openrod 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/THIRD_PARTY_NOTICES.md +84 -1
- package/dist/assets/index-DBqg9X9x.js +553 -0
- package/dist/assets/index-HZ0q_FBv.css +1 -0
- package/dist/assets/index.esm-BqjC2fhp.js +376 -0
- package/dist/assets/index.esm-Cj6nXjOx.js +16 -0
- package/dist/assets/index.esm-Z1y-oluO.js +1666 -0
- package/dist/assets/terminal-view-D-SQcdM5.js +40 -0
- package/dist/index.html +3 -3
- package/package.json +8 -1
- package/server/announcements.js +22 -0
- package/server/api.js +54 -11
- package/server/capabilities.js +13 -0
- package/server/cli.js +18 -2
- package/server/cloud-deployment.js +29 -0
- package/server/cloud-proxy.js +19 -9
- package/server/cloud-runtime.js +72 -0
- package/server/cloud-ssh-proxy.cjs +22 -4
- package/server/cloud-transfer.js +1 -1
- package/server/compute.js +18 -7
- package/server/image-templates.js +17 -0
- package/server/ingress.js +3 -0
- package/server/local-cloud-native.js +7 -1
- package/server/local-cloud.js +3 -3
- package/server/machines.js +33 -18
- package/server/policy-template-store.js +1 -0
- package/server/remote-gateway.js +26 -6
- package/server/remote-http.js +1 -1
- package/server/resource-import-portable.js +155 -0
- package/server/resource-imports.js +412 -0
- package/server/sandbox-identity.js +1 -1
- package/server/security.js +30 -14
- package/server/setup-discovery.js +2 -1
- package/server/setup-packages.js +138 -59
- package/server/setup-preparation.js +4 -3
- package/server/start.js +29 -7
- package/server/worker-auth.js +2 -2
- package/shared/agent-access.js +26 -4
- package/shared/analytics-release.json +5 -0
- package/src/lib/activity-inventory.js +1 -1
- package/src/lib/analytics.js +334 -0
- package/src/lib/api.js +28 -11
- package/src/lib/cloud-sign-in-error.js +13 -0
- package/src/lib/cloud-transfer.js +1 -1
- package/src/lib/combined-activity.js +95 -0
- package/src/lib/connection-host.js +6 -0
- package/src/lib/egress-inventory.js +63 -0
- package/src/lib/local-cloud.js +16 -3
- package/src/lib/location-choice.js +7 -0
- package/src/lib/location-data-reader.js +25 -0
- package/src/lib/locations.js +18 -8
- package/src/lib/placement.js +1 -1
- package/src/lib/resource-imports.js +63 -0
- package/src/lib/resource-sources.js +105 -0
- package/src/lib/sandbox-creations.js +14 -9
- package/src/lib/sandboxes.js +5 -1
- package/src/lib/working-location.js +10 -0
- package/dist/assets/index-89TNohi_.css +0 -1
- package/dist/assets/index-DoKK2G9s.js +0 -545
- package/dist/assets/terminal-view-DzqQnmh2.js +0 -40
|
@@ -1,545 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-view-DzqQnmh2.js","assets/terminal-view-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var Qz=Object.defineProperty;var Zz=(e,t,r)=>t in e?Qz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var tn=(e,t,r)=>Zz(e,typeof t!="symbol"?t+"":t,r);function Jz(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 CR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var S0={exports:{}},vd={};/**
|
|
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 XN;function eP(){if(XN)return vd;XN=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 vd.Fragment=t,vd.jsx=r,vd.jsxs=r,vd}var WN;function tP(){return WN||(WN=1,S0.exports=eP()),S0.exports}var s=tP(),N0={exports:{}},Rt={};/**
|
|
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 QN;function nP(){if(QN)return Rt;QN=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"),x=Symbol.for("react.view_transition"),v=Symbol.iterator;function j(P){return P===null||typeof P!="object"?null:(P=v&&P[v]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,C={};function T(P,U,Z){this.props=P,this.context=U,this.refs=C,this.updater=Z||S}T.prototype.isReactComponent={},T.prototype.setState=function(P,U){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,U,"setState")},T.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function k(){}k.prototype=T.prototype;function A(P,U,Z){this.props=P,this.context=U,this.refs=C,this.updater=Z||S}var R=A.prototype=new k;R.constructor=A,N(R,T.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function E(){}var O={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function _(P,U,Z){var te=Z.ref;return{$$typeof:e,type:P,key:U,ref:te!==void 0?te:null,props:Z}}function B(P,U){return _(P.type,U,P.props)}function q(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function I(P){var U={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(Z){return U[Z]})}var L=/\/+/g;function H(P,U){return typeof P=="object"&&P!==null&&P.key!=null?I(""+P.key):U.toString(36)}function F(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(E,E):(P.status="pending",P.then(function(U){P.status==="pending"&&(P.status="fulfilled",P.value=U)},function(U){P.status==="pending"&&(P.status="rejected",P.reason=U)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function V(P,U,Z,te,le){var de=typeof P;(de==="undefined"||de==="boolean")&&(P=null);var oe=!1;if(P===null)oe=!0;else switch(de){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(P.$$typeof){case e:case t:oe=!0;break;case g:return oe=P._init,V(oe(P._payload),U,Z,te,le)}}if(oe)return le=le(P),oe=te===""?"."+H(P,0):te,M(le)?(Z="",oe!=null&&(Z=oe.replace(L,"$&/")+"/"),V(le,U,Z,"",function(W){return W})):le!=null&&(q(le)&&(le=B(le,Z+(le.key==null||P&&P.key===le.key?"":(""+le.key).replace(L,"$&/")+"/")+oe)),U.push(le)),1;oe=0;var ne=te===""?".":te+":";if(M(P))for(var ee=0;ee<P.length;ee++)te=P[ee],de=ne+H(te,ee),oe+=V(te,U,Z,de,le);else if(ee=j(P),typeof ee=="function")for(P=ee.call(P),ee=0;!(te=P.next()).done;)te=te.value,de=ne+H(te,ee++),oe+=V(te,U,Z,de,le);else if(de==="object"){if(typeof P.then=="function")return V(F(P),U,Z,te,le);throw U=String(P),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return oe}function G(P,U,Z){if(P==null)return P;var te=[],le=0;return V(P,te,"","",function(de){return U.call(Z,de,le++)}),te}function X(P){if(P._status===-1){var U=P._result,Z=U();Z.then(function(te){(P._status===0||P._status===-1)&&(P._status=1,P._result=te,Z.status===void 0&&(Z.status="fulfilled",Z.value=te))},function(te){(P._status===0||P._status===-1)&&(P._status=2,P._result=te,Z.status===void 0&&(Z.status="rejected",Z.reason=te))}),P._status===-1&&(P._status=0,P._result=Z)}if(P._status===1)return P._result.default;throw P._result}var $=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)};function Q(P){var U=O.T,Z={};Z.types=U!==null?U.types:null,O.T=Z;try{var te=P(),le=O.S;le!==null&&le(Z,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(E,$)}catch(de){$(de)}finally{U!==null&&Z.types!==null&&(U.types=Z.types),O.T=U}}function K(P){var U=O.T;if(U!==null){var Z=U.types;Z===null?U.types=[P]:Z.indexOf(P)===-1&&Z.push(P)}else Q(K.bind(null,P))}var se={map:G,forEach:function(P,U,Z){G(P,function(){U.apply(this,arguments)},Z)},count:function(P){var U=0;return G(P,function(){U++}),U},toArray:function(P){return G(P,function(U){return U})||[]},only:function(P){if(!q(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Rt.Activity=p,Rt.Children=se,Rt.Component=T,Rt.Fragment=r,Rt.Profiler=l,Rt.PureComponent=A,Rt.StrictMode=a,Rt.Suspense=m,Rt.ViewTransition=x,Rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Rt.__COMPILER_RUNTIME={__proto__:null,c:function(P){return O.H.useMemoCache(P)}},Rt.addTransitionType=K,Rt.cache=function(P){return function(){return P.apply(null,arguments)}},Rt.cacheSignal=function(){return null},Rt.cloneElement=function(P,U,Z){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var te=N({},P.props),le=P.key;if(U!=null)for(de in U.key!==void 0&&(le=""+U.key),U)!z.call(U,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&U.ref===void 0||(te[de]=U[de]);var de=arguments.length-2;if(de===1)te.children=Z;else if(1<de){for(var oe=Array(de),ne=0;ne<de;ne++)oe[ne]=arguments[ne+2];te.children=oe}return _(P.type,le,te)},Rt.createContext=function(P){return P={$$typeof:u,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:c,_context:P},P},Rt.createElement=function(P,U,Z){var te,le={},de=null;if(U!=null)for(te in U.key!==void 0&&(de=""+U.key),U)z.call(U,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(le[te]=U[te]);var oe=arguments.length-2;if(oe===1)le.children=Z;else if(1<oe){for(var ne=Array(oe),ee=0;ee<oe;ee++)ne[ee]=arguments[ee+2];le.children=ne}if(P&&P.defaultProps)for(te in oe=P.defaultProps,oe)le[te]===void 0&&(le[te]=oe[te]);return _(P,de,le)},Rt.createRef=function(){return{current:null}},Rt.forwardRef=function(P){return{$$typeof:f,render:P}},Rt.isValidElement=q,Rt.lazy=function(P){return{$$typeof:g,_payload:{_status:-1,_result:P},_init:X}},Rt.memo=function(P,U){return{$$typeof:h,type:P,compare:U===void 0?null:U}},Rt.startTransition=Q,Rt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Rt.use=function(P){return O.H.use(P)},Rt.useActionState=function(P,U,Z){return O.H.useActionState(P,U,Z)},Rt.useCallback=function(P,U){return O.H.useCallback(P,U)},Rt.useContext=function(P){return O.H.useContext(P)},Rt.useDebugValue=function(){},Rt.useDeferredValue=function(P,U){return O.H.useDeferredValue(P,U)},Rt.useEffect=function(P,U){return O.H.useEffect(P,U)},Rt.useEffectEvent=function(P){return O.H.useEffectEvent(P)},Rt.useId=function(){return O.H.useId()},Rt.useImperativeHandle=function(P,U,Z){return O.H.useImperativeHandle(P,U,Z)},Rt.useInsertionEffect=function(P,U){return O.H.useInsertionEffect(P,U)},Rt.useLayoutEffect=function(P,U){return O.H.useLayoutEffect(P,U)},Rt.useMemo=function(P,U){return O.H.useMemo(P,U)},Rt.useOptimistic=function(P,U){return O.H.useOptimistic(P,U)},Rt.useReducer=function(P,U,Z){return O.H.useReducer(P,U,Z)},Rt.useRef=function(P){return O.H.useRef(P)},Rt.useState=function(P){return O.H.useState(P)},Rt.useSyncExternalStore=function(P,U,Z){return O.H.useSyncExternalStore(P,U,Z)},Rt.useTransition=function(){return O.H.useTransition()},Rt.version="19.3.0",Rt}var ZN;function lf(){return ZN||(ZN=1,N0.exports=nP()),N0.exports}var b=lf();const Ze=CR(b),sP=Jz({__proto__:null,default:Ze},[b]);var rP=(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",N=S&&c?l.map(C=>c[C]||C):l;S?(m.classList.remove(...N),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 x(){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"?x():v;g(j)}catch{}},JN=["light","dark"],kR="(prefers-color-scheme: dark)",oP=typeof window>"u",qv=b.createContext(void 0),aP={setTheme:e=>{},themes:[]},TR=()=>{var e;return(e=b.useContext(qv))!=null?e:aP},iP=e=>b.useContext(qv)?b.createElement(b.Fragment,null,e.children):b.createElement(cP,{...e}),lP=["light","dark"],cP=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:a=!0,storageKey:l="theme",themes:c=lP,defaultTheme:u=r?"system":"light",attribute:f="data-theme",value:m,children:h,nonce:g,scriptProps:p})=>{let[x,v]=b.useState(()=>dP(l,u)),[j,S]=b.useState(()=>x==="system"?C0():x),N=m?Object.values(m):c,C=b.useCallback(R=>{let M=R;if(!M)return;R==="system"&&r&&(M=C0());let E=m?m[M]:M,O=t?fP(g):null,z=document.documentElement,_=B=>{B==="class"?(z.classList.remove(...N),E&&z.classList.add(E)):B.startsWith("data-")&&(E?z.setAttribute(B,E):z.removeAttribute(B))};if(Array.isArray(f)?f.forEach(_):_(f),a){let B=JN.includes(u)?u:null,q=JN.includes(M)?M:B;z.style.colorScheme=q}O==null||O()},[g]),T=b.useCallback(R=>{let M=typeof R=="function"?R(x):R;v(M);try{localStorage.setItem(l,M)}catch{}},[x]),k=b.useCallback(R=>{let M=C0(R);S(M),x==="system"&&r&&!e&&C("system")},[x,e]);b.useEffect(()=>{let R=window.matchMedia(kR);return R.addListener(k),k(R),()=>R.removeListener(k)},[k]),b.useEffect(()=>{let R=M=>{M.key===l&&(M.newValue?v(M.newValue):T(u))};return window.addEventListener("storage",R),()=>window.removeEventListener("storage",R)},[T]),b.useEffect(()=>{C(e??x)},[e,x]);let A=b.useMemo(()=>({theme:x,setTheme:T,forcedTheme:e,resolvedTheme:x==="system"?j:x,themes:r?[...c,"system"]:c,systemTheme:r?j:void 0}),[x,T,e,j,r,c]);return b.createElement(qv.Provider,{value:A},b.createElement(uP,{forcedTheme:e,storageKey:l,attribute:f,enableSystem:r,enableColorScheme:a,defaultTheme:u,value:m,themes:c,nonce:g,scriptProps:p}),h)},uP=b.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 b.createElement("script",{...h,suppressHydrationWarning:!0,nonce:typeof window>"u"?m:"",dangerouslySetInnerHTML:{__html:`(${rP.toString()})(${g})`}})}),dP=(e,t)=>{if(oP)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},fP=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)}},C0=e=>(e||(e=window.matchMedia(kR)),e.matches?"dark":"light"),k0={exports:{}},wd={},T0={exports:{}},E0={};/**
|
|
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 eC;function mP(){return eC||(eC=1,(function(e){function t(F,V){var G=F.length;F.push(V);e:for(;0<G;){var X=G-1>>>1,$=F[X];if(0<l($,V))F[X]=V,F[G]=$,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,$=F.length,Q=$>>>1;X<Q;){var K=2*(X+1)-1,se=F[K],P=K+1,U=F[P];if(0>l(se,G))P<$&&0>l(U,se)?(F[X]=U,F[P]=G,X=P):(F[X]=se,F[K]=G,X=K);else if(P<$&&0>l(U,G))F[X]=U,F[P]=G,X=P;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,x=3,v=!1,j=!1,S=!1,N=!1,C=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,k=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 R(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(R,V.startTime-F)}}var M=!1,E=-1,O=5,z=-1;function _(){return N?!0:!(e.unstable_now()-z<O)}function B(){if(N=!1,M){var F=e.unstable_now();z=F;var V=!0;try{e:{j=!1,S&&(S=!1,T(E),E=-1),v=!0;var G=x;try{t:{for(A(F),p=r(m);p!==null&&!(p.expirationTime>F&&_());){var X=p.callback;if(typeof X=="function"){p.callback=null,x=p.priorityLevel;var $=X(p.expirationTime<=F);if(F=e.unstable_now(),typeof $=="function"){p.callback=$,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 Q=r(h);Q!==null&&H(R,Q.startTime-F),V=!1}}break e}finally{p=null,x=G,v=!1}V=void 0}}finally{V?q():M=!1}}}var q;if(typeof k=="function")q=function(){k(B)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,L=I.port2;I.port1.onmessage=B,q=function(){L.postMessage(null)}}else q=function(){C(B,0)};function H(F,V){E=C(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 x},e.unstable_next=function(F){switch(x){case 1:case 2:case 3:var V=3;break;default:V=x}var G=x;x=V;try{return F()}finally{x=G}},e.unstable_requestPaint=function(){N=!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=x;x=F;try{return V()}finally{x=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 $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=G+$,F={id:g++,callback:V,priorityLevel:F,startTime:G,expirationTime:$,sortIndex:-1},G>X?(F.sortIndex=G,t(h,F),r(m)===null&&F===r(h)&&(S?(T(E),E=-1):S=!0,H(R,G-X))):(F.sortIndex=$,t(m,F),j||v||(j=!0,M||(M=!0,q()))),F},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(F){var V=x;return function(){var G=x;x=V;try{return F.apply(this,arguments)}finally{x=G}}}})(E0)),E0}var tC;function hP(){return tC||(tC=1,T0.exports=mP()),T0.exports}var R0={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 nC;function pP(){if(nC)return Rs;nC=1;var e=lf();function t(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)p+="&args[]="+encodeURIComponent(arguments[x])}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,x){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:x}}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 x=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,x)},Rs.flushSync=function(g){var p=m.T,x=a.p;try{if(m.T=null,a.p=2,g)return g()}finally{m.T=p,a.p=x,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 x=p.as,v=h(x,p.crossOrigin),j=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;x==="style"?a.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:j,fetchPriority:S}):x==="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 x=h(p.as,p.crossOrigin);a.d.M(g,{crossOrigin:x,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 x=p.as,v=h(x,p.crossOrigin);a.d.L(g,x,{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 x=h(p.as,p.crossOrigin);a.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:x,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,x){return m.H.useFormState(g,p,x)},Rs.useFormStatus=function(){return m.H.useHostTransitionStatus()},Rs.version="19.3.0",Rs}var sC;function ER(){if(sC)return R0.exports;sC=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(),R0.exports=pP(),R0.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 rC;function gP(){if(rC)return wd;rC=1;var e=hP(),t=lf(),r=ER();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 D=!1,Y=y.child;Y;){if(Y===i){D=!0,i=y,d=w;break}if(Y===d){D=!0,d=y,i=w;break}Y=Y.sibling}if(!D){for(Y=w.child;Y;){if(Y===i){D=!0,i=w,d=y;break}if(Y===d){D=!0,d=w,i=y;break}Y=Y.sibling}if(!D)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 x(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=x(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 N(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 C=null,T=null;function k(n,o,i){return n===i?!0:n===o?(C=n,!0):!1}function A(n,o,i){return n===i?(T=n,!1):n===o?(T!==null&&(C=n),!0):!1}function R(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 E=Object.assign,O=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),L=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"),$=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),K=Symbol.for("react.legacy_hidden"),se=Symbol.for("react.memo_cache_sentinel"),P=Symbol.for("react.view_transition"),U=Symbol.for("react.recoverable"),Z=Symbol.iterator;function te(n){return n===null||typeof n!="object"?null:(n=Z&&n[Z]||n["@@iterator"],typeof n=="function"?n:null)}var le=Symbol.for("react.client.reference");function de(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 B:return"Fragment";case I:return"Profiler";case q:return"StrictMode";case V:return"Suspense";case G:return"SuspenseList";case Q:return"Activity";case P:return"ViewTransition"}if(typeof n=="object")switch(n.$$typeof){case _:return"Portal";case H:return n.displayName||"Context";case L: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:de(n.type)||"Memo";case $:o=n._payload,n=n._init;try{return de(n(o))}catch{}}return null}var oe=Array.isArray,ne=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},ce=[],Re=-1;function _e(n){return{current:n}}function Ne(n){0>Re||(n.current=ce[Re],ce[Re]=null,Re--)}function Ae(n,o){Re++,ce[Re]=n.current,n.current=o}var J=_e(null),re=_e(null),xe=_e(null),he=_e(null);function Be(n,o){switch(Ae(xe,o),Ae(re,n),Ae(J,null),o.nodeType){case 9:case 11:n=(n=o.documentElement)&&(n=n.namespaceURI)?rN(n):0;break;default:if(n=o.tagName,o=o.namespaceURI)o=rN(o),n=oN(o,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Ne(J),Ae(J,n)}function we(){Ne(J),Ne(re),Ne(xe)}function Ye(n){var o=n.memoizedState;o!==null&&($c._currentValue=o.memoizedState,Ae(he,n)),o=J.current;var i=oN(o,n.type);o!==i&&(Ae(re,n),Ae(J,i))}function Ee(n){re.current===n&&(Ne(J),Ne(re)),he.current===n&&(Ne(he),$c._currentValue=W)}var Ce,be;function Ue(n){if(Ce===void 0)try{throw Error()}catch(i){var o=i.stack.trim().match(/\n( *(at )?)/);Ce=o&&o[1]||"",be=-1<i.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+Ce+n+be}var Je=!1;function dt(n,o){if(!n||Je)return"";Je=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(o){var Pe=function(){throw Error()};if(Object.defineProperty(Pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Pe,[])}catch(tt){var ge=tt}Reflect.construct(n,[],Pe)}else{try{Pe.call()}catch(tt){ge=tt}Pe=!1;try{var Se=Object.getOwnPropertyDescriptor(n.prototype,"props");Object.defineProperty(n.prototype,"props",{configurable:!0,set:function(){throw Error()}}),Pe=!0,new n}finally{Pe&&(Se!==void 0?Object.defineProperty(n.prototype,"props",Se):delete n.prototype.props)}}}else{try{throw Error()}catch(tt){ge=tt}(Pe=n())&&typeof Pe.catch=="function"&&Pe.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(),D=w[0],Y=w[1];if(D&&Y){var ie=D.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 Te=`
|
|
47
|
-
`+ie[d].replace(" at new "," at ");return n.displayName&&Te.includes("<anonymous>")&&(Te=Te.replace("<anonymous>",n.displayName)),Te}while(1<=d&&0<=y);break}}}finally{Je=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?Ue(i):""}function lt(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 dt(n.type,!1);case 11:return dt(n.type.render,!1);case 1:return dt(n.type,!0);case 31:return Ue("Activity");case 30:return Ue("ViewTransition");default:return""}}function Ie(n){try{var o="",i=null;do o+=lt(n,i),i=n,n=n.return;while(n);return o}catch(d){return`
|
|
48
|
-
Error generating stack: `+d.message+`
|
|
49
|
-
`+d.stack}}var ot=Object.prototype.hasOwnProperty,We=e.unstable_scheduleCallback,me=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,Me=e.unstable_requestPaint,nt=e.unstable_now,Ge=e.unstable_getCurrentPriorityLevel,qe=e.unstable_ImmediatePriority,ht=e.unstable_UserBlockingPriority,pe=e.unstable_NormalPriority,De=e.unstable_LowPriority,Qe=e.unstable_IdlePriority,Fe=e.log,yt=e.unstable_setDisableYieldValue,Et=null,Nt=null;function Vt(n){if(typeof Fe=="function"&&yt(n),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(Et,n)}catch{}}var Ct=Math.clz32?Math.clz32:ae,ct=Math.log,vt=Math.LN2;function ae(n){return n>>>=0,n===0?32:31-(ct(n)/vt|0)|0}var Xe=256,ut=262144,Ft=4194304;function An(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 zt(n,o,i){var d=n.pendingLanes;if(d===0)return 0;var y=0,w=n.suspendedLanes,D=n.pingedLanes;n=n.warmLanes;var Y=d&134217727;return Y!==0?(d=Y&~w,d!==0?y=An(d):(D&=Y,D!==0?y=An(D):i||(i=Y&~n,i!==0&&(y=An(i))))):(Y=d&~w,Y!==0?y=An(Y):D!==0?y=An(D):i||(i=d&~n,i!==0&&(y=An(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 _t(n,o){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&o)===0}function On(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-Ct(i),y=1<<d;o|=n[d],i&=~y}return o}function io(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 vs(){var n=Ft;return Ft<<=1,(Ft&62914560)===0&&(Ft=4194304),n}function Lr(n){for(var o=[],i=0;31>i;i++)o.push(n);return o}function $s(n,o){n.pendingLanes|=o,o!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function cr(n,o,i,d,y,w){var D=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=D&~i;0<i;){var Te=31-Ct(i),Pe=1<<Te;Y[Te]=0,ie[Te]=-1;var ge=ve[Te];if(ge!==null)for(ve[Te]=null,Te=0;Te<ge.length;Te++){var Se=ge[Te];Se!==null&&(Se.lane&=-536870913)}i&=~Pe}d!==0&&Gn(n,d,0),w!==0&&y===0&&n.tag!==0&&(n.suspendedLanes|=w&~(D&~o))}function Gn(n,o,i){n.pendingLanes|=o,n.suspendedLanes&=~o;var d=31-Ct(o);n.entangledLanes|=o,n.entanglements[d]=n.entanglements[d]|1073741824|i&261930}function To(n,o){var i=n.entangledLanes|=o;for(n=n.entanglements;i;){var d=31-Ct(i),y=1<<d;y&o|n[d]&o&&(n[d]|=o),i&=~y}}function Fi(n,o){var i=o&-o;return i=(i&42)!==0?1:qa(i),(i&(n.suspendedLanes|o))!==0?0:i}function qa(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 $r(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Br(){var n=ee.p;return n!==0?n:(n=window.event,n===void 0?32:UN(n.type))}function Gi(n,o){var i=ee.p;try{return ee.p=n,o()}finally{ee.p=i}}var qn=Math.random().toString(36).slice(2),zn="__reactFiber$"+qn,ws="__reactProps$"+qn,ur="__reactContainer$"+qn,Eu="__reactEvents$"+qn,Jl="__reactListeners$"+qn,ec="__reactHandles$"+qn,Ya="__reactResources$"+qn,qi="__reactMarker$"+qn,tc="__reactLoad$"+qn;function nc(n){delete n[zn],delete n[ws],delete n[Jl],delete n[ec]}function lo(n){var o;if(o=n[zn])return o;for(var i=n.parentNode;i;){if(o=i[ur]||i[zn]){if(i=o.alternate,o.child!==null||i!==null&&i.child!==null)for(n=jN(n);n!==null;){if(i=n[zn])return i;n=jN(n)}return o}n=i,i=n.parentNode}return null}function Yi(n){if(n=n[zn]||n[ur]){var o=n.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return n}return null}function ke(n){var o=n.tag;if(o===5||o===26||o===27||o===6)return n.stateNode;throw Error(a(33))}function $e(n){var o=n[Ya];return o||(o=n[Ya]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function Ve(n){n[qi]=!0}function gt(n){n[tc]=void 0}var Ot=new Set,Tt={};function $t(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]*$"),St={},Mt={};function en(n){return ot.call(Mt,n)?!0:ot.call(St,n)?!1:sn.test(n)?Mt[n]=!0:(St[n]=!0,!1)}var wt=!1;function ns(){var n=wt;return wt=!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 dr(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 Xn(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 Wn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function sc(n){var o=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Ru(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(D){i=""+D,w.call(this,D)}}),Object.defineProperty(n,o,{enumerable:d.enumerable}),{getValue:function(){return i},setValue:function(D){i=""+D},stopTracking:function(){n._valueTracker=null,delete n[o]}}}}function sa(n){if(!n._valueTracker){var o=sc(n)?"checked":"value";n._valueTracker=Ru(n,o,""+n[o])}}function rc(n){if(!n)return!1;var o=n._valueTracker;if(!o)return!0;var i=o.getValue(),d="";return n&&(d=sc(n)?n.checked?"true":"false":n.value),n=d,n!==i?(o.setValue(n),!0):!1}var Vf=/[\n"\\]/g;function kn(n){return n.replace(Vf,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Ms(n,o,i,d,y,w,D,Y){n.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?n.type=D:n.removeAttribute("type"),o!=null?D==="number"?(o===0&&n.value===""||n.value!=o)&&(n.value=""+Wn(o)):n.value!==""+Wn(o)&&(n.value=""+Wn(o)):D!=="submit"&&D!=="reset"||n.removeAttribute("value"),o!=null?D==="number"&&n.value==o?oc(n,Wn(n.value)):oc(n,Wn(o)):i!=null?oc(n,Wn(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=""+Wn(Y):n.removeAttribute("name")}function Ka(n,o,i,d,y,w,D,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)){sa(n);return}i=i!=null?""+Wn(i):"",o=o!=null?""+Wn(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,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(n.name=D),sa(n)}function oc(n,o){n.defaultValue!==""+o&&(n.defaultValue=""+o)}function Xs(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=""+Wn(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 ac(n,o,i){if(o!=null&&(o=""+Wn(o),o!==n.value&&(n.value=o),i==null)){n.defaultValue!==o&&(n.defaultValue=o);return}n.defaultValue=i!=null?""+Wn(i):""}function fr(n,o,i,d){if(o==null){if(d!=null){if(i!=null)throw Error(a(92));if(oe(d)){if(1<d.length)throw Error(a(93));d=d[0]}i=d}i==null&&(i=""),o=i}i=Wn(o),n.defaultValue=i,d=n.textContent,d===i&&d!==""&&d!==null&&(n.value=d),sa(n)}function Bs(n,o){if(o){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=o;return}}n.textContent=o}var Xa=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 Au(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||Xa.has(o)?o==="float"?n.cssFloat=i:n[o]=(""+i).trim():n[o]=i+"px"}function mr(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]="",wt=!0);for(var y in o)d=o[y],o.hasOwnProperty(y)&&i[y]!==d&&(Au(n,y,d),wt=!0)}else for(var w in o)o.hasOwnProperty(w)&&Au(n,w,o[w])}function Ki(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 Ou=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"]]),Mu=/^[\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 Mu.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Vs(){}var Xi=null;function Wi(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Qt=null,hs=null;function Vr(n){var o=Yi(n);if(o&&(n=o.stateNode)){var i=n[ws]||null;e:switch(n=o.stateNode,o.type){case"input":if(Ms(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));Ms(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&&rc(d)}break e;case"textarea":ac(n,i.value,i.defaultValue);break e;case"select":o=i.value,o!=null&&Xs(n,!!i.multiple,o,!1)}}}var hr=!1;function Qi(n,o,i){if(hr)return n(o,i);hr=!0;try{var d=n(o);return d}finally{if(hr=!1,(Qt!==null||hs!==null)&&(Vm(),Qt&&(o=Qt,n=hs,hs=Qt=null,Vr(o),n)))for(o=0;o<n.length;o++)Vr(n[o])}}function ra(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"),Zi=!1;if(Ss)try{var Du={};Object.defineProperty(Du,"passive",{get:function(){Zi=!0}}),window.addEventListener("test",Du,Du),window.removeEventListener("test",Du,Du)}catch{Zi=!1}var Wa=null,ix=null,Uf=null;function ej(){if(Uf)return Uf;var n,o=ix,i=o.length,d,y="value"in Wa?Wa.value:Wa.textContent,w=y.length;for(n=0;n<i&&o[n]===y[n];n++);var D=i-n;for(d=1;d<=D&&o[i-d]===y[w-d];d++);return Uf=y.slice(n,1<d?1-d:void 0)}function Hf(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 Ff(){return!0}function tj(){return!1}function Us(n){function o(i,d,y,w,D){this._reactName=i,this._targetInst=y,this.type=d,this.nativeEvent=w,this.target=D,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)?Ff:tj,this.isPropagationStopped=tj,this}return E(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=Ff)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Ff)},persist:function(){},isPersistent:Ff}),o}var Qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gf=Us(Qa),zu=E({},Qa,{view:0,detail:0}),j4=Us(zu),lx,cx,Pu,qf=E({},zu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dx,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!==Pu&&(Pu&&n.type==="mousemove"?(lx=n.screenX-Pu.screenX,cx=n.screenY-Pu.screenY):cx=lx=0,Pu=n),lx)},movementY:function(n){return"movementY"in n?n.movementY:cx}}),nj=Us(qf),S4=E({},qf,{dataTransfer:0}),N4=Us(S4),C4=E({},zu,{relatedTarget:0}),ux=Us(C4),k4=E({},Qa,{animationName:0,elapsedTime:0,pseudoElement:0}),T4=Us(k4),E4=E({},Qa,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),R4=Us(E4),A4=E({},Qa,{data:0}),sj=Us(A4),O4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},M4={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"},D4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function z4(n){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(n):(n=D4[n])?!!o[n]:!1}function dx(){return z4}var P4=E({},zu,{key:function(n){if(n.key){var o=O4[n.key]||n.key;if(o!=="Unidentified")return o}return n.type==="keypress"?(n=Hf(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?M4[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dx,charCode:function(n){return n.type==="keypress"?Hf(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Hf(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),I4=Us(P4),_4=E({},qf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rj=Us(_4),L4=E({},Qa,{submitter:0}),$4=Us(L4),B4=E({},zu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dx}),V4=Us(B4),U4=E({},Qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),H4=Us(U4),F4=E({},qf,{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}),G4=Us(F4),q4=E({},Qa,{newState:0,oldState:0,source:0}),Y4=Us(q4),K4=[9,13,27,32],fx=Ss&&"CompositionEvent"in window,Iu=null;Ss&&"documentMode"in document&&(Iu=document.documentMode);var X4=Ss&&"TextEvent"in window&&!Iu,oj=Ss&&(!fx||Iu&&8<Iu&&11>=Iu),aj=" ",ij=!1;function lj(n,o){switch(n){case"keyup":return K4.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cj(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ic=!1;function W4(n,o){switch(n){case"compositionend":return cj(o);case"keypress":return o.which!==32?null:(ij=!0,aj);case"textInput":return n=o.data,n===aj&&ij?null:n;default:return null}}function Q4(n,o){if(ic)return n==="compositionend"||!fx&&lj(n,o)?(n=ej(),Uf=ix=Wa=null,ic=!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 oj&&o.locale!=="ko"?null:o.data;default:return null}}var Z4={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 uj(n){var o=n&&n.nodeName&&n.nodeName.toLowerCase();return o==="input"?!!Z4[n.type]:o==="textarea"}function dj(n,o,i,d){Qt?hs?hs.push(d):hs=[d]:Qt=d,o=Ym(o,"onChange"),0<o.length&&(i=new Gf("onChange","change",null,i,d),n.push({event:i,listeners:o}))}var _u=null,Lu=null;function J4(n){ZS(n,0)}function Yf(n){var o=ke(n);if(rc(o))return n}function fj(n,o){if(n==="change")return o}var mj=!1;if(Ss){var mx;if(Ss){var hx="oninput"in document;if(!hx){var hj=document.createElement("div");hj.setAttribute("oninput","return;"),hx=typeof hj.oninput=="function"}mx=hx}else mx=!1;mj=mx&&(!document.documentMode||9<document.documentMode)}function pj(){_u&&(_u.detachEvent("onpropertychange",gj),Lu=_u=null)}function gj(n){if(n.propertyName==="value"&&Yf(Lu)){var o=[];dj(o,Lu,n,Wi(n)),Qi(J4,o)}}function eD(n,o,i){n==="focusin"?(pj(),_u=o,Lu=i,_u.attachEvent("onpropertychange",gj)):n==="focusout"&&pj()}function tD(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Yf(Lu)}function nD(n,o){if(n==="click")return Yf(o)}function sD(n,o){if(n==="input"||n==="change")return Yf(o)}function rD(n,o){return n===o&&(n!==0||1/n===1/o)||n!==n&&o!==o}var pr=typeof Object.is=="function"?Object.is:rD;function $u(n,o){if(pr(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(!ot.call(o,y)||!pr(n[y],o[y]))return!1}return!0}function px(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 xj(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function bj(n,o){var i=xj(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=xj(i)}}function yj(n,o){return n&&o?n===o?!0:n&&n.nodeType===3?!1:o&&o.nodeType===3?yj(n,o.parentNode):"contains"in n?n.contains(o):n.compareDocumentPosition?!!(n.compareDocumentPosition(o)&16):!1:!1}function vj(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var o=px(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=px(n.document)}return o}function gx(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 oD=Ss&&"documentMode"in document&&11>=document.documentMode,lc=null,xx=null,Bu=null,bx=!1;function wj(n,o,i){var d=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;bx||lc==null||lc!==px(d)||(d=lc,"selectionStart"in d&&gx(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}),Bu&&$u(Bu,d)||(Bu=d,d=Ym(xx,"onSelect"),0<d.length&&(o=new Gf("onSelect","select",null,o,i),n.push({event:o,listeners:d}),o.target=lc)))}function Ji(n,o){var i={};return i[n.toLowerCase()]=o.toLowerCase(),i["Webkit"+n]="webkit"+o,i["Moz"+n]="moz"+o,i}var cc={animationend:Ji("Animation","AnimationEnd"),animationiteration:Ji("Animation","AnimationIteration"),animationstart:Ji("Animation","AnimationStart"),transitionrun:Ji("Transition","TransitionRun"),transitionstart:Ji("Transition","TransitionStart"),transitioncancel:Ji("Transition","TransitionCancel"),transitionend:Ji("Transition","TransitionEnd")},yx={},jj={};Ss&&(jj=document.createElement("div").style,"AnimationEvent"in window||(delete cc.animationend.animation,delete cc.animationiteration.animation,delete cc.animationstart.animation),"TransitionEvent"in window||delete cc.transitionend.transition);function el(n){if(yx[n])return yx[n];if(!cc[n])return n;var o=cc[n],i;for(i in o)if(o.hasOwnProperty(i)&&i in jj)return yx[n]=o[i];return n}var Sj=el("animationend"),Nj=el("animationiteration"),Cj=el("animationstart"),aD=el("transitionrun"),iD=el("transitionstart"),lD=el("transitioncancel"),kj=el("transitionend"),Tj=new Map,vx="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(" ");vx.push("scrollEnd");function co(n,o){Tj.set(n,o),$t(o,[n])}var cD=0;function oa(n,o){if(n.name!=null&&n.name!=="auto")return n.name;if(o.autoName!==null)return o.autoName;n=ho.identifierPrefix;var i=cD++;return n="_"+n+"t_"+i.toString(32)+"_",o.autoName=n}function Ej(n){if(n==null||typeof n=="string")return n;var o=null,i=Rc;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 aa(n,o){return n=Ej(n),o=Ej(o),o==null?n==="auto"?null:n:o==="auto"?null:o}var Kf=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)},Ur=[],uc=0,wx=0;function Xf(){for(var n=uc,o=wx=uc=0;o<n;){var i=Ur[o];Ur[o++]=null;var d=Ur[o];Ur[o++]=null;var y=Ur[o];Ur[o++]=null;var w=Ur[o];if(Ur[o++]=null,d!==null&&y!==null){var D=d.pending;D===null?y.next=y:(y.next=D.next,D.next=y),d.pending=y}w!==0&&Rj(i,y,w)}}function Wf(n,o,i,d){Ur[uc++]=n,Ur[uc++]=o,Ur[uc++]=i,Ur[uc++]=d,wx|=d,n.lanes|=d,n=n.alternate,n!==null&&(n.lanes|=d)}function jx(n,o,i,d){return Wf(n,o,i,d),Qf(n)}function tl(n,o){return Wf(n,null,null,o),Qf(n)}function Rj(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-Ct(i),n=w.hiddenUpdates,d=n[y],d===null?n[y]=[o]:d.push(o),o.lane=i|536870912),w):null}function Qf(n){if(50<ld)throw ld=0,Bm=null,Error(a(185));for(var o=n.return;o!==null;)n=o,o=n.return;return n.tag===3?n.stateNode:null}var dc={};function uD(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 Ws(n,o,i,d){return new uD(n,o,i,d)}function Sx(n){return n=n.prototype,!(!n||!n.isReactComponent)}function ia(n,o){var i=n.alternate;return i===null?(i=Ws(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 Aj(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 Zf(n,o,i,d,y,w){var D=0;if(d=n,typeof d=="function")Sx(d)&&(D=1);else if(typeof d=="string")D=Lz(n,i,J.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(d){case Q:return n=Ws(31,i,o,y),n.elementType=Q,n.lanes=w,n;case B:return nl(i.children,y,w,o);case q:D=8,y|=24;break;case I:return n=Ws(12,i,o,y|2),n.elementType=I,n.lanes=w,n;case V:return n=Ws(13,i,o,y),n.elementType=V,n.lanes=w,n;case G:return n=Ws(19,i,o,y),n.elementType=G,n.lanes=w,n;case K:case P:return n=y|32,n=Ws(30,i,o,n),n.elementType=P,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:D=10;break e;case L:D=9;break e;case F:D=11;break e;case X:D=14;break e;case $:D=16,d=null;break e}D=29,i=Error(a(130,n===null?"null":typeof n,"")),d=null}return o=Ws(D,i,o,y),o.elementType=n,o.type=d,o.lanes=w,o}function nl(n,o,i,d){return n=Ws(7,n,d,o),n.lanes=i,n}function Nx(n,o,i){return n=Ws(6,n,null,o),n.lanes=i,n}function Oj(n){var o=Ws(18,null,null,0);return o.stateNode=n,o}function Cx(n,o,i){return o=Ws(4,n.children!==null?n.children:[],n.key,o),o.lanes=i,o.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},o}var Mj=new WeakMap;function Hr(n,o){if(typeof n=="object"&&n!==null){var i=Mj.get(n);return i!==void 0?i:(o={value:n,source:o,stack:Ie(o)},Mj.set(n,o),o)}return{value:n,source:o,stack:Ie(o)}}var fc=[],mc=0,Jf=null,Vu=0,Fr=[],Gr=0,Za=null,Eo=1,Ro="";function la(n,o){fc[mc++]=Vu,fc[mc++]=Jf,Jf=n,Vu=o}function Dj(n,o,i){Fr[Gr++]=Eo,Fr[Gr++]=Ro,Fr[Gr++]=Za,Za=n;var d=Eo;n=Ro;var y=32-Ct(d)-1;d&=~(1<<y),i+=1;var w=32-Ct(o)+y;if(30<w){var D=y-y%5;w=(d&(1<<D)-1).toString(32),d>>=D,y-=D,Eo=1<<32-Ct(o)+y|i<<y|d,Ro=w+n}else Eo=1<<w|i<<y|d,Ro=n}function em(n){n.return!==null&&(la(n,1),Dj(n,1,0))}function kx(n){for(;n===Jf;)Jf=fc[--mc],fc[mc]=null,Vu=fc[--mc],fc[mc]=null;for(;n===Za;)Za=Fr[--Gr],Fr[Gr]=null,Ro=Fr[--Gr],Fr[Gr]=null,Eo=Fr[--Gr],Fr[Gr]=null}function zj(n,o){Fr[Gr++]=Eo,Fr[Gr++]=Ro,Fr[Gr++]=Za,Eo=o.id,Ro=o.overflow,Za=n}var ps=null,Sn=null,Ut=!1,Ja=null,qr=!1,Tx=Error(a(519));function ei(n){var o=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Uu(Hr(o,n)),Tx}function Pj(n){var o=n.stateNode,i=n.type,d=n.memoizedProps;switch(o[zn]=n,o[ws]=d,i){case"dialog":Kt("cancel",o),Kt("close",o);break;case"iframe":case"object":case"embed":Kt("load",o);break;case"video":case"audio":for(i=0;i<ud.length;i++)Kt(ud[i],o);break;case"source":Kt("error",o);break;case"img":case"image":case"link":Kt("error",o),Kt("load",o);break;case"details":Kt("toggle",o);break;case"input":Kt("invalid",o),Ka(o,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Kt("invalid",o);break;case"textarea":Kt("invalid",o),fr(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||nN(o.textContent,i)?(d.popover!=null&&(Kt("beforetoggle",o),Kt("toggle",o)),d.onScroll!=null&&Kt("scroll",o),d.onScrollEnd!=null&&Kt("scrollend",o),d.onClick!=null&&(o.onclick=Vs),o=!0):o=!1,o||ei(n,!0)}function tm(n){for(ps=n.return;ps;)switch(ps.tag){case 5:case 31:case 13:qr=!1;return;case 27:case 3:qr=!0;return;default:ps=ps.return}}function hc(n){if(n!==ps)return!1;if(!Ut)return tm(n),Ut=!0,!1;var o=n.tag,i;if((i=o!==3&&o!==27)&&((i=o===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||s0(n.type,n.memoizedProps)),i=!i),i&&Sn&&ei(n),tm(n),o===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));Sn=wN(n)}else if(o===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));Sn=wN(n)}else o===27?(o=Sn,gi(n.type)?(n=f0,f0=null,Sn=n):Sn=o):Sn=ps?Kr(n.stateNode.nextSibling):null;return!0}function sl(){Sn=ps=null,Ut=!1}function Ex(){var n=Ja;return n!==null&&(Js===null?Js=n:Js.push.apply(Js,n),Ja=null),n}function Uu(n){Ja===null?Ja=[n]:Ja.push(n)}var Rx=_e(null),rl=null,ca=null;function ti(n,o,i){Ae(Rx,o._currentValue),o._currentValue=i}function ua(n){n._currentValue=Rx.current,Ne(Rx)}function nm(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 Ax(n,o,i,d){var y=n.child;for(y!==null&&(y.return=n);y!==null;){var w=y.dependencies;if(w!==null){var D=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),nm(w.return,i,n),d||(D=null);break e}w=Y.next}}else if(y.tag===18){if(D=y.return,D===null)throw Error(a(341));D.lanes|=i,w=D.alternate,w!==null&&(w.lanes|=i),nm(D,i,n),D=null}else y.tag===13&&y.memoizedState!==null&&y.memoizedState.dehydrated===null?(y.lanes|=i,D=y.alternate,D!==null&&(D.lanes|=i),nm(y.return,i,n),D=y.child,D=D!==null?D.sibling:null):D=y.child;if(D!==null)D.return=y;else for(D=y;D!==null;){if(D===n){D=null;break}if(y=D.sibling,y!==null){y.return=D.return,D=y;break}D=D.return}y=D}}function ol(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 D=y.alternate;if(D===null)throw Error(a(387));if(D=D.memoizedProps,D!==null){var Y=y.type;pr(y.pendingProps.value,D.value)||(n!==null?n.push(Y):n=[Y])}}else if(y===he.current){if(D=y.alternate,D===null)throw Error(a(387));D.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(n!==null?n.push($c):n=[$c])}y=y.return}return n!==null&&Ax(o,n,i,d),o.flags|=262144,n!==null}function sm(n){for(n=n.firstContext;n!==null;){if(!pr(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function al(n){rl=n,ca=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Ns(n){return Ij(rl,n)}function rm(n,o){return rl===null&&al(n),Ij(n,o)}function Ij(n,o){var i=o._currentValue;if(o={context:o,memoizedValue:i,next:null},ca===null){if(n===null)throw Error(a(308));ca=o,n.dependencies={lanes:0,firstContext:o},n.flags|=524288}else ca=ca.next=o;return i}var dD=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()})}},fD=e.unstable_scheduleCallback,mD=e.unstable_NormalPriority,Qn={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ox(){return{controller:new dD,data:new Map,refCount:0}}function Hu(n){n.refCount--,n.refCount===0&&fD(mD,function(){n.controller.abort()})}function _j(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 Fu=null;function hD(n){var o=n.transitionTypes;return n.transitionTypes=null,o}var Gu=null,Mx=0,il=0,pc=null;function pD(n,o){if(Gu===null){var i=Gu=[];Mx=0,il=Kb(),pc={status:"pending",value:void 0,then:function(d){i.push(d)}}}return Mx++,o.then(Lj,Lj),o}function Lj(){if(--Mx===0&&(Fu=null,Gu!==null)){pc!==null&&(pc.status="fulfilled");var n=Gu;Gu=null,il=0,pc=null;for(var o=0;o<n.length;o++)(0,n[o])()}}function gD(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 $j=ne.S;ne.S=function(n,o){if(OS=nt(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&pD(n,o),Fu!==null)for(var i=Dc;i!==null;)_j(i,Fu),i=i.next;if(i=n.types,i!==null){for(var d=Dc;d!==null;)_j(d,i),d=d.next;if(il!==0){d=Fu,d===null&&(d=Fu=[]);for(var y=0;y<i.length;y++){var w=i[y];d.indexOf(w)===-1&&d.push(w)}}}$j!==null&&$j(n,o)};var ll=_e(null);function Dx(){var n=ll.current;return n!==null?n:wn.pooledCache}function om(n,o){o===null?Ae(ll,ll.current):Ae(ll,o.pool)}function Bj(){var n=Dx();return n===null?null:{parent:Qn._currentValue,pool:n}}var gc=Error(a(460)),zx=Error(a(474)),am=Error(a(542)),im={then:function(){}};function Vj(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Uj(n,o,i){switch(i=n[i],i===void 0?n.push(o):i!==o&&(o.then(Vs,Vs),o=i),o.status){case"fulfilled":return o.value;case"rejected":throw n=o.reason,Fj(n),n===void 0&&!("reason"in o)?Error(a(600)):n;default:if(typeof o.status=="string")o.then(Vs,Vs);else{if(n=wn,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,Fj(n),n}throw ul=o,gc}}function cl(n){try{var o=n._init;return o(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(ul=i,gc):i}}var ul=null;function Hj(){if(ul===null)throw Error(a(459));var n=ul;return ul=null,n}function Fj(n){if(n===gc||n===am)throw Error(a(483))}var xc=null,qu=0;function lm(n){var o=qu;return qu+=1,xc===null&&(xc=[]),Uj(xc,n,o)}function ni(n,o){o=o.props.ref,n.ref=o!==void 0?o:null}function cm(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 Gj(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=ia(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 D(ye){return n&&ye.alternate===null&&(ye.flags|=134217730),ye}function Y(ye,fe,je,ze){return fe===null||fe.tag!==6?(fe=Nx(je,ye.mode,ze),fe.return=ye,fe):(fe=y(fe,je),fe.return=ye,fe)}function ie(ye,fe,je,ze){var rt=je.type;return rt===B?(ye=Te(ye,fe,je.props.children,ze,je.key),ni(ye,je),ye):fe!==null&&(fe.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===$&&cl(rt)===fe.type)?(fe=y(fe,je.props),ni(fe,je),fe.return=ye,fe):(fe=Zf(je.type,je.key,je.props,null,ye.mode,ze),ni(fe,je),fe.return=ye,fe)}function ve(ye,fe,je,ze){return fe===null||fe.tag!==4||fe.stateNode.containerInfo!==je.containerInfo||fe.stateNode.implementation!==je.implementation?(fe=Cx(je,ye.mode,ze),fe.return=ye,fe):(fe=y(fe,je.children||[]),fe.return=ye,fe)}function Te(ye,fe,je,ze,rt){return fe===null||fe.tag!==7?(fe=nl(je,ye.mode,ze,rt),fe.return=ye,fe):(fe=y(fe,je),fe.return=ye,fe)}function Pe(ye,fe,je){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return fe=Nx(""+fe,ye.mode,je),fe.return=ye,fe;if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case z:return je=Zf(fe.type,fe.key,fe.props,null,ye.mode,je),ni(je,fe),je.return=ye,je;case _:return fe=Cx(fe,ye.mode,je),fe.return=ye,fe;case $:return fe=cl(fe),Pe(ye,fe,je)}if(oe(fe)||te(fe))return fe=nl(fe,ye.mode,je,null),fe.return=ye,fe;if(typeof fe.then=="function")return Pe(ye,lm(fe),je);if(fe.$$typeof===H)return Pe(ye,rm(ye,fe),je);cm(ye,fe)}return null}function ge(ye,fe,je,ze){var rt=fe!==null?fe.key:null;if(typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint")return rt!==null?null:Y(ye,fe,""+je,ze);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case z:return je.key===rt?ie(ye,fe,je,ze):null;case _:return je.key===rt?ve(ye,fe,je,ze):null;case $:return je=cl(je),ge(ye,fe,je,ze)}if(oe(je)||te(je))return rt!==null?null:Te(ye,fe,je,ze,null);if(typeof je.then=="function")return ge(ye,fe,lm(je),ze);if(je.$$typeof===H)return ge(ye,fe,rm(ye,je),ze);cm(ye,je)}return null}function Se(ye,fe,je,ze,rt){if(typeof ze=="string"&&ze!==""||typeof ze=="number"||typeof ze=="bigint")return ye=ye.get(je)||null,Y(fe,ye,""+ze,rt);if(typeof ze=="object"&&ze!==null){switch(ze.$$typeof){case z:return ye=ye.get(ze.key===null?je:ze.key)||null,ie(fe,ye,ze,rt);case _:return ye=ye.get(ze.key===null?je:ze.key)||null,ve(fe,ye,ze,rt);case $:return ze=cl(ze),Se(ye,fe,je,ze,rt)}if(oe(ze)||te(ze))return ye=ye.get(je)||null,Te(fe,ye,ze,rt,null);if(typeof ze.then=="function")return Se(ye,fe,je,lm(ze),rt);if(ze.$$typeof===H)return Se(ye,fe,je,rm(fe,ze),rt);cm(fe,ze)}return null}function tt(ye,fe,je,ze){for(var rt=null,Wt=null,xt=fe,kt=fe=0,es=null;xt!==null&&kt<je.length;kt++){xt.index>kt?(es=xt,xt=null):es=xt.sibling;var Zt=ge(ye,xt,je[kt],ze);if(Zt===null){xt===null&&(xt=es);break}n&&xt&&Zt.alternate===null&&o(ye,xt),fe=w(Zt,fe,kt),Wt===null?rt=Zt:Wt.sibling=Zt,Wt=Zt,xt=es}if(kt===je.length)return i(ye,xt),Ut&&la(ye,kt),rt;if(xt===null){for(;kt<je.length;kt++)xt=Pe(ye,je[kt],ze),xt!==null&&(fe=w(xt,fe,kt),Wt===null?rt=xt:Wt.sibling=xt,Wt=xt);return Ut&&la(ye,kt),rt}for(xt=d(xt);kt<je.length;kt++)es=Se(xt,ye,kt,je[kt],ze),es!==null&&(n&&(Zt=es.alternate,Zt!==null&&xt.delete(Zt.key===null?kt:Zt.key)),fe=w(es,fe,kt),Wt===null?rt=es:Wt.sibling=es,Wt=es);return n&&xt.forEach(function(wi){return o(ye,wi)}),Ut&&la(ye,kt),rt}function ft(ye,fe,je,ze){if(je==null)throw Error(a(151));for(var rt=null,Wt=null,xt=fe,kt=fe=0,es=null,Zt=je.next();xt!==null&&!Zt.done;kt++,Zt=je.next()){xt.index>kt?(es=xt,xt=null):es=xt.sibling;var wi=ge(ye,xt,Zt.value,ze);if(wi===null){xt===null&&(xt=es);break}n&&xt&&wi.alternate===null&&o(ye,xt),fe=w(wi,fe,kt),Wt===null?rt=wi:Wt.sibling=wi,Wt=wi,xt=es}if(Zt.done)return i(ye,xt),Ut&&la(ye,kt),rt;if(xt===null){for(;!Zt.done;kt++,Zt=je.next())Zt=Pe(ye,Zt.value,ze),Zt!==null&&(fe=w(Zt,fe,kt),Wt===null?rt=Zt:Wt.sibling=Zt,Wt=Zt);return Ut&&la(ye,kt),rt}for(xt=d(xt);!Zt.done;kt++,Zt=je.next())Zt=Se(xt,ye,kt,Zt.value,ze),Zt!==null&&(n&&(es=Zt.alternate,es!==null&&xt.delete(es.key===null?kt:es.key)),fe=w(Zt,fe,kt),Wt===null?rt=Zt:Wt.sibling=Zt,Wt=Zt);return n&&xt.forEach(function(Wz){return o(ye,Wz)}),Ut&&la(ye,kt),rt}function It(ye,fe,je,ze){if(typeof je=="object"&&je!==null&&je.type===B&&je.key===null&&je.props.ref===void 0&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case z:e:{for(var rt=je.key;fe!==null;){if(fe.key===rt){if(rt=je.type,rt===B){if(fe.tag===7){i(ye,fe.sibling),ze=y(fe,je.props.children),ni(ze,je),ze.return=ye,ye=ze;break e}}else if(fe.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===$&&cl(rt)===fe.type){i(ye,fe.sibling),ze=y(fe,je.props),ni(ze,je),ze.return=ye,ye=ze;break e}i(ye,fe);break}else o(ye,fe);fe=fe.sibling}je.type===B?(ze=nl(je.props.children,ye.mode,ze,je.key),ni(ze,je),ze.return=ye,ye=ze):(ze=Zf(je.type,je.key,je.props,null,ye.mode,ze),ni(ze,je),ze.return=ye,ye=ze)}return D(ye);case _:e:{for(rt=je.key;fe!==null;){if(fe.key===rt)if(fe.tag===4&&fe.stateNode.containerInfo===je.containerInfo&&fe.stateNode.implementation===je.implementation){i(ye,fe.sibling),ze=y(fe,je.children||[]),ze.return=ye,ye=ze;break e}else{i(ye,fe);break}else o(ye,fe);fe=fe.sibling}ze=Cx(je,ye.mode,ze),ze.return=ye,ye=ze}return D(ye);case $:return je=cl(je),It(ye,fe,je,ze)}if(oe(je))return tt(ye,fe,je,ze);if(te(je)){if(rt=te(je),typeof rt!="function")throw Error(a(150));return je=rt.call(je),ft(ye,fe,je,ze)}if(typeof je.then=="function")return It(ye,fe,lm(je),ze);if(je.$$typeof===H)return It(ye,fe,rm(ye,je),ze);cm(ye,je)}return typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint"?(je=""+je,fe!==null&&fe.tag===6?(i(ye,fe.sibling),ze=y(fe,je),ze.return=ye,ye=ze):(i(ye,fe),ze=Nx(je,ye.mode,ze),ze.return=ye,ye=ze),D(ye)):i(ye,fe)}return function(ye,fe,je,ze){try{qu=0;var rt=It(ye,fe,je,ze);return xc=null,rt}catch(xt){if(xt===gc||xt===am)throw xt;var Wt=Ws(29,xt,null,ye.mode);return Wt.lanes=ze,Wt.return=ye,Wt}finally{}}}var dl=Gj(!0),qj=Gj(!1),si=!1;function Px(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ix(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 ri(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function oi(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=Qf(n),Rj(n,null,i),o}return Wf(n,d,o,i),Qf(n)}function Yu(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,To(n,i)}}function _x(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 D={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};w===null?y=w=D:w=w.next=D,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 Lx=!1;function Ku(){if(Lx){var n=pc;if(n!==null)throw n}}function Xu(n,o,i,d){Lx=!1;var y=n.updateQueue;si=!1;var w=y.firstBaseUpdate,D=y.lastBaseUpdate,Y=y.shared.pending;if(Y!==null){y.shared.pending=null;var ie=Y,ve=ie.next;ie.next=null,D===null?w=ve:D.next=ve,D=ie;var Te=n.alternate;Te!==null&&(Te=Te.updateQueue,Y=Te.lastBaseUpdate,Y!==D&&(Y===null?Te.firstBaseUpdate=ve:Y.next=ve,Te.lastBaseUpdate=ie))}if(w!==null){var Pe=y.baseState;D=0,Te=ve=ie=null,Y=w;do{var ge=Y.lane&-536870913,Se=ge!==Y.lane;if(Se?(Xt&ge)===ge:(d&ge)===ge){ge!==0&&ge===il&&(Lx=!0),Te!==null&&(Te=Te.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var tt=n,ft=Y;ge=o;var It=i;switch(ft.tag){case 1:if(tt=ft.payload,typeof tt=="function"){Pe=tt.call(It,Pe,ge);break e}Pe=tt;break e;case 3:tt.flags=tt.flags&-65537|128;case 0:if(tt=ft.payload,ge=typeof tt=="function"?tt.call(It,Pe,ge):tt,ge==null)break e;Pe=E({},Pe,ge);break e;case 2:si=!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},Te===null?(ve=Te=Se,ie=Pe):Te=Te.next=Se,D|=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);Te===null&&(ie=Pe),y.baseState=ie,y.firstBaseUpdate=ve,y.lastBaseUpdate=Te,w===null&&(y.shared.lanes=0),fi|=D,n.lanes=D,n.memoizedState=Pe}}function Yj(n,o){if(typeof n!="function")throw Error(a(191,n));n.call(o)}function Kj(n,o){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)Yj(i[n],o)}var ai=_e(null),um=_e(0);function Xj(n,o){n=pa,Ae(um,n),Ae(ai,o),pa=n|o.baseLanes}function $x(){Ae(um,pa),Ae(ai,ai.current)}function Bx(){pa=um.current,Ne(ai),Ne(um)}var Cs=_e(null),Ds=null;function ii(n){var o=n.alternate;Ae(ks,ks.current&1),Ae(Cs,n),Ds===null&&(o===null||ai.current!==null||o.memoizedState!==null)&&(Ds=n)}function Vx(n){Ae(ks,ks.current),Ae(Cs,n),Ds===null&&(Ds=n)}function Wj(n){n.tag===22?(Ae(ks,ks.current),Ae(Cs,n),Ds===null&&(Ds=n)):li()}function li(){Ae(ks,ks.current),Ae(Cs,Cs.current)}function gr(n){Ne(Cs),Ds===n&&(Ds=null),Ne(ks)}var ks=_e(0);function Wu(n,o){Ae(Cs,Cs.current),Ae(ks,o)}function Ux(n){Ne(ks),Ne(Cs),Ds===n&&(Ds=null)}function dm(n){for(var o=n;o!==null;){if(o.tag===13){var i=o.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||u0(i)||d0(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 da=0,Pt=null,fn=null,Zn=null,fm=!1,bc=!1,fl=!1,mm=0,Qu=0,yc=null,xD=0;function Bn(){throw Error(a(321))}function Hx(n,o){if(o===null)return!1;for(var i=0;i<o.length&&i<n.length;i++)if(!pr(n[i],o[i]))return!1;return!0}function Fx(n,o,i,d,y,w){return da=w,Pt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,ne.H=n===null||n.memoizedState===null?D2:z2,fl=!1,w=i(d,y),fl=!1,bc&&(w=Zj(o,i,d,y)),Qj(n),w}function Qj(n){ne.H=vm;var o=fn!==null&&fn.next!==null;if(da=0,Zn=fn=Pt=null,fm=!1,Qu=0,yc=null,o)throw Error(a(300));n===null||Jn||(n=n.dependencies,n!==null&&sm(n)&&(Jn=!0))}function Zj(n,o,i,d){Pt=n;var y=0;do{if(bc&&(yc=null),Qu=0,bc=!1,25<=y)throw Error(a(301));if(y+=1,Zn=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)}ne.H=CD,w=o(i,d)}while(bc);return w}function bD(){var n=ne.H,o=n.useState()[0];return o=typeof o.then=="function"?Zu(o):o,n=n.useState()[0],(fn!==null?fn.memoizedState:null)!==n&&(Pt.flags|=1024),o}function Gx(){var n=mm!==0;return mm=0,n}function qx(n,o,i){o.updateQueue=n.updateQueue,o.flags&=-2053,n.lanes&=~i}function Yx(n){if(fm){for(n=n.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}fm=!1}da=0,Zn=fn=Pt=null,bc=!1,Qu=mm=0,yc=null}function Hs(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zn===null?Pt.memoizedState=Zn=n:Zn=Zn.next=n,Zn}function Yn(){if(fn===null){var n=Pt.alternate;n=n!==null?n.memoizedState:null}else n=fn.next;var o=Zn===null?Pt.memoizedState:Zn.next;if(o!==null)Zn=o,fn=n;else{if(n===null)throw Pt.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},Zn===null?Pt.memoizedState=Zn=n:Zn=Zn.next=n}return Zn}function hm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Zu(n){var o=Qu;return Qu+=1,yc===null&&(yc=[]),n=Uj(yc,n,o),o=Pt,(Zn===null?o.memoizedState:Zn.next)===null&&(o=o.alternate,ne.H=o===null||o.memoizedState===null?D2:z2),n}function pm(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Zu(n);if(n.$$typeof===U)return;if(n.$$typeof===H)return Ns(n)}throw Error(a(438,String(n)))}function Kx(n){var o=null,i=Pt.updateQueue;if(i!==null&&(o=i.memoCache),o==null){var d=Pt.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=hm(),Pt.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 fa(n,o){return typeof o=="function"?o(n):o}function gm(n){var o=Yn();return Xx(o,fn,n)}function Xx(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 D=y.next;y.next=w.next,w.next=D}o.baseQueue=y=w,d.pending=null}if(w=n.baseState,y===null)n.memoizedState=w;else{o=y.next;var Y=D=null,ie=null,ve=o,Te=!1;do{var Pe=ve.lane&-536870913;if(Pe!==ve.lane?(Xt&Pe)===Pe:(da&Pe)===Pe){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}),Pe===il&&(Te=!0);else if((da&ge)===ge){ve=ve.next,ge===il&&(Te=!0);continue}else Pe={lane:0,revertLane:ve.revertLane,gesture:null,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null},ie===null?(Y=ie=Pe,D=w):ie=ie.next=Pe,Pt.lanes|=ge,fi|=ge;Pe=ve.action,fl&&i(w,Pe),w=ve.hasEagerState?ve.eagerState:i(w,Pe)}else ge={lane:Pe,revertLane:ve.revertLane,gesture:ve.gesture,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null},ie===null?(Y=ie=ge,D=w):ie=ie.next=ge,Pt.lanes|=Pe,fi|=Pe;ve=ve.next}while(ve!==null&&ve!==o);if(ie===null?D=w:ie.next=Y,!pr(w,n.memoizedState)&&(Jn=!0,Te&&(i=pc,i!==null)))throw i;n.memoizedState=w,n.baseState=D,n.baseQueue=ie,d.lastRenderedState=w}return y===null&&(d.lanes=0),[n.memoizedState,d.dispatch]}function Wx(n){var o=Yn(),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 D=y=y.next;do w=n(w,D.action),D=D.next;while(D!==y);pr(w,o.memoizedState)||(Jn=!0),o.memoizedState=w,o.baseQueue===null&&(o.baseState=w),i.lastRenderedState=w}return[w,d]}function Jj(n,o,i){var d=Pt,y=Yn(),w=Ut;if(w){if(i===void 0)throw Error(a(407));i=i()}else i=o();var D=!pr((fn||y).memoizedState,i);if(D&&(y.memoizedState=i,Jn=!0),y=y.queue,Jx(n2.bind(null,d,y,n),[n]),n=y.getSnapshot!==o||D||Zn!==null&&(Zn.memoizedState.tag&1)!==0,vc(n?9:8,{destroy:void 0},t2.bind(null,d,y,i,o),null),n){if(d.flags|=2048,wn===null)throw Error(a(349));w||(da&127)!==0||e2(d,o,i)}return i}function e2(n,o,i){n.flags|=16384,n={getSnapshot:o,value:i},o=Pt.updateQueue,o===null?(o=hm(),Pt.updateQueue=o,o.stores=[n]):(i=o.stores,i===null?o.stores=[n]:i.push(n))}function t2(n,o,i,d){o.value=i,o.getSnapshot=d,s2(o)&&r2(n)}function n2(n,o,i){return i(function(){s2(o)&&r2(n)})}function s2(n){var o=n.getSnapshot;n=n.value;try{var i=o();return!pr(n,i)}catch{return!0}}function r2(n){var o=tl(n,2);o!==null&&er(o,n,2)}function Qx(n){var o=Hs();if(typeof n=="function"){var i=n;if(n=i(),fl){Vt(!0);try{i()}finally{Vt(!1)}}}return o.memoizedState=o.baseState=n,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:n},o}function o2(n,o,i,d){return n.baseState=i,Xx(n,fn,typeof d=="function"?d:fa)}function yD(n,o,i,d,y){if(ym(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(D){w.listeners.push(D)}};ne.T!==null?i(!0):w.isTransition=!1,d(w),i=o.pending,i===null?(w.next=o.pending=w,a2(o,w)):(w.next=i.next,o.pending=i.next=w)}}function a2(n,o){var i=o.action,d=o.payload,y=n.state;if(o.isTransition){var w=ne.T,D={};D.types=w!==null?w.types:null,ne.T=D;try{var Y=i(y,d),ie=ne.S;ie!==null&&ie(D,Y),i2(n,o,Y)}catch(ve){Zx(n,o,ve)}finally{w!==null&&D.types!==null&&(w.types=D.types),ne.T=w}}else try{w=i(y,d),i2(n,o,w)}catch(ve){Zx(n,o,ve)}}function i2(n,o,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(d){l2(n,o,d)},function(d){return Zx(n,o,d)}):l2(n,o,i)}function l2(n,o,i){o.status="fulfilled",o.value=i,c2(o),n.state=i,o=n.pending,o!==null&&(i=o.next,i===o?n.pending=null:(i=i.next,o.next=i,a2(n,i)))}function Zx(n,o,i){var d=n.pending;if(n.pending=null,d!==null){d=d.next;do o.status="rejected",o.reason=i,c2(o),o=o.next;while(o!==d)}n.action=null}function c2(n){n=n.listeners;for(var o=0;o<n.length;o++)(0,n[o])()}function u2(n,o){return o}function d2(n,o){if(Ut){var i=wn.formState;if(i!==null){e:{var d=Pt;if(Ut){if(Sn){t:{for(var y=Sn,w=qr;y.nodeType!==8;){if(!w){y=null;break t}if(y=Kr(y.nextSibling),y===null){y=null;break t}}w=y.data,y=w==="F!"||w==="F"?y:null}if(y){Sn=Kr(y.nextSibling),d=y.data==="F!";break e}}ei(d)}d=!1}d&&(o=i[0])}}return i=Hs(),i.memoizedState=i.baseState=o,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u2,lastRenderedState:o},i.queue=d,i=A2.bind(null,Pt,d),d.dispatch=i,d=Qx(!1),w=rb.bind(null,Pt,!1,d.queue),d=Hs(),y={state:o,dispatch:null,action:n,pending:null},d.queue=y,i=yD.bind(null,Pt,y,w,i),y.dispatch=i,d.memoizedState=n,[o,i,!1]}function f2(n){var o=Yn();return m2(o,fn,n)}function m2(n,o,i){if(o=Xx(n,o,u2)[0],n=gm(fa)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var d=Zu(o)}catch(D){throw D===gc?am:D}else d=o;o=Yn();var y=o.queue,w=y.dispatch;return i!==o.memoizedState&&(Pt.flags|=2048,vc(9,{destroy:void 0},vD.bind(null,y,i),null)),[d,w,n]}function vD(n,o){n.action=o}function h2(n){var o=Yn(),i=fn;if(i!==null)return m2(o,i,n);Yn(),o=o.memoizedState,i=Yn();var d=i.queue.dispatch;return i.memoizedState=n,[o,d,!1]}function vc(n,o,i,d){return n={tag:n,create:i,deps:d,inst:o,next:null},o=Pt.updateQueue,o===null&&(o=hm(),Pt.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 p2(){return Yn().memoizedState}function xm(n,o,i,d){var y=Hs();Pt.flags|=n,y.memoizedState=vc(1|o,{destroy:void 0},i,d===void 0?null:d)}function bm(n,o,i,d){var y=Yn();d=d===void 0?null:d;var w=y.memoizedState.inst;fn!==null&&d!==null&&Hx(d,fn.memoizedState.deps)?y.memoizedState=vc(o,w,i,d):(Pt.flags|=n,y.memoizedState=vc(1|o,w,i,d))}function g2(n,o){xm(8390656,8,n,o)}function Jx(n,o){bm(2048,8,n,o)}function wD(n){Pt.flags|=4;var o=Pt.updateQueue;if(o===null)o=hm(),Pt.updateQueue=o,o.events=[n];else{var i=o.events;i===null?o.events=[n]:i.push(n)}}function x2(n){var o=Yn().memoizedState;return wD({ref:o,nextImpl:n}),function(){if((nn&2)!==0)throw Error(a(440));return o.impl.apply(void 0,arguments)}}function b2(n,o){return bm(4,2,n,o)}function y2(n,o){return bm(4,4,n,o)}function v2(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 w2(n,o,i){i=i!=null?i.concat([n]):null,bm(4,4,v2.bind(null,o,n),i)}function eb(){}function j2(n,o){var i=Yn();o=o===void 0?null:o;var d=i.memoizedState;return o!==null&&Hx(o,d[1])?d[0]:(i.memoizedState=[n,o],n)}function S2(n,o){var i=Yn();o=o===void 0?null:o;var d=i.memoizedState;if(o!==null&&Hx(o,d[1]))return d[0];if(d=n(),fl){Vt(!0);try{n()}finally{Vt(!1)}}return i.memoizedState=[d,o],d}function tb(n,o,i){return i===void 0||(da&1073741824)!==0&&(Xt&261930)===0?n.memoizedState=o:(n.memoizedState=i,n=DS(),Pt.lanes|=n,fi|=n,i)}function N2(n,o,i,d){return pr(i,o)?i:ai.current!==null?(n=tb(n,i,d),pr(n,o)||(Jn=!0),n):(da&106)===0||(da&1073741824)!==0&&(Xt&261930)===0?(Jn=!0,n.memoizedState=i):(n=DS(),Pt.lanes|=n,fi|=n,o)}function C2(n,o,i,d,y){var w=ee.p;ee.p=w!==0&&8>w?w:8;var D=ne.T,Y={};Y.types=D!==null?D.types:null,ne.T=Y,rb(n,!1,o,i);try{var ie=y(),ve=ne.S;if(ve!==null&&ve(Y,ie),ie!==null&&typeof ie=="object"&&typeof ie.then=="function"){var Te=gD(ie,d);Ju(n,o,Te,vr(n))}else Ju(n,o,d,vr(n))}catch(Pe){Ju(n,o,{then:function(){},status:"rejected",reason:Pe},vr())}finally{ee.p=w,D!==null&&Y.types!==null&&(D.types=Y.types),ne.T=D}}function jD(){}function nb(n,o,i,d){if(n.tag!==5)throw Error(a(476));var y=k2(n).queue;C2(n,y,o,W,i===null?jD:function(){return T2(n),i(d)})}function k2(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:fa,lastRenderedState:W},next:null};var i={};return o.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:i},next:null},n.memoizedState=o,n=n.alternate,n!==null&&(n.memoizedState=o),o}function T2(n){var o=k2(n);o.next===null&&(o=n.alternate.memoizedState),Ju(n,o.next.queue,{},vr())}function sb(){return Ns($c)}function E2(){return Yn().memoizedState}function R2(){return Yn().memoizedState}function SD(n){for(var o=n.return;o!==null;){switch(o.tag){case 24:case 3:var i=vr();n=ri(i);var d=oi(o,n,i);d!==null&&(er(d,o,i),Yu(d,o,i)),o={cache:Ox()},n.payload=o;return}o=o.return}}function ND(n,o,i){var d=vr();i={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},ym(n)?O2(o,i):(i=jx(n,o,i,d),i!==null&&(er(i,n,d),M2(i,o,d)))}function A2(n,o,i){var d=vr();Ju(n,o,i,d)}function Ju(n,o,i,d){var y={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(ym(n))O2(o,y);else{var w=n.alternate;if(n.lanes===0&&(w===null||w.lanes===0)&&(w=o.lastRenderedReducer,w!==null))try{var D=o.lastRenderedState,Y=w(D,i);if(y.hasEagerState=!0,y.eagerState=Y,pr(Y,D))return Wf(n,o,y,0),wn===null&&Xf(),!1}catch{}finally{}if(i=jx(n,o,y,d),i!==null)return er(i,n,d),M2(i,o,d),!0}return!1}function rb(n,o,i,d){if(d={lane:2,revertLane:Kb(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},ym(n)){if(o)throw Error(a(479))}else o=jx(n,i,d,2),o!==null&&er(o,n,2)}function ym(n){var o=n.alternate;return n===Pt||o!==null&&o===Pt}function O2(n,o){bc=fm=!0;var i=n.pending;i===null?o.next=o:(o.next=i.next,i.next=o),n.pending=o}function M2(n,o,i){if((i&4194048)!==0){var d=o.lanes;d&=n.pendingLanes,i|=d,o.lanes=i,To(n,i)}}var vm={readContext:Ns,use:pm,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},D2={readContext:Ns,use:pm,useCallback:function(n,o){return Hs().memoizedState=[n,o===void 0?null:o],n},useContext:Ns,useEffect:g2,useImperativeHandle:function(n,o,i){i=i!=null?i.concat([n]):null,xm(4194308,4,v2.bind(null,o,n),i)},useLayoutEffect:function(n,o){return xm(4194308,4,n,o)},useInsertionEffect:function(n,o){xm(4,2,n,o)},useMemo:function(n,o){var i=Hs();o=o===void 0?null:o;var d=n();if(fl){Vt(!0);try{n()}finally{Vt(!1)}}return i.memoizedState=[d,o],d},useReducer:function(n,o,i){var d=Hs();if(i!==void 0){var y=i(o);if(fl){Vt(!0);try{i(o)}finally{Vt(!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=ND.bind(null,Pt,n),[d.memoizedState,n]},useRef:function(n){var o=Hs();return n={current:n},o.memoizedState=n},useState:function(n){n=Qx(n);var o=n.queue,i=A2.bind(null,Pt,o);return o.dispatch=i,[n.memoizedState,i]},useDebugValue:eb,useDeferredValue:function(n,o){var i=Hs();return tb(i,n,o)},useTransition:function(){var n=Qx(!1);return n=C2.bind(null,Pt,n.queue,!0,!1),Hs().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,o,i){var d=Pt,y=Hs();if(Ut){if(i===void 0)throw Error(a(407));i=i()}else{if(i=o(),wn===null)throw Error(a(349));(Xt&127)!==0||e2(d,o,i)}y.memoizedState=i;var w={value:i,getSnapshot:o};return y.queue=w,g2(n2.bind(null,d,w,n),[n]),d.flags|=2048,vc(9,{destroy:void 0},t2.bind(null,d,w,i,o),null),i},useId:function(){var n=Hs(),o=wn.identifierPrefix;if(Ut){var i=Ro,d=Eo;i=(d&~(1<<32-Ct(d)-1)).toString(32)+i,o="_"+o+"R_"+i,i=mm++,0<i&&(o+="H"+i.toString(32)),o+="_"}else i=xD++,o="_"+o+"r_"+i.toString(32)+"_";return n.memoizedState=o},useHostTransitionStatus:sb,useFormState:d2,useActionState:d2,useOptimistic:function(n){var o=Hs();o.memoizedState=o.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=i,o=rb.bind(null,Pt,!0,i),i.dispatch=o,[n,o]},useMemoCache:Kx,useCacheRefresh:function(){return Hs().memoizedState=SD.bind(null,Pt)},useEffectEvent:function(n){var o=Hs(),i={impl:n};return o.memoizedState=i,function(){if((nn&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},z2={readContext:Ns,use:pm,useCallback:j2,useContext:Ns,useEffect:Jx,useImperativeHandle:w2,useInsertionEffect:b2,useLayoutEffect:y2,useMemo:S2,useReducer:gm,useRef:p2,useState:function(){return gm(fa)},useDebugValue:eb,useDeferredValue:function(n,o){var i=Yn();return N2(i,fn.memoizedState,n,o)},useTransition:function(){var n=gm(fa)[0],o=Yn().memoizedState;return[typeof n=="boolean"?n:Zu(n),o]},useSyncExternalStore:Jj,useId:E2,useHostTransitionStatus:sb,useFormState:f2,useActionState:f2,useOptimistic:function(n,o){var i=Yn();return o2(i,fn,n,o)},useMemoCache:Kx,useCacheRefresh:R2,useEffectEvent:x2},CD={readContext:Ns,use:pm,useCallback:j2,useContext:Ns,useEffect:Jx,useImperativeHandle:w2,useInsertionEffect:b2,useLayoutEffect:y2,useMemo:S2,useReducer:Wx,useRef:p2,useState:function(){return Wx(fa)},useDebugValue:eb,useDeferredValue:function(n,o){var i=Yn();return fn===null?tb(i,n,o):N2(i,fn.memoizedState,n,o)},useTransition:function(){var n=Wx(fa)[0],o=Yn().memoizedState;return[typeof n=="boolean"?n:Zu(n),o]},useSyncExternalStore:Jj,useId:E2,useHostTransitionStatus:sb,useFormState:h2,useActionState:h2,useOptimistic:function(n,o){var i=Yn();return fn!==null?o2(i,fn,n,o):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:Kx,useCacheRefresh:R2,useEffectEvent:x2};function ob(n,o,i,d){o=n.memoizedState,i=i(d,o),i=i==null?o:E({},o,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var ab={enqueueSetState:function(n,o,i){n=n._reactInternals;var d=vr(),y=ri(d);y.payload=o,i!=null&&(y.callback=i),o=oi(n,y,d),o!==null&&(er(o,n,d),Yu(o,n,d))},enqueueReplaceState:function(n,o,i){n=n._reactInternals;var d=vr(),y=ri(d);y.tag=1,y.payload=o,i!=null&&(y.callback=i),o=oi(n,y,d),o!==null&&(er(o,n,d),Yu(o,n,d))},enqueueForceUpdate:function(n,o){n=n._reactInternals;var i=vr(),d=ri(i);d.tag=2,o!=null&&(d.callback=o),o=oi(n,d,i),o!==null&&(er(o,n,i),Yu(o,n,i))}};function P2(n,o,i,d,y,w,D){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(d,w,D):o.prototype&&o.prototype.isPureReactComponent?!$u(i,d)||!$u(y,w):!0}function I2(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&&ab.enqueueReplaceState(o,o.state,null)}function ml(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=E({},i));for(var y in n)i[y]===void 0&&(i[y]=n[y])}return i}function _2(n){Kf(n)}function L2(n){console.error(n)}function $2(n){Kf(n)}function wm(n,o){try{var i=n.onUncaughtError;i(o.value,{componentStack:o.stack})}catch(d){setTimeout(function(){throw d})}}function B2(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 ib(n,o,i){return i=ri(i),i.tag=3,i.payload={element:null},i.callback=function(){wm(n,o)},i}function V2(n){return n=ri(n),n.tag=3,n}function U2(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(){B2(o,i,d)}}var D=i.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(n.callback=function(){B2(o,i,d),typeof y!="function"&&(mi===null?mi=new Set([this]):mi.add(this));var Y=d.stack;this.componentDidCatch(d.value,{componentStack:Y!==null?Y:""})})}function kD(n,o,i,d,y){if(i.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=i.alternate,o!==null&&ol(o,i,y,!0),i=Cs.current,i!==null){switch(i.tag){case 31:case 13:case 19:return Ds===null?Um():i.alternate===null&&Vn===0&&(Vn=3),i.flags&=-257,i.flags|=65536,i.lanes=y,d===im?i.flags|=16384:(o=i.updateQueue,o===null?i.updateQueue=new Set([d]):o.add(d),Gb(n,d,y)),!1;case 22:return i.flags|=65536,d===im?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)),Gb(n,d,y)),!1}throw Error(a(435,i.tag))}return Gb(n,d,y),Um(),!1}if(Ut)return o=Cs.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=y,d!==Tx&&(n=Error(a(422),{cause:d}),Uu(Hr(n,i)))):(d!==Tx&&(o=Error(a(423),{cause:d}),Uu(Hr(o,i))),n=n.current.alternate,n.flags|=65536,y&=-y,n.lanes|=y,d=Hr(d,i),y=ib(n.stateNode,d,y),_x(n,y),Vn!==4&&(Vn=2)),!1;var w=Error(a(520),{cause:d});if(w=Hr(w,i),id===null?id=[w]:id.push(w),Vn!==4&&(Vn=2),o===null)return!0;d=Hr(d,i),i=o;do{switch(i.tag){case 3:return i.flags|=65536,n=y&-y,i.lanes|=n,n=ib(i.stateNode,d,n),_x(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"&&(mi===null||!mi.has(w))))return i.flags|=65536,y&=-y,i.lanes|=y,y=V2(y),U2(y,n,i,d),_x(i,y),!1;break;case 22:if(i.memoizedState!==null)return i.flags|=65536,!1}i=i.return}while(i!==null);return!1}var lb=Error(a(461)),Jn=!1;function ss(n,o,i,d){o.child=n===null?qj(o,null,i,d):dl(o,n.child,i,d)}function H2(n,o,i,d,y){i=i.render;var w=o.ref;if("ref"in d){var D={};for(var Y in d)Y!=="ref"&&(D[Y]=d[Y])}else D=d;return al(o),d=Fx(n,o,i,D,w,y),Y=Gx(),n!==null&&!Jn?(qx(n,o,y),ma(n,o,y)):(Ut&&Y&&em(o),o.flags|=1,ss(n,o,d,y),o.child)}function F2(n,o,i,d,y){if(n===null){var w=i.type;return typeof w=="function"&&!Sx(w)&&w.defaultProps===void 0&&i.compare===null?(o.tag=15,o.type=w,G2(n,o,w,d,y)):(n=Zf(i.type,null,d,o,o.mode,y),n.ref=o.ref,n.return=o,o.child=n)}if(w=n.child,!gb(n,y)){var D=w.memoizedProps;if(i=i.compare,i=i!==null?i:$u,i(D,d)&&n.ref===o.ref)return ma(n,o,y)}return o.flags|=1,n=ia(w,d),n.ref=o.ref,n.return=o,o.child=n}function G2(n,o,i,d,y){if(n!==null){var w=n.memoizedProps;if($u(w,d)&&n.ref===o.ref)if(Jn=!1,o.pendingProps=d=w,gb(n,y))(n.flags&131072)!==0&&(Jn=!0);else return o.lanes=n.lanes,ma(n,o,y)}return cb(n,o,i,d,y)}function q2(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 Y2(n,o,w,i,d)}if((i&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},n!==null&&om(o,w!==null?w.cachePool:null),w!==null?Xj(o,w):$x(),Wj(o);else return d=o.lanes=536870912,Y2(n,o,w!==null?w.baseLanes|i:i,i,d)}else w!==null?(om(o,w.cachePool),Xj(o,w),li(),o.memoizedState=null):(n!==null&&om(o,null),$x(),li());return ss(n,o,y,i),o.child}function ed(n,o){return n!==null&&n.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function Y2(n,o,i,d,y){var w=Dx();return w=w===null?null:{parent:Qn._currentValue,pool:w},o.memoizedState={baseLanes:i,cachePool:w},n!==null&&om(o,null),$x(),Wj(o),n!==null&&ol(n,o,d,!0),o.childLanes=y,null}function jm(n,o){return o=Sm({mode:o.mode,children:o.children},n.mode),o.ref=n.ref,n.child=o,o.return=n,o}function K2(n,o,i){return dl(o,n.child,null,i),n=jm(o,o.pendingProps),n.flags|=2,gr(o),o.memoizedState=null,n}function TD(n,o,i){var d=o.pendingProps,y=(o.flags&128)!==0;if(o.flags&=-129,n===null){if(Ut){if(d.mode==="hidden")return n=jm(o,d),o.lanes=536870912,n.memoizedState={baseLanes:0,cachePool:null},ed(null,n);if(Vx(o),(n=Sn)?(n=vN(n,qr),n=n!==null&&n.data==="&"?n:null,n!==null&&(o.memoizedState={dehydrated:n,treeContext:Za!==null?{id:Eo,overflow:Ro}:null,retryLane:536870912,hydrationErrors:null},i=Oj(n),i.return=o,o.child=i,ps=o,Sn=null)):n=null,n===null)throw ei(o);return o.lanes=536870912,null}return jm(o,d)}var w=n.memoizedState;if(w!==null){var D=w.dehydrated;if(Vx(o),y)if(o.flags&256)o.flags&=-257,o=K2(n,o,i);else if(o.memoizedState!==null)o.child=n.child,o.flags|=128,o=null;else throw Error(a(558));else if(Jn||ol(n,o,i,!1),y=(i&n.childLanes)!==0,Jn||y){if(ai.current===null){if(d=wn,d!==null&&(D=Fi(d,i),D!==0&&D!==w.retryLane))throw w.retryLane=D,tl(n,D),er(d,n,D),lb;Um()}o=K2(n,o,i)}else n=w.treeContext,Sn=Kr(D.nextSibling),ps=o,Ut=!0,Ja=null,qr=!1,n!==null&&zj(o,n),o=jm(o,d),o.flags|=134221824;return o}return n=ia(n.child,{mode:d.mode,children:d.children}),n.ref=o.ref,o.child=n,n.return=o,n}function wc(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 cb(n,o,i,d,y){return al(o),i=Fx(n,o,i,d,void 0,y),d=Gx(),n!==null&&!Jn?(qx(n,o,y),ma(n,o,y)):(Ut&&d&&em(o),o.flags|=1,ss(n,o,i,y),o.child)}function X2(n,o,i,d,y,w){return al(o),o.updateQueue=null,i=Zj(o,d,i,y),Qj(n),d=Gx(),n!==null&&!Jn?(qx(n,o,w),ma(n,o,w)):(Ut&&d&&em(o),o.flags|=1,ss(n,o,i,w),o.child)}function W2(n,o,i,d,y){if(al(o),o.stateNode===null){var w=dc,D=i.contextType;typeof D=="object"&&D!==null&&(w=Ns(D)),w=new i(d,w),o.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=ab,o.stateNode=w,w._reactInternals=o,w=o.stateNode,w.props=d,w.state=o.memoizedState,w.refs={},Px(o),D=i.contextType,w.context=typeof D=="object"&&D!==null?Ns(D):dc,w.state=o.memoizedState,D=i.getDerivedStateFromProps,typeof D=="function"&&(ob(o,i,D,d),w.state=o.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(D=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),D!==w.state&&ab.enqueueReplaceState(w,w.state,null),Xu(o,d,w,y),Ku(),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=ml(i,Y);w.props=ie;var ve=w.context,Te=i.contextType;D=dc,typeof Te=="object"&&Te!==null&&(D=Ns(Te));var Pe=i.getDerivedStateFromProps;Te=typeof Pe=="function"||typeof w.getSnapshotBeforeUpdate=="function",Y=o.pendingProps!==Y,Te||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(Y||ve!==D)&&I2(o,w,d,D),si=!1;var ge=o.memoizedState;w.state=ge,Xu(o,d,w,y),Ku(),ve=o.memoizedState,Y||ge!==ve||si?(typeof Pe=="function"&&(ob(o,i,Pe,d),ve=o.memoizedState),(ie=si||P2(o,i,ie,d,ge,ve,D))?(Te||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=D,d=ie):(typeof w.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{w=o.stateNode,Ix(n,o),D=o.memoizedProps,Te=ml(i,D),w.props=Te,Pe=o.pendingProps,ge=w.context,ve=i.contextType,ie=dc,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"||(D!==Pe||ge!==ie)&&I2(o,w,d,ie),si=!1,ge=o.memoizedState,w.state=ge,Xu(o,d,w,y),Ku();var Se=o.memoizedState;D!==Pe||ge!==Se||si||n!==null&&n.dependencies!==null&&sm(n.dependencies)?(typeof Y=="function"&&(ob(o,i,Y,d),Se=o.memoizedState),(Te=si||P2(o,i,Te,d,ge,Se,ie)||n!==null&&n.dependencies!==null&&sm(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"||D===n.memoizedProps&&ge===n.memoizedState||(o.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&ge===n.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=Se),w.props=d,w.state=Se,w.context=ie,d=Te):(typeof w.componentDidUpdate!="function"||D===n.memoizedProps&&ge===n.memoizedState||(o.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&ge===n.memoizedState||(o.flags|=1024),d=!1)}return w=d,wc(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=dl(o,n.child,null,y),o.child=dl(o,null,i,y)):ss(n,o,i,y),o.memoizedState=w.state,n=o.child):n=ma(n,o,y),n}function Q2(n,o,i,d){return sl(),o.flags|=256,ss(n,o,i,d),o.child}var ub={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function db(n){return{baseLanes:n,cachePool:Bj()}}function fb(n,o,i){return n=n!==null?n.childLanes&~i:0,o&&(n|=yr),n}function Z2(n,o,i){var d=o.pendingProps,y=!1,w=(o.flags&128)!==0,D;if((D=w)||(D=n!==null&&n.memoizedState===null?!1:(ks.current&2)!==0),D&&(y=!0,o.flags&=-129),D=(o.flags&32)!==0,o.flags&=-33,n===null){if(Ut){if(y?ii(o):li(),(n=Sn)?(n=vN(n,qr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(o.memoizedState={dehydrated:n,treeContext:Za!==null?{id:Eo,overflow:Ro}:null,retryLane:536870912,hydrationErrors:null},i=Oj(n),i.return=o,o.child=i,ps=o,Sn=null)):n=null,n===null)throw ei(o);return d0(n)?o.lanes=32:o.lanes=536870912,null}return w=d.children,d=d.fallback,y?(li(),y=o.mode,w=Sm({mode:"hidden",children:w},y),d=nl(d,y,i,null),w.return=o,d.return=o,w.sibling=d,o.child=w,d=o.child,d.memoizedState=db(i),d.childLanes=fb(n,D,i),o.memoizedState=ub,ed(null,d)):(ii(o),mb(o,w))}var Y=n.memoizedState;if(Y!==null){var ie=Y.dehydrated;if(ie!==null)return ED(n,o,w,D,d,ie,Y,i)}return y?(li(),y=d.fallback,w=o.mode,Y=n.child,ie=Y.sibling,d=ia(Y,{mode:"hidden",children:d.children}),d.subtreeFlags=Y.subtreeFlags&1206910976,ie!==null?y=ia(ie,y):(y=nl(y,w,i,null),y.flags|=2),y.return=o,d.return=o,d.sibling=y,o.child=d,ed(null,d),d=o.child,y=n.child.memoizedState,y===null?y=db(i):(w=y.cachePool,w!==null?(Y=Qn._currentValue,w=w.parent!==Y?{parent:Y,pool:Y}:w):w=Bj(),y={baseLanes:y.baseLanes|i,cachePool:w}),d.memoizedState=y,d.childLanes=fb(n,D,i),o.memoizedState=ub,ed(n.child,d)):(ii(o),i=n.child,n=i.sibling,i=ia(i,{mode:"visible",children:d.children}),i.return=o,i.sibling=null,n!==null&&(D=o.deletions,D===null?(o.deletions=[n],o.flags|=16):D.push(n)),o.child=i,o.memoizedState=null,i)}function mb(n,o){return o=Sm({mode:"visible",children:o},n.mode),o.return=n,n.child=o}function Sm(n,o){return n=Ws(22,n,null,o),n.lanes=0,n}function Nm(n,o,i){return dl(o,n.child,null,i),n=mb(o,o.pendingProps.children),n.flags|=2,o.memoizedState=null,n}function ED(n,o,i,d,y,w,D,Y){if(i)return o.flags&256?(ii(o),o.flags&=-257,Nm(n,o,Y)):o.memoizedState!==null?(li(),o.child=n.child,o.flags|=128,null):(li(),w=y.fallback,D=o.mode,y=Sm({mode:"visible",children:y.children},D),w=nl(w,D,Y,null),w.flags|=2,y.return=o,w.return=o,y.sibling=w,o.child=y,dl(o,n.child,null,Y),y=o.child,y.memoizedState=db(Y),y.childLanes=fb(n,d,Y),o.memoizedState=ub,ed(null,y));if(ii(o),d0(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,Uu({value:y,source:null,stack:null})),Nm(n,o,Y)}if(Jn||ol(n,o,Y,!1),d=(Y&n.childLanes)!==0,Jn||d){if(ai.current!==null)return Nm(n,o,Y);if(d=wn,d!==null&&(y=Fi(d,Y),y!==0&&y!==D.retryLane))throw D.retryLane=y,tl(n,y),er(d,n,y),lb;return u0(w)||Um(),Nm(n,o,Y)}return u0(w)?(o.flags|=192,o.child=n.child,null):(n=D.treeContext,Sn=Kr(w.nextSibling),ps=o,Ut=!0,Ja=null,qr=!1,n!==null&&zj(o,n),o=mb(o,y.children),o.flags|=134221824,o)}function J2(n,o,i){n.lanes|=o;var d=n.alternate;d!==null&&(d.lanes|=o),nm(n.return,o,i)}function eS(n){for(var o=null;n!==null;){var i=n.alternate;i!==null&&dm(i)===null&&(o=n),n=n.sibling}return o}function Cm(n,o,i,d,y,w){var D=n.memoizedState;D===null?n.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:i,tailMode:y,treeForkCount:w}:(D.isBackwards=o,D.rendering=null,D.renderingStartTime=0,D.last=d,D.tail=i,D.tailMode=y,D.treeForkCount=w)}function hb(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 pb(n,o,i){var d=o.pendingProps,y=d.revealOrder,w=d.tail;d=d.children;var D=ks.current;if(o.flags&128)return Wu(o,D),null;var Y=(D&2)!==0;if(Y?(D=D&1|2,o.flags|=128):D&=1,Wu(o,D),y==="backwards"&&n!==null?(hb(n),ss(n,o,d,i),hb(n)):ss(n,o,d,i),d=Ut?Vu:0,!Y&&n!==null&&(n.flags&128)!==0)e:for(n=o.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&J2(n,i,o);else if(n.tag===19)J2(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=eS(o.child),i===null?(y=o.child,o.child=null):(y=i.sibling,i.sibling=null,hb(o)),Cm(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&&dm(n)===null){o.child=y;break}n=y.sibling,y.sibling=i,i=y,y=n}Cm(o,!0,i,null,w,d);break;case"together":Cm(o,!1,null,null,void 0,d);break;case"independent":o.memoizedState=null;break;default:i=eS(o.child),i===null?(y=o.child,o.child=null):(y=i.sibling,i.sibling=null),Cm(o,!1,y,i,w,d)}return o.child}function tS(n,o,i){var d=o.pendingProps;return ti(o,o.type,d.value),ss(n,o,d.children,i),o.child}function ma(n,o,i){if(n!==null&&(o.dependencies=n.dependencies),fi|=o.lanes,(i&o.childLanes)===0)if(n!==null){if(ol(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=ia(n,n.pendingProps),o.child=i,i.return=o;n.sibling!==null;)n=n.sibling,i=i.sibling=ia(n,n.pendingProps),i.return=o;i.sibling=null}return o.child}function gb(n,o){return(n.lanes&o)!==0?!0:(n=n.dependencies,!!(n!==null&&sm(n)))}function RD(n,o,i){switch(o.tag){case 3:Be(o,o.stateNode.containerInfo),ti(o,Qn,n.memoizedState.cache),sl();break;case 27:case 5:Ye(o);break;case 4:Be(o,o.stateNode.containerInfo);break;case 10:ti(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,Vx(o),null;break;case 13:var d=o.memoizedState;if(d!==null){if(d.dehydrated!==null)return ii(o),o.flags|=128,null;d=ol(n,o,i,!1);var y=o.child.childLanes;return d||(i&y)!==0?Z2(n,o,i):(ii(o),n=ma(n,o,i),n!==null?n.sibling:null)}ii(o);break;case 19:if(o.flags&128)return pb(n,o,i);if(y=(n.flags&128)!==0,d=(i&o.childLanes)!==0,d||(ol(n,o,i,!1),d=(i&o.childLanes)!==0),y){if(d)return pb(n,o,i);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),Wu(o,ks.current),d)break;return null;case 22:return o.lanes=0,q2(n,o,i,o.pendingProps);case 24:ti(o,Qn,n.memoizedState.cache)}return ma(n,o,i)}function nS(n,o,i){if(n!==null)if(n.memoizedProps!==o.pendingProps)Jn=!0;else{if(!gb(n,i)&&(o.flags&128)===0)return Jn=!1,RD(n,o,i);Jn=(n.flags&131072)!==0}else Jn=!1,Ut&&(o.flags&1048576)!==0&&Dj(o,Vu,o.index);switch(o.lanes=0,o.tag){case 16:e:{var d=o.pendingProps;if(n=cl(o.elementType),o.type=n,typeof n=="function")Sx(n)?(d=ml(n,d),o.tag=1,o=W2(null,o,n,d,i)):(o.tag=0,o=cb(null,o,n,d,i));else{if(n!=null){var y=n.$$typeof;if(y===F){o.tag=11,o=H2(null,o,n,d,i);break e}else if(y===X){o.tag=14,o=F2(null,o,n,d,i);break e}else if(y===H){o.tag=10,o.type=n,o=tS(null,o,i);break e}}throw o=de(n)||n,Error(a(306,o,""))}}return o;case 0:return cb(n,o,o.type,o.pendingProps,i);case 1:return d=o.type,y=ml(d,o.pendingProps),W2(n,o,d,y,i);case 3:e:{if(Be(o,o.stateNode.containerInfo),n===null)throw Error(a(387));d=o.pendingProps;var w=o.memoizedState;y=w.element,Ix(n,o),Xu(o,d,null,i);var D=o.memoizedState;if(d=D.cache,ti(o,Qn,d),d!==w.cache&&Ax(o,[Qn],i,!0),Ku(),d=D.element,w.isDehydrated)if(w={element:d,isDehydrated:!1,cache:D.cache},o.updateQueue.baseState=w,o.memoizedState=w,o.flags&256){o=Q2(n,o,d,i);break e}else if(d!==y){y=Hr(Error(a(424)),o),Uu(y),o=Q2(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(Sn=Kr(n.firstChild),ps=o,Ut=!0,Ja=null,qr=!0,i=qj(o,null,d,i),o.child=i;i;)i.flags=i.flags&-3|134221824,i=i.sibling}else{if(sl(),d===y){o=ma(n,o,i);break e}ss(n,o,d,i)}o=o.child}return o;case 26:return wc(n,o),n===null?(i=TN(o.type,null,o.pendingProps,null))?o.memoizedState=i:Ut||(o.stateNode=aN(o.type,o.pendingProps,xe.current,o)):o.memoizedState=TN(o.type,n.memoizedProps,o.pendingProps,n.memoizedState),null;case 27:return Ye(o),n===null&&Ut&&(d=o.stateNode=SN(o.type,o.pendingProps,xe.current),ps=o,qr=!0,y=Sn,gi(o.type)?(f0=y,Sn=Kr(d.firstChild)):Sn=y),ss(n,o,o.pendingProps.children,i),wc(n,o),n===null&&(o.flags|=4194304),o.child;case 5:return n===null&&Ut&&((y=d=Sn)&&(d=Sz(d,o.type,o.pendingProps,qr),d!==null?(o.stateNode=d,ps=o,Sn=Kr(d.firstChild),qr=!1,y=!0):y=!1),y||ei(o)),Ye(o),y=o.type,w=o.pendingProps,D=n!==null?n.memoizedProps:null,d=w.children,s0(y,w)?d=null:D!==null&&s0(y,D)&&(o.flags|=32),o.memoizedState!==null&&(y=Fx(n,o,bD,null,null,i),$c._currentValue=y),wc(n,o),ss(n,o,d,i),o.child;case 6:return n===null&&Ut&&((n=i=Sn)&&(i=Nz(i,o.pendingProps,qr),i!==null?(o.stateNode=i,ps=o,Sn=null,n=!0):n=!1),n||ei(o)),null;case 13:return Z2(n,o,i);case 4:return Be(o,o.stateNode.containerInfo),d=o.pendingProps,n===null?o.child=dl(o,null,d,i):ss(n,o,d,i),o.child;case 11:return H2(n,o,o.type,o.pendingProps,i);case 7:return d=o.pendingProps,wc(n,o),ss(n,o,d,i),o.child;case 8:return ss(n,o,o.pendingProps.children,i),o.child;case 12:return ss(n,o,o.pendingProps.children,i),o.child;case 10:return tS(n,o,i);case 9:return y=o.type._context,d=o.pendingProps.children,al(o),y=Ns(y),d=d(y),o.flags|=1,ss(n,o,d,i),o.child;case 14:return F2(n,o,o.type,o.pendingProps,i);case 15:return G2(n,o,o.type,o.pendingProps,i);case 19:return pb(n,o,i);case 31:return TD(n,o,i);case 22:return q2(n,o,i,o.pendingProps);case 24:return al(o),d=Ns(Qn),n===null?(y=Dx(),y===null&&(y=wn,w=Ox(),y.pooledCache=w,w.refCount++,w!==null&&(y.pooledCacheLanes|=i),y=w),o.memoizedState={parent:d,cache:y},Px(o),ti(o,Qn,y)):((n.lanes&i)!==0&&(Ix(n,o),Xu(o,null,null,i),Ku()),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),ti(o,Qn,d)):(d=w.cache,ti(o,Qn,d),d!==y.cache&&Ax(o,[Qn],i,!0))),ss(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:Ut&&em(o),n!==null&&n.memoizedProps.name!==d.name?o.flags|=4194816:wc(n,o),ss(n,o,d.children,i),o.child;case 29:throw o.pendingProps}throw Error(a(156,o.tag))}function ha(n){n.flags|=4}function xb(n,o,i,d,y){var w;if((w=(n.mode&32)!==0)&&(w=i===null?ON(o,d):ON(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(_S())n.flags|=8192;else throw ul=im,zx}else n.flags&=-16777217}function sS(n,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!MN(o))if(_S())n.flags|=8192;else throw ul=im,zx}function km(n,o){o!==null&&(n.flags|=4),n.flags&16384&&(o=n.tag!==22?vs():536870912,n.lanes|=o,kc|=o)}function td(n,o){if(!Ut)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 Nn(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 AD(n,o,i){var d=o.pendingProps;switch(kx(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nn(o),null;case 1:return Nn(o),null;case 3:return i=o.stateNode,d=null,n!==null&&(d=n.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),ua(Qn),we(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(hc(o)?ha(o):n===null||n.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Ex())),Nn(o),null;case 26:var y=o.type,w=o.memoizedState;return n===null?(ha(o),w!==null?(Nn(o),sS(o,w)):(Nn(o),xb(o,y,null,d,i))):w?w!==n.memoizedState?(ha(o),Nn(o),sS(o,w)):(Nn(o),o.flags&=-16777217):(n=n.memoizedProps,n!==d&&ha(o),Nn(o),xb(o,y,n,d,i)),null;case 27:if(Ee(o),i=xe.current,y=o.type,n!==null&&o.stateNode!=null)n.memoizedProps!==d&&ha(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return Nn(o),o.subtreeFlags&=-33554433,null}n=J.current,hc(o)?Pj(o):(n=SN(y,d,i),o.stateNode=n,ha(o))}return Nn(o),o.subtreeFlags&=-33554433,null;case 5:if(Ee(o),y=o.type,n!==null&&o.stateNode!=null)n.memoizedProps!==d&&ha(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return Nn(o),o.subtreeFlags&=-33554433,null}if(w=J.current,hc(o))Pj(o);else{var D=fd(xe.current);switch(w){case 1:w=D.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:w=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":w=D.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":w=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":w=D.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof d.is=="string"?D.createElement("select",{is:d.is}):D.createElement("select"),d.multiple?w.multiple=!0:d.size&&(w.size=d.size);break;default:w=typeof d.is=="string"?D.createElement(y,{is:d.is}):D.createElement(y)}}w[zn]=o,w[ws]=d;e:for(D=o.child;D!==null;){if(D.tag===5||D.tag===6)w.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===o)break e;for(;D.sibling===null;){if(D.return===null||D.return===o)break e;D=D.return}D.sibling.return=D.return,D=D.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&&ha(o)}}return Nn(o),o.subtreeFlags&=-33554433,xb(o,o.type,n===null?null:n.memoizedProps,o.pendingProps,i),null;case 6:if(n&&o.stateNode!=null)n.memoizedProps!==d&&ha(o);else{if(typeof d!="string"&&o.stateNode===null)throw Error(a(166));if(n=xe.current,hc(o)){if(n=o.stateNode,i=o.memoizedProps,d=null,y=ps,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}n[zn]=o,n=!!(n.nodeValue===i||d!==null&&d.suppressHydrationWarning===!0||nN(n.nodeValue,i)),n||ei(o,!0)}else n=fd(n).createTextNode(d),n[zn]=o,o.stateNode=n}return Nn(o),null;case 31:if(i=o.memoizedState,n===null||n.memoizedState!==null){if(d=hc(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 sl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Nn(o),n=!1}else i=Ex(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return o.flags&256?(gr(o),o):(gr(o),null);if((o.flags&128)!==0)throw Error(a(558))}return Nn(o),null;case 13:if(d=o.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(y=hc(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 sl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Nn(o),y=!1}else y=Ex(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=y),y=!0;if(!y)return o.flags&256?(gr(o),o):(gr(o),null)}return gr(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),km(o,o.updateQueue),Nn(o),null);case 4:return we(),n===null&&Zb(o.stateNode.containerInfo),o.flags|=67108864,Nn(o),null;case 10:return ua(o.type),Nn(o),null;case 19:if(Ux(o),d=o.memoizedState,d===null)return Nn(o),null;if(y=(o.flags&128)!==0,w=d.rendering,w===null)if(y)td(d,!1);else{if(Vn!==0||n!==null&&(n.flags&128)!==0)for(n=o.child;n!==null;){if(w=dm(n),w!==null){for(o.flags|=128,td(d,!1),n=w.updateQueue,o.updateQueue=n,km(o,n),o.subtreeFlags=0,n=i,i=o.child;i!==null;)Aj(i,n),i=i.sibling;return Wu(o,ks.current&1|2),Ut&&la(o,d.treeForkCount),o.child}n=n.sibling}d.tail!==null&&nt()>Lm&&(o.flags|=128,y=!0,td(d,!1),o.lanes=4194304)}else{if(!y)if(n=dm(w),n!==null){if(o.flags|=128,y=!0,n=n.updateQueue,o.updateQueue=n,km(o,n),td(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!w.alternate&&!Ut)return Nn(o),null}else 2*nt()-d.renderingStartTime>Lm&&i!==536870912&&(o.flags|=128,y=!0,td(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||Ut?Wu(o,w):(i=w,Ae(Cs,o),Ae(ks,i),Ds===null&&(Ds=o)),Ut&&la(o,d.treeForkCount),n}return Nn(o),null;case 22:case 23:return gr(o),Bx(),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&&(Nn(o),o.subtreeFlags&6&&(o.flags|=8192)):Nn(o),i=o.updateQueue,i!==null&&km(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(ll),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),o.memoizedState.cache!==i&&(o.flags|=2048),ua(Qn),Nn(o),null;case 25:return null;case 30:return o.flags|=33554432,Nn(o),null}throw Error(a(156,o.tag))}function OD(n,o){switch(kx(o),o.tag){case 1:return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 3:return ua(Qn),we(),n=o.flags,(n&65536)!==0&&(n&128)===0?(o.flags=n&-65537|128,o):null;case 26:case 27:case 5:return Ee(o),null;case 31:if(o.memoizedState!==null){if(gr(o),o.alternate===null)throw Error(a(340));sl()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 13:if(gr(o),n=o.memoizedState,n!==null&&n.dehydrated!==null){if(o.alternate===null)throw Error(a(340));sl()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 19:return Ux(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 ua(o.type),null;case 22:case 23:return gr(o),Bx(),n!==null&&Ne(ll),n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 24:return ua(Qn),null;case 25:return null;default:return null}}function rS(n,o){switch(kx(o),o.tag){case 3:ua(Qn),we();break;case 26:case 27:case 5:Ee(o);break;case 4:we();break;case 31:o.memoizedState!==null&&gr(o);break;case 13:gr(o);break;case 19:Ux(o);break;case 10:ua(o.type);break;case 22:case 23:gr(o),Bx(),n!==null&&Ne(ll);break;case 24:ua(Qn)}}function nd(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,D=i.inst;d=w(),D.destroy=d}i=i.next}while(i!==y)}}catch(Y){an(o,o.return,Y)}}function ci(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 D=d.inst,Y=D.destroy;if(Y!==void 0){D.destroy=void 0,y=o;var ie=i,ve=Y;try{ve()}catch(Te){an(y,ie,Te)}}}d=d.next}while(d!==w)}}catch(Te){an(o,o.return,Te)}}function oS(n){var o=n.updateQueue;if(o!==null){var i=n.stateNode;try{Kj(o,i)}catch(d){an(n,n.return,d)}}}function aS(n,o,i){i.props=ml(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(d){an(n,o,d)}}function Ao(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=oa(n.memoizedProps,y);(y.ref===null||y.ref.name!==w)&&(y.ref=mN(w)),d=y.ref;break;case 7:if(n.stateNode===null){var D=new wr(n);p(n.child,!1,wz,D,void 0,void 0),n.stateNode=D}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 Tm(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++)yN(n.stateNode,o[i])}function iS(n){for(var o=n.return;o!==null&&(yb(o)&&yN(n.stateNode,o.stateNode),!bb(o));)o=o.return}function sd(n){for(var o=n.return;o!==null&&(yb(o)&&jz(n.stateNode,o.stateNode),!bb(o));)o=o.return}function bb(n){return n.tag===5||n.tag===3||n.tag===27}function yb(n){return n&&n.tag===7&&n.stateNode!==null}function vb(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 wb(n,o,i){try{var d=n.stateNode;sz(d,n.type,i,o),d[ws]=o}catch(y){an(n,n.return,y)}}function lS(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&gi(n.type)||n.tag===4}function jb(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||lS(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&&gi(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 Sb(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=Vs)),Tm(n,d),wt=!0;else if(y!==4&&(y===27&&(Tm(n,d),d=null,gi(n.type)&&(i=n.stateNode,o=null)),n=n.child,n!==null))for(Sb(n,o,i,d),n=n.sibling;n!==null;)Sb(n,o,i,d),n=n.sibling}function Em(n,o,i,d){var y=n.tag;if(y===5||y===6)y=n.stateNode,o?i.insertBefore(y,o):i.appendChild(y),Tm(n,d),wt=!0;else if(y!==4&&(y===27&&(Tm(n,d),d=null,gi(n.type)&&(i=n.stateNode)),n=n.child,n!==null))for(Em(n,o,i,d),n=n.sibling;n!==null;)Em(n,o,i,d),n=n.sibling}function cS(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 Rm=!1,xr=null;function uS(n){(n.tag===30||(n.subtreeFlags&33554432)!==0)&&(Rm=!0)}var Oo=null;function dS(){var n=Oo;return Oo=null,n}var Qs=0;function jc(n,o,i,d,y){return Qs=0,fS(n.child,o,i,d,y)}function fS(n,o,i,d,y){for(var w=!1;n!==null;){if(n.tag===5){var D=n.stateNode;if(d!==null){var Y=a0(D);d.push(Y),Y.view&&(w=!0)}else w||a0(D).view&&(w=!0);Rm=!0,dN(D,Qs===0?o:o+"_"+Qs,i),Qs++}else(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&y||fS(n.child,o,i,d,y)&&(w=!0));n=n.sibling}return w}function Mo(n,o){for(;n!==null;)n.tag===5?fN(n.stateNode,n.memoizedProps):(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&o||Mo(n.child,o)),n=n.sibling}function Am(n){if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if((n.tag!==22||n.memoizedState===null)&&(Am(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=aa(o.default,o.share),o!=="none"&&(jc(n,i,o,null,!1)||Mo(n.child,!1))}n=n.sibling}}function Nb(n,o){if(n.tag===30){var i=n.stateNode,d=n.memoizedProps,y=oa(d,i),w=aa(d.default,i.paired?d.share:d.enter);w!=="none"?jc(n,y,w,null,!1)?(Am(n),i.paired||o||Ac(n,d.onEnter)):Mo(n.child,!1):Am(n)}else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)Nb(n,o),n=n.sibling;else Am(n)}function Cb(n){if(xr!==null&&xr.size!==0){var o=xr;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=aa(i.default,i.share);if(w!=="none"&&(jc(n,d,w,null,!1)?(w=n.stateNode,y.paired=w,w.paired=y,Ac(n,i.onShare)):Mo(n.child,!1)),o.delete(d),o.size===0)break}}}Cb(n)}n=n.sibling}}}function kb(n){if(n.tag===30){var o=n.memoizedProps,i=oa(o,n.stateNode),d=xr!==null?xr.get(i):void 0,y=aa(o.default,d!==void 0?o.share:o.exit);y!=="none"&&(jc(n,i,y,null,!1)?d!==void 0?(y=n.stateNode,d.paired=y,y.paired=d,xr.delete(i),Ac(n,o.onShare)):Ac(n,o.onExit):Mo(n.child,!1)),xr!==null&&Cb(n)}else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)kb(n),n=n.sibling;else xr!==null&&Cb(n)}function mS(n){for(n=n.child;n!==null;){if(n.tag===30){var o=n.memoizedProps,i=oa(o,n.stateNode);o=aa(o.default,o.update),n.flags&=-5,o!=="none"&&jc(n,i,o,n.memoizedState=[],!1)}else(n.subtreeFlags&33554432)!==0&&mS(n);n=n.sibling}}function Tb(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,Mo(n.child,!1))}Tb(n)}n=n.sibling}}function Om(n){if(n.tag===30)n.stateNode.paired=null,Mo(n.child,!1),Tb(n);else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)Om(n),n=n.sibling;else Tb(n)}function hS(n){for(n=n.child;n!==null;)n.tag===30?Mo(n.child,!1):(n.subtreeFlags&33554432)!==0&&hS(n),n=n.sibling}function Eb(n,o,i,d,y,w,D){for(var Y=!1;o!==null;){if(o.tag===5){var ie=o.stateNode;if(w!==null&&Qs<w.length){var ve=w[Qs],Te=a0(ie);(ve.view||Te.view)&&(Y=!0);var Pe;if(Pe=(n.flags&4)===0)if(Te.clip)Pe=!0;else{Pe=ve.rect;var ge=Te.rect;Pe=Pe.y!==ge.y||Pe.x!==ge.x||Pe.height!==ge.height||Pe.width!==ge.width}Pe&&(n.flags|=4),Te.abs?Te=!ve.abs:(ve=ve.rect,Te=Te.rect,Te=ve.height!==Te.height||ve.width!==Te.width),Te&&(n.flags|=32)}else n.flags|=32;(n.flags&4)!==0&&dN(ie,Qs===0?i:i+"_"+Qs,y),Y&&(n.flags&4)!==0||(Oo===null&&(Oo=[]),Oo.push(ie,Qs===0?d:d+"_"+Qs,o.memoizedProps)),Qs++}else(o.tag!==22||o.memoizedState===null)&&(o.tag===30&&D?n.flags|=o.flags&32:Eb(n,o.child,i,d,y,w,D)&&(Y=!0));o=o.sibling}return Y}function pS(n,o){for(n=n.child;n!==null;){if(n.tag===30){var i=n.memoizedProps,d=n.stateNode,y=oa(i,d),w=aa(i.default,i.update),D;D=n.memoizedState,n.memoizedState=null,d=n;var Y=n.child;Qs=0,y=Eb(d,Y,y,y,w,D,!1),(n.flags&4)!==0&&y&&Ac(n,i.onUpdate)}else(n.subtreeFlags&33554432)!==0&&pS(n);n=n.sibling}}var gs=!1,rn=!1,Do=!1,Rb=!1,gS=typeof WeakSet=="function"?WeakSet:Set,xs=null,zo=!1,rd=!1,Mm=!1,Ab=!1;function MD(n,o,i){if(n=n.containerInfo,t0=Bc,n=vj(n),gx(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,D=y.focusNode;y=y.focusOffset;try{d.nodeType,D.nodeType}catch{d=null;break e}var Y=0,ie=-1,ve=-1,Te=0,Pe=0,ge=n,Se=null;t:for(;;){for(var tt;ge!==d||w!==0&&ge.nodeType!==3||(ie=Y+w),ge!==D||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&&++Te===w&&(ie=Y),Se===D&&++Pe===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(n0={focusedElem:n,selectionRange:d},Bc=!1,i=(i&335544064)===i,xs=o,o=i?9270:1024;xs!==null;){if(n=xs,i&&(d=n.deletions,d!==null))for(w=0;w<d.length;w++)i&&kb(d[w]);if(n.alternate===null&&(n.flags&2)!==0)i&&uS(n),Dm(i);else{if(n.tag===22){if(d=n.alternate,n.memoizedState!==null){d!==null&&d.memoizedState===null&&i&&kb(d),Dm(i);continue}else if(d!==null&&d.memoizedState!==null){i&&uS(n),Dm(i);continue}}d=n.child,(n.subtreeFlags&o)!==0&&d!==null?(d.return=n,xs=d):(i&&mS(n),Dm(i))}}xr=null}function Dm(n){for(;xs!==null;){var o=xs,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 D=ml(o.type,y);i=w.getSnapshotBeforeUpdate(D,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)c0(d);else if(i===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":c0(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=oa(d.memoizedProps,d.stateNode),y=o.memoizedProps,y=aa(y.default,y.update),y!=="none"&&jc(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,xs=d;break}xs=o.return}}function xS(n,o,i){var d=i.flags;switch(i.tag){case 0:case 11:case 15:Po(n,i),d&4&&nd(5,i);break;case 1:if(Po(n,i),d&4)if(n=i.stateNode,o===null)try{n.componentDidMount()}catch(D){an(i,i.return,D)}else{var y=ml(i.type,o.memoizedProps);o=o.memoizedState;try{n.componentDidUpdate(y,o,n.__reactInternalSnapshotBeforeUpdate)}catch(D){an(i,i.return,D)}}d&64&&oS(i),d&512&&Ao(i,i.return);break;case 3:if(Po(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{Kj(n,o)}catch(D){an(i,i.return,D)}}break;case 27:o===null&&d&4&&cS(i);case 26:case 5:Po(n,i),o===null&&d&4&&vb(i),d&512&&Ao(i,i.return);break;case 12:Po(n,i);break;case 31:Po(n,i),d&4&&wS(n,i);break;case 13:Po(n,i),d&4&&jS(n,i),d&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=FD.bind(null,i),Cz(n,i))));break;case 22:if(d=i.memoizedState!==null||gs,!d){var w=o!==null&&o.memoizedState!==null||rn;o=gs,y=rn,gs=d,(rn=w)&&!y?(d=2,(i.subtreeFlags&8772)!==0&&(d|=1),mo(n,i,d)):Po(n,i),gs=o,rn=y}break;case 30:Po(n,i),d&512&&Ao(i,i.return);break;case 7:d&512&&Ao(i,i.return);default:Po(n,i)}}function Ob(n,o){for(n=n.child;n!==null;)bS(n,o),n=n.sibling}function bS(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,D=w!=null&&w.hasOwnProperty("display")?w.display:null;y.style.display=D==null||typeof D=="boolean"?"":(""+D).trim()}}catch(ie){an(n,n.return,ie)}Mb(n,o);break;case 6:try{n.stateNode.nodeValue=o?"":n.memoizedProps,wt=!0}catch(ie){an(n,n.return,ie)}break;case 18:try{var Y=n.stateNode;o?uN(Y,!0):uN(n.stateNode,!1)}catch(ie){an(n,n.return,ie)}break;case 22:case 23:n.memoizedState===null&&Ob(n,o);break;default:Ob(n,o)}}function Mb(n,o){if(n.subtreeFlags&67108864)for(n=n.child;n!==null;){e:{var i=n,d=o;switch(i.tag){case 4:bS(i,d);break e;case 22:i.memoizedState===null&&Mb(i,d);break e;default:Mb(i,d)}}n=n.sibling}}function yS(n){var o=n.alternate;o!==null&&(n.alternate=null,yS(o)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(o=n.stateNode,o!==null&&nc(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 Mn=null,Zs=!1;function uo(n,o,i){for(i=i.child;i!==null;)vS(n,o,i),i=i.sibling}function vS(n,o,i){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(Et,i)}catch{}switch(i.tag){case 26:rn||Ts(i,o),uo(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),sd(i);var d=Mn,y=Zs;gi(i.type)&&(Mn=i.stateNode,Zs=!1),uo(n,o,i),NN(i.stateNode,i.type,i.memoizedProps),Mn=d,Zs=y;break;case 5:rn||Ts(i,o),sd(i);case 6:if(i.tag===6&&sd(i),d=Mn,y=Zs,Mn=null,uo(n,o,i),Mn=d,Zs=y,Mn!==null)if(Zs)try{(Mn.nodeType===9?Mn.body:Mn.nodeName==="HTML"?Mn.ownerDocument.body:Mn).removeChild(i.stateNode),wt=!0}catch(w){an(i,o,w)}else try{Mn.removeChild(i.stateNode),wt=!0}catch(w){an(i,o,w)}break;case 18:Mn!==null&&(Zs?(n=Mn,cN(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),Vc(n)):cN(Mn,i.stateNode));break;case 4:d=Mn,y=Zs,Mn=i.stateNode.containerInfo,Zs=!0,uo(n,o,i),Mn=d,Zs=y;break;case 0:case 11:case 14:case 15:ci(2,i,o),rn||ci(4,i,o),uo(n,o,i);break;case 1:rn||(Ts(i,o),d=i.stateNode,typeof d.componentWillUnmount=="function"&&aS(i,o,d)),uo(n,o,i);break;case 21:uo(n,o,i);break;case 22:rn=(d=rn)||i.memoizedState!==null,uo(n,o,i),rn=d;break;case 30:Ts(i,o),uo(n,o,i);break;case 7:rn||Ts(i,o),uo(n,o,i);break;default:uo(n,o,i)}}function wS(n,o){if(o.memoizedState===null&&(n=o.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Vc(n)}catch(i){an(o,o.return,i)}}}function jS(n,o){if(o.memoizedState===null&&(n=o.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Vc(n)}catch(i){an(o,o.return,i)}}function DD(n){switch(n.tag){case 31:case 13:case 19:var o=n.stateNode;return o===null&&(o=n.stateNode=new gS),o;case 22:return n=n.stateNode,o=n._retryCache,o===null&&(o=n._retryCache=new gS),o;default:throw Error(a(435,n.tag))}}function zm(n,o){var i=DD(n);o.forEach(function(d){if(!i.has(d)){i.add(d);var y=GD.bind(null,n,d);d.then(y,y)}})}function Fs(n,o,i){var d=o.deletions;if(d!==null)for(var y=0;y<d.length;y++){var w=d[y],D=n,Y=o,ie=Y;e:for(;ie!==null;){switch(ie.tag){case 27:if(gi(ie.type)){Mn=ie.stateNode,Zs=!1;break e}break;case 5:Mn=ie.stateNode,Zs=!1;break e;case 3:case 4:Mn=ie.stateNode.containerInfo,Zs=!0;break e}ie=ie.return}if(Mn===null)throw Error(a(160));vS(D,Y,w),Mn=null,Zs=!1,D=w.alternate,D!==null&&(D.return=null),w.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)SS(o,n,i),o=o.sibling}var fo=null;function SS(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 D=d[w];D.ref.impl=D.nextImpl}Fs(o,n,i),Gs(n),y&4&&(ci(3,n,n.return),nd(3,n),ci(5,n,n.return));break;case 1:Fs(o,n,i),Gs(n),y&512&&(rn||d===null||Ts(d,d.return)),y&64&&gs&&(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=fo,Fs(o,n,i),Gs(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(gs)n.stateNode=aN(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[qi]||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,Ve(d),o=d;break e;case"link":if(w=AN("link","href",y).get(o+(i.href||""))){for(D=0;D<w.length;D++)if(d=w[D],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(D,1);break t}}d=y.createElement(o),Es(d,o,i),y.head.appendChild(d);break;case"meta":if(w=AN("meta","content",y).get(o+(i.content||""))){for(D=0;D<w.length;D++)if(d=w[D],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(D,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,Ve(d),o=d}n.stateNode=o}else gs||g0(w,n.type,n.stateNode);else n.stateNode=RN(w,i,n.memoizedProps);else y!==i?(y===null?(o=d.stateNode,o===null||rn||o.parentNode.removeChild(o)):y.count--,i===null?gs||g0(w,n.type,n.stateNode):RN(w,i,n.memoizedProps)):i===null&&n.stateNode!==null&&wb(n,n.memoizedProps,d.memoizedProps);break;case 27:Fs(o,n,i),Gs(n),y&512&&(rn||d===null||Ts(d,d.return)),d!==null&&y&4&&wb(n,n.memoizedProps,d.memoizedProps);break;case 5:if(w=Do,Do=!1,Fs(o,n,i),Do=w,Gs(n),y&512&&(rn||d===null||Ts(d,d.return)),n.flags&32){o=n.stateNode;try{Bs(o,""),wt=!0}catch(Te){an(n,n.return,Te)}}y&4&&n.stateNode!=null&&(o=n.memoizedProps,wb(n,o,d!==null?d.memoizedProps:o)),y&1024&&(Rb=!0);break;case 6:if(Fs(o,n,i),Gs(n),y&4){if(n.stateNode===null)throw Error(a(162));o=n.memoizedProps,i=n.stateNode;try{i.nodeValue=o,wt=!0}catch(Te){an(n,n.return,Te)}}break;case 3:if(wt=!1,Xm=null,w=fo,fo=md(o.containerInfo),Fs(o,n,i),fo=w,Gs(n),y&4&&d!==null&&d.memoizedState.isDehydrated)try{Vc(o.containerInfo)}catch(Te){an(n,n.return,Te)}Rb&&(Rb=!1,NS(n)),wt=!1;break;case 4:y=Do,Do=gs,d=ns(),w=fo,fo=md(n.stateNode.containerInfo),Fs(o,n,i),Gs(n),fo=w,wt&&rd&&(Mm=!0),wt=d,Do=y;break;case 12:Fs(o,n,i),Gs(n);break;case 31:Fs(o,n,i),Gs(n),y&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,zm(n,o)));break;case 13:Fs(o,n,i),Gs(n),n.child.flags&8192&&n.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(_m=nt()),y&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,zm(n,o)));break;case 22:w=n.memoizedState!==null,D=d!==null&&d.memoizedState!==null;var Y=gs,ie=rn,ve=Do;gs=Y||w,Do=ve||w,rn=ie||D,Fs(o,n,i),rn=ie,Do=ve,gs=Y,Gs(n),y&8192&&(o=n.stateNode,o._visibility=w?o._visibility&-2:o._visibility|1,!w||d===null||D||gs||rn||(o=D||rn,i=gs,d=rn,gs=w||gs,rn=o,ui(n,2),gs=i,rn=d),!w&&Do||Ob(n,w)),y&4&&(o=n.updateQueue,o!==null&&(i=o.retryQueue,i!==null&&(o.retryQueue=null,zm(n,i))));break;case 19:Fs(o,n,i),Gs(n),y&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,zm(n,o)));break;case 30:y&512&&(rn||d===null||Ts(d,d.return)),y=ns(),w=rd,D=(i&335544064)===i,Y=n.memoizedProps,rd=D&&aa(Y.default,Y.update)!=="none",Fs(o,n,i),Gs(n),D&&d!==null&&wt&&(n.flags|=4),rd=w,wt=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:Fs(o,n,i),Gs(n)}}function Gs(n){var o=n.flags;if(o&2){try{for(var i,d=n.return;d!==null;){if(lS(d)){i=d;break}d=d.return}d=null;for(var y=n.return;y!==null;){if(yb(y)){var w=y.stateNode;d===null?d=[w]:d.push(w)}if(bb(y))break;y=y.return}var D=d;if(i==null)throw Error(a(160));switch(i.tag){case 27:var Y=i.stateNode,ie=jb(n);Em(n,ie,Y,D);break;case 5:var ve=i.stateNode;i.flags&32&&(Bs(ve,""),i.flags&=-33);var Te=jb(n);Em(n,Te,ve,D);break;case 3:case 4:var Pe=i.stateNode.containerInfo,ge=jb(n);Sb(n,ge,Pe,D);break;default:throw Error(a(161))}}catch(Se){an(n,n.return,Se)}n.flags&=-3}o&4096&&(n.flags&=-4097)}function NS(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var o=n;NS(o),o.tag===5&&o.flags&1024&&(o=o.stateNode,Bc=!0,o.reset(),Bc=!1),n=n.sibling}}function Sc(n,o){if(o.subtreeFlags&9270)for(o=o.child;o!==null;)CS(o,n),o=o.sibling;else pS(o)}function CS(n,o){var i=n.alternate;if(i===null)Nb(n,!1);else switch(n.tag){case 3:if(Ab=zo=!1,dS(),Sc(o,n),!zo&&!Mm){if(n=Oo,n!==null)for(var d=0;d<n.length;d+=3){i=n[d];var y=n[d+1];fN(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"})),Ab=!0}Oo=null;break;case 5:Sc(o,n);break;case 4:d=zo,zo=!1,Sc(o,n),zo&&(Mm=!0),zo=d;break;case 22:n.memoizedState===null&&(i.memoizedState!==null?Nb(n,!1):Sc(o,n));break;case 30:d=zo,y=dS(),zo=!1,Sc(o,n),zo&&(n.flags|=4);var w=n.memoizedProps,D=n.stateNode;o=oa(w,D),D=oa(i.memoizedProps,D);var Y=aa(w.default,w.update);Y==="none"?o=!1:(w=i.memoizedState,i.memoizedState=null,i=n.child,Qs=0,o=Eb(n,i,o,D,Y,w,!0),Qs!==(w===null?0:w.length)&&(n.flags|=32)),(n.flags&4)!==0&&o?(Ac(n,n.memoizedProps.onUpdate),Oo=y):y!==null&&(y.push.apply(y,Oo),Oo=y),zo=(n.flags&32)!==0?!0:d;break;default:Sc(o,n)}}function Po(n,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)xS(n,o.alternate,o),o=o.sibling}function ui(n,o){for(n=n.child;n!==null;){var i=n,d=o;switch(i.tag){case 0:case 11:case 14:case 15:ci(4,i,i.return),ui(i,d);break;case 1:Ts(i,i.return);var y=i.stateNode;typeof y.componentWillUnmount=="function"&&aS(i,i.return,y),ui(i,d);break;case 27:(d&2)!==0&&NN(i.stateNode,i.type,i.memoizedProps);case 5:Ts(i,i.return),i.tag!==5&&i.tag!==27||sd(i),ui(i,d);break;case 6:sd(i);break;case 26:Ts(i,i.return),y=i.stateNode,i.memoizedState!==null||y===null||rn||y.parentNode.removeChild(y),ui(i,d);break;case 22:i.memoizedState===null&&ui(i,d);break;case 30:Ts(i,i.return),ui(i,d);break;case 7:Ts(i,i.return);default:ui(i,d)}n=n.sibling}}function mo(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,D=w.flags,Y=(i&1)!==0;switch(w.tag){case 0:case 11:case 15:mo(y,w,i),nd(4,w);break;case 1:if(mo(y,w,i),d=w,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(Te){an(d,d.return,Te)}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++)Yj(ve[y],ie)}catch(Te){an(d,d.return,Te)}}Y&&D&64&&oS(w),Ao(w,w.return);break;case 27:(i&2)!==0&&cS(w);case 5:w.tag!==5&&w.tag!==27||iS(w),mo(y,w,i),Y&&d===null&&D&4&&vb(w),Ao(w,w.return);break;case 6:iS(w);break;case 26:ie=w.stateNode,w.memoizedState!==null||ie===null||gs||g0(md(ie.ownerDocument),w.type,ie),mo(y,w,i),Y&&d===null&&D&4&&vb(w),Ao(w,w.return);break;case 12:mo(y,w,i);break;case 31:mo(y,w,i),Y&&D&4&&wS(y,w);break;case 13:mo(y,w,i),Y&&D&4&&jS(y,w);break;case 22:w.memoizedState===null&&mo(y,w,i),Ao(w,w.return);break;case 30:mo(y,w,i),Ao(w,w.return);break;case 7:Ao(w,w.return);default:mo(y,w,i)}o=o.sibling}}function Db(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&&Hu(i))}function zb(n,o){n=null,o.alternate!==null&&(n=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==n&&(o.refCount++,n!=null&&Hu(n))}function Yr(n,o,i,d){var y=(i&335544064)===i;if(o.subtreeFlags&(y?10262:10256))for(o=o.child;o!==null;)kS(n,o,i,d),o=o.sibling;else y&&hS(o)}function kS(n,o,i,d){var y=(i&335544064)===i;y&&o.alternate===null&&o.return!==null&&o.return.alternate!==null&&Om(o);var w=o.flags;switch(o.tag){case 0:case 11:case 15:Yr(n,o,i,d),w&2048&&nd(9,o);break;case 1:Yr(n,o,i,d);break;case 3:Yr(n,o,i,d),y&&Ab&&(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&&Hu(w)));break;case 12:if(w&2048){Yr(n,o,i,d),w=o.stateNode;try{var D=o.memoizedProps,Y=D.id,ie=D.onPostCommit;typeof ie=="function"&&ie(Y,o.alternate===null?"mount":"update",w.passiveEffectDuration,-0)}catch(ve){an(o,o.return,ve)}}else Yr(n,o,i,d);break;case 31:Yr(n,o,i,d);break;case 13:Yr(n,o,i,d);break;case 23:break;case 22:D=o.stateNode,Y=o.alternate,o.memoizedState!==null?(y&&Y!==null&&Y.memoizedState===null&&Om(Y),D._visibility&2?Yr(n,o,i,d):od(n,o)):(y&&Y!==null&&Y.memoizedState!==null&&Om(o),D._visibility&2?Yr(n,o,i,d):(D._visibility|=2,Nc(n,o,i,d,(o.subtreeFlags&10256)!==0||!1))),w&2048&&Db(Y,o);break;case 24:Yr(n,o,i,d),w&2048&&zb(o.alternate,o);break;case 30:y&&(w=o.alternate,w!==null&&(Mo(w.child,!0),Mo(o.child,!0))),Yr(n,o,i,d);break;default:Yr(n,o,i,d)}}function Nc(n,o,i,d,y){for(y=y&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var w=n,D=o,Y=i,ie=d,ve=D.flags;switch(D.tag){case 0:case 11:case 15:Nc(w,D,Y,ie,y),nd(8,D);break;case 23:break;case 22:var Te=D.stateNode;D.memoizedState!==null?Te._visibility&2?Nc(w,D,Y,ie,y):od(w,D):(Te._visibility|=2,Nc(w,D,Y,ie,y)),y&&ve&2048&&Db(D.alternate,D);break;case 24:Nc(w,D,Y,ie,y),y&&ve&2048&&zb(D.alternate,D);break;default:Nc(w,D,Y,ie,y)}o=o.sibling}}function od(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:od(i,d),y&2048&&Db(d.alternate,d);break;case 24:od(i,d),y&2048&&zb(d.alternate,d);break;default:od(i,d)}o=o.sibling}}var hl=8192;function pl(n,o,i){if(n.subtreeFlags&hl)for(n=n.child;n!==null;)TS(n,o,i),n=n.sibling}function TS(n,o,i){switch(n.tag){case 26:pl(n,o,i),n.flags&hl&&(n.memoizedState!==null?$z(i,fo,n.memoizedState,n.memoizedProps):(n=n.stateNode,(o&335544128)===o&&zN(i,n)));break;case 5:pl(n,o,i),n.flags&hl&&(n=n.stateNode,(o&335544128)===o&&zN(i,n));break;case 3:case 4:var d=fo;fo=md(n.stateNode.containerInfo),pl(n,o,i),fo=d;break;case 22:n.memoizedState===null&&(d=n.alternate,d!==null&&d.memoizedState!==null?(d=hl,hl=16777216,pl(n,o,i),hl=d):pl(n,o,i));break;case 30:if((n.flags&hl)!==0&&(d=n.memoizedProps.name,d!=null&&d!=="auto")){var y=n.stateNode;y.paired=null,xr===null&&(xr=new Map),xr.set(d,y)}pl(n,o,i);break;default:pl(n,o,i)}}function ES(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 ad(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];xs=d,AS(d,n)}ES(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)RS(n),n=n.sibling}function RS(n){switch(n.tag){case 0:case 11:case 15:ad(n),n.flags&2048&&ci(9,n,n.return);break;case 3:ad(n);break;case 12:ad(n);break;case 22:var o=n.stateNode;n.memoizedState!==null&&o._visibility&2&&(n.return===null||n.return.tag!==13)?(o._visibility&=-3,Pm(n)):ad(n);break;default:ad(n)}}function Pm(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];xs=d,AS(d,n)}ES(n)}for(n=n.child;n!==null;){switch(o=n,o.tag){case 0:case 11:case 15:ci(8,o,o.return),Pm(o);break;case 22:i=o.stateNode,i._visibility&2&&(i._visibility&=-3,Pm(o));break;default:Pm(o)}n=n.sibling}}function AS(n,o){for(;xs!==null;){var i=xs;switch(i.tag){case 0:case 11:case 15:ci(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:Hu(i.memoizedState.cache)}if(d=i.child,d!==null)d.return=i,xs=d;else e:for(i=n;xs!==null;){d=xs;var y=d.sibling,w=d.return;if(yS(d),d===i){xs=null;break e}if(y!==null){y.return=w,xs=y;break e}xs=w}}}var zD={getCacheForType:function(n){var o=Ns(Qn),i=o.data.get(n);return i===void 0&&(i=n(),o.data.set(n,i)),i},cacheSignal:function(){return Ns(Qn).controller.signal}},PD=typeof WeakMap=="function"?WeakMap:Map,nn=0,wn=null,Yt=null,Xt=0,on=0,br=null,di=!1,Cc=!1,Pb=!1,pa=0,Vn=0,fi=0,gl=0,Im=0,yr=0,kc=0,id=null,Js=null,Ib=!1,_m=0,OS=0,Lm=1/0,$m=null,mi=null,In=0,ho=null,xl=null,Io=0,_b=0,Lb=null,MS=null,Tc=null,Ec=null,Rc=null,ld=0,Bm=null;function vr(){return(nn&2)!==0&&Xt!==0?Xt&-Xt:ne.T!==null?Kb():Br()}function DS(){if(yr===0)if((Xt&536870912)===0||Ut){var n=ut;ut<<=1,(ut&3932160)===0&&(ut=262144),yr=n}else yr=536870912;return n=Cs.current,n!==null&&(n.flags|=32),yr}function Ac(n,o){if(o!=null){var i=n.stateNode,d=i.ref;d===null&&(d=i.ref=mN(oa(n.memoizedProps,i))),Ec===null&&(Ec=[]),Ec.push(o.bind(null,d))}}function er(n,o,i){(n===wn&&(on===2||on===9)||n.cancelPendingCommit!==null)&&(Oc(n,0),hi(n,Xt,yr,!1)),$s(n,i),((nn&2)===0||n!==wn)&&(n===wn&&((nn&2)===0&&(gl|=i),Vn===4&&hi(n,Xt,yr,!1)),_o(n))}function zS(n,o,i){if((nn&6)!==0)throw Error(a(327));var d=!i&&(o&127)===0&&(o&n.expiredLanes)===0||_t(n,o),y=d?LD(n,o):Bb(n,o,!0),w=d;do{if(y===0){Cc&&!d&&hi(n,o,0,!1);break}else{if(i=n.current.alternate,w&&!ID(i)){y=Bb(n,o,!1),w=!1;continue}if(y===2){if(w=o,n.errorRecoveryDisabledLanes&w)var D=0;else D=n.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){o=D;e:{var Y=n;y=id;var ie=Y.current.memoizedState.isDehydrated;if(ie&&(Oc(Y,D).flags|=256),D=Bb(Y,D,!1),D!==2&&D!==6){if(Pb&&!ie){Y.errorRecoveryDisabledLanes|=w,gl|=w,y=4;break e}w=Js,Js=y,w!==null&&(Js===null?Js=w:Js.push.apply(Js,w))}y=D}if(w=!1,y!==2)continue}}if(y===1){Oc(n,0),hi(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:hi(d,o,yr,!di);break e;case 2:Js=null;break;case 3:case 5:break;default:throw Error(a(329))}if((o&62914560)===o&&(y=_m+300-nt(),10<y)){if(hi(d,o,yr,!di),zt(d,0,!0)!==0)break e;Io=o,d.timeoutHandle=o0(PS.bind(null,d,i,Js,$m,Ib,o,yr,gl,kc,di,w,"Throttled",-0,0),y);break e}PS(d,i,Js,$m,Ib,o,yr,gl,kc,di,w,null,-0,0)}}break}while(!0);_o(n)}function PS(n,o,i,d,y,w,D,Y,ie,ve,Te,Pe,ge,Se){n.timeoutHandle=-1;var tt=o.subtreeFlags,ft=(w&335544064)===w;if(Pe=null,(ft||tt&8192||(tt&16785408)===16785408)&&(Pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vs},xr=null,TS(o,w,Pe),ft&&(tt=Pe,ft=n.containerInfo,ft=(ft.nodeType===9?ft:ft.ownerDocument).__reactViewTransition,ft!=null&&(tt.count++,tt.waitingForViewTransition=!0,tt=gd.bind(tt),ft.finished.then(tt,tt))),tt=(w&62914560)===w?_m-nt():(w&4194048)===w?OS-nt():0,tt=Bz(Pe,tt),tt!==null)){Io=w,n.cancelPendingCommit=tt(HS.bind(null,n,o,w,i,d,y,D,Y,ie,ve,Te,Pe,null,ge,Se)),hi(n,w,D,!ve);return}HS(n,o,w,i,d,y,D,Y,ie,ve,Te,Pe)}function ID(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(!pr(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 hi(n,o,i,d){o=On(n,o),o&=~Im,o&=~gl,n.suspendedLanes|=o,n.pingedLanes&=~o,d&&(n.warmLanes|=o),d=n.expirationTimes;for(var y=o;0<y;){var w=31-Ct(y),D=1<<w;d[w]=-1,y&=~D}i!==0&&Gn(n,i,o)}function Vm(){return(nn&6)===0?(cd(0),!1):!0}function $b(){if(Yt!==null){if(on===0)var n=Yt.return;else n=Yt,ca=rl=null,Yx(n),xc=null,qu=0,n=Yt;for(;n!==null;)rS(n.alternate,n),n=n.return;Yt=null}}function Oc(n,o){var i=n.timeoutHandle;return i!==-1&&(n.timeoutHandle=-1,az(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Io=0,$b(),wn=n,Yt=i=ia(n.current,null),Xt=o,on=0,br=null,di=!1,Cc=_t(n,o),Pb=!1,kc=yr=Im=gl=fi=Vn=0,Js=id=null,Ib=!1,pa=On(n,o),Xf(),i}function IS(n,o){Pt=null,ne.H=vm,o===gc||o===am?(o=Hj(),on=3):o===zx?(o=Hj(),on=4):on=o===lb?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,br=o,Yt===null&&(Vn=1,wm(n,Hr(o,n.current)))}function _S(){var n=Cs.current;return n===null?!0:(Xt&4194048)===Xt?Ds===null:(Xt&62914560)===Xt||(Xt&536870912)!==0?n===Ds:!1}function LS(){var n=ne.H;return ne.H=vm,n===null?vm:n}function $S(){var n=ne.A;return ne.A=zD,n}function Um(){Vn=4,di||(Xt&4194048)!==Xt&&Cs.current!==null||(Cc=!0),(fi&134217727)===0&&(gl&134217727)===0||wn===null||hi(wn,Xt,yr,!1)}function Bb(n,o,i){var d=nn;nn|=2;var y=LS(),w=$S();(wn!==n||Xt!==o)&&($m=null,Oc(n,o)),o=!1;var D=Vn;e:do try{if(on!==0&&Yt!==null){var Y=Yt,ie=br;switch(on){case 8:$b(),D=6;break e;case 3:case 2:case 9:case 6:Cs.current===null&&(o=!0);var ve=on;if(on=0,br=null,Mc(n,Y,ie,ve),i&&Cc){D=0;break e}break;default:ve=on,on=0,br=null,Mc(n,Y,ie,ve)}}_D(),D=Vn;break}catch(Te){IS(n,Te)}while(!0);return o&&n.shellSuspendCounter++,ca=rl=null,nn=d,ne.H=y,ne.A=w,Yt===null&&(wn=null,Xt=0,Xf()),D}function _D(){for(;Yt!==null;)BS(Yt)}function LD(n,o){var i=nn;nn|=2;var d=LS(),y=$S();wn!==n||Xt!==o?($m=null,Lm=nt()+500,Oc(n,o)):Cc=_t(n,o);e:do try{if(on!==0&&Yt!==null){o=Yt;var w=br;t:switch(on){case 1:on=0,br=null,Mc(n,o,w,1);break;case 2:case 9:if(Vj(w)){on=0,br=null,VS(o);break}o=function(){on!==2&&on!==9||wn!==n||(on=7),_o(n)},w.then(o,o);break e;case 3:on=7;break e;case 4:on=5;break e;case 7:Vj(w)?(on=0,br=null,VS(o)):(on=0,br=null,Mc(n,o,w,7));break;case 5:var D=null;switch(Yt.tag){case 26:D=Yt.memoizedState;case 5:case 27:var Y=Yt;if(D?MN(D):Y.stateNode.complete){on=0,br=null;var ie=Y.sibling;if(ie!==null)Yt=ie;else{var ve=Y.return;ve!==null?(Yt=ve,Hm(ve)):Yt=null}break t}}on=0,br=null,Mc(n,o,w,5);break;case 6:on=0,br=null,Mc(n,o,w,6);break;case 8:$b(),Vn=6;break e;default:throw Error(a(462))}}$D();break}catch(Te){IS(n,Te)}while(!0);return ca=rl=null,ne.H=d,ne.A=y,nn=i,Yt!==null?0:(wn=null,Xt=0,Xf(),Vn)}function $D(){for(;Yt!==null&&!Oe();)BS(Yt)}function BS(n){var o=nS(n.alternate,n,pa);n.memoizedProps=n.pendingProps,o===null?Hm(n):Yt=o}function VS(n){var o=n,i=o.alternate;switch(o.tag){case 15:case 0:o=X2(i,o,o.pendingProps,o.type,void 0,Xt);break;case 11:o=X2(i,o,o.pendingProps,o.type.render,o.ref,Xt);break;case 5:Yx(o);var d=o;d===ps&&(Ut?(tm(d),d.tag===5&&d.stateNode!=null&&(Sn=d.stateNode)):(tm(d),Ut=!0));default:rS(i,o),o=Yt=Aj(o,pa),o=nS(i,o,pa)}n.memoizedProps=n.pendingProps,o===null?Hm(n):Yt=o}function Mc(n,o,i,d){ca=rl=null,Yx(o),xc=null,qu=0;var y=o.return;try{if(kD(n,y,o,i,Xt)){Vn=1,wm(n,Hr(i,n.current)),Yt=null;return}}catch(w){if(y!==null)throw Yt=y,w;Vn=1,wm(n,Hr(i,n.current)),Yt=null;return}o.flags&32768?(Ut||d===1?n=!0:Cc||(Xt&536870912)!==0?n=!1:(di=n=!0,(d===2||d===9||d===3||d===6)&&(d=Cs.current,d!==null&&d.tag===13&&(d.flags|=16384))),US(o,n)):Hm(o)}function Hm(n){var o=n;do{if((o.flags&32768)!==0){US(o,di);return}n=o.return;var i=AD(o.alternate,o,pa);if(i!==null){Yt=i;return}if(o=o.sibling,o!==null){Yt=o;return}Yt=o=n}while(o!==null);Vn===0&&(Vn=5)}function US(n,o){do{var i=OD(n.alternate,n);if(i!==null){i.flags&=32767,Yt=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!o&&(n=n.sibling,n!==null)){Yt=n;return}Yt=n=i}while(n!==null);Vn=6,Yt=null}function HS(n,o,i,d,y,w,D,Y,ie,ve,Te,Pe){n.cancelPendingCommit=null;do Fm();while(In!==0);if((nn&6)!==0)throw Error(a(327));if(o!==null){if(o===n.current)throw Error(a(177));n===wn&&(Yt=wn=null,Xt=0),xl=o,ho=n,Io=i,Lb=y,MS=d,BD(n,o,i,D,Y,ie,Pe)}}function BD(n,o,i,d,y,w,D){var Y=o.lanes|o.childLanes;if(_b=Y,Y|=wx,cr(n,i,Y,d,y,w),Ec=null,(i&335544064)===i?(Rc=hD(n),d=10262):(Rc=null,d=10256),(o.subtreeFlags&d)!==0||(o.flags&d)!==0?(n.callbackNode=null,n.callbackPriority=0,qD(pe,function(){return Fb(),null})):(n.callbackNode=null,n.callbackPriority=0),Rm=!1,d=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||d){d=ne.T,ne.T=null,y=ee.p,ee.p=2,w=nn,nn|=4;try{MD(n,o,i)}finally{nn=w,ee.p=y,ne.T=d}}In=1,Rm?Tc=fz(D,n.containerInfo,Rc,Vb,Ub,UD,Hb,Fb,VD):(Vb(),Ub(),Hb())}function VD(n){if(In!==0){var o=ho.onRecoverableError;o(n,{componentStack:null})}}function UD(){In===3&&(In=0,CS(xl,ho),In=4)}function Vb(){if(In===1){In=0;var n=ho,o=xl,i=Io,d=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||d){d=ne.T,ne.T=null;var y=ee.p;ee.p=2;var w=nn;nn|=4;try{rd=Mm=!1,SS(o,n,i),i=n0;var D=vj(n.containerInfo),Y=i.focusedElem,ie=i.selectionRange;if(D!==Y&&Y&&Y.ownerDocument&&yj(Y.ownerDocument.documentElement,Y)){if(ie!==null&&gx(Y)){var ve=ie.start,Te=ie.end;if(Te===void 0&&(Te=ve),"selectionStart"in Y)Y.selectionStart=ve,Y.selectionEnd=Math.min(Te,Y.value.length);else{var Pe=Y.ownerDocument||document,ge=Pe&&Pe.defaultView||window;if(ge.getSelection){var Se=ge.getSelection(),tt=Y.textContent.length,ft=Math.min(ie.start,tt),It=ie.end===void 0?ft:Math.min(ie.end,tt);!Se.extend&&ft>It&&(D=It,It=ft,ft=D);var ye=bj(Y,ft),fe=bj(Y,It);if(ye&&fe&&(Se.rangeCount!==1||Se.anchorNode!==ye.node||Se.anchorOffset!==ye.offset||Se.focusNode!==fe.node||Se.focusOffset!==fe.offset)){var je=Pe.createRange();je.setStart(ye.node,ye.offset),Se.removeAllRanges(),ft>It?(Se.addRange(je),Se.extend(fe.node,fe.offset)):(je.setEnd(fe.node,fe.offset),Se.addRange(je))}}}}for(Pe=[],Se=Y;Se=Se.parentNode;)Se.nodeType===1&&Pe.push({element:Se,left:Se.scrollLeft,top:Se.scrollTop});for(typeof Y.focus=="function"&&Y.focus(),Y=0;Y<Pe.length;Y++){var ze=Pe[Y];ze.element.scrollLeft=ze.left,ze.element.scrollTop=ze.top}}Bc=!!t0,n0=t0=null}finally{nn=w,ee.p=y,ne.T=d}}n.current=o,In=2}}function Ub(){if(In===2){In=0;var n=ho,o=xl,i=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||i){i=ne.T,ne.T=null;var d=ee.p;ee.p=2;var y=nn;nn|=4;try{xS(n,o.alternate,o)}finally{nn=y,ee.p=d,ne.T=i}}In=3}}function Hb(){if(In===4||In===3){In=0;var n=Tc;Tc=null,Me();var o=ho,i=xl,d=Io,y=MS,w=(d&335544064)===d?10262:10256;if((i.subtreeFlags&w)!==0||(i.flags&w)!==0?In=5:(In=0,xl=ho=null,FS(o,o.pendingLanes)),w=o.pendingLanes,w===0&&(mi=null),$r(d),i=i.stateNode,Nt&&typeof Nt.onCommitFiberRoot=="function")try{Nt.onCommitFiberRoot(Et,i,void 0,(i.current.flags&128)===128)}catch{}if(y!==null){i=ne.T,w=ee.p,ee.p=2,ne.T=null;try{for(var D=o.onRecoverableError,Y=0;Y<y.length;Y++){var ie=y[Y];D(ie.value,{componentStack:ie.stack})}}finally{ne.T=i,ee.p=w}}if(y=Ec,D=Rc,Rc=null,y!==null&&(Ec=null,D===null&&(D=[]),n!==null))for(ie=0;ie<y.length;ie++)i=(0,y[ie])(D),i!==void 0&&n.finished.finally(i);(Io&3)!==0&&Fm(),_o(o),w=o.pendingLanes,(d&261930)!==0&&(w&42)!==0?o===Bm?ld++:(ld=0,Bm=o):(ld=0,Bm=null),cd(0)}}function FS(n,o){(n.pooledCacheLanes&=o)===0&&(o=n.pooledCache,o!=null&&(n.pooledCache=null,Hu(o)))}function Fm(){return Tc!==null&&(Tc.skipTransition(),Tc=null),Vb(),Ub(),Hb(),Fb()}function Fb(){if(In!==5)return!1;var n=ho,o=_b;_b=0;var i=$r(Io),d=ne.T,y=ee.p;try{ee.p=32>i?32:i,ne.T=null,i=Lb,Lb=null;var w=ho,D=Io;if(In=0,xl=ho=null,Io=0,(nn&6)!==0)throw Error(a(331));var Y=nn;if(nn|=4,RS(w.current),kS(w,w.current,D,i),nn=Y,cd(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(Et,w)}catch{}return!0}finally{ee.p=y,ne.T=d,FS(n,o)}}function GS(n,o,i){o=Hr(i,o),o=ib(n.stateNode,o,2),n=oi(n,o,2),n!==null&&($s(n,2),_o(n))}function an(n,o,i){if(n.tag===3)GS(n,n,i);else for(;o!==null;){if(o.tag===3){GS(o,n,i);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(mi===null||!mi.has(d))){n=Hr(i,n),i=V2(2),d=oi(o,i,2),d!==null&&(U2(i,d,o,n),$s(d,2),_o(d));break}}o=o.return}}function Gb(n,o,i){var d=n.pingCache;if(d===null){d=n.pingCache=new PD;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)||(Pb=!0,y.add(i),n=HD.bind(null,n,o,i),o.then(n,n))}function HD(n,o,i){var d=n.pingCache;d!==null&&d.delete(o),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,wn===n&&(Xt&i)===i&&((Vn===4||Vn===3&&(Xt&62914560)===Xt&&300>nt()-_m)&&(nn&2)===0?Oc(n,0):Im|=i,kc===Xt&&(kc=0)),_o(n)}function qS(n,o){o===0&&(o=vs()),n=tl(n,o),n!==null&&($s(n,o),_o(n))}function FD(n){var o=n.memoizedState,i=0;o!==null&&(i=o.retryLane),qS(n,i)}function GD(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),qS(n,i)}function qD(n,o){return We(n,o)}var Dc=null,zc=null,qb=!1,Gm=!1,Yb=!1,pi=0;function _o(n){n!==zc&&n.next===null&&(zc===null?Dc=zc=n:zc=zc.next=n),Gm=!0,qb||(qb=!0,KD())}function cd(n,o){if(!Yb&&Gm){Yb=!0;do for(var i=!1,d=Dc;d!==null;){if(n!==0){var y=d.pendingLanes;if(y===0)var w=0;else{var D=d.suspendedLanes,Y=d.pingedLanes;w=(1<<31-Ct(42|n)+1)-1,w&=y&~(D&~Y),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(i=!0,WS(d,w))}else w=Xt,w=zt(d,d===wn?w:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(w&3)===0||_t(d,w)||(i=!0,WS(d,w));d=d.next}while(i);Yb=!1}}function YD(){YS()}function YS(){Gm=qb=!1;var n=0;pi!==0&&oz()&&(n=pi);for(var o=nt(),i=null,d=Dc;d!==null;){var y=d.next,w=KS(d,o);w===0?(d.next=null,i===null?Dc=y:i.next=y,y===null&&(zc=i)):(i=d,(n!==0||(w&3)!==0)&&(Gm=!0)),d=y}In!==0&&In!==5||cd(n),pi!==0&&(pi=0)}function KS(n,o){for(var i=n.suspendedLanes,d=n.pingedLanes,y=n.expirationTimes,w=n.pendingLanes&-62914561;0<w;){var D=31-Ct(w),Y=1<<D,ie=y[D];ie===-1?((Y&i)===0||(Y&d)!==0)&&(y[D]=io(Y,o)):ie<=o&&(n.expiredLanes|=Y),w&=~Y}if(o=wn,i=Xt,i=zt(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||_t(n,i)){if(o=i&-i,o===n.callbackPriority)return o;switch(d!==null&&me(d),$r(i)){case 2:case 8:i=ht;break;case 32:i=pe;break;case 268435456:i=Qe;break;default:i=pe}return d=XS.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 XS(n,o){if(In!==0&&In!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(Fm()&&n.callbackNode!==i)return null;var d=Xt;return d=zt(n,n===wn?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d===0?null:(zS(n,d,o),KS(n,nt()),n.callbackNode!=null&&n.callbackNode===i?XS.bind(null,n):null)}function WS(n,o){if(Fm())return null;zS(n,o,!0)}function KD(){iz(function(){(nn&6)!==0?We(qe,YD):YS()})}function Kb(){if(pi===0){var n=il;n===0&&(n=Xe,Xe<<=1,(Xe&261888)===0&&(Xe=256)),pi=n}return pi}function QS(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:js(n)}function XD(n,o,i,d,y){if(o==="submit"&&i&&i.stateNode===y){var w=QS((y[ws]||null).action),D=d.submitter;D&&(o=(o=D[ws]||null)?QS(o.formAction):D.getAttribute("formAction"),o!==null&&(w=o,D=null));var Y=new Gf("action","action",null,d,y);n.push({event:Y,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(pi!==0){var ie=new FormData(y,D);nb(i,{pending:!0,data:ie,method:y.method,action:w},null,ie)}}else typeof w=="function"&&(Y.preventDefault(),ie=new FormData(y,D),nb(i,{pending:!0,data:ie,method:y.method,action:w},w,ie))},currentTarget:y}]})}}for(var Xb=0;Xb<vx.length;Xb++){var Wb=vx[Xb],WD=Wb.toLowerCase(),QD=Wb[0].toUpperCase()+Wb.slice(1);co(WD,"on"+QD)}co(Sj,"onAnimationEnd"),co(Nj,"onAnimationIteration"),co(Cj,"onAnimationStart"),co("dblclick","onDoubleClick"),co("focusin","onFocus"),co("focusout","onBlur"),co(aD,"onTransitionRun"),co(iD,"onTransitionStart"),co(lD,"onTransitionCancel"),co(kj,"onTransitionEnd"),dn("onMouseEnter",["mouseout","mouseover"]),dn("onMouseLeave",["mouseout","mouseover"]),dn("onPointerEnter",["pointerout","pointerover"]),dn("onPointerLeave",["pointerout","pointerover"]),$t("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$t("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$t("onBeforeInput",["compositionend","keypress","textInput","paste"]),$t("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$t("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$t("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ud="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(" "),ZD=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ud));function ZS(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 D=d.length-1;0<=D;D--){var Y=d[D],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(Te){Kf(Te)}y.currentTarget=null,w=ie}else for(D=0;D<d.length;D++){if(Y=d[D],ie=Y.instance,ve=Y.currentTarget,Y=Y.listener,ie!==w&&y.isPropagationStopped())break e;w=Y,y.currentTarget=ve;try{w(y)}catch(Te){Kf(Te)}y.currentTarget=null,w=ie}}}}function Kt(n,o){var i=o[Eu];i===void 0&&(i=o[Eu]=new Set);var d=n+"__bubble";i.has(d)||(JS(o,n,2,!1),i.add(d))}function Qb(n,o,i){var d=0;o&&(d|=4),JS(i,n,d,o)}var qm="_reactListening"+Math.random().toString(36).slice(2);function Zb(n){if(!n[qm]){n[qm]=!0,Ot.forEach(function(i){i!=="selectionchange"&&(ZD.has(i)||Qb(i,!1,n),Qb(i,!0,n))});var o=n.nodeType===9?n:n.ownerDocument;o===null||o[qm]||(o[qm]=!0,Qb("selectionchange",!1,o))}}function JS(n,o,i,d){switch(UN(o)){case 2:var y=Fz;break;case 8:y=Gz;break;default:y=b0}i=y.bind(null,o,i,n),y=void 0,!Zi||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 Jb(n,o,i,d,y){var w=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var D=d.tag;if(D===3||D===4){var Y=d.stateNode.containerInfo;if(Y===y)break;if(D===4)for(D=d.return;D!==null;){var ie=D.tag;if((ie===3||ie===4)&&D.stateNode.containerInfo===y)return;D=D.return}for(;Y!==null;){if(D=lo(Y),D===null)return;if(ie=D.tag,ie===5||ie===6||ie===26||ie===27){d=w=D;continue e}Y=Y.parentNode}}d=d.return}Qi(function(){var ve=w,Te=Wi(i),Pe=[];e:{var ge=Tj.get(n);if(ge!==void 0){var Se=Gf,tt=n;switch(n){case"keypress":if(Hf(i)===0)break e;case"keydown":case"keyup":Se=I4;break;case"focusin":tt="focus",Se=ux;break;case"focusout":tt="blur",Se=ux;break;case"beforeblur":case"afterblur":Se=ux;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=nj;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=N4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=V4;break;case Sj:case Nj:case Cj:Se=T4;break;case kj:Se=H4;break;case"scroll":case"scrollend":Se=j4;break;case"wheel":Se=G4;break;case"copy":case"cut":case"paste":Se=R4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=rj;break;case"submit":Se=$4;break;case"toggle":case"beforetoggle":Se=Y4}var ft=(o&4)!==0,It=!ft&&(n==="scroll"||n==="scrollend"),ye=ft?ge!==null?ge+"Capture":null:ge;ft=[];for(var fe=ve,je;fe!==null;){var ze=fe;if(je=ze.stateNode,ze=ze.tag,ze!==5&&ze!==26&&ze!==27||je===null||ye===null||(ze=ra(fe,ye),ze!=null&&ft.push(dd(fe,ze,je))),It)break;fe=fe.return}0<ft.length&&(ge=new Se(ge,tt,null,i,Te),Pe.push({event:ge,listeners:ft}))}}if((o&7)===0){e:{if(Se=n==="mouseover"||n==="pointerover",ge=n==="mouseout"||n==="pointerout",Se&&i!==Xi&&(tt=i.relatedTarget||i.fromElement)&&(lo(tt)||tt[ur]))break e;(ge||Se)&&(tt=Te.window===Te?Te:(Se=Te.ownerDocument)?Se.defaultView||Se.parentWindow:window,ge?(Se=i.relatedTarget||i.toElement,ge=ve,Se=Se?lo(Se):null,Se!==null&&(It=c(Se),ft=Se.tag,Se!==It||ft!==5&&ft!==27&&ft!==6)&&(Se=null)):(ge=null,Se=ve),ge!==Se&&(ft=nj,ze="onMouseLeave",ye="onMouseEnter",fe="mouse",(n==="pointerout"||n==="pointerover")&&(ft=rj,ze="onPointerLeave",ye="onPointerEnter",fe="pointer"),It=ge==null?tt:ke(ge),je=Se==null?tt:ke(Se),tt=new ft(ze,fe+"leave",ge,i,Te),tt.target=It,tt.relatedTarget=je,ze=null,lo(Te)===ve&&(ft=new ft(ye,fe+"enter",Se,i,Te),ft.target=je,ft.relatedTarget=It,ze=ft),It=ze,ft=ge&&Se?M(ge,Se,JD):null,ge!==null&&eN(Pe,tt,ge,ft,!1),Se!==null&&It!==null&&eN(Pe,It,Se,ft,!0)))}e:{if(ge=ve?ke(ve):window,Se=ge.nodeName&&ge.nodeName.toLowerCase(),Se==="select"||Se==="input"&&ge.type==="file")var rt=fj;else if(uj(ge))if(mj)rt=sD;else{rt=tD;var Wt=eD}else Se=ge.nodeName,!Se||Se.toLowerCase()!=="input"||ge.type!=="checkbox"&&ge.type!=="radio"?ve&&Ki(ve.elementType)&&(rt=fj):rt=nD;if(rt&&(rt=rt(n,ve))){dj(Pe,rt,i,Te);break e}Wt&&Wt(n,ge,ve)}switch(Wt=ve?ke(ve):window,n){case"focusin":(uj(Wt)||Wt.contentEditable==="true")&&(lc=Wt,xx=ve,Bu=null);break;case"focusout":Bu=xx=lc=null;break;case"mousedown":bx=!0;break;case"contextmenu":case"mouseup":case"dragend":bx=!1,wj(Pe,i,Te);break;case"selectionchange":if(oD)break;case"keydown":case"keyup":wj(Pe,i,Te)}var xt;if(fx)e:{switch(n){case"compositionstart":var kt="onCompositionStart";break e;case"compositionend":kt="onCompositionEnd";break e;case"compositionupdate":kt="onCompositionUpdate";break e}kt=void 0}else ic?lj(n,i)&&(kt="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(kt="onCompositionStart");kt&&(oj&&i.locale!=="ko"&&(ic||kt!=="onCompositionStart"?kt==="onCompositionEnd"&&ic&&(xt=ej()):(Wa=Te,ix="value"in Wa?Wa.value:Wa.textContent,ic=!0)),Wt=Ym(ve,kt),0<Wt.length&&(kt=new sj(kt,n,null,i,Te),Pe.push({event:kt,listeners:Wt}),xt?kt.data=xt:(xt=cj(i),xt!==null&&(kt.data=xt)))),(xt=X4?W4(n,i):Q4(n,i))&&(kt=Ym(ve,"onBeforeInput"),0<kt.length&&(Wt=new sj("onBeforeInput","beforeinput",null,i,Te),Pe.push({event:Wt,listeners:kt}),Wt.data=xt)),XD(Pe,n,ve,i,Te)}ZS(Pe,o)})}function dd(n,o,i){return{instance:n,listener:o,currentTarget:i}}function Ym(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=ra(n,i),y!=null&&d.unshift(dd(n,y,w)),y=ra(n,o),y!=null&&d.push(dd(n,y,w))),n.tag===3)return d;n=n.return}return[]}function JD(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function eN(n,o,i,d,y){for(var w=o._reactName,D=[];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=ra(i,w),ve!=null&&D.unshift(dd(i,ve,ie))):y||(ve=ra(i,w),ve!=null&&D.push(dd(i,ve,ie)))),i=i.return}D.length!==0&&n.push({event:o,listeners:D})}var ez=/\r\n?/g,tz=/\u0000|\uFFFD/g;function tN(n){return(typeof n=="string"?n:""+n).replace(ez,`
|
|
50
|
-
`).replace(tz,"")}function nN(n,o){return o=tN(o),tN(n)===o}function ln(n,o,i,d,y,w){switch(i){case"children":if(typeof d=="string")o==="body"||o==="textarea"&&d===""||Bs(n,d);else if(typeof d=="number"||typeof d=="bigint")o!=="body"&&Bs(n,""+d);else return;break;case"className":dr(n,"class",d);break;case"tabIndex":dr(n,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":dr(n,i,d);break;case"style":mr(n,d,w);return;case"data":if(o!=="object"){dr(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=Vs);return;case"onScroll":d!=null&&Kt("scroll",n);return;case"onScrollEnd":d!=null&&Kt("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":Kt("beforetoggle",n),Kt("toggle",n),Pn(n,"popover",d);break;case"xlinkActuate":Xn(n,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Xn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Xn(n,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Xn(n,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Xn(n,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Xn(n,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Xn(n,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Xn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Xn(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=Ou.get(i)||i,Pn(n,i,d);else return}wt=!0}function e0(n,o,i,d,y,w){switch(i){case"style":mr(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")Bs(n,d);else if(typeof d=="number"||typeof d=="bigint")Bs(n,""+d);else return;break;case"onScroll":d!=null&&Kt("scroll",n);return;case"onScrollEnd":d!=null&&Kt("scrollend",n);return;case"onClick":d!=null&&(n.onclick=Vs);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}wt=!0,i in n?n[i]=d:d===!0?n.setAttribute(i,""):Pn(n,i,d)}return}wt=!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":Kt("error",n),Kt("load",n);var d=!1,y=!1,w;for(w in i)if(i.hasOwnProperty(w)){var D=i[w];if(D!=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,D,i,null)}}y&&ln(n,o,"srcSet",i.srcSet,i,null),d&&ln(n,o,"src",i.src,i,null);return;case"input":Kt("invalid",n);var Y=w=D=y=null,ie=null,ve=null;for(d in i)if(i.hasOwnProperty(d)){var Te=i[d];if(Te!=null)switch(d){case"name":y=Te;break;case"type":D=Te;break;case"checked":ie=Te;break;case"defaultChecked":ve=Te;break;case"value":w=Te;break;case"defaultValue":Y=Te;break;case"children":case"dangerouslySetInnerHTML":if(Te!=null)throw Error(a(137,o));break;default:ln(n,o,d,Te,i,null)}}Ka(n,w,Y,ie,ve,D,y,!1);return;case"select":Kt("invalid",n),d=D=w=null;for(y in i)if(i.hasOwnProperty(y)&&(Y=i[y],Y!=null))switch(y){case"value":w=Y;break;case"defaultValue":D=Y;break;case"multiple":d=Y;default:ln(n,o,y,Y,i,null)}o=w,i=D,n.multiple=!!d,o!=null?Xs(n,!!d,o,!1):i!=null&&Xs(n,!!d,i,!0);return;case"textarea":Kt("invalid",n),w=y=d=null;for(D in i)if(i.hasOwnProperty(D)&&(Y=i[D],Y!=null))switch(D){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,D,Y,i,null)}fr(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":Kt("beforetoggle",n),Kt("toggle",n),Kt("cancel",n),Kt("close",n);break;case"iframe":case"object":Kt("load",n);break;case"video":case"audio":for(d=0;d<ud.length;d++)Kt(ud[d],n);break;case"image":Kt("error",n),Kt("load",n);break;case"details":Kt("toggle",n);break;case"embed":case"source":case"link":Kt("error",n),Kt("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(Ki(o)){for(Te in i)i.hasOwnProperty(Te)&&(d=i[Te],d!==void 0&&e0(n,o,Te,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 nz={};function sz(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,D=null,Y=null,ie=null,ve=null,Te=null;for(Se in i){var Pe=i[Se];if(i.hasOwnProperty(Se)&&Pe!=null)switch(Se){case"checked":break;case"value":break;case"defaultValue":ie=Pe;default:d.hasOwnProperty(Se)||ln(n,o,Se,null,d,Pe)}}for(var ge in d){var Se=d[ge];if(Pe=i[ge],d.hasOwnProperty(ge)&&(Se!=null||Pe!=null))switch(ge){case"type":Se!==Pe&&(wt=!0),w=Se;break;case"name":Se!==Pe&&(wt=!0),y=Se;break;case"checked":Se!==Pe&&(wt=!0),ve=Se;break;case"defaultChecked":Se!==Pe&&(wt=!0),Te=Se;break;case"value":Se!==Pe&&(wt=!0),D=Se;break;case"defaultValue":Se!==Pe&&(wt=!0),Y=Se;break;case"children":case"dangerouslySetInnerHTML":if(Se!=null)throw Error(a(137,o));break;default:Se!==Pe&&ln(n,o,ge,Se,d,Pe)}}Ms(n,D,Y,ie,ve,Te,w,y);return;case"select":Se=D=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&&(wt=!0),ge=w;break;case"defaultValue":w!==ie&&(wt=!0),Y=w;break;case"multiple":w!==ie&&(wt=!0),D=w;default:w!==ie&&ln(n,o,y,w,d,ie)}o=Y,i=D,d=Se,ge!=null?Xs(n,!!i,ge,!1):!!d!=!!i&&(o!=null?Xs(n,!!i,o,!0):Xs(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(D in d)if(y=d[D],w=i[D],d.hasOwnProperty(D)&&(y!=null||w!=null))switch(D){case"value":y!==w&&(wt=!0),ge=y;break;case"defaultValue":y!==w&&(wt=!0),Se=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==w&&ln(n,o,D,y,d,w)}ac(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&&(wt=!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(Ki(o)){for(var It in i)ge=i[It],i.hasOwnProperty(It)&&ge!==void 0&&!d.hasOwnProperty(It)&&e0(n,o,It,void 0,d,ge);for(Te in d)ge=d[Te],Se=i[Te],!d.hasOwnProperty(Te)||ge===Se||ge===void 0&&Se===void 0||e0(n,o,Te,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(Pe in d)ge=d[Pe],Se=i[Pe],!d.hasOwnProperty(Pe)||ge===Se||ge==null&&Se==null||ln(n,o,Pe,ge,d,Se)}function sN(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function rz(){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,D=y.initiatorType,Y=y.duration;if(w&&Y&&sN(D)){for(D=0,Y=y.responseEnd,d+=1;d<i.length;d++){var ie=i[d],ve=ie.startTime;if(ve>Y)break;var Te=ie.transferSize,Pe=ie.initiatorType;Te&&sN(Pe)&&(ie=ie.responseEnd,D+=Te*(ie<Y?1:(Y-ve)/(ie-ve)))}if(--d,o+=8*(w+D)/(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 t0=null,n0=null;function fd(n){return n.nodeType===9?n:n.ownerDocument}function rN(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 oN(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 aN(n,o,i,d){return i=fd(i).createElement(n),i[zn]=d,i[ws]=o,Es(i,n,o),Ve(i),i}function s0(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 r0=null;function oz(){var n=window.event;return n&&n.type==="popstate"?n===r0?!1:(r0=n,!0):(r0=null,!1)}var o0=typeof setTimeout=="function"?setTimeout:void 0,az=typeof clearTimeout=="function"?clearTimeout:void 0,iN=typeof Promise=="function"?Promise:void 0,lN=typeof requestAnimationFrame=="function"?requestAnimationFrame:o0,iz=typeof queueMicrotask=="function"?queueMicrotask:typeof iN<"u"?function(n){return iN.resolve(null).then(n).catch(lz)}:o0;function lz(n){setTimeout(function(){throw n})}function gi(n){return n==="head"}function cN(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),Vc(o);return}d--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")d++;else if(i==="html")m0(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,m0(i);for(var w=i.firstChild;w;){var D=w.nextSibling,Y=w.nodeName;w[qi]||Y==="SCRIPT"||Y==="STYLE"||Y==="LINK"&&w.rel.toLowerCase()==="stylesheet"||i.removeChild(w),w=D}}else i==="body"&&m0(n.ownerDocument.body);i=y}while(i);Vc(o)}function uN(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 dN(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 fN(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 cz(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 a0(n){var o=n.getBoundingClientRect(),i=getComputedStyle(n);return cz(o,i,n)}function uz(n){return n.documentElement.clientHeight}function dz(n){this.addEventListener("load",n),this.addEventListener("error",n)}function fz(n,o,i,d,y,w,D,Y,ie){var ve=o.nodeType===9?o:o.ownerDocument;try{var Te=ve.startViewTransition({update:function(){var ge=ve.defaultView,Se=ge.navigation&&ge.navigation.transition,tt=ve.fonts.status;d();var ft=[];if(tt==="loaded"&&(uz(ve),ve.fonts.status==="loading"&&ft.push(ve.fonts.ready)),tt=ft.length,n!==null)for(var It=n.suspenseyImages,ye=0,fe=0;fe<It.length;fe++){var je=It[fe];if(!je.complete){var ze=je.getBoundingClientRect();if(0<ze.bottom&&0<ze.right&&ze.top<ge.innerHeight&&ze.left<ge.innerWidth){if(ye+=DN(je),ye>Wm){ft.length=tt;break}je=new Promise(dz.bind(je)),ft.push(je)}}}if(0<ft.length)return ge=Promise.race([Promise.all(ft),new Promise(function(rt){return setTimeout(rt,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=Te;var Pe=[];return Te.ready.then(function(){for(var ge=ve.documentElement.getAnimations({subtree:!0}),Se=0;Se<ge.length;Se++){var tt=ge[Se],ft=tt.effect,It=ft.pseudoElement;if(It!=null&&It.startsWith("::view-transition")){Pe.push(tt),tt=ft.getKeyframes();for(var ye=It=void 0,fe=!0,je=0;je<tt.length;je++){var ze=tt[je],rt=ze.width;if(It===void 0)It=rt;else if(It!==rt){fe=!1;break}if(rt=ze.height,ye===void 0)ye=rt;else if(ye!==rt){fe=!1;break}delete ze.width,delete ze.height,ze.transform==="none"&&delete ze.transform}fe&&It!==void 0&&ye!==void 0&&(ft.setKeyframes(tt),fe=getComputedStyle(ft.target,ft.pseudoElement),fe.width!==It||fe.height!==ye)&&(fe=tt[0],fe.width=It,fe.height=ye,fe=tt[tt.length-1],fe.width=It,fe.height=ye,ft.setKeyframes(tt))}}D()},function(ge){ve.__reactViewTransition===Te&&(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(),D()}}),Te.finished.finally(function(){for(var ge=0;ge<Pe.length;ge++)Pe[ge].cancel();ve.__reactViewTransition===Te&&(ve.__reactViewTransition=null),Y()}),Te}catch{return d(),y(),D(),null}}function bl(n,o){this._scope=document.documentElement,this._selector="::view-transition-"+n+"("+o+")"}bl.prototype.animate=function(n,o){return o=typeof o=="number"?{duration:o}:E({},o),o.pseudoElement=this._selector,this._scope.animate(n,o)},bl.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},bl.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function mN(n){return{name:n,group:new bl("group",n),imagePair:new bl("image-pair",n),old:new bl("old",n),new:new bl("new",n)}}function wr(n){this._fragmentFiber=n,this._observers=this._eventListeners=null}wr.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(pN(w,n,o,i)===-1){var D=this,Y=o;i!=null&&typeof i!="boolean"&&i.once===!0&&(Y=function(ie){D.removeEventListener(n,o,i),typeof o=="function"?o.call(this,ie):o.handleEvent(ie)}),d!==null&&(y=D.removeEventListener.bind(D,n,o,i),d.addEventListener("abort",y,{once:!0}),y=d.removeEventListener.bind(d,"abort",y)),d=Pc(i),w.push({type:n,listener:o,optionsOrUseCapture:i,attachedListener:Y,cleanup:y}),p(this._fragmentFiber.child,!1,mz,n,Y,d)}this._eventListeners=w}};function mz(n,o,i,d){return N(n).addEventListener(o,i,d),!1}wr.prototype.removeEventListener=function(n,o,i){var d=this._eventListeners;if(d!==null&&(o=pN(d,n,o,i),o!==-1)){var y=d[o];i=y.attachedListener;var w=y.cleanup;y=Pc(y.optionsOrUseCapture),p(this._fragmentFiber.child,!1,hz,n,i,y),d.splice(o,1),w!==null&&w()}};function hz(n,o,i,d){return N(n).removeEventListener(o,i,d),!1}function Pc(n){return n!=null&&typeof n!="boolean"&&(n.once===!0||n.signal instanceof AbortSignal)?{capture:n.capture,passive:n.passive}:n}function hN(n){return n==null?"c=0":typeof n=="boolean"?"c="+(n?"1":"0"):"c="+(n.capture?"1":"0")}function pN(n,o,i,d){if(n.length===0)return-1;d=hN(d);for(var y=0;y<n.length;y++){var w=n[y];if(w.type===o&&w.listener===i&&hN(w.optionsOrUseCapture)===d)return y}return-1}wr.prototype.dispatchEvent=function(n){var o=x(this._fragmentFiber);if(o===null)return!0;o=N(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,Pc(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,Pc(w.optionsOrUseCapture));return o.removeChild(d),n}return o.dispatchEvent(n)},wr.prototype.focus=function(n){p(this._fragmentFiber.child,!0,gN,n,void 0,void 0)};function gN(n,o){return n.tag===6?!1:(n=N(n),kz(n,o))}wr.prototype.focusLast=function(n){var o=[];p(this._fragmentFiber.child,!0,i0,o,void 0,void 0);for(var i=o.length-1;0<=i&&!gN(o[i],n);i--);};function i0(n,o){return o.push(n),!1}wr.prototype.blur=function(){var n=x(this._fragmentFiber);n!==null&&(n=N(n),n=fd(n).activeElement,n!==null&&p(this._fragmentFiber.child,!1,pz,n,void 0,void 0))};function pz(n,o){return n.tag===6?!1:(n=N(n),n===o||n.contains(o)?(o.blur(),!0):!1)}wr.prototype.observeUsing=function(n){this._observers===null&&(this._observers=new Set),this._observers.add(n),p(this._fragmentFiber.child,!1,gz,n,void 0,void 0)};function gz(n,o){return n.tag===6||(n=N(n),o.observe(n)),!1}wr.prototype.unobserveUsing=function(n){var o=this._observers;if(o!==null&&o.has(n)){o.delete(n),p(this._fragmentFiber.child,!1,xz,n,void 0,void 0);for(var i=o=0;i<po.length;i++){var d=po[i];d.fragmentInstance===this&&d.observer===n?n.unobserve(d.instance):po[o++]=d}po.length=o}};function xz(n,o){return n.tag===6||(n=N(n),o.unobserve(n)),!1}var po=[],l0=!1;function bz(n,o,i){po.push({fragmentInstance:n,observer:o,instance:i}),l0||(l0=!0,Tz(function(){l0=!1;var d=po;po=[];for(var y=0;y<d.length;y++){var w=d[y];w.observer.unobserve(w.instance)}}))}wr.prototype.getClientRects=function(){var n=[];return p(this._fragmentFiber.child,!1,yz,n,void 0,void 0),n};function yz(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=N(n),o.push.apply(o,n.getClientRects());return!1}wr.prototype.getRootNode=function(n){var o=x(this._fragmentFiber);return o===null?this:N(o).getRootNode(n)},wr.prototype.compareDocumentPosition=function(n){var o=x(this._fragmentFiber);if(o===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var i=[];p(this._fragmentFiber.child,!1,i0,i,void 0,void 0);var d=N(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=N(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=N(i[0]),y=N(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 D=o.compareDocumentPosition(n),Y=y.compareDocumentPosition(n),ie=D&Node.DOCUMENT_POSITION_CONTAINED_BY||Y&Node.DOCUMENT_POSITION_CONTAINED_BY;return Y=d&&w&&D&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:D,o&Node.DOCUMENT_POSITION_DISCONNECTED||o&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||vz(o,this._fragmentFiber,i[0],i[i.length-1],n)?o:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function vz(n,o,i,d,y){var w=lo(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=x(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,R),o===null?o=!1:(p(o,!0,k,w,i),w=C,C=null,o=w!==null)),o):n&Node.DOCUMENT_POSITION_FOLLOWING?((o=!!w)&&!(o=w===d)&&(o=M(d,w,R),o===null?o=!1:(p(o,!0,A,w,d),w=C,T=C=null,o=w!==null)),o):!1}function xN(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)}wr.prototype.scrollIntoView=function(n){if(typeof n=="object")throw Error(a(566));var o=[];p(this._fragmentFiber.child,!1,i0,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]||x(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){n=N(d),xN(n,i);return}if(d=N(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=N(y),xN(y,i)):N(y).scrollIntoView(n),d+=i?-1:1}};function wz(n,o){return n=N(n),bN(n,o),!1}function bN(n,o){n.reactFragments==null&&(n.reactFragments=new Set),n.reactFragments.add(o)}function yN(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,Pc(y.optionsOrUseCapture))}n.nodeType!==3&&(i=o._observers,i!==null&&i.forEach(function(w){for(var D=0,Y=0;Y<po.length;Y++){var ie=po[Y];(ie.fragmentInstance!==o||ie.observer!==w||ie.instance!==n)&&(po[D++]=ie)}po.length=D,w.observe(n)}),bN(n,o))}function jz(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,Pc(y.optionsOrUseCapture))}n.nodeType!==3&&(i=o._observers,i!==null&&i.forEach(function(w){typeof w.rootMargin=="string"?bz(o,w,n):w.unobserve(n)}),n.reactFragments!=null&&n.reactFragments.delete(o))}function c0(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":c0(i),nc(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function Sz(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[qi])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=Kr(n.nextSibling),n===null)break}return null}function Nz(n,o,i){if(o==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Kr(n.nextSibling),n===null))return null;return n}function vN(n,o){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=Kr(n.nextSibling),n===null))return null;return n}function u0(n){return n.data==="$?"||n.data==="$~"}function d0(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Cz(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 Kr(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 f0=null;function wN(n){n=n.nextSibling;for(var o=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(o===0)return Kr(n.nextSibling);o--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||o++}n=n.nextSibling}return null}function jN(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 kz(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 Tz(n){lN(function(){lN(function(o){return n(o)})})}function SN(n,o,i){switch(o=fd(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 NN(n,o,i){for(var d in i){var y=i[d];i.hasOwnProperty(d)&&y!=null&&ln(n,o,d,null,nz,y)}i.dangerouslySetInnerHTML!=null&&(n.textContent=""),n.onclick===Vs&&(n.onclick=null),nc(n)}function m0(n){for(var o=n.attributes;o.length;)n.removeAttributeNode(o[0]);nc(n)}var Xr=new Map,CN=new Set;function md(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 ga=ee.d;ee.d={f:Ez,r:Rz,D:Az,C:Oz,L:Mz,m:Dz,X:Pz,S:zz,M:Iz};function Ez(){var n=ga.f(),o=Vm();return n||o}function Rz(n){var o=Yi(n);o!==null&&o.tag===5&&o.type==="form"?T2(o):ga.r(n)}var Ic=typeof document>"u"?null:document;function kN(n,o,i){var d=Ic;if(d&&typeof o=="string"&&o){var y=kn(o);y='link[rel="'+n+'"][href="'+y+'"]',typeof i=="string"&&(y+='[crossorigin="'+i+'"]'),CN.has(y)||(CN.add(y),n={rel:n,crossOrigin:i,href:o},d.querySelector(y)===null&&(o=d.createElement("link"),Es(o,"link",n),Ve(o),d.head.appendChild(o)))}}function Az(n){ga.D(n),kN("dns-prefetch",n,null)}function Oz(n,o){ga.C(n,o),kN("preconnect",n,o)}function Mz(n,o,i){ga.L(n,o,i);var d=Ic;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=_c(n);break;case"script":w=Lc(n)}if(!(Xr.has(w)||(n=E({rel:"preload",href:o==="image"&&i&&i.imageSrcSet?void 0:n,as:o},i),Xr.set(w,n),d.querySelector(y)!==null||o==="style"&&d.querySelector(hd(w))||o==="script"&&d.querySelector(pd(w))))){var D=d.createElement("link");Es(D,"link",n),o==="style"&&(D[tc]=!0,D.onload=D.onerror=function(){gt(D)}),Ve(D),d.head.appendChild(D)}}}function Dz(n,o){ga.m(n,o);var i=Ic;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=Lc(n)}if(!Xr.has(w)&&(n=E({rel:"modulepreload",href:n},o),Xr.set(w,n),i.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(pd(w)))return}d=i.createElement("link"),Es(d,"link",n),Ve(d),i.head.appendChild(d)}}}function zz(n,o,i){ga.S(n,o,i);var d=Ic;if(d&&n){var y=$e(d).hoistableStyles,w=_c(n);o=o||"default";var D=y.get(w);if(!D){var Y={loading:0,preload:null};if(D=d.querySelector(hd(w)))Y.loading=5;else{n=E({rel:"stylesheet",href:n,"data-precedence":o},i),(i=Xr.get(w))&&h0(n,i);var ie=D=d.createElement("link");Ve(ie),Es(ie,"link",n),ie._p=new Promise(function(ve,Te){ie.onload=ve,ie.onerror=Te}),ie.addEventListener("load",function(){Y.loading|=1}),ie.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,Km(D,o,d)}D={type:"stylesheet",instance:D,count:1,state:Y},y.set(w,D)}}}function Pz(n,o){ga.X(n,o);var i=Ic;if(i&&n){var d=$e(i).hoistableScripts,y=Lc(n),w=d.get(y);w||(w=i.querySelector(pd(y)),w||(n=E({src:n,async:!0},o),(o=Xr.get(y))&&p0(n,o),w=i.createElement("script"),Ve(w),Es(w,"link",n),i.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},d.set(y,w))}}function Iz(n,o){ga.M(n,o);var i=Ic;if(i&&n){var d=$e(i).hoistableScripts,y=Lc(n),w=d.get(y);w||(w=i.querySelector(pd(y)),w||(n=E({src:n,async:!0,type:"module"},o),(o=Xr.get(y))&&p0(n,o),w=i.createElement("script"),Ve(w),Es(w,"link",n),i.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},d.set(y,w))}}function TN(n,o,i,d){var y=(y=xe.current)?md(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=_c(i.href),o=$e(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=_c(i.href);var w=$e(y).hoistableStyles,D=w.get(n);if(D||(y=y.ownerDocument||y,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(n,D),(w=y.querySelector(hd(n)))?w._p||(D.instance=w,D.state.loading=5):(w=Xr.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},Xr.set(n,w)),_z(y,n,w,D.state))),o&&d===null)throw Error(a(528,""));return D}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=Lc(i),o=$e(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 _c(n){return'href="'+kn(n)+'"'}function hd(n){return'link[rel="stylesheet"]['+n+"]"}function EN(n){return E({},n,{"data-precedence":n.precedence,precedence:null})}function _z(n,o,i,d){if(o=n.querySelector('link[rel="preload"][as="style"]['+o+"]")){if(o[tc]!==!0){d.loading=1;return}}else o=n.createElement("link"),o[tc]=!0,o.onload=o.onerror=gt.bind(null,o),Es(o,"link",i),Ve(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 Lc(n){return'[src="'+kn(n)+'"]'}function pd(n){return"script[async]"+n}function RN(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,Ve(d),d;var y=E({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return d=(n.ownerDocument||n).createElement("style"),Ve(d),Es(d,"style",y),Km(d,i.precedence,n),o.instance=d;case"stylesheet":y=_c(i.href);var w=n.querySelector(hd(y));if(w)return o.state.loading|=4,o.instance=w,Ve(w),w;d=EN(i),(y=Xr.get(y))&&h0(d,y),w=(n.ownerDocument||n).createElement("link"),Ve(w);var D=w;return D._p=new Promise(function(Y,ie){D.onload=Y,D.onerror=ie}),Es(w,"link",d),o.state.loading|=4,Km(w,i.precedence,n),o.instance=w;case"script":return w=Lc(i.src),(y=n.querySelector(pd(w)))?(o.instance=y,Ve(y),y):(d=i,(y=Xr.get(w))&&(d=E({},i),p0(d,y)),n=n.ownerDocument||n,y=n.createElement("script"),Ve(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,Km(d,i.precedence,n));return o.instance}function Km(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,D=0;D<d.length;D++){var Y=d[D];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 h0(n,o){n.crossOrigin==null&&(n.crossOrigin=o.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=o.referrerPolicy),n.title==null&&(n.title=o.title)}function p0(n,o){n.crossOrigin==null&&(n.crossOrigin=o.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=o.referrerPolicy),n.integrity==null&&(n.integrity=o.integrity)}var Xm=null;function AN(n,o,i){if(Xm===null){var d=new Map,y=Xm=new Map;y.set(i,d)}else y=Xm,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[qi]||w[zn]||n==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var D=w.getAttribute(o)||"";D=n+D;var Y=d.get(D);Y?Y.push(w):d.set(D,[w])}}return d}function g0(n,o,i){n=n.ownerDocument||n,n.head.insertBefore(i,o==="title"?n.querySelector("head > title"):null)}function Lz(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 ON(n,o){return n==="img"&&o.src!=null&&o.src!==""&&o.onLoad==null&&o.loading!=="lazy"}function MN(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function DN(n){return(n.width||100)*(n.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function zN(n,o){typeof o.decode=="function"&&(n.imgCount++,o.complete||(n.imgBytes+=DN(o),n.suspenseyImages.push(o)),n=Vz.bind(n),o.decode().then(n,n))}function $z(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=_c(d.href),w=o.querySelector(hd(y));if(w){o=w._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(n.count++,n=gd.bind(n),o.then(n,n)),i.state.loading|=4,i.instance=w,Ve(w);return}w=o.ownerDocument||o,d=EN(d),(y=Xr.get(y))&&h0(d,y),w=w.createElement("link"),Ve(w);var D=w;D._p=new Promise(function(Y,ie){D.onload=Y,D.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=gd.bind(n),o.addEventListener("load",i),o.addEventListener("error",i))}}var Wm=0;function Bz(n,o){return n.stylesheets&&n.count===0&&Zm(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var d=setTimeout(function(){if(n.stylesheets&&Zm(n,n.stylesheets),n.unsuspend){var w=n.unsuspend;n.unsuspend=null,w()}},6e4+o);0<n.imgBytes&&Wm===0&&(Wm=62500*rz());var y=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Zm(n,n.stylesheets),n.unsuspend)){var w=n.unsuspend;n.unsuspend=null,w()}},(n.imgBytes>Wm?50:800)+o);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function PN(n){if(n.count===0&&(n.imgCount===0||!n.waitingForImages)){if(n.stylesheets)Zm(n,n.stylesheets);else if(n.unsuspend){var o=n.unsuspend;n.unsuspend=null,o()}}}function gd(){this.count--,PN(this)}function Vz(){this.imgCount--,PN(this)}var Qm=null;function Zm(n,o){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Qm=new Map,o.forEach(Uz,n),Qm=null,gd.call(n))}function Uz(n,o){if(!(o.state.loading&4)){var i=Qm.get(n);if(i)var d=i.get(null);else{i=new Map,Qm.set(n,i);for(var y=n.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<y.length;w++){var D=y[w];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(i.set(D.dataset.precedence,D),d=D)}d&&i.set(null,d)}y=o.instance,D=y.getAttribute("data-precedence"),w=i.get(D)||d,w===d&&i.set(null,y),i.set(D,y),this.count++,d=gd.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 Hz(n,o,i,d,y,w,D,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=Lr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lr(0),this.hiddenUpdates=Lr(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=w,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ie,this.transitionTypes=null,this.incompleteTransitions=new Map}function IN(n,o,i,d,y,w,D,Y,ie,ve,Te,Pe){return n=new Hz(n,o,i,D,ie,ve,Te,Pe,Y),o=1,w===!0&&(o|=24),w=Ws(3,null,null,o),n.current=w,w.stateNode=n,o=Ox(),o.refCount++,n.pooledCache=o,o.refCount++,w.memoizedState={element:d,isDehydrated:i,cache:o},Px(w),n}function _N(n){return n?(n=dc,n):dc}function LN(n,o,i,d,y,w){y=_N(y),d.context===null?d.context=y:d.pendingContext=y,d=ri(o),d.payload={element:i},w=w===void 0?null:w,w!==null&&(d.callback=w),i=oi(n,d,o),i!==null&&(er(i,n,o),Yu(i,n,o))}function $N(n,o){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<o?i:o}}function x0(n,o){$N(n,o),(n=n.alternate)&&$N(n,o)}function BN(n){if(n.tag===13||n.tag===31){var o=tl(n,67108864);o!==null&&er(o,n,67108864),x0(n,67108864)}}function VN(n){if(n.tag===13||n.tag===31){var o=vr();o=qa(o);var i=tl(n,o);i!==null&&er(i,n,o),x0(n,o)}}var Bc=!0;function Fz(n,o,i,d){var y=ne.T;ne.T=null;var w=ee.p;try{ee.p=2,b0(n,o,i,d)}finally{ee.p=w,ne.T=y}}function Gz(n,o,i,d){var y=ne.T;ne.T=null;var w=ee.p;try{ee.p=8,b0(n,o,i,d)}finally{ee.p=w,ne.T=y}}function b0(n,o,i,d){if(Bc){var y=y0(d);if(y===null)Jb(n,o,d,Jm,i),HN(n,d);else if(Yz(y,n,o,i,d))d.stopPropagation();else if(HN(n,d),o&4&&-1<qz.indexOf(n)){for(;y!==null;){var w=Yi(y);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var D=An(w.pendingLanes);if(D!==0){var Y=w;for(Y.pendingLanes|=2,Y.entangledLanes|=2;D;){var ie=1<<31-Ct(D);Y.entanglements[1]|=ie,D&=~ie}_o(w),(nn&6)===0&&(Lm=nt()+500,cd(0))}}break;case 31:case 13:Y=tl(w,2),Y!==null&&er(Y,w,2),Vm(),x0(w,2)}if(w=y0(d),w===null&&Jb(n,o,d,Jm,i),w===y)break;y=w}y!==null&&d.stopPropagation()}else Jb(n,o,d,null,i)}}function y0(n){return n=Wi(n),v0(n)}var Jm=null;function v0(n){if(Jm=null,n=lo(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 Jm=n,null}function UN(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 qe:return 2;case ht:return 8;case pe:case De:return 32;case Qe:return 268435456;default:return 32}default:return 32}}var w0=!1,xi=null,bi=null,yi=null,xd=new Map,bd=new Map,vi=[],qz="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 HN(n,o){switch(n){case"focusin":case"focusout":xi=null;break;case"dragenter":case"dragleave":bi=null;break;case"mouseover":case"mouseout":yi=null;break;case"pointerover":case"pointerout":xd.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":bd.delete(o.pointerId)}}function yd(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=Yi(o),o!==null&&BN(o)),n):(n.eventSystemFlags|=d,o=n.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),n)}function Yz(n,o,i,d,y){switch(o){case"focusin":return xi=yd(xi,n,o,i,d,y),!0;case"dragenter":return bi=yd(bi,n,o,i,d,y),!0;case"mouseover":return yi=yd(yi,n,o,i,d,y),!0;case"pointerover":var w=y.pointerId;return xd.set(w,yd(xd.get(w)||null,n,o,i,d,y)),!0;case"gotpointercapture":return w=y.pointerId,bd.set(w,yd(bd.get(w)||null,n,o,i,d,y)),!0}return!1}function FN(n){var o=lo(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,Gi(n.priority,function(){VN(i)});return}}else if(o===31){if(o=f(i),o!==null){n.blockedOn=o,Gi(n.priority,function(){VN(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 eh(n){if(n.blockedOn!==null)return!1;for(var o=n.targetContainers;0<o.length;){var i=y0(n.nativeEvent);if(i===null){i=n.nativeEvent;var d=new i.constructor(i.type,i);Xi=d,i.target.dispatchEvent(d),Xi=null}else return o=Yi(i),o!==null&&BN(o),n.blockedOn=i,!1;o.shift()}return!0}function GN(n,o,i){eh(n)&&i.delete(o)}function Kz(){w0=!1,xi!==null&&eh(xi)&&(xi=null),bi!==null&&eh(bi)&&(bi=null),yi!==null&&eh(yi)&&(yi=null),xd.forEach(GN),bd.forEach(GN)}function th(n,o){n.blockedOn===o&&(n.blockedOn=null,w0||(w0=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Kz)))}var nh=null;function qN(n){nh!==n&&(nh=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){nh===n&&(nh=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(v0(d||i)===null)continue;break}var w=Yi(i);w!==null&&(n.splice(o,3),o-=3,nb(w,{pending:!0,data:y,method:i.method,action:d},d,y))}}))}function Vc(n){function o(ie){return th(ie,n)}xi!==null&&th(xi,n),bi!==null&&th(bi,n),yi!==null&&th(yi,n),xd.forEach(o),bd.forEach(o);for(var i=0;i<vi.length;i++){var d=vi[i];d.blockedOn===n&&(d.blockedOn=null)}for(;0<vi.length&&(i=vi[0],i.blockedOn===null);)FN(i),i.blockedOn===null&&vi.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],D=y[ws]||null;if(typeof w=="function")D||qN(i);else if(D){var Y=null;if(w&&w.hasAttribute("formAction")){if(y=w,D=w[ws]||null)Y=D.formAction;else if(v0(y)!==null)continue}else Y=D.action;typeof Y=="function"?i[d+1]=Y:(i.splice(d,3),d-=3),qN(i)}}}function YN(){function n(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(D){return y=D})},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 j0(n){this._internalRoot=n}sh.prototype.render=j0.prototype.render=function(n){var o=this._internalRoot;if(o===null)throw Error(a(409));var i=o.current,d=vr();LN(i,d,n,o,null,null)},sh.prototype.unmount=j0.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var o=n.containerInfo;LN(n.current,2,null,n,null,null),Vm(),o[ur]=null}};function sh(n){this._internalRoot=n}sh.prototype.unstable_scheduleHydration=function(n){if(n){var o=Br();n={blockedOn:null,target:n,priority:o};for(var i=0;i<vi.length&&o!==0&&o<vi[i].priority;i++);vi.splice(i,0,n),i===0&&FN(n)}};var KN=t.version;if(KN!=="19.3.0")throw Error(a(527,KN,"19.3.0"));ee.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 Xz={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:ne,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rh.isDisabled&&rh.supportsFiber)try{Et=rh.inject(Xz),Nt=rh}catch{}}return wd.createRoot=function(n,o){if(!l(n))throw Error(a(299));var i=!1,d="",y=_2,w=L2,D=$2;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&&(D=o.onRecoverableError)),o=IN(n,1,!1,null,null,i,d,null,y,w,D,YN),n[ur]=o.current,Zb(n),new j0(o)},wd.hydrateRoot=function(n,o,i){if(!l(n))throw Error(a(299));var d=!1,y="",w=_2,D=L2,Y=$2,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&&(D=i.onCaughtError),i.onRecoverableError!==void 0&&(Y=i.onRecoverableError),i.formState!==void 0&&(ie=i.formState)),o=IN(n,1,!0,o,i??null,d,y,ie,w,D,Y,YN),o.context=_N(null),i=o.current,d=vr(),d=qa(d),y=ri(d),y.callback=null,oi(i,y,d),i=d,o.current.lanes=i,$s(o,i),_o(o),n[ur]=o.current,Zb(n),new sh(o)},wd.version="19.3.0",wd}var oC;function xP(){if(oC)return k0.exports;oC=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=gP(),k0.exports}var bP=xP();const yP="modulepreload",vP=function(e){return"/"+e},aC={},wP=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=vP(h),h in aC)return;aC[h]=!0;const g=h.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const x=document.createElement("link");if(x.rel=g?"stylesheet":yP,g||(x.as="script"),x.crossOrigin="",x.href=h,m&&x.setAttribute("nonce",m),document.head.appendChild(x),g)return new Promise((v,j)=>{x.addEventListener("load",v),x.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)})},RR="openrod.compute-target";function jP(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(RR))==="cloud"?"cloud":"local"}catch{return"local"}}function SP(e,t){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");return`${e==="cloud"?"/api/remote/os":"/api/os"}${t}`}let AR="local";const OR=()=>AR;function MR(e){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");AR=e}function NP(e,t){const r=t??null;return{uid:r,revision:e.revision+(e.uid&&e.uid!==r?1:0)}}let DR=null;const Dy=()=>DR;function iC(e){DR=typeof e=="string"&&/^[a-f0-9]{16}$/.test(e)?e:null}const ki="CONSOLE_TOKEN_REQUIRED";function Cr(e,t,r=null,a=Dy()){const l=()=>e??OR(),c=a;let u,f;const m=v=>SP(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===ki?window.dispatchEvent(new Event(ki)):(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 x(v,{method:j="GET",body:S,signal:N,scoped:C=!0,raw:T=!1}={}){const k=h(N);k==null||k.throwIfAborted();const A=C?await p():null;k==null||k.throwIfAborted();const R=await fetch(m(v),{method:j,signal:k,headers:{...l()==="cloud"&&c?{"x-openrod-local-owner":c}:{},...A?{"x-openshell-context":A}:{},...A&&r?{"x-openshell-location":"1"}:{},...j==="GET"?{}:{"content-type":T?"application/octet-stream":"application/json","x-openshell-console":"1"}},body:S===void 0?void 0:T?S:JSON.stringify(S)}),M=await R.json().catch(()=>({}));if(k==null||k.throwIfAborted(),M.code===ki?window.dispatchEvent(new Event(ki)):(R.status===401||M.code==="CLOUD_OWNER_CHANGED")&&window.dispatchEvent(new Event("openrod-session-expired")),!R.ok)throw Object.assign(new Error(M.error??`Request failed (${R.status})`),{code:M.code,sandboxes:M.sandboxes,fix:M.fix});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=>Cr(e,t,v,c),inventory:v=>x("/inventory",{signal:v,scoped:!1}),context:g,contextKey:p,connections:v=>x("/connections",{signal:v,scoped:!1}),connectionJob:(v,j)=>x(`/connections/jobs/${encodeURIComponent(v)}`,{signal:j,scoped:!1}),connect:v=>x("/connections/connect",{method:"POST",body:v}),installConnectionDocker:v=>x(`/connections/jobs/${encodeURIComponent(v)}/docker`,{method:"POST",body:{approve:!0}}),installConnectionRuntime:v=>x(`/connections/jobs/${encodeURIComponent(v)}/install`,{method:"POST",body:{method:"download"}}),uploadConnectionPackage:(v,j)=>x(`/connections/jobs/${encodeURIComponent(v)}/package`,{method:"POST",body:j,raw:!0}),scanSshHost:v=>x("/connections/hosts/scan",{method:"POST",body:v}),addSshHost:v=>x("/connections/hosts",{method:"POST",body:{token:v}}),removeSshHost:v=>x("/connections/hosts/remove",{method:"POST",body:{alias:v}}),forgetRemote:()=>x("/connections/forget",{method:"POST",body:{}}),disconnectRemote:()=>x("/connections/disconnect",{method:"POST",body:{}}),syncLocalCatalog:()=>x("/local-catalog",{method:"POST",body:{}}),gatewayDocker:(v=!1)=>x(`/gateway-docker${v?"?fresh=1":""}`,{scoped:!1}),connectGatewayDocker:(v=[],j=!0)=>x("/gateway-docker/connect",{method:"POST",body:{confirm:j,seen:v},scoped:!1}),undoGatewayDocker:(v=[])=>x("/gateway-docker/undo",{method:"POST",body:{confirm:!0,seen:v},scoped:!1}),setups:()=>x("/setups"),discoverSetups:v=>x("/setups/scan",{method:"POST",body:{sources:v}}),reviewSetup:(v,j)=>x("/setups/review",{method:"POST",body:{token:v,ids:j}}),removeSetupReviewItem:(v,j)=>x("/setups/remove-review-item",{method:"POST",body:{token:v,item:j}}),prepareSetup:(v,j)=>x("/setups/prepare",{method:"POST",body:{token:v,items:j,approved:!0}}),prepareLaunchSetup:(v,j)=>x(`/setups/${v}/prepare-launch`,{method:"POST",body:{revision:j}}),prepareSavedSetup:v=>x(`/setups/${v}/prepare`,{method:"POST",body:{}}),setupPreparation:v=>x(`/setups/preparations/${v}`),cancelSetupPreparation:v=>x(`/setups/preparations/${v}/cancel`,{method:"POST",body:{}}),setupFile:(v,j,S)=>x("/setups/file",{method:"POST",body:{token:v,item:j,path:S}}),saveSetup:(v,j,S)=>x("/setups/save",{method:"POST",body:{token:v,name:j,acknowledged:S}}),deleteSetup:(v,j)=>x(`/setups/${v}/delete`,{method:"POST",body:{revision:j}}),deleteSetupItem:(v,j,S)=>x(`/setups/${v}/delete-item`,{method:"POST",body:{item:j,revision:S}}),previewSetup:(v,j,S)=>x(`/setups/${v}/preview`,{method:"POST",body:{sandbox:j,targets:S}}),enableSetup:(v,j,S,N=!1)=>x(`/setups/${v}/enable`,{method:"POST",body:{sandbox:j,token:S,approveAccess:N}}),removeSetup:(v,j,S)=>x(`/setups/${v}/remove`,{method:"POST",body:{sandbox:j,token:S}}),setupJobs:v=>x(`/setups/${v}/jobs`),cloudExport:v=>x(`/cloud-export?name=${encodeURIComponent(v)}`),importCloud:v=>x("/cloud-import",{method:"POST",body:v}),cloudTransfer:(v,j)=>x("/cloud-transfer",{method:"POST",body:{name:v,ticket:j}}),selectContext:v=>x("/context",{method:"POST",body:v}),previewActivityDeletion:v=>x("/activity/delete-preview",{method:"POST",body:v}),deleteActivity:v=>x("/activity/delete",{method:"POST",body:{token:v}}),activityDestinations:()=>x("/activity-destinations"),createActivityDestination:v=>x("/activity-destinations",{method:"POST",body:v}),activityDestinationAction:(v,j)=>x(`/activity-destinations/${encodeURIComponent(v)}/${j}`,{method:"POST",body:{}}),overview:()=>x("/overview"),sandbox:v=>x(`/sandboxes/${encodeURIComponent(v)}`),activity:(v={})=>x(`/activity?query=${encodeURIComponent(JSON.stringify(v))}`),create:v=>x("/sandboxes",{method:"POST",body:v}),sshConnection:v=>x(`/sandboxes/${encodeURIComponent(v)}/ssh`),openSshTerminal:(v,j)=>x(`/sandboxes/${encodeURIComponent(v)}/ssh-open`,{method:"POST",body:{mode:j}}),sshConfig:v=>x(`/sandboxes/${encodeURIComponent(v)}/ssh-config`,{method:"POST",body:{}}),terminalSession:(v,j)=>x(`/sandboxes/${encodeURIComponent(v)}/terminal-session`,{method:"POST",body:j}),lifecycle:(v,j)=>x(`/sandboxes/${encodeURIComponent(v)}/${j}`,{method:"POST",body:{}}),editors:()=>x("/editors"),openEditor:(v,j)=>x(`/sandboxes/${encodeURIComponent(v)}/editor`,{method:"POST",body:{editor:j}}),fleetPolicy:()=>x("/policy/fleet"),policy:v=>x(`/policy/${encodeURIComponent(v)}`),revision:(v,j)=>x(`/policy/${encodeURIComponent(v)}/revisions/${j}`),applyOps:(v,j)=>x(`/policy/${encodeURIComponent(v)}/ops`,{method:"POST",body:{ops:j}}),restore:(v,j)=>x(`/policy/${encodeURIComponent(v)}/restore`,{method:"POST",body:{version:j}}),globalPolicy:()=>x("/policy/global"),removeGlobal:()=>x("/policy/global/remove",{method:"POST",body:{}}),settings:v=>x(`/settings${v?`/${encodeURIComponent(v)}`:""}`),setSetting:v=>x("/settings",{method:"POST",body:v}),secrets:()=>x("/secrets"),createSecret:v=>x("/secrets",{method:"POST",body:v}),rotateSecret:(v,j)=>x(`/secrets/${encodeURIComponent(v)}/rotate`,{method:"POST",body:{credentials:j}}),secretExpiry:(v,j,S)=>x(`/secrets/${encodeURIComponent(v)}/expiry`,{method:"POST",body:{key:j,expiresAt:S}}),deleteSecret:v=>x(`/secrets/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),attachSecret:(v,j,S)=>x(`/secrets/${encodeURIComponent(v)}/${S?"attach":"detach"}`,{method:"POST",body:{sandbox:j}}),importProfile:v=>x("/profiles/import",{method:"POST",body:{id:v}}),deleteTemplates:v=>x("/templates/delete",{method:"POST",body:{ids:v}}),templates:()=>x("/templates"),imageTemplates:()=>x("/image-templates"),localImages:()=>x("/image-templates/local-images"),buildImageTemplate:(v,j=!1)=>x("/image-templates",{method:"POST",body:{recipe:v,replace:j}}),cancelImageBuild:v=>x(`/image-templates/${encodeURIComponent(v)}/cancel`,{method:"POST",body:{}}),dismissImageBuild:v=>x(`/image-templates/${encodeURIComponent(v)}/dismiss`,{method:"POST",body:{}}),imageTemplateUsage:v=>x(`/image-templates/${encodeURIComponent(v)}/usage`),deleteImageTemplate:v=>x(`/image-templates/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),org:()=>x("/org"),saveOrg:v=>x("/org",{method:"POST",body:v}),saveGroup:v=>x("/org/groups",{method:"POST",body:v}),deleteGroup:v=>x(`/org/groups/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),setGroupMembers:(v,j,S="replace")=>x("/org/members",{method:"POST",body:{sandboxes:v,groups:j,mode:S}}),savePolicy:v=>x("/egress/policies",{method:"POST",body:v}),deletePolicy:v=>x(`/egress/policies/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),saveTemplate:v=>x("/templates",{method:"POST",body:v}),deleteTemplate:v=>x(`/templates/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),localFolder:v=>x("/local-folder",{method:"POST",body:{path:v}}),files:(v,j)=>x(`/files/${encodeURIComponent(v)}?path=${encodeURIComponent(j)}`),seed:v=>x(`/files/${encodeURIComponent(v)}/seed`),retrySeed:v=>x(`/files/${encodeURIComponent(v)}/seed/retry`,{method:"POST",body:{}}),prepareDownload:(v,j)=>x(`/files/${encodeURIComponent(v)}/download`,{method:"POST",body:{path:j}}),startUpload:v=>x(`/files/${encodeURIComponent(v)}/uploads`,{method:"POST",body:{}}),uploadFile:(v,j,S,N,C)=>x(`/files/${encodeURIComponent(v)}/uploads/${j}?path=${encodeURIComponent(S)}`,{method:"POST",body:N,raw:!0,signal:C}),commitUpload:(v,j,S)=>x(`/files/${encodeURIComponent(v)}/uploads/${j}/commit`,{method:"POST",body:{dir:S}}),cancelUpload:(v,j)=>x(`/files/${encodeURIComponent(v)}/uploads/${j}/cancel`,{method:"POST",body:{}}),ingress:()=>x("/ingress"),exposeService:v=>x("/ingress/expose",{method:"POST",body:v}),closeService:v=>x("/ingress/close",{method:"POST",body:{sandbox:v.sandbox,name:v.name}}),extendService:(v,j)=>x("/ingress/extend",{method:"POST",body:{sandbox:v.sandbox,name:v.name,closeAfterMinutes:j}})}}const ls=Cr(),lC="",ja=/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(lC)?lC:"",Go=!!ja,Ml="Cloud is coming soon. We're still working on it.";function CP(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 kP(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!CP(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 TP(e,t,r,a=ja){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 au(e,t,{signal:r}={}){const a=await fetch(`/api/local-cloud/${e}`,{signal:r,method:t===void 0?"GET":"POST",headers:{...Dy()?{"x-openrod-local-owner":Dy()}:{},...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 EP=(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 zR(e,{signal:t,onProgress:r=()=>{},wait:a=EP,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 PR(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 RP(e,t,r,a){if(t.target!=="local")throw Error("Choose a local destination for this workspace.");return PR(e,t,r,a)}async function AP(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 OP({popup:e,origin:t,cloud:r=ja,request:a=au,events:l=window,focus:c=()=>window.focus(),setTimer:u=setInterval,clearTimer:f=clearInterval,now:m=Date.now}){let h,g=!1,p=!1,x,v;const j=new Promise((R,M)=>{x=R,v=M}),S=async()=>{h&&await a("cancel",{nonce:h}).catch(()=>{})},N=()=>{f(A),l.removeEventListener("message",T)};function C(R="Cloud sign-in was cancelled."){return p?Promise.resolve():(p=!0,N(),e.close(),v(new Error(R)),S())}const T=async R=>{if(!(p||g||!h||!TP(R,e,h,r))){g=!0;try{const M=await a("finish",{nonce:h,code:R.data.code});if(p){await S();return}if(!M.connected||!M.user)throw new Error("Sign-in did not finish. Try again.");p=!0,N(),e.close(),c(),x(M)}catch(M){if(p){await S();return}await C(M.message)}}},k=m()+15*6e4,A=u(()=>{(e.closed||m()>k)&&C(e.closed?"Cloud sign-in was cancelled.":"Cloud sign-in timed out. Try again.")},500);return l.addEventListener("message",T),Promise.resolve().then(async()=>{if(p)return;const R=await a("start",{origin:t});if(h=R.nonce,p){await S();return}e.location.href=R.url}).catch(R=>{p||C(R.message)}),{promise:j,cancel:C}}const ng=b.createContext(null),IR=b.createContext(null),_r=()=>b.useContext(ng);function sg(){const e=b.useContext(IR);if(!e)throw new Error("useApi outside ComputeSession");return e}function MP({target:e,children:t}){const r=_r(),a=b.useMemo(()=>e&&(r!=null&&r.localViewer)?{...r,target:e,nativeActions:e==="local"||!!r.connected}:r,[r,e]);return s.jsx(ng.Provider,{value:a,children:t})}function zy({target:e,ownerScope:t,children:r}){const a=b.useMemo(()=>{const l=new AbortController;return{controller:l,generation:0,api:Cr(e,l.signal)}},[e,t]);return b.useEffect(()=>{const l=++a.generation;return()=>queueMicrotask(()=>{l===a.generation&&a.controller.abort()})},[a]),s.jsx(IR.Provider,{value:a.api,children:r})}function DP({children:e,user:t,logout:r}){MR("cloud");const a={target:"cloud",localViewer:!1,nativeActions:!1,user:t,logout:r};return s.jsx(ng.Provider,{value:a,children:s.jsx(zy,{target:"local",children:e})})}function zP({children:e,status:t,onStatus:r,onCancel:a}){var x;const[l,c]=b.useState(((x=t.machine)==null?void 0:x.status)==="ready"),[u,f]=b.useState(t.machine),[m,h]=b.useState(""),[g,p]=b.useState(0);return b.useEffect(()=>{if(l)return;const v=new AbortController;return h(""),zR(()=>au("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"}),ja]})})}function PP({children:e}){var A;const[t,r]=b.useState(()=>jP(window.location.href,window.sessionStorage)),[a,l]=b.useState(()=>Go?null:{connected:!1}),[c,u]=b.useState(""),[f,m]=b.useState(!1),[h,g]=b.useState(!1),p=b.useRef(null),x=b.useRef({uid:null,revision:0});MR(t),iC(a!=null&&a.connected?a.owner:null),b.useEffect(()=>{let R=!0;if(!Go)return;au("status").then(E=>{R&&l(E)}).catch(E=>{R&&(u(E.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 E;R=!1,window.removeEventListener("openrod-session-expired",M),(E=p.current)==null||E.cancel("Cloud connection cancelled.")}},[]),b.useEffect(()=>{if(!(a!=null&&a.connected)||!a.expires)return;const R=typeof a.expires=="number"?a.expires:Date.parse(a.expires);if(!Number.isFinite(R))return;const M=setTimeout(()=>{l({connected:!1}),u("Your cloud connection expired. Connect again to continue.")},Math.max(0,R-Date.now()));return()=>clearTimeout(M)},[a]);function v(R){if(!["local","cloud"].includes(R))return;try{sessionStorage.setItem(RR,R)}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(R)}async function j(){if(a!=null&&a.connected)return a;if(!Go)throw new Error(Ml);if(p.current)throw new Error("A cloud sign-in is already open.");const R=window.open("about:blank","_blank","popup,width=520,height=720");if(!R)throw new Error("Allow popups to connect your local OpenRod to cloud.");const M=OP({popup:R,origin:window.location.origin});p.current=M,m(!0),u("");try{const E=await M.promise;if(p.current!==M)throw new Error("Cloud sign-in was cancelled.");return iC(E.owner),l(E),E}catch(E){throw p.current===M&&u(E.message),E}finally{p.current===M&&(p.current=null,m(!1))}}function S(R="Cloud connection cancelled."){const M=p.current;if(M)return p.current=null,m(!1),u(R),M.cancel(R)}async function N(){try{await au("disconnect",{}),l({connected:!1}),v("local")}catch(R){[401,403].includes(R.status)&&(l({connected:!1}),v("local")),u(R.message)}}x.current=NP(x.current,a!=null&&a.connected?(A=a.user)==null?void 0:A.uid:null);const C=x.current.revision,T=`${t}:${C}`,k={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:N,selectTarget:v,createRequested:h,requestCreate:g,cancelConnect:()=>S()};return s.jsx(ng.Provider,{value:k,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}),Go?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:Ml,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:Ml})]}),s.jsx("button",{className:"mt-4 block w-full text-xs underline",onClick:()=>{S(),v("local")},children:"Use local compute"})]})}):t==="cloud"?s.jsx(zP,{status:a,onStatus:l,onCancel:()=>v("local"),children:s.jsx(zy,{target:t,ownerScope:C,children:e},T)},"cloud"):s.jsx(zy,{target:t,ownerScope:C,children:e},T)})}/**
|
|
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 _R=(...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 IP=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 _P=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 cC=e=>{const t=_P(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 LP={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 $P=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 BP=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:l="",children:c,iconNode:u,...f},m)=>b.createElement("svg",{ref:m,...LP,width:t,height:t,stroke:e,strokeWidth:a?Number(r)*24/Number(t):r,className:_R("lucide",l),...!c&&!$P(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,g])=>b.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=b.forwardRef(({className:a,...l},c)=>b.createElement(BP,{ref:c,iconNode:t,className:_R(`lucide-${IP(cC(e))}`,`lucide-${e}`,a),...l}));return r.displayName=cC(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 VP=[["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"}]],UP=st("activity",VP);/**
|
|
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 HP=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],cf=st("arrow-down",HP);/**
|
|
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 FP=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Yv=st("arrow-left",FP);/**
|
|
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 GP=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Py=st("arrow-right",GP);/**
|
|
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 qP=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Mi=st("arrow-up-right",qP);/**
|
|
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 YP=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],uf=st("arrow-up",YP);/**
|
|
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 KP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],XP=st("ban",KP);/**
|
|
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 WP=[["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"}]],QP=st("book-open",WP);/**
|
|
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 ZP=[["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"}]],LR=st("bot",ZP);/**
|
|
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 JP=[["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"}]],Xl=st("box",JP);/**
|
|
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 eI=[["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"}]],tI=st("building-2",eI);/**
|
|
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 nI=[["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"}]],sI=st("cable",nI);/**
|
|
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 rI=[["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"}]],oI=st("calendar-clock",rI);/**
|
|
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 aI=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Fn=st("check",aI);/**
|
|
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 iI=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Qo=st("chevron-down",iI);/**
|
|
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 lI=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Jr=st("chevron-right",lI);/**
|
|
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 cI=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],$R=st("chevron-up",cI);/**
|
|
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 uI=[["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"}]],uC=st("circle-alert",uI);/**
|
|
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 dI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],fI=st("circle-check",dI);/**
|
|
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 mI=[["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"}]],hI=st("circle-x",mI);/**
|
|
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 pI=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],gI=st("cloud",pI);/**
|
|
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 xI=[["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"}]],df=st("copy",xI);/**
|
|
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 bI=[["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"}]],Kv=st("door-open",bI);/**
|
|
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 yI=[["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"}]],BR=st("door-closed",yI);/**
|
|
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 vI=[["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"}]],Wc=st("download",vI);/**
|
|
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 wI=[["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"}]],VR=st("earth",wI);/**
|
|
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 jI=[["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"}]],SI=st("ellipsis",jI);/**
|
|
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 NI=[["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"}]],CI=st("external-link",NI);/**
|
|
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 kI=[["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"}]],UR=st("file-code-corner",kI);/**
|
|
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 TI=[["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"}]],Xv=st("file-text",TI);/**
|
|
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 EI=[["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"}]],RI=st("file",EI);/**
|
|
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 AI=[["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"}]],OI=st("folder-git-2",AI);/**
|
|
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 MI=[["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"}]],DI=st("folder-input",MI);/**
|
|
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 zI=[["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"}]],dC=st("folder",zI);/**
|
|
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 PI=[["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"}]],fC=st("funnel",PI);/**
|
|
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 II=[["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"}]],Wv=st("globe",II);/**
|
|
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 _I=[["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"}]],HR=st("hard-drive",_I);/**
|
|
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 LI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ff=st("info",LI);/**
|
|
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 $I=[["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"}]],gu=st("key-round",$I);/**
|
|
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 BI=[["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"}]],gp=st("laptop",BI);/**
|
|
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 VI=[["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"}]],UI=st("layers",VI);/**
|
|
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 HI=[["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"}]],FR=st("link-2",HI);/**
|
|
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 FI=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],GI=st("list-filter",FI);/**
|
|
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 qI=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],_l=st("loader-circle",qI);/**
|
|
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 YI=[["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"}]],mC=st("lock",YI);/**
|
|
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 KI=[["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"}]],XI=st("monitor",KI);/**
|
|
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 WI=[["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"}]],QI=st("moon",WI);/**
|
|
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 ZI=[["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"}]],rg=st("network",ZI);/**
|
|
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 JI=[["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"}]],GR=st("octagon-x",JI);/**
|
|
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 e6=[["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"}]],Qv=st("package",e6);/**
|
|
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 t6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],n6=st("panel-left",t6);/**
|
|
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 s6=[["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"}]],r6=st("pause",s6);/**
|
|
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 o6=[["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"}]],hC=st("pencil",o6);/**
|
|
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 a6=[["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"}]],qR=st("play",a6);/**
|
|
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 i6=[["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"}]],Zv=st("plug",i6);/**
|
|
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 l6=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],us=st("plus",l6);/**
|
|
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 c6=[["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"}]],$a=st("refresh-cw",c6);/**
|
|
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 u6=[["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"}]],d6=st("rotate-ccw",u6);/**
|
|
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 f6=[["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"}]],m6=st("rotate-cw",f6);/**
|
|
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 h6=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],p6=st("search",h6);/**
|
|
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 g6=[["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"}]],mf=st("server",g6);/**
|
|
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 x6=[["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"}]],xu=st("shield-check",x6);/**
|
|
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 b6=[["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"}]],Jv=st("shield-off",b6);/**
|
|
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 y6=[["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"}]],v6=st("sliders-horizontal",y6);/**
|
|
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 w6=[["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"}]],j6=st("square-code",w6);/**
|
|
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 S6=[["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"}]],N6=st("square-plus",S6);/**
|
|
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 C6=[["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"}]],YR=st("square-terminal",C6);/**
|
|
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 k6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],T6=st("square",k6);/**
|
|
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 E6=[["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"}]],R6=st("sun",E6);/**
|
|
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 A6=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],e1=st("terminal",A6);/**
|
|
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 O6=[["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"}]],pC=st("timer",O6);/**
|
|
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 M6=[["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"}]],Kn=st("trash-2",M6);/**
|
|
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 D6=[["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"}]],Ba=st("triangle-alert",D6);/**
|
|
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 z6=[["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"}]],P6=st("upload",z6);/**
|
|
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 I6=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],_6=st("user-round",I6);/**
|
|
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 L6=[["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"}]],Ra=st("users",L6);/**
|
|
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 $6=[["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"}]],gC=st("webhook",$6);/**
|
|
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 B6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Dn=st("x",B6),KR=[{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."}],V6=KR,U6=KR.filter(e=>e.config&&e.skills),Iy=e=>U6.find(t=>t.id===e),H6=e=>e.filter(t=>!!Iy(t));function og(){return typeof window<"u"}function Os(e){return t1(e)?(e.nodeName||"").toLowerCase():"#document"}function xn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Va(e){var t;return(t=(t1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function t1(e){return og()?e instanceof Node||e instanceof xn(e).Node:!1}function qt(e){return og()?e instanceof Element||e instanceof xn(e).Element:!1}function cn(e){return og()?e instanceof HTMLElement||e instanceof xn(e).HTMLElement:!1}function iu(e){return!og()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof xn(e).ShadowRoot}function hf(e){const{overflow:t,overflowX:r,overflowY:a,display:l}=kr(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+r)&&l!=="inline"&&l!=="contents"}function F6(e){return/^(table|td|th)$/.test(Os(e))}function ag(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const G6=/transform|translate|scale|rotate|perspective|filter/,q6=/paint|layout|strict|content/,yl=e=>!!e&&e!=="none";let A0;function n1(e){const t=qt(e)?kr(e):e;return yl(t.transform)||yl(t.translate)||yl(t.scale)||yl(t.rotate)||yl(t.perspective)||!s1()&&(yl(t.backdropFilter)||yl(t.filter))||G6.test(t.willChange||"")||q6.test(t.contain||"")}function Y6(e){let t=Aa(e);for(;cn(t)&&!Ca(t);){if(n1(t))return t;if(ag(t))return null;t=Aa(t)}return null}function s1(){return A0==null&&(A0=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),A0}function Ca(e){return/^(html|body|#document)$/.test(Os(e))}function kr(e){return xn(e).getComputedStyle(e)}function ig(e){return qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Aa(e){if(Os(e)==="html")return e;const t=e.assignedSlot||e.parentNode||iu(e)&&e.host||Va(e);return iu(t)?t.host:t}function XR(e){const t=Aa(e);return Ca(t)?(e.ownerDocument||e).body:cn(t)&&hf(t)?t:XR(t)}function Yd(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=!0);const l=XR(e),c=l===((a=e.ownerDocument)==null?void 0:a.body),u=xn(l);if(c){const f=_y(u);return t.concat(u,u.visualViewport||[],hf(l)?l:[],f&&r?Yd(f):[])}else return t.concat(l,Yd(l,[],r))}function _y(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const r1={...sP},xC={};function ds(e,t){const r=b.useRef(xC);return r.current===xC&&(r.current=e(t)),r}const O0=r1.useInsertionEffect,K6=O0&&O0!==r1.useLayoutEffect?O0:e=>e();function et(e){const t=ds(X6).current;return t.next=e,K6(t.effect),t.trampoline}function X6(){const e={next:void 0,callback:W6,trampoline:(...t)=>{var r;return(r=e.callback)==null?void 0:r.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function W6(){}const Q6=()=>{},Ke=typeof document<"u"?b.useLayoutEffect:Q6;function Ly(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const o1={};function Ks(e,t,r,a,l){if(!r&&!a&&!l&&!e)return xp(t);let c=xp(e);return t&&(c=Rd(c,t)),r&&(c=Rd(c,r)),a&&(c=Rd(c,a)),l&&(c=Rd(c,l)),c}function Z6(e){if(e.length===0)return o1;if(e.length===1)return xp(e[0]);let t=xp(e[0]);for(let r=1;r<e.length;r+=1)t=Rd(t,e[r]);return t}function xp(e){return a1(e)?{...QR(e,o1)}:J6(e)}function Rd(e,t){return a1(t)?QR(t,e):e_(e,t)}function J6(e){const t={...e};for(const r in t){const a=t[r];WR(r,a)&&(t[r]=ZR(a))}return t}function e_(e,t){if(!t)return e;for(const r in t){const a=t[r];switch(r){case"style":{e[r]=Ly(e.style,a);break}case"className":{e[r]=JR(e.className,a);break}default:WR(r,a)?e[r]=t_(e[r],a):e[r]=a}}return e}function WR(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 a1(e){return typeof e=="function"}function QR(e,t){return a1(e)?e(t):e??o1}function t_(e,t){return t?e?(...r)=>{const a=r[0];if(eA(a)){const c=a;bp(c);const u=t(...r);return c.baseUIHandlerPrevented||e==null||e(...r),u}const l=t(...r);return e==null||e(...r),l}:ZR(t):e}function ZR(e){return e&&((...t)=>{const r=t[0];return eA(r)&&bp(r),e(...t)})}function bp(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function JR(e,t){return t?e?t+" "+e:t:e}function eA(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function n_(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=n_("https://base-ui.com/production-error","Base UI"),tA=b.createContext(void 0);function lg(e=!1){const t=b.useContext(tA);if(t===void 0&&!e)throw new Error(Jt(16));return t}function s_(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:b.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 Gt(e){return(e==null?void 0:e.ownerDocument)||document}function Qc(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 ao(e={}){const{disabled:t=!1,focusableWhenDisabled:r,tabIndex:a=0,native:l=!0,composite:c}=e,u=b.useRef(null),f=lg(!0),m=c??f!==void 0,{props:h}=s_({focusableWhenDisabled:r,disabled:t,composite:m,tabIndex:a,isNativeButton:l}),g=b.useCallback(()=>{const v=u.current;M0(v)&&m&&t&&h.disabled===void 0&&v.disabled&&(v.disabled=!1)},[t,h.disabled,m]);Ke(g,[g]);const p=b.useCallback((v={})=>{const{onClick:j,onMouseDown:S,onKeyUp:N,onKeyDown:C,onPointerDown:T,...k}=v;return Ks({onClick(A){if(t){A.preventDefault();return}j==null||j(A)},onMouseDown(A){t||S==null||S(A)},onKeyDown(A){if(t||(bp(A),C==null||C(A),A.baseUIHandlerPrevented))return;const R=A.target===A.currentTarget,M=A.currentTarget,E=M0(M),O=!l&&r_(M),z=R&&(l?E:!O),_=A.key==="Enter",B=A.key===" ",q=M.getAttribute("role"),I=(q==null?void 0:q.startsWith("menuitem"))||q==="option"||q==="gridcell";if(R&&m&&B){if(A.defaultPrevented&&I)return;A.preventDefault(),(!l||E)&&(A.preventBaseUIHandler(),Qc(M,A));return}if(!z||l||!B&&!_){R&&O&&B&&A.preventDefault();return}A.defaultPrevented||(A.preventDefault(),_&&(A.preventBaseUIHandler(),Qc(M,A)))},onKeyUp(A){if(!t){if(bp(A),N==null||N(A),A.target===A.currentTarget&&l&&m&&M0(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!l&&!m&&!A.defaultPrevented&&A.key===" "&&(A.preventBaseUIHandler(),Qc(A.currentTarget,A))}},onPointerDown(A){if(t){A.preventDefault();return}T==null||T(A)}},l?{type:"button"}:{role:"button"},h,k)},[t,h,m,l]),x=et(v=>{u.current=v,g()});return{getButtonProps:p,buttonRef:x}}function M0(e){return cn(e)&&e.tagName==="BUTTON"}function r_(e){return cn(e)&&e.tagName==="A"&&!!e.href}function no(e,t,r,a){const l=ds(nA).current;return a_(l,e,t,r,a)&&sA(l,[e,t,r,a]),l.callback}function o_(e){const t=ds(nA).current;return i_(t,e)&&sA(t,e),t.callback}function nA(){return{callback:null,cleanup:null,refs:[]}}function a_(e,t,r,a,l){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==a||e.refs[3]!==l}function i_(e,t){return e.refs.length!==t.length||e.refs.some((r,a)=>r!==t[a])}function sA(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 l_=parseInt(b.version,10);function i1(e){return l_>=e}function bC(e){if(!b.isValidElement(e))return null;const t=e,r=t.props;return(i1(19)?r==null?void 0:r.ref:t.ref)??null}function Tn(){}const Tr=Object.freeze([]),gn=Object.freeze({});function c_(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 u_(e,t){return typeof e=="function"?e(t):e}function rA(e,t){return typeof e=="function"?e(t):e}function jt(e,t,r={}){let a=t.render;r.enabled!==!1&&(a=h_(a));const l=d_(t,r,a);if(r.enabled===!1)return null;const c=r.state??gn;return p_(e,a,l,c)}function d_(e,t,r){const{className:a,style:l}=e,{state:c=gn,ref:u,props:f,stateAttributesMapping:m,enabled:h=!0}=t,g=h?u_(a,c):void 0,p=h?rA(l,c):void 0,x=h?c_(c,m):gn,v=h&&f?f_(f):void 0,j=h?Ly(x,v)??{}:gn;return typeof document<"u"&&(h?Array.isArray(u)?j.ref=o_([j.ref,bC(r),...u]):j.ref=no(j.ref,bC(r),u):no(null,null)),h?(g!==void 0&&(j.className=JR(j.className,g)),p!==void 0&&(j.style=Ly(j.style,p)),j):gn}function f_(e){return Array.isArray(e)?Z6(e):Ks(void 0,e)}const m_=Symbol.for("react.lazy");function h_(e){if((e==null?void 0:e.$$typeof)!==m_)return e;const t=b.Children.toArray(e)[0];return b.isValidElement(t)?t:e}function p_(e,t,r,a){if(t){if(typeof t=="function")return t(r,a);const l=Ks(r,t.props);return l.ref=r.ref,b.cloneElement(t,l)}if(e&&typeof e=="string")return g_(e,r);throw new Error(Jt(8))}function g_(e,t){return e==="button"?b.createElement("button",{type:"button",...t,key:t.key}):e==="img"?b.createElement("img",{alt:"",...t,key:t.key}):b.createElement(e,t)}const x_=b.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}=ao({disabled:c,focusableWhenDisabled:u,native:f});return jt("button",t,{state:{disabled:c},ref:[r,p],props:[h,g]})});function oA(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=oA(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function aA(){for(var e,t,r=0,a="",l=arguments.length;r<l;r++)(e=arguments[r])&&(t=oA(e))&&(a&&(a+=" "),a+=t);return a}const yC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,vC=aA,cg=(e,t)=>r=>{var a;if((t==null?void 0:t.variants)==null)return vC(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 x=yC(g)||yC(p);return l[h][x]}),f=r&&Object.entries(r).reduce((h,g)=>{let[p,x]=g;return x===void 0||(h[p]=x),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,g)=>{let{class:p,className:x,...v}=g;return Object.entries(v).every(j=>{let[S,N]=j;return Array.isArray(N)?N.includes({...c,...f}[S]):{...c,...f}[S]===N})?[...h,p,x]:h},[]);return vC(e,u,m,r==null?void 0:r.class,r==null?void 0:r.className)},b_=(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},y_=(e,t)=>({classGroupId:e,validator:t}),iA=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),yp="-",wC=[],v_="arbitrary..",w_=e=>{const t=S_(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return j_(u);const f=u.split(yp),m=f[0]===""&&f.length>1?1:0;return lA(f,m,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const m=a[u],h=r[u];return m?h?b_(h,m):m:h||wC}return r[u]||wC}}},lA=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const l=e[t],c=r.nextPart.get(l);if(c){const h=lA(e,t+1,c);if(h)return h}const u=r.validators;if(u===null)return;const f=t===0?e.join(yp):e.slice(t).join(yp),m=u.length;for(let h=0;h<m;h++){const g=u[h];if(g.validator(f))return g.classGroupId}},j_=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?v_+a:void 0})(),S_=e=>{const{theme:t,classGroups:r}=e;return N_(r,t)},N_=(e,t)=>{const r=iA();for(const a in e){const l=e[a];l1(l,r,a,t)}return r},l1=(e,t,r,a)=>{const l=e.length;for(let c=0;c<l;c++){const u=e[c];C_(u,t,r,a)}},C_=(e,t,r,a)=>{if(typeof e=="string"){k_(e,t,r);return}if(typeof e=="function"){T_(e,t,r,a);return}E_(e,t,r,a)},k_=(e,t,r)=>{const a=e===""?t:cA(t,e);a.classGroupId=r},T_=(e,t,r,a)=>{if(R_(e)){l1(e(a),t,r,a);return}t.validators===null&&(t.validators=[]),t.validators.push(y_(r,e))},E_=(e,t,r,a)=>{const l=Object.entries(e),c=l.length;for(let u=0;u<c;u++){const[f,m]=l[u];l1(m,cA(t,f),r,a)}},cA=(e,t)=>{let r=e;const a=t.split(yp),l=a.length;for(let c=0;c<l;c++){const u=a[c];let f=r.nextPart.get(u);f||(f=iA(),r.nextPart.set(u,f)),r=f}return r},R_=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,A_=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)}}},$y="!",jC=":",O_=[],SC=(e,t,r,a,l)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:a,isExternal:l}),M_=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 N=l[S];if(u===0&&f===0){if(N===jC){c.push(l.slice(m,S)),m=S+1;continue}if(N==="/"){h=S;continue}}N==="["?u++:N==="]"?u--:N==="("?f++:N===")"&&f--}const p=c.length===0?l:l.slice(m);let x=p,v=!1;p.endsWith($y)?(x=p.slice(0,-1),v=!0):p.startsWith($y)&&(x=p.slice(1),v=!0);const j=h&&h>m?h-m:void 0;return SC(c,v,x,j)};if(t){const l=t+jC,c=a;a=u=>u.startsWith(l)?c(u.slice(l.length)):SC(O_,!1,u,void 0,!0)}if(r){const l=a;a=c=>r({className:c,parseClassName:l})}return a},D_=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}},z_=e=>({cache:A_(e.cacheSize),parseClassName:M_(e),sortModifiers:D_(e),postfixLookupClassGroupIds:P_(e),...w_(e)}),P_=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},I_=/\s+/,__=(e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:c,postfixLookupClassGroupIds:u}=t,f=[],m=e.trim().split(I_);let h="";for(let g=m.length-1;g>=0;g-=1){const p=m[g],{isExternal:x,modifiers:v,hasImportantModifier:j,baseClassName:S,maybePostfixModifierPosition:N}=r(p);if(x){h=p+(h.length>0?" "+h:h);continue}let C=!!N,T;if(C){const E=S.substring(0,N);T=a(E);const O=T&&u[T]?a(S):void 0;O&&O!==T&&(T=O,C=!1)}else T=a(S);if(!T){if(!C){h=p+(h.length>0?" "+h:h);continue}if(T=a(S),!T){h=p+(h.length>0?" "+h:h);continue}C=!1}const k=v.length===0?"":v.length===1?v[0]:c(v).join(":"),A=j?k+$y:k,R=A+T;if(f.indexOf(R)>-1)continue;f.push(R);const M=l(T,C);for(let E=0;E<M.length;++E){const O=M[E];f.push(A+O)}h=p+(h.length>0?" "+h:h)}return h},L_=(...e)=>{let t=0,r,a,l="";for(;t<e.length;)(r=e[t++])&&(a=uA(r))&&(l&&(l+=" "),l+=a);return l},uA=e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=uA(e[a]))&&(r&&(r+=" "),r+=t);return r},$_=(e,...t)=>{let r,a,l,c;const u=m=>{const h=t.reduce((g,p)=>p(g),e());return r=z_(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=__(m,r);return l(m,g),g};return c=u,(...m)=>c(L_(...m))},B_=[],rs=e=>{const t=r=>r[e]||B_;return t.isThemeGetter=!0,t.themeKey=e,t},dA=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fA=/^\((?:(\w[\w-]*):)?(.+)\)$/i,V_=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,U_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H_=/\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$/,F_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,G_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,q_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ji=e=>V_.test(e),Ht=e=>!!e&&!Number.isNaN(Number(e)),Lo=e=>!!e&&Number.isInteger(Number(e)),D0=e=>e.endsWith("%")&&Ht(e.slice(0,-1)),xa=e=>U_.test(e),mA=()=>!0,Y_=e=>H_.test(e)&&!F_.test(e),c1=()=>!1,K_=e=>G_.test(e),X_=e=>q_.test(e),W_=e=>!at(e)&&!it(e),Q_=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)),Z_=e=>$i(e,gA,c1),at=e=>dA.test(e),vl=e=>$i(e,xA,Y_),NC=e=>$i(e,aL,Ht),J_=e=>$i(e,yA,mA),eL=e=>$i(e,bA,c1),CC=e=>$i(e,hA,c1),tL=e=>$i(e,pA,X_),oh=e=>$i(e,vA,K_),it=e=>fA.test(e),jd=e=>Wl(e,xA),nL=e=>Wl(e,bA),kC=e=>Wl(e,hA),sL=e=>Wl(e,gA),rL=e=>Wl(e,pA),ah=e=>Wl(e,vA,!0),oL=e=>Wl(e,yA,!0),$i=(e,t,r)=>{const a=dA.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},Wl=(e,t,r=!1)=>{const a=fA.exec(e);return a?a[1]?t(a[1]):r:!1},hA=e=>e==="position"||e==="percentage",pA=e=>e==="image"||e==="url",gA=e=>e==="length"||e==="size"||e==="bg-size",xA=e=>e==="length",aL=e=>e==="number",bA=e=>e==="family-name",yA=e=>e==="number"||e==="weight",vA=e=>e==="shadow",iL=()=>{const e=rs("color"),t=rs("font"),r=rs("text"),a=rs("font-weight"),l=rs("tracking"),c=rs("leading"),u=rs("breakpoint"),f=rs("container"),m=rs("spacing"),h=rs("radius"),g=rs("shadow"),p=rs("inset-shadow"),x=rs("text-shadow"),v=rs("drop-shadow"),j=rs("blur"),S=rs("perspective"),N=rs("aspect"),C=rs("ease"),T=rs("animate"),k=()=>["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"],R=()=>[...A(),it,at],M=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],O=()=>[it,at,m],z=()=>[ji,"full","auto",...O()],_=()=>[Lo,"none","subgrid",it,at],B=()=>["auto",{span:["full",Lo,it,at]},Lo,it,at],q=()=>[Lo,"auto",it,at],I=()=>["auto","min","max","fr",it,at],L=()=>["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=()=>[ji,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],G=()=>[f,ji,"screen","full","dvw","lvw","svw","min","max","fit",...O()],X=()=>[ji,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],$=()=>[e,it,at],Q=()=>[...A(),kC,CC,{position:[it,at]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",sL,Z_,{size:[it,at]}],P=()=>[D0,jd,vl],U=()=>["","none","full",h,it,at],Z=()=>["",Ht,jd,vl],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"],de=()=>[Ht,D0,kC,CC],oe=()=>["","none",j,it,at],ne=()=>["none",Ht,it,at],ee=()=>["none",Ht,it,at],W=()=>[Ht,it,at],ce=()=>[ji,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xa],breakpoint:[xa],color:[mA],container:[xa],"drop-shadow":[xa],ease:["in","out","in-out"],font:[W_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xa],shadow:[xa],spacing:["px",Ht],text:[xa],"text-shadow":[xa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ji,at,it,N]}],container:["container"],"container-type":[{"@container":["","normal","size",it,at]}],"container-named":[Q_],columns:[{columns:[Ht,"auto",at,it,f]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:R()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{"inset-s":z(),start:z()}],end:[{"inset-e":z(),end:z()}],"inset-bs":[{"inset-bs":z()}],"inset-be":[{"inset-be":z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[Lo,"auto",it,at]}],basis:[{basis:[ji,"full","auto",f,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ht,ji,"auto","initial","none",at]}],grow:[{grow:["",Ht,it,at]}],shrink:[{shrink:["",Ht,it,at]}],order:[{order:[Lo,"first","last","none",it,at]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:B()}],"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":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"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,jd,vl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,oL,J_]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",D0,at]}],"font-family":[{font:[nL,eL,t]}],"font-features":[{"font-features":[at]}],"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,it,at]}],"line-clamp":[{"line-clamp":[Ht,"none",it,NC]}],leading:[{leading:["none",c,...O()]}],"list-image":[{"list-image":["none",it,at]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",it,at]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ht,"from-font","auto",it,vl]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Ht,"auto",it,at]}],"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:[Lo,it,at]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",it,at]}],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",it,at]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Lo,it,at],radial:["",it,at],conic:["",Lo,it,at]},rL,tL]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],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:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-bs":[{"border-bs":$()}],"border-color-be":[{"border-be":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ht,it,at]}],"outline-w":[{outline:["",Ht,jd,vl]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","inner","none",g,ah,oh]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",p,ah,oh]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Ht,vl]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",x,ah,oh]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Ht,it,at]}],"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":[Ht]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[it,at]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"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":[Ht]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",it,at]}],filter:[{filter:["","none",it,at]}],blur:[{blur:oe()}],brightness:[{brightness:[Ht,it,at]}],contrast:[{contrast:[Ht,it,at]}],"drop-shadow":[{"drop-shadow":["","none",v,ah,oh]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Ht,it,at]}],"hue-rotate":[{"hue-rotate":[Ht,it,at]}],invert:[{invert:["",Ht,it,at]}],saturate:[{saturate:[Ht,it,at]}],sepia:[{sepia:["",Ht,it,at]}],"backdrop-filter":[{"backdrop-filter":["","none",it,at]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[Ht,it,at]}],"backdrop-contrast":[{"backdrop-contrast":[Ht,it,at]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ht,it,at]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ht,it,at]}],"backdrop-invert":[{"backdrop-invert":["",Ht,it,at]}],"backdrop-opacity":[{"backdrop-opacity":[Ht,it,at]}],"backdrop-saturate":[{"backdrop-saturate":[Ht,it,at]}],"backdrop-sepia":[{"backdrop-sepia":["",Ht,it,at]}],"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",it,at]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ht,"initial",it,at]}],ease:[{ease:["linear","initial",C,it,at]}],delay:[{delay:[Ht,it,at]}],animate:[{animate:["none",T,it,at]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,it,at]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:W()}],"skew-x":[{"skew-x":W()}],"skew-y":[{"skew-y":W()}],transform:[{transform:[it,at,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],zoom:[{zoom:[Lo,it,at]}],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"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",it,at]}],"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":$()}],"scrollbar-track-color":[{"scrollbar-track":$()}],"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",it,at]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Ht,jd,vl,NC]}],stroke:[{stroke:["none",...$()]}],"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"]}},lL=$_(iL);function Le(...e){return lL(aA(e))}const By=cg("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(x_,{"data-slot":"button",className:Le(By({variant:t,size:r,className:e})),...a})}const cL="data-valid",uL="data-invalid",dL={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},fL={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},mL={disabled:!1,...fL},ug={valid(e){return e===null?null:e?{[cL]:""}:{[uL]:""}}},hL={invalid:void 0,name:void 0,validityData:{state:dL,errors:[],error:"",value:"",initialValue:null},setValidityData:Tn,disabled:void 0,setTouched:Tn,setDirty:Tn,setFilled:Tn,setFocused:Tn,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:mL,registerFieldControl:Tn,validation:{getValidationProps:(e,t=gn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Tn,getInputControl:()=>null,commit:async()=>{},change:Tn}},pL=b.createContext(hL);function bu(e=!0){const t=b.useContext(pL);if(t.setValidityData===Tn&&!e)throw new Error(Jt(28));return t}const gL=b.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Tn,validationMode:"onSubmit",submitCountRef:{current:0}});function dg(){return b.useContext(gL)}let TC=0;function xL(e,t="mui"){const[r,a]=b.useState(e),l=e||r;return b.useEffect(()=>{r==null&&(TC+=1,a(`${t}-${TC}`))},[r,t]),l}const EC=r1.useId;function Ll(e,t){if(EC!==void 0){const r=EC();return e??(t?`${t}-${r}`:r)}return xL(e,t)}function fs(e){return Ll(e,"base-ui")}const bL=b.createContext({controlId:void 0,registerControlId:Tn,resetControlId:Tn,labelId:void 0,setLabelId:Tn,messageIds:[],setMessageIds:Tn,getDescriptionProps:e=>e});function pf(){return b.useContext(bL)}function wA(e,t,r,a=!0,l){const[c,u]=b.useState(),f=fs(l?`${l}-label`:void 0),m=e??t??c;return Ke(()=>{const h=e||t||!a?void 0:yL(r.current,f);c!==h&&u(h)}),m}function yL(e,t){const r=vL(e);if(r)return!r.id&&t&&(r.id=t),r.id||void 0}function vL(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 gf(e={}){const{id:t,enabled:r=!0}=e,{controlId:a,registerControlId:l,resetControlId:c}=pf(),u=fs(),f=ds(()=>Symbol()),m=b.useRef(!1),h=b.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 wL(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:jL,platform:SL,maxTouchPoints:NL}=wL(),fg=jL.toLowerCase(),Kd=SL.toLowerCase(),mg=/^i(os$|p)/.test(Kd)||Kd==="macintel"&&NL>1,RC="android",Vy=Kd===RC||fg.includes(RC),u1=!mg&&Kd.startsWith("mac");Kd.startsWith("win");const CL=u1||mg;var NR;const Ua=typeof CSS<"u"&&!!((NR=CSS.supports)!=null&&NR.call(CSS,"-webkit-backdrop-filter:none"));!Ua&&fg.includes("firefox");!Ua&&fg.includes("chrom");const kL=CL,d1=/jsdom|happydom/.test(fg);function Ps(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&&iu(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 Uy="data-base-ui-focusable",jA="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",hg="ArrowLeft",pg="ArrowRight",SA="ArrowUp",f1="ArrowDown",m1="data-starting-style",TL="data-ending-style",EL={[m1]:""},RL={[TL]:""},Ha={transitionStatus(e){return e==="starting"?EL:e==="ending"?RL:null}},AL="data-open",OL="data-closed",ML="data-anchor-hidden",NA="data-popup-open",DL="data-pressed",zL={[NA]:""},PL={[NA]:"",[DL]:""},IL={[AL]:""},_L={[OL]:""},LL={[ML]:""},h1={open(e){return e?zL:null}},vp={open(e){return e?PL:null}},xf={open(e){return e?IL:_L},anchorHidden(e){return e?LL:null}},gg={...xf,...Ha},Hy="data-trigger-disabled";function wp(e,t){if(!qt(e))return!1;const r=e;if(t.hasElement(r))return!r.hasAttribute(Hy);for(const[,a]of t.entries())if(pt(a,r))return!a.hasAttribute(Hy);return!1}function z0(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 $L(e){return e.matches("html,body")}function xg(e){return cn(e)&&e.matches(jA)}function BL(e){return(e==null?void 0:e.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${jA}`))!=null}function Fy(e){return e?e.getAttribute("role")==="combobox"&&xg(e):!1}function VL(e){if(!e||d1)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function jp(e){return e?e.hasAttribute(Uy)?e:e.querySelector(`[${Uy}]`)||e:null}function Di(e,t,r=!0){return e.filter(l=>l.parentId===t).flatMap(l=>{var c;return[...!r||(c=l.context)!=null&&c.open?[l]:[],...Di(e,l.id,r)]})}function AC(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 Ho(e){e.preventDefault(),e.stopPropagation()}function UL(e){return"nativeEvent"in e}function bg(e){return e.pointerType===""&&e.isTrusted?!0:Vy&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function p1(e){return d1?!1:!Vy&&e.width===0&&e.height===0||Vy&&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 Ei(e,t){const r=["mouse","pen"];return t||r.push("",void 0),r.includes(e)}function HL(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const lu=Math.min,ka=Math.max,Sp=Math.round,ih=Math.floor,Ta=e=>({x:e,y:e}),FL={left:"right",right:"left",bottom:"top",top:"bottom"};function CA(e,t,r){return ka(e,lu(t,r))}function zi(e,t){return typeof e=="function"?e(t):e}function eo(e){return e.split("-")[0]}function Oa(e){return e.split("-")[1]}function g1(e){return e==="x"?"y":"x"}function x1(e){return e==="y"?"height":"width"}function Zr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function b1(e){return g1(Zr(e))}function GL(e,t,r){r===void 0&&(r=!1);const a=Oa(e),l=b1(e),c=x1(l);let u=l==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=Np(u)),[u,Np(u)]}function qL(e){const t=Np(e);return[Gy(e),t,Gy(t)]}function Gy(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const OC=["left","right"],MC=["right","left"],YL=["top","bottom"],KL=["bottom","top"];function XL(e,t,r){switch(e){case"top":case"bottom":return r?t?MC:OC:t?OC:MC;case"left":case"right":return t?YL:KL;default:return[]}}function WL(e,t,r,a){const l=Oa(e);let c=XL(eo(e),r==="start",a);return l&&(c=c.map(u=>u+"-"+l),t&&(c=c.concat(c.map(Gy)))),c}function Np(e){const t=eo(e);return FL[t]+e.slice(t.length)}function QL(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 kA(e){return typeof e!="number"?QL(e):{top:e,right:e,bottom:e,left:e}}function Xd(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 Ld(e,t){return t<0||t>=e.length}function Uh(e,t){return Sa(e.current,{disabledIndices:t})}function qy(e,t){return Sa(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Sa(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&&Zc(e,c,a));return c}function Zc(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?!yg(l)||l.matches(":disabled")?!0:!r&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!1}function ZL(e){return e.visibility==="hidden"||e.visibility==="collapse"}function yg(e,t=e?kr(e):null){return!e||!e.isConnected||!t||ZL(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const JL='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function e8(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const r=e.getRootNode();return iu(r)?r.host:null}function Yy(e){for(const t of Array.from(e.children))if(Os(t)==="summary")return t;return null}function t8(e,t){const r=Yy(t);return!!r&&(e===r||pt(r,e))}function TA(e){const t=e?Os(e):"";return e!=null&&e.matches(JL)&&(t!=="summary"||e.parentElement!=null&&Os(e.parentElement)==="details"&&Yy(e.parentElement)===e)&&(t!=="details"||Yy(e)==null)&&(t!=="input"||e.type!=="hidden")}function EA(e){if(!TA(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=e8(t)){const r=t!==e,a=Os(t)==="slot";if(t.hasAttribute("inert")||r&&Os(t)==="details"&&!t.open&&!t8(e,t)||t.hasAttribute("hidden")||!a&&!n8(t,r))return!1}return!0}function n8(e,t){const r=kr(e);return t?r.display!=="none":yg(e,r)}function RA(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 P0(e){if(Os(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function s8(e,t){const r=P0(e);if(!r)return!0;const a=t.find(l=>{const c=P0(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=P0(l);return(c==null?void 0:c.name)===r.name&&c.form===r.form})===r}function AA(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 OA(e,t){AA(e).forEach(r=>{TA(r)&&t.push(r),OA(r,t)})}function MA(e,t,r){AA(e).forEach(a=>{cn(a)&&a.matches(t)&&r.push(a),MA(a,t,r)})}function y1(e){return EA(e)&&RA(e)>=0}function DA(e){const t=[];return OA(e,t),t.filter(EA)}function bf(e){const t=DA(e);return t.filter(r=>RA(r)>=0&&s8(r,t))}function zA(e,t){const r=bf(e),a=r.length;if(a===0)return;const l=Ps(Gt(e)),c=r.indexOf(l),u=c===-1?t===1?0:a-1:c+t;return r[u]}function v1(e){return zA(Gt(e).body,1)||e}function PA(e){return zA(Gt(e).body,-1)||e}function IA(e,t){if(!e)return null;const r=bf(Gt(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 r8(e){return IA(e,1)}function o8(e){return IA(e,-1)}function Jc(e,t){const r=t||e.currentTarget,a=e.relatedTarget;return!a||!pt(r,a)}function a8(e){bf(e).forEach(r=>{r.dataset.tabindex=r.getAttribute("tabindex")||"",r.setAttribute("tabindex","-1")})}function DC(e){const t=[];MA(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 w1(e){b.useEffect(e,Tr)}const Sd=0;class so{constructor(){tn(this,"currentId",Sd);tn(this,"clear",()=>{this.currentId!==Sd&&(clearTimeout(this.currentId),this.currentId=Sd)});tn(this,"disposeEffect",()=>this.clear)}static create(){return new so}start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Sd,r()},t)}isStarted(){return this.currentId!==Sd}}function ts(){const e=ds(so.create).current;return w1(e.disposeEffect),e}const i8=b.createContext({disabled:!1});function l8(){return b.useContext(i8)}var ro=ER();const c8=CR(ro),lh=null;class u8{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 ch=new u8;class ar{constructor(){tn(this,"currentId",lh);tn(this,"cancel",()=>{this.currentId!==lh&&(ch.cancel(this.currentId),this.currentId=lh)});tn(this,"disposeEffect",()=>this.cancel)}static create(){return new ar}static request(t){return ch.request(t)}static cancel(t){return ch.cancel(t)}request(t){this.cancel(),this.currentId=ch.request(()=>{this.currentId=lh,t()})}}function cu(){const e=ds(ar.create).current;return w1(e.disposeEffect),e}function ba(e){return e==null?e:"current"in e?e.current:e}let uh=null;function d8(e){if(!uh){const t=[];uh=t,queueMicrotask(()=>{uh=null,ro.flushSync(()=>{for(const r of t)r()})})}uh.push(e)}function yf(e,t=!1,r=!1){const a=cu();return et((l,c=null)=>{a.cancel();const u=ba(e);if(u==null)return;const f=u,m=()=>{if(!r){ro.flushSync(l);return}d8(()=>{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=m1;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=yf(a,r,l);b.useEffect(()=>{if(!t)return;const m=new AbortController;return f(u,m.signal),()=>{m.abort()}},[t,r,u,f])}function Fa(e,t=!1,r=!1,a=!1){const[l,c]=b.useState(e&&t?"idle":void 0),[u,f]=b.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=ar.request(()=>{c("ending")});return()=>{ar.cancel(m)}}},[e,u,l,r]),Ke(()=>{if(!e||t)return;const m=ar.request(()=>{c(void 0)});return()=>{ar.cancel(m)}},[t,e]),Ke(()=>{if(!e||!t)return;e&&u&&l!=="idle"&&c("starting");const m=ar.request(()=>{c("idle")});return()=>{ar.cancel(m)}},[t,e,u,l]),{mounted:u,setMounted:f,transitionStatus:l}}function oo({controlled:e,default:t,name:r,state:a="value"}){const{current:l}=b.useRef(e!==void 0),[c,u]=b.useState(t),f=l&&e!==void 0?e:c,m=b.useCallback(h=>{l||u(h)},[]);return[f,m]}function vg(e,t,r,a,l=!0,c){const{registerFieldControl:u}=bu(),f=ds(()=>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 vf(e,t){const r=b.useRef(e),a=et(t);Ke(()=>{r.current!==e&&a(r.current),r.current=e},[e,a])}const Er="none",Zo="trigger-press",Hn="trigger-hover",eu="trigger-focus",wg="outside-press",Dl="item-press",_A="close-press",Pi="focus-out",wf="escape-key",Ky="list-navigation",LA="cancel-open",Ad="sibling-open",$A="disabled",zC="missing",PC="initial",jg="imperative-action",f8="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 m8=b.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:x,...v}=t,{state:j,name:S,disabled:N,setTouched:C,setDirty:T,validityData:k,setFocused:A,setFilled:R,validationMode:M,validation:E}=bu(),{clearErrors:O,elementRef:z,submitCountRef:_}=dg(),B=N||m,q=S??u,I={...j,disabled:B},{labelId:L}=pf(),H=gf({id:c}),[F]=oo({controlled:f,default:g,name:"FieldControl",state:"value"}),V=f!==void 0,G=V?F:void 0,X=G==null?void 0:String(G),$=et(()=>{var P;return(P=E.inputRef.current)==null?void 0:P.value});vg(E.inputRef,H,X,$,!B,u),Ke(()=>{var U;const P=X??((U=E.inputRef.current)==null?void 0:U.value);P!==void 0&&R(P!=="")},[X,E.inputRef,R]),vf(X,()=>{X!==void 0&&(O(q),T(X!==(k.initialValue??"")),E.change(X))});const Q=b.useRef(null),K=ts();return Ke(()=>{p&&Q.current===Ps(Gt(Q.current))&&A(!0)},[p,A]),jt("input",t,{ref:[r,Q],state:I,props:[{id:H,disabled:B,name:q,ref:E.inputRef,"aria-labelledby":L,autoFocus:p,...V?{value:G}:{defaultValue:g},onChange(P){const U=P.currentTarget.value,Z=bt(Er,P.nativeEvent);h==null||h(U,Z),!V&&(T(U!==(k.initialValue??"")),R(U!==""),!P.nativeEvent.defaultPrevented&&!Z.isCanceled&&(O(q),E.change(U)))},onFocus(){A(!0)},onBlur(P){if(C(!0),A(!1),M==="onBlur"){const U=P.currentTarget.value;E.commit(U),V&&queueMicrotask(()=>{var te;const Z=(te=E.inputRef.current)==null?void 0:te.value;Z!==void 0&&Z!==U&&Z!==(k.initialValue??"")&&E.commit(Z)})}},onKeyDown(P){if(P.currentTarget.tagName==="INPUT"&&P.key==="Enter"){C(!0);const U=P.currentTarget.value,Z=P.currentTarget.form;if(Z&&Z===z.current&&!P.defaultPrevented){const te=P.currentTarget,le=_.current;K.start(0,()=>{_.current===le&&E.commit(te.value)})}else E.commit(U)}}},v,P=>E.getValidationProps(B,P)],stateAttributesMapping:ug})}),h8=b.forwardRef(function(t,r){return s.jsx(m8,{ref:r,...t})});function At({className:e,type:t,...r}){return s.jsx(h8,{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 BA=48,ea=(e,t=0)=>{const r=new Int32Array(e.length);for(let a=0;a<e.length;a++)r[a]=e.charCodeAt(a)-BA-t;return r},Sg=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},Ii=e=>{const t=new Int32Array(e.length);let r=0;for(let a=0;a<e.length;a++){const l=e.charCodeAt(a)-BA;r+=l>>>1^-(l&1),t[a]=r}return t},p8=384,g8=[],Nl=Sg(ea("E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010")),x8=Sg(ea(":11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3")),b8="@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",y8=(()=>{const e=Nl.length-1,t=new Int32Array(e);for(let l=e-1;l>=0;l--){let c=1,u=l+1;for(let f=Nl[l];f<Nl[l+1];f++)c+=t[u],u+=t[u];t[l]=c}const r=new Int32Array(Nl[e]);let a=0;for(let l=0;l<e;l++){let c=l+1;for(let u=Nl[l];u<Nl[l+1];u++)r[a++]=c,c+=t[c]}return r})(),v8=ea("02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000",1),w8=Sg(ea("1233333593464636351265367151576")),j8=ea("93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0324325853;D>E?3257D>03258432585:0325B:;0328B:032"),S8=ea("012123445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EJK4444::EJ4444441691;644444114244444:;L6666555555555555555999666664444444444444444444444226?6:66644M9N?D:111::::6DJ199"),N8=Ii("0202002020020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200"),C8=(()=>{const e=new Int32Array(319).fill(-1),t=Ii("02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222"),r=Ii("02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222");for(let a=0;a<t.length;a++)e[t[a]]=r[a];return e})(),k8="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}),IC=Ii("0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422"),T8=Ii("ɠ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"),E8=Ii("02222222222222222222222222222222222222222222222222222222222222222203062222222222IL2200IL021042222]`222IL0gj2e50n2222U00X202[^2y0000560|{~22>22|22222222222G000qOVI00000}2>40000B00000I¨000°00000000000000021Q²±00´000000000000000000000222HGHa5¾222Ã6À2222ÍÐ000°2±"),VA=new Int32Array(991),UA=new Int32Array(991),HA=new Int32Array(991);let Xy="";const Wy=new Int32Array(1030);{const e=new Map;let t=0,r=0;for(let a=0;a<IC.length;a++)for(const l of k8[E8[a]]){let c=e.get(l);c===void 0&&(c=t++,e.set(l,c),Wy[c*2]=Xy.length,Wy[c*2+1]=l.length,Xy+=l),VA[r]=IC[a],UA[r]=T8[a],HA[r]=c,r++}}const R8=Ii("0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p"),A8=Sg(ea("1::22222432:222:22:22>222222:22:2221322511111311111114")),O8=Ii("24A;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"),M8=ea("ij"),D8=ea(""),z8=ea("1"),P8="* ** after backdrop before details-content file first-letter first-line marker placeholder selection";var I8={GROUP_COUNT:p8,customValidatorNames:g8,edgeStart:Nl,labelStart:x8,labelText:b8,edgeTarget:y8,nodeGroup:v8,nodeVlist:C8,vlistPat:w8,vlistOps:j8,vlistRef:S8,vlistGroup:N8,litAnchor:VA,litGroup:UA,litPool:HA,poolOffsets:Wy,poolText:Xy,adjGid:R8,adjStart:A8,adjTgt:O8,patGid:M8,patTgt:D8,postfixLookupGroups:z8,orderSensitiveModifiers:P8};const _8="line"in new Error,$o=-1,wl=-1,I0=(e,t,r)=>{let a=2166136261;for(let l=t;l<r;l++)a=Math.imul(a^e.charCodeAt(l),16777619);return a},_0=(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},L8=(e,t,r={})=>{const{GROUP_COUNT:a,edgeStart:l,labelStart:c,labelText:u,edgeTarget:f,nodeGroup:m,nodeVlist:h,vlistPat:g,vlistOps:p,vlistRef:x,vlistGroup:v,litAnchor:j,litGroup:S,litPool:N,poolOffsets:C,poolText:T,adjGid:k,adjStart:A,adjTgt:R,patGid:M,patTgt:E,postfixLookupGroups:O,customValidatorNames:z,orderSensitiveModifiers:_}=e,B=new Int32Array(a).fill(-1);for(let ke=0;ke<k.length;ke++)B[k[ke]]=ke;let q=0;for(let ke=0;ke+1<A.length;ke++){const $e=A[ke+1]-A[ke];$e>q&&(q=$e)}let I=32;for(;I<2*(1+q+M.length);)I<<=1;const L=new Int32Array(x.length+1);for(let ke=0;ke<x.length;ke++)L[ke+1]=L[ke]+g[x[ke]+1]-g[x[ke]];const H=new Uint8Array(a);for(let ke=0;ke<O.length;ke++)H[O[ke]]=1;const F=l.length-1,V=new Uint8Array(F);let G=0,X=!0;for(let ke=0;ke<j.length;ke++){V[j[ke]]=1;const $e=C[N[ke]*2+1];$e>G&&(G=$e);const Ve=T.charCodeAt(C[N[ke]*2]);(Ve===91||Ve===40)&&(X=!1)}let $=1;for(;$<j.length*2;)$<<=1;const Q=new Int32Array($).fill(-1);for(let ke=0;ke<j.length;ke++){const $e=C[N[ke]*2];let Ve=(I0(T,$e,$e+C[N[ke]*2+1])^Math.imul(j[ke],2654435761)|0)&$-1;for(;Q[Ve]!==-1;)Ve=Ve+1&$-1;Q[Ve]=ke}const K=(ke,$e,Ve,gt)=>{let Ot=(I0($e,Ve,gt)^Math.imul(ke,2654435761)|0)&$-1;const Tt=gt-Ve;for(;;){const $t=Q[Ot];if($t===-1)return-1;if(j[$t]===ke&&C[N[$t]*2+1]===Tt){const dn=C[N[$t]*2];let sn=!0;for(let St=0;St<Tt;St++)if(T.charCodeAt(dn+St)!==$e.charCodeAt(Ve+St)){sn=!1;break}if(sn)return S[$t]}Ot=Ot+1&$-1}},se=r.cacheSize??8192,P=r.prefix??e.prefix??"",U=P===""?"":P+":",Z=U.length,te=(z??[]).map(ke=>{throw new Error("cn: missing validator "+ke)}),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$/,de=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ne=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;let ee=0,W=-1,ce=-1,Re=-1,_e=-1;const Ne=ke=>ke>=97&&ke<=122||ke>=65&&ke<=90||ke>=48&&ke<=57||ke===95,Ae=ke=>/\s/.test(String.fromCharCode(ke)),J=(ke,$e,Ve)=>{if(ee=0,W=-1,Ve-$e<3)return;const gt=ke.charCodeAt($e),Ot=ke.charCodeAt(Ve-1);if(gt===91&&Ot===93)ee=1;else if(gt===40&&Ot===41)ee=2;else return;Re=$e+1,_e=Ve-1;let Tt=$e+1;if(Ne(ke.charCodeAt(Tt))){for(Tt++;Tt<Ve-1;){const $t=ke.charCodeAt(Tt);if(!Ne($t)&&$t!==45)break;Tt++}Tt<Ve-2&&ke.charCodeAt(Tt)===58&&(W=$e+1,ce=Tt,Re=Tt+1)}},re=(ke,$e,Ve,gt)=>{if(Ve-$e!==gt.length)return!1;for(let Ot=0;Ot<gt.length;Ot++)if(ke.charCodeAt($e+Ot)!==gt.charCodeAt(Ot))return!1;return!0},xe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,he=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Be=ke=>!!ke&&!Number.isNaN(Number(ke)),we=(ke,$e,Ve)=>{if(Ve-$e<11||!re(ke,$e,$e+10,"@container"))return!1;if(ke.charCodeAt($e+10)===47)return Ve-$e>=12;const gt=ke.charCodeAt($e+11);return gt===115&&Ve-$e>=17&&re(ke,$e+10,$e+16,"-size/")||gt===110&&Ve-$e>=19&&re(ke,$e+10,$e+18,"-normal/")},Ye=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Ee="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(ke=>ke.split(" ")),Ce=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],be=(ke,$e,Ve,gt)=>{if(ke>=10){if(ke>=25)return te[ke-25]($e.slice(Ve,gt));const Ot=ke-10;if(ee!==Ye[Ot])return!1;if(W>=0){for(const Tt of Ee[Ot])if(re($e,W,ce,Tt))return!0;return!1}switch(Ce[Ot]){case 0:return!1;case 1:return!0;case 2:{const Tt=$e.slice(Re,_e);return le.test(Tt)&&!de.test(Tt)}case 3:return Be($e.slice(Re,_e));case 4:return ne.test($e.slice(Re,_e));default:return oe.test($e.slice(Re,_e))}}switch(ke){case 0:return!0;case 1:return ee===0;case 2:return ee===1;case 3:return ee===2;case 4:return xe.test($e.slice(Ve,gt));case 5:return Be($e.slice(Ve,gt));case 6:{const Ot=$e.slice(Ve,gt);return!!Ot&&Number.isInteger(Number(Ot))}case 7:return gt>Ve&&$e.charCodeAt(gt-1)===37&&Be($e.slice(Ve,gt-1));case 8:return he.test($e.slice(Ve,gt));default:return we($e,Ve,gt)}},Ue=new Set(typeof _=="string"?_.split(" "):_),Je=(ke,$e,Ve,gt,Ot,Tt)=>{const $t=I0($e,Ve,gt)^(Ot?2654435769:0)|0;let dn=ke.get($t);if(dn!==void 0)e:for(let Mt=0;Mt<dn.length;Mt++){const en=dn[Mt];if(!(en.imp!==Ot||en.k.length!==gt-Ve)){for(let wt=0;wt<en.k.length;wt++)if(en.k.charCodeAt(wt)!==$e.charCodeAt(Ve+wt))continue e;return en.id}}else ke.set($t,dn=[]);const sn=$e.slice(Ve,gt),St=Tt(sn);return dn.push({k:sn,imp:Ot,id:St}),St};let dt=new Map,lt=new Map,Ie=2;const ot=4096,We=(ke,$e)=>{const Ve=[];let gt=0,Ot=0,Tt=0;for(let St=0;St<ke.length;St++){const Mt=ke.charCodeAt(St);gt===0&&Ot===0&&Mt===58?(Ve.push(ke.slice(Tt,St)),Tt=St+1):Mt===91?gt++:Mt===93?gt--:Mt===40?Ot++:Mt===41&&Ot--}Ve.push(ke.slice(Tt));let $t=Ve[0];if(Ve.length>1){const St=[];let Mt=[];for(const en of Ve)en.charCodeAt(0)===91||Ue.has(en)?(Mt.length&&(St.push(...Mt.sort()),Mt=[]),St.push(en)):Mt.push(en);Mt.length&&St.push(...Mt.sort()),$t=St.join(":")}const dn=$e?$t+" !":$t;let sn=lt.get(dn);return sn===void 0&<.set(dn,sn=Ie++),sn};let me=new Map,Oe=a;const Me=a+4096,nt=()=>Oe++,Ge=2097152,qe=8192,ht=new Int32Array(qe),pe=new Array(qe).fill(null),De=new Int32Array(qe),Qe=new Int32Array(qe),Fe=new Uint8Array(qe);let yt=0;const Et=(ke,$e,Ve,gt,Ot,Tt,$t,dn)=>{let sn=ke;if(pe[ke]!==null)if(pe[ke|1]===null)sn=ke|1;else if((yt++&3)===0)sn=ke|yt>>2&1;else return;pe[sn]=$e.slice(Ve,gt),ht[sn]=Ot,De[sn]=Tt,Qe[sn]=$t,Fe[sn]=dn},Nt=()=>pe.fill(null);let Vt=256,Ct=[new Int32Array(Vt),new Int32Array(Vt),new Int32Array(Vt),new Int32Array(Vt)],[ct,vt,ae,Xe]=Ct,ut=new Uint8Array(Vt),Ft=new Uint8Array(Vt);const An=()=>{Vt*=2,Ct=Ct.map($e=>{const Ve=new Int32Array(Vt);return Ve.set($e),Ve}),[ct,vt,ae,Xe]=Ct;const ke=new Uint8Array(Vt);ke.set(ut),ut=ke,Ft=new Uint8Array(Vt)};let zt=64,_t=new Int32Array(zt),On=new Int32Array(zt);const io=new Int32Array(a);let vs=2048,Lr=21,$s=new Float64Array(vs),cr=new Int32Array(vs),Gn=0;const To=(ke,$e)=>{if(ke===0&&$e<a)return io[$e]===Gn?1:(io[$e]=Gn,0);const Ve=ke*2097152+$e+1;let gt=Math.imul(Ve,2654435761)>>>Lr;for(;cr[gt]===Gn;){if($s[gt]===Ve)return 1;gt=gt+1&vs-1}return $s[gt]=Ve,cr[gt]=Gn,0},Fi=(ke,$e,Ve,gt,Ot)=>{if(Ve-$e>=2&&ke.charCodeAt($e)===91&&ke.charCodeAt(Ve-1)===93){let Tt=-1;for(let $t=$e+1;$t<Ve-1;$t++)if(ke.charCodeAt($t)===58){Tt=$t;break}return Tt===-1||Tt===$e+1?$o:Je(me,ke,$e+1,Tt,0,nt)}if(gt>=0&&m[gt]>=0)return m[gt];for(let Tt=Ot-1;Tt>=0;Tt--){const $t=On[Tt];if($t>Ve)continue;const dn=_t[Tt],sn=Ve-$t;if(V[dn]===1&&sn>0&&sn<=G){const Pn=ke.charCodeAt($t);if(X===!1||Pn!==91&&Pn!==40){const dr=K(dn,ke,$t,Ve);if(dr>=0)return dr}}const St=h[dn];if(St<0)continue;const Mt=x[St],en=g[Mt],wt=g[Mt+1];if(en===wt)continue;J(ke,$t,Ve);const ns=L[St]-en;for(let Pn=en;Pn<wt;Pn++)if(be(p[Pn],ke,$t,Ve))return v[ns+Pn]}return $o},qa=ke=>{const $e=ke.length;let Ve=0,gt=0,Ot=!1;(Ie>ot||dt.size>ot)&&(dt=new Map,lt=new Map,Ie=2,Nt()),Oe>Me&&(me=new Map,Oe=a,Nt());let Tt=0;for(;Tt<$e;){let St=ke.charCodeAt(Tt);if(St===32||St>=9&&St<=13||St>=160&&Ae(St)){St!==32&&(Ot=!0),Tt++;continue}const Mt=Tt;let en=0;for(;Tt<$e;){if(St=ke.charCodeAt(Tt),St<=32){if(St===32)break;if(St>=9&&St<=13){Ot=!0;break}}else if(St>=160&&Ae(St)){Ot=!0;break}en=Math.imul(en^St,16777619),Tt++}const wt=Tt,ns=wt-Mt;Ve===Vt&&An();const Pn=Ve++;ct[Pn]=Mt,vt[Pn]=wt,gt+=ns,en^=Math.imul(ns,2654435761);const dr=en^en>>>15|0,Xn=dr&8190;{let Qt=-1;if(ht[Xn]===dr&&pe[Xn]!==null&&pe[Xn].length===ns?Qt=Xn:ht[Xn|1]===dr&&pe[Xn|1]!==null&&pe[Xn|1].length===ns&&(Qt=Xn|1),Qt>=0){const hs=pe[Qt];let Vr=!0;for(let hr=0;hr<ns;hr++)if(hs.charCodeAt(hr)!==ke.charCodeAt(Mt+hr)){Vr=!1;break}if(Vr){ae[Pn]=De[Qt],Xe[Pn]=Qe[Qt],ut[Pn]=Fe[Qt];continue}}}let Wn=Mt;if(Z!==0){if(wt-Mt<=Z||!ke.startsWith(U,Mt)){ae[Pn]=$o,Et(Xn,ke,Mt,wt,dr,$o,0,0);continue}Wn=Mt+Z}let sc=0,Ru=0,sa=-1,rc=-1;for(let Qt=Wn;Qt<wt;Qt++){const hs=ke.charCodeAt(Qt);if(sc===0&&Ru===0){if(hs===58){sa=Qt;continue}if(hs===47){rc=Qt;continue}}hs===91?sc++:hs===93?sc--:hs===40?Ru++:hs===41&&Ru--}const Vf=sa>=Wn?sa+1:Wn;let kn=Vf,Ms=wt,Ka=!1,oc=0;Ms>kn&&ke.charCodeAt(Ms-1)===33?(Ka=!0,Ms--):Ms>kn&&ke.charCodeAt(kn)===33&&(Ka=!0,kn++,oc=1);let Xs=-1;rc>Vf&&(Xs=rc+oc,Xs>=Ms&&(Xs=-1));let ac=kn;Ms-kn>1&&ke.charCodeAt(kn)===45&&(ac=kn+1);let fr=0,Bs=0,Xa=0,Au=-1,mr=0;(h[0]>=0||V[0]===1)&&(_t[0]=0,On[0]=ac,mr=1);let Ki=wl,Ou=0;for(let Qt=ac;Qt<Ms;Qt++)if(Qt===Xs&&(Ki=Bs<Xa?wl:fr,Ou=mr),fr!==wl){const hs=ke.charCodeAt(Qt);let Vr=-1;if(Bs<Xa)u.charCodeAt(Bs)===hs?(Bs++,Bs===Xa&&(Vr=fr=Au)):fr=wl;else{const hr=l[fr],Qi=l[fr+1];let ra=wl;for(let Ss=hr;Ss<Qi;Ss++){const Zi=c[Ss];if(u.charCodeAt(Zi)===hs){c[Ss+1]-Zi===1?Vr=ra=f[Ss]:(Bs=Zi+1,Xa=c[Ss+1],Au=f[Ss],ra=fr);break}}fr=ra}if(Vr>=0&&(h[Vr]>=0||V[Vr]===1)&&Qt+1<Ms&&ke.charCodeAt(Qt+1)===45){if(mr===zt){zt*=2;const hr=new Int32Array(zt);hr.set(_t),_t=hr;const Qi=new Int32Array(zt);Qi.set(On),On=Qi}_t[mr]=Vr,On[mr]=Qt+2,mr++}}Xs===Ms&&(Ki=Bs<Xa?wl:fr,Ou=mr);const Mu=Bs<Xa?wl:fr;let js,Vs=!1;if(Xs>=0)if(Vs=!0,js=Fi(ke,kn,Xs,Ki,Ou),js!==$o&&js<a&&H[js]){const Qt=Fi(ke,kn,Ms,Mu,mr);Qt!==$o&&Qt!==js&&(js=Qt,Vs=!1)}else js===$o&&(js=Fi(ke,kn,Ms,Mu,mr),Vs=!1);else js=Fi(ke,kn,Ms,Mu,mr);let Xi=0,Wi=0;js===$o?ae[Pn]=$o:(Wi=Vs?1:0,Xi=Wn>=sa?Ka?1:0:Je(dt,ke,Wn,sa,Ka?1:0,Qt=>We(Qt,Ka)),ae[Pn]=js,ut[Pn]=Wi,Xe[Pn]=Xi),Et(Xn,ke,Mt,wt,dr,js,Xi,Wi)}if(Ve===0)return"";if(Ve===1)return ct[0]===0&&vt[0]===$e?ke:ke.slice(ct[0],vt[0]);if(Ve*I>vs){for(;Ve*I>vs;)vs<<=1,Lr--;$s=new Float64Array(vs),cr=new Int32Array(vs)}if(Ie>=Ge||Oe>=Ge)throw new Error("cn: too many distinct classes in one merge");Gn=Gn+1|0,Gn===0&&(io.fill(0),cr.fill(0),Gn=1);let $t=!1;for(let St=Ve-1;St>=0;St--){const Mt=ae[St];if(Mt===$o){Ft[St]=1;continue}const en=Xe[St];if(To(en,Mt)===1){Ft[St]=0,$t=!0;continue}if(Ft[St]=1,Mt<a){const wt=B[Mt];if(wt>=0)for(let ns=A[wt];ns<A[wt+1];ns++)To(en,R[ns]);if(ut[St]&1)for(let ns=0;ns<M.length;ns++)M[ns]===Mt&&To(en,E[ns])}}if(!$t&&!Ot&&$e===gt+Ve-1)return ke;let dn="",sn=0;for(;sn<Ve;){if(!Ft[sn]){sn++;continue}const St=ct[sn];let Mt=vt[sn],en=sn+1;for(;en<Ve&&Ft[en]&&ct[en]===Mt+1&&ke.charCodeAt(Mt)===32;)Mt=vt[en],en++;dn.length>0&&(dn+=" "),dn+=ke.slice(St,Mt),sn=en}return dn},$r=16384,Br=new Int32Array($r*2);let Gi=0,qn=1,zn=Object.create(null),ws=Object.create(null),ur=new Map,Eu=new Map,Jl=0,ec=0;const Ya=()=>{Gi^=$r,qn=qn+1|0,ec=0},qi=ke=>{let $e=zn[ke];if($e!==void 0)return $e;const Ve=_0(ke,0,ke.length),gt=(Ve&16383)+Gi,Ot=Br[gt]===(Ve^qn)||Br[gt^$r]===(Ve^qn-1);return Ot&&($e=ws[ke],$e!==void 0)?(zn[ke]=$e,$e):($e=qa(ke),Ot?(zn[ke]=$e,++Jl>se&&(Jl=0,ws=zn,zn=Object.create(null),Ya())):(Br[gt]=Ve^qn,++ec>$r&&Ya()),$e)},tc=ke=>{let $e=ur.get(ke);if($e!==void 0)return $e;const Ve=_0(ke,0,ke.length),gt=(Ve&16383)+Gi,Ot=Br[gt]===(Ve^qn)||Br[gt^$r]===(Ve^qn-1);return Ot&&($e=Eu.get(ke),$e!==void 0)?(ur.set(ke,$e),$e):($e=qa(ke),Ot?(ur.set(ke,$e),++Jl>se&&(Jl=0,Eu=ur,ur=new Map,Ya())):(Br[gt]=Ve^qn,++ec>$r&&Ya()),$e)},nc=ke=>{const $e=_0(ke,0,ke.length),Ve=($e&16383)+Gi;return Br[Ve]===($e^qn)||Br[Ve^$r]===($e^qn-1)?!0:(Br[Ve]=$e^qn,++ec>$r&&Ya(),!1)},lo=se===0?qa:_8?ke=>{const $e=ur.get(ke);return $e!==void 0?$e:tc(ke)}:qi;return{merge:function(){return arguments.length===1&&typeof arguments[0]=="string"?lo(arguments[0]):lo(B8.apply(null,arguments))},mergeString:lo,seenBefore:se===0?()=>!1:nc,mergeUncached:qa}},Cp=(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:Cp(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},$8=(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:Cp(l,t);c&&(r&&(r+=" "),r+=c)}return r},B8=function(){return $8(arguments,!1)},V8=(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=(x,v,j,S)=>{let N=0;if(v){if(v!==x.a0)return!1;N=1}if(j){if(j!==(N===0?x.a0:x.a1))return!1;N++}if(S){if(S!==(N===0?x.a0:N===1?x.a1:x.a2))return!1;N++}return N===x.t},h=(x,v)=>{const j=x.a;let S=0;for(let N=0;N<v.length;N++){const C=v[N];if(C){if(C!==j[S])return!1;S++}}return S===x.t},g=(x,v)=>{const j=x.length,S=f===null?null:f.n;if(!v){if(S!==null&&h(S,x))return f=S,S.r;if(f!==null&&f!==S&&h(f,x))return f.r}let N="",C=-1,T=0,k=!1;for(let M=0;M<j;M++){let E=x[M];if(E){if(typeof E!="string"){if(E=x[M]=Cp(E,!0),!E)continue;k=!0}C<0&&(N=E,C=M),T++}}if(T===0)return"";if(T===1)return e(N);if(k){if(S!==null&&h(S,x))return f=S,S.r;if(f!==null&&f!==S&&h(f,x))return f.r}let A=l.get(N);A===void 0&&(A=c.get(N),A!==void 0&&l.set(N,A));let R=null;if(A!==void 0)e:for(let M=0;M<A.length;M++){const E=A[M];if(E.t!==T)continue;const O=E.a;let z=1;for(let _=C+1;_<j;_++){const B=x[_];if(B&&B!==O[z++])continue e}R=E;break}if(R===null){let M=N;const E=[N];for(let O=C+1;O<j;O++){const z=x[O];z&&(M+=" "+z,E.push(z))}if(!r(M))return a(M);R={r:e(M),t:E.length,a0:E[0],a1:E[1],a2:E[2]??"",a:E,n:null},A===void 0&&l.set(N,A=[]),A.length>=256&&A.shift(),A.push(R),++u>1e3&&(u=0,c=l,l=new Map)}return f!==null&&f!==R&&(f.n=R),f=R,R.r},p=x=>Array.isArray(x)?g(x.slice(),!1):e(Cp(x,!0));return function(x,v,j){const S=arguments.length;if((S|1)===3){const T=f;if(T!==null){const k=T.n;if(k!==null&&m(k,x,v,j))return f=k,k.r;if(T!==k&&m(T,x,v,j))return T.r}return g([x,v,j],!0)}if(S===1)return typeof x=="string"?e(x):p(x);const N=f;if(N!==null){const T=N.n;if(T!==null){const k=T.a;let A=0,R=!0;for(let M=0;M<S;M++){const E=arguments[M];if(E){if(E!==k[A]){R=!1;break}A++}}if(R&&A===T.t)return f=T,T.r}if(N!==T){const k=N.a;let A=0,R=!0;for(let M=0;M<S;M++){const E=arguments[M];if(E){if(E!==k[A]){R=!1;break}A++}}if(R&&A===N.t)return N.r}}const C=[];for(let T=0;T<S;T++)C.push(arguments[T]);return g(C,!0)}},_C=L8(I8),ms=V8(_C.mergeString,_C);function U8({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:ms("w-full caption-bottom text-sm",e),...t})})}function H8({className:e,...t}){return s.jsx("thead",{"data-slot":"table-header",className:ms("[&_tr]:border-b",e),...t})}function F8({className:e,...t}){return s.jsx("tbody",{"data-slot":"table-body",className:ms("[&_tr:last-child]:border-0",e),...t})}function LC({className:e,...t}){return s.jsx("tr",{"data-slot":"table-row",className:ms("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function L0({className:e,...t}){return s.jsx("th",{"data-slot":"table-head",className:ms("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function Uc({className:e,...t}){return s.jsx("td",{"data-slot":"table-cell",className:ms("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function yu(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 Wd(e){return!e||!Number.isFinite(Date.parse(e))?"Not reported":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}const FA={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ng={...FA,position:"fixed",top:0,left:0},j1={...FA,position:"absolute"};function G8(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 q8="data-checked",Y8="data-unchecked";function GA(e){return{checked(t){return e.indeterminate?{}:t?{[q8]:""}:{[Y8]:""}},...ug}}const K8=b.createContext(void 0);function X8(){return b.useContext(K8)}const qA=b.createContext(void 0);function W8(){const e=b.useContext(qA);if(e===void 0)throw new Error(Jt(14));return e}const Q8="data-parent",Z8=b.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:x,onCheckedChange:v,parent:j=!1,readOnly:S=!1,render:N,required:C=!1,uncheckedValue:T,value:k,nativeButton:A=!1,style:R,...M}=t,{clearErrors:E}=dg(),{disabled:O,name:z,setDirty:_,setFilled:B,setFocused:q,setTouched:I,state:L,validationMode:H,validityData:F,validation:V}=bu(),G=l8(),{labelId:X,registerControlId:$,getDescriptionProps:Q}=pf(),K=X8(),se=(K==null?void 0:K.allValues)===void 0?void 0:K.parent,P=se!==void 0,U=O||G.disabled||(K==null?void 0:K.disabled)||f,Z=z??x,te=k??Z,le=fs(),de=(K==null?void 0:K.registerControlId)!==$,oe=gf({id:h||void 0,enabled:de}),ne=A?oe:le;let ee={};P&&(j?ee=se.getParentProps():te!==void 0&&(ee=se.getChildProps(te)));const{checked:W=a,indeterminate:ce=g,onCheckedChange:Re,..._e}=ee,Ne=K==null?void 0:K.value,Ae=b.useRef(null),{getButtonProps:J,buttonRef:re}=ao({disabled:U,native:A}),xe=(K==null?void 0:K.validation)??V,[he,Be]=oo({controlled:te!==void 0&&Ne!==void 0&&!j?Ne.includes(te):W,default:c,name:"Checkbox",state:"checked"}),we=P?!!W:he,Ye=P&&ce||g;vg(Ae,le,he,void 0,!K&&!U,x);const Ee=se==null?void 0:se.registerChildId,Ce=b.useRef(null),be=xe.registerInput,Ue=K?te:void 0,Je=b.useCallback(Me=>be(Me,{controlRef:Ae,value:Ue}),[be,Ue]),dt=no(p,Ce,j?void 0:Je),lt=wA(u,X,Ce,!A,oe);Ke(()=>{Ce.current&&(Ce.current.indeterminate=Ye),K||B(he)},[he,Ye,K,B]),vf(he,()=>{K||(E(Z),_(he!==F.initialValue),xe.change(he))});const Ie=Ks({checked:he,disabled:U,form:m,name:j?void 0:Z,id:A?void 0:oe,required:C,ref:dt,style:Z?j1:Ng,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Me){if(Me.nativeEvent.defaultPrevented)return;if(S){Me.preventDefault();return}const nt=Me.currentTarget.checked,Ge=bt(Er,Me.nativeEvent);if(v==null||v(nt,Ge),!Ge.isCanceled&&(Re==null||Re(nt,Ge),!Ge.isCanceled&&(Be(nt),te!==void 0&&K!==void 0&&!j&&!P))){const qe=nt?[...K.value,te]:K.value.filter(ht=>ht!==te);K.setValue(qe,Ge)}},onClick(Me){Me.stopPropagation()},onFocus(){var Me;(Me=Ae.current)==null||Me.focus()}},k!==void 0?{value:(K?he&&k:k)||""}:gn,Q,Me=>xe.getValidationProps(U,Me));b.useEffect(()=>{if(!se||te===void 0)return;const Me=se.disabledStatesRef.current;return Me.set(te,U),()=>{Me.delete(te)}},[se,U,te]);const ot=b.useMemo(()=>({...L,checked:we,disabled:U,readOnly:S,required:C,indeterminate:Ye}),[L,we,U,S,C,Ye]),We=GA(ot),me=jt("span",t,{state:ot,ref:[re,Ae,r],props:[{id:ne,role:"checkbox","aria-checked":Ye?"mixed":we,"aria-readonly":S||void 0,"aria-required":C||void 0,"aria-labelledby":lt,[Q8]:j?"":void 0,onFocus(){U||q(!0)},onBlur(){const Me=Ce.current;Me&&(I(!0),q(!1),H==="onBlur"&&xe.commit(K?Ne:Me.checked))},onKeyDown(Me){var Qe;if(Me.key!=="Enter"||(Me.preventBaseUIHandler(),Me.defaultPrevented))return;const nt=((Qe=Ce.current)==null?void 0:Qe.form)??null,Ge=Me.currentTarget,qe=Me.nativeEvent,ht=Me.preventDefault,pe=qe.preventDefault;let De=!1;Me.preventDefault=()=>{De=!0,ht.call(Me)},qe.preventDefault=()=>{De=!0,pe.call(qe)},pe.call(qe),xn(Ge).queueMicrotask(()=>{var Fe;Me.preventDefault=ht,qe.preventDefault=pe,De||(Fe=G8(nt))==null||Fe.click()})},onClick(Me){if(S||U)return;Me.preventDefault();const nt=Ce.current;nt&&Qc(nt,Me)}},M,_e,J,Q,Me=>xe.getValidationProps(U,Me)],stateAttributesMapping:We}),Oe=me.props.id;return Ke(()=>{if(!(!Ee||j||te===void 0||Oe===void 0))return Ee(te,Oe)},[Ee,j,te,Oe]),s.jsxs(qA.Provider,{value:ot,children:[me,!he&&!K&&Z&&!j&&T!==void 0&&s.jsx("input",{type:"hidden",form:m,name:Z,value:T,disabled:U}),s.jsx("input",{...Ie,suppressHydrationWarning:!0})]})}),J8=b.forwardRef(function(t,r){const{render:a,className:l,style:c,keepMounted:u=!1,...f}=t,m=W8(),h=m.checked||m.indeterminate,{mounted:g,transitionStatus:p,setMounted:x}=Fa(h),v=b.useRef(null),j={...m,transitionStatus:p};lr({batch:!0,enabled:!h,open:h,ref:v,onComplete(){h||x(!1)}});const N={...GA(m),...Ha},C=u||g,T=jt("span",t,{ref:[r,v],state:j,stateAttributesMapping:N,props:f});return C?T:null});function $l({className:e,...t}){return s.jsx(Z8,{"data-slot":"checkbox",className:ms("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(J8,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:s.jsx(Fn,{})})})}function e$(e){const t=b.useRef(!0);t.current&&(t.current=!1,e())}function t$(e){const[t,r]=b.useState({current:e,previous:null});return Object.is(e,t.current)||r({current:e,previous:t.current}),t.previous}function YA(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Ln(e){const t=ds(n$,e).current;return t.next=e,Ke(t.effect),t}function n$(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var $0={exports:{}},B0={};/**
|
|
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 $C;function s$(){if($C)return B0;$C=1;var e=lf();function t(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var r=typeof Object.is=="function"?Object.is:t,a=e.useState,l=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function f(p,x){var v=x(),j=a({inst:{value:v,getSnapshot:x}}),S=j[0].inst,N=j[1];return c(function(){S.value=v,S.getSnapshot=x,m(S)&&N({inst:S})},[p,v,x]),l(function(){return m(S)&&N({inst:S}),p(function(){m(S)&&N({inst:S})})},[p]),u(v),v}function m(p){var x=p.getSnapshot;p=p.value;try{var v=x();return!r(p,v)}catch{return!0}}function h(p,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return B0.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,B0}var BC;function KA(){return BC||(BC=1,$0.exports=s$()),$0.exports}var S1=KA(),V0={exports:{}},U0={};/**
|
|
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 VC;function r$(){if(VC)return U0;VC=1;var e=lf(),t=KA();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 U0.useSyncExternalStoreWithSelector=function(h,g,p,x,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 C(M){if(!T){if(T=!0,k=M,M=x(M),v!==void 0&&S.hasValue){var E=S.value;if(v(E,M))return A=E}return A=M}if(E=A,a(k,M))return E;var O=x(M);return v!==void 0&&v(E,O)?(k=M,E):(k=M,A=O)}var T=!1,k,A,R=p===void 0?null:p;return[function(){return C(g())},R===null?void 0:function(){return C(R())}]},[g,p,x,v]);var N=l(h,j[0],j[1]);return u(function(){S.hasValue=!0,S.value=N},[N]),m(N),N},U0}var UC;function o$(){return UC||(UC=1,V0.exports=r$()),V0.exports}var a$=o$();const Qy=[];let Zy;function i$(){return Zy}function l$(e){Qy.push(e)}function jf(e){const t=(r,a)=>{const l=ds(c$).current;let c;try{Zy=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{Zy=void 0}return c};return t.displayName=e.displayName||e.name,t}function N1(e){return b.forwardRef(jf(e))}function c$(){return{didInitialize:!1}}const u$=i1(19),d$=u$?m$:h$;function XA(e,t,r,a,l){return d$(e,t,r,a,l)}function f$(e,t,r,a,l){const c=b.useCallback(()=>t(e.getSnapshot(),r,a,l),[e,t,r,a,l]);return S1.useSyncExternalStore(e.subscribe,c,c)}l$({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()}}),S1.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function m$(e,t,r,a,l){const c=i$();if(!c)return f$(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 h$(e,t,r,a,l){return a$.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,r,a,l))}class p${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 XA(this,t,r,a,l)}}class vu extends p${constructor(t,r={},a){super(t),this.context=r,this.selectors=a}useSyncedValue(t,r){b.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){b.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 b.useDebugValue(t),XA(this,this.selectors[t],r,a,l)}useContextCallback(t,r){b.useDebugValue(t);const a=et(r??Tn);this.context[t]=a}useStateSetter(t){const r=b.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 qo(...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 g$(e,t){return t!=null&&!Ei(t)?0:typeof e=="function"?e():e}function Bl(e,t,r){const a=g$(e,r);return typeof a=="number"?a:a==null?void 0:a[t]}function HC(e){return typeof e=="function"?e():e}function WA(e,t){return t||e==="click"||e==="mousedown"}function x$(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}const QA=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new so,currentIdRef:{current:null},currentContextRef:{current:null}});function b$(e,t){e.current=t.current}function y$(e){const{children:t,delay:r,timeoutMs:a=0}=e,l=b.useRef(r),c=b.useRef(r),u=b.useRef(null),f=b.useRef(null),m=ts();return Ke(()=>{if(c.current=r,!u.current){l.current=r;return}l.current={open:Bl(l.current,"open"),close:Bl(r,"close")}},[r,u,l,c]),s.jsx(QA.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:u,timeoutMs:a,currentContextRef:f,timeout:m}),[a,m]),children:t})}function v$(e,t={open:!1}){const{open:r}=t,a="rootStore"in e?e.rootStore:e,l=a.useState("floatingId"),c=b.useContext(QA),{currentIdRef:u,delayRef:f,timeoutMs:m,initialDelayRef:h,currentContextRef:g,hasProvider:p,timeout:x}=c,[v,j]=b.useState(!1),S=b.useRef(r);return Ke(()=>{S.current=r},[r]),Ke(()=>{function N(){var C;(C=g.current)==null||C.setIsInstantPhase(!1),u.current=null,g.current=null,f.current=h.current,x.clear()}if(u.current&&!r&&u.current===l){if(j(!1),m){const C=l;return x.start(m,()=>{a.select("open")||u.current&&u.current!==C||N()}),()=>{(S.current||u.current!==C)&&x.clear()}}N()}},[r,l,u,f,m,h,g,x,a]),Ke(()=>{if(!r)return;const N=g.current,C=u.current;x.clear(),g.current={onOpenChange:a.setOpen,setIsInstantPhase:j},u.current=l,f.current={open:0,close:Bl(h.current,"close")},C!==null&&C!==l?(j(!0),N==null||N.setIsInstantPhase(!0),N==null||N.onOpenChange(!1,bt(Er))):(j(!1),N==null||N.setIsInstantPhase(!1))},[r,l,a,u,f,h,g,x]),Ke(()=>()=>{if(u.current===l){if(g.current=null,!S.current)return;u.current=null,b$(f,h),x.clear()}},[g,u,f,l,h,x]),b.useMemo(()=>({activeIdRef:u,hasProvider:p,delayRef:f,isInstantPhase:v}),[u,p,f,v])}const _i=b.forwardRef(function(t,r){const[a,l]=b.useState();Ke(()=>{kL&&Ua&&l("button")},[]);const c={tabIndex:0,role:a};return s.jsx("span",{...t,ref:r,style:Ng,"aria-hidden":a?void 0:!0,...c,"data-base-ui-focus-guard":""})});function Qd(e){return`data-base-ui-${e}`}let dh=0;function Hh(e,t={}){const{preventScroll:r=!1,sync:a=!1,shouldFocus:l}=t;cancelAnimationFrame(dh);function c(){l&&!l()||e==null||e.focus({preventScroll:r})}if(a)return c(),Tn;const u=requestAnimationFrame(c);return dh=u,()=>{dh===u&&(cancelAnimationFrame(u),dh=0)}}const H0={inert:new WeakMap,"aria-hidden":new WeakMap},FC="data-base-ui-inert",Jy={inert:new WeakSet,"aria-hidden":new WeakSet};let Nd=new WeakMap,F0=0;function w$(e){return Jy[e]}function ZA(e){return e?iu(e)?e.host:ZA(e.parentNode):null}const GC=(e,t)=>t.map(r=>{if(e.contains(r))return r;const a=ZA(r);return e.contains(a)?a:null}).filter(r=>r!=null),qC=e=>{const t=new Set;return e.forEach(r=>{let a=r;for(;a&&!t.has(a);)t.add(a),a=a.parentNode}),t},YC=(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 j$(e,t,r,a,{mark:l=!0}){let c=null;a?c="inert":r&&(c="aria-hidden");let u=null,f=null;const m=GC(t,e),h=l?YC(t,qC(m),new Set(m)):[],g=[],p=[];if(c){const x=H0[c],v=w$(c);f=v,u=x;const j=GC(t,Array.from(t.querySelectorAll("[aria-live]"))),S=m.concat(j);YC(t,qC(S),new Set(S)).forEach(C=>{const T=C.getAttribute(c),k=T!==null&&T!=="false",A=(x.get(C)||0)+1;x.set(C,A),g.push(C),A===1&&k&&v.add(C),k||C.setAttribute(c,c==="inert"?"":"true")})}return l&&h.forEach(x=>{const v=(Nd.get(x)||0)+1;Nd.set(x,v),p.push(x),v===1&&x.setAttribute(FC,"")}),F0+=1,()=>{u&&g.forEach(x=>{const j=(u.get(x)||0)-1;u.set(x,j),j||(!(f!=null&&f.has(x))&&c&&x.removeAttribute(c),f==null||f.delete(x))}),l&&p.forEach(x=>{const v=(Nd.get(x)||0)-1;Nd.set(x,v),v||x.removeAttribute(FC)}),F0-=1,F0||(H0.inert=new WeakMap,H0["aria-hidden"]=new WeakMap,Jy.inert=new WeakSet,Jy["aria-hidden"]=new WeakSet,Nd=new WeakMap)}}function KC(e,t={}){const{ariaHidden:r=!1,inert:a=!1,mark:l=!0}=t,c=Gt(e[0]).body;return j$(e,c,r,a,{mark:l})}const S$=500,JA=500,N$={style:{transition:"none"}},eO="data-base-ui-click-trigger",tO={fallbackAxisSide:"none"},C1={fallbackAxisSide:"end"},C$={clipPath:"inset(50%)",position:"fixed",top:0,left:0},nO=b.createContext(null),sO=()=>b.useContext(nO),k$=Qd("portal");function rO(e={}){const{ref:t,container:r,componentProps:a=gn,elementProps:l}=e,c=Ll(),u=sO(),f=u==null?void 0:u.portalNode,[m,h]=b.useState(null),[g,p]=b.useState(null),x=et(N=>{N!==null&&p(N)}),v=b.useRef(null);Ke(()=>{if(r===null){v.current&&(v.current=null,p(null),h(null));return}const N=(r&&(t1(r)?r:r.current))??f??document.body;if(N==null){v.current&&(v.current=null,p(null),h(null));return}v.current!==N&&(v.current=N,p(null),h(N))},[r,f]);const j=jt("div",a,{ref:[t,x],props:[{id:c,[k$]:""},l]}),S=m&&j?ro.createPortal(j,m):null;return{node:g,nodeId:b.isValidElement(j)?j.props.id:void 0,subtree:S}}const Cg=b.forwardRef(function(t,r){const{render:a,className:l,style:c,children:u,container:f,portalOwnerRole:m,...h}=t,{node:g,nodeId:p,subtree:x}=rO({container:f,ref:r,componentProps:t,elementProps:h}),v=b.useRef(null),j=b.useRef(null),S=b.useRef(null),N=b.useRef(null),[C,T]=b.useState(null),k=b.useRef(!1),A=C==null?void 0:C.modal,R=C==null?void 0:C.open,M=!!C&&!C.modal&&C.open&&!!g;b.useEffect(()=>{if(!g||A)return;function O(z){g&&z.relatedTarget&&Jc(z)&&(z.type==="focusin"?k.current&&(DC(g),k.current=!1):(a8(g),k.current=!0))}return qo(Lt(g,"focusin",O,!0),Lt(g,"focusout",O,!0))},[g,A]),Ke(()=>{!g||R!==!0||!k.current||(DC(g),k.current=!1)},[R,g]);const E=b.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:j,beforeInsideRef:S,afterInsideRef:N,portalNode:g,setFocusManagerState:T}),[g]);return s.jsxs(b.Fragment,{children:[x,s.jsxs(nO.Provider,{value:E,children:[M&&g&&s.jsx(_i,{"data-type":"outside",ref:v,onFocus:O=>{var z;if(Jc(O,g))(z=S.current)==null||z.focus();else{const _=C?C.domReference:null,B=PA(_);B==null||B.focus()}}}),M&&g&&s.jsx("span",{role:m,"aria-owns":p,style:C$}),g&&ro.createPortal(u,g),M&&g&&s.jsx(_i,{"data-type":"outside",ref:j,onFocus:O=>{var z;if(Jc(O,g))(z=N.current)==null||z.focus();else{const _=C?C.domReference:null,B=v1(_);B==null||B.focus(),C!=null&&C.closeOnFocusOut&&(C==null||C.onOpenChange(!1,bt(Pi,O.nativeEvent)))}}})]})]})});function oO(){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 k1{constructor(){tn(this,"nodesRef",{current:[]});tn(this,"events",oO())}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 aO=b.createContext(null),iO=b.createContext(null),Bi=()=>{var e;return((e=b.useContext(aO))==null?void 0:e.id)||null},Vi=e=>{const t=b.useContext(iO);return e??t};function T1(e){const t=Ll(),r=Vi(e),a=Bi();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 lO(e){const{children:t,id:r}=e,a=Bi();return s.jsx(aO.Provider,{value:b.useMemo(()=>({id:r,parentId:a}),[r,a]),children:t})}function cO(e){const{children:t,externalTree:r}=e,a=ds(()=>r??new k1).current;return s.jsx(iO.Provider,{value:a,children:t})}function T$(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 XC=20;let Ti=[];function E1(){Ti=Ti.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function WC(e){E1(),e&&Os(e)!=="body"&&(Ti.push(new WeakRef(e)),Ti.length>XC&&(Ti=Ti.slice(-XC)))}function QC(){var e;return E1(),(e=Ti[Ti.length-1])==null?void 0:e.deref()}function E$(e){return e?y1(e)?e:bf(e)[0]||e:null}function ZC(e){var l;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!((l=e.getAttribute("role"))!=null&&l.includes("dialog")))return;const r=DA(e).filter(c=>{const u=c.getAttribute("data-tabindex")||"";return y1(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 kg(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:x,externalTree:v,getInsideElements:j}=e,S="rootStore"in t?t.rootStore:t,N=S.useState("open"),C=S.useState("domReferenceElement"),T=S.useState("floatingElement"),{events:k,dataRef:A}=S.context,R=et(()=>{var ee;return(ee=A.current.floatingContext)==null?void 0:ee.nodeId}),M=l===!1,E=Fy(C)&&M,O=Ln(l),z=Ln(c),_=Ln(h),B=Ln(N),q=Vi(v),I=sO(),L=b.useRef(!1),H=b.useRef(!1),F=b.useRef(!1),V=b.useRef(null),G=b.useRef(""),X=b.useRef(""),$=b.useRef(null),Q=b.useRef(null),K=no($,x,I==null?void 0:I.beforeInsideRef),se=no(Q,I==null?void 0:I.afterInsideRef),P=ts(),U=ts(),Z=cu(),te=I!=null,le=jp(T),de=et((ee=le)=>ee?bf(ee):[]),oe=et(()=>(j==null?void 0:j().filter(ee=>ee!=null))??[]);b.useEffect(()=>{if(a||!f)return;function ee(ce){ce.key==="Tab"&&pt(le,Ps(Gt(le)))&&de().length===0&&!E&&Ho(ce)}const W=Gt(le);return Lt(W,"keydown",ee)},[a,le,f,E,de]),b.useEffect(()=>{if(a||!N)return;const ee=Gt(le);function W(){F.current=!1}function ce(_e){const Ne=As(_e),Ae=oe(),J=pt(T,Ne)||pt(C,Ne)||pt(I==null?void 0:I.portalNode,Ne)||Ae.some(re=>re===Ne||pt(re,Ne));F.current=!J,X.current=_e.pointerType||"keyboard",Ne!=null&&Ne.closest(`[${eO}]`)&&(H.current=!0,U.start(0,()=>{H.current=!1}))}function Re(){X.current="keyboard"}return qo(Lt(ee,"pointerdown",ce,!0),Lt(ee,"pointerup",W,!0),Lt(ee,"pointercancel",W,!0),Lt(ee,"keydown",Re,!0),W)},[a,T,C,le,N,I,U,oe]),b.useEffect(()=>{if(a||!m)return;const ee=Gt(le);function W(){H.current=!0,U.start(0,()=>{H.current=!1})}function ce(Ae){const J=As(Ae);y1(J)&&(V.current=J)}function Re(Ae){const J=Ae.relatedTarget,re=Ae.currentTarget,xe=As(Ae);f&&J==null&&xe!=null&&pt(T,xe)&&WC(xe),queueMicrotask(()=>{const he=R(),Be=S.context.triggerElements,we=oe(),Ye=(J==null?void 0:J.hasAttribute(Qd("focus-guard")))&&[$.current,Q.current,I==null?void 0:I.beforeInsideRef.current,I==null?void 0:I.afterInsideRef.current,I==null?void 0:I.beforeOutsideRef.current,I==null?void 0:I.afterOutsideRef.current,ba(p),ba(g)].includes(J),Ee=!(pt(C,J)||pt(T,J)||pt(J,T)||pt(I==null?void 0:I.portalNode,J)||we.some(Ce=>Ce===J||pt(Ce,J))||Be.hasMatchingElement(Ce=>pt(Ce,J))||Ye||q&&(Di(q.nodesRef.current,he).find(Ce=>{var be,Ue;return pt((be=Ce.context)==null?void 0:be.elements.floating,J)||pt((Ue=Ce.context)==null?void 0:Ue.elements.domReference,J)})||AC(q.nodesRef.current,he).find(Ce=>{var be,Ue,Je;return[(be=Ce.context)==null?void 0:be.elements.floating,jp((Ue=Ce.context)==null?void 0:Ue.elements.floating)].includes(J)||((Je=Ce.context)==null?void 0:Je.elements.domReference)===J})));if(re===C&&le&&ZC(le),u&&re!==C&&!yg(xe)&&Ps(ee)===ee.body){if(cn(le)&&(le.focus(),u==="popup")){Z.request(()=>{le.focus()});return}const Ce=de(),be=V.current,Ue=(be&&Ce.includes(be)?be:null)||Ce[Ce.length-1]||le;cn(Ue)&&Ue.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(E||!f)&&J&&Ee&&!H.current&&(E||J!==QC())&&(L.current=!0,S.setOpen(!1,bt(Pi,Ae)))})}function _e(){F.current||(A.current.insideReactTree=!0,P.start(0,()=>{A.current.insideReactTree=!1}))}const Ne=cn(C)?C:null;if(!(!T&&!Ne))return qo(Ne&&Lt(Ne,"focusout",Re),Ne&&Lt(Ne,"pointerdown",W),T&&Lt(T,"focusin",ce),T&&Lt(T,"focusout",Re),T&&I&&Lt(T,"focusout",_e,!0))},[a,C,T,le,f,q,I,S,m,u,de,E,R,A,P,U,Z,g,p,oe]),b.useEffect(()=>{var re,xe,he;if(a||!T||!N)return;const ee=Array.from(((re=I==null?void 0:I.portalNode)==null?void 0:re.querySelectorAll(`[${Qd("portal")}]`))||[]),ce=(he=(xe=(q?AC(q.nodesRef.current,R()):[]).find(Be=>{var we;return Fy(((we=Be.context)==null?void 0:we.elements.domReference)||null)}))==null?void 0:xe.context)==null?void 0:he.elements.domReference,_e=[...[T,...ee,$.current,Q.current,I==null?void 0:I.beforeOutsideRef.current,I==null?void 0:I.afterOutsideRef.current,...oe()],ce,ba(p),ba(g),E?C:null].filter(Be=>Be!=null),Ne=KC(_e,{ariaHidden:f||E,mark:!1}),Ae=[T,...ee].filter(Be=>Be!=null),J=KC(Ae);return()=>{J(),Ne()}},[N,a,C,T,f,I,E,q,R,g,p,oe]),Ke(()=>{if(!N||a||!cn(le))return;G.current="",X.current="";const ee=Gt(le),W=Ps(ee);queueMicrotask(()=>{const ce=O.current,Re=typeof ce=="function"?ce(_.current||""):ce;if(Re===void 0||Re===!1||pt(le,W))return;let Ne=null;const Ae=()=>(Ne==null&&(Ne=de(le)),Ne[0]||le);let J;Re===!0||Re===null?J=Ae():J=ba(Re),J=J||Ae();const re=pt(le,Ps(ee));Hh(J,{preventScroll:J===le,shouldFocus(){if(!B.current)return!1;if(re)return!0;const xe=Ps(ee);return!(xe!==J&&pt(le,xe))}})})},[a,N,le,de,O,_,B]),Ke(()=>{if(a||!le)return;const ee=Gt(le),W=Ps(ee),ce=_.current==null;WC(W);function Re(Ne){if(Ne.open||(G.current=T$(Ne.nativeEvent,X.current)),Ne.reason===Hn&&Ne.nativeEvent.type==="mouseleave"&&(L.current=!0),Ne.reason===wg)if(Ne.nested)L.current=!1;else if(bg(Ne.nativeEvent)||p1(Ne.nativeEvent))L.current=!1;else{let Ae=!1;Gt(le).createElement("div").focus({get preventScroll(){return Ae=!0,!1}}),Ae?L.current=!1:L.current=!0}}k.on("openchange",Re);function _e(Ne){const Ae=z.current;let J=typeof Ae=="function"?Ae(Ne):Ae;if(J===void 0||J===!1)return null;J===null&&(J=!0);const re=C!=null&&C.isConnected?C:null,xe=W!=null&&W.isConnected&&Os(W)!=="body"?W:null;let he=ce?xe||re:re||xe;return he||(he=QC()||null),typeof J=="boolean"?he:ba(J)||he||null}return()=>{k.off("openchange",Re);const Ne=Ps(ee),Ae=oe(),J=pt(T,Ne)||Ae.some(Be=>Be===Ne||pt(Be,Ne))||q&&Di(q.nodesRef.current,R(),!1).some(Be=>{var we;return pt((we=Be.context)==null?void 0:we.elements.floating,Ne)}),re=z.current,xe=G.current,he=_e(xe);queueMicrotask(()=>{const Be=E$(he),we=typeof re!="boolean";if(re&&!L.current&&cn(Be)&&(!(!we&&Be!==Ne&&Ne!==ee.body)||J)){const Ye={preventScroll:!0};xe==="keyboard"&&(Ye.focusVisible=!0),Be.focus(Ye)}L.current=!1})}},[a,T,le,z,_,k,q,C,R,oe]),Ke(()=>{if(!Ua||N||!T)return;const ee=Ps(Gt(T));!cn(ee)||!xg(ee)||pt(T,ee)&&ee.blur()},[N,T]),Ke(()=>{if(!(a||!I))return I.setFocusManagerState({modal:f,closeOnFocusOut:m,open:N,onOpenChange:S.setOpen,domReference:C}),()=>{I.setFocusManagerState(null)}},[a,I,f,N,S,m,C]),Ke(()=>{if(!(a||!le))return ZC(le),()=>{queueMicrotask(E1)}},[a,le]);const ne=!a&&(f?!E:!0)&&(te||f);return s.jsxs(b.Fragment,{children:[ne&&s.jsx(_i,{"data-type":"inside",ref:K,onFocus:ee=>{var W;if(f){const ce=de();Hh(ce[ce.length-1])}else if(I!=null&&I.portalNode)if(L.current=!1,Jc(ee,I.portalNode)){const ce=v1(C);ce==null||ce.focus()}else(W=ba(p??I.beforeOutsideRef))==null||W.focus()}}),r,ne&&s.jsx(_i,{"data-type":"inside",ref:se,onFocus:ee=>{var W;if(f)Hh(de()[0]);else if(I!=null&&I.portalNode)if(m&&(L.current=!0),Jc(ee,I.portalNode)){const ce=PA(C);ce==null||ce.focus()}else(W=ba(g??I.afterOutsideRef))==null||W.focus()}})]})}function R1(e,t={}){const{enabled:r=!0,event:a="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:f=0,reason:m=Zo}=t,h="rootStore"in e?e.rootStore:e,g=h.context.dataRef,p=b.useRef(void 0),x=cu(),v=ts(),j=b.useMemo(()=>{function S(C,T,k,A){const R=bt(m,T,k);C&&A==="touch"&&f>0?v.start(f,()=>{h.setOpen(!0,R)}):h.setOpen(C,R)}function N(C,T,k){const A=g.current.openEvent,R=h.select("domReferenceElement")!==T;return C&&R||!C||!l?!0:A&&u?!k(A.type):!1}return{onPointerDown(C){p.current=Ei(C.pointerType,!0)&&p1(C.nativeEvent)?"virtual":C.pointerType},onMouseDown(C){const T=p.current,k=C.nativeEvent,A=h.select("open");if(C.button!==0||a==="click"||Ei(T,!0)&&c)return;const R=N(A,C.currentTarget,O=>O==="click"||O==="mousedown"),M=As(k);if(xg(M)){S(R,k,M,T);return}const E=C.currentTarget;x.request(()=>{S(R,k,E,T)})},onClick(C){if(a==="mousedown-only")return;const T=p.current;if(a==="mousedown"&&T){p.current=void 0;return}if(Ei(T,!0)&&c)return;const k=h.select("open"),A=N(k,C.currentTarget,R=>R==="click"||R==="mousedown"||R==="keydown"||R==="keyup");S(A,C.nativeEvent,C.currentTarget,T)},onKeyDown(){p.current=void 0}}},[g,a,c,m,h,u,l,x,v,f]);return b.useMemo(()=>r?{reference:j}:gn,[r,j])}function R$(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,x=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,x-=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,x=f&&t.y!=null?t.y:x):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:x,top:x,right:p+h,bottom:x+g,left:p}}}}function JC(e){return e!=null&&e.clientX!=null}function A$(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=b.useRef(!1),g=b.useRef(null),[p,x]=b.useState(),[v,j]=b.useState([]),S=et(A=>{l.set("positionReference",A)}),N=et((A,R,M)=>{h.current||m.current.openEvent&&!JC(m.current.openEvent)||l.set("positionReference",R$(M??f,{x:A,y:R,axis:a,dataRef:m,pointerType:p}))}),C=et(A=>{c?g.current||(N(A.clientX,A.clientY,A.currentTarget),j([])):N(A.clientX,A.clientY,A.currentTarget)}),T=Ei(p)?u:c;b.useEffect(()=>{if(!r){S(f);return}if(!T)return;function A(){var E;(E=g.current)==null||E.call(g),g.current=null}const R=xn(u);function M(E){const O=As(E);pt(u,O)?A():N(E.clientX,E.clientY)}return!m.current.openEvent||JC(m.current.openEvent)?g.current=Lt(R,"mousemove",M):S(f),A},[T,r,u,m,f,l,N,S,v]),b.useEffect(()=>()=>{l.set("positionReference",null)},[l]),b.useEffect(()=>{r&&!u&&(h.current=!1)},[r,u]),b.useEffect(()=>{!r&&c&&(h.current=!0)},[r,c]);const k=b.useMemo(()=>{function A(R){x(R.pointerType)}return{onPointerDown:A,onPointerEnter:A,onMouseMove:C,onMouseEnter:C}},[C]);return b.useMemo(()=>r?{reference:k,trigger:k}:{},[r,k])}function O$(){return!1}function M$(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 Sf(e,t={}){const{enabled:r=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:u=O$,bubbles:f,externalTree:m}=t,h="rootStore"in e?e.rootStore:e,g=h.useState("open"),p=h.useState("floatingElement"),{dataRef:x,events:v}=h.context,j=Vi(m),S=et(typeof l=="function"?l:()=>!1),N=typeof l=="function"?S:l,C=N!==!1,T=et(()=>c),{escapeKey:k,outsidePress:A}=M$(f),R=b.useRef(!1),M=b.useRef(!1),E=b.useRef(!1),O=b.useRef(!1),z=b.useRef(!1),_=b.useRef(""),B=b.useRef(null),q=ts(),I=ts(),L=et(()=>{I.clear(),x.current.insideReactTree=!1}),H=et(P=>{var te;const U=(te=x.current.floatingContext)==null?void 0:te.nodeId;return(j?Di(j.nodesRef.current,U):[]).some(le=>{var de;return((de=le.context)==null?void 0:de.open)&&!le.context.dataRef.current[P]})}),F=et(P=>z0(P,h.select("floatingElement"))||z0(P,h.select("domReferenceElement"))),V=et(P=>{u()&&h.setOpen(!1,bt(Zo,P.nativeEvent))}),G=et(P=>{if(!g||!r||!a||P.key!=="Escape"||z.current||!k&&H("__escapeKeyBubbles"))return;const U=UL(P)?P.nativeEvent:P,Z=bt(wf,U);h.setOpen(!1,Z),Z.isCanceled||P.preventDefault(),!k&&!Z.isPropagationAllowed&&P.stopPropagation()}),X=et(()=>{x.current.insideReactTree=!0,I.start(0,L)}),$=et(P=>{if(!g||!r||P.button!==0)return;const U=As(P.nativeEvent);pt(h.select("floatingElement"),U)&&(R.current||(R.current=!0,M.current=!1))}),Q=et(P=>{!g||!r||(P.defaultPrevented||P.nativeEvent.defaultPrevented)&&R.current&&(M.current=!0)});b.useEffect(()=>{function P(U){U.open||(O.current=!1)}return v.on("openchange",P),()=>{v.off("openchange",P)}},[v]),b.useEffect(()=>{if(!g||!r)return g||(O.current=!1),L;x.current.__escapeKeyBubbles=k,x.current.__outsidePressBubbles=A;const P=new so,U=new so,Z=Gt(p);function te(){P.clear(),z.current=!0}function le(){P.start(Ua?5:0,()=>{z.current=!1})}function de(){E.current=!0,U.start(0,()=>{E.current=!1})}function oe(){R.current=!1,M.current=!1}function ne(){const Ee=_.current,Ce=Ee==="pen"||!Ee?"mouse":Ee,be=T(),Ue=typeof be=="function"?be():be;return typeof Ue=="string"?Ue:Ue[Ce]}function ee(Ee){const Ce=ne();return Ce==="intentional"&&Ee.type!=="click"||Ce==="sloppy"&&Ee.type==="click"}function W(Ee){var Ue;const Ce=(Ue=x.current.floatingContext)==null?void 0:Ue.nodeId,be=j&&Di(j.nodesRef.current,Ce).some(Je=>{var dt;return z0(Ee,(dt=Je.context)==null?void 0:dt.elements.floating)});return F(Ee)||be}function ce(Ee){if(ee(Ee)){Ee.type!=="click"&&!F(Ee)&&(U.clear(),E.current=!1),L();return}if(x.current.insideReactTree){L();return}const Ce=As(Ee),be=`[${Qd("inert")}]`,Ue=qt(Ce)?Ce.getRootNode():null,Je=Array.from((iu(Ue)?Ue:Gt(h.select("floatingElement"))).querySelectorAll(be)),dt=h.context.triggerElements;if(Ce&&(dt.hasElement(Ce)||dt.hasMatchingElement(Ie=>pt(Ie,Ce))))return;let lt=qt(Ce)?Ce:null;for(;lt&&!Ca(lt);){const Ie=Aa(lt);if(Ca(Ie)||!qt(Ie))break;lt=Ie}if(!(Je.length&&qt(Ce)&&!$L(Ce)&&!pt(Ce,h.select("floatingElement"))&&Je.every(Ie=>!pt(lt,Ie)))){if(cn(Ce)&&!("touches"in Ee)){const Ie=Ca(Ce),ot=kr(Ce),We=/auto|scroll/,me=Ie||We.test(ot.overflowX),Oe=Ie||We.test(ot.overflowY),Me=me&&Ce.clientWidth>0&&Ce.scrollWidth>Ce.clientWidth,nt=Oe&&Ce.clientHeight>0&&Ce.scrollHeight>Ce.clientHeight,Ge=ot.direction==="rtl",qe=nt&&(Ge?Ee.offsetX<=Ce.offsetWidth-Ce.clientWidth:Ee.offsetX>Ce.clientWidth),ht=Me&&Ee.offsetY>Ce.clientHeight;if(qe||ht)return}if(!W(Ee)){if(ne()==="intentional"){if(Ee.detail!==0&&!bg(Ee)&&!O.current)return;if(E.current){U.clear(),E.current=!1;return}}typeof N=="function"&&!N(Ee)||H("__outsidePressBubbles")||(h.setOpen(!1,bt(wg,Ee)),L())}}}function Re(Ee){ne()!=="sloppy"||Ee.pointerType==="touch"||!h.select("open")||!r||F(Ee)||ce(Ee)}function _e(Ee){if(ne()!=="sloppy"||!h.select("open")||!r||F(Ee))return;const Ce=Ee.touches[0];Ce&&(B.current={startTime:Date.now(),startX:Ce.clientX,startY:Ce.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},q.start(1e3,()=>{B.current&&(B.current.dismissOnTouchEnd=!1,B.current.dismissOnMouseDown=!1)}))}function Ne(Ee,Ce){const be=As(Ee);if(!be)return;const Ue=Lt(be,Ee.type,()=>{Ce(Ee),Ue()})}function Ae(Ee){_.current="touch",Ne(Ee,_e)}function J(Ee){q.clear(),Ee.type==="pointerdown"&&(Ee.button===0&&(O.current=!0),_.current=Ee.pointerType),!(Ee.type==="mousedown"&&B.current&&!B.current.dismissOnMouseDown)&&Ne(Ee,Ce=>{Ce.type==="pointerdown"?Re(Ce):ce(Ce)})}function re(Ee){if(Ee.type==="pointercancel"&&(O.current=!1),!R.current)return;const Ce=M.current;if(oe(),ne()==="intentional"){if(Ee.type==="pointercancel"){Ce&&de();return}if(!W(Ee)){if(Ce){de();return}typeof N=="function"&&!N(Ee)||(U.clear(),E.current=!0,L())}}}function xe(Ee){if(ne()!=="sloppy"||!B.current||F(Ee))return;const Ce=Ee.touches[0];if(!Ce)return;const be=Math.abs(Ce.clientX-B.current.startX),Ue=Math.abs(Ce.clientY-B.current.startY),Je=Math.sqrt(be*be+Ue*Ue);Je>5&&(B.current.dismissOnTouchEnd=!0),Je>10&&(ce(Ee),q.clear(),B.current=null)}function he(Ee){Ne(Ee,xe)}function Be(Ee){ne()!=="sloppy"||!B.current||F(Ee)||(B.current.dismissOnTouchEnd&&ce(Ee),q.clear(),B.current=null)}function we(Ee){Ne(Ee,Be)}const Ye=qo(a&&qo(Lt(Z,"keydown",G),Lt(Z,"compositionstart",te),Lt(Z,"compositionend",le)),C&&qo(Lt(Z,"click",J,!0),Lt(Z,"pointerdown",J,!0),Lt(Z,"pointerup",re,!0),Lt(Z,"pointercancel",re,!0),Lt(Z,"mousedown",J,!0),Lt(Z,"mouseup",re,!0),Lt(Z,"touchstart",Ae,{capture:!0,passive:!0}),Lt(Z,"touchmove",he,{capture:!0,passive:!0}),Lt(Z,"touchend",we,{capture:!0,passive:!0})));return()=>{Ye(),P.clear(),U.clear(),oe(),E.current=!1,L()}},[x,p,a,C,N,g,r,k,A,G,L,T,H,F,j,h,q]);const K=b.useMemo(()=>({onKeyDown:G,onPointerDown:V,onClick:V}),[G,V]),se=b.useMemo(()=>({onKeyDown:G,onPointerDown:Q,onMouseDown:Q,onClickCapture:X,onMouseDownCapture(P){X(),$(P)},onPointerDownCapture(P){X(),$(P)},onMouseUpCapture:X,onTouchEndCapture:X,onTouchMoveCapture:X}),[G,X,$,Q]);return b.useMemo(()=>r?{reference:K,floating:se,trigger:K}:{},[r,K,se])}function ek(e,t,r){let{reference:a,floating:l}=e;const c=Zr(t),u=b1(t),f=x1(u),m=eo(t),h=c==="y",g=a.x+a.width/2-l.width/2,p=a.y+a.height/2-l.height/2,x=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=Oa(t);return j&&(v[u]+=x*(j==="end"?1:-1)*(r&&h?-1:1)),v}async function D$(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:x=!1,padding:v=0}=zi(t,e),j=kA(v),N=f[x?p==="floating"?"reference":"floating":p],C=Xd(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(N)))==null||r?N:N.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:h,rootBoundary:g,strategy:m})),T=p==="floating"?{x:a,y:l,width:u.floating.width,height:u.floating.height}:u.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),A=await(c.isElement==null?void 0:c.isElement(k))&&await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1},R=Xd(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:T,offsetParent:k,strategy:m}):T);return{top:(C.top-R.top+j.top)/A.y,bottom:(R.bottom-C.bottom+j.bottom)/A.y,left:(C.left-R.left+j.left)/A.x,right:(R.right-C.right+j.right)/A.x}}const z$=50,P$=async(e,t,r)=>{const{placement:a="bottom",strategy:l="absolute",middleware:c=[],platform:u}=r,f=u.detectOverflow?u:{...u,detectOverflow:D$},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}=ek(h,a,m),x=a,v=0;const j={};for(let S=0;S<c.length;S++){const N=c[S];if(!N)continue;const{name:C,fn:T}=N,{x:k,y:A,data:R,reset:M}=await T({x:g,y:p,initialPlacement:a,placement:x,strategy:l,middlewareData:j,rects:h,platform:f,elements:{reference:e,floating:t}});g=k??g,p=A??p,j[C]={...j[C],...R},M&&v<z$&&(v++,typeof M=="object"&&(M.placement&&(x=M.placement),M.rects&&(h=M.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:l}):M.rects),{x:g,y:p}=ek(h,x,m)),S=-1)}return{x:g,y:p,placement:x,strategy:l,middlewareData:j}},I$=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:x,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:S=!0,...N}=zi(e,t);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const C=eo(l),T=Zr(f),k=eo(f)===f,A=await(m.isRTL==null?void 0:m.isRTL(h.floating)),R=x||(k||!S?[Np(f)]:qL(f)),M=j!=="none";!x&&M&&R.push(...WL(f,S,j,A));const E=[f,...R],O=await m.detectOverflow(t,N),z=[];let _=((a=c.flip)==null?void 0:a.overflows)||[];if(g&&z.push(O[C]),p){const L=GL(l,u,A);z.push(O[L[0]],O[L[1]])}if(_=[..._,{placement:l,overflows:z}],!z.every(L=>L<=0)){var B,q;const L=(((B=c.flip)==null?void 0:B.index)||0)+1,H=E[L];if(H&&(!(p==="alignment"?T!==Zr(H):!1)||_.every(G=>Zr(G.placement)===T?G.overflows[0]>0:!0)))return{data:{index:L,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 I;const V=(I=_.filter(G=>{if(M){const X=Zr(G.placement);return X===T||X==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(X=>X>0).reduce((X,$)=>X+$,0)]).sort((G,X)=>G[1]-X[1])[0])==null?void 0:I[0];V&&(F=V);break}case"initialPlacement":F=f;break}if(l!==F)return{reset:{placement:F}}}return{}}}},uO=new Set(["left","top"]);async function _$(e,t){const{placement:r,platform:a,elements:l}=e,c=await(a.isRTL==null?void 0:a.isRTL(l.floating)),u=eo(r),f=Oa(r),m=Zr(r)==="y",h=uO.has(u)?-1:1,g=c&&m?-1:1,p=zi(t,e);let{mainAxis:x,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:x*h}:{x:x*h,y:v*g}}const L$=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 _$(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}}}}},$$=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:T=>{let{x:k,y:A}=T;return{x:k,y:A}}},...h}=zi(e,t),g={x:r,y:a},p=await c.detectOverflow(t,h),x=Zr(l),v=g1(x);let j=g[v],S=g[x];const N=(T,k)=>CA(k+p[T==="y"?"top":"left"],k,k-p[T==="y"?"bottom":"right"]);u&&(j=N(v,j)),f&&(S=N(x,S));const C=m.fn({...t,[v]:j,[x]:S});return{...C,data:{x:C.x-r,y:C.y-a,enabled:{[v]:u,[x]:f}}}}}},B$=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}=zi(e,t),x={x:l,y:c},v=Zr(u),j=g1(v);let S=x[j],N=x[v];const C=zi(h,t),T=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(r=C.mainAxis)!=null?r:0,crossAxis:(a=C.crossAxis)!=null?a:0};if(g){const R=j==="y"?"height":"width",M=f.reference[j]-f.floating[R]+T.mainAxis,E=f.reference[j]+f.reference[R]-T.mainAxis;S<M?S=M:S>E&&(S=E)}if(p){var k,A;const R=j==="y"?"width":"height",M=uO.has(eo(u)),E=f.reference[v]-f.floating[R]+(M&&((k=m.offset)==null?void 0:k[v])||0)+(M?0:T.crossAxis),O=f.reference[v]+f.reference[R]+(M?0:((A=m.offset)==null?void 0:A[v])||0)-(M?T.crossAxis:0);N<E?N=E:N>O&&(N=O)}return{[j]:S,[v]:N}}}},V$=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}=zi(e,t),m=await l.detectOverflow(t,f),h=eo(r),g=Oa(r),p=Zr(r)==="y",{width:x,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 N=v-m.top-m.bottom,C=x-m.left-m.right,T=lu(v-m[j],N),k=lu(x-m[S],C),A=t.middlewareData.shift,R=!A;let M=T,E=k;A!=null&&A.enabled.x&&(E=C),A!=null&&A.enabled.y&&(M=N),R&&!g&&(p?E=x-2*ka(m.left,m.right):M=v-2*ka(m.top,m.bottom)),await u({...t,availableWidth:E,availableHeight:M});const O=await l.getDimensions(c.floating);return x!==O.width||v!==O.height?{reset:{rects:!0}}:{}}}};function dO(e){const t=kr(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=Sp(r)!==c||Sp(a)!==u;return f&&(r=c,a=u),{width:r,height:a,$:f}}function A1(e){return qt(e)?e:e.contextElement}function tu(e){const t=A1(e);if(!cn(t))return Ta(1);const r=t.getBoundingClientRect(),{width:a,height:l,$:c}=dO(t);let u=(c?Sp(r.width):r.width)/a,f=(c?Sp(r.height):r.height)/l;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const U$=Ta(0);function fO(e){const t=xn(e);return!s1()||!t.visualViewport?U$:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function H$(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===xn(e)}function Vl(e,t,r,a){t===void 0&&(t=!1),r===void 0&&(r=!1);const l=e.getBoundingClientRect(),c=A1(e);let u=Ta(1);t&&(a?qt(a)&&(u=tu(a)):u=tu(e));const f=H$(c,r,a)?fO(c):Ta(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 x=xn(c),v=qt(a)?xn(a):a;let j=x,S=_y(j);for(;S&&v!==j;){const N=tu(S),C=S.getBoundingClientRect(),T=kr(S),k=C.left+(S.clientLeft+parseFloat(T.paddingLeft))*N.x,A=C.top+(S.clientTop+parseFloat(T.paddingTop))*N.y;m*=N.x,h*=N.y,g*=N.x,p*=N.y,m+=k,h+=A,j=xn(S),S=_y(j)}}return Xd({width:g,height:p,x:m,y:h})}function Tg(e,t){const r=ig(e).scrollLeft;return t?t.left+r:Vl(Va(e)).left+r}function mO(e,t){const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-Tg(e,r),l=r.top+t.scrollTop;return{x:a,y:l}}function F$(e){let{elements:t,rect:r,offsetParent:a,strategy:l}=e;const c=l==="fixed",u=Va(a),f=t?ag(t.floating):!1;if(a===u||f&&c)return r;let m={scrollLeft:0,scrollTop:0},h=Ta(1);const g=Ta(0),p=cn(a);if((p||!c)&&((Os(a)!=="body"||hf(u))&&(m=ig(a)),p)){const v=Vl(a);h=tu(a),g.x=v.x+a.clientLeft,g.y=v.y+a.clientTop}const x=u&&!p&&!c?mO(u,m):Ta(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-m.scrollLeft*h.x+g.x+x.x,y:r.y*h.y-m.scrollTop*h.y+g.y+x.y}}function G$(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function q$(e){const t=ig(e),r=e.ownerDocument.body,a=ka(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),l=ka(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let c=-t.scrollLeft+Tg(e);const u=-t.scrollTop;return kr(r).direction==="rtl"&&(c+=ka(e.clientWidth,r.clientWidth)-a),{width:a,height:l,x:c,y:u}}const Y$=25;function K$(e,t,r){r===void 0&&(r="viewport");const a=r==="layoutViewport",l=xn(e),c=Va(e),u=l.visualViewport;let f=c.clientWidth,m=c.clientHeight,h=0,g=0;if(u){const x=!s1()||t==="fixed";a?x||(h=-u.offsetLeft,g=-u.offsetTop):(f=u.width,m=u.height,x&&(h=u.offsetLeft,g=u.offsetTop))}if(Tg(c)<=0){const x=c.ownerDocument,v=x.body,j=getComputedStyle(v),S=x.compatMode==="CSS1Compat"&&parseFloat(j.marginLeft)+parseFloat(j.marginRight)||0,N=Math.abs(c.clientWidth-v.clientWidth-S),C=getComputedStyle(c).scrollbarGutter==="stable both-edges"?N/2:N;C<=Y$&&(f-=C)}return{width:f,height:m,x:h,y:g}}function X$(e,t){const r=Vl(e,!0,t==="fixed"),a=r.top+e.clientTop,l=r.left+e.clientLeft,c=tu(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 tk(e,t,r){let a;if(t==="viewport"||t==="layoutViewport")a=K$(e,r,t);else if(t==="document")a=q$(Va(e));else if(qt(t))a=X$(t,r);else{const l=fO(e);a={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return Xd(a)}function W$(e,t){const r=t.get(e);if(r)return r;let a=Yd(e,[],!1).filter(f=>qt(f)&&Os(f)!=="body"),l=null;const c=kr(e).position==="fixed";let u=c?Aa(e):e;for(;qt(u)&&!Ca(u);){const f=kr(u),m=n1(u),h=l?l.position:c?"fixed":"";!m&&(h==="fixed"||h==="absolute"&&f.position==="static")?a=a.filter(p=>p!==u):l=f,u=Aa(u)}return t.set(e,a),a}function Q$(e){let{element:t,boundary:r,rootBoundary:a,strategy:l}=e;const u=[...r==="clippingAncestors"?ag(t)?[]:W$(t,this._c):[].concat(r),a],f=tk(t,u[0],l);let m=f.top,h=f.right,g=f.bottom,p=f.left;for(let x=1;x<u.length;x++){const v=tk(t,u[x],l);m=ka(v.top,m),h=lu(v.right,h),g=lu(v.bottom,g),p=ka(v.left,p)}return{width:h-p,height:g-m,x:p,y:m}}function Z$(e){const{width:t,height:r}=dO(e);return{width:t,height:r}}function J$(e,t,r){const a=cn(t),l=Va(t),c=r==="fixed",u=Vl(e,!0,c,t);let f={scrollLeft:0,scrollTop:0};const m=Ta(0);if((a||!c)&&((Os(t)!=="body"||hf(l))&&(f=ig(t)),a)){const x=Vl(t,!0,c,t);m.x=x.x+t.clientLeft,m.y=x.y+t.clientTop}!a&&l&&(m.x=Tg(l));const h=l&&!a&&!c?mO(l,f):Ta(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 G0(e){return kr(e).position==="static"}function nk(e,t){if(!cn(e)||kr(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Va(e)===r&&(r=r.ownerDocument.body),r}function hO(e,t){const r=xn(e);if(ag(e))return r;if(!cn(e)){let l=Aa(e);for(;l&&!Ca(l);){if(qt(l)&&!G0(l))return l;l=Aa(l)}return r}let a=nk(e,t);for(;a&&F6(a)&&G0(a);)a=nk(a,t);return a&&Ca(a)&&G0(a)&&!n1(a)?r:a||Y6(e)||r}const eB=async function(e){const t=this.getOffsetParent||hO,r=this.getDimensions,a=await r(e.floating);return{reference:J$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function tB(e){return kr(e).direction==="rtl"}const pO={convertOffsetParentRelativeRectToViewportRelativeRect:F$,getDocumentElement:Va,getClippingRect:Q$,getOffsetParent:hO,getElementRects:eB,getClientRects:G$,getDimensions:Z$,getScale:tu,isElement:qt,isRTL:tB};function gO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nB(e,t,r){let a=null,l;const c=Va(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 x=e.getBoundingClientRect(),{left:v,top:j,width:S,height:N}=x;if(g||t(),!S||!N)return;const C=ih(j),T=ih(c.clientWidth-(v+S)),k=ih(c.clientHeight-(j+N)),A=ih(v),M={rootMargin:-C+"px "+-T+"px "+-k+"px "+-A+"px",threshold:ka(0,lu(1,p))||1};let E=!0;function O(z){const _=z[0].intersectionRatio;if(!gO(x,e.getBoundingClientRect()))return f();if(_!==p){if(!E)return f();_?f(!1,_):l=setTimeout(()=>{f(!1,1e-7)},1e3)}E=!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 sk(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=A1(e),g=l||c?[...h?Yd(h):[],...t?Yd(t):[]]:[];g.forEach(C=>{l&&C.addEventListener("scroll",r),c&&C.addEventListener("resize",r)});const p=h&&f?nB(h,r,c):null;let x=-1,v=null;u&&(v=new ResizeObserver(C=>{let[T]=C;T&&T.target===h&&v&&t&&(v.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var k;(k=v)==null||k.observe(t)})),r()}),h&&!m&&v.observe(h),t&&v.observe(t));let j,S=m?Vl(e):null;m&&N();function N(){const C=Vl(e);S&&!gO(S,C)&&r(),S=C,j=requestAnimationFrame(N)}return r(),()=>{var C;g.forEach(T=>{l&&T.removeEventListener("scroll",r),c&&T.removeEventListener("resize",r)}),p==null||p(),(C=v)==null||C.disconnect(),v=null,m&&cancelAnimationFrame(j)}}const sB=L$,rB=$$,oB=I$,aB=V$,iB=B$,lB=(e,t,r)=>{const a=new Map,l=r??{},c={...pO,...l.platform,_c:a};return P$(e,t,{...l,platform:c})};var cB=typeof document<"u",uB=function(){},Fh=cB?b.useLayoutEffect:uB;function kp(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(!kp(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)&&!kp(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function xO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rk(e,t){const r=xO(e);return Math.round(t*r)/r}function q0(e){const t=b.useRef(e);return Fh(()=>{t.current=e}),t}function dB(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]=b.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[x,v]=b.useState(a);kp(x,a)||v(a);const[j,S]=b.useState(null),[N,C]=b.useState(null),T=b.useCallback(G=>{G!==M.current&&(M.current=G,S(G))},[]),k=b.useCallback(G=>{G!==E.current&&(E.current=G,C(G))},[]),A=c||j,R=u||N,M=b.useRef(null),E=b.useRef(null),O=b.useRef(g),z=m!=null,_=q0(m),B=q0(l),q=q0(h),I=b.useCallback(()=>{if(!M.current||!E.current)return;const G={placement:t,strategy:r,middleware:x};B.current&&(G.platform=B.current),lB(M.current,E.current,G).then(X=>{const $={...X,isPositioned:q.current!==!1};L.current&&!kp(O.current,$)&&(O.current=$,ro.flushSync(()=>{p($)}))})},[x,t,r,B,q]);Fh(()=>{h===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(G=>({...G,isPositioned:!1})))},[h]);const L=b.useRef(!1);Fh(()=>(L.current=!0,()=>{L.current=!1}),[]),Fh(()=>{if(A&&(M.current=A),R&&(E.current=R),A&&R){if(_.current)return _.current(A,R,I);I()}},[A,R,I,_,z]);const H=b.useMemo(()=>({reference:M,floating:E,setReference:T,setFloating:k}),[T,k]),F=b.useMemo(()=>({reference:A,floating:R}),[A,R]),V=b.useMemo(()=>{const G={position:r,left:0,top:0};if(!F.floating)return G;const X=rk(F.floating,g.x),$=rk(F.floating,g.y);return f?{...G,transform:"translate("+X+"px, "+$+"px)",...xO(F.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:X,top:$}},[r,f,F.floating,g.x,g.y]);return b.useMemo(()=>({...g,update:I,refs:H,elements:F,floatingStyles:V}),[g,I,H,F,V])}const fB=(e,t)=>{const r=sB(e);return{name:r.name,fn:r.fn,options:[e,t]}},mB=(e,t)=>{const r=rB(e);return{name:r.name,fn:r.fn,options:[e,t]}},hB=(e,t)=>({fn:iB(e).fn,options:[e,t]}),pB=(e,t)=>{const r=oB(e);return{name:r.name,fn:r.fn,options:[e,t]}},gB=(e,t)=>{const r=aB(e);return{name:r.name,fn:r.fn,options:[e,t]}},xB={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 O1 extends vu{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:oO(),nested:l,triggerElements:u},xB);tn(this,"syncOpenEvent",(r,a)=>{(!r||!this.state.open||a!=null&&HL(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 bO(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,x=b.useRef(null);a===void 0&&x.current===null&&(x.current=new O1({open:f,transitionStatus:void 0,referenceElement:m,floatingElement:h,triggerElements:g,onOpenChange:p,floatingId:l,syncOnly:!0,nested:c}));const v=a??x.current;return t.useSyncedValue("floatingId",l),Ke(()=>{const j={open:f,floatingId:l,referenceElement:m,floatingElement:h};qt(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 Nf={tabIndex:-1,[Uy]:""};function yO(e){return t=>t==="touch"?e.current:!0}function M1(e,t=!1){const r=Ll(),a=Bi()!=null,l=ds(()=>e(r,a)).current;return bO({popupStore:l,treatPopupAsFloatingElement:t,floatingRootContext:l.state.floatingRootContext,floatingId:r,nested:a,onOpenChange:l.setOpen}),l}function Eg({handle:e,store:t}){return Ke(()=>e.attachStore(t),[e,t]),null}function ok(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function bB(e,t){const r=b.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),ok(c))}a!==null&&e!==void 0&&(r.current={store:t,id:e,element:a},t.context.triggerElements.add(e,a),ok(t))})}function Rg(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 D1(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function yB(e,t,r,a={}){var g,p,x;const l=r.reason,c=l===Hn,u=t&&l===eu,f=!t&&(l===Zo||l===wf),m=D1(r);if((p=(g=e.context).onOpenChange)==null||p.call(g,t,r),r.isCanceled)return;(x=a.onBeforeDispatch)==null||x.call(a),e.state.floatingRootContext.dispatchOpenChange(t,r);const h=()=>{const v=Rg(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?ro.flushSync(h):h()}function z1(e,t,r,a){const l=r.useState("isMountedByTrigger",e),c=bB(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 Ag(e,t={}){const{closeOnActiveTriggerUnmount:r=!1}=t,a=b.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 x=e.context.triggerElements.getById(g);if(x)a.current=g,x!==e.state.activeTriggerElement&&(h.activeTriggerElement=x);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 x=e.context.triggerElements.entries().next();if(!x.done){const[v,j]=x.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 x=bt(Er);e.setOpen(!1,x),x.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[l,e,c,u,f,r])}function Og(e,t,r,a){const{mounted:l,setMounted:c,transitionStatus:u}=Fa(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 Mg(e,t){e.useSyncedValues(t),Ke(()=>()=>{e.update({activeTriggerProps:gn,inactiveTriggerProps:gn,popupProps:gn})},[e])}function vO(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 Cf{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 Dg(e,t,r=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new O1({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 $d=e=>e.triggerIdProp??e.activeTriggerId,P1=e=>e.openProp??e.open,ak=e=>{var r;return(((r=e.popupElement)==null?void 0:r.id)??e.floatingId)||void 0};function wO(e,t){return t!==void 0&&P1(e)&&$d(e)===t}function vB(e,t){return wO(e,t)?!0:t!==void 0&&P1(e)&&$d(e)==null&&e.triggerCount===1}const zg={open:P1,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:$d,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:ak,isTriggerActive:(e,t)=>t!==void 0&&$d(e)===t,isOpenedByTrigger:(e,t)=>wO(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&$d(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>vB(e,t)?ak(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function I1(e){const t=b.useCallback(a=>e===void 0?Tn:e.subscribeStore(a),[e]),r=b.useCallback(()=>e===void 0?void 0:e.store,[e]);return S1.useSyncExternalStore(t,r,()=>e==null?void 0:e.serverStore)}function wB(e){const{open:t=!1,onOpenChange:r,elements:a={}}=e,l=Ll(),c=Bi()!=null,u=ds(()=>new O1({open:t,transitionStatus:void 0,onOpenChange:r,referenceElement:a.reference??null,floatingElement:a.floating??null,triggerElements:new Cf,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=qt(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 jB(e){return SB(e,e.rootContext)}function SB(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]=b.useState(null),[p,x]=b.useState(void 0),[v,j]=b.useState(void 0),S=b.useRef(null),N=Vi(a),C=b.useMemo(()=>({reference:l,floating:c,domReference:u}),[l,c,u]),T=dB({...e,elements:{...C,...h&&{reference:h}}}),k=qt(p)?p:null,A=v===void 0?t.state.floatingElement:v;t.useSyncedValue("referenceElement",p??null),t.useSyncedValue("domReferenceElement",p===void 0?u:k),t.useSyncedValue("floatingElement",A);const R=b.useCallback(B=>{const q=qt(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;g(q),T.refs.setReference(q)},[T.refs]),M=b.useCallback(B=>{(qt(B)||B===null)&&(S.current=B,x(B)),(qt(T.refs.reference.current)||T.refs.reference.current===null||B!==null&&!qt(B))&&T.refs.setReference(B)},[T.refs,x]),E=b.useCallback(B=>{j(B),T.refs.setFloating(B)},[T.refs]),O=b.useMemo(()=>({...T.refs,setReference:M,setFloating:E,setPositionReference:R,domReference:S}),[T.refs,M,E,R]),z=b.useMemo(()=>({...T.elements,domReference:u}),[T.elements,u]),_=b.useMemo(()=>({...T,dataRef:t.context.dataRef,open:f,onOpenChange:t.setOpen,events:t.context.events,floatingId:m,refs:O,elements:z,nodeId:r,rootStore:t}),[T,O,z,r,t,f,m]);return Ke(()=>{u&&(S.current=u)},[u]),Ke(()=>{t.context.dataRef.current.floatingContext=_;const B=N==null?void 0:N.nodesRef.current.find(q=>q.id===r);B&&(B.context=_)}),b.useMemo(()=>({...T,context:_,refs:O,elements:z,rootStore:t}),[T,O,z,_,t])}const Y0=u1&&Ua;function jO(e,t={}){const{enabled:r=!0,delay:a}=t,l="rootStore"in e?e.rootStore:e,{events:c,dataRef:u}=l.context,f=b.useRef(!1),m=b.useRef(null),h=b.useRef(!0),g=ts();b.useEffect(()=>{const x=l.select("domReferenceElement");if(!r)return;const v=xn(x);function j(){const C=l.select("domReferenceElement");!l.select("open")&&cn(C)&&C===Ps(Gt(C))&&(f.current=!0,m.current=C)}function S(){h.current=!0}function N(){h.current=!1}return qo(Lt(v,"blur",j),Y0&&Lt(v,"keydown",S,!0),Y0&&Lt(v,"pointerdown",N,!0))},[l,r]),b.useEffect(()=>{if(!r)return;function x(v){if(v.reason===Zo||v.reason===wf){const j=l.select("domReferenceElement");qt(j)&&(m.current=j,f.current=!0)}}return c.on("openchange",x),()=>{c.off("openchange",x)}},[c,r,l]);const p=b.useMemo(()=>{function x(){f.current=!1,m.current=null}return{onMouseLeave(){x()},onFocus(v){const j=v.currentTarget;if(f.current){if(m.current===j)return;x()}const S=As(v.nativeEvent);if(qt(S)){if(Y0&&!v.relatedTarget){if(!h.current&&!xg(S))return}else if(!VL(S))return}const N=wp(v.relatedTarget,l.context.triggerElements),{nativeEvent:C,currentTarget:T}=v,k=typeof a=="function"?a():a;if(l.select("open")&&N||k===0||k===void 0){l.setOpen(!0,bt(eu,C,T));return}g.start(k,()=>{f.current||l.setOpen(!0,bt(eu,C,T))})},onBlur(v){x();const j=v.relatedTarget,S=v.nativeEvent,N=qt(j)&&j.hasAttribute(Qd("focus-guard"))&&j.getAttribute("data-type")==="outside";g.start(0,()=>{var A;const C=l.select("domReferenceElement"),T=Ps(Gt(C));!j&&T===C||pt((A=u.current.floatingContext)==null?void 0:A.refs.floating.current,T)||pt(C,T)||N||wp(j??T,l.context.triggerElements)||l.setOpen(!1,bt(eu,S))})}}},[u,a,l,g]);return b.useMemo(()=>r?{reference:p,trigger:p}:{},[r,p])}class _1{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 so,this.restTimeout=new so,this.handleCloseOptions=void 0}static create(){return new _1}}const Tp=new WeakMap;function Ep(e){var r,a,l;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Tp.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"),Tp.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function SO(e,t){const{scopeElement:r,referenceElement:a,floatingElement:l}=t,c=Tp.get(r);c&&c!==e&&Ep(c),Ep(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=r,e.pointerEventsReferenceElement=a,e.pointerEventsFloatingElement=l,Tp.set(r,e),r.style.pointerEvents="none",a.style.pointerEvents="auto",l.style.pointerEvents="auto"}function L1(e){const t=e.context.dataRef.current,r=ds(()=>t.hoverInteractionState??_1.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=r),w1(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function $1(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=Vi(),p=Bi(),x=L1(c),v=ts(),j=et(()=>{var C;return WA((C=h.current.openEvent)==null?void 0:C.type,x.interactedInside)}),S=et(()=>{var C;return x$((C=h.current.openEvent)==null?void 0:C.type)}),N=et(()=>{Ep(x)});Ke(()=>{u||(x.pointerType=void 0,x.restTimeoutPending=!1,x.interactedInside=!1,N())},[u,x,N]),b.useEffect(()=>N,[N]),Ke(()=>{var C,T,k,A,R;if(r&&u&&(C=x.handleCloseOptions)!=null&&C.blockPointerEvents&&S()&&qt(m)&&f){const M=m,E=f,O=Gt(f),z=(k=(T=g==null?void 0:g.nodesRef.current.find(I=>I.id===p))==null?void 0:T.context)==null?void 0:k.elements.floating;z&&(z.style.pointerEvents="");const _=x.pointerEventsScopeElement!==E?x.pointerEventsScopeElement:null,B=z!==E?z:null,q=((R=(A=x.handleCloseOptions)==null?void 0:A.getScope)==null?void 0:R.call(A))??_??B??M.closest("[data-rootownerid]")??O.body;return SO(x,{scopeElement:q,referenceElement:M,floatingElement:E}),()=>{N()}}},[r,u,m,f,x,S,g,p,N]),b.useEffect(()=>{if(!r)return;function C(){return!!(g&&p&&Di(g.nodesRef.current,p).length>0)}function T(O){const z=Bl(a,"close",x.pointerType),_=()=>{c.setOpen(!1,bt(Hn,O)),g==null||g.events.emit("floating.closed",O)};z?x.openChangeTimeout.start(z,_):(x.openChangeTimeout.clear(),_())}function k(O){const z=As(O);if(!BL(z)){x.interactedInside=!1;return}x.interactedInside=(z==null?void 0:z.closest("[aria-haspopup]"))!=null}function A(){x.openChangeTimeout.clear(),v.clear(),g==null||g.events.off("floating.closed",M),N()}function R(O){var q;if(C()&&g){g.events.on("floating.closed",M);return}if(wp(O.relatedTarget,c.context.triggerElements))return;const z=((q=h.current.floatingContext)==null?void 0:q.nodeId)??l,_=O.relatedTarget;if(!(g&&z&&qt(_)&&Di(g.nodesRef.current,z,!1).some(I=>{var L;return pt((L=I.context)==null?void 0:L.elements.floating,_)}))){if(x.handler){x.handler(O);return}N(),S()&&!j()&&T(O)}}function M(O){!g||!p||C()||v.start(0,()=>{g.events.off("floating.closed",M),c.setOpen(!1,bt(Hn,O)),g.events.emit("floating.closed",O)})}const E=f;return qo(E&&Lt(E,"mouseenter",A),E&&Lt(E,"mouseleave",R),E&&Lt(E,"pointerdown",k,!0),()=>{g==null||g.events.off("floating.closed",M)})},[r,f,c,h,a,l,S,j,N,x,g,p,v])}const NB={current:null};function B1(e,t={}){const{enabled:r=!0,delay:a=0,handleClose:l=null,mouseOnly:c=!1,restMs:u=0,move:f=!0,triggerElementRef:m=NB,externalTree:h,isActiveTrigger:g=!0,getHandleCloseContext:p,isClosing:x,shouldOpen:v,guardStaleOpen:j=!1}=t,S="rootStore"in e?e.rootStore:e,{dataRef:N,events:C}=S.context,T=Vi(h),k=L1(S),A=b.useRef(!1),R=Ln(l),M=Ln(a),E=Ln(u),O=Ln(r),z=Ln(v),_=Ln(x),B=et(()=>{var F;return WA((F=N.current.openEvent)==null?void 0:F.type,k.interactedInside)}),q=et(()=>{var F;return((F=z.current)==null?void 0:F.call(z))!==!1}),I=et((F,V,G)=>{const X=S.context.triggerElements;if(X.hasElement(V))return!F||!pt(F,V);if(!qt(G))return!1;const $=G;return X.hasMatchingElement(Q=>pt(Q,$))&&(!F||!pt(F,$))}),L=et(()=>{if(!k.handler)return;Gt(S.select("domReferenceElement")).removeEventListener("mousemove",k.handler),k.handler=void 0}),H=et(()=>{Ep(k)});return g&&(k.handleCloseOptions=l==null?void 0:l.__options),b.useEffect(()=>L,[L]),b.useEffect(()=>{if(!r)return;function F(V){V.open?A.current=!1:(A.current=V.reason===Hn,L(),k.openChangeTimeout.clear(),k.restTimeout.clear(),k.blockMouseMove=!0,k.restTimeoutPending=!1)}return C.on("openchange",F),()=>{C.off("openchange",F)}},[r,C,k,L]),b.useEffect(()=>{if(!r)return;function F(K,se=!0){const P=Bl(M.current,"close",k.pointerType);P?k.openChangeTimeout.start(P,()=>{S.setOpen(!1,bt(Hn,K)),T==null||T.events.emit("floating.closed",K)}):se&&(k.openChangeTimeout.clear(),S.setOpen(!1,bt(Hn,K)),T==null||T.events.emit("floating.closed",K))}const V=m.current??(g?S.select("domReferenceElement"):null);if(!qt(V))return;function G(K){var Ne;if(k.openChangeTimeout.clear(),k.blockMouseMove=!1,c&&!Ei(k.pointerType))return;const se=HC(E.current),P=Bl(M.current,"open",k.pointerType),U=As(K),Z=K.currentTarget??null,te=S.select("domReferenceElement");let le=Z;if(qt(U)&&!S.context.triggerElements.hasElement(U)){for(const Ae of S.context.triggerElements.elements())if(pt(Ae,U)){le=Ae;break}}qt(Z)&&qt(te)&&!S.context.triggerElements.hasElement(Z)&&pt(Z,te)&&(le=te);const de=le==null?!1:I(te,le,U),oe=S.select("open"),ne=((Ne=_.current)==null?void 0:Ne.call(_))??S.select("transitionStatus")==="ending",ee=!oe&&ne&&A.current,W=!de&&qt(le)&&qt(te)&&pt(te,le)&&ee,ce=se>0&&!P,Re=de&&(oe||ee)||W,_e=!oe||de;if(Re){q()&&S.setOpen(!0,bt(Hn,K,le));return}ce||(P?k.openChangeTimeout.start(P,()=>{_e&&q()&&S.setOpen(!0,bt(Hn,K,le))}):_e&&q()&&S.setOpen(!0,bt(Hn,K,le)))}function X(K){if(B()){H();return}L();const se=S.select("domReferenceElement"),P=Gt(se);k.restTimeout.clear(),k.restTimeoutPending=!1;const U=N.current.floatingContext??(p==null?void 0:p());if(wp(K.relatedTarget,S.context.triggerElements))return;if(R.current&&U){S.select("open")||k.openChangeTimeout.clear();const te=m.current;k.handler=R.current({...U,tree:T,x:K.clientX,y:K.clientY,onClose(){H(),L(),O.current&&!B()&&te===S.select("domReferenceElement")&&F(K,!0)}}),P.addEventListener("mousemove",k.handler),k.handler(K);return}(k.pointerType==="touch"?!pt(S.select("floatingElement"),K.relatedTarget):!0)&&F(K)}function $(K){pt(V,K.relatedTarget)||(k.openChangeTimeout.clear(),k.restTimeout.clear(),k.restTimeoutPending=!1)}const Q=j?Lt(V,"mouseout",$):void 0;return f?qo(Lt(V,"mousemove",G,{once:!0}),Lt(V,"mouseenter",G),Lt(V,"mouseleave",X),Q):qo(Lt(V,"mouseenter",G),Lt(V,"mouseleave",X),Q)},[L,H,N,M,S,r,R,k,g,I,B,c,f,E,m,T,O,p,_,q,j]),b.useMemo(()=>{if(!r)return;function F(V){k.pointerType=V.pointerType}return{onPointerDown:F,onPointerEnter:F,onMouseMove(V){var U,Z,te;const{nativeEvent:G}=V,X=V.currentTarget,$=S.select("domReferenceElement"),Q=S.select("open"),K=I($,X,V.target);if(c&&!Ei(k.pointerType))return;if(Q&&K&&((U=k.handleCloseOptions)!=null&&U.blockPointerEvents)){const le=S.select("floatingElement");if(le){const de=((te=(Z=k.handleCloseOptions)==null?void 0:Z.getScope)==null?void 0:te.call(Z))??X.ownerDocument.body;SO(k,{scopeElement:de,referenceElement:X,floatingElement:le})}}const se=HC(E.current);if(Q&&!K||se===0||!K&&k.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;k.restTimeout.clear();function P(){if(k.restTimeoutPending=!1,B())return;const le=S.select("open");!k.blockMouseMove&&(!le||K)&&q()&&S.setOpen(!0,bt(Hn,G,X))}k.pointerType==="touch"?ro.flushSync(()=>{P()}):K&&Q?P():(k.restTimeoutPending=!0,k.restTimeout.start(se,P))}}},[r,k,B,I,c,S,E,q])}const CB="Escape";function ik(e){return Ua&&e.movementX===0&&e.movementY===0}function Pg(e,t,r){switch(e){case"vertical":return t;case"horizontal":return r;default:return t||r}}function fh(e,t){return Pg(t,e===SA||e===f1,e===hg||e===pg)}function K0(e,t,r){return Pg(t,e===f1,r?e===hg:e===pg)||e==="Enter"||e===" "||e===""}function kB(e,t,r){return Pg(t,r?e===hg:e===pg,e===f1)}function TB(e,t,r,a){const l=r?e===pg:e===hg,c=e===SA;return t==="both"||t==="horizontal"&&a?e===CB:Pg(t,l,c)}function NO(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:x="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:j=!0,disabledIndices:S=void 0,orientation:N="vertical",parentOrientation:C,id:T,resetOnPointerLeave:k=!0,externalTree:A,grid:R}=t,M=R!=null,E="rootStore"in e?e.rootStore:e,O=E.useState("open"),z=E.useState("floatingElement"),_=E.useState("domReferenceElement"),B=E.context.dataRef,q=jp(z),I=Fy(_),L=Ln(q),H=Bi(),F=Vi(A),V=b.useRef(x),G=b.useRef(u??-1),X=b.useRef(null),$=b.useRef(!0),Q=et(we=>{l(G.current===-1?null:G.current,we)}),K=b.useRef(!!z),se=b.useRef(O),P=b.useRef(!1),U=b.useRef(!1),Z=b.useRef(null),te=Ln(S),le=Ln(O),de=Ln(u),oe=Ln(k),ne=cu(),ee=cu(),W=et(()=>{function we(be){p?F==null||F.events.emit("virtualfocus",be):Z.current=Hh(be,{sync:P.current,preventScroll:!0})}const Ye=r.current[G.current],Ee=U.current;Ye&&we(Ye),(P.current?be=>be():be=>ne.request(be))(()=>{var Je;const be=r.current[G.current]||Ye;if(!be)return;Ye||we(be),J&&(Ee||!$.current)&&((Je=be.scrollIntoView)==null||Je.call(be,{block:"nearest",inline:"nearest"}))})});Ke(()=>{B.current.orientation=N},[B,N]),Ke(()=>{c&&(O&&z?(G.current=u??-1,V.current&&u!=null&&(U.current=!0,Q())):K.current&&(G.current=-1,Q()))},[c,O,z,u,Q]),Ke(()=>{if(c){if(!O){P.current=!1;return}if(z)if(a==null){if(P.current=!1,de.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 Ye=()=>{r.current[0]==null?(we<2&&(we?Ce=>ee.request(Ce):queueMicrotask)(Ye),we+=1):(G.current=X.current==null||K0(X.current,N,g)||h?Uh(r):qy(r),X.current=null,Q())};Ye()}}else Ld(r.current,a)||(G.current=a,W(),U.current=!1)}},[c,O,z,a,de,h,r,N,g,Q,W,ee]),Ke(()=>{var be,Ue;if(!c||z||!F||p||!K.current)return;const we=F.nodesRef.current,Ye=(Ue=(be=we.find(Je=>Je.id===H))==null?void 0:be.context)==null?void 0:Ue.elements.floating,Ee=Ps(Gt(_??Ye??null)),Ce=we.some(Je=>Je.context&&pt(Je.context.elements.floating,Ee));Ye&&!Ce&&$.current&&Ye.focus({preventScroll:!0})},[c,z,_,F,H,p]),Ke(()=>{se.current=O,K.current=!!z}),Ke(()=>{O||(X.current=null,V.current=x)},[O,x]);const ce=a!=null,Re=et(we=>{if(!le.current)return;const Ye=r.current.indexOf(we.currentTarget);Ye!==-1&&(G.current!==Ye||a!==Ye)&&(G.current=Ye,Q(we))}),_e=et(()=>{var we,Ye,Ee;return C??((Ee=(Ye=(we=F==null?void 0:F.nodesRef.current.find(Ce=>Ce.id===H))==null?void 0:we.context)==null?void 0:Ye.dataRef)==null?void 0:Ee.current.orientation)}),Ne=et(()=>Uh(r,te.current)),Ae=et(we=>{if($.current=!1,P.current=!0,we.which===229||!le.current&&we.currentTarget===L.current)return;if(h&&TB(we.key,N,g,M)){fh(we.key,_e())||Ho(we),E.setOpen(!1,bt(Ky,we.nativeEvent)),cn(_)&&(p?F==null||F.events.emit("virtualfocus",_):_.focus());return}const Ye=G.current,Ee=Uh(r,S),Ce=qy(r,S);if(I||(we.key==="Home"&&(Ho(we),G.current=Ee,Q(we)),we.key==="End"&&(Ho(we),G.current=Ce,Q(we))),R!=null){const be=R(we,G.current,r,N,m,g,S,Ee,Ce);if(be!=null&&(G.current=be,Q(we)),N==="both")return}if(fh(we.key,N)){if(Ho(we),O&&!p&&Ps(we.currentTarget.ownerDocument)===we.currentTarget){G.current=K0(we.key,N,g)?Ee:Ce,Q(we);return}K0(we.key,N,g)?m?Ye>=Ce?f&&Ye!==r.current.length?G.current=-1:(P.current=!1,G.current=Ee):G.current=Sa(r.current,{startingIndex:Ye,disabledIndices:S}):G.current=Math.min(Ce,Sa(r.current,{startingIndex:Ye,disabledIndices:S})):m?Ye<=Ee?f&&Ye!==-1?G.current=r.current.length:(P.current=!1,G.current=Ce):G.current=Sa(r.current,{startingIndex:Ye,decrement:!0,disabledIndices:S}):G.current=Math.max(Ee,Sa(r.current,{startingIndex:Ye,decrement:!0,disabledIndices:S})),Ld(r.current,G.current)&&(G.current=-1),Q(we)}}),J=b.useMemo(()=>({onFocus(Ye){P.current=!0,Re(Ye)},onClick:({currentTarget:Ye})=>Ye.focus({preventScroll:!0}),onMouseMove(Ye){ik(Ye)||(P.current=!0,U.current=!1,v&&Re(Ye))},onPointerLeave(Ye){var Ce;if(!le.current||!$.current||Ye.pointerType==="touch")return;P.current=!0;const Ee=Ye.relatedTarget;if(!(!v||r.current.includes(Ee))&&oe.current&&((Ce=Z.current)==null||Ce.call(Z),Z.current=null,G.current=-1,Q(Ye),!p)){const be=L.current,Ue=Ps(Gt(be));be&&pt(be,Ue)&&be.focus({preventScroll:!0})}}}),[Re,le,L,v,r,Q,oe,p]),re=b.useMemo(()=>p&&O&&ce&&{"aria-activedescendant":`${T}-${a}`},[p,O,ce,T,a]),xe=b.useMemo(()=>({...I?{}:re,onKeyDown(we){if(we.key==="Tab"&&we.shiftKey&&O&&!p){const Ye=As(we.nativeEvent);if(Ye&&!pt(L.current,Ye))return;Ho(we),E.setOpen(!1,bt(Pi,we.nativeEvent)),cn(_)&&_.focus();return}Ae(we)},onPointerMove(we){ik(we)||($.current=!0)}}),[re,Ae,L,I,E,O,p,_]),he=b.useMemo(()=>{function we(Ce){E.setOpen(!0,bt(Ky,Ce.nativeEvent,Ce.currentTarget))}function Ye(Ce){x==="auto"&&bg(Ce.nativeEvent)&&(V.current=!p)}function Ee(Ce){V.current=x,x==="auto"&&p1(Ce.nativeEvent)&&(V.current=!0)}return{onKeyDown(Ce){const be=E.select("open");$.current=!1;const Ue=Ce.key.startsWith("Arrow"),Je=kB(Ce.key,_e(),g),dt=fh(Ce.key,N),lt=(h?Je:dt)||Ce.key==="Enter"||Ce.key.trim()==="";if(p&&be)return Ae(Ce);if(!(!be&&!j&&Ue)){if(lt){const Ie=fh(Ce.key,_e());X.current=h&&Ie?null:Ce.key}if(h){Je&&(Ho(Ce),be?(G.current=Ne(),Q(Ce)):we(Ce));return}dt&&(de.current!=null&&(G.current=de.current),Ho(Ce),!be&&j?we(Ce):Ae(Ce),be&&Q(Ce))}},onFocus(Ce){E.select("open")&&!p&&(G.current=-1,Q(Ce))},onPointerDown:Ee,onPointerEnter:Ee,onMouseDown:Ye,onClick:Ye}},[Ae,x,Ne,h,Q,E,j,N,_e,g,de,p]),Be=b.useMemo(()=>({...re,...he}),[re,he]);return b.useMemo(()=>c?{reference:Be,floating:xe,item:J,trigger:he}:{},[c,Be,xe,he,J])}function CO(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,x=p.useState("open"),v=ts(),j=b.useRef(""),S=b.useRef(g??l??-1),N=b.useRef(null),C=et(A=>{function R(L){return a==null?void 0:a.current[L]}function M(L){const H=R(L);return H&&!yg(H)||H!=null&&H.matches(":disabled")?!1:u==null||!Zc(Tr,L,u)}function E(L,H,F=0){if(L.length===0)return-1;const V=(F%L.length+L.length)%L.length,G=H.toLowerCase();for(let X=0;X<L.length;X+=1){const $=(V+X)%L.length,Q=L[$];if(!(!(Q!=null&&Q.toLowerCase().startsWith(G))||!M($)))return $}return-1}const O=r.current;if(j.current.length>0&&A.key===" "&&(Ho(A),f==null||f(!0)),j.current.length>0&&j.current[0]!==" "&&E(O,j.current)===-1&&A.key!==" "&&(f==null||f(!1)),O==null||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;x&&A.key!==" "&&(Ho(A),f==null||f(!0));const z=j.current==="";z&&(S.current=g??l??-1),O.every((L,H)=>{var F,V;return L&&M(H)?((F=L[0])==null?void 0:F.toLowerCase())!==((V=L[1])==null?void 0:V.toLowerCase()):!0})&&j.current===A.key&&(j.current="",S.current=N.current),j.current+=A.key,v.start(h,()=>{j.current="",S.current=N.current,f==null||f(!1)});const q=((z?g??l??-1:S.current)??0)+1,I=E(O,j.current,q);I!==-1?(c==null||c(I),N.current=I):A.key!==" "&&(j.current="",f==null||f(!1))}),T=et(A=>{const R=A.relatedTarget,M=p.select("domReferenceElement"),E=p.select("floatingElement");pt(M,R)||pt(E,R)||(v.clear(),j.current="",S.current=N.current,f==null||f(!1))});Ke(()=>{!x&&g!==null||(v.clear(),N.current=null,j.current!==""&&(j.current=""))},[x,g,v]);const k=b.useMemo(()=>({onKeyDown:C,onBlur:T}),[C,T]);return b.useMemo(()=>m?{reference:k,floating:k}:{},[m,k])}const lk=.1,EB=lk*lk,mn=.5;function mh(e,t,r,a,l,c){return a>=t!=c>=t&&e<=(l-r)*(t-a)/(c-a)+r}function hh(e,t,r,a,l,c,u,f,m,h){let g=!1;return mh(e,t,r,a,l,c)&&(g=!g),mh(e,t,l,c,u,f)&&(g=!g),mh(e,t,u,f,m,h)&&(g=!g),mh(e,t,m,h,r,a)&&(g=!g),g}function RB(e,t,r){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height}function ph(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 V1(e={}){const{blockPointerEvents:t=!1}=e,r=new so,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 x=!1,v=null,j=null,S=typeof performance<"u"?performance.now():0;function N(T,k){const A=performance.now(),R=A-S;if(v===null||j===null||R===0)return v=T,j=k,S=A,!1;const M=T-v,E=k-j,O=M*M+E*E,z=R*R*EB;return v=T,j=k,S=A,O<z}function C(){r.clear(),m()}return function(k){r.clear();const A=f.domReference,R=f.floating;if(!A||!R||p==null||l==null||c==null)return;const{clientX:M,clientY:E}=k,O=As(k),z=k.type==="mouseleave",_=pt(R,O),B=pt(A,O);if(_&&(x=!0,!z))return;if(B&&(x=!1,!z)){x=!0;return}if(z&&qt(k.relatedTarget)&&pt(R,k.relatedTarget))return;function q(){return!!(g&&Di(g.nodesRef.current,h).length>0)}function I(){q()||C()}if(q())return;const L=A.getBoundingClientRect(),H=R.getBoundingClientRect(),F=l>H.right-H.width/2,V=c>H.bottom-H.height/2,G=H.width>L.width,X=H.height>L.height,$=(G?L:H).left,Q=(G?L:H).right,K=(X?L:H).top,se=(X?L:H).bottom;if(p==="top"&&c>=L.bottom-1||p==="bottom"&&c<=L.top+1||p==="left"&&l>=L.right-1||p==="right"&&l<=L.left+1){I();return}let P=!1;switch(p){case"top":P=ph(M,E,$,L.top+1,Q,H.bottom-1);break;case"bottom":P=ph(M,E,$,H.top+1,Q,L.bottom-1);break;case"left":P=ph(M,E,H.right-1,se,L.left+1,K);break;case"right":P=ph(M,E,L.right-1,se,H.left+1,K);break}if(P)return;if(x&&!RB(M,E,L)){I();return}if(!z&&N(M,E)){I();return}let U=!1;switch(p){case"top":{const Z=G?mn/2:mn*4,te=G||F?l+Z:l-Z,le=G?l-Z:F?l+Z:l-Z,de=c+mn+1,oe=F||G?H.bottom-mn:H.top,ne=F?G?H.bottom-mn:H.top:H.bottom-mn;U=hh(M,E,te,de,le,de,H.left,oe,H.right,ne);break}case"bottom":{const Z=G?mn/2:mn*4,te=G||F?l+Z:l-Z,le=G?l-Z:F?l+Z:l-Z,de=c-mn,oe=F||G?H.top+mn:H.bottom,ne=F?G?H.top+mn:H.bottom:H.top+mn;U=hh(M,E,te,de,le,de,H.left,oe,H.right,ne);break}case"left":{const Z=X?mn/2:mn*4,te=X||V?c+Z:c-Z,le=X?c-Z:V?c+Z:c-Z,de=l+mn+1,oe=V||X?H.right-mn:H.left,ne=V?X?H.right-mn:H.left:H.right-mn;U=hh(M,E,oe,H.top,ne,H.bottom,de,te,de,le);break}case"right":{const Z=X?mn/2:mn*4,te=X||V?c+Z:c-Z,le=X?c-Z:V?c+Z:c-Z,de=l-mn,oe=V||X?H.left+mn:H.right,ne=V?X?H.left+mn:H.right:H.left+mn;U=hh(M,E,de,te,de,le,oe,H.top,ne,H.bottom);break}}U?x||r.start(40,I):I()}};return a.__options={...e,blockPointerEvents:t},a}const kO=b.createContext(void 0),TO=b.createContext(void 0),EO=b.createContext(void 0);function ta(){const e=b.useContext(kO);if(e===void 0)throw new Error(Jt(60));return e}function Ig(){const e=b.useContext(TO);if(e===void 0)throw new Error(Jt(101));return e}function RO(){const e=b.useContext(EO);if(e===void 0)throw new Error(Jt(61));return e}function AB(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 AO=(e,t)=>Object.is(e,t);function Ul(e,t,r){return e==null||t==null?Object.is(e,t):r(e,t)}function OB(e,t,r){return Array.isArray(e)&&Array.isArray(t)?!AB(e,t,(a,l)=>Ul(a,l,r)):e!==t}function ev(e,t,r){return e?e.some(a=>a===void 0?!1:Ul(t,a,r)):!1}function Gh(e,t,r){return e?e.findIndex(a=>a===void 0?!1:Ul(a,t,r)):-1}function MB(e,t){if(t!==AO)return a=>ev(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 OO(e,t,r,a){const l=a&&Array.isArray(t)?e.findIndex(MB(t,r)):Gh(e,t,r);return l===-1?null:l}function DB(e,t,r,a,l,c){return ev(a,t,l)?c!=null&&e>c&&ev(a,r[c],l)?c:e:e===c?OO(r,a,l,!0):c}function zB(e,t,r){return e.filter(a=>!Ul(t,a,r))}function tv(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function PB(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function MO(e){return PB(e==null?void 0:e[0])}function IB(e){return MO(e)?e.flatMap(t=>t.items):e}function _B(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(MO(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 DO(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 tv(e)}function Gc(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?tv(e.value):tv(e)}function zO(e,t,r){function a(){return DO(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=IB(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 LB(e,t,r){return e.reduce((a,l,c)=>(c>0&&a.push(", "),a.push(s.jsx(b.Fragment,{children:zO(l,t,r)},c)),a),[])}const $B={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:Gc(t,a)!==""},hasNullItemLabel:(e,t)=>t?_B(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=>Ul(t,l,r)):Ul(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 BB(e){const t=b.useRef(""),r=b.useCallback(l=>{l.defaultPrevented||(t.current=l.pointerType,e(l,l.pointerType))},[e]);return{onClick:b.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 PO(e,t){const r=et((c,u)=>{(typeof e=="function"?e():e)||t(u||(mg?"touch":""))}),{onClick:a,onPointerDown:l}=BB(r);return b.useMemo(()=>({onClick:a,onPointerDown:l}),[a,l])}function IO(e){const[t,r]=b.useState(null),a=PO(e,r);return vf(e,l=>{l&&!e&&r(null)}),b.useMemo(()=>({openMethod:t,triggerProps:a}),[t,a])}function Od(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}const yo=1;function U1(e,t){return Math.max(0,e-t)}function Rp(e,t){if(t<=0)return 0;const r=Od(e,0,t),a=r,l=t-r,c=a<=yo,u=l<=yo;return c&&u?a<=l?0:t:c?0:u?t:r}function VB(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:x=!1,required:v=!1,modal:j=!0,actionsRef:S,inputRef:N,onOpenChangeComplete:C,items:T,multiple:k=!1,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:M=AO,highlightItemOnHover:E=!0,children:O}=e,{clearErrors:z}=dg(),{setDirty:_,setTouched:B,setFocused:q,validityData:I,setFilled:L,name:H,disabled:F,validation:V,validationMode:G}=bu(),X=gf({id:t}),$=F||p,Q=H??m,[K,se]=oo({controlled:r,default:k?a??Tr:a,name:"Select",state:"value"}),[P,U]=oo({controlled:c,default:u,name:"Select",state:"open"}),Z=b.useRef([]),te=b.useRef([]),le=b.useRef(null),de=b.useRef(null),oe=b.useRef(0),ne=b.useRef(null),ee=b.useRef([]),W=b.useRef(!1),ce=b.useRef(null),Re=b.useRef(null),_e=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Ne=b.useRef(!1),Ae=b.useRef(K),{mounted:J,setMounted:re,transitionStatus:xe}=Fa(P),{openMethod:he,triggerProps:Be}=IO(P),we=ds(()=>new vu({id:X,labelId:void 0,modal:j,multiple:k,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:M,value:K,open:P,mounted:J,transitionStatus:xe,items:T,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:Z,popupRef:le,scrollHandlerRef:de,scrollArrowsMountedCountRef:oe,valueRef:ne,valuesRef:ee,labelsRef:te,typingRef:W,selectionRef:_e,firstItemTextRef:ce,selectedItemTextRef:Re,alignItemWithTriggerActiveRef:Ne,initialValueRef:Ae},$B)).current,Ye=we.useState("activeIndex"),Ee=we.useState("selectedIndex"),Ce=we.useState("triggerElement"),be=we.useState("positionerElement"),Ue=t$(he),Je=he??Ue,dt=b.useMemo(()=>k?"":Gc(K,R),[k,K,R]),lt=b.useMemo(()=>k&&Array.isArray(K)?K.map(ct=>Gc(ct,R)):Gc(K,R),[k,K,R]),Ie=Ln(Ce),ot=et(()=>lt);vg(Ie,X,K,ot,!$,m);const We=k?Array.isArray(K)&&K.length>0:K!=null&&dt!=="";Ke(()=>{L(We)},[We,L]),Ke(function(){const vt=OO(ee.current,K,M,k);vt===null&&(Re.current=null),!P&&we.set("selectedIndex",vt)},[k,P,K,M,we]),vf(K,()=>{z(Q),_(OB(K,I.initialValue,M)),V.change(K)});const me=et((ct,vt)=>{f==null||f(ct,vt),!vt.isCanceled&&(U(ct),!ct&&(vt.reason===Pi||vt.reason===wg)&&(B(!0),q(!1),G==="onBlur"&&V.commit(K)))}),Oe=et(()=>{re(!1),we.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),C==null||C(!1)});lr({enabled:!S,open:P,ref:le,onComplete(){P||Oe()}}),b.useImperativeHandle(S,()=>({unmount:Oe}),[Oe]);const Me=et((ct,vt)=>{l==null||l(ct,vt),!vt.isCanceled&&se(ct)}),nt=et(ct=>{const vt=U1(ct.scrollHeight,ct.clientHeight),ae=Rp(ct.scrollTop,vt),Xe=ae>0,ut=ae<vt;we.set("scrollUpArrowVisible",Xe),we.set("scrollDownArrowVisible",ut)}),Ge=wB({open:P,onOpenChange:me,elements:{reference:Ce,floating:be}}),qe=R1(Ge,{enabled:!$,event:"mousedown"}),ht=Sf(Ge),pe=NO(Ge,{enabled:!$,listRef:Z,activeIndex:Ye,selectedIndex:Ee,disabledIndices:Tr,onNavigate(ct){ct===null&&!P||we.set("activeIndex",ct)},focusItemOnHover:E}),De=CO(Ge,{enabled:!$&&(P||!x&&!k),listRef:te,activeIndex:Ye,selectedIndex:Ee,disabledIndices:ct=>YA(Z.current[ct]),onMatch(ct){P?we.set("activeIndex",ct):Me(ee.current[ct],bt(Er))},onTyping(ct){W.current=ct}}),Qe=b.useMemo(()=>Ks(De.reference,pe.reference,ht.reference,qe.reference,Be),[qe.reference,De.reference,pe.reference,ht.reference,Be]),Fe=b.useMemo(()=>Ks(Nf,De.floating,pe.floating,ht.floating),[De.floating,pe.floating,ht.floating]),yt=pe.item??gn;we.useContextCallback("setValue",Me),we.useContextCallback("setOpen",me),we.useContextCallback("handleScrollArrowVisibility",nt),we.useContextCallback("onOpenChangeComplete",C),e$(()=>{we.update({popupProps:Fe,triggerProps:Qe})}),we.useSyncedValues({id:X,modal:j,multiple:k,value:K,open:P,mounted:J,transitionStatus:xe,popupProps:Fe,triggerProps:Qe,items:T,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:M,openMethod:Je});const Et=b.useMemo(()=>({disabled:$,readOnly:x,required:v,multiple:k,highlightItemOnHover:E,itemProps:yt}),[$,x,v,k,E,yt]),Nt=no(N,V.inputRef),Vt=k?void 0:Q,Ct=b.useMemo(()=>!k||!Array.isArray(K)||!Q?null:K.map(ct=>{const vt=Gc(ct,R);return s.jsx("input",{type:"hidden",form:h,name:Q,value:vt,disabled:$},vt)}),[k,K,h,Q,R,$]);return s.jsxs(kO.Provider,{value:we,children:[s.jsx(TO.Provider,{value:Et,children:s.jsx(EO.Provider,{value:Ge,children:O})}),s.jsx("input",{...V.getValidationProps($,{onFocus(){var ct;(ct=we.state.triggerElement)==null||ct.focus({focusVisible:!0})},onChange(ct){if(ct.nativeEvent.defaultPrevented||$||x)return;const vt=ct.currentTarget.value,ae=bt(Er,ct.nativeEvent);function Xe(){if(k)return;const ut=vt.toLowerCase();let Ft=ee.current.findIndex(zt=>Gc(zt,R).toLowerCase()===ut||DO(zt,A).toLowerCase()===ut);Ft===-1&&(Ft=ee.current.findIndex((zt,_t)=>{const On=te.current[_t];return On!=null&&On.toLowerCase()===ut}));const An=ee.current[Ft];An!=null&&Me(An,ae)}we.set("forceMount",!0),queueMicrotask(Xe)}}),id:X&&Vt==null?`${X}-hidden-input`:void 0,form:h,name:Vt,autoComplete:g,value:dt,disabled:$,required:v&&!(k&&We),readOnly:x,ref:Nt,style:Q?j1:Ng,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ct]})}function UB(e,t){return e??t}const gh=5;function _O(e,t){const r=HB(t);return e.clientX>=r.left-gh&&e.clientX<=r.right+gh&&e.clientY>=r.top-gh&&e.clientY<=r.bottom+gh}function HB(e){const t=e.getBoundingClientRect(),r=xn(e);if(d1)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),x=g-t.width,v=p-t.height;return{left:t.left-x/2,right:t.right+x/2,top:t.top-v/2,bottom:t.bottom+v/2}}const FB="data-popup-side",GB=400,qB={...vp,...ug,popupSide:e=>e?{[FB]:e}:null,value:()=>null},YB=b.forwardRef(function(t,r){var oe;const{render:a,className:l,id:c,disabled:u=!1,nativeButton:f=!0,style:m,...h}=t,{setTouched:g,setFocused:p,validationMode:x,validation:v,state:j,disabled:S}=bu(),{labelId:N}=pf(),C=ta(),{readOnly:T,required:k,disabled:A}=Ig(),R=S||A||u,M=C.useState("open"),E=C.useState("mounted"),O=C.useState("value"),z=C.useState("triggerProps"),_=C.useState("positionerElement"),B=C.useState("listElement"),q=C.useState("popupSide"),I=C.useState("id"),L=C.useState("labelId"),H=C.useState("hasSelectedValue"),F=E&&_?q:null,V=c??I,G=UB(N,L);gf({id:c});const X=Ln(_),$=b.useRef(null),{getButtonProps:Q,buttonRef:K}=ao({disabled:R,native:f}),se=C.useStateSetter("triggerElement"),P=ts(),U=ts(),Z=ts();b.useEffect(()=>{if(M)return Z.start(GB,()=>{C.context.selectionRef.current.allowUnselectedMouseUp=!0,C.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{Z.clear()};C.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[M,C,U,Z]);const te=Ks(z,{id:V,role:"combobox","aria-expanded":M,"aria-haspopup":"listbox","aria-controls":M?(B==null?void 0:B.id)??((oe=jp(_))==null?void 0:oe.id):void 0,"aria-labelledby":G,"aria-readonly":T||void 0,"aria-required":k||void 0,tabIndex:R?-1:0,onFocus(ne){p(!0),M&&C.context.alignItemWithTriggerActiveRef.current&&C.context.setOpen(!1,bt(Er,ne.nativeEvent)),P.start(0,()=>{C.set("forceMount",!0)})},onBlur(ne){pt(_,ne.relatedTarget)||(g(!0),p(!1),x==="onBlur"&&v.commit(O))},onMouseDown(ne){if(M)return;const ee=Gt(ne.currentTarget);function W(ce){if(!$.current)return;const Re=ce.target;pt($.current,Re)||pt(X.current,Re)||_O(ce,$.current)||C.context.setOpen(!1,bt(LA,ce))}U.start(0,()=>{ee.addEventListener("mouseup",W,{once:!0})})}},h,Q),le=v.getValidationProps(R,te);le.role="combobox";const de={...j,open:M,disabled:R,value:O,readOnly:T,popupSide:F,placeholder:!H};return jt("button",t,{ref:[r,$,K,se],state:de,stateAttributesMapping:qB,props:le})}),KB={value:()=>null},XB=b.forwardRef(function(t,r){const{className:a,render:l,children:c,placeholder:u,style:f,...m}=t,h=ta(),g=h.useState("value"),p=h.useState("items"),x=h.useState("itemToStringLabel"),v=h.useState("hasSelectedValue"),j=!v&&u!=null&&c==null,S=h.useState("hasNullItemLabel",j),N={value:g,placeholder:!v};let C=null;return typeof c=="function"?C=c(g):c!=null?C=c:j&&!S?C=u:Array.isArray(g)?C=LB(g,p,x):C=zO(g,p,x),jt("span",t,{state:N,ref:[r,h.context.valueRef],props:[{children:C},m],stateAttributesMapping:KB})}),WB=b.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,h={open:ta().useState("open")};return jt("span",t,{state:h,ref:r,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:h1})}),QB=b.forwardRef(function(t,r){const a=ta(),l=a.useState("mounted"),c=a.useState("forceMount");return l||c?s.jsx(Cg,{ref:r,...t}):null});function kf(e){return i1(19)?e:e?"true":void 0}const LO=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function ZB(){return b.useContext(LO)}function Tf(e){const{children:t,elementsRef:r,labelsRef:a,onMapChange:l}=e,c=et(l),[,u]=b.useState(!1),f=ds(eV).current,m=ds(JB).current,h=b.useRef(0),g=b.useRef(!0),p=b.useRef(null),x=b.useRef(null),v=et(()=>{g.current||(g.current=!0,u(R=>!R))}),j=et((R,M)=>{m.set(R,M),v()}),S=et(R=>{m.delete(R),v()}),N=et(R=>{const M=new Map;return r.current.length=0,a&&(a.current.length=0),R.forEach(E=>{var O,z;M.set(E.element,{...E.registration.metadata??{},index:E.index}),r.current[E.index]=E.element,a&&(a.current[E.index]=E.registration.label!==void 0?E.registration.label:((z=(O=E.registration.textRef)==null?void 0:O.current)==null?void 0:z.textContent)??E.element.textContent)}),h.current=r.current.length,M});function C(R){var O;if((O=x.current)==null||O.disconnect(),x.current=null,typeof MutationObserver!="function"||R.length<2)return;const M=new MutationObserver(z=>{if(!sV(z))return;let _=null;for(const B of R)if(B.isConnected){if(_&&$O(_,B)>0){M.disconnect(),v();return}_=B}});x.current=M;const E=new Set;for(let z=1;z<R.length;z+=1){const _=nV(R[z-1],R[z]);_&&E.add(_)}E.forEach(z=>M.observe(z,{childList:!0}))}const T=et(()=>{const[R,M]=tV(m),E=N(R),O=p.current,z=!O||O.length!==R.length||R.some((_,B)=>{const q=O[B];return _.index!==q.index||_.element!==q.element||_.registration.index!==q.registration.index||_.registration.metadata!==q.registration.metadata});C(M),p.current=R,g.current=!1,z&&(f.forEach(_=>_(E)),c(E))});Ke(()=>(!g.current&&p.current&&N(p.current),()=>{r.current=[],a&&(a.current=[])}),[r,a,N]),Ke(()=>{g.current&&T()}),Ke(()=>()=>{var R;(R=x.current)==null||R.disconnect(),g.current=!0},[]);const k=et(R=>(f.add(R),()=>{f.delete(R)})),A=b.useMemo(()=>({register:j,unregister:S,subscribeMapChange:k,nextIndexRef:h}),[j,S,k,h]);return s.jsx(LO.Provider,{value:A,children:t})}function JB(){return new Map}function eV(){return new Set}function tV(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)=>$O(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 nV(e,t){let r=e.parentElement;for(;r&&!r.contains(t);)r=r.parentElement;return r}function sV(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 $O(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const rV=b.createContext(void 0);function _g(){const e=b.useContext(rV);return(e==null?void 0:e.direction)??"ltr"}const oV=e=>({name:"arrow",options:e,async fn(t){var X,$;const{x:r,y:a,placement:l,rects:c,platform:u,elements:f,middlewareData:m}=t,{element:h,padding:g=0,offsetParent:p="real"}=zi(e,t)||{};if(h==null)return{};const x=kA(g),v={x:r,y:a},j=b1(l),S=x1(j),N=await u.getDimensions(h),C=j==="y",T=C?"top":"left",k=C?"bottom":"right",A=C?"clientHeight":"clientWidth",R=c.reference[S]+c.reference[j]-v[j]-c.floating[S],M=v[j]-c.reference[j],E=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(($=u.isElement)==null?void 0:$.call(u,E)))&&(O=f.floating[A]||c.floating[S]);const z=R/2-M/2,_=O/2-N[S]/2-1,B=Math.min(x[T],_),q=Math.min(x[k],_),I=B,L=O-N[S]-q,H=O/2-N[S]/2+z,F=CA(I,H,L),V=!m.arrow&&Oa(l)!=null&&H!==F&&c.reference[S]/2-(H<I?B:q)-N[S]/2<0,G=V?H<I?H-I:H-L:0;return{[j]:v[j]+G,data:{[j]:F,centerOffset:H-F-G,...V&&{alignmentOffset:G}},reset:V}}}),aV=(e,t)=>{const{name:r,fn:a}=oV(e);return{name:r,fn:a,options:[e,t]}},iV={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}}}},lV={sideX:"left",sideY:"top"},cV="--available-width",uV="--available-height",dV="--anchor-width",fV="--anchor-height",mV="--transform-origin",ck=cV,uk=uV;function BO(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 dk(e,t,r){const{rects:a,placement:l}=e;return{side:BO(t,eo(l),r),align:Oa(l)||"center",anchor:{width:a.reference.width,height:a.reference.height},positioner:{width:a.floating.width,height:a.floating.height}}}function Lg(e){return hV(e,jB)}function hV(e,t){var ht,pe;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:x=!1,inline:v,keepMounted:j=!1,floatingRootContext:S,mounted:N,collisionAvoidance:C,shift:T,nodeId:k,adaptiveOrigin:A,lazyFlip:R=!1,externalTree:M}=e,[E,O]=b.useState(null);!N&&E!==null&&O(null);const z=C.side||"flip",_=C.align||"flip",B=C.fallbackAxisSide||"end",q=(T==null?void 0:T.crossAxis)??!1,I=T==null?void 0:T.rootBoundary,L=typeof r=="function"?r:void 0,H=et(L),F=L?H:r,V=Ln(r),G=Ln(N),$=_g()==="rtl",Q=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":$?"left":"right","inline-start":$?"right":"left"}[l],K=u==="center"?Q:`${Q}-${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 P=1,U=l==="bottom"?P:0,Z=l==="top"?P:0,te=l==="right"?P:0,le=l==="left"?P:0,de={boundary:m==="clipping-ancestors"?"clippingAncestors":m,padding:se},oe=b.useRef(null),ne=Ln(c),ee=Ln(f),W=typeof c!="function"?c:0,ce=typeof f!="function"?f:0,Re=[];v&&Re.push(v),Re.push(fB(De=>{const Qe=dk(De,l,$),Fe=typeof ne.current=="function"?ne.current(Qe):ne.current,yt=typeof ee.current=="function"?ee.current(Qe):ee.current;return{mainAxis:Fe,crossAxis:yt,alignmentAxis:yt}},[W,ce,$,l]));const _e=_==="none"&&z!=="shift",Ne=!_e&&(g||q||z==="shift"),Ae=z==="none"?null:pB({...de,padding:{top:se.top+P+U,right:se.right+P+le,bottom:se.bottom+P+Z,left:se.left+P+te},mainAxis:!q&&z==="flip",crossAxis:_==="flip"?"alignment":!1,fallbackAxisSideDirection:B}),J=_e?null:mB({...de,rootBoundary:I,mainAxis:_!=="none",crossAxis:Ne,limiter:g||q?void 0:hB(De=>{if(!oe.current)return{};const{width:Qe,height:Fe}=oe.current.getBoundingClientRect(),yt=Zr(eo(De.placement)),Et=yt==="y"?Qe:Fe,Nt=yt==="y"?se.left+se.right:se.top+se.bottom;return{offset:Et/2+Nt/2}})},[de,g,q,I,se,_]);z==="shift"||_==="shift"||u==="center"?Re.push(J,Ae):Re.push(Ae,J),Re.push(gB({...de,apply({elements:{floating:De},availableWidth:Qe,availableHeight:Fe,rects:yt}){if(!G.current)return;const Et=De.style;Et.setProperty(ck,`${Qe}px`),Et.setProperty(uk,`${Fe}px`);const Nt=xn(De).devicePixelRatio||1,{x:Vt,y:Ct,width:ct,height:vt}=yt.reference,ae=(Math.round((Vt+ct)*Nt)-Math.round(Vt*Nt))/Nt,Xe=(Math.round((Ct+vt)*Nt)-Math.round(Ct*Nt))/Nt;Et.setProperty(dV,`${ae}px`),Et.setProperty(fV,`${Xe}px`)}}),aV(De=>({element:oe.current||Gt(De.elements.floating).createElement("div"),padding:oe.current?p:0,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(De){var An,zt,_t,On,io,vs;const{elements:{floating:Qe},middlewareData:Fe,placement:yt,platform:Et,rects:Nt,y:Vt}=De,Ct=eo(yt),ct=Oa(yt),vt=Zr(Ct)==="y",ae=oe.current,Xe=typeof c=="function"?c(dk(De,l,$)):c;let ut;if(!ae&&ct&&Math.abs(vt?((An=Fe.shift)==null?void 0:An.x)||0:((zt=Fe.shift)==null?void 0:zt.y)||0)<=1)ut=ct==="start"===(vt&&((_t=Et.isRTL)==null?void 0:_t.call(Et,Qe))===!0)?"100%":"0%";else{const Lr=vt?((On=Fe.arrow)==null?void 0:On.x)||0:((io=Fe.arrow)==null?void 0:io.y)||0,$s=vt?(ae==null?void 0:ae.clientWidth)||0:(ae==null?void 0:ae.clientHeight)||0;ut=`${Lr+$s/2}px`}let Ft=Ct==="top"||Ct==="left"?`calc(100% + ${Xe}px)`:`${-Xe}px`;return Ne&&vt&&Math.abs(((vs=Fe.shift)==null?void 0:vs.y)||0)>Xe&&(Ft=`${Nt.reference.y+Nt.reference.height/2-Vt}px`),Qe.style.setProperty(mV,vt?`${ut} ${Ft}`:`${Ft} ${ut}`),{}}},iV,A),Ke(()=>{!N&&S&&S.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[N,S]);const re=b.useMemo(()=>({ancestorScroll:!x,elementResize:!x&&typeof ResizeObserver<"u",layoutShift:!x&&typeof IntersectionObserver<"u"}),[x]),{refs:xe,elements:he,x:Be,y:we,middlewareData:Ye,update:Ee,placement:Ce,context:be,isPositioned:Ue,floatingStyles:Je}=t({rootContext:S,open:j?N:void 0,placement:K,middleware:Re,strategy:a,whileElementsMounted:j?void 0:(...De)=>sk(...De,re),nodeId:k,externalTree:M}),{sideX:dt,sideY:lt}=Ye.adaptiveOrigin||lV,Ie=Ue?a:"fixed",ot=b.useMemo(()=>{let De;return Ue?A?De={position:Ie,[dt]:Be,[lt]:we}:De={...Je,position:Ie}:De={position:Ie,top:0,left:0},De[ck]="100vw",De[uk]="100vh",Ue||(De.opacity=0),De},[A,Ie,dt,Be,lt,we,Je,Ue]),We=b.useRef(null);Ke(()=>{if(!N)return;const De=V.current,Qe=typeof De=="function"?De():De,yt=(fk(Qe)?Qe.current:Qe)||null||null;yt!==We.current&&(xe.setPositionReference(yt),We.current=yt)},[N,xe,F,V]),b.useEffect(()=>{if(!N)return;const De=V.current;typeof De!="function"&&fk(De)&&De.current!==We.current&&(xe.setPositionReference(De.current),We.current=De.current)},[N,xe,F,V]),b.useEffect(()=>{if(j&&N&&he.reference&&he.floating)return sk(he.reference,he.floating,Ee,re)},[j,N,he,Ee,re]);const me=eo(Ce),Oe=BO(l,me,$),Me=Oa(Ce)||"center",nt=!!((ht=Ye.hide)!=null&&ht.referenceHidden);Ke(()=>{R&&N&&Ue&&me!==Q&&O(me)},[R,N,Ue,me,Q]);const Ge=b.useMemo(()=>{var De,Qe;return{position:"absolute",top:(De=Ye.arrow)==null?void 0:De.y,left:(Qe=Ye.arrow)==null?void 0:Qe.x}},[Ye.arrow]),qe=((pe=Ye.arrow)==null?void 0:pe.centerOffset)!==0;return b.useMemo(()=>({positionerStyles:ot,arrowStyles:Ge,arrowRef:oe,arrowUncentered:qe,side:Oe,align:Me,physicalSide:me,anchorHidden:nt,refs:xe,context:be,isPositioned:Ue,update:Ee}),[ot,Ge,oe,qe,Oe,Me,me,nt,xe,be,Ue,Ee])}function fk(e){return e!=null&&"current"in e}const VO=b.createContext(void 0);function H1(){const e=b.useContext(VO);if(!e)throw new Error(Jt(59));return e}const $g=b.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 Ap(e,t){e&&Object.assign(e.style,t)}const UO={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};function Ef(e){return e==="starting"?N$:gn}function Bg(e,t,{styles:r,transitionStatus:a,props:l,refs:c,hidden:u,inert:f=!1}){const m={...r};return f&&(m.pointerEvents="none"),jt("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:u,style:m},Ef(a),l],stateAttributesMapping:xf})}let mk={},hk={},pk="";function Vg(e,t){return hf(e)?e:t}function gk(e,t,r){return/hidden|clip/.test(e.getComputedStyle(Vg(t,r)).overflowY)}function pV(e){if(typeof document>"u")return!1;const t=Gt(e);return xn(t).innerWidth-t.documentElement.clientWidth>0}function gV(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=Gt(e),a=r.documentElement,l=r.body,c=Vg(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 xV(e){const t=Gt(e),r=t.documentElement,a=t.body,l=Vg(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 bV(e){var v;const t=Gt(e),r=t.documentElement,a=t.body,l=xn(r);let c=0,u=0,f=!1;const m=ar.create();if(Ua&&(((v=l.visualViewport)==null?void 0:v.scale)??1)!==1)return()=>{};function h(){const j=l.getComputedStyle(r),S=l.getComputedStyle(a),T=(j.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=r.scrollTop,u=r.scrollLeft,mk={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},pk=r.style.scrollBehavior,hk={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 k=r.scrollHeight>r.clientHeight,A=r.scrollWidth>r.clientWidth,R=j.overflowY==="scroll"||S.overflowY==="scroll",M=j.overflowX==="scroll"||S.overflowX==="scroll",E=Math.max(0,l.innerWidth-a.clientWidth),O=Math.max(0,l.innerHeight-a.clientHeight),z=parseFloat(S.marginTop)+parseFloat(S.marginBottom),_=parseFloat(S.marginLeft)+parseFloat(S.marginRight),B=Vg(r,a);if(f=gV(e),f){r.style.scrollbarGutter=T,B.style.overflowY="hidden",B.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:T,overflowY:"hidden",overflowX:"hidden"}),(k||R)&&(r.style.overflowY="scroll"),(A||M)&&(r.style.overflowX="scroll"),Object.assign(a.style,{position:"relative",height:z||O?`calc(100dvh - ${z+O}px)`:"100dvh",width:_||E?`calc(100vw - ${_+E}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,mk),Object.assign(a.style,hk),f||(r.scrollTop=c,r.scrollLeft=u,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=pk)}function p(){g(),m.request(h)}h();const x=Lt(l,"resize",p);return()=>{m.cancel(),g(),typeof l.removeEventListener=="function"&&x()}}class yV{constructor(){tn(this,"lockCount",0);tn(this,"restore",null);tn(this,"timeoutLock",so.create());tn(this,"timeoutUnlock",so.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=Gt(t),a=r.documentElement,l=r.body,c=xn(a);if(gk(c,a,l)){const f=new c.MutationObserver(()=>{gk(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=mg||!pV(t);this.restore=u?xV(t):bV(t)}}const vV=new yV;function HO(e=!0,t=null){Ke(()=>{if(e)return vV.acquire(t)},[e,t])}const wV=20;function F1(e,t,r,a){const[l,c]=b.useState(!1);Ke(()=>{if(!e||!t||r==null){c(!1);return}const u=Gt(r).documentElement.clientWidth,f=r.offsetWidth;c(u>0&&f>0&&f>=u-wV)},[e,t,r]),HO(e&&(!t||l),a)}const jV={position:"fixed"},SV=b.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:x,arrowPadding:v,sticky:j,disableAnchorTracking:S,alignItemWithTrigger:N=!0,collisionAvoidance:C=tO,style:T,...k}=t,A=ta(),R=RO(),M=A.useState("open"),E=A.useState("mounted"),O=A.useState("modal"),z=A.useState("value"),_=A.useState("openMethod"),B=A.useState("positionerElement"),q=A.useState("triggerElement"),I=A.useState("isItemEqualToValue"),L=A.useState("transitionStatus"),H=b.useRef(null),F=b.useRef(null),[V,G]=b.useState(N),X=E&&V&&_!=="touch";!E&&V!==N&&G(N),b.useImperativeHandle(A.context.alignItemWithTriggerActiveRef,()=>X),F1((X||O)&&M,_==="touch",B,q);const $=Lg({anchor:a,floatingRootContext:R,positionMethod:u,mounted:E,side:f,sideOffset:h,align:m,alignOffset:g,arrowPadding:v,collisionBoundary:p,collisionPadding:x,sticky:j,disableAnchorTracking:S??X,collisionAvoidance:C,keepMounted:!0}),Q=X?"none":$.side,K=X?jV:$.positionerStyles,se={open:M,side:Q,align:$.align,anchorHidden:$.anchorHidden};Ke(()=>{A.set("popupSide",$.side)},[A,$.side]);const P=A.useStateSetter("positionerElement"),U=Bg(t,se,{styles:K,transitionStatus:L,props:k,refs:[r,P],hidden:!E,inert:!M}),Z=b.useRef(0),te=et(de=>{if(A.context.valuesRef.current.length===0)return;const oe=Z.current;Z.current=de.size;const ne=bt(Er);if(oe!==0&&!A.state.multiple&&z!==null&&Gh(A.context.valuesRef.current,z,I)===-1){const W=A.context.initialValueRef.current,Re=W!=null&&Gh(A.context.valuesRef.current,W,I)!==-1?W:null;A.context.setValue(Re,ne),Re===null&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null)}if(oe!==0&&A.state.multiple&&Array.isArray(z)){const ee=z.filter(W=>Gh(A.context.valuesRef.current,W,I)!==-1);ee.length!==z.length&&(A.context.setValue(ee,ne),ee.length===0&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null))}if(M&&X){A.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ee={height:""};Ap(B,ee),Ap(A.context.popupRef.current,ee)}}),le=b.useMemo(()=>({...$,side:Q,alignItemWithTriggerActive:X,setControlledAlignItemWithTrigger:G,scrollUpArrowRef:H,scrollDownArrowRef:F}),[$,Q,X,G]);return s.jsx(Tf,{elementsRef:A.context.listRef,labelsRef:A.context.labelsRef,onMapChange:te,children:s.jsxs(VO.Provider,{value:le,children:[E&&O&&s.jsx($g,{inert:kf(!M),cutout:q}),U]})})}),xh="base-ui-disable-scrollbar",nv={className:xh,getElement(e){return s.jsx("style",{nonce:e,href:xh,precedence:"base-ui:low",children:`.${xh}{scrollbar-width:none}.${xh}::-webkit-scrollbar{display:none}`})}},NV=b.createContext(void 0);function Ug(e){return b.useContext(NV)}const sv="ArrowUp",rv="ArrowDown",ov="ArrowLeft",av="ArrowRight",iv="Home",lv="End",Rf=new Set([sv,rv,ov,av,iv,lv]),CV="Shift",kV=[CV,"Control","Alt","Meta"];function TV(e){return cn(e)&&e.tagName==="INPUT"}function xk(e){return!!(TV(e)&&e.selectionStart!=null||cn(e)&&e.tagName==="TEXTAREA")}function bk(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=yk(e,t,"left"),h=bh(e),g=bh(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=yk(e,t,"top"),h=bh(e),g=bh(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 yk(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 bh(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 EV=b.createContext(void 0),RV={disableStyleElements:!1};function AV(){return b.useContext(EV)??RV}const vk="--transform-origin",OV={...xf,...Ha},MV=b.forwardRef(function(t,r){const{render:a,className:l,style:c,finalFocus:u,...f}=t,m=ta(),{multiple:h,readOnly:g,highlightItemOnHover:p}=Ig(),x=RO(),{side:v,align:j,alignItemWithTriggerActive:S,isPositioned:N,setControlledAlignItemWithTrigger:C}=H1(),T=Ug()!=null,k=_g(),{nonce:A,disableStyleElements:R}=AV(),M=m.useState("id"),E=m.useState("open"),O=m.useState("openMethod"),z=m.useState("mounted"),_=m.useState("popupProps"),B=m.useState("transitionStatus"),q=m.useState("triggerElement"),I=m.useState("positionerElement"),L=m.useState("listElement"),H=b.useRef(!1),F=b.useRef(!1),V=b.useRef({}),G=cu(),X=et(se=>{if(!I||!m.context.popupRef.current||!F.current)return;const P=I.style.top==="0px",U=I.style.bottom==="0px";if(H.current||!S||!P&&!U){m.context.handleScrollArrowVisibility(se);return}const Z=jk(I),te=Md(I.getBoundingClientRect().height,"y",Z),le=Gt(I),de=xn(I),oe=de.getComputedStyle(I),ne=parseFloat(oe.marginTop),ee=parseFloat(oe.marginBottom),W=wk(de.getComputedStyle(m.context.popupRef.current)),ce=Math.min(le.documentElement.clientHeight-ne-ee,W),Re=se.scrollTop,_e=yh(se);let Ne=null;const Ae=he=>{I.style.height=`${he}px`},J=P?_e-Re:Re,re=Math.min(te+J,ce);if(J<=yo){const he=Od(J,0,ce-te);he>0&&Ae(te+he),se.scrollTop=P?_e:0,ce-(te+he)<=yo&&(H.current=!0),m.context.handleScrollArrowVisibility(se);return}if(ce-re>yo)Ne=P?1/0:0;else if(U&&Re<_e){const he=te+J-ce;Ne=Re-(J-he)}const xe=Math.ceil(re);if(xe!==0&&Ae(xe),Ne!=null){const he=Od(Ne,0,yh(se));Math.abs(se.scrollTop-he)>yo&&(se.scrollTop=he)}xe>=ce-yo&&(H.current=!0),m.context.handleScrollArrowVisibility(se)});b.useImperativeHandle(m.context.scrollHandlerRef,()=>X,[X]),lr({open:E,ref:m.context.popupRef,onComplete(){E&&m.context.onOpenChangeComplete(!0)}});const $={open:E,transitionStatus:B,side:v,align:j};Ke(()=>{!I||!m.context.popupRef.current||Object.keys(V.current).length||(V.current={top:I.style.top||"0",left:I.style.left||"0",right:I.style.right,height:I.style.height,bottom:I.style.bottom,minHeight:I.style.minHeight,maxHeight:I.style.maxHeight,marginTop:I.style.marginTop,marginBottom:I.style.marginBottom})},[m,I]),Ke(()=>{E||S||(F.current=!1,H.current=!1,Ap(I,V.current))},[E,S,I]),Ke(()=>{var U,Z;const se=m.context.popupRef.current;if(!E||!q||!I||!se||S&&!N||m.state.transitionStatus==="ending")return;if(F.current=!0,se.style.removeProperty(vk),!S){G.request(()=>m.context.handleScrollArrowVisibility(L||se));return}const P=DV(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,de=xn(I),oe=de.getComputedStyle(I),ne=de.getComputedStyle(se),ee=Gt(q),W=jk(q),ce=vh(q.getBoundingClientRect(),W),Re=vh(I.getBoundingClientRect(),W),_e=ce.height,Ne=L||se,Ae=Ne.scrollHeight,J=parseFloat(ne.borderBottomWidth),re=parseFloat(oe.marginTop)||10,xe=parseFloat(oe.marginBottom)||10,he=parseFloat(oe.minHeight)||100,Be=wk(ne),we=5,Ye=5,Ee=20,Ce=ee.documentElement.clientHeight-re-xe,be=ee.documentElement.clientWidth,Ue=Ce-ce.bottom+_e;let Je,dt=k==="rtl"?ce.right-Re.width:ce.left,lt=0;if(te&&le){const pe=vh(le.getBoundingClientRect(),W);Je=vh(te.getBoundingClientRect(),W),dt=Re.left+(k==="rtl"?pe.right-Je.right:pe.left-Je.left);const De=pe.top-ce.top+pe.height/2;lt=Je.top-Re.top+Je.height/2-De}const Ie=Ue+lt+xe+J;let ot=Math.min(Ce,Ie);const We=Ce-re-xe,me=Ie-ot,Oe=be-Ye;I.style.left=`${Od(dt,we,Oe-Re.width)}px`,I.style.height=`${ot}px`,I.style.maxHeight="none",I.style.marginTop=`${re}px`,I.style.marginBottom=`${xe}px`,se.style.height="100%";const Me=yh(Ne),nt=me>=Me-yo;nt&&(ot=Math.min(Ce,Re.height)-(me-Me));const Ge=ce.top<Ee||ce.bottom>Ce-Ee||Math.ceil(ot)+yo<Math.min(Ae,he),qe=(((Z=de.visualViewport)==null?void 0:Z.scale)??1)!==1&&Ua;if(Ge||qe){Ap(I,V.current),C(!1);return}const ht=Math.max(he,ot);if(nt){const pe=Math.max(0,Ce-Ie);I.style.top=Re.height>=We?"0":`${pe}px`,I.style.height=`${ot}px`,Ne.scrollTop=yh(Ne)}else I.style.bottom="0",Ne.scrollTop=me;if(Je){const pe=Re.top,De=Re.height,Qe=Je.top+Je.height/2,Fe=Od(De>0?(Qe-pe)/De*100:50,0,100);se.style.setProperty(vk,`50% ${Fe}%`)}(ht===Ce||ot>=Be)&&(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{P()}},[m,E,I,q,S,C,G,L,p,k,N]),b.useEffect(()=>{if(!S||!I||!E)return;const se=xn(I);function P(U){m.context.setOpen(!1,bt(f8,U))}return Lt(se,"resize",P)},[m,S,I,E]);const Q={...L?{role:"presentation"}:{role:"listbox","aria-multiselectable":h||void 0,"aria-readonly":g||void 0,id:`${M}-list`},onKeyDown(se){T&&Rf.has(se.key)&&se.stopPropagation()},onScroll(se){L||X(se.currentTarget)},...S&&{style:L?{height:"100%"}:UO},className:!L&&S?nv.className:void 0},K=jt("div",t,{ref:[r,m.context.popupRef],state:$,stateAttributesMapping:OV,props:[_,Q,Ef(B),f]});return s.jsxs(b.Fragment,{children:[!R&&nv.getElement(A),s.jsx(kg,{context:x,modal:!1,disabled:!z,openInteractionType:O,returnFocus:u,restoreFocus:!0,children:K})]})});function wk(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function yh(e){return U1(e.scrollHeight,e.clientHeight)}function jk(e){return pO.getScale(e)}function Md(e,t,r){return e/r[t]}function vh(e,t){return Xd({x:Md(e.x,"x",t),y:Md(e.y,"y",t),width:Md(e.width,"x",t),height:Md(e.height,"y",t)})}const Sk=[["transform","none"],["scale","1"],["translate","0 0"]];function DV(e){const{style:t}=e,r={};for(const[a,l]of Sk)r[a]=t.getPropertyValue(a),t.setProperty(a,l,"important");return()=>{for(const[a]of Sk){const l=r[a];l?t.setProperty(a,l):t.removeProperty(a)}}}const zV=b.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,f=ta(),{multiple:m,readOnly:h}=Ig(),{alignItemWithTriggerActive:g}=H1(),p=f.useState("hasScrollArrows"),x=f.useState("openMethod"),j={id:`${f.useState("id")}-list`,role:"listbox","aria-multiselectable":m||void 0,"aria-readonly":h||void 0,onScroll(N){var C,T;(T=(C=f.context.scrollHandlerRef).current)==null||T.call(C,N.currentTarget)},...g&&{style:UO},className:p&&x!=="touch"?nv.className:void 0},S=f.useStateSetter("listElement");return jt("div",t,{ref:[r,S],props:[j,u]})});function Ql(e={}){const{guess:t,label:r,metadata:a,textRef:l,index:c}=e,{register:u,unregister:f,subscribeMapChange:m,nextIndexRef:h}=ZB(),g=b.useRef(-1),[p,x]=b.useState(c==null&&t?()=>{if(g.current===-1){const N=h.current;h.current+=1,g.current=N}return g.current}:-1),v=c??p,j=b.useRef(null),S=b.useCallback(N=>{const C=j.current;C&&f(C),j.current=N,N&&u(N,{metadata:a??null,index:c??null,label:r,textRef:l})},[c,u,f,a,r,l]);return Ke(()=>{if(c==null)return m(N=>{var T;const C=j.current?(T=N.get(j.current))==null?void 0:T.index:null;C!=null&&x(C)})},[c,m]),{ref:S,index:v}}const FO=b.createContext(void 0);function G1(){const e=b.useContext(FO);if(!e)throw new Error(Jt(57));return e}const PV=b.memo(b.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=b.useRef(null),x=Ql({guess:!0,label:f,textRef:p}),v=ta(),{itemProps:j,multiple:S,disabled:N,readOnly:C}=Ig(),T=N||m,k=v.useState("isActive",x.index),A=v.useState("open"),R=v.useState("isSelected",u),M=v.useState("isSelectedByFocus",x.index),E=v.useState("isItemEqualToValue"),O=x.index,z=b.useRef(null);Ke(()=>{const $=v.context.valuesRef.current;return $[O]=u,()=>{delete $[O]}},[O,u,v]),Ke(()=>{const $=v.state.value,Q=v.state.selectedIndex;let K=Q,se;S&&Array.isArray($)?(K=DB(O,u,v.context.valuesRef.current,$,E,Q),se=K===O,O===Q&&!se&&(v.context.selectedItemTextRef.current=null)):(se=$!==void 0&&Ul(u,$,E),se&&(K=O)),v.set("selectedIndex",K),se&&p.current&&(v.context.selectedItemTextRef.current=p.current)},[O,S,E,v,u]);const _=b.useRef("mouse"),B=b.useRef(!1),{getButtonProps:q,buttonRef:I}=ao({disabled:T,focusableWhenDisabled:!0,native:h,composite:!0}),L={disabled:T,selected:R,highlighted:k};function H($){if(N||C)return;const Q=v.state.value;if(S){const K=Array.isArray(Q)?Q:[],se=R?zB(K,u,E):[...K,u];v.context.setValue(se,bt(Dl,$))}else v.context.setValue(u,bt(Dl,$)),v.context.setOpen(!1,bt(Dl,$))}function F(){v.context.selectionRef.current.dragY=0}const V={role:"option","aria-selected":R,tabIndex:A&&k?0:-1,onKeyDown($){v.set("activeIndex",O),$.key===" "&&v.context.typingRef.current&&$.preventDefault()},onClick($){const Q=_.current!=="touch",K=$.nativeEvent.pointerType,se=Q&&bg($.nativeEvent)&&(K!==void 0||k),P=Q&&!se&&!B.current;B.current=!1,!(T||P)&&H($.nativeEvent)},onPointerEnter($){_.current=$.pointerType},onPointerMove($){if($.pointerType==="mouse"&&$.buttons===1){const Q=v.context.selectionRef.current;Q.dragY+=$.movementY,Q.dragY**2>=64&&(Q.allowUnselectedMouseUp=!0)}},onPointerDown($){_.current=$.pointerType,B.current=!0,F()},onMouseUp(){var K;if(F(),T||_.current==="touch"||B.current)return;const $=!v.context.selectionRef.current.allowSelectedMouseUp&&R,Q=!v.context.selectionRef.current.allowUnselectedMouseUp&&!R;$||Q||(B.current=!0,(K=z.current)==null||K.click(),B.current=!1)}},G=jt("div",t,{ref:[I,r,x.ref,z],state:L,props:[j,V,g,q]}),X=b.useMemo(()=>({selected:R,index:O,textRef:p,selectedByFocus:M}),[R,O,p,M]);return s.jsx(FO.Provider,{value:X,children:G})})),IV=b.forwardRef(function(t,r){const{selected:a}=G1();return t.keepMounted||a?s.jsx(_V,{...t,ref:r}):null}),_V=b.memo(b.forwardRef((e,t)=>{const{render:r,className:a,style:l,keepMounted:c,...u}=e,{selected:f}=G1(),m=b.useRef(null),{transitionStatus:h,setMounted:g}=Fa(f),x=jt("span",e,{ref:[t,m],state:{selected:f,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:Ha});return lr({batch:!0,enabled:!f,open:f,ref:m,onComplete(){f||g(!1)}}),x})),LV=b.memo(b.forwardRef(function(t,r){const{index:a,textRef:l,selectedByFocus:c}=G1(),u=ta(),{render:f,className:m,style:h,...g}=t,p=b.useCallback(v=>{v&&(a===0&&(u.context.firstItemTextRef.current=v),c&&(u.context.selectedItemTextRef.current=v))},[u,a,c]);return jt("div",t,{ref:[p,r,l],props:g})})),GO=b.forwardRef(function(t,r){const{render:a,className:l,style:c,direction:u,keepMounted:f,...m}=t,h=u==="up",g=ta(),{side:p,scrollDownArrowRef:x,scrollUpArrowRef:v}=H1(),j=h?"scrollUpArrowVisible":"scrollDownArrowVisible",S=g.useState(j),N=g.useState("openMethod"),C=S&&N!=="touch",T=ts(),k=h?v:x,{mounted:A,transitionStatus:R,setMounted:M}=Fa(C);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:C,ref:k,onComplete(){C||M(!1)}});const z=jt("div",t,{ref:[r,k],state:{direction:u,visible:C,side:p,transitionStatus:R},props:[{"aria-hidden":!0,children:h?"▲":"▼",style:{position:"absolute"},onMouseMove(B){if(B.movementX===0&&B.movementY===0||T.isStarted())return;g.set("activeIndex",null);function q(){var G;const I=g.state.listElement??g.context.popupRef.current;if(!I)return;g.set("activeIndex",null),g.context.handleScrollArrowVisibility(I);const L=U1(I.scrollHeight,I.clientHeight),H=Rp(I.scrollTop,L),F=H===(h?0:L),V=g.context.listRef.current;if(H!==I.scrollTop&&(I.scrollTop=H),F){T.clear();return}if(V.length>0){const X=((G=k.current)==null?void 0:G.offsetHeight)||0;I.scrollTop=$V(V,h,H,I.clientHeight,X,L)}T.start(40,q)}T.start(40,q)},onMouseLeave(){T.clear()}},m],stateAttributesMapping:Ha});return A||f?z:null});function $V(e,t,r,a,l,c){if(t){let g=0;const p=r+l-yo;for(let j=0;j<e.length;j+=1){const S=e[j];if(S&&S.offsetTop>=p){g=j;break}}const x=Math.max(0,g-1),v=e[x];return x<g&&v?Rp(v.offsetTop-l,c):0}let u=e.length-1;const f=r+a-l+yo;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?Rp(h.offsetTop+h.offsetHeight-a+l,c):c}const BV=b.forwardRef(function(t,r){return s.jsx(GO,{...t,ref:r,direction:"down"})}),VV=b.forwardRef(function(t,r){return s.jsx(GO,{...t,ref:r,direction:"up"})}),UV=b.createContext(void 0),HV=b.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,[f,m]=b.useState(),h=b.useMemo(()=>({labelId:f,setLabelId:m}),[f,m]),g=jt("div",t,{ref:r,props:[{role:"group","aria-labelledby":f},u]});return s.jsx(UV.Provider,{value:h,children:g})}),qh=VB;function Nk({className:e,...t}){return s.jsx(HV,{"data-slot":"select-group",className:Le("scroll-my-1 p-1",e),...t})}function Yh({className:e,...t}){return s.jsx(XB,{"data-slot":"select-value",className:Le("flex flex-1 text-left",e),...t})}function Kh({className:e,size:t="default",children:r,...a}){return s.jsxs(YB,{"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(WB,{render:s.jsx(Qo,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Xh({className:e,children:t,side:r="bottom",sideOffset:a=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:u=!0,...f}){return s.jsx(QB,{children:s.jsx(SV,{side:r,sideOffset:a,align:l,alignOffset:c,alignItemWithTrigger:u,className:"isolate z-50",children:s.jsxs(MV,{"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(FV,{}),s.jsx(zV,{children:t}),s.jsx(GV,{})]})})})}function Dd({className:e,children:t,...r}){return s.jsxs(PV,{"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(LV,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),s.jsx(IV,{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 FV({className:e,...t}){return s.jsx(VV,{"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($R,{})})}function GV({className:e,...t}){return s.jsx(BV,{"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(Qo,{})})}function hn({children:e,value:t,onChange:r,className:a,disabled:l,...c}){const u=m=>b.Children.toArray(m).join(""),f=b.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(qh,{items:f,value:t,disabled:l,onValueChange:m=>r==null?void 0:r({target:{value:m}}),children:[s.jsx(Kh,{className:a,...c,children:s.jsx(Yh,{})}),s.jsx(Xh,{align:"start",alignItemWithTrigger:!1,children:f.map(m=>s.jsx(Dd,{className:"text-xs",value:m.value,disabled:m.disabled,children:m.label},m.value))})]})}const qO=b.createContext(void 0);function Zl(e){const t=b.useContext(qO);if(!e&&t===void 0)throw new Error(Jt(27));return t}const q1=b.forwardRef(function(t,r){const{render:a,className:l,style:c,forceRender:u=!1,...f}=t,m=Zl(),h=m.useState("open"),g=m.useState("nested"),p=m.useState("mounted"),x=m.useState("transitionStatus");return jt("div",t,{state:{open:h,transitionStatus:x},ref:[m.context.backdropRef,r],stateAttributesMapping:gg,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:u||!g})}),Hg=b.forwardRef(function(t,r){const{render:a,className:l,style:c,disabled:u=!1,nativeButton:f=!0,...m}=t,h=Zl(),g=h.useState("open"),{getButtonProps:p,buttonRef:x}=ao({disabled:u,native:f}),v={disabled:u};function j(S){g&&h.setOpen(!1,bt(_A,S.nativeEvent))}return jt("button",t,{state:v,ref:[r,x],props:[{onClick:j},m,p]})}),Y1=b.forwardRef(function(t,r){const{render:a,className:l,style:c,id:u,...f}=t,m=Zl(),h=fs(u);return m.useSyncedValueWithCleanup("descriptionElementId",h),jt("p",t,{ref:r,props:[{id:h},f]})}),YO=b.createContext(void 0);function qV(){const e=b.useContext(YO);if(e===void 0)throw new Error(Jt(26));return e}const YV="--nested-dialogs",KV="data-nested-dialog-open",XV={...xf,...Ha,nestedDialogOpen(e){return e?{[KV]:""}:null}},K1=b.forwardRef(function(t,r){const{render:a,className:l,style:c,finalFocus:u,initialFocus:f,...m}=t,h=Zl(),g=h.useState("descriptionElementId"),p=h.useState("disablePointerDismissal"),x=h.useState("floatingRootContext"),v=h.useState("popupProps"),j=h.useState("modal"),S=h.useState("mounted"),N=h.useState("nested"),C=h.useState("nestedOpenDialogCount"),T=h.useState("open"),k=h.useState("openMethod"),A=h.useState("titleElementId"),R=h.useState("transitionStatus"),M=h.useState("role"),E=x.useState("floatingId");qV(),lr({open:T,ref:h.context.popupRef,onComplete(){var I,L;T&&((L=(I=h.context).onOpenChangeComplete)==null||L.call(I,!0))}});const O=f===void 0?yO(h.context.popupRef):f,z=C>0,_=h.useStateSetter("popupElement"),q=jt("div",t,{state:{open:T,nested:N,transitionStatus:R,nestedDialogOpen:z},props:[v,{id:E,"aria-labelledby":A,"aria-describedby":g,role:M,...Nf,hidden:!S,onKeyDown(I){Rf.has(I.key)&&I.stopPropagation()},style:{[YV]:C}},m],ref:[r,h.context.popupRef,_],stateAttributesMapping:XV});return s.jsx(kg,{context:x,openInteractionType:k,disabled:!S,closeOnFocusOut:!p,initialFocus:O,returnFocus:u,modal:j!==!1,restoreFocus:"popup",children:q})}),X1=b.forwardRef(function(t,r){const{keepMounted:a=!1,...l}=t,c=Zl(),u=c.useState("mounted"),f=c.useState("modal"),m=c.useState("open");return u||a?s.jsx(YO.Provider,{value:a,children:s.jsxs(Cg,{ref:r,...l,children:[u&&f===!0&&s.jsx($g,{ref:c.context.internalBackdropRef,inert:kf(!m)}),t.children]})}):null});function WV({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]=b.useState(0),[g,p]=b.useState(0),x=m===0,v=Sf(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(x&&!l){if(c){const N=e.context.internalBackdropRef.current,C=e.context.backdropRef.current;return N||C?N===S||C===S||pt(S,u)&&!(S!=null&&S.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:x});return HO(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]),Mg(e,{activeTriggerProps:v.reference,inactiveTriggerProps:v.trigger,popupProps:v.floating,nestedOpenDialogCount:m,nestedOpenDrawerCount:g}),null}const QV={...zg,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 ZV extends vu{constructor(r,a,l){const c=new Cf,u=JV(r,c,a,l);super(u,e7(c),QV);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(Rg(this.state,r,a.trigger)))})}}function JV(e,t,r,a=!1){return{...Dg(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 e7(e){return{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function KO(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:x=null}=t,v=e==="drawer",j=e==="alert-dialog",S=j?!0:m,N=j||f,C=j?"alertdialog":"dialog",T=Zl(!0),k=T!=null,A={modal:S,disablePointerDismissal:N,nested:k,role:C},R=M1((B,q)=>new ZV({open:l,openProp:a,activeTriggerId:x,triggerIdProp:p,...A},B,q),!0);R.useControlledProp("openProp",a),R.useControlledProp("triggerIdProp",p),R.useSyncedValues(A),R.useContextCallback("onOpenChange",c),R.useContextCallback("onOpenChangeComplete",u);const M=R.useState("open"),E=R.useState("mounted"),O=R.useState("payload");vO(R,M),Ag(R);const{forceUnmount:z}=Og(M,R);b.useImperativeHandle(h,()=>({unmount:z,close:()=>R.setOpen(!1,bt(jg))}),[z,R]);const _=M||E;return s.jsxs(qO.Provider,{value:R,children:[g&&s.jsx(Eg,{handle:g,store:R}),_&&s.jsx(WV,{store:R,parentContext:T==null?void 0:T.context,isDrawer:v}),typeof r=="function"?r({payload:O}):r]})}const XO=jf(function(t){return KO("dialog",t)}),W1=b.forwardRef(function(t,r){const{render:a,className:l,style:c,id:u,...f}=t,m=Zl(),h=fs(u);return m.useSyncedValueWithCleanup("titleElementId",h),jt("h2",t,{ref:r,props:[{id:h},f]})});function bn({...e}){return s.jsx(XO,{"data-slot":"dialog",...e})}function t7({...e}){return s.jsx(X1,{"data-slot":"dialog-portal",...e})}function n7({className:e,...t}){return s.jsx(q1,{"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 yn({className:e,children:t,showCloseButton:r=!0,...a}){return s.jsxs(t7,{children:[s.jsx(n7,{}),s.jsxs(K1,{"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(Hg,{"data-slot":"dialog-close",render:s.jsx(ue,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[s.jsx(Dn,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function jn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:Le("flex flex-col gap-2",e),...t})}function Co({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(Hg,{render:s.jsx(ue,{variant:"outline"}),children:"Close"})]})}function vn({className:e,...t}){return s.jsx(W1,{"data-slot":"dialog-title",className:Le("font-heading text-base leading-none font-medium",e),...t})}function $n({className:e,...t}){return s.jsx(Y1,{"data-slot":"dialog-description",className:Le("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const WO=b.createContext(void 0);function Q1(){const e=b.useContext(WO);if(e===void 0)throw new Error(Jt(64));return e}const s7="data-activation-direction",Fg={tabActivationDirection:e=>({[s7]:e})},r7=b.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,x=b.useRef([]),[v,j]=b.useState(()=>new Map),[S,N]=oo({controlled:m,default:l,name:"Tabs",state:"value"}),C=m!==void 0,[T,k]=b.useState(()=>new Map),A=b.useRef(void 0),R=b.useCallback(le=>cv(T,le),[T]),[M,E]=b.useState(()=>({previousValue:S,tabActivationDirection:"none"})),{previousValue:O,tabActivationDirection:z}=M;let _=z,B=!1;O!==S&&(_=Ck(O,S,u,T),B=O!=null&&S!=null&&R(S)==null);const q=B?O:S,I=O!==q||z!==_;Ke(()=>{I&&E({previousValue:q,tabActivationDirection:_})},[q,I,_]);const L=et((le,de)=>{const oe=Ck(S,le,u,T);de.activationDirection=oe,c==null||c(le,de),!de.isCanceled&&N(le)}),H=et((le,de)=>{c==null||c(le,bt(de,void 0,void 0,{activationDirection:"none"}))}),F=et((le,de)=>(j(oe=>{const ne=new Map(oe);return ne.set(le,de),ne}),()=>{j(oe=>{if(oe.get(le)!==de)return oe;const ne=new Map(oe);return ne.delete(le),ne})})),V=b.useCallback(le=>v.get(le),[v]),G=b.useCallback(le=>{for(const de of T.values())if(le===de.value)return de.id},[T]),X=b.useMemo(()=>({getTabElementBySelectedValue:R,getTabIdByPanelValue:G,getTabPanelIdByValue:V,onValueChange:L,orientation:u,registerMountedTabPanel:F,setTabMap:k,tabActivationDirection:_,value:S}),[R,G,V,L,u,F,k,_,S]),$=b.useMemo(()=>{for(const le of T.values())if(le.value===S)return le},[T,S]),Q=b.useMemo(()=>{for(const le of T.values())if(!le.disabled)return le.value},[T]),K=b.useRef(!p),se=b.useRef(l),P=b.useRef(p),U=b.useRef(!1);Ke(()=>{var ee;if(C)return;function le(W,ce){N(W),E({previousValue:W,tabActivationDirection:"none"}),H(W,ce),K.current=!1}if(T.size===0){U.current&&S!==null&&!((ee=A.current)!=null&&ee.isConnected)&&le(null,zC);return}U.current=!0,A.current=T.keys().next().value;const de=$==null?void 0:$.disabled,oe=$==null&&S!==null;if(!de&&S===se.current&&(P.current=!1),P.current&&de&&S===se.current)return;const ne=K.current;if(de||oe){const W=Q??null;if(S===W){K.current=!1;return}let ce=zC;ne?ce=PC:de&&(ce=$A),le(W,ce);return}ne&&$!=null&&(H(S,PC),K.current=!1)},[Q,C,H,$,N,T,S]);const te=jt("div",t,{state:{orientation:u,tabActivationDirection:_},ref:r,props:g,stateAttributesMapping:Fg});return s.jsx(WO.Provider,{value:X,children:s.jsx(Tf,{elementsRef:x,children:te})})});function cv(e,t){for(const[r,a]of e.entries())if(t===a.value)return r;return null}function Ck(e,t,r,a){if(e==null||t==null)return"none";const[l,c,u]=r==="horizontal"?["left","left","right"]:["top","up","down"],f=cv(a,e),m=cv(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 Z1="data-composite-item-active";function QO(e={}){const{highlightItemOnHover:t,highlightedIndex:r,onHighlightedIndexChange:a}=lg(),{ref:l,index:c}=Ql(e),u=r===c,f=b.useRef(null),m=no(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 ZO=b.createContext(void 0);function o7(){const e=b.useContext(ZO);if(e===void 0)throw new Error(Jt(65));return e}const a7=b.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:x,onValueChange:v,orientation:j,tabActivationDirection:S}=Q1(),{activateOnFocus:N,registerTabResizeObserverElement:C,tabsListElement:T}=o7(),{highlightedIndex:k,onHighlightedIndexChange:A}=lg(),R=fs(f),M=b.useMemo(()=>({disabled:l,id:R,value:u}),[l,R,u]),{compositeProps:E,compositeRef:O,index:z}=QO({metadata:M}),_=u===p,B=b.useRef(!1),q=b.useRef(null),I=et(U=>{var Z;(Z=q.current)==null||Z.call(q),q.current=U?C(U):null});Ke(()=>{if(B.current){B.current=!1;return}if(!(_&&z>-1&&k!==z))return;const U=T;if(U!=null){const Z=Ps(Gt(U));if(Z&&pt(U,Z))return}l||A(z)},[_,z,k,A,l,T]);const{getButtonProps:L,buttonRef:H}=ao({disabled:l,native:m,focusableWhenDisabled:!0}),F=x(u),V=b.useRef(!1),G=b.useRef(!1);function X(U){v(u,bt(Er,U.nativeEvent,void 0,{activationDirection:"none"}))}function $(U){_||l||X(U)}function Q(U){_||l||N&&(!V.current||G.current)&&X(U)}function K(U){if(_||l)return;V.current=!0,G.current=U.button===0;const Z=Gt(U.currentTarget);function te(){V.current=!1,G.current=!1,Z.removeEventListener("pointerup",te),Z.removeEventListener("pointercancel",te)}Z.addEventListener("pointerup",te),Z.addEventListener("pointercancel",te)}return jt("button",t,{state:{disabled:l,active:_,orientation:j,tabActivationDirection:S},ref:[r,H,O,I],props:[E,{role:"tab","aria-controls":F,"aria-selected":_,id:R,onClick:$,onFocus:Q,onPointerDown:K,[Z1]:_?"":void 0,onKeyDownCapture(){B.current=!0}},g,L],stateAttributesMapping:Fg})}),i7="data-index",l7={...Fg,...Ha},c7=b.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:x,registerMountedTabPanel:v}=Q1(),j=fs(),{ref:S,index:N}=Ql(),C=l===h,{mounted:T,transitionStatus:k,setMounted:A}=Fa(C),R=!T,M=g(l),E={hidden:R,orientation:p,tabActivationDirection:x,transitionStatus:k},O=b.useRef(null),z=jt("div",t,{state:E,ref:[r,S,O],props:[{"aria-labelledby":M,hidden:R,id:j,role:"tabpanel",tabIndex:C?0:-1,inert:kf(!C),[i7]:N},m],stateAttributesMapping:l7});return lr({open:C,ref:O,onComplete(){C||A(!1)}}),Ke(()=>{if(!(j==null||R&&!u))return v(l,j)},[R,u,l,j,v]),u||T?z:null});function u7(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:x=Tr}=e,[v,j]=b.useState(0),S=a!=null,N=b.useRef(null),C=no(N,m),T=b.useRef([]),k=b.useRef(!1),A=b.useRef(null),R=u??v,M=et((B,q=!1)=>{if(A.current=T.current[B]??null,(f??j)(B),q){const I=T.current[B];bk(N.current,I,c,r)}}),E=et(B=>{var H;if(B.size===0)return;if(k.current){const F=T.current,V=F.indexOf(A.current);if(V===-1){const G=F[R];!G||Zc(F,R,p)?M(d7(F,p)):A.current=G}else V!==R&&M(V);return}k.current=!0;const q=Array.from(B.keys()),I=q.find(F=>F==null?void 0:F.hasAttribute(Z1))??null,L=I?((H=B.get(I))==null?void 0:H.index)??-1:-1;if(L!==-1)M(L);else if(Zc(q,R,p)){const F=Sa(q,{disabledIndices:p});Ld(q,F)||M(F)}bk(N.current,I,c,r)});Ke(()=>{if(p==null||u!=null||!k.current)return;const B=T.current;if(Zc(B,R,p)){const q=Sa(B,{disabledIndices:p});Ld(B,q)||M(q)}},[p,u,R,T,M]);const O=et((B,q,I)=>l?l(B,q,I,T):I),z=et(B=>{const q=B.key===iv||B.key===lv;if(!Rf.has(B.key)||!h&&q||f7(B,x)||!N.current)return;const L=c==="rtl",H=L?ov:av,F=L?av:ov,V=r==="vertical"?rv:H,G=r==="vertical"?sv:F,X=As(B.nativeEvent);if(X!=null&&xk(X)&&!YA(X)){const U=X.selectionStart,Z=X.selectionEnd,te=X.value;if(U==null||B.shiftKey||U!==Z||B.key!==G&&U<te.length||B.key!==V&&U>0)return}let $=R;const Q=Uh(T,p),K=qy(T,p);a!=null&&($=a({disabledIndices:p,elementsRef:T,event:B,highlightedIndex:R,loopFocus:t,maxIndex:K,minIndex:Q,onLoop:O,orientation:r,rtl:L}));const se=r!=="vertical"&&B.key===H||r!=="horizontal"&&B.key===rv,P=r!=="vertical"&&B.key===F||r!=="horizontal"&&B.key===sv;h&&(B.key===iv?$=Q:B.key===lv&&($=K)),$===R&&(se||P)&&(t&&$===K&&se?($=Q,l&&($=l(B,R,$,T))):t&&$===Q&&P?($=K,l&&($=l(B,R,$,T))):$=Sa(T.current,{startingIndex:$,decrement:P,disabledIndices:p})),$!==R&&!Ld(T.current,$)&&(g&&B.stopPropagation(),(S||q||se||P)&&B.preventDefault(),M($,!0),queueMicrotask(()=>{var U;(U=T.current[$])==null||U.focus()}))});return{props:{ref:C,onFocus(B){const q=N.current,I=As(B.nativeEvent);!q||I==null||!xk(I)||I.setSelectionRange(0,I.value.length)},onKeyDown:z},highlightedIndex:R,onHighlightedIndexChange:M,elementsRef:T,onMapChange:E,relayKeyboardEvent:z}}function d7(e,t){let r=-1;for(let a=0;a<e.length;a+=1){const l=e[a];if(!(!l||Zc(e,a,t))){if(l.hasAttribute(Z1))return a;r===-1&&(r=a)}}return Math.max(r,0)}function f7(e,t){for(const r of kV)if(!t.includes(r)&&e.getModifierState(r))return!0;return!1}function JO(e){const{render:t,className:r,style:a,refs:l=Tr,props:c=Tr,state:u=gn,stateAttributesMapping:f,highlightedIndex:m,onHighlightedIndexChange:h,orientation:g,grid:p,loopFocus:x,onLoop:v,enableHomeAndEndKeys:j,onMapChange:S,stopEventPropagation:N=!0,rootRef:C,disabledIndices:T,modifierKeys:k,highlightItemOnHover:A=!1,tag:R="div",...M}=e,E=_g(),{props:O,highlightedIndex:z,onHighlightedIndexChange:_,elementsRef:B,onMapChange:q,relayKeyboardEvent:I}=u7({grid:p,loopFocus:x,onLoop:v,orientation:g,highlightedIndex:m,onHighlightedIndexChange:h,rootRef:C,stopEventPropagation:N,enableHomeAndEndKeys:j,direction:E,disabledIndices:T,modifierKeys:k}),L=jt(R,e,{state:u,ref:l,props:[O,...c,M],stateAttributesMapping:f}),H=b.useMemo(()=>({highlightedIndex:z,onHighlightedIndexChange:_,highlightItemOnHover:A,relayKeyboardEvent:I}),[z,_,A,I]);return s.jsx(tA.Provider,{value:H,children:s.jsx(Tf,{elementsRef:B,onMapChange:F=>{S==null||S(F),q(F)},children:L})})}const m7=b.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}=Q1(),[x,v]=b.useState(0),[j,S]=b.useState(null),N=b.useRef(new Set),C=b.useRef(new Set),T=b.useRef(null);Ke(()=>{if(typeof ResizeObserver>"u")return;const O=new ResizeObserver(()=>{N.current.forEach(z=>{z()})});return T.current=O,j&&O.observe(j),C.current.forEach(z=>{O.observe(z)}),()=>{O.disconnect(),T.current=null}},[j]);const k=et(O=>(N.current.add(O),()=>{N.current.delete(O)})),A=et(O=>{var z;return C.current.add(O),(z=T.current)==null||z.observe(O),()=>{var _;C.current.delete(O),(_=T.current)==null||_.unobserve(O)}}),R={orientation:h,tabActivationDirection:p},M={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},E=b.useMemo(()=>({activateOnFocus:a,registerIndicatorUpdateListener:k,registerTabResizeObserverElement:A,tabsListElement:j}),[a,k,A,j]);return s.jsx(ZO.Provider,{value:E,children:s.jsx(JO,{render:u,className:l,style:f,state:R,refs:[r,S],props:[M,m],stateAttributesMapping:Fg,highlightedIndex:x,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:v,onMapChange:g,disabledIndices:Tr})})});function Af({className:e,orientation:t="horizontal",...r}){return s.jsx(r7,{"data-slot":"tabs","data-orientation":t,className:Le("group/tabs flex gap-2 data-horizontal:flex-col",e),...r})}const h7=cg("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 Of({className:e,variant:t="default",...r}){return s.jsx(m7,{"data-slot":"tabs-list","data-variant":t,className:Le(h7({variant:t}),e),...r})}function jr({className:e,...t}){return s.jsx(a7,{"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 vo({className:e,...t}){return s.jsx(c7,{"data-slot":"tabs-content",className:Le("flex-1 text-sm outline-none",e),...t})}const e5=b.createContext(void 0);function t5(){const e=b.useContext(e5);if(e===void 0)throw new Error(Jt(10));return e}const p7={value:()=>null},g7=b.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:x,defaultValue:v,style:j,...S}=t,N=v??Tr,C=b.useRef([]),[T,k]=oo({controlled:x,default:N,name:"Accordion",state:"value"}),A=et((O,z,_)=>{if(g)if(z){const B=T.slice();if(B.push(O),h==null||h(B,_),_.isCanceled)return;k(B)}else{const B=T.filter(q=>q!==O);if(h==null||h(B,_),_.isCanceled)return;k(B)}else{const B=T[0]===O?[]:[O];if(h==null||h(B,_),_.isCanceled)return;k(B)}}),R=b.useMemo(()=>({value:T,disabled:c,orientation:p}),[T,c,p]),M=b.useMemo(()=>({disabled:c,handleValueChange:A,hiddenUntilFound:u??!1,keepMounted:f??!1,state:R,value:T}),[c,A,u,f,R,T]),E=jt("div",t,{state:R,ref:r,props:S,stateAttributesMapping:p7});return s.jsx(e5.Provider,{value:M,children:s.jsx(Tf,{elementsRef:C,children:E})})});function x7(e){const{open:t,defaultOpen:r=!1,onOpenChange:a,disabled:l}=e,[c,u]=oo({controlled:t,default:r,name:"Collapsible",state:"open"}),{mounted:f,setMounted:m,transitionStatus:h}=Fa(c,!0,!0),g=fs(),[p,x]=b.useState(),v=p===null?void 0:p??g,j=et(S=>{const N=!c,C=bt(Zo,S.nativeEvent);a(N,C),!C.isCanceled&&u(N)});return b.useMemo(()=>({defaultPanelId:g,disabled:l,handleTrigger:j,mounted:f,open:c,panelId:v,setMounted:m,setOpen:u,setPanelIdState:x,transitionStatus:h}),[g,l,j,f,c,v,m,u,x,h])}const n5=b.createContext(void 0);function s5(){const e=b.useContext(n5);if(e===void 0)throw new Error(Jt(15));return e}const r5=b.createContext(void 0);function J1(){const e=b.useContext(r5);if(e===void 0)throw new Error(Jt(9));return e}const b7="data-open",y7="data-closed",v7=m1,w7="data-panel-open",j7={[b7]:""},S7={[y7]:""},N7={open(e){return e?{[w7]:""}:null}},C7={open(e){return e?j7:S7}},k7="data-index",ew={...C7,index:e=>({[k7]:String(e)}),...Ha,value:()=>null},T7=b.forwardRef(function(t,r){const{className:a,disabled:l=!1,onOpenChange:c,render:u,value:f,style:m,...h}=t,{ref:g,index:p}=Ql(),x=no(r,g),{disabled:v,handleValueChange:j,state:S,value:N}=t5(),C=fs(),T=f??C,k=l||v,A=N.indexOf(T)!==-1,R=et((F,V)=>{c==null||c(F,V),!V.isCanceled&&j(T,F,V)}),M=x7({open:A,onOpenChange:R,disabled:k}),E=b.useMemo(()=>({open:M.open,disabled:M.disabled,transitionStatus:M.transitionStatus}),[M.open,M.disabled,M.transitionStatus]),O=b.useMemo(()=>({...M,onOpenChange:R,state:E}),[M,E,R]),z=b.useMemo(()=>({...S,hidden:!A&&!M.mounted,index:p,disabled:k,open:A}),[M.mounted,k,p,A,S]),_=fs(),[B,q]=b.useState(),I=B===null?void 0:B??_,L=b.useMemo(()=>({defaultTriggerId:_,open:A,state:z,setTriggerId:q,triggerId:I}),[_,A,z,q,I]),H=jt("div",t,{state:z,ref:x,props:h,stateAttributesMapping:ew});return s.jsx(n5.Provider,{value:O,children:s.jsx(r5.Provider,{value:L,children:H})})}),E7=b.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,{state:f}=J1();return jt("h3",t,{state:f,ref:r,props:u,stateAttributesMapping:ew})}),R7=b.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:x,disabled:v}=s5(),j=a||v,{getButtonProps:S,buttonRef:N}=ao({disabled:j,focusableWhenDisabled:!0,native:f}),{defaultTriggerId:C,state:T,setTriggerId:k}=J1(),A=c||void 0,R=A??C;return Ke(()=>(k(O=>A??(O===null?void 0:O)),()=>{k(O=>O===A?null:O)}),[A,k]),jt("button",t,{state:T,ref:[r,N],props:[{"aria-controls":p?g:void 0,"aria-expanded":p,id:R,onClick:x},h,S],stateAttributesMapping:N7})}),Cd={height:void 0,width:void 0};function A7(e){const{externalRef:t,hiddenUntilFound:r,id:a,keepMounted:l,mounted:c,onOpenChange:u,open:f,setMounted:m,setOpen:h,transitionStatus:g}=e,p=b.useRef(null),x=b.useRef(null),[v,j]=b.useState(Cd),S=b.useRef(Cd),N=b.useRef(!1),C=b.useRef(f),T=b.useRef(!1),[k,A]=b.useState(!1),R=b.useRef(null),M=no(t,p),E=Ln(f),O=yf(p),z=!f&&!c,_=k?"idle":g,B=f&&(C.current||T.current),q=!f&&c&&x.current==="css-animation"&&v.height===void 0&&v.width===void 0?S.current:v,I=r&&z&&x.current!=="css-animation",L=et((X,$=!0)=>{$&&(S.current=X),j(X)}),H=et(()=>{var X;(X=R.current)==null||X.call(R),R.current=null}),F=et(X=>{H(),R.current=()=>{R.current=null,X()}}),V=et(()=>{f&&c&&x.current==="css-animation"&&(T.current=!0)});Ke(()=>{!k||g==="starting"||A(!1)},[k,g]),b.useEffect(()=>()=>{V(),H()},[V,H]),Ke(()=>{const X=p.current;if(!X)return;!f&&R.current&&H();const $=O7(X,B);if(x.current=$,f&&g==="idle"&&C.current&&$==="css-animation"){S.current=Hc(X);return}if(f&&g==="starting"){const se=N.current;if(N.current=!1,$==="none"){L(Hc(X)),A(!0);return}if($==="css-transition"){const Z=M7(X);if(L(Hc(X)),!se)return Z;const te=wh(X,"transition-duration","0s");return F(te),A(!0),Z}L(Hc(X));const P=wh(X,"animation-name","none");if(!se){P();return}const U=wh(X,"animation-duration","0s");P(),F(U),A(!0);return}if(!f&&c&&(g==="idle"||g==="starting")){if(C.current=!1,T.current=!1,$==="none"){L(Cd,!1),m(!1);return}L(Hc(X));return}if(g!=="ending")return;if($==="none"){m(!1);return}const Q=Hc(X);if(!(Q.height>0||Q.width>0)){m(!1);return}L(Q),$==="css-animation"&&wh(X,"animation-name","none")()},[c,f,H,L,m,F,B,g]),lr({enabled:f&&c&&_==="idle",open:!0,ref:p,onComplete(){f&&L(Cd,!1)}}),b.useEffect(()=>{if(f||!c||_!=="ending"||!p.current)return;const $=new AbortController;let Q=-1;function K(){E.current||(m(!1),L(Cd,!1))}return Q=ar.request(()=>{O(K,$.signal)}),()=>{ar.cancel(Q),$.abort()}},[E,c,f,_,O,L,m]),Ke(()=>{const X=p.current;!X||!r||!z||X.setAttribute("hidden","until-found")},[z,r]),b.useEffect(function(){const $=p.current;if(!$)return;function Q(K){const se=bt(Er,K);u(!0,se),!se.isCanceled&&(N.current=!0,h(!0))}return Lt($,"beforematch",Q)},[u,h]);const G=l||r||c||f;return{height:q.height,props:{...I?{[v7]:""}:void 0,hidden:z,id:a},ref:M,shouldPreventOpenAnimation:B,shouldRender:G,transitionStatus:_,width:q.width}}function Hc(e){return{height:e.scrollHeight,width:e.scrollWidth}}function O7(e,t){const r=xn(e).getComputedStyle(e),a=(r.animationName.split(",").map(c=>c.trim()).some(c=>c!==""&&c!=="none")||t)&&kk(r.animationDuration),l=kk(r.transitionDuration);return a&&l||l?"css-transition":a?"css-animation":"none"}function kk(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function wh(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 M7(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=ar.request(r);return()=>{ar.cancel(a),r()}}const D7="--accordion-panel-height",z7="--accordion-panel-width",P7=b.forwardRef(function(t,r){const{className:a,hiddenUntilFound:l,keepMounted:c,id:u,render:f,style:m,...h}=t,{hiddenUntilFound:g,keepMounted:p}=t5(),{defaultPanelId:x,mounted:v,onOpenChange:j,open:S,setMounted:N,setOpen:C,setPanelIdState:T,transitionStatus:k}=s5(),A=l??g,R=c??p,M=u||void 0,E=u??x;Ke(()=>(T($=>M??($===null?void 0:$)),()=>{T($=>$===M?null:$)}),[M,T]);const{height:O,props:z,ref:_,shouldPreventOpenAnimation:B,shouldRender:q,transitionStatus:I,width:L}=A7({externalRef:r,hiddenUntilFound:A,id:E,keepMounted:R,mounted:v,onOpenChange:j,open:S,setMounted:N,setOpen:C,transitionStatus:k}),{state:H,triggerId:F}=J1(),V={...H,transitionStatus:I},G=rA(m,V),X=jt("div",{...t,style:void 0},{state:V,ref:_,props:[z,{"aria-labelledby":F,role:"region",style:{[D7]:O===void 0?"auto":`${O}px`,[z7]:L===void 0?"auto":`${L}px`}},h,G?{style:G}:void 0,B?{style:{animationName:"none"}}:void 0],stateAttributesMapping:ew});return q?X:null});function I7({className:e,...t}){return s.jsx(g7,{"data-slot":"accordion",className:Le("flex w-full flex-col",e),...t})}function _7({className:e,...t}){return s.jsx(T7,{"data-slot":"accordion-item",className:Le("not-last:border-b",e),...t})}function L7({className:e,children:t,...r}){return s.jsx(E7,{className:"flex",children:s.jsxs(R7,{"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(Qo,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),s.jsx($R,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function $7({className:e,children:t,...r}){return s.jsx(P7,{"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 tw=b.createContext({});function Mf(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const B7=typeof window<"u",uu=B7?b.useLayoutEffect:b.useEffect,Gg=b.createContext(null);function nw(e,t){e.indexOf(t)===-1&&e.push(t)}function Op(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}const ko=(e,t,r)=>r>t?t:r<e?e:r;let qg=()=>{};const Ma={},sw=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),o5=e=>typeof e=="object"&&e!==null,rw=e=>/^0[^.\s]+$/u.test(e);function a5(e){let t;return()=>(t===void 0&&(t=e()),t)}const jo=e=>e,Df=(...e)=>e.reduce((t,r)=>a=>r(t(a))),Zd=(e,t,r)=>{const a=t-e;return a?(r-e)/a:1};class Mp{constructor(){this.subscriptions=[]}add(t){return nw(this.subscriptions,t),()=>this.remove(t)}remove(t){Op(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 to=e=>e*1e3,Sr=e=>e/1e3,i5=(e,t)=>t?e*(1e3/t):0,l5=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,V7=1e-7,U7=12;function H7(e,t,r,a,l){let c,u,f=0;do u=t+(r-t)/2,c=l5(u,a,l)-e,c>0?r=u:t=u;while(Math.abs(c)>V7&&++f<U7);return u}function zf(e,t,r,a){if(e===t&&r===a)return jo;const l=c=>H7(c,0,1,e,r);return c=>c===0||c===1?c:l5(l(c),t,a)}const c5=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,u5=e=>t=>1-e(1-t),d5=zf(.33,1.53,.69,.99),ow=u5(d5),f5=c5(ow),m5=e=>e>=1?1:(e*=2)<1?.5*ow(e):.5*(2-Math.pow(2,-10*(e-1))),aw=e=>1-Math.sin(Math.acos(e)),h5=u5(aw),p5=c5(aw),F7=zf(.42,0,1,1),G7=zf(0,0,.58,1),iw=zf(.42,0,.58,1),q7=e=>Array.isArray(e)&&typeof e[0]!="number",g5=e=>Array.isArray(e)&&typeof e[0]=="number",Y7={linear:jo,easeIn:F7,easeInOut:iw,easeOut:G7,circIn:aw,circInOut:p5,circOut:h5,backIn:ow,backInOut:f5,backOut:d5,anticipate:m5},K7=e=>typeof e=="string",Tk=e=>{if(g5(e)){qg(e.length===4);const[t,r,a,l]=e;return zf(t,r,a,l)}else if(K7(e))return Y7[e];return e},jh=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function X7(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 W7=40;function x5(e,t){let r=!1,a=!0;const l={delta:0,timestamp:0,isProcessing:!1},c=()=>r=!0,u=jh.reduce((k,A)=>(k[A]=X7(c),k),{}),{setup:f,read:m,resolveKeyframes:h,preUpdate:g,update:p,preRender:x,render:v,postRender:j}=u,S=()=>{const k=Ma.useManualTiming,A=k?l.timestamp:performance.now();r=!1,k||(l.delta=a?1e3/60:Math.max(Math.min(A-l.timestamp,W7),1)),l.timestamp=A,l.isProcessing=!0,f.process(l),m.process(l),h.process(l),g.process(l),p.process(l),x.process(l),v.process(l),j.process(l),l.isProcessing=!1,r&&t&&(a=!1,e(S))},N=()=>{r=!0,a=!0,l.isProcessing||e(S)};return{schedule:jh.reduce((k,A)=>{const R=u[A];return k[A]=(M,E=!1,O=!1)=>(r||N(),R.schedule(M,E,O)),k},{}),cancel:k=>{for(let A=0;A<jh.length;A++)u[jh[A]].cancel(k)},state:l,steps:u}}const{schedule:un,cancel:Jo,state:bs,steps:X0}=x5(typeof requestAnimationFrame<"u"?requestAnimationFrame:jo,!0);let Wh;function Q7(){Wh=void 0}const ys={now:()=>(Wh===void 0&&ys.set(bs.isProcessing||Ma.useManualTiming?bs.timestamp:performance.now()),Wh),set:e=>{Wh=e,queueMicrotask(Q7)}},nu=e=>Math.round(e*1e5)/1e5,b5=e=>t=>typeof t=="string"&&t.startsWith(e),y5=b5("--"),Z7=b5("var(--"),lw=e=>Z7(e)?J7.test(e.split("/*")[0].trim()):!1,J7=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ek(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const wu={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Jd={...wu,transform:e=>ko(0,1,e)},Sh={...wu,default:1},cw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function eU(e){return e==null}const tU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,uw=(e,t)=>r=>!!(typeof r=="string"&&tU.test(r)&&r.startsWith(e)||t&&!eU(r)&&Object.prototype.hasOwnProperty.call(r,t)),v5=(e,t,r)=>a=>{if(typeof a!="string")return a;const[l,c,u,f]=a.match(cw);return{[e]:parseFloat(l),[t]:parseFloat(c),[r]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},nU=e=>ko(0,255,e),W0={...wu,transform:e=>Math.round(nU(e))},Al={test:uw("rgb","red"),parse:v5("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:a=1})=>"rgba("+W0.transform(e)+", "+W0.transform(t)+", "+W0.transform(r)+", "+nu(Jd.transform(a))+")"};function sU(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 uv={test:uw("#"),parse:sU,transform:Al.transform},Pf=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ya=Pf("deg"),Yo=Pf("%"),mt=Pf("px"),rU=Pf("vh"),oU=Pf("vw"),Rk={...Yo,parse:e=>Yo.parse(e)/100,transform:e=>Yo.transform(e*100)},Yc={test:uw("hsl","hue"),parse:v5("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:a=1})=>"hsla("+Math.round(e)+", "+Yo.transform(nu(t))+", "+Yo.transform(nu(r))+", "+nu(Jd.transform(a))+")"},is={test:e=>Al.test(e)||uv.test(e)||Yc.test(e),parse:e=>Al.test(e)?Al.parse(e):Yc.test(e)?Yc.parse(e):uv.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Al.transform(e):Yc.transform(e),getAnimatableNone:e=>{const t=is.parse(e);return t.alpha=0,is.transform(t)}},aU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,w5=new RegExp(cw.source),j5=new RegExp(aU.source,"i");function iU(e){return isNaN(e)&&typeof e=="string"&&(w5.test(e)||j5.test(e))}const S5="number",N5="color",lU="var",cU="var(",Ak="${}",uU=/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 dU(e){const t=e.toString();return w5.test(t)||j5.test(t)}function ef(e){const t=e.toString(),r=[],a={color:[],number:[],var:[]},l=[];let c=0;const f=t.replace(uU,m=>(is.test(m)?(a.color.push(c),l.push(N5),r.push(is.parse(m))):m.startsWith(cU)?(a.var.push(c),l.push(lU),r.push(m)):(a.number.push(c),l.push(S5),r.push(parseFloat(m))),++c,Ak)).split(Ak);return{values:r,split:f,indexes:a,types:l}}function fU(e){return ef(e).values}function C5({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===S5?l+=nu(a[c]):u===N5?l+=is.transform(a[c]):l+=a[c]}return l}}function mU(e){return C5(ef(e))}const hU=e=>typeof e=="number"?0:is.test(e)?is.getAnimatableNone(e):e,pU=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:hU(e);function gU(e){const t=ef(e);return C5(t)(t.values.map((a,l)=>pU(a,t.split[l])))}const Nr={test:iU,parse:fU,createTransformer:mU,getAnimatableNone:gU};function Q0(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 xU({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=Q0(m,f,e+1/3),c=Q0(m,f,e),u=Q0(m,f,e-1/3)}return{red:Math.round(l*255),green:Math.round(c*255),blue:Math.round(u*255),alpha:a}}function Dp(e,t){return r=>r>0?t:e}const pn=(e,t,r)=>e+(t-e)*r,Z0=(e,t,r)=>{const a=e*e,l=r*(t*t-a)+a;return l<0?0:Math.sqrt(l)},bU=[uv,Al,Yc],yU=e=>bU.find(t=>t.test(e));function Ok(e){const t=yU(e);if(!t)return!1;let r=t.parse(e);return t===Yc&&(r=xU(r)),r}const Mk=(e,t)=>{const r=Ok(e),a=Ok(t);if(!r||!a)return Dp(e,t);const l={...r};return c=>(l.red=Z0(r.red,a.red,c),l.green=Z0(r.green,a.green,c),l.blue=Z0(r.blue,a.blue,c),l.alpha=pn(r.alpha,a.alpha,c),Al.transform(l))},dv=new Set(["none","hidden"]);function vU(e,t){return dv.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function wU(e,t){return r=>pn(e,t,r)}function dw(e){return typeof e=="number"?wU:typeof e=="string"?lw(e)?Dp:is.test(e)?Mk:NU:Array.isArray(e)?k5:typeof e=="object"?is.test(e)?Mk:jU:Dp}function k5(e,t){const r=[...e],a=r.length,l=e.map((c,u)=>dw(c)(c,t[u]));return c=>{for(let u=0;u<a;u++)r[u]=l[u](c);return r}}function jU(e,t){const r={...e,...t},a={};for(const l in r)e[l]!==void 0&&t[l]!==void 0&&(a[l]=dw(e[l])(e[l],t[l]));return l=>{for(const c in a)r[c]=a[c](l);return r}}function SU(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 NU=(e,t)=>{const r=Nr.createTransformer(t),a=ef(e),l=ef(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?dv.has(e)&&!l.values.length||dv.has(t)&&!a.values.length?vU(e,t):Df(k5(SU(a,l),l.values),r):Dp(e,t)},Dk=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function CU(e,t){const r=Dk.exec(e);if(!r)return;const a=Dk.exec(t);if(!a||r[2]!==a[2])return;const l=r[2],c=parseFloat(r[1]),u=parseFloat(a[1]);return f=>nu(pn(c,u,f))+l}function fw(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=CU(e,t);if(l)return l}return dw(e)(e,t)}const kU=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>un.update(t,r),stop:()=>Jo(t),now:()=>bs.isProcessing?bs.timestamp:ys.now()}},T5=(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)})`},mw=2e4;function hw(e,t=50,r=mw,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 TU(e,t=100,r){const a=r({...e,keyframes:[0,t]}),l=Math.min(hw(a),mw);return{type:"keyframes",ease:c=>a.next(l*c).value/t,duration:Sr(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 fv(e,t){return e*Math.sqrt(1-t*t)}const EU=12;function RU(e,t,r){let a=r;for(let l=1;l<EU;l++)a=a-e(a)/t(a);return a}const J0=.001;function AU({duration:e=_n.duration,bounce:t=_n.bounce,velocity:r=_n.velocity,mass:a=_n.mass}){let l,c,u=1-t;u=ko(_n.minDamping,_n.maxDamping,u),e=ko(_n.minDuration,_n.maxDuration,Sr(e)),u<1?(l=h=>{const g=h*u,p=g*e,x=g-r,v=fv(h,u),j=Math.exp(-p);return J0-x/v*j},c=h=>{const p=h*u*e,x=p*r+r,v=u*u*h*h*e,j=Math.exp(-p),S=fv(h*h,u);return(-l(h)+J0>0?-1:1)*((x-v)*j)/S}):(l=h=>{const g=Math.exp(-h*e),p=(h-r)*e+1;return-J0+g*p},c=h=>{const g=Math.exp(-h*e),p=(r-h)*(e*e);return g*p});const f=5/e,m=RU(l,c,f);if(e=to(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 OU=["duration","bounce"];function MU(e,t){return t.some(r=>e[r]!==void 0)}const mv=(e,t)=>(t?e>=0:e>0)&&e<1/0;function ey(e,t){if(mv(e,t))return e}function DU(e){const t=ey(e.stiffness),r=ey(e.damping,!0),a=ey(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&&MU(e,OU)};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*ko(.05,1,1-(e.bounce||0))*Math.sqrt(f);l={...l,mass:_n.mass,stiffness:f,damping:m}}else{const c=AU(l);l={...l,...c,mass:_n.mass},l.isResolvedFromDuration=!0}(!mv(l.stiffness)||!mv(l.damping,!0))&&(l.stiffness=_n.stiffness,l.damping=_n.damping)}return l}function zp(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:x}=DU({...r,velocity:-Sr(r.velocity||0)}),v=f/(2*Math.sqrt(u*m)),j=Sr(Math.sqrt(u/m)),S=v*j,N={target:l,delta:l-a,velocity:g||0,restSpeed:0,restDelta:0},C=()=>{const E=Math.abs(N.delta)<5;N.restSpeed=r.restSpeed||(E?_n.restSpeed.granular:_n.restSpeed.default),N.restDelta=r.restDelta||(E?_n.restDelta.granular:_n.restDelta.default)};C();let T,k,A;if(v<1){const E=fv(j,v),O={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};A=()=>{O.A=(N.velocity+S*N.delta)/E,O.sinC=S*O.A+N.delta*E,O.cosC=S*N.delta-O.A*E};const z=_=>{_!==O.t&&(O.t=_,O.env=Math.exp(-S*_),O.sin=Math.sin(E*_),O.cos=Math.cos(E*_))};T=_=>(z(_),N.target-O.env*(O.A*O.sin+N.delta*O.cos)),k=_=>(z(_),O.env*(O.sinC*O.sin+O.cosC*O.cos))}else if(v===1){T=O=>N.target-Math.exp(-j*O)*(N.delta+(N.velocity+j*N.delta)*O);const E={C:0};A=()=>{E.C=N.velocity+j*N.delta},k=O=>Math.exp(-j*O)*(j*E.C*O-N.velocity)}else{const E=j*Math.sqrt(v*v-1);T=z=>{const _=Math.exp(-S*z),B=Math.min(E*z,300);return N.target-_*((N.velocity+S*N.delta)*Math.sinh(B)+E*N.delta*Math.cosh(B))/E};const O={P:0,sinh:0,cosh:0};A=()=>{O.P=(N.velocity+S*N.delta)/E,O.sinh=S*O.P-N.delta*E,O.cosh=S*N.delta-O.P*E},k=z=>{const _=Math.exp(-S*z),B=Math.min(E*z,300);return _*(O.sinh*Math.sinh(B)+O.cosh*Math.cosh(B))}}A();const R=p&&h||null,M={calculatedDuration:R,retarget:(E,O)=>{N.target=E[E.length-1],N.delta=N.target-E[0],N.velocity=x?0:-Sr(O),r.restSpeed&&r.restDelta||C(),M.calculatedDuration=R,c.done=!1,A()},velocity:E=>to(k(E)),next:E=>{const O=T(E);if(p)c.done=E>=h;else{const z=to(k(E));c.done=Math.abs(z)<=N.restSpeed&&Math.abs(N.target-O)<=N.restDelta}return c.value=c.done?N.target:O,c},toString:()=>{const E=Math.min(hw(M),mw),O=T5(z=>M.next(E*z).value,E,30);return E+"ms "+O},toTransition:()=>{}};return M}zp.applyToOptions=e=>{const t=TU(e,100,zp);return e.ease=t.ease,e.duration=to(t.duration),e.type="keyframes",e};function hv({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],x={done:!1,value:p},v=E=>E<f||E>m,j=E=>f===void 0?m:m===void 0||Math.abs(f-E)<Math.abs(m-E)?f:m;let S=r*t;const N=p+S,C=u===void 0?N:u(N);C!==N&&(S=C-p);const T=E=>-S*Math.exp(-E/a),k=E=>{const O=T(E);x.done=Math.abs(O)<=h,x.value=x.done?C:C+O};let A,R;const M=E=>{v(x.value)&&(A=E,R=zp({keyframes:[x.value,j(x.value)],velocity:-T(E)/a*1e3,damping:l,stiffness:c,restDelta:h,restSpeed:g}))};return M(0),{calculatedDuration:null,next:E=>{let O=!1;return!R&&A===void 0&&(O=!0,k(E),M(E)),A!==void 0&&E>=A?R.next(E-A):(!O&&k(E),x)}}}function zU(e,t,r){const a=[],l=r||Ma.mix||fw,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]||jo:t;f=Df(m,f)}a.push(f)}return a}function E5(e,t,{clamp:r=!0,ease:a,mixer:l}={}){const c=e.length;if(qg(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=zU(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 x=Zd(e[p],e[p+1],g);return f[p](x)};return r?g=>h(ko(e[0],e[c-1],g)):h}function PU(e,t){const r=e[e.length-1];for(let a=1;a<=t;a++){const l=Zd(0,t,a);e.push(pn(r,1,l))}}function IU(e){const t=[0];return PU(t,e.length-1),t}function _U(e,t){return e.map(r=>r*t)}function LU(e,t){return e.map(()=>t||iw).splice(0,e.length-1)}function su({duration:e=300,keyframes:t,times:r,ease:a="easeInOut"}){const l=q7(a)?a.map(Tk):Tk(a)||iw,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:(Ma.mix||fw)(m,h);return{calculatedDuration:e,next:p=>(c.value=g?g(l(e>0?ko(0,1,p/e):1)):h,c.done=p>=e,c)}}const u=_U(r&&r.length===t.length?r:IU(t),e),f=E5(u,t,{ease:Array.isArray(l)?l:LU(t,l)});return{calculatedDuration:e,next:m=>(c.value=f(m),c.done=m>=e,c)}}const $U=5;function BU(e,t,r){const a=Math.max(t-$U,0);return i5(r-e(a),t-a)}function R5(e,t,r=0){return t<=0?r:e.velocity?e.velocity(t):BU(a=>e.next(a).value,t,e.next(t).value)}const VU=e=>e!==null;function Yg(e,{repeat:t,repeatType:r="loop"},a,l=1){const c=e.filter(VU),f=l<0||t&&r!=="loop"&&t%2===1?0:c.length-1;return!f||a===void 0?c[f]:a}const UU={decay:hv,inertia:hv,tween:su,keyframes:su,spring:zp};function pw(e){typeof e.type=="string"&&(e.type=UU[e.type])}function A5(e,t){return{kind:e,animation:t,timestamp:ys.now(),frameTimestamp:bs.timestamp,frameIsProcessing:bs.isProcessing}}function O5(e,t,r){const a=globalThis.__MOTION_INSPECT__;if(a)try{a({...A5("animation-start",e),options:r?{...t,...r}:t})}catch{}}function HU(e,t){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...A5("layout-animation-start",e),node:t})}catch{}}class Kg{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 FU=e=>e/100;class Pp extends Kg{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!==ys.now()&&this.tick(ys.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(),O5(this,this.options)}initAnimation(){const{options:t}=this;pw(t);const{type:r=su,repeat:a=0,repeatDelay:l=0,repeatType:c,velocity:u=0}=t;let{keyframes:f}=t;const m=r||su;m!==su&&typeof f[0]!="number"&&(this.mixKeyframes=Df(FU,fw(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=hw(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:x,repeatDelay:v,type:j,onUpdate:S,finalKeyframe:N}=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 C=this.currentTime-h*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?C<0:C>l;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=l);let k=this.currentTime,A=a;if(p){const O=Math.min(this.currentTime,l)/f;let z=Math.floor(O),_=O%1;!_&&O>=1&&(_=1),_===1&&z--,z=Math.min(z,p+1),!!(z%2)&&(x==="reverse"?(_=1-_,v&&(_-=v/f)):x==="mirror"&&(A=u)),k=ko(0,1,_)*f}let R;T?(this.delayState.value=g[0],R=this.delayState):R=A.next(k),c&&!T&&(R.value=c(R.value));let{done:M}=R;!T&&m!==null&&(M=this.playbackSpeed>=0?this.currentTime>=l:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return E&&j!==hv&&(R.value=Yg(g,this.options,N,this.speed)),S&&S(R.value),E&&this.finish(),R}then(t,r){return this.finished.then(t,r)}get duration(){return Sr(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Sr(t)}get time(){return Sr(this.currentTime)}set time(t){t=to(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 R5(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(ys.now()),this.playbackSpeed=t,r&&this.driver&&(this.time=Sr(this.currentTime))}play(){var l,c;if(this.isStopped)return;const{driver:t=kU,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(ys.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 GU=new Set(["brightness","contrast","saturate","opacity"]);function qU(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=r.match(cw)||[];if(!a)return e;const l=r.replace(a,"");let c=GU.has(t)?1:0;return a!==r&&(c*=100),t+"("+c+l+")"}const YU=/\b([a-z-]*)\(.*?\)/gu,pv={...Nr,getAnimatableNone:e=>{const t=e.match(YU);return t?t.map(qU).join(" "):e}},gv={...Nr,getAnimatableNone:e=>{const t=Nr.parse(e);return Nr.createTransformer(e)(t.map(a=>typeof a=="number"?0:typeof a=="object"?{...a,alpha:1}:a))}},zk={...wu,transform:Math.round},KU={rotate:ya,pathRotation:ya,rotateX:ya,rotateY:ya,rotateZ:ya,scale:Sh,scaleX:Sh,scaleY:Sh,scaleZ:Sh,skew:ya,skewX:ya,skewY:ya,distance:mt,translateX:mt,translateY:mt,translateZ:mt,x:mt,y:mt,z:mt,perspective:mt,transformPerspective:mt,opacity:Jd,originX:Rk,originY:Rk,originZ:mt},Ip={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,...KU,zIndex:zk,fillOpacity:Jd,strokeOpacity:Jd,numOctaves:zk},XU={...Ip,color:is,backgroundColor:is,outlineColor:is,fill:is,stroke:is,borderColor:is,borderTopColor:is,borderRightColor:is,borderBottomColor:is,borderLeftColor:is,filter:pv,WebkitFilter:pv,mask:gv,WebkitMask:gv},M5=e=>XU[e],WU=new Set([pv,gv]);function gw(e,t){let r=M5(e);return WU.has(r)||(r=Nr),r.getAnimatableNone?r.getAnimatableNone(t):void 0}function QU(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Ol=e=>e*180/Math.PI,xv=e=>{const t=Ol(Math.atan2(e[1],e[0]));return bv(t)},ZU={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:xv,rotateZ:xv,skewX:e=>Ol(Math.atan(e[1])),skewY:e=>Ol(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},bv=e=>(e=e%360,e<0&&(e+=360),e),Pk=xv,Ik=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),_k=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),JU={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ik,scaleY:_k,scale:e=>(Ik(e)+_k(e))/2,rotateX:e=>bv(Ol(Math.atan2(e[6],e[5]))),rotateY:e=>bv(Ol(Math.atan2(-e[2],e[0]))),rotateZ:Pk,rotate:Pk,skewX:e=>Ol(Math.atan(e[4])),skewY:e=>Ol(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function yv(e){return e.includes("scale")?1:0}function vv(e,t){if(!e||e==="none")return yv(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,l;if(r)a=JU,l=r;else{const f=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=ZU,l=f}if(!l)return yv(t);const c=a[t],u=l[1].split(",").map(tH);return typeof c=="function"?c(u):u[c]}const eH=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return vv(r,t)};function tH(e){return parseFloat(e.trim())}const ju=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Su=new Set([...ju,"pathRotation"]),Lk=e=>e===wu||e===mt,nH=new Set(["x","y","z"]),sH=ju.filter(e=>!nH.has(e));function rH(e){const t=[];return sH.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 oH=new Set(["bottom","right"]);function $k(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 zl={width:({width:e,paddingLeft:t="0",paddingRight:r="0",boxSizing:a},l)=>$k(e,l,"x",t,r,a),height:({height:e,paddingTop:t="0",paddingBottom:r="0",boxSizing:a},l)=>$k(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})=>vv(e,"x"),y:({transform:e})=>vv(e,"y")};zl.translateX=zl.x;zl.translateY=zl.y;const Pl=new Set;let wv=!1,jv=!1,Sv=!1;function D5(){if(jv){const e=[],t=new Set,r=new Set;Pl.forEach(l=>{l.needsMeasurement&&(e.push(l),t.add(l.element),oH.has(l.name)&&r.add(l.element))});const a=new Map;r.forEach(l=>{const c=rH(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)})}jv=!1,wv=!1,Pl.forEach(e=>e.complete(Sv)),Pl.clear()}function z5(){Pl.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(jv=!0)})}function aH(){Sv=!0,z5(),D5(),Sv=!1}function iH(e,t,r){if(typeof e=="string"){if(sw(e)||rw(e))return parseFloat(e);if(!Nr.test(e)&&Nr.test(r))return gw(t,r)}return e??void 0}class xw{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?(Pl.add(this),wv||(wv=!0,un.read(z5),un.resolveKeyframes(D5))):(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=iH(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])}QU(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Pl.delete(this)}cancel(){this.state==="scheduled"&&(Pl.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const lH=e=>e.startsWith("--");function P5(e,t,r){lH(t)?e.style.setProperty(t,r):e.style[t]=r}const cH={};function I5(e,t){const r=a5(e);return()=>cH[t]??r()}const uH=I5(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),_5=I5(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),zd=([e,t,r,a])=>`cubic-bezier(${e}, ${t}, ${r}, ${a})`,Bk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:zd([0,.65,.55,1]),circOut:zd([.55,0,1,.45]),backIn:zd([.31,.01,.66,-.59]),backOut:zd([.33,1.53,.69,.99])};function L5(e,t){if(e)return typeof e=="function"?_5()?T5(e,t):"ease-out":g5(e)?zd(e):Array.isArray(e)?e.map(r=>L5(r,t)||Bk.easeOut):Bk[e]}function dH(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=L5(f,l);Array.isArray(p)&&(g.easing=p);const x={delay:a,duration:l,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:c+1,direction:u==="reverse"?"alternate":"normal"};return h&&(x.pseudoElement=h),e.animate(g,x)}function $5(e){return typeof e=="function"&&"applyToOptions"in e}function fH({type:e,...t}){return $5(e)&&_5()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class B5 extends Kg{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,qg(typeof t.type!="string");const h=fH(t);this.animation=dH(r,a,l,h,c),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const g=Yg(l,this.options,f,this.speed);this.updateMotionValue&&this.updateMotionValue(g),P5(r,a,g),this.animation.cancel()}m==null||m(),this.notifyFinished()},O5(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 Sr(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Sr(t)}get time(){return Sr(Number(this.animation.currentTime)||0)}set time(t){const r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=to(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&&uH()?(this.animation.timeline=t,r&&(this.animation.rangeStart=r),a&&(this.animation.rangeEnd=a),jo):l(this)}}const V5={anticipate:m5,backInOut:f5,circInOut:p5};function mH(e){return e in V5}function hH(e){typeof e.ease=="string"&&mH(e.ease)&&(e.ease=V5[e.ease])}const ty=10;class pH extends B5{constructor(t){hH(t),pw(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 Pp({...u,autoplay:!1}),m=Math.max(ty,ys.now()-this.startTime),h=ko(0,ty,m-ty),g=f.sample(m).value,{name:p}=this.options;c&&p&&P5(c,p,g),r.setWithVelocity(f.sample(Math.max(0,m-h)).value,g,h),f.stop()}}const Vk=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Nr.test(e)||e==="0")&&!e.startsWith("url("));function gH(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 xH(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=Vk(l,t),f=Vk(c,t);return!u||!f?!1:gH(e)||(r==="spring"||$5(r))&&a}function Nv(e){e.duration=0,e.type="keyframes"}const Cv=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),bH=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function yH(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&bH.test(e[t]))return!0;return!1}const Uk=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),vH=a5(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function wH(e){var p;const{motionValue:t,name:r,repeatDelay:a,repeatType:l,damping:c,type:u,keyframes:f}=e;if(!r||!(Cv.has(r)||Uk.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 vH()&&(Cv.has(r)||Uk.has(r)&&yH(f))&&(r!=="transform"||!g)&&!h&&!a&&l!=="mirror"&&c!==0&&u!=="inertia"}const jH=40;class SH extends Kg{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=ys.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)||xw;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 N,C;this.keyframeResolver=void 0;const{name:c,type:u,velocity:f,delay:m,isHandoff:h,onUpdate:g}=a;this.resolvedAt=ys.now();let p=!0;xH(t,c,u,f)||(p=!1,(Ma.instantAnimations||!m)&&(g==null||g(Yg(t,a,r))),t[0]=t[t.length-1],Nv(a),a.repeat=0);const x=l?this.resolvedAt?this.resolvedAt-this.createdAt>jH?this.resolvedAt:this.createdAt:this.createdAt:void 0,{onComplete:v}=a;a.startTime??(a.startTime=x),a.finalKeyframe=r,a.keyframes=t,a.onComplete=()=>{v==null||v(),this.notifyFinished()};const j=p&&!h&&wH(a);let S;if(j){a.element=(C=(N=a.motionValue)==null?void 0:N.owner)==null?void 0:C.current;try{S=new pH(a)}catch{S=new Pp(a)}}else S=new Pp(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(),aH()),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 U5(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 Hk=30,NH=e=>!isNaN(parseFloat(e)),Bd={current:void 0};class CH{constructor(t,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const l=ys.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=ys.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=NH(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 Mp)).add(r)}onChangeSubscribe(t){const{events:r}=this;return!r.change&&!this.changeSubscriber?this.changeSubscriber=t:(r.change||(r.change=new Mp,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 Bd.current&&Bd.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=ys.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Hk)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,Hk);return i5(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 Hl(e,t){return new CH(e,t)}function H5(e,t){if(e!=null&&e.inherit&&t){const{inherit:r,...a}=e;return{...t,...a}}return e}function bw(e,t){const r=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return r!==e?H5(r,e):r}const kH={type:"spring",stiffness:500,damping:25,restSpeed:10},TH=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),EH={type:"keyframes",duration:.8},RH={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},AH=(e,{keyframes:t})=>t.length>2?EH:Su.has(e)?e.startsWith("scale")?TH(t[1]):kH:RH,OH=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function MH(e){for(const t in e)if(!OH.has(t))return!0;return!1}const yw=(e,t,r,a={},l,c)=>u=>{const f=bw(a,e)||{},m=f.delay||a.delay||0;let{elapsed:h=0}=a;h=h-to(m);const g={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...f,delay:-h,onUpdate:x=>{t.set(x),f.onUpdate&&f.onUpdate(x)},onComplete:()=>{u(),f.onComplete&&f.onComplete()},name:e,motionValue:t,element:c?void 0:l};MH(f)||Object.assign(g,AH(e,g)),g.duration&&(g.duration=to(g.duration)),g.repeatDelay&&(g.repeatDelay=to(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let p=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(Nv(g),g.delay===0&&(p=!0)),(Ma.instantAnimations||Ma.skipAnimations||l!=null&&l.shouldSkipAnimations||f.skipAnimations)&&(p=!0,Nv(g),g.delay=0),g.allowFlatten=!f.type&&!f.ease,p&&!c&&t.get()!==void 0){const x=Yg(g.keyframes,f);if(x!==void 0){un.update(()=>{g.onUpdate(x),g.onComplete()});return}}return f.isSync?new Pp(g):new SH(g)},DH=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function zH(e){const t=DH.exec(e);if(!t)return[,];const[,r,a,l]=t;return[`--${r??a}`,l]}function F5(e,t,r=1){const[a,l]=zH(e);if(!a)return;const c=window.getComputedStyle(t).getPropertyValue(a);if(c){const u=c.trim();return sw(u)?parseFloat(u):u}return lw(l)?F5(l,t,r+1):l}function Fk(e){const t=[{},{}];return e==null||e.values.forEach((r,a)=>{t[0][a]=r.get(),t[1][a]=r.getVelocity()}),t}function vw(e,t,r,a){if(typeof t=="function"){const[l,c]=Fk(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]=Fk(a);t=t(r!==void 0?r:e.custom,l,c)}return t}function Il(e,t,r){const a=e.getProps();return vw(a,t,r!==void 0?r:a.custom,e)}const G5=new Set(["width","height","top","left","right","bottom",...ju]),kv=e=>Array.isArray(e);function PH(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Hl(r))}function IH(e){return kv(e)?e[e.length-1]||0:e}function _H(e,t){const r=Il(e,t);let{transitionEnd:a={},transition:l={},...c}=r||{};c={...c,...a};for(const u in c){const f=IH(c[u]);PH(e,u,f)}}const cs=e=>!!(e&&e.getVelocity);function LH(e){return!!(cs(e)&&e.add)}function Tv(e,t){const r=e.getValue("willChange");if(LH(r))return r.add(t);if(!r&&Ma.WillChange){const a=new Ma.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function ww(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const $H="framerAppearId",q5="data-"+ww($H);function Y5(e){return e.props[q5]}const BH=typeof window<"u";function VH({protectedKeys:e,needsAnimating:t},r){const a=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,a}function K5(e,t,{delay:r=0,transitionOverride:a,type:l}={}){let{transition:c,transitionEnd:u,...f}=t;const m=e.getDefaultTransition();c=c?H5(c,m):m;const h=c==null?void 0:c.reduceMotion,g=c==null?void 0:c.skipAnimations;a&&(c=a);const p=[],x=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),N=f[j];if(N===void 0||x&&VH(x,j))continue;const C={delay:r,...bw(c||{},j)};g&&(C.skipAnimations=!0);const T=S.get();if(T!==void 0&&!S.isAnimating()&&!Array.isArray(N)&&N===T&&!C.velocity){un.update(()=>S.set(N));continue}let k=!1;if(BH&&window.MotionHandoffAnimation){const M=Y5(e);if(M){const E=window.MotionHandoffAnimation(M,j,un);E!==null&&(C.startTime=E,k=!0)}}Tv(e,j);const A=h??e.shouldReduceMotion;S.start(yw(j,S,N,A&&G5.has(j)?{type:!1}:C,e,k));const R=S.animation;R&&p.push(R)}if(u){const j=()=>un.update(()=>{u&&_H(e,u)});p.length?Promise.all(p).then(j):j()}return p}function Ev(e,t,r={}){var m;const a=Il(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(K5(e,a,r)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(h=0)=>{const{delayChildren:g=0,staggerChildren:p,staggerDirection:x}=l;return UH(e,t,h,g,p,x,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 UH(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(Ev(m,t,{...u,delay:r+(typeof a=="function"?0:a)+U5(e.variantChildren,m,a,l,c)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(f)}function HH(e,t,r={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const l=t.map(c=>Ev(e,c,r));a=Promise.all(l)}else if(typeof t=="string")a=Ev(e,t,r);else{const l=typeof t=="function"?Il(e,t,r.custom):t;a=Promise.all(K5(e,l,r))}return a.then(()=>{e.notify("AnimationComplete",t)})}const FH={test:e=>e==="auto",parse:e=>e},GH=e=>t=>t.test(e),qH=[wu,mt,Yo,ya,oU,rU,FH],Gk=e=>qH.find(GH(e));function YH(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||rw(e):!0}const KH=new Set(["auto","none","0"]);function XH(e,t,r){let a=0,l;for(;a<e.length&&!l;){const c=e[a];typeof c=="string"&&!KH.has(c)&&dU(c)&&(l=e[a]),a++}if(l&&r)for(const c of t)e[c]!==l&&(e[c]=gw(r,l))}class WH extends xw{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(),lw(p))){const x=F5(p,r.current);x!==void 0&&(t[g]=x),g===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!G5.has(a)||t.length!==2)return;const[l,c]=t;if(typeof l=="number"&&typeof c=="number")return;const u=Gk(l),f=Gk(c),m=Ek(l),h=Ek(c);if(m!==h&&zl[a]){this.needsMeasurement=!0;return}if(u!==f)if(Lk(u)&&Lk(f))for(let g=0;g<t.length;g++){const p=t[g];typeof p=="string"&&(t[g]=parseFloat(p))}else zl[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,a=[];for(let l=0;l<t.length;l++)(t[l]===null||YH(t[l]))&&a.push(l);a.length&&XH(t,a,r)}measure(){const{element:t,name:r}=this;return zl[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 jw=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Qh(e){return o5(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function Sw(e){return o5(e)&&"ownerSVGElement"in e}const Rv=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Nw(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 QH={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ZH=ju.length;function JH(e,t,r){let a="",l=!0;for(let u=0;u<ZH;u++){const f=ju[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=Rv(m,Ip[f]);if(!h){l=!1;const p=QH[f]||f;a+=`${p}(${g}) `}r&&(t[f]=g)}}const c=e.pathRotation;return c&&(l=!1,a+=`rotate(${Rv(c,Ip.pathRotation)}) `),a=a.trim(),r?a=r(t,l?"":a):l&&(a="none"),a}function Cw(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(Su.has(m)){u=!0;continue}else if(y5(m)){l[m]=h;continue}else{const g=Rv(h,Ip[m]);m.startsWith("origin")?(f=!0,c[m]=g):a[m]=g}}if(t.transform||(u||r?a.transform=JH(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 e9={offset:"stroke-dashoffset",array:"stroke-dasharray"},t9={offset:"strokeDashoffset",array:"strokeDasharray"};function n9(e,t,r=1,a=0,l=!0){e.pathLength=1;const c=l?e9:t9;e[c.offset]=`${-a}`,e[c.array]=`${t} ${r}`}const X5=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function W5(e,{attrX:t,attrY:r,attrScale:a,pathLength:l,pathSpacing:c=1,pathOffset:u=0,...f},m,h,g){if(Cw(e,f,h),m){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:x}=e;for(const v of X5)p[v]!==void 0&&(x[v]=p[v],delete p[v]);(x.transform||p.transformOrigin)&&(x.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),x.transform&&(x.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&&n9(p,l,c,u,!1)}function Q5({top:e,left:t,right:r,bottom:a}){return{x:{min:t,max:r},y:{min:e,max:a}}}function s9({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function r9(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 ny(e){return e===void 0||e===1}function Av({scale:e,scaleX:t,scaleY:r}){return!ny(e)||!ny(t)||!ny(r)}function Cl(e){return Av(e)||Z5(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Z5(e){return qk(e.x)||qk(e.y)}function qk(e){return e&&e!=="0%"}function _p(e,t,r){const a=e-r,l=t*a;return r+l}function Yk(e,t,r,a,l){return l!==void 0&&(e=_p(e,l,a)),_p(e,r,a)+t}function Ov(e,t=0,r=1,a,l){e.min=Yk(e.min,t,r,a,l),e.max=Yk(e.max,t,r,a,l)}function J5(e,{x:t,y:r}){Ov(e.x,t.translate,t.scale,t.originPoint),Ov(e.y,r.translate,r.scale,r.originPoint)}const Kk=.999999999999,Xk=1.0000000000001;function o9(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&&(Fo(e.x,-c.scroll.offset.x),Fo(e.y,-c.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,J5(e,u)),a&&Cl(c.latestValues)&&Zh(e,c.latestValues,(f=c.layout)==null?void 0:f.layoutBox))}t.x<Xk&&t.x>Kk&&(t.x=1),t.y<Xk&&t.y>Kk&&(t.y=1)}function Fo(e,t){e.min+=t,e.max+=t}function Wk(e,t,r,a,l=.5){const c=pn(e.min,e.max,l);Ov(e,t,r,c,a)}function Qk(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Zh(e,t,r){const a=r??e;Wk(e.x,Qk(t.x,a.x),t.scaleX,t.scale,t.originX),Wk(e.y,Qk(t.y,a.y),t.scaleY,t.scale,t.originY)}function eM(e,t){return Q5(r9(e.getBoundingClientRect(),t))}function a9(e,t,r){const a=eM(e,r),{scroll:l}=t;return l&&(Fo(a.x,l.offset.x),Fo(a.y,l.offset.y)),a}const{schedule:kw}=x5(queueMicrotask,!1),xo={x:!1,y:!1};function tM(){return xo.x||xo.y}function i9(e){return e==="x"||e==="y"?xo[e]?null:(xo[e]=!0,()=>{xo[e]=!1}):xo.x||xo.y?null:(xo.x=xo.y=!0,()=>{xo.x=xo.y=!1})}function nM(e,t){const r=Nw(e),a=new AbortController,l={passive:!0,...t,signal:a.signal};return[r,l,()=>a.abort()]}function l9(e){return!(e.pointerType==="touch"||tM())}function c9(e,t,r={}){const[a,l,c]=nM(e,r);return a.forEach(u=>{let f=!1,m=!1,h;const g=()=>{u.removeEventListener("pointerleave",j)},p=N=>{h&&(h(N),h=void 0),g()},x=N=>{f=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),m&&(m=!1,p(N))},v=()=>{f=!0,window.addEventListener("pointerup",x,l),window.addEventListener("pointercancel",x,l)},j=N=>{if(N.pointerType!=="touch"){if(f){m=!0;return}p(N)}},S=N=>{if(!l9(N))return;m=!1;const C=t(u,N);typeof C=="function"&&(h=C,u.addEventListener("pointerleave",j,l))};u.addEventListener("pointerenter",S,l),u.addEventListener("pointerdown",v,l)}),c}const sM=(e,t)=>t?e===t?!0:sM(e,t.parentElement):!1,Tw=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,u9=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function d9(e){return u9.has(e.tagName)||e.isContentEditable===!0}const f9=new Set(["INPUT","SELECT","TEXTAREA"]);function m9(e){return f9.has(e.tagName)||e.isContentEditable===!0}const Jh=new WeakSet;function Zk(e){return t=>{t.key==="Enter"&&e(t)}}function sy(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const h9=(e,t)=>{const r=e.currentTarget;if(!r)return;const a=Zk(()=>{if(Jh.has(r))return;sy(r,"down");const l=Zk(()=>{sy(r,"up")}),c=()=>sy(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 Jk(e){return Tw(e)&&!tM()}const eT=new WeakSet;function p9(e,t,r={}){const[a,l,c]=nM(e,r),u=f=>{const m=f.currentTarget;if(!Jk(f)||eT.has(f))return;Jh.add(m),r.stopPropagation&&eT.add(f);const h=t(m,f),g={...l,capture:!0},p=(j,S)=>{window.removeEventListener("pointerup",x,g),window.removeEventListener("pointercancel",v,g),Jh.has(m)&&Jh.delete(m),Jk(j)&&typeof h=="function"&&h(j,{success:S})},x=j=>{p(j,m===window||m===document||r.useGlobalTarget||sM(m,j.target))},v=j=>{p(j,!1)};window.addEventListener("pointerup",x,g),window.addEventListener("pointercancel",v,g)};return a.forEach(f=>{(r.useGlobalTarget?window:f).addEventListener("pointerdown",u,l),Qh(f)&&(f.addEventListener("focus",h=>h9(h,l)),!d9(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),c}const ep=new WeakMap;let Ni;const rM=(e,t,r)=>(a,l)=>l&&l[0]?l[0][e+"Size"]:Sw(a)&&"getBBox"in a?a.getBBox()[t]:a[r],g9=rM("inline","width","offsetWidth"),x9=rM("block","height","offsetHeight");function b9({target:e,borderBoxSize:t}){var r;(r=ep.get(e))==null||r.forEach(a=>{a(e,{get width(){return g9(e,t)},get height(){return x9(e,t)}})})}function y9(e){e.forEach(b9)}function v9(){typeof ResizeObserver>"u"||(Ni=new ResizeObserver(y9))}function w9(e,t){Ni||v9();const r=Nw(e);return r.forEach(a=>{let l=ep.get(a);l||(l=new Set,ep.set(a,l)),l.add(t),Ni==null||Ni.observe(a)}),()=>{r.forEach(a=>{const l=ep.get(a);l==null||l.delete(t),l!=null&&l.size||Ni==null||Ni.unobserve(a)})}}const tp=new Set;let Kc;function j9(){Kc=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};tp.forEach(t=>t(e))},window.addEventListener("resize",Kc)}function S9(e){return tp.add(e),Kc||j9(),()=>{tp.delete(e),!tp.size&&typeof Kc=="function"&&(window.removeEventListener("resize",Kc),Kc=void 0)}}function tT(e,t){return typeof e=="function"?S9(e):w9(e,t)}function N9(e){return Sw(e)&&e.tagName==="svg"}function C9(...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=E5(l,c,u);return t?f(a):f}const Pd=new Set,nT=({timestamp:e})=>{Pd.forEach(t=>t.tick(e))};class k9 extends Kg{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,pw(t),this.factory=t.type||su,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():(Pd.size||un.update(nT,!0),Pd.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:x}=r;x[0]=g,x[1]=this.nextTarget,this.retarget(x,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 R5(this.generator,this.currentTime,this.options.velocity)}now(){return this.driver?this.driver.now():ys.now()}teardown(){this.state="idle",this.driver?this.driver.stop():(Pd.delete(this),Pd.size||Jo(nT))}}function T9(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 x=rT(g);if((l==null?void 0:l.state)==="running"){l.setTarget(x,r.velocity);return}const v=rT(e.get()),j=l?l.getGeneratorVelocity():e.getVelocity();if(h(),v===x)return;const S={keyframes:[v,x],velocity:j,type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:f},N=l=new k9({...S,onPlay:m});e.animation=N,N.then(()=>{var C;l===N&&(l=null,e.animation=void 0,(C=e.events.animationComplete)==null||C.notify())})},h),cs(t)){let g=r.skipInitialAnimation===!0;const p=t.on("change",v=>{g?(g=!1,e.jump(sT(v,u),!1)):e.set(sT(v,u))}),x=e.on("destroy",p);return()=>{p(),x()}}return h}function sT(e,t){return t?e+t:e}function rT(e){return typeof e=="number"?e:parseFloat(e)}const oT=()=>({translate:0,scale:1,origin:0,originPoint:0}),Xc=()=>({x:oT(),y:oT()}),aT=()=>({min:0,max:0}),as=()=>({x:aT(),y:aT()}),E9=new WeakMap;function Xg(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function tf(e){return typeof e=="string"||Array.isArray(e)}const Ew=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Lp=["initial",...Ew];function Wg(e){if(Xg(e.animate))return!0;for(let t=0;t<Lp.length;t++)if(tf(e[Lp[t]]))return!0;return!1}function oM(e){return!!(Wg(e)||e.variants)}function R9(e,t,r){for(const a in t){const l=t[a],c=r[a];if(cs(l))e.addValue(a,l);else if(cs(c))e.addValue(a,Hl(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,Hl(u!==void 0?u:l,{owner:e}))}}for(const a in r)t[a]===void 0&&e.removeValue(a);return t}const $p={current:null},Rw={current:!1},A9=typeof window<"u";function aM(){if(Rw.current=!0,!!A9)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>$p.current=e.matches;e.addEventListener("change",t),t()}else $p.current=!1}const iT=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Bp={};function iM(e){Bp=e}function O9(){return Bp}class M9{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=xw,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=ys.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=Wg(r),this.isVariantNode=oM(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...x}=this.scrapeMotionValuesFromProps(r,{},this);for(const v in x){const j=x[v];h[v]!==void 0&&cs(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,E9.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:(Rw.current||aM(),this.shouldReduceMotion=$p.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(),Jo(this.notifyUpdate),Jo(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&&Cv.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:f,times:m,ease:h,duration:g}=r.accelerate,p=new B5({element:this.current,name:t,keyframes:f,times:m,ease:h,duration:to(g)}),x=u(p);this.valueSubscriptions.set(t,()=>{x(),p.cancel()});return}const a=Su.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 Bp){const r=Bp[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):as()}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<iT.length;a++){const l=iT[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=R9(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=Hl(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"&&(sw(a)||rw(a))?a=parseFloat(a):typeof a!="number"&&!Nr.test(a)&&Nr.test(r)&&(a=gw(t,r)),this.setBaseTarget(t,cs(a)?a.get():a)),cs(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=vw(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&&!cs(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 Mp),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){kw.render(this.render)}}class lM extends M9{constructor(){super(...arguments),this.KeyframeResolver=WH}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;cs(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class Ui{constructor(t){this.isMounted=!1,this.node=t}update(){}}function cM(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 lT(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const kd={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(mt.test(e))e=parseFloat(e);else return e;const r=lT(e,t.target.x),a=lT(e,t.target.y);return`${r}% ${a}%`}},D9={correct:(e,{treeScale:t,projectionDelta:r})=>{const a=e,l=Nr.parse(e);if(l.length>5)return a;const c=Nr.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)}},Mv={borderRadius:{...kd,applyTo:[...jw]},borderTopLeftRadius:kd,borderTopRightRadius:kd,borderBottomLeftRadius:kd,borderBottomRightRadius:kd,boxShadow:D9};function uM(e,{layout:t,layoutId:r}){return Su.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!Mv[e]||e==="opacity")}function Aw(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)(cs(a[f])||l&&cs(l[f])||uM(f,e)||((u=r==null?void 0:r.getValue(f))==null?void 0:u.liveStyle)!==void 0)&&(c[f]=a[f]);return c}function z9(e){return window.getComputedStyle(e)}class P9 extends lM{constructor(){super(...arguments),this.type="html",this.renderInstance=cM}mount(t){qg(!!t.style),super.mount(t)}readValueFromInstance(t,r){var a;if(Su.has(r))return(a=this.projection)!=null&&a.isProjecting?yv(r):eH(t,r);{const l=z9(t),c=(y5(r)?l.getPropertyValue(r):l[r])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(t,{transformPagePoint:r}){return eM(t,r)}build(t,r,a){Cw(t,r,a.transformTemplate)}scrapeMotionValuesFromProps(t,r,a){return Aw(t,r,a)}}const dM=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"]),fM=e=>typeof e=="string"&&e.toLowerCase()==="svg";function I9(e,t,r,a){cM(e,t,void 0,a);for(const l in t.attrs)e.setAttribute(dM.has(l)?l:ww(l),t.attrs[l])}function mM(e,t,r){const a=Aw(e,t,r);for(const l in e)if(cs(e[l])||cs(t[l])){const c=ju.indexOf(l)!==-1?"attr"+l.charAt(0).toUpperCase()+l.substring(1):l;a[c]=e[l]}return a}class _9 extends lM{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=as}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Su.has(r)){const a=M5(r);return a&&a.default||0}if(X5.includes(r)){const l=getComputedStyle(t)[r];if(typeof l=="string"&&l)return l.trim()}return r=dM.has(r)?r:ww(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,a){return mM(t,r,a)}build(t,r,a){W5(t,r,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,r,a,l){I9(t,r,a,l)}mount(t){this.isSVGTag=fM(t.tagName),super.mount(t)}}const L9=Lp.length;function hM(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?hM(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<L9;r++){const a=Lp[r],l=e.props[a];(tf(l)||l===!1)&&(t[a]=l)}return t}function pM(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 $9=[...Ew].reverse(),B9=Ew.length;function V9(e){return t=>Promise.all(t.map(({animation:r,options:a})=>HH(e,r,a)))}function U9(e){let t=V9(e),r=cT(),a=!0,l=!1;const c=h=>(g,p)=>{var v;const x=Il(e,p,h==="exit"?(v=e.presenceContext)==null?void 0:v.custom:void 0);if(x){const{transition:j,transitionEnd:S,...N}=x;g={...g,...N,...S}}return g};function u(h){t=h(e)}function f(h){const{props:g}=e,p=hM(e.parent)||{},x=[],v=new Set;let j={},S=1/0;for(let C=0;C<B9;C++){const T=$9[C],k=r[T],A=g[T]!==void 0?g[T]:p[T],R=tf(A),M=T===h?k.isActive:null;M===!1&&(S=C);let E=A===p[T]&&A!==g[T]&&R;if(E&&(a||l)&&e.manuallyAnimateOnMount&&(E=!1),k.protectedKeys={...j},!k.isActive&&M===null||!A&&!k.prevProp||Xg(A)||typeof A=="boolean")continue;if(T==="exit"&&k.isActive&&M!==!0){k.prevResolvedValues&&(j={...j,...k.prevResolvedValues});continue}const O=H9(k.prevProp,A);let z=O||T===h&&k.isActive&&!E&&R||C>S&&R,_=!1;const B=Array.isArray(A)?A:[A];let q=B.reduce(c(T),{});M===!1&&(q={});const{prevResolvedValues:I={}}=k,L={...I,...q},H=G=>{z=!0,v.has(G)&&(_=!0,v.delete(G)),k.needsAnimating[G]=!0;const X=e.getValue(G);X&&(X.liveStyle=!1)};for(const G in L){const X=q[G],$=I[G];if(j.hasOwnProperty(G))continue;let Q=!1;kv(X)&&kv($)?Q=!pM(X,$)||O:Q=X!==$,Q?X!=null?H(G):v.add(G):X!==void 0&&v.has(G)?H(G):k.protectedKeys[G]=!0}k.prevProp=A,k.prevResolvedValues=q,k.isActive&&(j={...j,...q}),(a||l)&&e.blockInitialAnimation&&(z=!1);const F=E&&O;z&&(!F||_)&&x.push(...B.map(G=>{const X={type:T};if(typeof G=="string"&&(a||l)&&!F&&e.manuallyAnimateOnMount&&e.parent){const{parent:$}=e,Q=Il($,G);if($.enteringChildren&&Q){const{delayChildren:K}=Q.transition||{};X.delay=U5($.enteringChildren,e,K)}}return{animation:G,options:X}}))}if(v.size){const C={};if(typeof g.initial!="boolean"){const T=Il(e,Array.isArray(g.initial)?g.initial[0]:g.initial);T&&T.transition&&(C.transition=T.transition)}v.forEach(T=>{const k=e.getBaseTarget(T),A=e.getValue(T);A&&(A.liveStyle=!0),C[T]=k??null}),x.push({animation:C})}let N=!!x.length;return a&&(g.initial===!1||g.initial===g.animate)&&!e.manuallyAnimateOnMount&&(N=!1),a=!1,l=!1,N?t(x):Promise.resolve()}function m(h,g){var x;if(r[h].isActive===g)return Promise.resolve();(x=e.variantChildren)==null||x.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=cT(),l=!0}}}function H9(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!pM(t,e):!1}function jl(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function cT(){return{animate:jl(!0),whileInView:jl(),whileHover:jl(),whileTap:jl(),whileDrag:jl(),whileFocus:jl(),exit:jl()}}function Dv(e,t){e.min=t.min,e.max=t.max}function go(e,t){Dv(e.x,t.x),Dv(e.y,t.y)}function uT(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const gM=1e-4,F9=1-gM,G9=1+gM,xM=.01,q9=0-xM,Y9=0+xM;function Ys(e){return e.max-e.min}function K9(e,t,r){return Math.abs(e-t)<=r}function dT(e,t,r,a=.5){e.origin=a,e.originPoint=pn(t.min,t.max,e.origin),e.scale=Ys(r)/Ys(t),e.translate=pn(r.min,r.max,e.origin)-e.originPoint,(e.scale>=F9&&e.scale<=G9||isNaN(e.scale))&&(e.scale=1),(e.translate>=q9&&e.translate<=Y9||isNaN(e.translate))&&(e.translate=0)}function Vd(e,t,r,a){dT(e.x,t.x,r.x,a?a.originX:void 0),dT(e.y,t.y,r.y,a?a.originY:void 0)}function fT(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+Ys(t)}function X9(e,t,r,a){fT(e.x,t.x,r.x,a==null?void 0:a.x),fT(e.y,t.y,r.y,a==null?void 0:a.y)}function mT(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+Ys(t)}function Vp(e,t,r,a){mT(e.x,t.x,r.x,a==null?void 0:a.x),mT(e.y,t.y,r.y,a==null?void 0:a.y)}function hT(e,t,r,a,l){return e-=t,e=_p(e,1/r,a),l!==void 0&&(e=_p(e,1/l,a)),e}function W9(e,t=0,r=1,a=.5,l,c=e,u=e){if(Yo.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=hT(e.min,t,r,f,l),e.max=hT(e.max,t,r,f,l)}function pT(e,t,[r,a,l],c,u){W9(e,t[r],t[a],t[l],t.scale,c,u)}const Q9=["x","scaleX","originX"],Z9=["y","scaleY","originY"];function gT(e,t,r,a){pT(e.x,t,Q9,r?r.x:void 0,a?a.x:void 0),pT(e.y,t,Z9,r?r.y:void 0,a?a.y:void 0)}function xT(e){return e.translate===0&&e.scale===1}function bM(e){return xT(e.x)&&xT(e.y)}function bT(e,t){return e.min===t.min&&e.max===t.max}function J9(e,t){return bT(e.x,t.x)&&bT(e.y,t.y)}function yT(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function yM(e,t){return yT(e.x,t.x)&&yT(e.y,t.y)}function vT(e){return Ys(e.x)/Ys(e.y)}function wT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Vo(e){return[e("x"),e("y")]}function eF(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:x,rotateY:v,skewX:j,skewY:S}=r;h&&(a=`perspective(${h}px) ${a}`),g&&(a+=`rotate(${g}deg) `),p&&(a+=`rotate(${p}deg) `),x&&(a+=`rotateX(${x}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 tF=jw.length,jT=e=>typeof e=="string"?parseFloat(e):e,ST=e=>typeof e=="number"||mt.test(e);function nF(e,t,r,a,l,c){l?(e.opacity=pn(0,r.opacity??1,sF(a)),e.opacityExit=pn(t.opacity??1,0,rF(a))):c&&(e.opacity=pn(t.opacity??1,r.opacity??1,a));for(let u=0;u<tF;u++){const f=jw[u];let m=NT(t,f),h=NT(r,f);if(m===void 0&&h===void 0)continue;m||(m=0),h||(h=0),m===0||h===0||ST(m)===ST(h)?(e[f]=Math.max(pn(jT(m),jT(h),a),0),(Yo.test(h)||Yo.test(m))&&(e[f]+="%")):e[f]=h}(t.rotate||r.rotate)&&(e.rotate=pn(t.rotate||0,r.rotate||0,a))}function NT(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const sF=vM(0,.5,h5),rF=vM(.5,.95,jo);function vM(e,t,r){return a=>a<e?0:a>t?1:r(Zd(e,t,a))}function oF(e,t,r){const a=cs(e)?e:Hl(e);return a.start(yw("",a,t,r)),a.animation}function nf(e,t,r,a={passive:!0}){return e.addEventListener(t,r,a),()=>e.removeEventListener(t,r,a)}const aF=(e,t)=>e.depth-t.depth;class iF{constructor(){this.children=[],this.isDirty=!1}add(t){nw(this.children,t),this.isDirty=!0}remove(t){Op(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(aF),this.isDirty=!1,this.children.forEach(t)}}function lF(e,t){const r=ys.now(),a=({timestamp:l})=>{const c=l-r;c>=t&&(Jo(a),e(c-t))};return un.setup(a,!0),()=>Jo(a)}function np(e){return cs(e)?e.get():e}class cF{constructor(){this.members=[]}add(t){nw(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&&(Op(this.members,a),a.unmount())}t.scheduleRender()}remove(t){if(Op(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 sp={hasAnimatedSinceResize:!0,hasEverUpdated:!1},ry=["","X","Y","Z"],uF=1e3;let dF=0;function oy(e,t,r,a){const{latestValues:l}=t;l[e]&&(r[e]=l[e],t.setStaticValue(e,0),a&&(a[e]=0))}function wM(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=Y5(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&&wM(a)}function jM({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:a,resetTransform:l}){return class{constructor(u={},f=t==null?void 0:t()){this.id=dF++,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(hF),this.nodes.forEach(vF),this.nodes.forEach(wF),this.nodes.forEach(pF)},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 iF)}addEventListener(u,f){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Mp),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=Sw(u)&&!N9(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 x=()=>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=lF(x,250),sp.hasAnimatedSinceResize&&(sp.hasAnimatedSinceResize=!1,this.nodes.forEach(TT)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&h&&(f||m)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:p,hasRelativeLayoutChanged:x,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||h.getDefaultTransition()||kF,{onLayoutAnimationStart:S,onLayoutAnimationComplete:N}=h.getProps(),C=!this.targetLayout||!yM(this.targetLayout,v),T=!p&&x;if(this.options.layoutRoot||this.resumeFrom||T||p&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...bw(j,"layout"),onPlay:S,onComplete:N};(h.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(g,T,k.path)}else p||TT(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(),Jo(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(jF),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&&wM(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(xF),this.nodes.forEach(CT);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(kT);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(bF),this.nodes.forEach(yF),this.nodes.forEach(fF),this.nodes.forEach(mF)):this.nodes.forEach(kT),this.clearAllSnapshots();const f=ys.now();bs.delta=ko(0,1e3/60,f-bs.timestamp),bs.timestamp=f,bs.isProcessing=!0,X0.update.process(bs),X0.preRender.process(bs),X0.render.process(bs),bs.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,kw.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(gF),this.sharedNodes.forEach(SF)}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&&!Ys(this.snapshot.measuredBox.x)&&!Ys(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=as()),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&&!bM(this.projectionDelta),m=this.getTransformTemplate(),h=m?m(this.latestValues,""):void 0,g=h!==this.prevTransformTemplateValue;u&&this.instance&&(f||Cl(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)),TF(m),{animationId:this.root.animationId,measuredBox:f,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var h;const{visualElement:u}=this.options;if(!u)return as();const f=u.measureViewportBox();if(!(((h=this.scroll)==null?void 0:h.wasRoot)||this.path.some(EF))){const{scroll:g}=this.root;g&&(Fo(f.x,g.offset.x),Fo(f.y,g.offset.y))}return f}removeElementScroll(u){var m;const f=as();if(go(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:x}=g;g!==this.root&&p&&x.layoutScroll&&(p.wasRoot&&go(f,u),Fo(f.x,p.offset.x),Fo(f.y,p.offset.y))}return f}applyTransform(u,f=!1,m){var g,p;const h=m||as();go(h,u);for(let x=0;x<this.path.length;x++){const v=this.path[x];!f&&v.options.layoutScroll&&v.scroll&&v!==v.root&&(Fo(h.x,-v.scroll.offset.x),Fo(h.y,-v.scroll.offset.y)),Cl(v.latestValues)&&Zh(h,v.latestValues,(g=v.layout)==null?void 0:g.layoutBox)}return Cl(this.latestValues)&&Zh(h,this.latestValues,(p=this.layout)==null?void 0:p.layoutBox),h}removeTransform(u){var m;const f=as();go(f,u);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!Cl(g.latestValues))continue;let p;g.instance&&(Av(g.latestValues)&&g.updateSnapshot(),p=as(),go(p,g.measurePageBox())),gT(f,g.latestValues,(m=g.snapshot)==null?void 0:m.layoutBox,p)}return Cl(this.latestValues)&&gT(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!==bs.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=bs.timestamp;const x=this.getClosestProjectingParent();x&&this.linkedParentVersion!==x.layoutVersion&&!x.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&x&&x.layout?this.createRelativeTarget(x,this.layout.layoutBox,x.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=as(),this.targetWithTransforms=as()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),X9(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):go(this.target,this.layout.layoutBox),J5(this.target,this.targetDelta)):go(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?this.createRelativeTarget(x,this.target,x.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Av(this.parent.latestValues)||Z5(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=as(),this.relativeTargetOrigin=as(),Vp(this.relativeTargetOrigin,f,m,this.options.layoutAnchor||void 0),go(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===bs.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;go(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,x=this.treeScale.y;o9(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=as());const{target:v}=u;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(uT(this.prevProjectionDelta.x,this.projectionDelta.x),uT(this.prevProjectionDelta.y,this.projectionDelta.y)),Vd(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==x||!wT(this.projectionDelta.x,this.prevProjectionDelta.x)||!wT(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=Xc(),this.projectionDelta=Xc(),this.projectionDeltaWithTransform=Xc()}setAnimationOrigin(u,f=!1,m){const h=this.snapshot,g=h?h.latestValues:{},p={...this.latestValues},x=Xc();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const v=as(),j=h?h.source:void 0,S=this.layout?this.layout.source:void 0,N=j!==S,C=this.getStack(),T=!C||C.members.length<=1,k=!!(N&&!T&&this.options.crossfade===!0&&!this.path.some(CF));this.animationProgress=0;let A;const R=m==null?void 0:m.interpolateProjection(u);this.mixTargetDelta=M=>{const E=M/1e3,O=R==null?void 0:R(E);O?(x.x.translate=O.x,x.x.scale=pn(u.x.scale,1,E),x.x.origin=u.x.origin,x.x.originPoint=u.x.originPoint,x.y.translate=O.y,x.y.scale=pn(u.y.scale,1,E),x.y.origin=u.y.origin,x.y.originPoint=u.y.originPoint):(ET(x.x,u.x,E),ET(x.y,u.y,E)),this.setTargetDelta(x),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Vp(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),NF(this.relativeTarget,this.relativeTargetOrigin,v,E),A&&J9(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=as()),go(A,this.relativeTarget)),N&&(this.animationValues=p,nF(p,g,this.latestValues,E,k,T)),O&&O.rotate!==void 0&&(this.animationValues||(this.animationValues=p),this.animationValues.pathRotation=O.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},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&&(Jo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=un.update(()=>{sp.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Hl(0)),this.motionValue.jump(0,!1),this.currentAnimation=oF(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()}}),HU(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(uF),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&&SM(this.options.animationType,this.layout.layoutBox,m.layoutBox)){g=this.target||as();const p=Ys(this.layout.layoutBox.x);g.x.min=u.target.x.min,g.x.max=g.x.min+p;const x=Ys(this.layout.layoutBox.y);g.y.min=u.target.y.min,g.y.max=g.y.min+x}go(f,g),Zh(f,h),Vd(this.projectionDeltaWithTransform,this.layoutCorrected,f,h)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new cF),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&&oy("z",u,h,this.animationValues);for(let g=0;g<ry.length;g++)oy(`rotate${ry[g]}`,u,h,this.animationValues),oy(`skew${ry[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=np(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=np(f==null?void 0:f.pointerEvents)||""),this.hasProjected&&!Cl(this.latestValues)&&(u.transform=m?m({},""):"none",this.hasProjected=!1);return}u.visibility="";const g=h.animationValues||h.latestValues;this.applyTransformsToTarget();let p=eF(this.projectionDeltaWithTransform,this.treeScale,g);m&&(p=m(g,p)),u.transform=p;const{x,y:v}=this.projectionDelta;u.transformOrigin=`${x.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 Mv){if(g[j]===void 0)continue;const{correct:S,applyTo:N,isCSSVariable:C}=Mv[j],T=p==="none"?g[j]:S(g[j],h);if(N){const k=N.length;for(let A=0;A<k;A++)u[N[A]]=T}else C?this.options.visualElement.renderState.vars[j]=T:u[j]=T}this.options.layoutId&&(u.pointerEvents=h===this?np(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(CT),this.root.sharedNodes.clear()}}}function fF(e){e.updateLayout()}function mF(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")Vo(p=>{const x=u?t.measuredBox[p]:t.layoutBox[p],v=Ys(x);x.min=a[p].min,x.max=x.min+v});else if(c==="x"||c==="y"){const p=c==="x"?"y":"x";Dv(u?t.measuredBox[p]:t.layoutBox[p],a[p])}else SM(c,t.layoutBox,a)&&Vo(p=>{const x=u?t.measuredBox[p]:t.layoutBox[p],v=Ys(a[p]);x.max=x.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+v)});const f=Xc();Vd(f,a,t.layoutBox);const m=Xc();u?Vd(m,e.applyTransform(l,!0),t.measuredBox):Vd(m,a,t.layoutBox);const h=!bM(f);let g=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:x,layout:v}=p;if(x&&v){const j=e.options.layoutAnchor||void 0,S=as();Vp(S,t.layoutBox,x.layoutBox,j);const N=as();Vp(N,a,v.layoutBox,j),yM(S,N)||(g=!0),p.options.layoutRoot&&(e.relativeTarget=N,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 hF(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 pF(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function gF(e){e.clearSnapshot()}function CT(e){e.clearMeasurements()}function xF(e){e.isLayoutDirty=!0,e.updateLayout()}function kT(e){e.isLayoutDirty=!1}function bF(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function yF(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function TT(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function vF(e){e.resolveTargetDelta()}function wF(e){e.calcProjection()}function jF(e){e.resetSkewAndRotation()}function SF(e){e.removeLeadSnapshot()}function ET(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 RT(e,t,r,a){e.min=pn(t.min,r.min,a),e.max=pn(t.max,r.max,a)}function NF(e,t,r,a){RT(e.x,t.x,r.x,a),RT(e.y,t.y,r.y,a)}function CF(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const kF={duration:.45,ease:[.4,0,.1,1]},AT=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),OT=AT("applewebkit/")&&!AT("chrome/")?Math.round:jo;function MT(e){e.min=OT(e.min),e.max=OT(e.max)}function TF(e){MT(e.x),MT(e.y)}function SM(e,t,r){return e==="position"||e==="preserve-aspect"&&!K9(vT(t),vT(r),.2)}function EF(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const RF=jM({attachResizeListener:(e,t)=>nf(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}),ay={current:void 0},NM=jM({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ay.current){const e=new RF({});e.mount(window),e.setOptions({layoutScroll:!0}),ay.current=e}return ay.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),If=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function DT(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function AF(...e){return t=>{let r=!1;const a=e.map(l=>{const c=DT(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():DT(e[l],null)}}}}function OF(...e){return b.useCallback(AF(...e),e)}class MF extends b.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(Qh(r)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=r.offsetParent,l=Qh(a)&&a.offsetWidth||0,c=Qh(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 DF({children:e,isPresent:t,anchorX:r,anchorY:a,root:l,pop:c}){var x;const u=b.useId(),f=b.useRef(null),m=b.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:h}=b.useContext(If),g=c!==!1?((x=e.props)==null?void 0:x.ref)??(e==null?void 0:e.ref):void 0,p=OF(f,g);return b.useInsertionEffect(()=>{const{width:v,height:j,top:S,left:N,right:C,bottom:T,direction:k}=m.current;if(t||c===!1||!f.current||!v||!j)return;const A=k==="rtl",R=r==="left"?A?`right: ${C}`:`left: ${N}`:A?`left: ${N}`:`right: ${C}`,M=a==="bottom"?`bottom: ${T}`:`top: ${S}`;f.current.dataset.motionPopId=u;const E=document.createElement("style");h&&(E.nonce=h);const O=l??document.head;return O.appendChild(E),E.sheet&&E.sheet.insertRule(`
|
|
497
|
-
[data-motion-pop-id="${u}"] {
|
|
498
|
-
position: absolute !important;
|
|
499
|
-
width: ${v}px !important;
|
|
500
|
-
height: ${j}px !important;
|
|
501
|
-
${R}px !important;
|
|
502
|
-
${M}px !important;
|
|
503
|
-
}
|
|
504
|
-
`),()=>{var z;(z=f.current)==null||z.removeAttribute("data-motion-pop-id"),O.contains(E)&&O.removeChild(E)}},[t]),s.jsx(MF,{isPresent:t,childRef:f,sizeRef:m,pop:c,children:c===!1?e:b.cloneElement(e,{ref:p})})}const zF=({children:e,initial:t,isPresent:r,onExitComplete:a,custom:l,presenceAffectsLayout:c,mode:u,anchorX:f,anchorY:m,root:h})=>{const g=Mf(PF),p=b.useId(),x=b.useRef(r),v=b.useRef(a);uu(()=>{x.current=r,v.current=a});let j=!0,S=b.useMemo(()=>(j=!1,{id:p,initial:t,isPresent:r,custom:l,onExitComplete:N=>{g.set(N,!0);for(const C of g.values())if(!C)return;a&&a()},register:N=>(g.set(N,!1),()=>{var C;g.delete(N),!x.current&&!g.size&&((C=v.current)==null||C.call(v))})}),[r,g,a]);return c&&j&&(S={...S}),b.useMemo(()=>{g.forEach((N,C)=>g.set(C,!1))},[r]),b.useEffect(()=>{!r&&!g.size&&a&&a()},[r]),e=s.jsx(DF,{pop:u==="popLayout",isPresent:r,anchorX:f,anchorY:m,root:h,children:e}),s.jsx(Gg.Provider,{value:S,children:e})};function PF(){return new Map}function CM(e=!0){const t=b.useContext(Gg);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:a,register:l}=t,c=b.useId();b.useEffect(()=>{if(e)return l(c)},[e]);const u=b.useCallback(()=>e&&a&&a(c),[c,a,e]);return!r&&a?[!1,u]:[!0]}const Nh=e=>e.key||"";function zT(e){const t=[];return b.Children.forEach(e,r=>{b.isValidElement(r)&&t.push(r)}),t}const Fl=({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]=CM(u),x=b.useMemo(()=>zT(e),[e]),v=u&&!g?[]:x.map(Nh),j=b.useRef(!0),S=b.useRef(x),N=Mf(()=>new Map),C=b.useRef(new Set),[T,k]=b.useState(x),[A,R]=b.useState(x);uu(()=>{u&&!g&&!A.length&&(p==null||p())},[g,u,A.length,p]),uu(()=>{j.current=!1,S.current=x;for(let O=0;O<A.length;O++){const z=Nh(A[O]);v.includes(z)?(N.delete(z),C.current.delete(z)):N.get(z)!==!0&&N.set(z,!1)}},[A,v.length,v.join("-")]);const M=[];if(x!==T){let O=[...x],z=0;for(const _ of A){const B=v.indexOf(Nh(_));B===-1?(O.splice(z++,0,_),M.push(_)):z=B+M.length+1}return c==="wait"&&M.length&&(O=M),R(zT(O)),k(x),null}const{forceRender:E}=b.useContext(tw);return s.jsx(s.Fragment,{children:A.map(O=>{const z=Nh(O),_=u&&!g?!1:x===A||v.includes(z),B=()=>{if(C.current.has(z))return;if(N.has(z))C.current.add(z),N.set(z,!0);else return;let q=!0;N.forEach(I=>{I||(q=!1)}),q&&(E==null||E(),R(S.current),u&&(p==null||p()),a&&a())};return s.jsx(zF,{isPresent:_,initial:!j.current||r?void 0:!1,custom:t,presenceAffectsLayout:l,mode:c,root:h,onExitComplete:_?void 0:B,anchorX:f,anchorY:m,children:O},z)})})},kM=b.createContext({strict:!1}),PT={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 IT=!1;function IF(){if(IT)return;const e={};for(const t in PT)e[t]={isEnabled:r=>PT[t].some(a=>!!r[a])};iM(e),IT=!0}function TM(){return IF(),O9()}function _F(e){const t=TM();for(const r in e)t[r]={...t[r],...e[r]};iM(t)}const Qg=b.createContext({});function LF(e,t){if(Wg(e)){const{initial:r,animate:a}=e;return{initial:r===!1||tf(r)?r:void 0,animate:tf(a)?a:void 0}}return e.inherit!==!1?t:{}}function $F(e){const{initial:t,animate:r}=LF(e,b.useContext(Qg));return b.useMemo(()=>({initial:t,animate:r}),[_T(t),_T(r)])}function _T(e){return Array.isArray(e)?e.join(" "):e}const Ow=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function EM(e,t,r){for(const a in t)!cs(t[a])&&!uM(a,r)&&(e[a]=t[a])}function BF({transformTemplate:e},t){return b.useMemo(()=>{const r=Ow();return Cw(r,t,e),Object.assign({},r.vars,r.style)},[t])}function VF(e,t){const r=e.style||{},a={};return EM(a,r,e),Object.assign(a,BF(e,t)),a}function UF(e,t){const r={},a=VF(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 RM=()=>({...Ow(),attrs:{}});function HF(e,t,r,a){const l=b.useMemo(()=>{const c=RM();return W5(c,t,fM(a),e.transformTemplate,e.style),{...c.attrs,style:{...c.style}}},[t]);if(e.style){const c={};EM(c,e.style,e),l.style={...c,...l.style}}return l}const FF=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 Up(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||FF.has(e)}function GF(e,t){return e.startsWith("on")?!Up(e):(t==null?void 0:t(e))??!Up(e)}function qF(e,t,r,a){const l={};for(const c in e)c==="values"&&typeof e.values=="object"||cs(e[c])||(GF(c,a)||r===!0&&Up(c)||!t&&!Up(c)||e.draggable&&c.startsWith("onDrag"))&&(l[c]=e[c]);return l}const YF=["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 Mw(e){return typeof e!="string"||e.includes("-")?!1:!!(YF.indexOf(e)>-1||/[A-Z]/u.test(e))}function KF(e,t,r,{latestValues:a},l,c=!1,u,f){const h=(u??Mw(e)?HF:UF)(t,a,l,e),g=qF(t,typeof e=="string",c,f),p=e!==b.Fragment?{...g,...h,ref:r}:{},{children:x}=t,v=b.useMemo(()=>cs(x)?x.get():x,[x]);return b.createElement(e,{...p,children:v})}function XF({scrapeMotionValuesFromProps:e,createRenderState:t},r,a,l){return{latestValues:WF(r,a,l,e),renderState:t()}}function WF(e,t,r,a){const l={},c=a(e,{});for(const x in c)l[x]=np(c[x]);let{initial:u,animate:f}=e;const m=Wg(e),h=oM(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"&&!Xg(p)){const x=Array.isArray(p)?p:[p];for(let v=0;v<x.length;v++){const j=vw(e,x[v]);if(j){const{transitionEnd:S,transition:N,...C}=j;for(const T in C){let k=C[T];if(Array.isArray(k)){const A=g?k.length-1:0;k=k[A]}k!==null&&(l[T]=k)}for(const T in S)l[T]=S[T]}}}return l}const AM=e=>(t,r)=>{const a=b.useContext(Qg),l=b.useContext(Gg),c=()=>XF(e,t,a,l);return r?c():Mf(c)},QF=AM({scrapeMotionValuesFromProps:Aw,createRenderState:Ow}),ZF=AM({scrapeMotionValuesFromProps:mM,createRenderState:RM}),JF=Symbol.for("motionComponentSymbol");function eG(e,t,r){const a=b.useRef(r);b.useInsertionEffect(()=>{a.current=r});const l=b.useRef(null);return b.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 OM=b.createContext({});function qc(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function tG(e,t,r,a,l,c){var k,A;const{visualElement:u}=b.useContext(Qg),f=b.useContext(kM),m=b.useContext(Gg),h=b.useContext(If),g=h.reducedMotion,p=h.skipAnimations,x=b.useRef(null),v=b.useRef(!1);a=a||f.renderer,!x.current&&a&&(x.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&&x.current&&(x.current.manuallyAnimateOnMount=!0));const j=x.current,S=b.useContext(OM);j&&!j.projection&&l&&(j.type==="html"||j.type==="svg")&&nG(x.current,r,l,S);const N=b.useRef(!1);b.useInsertionEffect(()=>{j&&N.current&&j.update(r,m)});const C=r[q5],T=b.useRef(!!C&&typeof window<"u"&&!((k=window.MotionHandoffIsComplete)!=null&&k.call(window,C))&&((A=window.MotionHasOptimisedAnimation)==null?void 0:A.call(window,C)));return uu(()=>{var R;!v.current||!j||((R=j.animationState)==null||R.animateChanges(),j.enteringChildren=void 0)},[]),uu(()=>{v.current=!0,j&&(N.current=!0,window.MotionIsMounted=!0,j.updateFeatures(),j.scheduleRenderMicrotask(),T.current&&j.animationState&&j.animationState.animateChanges())}),b.useEffect(()=>{j&&(!T.current&&j.animationState&&j.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{var R;(R=window.MotionHandoffMarkAsComplete)==null||R.call(window,C)}),T.current=!1),j.enteringChildren=void 0)}),j}function nG(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:MM(e.parent)),e.projection.setOptions({layoutId:l,layout:c,alwaysMeasureLayout:!!u||f&&qc(f),visualElement:e,animationType:typeof c=="string"?c:"both",initialPromotionConfig:a,crossfade:p,layoutScroll:m,layoutRoot:h,layoutAnchor:g})}function MM(e){if(e)return e.options.allowProjection!==!1?e.projection:MM(e.parent)}function iy(e,{forwardMotionProps:t=!1,type:r}={},a,l){a&&_F(a);const c=r?r==="svg":Mw(e),u=c?ZF:QF;function f(h,g){let p;const x={...b.useContext(If),...h,layoutId:sG(h)},{isStatic:v,isValidProp:j}=x,S=$F(h),N=u(h,v);if(!v&&typeof window<"u"){rG();const C=oG(x);p=C.MeasureLayout,S.visualElement=tG(e,N,x,l,C.ProjectionNode,c)}return s.jsxs(Qg.Provider,{value:S,children:[p&&S.visualElement?s.jsx(p,{visualElement:S.visualElement,...x}):null,KF(e,h,eG(N,S.visualElement,g),N,v,t,c,j)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=b.forwardRef(f);return m[JF]=e,m}function sG({layoutId:e}){const t=b.useContext(tw).id;return t&&e!==void 0?t+"-"+e:e}function rG(e,t){b.useContext(kM).strict}function oG(e){const t=TM(),{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 aG(e,t){if(typeof Proxy>"u")return iy;const r=new Map,a=(c,u)=>iy(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,iy(u,void 0,e,t)),r.get(u))})}const iG=(e,t)=>t.isSVG??Mw(e)?new _9(t):new P9(t,{allowProjection:e!==b.Fragment});class lG extends Ui{constructor(t){super(t),t.animationState||(t.animationState=U9(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Xg(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 cG=0;class uG extends Ui{constructor(){super(...arguments),this.id=cG++,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=Il(this.node,u,f);if(m){const{transition:h,transitionEnd:g,...p}=m;for(const x in p)(c=this.node.getValue(x))==null||c.jump(p[x])}}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 dG={animation:{Feature:lG},exit:{Feature:uG}};function Zg(e){return{point:{x:e.pageX,y:e.pageY}}}const fG=e=>t=>Tw(t)&&e(t,Zg(t));function Ud(e,t,r,a){return nf(e,t,fG(r),a)}const DM=({current:e})=>e?e.ownerDocument.defaultView:null,LT=(e,t)=>Math.abs(e-t);function mG(e,t){const r=LT(e.x,t.x),a=LT(e.y,t.y);return Math.sqrt(r**2+a**2)}const $T=new Set(["auto","scroll"]);class zM{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=Ch(this.lastRawMoveEventInfo,this.transformPagePoint));const j=ly(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,N=mG(j.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!N)return;const{point:C}=j;this.history.push({...C,timestamp:ys.now()});const{onStart:T,onMove:k}=this.handlers;S||(T&&T(this.lastMoveEvent,j),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,j)},this.handlePointerMove=(j,S)=>{this.lastMoveEvent=j,this.lastRawMoveEventInfo=S,this.lastMoveEventInfo=Ch(S,this.transformPagePoint),this.hasPendingMove=!0,un.update(this.updatePoint,!0)},this.handlePointerUp=(j,S)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:N,onSessionEnd:C,resumeAnimation:T}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&T&&T(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=ly(j.type==="pointercancel"?this.lastMoveEventInfo:Ch(S,this.transformPagePoint),this.history);this.startEvent&&N&&N(j,k),C&&C(j,k)},!Tw(t))return;this.dragSnapToOrigin=c,this.handlers=r,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=l||window;const m=Zg(t),h=Ch(m,this.transformPagePoint),{point:g}=h,{timestamp:p}=bs;this.history=[{...g,timestamp:p}];const{onSessionStart:x}=r;x&&x(t,ly(h,this.history));const v={passive:!0,capture:!0};this.removeListeners=Df(Ud(this.contextWindow,"pointermove",this.handlePointerMove,v),Ud(this.contextWindow,"pointerup",this.handlePointerUp,v),Ud(this.contextWindow,"pointercancel",this.handlePointerUp,v)),f&&this.startScrollTracking(f)}startScrollTracking(t){let r=t.parentElement;for(;r;){const a=getComputedStyle(r);($T.has(a.overflowX)||$T.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(),Jo(this.updatePoint)}}function Ch(e,t){return t?{point:t(e.point)}:e}function BT(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ly({point:e},t){return{point:e,delta:BT(e,PM(t)),offset:BT(e,hG(t)),velocity:pG(t,.1)}}function hG(e){return e[0]}function PM(e){return e[e.length-1]}function pG(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,a=null;const l=PM(e);for(;r>=0&&(a=e[r],!(l.timestamp-a.timestamp>to(t)));)r--;if(!a)return{x:0,y:0};a===e[0]&&e.length>2&&l.timestamp-a.timestamp>to(t)*2&&(a=e[1]);const c=Sr(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 gG(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 VT(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 xG(e,{top:t,left:r,bottom:a,right:l}){return{x:VT(e.x,r,l),y:VT(e.y,t,a)}}function UT(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 bG(e,t){return{x:UT(e.x,t.x),y:UT(e.y,t.y)}}function yG(e,t){let r=.5;const a=Ys(e),l=Ys(t);return l>a?r=Zd(t.min,t.max-a,e.min):a>l&&(r=Zd(e.min,e.max-l,t.min)),ko(0,1,r)}function vG(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 zv=.35;function wG(e=zv){return e===!1?e=0:e===!0&&(e=zv),{x:HT(e,"left","right"),y:HT(e,"top","bottom")}}function HT(e,t,r){return{min:FT(e,t),max:FT(e,r)}}function FT(e,t){return typeof e=="number"?e:e[t]||0}const jG=new WeakMap;class SG{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=as(),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,x)=>{const{drag:v,dragPropagation:j,onDragStart:S}=this.getProps();if(v&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=i9(v),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Vo(C=>{let T=this.getAxisMotionValue(C).get()||0;if(Yo.test(T)){const{projection:k}=this.visualElement;if(k&&k.layout){const A=k.layout.layoutBox[C];A&&(T=Ys(A)*(parseFloat(T)/100))}}this.originPoint[C]=T}),S&&un.update(()=>S(p,x),!1,!0),Tv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},f=(p,x)=>{this.latestPointerEvent=p,this.latestPanInfo=x;const{dragPropagation:v,dragDirectionLock:j,onDirectionLock:S,onDrag:N}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:C}=x;if(j&&this.currentDirection===null){this.currentDirection=CG(C),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",x.point,C),this.updateAxis("y",x.point,C),this.visualElement.render(),N&&un.update(()=>N(p,x),!1,!0)},m=(p,x)=>{this.latestPointerEvent=p,this.latestPanInfo=x,this.stop(p,x),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 zM(t,{onSessionStart:c,onStart:u,onMove:f,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:a,contextWindow:DM(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||!kh(t,l,this.currentDirection))return;const c=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=gG(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&&qc(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&a?this.constraints=xG(a.layoutBox,t):this.constraints=!1,this.elastic=wG(r),l!==this.constraints&&!qc(t)&&a&&this.constraints&&!this.hasMutatedConstraints&&Vo(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=vG(a.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!qc(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=a9(a,l.root,this.visualElement.getTransformPagePoint());let u=bG(l.layout.layoutBox,c);if(r){const f=r(s9(u));this.hasMutatedConstraints=!!f,f&&(u=Q5(f))}return u}startAnimation(t){const{drag:r,dragMomentum:a,dragElastic:l,dragTransition:c,dragSnapToOrigin:u,onDragTransitionEnd:f}=this.getProps(),m=this.constraints||{},h=Vo(g=>{if(!kh(g,r,this.currentDirection))return;let p=m&&m[g]||{};(u===!0||u===g)&&(p={min:0,max:0});const x=l?200:1e6,v=l?40:1e7,j={type:"inertia",velocity:a?t[g]:0,bounceStiffness:x,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 Tv(this.visualElement,t),a.start(yw(t,a,0,r,this.visualElement,!1))}stopAnimation(){Vo(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();Vo(m=>{if(!kh(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(!qc(r)||!a||!this.constraints)return;this.stopAnimation();const l=this.constraints,c={x:0,y:0};Vo(f=>{const m=this.getAxisMotionValue(f).get();c[f]=yG({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(),Vo(f=>{const m=this.getAxisMotionValue(f);if(!kh(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;jG.set(this.visualElement,this);const t=this.visualElement.current,r=Ud(t,"pointerdown",h=>{const{drag:g,dragListener:p=!0}=this.getProps(),x=h.target,v=x!==t&&m9(x);g&&p&&!v&&this.start(h)});let a;const l=()=>{const{dragConstraints:h}=this.getProps();qc(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(a=NG(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=nf(window,"resize",()=>this.scalePositionWithinConstraints()),m=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Vo(p=>{const x=this.getAxisMotionValue(p);x&&(this.originPoint[p]+=h[p].translate,x.set(x.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=zv,dragMomentum:f=!0}=t;return{...t,drag:r,dragDirectionLock:a,dragPropagation:l,dragConstraints:c,dragElastic:u,dragMomentum:f}}}function GT(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function NG(e,t,r){const a=tT(e,GT(r)),l=tT(t,GT(r));return()=>{a(),l()}}function kh(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function CG(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class kG extends Ui{constructor(t){super(t),this.removeGroupControls=jo,this.removeListeners=jo,this.controls=new SG(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||jo}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 cy=e=>(t,r)=>{e&&un.update(()=>e(t,r),!1,!0)};class TG extends Ui{constructor(){super(...arguments),this.removePointerDownListener=jo}onPointerDown(t){this.session=new zM(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:DM(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:a,onPanEnd:l}=this.node.getProps();return{onSessionStart:cy(t),onStart:cy(r),onMove:cy(a),onEnd:(c,u)=>{delete this.session,l&&un.postRender(()=>l(c,u))}}}mount(){this.removePointerDownListener=Ud(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 uy=!1;class EG extends b.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),uy&&c.root.didUpdate(),c.addEventListener("animationComplete",()=>{this.safeToRemove()}),c.setOptions({...c.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),sp.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}),uy=!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(),kw.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:a}=this.props,{projection:l}=t;uy=!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 IM(e){const[t,r]=CM(),a=b.useContext(tw);return s.jsx(EG,{...e,layoutGroup:a,switchLayoutGroup:b.useContext(OM),isPresent:t,safeToRemove:r})}const RG={pan:{Feature:TG},drag:{Feature:kG,ProjectionNode:NM,MeasureLayout:IM}};function qT(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,Zg(t)))}class AG extends Ui{mount(){const{current:t}=this.node;t&&(this.unmount=c9(t,(r,a)=>(qT(this.node,a,"Start"),l=>qT(this.node,l,"End"))))}unmount(){}}class OG extends Ui{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=Df(nf(this.node.current,"focus",()=>this.onFocus()),nf(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function YT(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,Zg(t)))}class MG extends Ui{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:r,propagate:a}=this.node.props;this.unmount=p9(t,(l,c)=>(YT(this.node,c,"Start"),(u,{success:f})=>YT(this.node,u,f?"End":"Cancel")),{useGlobalTarget:r,stopPropagation:(a==null?void 0:a.tap)===!1})}unmount(){}}const Pv=new WeakMap,dy=new WeakMap,DG=e=>{const t=Pv.get(e.target);t&&t(e)},zG=e=>{e.forEach(DG)};function PG({root:e,...t}){const r=e||document;dy.has(r)||dy.set(r,{});const a=dy.get(r),l=JSON.stringify(t);return a[l]||(a[l]=new IntersectionObserver(zG,{root:e,...t})),a[l]}function IG(e,t,r){const a=PG(t);return Pv.set(e,r),a.observe(e),()=>{Pv.delete(e),a.unobserve(e)}}const _G={some:0,all:1};class LG extends Ui{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:_G[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:x}=this.node.getProps(),v=g?p:x;v&&v(h)};this.stopObserver=IG(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($G(t,r))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function $G({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const BG={inView:{Feature:LG},tap:{Feature:MG},focus:{Feature:OG},hover:{Feature:AG}},VG={layout:{ProjectionNode:NM,MeasureLayout:IM}},UG={...dG,...BG,...RG,...VG},HG=aG(UG,iG);function Dw(e){const t=Mf(()=>Hl(e)),{isStatic:r}=b.useContext(If);if(r){const[,a]=b.useState(e);b.useEffect(()=>t.on("change",a),[])}return t}function _M(e,t){const r=Dw(t()),a=()=>r.set(t());return a(),uu(()=>{const l=()=>un.preRender(a,!1,!0),c=e.map(u=>u.on("change",l));return()=>{c.forEach(u=>u()),Jo(a)}}),r}function FG(e){Bd.current=[],e();const t=_M(Bd.current,e);return Bd.current=void 0,t}function GG(e,t,r,a){if(typeof e=="function")return FG(e);const c=C9(t,r,a),u=Array.isArray(e)?KT(e,c):KT([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 KT(e,t){const r=Mf(()=>[]);return _M(e,()=>{r.length=0;const a=e.length;for(let l=0;l<a;l++)r[l]=e[l].get();return t(r)})}function qG(e,t={}){const{isStatic:r}=b.useContext(If),a=()=>cs(e)?e.get():e;if(r)return GG(a);const l=Dw(a());return b.useInsertionEffect(()=>T9(l,e,t),[l,JSON.stringify(t)]),l}function YG(e,t={}){return qG(e,{type:"spring",...t})}function Ls(){!Rw.current&&aM();const[e]=b.useState($p.current);return e}const KG={some:0,all:1};function XG(e,t,{root:r,margin:a,amount:l="some"}={}){const c=Nw(e),u=new WeakMap,f=h=>{h.forEach(g=>{const p=u.get(g.target);if(g.isIntersecting!==!!p)if(g.isIntersecting){const x=t(g.target,g);typeof x=="function"?u.set(g.target,x):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:KG[l]});return c.forEach(h=>m.observe(h)),()=>m.disconnect()}function LM(e,{root:t,margin:r,amount:a,once:l=!1,initial:c=!1}={}){const[u,f]=b.useState(c);return b.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 XG(e.current,m,h)},[t,e,r,l,a]),u}const Rn=HG,XT=e=>typeof e=="function"?void 0:e.filter;function Ko({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=b.useRef(null),x=LM(p,{once:!0,margin:m}),v=!f||x,j=Ls(),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)"}},N=r??S,C=XT(N.hidden),T=XT(N.visible),k=C!=null&&T!=null&&C!==T;return s.jsx(Fl,{children:s.jsx(Rn.div,{ref:p,initial:j?!1:"hidden",animate:v?"visible":"hidden",exit:"hidden",variants:N,transition:{delay:.04+l,duration:j?0:a,ease:"easeOut",...k?{filter:{duration:a}}:{}},className:t,...g,children:e})})}function Dt({className:e,...t}){return s.jsx(_l,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:ms("size-4 animate-spin motion-reduce:animate-none",e),...t})}const Jg=[{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 $M(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 x=Jg.find(S=>{var N;return S.name.toLowerCase()===p.toLowerCase()||S.commands.includes(p.toLowerCase())||((N=S.aliases)==null?void 0:N.some(C=>C.toLowerCase()===p.toLowerCase()))});return x?[{resources:(j=(v=e==null?void 0:e.agentInventory)==null?void 0:v.resources)==null?void 0:j[x.name],name:x.name,logo:`/logos/agents/${x.logo}.svg`}]:u?[{name:p,logo:null}]:[]});return m.filter((p,x)=>m.findIndex(v=>v.name.toLowerCase()===p.name.toLowerCase())===x)}function fy(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 WG=`
|
|
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
|
-
`,Hp=[{id:"ubuntu:24.04",name:"Ubuntu 24.04"},{id:"debian:12-slim",name:"Debian 12 slim"}],QG=["git","curl","ripgrep"],Th=(e,t="bash")=>`curl -fsSL ${e} -o /tmp/install-agent.sh && ${t} /tmp/install-agent.sh && rm /tmp/install-agent.sh`,ZG=[{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:Th("https://cursor.com/install")},{id:"antigravity",command:"agy",install:Th("https://antigravity.google/cli/install.sh")},{id:"copilot",command:"copilot",npm:"@github/copilot"},{id:"kiro",command:"kiro-cli",packages:["unzip"],install:Th("https://cli.kiro.dev/install")},{id:"droid",command:"droid",install:Th("https://app.factory.ai/cli","sh")},{id:"aider",command:"aider",python:!0}],_s=ZG.map(e=>{const t=Jg.find(r=>r.commands.includes(e.command));return{...e,name:t.name,logo:`/logos/agents/${t.logo}.svg`}}),Iv=e=>_s.filter(t=>e.agents.includes(t.id)),_v=[{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}],JG="/run/openshell-supervisor-ca/material/ca-bundle.crt",Fp=[..._s.map(e=>({id:e.command,name:e.name})),{id:"",name:"Shell"}],eq=/^[a-z0-9]([a-z0-9-]{0,17}[a-z0-9])?$/,tq=8e3,ex=e=>e.source==="build"&&Array.isArray(e.agents)&&new Set(e.agents).size+(Array.isArray(e.customAgents)?e.customAgents.length:0)>1;function va(e={}){const t={name:"",source:"build",agents:["claude"],customAgents:[],repository:"",runtimes:[],base:Hp[0].id,packages:[...QG],setup:"",image:"",environment:[],command:"claude",setups:[],setupRevisions:{},...e};return ex(t)&&(t.command=""),t}const WT=e=>e.split(/[\s,]+/).filter(Boolean),my=e=>`openshell-image-recipe-v3:${e}`;function QT(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 nq(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 sq(e){let t=2166136261;for(const r of Lv(e))t=Math.imul(t^r.charCodeAt(0),16777619);return(t>>>0).toString(16).padStart(8,"0")}const hy=e=>"'"+e.replaceAll("'","'\\''")+"'",rq=/^[a-zA-Z0-9][a-zA-Z0-9._/:@-]{0,255}$/;function oq(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."),eq.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=>!_s.some(a=>a.id===r)))&&(t.agents="Choose a supported agent."),(!Array.isArray(e.runtimes)||e.runtimes.some(r=>!_v.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."}Hp.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"?rq.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."),ex(e)&&e.command!==""&&(t.command="Templates with multiple agents must start in Shell."),!Object.keys(t).length&&new TextEncoder().encode(JSON.stringify(nq(e))).length>tq&&(t.setup="This recipe is too large to store with the template. Shorten the setup commands or package list."),t}function Lv(e){var u,f,m;const t=Iv(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(hy).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 = ${JG}' >> /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 -- ${hy(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' ${WG.split(`
|
|
512
|
-
`).map(hy).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 ZT="openshell.console/session",aq="openshell.console/project",rp=e=>!!(e!=null&&e.remote&&/^console-ssh-[a-f0-9]{24}$/.test(e.name??e.gateway??"")),iq=e=>{var r;const t=(r=e==null?void 0:e.labels)==null?void 0:r[aq];return typeof t=="string"&&/^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(t)?t:null},lq={shell:"/bin/bash -l",...Object.fromEntries(_s.map(e=>[e.command,e.command]))},cq=e=>Object.hasOwn(lq,e??""),uq=e=>{var t;return cq((t=e==null?void 0:e.labels)==null?void 0:t[ZT])?e.labels[ZT]:"shell"},BM=e=>{var t;return e==="shell"?"Shell":((t=_s.find(r=>r.command===e))==null?void 0:t.name)??e};function aJ(e){const t=uq(e),r=$M(e).flatMap(l=>_s.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:BM(l)}))]}function Gp(e,t,r,a=typeof r=="string"?r:(r==null?void 0:r.target)??OR()){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 zw=b.createContext(null);function Da({location:e,children:t}){const r=sg(),a=_r(),l=a!=null&&a.localViewer&&(e!=null&&e.target)?e.target:r.target,c=b.useMemo(()=>Cr(l,r.signal,e==null?void 0:e.context),[l,r.signal,e==null?void 0:e.context]),u=b.useMemo(()=>({location:e,api:c}),[e,c]);return s.jsx(MP,{target:e==null?void 0:e.target,children:s.jsx(zw.Provider,{value:u,children:t})})}function Bt(){var t;const e=sg();return((t=b.useContext(zw))==null?void 0:t.api)??e}function Cn(){var e;return((e=b.useContext(zw))==null?void 0:e.location)??null}function Pw(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 tx=(e,t)=>e.appliesTo.everyone||Pw(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)),dq=e=>e.startsWith("*")||!e.includes(".")?[e]:[e,`**.${e}`],fq=e=>e.flatMap(dq);function VM(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 UM=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48).replace(/-$/,""),So=(e,t)=>{var r;return Pw((r=e==null?void 0:e.assignments)==null?void 0:r[t])},mq=(e,t)=>(e??[]).filter(r=>tx(r,t)),HM=(e,t)=>(e??[]).filter(r=>!r.appliesTo.everyone&&r.appliesTo.groups.includes(t));function JT({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(Ra,{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 hq({onCreated:e,existing:t}){const r=Bt(),[a,l]=b.useState(!1),[c,u]=b.useState(""),[f,m]=b.useState(!1),[h,g]=b.useState(null),p=UM(c),x=t.some(j=>j.id===p);async function v(){if(!(!p||x)){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(At,{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||x,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&s.jsx(Dt,{"aria-hidden":"true"}),"Create"]}),s.jsx(ue,{type:"button",size:"xs",variant:"ghost",onClick:()=>{l(!1),u("")},children:"Cancel"})]}),(h||x)&&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(us,{className:"size-3","aria-hidden":"true"}),"New group"]})}function sf({groups:e,counts:t={},value:r,onChange:a,multiple:l=!1,required:c=!1,allowCreate:u=!0,onCreated:f}){const m=b.useId(),h=l?r:r?[r]:[],g=p=>{a(l?h.includes(p)?h.filter(x=>x!==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(JT,{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(Ra,{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(JT,{pressed:h.includes(p.id),onClick:()=>g(p.id),count:t[p.id],children:p.name},p.id)),u&&s.jsx(hq,{existing:e,onCreated:p=>{f==null||f(p),g(p.id)}})]})}const Is=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"),Un=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 FM(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 No({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:[Is(e),!e.connected&&" · Disconnected"]}):null}function pq(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 gq=e=>{switch(e){case"success":return yq;case"info":return wq;case"warning":return vq;case"error":return jq;default:return null}},xq=Array(12).fill(0),bq=({visible:e,className:t})=>Ze.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ze.createElement("div",{className:"sonner-spinner"},xq.map((r,a)=>Ze.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),yq=Ze.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ze.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"})),vq=Ze.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ze.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"})),wq=Ze.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ze.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"})),jq=Ze.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ze.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"})),Sq=Ze.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"},Ze.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ze.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Nq=()=>{const[e,t]=Ze.useState(document.hidden);return Ze.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)},[]),e};let Cq=1;const kq=100,eE=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:Cq++};class Tq{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-kq;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=eE(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],Ze.isValidElement(h))c=!1,this.create({id:a,type:"default",message:h});else if(Rq(h)&&!h.ok){c=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,x=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,j=typeof p=="object"&&!Ze.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:x,...j})}else if(h instanceof Error){c=!1;const p=typeof r.error=="function"?await r.error(h):r.error,x=typeof r.description=="function"?await r.description(h):r.description,j=typeof p=="object"&&!Ze.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:x,...j})}else if(r.success!==void 0){c=!1;const p=typeof r.success=="function"?await r.success(h):r.success,x=typeof r.description=="function"?await r.description(h):r.description,j=typeof p=="object"&&!Ze.isValidElement(p)?p:{message:p};this.create({id:a,type:"success",description:x,...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"&&!Ze.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=eE(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 rr=new Tq,Eq=(e,t)=>rr.message(e,t),Rq=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Aq=Eq,Oq=()=>rr.toasts,Mq=()=>rr.getActiveToasts(),He=Object.assign(Aq,{success:rr.success,info:rr.info,warning:rr.warning,error:rr.error,custom:rr.custom,message:rr.message,promise:rr.promise,dismiss:rr.dismiss,loading:rr.loading},{getHistory:Oq,getToasts:Mq});pq("[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 Eh(e){return e.label!==void 0}const Dq=3,zq="24px",Pq="16px",tE=4e3,Iq=356,_q=14,Lq=45,$q=200;function Bo(...e){return e.filter(Boolean).join(" ")}function Bq(e){const[t,r]=e.split("-"),a=[];return t&&a.push(t),r&&a.push(r),a}const Vq=e=>{var t,r,a,l,c,u,f,m,h;const{invert:g,toast:p,unstyled:x,interacting:v,setHeights:j,visibleToasts:S,heights:N,index:C,toasts:T,expanded:k,removeToast:A,defaultRichColors:R,closeButton:M,style:E,cancelButtonStyle:O,actionButtonStyle:z,className:_="",descriptionClassName:B="",duration:q,position:I,gap:L,expandByDefault:H,classNames:F,icons:V,closeButtonAriaLabel:G="Close toast"}=e,[X,$]=Ze.useState(null),[Q,K]=Ze.useState(null),[se,P]=Ze.useState(!1),[U,Z]=Ze.useState(!1),[te,le]=Ze.useState(!1),[de,oe]=Ze.useState(!1),[ne,ee]=Ze.useState(!1),[W,ce]=Ze.useState(0),[Re,_e]=Ze.useState(0),Ne=Ze.useRef(p.duration||q||tE),Ae=Ze.useRef(null),J=Ze.useRef(null),re=C===0,xe=C+1<=S,he=p.type,Be=he??"default",we=p.dismissible!==!1,Ye=p.className||"",Ee=p.descriptionClassName||"",Ce=Ze.useMemo(()=>N.findIndex(Fe=>Fe.toastId===p.id)||0,[N,p.id]),be=Ze.useMemo(()=>{var Fe;return(Fe=p.closeButton)!=null?Fe:M},[p.closeButton,M]),Ue=Ze.useMemo(()=>p.duration||q||tE,[p.duration,q]),Je=Ze.useRef(0),dt=Ze.useRef(0),lt=Ze.useRef(0),Ie=Ze.useRef(null),[ot,We]=I.split("-"),me=Ze.useMemo(()=>N.reduce((Fe,yt,Et)=>Et>=Ce?Fe:Fe+yt.height,0),[N,Ce]),Oe=Nq(),Me=Ze.useMemo(()=>{var Fe;return(Fe=e.swipeDirections)!=null?Fe:Bq(I)},[e.swipeDirections,I]),nt=p.invert||g,Ge=he==="loading";dt.current=Ze.useMemo(()=>Ce*L+me,[Ce,me]),Ze.useEffect(()=>{Ne.current=Ue},[Ue]),Ze.useEffect(()=>{P(!0)},[]),Ze.useEffect(()=>{const Fe=J.current;if(Fe){const yt=Fe.getBoundingClientRect().height;return _e(yt),j(Et=>[{toastId:p.id,height:yt,position:p.position},...Et]),()=>j(Et=>Et.filter(Nt=>Nt.toastId!==p.id))}},[j,p.id]),Ze.useLayoutEffect(()=>{if(!se)return;const Fe=J.current,yt=Fe.style.height;Fe.style.height="auto";const Et=Fe.getBoundingClientRect().height;Fe.style.height=yt,_e(Et),j(Nt=>Nt.find(Ct=>Ct.toastId===p.id)?Nt.map(Ct=>Ct.toastId===p.id?{...Ct,height:Et}:Ct):[{toastId:p.id,height:Et,position:p.position},...Nt])},[se,p.title,p.description,j,p.id,p.jsx,p.action,p.cancel]);const qe=Ze.useCallback(()=>{Z(!0),ce(dt.current),j(Fe=>Fe.filter(yt=>yt.toastId!==p.id)),setTimeout(()=>{A(p)},$q)},[p,A,j,dt]);Ze.useEffect(()=>{if(p.promise&&he==="loading"||p.duration===1/0||p.type==="loading")return;let Fe;return k||v||Oe?(()=>{if(lt.current<Je.current){const Nt=new Date().getTime()-Je.current;Ne.current=Ne.current-Nt}lt.current=new Date().getTime()})():(()=>{Ne.current!==1/0&&(Je.current=new Date().getTime(),Fe=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),qe()},Ne.current))})(),()=>clearTimeout(Fe)},[k,v,p,he,Oe,qe]),Ze.useEffect(()=>{p.delete&&(qe(),p.onDismiss==null||p.onDismiss.call(p,p))},[qe,p.delete]);function ht(){var Fe;if(V!=null&&V.loading){var yt;return Ze.createElement("div",{className:Bo(F==null?void 0:F.loader,p==null||(yt=p.classNames)==null?void 0:yt.loader,"sonner-loader"),"data-visible":he==="loading"},V.loading)}return Ze.createElement(bq,{className:Bo(F==null?void 0:F.loader,p==null||(Fe=p.classNames)==null?void 0:Fe.loader),visible:he==="loading"})}const pe=p.icon||(V==null?void 0:V[he])||gq(he);var De,Qe;return Ze.createElement("li",{tabIndex:0,ref:J,className:Bo(_,Ye,F==null?void 0:F.toast,p==null||(t=p.classNames)==null?void 0:t.toast,F==null?void 0:F[Be],p==null||(r=p.classNames)==null?void 0:r[Be]),"data-sonner-toast":"","data-rich-colors":(De=p.richColors)!=null?De:R,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":se,"data-promise":!!p.promise,"data-swiped":ne,"data-removed":U,"data-visible":xe,"data-y-position":ot,"data-x-position":We,"data-index":C,"data-front":re,"data-swiping":te,"data-dismissible":we,"data-type":he,"data-invert":nt,"data-swipe-out":de,"data-swipe-direction":Q,"data-expanded":!!(k||H&&se),"data-testid":p.testId,style:{"--index":C,"--toasts-before":C,"--z-index":T.length-C,"--offset":`${U?W:dt.current}px`,"--initial-height":H?"auto":`${Re}px`,...E,...p.style},onDragEnd:()=>{le(!1),$(null),Ie.current=null},onPointerDown:Fe=>{Fe.button!==2&&(Ge||!we||(Ae.current=new Date,ce(dt.current),Fe.target.setPointerCapture(Fe.pointerId),Fe.target.tagName!=="BUTTON"&&(le(!0),Ie.current={x:Fe.clientX,y:Fe.clientY})))},onPointerUp:()=>{var Fe,yt,Et;if(de||!we)return;Ie.current=null;const Nt=Number(((Fe=J.current)==null?void 0:Fe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Vt=Number(((yt=J.current)==null?void 0:yt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ct=new Date().getTime()-((Et=Ae.current)==null?void 0:Et.getTime()),ct=X==="x"?Nt:Vt,vt=Math.abs(ct)/Ct;if((X==="x"?Me.includes(Nt>0?"right":"left"):Me.includes(Vt>0?"bottom":"top"))&&(Math.abs(ct)>=Lq||vt>.11)){ce(dt.current),p.onDismiss==null||p.onDismiss.call(p,p),K(X==="x"?Nt>0?"right":"left":Vt>0?"down":"up"),qe(),oe(!0);return}else{var Xe,ut;(Xe=J.current)==null||Xe.style.setProperty("--swipe-amount-x","0px"),(ut=J.current)==null||ut.style.setProperty("--swipe-amount-y","0px")}ee(!1),le(!1),$(null)},onPointerMove:Fe=>{var yt,Et,Nt;if(!Ie.current||!we||((yt=window.getSelection())==null?void 0:yt.toString().length)>0)return;const Ct=Fe.clientY-Ie.current.y,ct=Fe.clientX-Ie.current.x;!X&&(Math.abs(ct)>1||Math.abs(Ct)>1)&&$(Math.abs(ct)>Math.abs(Ct)?"x":"y");let vt={x:0,y:0};const ae=Xe=>1/(1.5+Math.abs(Xe)/20);if(X==="y"){if(Me.includes("top")||Me.includes("bottom"))if(Me.includes("top")&&Ct<0||Me.includes("bottom")&&Ct>0)vt.y=Ct;else{const Xe=Ct*ae(Ct);vt.y=Math.abs(Xe)<Math.abs(Ct)?Xe:Ct}}else if(X==="x"&&(Me.includes("left")||Me.includes("right")))if(Me.includes("left")&&ct<0||Me.includes("right")&&ct>0)vt.x=ct;else{const Xe=ct*ae(ct);vt.x=Math.abs(Xe)<Math.abs(ct)?Xe:ct}(Math.abs(vt.x)>0||Math.abs(vt.y)>0)&&ee(!0),(Et=J.current)==null||Et.style.setProperty("--swipe-amount-x",`${vt.x}px`),(Nt=J.current)==null||Nt.style.setProperty("--swipe-amount-y",`${vt.y}px`)}},be&&!p.jsx&&he!=="loading"?Ze.createElement("button",{"aria-label":G,"data-disabled":Ge,"data-close-button":!0,onClick:Ge||!we?()=>{}:()=>{qe(),p.onDismiss==null||p.onDismiss.call(p,p)},className:Bo(F==null?void 0:F.closeButton,p==null||(a=p.classNames)==null?void 0:a.closeButton)},(Qe=V==null?void 0:V.close)!=null?Qe:Sq):null,(he||p.icon||p.promise)&&p.icon!==null&&((V==null?void 0:V[he])!==null||p.icon)?Ze.createElement("div",{"data-icon":"",className:Bo(F==null?void 0:F.icon,p==null||(l=p.classNames)==null?void 0:l.icon)},he==="loading"?p.icon||ht():p.promise?ht():null,he!=="loading"?pe:null):null,Ze.createElement("div",{"data-content":"",className:Bo(F==null?void 0:F.content,p==null||(c=p.classNames)==null?void 0:c.content)},Ze.createElement("div",{"data-title":"",className:Bo(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?Ze.createElement("div",{"data-description":"",className:Bo(B,Ee,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),Ze.isValidElement(p.cancel)?p.cancel:p.cancel&&Eh(p.cancel)?Ze.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||O,onClick:Fe=>{Eh(p.cancel)&&we&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Fe),qe())},className:Bo(F==null?void 0:F.cancelButton,p==null||(m=p.classNames)==null?void 0:m.cancelButton)},p.cancel.label):null,Ze.isValidElement(p.action)?p.action:p.action&&Eh(p.action)?Ze.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||z,onClick:Fe=>{Eh(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Fe),!Fe.defaultPrevented&&qe())},className:Bo(F==null?void 0:F.actionButton,p==null||(h=p.classNames)==null?void 0:h.actionButton)},p.action.label):null)};function nE(){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 Uq(e,t){const r={};return[e,t].forEach((a,l)=>{const c=l===1,u=c?"--mobile-offset":"--offset",f=c?Pq:zq;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 Hq=Ze.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:x="light",richColors:v,duration:j,style:S,visibleToasts:N=Dq,toastOptions:C,dir:T=nE(),gap:k=_q,icons:A,customAriaLabel:R,containerAriaLabel:M="Notifications"}=t,[E,O]=Ze.useState([]),z=Ze.useMemo(()=>a?E.filter(P=>P.toasterId===a):E.filter(P=>!P.toasterId),[E,a]),_=Ze.useMemo(()=>Array.from(new Set([c].concat(z.filter(P=>P.position).map(P=>P.position)))),[z,c]),[B,q]=Ze.useState([]),[I,L]=Ze.useState(!1),[H,F]=Ze.useState(!1),[V,G]=Ze.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),X=Ze.useRef(null),$=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),Q=Ze.useRef(null),K=Ze.useRef(!1),se=Ze.useCallback(P=>{O(U=>{var Z;return(Z=U.find(te=>te.id===P.id))!=null&&Z.delete||rr.dismiss(P.id),U.filter(({id:te})=>te!==P.id)})},[]);return Ze.useEffect(()=>rr.subscribe(P=>{if(P.dismiss){requestAnimationFrame(()=>{O(U=>U.map(Z=>Z.id===P.id?{...Z,delete:!0}:Z))});return}setTimeout(()=>{c8.flushSync(()=>{O(U=>{const Z=U.findIndex(te=>te.id===P.id);return Z!==-1?[...U.slice(0,Z),{...U[Z],...P},...U.slice(Z+1)]:[P,...U]})})})}),[]),Ze.useEffect(()=>{if(x!=="system"){G(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?G("dark"):G("light")),typeof window>"u")return;const P=window.matchMedia("(prefers-color-scheme: dark)");try{P.addEventListener("change",({matches:U})=>{G(U?"dark":"light")})}catch{P.addListener(({matches:Z})=>{try{G(Z?"dark":"light")}catch(te){console.error(te)}})}},[x]),Ze.useEffect(()=>{E.length<=1&&L(!1)},[E]),Ze.useEffect(()=>{const P=U=>{var Z;if(u.length>0&&u.every(de=>U[de]||U.code===de)){var le;L(!0),(le=X.current)==null||le.focus()}U.code==="Escape"&&(document.activeElement===X.current||(Z=X.current)!=null&&Z.contains(document.activeElement))&&L(!1)};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[u]),Ze.useEffect(()=>{if(X.current)return()=>{Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null,K.current=!1)}},[X.current]),Ze.createElement("section",{ref:r,"aria-label":R??`${M} ${$}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},_.map((P,U)=>{var Z;const[te,le]=P.split("-");return z.length?Ze.createElement("ol",{key:P,dir:T==="auto"?nE():T,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":`${((Z=B[0])==null?void 0:Z.height)||0}px`,"--width":`${Iq}px`,"--gap":`${k}px`,...S,...Uq(g,p)},onBlur:de=>{K.current&&!de.currentTarget.contains(de.relatedTarget)&&(K.current=!1,Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null))},onFocus:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||K.current||(K.current=!0,Q.current=de.relatedTarget)},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{H||L(!1)},onDragEnd:()=>L(!1),onPointerDown:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||F(!0)},onPointerUp:()=>F(!1)},z.filter(de=>!de.position&&U===0||de.position===P).map((de,oe)=>{var ne,ee;return Ze.createElement(Vq,{key:de.id,icons:A,index:oe,toast:de,defaultRichColors:v,duration:(ne=C==null?void 0:C.duration)!=null?ne:j,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:l,visibleToasts:N,closeButton:(ee=C==null?void 0:C.closeButton)!=null?ee:m,interacting:H,position:P,style:C==null?void 0:C.style,unstyled:C==null?void 0:C.unstyled,classNames:C==null?void 0:C.classNames,cancelButtonStyle:C==null?void 0:C.cancelButtonStyle,actionButtonStyle:C==null?void 0:C.actionButtonStyle,closeButtonAriaLabel:C==null?void 0:C.closeButtonAriaLabel,removeToast:se,toasts:z.filter(W=>W.position==de.position),heights:B.filter(W=>W.position==de.position),setHeights:q,expandByDefault:f,gap:k,expanded:I,swipeDirections:t.swipeDirections})})):null}))}),Fq={info:{icon:s.jsx(ff,{className:"size-4 text-muted-foreground"}),role:"status"},progress:{icon:s.jsx(Dt,{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(Ba,{className:"size-4 text-amber-600"}),role:"alert"},error:{icon:s.jsx(GR,{className:"size-4 text-destructive"}),role:"alert"}};function Gq({tone:e="info",title:t,children:r,actions:a,onDismiss:l,dismissLabel:c}){const{icon:u,role:f}=Fq[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(Dn,{className:"mx-auto size-3.5"})})]})}function za({id:e,...t}){return b.useEffect(()=>{const r=setTimeout(()=>He.custom(()=>s.jsx(Gq,{...t}),{id:e,duration:1/0,dismissible:!1,unstyled:!0}));return()=>clearTimeout(r)}),b.useEffect(()=>()=>{He.dismiss(e)},[e]),null}const qq="Not downloaded yet. Import downloads this npm package and checks that it starts, in a temporary sandbox.",Iw=e=>e===qq||e.startsWith("Prepare package"),_w=e=>e.kind==="mcp"&&!e.disabled&&!e.config&&!e.configuration&&!e.package;function Yq(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 GM(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=>Iw(a)||t.has(a)))}function Kq(e){return!e.disabled&&(!e.issues.length||GM(e))}function Xq(e){const t=e.requirements||[];return[...t,...Yq(e.package).filter(r=>!t.some(a=>a.host===r.host&&a.phase===r.phase))]}const sE=e=>e.items.some(t=>!t.disabled&&t.issues.length>0),qM=e=>!!(e!=null&&e.useSourceSecrets||e!=null&&e.provider||Object.values((e==null?void 0:e.secrets)||{}).some(Boolean)),YM=(e,t)=>e.issues.filter(r=>{var a;return!Iw(r)&&!((a=e.preparationIssues)!=null&&a.includes(r))&&!(r.startsWith("Connect credentials")&&qM(t))}),Wq=(e,t={})=>new Map(e.items.map(r=>[r.id,new Set(YM(r,t[r.id]))])),Qq=(e,t={})=>e.items.filter(r=>!r.disabled&&YM(r,t[r.id]).length>0),Zq=(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 Jq(e,t,r,a,{onProgress:l=()=>{},onReview:c=()=>{},isCancelled:u=()=>!1,resumeJob:f,wait:m=h=>new Promise(g=>setTimeout(g,h))}={}){const h=Wq(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 Zq(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 rf({value:e,startValue:t=0,direction:r="up",delay:a=0,className:l,decimalPlaces:c=0,...u}){const f=b.useRef(null),m=Ls(),h=Dw(r==="down"?e:t),g=YG(h,{damping:60,stiffness:100}),p=LM(f,{once:!0,margin:"0px"}),x=b.useCallback(v=>Intl.NumberFormat("en-US",{minimumFractionDigits:c,maximumFractionDigits:c}).format(Number(v.toFixed(c))),[c]);return b.useEffect(()=>{if(!p)return;const v=setTimeout(()=>h.set(r==="down"?t:e),a*1e3);return()=>clearTimeout(v)},[h,p,a,e,r,t]),b.useEffect(()=>g.on("change",v=>{f.current&&!m&&(f.current.textContent=x(v))}),[g,x,m]),b.useEffect(()=>{f.current&&m&&(f.current.textContent=x(e))},[m,e,x]),s.jsx("span",{ref:f,className:Le("inline-block tabular-nums",l),...u,children:m?x(e):t})}function KM(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 XM(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 eY=e=>new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function WM({points:e,height:t=34,title:r,action:a}){const l=b.useRef(null),c=b.useId(),u=Ls(),[f,m]=b.useState(280),[h,g]=b.useState(null);b.useLayoutEffect(()=>{const R=l.current;if(!R)return;const M=()=>m(R.clientWidth);M();const E=new ResizeObserver(M);return E.observe(R),()=>E.disconnect()},[]);const p=Math.max(4,Math.round(t*.18)),x=e.map(R=>R.allowed+R.denied),v=Math.max(1,...x),j=R=>(e.length<2?f-12:R/(e.length-1)*(f-12))+6,S=R=>t-p-R/v*(t-p*2),N=x.map((R,M)=>[j(M),S(R)]),C=KM(N),T=`${C} L${j(e.length-1).toFixed(2)} ${t} L${j(0).toFixed(2)} ${t} Z`,k=h===null?null:e[h],A=R=>e.reduce((M,E)=>M+E[R],0);return s.jsxs("div",{className:"relative w-full",onMouseLeave:()=>g(null),onMouseMove:R=>{const M=R.currentTarget.getBoundingClientRect(),E=(R.clientX-M.left)/Math.max(1,M.width);g(Math.min(e.length-1,Math.max(0,Math.round(E*(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:k?s.jsxs("span",{className:"font-mono normal-case tracking-normal text-muted-foreground",children:[eY(k.at)," · ",k.allowed," allowed",k.denied?s.jsxs("span",{className:"text-red-600",children:[" · ",k.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:T,fill:`url(#${c})`}),s.jsx(Rn.path,{d:C,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((R,M)=>R.denied?s.jsx("circle",{cx:j(M),cy:t-2,r:"1.75",fill:"var(--status-error)",opacity:h===M?1:.75},R.at):null),k&&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(x[h]),r:"3",fill:"var(--surface)",stroke:"var(--ink)",strokeWidth:"1.5"})]})]})})]})}function na({value:e,onValueChange:t,className:r,ref:a,...l}){return s.jsxs("div",{className:Le("relative",r),children:[s.jsx(p6,{"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(At,{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(Dn,{className:"size-3.5"})})]})}function Gl({...e}){return s.jsx(XO,{"data-slot":"sheet",...e})}function tY({...e}){return s.jsx(X1,{"data-slot":"sheet-portal",...e})}function nY({className:e,...t}){return s.jsx(q1,{"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 du({className:e,children:t,side:r="right",showCloseButton:a=!0,...l}){return s.jsxs(tY,{children:[s.jsx(nY,{}),s.jsxs(K1,{"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(Hg,{"data-slot":"sheet-close",render:s.jsx(ue,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[s.jsx(Dn,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fu({className:e,...t}){return s.jsx("div",{"data-slot":"sheet-header",className:Le("flex flex-col gap-0.5 p-4",e),...t})}function mu({className:e,...t}){return s.jsx(W1,{"data-slot":"sheet-title",className:Le("font-heading text-base font-medium text-foreground",e),...t})}function hu({className:e,...t}){return s.jsx(Y1,{"data-slot":"sheet-description",className:Le("text-sm text-muted-foreground",e),...t})}function sY(e){return KO("alert-dialog",e)}function Rr({...e}){return s.jsx(sY,{"data-slot":"alert-dialog",...e})}function rY({...e}){return s.jsx(X1,{"data-slot":"alert-dialog-portal",...e})}function oY({className:e,...t}){return s.jsx(q1,{"data-slot":"alert-dialog-overlay",className:ms("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 Ar({className:e,size:t="default",...r}){return s.jsxs(rY,{children:[s.jsx(oY,{}),s.jsx(K1,{"data-slot":"alert-dialog-content","data-size":t,className:ms("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 Or({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:ms("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 Mr({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:ms("-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 Dr({className:e,...t}){return s.jsx(W1,{"data-slot":"alert-dialog-title",className:ms("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 zr({className:e,...t}){return s.jsx(Y1,{"data-slot":"alert-dialog-description",className:ms("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function Pr({className:e,...t}){return s.jsx(ue,{"data-slot":"alert-dialog-action",className:ms(e),...t})}function Ir({className:e,variant:t="outline",size:r="default",...a}){return s.jsx(Hg,{"data-slot":"alert-dialog-cancel",className:ms(e),render:s.jsx(ue,{variant:t,size:r}),...a})}const QM=b.createContext(void 0);function nx(e){const t=b.useContext(QM);if(t===void 0&&!e)throw new Error(Jt(33));return t}const ZM=b.createContext(void 0);function Hi(e){const t=b.useContext(ZM);if(t===void 0&&!e)throw new Error(Jt(36));return t}const aY=b.createContext(void 0);function Lw(e=!0){const t=b.useContext(aY);if(t===void 0&&!e)throw new Error(Jt(25));return t}const JM=b.createContext(void 0);function iY(){const e=b.useContext(JM);if(e===void 0)throw new Error(Jt(30));return e}function lY(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=Lw(!0),x=p!==void 0;return b.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:Dl})},onMouseUp(v){if(p){const j=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,x&&j&&Math.abs(v.clientX-j.x)<=1&&Math.abs(v.clientY-j.y)<=1||x&&!u1&&v.button===2)return}f.current&&c.context.allowMouseUpTriggerRef.current&&(!x||v.button===2)&&m.type==="regular-item"&&Qc(f.current,v,{detail:1})}}),[t,r,a,h,l,g,c,u,f,p,x,m])}const $w={type:"regular-item"};function Bw(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=b.useRef(null),{getButtonProps:p,buttonRef:x}=ao({disabled:r,focusableWhenDisabled:!0,native:f,composite:!0}),v=lY({closeOnClick:t,highlighted:a,id:l,nodeId:h,store:c,typingRef:u,itemRef:g,itemMetadata:m}),j=b.useCallback(N=>Ks(v,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},N,p),[v,p,m]),S=no(g,x);return b.useMemo(()=>({getItemProps:j,itemRef:S}),[j,S])}const cY="data-checked",uY="data-unchecked",sx={checked(e){return e?{[cY]:""}:{[uY]:""}},...Ha},dY=b.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:x,style:v,...j}=t,S=Ql({guess:!0,label:u}),N=nx(!0),C=fs(c),{store:T}=Hi(),k=T.useState("disabled"),A=m||k,R=T.useState("isActive",S.index),M=T.useState("itemProps"),[E,O]=oo({controlled:g,default:p??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:z,itemRef:_}=Bw({closeOnClick:h,disabled:A,highlighted:R,id:C,store:T,nativeButton:f,nodeId:N==null?void 0:N.context.nodeId,itemMetadata:$w}),B=b.useMemo(()=>({disabled:A,highlighted:R,checked:E}),[A,R,E]);function q(L){const H=bt(Dl,L.nativeEvent,void 0,{preventUnmountOnClose:Tn});x==null||x(!E,H),!H.isCanceled&&O(F=>!F)}const I=jt("div",t,{state:B,stateAttributesMapping:sx,props:[M,{role:"menuitemcheckbox","aria-checked":E,onClick:q},j,z],ref:[_,r,S.ref]});return s.jsx(JM.Provider,{value:B,children:I})}),fY=b.forwardRef(function(t,r){const{render:a,className:l,style:c,keepMounted:u=!1,...f}=t,m=iY(),h=b.useRef(null),{transitionStatus:g,mounted:p,setMounted:x}=Fa(m.checked);lr({batch:!0,enabled:!m.checked,open:m.checked,ref:h,onComplete(){m.checked||x(!1)}});const v={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return jt("span",t,{state:v,ref:[r,h],stateAttributesMapping:sx,props:{"aria-hidden":!0,...f},enabled:u||p})}),Vw=b.createContext(void 0);function mY(){const e=b.useContext(Vw);if(e===void 0)throw new Error(Jt(31));return e}const hY=b.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,[f,m]=b.useState(void 0),h=jt("div",t,{ref:r,props:{role:"group","aria-labelledby":f,...u}});return s.jsx(Vw.Provider,{value:m,children:h})}),pY=b.forwardRef(function(t,r){const{render:a,className:l,style:c,id:u,...f}=t,m=fs(u),h=mY();return Ke(()=>(h(m),()=>{h(g=>g===m?void 0:g)}),[h,m]),jt("div",t,{ref:r,props:{id:m,"aria-hidden":!0,...f}})}),gY=b.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,x=Ql({guess:!0,label:u}),v=nx(!0),j=fs(c),{store:S}=Hi(),N=S.useState("disabled"),C=m||N,T=S.useState("isActive",x.index),k=S.useState("itemProps"),{getItemProps:A,itemRef:R}=Bw({closeOnClick:h,disabled:C,highlighted:T,id:j,store:S,nativeButton:f,nodeId:v==null?void 0:v.context.nodeId,itemMetadata:$w});return jt("div",t,{state:{disabled:C,highlighted:T},props:[k,p,A],ref:[R,r,x.ref]})}),xY=b.forwardRef(function(t,r){const{render:a,className:l,style:c,finalFocus:u,...f}=t,{store:m}=Hi(),{side:h,align:g}=nx(),p=Ug()!=null,x=m.useState("open"),v=m.useState("transitionStatus"),j=m.useState("popupProps"),S=m.useState("mounted"),N=m.useState("instantType"),C=m.useState("activeTriggerElement"),T=m.useState("parent"),k=m.useState("lastOpenChangeReason"),A=m.useState("rootId"),R=m.useState("floatingRootContext"),M=m.useState("floatingTreeRoot"),E=m.useState("closeDelay"),O=m.useState("hoverEnabled"),z=m.useState("disabled"),_=m.useState("openMethod"),B=T.type==="context-menu";lr({open:x,ref:m.context.popupRef,onComplete(){var F,V;x&&((V=(F=m.context).onOpenChangeComplete)==null||V.call(F,!0))}}),b.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]),$1(R,{enabled:O&&!z&&!B&&T.type!=="menubar",closeDelay:E});const q=m.useStateSetter("popupElement"),I={transitionStatus:v,side:h,align:g,open:x,nested:T.type==="menu",instant:N},L=jt("div",t,{state:I,ref:[r,m.context.popupRef,q],stateAttributesMapping:gg,props:[j,{onKeyDown(F){p&&Rf.has(F.key)&&F.stopPropagation()}},Ef(v),f,{"data-rootownerid":A}]});let H=T.type===void 0||B;return(C||T.type==="menubar"&&k!==wg)&&(H=!0),s.jsx(kg,{context:R,openInteractionType:_,modal:B,disabled:!S,returnFocus:u===void 0?H:u,initialFocus:T.type!=="menu",restoreFocus:!0,externalTree:T.type!=="menubar"?M:void 0,previousFocusableElement:C,nextFocusableElement:T.type===void 0?m.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:T.type===void 0?m.context.beforeContentFocusGuardRef:void 0,children:L})}),e3=b.createContext(void 0);function bY(){const e=b.useContext(e3);if(e===void 0)throw new Error(Jt(32));return e}const yY=b.forwardRef(function(t,r){const{keepMounted:a=!1,...l}=t,{store:c,parent:u}=Hi();if(!(c.useState("mounted")||a))return null;const h=u.type==="menu"||u.type==="menubar"?"group":void 0;return s.jsx(e3.Provider,{value:a,children:s.jsx(Cg,{ref:r,...l,portalOwnerRole:h})})}),vY=b.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:x=5,arrowPadding:v=5,sticky:j=!1,disableAnchorTracking:S=!1,collisionAvoidance:N=tO,style:C,...T}=t,{store:k}=Hi(),A=bY(),R=Lw(!0),M=k.useState("parent"),E=k.useState("floatingRootContext"),O=k.useState("floatingTreeRoot"),z=k.useState("mounted"),_=k.useState("open"),B=k.useState("modal"),q=k.useState("openMethod"),I=k.useState("activeTriggerElement"),L=k.useState("transitionStatus"),H=k.useState("positionerElement"),F=k.useState("instantType"),V=k.useState("adaptiveOrigin"),G=k.useState("lastOpenChangeReason"),X=k.useState("floatingNodeId"),$=k.useState("floatingParentNodeId"),Q=E.useState("domReferenceElement"),K=b.useRef(null),se=yf(H);let P=a,U=h,Z=g,te=m,le=N;M.type==="context-menu"&&(P=a??((re=M.context)==null?void 0:re.anchor),te=te??"start",!f&&te!=="center"&&(Z=t.alignOffset??2,U=t.sideOffset??-5));let de=f,oe=te;M.type==="menu"?(de=de??"inline-end",oe=oe??"start",le=t.collisionAvoidance??C1):M.type==="menubar"&&(de=de??(M.context.orientation==="vertical"?"inline-end":"bottom"),oe=oe??"start");const ne=M.type==="context-menu",ee=Lg({anchor:P,floatingRootContext:E,positionMethod:R?"fixed":l,mounted:z,side:de,sideOffset:U,align:oe,alignOffset:Z,arrowPadding:ne?0:v,collisionBoundary:p,collisionPadding:x,sticky:j,nodeId:X,keepMounted:A,disableAnchorTracking:S,collisionAvoidance:le,shift:ne?{crossAxis:!("side"in le&&le.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:O,adaptiveOrigin:V});b.useEffect(()=>{function xe(he){he.open&&(he.parentNodeId===X&&k.set("hoverEnabled",!1),he.nodeId!==X&&he.parentNodeId===k.select("floatingParentNodeId")&&k.setOpen(!1,bt(Ad)))}return O.events.on("menuopenchange",xe),()=>{O.events.off("menuopenchange",xe)}},[k,O.events,X]),b.useEffect(()=>{if(k.select("floatingParentNodeId")==null)return;function xe(he){if(he.open||he.nodeId!==k.select("floatingParentNodeId"))return;const Be=he.reason??Ad;k.setOpen(!1,bt(Be))}return O.events.on("menuopenchange",xe),()=>{O.events.off("menuopenchange",xe)}},[O.events,k]);const W=ts();b.useEffect(()=>{_||W.clear()},[_,W]),b.useEffect(()=>{function xe(he){if(!(!_||he.nodeId!==k.select("floatingParentNodeId")))if(he.target&&I&&I!==he.target){const Be=k.select("closeDelay");Be>0?W.isStarted()||W.start(Be,()=>{k.setOpen(!1,bt(Ad))}):k.setOpen(!1,bt(Ad))}else W.clear()}return O.events.on("itemhover",xe),()=>{O.events.off("itemhover",xe)}},[O.events,_,I,k,W]),b.useEffect(()=>{const xe={open:_,nodeId:X,parentNodeId:$,reason:k.select("lastOpenChangeReason")};O.events.emit("menuopenchange",xe)},[O.events,_,k,X,$]),Ke(()=>{const xe=Q,he=K.current;if(xe&&(K.current=xe),he&&xe&&xe!==he){k.set("instantType",void 0);const Be=new AbortController;return se(()=>{k.set("instantType","trigger-change")},Be.signal),()=>{Be.abort()}}},[Q,se,k]);const ce={open:_,side:ee.side,align:ee.align,anchorHidden:ee.anchorHidden,nested:M.type==="menu",instant:F},Re=M.type==="menubar"&&M.context.modal;F1(_&&(Re||B&&G!==Hn),q==="touch",H,I);const Ne=Bg(t,ce,{styles:ee.positionerStyles,transitionStatus:L,props:T,refs:[r,k.useStateSetter("positionerElement")],hidden:!z,inert:!_}),Ae=z&&M.type!=="menu"&&(M.type!=="menubar"&&B&&G!==Hn||M.type==="menubar"&&M.context.modal);let J=null;return M.type==="menubar"?J=M.context.contentElement:M.type===void 0&&(J=I),s.jsxs(QM.Provider,{value:ee,children:[Ae&&s.jsx($g,{ref:M.type==="context-menu"||M.type==="nested-context-menu"?M.context.internalBackdropRef:null,inert:kf(!_),cutout:J}),s.jsx(lO,{id:X,children:s.jsx(Tf,{elementsRef:k.context.itemDomElements,labelsRef:k.context.itemLabels,children:Ne})})]})}),t3=b.createContext(void 0);function wY(){const e=b.useContext(t3);if(e===void 0)throw new Error(Jt(34));return e}const jY=b.memo(b.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,[x,v]=b.useState(void 0),[j,S]=oo({controlled:c,default:u,name:"MenuRadioGroup"}),N=et((A,R)=>{f==null||f(A,R),!R.isCanceled&&S(A)}),T=jt("div",t,{state:{disabled:m},ref:r,props:{role:"group","aria-labelledby":g??x,"aria-disabled":m||void 0,...p}}),k=b.useMemo(()=>({value:j,setValue:N,disabled:m}),[j,N,m]);return s.jsx(Vw.Provider,{value:v,children:s.jsx(t3.Provider,{value:k,children:T})})})),n3=b.createContext(void 0);function SY(){const e=b.useContext(n3);if(e===void 0)throw new Error(Jt(35));return e}const NY=b.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,...x}=t,v=Ql({guess:!0,label:u}),j=nx(!0),S=fs(c),{store:N}=Hi(),C=N.useState("isActive",v.index),T=N.useState("itemProps"),{value:k,setValue:A,disabled:R}=wY(),M=N.useState("disabled"),E=m||R||M,O=k===g,{getItemProps:z,itemRef:_}=Bw({closeOnClick:h,disabled:E,highlighted:C,id:S,store:N,nativeButton:f,nodeId:j==null?void 0:j.context.nodeId,itemMetadata:$w}),B=b.useMemo(()=>({disabled:E,highlighted:C,checked:O}),[E,C,O]);function q(L){const H=bt(Dl,L.nativeEvent,void 0,{preventUnmountOnClose:Tn});A(g,H)}const I=jt("div",t,{state:B,stateAttributesMapping:sx,props:[T,{role:"menuitemradio","aria-checked":O,onClick:q},x,z],ref:[_,r,v.ref]});return s.jsx(n3.Provider,{value:B,children:I})}),CY=b.forwardRef(function(t,r){const{render:a,className:l,style:c,keepMounted:u=!1,...f}=t,m=SY(),h=b.useRef(null),{transitionStatus:g,mounted:p,setMounted:x}=Fa(m.checked);lr({batch:!0,enabled:!m.checked,open:m.checked,ref:h,onComplete(){m.checked||x(!1)}});const v={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return jt("span",t,{state:v,stateAttributesMapping:sx,ref:[r,h],props:{"aria-hidden":!0,...f},enabled:u||p})}),kY=b.createContext(null);function s3(e){return b.useContext(kY)}const TY={...zg,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 EY extends vu{constructor(r,a,l=!1){const c=new Cf,u=AY(c,a,l,r);super(u,RY(c),TY);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 x=f.store.select("rootId"),v=f.store.select("floatingTreeRoot"),j=f.store.select("keyboardEventRelay");h===x&&g===v&&p===j||(h=x,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 RY(e){return{positionerRef:b.createRef(),popupRef:b.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function AY(e,t,r=!1,a){return{...Dg(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 k1,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:gn,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...a}}const OY=b.createContext(void 0);function MY(){return b.useContext(OY)}const DY=jf(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:x=!1,handle:v,triggerId:j,defaultTriggerId:S=null,highlightItemOnHover:N=!0}=t,C=Lw(!0),T=Hi(!0),k=s3(!0),A=MY(),R=b.useMemo(()=>A&&T?{type:"menu",store:T.store}:k?{type:"menubar",context:k}:C&&!T?{type:"context-menu",context:C}:{type:void 0},[C,T,k,A]),M=Ll(),E=Ll(),O=Bi(),z=R.type==="menu"?R.store:void 0,_=(a??u)&&(z==null?void 0:z.state.transitionStatus)==="starting",B=ds(()=>_?z==null?void 0:z.state.instantType:void 0).current,q=zY({open:u,openProp:a,activeTriggerId:S,triggerIdProp:j,parent:R,disabled:f,highlightItemOnHover:N,modal:R.type===void 0?m:void 0,rootId:M,instantType:B},E,O!=null);q.useControlledProp("openProp",a),q.useControlledProp("triggerIdProp",j),q.useContextCallback("onOpenChangeComplete",c);const I=q.useState("floatingTreeRoot"),L=T1(I),H=q.useState("open"),F=q.useState("activeTriggerElement"),V=q.useState("positionerElement"),G=q.useState("hoverEnabled"),X=q.useState("disabled"),$=q.useState("lastOpenChangeReason"),Q=q.useState("parent"),K=q.useState("activeIndex"),se=q.useState("payload"),P=q.useState("floatingParentNodeId"),U=b.useRef(null),Z=b.useRef(Q.type!=="context-menu"),te=ts(),le=b.useRef(!0),de=ts(),oe=P!=null,{openMethod:ne,triggerProps:ee}=IO(H);q.useSyncedValues({disabled:f,highlightItemOnHover:N,modal:Q.type===void 0?m:void 0,openMethod:ne,rootId:M}),Ag(q);const{forceUnmount:W,transitionStatus:ce}=Og(H,q,()=>{q.set("allowMouseEnter",!1)},_),Re=yf(q.context.popupRef);b.useEffect(()=>{if(B===void 0)return;const Ie=()=>{q.state.instantType===B&&q.set("instantType",void 0)};if(!H){Ie();return}if(ce!==void 0)return;if(q.context.popupRef.current==null){Ie();return}const ot=new AbortController;return Re(Ie,ot.signal),()=>{ot.abort()}},[B,H,ce,Re,q]),Ke(()=>{C&&!T?q.update({parent:{type:"context-menu",context:C},floatingNodeId:L,floatingParentNodeId:O}):T&&q.update({floatingNodeId:L,floatingParentNodeId:O})},[C,T,L,O,q]),b.useEffect(()=>{if(H||(U.current=null),Q.type==="context-menu"){if(!H){te.clear(),Z.current=!1;return}te.start(500,()=>{Z.current=!0})}},[te,H,Q.type]),Ke(()=>{!H&&!G&&q.set("hoverEnabled",!0)},[H,G,q]);const _e=et((Ie,ot)=>{const We=ot.reason;if(!Ie&&!q.select("open")||H===Ie&&ot.trigger===F&&$===We)return;const me=D1(ot);if(!Ie&&ot.trigger==null&&(ot.trigger=F??void 0),l==null||l(Ie,ot),ot.isCanceled)return;q.state.floatingRootContext.dispatchOpenChange(Ie,ot);const Oe=ot.event;if(Ie===!1&&(Oe==null?void 0:Oe.type)==="click"&&Oe.pointerType==="touch"&&!le.current)return;Ie&&We===eu?(le.current=!1,de.start(300,()=>{le.current=!0})):(le.current=!0,de.clear());const Me=(We===Zo||We===Dl)&&Oe.detail===0,nt=!Ie&&(We===wf||We==null);U.current=ot.event;const Ge=Rg(q.state,Ie,ot.trigger,me());Ge.openChangeReason=We,Q.type==="menubar"&&(We===eu||We===Pi||We===Hn||We===Ky||We===Ad)?Ge.instantType="group":Me||nt?Ge.instantType=Me?"click":"dismiss":Ge.instantType=void 0,q.update(Ge)}),Ne=bO({popupStore:q,floatingRootContext:q.state.floatingRootContext,floatingId:E,nested:O!=null,onOpenChange:_e}),Ae=Ne.context.events;Ke(()=>{const Ie=({open:ot,eventDetails:We})=>_e(ot,We);return Ae.on("setOpen",Ie),()=>{Ae==null||Ae.off("setOpen",Ie)}},[Ae,_e]);const J=b.useCallback(()=>{q.setOpen(!1,bt(jg))},[q]);b.useImperativeHandle(p,()=>({unmount:W,close:J}),[W,J]);let re;Q.type==="context-menu"&&(re=Q.context),b.useImperativeHandle(re==null?void 0:re.positionerRef,()=>V,[V]),b.useImperativeHandle(re==null?void 0:re.actionsRef,()=>({setOpen:_e}),[_e]);const xe=Sf(Ne,{enabled:!X,bubbles:{escapeKey:x&&Q.type==="menu"},outsidePress(){var Ie;return Q.type!=="context-menu"||((Ie=U.current)==null?void 0:Ie.type)==="contextmenu"?!0:Z.current},externalTree:oe?I:void 0}),he=_g(),Be=b.useCallback(Ie=>{q.select("activeIndex")!==Ie&&q.set("activeIndex",Ie)},[q]),we=NO(Ne,{enabled:!X,listRef:q.context.itemDomElements,activeIndex:K,nested:Q.type!==void 0,loopFocus:h,orientation:g,parentOrientation:Q.type==="menubar"?Q.context.orientation:void 0,rtl:he==="rtl",disabledIndices:Tr,onNavigate:Be,openOnArrowKeyDown:Q.type!=="context-menu",externalTree:oe?I:void 0,focusItemOnHover:N}),Ye=b.useCallback(Ie=>{q.context.typingRef.current=Ie},[q]),Ee=CO(Ne,{enabled:!X,listRef:q.context.itemLabels,elementsRef:q.context.itemDomElements,activeIndex:K,resetMs:S$,onMatch:Ie=>{H&&Ie!==K&&q.set("activeIndex",Ie)},onTyping:Ye}),Ce=b.useMemo(()=>{const Ie=Ks(Ee.reference,we.reference,xe.reference,{onMouseMove(){q.set("allowMouseEnter",!0)}},ee);return Ie["aria-haspopup"]="menu",Ie["aria-expanded"]=H,Ie},[q,Ee.reference,we.reference,xe.reference,ee,H]),be=b.useMemo(()=>{const Ie=Ks(we.trigger,xe.trigger,ee);return Ie["aria-haspopup"]="menu",Ie["aria-expanded"]=!1,Ie},[we.trigger,xe.trigger,ee]);ds(()=>(q.update({inactiveTriggerProps:be}),null));const Ue=b.useMemo(()=>Ks(Nf,{id:E,role:"menu","aria-orientation":g==="horizontal"?"horizontal":void 0,"aria-labelledby":F==null?void 0:F.id,onMouseMove(){q.set("allowMouseEnter",!0),Q.type==="menu"&&q.set("hoverEnabled",!1)},onClick(){q.select("hoverEnabled")&&q.set("hoverEnabled",!1)},onKeyDown(Ie){const ot=q.select("keyboardEventRelay");ot&&!Ie.isPropagationStopped()&&ot(Ie)}},Ee.floating,we.floating,xe.floating),[F,E,g,Q.type,q,Ee.floating,we.floating,xe.floating]),Je=we.item??gn;Mg(q,{floatingRootContext:Ne,activeTriggerProps:Ce,inactiveTriggerProps:be,popupProps:Ue,itemProps:Je});const dt=b.useMemo(()=>({store:q,parent:R}),[q,R]),lt=s.jsxs(ZM.Provider,{value:dt,children:[v&&s.jsx(Eg,{handle:v,store:q}),typeof r=="function"?r({payload:se}):r]});return Q.type===void 0||Q.type==="context-menu"?s.jsx(cO,{externalTree:I,children:lt}):lt});function zY(e,t,r){return ds(()=>new EY(e,t,r)).current}function r3(e){const{render:t,className:r,style:a,state:l=gn,props:c=Tr,refs:u=Tr,metadata:f,stateAttributesMapping:m,tag:h="div",...g}=e,{compositeProps:p,compositeRef:x}=QO({metadata:f});return jt(h,e,{state:l,ref:[x,...u],props:[p,...c,g],stateAttributesMapping:m})}function o3(e){if(cn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Ca(e))return o3(Aa(e))}function a3(e,t){const r=b.useRef(null);function a(c){ro.flushSync(()=>{e.setOpen(!1,bt(Pi,c.nativeEvent,c.currentTarget))});const u=o8(r.current);u==null||u.focus()}function l(c){var f;const u=e.select("positionerElement");if(u&&Jc(c,u))(f=e.context.beforeContentFocusGuardRef.current)==null||f.focus();else{ro.flushSync(()=>{e.setOpen(!1,bt(Pi,c.nativeEvent,c.currentTarget))});let m=r8(e.context.triggerFocusTargetRef.current||t.current);for(;m!==null&&pt(u,m);){const h=m;if(m=v1(m),m===h)break}m==null||m.focus()}}return{preFocusGuardRef:r,handlePreFocusGuardFocus:a,handleFocusTargetFocus:l}}function PY(e){const{enabled:t=!0,mouseDownAction:r,open:a}=e,l=b.useRef(!1);return b.useMemo(()=>t?{onMouseDown:c=>{(r==="open"&&!a||r==="close"&&a)&&(l.current=!0,Gt(c.currentTarget).addEventListener("click",()=>{l.current=!1},{once:!0}))},onClick:c=>{l.current&&(l.current=!1,c.preventBaseUIHandler())}}:gn,[t,r,a])}const IY=N1(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:x,payload:v,...j}=t,S=Hi(!0),C=I1(x)??(S==null?void 0:S.store);if(!C)throw new Error(Jt(85));const T=fs(m),k=C.useState("isTriggerActive",T),A=C.useState("floatingRootContext"),R=C.useState("isOpenedByTrigger",T),M=C.useState("triggerPopupId",T),E=b.useRef(null),O=LY(),z=lg(!0),_=Vi(),B=b.useMemo(()=>_??new k1,[_]),q=T1(B),I=Bi(),{registerTrigger:L,isMountedByThisTrigger:H}=z1(T,E,C,{payload:v,closeDelay:p,parent:O,floatingTreeRoot:B,floatingNodeId:q,floatingParentNodeId:I,keyboardEventRelay:z==null?void 0:z.relayKeyboardEvent}),F=O.type==="menubar",V=C.useState("disabled"),G=u||V||F&&O.context.disabled,{getButtonProps:X,buttonRef:$}=ao({disabled:G,native:f});b.useEffect(()=>{!R&&O.type===void 0&&(C.context.allowMouseUpTriggerRef.current=!1)},[C,R,O.type]);const Q=b.useRef(null),K=ts(),se=et(re=>{if(!Q.current)return;K.clear(),C.context.allowMouseUpTriggerRef.current=!1;const xe=re.target;pt(Q.current,xe)||pt(C.select("positionerElement"),xe)||xe===Q.current||xe!=null&&o3(xe)===C.select("rootId")||_O(re,Q.current)||B.events.emit("close",{domEvent:re,reason:LA})});b.useEffect(()=>{R&&C.select("lastOpenChangeReason")===Hn&&Gt(Q.current).addEventListener("mouseup",se,{once:!0})},[R,se,C]);const P=F&&O.context.hasSubmenuOpen,Z=B1(A,{enabled:(h??P)&&!G&&(!F||P&&!H),handleClose:V1({blockPointerEvents:!F}),mouseOnly:!0,move:!1,restMs:O.type===void 0?g:void 0,delay:{close:p},triggerElementRef:E,externalTree:B,isActiveTrigger:k,isClosing:()=>C.select("transitionStatus")==="ending"}),te=_Y(R,C.select("lastOpenChangeReason")),le=R1(A,{enabled:!G,event:R&&F?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:O.type===void 0?te:!1}),de=jO(A,{enabled:!G&&P}),oe=PY({open:R,enabled:F,mouseDownAction:"open"}),ne=b.useMemo(()=>Ks(de.reference,le.reference),[de.reference,le.reference]),ee=C.useState("triggerProps",H),{preFocusGuardRef:W,handlePreFocusGuardFocus:ce,handleFocusTargetFocus:Re}=a3(C,E),_e={disabled:G,open:R},Ne=[Q,r,$,L,E],Ae=[ne,Z??gn,ee,{"aria-haspopup":"menu","aria-controls":M,id:T,onMouseDown:re=>{if(C.select("open"))return;K.start(200,()=>{C.context.allowMouseUpTriggerRef.current=!0}),Gt(re.currentTarget).addEventListener("mouseup",se,{once:!0})}},F?{role:"menuitem"}:{},oe,j,X],J=jt("button",t,{enabled:!F,stateAttributesMapping:vp,state:_e,ref:Ne,props:Ae});return F?s.jsx(r3,{tag:"button",render:a,className:l,style:c,state:_e,refs:Ne,props:Ae,stateAttributesMapping:vp}):R?s.jsxs(b.Fragment,{children:[s.jsx(_i,{ref:W,onFocus:ce},`${T}-pre-focus-guard`),s.jsx(b.Fragment,{children:J},T),s.jsx(_i,{ref:C.context.triggerFocusTargetRef,onFocus:Re},`${T}-post-focus-guard`)]}):s.jsx(b.Fragment,{children:J},T)});function _Y(e,t){const r=ts(),[a,l]=b.useState(!1);return Ke(()=>{e&&t===Hn?(l(!0),r.start(JA,()=>{l(!1)})):e||(r.clear(),l(!1))},[e,t,r]),a}function LY(){const e=s3();return b.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}const $Y=b.forwardRef(function(t,r){const{className:a,render:l,orientation:c="horizontal",style:u,...f}=t;return jt("div",t,{state:{orientation:c},ref:r,props:[{role:"separator","aria-orientation":c},f]})});function Nu({...e}){return s.jsx(DY,{"data-slot":"dropdown-menu",...e})}function Cu({...e}){return s.jsx(IY,{"data-slot":"dropdown-menu-trigger",...e})}function ku({align:e="start",alignOffset:t=0,side:r="bottom",sideOffset:a=4,className:l,positionerRender:c,...u}){return s.jsx(yY,{children:s.jsx(vY,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:r,sideOffset:a,render:c,children:s.jsx(xY,{"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 op({...e}){return s.jsx(hY,{"data-slot":"dropdown-menu-group",...e})}function $v({className:e,inset:t,...r}){return s.jsx(pY,{"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 qs({className:e,inset:t,variant:r="default",...a}){return s.jsx(gY,{"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})}b.createContext(null);function Uw({className:e,children:t,checked:r,inset:a,...l}){return s.jsxs(dY,{"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(fY,{children:s.jsx(Fn,{})})}),t]})}function BY({...e}){return s.jsx(jY,{"data-slot":"dropdown-menu-radio-group",...e})}function rE({className:e,children:t,inset:r,...a}){return s.jsxs(NY,{"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(CY,{children:s.jsx(Fn,{})})}),t]})}function Hd({className:e,...t}){return s.jsx($Y,{"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:ms("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 VY=[{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"}],i3=[{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"}],UY=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],bo=(e={})=>({host:"",ports:"443",protocol:"rest",access:"read-only",allow:[],deny:[],enforcement:"enforce",allowedIps:"",...e}),HY=[{id:"github-api-read",label:"GitHub API · read",rule:{name:"github-api-read",binaries:[],endpoints:[bo({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:[bo({host:"github.com"}),bo({host:"codeload.github.com"})]}},{id:"npm",label:"npm registry",rule:{name:"npm-registry",binaries:["/usr/bin/node","/usr/local/bin/node"],endpoints:[bo({host:"registry.npmjs.org"})]}},{id:"pypi",label:"PyPI",rule:{name:"pypi",binaries:["/usr/bin/python3*","/usr/local/bin/pip*"],endpoints:[bo({host:"pypi.org"}),bo({host:"files.pythonhosted.org"})]}},{id:"huggingface",label:"Hugging Face · downloads",rule:{name:"huggingface",binaries:["/usr/bin/python3*"],endpoints:[bo({host:"huggingface.co"}),bo({host:"**.hf.co"})]}}];function py(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:[bo()]).map(r=>{var a;return bo({...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 FY(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 GY(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=i3.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 ru({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 qp({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:UY.map(c=>s.jsx("option",{children:c},c))}),s.jsx(At,{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(Dn,{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(us,{className:"size-3"}),r==="deny"?"Block request":"Allow request"]})]})}function qY({open:e,onOpenChange:t,initial:r,onSubmit:a,knownPrograms:l=[],title:c="New rule",submitLabel:u="Add rule",lockName:f=!1}){const[m,h]=b.useState(()=>py(r)),[g,p]=b.useState(""),[x,v]=b.useState(!1),[j,S]=b.useState(null);b.useEffect(()=>{e&&(h(py(r)),S(null),p(""))},[e,r]);const N=(R,M)=>h(E=>({...E,endpoints:E.endpoints.map((O,z)=>z===R?{...O,...M}:O)})),C=R=>{const M=R.trim();M&&!m.binaries.includes(M)&&h(E=>({...E,binaries:[...E.binaries,M]})),p("")},T=FY(m),k=l.filter(R=>!m.binaries.includes(R));async function A(R){R.preventDefault(),v(!0),S(null);try{await a(T),t(!1)}catch(M){S(M.message)}finally{v(!1)}}return s.jsx(bn,{open:e,onOpenChange:t,children:s.jsx(yn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:s.jsxs("form",{onSubmit:A,className:"grid gap-5",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:c}),s.jsx($n,{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"}),HY.map(R=>s.jsx("button",{type:"button",onClick:()=>h(py(R.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:R.label},R.id))]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"rule-name",className:"text-xs",children:"Rule name"}),s.jsx(At,{id:"rule-name",value:m.name,disabled:f,onChange:R=>h(M=>({...M,name:R.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(R=>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:[R,s.jsx("button",{type:"button","aria-label":`Remove ${R}`,onClick:()=>h(M=>({...M,binaries:M.binaries.filter(E=>E!==R)})),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(Dn,{className:"size-3"})})]},R)),!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(At,{value:g,onChange:R=>p(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),C(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:()=>C(g),disabled:!g.trim(),children:"Add"})]}),k.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"}),k.slice(0,6).map(R=>s.jsxs("button",{type:"button",onClick:()=>C(R),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:["+ ",R]},R))]})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx("span",{className:"text-xs font-medium",children:"Destinations"}),m.endpoints.map((R,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(At,{id:`host-${M}`,value:R.host,onChange:E=>N(M,{host:E.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(At,{id:`ports-${M}`,value:R.ports,onChange:E=>N(M,{ports:E.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(E=>({...E,endpoints:E.endpoints.filter((O,z)=>z!==M)})),children:s.jsx(Kn,{className:"size-3.5"})})]}),s.jsx(ru,{label:"Inspection",options:VY,value:R.protocol,onChange:E=>N(M,{protocol:E})}),R.protocol!=="tcp"&&s.jsxs(s.Fragment,{children:[s.jsx(ru,{label:"Access",options:i3,value:R.access,onChange:E=>N(M,{access:E,allow:E==="custom"&&!R.allow.length?[{method:"GET",path:""}]:R.allow})}),R.access==="custom"&&s.jsx(qp,{kind:"allow",items:R.allow,onChange:E=>N(M,{allow:E})}),s.jsx(qp,{kind:"deny",items:R.deny,onChange:E=>N(M,{deny:E})})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("div",{className:"w-52",children:s.jsx(ru,{label:"Enforcement",options:[{id:"enforce",label:"Enforce"},{id:"audit",label:"Audit only"}],value:R.enforcement,onChange:E=>N(M,{enforcement:E})})}),R.enforcement==="audit"&&s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-700",children:[s.jsx(Ba,{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(At,{value:R.allowedIps,onChange:E=>N(M,{allowedIps:E.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(R=>({...R,endpoints:[...R.endpoints,bo()]})),children:[s.jsx(us,{}),"Add destination"]})]}),s.jsx("p",{className:"rounded-md border border-border bg-muted/40 px-3 py-2 text-[11px] leading-relaxed",children:GY(T)}),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(Co,{children:[s.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),s.jsxs(ue,{type:"submit",disabled:x||!m.binaries.length,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[x&&s.jsx(Dt,{"aria-hidden":"true"}),u]})]})]})})})}function _f({className:e,...t}){return s.jsx("textarea",{"data-slot":"textarea",className:ms("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 Ri={ports:[443,80],programs:[],requests:"any",allow:[],deny:[],enforcement:"enforce",privateIps:[]},l3=[{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"}],YY=[{label:"GitHub · read and clone",policy:{name:"GitHub read",destinations:["github.com","api.github.com","codeload.github.com"],advanced:{...Ri,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:{...Ri,ports:[443]}}},{label:"PyPI",policy:{name:"PyPI",destinations:["pypi.org","files.pythonhosted.org"],advanced:{...Ri,ports:[443],requests:"read-only"}}}],Fd=(e={})=>({name:"",action:"allow",destinations:[],appliesTo:{everyone:!1,groups:[],sandboxes:[]},advanced:Ri,...e}),KY=e=>e.split(`
|
|
514
|
-
`).map(t=>t.trim()).filter(Boolean),Yp=e=>e.split(/[\s,]+/).filter(Boolean),XY=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40).replace(/-$/,""),ap=e=>e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`,WY=e=>JSON.stringify({...Ri,...e})===JSON.stringify(Ri);function gy(e){const t={...Ri,...(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 QY(e,t){return{id:t?XY(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:Yp(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:Yp(e.privateIps)}}:{}}}const ZY=e=>{var t;return((t=e.setup)==null?void 0:t.name)??"an MCPs & Skills setup"};function Kp(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 “${ZY(e)}”`]:[]];return a.length?ap(a):null}function JY(e,t=[]){var g;const r=e.destinations.length>3?`${e.destinations.slice(0,3).join(", ")} and ${e.destinations.length-3} more`:ap(e.destinations),a=Kp(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={...Ri,...e.advanced},u=c.requests==="custom"?`only ${c.allow.map(p=>`${p.method} ${p.path}`).join(", ")||"the listed requests"}`:((g=l3.find(p=>p.id===c.requests))==null?void 0:g.label.toLowerCase())+" requests",f=c.programs.length?`from ${ap([...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"} ${ap(c.ports.map(String))}, ${f}.${h} ${l}`}function c3({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=Bt(),p=!(r!=null&&r.id),[x,v]=b.useState(()=>gy(r)),[j,S]=b.useState([]),N=[...a,...j.filter(P=>!a.some(U=>U.id===P.id))].sort((P,U)=>P.name.localeCompare(U.name)),[C,T]=b.useState(""),[k,A]=b.useState(""),[R,M]=b.useState(!1),[E,O]=b.useState(null),[z,_]=b.useState(!1);b.useEffect(()=>{e&&(v(gy(r)),O(null),T(""),A(""),_(!1))},[e,r]);const B=P=>v(U=>({...U,...P})),q=P=>v(U=>({...U,appliesTo:{...U.appliesTo,...P}})),I=((K=x.appliesTo.setups)==null?void 0:K.length)>0,L=!x.appliesTo.everyone&&!x.appliesTo.sandboxes.length&&(I||x.appliesTo.groups.length>0)&&x.appliesTo.groups.every(P=>N.some(U=>U.id===P)),H=QY(x,p),F=P=>{const U=Yp(P).filter((Z,te,le)=>!x.destinations.includes(Z)&&le.indexOf(Z)===te);U.length&&B({destinations:[...x.destinations,...U]}),A("")},V=P=>{const U=P.trim();U&&!x.programs.includes(U)&&B({programs:[...x.programs,U]}),T("")},G=Object.fromEntries(N.map(P=>[P.id,l.filter(U=>So({assignments:c},U).includes(P.id)).length])),X=l.filter(P=>tx(H,{name:P,groups:So({assignments:c},P),setups:u[P]??[]}));async function $(P){if(P.preventDefault(),!L){O("Choose at least one group for this network rule.");return}M(!0),O(null);const U=Yp(k).filter(te=>!H.destinations.includes(te)),Z={...H,destinations:[...H.destinations,...U]};try{m(await g.savePolicy({...Z,isNew:p}),Z),t(!1)}catch(te){O(te.message)}finally{M(!1)}}async function Q(){M(!0),O(null);try{m({...await g.deletePolicy(r.id),deleted:!0},r),t(!1)}catch(P){O(P.message)}finally{M(!1)}}return s.jsx(bn,{open:e,onOpenChange:t,children:s.jsx(yn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:s.jsxs("form",{onSubmit:$,className:"grid gap-5",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:p?"Add network rule":`Edit ${r.name}`}),s.jsx($n,{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"}),YY.map(P=>s.jsx("button",{type:"button",onClick:()=>v(U=>({...gy(Fd(P.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:P.label},P.label))]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"policy-name",className:"text-xs",children:"Name"}),s.jsx(At,{id:"policy-name",value:x.name,onChange:P=>B({name:P.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:["· ",I?"Optional":"Required"]})]}),I&&s.jsxs("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:["Applies to sandboxes that use the MCPs & Skills setup",(se=x.setup)!=null&&se.name?s.jsxs(s.Fragment,{children:[" “",s.jsx("span",{className:"text-foreground",children:x.setup.name}),"”"]}):"",". Groups you pick here also get it."]}),s.jsx(sf,{multiple:!0,required:!I,groups:N,counts:G,value:x.appliesTo.groups,onChange:P=>q({everyone:!1,groups:P,sandboxes:[]}),onCreated:P=>{S(U=>[...U,P]),h==null||h(P)}}),X.length>0&&s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[X.length," ",X.length===1?"sandbox":"sandboxes"," currently in scope."]}),!p&&!I&&(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(ru,{label:"Action",options:[{id:"allow",label:"Allow"},{id:"block",label:"Block"}],value:x.action,onChange:P=>B({action:P})})})]}),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:[x.destinations.map(P=>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:[P,s.jsx("button",{type:"button","aria-label":`Remove ${P}`,onClick:()=>B({destinations:x.destinations.filter(U=>U!==P)}),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(Dn,{className:"size-3"})})]},P)),s.jsx("input",{id:"policy-destinations",value:k,onChange:P=>/[\s,]$/.test(P.target.value)?F(P.target.value):A(P.target.value),onKeyDown:P=>{P.key==="Enter"?(P.preventDefault(),F(k)):P.key==="Backspace"&&!k&&x.destinations.length&&B({destinations:x.destinations.slice(0,-1)})},onBlur:()=>F(k),className:"min-w-32 flex-1 bg-transparent font-mono text-[11px] outline-none placeholder:text-muted-foreground",placeholder:x.destinations.length?"":x.action==="block"?"pastebin.com":"github.com","aria-label":"Destinations"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:x.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."})]}),x.action==="allow"&&s.jsxs("details",{className:"group rounded-lg border border-border",open:!WY(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(At,{id:"policy-ports",value:x.ports,onChange:P=>B({ports:P.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(ru,{label:"Requests",options:l3,value:x.requests,onChange:P=>B({requests:P,allow:P==="custom"&&!x.allow.length?[{method:"GET",path:""}]:x.allow})}),x.requests==="custom"&&s.jsx(qp,{kind:"allow",items:x.allow,onChange:P=>B({allow:P})}),s.jsx(qp,{kind:"deny",items:x.deny,onChange:P=>B({deny:P})})]}),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:[x.programs.map(P=>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:[P,s.jsx("button",{type:"button","aria-label":`Remove ${P}`,onClick:()=>B({programs:x.programs.filter(U=>U!==P)}),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(Dn,{className:"size-3"})})]},P)),!x.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(At,{value:C,onChange:P=>T(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),V(C))},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(C),disabled:!C.trim(),children:"Add"})]}),f.filter(P=>!x.programs.includes(P)).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(P=>!x.programs.includes(P)).slice(0,6).map(P=>s.jsxs("button",{type:"button",onClick:()=>V(P),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:["+ ",P]},P))]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("div",{className:"w-52",children:s.jsx(ru,{label:"Enforcement",options:[{id:"enforce",label:"Enforce"},{id:"audit",label:"Audit only"}],value:x.enforcement,onChange:P=>B({enforcement:P})})}),x.enforcement==="audit"&&s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-700",children:[s.jsx(Ba,{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(At,{id:"policy-ips",value:x.privateIps,onChange:P=>B({privateIps:P.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:JY(H,N)}),E&&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:E}),s.jsxs(Co,{className:"sm:justify-between",children:[p?s.jsx("span",{}):z?s.jsxs("span",{className:"grid gap-1.5",children:[x.setup&&s.jsxs("span",{className:"max-w-64 text-[11px] text-muted-foreground",children:["Sandboxes that use “",x.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:R,onClick:Q,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:R||!L||!x.name.trim()||!x.destinations.length&&!k.trim(),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[R&&s.jsx(Dt,{"aria-hidden":"true"}),p?"Add rule":"Save rule"]})]})]})]})})})}function eK({open:e,onOpenChange:t,org:r,onSaved:a}){const l=Bt(),[c,u]=b.useState(""),[f,m]=b.useState(!1),[h,g]=b.useState(null);b.useEffect(()=>{e&&(u(((r==null?void 0:r.blocked)??[]).join(`
|
|
515
|
-
`)),g(null))},[e,r]);async function p(x){x.preventDefault(),m(!0),g(null);try{a(await l.saveOrg({...r,blocked:KY(c)})),t(!1)}catch(v){g(v.message)}finally{m(!1)}}return s.jsx(bn,{open:e,onOpenChange:t,children:s.jsx(yn,{className:"sm:max-w-md",children:s.jsxs("form",{onSubmit:p,className:"grid gap-4",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:"Blocked everywhere"}),s.jsx($n,{className:"text-xs",children:"Blocked in every sandbox, with their subdomains. No rule can open them."})]}),s.jsx(_f,{rows:6,value:c,onChange:x=>u(x.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(Co,{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(Dt,{"aria-hidden":"true"}),"Save"]})]})]})})})}function oE({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 u3({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 d3=b.createContext(void 0);function Lf(e){const t=b.useContext(d3);if(t===void 0&&!e)throw new Error(Jt(72));return t}const tK={...zg,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 nK extends vu{constructor(r,a,l){const c=new Cf;super(sK(r,c,a,l),rK(c),tK);tn(this,"setOpen",(r,a)=>{yB(this,r,a,{extraState:{openChangeReason:a.reason}})})}cancelPendingOpen(r){this.state.floatingRootContext.dispatchOpenChange(!1,bt(Zo,r))}}function sK(e,t,r,a=!1){return{...Dg(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 rK(e){return{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const oK=jf(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:x=null,children:v}=t,j=M1((B,q)=>new nK({open:a,openProp:l,activeTriggerId:x,triggerIdProp:p},B,q));j.useControlledProp("openProp",l),j.useControlledProp("triggerIdProp",p),j.useContextCallback("onOpenChange",m),j.useContextCallback("onOpenChangeComplete",h);const S=j.useState("open"),N=!r&&S,C=j.useState("activeTriggerId"),T=j.useState("mounted"),k=j.useState("payload");j.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:c,disabled:r}),Ag(j,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:A,transitionStatus:R}=Og(N,j),M=j.useState("isInstantPhase"),E=j.useState("instantType"),O=j.useState("lastOpenChangeReason"),z=b.useRef(null);Ke(()=>{S&&r&&j.setOpen(!1,bt($A))},[S,r,j]),Ke(()=>{R==="ending"&&O===Er||R!=="ending"&&M?(E!=="delay"&&(z.current=E),j.set("instantType","delay")):z.current!==null&&(j.set("instantType",z.current),z.current=null)},[R,M,O,E,j]),Ke(()=>{N&&C==null&&j.set("payload",void 0)},[j,C,N]),b.useImperativeHandle(f,()=>({unmount:A,close:()=>j.setOpen(!1,bt(jg))}),[A,j]);const _=N||T||!r&&u!=="none";return s.jsxs(d3.Provider,{value:j,children:[g&&s.jsx(Eg,{handle:g,store:j}),_&&s.jsx(aK,{store:j,disabled:r,trackCursorAxis:u}),typeof v=="function"?v({payload:k}):v]})});function aK({store:e,disabled:t,trackCursorAxis:r}){const a=e.useState("floatingRootContext"),l=Sf(a,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=A$(a,{enabled:!t&&r!=="none",axis:r==="none"?void 0:r}),u=b.useMemo(()=>Ks(c.reference,l.reference),[c.reference,l.reference]);return Mg(e,{activeTriggerProps:u,inactiveTriggerProps:u,popupProps:l.floating??gn}),null}const f3=b.createContext(void 0);function iK(){return b.useContext(f3)}const lK=600,m3="data-base-ui-tooltip-trigger";function aE(e){if("composedPath"in e){const r=e.composedPath();for(let a=0;a<r.length;a+=1){const l=r[a];if(qt(l))return l}}const t=e.target;return qt(t)?t:null}function cK(e){let t=e;for(;t;){const r=t.closest(`[${m3}]`);if(r)return r;const a=t.getRootNode();t="host"in a&&qt(a.host)?a.host:null}return null}const uK=N1(function(t,r){const{render:a,className:l,style:c,handle:u,payload:f,disabled:m,delay:h,closeOnClick:g=!0,closeDelay:p,id:x,...v}=t,j=Lf(!0),N=I1(u)??j;if(!N)throw new Error(Jt(82));const C=fs(x),T=N.useState("isTriggerActive",C),k=N.useState("isOpenedByTrigger",C),A=N.useState("floatingRootContext"),R=b.useRef(null),M=p??0,{registerTrigger:E,isMountedByThisTrigger:O}=z1(C,R,N,{payload:f,closeOnClick:g,closeDelay:M}),z=iK(),{activeIdRef:_,delayRef:B,isInstantPhase:q,hasProvider:I}=v$(A,{open:k}),L=L1(A);N.useSyncedValue("isInstantPhase",q);const H=N.useState("disabled"),F=m??H,V=Ln(F),G=N.useState("trackCursorAxis"),X=N.useState("disableHoverablePopup"),$=b.useRef(!1),Q=ts(),K=b.useRef(void 0);function se(){return I&&_.current!=null?0:h??z??lK}function P(W){const ce=R.current;if(!ce||!W)return!1;const Re=cK(W);return Re!==null&&Re!==ce&&pt(ce,Re)}function U(W){const ce=P(W);return $.current=ce,ce&&(L.openChangeTimeout.clear(),L.restTimeout.clear(),L.restTimeoutPending=!1,Q.clear()),ce}const Z=B1(A,{enabled:!F,mouseOnly:!0,move:!1,handleClose:!X&&G!=="both"?V1():null,restMs:se,delay(){return p==null&&I?{close:Bl(B.current,"close")}:{close:M}},triggerElementRef:R,isActiveTrigger:T,isClosing:()=>N.select("transitionStatus")==="ending",shouldOpen(){return!$.current}}),te=jO(A,{enabled:!F}).reference,le=W=>{const ce=$.current,Re=aE(W),_e=U(Re),Ne=R.current,Ae=Ne&&Re&&pt(Ne,Re);if(_e&&N.select("open")&&N.select("lastOpenChangeReason")===Hn){N.setOpen(!1,bt(Hn,W));return}if(ce&&!_e&&Ae&&!V.current&&!N.select("open")&&Ne&&Ei(K.current)){const J=()=>{!$.current&&!V.current&&!N.select("open")&&N.setOpen(!0,bt(Hn,W,Ne))},re=se();re===0?(Q.clear(),J()):Q.start(re,J)}},de=N.useState("triggerProps",O);return jt("button",t,{state:{open:k},ref:[r,E,R],props:[Z,te,O||G!=="none"?de:void 0,{onMouseOver(W){le(W.nativeEvent)},onFocus(W){P(aE(W.nativeEvent))&&W.preventBaseUIHandler()},onMouseLeave(){$.current=!1,Q.clear(),K.current=void 0},onPointerEnter(W){K.current=W.pointerType},onPointerDown(W){K.current=W.pointerType,N.set("closeOnClick",g),g&&!N.select("open")&&N.cancelPendingOpen(W.nativeEvent)},onClick(W){g&&!N.select("open")&&N.cancelPendingOpen(W.nativeEvent)},id:C,[Hy]:F?"":void 0,[m3]:F?void 0:""},v],stateAttributesMapping:h1})}),h3=b.createContext(void 0);function dK(){const e=b.useContext(h3);if(e===void 0)throw new Error(Jt(70));return e}const fK=b.forwardRef(function(t,r){const{children:a,container:l,className:c,render:u,style:f,...m}=t,{node:h,subtree:g}=rO({container:l,ref:r,componentProps:t,elementProps:m});return!g&&!h?null:s.jsxs(b.Fragment,{children:[g,h&&ro.createPortal(a,h)]})}),mK=b.forwardRef(function(t,r){const{keepMounted:a=!1,...l}=t;return Lf().useState("mounted")||a?s.jsx(h3.Provider,{value:a,children:s.jsx(fK,{ref:r,...l})}):null}),p3=b.createContext(void 0);function g3(){const e=b.useContext(p3);if(e===void 0)throw new Error(Jt(71));return e}const hK=b.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:x=5,arrowPadding:v=5,sticky:j=!1,disableAnchorTracking:S=!1,collisionAvoidance:N=C1,style:C,...T}=t,k=Lf(),A=dK(),R=k.useState("open"),M=k.useState("mounted"),E=k.useState("trackCursorAxis"),O=k.useState("disableHoverablePopup"),z=k.useState("floatingRootContext"),_=k.useState("instantType"),B=k.useState("transitionStatus"),q=k.useState("adaptiveOrigin"),I=Lg({anchor:c,positionMethod:u,floatingRootContext:z,mounted:M,side:f,sideOffset:h,align:m,alignOffset:g,collisionBoundary:p,collisionPadding:x,sticky:j,arrowPadding:v,disableAnchorTracking:S,keepMounted:A,collisionAvoidance:N,adaptiveOrigin:q}),L=b.useMemo(()=>({open:R,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:E!=="none"?"tracking-cursor":_}),[R,I.side,I.align,I.anchorHidden,E,_]),H=Bg(t,L,{styles:I.positionerStyles,transitionStatus:B,props:T,refs:[r,k.useStateSetter("positionerElement")],hidden:!M,inert:!R||E==="both"||O});return s.jsx(p3.Provider,{value:I,children:H})}),pK=b.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,f=Lf(),{side:m,align:h}=g3(),g=f.useState("open"),p=f.useState("instantType"),x=f.useState("transitionStatus"),v=f.useState("popupProps"),j=f.useState("floatingRootContext"),S=f.useState("disabled"),N=f.useState("closeDelay");lr({open:g,ref:f.context.popupRef,onComplete(){var A,R;g&&((R=(A=f.context).onOpenChangeComplete)==null||R.call(A,!0))}}),$1(j,{enabled:!S,closeDelay:N});const C=f.useStateSetter("popupElement");return jt("div",t,{state:{open:g,side:m,align:h,instant:p,transitionStatus:x},ref:[r,f.context.popupRef,C],props:[Nf,v,Ef(x),u],stateAttributesMapping:gg})}),gK=b.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,f=Lf(),{arrowRef:m,side:h,align:g,arrowUncentered:p,arrowStyles:x}=g3(),v=f.useState("open"),j=f.useState("instantType");return jt("div",t,{state:{open:v,side:h,align:g,uncentered:p,instant:j},ref:[r,m],props:[{style:x,"aria-hidden":!0},u],stateAttributesMapping:xf})}),xK=function(t){const{delay:r,closeDelay:a,timeout:l=400}=t,c=b.useMemo(()=>({open:r,close:a}),[r,a]);return s.jsx(f3.Provider,{value:r,children:s.jsx(y$,{delay:c,timeoutMs:l,children:t.children})})};function $f({delay:e=0,...t}){return s.jsx(xK,{"data-slot":"tooltip-provider",delay:e,...t})}function Pa({...e}){return s.jsx(oK,{"data-slot":"tooltip",...e})}function Ia({...e}){return s.jsx(uK,{"data-slot":"tooltip-trigger",...e})}function _a({className:e,side:t="top",sideOffset:r=4,align:a="center",alignOffset:l=0,children:c,...u}){return s.jsx(mK,{children:s.jsx(hK,{align:a,alignOffset:l,side:t,sideOffset:r,className:"isolate z-50",children:s.jsxs(pK,{"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(gK,{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 Xo={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"]}},Xp=["org","policy","group","agent","own","secret"],Ea=e=>e.startsWith("_provider_")?"secret":e.startsWith("egress_")?"policy":e.startsWith("org_")?"org":e.startsWith("group_")?"group":e.startsWith("agent-")?"agent":"own",Gd=e=>e.replace(/^_provider_/,"").replace(/^(org|group|egress)_/,"").replace(/_/g,"-");function Hw(e){if(!e)return null;try{return new URL(e.includes("://")?e:`https://${e}`).hostname}catch{return e.split("/")[0].replace(/:\d+$/,"")}}function x3(e){try{const t=new URL(e.includes("://")?e:`https://${e}`);return Number(t.port)||(t.protocol==="http:"?80:443)}catch{return 443}}const Wp=e=>e.split("/").pop(),b3=e=>/^\d+\.\d+\.\d+\.\d+$/.test(e);function bK(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 Fw({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:bK(e).charAt(0).toUpperCase()})}const iE=b.forwardRef(function({item:t,denied:r,active:a,onFocus:l,onBlur:c,onAllow:u},f){const m=Xo[t.source]??Xo.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(Pa,{children:[s.jsxs(Ia,{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(_a,{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"})]})}),Rh=b.forwardRef(function({title:t,count:r,icon:a,summary:l,open:c,onToggle:u,tone:f="neutral",children:m,className:h,...g},p){const x=b.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":x,"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(Qo,{className:Le("size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none",c&&"rotate-180")})]}),s.jsx(Rn.div,{id:x,initial:!1,animate:{height:c?"auto":0,opacity:c?1:0},transition:{duration:Ls()?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 Fc({children:e,canvas:t,label:r}){var m;const[a,l]=b.useState({x:0,y:0}),c=b.useRef(null),u=b.useRef(!1),f=(h,g,p)=>{const x=t.current.getBoundingClientRect(),v=h.getBoundingClientRect(),j=x.width/t.current.offsetWidth||1,S=(v.left-x.left)/j-a.x,N=(v.top-x.top)/j-a.y;return{x:Math.max(-S,Math.min(g,x.width/j-S-v.width/j)),y:Math.max(-N,Math.min(p,x.height/j-N-v.height/j))}};return b.useLayoutEffect(()=>{var h;(h=t.current)==null||h.dispatchEvent(new Event("graph-move"))},[a,t]),b.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,x=h.clientY-g.y;if(!g.moved&&Math.hypot(p,x)<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+x/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 yK({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 x=b.useRef(null),v=b.useRef(null),j=b.useRef(null),S=b.useMemo(()=>({agents:b.createRef(),owner:b.createRef(),secrets:b.createRef(),blocked:b.createRef(),allowed:b.createRef()}),[]),[N,C]=b.useReducer(z=>z+1,0);b.useEffect(()=>{var B;let z=(B=x.current)==null?void 0:B.clientWidth;const _=new ResizeObserver(()=>{var I;const q=(I=x.current)==null?void 0:I.clientWidth;q!==z&&(z=q,C())});return _.observe(x.current),()=>_.disconnect()},[]);const[T,k]=b.useState({}),[A,R]=b.useState(null),M=z=>k(_=>({..._,[z]:!_[z]})),E=["secrets","blocked","allowed",...r.flatMap(z=>[`${z.name}:mcps`,`${z.name}:skills`])],O=E.every(z=>T[z]);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:C,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:()=>k(Object.fromEntries(E.map(z=>[z,!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:x,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(z=>s.jsx(Fc,{canvas:x,label:z.name,children:s.jsxs("div",{className:"flex w-full max-w-[280px] flex-col items-center gap-2",children:[s.jsxs(oE,{"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(u3,{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:z.logo?s.jsx("img",{src:z.logo,alt:"",className:"size-6 object-contain"}):s.jsx(LR,{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:z.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":`${z.name} resources`,className:"overflow-hidden rounded-xl border border-border/80 bg-card shadow-[0_2px_8px_#1c191705]",children:[{kind:"mcps",title:"MCPs",icon:Zv},{kind:"skills",title:"Skills",icon:QP}].map(({kind:_,title:B,icon:q})=>{var G;const I=(G=z.resources)==null?void 0:G[_],L=(I==null?void 0:I.status)==="checked",H=(I==null?void 0:I.status)==="unsupported",F=L?I.items:[],V=`${z.name}:${_}`;return s.jsx(Rh,{title:B,"aria-label":`${z.name} ${B}`,count:L?F.length:"-",icon:q,summary:H?"Setup integration unavailable":L?"In agent user configuration":"Inventory unavailable",open:!!T[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?`${B} integration unavailable`:L?`No ${B} found in user configuration`:`${B} inventory unavailable`})]})},_)})})})]})},`${e}-${N}-${z.name}`))}),s.jsx(Fc,{canvas:x,label:"Owner",children:s.jsxs(oE,{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(_6,{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}-${N}-owner`),s.jsx(Fc,{canvas:x,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(Xl,{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}-${N}-sandbox`),s.jsx(Fc,{canvas:x,label:"Gateway",children:s.jsx("div",{className:"relative z-10 flex justify-center @2xl:col-start-2 @2xl:row-start-3",children:s.jsxs(Pa,{children:[s.jsxs(Ia,{"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(mf,{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(_a,{className:"max-w-64 font-sans",children:[p?`Connected through ${p.name}. `:"","The sandbox’s host machine is not reported."]})]})})},`${e}-${N}-gateway`),s.jsx(Fc,{canvas:x,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(rg,{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(Rh,{ref:S.allowed,title:"Approved network",count:l.length,icon:Fn,summary:"Destinations in policy",tone:"allowed",open:!!T.allowed,onToggle:()=>M("allowed"),className:"border-0 shadow-none",children:[l.map(z=>s.jsx(iE,{item:z,active:A===z.host,onFocus:()=>R(z.host),onBlur:()=>R(null)},z.host)),!l.length&&s.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No approved destinations"})]}),s.jsxs(Rh,{ref:S.blocked,title:"Blocked network",count:c.length,icon:XP,summary:"Recent connection attempts",tone:"blocked",open:!!T.blocked,onToggle:()=>M("blocked"),className:"border-0 border-t border-border/60 shadow-none",children:[c.map(z=>s.jsx(iE,{item:z,denied:!0,active:A===z.host,onFocus:()=>R(z.host),onBlur:()=>R(null),onAllow:u?()=>u(z):void 0},z.host)),!c.length&&s.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No blocked attempts"})]})]})},`${e}-${N}-network`),s.jsx(Fc,{canvas:x,label:"Secrets",children:s.jsxs(Rh,{ref:S.secrets,title:"Secrets",count:g.length,icon:gu,summary:g.length?g.map(z=>z.name).join(", "):"None attached",open:!!T.secrets,onToggle:()=>M("secrets"),className:"@2xl:col-start-2 @2xl:row-start-4",children:[g.map(z=>{var _;return s.jsxs(Pa,{children:[s.jsx(Ia,{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:z.name}),s.jsxs(_a,{className:"max-w-72 break-words font-sans",children:[z.name,z.type?` · ${z.type}`:"",(_=z.credentialKeys)!=null&&_.length?` · ${z.credentialKeys.join(", ")}`:""]})]},z.name)}),!g.length&&s.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No secrets attached"})]})},`${e}-${N}-secrets`),s.jsx(vK,{container:x,core:v,hub:j,groups:S},`${e}-${N}-${r.map(z=>z.name).join(",")}`)]})]})})}function vK({container:e,core:t,hub:r,groups:a}){const l=b.useRef(null),[c,u]=b.useState([]);return b.useEffect(()=>{function f(){var C;if(!e.current||!t.current||!r.current)return;const g=(C=l.current)==null?void 0:C.getScreenCTM();if(!g)return;const p=g.inverse(),x=T=>{const k=T.getBoundingClientRect(),A=new DOMPoint(k.left,k.top).matrixTransform(p),R=new DOMPoint(k.right,k.bottom).matrixTransform(p);return{left:A.x,top:A.y,right:R.x,bottom:R.y,width:R.x-A.x,height:R.y-A.y}},v=x(t.current),j=x(r.current),S=v.left+v.width/2,N=v.top+v.height/2;u(Object.entries(a).flatMap(([T,k])=>{const A=k.current?x(k.current):null;if(!A)return[];if(T==="owner"||T==="secrets"){const B=T==="owner"?v.top:j.bottom,q=T==="owner"?A.bottom:A.top,I=A.left+A.width/2,L=(B+q)/2;return[{key:T,d:`M ${S} ${B} C ${S} ${L}, ${I} ${L}, ${I} ${q}`,x:I,y:q}]}if(T==="agents")return[...k.current.querySelectorAll("[data-agent-node]")].map((B,q)=>{const I=x(B),L=v.left,H=I.right,F=I.top+I.height/2,V=(L+H)/2;return{key:`agent-${q}`,d:`M ${L} ${N} C ${V} ${N}, ${V} ${F}, ${H} ${F}`,x:H,y:F}});const R=v.right,M=A.left,E=x(k.current.querySelector("button")),O=E.top+E.height/2,z=R+(M-R)*.4,_=z+(M-z)*.5;return[{key:T,d:`M ${R} ${N} H ${z} C ${_} ${N}, ${_} ${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 wK(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 of=e=>e.id||`${e.sandbox}|${e.at}|${e.source}|${e.target}|${e.message}`,lE={CRITICAL:6,FATAL:6,HIGH:5,MED:4,MEDIUM:4,LOW:3,INFO:2,INFORMATIONAL:2},jK={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},SK={NET:"Network",HTTP:"HTTP",SSH:"Session",CONFIG:"Configuration",PROC:"Process",FILE:"File",AUTH:"Authentication",FINDING:"Finding",EVENT:"Event"};function y3(e){var u,f,m,h;const t=((u=e.binary)==null?void 0:u.split("/").pop())||"",r=Jg.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:SK[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:jK[e.reason]??e.reason??""};return{event:e,agent:a,key:of(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 cE(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 x=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(N=>r!=="all"&&N.values.direction!==r||x.size&&!x.has(N.values.sandbox)||c.length&&!c.includes(N.values.agent)||l.length&&!l.includes(N.values.verdict)||v&&!N.search.includes(v)||f!=="all"&&(!Number.isFinite(N.timestamp)||N.timestamp<j||N.timestamp>S)?!1:Object.entries(u).every(([C,T])=>{var k;return!((k=T==null?void 0:T.value)!=null&&k.trim())||(T.mode==="equals"?(N.values[C]??"").toLowerCase()===T.value.trim().toLowerCase():(N.values[C]??"").toLowerCase().includes(T.value.trim().toLowerCase()))!==(T.mode==="excludes")})).sort((N,C)=>{const T=p.key==="severity"?lE[N.values.severity.toUpperCase()]??-1:p.key==="time"?Number.isFinite(N.timestamp)?N.timestamp:0:N.values[p.key]??"",k=p.key==="severity"?lE[C.values.severity.toUpperCase()]??-1:p.key==="time"?Number.isFinite(C.timestamp)?C.timestamp:0:C.values[p.key]??"",A=typeof T=="number"?T-k:T.localeCompare(k,void 0,{numeric:!0});return(p.direction==="asc"?A:-A)||N.key.localeCompare(C.key)})}const v3=b.createContext(null),xy=2e3;function Gw({children:e}){const t=Bt(),r=Cn(),[a,l]=b.useState(null),[c,u]=b.useState(null),[f,m]=b.useState([]),[h,g]=b.useState("connecting"),[p,x]=b.useState(null),[v,j]=b.useState(null),S=b.useRef(new Set),N=b.useRef(0),[C,T]=b.useState(0),k=b.useCallback(E=>{const O=E.filter(z=>{const _=of(z);return S.current.has(_)?!1:(S.current.add(_),!0)});O.length&&m(z=>{const _=[...O,...z].sort((B,q)=>(q.at??"").localeCompare(B.at??""));if(_.length<=xy)return _;for(const B of _.slice(xy))S.current.delete(of(B));return _.slice(0,xy)})},[]),A=b.useCallback(async()=>{try{u(await t.overview())}catch(E){u(O=>O??{error:E.message})}},[t]),R=b.useCallback(async()=>{const E=N.current;try{const O=await t.activity({limit:500});if(E!==N.current)return;k(O.events),x(O.coverage),j(null)}catch(O){j(O.message)}},[k,t]);b.useEffect(()=>{let E,O,z=!1;const _=()=>{N.current++,S.current.clear(),m([]),T(B=>B+1),R()};return l(null),u(null),m([]),S.current.clear(),N.current++,t.context().then(async B=>{if(z)return;if(!r&&!B.configured){g("setup-required"),l([]);return}A(),R(),O=setInterval(A,15e3);const q=await t.contextKey();z||(E=new EventSource(t.url("/stream",{context:q,...r?{location:"1"}:{}})),E.onopen=()=>{g("live"),_()},E.addEventListener("context-changed",()=>window.location.reload()),E.addEventListener("activity-deleted",I=>{x(JSON.parse(I.data).coverage),_()}),E.onerror=()=>g("reconnecting"),E.addEventListener("sandboxes",I=>{g("live"),l(JSON.parse(I.data))}),E.addEventListener("log",I=>k([JSON.parse(I.data)])),E.addEventListener("collection",I=>x(JSON.parse(I.data))),E.addEventListener("gateway-health",()=>g("live")),E.addEventListener("gateway-error",()=>g("gateway-down")))}).catch(()=>{z||g("gateway-down")}),()=>{z=!0,E==null||E.close(),clearInterval(O)}},[k,R,A,t,r==null?void 0:r.context]);const M=b.useMemo(()=>({sandboxes:a??(c==null?void 0:c.sandboxes)??null,overview:c,events:f,connection:h,collection:p,historyError:v,activityRevision:C,refresh:()=>{A(),R()}}),[a,c,f,h,p,v,C,A,R]);return s.jsx(v3.Provider,{value:M,children:e})}function Ga(){const e=b.useContext(v3);if(!e)throw new Error("useLive outside LiveProvider");return e}const kl={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"}},Bv=["running","sleeping","provisioning","error","unknown"],NK={ready:"running",provisioning:"provisioning",starting:"provisioning",stopping:"provisioning",stopped:"sleeping",completed:"sleeping",error:"error",deleting:"unknown",unknown:"unknown",unspecified:"unknown"},Qp={ready:"Ready",provisioning:"Provisioning",starting:"Starting",stopping:"Stopping",stopped:"Stopped",completed:"Completed",error:"Error",deleting:"Deleting",unknown:"Unknown",unspecified:"Unknown"},rx=e=>NK[e]??"unknown",La=e=>kl[rx(e)],CK=e=>["ready","provisioning","starting"].includes(e),kK=e=>e==="stopped",TK=e=>e!=null&&e.length?e.join(" "):"Scratch shell",ip=(e,t)=>t||(/^sha256:[a-f0-9]{64}$/i.test(e??"")?"Unknown template":e)||"Gateway default";function EK(e){const t=Object.fromEntries(Bv.map(r=>[r,0]));for(const r of e)t[rx(r.phase)]+=1;return{total:e.length,status:t}}const qd=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 w3(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 RK(e,t=Date.now()){return["stopped","completed"].includes(e.phase)?"Not running":e.phase==="ready"?w3(e.startedAt,t):"-"}const Wo={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"}},qw={"read-only":"Read only","read-write":"Read & write",full:"Any request",custom:"Specific requests",connect:"Connection",none:"No access",blocked:"Blocked"},AK=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],OK={own:VR,agent:Xl,org:tI,group:Ra,policy:xu,secret:gu},wo=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,j3=e=>e.replace(/^\*\*?\./,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,56);function Td({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 S3({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",Xo[e].swatch),"aria-hidden":"true"}),Xo[e].label]})}function ou({className:e,children:t}){return s.jsx("div",{className:Le("rounded-lg border border-border bg-card",e),children:t})}function MK({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 N3({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 C3="grid-cols-[minmax(0,2fr)_minmax(0,1fr)_8rem_7rem_5rem_1rem]",k3="grid-cols-[minmax(0,1.6fr)_7.5rem_5rem_minmax(0,1fr)_13.5rem]",uE="grid-cols-[minmax(0,1.2fr)_minmax(0,1.3fr)_8rem_5rem_1rem]",by="grid-cols-[1rem_minmax(0,1.1fr)_4.5rem_minmax(0,1.5fr)_minmax(0,1fr)_7.5rem_5rem]";function DK({d:e,total:t,onOpen:r}){const[a,l]=b.useState(!1),c=Ls(),u=b.useId(),f=Xp.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",C3),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(Fw,{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(S3,{source:h},h))}),s.jsx("span",{className:"text-[12px] text-muted-foreground",children:e.access.size===1?qw[[...e.access][0]]??[...e.access][0]:"Mixed"}),s.jsx("span",{className:"block",children:s.jsx(N3,{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(Jr,{className:Le("size-3.5 text-faint transition-transform",a&&"rotate-90"),"aria-hidden":"true"})]}),s.jsx(Fl,{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:[wo(e.sandboxes.size,"sandbox","sandboxes")," · ",wo(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=Xo[Ea(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(Xl,{"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:Gd(h.key),children:Gd(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 ${Gd(h.key)}`,onClick:()=>r(h.sandbox),children:["View rules",s.jsx(Mi,{className:"size-3"})]})})]},`${h.sandbox}:${h.key}`)})})]})})]})})})]})}function zK({b:e,onDecide:t}){return s.jsxs("li",{className:Le("grid items-center gap-4 px-6 py-2",k3),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(Fw,{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?` · ${yu(e.lastAt)}`:""]})]})]}),s.jsx("span",{className:"text-[12px] tabular-nums",children:wo(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(Wp).join(", ")||"-"}),s.jsxs("span",{className:"flex items-center justify-end gap-1.5",children:[s.jsxs(Nu,{children:[s.jsxs(Cu,{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(Qo,{className:"size-3 opacity-70"})]}),s.jsx(ku,{align:"end",className:"w-60",children:s.jsxs(op,{children:[s.jsxs($v,{children:["Allow ",e.host]}),s.jsxs(qs,{onClick:()=>t("allow-org",e),children:[s.jsx(Ra,{}),"Choose groups",s.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"new rule"})]}),e.sandboxes.size===1&&s.jsxs(qs,{onClick:()=>t("allow-one",e),children:[s.jsx(Ra,{}),"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 Vv({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 lp({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 dE({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 fE({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 mE({label:e,checked:t,mixed:r=!1,disabled:a,onChange:l}){const c=b.useRef(null);return b.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 PK({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:x,deleting:v}){var C;const j=((C=t==null?void 0:t.org)==null?void 0:C.blocked)??[],S=e.filter(T=>h.has(T.id)).length,N=e.length>0&&S===e.length;return s.jsxs(s.Fragment,{children:[s.jsxs(lp,{className:by,children:[s.jsx(mE,{label:"Select all matching network rules",checked:N,mixed:S>0&&!N,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",by),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(Jv,{"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(dE,{action:"block"}),s.jsx(fE,{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(Kn,{className:"size-3.5"}),"Delete"]})]}),e.map(T=>{const k=r.filter(R=>tx(T,{name:R.name,groups:So({assignments:l},R.name),setups:(c==null?void 0:c[R.name])??[]})),A=k.filter(R=>R.status==="loaded"&&R.rules.some(M=>M.key===`egress_${T.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",by,h.has(T.id)&&"bg-accent/40"),children:[s.jsx(mE,{label:`Select ${T.name}`,checked:h.has(T.id),disabled:v,onChange:()=>g(T.id)}),s.jsxs("button",{onClick:()=>u(T),disabled:v,"aria-label":`Edit ${T.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(xu,{"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:T.name})]}),s.jsx(dE,{action:T.action}),s.jsx(fE,{hosts:T.destinations}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:T.appliesTo.everyone||T.appliesTo.sandboxes.length||!T.appliesTo.groups.length?s.jsx("span",{className:"text-amber-700",title:`Current scope: ${Kp(T,a)||"none"}`,children:"Assign a group"}):Kp(T,a)}),k.length?s.jsx(N3,{n:A,total:k.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 ${T.name}`,disabled:v,onClick:()=>x([T]),children:[s.jsx(Kn,{className:"size-3.5"}),"Delete"]})]},T.id)})]})]})}function IK({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:x,onClearSandbox:v}){var Ee,Ce;const j=Bt(),[S,N]=b.useState(()=>new Set),[C,T]=b.useState(null),[k,A]=b.useState(!1),[R,M]=b.useState([]),E=b.useRef(!1),[O,z]=b.useState("all"),[_,B]=b.useState(""),[q,I]=b.useState(100),[L,H]=b.useState("rules"),[F,V]=b.useState(Date.now),G=b.useRef(null),X=b.useRef(null);b.useEffect(()=>{const be=setInterval(()=>V(Date.now()),3e4),Ue=Je=>{var dt;(Je.metaKey||Je.ctrlKey)&&Je.key.toLowerCase()==="k"&&(Je.preventDefault(),(dt=G.current)==null||dt.focus())};return window.addEventListener("keydown",Ue),()=>{clearInterval(be),window.removeEventListener("keydown",Ue)}},[]),b.useEffect(()=>{var be;I(100),(be=X.current)==null||be.scrollTo({top:0})},[_,O,L]);const $=b.useMemo(()=>XM(r,15,F),[r,F]),Q=e.sandboxes,K=Q.length,se=(t==null?void 0:t.policies)??[],P=(t==null?void 0:t.groups)??[],{destinations:U,blocked:Z,perSandbox:te}=b.useMemo(()=>{var Ie,ot;const be=new Map,Ue=new Map,Je=new Map;for(const We of Q){const me=new Set,Oe={};for(const Me of We.rules){const nt=Ea(Me.key);Oe[nt]=(Oe[nt]??0)+1;for(const Ge of Me.endpoints){if(Ge.blocked)continue;me.add(Ge.host);const qe=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};qe.sources.add(nt),qe.access.add(Ge.access),Ge.ports.forEach(pe=>qe.ports.add(pe)),qe.sandboxes.add(We.name);let ht=qe.grants.find(pe=>pe.sandbox===We.name&&pe.key===Me.key);ht||(ht={sandbox:We.name,key:Me.key,source:nt,access:[],ports:[]},qe.grants.push(ht)),ht.access.push(Ge.access),ht.ports.push(...Ge.ports),be.set(Ge.host,qe)}}Ue.set(We.name,me),Je.set(We.name,{counts:Oe,blocked:0})}const dt=new Map;for(const We of r){if(We.kind!=="audit"||!We.verdict)continue;const me=Hw(We.destination);if(!me||b3(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"||(Ie=Ue.get(We.sandbox))!=null&&Ie.has(me))continue;const Oe=dt.get(me)??{host:me,port:x3(We.destination),sandboxes:new Set,attempts:0,programs:new Set,lastAt:null};Oe.attempts+=1,Oe.sandboxes.add(We.sandbox),We.binary&&Oe.programs.add(We.binary),We.at&&(!Oe.lastAt||We.at>Oe.lastAt)&&(Oe.lastAt=We.at),dt.set(me,Oe);const Me=Je.get(We.sandbox);Me&&(Me.blocked+=1)}const lt=fq([...((ot=t==null?void 0:t.org)==null?void 0:ot.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:[...dt.values()].filter(We=>!lt.some(me=>VM(me,We.host))).sort((We,me)=>me.sandboxes.size-We.sandboxes.size||me.attempts-We.attempts),perSandbox:Je}},[Q,r,t]),le=Q.filter(be=>be.status==="loaded").length,de=_.trim().toLowerCase(),oe=U.filter(be=>(O==="all"||be.sources.has(O))&&(!de||[be.host,...be.grants.flatMap(Ue=>[Ue.sandbox,Ue.key])].join(" ").toLowerCase().includes(de))),ne=oe.length,ee=[{id:"all",label:"All"},...Xp.filter(be=>U.some(Ue=>Ue.sources.has(be))).map(be=>({id:be,label:Xo[be].label}))],W=Z.filter(be=>!de||[be.host,...be.programs,...be.sandboxes].join(" ").toLowerCase().includes(de)),ce=Q.filter(be=>!de||be.name.toLowerCase().includes(de)),Re=be=>{var Ue;return!x||tx(be,{name:x,groups:So(t,x),setups:((Ue=t==null?void 0:t.setupMembers)==null?void 0:Ue[x])??[]})},_e=se.filter(be=>Re(be)).filter(be=>!de||[be.name,be.action,...be.destinations,Kp(be,P)].join(" ").toLowerCase().includes(de)),Ne=se.filter(be=>S.has(be.id)),Ae=_e.filter(be=>S.has(be.id)).length;function J(be){N(Ue=>{const Je=new Set(Ue);return Je.has(be)?Je.delete(be):Je.add(be),Je})}function re(){N(be=>{const Ue=new Set(be),Je=_e.every(dt=>be.has(dt.id));for(const dt of _e)Je?Ue.delete(dt.id):Ue.add(dt.id);return Ue})}async function xe(){if(!(E.current||!(C!=null&&C.length))){E.current=!0,A(!0),M([]);try{const be=await wK(C,Ue=>j.deletePolicy(Ue));N(Ue=>{const Je=new Set(Ue);return be.deleted.forEach(dt=>Je.delete(dt)),be.failed.forEach(({id:dt})=>Je.add(dt)),Je}),M(be.failed),be.deleted.length&&He.success(`Deleted ${wo(be.deleted.length,"network rule")}`),be.failed.length&&He.error(`${wo(be.failed.length,"network rule")} could not be deleted. Review the errors and retry.`),be.syncFailures.length&&He.warning("Rules deleted, but some sandboxes could not be updated",{description:be.syncFailures.map(Ue=>`${Ue.rule} · ${Ue.sandbox}: ${Ue.error}`).join(`
|
|
518
|
-
`)}),T(null),await f()}finally{A(!1),E.current=!1}}}const he=L==="rules"?_e.length:L==="destinations"?ne:L==="blocked"?W.length:ce.length,Be=L==="rules"?se.length:L==="destinations"?U.length:L==="blocked"?Z.length:K,we=!!(_||L==="destinations"&&O!=="all"),Ye=()=>{B(""),z("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:Z.length,dot:"bg-red-500"},{id:"sandboxes",label:"Sandboxes",count:K}].map(be=>s.jsxs("button",{"aria-pressed":L===be.id,onClick:()=>{H(be.id),Ye()},className:Le("rounded-md px-3 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",L===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(rf,{value:be.count})})]},be.id))}),s.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:s.jsx(WM,{points:$,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(na,{ref:G,value:_,onValueChange:B,placeholder:L==="sandboxes"?"Search sandbox…":L==="rules"?"Search rule, destination…":"Search destination, sandbox, rule…","aria-label":"Search egress",className:"mr-auto w-full sm:w-64"}),L==="destinations"&&s.jsx(hn,{"aria-label":"Filter by source",value:O,onChange:be=>z(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:ee.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:Ye,children:[s.jsx(Dn,{className:"size-3"}),"Clear"]}),x&&L==="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:x}),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(Dn,{className:"size-3"})})]}),s.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>a(x),children:["Rules & history",s.jsx(Mi,{className:"size-3"})]})]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh egress",onClick:f,children:s.jsx($a,{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(us,{className:"size-3.5"}),"Add rule"]})]}),L==="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:k,onClick:()=>N(new Set),children:"Clear selection"}),s.jsxs(ue,{variant:"destructive",size:"sm",disabled:k,onClick:()=>T([...Ne]),children:[s.jsx(Kn,{className:"size-3.5"}),k?"Deleting…":"Delete selected"]})]}),Q.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(Ba,{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"})]}),R.length>0&&s.jsxs(za,{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:R.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&&!(L==="rules"&&!we&&((Ce=(Ee=t==null?void 0:t.org)==null?void 0:Ee.blocked)!=null&&Ce.length))?s.jsxs("div",{className:"py-20 text-center",children:[s.jsx(VR,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),s.jsx("p",{className:"text-sm",children:we?"No matching results":L==="rules"?x?`No rule applies to ${x} yet`:"No network rules yet":L==="blocked"?"No blocked hosts to review":L==="sandboxes"?"No sandboxes yet":"No open destinations"}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:!we&&L==="rules"?"Sandboxes are locked down: nothing leaves them until a rule allows it.":!we&&L==="destinations"?"Destinations appear when a sandbox policy allows access.":!we&&L==="blocked"?"Blocked connection attempts will appear here.":""}),we?s.jsx(ue,{variant:"outline",className:"mt-4",onClick:Ye,children:"Clear filters"}):L==="rules"&&s.jsxs(ue,{className:"mt-4 bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:h,children:[s.jsx(us,{}),"Add rule"]})]}):s.jsxs("div",{className:"min-w-[960px] bg-card",children:[L==="rules"&&s.jsx(PK,{policies:_e,org:we?null:t,sandboxes:Q,groups:P,assignments:t==null?void 0:t.assignments,setupMembers:t==null?void 0:t.setupMembers,onEdit:m,onEditBlocked:g,onClearBlocked:p,selected:S,onSelect:J,onSelectAll:re,onDelete:T,deleting:k}),L==="destinations"&&s.jsxs(s.Fragment,{children:[s.jsxs(lp,{className:C3,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:oe.slice(0,q).map(be=>s.jsx(DK,{d:be,total:K,onOpen:a},be.host))})]}),L==="blocked"&&s.jsxs(s.Fragment,{children:[s.jsxs(lp,{className:k3,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(zK,{b:be,onDecide:c},be.host))})]}),L==="sandboxes"&&s.jsxs(s.Fragment,{children:[s.jsxs(lp,{className:uE,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:ce.slice(0,q).map(be=>{var Je,dt;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",uE),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]",La(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:Xp.filter(lt=>Ue.counts[lt]).map(lt=>s.jsxs("span",{className:"flex items-center gap-1.5 text-[12px] tabular-nums",title:Xo[lt].label,children:[s.jsx("span",{className:Le("size-1.5 rounded-full",Xo[lt].swatch)}),Ue.counts[lt]]},lt))}),s.jsxs("span",{className:"items-center gap-1.5 text-[12px] flex",children:[s.jsx("span",{className:Le("size-1.5 rounded-full",((Je=Wo[be.status])==null?void 0:Je.dot)??"bg-stone-200")}),be.error?"Unavailable":be.version?`v${be.version} ${(dt=Wo[be.status])==null?void 0:dt.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(Jr,{className:"size-3.5 text-faint","aria-hidden":"true"})]})},be.name)})})]}),L!=="rules"&&he>q&&s.jsxs("button",{onClick:()=>I(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 ${Be.toLocaleString()}`:""," ",L==="blocked"?"blocked hosts":L]}),s.jsxs("span",{className:"hidden sm:inline",children:[le,"/",K," policies enforced · ⌘K to search"]})]}),s.jsx(Rr,{open:C!==null,onOpenChange:be=>{!be&&!E.current&&T(null)},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:["Delete ",wo((C==null?void 0:C.length)??0,"network rule"),"?"]}),s.jsx(zr,{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:C==null?void 0:C.map(be=>s.jsx("li",{className:"break-all py-1",children:be.name},be.id))}),s.jsxs(Mr,{children:[s.jsx(Ir,{disabled:k,children:"Cancel"}),s.jsx(Pr,{variant:"destructive",disabled:k||!(C!=null&&C.length),onClick:xe,children:k?"Deleting…":"Delete rules"})]})]})})]})}function hE({kind:e,onAdd:t}){const[r,a]=b.useState(!1),[l,c]=b.useState("GET"),[u,f]=b.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:AK.map(m=>s.jsx("option",{children:m},m))}),s.jsx(At,{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(Dn,{})})]}):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(us,{className:"size-3"}),e==="deny"?"Block request":"Allow request"]})}function _K(e){const t=[...new Set(e.endpoints.map(r=>qw[r.access]??r.access))];return t.length===1?t[0]:"Mixed"}function Yw({rule:e,onOp:t,onDelete:r,busy:a,locked:l,managedBy:c,onManage:u}){const[f,m]=b.useState(!1),h=Ea(e.key),g=OK[h],p=e.endpoints.map(v=>v.host),x=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:Xo[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:Gd(e.key)}),x&&s.jsx(Ba,{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(S3,{source:h})}),s.jsx("span",{className:"hidden w-24 shrink-0 text-[12px] text-muted-foreground sm:block",children:_K(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(Wp))].join(", ")}),s.jsx(Jr,{className:Le("size-3.5 shrink-0 text-faint transition-transform duration-200",f&&"rotate-90 text-muted-foreground"),"aria-hidden":"true"})]}),s.jsx(Fl,{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(Td,{children:v.protocol}),s.jsx(Td,{children:(qw[v.access]??v.access).toLowerCase()}),v.protocol!=="tcp"&&v.enforcement==="audit"&&s.jsx(Td,{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(Td,{title:"Private addresses allowed",children:["ips ",v.allowedIps.join(", ")]}),v.credentialRisk&&s.jsx(Td,{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(hE,{kind:"allow",onAdd:j=>t({kind:"addAllow",ruleName:e.key,host:v.host,ports:v.ports,binaries:e.binaries,match:j})}),s.jsx(hE,{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:[Wp(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(Dn,{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(Kn,{}),"Delete"]})]})]})]})})})]})}function LK({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=Wo[a.status])==null?void 0:c.label} · ${yu(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=Wo[a.status])==null?void 0:u.dot)??"bg-stone-200"),"aria-label":`Revision ${a.version}`},a.version)})})}function $K({sandbox:e,version:t,latest:r,onClose:a,onRestore:l}){var m,h,g,p;const c=Bt(),[u,f]=b.useState(null);return b.useEffect(()=>{f(null),t!=null&&c.revision(e,t).then(f).catch(x=>f({error:x.message}))},[e,t,c]),s.jsx(Gl,{open:t!=null,onOpenChange:x=>{x||a()},children:s.jsxs(du,{className:"w-full! overflow-y-auto sm:max-w-[460px]!",children:[s.jsxs(fu,{className:"border-b p-6",children:[s.jsxs(mu,{className:"font-mono text-base",children:[e," · v",t]}),s.jsx(hu,{children:u!=null&&u.revision?`${(m=Wo[u.revision.status])==null?void 0:m.label} · ${Wd(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(ou,{className:"divide-y divide-border/70 overflow-hidden",children:u.policy.rules.map(x=>s.jsx(Yw,{rule:x,locked:!0,onOp:()=>{}},x.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(d6,{}),"Restore"]})]})]})})}function T3({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(Yv,{className:"size-3.5 transition-transform group-hover:-translate-x-0.5"}),"All sandboxes"]})}function BK({onBack:e}){var f,m,h;const t=Bt(),[r,a]=b.useState(null),[l,c]=b.useState(!1),u=b.useCallback(()=>t.globalPolicy().then(a).catch(g=>a({error:g.message})),[t]);return b.useEffect(()=>{u()},[u]),s.jsxs("div",{className:"space-y-6 px-4 py-5 sm:px-6",children:[s.jsx(T3,{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(Jv,{}),"Remove"]})]}),((h=(m=r.current)==null?void 0:m.policy)==null?void 0:h.rules.length)>0&&s.jsx(ou,{className:"divide-y divide-border/70 overflow-hidden",children:r.current.policy.rules.map(g=>s.jsx(Yw,{rule:g,locked:!0,onOp:()=>{}},g.key))}),r.revisions.length>0&&s.jsx(Vv,{title:"History",children:s.jsx(ou,{className:"divide-y divide-border/60",children:r.revisions.map(g=>{var p,x;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=Wo[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:(x=Wo[g.status])==null?void 0:x.label}),s.jsx("span",{className:"ml-auto text-muted-foreground",children:yu(g.createdAt)})]},g.version)})})})]}):s.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"}),s.jsx(Rr,{open:l,onOpenChange:c,children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsx(Dr,{children:"Remove the global policy?"}),s.jsx(zr,{children:"Every sandbox reverts to its own rules."})]}),s.jsxs(Mr,{children:[s.jsx(Ir,{children:"Cancel"}),s.jsx(Pr,{variant:"destructive",onClick:async()=>{try{await t.removeGlobal(),He.success("Global policy removed"),u()}catch(g){He.error(g.message)}finally{c(!1)}},children:"Remove"})]})]})})]})}const pE=[{id:"all",label:"All"},...Xp.map(e=>({id:e,label:Xo[e].label}))];function VK({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,$,Q;const g=Bt(),p=Cn(),[x,v]=b.useState(null),[j,S]=b.useState(!1),[N,C]=b.useState(null),[T,k]=b.useState(null),[A,R]=b.useState("all"),M=b.useCallback(async()=>{try{const K=await g.policy(e);return v(K),K}catch(K){v({error:K.message})}},[e,g]);b.useEffect(()=>{v(null),M()},[M]),b.useEffect(()=>{h&&M()},[h]);async function E(K){var se;for(let P=0;P<20;P++){const U=await M(),Z=(se=U==null?void 0:U.revisions)==null?void 0:se.find(te=>te.version===K);if((Z==null?void 0:Z.status)==="loaded"){He.success(`Policy v${K} is enforced in ${e}`);return}if((Z==null?void 0:Z.status)==="failed"){He.error(`v${K} failed to load: ${Z.loadError??"unknown error"}`);return}await new Promise(te=>setTimeout(te,1500))}He.warning(`v${K} saved; not yet loaded by ${e}`)}async function O(K){S(!0);try{const se=await g.applyOps(e,K);return He(`Saved as v${se.version}`),E(se.version),!0}catch(se){return He.error(se.message),!1}finally{S(!1)}}async function z(K){S(!0);try{const se=await g.restore(e,K);He(`Restored v${K} as v${se.version}`),k(null),E(se.version)}catch(se){He.error(se.message)}finally{S(!1)}}const _=((F=x==null?void 0:x.effective)==null?void 0:F.rules)??[],B=new Set(_.flatMap(K=>K.endpoints.filter(se=>!se.blocked).map(se=>se.host))),q=b.useMemo(()=>{const K=new Map;for(const se of r){if(se.sandbox!==e||se.verdict!=="denied")continue;const P=Hw(se.destination);if(!P||b3(P)||B.has(P))continue;const U=K.get(P)??{host:P,port:x3(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(P,U)}return[...K.values()].sort((se,P)=>P.count-se.count)},[r,e,x]),I=(x==null?void 0:x.source)==="global",L=Object.fromEntries(pE.map(K=>[K.id,_.filter(se=>K.id==="all"||Ea(se.key)===K.id).length])),H=_.filter(K=>A==="all"||Ea(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(T3,{onClick:a}),x?x.error?s.jsx("p",{role:"alert",className:"py-16 text-center text-sm text-muted-foreground",children:x.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]",La(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:[x.latest&&s.jsxs("span",{className:Le("flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[12px]",(V=Wo[x.latest.status])==null?void 0:V.cls),children:[s.jsxs("span",{className:"relative flex size-1.5",children:[x.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=Wo[x.latest.status])==null?void 0:G.dot)})]}),"v",x.latest.version," ",(X=Wo[x.latest.status])==null?void 0:X.label.toLowerCase()]}),s.jsx(LK,{revisions:x.revisions,onOpen:k}),s.jsxs("span",{className:"text-[12.5px] text-muted-foreground tabular-nums",children:[wo(B.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(rg,{}),"View sandbox"]}),s.jsxs(ue,{className:"rounded-lg bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",disabled:j||I,onClick:()=>c(null,E),children:[s.jsx(us,{}),"Add rule"]})]})]}):s.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"})]}),x&&!x.error&&s.jsxs(s.Fragment,{children:[I&&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(Ba,{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"})]}),x.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:x.configurationError}),q.length>0&&!I&&s.jsx(Vv,{title:"Blocked recently",count:q.length,children:s.jsx(ou,{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(Fw,{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?Wp(K.binary):"Unknown program",K.lastAt?` · ${yu(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:j3(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"}]},E),children:"Allow"})]},K.host))})}),s.jsx(Vv,{title:"Rules",count:_.length,actions:s.jsx(MK,{label:"Filter rules",options:pE.filter(K=>K.id==="all"||L[K.id]>0).map(K=>({...K,count:L[K.id]})),value:A,onChange:R}),children:H.length===0?s.jsx(ou,{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(ou,{className:"divide-y divide-border/70 overflow-hidden",children:H.map(K=>{const se=Ea(K.key);return s.jsx(Yw,{rule:K,busy:j,locked:!["own","agent"].includes(se)||I,onOp:P=>O([P]),onDelete:["own","agent"].includes(se)?()=>C(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(Rr,{open:!!N,onOpenChange:K=>{K||C(null)},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:["Delete rule ",N,"?"]}),s.jsxs(zr,{children:[e," loses access immediately. Restorable from revisions."]})]}),s.jsxs(Mr,{children:[s.jsx(Ir,{children:"Cancel"}),s.jsx(Pr,{variant:"destructive",onClick:async()=>{await O([{kind:"removeRule",ruleName:N}]),C(null)},children:"Delete rule"})]})]})}),s.jsx($K,{sandbox:e,version:T,latest:(Q=($=x==null?void 0:x.revisions)==null?void 0:$[0])==null?void 0:Q.version,onClose:()=>k(null),onRestore:z})]})}function UK(e){const t=e.port===443||e.port===80;return{name:j3(e.host),binaries:[...e.programs],endpoints:[{host:e.host,ports:[e.port],protocol:t?"rest":"tcp",...t?{access:"read-only"}:{},enforcement:"enforce"}]}}const gE="egress-allow",xE="egress-sandbox",ql="egress-policy",bE=()=>{try{const e=JSON.parse(sessionStorage.getItem(ql)??"null");return sessionStorage.removeItem(ql),e}catch{return null}};function HK(e){const t=Cn();return s.jsx(FK,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function FK({onNavigate:e}){var le,de,oe,ne,ee;const t=Bt(),r=Cn(),a=W=>e(W,r),l=Ga(),[c,u]=b.useState(null),[f,m]=b.useState(!1),[h,g]=b.useState(()=>{try{const W=sessionStorage.getItem(xE);return sessionStorage.removeItem(xE),W}catch{return null}}),[p,x]=b.useState(null),[v,j]=b.useState(null),[S,N]=b.useState(null),[C,T]=b.useState(null),[k,A]=b.useState(!1),[R,M]=b.useState(!1),[E,O]=b.useState(!1),[z,_]=b.useState(null),[B,q]=b.useState(0),I=b.useRef(null),L=b.useCallback(async()=>{try{x(await t.fleetPolicy())}catch(W){x({error:W.message,sandboxes:[]})}try{j(await t.org())}catch{j(null)}},[t]);b.useEffect(()=>{L()},[L]);const[H,F]=b.useState(bE);b.useEffect(()=>{const W=()=>{const ce=bE();ce&&(F(ce),L())};return window.addEventListener(ql,W),()=>window.removeEventListener(ql,W)},[L]),b.useEffect(()=>{H!=null&&H.new&&T({initial:Fd({appliesTo:{everyone:!1,groups:[],sandboxes:[],...H.new.appliesTo}})})},[H]);const V=b.useRef(null);b.useEffect(()=>{if(!(H!=null&&H.edit)||!v||V.current===H)return;const W=v.policies.find(ce=>ce.id===H.edit);W&&(V.current=H,T({initial:W}))},[H,v]),b.useEffect(()=>{let W=null;try{W=JSON.parse(sessionStorage.getItem(gE)??"null"),sessionStorage.removeItem(gE)}catch{}!(W!=null&&W.sandbox)||!(W!=null&&W.host)||(u(W.sandbox),N({sandbox:W.sandbox,initial:UK({host:W.host,port:Number(W.port)||443,programs:new Set(W.binary?[W.binary]:[])}),after:()=>q(ce=>ce+1)}))},[]);const G=b.useMemo(()=>{const W=new Set;for(const ce of l.events)ce.binary&&W.add(ce.binary);return[...W].sort()},[l.events]),X=W=>{var ce;u(W),(ce=I.current)==null||ce.scrollTo({top:0})},$=()=>{var W;m(!0),(W=I.current)==null||W.scrollTo({top:0})},Q=()=>{var W;u(null),m(!1),L(),(W=I.current)==null||W.scrollTo({top:0})};function K(W,ce){const _e={everyone:!1,groups:W==="allow-one"?So(v,[...ce.sandboxes][0]):[],sandboxes:[]};if(W.startsWith("allow")){T({initial:Fd({name:ce.host,destinations:[ce.host],appliesTo:_e})});return}_({kind:W,b:ce})}function se(W){const ce=((v==null?void 0:v.policies)??[]).find(Re=>Re.id===W);ce&&T({initial:ce})}function P(W,ce){var _e,Ne;const Re=((_e=W.applied)==null?void 0:_e.length)??0;(Ne=W.failed)!=null&&Ne.length?He.warning(`${ce}. ${wo(W.failed.length,"sandbox","sandboxes")} could not be updated`,{description:W.failed.map(Ae=>`${Ae.sandbox}: ${Ae.error}`).join(`
|
|
519
|
-
`)}):He.success(ce,{description:Re?`Updated ${wo(Re,"sandbox","sandboxes")}.`:void 0}),L(),q(Ae=>Ae+1)}async function U(){O(!0);try{const W=v??await t.org();P(await t.saveOrg({...W.org,blocked:[]}),"Cleared blocked hosts"),M(!1)}catch(W){He.error(W.message)}finally{O(!1)}}async function Z(){const{b:W}=z;try{const ce=v??await t.org();P(await t.saveOrg({...ce.org,blocked:[...ce.org.blocked,W.host]}),`${W.host} blocked everywhere`),_(null)}catch(ce){He.error(ce.message)}}const te=((le=p==null?void 0:p.sandboxes)==null?void 0:le.length)??0;return s.jsxs("div",{ref:I,className:"h-full overflow-y-auto",children:[f?s.jsx(BK,{onBack:Q}):c?s.jsx(VK,{name:c,sandbox:((de=p==null?void 0:p.sandboxes)==null?void 0:de.find(W=>W.name===c))??((oe=l.sandboxes)==null?void 0:oe.find(W=>W.name===c)),events:l.events,onBack:Q,onNavigate:a,onOpenGlobal:$,reloadSignal:B,onDraft:(W,ce)=>N({sandbox:c,initial:W,after:ce}),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(IK,{fleet:p,org:v,events:l.events,onOpen:X,onOpenGlobal:$,onDecide:K,onNavigate:a,onRefresh:L,onEditPolicy:W=>T({initial:W}),onEditBlocked:()=>A(!0),onClearBlocked:()=>M(!0),onAddPolicy:()=>T({initial:Fd(h?{appliesTo:{everyone:!1,groups:So(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(c3,{open:!!C,onOpenChange:W=>{W||T(null)},initial:C==null?void 0:C.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,ce)=>P(W,`${W.deleted?"Deleted":"Saved"} ${ce.name}`)}),s.jsx(Rr,{open:R,onOpenChange:W=>{!W&&!E&&M(!1)},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:["Unblock ",wo(((ee=(ne=v==null?void 0:v.org)==null?void 0:ne.blocked)==null?void 0:ee.length)??0,"host")," everywhere?"]}),s.jsx(zr,{children:"Removes the shared blocked list and updates every sandbox. These hosts can then be reached if another rule allows them."})]}),s.jsxs(Mr,{children:[s.jsx(Ir,{disabled:E,children:"Cancel"}),s.jsx(Pr,{variant:"destructive",disabled:E,onClick:U,children:E?"Removing…":"Unblock all"})]})]})}),s.jsx(eK,{open:k,onOpenChange:A,org:v==null?void 0:v.org,onSaved:W=>P(W,"Saved blocked hosts")}),s.jsx(qY,{open:!!S,onOpenChange:W=>{W||N(null)},initial:S==null?void 0:S.initial,knownPrograms:G,onSubmit:async W=>{var Re;const ce=await t.applyOps(S.sandbox,[{kind:"addRule",rule:W}]);He(`Saved as v${ce.version}`),q(_e=>_e+1),(Re=S.after)==null||Re.call(S,ce.version)}}),s.jsx(Rr,{open:!!z,onOpenChange:W=>{W||_(null)},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:["Block ",z==null?void 0:z.b.host," everywhere?"]}),s.jsxs(zr,{children:["Adds it, with its subdomains, to the hosts blocked in every sandbox. No rule can open it. Applies to ",wo(te,"sandbox","sandboxes"),"."]})]}),s.jsxs(Mr,{children:[s.jsx(Ir,{children:"Cancel"}),s.jsx(Pr,{variant:"destructive",onClick:Z,children:"Block everywhere"})]})]})})]})}const GK=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 qK(e,t=Jq){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:x=e,location:v=null},j={}){if(l.has(u))return{id:u,promise:l.get(u).promise};const S={cancelled:!1,api:x};return l.set(u,S),r=[...r.filter(N=>N.id!==u),{id:u,name:m,review:f,location:v,prepared:p,status:"importing",message:p?"Saving your setup…":"Preparing your tools…"}],a.forEach(N=>N()),S.promise=(async()=>{var N;try{const C=p?{status:"saved",setup:await x.saveSetup(f.token,m,!0),inactive:f.items.filter(T=>{var k;return!T.disabled&&((k=T.issues)==null?void 0:k.length)}).map(T=>T.name)}:await t(x,f,m,h,{resumeJob:g,isCancelled:()=>S.cancelled,onProgress:T=>{var k;c(u,{preparation:T,message:T.message}),(k=j.onProgress)==null||k.call(j,T)},onReview:T=>{var k;c(u,{review:T,prepared:!0}),(k=j.onReview)==null||k.call(j,T)}});return c(u,{status:C.status,setup:C.setup,...C.status==="cancelled"?{prepared:!1}:{},message:C.status==="saved"?`Available in templates and sandboxes.${(N=C.inactive)!=null&&N.length?` Inactive: ${C.inactive.join(", ")}.`:""}${GK(C.setup)}`:C.status==="needs-attention"?"Some items need attention. Open the import to remove or fix them.":"Import cancelled. You can resume from the completed preparation."}),C}catch(C){throw c(u,{status:"failed",message:C.message}),C}finally{l.delete(u)}})(),{id:u,promise:S.promise}}}}const Ai=qK(ls),YK=(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)})}),KK=(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)},XK=(e,t,r)=>YK(e,t).some(a=>{var l;return KK(a.advanced)&&(((l=a.advanced)==null?void 0:l.ports)??[443,80]).map(Number).includes(Number(r.port??443))&&a.destinations.some(c=>VM(c,r.host))}),E3=e=>{var t;return!!(e.credentialRef||(t=e.credentialFields)!=null&&t.length)},WK=(e,t)=>String(e??"").toLowerCase()===String(t??"").toLowerCase(),yE=(e,t)=>!E3(e)&&(t.phase==="runtime"||t.phase==="auth"&&(e.requirements??[]).some(r=>r.phase==="runtime"&&WK(r.host,t.host))),Uv=e=>`${e.host}${Number(e.port??443)===443?"":`:${e.port}`}`,QK=e=>`${Uv(e)}${e.path||""}`;function ZK(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"&&E3(m))&&XK(t,f,h)?l.add(Uv(h)):c.set(QK(h),Uv(h));const u=new Set(c.values());return{covered:[...l].filter(f=>!u.has(f)),uncovered:[...c.keys()]}}function JK(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 Kw=[{id:"codex",name:"Codex",logo:"codex"},{id:"claude",name:"Claude Code",logo:"claudecode"},{id:"cursor",name:"Cursor",logo:"cursor"}],Zp=(e,t)=>e.items.filter(r=>r.kind===t).length,Na=e=>e.issues.filter(t=>!Iw(t)),eX=e=>e.items.filter(t=>!t.disabled&&!Na(t).length).length,Jp=e=>e.items.filter(t=>Na(t).length).length,vE=e=>e.sources.map(t=>{var r;return((r=Kw.find(a=>a.id===t))==null?void 0:r.name)||t}).join(", "),tX=e=>`${e.host}${e.port&&Number(e.port)!==443?`:${e.port}`:""}${e.path||""}`,nX={build:"Downloads from",runtime:"Connects to",auth:"Sign-in"},wE={connected:"Connected","needs-sign-in":"Needs sign-in","needs-credentials":"Needs credentials",unverified:"Couldn’t check"},sX={prepared:"Ready","sign-in-in-sandbox":"Sign in after install","needs-attention":"Needs attention",disabled:"Inactive"},jE=e=>{var t,r,a;return e.disabled?"Inactive":_w(e)?"Can’t run in a sandbox":Na(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"},rX=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"),R3=(e=[])=>e.some(t=>!rX(t))?"Enter domain names like api.github.com (no wildcards, IP addresses or local names).":e.length>20?"Add up to 20 websites.":"",A3=e=>{var t;return((t=e.credentialFields)==null?void 0:t.length)>0&&!e.requirements.some(r=>r.phase==="runtime")},O3=(e,t)=>{var r;return A3(e)&&qM(t)&&!((r=t==null?void 0:t.hosts)!=null&&r.length)},cp=e=>(e==null?void 0:e.egressPolicy)??(e!=null&&e.egressPolicyError?{error:e.egressPolicyError}:null),oX=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function af({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 M3({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(xu,{className:"mt-0.5 size-3.5 shrink-0"}),s.jsx("span",{children:e})]})}const SE=[{kind:"mcp",label:"MCPs",icon:Zv},{kind:"skill",label:"Skills",icon:Xv}];function D3({items:e,children:t}){return s.jsxs(Af,{defaultValue:e.some(r=>r.kind==="mcp")?"mcp":"skill",className:"min-w-0 gap-3",children:[s.jsx(Of,{"aria-label":"Setup item categories",className:"w-full",children:SE.map(({kind:r,label:a,icon:l})=>s.jsxs(jr,{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))}),SE.map(({kind:r,label:a,icon:l})=>s.jsx(vo,{value:r,keepMounted:!0,className:"min-w-0",children:s.jsx(Ko,{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 z3(e){const t=Cn();return s.jsx(aX,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function aX({sandbox:e=null,setupIds:t=[]}){const r=Bt(),a=Cn(),[l,c]=b.useState(null),[u,f]=b.useState(""),[m,h]=b.useState(!1),[g,p]=b.useState(null),[x,v]=b.useState(null),[j,S]=b.useState(!1),[N,C]=b.useState(""),[T,k]=b.useState(""),[A,R]=b.useState("all"),[M,E]=b.useState(!1),[O,z]=b.useState(!1),[_,B]=b.useState(null),q=b.useCallback(async()=>{z(!0);try{c(await r.setups()),f("")}catch(V){f(V.message)}finally{z(!1)}},[r]),L=b.useSyncExternalStore(Ai.subscribe,Ai.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(",");b.useEffect(()=>{q()},[q,L]);const H=b.useMemo(()=>(l||[]).filter(V=>{const G=[V.name,...V.items.flatMap(X=>[X.name,...X.sources||[]])].join(" ").toLowerCase().includes(T.trim().toLowerCase());return(!e||t.includes(V.id))&&G&&(A==="all"||(A==="review"?Jp(V)>0:Jp(V)===0))}).sort((V,G)=>V.name.localeCompare(G.name,void 0,{numeric:!0})*(M?-1:1)),[l,T,A,M,e,t]),F=!!(T||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(na,{"aria-label":"Search setups",placeholder:"Search…",value:T,onValueChange:k,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=>R(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:()=>{k(""),R("all")},children:"Clear"}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh setups",disabled:O,onClick:q,children:O?s.jsx(Dt,{className:"size-3.5"}):s.jsx($a,{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(us,{}),"Bring my setup"]})]}),u&&s.jsxs("div",{className:"space-y-2 border-b px-4 py-3 sm:px-6",children:[s.jsx(af,{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(Dt,{}),"Loading setups…"]}):l&&!H.length?s.jsxs("div",{className:"px-4 py-16 text-center",children:[s.jsx(DI,{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?(k(""),R("all")):h(!0),children:l.length?"Clear filters":"Bring my setup"})]}):l&&s.jsx(Ko,{duration:.15,offset:0,blur:"0px",children:s.jsxs(U8,{"aria-label":"MCPs & Skills",className:"min-w-[740px] text-xs",children:[s.jsx(H8,{children:s.jsxs(LC,{className:"hover:bg-transparent",children:[s.jsx(L0,{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:()=>E(V=>!V),children:["Name",M?s.jsx(cf,{className:"size-3"}):s.jsx(uf,{className:"size-3"})]})}),["Source agents","MCPs","Skills","Created"].map(V=>s.jsx(L0,{scope:"col",className:"h-9 px-4 text-[11px] font-normal text-muted-foreground",children:V},V)),s.jsx(L0,{className:"w-12",children:s.jsx("span",{className:"sr-only",children:"Actions"})})]})}),s.jsx(F8,{children:H.map(V=>{const G=Kw.filter(X=>V.items.some($=>{var Q;return(Q=$.sources)==null?void 0:Q.includes(X.id)}));return s.jsxs(LC,{className:"cursor-pointer hover:bg-muted/40",onClick:()=>p(V),children:[s.jsx(Uc,{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(Qv,{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(Uc,{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(Uc,{className:"px-4 py-2 tabular-nums",children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(Zv,{"aria-hidden":"true",className:"size-3.5 text-muted-foreground",strokeWidth:1.5}),Zp(V,"mcp")]})}),s.jsx(Uc,{className:"px-4 py-2 tabular-nums",children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(Xv,{"aria-hidden":"true",className:"size-3.5 text-muted-foreground",strokeWidth:1.5}),Zp(V,"skill")]})}),s.jsx(Uc,{className:"px-4 py-2 text-[11px] text-muted-foreground",children:V.createdAt?Wd(V.createdAt):"Not reported"}),s.jsx(Uc,{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(),C(""),v(V)},children:s.jsx(Kn,{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"})]}),x&&s.jsx(bn,{open:!0,onOpenChange:V=>{!V&&!j&&v(null)},children:s.jsxs(yn,{className:"sm:max-w-md",children:[s.jsxs(jn,{children:[s.jsxs(vn,{children:["Delete “",x.name,"”?"]}),s.jsx($n,{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(af,{children:N}),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),C("");try{await r.deleteSetup(x.id,x.revision),c(V=>V.filter(G=>G.id!==x.id)),p(V=>(V==null?void 0:V.id)===x.id?null:V),v(null)}catch(V){C(V.message)}finally{S(!1)}},children:[j&&s.jsx(Dt,{}),"Delete setup"]})]})]})}),m&&s.jsx(I3,{initialReview:m.review,initialName:m.name,onClose:()=>h(!1),onSaved:V=>{h(!1),q(),B(cp(V))}}),_&&s.jsx(P3,{policy:_,onClose:()=>B(null)}),g&&s.jsx(dX,{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 iX(){const e=b.useSyncExternalStore(Ai.subscribe,Ai.getSnapshot),[t,r]=b.useState(null),[a,l]=b.useState(null);return s.jsxs(s.Fragment,{children:[e.map(c=>s.jsx(za,{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(No,{location:c.location}),!["importing","saved"].includes(c.status)&&s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>r(c),children:"Review import"}),c.status==="saved"&&cp(c.setup)&&s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>l({policy:cp(c.setup),location:c.location}),children:"View egress policy"})]}),onDismiss:c.status==="importing"?void 0:()=>Ai.dismiss(c.id),dismissLabel:`Dismiss import notification for ${c.name}`,children:c.message},c.id)),t&&s.jsx(Da,{location:t.location,children:s.jsx(I3,{initialJob:t,initialReview:t.review,initialName:t.name,onClose:()=>r(null),onSaved:c=>{l({policy:cp(c),location:t.location}),r(null)}},t.id)}),(a==null?void 0:a.policy)&&s.jsx(Da,{location:a.location,children:s.jsx(P3,{policy:a.policy,onClose:()=>l(null)})})]})}function P3({policy:e,onClose:t}){var A,R,M,E,O;const r=Bt(),a=Cn(),[l,c]=b.useState([]),[u,f]=b.useState(null),[m,h]=b.useState([]),[g,p]=b.useState(!1),[x,v]=b.useState(""),[j,S]=b.useState(!1);b.useEffect(()=>{if(e.error)return;let z=!0;return r.org().then(_=>{var q;if(!z)return;const B=(_.policies??[]).find(I=>I.id===e.id);h(_.groups??[]),f(B??null),c(((q=B==null?void 0:B.appliesTo)==null?void 0:q.groups)??[])}).catch(_=>{z&&v(`Could not load groups: ${_.message}`)}),()=>{z=!1}},[r,e.id,e.error]);const N=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(z){v(z.message)}finally{p(!1)}},C=u&&(l.length!==u.appliesTo.groups.length||l.some(z=>!u.appliesTo.groups.includes(z))),T=JK(e),k=()=>{try{sessionStorage.setItem(ql,JSON.stringify({edit:e.id}))}catch{}t(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"egress",location:a}})),window.dispatchEvent(new Event(ql))};return e.error?s.jsx(bn,{open:!0,onOpenChange:z=>{z||t()},children:s.jsxs(yn,{className:"sm:max-w-md",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:"Egress policy not saved"}),s.jsx($n,{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(bn,{open:!0,onOpenChange:z=>{z||t()},children:s.jsxs(yn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:e.created?"Egress policy created":"Egress policy updated"}),s.jsxs($n,{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."]})]}),T.length>0&&s.jsx("ul",{"aria-label":"Allowed websites",className:"max-h-64 divide-y overflow-y-auto rounded-lg border text-xs",children:T.map(z=>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:z.host}),z.items.length>0&&s.jsx("span",{className:"max-w-[50%] text-right text-muted-foreground",children:z.items.join(", ")})]},z.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(", "),"."]}),((R=e.approval)==null?void 0:R.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(z=>`${z.host} (${z.items.join(", ")})`).join(", "),". You approve these for each sandbox when you enable the setup there."]}),(((M=e.sync)==null?void 0:M.error)||((O=(E=e.sync)==null?void 0:E.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(sf,{multiple:!0,groups:m,value:l,onChange:z=>{S(!1),c(z)},onCreated:z=>h(_=>[..._,z])}),x&&s.jsx("p",{role:"alert",className:"text-[11px] text-red-700",children:x}),j&&!C&&s.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"Groups saved."})]}),!u&&x&&s.jsx("p",{role:"alert",className:"text-[11px] text-red-700",children:x}),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:k,children:"Edit policy"}),C&&s.jsxs(ue,{disabled:g,onClick:N,children:[g&&s.jsx(Dt,{}),"Save groups"]}),s.jsx(ue,{variant:C?"ghost":"default",disabled:g,onClick:t,children:C?"Skip":"Done"})]})]})})}function lX({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=>yE(e,c)),a=t(c=>!yE(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 cX({preparation:e,onCancel:t}){var p,x;const r=e.status==="running",[a,l]=b.useState(Date.now);b.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=((x=e.items)==null?void 0:x.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(Dt,{}),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:oX(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&&_w(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(Dt,{className:"size-3.5"}):S||!v.state||v.state==="disabled"?g:v.state==="needs-attention"?s.jsx(xu,{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":sX[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 uX({item:e,choice:t,disabled:r,onChange:a}){const l=R3(t==null?void 0:t.hosts)||(O3(e,t)?"Enter at least one website, for example api.github.com.":"");return A3(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(At,{"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 I3({onClose:e,onSaved:t,initialReview:r=null,initialName:a="My setup",initialJob:l=null}){const c=Bt(),u=Cn(),[f,m]=b.useState([]),[h,g]=b.useState(null),[p,x]=b.useState([]),[v,j]=b.useState(r),[S,N]=b.useState(a),[C,T]=b.useState(""),[k,A]=b.useState(null),[R,M]=b.useState(!1),[E,O]=b.useState("");async function z(ee){M(!0),O("");try{await ee()}catch(W){O(W.message)}finally{M(!1)}}const[_,B]=b.useState({}),[q,I]=b.useState((l==null?void 0:l.preparation)??null),[L,H]=b.useState((l==null?void 0:l.prepared)??!1),[F,V]=b.useState(!1),[G,X]=b.useState(!!l),$=b.useRef(l==null?void 0:l.id),Q=b.useRef(!0);b.useEffect(()=>(Q.current=!0,()=>{Q.current=!1}),[]);const K=(q==null?void 0:q.status)==="running"||R&&!!q,se=(ee,W)=>{H(!1),B(ce=>({...ce,[ee]:{...ce[ee],...W}}))};async function P(ee){const W=await c.removeSetupReviewItem(v.token,ee);j(W),x(ce=>ce.filter(Re=>Re!==ee)),B(ce=>Object.fromEntries(Object.entries(ce).filter(([Re])=>Re!==ee))),I(null),$.current&&Ai.updateReview($.current,W,L)}async function U(ee=!1){X(!0),V(!0);const W=Ai.start({id:$.current,review:v,name:S,choices:_,saveOnly:ee,api:c,location:u,resumeJob:(q==null?void 0:q.status)==="running"?q:void 0},{onProgress:ce=>{Q.current&&I(ce)},onReview:ce=>{Q.current&&(j(ce),H(!0),B({}))}});$.current=W.id;try{const ce=await W.promise;if(!Q.current)return;ce.status==="saved"?t(ce.setup):ce.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{Q.current&&V(!1)}}const Z=(h==null?void 0:h.items.filter(ee=>`${ee.name} ${ee.kind} ${ee.sources.join(" ")}`.toLowerCase().includes(C.toLowerCase())))??[],te=new Set(p),le=(ee,W)=>x(ce=>{const Re=new Set(ce);for(const _e of ee)W?Re.add(_e.id):Re.delete(_e.id);return[...Re]}),de=Z.length>0&&Z.every(ee=>te.has(ee.id)),oe=v?Qq(v,_):[],ne=Object.values(_).some(ee=>R3(ee.hosts))||!!(v!=null&&v.items.some(ee=>!ee.disabled&&O3(ee,_[ee.id])));return s.jsxs(bn,{open:!0,onOpenChange:ee=>{!ee&&($.current||F||!R&&!K)&&e()},children:[s.jsxs(yn,{className:"flex max-h-[90svh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl",children:[s.jsxs(jn,{className:"shrink-0 px-6 pb-4 pt-6 pr-12",children:[s.jsx(vn,{children:v?"Import setup":h?"Choose what to bring":"Bring my setup"}),s.jsx($n,{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:Kw.map(ee=>s.jsxs("button",{type:"button","aria-pressed":f.includes(ee.id),onClick:()=>m(W=>W.includes(ee.id)?W.filter(ce=>ce!==ee.id):[...W,ee.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(ee.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/${ee.logo}.svg`,alt:"",className:"size-4"})}),ee.name,f.includes(ee.id)&&s.jsx(Fn,{className:"ml-auto size-3.5"})]},ee.id))})}),h&&!v&&s.jsxs(s.Fragment,{children:[s.jsx(na,{"aria-label":"Search discovered tools",placeholder:"Search MCPs and Skills…",value:C,onValueChange:T}),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",C.trim()?` · ${Z.length} matching`:""]}),s.jsx(ue,{size:"sm",variant:"outline",disabled:R||!Z.length,onClick:()=>le(Z,!de),children:de?C.trim()?"Clear results":"Clear all":C.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:ee,label:W})=>{const ce=Z.filter(Ne=>Ne.kind===ee),Re=ce.filter(Ne=>te.has(Ne.id)).length,_e=ce.length>0&&Re===ce.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:[Re,"/",ce.length]})]}),s.jsx(ue,{size:"sm",variant:"ghost",className:"h-7 text-xs",disabled:R||!ce.length,"aria-label":`${_e?"Clear":"Select all"} ${W}${C.trim()?" in search results":""}`,onClick:()=>le(ce,!_e),children:_e?"Clear":"Select all"})]}),s.jsxs("div",{className:"max-h-64 divide-y overflow-y-auto",children:[ce.map(Ne=>s.jsxs("label",{className:"flex cursor-pointer items-start gap-3 p-3",children:[s.jsx($l,{disabled:R,"aria-label":`Import ${Ne.name} from ${vE(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:[vE(Ne),_w(Ne)?" · Can’t run in a sandbox":Na(Ne).length?" · Needs attention":""]})]})]},Ne.id)),!ce.length&&s.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:C.trim()?`No matching ${W}`:`No ${W} found`})]})]},ee)})}),C.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(ee=>s.jsx("p",{className:"text-[11px] text-muted-foreground",children:ee},ee))]}),v&&s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"grid gap-1.5 text-xs",children:["Setup name",s.jsx(At,{disabled:R,value:S,onChange:ee=>N(ee.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:[eX(v)," ready · ",Jp(v)," need attention"]})}),s.jsx(D3,{items:v.items,children:ee=>s.jsx(I7,{className:"overflow-hidden rounded-lg border",children:ee.map(W=>{var ce,Re,_e,Ne,Ae,J,re,xe;return s.jsxs(_7,{value:W.id,children:[s.jsxs("div",{className:"flex items-center [&>h3]:min-w-0 [&>h3]:flex-1",children:[s.jsxs(L7,{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(jE(W))?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:jE(W)})]}),s.jsx(ue,{variant:"ghost",size:"icon",className:"mr-2 size-7 shrink-0 text-muted-foreground hover:text-destructive",disabled:R||K,"aria-label":`Remove ${W.name} from import`,title:"Remove from this import",onClick:()=>z(()=>P(W.id)),children:s.jsx(Kn,{className:"size-3.5"})})]}),s.jsxs($7,{className:"space-y-3 border-t bg-muted/10 px-4 py-4 text-xs leading-relaxed [&_p:not(:last-child)]:mb-0",children:[Na(W).length>0&&s.jsx("div",{className:"space-y-1 text-amber-700 dark:text-amber-400",children:Na(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,Be)=>s.jsxs("p",{children:[s.jsxs("span",{className:"font-medium",children:[nX[he.phase]||he.phase,":"]})," ",tX(he),s.jsxs("span",{className:"text-muted-foreground",children:[" · ",he.reason]})]},Be)),W.kind==="mcp"&&!W.disabled&&!Na(W).some(he=>!he.startsWith("Connect credentials"))&&s.jsx(lX,{item:W})]}),W.package&&s.jsxs("p",{children:["npm package ",W.package.name,"@",((ce=W.artifact)==null?void 0:ce.version)||W.package.requested,W.artifact?" · downloaded and version-locked":" · downloads when you press Import"]}),W.verification&&s.jsxs("p",{children:["Connection: ",wE[W.verification.status]||W.verification.status,W.verification.reason?` · ${W.verification.reason}`:""]}),((Re=W.artifact)==null?void 0:Re.verification)&&s.jsxs("p",{children:["Startup check: ",wE[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."]}),((_e=W.configuration)==null?void 0:_e.endpoint)&&!W.credentialRef&&s.jsx(M3,{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(uX,{item:W,choice:_[W.id],disabled:R||K,onChange:he=>se(W.id,{hostsText:he,hosts:he.split(/[\s,]+/).map(Be=>Be.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"}),((J=W.sourceCredentialFields)==null?void 0:J.length)>0&&s.jsxs("label",{className:"flex items-start gap-2",children:[s.jsx($l,{disabled:R||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 Be,we;return!((Be=_[W.id])!=null&&Be.useSourceSecrets)||!((we=W.sourceCredentialFields)!=null&&we.includes(he))}).map(he=>{var Be,we;return s.jsxs("label",{className:"grid gap-1",children:[he,s.jsx(At,{type:"password",autoComplete:"new-password","aria-label":`${W.name} ${he}`,disabled:R||K,value:((we=(Be=_[W.id])==null?void 0:Be.secrets)==null?void 0:we[he])||"",onChange:Ye=>{var Ee;return se(W.id,{secrets:{...(Ee=_[W.id])==null?void 0:Ee.secrets,[he]:Ye.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(Jr,{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:R,onClick:()=>z(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(Xv,{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(cX,{preparation:q,onCancel:()=>{Ai.cancel($.current).catch(ee=>O(ee.message))}}):s.jsx("p",{children:L?sE(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||R,onClick:()=>{j(null),m([...new Set(r.items.flatMap(ee=>ee.sources))]),I(null),H(!1),B({})},children:"Re-scan sources"})]}),s.jsx(af,{children:E})]}),s.jsxs("div",{className:"shrink-0 space-y-4 border-t bg-muted/20 px-6 py-4",children:[v&&!K&&!L&&oe.length>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:[oe.map(ee=>ee.name).join(", ")," will be saved as inactive. You can fix ",oe.length===1?"it":"them"," later."]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[h&&s.jsx(ue,{variant:"ghost",disabled:R||K,onClick:()=>{v?(j(null),H(!1),I(null),B({})):(g(null),x([])),O("")},children:"Back"}),s.jsx(ue,{variant:"ghost",disabled:!$.current&&!F&&(R||K),onClick:e,children:F?"Continue in background":$.current?"Close":"Cancel"}),v?s.jsxs(ue,{disabled:R||!S.trim()||!v.items.length||ne,onClick:()=>z(()=>U(L&&!sE(v))),children:[R&&s.jsx(Dt,{}),R?"Importing…":K?"Resume import":G?"Retry import":"Import"]}):h?s.jsxs(ue,{disabled:R||!p.length,onClick:()=>z(async()=>{j(await c.reviewSetup(h.token,p)),X(!1)}),children:[R&&s.jsx(Dt,{}),"Review selection"]}):s.jsxs(ue,{disabled:R||!f.length,onClick:()=>z(async()=>g(await c.discoverSetups(f))),children:[R&&s.jsx(Dt,{}),"Discover tools"]})]})]})]}),k&&s.jsx(bn,{open:!0,onOpenChange:()=>A(null),children:s.jsxs(yn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-3xl",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:k.path}),s.jsx($n,{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:k.content})]})})]})}function dX({setup:e,sandbox:t,onUpdated:r,onClose:a,onPrepare:l}){var B,q;const c=Bt(),u=Cn(),[f,m]=b.useState([]),[h,g]=b.useState(null),[p,x]=b.useState(t||""),[v,j]=b.useState([]),[S,N]=b.useState(null),[C,T]=b.useState(null),[k,A]=b.useState([]),[R,M]=b.useState(!1),[E,O]=b.useState("");b.useEffect(()=>{let I=!0;return c.overview().then(L=>{I&&(m(L.sandboxes),g({...L.gateway,target:u==null?void 0:u.target}))}).catch(L=>{I&&O(L.message)}),()=>{I=!1}},[c]),b.useEffect(()=>{let I=!1,L;const H=async()=>{try{const F=await c.setupJobs(e.id);if(I)return;A(F),F.some(V=>V.status==="waiting")&&(L=setTimeout(H,2e3))}catch{}};return H(),()=>{I=!0,clearTimeout(L)}},[e.id,C,c]);async function z(I){M(!0),O("");try{await I()}catch(L){O(L.message),N(null)}finally{M(!1)}}const _=e.items.filter(I=>{var L;return!I.disabled&&!I.issues.length&&!I.credentialRef&&((L=I.auth)==null?void 0:L.mode)==="agent-session"});return s.jsx(bn,{open:!0,onOpenChange:I=>{!I&&!R&&a()},children:s.jsxs(yn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-lg",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:e.name}),s.jsx($n,{className:"sr-only",children:"Manage the MCPs and Skills in this saved setup."})]}),s.jsx(D3,{items:e.items,children:I=>s.jsx("div",{className:"max-h-72 divide-y overflow-y-auto rounded-lg border",children:I.map(L=>{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:L.issues.length||((H=L.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(Jr,{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:L.name}),s.jsx("span",{className:`shrink-0 text-[10px] ${Na(L).length?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:Na(L).length?"Needs review":L.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:[L.issues.map(V=>s.jsx("p",{children:V},V)),((F=L.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:L.name})}),s.jsx(ue,{variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground hover:text-destructive",disabled:R,"aria-label":`Delete ${L.name} from setup`,title:L.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:()=>z(async()=>{const{egressPolicyError:V,...G}=await c.deleteSetupItem(e.id,L.id,e.revision);N(null),T(null),r(G),V&&O(`Removed. The setup’s egress policy wasn’t updated: ${V}`)}),children:s.jsx(Kn,{className:"size-3.5"})})]},L.id)})})}),s.jsx("div",{className:"flex items-center justify-between gap-3",children:s.jsxs(ue,{variant:"outline",size:"sm",onClick:l,disabled:R,children:[Jp(e)?"Resolve issues":"Prepare setup",s.jsx(Jr,{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(Jr,{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:R,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:I=>{x(I.target.value),N(null),T(null)},className:"w-full text-xs",children:[s.jsx("option",{value:"",children:"Choose a sandbox"}),f.map(I=>s.jsxs("option",{value:I.name,children:[I.name," · ",I.phase]},I.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:V6.map(I=>s.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[s.jsx($l,{disabled:!I.config,title:I.reason,checked:v.includes(I.id),onCheckedChange:L=>{j(H=>L?[...H,I.id]:H.filter(F=>F!==I.id)),N(null),T(null)}}),I.name,!I.config&&s.jsx("span",{className:"text-muted-foreground",children:" · Unavailable"})]},I.id))})]}),s.jsxs(ue,{variant:"outline",disabled:!p||!v.length||R,onClick:()=>z(async()=>{T(null),N(await c.previewSetup(e.id,p,v))}),children:[R&&s.jsx(Dt,{}),"Check requirements"]})]}),S&&s.jsxs("div",{className:"space-y-3",children:[S.problems.map(I=>s.jsx("p",{className:"text-xs text-amber-700",children:I},I)),S.network.map((I,L)=>{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:[I.item," · ",I.host,":",I.port,I.path||""]}),s.jsx("span",{children:I.status==="allowed"?"Existing access":I.status==="policy"?"Allowed by setup policy":I.status==="blocked"?"Blocked":I.status==="proposed"?"Requested access":"Needs review"})]}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:I.reason}),((H=I.binaries)==null?void 0:H.length)>0&&s.jsx("p",{className:"mt-1 break-all font-mono text-muted-foreground",children:I.binaries.join(", ")}),I.credentialProvider&&s.jsxs("p",{children:["Credential binding: ",I.credentialProvider]})]},L)}),(B=S.inactive)==null?void 0:B.map(I=>s.jsxs("p",{className:"text-xs text-muted-foreground",children:[I.name,": inactive · ",I.issues.join(" ")]},I.name)),S.notes.length>0&&s.jsx(M3,{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:R,onClick:()=>z(async()=>{T(await c.removeSetup(e.id,p,S.token)),N(null)}),children:"Remove from sandbox"}),s.jsxs(ue,{disabled:R||!S.canEnable,onClick:()=>z(async()=>{T(await c.enableSetup(e.id,p,S.token,S.requiresApproval)),N(null)}),children:[R&&s.jsx(Dt,{}),S.requiresApproval?"Approve access & enable":S.installed?"Check & reapply":"Enable & check"]})]})]}),C&&s.jsx("p",{role:"status",className:"rounded-lg border bg-muted/30 p-3 text-xs",children:C.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=C==null?void 0:C.checks)==null?void 0:q.map((I,L)=>s.jsxs("p",{className:"text-xs text-muted-foreground",children:[I.item,": ",I.status,I.toolCount!==void 0?` · ${I.toolCount} tools discovered`:"",I.reason?` · ${I.reason}`:""]},L)),((C==null?void 0:C.status)==="installed"||(S==null?void 0:S.installed)||k.some(I=>I.sandbox===p&&I.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(I=>I.name).join(", ")]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:v.map(I=>{var L,H;return s.jsxs("a",{className:"rounded-md border px-3 py-2 hover:bg-muted",href:Gp(p,((L=Iy(I))==null?void 0:L.command)||I,h),target:"_blank",rel:"noreferrer",children:["Open ",(H=Iy(I))==null?void 0:H.name]},I)})}),v.includes("codex")&&_.filter(I=>{var L;return(L=I.configuration)==null?void 0:L.endpoint}).map(I=>s.jsxs("a",{className:"block underline underline-offset-4",href:`${Gp(p,"codex",h)}&setupLogin=${e.id}&mcp=${encodeURIComponent(I.id)}`,target:"_blank",rel:"noreferrer",children:["Sign in to ",I.name," with Codex"]},I.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."})]})]}),k.filter(I=>!p||I.sandbox===p).map((I,L)=>s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[I.sandbox,": ",I.status,I.error?` · ${I.error}`:""]},L))]})]}),s.jsx(af,{children:E})]})})}function _3(e){const t=Cn();return s.jsx(fX,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}const NE=[];function fX({value:e=[],onChange:t,inherited:r=NE,accessReview:a,onAccessReview:l,automaticAccess:c=!1,autoPrepare:u=!1,preparationContext:f="sandbox",localCatalog:m,retained:h=NE}){const g=Bt(),[p,x]=b.useState([]),[v,j]=b.useState(""),[S,N]=b.useState(null),C=!!l;b.useEffect(()=>{let z=!0;return g.setups().then(_=>{z&&x(_.filter(B=>!(m!=null&&m.available)||!B.localSource||m.setups.includes(B.id)||r.includes(B.id)||h.includes(B.id)))}).catch(_=>{z&&j(_.message)}),()=>{z=!1}},[g,m,r,h]),b.useEffect(()=>{if(!C)return;let z=!0;return g.org().then(_=>{z&&N(_.policies??null)}).catch(()=>{z&&N(null)}),()=>{z=!1}},[C,g]);const T=p.filter(z=>e.includes(z.id)||r.includes(z.id)),k=z=>u?Kq(z):!z.disabled&&!z.issues.length,A=z=>u?z.items.filter(GM):[],R=z=>z.items.filter(_=>!k(_)),M=ZK(T,S,z=>z.items.filter(k),z=>u?Xq(z):z.requirements),E=T.some(z=>z.items.some(_=>{var B;return k(_)&&!_.credentialRef&&((B=_.auth)==null?void 0:B.mode)==="agent-session"})),O=JSON.stringify(T.map(z=>[z.id,z.revision]));return b.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(z=>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($l,{"aria-label":`Use ${z.name}`,disabled:r.includes(z.id)||!z.items.some(k),checked:e.includes(z.id)||r.includes(z.id),onCheckedChange:_=>t(_?[...e,z.id]:e.filter(B=>B!==z.id))}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"block truncate",children:[z.name,r.includes(z.id)?" · From image template":""]}),s.jsxs("span",{className:"mt-1 block text-[11px] text-muted-foreground",children:[Zp(z,"mcp")," MCPs · ",Zp(z,"skill")," Skills",A(z).length?` · ${A(z).length} install automatically`:"",R(z).length?` · ${R(z).length} inactive`:""]})]})]}),R(z).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:[R(z).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."})]})]})]},z.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(z=>s.jsx("li",{className:"break-all py-1",children:z},z))}),!c&&s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"flex items-start gap-2",children:[s.jsx($l,{checked:!!a,onCheckedChange:z=>l(z?Object.fromEntries(T.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:T.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(z=>s.jsx("li",{className:"break-all py-1",children:z},z))})]}),s.jsx(af,{children:v}),E&&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 mX(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 Tu(){var h;const e=_r(),t=!!(e!=null&&e.localViewer),r=t&&e.connected,a=`${t}:${r?(h=e.user)==null?void 0:h.uid:""}`,[l,c]=b.useState(null),[u,f]=b.useReducer(g=>g+1,0);b.useEffect(()=>{let g=!0,p;const x=new AbortController,v=Cr("local",x.signal);let j=null;const S=async()=>{var A,R;const N=await Promise.allSettled([v.inventory(),...r?[au("inventory",void 0,{signal:x.signal})]:[]]);if(!g)return;const C=[],T=[];for(let M=0;M<N.length;M++){const E=M===0?"local":"cloud",O=M!==0||!t,z=N[M];if(z.status==="fulfilled")C.push({target:E,cloud:O,inventory:z.value}),(A=z.value.machine)!=null&&A.error&&T.push(z.value.machine.error);else{T.push(`${O?"Cloud":"Local"} inventory unavailable: ${z.reason.message}`);const _=(R=j==null?void 0:j.filter(B=>B.target===E)[0])==null?void 0:R.inventory;if(_){const B=_.locations.map(q=>({...q,connected:!1,error:z.reason.message}));C.push({target:E,cloud:O,inventory:{..._,locations:B}})}}}j=C;const k=mX(C);c({scope:a,inventory:k,error:T.join("; ")||null}),p=setTimeout(S,k.templates.some(M=>M.status==="building")?1200:5e3)};return S(),()=>{g=!1,x.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}}const hX=e=>/failed to resolve .*image/i.test(e??"")&&/docker\.io/.test(e??""),pX=e=>{var t;return Array.isArray(e==null?void 0:e.sandboxes)&&!e.sandboxes.length&&!((t=e.stranded)!=null&&t.length)&&!e.conflict},CE=e=>(e??[]).map(t=>typeof t=="string"?t:`${t.workspace}/${t.name}`);function gX(e,{schedule:t=setTimeout,cancel:r=clearTimeout}={}){let a={status:null,asking:null,error:null},l=null,c=null;const u=new Set,f=x=>{a={...a,...x},u.forEach(v=>v())};function m(){var x;r(l),l=null,u.size&&(l=t(()=>{g()},((x=a.status)==null?void 0:x.state)==="working"?2e3:15e3))}function h(x){var S,N;if(!c||((S=x==null?void 0:x.job)==null?void 0:S.status)==="working")return;const{id:v,then:j}=c;c=null,((N=x==null?void 0:x.job)==null?void 0:N.id)===v&&x.job.status==="done"&&(j==null||j())}async function g(x=!1){try{const v=await e.gatewayDocker(x);return f({status:v}),h(v),v}catch{return a.status}finally{m()}}async function p(x,v,j,S=!0){var N;f({asking:a.asking&&{...a.asking,busy:!0},error:null});try{const C=await(x==="undo"?e.undoGatewayDocker(CE(v)):e.connectGatewayDocker(CE(v),S));return f({status:C,asking:null}),C.state==="working"&&C.job?c={id:C.job.id,then:j}:C.state!=="mismatch"&&(j==null||j()),C}catch(C){if(C.code==="GATEWAY_DOCKER_MISMATCH"&&!(x==="undo"&&C.fix==="manual")){const T=await g(!0);f({asking:{kind:C.fix==="manual"?"steps":x,then:j,sandboxes:x==="undo"?C.sandboxes??null:(T==null?void 0:T.sandboxes)??C.sandboxes??null,busy:!1}})}else f({error:C.message,asking:{...a.asking??{kind:x,then:j,sandboxes:((N=a.status)==null?void 0:N.sandboxes)??null},busy:!1}});return null}finally{m()}}return{subscribe(x){return u.add(x),u.size===1&&g(),()=>{u.delete(x),u.size||(r(l),l=null)}},getSnapshot:()=>a,refresh:g,connect:(x=(v=>(v=a.asking)==null?void 0:v.sandboxes)())=>{var j;return p("connect",x,(j=a.asking)==null?void 0:j.then)},undo:(x=(v=>(v=a.asking)==null?void 0:v.sandboxes)())=>{var j;return p("undo",x,(j=a.asking)==null?void 0:j.then)},ask({kind:x,then:v}={}){const j=a.status;if(x??(x=(j==null?void 0:j.fix)==="manual"?"steps":"connect"),x==="connect"&&((j==null?void 0:j.state)!=="mismatch"||pX(j)))return p("connect",[],v,(j==null?void 0:j.state)==="mismatch");f({asking:{kind:x,then:v,sandboxes:x==="connect"?(j==null?void 0:j.sandboxes)??null:null,busy:!1},error:null})},close:()=>f({asking:null,error:null})}}const ir=gX(Cr("local"));function xX(){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,x=>{var v;return{build:{...p,logs:p.logs??((v=x.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,code:p.code??null,fix:p.fix??null,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){var f;r.has(u)&&((f=e.find(m=>m.id===u))==null?void 0:f.status)==="failed"&&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 Qr=xX(),Tl="gateway-box",L3=["error","stopped","completed","deleting"],kE=(e,t)=>JSON.stringify([e==null?void 0:e.context,t]),TE=e=>e.status==="created"&&e.phase!=="ready"&&!L3.includes(e.phase);function bX({jobs:e}){const{sandboxes:t,loading:r}=Tu();return b.useEffect(()=>{if(r)return;const a=new Map(t.map(l=>[kE(l.location,l.name),l]));for(const l of e){const c=a.get(kE(l.location,l.name));c?(c.phase!==l.phase||!l.reported)&&Qr.update(l.id,{phase:c.phase,reported:!0,sandbox:c}):l.reported&&Qr.dismiss(l.id)}},[t,r,e]),null}function EE(e){try{sessionStorage.setItem(Tl,JSON.stringify({name:e.name,location:e.location}))}catch{}window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"sandboxes"}})),window.dispatchEvent(new Event(Tl))}function yX({job:e,onClose:t}){const r=b.useRef(null),a=b.useRef(!0),l=e.build;return b.useEffect(()=>{a.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[l==null?void 0:l.logs,e.message]),s.jsx(bn,{open:!0,onOpenChange:c=>{c||t()},children:s.jsxs(yn,{className:"flex h-[min(36rem,90svh)] flex-col gap-3 sm:max-w-2xl",children:[s.jsxs(jn,{children:[s.jsxs(vn,{children:["Build logs · ",e.name]}),s.jsx($n,{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 vX(){const e=b.useSyncExternalStore(Qr.subscribe,Qr.getSnapshot),[t,r]=b.useState(null),a=e.filter(c=>c.status==="created"),l=e.find(c=>c.id===t);return s.jsxs(s.Fragment,{children:[a.some(TE)&&s.jsx(bX,{jobs:a}),e.map(c=>{var p;const u=c.status==="created"&&c.phase==="ready",f=c.status==="created"&&L3.includes(c.phase),m=c.status==="preparing"||c.status==="creating"||TE(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:()=>Qr.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,c.code==="GATEWAY_DOCKER_MISMATCH"&&s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>ir.ask({kind:c.fix==="manual"?"steps":void 0,then:()=>Qr.retry(c.id)}),children:c.fix==="manual"?"Show steps":"Connect"}),s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>Qr.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:()=>EE(c),children:["Open sandbox",s.jsx(Mi,{className:"size-3"})]})}:f?{tone:"error",title:`${c.name} needs attention`,body:`Status: ${Qp[c.phase]}. Open the sandbox to inspect it.`,actions:s.jsxs(ue,{size:"xs",variant:"outline",onClick:()=>EE(c),children:["Open sandbox",s.jsx(Mi,{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(za,{id:`sandbox-creation:${c.id}`,tone:g.tone,title:g.title,actions:s.jsxs(s.Fragment,{children:[s.jsx(No,{location:c.location}),g.actions]}),onDismiss:m?void 0:()=>Qr.dismiss(c.id),dismissLabel:`Dismiss status for ${c.name}`,children:g.body},c.id)}),l&&s.jsx(yX,{job:l,onClose:()=>r(null)})]})}function Li({command:e,label:t}){const[r,a]=b.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(df,{className:"size-3.5"})})]})}const yy="openrod.gateway-docker.dismissed",RE="openrod.gateway-docker.shown",AE="openrod.gateway-docker.failed",vy=e=>{try{return localStorage.getItem(e)}catch{return null}},Ah=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},Ed=e=>{var t,r;return`${((t=e.build)==null?void 0:t.engineId)??""}|${((r=e.conflict)==null?void 0:r.dockerHost)??""}`},$3=()=>b.useSyncExternalStore(ir.subscribe,ir.getSnapshot),wX=e=>`${e.workspace}/${e.name}`;function OE({label:e,sandboxes:t,className:r=""}){return s.jsx("ul",{"aria-label":e,className:`max-h-48 overflow-auto rounded-md border border-border p-3 text-xs ${r}`,children:t.map(a=>s.jsxs("li",{className:"break-all py-1",children:[a.name,s.jsxs("span",{className:"text-muted-foreground",children:[" · ",a.workspace]})]},wX(a)))})}function jX({status:e,asking:t,error:r}){var h;const a=t.kind==="undo",{sandboxes:l,busy:c}=t,u=!a&&(e==null?void 0:e.conflict),f=a?[]:(e==null?void 0:e.stranded)??[],m=(h=e==null?void 0:e.steps)!=null&&h.file?s.jsx("span",{className:"font-mono",children:e.steps.file}):"OpenShell’s settings";return s.jsx(Rr,{open:!0,onOpenChange:g=>{!g&&!c&&ir.close()},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsx(Dr,{children:a?"Undo the Docker change?":"Connect OpenShell to Docker?"}),s.jsxs(zr,{children:[u&&s.jsxs("span",{className:"mb-2 block break-all font-mono text-[11px]",children:["OpenShell is set to use Docker at ",u.dockerHost,". OpenRod adds its own line after it."]}),a?s.jsxs(s.Fragment,{children:["OpenRod removes its line from ",m," and restarts OpenShell. Sandboxes from templates won’t start after that."]}):s.jsxs(s.Fragment,{children:["OpenRod will set DOCKER_HOST in ",m," and restart OpenShell."]})]})]}),l==null&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Running sandboxes restart too. Files in /sandbox are kept; open sessions end."}),(l==null?void 0:l.length)>0&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"These sandboxes restart. Files in /sandbox are kept; open sessions end."}),s.jsx(OE,{label:"Sandboxes that restart",sandboxes:l})]}),f.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs text-destructive",children:"These won’t start again: their images aren’t in this Docker."}),s.jsx(OE,{label:"Sandboxes that won’t start again",sandboxes:f,className:"text-destructive"})]}),!a&&(e==null?void 0:e.alternative)&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"To skip the restart, turn on “Allow the default Docker socket to be used” in Docker Desktop → Settings → Advanced."}),r&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:r}),s.jsxs(Mr,{children:[s.jsx(Ir,{disabled:c,children:"Cancel"}),s.jsx(Pr,{variant:f.length?"destructive":"default",disabled:c,onClick:()=>a?ir.undo():ir.connect(),children:c?"Restarting…":a?"Undo and restart":u?"Switch and restart":"Restart OpenShell"})]})]})})}function SX({status:e,asking:t}){const[r,a]=b.useState(!1),[l,c]=b.useState(!1),u=e==null?void 0:e.steps;async function f(){var h;a(!0);const m=await ir.refresh(!0);if(a(!1),(m==null?void 0:m.state)!=="ok")return c(!0);He.success("OpenShell can see Docker now"),ir.close(),(h=t.then)==null||h.call(t)}return s.jsx(bn,{open:!0,onOpenChange:m=>{m||ir.close()},children:s.jsxs(yn,{className:"sm:max-w-xl",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:"Connect OpenShell to Docker"}),s.jsx($n,{children:[(e==null?void 0:e.blocked)!=="Add one setting to OpenShell and restart it."&&(e==null?void 0:e.blocked),u&&"Add this line to OpenShell’s settings, then restart it. Running sandboxes restart too."].filter(Boolean).join(" ")})]}),u&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"break-all font-mono text-[11px]",children:u.file}),s.jsx(Li,{command:u.append,label:u.line}),u.restart?s.jsx(Li,{command:u.restart}):s.jsx("p",{className:"text-xs text-muted-foreground",children:"Then restart the OpenShell gateway the way you started it."})]}),(e==null?void 0:e.alternative)&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"No restart: in Docker Desktop, open Settings → Advanced and turn on “Allow the default Docker socket to be used”."}),l&&!r&&s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"OpenShell still can’t see your Docker images."}),s.jsx(ue,{variant:"outline",disabled:r,onClick:f,children:r?"Checking…":"Check again"})]})})}function NX(){const{status:e,asking:t,error:r}=$3(),[a,l]=b.useState(()=>vy(yy)),[c,u]=b.useState(()=>vy(AE)),[f,m]=b.useState(null),h=b.useRef(null),g=e==null?void 0:e.lastChange,p=e==null?void 0:e.job;b.useEffect(()=>{if(!g)return;const N=()=>{if(!(document.visibilityState!=="visible"||vy(RE)===g.id||Date.now()-Date.parse(g.at)>36e5)){if(document.removeEventListener("visibilitychange",N),Ah(RE,g.id),g.kind==="connect")return m(g.id);He.success("Undid the Docker change"),e.build&&(Ah(yy,Ed(e)),l(Ed(e)))}};return N(),document.addEventListener("visibilitychange",N),()=>document.removeEventListener("visibilitychange",N)},[g==null?void 0:g.id]),b.useEffect(()=>{if(!f)return;let N;const C=()=>{clearTimeout(N),document.visibilityState==="visible"&&(N=setTimeout(()=>m(null),15e3))};return C(),document.addEventListener("visibilitychange",C),()=>{clearTimeout(N),document.removeEventListener("visibilitychange",C)}},[f]),b.useEffect(()=>{(p==null?void 0:p.status)==="working"?h.current=p.id:p&&h.current===p.id&&(h.current=null,p.kind==="undo"&&p.status==="failed"&&He.error("Couldn’t undo the Docker change",{description:p.error}))},[p==null?void 0:p.id,p==null?void 0:p.status]);const x=()=>{Ah(yy,Ed(e)),l(Ed(e))},v=!!(e!=null&&e.build)&&a===Ed(e),j=(p==null?void 0:p.kind)==="undo"?"Undoing the Docker change…":"Connecting OpenShell to Docker…",S=(e==null?void 0:e.state)==="working"&&p?{tone:"progress",title:j,body:p.stage!==j&&p.stage}:["mismatch","unknown","no-docker"].includes(e==null?void 0:e.state)&&(p==null?void 0:p.kind)==="connect"&&p.status==="failed"&&c!==p.id?{tone:"error",title:"Couldn’t connect OpenShell to Docker",body:p.error,onDismiss:()=>{x(),Ah(AE,p.id),u(p.id)},actions:s.jsxs(s.Fragment,{children:[e.state==="mismatch"&&e.fix!=="manual"&&s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>ir.ask({kind:"connect"}),children:"Try again"}),e.steps&&s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>ir.ask({kind:"steps"}),children:"Show steps"})]})}:f&&(g==null?void 0:g.id)===f?{tone:"success",title:"Connected OpenShell to Docker",onDismiss:()=>m(null),body:g.auto?"OpenShell restarted so new sandboxes can use your Docker images.":"New sandboxes can use your Docker images.",actions:g.undoable&&s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>ir.ask({kind:"undo"}),children:"Undo"})}:(e==null?void 0:e.state)==="mismatch"&&e.fix!=="auto"&&!v?{tone:"warning",title:"OpenShell can’t see your Docker images",body:e.fix==="manual"?"Add one setting to OpenShell and restart it.":"Sandboxes from templates won’t start until it can.",actions:s.jsxs(s.Fragment,{children:[s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>ir.ask(),children:e.fix==="manual"?"Show steps":"Connect"}),s.jsx(ue,{size:"xs",variant:"ghost",onClick:x,children:"Not now"})]})}:null;return s.jsxs(s.Fragment,{children:[S&&s.jsx(za,{id:"gateway-docker",tone:S.tone,title:S.title,actions:S.actions||void 0,onDismiss:S.onDismiss,children:S.body}),t&&(t.kind==="steps"?s.jsx(SX,{status:e,asking:t}):s.jsx(jX,{status:e,asking:t,error:r}))]})}const Hv="mt-1 text-[11px] text-red-700";function CX(){const{status:e}=$3();return(e==null?void 0:e.state)==="mismatch"?s.jsxs("div",{className:`${Hv} flex flex-wrap items-center gap-2`,children:["OpenShell can’t see your Docker images.",s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>ir.ask(),children:e.fix==="manual"?"Show steps":"Connect"})]}):s.jsx("p",{className:Hv,children:(e==null?void 0:e.state)==="working"?"Connecting OpenShell to Docker…":(e==null?void 0:e.state)==="ok"?"OpenShell can see Docker now. Delete this sandbox and create it again.":"Start Docker, then delete this sandbox and create it again."})}function kX({local:e}){return e?s.jsx(CX,{}):s.jsx("p",{className:Hv,children:"Start Docker, then delete this sandbox and create it again."})}const B3=b.createContext(void 0);function TX(){return b.useContext(B3)}const EX=b.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:x=!0,style:v,...j}=t,S=fs(p||void 0),N=TX(),C=(N==null?void 0:N.value)??[],T=(c||(N==null?void 0:N.disabled))??!1,[k,A]=oo({controlled:N?S!==void 0&&C.indexOf(S)>-1:m,default:l,name:"Toggle",state:"pressed"}),{getButtonProps:R,buttonRef:M}=ao({disabled:T,native:x}),E={disabled:T,pressed:k},O=[M,r],z=[{"aria-pressed":k,onClick(q){var H;const I=!k,L=bt(Er,q.nativeEvent);f==null||f(I,L),!L.isCanceled&&(S&&((H=N==null?void 0:N.setGroupValue)==null||H.call(N,S,I,L)),!L.isCanceled&&A(I))}},j,R],_=jt("button",t,{enabled:!N,state:E,ref:O,props:z}),B=b.useMemo(()=>({disabled:T,focusableWhenDisabled:!1}),[T]);return N?s.jsx(r3,{tag:"button",render:h,className:a,style:v,metadata:B,state:E,refs:O,props:z}):_}),RX=b.createContext(void 0);function AX(){return b.useContext(RX)}const OX=b.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:x,...v}=t,j=Ug(),S=AX(),N=a??Tr,C=h!==void 0||a!==void 0,T=((j==null?void 0:j.disabled)??!1)||((S==null?void 0:S.disabled)??!1)||l,[k,A]=oo({controlled:h,default:N,name:"ToggleGroup",state:"value"}),R=et((_,B,q)=>{let I;m?(I=k.slice(),B?I.push(_):I.splice(k.indexOf(_),1)):I=B?[_]:[],u==null||u(I,q),!q.isCanceled&&A(I)}),M={disabled:T,multiple:m,orientation:f},E=b.useMemo(()=>({disabled:T,setGroupValue:R,value:k,isValueInitialized:C}),[T,R,k,C]),O={role:"group"},z=jt("div",t,{enabled:!!j,state:M,ref:r,props:[O,v]});return s.jsx(B3.Provider,{value:E,children:j?z:s.jsx(JO,{render:p,className:g,style:x,state:M,refs:[r],props:[O,v],loopFocus:c,enableHomeAndEndKeys:!0,orientation:f})})}),MX=cg("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"}}),V3=b.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function DX({className:e,variant:t,size:r,spacing:a=2,orientation:l="horizontal",children:c,...u}){return s.jsx(OX,{"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(V3.Provider,{value:{variant:t,size:r,spacing:a,orientation:l},children:c})})}function zX({className:e,children:t,variant:r="default",size:a="default",...l}){const c=b.useContext(V3);return s.jsx(EX,{"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",MX({variant:c.variant||r,size:c.size||a}),e),...l,children:t})}const ME=[{value:"light",label:"Light mode",icon:R6},{value:"dark",label:"Dark mode",icon:QI},{value:"system",label:"Auto · Follow computer",icon:XI}];function PX(){const{theme:e="system",setTheme:t}=TR(),r=Ls(),a=Math.max(0,ME.findIndex(l=>l.value===e));return s.jsx($f,{delay:200,children:s.jsxs(DX,{"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(u3,{duration:12,shineColor:["var(--border)","var(--frame-highlight)","var(--ink-faint)"]})}),ME.map(({value:l,label:c,icon:u})=>s.jsxs(Pa,{children:[s.jsx(Ia,{render:s.jsx(zX,{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(_a,{side:"top",children:c})]},l))]})})}const U3=b.createContext(void 0);function Bf(e){const t=b.useContext(U3);if(t===void 0&&!e)throw new Error(Jt(47));return t}const IX={...zg,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 _X extends vu{constructor(r,a,l){const c=new Cf;super(LX(r,c,a,l),$X(c),IX);tn(this,"setOpen",(r,a)=>{var p,x;const l=a.reason===Hn,c=a.reason===Zo&&a.event.detail===0,u=!r&&(a.reason===wf||a.reason==null),f=D1(a),m=this.select("activeTriggerId");if(!r&&a.reason===_A&&a.trigger==null&&m!=null&&(a.trigger=this.context.triggerElements.getById(m)??this.select("activeTriggerElement")??void 0),(x=(p=this.context).onOpenChange)==null||x.call(p,r,a),a.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(r,a);const h=()=>{const v=Rg(this.state,r,a.trigger,f());v.openChangeReason=a.reason,this.update(v)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(JA,()=>{this.set("stickIfOpen",!1)}),ro.flushSync(h)):h();let g;c?g="click":u?g="dismiss":a.reason===Pi&&(g="focus"),this.set("instantType",g)})}}function LX(e,t,r,a=!1){const l={...Dg(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 $X(e){return{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new so,triggerElements:e}}const DE=jf(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 x=p.useState("open"),v=p.useState("mounted"),j=p.useState("payload");p.useContextCallback("onOpenChange",c),p.useContextCallback("onOpenChangeComplete",u),vO(p,x),Ag(p);const{forceUnmount:S}=Og(x,p,()=>{p.update({stickIfOpen:!0,openChangeReason:null})});p.useSyncedValues({modal:f}),b.useEffect(()=>{x||p.context.stickIfOpenTimeout.clear()},[p,x]),b.useImperativeHandle(t.actionsRef,()=>({unmount:S,close:()=>p.setOpen(!1,bt(jg))}),[S,p]);const N=x||v;return s.jsxs(U3.Provider,{value:p,children:[m&&s.jsx(Eg,{handle:m,store:p}),N&&s.jsx(UX,{store:p,modal:f}),typeof r=="function"?r({payload:j}):r]})});function BX(e){return Bf(!0)?s.jsx(DE,{props:e}):s.jsx(cO,{children:s.jsx(DE,{props:e})})}function VX(e,t){const r=M1((a,l)=>new _X(t,a,l));return b.useEffect(()=>r.context.stickIfOpenTimeout.disposeEffect(),[r]),r}function UX({store:e,modal:t}){const r=e.useState("floatingRootContext"),a=Sf(r,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),l=a.reference,c=a.floating;return Mg(e,{activeTriggerProps:l,inactiveTriggerProps:l,popupProps:c}),null}const HX=300,FX=N1(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=HX,closeDelay:x=0,id:v,...j}=t,S=Bf(!0),C=I1(m)??S;if(!C)throw new Error(Jt(74));const T=fs(v),k=C.useState("isTriggerActive",T),A=C.useState("floatingRootContext"),R=C.useState("isOpenedByTrigger",T),M=C.useState("triggerPopupId",T),E=b.useRef(null),{registerTrigger:O,isMountedByThisTrigger:z}=z1(T,E,C,{payload:h,disabled:u,openOnHover:g,closeDelay:x}),_=C.useState("openChangeReason"),B=C.useState("stickIfOpen"),q=C.useState("openMethod"),I=C.useState("focusManagerModal"),L=B1(A,{enabled:!u&&g&&(q!=="touch"||_!==Zo),mouseOnly:!0,move:!1,handleClose:V1(),restMs:p,delay:{close:x},triggerElementRef:E,isActiveTrigger:k,isClosing:()=>C.select("transitionStatus")==="ending"}),H=R1(A,{stickIfOpen:B}),F=PO(()=>C.select("open"),te=>{C.set("openMethod",te)}),V=C.useState("triggerProps",z),{getButtonProps:G,buttonRef:X}=ao({disabled:u,native:f}),$={open(te){return te&&_===Zo?vp.open(te):h1.open(te)}},{preFocusGuardRef:Q,handlePreFocusGuardFocus:K,handleFocusTargetFocus:se}=a3(C,E),U=jt("button",t,{state:{disabled:u,open:R},ref:[X,r,O,E],props:[H.reference,L,V,F,{[eO]:"",id:T,"aria-haspopup":"dialog","aria-expanded":R,"aria-controls":M},j,G],stateAttributesMapping:$}),Z=s.jsx(b.Fragment,{children:U},T);return z&&!I?s.jsxs(b.Fragment,{children:[s.jsx(_i,{ref:Q,onFocus:K}),Z,s.jsx(_i,{ref:C.context.triggerFocusTargetRef,onFocus:se})]}):Z}),H3=b.createContext(void 0);function GX(){const e=b.useContext(H3);if(e===void 0)throw new Error(Jt(45));return e}const qX=b.forwardRef(function(t,r){const{keepMounted:a=!1,...l}=t;return Bf().useState("mounted")||a?s.jsx(H3.Provider,{value:a,children:s.jsx(Cg,{ref:r,...l})}):null}),F3=b.createContext(void 0);function YX(){const e=b.useContext(F3);if(!e)throw new Error(Jt(46));return e}const KX=b.forwardRef(function(t,r){const{render:a,className:l,style:c,anchor:u,positionMethod:f,side:m,align:h,sideOffset:g,alignOffset:p,collisionBoundary:x="clipping-ancestors",collisionPadding:v,arrowPadding:j,sticky:S,disableAnchorTracking:N=!1,collisionAvoidance:C=C1,...T}=t,k=Bf(),A=GX(),R=T1(),M=k.useState("floatingRootContext"),E=k.useState("mounted"),O=k.useState("open"),z=k.useState("openChangeReason"),_=k.useState("activeTriggerElement"),B=k.useState("modal"),q=k.useState("openMethod"),I=k.useState("positionerElement"),L=k.useState("instantType"),H=k.useState("transitionStatus"),F=k.useState("adaptiveOrigin"),V=b.useRef(null),G=yf(I),X=Lg({anchor:u,floatingRootContext:M,positionMethod:f,mounted:E,side:m,sideOffset:g,align:h,alignOffset:p,arrowPadding:j,collisionBoundary:x,collisionPadding:v,sticky:S,disableAnchorTracking:N,keepMounted:A,nodeId:R,collisionAvoidance:C,adaptiveOrigin:F}),$=M.useState("domReferenceElement");Ke(()=>{const U=$,Z=V.current;if(U&&(V.current=U),Z&&U&&U!==Z){k.set("instantType",void 0);const te=new AbortController;return G(()=>{k.set("instantType","trigger-change")},te.signal),()=>{te.abort()}}},[$,G,k]);const Q=B===!0&&z!==Hn;F1(O&&Q,q==="touch",I,_);const K=k.useStateSetter("positionerElement"),se={open:O,side:X.side,align:X.align,anchorHidden:X.anchorHidden,instant:L},P=Bg(t,se,{styles:X.positionerStyles,transitionStatus:H,props:T,refs:[r,K],hidden:!E,inert:!O});return s.jsxs(F3.Provider,{value:X,children:[E&&Q&&s.jsx($g,{inert:kf(!O),cutout:_}),s.jsx(lO,{id:R,children:P})]})}),XX=b.createContext(void 0);function WX(){const[e,t]=b.useState(0),r=et(()=>(t(l=>l+1),()=>{t(l=>Math.max(0,l-1))}));return{context:b.useMemo(()=>({register:r}),[r]),hasClosePart:e>0}}const QX=b.forwardRef(function(t,r){const{render:a,className:l,style:c,initialFocus:u,finalFocus:f,...m}=t,h=Bf(),g=YX(),p=Ug()!=null,{context:x,hasClosePart:v}=WX(),j=h.useState("open"),S=h.useState("openMethod"),N=h.useState("instantType"),C=h.useState("transitionStatus"),T=h.useState("popupProps"),k=h.useState("titleElementId"),A=h.useState("descriptionElementId"),R=h.useState("modal"),M=h.useState("mounted"),E=h.useState("openChangeReason"),O=h.useState("activeTriggerElement"),z=h.useState("floatingRootContext"),_=z.useState("floatingId"),B=h.useState("disabled"),q=h.useState("openOnHover"),I=h.useState("closeDelay");lr({open:j,ref:h.context.popupRef,onComplete(){var X,$;j&&(($=(X=h.context).onOpenChangeComplete)==null||$.call(X,!0))}}),$1(z,{enabled:q&&!B,closeDelay:I});const L=u===void 0?yO(h.context.popupRef):u,H=R!==!1&&v;h.useSyncedValue("focusManagerModal",H);const F=h.useStateSetter("popupElement"),V={open:j,side:g.side,align:g.align,instant:N,transitionStatus:C},G=jt("div",t,{state:V,ref:[r,h.context.popupRef,F],props:[T,{id:_,role:"dialog",...Nf,"aria-labelledby":k,"aria-describedby":A,onKeyDown(X){p&&Rf.has(X.key)&&X.stopPropagation()}},Ef(C),m],stateAttributesMapping:gg});return s.jsx(kg,{context:z,openInteractionType:S,modal:H,disabled:!M||E===Hn,initialFocus:L,returnFocus:f,restoreFocus:"popup",previousFocusableElement:cn(O)?O:void 0,nextFocusableElement:h.context.triggerFocusTargetRef,beforeContentFocusGuardRef:h.context.beforeContentFocusGuardRef,children:s.jsx(XX.Provider,{value:x,children:G})})});function up({...e}){return s.jsx(BX,{"data-slot":"popover",...e})}function dp({...e}){return s.jsx(FX,{"data-slot":"popover-trigger",...e})}function fp({className:e,align:t="center",alignOffset:r=0,side:a="bottom",sideOffset:l=4,...c}){return s.jsx(qX,{children:s.jsx(KX,{align:t,alignOffset:r,side:a,sideOffset:l,className:"isolate z-50",children:s.jsx(QX,{"data-slot":"popover-content",className:ms("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 G3(e){return jt(e.defaultTagName??"div",e,e)}const wy=768;function ZX(){const[e,t]=b.useState(void 0);return b.useEffect(()=>{const r=window.matchMedia(`(max-width: ${wy-1}px)`),a=()=>{t(window.innerWidth<wy)};return r.addEventListener("change",a),t(window.innerWidth<wy),()=>r.removeEventListener("change",a)},[]),!!e}const JX="sidebar_state",eW=3600*24*7,tW="16rem",nW="18rem",sW="3rem",rW="b",q3=b.createContext(null);function Xw(){const e=b.useContext(q3);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function oW({defaultOpen:e=!0,open:t,onOpenChange:r,className:a,style:l,children:c,...u}){const f=ZX(),[m,h]=b.useState(!1),[g,p]=b.useState(e),x=t??g,v=b.useCallback(C=>{const T=typeof C=="function"?C(x):C;r?r(T):p(T),document.cookie=`${JX}=${T}; path=/; max-age=${eW}`},[r,x]),j=b.useCallback(()=>f?h(C=>!C):v(C=>!C),[f,v,h]);b.useEffect(()=>{const C=T=>{T.key===rW&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),j())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[j]);const S=x?"expanded":"collapsed",N=b.useMemo(()=>({state:S,open:x,setOpen:v,isMobile:f,openMobile:m,setOpenMobile:h,toggleSidebar:j}),[S,x,v,f,m,h,j]);return s.jsx(q3.Provider,{value:N,children:s.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":tW,"--sidebar-width-icon":sW,...l},className:Le("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...u,children:c})})}function aW({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}=Xw();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(Gl,{open:h,onOpenChange:g,...u,children:s.jsxs(du,{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":nW},side:e,children:[s.jsxs(fu,{className:"sr-only",children:[s.jsx(mu,{children:"Sidebar"}),s.jsx(hu,{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 iW({className:e,onClick:t,...r}){const{toggleSidebar:a}=Xw();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(n6,{}),s.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function lW({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 cW({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 uW({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 dW({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 zE({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 PE({className:e,render:t,...r}){return G3({defaultTagName:"div",props:Ks({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 IE({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 _E({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 LE({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 fW=cg("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 $E({render:e,isActive:t=!1,variant:r="default",size:a="default",tooltip:l,className:c,...u}){const{isMobile:f,state:m}=Xw(),h=G3({defaultTagName:"button",props:Ks({className:Le(fW({variant:r,size:a}),c)},u),render:l?s.jsx(Ia,{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(Pa,{children:[h,s.jsx(_a,{side:"right",align:"center",hidden:m!=="collapsed"||f,...l})]})):h}const mW=[{label:"Sandboxes",icon:Xl,view:"sandboxes"},{label:"Templates",icon:UI,view:"templates"},{label:"MCPs & Skills",icon:Qv,view:"setups"},{label:"Activity",icon:UP,view:"activity"},{label:"Connections",icon:sI,view:"connections"}],hW=[{label:"Groups",icon:Ra,view:"groups"},{label:"Network",icon:rg,view:"egress",also:["ingress"]},{label:"Secrets",icon:gu,view:"secrets"}],BE={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 pW({view:e,onNavigate:t}){const{connection:r,overview:a}=Ga(),l=BE[r]??BE.connecting,c=a==null?void 0:a.gateway;return s.jsxs(aW,{collapsible:"offcanvas",className:"border-r border-sidebar-border",children:[s.jsx(cW,{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(dW,{className:"px-3 pt-4",children:[s.jsxs(zE,{className:"p-0",children:[s.jsx(PE,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Environment"}),s.jsx(IE,{children:s.jsx(_E,{children:mW.map(({label:u,icon:f,view:m})=>s.jsx(LE,{children:s.jsxs($E,{isActive:e===m,onClick:()=>t(m),children:[s.jsx(f,{}),u]})},m))})})]}),s.jsxs(zE,{className:"p-0 pt-4",children:[s.jsx(PE,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Security"}),s.jsx(IE,{children:s.jsx(_E,{children:hW.map(({label:u,icon:f,view:m,also:h=[]})=>s.jsx(LE,{children:s.jsxs($E,{isActive:e===m||h.includes(e),onClick:()=>t(h.includes(e)?e:m),children:[s.jsx(f,{}),u]})},m))})})]})]}),s.jsxs(uW,{className:"border-t border-sidebar-border p-4",children:[s.jsx(PX,{}),s.jsxs(up,{children:[s.jsxs(dp,{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(fp,{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(gW,{})]})]})]})]})}function gW(){const[e,t]=b.useState(null),[r,a]=b.useState(!1),[l,c]=b.useState(null);if(b.useEffect(()=>{let f=!0;return ls.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 ls.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(mf,{"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 Yl={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"}},mp=e=>{var t;return((t=Yl[e==null?void 0:e.placement])==null?void 0:t.id)??(e!=null&&e.remote?"remote":"local")},jy=({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`})]}),xW={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(jy,{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(jy,{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(jy,{x:7.6,y:9.6})]})},bW={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 yW({type:e,className:t="size-3.5"}){const r=xW[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 Y3({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 ${bW[e]}`,children:[s.jsx(yW,{type:e}),Yl[e].label]})}function K3({location:e}){const t=mp(e);return s.jsx(Y3,{type:t,title:`${Yl[t].hint} · ${Is(e)}`})}const vW=864e5;function wW(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*vW;for(;u<a.length&&a[u]<=m;)u++;c.push({at:m,count:u+l})}return c}const jW=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"});function SW({points:e,height:t=34,title:r}){const a=b.useRef(null),l=b.useId(),c=Ls(),[u,f]=b.useState(280),[m,h]=b.useState(null);b.useLayoutEffect(()=>{const A=a.current;if(!A)return;const R=()=>f(A.clientWidth);R();const M=new ResizeObserver(R);return M.observe(A),()=>M.disconnect()},[]);const g=Math.max(4,Math.round(t*.18)),p=e.map(A=>A.count),x=Math.max(1,...p),v=A=>(e.length<2?u-12:A/(e.length-1)*(u-12))+6,j=A=>t-g-A/x*(t-g*2),S=KM(p.map((A,R)=>[v(R),j(A)])),N=`${S} L${v(e.length-1).toFixed(2)} ${t} L${v(0).toFixed(2)} ${t} Z`,C=m===null?null:e[m],T=p[0]??0,k=p[p.length-1]??0;return s.jsxs("div",{className:"relative w-full",onMouseLeave:()=>h(null),onMouseMove:A=>{const R=A.currentTarget.getBoundingClientRect(),M=(A.clientX-R.left)/Math.max(1,R.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:C?s.jsxs("span",{className:"font-mono normal-case tracking-normal text-muted-foreground",children:[jW(C.at)," · ",C.count.toLocaleString("en-US")," ",C.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":`${T} boxes ${e.length} days ago, ${k} 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:N,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"}}),C&&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 NW=e=>e?new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"",CW={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},kW=e=>e?CW[e]??e:null;function TW({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:NW(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?kW(e.reason):(l=e.policy)==null?void 0:l.replace(/^_provider_/,"provider · ")})]})}function X3(e=[],t){const r=Pw(t);return e.filter(a=>!a.appliesTo.everyone&&a.appliesTo.groups.some(l=>r.includes(l)))}function Ww(){const[e,t]=b.useState(null),[r,a]=b.useState(""),l=b.useRef(null),c=b.useRef(!0),u=b.useCallback((g,p,x=!0)=>{const v=l.current;v&&(l.current=null,v.cleanup(),x&&t(null),p?v.reject(p):v.resolve(g))},[]),f=b.useCallback(()=>u(void 0,new DOMException("Workspace transfer cancelled.","AbortError")),[u]);b.useEffect(()=>(c.current=!0,()=>{c.current=!1,u(void 0,new DOMException("Workspace transfer cancelled.","AbortError"),!1)}),[u]);const m=b.useCallback(async(g,p,x)=>{x==null||x.throwIfAborted();const v=await g.org();if(!c.current)throw new DOMException("Workspace transfer cancelled.","AbortError");x==null||x.throwIfAborted();const j=(v.groups??[]).filter(S=>X3(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,N)=>{const C=()=>u(void 0,new DOMException("Workspace transfer cancelled.","AbortError"));l.current={resolve:S,reject:N,cleanup:()=>x==null?void 0:x.removeEventListener("abort",C)},x==null||x.addEventListener("abort",C,{once:!0}),x!=null&&x.aborted&&C()})}},[u]),h=s.jsx(bn,{open:!!e,onOpenChange:g=>{g||f()},children:s.jsxs(yn,{className:"sm:max-w-md",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:"Choose a destination group"}),s.jsxs($n,{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(Co,{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 eg="http://127.0.0.1:4600",EW=e=>`${eg}/?handoff=cloud&target=local#cloud-return=${encodeURIComponent(e)}`;function VE(e,t,r,a){var l;return!!(t&&e.source===t&&e.origin===eg&&((l=e.data)==null?void 0:l.type)===a&&e.data.nonce===r)}function RW({children:e,className:t,variant:r="outline",size:a="sm"}){return s.jsx($f,{delay:200,children:s.jsxs(Pa,{children:[s.jsxs(Ia,{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:[" ",Ml]})]}),s.jsx(_a,{side:"bottom",className:"max-w-60",children:Ml})]})})}function AW({name:e,sandbox:t}){const r=Bt(),a=_r(),l=Cn(),{locations:c,refresh:u}=Tu(),{chooseGroups:f,dialog:m}=Ww(),h=b.useRef(null);b.useEffect(()=>()=>{var j;return(j=h.current)==null?void 0:j.abort()},[]);const[g,p]=b.useState(null),x=b.useRef(null);if(b.useEffect(()=>{let j=!0;const S=async C=>{const T=x.current;if(T){if(VE(C,T.popup,T.nonce,"openrod-local-result")&&T.accepted){if(j){if(typeof C.data.error=="string")He.error("Couldn’t continue locally",{description:C.data.error});else if(typeof C.data.name=="string")He.success("Workspace ready locally",{description:C.data.warning||T.warning||"Reconnect your agent credentials locally to continue."});else return;p(null)}x.current=null;return}if(!(T.accepted||!VE(C,T.popup,T.nonce,"openrod-local-ready"))){T.accepted=!0,p("transfer");try{const k=await r.cloudExport(T.name);T.warning=k.warning,T.popup.postMessage({type:"openrod-local-bundle",nonce:T.nonce,bundle:k.bundle,warning:k.warning},eg)}catch(k){T.popup.postMessage({type:"openrod-local-bundle",nonce:T.nonce,error:k.message},eg),x.current===T&&(x.current=null),j&&(p(null),He.error("Couldn’t continue locally",{description:k.message}))}}}};window.addEventListener("message",S);const N=setInterval(()=>{const C=x.current;C&&(C.popup.closed||Date.now()>C.expires)&&(x.current=null,p(null),C.popup.closed||He.error("Local transfer timed out. Try again."))},1e3);return()=>{j=!1,window.removeEventListener("message",S),clearInterval(N),x.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(C=>C.target!=="cloud"&&!C.remote&&C.connected);if(!j){He.error("Connect a local gateway before importing this workspace.");return}const S=new AbortController;h.current=S;const N=r.signal?AbortSignal.any([r.signal,S.signal]):S.signal;p("transfer");try{const C=Cr("local",N,j.context);p("groups");const T=await f(C,"local OpenRod",N);p("transfer");const k=await RP(Cr(r.target,N,l==null?void 0:l.context),C,e,T);N.throwIfAborted(),He.success("Workspace running locally",{description:k.warning||"Your cloud source is unchanged. Reconnect agent credentials locally."});try{sessionStorage.setItem("gateway-box",JSON.stringify({name:k.name,context:j.context,target:"local"}))}catch{}u(),a.selectTarget("local"),window.dispatchEvent(new CustomEvent("openrod-sandbox-handoff",{detail:{name:k.name,context:j.context,target:"local"}}))}catch(C){C.name!=="AbortError"&&He.error("Couldn’t import locally",{description:C.message})}finally{S.signal.aborted||p(null),h.current===S&&(h.current=null)}}return a!=null&&a.localViewer&&!Go?s.jsxs(RW,{className:"w-full justify-start text-xs",children:[s.jsx(gp,{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(EW(j),"_blank");if(!S){He.error("Allow popups to continue locally.");return}x.current={popup:S,nonce:j,name:e,accepted:!1,expires:Date.now()+40*6e4},p("connect")},children:[g?s.jsx(Dt,{className:"size-3.5"}):s.jsx(gp,{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(Pa,{children:[s.jsx(Ia,{render:s.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"What this does",className:"text-muted-foreground"}),children:s.jsx(ff,{className:"size-3.5","aria-hidden":"true"})}),s.jsxs(_a,{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 wa="/sandbox",UE=1024**3;function sr(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 pu(e){return/^[\w@%+=:,./~-]+$/.test(e)?e:`'${e.replaceAll("'","'\\''")}'`}const W3=e=>e.startsWith("~/")?`~/${pu(e.slice(2))}`:pu(e),Fv=(e,t,r=wa)=>`openshell sandbox upload ${pu(e)} ${W3(t)} ${pu(r)}`,OW=(e,t,r=".")=>`openshell sandbox download ${pu(e)} ${pu(t)} ${W3(r)}`,hp=new Set(["waiting","uploading","cloning"]),MW=(e,t)=>e==="/"?`/${t}`:`${e}/${t}`,Oh=e=>e.type==="dir"||e.targetType==="dir";function DW(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 zW(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 PW({seed:e,onRetry:t}){if(!e)return null;const r=e.kind==="folder"?"Uploading":"Cloning";return hp.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(Dt,{"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(Ba,{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(OI,{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, ",sr(e.bytes)]}),s.jsxs("span",{children:["→ ",s.jsx("span",{className:"font-mono",children:e.dest})]})]})}function IW(e){const t=Cn();return s.jsx(_W,{...e},`${(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default"}:${e.sandbox.name}`)}function _W({sandbox:e,demo:t}){const r=Bt(),a=Cn(),l=e.name,c=e.phase==="ready",u=iq(e),[f,m]=b.useState(u?`${wa}/${u}`:wa),[h,g]=b.useState(null),[p,x]=b.useState(null),[v,j]=b.useState(!1),[S,N]=b.useState(null),[C,T]=b.useState(!1),[k,A]=b.useState(null),[R,M]=b.useState(null),[E,O]=b.useState(null),z=b.useRef(null),_=b.useCallback(async $=>{j(!0);try{const Q=await r.files(l,$);g(Q),x(null),Q.path!==$&&m(Q.path)}catch(Q){if($!==wa&&/does not exist/.test(Q.message)){m(wa);return}x(Q.message)}finally{j(!1)}},[l,r]);b.useEffect(()=>{c&&!t&&_(f)},[f,c,t,_]);const B=S==null?void 0:S.state;b.useEffect(()=>{if(t)return;let $=!1,Q;const K=async()=>{try{const se=await r.seed(l);if($)return;N(se),se&&hp.has(se.state)&&(Q=setTimeout(K,2e3))}catch{}};return(!S||hp.has(B))&&K(),()=>{$=!0,clearTimeout(Q)}},[l,t,B,r]);const q=b.useRef(null);b.useEffect(()=>{if(hp.has(q.current)&&B==="done"&&c){const $=u?`${wa}/${u}`:f;$!==f?m($):_(f)}q.current=B},[B]);async function I(){try{N(await r.retrySeed(l))}catch($){He.error($.message)}}async function L($,Q){O($);const K=He.loading(`Preparing ${Q}…`);try{const{token:se,filename:P,bytes:U}=await r.prepareDownload(l,$),Z=document.createElement("a");Z.href=r.url(`/downloads/${se}`,{context:await r.contextKey(),...a?{location:"1"}:{}}),Z.download=P,document.body.append(Z),Z.click(),Z.remove(),He.success(`Downloading ${P}`,{id:K,description:sr(U)})}catch(se){He.error(se.message,{id:K})}finally{O(null)}}function H($){if(!$.length){He.error("Nothing to upload. Empty folders are skipped.");return}const Q=$.reduce((U,Z)=>U+Z.file.size,0);if(Q>UE){He.error(`That is ${sr(Q)}; the console uploads up to ${sr(UE)}.`,{description:`From a terminal: ${Fv(l,"./my-files",f)}`});return}if(h&&Q>h.free){He.error(`The sandbox has ${sr(h.free)} free; this is ${sr(Q)}.`);return}const se=[...new Set($.map(U=>U.path.split("/")[0]))].filter(U=>h==null?void 0:h.entries.some(Z=>Z.name===U)),P={files:$,bytes:Q,dir:f,taken:se};se.length?M(P):F(P)}async function F({files:$,bytes:Q,dir:K}){M(null);const se=new AbortController;let P;A({done:0,total:$.length,sent:0,bytes:Q,committing:!1,controller:se});try{({id:P}=await r.startUpload(l));let U=0;await Promise.all(Array.from({length:Math.min(4,$.length)},async()=>{for(;U<$.length&&!se.signal.aborted;){const te=$[U++];try{await r.uploadFile(l,P,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 Z=await r.commitUpload(l,P,K);He.success(`Uploaded ${Z.files.toLocaleString()} ${Z.files===1?"file":"files"} to ${Z.dest}`,{description:sr(Z.bytes)}),K===f&&_(f)}catch(U){P&&r.cancelUpload(l,P).catch(()=>{}),He.error(se.signal.aborted&&U.name==="AbortError"?"Upload cancelled.":U.message)}finally{A(null)}}async function V($){if($.preventDefault(),T(!1),!c||k)return;const Q=DW($.dataTransfer);try{H(await zW(Q))}catch(K){He.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(($,Q,K)=>({label:$,path:`/${K.slice(0,Q+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:$=>{c&&!k&&Array.from($.dataTransfer.types).includes("Files")&&($.preventDefault(),T(!0))},onDragLeave:$=>{$.currentTarget.contains($.relatedTarget)||T(!1)},onDrop:V,children:[s.jsx(PW,{seed:S,onRetry:I}),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(($,Q)=>s.jsxs(b.Fragment,{children:[Q>0&&s.jsx(Jr,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":"true"}),Q===G.length-1?s.jsx("span",{className:"truncate px-1 text-foreground","aria-current":"page",children:$.label}):s.jsx("button",{type:"button",onClick:()=>m($.path),className:"truncate rounded px-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:$.label})]},$.path))}),h&&s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[sr(h.free)," free"]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh",disabled:!c||v,onClick:()=>_(f),children:s.jsx($a,{className:v?"animate-spin":void 0,"aria-hidden":"true"})}),s.jsxs(ue,{variant:"outline",size:"sm",disabled:!c||!!E,onClick:()=>L(f,`${f.split("/").pop()}.tar.gz`),children:[E===f?s.jsx(Dt,{"aria-hidden":"true"}):s.jsx(Wc,{"aria-hidden":"true"}),"Download folder"]}),s.jsxs(ue,{variant:"outline",size:"sm",disabled:!c||!!k,onClick:()=>{var $;return($=z.current)==null?void 0:$.click()},children:[s.jsx(P6,{"aria-hidden":"true"}),"Upload"]}),s.jsx("input",{ref:z,type:"file",multiple:!0,hidden:!0,onChange:$=>{const Q=[...$.target.files].map(K=>({path:K.name,file:K}));$.target.value="",H(Q)}})]}),k&&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(Dt,{"aria-hidden":"true"}),s.jsx("span",{className:"flex-1",children:k.committing?`Sending ${k.total.toLocaleString()} ${k.total===1?"file":"files"} to ${f}…`:`Reading ${k.done.toLocaleString()} of ${k.total.toLocaleString()} files · ${sr(k.sent)} of ${sr(k.bytes)}`}),!k.committing&&s.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>k.controller.abort(),children:[s.jsx(Dn,{"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!==wa&&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(dC,{className:"size-3.5","aria-hidden":"true"}),".."]})}),X.map($=>{const Q=MW(f,$.name),K=$.type==="link"?FR:Oh($)?dC:RI,se=s.jsxs(s.Fragment,{children:[s.jsx(K,{className:`size-3.5 shrink-0 ${Oh($)?"text-sky-600":"text-muted-foreground"}`,"aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:$.name}),$.target&&s.jsxs("span",{className:"truncate text-muted-foreground",children:["→ ",$.target]})]});return s.jsxs("li",{className:"group flex items-center gap-3 px-5 py-1 hover:bg-muted/50",children:[Oh($)?s.jsx("button",{type:"button",onClick:()=>m(Q),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:$.size!=null?sr($.size):""}),s.jsx("span",{className:"hidden w-16 shrink-0 text-right text-[11px] text-muted-foreground sm:block",title:$.modifiedAt,children:yu($.modifiedAt)}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":`Download ${$.name}`,className:"opacity-60 group-hover:opacity-100",disabled:!!E||$.targetType==="missing",onClick:()=>L(Q,Oh($)?`${$.name}.tar.gz`:$.name),children:E===Q?s.jsx(Dt,{"aria-hidden":"true"}):s.jsx(Wc,{"aria-hidden":"true"})})]},$.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(Li,{command:Fv(l,"./my-files",f)}),s.jsx(Li,{command:OW(l,f,".")})]})]}),C&&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(Rr,{open:!!R,onOpenChange:$=>{$||M(null)},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:["Replace ",(R==null?void 0:R.taken.length)===1?`“${R.taken[0]}”`:`${R==null?void 0:R.taken.length} items`,"?"]}),s.jsxs(zr,{children:[(R==null?void 0:R.taken.length)>1&&s.jsxs("span",{className:"mb-2 block font-mono text-[11px]",children:[R.taken.slice(0,6).join(", "),R.taken.length>6?", …":""]}),"Files with the same name in ",R==null?void 0:R.dir," are replaced. Folders are merged: matching files inside are replaced, and nothing is deleted."]})]}),s.jsxs(Mr,{children:[s.jsx(Ir,{children:"Cancel"}),s.jsx(Pr,{onClick:()=>F(R),children:"Replace"})]})]})})]})}function pp({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(LR,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground",strokeWidth:1.5}),s.jsx("span",{className:"truncate",children:e.name})]})}function HE({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(pp,{agent:r},r.name))}):s.jsx("span",{className:"text-muted-foreground",children:t})}function El({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 LW(){const e=Bt(),t=_r(),r=!!(t!=null&&t.nativeActions),[a,l]=b.useState([]);return b.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 $W({name:e,editors:t,cloud:r,context:a,cursorAgent:l=!1}){var z;const c=Bt(),[u,f]=b.useState(null),[m,h]=b.useState(null),[g,p]=b.useState("ssh"),[x,v]=b.useState(!1),[j,S]=b.useState(!1),[N,C]=b.useState(null);b.useEffect(()=>{if(r)return;let _=!1;return f(null),h(null),p("ssh"),C(null),c.sshConnection(e).then(B=>{_||(f(B),p(B.defaultMode))}).catch(B=>{_||h(B.message)}),()=>{_=!0}},[e,r,c]);const T=(u==null?void 0:u.modes[g])??(u==null?void 0:u.modes.ssh),k=g==="ssh"?"Open SSH in terminal":g==="attach"?"Attach canonical TTY":`New ${((z=BM(T==null?void 0:T.session))==null?void 0:z.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 R(_){v(!0);try{await c.openEditor(e,_.id),He.success(`Opening ${e} in ${_.label}`)}catch(B){He.error(`Couldn’t open ${_.label}`,{description:B.message})}finally{v(!1)}}async function M(){v(!0);try{await c.openSshTerminal(e,g),He.success(g==="ssh"?`Opening SSH to ${e}`:g==="attach"?`Attaching to ${e}`:`Starting a new session in ${e}`)}catch(_){He.error("Couldn’t open SSH terminal",{description:_.message})}finally{v(!1)}}async function E(){S(!0);try{C(await c.sshConfig(e))}catch(_){He.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)?Gp(e,void 0,a):void 0,target:"_blank",rel:"noreferrer"}),children:[s.jsx(Wv,{className:"size-3.5"}),"Browser"]});return r?s.jsx(El,{title:"Open in",children:s.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:O})}):s.jsxs(s.Fragment,{children:[s.jsxs(El,{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)||x,title:A??k,onClick:M,children:[x?s.jsx(Dt,{className:"size-3.5"}):s.jsx(YR,{className:"size-3.5"}),"Terminal"]}),[...l?[{id:"cursor",label:"Cursor"}]:[],{id:"vscode",label:"VS Code"}].map(_=>{const B=t.some(q=>q.id===_.id);return s.jsxs(ue,{variant:"outline",size:"sm",className:"justify-start text-xs",disabled:!B||x,title:B?"Connects over SSH through OpenShell. The first time, OpenShell adds one Include line to ~/.ssh/config.":`${_.label} is not installed.`,onClick:()=>R(_),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(Jr,{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."}),T&&s.jsx(Li,{command:T.command,label:g==="ssh"?`ssh ${T.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:E,children:[j?s.jsx(Dt,{className:"size-3.5"}):s.jsx(j6,{className:"size-3.5"}),"SSH configuration"]})]})]})]}),s.jsx(bn,{open:!!N,onOpenChange:_=>{_||C(null)},children:s.jsxs(yn,{className:"sm:max-w-2xl",children:[s.jsxs(jn,{children:[s.jsxs(vn,{children:["SSH configuration for ",e]}),s.jsx($n,{children:"The console does not change ~/.ssh/config. Review and add this Host block yourself, then connect with the command below."})]}),N&&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:N.config}),s.jsx(Li,{command:N.command}),s.jsx(ue,{variant:"outline",onClick:async()=>{try{await navigator.clipboard.writeText(N.config),He.success("SSH config copied")}catch{He.error("Couldn’t copy SSH config")}},children:"Copy Host block"})]})]})})]})}const BW={"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 UW(e){var r;const t=Cn();return t&&!((r=e.liveData)!=null&&r.demo)?s.jsx(Gw,{children:s.jsx(FE,{...e,scoped:!0},e.name)},t.id??t.context):s.jsx(FE,{...e},e.name)}function FE({name:e,sandbox:t,onClose:r,onNavigate:a,onChanged:l,liveData:c,scoped:u}){var P,U,Z,te,le,de,oe;const f=Bt(),m=Cn(),h=Ga(),g=u?h:c??h,p=ne=>a(ne,m),[x,v]=b.useState(15),[j,S]=b.useState(Date.now);b.useEffect(()=>{const ne=setInterval(()=>S(Date.now()),3e4);return()=>clearInterval(ne)},[]);const[N,C]=b.useState(null),[T,k]=b.useState(null),[A,R]=b.useState(null),[M,E]=b.useState(!1),O=_r(),z=!!(O!=null&&O.nativeActions),_=!!(m!=null&&m.cloud||((m==null?void 0:m.target)??(O==null?void 0:O.target))==="cloud"),B=LW(),q=((P=g.sandboxes)==null?void 0:P.find(ne=>ne.name===e))??t,I=q?`${q.phase}|${q.policyVersion}`:null;b.useEffect(()=>{if(!e||(m==null?void 0:m.connected)===!1){C(null),k((m==null?void 0:m.error)??null);return}if(C(null),k(null),g.demo)return;let ne=!1,ee,W=3e4;const ce=async()=>{var Re;try{const _e=await f.sandbox(e);ne||(C(_e),k(null),W=(Re=_e.setupJobs)!=null&&Re.some(Ne=>Ne.status==="waiting")?2e3:3e4)}catch(_e){ne||k(_e.message)}ne||(ee=setTimeout(ce,W))};return ce(),()=>{ne=!0,clearTimeout(ee)}},[e,I,g.demo,f,m==null?void 0:m.connected,m==null?void 0:m.error]);const L=(N==null?void 0:N.name)===e?N:q,H=b.useMemo(()=>g.events.filter(ne=>ne.sandbox===e&&ne.kind==="audit"&&ne.verdict).slice(0,14),[g.events,e]);async function F(ne){var ee;if((m==null?void 0:m.connected)!==!1){R(ne);try{await f.lifecycle(e,ne),He.success(ne==="delete"?`Deleting ${e}`:ne==="stop"?`Stopping ${e}`:`Starting ${e}`),l==null||l(),(ee=g.refresh)==null||ee.call(g),ne==="delete"&&r()}catch(W){He.error(W.message)}finally{R(null),E(!1)}}}const V=b.useMemo(()=>g.events.filter(ne=>ne.sandbox===e),[g.events,e]),G=b.useMemo(()=>XM(V,x,j),[V,x,j]),X=b.useMemo(()=>{var ee;const ne=new Map;for(const W of((ee=N==null?void 0:N.policy)==null?void 0:ee.rules)??[])for(const ce of W.endpoints)!ce.blocked&&!ne.has(ce.host)&&ne.set(ce.host,{host:ce.host,source:Ea(W.key)});return[...ne.values()]},[N]),$=b.useMemo(()=>{const ne=new Map;for(const ee of V){if(ee.kind!=="audit"||ee.verdict!=="denied")continue;const W=Hw(ee.destination);if(!W)continue;const ce=ne.get(W)??{host:W,count:0};ce.count+=1,ne.set(W,ce)}return[...ne.values()].sort((ee,W)=>W.count-ee.count)},[V]),Q=$M(L),K=L==null?void 0:L.phase,se=((U=N==null?void 0:N.policy)==null?void 0:U.rules)??[];return s.jsxs(s.Fragment,{children:[s.jsx(bn,{open:!!e,onOpenChange:ne=>{ne||r()},children:s.jsxs(yn,{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(jn,{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(vn,{className:"flex min-w-0 items-center gap-2 text-base",children:[s.jsx(Xl,{"aria-hidden":"true",strokeWidth:1.5,className:"size-4 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate",children:e}),s.jsx(No,{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 ${La(K).cell}`}),Qp[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:N!=null&&N.policy?X.length:"-"}),"allowed hosts"]}),s.jsxs("span",{children:[s.jsx("strong",{className:"mr-1 font-sans font-medium text-foreground",children:$.length}),"blocked hosts"]})]})]}),s.jsx($n,{className:"sr-only",children:"Sandbox access graph, details, rules, files, and connection activity."})]}),T&&s.jsx("p",{role:"alert",className:"shrink-0 border-b px-5 py-2 text-xs text-destructive",children:T}),L?s.jsxs(Af,{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(Of,{variant:"line","aria-label":"Sandbox information",className:"max-w-full",children:[s.jsx(jr,{value:"overview",className:"px-3 text-xs",children:"Overview"}),s.jsxs(jr,{value:"rules",className:"px-3 text-xs",children:["Rules",(N==null?void 0:N.policy)&&s.jsx("span",{className:"text-muted-foreground",children:se.length})]}),s.jsx(jr,{value:"setups",className:"px-3 text-xs",children:"MCPs & Skills"}),s.jsx(jr,{value:"files",className:"px-3 text-xs",children:"Files"}),s.jsx(jr,{value:"activity",className:"px-3 text-xs",children:"Activity"}),s.jsx(jr,{value:"details",className:"px-3 text-xs",children:"Details"})]})}),s.jsx(vo,{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(El,{title:"Access graph",className:"flex flex-1 flex-col",children:N!=null&&N.policy?s.jsx(yK,{compact:!0,fill:!0,agentStatus:fy(L),agents:Q,name:e,phase:K,allowed:X,denied:$,owner:qd(L),gateway:g.demo||(Z=g.overview)==null?void 0:Z.gateway,secrets:(L.providers??[]).map(ne=>{var ee,W;return((W=(ee=g.overview)==null?void 0:ee.providers)==null?void 0:W.find(ce=>ce.name===ne))??{name:ne}})}):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.":T?"The access graph is unavailable because the policy could not be loaded.":N?"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($W,{name:e,editors:B,cursorAgent:Q.some(ne=>ne.name==="Cursor"),cloud:!z,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(AW,{name:e,sandbox:L},e),s.jsxs(El,{title:"At a glance",children:[(le=L.setupJobs)==null?void 0:le.filter(ne=>["waiting","failed","blocked"].includes(ne.status)).map(ne=>s.jsx("p",{role:"status",className:"mb-3 text-xs text-muted-foreground",children:ne.status==="waiting"?"Installing included MCPs and skills…":`Included tools could not be activated: ${ne.error} Open MCPs & Skills to retry.`},ne.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 ${La(K).cell}`,"aria-hidden":"true"}),Qp[K]??"Unknown"]})],["Owner",qd(L)],[Q.length===1?"AI agent":"AI agents",s.jsx(HE,{agents:Q,status:fy(L)})],["Image",ip(L.image,L.imageTemplateName)],["Providers",L.providers.join(", ")||"None"],["Created",Wd(L.createdAt)],["Policy",N?`v${N.policyVersionNumber??L.policyVersion} · ${N.policySource??"sandbox"}`:"Not reported"]].map(([ne,ee])=>s.jsxs("div",{className:"min-w-0",children:[s.jsx("dt",{className:"text-[11px] text-muted-foreground",children:ne}),s.jsx("dd",{className:"mt-1 break-words text-xs",children:ee})]},ne))})]}),L.problem&&rx(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(Ba,{className:"size-3.5","aria-hidden":"true"}),"Failed to start"]}),hX(L.problem)&&s.jsx(kX,{local:!_&&!(m?m.remote:(oe=(de=g.overview)==null?void 0:de.gateway)!=null&&oe.remote)}),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:L.problem})]})]})]})}),s.jsx(vo,{value:"rules",className:"min-h-0 space-y-6 overflow-y-auto p-5",children:s.jsx(El,{title:"Network rules",icon:Wv,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:N!=null&&N.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(ne=>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:Ea(ne.key)==="own"?ne.name:Gd(ne.key)}),s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:VW[Ea(ne.key)]})]}),s.jsx("ul",{className:"mt-1.5 space-y-0.5",children:ne.endpoints.map(ee=>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 ${ee.blocked?"bg-red-500":"bg-emerald-500"}`,"aria-hidden":"true"}),s.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[ee.host,ee.port?`:${ee.port}`:""]}),s.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[BW[ee.access]??ee.access,ee.tlsSkip?" · TLS passthrough":"",ee.protocol!=="tcp"&&ee.enforcement==="audit"?" · audit only":""]})]},`${ee.host}:${ee.port}`))}),ne.binaries.length>0&&s.jsx("p",{className:"mt-1.5 truncate font-mono text-[10px] text-muted-foreground",title:ne.binaries.join(", "),children:ne.binaries.map(ee=>ee.split("/").pop()).filter((ee,W,ce)=>ce.indexOf(ee)===W).join(", ")})]},ne.key))}):s.jsx("p",{className:"text-sm text-muted-foreground",children:g.demo?"Policy data is unavailable in this preview.":T?"Rules could not be loaded. Close and reopen to retry.":N?"No policy reported.":"Loading rules…"})})}),s.jsx(vo,{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(z3,{sandbox:e,setupIds:(N==null?void 0:N.setupIds)??[]})}),s.jsx(vo,{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(IW,{sandbox:L,demo:g.demo})}),s.jsxs(vo,{value:"activity",className:"min-h-0 space-y-6 overflow-y-auto p-5",children:[s.jsxs(El,{title:"Connection activity",aside:s.jsx("div",{className:"flex gap-1",children:[15,60].map(ne=>s.jsx("button",{onClick:()=>v(ne),"aria-pressed":x===ne,className:`rounded px-2 py-1 text-xs ${x===ne?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:ne===15?"15m":"1h"},ne))}),children:[s.jsx("div",{className:"rounded-lg border border-border p-4",children:s.jsx(WM,{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(El,{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(ne=>s.jsx(TW,{event:ne,dense:!0},`${ne.at}|${ne.message}`))}):s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No connections yet"})})]}),s.jsx(vo,{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",qd(L)],["Image",ip(L.image,L.imageTemplateName),!0],...L.image&&ip(L.image,L.imageTemplateName)!==L.image?[["Image reference",L.image,!0]]:[],["Command",TK(L.command),!0],[Q.length===1?"AI agent":"AI agents",s.jsx(HE,{agents:Q,status:fy(L)})],["Providers",L.providers.join(", ")||"None"],["Created",Wd(L.createdAt)],["Workspace",L.workspace],["Policy",N?`v${N.policyVersionNumber??L.policyVersion} · ${N.policySource??"sandbox"}`:`v${L.policyVersion??"-"}`],["Sandbox ID",L.id,!0,!0]].map(([ne,ee,W,ce])=>s.jsxs("div",{className:ce?"sm:col-span-2":void 0,children:[s.jsx("dt",{className:"mb-1 text-[11px] text-muted-foreground",children:ne}),s.jsx("dd",{className:`break-all ${W?"font-mono text-xs":"text-sm"}`,children:ee??"Not reported"})]},ne))})})]}):s.jsx("p",{role:"status",className:"flex-1 p-5 text-sm text-muted-foreground",children:T?"Sandbox details unavailable.":"Loading sandbox…"}),L&&!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:[CK(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(Dt,{"aria-hidden":"true"}):s.jsx(T6,{"aria-hidden":"true"}),"Stop"]}),kK(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(Dt,{"aria-hidden":"true"}):s.jsx(qR,{"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:()=>E(!0),children:[s.jsx(Kn,{"aria-hidden":"true"}),"Delete"]})]})]})}),s.jsx(Rr,{open:M,onOpenChange:E,children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:["Delete ",e,"?"]}),s.jsx(zr,{children:"All files inside will be lost."})]}),s.jsxs(Mr,{children:[s.jsx(Ir,{children:"Cancel"}),s.jsxs(Pr,{variant:"destructive",onClick:()=>F("delete"),disabled:A==="delete",children:[A==="delete"&&s.jsx(Dt,{"aria-hidden":"true"}),"Delete"]})]})]})})]})}const Q3=({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:x="#9c40ff",repeat:v=1/0,repeatDelay:j=0,startXOffset:S=0,startYOffset:N=0,endXOffset:C=0,endYOffset:T=0})=>{const k=b.useId(),[A,R]=b.useState(""),[M,E]=b.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 b.useEffect(()=>{const z=()=>{if(t.current&&r.current&&a.current){const B=t.current.getBoundingClientRect(),q=r.current.getBoundingClientRect(),I=a.current.getBoundingClientRect(),L=B.width,H=B.height;E({width:L,height:H});const F=q.left-B.left+q.width/2+S,V=q.top-B.top+q.height/2+N,G=I.left-B.left+I.width/2+C,X=I.top-B.top+I.height/2+T,$=V-l,Q=`M ${F},${V} Q ${(F+G)/2},${$} ${G},${X}`;R(Q)}},_=new ResizeObserver(()=>{z()});return t.current&&_.observe(t.current),z(),()=>{_.disconnect()}},[t,r,a,l,S,N,C,T]),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(#${k})`,strokeOpacity:"1",strokeLinecap:"round"}),s.jsx("defs",{children:s.jsxs(Rn.linearGradient,{className:"transform-gpu",id:k,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:x}),s.jsx("stop",{offset:"100%",stopColor:x,stopOpacity:"0"})]})})]})},HW=["working","needs-docker","needs-install"],GE={working:{icon:_l,tone:"text-muted-foreground animate-spin motion-reduce:animate-none",title:e=>`Connecting to ${e.host}`},"needs-docker":{icon:uC,tone:"text-amber-500",title:e=>`Docker isn’t installed on ${e.host}`},"needs-install":{icon:uC,tone:"text-amber-500",title:e=>`${e.host} needs the runtime images`},failed:{icon:hI,tone:"text-destructive",title:e=>`Couldn’t connect to ${e.host}`}};function Z3({onConnected:e,onBack:t,initialHost:r,connectedHost:a=null,onUseConnected:l}){var se,P;const[c,u]=b.useState(null),[f,m]=b.useState("download"),[h,g]=b.useState(""),[p,x]=b.useState(null),[v,j]=b.useState(null),[S,N]=b.useState(null),[C,T]=b.useState(!1),[k,A]=b.useState(null),[R,M]=b.useState(null),[E,O]=b.useState(0),z=b.useRef(0),_=b.useRef(null),B=b.useRef(!1),q=b.useId(),I=b.useCallback(U=>{B.current||(B.current=!0,e(U))},[e]);b.useEffect(()=>{const U=new AbortController,Z=++z.current,te=setTimeout(()=>U.abort(new Error("Reading hosts timed out. Try refreshing.")),1e4);return T(!0),A(null),M(null),ls.connections(U.signal).then(le=>{var ne,ee,W;if(z.current!==Z)return;u(le);const de=(ne=le.job)!=null&&ne.host&&HW.includes(le.job.status)?le.job:null;de&&(x(de),m(de.runtimeInstallation||"download"));const oe=(de==null?void 0:de.host)??_.current??r??((ee=le.active)==null?void 0:ee.host);g(le.hosts.some(ce=>ce.name===oe)?oe:((W=le.hosts[0])==null?void 0:W.name)||"")}).catch(le=>{z.current===Z&&le.name!=="AbortError"&&A(le.message)}).finally(()=>{clearTimeout(te),z.current===Z&&T(!1)}),()=>{U.abort(),clearTimeout(te),z.current+=1}},[E,r]),b.useEffect(()=>{if((p==null?void 0:p.status)!=="working"||R||S)return;const U=new AbortController;let Z;async function te(){try{const le=await ls.connectionJob(p.id,U.signal);if(U.signal.aborted)return;x(le),le.status==="ready"?I(le):le.status==="working"&&(Z=setTimeout(te,1e3))}catch(le){U.signal.aborted||M(le.message)}}return Z=setTimeout(te,500),()=>{U.abort(),clearTimeout(Z)}},[p==null?void 0:p.id,p==null?void 0:p.status,R,S,I]);async function L(U,Z){N(U),A(null),M(null);try{const te=await Z();x(te),te.status==="ready"&&I(te)}catch(te){A(te.message)}finally{N(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,$=p&&p.host===h&&GE[p.status]?GE[p.status]:null,Q=()=>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(GW,{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),x(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||C,onClick:Q,children:s.jsx($a,{className:`size-3.5 ${C?"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(Mh,{children:"OpenSSH isn’t installed on this computer. Install it, then refresh."})]}),s.jsxs(FW,{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,Z])=>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:Z},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."})]})]})]})]}),$&&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($.icon,{className:`mt-0.5 size-4 shrink-0 ${$.tone}`}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium text-foreground",children:$.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:()=>L("docker",()=>ls.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:[((P=p.probe)==null?void 0:P.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:()=>L("connect",()=>ls.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:()=>L("download",()=>ls.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(At,{"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 Z;j(((Z=U.target.files)==null?void 0:Z[0])??null),A(null)}}),s.jsx(ue,{type:"button",variant:"outline",size:"sm",disabled:V||!(v!=null&&v.name.toLowerCase().endsWith(".tar")),onClick:()=>L("upload",()=>ls.uploadConnectionPackage(p.id,v)),children:S==="upload"?"Uploading…":"Upload"})]}),v&&!v.name.toLowerCase().endsWith(".tar")&&s.jsx(Mh,{children:"Choose an uncompressed .tar archive."})]})]}),(k||$&&p.error)&&s.jsx(Mh,{children:k||p.error}),R&&s.jsxs(Mh,{children:["Lost track of progress: ",R," 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:()=>L("connect",()=>ls.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(_l,{className:"size-3.5 animate-spin"}),"Connecting…"]}):(p==null?void 0:p.status)==="failed"&&p.host===h?"Try again":"Connect"})]})]})}function Mh({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 FW({children:e}){const[t,r]=b.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(ff,{className:"size-3.5"}),"Requirements & safety",s.jsx(Qo,{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 GW({host:e,live:t}){const r=b.useRef(null),a=b.useRef(null),l=b.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,gp,"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,mf,e,"Docker · sandboxes"),s.jsx(Q3,{containerRef:r,fromRef:a,toRef:l,duration:t?2.5:5,pathOpacity:.25,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})}function qW({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=b.useId(),p=b.useRef(null),[x,v]=b.useState({width:0,height:0});b.useEffect(()=>{const S=()=>{if(p.current){const{width:N,height:C}=p.current.getBoundingClientRect();v({width:N,height:C})}};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const j=Array.from({length:Math.ceil(x.width/e)*Math.ceil(x.height/t)},(S,N)=>{const C=N%Math.ceil(x.width/e),T=Math.floor(N/Math.ceil(x.width/e));return{x:C*e+l+r,y:T*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 Qw({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(b.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 J3({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(mf,{"aria-hidden":"true",className:"size-3"}):s.jsx(gp,{"aria-hidden":"true",className:"size-3"}),s.jsx("span",{className:"max-w-40 truncate text-foreground",children:e!=null&&e.remote?Id(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 Id=e=>{var t;return((t=e==null?void 0:e.label)==null?void 0:t.replace(/^SSH · /,""))??(e==null?void 0:e.gateway)};function qE({live:e}){const t=Ls(),r=b.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 e4({live:e}){const t=Ls();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 YW(){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 KW({kind:e,live:t}){const r=b.useRef(null),a=b.useRef(null),l=b.useRef(null);return s.jsxs("div",{ref:r,className:"relative flex h-36 items-center justify-center gap-14",children:[s.jsx(qW,{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(YW,{})}),e==="local"&&s.jsx("span",{className:"relative z-10 transition-transform duration-500 group-hover:scale-105",children:s.jsx(qE,{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(qE,{live:t})}),s.jsx("span",{ref:l,className:"relative z-10 transition-transform duration-500 group-hover:translate-x-1",children:s.jsx(e4,{live:t})}),s.jsx(Q3,{containerRef:r,fromRef:a,toRef:l,duration:t?2.5:4,pathOpacity:.3,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})]})}function Sy({index:e,scene:t,live:r,title:a,caption:l,tone:c="idle",disabled:u,onClick:f,trailing:m}){const h=Ls(),g=p=>{const x=p.currentTarget.getBoundingClientRect();p.currentTarget.style.setProperty("--x",`${p.clientX-x.left}px`),p.currentTarget.style.setProperty("--y",`${p.clientY-x.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(KW,{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(Mi,{"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 t4({locations:e,allowRemote:t,onPick:r,onConnected:a,onCancel:l,connecting:c,subject:u="sandbox"}){const f=Ls(),[m,h]=b.useState("choose"),[g,p]=b.useState(null),[x,v]=b.useState(!1),[j,S]=b.useState(!1),[N,C]=b.useState(null),T=e.find(E=>!E.remote),k=e.find(E=>E.remote);b.useEffect(()=>{if(T||!t)return;let E=!0;return ls.connections().then(O=>{var z;E&&(p(O.locals),v(((z=O.tools)==null?void 0:z.openshell)===!1))}).catch(()=>{E&&p([])}),()=>{E=!1}},[T,t]);async function A(){S(!0),C(null);try{await FM(ls,g[0].name),window.location.reload()}catch(E){C(E.message),S(!1)}}const R=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]}},M=T?T.connected?"Local gateway":"Disconnected":g!=null&&g.length?`Use ${g[0].name}`:g?x?"OpenShell isn’t installed":"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(jn,{className:"gap-3",children:[s.jsx(Qw,{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(Yv,{})}),s.jsx(vn,{children:m==="remote"?"Connect a machine":"Where should it run?"})]}),s.jsx($n,{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(Fl,{mode:"wait",initial:!1,children:m==="choose"?s.jsxs(Rn.div,{...R,className:"grid gap-3",children:[s.jsxs("div",{className:`grid gap-4 ${t?"sm:grid-cols-3":""}`,children:[s.jsx(Sy,{index:0,scene:"local",live:T==null?void 0:T.connected,title:"This computer",caption:M,tone:T!=null&&T.connected?"live":"idle",disabled:T?!T.connected:!(g!=null&&g.length)||j,onClick:()=>T?r(T.id??T.context):A(),trailing:j&&s.jsx(_l,{className:"size-4 animate-spin text-muted-foreground"})}),t&&s.jsx(Sy,{index:1,scene:"remote",live:k==null?void 0:k.connected,title:"Remote machine",caption:k!=null&&k.connected?`Connected · ${Id(k)}`:k?`${Id(k)} · Disconnected`:"Your server, over SSH",tone:k!=null&&k.connected?"live":k?"warn":"idle",onClick:()=>h("remote")}),t&&s.jsx(Sy,{index:2,scene:"cloud",title:"Cloud",caption:"Coming soon",disabled:!0,trailing:s.jsx("span",{"aria-hidden":"true"})})]}),N&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:N}),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,{...R,children:c?s.jsxs("div",{role:"status",className:"grid place-items-center gap-3 py-16 text-xs text-muted-foreground",children:[s.jsx(_l,{className:"size-5 animate-spin"}),"Connected. Opening the ",u," form…"]}):s.jsx(Z3,{initialHost:k?Id(k):void 0,connectedHost:k!=null&&k.connected?Id(k):null,onUseConnected:()=>r(k.id??k.context),onConnected:a,onBack:()=>h("choose")})},"remote")})})]})}function Rl({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(Jr,{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 Uo=(e,t="read-write")=>({host:e,ports:[443],protocol:"rest",access:t,enforcement:"enforce"}),Dh=["/usr/local/bin/node","/usr/bin/node"],Ny=["generativelanguage.googleapis.com","cloudcode-pa.googleapis.com","oauth2.googleapis.com","accounts.google.com","www.googleapis.com","aiplatform.googleapis.com","*.aiplatform.googleapis.com"],XW=new Set(["cloudcode-pa.googleapis.com","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"]),WW=e=>({...Uo(e),...XW.has(e)?{deny:["fetchFromTrawlerCache","rewriteUri","generateContent"].map(t=>({method:"*",path:`/**:${t}*`}))}:{}}),zh=["api.anthropic.com","api.openai.com","openrouter.ai","api.groq.com","api.deepseek.com","api.mistral.ai","api.x.ai","generativelanguage.googleapis.com"],Si=(e,t,r)=>({name:e,binaries:t,endpoints:[...new Set(r)].map(a=>Uo(a))}),Cy={claude:{name:"Claude Code",binaries:["/usr/bin/claude","/usr/local/bin/claude"],endpoints:["api.anthropic.com","platform.claude.com","claude.ai"].map(e=>Uo(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:[Uo("models.opencode.ai","read-only"),Uo("models.dev","read-only"),Uo("opencode.ai"),...zh.map(e=>Uo(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=>Uo(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:Si("Gemini CLI",[...Dh,"/usr/local/bin/gemini"],Ny),pi:{...Si("Pi",[...Dh,"/usr/local/bin/pi"],[...zh,...Ny,"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:Si("Aider",["/usr/local/bin/aider","/opt/aider/bin/python*","/usr/bin/python3*","/usr/local/bin/python3*"],zh),copilot:Si("GitHub Copilot",[...Dh,"/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:{...Si("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=>Uo(e)),{host:"agentn.global.api5.cursor.sh",ports:[443],protocol:"tcp",tlsSkip:!0}]},antigravity:{...Si("Antigravity",["/sandbox/.local/bin/agy","/sandbox/.antigravity/**","/sandbox/.local/share/antigravity/**","/usr/local/bin/agy",...Dh],[]),endpoints:[...[...Ny,"antigravity.google","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"].map(WW),Uo("lh3.googleusercontent.com","read-only")]},kiro:Si("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:Si("Factory Droid",["/sandbox/.local/bin/droid","/sandbox/.factory/bin/**","/usr/local/bin/droid"],["factory.ai","*.factory.ai",...zh])},QW=e=>({host:e,ports:[443],protocol:"rest",enforcement:"enforce",allow:[{method:"GET",path:"/**"}]}),YE={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(QW)}};function n4(e){if((e==null?void 0:e.source)!=="build")return{profiles:[],unsupported:[]};const t=[...new Set(e.agents??[])];return{profiles:[...t.filter(r=>Cy[r]).map(r=>({id:r,rule:`agent-${r}`,...Cy[r]})),...[...new Set(e.runtimes??[])].filter(r=>YE[r]).map(r=>({id:r,...YE[r]}))],unsupported:t.filter(r=>!Cy[r])}}const Kl=_s.filter(e=>!n4({source:"build",agents:[e.id]}).unsupported.length);function Zw(e){const t=Array.isArray(e)?e:e==="terminal"?[]:[e];if(t.some(r=>!Kl.some(a=>a.id===r)))throw new Error("Choose a supported agent.");return Kl.filter(r=>t.includes(r.id)).map(r=>r.id)}function ZW(e,t){const r=Zw(e);if(r.length!==1||t==="shell")return"shell";const a=Kl.find(l=>l.id===t&&r.includes(l.id));if(!a)throw new Error("Choose Shell or a selected agent.");return a.command}function Jw(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=Zw(e),f=Kl.find(m=>m.id===u[0]);return va({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 JW(e,t,r="agent",a=!1,l=[]){const c=Jw(t,"",r,a,l);return e.find(u=>u.managed&&u.status==="ready"&&u.image&&u.build===sq(c)&&JSON.stringify(va({...u.recipe,name:""}))===JSON.stringify(c))}function KE(e,t){const r={claude:["claude-code"],codex:["codex"]}[t]||[];return e.filter(a=>r.includes(a.type))}const s4=(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 eQ(e,t,{openIn:r="agent",withSetups:a=!1,setups:l=[],signal:c,onProgress:u=()=>{},onBuild:f=()=>{},onBuildUpdate:m=()=>{},wait:h=s4}={}){const g=()=>{if(c!=null&&c.aborted)throw new DOMException("Preparation cancelled.","AbortError")};g();const p=await e.imageTemplates();g();const x=JW(p,t,r,a,l);if(x)return m(x),x;const v=Zw(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 N=await e.buildImageTemplate(Jw(t,S,r,a,l));if(f(S),m({...N,name:S}),g(),N.status==="failed")throw new Error(N.error||"Environment build failed.");for(let C=0;C<900;C++){await h(2e3,c),g();const T=(await e.imageTemplates()).find(k=>k.name===S);if(g(),!T)throw new Error("The environment build disappeared. Check Templates and try again.");if(m(T),T.status==="failed")throw new Error(T.error||"Environment build failed.");if(T.status==="ready")return T}throw new Error("The build is still running. Check Templates before trying again.")}async function r4(e,t,r,{signal:a,expectedRevisions:l={},onProgress:c=()=>{},wait:u=s4}={}){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 x=m.find(j=>j.id===p);if(!x||r&&r[p]!==x.revision||l[p]&&l[p]!==x.revision)throw new Error("A selected Setup changed. Reopen the dialog and review it again.");c(`Preparing MCP packages for ${x.name}…`);let v;try{v=await e.prepareLaunchSetup(p,x.revision);for(let j=0;v.status==="running"&&j<900;j++)f(),c(v.message||`Preparing ${x.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 or=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),o4=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>Kl.find(t=>t.id===e)).filter(Boolean),XE=Kl.filter(e=>!o4.includes(e)),tQ=[{id:"empty",label:"Empty"},{id:"folder",label:"Local folder"},{id:"repo",label:"Git repository"}];function nQ(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?`${wa}/${/^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(a)?a:"repo"}`:null}catch{return null}}const sQ={gitignore:".gitignore applied","gitignore-empty":".gitignore matched nothing, so everything is sent",none:"Not a git repository, so everything is sent"},rQ={included:e=>`git history included (${sr(e.gitBytes)})`,worktree:()=>"Git worktree: history not included",subfolder:()=>"Inside a repository: history not included",none:()=>null};function oQ({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 ",sr(e.limit),". Add a .gitignore, or upload it from a terminal."]}):s.jsxs("p",{children:[e.files.toLocaleString()," ",e.files===1?"file":"files"," · ",sr(e.bytes)," → ",s.jsx("span",{className:"font-mono",children:e.dest})]}),s.jsx("p",{className:"text-muted-foreground",children:[sQ[e.filter],rQ[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(Li,{command:Fv(t||"NAME",e.display,wa)})]})]})}function aQ({org:e,value:t,onChange:r,onCreated:a,onAddPolicy:l,invalid:c=!1}){const u=Ls(),f=X3(e.policies,t),m=Object.fromEntries(e.groups.map(g=>{var p,x;return[g.id,((x=(p=e.members)==null?void 0:p[g.id])==null?void 0:x.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(sf,{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 WE(e,t){const r=Qr.getSnapshot().filter(a=>a.status!=="failed"&&a.status!=="cancelled"&&or(a.location)===or(t));return new Set([...e.map(a=>a.name),...r.map(a=>a.name)])}function QE(e,t="sandbox"){for(let r=1;r<1e3;r++){const a=`${t}-${r}`;if(!e.has(a))return a}return""}function a4({locations:e,location:t,onLocationChange:r,onRefreshLocations:a,allowRemote:l=!1,...c}){var R;const u=Cn(),f=Bt(),[m,h]=b.useState(null),g=(R=c.initialImageTemplate)==null?void 0:R.location,p=e??[],x=g??t,v=x?p.find(M=>or(M)===or(x))??(or(u)===or(x)?u:x):p.find(M=>or(M)===m)??u??p.find(M=>M.target===f.target&&M.connected)??null,j=!c.initialImageTemplate&&(l||p.length>1),[S,N]=b.useState("where"),[C,T]=b.useState(null);b.useEffect(()=>{c.open||h(null),N("where"),T(null)},[c.open]);const k=M=>{const E=p.find(O=>or(O)===M&&O.connected);E&&(h(M),r==null||r(E))};b.useEffect(()=>{if(!C)return;const M=p.find(O=>O.gateway===C&&O.connected);if(M){T(null),k(or(M)),N("form");return}const E=setInterval(()=>a==null?void 0:a(),1500);return()=>clearInterval(E)},[C,p]);const A=j&&S==="where"?s.jsx(t4,{locations:p,allowRemote:l,connecting:!!C,onPick:M=>{k(M),N("form")},onConnected:M=>{T(M.gateway),a==null||a()},onCancel:()=>c.onOpenChange(!1)}):null;return s.jsx(Da,{location:v,children:s.jsx(iQ,{...c,locations:p,onLocationChange:k,chooser:A,onChangeLocation:j?()=>N("where"):void 0},or(v)??"default")})}function iQ({open:e,onOpenChange:t,onStarted:r,initialImageTemplate:a=null,locations:l,onLocationChange:c,chooser:u,onChangeLocation:f}){var qe,ht;const m=Bt(),h=Cn(),g=Ls(),[p,x]=b.useState([]),[v,j]=b.useState([]),[S,N]=b.useState(""),C=b.useRef(!1),[T,k]=b.useState([]),[A,R]=b.useState([]),[M,E]=b.useState(null),[O,z]=b.useState(""),[_,B]=b.useState([]),[q,I]=b.useState("quick"),[L,H]=b.useState([]),[F,V]=b.useState("shell"),[G,X]=b.useState({}),[$,Q]=b.useState(null),[K,se]=b.useState(null),[P,U]=b.useState("empty"),Z=_r(),te=!!(h!=null&&h.cloud||((h==null?void 0:h.target)??(Z==null?void 0:Z.target))==="cloud"),[le,de]=b.useState(""),[oe,ne]=b.useState(null),[ee,W]=b.useState(""),[ce,Re]=b.useState(null),[_e,Ne]=b.useState([]),[Ae,J]=b.useState(null),[re,xe]=b.useState(!1),[he,Be]=b.useState(0),[we,Ye]=b.useState(!1);b.useEffect(()=>{if(!e||(h==null?void 0:h.connected)===!1)return;let pe=!0;return C.current=!1,x([]),j([]),m.overview().then(Qe=>{if(!pe)return;const Fe=Qe.sandboxes??[],yt=Qe.providers??[];x(Fe),j(yt),C.current||N(QE(WE(Fe,h))),B(yt.map(Et=>Et.name))}).catch(Qe=>{pe&&Q(Qe.message)}),N(""),I(a?"template":"quick"),H([]),V("shell"),X({}),R([]),z((a==null?void 0:a.name)||""),k(a?[a]:[]),m.imageTemplates().then(Qe=>{pe&&k(Qe.filter(Fe=>Fe.status==="ready"||Fe.exists))}).catch(Qe=>{pe&&Q(Qe.message)}),B([]),Q(null),se(null),Re(null),U("empty"),de(""),ne(null),W(""),Ne([]),Ye(!1),J(null),xe(rp(h)),(rp(h)?m.syncLocalCatalog():Promise.resolve(null)).then(async Qe=>{if(!pe)return;const Fe=await m.org();pe&&(Qe!=null&&Qe.available&&(Fe.groups=Fe.groups.filter(yt=>!Qe.importedGroups.includes(yt.id)||Qe.groups.includes(yt.id))),Re(Fe),J(Qe))}).catch(Qe=>{pe&&(Re(null),Q(`Could not load sandbox settings: ${Qe.message}`))}).finally(()=>{pe&&xe(!1)}),()=>{pe=!1}},[e,m,h==null?void 0:h.connected,h==null?void 0:h.remote,a,he]);const Ee=q==="template"?T.find(pe=>pe.name===O):null,Ce=Kl.filter(pe=>L.includes(pe.id)),be=n4(q==="quick"?Jw(L):Ee!=null&&Ee.managed?Ee.recipe:null),Ue=q==="quick"?[...new Set(Ce.flatMap(pe=>{const De=G[pe.id];return KE(v,pe.id).some(Qe=>Qe.name===De)?[De]:[]}))]:_,Je=Ee!=null&&Ee.managed&&Ee.recipe.source==="build"?_s.filter(pe=>Ee.recipe.agents.includes(pe.id)):null,dt=q==="quick"?L:(Je??[]).map(pe=>pe.id),lt=H6(dt),Ie=q==="quick"?A.length>0:!!((ht=(qe=Ee==null?void 0:Ee.recipe)==null?void 0:qe.setups)!=null&&ht.length),ot=Ie&&!lt.length;function We(pe){const De=L.includes(pe)?L.filter(Qe=>Qe!==pe):[...L,pe];H(De),Q(null),(De.length!==1||!De.includes(F))&&V("shell"),X(Qe=>Object.fromEntries(Object.entries(Qe).filter(([Fe])=>De.includes(Fe)))),/^(sandbox|terminal|claude|codex|cursor|opencode|pi|antigravity|copilot|kiro|droid|aider)-\d+$/.test(S)&&N(QE(WE(p??[],h),De.length===1?De[0]:"sandbox"))}b.useEffect(()=>{if(P!=="folder"||!le.trim()){ne(null);return}let pe=!1;ne({loading:!0});const De=setTimeout(()=>{m.localFolder(le.trim()).then(Qe=>{pe||ne({data:Qe})}).catch(Qe=>{pe||ne({error:Qe.message})})},400);return()=>{pe=!0,clearTimeout(De)}},[P,le,m]);const me=_e.every(pe=>ce==null?void 0:ce.groups.some(De=>De.id===pe)),Oe=P==="repo"?nQ(ee):null,Me=P==="empty"||(P==="folder"?!!(oe!=null&&oe.data&&!oe.data.over):!!Oe),nt=P==="folder"?le.trim():P==="repo"?ee.trim():"";function Ge(pe){var ut;if(pe.preventDefault(),(h==null?void 0:h.connected)===!1)return;const De=[!S&&"sandbox-name",q==="template"&&!Ee&&"sandbox-image-template",!me&&"sandbox-groups"].find(Boolean);if(De||!Me||ot){Ye(!0),De&&((ut=document.getElementById(De))==null||ut.scrollIntoView({behavior:g?"auto":"smooth",block:"center"}));return}const Qe=P==="folder"?{folder:oe.data.path}:P==="repo"?{repository:ee.trim()}:{},Fe=S.trim(),yt=q==="quick",Et=L,Nt=yt?{session:ZW(L,F)}:{},Vt=A,Ct=M,ct=Ue,vt=lt,ae=_e,Xe=Ee;Qr.start({name:Fe,location:h,task:async({signal:Ft,progress:An,build:zt,creating:_t})=>{let On=Xe,io=[],vs=null,Lr=null;const $s=()=>{Lr&&m.cancelImageBuild(Lr).catch(Gn=>He.error(Gn.message))};Ft.addEventListener("abort",$s);try{if(yt){const Gn=await r4(m,Vt,Ct,{signal:Ft,onProgress:An});io=Gn.setups.map(To=>To.id),vs=Gn.accessReview,On=await eQ(m,Et,{withSetups:Vt.length>0,setups:Gn.setups,signal:Ft,onProgress:An,onBuildUpdate:zt,onBuild:To=>{Lr=To,Ft.aborted&&$s()}})}}finally{Ft.removeEventListener("abort",$s)}if(Ft.aborted)throw new DOMException("Cancelled","AbortError");_t();const cr=await m.create({name:Fe,imageTemplate:On.name,includeTemplateAccess:!yt,...Nt,providers:ct,setups:io,setupAccessReview:vs,setupTargets:vt,groups:ae,...Qe});cr.seed&&He(`${cr.seed.kind==="folder"?"Uploading":"Cloning"} ${cr.seed.source}`,{description:`Into ${cr.seed.dest} once the sandbox starts. Progress is in its Files tab.`});for(const Gn of cr.opened??[])He(`Opened ${Gn.name||"default"} on port ${Gn.port}`,{description:Gn.url??void 0});return{...cr,image:On.image,providers:ct,createdAt:new Date().toISOString(),...h?{location:h}:{}}}}),t(!1),r==null||r()}return s.jsxs(s.Fragment,{children:[s.jsx(bn,{open:e,onOpenChange:t,children:s.jsx(yn,{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:Ge,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(Af,{value:q,onValueChange:pe=>{I(pe),Q(null)},className:"contents",children:[s.jsxs(jn,{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(Qw,{step:2})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 pr-8",children:[s.jsx(vn,{children:"New sandbox"}),f?s.jsx(J3,{location:h,onChange:f}):!a&&l.length>0?null:s.jsx(No,{location:h}),s.jsxs(Of,{className:"ml-auto w-fit","aria-label":"Sandbox creation method",children:[s.jsx(jr,{value:"quick",className:"px-3 text-xs",children:"Quick setup"}),s.jsx(jr,{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(qh,{value:or(h)??"",onValueChange:c,items:l.map(pe=>({value:or(pe),label:`${Is(pe)}${pe.connected?"":" · Disconnected"}`})),children:[s.jsx(Kh,{id:"sandbox-location",className:"w-full text-xs",children:s.jsx(Yh,{placeholder:"Choose a connected location"})}),s.jsx(Xh,{align:"start",alignItemWithTrigger:!1,children:l.map(pe=>s.jsxs(Dd,{value:or(pe),disabled:!pe.connected,children:[Is(pe),pe.connected?"":" · Disconnected"]},or(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."}),re&&s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading your local network policies, MCPs & Skills, and Groups…"}),(Ae==null?void 0:Ae.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."}),rp(h)&&!re&&!ce&&s.jsx(ue,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>Be(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(At,{id:"sandbox-name",value:S,onChange:pe=>{C.current=!0,N(pe.target.value.toLowerCase())},className:"h-10 font-mono text-sm",required:!0,"aria-invalid":we&&!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(vo,{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:o4.map(pe=>s.jsxs("label",{className:"relative min-w-0",children:[s.jsx("input",{type:"checkbox",checked:L.includes(pe.id),onChange:()=>We(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}),L.includes(pe.id)&&s.jsx(Fn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]})]},pe.id))}),s.jsxs(Nu,{children:[s.jsxs(Cu,{render:s.jsx(ue,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[s.jsx("span",{className:"truncate",children:XE.filter(pe=>L.includes(pe.id)).map(pe=>pe.name).join(", ")||"More agents"}),s.jsx(Qo,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),s.jsx(ku,{align:"start",children:XE.map(pe=>s.jsxs(Uw,{checked:L.includes(pe.id),onCheckedChange:()=>We(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))})]})]}),Ce.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"},...Ce.length===1?Ce:[]].map(pe=>s.jsxs("label",{className:"relative min-w-0",children:[s.jsx("input",{type:"radio",name:"quick-open-in",value:pe.id,checked:F===pe.id,onChange:()=>V(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(e1,{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 ${F===pe.id?"border-foreground":"border-muted-foreground/40"}`,children:F===pe.id&&s.jsx("span",{className:"size-1.5 rounded-full bg-foreground"})})]})]},pe.id))})]}),Ce.map(pe=>{const De=KE(v,pe.id);return De.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(qh,{value:G[pe.id]||"",onValueChange:Qe=>X(Fe=>({...Fe,[pe.id]:Qe??""})),children:[s.jsx(Kh,{id:`quick-sign-in-${pe.id}`,className:"w-full text-xs",children:s.jsx(Yh,{children:G[pe.id]||"None, I’ll use my subscription"})}),s.jsx(Xh,{align:"start",alignItemWithTrigger:!1,children:s.jsxs(Nk,{children:[s.jsx(Dd,{value:"",className:"text-xs",children:"None, I’ll use my subscription"}),De.map(Qe=>s.jsx(Dd,{value:Qe.name,className:"text-xs",children:Qe.name},Qe.name))]})})]})]},pe.id):null})]}),s.jsx(vo,{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(qh,{value:O,onValueChange:pe=>z(pe??""),children:[s.jsx(Kh,{id:"sandbox-image-template","aria-invalid":we&&!Ee||void 0,className:"w-full text-xs",children:s.jsx(Yh,{children:O||"Choose a template"})}),s.jsx(Xh,{align:"start",alignItemWithTrigger:!1,children:s.jsx(Nk,{children:T.map(pe=>s.jsx(Dd,{value:pe.name,className:"text-xs",children:pe.name},pe.name))})})]}),we&&!Ee&&T.length>0&&s.jsx("p",{className:"text-[11px] text-destructive",children:"Choose a template to create a sandbox."}),!T.length&&s.jsx("p",{className:`text-[11px] ${we?"text-destructive":"text-muted-foreground"}`,children:"No ready templates. Use Quick setup or create one in Templates."}),Ee&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:Je?`Included tools: ${[...Je.map(pe=>pe.name),...(Ee.recipe.customAgents??[]).map(pe=>pe.name),"Terminal"].join(", ")}`:"Installed tools are not reported by this template."})]})}),q==="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 De=_.includes(pe.name);return s.jsxs("button",{type:"button","aria-pressed":De,onClick:()=>B(Qe=>De?Qe.filter(Fe=>Fe!==pe.name):[...Qe,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 ${De?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[s.jsx("span",{className:`size-1.5 rounded-full ${De?"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"})]}),$&&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.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:[ce?s.jsx(aQ,{org:ce,value:_e,onChange:Ne,invalid:we&&!me,onAddPolicy:()=>se(Fd({appliesTo:{everyone:!1,groups:_e,sandboxes:[]}})),onCreated:pe=>Re(De=>({...De,groups:[...De.groups,pe].sort((Qe,Fe)=>Qe.name.localeCompare(Fe.name)),members:{...De.members,[pe.id]:[]}}))}):s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:$?"Groups unavailable. Reopen this dialog to retry.":"Loading groups…"}),(q==="quick"||Ie&&(ot||dt.includes("aider")))&&s.jsxs("div",{className:"space-y-3",children:[q==="quick"&&!re&&s.jsx(_3,{localCatalog:Ae,autoPrepare:!0,automaticAccess:!0,preparationContext:"sandbox",accessReview:M,onAccessReview:E,value:A,onChange:R}),Ie&&ot&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:dt.includes("aider")?"Setup installation is unavailable for Aider. Choose another agent.":q==="quick"?"Choose an agent to use this Setup.":"Choose a template with a supported agent to use this Setup."}),Ie&&!ot&&dt.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(Rl,{title:"Add project files",summary:nt,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:tQ.filter(pe=>!te||pe.id!=="folder").map(pe=>s.jsx("button",{type:"button",onClick:()=>U(pe.id),"aria-pressed":P===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 ${P===pe.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:pe.label},pe.id))}),P==="folder"&&s.jsxs(s.Fragment,{children:[s.jsx(At,{value:le,onChange:pe=>de(pe.target.value),className:"font-mono text-xs",placeholder:"~/code/my-project","aria-label":"Folder on this computer"}),(oe==null?void 0:oe.loading)&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Checking the folder…"}),(oe==null?void 0:oe.error)&&s.jsx("p",{className:"text-[11px] text-red-700",children:oe.error}),(oe==null?void 0:oe.data)&&s.jsx(oQ,{plan:oe.data,sandbox:S})]}),P==="repo"&&s.jsxs(s.Fragment,{children:[s.jsx(At,{value:ee,onChange:pe=>W(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:[Oe?s.jsxs(s.Fragment,{children:["Cloned into ",s.jsx("span",{className:"font-mono",children:Oe})," once the sandbox starts. "]}):"An https:// URL. ","Public repositories only. Your access rules must allow Git connections to this host."]})]})]})}),be.profiles.length>0&&s.jsx(Rl,{title:be.profiles.some(pe=>pe.rule.startsWith("tool-"))?"Agent and tool connections":"Agent connections",summary:`${new Set(be.profiles.flatMap(pe=>pe.endpoints.map(De=>`${De.host}:${De.ports.join(",")}`))).size} destinations`,children:s.jsx("div",{className:"max-h-52 divide-y overflow-y-auto",children:be.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(De=>{var Qe;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:[De.host,":",De.ports.join(",")]}),s.jsx("span",{className:"text-muted-foreground",children:De.tlsSkip?"TLS passthrough":(Qe=De.allow)!=null&&Qe.length?`${De.allow.map(Fe=>Fe.method).join(", ")} only`:De.access==="read-only"?"Read only":"Read & write"})]},De.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(De=>s.jsx("li",{children:De},De))})]},pe.id))})})]})]})]})}),s.jsxs(Co,{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(c3,{open:!!K,initial:K,onOpenChange:pe=>{pe||se(null)},groups:(ce==null?void 0:ce.groups)??[],sandboxes:(p??[]).map(pe=>pe.name),assignments:(ce==null?void 0:ce.assignments)??{},onGroupCreated:pe=>Re(De=>({...De,groups:[...De.groups,pe]})),onSaved:(pe,De)=>{var Qe;Ne(Fe=>[...new Set([...Fe,...De.appliesTo.groups])]),Re(Fe=>({...Fe,policies:[...Fe.policies.filter(yt=>yt.id!==De.id),De]})),(Qe=pe.failed)!=null&&Qe.length?He.error("Rule saved, but some sandboxes could not be updated."):He.success(`Saved ${De.name}`)}})]})}function ox({count:e,rowHeight:t,overscan:r=8}){const[a,l]=b.useState(null),[c,u]=b.useState(0),[f,m]=b.useState(0);b.useLayoutEffect(()=>{if(!a)return;const x=()=>m(a.clientHeight);x();const v=new ResizeObserver(x);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:x=>u(x.currentTarget.scrollTop),start:h,end:p,paddingTop:h*t,totalHeight:e*t,scrollToTop:()=>{a==null||a.scrollTo({top:0}),u(0)}}}const ZE=["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"],JE=new Set(["pastebin.com","ngrok.io","api.stripe.com"]);function lQ(e){let t=e>>>0;return()=>(t=t*1664525+1013904223>>>0)/2**32}const cQ=(e,t)=>t[Math.floor(e()*t.length)];function i4(e,t=Math.random,r=new Date().toISOString()){const a=e[Math.floor(t()**2.2*e.length)],l=t()<.08?cQ(t,[...JE]):ZE[Math.floor(t()**1.8*(ZE.length-3))],c=JE.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 uQ(e,t=2e3){const r=lQ(11),a=Date.now(),l=new Map(e.map(c=>[c.name,c.phase]));return Array.from({length:t},(c,u)=>i4(e,r,new Date(a-u*1500).toISOString())).filter(c=>["ready","error"].includes(l.get(c.sandbox)))}function l4(e){const t=b.useMemo(()=>null,[]),[r,a]=b.useState(()=>t?uQ(t):[]);return b.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)},()=>i4(l));a(f=>[...u,...f].slice(0,2e3))},450);return()=>clearInterval(c)},[t]),t?{...e,sandboxes:t,events:r,demo:!0}:e}const eR=[],dQ={context:'["preview","default"]',gateway:"preview",workspace:"default",label:"Local",remote:!1,connected:!0},tR=40,fQ=["all","running","sleeping","provisioning","error","unknown"],os=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),tr=Un,Ph=e=>JSON.stringify([os(e.location),e.name]),Ci=e=>e.toLocaleString("en-US"),ky=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),nR=[{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"}],mQ=[{value:"1",label:"Last 24 hours"},{value:"7",label:"Last 7 days"},{value:"30",label:"Last 30 days"}],Ty={type:[],phase:[],owner:[],image:[],createdAt:""},hQ=Object.fromEntries(Object.entries(Yl).map(([e,t])=>[t.label,e])),c4=()=>s.jsx(HR,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),Ey={type:e=>s.jsx(Y3,{type:hQ[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 ${kl[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(c4,{}),s.jsx("span",{className:"truncate font-mono text-[11px]",children:e.label})]})},sR={type:e=>e.type,phase:e=>rx(e.sandbox.phase),owner:e=>e.owner,image:e=>e.image},rR=Object.keys(Yl);function pQ({onNavigate:e,allowRemote:t=!1,createRequest:r=0,onCreateRequestHandled:a}){const l=Bt(),c=_r(),u=l4(Ga()),f=Tu(),{locations:m}=f,h=Cn(),[g,p]=b.useState(null),x=os(h)??g,v=os(h)??"",[j,S]=b.useState(null),[N,C]=b.useState(null),T=t;b.useEffect(()=>{let me=!0;return l.contextKey().then(Oe=>{me&&p(JSON.stringify([l.target,Oe]))}).catch(()=>{}),()=>{me=!1}},[l]);const k=m.find(me=>os(me)===x),A=m.find(me=>os(me)===v&&me.connected)??(k!=null&&k.connected?k:null)??m.find(me=>me.target===l.target&&!me.remote&&me.connected)??m.find(me=>me.target===l.target&&me.connected),R=m.find(me=>os(me)===os(j))??j??A,M=b.useSyncExternalStore(Qr.subscribe,Qr.getSnapshot),E=b.useMemo(()=>M.filter(me=>me.status==="created"&&!me.reported).map(me=>me.sandbox),[M]),O=b.useMemo(()=>u.demo?(u.sandboxes??eR).map((me,Oe)=>{const Me=k??A??dQ,nt=rR[Oe%rR.length];return{...me,location:nt===mp(Me)?Me:{...Me,placement:nt,host:`${nt}-demo`}}}):f.sandboxes,[u.demo,u.sandboxes,k,A,f.sandboxes]),z=b.useMemo(()=>{const me=new Set(O.map(Ph));return[...E.filter(Oe=>!me.has(Ph(Oe))).map(Oe=>({...Oe,location:m.find(Me=>os(Me)===os(Oe.location))??Oe.location})),...O]},[O,E,m]),[_,B]=b.useState(""),[q,I]=b.useState(Ty),L=(me,Oe)=>I(Me=>({...Me,[me]:Oe})),[H,F]=b.useState({key:"name",direction:"asc"}),V=b.useDeferredValue(_),[G,X]=b.useState(null),[$,Q]=b.useState(()=>new Set),[K,se]=b.useState(null),[P,U]=b.useState(!1),Z=b.useRef(!1),[te,le]=b.useState([]),[de,oe]=b.useState(!!(c!=null&&c.createRequested));b.useEffect(()=>{c!=null&&c.createRequested&&(oe(!0),c.requestCreate(!1))},[c==null?void 0:c.createRequested]);const[ne,ee]=b.useState(Date.now),W=b.useRef(null);b.useEffect(()=>{const me=setInterval(()=>ee(Date.now()),3e4),Oe=Ge=>{var qe;(Ge.metaKey||Ge.ctrlKey)&&Ge.key.toLowerCase()==="k"&&(Ge.preventDefault(),(qe=W.current)==null||qe.focus())};window.addEventListener("keydown",Oe);const Me=()=>{try{const Ge=sessionStorage.getItem(Tl);if(sessionStorage.removeItem(Tl),Ge){let qe;try{qe=JSON.parse(Ge)}catch{}C(qe&&typeof qe.name=="string"?{name:qe.name,context:os(qe.location)??(qe.context&&qe.target?JSON.stringify([qe.target,qe.context]):qe.context)}:{name:Ge})}}catch{}},nt=Ge=>{var ht;const qe=Ge.detail;typeof(qe==null?void 0:qe.name)=="string"&&(C({name:qe.name,context:((ht=qe.location)==null?void 0:ht.id)??(qe.context?JSON.stringify([qe.target??l.target,qe.context]):void 0)}),f.refresh())};return Me(),window.addEventListener("openrod-sandbox-handoff",nt),window.addEventListener(Tl,Me),()=>{clearInterval(me),window.removeEventListener("keydown",Oe),window.removeEventListener(Tl,Me),window.removeEventListener("openrod-sandbox-handoff",nt)}},[]),b.useEffect(()=>{const me=(N==null?void 0:N.context)??x;if(!N||!me||f.loading)return;const Oe=z.find(Me=>Me.name===N.name&&os(Me.location)===me);if(Oe!=null&&Oe.location.connected){X(Oe),C(null);try{sessionStorage.removeItem(Tl)}catch{}}},[N,x,f.loading,z]);const ce=b.useRef(null);b.useEffect(()=>{const me=M.filter(Me=>Me.status==="created");if(!ce.current){ce.current=new Set(me.map(Me=>Me.id));return}const Oe=me.filter(Me=>!ce.current.has(Me.id));Oe.length&&(Oe.forEach(Me=>ce.current.add(Me.id)),X(null),B(""),I(Ty),F({key:"createdAt",direction:"desc"}),f.refresh())},[M]);const Re=b.useMemo(()=>EK(z),[z]),_e=b.useMemo(()=>z.map(me=>({sandbox:me,owner:qd(me),type:Yl[mp(me.location)].label,image:ip(me.image,me.imageTemplateName),search:[me.name,me.id,me.image,me.imageTemplateName,Is(me.location),Yl[mp(me.location)].label,qd(me),...me.providers??[]].join(" ").toLowerCase()})),[z]),Ne=b.useMemo(()=>Object.fromEntries(Object.entries(sR).map(([me,Oe])=>{const Me=new Map;for(const Ge of _e)Me.set(Oe(Ge),(Me.get(Oe(Ge))??0)+1);const nt=[...Me.keys()].sort(me==="phase"?(Ge,qe)=>Bv.indexOf(Ge)-Bv.indexOf(qe):ky.compare);return[me,nt.map(Ge=>({value:Ge,label:me==="phase"?kl[Ge].label:Ge,count:Me.get(Ge)}))]})),[_e]),Ae=b.useMemo(()=>{const me=V.trim().toLowerCase(),Oe=q.createdAt?ne-Number(q.createdAt)*864e5:null,Me=_e.filter(Ge=>(!v||os(Ge.sandbox.location)===v)&&Object.entries(sR).every(([qe,ht])=>!q[qe].length||q[qe].includes(ht(Ge)))&&(Oe===null||Date.parse(Ge.sandbox.createdAt)>=Oe)&&(!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 Me.sort((Ge,qe)=>{const ht=nt(Ge),pe=nt(qe);if(!ht&&pe)return 1;if(ht&&!pe)return-1;const De=ky.compare(ht??"",pe??"");return(H.direction==="asc"?De:-De)||ky.compare(Ge.sandbox.name,qe.sandbox.name)})},[_e,q,v,V,H,ne]);b.useEffect(()=>{const me=new Set(z.filter(Oe=>{var Me;return((Me=Oe.location)==null?void 0:Me.connected)&&!u.demo}).map(tr));Q(Oe=>{const Me=new Set([...Oe].filter(nt=>me.has(nt)));return Me.size===Oe.size?Oe:Me})},[z,u.demo]);const J=b.useMemo(()=>z.filter(me=>{var Oe;return((Oe=me.location)==null?void 0:Oe.connected)&&$.has(tr(me))}),[z,$]),re=Ae.filter(me=>{var Oe;return((Oe=me.sandbox.location)==null?void 0:Oe.connected)&&!u.demo}),xe=re.reduce((me,Oe)=>me+Number($.has(tr(Oe.sandbox))),0),he=re.length>0&&xe===re.length,Be=b.useCallback(me=>{var Oe;(Oe=me.location)!=null&&Oe.connected&&Q(Me=>{const nt=new Set(Me),Ge=tr(me);return nt.has(Ge)?nt.delete(Ge):nt.add(Ge),nt})},[]),we=()=>Q(me=>{const Oe=new Set(me);for(const{sandbox:Me}of re)he?Oe.delete(tr(Me)):Oe.add(tr(Me));return Oe});async function Ye(){if(Z.current||u.demo||!(K!=null&&K.length))return;Z.current=!0,U(!0),le([]);const me=new Set,Oe=[];let Me=0;const nt=async()=>{for(;Me<K.length;){const Ge=K[Me++];try{const qe=m.find(ht=>os(ht)===os(Ge.location));if(!(qe!=null&&qe.connected))throw new Error("Location is disconnected. Reconnect before deleting.");await Cr(c!=null&&c.localViewer?qe.target??"local":l.target,l.signal,qe.context).lifecycle(Ge.name,"delete"),me.add(tr(Ge))}catch(qe){Oe.push({key:tr(Ge),name:Ge.name,location:Ge.location,message:qe.message})}}};try{await Promise.all(Array.from({length:Math.min(4,K.length)},nt)),Q(Ge=>new Set([...Ge].filter(qe=>!me.has(qe)))),le(Oe),me.size&&He.success(`Deletion requested for ${Ci(me.size)} ${me.size===1?"sandbox":"sandboxes"}`),Oe.length&&He.error(`${Ci(Oe.length)} ${Oe.length===1?"sandbox could":"sandboxes could"} not be deleted. Review the errors and retry.`),f.refresh()}finally{Z.current=!1,U(!1),se(null)}}const Ee=ox({count:Ae.length,rowHeight:tR});b.useEffect(()=>{Ee.scrollToTop()},[V,q,v,H]);const Ce=b.useMemo(()=>wW(z,30,ne),[z,ne]),be=()=>{B(""),I(Ty)},Ue=_||Object.values(q).some(me=>me.length),Je=z.length===0&&f.loading&&!u.demo,dt=z.length===0&&f.error,lt=G&&(z.find(me=>tr(me)===tr(G))??(G.id==null?z.find(me=>Ph(me)===Ph(G)):null)??G),Ie=lt&&(m.find(me=>os(me)===os(lt.location))??lt.location),ot=lt?{...u,sandboxes:[lt],events:os(Ie)===x?u.events:eR,overview:os(Ie)===x?u.overview:{gateway:{name:Ie==null?void 0:Ie.gateway,workspace:Ie==null?void 0:Ie.workspace,remote:Ie==null?void 0:Ie.remote}},refresh:f.refresh}:null,We=()=>{S(A??null),oe(!0)};return b.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:fQ.filter(me=>["all","running","sleeping"].includes(me)||Re.status[me]>0).map(me=>s.jsxs("button",{"aria-pressed":me==="all"?!q.phase.length:q.phase.length===1&&q.phase[0]===me,onClick:()=>L("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 ${kl[me].bar}`}),me==="all"?"Sandboxes":kl[me].label]}),s.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:s.jsx(rf,{value:me==="all"?Re.total:Re.status[me]})})]},me))}),s.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:s.jsx(SW,{points:Ce,height:34,title:"Boxes · 30d"})})]}),s.jsx("div",{className:"flex h-[3px] shrink-0 overflow-hidden",role:"img","aria-label":Object.entries(Re.status).map(([me,Oe])=>`${Oe} ${kl[me].label}`).join(", "),children:Object.entries(Re.status).map(([me,Oe])=>Oe>0&&s.jsx("span",{className:kl[me].strip,style:{width:`${Oe/Re.total*100}%`}},me))}),f.error&&z.length>0&&s.jsxs(za,{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(xQ,{location:me,onReconnected:f.refresh},os(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(na,{ref:W,value:_,onValueChange:B,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(Dn,{className:"size-3"}),"Clear"]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh sandboxes",onClick:f.refresh,children:s.jsx($a,{className:"size-3.5"})}),s.jsxs(ue,{size:"sm",disabled:!A&&!T,onClick:We,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[s.jsx(us,{className:"size-3.5"}),"New sandbox"]})]}),J.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:Ci(J.length)})," selected",J.length>xe&&s.jsxs("span",{className:"text-muted-foreground",children:[" · ",Ci(J.length-xe)," outside current filters"]})]}),s.jsx(ue,{variant:"ghost",size:"sm",disabled:P,onClick:()=>Q(new Set),children:"Clear selection"}),s.jsxs(ue,{variant:"destructive",size:"sm",disabled:P||u.demo,title:u.demo?"Deletion is unavailable for synthetic preview data":void 0,onClick:()=>se([...J]),children:[s.jsx(Kn,{className:"size-3.5"}),P?"Deleting…":"Delete selected"]})]}),te.length>0&&s.jsxs(za,{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(No,{location:me.location}),": ",me.message]},me.key))})]}),s.jsx("div",{ref:Ee.ref,onScroll:Ee.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:Je?s.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Loading sandboxes…"}):dt?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}}),nR.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(u4,{label:"Select all matching sandboxes",checked:he,mixed:xe>0&&!he,disabled:P||!re.length,onChange:we})}),nR.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(Oe=>({key:me.id,direction:Oe.key===me.id&&Oe.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(uf,{className:"size-3 shrink-0"}):s.jsx(cf,{className:"size-3 shrink-0"}))]}),s.jsx(bQ,{column:me,sort:H,onSort:Oe=>F({key:me.id,direction:Oe}),values:Ne[me.id],value:q[me.id],onFilter:Oe=>L(me.id,Oe)})]})},me.id))]})}),s.jsxs("tbody",{children:[Ee.paddingTop>0&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:8,style:{height:Ee.paddingTop,padding:0,border:0}})}),Ae.slice(Ee.start,Ee.end).map((me,Oe)=>{var Me;return s.jsx(gQ,{row:me,now:ne,index:Ee.start+Oe+2,onOpen:X,selected:$.has(tr(me.sandbox)),onSelect:Be,disabled:P||u.demo||!((Me=me.sandbox.location)!=null&&Me.connected)},tr(me.sandbox))}),Ee.end<Ae.length&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:8,style:{height:(Ae.length-Ee.end)*tR,padding:0,border:0}})})]})]}):s.jsxs("div",{className:"py-20 text-center",children:[s.jsx(Xl,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),s.jsx("p",{className:"text-sm",children:z.length?"No matching sandboxes":"No sandboxes yet"}),s.jsx(ue,{variant:"outline",disabled:!z.length&&!A&&!T,className:"mt-4",onClick:()=>z.length?be():We(),children:z.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:Ci(Ae.length)}),Ue?` of ${Ci(z.length)}`:""," sandboxes"]}),s.jsx("span",{className:"hidden sm:inline",children:"Click a row to inspect · ⌘K to search"})]})]}),lt&&(Ie==null?void 0:Ie.connected)&&s.jsx(Da,{location:Ie,children:s.jsx(UW,{name:lt.name,sandbox:lt,liveData:ot,onClose:()=>X(null),onNavigate:e,onChanged:f.refresh})},tr(lt)),s.jsx(Rr,{open:K!==null,onOpenChange:me=>{!me&&!Z.current&&se(null)},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:["Delete ",Ci((K==null?void 0:K.length)??0)," ",(K==null?void 0:K.length)===1?"sandbox":"sandboxes","?"]}),s.jsx(zr,{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(No,{location:me.location})]},tr(me)))}),s.jsxs(Mr,{children:[s.jsx(Ir,{disabled:P,children:"Cancel"}),s.jsx(Pr,{variant:"destructive",disabled:P||!(K!=null&&K.length),onClick:Ye,children:P?"Deleting…":"Delete sandboxes"})]})]})}),s.jsx(Da,{location:R,children:s.jsx(a4,{open:de,onOpenChange:oe,locations:m,location:R,onLocationChange:S,onRefreshLocations:f.refresh,allowRemote:T})})]})}const gQ=b.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",x=!((j=m.location)!=null&&j.connected),v=`${m.name} at ${Is(m.location)}`;return s.jsxs("tr",{"aria-rowindex":a,"aria-disabled":x||void 0,onClick:()=>{x||l(m)},className:`group transition-colors ${x?"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(u4,{label:`Select ${v}`,checked:c,disabled:f,onChange:()=>u(m)})}),s.jsx("td",{className:`${p} pl-6`,children:s.jsxs("button",{disabled:x,"aria-haspopup":"dialog","aria-label":`Open ${v}`,onClick:S=>{S.stopPropagation(),x||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(Xl,{"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(Mi,{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(K3,{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 ${La(m.phase).bar}`}),Qp[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(c4,{}),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:RK(m,r)})}),s.jsx("td",{className:p,children:s.jsxs("span",{className:"block truncate tabular-nums",title:m.createdAt||"Not reported",children:[w3(m.createdAt,r),m.createdAt?" ago":""]})})]})});function xQ({location:e,onReconnected:t}){const r=Bt(),[a,l]=b.useState({busy:!1,error:null}),c=b.useRef(!0);b.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:[Is(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($a,{className:`size-3 ${a.busy?"animate-spin motion-reduce:animate-none":""}`}),a.busy?"Reconnecting…":"Reconnect"]})]})}function u4({label:e,checked:t,mixed:r=!1,disabled:a,onChange:l}){const c=b.useRef(null);return b.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 bQ({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(Nu,{children:[s.jsx(Cu,{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(GI,{className:"size-3.5 shrink-0"})}),s.jsxs(ku,{align:"start",className:"w-56",children:[s.jsxs(op,{children:[s.jsxs(qs,{className:"text-xs",onClick:()=>r("asc"),children:[s.jsx(uf,{className:"size-3.5"}),"Sort ascending",f==="asc"&&s.jsx(Fn,{className:"ml-auto size-3.5"})]}),s.jsxs(qs,{className:"text-xs",onClick:()=>r("desc"),children:[s.jsx(cf,{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(Hd,{}),s.jsxs(op,{children:[s.jsx($v,{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(Uw,{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=Ey[e.id])==null?void 0:g.call(Ey,h))??h.label}),s.jsx("span",{className:"ml-2 font-mono text-[10px] tabular-nums text-muted-foreground",children:Ci(h.count)})]},h.value)})})]})]}),e.filter==="recent"&&s.jsxs(s.Fragment,{children:[s.jsx(Hd,{}),s.jsxs(op,{children:[s.jsx($v,{className:"text-[11px]",children:"Created"}),s.jsxs(BY,{value:l,onValueChange:c,children:[s.jsx(rE,{value:"",className:"text-xs",children:"Any time"}),mQ.map(h=>s.jsx(rE,{value:h.value,className:"text-xs",children:h.label},h.value))]})]})]}),u&&s.jsxs(s.Fragment,{children:[s.jsx(Hd,{}),s.jsxs(qs,{className:"text-xs",onClick:()=>c(e.filter==="values"?[]:""),children:[s.jsx(Dn,{className:"size-3.5"}),"Clear filter"]})]})]})]})}const Ry=()=>({name:"",url:"",format:"ocsf",auth:"none",token:"",sandboxes:"",category:"",verdict:""}),Ih="h-9 w-full rounded-md border border-border bg-card px-2 text-xs",Ay=e=>e?new Date(e).toLocaleString():"Never";function yQ(){const e=Bt(),[t,r]=b.useState([]),[a,l]=b.useState(Ry),[c,u]=b.useState(!1),[f,m]=b.useState(null),[h,g]=b.useState(null),[p,x]=b.useState(null),[v,j]=b.useState(!1),S=b.useCallback(async()=>{try{r(await e.activityDestinations()),x(null),j(!0)}catch(k){x(k.message)}},[e]);b.useEffect(()=>{S();const k=setInterval(S,5e3);return()=>clearInterval(k)},[S]);const N=k=>({value:a[k],onChange:A=>l(R=>({...R,[k]:A.target.value}))});async function C(k,A){g(k);try{const R=await e.activityDestinationAction(k,A);A==="test"&&He.success(`Test accepted · HTTP ${R.status}`),await S(),m(null)}catch(R){He.error(R.message),await S()}finally{g(null)}}async function T(k){k.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(Ry()),u(!1),await S(),He.success("Webhook saved. Test it, then enable forwarding.")}catch(A){He.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(k=>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:k.name}),s.jsx("span",{className:`text-xs ${k.error?"text-amber-700":"text-muted-foreground"}`,children:k.enabled?k.error?"Retrying":"Enabled":k.error?"Needs attention":"Paused"})]}),s.jsx("p",{className:"break-all font-mono text-[11px] text-muted-foreground",children:k.url}),s.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[k.delivered.toLocaleString()," delivered · ",k.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:[k.format==="ocsf"?"OCSF JSON":"Console JSON"," · ",k.auth==="none"?"No authentication":k.auth==="bearer"?"Bearer token":"API key"]}),s.jsxs("p",{className:"text-xs",children:[k.filters.sandboxes.join(", ")||"All sandboxes"," · ",k.filters.categories.join(", ")||"All event types"," · ",k.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:k.delivered.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-muted-foreground",children:"Pending"}),s.jsx("dd",{className:"mt-1",children:k.backlog.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-muted-foreground",children:"Filtered out"}),s.jsx("dd",{className:"mt-1",children:k.skipped.toLocaleString()})]})]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Last delivery: ",Ay(k.lastDeliveredAt),k.lastStatus?` · HTTP ${k.lastStatus}`:""]}),k.lastTest&&s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Test: ",k.lastTest.ok?`Accepted · HTTP ${k.lastTest.status}`:k.lastTest.error," · ",Ay(k.lastTest.at)]})]})]}),k.error&&s.jsxs("p",{role:"status",className:"text-xs text-amber-700",children:[k.error," · Attempt ",k.attempts,"/8",k.enabled?` · Next retry ${Ay(k.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:()=>C(k.id,"test"),children:"Send test"}),s.jsx(ue,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>C(k.id,k.enabled?"pause":"resume"),children:k.enabled?"Pause":"Enable forwarding"}),k.error&&s.jsx(ue,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>C(k.id,"retry"),children:"Retry now"}),s.jsx(ue,{size:"xs",variant:"ghost",disabled:!!h,onClick:()=>m(k.id),children:"Remove"})]}),f===k.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:()=>C(k.id,"remove"),children:"Remove webhook"}),s.jsx(ue,{size:"xs",variant:"ghost",onClick:()=>m(null),children:"Cancel"})]})]},k.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:T,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(At,{required:!0,maxLength:80,placeholder:"Security monitoring",...N("name")})]}),s.jsxs("label",{className:"block space-y-1 text-xs",children:[s.jsx("span",{children:"HTTPS endpoint"}),s.jsx(At,{required:!0,type:"url",placeholder:"https://logs.example.com/events",...N("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:Ih,...N("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:Ih,...N("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(At,{required:!0,type:"password",autoComplete:"new-password",...N("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(At,{placeholder:"All sandboxes, or comma-separated names",...N("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:Ih,...N("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(([k,A])=>s.jsx("option",{value:k,children:A},k))]})]}),s.jsxs("label",{className:"space-y-1 text-xs",children:[s.jsx("span",{children:"Decision"}),s.jsxs(hn,{className:Ih,...N("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(Ry())},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 d4="1.4.0";function oR(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:d4,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 vQ(e,t="json",r){if(!Array.isArray(r))return t==="ocsf"?oR(e):e;const a=y3(e).values,l=Object.fromEntries(r.filter(u=>Object.hasOwn(a,u)).map(u=>[u,a[u]]));if(t!=="ocsf")return l;const c=oR(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:d4,product:c.metadata.product},unmapped:{openshell:l,time_basis:c.unmapped.time_basis}}}function wQ(e,t,r="json"){const a=e.map(l=>vQ(l,r,t==null?void 0:t.columns));return r==="ocsf"?a:{exportedAt:new Date().toISOString(),context:t,events:a}}function jQ(e,{paused:t,demo:r,activityRevision:a}){const l=Bt(),c=b.useRef(t);c.current=t;const u=JSON.stringify(e),[f,m]=b.useState({events:[],total:0,nextOffset:null}),[h,g]=b.useState(0),[p,x]=b.useState(null),[v,j]=b.useState(!1),[S,N]=b.useReducer(A=>A+1,0),C=b.useRef(0),T=b.useRef(0);return b.useEffect(()=>{const A=++C.current;if(r)return;let R=!0;const M=async(O=!1)=>{const z=++T.current;j(!0);try{const _=await l.activity(JSON.parse(u));R&&C.current===A&&z===T.current&&(!O||!c.current)&&(m(_),x(null))}catch(_){R&&z===T.current&&x(_.message)}finally{R&&z===T.current&&j(!1)}};g(0),m({events:[],total:0,nextOffset:null}),M();const E=setInterval(()=>{c.current||M(!0)},5e3);return()=>{R=!1,clearInterval(E)}},[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 R=C.current,M=++T.current;j(!0);try{const E=await l.activity({...JSON.parse(u),snapshot:f.snapshot,offset:A*e.limit,now:f.now});R===C.current&&M===T.current&&(m(E),g(A),x(null))}catch(E){R===C.current&&M===T.current&&x(E.message)}finally{R===C.current&&M===T.current&&j(!1)}},refresh:N}}const Sl=50,_h=[{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}],SQ=Object.fromEntries(Jg.map(e=>[e.name,{name:e.name,logo:`/logos/agents/${e.logo}.svg`}])),Lh={all:"Available history",15:"Last 15 minutes",60:"Last hour",1440:"Last 24 hours",custom:"Custom range"},nr="h-8 rounded-md border border-border bg-card px-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",NQ=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 Oy({options:e,selected:t,onChange:r,label:a}){const[l,c]=b.useState(""),u=b.useDeferredValue(l),f=b.useMemo(()=>e.filter(g=>g.toLowerCase().includes(u.toLowerCase())),[e,u]),m=ox({count:f.length,rowHeight:32});b.useEffect(()=>{m.scrollToTop()},[u]);const h=new Set(t);return s.jsxs(s.Fragment,{children:[s.jsx(na,{"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 $h(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 CQ(){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),f4(t)}catch{return{}}}function f4(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 kQ(){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 TQ(e,t,r){const a=new Blob([JSON.stringify(wQ(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 EQ(){const e=Cn();return s.jsx(RQ,{},(e==null?void 0:e.id)??(e==null?void 0:e.context)??"default")}function RQ(){var Ct,ct,vt;const e=Bt(),t=Cn(),r=l4(Ga()),[a]=b.useState(CQ),[l,c]=b.useState(["time","sandbox","agent","action","verdict","destination"]),u=_h.filter(ae=>l.includes(ae.id)),[f,m]=b.useState(kQ),[h,g]=b.useState(""),[p,x]=b.useState(!1),[v,j]=b.useState("columns"),[S,N]=b.useState(null),[C,T]=b.useState(!1),[k,A]=b.useState(null),[R,M]=b.useState(Date.now),[E,O]=b.useState(a.query??""),[z,_]=b.useState(a.direction??"all"),[B,q]=b.useState(a.sandboxes??[]),[I,L]=b.useState(a.agents??[]),[H,F]=b.useState(a.verdicts??[]),[V,G]=b.useState(a.filters??{}),[X,$]=b.useState(a.range??"all"),[Q,K]=b.useState($h(a.from)),[se,P]=b.useState($h(a.to)),[U,Z]=b.useState(a.sort??{key:"time",direction:"desc"}),[te,le]=b.useState(null),[de,oe]=b.useState(()=>new Set),[ne,ee]=b.useState(null),[W,ce]=b.useState(!1),[Re,_e]=b.useState(null),Ne=b.useDeferredValue(E),Ae={query:Ne,direction:z,sandboxes:B,verdicts:H,agents:I,filters:V,range:X,from:Q&&Number.isFinite(Date.parse(Q))?new Date(Q).toISOString():Q,to:se&&Number.isFinite(Date.parse(se))?new Date(se).toISOString():se,sort:U},J=JSON.stringify(Ae),[re,xe]=b.useState({query:J,page:0}),he=jQ({...Ae,limit:Sl},{paused:!!k,demo:r.demo,activityRevision:r.activityRevision});b.useEffect(()=>{oe(new Set),le(null)},[r.activityRevision]),b.useEffect(()=>{oe(new Set)},[Ne,z,B,H,I,V,X,Q,se]);async function Be(ae,Xe){lt(),ce(!0),_e(null);try{const ut=await e.previewActivityDeletion({mode:ae,ids:Xe||[...de],query:Ae});ee(ut)}catch(ut){He.error(ut.message)}finally{ce(!1)}}async function we(){ce(!0),_e(null);try{const ae=await e.deleteActivity(ne.token);ee(null),le(null),oe(new Set),A([]),he.refresh(),r.refresh(),He.success(`Deleted ${ae.deleted.toLocaleString()} log${ae.deleted===1?"":"s"}`)}catch(ae){_e(ae.message)}finally{ce(!1)}}function Ye(ae){lt(),oe(Xe=>{const ut=new Set(Xe);return ut.has(ae)?ut.delete(ae):ut.size<5e3&&ut.add(ae),ut})}const Ee=r.demo?k??r.events:he.events;function Ce(ae){ae=f4(ae),lt(),O(ae.query||""),_(ae.direction||"all"),q(ae.sandboxes||[]),F(ae.verdicts||[]),L(ae.agents||[]),G(ae.filters||{}),$(ae.range||"all"),K($h(ae.from)),P($h(ae.to)),Z(ae.sort||{key:"time",direction:"desc"})}function be(ae,Xe){Ce({filters:{[ae]:{mode:"equals",value:Xe}}}),le(null)}function Ue(ae){N({format:ae,columns:[...l],range:X,from:Q,to:se})}const Je=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 dt(){if(!S||Je)return;const{format:ae,columns:Xe,range:ut,from:Ft,to:An}=S,zt={...Ae,columns:Xe,range:ut,from:Ft?new Date(Ft).toISOString():"",to:An?new Date(An).toISOString():""};T(!0);try{if(r.demo){TQ(cE(ot,{...zt,now:R}).map(On=>On.event),{...zt,demo:!0},ae),N(null);return}const _t=document.createElement("a");_t.href=e.url("/activity/export",{format:ae,query:JSON.stringify(zt),context:await e.contextKey(),...t?{location:"1"}:{}}),_t.download=ae==="ocsf"?"openshell-activity-ocsf.json":"openshell-activity.json",document.body.appendChild(_t),_t.click(),_t.remove(),N(null)}catch(_t){He.error(`Export failed: ${_t.message}`)}finally{T(!1)}}const lt=()=>{k||(A(Ee),M(Date.now()))},Ie=ae=>Xe=>{lt(),ae(Xe)},ot=b.useMemo(()=>Ee.map(y3),[Ee]),We=b.useMemo(()=>[...new Set([...(r.sandboxes??[]).map(ae=>ae.name),...he.sandboxes??[],...Ee.map(ae=>ae.sandbox),...B].filter(Boolean))].sort(),[r.sandboxes,he.sandboxes,Ee,B]),me=b.useMemo(()=>[...new Set(r.demo?ot.map(ae=>ae.values.agent):he.agents??ot.map(ae=>ae.values.agent))].filter(Boolean).sort((ae,Xe)=>ae.localeCompare(Xe)),[r.demo,ot,he.agents]),Oe=X==="custom"&&(!Q&&!se||Q&&se&&Date.parse(Q)>Date.parse(se)),Me=b.useMemo(()=>Oe?[]:r.demo?cE(ot,{query:Ne,direction:z,sandboxes:B,verdicts:H,agents:I,filters:V,range:X,from:Q,to:se,now:R,sort:U}):ot,[ot,Ne,z,B,H,I,V,X,Q,se,R,U,Oe,r.demo]),nt=Oe?0:r.demo?Me.length:he.total||0,Ge=Math.max(1,Math.ceil(nt/Sl)),qe=r.demo?Math.min(re.query===J?re.page:0,Ge-1):he.page,ht=r.demo?Me.slice(qe*Sl,(qe+1)*Sl):Me;function pe(ae){lt(),oe(new Set),le(null),r.demo?xe({query:J,page:ae}):he.goToPage(ae)}const De=ox({count:ht.length,rowHeight:48});b.useEffect(()=>{De.scrollToTop()},[Ne,z,B,H,I,V,X,Q,se,U,qe]);const Qe=b.useMemo(()=>{if(!k)return 0;const ae=new Set(k.map(of));return r.events.filter(Xe=>!ae.has(of(Xe))).length},[k,r.events]),Fe=ht.filter(ae=>ae.values.verdict==="denied").length,yt=ht.filter(ae=>ae.values.verdict==="allowed").length,Et=E||B.length||H.length||I.length||z!=="all"||X!=="all"||Object.values(V).some(ae=>ae.value);function Nt(){lt(),O(""),_("all"),q([]),F([]),L([]),G({}),$("all"),K(""),P("")}const Vt=[...z!=="all"?[{label:`Direction: ${z}`,clear:()=>_("all")}]:[],...E?[{label:`Search: ${E}`,clear:()=>O("")}]:[],...B.length?[{label:`${B.length} sandbox${B.length===1?`: ${B[0]}`:"es"}`,clear:()=>q([])}]:[],...I.length?[{label:`Observed agents: ${I.join(", ")}`,clear:()=>L([])}]:[],...H.length?[{label:`Decision: ${H.join(", ")}`,clear:()=>F([])}]:[],...X!=="all"?[{label:Lh[X],clear:()=>$("all")}]:[],...Object.entries(V).filter(([,ae])=>ae.value).map(([ae,Xe])=>{var ut;return{label:`${((ut=_h.find(Ft=>Ft.id===ae))==null?void 0:ut.label)??ae}${ae==="agent"?"":` ${Xe.mode}`}: ${Xe.value}`,clear:()=>G(Ft=>({...Ft,[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(na,{"aria-label":"Search activity",placeholder:"Search activity…",value:E,onValueChange:Ie(O),className:"min-w-44 flex-1 basis-full sm:basis-44"}),s.jsxs(up,{children:[s.jsxs(dp,{className:`${nr} flex items-center gap-2 hover:bg-muted`,children:[s.jsx(fC,{className:"size-3.5"}),"Filters",(X!=="all"||z!=="all"||B.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")+ +(z!=="all")+ +(B.length>0)+ +(H.length>0)+Object.values(V).filter(ae=>ae.value).length})]}),s.jsxs(fp,{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:nr,value:X,onChange:ae=>Ie($)(ae.target.value),children:Object.entries(Lh).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:nr,value:z,onChange:ae=>Ie(_)(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:nr,value:((Ct=V.category)==null?void 0:Ct.value)||"",onChange:ae=>Ie(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:nr,value:((ct=V.severity)==null?void 0:ct.value)||"",onChange:ae=>Ie(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:nr,value:((vt=V.logLevel)==null?void 0:vt.value)||"",onChange:ae=>Ie(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:()=>Ie(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(Oy,{label:"Sandboxes",options:We,selected:B,onChange:Ie(q)})]})]})]}),s.jsxs(up,{children:[s.jsxs(dp,{className:`${nr} flex items-center gap-2 hover:bg-muted`,children:[s.jsx(v6,{className:"size-3.5"}),"View",s.jsx(Qo,{className:"size-3"})]}),s.jsxs(fp,{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:_h.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(ut=>ut!==ae.id))}),ae.label]},ae.id))}):s.jsxs("div",{className:"flex max-h-80 flex-col gap-3 overflow-auto",children:[s.jsx(At,{"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(""),He.success("View saved in this browser")}catch{He.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:()=>Ce(ae.query),children:ae.name}),s.jsx("button",{"aria-label":`Delete view ${ae.name}`,onClick:()=>{try{const Xe=f.filter(ut=>ut.name!==ae.name);localStorage.setItem("openshell.activity.views",JSON.stringify(Xe)),m(Xe)}catch{He.error("Could not delete view")}},children:s.jsx(Dn,{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(Nu,{children:[s.jsxs(Cu,{"aria-label":"Activity actions",className:`${nr} flex items-center gap-2 hover:bg-muted`,children:["Actions",s.jsx(Qo,{className:"size-3"})]}),s.jsxs(ku,{align:"end",className:"w-60",children:[s.jsxs(qs,{disabled:C||!!Oe,onClick:()=>Ue("json"),children:[s.jsx(Wc,{}),"Export Console JSON"]}),s.jsxs(qs,{disabled:C||!!Oe,onClick:()=>Ue("ocsf"),children:[s.jsx(Wc,{}),"Export OCSF JSON"]}),s.jsxs(qs,{onClick:()=>x(!0),children:[s.jsx(gC,{}),"Webhooks"]}),!r.demo&&s.jsxs(s.Fragment,{children:[s.jsx(Hd,{}),s.jsxs(qs,{disabled:W||!de.size,variant:"destructive",onClick:()=>Be("selected"),children:[s.jsx(Kn,{}),"Delete selected logs",de.size?` (${de.size})`:""]}),s.jsxs(qs,{disabled:W||!!Oe||he.loading||!he.total,variant:"destructive",onClick:()=>Be("matching"),children:[s.jsx(Kn,{}),"Delete matching logs"]}),s.jsxs(qs,{disabled:W,variant:"destructive",onClick:()=>Be("all"),children:[s.jsx(Kn,{}),"Delete all logs"]})]})]})]})]}),(he.error||r.historyError)&&!r.demo&&s.jsx(za,{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:nr,value:Q,onInput:ae=>Ie(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:nr,value:se,onInput:ae=>Ie(P)(ae.currentTarget.value)})]}),s.jsx("span",{className:"text-muted-foreground",children:Intl.DateTimeFormat().resolvedOptions().timeZone}),Oe&&s.jsx("span",{role:"alert",className:"text-red-600",children:"Choose a start or end time; the end must follow the start."})]}),!!Et&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border px-6 py-2",children:[Vt.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(Dn,{className:"size-3 shrink-0"})]},ae.label)),s.jsx(ue,{size:"xs",variant:"ghost",onClick:Nt,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:[yt.toLocaleString()," allowed · ",s.jsxs("span",{className:Fe?"text-red-600":"",children:[Fe.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:()=>{k?(A(null),xe({query:J,page:0}),M(Date.now()),he.refresh(),De.scrollToTop()):lt()},children:[k?s.jsx(qR,{className:"size-3"}):s.jsx(r6,{className:"size-3"}),k?"Resume":"Pause"]}),k&&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&&!Qe,onClick:()=>{A(r.demo?r.events:Ee),M(Date.now()),he.refresh(),De.scrollToTop()},children:r.demo?`${Qe.toLocaleString()} new events`:"Refresh"})]}),de.size>0&&s.jsxs("span",{className:"flex items-center gap-2",children:[de.size.toLocaleString()," selected",s.jsx("button",{className:"underline",onClick:()=>oe(new Set),children:"Clear selection"})]}),s.jsx("span",{className:"ml-auto",children:Intl.DateTimeFormat().resolvedOptions().timeZone})]}),s.jsxs("div",{ref:De.ref,onScroll:ae=>{De.onScroll(ae),ae.currentTarget.scrollTop>0&<()},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":ht.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:!ht.length||ht.length>5e3,checked:ht.length>0&&ht.every(ae=>de.has(ae.key)),ref:ae=>{ae&&(ae.indeterminate=ht.some(Xe=>de.has(Xe.key))&&!ht.every(Xe=>de.has(Xe.key)))},onChange:ae=>{lt(),oe(ae.target.checked?new Set(ht.map(Xe=>Xe.key)):new Set)}})}),u.map(ae=>{var Xe,ut,Ft,An;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:()=>Ie(Z)({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(uf,{className:"size-3"}):s.jsx(cf,{className:"size-3"}))]}),s.jsxs(up,{children:[s.jsx(dp,{"aria-label":`Filter ${ae.label}`,className:`rounded p-1 hover:bg-accent ${(ae.id==="time"?X!=="all":ae.id==="sandbox"?B.length:ae.id==="verdict"?H.length:ae.id==="agent"?I.length||(Xe=V.agent)!=null&&Xe.value:(ut=V[ae.id])!=null&&ut.value)?"bg-accent text-foreground":""}`,children:s.jsx(fC,{className:"size-3"})}),s.jsxs(fp,{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:I.length?`${I.length} selected`:"All agents"}),s.jsx("button",{className:"underline",onClick:()=>{lt(),L([]),G(({agent:zt,..._t})=>_t)},children:"Clear"})]}),me.map(zt=>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:I.includes(zt),onChange:()=>{lt(),G(({agent:_t,...On})=>On),L(_t=>_t.includes(zt)?_t.filter(On=>On!==zt):[..._t,zt])},className:"accent-foreground"}),s.jsx(pp,{agent:SQ[zt]??{name:zt}})]},zt)),!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(Oy,{label:"Sandboxes",options:We,selected:B,onChange:Ie(q)}):ae.id==="verdict"?s.jsx(Oy,{label:"Decisions",options:["allowed","denied","not reported","not applicable"],selected:H,onChange:Ie(F)}):ae.id==="time"?s.jsxs(s.Fragment,{children:[s.jsx(hn,{"aria-label":"Filter time",className:nr,value:X,onChange:zt=>Ie($)(zt.target.value),children:Object.entries(Lh).map(([zt,_t])=>s.jsx("option",{value:zt,children:_t},zt))}),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:nr,value:((Ft=V[ae.id])==null?void 0:Ft.mode)??"contains",onChange:zt=>{var _t;return Ie(G)({...V,[ae.id]:{value:((_t=V[ae.id])==null?void 0:_t.value)??"",mode:zt.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(At,{"aria-label":`${ae.label} filter value`,placeholder:`Filter ${ae.label.toLowerCase()}…`,value:((An=V[ae.id])==null?void 0:An.value)??"",onChange:zt=>{var _t;return Ie(G)({...V,[ae.id]:{mode:((_t=V[ae.id])==null?void 0:_t.mode)??"contains",value:zt.target.value}})},className:"h-8 text-xs"})]})]})]})]})},ae.id)})]})}),s.jsxs("tbody",{children:[De.paddingTop>0&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:u.length+(r.demo?0:1),style:{height:De.paddingTop,padding:0}})}),ht.slice(De.start,De.end).map((ae,Xe)=>s.jsxs("tr",{"aria-rowindex":De.start+Xe+2,onClick:()=>{lt(),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:ut=>ut.stopPropagation(),children:s.jsx("input",{type:"checkbox","aria-label":`Select log ${ae.values.sandbox} ${ae.values.time}`,checked:de.has(ae.key),disabled:!de.has(ae.key)&&de.size>=5e3,onChange:()=>Ye(ae.key)})}),u.map(ut=>s.jsx("td",{className:`h-12 border-b border-border/60 px-3 py-0 font-mono text-[11px] ${ut.id==="verdict"?ae.values.verdict==="denied"?"text-red-600":ae.values.verdict==="allowed"?"text-emerald-700":"text-muted-foreground":ut.id==="destination"?"text-foreground":"text-muted-foreground"}`,children:ut.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:Ft=>{Ft.stopPropagation(),lt(),le(ae)},children:NQ(ae.values.time)}):ut.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"})]}):ut.id==="agent"&&ae.agent?s.jsx("span",{className:"font-sans text-foreground",children:s.jsx(pp,{agent:ae.agent})}):s.jsx("span",{className:"block truncate",title:ae.values[ut.id],children:ae.values[ut.id]||"-"})},ut.id))]},ae.key)),De.end<ht.length&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:u.length+(r.demo?0:1),style:{height:(ht.length-De.end)*48,padding:0}})})]})]}),!ht.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…":Oe?"Set a valid time range":Et?"No matching events in available history":"No activity available"}),!!Et&&s.jsx(ue,{variant:"outline",size:"sm",className:"mt-3",onClick:Nt,children:"Clear filters"})]})]}),nt>Sl&&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:[(qe*Sl+1).toLocaleString(),"-",Math.min((qe+1)*Sl,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:qe===0||!r.demo&&he.loading,onClick:()=>pe(0),children:"First"}),s.jsx(ue,{variant:"outline",size:"sm","aria-label":"Previous page",disabled:qe===0||!r.demo&&he.loading,onClick:()=>pe(qe-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 ${qe+1} of ${Ge.toLocaleString()}`}),s.jsx(ue,{variant:"outline",size:"sm","aria-label":"Next page",disabled:qe>=Ge-1||!r.demo&&he.loading,onClick:()=>pe(qe+1),children:"Next"}),s.jsx(ue,{variant:"outline",size:"sm","aria-label":"Last page",disabled:qe>=Ge-1||!r.demo&&he.loading,onClick:()=>pe(Ge-1),children:"Last"})]})]})]}),s.jsx(bn,{open:!!S,onOpenChange:ae=>{ae||N(null)},children:s.jsxs(yn,{className:"sm:max-w-md max-h-[85vh] overflow-y-auto",children:[s.jsxs(jn,{children:[s.jsxs(vn,{children:["Export ",(S==null?void 0:S.format)==="ocsf"?"OCSF JSON":"Console JSON"]}),s.jsx($n,{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:nr,value:S.range,onChange:ae=>N({...S,range:ae.target.value}),children:Object.entries(Lh).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:nr+" w-full min-w-0",value:S[ae],onChange:Xe=>N({...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:_h.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=>N({...S,columns:Xe.target.checked?[...S.columns,ae.id]:S.columns.filter(ut=>ut!==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."}),Je&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Choose at least one column and a valid time frame."}),s.jsxs(Co,{children:[s.jsx(ue,{variant:"outline",onClick:()=>N(null),children:"Cancel"}),s.jsxs(ue,{disabled:C||Je,onClick:dt,children:[s.jsx(Wc,{}),C?"Exporting…":"Export"]})]})]})]})}),s.jsx(Rr,{open:!!ne,onOpenChange:ae=>{!ae&&!W&&ee(null)},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsx(Dr,{children:(ne==null?void 0:ne.mode)==="all"?"Delete all retained logs?":(ne==null?void 0:ne.mode)==="matching"?"Delete matching logs?":"Delete selected logs?"}),s.jsxs(zr,{children:[ne==null?void 0:ne.count.toLocaleString()," log",(ne==null?void 0:ne.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:[(ne==null?void 0:ne.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."]}),Re&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:Re}),s.jsxs(Mr,{children:[s.jsx(Ir,{disabled:W,children:"Cancel"}),s.jsx(Pr,{variant:"destructive",disabled:W||!(ne!=null&&ne.count)||!!Re,onClick:we,children:W?"Deleting…":`Delete ${ne==null?void 0:ne.count.toLocaleString()} log${(ne==null?void 0:ne.count)===1?"":"s"}`})]})]})}),s.jsx(Gl,{open:p,onOpenChange:x,children:s.jsxs(du,{className:"gap-0 data-[side=right]:w-full sm:data-[side=right]:max-w-2xl",children:[s.jsxs(fu,{className:"border-b border-border pr-12",children:[s.jsxs(mu,{className:"flex items-center gap-2",children:[s.jsx(gC,{"aria-hidden":"true",className:"size-4 text-muted-foreground",strokeWidth:1.5}),"Webhooks"]}),s.jsx(hu,{children:"Send activity to an HTTPS endpoint."})]}),p&&s.jsx(yQ,{})]})}),s.jsx(Gl,{open:!!te,onOpenChange:ae=>{ae||le(null)},children:s.jsxs(du,{className:"w-full gap-0 sm:max-w-lg",children:[s.jsxs(fu,{className:"border-b border-border pr-12",children:[s.jsx(mu,{children:"Event details"}),s.jsx(hu,{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,ut])=>s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>be(ae,Xe),children:ut},ae))}),!r.demo&&s.jsxs(ue,{size:"sm",variant:"destructive",disabled:W,onClick:()=>Be("selected",[te.key]),children:[s.jsx(Kn,{}),"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(pp,{agent:te.agent}):Xe||"-"}),Xe&&s.jsx(aR,{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(aR,{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 aR({label:e,value:t}){const[r,a]=b.useState(!1);return b.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{He.error("Could not copy to clipboard")}},children:r?s.jsx(Fn,{className:"size-3.5"}):s.jsx(df,{className:"size-3.5"})})}const Oi=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,iR="groups-show-sandboxes";function AQ(e){try{sessionStorage.setItem(ql,JSON.stringify(e))}catch{}}function tg(e,t){var r,a;(r=e.failed)!=null&&r.length?He.warning(`${t}. ${Oi(e.failed.length,"sandbox","sandboxes")} could not be updated`,{description:e.failed.map(l=>`${l.sandbox}: ${l.error}`).join(`
|
|
520
|
-
`)}):He.success(t,{description:(a=e.applied)!=null&&a.length?`Network access updated in ${Oi(e.applied.length,"sandbox","sandboxes")}.`:void 0})}function OQ({policy:e,onClick:t}){const r=e.action==="block"?Jv:xu;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 MQ({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 DQ=[{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 zQ({onCreate:e,onPolicy:t}){return s.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[s.jsx(Ko,{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(Ra,{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"}),DQ.map((r,a)=>s.jsx(Ko,{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(Ko,{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(us,{}),"Create your first group"]}),s.jsxs(ue,{variant:"ghost",onClick:t,className:"text-muted-foreground",children:["Network rules",s.jsx(Py,{})]})]})})]})}function PQ({open:e,onOpenChange:t,groups:r,sandboxes:a,assignments:l,onCreated:c}){const u=Bt(),[f,m]=b.useState(""),[h,g]=b.useState(""),[p,x]=b.useState([]),[v,j]=b.useState(!1),[S,N]=b.useState(null);b.useEffect(()=>{e&&(m(""),g(""),x([]),N(null))},[e]);const C=UM(f),T=r.some(R=>R.id===C),k=R=>So({assignments:l},R).map(M=>{var E;return(E=r.find(O=>O.id===M))==null?void 0:E.name}).filter(Boolean).join(", ");async function A(R){R.preventDefault(),j(!0),N(null);try{const{group:M}=await u.saveGroup({id:C,name:f.trim(),description:h.trim(),isNew:!0});let E=null;if(p.length)try{E=await u.setGroupMembers(p,[M.id],"add")}catch(O){He.warning(`Created ${M.name}, but could not add sandboxes`,{description:O.message})}t(!1),c(M,E,p.length)}catch(M){N(M.message)}finally{j(!1)}}return s.jsx(bn,{open:e,onOpenChange:t,children:s.jsx(yn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:s.jsxs("form",{onSubmit:A,className:"grid gap-4",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:"New group"}),s.jsx($n,{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(At,{id:"group-name",value:f,onChange:R=>m(R.target.value),placeholder:"Frontend",className:"text-xs",required:!0,autoFocus:!0}),T&&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(_f,{id:"group-description",rows:2,value:h,onChange:R=>g(R.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(R=>{const M=p.includes(R.name),E=k(R.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:()=>x(O=>M?O.filter(z=>z!==R.name):[...O,R.name]),className:"size-3.5"}),s.jsx("span",{className:Le("size-1.5 shrink-0 rounded-full",La(R.phase).cell),"aria-hidden":"true"}),s.jsx("span",{className:"truncate font-mono",children:R.name}),E&&s.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-muted-foreground",children:`also in ${E}`})]})},R.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(Co,{children:[s.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),s.jsxs(ue,{type:"submit",disabled:v||!C||T,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[v&&s.jsx(Dt,{"aria-hidden":"true"}),"Create group",p.length?` with ${Oi(p.length,"sandbox","sandboxes")}`:""]})]})]})})})}function IQ({group:e,org:t,sandboxes:r,onClose:a,onChanged:l,onPolicy:c}){const u=Bt(),[f,m]=b.useState(""),[h,g]=b.useState(""),[p,x]=b.useState(!1),[v,j]=b.useState(!1);if(b.useEffect(()=>{e&&(m(e.name),g(e.description))},[e]),!e)return s.jsx(Gl,{open:!1,onOpenChange:()=>{}});const S=t.members[e.id]??[],N=HM(t.policies,e.id),C=t.policies.filter(O=>O.appliesTo.everyone),T=r.filter(O=>!S.includes(O.name)),k=O=>So(t,O).map(z=>{var _;return(_=t.groups.find(B=>B.id===z))==null?void 0:_.name}).filter(Boolean).join(", "),A=f.trim()!==e.name||h.trim()!==e.description;async function R(){x(!0);try{await u.saveGroup({...e,name:f.trim()||e.name,description:h.trim()}),He.success(`Saved ${f.trim()||e.name}`),l()}catch(O){He.error(O.message)}finally{x(!1)}}async function M(O,z){x(!0);try{tg(await u.setGroupMembers(O,[e.id],z?"add":"remove"),z?`Added ${O.join(", ")} to ${e.name}`:`Removed ${O.join(", ")} from ${e.name}`),l()}catch(_){He.error(_.message)}finally{x(!1)}}async function E(){x(!0);try{tg(await u.deleteGroup(e.id),`Deleted ${e.name}`),a(),l()}catch(O){He.error(O.message)}finally{x(!1),j(!1)}}return s.jsx(Gl,{open:!0,onOpenChange:O=>{O||a()},children:s.jsxs(du,{className:"w-full! overflow-y-auto sm:max-w-[460px]!",children:[s.jsxs(fu,{className:"border-b p-6",children:[s.jsxs(mu,{className:"flex items-center gap-2 text-base",children:[s.jsx(Ra,{className:"size-4 text-muted-foreground",strokeWidth:1.5}),e.name]}),s.jsxs(hu,{children:[Oi(S.length,"sandbox","sandboxes")," · ",Oi(N.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(At,{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(_f,{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:R,children:[p&&s.jsx(Dt,{}),"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 z=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",La(z==null?void 0:z.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(Dn,{})})]},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."]}),T.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"}),T.map(O=>s.jsxs("option",{value:O.name,children:[O.name,k(O.name)?` (also in ${k(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"}),N.length?s.jsx("div",{className:"flex flex-wrap gap-1.5",children:N.map(O=>s.jsx(OQ,{policy:O,onClick:()=>c({edit:O.id})},O.id))}):s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No network rules yet."}),C.length>0&&s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Also, like every sandbox: ",C.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(us,{}),"Add rule for ",e.name]})]}),s.jsxs("section",{className:"border-t border-border pt-4",children:[(S.length>0||N.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||N.length>0,onClick:()=>j(!0),children:[s.jsx(Kn,{}),"Delete group"]})]})]}),s.jsx(Rr,{open:v,onOpenChange:j,children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:["Delete ",e.name,"?"]}),s.jsx(zr,{children:"This empty group will be deleted."})]}),s.jsxs(Mr,{children:[s.jsx(Ir,{children:"Cancel"}),s.jsx(Pr,{variant:"destructive",onClick:E,children:"Delete group"})]})]})})]})})}function _Q({group:e,members:t,policies:r,onOpen:a,delay:l}){return s.jsx(Ko,{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(Ra,{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(Jr,{className:"size-3.5 shrink-0 text-faint transition-transform group-hover/card:translate-x-0.5","aria-hidden":"true"})]}),s.jsx(MQ,{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 LQ({onNavigate:e}){const t=Bt(),r=Ga(),[a,l]=b.useState(null),[c,u]=b.useState(!1),[f,m]=b.useState(null),[h,g]=b.useState(""),[p,x]=b.useState([]),[v,j]=b.useState([]),[S,N]=b.useState(!1),[C,T]=b.useState(()=>{try{return localStorage.getItem(iR)==="1"}catch{return!1}}),k=()=>T(H=>{try{localStorage.setItem(iR,H?"0":"1")}catch{}return!H}),A=b.useCallback(async()=>{try{l(await t.org())}catch(H){l({error:H.message})}},[]);b.useEffect(()=>{A()},[A]);const R=b.useMemo(()=>[...r.sandboxes??[]].filter(H=>H.phase!=="deleting").sort((H,F)=>H.name.localeCompare(F.name)),[r.sandboxes]),M=H=>{AQ(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 E=a.groups,O=a.assignments??{},z=R.filter(H=>So(a,H.name).length).length,_=h.trim().toLowerCase(),B=R.filter(H=>!_||H.name.includes(_)||E.some(F=>So(a,H.name).includes(F.id)&&F.name.toLowerCase().includes(_))),q=B.length>0&&B.every(H=>p.includes(H.name));async function I(H,F,V="replace"){N(!0);try{tg(await t.setGroupMembers(H,F,V),`Updated groups for ${Oi(H.length,"sandbox","sandboxes")}`),x([]),await A()}catch(G){He.error(G.message)}finally{N(!1)}}const L=s.jsx(PQ,{open:c,onOpenChange:u,groups:E,sandboxes:R,assignments:O,onCreated:async(H,F,V)=>{F?tg(F,`Created ${H.name} with ${Oi(V,"sandbox","sandboxes")}`):He.success(`Created ${H.name}`,{description:"Add sandboxes and network rules to it in any order."}),await A(),m(H.id)}});return E.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:E.length},{label:"In a group",value:z},{label:"No group",value:R.length-z}].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(rf,{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(us,{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:[E.map((H,F)=>s.jsx(_Q,{group:H,members:a.members[H.id]??[],policies:HM(a.policies,H.id),onOpen:()=>m(H.id),delay:F*.04},H.id)),s.jsx(Ko,{delay:E.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(us,{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:k,"aria-expanded":C,className:"flex items-center gap-1.5 rounded text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx(Jr,{className:Le("size-3.5 text-muted-foreground transition-transform",C&&"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:R.length}),R.length-z>0&&s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["· ",R.length-z," not in a group"]})]}),C&&s.jsx(na,{value:h,onValueChange:g,placeholder:"Search sandbox or group…","aria-label":"Search sandboxes",className:"ml-auto w-full sm:w-56"})]}),C&&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"}),Oi(p.length,"sandbox","sandboxes")," selected",s.jsx("fieldset",{disabled:S,className:"min-w-0",children:s.jsx(sf,{multiple:!0,allowCreate:!1,groups:E,value:v,onChange:j})}),s.jsx(ue,{variant:"outline",size:"sm",disabled:S||!v.length,onClick:()=>I(p,v,"add"),children:"Add to groups"}),s.jsx(ue,{variant:"outline",size:"sm",disabled:S||!v.length,onClick:()=>I(p,v,"remove"),children:"Remove from groups"}),s.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>x([]),children:"Clear"}),S&&s.jsx(Dt,{"aria-hidden":"true"})]}),R.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:()=>x(q?[]:B.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(rg,{className:"size-3","aria-hidden":"true"}),"Network rules"]})]}),s.jsxs("ul",{className:"divide-y divide-border/60 bg-card",children:[B.map(H=>{var X;const F=So(a,H.name),V=mq(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:()=>x($=>G?$.filter(Q=>Q!==H.name):[...$,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]",La(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(sf,{multiple:!0,allowCreate:!1,groups:E,value:F,onChange:$=>{const Q=$.filter(se=>!F.includes(se)),K=F.filter(se=>!$.includes(se));I([H.name],Q.length?Q:K,Q.length?"add":"remove")}})}),s.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:V.map($=>$.name).join(`
|
|
521
|
-
`),children:V.length?V.map($=>$.name).join(", "):s.jsx("span",{className:"text-faint",title:"Its policy and agent rules still apply",children:"No network rules"})})]},H.name)}),!B.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."})]})]}),L,s.jsx(IQ,{group:E.find(H=>H.id===f)??null,org:a,sandboxes:R,onClose:()=>m(null),onChanged:A,onPolicy:M})]}):s.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[s.jsx(zQ,{onCreate:()=>u(!0),onPolicy:()=>e("egress")}),L]})}const $Q=({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}})}),BQ=[{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 UQ(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 HQ(e=3e4){const[t,r]=b.useState(Date.now());return b.useEffect(()=>{const a=setInterval(()=>r(Date.now()),e);return()=>clearInterval(a)},[e]),t}function m4({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:BQ.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 FQ({text:e}){const[t,r]=b.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(df,{className:"size-3.5"})})}function GQ({service:e,visits:t,now:r,onChanged:a,remote:l}){var v;const c=Bt(),[u,f]=b.useState(null),[m,h]=b.useState(!1),g=e.name||"default",p=t.filter(j=>j.verdict==="denied").length;async function x(j,S,N){f(j);try{await S(),He.success(N),a()}catch(C){He.error(C.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($Q,{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(Kv,{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(pC,{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 ",UQ(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(FQ,{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(CI,{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(m4,{value:void 0,onChange:j=>x("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(Dn,{})})]}):s.jsxs(ue,{size:"xs",variant:"ghost",onClick:()=>h(!0),disabled:!!u,children:[s.jsx(pC,{}),"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:()=>x("close",()=>c.closeService(e),`Closed ${g}`),children:[u==="close"?s.jsx(Dt,{}):s.jsx(BR,{}),"Close now"]})]})]})}function qQ({sandbox:e,onOpened:t}){const r=Bt(),[a,l]=b.useState(""),[c,u]=b.useState(""),[f,m]=b.useState(60),[h,g]=b.useState(!1),[p,x]=b.useState(null);async function v(j){j.preventDefault(),g(!0),x(null);try{const S=await r.exposeService({sandbox:e,name:c.trim(),port:Number(a),closeAfterMinutes:f});He.success(`Opened ${c||"default"} on port ${a}`,{description:S.url??void 0}),l(""),u(""),t()}catch(S){x(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(At,{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(At,{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(m4,{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(Dt,{}):s.jsx(Kv,{}),"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 Bh={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 YQ(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 KQ(){const e=Cn();return s.jsx(XQ,{},(e==null?void 0:e.id)??(e==null?void 0:e.context)??"default")}function XQ(){var k,A,R,M;const e=Bt(),t=Cn(),r=t?`ingress-scope:${t.context}`:"ingress-scope",a=Ga(),l=HQ(),c=(a.sandboxes??[]).filter(E=>E.phase!=="deleting"),[u,f]=b.useState(()=>{try{return sessionStorage.getItem(r)}catch{return null}}),m=((k=c.find(E=>E.name===u))==null?void 0:k.name)??((A=c[0])==null?void 0:A.name)??null;b.useEffect(()=>{try{m&&sessionStorage.setItem(r,m)}catch{}},[m,r]);const[h,g]=b.useState(null),p=b.useCallback(()=>e.ingress().then(g).catch(E=>g({error:E.message})),[e]);b.useEffect(()=>{p();const E=setInterval(p,15e3);return()=>clearInterval(E)},[p]);const x=((h==null?void 0:h.services)??[]).filter(E=>E.sandbox===m),v=b.useMemo(()=>{const E={};for(const O of(h==null?void 0:h.services)??[])E[O.sandbox]=(E[O.sandbox]??0)+1;return E},[h]),j=b.useMemo(()=>YQ(a.events.filter(E=>E.kind==="inbound"&&E.sandbox===m)),[a.events,m]),S=E=>j.filter(O=>O.type==="visit"&&O.port===E&&Date.parse(O.at)>l-36e5),N=j.filter(E=>E.type==="session"||E.type==="command"),C=(R=h==null?void 0:h.sessions)==null?void 0:R.ttlSeconds,T=(h==null?void 0:h.error)??(a.sandboxes==null?((M=a.overview)==null?void 0:M.error)??(a.connection==="gateway-down"?"The gateway is unavailable.":null):null);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(E=>s.jsxs("button",{onClick:()=>f(E.name),"aria-current":m===E.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===E.name?"bg-accent":"hover:bg-muted/60"}`,children:[s.jsx("span",{className:`size-2 shrink-0 rounded-[2px] ${La(E.phase).cell}`,"aria-hidden":"true"}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px]",children:E.name}),v[E.name]?s.jsxs("span",{className:"rounded bg-emerald-50 px-1 font-mono text-[10px] text-emerald-800",title:"Open services",children:[v[E.name]," open"]}):s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:"closed"})]},E.id))]}),s.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:T?s.jsxs("div",{role:"alert",className:"grid justify-items-center gap-3 py-16 text-center text-sm text-muted-foreground",children:[s.jsx("p",{children:T}),s.jsx(ue,{variant:"outline",size:"sm",onClick:()=>{p(),a.refresh()},children:"Retry"})]}):!h||a.sandboxes==null?s.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"}):m?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:E=>f(E.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(E=>s.jsx("option",{children:E.name},E.id))}),s.jsx(Ko,{duration:.22,offset:3,blur:"1px",children:s.jsx("div",{className:`rounded-lg border p-5 ${x.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:[x.length?s.jsx(Kv,{className:"size-4 text-emerald-600"}):s.jsx(BR,{className:"size-4 text-muted-foreground"}),x.length?`${x.length} service${x.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(Wv,{className:"size-3"}),"Web services"]}),x.map(E=>s.jsx(GQ,{remote:h.auth.remote,service:E,visits:S(E.port),now:l,onChanged:()=>{p(),a.refresh()}},`${E.sandbox}/${E.name}`)),s.jsx(qQ,{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(YR,{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:C===null?"Default session lifetime":C===0?"Sessions never expire":`Sessions expire after ${Math.round(C/60)} min`}),s.jsx("div",{className:"border-t border-border/70",children:N.length?N.slice(0,8).map(E=>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(E.at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),s.jsx("span",{children:Bh[E.type](E)})]},`${E.at}|${E.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(gu,{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(E=>{var O;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 ${E.verdict==="denied"?"bg-red-500":E.type.startsWith("service")?"bg-emerald-500":"bg-stone-400"}`,"aria-hidden":"true"}),s.jsx("span",{className:"min-w-0 flex-1",children:((O=Bh[E.type])==null?void 0:O.call(Bh,E))??E.type}),s.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:yu(E.at)})]},`${E.at}|${E.message}`)}):s.jsx("li",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:"Nothing yet."})})]})]})]}):s.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"No sandboxes yet."})})]})}function WQ({tab:e,onNavigate:t}){const r=Cn();return s.jsxs(Af,{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(Of,{variant:"line",className:"h-11! gap-5 p-0",children:[s.jsx(jr,{value:"egress",className:"h-full px-0 text-xs after:bottom-0!",children:"Egress"}),s.jsx(jr,{value:"ingress",className:"h-full px-0 text-xs after:bottom-0!",children:"Ingress"})]})}),s.jsx(vo,{value:"egress",className:"min-h-0",children:s.jsx(HK,{onNavigate:t})}),s.jsx(vo,{value:"ingress",className:"min-h-0",children:s.jsx(KQ,{})})]})}const My=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function QQ(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 ZQ(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?My.compare(f.secret.name,m.secret.name):1;if(p===null)return-1;const x=typeof g=="number"?g-p:My.compare(g,p);return(c.direction==="asc"?x:-x)||My.compare(f.secret.name,m.secret.name)})}const JQ=[{id:"agent",label:"Agents"},{id:"inference",label:"Models"},{id:"code",label:"Code"}],h4=[{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:"openai",name:"OpenAI",group:"inference",blurb:"GPT models API",keyUrl:"https://platform.openai.com/api-keys",keyHint:"sk-…"},{id:"openrouter",name:"OpenRouter",group:"inference",blurb:"One key, many models",keyUrl:"https://openrouter.ai/keys",keyHint:"sk-or-…"},{id:"github",name:"GitHub",group:"code",blurb:"Repos and API",keyUrl:"https://github.com/settings/personal-access-tokens",keyHint:"github_pat_…"}],p4=e=>h4.find(t=>t.id===e)??null,eZ=e=>p4(e)?`/logos/${e}.svg`:null;function ax({type:e,size:t="md",className:r}){const a=eZ(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(gu,{strokeWidth:1.4,className:Le("text-muted-foreground",c),"aria-hidden":"true"})})}function g4(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 tZ(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 nZ(e,t){const r=g4(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 sZ({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=JQ.map(m=>({...m,items:h4.filter(h=>h.group===m.id&&u(h))})).filter(m=>m.items.length);return s.jsxs("div",{className:"space-y-3",children:[s.jsx(na,{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(Dt,{className:"size-3.5"})}):s.jsx(ax,{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 rZ({service:e,profile:t,taken:r,sandboxes:a,onBack:l,onDone:c}){const u=Bt(),[f,m]=b.useState(()=>{const M=`my-${e.id}`;if(!r.has(M))return M;for(let E=2;;E++)if(!r.has(`${M}-${E}`))return`${M}-${E}`}),[h,g]=b.useState({}),[p,x]=b.useState([]),[v,j]=b.useState(!1),[S,N]=b.useState(null),C=t.endpoints.map(M=>M.host),T=tZ(t),k=g4(t),A=t.id==="codex"&&T.some(M=>M.key==="CODEX_AUTH_ACCESS_TOKEN");async function R(M){M.preventDefault(),j(!0),N(null);try{await u.createSecret({name:f,type:t.id,credentials:nZ(t,h)}),g({});const E=[];for(const O of p)try{await u.attachSecret(f,O,!0)}catch{E.push(O)}He.success(`Stored ${f}`,{description:p.length?`Attached to ${p.filter(O=>!E.includes(O)).join(", ")||"none"}${E.length?` · failed: ${E.join(", ")}`:""}`:"Credential saved. Vendor connection not tested."}),c()}catch(E){N(E.message)}finally{j(!1)}}return s.jsxs("form",{onSubmit:R,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(Yv,{})}),s.jsx(ax,{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&&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(Mi,{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"})]}),k&&s.jsx("p",{role:"status",className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5 text-xs leading-relaxed",children:k}),s.jsx("div",{className:"space-y-2.5",children:!k&&T.map((M,E)=>{const O=M.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:[M.label,M.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:O})]}),s.jsxs("span",{className:"relative block",children:[s.jsx(mC,{className:"absolute top-2.5 left-3 size-3.5 text-muted-foreground","aria-hidden":"true"}),s.jsx(At,{"aria-label":M.label,type:M.inputType,value:h[O]??"",onChange:z=>g(_=>({..._,[O]:z.target.value})),className:"h-9 pl-9 font-mono text-xs",placeholder:T.length===1&&e.keyHint?e.keyHint:M.placeholder,required:M.required,maxLength:8192,autoFocus:E===0,spellCheck:!1,autoComplete:"off"})]})]},O)})}),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:C.map(M=>s.jsx("span",{className:"rounded border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:M},M))}),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."]})]}),!k&&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(At,{value:f,onChange:M=>m(M.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(M=>{const E=p.includes(M.name);return s.jsxs("button",{type:"button","aria-pressed":E,onClick:()=>x(O=>E?O.filter(z=>z!==M.name):[...O,M.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 ${E?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[s.jsx("span",{className:`size-1.5 rounded-full ${E?"bg-emerald-500":"bg-stone-300"}`,"aria-hidden":"true"}),M.name]},M.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||!!k,className:"h-9 w-full bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[v?s.jsx(Dt,{}):s.jsx(mC,{}),"Store ",e.name," secret"]})]})}function oZ({open:e,onOpenChange:t,profiles:r,providers:a,sandboxes:l,reload:c}){const u=Bt(),f=Ls(),[m,h]=b.useState(""),[g,p]=b.useState(null),[x,v]=b.useState(null),[j,S]=b.useState(r);b.useEffect(()=>S(r),[r]),b.useEffect(()=>{e||(p(null),h(""),v(null))},[e]);const N=new Set(a.map(M=>M.type)),C=new Set(a.map(M=>M.name)),T=g&&j.find(M=>M.id===g.id);async function k(M){if(j.some(E=>E.id===M.id)){p(M);return}v(M.id);try{await u.importProfile(M.id);const E=await c();S((E==null?void 0:E.profiles)??j),p(M)}catch(E){He.error(`Couldn't set up ${M.name}: ${E.message}`)}finally{v(null)}}const A=g&&T?"key":"pick",R=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(bn,{open:e,onOpenChange:t,children:s.jsxs(yn,{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(vn,{className:"text-[14px]",children:A==="pick"?"Add secret":"Add credentials"}),s.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:A==="pick"?"Pick the service it's for.":"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(Fl,{mode:"wait",initial:!1,children:s.jsx(Rn.div,{...R,children:A==="pick"?s.jsx(sZ,{query:m,setQuery:h,have:N,onPick:k,picking:x}):s.jsx(rZ,{service:g,profile:T,taken:C,sandboxes:l,onBack:()=>p(null),onDone:()=>{t(!1),c()}})},A)})})]})})}const aZ={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"},iZ=e=>(aZ[e.authStyle]??(()=>"resolved by the proxy"))(e),lZ=e=>e&&Date.parse(e)-Date.now()<7*864e5;function cZ({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(At,{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 uZ({secret:e,onClose:t,onDone:r}){const a=Bt(),[l,c]=b.useState({}),[u,f]=b.useState(!1),[m,h]=b.useState(null);return b.useEffect(()=>{c({}),h(null)},[e]),s.jsx(bn,{open:!!e,onOpenChange:g=>{g||t()},children:s.jsx(yn,{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({}),He.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(jn,{children:s.jsxs(vn,{children:["Rotate ",e==null?void 0:e.name]})}),e==null?void 0:e.credentialKeys.map(g=>s.jsx(cZ,{id:`rot-${g}`,label:g,value:l[g]??"",onChange:p=>c(x=>({...x,[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(Co,{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(Dt,{"aria-hidden":"true"}),"Rotate"]})]})]})})})}function dZ({secret:e,keyName:t,onDone:r}){var h;const a=Bt(),l=(h=e.expires)==null?void 0:h[t],[c,u]=b.useState(!1),[f,m]=b.useState("");return c?s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(At,{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),He.success(f?"Expiry set":"Expiry cleared"),u(!1),r()}catch(g){He.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){He.error(g.message)}},children:"Clear"}),s.jsx(ue,{size:"icon-xs",variant:"ghost",onClick:()=>u(!1),"aria-label":"Cancel",children:s.jsx(Dn,{})})]}):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 ${lZ(l)?"text-amber-700":"text-muted-foreground"}`,children:[s.jsx(oI,{className:"size-3"}),l?`expires ${Wd(l)}`:"no expiry"]})}function fZ({secret:e,profile:t,sandboxes:r,onRotate:a,onDelete:l,onDone:c}){var p;const u=Bt(),[f,m]=b.useState(!1),h=r.filter(x=>!e.attachedTo.includes(x.name));async function g(x,v){m(!0);try{await u.attachSecret(e.name,x,v),He.success(v?`Attached to ${x}`:`Detached from ${x}`),c()}catch(j){He.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(ax,{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=p4(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($a,{}),"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(Kn,{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(x=>{const v=t==null?void 0:t.credentials.find(j=>j.envVars.includes(x));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?iZ(v):void 0,children:[s.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500","aria-hidden":"true"}),x]}),s.jsx("div",{className:"pl-3",children:s.jsx(dZ,{secret:e,keyName:x,onDone:c})})]},x)})]}),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(x=>s.jsxs("li",{children:[x.host,x.port?`:${x.port}`:"",s.jsxs("span",{className:"font-sans text-[10px] text-muted-foreground",children:[" ",x.access??""]})]},`${x.host}:${x.port}`))}),s.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["by ",t.binaries.map(x=>x.split("/").pop()).filter((x,v,j)=>j.indexOf(x)===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(FR,{className:"size-3 text-muted-foreground","aria-hidden":"true"}),s.jsx("span",{className:"text-muted-foreground",children:"Attached to"}),e.attachedTo.map(x=>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:[x,s.jsx("button",{onClick:()=>g(x,!1),disabled:f,"aria-label":`Detach from ${x}`,className:"rounded p-0.5 text-muted-foreground outline-none hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(Dn,{className:"size-2.5"})})]},x)),!e.attachedTo.length&&s.jsx("span",{className:"text-muted-foreground/70",children:"no sandbox"}),h.length>0&&s.jsxs(hn,{value:"",disabled:f,onChange:x=>x.target.value&&g(x.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(x=>s.jsx("option",{value:x.name,children:x.name},x.id))]}),f&&s.jsx(Dt,{className:"size-3"})]})]})}const lR=[],cR=[{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%"}],mZ={none:"No expiry",expired:"Expired",expiring:"Within 7 days",scheduled:"Scheduled"};function hZ(){const e=Cn();return s.jsx(pZ,{},(e==null?void 0:e.id)??(e==null?void 0:e.context)??"default")}function pZ(){const e=Bt(),t=Ga(),[r,a]=b.useState(null),[l,c]=b.useState(null),[u,f]=b.useState(!1),[m,h]=b.useState(!1),[g,p]=b.useState(null),[x,v]=b.useState(null),[j,S]=b.useState(null),[N,C]=b.useState(""),[T,k]=b.useState("all"),[A,R]=b.useState(""),[M,E]=b.useState(""),[O,z]=b.useState({key:"name",direction:"asc"}),[_,B]=b.useState(Date.now),q=b.useRef(null),I=b.useDeferredValue(N),L=b.useCallback(async()=>{f(!0);try{const oe=await e.secrets();return a(oe),c(null),oe}catch(oe){return c(oe.message),null}finally{f(!1)}},[e]);b.useEffect(()=>{L()},[L]),b.useEffect(()=>{const oe=setInterval(()=>B(Date.now()),6e4),ne=ee=>{var W;(ee.metaKey||ee.ctrlKey)&&ee.key.toLowerCase()==="k"&&!j&&!m&&!g&&!x&&(ee.preventDefault(),(W=q.current)==null||W.focus())};return window.addEventListener("keydown",ne),()=>{clearInterval(oe),window.removeEventListener("keydown",ne)}},[j,m,g,x]);const H=(r==null?void 0:r.providers)??lR,F=(r==null?void 0:r.profiles)??lR,V=b.useMemo(()=>QQ(H,F,_),[H,F,_]),G=b.useMemo(()=>ZQ(V,{query:I,scope:T,service:A,expiry:M,sort:O}),[V,I,T,A,M,O]),X=b.useMemo(()=>[...new Map(V.map(oe=>[oe.secret.type,oe.service])).entries()].sort((oe,ne)=>oe[1].localeCompare(ne[1])),[V]),$=ox({count:G.length,rowHeight:40});b.useEffect(()=>{$.scrollToTop()},[I,T,A,M,O]);const Q=V.find(oe=>oe.secret.name===j),K=(t.sandboxes??[]).filter(oe=>oe.phase!=="deleting"),se=V.filter(oe=>oe.secret.attachedTo.length>0).length,P=V.filter(oe=>oe.status==="expiring").length,U=V.filter(oe=>oe.status==="expired").length,Z=N||T!=="all"||A||M,te=()=>{C(""),k("all"),R(""),E("")},le=()=>{L(),t.refresh()},de="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(([oe,ne,ee])=>s.jsxs("button",{"aria-pressed":T===oe,onClick:()=>k(oe),className:`rounded-md px-3 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${T===oe?"bg-accent/70":"hover:bg-muted/60"}`,children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:ne}),s.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:s.jsx(rf,{value:ee})})]},oe)),s.jsx("div",{className:"ml-auto flex gap-1",children:[["expiring","Expiring in 7 days",P],["expired","Expired",U]].map(([oe,ne,ee])=>s.jsxs("button",{"aria-pressed":M===oe,onClick:()=>E(M===oe?"":oe),className:`rounded-md px-3 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${M===oe?"bg-accent/70":"hover:bg-muted/60"}`,children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:ne}),s.jsx("span",{className:`mt-1 block font-mono text-lg leading-none tabular-nums ${ee?oe==="expired"?"text-red-600":"text-amber-700":"text-muted-foreground"}`,children:s.jsx(rf,{value:ee})})]},oe))})]}),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(na,{ref:q,value:N,onValueChange:C,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:oe=>R(oe.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(([oe,ne])=>s.jsx("option",{value:oe,children:ne},oe))]}),s.jsxs(hn,{"aria-label":"Filter by expiry",value:M,onChange:oe=>E(oe.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(mZ).map(([oe,ne])=>s.jsx("option",{value:oe,children:ne},oe))]}),Z&&s.jsxs(ue,{variant:"ghost",size:"sm",onClick:te,children:[s.jsx(Dn,{}),"Clear"]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh secrets",disabled:u,onClick:le,children:s.jsx($a,{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(us,{}),"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:L,children:"Retry"})]}),s.jsx("div",{ref:$.ref,onScroll:$.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:cR.map(oe=>s.jsx("col",{style:{width:oe.width}},oe.id))}),s.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:s.jsx("tr",{"aria-rowindex":1,children:cR.map(oe=>s.jsx("th",{scope:"col","aria-sort":O.key===oe.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:oe.id==="hosts"?oe.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:()=>z({key:oe.id,direction:O.key===oe.id&&O.direction==="asc"?"desc":"asc"}),children:[oe.label,O.key===oe.id&&(O.direction==="asc"?s.jsx(uf,{className:"size-3"}):s.jsx(cf,{className:"size-3"}))]})},oe.id))})}),s.jsxs("tbody",{children:[$.paddingTop>0&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:6,style:{height:$.paddingTop,padding:0}})}),G.slice($.start,$.end).map((oe,ne)=>s.jsxs("tr",{"aria-rowindex":$.start+ne+2,onClick:()=>S(oe.secret.name),className:"group cursor-pointer bg-card hover:bg-muted/60 focus-within:bg-muted/60",children:[s.jsx("td",{className:`${de} pl-6`,children:s.jsxs("button",{"aria-haspopup":"dialog","aria-label":`Open ${oe.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:ee=>{ee.stopPropagation(),S(oe.secret.name)},children:[s.jsx(ax,{type:oe.secret.type,size:"sm"}),s.jsx("span",{title:oe.secret.name,className:"truncate font-medium text-foreground",children:oe.secret.name}),s.jsx(Mi,{className:"ml-auto size-3 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"})]})}),s.jsx("td",{className:de,children:s.jsx("span",{className:"block truncate",title:oe.service,children:oe.service})}),s.jsx("td",{className:de,children:s.jsx("span",{className:"font-mono text-[11px]",children:oe.secret.credentialKeys.length||"Access only"})}),s.jsx("td",{className:de,children:s.jsx("span",{className:"block truncate",title:oe.secret.attachedTo.slice(0,10).join(", "),children:oe.secret.attachedTo.length===1?oe.secret.attachedTo[0]:oe.secret.attachedTo.length?`${oe.secret.attachedTo.length.toLocaleString()} sandboxes`:"Unattached"})}),s.jsx("td",{className:de,children:s.jsxs("span",{className:oe.status==="expired"?"text-red-600":oe.status==="expiring"?"text-amber-700":"",title:oe.expiry?new Date(oe.expiry).toLocaleString():void 0,children:[oe.status==="expired"?"Expired · ":"",oe.expiry?new Date(oe.expiry).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):"No expiry"]})}),s.jsx("td",{className:de,children:s.jsx("span",{className:"block truncate font-mono text-[11px]",title:oe.hosts.join(", "),children:oe.hosts.length===1?oe.hosts[0]:oe.hosts.length?`${oe.hosts.length} hosts`:"-"})})]},oe.secret.name)),$.end<G.length&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:6,style:{height:(G.length-$.end)*40,padding:0}})})]})]}):s.jsxs("div",{className:"py-20 text-center",children:[s.jsx(gu,{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()}),Z?` of ${V.length.toLocaleString()}`:""," secrets"]}),s.jsx("span",{className:"hidden sm:inline",children:"Click a row to inspect · ⌘K to search"})]})]}),s.jsx(Gl,{open:!!Q,onOpenChange:oe=>{oe||S(null)},children:s.jsxs(du,{className:"w-full gap-0 sm:max-w-lg","aria-describedby":"secret-description",children:[s.jsxs(fu,{className:"border-b border-border px-4 py-4 pr-12",children:[s.jsx(mu,{children:"Secret details"}),s.jsx(hu,{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:Q&&s.jsx(fZ,{secret:Q.secret,profile:Q.profile,sandboxes:K,onRotate:()=>p(Q.secret),onDelete:()=>v(Q.secret),onDone:le},Q.secret.name)})]})}),s.jsx(oZ,{open:m,onOpenChange:h,profiles:F,providers:H,sandboxes:K,reload:async()=>{const oe=await L();return t.refresh(),oe}}),s.jsx(uZ,{secret:g,onClose:()=>p(null),onDone:le}),s.jsx(Rr,{open:!!x,onOpenChange:oe=>{oe||v(null)},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:["Delete ",x==null?void 0:x.name,"?"]}),s.jsx(zr,{children:x!=null&&x.attachedTo.length?`Detach from ${x.attachedTo.join(", ")} first.`:"This cannot be undone."})]}),s.jsxs(Mr,{children:[s.jsx(Ir,{children:"Cancel"}),s.jsx(Pr,{variant:"destructive",disabled:!!(x!=null&&x.attachedTo.length),onClick:async()=>{try{await e.deleteSecret(x.name),He.success(`Deleted ${x.name}`),le()}catch(oe){He.error(oe.message)}finally{v(null)}},children:"Delete"})]})]})})]})}async function gZ(e,t,r,a={}){var u,f,m;const l=await r4(e,t.setups||[],null,{...a,expectedRevisions:t.setupRevisions});if((u=a.signal)!=null&&u.aborted)throw new DOMException("Preparation cancelled.","AbortError");const c=va({...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 xZ="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",x4=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>_s.find(t=>t.id===e)).filter(Boolean),uR=_s.filter(e=>!x4.includes(e)),dR={runtimes:"runtimes",repository:"repository",customAgents:"custom",base:"system",packages:"system",setup:"system",environment:"environment"};function _d({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 fR({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 bZ(e){const t=Cn();return s.jsx(yZ,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function yZ({initial:e,draftKey:t,onClose:r,onStarted:a,onChangeLocation:l}){var Ne,Ae,J;const c=Bt(),u=Cn(),f=Ls(),[m,h]=b.useState(()=>va(e==null?void 0:e.recipe)),g=!!(e!=null&&e.replace),[p]=b.useState(()=>(e==null?void 0:e.baseline)??JSON.stringify(va(e==null?void 0:e.recipe))),[x,v]=b.useState(()=>new Set(Array.isArray(e==null?void 0:e.advanced)?e.advanced:e!=null&&e.advanced?["system","environment"]:va(e==null?void 0:e.recipe).customAgents.length?["custom"]:[])),j=re=>({open:x.has(re),onToggle:xe=>{const he=xe.currentTarget.open;v(Be=>he===Be.has(re)?Be:new Set(he?[...Be,re]:[...Be].filter(we=>we!==re)))}}),[S,N]=b.useState(()=>!Fp.some(re=>re.id===va(e==null?void 0:e.recipe).command)),[C,T]=b.useState(""),[k,A]=b.useState(!1),[R,M]=b.useState(!1),[E,O]=b.useState(""),z=b.useRef(null);b.useEffect(()=>()=>{var re;return(re=z.current)==null?void 0:re.abort()},[]);const[_,B]=b.useState(null),[q,I]=b.useState(!1),[L,H]=b.useState(!1),F=m.source==="build",V=re=>{ex({...m,...re})&&N(!1),h(xe=>va({...xe,...re,...re.setups?{setupRevisions:Object.fromEntries(Object.entries(xe.setupRevisions||{}).filter(([he])=>re.setups.includes(he)))}:{}}))},G=JSON.stringify(m)!==p,X=oq(m);b.useEffect(()=>{try{sessionStorage.setItem(t,JSON.stringify({recipe:m,replace:g,baseline:p,advanced:[...x]}))}catch{}},[t,m,g,p,x]);const $=rp(u),[Q,K]=b.useState({loading:$,value:null,error:""}),[se,P]=b.useState(0),[U]=b.useState(()=>va(e==null?void 0:e.recipe).setups);b.useEffect(()=>{if(!$)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,$,se]),b.useEffect(()=>{let re=!0;return c.localImages().then(xe=>{re&&B(xe)}).catch(xe=>{re&&B({images:[],error:xe.message})}),()=>{re=!1}},[c]),b.useEffect(()=>{const re=xe=>{G&&(xe.preventDefault(),xe.returnValue="")};return window.addEventListener("beforeunload",re),()=>window.removeEventListener("beforeunload",re)},[G]);function Z(re){var Be;const xe=m.agents.includes(re)?m.agents.filter(we=>we!==re):_s.filter(we=>we.id===re||m.agents.includes(we.id)).map(we=>we.id),he=!S&&(m.command===""?m.agents.length===0:_s.some(we=>we.command===m.command));xe.length>1&&N(!1),V({agents:xe,...he?{command:((Be=_s.find(we=>we.id===xe[0]))==null?void 0:Be.command)??""}:{}})}const te=re=>V({runtimes:m.runtimes.includes(re)?m.runtimes.filter(xe=>xe!==re):[...m.runtimes,re]}),le=[Iv(m).some(re=>re.npm)&&!m.runtimes.includes("node")&&"Node.js 22",Iv(m).some(re=>re.python)&&!m.runtimes.includes("python")&&"Python 3"].filter(Boolean),de=Fp.filter(re=>{var xe;return!F||re.id===""||m.agents.includes((xe=_s.find(he=>he.command===re.id))==null?void 0:xe.id)}),oe=[..._v.filter(re=>m.runtimes.includes(re.id)).map(re=>re.name),...le].join(", "),ne=[(Ne=Hp.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(" · "),ee=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){dR[xe[0]]&&v(Be=>new Set([...Be,dR[xe[0]]])),T(xe[1]);return}if(k||(u==null?void 0:u.connected)===!1)return;A(!0),M(!0),T(""),O("");const he=new AbortController;z.current=he;try{a(await gZ(c,m,g,{signal:he.signal,onProgress:O,onPrepared:()=>M(!1)}))}catch(Be){Be.name!=="AbortError"&&T(Be.message)}finally{A(!1),M(!1),O(""),z.current=null}}function ce(){const re=URL.createObjectURL(new Blob([Lv(m)],{type:"text/plain"})),xe=document.createElement("a");xe.href=re,xe.download="Dockerfile",xe.click(),URL.revokeObjectURL(re)}function Re(){k||(G?H(!0):r())}const _e=(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(bn,{open:!0,onOpenChange:re=>{re||Re()},children:s.jsx(yn,{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(Af,{value:m.source,onValueChange:re=>{V({source:re}),re==="build"&&m.agents.length>1&&N(!1),T("")},className:"contents",children:[s.jsxs(jn,{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(Qw,{step:2,subject:"template"})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 pr-8",children:[s.jsx(vn,{className:"truncate",children:g?`Edit ${m.name}`:"New template"}),l?s.jsx(J3,{location:u,onChange:l}):s.jsx(No,{location:u}),s.jsxs(Of,{className:"ml-auto w-fit","aria-label":"Template image source",children:[s.jsx(jr,{value:"build",className:"px-3 text-xs",children:"Build an image"}),s.jsx(jr,{value:"image",className:"px-3 text-xs",children:"Existing image"})]})]}),s.jsx($n,{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:k||(u==null?void 0:u.connected)===!1,className:"contents",children:[s.jsxs(Rn.div,{..._e(),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(At,{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":C&&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:x4.map(re=>s.jsxs(fR,{checked:m.agents.includes(re.id),onChange:()=>Z(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(Nu,{children:[s.jsxs(Cu,{render:s.jsx(ue,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[s.jsx("span",{className:"truncate",children:uR.filter(re=>m.agents.includes(re.id)).map(re=>re.name).join(", ")||"More agents"}),s.jsx(Qo,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),s.jsx(ku,{align:"start",children:uR.map(re=>s.jsxs(Uw,{checked:m.agents.includes(re.id),onCheckedChange:()=>Z(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(_d,{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(At,{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(vZ,{starts:de,recipe:m,custom:S,setCustom:N,patch:V}),C&&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:C})]}),s.jsxs(Rn.aside,{..._e(.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:[Q.loading&&s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading your local MCPs & Skills…"}),((J=Q.value)==null?void 0:J.available)&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Your local MCPs & Skills are available here. Existing remote templates keep their settings."}),Q.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: ",Q.error]}),s.jsx(ue,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>P(re=>re+1),children:"Retry"})]}),!Q.loading&&s.jsx(_3,{localCatalog:Q.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(Rl,{title:"Runtimes and tools",summary:oe,...j("runtimes"),children:[s.jsx("div",{className:"grid gap-2",children:_v.filter(re=>!re.retired||m.runtimes.includes(re.id)).map(re=>s.jsxs(fR,{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(Rl,{title:"Repository",summary:m.repository,...j("repository"),children:s.jsx(_d,{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(At,{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(Rl,{title:"Custom agent",summary:m.customAgents.length?"Install command set":"",...j("custom"),children:s.jsx(jZ,{agents:m.customAgents,onChange:re=>{re.length>m.customAgents.length&&N(!1),V({customAgents:re,...re.length>m.customAgents.length?{command:""}:{}})},error:C?X.customAgents:void 0})}),F&&s.jsxs(Rl,{title:"System",summary:ne,...j("system"),children:[s.jsx(_d,{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:Hp.map(re=>s.jsx("option",{value:re.id,children:re.name},re.id))})}),s.jsx(wZ,{packages:m.packages,onChange:re=>V({packages:re})}),s.jsx(_d,{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(_f,{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(Rl,{title:"Environment variables",summary:ee,...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(At,{"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((Be,we)=>xe===we?{...Be,name:he.target.value}:Be)}),placeholder:"NODE_ENV"}),s.jsx(At,{"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((Be,we)=>xe===we?{...Be,value:he.target.value}:Be)}),placeholder:"development"}),s.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove variable ${xe+1}`,onClick:()=>V({environment:m.environment.filter((he,Be)=>Be!==xe)}),children:s.jsx(Kn,{})})]},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(us,{}),"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."})]})]})}),(E||g)&&s.jsx("p",{role:E?"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:E||s.jsxs(s.Fragment,{children:[s.jsx(ff,{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(Co,{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:()=>I(!0),children:[s.jsx(UR,{}),"View Dockerfile"]}),s.jsx(ue,{type:"button",variant:"ghost",disabled:k&&!R,onClick:()=>{var re;return R?(re=z.current)==null?void 0:re.abort():Re()},children:R?"Cancel preparation":"Cancel"}),s.jsxs(ue,{type:"submit",className:xZ,disabled:k||(u==null?void 0:u.connected)===!1,children:[k?s.jsx(Dt,{}):s.jsx(Qv,{}),R?"Preparing MCPs…":F?g?"Rebuild template":"Build template":"Save template"]})]})]}),s.jsx(bn,{open:q,onOpenChange:I,children:s.jsxs(yn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:"Generated Dockerfile"}),s.jsx($n,{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?Lv(m):""}),s.jsxs(ue,{type:"button",variant:"outline",onClick:ce,children:[s.jsx(Wc,{}),"Download Dockerfile"]})]})}),s.jsx(bn,{open:L,onOpenChange:H,children:s.jsxs(yn,{children:[s.jsxs(jn,{children:[s.jsx(vn,{children:"Discard this template?"}),s.jsx($n,{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 vZ({starts:e,recipe:t,custom:r,setCustom:a,patch:l}){const c=ex(t),u=[...c?Fp.filter(m=>m.id===""):e].sort((m,h)=>(m.id===""?-1:0)-(h.id===""?-1:0)),f=(m,h,g,p,x)=>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"})})]})]},x);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=_s.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(e1,{"aria-hidden":"true",className:"size-5 shrink-0"}),m.name,()=>{a(!1),l({command:m.id})},m.id||"shell")}),!c&&f(r,s.jsx(UR,{"aria-hidden":"true",className:"size-5 shrink-0"}),"Custom command",()=>{r||(a(!0),l({command:""}))},"custom")]}),!c&&r&&s.jsx(At,{"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 wZ({packages:e,onChange:t}){const[r,a]=b.useState(""),l=b.useRef(null);function c(){const u=WT(r);u.length&&t([...new Set([...e,...u])]),a("")}return s.jsx(_d,{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(Dn,{className:"size-3"})})]},u))}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(At,{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,...WT(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(us,{}),"Add"]})]})]})})}function jZ({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(e1,{"aria-hidden":"true",className:"mt-2 size-3.5 shrink-0 text-muted-foreground"}),s.jsx(_f,{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 zs=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),mR="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",Wr=e=>e.status==="building",Vh=e=>e.status==="ready"||e.exists,SZ=e=>Wr(e)?e.exists?"Rebuilding":"Building":e.status==="failed"?e.exists?"Rebuild failed":"Build failed":"Ready";function hR({record:e}){return s.jsxs("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-[11px]",children:[Wr(e)?s.jsx(Dt,{className:"size-3 text-amber-600"}):s.jsx("span",{className:`size-1.5 rounded-full ${e.status==="failed"?"bg-amber-500":"bg-emerald-500"}`}),SZ(e)]})}const pR=e=>{var t;return((t=Fp.find(r=>r.id===e))==null?void 0:t.name)??e};function NZ(){var Ae;const e=Bt(),t=_r(),{templates:r,locations:a,error:l,refresh:c,loading:u}=Tu(),[f,m]=b.useState(""),[h,g]=b.useState(""),[p,x]=b.useState(null),[v,j]=b.useState(null),S=v?my(zs(v.location)):null,[N,C]=b.useState(null),[T,k]=b.useState(!1),[A,R]=b.useState(null),M=b.useRef(!1),[E,O]=b.useState(null),[z,_]=b.useState(null),[B,q]=b.useState(!1),I=b.useRef(!1),[L,H]=b.useState(()=>new Set),[F,V]=b.useState([]);b.useEffect(()=>{let J=!0;return e.contextKey().then(re=>{J&&x(JSON.stringify([e.target,re]))}).catch(re=>He.error(re.message)),()=>{J=!1}},[e]),b.useEffect(()=>{if(M.current||!p)return;const J=a.find(xe=>zs(xe)===p);if(!(J!=null&&J.connected))return;M.current=!0;const re=QT(my(zs(J)));re&&j(xe=>xe??{...re,location:J})},[p,a]);const G=r.find(J=>Un(J)===N),X=J=>a.find(re=>zs(re)===zs(J.location))??J.location,$=a.length>1,Q=J=>X(J).connected!==!1,K=J=>{if(!Q(J))throw new Error(`${Is(X(J))} is disconnected. Reconnect before continuing.`);return Cr(t!=null&&t.localViewer?X(J).target??"local":e.target,e.signal,J.location.context)},se=r.filter(J=>(!$||!h||zs(J.location)===h)&&`${J.name} ${J.image||""} ${J.recipe.repository||""}`.toLowerCase().includes(f.toLowerCase())),P=se.filter(J=>!Wr(J)&&Q(J)),U=r.filter(J=>L.has(Un(J))&&!Wr(J)&&Q(J)),Z=P.filter(J=>L.has(Un(J))).length,te=P.length>0&&Z===P.length;b.useEffect(()=>{const J=new Set(r.filter(re=>!Wr(re)&&(a.find(xe=>zs(xe)===zs(re.location))??re.location).connected!==!1).map(Un));H(re=>new Set([...re].filter(xe=>J.has(xe))))},[r,a]);function le(J){H(re=>{const xe=new Set(re);return xe.has(J)?xe.delete(J):xe.add(J),xe})}function de(){H(J=>{const re=new Set(J);for(const xe of P)te?re.delete(Un(xe)):re.add(Un(xe));return re})}async function oe(J){const re=[];for(const xe of J)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 ne(J){if(!I.current){I.current=!0,q(!0),V([]),C(null),O(J);try{await oe(J)}finally{I.current=!1,q(!1)}}}async function ee(J,re){if(!I.current){I.current=!0,q(!0);try{await K(J).lifecycle(re,"delete"),He.success(`Deleted sandbox ${re}`),await oe(E),await c()}catch(xe){He.error(xe.message)}finally{I.current=!1,q(!1)}}}async function W(){if(I.current||!(E!=null&&E.length))return;I.current=!0,q(!0),V([]);const J=new Set,re=[],xe=new Map;try{for(const he of E)try{const Be=await K(he).deleteImageTemplate(he.name);J.add(Un(he));const we=Be==null?void 0:Be.imageCleanup,Ye=JSON.stringify([zs(he.location),we==null?void 0:we.image]);(we==null?void 0:we.status)==="retained"?xe.set(Ye,{image:we.image,reason:we.reason,location:X(he)}):we!=null&&we.image&&xe.delete(Ye)}catch(Be){re.push({target:he,message:Be.message,sandboxes:Be.sandboxes})}for(const{image:he,reason:Be,location:we}of xe.values())He.warning(Be,{description:`${Is(we)} · ${he}`,duration:1e4});H(he=>new Set([...he].filter(Be=>!J.has(Be)))),C(he=>J.has(he)?null:he),V(re),J.size&&He.success(`Deleted ${J.size} ${J.size===1?"template":"templates"}`),O(re.length?E.filter(he=>!J.has(Un(he))):null),await c()}finally{I.current=!1,q(!1)}}function ce(J,re,xe){Q(J)&&(C(null),j({recipe:re,replace:xe,location:X(J)}))}function Re(J){if(!(J!=null&&J.connected))return;const re=QT(my(zs(J)));j({...re??{},location:J}),k(!1)}b.useEffect(()=>{if(!A)return;const J=a.find(xe=>xe.gateway===A&&xe.connected);if(J){R(null),Re(J);return}const re=setInterval(c,1500);return()=>clearInterval(re)},[A,a]);function _e(){try{sessionStorage.removeItem(S)}catch{}j(null)}async function Ne(J){try{await J(),await c()}catch(re){He.error(re.message)}}return s.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[v&&s.jsx(Da,{location:X(v),children:s.jsx(bZ,{initial:v,draftKey:S,onClose:_e,onChangeLocation:v.replace?void 0:()=>{j(null),k(!0)},onStarted:J=>{C(Un({...J,location:v.location})),_e(),c()}},JSON.stringify([zs(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(na,{"aria-label":"Search image templates",value:f,onValueChange:m,placeholder:"Search…",className:"mr-auto min-w-32 flex-1 sm:max-w-60"}),$&&s.jsxs(hn,{"aria-label":"Filter template location",value:h,onChange:J=>g(J.target.value),className:"h-8 rounded-md border bg-card px-2 text-xs",children:[s.jsx("option",{value:"",children:"All locations"}),a.map(J=>s.jsxs("option",{value:zs(J),children:[Is(J),zs(J)===p?" (default)":"",J.connected===!1?" · disconnected":""]},zs(J)))]}),s.jsxs(ue,{size:"sm",className:mR,onClick:()=>k(!0),children:[s.jsx(us,{}),"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>Z&&s.jsxs("span",{className:"text-muted-foreground",children:[" · ",U.length-Z," outside current filters"]})]}),s.jsx(ue,{variant:"ghost",size:"sm",disabled:B,onClick:()=>H(new Set),children:"Clear selection"}),s.jsxs(ue,{variant:"destructive",size:"sm",disabled:B,onClick:()=>ne(U),children:[s.jsx(Kn,{}),"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(J=>J.connected===!1).map(J=>s.jsxs("div",{role:"status",className:"border-b bg-muted/30 px-4 py-3 text-xs text-muted-foreground sm:px-6",children:[Is(J)," is disconnected. Saved templates are shown; reconnect to use or change them.",J.error&&s.jsx("span",{className:"ml-1",children:J.error})]},zs(J))),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(Dt,{}),"Loading…"]}):se.length?s.jsx(Ko,{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($l,{"aria-label":"Select all matching templates",checked:te,indeterminate:Z>0&&!te,disabled:B||!P.length,onCheckedChange:de})}),s.jsx("th",{className:"px-4 py-2 font-normal",children:"Name"}),$&&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(J=>s.jsxs("tr",{className:L.has(Un(J))?"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($l,{"aria-label":`Select ${J.name} in ${Is(X(J))}`,checked:L.has(Un(J)),disabled:B||Wr(J)||!Q(J),onCheckedChange:()=>le(Un(J))})}),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:()=>C(Un(J)),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(HR,{className:"size-4",strokeWidth:1.5})}),s.jsx("span",{className:"truncate group-hover:underline",children:J.name})]})}),$&&s.jsx("td",{className:"px-4 py-2",children:s.jsx(K3,{location:X(J)})}),s.jsx("td",{className:"px-4 py-2 text-[11px] text-muted-foreground",children:J.managed===!1?"-":pR(J.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:J.image||"",children:J.image||(J.recipe.source==="image"?J.recipe.image:"Not built yet")})}),s.jsx("td",{className:"px-4 py-2",children:s.jsx(hR,{record:J})}),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:[!Wr(J)&&(J.status==="failed"||J.status==="ready"&&J.managed)&&s.jsxs(ue,{variant:"ghost",size:"xs",disabled:!Q(J),"aria-label":`Edit ${J.name} in ${Is(X(J))}`,onClick:()=>ce(J,J.recipe,J.status==="ready"||!!J.exists),children:[s.jsx(hC,{}),"Edit"]}),s.jsxs(ue,{variant:"ghost",size:"xs",disabled:Vh(J)&&!Q(J),onClick:()=>Vh(J)?_(J):C(Un(J)),children:[Vh(J)?"Use template":Wr(J)?"View progress":"Details",s.jsx(Py,{})]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${J.name} in ${Is(X(J))}`,title:Wr(J)?"Cancel the build before deleting this template":`Delete ${J.name}`,disabled:B||Wr(J)||!Q(J),onClick:()=>ne([J]),children:s.jsx(Kn,{})})]})})]},Un(J)))})]})})}):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(bn,{open:!!G,onOpenChange:J=>{J||C(null)},children:s.jsx(yn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:G&&s.jsxs(s.Fragment,{children:[s.jsxs(jn,{children:[s.jsx(vn,{className:"font-mono",children:G.name}),s.jsx($n,{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(No,{location:X(G)}),s.jsx(hR,{record:G})]}),!Q(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",pR(G.recipe.command)]],...G.recipe.source==="build"&&G.managed!==!1?[["Agents",[...G.recipe.agents.map(J=>{var re;return(re=_s.find(xe=>xe.id===J))==null?void 0:re.name}),...(G.recipe.customAgents??[]).map(J=>J.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(J=>J.name).join(", ")},"e"):"None"],["CLI",s.jsxs("code",{className:"font-mono",children:["openshell sandbox create --template ",G.name]},"c")]].map(([J,re])=>s.jsxs("div",{className:"flex gap-4 py-2",children:[s.jsx("dt",{className:"w-24 shrink-0 text-muted-foreground",children:J}),s.jsx("dd",{className:"min-w-0",children:re})]},J))}),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:Wr(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:Wr(G)?s.jsxs(ue,{variant:"outline",disabled:!Q(G),onClick:()=>Ne(()=>K(G).cancelImageBuild(G.name)),children:[s.jsx(Dn,{}),"Cancel build"]}):s.jsxs(s.Fragment,{children:[G.status==="failed"&&s.jsxs(ue,{variant:"outline",size:"sm",disabled:!Q(G),onClick:()=>ce(G,G.recipe,!!G.exists),children:[s.jsx(m6,{}),"Edit and retry"]}),G.status==="failed"&&G.exists&&s.jsx(ue,{variant:"ghost",size:"sm",disabled:!Q(G),onClick:()=>Ne(()=>K(G).dismissImageBuild(G.name)),children:"Dismiss"}),G.status==="ready"&&G.managed&&s.jsxs(ue,{variant:"ghost",size:"sm",disabled:!Q(G),onClick:()=>ce(G,G.recipe,!0),children:[s.jsx(hC,{}),"Edit"]}),G.managed!==!1&&s.jsxs(ue,{variant:"ghost",size:"sm",disabled:!Q(G),onClick:()=>ce(G,{...G.recipe,name:`${G.name.slice(0,14)}-copy`},!1),children:[s.jsx(df,{}),"Duplicate"]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Delete image template",disabled:B||!Q(G),onClick:()=>ne([G]),children:s.jsx(Kn,{})}),Vh(G)&&s.jsxs(ue,{className:`ml-auto ${mR}`,disabled:!Q(G),onClick:()=>{_(G),C(null)},children:["Use template",s.jsx(Py,{})]})]})})]})})}),s.jsx(bn,{open:!!E,onOpenChange:J=>{!J&&!I.current&&O(null)},children:s.jsxs(yn,{className:"max-h-[85svh] overflow-y-auto",children:[s.jsxs(jn,{children:[s.jsxs(vn,{children:["Delete ",(E==null?void 0:E.length)===1?"this template":`${(E==null?void 0:E.length)??0} templates`,"?"]}),s.jsx($n,{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:E==null?void 0:E.map(J=>s.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[s.jsx("span",{className:"font-mono",children:J.name}),s.jsx(No,{location:X(J)})]},Un(J)))}),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 ",(E==null?void 0:E.length)===1?"this template":"these templates","."]}),s.jsx("ul",{className:"mt-2 space-y-3",children:F.map(J=>{var re;return s.jsxs("li",{children:[s.jsxs("p",{children:[s.jsx("span",{className:"font-mono",children:J.target.name})," ",s.jsx(No,{location:X(J.target)}),": ",J.message]}),((re=J.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:J.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:B||!Q(J.target),"aria-label":`Delete sandbox ${xe.name} in ${Is(X(J.target))}`,onClick:()=>ee(J.target,xe.name),children:[s.jsx(Kn,{}),"Delete sandbox"]})]},Un({...xe,location:J.target.location})))})]})]},Un(J.target))})})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ue,{variant:"ghost",disabled:B,onClick:()=>O(null),children:"Cancel"}),s.jsxs(ue,{variant:"destructive",disabled:B||!(E!=null&&E.some(Q)),onClick:W,children:[B&&s.jsx(Dt,{}),B?"Deleting…":F.length?"Retry deletion":(E==null?void 0:E.length)===1?"Delete template":"Delete templates"]})]})]})}),s.jsx(bn,{open:T,onOpenChange:J=>{k(J),J||R(null)},children:s.jsx(yn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:s.jsx(t4,{locations:a,allowRemote:!0,subject:"template",connecting:!!A,onPick:J=>Re(a.find(re=>zs(re)===J)),onConnected:J=>{R(J.gateway),c()},onCancel:()=>k(!1)})})}),z&&s.jsx(Da,{location:X(z),children:s.jsx(a4,{open:!0,initialImageTemplate:z,onOpenChange:J=>{J||_(null)},onStarted:()=>_(null)})})]})}const b4=b.createContext(void 0);function CZ(){const e=b.useContext(b4);if(e===void 0)throw new Error(Jt(63));return e}const kZ="data-checked",TZ="data-unchecked",y4={...ug,checked(e){return e?{[kZ]:""}:{[TZ]:""}}},EZ=b.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:x,readOnly:v=!1,required:j=!1,disabled:S=!1,render:N,uncheckedValue:C,value:T,style:k,...A}=t,{clearErrors:R}=dg(),{state:M,setTouched:E,setDirty:O,validityData:z,setFilled:_,setFocused:B,validationMode:q,disabled:I,name:L,validation:H}=bu(),{labelId:F}=pf(),V=I||S,G=L??g,X=b.useRef(null),$=no(X,h,H.inputRef),Q=b.useRef(null),K=fs(),se=gf({id:m}),P=p?void 0:se,[U,Z]=oo({controlled:a,default:!!c,name:"Switch",state:"checked"});vg(Q,K,U,void 0,!V,g),Ke(()=>{_(U)},[U,_]),vf(U,()=>{R(G),O(U!==z.initialValue),H.change(U)});const{getButtonProps:te,buttonRef:le}=ao({disabled:V,native:p}),de=wA(u,F,X,!p,P),oe={id:p?se:K,role:"switch","aria-checked":U,"aria-readonly":v||void 0,"aria-required":j||void 0,"aria-labelledby":de,onFocus(){V||B(!0)},onBlur(){const ce=X.current;!ce||V||(E(!0),B(!1),q==="onBlur"&&H.commit(ce.checked))},onClick(ce){if(v||V)return;ce.preventDefault();const Re=X.current;Re&&Qc(Re,ce)}},ne={...H.getValidationProps(V),checked:U,disabled:V,form:f,id:P,name:G,required:j,style:G?j1:Ng,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:$,onChange(ce){if(ce.nativeEvent.defaultPrevented)return;if(v){ce.preventDefault();return}const Re=ce.currentTarget.checked,_e=bt(Er,ce.nativeEvent);x==null||x(Re,_e),!_e.isCanceled&&Z(Re)},onClick(ce){ce.stopPropagation()},onFocus(){var ce;(ce=Q.current)==null||ce.focus()},...T!==void 0?{value:T}:gn},ee=b.useMemo(()=>({...M,checked:U,disabled:V,readOnly:v,required:j}),[M,U,V,v,j]),W=jt("span",t,{state:ee,ref:[r,Q,le],props:[oe,A,te,ce=>H.getValidationProps(V,ce)],stateAttributesMapping:y4});return s.jsxs(b4.Provider,{value:ee,children:[W,!U&&G&&C!==void 0&&s.jsx("input",{type:"hidden",form:f,name:G,value:C,disabled:V}),s.jsx("input",{...ne,suppressHydrationWarning:!0})]})}),RZ=b.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,f=CZ();return jt("span",t,{state:f,ref:r,stateAttributesMapping:y4,props:u})});function AZ({className:e,...t}){return s.jsx(EZ,{"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(RZ,{"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 OZ=({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}),MZ=`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 DZ(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 zZ={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 PZ({className:e}){const[t,r]=b.useState(!1),a=Ls();b.useEffect(()=>{if(!t)return;const u=setTimeout(()=>r(!1),2e3);return()=>clearTimeout(u)},[t]);const l=async u=>{await DZ(MZ,u.currentTarget)?r(!0):He.error("Couldn’t copy the prompt",{description:"Your browser blocked clipboard access."})},c=a?{}:{...zZ,transition:{duration:.18,ease:"easeOut"}};return s.jsx($f,{delay:300,children:s.jsxs(Pa,{children:[s.jsxs(Ia,{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(Fl,{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(df,{className:"size-3.5"})},t?"check":"copy")})}),s.jsx(Fl,{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(OZ,{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(_a,{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 gR={name:"",hostname:"",port:"",auth:"default",identityFile:""},IZ=[["default","SSH agent / default keys"],["identity","Key file"]];function _Z({open:e,onOpenChange:t,onAdded:r}){const[a,l]=b.useState(gR),[c,u]=b.useState(null),[f,m]=b.useState(!1),[h,g]=b.useState(null),p=b.useId();b.useEffect(()=>{e&&(l(gR),u(null),g(null),m(!1))},[e]);const x=C=>T=>{l(k=>({...k,[C]:T.target.value})),g(null)},v=a.name.trim()&&a.hostname.trim()&&(a.auth==="default"||a.identityFile.trim());async function j(C){m(!0),g(null);try{await C()}catch(T){g(T.message)}finally{m(!1)}}const S=C=>{C.preventDefault(),v&&!f&&j(async()=>u(await ls.scanSshHost(a)))},N=()=>j(async()=>{const C=await ls.addSshHost(c.token);r(C)});return s.jsx(bn,{open:e,onOpenChange:C=>{f||t(C)},children:s.jsxs(yn,{className:"sm:max-w-md","aria-describedby":void 0,children:[s.jsx(jn,{children:s.jsx(vn,{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(C=>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:C.type}),s.jsx("span",{className:"block font-mono break-all text-foreground",children:C.fingerprint})]},C.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(Co,{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:N,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f?s.jsx(Dt,{"aria-hidden":"true"}):s.jsx(xu,{"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(At,{id:`${p}-name`,value:a.name,onChange:x("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(At,{id:`${p}-host`,value:a.hostname,onChange:x("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(At,{id:`${p}-port`,value:a.port,onChange:x("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:IZ.map(([C,T])=>s.jsx("button",{type:"button",role:"radio","aria-checked":a.auth===C,onClick:()=>{l(k=>({...k,auth:C})),g(null)},className:`rounded-md px-3 py-1 transition-colors ${a.auth===C?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:T},C))}),a.auth==="identity"?s.jsx(At,{"aria-label":"Private key file",value:a.identityFile,onChange:x("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(Co,{children:[s.jsx(PZ,{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(Dt,{"aria-hidden":"true"}),f?"Checking…":"Continue"]})]})]})]})})}const v4={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"}},xR=e=>v4[e]?e:"off",LZ=(e,t,r)=>`${e} ${e===1?t:r}`;function $Z({row:e,count:t}){const r=v4[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:["· ",LZ(t,"sandbox","sandboxes")]})]})}function BZ({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(Dt,{"aria-label":"Working",className:"size-3.5"}):s.jsx(AZ,{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(e4,{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($Z,{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(Pa,{children:[s.jsx(Ia,{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(N6,{className:"size-4"})}),s.jsx(_a,{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=Tu(),[r,a]=b.useState(null),[l,c]=b.useState(null),[u,f]=b.useState(null),[m,h]=b.useState(null),[g,p]=b.useState(!1),[x,v]=b.useState(null),j=b.useCallback(async I=>{try{a(await ls.connections(I)),c(null)}catch(L){L.name!=="AbortError"&&c(L.message)}},[]);b.useEffect(()=>{const I=new AbortController;return j(I.signal),()=>I.abort()},[j]);const S=(r==null?void 0:r.active)??null,N=xR(S==null?void 0:S.status),C=N==="connected",T=b.useMemo(()=>{if(!r)return[];const I=r.hosts.map(L=>({...L,state:(S==null?void 0:S.host)===L.name?xR(S.status):"off",error:(S==null?void 0:S.host)===L.name?S.error:null}));return S&&!I.some(L=>L.name===S.host)&&I.push({name:S.host,state:N,error:S.error}),I},[r,S,N]),k=T.filter(I=>I.managed||I.name===(S==null?void 0:S.host)).sort((I,L)=>(L.state==="connected")-(I.state==="connected")||(I.label??I.name).localeCompare(L.label??L.name)),A=T.filter(I=>!k.includes(I)),R=I=>t.sandboxes.filter(L=>{var H;return((H=L.location)==null?void 0:H.remote)&&L.location.host===I.name}).length;async function M(I,L,H){f(I);try{await L(),await j(),t.refresh()}catch(F){He.error(H,{description:F.message})}finally{f(null)}}const E=(I,L)=>{L?h({host:I.name,replacing:C?S.host:void 0}):M(I.name,async()=>{await ls.disconnectRemote(),He.success(`Disconnected from ${I.label??I.name}`)},"Couldn’t disconnect")};function O(){const{kind:I,row:L}=x;v(null);const H=L.label??L.name;I==="forget"?M(L.name,async()=>{await ls.forgetRemote(),He.success(`Forgot ${H}`)},"Couldn’t forget it"):M(L.name,async()=>{(S==null?void 0:S.host)===L.name&&await ls.forgetRemote(),await ls.removeSshHost(L.name),He.success(`Deleted ${H}`)},"Couldn’t delete it")}function z(I){const L=I.name===(S==null?void 0:S.host);return!I.managed&&!L?null:s.jsxs(Nu,{children:[s.jsx(Cu,{render:s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":`More actions for ${I.label??I.name}`,className:"size-7 text-muted-foreground hover:text-foreground"}),children:s.jsx(SI,{className:"size-4"})}),s.jsxs(ku,{align:"end",className:"min-w-44",children:[I.state==="connected"&&s.jsx(qs,{onClick:()=>E(I,!1),children:"Disconnect"}),I.state!=="connected"&&I.state!=="connecting"&&s.jsx(qs,{onClick:()=>E(I,!0),children:I.state==="failed"?"Try again":"Connect"}),L&&!I.managed&&s.jsx(qs,{onClick:()=>v({kind:"forget",row:I}),children:"Forget"}),I.managed&&s.jsxs(s.Fragment,{children:[s.jsx(Hd,{}),s.jsxs(qs,{variant:"destructive",disabled:I.state==="connected"||I.state==="connecting",onClick:()=>v({kind:"delete",row:I}),children:["Delete",I.state==="connected"?" (disconnect first)":""]})]})]})]})}const _=(I,L)=>s.jsx(Ko,{delay:.04*L,offset:4,blur:"3px",className:"contents",children:s.jsx(BZ,{row:I,count:R(I),working:u===I.name,onToggle:E,onCreate:e,menu:z(I)})},I.name),B=(x==null?void 0:x.row.label)??(x==null?void 0:x.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($a,{})}),s.jsxs(ue,{size:"sm",onClick:()=>p(!0),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[s.jsx(us,{className:"size-3.5"}),"Add"]})]}),k.length>0?s.jsx("ul",{className:q,children:k.map(_)}):s.jsxs("div",{className:"rounded-xl border border-border bg-card py-14 text-center",children:[s.jsx(mf,{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(Rr,{open:!!x,onOpenChange:I=>{I||v(null)},children:s.jsxs(Ar,{children:[s.jsxs(Or,{children:[s.jsxs(Dr,{children:[(x==null?void 0:x.kind)==="forget"?"Forget":"Delete"," ",B,"?"]}),s.jsx(zr,{children:(x==null?void 0:x.kind)==="forget"?`${(x==null?void 0:x.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(Mr,{children:[s.jsx(Ir,{children:"Cancel"}),s.jsx(Pr,{variant:"destructive",onClick:O,children:(x==null?void 0:x.kind)==="forget"?"Forget":"Delete"})]})]})}),s.jsx(_Z,{open:g,onOpenChange:p,onAdded:I=>{p(!1),He.success(`Added ${I.name}`),j(),h({host:I.alias})}}),s.jsx(bn,{open:!!m,onOpenChange:I=>{I||h(null)},children:s.jsxs(yn,{className:"sm:max-w-3xl","aria-describedby":void 0,children:[s.jsx(jn,{children:s.jsx(vn,{children:m!=null&&m.replacing?"Switch host":"Connect a remote machine"})}),m&&s.jsx(Z3,{initialHost:m.host,connectedHost:m.replacing??null,onUseConnected:()=>h(null),onConnected:I=>{h(null),He.success(`Connected to ${I.host}`),j(),t.refresh()},onBack:()=>h(null)})]})})]})}const bR=({...e})=>{const{resolvedTheme:t}=TR();return s.jsx(Hq,{theme:t??"system",className:"toaster group",icons:{success:s.jsx(fI,{className:"size-4"}),info:s.jsx(ff,{className:"size-4"}),warning:s.jsx(Ba,{className:"size-4"}),error:s.jsx(GR,{className:"size-4"}),loading:s.jsx(_l,{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 UZ({children:e,user:t,logout:r}){const[a]=b.useState(()=>window.location.hash.startsWith("#local-connect=")?kP(window.location.hash)??!1:null),[l,c]=b.useState(""),u=b.useRef(null),f=a&&window.opener&&!window.opener.closed;return b.useEffect(()=>{if(!f)return;let m=!0;return u.current??(u.current=AP(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 HZ({children:e}){var j;const{chooseGroups:t,dialog:r,cancel:a}=Ww(),l=b.useRef(new AbortController),c=b.useMemo(()=>Cr("local",l.current.signal),[]),u=b.useRef(0);b.useEffect(()=>{const S=++u.current;return()=>queueMicrotask(()=>{u.current===S&&l.current.abort()})},[]);const f=b.useRef((j=/^#cloud-return=([a-f0-9-]{36})$/.exec(window.location.hash))==null?void 0:j[1]),[m,h]=b.useState(Go&&f.current&&window.opener?"waiting":"normal"),[g,p]=b.useState(""),x=b.useRef(!1),v=b.useRef(!1);return b.useEffect(()=>{if(m!=="waiting")return;const S=async N=>{var C;if(!(x.current||N.origin!==ja||N.source!==window.opener||((C=N.data)==null?void 0:C.type)!=="openrod-local-bundle"||N.data.nonce!==f.current)){x.current=!0,h("importing");try{if(typeof N.data.error=="string")throw Error(N.data.error);const k=(await c.inventory()).locations.find(E=>!E.remote&&E.connected);if(!k)throw Error("Connect a local gateway before importing this workspace.");const A=c.forContext(k.context),R=await t(A,"local OpenRod",l.current.signal);if(v.current)return;const M=await A.importCloud({...N.data.bundle,...R?{destinationGroups:R}:{}});if(window.opener.postMessage({type:"openrod-local-result",nonce:f.current,name:M.name},ja),v.current)return;p(N.data.warning??"Workspace copied locally. Reconnect agent credentials to continue."),window.location.href=Gp(M.name,"shell",{...k,target:"local"}),h("done")}catch(T){if(v.current||l.current.signal.aborted)return;p(T.message),h("error"),window.opener.postMessage({type:"openrod-local-result",nonce:f.current,error:T.message},ja)}}};return window.addEventListener("message",S),window.opener.postMessage({type:"openrod-local-ready",nonce:f.current},ja),()=>window.removeEventListener("message",S)},[m]),b.useEffect(()=>{if(!["waiting","importing"].includes(m))return;const S=Date.now()+35*6e4,N=setInterval(()=>{var C;((C=window.opener)!=null&&C.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(N)},[m]),m==="normal"||m==="done"?s.jsxs(s.Fragment,{children:[g&&s.jsx(za,{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,x.current=!0,window.location.hash="",h("normal")},children:"Open local workspace"})]})})]})}function FZ(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 yR(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 GZ({children:e,logout:t}){const[r,a]=b.useState(null),[l,c]=b.useState(""),[u,f]=b.useState(null),m=b.useRef(FZ(window.location.hash)),h=b.useRef(!1);return b.useEffect(()=>{let g=!0,p;async function x(){try{const v=await yR("machine");g&&(a(v),c(v.error??""),v.status!=="ready"&&(p=setTimeout(x,5e3)))}catch(v){g&&(c(v.message),p=setTimeout(x,1e4))}}return x(),()=>{g=!1,clearTimeout(p)}},[]),b.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),yR("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 x=Date.now()+35*6e4,v=setInterval(()=>{var j;m.current&&((j=window.opener)!=null&&j.closed||Date.now()>x)&&(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(za,{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 qZ({open:e,onOpenChange:t}){const r=_r(),{chooseGroups:a,dialog:l}=Ww(),c=Tu(),u=c.sandboxes.filter(k=>{var A,R,M;return k.phase==="ready"&&((A=k.location)==null?void 0:A.target)!=="cloud"&&!((R=k.location)!=null&&R.remote)&&((M=k.location)==null?void 0:M.connected)}),[f,m]=b.useState("new"),[h,g]=b.useState(""),[p,x]=b.useState(!1),[v,j]=b.useState(""),[S,N]=b.useState(""),C=b.useRef(null);b.useEffect(()=>()=>{var k;return(k=C.current)==null?void 0:k.abort()},[]),b.useEffect(()=>{e&&(j(""),g(""))},[e]);async function T(){if(p||!Go)return;const k=u.find(R=>Un(R)===h);if(f==="copy"&&!k){j("Choose a connected local sandbox.");return}const A=new AbortController;C.current=A,x(!0),j(""),N("signin");try{if(await r.connect(),A.signal.throwIfAborted(),f==="copy"){N("prepare"),await zR(()=>au("machine"),{signal:A.signal}),N("transfer");const R=Cr("cloud",A.signal);N("groups");const M=await a(R,"cloud",A.signal);N("transfer");const E=await PR(Cr("local",A.signal,k.location.context),R,k.name,M),O=await R.contextKey();A.signal.throwIfAborted();try{sessionStorage.setItem("gateway-box",JSON.stringify({name:E.name,context:O,target:"cloud"}))}catch{}c.refresh(),He.success("Workspace ready in cloud",{description:E.warning||"Reconnect your agent credentials to continue."})}r.requestCreate(f==="new"),t(!1),r.selectTarget("cloud")}catch(R){j(R.name==="AbortError"?"Cloud preparation cancelled.":R.message)}finally{x(!1),N(""),C.current=null}}return s.jsx(bn,{open:e,onOpenChange:k=>{p||t(k)},children:s.jsxs(yn,{className:"sm:max-w-md",children:[s.jsxs(jn,{children:[s.jsx(vn,{children:"Build in cloud"}),s.jsx($n,{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(([k,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===k,onChange:()=>m(k)}),A]},k))}),f==="copy"&&s.jsxs(s.Fragment,{children:[s.jsxs(hn,{"aria-label":"Local sandbox to copy",value:h,disabled:p,onChange:k=>g(k.target.value),className:"rounded-md border bg-background p-2 text-sm",children:[s.jsx("option",{value:"",children:"Choose a local sandbox"}),u.map(k=>s.jsxs("option",{value:Un(k),children:[k.name," · ",Is(k.location)]},Un(k)))]}),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}),!Go&&s.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:Ml}),s.jsxs(ue,{disabled:p||!Go||f==="copy"&&!h,onClick:T,children:[p&&s.jsx(Dt,{}),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 k;return(k=C.current)==null?void 0:k.abort()},children:"Cancel preparation"}),p&&r.connecting&&s.jsx(ue,{variant:"ghost",onClick:r.cancelConnect,children:"Cancel sign-in"}),ja,l]})})}async function vR(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===ki&&window.dispatchEvent(new Event(ki)),!r.ok)throw Object.assign(new Error(a.error??"Sign-in unavailable"),{code:a.code});return a}const YZ=()=>{var e;return((e=_r())==null?void 0:e.target)==="cloud"};function KZ(){var a,l;const e=_r(),[t,r]=b.useState(!1);return e!=null&&e.localViewer?Go?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=>He.error("Couldn’t sign in",{description:c.message})),className:By({size:"sm",variant:"outline"}),children:e.connecting?"Signing in…":"Sign in"}),s.jsxs("button",{onClick:()=>r(!0),className:By({size:"sm",className:"gap-2"}),children:[s.jsx(gI,{"aria-hidden":"true"}),"Build in cloud"]}),s.jsx(qZ,{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 XZ({children:e}){const[t,r]=b.useState(null),[a,l]=b.useState(null),[c,u]=b.useState(!0),[f,m]=b.useState(""),[h,g]=b.useState(!1);b.useEffect(()=>{let v=!0;async function j(){try{const C=await vR("config");if(!["local","cloud"].includes(C.mode))throw Error("Invalid console configuration");if(!v)return;if(r(C),C.mode==="cloud"){const T=await fetch("/api/auth/me");if(T.ok){const k=await T.json();v&&l(k.user)}else if(T.status!==401){const k=await T.json();throw Error(k.error??"Authentication unavailable")}}}catch(C){v&&m(C.message)}finally{v&&u(!1)}}j();const S=()=>{l(null),m("Your session expired. Sign in again.")},N=()=>g(!0);return window.addEventListener("openrod-session-expired",S),window.addEventListener(ki,N),()=>{v=!1,window.removeEventListener("openrod-session-expired",S),window.removeEventListener(ki,N)}},[]);const p=()=>m(Ml);async function x(){try{await vR("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(PP,{children:s.jsx(HZ,{children:e})}):a?s.jsx(UZ,{user:a,logout:x,children:s.jsx(DP,{user:a,logout:x,children:s.jsx(GZ,{logout:x,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 WZ="0.1.2",w4=`v${WZ}`,QZ=`https://raw.githubusercontent.com/NVIDIA/OpenShell/${w4}/install.sh`,ZZ=`curl -LsSf ${QZ} | OPENSHELL_VERSION=${w4} sh`,JZ=b.lazy(()=>wP(()=>import("./terminal-view-DzqQnmh2.js"),__vite__mapDeps([0,1])).then(e=>({default:e.TerminalView}))),Gv={sandboxes:"Sandboxes",activity:"Activity",groups:"Groups",egress:"Network",ingress:"Network",secrets:"Secrets",templates:"Templates",setups:"MCPs & Skills",connections:"Connections"};class eJ extends b.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 wR(){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 tJ({location:e,children:t}){return e?s.jsx(Da,{location:e,children:s.jsx(Gw,{children:t})}):t}function jR(){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 SR(){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"):Gv[e]?e:"sandboxes"}function nJ({onSetup:e,onConnections:t,children:r}){var j;const a=sg(),{connection:l,overview:c}=Ga(),u=!!e&&l==="setup-required",[f,m]=b.useState(null),[h,g]=b.useState({busy:!1,error:null});b.useEffect(()=>{if(!u)return;let S=!0;return a.connections().then(N=>{S&&m(N)}).catch(()=>{S&&m({locals:[]})}),()=>{S=!1}},[u,a]);const p=(f==null?void 0:f.locals)??null;if(!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 x(){g({busy:!0,error:null});try{await FM(a,p[0].name),window.location.reload()}catch(S){g({busy:!1,error:S.message})}}const v="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:[(p==null?void 0:p.length)>0&&s.jsxs(ue,{onClick:x,disabled:h.busy,title:`Use the ${p[0].name} gateway`,className:v,children:[h.busy&&s.jsx(_l,{"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:p!=null&&p.length?"ghost":void 0,onClick:e,className:p!=null&&p.length?"":v,children:[s.jsx(us,{"aria-hidden":"true",className:"size-4"}),"New sandbox"]})]}),(p==null?void 0:p.length)===0&&((j=f.tools)==null?void 0:j.openshell)===!1&&s.jsxs("div",{className:"grid w-full gap-2",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenShell isn’t installed. Install it in a terminal, then refresh this page."}),s.jsx(Li,{command:f.tools.installCommand??ZZ})]}),h.error&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:h.error})]})}function sJ(){var v;const e=YZ(),t=sg(),r=_r(),[a,l]=b.useState(SR),[c,u]=b.useState(jR),[f,m]=b.useState(0),[h,g]=b.useState(wR),p=e?void 0:()=>{x("sandboxes"),m(j=>j+1)};b.useEffect(()=>{const j=()=>{l(SR()),u(jR()),g(wR())};window.addEventListener("popstate",j),window.addEventListener("hashchange",j);const S=N=>x(N.detail.view,N.detail.location);return window.addEventListener("openrod-navigate",S),()=>{window.removeEventListener("popstate",j),window.removeEventListener("hashchange",j),window.removeEventListener("openrod-navigate",S)}},[]);function x(j,S=null){var C;if((C=t.signal)!=null&&C.aborted||!Gv[j])return;l(j),g(S);const N=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}${N}`)}return c?s.jsxs(s.Fragment,{children:[s.jsx(b.Suspense,{fallback:null,children:s.jsx(Da,{location:c.location,children:s.jsx(JZ,{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(bR,{position:"bottom-right"})]}):s.jsx(Gw,{children:s.jsxs(oW,{children:[s.jsx(pW,{view:a,onNavigate:x}),s.jsxs(lW,{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(iW,{className:"mr-2 md:hidden"}),s.jsx("h1",{className:"text-[18px] font-semibold tracking-tight",children:Gv[a]}),h&&s.jsx("span",{className:"ml-3",children:s.jsx(No,{location:h})}),s.jsx(KZ,{})]}),s.jsx(iX,{}),s.jsx(vX,{}),!e&&s.jsx(NX,{}),s.jsx(eJ,{view:a,children:s.jsx(tJ,{location:h,children:s.jsxs(nJ,{onSetup:a==="sandboxes"||a==="templates"||a==="connections"?void 0:p,onConnections:()=>x("connections"),children:[a==="sandboxes"&&s.jsx(pQ,{onNavigate:x,allowRemote:!e,createRequest:f,onCreateRequestHandled:()=>m(0)}),a==="activity"&&s.jsx(EQ,{}),a==="groups"&&s.jsx(LQ,{onNavigate:x}),(a==="egress"||a==="ingress")&&s.jsx(WQ,{tab:a,onNavigate:x}),a==="secrets"&&s.jsx(hZ,{}),a==="templates"&&s.jsx(NZ,{}),a==="setups"&&s.jsx(z3,{}),a==="connections"&&!e&&s.jsx(VZ,{onCreateSandbox:p})]})})},`${a}:${(h==null?void 0:h.target)??""}:${(h==null?void 0:h.context)??""}`)]}),s.jsx(bR,{position:"bottom-right"})]})})}bP.createRoot(document.getElementById("root")).render(s.jsx(Ze.StrictMode,{children:s.jsx(iP,{attribute:"class",defaultTheme:"system",enableSystem:!0,storageKey:"openshell-theme",children:s.jsx(XZ,{children:s.jsx(sJ,{})})})}));export{ue as B,Qo as C,Nu as D,No as L,d6 as R,e1 as T,Cn as a,aJ as b,Cu as c,uq as d,ku as e,qs as f,s as j,rp as p,b as r,BM as s,Gp as t,Bt as u};
|