openrod 0.2.0-rc.3 → 0.2.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,553 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.esm-Cj6nXjOx.js","assets/index.esm-BqjC2fhp.js","assets/index.esm-Z1y-oluO.js","assets/terminal-view-Sk9ve2lh.js","assets/terminal-view-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
+ var EP=Object.defineProperty;var RP=(e,t,r)=>t in e?EP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ln=(e,t,r)=>RP(e,typeof t!="symbol"?t+"":t,r);function AP(e,t){for(var r=0;r<t.length;r++){const a=t[r];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in e)){const c=Object.getOwnPropertyDescriptor(a,i);c&&Object.defineProperty(e,i,c.get?c:{enumerable:!0,get:()=>a[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const c of i)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(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(i){if(i.ep)return;i.ep=!0;const c=r(i);fetch(i.href,c)}})();function VR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nv={exports:{}},_d={};/**
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 XC;function MP(){if(XC)return _d;XC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(a,i,c){var u=null;if(c!==void 0&&(u=""+c),i.key!==void 0&&(u=""+i.key),"key"in i){c={};for(var f in i)f!=="key"&&(c[f]=i[f])}else c=i;return i=c.ref,{$$typeof:e,type:a,key:u,ref:i!==void 0?i:null,props:c}}return _d.Fragment=t,_d.jsx=r,_d.jsxs=r,_d}var WC;function OP(){return WC||(WC=1,nv.exports=MP()),nv.exports}var n=OP(),sv={exports:{}},Dt={};/**
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 QC;function DP(){if(QC)return Dt;QC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),v=Symbol.iterator;function w($){return $===null||typeof $!="object"?null:($=v&&$[v]||$["@@iterator"],typeof $=="function"?$:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,N={};function E($,U,F){this.props=$,this.context=U,this.refs=N,this.updater=F||C}E.prototype.isReactComponent={},E.prototype.setState=function($,U){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,U,"setState")},E.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function T(){}T.prototype=E.prototype;function R($,U,F){this.props=$,this.context=U,this.refs=N,this.updater=F||C}var M=R.prototype=new T;M.constructor=R,S(M,E.prototype),M.isPureReactComponent=!0;var A=Array.isArray;function k(){}var O={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function _($,U,F){var Y=F.ref;return{$$typeof:e,type:$,key:U,ref:Y!==void 0?Y:null,props:F}}function H($,U){return _($.type,U,$.props)}function G($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function B($){var U={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(F){return U[F]})}var P=/\/+/g;function V($,U){return typeof $=="object"&&$!==null&&$.key!=null?B(""+$.key):U.toString(36)}function q($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(k,k):($.status="pending",$.then(function(U){$.status==="pending"&&($.status="fulfilled",$.value=U)},function(U){$.status==="pending"&&($.status="rejected",$.reason=U)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function W($,U,F,Y,ne){var te=typeof $;(te==="undefined"||te==="boolean")&&($=null);var ye=!1;if($===null)ye=!0;else switch(te){case"bigint":case"string":case"number":ye=!0;break;case"object":switch($.$$typeof){case e:case t:ye=!0;break;case g:return ye=$._init,W(ye($._payload),U,F,Y,ne)}}if(ye)return ne=ne($),ye=Y===""?"."+V($,0):Y,A(ne)?(F="",ye!=null&&(F=ye.replace(P,"$&/")+"/"),W(ne,U,F,"",function(se){return se})):ne!=null&&(G(ne)&&(ne=H(ne,F+(ne.key==null||$&&$.key===ne.key?"":(""+ne.key).replace(P,"$&/")+"/")+ye)),U.push(ne)),1;ye=0;var ae=Y===""?".":Y+":";if(A($))for(var ue=0;ue<$.length;ue++)Y=$[ue],te=ae+V(Y,ue),ye+=W(Y,U,F,te,ne);else if(ue=w($),typeof ue=="function")for($=ue.call($),ue=0;!(Y=$.next()).done;)Y=Y.value,te=ae+V(Y,ue++),ye+=W(Y,U,F,te,ne);else if(te==="object"){if(typeof $.then=="function")return W(q($),U,F,Y,ne);throw U=String($),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return ye}function K($,U,F){if($==null)return $;var Y=[],ne=0;return W($,Y,"","",function(te){return U.call(F,te,ne++)}),Y}function J($){if($._status===-1){var U=$._result,F=U();F.then(function(Y){($._status===0||$._status===-1)&&($._status=1,$._result=Y,F.status===void 0&&(F.status="fulfilled",F.value=Y))},function(Y){($._status===0||$._status===-1)&&($._status=2,$._result=Y,F.status===void 0&&(F.status="rejected",F.reason=Y))}),$._status===-1&&($._status=0,$._result=F)}if($._status===1)return $._result.default;throw $._result}var z=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)};function L($){var U=O.T,F={};F.types=U!==null?U.types:null,O.T=F;try{var Y=$(),ne=O.S;ne!==null&&ne(F,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(k,z)}catch(te){z(te)}finally{U!==null&&F.types!==null&&(U.types=F.types),O.T=U}}function X($){var U=O.T;if(U!==null){var F=U.types;F===null?U.types=[$]:F.indexOf($)===-1&&F.push($)}else L(X.bind(null,$))}var ee={map:K,forEach:function($,U,F){K($,function(){U.apply(this,arguments)},F)},count:function($){var U=0;return K($,function(){U++}),U},toArray:function($){return K($,function(U){return U})||[]},only:function($){if(!G($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return Dt.Activity=p,Dt.Children=ee,Dt.Component=E,Dt.Fragment=r,Dt.Profiler=i,Dt.PureComponent=R,Dt.StrictMode=a,Dt.Suspense=m,Dt.ViewTransition=b,Dt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Dt.__COMPILER_RUNTIME={__proto__:null,c:function($){return O.H.useMemoCache($)}},Dt.addTransitionType=X,Dt.cache=function($){return function(){return $.apply(null,arguments)}},Dt.cacheSignal=function(){return null},Dt.cloneElement=function($,U,F){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var Y=S({},$.props),ne=$.key;if(U!=null)for(te in U.key!==void 0&&(ne=""+U.key),U)!D.call(U,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&U.ref===void 0||(Y[te]=U[te]);var te=arguments.length-2;if(te===1)Y.children=F;else if(1<te){for(var ye=Array(te),ae=0;ae<te;ae++)ye[ae]=arguments[ae+2];Y.children=ye}return _($.type,ne,Y)},Dt.createContext=function($){return $={$$typeof:u,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:c,_context:$},$},Dt.createElement=function($,U,F){var Y,ne={},te=null;if(U!=null)for(Y in U.key!==void 0&&(te=""+U.key),U)D.call(U,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(ne[Y]=U[Y]);var ye=arguments.length-2;if(ye===1)ne.children=F;else if(1<ye){for(var ae=Array(ye),ue=0;ue<ye;ue++)ae[ue]=arguments[ue+2];ne.children=ae}if($&&$.defaultProps)for(Y in ye=$.defaultProps,ye)ne[Y]===void 0&&(ne[Y]=ye[Y]);return _($,te,ne)},Dt.createRef=function(){return{current:null}},Dt.forwardRef=function($){return{$$typeof:f,render:$}},Dt.isValidElement=G,Dt.lazy=function($){return{$$typeof:g,_payload:{_status:-1,_result:$},_init:J}},Dt.memo=function($,U){return{$$typeof:h,type:$,compare:U===void 0?null:U}},Dt.startTransition=L,Dt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Dt.use=function($){return O.H.use($)},Dt.useActionState=function($,U,F){return O.H.useActionState($,U,F)},Dt.useCallback=function($,U){return O.H.useCallback($,U)},Dt.useContext=function($){return O.H.useContext($)},Dt.useDebugValue=function(){},Dt.useDeferredValue=function($,U){return O.H.useDeferredValue($,U)},Dt.useEffect=function($,U){return O.H.useEffect($,U)},Dt.useEffectEvent=function($){return O.H.useEffectEvent($)},Dt.useId=function(){return O.H.useId()},Dt.useImperativeHandle=function($,U,F){return O.H.useImperativeHandle($,U,F)},Dt.useInsertionEffect=function($,U){return O.H.useInsertionEffect($,U)},Dt.useLayoutEffect=function($,U){return O.H.useLayoutEffect($,U)},Dt.useMemo=function($,U){return O.H.useMemo($,U)},Dt.useOptimistic=function($,U){return O.H.useOptimistic($,U)},Dt.useReducer=function($,U,F){return O.H.useReducer($,U,F)},Dt.useRef=function($){return O.H.useRef($)},Dt.useState=function($){return O.H.useState($)},Dt.useSyncExternalStore=function($,U,F){return O.H.useSyncExternalStore($,U,F)},Dt.useTransition=function(){return O.H.useTransition()},Dt.version="19.3.0",Dt}var ZC;function Df(){return ZC||(ZC=1,sv.exports=DP()),sv.exports}var x=Df();const nt=VR(x),zP=AP({__proto__:null,default:nt},[x]);var IP=(e,t,r,a,i,c,u,f)=>{let m=document.documentElement,h=["light","dark"];function g(v){(Array.isArray(e)?e:[e]).forEach(w=>{let C=w==="class",S=C&&c?i.map(N=>c[N]||N):i;C?(m.classList.remove(...S),m.classList.add(c&&c[v]?c[v]:v)):m.setAttribute(w,v)}),p(v)}function p(v){f&&h.includes(v)&&(m.style.colorScheme=v)}function b(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(a)g(a);else try{let v=localStorage.getItem(t)||r,w=u&&v==="system"?b():v;g(w)}catch{}},JC=["light","dark"],UR="(prefers-color-scheme: dark)",PP=typeof window>"u",_1=x.createContext(void 0),_P={setTheme:e=>{},themes:[]},HR=()=>{var e;return(e=x.useContext(_1))!=null?e:_P},LP=e=>x.useContext(_1)?x.createElement(x.Fragment,null,e.children):x.createElement(BP,{...e}),$P=["light","dark"],BP=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:a=!0,storageKey:i="theme",themes:c=$P,defaultTheme:u=r?"system":"light",attribute:f="data-theme",value:m,children:h,nonce:g,scriptProps:p})=>{let[b,v]=x.useState(()=>UP(i,u)),[w,C]=x.useState(()=>b==="system"?rv():b),S=m?Object.values(m):c,N=x.useCallback(M=>{let A=M;if(!A)return;M==="system"&&r&&(A=rv());let k=m?m[A]:A,O=t?HP(g):null,D=document.documentElement,_=H=>{H==="class"?(D.classList.remove(...S),k&&D.classList.add(k)):H.startsWith("data-")&&(k?D.setAttribute(H,k):D.removeAttribute(H))};if(Array.isArray(f)?f.forEach(_):_(f),a){let H=JC.includes(u)?u:null,G=JC.includes(A)?A:H;D.style.colorScheme=G}O==null||O()},[g]),E=x.useCallback(M=>{let A=typeof M=="function"?M(b):M;v(A);try{localStorage.setItem(i,A)}catch{}},[b]),T=x.useCallback(M=>{let A=rv(M);C(A),b==="system"&&r&&!e&&N("system")},[b,e]);x.useEffect(()=>{let M=window.matchMedia(UR);return M.addListener(T),T(M),()=>M.removeListener(T)},[T]),x.useEffect(()=>{let M=A=>{A.key===i&&(A.newValue?v(A.newValue):E(u))};return window.addEventListener("storage",M),()=>window.removeEventListener("storage",M)},[E]),x.useEffect(()=>{N(e??b)},[e,b]);let R=x.useMemo(()=>({theme:b,setTheme:E,forcedTheme:e,resolvedTheme:b==="system"?w:b,themes:r?[...c,"system"]:c,systemTheme:r?w:void 0}),[b,E,e,w,r,c]);return x.createElement(_1.Provider,{value:R},x.createElement(VP,{forcedTheme:e,storageKey:i,attribute:f,enableSystem:r,enableColorScheme:a,defaultTheme:u,value:m,themes:c,nonce:g,scriptProps:p}),h)},VP=x.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:a,enableColorScheme:i,defaultTheme:c,value:u,themes:f,nonce:m,scriptProps:h})=>{let g=JSON.stringify([r,t,c,e,f,u,a,i]).slice(1,-1);return x.createElement("script",{...h,suppressHydrationWarning:!0,nonce:typeof window>"u"?m:"",dangerouslySetInnerHTML:{__html:`(${IP.toString()})(${g})`}})}),UP=(e,t)=>{if(PP)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},HP=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)}},rv=e=>(e||(e=window.matchMedia(UR)),e.matches?"dark":"light"),ov={exports:{}},Ld={},av={exports:{}},iv={};/**
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 ek;function FP(){return ek||(ek=1,(function(e){function t(q,W){var K=q.length;q.push(W);e:for(;0<K;){var J=K-1>>>1,z=q[J];if(0<i(z,W))q[J]=W,q[K]=z,K=J;else break e}}function r(q){return q.length===0?null:q[0]}function a(q){if(q.length===0)return null;var W=q[0],K=q.pop();if(K!==W){q[0]=K;e:for(var J=0,z=q.length,L=z>>>1;J<L;){var X=2*(J+1)-1,ee=q[X],$=X+1,U=q[$];if(0>i(ee,K))$<z&&0>i(U,ee)?(q[J]=U,q[$]=K,J=$):(q[J]=ee,q[X]=K,J=X);else if($<z&&0>i(U,K))q[J]=U,q[$]=K,J=$;else break e}}return W}function i(q,W){var K=q.sortIndex-W.sortIndex;return K!==0?K:q.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var m=[],h=[],g=1,p=null,b=3,v=!1,w=!1,C=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function R(q){for(var W=r(h);W!==null;){if(W.callback===null)a(h);else if(W.startTime<=q)a(h),W.sortIndex=W.expirationTime,t(m,W);else break;W=r(h)}}function M(q){if(C=!1,R(q),!w)if(r(m)!==null)w=!0,A||(A=!0,G());else{var W=r(h);W!==null&&V(M,W.startTime-q)}}var A=!1,k=-1,O=5,D=-1;function _(){return S?!0:!(e.unstable_now()-D<O)}function H(){if(S=!1,A){var q=e.unstable_now();D=q;var W=!0;try{e:{w=!1,C&&(C=!1,E(k),k=-1),v=!0;var K=b;try{t:{for(R(q),p=r(m);p!==null&&!(p.expirationTime>q&&_());){var J=p.callback;if(typeof J=="function"){p.callback=null,b=p.priorityLevel;var z=J(p.expirationTime<=q);if(q=e.unstable_now(),typeof z=="function"){p.callback=z,R(q),W=!0;break t}p===r(m)&&a(m),R(q)}else a(m);p=r(m)}if(p!==null)W=!0;else{var L=r(h);L!==null&&V(M,L.startTime-q),W=!1}}break e}finally{p=null,b=K,v=!1}W=void 0}}finally{W?G():A=!1}}}var G;if(typeof T=="function")G=function(){T(H)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,P=B.port2;B.port1.onmessage=H,G=function(){P.postMessage(null)}}else G=function(){N(H,0)};function V(q,W){k=N(function(){q(e.unstable_now())},W)}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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(q){switch(b){case 1:case 2:case 3:var W=3;break;default:W=b}var K=b;b=W;try{return q()}finally{b=K}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(q,W){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var K=b;b=q;try{return W()}finally{b=K}},e.unstable_scheduleCallback=function(q,W,K){var J=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?J+K:J):K=J,q){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=K+z,q={id:g++,callback:W,priorityLevel:q,startTime:K,expirationTime:z,sortIndex:-1},K>J?(q.sortIndex=K,t(h,q),r(m)===null&&q===r(h)&&(C?(E(k),k=-1):C=!0,V(M,K-J))):(q.sortIndex=z,t(m,q),w||v||(w=!0,A||(A=!0,G()))),q},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(q){var W=b;return function(){var K=b;b=W;try{return q.apply(this,arguments)}finally{b=K}}}})(iv)),iv}var tk;function GP(){return tk||(tk=1,av.exports=FP()),av.exports}var lv={exports:{}},Bs={};/**
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 nk;function qP(){if(nk)return Bs;nk=1;var e=Df();function t(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal"),c=Symbol.for("react.recoverable"),u=Symbol.for("react.optimistic_key");function f(g,p,b){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:v==null?null:v===u?u:""+v,children:g,containerInfo:p,implementation:b}}var m=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Bs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Bs.browser=function(g){return{$$typeof:c,_reason:g}},Bs.createPortal=function(g,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return f(g,p,null,b)},Bs.flushSync=function(g){var p=m.T,b=a.p;try{if(m.T=null,a.p=2,g)return g()}finally{m.T=p,a.p=b,a.d.f()}},Bs.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))},Bs.prefetchDNS=function(g){typeof g=="string"&&a.d.D(g)},Bs.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var b=p.as,v=h(b,p.crossOrigin),w=typeof p.integrity=="string"?p.integrity:void 0,C=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?a.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:w,fetchPriority:C}):b==="script"&&a.d.X(g,{crossOrigin:v,integrity:w,fetchPriority:C,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Bs.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=h(p.as,p.crossOrigin);a.d.M(g,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0})}}else p==null&&a.d.M(g)},Bs.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,v=h(b,p.crossOrigin);a.d.L(g,b,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Bs.preloadModule=function(g,p){if(typeof g=="string")if(p){var b=h(p.as,p.crossOrigin);a.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0})}else a.d.m(g)},Bs.requestFormReset=function(g){a.d.r(g)},Bs.unstable_batchedUpdates=function(g,p){return g(p)},Bs.useFormState=function(g,p,b){return m.H.useFormState(g,p,b)},Bs.useFormStatus=function(){return m.H.useHostTransitionStatus()},Bs.version="19.3.0",Bs}var sk;function FR(){if(sk)return lv.exports;sk=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(),lv.exports=qP(),lv.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 rk;function YP(){if(rk)return Ld;rk=1;var e=GP(),t=Df(),r=FR();function a(s){var o="https://react.dev/errors/"+s;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)o+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function c(s){for(var o=s,l=o;l&&!l.alternate;)o=l,(o.flags&4098)!==0&&(s=o.return),l=o.return;for(;o.return;)o=o.return;return o.tag===3?s:null}function u(s){if(s.tag===13){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function f(s){if(s.tag===31){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function m(s){if(c(s)!==s)throw Error(a(188))}function h(s){var o=s.alternate;if(!o){if(o=c(s),o===null)throw Error(a(188));return o!==s?null:s}for(var l=s,d=o;;){var y=l.return;if(y===null)break;var j=y.alternate;if(j===null){if(d=y.return,d!==null){l=d;continue}break}if(y.child===j.child){for(j=y.child;j;){if(j===l)return m(y),s;if(j===d)return m(y),o;j=j.sibling}throw Error(a(188))}if(l.return!==d.return)l=y,d=j;else{for(var I=!1,Z=y.child;Z;){if(Z===l){I=!0,l=y,d=j;break}if(Z===d){I=!0,d=y,l=j;break}Z=Z.sibling}if(!I){for(Z=j.child;Z;){if(Z===l){I=!0,l=j,d=y;break}if(Z===d){I=!0,d=j,l=y;break}Z=Z.sibling}if(!I)throw Error(a(189))}}if(l.alternate!==d)throw Error(a(190))}if(l.tag!==3)throw Error(a(188));return l.stateNode.current===l?s:o}function g(s){var o=s.tag;if(o===5||o===26||o===27||o===6)return s;for(s=s.child;s!==null;){if(o=g(s),o!==null)return o;s=s.sibling}return null}function p(s,o,l,d,y,j){for(;s!==null;){if((s.tag===5||s.tag===27||s.tag===6)&&l(s,d,y,j)||(s.tag!==22||s.memoizedState===null)&&(o||s.tag!==5&&s.tag!==27)&&p(s.child,o,l,d,y,j))return!0;s=s.sibling}return!1}function b(s){for(s=s.return;s!==null;){if(s.tag===3||s.tag===5||s.tag===27)return s;s=s.return}return null}function v(s){var o=!1;for(s=s.return;s!==null&&(s.tag===4&&(o=!0),!(s.tag===3||s.tag===5||s.tag===27));)s=s.return;return o}function w(s){var o=[null,null],l=b(s);return l===null||C(o,s,l.child,{foundSelf:!1}),o}function C(s,o,l,d){for(;l!==null;){if(l===o)d.foundSelf=!0;else if(l.tag===5||l.tag===27||l.tag===6){if(d.foundSelf)return s[1]=l,!0;s[0]=l}else if((l.tag!==22||l.memoizedState===null)&&C(s,o,l.child,d))return!0;l=l.sibling}return!1}function S(s){switch(s.tag){case 5:case 27:case 6:return s.stateNode;case 3:return s.stateNode.containerInfo;default:throw Error(a(559))}}var N=null,E=null;function T(s,o,l){return s===l?!0:s===o?(N=s,!0):!1}function R(s,o,l){return s===l?(E=s,!1):s===o?(E!==null&&(N=s),!0):!1}function M(s){if(s===null)return null;do s=s===null?null:s.return;while(s&&s.tag!==5&&s.tag!==27&&s.tag!==3);return s||null}function A(s,o,l){for(var d=0,y=s;y;y=l(y))d++;y=0;for(var j=o;j;j=l(j))y++;for(;0<d-y;)s=l(s),d--;for(;0<y-d;)o=l(o),y--;for(;d--;){if(s===o||o!==null&&s===o.alternate)return s;s=l(s),o=l(o)}return null}var k=Object.assign,O=Symbol.for("react.element"),D=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),V=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),X=Symbol.for("react.legacy_hidden"),ee=Symbol.for("react.memo_cache_sentinel"),$=Symbol.for("react.view_transition"),U=Symbol.for("react.recoverable"),F=Symbol.iterator;function Y(s){return s===null||typeof s!="object"?null:(s=F&&s[F]||s["@@iterator"],typeof s=="function"?s:null)}var ne=Symbol.for("react.client.reference");function te(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===ne?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case H:return"Fragment";case B:return"Profiler";case G:return"StrictMode";case W:return"Suspense";case K:return"SuspenseList";case L:return"Activity";case $:return"ViewTransition"}if(typeof s=="object")switch(s.$$typeof){case _:return"Portal";case V:return s.displayName||"Context";case P:return(s._context.displayName||"Context")+".Consumer";case q:var o=s.render;return s=s.displayName,s||(s=o.displayName||o.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case J:return o=s.displayName||null,o!==null?o:te(s.type)||"Memo";case z:o=s._payload,s=s._init;try{return te(s(o))}catch{}}return null}var ye=Array.isArray,ae=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},Q=[],ie=-1;function oe(s){return{current:s}}function pe(s){0>ie||(s.current=Q[ie],Q[ie]=null,ie--)}function xe(s,o){ie++,Q[ie]=s.current,s.current=o}var je=oe(null),Ie=oe(null),ce=oe(null),Te=oe(null);function re(s,o){switch(xe(ce,o),xe(Ie,s),xe(je,null),o.nodeType){case 9:case 11:s=(s=o.documentElement)&&(s=s.namespaceURI)?rC(s):0;break;default:if(s=o.tagName,o=o.namespaceURI)o=rC(o),s=oC(o,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}pe(je),xe(je,s)}function fe(){pe(je),pe(Ie),pe(ce)}function Re(s){var o=s.memoizedState;o!==null&&(nu._currentValue=o.memoizedState,xe(Te,s)),o=je.current;var l=oC(o,s.type);o!==l&&(xe(Ie,s),xe(je,l))}function Oe(s){Ie.current===s&&(pe(je),pe(Ie)),Te.current===s&&(pe(Te),nu._currentValue=se)}var ke,he;function Ae(s){if(ke===void 0)try{throw Error()}catch(l){var o=l.stack.trim().match(/\n( *(at )?)/);ke=o&&o[1]||"",he=-1<l.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+ke+s+he}var ge=!1;function Pe(s,o){if(!s||ge)return"";ge=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(o){var $e=function(){throw Error()};if(Object.defineProperty($e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct($e,[])}catch(ot){var we=ot}Reflect.construct(s,[],$e)}else{try{$e.call()}catch(ot){we=ot}$e=!1;try{var Me=Object.getOwnPropertyDescriptor(s.prototype,"props");Object.defineProperty(s.prototype,"props",{configurable:!0,set:function(){throw Error()}}),$e=!0,new s}finally{$e&&(Me!==void 0?Object.defineProperty(s.prototype,"props",Me):delete s.prototype.props)}}}else{try{throw Error()}catch(ot){we=ot}($e=s())&&typeof $e.catch=="function"&&$e.catch(function(){})}}catch(ot){if(ot&&we&&typeof ot.stack=="string")return[ot.stack,we.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 j=d.DetermineComponentFrameRoot(),I=j[0],Z=j[1];if(I&&Z){var me=I.split(`
45
+ `),Ce=Z.split(`
46
+ `);for(y=d=0;d<me.length&&!me[d].includes("DetermineComponentFrameRoot");)d++;for(;y<Ce.length&&!Ce[y].includes("DetermineComponentFrameRoot");)y++;if(d===me.length||y===Ce.length)for(d=me.length-1,y=Ce.length-1;1<=d&&0<=y&&me[d]!==Ce[y];)y--;for(;1<=d&&0<=y;d--,y--)if(me[d]!==Ce[y]){if(d!==1||y!==1)do if(d--,y--,0>y||me[d]!==Ce[y]){var ze=`
47
+ `+me[d].replace(" at new "," at ");return s.displayName&&ze.includes("<anonymous>")&&(ze=ze.replace("<anonymous>",s.displayName)),ze}while(1<=d&&0<=y);break}}}finally{ge=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Ae(l):""}function Fe(s,o){switch(s.tag){case 26:case 27:case 5:return Ae(s.type);case 16:return Ae("Lazy");case 13:return s.child!==o&&o!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return Pe(s.type,!1);case 11:return Pe(s.type.render,!1);case 1:return Pe(s.type,!0);case 31:return Ae("Activity");case 30:return Ae("ViewTransition");default:return""}}function _e(s){try{var o="",l=null;do o+=Fe(s,l),l=s,s=s.return;while(s);return o}catch(d){return`
48
+ Error generating stack: `+d.message+`
49
+ `+d.stack}}var Xe=Object.prototype.hasOwnProperty,Je=e.unstable_scheduleCallback,ct=e.unstable_cancelCallback,At=e.unstable_shouldYield,rt=e.unstable_requestPaint,ve=e.unstable_now,Ue=e.unstable_getCurrentPriorityLevel,Qe=e.unstable_ImmediatePriority,xt=e.unstable_UserBlockingPriority,Ke=e.unstable_NormalPriority,Be=e.unstable_LowPriority,jt=e.unstable_IdlePriority,Ze=e.log,Tt=e.unstable_setDisableYieldValue,Se=null,Ye=null;function et(s){if(typeof Ze=="function"&&Tt(s),Ye&&typeof Ye.setStrictMode=="function")try{Ye.setStrictMode(Se,s)}catch{}}var it=Math.clz32?Math.clz32:cn,lt=Math.log,wt=Math.LN2;function cn(s){return s>>>=0,s===0?32:31-(lt(s)/wt|0)|0}var Gt=256,fn=262144,Bn=4194304;function Kn(s){var o=s&42;if(o!==0)return o;switch(s&-s){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 s&-s;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function de(s,o,l){var d=s.pendingLanes;if(d===0)return 0;var y=0,j=s.suspendedLanes,I=s.pingedLanes;s=s.warmLanes;var Z=d&134217727;return Z!==0?(d=Z&~j,d!==0?y=Kn(d):(I&=Z,I!==0?y=Kn(I):l||(l=Z&~s,l!==0&&(y=Kn(l))))):(Z=d&~j,Z!==0?y=Kn(Z):I!==0?y=Kn(I):l||(l=d&~s,l!==0&&(y=Kn(l)))),y===0?0:o!==0&&o!==y&&(o&j)===0&&(j=y&-y,l=o&-o,j>=l||j===32&&(l&4194048)!==0)?o:y}function tt(s,o){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&o)===0}function Et(s,o){(o&8)!==0&&(o|=o&32);var l=s.entangledLanes;if(l!==0)for(s=s.entanglements,l&=o;0<l;){var d=31-it(l),y=1<<d;o|=s[d],l&=~y}return o}function on(s,o){switch(s){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 xn(){var s=Bn;return Bn<<=1,(Bn&62914560)===0&&(Bn=4194304),s}function Wt(s){for(var o=[],l=0;31>l;l++)o.push(s);return o}function un(s,o){s.pendingLanes|=o,o!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function ns(s,o,l,d,y,j){var I=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var Z=s.entanglements,me=s.expirationTimes,Ce=s.hiddenUpdates;for(l=I&~l;0<l;){var ze=31-it(l),$e=1<<ze;Z[ze]=0,me[ze]=-1;var we=Ce[ze];if(we!==null)for(Ce[ze]=null,ze=0;ze<we.length;ze++){var Me=we[ze];Me!==null&&(Me.lane&=-536870913)}l&=~$e}d!==0&&Jn(s,d,0),j!==0&&y===0&&s.tag!==0&&(s.suspendedLanes|=j&~(I&~o))}function Jn(s,o,l){s.pendingLanes|=o,s.suspendedLanes&=~o;var d=31-it(o);s.entangledLanes|=o,s.entanglements[d]=s.entanglements[d]|1073741824|l&261930}function wo(s,o){var l=s.entangledLanes|=o;for(s=s.entanglements;l;){var d=31-it(l),y=1<<d;y&o|s[d]&o&&(s[d]|=o),l&=~y}}function jo(s,o){var l=o&-o;return l=(l&42)!==0?1:cr(l),(l&(s.suspendedLanes|o))!==0?0:l}function cr(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Fs(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ds(){var s=ue.p;return s!==0?s:(s=window.event,s===void 0?32:UC(s.type))}function Ms(s,o){var l=ue.p;try{return ue.p=s,o()}finally{ue.p=l}}var Pn=Math.random().toString(36).slice(2),Un="__reactFiber$"+Pn,Os="__reactProps$"+Pn,Nr="__reactContainer$"+Pn,Gu="__reactEvents$"+Pn,gc="__reactListeners$"+Pn,xc="__reactHandles$"+Pn,ai="__reactResources$"+Pn,cl="__reactMarker$"+Pn,bc="__reactLoad$"+Pn;function vc(s){delete s[Un],delete s[Os],delete s[gc],delete s[xc]}function So(s){var o;if(o=s[Un])return o;for(var l=s.parentNode;l;){if(o=l[Nr]||l[Un]){if(l=o.alternate,o.child!==null||l!==null&&l.child!==null)for(s=jC(s);s!==null;){if(l=s[Un])return l;s=jC(s)}return o}s=l,l=s.parentNode}return null}function ul(s){if(s=s[Un]||s[Nr]){var o=s.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return s}return null}function De(s){var o=s.tag;if(o===5||o===26||o===27||o===6)return s.stateNode;throw Error(a(33))}function Ge(s){var o=s[ai];return o||(o=s[ai]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function qe(s){s[cl]=!0}function bt(s){s[bc]=void 0}var zt=new Set,Mt={};function Bt(s,o){Nn(s,o),Nn(s+"Capture",o)}function Nn(s,o){for(Mt[s]=o,s=0;s<o.length;s++)zt.add(o[s])}var hn=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]*$"),Ct={},It={};function an(s){return Xe.call(It,s)?!0:Xe.call(Ct,s)?!1:hn.test(s)?It[s]=!0:(Ct[s]=!0,!1)}var St=!1;function fs(){var s=St;return St=!1,s}function Hn(s,o,l){if(an(o))if(l===null)s.removeAttribute(o);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(o);return;case"boolean":var d=o.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(o);return}}s.setAttribute(o,l)}}function Cr(s,o,l){if(l===null)s.removeAttribute(o);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttribute(o,l)}}function ss(s,o,l,d){if(d===null)s.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(o,l,d)}}function rs(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function yc(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function qu(s,o,l){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,o);if(!s.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,j=d.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return y.call(this)},set:function(I){l=""+I,j.call(this,I)}}),Object.defineProperty(s,o,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(I){l=""+I},stopTracking:function(){s._valueTracker=null,delete s[o]}}}}function ja(s){if(!s._valueTracker){var o=yc(s)?"checked":"value";s._valueTracker=qu(s,o,""+s[o])}}function wc(s){if(!s)return!1;var o=s._valueTracker;if(!o)return!0;var l=o.getValue(),d="";return s&&(d=yc(s)?s.checked?"true":"false":s.value),s=d,s!==l?(o.setValue(s),!0):!1}var dh=/[\n"\\]/g;function _n(s){return s.replace(dh,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Gs(s,o,l,d,y,j,I,Z){s.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.type=I:s.removeAttribute("type"),o!=null?I==="number"?(o===0&&s.value===""||s.value!=o)&&(s.value=""+rs(o)):s.value!==""+rs(o)&&(s.value=""+rs(o)):I!=="submit"&&I!=="reset"||s.removeAttribute("value"),o!=null?I==="number"&&s.value==o?jc(s,rs(s.value)):jc(s,rs(o)):l!=null?jc(s,rs(l)):d!=null&&s.removeAttribute("value"),y==null&&j!=null&&(s.defaultChecked=!!j),y!=null&&(s.checked=y&&typeof y!="function"&&typeof y!="symbol"),Z!=null&&typeof Z!="function"&&typeof Z!="symbol"&&typeof Z!="boolean"?s.name=""+rs(Z):s.removeAttribute("name")}function ii(s,o,l,d,y,j,I,Z){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.type=j),o!=null||l!=null){if(!(j!=="submit"&&j!=="reset"||o!=null)){ja(s);return}l=l!=null?""+rs(l):"",o=o!=null?""+rs(o):l,Z||o===s.value||(s.value=o),s.defaultValue=o}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=Z?s.checked:!!d,s.defaultChecked=!!d,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(s.name=I),ja(s)}function jc(s,o){s.defaultValue!==""+o&&(s.defaultValue=""+o)}function ur(s,o,l,d){if(s=s.options,o){o={};for(var y=0;y<l.length;y++)o["$"+l[y]]=!0;for(l=0;l<s.length;l++)y=o.hasOwnProperty("$"+s[l].value),s[l].selected!==y&&(s[l].selected=y),y&&d&&(s[l].defaultSelected=!0)}else{for(l=""+rs(l),o=null,y=0;y<s.length;y++){if(s[y].value===l){s[y].selected=!0,d&&(s[y].defaultSelected=!0);return}o!==null||s[y].disabled||(o=s[y])}o!==null&&(o.selected=!0)}}function Sc(s,o,l){if(o!=null&&(o=""+rs(o),o!==s.value&&(s.value=o),l==null)){s.defaultValue!==o&&(s.defaultValue=o);return}s.defaultValue=l!=null?""+rs(l):""}function kr(s,o,l,d){if(o==null){if(d!=null){if(l!=null)throw Error(a(92));if(ye(d)){if(1<d.length)throw Error(a(93));d=d[0]}l=d}l==null&&(l=""),o=l}l=rs(o),s.defaultValue=l,d=s.textContent,d===l&&d!==""&&d!==null&&(s.value=d),ja(s)}function Js(s,o){if(o){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=o;return}}s.textContent=o}var li=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 Yu(s,o,l){var d=o.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?s.setProperty(o,""):o==="float"?s.cssFloat="":s[o]="":d?s.setProperty(o,l):typeof l!="number"||l===0||li.has(o)?o==="float"?s.cssFloat=l:s[o]=(""+l).trim():s[o]=l+"px"}function Tr(s,o,l){if(o!=null&&typeof o!="object")throw Error(a(62));if(s=s.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||o!=null&&o.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="",St=!0);for(var y in o)d=o[y],o.hasOwnProperty(y)&&l[y]!==d&&(Yu(s,y,d),St=!0)}else for(var j in o)o.hasOwnProperty(j)&&Yu(s,j,o[j])}function dl(s){if(s.indexOf("-")===-1)return!1;switch(s){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 Ku=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"]]),Xu=/^[\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 Ds(s){return Xu.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function er(){}var fl=null;function hl(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Zt=null,Ss=null;function Zr(s){var o=ul(s);if(o&&(s=o.stateNode)){var l=s[Os]||null;e:switch(s=o.stateNode,o.type){case"input":if(Gs(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),o=l.name,l.type==="radio"&&o!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+_n(""+o)+'"][type="radio"]'),o=0;o<l.length;o++){var d=l[o];if(d!==s&&d.form===s.form){var y=d[Os]||null;if(!y)throw Error(a(90));Gs(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(o=0;o<l.length;o++)d=l[o],d.form===s.form&&wc(d)}break e;case"textarea":Sc(s,l.value,l.defaultValue);break e;case"select":o=l.value,o!=null&&ur(s,!!l.multiple,o,!1)}}}var Er=!1;function ml(s,o,l){if(Er)return s(o,l);Er=!0;try{var d=s(o);return d}finally{if(Er=!1,(Zt!==null||Ss!==null)&&(dm(),Zt&&(o=Zt,s=Ss,Ss=Zt=null,Zr(o),s)))for(o=0;o<s.length;o++)Zr(s[o])}}function Sa(s,o){var l=s.stateNode;if(l===null)return null;var d=l[Os]||null;if(d===null)return null;l=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)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(a(231,o,typeof l));return l}var zs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pl=!1;if(zs)try{var Wu={};Object.defineProperty(Wu,"passive",{get:function(){pl=!0}}),window.addEventListener("test",Wu,Wu),window.removeEventListener("test",Wu,Wu)}catch{pl=!1}var ci=null,Bx=null,fh=null;function ej(){if(fh)return fh;var s,o=Bx,l=o.length,d,y="value"in ci?ci.value:ci.textContent,j=y.length;for(s=0;s<l&&o[s]===y[s];s++);var I=l-s;for(d=1;d<=I&&o[l-d]===y[j-d];d++);return fh=y.slice(s,1<d?1-d:void 0)}function hh(s){var o=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&o===13&&(s=13)):s=o,s===10&&(s=13),32<=s||s===13?s:0}function mh(){return!0}function tj(){return!1}function tr(s){function o(l,d,y,j,I){this._reactName=l,this._targetInst=y,this.type=d,this.nativeEvent=j,this.target=I,this.currentTarget=null;for(var Z in s)s.hasOwnProperty(Z)&&(l=s[Z],this[Z]=l?l(j):j[Z]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?mh:tj,this.isPropagationStopped=tj,this}return k(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=mh)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=mh)},persist:function(){},isPersistent:mh}),o}var ui={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ph=tr(ui),Qu=k({},ui,{view:0,detail:0}),JD=tr(Qu),Vx,Ux,Zu,gh=k({},Qu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fx,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Zu&&(Zu&&s.type==="mousemove"?(Vx=s.screenX-Zu.screenX,Ux=s.screenY-Zu.screenY):Ux=Vx=0,Zu=s),Vx)},movementY:function(s){return"movementY"in s?s.movementY:Ux}}),nj=tr(gh),ez=k({},gh,{dataTransfer:0}),tz=tr(ez),nz=k({},Qu,{relatedTarget:0}),Hx=tr(nz),sz=k({},ui,{animationName:0,elapsedTime:0,pseudoElement:0}),rz=tr(sz),oz=k({},ui,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),az=tr(oz),iz=k({},ui,{data:0}),sj=tr(iz),lz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cz={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"},uz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dz(s){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(s):(s=uz[s])?!!o[s]:!1}function Fx(){return dz}var fz=k({},Qu,{key:function(s){if(s.key){var o=lz[s.key]||s.key;if(o!=="Unidentified")return o}return s.type==="keypress"?(s=hh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?cz[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fx,charCode:function(s){return s.type==="keypress"?hh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?hh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),hz=tr(fz),mz=k({},gh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rj=tr(mz),pz=k({},ui,{submitter:0}),gz=tr(pz),xz=k({},Qu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fx}),bz=tr(xz),vz=k({},ui,{propertyName:0,elapsedTime:0,pseudoElement:0}),yz=tr(vz),wz=k({},gh,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),jz=tr(wz),Sz=k({},ui,{newState:0,oldState:0,source:0}),Nz=tr(Sz),Cz=[9,13,27,32],Gx=zs&&"CompositionEvent"in window,Ju=null;zs&&"documentMode"in document&&(Ju=document.documentMode);var kz=zs&&"TextEvent"in window&&!Ju,oj=zs&&(!Gx||Ju&&8<Ju&&11>=Ju),aj=" ",ij=!1;function lj(s,o){switch(s){case"keyup":return Cz.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cj(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Nc=!1;function Tz(s,o){switch(s){case"compositionend":return cj(o);case"keypress":return o.which!==32?null:(ij=!0,aj);case"textInput":return s=o.data,s===aj&&ij?null:s;default:return null}}function Ez(s,o){if(Nc)return s==="compositionend"||!Gx&&lj(s,o)?(s=ej(),fh=Bx=ci=null,Nc=!1,s):null;switch(s){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 Rz={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(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o==="input"?!!Rz[s.type]:o==="textarea"}function dj(s,o,l,d){Zt?Ss?Ss.push(d):Ss=[d]:Zt=d,o=xm(o,"onChange"),0<o.length&&(l=new ph("onChange","change",null,l,d),s.push({event:l,listeners:o}))}var ed=null,td=null;function Az(s){ZN(s,0)}function xh(s){var o=De(s);if(wc(o))return s}function fj(s,o){if(s==="change")return o}var hj=!1;if(zs){var qx;if(zs){var Yx="oninput"in document;if(!Yx){var mj=document.createElement("div");mj.setAttribute("oninput","return;"),Yx=typeof mj.oninput=="function"}qx=Yx}else qx=!1;hj=qx&&(!document.documentMode||9<document.documentMode)}function pj(){ed&&(ed.detachEvent("onpropertychange",gj),td=ed=null)}function gj(s){if(s.propertyName==="value"&&xh(td)){var o=[];dj(o,td,s,hl(s)),ml(Az,o)}}function Mz(s,o,l){s==="focusin"?(pj(),ed=o,td=l,ed.attachEvent("onpropertychange",gj)):s==="focusout"&&pj()}function Oz(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return xh(td)}function Dz(s,o){if(s==="click")return xh(o)}function zz(s,o){if(s==="input"||s==="change")return xh(o)}function Iz(s,o){return s===o&&(s!==0||1/s===1/o)||s!==s&&o!==o}var Rr=typeof Object.is=="function"?Object.is:Iz;function nd(s,o){if(Rr(s,o))return!0;if(typeof s!="object"||s===null||typeof o!="object"||o===null)return!1;var l=Object.keys(s),d=Object.keys(o);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var y=l[d];if(!Xe.call(o,y)||!Rr(s[y],o[y]))return!1}return!0}function Kx(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function xj(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function bj(s,o){var l=xj(s);s=0;for(var d;l;){if(l.nodeType===3){if(d=s+l.textContent.length,s<=o&&d>=o)return{node:l,offset:o-s};s=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=xj(l)}}function vj(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?vj(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function yj(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var o=Kx(s.document);o instanceof s.HTMLIFrameElement;){try{var l=typeof o.contentWindow.location.href=="string"}catch{l=!1}if(l)s=o.contentWindow;else break;o=Kx(s.document)}return o}function Xx(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o&&(o==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||o==="textarea"||s.contentEditable==="true")}var Pz=zs&&"documentMode"in document&&11>=document.documentMode,Cc=null,Wx=null,sd=null,Qx=!1;function wj(s,o,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Qx||Cc==null||Cc!==Kx(d)||(d=Cc,"selectionStart"in d&&Xx(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}),sd&&nd(sd,d)||(sd=d,d=xm(Wx,"onSelect"),0<d.length&&(o=new ph("onSelect","select",null,o,l),s.push({event:o,listeners:d}),o.target=Cc)))}function gl(s,o){var l={};return l[s.toLowerCase()]=o.toLowerCase(),l["Webkit"+s]="webkit"+o,l["Moz"+s]="moz"+o,l}var kc={animationend:gl("Animation","AnimationEnd"),animationiteration:gl("Animation","AnimationIteration"),animationstart:gl("Animation","AnimationStart"),transitionrun:gl("Transition","TransitionRun"),transitionstart:gl("Transition","TransitionStart"),transitioncancel:gl("Transition","TransitionCancel"),transitionend:gl("Transition","TransitionEnd")},Zx={},jj={};zs&&(jj=document.createElement("div").style,"AnimationEvent"in window||(delete kc.animationend.animation,delete kc.animationiteration.animation,delete kc.animationstart.animation),"TransitionEvent"in window||delete kc.transitionend.transition);function xl(s){if(Zx[s])return Zx[s];if(!kc[s])return s;var o=kc[s],l;for(l in o)if(o.hasOwnProperty(l)&&l in jj)return Zx[s]=o[l];return s}var Sj=xl("animationend"),Nj=xl("animationiteration"),Cj=xl("animationstart"),_z=xl("transitionrun"),Lz=xl("transitionstart"),$z=xl("transitioncancel"),kj=xl("transitionend"),Tj=new Map,Jx="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(" ");Jx.push("scrollEnd");function No(s,o){Tj.set(s,o),Bt(o,[s])}var Bz=0;function Na(s,o){if(s.name!=null&&s.name!=="auto")return s.name;if(o.autoName!==null)return o.autoName;s=Eo.identifierPrefix;var l=Bz++;return s="_"+s+"t_"+l.toString(32)+"_",o.autoName=s}function Ej(s){if(s==null||typeof s=="string")return s;var o=null,l=qc;if(l!==null)for(var d=0;d<l.length;d++){var y=s[l[d]];if(y!=null){if(y==="none")return"none";o=o==null?y:o+(" "+y)}}return o??s.default}function Ca(s,o){return s=Ej(s),o=Ej(o),o==null?s==="auto"?null:s:o==="auto"?null:o}var bh=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Jr=[],Tc=0,eb=0;function vh(){for(var s=Tc,o=eb=Tc=0;o<s;){var l=Jr[o];Jr[o++]=null;var d=Jr[o];Jr[o++]=null;var y=Jr[o];Jr[o++]=null;var j=Jr[o];if(Jr[o++]=null,d!==null&&y!==null){var I=d.pending;I===null?y.next=y:(y.next=I.next,I.next=y),d.pending=y}j!==0&&Rj(l,y,j)}}function yh(s,o,l,d){Jr[Tc++]=s,Jr[Tc++]=o,Jr[Tc++]=l,Jr[Tc++]=d,eb|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function tb(s,o,l,d){return yh(s,o,l,d),wh(s)}function bl(s,o){return yh(s,null,null,o),wh(s)}function Rj(s,o,l){s.lanes|=l;var d=s.alternate;d!==null&&(d.lanes|=l);for(var y=!1,j=s.return;j!==null;)j.childLanes|=l,d=j.alternate,d!==null&&(d.childLanes|=l),j.tag===22&&(s=j.stateNode,s===null||s._visibility&1||(y=!0)),s=j,j=j.return;return s.tag===3?(j=s.stateNode,y&&o!==null&&(y=31-it(l),s=j.hiddenUpdates,d=s[y],d===null?s[y]=[o]:d.push(o),o.lane=l|536870912),j):null}function wh(s){if(50<Cd)throw Cd=0,um=null,Error(a(185));for(var o=s.return;o!==null;)s=o,o=s.return;return s.tag===3?s.stateNode:null}var Ec={};function Vz(s,o,l,d){this.tag=s,this.key=l,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 dr(s,o,l,d){return new Vz(s,o,l,d)}function nb(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ka(s,o){var l=s.alternate;return l===null?(l=dr(s.tag,o,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=o,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&1206910976,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,o=s.dependencies,l.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function Aj(s,o){s.flags&=1206910978;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=o,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,o=l.dependencies,s.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),s}function jh(s,o,l,d,y,j){var I=0;if(d=s,typeof d=="function")nb(d)&&(I=1);else if(typeof d=="string")I=pP(s,l,je.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(d){case L:return s=dr(31,l,o,y),s.elementType=L,s.lanes=j,s;case H:return vl(l.children,y,j,o);case G:I=8,y|=24;break;case B:return s=dr(12,l,o,y|2),s.elementType=B,s.lanes=j,s;case W:return s=dr(13,l,o,y),s.elementType=W,s.lanes=j,s;case K:return s=dr(19,l,o,y),s.elementType=K,s.lanes=j,s;case X:case $:return s=y|32,s=dr(30,l,o,s),s.elementType=$,s.lanes=j,s.stateNode={autoName:null,paired:null,clones:null,ref:null},s;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case V:I=10;break e;case P:I=9;break e;case q:I=11;break e;case J:I=14;break e;case z:I=16,d=null;break e}I=29,l=Error(a(130,s===null?"null":typeof s,"")),d=null}return o=dr(I,l,o,y),o.elementType=s,o.type=d,o.lanes=j,o}function vl(s,o,l,d){return s=dr(7,s,d,o),s.lanes=l,s}function sb(s,o,l){return s=dr(6,s,null,o),s.lanes=l,s}function Mj(s){var o=dr(18,null,null,0);return o.stateNode=s,o}function rb(s,o,l){return o=dr(4,s.children!==null?s.children:[],s.key,o),o.lanes=l,o.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},o}var Oj=new WeakMap;function eo(s,o){if(typeof s=="object"&&s!==null){var l=Oj.get(s);return l!==void 0?l:(o={value:s,source:o,stack:_e(o)},Oj.set(s,o),o)}return{value:s,source:o,stack:_e(o)}}var Rc=[],Ac=0,Sh=null,rd=0,to=[],no=0,di=null,Vo=1,Uo="";function Ta(s,o){Rc[Ac++]=rd,Rc[Ac++]=Sh,Sh=s,rd=o}function Dj(s,o,l){to[no++]=Vo,to[no++]=Uo,to[no++]=di,di=s;var d=Vo;s=Uo;var y=32-it(d)-1;d&=~(1<<y),l+=1;var j=32-it(o)+y;if(30<j){var I=y-y%5;j=(d&(1<<I)-1).toString(32),d>>=I,y-=I,Vo=1<<32-it(o)+y|l<<y|d,Uo=j+s}else Vo=1<<j|l<<y|d,Uo=s}function Nh(s){s.return!==null&&(Ta(s,1),Dj(s,1,0))}function ob(s){for(;s===Sh;)Sh=Rc[--Ac],Rc[Ac]=null,rd=Rc[--Ac],Rc[Ac]=null;for(;s===di;)di=to[--no],to[no]=null,Uo=to[--no],to[no]=null,Vo=to[--no],to[no]=null}function zj(s,o){to[no++]=Vo,to[no++]=Uo,to[no++]=di,Vo=o.id,Uo=o.overflow,di=s}var Ns=null,Mn=null,Vt=!1,fi=null,so=!1,ab=Error(a(519));function hi(s){var o=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw od(eo(o,s)),ab}function Ij(s){var o=s.stateNode,l=s.type,d=s.memoizedProps;switch(o[Un]=s,o[Os]=d,l){case"dialog":Yt("cancel",o),Yt("close",o);break;case"iframe":case"object":case"embed":Yt("load",o);break;case"video":case"audio":for(l=0;l<Td.length;l++)Yt(Td[l],o);break;case"source":Yt("error",o);break;case"img":case"image":case"link":Yt("error",o),Yt("load",o);break;case"details":Yt("toggle",o);break;case"input":Yt("invalid",o),ii(o,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Yt("invalid",o);break;case"textarea":Yt("invalid",o),kr(o,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||o.textContent===""+l||d.suppressHydrationWarning===!0||nC(o.textContent,l)?(d.popover!=null&&(Yt("beforetoggle",o),Yt("toggle",o)),d.onScroll!=null&&Yt("scroll",o),d.onScrollEnd!=null&&Yt("scrollend",o),d.onClick!=null&&(o.onclick=er),o=!0):o=!1,o||hi(s,!0)}function Ch(s){for(Ns=s.return;Ns;)switch(Ns.tag){case 5:case 31:case 13:so=!1;return;case 27:case 3:so=!0;return;default:Ns=Ns.return}}function Mc(s){if(s!==Ns)return!1;if(!Vt)return Ch(s),Vt=!0,!1;var o=s.tag,l;if((l=o!==3&&o!==27)&&((l=o===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||P0(s.type,s.memoizedProps)),l=!l),l&&Mn&&hi(s),Ch(s),o===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));Mn=wC(s)}else if(o===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));Mn=wC(s)}else o===27?(o=Mn,Ri(s.type)?(s=G0,G0=null,Mn=s):Mn=o):Mn=Ns?oo(s.stateNode.nextSibling):null;return!0}function yl(){Mn=Ns=null,Vt=!1}function ib(){var s=fi;return s!==null&&(mr===null?mr=s:mr.push.apply(mr,s),fi=null),s}function od(s){fi===null?fi=[s]:fi.push(s)}var lb=oe(null),wl=null,Ea=null;function mi(s,o,l){xe(lb,o._currentValue),o._currentValue=l}function Ra(s){s._currentValue=lb.current,pe(lb)}function kh(s,o,l){for(;s!==null;){var d=s.alternate;if((s.childLanes&o)!==o?(s.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),s===l)break;s=s.return}}function cb(s,o,l,d){var y=s.child;for(y!==null&&(y.return=s);y!==null;){var j=y.dependencies;if(j!==null){var I=y.child;j=j.firstContext;e:for(;j!==null;){var Z=j;j=y;for(var me=0;me<o.length;me++)if(Z.context===o[me]){j.lanes|=l,Z=j.alternate,Z!==null&&(Z.lanes|=l),kh(j.return,l,s),d||(I=null);break e}j=Z.next}}else if(y.tag===18){if(I=y.return,I===null)throw Error(a(341));I.lanes|=l,j=I.alternate,j!==null&&(j.lanes|=l),kh(I,l,s),I=null}else y.tag===13&&y.memoizedState!==null&&y.memoizedState.dehydrated===null?(y.lanes|=l,I=y.alternate,I!==null&&(I.lanes|=l),kh(y.return,l,s),I=y.child,I=I!==null?I.sibling:null):I=y.child;if(I!==null)I.return=y;else for(I=y;I!==null;){if(I===s){I=null;break}if(y=I.sibling,y!==null){y.return=I.return,I=y;break}I=I.return}y=I}}function jl(s,o,l,d){s=null;for(var y=o,j=!1;y!==null;){if(!j){if((y.flags&524288)!==0)j=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var I=y.alternate;if(I===null)throw Error(a(387));if(I=I.memoizedProps,I!==null){var Z=y.type;Rr(y.pendingProps.value,I.value)||(s!==null?s.push(Z):s=[Z])}}else if(y===Te.current){if(I=y.alternate,I===null)throw Error(a(387));I.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(s!==null?s.push(nu):s=[nu])}y=y.return}return s!==null&&cb(o,s,l,d),o.flags|=262144,s!==null}function Th(s){for(s=s.firstContext;s!==null;){if(!Rr(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Sl(s){wl=s,Ea=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Is(s){return Pj(wl,s)}function Eh(s,o){return wl===null&&Sl(s),Pj(s,o)}function Pj(s,o){var l=o._currentValue;if(o={context:o,memoizedValue:l,next:null},Ea===null){if(s===null)throw Error(a(308));Ea=o,s.dependencies={lanes:0,firstContext:o},s.flags|=524288}else Ea=Ea.next=o;return l}var Uz=typeof AbortController<"u"?AbortController:function(){var s=[],o=this.signal={aborted:!1,addEventListener:function(l,d){s.push(d)}};this.abort=function(){o.aborted=!0,s.forEach(function(l){return l()})}},Hz=e.unstable_scheduleCallback,Fz=e.unstable_NormalPriority,os={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ub(){return{controller:new Uz,data:new Map,refCount:0}}function ad(s){s.refCount--,s.refCount===0&&Hz(Fz,function(){s.controller.abort()})}function _j(s,o){if((s.pendingLanes&4194048)!==0){var l=s.transitionTypes;for(l===null&&(l=s.transitionTypes=[]),s=0;s<o.length;s++){var d=o[s];l.indexOf(d)===-1&&l.push(d)}}}var id=null;function Gz(s){var o=s.transitionTypes;return s.transitionTypes=null,o}var ld=null,db=0,Nl=0,Oc=null;function qz(s,o){if(ld===null){var l=ld=[];db=0,Nl=T0(),Oc={status:"pending",value:void 0,then:function(d){l.push(d)}}}return db++,o.then(Lj,Lj),o}function Lj(){if(--db===0&&(id=null,ld!==null)){Oc!==null&&(Oc.status="fulfilled");var s=ld;ld=null,Nl=0,Oc=null;for(var o=0;o<s.length;o++)(0,s[o])()}}function Yz(s,o){var l=[],d={status:"pending",value:null,reason:null,then:function(y){l.push(y)}};return s.then(function(){d.status="fulfilled",d.value=o;for(var y=0;y<l.length;y++)(0,l[y])(o)},function(y){for(d.status="rejected",d.reason=y,y=0;y<l.length;y++)(0,l[y])(void 0)}),d}var $j=ae.S;ae.S=function(s,o){if(MN=ve(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&qz(s,o),id!==null)for(var l=Wc;l!==null;)_j(l,id),l=l.next;if(l=s.types,l!==null){for(var d=Wc;d!==null;)_j(d,l),d=d.next;if(Nl!==0){d=id,d===null&&(d=id=[]);for(var y=0;y<l.length;y++){var j=l[y];d.indexOf(j)===-1&&d.push(j)}}}$j!==null&&$j(s,o)};var Cl=oe(null);function fb(){var s=Cl.current;return s!==null?s:An.pooledCache}function Rh(s,o){o===null?xe(Cl,Cl.current):xe(Cl,o.pool)}function Bj(){var s=fb();return s===null?null:{parent:os._currentValue,pool:s}}var Dc=Error(a(460)),hb=Error(a(474)),Ah=Error(a(542)),Mh={then:function(){}};function Vj(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Uj(s,o,l){switch(l=s[l],l===void 0?s.push(o):l!==o&&(o.then(er,er),o=l),o.status){case"fulfilled":return o.value;case"rejected":throw s=o.reason,Fj(s),s===void 0&&!("reason"in o)?Error(a(600)):s;default:if(typeof o.status=="string")o.then(er,er);else{if(s=An,s!==null&&100<s.shellSuspendCounter)throw Error(a(482));s=o,s.status="pending",s.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 s=o.reason,Fj(s),s}throw Tl=o,Dc}}function kl(s){try{var o=s._init;return o(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Tl=l,Dc):l}}var Tl=null;function Hj(){if(Tl===null)throw Error(a(459));var s=Tl;return Tl=null,s}function Fj(s){if(s===Dc||s===Ah)throw Error(a(483))}var zc=null,cd=0;function Oh(s){var o=cd;return cd+=1,zc===null&&(zc=[]),Uj(zc,s,o)}function pi(s,o){o=o.props.ref,s.ref=o!==void 0?o:null}function Dh(s,o){throw o.$$typeof===O?Error(a(525)):(s=Object.prototype.toString.call(o),Error(a(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s)))}function Gj(s){function o(Ne,be){if(s){var Ee=Ne.deletions;Ee===null?(Ne.deletions=[be],Ne.flags|=16):Ee.push(be)}}function l(Ne,be){if(!s)return null;for(;be!==null;)o(Ne,be),be=be.sibling;return null}function d(Ne){for(var be=new Map;Ne!==null;)Ne.key===null?be.set(Ne.index,Ne):be.set(Ne.key,Ne),Ne=Ne.sibling;return be}function y(Ne,be){return Ne=ka(Ne,be),Ne.index=0,Ne.sibling=null,Ne}function j(Ne,be,Ee){return Ne.index=Ee,s?(Ee=Ne.alternate,Ee!==null?(Ee=Ee.index,Ee<be?(Ne.flags|=2,be):Ee):(Ne.flags|=134217730,be)):(Ne.flags|=1048576,be)}function I(Ne){return s&&Ne.alternate===null&&(Ne.flags|=134217730),Ne}function Z(Ne,be,Ee,Le){return be===null||be.tag!==6?(be=sb(Ee,Ne.mode,Le),be.return=Ne,be):(be=y(be,Ee),be.return=Ne,be)}function me(Ne,be,Ee,Le){var ut=Ee.type;return ut===H?(Ne=ze(Ne,be,Ee.props.children,Le,Ee.key),pi(Ne,Ee),Ne):be!==null&&(be.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===z&&kl(ut)===be.type)?(be=y(be,Ee.props),pi(be,Ee),be.return=Ne,be):(be=jh(Ee.type,Ee.key,Ee.props,null,Ne.mode,Le),pi(be,Ee),be.return=Ne,be)}function Ce(Ne,be,Ee,Le){return be===null||be.tag!==4||be.stateNode.containerInfo!==Ee.containerInfo||be.stateNode.implementation!==Ee.implementation?(be=rb(Ee,Ne.mode,Le),be.return=Ne,be):(be=y(be,Ee.children||[]),be.return=Ne,be)}function ze(Ne,be,Ee,Le,ut){return be===null||be.tag!==7?(be=vl(Ee,Ne.mode,Le,ut),be.return=Ne,be):(be=y(be,Ee),be.return=Ne,be)}function $e(Ne,be,Ee){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return be=sb(""+be,Ne.mode,Ee),be.return=Ne,be;if(typeof be=="object"&&be!==null){switch(be.$$typeof){case D:return Ee=jh(be.type,be.key,be.props,null,Ne.mode,Ee),pi(Ee,be),Ee.return=Ne,Ee;case _:return be=rb(be,Ne.mode,Ee),be.return=Ne,be;case z:return be=kl(be),$e(Ne,be,Ee)}if(ye(be)||Y(be))return be=vl(be,Ne.mode,Ee,null),be.return=Ne,be;if(typeof be.then=="function")return $e(Ne,Oh(be),Ee);if(be.$$typeof===V)return $e(Ne,Eh(Ne,be),Ee);Dh(Ne,be)}return null}function we(Ne,be,Ee,Le){var ut=be!==null?be.key:null;if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return ut!==null?null:Z(Ne,be,""+Ee,Le);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case D:return Ee.key===ut?me(Ne,be,Ee,Le):null;case _:return Ee.key===ut?Ce(Ne,be,Ee,Le):null;case z:return Ee=kl(Ee),we(Ne,be,Ee,Le)}if(ye(Ee)||Y(Ee))return ut!==null?null:ze(Ne,be,Ee,Le,null);if(typeof Ee.then=="function")return we(Ne,be,Oh(Ee),Le);if(Ee.$$typeof===V)return we(Ne,be,Eh(Ne,Ee),Le);Dh(Ne,Ee)}return null}function Me(Ne,be,Ee,Le,ut){if(typeof Le=="string"&&Le!==""||typeof Le=="number"||typeof Le=="bigint")return Ne=Ne.get(Ee)||null,Z(be,Ne,""+Le,ut);if(typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case D:return Ne=Ne.get(Le.key===null?Ee:Le.key)||null,me(be,Ne,Le,ut);case _:return Ne=Ne.get(Le.key===null?Ee:Le.key)||null,Ce(be,Ne,Le,ut);case z:return Le=kl(Le),Me(Ne,be,Ee,Le,ut)}if(ye(Le)||Y(Le))return Ne=Ne.get(Ee)||null,ze(be,Ne,Le,ut,null);if(typeof Le.then=="function")return Me(Ne,be,Ee,Oh(Le),ut);if(Le.$$typeof===V)return Me(Ne,be,Ee,Eh(be,Le),ut);Dh(be,Le)}return null}function ot(Ne,be,Ee,Le){for(var ut=null,Xt=null,vt=be,Rt=be=0,ls=null;vt!==null&&Rt<Ee.length;Rt++){vt.index>Rt?(ls=vt,vt=null):ls=vt.sibling;var Jt=we(Ne,vt,Ee[Rt],Le);if(Jt===null){vt===null&&(vt=ls);break}s&&vt&&Jt.alternate===null&&o(Ne,vt),be=j(Jt,be,Rt),Xt===null?ut=Jt:Xt.sibling=Jt,Xt=Jt,vt=ls}if(Rt===Ee.length)return l(Ne,vt),Vt&&Ta(Ne,Rt),ut;if(vt===null){for(;Rt<Ee.length;Rt++)vt=$e(Ne,Ee[Rt],Le),vt!==null&&(be=j(vt,be,Rt),Xt===null?ut=vt:Xt.sibling=vt,Xt=vt);return Vt&&Ta(Ne,Rt),ut}for(vt=d(vt);Rt<Ee.length;Rt++)ls=Me(vt,Ne,Rt,Ee[Rt],Le),ls!==null&&(s&&(Jt=ls.alternate,Jt!==null&&vt.delete(Jt.key===null?Rt:Jt.key)),be=j(ls,be,Rt),Xt===null?ut=ls:Xt.sibling=ls,Xt=ls);return s&&vt.forEach(function(zi){return o(Ne,zi)}),Vt&&Ta(Ne,Rt),ut}function mt(Ne,be,Ee,Le){if(Ee==null)throw Error(a(151));for(var ut=null,Xt=null,vt=be,Rt=be=0,ls=null,Jt=Ee.next();vt!==null&&!Jt.done;Rt++,Jt=Ee.next()){vt.index>Rt?(ls=vt,vt=null):ls=vt.sibling;var zi=we(Ne,vt,Jt.value,Le);if(zi===null){vt===null&&(vt=ls);break}s&&vt&&zi.alternate===null&&o(Ne,vt),be=j(zi,be,Rt),Xt===null?ut=zi:Xt.sibling=zi,Xt=zi,vt=ls}if(Jt.done)return l(Ne,vt),Vt&&Ta(Ne,Rt),ut;if(vt===null){for(;!Jt.done;Rt++,Jt=Ee.next())Jt=$e(Ne,Jt.value,Le),Jt!==null&&(be=j(Jt,be,Rt),Xt===null?ut=Jt:Xt.sibling=Jt,Xt=Jt);return Vt&&Ta(Ne,Rt),ut}for(vt=d(vt);!Jt.done;Rt++,Jt=Ee.next())Jt=Me(vt,Ne,Rt,Jt.value,Le),Jt!==null&&(s&&(ls=Jt.alternate,ls!==null&&vt.delete(ls.key===null?Rt:ls.key)),be=j(Jt,be,Rt),Xt===null?ut=Jt:Xt.sibling=Jt,Xt=Jt);return s&&vt.forEach(function(TP){return o(Ne,TP)}),Vt&&Ta(Ne,Rt),ut}function Lt(Ne,be,Ee,Le){if(typeof Ee=="object"&&Ee!==null&&Ee.type===H&&Ee.key===null&&Ee.props.ref===void 0&&(Ee=Ee.props.children),typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case D:e:{for(var ut=Ee.key;be!==null;){if(be.key===ut){if(ut=Ee.type,ut===H){if(be.tag===7){l(Ne,be.sibling),Le=y(be,Ee.props.children),pi(Le,Ee),Le.return=Ne,Ne=Le;break e}}else if(be.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===z&&kl(ut)===be.type){l(Ne,be.sibling),Le=y(be,Ee.props),pi(Le,Ee),Le.return=Ne,Ne=Le;break e}l(Ne,be);break}else o(Ne,be);be=be.sibling}Ee.type===H?(Le=vl(Ee.props.children,Ne.mode,Le,Ee.key),pi(Le,Ee),Le.return=Ne,Ne=Le):(Le=jh(Ee.type,Ee.key,Ee.props,null,Ne.mode,Le),pi(Le,Ee),Le.return=Ne,Ne=Le)}return I(Ne);case _:e:{for(ut=Ee.key;be!==null;){if(be.key===ut)if(be.tag===4&&be.stateNode.containerInfo===Ee.containerInfo&&be.stateNode.implementation===Ee.implementation){l(Ne,be.sibling),Le=y(be,Ee.children||[]),Le.return=Ne,Ne=Le;break e}else{l(Ne,be);break}else o(Ne,be);be=be.sibling}Le=rb(Ee,Ne.mode,Le),Le.return=Ne,Ne=Le}return I(Ne);case z:return Ee=kl(Ee),Lt(Ne,be,Ee,Le)}if(ye(Ee))return ot(Ne,be,Ee,Le);if(Y(Ee)){if(ut=Y(Ee),typeof ut!="function")throw Error(a(150));return Ee=ut.call(Ee),mt(Ne,be,Ee,Le)}if(typeof Ee.then=="function")return Lt(Ne,be,Oh(Ee),Le);if(Ee.$$typeof===V)return Lt(Ne,be,Eh(Ne,Ee),Le);Dh(Ne,Ee)}return typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint"?(Ee=""+Ee,be!==null&&be.tag===6?(l(Ne,be.sibling),Le=y(be,Ee),Le.return=Ne,Ne=Le):(l(Ne,be),Le=sb(Ee,Ne.mode,Le),Le.return=Ne,Ne=Le),I(Ne)):l(Ne,be)}return function(Ne,be,Ee,Le){try{cd=0;var ut=Lt(Ne,be,Ee,Le);return zc=null,ut}catch(vt){if(vt===Dc||vt===Ah)throw vt;var Xt=dr(29,vt,null,Ne.mode);return Xt.lanes=Le,Xt.return=Ne,Xt}finally{}}}var El=Gj(!0),qj=Gj(!1),gi=!1;function mb(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pb(s,o){s=s.updateQueue,o.updateQueue===s&&(o.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function xi(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function bi(s,o,l){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(dn&2)!==0){var y=d.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),d.pending=o,o=wh(s),Rj(s,null,l),o}return yh(s,d,o,l),wh(s)}function ud(s,o,l){if(o=o.updateQueue,o!==null&&(o=o.shared,(l&4194048)!==0)){var d=o.lanes;d&=s.pendingLanes,l|=d,o.lanes=l,wo(s,l)}}function gb(s,o){var l=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var y=null,j=null;if(l=l.firstBaseUpdate,l!==null){do{var I={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};j===null?y=j=I:j=j.next=I,l=l.next}while(l!==null);j===null?y=j=o:j=j.next=o}else y=j=o;l={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:j,shared:d.shared,callbacks:d.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=o:s.next=o,l.lastBaseUpdate=o}var xb=!1;function dd(){if(xb){var s=Oc;if(s!==null)throw s}}function fd(s,o,l,d){xb=!1;var y=s.updateQueue;gi=!1;var j=y.firstBaseUpdate,I=y.lastBaseUpdate,Z=y.shared.pending;if(Z!==null){y.shared.pending=null;var me=Z,Ce=me.next;me.next=null,I===null?j=Ce:I.next=Ce,I=me;var ze=s.alternate;ze!==null&&(ze=ze.updateQueue,Z=ze.lastBaseUpdate,Z!==I&&(Z===null?ze.firstBaseUpdate=Ce:Z.next=Ce,ze.lastBaseUpdate=me))}if(j!==null){var $e=y.baseState;I=0,ze=Ce=me=null,Z=j;do{var we=Z.lane&-536870913,Me=we!==Z.lane;if(Me?(Kt&we)===we:(d&we)===we){we!==0&&we===Nl&&(xb=!0),ze!==null&&(ze=ze.next={lane:0,tag:Z.tag,payload:Z.payload,callback:null,next:null});e:{var ot=s,mt=Z;we=o;var Lt=l;switch(mt.tag){case 1:if(ot=mt.payload,typeof ot=="function"){$e=ot.call(Lt,$e,we);break e}$e=ot;break e;case 3:ot.flags=ot.flags&-65537|128;case 0:if(ot=mt.payload,we=typeof ot=="function"?ot.call(Lt,$e,we):ot,we==null)break e;$e=k({},$e,we);break e;case 2:gi=!0}}we=Z.callback,we!==null&&(s.flags|=64,Me&&(s.flags|=8192),Me=y.callbacks,Me===null?y.callbacks=[we]:Me.push(we))}else Me={lane:we,tag:Z.tag,payload:Z.payload,callback:Z.callback,next:null},ze===null?(Ce=ze=Me,me=$e):ze=ze.next=Me,I|=we;if(Z=Z.next,Z===null){if(Z=y.shared.pending,Z===null)break;Me=Z,Z=Me.next,Me.next=null,y.lastBaseUpdate=Me,y.shared.pending=null}}while(!0);ze===null&&(me=$e),y.baseState=me,y.firstBaseUpdate=Ce,y.lastBaseUpdate=ze,j===null&&(y.shared.lanes=0),Ci|=I,s.lanes=I,s.memoizedState=$e}}function Yj(s,o){if(typeof s!="function")throw Error(a(191,s));s.call(o)}function Kj(s,o){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)Yj(l[s],o)}var vi=oe(null),zh=oe(0);function Xj(s,o){s=za,xe(zh,s),xe(vi,o),za=s|o.baseLanes}function bb(){xe(zh,za),xe(vi,vi.current)}function vb(){za=zh.current,pe(vi),pe(zh)}var Ps=oe(null),qs=null;function yi(s){var o=s.alternate;xe(_s,_s.current&1),xe(Ps,s),qs===null&&(o===null||vi.current!==null||o.memoizedState!==null)&&(qs=s)}function yb(s){xe(_s,_s.current),xe(Ps,s),qs===null&&(qs=s)}function Wj(s){s.tag===22?(xe(_s,_s.current),xe(Ps,s),qs===null&&(qs=s)):wi()}function wi(){xe(_s,_s.current),xe(Ps,Ps.current)}function Ar(s){pe(Ps),qs===s&&(qs=null),pe(_s)}var _s=oe(0);function hd(s,o){xe(Ps,Ps.current),xe(_s,o)}function wb(s){pe(_s),pe(Ps),qs===s&&(qs=null)}function Ih(s){for(var o=s;o!==null;){if(o.tag===13){var l=o.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||H0(l)||F0(l)))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===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Aa=0,_t=null,Cn=null,as=null,Ph=!1,Ic=!1,Rl=!1,_h=0,md=0,Pc=null,Kz=0;function Xn(){throw Error(a(321))}function jb(s,o){if(o===null)return!1;for(var l=0;l<o.length&&l<s.length;l++)if(!Rr(s[l],o[l]))return!1;return!0}function Sb(s,o,l,d,y,j){return Aa=j,_t=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,ae.H=s===null||s.memoizedState===null?DS:zS,Rl=!1,j=l(d,y),Rl=!1,Ic&&(j=Zj(o,l,d,y)),Qj(s),j}function Qj(s){ae.H=Fh;var o=Cn!==null&&Cn.next!==null;if(Aa=0,as=Cn=_t=null,Ph=!1,md=0,Pc=null,o)throw Error(a(300));s===null||is||(s=s.dependencies,s!==null&&Th(s)&&(is=!0))}function Zj(s,o,l,d){_t=s;var y=0;do{if(Ic&&(Pc=null),md=0,Ic=!1,25<=y)throw Error(a(301));if(y+=1,as=Cn=null,s.updateQueue!=null){var j=s.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}ae.H=nI,j=o(l,d)}while(Ic);return j}function Xz(){var s=ae.H,o=s.useState()[0];return o=typeof o.then=="function"?pd(o):o,s=s.useState()[0],(Cn!==null?Cn.memoizedState:null)!==s&&(_t.flags|=1024),o}function Nb(){var s=_h!==0;return _h=0,s}function Cb(s,o,l){o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~l}function kb(s){if(Ph){for(s=s.memoizedState;s!==null;){var o=s.queue;o!==null&&(o.pending=null),s=s.next}Ph=!1}Aa=0,as=Cn=_t=null,Ic=!1,md=_h=0,Pc=null}function nr(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return as===null?_t.memoizedState=as=s:as=as.next=s,as}function es(){if(Cn===null){var s=_t.alternate;s=s!==null?s.memoizedState:null}else s=Cn.next;var o=as===null?_t.memoizedState:as.next;if(o!==null)as=o,Cn=s;else{if(s===null)throw _t.alternate===null?Error(a(467)):Error(a(310));Cn=s,s={memoizedState:Cn.memoizedState,baseState:Cn.baseState,baseQueue:Cn.baseQueue,queue:Cn.queue,next:null},as===null?_t.memoizedState=as=s:as=as.next=s}return as}function Lh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pd(s){var o=md;return md+=1,Pc===null&&(Pc=[]),s=Uj(Pc,s,o),o=_t,(as===null?o.memoizedState:as.next)===null&&(o=o.alternate,ae.H=o===null||o.memoizedState===null?DS:zS),s}function $h(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return pd(s);if(s.$$typeof===U)return;if(s.$$typeof===V)return Is(s)}throw Error(a(438,String(s)))}function Tb(s){var o=null,l=_t.updateQueue;if(l!==null&&(o=l.memoCache),o==null){var d=_t.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}),l===null&&(l=Lh(),_t.updateQueue=l),l.memoCache=o,l=o.data[o.index],l===void 0)for(l=o.data[o.index]=Array(s),d=0;d<s;d++)l[d]=ee;return o.index++,l}function Ma(s,o){return typeof o=="function"?o(s):o}function Bh(s){var o=es();return Eb(o,Cn,s)}function Eb(s,o,l){var d=s.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=l;var y=s.baseQueue,j=d.pending;if(j!==null){if(y!==null){var I=y.next;y.next=j.next,j.next=I}o.baseQueue=y=j,d.pending=null}if(j=s.baseState,y===null)s.memoizedState=j;else{o=y.next;var Z=I=null,me=null,Ce=o,ze=!1;do{var $e=Ce.lane&-536870913;if($e!==Ce.lane?(Kt&$e)===$e:(Aa&$e)===$e){var we=Ce.revertLane;if(we===0)me!==null&&(me=me.next={lane:0,revertLane:0,gesture:null,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null}),$e===Nl&&(ze=!0);else if((Aa&we)===we){Ce=Ce.next,we===Nl&&(ze=!0);continue}else $e={lane:0,revertLane:Ce.revertLane,gesture:null,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null},me===null?(Z=me=$e,I=j):me=me.next=$e,_t.lanes|=we,Ci|=we;$e=Ce.action,Rl&&l(j,$e),j=Ce.hasEagerState?Ce.eagerState:l(j,$e)}else we={lane:$e,revertLane:Ce.revertLane,gesture:Ce.gesture,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null},me===null?(Z=me=we,I=j):me=me.next=we,_t.lanes|=$e,Ci|=$e;Ce=Ce.next}while(Ce!==null&&Ce!==o);if(me===null?I=j:me.next=Z,!Rr(j,s.memoizedState)&&(is=!0,ze&&(l=Oc,l!==null)))throw l;s.memoizedState=j,s.baseState=I,s.baseQueue=me,d.lastRenderedState=j}return y===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Rb(s){var o=es(),l=o.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=s;var d=l.dispatch,y=l.pending,j=o.memoizedState;if(y!==null){l.pending=null;var I=y=y.next;do j=s(j,I.action),I=I.next;while(I!==y);Rr(j,o.memoizedState)||(is=!0),o.memoizedState=j,o.baseQueue===null&&(o.baseState=j),l.lastRenderedState=j}return[j,d]}function Jj(s,o,l){var d=_t,y=es(),j=Vt;if(j){if(l===void 0)throw Error(a(407));l=l()}else l=o();var I=!Rr((Cn||y).memoizedState,l);if(I&&(y.memoizedState=l,is=!0),y=y.queue,Ob(nS.bind(null,d,y,s),[s]),s=y.getSnapshot!==o||I||as!==null&&(as.memoizedState.tag&1)!==0,_c(s?9:8,{destroy:void 0},tS.bind(null,d,y,l,o),null),s){if(d.flags|=2048,An===null)throw Error(a(349));j||(Aa&127)!==0||eS(d,o,l)}return l}function eS(s,o,l){s.flags|=16384,s={getSnapshot:o,value:l},o=_t.updateQueue,o===null?(o=Lh(),_t.updateQueue=o,o.stores=[s]):(l=o.stores,l===null?o.stores=[s]:l.push(s))}function tS(s,o,l,d){o.value=l,o.getSnapshot=d,sS(o)&&rS(s)}function nS(s,o,l){return l(function(){sS(o)&&rS(s)})}function sS(s){var o=s.getSnapshot;s=s.value;try{var l=o();return!Rr(s,l)}catch{return!0}}function rS(s){var o=bl(s,2);o!==null&&pr(o,s,2)}function Ab(s){var o=nr();if(typeof s=="function"){var l=s;if(s=l(),Rl){et(!0);try{l()}finally{et(!1)}}}return o.memoizedState=o.baseState=s,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:s},o}function oS(s,o,l,d){return s.baseState=l,Eb(s,Cn,typeof d=="function"?d:Ma)}function Wz(s,o,l,d,y){if(Hh(s))throw Error(a(485));if(s=o.action,s!==null){var j={payload:y,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(I){j.listeners.push(I)}};ae.T!==null?l(!0):j.isTransition=!1,d(j),l=o.pending,l===null?(j.next=o.pending=j,aS(o,j)):(j.next=l.next,o.pending=l.next=j)}}function aS(s,o){var l=o.action,d=o.payload,y=s.state;if(o.isTransition){var j=ae.T,I={};I.types=j!==null?j.types:null,ae.T=I;try{var Z=l(y,d),me=ae.S;me!==null&&me(I,Z),iS(s,o,Z)}catch(Ce){Mb(s,o,Ce)}finally{j!==null&&I.types!==null&&(j.types=I.types),ae.T=j}}else try{j=l(y,d),iS(s,o,j)}catch(Ce){Mb(s,o,Ce)}}function iS(s,o,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){lS(s,o,d)},function(d){return Mb(s,o,d)}):lS(s,o,l)}function lS(s,o,l){o.status="fulfilled",o.value=l,cS(o),s.state=l,o=s.pending,o!==null&&(l=o.next,l===o?s.pending=null:(l=l.next,o.next=l,aS(s,l)))}function Mb(s,o,l){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do o.status="rejected",o.reason=l,cS(o),o=o.next;while(o!==d)}s.action=null}function cS(s){s=s.listeners;for(var o=0;o<s.length;o++)(0,s[o])()}function uS(s,o){return o}function dS(s,o){if(Vt){var l=An.formState;if(l!==null){e:{var d=_t;if(Vt){if(Mn){t:{for(var y=Mn,j=so;y.nodeType!==8;){if(!j){y=null;break t}if(y=oo(y.nextSibling),y===null){y=null;break t}}j=y.data,y=j==="F!"||j==="F"?y:null}if(y){Mn=oo(y.nextSibling),d=y.data==="F!";break e}}hi(d)}d=!1}d&&(o=l[0])}}return l=nr(),l.memoizedState=l.baseState=o,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:uS,lastRenderedState:o},l.queue=d,l=AS.bind(null,_t,d),d.dispatch=l,d=Ab(!1),j=_b.bind(null,_t,!1,d.queue),d=nr(),y={state:o,dispatch:null,action:s,pending:null},d.queue=y,l=Wz.bind(null,_t,y,j,l),y.dispatch=l,d.memoizedState=s,[o,l,!1]}function fS(s){var o=es();return hS(o,Cn,s)}function hS(s,o,l){if(o=Eb(s,o,uS)[0],s=Bh(Ma)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var d=pd(o)}catch(I){throw I===Dc?Ah:I}else d=o;o=es();var y=o.queue,j=y.dispatch;return l!==o.memoizedState&&(_t.flags|=2048,_c(9,{destroy:void 0},Qz.bind(null,y,l),null)),[d,j,s]}function Qz(s,o){s.action=o}function mS(s){var o=es(),l=Cn;if(l!==null)return hS(o,l,s);es(),o=o.memoizedState,l=es();var d=l.queue.dispatch;return l.memoizedState=s,[o,d,!1]}function _c(s,o,l,d){return s={tag:s,create:l,deps:d,inst:o,next:null},o=_t.updateQueue,o===null&&(o=Lh(),_t.updateQueue=o),l=o.lastEffect,l===null?o.lastEffect=s.next=s:(d=l.next,l.next=s,s.next=d,o.lastEffect=s),s}function pS(){return es().memoizedState}function Vh(s,o,l,d){var y=nr();_t.flags|=s,y.memoizedState=_c(1|o,{destroy:void 0},l,d===void 0?null:d)}function Uh(s,o,l,d){var y=es();d=d===void 0?null:d;var j=y.memoizedState.inst;Cn!==null&&d!==null&&jb(d,Cn.memoizedState.deps)?y.memoizedState=_c(o,j,l,d):(_t.flags|=s,y.memoizedState=_c(1|o,j,l,d))}function gS(s,o){Vh(8390656,8,s,o)}function Ob(s,o){Uh(2048,8,s,o)}function Zz(s){_t.flags|=4;var o=_t.updateQueue;if(o===null)o=Lh(),_t.updateQueue=o,o.events=[s];else{var l=o.events;l===null?o.events=[s]:l.push(s)}}function xS(s){var o=es().memoizedState;return Zz({ref:o,nextImpl:s}),function(){if((dn&2)!==0)throw Error(a(440));return o.impl.apply(void 0,arguments)}}function bS(s,o){return Uh(4,2,s,o)}function vS(s,o){return Uh(4,4,s,o)}function yS(s,o){if(typeof o=="function"){s=s();var l=o(s);return function(){typeof l=="function"?l():o(null)}}if(o!=null)return s=s(),o.current=s,function(){o.current=null}}function wS(s,o,l){l=l!=null?l.concat([s]):null,Uh(4,4,yS.bind(null,o,s),l)}function Db(){}function jS(s,o){var l=es();o=o===void 0?null:o;var d=l.memoizedState;return o!==null&&jb(o,d[1])?d[0]:(l.memoizedState=[s,o],s)}function SS(s,o){var l=es();o=o===void 0?null:o;var d=l.memoizedState;if(o!==null&&jb(o,d[1]))return d[0];if(d=s(),Rl){et(!0);try{s()}finally{et(!1)}}return l.memoizedState=[d,o],d}function zb(s,o,l){return l===void 0||(Aa&1073741824)!==0&&(Kt&261930)===0?s.memoizedState=o:(s.memoizedState=l,s=DN(),_t.lanes|=s,Ci|=s,l)}function NS(s,o,l,d){return Rr(l,o)?l:vi.current!==null?(s=zb(s,l,d),Rr(s,o)||(is=!0),s):(Aa&106)===0||(Aa&1073741824)!==0&&(Kt&261930)===0?(is=!0,s.memoizedState=l):(s=DN(),_t.lanes|=s,Ci|=s,o)}function CS(s,o,l,d,y){var j=ue.p;ue.p=j!==0&&8>j?j:8;var I=ae.T,Z={};Z.types=I!==null?I.types:null,ae.T=Z,_b(s,!1,o,l);try{var me=y(),Ce=ae.S;if(Ce!==null&&Ce(Z,me),me!==null&&typeof me=="object"&&typeof me.then=="function"){var ze=Yz(me,d);gd(s,o,ze,zr(s))}else gd(s,o,d,zr(s))}catch($e){gd(s,o,{then:function(){},status:"rejected",reason:$e},zr())}finally{ue.p=j,I!==null&&Z.types!==null&&(I.types=Z.types),ae.T=I}}function Jz(){}function Ib(s,o,l,d){if(s.tag!==5)throw Error(a(476));var y=kS(s).queue;CS(s,y,o,se,l===null?Jz:function(){return TS(s),l(d)})}function kS(s){var o=s.memoizedState;if(o!==null)return o;o={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:se},next:null};var l={};return o.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:l},next:null},s.memoizedState=o,s=s.alternate,s!==null&&(s.memoizedState=o),o}function TS(s){var o=kS(s);o.next===null&&(o=s.alternate.memoizedState),gd(s,o.next.queue,{},zr())}function Pb(){return Is(nu)}function ES(){return es().memoizedState}function RS(){return es().memoizedState}function eI(s){for(var o=s.return;o!==null;){switch(o.tag){case 24:case 3:var l=zr();s=xi(l);var d=bi(o,s,l);d!==null&&(pr(d,o,l),ud(d,o,l)),o={cache:ub()},s.payload=o;return}o=o.return}}function tI(s,o,l){var d=zr();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Hh(s)?MS(o,l):(l=tb(s,o,l,d),l!==null&&(pr(l,s,d),OS(l,o,d)))}function AS(s,o,l){var d=zr();gd(s,o,l,d)}function gd(s,o,l,d){var y={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Hh(s))MS(o,y);else{var j=s.alternate;if(s.lanes===0&&(j===null||j.lanes===0)&&(j=o.lastRenderedReducer,j!==null))try{var I=o.lastRenderedState,Z=j(I,l);if(y.hasEagerState=!0,y.eagerState=Z,Rr(Z,I))return yh(s,o,y,0),An===null&&vh(),!1}catch{}finally{}if(l=tb(s,o,y,d),l!==null)return pr(l,s,d),OS(l,o,d),!0}return!1}function _b(s,o,l,d){if(d={lane:2,revertLane:T0(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Hh(s)){if(o)throw Error(a(479))}else o=tb(s,l,d,2),o!==null&&pr(o,s,2)}function Hh(s){var o=s.alternate;return s===_t||o!==null&&o===_t}function MS(s,o){Ic=Ph=!0;var l=s.pending;l===null?o.next=o:(o.next=l.next,l.next=o),s.pending=o}function OS(s,o,l){if((l&4194048)!==0){var d=o.lanes;d&=s.pendingLanes,l|=d,o.lanes=l,wo(s,l)}}var Fh={readContext:Is,use:$h,useCallback:Xn,useContext:Xn,useEffect:Xn,useImperativeHandle:Xn,useLayoutEffect:Xn,useInsertionEffect:Xn,useMemo:Xn,useReducer:Xn,useRef:Xn,useState:Xn,useDebugValue:Xn,useDeferredValue:Xn,useTransition:Xn,useSyncExternalStore:Xn,useId:Xn,useHostTransitionStatus:Xn,useFormState:Xn,useActionState:Xn,useOptimistic:Xn,useMemoCache:Xn,useCacheRefresh:Xn,useEffectEvent:Xn},DS={readContext:Is,use:$h,useCallback:function(s,o){return nr().memoizedState=[s,o===void 0?null:o],s},useContext:Is,useEffect:gS,useImperativeHandle:function(s,o,l){l=l!=null?l.concat([s]):null,Vh(4194308,4,yS.bind(null,o,s),l)},useLayoutEffect:function(s,o){return Vh(4194308,4,s,o)},useInsertionEffect:function(s,o){Vh(4,2,s,o)},useMemo:function(s,o){var l=nr();o=o===void 0?null:o;var d=s();if(Rl){et(!0);try{s()}finally{et(!1)}}return l.memoizedState=[d,o],d},useReducer:function(s,o,l){var d=nr();if(l!==void 0){var y=l(o);if(Rl){et(!0);try{l(o)}finally{et(!1)}}}else y=o;return d.memoizedState=d.baseState=y,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:y},d.queue=s,s=s.dispatch=tI.bind(null,_t,s),[d.memoizedState,s]},useRef:function(s){var o=nr();return s={current:s},o.memoizedState=s},useState:function(s){s=Ab(s);var o=s.queue,l=AS.bind(null,_t,o);return o.dispatch=l,[s.memoizedState,l]},useDebugValue:Db,useDeferredValue:function(s,o){var l=nr();return zb(l,s,o)},useTransition:function(){var s=Ab(!1);return s=CS.bind(null,_t,s.queue,!0,!1),nr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,o,l){var d=_t,y=nr();if(Vt){if(l===void 0)throw Error(a(407));l=l()}else{if(l=o(),An===null)throw Error(a(349));(Kt&127)!==0||eS(d,o,l)}y.memoizedState=l;var j={value:l,getSnapshot:o};return y.queue=j,gS(nS.bind(null,d,j,s),[s]),d.flags|=2048,_c(9,{destroy:void 0},tS.bind(null,d,j,l,o),null),l},useId:function(){var s=nr(),o=An.identifierPrefix;if(Vt){var l=Uo,d=Vo;l=(d&~(1<<32-it(d)-1)).toString(32)+l,o="_"+o+"R_"+l,l=_h++,0<l&&(o+="H"+l.toString(32)),o+="_"}else l=Kz++,o="_"+o+"r_"+l.toString(32)+"_";return s.memoizedState=o},useHostTransitionStatus:Pb,useFormState:dS,useActionState:dS,useOptimistic:function(s){var o=nr();o.memoizedState=o.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=l,o=_b.bind(null,_t,!0,l),l.dispatch=o,[s,o]},useMemoCache:Tb,useCacheRefresh:function(){return nr().memoizedState=eI.bind(null,_t)},useEffectEvent:function(s){var o=nr(),l={impl:s};return o.memoizedState=l,function(){if((dn&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}},zS={readContext:Is,use:$h,useCallback:jS,useContext:Is,useEffect:Ob,useImperativeHandle:wS,useInsertionEffect:bS,useLayoutEffect:vS,useMemo:SS,useReducer:Bh,useRef:pS,useState:function(){return Bh(Ma)},useDebugValue:Db,useDeferredValue:function(s,o){var l=es();return NS(l,Cn.memoizedState,s,o)},useTransition:function(){var s=Bh(Ma)[0],o=es().memoizedState;return[typeof s=="boolean"?s:pd(s),o]},useSyncExternalStore:Jj,useId:ES,useHostTransitionStatus:Pb,useFormState:fS,useActionState:fS,useOptimistic:function(s,o){var l=es();return oS(l,Cn,s,o)},useMemoCache:Tb,useCacheRefresh:RS,useEffectEvent:xS},nI={readContext:Is,use:$h,useCallback:jS,useContext:Is,useEffect:Ob,useImperativeHandle:wS,useInsertionEffect:bS,useLayoutEffect:vS,useMemo:SS,useReducer:Rb,useRef:pS,useState:function(){return Rb(Ma)},useDebugValue:Db,useDeferredValue:function(s,o){var l=es();return Cn===null?zb(l,s,o):NS(l,Cn.memoizedState,s,o)},useTransition:function(){var s=Rb(Ma)[0],o=es().memoizedState;return[typeof s=="boolean"?s:pd(s),o]},useSyncExternalStore:Jj,useId:ES,useHostTransitionStatus:Pb,useFormState:mS,useActionState:mS,useOptimistic:function(s,o){var l=es();return Cn!==null?oS(l,Cn,s,o):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:Tb,useCacheRefresh:RS,useEffectEvent:xS};function Lb(s,o,l,d){o=s.memoizedState,l=l(d,o),l=l==null?o:k({},o,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var $b={enqueueSetState:function(s,o,l){s=s._reactInternals;var d=zr(),y=xi(d);y.payload=o,l!=null&&(y.callback=l),o=bi(s,y,d),o!==null&&(pr(o,s,d),ud(o,s,d))},enqueueReplaceState:function(s,o,l){s=s._reactInternals;var d=zr(),y=xi(d);y.tag=1,y.payload=o,l!=null&&(y.callback=l),o=bi(s,y,d),o!==null&&(pr(o,s,d),ud(o,s,d))},enqueueForceUpdate:function(s,o){s=s._reactInternals;var l=zr(),d=xi(l);d.tag=2,o!=null&&(d.callback=o),o=bi(s,d,l),o!==null&&(pr(o,s,l),ud(o,s,l))}};function IS(s,o,l,d,y,j,I){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,j,I):o.prototype&&o.prototype.isPureReactComponent?!nd(l,d)||!nd(y,j):!0}function PS(s,o,l,d){s=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(l,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(l,d),o.state!==s&&$b.enqueueReplaceState(o,o.state,null)}function Al(s,o){var l=o;if("ref"in o){l={};for(var d in o)d!=="ref"&&(l[d]=o[d])}if(s=s.defaultProps){l===o&&(l=k({},l));for(var y in s)l[y]===void 0&&(l[y]=s[y])}return l}function _S(s){bh(s)}function LS(s){console.error(s)}function $S(s){bh(s)}function Gh(s,o){try{var l=s.onUncaughtError;l(o.value,{componentStack:o.stack})}catch(d){setTimeout(function(){throw d})}}function BS(s,o,l){try{var d=s.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Bb(s,o,l){return l=xi(l),l.tag=3,l.payload={element:null},l.callback=function(){Gh(s,o)},l}function VS(s){return s=xi(s),s.tag=3,s}function US(s,o,l,d){var y=l.type.getDerivedStateFromError;if(typeof y=="function"){var j=d.value;s.payload=function(){return y(j)},s.callback=function(){BS(o,l,d)}}var I=l.stateNode;I!==null&&typeof I.componentDidCatch=="function"&&(s.callback=function(){BS(o,l,d),typeof y!="function"&&(ki===null?ki=new Set([this]):ki.add(this));var Z=d.stack;this.componentDidCatch(d.value,{componentStack:Z!==null?Z:""})})}function sI(s,o,l,d,y){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=l.alternate,o!==null&&jl(o,l,y,!0),l=Ps.current,l!==null){switch(l.tag){case 31:case 13:case 19:return qs===null?fm():l.alternate===null&&Wn===0&&(Wn=3),l.flags&=-257,l.flags|=65536,l.lanes=y,d===Mh?l.flags|=16384:(o=l.updateQueue,o===null?l.updateQueue=new Set([d]):o.add(d),N0(s,d,y)),!1;case 22:return l.flags|=65536,d===Mh?l.flags|=16384:(o=l.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=o):(l=o.retryQueue,l===null?o.retryQueue=new Set([d]):l.add(d)),N0(s,d,y)),!1}throw Error(a(435,l.tag))}return N0(s,d,y),fm(),!1}if(Vt)return o=Ps.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=y,d!==ab&&(s=Error(a(422),{cause:d}),od(eo(s,l)))):(d!==ab&&(o=Error(a(423),{cause:d}),od(eo(o,l))),s=s.current.alternate,s.flags|=65536,y&=-y,s.lanes|=y,d=eo(d,l),y=Bb(s.stateNode,d,y),gb(s,y),Wn!==4&&(Wn=2)),!1;var j=Error(a(520),{cause:d});if(j=eo(j,l),Nd===null?Nd=[j]:Nd.push(j),Wn!==4&&(Wn=2),o===null)return!0;d=eo(d,l),l=o;do{switch(l.tag){case 3:return l.flags|=65536,s=y&-y,l.lanes|=s,s=Bb(l.stateNode,d,s),gb(l,s),!1;case 1:if(o=l.type,j=l.stateNode,(l.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(ki===null||!ki.has(j))))return l.flags|=65536,y&=-y,l.lanes|=y,y=VS(y),US(y,s,l,d),gb(l,y),!1;break;case 22:if(l.memoizedState!==null)return l.flags|=65536,!1}l=l.return}while(l!==null);return!1}var Vb=Error(a(461)),is=!1;function hs(s,o,l,d){o.child=s===null?qj(o,null,l,d):El(o,s.child,l,d)}function HS(s,o,l,d,y){l=l.render;var j=o.ref;if("ref"in d){var I={};for(var Z in d)Z!=="ref"&&(I[Z]=d[Z])}else I=d;return Sl(o),d=Sb(s,o,l,I,j,y),Z=Nb(),s!==null&&!is?(Cb(s,o,y),Oa(s,o,y)):(Vt&&Z&&Nh(o),o.flags|=1,hs(s,o,d,y),o.child)}function FS(s,o,l,d,y){if(s===null){var j=l.type;return typeof j=="function"&&!nb(j)&&j.defaultProps===void 0&&l.compare===null?(o.tag=15,o.type=j,GS(s,o,j,d,y)):(s=jh(l.type,null,d,o,o.mode,y),s.ref=o.ref,s.return=o,o.child=s)}if(j=s.child,!Xb(s,y)){var I=j.memoizedProps;if(l=l.compare,l=l!==null?l:nd,l(I,d)&&s.ref===o.ref)return Oa(s,o,y)}return o.flags|=1,s=ka(j,d),s.ref=o.ref,s.return=o,o.child=s}function GS(s,o,l,d,y){if(s!==null){var j=s.memoizedProps;if(nd(j,d)&&s.ref===o.ref)if(is=!1,o.pendingProps=d=j,Xb(s,y))(s.flags&131072)!==0&&(is=!0);else return o.lanes=s.lanes,Oa(s,o,y)}return Ub(s,o,l,d,y)}function qS(s,o,l,d){var y=d.children,j=s!==null?s.memoizedState:null;if(s===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((o.flags&128)!==0){if(j=j!==null?j.baseLanes|l:l,s!==null){for(d=o.child=s.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~j}else d=0,o.child=null;return YS(s,o,j,l,d)}if((l&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},s!==null&&Rh(o,j!==null?j.cachePool:null),j!==null?Xj(o,j):bb(),Wj(o);else return d=o.lanes=536870912,YS(s,o,j!==null?j.baseLanes|l:l,l,d)}else j!==null?(Rh(o,j.cachePool),Xj(o,j),wi(),o.memoizedState=null):(s!==null&&Rh(o,null),bb(),wi());return hs(s,o,y,l),o.child}function xd(s,o){return s!==null&&s.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function YS(s,o,l,d,y){var j=fb();return j=j===null?null:{parent:os._currentValue,pool:j},o.memoizedState={baseLanes:l,cachePool:j},s!==null&&Rh(o,null),bb(),Wj(o),s!==null&&jl(s,o,d,!0),o.childLanes=y,null}function qh(s,o){return o=Yh({mode:o.mode,children:o.children},s.mode),o.ref=s.ref,s.child=o,o.return=s,o}function KS(s,o,l){return El(o,s.child,null,l),s=qh(o,o.pendingProps),s.flags|=2,Ar(o),o.memoizedState=null,s}function rI(s,o,l){var d=o.pendingProps,y=(o.flags&128)!==0;if(o.flags&=-129,s===null){if(Vt){if(d.mode==="hidden")return s=qh(o,d),o.lanes=536870912,s.memoizedState={baseLanes:0,cachePool:null},xd(null,s);if(yb(o),(s=Mn)?(s=yC(s,so),s=s!==null&&s.data==="&"?s:null,s!==null&&(o.memoizedState={dehydrated:s,treeContext:di!==null?{id:Vo,overflow:Uo}:null,retryLane:536870912,hydrationErrors:null},l=Mj(s),l.return=o,o.child=l,Ns=o,Mn=null)):s=null,s===null)throw hi(o);return o.lanes=536870912,null}return qh(o,d)}var j=s.memoizedState;if(j!==null){var I=j.dehydrated;if(yb(o),y)if(o.flags&256)o.flags&=-257,o=KS(s,o,l);else if(o.memoizedState!==null)o.child=s.child,o.flags|=128,o=null;else throw Error(a(558));else if(is||jl(s,o,l,!1),y=(l&s.childLanes)!==0,is||y){if(vi.current===null){if(d=An,d!==null&&(I=jo(d,l),I!==0&&I!==j.retryLane))throw j.retryLane=I,bl(s,I),pr(d,s,I),Vb;fm()}o=KS(s,o,l)}else s=j.treeContext,Mn=oo(I.nextSibling),Ns=o,Vt=!0,fi=null,so=!1,s!==null&&zj(o,s),o=qh(o,d),o.flags|=134221824;return o}return s=ka(s.child,{mode:d.mode,children:d.children}),s.ref=o.ref,o.child=s,s.return=o,s}function Lc(s,o){var l=o.ref;if(l===null)s!==null&&s.ref!==null&&(o.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(a(284));(s===null||s.ref!==l)&&(o.flags|=4194816)}}function Ub(s,o,l,d,y){return Sl(o),l=Sb(s,o,l,d,void 0,y),d=Nb(),s!==null&&!is?(Cb(s,o,y),Oa(s,o,y)):(Vt&&d&&Nh(o),o.flags|=1,hs(s,o,l,y),o.child)}function XS(s,o,l,d,y,j){return Sl(o),o.updateQueue=null,l=Zj(o,d,l,y),Qj(s),d=Nb(),s!==null&&!is?(Cb(s,o,j),Oa(s,o,j)):(Vt&&d&&Nh(o),o.flags|=1,hs(s,o,l,j),o.child)}function WS(s,o,l,d,y){if(Sl(o),o.stateNode===null){var j=Ec,I=l.contextType;typeof I=="object"&&I!==null&&(j=Is(I)),j=new l(d,j),o.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=$b,o.stateNode=j,j._reactInternals=o,j=o.stateNode,j.props=d,j.state=o.memoizedState,j.refs={},mb(o),I=l.contextType,j.context=typeof I=="object"&&I!==null?Is(I):Ec,j.state=o.memoizedState,I=l.getDerivedStateFromProps,typeof I=="function"&&(Lb(o,l,I,d),j.state=o.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(I=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),I!==j.state&&$b.enqueueReplaceState(j,j.state,null),fd(o,d,j,y),dd(),j.state=o.memoizedState),typeof j.componentDidMount=="function"&&(o.flags|=4194308),d=!0}else if(s===null){j=o.stateNode;var Z=o.memoizedProps,me=Al(l,Z);j.props=me;var Ce=j.context,ze=l.contextType;I=Ec,typeof ze=="object"&&ze!==null&&(I=Is(ze));var $e=l.getDerivedStateFromProps;ze=typeof $e=="function"||typeof j.getSnapshotBeforeUpdate=="function",Z=o.pendingProps!==Z,ze||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(Z||Ce!==I)&&PS(o,j,d,I),gi=!1;var we=o.memoizedState;j.state=we,fd(o,d,j,y),dd(),Ce=o.memoizedState,Z||we!==Ce||gi?(typeof $e=="function"&&(Lb(o,l,$e,d),Ce=o.memoizedState),(me=gi||IS(o,l,me,d,we,Ce,I))?(ze||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(o.flags|=4194308)):(typeof j.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=Ce),j.props=d,j.state=Ce,j.context=I,d=me):(typeof j.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{j=o.stateNode,pb(s,o),I=o.memoizedProps,ze=Al(l,I),j.props=ze,$e=o.pendingProps,we=j.context,Ce=l.contextType,me=Ec,typeof Ce=="object"&&Ce!==null&&(me=Is(Ce)),Z=l.getDerivedStateFromProps,(Ce=typeof Z=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(I!==$e||we!==me)&&PS(o,j,d,me),gi=!1,we=o.memoizedState,j.state=we,fd(o,d,j,y),dd();var Me=o.memoizedState;I!==$e||we!==Me||gi||s!==null&&s.dependencies!==null&&Th(s.dependencies)?(typeof Z=="function"&&(Lb(o,l,Z,d),Me=o.memoizedState),(ze=gi||IS(o,l,ze,d,we,Me,me)||s!==null&&s.dependencies!==null&&Th(s.dependencies))?(Ce||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(d,Me,me),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(d,Me,me)),typeof j.componentDidUpdate=="function"&&(o.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof j.componentDidUpdate!="function"||I===s.memoizedProps&&we===s.memoizedState||(o.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||I===s.memoizedProps&&we===s.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=Me),j.props=d,j.state=Me,j.context=me,d=ze):(typeof j.componentDidUpdate!="function"||I===s.memoizedProps&&we===s.memoizedState||(o.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||I===s.memoizedProps&&we===s.memoizedState||(o.flags|=1024),d=!1)}return j=d,Lc(s,o),d=(o.flags&128)!==0,j||d?(j=o.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:j.render(),o.flags|=1,s!==null&&d?(o.child=El(o,s.child,null,y),o.child=El(o,null,l,y)):hs(s,o,l,y),o.memoizedState=j.state,s=o.child):s=Oa(s,o,y),s}function QS(s,o,l,d){return yl(),o.flags|=256,hs(s,o,l,d),o.child}var Hb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fb(s){return{baseLanes:s,cachePool:Bj()}}function Gb(s,o,l){return s=s!==null?s.childLanes&~l:0,o&&(s|=Dr),s}function ZS(s,o,l){var d=o.pendingProps,y=!1,j=(o.flags&128)!==0,I;if((I=j)||(I=s!==null&&s.memoizedState===null?!1:(_s.current&2)!==0),I&&(y=!0,o.flags&=-129),I=(o.flags&32)!==0,o.flags&=-33,s===null){if(Vt){if(y?yi(o):wi(),(s=Mn)?(s=yC(s,so),s=s!==null&&s.data!=="&"?s:null,s!==null&&(o.memoizedState={dehydrated:s,treeContext:di!==null?{id:Vo,overflow:Uo}:null,retryLane:536870912,hydrationErrors:null},l=Mj(s),l.return=o,o.child=l,Ns=o,Mn=null)):s=null,s===null)throw hi(o);return F0(s)?o.lanes=32:o.lanes=536870912,null}return j=d.children,d=d.fallback,y?(wi(),y=o.mode,j=Yh({mode:"hidden",children:j},y),d=vl(d,y,l,null),j.return=o,d.return=o,j.sibling=d,o.child=j,d=o.child,d.memoizedState=Fb(l),d.childLanes=Gb(s,I,l),o.memoizedState=Hb,xd(null,d)):(yi(o),qb(o,j))}var Z=s.memoizedState;if(Z!==null){var me=Z.dehydrated;if(me!==null)return oI(s,o,j,I,d,me,Z,l)}return y?(wi(),y=d.fallback,j=o.mode,Z=s.child,me=Z.sibling,d=ka(Z,{mode:"hidden",children:d.children}),d.subtreeFlags=Z.subtreeFlags&1206910976,me!==null?y=ka(me,y):(y=vl(y,j,l,null),y.flags|=2),y.return=o,d.return=o,d.sibling=y,o.child=d,xd(null,d),d=o.child,y=s.child.memoizedState,y===null?y=Fb(l):(j=y.cachePool,j!==null?(Z=os._currentValue,j=j.parent!==Z?{parent:Z,pool:Z}:j):j=Bj(),y={baseLanes:y.baseLanes|l,cachePool:j}),d.memoizedState=y,d.childLanes=Gb(s,I,l),o.memoizedState=Hb,xd(s.child,d)):(yi(o),l=s.child,s=l.sibling,l=ka(l,{mode:"visible",children:d.children}),l.return=o,l.sibling=null,s!==null&&(I=o.deletions,I===null?(o.deletions=[s],o.flags|=16):I.push(s)),o.child=l,o.memoizedState=null,l)}function qb(s,o){return o=Yh({mode:"visible",children:o},s.mode),o.return=s,s.child=o}function Yh(s,o){return s=dr(22,s,null,o),s.lanes=0,s}function Kh(s,o,l){return El(o,s.child,null,l),s=qb(o,o.pendingProps.children),s.flags|=2,o.memoizedState=null,s}function oI(s,o,l,d,y,j,I,Z){if(l)return o.flags&256?(yi(o),o.flags&=-257,Kh(s,o,Z)):o.memoizedState!==null?(wi(),o.child=s.child,o.flags|=128,null):(wi(),j=y.fallback,I=o.mode,y=Yh({mode:"visible",children:y.children},I),j=vl(j,I,Z,null),j.flags|=2,y.return=o,j.return=o,y.sibling=j,o.child=y,El(o,s.child,null,Z),y=o.child,y.memoizedState=Fb(Z),y.childLanes=Gb(s,d,Z),o.memoizedState=Hb,xd(null,y));if(yi(o),F0(j)){if(d=j.nextSibling&&j.nextSibling.dataset,d)var me=d.dgst;return d=me,d!==""&&(y=Error(a(419)),y.stack="",y.digest=d,od({value:y,source:null,stack:null})),Kh(s,o,Z)}if(is||jl(s,o,Z,!1),d=(Z&s.childLanes)!==0,is||d){if(vi.current!==null)return Kh(s,o,Z);if(d=An,d!==null&&(y=jo(d,Z),y!==0&&y!==I.retryLane))throw I.retryLane=y,bl(s,y),pr(d,s,y),Vb;return H0(j)||fm(),Kh(s,o,Z)}return H0(j)?(o.flags|=192,o.child=s.child,null):(s=I.treeContext,Mn=oo(j.nextSibling),Ns=o,Vt=!0,fi=null,so=!1,s!==null&&zj(o,s),o=qb(o,y.children),o.flags|=134221824,o)}function JS(s,o,l){s.lanes|=o;var d=s.alternate;d!==null&&(d.lanes|=o),kh(s.return,o,l)}function eN(s){for(var o=null;s!==null;){var l=s.alternate;l!==null&&Ih(l)===null&&(o=s),s=s.sibling}return o}function Xh(s,o,l,d,y,j){var I=s.memoizedState;I===null?s.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:y,treeForkCount:j}:(I.isBackwards=o,I.rendering=null,I.renderingStartTime=0,I.last=d,I.tail=l,I.tailMode=y,I.treeForkCount=j)}function Yb(s){var o=s.child;for(s.child=null;o!==null;){var l=o.sibling;o.sibling=s.child,s.child=o,o=l}}function Kb(s,o,l){var d=o.pendingProps,y=d.revealOrder,j=d.tail;d=d.children;var I=_s.current;if(o.flags&128)return hd(o,I),null;var Z=(I&2)!==0;if(Z?(I=I&1|2,o.flags|=128):I&=1,hd(o,I),y==="backwards"&&s!==null?(Yb(s),hs(s,o,d,l),Yb(s)):hs(s,o,d,l),d=Vt?rd:0,!Z&&s!==null&&(s.flags&128)!==0)e:for(s=o.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&JS(s,l,o);else if(s.tag===19)JS(s,l,o);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break e;for(;s.sibling===null;){if(s.return===null||s.return===o)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(y){case"backwards":l=eN(o.child),l===null?(y=o.child,o.child=null):(y=l.sibling,l.sibling=null,Yb(o)),Xh(o,!0,y,null,j,d);break;case"unstable_legacy-backwards":for(l=null,y=o.child,o.child=null;y!==null;){if(s=y.alternate,s!==null&&Ih(s)===null){o.child=y;break}s=y.sibling,y.sibling=l,l=y,y=s}Xh(o,!0,l,null,j,d);break;case"together":Xh(o,!1,null,null,void 0,d);break;case"independent":o.memoizedState=null;break;default:l=eN(o.child),l===null?(y=o.child,o.child=null):(y=l.sibling,l.sibling=null),Xh(o,!1,y,l,j,d)}return o.child}function tN(s,o,l){var d=o.pendingProps;return mi(o,o.type,d.value),hs(s,o,d.children,l),o.child}function Oa(s,o,l){if(s!==null&&(o.dependencies=s.dependencies),Ci|=o.lanes,(l&o.childLanes)===0)if(s!==null){if(jl(s,o,l,!1),(l&o.childLanes)===0)return null}else return null;if(s!==null&&o.child!==s.child)throw Error(a(153));if(o.child!==null){for(s=o.child,l=ka(s,s.pendingProps),o.child=l,l.return=o;s.sibling!==null;)s=s.sibling,l=l.sibling=ka(s,s.pendingProps),l.return=o;l.sibling=null}return o.child}function Xb(s,o){return(s.lanes&o)!==0?!0:(s=s.dependencies,!!(s!==null&&Th(s)))}function aI(s,o,l){switch(o.tag){case 3:re(o,o.stateNode.containerInfo),mi(o,os,s.memoizedState.cache),yl();break;case 27:case 5:Re(o);break;case 4:re(o,o.stateNode.containerInfo);break;case 10:mi(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,yb(o),null;break;case 13:var d=o.memoizedState;if(d!==null){if(d.dehydrated!==null)return yi(o),o.flags|=128,null;d=jl(s,o,l,!1);var y=o.child.childLanes;return d||(l&y)!==0?ZS(s,o,l):(yi(o),s=Oa(s,o,l),s!==null?s.sibling:null)}yi(o);break;case 19:if(o.flags&128)return Kb(s,o,l);if(y=(s.flags&128)!==0,d=(l&o.childLanes)!==0,d||(jl(s,o,l,!1),d=(l&o.childLanes)!==0),y){if(d)return Kb(s,o,l);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),hd(o,_s.current),d)break;return null;case 22:return o.lanes=0,qS(s,o,l,o.pendingProps);case 24:mi(o,os,s.memoizedState.cache)}return Oa(s,o,l)}function nN(s,o,l){if(s!==null)if(s.memoizedProps!==o.pendingProps)is=!0;else{if(!Xb(s,l)&&(o.flags&128)===0)return is=!1,aI(s,o,l);is=(s.flags&131072)!==0}else is=!1,Vt&&(o.flags&1048576)!==0&&Dj(o,rd,o.index);switch(o.lanes=0,o.tag){case 16:e:{var d=o.pendingProps;if(s=kl(o.elementType),o.type=s,typeof s=="function")nb(s)?(d=Al(s,d),o.tag=1,o=WS(null,o,s,d,l)):(o.tag=0,o=Ub(null,o,s,d,l));else{if(s!=null){var y=s.$$typeof;if(y===q){o.tag=11,o=HS(null,o,s,d,l);break e}else if(y===J){o.tag=14,o=FS(null,o,s,d,l);break e}else if(y===V){o.tag=10,o.type=s,o=tN(null,o,l);break e}}throw o=te(s)||s,Error(a(306,o,""))}}return o;case 0:return Ub(s,o,o.type,o.pendingProps,l);case 1:return d=o.type,y=Al(d,o.pendingProps),WS(s,o,d,y,l);case 3:e:{if(re(o,o.stateNode.containerInfo),s===null)throw Error(a(387));d=o.pendingProps;var j=o.memoizedState;y=j.element,pb(s,o),fd(o,d,null,l);var I=o.memoizedState;if(d=I.cache,mi(o,os,d),d!==j.cache&&cb(o,[os],l,!0),dd(),d=I.element,j.isDehydrated)if(j={element:d,isDehydrated:!1,cache:I.cache},o.updateQueue.baseState=j,o.memoizedState=j,o.flags&256){o=QS(s,o,d,l);break e}else if(d!==y){y=eo(Error(a(424)),o),od(y),o=QS(s,o,d,l);break e}else{switch(s=o.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Mn=oo(s.firstChild),Ns=o,Vt=!0,fi=null,so=!0,l=qj(o,null,d,l),o.child=l;l;)l.flags=l.flags&-3|134221824,l=l.sibling}else{if(yl(),d===y){o=Oa(s,o,l);break e}hs(s,o,d,l)}o=o.child}return o;case 26:return Lc(s,o),s===null?(l=TC(o.type,null,o.pendingProps,null))?o.memoizedState=l:Vt||(o.stateNode=aC(o.type,o.pendingProps,ce.current,o)):o.memoizedState=TC(o.type,s.memoizedProps,o.pendingProps,s.memoizedState),null;case 27:return Re(o),s===null&&Vt&&(d=o.stateNode=SC(o.type,o.pendingProps,ce.current),Ns=o,so=!0,y=Mn,Ri(o.type)?(G0=y,Mn=oo(d.firstChild)):Mn=y),hs(s,o,o.pendingProps.children,l),Lc(s,o),s===null&&(o.flags|=4194304),o.child;case 5:return s===null&&Vt&&((y=d=Mn)&&(d=eP(d,o.type,o.pendingProps,so),d!==null?(o.stateNode=d,Ns=o,Mn=oo(d.firstChild),so=!1,y=!0):y=!1),y||hi(o)),Re(o),y=o.type,j=o.pendingProps,I=s!==null?s.memoizedProps:null,d=j.children,P0(y,j)?d=null:I!==null&&P0(y,I)&&(o.flags|=32),o.memoizedState!==null&&(y=Sb(s,o,Xz,null,null,l),nu._currentValue=y),Lc(s,o),hs(s,o,d,l),o.child;case 6:return s===null&&Vt&&((s=l=Mn)&&(l=tP(l,o.pendingProps,so),l!==null?(o.stateNode=l,Ns=o,Mn=null,s=!0):s=!1),s||hi(o)),null;case 13:return ZS(s,o,l);case 4:return re(o,o.stateNode.containerInfo),d=o.pendingProps,s===null?o.child=El(o,null,d,l):hs(s,o,d,l),o.child;case 11:return HS(s,o,o.type,o.pendingProps,l);case 7:return d=o.pendingProps,Lc(s,o),hs(s,o,d,l),o.child;case 8:return hs(s,o,o.pendingProps.children,l),o.child;case 12:return hs(s,o,o.pendingProps.children,l),o.child;case 10:return tN(s,o,l);case 9:return y=o.type._context,d=o.pendingProps.children,Sl(o),y=Is(y),d=d(y),o.flags|=1,hs(s,o,d,l),o.child;case 14:return FS(s,o,o.type,o.pendingProps,l);case 15:return GS(s,o,o.type,o.pendingProps,l);case 19:return Kb(s,o,l);case 31:return rI(s,o,l);case 22:return qS(s,o,l,o.pendingProps);case 24:return Sl(o),d=Is(os),s===null?(y=fb(),y===null&&(y=An,j=ub(),y.pooledCache=j,j.refCount++,j!==null&&(y.pooledCacheLanes|=l),y=j),o.memoizedState={parent:d,cache:y},mb(o),mi(o,os,y)):((s.lanes&l)!==0&&(pb(s,o),fd(o,null,null,l),dd()),y=s.memoizedState,j=o.memoizedState,y.parent!==d?(y={parent:d,cache:d},o.memoizedState=y,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=y),mi(o,os,d)):(d=j.cache,mi(o,os,d),d!==y.cache&&cb(o,[os],l,!0))),hs(s,o,o.pendingProps.children,l),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|=s===null?18882560:18874368:Vt&&Nh(o),s!==null&&s.memoizedProps.name!==d.name?o.flags|=4194816:Lc(s,o),hs(s,o,d.children,l),o.child;case 29:throw o.pendingProps}throw Error(a(156,o.tag))}function Da(s){s.flags|=4}function Wb(s,o,l,d,y){var j;if((j=(s.mode&32)!==0)&&(j=l===null?MC(o,d):MC(o,d)&&(d.src!==l.src||d.srcSet!==l.srcSet)),j){if(s.flags|=16777216,(y&335544128)===y)if(s.stateNode.complete)s.flags|=8192;else if(_N())s.flags|=8192;else throw Tl=Mh,hb}else s.flags&=-16777217}function sN(s,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!OC(o))if(_N())s.flags|=8192;else throw Tl=Mh,hb}function Wh(s,o){o!==null&&(s.flags|=4),s.flags&16384&&(o=s.tag!==22?xn():536870912,s.lanes|=o,Hc|=o)}function bd(s,o){if(!Vt)switch(s.tailMode){case"visible":break;case"collapsed":for(var l=s.tail,d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?o||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null;break;default:for(o=s.tail,l=null;o!==null;)o.alternate!==null&&(l=o),o=o.sibling;l===null?s.tail=null:l.sibling=null}}function On(s){var o=s.alternate!==null&&s.alternate.child===s.child,l=0,d=0;if(o)for(var y=s.child;y!==null;)l|=y.lanes|y.childLanes,d|=y.subtreeFlags&1206910976,d|=y.flags&1206910976,y.return=s,y=y.sibling;else for(y=s.child;y!==null;)l|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=s,y=y.sibling;return s.subtreeFlags|=d,s.childLanes=l,o}function iI(s,o,l){var d=o.pendingProps;switch(ob(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return On(o),null;case 1:return On(o),null;case 3:return l=o.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),Ra(os),fe(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(Mc(o)?Da(o):s===null||s.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,ib())),On(o),null;case 26:var y=o.type,j=o.memoizedState;return s===null?(Da(o),j!==null?(On(o),sN(o,j)):(On(o),Wb(o,y,null,d,l))):j?j!==s.memoizedState?(Da(o),On(o),sN(o,j)):(On(o),o.flags&=-16777217):(s=s.memoizedProps,s!==d&&Da(o),On(o),Wb(o,y,s,d,l)),null;case 27:if(Oe(o),l=ce.current,y=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==d&&Da(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return On(o),o.subtreeFlags&=-33554433,null}s=je.current,Mc(o)?Ij(o):(s=SC(y,d,l),o.stateNode=s,Da(o))}return On(o),o.subtreeFlags&=-33554433,null;case 5:if(Oe(o),y=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==d&&Da(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return On(o),o.subtreeFlags&=-33554433,null}if(j=je.current,Mc(o))Ij(o);else{var I=Rd(ce.current);switch(j){case 1:j=I.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:j=I.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":j=I.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":j=I.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":j=I.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof d.is=="string"?I.createElement("select",{is:d.is}):I.createElement("select"),d.multiple?j.multiple=!0:d.size&&(j.size=d.size);break;default:j=typeof d.is=="string"?I.createElement(y,{is:d.is}):I.createElement(y)}}j[Un]=o,j[Os]=d;e:for(I=o.child;I!==null;){if(I.tag===5||I.tag===6)j.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===o)break e;for(;I.sibling===null;){if(I.return===null||I.return===o)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}o.stateNode=j;e:switch($s(j,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&&Da(o)}}return On(o),o.subtreeFlags&=-33554433,Wb(o,o.type,s===null?null:s.memoizedProps,o.pendingProps,l),null;case 6:if(s&&o.stateNode!=null)s.memoizedProps!==d&&Da(o);else{if(typeof d!="string"&&o.stateNode===null)throw Error(a(166));if(s=ce.current,Mc(o)){if(s=o.stateNode,l=o.memoizedProps,d=null,y=Ns,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}s[Un]=o,s=!!(s.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||nC(s.nodeValue,l)),s||hi(o,!0)}else s=Rd(s).createTextNode(d),s[Un]=o,o.stateNode=s}return On(o),null;case 31:if(l=o.memoizedState,s===null||s.memoizedState!==null){if(d=Mc(o),l!==null){if(s===null){if(!d)throw Error(a(318));if(s=o.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(557));s[Un]=o}else yl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;On(o),s=!1}else l=ib(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return o.flags&256?(Ar(o),o):(Ar(o),null);if((o.flags&128)!==0)throw Error(a(558))}return On(o),null;case 13:if(d=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(y=Mc(o),d!==null&&d.dehydrated!==null){if(s===null){if(!y)throw Error(a(318));if(y=o.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[Un]=o}else yl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;On(o),y=!1}else y=ib(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=y),y=!0;if(!y)return o.flags&256?(Ar(o),o):(Ar(o),null)}return Ar(o),(o.flags&128)!==0?(o.lanes=l,o):(l=d!==null,s=s!==null&&s.memoizedState!==null,l&&(d=o.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),j=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(j=d.memoizedState.cachePool.pool),j!==y&&(d.flags|=2048)),l!==s&&l&&(o.child.flags|=8192),Wh(o,o.updateQueue),On(o),null);case 4:return fe(),s===null&&M0(o.stateNode.containerInfo),o.flags|=67108864,On(o),null;case 10:return Ra(o.type),On(o),null;case 19:if(wb(o),d=o.memoizedState,d===null)return On(o),null;if(y=(o.flags&128)!==0,j=d.rendering,j===null)if(y)bd(d,!1);else{if(Wn!==0||s!==null&&(s.flags&128)!==0)for(s=o.child;s!==null;){if(j=Ih(s),j!==null){for(o.flags|=128,bd(d,!1),s=j.updateQueue,o.updateQueue=s,Wh(o,s),o.subtreeFlags=0,s=l,l=o.child;l!==null;)Aj(l,s),l=l.sibling;return hd(o,_s.current&1|2),Vt&&Ta(o,d.treeForkCount),o.child}s=s.sibling}d.tail!==null&&ve()>lm&&(o.flags|=128,y=!0,bd(d,!1),o.lanes=4194304)}else{if(!y)if(s=Ih(j),s!==null){if(o.flags|=128,y=!0,s=s.updateQueue,o.updateQueue=s,Wh(o,s),bd(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!j.alternate&&!Vt)return On(o),null}else 2*ve()-d.renderingStartTime>lm&&l!==536870912&&(o.flags|=128,y=!0,bd(d,!1),o.lanes=4194304);d.isBackwards?(j.sibling=o.child,o.child=j):(s=d.last,s!==null?s.sibling=j:o.child=j,d.last=j)}if(d.tail!==null){s=d.tail;e:{for(l=s;l!==null;){if(l.alternate!==null){l=!1;break e}l=l.sibling}l=!0}return d.rendering=s,d.tail=s.sibling,d.renderingStartTime=ve(),s.sibling=null,j=_s.current,j=y?j&1|2:j&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!l||Vt?hd(o,j):(l=j,xe(Ps,o),xe(_s,l),qs===null&&(qs=o)),Vt&&Ta(o,d.treeForkCount),s}return On(o),null;case 22:case 23:return Ar(o),vb(),d=o.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(o.flags|=8192):d&&(o.flags|=8192),d?(l&536870912)!==0&&(o.flags&128)===0&&(On(o),o.subtreeFlags&6&&(o.flags|=8192)):On(o),l=o.updateQueue,l!==null&&Wh(o,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==l&&(o.flags|=2048),s!==null&&pe(Cl),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),o.memoizedState.cache!==l&&(o.flags|=2048),Ra(os),On(o),null;case 25:return null;case 30:return o.flags|=33554432,On(o),null}throw Error(a(156,o.tag))}function lI(s,o){switch(ob(o),o.tag){case 1:return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 3:return Ra(os),fe(),s=o.flags,(s&65536)!==0&&(s&128)===0?(o.flags=s&-65537|128,o):null;case 26:case 27:case 5:return Oe(o),null;case 31:if(o.memoizedState!==null){if(Ar(o),o.alternate===null)throw Error(a(340));yl()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 13:if(Ar(o),s=o.memoizedState,s!==null&&s.dehydrated!==null){if(o.alternate===null)throw Error(a(340));yl()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 19:return wb(o),s=o.flags,s&65536?(o.flags=s&-65537|128,s=o.memoizedState,s!==null&&(s.rendering=null,s.tail=null),o.flags|=4,o):null;case 4:return fe(),null;case 10:return Ra(o.type),null;case 22:case 23:return Ar(o),vb(),s!==null&&pe(Cl),s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 24:return Ra(os),null;case 25:return null;default:return null}}function rN(s,o){switch(ob(o),o.tag){case 3:Ra(os),fe();break;case 26:case 27:case 5:Oe(o);break;case 4:fe();break;case 31:o.memoizedState!==null&&Ar(o);break;case 13:Ar(o);break;case 19:wb(o);break;case 10:Ra(o.type);break;case 22:case 23:Ar(o),vb(),s!==null&&pe(Cl);break;case 24:Ra(os)}}function vd(s,o){try{var l=o.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var y=d.next;l=y;do{if((l.tag&s)===s){d=void 0;var j=l.create,I=l.inst;d=j(),I.destroy=d}l=l.next}while(l!==y)}}catch(Z){vn(o,o.return,Z)}}function ji(s,o,l){try{var d=o.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var j=y.next;d=j;do{if((d.tag&s)===s){var I=d.inst,Z=I.destroy;if(Z!==void 0){I.destroy=void 0,y=o;var me=l,Ce=Z;try{Ce()}catch(ze){vn(y,me,ze)}}}d=d.next}while(d!==j)}}catch(ze){vn(o,o.return,ze)}}function oN(s){var o=s.updateQueue;if(o!==null){var l=s.stateNode;try{Kj(o,l)}catch(d){vn(s,s.return,d)}}}function aN(s,o,l){l.props=Al(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(d){vn(s,o,d)}}function Ho(s,o){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:var y=s.stateNode,j=Na(s.memoizedProps,y);(y.ref===null||y.ref.name!==j)&&(y.ref=hC(j)),d=y.ref;break;case 7:if(s.stateNode===null){var I=new Ir(s);p(s.child,!1,ZI,I,void 0,void 0),s.stateNode=I}d=s.stateNode;break;default:d=s.stateNode}typeof l=="function"?s.refCleanup=l(d):l.current=d}}catch(Z){vn(s,o,Z)}}function Ls(s,o){var l=s.ref,d=s.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(y){vn(s,o,y)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(y){vn(s,o,y)}else l.current=null}function Qh(s,o){if((s.tag===5||s.tag===27||s.tag===6)&&s.alternate===null&&o!==null)for(var l=0;l<o.length;l++)vC(s.stateNode,o[l])}function iN(s){for(var o=s.return;o!==null&&(Zb(o)&&vC(s.stateNode,o.stateNode),!Qb(o));)o=o.return}function yd(s){for(var o=s.return;o!==null&&(Zb(o)&&JI(s.stateNode,o.stateNode),!Qb(o));)o=o.return}function Qb(s){return s.tag===5||s.tag===3||s.tag===27}function Zb(s){return s&&s.tag===7&&s.stateNode!==null}function Jb(s){var o=s.type,l=s.memoizedProps,d=s.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(y){vn(s,s.return,y)}}function e0(s,o,l){try{var d=s.stateNode;zI(d,s.type,l,o),d[Os]=o}catch(y){vn(s,s.return,y)}}function lN(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ri(s.type)||s.tag===4}function t0(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||lN(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ri(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function n0(s,o,l,d){var y=s.tag;if(y===5||y===6)y=s.stateNode,o?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(y,o):(o=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,o.appendChild(y),l=l._reactRootContainer,l!=null||o.onclick!==null||(o.onclick=er)),Qh(s,d),St=!0;else if(y!==4&&(y===27&&(Qh(s,d),d=null,Ri(s.type)&&(l=s.stateNode,o=null)),s=s.child,s!==null))for(n0(s,o,l,d),s=s.sibling;s!==null;)n0(s,o,l,d),s=s.sibling}function Zh(s,o,l,d){var y=s.tag;if(y===5||y===6)y=s.stateNode,o?l.insertBefore(y,o):l.appendChild(y),Qh(s,d),St=!0;else if(y!==4&&(y===27&&(Qh(s,d),d=null,Ri(s.type)&&(l=s.stateNode)),s=s.child,s!==null))for(Zh(s,o,l,d),s=s.sibling;s!==null;)Zh(s,o,l,d),s=s.sibling}function cN(s){var o=s.stateNode,l=s.memoizedProps;try{for(var d=s.type,y=o.attributes;y.length;)o.removeAttributeNode(y[0]);$s(o,d,l),o[Un]=s,o[Os]=l}catch(j){vn(s,s.return,j)}}var Jh=!1,Mr=null;function uN(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(Jh=!0)}var Fo=null;function dN(){var s=Fo;return Fo=null,s}var fr=0;function $c(s,o,l,d,y){return fr=0,fN(s.child,o,l,d,y)}function fN(s,o,l,d,y){for(var j=!1;s!==null;){if(s.tag===5){var I=s.stateNode;if(d!==null){var Z=$0(I);d.push(Z),Z.view&&(j=!0)}else j||$0(I).view&&(j=!0);Jh=!0,dC(I,fr===0?o:o+"_"+fr,l),fr++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&y||fN(s.child,o,l,d,y)&&(j=!0));s=s.sibling}return j}function Go(s,o){for(;s!==null;)s.tag===5?fC(s.stateNode,s.memoizedProps):(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&o||Go(s.child,o)),s=s.sibling}function em(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if((s.tag!==22||s.memoizedState===null)&&(em(s),s.tag===30&&(s.flags&18874368)!==0&&s.stateNode.paired)){var o=s.memoizedProps;if(o.name==null||o.name==="auto")throw Error(a(544));var l=o.name;o=Ca(o.default,o.share),o!=="none"&&($c(s,l,o,null,!1)||Go(s.child,!1))}s=s.sibling}}function s0(s,o){if(s.tag===30){var l=s.stateNode,d=s.memoizedProps,y=Na(d,l),j=Ca(d.default,l.paired?d.share:d.enter);j!=="none"?$c(s,y,j,null,!1)?(em(s),l.paired||o||Yc(s,d.onEnter)):Go(s.child,!1):em(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)s0(s,o),s=s.sibling;else em(s)}function r0(s){if(Mr!==null&&Mr.size!==0){var o=Mr;if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var l=s.memoizedProps,d=l.name;if(d!=null&&d!=="auto"){var y=o.get(d);if(y!==void 0){var j=Ca(l.default,l.share);if(j!=="none"&&($c(s,d,j,null,!1)?(j=s.stateNode,y.paired=j,j.paired=y,Yc(s,l.onShare)):Go(s.child,!1)),o.delete(d),o.size===0)break}}}r0(s)}s=s.sibling}}}function o0(s){if(s.tag===30){var o=s.memoizedProps,l=Na(o,s.stateNode),d=Mr!==null?Mr.get(l):void 0,y=Ca(o.default,d!==void 0?o.share:o.exit);y!=="none"&&($c(s,l,y,null,!1)?d!==void 0?(y=s.stateNode,d.paired=y,y.paired=d,Mr.delete(l),Yc(s,o.onShare)):Yc(s,o.onExit):Go(s.child,!1)),Mr!==null&&r0(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)o0(s),s=s.sibling;else Mr!==null&&r0(s)}function hN(s){for(s=s.child;s!==null;){if(s.tag===30){var o=s.memoizedProps,l=Na(o,s.stateNode);o=Ca(o.default,o.update),s.flags&=-5,o!=="none"&&$c(s,l,o,s.memoizedState=[],!1)}else(s.subtreeFlags&33554432)!==0&&hN(s);s=s.sibling}}function a0(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var o=s.stateNode;o.paired!==null&&(o.paired=null,Go(s.child,!1))}a0(s)}s=s.sibling}}function tm(s){if(s.tag===30)s.stateNode.paired=null,Go(s.child,!1),a0(s);else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)tm(s),s=s.sibling;else a0(s)}function mN(s){for(s=s.child;s!==null;)s.tag===30?Go(s.child,!1):(s.subtreeFlags&33554432)!==0&&mN(s),s=s.sibling}function i0(s,o,l,d,y,j,I){for(var Z=!1;o!==null;){if(o.tag===5){var me=o.stateNode;if(j!==null&&fr<j.length){var Ce=j[fr],ze=$0(me);(Ce.view||ze.view)&&(Z=!0);var $e;if($e=(s.flags&4)===0)if(ze.clip)$e=!0;else{$e=Ce.rect;var we=ze.rect;$e=$e.y!==we.y||$e.x!==we.x||$e.height!==we.height||$e.width!==we.width}$e&&(s.flags|=4),ze.abs?ze=!Ce.abs:(Ce=Ce.rect,ze=ze.rect,ze=Ce.height!==ze.height||Ce.width!==ze.width),ze&&(s.flags|=32)}else s.flags|=32;(s.flags&4)!==0&&dC(me,fr===0?l:l+"_"+fr,y),Z&&(s.flags&4)!==0||(Fo===null&&(Fo=[]),Fo.push(me,fr===0?d:d+"_"+fr,o.memoizedProps)),fr++}else(o.tag!==22||o.memoizedState===null)&&(o.tag===30&&I?s.flags|=o.flags&32:i0(s,o.child,l,d,y,j,I)&&(Z=!0));o=o.sibling}return Z}function pN(s,o){for(s=s.child;s!==null;){if(s.tag===30){var l=s.memoizedProps,d=s.stateNode,y=Na(l,d),j=Ca(l.default,l.update),I;I=s.memoizedState,s.memoizedState=null,d=s;var Z=s.child;fr=0,y=i0(d,Z,y,y,j,I,!1),(s.flags&4)!==0&&y&&Yc(s,l.onUpdate)}else(s.subtreeFlags&33554432)!==0&&pN(s);s=s.sibling}}var Cs=!1,mn=!1,qo=!1,l0=!1,gN=typeof WeakSet=="function"?WeakSet:Set,ks=null,Yo=!1,wd=!1,nm=!1,c0=!1;function cI(s,o,l){if(s=s.containerInfo,z0=su,s=yj(s),Xx(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var y=d.getSelection&&d.getSelection();if(y&&y.rangeCount!==0){d=y.anchorNode;var j=y.anchorOffset,I=y.focusNode;y=y.focusOffset;try{d.nodeType,I.nodeType}catch{d=null;break e}var Z=0,me=-1,Ce=-1,ze=0,$e=0,we=s,Me=null;t:for(;;){for(var ot;we!==d||j!==0&&we.nodeType!==3||(me=Z+j),we!==I||y!==0&&we.nodeType!==3||(Ce=Z+y),we.nodeType===3&&(Z+=we.nodeValue.length),(ot=we.firstChild)!==null;)Me=we,we=ot;for(;;){if(we===s)break t;if(Me===d&&++ze===j&&(me=Z),Me===I&&++$e===y&&(Ce=Z),(ot=we.nextSibling)!==null)break;we=Me,Me=we.parentNode}we=ot}d=me===-1||Ce===-1?null:{start:me,end:Ce}}else d=null}d=d||{start:0,end:0}}else d=null;for(I0={focusedElem:s,selectionRange:d},su=!1,l=(l&335544064)===l,ks=o,o=l?9270:1024;ks!==null;){if(s=ks,l&&(d=s.deletions,d!==null))for(j=0;j<d.length;j++)l&&o0(d[j]);if(s.alternate===null&&(s.flags&2)!==0)l&&uN(s),sm(l);else{if(s.tag===22){if(d=s.alternate,s.memoizedState!==null){d!==null&&d.memoizedState===null&&l&&o0(d),sm(l);continue}else if(d!==null&&d.memoizedState!==null){l&&uN(s),sm(l);continue}}d=s.child,(s.subtreeFlags&o)!==0&&d!==null?(d.return=s,ks=d):(l&&hN(s),sm(l))}}Mr=null}function sm(s){for(;ks!==null;){var o=ks,l=s,d=o.alternate,y=o.flags;switch(o.tag){case 0:case 11:case 15:break;case 1:if((y&1024)!==0&&d!==null){l=void 0,y=d.memoizedProps,d=d.memoizedState;var j=o.stateNode;try{var I=Al(o.type,y);l=j.getSnapshotBeforeUpdate(I,d),j.__reactInternalSnapshotBeforeUpdate=l}catch(Z){vn(o,o.return,Z)}}break;case 3:if((y&1024)!==0){if(d=o.stateNode.containerInfo,l=d.nodeType,l===9)U0(d);else if(l===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":U0(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:l&&d!==null&&(l=Na(d.memoizedProps,d.stateNode),y=o.memoizedProps,y=Ca(y.default,y.update),y!=="none"&&$c(d,l,y,d.memoizedState=[],!0));break;default:if((y&1024)!==0)throw Error(a(163))}if(d=o.sibling,d!==null){d.return=o.return,ks=d;break}ks=o.return}}function xN(s,o,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:Ko(s,l),d&4&&vd(5,l);break;case 1:if(Ko(s,l),d&4)if(s=l.stateNode,o===null)try{s.componentDidMount()}catch(I){vn(l,l.return,I)}else{var y=Al(l.type,o.memoizedProps);o=o.memoizedState;try{s.componentDidUpdate(y,o,s.__reactInternalSnapshotBeforeUpdate)}catch(I){vn(l,l.return,I)}}d&64&&oN(l),d&512&&Ho(l,l.return);break;case 3:if(Ko(s,l),d&64&&(s=l.updateQueue,s!==null)){if(o=null,l.child!==null)switch(l.child.tag){case 27:case 5:o=l.child.stateNode;break;case 1:o=l.child.stateNode}try{Kj(s,o)}catch(I){vn(l,l.return,I)}}break;case 27:o===null&&d&4&&cN(l);case 26:case 5:Ko(s,l),o===null&&d&4&&Jb(l),d&512&&Ho(l,l.return);break;case 12:Ko(s,l);break;case 31:Ko(s,l),d&4&&wN(s,l);break;case 13:Ko(s,l),d&4&&jN(s,l),d&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=wI.bind(null,l),nP(s,l))));break;case 22:if(d=l.memoizedState!==null||Cs,!d){var j=o!==null&&o.memoizedState!==null||mn;o=Cs,y=mn,Cs=d,(mn=j)&&!y?(d=2,(l.subtreeFlags&8772)!==0&&(d|=1),To(s,l,d)):Ko(s,l),Cs=o,mn=y}break;case 30:Ko(s,l),d&512&&Ho(l,l.return);break;case 7:d&512&&Ho(l,l.return);default:Ko(s,l)}}function u0(s,o){for(s=s.child;s!==null;)bN(s,o),s=s.sibling}function bN(s,o){switch(s.tag){case 5:case 26:try{var l=s.stateNode;if(o){var d=l.style;typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"}else{var y=s.stateNode,j=s.memoizedProps.style,I=j!=null&&j.hasOwnProperty("display")?j.display:null;y.style.display=I==null||typeof I=="boolean"?"":(""+I).trim()}}catch(me){vn(s,s.return,me)}d0(s,o);break;case 6:try{s.stateNode.nodeValue=o?"":s.memoizedProps,St=!0}catch(me){vn(s,s.return,me)}break;case 18:try{var Z=s.stateNode;o?uC(Z,!0):uC(s.stateNode,!1)}catch(me){vn(s,s.return,me)}break;case 22:case 23:s.memoizedState===null&&u0(s,o);break;default:u0(s,o)}}function d0(s,o){if(s.subtreeFlags&67108864)for(s=s.child;s!==null;){e:{var l=s,d=o;switch(l.tag){case 4:bN(l,d);break e;case 22:l.memoizedState===null&&d0(l,d);break e;default:d0(l,d)}}s=s.sibling}}function vN(s){var o=s.alternate;o!==null&&(s.alternate=null,vN(o)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(o=s.stateNode,o!==null&&vc(o)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Vn=null,hr=!1;function Co(s,o,l){for(l=l.child;l!==null;)yN(s,o,l),l=l.sibling}function yN(s,o,l){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(Se,l)}catch{}switch(l.tag){case 26:mn||Ls(l,o),Co(s,o,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&!mn&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:mn||Ls(l,o),yd(l);var d=Vn,y=hr;Ri(l.type)&&(Vn=l.stateNode,hr=!1),Co(s,o,l),NC(l.stateNode,l.type,l.memoizedProps),Vn=d,hr=y;break;case 5:mn||Ls(l,o),yd(l);case 6:if(l.tag===6&&yd(l),d=Vn,y=hr,Vn=null,Co(s,o,l),Vn=d,hr=y,Vn!==null)if(hr)try{(Vn.nodeType===9?Vn.body:Vn.nodeName==="HTML"?Vn.ownerDocument.body:Vn).removeChild(l.stateNode),St=!0}catch(j){vn(l,o,j)}else try{Vn.removeChild(l.stateNode),St=!0}catch(j){vn(l,o,j)}break;case 18:Vn!==null&&(hr?(s=Vn,cC(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),ru(s)):cC(Vn,l.stateNode));break;case 4:d=Vn,y=hr,Vn=l.stateNode.containerInfo,hr=!0,Co(s,o,l),Vn=d,hr=y;break;case 0:case 11:case 14:case 15:ji(2,l,o),mn||ji(4,l,o),Co(s,o,l);break;case 1:mn||(Ls(l,o),d=l.stateNode,typeof d.componentWillUnmount=="function"&&aN(l,o,d)),Co(s,o,l);break;case 21:Co(s,o,l);break;case 22:mn=(d=mn)||l.memoizedState!==null,Co(s,o,l),mn=d;break;case 30:Ls(l,o),Co(s,o,l);break;case 7:mn||Ls(l,o),Co(s,o,l);break;default:Co(s,o,l)}}function wN(s,o){if(o.memoizedState===null&&(s=o.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{ru(s)}catch(l){vn(o,o.return,l)}}}function jN(s,o){if(o.memoizedState===null&&(s=o.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{ru(s)}catch(l){vn(o,o.return,l)}}function uI(s){switch(s.tag){case 31:case 13:case 19:var o=s.stateNode;return o===null&&(o=s.stateNode=new gN),o;case 22:return s=s.stateNode,o=s._retryCache,o===null&&(o=s._retryCache=new gN),o;default:throw Error(a(435,s.tag))}}function rm(s,o){var l=uI(s);o.forEach(function(d){if(!l.has(d)){l.add(d);var y=jI.bind(null,s,d);d.then(y,y)}})}function sr(s,o,l){var d=o.deletions;if(d!==null)for(var y=0;y<d.length;y++){var j=d[y],I=s,Z=o,me=Z;e:for(;me!==null;){switch(me.tag){case 27:if(Ri(me.type)){Vn=me.stateNode,hr=!1;break e}break;case 5:Vn=me.stateNode,hr=!1;break e;case 3:case 4:Vn=me.stateNode.containerInfo,hr=!0;break e}me=me.return}if(Vn===null)throw Error(a(160));yN(I,Z,j),Vn=null,hr=!1,I=j.alternate,I!==null&&(I.return=null),j.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)SN(o,s,l),o=o.sibling}var ko=null;function SN(s,o,l){var d=s.alternate,y=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(y&4&&(d=s.updateQueue,d=d!==null?d.events:null,d!==null))for(var j=0;j<d.length;j++){var I=d[j];I.ref.impl=I.nextImpl}sr(o,s,l),rr(s),y&4&&(ji(3,s,s.return),vd(3,s),ji(5,s,s.return));break;case 1:sr(o,s,l),rr(s),y&512&&(mn||d===null||Ls(d,d.return)),y&64&&Cs&&(s=s.updateQueue,s!==null&&(o=s.callbacks,o!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?o:l.concat(o))));break;case 26:if(j=ko,sr(o,s,l),rr(s),y&512&&(mn||d===null||Ls(d,d.return)),y&4)if(y=d!==null?d.memoizedState:null,l=s.memoizedState,d===null)if(l===null)if(s.stateNode===null)if(Cs)s.stateNode=aC(s.type,s.memoizedProps,o.containerInfo,s);else{e:{o=s.type,l=s.memoizedProps,y=j.ownerDocument||j;t:switch(o){case"title":d=y.getElementsByTagName("title")[0],(!d||d[cl]||d[Un]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=y.createElement(o),y.head.insertBefore(d,y.querySelector("head > title"))),$s(d,o,l),d[Un]=s,qe(d),o=d;break e;case"link":if(j=AC("link","href",y).get(o+(l.href||""))){for(I=0;I<j.length;I++)if(d=j[I],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){j.splice(I,1);break t}}d=y.createElement(o),$s(d,o,l),y.head.appendChild(d);break;case"meta":if(j=AC("meta","content",y).get(o+(l.content||""))){for(I=0;I<j.length;I++)if(d=j[I],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){j.splice(I,1);break t}}d=y.createElement(o),$s(d,o,l),y.head.appendChild(d);break;default:throw Error(a(468,o))}d[Un]=s,qe(d),o=d}s.stateNode=o}else Cs||X0(j,s.type,s.stateNode);else s.stateNode=RC(j,l,s.memoizedProps);else y!==l?(y===null?(o=d.stateNode,o===null||mn||o.parentNode.removeChild(o)):y.count--,l===null?Cs||X0(j,s.type,s.stateNode):RC(j,l,s.memoizedProps)):l===null&&s.stateNode!==null&&e0(s,s.memoizedProps,d.memoizedProps);break;case 27:sr(o,s,l),rr(s),y&512&&(mn||d===null||Ls(d,d.return)),d!==null&&y&4&&e0(s,s.memoizedProps,d.memoizedProps);break;case 5:if(j=qo,qo=!1,sr(o,s,l),qo=j,rr(s),y&512&&(mn||d===null||Ls(d,d.return)),s.flags&32){o=s.stateNode;try{Js(o,""),St=!0}catch(ze){vn(s,s.return,ze)}}y&4&&s.stateNode!=null&&(o=s.memoizedProps,e0(s,o,d!==null?d.memoizedProps:o)),y&1024&&(l0=!0);break;case 6:if(sr(o,s,l),rr(s),y&4){if(s.stateNode===null)throw Error(a(162));o=s.memoizedProps,l=s.stateNode;try{l.nodeValue=o,St=!0}catch(ze){vn(s,s.return,ze)}}break;case 3:if(St=!1,vm=null,j=ko,ko=Ad(o.containerInfo),sr(o,s,l),ko=j,rr(s),y&4&&d!==null&&d.memoizedState.isDehydrated)try{ru(o.containerInfo)}catch(ze){vn(s,s.return,ze)}l0&&(l0=!1,NN(s)),St=!1;break;case 4:y=qo,qo=Cs,d=fs(),j=ko,ko=Ad(s.stateNode.containerInfo),sr(o,s,l),rr(s),ko=j,St&&wd&&(nm=!0),St=d,qo=y;break;case 12:sr(o,s,l),rr(s);break;case 31:sr(o,s,l),rr(s),y&4&&(o=s.updateQueue,o!==null&&(s.updateQueue=null,rm(s,o)));break;case 13:sr(o,s,l),rr(s),s.child.flags&8192&&s.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(im=ve()),y&4&&(o=s.updateQueue,o!==null&&(s.updateQueue=null,rm(s,o)));break;case 22:j=s.memoizedState!==null,I=d!==null&&d.memoizedState!==null;var Z=Cs,me=mn,Ce=qo;Cs=Z||j,qo=Ce||j,mn=me||I,sr(o,s,l),mn=me,qo=Ce,Cs=Z,rr(s),y&8192&&(o=s.stateNode,o._visibility=j?o._visibility&-2:o._visibility|1,!j||d===null||I||Cs||mn||(o=I||mn,l=Cs,d=mn,Cs=j||Cs,mn=o,Si(s,2),Cs=l,mn=d),!j&&qo||u0(s,j)),y&4&&(o=s.updateQueue,o!==null&&(l=o.retryQueue,l!==null&&(o.retryQueue=null,rm(s,l))));break;case 19:sr(o,s,l),rr(s),y&4&&(o=s.updateQueue,o!==null&&(s.updateQueue=null,rm(s,o)));break;case 30:y&512&&(mn||d===null||Ls(d,d.return)),y=fs(),j=wd,I=(l&335544064)===l,Z=s.memoizedProps,wd=I&&Ca(Z.default,Z.update)!=="none",sr(o,s,l),rr(s),I&&d!==null&&St&&(s.flags|=4),wd=j,St=y;break;case 21:break;case 7:y&512&&(mn||d===null||Ls(d,d.return)),d&&d.stateNode!==null&&(d.stateNode._fragmentFiber=s);default:sr(o,s,l),rr(s)}}function rr(s){var o=s.flags;if(o&2){try{for(var l,d=s.return;d!==null;){if(lN(d)){l=d;break}d=d.return}d=null;for(var y=s.return;y!==null;){if(Zb(y)){var j=y.stateNode;d===null?d=[j]:d.push(j)}if(Qb(y))break;y=y.return}var I=d;if(l==null)throw Error(a(160));switch(l.tag){case 27:var Z=l.stateNode,me=t0(s);Zh(s,me,Z,I);break;case 5:var Ce=l.stateNode;l.flags&32&&(Js(Ce,""),l.flags&=-33);var ze=t0(s);Zh(s,ze,Ce,I);break;case 3:case 4:var $e=l.stateNode.containerInfo,we=t0(s);n0(s,we,$e,I);break;default:throw Error(a(161))}}catch(Me){vn(s,s.return,Me)}s.flags&=-3}o&4096&&(s.flags&=-4097)}function NN(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var o=s;NN(o),o.tag===5&&o.flags&1024&&(o=o.stateNode,su=!0,o.reset(),su=!1),s=s.sibling}}function Bc(s,o){if(o.subtreeFlags&9270)for(o=o.child;o!==null;)CN(o,s),o=o.sibling;else pN(o)}function CN(s,o){var l=s.alternate;if(l===null)s0(s,!1);else switch(s.tag){case 3:if(c0=Yo=!1,dN(),Bc(o,s),!Yo&&!nm){if(s=Fo,s!==null)for(var d=0;d<s.length;d+=3){l=s[d];var y=s[d+1];fC(l,s[d+2]),l=l.ownerDocument.documentElement,l!==null&&l.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+y+")"})}s=o.containerInfo,s=s.nodeType===9?s.documentElement:s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName===""&&(s.style.viewTransitionName="none",s.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),s.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),c0=!0}Fo=null;break;case 5:Bc(o,s);break;case 4:d=Yo,Yo=!1,Bc(o,s),Yo&&(nm=!0),Yo=d;break;case 22:s.memoizedState===null&&(l.memoizedState!==null?s0(s,!1):Bc(o,s));break;case 30:d=Yo,y=dN(),Yo=!1,Bc(o,s),Yo&&(s.flags|=4);var j=s.memoizedProps,I=s.stateNode;o=Na(j,I),I=Na(l.memoizedProps,I);var Z=Ca(j.default,j.update);Z==="none"?o=!1:(j=l.memoizedState,l.memoizedState=null,l=s.child,fr=0,o=i0(s,l,o,I,Z,j,!0),fr!==(j===null?0:j.length)&&(s.flags|=32)),(s.flags&4)!==0&&o?(Yc(s,s.memoizedProps.onUpdate),Fo=y):y!==null&&(y.push.apply(y,Fo),Fo=y),Yo=(s.flags&32)!==0?!0:d;break;default:Bc(o,s)}}function Ko(s,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)xN(s,o.alternate,o),o=o.sibling}function Si(s,o){for(s=s.child;s!==null;){var l=s,d=o;switch(l.tag){case 0:case 11:case 14:case 15:ji(4,l,l.return),Si(l,d);break;case 1:Ls(l,l.return);var y=l.stateNode;typeof y.componentWillUnmount=="function"&&aN(l,l.return,y),Si(l,d);break;case 27:(d&2)!==0&&NC(l.stateNode,l.type,l.memoizedProps);case 5:Ls(l,l.return),l.tag!==5&&l.tag!==27||yd(l),Si(l,d);break;case 6:yd(l);break;case 26:Ls(l,l.return),y=l.stateNode,l.memoizedState!==null||y===null||mn||y.parentNode.removeChild(y),Si(l,d);break;case 22:l.memoizedState===null&&Si(l,d);break;case 30:Ls(l,l.return),Si(l,d);break;case 7:Ls(l,l.return);default:Si(l,d)}s=s.sibling}}function To(s,o,l){for(l=(o.subtreeFlags&8772)!==0?l:l&-2,o=o.child;o!==null;){var d=o.alternate,y=s,j=o,I=j.flags,Z=(l&1)!==0;switch(j.tag){case 0:case 11:case 15:To(y,j,l),vd(4,j);break;case 1:if(To(y,j,l),d=j,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ze){vn(d,d.return,ze)}if(d=j,y=d.updateQueue,y!==null){var me=d.stateNode;try{var Ce=y.shared.hiddenCallbacks;if(Ce!==null)for(y.shared.hiddenCallbacks=null,y=0;y<Ce.length;y++)Yj(Ce[y],me)}catch(ze){vn(d,d.return,ze)}}Z&&I&64&&oN(j),Ho(j,j.return);break;case 27:(l&2)!==0&&cN(j);case 5:j.tag!==5&&j.tag!==27||iN(j),To(y,j,l),Z&&d===null&&I&4&&Jb(j),Ho(j,j.return);break;case 6:iN(j);break;case 26:me=j.stateNode,j.memoizedState!==null||me===null||Cs||X0(Ad(me.ownerDocument),j.type,me),To(y,j,l),Z&&d===null&&I&4&&Jb(j),Ho(j,j.return);break;case 12:To(y,j,l);break;case 31:To(y,j,l),Z&&I&4&&wN(y,j);break;case 13:To(y,j,l),Z&&I&4&&jN(y,j);break;case 22:j.memoizedState===null&&To(y,j,l),Ho(j,j.return);break;case 30:To(y,j,l),Ho(j,j.return);break;case 7:Ho(j,j.return);default:To(y,j,l)}o=o.sibling}}function f0(s,o){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(s=o.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&ad(l))}function h0(s,o){s=null,o.alternate!==null&&(s=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==s&&(o.refCount++,s!=null&&ad(s))}function ro(s,o,l,d){var y=(l&335544064)===l;if(o.subtreeFlags&(y?10262:10256))for(o=o.child;o!==null;)kN(s,o,l,d),o=o.sibling;else y&&mN(o)}function kN(s,o,l,d){var y=(l&335544064)===l;y&&o.alternate===null&&o.return!==null&&o.return.alternate!==null&&tm(o);var j=o.flags;switch(o.tag){case 0:case 11:case 15:ro(s,o,l,d),j&2048&&vd(9,o);break;case 1:ro(s,o,l,d);break;case 3:ro(s,o,l,d),y&&c0&&(s=s.containerInfo,s=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,s.style.viewTransitionName==="root"&&(s.style.viewTransitionName=""),s=s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName==="none"&&(s.style.viewTransitionName="")),j&2048&&(j=null,o.alternate!==null&&(j=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==j&&(o.refCount++,j!=null&&ad(j)));break;case 12:if(j&2048){ro(s,o,l,d),j=o.stateNode;try{var I=o.memoizedProps,Z=I.id,me=I.onPostCommit;typeof me=="function"&&me(Z,o.alternate===null?"mount":"update",j.passiveEffectDuration,-0)}catch(Ce){vn(o,o.return,Ce)}}else ro(s,o,l,d);break;case 31:ro(s,o,l,d);break;case 13:ro(s,o,l,d);break;case 23:break;case 22:I=o.stateNode,Z=o.alternate,o.memoizedState!==null?(y&&Z!==null&&Z.memoizedState===null&&tm(Z),I._visibility&2?ro(s,o,l,d):jd(s,o)):(y&&Z!==null&&Z.memoizedState!==null&&tm(o),I._visibility&2?ro(s,o,l,d):(I._visibility|=2,Vc(s,o,l,d,(o.subtreeFlags&10256)!==0||!1))),j&2048&&f0(Z,o);break;case 24:ro(s,o,l,d),j&2048&&h0(o.alternate,o);break;case 30:y&&(j=o.alternate,j!==null&&(Go(j.child,!0),Go(o.child,!0))),ro(s,o,l,d);break;default:ro(s,o,l,d)}}function Vc(s,o,l,d,y){for(y=y&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var j=s,I=o,Z=l,me=d,Ce=I.flags;switch(I.tag){case 0:case 11:case 15:Vc(j,I,Z,me,y),vd(8,I);break;case 23:break;case 22:var ze=I.stateNode;I.memoizedState!==null?ze._visibility&2?Vc(j,I,Z,me,y):jd(j,I):(ze._visibility|=2,Vc(j,I,Z,me,y)),y&&Ce&2048&&f0(I.alternate,I);break;case 24:Vc(j,I,Z,me,y),y&&Ce&2048&&h0(I.alternate,I);break;default:Vc(j,I,Z,me,y)}o=o.sibling}}function jd(s,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var l=s,d=o,y=d.flags;switch(d.tag){case 22:jd(l,d),y&2048&&f0(d.alternate,d);break;case 24:jd(l,d),y&2048&&h0(d.alternate,d);break;default:jd(l,d)}o=o.sibling}}var Ml=8192;function Ol(s,o,l){if(s.subtreeFlags&Ml)for(s=s.child;s!==null;)TN(s,o,l),s=s.sibling}function TN(s,o,l){switch(s.tag){case 26:Ol(s,o,l),s.flags&Ml&&(s.memoizedState!==null?gP(l,ko,s.memoizedState,s.memoizedProps):(s=s.stateNode,(o&335544128)===o&&zC(l,s)));break;case 5:Ol(s,o,l),s.flags&Ml&&(s=s.stateNode,(o&335544128)===o&&zC(l,s));break;case 3:case 4:var d=ko;ko=Ad(s.stateNode.containerInfo),Ol(s,o,l),ko=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Ml,Ml=16777216,Ol(s,o,l),Ml=d):Ol(s,o,l));break;case 30:if((s.flags&Ml)!==0&&(d=s.memoizedProps.name,d!=null&&d!=="auto")){var y=s.stateNode;y.paired=null,Mr===null&&(Mr=new Map),Mr.set(d,y)}Ol(s,o,l);break;default:Ol(s,o,l)}}function EN(s){var o=s.alternate;if(o!==null&&(s=o.child,s!==null)){o.child=null;do o=s.sibling,s.sibling=null,s=o;while(s!==null)}}function Sd(s){var o=s.deletions;if((s.flags&16)!==0){if(o!==null)for(var l=0;l<o.length;l++){var d=o[l];ks=d,AN(d,s)}EN(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)RN(s),s=s.sibling}function RN(s){switch(s.tag){case 0:case 11:case 15:Sd(s),s.flags&2048&&ji(9,s,s.return);break;case 3:Sd(s);break;case 12:Sd(s);break;case 22:var o=s.stateNode;s.memoizedState!==null&&o._visibility&2&&(s.return===null||s.return.tag!==13)?(o._visibility&=-3,om(s)):Sd(s);break;default:Sd(s)}}function om(s){var o=s.deletions;if((s.flags&16)!==0){if(o!==null)for(var l=0;l<o.length;l++){var d=o[l];ks=d,AN(d,s)}EN(s)}for(s=s.child;s!==null;){switch(o=s,o.tag){case 0:case 11:case 15:ji(8,o,o.return),om(o);break;case 22:l=o.stateNode,l._visibility&2&&(l._visibility&=-3,om(o));break;default:om(o)}s=s.sibling}}function AN(s,o){for(;ks!==null;){var l=ks;switch(l.tag){case 0:case 11:case 15:ji(8,l,o);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:ad(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,ks=d;else e:for(l=s;ks!==null;){d=ks;var y=d.sibling,j=d.return;if(vN(d),d===l){ks=null;break e}if(y!==null){y.return=j,ks=y;break e}ks=j}}}var dI={getCacheForType:function(s){var o=Is(os),l=o.data.get(s);return l===void 0&&(l=s(),o.data.set(s,l)),l},cacheSignal:function(){return Is(os).controller.signal}},fI=typeof WeakMap=="function"?WeakMap:Map,dn=0,An=null,qt=null,Kt=0,bn=0,Or=null,Ni=!1,Uc=!1,m0=!1,za=0,Wn=0,Ci=0,Dl=0,am=0,Dr=0,Hc=0,Nd=null,mr=null,p0=!1,im=0,MN=0,lm=1/0,cm=null,ki=null,Fn=0,Eo=null,zl=null,Xo=0,g0=0,x0=null,ON=null,Fc=null,Gc=null,qc=null,Cd=0,um=null;function zr(){return(dn&2)!==0&&Kt!==0?Kt&-Kt:ae.T!==null?T0():ds()}function DN(){if(Dr===0)if((Kt&536870912)===0||Vt){var s=fn;fn<<=1,(fn&3932160)===0&&(fn=262144),Dr=s}else Dr=536870912;return s=Ps.current,s!==null&&(s.flags|=32),Dr}function Yc(s,o){if(o!=null){var l=s.stateNode,d=l.ref;d===null&&(d=l.ref=hC(Na(s.memoizedProps,l))),Gc===null&&(Gc=[]),Gc.push(o.bind(null,d))}}function pr(s,o,l){(s===An&&(bn===2||bn===9)||s.cancelPendingCommit!==null)&&(Kc(s,0),Ti(s,Kt,Dr,!1)),un(s,l),((dn&2)===0||s!==An)&&(s===An&&((dn&2)===0&&(Dl|=l),Wn===4&&Ti(s,Kt,Dr,!1)),Wo(s))}function zN(s,o,l){if((dn&6)!==0)throw Error(a(327));var d=!l&&(o&127)===0&&(o&s.expiredLanes)===0||tt(s,o),y=d?pI(s,o):v0(s,o,!0),j=d;do{if(y===0){Uc&&!d&&Ti(s,o,0,!1);break}else{if(l=s.current.alternate,j&&!hI(l)){y=v0(s,o,!1),j=!1;continue}if(y===2){if(j=o,s.errorRecoveryDisabledLanes&j)var I=0;else I=s.pendingLanes&-536870913,I=I!==0?I:I&536870912?536870912:0;if(I!==0){o=I;e:{var Z=s;y=Nd;var me=Z.current.memoizedState.isDehydrated;if(me&&(Kc(Z,I).flags|=256),I=v0(Z,I,!1),I!==2&&I!==6){if(m0&&!me){Z.errorRecoveryDisabledLanes|=j,Dl|=j,y=4;break e}j=mr,mr=y,j!==null&&(mr===null?mr=j:mr.push.apply(mr,j))}y=I}if(j=!1,y!==2)continue}}if(y===1){Kc(s,0),Ti(s,o,0,!0);break}e:{switch(d=s,j=y,j){case 0:case 1:throw Error(a(345));case 4:if((o&4194048)!==o&&(o&62914560)!==o)break;case 6:Ti(d,o,Dr,!Ni);break e;case 2:mr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((o&62914560)===o&&(y=im+300-ve(),10<y)){if(Ti(d,o,Dr,!Ni),de(d,0,!0)!==0)break e;Xo=o,d.timeoutHandle=L0(IN.bind(null,d,l,mr,cm,p0,o,Dr,Dl,Hc,Ni,j,"Throttled",-0,0),y);break e}IN(d,l,mr,cm,p0,o,Dr,Dl,Hc,Ni,j,null,-0,0)}}break}while(!0);Wo(s)}function IN(s,o,l,d,y,j,I,Z,me,Ce,ze,$e,we,Me){s.timeoutHandle=-1;var ot=o.subtreeFlags,mt=(j&335544064)===j;if($e=null,(mt||ot&8192||(ot&16785408)===16785408)&&($e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:er},Mr=null,TN(o,j,$e),mt&&(ot=$e,mt=s.containerInfo,mt=(mt.nodeType===9?mt:mt.ownerDocument).__reactViewTransition,mt!=null&&(ot.count++,ot.waitingForViewTransition=!0,ot=Dd.bind(ot),mt.finished.then(ot,ot))),ot=(j&62914560)===j?im-ve():(j&4194048)===j?MN-ve():0,ot=xP($e,ot),ot!==null)){Xo=j,s.cancelPendingCommit=ot(HN.bind(null,s,o,j,l,d,y,I,Z,me,Ce,ze,$e,null,we,Me)),Ti(s,j,I,!Ce);return}HN(s,o,j,l,d,y,I,Z,me,Ce,ze,$e)}function hI(s){for(var o=s;;){var l=o.tag;if((l===0||l===11||l===15)&&o.flags&16384&&(l=o.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var y=l[d],j=y.getSnapshot;y=y.value;try{if(!Rr(j(),y))return!1}catch{return!1}}if(l=o.child,o.subtreeFlags&16384&&l!==null)l.return=o,o=l;else{if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ti(s,o,l,d){o=Et(s,o),o&=~am,o&=~Dl,s.suspendedLanes|=o,s.pingedLanes&=~o,d&&(s.warmLanes|=o),d=s.expirationTimes;for(var y=o;0<y;){var j=31-it(y),I=1<<j;d[j]=-1,y&=~I}l!==0&&Jn(s,l,o)}function dm(){return(dn&6)===0?(kd(0),!1):!0}function b0(){if(qt!==null){if(bn===0)var s=qt.return;else s=qt,Ea=wl=null,kb(s),zc=null,cd=0,s=qt;for(;s!==null;)rN(s.alternate,s),s=s.return;qt=null}}function Kc(s,o){var l=s.timeoutHandle;return l!==-1&&(s.timeoutHandle=-1,_I(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Xo=0,b0(),An=s,qt=l=ka(s.current,null),Kt=o,bn=0,Or=null,Ni=!1,Uc=tt(s,o),m0=!1,Hc=Dr=am=Dl=Ci=Wn=0,mr=Nd=null,p0=!1,za=Et(s,o),vh(),l}function PN(s,o){_t=null,ae.H=Fh,o===Dc||o===Ah?(o=Hj(),bn=3):o===hb?(o=Hj(),bn=4):bn=o===Vb?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Or=o,qt===null&&(Wn=1,Gh(s,eo(o,s.current)))}function _N(){var s=Ps.current;return s===null?!0:(Kt&4194048)===Kt?qs===null:(Kt&62914560)===Kt||(Kt&536870912)!==0?s===qs:!1}function LN(){var s=ae.H;return ae.H=Fh,s===null?Fh:s}function $N(){var s=ae.A;return ae.A=dI,s}function fm(){Wn=4,Ni||(Kt&4194048)!==Kt&&Ps.current!==null||(Uc=!0),(Ci&134217727)===0&&(Dl&134217727)===0||An===null||Ti(An,Kt,Dr,!1)}function v0(s,o,l){var d=dn;dn|=2;var y=LN(),j=$N();(An!==s||Kt!==o)&&(cm=null,Kc(s,o)),o=!1;var I=Wn;e:do try{if(bn!==0&&qt!==null){var Z=qt,me=Or;switch(bn){case 8:b0(),I=6;break e;case 3:case 2:case 9:case 6:Ps.current===null&&(o=!0);var Ce=bn;if(bn=0,Or=null,Xc(s,Z,me,Ce),l&&Uc){I=0;break e}break;default:Ce=bn,bn=0,Or=null,Xc(s,Z,me,Ce)}}mI(),I=Wn;break}catch(ze){PN(s,ze)}while(!0);return o&&s.shellSuspendCounter++,Ea=wl=null,dn=d,ae.H=y,ae.A=j,qt===null&&(An=null,Kt=0,vh()),I}function mI(){for(;qt!==null;)BN(qt)}function pI(s,o){var l=dn;dn|=2;var d=LN(),y=$N();An!==s||Kt!==o?(cm=null,lm=ve()+500,Kc(s,o)):Uc=tt(s,o);e:do try{if(bn!==0&&qt!==null){o=qt;var j=Or;t:switch(bn){case 1:bn=0,Or=null,Xc(s,o,j,1);break;case 2:case 9:if(Vj(j)){bn=0,Or=null,VN(o);break}o=function(){bn!==2&&bn!==9||An!==s||(bn=7),Wo(s)},j.then(o,o);break e;case 3:bn=7;break e;case 4:bn=5;break e;case 7:Vj(j)?(bn=0,Or=null,VN(o)):(bn=0,Or=null,Xc(s,o,j,7));break;case 5:var I=null;switch(qt.tag){case 26:I=qt.memoizedState;case 5:case 27:var Z=qt;if(I?OC(I):Z.stateNode.complete){bn=0,Or=null;var me=Z.sibling;if(me!==null)qt=me;else{var Ce=Z.return;Ce!==null?(qt=Ce,hm(Ce)):qt=null}break t}}bn=0,Or=null,Xc(s,o,j,5);break;case 6:bn=0,Or=null,Xc(s,o,j,6);break;case 8:b0(),Wn=6;break e;default:throw Error(a(462))}}gI();break}catch(ze){PN(s,ze)}while(!0);return Ea=wl=null,ae.H=d,ae.A=y,dn=l,qt!==null?0:(An=null,Kt=0,vh(),Wn)}function gI(){for(;qt!==null&&!At();)BN(qt)}function BN(s){var o=nN(s.alternate,s,za);s.memoizedProps=s.pendingProps,o===null?hm(s):qt=o}function VN(s){var o=s,l=o.alternate;switch(o.tag){case 15:case 0:o=XS(l,o,o.pendingProps,o.type,void 0,Kt);break;case 11:o=XS(l,o,o.pendingProps,o.type.render,o.ref,Kt);break;case 5:kb(o);var d=o;d===Ns&&(Vt?(Ch(d),d.tag===5&&d.stateNode!=null&&(Mn=d.stateNode)):(Ch(d),Vt=!0));default:rN(l,o),o=qt=Aj(o,za),o=nN(l,o,za)}s.memoizedProps=s.pendingProps,o===null?hm(s):qt=o}function Xc(s,o,l,d){Ea=wl=null,kb(o),zc=null,cd=0;var y=o.return;try{if(sI(s,y,o,l,Kt)){Wn=1,Gh(s,eo(l,s.current)),qt=null;return}}catch(j){if(y!==null)throw qt=y,j;Wn=1,Gh(s,eo(l,s.current)),qt=null;return}o.flags&32768?(Vt||d===1?s=!0:Uc||(Kt&536870912)!==0?s=!1:(Ni=s=!0,(d===2||d===9||d===3||d===6)&&(d=Ps.current,d!==null&&d.tag===13&&(d.flags|=16384))),UN(o,s)):hm(o)}function hm(s){var o=s;do{if((o.flags&32768)!==0){UN(o,Ni);return}s=o.return;var l=iI(o.alternate,o,za);if(l!==null){qt=l;return}if(o=o.sibling,o!==null){qt=o;return}qt=o=s}while(o!==null);Wn===0&&(Wn=5)}function UN(s,o){do{var l=lI(s.alternate,s);if(l!==null){l.flags&=32767,qt=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!o&&(s=s.sibling,s!==null)){qt=s;return}qt=s=l}while(s!==null);Wn=6,qt=null}function HN(s,o,l,d,y,j,I,Z,me,Ce,ze,$e){s.cancelPendingCommit=null;do mm();while(Fn!==0);if((dn&6)!==0)throw Error(a(327));if(o!==null){if(o===s.current)throw Error(a(177));s===An&&(qt=An=null,Kt=0),zl=o,Eo=s,Xo=l,x0=y,ON=d,xI(s,o,l,I,Z,me,$e)}}function xI(s,o,l,d,y,j,I){var Z=o.lanes|o.childLanes;if(g0=Z,Z|=eb,ns(s,l,Z,d,y,j),Gc=null,(l&335544064)===l?(qc=Gz(s),d=10262):(qc=null,d=10256),(o.subtreeFlags&d)!==0||(o.flags&d)!==0?(s.callbackNode=null,s.callbackPriority=0,SI(Ke,function(){return S0(),null})):(s.callbackNode=null,s.callbackPriority=0),Jh=!1,d=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||d){d=ae.T,ae.T=null,y=ue.p,ue.p=2,j=dn,dn|=4;try{cI(s,o,l)}finally{dn=j,ue.p=y,ae.T=d}}Fn=1,Jh?Fc=HI(I,s.containerInfo,qc,y0,w0,vI,j0,S0,bI):(y0(),w0(),j0())}function bI(s){if(Fn!==0){var o=Eo.onRecoverableError;o(s,{componentStack:null})}}function vI(){Fn===3&&(Fn=0,CN(zl,Eo),Fn=4)}function y0(){if(Fn===1){Fn=0;var s=Eo,o=zl,l=Xo,d=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||d){d=ae.T,ae.T=null;var y=ue.p;ue.p=2;var j=dn;dn|=4;try{wd=nm=!1,SN(o,s,l),l=I0;var I=yj(s.containerInfo),Z=l.focusedElem,me=l.selectionRange;if(I!==Z&&Z&&Z.ownerDocument&&vj(Z.ownerDocument.documentElement,Z)){if(me!==null&&Xx(Z)){var Ce=me.start,ze=me.end;if(ze===void 0&&(ze=Ce),"selectionStart"in Z)Z.selectionStart=Ce,Z.selectionEnd=Math.min(ze,Z.value.length);else{var $e=Z.ownerDocument||document,we=$e&&$e.defaultView||window;if(we.getSelection){var Me=we.getSelection(),ot=Z.textContent.length,mt=Math.min(me.start,ot),Lt=me.end===void 0?mt:Math.min(me.end,ot);!Me.extend&&mt>Lt&&(I=Lt,Lt=mt,mt=I);var Ne=bj(Z,mt),be=bj(Z,Lt);if(Ne&&be&&(Me.rangeCount!==1||Me.anchorNode!==Ne.node||Me.anchorOffset!==Ne.offset||Me.focusNode!==be.node||Me.focusOffset!==be.offset)){var Ee=$e.createRange();Ee.setStart(Ne.node,Ne.offset),Me.removeAllRanges(),mt>Lt?(Me.addRange(Ee),Me.extend(be.node,be.offset)):(Ee.setEnd(be.node,be.offset),Me.addRange(Ee))}}}}for($e=[],Me=Z;Me=Me.parentNode;)Me.nodeType===1&&$e.push({element:Me,left:Me.scrollLeft,top:Me.scrollTop});for(typeof Z.focus=="function"&&Z.focus(),Z=0;Z<$e.length;Z++){var Le=$e[Z];Le.element.scrollLeft=Le.left,Le.element.scrollTop=Le.top}}su=!!z0,I0=z0=null}finally{dn=j,ue.p=y,ae.T=d}}s.current=o,Fn=2}}function w0(){if(Fn===2){Fn=0;var s=Eo,o=zl,l=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||l){l=ae.T,ae.T=null;var d=ue.p;ue.p=2;var y=dn;dn|=4;try{xN(s,o.alternate,o)}finally{dn=y,ue.p=d,ae.T=l}}Fn=3}}function j0(){if(Fn===4||Fn===3){Fn=0;var s=Fc;Fc=null,rt();var o=Eo,l=zl,d=Xo,y=ON,j=(d&335544064)===d?10262:10256;if((l.subtreeFlags&j)!==0||(l.flags&j)!==0?Fn=5:(Fn=0,zl=Eo=null,FN(o,o.pendingLanes)),j=o.pendingLanes,j===0&&(ki=null),Fs(d),l=l.stateNode,Ye&&typeof Ye.onCommitFiberRoot=="function")try{Ye.onCommitFiberRoot(Se,l,void 0,(l.current.flags&128)===128)}catch{}if(y!==null){l=ae.T,j=ue.p,ue.p=2,ae.T=null;try{for(var I=o.onRecoverableError,Z=0;Z<y.length;Z++){var me=y[Z];I(me.value,{componentStack:me.stack})}}finally{ae.T=l,ue.p=j}}if(y=Gc,I=qc,qc=null,y!==null&&(Gc=null,I===null&&(I=[]),s!==null))for(me=0;me<y.length;me++)l=(0,y[me])(I),l!==void 0&&s.finished.finally(l);(Xo&3)!==0&&mm(),Wo(o),j=o.pendingLanes,(d&261930)!==0&&(j&42)!==0?o===um?Cd++:(Cd=0,um=o):(Cd=0,um=null),kd(0)}}function FN(s,o){(s.pooledCacheLanes&=o)===0&&(o=s.pooledCache,o!=null&&(s.pooledCache=null,ad(o)))}function mm(){return Fc!==null&&(Fc.skipTransition(),Fc=null),y0(),w0(),j0(),S0()}function S0(){if(Fn!==5)return!1;var s=Eo,o=g0;g0=0;var l=Fs(Xo),d=ae.T,y=ue.p;try{ue.p=32>l?32:l,ae.T=null,l=x0,x0=null;var j=Eo,I=Xo;if(Fn=0,zl=Eo=null,Xo=0,(dn&6)!==0)throw Error(a(331));var Z=dn;if(dn|=4,RN(j.current),kN(j,j.current,I,l),dn=Z,kd(0,!1),Ye&&typeof Ye.onPostCommitFiberRoot=="function")try{Ye.onPostCommitFiberRoot(Se,j)}catch{}return!0}finally{ue.p=y,ae.T=d,FN(s,o)}}function GN(s,o,l){o=eo(l,o),o=Bb(s.stateNode,o,2),s=bi(s,o,2),s!==null&&(un(s,2),Wo(s))}function vn(s,o,l){if(s.tag===3)GN(s,s,l);else for(;o!==null;){if(o.tag===3){GN(o,s,l);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ki===null||!ki.has(d))){s=eo(l,s),l=VS(2),d=bi(o,l,2),d!==null&&(US(l,d,o,s),un(d,2),Wo(d));break}}o=o.return}}function N0(s,o,l){var d=s.pingCache;if(d===null){d=s.pingCache=new fI;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(l)||(m0=!0,y.add(l),s=yI.bind(null,s,o,l),o.then(s,s))}function yI(s,o,l){var d=s.pingCache;d!==null&&d.delete(o),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,An===s&&(Kt&l)===l&&((Wn===4||Wn===3&&(Kt&62914560)===Kt&&300>ve()-im)&&(dn&2)===0?Kc(s,0):am|=l,Hc===Kt&&(Hc=0)),Wo(s)}function qN(s,o){o===0&&(o=xn()),s=bl(s,o),s!==null&&(un(s,o),Wo(s))}function wI(s){var o=s.memoizedState,l=0;o!==null&&(l=o.retryLane),qN(s,l)}function jI(s,o){var l=0;switch(s.tag){case 31:case 13:var d=s.stateNode,y=s.memoizedState;y!==null&&(l=y.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(o),qN(s,l)}function SI(s,o){return Je(s,o)}var Wc=null,Qc=null,C0=!1,pm=!1,k0=!1,Ei=0;function Wo(s){s!==Qc&&s.next===null&&(Qc===null?Wc=Qc=s:Qc=Qc.next=s),pm=!0,C0||(C0=!0,CI())}function kd(s,o){if(!k0&&pm){k0=!0;do for(var l=!1,d=Wc;d!==null;){if(s!==0){var y=d.pendingLanes;if(y===0)var j=0;else{var I=d.suspendedLanes,Z=d.pingedLanes;j=(1<<31-it(42|s)+1)-1,j&=y&~(I&~Z),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(l=!0,WN(d,j))}else j=Kt,j=de(d,d===An?j:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(j&3)===0||tt(d,j)||(l=!0,WN(d,j));d=d.next}while(l);k0=!1}}function NI(){YN()}function YN(){pm=C0=!1;var s=0;Ei!==0&&PI()&&(s=Ei);for(var o=ve(),l=null,d=Wc;d!==null;){var y=d.next,j=KN(d,o);j===0?(d.next=null,l===null?Wc=y:l.next=y,y===null&&(Qc=l)):(l=d,(s!==0||(j&3)!==0)&&(pm=!0)),d=y}Fn!==0&&Fn!==5||kd(s),Ei!==0&&(Ei=0)}function KN(s,o){for(var l=s.suspendedLanes,d=s.pingedLanes,y=s.expirationTimes,j=s.pendingLanes&-62914561;0<j;){var I=31-it(j),Z=1<<I,me=y[I];me===-1?((Z&l)===0||(Z&d)!==0)&&(y[I]=on(Z,o)):me<=o&&(s.expiredLanes|=Z),j&=~Z}if(o=An,l=Kt,l=de(s,s===o?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,l===0||s===o&&(bn===2||bn===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&ct(d),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||tt(s,l)){if(o=l&-l,o===s.callbackPriority)return o;switch(d!==null&&ct(d),Fs(l)){case 2:case 8:l=xt;break;case 32:l=Ke;break;case 268435456:l=jt;break;default:l=Ke}return d=XN.bind(null,s),l=Je(l,d),s.callbackPriority=o,s.callbackNode=l,o}return d!==null&&d!==null&&ct(d),s.callbackPriority=2,s.callbackNode=null,2}function XN(s,o){if(Fn!==0&&Fn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(mm()&&s.callbackNode!==l)return null;var d=Kt;return d=de(s,s===An?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(zN(s,d,o),KN(s,ve()),s.callbackNode!=null&&s.callbackNode===l?XN.bind(null,s):null)}function WN(s,o){if(mm())return null;zN(s,o,!0)}function CI(){LI(function(){(dn&6)!==0?Je(Qe,NI):YN()})}function T0(){if(Ei===0){var s=Nl;s===0&&(s=Gt,Gt<<=1,(Gt&261888)===0&&(Gt=256)),Ei=s}return Ei}function QN(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Ds(s)}function kI(s,o,l,d,y){if(o==="submit"&&l&&l.stateNode===y){var j=QN((y[Os]||null).action),I=d.submitter;I&&(o=(o=I[Os]||null)?QN(o.formAction):I.getAttribute("formAction"),o!==null&&(j=o,I=null));var Z=new ph("action","action",null,d,y);s.push({event:Z,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Ei!==0){var me=new FormData(y,I);Ib(l,{pending:!0,data:me,method:y.method,action:j},null,me)}}else typeof j=="function"&&(Z.preventDefault(),me=new FormData(y,I),Ib(l,{pending:!0,data:me,method:y.method,action:j},j,me))},currentTarget:y}]})}}for(var E0=0;E0<Jx.length;E0++){var R0=Jx[E0],TI=R0.toLowerCase(),EI=R0[0].toUpperCase()+R0.slice(1);No(TI,"on"+EI)}No(Sj,"onAnimationEnd"),No(Nj,"onAnimationIteration"),No(Cj,"onAnimationStart"),No("dblclick","onDoubleClick"),No("focusin","onFocus"),No("focusout","onBlur"),No(_z,"onTransitionRun"),No(Lz,"onTransitionStart"),No($z,"onTransitionCancel"),No(kj,"onTransitionEnd"),Nn("onMouseEnter",["mouseout","mouseover"]),Nn("onMouseLeave",["mouseout","mouseover"]),Nn("onPointerEnter",["pointerout","pointerover"]),Nn("onPointerLeave",["pointerout","pointerover"]),Bt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Bt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Bt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Bt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Bt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Bt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Td="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(" "),RI=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Td));function ZN(s,o){o=(o&4)!==0;for(var l=0;l<s.length;l++){var d=s[l],y=d.event;d=d.listeners;e:{var j=void 0;if(o)for(var I=d.length-1;0<=I;I--){var Z=d[I],me=Z.instance,Ce=Z.currentTarget;if(Z=Z.listener,me!==j&&y.isPropagationStopped())break e;j=Z,y.currentTarget=Ce;try{j(y)}catch(ze){bh(ze)}y.currentTarget=null,j=me}else for(I=0;I<d.length;I++){if(Z=d[I],me=Z.instance,Ce=Z.currentTarget,Z=Z.listener,me!==j&&y.isPropagationStopped())break e;j=Z,y.currentTarget=Ce;try{j(y)}catch(ze){bh(ze)}y.currentTarget=null,j=me}}}}function Yt(s,o){var l=o[Gu];l===void 0&&(l=o[Gu]=new Set);var d=s+"__bubble";l.has(d)||(JN(o,s,2,!1),l.add(d))}function A0(s,o,l){var d=0;o&&(d|=4),JN(l,s,d,o)}var gm="_reactListening"+Math.random().toString(36).slice(2);function M0(s){if(!s[gm]){s[gm]=!0,zt.forEach(function(l){l!=="selectionchange"&&(RI.has(l)||A0(l,!1,s),A0(l,!0,s))});var o=s.nodeType===9?s:s.ownerDocument;o===null||o[gm]||(o[gm]=!0,A0("selectionchange",!1,o))}}function JN(s,o,l,d){switch(UC(o)){case 2:var y=wP;break;case 8:y=jP;break;default:y=Q0}l=y.bind(null,o,l,s),y=void 0,!pl||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(y=!0),d?y!==void 0?s.addEventListener(o,l,{capture:!0,passive:y}):s.addEventListener(o,l,!0):y!==void 0?s.addEventListener(o,l,{passive:y}):s.addEventListener(o,l,!1)}function O0(s,o,l,d,y){var j=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var I=d.tag;if(I===3||I===4){var Z=d.stateNode.containerInfo;if(Z===y)break;if(I===4)for(I=d.return;I!==null;){var me=I.tag;if((me===3||me===4)&&I.stateNode.containerInfo===y)return;I=I.return}for(;Z!==null;){if(I=So(Z),I===null)return;if(me=I.tag,me===5||me===6||me===26||me===27){d=j=I;continue e}Z=Z.parentNode}}d=d.return}ml(function(){var Ce=j,ze=hl(l),$e=[];e:{var we=Tj.get(s);if(we!==void 0){var Me=ph,ot=s;switch(s){case"keypress":if(hh(l)===0)break e;case"keydown":case"keyup":Me=hz;break;case"focusin":ot="focus",Me=Hx;break;case"focusout":ot="blur",Me=Hx;break;case"beforeblur":case"afterblur":Me=Hx;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Me=nj;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Me=tz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Me=bz;break;case Sj:case Nj:case Cj:Me=rz;break;case kj:Me=yz;break;case"scroll":case"scrollend":Me=JD;break;case"wheel":Me=jz;break;case"copy":case"cut":case"paste":Me=az;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Me=rj;break;case"submit":Me=gz;break;case"toggle":case"beforetoggle":Me=Nz}var mt=(o&4)!==0,Lt=!mt&&(s==="scroll"||s==="scrollend"),Ne=mt?we!==null?we+"Capture":null:we;mt=[];for(var be=Ce,Ee;be!==null;){var Le=be;if(Ee=Le.stateNode,Le=Le.tag,Le!==5&&Le!==26&&Le!==27||Ee===null||Ne===null||(Le=Sa(be,Ne),Le!=null&&mt.push(Ed(be,Le,Ee))),Lt)break;be=be.return}0<mt.length&&(we=new Me(we,ot,null,l,ze),$e.push({event:we,listeners:mt}))}}if((o&7)===0){e:{if(Me=s==="mouseover"||s==="pointerover",we=s==="mouseout"||s==="pointerout",Me&&l!==fl&&(ot=l.relatedTarget||l.fromElement)&&(So(ot)||ot[Nr]))break e;(we||Me)&&(ot=ze.window===ze?ze:(Me=ze.ownerDocument)?Me.defaultView||Me.parentWindow:window,we?(Me=l.relatedTarget||l.toElement,we=Ce,Me=Me?So(Me):null,Me!==null&&(Lt=c(Me),mt=Me.tag,Me!==Lt||mt!==5&&mt!==27&&mt!==6)&&(Me=null)):(we=null,Me=Ce),we!==Me&&(mt=nj,Le="onMouseLeave",Ne="onMouseEnter",be="mouse",(s==="pointerout"||s==="pointerover")&&(mt=rj,Le="onPointerLeave",Ne="onPointerEnter",be="pointer"),Lt=we==null?ot:De(we),Ee=Me==null?ot:De(Me),ot=new mt(Le,be+"leave",we,l,ze),ot.target=Lt,ot.relatedTarget=Ee,Le=null,So(ze)===Ce&&(mt=new mt(Ne,be+"enter",Me,l,ze),mt.target=Ee,mt.relatedTarget=Lt,Le=mt),Lt=Le,mt=we&&Me?A(we,Me,AI):null,we!==null&&eC($e,ot,we,mt,!1),Me!==null&&Lt!==null&&eC($e,Lt,Me,mt,!0)))}e:{if(we=Ce?De(Ce):window,Me=we.nodeName&&we.nodeName.toLowerCase(),Me==="select"||Me==="input"&&we.type==="file")var ut=fj;else if(uj(we))if(hj)ut=zz;else{ut=Oz;var Xt=Mz}else Me=we.nodeName,!Me||Me.toLowerCase()!=="input"||we.type!=="checkbox"&&we.type!=="radio"?Ce&&dl(Ce.elementType)&&(ut=fj):ut=Dz;if(ut&&(ut=ut(s,Ce))){dj($e,ut,l,ze);break e}Xt&&Xt(s,we,Ce)}switch(Xt=Ce?De(Ce):window,s){case"focusin":(uj(Xt)||Xt.contentEditable==="true")&&(Cc=Xt,Wx=Ce,sd=null);break;case"focusout":sd=Wx=Cc=null;break;case"mousedown":Qx=!0;break;case"contextmenu":case"mouseup":case"dragend":Qx=!1,wj($e,l,ze);break;case"selectionchange":if(Pz)break;case"keydown":case"keyup":wj($e,l,ze)}var vt;if(Gx)e:{switch(s){case"compositionstart":var Rt="onCompositionStart";break e;case"compositionend":Rt="onCompositionEnd";break e;case"compositionupdate":Rt="onCompositionUpdate";break e}Rt=void 0}else Nc?lj(s,l)&&(Rt="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Rt="onCompositionStart");Rt&&(oj&&l.locale!=="ko"&&(Nc||Rt!=="onCompositionStart"?Rt==="onCompositionEnd"&&Nc&&(vt=ej()):(ci=ze,Bx="value"in ci?ci.value:ci.textContent,Nc=!0)),Xt=xm(Ce,Rt),0<Xt.length&&(Rt=new sj(Rt,s,null,l,ze),$e.push({event:Rt,listeners:Xt}),vt?Rt.data=vt:(vt=cj(l),vt!==null&&(Rt.data=vt)))),(vt=kz?Tz(s,l):Ez(s,l))&&(Rt=xm(Ce,"onBeforeInput"),0<Rt.length&&(Xt=new sj("onBeforeInput","beforeinput",null,l,ze),$e.push({event:Xt,listeners:Rt}),Xt.data=vt)),kI($e,s,Ce,l,ze)}ZN($e,o)})}function Ed(s,o,l){return{instance:s,listener:o,currentTarget:l}}function xm(s,o){for(var l=o+"Capture",d=[];s!==null;){var y=s,j=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||j===null||(y=Sa(s,l),y!=null&&d.unshift(Ed(s,y,j)),y=Sa(s,o),y!=null&&d.push(Ed(s,y,j))),s.tag===3)return d;s=s.return}return[]}function AI(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function eC(s,o,l,d,y){for(var j=o._reactName,I=[];l!==null&&l!==d;){var Z=l,me=Z.alternate,Ce=Z.stateNode;if(Z=Z.tag,me!==null&&me===d)break;Z!==5&&Z!==26&&Z!==27||Ce===null||(me=Ce,y?(Ce=Sa(l,j),Ce!=null&&I.unshift(Ed(l,Ce,me))):y||(Ce=Sa(l,j),Ce!=null&&I.push(Ed(l,Ce,me)))),l=l.return}I.length!==0&&s.push({event:o,listeners:I})}var MI=/\r\n?/g,OI=/\u0000|\uFFFD/g;function tC(s){return(typeof s=="string"?s:""+s).replace(MI,`
50
+ `).replace(OI,"")}function nC(s,o){return o=tC(o),tC(s)===o}function yn(s,o,l,d,y,j){switch(l){case"children":if(typeof d=="string")o==="body"||o==="textarea"&&d===""||Js(s,d);else if(typeof d=="number"||typeof d=="bigint")o!=="body"&&Js(s,""+d);else return;break;case"className":Cr(s,"class",d);break;case"tabIndex":Cr(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Cr(s,l,d);break;case"style":Tr(s,d,j);return;case"data":if(o!=="object"){Cr(s,"data",d);break}case"src":case"href":if(d===""&&(o!=="a"||l!=="href")){s.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=Ds(d),s.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(l,"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 j=="function"&&(l==="formAction"?(o!=="input"&&yn(s,o,"name",y.name,y,null),yn(s,o,"formEncType",y.formEncType,y,null),yn(s,o,"formMethod",y.formMethod,y,null),yn(s,o,"formTarget",y.formTarget,y,null)):(yn(s,o,"encType",y.encType,y,null),yn(s,o,"method",y.method,y,null),yn(s,o,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=Ds(d),s.setAttribute(l,d);break;case"onClick":d!=null&&(s.onclick=er);return;case"onScroll":d!=null&&Yt("scroll",s);return;case"onScrollEnd":d!=null&&Yt("scrollend",s);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(y.children!=null)throw Error(a(60));(j!=null?j.__html:void 0)!==l&&(s.innerHTML=l)}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.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"){s.removeAttribute("xlink:href");break}l=Ds(d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);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"?s.setAttribute(l,d):s.removeAttribute(l);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"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":d===!0?s.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,d):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(l,d):s.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(l):s.setAttribute(l,d);break;case"popover":Yt("beforetoggle",s),Yt("toggle",s),Hn(s,"popover",d);break;case"xlinkActuate":ss(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":ss(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":ss(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":ss(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":ss(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":ss(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":ss(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":ss(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":ss(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Hn(s,"is",d);break;case"innerText":case"textContent":return;default:if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")l=Ku.get(l)||l,Hn(s,l,d);else return}St=!0}function D0(s,o,l,d,y,j){switch(l){case"style":Tr(s,d,j);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(y.children!=null)throw Error(a(60));(j!=null?j.__html:void 0)!==l&&(s.innerHTML=l)}}break;case"children":if(typeof d=="string")Js(s,d);else if(typeof d=="number"||typeof d=="bigint")Js(s,""+d);else return;break;case"onScroll":d!=null&&Yt("scroll",s);return;case"onScrollEnd":d!=null&&Yt("scrollend",s);return;case"onClick":d!=null&&(s.onclick=er);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Mt.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(y=l.endsWith("Capture"),j=l.slice(2,y?l.length-7:void 0),o=s[Os]||null,o=o!=null?o[l]:null,typeof o=="function"&&s.removeEventListener(j,o,y),typeof d=="function")){typeof o!="function"&&o!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(j,d,y);break e}St=!0,l in s?s[l]=d:d===!0?s.setAttribute(l,""):Hn(s,l,d)}return}St=!0}function $s(s,o,l){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Yt("error",s),Yt("load",s);var d=!1,y=!1,j;for(j in l)if(l.hasOwnProperty(j)){var I=l[j];if(I!=null)switch(j){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:yn(s,o,j,I,l,null)}}y&&yn(s,o,"srcSet",l.srcSet,l,null),d&&yn(s,o,"src",l.src,l,null);return;case"input":Yt("invalid",s);var Z=j=I=y=null,me=null,Ce=null;for(d in l)if(l.hasOwnProperty(d)){var ze=l[d];if(ze!=null)switch(d){case"name":y=ze;break;case"type":I=ze;break;case"checked":me=ze;break;case"defaultChecked":Ce=ze;break;case"value":j=ze;break;case"defaultValue":Z=ze;break;case"children":case"dangerouslySetInnerHTML":if(ze!=null)throw Error(a(137,o));break;default:yn(s,o,d,ze,l,null)}}ii(s,j,Z,me,Ce,I,y,!1);return;case"select":Yt("invalid",s),d=I=j=null;for(y in l)if(l.hasOwnProperty(y)&&(Z=l[y],Z!=null))switch(y){case"value":j=Z;break;case"defaultValue":I=Z;break;case"multiple":d=Z;default:yn(s,o,y,Z,l,null)}o=j,l=I,s.multiple=!!d,o!=null?ur(s,!!d,o,!1):l!=null&&ur(s,!!d,l,!0);return;case"textarea":Yt("invalid",s),j=y=d=null;for(I in l)if(l.hasOwnProperty(I)&&(Z=l[I],Z!=null))switch(I){case"value":d=Z;break;case"defaultValue":y=Z;break;case"children":j=Z;break;case"dangerouslySetInnerHTML":if(Z!=null)throw Error(a(91));break;default:yn(s,o,I,Z,l,null)}kr(s,d,y,j);return;case"option":for(me in l)if(l.hasOwnProperty(me)&&(d=l[me],d!=null))switch(me){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:yn(s,o,me,d,l,null)}return;case"dialog":Yt("beforetoggle",s),Yt("toggle",s),Yt("cancel",s),Yt("close",s);break;case"iframe":case"object":Yt("load",s);break;case"video":case"audio":for(d=0;d<Td.length;d++)Yt(Td[d],s);break;case"image":Yt("error",s),Yt("load",s);break;case"details":Yt("toggle",s);break;case"embed":case"source":case"link":Yt("error",s),Yt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Ce in l)if(l.hasOwnProperty(Ce)&&(d=l[Ce],d!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:yn(s,o,Ce,d,l,null)}return;default:if(dl(o)){for(ze in l)l.hasOwnProperty(ze)&&(d=l[ze],d!==void 0&&D0(s,o,ze,d,l,void 0));return}}for(Z in l)l.hasOwnProperty(Z)&&(d=l[Z],d!=null&&yn(s,o,Z,d,l,null))}var DI={};function zI(s,o,l,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,j=null,I=null,Z=null,me=null,Ce=null,ze=null;for(Me in l){var $e=l[Me];if(l.hasOwnProperty(Me)&&$e!=null)switch(Me){case"checked":break;case"value":break;case"defaultValue":me=$e;default:d.hasOwnProperty(Me)||yn(s,o,Me,null,d,$e)}}for(var we in d){var Me=d[we];if($e=l[we],d.hasOwnProperty(we)&&(Me!=null||$e!=null))switch(we){case"type":Me!==$e&&(St=!0),j=Me;break;case"name":Me!==$e&&(St=!0),y=Me;break;case"checked":Me!==$e&&(St=!0),Ce=Me;break;case"defaultChecked":Me!==$e&&(St=!0),ze=Me;break;case"value":Me!==$e&&(St=!0),I=Me;break;case"defaultValue":Me!==$e&&(St=!0),Z=Me;break;case"children":case"dangerouslySetInnerHTML":if(Me!=null)throw Error(a(137,o));break;default:Me!==$e&&yn(s,o,we,Me,d,$e)}}Gs(s,I,Z,me,Ce,ze,j,y);return;case"select":Me=I=Z=we=null;for(j in l)if(me=l[j],l.hasOwnProperty(j)&&me!=null)switch(j){case"value":break;case"multiple":Me=me;default:d.hasOwnProperty(j)||yn(s,o,j,null,d,me)}for(y in d)if(j=d[y],me=l[y],d.hasOwnProperty(y)&&(j!=null||me!=null))switch(y){case"value":j!==me&&(St=!0),we=j;break;case"defaultValue":j!==me&&(St=!0),Z=j;break;case"multiple":j!==me&&(St=!0),I=j;default:j!==me&&yn(s,o,y,j,d,me)}o=Z,l=I,d=Me,we!=null?ur(s,!!l,we,!1):!!d!=!!l&&(o!=null?ur(s,!!l,o,!0):ur(s,!!l,l?[]:"",!1));return;case"textarea":Me=we=null;for(Z in l)if(y=l[Z],l.hasOwnProperty(Z)&&y!=null&&!d.hasOwnProperty(Z))switch(Z){case"value":break;case"children":break;default:yn(s,o,Z,null,d,y)}for(I in d)if(y=d[I],j=l[I],d.hasOwnProperty(I)&&(y!=null||j!=null))switch(I){case"value":y!==j&&(St=!0),we=y;break;case"defaultValue":y!==j&&(St=!0),Me=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==j&&yn(s,o,I,y,d,j)}Sc(s,we,Me);return;case"option":for(var ot in l)if(we=l[ot],l.hasOwnProperty(ot)&&we!=null&&!d.hasOwnProperty(ot))switch(ot){case"selected":s.selected=!1;break;default:yn(s,o,ot,null,d,we)}for(me in d)if(we=d[me],Me=l[me],d.hasOwnProperty(me)&&we!==Me&&(we!=null||Me!=null))switch(me){case"selected":we!==Me&&(St=!0),s.selected=we&&typeof we!="function"&&typeof we!="symbol";break;default:yn(s,o,me,we,d,Me)}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 mt in l)we=l[mt],l.hasOwnProperty(mt)&&we!=null&&!d.hasOwnProperty(mt)&&yn(s,o,mt,null,d,we);for(Ce in d)if(we=d[Ce],Me=l[Ce],d.hasOwnProperty(Ce)&&we!==Me&&(we!=null||Me!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(a(137,o));break;default:yn(s,o,Ce,we,d,Me)}return;default:if(dl(o)){for(var Lt in l)we=l[Lt],l.hasOwnProperty(Lt)&&we!==void 0&&!d.hasOwnProperty(Lt)&&D0(s,o,Lt,void 0,d,we);for(ze in d)we=d[ze],Me=l[ze],!d.hasOwnProperty(ze)||we===Me||we===void 0&&Me===void 0||D0(s,o,ze,we,d,Me);return}}for(var Ne in l)we=l[Ne],l.hasOwnProperty(Ne)&&we!=null&&!d.hasOwnProperty(Ne)&&yn(s,o,Ne,null,d,we);for($e in d)we=d[$e],Me=l[$e],!d.hasOwnProperty($e)||we===Me||we==null&&Me==null||yn(s,o,$e,we,d,Me)}function sC(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function II(){if(typeof performance.getEntriesByType=="function"){for(var s=0,o=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var y=l[d],j=y.transferSize,I=y.initiatorType,Z=y.duration;if(j&&Z&&sC(I)){for(I=0,Z=y.responseEnd,d+=1;d<l.length;d++){var me=l[d],Ce=me.startTime;if(Ce>Z)break;var ze=me.transferSize,$e=me.initiatorType;ze&&sC($e)&&(me=me.responseEnd,I+=ze*(me<Z?1:(Z-Ce)/(me-Ce)))}if(--d,o+=8*(j+I)/(y.duration/1e3),s++,10<s)break}}if(0<s)return o/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var z0=null,I0=null;function Rd(s){return s.nodeType===9?s:s.ownerDocument}function rC(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function oC(s,o){if(s===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&o==="foreignObject"?0:s}function aC(s,o,l,d){return l=Rd(l).createElement(s),l[Un]=d,l[Os]=o,$s(l,s,o),qe(l),l}function P0(s,o){return s==="textarea"||s==="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 _0=null;function PI(){var s=window.event;return s&&s.type==="popstate"?s===_0?!1:(_0=s,!0):(_0=null,!1)}var L0=typeof setTimeout=="function"?setTimeout:void 0,_I=typeof clearTimeout=="function"?clearTimeout:void 0,iC=typeof Promise=="function"?Promise:void 0,lC=typeof requestAnimationFrame=="function"?requestAnimationFrame:L0,LI=typeof queueMicrotask=="function"?queueMicrotask:typeof iC<"u"?function(s){return iC.resolve(null).then(s).catch($I)}:L0;function $I(s){setTimeout(function(){throw s})}function Ri(s){return s==="head"}function cC(s,o){var l=o,d=0;do{var y=l.nextSibling;if(s.removeChild(l),y&&y.nodeType===8)if(l=y.data,l==="/$"||l==="/&"){if(d===0){s.removeChild(y),ru(o);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")q0(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,q0(l);for(var j=l.firstChild;j;){var I=j.nextSibling,Z=j.nodeName;j[cl]||Z==="SCRIPT"||Z==="STYLE"||Z==="LINK"&&j.rel.toLowerCase()==="stylesheet"||l.removeChild(j),j=I}}else l==="body"&&q0(s.ownerDocument.body);l=y}while(l);ru(o)}function uC(s,o){var l=s;s=0;do{var d=l.nextSibling;if(l.nodeType===1?o?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(o?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=d}while(l)}function dC(s,o,l){if(o=CSS.escape(o)!==o?"r-"+btoa(o).replace(/=/g,""):o,s.style.viewTransitionName=o,l!=null&&(s.style.viewTransitionClass=l),l=getComputedStyle(s),l.display==="inline"){if(o=s.getClientRects(),o.length===1)var d=1;else for(var y=d=0;y<o.length;y++){var j=o[y];0<j.width&&0<j.height&&d++}d===1&&(s=s.style,s.display=o.length===1?"inline-block":"block",s.marginTop="-"+l.paddingTop,s.marginBottom="-"+l.paddingBottom)}}function fC(s,o){s=s.style,o=o.style;var l=o!=null?o.hasOwnProperty("viewTransitionName")?o.viewTransitionName:o.hasOwnProperty("view-transition-name")?o["view-transition-name"]:null:null;s.viewTransitionName=l==null||typeof l=="boolean"?"":(""+l).trim(),l=o!=null?o.hasOwnProperty("viewTransitionClass")?o.viewTransitionClass:o.hasOwnProperty("view-transition-class")?o["view-transition-class"]:null:null,s.viewTransitionClass=l==null||typeof l=="boolean"?"":(""+l).trim(),s.display==="inline-block"&&(o==null?s.display=s.margin="":(l=o.display,s.display=l==null||typeof l=="boolean"?"":l,l=o.margin,l!=null?s.margin=l:(l=o.hasOwnProperty("marginTop")?o.marginTop:o["margin-top"],s.marginTop=l==null||typeof l=="boolean"?"":l,o=o.hasOwnProperty("marginBottom")?o.marginBottom:o["margin-bottom"],s.marginBottom=o==null||typeof o=="boolean"?"":o)))}function BI(s,o,l){return l=l.ownerDocument.defaultView,{rect:s,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<=s.bottom&&0<=s.right&&s.top<=l.innerHeight&&s.left<=l.innerWidth}}function $0(s){var o=s.getBoundingClientRect(),l=getComputedStyle(s);return BI(o,l,s)}function VI(s){return s.documentElement.clientHeight}function UI(s){this.addEventListener("load",s),this.addEventListener("error",s)}function HI(s,o,l,d,y,j,I,Z,me){var Ce=o.nodeType===9?o:o.ownerDocument;try{var ze=Ce.startViewTransition({update:function(){var we=Ce.defaultView,Me=we.navigation&&we.navigation.transition,ot=Ce.fonts.status;d();var mt=[];if(ot==="loaded"&&(VI(Ce),Ce.fonts.status==="loading"&&mt.push(Ce.fonts.ready)),ot=mt.length,s!==null)for(var Lt=s.suspenseyImages,Ne=0,be=0;be<Lt.length;be++){var Ee=Lt[be];if(!Ee.complete){var Le=Ee.getBoundingClientRect();if(0<Le.bottom&&0<Le.right&&Le.top<we.innerHeight&&Le.left<we.innerWidth){if(Ne+=DC(Ee),Ne>ym){mt.length=ot;break}Ee=new Promise(UI.bind(Ee)),mt.push(Ee)}}}if(0<mt.length)return we=Promise.race([Promise.all(mt),new Promise(function(ut){return setTimeout(ut,500)})]).then(y,y),(Me?Promise.allSettled([Me.finished,we]):we).then(j,j);if(y(),Me)return Me.finished.then(j,j);j()},types:l});Ce.__reactViewTransition=ze;var $e=[];return ze.ready.then(function(){for(var we=Ce.documentElement.getAnimations({subtree:!0}),Me=0;Me<we.length;Me++){var ot=we[Me],mt=ot.effect,Lt=mt.pseudoElement;if(Lt!=null&&Lt.startsWith("::view-transition")){$e.push(ot),ot=mt.getKeyframes();for(var Ne=Lt=void 0,be=!0,Ee=0;Ee<ot.length;Ee++){var Le=ot[Ee],ut=Le.width;if(Lt===void 0)Lt=ut;else if(Lt!==ut){be=!1;break}if(ut=Le.height,Ne===void 0)Ne=ut;else if(Ne!==ut){be=!1;break}delete Le.width,delete Le.height,Le.transform==="none"&&delete Le.transform}be&&Lt!==void 0&&Ne!==void 0&&(mt.setKeyframes(ot),be=getComputedStyle(mt.target,mt.pseudoElement),be.width!==Lt||be.height!==Ne)&&(be=ot[0],be.width=Lt,be.height=Ne,be=ot[ot.length-1],be.width=Lt,be.height=Ne,mt.setKeyframes(ot))}}I()},function(we){Ce.__reactViewTransition===ze&&(Ce.__reactViewTransition=null);try{if(typeof we=="object"&&we!==null)switch(we.name){case"InvalidStateError":(we.message==="View transition was skipped because document visibility state is hidden."||we.message==="Skipping view transition because document visibility state has become hidden."||we.message==="Skipping view transition because viewport size changed."||we.message==="Transition was aborted because of invalid state")&&(we=null)}we!==null&&me(we)}finally{d(),y(),I()}}),ze.finished.finally(function(){for(var we=0;we<$e.length;we++)$e[we].cancel();Ce.__reactViewTransition===ze&&(Ce.__reactViewTransition=null),Z()}),ze}catch{return d(),y(),I(),null}}function Il(s,o){this._scope=document.documentElement,this._selector="::view-transition-"+s+"("+o+")"}Il.prototype.animate=function(s,o){return o=typeof o=="number"?{duration:o}:k({},o),o.pseudoElement=this._selector,this._scope.animate(s,o)},Il.prototype.getAnimations=function(){for(var s=this._scope,o=this._selector,l=s.getAnimations({subtree:!0}),d=[],y=0;y<l.length;y++){var j=l[y].effect;j!==null&&j.target===s&&j.pseudoElement===o&&d.push(l[y])}return d},Il.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function hC(s){return{name:s,group:new Il("group",s),imagePair:new Il("image-pair",s),old:new Il("old",s),new:new Il("new",s)}}function Ir(s){this._fragmentFiber=s,this._observers=this._eventListeners=null}Ir.prototype.addEventListener=function(s,o,l){var d=null,y=null;if(!(l!=null&&typeof l!="boolean"&&(d=l.signal||null,d!==null&&d.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var j=this._eventListeners;if(pC(j,s,o,l)===-1){var I=this,Z=o;l!=null&&typeof l!="boolean"&&l.once===!0&&(Z=function(me){I.removeEventListener(s,o,l),typeof o=="function"?o.call(this,me):o.handleEvent(me)}),d!==null&&(y=I.removeEventListener.bind(I,s,o,l),d.addEventListener("abort",y,{once:!0}),y=d.removeEventListener.bind(d,"abort",y)),d=Zc(l),j.push({type:s,listener:o,optionsOrUseCapture:l,attachedListener:Z,cleanup:y}),p(this._fragmentFiber.child,!1,FI,s,Z,d)}this._eventListeners=j}};function FI(s,o,l,d){return S(s).addEventListener(o,l,d),!1}Ir.prototype.removeEventListener=function(s,o,l){var d=this._eventListeners;if(d!==null&&(o=pC(d,s,o,l),o!==-1)){var y=d[o];l=y.attachedListener;var j=y.cleanup;y=Zc(y.optionsOrUseCapture),p(this._fragmentFiber.child,!1,GI,s,l,y),d.splice(o,1),j!==null&&j()}};function GI(s,o,l,d){return S(s).removeEventListener(o,l,d),!1}function Zc(s){return s!=null&&typeof s!="boolean"&&(s.once===!0||s.signal instanceof AbortSignal)?{capture:s.capture,passive:s.passive}:s}function mC(s){return s==null?"c=0":typeof s=="boolean"?"c="+(s?"1":"0"):"c="+(s.capture?"1":"0")}function pC(s,o,l,d){if(s.length===0)return-1;d=mC(d);for(var y=0;y<s.length;y++){var j=s[y];if(j.type===o&&j.listener===l&&mC(j.optionsOrUseCapture)===d)return y}return-1}Ir.prototype.dispatchEvent=function(s){var o=b(this._fragmentFiber);if(o===null)return!0;o=S(o);var l=this._eventListeners;if(l!==null&&0<l.length||!s.bubbles){var d=o.nodeType===9?o.createComment(""):document.createTextNode("");if(l)for(var y=0;y<l.length;y++){var j=l[y];d.addEventListener(j.type,j.attachedListener,Zc(j.optionsOrUseCapture))}if(o.appendChild(d),s=d.dispatchEvent(s),l)for(y=0;y<l.length;y++)j=l[y],d.removeEventListener(j.type,j.attachedListener,Zc(j.optionsOrUseCapture));return o.removeChild(d),s}return o.dispatchEvent(s)},Ir.prototype.focus=function(s){p(this._fragmentFiber.child,!0,gC,s,void 0,void 0)};function gC(s,o){return s.tag===6?!1:(s=S(s),sP(s,o))}Ir.prototype.focusLast=function(s){var o=[];p(this._fragmentFiber.child,!0,B0,o,void 0,void 0);for(var l=o.length-1;0<=l&&!gC(o[l],s);l--);};function B0(s,o){return o.push(s),!1}Ir.prototype.blur=function(){var s=b(this._fragmentFiber);s!==null&&(s=S(s),s=Rd(s).activeElement,s!==null&&p(this._fragmentFiber.child,!1,qI,s,void 0,void 0))};function qI(s,o){return s.tag===6?!1:(s=S(s),s===o||s.contains(o)?(o.blur(),!0):!1)}Ir.prototype.observeUsing=function(s){this._observers===null&&(this._observers=new Set),this._observers.add(s),p(this._fragmentFiber.child,!1,YI,s,void 0,void 0)};function YI(s,o){return s.tag===6||(s=S(s),o.observe(s)),!1}Ir.prototype.unobserveUsing=function(s){var o=this._observers;if(o!==null&&o.has(s)){o.delete(s),p(this._fragmentFiber.child,!1,KI,s,void 0,void 0);for(var l=o=0;l<Ro.length;l++){var d=Ro[l];d.fragmentInstance===this&&d.observer===s?s.unobserve(d.instance):Ro[o++]=d}Ro.length=o}};function KI(s,o){return s.tag===6||(s=S(s),o.unobserve(s)),!1}var Ro=[],V0=!1;function XI(s,o,l){Ro.push({fragmentInstance:s,observer:o,instance:l}),V0||(V0=!0,rP(function(){V0=!1;var d=Ro;Ro=[];for(var y=0;y<d.length;y++){var j=d[y];j.observer.unobserve(j.instance)}}))}Ir.prototype.getClientRects=function(){var s=[];return p(this._fragmentFiber.child,!1,WI,s,void 0,void 0),s};function WI(s,o){if(s.tag===6){s=s.stateNode;var l=s.ownerDocument.createRange();l.selectNodeContents(s),o.push.apply(o,l.getClientRects())}else s=S(s),o.push.apply(o,s.getClientRects());return!1}Ir.prototype.getRootNode=function(s){var o=b(this._fragmentFiber);return o===null?this:S(o).getRootNode(s)},Ir.prototype.compareDocumentPosition=function(s){var o=b(this._fragmentFiber);if(o===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var l=[];p(this._fragmentFiber.child,!1,B0,l,void 0,void 0);var d=S(o);if(l.length===0){if(l=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&&(l=o)}o=this._fragmentFiber;var y=d=l.compareDocumentPosition(s);return l===s?y=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(l=w(o)[1],l===null?y=Node.DOCUMENT_POSITION_PRECEDING:(s=S(l).compareDocumentPosition(s),y=s===0||s&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),y|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}o=S(l[0]),y=S(l[l.length-1]);var j=v(this._fragmentFiber)?o.parentElement:d;if(j==null)return Node.DOCUMENT_POSITION_DISCONNECTED;d=j.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY,j=j.compareDocumentPosition(y)&Node.DOCUMENT_POSITION_CONTAINED_BY;var I=o.compareDocumentPosition(s),Z=y.compareDocumentPosition(s),me=I&Node.DOCUMENT_POSITION_CONTAINED_BY||Z&Node.DOCUMENT_POSITION_CONTAINED_BY;return Z=d&&j&&I&Node.DOCUMENT_POSITION_FOLLOWING&&Z&Node.DOCUMENT_POSITION_PRECEDING,o=d&&o===s||j&&y===s||me||Z?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&o===s||!j&&y===s?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:I,o&Node.DOCUMENT_POSITION_DISCONNECTED||o&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||QI(o,this._fragmentFiber,l[0],l[l.length-1],s)?o:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function QI(s,o,l,d,y){var j=So(y);if(s&Node.DOCUMENT_POSITION_CONTAINED_BY){if(l=!!j)e:{for(;j!==null;){if(j.tag===7&&(j===o||j.alternate===o)){l=!0;break e}j=j.return}l=!1}return l}if(s&Node.DOCUMENT_POSITION_CONTAINS){if(j===null)return j=y.ownerDocument,y===j||y===j.documentElement||y===j.body;e:{for(j=o,o=b(o);j!==null;){if(!(j.tag!==5&&j.tag!==3&&j.tag!==27||j!==o&&j.alternate!==o)){j=!0;break e}j=j.return}j=!1}return j}return s&Node.DOCUMENT_POSITION_PRECEDING?((o=!!j)&&!(o=j===l)&&(o=A(l,j,M),o===null?o=!1:(p(o,!0,T,j,l),j=N,N=null,o=j!==null)),o):s&Node.DOCUMENT_POSITION_FOLLOWING?((o=!!j)&&!(o=j===d)&&(o=A(d,j,M),o===null?o=!1:(p(o,!0,R,j,d),j=N,E=N=null,o=j!==null)),o):!1}function xC(s,o){var l=s.ownerDocument.createRange();l.selectNodeContents(s),s=l.getBoundingClientRect(),window.scrollTo(window.scrollX+s.left,o?window.scrollY+s.top:window.scrollY+s.bottom-window.innerHeight)}Ir.prototype.scrollIntoView=function(s){if(typeof s=="object")throw Error(a(566));var o=[];p(this._fragmentFiber.child,!1,B0,o,void 0,void 0);var l=s!==!1;if(o.length===0){var d=w(this._fragmentFiber);if(d=l?d[1]||d[0]||b(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){s=S(d),xC(s,l);return}if(d=S(d),d.nodeType!==9){if(d.nodeType===11){l="host"in d?d.host:null,l!==null&&l.scrollIntoView(s);return}d.scrollIntoView(s)}}for(d=l?o.length-1:0;d!==(l?-1:o.length);){var y=o[d];y.tag===6?(y=S(y),xC(y,l)):S(y).scrollIntoView(s),d+=l?-1:1}};function ZI(s,o){return s=S(s),bC(s,o),!1}function bC(s,o){s.reactFragments==null&&(s.reactFragments=new Set),s.reactFragments.add(o)}function vC(s,o){var l=o._eventListeners;if(l!==null)for(var d=0;d<l.length;d++){var y=l[d];s.addEventListener(y.type,y.attachedListener,Zc(y.optionsOrUseCapture))}s.nodeType!==3&&(l=o._observers,l!==null&&l.forEach(function(j){for(var I=0,Z=0;Z<Ro.length;Z++){var me=Ro[Z];(me.fragmentInstance!==o||me.observer!==j||me.instance!==s)&&(Ro[I++]=me)}Ro.length=I,j.observe(s)}),bC(s,o))}function JI(s,o){var l=o._eventListeners;if(l!==null)for(var d=0;d<l.length;d++){var y=l[d];s.removeEventListener(y.type,y.attachedListener,Zc(y.optionsOrUseCapture))}s.nodeType!==3&&(l=o._observers,l!==null&&l.forEach(function(j){typeof j.rootMargin=="string"?XI(o,j,s):j.unobserve(s)}),s.reactFragments!=null&&s.reactFragments.delete(o))}function U0(s){var o=s.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var l=o;switch(o=o.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":U0(l),vc(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function eP(s,o,l,d){for(;s.nodeType===1;){var y=l;if(s.nodeName.toLowerCase()!==o.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[cl])switch(o){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(j=s.getAttribute("rel"),j==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(j!==y.rel||s.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||s.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||s.getAttribute("title")!==(y.title==null?null:y.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(j=s.getAttribute("src"),(j!==(y.src==null?null:y.src)||s.getAttribute("type")!==(y.type==null?null:y.type)||s.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&j&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(o==="input"&&s.type==="hidden"){var j=y.name==null?null:""+y.name;if(y.type==="hidden"&&s.getAttribute("name")===j)return s}else return s;if(s=oo(s.nextSibling),s===null)break}return null}function tP(s,o,l){if(o==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=oo(s.nextSibling),s===null))return null;return s}function yC(s,o){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=oo(s.nextSibling),s===null))return null;return s}function H0(s){return s.data==="$?"||s.data==="$~"}function F0(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function nP(s,o){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=o;else if(s.data!=="$?"||l.readyState!=="loading")o();else{var d=function(){o(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function oo(s){for(;s!=null;s=s.nextSibling){var o=s.nodeType;if(o===1||o===3)break;if(o===8){if(o=s.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return s}var G0=null;function wC(s){s=s.nextSibling;for(var o=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(o===0)return oo(s.nextSibling);o--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||o++}s=s.nextSibling}return null}function jC(s){s=s.previousSibling;for(var o=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(o===0)return s;o--}else l!=="/$"&&l!=="/&"||o++}s=s.previousSibling}return null}function sP(s,o){function l(){d=!0}if(s.ownerDocument.activeElement===s)return!0;var d=!1;try{s.ownerDocument.addEventListener("focus",l,!0),(s.focus||HTMLElement.prototype.focus).call(s,o)}finally{s.ownerDocument.removeEventListener("focus",l,!0)}return d}function rP(s){lC(function(){lC(function(o){return s(o)})})}function SC(s,o,l){switch(o=Rd(l),s){case"html":if(s=o.documentElement,!s)throw Error(a(452));return s;case"head":if(s=o.head,!s)throw Error(a(453));return s;case"body":if(s=o.body,!s)throw Error(a(454));return s;default:throw Error(a(451))}}function NC(s,o,l){for(var d in l){var y=l[d];l.hasOwnProperty(d)&&y!=null&&yn(s,o,d,null,DI,y)}l.dangerouslySetInnerHTML!=null&&(s.textContent=""),s.onclick===er&&(s.onclick=null),vc(s)}function q0(s){for(var o=s.attributes;o.length;)s.removeAttributeNode(o[0]);vc(s)}var ao=new Map,CC=new Set;function Ad(s){if(typeof s.getRootNode=="function"){var o=s.getRootNode();if(o.nodeType===9||o.nodeType===11)return o}return s.nodeType===9?s:s.ownerDocument}var Ia=ue.d;ue.d={f:oP,r:aP,D:iP,C:lP,L:cP,m:uP,X:fP,S:dP,M:hP};function oP(){var s=Ia.f(),o=dm();return s||o}function aP(s){var o=ul(s);o!==null&&o.tag===5&&o.type==="form"?TS(o):Ia.r(s)}var Jc=typeof document>"u"?null:document;function kC(s,o,l){var d=Jc;if(d&&typeof o=="string"&&o){var y=_n(o);y='link[rel="'+s+'"][href="'+y+'"]',typeof l=="string"&&(y+='[crossorigin="'+l+'"]'),CC.has(y)||(CC.add(y),s={rel:s,crossOrigin:l,href:o},d.querySelector(y)===null&&(o=d.createElement("link"),$s(o,"link",s),qe(o),d.head.appendChild(o)))}}function iP(s){Ia.D(s),kC("dns-prefetch",s,null)}function lP(s,o){Ia.C(s,o),kC("preconnect",s,o)}function cP(s,o,l){Ia.L(s,o,l);var d=Jc;if(d&&s&&o){var y='link[rel="preload"][as="'+_n(o)+'"]';o==="image"&&l&&l.imageSrcSet?(y+='[imagesrcset="'+_n(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(y+='[imagesizes="'+_n(l.imageSizes)+'"]')):y+='[href="'+_n(s)+'"]';var j=y;switch(o){case"style":j=eu(s);break;case"script":j=tu(s)}if(!(ao.has(j)||(s=k({rel:"preload",href:o==="image"&&l&&l.imageSrcSet?void 0:s,as:o},l),ao.set(j,s),d.querySelector(y)!==null||o==="style"&&d.querySelector(Md(j))||o==="script"&&d.querySelector(Od(j))))){var I=d.createElement("link");$s(I,"link",s),o==="style"&&(I[bc]=!0,I.onload=I.onerror=function(){bt(I)}),qe(I),d.head.appendChild(I)}}}function uP(s,o){Ia.m(s,o);var l=Jc;if(l&&s){var d=o&&typeof o.as=="string"?o.as:"script",y='link[rel="modulepreload"][as="'+_n(d)+'"][href="'+_n(s)+'"]',j=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=tu(s)}if(!ao.has(j)&&(s=k({rel:"modulepreload",href:s},o),ao.set(j,s),l.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Od(j)))return}d=l.createElement("link"),$s(d,"link",s),qe(d),l.head.appendChild(d)}}}function dP(s,o,l){Ia.S(s,o,l);var d=Jc;if(d&&s){var y=Ge(d).hoistableStyles,j=eu(s);o=o||"default";var I=y.get(j);if(!I){var Z={loading:0,preload:null};if(I=d.querySelector(Md(j)))Z.loading=5;else{s=k({rel:"stylesheet",href:s,"data-precedence":o},l),(l=ao.get(j))&&Y0(s,l);var me=I=d.createElement("link");qe(me),$s(me,"link",s),me._p=new Promise(function(Ce,ze){me.onload=Ce,me.onerror=ze}),me.addEventListener("load",function(){Z.loading|=1}),me.addEventListener("error",function(){Z.loading|=2}),Z.loading|=4,bm(I,o,d)}I={type:"stylesheet",instance:I,count:1,state:Z},y.set(j,I)}}}function fP(s,o){Ia.X(s,o);var l=Jc;if(l&&s){var d=Ge(l).hoistableScripts,y=tu(s),j=d.get(y);j||(j=l.querySelector(Od(y)),j||(s=k({src:s,async:!0},o),(o=ao.get(y))&&K0(s,o),j=l.createElement("script"),qe(j),$s(j,"link",s),l.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},d.set(y,j))}}function hP(s,o){Ia.M(s,o);var l=Jc;if(l&&s){var d=Ge(l).hoistableScripts,y=tu(s),j=d.get(y);j||(j=l.querySelector(Od(y)),j||(s=k({src:s,async:!0,type:"module"},o),(o=ao.get(y))&&K0(s,o),j=l.createElement("script"),qe(j),$s(j,"link",s),l.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},d.set(y,j))}}function TC(s,o,l,d){var y=(y=ce.current)?Ad(y):null;if(!y)throw Error(a(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(l=eu(l.href),o=Ge(y).hoistableStyles,d=o.get(l),d||(d={type:"style",instance:null,count:0,state:null},o.set(l,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=eu(l.href);var j=Ge(y).hoistableStyles,I=j.get(s);if(I||(y=y.ownerDocument||y,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(s,I),(j=y.querySelector(Md(s)))?j._p||(I.instance=j,I.state.loading=5):(j=ao.get(s),j||(j={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},ao.set(s,j)),mP(y,s,j,I.state))),o&&d===null)throw Error(a(528,""));return I}if(o&&d!==null)throw Error(a(529,""));return null;case"script":return o=l.async,l=l.src,typeof l=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(l=tu(l),o=Ge(y).hoistableScripts,d=o.get(l),d||(d={type:"script",instance:null,count:0,state:null},o.set(l,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,s))}}function eu(s){return'href="'+_n(s)+'"'}function Md(s){return'link[rel="stylesheet"]['+s+"]"}function EC(s){return k({},s,{"data-precedence":s.precedence,precedence:null})}function mP(s,o,l,d){if(o=s.querySelector('link[rel="preload"][as="style"]['+o+"]")){if(o[bc]!==!0){d.loading=1;return}}else o=s.createElement("link"),o[bc]=!0,o.onload=o.onerror=bt.bind(null,o),$s(o,"link",l),qe(o),s.head.appendChild(o);d.preload=o,o.addEventListener("load",function(){return d.loading|=1}),o.addEventListener("error",function(){return d.loading|=2})}function tu(s){return'[src="'+_n(s)+'"]'}function Od(s){return"script[async]"+s}function RC(s,o,l){if(o.count++,o.instance===null)switch(o.type){case"style":var d=s.querySelector('style[data-href~="'+_n(l.href)+'"]');if(d)return o.instance=d,qe(d),d;var y=k({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),qe(d),$s(d,"style",y),bm(d,l.precedence,s),o.instance=d;case"stylesheet":y=eu(l.href);var j=s.querySelector(Md(y));if(j)return o.state.loading|=4,o.instance=j,qe(j),j;d=EC(l),(y=ao.get(y))&&Y0(d,y),j=(s.ownerDocument||s).createElement("link"),qe(j);var I=j;return I._p=new Promise(function(Z,me){I.onload=Z,I.onerror=me}),$s(j,"link",d),o.state.loading|=4,bm(j,l.precedence,s),o.instance=j;case"script":return j=tu(l.src),(y=s.querySelector(Od(j)))?(o.instance=y,qe(y),y):(d=l,(y=ao.get(j))&&(d=k({},l),K0(d,y)),s=s.ownerDocument||s,y=s.createElement("script"),qe(y),$s(y,"link",d),s.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,bm(d,l.precedence,s));return o.instance}function bm(s,o,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,j=y,I=0;I<d.length;I++){var Z=d[I];if(Z.dataset.precedence===o)j=Z;else if(j!==y)break}j?j.parentNode.insertBefore(s,j.nextSibling):(o=l.nodeType===9?l.head:l,o.insertBefore(s,o.firstChild))}function Y0(s,o){s.crossOrigin==null&&(s.crossOrigin=o.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=o.referrerPolicy),s.title==null&&(s.title=o.title)}function K0(s,o){s.crossOrigin==null&&(s.crossOrigin=o.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=o.referrerPolicy),s.integrity==null&&(s.integrity=o.integrity)}var vm=null;function AC(s,o,l){if(vm===null){var d=new Map,y=vm=new Map;y.set(l,d)}else y=vm,d=y.get(l),d||(d=new Map,y.set(l,d));if(d.has(s))return d;for(d.set(s,null),l=l.getElementsByTagName(s),y=0;y<l.length;y++){var j=l[y];if(!(j[cl]||j[Un]||s==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var I=j.getAttribute(o)||"";I=s+I;var Z=d.get(I);Z?Z.push(j):d.set(I,[j])}}return d}function X0(s,o,l){s=s.ownerDocument||s,s.head.insertBefore(l,o==="title"?s.querySelector("head > title"):null)}function pP(s,o,l){if(l===1||o.itemProp!=null)return!1;switch(s){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 s=o.disabled,typeof o.precedence=="string"&&s==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 MC(s,o){return s==="img"&&o.src!=null&&o.src!==""&&o.onLoad==null&&o.loading!=="lazy"}function OC(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function DC(s){return(s.width||100)*(s.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function zC(s,o){typeof o.decode=="function"&&(s.imgCount++,o.complete||(s.imgBytes+=DC(o),s.suspenseyImages.push(o)),s=bP.bind(s),o.decode().then(s,s))}function gP(s,o,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var y=eu(d.href),j=o.querySelector(Md(y));if(j){o=j._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(s.count++,s=Dd.bind(s),o.then(s,s)),l.state.loading|=4,l.instance=j,qe(j);return}j=o.ownerDocument||o,d=EC(d),(y=ao.get(y))&&Y0(d,y),j=j.createElement("link"),qe(j);var I=j;I._p=new Promise(function(Z,me){I.onload=Z,I.onerror=me}),$s(j,"link",d),l.instance=j}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,o),(o=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=Dd.bind(s),o.addEventListener("load",l),o.addEventListener("error",l))}}var ym=0;function xP(s,o){return s.stylesheets&&s.count===0&&jm(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var d=setTimeout(function(){if(s.stylesheets&&jm(s,s.stylesheets),s.unsuspend){var j=s.unsuspend;s.unsuspend=null,j()}},6e4+o);0<s.imgBytes&&ym===0&&(ym=62500*II());var y=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&jm(s,s.stylesheets),s.unsuspend)){var j=s.unsuspend;s.unsuspend=null,j()}},(s.imgBytes>ym?50:800)+o);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function IC(s){if(s.count===0&&(s.imgCount===0||!s.waitingForImages)){if(s.stylesheets)jm(s,s.stylesheets);else if(s.unsuspend){var o=s.unsuspend;s.unsuspend=null,o()}}}function Dd(){this.count--,IC(this)}function bP(){this.imgCount--,IC(this)}var wm=null;function jm(s,o){s.stylesheets=null,s.unsuspend!==null&&(s.count++,wm=new Map,o.forEach(vP,s),wm=null,Dd.call(s))}function vP(s,o){if(!(o.state.loading&4)){var l=wm.get(s);if(l)var d=l.get(null);else{l=new Map,wm.set(s,l);for(var y=s.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<y.length;j++){var I=y[j];(I.nodeName==="LINK"||I.getAttribute("media")!=="not all")&&(l.set(I.dataset.precedence,I),d=I)}d&&l.set(null,d)}y=o.instance,I=y.getAttribute("data-precedence"),j=l.get(I)||d,j===d&&l.set(null,y),l.set(I,y),this.count++,d=Dd.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),j?j.parentNode.insertBefore(y,j.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(y,s.firstChild)),o.state.loading|=4}}var nu={$$typeof:V,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function yP(s,o,l,d,y,j,I,Z,me){this.tag=1,this.containerInfo=s,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=Wt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wt(0),this.hiddenUpdates=Wt(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=j,this.onRecoverableError=I,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=me,this.transitionTypes=null,this.incompleteTransitions=new Map}function PC(s,o,l,d,y,j,I,Z,me,Ce,ze,$e){return s=new yP(s,o,l,I,me,Ce,ze,$e,Z),o=1,j===!0&&(o|=24),j=dr(3,null,null,o),s.current=j,j.stateNode=s,o=ub(),o.refCount++,s.pooledCache=o,o.refCount++,j.memoizedState={element:d,isDehydrated:l,cache:o},mb(j),s}function _C(s){return s?(s=Ec,s):Ec}function LC(s,o,l,d,y,j){y=_C(y),d.context===null?d.context=y:d.pendingContext=y,d=xi(o),d.payload={element:l},j=j===void 0?null:j,j!==null&&(d.callback=j),l=bi(s,d,o),l!==null&&(pr(l,s,o),ud(l,s,o))}function $C(s,o){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<o?l:o}}function W0(s,o){$C(s,o),(s=s.alternate)&&$C(s,o)}function BC(s){if(s.tag===13||s.tag===31){var o=bl(s,67108864);o!==null&&pr(o,s,67108864),W0(s,67108864)}}function VC(s){if(s.tag===13||s.tag===31){var o=zr();o=cr(o);var l=bl(s,o);l!==null&&pr(l,s,o),W0(s,o)}}var su=!0;function wP(s,o,l,d){var y=ae.T;ae.T=null;var j=ue.p;try{ue.p=2,Q0(s,o,l,d)}finally{ue.p=j,ae.T=y}}function jP(s,o,l,d){var y=ae.T;ae.T=null;var j=ue.p;try{ue.p=8,Q0(s,o,l,d)}finally{ue.p=j,ae.T=y}}function Q0(s,o,l,d){if(su){var y=Z0(d);if(y===null)O0(s,o,d,Sm,l),HC(s,d);else if(NP(y,s,o,l,d))d.stopPropagation();else if(HC(s,d),o&4&&-1<SP.indexOf(s)){for(;y!==null;){var j=ul(y);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var I=Kn(j.pendingLanes);if(I!==0){var Z=j;for(Z.pendingLanes|=2,Z.entangledLanes|=2;I;){var me=1<<31-it(I);Z.entanglements[1]|=me,I&=~me}Wo(j),(dn&6)===0&&(lm=ve()+500,kd(0))}}break;case 31:case 13:Z=bl(j,2),Z!==null&&pr(Z,j,2),dm(),W0(j,2)}if(j=Z0(d),j===null&&O0(s,o,d,Sm,l),j===y)break;y=j}y!==null&&d.stopPropagation()}else O0(s,o,d,null,l)}}function Z0(s){return s=hl(s),J0(s)}var Sm=null;function J0(s){if(Sm=null,s=So(s),s!==null){var o=c(s);if(o===null)s=null;else{var l=o.tag;if(l===13){if(s=u(o),s!==null)return s;s=null}else if(l===31){if(s=f(o),s!==null)return s;s=null}else if(l===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;s=null}else o!==s&&(s=null)}}return Sm=s,null}function UC(s){switch(s){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(Ue()){case Qe:return 2;case xt:return 8;case Ke:case Be:return 32;case jt:return 268435456;default:return 32}default:return 32}}var ev=!1,Ai=null,Mi=null,Oi=null,zd=new Map,Id=new Map,Di=[],SP="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 HC(s,o){switch(s){case"focusin":case"focusout":Ai=null;break;case"dragenter":case"dragleave":Mi=null;break;case"mouseover":case"mouseout":Oi=null;break;case"pointerover":case"pointerout":zd.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Id.delete(o.pointerId)}}function Pd(s,o,l,d,y,j){return s===null||s.nativeEvent!==j?(s={blockedOn:o,domEventName:l,eventSystemFlags:d,nativeEvent:j,targetContainers:[y]},o!==null&&(o=ul(o),o!==null&&BC(o)),s):(s.eventSystemFlags|=d,o=s.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),s)}function NP(s,o,l,d,y){switch(o){case"focusin":return Ai=Pd(Ai,s,o,l,d,y),!0;case"dragenter":return Mi=Pd(Mi,s,o,l,d,y),!0;case"mouseover":return Oi=Pd(Oi,s,o,l,d,y),!0;case"pointerover":var j=y.pointerId;return zd.set(j,Pd(zd.get(j)||null,s,o,l,d,y)),!0;case"gotpointercapture":return j=y.pointerId,Id.set(j,Pd(Id.get(j)||null,s,o,l,d,y)),!0}return!1}function FC(s){var o=So(s.target);if(o!==null){var l=c(o);if(l!==null){if(o=l.tag,o===13){if(o=u(l),o!==null){s.blockedOn=o,Ms(s.priority,function(){VC(l)});return}}else if(o===31){if(o=f(l),o!==null){s.blockedOn=o,Ms(s.priority,function(){VC(l)});return}}else if(o===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Nm(s){if(s.blockedOn!==null)return!1;for(var o=s.targetContainers;0<o.length;){var l=Z0(s.nativeEvent);if(l===null){l=s.nativeEvent;var d=new l.constructor(l.type,l);fl=d,l.target.dispatchEvent(d),fl=null}else return o=ul(l),o!==null&&BC(o),s.blockedOn=l,!1;o.shift()}return!0}function GC(s,o,l){Nm(s)&&l.delete(o)}function CP(){ev=!1,Ai!==null&&Nm(Ai)&&(Ai=null),Mi!==null&&Nm(Mi)&&(Mi=null),Oi!==null&&Nm(Oi)&&(Oi=null),zd.forEach(GC),Id.forEach(GC)}function Cm(s,o){s.blockedOn===o&&(s.blockedOn=null,ev||(ev=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,CP)))}var km=null;function qC(s){km!==s&&(km=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){km===s&&(km=null);for(var o=0;o<s.length;o+=3){var l=s[o],d=s[o+1],y=s[o+2];if(typeof d!="function"){if(J0(d||l)===null)continue;break}var j=ul(l);j!==null&&(s.splice(o,3),o-=3,Ib(j,{pending:!0,data:y,method:l.method,action:d},d,y))}}))}function ru(s){function o(me){return Cm(me,s)}Ai!==null&&Cm(Ai,s),Mi!==null&&Cm(Mi,s),Oi!==null&&Cm(Oi,s),zd.forEach(o),Id.forEach(o);for(var l=0;l<Di.length;l++){var d=Di[l];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Di.length&&(l=Di[0],l.blockedOn===null);)FC(l),l.blockedOn===null&&Di.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var y=l[d],j=l[d+1],I=y[Os]||null;if(typeof j=="function")I||qC(l);else if(I){var Z=null;if(j&&j.hasAttribute("formAction")){if(y=j,I=j[Os]||null)Z=I.formAction;else if(J0(y)!==null)continue}else Z=I.action;typeof Z=="function"?l[d+1]=Z:(l.splice(d,3),d-=3),qC(l)}}}function YC(){function s(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(I){return y=I})},focusReset:"manual",scroll:"manual"})}function o(){y!==null&&(y(),y=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),y!==null&&(y(),y=null)}}}function tv(s){this._internalRoot=s}Tm.prototype.render=tv.prototype.render=function(s){var o=this._internalRoot;if(o===null)throw Error(a(409));var l=o.current,d=zr();LC(l,d,s,o,null,null)},Tm.prototype.unmount=tv.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var o=s.containerInfo;LC(s.current,2,null,s,null,null),dm(),o[Nr]=null}};function Tm(s){this._internalRoot=s}Tm.prototype.unstable_scheduleHydration=function(s){if(s){var o=ds();s={blockedOn:null,target:s,priority:o};for(var l=0;l<Di.length&&o!==0&&o<Di[l].priority;l++);Di.splice(l,0,s),l===0&&FC(s)}};var KC=t.version;if(KC!=="19.3.0")throw Error(a(527,KC,"19.3.0"));ue.findDOMNode=function(s){var o=s._reactInternals;if(o===void 0)throw typeof s.render=="function"?Error(a(188)):(s=Object.keys(s).join(","),Error(a(268,s)));return s=h(o),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var kP={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:ae,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Em=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Em.isDisabled&&Em.supportsFiber)try{Se=Em.inject(kP),Ye=Em}catch{}}return Ld.createRoot=function(s,o){if(!i(s))throw Error(a(299));var l=!1,d="",y=_S,j=LS,I=$S;return o!=null&&(o.unstable_strictMode===!0&&(l=!0),o.identifierPrefix!==void 0&&(d=o.identifierPrefix),o.onUncaughtError!==void 0&&(y=o.onUncaughtError),o.onCaughtError!==void 0&&(j=o.onCaughtError),o.onRecoverableError!==void 0&&(I=o.onRecoverableError)),o=PC(s,1,!1,null,null,l,d,null,y,j,I,YC),s[Nr]=o.current,M0(s),new tv(o)},Ld.hydrateRoot=function(s,o,l){if(!i(s))throw Error(a(299));var d=!1,y="",j=_S,I=LS,Z=$S,me=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(y=l.identifierPrefix),l.onUncaughtError!==void 0&&(j=l.onUncaughtError),l.onCaughtError!==void 0&&(I=l.onCaughtError),l.onRecoverableError!==void 0&&(Z=l.onRecoverableError),l.formState!==void 0&&(me=l.formState)),o=PC(s,1,!0,o,l??null,d,y,me,j,I,Z,YC),o.context=_C(null),l=o.current,d=zr(),d=cr(d),y=xi(d),y.callback=null,bi(l,y,d),l=d,o.current.lanes=l,un(o,l),Wo(o),s[Nr]=o.current,M0(s),new Tm(o)},Ld.version="19.3.0",Ld}var ok;function KP(){if(ok)return ov.exports;ok=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(),ov.exports=YP(),ov.exports}var XP=KP();const WP="modulepreload",QP=function(e){return"/"+e},ak={},gy=function(t,r,a){let i=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"));i=u(r.map(h=>{if(h=QP(h),h in ak)return;ak[h]=!0;const g=h.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":WP,g||(b.as="script"),b.crossOrigin="",b.href=h,m&&b.setAttribute("nonce",m),document.head.appendChild(b),g)return new Promise((v,w)=>{b.addEventListener("load",v),b.addEventListener("error",()=>w(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 i.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},ZP="openrod.compute-target";function JP(e,t){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");return`${e==="cloud"?"/api/remote/os":"/api/os"}${t}`}let GR="local";const qR=()=>GR;function YR(e){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");GR=e}function e6(e,t){const r=t??null;return{uid:r,revision:e.revision+(e.uid&&e.uid!==r?1:0)}}let KR=null;const XR=()=>KR;function ik(e){KR=typeof e=="string"&&/^[a-f0-9]{16}$/.test(e)?e:null}var lk={projectToken:"phc_t8z9eNB6eJABMR9iLkDbqAZH5wFh7wmjjDqEpAxnPPAU",host:"https://us.i.posthog.com",version:"0.2.0-rc.4",environment:"production",enabled:!0};const t6=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i,ck="openrod.usage.v1",$d="openrod.usage-id.v1",cv="openrod.usage-session.v1",Rm="openrod.terminal-flows.v1",Ks=(...e)=>t=>e.includes(t)?t:void 0,cu=e=>typeof e=="string"&&t6.test(e)?e:void 0,Ui=e=>Number.isFinite(e)&&e>=0?Math.min(Math.round(e),864e5):void 0,uv=e=>typeof e=="boolean"?e:void 0,L1=Ks("sandboxes","activity","groups","egress","ingress","secrets","templates","setups","connections","terminal"),xy=Ks("gateway_connection","sandbox_creation","session_launch"),by=Ks("local","ssh","cloud","unknown"),uk=Ks("docker_missing","docker_unavailable","openshell_missing","gateway_unavailable","ssh_auth","host_key","runtime_missing","image_build","credentials_missing","setup_import","policy","file_seed","timeout","connection_lost","unknown"),dv={flow:xy,flow_id:cu,attempt:Ui,location_type:by,launch_target:Ks("browser","terminal","vscode","cursor")},n6=e=>typeof e=="string"?e.trim().slice(0,2e3):void 0,s6=e=>Array.isArray(e)?[...new Set(e.filter(t=>["claude","codex","cursor","pi","antigravity","opencode","aider","copilot","kiro","droid"].includes(t)))].slice(0,12):void 0,dk={creation_mode:Ks("quick","template"),file_source:Ks("empty","folder","repo"),agent_ids:s6,setup_count:Ui,provider_count:Ui,group_count:Ui},fk={telemetry_declined:{},console_opened:{gateway_state:Ks("available","setup_required","unavailable"),first_observed_visit:uv,connection_method:Ks("automatic","manual","existing","unknown")},view_opened:{previous_view:L1},flow_started:{...dv,...dk},flow_step_changed:{...dv,step:Ks("location","configuration","validation","host_selection","connecting","needs_docker","needs_runtime","preparing_tools","building_image","creating","requesting"),state:Ks("entered","blocked"),error_category:uk},flow_finished:{...dv,...dk,outcome:Ks("connected","created","live","handoff_requested","failed","cancelled"),duration_ms:Ui,start_observed:uv,error_category:uk},sandbox_ready:{flow_id:cu,duration_ms:Ui,location_type:by},feature_used:{feature:Ks("template","setup","network","group","activity","files","sandbox"),action:Ks("built","imported","activated","rule_saved","membership_saved","filter_applied","exported","uploaded","started","stopped","deleted"),count:Ui,location_type:by},feedback_submitted:{prompt:Ks("general"),category:Ks("general"),text:n6,feedback_only:uv}};function Am(e,t={}){if(!Object.hasOwn(fk,e))return null;if(e==="telemetry_declined")return{};const r={};for(const[a,i]of Object.entries({view:L1,...fk[e]})){const c=i(t[a]);c!==void 0&&(r[a]=c)}return r}const r6=[[/host key/i,"host_key"],[/permission denied|publickey|authentication failed/i,"ssh_auth"],[/docker (engine )?is missing|docker isn.t installed|install docker/i,"docker_missing"],[/docker isn.t running|docker daemon|reach docker|docker.*not available/i,"docker_unavailable"],[/openshell (cli )?is not installed|openshell isn.t installed/i,"openshell_missing"],[/runtime (image|package)|sandbox runtime/i,"runtime_missing"],[/timed out/i,"timeout"],[/gateway/i,"gateway_unavailable"]];function Cu(e){if((e==null?void 0:e.name)==="TimeoutError"||(e==null?void 0:e.status)===504)return"timeout";if((e==null?void 0:e.code)==="GATEWAY_DOCKER_MISMATCH")return"docker_unavailable";const t=typeof(e==null?void 0:e.message)=="string"?e.message:"";for(const[r,a]of r6)if(r.test(t))return a;return(e==null?void 0:e.name)==="TypeError"?"connection_lost":(e==null?void 0:e.status)===502||(e==null?void 0:e.status)===503?"gateway_unavailable":"unknown"}function o6({getStorage:e=()=>window.localStorage,getLocation:t=()=>window.location.href,randomUUID:r=()=>crypto.randomUUID(),now:a=()=>Date.now(),fetch:i=(...h)=>fetch(...h),setTimer:c=setTimeout,clearTimer:u=clearTimeout,replaceLocation:f=h=>window.history.replaceState(window.history.state,"",h),config:m=typeof lk>"u"?{}:lk}={}){let h=!1,g=!1,p=!1,b,v,w=!1,C;const S=m.host==="https://eu.i.posthog.com"?"EU":"US";let N=Object.freeze({available:!1,sharing:null,destination:S});const E=new Set,T=new Map,R=new Set,M=new Map,A=new Map;let k=[],O=0;const D=()=>e(),_=(oe,pe)=>{try{return oe()}catch{return pe}};function H(){O++;for(const[oe,pe]of T)oe.abort(),u(pe);T.clear(),R.clear(),M.clear(),A.clear(),k=[],w=!1,v=void 0,C=void 0}function G(){const oe=new URL(t());return!oe.searchParams.has("token")&&!oe.searchParams.has("handoff")&&!/^#local-(connect|return)=/.test(oe.hash)&&!(m.environment==="development"&&oe.searchParams.has("fleet"))}function B(){return _(()=>h&&g&&!p&&m.enabled===!0&&/^phc_[a-zA-Z0-9]+$/.test(m.projectToken??"")&&["https://us.i.posthog.com","https://eu.i.posthog.com"].includes(m.host)&&G(),!1)}function P(){_(()=>{let oe=null;try{const xe=D().getItem(ck);oe=xe==="yes"?!0:xe==="no"?!1:null}catch{p=!0,H()}oe!==!0&&N.sharing===!0&&H();const pe={available:B(),sharing:oe,destination:S};if(Object.keys(pe).some(xe=>pe[xe]!==N[xe])){N=Object.freeze(pe);for(const xe of E)_(xe)}})}function V({enabled:oe=!1,mode:pe="local"}={}){_(()=>{h=pe==="local",g=oe,(!h||!oe)&&H(),P()})}function q(oe){_(()=>{try{if(D().setItem(ck,oe?"yes":"no"),!oe){for(const pe of[$d,cv,Rm])D().removeItem(pe);H()}}catch{p=!0,H()}P()})}function W(){return _(()=>{if(P(),N.sharing===!1)return!1;const oe=N.available;return q(!1),oe&&N.sharing===!1&&J("telemetry_declined",{},{explicitDecline:!0})},!1)}function K(){const oe=D();let pe=cu(oe.getItem($d)),xe;C??(C=!pe),pe||(pe=r(),oe.setItem($d,pe));try{xe=JSON.parse(oe.getItem(cv))}catch{}return(!cu(xe==null?void 0:xe.id)||!Number.isFinite(xe==null?void 0:xe.at)||a()-xe.at>18e5)&&(xe={id:r()}),oe.setItem(cv,JSON.stringify({id:xe.id,at:a()})),{id:pe,session:xe.id,first:C}}function J(oe,pe={},{explicitFeedback:xe=!1,explicitDecline:je=!1}={}){return _(()=>{P();const Ie=je&&oe==="telemetry_declined"&&N.sharing===!1;if(oe==="telemetry_declined"&&!Ie||!N.available||N.sharing!==!0&&!Ie&&!(xe&&oe==="feedback_submitted"))return!1;const ce=Am(oe,pe);if(!ce)return!1;const Te=N.sharing===!0;let re;try{re=Te?K():{id:r()}}catch{return p=!0,H(),P(),!1}if(k=k.filter(he=>a()-he<6e4),T.size>=6||k.length>=120)return!1;const fe=new AbortController,Re=c(()=>{fe.abort(),T.delete(fe)},3e3);T.set(fe,Re),k.push(a());const Oe={api_key:m.projectToken,event:oe,distinct_id:re.id,timestamp:new Date(a()).toISOString(),properties:{schema_version:1,app_version:m.version,environment:m.environment,...Te&&re.session?{$session_id:re.session}:{},...Te&&b?{view:b}:{},...ce,$process_person_profile:!1,...Te?{}:{$geoip_disable:!0},...oe==="console_opened"?{first_observed_visit:re.first}:{},...xe?{feedback_only:!Te}:{}}},ke=()=>{u(Re),T.delete(fe)};oe==="console_opened"&&(C=!1);try{Promise.resolve(i(`${m.host}/i/v0/e/`,{method:"POST",headers:{"content-type":"text/plain"},body:JSON.stringify(Oe),signal:fe.signal,credentials:"omit",referrerPolicy:"no-referrer",cache:"no-store",redirect:"error",keepalive:!0})).then(ke,ke)}catch{ke()}return!0},!1)}function z(oe){_(()=>{w||!["live","setup-required","gateway-down"].includes(oe)||J("console_opened",{gateway_state:oe==="live"?"available":oe==="setup-required"?"setup_required":"unavailable",connection_method:"existing"})&&(w=!0)})}function L(oe){_(()=>{b=L1(oe),b&&b!==v&&J("view_opened",{previous_view:v})&&(v=b)})}function X(oe,pe={},xe=null){return _(()=>{if(P(),!N.available||N.sharing!==!0||!xy(oe))return null;const je=K().id;((xe==null?void 0:xe.generation)!==O||(xe==null?void 0:xe.installationId)!==je||(xe==null?void 0:xe.flow)!==oe)&&(xe=null),xe&&xe.outcome!=="failed"&&xe.started!==null&&(xe.outcome||Y(xe,"cancelled"),xe=null);const Ie={generation:O,installationId:je,id:(xe==null?void 0:xe.id)??r(),flow:oe,attempt:((xe==null?void 0:xe.attempt)??0)+1,started:a(),properties:Am("flow_started",pe)};return J("flow_started",{...Ie.properties,flow:oe,flow_id:Ie.id,attempt:Ie.attempt}),F(Ie,oe==="session_launch"?"requesting":oe==="gateway_connection"?"connecting":"preparing_tools"),Ie},null)}function ee(oe,pe={}){return _(()=>(P(),!N.available||N.sharing!==!0||!xy(oe)?null:{generation:O,installationId:K().id,id:r(),flow:oe,attempt:0,started:null,properties:Am("flow_started",pe)}),null)}const $=oe=>oe&&oe.generation===O&&N.available&&N.sharing===!0&&cu(oe.installationId)&&oe.installationId===D().getItem($d),U=oe=>({...oe.properties,flow:oe.flow,flow_id:oe.id,attempt:oe.attempt});function F(oe,pe,xe="entered",je){_(()=>{if(P(),!$(oe))return;const Ie=`${oe.id}:${oe.attempt}`,ce=`${pe}:${xe}:${je}`;M.get(Ie)!==ce&&(M.size>=100&&M.delete(M.keys().next().value),M.set(Ie,ce),J("flow_step_changed",{...U(oe),step:pe,state:xe,error_category:je}))})}function Y(oe,pe,xe){_(()=>{if(P(),!$(oe))return;const je=`${oe.id}:${oe.attempt}`;R.has(je)||(R.size>=200&&R.delete(R.values().next().value),R.add(je),M.delete(je),oe.outcome=pe,J("flow_finished",{...U(oe),outcome:pe,start_observed:oe.started!==null,duration_ms:oe.started===null?void 0:a()-oe.started,error_category:xe}))})}function ne(oe){_(()=>{if(P(),!$(oe))return;const pe=`${oe.id}:ready`;R.has(pe)||(R.size>=200&&R.delete(R.values().next().value),R.add(pe),J("sandbox_ready",{flow_id:oe.id,duration_ms:a()-oe.started,location_type:oe.properties.location_type}))})}function te(oe){return J("feedback_submitted",oe,{explicitFeedback:!0})}function ye(oe,pe={}){_(()=>{const xe=X("session_launch",{...pe,launch_target:"browser"});if(P(),!$(xe))return;const je=new URL(oe.currentTarget.href),[Ie,ce=""]=je.hash.split("?"),Te=new URLSearchParams(ce);Te.set("analyticsFlow",xe.id),je.hash=`${Ie}?${Te}`;try{const re=ue();re.push(xe),D().setItem(Rm,JSON.stringify(re.slice(-20))),oe.currentTarget.href=je.href}catch{}})}function ae(oe,pe){try{D().setItem(Rm,JSON.stringify(oe.filter(xe=>xe.id!==pe)))}catch{}_(()=>{const xe=new URL(t()),[je,Ie=""]=xe.hash.split("?"),ce=new URLSearchParams(Ie);ce.delete("analyticsFlow"),xe.hash=ce.toString()?`${je}?${ce}`:je,f(xe.href)})}function ue(){let oe=[];try{oe=JSON.parse(D().getItem(Rm)||"[]")}catch{}return Array.isArray(oe)?oe.filter(pe=>cu(pe.id)&&pe.flow==="session_launch"&&Number.isFinite(pe.started)&&a()-pe.started<18e5).slice(-20):[]}function se(oe,pe){return _(()=>{if(P(),!N.available||N.sharing!==!0)return null;if(pe)return X("session_launch",oe,pe);const xe=new URLSearchParams(new URL(t()).hash.split("?")[1]).get("analyticsFlow"),je=K().id,Ie=ue(),ce=Ie.find(Te=>Te.id===xe&&Te.installationId===je);return xe&&ae(Ie,xe),ce?{generation:O,installationId:je,id:ce.id,flow:"session_launch",attempt:Ui(ce.attempt)??1,started:ce.started,properties:Am("flow_started",ce.properties)}:X("session_launch",{...oe,launch_target:"browser"})},null)}function Q(oe,pe){_(()=>{if(P(),!(!N.available||N.sharing!==!0)){if(oe.status==="ready"){J("feature_used",{feature:"template",action:"built",location_type:mf(pe)});return}oe.status==="building"&&(A.size>=100&&A.delete(A.keys().next().value),A.set(JSON.stringify([pe==null?void 0:pe.context,oe.name]),{installationId:K().id,startedAt:oe.startedAt,at:a(),location_type:mf(pe)}))}})}function ie(oe){_(()=>{var pe,xe;for(const je of oe){const Ie=JSON.stringify([(pe=je.location)==null?void 0:pe.context,je.name]),ce=A.get(Ie);if(ce){if(ce.installationId!==D().getItem($d)||a()-ce.at>18e5){A.delete(Ie);continue}je.startedAt&&je.startedAt!==ce.startedAt||((xe=je.location)==null?void 0:xe.connected)===!1||(je.status==="ready"?(A.delete(Ie),J("feature_used",{feature:"template",action:"built",location_type:ce.location_type})):je.status==="failed"&&A.delete(Ie))}}})}return{configure:V,setSharing:q,declineSharing:W,refresh:P,capture:J,observeConsole:z,observeView:L,startFlow:X,exploreFlow:ee,step:F,finishFlow:Y,ready:ne,templateStarted:Q,observeTemplates:ie,submitFeedback:te,terminalClick:ye,terminalFlow:se,subscribe:oe=>(E.add(oe),()=>E.delete(oe)),getSnapshot:()=>N,stop:()=>{h=!1,H(),P()}}}const en=o6(),mf=e=>(e==null?void 0:e.target)==="cloud"?"cloud":e!=null&&e.remote?"ssh":"local";function a6(e,t){if(t==="GET"||t===void 0)return;const a=[[/^\/setups\/save$/,"setup","imported"],[/^\/setups\/[^/]+\/enable$/,"setup","activated"],[/^\/egress\/policies$/,"network","rule_saved"],[/^\/org\/members$/,"group","membership_saved"],[/^\/files\/[^/]+\/uploads\/[^/]+\/commit$/,"files","uploaded"],[/^\/sandboxes\/[^/]+\/start$/,"sandbox","started"],[/^\/sandboxes\/[^/]+\/stop$/,"sandbox","stopped"],[/^\/sandboxes\/[^/]+\/delete$/,"sandbox","deleted"]].find(([i])=>i.test(e));a&&en.capture("feature_used",{feature:a[1],action:a[2]})}const $i="CONSOLE_TOKEN_REQUIRED";function lr(e,t,r=null,a=XR()){const i=()=>e??qR(),c=a;let u,f;const m=v=>JP(i(),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:{...i()==="cloud"&&c?{"x-openrod-local-owner":c}:{},...r?{"x-openshell-context":r,"x-openshell-location":"1"}:{}}}),w=await v.json();if(t==null||t.throwIfAborted(),w.code===$i?window.dispatchEvent(new Event($i)):(v.status===401||w.code==="CLOUD_OWNER_CHANGED")&&window.dispatchEvent(new Event("openrod-session-expired")),!v.ok)throw new Error(w.error??"Could not read gateway registrations.");return u??(u=JSON.stringify([w.gateway,w.workspace])),w}async function p(){return t==null||t.throwIfAborted(),r??(u||(f??(f=g().finally(()=>{f=null})),await f),u)}async function b(v,{method:w="GET",body:C,signal:S,scoped:N=!0,raw:E=!1}={}){const T=h(S);T==null||T.throwIfAborted();const R=N?await p():null;T==null||T.throwIfAborted();const M=await fetch(m(v),{method:w,signal:T,headers:{...i()==="cloud"&&c?{"x-openrod-local-owner":c}:{},...R?{"x-openshell-context":R}:{},...R&&r?{"x-openshell-location":"1"}:{},...w==="GET"?{}:{"content-type":E?"application/octet-stream":"application/json","x-openshell-console":"1"}},body:C===void 0?void 0:E?C:JSON.stringify(C)}),A=await M.json().catch(()=>({}));if(T==null||T.throwIfAborted(),A.code===$i?window.dispatchEvent(new Event($i)):(M.status===401||A.code==="CLOUD_OWNER_CHANGED")&&window.dispatchEvent(new Event("openrod-session-expired")),!M.ok)throw Object.assign(new Error(A.error??`Request failed (${M.status})`),{status:M.status,code:A.code,sandboxes:A.sandboxes,fix:A.fix});return a6(v,w),A}return{target:e,signal:t,path:m,owner:c,url:(v,w={})=>{const C=new URLSearchParams({...w,...i()==="cloud"&&c?{owner:c}:{}});return m(v)+(C.size?"?"+C:"")},forContext:v=>lr(e,t,v,c),inventory:v=>b("/inventory",{signal:v,scoped:!1}),context:g,contextKey:p,capabilities:()=>b("/capabilities",{scoped:!1}),importCapabilities:()=>b("/resource-imports/capabilities"),exportResources:v=>b("/resource-imports/export",{method:"POST",body:v}),planImport:v=>b("/resource-imports/plan",{method:"POST",body:v}),importJobs:()=>b("/resource-imports"),importJob:v=>b(`/resource-imports/${encodeURIComponent(v)}`),executeImport:v=>b(`/resource-imports/${encodeURIComponent(v)}/execute`,{method:"POST",body:{acknowledged:!0}}),retryImport:v=>b(`/resource-imports/${encodeURIComponent(v)}/retry`,{method:"POST",body:{acknowledged:!0}}),cancelImport:v=>b(`/resource-imports/${encodeURIComponent(v)}/cancel`,{method:"POST",body:{}}),connections:v=>b("/connections",{signal:v,scoped:!1}),connectionJob:(v,w)=>b(`/connections/jobs/${encodeURIComponent(v)}`,{signal:w,scoped:!1}),connect:v=>b("/connections/connect",{method:"POST",body:v,scoped:!1}),installConnectionDocker:v=>b(`/connections/jobs/${encodeURIComponent(v)}/docker`,{method:"POST",body:{approve:!0},scoped:!1}),installConnectionRuntime:v=>b(`/connections/jobs/${encodeURIComponent(v)}/install`,{method:"POST",body:{method:"download"},scoped:!1}),uploadConnectionPackage:(v,w)=>b(`/connections/jobs/${encodeURIComponent(v)}/package`,{method:"POST",body:w,raw:!0,scoped:!1}),scanSshHost:v=>b("/connections/hosts/scan",{method:"POST",body:v,scoped:!1}),addSshHost:v=>b("/connections/hosts",{method:"POST",body:{token:v},scoped:!1}),removeSshHost:v=>b("/connections/hosts/remove",{method:"POST",body:{alias:v},scoped:!1}),restoreSshHost:v=>b("/connections/hosts/restore",{method:"POST",body:{host:v},scoped:!1}),forgetRemote:()=>b("/connections/forget",{method:"POST",body:{},scoped:!1}),disconnectRemote:()=>b("/connections/disconnect",{method:"POST",body:{},scoped:!1}),syncLocalCatalog:()=>b("/local-catalog",{method:"POST",body:{}}),gatewayDocker:(v=!1)=>b(`/gateway-docker${v?"?fresh=1":""}`,{scoped:!1}),connectGatewayDocker:(v=[],w=!0)=>b("/gateway-docker/connect",{method:"POST",body:{confirm:w,seen:v},scoped:!1}),undoGatewayDocker:(v=[])=>b("/gateway-docker/undo",{method:"POST",body:{confirm:!0,seen:v},scoped:!1}),setups:()=>b("/setups"),discoverSetups:v=>b("/setups/scan",{method:"POST",body:{sources:v}}),reviewSetup:(v,w)=>b("/setups/review",{method:"POST",body:{token:v,ids:w}}),removeSetupReviewItem:(v,w)=>b("/setups/remove-review-item",{method:"POST",body:{token:v,item:w}}),prepareSetup:(v,w)=>b("/setups/prepare",{method:"POST",body:{token:v,items:w,approved:!0}}),prepareLaunchSetup:(v,w)=>b(`/setups/${v}/prepare-launch`,{method:"POST",body:{revision:w}}),prepareSavedSetup:v=>b(`/setups/${v}/prepare`,{method:"POST",body:{}}),setupPreparation:v=>b(`/setups/preparations/${v}`),cancelSetupPreparation:v=>b(`/setups/preparations/${v}/cancel`,{method:"POST",body:{}}),setupFile:(v,w,C)=>b("/setups/file",{method:"POST",body:{token:v,item:w,path:C}}),saveSetup:(v,w,C)=>b("/setups/save",{method:"POST",body:{token:v,name:w,acknowledged:C}}),deleteSetup:(v,w)=>b(`/setups/${v}/delete`,{method:"POST",body:{revision:w}}),deleteSetupItem:(v,w,C)=>b(`/setups/${v}/delete-item`,{method:"POST",body:{item:w,revision:C}}),previewSetup:(v,w,C)=>b(`/setups/${v}/preview`,{method:"POST",body:{sandbox:w,targets:C}}),enableSetup:(v,w,C,S=!1)=>b(`/setups/${v}/enable`,{method:"POST",body:{sandbox:w,token:C,approveAccess:S}}),removeSetup:(v,w,C)=>b(`/setups/${v}/remove`,{method:"POST",body:{sandbox:w,token:C}}),setupJobs:v=>b(`/setups/${v}/jobs`),cloudExport:v=>b(`/cloud-export?name=${encodeURIComponent(v)}`),importCloud:v=>b("/cloud-import",{method:"POST",body:v}),cloudTransfer:(v,w)=>b("/cloud-transfer",{method:"POST",body:{name:v,ticket:w}}),selectContext:v=>b("/context",{method:"POST",body:v}),previewActivityDeletion:v=>b("/activity/delete-preview",{method:"POST",body:v}),deleteActivity:v=>b("/activity/delete",{method:"POST",body:{token:v}}),activityDestinations:()=>b("/activity-destinations"),createActivityDestination:v=>b("/activity-destinations",{method:"POST",body:v}),activityDestinationAction:(v,w)=>b(`/activity-destinations/${encodeURIComponent(v)}/${w}`,{method:"POST",body:{}}),overview:()=>b("/overview"),sandbox:v=>b(`/sandboxes/${encodeURIComponent(v)}`),activity:(v={})=>b(`/activity?query=${encodeURIComponent(JSON.stringify(v))}`),create:v=>b("/sandboxes",{method:"POST",body:v}),sshConnection:v=>b(`/sandboxes/${encodeURIComponent(v)}/ssh`),openSshTerminal:(v,w)=>b(`/sandboxes/${encodeURIComponent(v)}/ssh-open`,{method:"POST",body:{mode:w}}),sshConfig:v=>b(`/sandboxes/${encodeURIComponent(v)}/ssh-config`,{method:"POST",body:{}}),terminalSession:(v,w)=>b(`/sandboxes/${encodeURIComponent(v)}/terminal-session`,{method:"POST",body:w}),lifecycle:(v,w)=>b(`/sandboxes/${encodeURIComponent(v)}/${w}`,{method:"POST",body:{}}),editors:()=>b("/editors"),openEditor:(v,w)=>b(`/sandboxes/${encodeURIComponent(v)}/editor`,{method:"POST",body:{editor:w}}),fleetPolicy:()=>b("/policy/fleet"),policy:v=>b(`/policy/${encodeURIComponent(v)}`),revision:(v,w)=>b(`/policy/${encodeURIComponent(v)}/revisions/${w}`),applyOps:(v,w)=>b(`/policy/${encodeURIComponent(v)}/ops`,{method:"POST",body:{ops:w}}),restore:(v,w)=>b(`/policy/${encodeURIComponent(v)}/restore`,{method:"POST",body:{version:w}}),globalPolicy:()=>b("/policy/global"),removeGlobal:()=>b("/policy/global/remove",{method:"POST",body:{}}),settings:v=>b(`/settings${v?`/${encodeURIComponent(v)}`:""}`),setSetting:v=>b("/settings",{method:"POST",body:v}),secrets:()=>b("/secrets"),createSecret:v=>b("/secrets",{method:"POST",body:v}),rotateSecret:(v,w)=>b(`/secrets/${encodeURIComponent(v)}/rotate`,{method:"POST",body:{credentials:w}}),secretExpiry:(v,w,C)=>b(`/secrets/${encodeURIComponent(v)}/expiry`,{method:"POST",body:{key:w,expiresAt:C}}),deleteSecret:v=>b(`/secrets/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),attachSecret:(v,w,C)=>b(`/secrets/${encodeURIComponent(v)}/${C?"attach":"detach"}`,{method:"POST",body:{sandbox:w}}),importProfile:v=>b("/profiles/import",{method:"POST",body:{id:v}}),deleteTemplates:v=>b("/templates/delete",{method:"POST",body:{ids:v}}),templates:()=>b("/templates"),imageTemplates:()=>b("/image-templates"),localImages:()=>b("/image-templates/local-images"),buildImageTemplate:(v,w=!1)=>b("/image-templates",{method:"POST",body:{recipe:v,replace:w}}),cancelImageBuild:v=>b(`/image-templates/${encodeURIComponent(v)}/cancel`,{method:"POST",body:{}}),dismissImageBuild:v=>b(`/image-templates/${encodeURIComponent(v)}/dismiss`,{method:"POST",body:{}}),imageTemplateUsage:v=>b(`/image-templates/${encodeURIComponent(v)}/usage`),deleteImageTemplate:v=>b(`/image-templates/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),org:()=>b("/org"),saveOrg:v=>b("/org",{method:"POST",body:v}),saveGroup:v=>b("/org/groups",{method:"POST",body:v}),deleteGroup:v=>b(`/org/groups/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),setGroupMembers:(v,w,C="replace")=>b("/org/members",{method:"POST",body:{sandboxes:v,groups:w,mode:C}}),savePolicy:v=>b("/egress/policies",{method:"POST",body:v}),deletePolicy:v=>b(`/egress/policies/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),saveTemplate:v=>b("/templates",{method:"POST",body:v}),deleteTemplate:v=>b(`/templates/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),localFolder:v=>b("/local-folder",{method:"POST",body:{path:v}}),files:(v,w)=>b(`/files/${encodeURIComponent(v)}?path=${encodeURIComponent(w)}`),seed:v=>b(`/files/${encodeURIComponent(v)}/seed`),retrySeed:v=>b(`/files/${encodeURIComponent(v)}/seed/retry`,{method:"POST",body:{}}),prepareDownload:(v,w)=>b(`/files/${encodeURIComponent(v)}/download`,{method:"POST",body:{path:w}}),startUpload:v=>b(`/files/${encodeURIComponent(v)}/uploads`,{method:"POST",body:{}}),uploadFile:(v,w,C,S,N)=>b(`/files/${encodeURIComponent(v)}/uploads/${w}?path=${encodeURIComponent(C)}`,{method:"POST",body:S,raw:!0,signal:N}),commitUpload:(v,w,C)=>b(`/files/${encodeURIComponent(v)}/uploads/${w}/commit`,{method:"POST",body:{dir:C}}),cancelUpload:(v,w)=>b(`/files/${encodeURIComponent(v)}/uploads/${w}/cancel`,{method:"POST",body:{}}),ingress:()=>b("/ingress"),exposeService:v=>b("/ingress/expose",{method:"POST",body:v}),closeService:v=>b("/ingress/close",{method:"POST",body:{sandbox:v.sandbox,name:v.name}}),extendService:(v,w)=>b("/ingress/extend",{method:"POST",body:{sandbox:v.sandbox,name:v.name,closeAfterMinutes:w}})}}const cs=lr(),hk="https://console.openrod.io".trim(),ku=/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(hk)?hk:"",mk="Cloud is coming soon. We're still working on it.";function Ag(){return typeof window<"u"}function Us(e){return $1(e)?(e.nodeName||"").toLowerCase():"#document"}function Rn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ei(e){var t;return(t=($1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $1(e){return Ag()?e instanceof Node||e instanceof Rn(e).Node:!1}function Ft(e){return Ag()?e instanceof Element||e instanceof Rn(e).Element:!1}function wn(e){return Ag()?e instanceof HTMLElement||e instanceof Rn(e).HTMLElement:!1}function Tu(e){return!Ag()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rn(e).ShadowRoot}function zf(e){const{overflow:t,overflowX:r,overflowY:a,display:i}=Br(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+r)&&i!=="inline"&&i!=="contents"}function i6(e){return/^(table|td|th)$/.test(Us(e))}function Mg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const l6=/transform|translate|scale|rotate|perspective|filter/,c6=/paint|layout|strict|content/,Pl=e=>!!e&&e!=="none";let fv;function B1(e){const t=Ft(e)?Br(e):e;return Pl(t.transform)||Pl(t.translate)||Pl(t.scale)||Pl(t.rotate)||Pl(t.perspective)||!V1()&&(Pl(t.backdropFilter)||Pl(t.filter))||l6.test(t.willChange||"")||c6.test(t.contain||"")}function u6(e){let t=Ya(e);for(;wn(t)&&!Ua(t);){if(B1(t))return t;if(Mg(t))return null;t=Ya(t)}return null}function V1(){return fv==null&&(fv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fv}function Ua(e){return/^(html|body|#document)$/.test(Us(e))}function Br(e){return Rn(e).getComputedStyle(e)}function Og(e){return Ft(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ya(e){if(Us(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Tu(e)&&e.host||ei(e);return Tu(t)?t.host:t}function WR(e){const t=Ya(e);return Ua(t)?(e.ownerDocument||e).body:wn(t)&&zf(t)?t:WR(t)}function pf(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=WR(e),c=i===((a=e.ownerDocument)==null?void 0:a.body),u=Rn(i);if(c){const f=vy(u);return t.concat(u,u.visualViewport||[],zf(i)?i:[],f&&r?pf(f):[])}else return t.concat(i,pf(i,[],r))}function vy(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const U1={...zP},pk={};function bs(e,t){const r=x.useRef(pk);return r.current===pk&&(r.current=e(t)),r}const hv=U1.useInsertionEffect,d6=hv&&hv!==U1.useLayoutEffect?hv:e=>e();function st(e){const t=bs(f6).current;return t.next=e,d6(t.effect),t.trampoline}function f6(){const e={next:void 0,callback:h6,trampoline:(...t)=>{var r;return(r=e.callback)==null?void 0:r.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function h6(){}const m6=()=>{},We=typeof document<"u"?x.useLayoutEffect:m6;function yy(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const H1={};function Qs(e,t,r,a,i){if(!r&&!a&&!i&&!e)return Fp(t);let c=Fp(e);return t&&(c=Kd(c,t)),r&&(c=Kd(c,r)),a&&(c=Kd(c,a)),i&&(c=Kd(c,i)),c}function p6(e){if(e.length===0)return H1;if(e.length===1)return Fp(e[0]);let t=Fp(e[0]);for(let r=1;r<e.length;r+=1)t=Kd(t,e[r]);return t}function Fp(e){return F1(e)?{...ZR(e,H1)}:g6(e)}function Kd(e,t){return F1(t)?ZR(t,e):x6(e,t)}function g6(e){const t={...e};for(const r in t){const a=t[r];QR(r,a)&&(t[r]=JR(a))}return t}function x6(e,t){if(!t)return e;for(const r in t){const a=t[r];switch(r){case"style":{e[r]=yy(e.style,a);break}case"className":{e[r]=eA(e.className,a);break}default:QR(r,a)?e[r]=b6(e[r],a):e[r]=a}}return e}function QR(e,t){const r=e.charCodeAt(0),a=e.charCodeAt(1),i=e.charCodeAt(2);return r===111&&a===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function F1(e){return typeof e=="function"}function ZR(e,t){return F1(e)?e(t):e??H1}function b6(e,t){return t?e?(...r)=>{const a=r[0];if(tA(a)){const c=a;Gp(c);const u=t(...r);return c.baseUIHandlerPrevented||e==null||e(...r),u}const i=t(...r);return e==null||e(...r),i}:JR(t):e}function JR(e){return e&&((...t)=>{const r=t[0];return tA(r)&&Gp(r),e(...t)})}function Gp(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function eA(e,t){return t?e?t+" "+e:t:e}function tA(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function v6(e,t){return function(a,...i){const c=new URL(e);return c.searchParams.set("code",a.toString()),i.forEach(u=>c.searchParams.append("args[]",u)),`${t} error #${a}; visit ${c} for the full message.`}}const rn=v6("https://base-ui.com/production-error","Base UI"),nA=x.createContext(void 0);function Dg(e=!1){const t=x.useContext(nA);if(t===void 0&&!e)throw new Error(rn(16));return t}function y6(e){const{focusableWhenDisabled:t,disabled:r,composite:a=!1,tabIndex:i=0,isNativeButton:c}=e,u=a&&t!==!1,f=a&&t===!1;return{props:x.useMemo(()=>{const h={onKeyDown(g){r&&t&&g.key!=="Tab"&&g.preventDefault()}};return a||(h.tabIndex=i,!c&&r&&(h.tabIndex=t?i:-1)),(c&&(t||u)||!c&&r)&&(h["aria-disabled"]=r),c&&(!t||f)&&(h.disabled=r),h},[a,r,t,u,f,c,i])}}function Ht(e){return(e==null?void 0:e.ownerDocument)||document}function hu(e,t,{detail:r=0}={}){e.dispatchEvent(new(Rn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function bo(e={}){const{disabled:t=!1,focusableWhenDisabled:r,tabIndex:a=0,native:i=!0,composite:c}=e,u=x.useRef(null),f=Dg(!0),m=c??f!==void 0,{props:h}=y6({focusableWhenDisabled:r,disabled:t,composite:m,tabIndex:a,isNativeButton:i}),g=x.useCallback(()=>{const v=u.current;mv(v)&&m&&t&&h.disabled===void 0&&v.disabled&&(v.disabled=!1)},[t,h.disabled,m]);We(g,[g]);const p=x.useCallback((v={})=>{const{onClick:w,onMouseDown:C,onKeyUp:S,onKeyDown:N,onPointerDown:E,...T}=v;return Qs({onClick(R){if(t){R.preventDefault();return}w==null||w(R)},onMouseDown(R){t||C==null||C(R)},onKeyDown(R){if(t||(Gp(R),N==null||N(R),R.baseUIHandlerPrevented))return;const M=R.target===R.currentTarget,A=R.currentTarget,k=mv(A),O=!i&&w6(A),D=M&&(i?k:!O),_=R.key==="Enter",H=R.key===" ",G=A.getAttribute("role"),B=(G==null?void 0:G.startsWith("menuitem"))||G==="option"||G==="gridcell";if(M&&m&&H){if(R.defaultPrevented&&B)return;R.preventDefault(),(!i||k)&&(R.preventBaseUIHandler(),hu(A,R));return}if(!D||i||!H&&!_){M&&O&&H&&R.preventDefault();return}R.defaultPrevented||(R.preventDefault(),_&&(R.preventBaseUIHandler(),hu(A,R)))},onKeyUp(R){if(!t){if(Gp(R),S==null||S(R),R.target===R.currentTarget&&i&&m&&mv(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!i&&!m&&!R.defaultPrevented&&R.key===" "&&(R.preventBaseUIHandler(),hu(R.currentTarget,R))}},onPointerDown(R){if(t){R.preventDefault();return}E==null||E(R)}},i?{type:"button"}:{role:"button"},h,T)},[t,h,m,i]),b=st(v=>{u.current=v,g()});return{getButtonProps:p,buttonRef:b}}function mv(e){return wn(e)&&e.tagName==="BUTTON"}function w6(e){return wn(e)&&e.tagName==="A"&&!!e.href}function mo(e,t,r,a){const i=bs(sA).current;return S6(i,e,t,r,a)&&rA(i,[e,t,r,a]),i.callback}function j6(e){const t=bs(sA).current;return N6(t,e)&&rA(t,e),t.callback}function sA(){return{callback:null,cleanup:null,refs:[]}}function S6(e,t,r,a,i){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==a||e.refs[3]!==i}function N6(e,t){return e.refs.length!==t.length||e.refs.some((r,a)=>r!==t[a])}function rA(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 i=0;i<t.length;i+=1){const c=t[i];if(c!=null)switch(typeof c){case"function":{const u=c(r);typeof u=="function"&&(a[i]=u);break}case"object":{c.current=r;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const c=t[i];if(c!=null)switch(typeof c){case"function":{const u=a[i];typeof u=="function"?u():c(null);break}case"object":{c.current=null;break}}}}}}}const C6=parseInt(x.version,10);function G1(e){return C6>=e}function gk(e){if(!x.isValidElement(e))return null;const t=e,r=t.props;return(G1(19)?r==null?void 0:r.ref:t.ref)??null}function Ln(){}const Vr=Object.freeze([]),En=Object.freeze({});function k6(e,t){const r={};for(const a in e){const i=e[a];if(t!=null&&t.hasOwnProperty(a)){const c=t[a](i);c!=null&&Object.assign(r,c);continue}i===!0?r[`data-${a.toLowerCase()}`]="":i&&(r[`data-${a.toLowerCase()}`]=i.toString())}return r}function T6(e,t){return typeof e=="function"?e(t):e}function oA(e,t){return typeof e=="function"?e(t):e}function Nt(e,t,r={}){let a=t.render;r.enabled!==!1&&(a=M6(a));const i=E6(t,r,a);if(r.enabled===!1)return null;const c=r.state??En;return O6(e,a,i,c)}function E6(e,t,r){const{className:a,style:i}=e,{state:c=En,ref:u,props:f,stateAttributesMapping:m,enabled:h=!0}=t,g=h?T6(a,c):void 0,p=h?oA(i,c):void 0,b=h?k6(c,m):En,v=h&&f?R6(f):void 0,w=h?yy(b,v)??{}:En;return typeof document<"u"&&(h?Array.isArray(u)?w.ref=j6([w.ref,gk(r),...u]):w.ref=mo(w.ref,gk(r),u):mo(null,null)),h?(g!==void 0&&(w.className=eA(w.className,g)),p!==void 0&&(w.style=yy(w.style,p)),w):En}function R6(e){return Array.isArray(e)?p6(e):Qs(void 0,e)}const A6=Symbol.for("react.lazy");function M6(e){if((e==null?void 0:e.$$typeof)!==A6)return e;const t=x.Children.toArray(e)[0];return x.isValidElement(t)?t:e}function O6(e,t,r,a){if(t){if(typeof t=="function")return t(r,a);const i=Qs(r,t.props);return i.ref=r.ref,x.cloneElement(t,i)}if(e&&typeof e=="string")return D6(e,r);throw new Error(rn(8))}function D6(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const z6=x.forwardRef(function(t,r){const{render:a,className:i,disabled:c=!1,focusableWhenDisabled:u=!1,nativeButton:f=!0,style:m,...h}=t,{getButtonProps:g,buttonRef:p}=bo({disabled:c,focusableWhenDisabled:u,native:f});return Nt("button",t,{state:{disabled:c},ref:[r,p],props:[h,g]})});function aA(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=aA(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function iA(){for(var e,t,r=0,a="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=aA(e))&&(a&&(a+=" "),a+=t);return a}const xk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,bk=iA,If=(e,t)=>r=>{var a;if((t==null?void 0:t.variants)==null)return bk(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:c}=t,u=Object.keys(i).map(h=>{const g=r==null?void 0:r[h],p=c==null?void 0:c[h];if(g===null)return null;const b=xk(g)||xk(p);return i[h][b]}),f=r&&Object.entries(r).reduce((h,g)=>{let[p,b]=g;return b===void 0||(h[p]=b),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,g)=>{let{class:p,className:b,...v}=g;return Object.entries(v).every(w=>{let[C,S]=w;return Array.isArray(S)?S.includes({...c,...f}[C]):{...c,...f}[C]===S})?[...h,p,b]:h},[]);return bk(e,u,m,r==null?void 0:r.class,r==null?void 0:r.className)},I6=(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},P6=(e,t)=>({classGroupId:e,validator:t}),lA=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),qp="-",vk=[],_6="arbitrary..",L6=e=>{const t=B6(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return $6(u);const f=u.split(qp),m=f[0]===""&&f.length>1?1:0;return cA(f,m,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const m=a[u],h=r[u];return m?h?I6(h,m):m:h||vk}return r[u]||vk}}},cA=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],c=r.nextPart.get(i);if(c){const h=cA(e,t+1,c);if(h)return h}const u=r.validators;if(u===null)return;const f=t===0?e.join(qp):e.slice(t).join(qp),m=u.length;for(let h=0;h<m;h++){const g=u[h];if(g.validator(f))return g.classGroupId}},$6=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?_6+a:void 0})(),B6=e=>{const{theme:t,classGroups:r}=e;return V6(r,t)},V6=(e,t)=>{const r=lA();for(const a in e){const i=e[a];q1(i,r,a,t)}return r},q1=(e,t,r,a)=>{const i=e.length;for(let c=0;c<i;c++){const u=e[c];U6(u,t,r,a)}},U6=(e,t,r,a)=>{if(typeof e=="string"){H6(e,t,r);return}if(typeof e=="function"){F6(e,t,r,a);return}G6(e,t,r,a)},H6=(e,t,r)=>{const a=e===""?t:uA(t,e);a.classGroupId=r},F6=(e,t,r,a)=>{if(q6(e)){q1(e(a),t,r,a);return}t.validators===null&&(t.validators=[]),t.validators.push(P6(r,e))},G6=(e,t,r,a)=>{const i=Object.entries(e),c=i.length;for(let u=0;u<c;u++){const[f,m]=i[u];q1(m,uA(t,f),r,a)}},uA=(e,t)=>{let r=e;const a=t.split(qp),i=a.length;for(let c=0;c<i;c++){const u=a[c];let f=r.nextPart.get(u);f||(f=lA(),r.nextPart.set(u,f)),r=f}return r},q6=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Y6=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),a=Object.create(null);const i=(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 i(c,u),u},set(c,u){c in r?r[c]=u:i(c,u)}}},wy="!",yk=":",K6=[],wk=(e,t,r,a,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:a,isExternal:i}),X6=e=>{const{prefix:t,experimentalParseClassName:r}=e;let a=i=>{const c=[];let u=0,f=0,m=0,h;const g=i.length;for(let C=0;C<g;C++){const S=i[C];if(u===0&&f===0){if(S===yk){c.push(i.slice(m,C)),m=C+1;continue}if(S==="/"){h=C;continue}}S==="["?u++:S==="]"?u--:S==="("?f++:S===")"&&f--}const p=c.length===0?i:i.slice(m);let b=p,v=!1;p.endsWith(wy)?(b=p.slice(0,-1),v=!0):p.startsWith(wy)&&(b=p.slice(1),v=!0);const w=h&&h>m?h-m:void 0;return wk(c,v,b,w)};if(t){const i=t+yk,c=a;a=u=>u.startsWith(i)?c(u.slice(i.length)):wk(K6,!1,u,void 0,!0)}if(r){const i=a;a=c=>r({className:c,parseClassName:i})}return a},W6=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,a)=>{t.set(r,1e6+a)}),r=>{const a=[];let i=[];for(let c=0;c<r.length;c++){const u=r[c],f=u[0]==="[",m=t.has(u);f||m?(i.length>0&&(i.sort(),a.push(...i),i=[]),a.push(u)):i.push(u)}return i.length>0&&(i.sort(),a.push(...i)),a}},Q6=e=>({cache:Y6(e.cacheSize),parseClassName:X6(e),sortModifiers:W6(e),postfixLookupClassGroupIds:Z6(e),...L6(e)}),Z6=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},J6=/\s+/,e_=(e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:i,sortModifiers:c,postfixLookupClassGroupIds:u}=t,f=[],m=e.trim().split(J6);let h="";for(let g=m.length-1;g>=0;g-=1){const p=m[g],{isExternal:b,modifiers:v,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:S}=r(p);if(b){h=p+(h.length>0?" "+h:h);continue}let N=!!S,E;if(N){const k=C.substring(0,S);E=a(k);const O=E&&u[E]?a(C):void 0;O&&O!==E&&(E=O,N=!1)}else E=a(C);if(!E){if(!N){h=p+(h.length>0?" "+h:h);continue}if(E=a(C),!E){h=p+(h.length>0?" "+h:h);continue}N=!1}const T=v.length===0?"":v.length===1?v[0]:c(v).join(":"),R=w?T+wy:T,M=R+E;if(f.indexOf(M)>-1)continue;f.push(M);const A=i(E,N);for(let k=0;k<A.length;++k){const O=A[k];f.push(R+O)}h=p+(h.length>0?" "+h:h)}return h},t_=(...e)=>{let t=0,r,a,i="";for(;t<e.length;)(r=e[t++])&&(a=dA(r))&&(i&&(i+=" "),i+=a);return i},dA=e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=dA(e[a]))&&(r&&(r+=" "),r+=t);return r},n_=(e,...t)=>{let r,a,i,c;const u=m=>{const h=t.reduce((g,p)=>p(g),e());return r=Q6(h),a=r.cache.get,i=r.cache.set,c=f,f(m)},f=m=>{const h=a(m);if(h)return h;const g=e_(m,r);return i(m,g),g};return c=u,(...m)=>c(t_(...m))},s_=[],ms=e=>{const t=r=>r[e]||s_;return t.isThemeGetter=!0,t.themeKey=e,t},fA=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hA=/^\((?:(\w[\w-]*):)?(.+)\)$/i,r_=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,o_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,a_=/\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$/,i_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,l_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,c_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ii=e=>r_.test(e),Ut=e=>!!e&&!Number.isNaN(Number(e)),Qo=e=>!!e&&Number.isInteger(Number(e)),pv=e=>e.endsWith("%")&&Ut(e.slice(0,-1)),Pa=e=>o_.test(e),mA=()=>!0,u_=e=>a_.test(e)&&!i_.test(e),Y1=()=>!1,d_=e=>l_.test(e),f_=e=>c_.test(e),h_=e=>!dt(e)&&!ft(e),m_=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)),p_=e=>sl(e,xA,Y1),dt=e=>fA.test(e),_l=e=>sl(e,bA,u_),jk=e=>sl(e,S_,Ut),g_=e=>sl(e,yA,mA),x_=e=>sl(e,vA,Y1),Sk=e=>sl(e,pA,Y1),b_=e=>sl(e,gA,f_),Mm=e=>sl(e,wA,d_),ft=e=>hA.test(e),Bd=e=>fc(e,bA),v_=e=>fc(e,vA),Nk=e=>fc(e,pA),y_=e=>fc(e,xA),w_=e=>fc(e,gA),Om=e=>fc(e,wA,!0),j_=e=>fc(e,yA,!0),sl=(e,t,r)=>{const a=fA.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},fc=(e,t,r=!1)=>{const a=hA.exec(e);return a?a[1]?t(a[1]):r:!1},pA=e=>e==="position"||e==="percentage",gA=e=>e==="image"||e==="url",xA=e=>e==="length"||e==="size"||e==="bg-size",bA=e=>e==="length",S_=e=>e==="number",vA=e=>e==="family-name",yA=e=>e==="number"||e==="weight",wA=e=>e==="shadow",N_=()=>{const e=ms("color"),t=ms("font"),r=ms("text"),a=ms("font-weight"),i=ms("tracking"),c=ms("leading"),u=ms("breakpoint"),f=ms("container"),m=ms("spacing"),h=ms("radius"),g=ms("shadow"),p=ms("inset-shadow"),b=ms("text-shadow"),v=ms("drop-shadow"),w=ms("blur"),C=ms("perspective"),S=ms("aspect"),N=ms("ease"),E=ms("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...R(),ft,dt],A=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],O=()=>[ft,dt,m],D=()=>[Ii,"full","auto",...O()],_=()=>[Qo,"none","subgrid",ft,dt],H=()=>["auto",{span:["full",Qo,ft,dt]},Qo,ft,dt],G=()=>[Qo,"auto",ft,dt],B=()=>["auto","min","max","fr",ft,dt],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...O()],W=()=>[Ii,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],K=()=>[f,Ii,"screen","full","dvw","lvw","svw","min","max","fit",...O()],J=()=>[Ii,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],z=()=>[e,ft,dt],L=()=>[...R(),Nk,Sk,{position:[ft,dt]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ee=()=>["auto","cover","contain",y_,p_,{size:[ft,dt]}],$=()=>[pv,Bd,_l],U=()=>["","none","full",h,ft,dt],F=()=>["",Ut,Bd,_l],Y=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[Ut,pv,Nk,Sk],ye=()=>["","none",w,ft,dt],ae=()=>["none",Ut,ft,dt],ue=()=>["none",Ut,ft,dt],se=()=>[Ut,ft,dt],Q=()=>[Ii,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Pa],breakpoint:[Pa],color:[mA],container:[Pa],"drop-shadow":[Pa],ease:["in","out","in-out"],font:[h_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Pa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Pa],shadow:[Pa],spacing:["px",Ut],text:[Pa],"text-shadow":[Pa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ii,dt,ft,S]}],container:["container"],"container-type":[{"@container":["","normal","size",ft,dt]}],"container-named":[m_],columns:[{columns:[Ut,"auto",dt,ft,f]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:M()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Qo,"auto",ft,dt]}],basis:[{basis:[Ii,"full","auto",f,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ut,Ii,"auto","initial","none",dt]}],grow:[{grow:["",Ut,ft,dt]}],shrink:[{shrink:["",Ut,ft,dt]}],order:[{order:[Qo,"first","last","none",ft,dt]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],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:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...J()]}],"min-block-size":[{"min-block":["auto",...J()]}],"max-block-size":[{"max-block":["none",...J()]}],w:[{w:[f,"screen",...W()]}],"min-w":[{"min-w":[f,"screen","none",...W()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh","none",...W()]}],"font-size":[{text:["base",r,Bd,_l]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,j_,g_]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pv,dt]}],"font-family":[{font:[v_,x_,t]}],"font-features":[{"font-features":[dt]}],"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:[i,ft,dt]}],"line-clamp":[{"line-clamp":[Ut,"none",ft,jk]}],leading:[{leading:["none",c,...O()]}],"list-image":[{"list-image":["none",ft,dt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ft,dt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ut,"from-font","auto",ft,_l]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[Ut,"auto",ft,dt]}],"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:[Qo,ft,dt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ft,dt]}],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",ft,dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Qo,ft,dt],radial:["",ft,dt],conic:["",Qo,ft,dt]},w_,b_]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],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:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-bs":[{"border-bs":F()}],"border-w-be":[{"border-be":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-bs":[{"border-bs":z()}],"border-color-be":[{"border-be":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ut,ft,dt]}],"outline-w":[{outline:["",Ut,Bd,_l]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","inner","none",g,Om,Mm]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",p,Om,Mm]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[Ut,_l]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",b,Om,Mm]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[Ut,ft,dt]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[ft,dt]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"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":R()}],"mask-image-conic-pos":[{"mask-conic":[Ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ft,dt]}],filter:[{filter:["","none",ft,dt]}],blur:[{blur:ye()}],brightness:[{brightness:[Ut,ft,dt]}],contrast:[{contrast:[Ut,ft,dt]}],"drop-shadow":[{"drop-shadow":["","none",v,Om,Mm]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",Ut,ft,dt]}],"hue-rotate":[{"hue-rotate":[Ut,ft,dt]}],invert:[{invert:["",Ut,ft,dt]}],saturate:[{saturate:[Ut,ft,dt]}],sepia:[{sepia:["",Ut,ft,dt]}],"backdrop-filter":[{"backdrop-filter":["","none",ft,dt]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[Ut,ft,dt]}],"backdrop-contrast":[{"backdrop-contrast":[Ut,ft,dt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ut,ft,dt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ut,ft,dt]}],"backdrop-invert":[{"backdrop-invert":["",Ut,ft,dt]}],"backdrop-opacity":[{"backdrop-opacity":[Ut,ft,dt]}],"backdrop-saturate":[{"backdrop-saturate":[Ut,ft,dt]}],"backdrop-sepia":[{"backdrop-sepia":["",Ut,ft,dt]}],"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",ft,dt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ut,"initial",ft,dt]}],ease:[{ease:["linear","initial",N,ft,dt]}],delay:[{delay:[Ut,ft,dt]}],animate:[{animate:["none",E,ft,dt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,ft,dt]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":["scale-3d"],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[ft,dt,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Q()}],"translate-x":[{"translate-x":Q()}],"translate-y":[{"translate-y":Q()}],"translate-z":[{"translate-z":Q()}],"translate-none":["translate-none"],zoom:[{zoom:[Qo,ft,dt]}],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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",ft,dt]}],"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":z()}],"scrollbar-track-color":[{"scrollbar-track":z()}],"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",ft,dt]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[Ut,Bd,_l,jk]}],stroke:[{stroke:["none",...z()]}],"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"]}},C_=n_(N_);function Ve(...e){return C_(iA(e))}const k_=If("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 le({className:e,variant:t="default",size:r="default",...a}){return n.jsx(z6,{"data-slot":"button",className:Ve(k_({variant:t,size:r,className:e})),...a})}const jA=48,ya=(e,t=0)=>{const r=new Int32Array(e.length);for(let a=0;a<e.length;a++)r[a]=e.charCodeAt(a)-jA-t;return r},zg=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},Qi=e=>{const t=new Int32Array(e.length);let r=0;for(let a=0;a<e.length;a++){const i=e.charCodeAt(a)-jA;r+=i>>>1^-(i&1),t[a]=r}return t},T_=384,E_=[],Hl=zg(ya("E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010")),R_=zg(ya(":11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3")),A_="@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",M_=(()=>{const e=Hl.length-1,t=new Int32Array(e);for(let i=e-1;i>=0;i--){let c=1,u=i+1;for(let f=Hl[i];f<Hl[i+1];f++)c+=t[u],u+=t[u];t[i]=c}const r=new Int32Array(Hl[e]);let a=0;for(let i=0;i<e;i++){let c=i+1;for(let u=Hl[i];u<Hl[i+1];u++)r[a++]=c,c+=t[c]}return r})(),O_=ya("02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000…ŏ000ˆ0000ŏ0000000000—0000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000",1),D_=zg(ya("1233333593464636351265367151576")),z_=ya("93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0324325853;D>E?3257D>03258432585:0325B:;0328B:032"),I_=ya("012123445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EJK4444::EJ4444441691;644444114244444:;L6666555555555555555999666664444444444444444444444226?6:66644M9N?D:111::::6DJ199"),P_=Qi("0202002020020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200"),__=(()=>{const e=new Int32Array(319).fill(-1),t=Qi("02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222"),r=Qi("02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222");for(let a=0;a<t.length;a++)e[t[a]]=r[a];return e})(),L_="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}),Ck=Qi("0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422"),$_=Qi("ɠ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"),B_=Qi("02222222222222222222222222222222222222222222222222222222222222222203062222222222IL2200IL021042222]`222IL0gj2e50n2222U00X202[^2y0000560|{~ƒ†22‰Œ‹>22|22222222222G000q†OVI00000}š2›>40000ŒB00000I¨­000°00000000000000021Q²±00´“000000000000000000000–222›HGHa5¾222Ã6À2222ÍÐ000­°2±"),SA=new Int32Array(991),NA=new Int32Array(991),CA=new Int32Array(991);let jy="";const Sy=new Int32Array(1030);{const e=new Map;let t=0,r=0;for(let a=0;a<Ck.length;a++)for(const i of L_[B_[a]]){let c=e.get(i);c===void 0&&(c=t++,e.set(i,c),Sy[c*2]=jy.length,Sy[c*2+1]=i.length,jy+=i),SA[r]=Ck[a],NA[r]=$_[a],CA[r]=c,r++}}const V_=Qi("0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p"),U_=zg(ya("1::22222432:222:22:22>222222:22:2221322511111311111114")),H_=Qi("2Š4A;33N=C@H4A;33N=C@<2;363@QTQʰ222ˉºŴŽ2R2=18cƴÅҜÜÛŲǝȈ:ħ25=11D3A@216Er25;11B3?<438Cn9@7=<8192>2E121@9@EHE@9>2T25511<398216=V25511<398216=„ƧNž2Đå242L222290000f22500ɛ000ǘ222"),F_=ya("ij"),G_=ya("—"),q_=ya("1"),Y_="* ** after backdrop before details-content file first-letter first-line marker placeholder selection";var K_={GROUP_COUNT:T_,customValidatorNames:E_,edgeStart:Hl,labelStart:R_,labelText:A_,edgeTarget:M_,nodeGroup:O_,nodeVlist:__,vlistPat:D_,vlistOps:z_,vlistRef:I_,vlistGroup:P_,litAnchor:SA,litGroup:NA,litPool:CA,poolOffsets:Sy,poolText:jy,adjGid:V_,adjStart:U_,adjTgt:H_,patGid:F_,patTgt:G_,postfixLookupGroups:q_,orderSensitiveModifiers:Y_};const X_="line"in new Error,Zo=-1,Ll=-1,gv=(e,t,r)=>{let a=2166136261;for(let i=t;i<r;i++)a=Math.imul(a^e.charCodeAt(i),16777619);return a},xv=(e,t,r)=>{const a=r-t;let i=Math.imul(a,2654435761)^e.charCodeAt(t);if(a>3){const c=a>>2,u=a>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+c),2246822507),i=Math.imul(i^e.charCodeAt(t+u)<<8^e.charCodeAt(t+u+c)<<16^e.charCodeAt(r-3),3266489909),i^=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--)i=Math.imul(i^e.charCodeAt(f)^e.charCodeAt(m)<<8,16777619)}return i^i>>>15|0},W_=(e,t,r={})=>{const{GROUP_COUNT:a,edgeStart:i,labelStart:c,labelText:u,edgeTarget:f,nodeGroup:m,nodeVlist:h,vlistPat:g,vlistOps:p,vlistRef:b,vlistGroup:v,litAnchor:w,litGroup:C,litPool:S,poolOffsets:N,poolText:E,adjGid:T,adjStart:R,adjTgt:M,patGid:A,patTgt:k,postfixLookupGroups:O,customValidatorNames:D,orderSensitiveModifiers:_}=e,H=new Int32Array(a).fill(-1);for(let De=0;De<T.length;De++)H[T[De]]=De;let G=0;for(let De=0;De+1<R.length;De++){const Ge=R[De+1]-R[De];Ge>G&&(G=Ge)}let B=32;for(;B<2*(1+G+A.length);)B<<=1;const P=new Int32Array(b.length+1);for(let De=0;De<b.length;De++)P[De+1]=P[De]+g[b[De]+1]-g[b[De]];const V=new Uint8Array(a);for(let De=0;De<O.length;De++)V[O[De]]=1;const q=i.length-1,W=new Uint8Array(q);let K=0,J=!0;for(let De=0;De<w.length;De++){W[w[De]]=1;const Ge=N[S[De]*2+1];Ge>K&&(K=Ge);const qe=E.charCodeAt(N[S[De]*2]);(qe===91||qe===40)&&(J=!1)}let z=1;for(;z<w.length*2;)z<<=1;const L=new Int32Array(z).fill(-1);for(let De=0;De<w.length;De++){const Ge=N[S[De]*2];let qe=(gv(E,Ge,Ge+N[S[De]*2+1])^Math.imul(w[De],2654435761)|0)&z-1;for(;L[qe]!==-1;)qe=qe+1&z-1;L[qe]=De}const X=(De,Ge,qe,bt)=>{let zt=(gv(Ge,qe,bt)^Math.imul(De,2654435761)|0)&z-1;const Mt=bt-qe;for(;;){const Bt=L[zt];if(Bt===-1)return-1;if(w[Bt]===De&&N[S[Bt]*2+1]===Mt){const Nn=N[S[Bt]*2];let hn=!0;for(let Ct=0;Ct<Mt;Ct++)if(E.charCodeAt(Nn+Ct)!==Ge.charCodeAt(qe+Ct)){hn=!1;break}if(hn)return C[Bt]}zt=zt+1&z-1}},ee=r.cacheSize??8192,$=r.prefix??e.prefix??"",U=$===""?"":$+":",F=U.length,Y=(D??[]).map(De=>{throw new Error("cn: missing validator "+De)}),ne=/\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$/,te=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ye=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ae=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;let ue=0,se=-1,Q=-1,ie=-1,oe=-1;const pe=De=>De>=97&&De<=122||De>=65&&De<=90||De>=48&&De<=57||De===95,xe=De=>/\s/.test(String.fromCharCode(De)),je=(De,Ge,qe)=>{if(ue=0,se=-1,qe-Ge<3)return;const bt=De.charCodeAt(Ge),zt=De.charCodeAt(qe-1);if(bt===91&&zt===93)ue=1;else if(bt===40&&zt===41)ue=2;else return;ie=Ge+1,oe=qe-1;let Mt=Ge+1;if(pe(De.charCodeAt(Mt))){for(Mt++;Mt<qe-1;){const Bt=De.charCodeAt(Mt);if(!pe(Bt)&&Bt!==45)break;Mt++}Mt<qe-2&&De.charCodeAt(Mt)===58&&(se=Ge+1,Q=Mt,ie=Mt+1)}},Ie=(De,Ge,qe,bt)=>{if(qe-Ge!==bt.length)return!1;for(let zt=0;zt<bt.length;zt++)if(De.charCodeAt(Ge+zt)!==bt.charCodeAt(zt))return!1;return!0},ce=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Te=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,re=De=>!!De&&!Number.isNaN(Number(De)),fe=(De,Ge,qe)=>{if(qe-Ge<11||!Ie(De,Ge,Ge+10,"@container"))return!1;if(De.charCodeAt(Ge+10)===47)return qe-Ge>=12;const bt=De.charCodeAt(Ge+11);return bt===115&&qe-Ge>=17&&Ie(De,Ge+10,Ge+16,"-size/")||bt===110&&qe-Ge>=19&&Ie(De,Ge+10,Ge+18,"-normal/")},Re=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Oe="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(De=>De.split(" ")),ke=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],he=(De,Ge,qe,bt)=>{if(De>=10){if(De>=25)return Y[De-25](Ge.slice(qe,bt));const zt=De-10;if(ue!==Re[zt])return!1;if(se>=0){for(const Mt of Oe[zt])if(Ie(Ge,se,Q,Mt))return!0;return!1}switch(ke[zt]){case 0:return!1;case 1:return!0;case 2:{const Mt=Ge.slice(ie,oe);return ne.test(Mt)&&!te.test(Mt)}case 3:return re(Ge.slice(ie,oe));case 4:return ae.test(Ge.slice(ie,oe));default:return ye.test(Ge.slice(ie,oe))}}switch(De){case 0:return!0;case 1:return ue===0;case 2:return ue===1;case 3:return ue===2;case 4:return ce.test(Ge.slice(qe,bt));case 5:return re(Ge.slice(qe,bt));case 6:{const zt=Ge.slice(qe,bt);return!!zt&&Number.isInteger(Number(zt))}case 7:return bt>qe&&Ge.charCodeAt(bt-1)===37&&re(Ge.slice(qe,bt-1));case 8:return Te.test(Ge.slice(qe,bt));default:return fe(Ge,qe,bt)}},Ae=new Set(typeof _=="string"?_.split(" "):_),ge=(De,Ge,qe,bt,zt,Mt)=>{const Bt=gv(Ge,qe,bt)^(zt?2654435769:0)|0;let Nn=De.get(Bt);if(Nn!==void 0)e:for(let It=0;It<Nn.length;It++){const an=Nn[It];if(!(an.imp!==zt||an.k.length!==bt-qe)){for(let St=0;St<an.k.length;St++)if(an.k.charCodeAt(St)!==Ge.charCodeAt(qe+St))continue e;return an.id}}else De.set(Bt,Nn=[]);const hn=Ge.slice(qe,bt),Ct=Mt(hn);return Nn.push({k:hn,imp:zt,id:Ct}),Ct};let Pe=new Map,Fe=new Map,_e=2;const Xe=4096,Je=(De,Ge)=>{const qe=[];let bt=0,zt=0,Mt=0;for(let Ct=0;Ct<De.length;Ct++){const It=De.charCodeAt(Ct);bt===0&&zt===0&&It===58?(qe.push(De.slice(Mt,Ct)),Mt=Ct+1):It===91?bt++:It===93?bt--:It===40?zt++:It===41&&zt--}qe.push(De.slice(Mt));let Bt=qe[0];if(qe.length>1){const Ct=[];let It=[];for(const an of qe)an.charCodeAt(0)===91||Ae.has(an)?(It.length&&(Ct.push(...It.sort()),It=[]),Ct.push(an)):It.push(an);It.length&&Ct.push(...It.sort()),Bt=Ct.join(":")}const Nn=Ge?Bt+" !":Bt;let hn=Fe.get(Nn);return hn===void 0&&Fe.set(Nn,hn=_e++),hn};let ct=new Map,At=a;const rt=a+4096,ve=()=>At++,Ue=2097152,Qe=8192,xt=new Int32Array(Qe),Ke=new Array(Qe).fill(null),Be=new Int32Array(Qe),jt=new Int32Array(Qe),Ze=new Uint8Array(Qe);let Tt=0;const Se=(De,Ge,qe,bt,zt,Mt,Bt,Nn)=>{let hn=De;if(Ke[De]!==null)if(Ke[De|1]===null)hn=De|1;else if((Tt++&3)===0)hn=De|Tt>>2&1;else return;Ke[hn]=Ge.slice(qe,bt),xt[hn]=zt,Be[hn]=Mt,jt[hn]=Bt,Ze[hn]=Nn},Ye=()=>Ke.fill(null);let et=256,it=[new Int32Array(et),new Int32Array(et),new Int32Array(et),new Int32Array(et)],[lt,wt,cn,Gt]=it,fn=new Uint8Array(et),Bn=new Uint8Array(et);const Kn=()=>{et*=2,it=it.map(Ge=>{const qe=new Int32Array(et);return qe.set(Ge),qe}),[lt,wt,cn,Gt]=it;const De=new Uint8Array(et);De.set(fn),fn=De,Bn=new Uint8Array(et)};let de=64,tt=new Int32Array(de),Et=new Int32Array(de);const on=new Int32Array(a);let xn=2048,Wt=21,un=new Float64Array(xn),ns=new Int32Array(xn),Jn=0;const wo=(De,Ge)=>{if(De===0&&Ge<a)return on[Ge]===Jn?1:(on[Ge]=Jn,0);const qe=De*2097152+Ge+1;let bt=Math.imul(qe,2654435761)>>>Wt;for(;ns[bt]===Jn;){if(un[bt]===qe)return 1;bt=bt+1&xn-1}return un[bt]=qe,ns[bt]=Jn,0},jo=(De,Ge,qe,bt,zt)=>{if(qe-Ge>=2&&De.charCodeAt(Ge)===91&&De.charCodeAt(qe-1)===93){let Mt=-1;for(let Bt=Ge+1;Bt<qe-1;Bt++)if(De.charCodeAt(Bt)===58){Mt=Bt;break}return Mt===-1||Mt===Ge+1?Zo:ge(ct,De,Ge+1,Mt,0,ve)}if(bt>=0&&m[bt]>=0)return m[bt];for(let Mt=zt-1;Mt>=0;Mt--){const Bt=Et[Mt];if(Bt>qe)continue;const Nn=tt[Mt],hn=qe-Bt;if(W[Nn]===1&&hn>0&&hn<=K){const Hn=De.charCodeAt(Bt);if(J===!1||Hn!==91&&Hn!==40){const Cr=X(Nn,De,Bt,qe);if(Cr>=0)return Cr}}const Ct=h[Nn];if(Ct<0)continue;const It=b[Ct],an=g[It],St=g[It+1];if(an===St)continue;je(De,Bt,qe);const fs=P[Ct]-an;for(let Hn=an;Hn<St;Hn++)if(he(p[Hn],De,Bt,qe))return v[fs+Hn]}return Zo},cr=De=>{const Ge=De.length;let qe=0,bt=0,zt=!1;(_e>Xe||Pe.size>Xe)&&(Pe=new Map,Fe=new Map,_e=2,Ye()),At>rt&&(ct=new Map,At=a,Ye());let Mt=0;for(;Mt<Ge;){let Ct=De.charCodeAt(Mt);if(Ct===32||Ct>=9&&Ct<=13||Ct>=160&&xe(Ct)){Ct!==32&&(zt=!0),Mt++;continue}const It=Mt;let an=0;for(;Mt<Ge;){if(Ct=De.charCodeAt(Mt),Ct<=32){if(Ct===32)break;if(Ct>=9&&Ct<=13){zt=!0;break}}else if(Ct>=160&&xe(Ct)){zt=!0;break}an=Math.imul(an^Ct,16777619),Mt++}const St=Mt,fs=St-It;qe===et&&Kn();const Hn=qe++;lt[Hn]=It,wt[Hn]=St,bt+=fs,an^=Math.imul(fs,2654435761);const Cr=an^an>>>15|0,ss=Cr&8190;{let Zt=-1;if(xt[ss]===Cr&&Ke[ss]!==null&&Ke[ss].length===fs?Zt=ss:xt[ss|1]===Cr&&Ke[ss|1]!==null&&Ke[ss|1].length===fs&&(Zt=ss|1),Zt>=0){const Ss=Ke[Zt];let Zr=!0;for(let Er=0;Er<fs;Er++)if(Ss.charCodeAt(Er)!==De.charCodeAt(It+Er)){Zr=!1;break}if(Zr){cn[Hn]=Be[Zt],Gt[Hn]=jt[Zt],fn[Hn]=Ze[Zt];continue}}}let rs=It;if(F!==0){if(St-It<=F||!De.startsWith(U,It)){cn[Hn]=Zo,Se(ss,De,It,St,Cr,Zo,0,0);continue}rs=It+F}let yc=0,qu=0,ja=-1,wc=-1;for(let Zt=rs;Zt<St;Zt++){const Ss=De.charCodeAt(Zt);if(yc===0&&qu===0){if(Ss===58){ja=Zt;continue}if(Ss===47){wc=Zt;continue}}Ss===91?yc++:Ss===93?yc--:Ss===40?qu++:Ss===41&&qu--}const dh=ja>=rs?ja+1:rs;let _n=dh,Gs=St,ii=!1,jc=0;Gs>_n&&De.charCodeAt(Gs-1)===33?(ii=!0,Gs--):Gs>_n&&De.charCodeAt(_n)===33&&(ii=!0,_n++,jc=1);let ur=-1;wc>dh&&(ur=wc+jc,ur>=Gs&&(ur=-1));let Sc=_n;Gs-_n>1&&De.charCodeAt(_n)===45&&(Sc=_n+1);let kr=0,Js=0,li=0,Yu=-1,Tr=0;(h[0]>=0||W[0]===1)&&(tt[0]=0,Et[0]=Sc,Tr=1);let dl=Ll,Ku=0;for(let Zt=Sc;Zt<Gs;Zt++)if(Zt===ur&&(dl=Js<li?Ll:kr,Ku=Tr),kr!==Ll){const Ss=De.charCodeAt(Zt);let Zr=-1;if(Js<li)u.charCodeAt(Js)===Ss?(Js++,Js===li&&(Zr=kr=Yu)):kr=Ll;else{const Er=i[kr],ml=i[kr+1];let Sa=Ll;for(let zs=Er;zs<ml;zs++){const pl=c[zs];if(u.charCodeAt(pl)===Ss){c[zs+1]-pl===1?Zr=Sa=f[zs]:(Js=pl+1,li=c[zs+1],Yu=f[zs],Sa=kr);break}}kr=Sa}if(Zr>=0&&(h[Zr]>=0||W[Zr]===1)&&Zt+1<Gs&&De.charCodeAt(Zt+1)===45){if(Tr===de){de*=2;const Er=new Int32Array(de);Er.set(tt),tt=Er;const ml=new Int32Array(de);ml.set(Et),Et=ml}tt[Tr]=Zr,Et[Tr]=Zt+2,Tr++}}ur===Gs&&(dl=Js<li?Ll:kr,Ku=Tr);const Xu=Js<li?Ll:kr;let Ds,er=!1;if(ur>=0)if(er=!0,Ds=jo(De,_n,ur,dl,Ku),Ds!==Zo&&Ds<a&&V[Ds]){const Zt=jo(De,_n,Gs,Xu,Tr);Zt!==Zo&&Zt!==Ds&&(Ds=Zt,er=!1)}else Ds===Zo&&(Ds=jo(De,_n,Gs,Xu,Tr),er=!1);else Ds=jo(De,_n,Gs,Xu,Tr);let fl=0,hl=0;Ds===Zo?cn[Hn]=Zo:(hl=er?1:0,fl=rs>=ja?ii?1:0:ge(Pe,De,rs,ja,ii?1:0,Zt=>Je(Zt,ii)),cn[Hn]=Ds,fn[Hn]=hl,Gt[Hn]=fl),Se(ss,De,It,St,Cr,Ds,fl,hl)}if(qe===0)return"";if(qe===1)return lt[0]===0&&wt[0]===Ge?De:De.slice(lt[0],wt[0]);if(qe*B>xn){for(;qe*B>xn;)xn<<=1,Wt--;un=new Float64Array(xn),ns=new Int32Array(xn)}if(_e>=Ue||At>=Ue)throw new Error("cn: too many distinct classes in one merge");Jn=Jn+1|0,Jn===0&&(on.fill(0),ns.fill(0),Jn=1);let Bt=!1;for(let Ct=qe-1;Ct>=0;Ct--){const It=cn[Ct];if(It===Zo){Bn[Ct]=1;continue}const an=Gt[Ct];if(wo(an,It)===1){Bn[Ct]=0,Bt=!0;continue}if(Bn[Ct]=1,It<a){const St=H[It];if(St>=0)for(let fs=R[St];fs<R[St+1];fs++)wo(an,M[fs]);if(fn[Ct]&1)for(let fs=0;fs<A.length;fs++)A[fs]===It&&wo(an,k[fs])}}if(!Bt&&!zt&&Ge===bt+qe-1)return De;let Nn="",hn=0;for(;hn<qe;){if(!Bn[hn]){hn++;continue}const Ct=lt[hn];let It=wt[hn],an=hn+1;for(;an<qe&&Bn[an]&&lt[an]===It+1&&De.charCodeAt(It)===32;)It=wt[an],an++;Nn.length>0&&(Nn+=" "),Nn+=De.slice(Ct,It),hn=an}return Nn},Fs=16384,ds=new Int32Array(Fs*2);let Ms=0,Pn=1,Un=Object.create(null),Os=Object.create(null),Nr=new Map,Gu=new Map,gc=0,xc=0;const ai=()=>{Ms^=Fs,Pn=Pn+1|0,xc=0},cl=De=>{let Ge=Un[De];if(Ge!==void 0)return Ge;const qe=xv(De,0,De.length),bt=(qe&16383)+Ms,zt=ds[bt]===(qe^Pn)||ds[bt^Fs]===(qe^Pn-1);return zt&&(Ge=Os[De],Ge!==void 0)?(Un[De]=Ge,Ge):(Ge=cr(De),zt?(Un[De]=Ge,++gc>ee&&(gc=0,Os=Un,Un=Object.create(null),ai())):(ds[bt]=qe^Pn,++xc>Fs&&ai()),Ge)},bc=De=>{let Ge=Nr.get(De);if(Ge!==void 0)return Ge;const qe=xv(De,0,De.length),bt=(qe&16383)+Ms,zt=ds[bt]===(qe^Pn)||ds[bt^Fs]===(qe^Pn-1);return zt&&(Ge=Gu.get(De),Ge!==void 0)?(Nr.set(De,Ge),Ge):(Ge=cr(De),zt?(Nr.set(De,Ge),++gc>ee&&(gc=0,Gu=Nr,Nr=new Map,ai())):(ds[bt]=qe^Pn,++xc>Fs&&ai()),Ge)},vc=De=>{const Ge=xv(De,0,De.length),qe=(Ge&16383)+Ms;return ds[qe]===(Ge^Pn)||ds[qe^Fs]===(Ge^Pn-1)?!0:(ds[qe]=Ge^Pn,++xc>Fs&&ai(),!1)},So=ee===0?cr:X_?De=>{const Ge=Nr.get(De);return Ge!==void 0?Ge:bc(De)}:cl;return{merge:function(){return arguments.length===1&&typeof arguments[0]=="string"?So(arguments[0]):So(Z_.apply(null,arguments))},mergeString:So,seenBefore:ee===0?()=>!1:vc,mergeUncached:cr}},Yp=(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 i=0;i<a.length;i++){const c=a[i];if(!c)continue;const u=typeof c=="string"?c:Yp(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},Q_=(e,t)=>{let r="";for(let a=0;a<e.length;a++){const i=e[a];if(!i)continue;const c=typeof i=="string"?i:Yp(i,t);c&&(r&&(r+=" "),r+=c)}return r},Z_=function(){return Q_(arguments,!1)},J_=(e,t)=>{const r=t===void 0?()=>!0:t.seenBefore,a=t===void 0?e:t.mergeUncached;let i=new Map,c=new Map,u=0,f=null;const m=(b,v,w,C)=>{let S=0;if(v){if(v!==b.a0)return!1;S=1}if(w){if(w!==(S===0?b.a0:b.a1))return!1;S++}if(C){if(C!==(S===0?b.a0:S===1?b.a1:b.a2))return!1;S++}return S===b.t},h=(b,v)=>{const w=b.a;let C=0;for(let S=0;S<v.length;S++){const N=v[S];if(N){if(N!==w[C])return!1;C++}}return C===b.t},g=(b,v)=>{const w=b.length,C=f===null?null:f.n;if(!v){if(C!==null&&h(C,b))return f=C,C.r;if(f!==null&&f!==C&&h(f,b))return f.r}let S="",N=-1,E=0,T=!1;for(let A=0;A<w;A++){let k=b[A];if(k){if(typeof k!="string"){if(k=b[A]=Yp(k,!0),!k)continue;T=!0}N<0&&(S=k,N=A),E++}}if(E===0)return"";if(E===1)return e(S);if(T){if(C!==null&&h(C,b))return f=C,C.r;if(f!==null&&f!==C&&h(f,b))return f.r}let R=i.get(S);R===void 0&&(R=c.get(S),R!==void 0&&i.set(S,R));let M=null;if(R!==void 0)e:for(let A=0;A<R.length;A++){const k=R[A];if(k.t!==E)continue;const O=k.a;let D=1;for(let _=N+1;_<w;_++){const H=b[_];if(H&&H!==O[D++])continue e}M=k;break}if(M===null){let A=S;const k=[S];for(let O=N+1;O<w;O++){const D=b[O];D&&(A+=" "+D,k.push(D))}if(!r(A))return a(A);M={r:e(A),t:k.length,a0:k[0],a1:k[1],a2:k[2]??"",a:k,n:null},R===void 0&&i.set(S,R=[]),R.length>=256&&R.shift(),R.push(M),++u>1e3&&(u=0,c=i,i=new Map)}return f!==null&&f!==M&&(f.n=M),f=M,M.r},p=b=>Array.isArray(b)?g(b.slice(),!1):e(Yp(b,!0));return function(b,v,w){const C=arguments.length;if((C|1)===3){const E=f;if(E!==null){const T=E.n;if(T!==null&&m(T,b,v,w))return f=T,T.r;if(E!==T&&m(E,b,v,w))return E.r}return g([b,v,w],!0)}if(C===1)return typeof b=="string"?e(b):p(b);const S=f;if(S!==null){const E=S.n;if(E!==null){const T=E.a;let R=0,M=!0;for(let A=0;A<C;A++){const k=arguments[A];if(k){if(k!==T[R]){M=!1;break}R++}}if(M&&R===E.t)return f=E,E.r}if(S!==E){const T=S.a;let R=0,M=!0;for(let A=0;A<C;A++){const k=arguments[A];if(k){if(k!==T[R]){M=!1;break}R++}}if(M&&R===S.t)return S.r}}const N=[];for(let E=0;E<C;E++)N.push(arguments[E]);return g(N,!0)}},kk=W_(K_),ws=J_(kk.mergeString,kk);/**
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 kA=(...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 eL=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 tL=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 Tk=e=>{const t=tL(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 nL={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 sL=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 rL=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:i="",children:c,iconNode:u,...f},m)=>x.createElement("svg",{ref:m,...nL,width:t,height:t,stroke:e,strokeWidth:a?Number(r)*24/Number(t):r,className:kA("lucide",i),...!c&&!sL(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,g])=>x.createElement(h,g)),...Array.isArray(c)?c:[c]]));/**
86
+ * @license lucide-react v0.577.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const at=(e,t)=>{const r=x.forwardRef(({className:a,...i},c)=>x.createElement(rL,{ref:c,iconNode:t,className:kA(`lucide-${eL(Tk(e))}`,`lucide-${e}`,a),...i}));return r.displayName=Tk(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 oL=[["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"}]],aL=at("activity",oL);/**
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 iL=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Pf=at("arrow-down",iL);/**
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 lL=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],K1=at("arrow-left",lL);/**
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 cL=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],mu=at("arrow-right",cL);/**
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 uL=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Zi=at("arrow-up-right",uL);/**
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 dL=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],_f=at("arrow-up",dL);/**
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 fL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],hL=at("ban",fL);/**
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 mL=[["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"}]],pL=at("book-open",mL);/**
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 gL=[["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"}]],TA=at("bot",gL);/**
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 xL=[["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"}]],hc=at("box",xL);/**
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 bL=[["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"}]],vL=at("building-2",bL);/**
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 yL=[["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"}]],wL=at("cable",yL);/**
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 jL=[["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"}]],SL=at("calendar-clock",jL);/**
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 NL=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Yn=at("check",NL);/**
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 CL=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ha=at("chevron-down",CL);/**
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 kL=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Lr=at("chevron-right",kL);/**
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 TL=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],EA=at("chevron-up",TL);/**
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 EL=[["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"}]],Ek=at("circle-alert",EL);/**
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 RL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],AL=at("circle-check",RL);/**
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 ML=[["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"}]],OL=at("circle-x",ML);/**
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 DL=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Kp=at("cloud",DL);/**
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 zL=[["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"}]],Lf=at("copy",zL);/**
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 IL=[["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"}]],X1=at("door-open",IL);/**
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 PL=[["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"}]],RA=at("door-closed",PL);/**
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 _L=[["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"}]],pu=at("download",_L);/**
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 LL=[["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"}]],AA=at("earth",LL);/**
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 $L=[["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"}]],Rk=at("ellipsis",$L);/**
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 BL=[["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"}]],VL=at("external-link",BL);/**
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 UL=[["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"}]],MA=at("file-code-corner",UL);/**
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 HL=[["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"}]],W1=at("file-text",HL);/**
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 FL=[["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"}]],GL=at("file",FL);/**
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 qL=[["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"}]],YL=at("folder-git-2",qL);/**
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 KL=[["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"}]],gf=at("folder-input",KL);/**
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 XL=[["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"}]],Ak=at("folder",XL);/**
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 WL=[["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"}]],Mk=at("funnel",WL);/**
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 QL=[["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"}]],Q1=at("globe",QL);/**
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 ZL=[["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"}]],OA=at("hard-drive",ZL);/**
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 JL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Du=at("info",JL);/**
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 e8=[["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"}]],zu=at("key-round",e8);/**
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 t8=[["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"}]],Z1=at("laptop",t8);/**
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 n8=[["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"}]],s8=at("layers",n8);/**
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 r8=[["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"}]],DA=at("link-2",r8);/**
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 o8=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],a8=at("list-filter",o8);/**
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 i8=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ql=at("loader-circle",i8);/**
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 l8=[["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"}]],Ok=at("lock",l8);/**
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 c8=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],u8=at("message-square",c8);/**
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 d8=[["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"}]],f8=at("monitor",d8);/**
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 h8=[["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"}]],m8=at("moon",h8);/**
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 p8=[["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"}]],Ig=at("network",p8);/**
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 g8=[["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"}]],zA=at("octagon-x",g8);/**
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 x8=[["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"}]],J1=at("package",x8);/**
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 b8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],v8=at("panel-left",b8);/**
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 y8=[["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"}]],w8=at("pause",y8);/**
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 j8=[["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"}]],Dk=at("pencil",j8);/**
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 S8=[["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"}]],IA=at("play",S8);/**
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 N8=[["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"}]],e2=at("plug",N8);/**
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 C8=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],vs=at("plus",C8);/**
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 k8=[["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"}]],rl=at("refresh-cw",k8);/**
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 T8=[["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"}]],E8=at("rotate-ccw",T8);/**
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 R8=[["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"}]],PA=at("rotate-cw",R8);/**
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 A8=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],M8=at("search",A8);/**
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 O8=[["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"}]],$f=at("server",O8);/**
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 D8=[["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"}]],Iu=at("shield-check",D8);/**
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 z8=[["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"}]],t2=at("shield-off",z8);/**
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 I8=[["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"}]],P8=at("sliders-horizontal",I8);/**
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 _8=[["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"}]],L8=at("square-code",_8);/**
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 $8=[["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"}]],B8=at("square-plus",$8);/**
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 V8=[["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"}]],_A=at("square-terminal",V8);/**
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 U8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],H8=at("square",U8);/**
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 F8=[["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"}]],G8=at("sun",F8);/**
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 q8=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],n2=at("terminal",q8);/**
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 Y8=[["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"}]],zk=at("timer",Y8);/**
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 K8=[["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"}]],ts=at("trash-2",K8);/**
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 X8=[["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"}]],ti=at("triangle-alert",X8);/**
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 W8=[["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"}]],Q8=at("upload",W8);/**
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 Z8=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],J8=at("user-round",Z8);/**
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 e7=[["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"}]],Ka=at("users",e7);/**
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 t7=[["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"}]],Ik=at("webhook",t7);/**
481
+ * @license lucide-react v0.577.0 - ISC
482
+ *
483
+ * This source code is licensed under the ISC license.
484
+ * See the LICENSE file in the root directory of this source tree.
485
+ */const n7=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],In=at("x",n7);function kt({className:e,...t}){return n.jsx(Ql,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:ws("size-4 animate-spin motion-reduce:animate-none",e),...t})}function s7(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 r7(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!s7(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 o7(e,t,r,a=ku){var i;return!!(a&&t&&e.source===t&&e.origin===a&&((i=e.data)==null?void 0:i.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 Ha(e,t,{signal:r,owner:a=XR()}={}){const i=await fetch(`/api/local-cloud/${e}`,{signal:r,method:t===void 0?"GET":"POST",headers:{...a?{"x-openrod-local-owner":a}:{},...t===void 0?{}:{"content-type":"application/json","x-openshell-console":"1"}},body:t===void 0?void 0:JSON.stringify(t)}),c=await i.json().catch(()=>({}));if((c.code==="CLOUD_OWNER_CHANGED"||i.status===401&&["machine","inventory"].includes(e))&&window.dispatchEvent(new Event("openrod-session-expired")),!i.ok)throw Object.assign(new Error(c.error??"Cloud connection unavailable"),{status:i.status});return c}const a7=(e,t)=>new Promise((r,a)=>{const i=()=>{clearTimeout(c),a(new DOMException("Cloud preparation cancelled.","AbortError"))},c=setTimeout(()=>{t==null||t.removeEventListener("abort",i),r()},e);t==null||t.addEventListener("abort",i,{once:!0}),t!=null&&t.aborted&&i()});async function LA(e,{signal:t,onProgress:r=()=>{},wait:a=a7,attempts:i=120}={}){var c,u,f;for(let m=0;m<i;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<i-1&&await a(5e3,t)}throw new Error("Your private machine is still preparing. Check its status before trying again.")}async function i7({owner:e,signal:t,onProgress:r,request:a=Ha,wait:i,attempts:c}={}){t==null||t.throwIfAborted();const u=await a("machine",{},{signal:t,owner:e});let f=!0;return LA(async()=>{const m=f?u:await a("machine",void 0,{signal:t,owner:e});if(f=!1,m.owner!==e)throw new Error("Your cloud account changed. Choose the destination again.");return m},{signal:t,onProgress:r,wait:i,attempts:c})}async function $A(e,t,r,a){const i=await e.cloudExport(r),c=await t.importCloud(a?{...i.bundle,destinationGroups:a}:i.bundle);return{...c,warning:c.warning||i.warning}}async function l7(e,t,r,a){if(t.target!=="local")throw Error("Choose a local destination for this workspace.");return $A(e,t,r,a)}async function c7(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 u7({popup:e,origin:t,cloud:r=ku,request:a=Ha,events:i=window,focus:c=()=>window.focus(),setTimer:u=setInterval,clearTimer:f=clearInterval,now:m=Date.now}){let h,g=!1,p=!1,b,v;const w=new Promise((M,A)=>{b=M,v=A}),C=async()=>{h&&await a("cancel",{nonce:h}).catch(()=>{})},S=()=>{f(R),i.removeEventListener("message",E)};function N(M="Cloud sign-in was cancelled."){return p?Promise.resolve():(p=!0,S(),e.close(),v(new Error(M)),C())}const E=async M=>{if(!(p||g||!h||!o7(M,e,h,r))){g=!0;try{const A=await a("finish",{nonce:h,code:M.data.code});if(p){await C();return}if(!A.connected||!A.user)throw new Error("Sign-in did not finish. Try again.");p=!0,S(),e.close(),c(),b(A)}catch(A){if(p){await C();return}await N(A.message)}}},T=m()+15*6e4,R=u(()=>{(e.closed||m()>T)&&N(e.closed?"Cloud sign-in was cancelled.":"Cloud sign-in timed out. Try again.")},500);return i.addEventListener("message",E),Promise.resolve().then(async()=>{if(p)return;const M=await a("start",{origin:t});if(h=M.nonce,p){await C();return}e.location.href=M.url}).catch(M=>{p||N(M.message)}),{promise:w,cancel:N}}const Pg=x.createContext(null),BA=x.createContext(null),js=()=>x.useContext(Pg);function Bf(){const e=x.useContext(BA);if(!e)throw new Error("useApi outside ComputeSession");return e}function d7({target:e,children:t}){const r=js(),a=x.useMemo(()=>e&&(r!=null&&r.localViewer)?{...r,target:e,nativeActions:e==="local"||!!r.connected}:r,[r,e]);return n.jsx(Pg.Provider,{value:a,children:t})}function Ny({target:e,ownerScope:t,children:r}){const a=x.useMemo(()=>{const i=new AbortController;return{controller:i,generation:0,api:lr(e,i.signal)}},[e,t]);return x.useEffect(()=>{const i=++a.generation;return()=>queueMicrotask(()=>{i===a.generation&&a.controller.abort()})},[a]),n.jsx(BA.Provider,{value:a.api,children:r})}function f7({children:e,user:t,logout:r}){YR("cloud");const a={target:"cloud",localViewer:!1,nativeActions:!1,user:t,logout:r,connected:!0,available:!0};return n.jsx(Pg.Provider,{value:a,children:n.jsx(Ny,{target:"local",children:e})})}function h7({children:e,status:t,onStatus:r,onCancel:a}){var w;const[i,c]=x.useState(((w=t.machine)==null?void 0:w.status)==="ready"),[u,f]=x.useState(t.machine),[m,h]=x.useState(""),[g,p]=x.useState(0),[b,v]=x.useState(!1);return x.useEffect(()=>{if(i)return;const C=new AbortController;return h(""),Ha("machine",b?{}:void 0,{signal:C.signal}).then(S=>{var N;return((N=S.machine)==null?void 0:N.status)==="none"?(f(S.machine),null):LA(()=>Ha("machine",void 0,{signal:C.signal}),{signal:C.signal,onProgress:E=>{f(E.machine),r(E)}})}).then(S=>{S&&c(!0)}).catch(S=>{S.name!=="AbortError"&&h(S.message)}),()=>C.abort()},[g,i,r,b]),i?e:n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-sm text-center",children:[n.jsx("h1",{className:"text-2xl font-semibold",children:(u==null?void 0:u.status)==="none"?"Start OpenRod Cloud":"Starting your cloud machine…"}),n.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."}),(u==null?void 0:u.status)==="none"&&!m&&n.jsx(le,{className:"mt-5",onClick:()=>v(!0),children:"Start cloud machine"}),m&&n.jsxs(n.Fragment,{children:[n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:m}),n.jsx("button",{className:"mt-4 text-sm underline",onClick:()=>{v(!0),p(C=>C+1)},children:"Try again"})]}),n.jsx("button",{className:"mt-6 block w-full text-xs underline",onClick:a,children:"Use local compute"}),ku&&n.jsx("a",{href:ku,target:"_blank",rel:"noopener noreferrer",className:"mt-4 block text-xs underline",children:"Open cloud console"})]})})}function m7({children:e}){var A;const[t,r]=x.useState("local"),[a,i]=x.useState(null),[c,u]=x.useState(""),[f,m]=x.useState(!1),[h,g]=x.useState(!1),p=x.useRef(null),b=x.useCallback(async k=>{const O=await Ha("status",void 0,{signal:k});return i(D=>({...D,...O})),u(O.error??""),O},[]),v=x.useRef({uid:null,revision:0});YR(t),ik(a!=null&&a.connected?a.owner:null),x.useEffect(()=>{let k=!0;Ha("status").then(D=>{k&&(i(D),u(D.error??""))}).catch(D=>{k&&(u(D.message),i({connected:!1,available:!1}))});const O=()=>{i(D=>({...D,connected:!1,machine:null})),u("Your cloud connection expired. Connect again to continue.")};return window.addEventListener("openrod-session-expired",O),()=>{var D;k=!1,window.removeEventListener("openrod-session-expired",O),(D=p.current)==null||D.cancel("Cloud connection cancelled.")}},[]),x.useEffect(()=>{if(!(a!=null&&a.connected)||!a.expires)return;const k=typeof a.expires=="number"?a.expires:Date.parse(a.expires);if(!Number.isFinite(k))return;const O=setTimeout(()=>{i(D=>({...D,connected:!1,machine:null})),u("Your cloud connection expired. Connect again to continue.")},Math.max(0,k-Date.now()));return()=>clearTimeout(O)},[a]);function w(k){if(!["local","cloud"].includes(k))return;try{sessionStorage.setItem(ZP,k)}catch{}const O=new URL(window.location.href);O.searchParams.delete("target"),O.hash="",window.history.replaceState(null,"",O),window.dispatchEvent(new HashChangeEvent("hashchange")),r(k)}async function C(){if(a!=null&&a.connected)return a;if(!(a!=null&&a.available))throw new Error((a==null?void 0:a.reason)||"OpenRod Cloud is not configured on this computer.");if(p.current)throw new Error("A cloud sign-in is already open.");const k=window.open("about:blank","_blank","popup,width=760,height=720");if(!k)throw new Error("Allow popups to connect your local OpenRod to cloud.");const O=u7({popup:k,origin:window.location.origin,cloud:a.origin||ku});p.current=O,m(!0),u("");try{const D=await O.promise;if(p.current!==O)throw new Error("Cloud sign-in was cancelled.");return ik(D.owner),i(_=>({..._,...D})),D}catch(D){throw p.current===O&&u(D.message),D}finally{p.current===O&&(p.current=null,m(!1))}}function S(k="Cloud connection cancelled."){const O=p.current;if(O)return p.current=null,m(!1),u(k),O.cancel(k)}async function N(){try{const k=await Ha("disconnect",{});i(k),w("local")}catch(k){throw[401,403].includes(k.status)&&(i(O=>({...O,connected:!1,machine:null})),w("local")),u(k.message),k}}async function E({signal:k,onProgress:O}={}){k==null||k.throwIfAborted();const D=C(),_=p.current,H=()=>{_&&p.current===_&&S()};k==null||k.addEventListener("abort",H,{once:!0});let G;try{G=await D}finally{k==null||k.removeEventListener("abort",H)}k==null||k.throwIfAborted();const B=G.owner;return i7({owner:B,signal:k,onProgress:V=>{if(V.owner!==B)throw new Error("Your cloud account changed. Choose the destination again.");i(q=>({...q,...V})),O==null||O(V)}})}v.current=e6(v.current,a!=null&&a.connected?(A=a.user)==null?void 0:A.uid:null);const T=v.current.revision,R=`${t}:${T}`,M={target:t,status:a,available:!!(a!=null&&a.available),checking:a===null,refresh:b,prepare:E,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:C,disconnect:N,selectTarget:w,createRequested:h,requestCreate:g,cancelConnect:()=>S()};return n.jsx(Pg.Provider,{value:M,children:t==="cloud"&&!(a!=null&&a.connected)?n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-sm text-center",children:[n.jsx("h1",{className:"text-2xl font-semibold",children:"Connect your cloud workspace"}),n.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&&n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:c}),n.jsxs(le,{disabled:!(a!=null&&a.available)||f,className:"mt-6",onClick:()=>C().catch(()=>{}),children:[f&&n.jsx(kt,{}),a===null?"Checking connection…":f?"Connecting…":"Continue with Google"]}),a&&!a.available&&n.jsx("p",{role:"status",className:"mt-3 text-xs text-muted-foreground",children:a.reason||"OpenRod Cloud is not configured on this computer."}),n.jsx("button",{className:"mt-4 block w-full text-xs underline",onClick:()=>{S(),w("local")},children:"Use local compute"})]})}):t==="cloud"?n.jsx(h7,{status:a,onStatus:i,onCancel:()=>w("local"),children:n.jsx(Ny,{target:t,ownerScope:T,children:e},R)},`cloud:${T}`):n.jsx(Ny,{target:t,ownerScope:T,children:e},R)})}function ra(e){return Array.isArray(e)?e.map(ra):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>[t,ra(e[t])])):e}const bv=(e,t)=>Object.fromEntries(Object.entries(e).filter(([r])=>!t.includes(r))),Cy=["location","copies","sourceOrg","sourceSetups","id","createdAt","updatedAt","revision","importedAt","importSource","localSource","configurationCount"];function ky(e,t){if(e==="network"&&t.sourceOrg){const r=u=>{var m;const f=t.sourceOrg.groups.find(h=>h.id===u);return f?bv(ky("groups",f),["template"]):{missing:u,source:(m=t.location)==null?void 0:m.id}},a=u=>{var m,h;const f=(m=t.sourceSetups)==null?void 0:m.find(g=>g.id===u);return f?ky("setups",f):{missing:u,source:(h=t.location)==null?void 0:h.id}},i=u=>u.map(f=>ra(f)).sort((f,m)=>JSON.stringify(f).localeCompare(JSON.stringify(m))),c=bv(t,Cy);return{...c,destinations:i(c.destinations),appliesTo:{...c.appliesTo,groups:i(c.appliesTo.groups.map(r)),setups:i((c.appliesTo.setups??[]).map(a)),sandboxes:i(c.appliesTo.sandboxes)},...c.setup?{setup:{...c.setup,id:a(c.setup.id)}}:{}}}return e==="setups"?{name:t.name,items:t.items.map(r=>({name:r.name,kind:r.kind,contentDigest:r.contentDigest??t.revision})).sort((r,a)=>JSON.stringify(r).localeCompare(JSON.stringify(a)))}:e==="templates"?{name:t.name,recipe:t.recipe,managed:t.managed,status:t.status,exists:t.exists}:bv(t,Cy)}const Bi=(e,t)=>JSON.stringify(ra(ky(e,t)));function xf(e,t){const r=[];for(const a of t){const i=e!=="network"&&a.name?JSON.stringify([e,a.name]):Bi(e,a),c=r.find(u=>u.key===i&&!u.copies.some(f=>{var m,h;return((m=f.location)==null?void 0:m.id)===((h=a.location)==null?void 0:h.id)}));c?c.copies.push(a):r.push({key:i,copies:[a]})}return r.map(({copies:a})=>({...a.find(i=>{var c;return((c=i.location)==null?void 0:c.connected)!==!1})??a[0],copies:a,configurationCount:new Set(a.map(i=>Bi(e,i))).size}))}const s2=e=>(e==null?void 0:e.copies)??(e?[e]:[]);function p7(e,t){const r=s2(e);return t.filter(a=>{var i,c;return((i=a.location)==null?void 0:i.id)!==((c=e.location)==null?void 0:c.id)&&r.some(u=>{var f,m;return((f=u.location)==null?void 0:f.id)===((m=a.location)==null?void 0:m.id)&&(u.id??u.name)===(a.id??a.name)})&&t.filter(u=>{var f,m;return((f=u.location)==null?void 0:f.id)===((m=a.location)==null?void 0:m.id)&&(u.id??u.name)===(a.id??a.name)}).length===1})}function VA(e,t,r){if(t&&typeof t=="object"&&!Array.isArray(t)){const a={...r};for(const[i,c]of Object.entries(t))JSON.stringify(ra(e==null?void 0:e[i]))!==JSON.stringify(ra(c))&&(a[i]=VA(e==null?void 0:e[i],c,r==null?void 0:r[i]));return a}return t}async function g7({type:e,before:t,args:r,method:a},i,c){var g,p;if(!((g=i.location)!=null&&g.connected))throw new Error("Reconnect this source before applying changes.");const u=e==="setups"?await c.setups():e==="templates"?await c.imageTemplates():(await c.org())[e==="network"?"policies":"groups"],f=(Array.isArray(u)?u:u.templates??[]).find(b=>(b.id??b.name)===(i.id??i.name));if(!f||Bi(e,{...f,sourceOrg:void 0,sourceSetups:void 0})!==Bi(e,{...i,sourceOrg:void 0,sourceSetups:void 0}))throw new Error("This source changed. Reopen it before applying the edit.");if(a==="deleteSetupItem"){const b=t.items.find(w=>w.id===r[1]),v=f.items.filter(w=>w.name===(b==null?void 0:b.name)&&w.kind===(b==null?void 0:b.kind)&&(b.contentDigest?w.contentDigest===b.contentDigest:f.revision===t.revision));if(v.length!==1)throw new Error("The matching item differs on this source. Edit it separately.");return c.deleteSetupItem(f.id,v[0].id,f.revision)}const m={},h=e==="templates"?t.recipe:t;for(const[b,v]of Object.entries(r[0]))Cy.includes(b)||b==="isNew"||e==="templates"&&b==="environment"||JSON.stringify(ra(h[b]))!==JSON.stringify(ra(v))&&(m[b]=VA(h[b],v,(e==="templates"?f.recipe:f)[b]));if(a==="savePolicy"){const b=await c.org(),v={...f,...m,id:f.id,isNew:!1};if(m.appliesTo){v.appliesTo={...f.appliesTo};for(const[w,C]of Object.entries(m.appliesTo))JSON.stringify(ra(C))!==JSON.stringify(ra(t.appliesTo[w]))&&(w==="groups"?v.appliesTo.groups=C.map(S=>{var T;const N=(T=t.sourceOrg)==null?void 0:T.groups.find(R=>R.id===S),E=N?b.groups.filter(R=>Bi("groups",R)===Bi("groups",N)):b.groups.filter(R=>R.id===S);if(E.length!==1)throw new Error("A changed group is missing or ambiguous here. Import or select it separately.");return E[0].id}):v.appliesTo[w]=C)}if(v.appliesTo.groups.some(w=>!b.groups.some(C=>C.id===w)))throw new Error("A required group is missing here. Import it first.");if((p=v.appliesTo.setups)!=null&&p.length){const w=await c.setups();if(v.appliesTo.setups.some(C=>!w.some(S=>S.id===C)))throw new Error("A required setup is missing here. Import it first.")}return c.savePolicy(v)}if(a==="saveGroup")return c.saveGroup({...f,...m,id:f.id,isNew:!1});if(a==="buildImageTemplate"){if(!Object.keys(m).length)throw new Error("Only environment values changed. Enter them on this source separately.");return c.buildImageTemplate({...f.recipe,...m,name:f.name},!0)}throw new Error("This change must be made separately on each source.")}const nc={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"}},xp=e=>{var t;return e!=null&&e.cloud||(e==null?void 0:e.target)==="cloud"?"cloud":((t=nc[e==null?void 0:e.placement])==null?void 0:t.id)??(e!=null&&e.remote?"remote":"local")},Dn=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"),ht=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])},Pk=new WeakMap;async function x7(e,t,r=1e3){const a=Pk.get(e),i=en.startFlow("gateway_connection",{location_type:"local"},(a==null?void 0:a.outcome)==="failed"?a:null);Pk.set(e,i);try{let c=await e.connect({localGateway:t});for(;c.status==="working";)await new Promise(u=>setTimeout(u,r)),c=await e.connectionJob(c.id);if(c.status!=="ready")throw new Error(c.error||`Couldn’t connect to ${t}.`);return en.finishFlow(i,"connected"),c}catch(c){throw en.finishFlow(i,"failed",Cu(c)),c}}const vv=({x:e,y:t})=>n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:e-1.6,cy:t,r:".7",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:e+1.6,cy:t,r:".7",fill:"currentColor",stroke:"none"}),n.jsx("path",{d:`M${e-1.1} ${t+1.5}q1.1 1 2.2 0`})]}),b7={local:()=>n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"2.5",y:"2.5",width:"11",height:"8",rx:"1.8"}),n.jsx("path",{d:"M1 13.5h14"}),n.jsx(vv,{x:8,y:6})]}),remote:()=>n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"3",y:"5",width:"10",height:"9",rx:"2"}),n.jsx("path",{d:"M5.8 3a3.2 3.2 0 0 1 4.4 0"}),n.jsx("circle",{cx:"8",cy:"1.6",r:".55",fill:"currentColor",stroke:"none",className:"motion-safe:animate-pulse"}),n.jsx(vv,{x:8,y:8.8})]}),cloud:()=>n.jsxs(n.Fragment,{children:[n.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"}),n.jsx("path",{d:"M13.6 1.2v2M12.6 2.2h2",className:"motion-safe:animate-pulse"}),n.jsx(vv,{x:7.6,y:9.6})]})},v7={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 y7({type:e,className:t="size-3.5"}){const r=b7[e];return n.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:n.jsx(r,{})})}function UA({type:e,title:t}){return n.jsxs("span",{title:t,className:`inline-flex h-5 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-full pr-2 pl-1.5 font-sans text-[11px] leading-none font-medium ring-1 ring-inset ${v7[e]}`,children:[n.jsx(y7,{type:e}),nc[e].label]})}function Hs({location:e}){const t=xp(e);return n.jsx(UA,{type:t,title:`${nc[t].hint} · ${Dn(e)}`})}function po({controlled:e,default:t,name:r,state:a="value"}){const{current:i}=x.useRef(e!==void 0),[c,u]=x.useState(t),f=i&&e!==void 0?e:c,m=x.useCallback(h=>{i||u(h)},[]);return[f,m]}const HA={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},_g={...HA,position:"fixed",top:0,left:0},r2={...HA,position:"absolute"};function w7(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 j7="data-valid",S7="data-invalid",N7={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},C7={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},k7={disabled:!1,...C7},Lg={valid(e){return e===null?null:e?{[j7]:""}:{[S7]:""}}},T7="data-checked",E7="data-unchecked";function FA(e){return{checked(t){return e.indeterminate?{}:t?{[T7]:""}:{[E7]:""}},...Lg}}let _k=0;function R7(e,t="mui"){const[r,a]=x.useState(e),i=e||r;return x.useEffect(()=>{r==null&&(_k+=1,a(`${t}-${_k}`))},[r,t]),i}const Lk=U1.useId;function sc(e,t){if(Lk!==void 0){const r=Lk();return e??(t?`${t}-${r}`:r)}return R7(e,t)}function ys(e){return sc(e,"base-ui")}const A7={invalid:void 0,name:void 0,validityData:{state:N7,errors:[],error:"",value:"",initialValue:null},setValidityData:Ln,disabled:void 0,setTouched:Ln,setDirty:Ln,setFilled:Ln,setFocused:Ln,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:k7,registerFieldControl:Ln,validation:{getValidationProps:(e,t=En)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Ln,getInputControl:()=>null,commit:async()=>{},change:Ln}},M7=x.createContext(A7);function Pu(e=!0){const t=x.useContext(M7);if(t.setValidityData===Ln&&!e)throw new Error(rn(28));return t}function $g(e,t,r,a,i=!0,c){const{registerFieldControl:u}=Pu(),f=bs(()=>Symbol());We(()=>{const m=f.current;if(!i){u(m,void 0);return}u(m,{controlRef:e,getValue:a,id:t,name:c,value:r})},[e,i,a,t,c,u,f,r]),We(()=>{const m=f.current;return()=>{u(m,void 0)}},[u,f])}const O7=x.createContext({disabled:!1});function D7(){return x.useContext(O7)}const z7=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Ln,validationMode:"onSubmit",submitCountRef:{current:0}});function Bg(){return x.useContext(z7)}const I7=x.createContext({controlId:void 0,registerControlId:Ln,resetControlId:Ln,labelId:void 0,setLabelId:Ln,messageIds:[],setMessageIds:Ln,getDescriptionProps:e=>e});function Vf(){return x.useContext(I7)}function GA(e,t,r,a=!0,i){const[c,u]=x.useState(),f=ys(i?`${i}-label`:void 0),m=e??t??c;return We(()=>{const h=e||t||!a?void 0:P7(r.current,f);c!==h&&u(h)}),m}function P7(e,t){const r=_7(e);if(r)return!r.id&&t&&(r.id=t),r.id||void 0}function _7(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const r=e.id;if(r){const i=e.nextElementSibling;if(i&&i.htmlFor===r)return i}const a=e.labels;return a&&a[0]}function Uf(e={}){const{id:t,enabled:r=!0}=e,{controlId:a,registerControlId:i,resetControlId:c}=Vf(),u=ys(),f=bs(()=>Symbol()),m=x.useRef(!1),h=x.useRef(!1),g=st(()=>{!m.current||i===Ln||(m.current=!1,i(f.current,void 0))});return We(()=>{if(!r||i===Ln){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,i(f.current,p)},[t,r,i,c,u,f,g]),We(()=>g,[g]),(r?a:void 0)??t??u}const L7=x.createContext(void 0);function $7(){return x.useContext(L7)}const qA=x.createContext(void 0);function B7(){const e=x.useContext(qA);if(e===void 0)throw new Error(rn(14));return e}const Ur="none",ma="trigger-press",Qn="trigger-hover",gu="trigger-focus",Vg="outside-press",Zl="item-press",YA="close-press",Ji="focus-out",Hf="escape-key",Ty="list-navigation",KA="cancel-open",Xd="sibling-open",XA="disabled",$k="missing",Bk="initial",Ug="imperative-action",V7="window-resize";function yt(e,t,r,a){let i=!1,c=!1;const u=a??En;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){c=!0},get isCanceled(){return i},get isPropagationAllowed(){return c},trigger:r,...u}}function Ff(e,t){const r=x.useRef(e),a=st(t);We(()=>{r.current!==e&&a(r.current),r.current=e},[e,a])}const U7="data-parent",H7=x.forwardRef(function(t,r){const{checked:a,className:i,defaultChecked:c=!1,"aria-labelledby":u,disabled:f=!1,form:m,id:h,indeterminate:g=!1,inputRef:p,name:b,onCheckedChange:v,parent:w=!1,readOnly:C=!1,render:S,required:N=!1,uncheckedValue:E,value:T,nativeButton:R=!1,style:M,...A}=t,{clearErrors:k}=Bg(),{disabled:O,name:D,setDirty:_,setFilled:H,setFocused:G,setTouched:B,state:P,validationMode:V,validityData:q,validation:W}=Pu(),K=D7(),{labelId:J,registerControlId:z,getDescriptionProps:L}=Vf(),X=$7(),ee=(X==null?void 0:X.allValues)===void 0?void 0:X.parent,$=ee!==void 0,U=O||K.disabled||(X==null?void 0:X.disabled)||f,F=D??b,Y=T??F,ne=ys(),te=(X==null?void 0:X.registerControlId)!==z,ye=Uf({id:h||void 0,enabled:te}),ae=R?ye:ne;let ue={};$&&(w?ue=ee.getParentProps():Y!==void 0&&(ue=ee.getChildProps(Y)));const{checked:se=a,indeterminate:Q=g,onCheckedChange:ie,...oe}=ue,pe=X==null?void 0:X.value,xe=x.useRef(null),{getButtonProps:je,buttonRef:Ie}=bo({disabled:U,native:R}),ce=(X==null?void 0:X.validation)??W,[Te,re]=po({controlled:Y!==void 0&&pe!==void 0&&!w?pe.includes(Y):se,default:c,name:"Checkbox",state:"checked"}),fe=$?!!se:Te,Re=$&&Q||g;$g(xe,ne,Te,void 0,!X&&!U,b);const Oe=ee==null?void 0:ee.registerChildId,ke=x.useRef(null),he=ce.registerInput,Ae=X?Y:void 0,ge=x.useCallback(rt=>he(rt,{controlRef:xe,value:Ae}),[he,Ae]),Pe=mo(p,ke,w?void 0:ge),Fe=GA(u,J,ke,!R,ye);We(()=>{ke.current&&(ke.current.indeterminate=Re),X||H(Te)},[Te,Re,X,H]),Ff(Te,()=>{X||(k(F),_(Te!==q.initialValue),ce.change(Te))});const _e=Qs({checked:Te,disabled:U,form:m,name:w?void 0:F,id:R?void 0:ye,required:N,ref:Pe,style:F?r2:_g,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(rt){if(rt.nativeEvent.defaultPrevented)return;if(C){rt.preventDefault();return}const ve=rt.currentTarget.checked,Ue=yt(Ur,rt.nativeEvent);if(v==null||v(ve,Ue),!Ue.isCanceled&&(ie==null||ie(ve,Ue),!Ue.isCanceled&&(re(ve),Y!==void 0&&X!==void 0&&!w&&!$))){const Qe=ve?[...X.value,Y]:X.value.filter(xt=>xt!==Y);X.setValue(Qe,Ue)}},onClick(rt){rt.stopPropagation()},onFocus(){var rt;(rt=xe.current)==null||rt.focus()}},T!==void 0?{value:(X?Te&&T:T)||""}:En,L,rt=>ce.getValidationProps(U,rt));x.useEffect(()=>{if(!ee||Y===void 0)return;const rt=ee.disabledStatesRef.current;return rt.set(Y,U),()=>{rt.delete(Y)}},[ee,U,Y]);const Xe=x.useMemo(()=>({...P,checked:fe,disabled:U,readOnly:C,required:N,indeterminate:Re}),[P,fe,U,C,N,Re]),Je=FA(Xe),ct=Nt("span",t,{state:Xe,ref:[Ie,xe,r],props:[{id:ae,role:"checkbox","aria-checked":Re?"mixed":fe,"aria-readonly":C||void 0,"aria-required":N||void 0,"aria-labelledby":Fe,[U7]:w?"":void 0,onFocus(){U||G(!0)},onBlur(){const rt=ke.current;rt&&(B(!0),G(!1),V==="onBlur"&&ce.commit(X?pe:rt.checked))},onKeyDown(rt){var jt;if(rt.key!=="Enter"||(rt.preventBaseUIHandler(),rt.defaultPrevented))return;const ve=((jt=ke.current)==null?void 0:jt.form)??null,Ue=rt.currentTarget,Qe=rt.nativeEvent,xt=rt.preventDefault,Ke=Qe.preventDefault;let Be=!1;rt.preventDefault=()=>{Be=!0,xt.call(rt)},Qe.preventDefault=()=>{Be=!0,Ke.call(Qe)},Ke.call(Qe),Rn(Ue).queueMicrotask(()=>{var Ze;rt.preventDefault=xt,Qe.preventDefault=Ke,Be||(Ze=w7(ve))==null||Ze.click()})},onClick(rt){if(C||U)return;rt.preventDefault();const ve=ke.current;ve&&hu(ve,rt)}},A,oe,je,L,rt=>ce.getValidationProps(U,rt)],stateAttributesMapping:Je}),At=ct.props.id;return We(()=>{if(!(!Oe||w||Y===void 0||At===void 0))return Oe(Y,At)},[Oe,w,Y,At]),n.jsxs(qA.Provider,{value:Xe,children:[ct,!Te&&!X&&F&&!w&&E!==void 0&&n.jsx("input",{type:"hidden",form:m,name:F,value:E,disabled:U}),n.jsx("input",{..._e,suppressHydrationWarning:!0})]})});var go=FR();const F7=VR(go);function o2(e){x.useEffect(e,Vr)}const Dm=null;class G7{constructor(){ln(this,"callbacks",[]);ln(this,"callbacksCount",0);ln(this,"nextId",1);ln(this,"startId",1);ln(this,"isScheduled",!1);ln(this,"tick",t=>{var i;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)(i=r[c])==null||i.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 zm=new G7;class wr{constructor(){ln(this,"currentId",Dm);ln(this,"cancel",()=>{this.currentId!==Dm&&(zm.cancel(this.currentId),this.currentId=Dm)});ln(this,"disposeEffect",()=>this.cancel)}static create(){return new wr}static request(t){return zm.request(t)}static cancel(t){return zm.cancel(t)}request(t){this.cancel(),this.currentId=zm.request(()=>{this.currentId=Dm,t()})}}function Eu(){const e=bs(wr.create).current;return o2(e.disposeEffect),e}function _a(e){return e==null?e:"current"in e?e.current:e}const a2="data-starting-style",q7="data-ending-style";let Im=null;function Y7(e){if(!Im){const t=[];Im=t,queueMicrotask(()=>{Im=null,go.flushSync(()=>{for(const r of t)r()})})}Im.push(e)}function Gf(e,t=!1,r=!1){const a=Eu();return st((i,c=null)=>{a.cancel();const u=_a(e);if(u==null)return;const f=u,m=()=>{if(!r){go.flushSync(i);return}Y7(()=>{c!=null&&c.aborted||i()})};if(typeof f.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();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=a2;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 Sr(e){const{enabled:t=!0,open:r,ref:a,batch:i=!1,onComplete:c}=e,u=st(c),f=Gf(a,r,i);x.useEffect(()=>{if(!t)return;const m=new AbortController;return f(u,m.signal),()=>{m.abort()}},[t,r,u,f])}function ni(e,t=!1,r=!1,a=!1){const[i,c]=x.useState(e&&t?"idle":void 0),[u,f]=x.useState(e&&!a);return e&&!u&&(f(!0),c("starting")),!e&&u&&i!=="ending"&&!r&&c("ending"),!e&&!u&&i==="ending"&&c(void 0),We(()=>{if(!e&&u&&i!=="ending"&&r){const m=wr.request(()=>{c("ending")});return()=>{wr.cancel(m)}}},[e,u,i,r]),We(()=>{if(!e||t)return;const m=wr.request(()=>{c(void 0)});return()=>{wr.cancel(m)}},[t,e]),We(()=>{if(!e||!t)return;e&&u&&i!=="idle"&&c("starting");const m=wr.request(()=>{c("idle")});return()=>{wr.cancel(m)}},[t,e,u,i]),{mounted:u,setMounted:f,transitionStatus:i}}const K7={[a2]:""},X7={[q7]:""},si={transitionStatus(e){return e==="starting"?K7:e==="ending"?X7:null}},W7=x.forwardRef(function(t,r){const{render:a,className:i,style:c,keepMounted:u=!1,...f}=t,m=B7(),h=m.checked||m.indeterminate,{mounted:g,transitionStatus:p,setMounted:b}=ni(h),v=x.useRef(null),w={...m,transitionStatus:p};Sr({batch:!0,enabled:!h,open:h,ref:v,onComplete(){h||b(!1)}});const S={...FA(m),...si},N=u||g,E=Nt("span",t,{ref:[r,v],state:w,stateAttributesMapping:S,props:f});return N?E:null});function $o({className:e,...t}){return n.jsx(H7,{"data-slot":"checkbox",className:ws("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:n.jsx(W7,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:n.jsx(Yn,{})})})}const WA=x.createContext(void 0);function mc(e){const t=x.useContext(WA);if(!e&&t===void 0)throw new Error(rn(27));return t}const Q7="data-open",Z7="data-closed",J7="data-anchor-hidden",QA="data-popup-open",e$="data-pressed",t$={[QA]:""},n$={[QA]:"",[e$]:""},s$={[Q7]:""},r$={[Z7]:""},o$={[J7]:""},i2={open(e){return e?t$:null}},Xp={open(e){return e?n$:null}},qf={open(e){return e?s$:r$},anchorHidden(e){return e?o$:null}},Hg={...qf,...si},l2=x.forwardRef(function(t,r){const{render:a,className:i,style:c,forceRender:u=!1,...f}=t,m=mc(),h=m.useState("open"),g=m.useState("nested"),p=m.useState("mounted"),b=m.useState("transitionStatus");return Nt("div",t,{state:{open:h,transitionStatus:b},ref:[m.context.backdropRef,r],stateAttributesMapping:Hg,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:u||!g})}),Fg=x.forwardRef(function(t,r){const{render:a,className:i,style:c,disabled:u=!1,nativeButton:f=!0,...m}=t,h=mc(),g=h.useState("open"),{getButtonProps:p,buttonRef:b}=bo({disabled:u,native:f}),v={disabled:u};function w(C){g&&h.setOpen(!1,yt(YA,C.nativeEvent))}return Nt("button",t,{state:v,ref:[r,b],props:[{onClick:w},m,p]})}),c2=x.forwardRef(function(t,r){const{render:a,className:i,style:c,id:u,...f}=t,m=mc(),h=ys(u);return m.useSyncedValueWithCleanup("descriptionElementId",h),Nt("p",t,{ref:r,props:[{id:h},f]})}),Vd=0;class xo{constructor(){ln(this,"currentId",Vd);ln(this,"clear",()=>{this.currentId!==Vd&&(clearTimeout(this.currentId),this.currentId=Vd)});ln(this,"disposeEffect",()=>this.clear)}static create(){return new xo}start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Vd,r()},t)}isStarted(){return this.currentId!==Vd}}function us(){const e=bs(xo.create).current;return o2(e.disposeEffect),e}function a$(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:i$,platform:l$,maxTouchPoints:c$}=a$(),Gg=i$.toLowerCase(),bf=l$.toLowerCase(),qg=/^i(os$|p)/.test(bf)||bf==="macintel"&&c$>1,Vk="android",Ey=bf===Vk||Gg.includes(Vk),u2=!qg&&bf.startsWith("mac");bf.startsWith("win");const u$=u2||qg;var BR;const ri=typeof CSS<"u"&&!!((BR=CSS.supports)!=null&&BR.call(CSS,"-webkit-backdrop-filter:none"));!ri&&Gg.includes("firefox");!ri&&Gg.includes("chrom");const d$=u$,d2=/jsdom|happydom/.test(Gg);function ta(e){e.preventDefault(),e.stopPropagation()}function f$(e){return"nativeEvent"in e}function Yg(e){return e.pointerType===""&&e.isTrusted?!0:Ey&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function f2(e){return d2?!1:!Ey&&e.width===0&&e.height===0||Ey&&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 Hi(e,t){const r=["mouse","pen"];return t||r.push("",void 0),r.includes(e)}function h$(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Xs(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 gt(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&&Tu(r)){let i=t;for(;i;){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function Vs(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Ry="data-base-ui-focusable",ZA="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Kg="ArrowLeft",Xg="ArrowRight",JA="ArrowUp",h2="ArrowDown",Ay="data-trigger-disabled";function Wp(e,t){if(!Ft(e))return!1;const r=e;if(t.hasElement(r))return!r.hasAttribute(Ay);for(const[,a]of t.entries())if(gt(a,r))return!a.hasAttribute(Ay);return!1}function yv(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 m$(e){return e.matches("html,body")}function Wg(e){return wn(e)&&e.matches(ZA)}function p$(e){return(e==null?void 0:e.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ZA}`))!=null}function My(e){return e?e.getAttribute("role")==="combobox"&&Wg(e):!1}function g$(e){if(!e||d2)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Qp(e){return e?e.hasAttribute(Ry)?e:e.querySelector(`[${Ry}]`)||e:null}function x$(e,t){return t!=null&&!Hi(t)?0:typeof e=="function"?e():e}function rc(e,t,r){const a=x$(e,r);return typeof a=="number"?a:a==null?void 0:a[t]}function Uk(e){return typeof e=="function"?e():e}function eM(e,t){return t||e==="click"||e==="mousedown"}function b$(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}const tM=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new xo,currentIdRef:{current:null},currentContextRef:{current:null}});function v$(e,t){e.current=t.current}function y$(e){const{children:t,delay:r,timeoutMs:a=0}=e,i=x.useRef(r),c=x.useRef(r),u=x.useRef(null),f=x.useRef(null),m=us();return We(()=>{if(c.current=r,!u.current){i.current=r;return}i.current={open:rc(i.current,"open"),close:rc(r,"close")}},[r,u,i,c]),n.jsx(tM.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:c,currentIdRef:u,timeoutMs:a,currentContextRef:f,timeout:m}),[a,m]),children:t})}function w$(e,t={open:!1}){const{open:r}=t,a="rootStore"in e?e.rootStore:e,i=a.useState("floatingId"),c=x.useContext(tM),{currentIdRef:u,delayRef:f,timeoutMs:m,initialDelayRef:h,currentContextRef:g,hasProvider:p,timeout:b}=c,[v,w]=x.useState(!1),C=x.useRef(r);return We(()=>{C.current=r},[r]),We(()=>{function S(){var N;(N=g.current)==null||N.setIsInstantPhase(!1),u.current=null,g.current=null,f.current=h.current,b.clear()}if(u.current&&!r&&u.current===i){if(w(!1),m){const N=i;return b.start(m,()=>{a.select("open")||u.current&&u.current!==N||S()}),()=>{(C.current||u.current!==N)&&b.clear()}}S()}},[r,i,u,f,m,h,g,b,a]),We(()=>{if(!r)return;const S=g.current,N=u.current;b.clear(),g.current={onOpenChange:a.setOpen,setIsInstantPhase:w},u.current=i,f.current={open:0,close:rc(h.current,"close")},N!==null&&N!==i?(w(!0),S==null||S.setIsInstantPhase(!0),S==null||S.onOpenChange(!1,yt(Ur))):(w(!1),S==null||S.setIsInstantPhase(!1))},[r,i,a,u,f,h,g,b]),We(()=>()=>{if(u.current===i){if(g.current=null,!C.current)return;u.current=null,v$(f,h),b.clear()}},[g,u,f,i,h,b]),x.useMemo(()=>({activeIdRef:u,hasProvider:p,delayRef:f,isInstantPhase:v}),[u,p,f,v])}function $t(e,t,r,a){return e.addEventListener(t,r,a),()=>{e.removeEventListener(t,r,a)}}function oa(...e){return()=>{for(let t=0;t<e.length;t+=1){const r=e[t];r&&r()}}}function qn(e){const t=bs(j$,e).current;return t.next=e,We(t.effect),t}function j$(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const el=x.forwardRef(function(t,r){const[a,i]=x.useState();We(()=>{d$&&ri&&i("button")},[]);const c={tabIndex:0,role:a};return n.jsx("span",{...t,ref:r,style:_g,"aria-hidden":a?void 0:!0,...c,"data-base-ui-focus-guard":""})}),Ru=Math.min,Fa=Math.max,Zp=Math.round,Pm=Math.floor,Ga=e=>({x:e,y:e}),S$={left:"right",right:"left",bottom:"top",top:"bottom"};function nM(e,t,r){return Fa(e,Ru(t,r))}function tl(e,t){return typeof e=="function"?e(t):e}function uo(e){return e.split("-")[0]}function Xa(e){return e.split("-")[1]}function m2(e){return e==="x"?"y":"x"}function p2(e){return e==="y"?"height":"width"}function co(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function g2(e){return m2(co(e))}function N$(e,t,r){r===void 0&&(r=!1);const a=Xa(e),i=g2(e),c=p2(i);let u=i==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=Jp(u)),[u,Jp(u)]}function C$(e){const t=Jp(e);return[Oy(e),t,Oy(t)]}function Oy(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Hk=["left","right"],Fk=["right","left"],k$=["top","bottom"],T$=["bottom","top"];function E$(e,t,r){switch(e){case"top":case"bottom":return r?t?Fk:Hk:t?Hk:Fk;case"left":case"right":return t?k$:T$;default:return[]}}function R$(e,t,r,a){const i=Xa(e);let c=E$(uo(e),r==="start",a);return i&&(c=c.map(u=>u+"-"+i),t&&(c=c.concat(c.map(Oy)))),c}function Jp(e){const t=uo(e);return S$[t]+e.slice(t.length)}function A$(e){var t,r,a,i;return{top:(t=e.top)!=null?t:0,right:(r=e.right)!=null?r:0,bottom:(a=e.bottom)!=null?a:0,left:(i=e.left)!=null?i:0}}function sM(e){return typeof e!="number"?A$(e):{top:e,right:e,bottom:e,left:e}}function vf(e){const{x:t,y:r,width:a,height:i}=e;return{width:a,height:i,top:r,left:t,right:t+a,bottom:r+i,x:t,y:r}}function sf(e,t){return t<0||t>=e.length}function bp(e,t){return Ba(e.current,{disabledIndices:t})}function Dy(e,t){return Ba(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Ba(e,{startingIndex:t=-1,decrement:r=!1,disabledIndices:a,amount:i=1}={}){let c=t;do c+=r?-i:i;while(c>=0&&c<=e.length-1&&xu(e,c,a));return c}function xu(e,t,r){if(typeof r=="function"?r(t):(r==null?void 0:r.includes(t))??!1)return!0;const i=e[t];return i?!Qg(i)||i.matches(":disabled")?!0:!r&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!1}function M$(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Qg(e,t=e?Br(e):null){return!e||!e.isConnected||!t||M$(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const O$='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function D$(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const r=e.getRootNode();return Tu(r)?r.host:null}function zy(e){for(const t of Array.from(e.children))if(Us(t)==="summary")return t;return null}function z$(e,t){const r=zy(t);return!!r&&(e===r||gt(r,e))}function rM(e){const t=e?Us(e):"";return e!=null&&e.matches(O$)&&(t!=="summary"||e.parentElement!=null&&Us(e.parentElement)==="details"&&zy(e.parentElement)===e)&&(t!=="details"||zy(e)==null)&&(t!=="input"||e.type!=="hidden")}function oM(e){if(!rM(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=D$(t)){const r=t!==e,a=Us(t)==="slot";if(t.hasAttribute("inert")||r&&Us(t)==="details"&&!t.open&&!z$(e,t)||t.hasAttribute("hidden")||!a&&!I$(t,r))return!1}return!0}function I$(e,t){const r=Br(e);return t?r.display!=="none":Qg(e,r)}function aM(e){const t=e.tabIndex;if(t<0){const r=Us(e);if(r==="details"||r==="audio"||r==="video"||wn(e)&&e.isContentEditable)return 0}return t}function wv(e){if(Us(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function P$(e,t){const r=wv(e);if(!r)return!0;const a=t.find(i=>{const c=wv(i);return(c==null?void 0:c.name)===r.name&&c.form===r.form&&c.checked});return a?a===r:t.find(i=>{const c=wv(i);return(c==null?void 0:c.name)===r.name&&c.form===r.form})===r}function iM(e){if(wn(e)&&Us(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return wn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function lM(e,t){iM(e).forEach(r=>{rM(r)&&t.push(r),lM(r,t)})}function cM(e,t,r){iM(e).forEach(a=>{wn(a)&&a.matches(t)&&r.push(a),cM(a,t,r)})}function x2(e){return oM(e)&&aM(e)>=0}function uM(e){const t=[];return lM(e,t),t.filter(oM)}function Yf(e){const t=uM(e);return t.filter(r=>aM(r)>=0&&P$(r,t))}function dM(e,t){const r=Yf(e),a=r.length;if(a===0)return;const i=Xs(Ht(e)),c=r.indexOf(i),u=c===-1?t===1?0:a-1:c+t;return r[u]}function b2(e){return dM(Ht(e).body,1)||e}function fM(e){return dM(Ht(e).body,-1)||e}function hM(e,t){if(!e)return null;const r=Yf(Ht(e).body),a=r.length;if(a===0)return null;const i=r.indexOf(e);if(i===-1)return null;const c=(i+t+a)%a;return r[c]}function _$(e){return hM(e,1)}function L$(e){return hM(e,-1)}function bu(e,t){const r=t||e.currentTarget,a=e.relatedTarget;return!a||!gt(r,a)}function $$(e){Yf(e).forEach(r=>{r.dataset.tabindex=r.getAttribute("tabindex")||"",r.setAttribute("tabindex","-1")})}function Gk(e){const t=[];cM(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 nl(e,t,r=!0){return e.filter(i=>i.parentId===t).flatMap(i=>{var c;return[...!r||(c=i.context)!=null&&c.open?[i]:[],...nl(e,i.id,r)]})}function qk(e,t){var i;let r=[],a=(i=e.find(c=>c.id===t))==null?void 0:i.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 yf(e){return`data-base-ui-${e}`}let _m=0;function vp(e,t={}){const{preventScroll:r=!1,sync:a=!1,shouldFocus:i}=t;cancelAnimationFrame(_m);function c(){i&&!i()||e==null||e.focus({preventScroll:r})}if(a)return c(),Ln;const u=requestAnimationFrame(c);return _m=u,()=>{_m===u&&(cancelAnimationFrame(u),_m=0)}}const jv={inert:new WeakMap,"aria-hidden":new WeakMap},Yk="data-base-ui-inert",Iy={inert:new WeakSet,"aria-hidden":new WeakSet};let Ud=new WeakMap,Sv=0;function B$(e){return Iy[e]}function mM(e){return e?Tu(e)?e.host:mM(e.parentNode):null}const Kk=(e,t)=>t.map(r=>{if(e.contains(r))return r;const a=mM(r);return e.contains(a)?a:null}).filter(r=>r!=null),Xk=e=>{const t=new Set;return e.forEach(r=>{let a=r;for(;a&&!t.has(a);)t.add(a),a=a.parentNode}),t},Wk=(e,t,r)=>{const a=[],i=c=>{!c||r.has(c)||Array.from(c.children).forEach(u=>{Us(u)!=="script"&&(t.has(u)?i(u):a.push(u))})};return i(e),a};function V$(e,t,r,a,{mark:i=!0}){let c=null;a?c="inert":r&&(c="aria-hidden");let u=null,f=null;const m=Kk(t,e),h=i?Wk(t,Xk(m),new Set(m)):[],g=[],p=[];if(c){const b=jv[c],v=B$(c);f=v,u=b;const w=Kk(t,Array.from(t.querySelectorAll("[aria-live]"))),C=m.concat(w);Wk(t,Xk(C),new Set(C)).forEach(N=>{const E=N.getAttribute(c),T=E!==null&&E!=="false",R=(b.get(N)||0)+1;b.set(N,R),g.push(N),R===1&&T&&v.add(N),T||N.setAttribute(c,c==="inert"?"":"true")})}return i&&h.forEach(b=>{const v=(Ud.get(b)||0)+1;Ud.set(b,v),p.push(b),v===1&&b.setAttribute(Yk,"")}),Sv+=1,()=>{u&&g.forEach(b=>{const w=(u.get(b)||0)-1;u.set(b,w),w||(!(f!=null&&f.has(b))&&c&&b.removeAttribute(c),f==null||f.delete(b))}),i&&p.forEach(b=>{const v=(Ud.get(b)||0)-1;Ud.set(b,v),v||b.removeAttribute(Yk)}),Sv-=1,Sv||(jv.inert=new WeakMap,jv["aria-hidden"]=new WeakMap,Iy.inert=new WeakSet,Iy["aria-hidden"]=new WeakSet,Ud=new WeakMap)}}function Qk(e,t={}){const{ariaHidden:r=!1,inert:a=!1,mark:i=!0}=t,c=Ht(e[0]).body;return V$(e,c,r,a,{mark:i})}const U$=500,pM=500,H$={style:{transition:"none"}},gM="data-base-ui-click-trigger",xM={fallbackAxisSide:"none"},v2={fallbackAxisSide:"end"},F$={clipPath:"inset(50%)",position:"fixed",top:0,left:0},bM=x.createContext(null),vM=()=>x.useContext(bM),G$=yf("portal");function yM(e={}){const{ref:t,container:r,componentProps:a=En,elementProps:i}=e,c=sc(),u=vM(),f=u==null?void 0:u.portalNode,[m,h]=x.useState(null),[g,p]=x.useState(null),b=st(S=>{S!==null&&p(S)}),v=x.useRef(null);We(()=>{if(r===null){v.current&&(v.current=null,p(null),h(null));return}const S=(r&&($1(r)?r:r.current))??f??document.body;if(S==null){v.current&&(v.current=null,p(null),h(null));return}v.current!==S&&(v.current=S,p(null),h(S))},[r,f]);const w=Nt("div",a,{ref:[t,b],props:[{id:c,[G$]:""},i]}),C=m&&w?go.createPortal(w,m):null;return{node:g,nodeId:x.isValidElement(w)?w.props.id:void 0,subtree:C}}const Zg=x.forwardRef(function(t,r){const{render:a,className:i,style:c,children:u,container:f,portalOwnerRole:m,...h}=t,{node:g,nodeId:p,subtree:b}=yM({container:f,ref:r,componentProps:t,elementProps:h}),v=x.useRef(null),w=x.useRef(null),C=x.useRef(null),S=x.useRef(null),[N,E]=x.useState(null),T=x.useRef(!1),R=N==null?void 0:N.modal,M=N==null?void 0:N.open,A=!!N&&!N.modal&&N.open&&!!g;x.useEffect(()=>{if(!g||R)return;function O(D){g&&D.relatedTarget&&bu(D)&&(D.type==="focusin"?T.current&&(Gk(g),T.current=!1):($$(g),T.current=!0))}return oa($t(g,"focusin",O,!0),$t(g,"focusout",O,!0))},[g,R]),We(()=>{!g||M!==!0||!T.current||(Gk(g),T.current=!1)},[M,g]);const k=x.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:w,beforeInsideRef:C,afterInsideRef:S,portalNode:g,setFocusManagerState:E}),[g]);return n.jsxs(x.Fragment,{children:[b,n.jsxs(bM.Provider,{value:k,children:[A&&g&&n.jsx(el,{"data-type":"outside",ref:v,onFocus:O=>{var D;if(bu(O,g))(D=C.current)==null||D.focus();else{const _=N?N.domReference:null,H=fM(_);H==null||H.focus()}}}),A&&g&&n.jsx("span",{role:m,"aria-owns":p,style:F$}),g&&go.createPortal(u,g),A&&g&&n.jsx(el,{"data-type":"outside",ref:w,onFocus:O=>{var D;if(bu(O,g))(D=S.current)==null||D.focus();else{const _=N?N.domReference:null,H=b2(_);H==null||H.focus(),N!=null&&N.closeOnFocusOut&&(N==null||N.onOpenChange(!1,yt(Ji,O.nativeEvent)))}}})]})]})});function wM(){const e=new Map;return{emit(t,r){var a;(a=e.get(t))==null||a.forEach(i=>i(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 y2{constructor(){ln(this,"nodesRef",{current:[]});ln(this,"events",wM())}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 jM=x.createContext(null),SM=x.createContext(null),ol=()=>{var e;return((e=x.useContext(jM))==null?void 0:e.id)||null},al=e=>{const t=x.useContext(SM);return e??t};function w2(e){const t=sc(),r=al(e),a=ol();return We(()=>{if(!t)return;const i={id:t,parentId:a};return r==null||r.addNode(i),()=>{r==null||r.removeNode(i)}},[r,t,a]),t}function NM(e){const{children:t,id:r}=e,a=ol();return n.jsx(jM.Provider,{value:x.useMemo(()=>({id:r,parentId:a}),[r,a]),children:t})}function CM(e){const{children:t,externalTree:r}=e,a=bs(()=>r??new y2).current;return n.jsx(SM.Provider,{value:a,children:t})}function q$(e,t){const r=Rn(Vs(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 Zk=20;let Vi=[];function j2(){Vi=Vi.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function Jk(e){j2(),e&&Us(e)!=="body"&&(Vi.push(new WeakRef(e)),Vi.length>Zk&&(Vi=Vi.slice(-Zk)))}function e5(){var e;return j2(),(e=Vi[Vi.length-1])==null?void 0:e.deref()}function Y$(e){return e?x2(e)?e:Yf(e)[0]||e:null}function t5(e){var i;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!((i=e.getAttribute("role"))!=null&&i.includes("dialog")))return;const r=uM(e).filter(c=>{const u=c.getAttribute("data-tabindex")||"";return x2(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 Jg(e){const{context:t,children:r,disabled:a=!1,initialFocus:i=!0,returnFocus:c=!0,restoreFocus:u=!1,modal:f=!0,closeOnFocusOut:m=!0,openInteractionType:h="",nextFocusableElement:g,previousFocusableElement:p,beforeContentFocusGuardRef:b,externalTree:v,getInsideElements:w}=e,C="rootStore"in t?t.rootStore:t,S=C.useState("open"),N=C.useState("domReferenceElement"),E=C.useState("floatingElement"),{events:T,dataRef:R}=C.context,M=st(()=>{var ue;return(ue=R.current.floatingContext)==null?void 0:ue.nodeId}),A=i===!1,k=My(N)&&A,O=qn(i),D=qn(c),_=qn(h),H=qn(S),G=al(v),B=vM(),P=x.useRef(!1),V=x.useRef(!1),q=x.useRef(!1),W=x.useRef(null),K=x.useRef(""),J=x.useRef(""),z=x.useRef(null),L=x.useRef(null),X=mo(z,b,B==null?void 0:B.beforeInsideRef),ee=mo(L,B==null?void 0:B.afterInsideRef),$=us(),U=us(),F=Eu(),Y=B!=null,ne=Qp(E),te=st((ue=ne)=>ue?Yf(ue):[]),ye=st(()=>(w==null?void 0:w().filter(ue=>ue!=null))??[]);x.useEffect(()=>{if(a||!f)return;function ue(Q){Q.key==="Tab"&&gt(ne,Xs(Ht(ne)))&&te().length===0&&!k&&ta(Q)}const se=Ht(ne);return $t(se,"keydown",ue)},[a,ne,f,k,te]),x.useEffect(()=>{if(a||!S)return;const ue=Ht(ne);function se(){q.current=!1}function Q(oe){const pe=Vs(oe),xe=ye(),je=gt(E,pe)||gt(N,pe)||gt(B==null?void 0:B.portalNode,pe)||xe.some(Ie=>Ie===pe||gt(Ie,pe));q.current=!je,J.current=oe.pointerType||"keyboard",pe!=null&&pe.closest(`[${gM}]`)&&(V.current=!0,U.start(0,()=>{V.current=!1}))}function ie(){J.current="keyboard"}return oa($t(ue,"pointerdown",Q,!0),$t(ue,"pointerup",se,!0),$t(ue,"pointercancel",se,!0),$t(ue,"keydown",ie,!0),se)},[a,E,N,ne,S,B,U,ye]),x.useEffect(()=>{if(a||!m)return;const ue=Ht(ne);function se(){V.current=!0,U.start(0,()=>{V.current=!1})}function Q(xe){const je=Vs(xe);x2(je)&&(W.current=je)}function ie(xe){const je=xe.relatedTarget,Ie=xe.currentTarget,ce=Vs(xe);f&&je==null&&ce!=null&&gt(E,ce)&&Jk(ce),queueMicrotask(()=>{const Te=M(),re=C.context.triggerElements,fe=ye(),Re=(je==null?void 0:je.hasAttribute(yf("focus-guard")))&&[z.current,L.current,B==null?void 0:B.beforeInsideRef.current,B==null?void 0:B.afterInsideRef.current,B==null?void 0:B.beforeOutsideRef.current,B==null?void 0:B.afterOutsideRef.current,_a(p),_a(g)].includes(je),Oe=!(gt(N,je)||gt(E,je)||gt(je,E)||gt(B==null?void 0:B.portalNode,je)||fe.some(ke=>ke===je||gt(ke,je))||re.hasMatchingElement(ke=>gt(ke,je))||Re||G&&(nl(G.nodesRef.current,Te).find(ke=>{var he,Ae;return gt((he=ke.context)==null?void 0:he.elements.floating,je)||gt((Ae=ke.context)==null?void 0:Ae.elements.domReference,je)})||qk(G.nodesRef.current,Te).find(ke=>{var he,Ae,ge;return[(he=ke.context)==null?void 0:he.elements.floating,Qp((Ae=ke.context)==null?void 0:Ae.elements.floating)].includes(je)||((ge=ke.context)==null?void 0:ge.elements.domReference)===je})));if(Ie===N&&ne&&t5(ne),u&&Ie!==N&&!Qg(ce)&&Xs(ue)===ue.body){if(wn(ne)&&(ne.focus(),u==="popup")){F.request(()=>{ne.focus()});return}const ke=te(),he=W.current,Ae=(he&&ke.includes(he)?he:null)||ke[ke.length-1]||ne;wn(Ae)&&Ae.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(k||!f)&&je&&Oe&&!V.current&&(k||je!==e5())&&(P.current=!0,C.setOpen(!1,yt(Ji,xe)))})}function oe(){q.current||(R.current.insideReactTree=!0,$.start(0,()=>{R.current.insideReactTree=!1}))}const pe=wn(N)?N:null;if(!(!E&&!pe))return oa(pe&&$t(pe,"focusout",ie),pe&&$t(pe,"pointerdown",se),E&&$t(E,"focusin",Q),E&&$t(E,"focusout",ie),E&&B&&$t(E,"focusout",oe,!0))},[a,N,E,ne,f,G,B,C,m,u,te,k,M,R,$,U,F,g,p,ye]),x.useEffect(()=>{var Ie,ce,Te;if(a||!E||!S)return;const ue=Array.from(((Ie=B==null?void 0:B.portalNode)==null?void 0:Ie.querySelectorAll(`[${yf("portal")}]`))||[]),Q=(Te=(ce=(G?qk(G.nodesRef.current,M()):[]).find(re=>{var fe;return My(((fe=re.context)==null?void 0:fe.elements.domReference)||null)}))==null?void 0:ce.context)==null?void 0:Te.elements.domReference,oe=[...[E,...ue,z.current,L.current,B==null?void 0:B.beforeOutsideRef.current,B==null?void 0:B.afterOutsideRef.current,...ye()],Q,_a(p),_a(g),k?N:null].filter(re=>re!=null),pe=Qk(oe,{ariaHidden:f||k,mark:!1}),xe=[E,...ue].filter(re=>re!=null),je=Qk(xe);return()=>{je(),pe()}},[S,a,N,E,f,B,k,G,M,g,p,ye]),We(()=>{if(!S||a||!wn(ne))return;K.current="",J.current="";const ue=Ht(ne),se=Xs(ue);queueMicrotask(()=>{const Q=O.current,ie=typeof Q=="function"?Q(_.current||""):Q;if(ie===void 0||ie===!1||gt(ne,se))return;let pe=null;const xe=()=>(pe==null&&(pe=te(ne)),pe[0]||ne);let je;ie===!0||ie===null?je=xe():je=_a(ie),je=je||xe();const Ie=gt(ne,Xs(ue));vp(je,{preventScroll:je===ne,shouldFocus(){if(!H.current)return!1;if(Ie)return!0;const ce=Xs(ue);return!(ce!==je&&gt(ne,ce))}})})},[a,S,ne,te,O,_,H]),We(()=>{if(a||!ne)return;const ue=Ht(ne),se=Xs(ue),Q=_.current==null;Jk(se);function ie(pe){if(pe.open||(K.current=q$(pe.nativeEvent,J.current)),pe.reason===Qn&&pe.nativeEvent.type==="mouseleave"&&(P.current=!0),pe.reason===Vg)if(pe.nested)P.current=!1;else if(Yg(pe.nativeEvent)||f2(pe.nativeEvent))P.current=!1;else{let xe=!1;Ht(ne).createElement("div").focus({get preventScroll(){return xe=!0,!1}}),xe?P.current=!1:P.current=!0}}T.on("openchange",ie);function oe(pe){const xe=D.current;let je=typeof xe=="function"?xe(pe):xe;if(je===void 0||je===!1)return null;je===null&&(je=!0);const Ie=N!=null&&N.isConnected?N:null,ce=se!=null&&se.isConnected&&Us(se)!=="body"?se:null;let Te=Q?ce||Ie:Ie||ce;return Te||(Te=e5()||null),typeof je=="boolean"?Te:_a(je)||Te||null}return()=>{T.off("openchange",ie);const pe=Xs(ue),xe=ye(),je=gt(E,pe)||xe.some(re=>re===pe||gt(re,pe))||G&&nl(G.nodesRef.current,M(),!1).some(re=>{var fe;return gt((fe=re.context)==null?void 0:fe.elements.floating,pe)}),Ie=D.current,ce=K.current,Te=oe(ce);queueMicrotask(()=>{const re=Y$(Te),fe=typeof Ie!="boolean";if(Ie&&!P.current&&wn(re)&&(!(!fe&&re!==pe&&pe!==ue.body)||je)){const Re={preventScroll:!0};ce==="keyboard"&&(Re.focusVisible=!0),re.focus(Re)}P.current=!1})}},[a,E,ne,D,_,T,G,N,M,ye]),We(()=>{if(!ri||S||!E)return;const ue=Xs(Ht(E));!wn(ue)||!Wg(ue)||gt(E,ue)&&ue.blur()},[S,E]),We(()=>{if(!(a||!B))return B.setFocusManagerState({modal:f,closeOnFocusOut:m,open:S,onOpenChange:C.setOpen,domReference:N}),()=>{B.setFocusManagerState(null)}},[a,B,f,S,C,m,N]),We(()=>{if(!(a||!ne))return t5(ne),()=>{queueMicrotask(j2)}},[a,ne]);const ae=!a&&(f?!k:!0)&&(Y||f);return n.jsxs(x.Fragment,{children:[ae&&n.jsx(el,{"data-type":"inside",ref:X,onFocus:ue=>{var se;if(f){const Q=te();vp(Q[Q.length-1])}else if(B!=null&&B.portalNode)if(P.current=!1,bu(ue,B.portalNode)){const Q=b2(N);Q==null||Q.focus()}else(se=_a(p??B.beforeOutsideRef))==null||se.focus()}}),r,ae&&n.jsx(el,{"data-type":"inside",ref:ee,onFocus:ue=>{var se;if(f)vp(te()[0]);else if(B!=null&&B.portalNode)if(m&&(P.current=!0),bu(ue,B.portalNode)){const Q=fM(N);Q==null||Q.focus()}else(se=_a(g??B.afterOutsideRef))==null||se.focus()}})]})}function S2(e,t={}){const{enabled:r=!0,event:a="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:f=0,reason:m=ma}=t,h="rootStore"in e?e.rootStore:e,g=h.context.dataRef,p=x.useRef(void 0),b=Eu(),v=us(),w=x.useMemo(()=>{function C(N,E,T,R){const M=yt(m,E,T);N&&R==="touch"&&f>0?v.start(f,()=>{h.setOpen(!0,M)}):h.setOpen(N,M)}function S(N,E,T){const R=g.current.openEvent,M=h.select("domReferenceElement")!==E;return N&&M||!N||!i?!0:R&&u?!T(R.type):!1}return{onPointerDown(N){p.current=Hi(N.pointerType,!0)&&f2(N.nativeEvent)?"virtual":N.pointerType},onMouseDown(N){const E=p.current,T=N.nativeEvent,R=h.select("open");if(N.button!==0||a==="click"||Hi(E,!0)&&c)return;const M=S(R,N.currentTarget,O=>O==="click"||O==="mousedown"),A=Vs(T);if(Wg(A)){C(M,T,A,E);return}const k=N.currentTarget;b.request(()=>{C(M,T,k,E)})},onClick(N){if(a==="mousedown-only")return;const E=p.current;if(a==="mousedown"&&E){p.current=void 0;return}if(Hi(E,!0)&&c)return;const T=h.select("open"),R=S(T,N.currentTarget,M=>M==="click"||M==="mousedown"||M==="keydown"||M==="keyup");C(R,N.nativeEvent,N.currentTarget,E)},onKeyDown(){p.current=void 0}}},[g,a,c,m,h,u,i,b,v,f]);return x.useMemo(()=>r?{reference:w}:En,[r,w])}function K$(e,t){let r=null,a=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){var v;const c=(e==null?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},u=t.axis==="x"||t.axis==="both",f=t.axis==="y"||t.axis==="both",m=["mouseenter","mousemove"].includes(((v=t.dataRef.current.openEvent)==null?void 0:v.type)||"")&&t.pointerType!=="touch";let h=c.width,g=c.height,p=c.x,b=c.y;return r==null&&t.x&&u&&(r=c.x-t.x),a==null&&t.y&&f&&(a=c.y-t.y),p-=r||0,b-=a||0,h=0,g=0,!i||m?(h=t.axis==="y"?c.width:0,g=t.axis==="x"?c.height:0,p=u&&t.x!=null?t.x:p,b=f&&t.y!=null?t.y:b):i&&!m&&(g=t.axis==="x"?c.height:g,h=t.axis==="y"?c.width:h),i=!0,{width:h,height:g,x:p,y:b,top:b,right:p+h,bottom:b+g,left:p}}}}function n5(e){return e!=null&&e.clientX!=null}function X$(e,t={}){const{enabled:r=!0,axis:a="both"}=t,i="rootStore"in e?e.rootStore:e,c=i.useState("open"),u=i.useState("floatingElement"),f=i.useState("domReferenceElement"),m=i.context.dataRef,h=x.useRef(!1),g=x.useRef(null),[p,b]=x.useState(),[v,w]=x.useState([]),C=st(R=>{i.set("positionReference",R)}),S=st((R,M,A)=>{h.current||m.current.openEvent&&!n5(m.current.openEvent)||i.set("positionReference",K$(A??f,{x:R,y:M,axis:a,dataRef:m,pointerType:p}))}),N=st(R=>{c?g.current||(S(R.clientX,R.clientY,R.currentTarget),w([])):S(R.clientX,R.clientY,R.currentTarget)}),E=Hi(p)?u:c;x.useEffect(()=>{if(!r){C(f);return}if(!E)return;function R(){var k;(k=g.current)==null||k.call(g),g.current=null}const M=Rn(u);function A(k){const O=Vs(k);gt(u,O)?R():S(k.clientX,k.clientY)}return!m.current.openEvent||n5(m.current.openEvent)?g.current=$t(M,"mousemove",A):C(f),R},[E,r,u,m,f,i,S,C,v]),x.useEffect(()=>()=>{i.set("positionReference",null)},[i]),x.useEffect(()=>{r&&!u&&(h.current=!1)},[r,u]),x.useEffect(()=>{!r&&c&&(h.current=!0)},[r,c]);const T=x.useMemo(()=>{function R(M){b(M.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:N,onMouseEnter:N}},[N]);return x.useMemo(()=>r?{reference:T,trigger:T}:{},[r,T])}function W$(){return!1}function Q$(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 Kf(e,t={}){const{enabled:r=!0,escapeKey:a=!0,outsidePress:i=!0,outsidePressEvent:c="sloppy",referencePress:u=W$,bubbles:f,externalTree:m}=t,h="rootStore"in e?e.rootStore:e,g=h.useState("open"),p=h.useState("floatingElement"),{dataRef:b,events:v}=h.context,w=al(m),C=st(typeof i=="function"?i:()=>!1),S=typeof i=="function"?C:i,N=S!==!1,E=st(()=>c),{escapeKey:T,outsidePress:R}=Q$(f),M=x.useRef(!1),A=x.useRef(!1),k=x.useRef(!1),O=x.useRef(!1),D=x.useRef(!1),_=x.useRef(""),H=x.useRef(null),G=us(),B=us(),P=st(()=>{B.clear(),b.current.insideReactTree=!1}),V=st($=>{var Y;const U=(Y=b.current.floatingContext)==null?void 0:Y.nodeId;return(w?nl(w.nodesRef.current,U):[]).some(ne=>{var te;return((te=ne.context)==null?void 0:te.open)&&!ne.context.dataRef.current[$]})}),q=st($=>yv($,h.select("floatingElement"))||yv($,h.select("domReferenceElement"))),W=st($=>{u()&&h.setOpen(!1,yt(ma,$.nativeEvent))}),K=st($=>{if(!g||!r||!a||$.key!=="Escape"||D.current||!T&&V("__escapeKeyBubbles"))return;const U=f$($)?$.nativeEvent:$,F=yt(Hf,U);h.setOpen(!1,F),F.isCanceled||$.preventDefault(),!T&&!F.isPropagationAllowed&&$.stopPropagation()}),J=st(()=>{b.current.insideReactTree=!0,B.start(0,P)}),z=st($=>{if(!g||!r||$.button!==0)return;const U=Vs($.nativeEvent);gt(h.select("floatingElement"),U)&&(M.current||(M.current=!0,A.current=!1))}),L=st($=>{!g||!r||($.defaultPrevented||$.nativeEvent.defaultPrevented)&&M.current&&(A.current=!0)});x.useEffect(()=>{function $(U){U.open||(O.current=!1)}return v.on("openchange",$),()=>{v.off("openchange",$)}},[v]),x.useEffect(()=>{if(!g||!r)return g||(O.current=!1),P;b.current.__escapeKeyBubbles=T,b.current.__outsidePressBubbles=R;const $=new xo,U=new xo,F=Ht(p);function Y(){$.clear(),D.current=!0}function ne(){$.start(ri?5:0,()=>{D.current=!1})}function te(){k.current=!0,U.start(0,()=>{k.current=!1})}function ye(){M.current=!1,A.current=!1}function ae(){const Oe=_.current,ke=Oe==="pen"||!Oe?"mouse":Oe,he=E(),Ae=typeof he=="function"?he():he;return typeof Ae=="string"?Ae:Ae[ke]}function ue(Oe){const ke=ae();return ke==="intentional"&&Oe.type!=="click"||ke==="sloppy"&&Oe.type==="click"}function se(Oe){var Ae;const ke=(Ae=b.current.floatingContext)==null?void 0:Ae.nodeId,he=w&&nl(w.nodesRef.current,ke).some(ge=>{var Pe;return yv(Oe,(Pe=ge.context)==null?void 0:Pe.elements.floating)});return q(Oe)||he}function Q(Oe){if(ue(Oe)){Oe.type!=="click"&&!q(Oe)&&(U.clear(),k.current=!1),P();return}if(b.current.insideReactTree){P();return}const ke=Vs(Oe),he=`[${yf("inert")}]`,Ae=Ft(ke)?ke.getRootNode():null,ge=Array.from((Tu(Ae)?Ae:Ht(h.select("floatingElement"))).querySelectorAll(he)),Pe=h.context.triggerElements;if(ke&&(Pe.hasElement(ke)||Pe.hasMatchingElement(_e=>gt(_e,ke))))return;let Fe=Ft(ke)?ke:null;for(;Fe&&!Ua(Fe);){const _e=Ya(Fe);if(Ua(_e)||!Ft(_e))break;Fe=_e}if(!(ge.length&&Ft(ke)&&!m$(ke)&&!gt(ke,h.select("floatingElement"))&&ge.every(_e=>!gt(Fe,_e)))){if(wn(ke)&&!("touches"in Oe)){const _e=Ua(ke),Xe=Br(ke),Je=/auto|scroll/,ct=_e||Je.test(Xe.overflowX),At=_e||Je.test(Xe.overflowY),rt=ct&&ke.clientWidth>0&&ke.scrollWidth>ke.clientWidth,ve=At&&ke.clientHeight>0&&ke.scrollHeight>ke.clientHeight,Ue=Xe.direction==="rtl",Qe=ve&&(Ue?Oe.offsetX<=ke.offsetWidth-ke.clientWidth:Oe.offsetX>ke.clientWidth),xt=rt&&Oe.offsetY>ke.clientHeight;if(Qe||xt)return}if(!se(Oe)){if(ae()==="intentional"){if(Oe.detail!==0&&!Yg(Oe)&&!O.current)return;if(k.current){U.clear(),k.current=!1;return}}typeof S=="function"&&!S(Oe)||V("__outsidePressBubbles")||(h.setOpen(!1,yt(Vg,Oe)),P())}}}function ie(Oe){ae()!=="sloppy"||Oe.pointerType==="touch"||!h.select("open")||!r||q(Oe)||Q(Oe)}function oe(Oe){if(ae()!=="sloppy"||!h.select("open")||!r||q(Oe))return;const ke=Oe.touches[0];ke&&(H.current={startTime:Date.now(),startX:ke.clientX,startY:ke.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},G.start(1e3,()=>{H.current&&(H.current.dismissOnTouchEnd=!1,H.current.dismissOnMouseDown=!1)}))}function pe(Oe,ke){const he=Vs(Oe);if(!he)return;const Ae=$t(he,Oe.type,()=>{ke(Oe),Ae()})}function xe(Oe){_.current="touch",pe(Oe,oe)}function je(Oe){G.clear(),Oe.type==="pointerdown"&&(Oe.button===0&&(O.current=!0),_.current=Oe.pointerType),!(Oe.type==="mousedown"&&H.current&&!H.current.dismissOnMouseDown)&&pe(Oe,ke=>{ke.type==="pointerdown"?ie(ke):Q(ke)})}function Ie(Oe){if(Oe.type==="pointercancel"&&(O.current=!1),!M.current)return;const ke=A.current;if(ye(),ae()==="intentional"){if(Oe.type==="pointercancel"){ke&&te();return}if(!se(Oe)){if(ke){te();return}typeof S=="function"&&!S(Oe)||(U.clear(),k.current=!0,P())}}}function ce(Oe){if(ae()!=="sloppy"||!H.current||q(Oe))return;const ke=Oe.touches[0];if(!ke)return;const he=Math.abs(ke.clientX-H.current.startX),Ae=Math.abs(ke.clientY-H.current.startY),ge=Math.sqrt(he*he+Ae*Ae);ge>5&&(H.current.dismissOnTouchEnd=!0),ge>10&&(Q(Oe),G.clear(),H.current=null)}function Te(Oe){pe(Oe,ce)}function re(Oe){ae()!=="sloppy"||!H.current||q(Oe)||(H.current.dismissOnTouchEnd&&Q(Oe),G.clear(),H.current=null)}function fe(Oe){pe(Oe,re)}const Re=oa(a&&oa($t(F,"keydown",K),$t(F,"compositionstart",Y),$t(F,"compositionend",ne)),N&&oa($t(F,"click",je,!0),$t(F,"pointerdown",je,!0),$t(F,"pointerup",Ie,!0),$t(F,"pointercancel",Ie,!0),$t(F,"mousedown",je,!0),$t(F,"mouseup",Ie,!0),$t(F,"touchstart",xe,{capture:!0,passive:!0}),$t(F,"touchmove",Te,{capture:!0,passive:!0}),$t(F,"touchend",fe,{capture:!0,passive:!0})));return()=>{Re(),$.clear(),U.clear(),ye(),k.current=!1,P()}},[b,p,a,N,S,g,r,T,R,K,P,E,V,q,w,h,G]);const X=x.useMemo(()=>({onKeyDown:K,onPointerDown:W,onClick:W}),[K,W]),ee=x.useMemo(()=>({onKeyDown:K,onPointerDown:L,onMouseDown:L,onClickCapture:J,onMouseDownCapture($){J(),z($)},onPointerDownCapture($){J(),z($)},onMouseUpCapture:J,onTouchEndCapture:J,onTouchMoveCapture:J}),[K,J,z,L]);return x.useMemo(()=>r?{reference:X,floating:ee,trigger:X}:{},[r,X,ee])}function s5(e,t,r){let{reference:a,floating:i}=e;const c=co(t),u=g2(t),f=p2(u),m=uo(t),h=c==="y",g=a.x+a.width/2-i.width/2,p=a.y+a.height/2-i.height/2,b=a[f]/2-i[f]/2;let v;switch(m){case"top":v={x:g,y:a.y-i.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-i.width,y:p};break;default:v={x:a.x,y:a.y}}const w=Xa(t);return w&&(v[u]+=b*(w==="end"?1:-1)*(r&&h?-1:1)),v}async function Z$(e,t){var r;t===void 0&&(t={});const{x:a,y:i,platform:c,rects:u,elements:f,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:b=!1,padding:v=0}=tl(t,e),w=sM(v),S=f[b?p==="floating"?"reference":"floating":p],N=vf(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(S)))==null||r?S:S.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:h,rootBoundary:g,strategy:m})),E=p==="floating"?{x:a,y:i,width:u.floating.width,height:u.floating.height}:u.reference,T=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),R=await(c.isElement==null?void 0:c.isElement(T))&&await(c.getScale==null?void 0:c.getScale(T))||{x:1,y:1},M=vf(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:E,offsetParent:T,strategy:m}):E);return{top:(N.top-M.top+w.top)/R.y,bottom:(M.bottom-N.bottom+w.bottom)/R.y,left:(N.left-M.left+w.left)/R.x,right:(M.right-N.right+w.right)/R.x}}const J$=50,eB=async(e,t,r)=>{const{placement:a="bottom",strategy:i="absolute",middleware:c=[],platform:u}=r,f=u.detectOverflow?u:{...u,detectOverflow:Z$},m=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:i}),{x:g,y:p}=s5(h,a,m),b=a,v=0;const w={};for(let C=0;C<c.length;C++){const S=c[C];if(!S)continue;const{name:N,fn:E}=S,{x:T,y:R,data:M,reset:A}=await E({x:g,y:p,initialPlacement:a,placement:b,strategy:i,middlewareData:w,rects:h,platform:f,elements:{reference:e,floating:t}});g=T??g,p=R??p,w[N]={...w[N],...M},A&&v<J$&&(v++,typeof A=="object"&&(A.placement&&(b=A.placement),A.rects&&(h=A.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:g,y:p}=s5(h,b,m)),C=-1)}return{x:g,y:p,placement:b,strategy:i,middlewareData:w}},tB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;const{placement:i,middlewareData:c,rects:u,initialPlacement:f,platform:m,elements:h}=t,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:C=!0,...S}=tl(e,t);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const N=uo(i),E=co(f),T=uo(f)===f,R=await(m.isRTL==null?void 0:m.isRTL(h.floating)),M=b||(T||!C?[Jp(f)]:C$(f)),A=w!=="none";!b&&A&&M.push(...R$(f,C,w,R));const k=[f,...M],O=await m.detectOverflow(t,S),D=[];let _=((a=c.flip)==null?void 0:a.overflows)||[];if(g&&D.push(O[N]),p){const P=N$(i,u,R);D.push(O[P[0]],O[P[1]])}if(_=[..._,{placement:i,overflows:D}],!D.every(P=>P<=0)){var H,G;const P=(((H=c.flip)==null?void 0:H.index)||0)+1,V=k[P];if(V&&(!(p==="alignment"?E!==co(V):!1)||_.every(K=>co(K.placement)===E?K.overflows[0]>0:!0)))return{data:{index:P,overflows:_},reset:{placement:V}};let q=(G=_.filter(W=>W.overflows[0]<=0).sort((W,K)=>W.overflows[1]-K.overflows[1])[0])==null?void 0:G.placement;if(!q)switch(v){case"bestFit":{var B;const W=(B=_.filter(K=>{if(A){const J=co(K.placement);return J===E||J==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(J=>J>0).reduce((J,z)=>J+z,0)]).sort((K,J)=>K[1]-J[1])[0])==null?void 0:B[0];W&&(q=W);break}case"initialPlacement":q=f;break}if(i!==q)return{reset:{placement:q}}}return{}}}},kM=new Set(["left","top"]);async function nB(e,t){const{placement:r,platform:a,elements:i}=e,c=await(a.isRTL==null?void 0:a.isRTL(i.floating)),u=uo(r),f=Xa(r),m=co(r)==="y",h=kM.has(u)?-1:1,g=c&&m?-1:1,p=tl(t,e);let{mainAxis:b,crossAxis:v,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return f&&typeof w=="number"&&(v=f==="end"?w*-1:w),m?{x:v*g,y:b*h}:{x:b*h,y:v*g}}const sB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;const{x:i,y:c,placement:u,middlewareData:f}=t,m=await nB(t,e);return u===((r=f.offset)==null?void 0:r.placement)&&(a=f.arrow)!=null&&a.alignmentOffset?{}:{x:i+m.x,y:c+m.y,data:{...m,placement:u}}}}},rB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:a,placement:i,platform:c}=t,{mainAxis:u=!0,crossAxis:f=!1,limiter:m={fn:E=>{let{x:T,y:R}=E;return{x:T,y:R}}},...h}=tl(e,t),g={x:r,y:a},p=await c.detectOverflow(t,h),b=co(i),v=m2(b);let w=g[v],C=g[b];const S=(E,T)=>nM(T+p[E==="y"?"top":"left"],T,T-p[E==="y"?"bottom":"right"]);u&&(w=S(v,w)),f&&(C=S(b,C));const N=m.fn({...t,[v]:w,[b]:C});return{...N,data:{x:N.x-r,y:N.y-a,enabled:{[v]:u,[b]:f}}}}}},oB=function(e){return e===void 0&&(e={}),{options:e,fn(t){var r,a;const{x:i,y:c,placement:u,rects:f,middlewareData:m}=t,{offset:h=0,mainAxis:g=!0,crossAxis:p=!0}=tl(e,t),b={x:i,y:c},v=co(u),w=m2(v);let C=b[w],S=b[v];const N=tl(h,t),E=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:(r=N.mainAxis)!=null?r:0,crossAxis:(a=N.crossAxis)!=null?a:0};if(g){const M=w==="y"?"height":"width",A=f.reference[w]-f.floating[M]+E.mainAxis,k=f.reference[w]+f.reference[M]-E.mainAxis;C<A?C=A:C>k&&(C=k)}if(p){var T,R;const M=w==="y"?"width":"height",A=kM.has(uo(u)),k=f.reference[v]-f.floating[M]+(A&&((T=m.offset)==null?void 0:T[v])||0)+(A?0:E.crossAxis),O=f.reference[v]+f.reference[M]+(A?0:((R=m.offset)==null?void 0:R[v])||0)-(A?E.crossAxis:0);S<k?S=k:S>O&&(S=O)}return{[w]:C,[v]:S}}}},aB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:a,platform:i,elements:c}=t,{apply:u=()=>{},...f}=tl(e,t),m=await i.detectOverflow(t,f),h=uo(r),g=Xa(r),p=co(r)==="y",{width:b,height:v}=a.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const S=v-m.top-m.bottom,N=b-m.left-m.right,E=Ru(v-m[w],S),T=Ru(b-m[C],N),R=t.middlewareData.shift,M=!R;let A=E,k=T;R!=null&&R.enabled.x&&(k=N),R!=null&&R.enabled.y&&(A=S),M&&!g&&(p?k=b-2*Fa(m.left,m.right):A=v-2*Fa(m.top,m.bottom)),await u({...t,availableWidth:k,availableHeight:A});const O=await i.getDimensions(c.floating);return b!==O.width||v!==O.height?{reset:{rects:!0}}:{}}}};function TM(e){const t=Br(e);let r=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const i=wn(e),c=i?e.offsetWidth:r,u=i?e.offsetHeight:a,f=Zp(r)!==c||Zp(a)!==u;return f&&(r=c,a=u),{width:r,height:a,$:f}}function N2(e){return Ft(e)?e:e.contextElement}function vu(e){const t=N2(e);if(!wn(t))return Ga(1);const r=t.getBoundingClientRect(),{width:a,height:i,$:c}=TM(t);let u=(c?Zp(r.width):r.width)/a,f=(c?Zp(r.height):r.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const iB=Ga(0);function EM(e){const t=Rn(e);return!V1()||!t.visualViewport?iB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lB(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===Rn(e)}function oc(e,t,r,a){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),c=N2(e);let u=Ga(1);t&&(a?Ft(a)&&(u=vu(a)):u=vu(e));const f=lB(c,r,a)?EM(c):Ga(0);let m=(i.left+f.x)/u.x,h=(i.top+f.y)/u.y,g=i.width/u.x,p=i.height/u.y;if(c&&a){const b=Rn(c),v=Ft(a)?Rn(a):a;let w=b,C=vy(w);for(;C&&v!==w;){const S=vu(C),N=C.getBoundingClientRect(),E=Br(C),T=N.left+(C.clientLeft+parseFloat(E.paddingLeft))*S.x,R=N.top+(C.clientTop+parseFloat(E.paddingTop))*S.y;m*=S.x,h*=S.y,g*=S.x,p*=S.y,m+=T,h+=R,w=Rn(C),C=vy(w)}}return vf({width:g,height:p,x:m,y:h})}function ex(e,t){const r=Og(e).scrollLeft;return t?t.left+r:oc(ei(e)).left+r}function RM(e,t){const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-ex(e,r),i=r.top+t.scrollTop;return{x:a,y:i}}function cB(e){let{elements:t,rect:r,offsetParent:a,strategy:i}=e;const c=i==="fixed",u=ei(a),f=t?Mg(t.floating):!1;if(a===u||f&&c)return r;let m={scrollLeft:0,scrollTop:0},h=Ga(1);const g=Ga(0),p=wn(a);if((p||!c)&&((Us(a)!=="body"||zf(u))&&(m=Og(a)),p)){const v=oc(a);h=vu(a),g.x=v.x+a.clientLeft,g.y=v.y+a.clientTop}const b=u&&!p&&!c?RM(u,m):Ga(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-m.scrollLeft*h.x+g.x+b.x,y:r.y*h.y-m.scrollTop*h.y+g.y+b.y}}function uB(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function dB(e){const t=Og(e),r=e.ownerDocument.body,a=Fa(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Fa(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let c=-t.scrollLeft+ex(e);const u=-t.scrollTop;return Br(r).direction==="rtl"&&(c+=Fa(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:c,y:u}}const fB=25;function hB(e,t,r){r===void 0&&(r="viewport");const a=r==="layoutViewport",i=Rn(e),c=ei(e),u=i.visualViewport;let f=c.clientWidth,m=c.clientHeight,h=0,g=0;if(u){const b=!V1()||t==="fixed";a?b||(h=-u.offsetLeft,g=-u.offsetTop):(f=u.width,m=u.height,b&&(h=u.offsetLeft,g=u.offsetTop))}if(ex(c)<=0){const b=c.ownerDocument,v=b.body,w=getComputedStyle(v),C=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,S=Math.abs(c.clientWidth-v.clientWidth-C),N=getComputedStyle(c).scrollbarGutter==="stable both-edges"?S/2:S;N<=fB&&(f-=N)}return{width:f,height:m,x:h,y:g}}function mB(e,t){const r=oc(e,!0,t==="fixed"),a=r.top+e.clientTop,i=r.left+e.clientLeft,c=vu(e),u=e.clientWidth*c.x,f=e.clientHeight*c.y,m=i*c.x,h=a*c.y;return{width:u,height:f,x:m,y:h}}function r5(e,t,r){let a;if(t==="viewport"||t==="layoutViewport")a=hB(e,r,t);else if(t==="document")a=dB(ei(e));else if(Ft(t))a=mB(t,r);else{const i=EM(e);a={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return vf(a)}function pB(e,t){const r=t.get(e);if(r)return r;let a=pf(e,[],!1).filter(f=>Ft(f)&&Us(f)!=="body"),i=null;const c=Br(e).position==="fixed";let u=c?Ya(e):e;for(;Ft(u)&&!Ua(u);){const f=Br(u),m=B1(u),h=i?i.position:c?"fixed":"";!m&&(h==="fixed"||h==="absolute"&&f.position==="static")?a=a.filter(p=>p!==u):i=f,u=Ya(u)}return t.set(e,a),a}function gB(e){let{element:t,boundary:r,rootBoundary:a,strategy:i}=e;const u=[...r==="clippingAncestors"?Mg(t)?[]:pB(t,this._c):[].concat(r),a],f=r5(t,u[0],i);let m=f.top,h=f.right,g=f.bottom,p=f.left;for(let b=1;b<u.length;b++){const v=r5(t,u[b],i);m=Fa(v.top,m),h=Ru(v.right,h),g=Ru(v.bottom,g),p=Fa(v.left,p)}return{width:h-p,height:g-m,x:p,y:m}}function xB(e){const{width:t,height:r}=TM(e);return{width:t,height:r}}function bB(e,t,r){const a=wn(t),i=ei(t),c=r==="fixed",u=oc(e,!0,c,t);let f={scrollLeft:0,scrollTop:0};const m=Ga(0);if((a||!c)&&((Us(t)!=="body"||zf(i))&&(f=Og(t)),a)){const b=oc(t,!0,c,t);m.x=b.x+t.clientLeft,m.y=b.y+t.clientTop}!a&&i&&(m.x=ex(i));const h=i&&!a&&!c?RM(i,f):Ga(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 Nv(e){return Br(e).position==="static"}function o5(e,t){if(!wn(e)||Br(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return ei(e)===r&&(r=r.ownerDocument.body),r}function AM(e,t){const r=Rn(e);if(Mg(e))return r;if(!wn(e)){let i=Ya(e);for(;i&&!Ua(i);){if(Ft(i)&&!Nv(i))return i;i=Ya(i)}return r}let a=o5(e,t);for(;a&&i6(a)&&Nv(a);)a=o5(a,t);return a&&Ua(a)&&Nv(a)&&!B1(a)?r:a||u6(e)||r}const vB=async function(e){const t=this.getOffsetParent||AM,r=this.getDimensions,a=await r(e.floating);return{reference:bB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function yB(e){return Br(e).direction==="rtl"}const MM={convertOffsetParentRelativeRectToViewportRelativeRect:cB,getDocumentElement:ei,getClippingRect:gB,getOffsetParent:AM,getElementRects:vB,getClientRects:uB,getDimensions:xB,getScale:vu,isElement:Ft,isRTL:yB};function OM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wB(e,t,r){let a=null,i;const c=ei(e);function u(){var g;clearTimeout(i),(g=a)==null||g.disconnect(),a=null}function f(g,p){g===void 0&&(g=!1),p===void 0&&(p=1),u();const b=e.getBoundingClientRect(),{left:v,top:w,width:C,height:S}=b;if(g||t(),!C||!S)return;const N=Pm(w),E=Pm(c.clientWidth-(v+C)),T=Pm(c.clientHeight-(w+S)),R=Pm(v),A={rootMargin:-N+"px "+-E+"px "+-T+"px "+-R+"px",threshold:Fa(0,Ru(1,p))||1};let k=!0;function O(D){const _=D[0].intersectionRatio;if(!OM(b,e.getBoundingClientRect()))return f();if(_!==p){if(!k)return f();_?f(!1,_):i=setTimeout(()=>{f(!1,1e-7)},1e3)}k=!1}try{a=new IntersectionObserver(O,{...A,root:c.ownerDocument})}catch{a=new IntersectionObserver(O,A)}a.observe(e)}const m=Rn(e),h=()=>f(r);return m.addEventListener("resize",h),f(!0),()=>{m.removeEventListener("resize",h),u()}}function a5(e,t,r,a){a===void 0&&(a={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:m=!1}=a,h=N2(e),g=i||c?[...h?pf(h):[],...t?pf(t):[]]:[];g.forEach(N=>{i&&N.addEventListener("scroll",r),c&&N.addEventListener("resize",r)});const p=h&&f?wB(h,r,c):null;let b=-1,v=null;u&&(v=new ResizeObserver(N=>{let[E]=N;E&&E.target===h&&v&&t&&(v.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var T;(T=v)==null||T.observe(t)})),r()}),h&&!m&&v.observe(h),t&&v.observe(t));let w,C=m?oc(e):null;m&&S();function S(){const N=oc(e);C&&!OM(C,N)&&r(),C=N,w=requestAnimationFrame(S)}return r(),()=>{var N;g.forEach(E=>{i&&E.removeEventListener("scroll",r),c&&E.removeEventListener("resize",r)}),p==null||p(),(N=v)==null||N.disconnect(),v=null,m&&cancelAnimationFrame(w)}}const jB=sB,SB=rB,NB=tB,CB=aB,kB=oB,TB=(e,t,r)=>{const a=new Map,i=r??{},c={...MM,...i.platform,_c:a};return eB(e,t,{...i,platform:c})};var EB=typeof document<"u",RB=function(){},yp=EB?x.useLayoutEffect:RB;function eg(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,i;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(!eg(e[a],t[a]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(t,i[a]))return!1;for(a=r;a--!==0;){const c=i[a];if(!(c==="_owner"&&e.$$typeof)&&!eg(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function DM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function i5(e,t){const r=DM(e);return Math.round(t*r)/r}function Cv(e){const t=x.useRef(e);return yp(()=>{t.current=e}),t}function AB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:i,elements:{reference:c,floating:u}={},transform:f=!0,whileElementsMounted:m,open:h}=e,[g,p]=x.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[b,v]=x.useState(a);eg(b,a)||v(a);const[w,C]=x.useState(null),[S,N]=x.useState(null),E=x.useCallback(K=>{K!==A.current&&(A.current=K,C(K))},[]),T=x.useCallback(K=>{K!==k.current&&(k.current=K,N(K))},[]),R=c||w,M=u||S,A=x.useRef(null),k=x.useRef(null),O=x.useRef(g),D=m!=null,_=Cv(m),H=Cv(i),G=Cv(h),B=x.useCallback(()=>{if(!A.current||!k.current)return;const K={placement:t,strategy:r,middleware:b};H.current&&(K.platform=H.current),TB(A.current,k.current,K).then(J=>{const z={...J,isPositioned:G.current!==!1};P.current&&!eg(O.current,z)&&(O.current=z,go.flushSync(()=>{p(z)}))})},[b,t,r,H,G]);yp(()=>{h===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[h]);const P=x.useRef(!1);yp(()=>(P.current=!0,()=>{P.current=!1}),[]),yp(()=>{if(R&&(A.current=R),M&&(k.current=M),R&&M){if(_.current)return _.current(R,M,B);B()}},[R,M,B,_,D]);const V=x.useMemo(()=>({reference:A,floating:k,setReference:E,setFloating:T}),[E,T]),q=x.useMemo(()=>({reference:R,floating:M}),[R,M]),W=x.useMemo(()=>{const K={position:r,left:0,top:0};if(!q.floating)return K;const J=i5(q.floating,g.x),z=i5(q.floating,g.y);return f?{...K,transform:"translate("+J+"px, "+z+"px)",...DM(q.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:J,top:z}},[r,f,q.floating,g.x,g.y]);return x.useMemo(()=>({...g,update:B,refs:V,elements:q,floatingStyles:W}),[g,B,V,q,W])}const MB=(e,t)=>{const r=jB(e);return{name:r.name,fn:r.fn,options:[e,t]}},OB=(e,t)=>{const r=SB(e);return{name:r.name,fn:r.fn,options:[e,t]}},DB=(e,t)=>({fn:kB(e).fn,options:[e,t]}),zB=(e,t)=>{const r=NB(e);return{name:r.name,fn:r.fn,options:[e,t]}},IB=(e,t)=>{const r=CB(e);return{name:r.name,fn:r.fn,options:[e,t]}};var kv={exports:{}},Tv={};/**
486
+ * @license React
487
+ * use-sync-external-store-shim.production.js
488
+ *
489
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
490
+ *
491
+ * This source code is licensed under the MIT license found in the
492
+ * LICENSE file in the root directory of this source tree.
493
+ */var l5;function PB(){if(l5)return Tv;l5=1;var e=Df();function t(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}var r=typeof Object.is=="function"?Object.is:t,a=e.useState,i=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function f(p,b){var v=b(),w=a({inst:{value:v,getSnapshot:b}}),C=w[0].inst,S=w[1];return c(function(){C.value=v,C.getSnapshot=b,m(C)&&S({inst:C})},[p,v,b]),i(function(){return m(C)&&S({inst:C}),p(function(){m(C)&&S({inst:C})})},[p]),u(v),v}function m(p){var b=p.getSnapshot;p=p.value;try{var v=b();return!r(p,v)}catch{return!0}}function h(p,b){return b()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return Tv.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Tv}var c5;function zM(){return c5||(c5=1,kv.exports=PB()),kv.exports}var C2=zM(),Ev={exports:{}},Rv={};/**
494
+ * @license React
495
+ * use-sync-external-store-shim/with-selector.production.js
496
+ *
497
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
498
+ *
499
+ * This source code is licensed under the MIT license found in the
500
+ * LICENSE file in the root directory of this source tree.
501
+ */var u5;function _B(){if(u5)return Rv;u5=1;var e=Df(),t=zM();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,i=t.useSyncExternalStore,c=e.useRef,u=e.useEffect,f=e.useMemo,m=e.useDebugValue;return Rv.useSyncExternalStoreWithSelector=function(h,g,p,b,v){var w=c(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=f(function(){function N(A){if(!E){if(E=!0,T=A,A=b(A),v!==void 0&&C.hasValue){var k=C.value;if(v(k,A))return R=k}return R=A}if(k=R,a(T,A))return k;var O=b(A);return v!==void 0&&v(k,O)?(T=A,k):(T=A,R=O)}var E=!1,T,R,M=p===void 0?null:p;return[function(){return N(g())},M===null?void 0:function(){return N(M())}]},[g,p,b,v]);var S=i(h,w[0],w[1]);return u(function(){C.hasValue=!0,C.value=S},[S]),m(S),S},Rv}var d5;function LB(){return d5||(d5=1,Ev.exports=_B()),Ev.exports}var $B=LB();const Py=[];let _y;function BB(){return _y}function VB(e){Py.push(e)}function Xf(e){const t=(r,a)=>{const i=bs(UB).current;let c;try{_y=i;for(const u of Py)u.before(i);c=e(r,a);for(const u of Py)u.after(i);i.didInitialize=!0}finally{_y=void 0}return c};return t.displayName=e.displayName||e.name,t}function k2(e){return x.forwardRef(Xf(e))}function UB(){return{didInitialize:!1}}const HB=G1(19),FB=HB?qB:YB;function IM(e,t,r,a,i){return FB(e,t,r,a,i)}function GB(e,t,r,a,i){const c=x.useCallback(()=>t(e.getSnapshot(),r,a,i),[e,t,r,a,i]);return C2.useSyncExternalStore(e.subscribe,c,c)}VB({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],i=a.selector(a.store.state,a.a1,a.a2,a.a3);Object.is(a.value,i)||(t=!0,a.value=i)}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 i of e.syncHooks)r.add(i.store);const a=[];for(const i of r)a.push(i.subscribe(t));return()=>{for(const i of a)i()}}),C2.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function qB(e,t,r,a,i){const c=BB();if(!c)return GB(e,t,r,a,i);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,i))&&(f.store!==e&&(c.didChangeStore=!0),f.store=e,f.selector=t,f.a1=r,f.a2=a,f.a3=i,f.value=t(e.getSnapshot(),r,a,i))):(f={store:e,selector:t,a1:r,a2:a,a3:i,value:t(e.getSnapshot(),r,a,i)},c.syncHooks.push(f)),f.value}function YB(e,t,r,a,i){return $B.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,r,a,i))}class KB{constructor(t){ln(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ln(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,i){return IM(this,t,r,a,i)}}class _u extends KB{constructor(t,r={},a){super(t),this.context=r,this.selectors=a}useSyncedValue(t,r){x.useDebugValue(t);const a=this;We(()=>{a.state[t]!==r&&a.set(t,r)},[a,t,r])}useSyncedValueWithCleanup(t,r){const a=this;We(()=>(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);We(()=>{r.update(t)},[r,...a])}useControlledProp(t,r){x.useDebugValue(t);const a=this,i=r!==void 0;We(()=>{i&&!Object.is(a.state[t],r)&&a.setState({...a.state,[t]:r})},[a,t,r,i])}select(t,r,a,i){const c=this.selectors[t];return c(this.state,r,a,i)}useState(t,r,a,i){return x.useDebugValue(t),IM(this,this.selectors[t],r,a,i)}useContextCallback(t,r){x.useDebugValue(t);const a=st(r??Ln);this.context[t]=a}useStateSetter(t){const r=x.useRef(void 0);return r.current===void 0&&(r.current=a=>{this.set(t,a)}),r.current}observe(t,r){let a;typeof t=="function"?a=t:a=this.selectors[t];let i=a(this.state);return r(i,i,this),this.subscribe(c=>{const u=a(c);if(!Object.is(i,u)){const f=i;i=u,r(u,f,this)}})}}const 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 T2 extends _u{constructor(r){const{syncOnly:a,nested:i,onOpenChange:c,triggerElements:u,...f}=r;super({...f,positionReference:f.referenceElement,domReferenceElement:f.referenceElement},{onOpenChange:c,dataRef:{current:{}},events:wM(),nested:i,triggerElements:u},XB);ln(this,"syncOpenEvent",(r,a)=>{(!r||!this.state.open||a!=null&&h$(a))&&(this.context.dataRef.current.openEvent=r?a:void 0)});ln(this,"dispatchOpenChange",(r,a)=>{this.syncOpenEvent(r,a.event);const i={open:r,reason:a.reason,nativeEvent:a.event,nested:this.context.nested,triggerElement:a.trigger};this.context.events.emit("openchange",i)});ln(this,"setOpen",(r,a)=>{var i,c,u,f;if(this.syncOnly){(c=(i=this.context).onOpenChange)==null||c.call(i,r,a);return}this.dispatchOpenChange(r,a),(f=(u=this.context).onOpenChange)==null||f.call(u,r,a)});this.syncOnly=a}}function PM(e){const{popupStore:t,treatPopupAsFloatingElement:r=!1,floatingRootContext:a,floatingId:i,nested:c,onOpenChange:u}=e,f=t.useState("open"),m=t.useState("activeTriggerElement"),h=t.useState(r?"popupElement":"positionerElement"),g=t.context.triggerElements,p=u,b=x.useRef(null);a===void 0&&b.current===null&&(b.current=new T2({open:f,transitionStatus:void 0,referenceElement:m,floatingElement:h,triggerElements:g,onOpenChange:p,floatingId:i,syncOnly:!0,nested:c}));const v=a??b.current;return t.useSyncedValue("floatingId",i),We(()=>{const w={open:f,floatingId:i,referenceElement:m,floatingElement:h};Ft(m)&&(w.domReferenceElement=m),v.state.positionReference===v.state.referenceElement&&(w.positionReference=m),v.update(w)},[f,i,m,h,v]),v.context.onOpenChange=p,v.context.nested=c,v}const Wf={tabIndex:-1,[Ry]:""};function _M(e){return t=>t==="touch"?e.current:!0}function E2(e,t=!1){const r=sc(),a=ol()!=null,i=bs(()=>e(r,a)).current;return PM({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:r,nested:a,onOpenChange:i.setOpen}),i}function tx({handle:e,store:t}){return We(()=>e.attachStore(t),[e,t]),null}function f5(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function WB(e,t){const r=x.useRef(null);return st(a=>{const i=r.current;if(i!==null){if(i.element===a&&i.store===t&&i.id===e)return;r.current=null;const c=i.store;c.context.triggerElements.getById(i.id)===i.element&&(c.context.triggerElements.delete(i.id),f5(c))}a!==null&&e!==void 0&&(r.current={store:t,id:e,element:a},t.context.triggerElements.add(e,a),f5(t))})}function nx(e,t,r,a=!1){let i=e.preventUnmountingOnClose;t?i=!1:a&&(i=!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:i,activeTriggerId:u,activeTriggerElement:f}}function R2(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function QB(e,t,r,a={}){var g,p,b;const i=r.reason,c=i===Qn,u=t&&i===gu,f=!t&&(i===ma||i===Hf),m=R2(r);if((p=(g=e.context).onOpenChange)==null||p.call(g,t,r),r.isCanceled)return;(b=a.onBeforeDispatch)==null||b.call(a),e.state.floatingRootContext.dispatchOpenChange(t,r);const h=()=>{const v=nx(e.state,t,r.trigger,m()),w={...a.extraState,...v};u?w.instantType="focus":f?w.instantType="dismiss":c&&(w.instantType=void 0),e.update(w)};c?go.flushSync(h):h()}function A2(e,t,r,a){const i=r.useState("isMountedByTrigger",e),c=WB(e,r),u=st(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=st(m=>{c(m),m&&u(m)});return We(()=>(f(t.current),()=>f(null)),[f,t,r,e]),We(()=>{if(i){const m={activeTriggerElement:t.current,...a};r.update(m)}},[i,r,t,...Object.values(a)]),{registerTrigger:f,isMountedByThisTrigger:i}}function sx(e,t={}){const{closeOnActiveTriggerUnmount:r=!1}=t,a=x.useRef(null),i=e.useState("open"),c=e.useState("triggerCount"),u=e.useState("activeTriggerId"),f=e.useState("activeTriggerElement");We(()=>{if(!i){a.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const m=e.context.triggerElements.size,h={};e.state.triggerCount!==m&&(h.triggerCount=m);const g=e.select("activeTriggerId");let p=null;if(g){const b=e.context.triggerElements.getById(g);if(b)a.current=g,b!==e.state.activeTriggerElement&&(h.activeTriggerElement=b);else{for(const[v,w]of e.context.triggerElements.entries())if(w===e.state.activeTriggerElement){h.activeTriggerId=v,h.activeTriggerElement=w,a.current=v;break}h.activeTriggerId===void 0&&(a.current===g?p=g:a.current=null)}}else a.current=null;if(!p&&!g&&m===1){const b=e.context.triggerElements.entries().next();if(!b.done){const[v,w]=b.value;h.activeTriggerId=v,h.activeTriggerElement=w,a.current=v}}(h.triggerCount!==void 0||h.activeTriggerId!==void 0||h.activeTriggerElement!==void 0)&&e.update(h),p&&r&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===p&&!e.context.triggerElements.getById(p)){const b=yt(Ur);e.setOpen(!1,b),b.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,c,u,f,r])}function rx(e,t,r,a){const{mounted:i,setMounted:c,transitionStatus:u}=ni(e,!1,!1,a),f=t.useState("preventUnmountingOnClose"),m=e?!1:f;t.useSyncedValues({mounted:i,transitionStatus:u,preventUnmountingOnClose:m});const h=st(()=>{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 Sr({enabled:i&&!e&&!m,open:e,ref:t.context.popupRef,onComplete(){e||h()}}),{forceUnmount:h,transitionStatus:u}}function ox(e,t){e.useSyncedValues(t),We(()=>()=>{e.update({activeTriggerProps:En,inactiveTriggerProps:En,popupProps:En})},[e])}function LM(e,t){We(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),We(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Qf{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 ax(e,t,r=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new T2({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:En,inactiveTriggerProps:En,popupProps:En}}const rf=e=>e.triggerIdProp??e.activeTriggerId,M2=e=>e.openProp??e.open,h5=e=>{var r;return(((r=e.popupElement)==null?void 0:r.id)??e.floatingId)||void 0};function $M(e,t){return t!==void 0&&M2(e)&&rf(e)===t}function ZB(e,t){return $M(e,t)?!0:t!==void 0&&M2(e)&&rf(e)==null&&e.triggerCount===1}const ix={open:M2,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:rf,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:h5,isTriggerActive:(e,t)=>t!==void 0&&rf(e)===t,isOpenedByTrigger:(e,t)=>$M(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&rf(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>ZB(e,t)?h5(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function O2(e){const t=x.useCallback(a=>e===void 0?Ln:e.subscribeStore(a),[e]),r=x.useCallback(()=>e===void 0?void 0:e.store,[e]);return C2.useSyncExternalStore(t,r,()=>e==null?void 0:e.serverStore)}function JB(e){const{open:t=!1,onOpenChange:r,elements:a={}}=e,i=sc(),c=ol()!=null,u=bs(()=>new T2({open:t,transitionStatus:void 0,onOpenChange:r,referenceElement:a.reference??null,floatingElement:a.floating??null,triggerElements:new Qf,floatingId:i,syncOnly:!1,nested:c})).current;return We(()=>{const f={open:t,floatingId:i};a.reference!==void 0&&(f.referenceElement=a.reference,f.domReferenceElement=Ft(a.reference)?a.reference:null),a.floating!==void 0&&(f.floatingElement=a.floating),u.update(f)},[t,i,a.reference,a.floating,u]),u.context.onOpenChange=r,u.context.nested=c,u}function eV(e){return tV(e,e.rootContext)}function tV(e,t){const{nodeId:r,externalTree:a}=e,i=t.useState("referenceElement"),c=t.useState("floatingElement"),u=t.useState("domReferenceElement"),f=t.useState("open"),m=t.useState("floatingId"),[h,g]=x.useState(null),[p,b]=x.useState(void 0),[v,w]=x.useState(void 0),C=x.useRef(null),S=al(a),N=x.useMemo(()=>({reference:i,floating:c,domReference:u}),[i,c,u]),E=AB({...e,elements:{...N,...h&&{reference:h}}}),T=Ft(p)?p:null,R=v===void 0?t.state.floatingElement:v;t.useSyncedValue("referenceElement",p??null),t.useSyncedValue("domReferenceElement",p===void 0?u:T),t.useSyncedValue("floatingElement",R);const M=x.useCallback(H=>{const G=Ft(H)?{getBoundingClientRect:()=>H.getBoundingClientRect(),getClientRects:()=>H.getClientRects(),contextElement:H}:H;g(G),E.refs.setReference(G)},[E.refs]),A=x.useCallback(H=>{(Ft(H)||H===null)&&(C.current=H,b(H)),(Ft(E.refs.reference.current)||E.refs.reference.current===null||H!==null&&!Ft(H))&&E.refs.setReference(H)},[E.refs,b]),k=x.useCallback(H=>{w(H),E.refs.setFloating(H)},[E.refs]),O=x.useMemo(()=>({...E.refs,setReference:A,setFloating:k,setPositionReference:M,domReference:C}),[E.refs,A,k,M]),D=x.useMemo(()=>({...E.elements,domReference:u}),[E.elements,u]),_=x.useMemo(()=>({...E,dataRef:t.context.dataRef,open:f,onOpenChange:t.setOpen,events:t.context.events,floatingId:m,refs:O,elements:D,nodeId:r,rootStore:t}),[E,O,D,r,t,f,m]);return We(()=>{u&&(C.current=u)},[u]),We(()=>{t.context.dataRef.current.floatingContext=_;const H=S==null?void 0:S.nodesRef.current.find(G=>G.id===r);H&&(H.context=_)}),x.useMemo(()=>({...E,context:_,refs:O,elements:D,rootStore:t}),[E,O,D,_,t])}const Av=u2&&ri;function BM(e,t={}){const{enabled:r=!0,delay:a}=t,i="rootStore"in e?e.rootStore:e,{events:c,dataRef:u}=i.context,f=x.useRef(!1),m=x.useRef(null),h=x.useRef(!0),g=us();x.useEffect(()=>{const b=i.select("domReferenceElement");if(!r)return;const v=Rn(b);function w(){const N=i.select("domReferenceElement");!i.select("open")&&wn(N)&&N===Xs(Ht(N))&&(f.current=!0,m.current=N)}function C(){h.current=!0}function S(){h.current=!1}return oa($t(v,"blur",w),Av&&$t(v,"keydown",C,!0),Av&&$t(v,"pointerdown",S,!0))},[i,r]),x.useEffect(()=>{if(!r)return;function b(v){if(v.reason===ma||v.reason===Hf){const w=i.select("domReferenceElement");Ft(w)&&(m.current=w,f.current=!0)}}return c.on("openchange",b),()=>{c.off("openchange",b)}},[c,r,i]);const p=x.useMemo(()=>{function b(){f.current=!1,m.current=null}return{onMouseLeave(){b()},onFocus(v){const w=v.currentTarget;if(f.current){if(m.current===w)return;b()}const C=Vs(v.nativeEvent);if(Ft(C)){if(Av&&!v.relatedTarget){if(!h.current&&!Wg(C))return}else if(!g$(C))return}const S=Wp(v.relatedTarget,i.context.triggerElements),{nativeEvent:N,currentTarget:E}=v,T=typeof a=="function"?a():a;if(i.select("open")&&S||T===0||T===void 0){i.setOpen(!0,yt(gu,N,E));return}g.start(T,()=>{f.current||i.setOpen(!0,yt(gu,N,E))})},onBlur(v){b();const w=v.relatedTarget,C=v.nativeEvent,S=Ft(w)&&w.hasAttribute(yf("focus-guard"))&&w.getAttribute("data-type")==="outside";g.start(0,()=>{var R;const N=i.select("domReferenceElement"),E=Xs(Ht(N));!w&&E===N||gt((R=u.current.floatingContext)==null?void 0:R.refs.floating.current,E)||gt(N,E)||S||Wp(w??E,i.context.triggerElements)||i.setOpen(!1,yt(gu,C))})}}},[u,a,i,g]);return x.useMemo(()=>r?{reference:p,trigger:p}:{},[r,p])}class D2{constructor(){ln(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ln(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 xo,this.restTimeout=new xo,this.handleCloseOptions=void 0}static create(){return new D2}}const tg=new WeakMap;function ng(e){var r,a,i;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&tg.get(t)===e&&((r=e.pointerEventsScopeElement)==null||r.style.removeProperty("pointer-events"),(a=e.pointerEventsReferenceElement)==null||a.style.removeProperty("pointer-events"),(i=e.pointerEventsFloatingElement)==null||i.style.removeProperty("pointer-events"),tg.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function VM(e,t){const{scopeElement:r,referenceElement:a,floatingElement:i}=t,c=tg.get(r);c&&c!==e&&ng(c),ng(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=r,e.pointerEventsReferenceElement=a,e.pointerEventsFloatingElement=i,tg.set(r,e),r.style.pointerEvents="none",a.style.pointerEvents="auto",i.style.pointerEvents="auto"}function z2(e){const t=e.context.dataRef.current,r=bs(()=>t.hoverInteractionState??D2.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=r),o2(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function I2(e,t={}){const{enabled:r=!0,closeDelay:a=0,nodeId:i}=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=al(),p=ol(),b=z2(c),v=us(),w=st(()=>{var N;return eM((N=h.current.openEvent)==null?void 0:N.type,b.interactedInside)}),C=st(()=>{var N;return b$((N=h.current.openEvent)==null?void 0:N.type)}),S=st(()=>{ng(b)});We(()=>{u||(b.pointerType=void 0,b.restTimeoutPending=!1,b.interactedInside=!1,S())},[u,b,S]),x.useEffect(()=>S,[S]),We(()=>{var N,E,T,R,M;if(r&&u&&(N=b.handleCloseOptions)!=null&&N.blockPointerEvents&&C()&&Ft(m)&&f){const A=m,k=f,O=Ht(f),D=(T=(E=g==null?void 0:g.nodesRef.current.find(B=>B.id===p))==null?void 0:E.context)==null?void 0:T.elements.floating;D&&(D.style.pointerEvents="");const _=b.pointerEventsScopeElement!==k?b.pointerEventsScopeElement:null,H=D!==k?D:null,G=((M=(R=b.handleCloseOptions)==null?void 0:R.getScope)==null?void 0:M.call(R))??_??H??A.closest("[data-rootownerid]")??O.body;return VM(b,{scopeElement:G,referenceElement:A,floatingElement:k}),()=>{S()}}},[r,u,m,f,b,C,g,p,S]),x.useEffect(()=>{if(!r)return;function N(){return!!(g&&p&&nl(g.nodesRef.current,p).length>0)}function E(O){const D=rc(a,"close",b.pointerType),_=()=>{c.setOpen(!1,yt(Qn,O)),g==null||g.events.emit("floating.closed",O)};D?b.openChangeTimeout.start(D,_):(b.openChangeTimeout.clear(),_())}function T(O){const D=Vs(O);if(!p$(D)){b.interactedInside=!1;return}b.interactedInside=(D==null?void 0:D.closest("[aria-haspopup]"))!=null}function R(){b.openChangeTimeout.clear(),v.clear(),g==null||g.events.off("floating.closed",A),S()}function M(O){var G;if(N()&&g){g.events.on("floating.closed",A);return}if(Wp(O.relatedTarget,c.context.triggerElements))return;const D=((G=h.current.floatingContext)==null?void 0:G.nodeId)??i,_=O.relatedTarget;if(!(g&&D&&Ft(_)&&nl(g.nodesRef.current,D,!1).some(B=>{var P;return gt((P=B.context)==null?void 0:P.elements.floating,_)}))){if(b.handler){b.handler(O);return}S(),C()&&!w()&&E(O)}}function A(O){!g||!p||N()||v.start(0,()=>{g.events.off("floating.closed",A),c.setOpen(!1,yt(Qn,O)),g.events.emit("floating.closed",O)})}const k=f;return oa(k&&$t(k,"mouseenter",R),k&&$t(k,"mouseleave",M),k&&$t(k,"pointerdown",T,!0),()=>{g==null||g.events.off("floating.closed",A)})},[r,f,c,h,a,i,C,w,S,b,g,p,v])}const nV={current:null};function P2(e,t={}){const{enabled:r=!0,delay:a=0,handleClose:i=null,mouseOnly:c=!1,restMs:u=0,move:f=!0,triggerElementRef:m=nV,externalTree:h,isActiveTrigger:g=!0,getHandleCloseContext:p,isClosing:b,shouldOpen:v,guardStaleOpen:w=!1}=t,C="rootStore"in e?e.rootStore:e,{dataRef:S,events:N}=C.context,E=al(h),T=z2(C),R=x.useRef(!1),M=qn(i),A=qn(a),k=qn(u),O=qn(r),D=qn(v),_=qn(b),H=st(()=>{var q;return eM((q=S.current.openEvent)==null?void 0:q.type,T.interactedInside)}),G=st(()=>{var q;return((q=D.current)==null?void 0:q.call(D))!==!1}),B=st((q,W,K)=>{const J=C.context.triggerElements;if(J.hasElement(W))return!q||!gt(q,W);if(!Ft(K))return!1;const z=K;return J.hasMatchingElement(L=>gt(L,z))&&(!q||!gt(q,z))}),P=st(()=>{if(!T.handler)return;Ht(C.select("domReferenceElement")).removeEventListener("mousemove",T.handler),T.handler=void 0}),V=st(()=>{ng(T)});return g&&(T.handleCloseOptions=i==null?void 0:i.__options),x.useEffect(()=>P,[P]),x.useEffect(()=>{if(!r)return;function q(W){W.open?R.current=!1:(R.current=W.reason===Qn,P(),T.openChangeTimeout.clear(),T.restTimeout.clear(),T.blockMouseMove=!0,T.restTimeoutPending=!1)}return N.on("openchange",q),()=>{N.off("openchange",q)}},[r,N,T,P]),x.useEffect(()=>{if(!r)return;function q(X,ee=!0){const $=rc(A.current,"close",T.pointerType);$?T.openChangeTimeout.start($,()=>{C.setOpen(!1,yt(Qn,X)),E==null||E.events.emit("floating.closed",X)}):ee&&(T.openChangeTimeout.clear(),C.setOpen(!1,yt(Qn,X)),E==null||E.events.emit("floating.closed",X))}const W=m.current??(g?C.select("domReferenceElement"):null);if(!Ft(W))return;function K(X){var pe;if(T.openChangeTimeout.clear(),T.blockMouseMove=!1,c&&!Hi(T.pointerType))return;const ee=Uk(k.current),$=rc(A.current,"open",T.pointerType),U=Vs(X),F=X.currentTarget??null,Y=C.select("domReferenceElement");let ne=F;if(Ft(U)&&!C.context.triggerElements.hasElement(U)){for(const xe of C.context.triggerElements.elements())if(gt(xe,U)){ne=xe;break}}Ft(F)&&Ft(Y)&&!C.context.triggerElements.hasElement(F)&&gt(F,Y)&&(ne=Y);const te=ne==null?!1:B(Y,ne,U),ye=C.select("open"),ae=((pe=_.current)==null?void 0:pe.call(_))??C.select("transitionStatus")==="ending",ue=!ye&&ae&&R.current,se=!te&&Ft(ne)&&Ft(Y)&&gt(Y,ne)&&ue,Q=ee>0&&!$,ie=te&&(ye||ue)||se,oe=!ye||te;if(ie){G()&&C.setOpen(!0,yt(Qn,X,ne));return}Q||($?T.openChangeTimeout.start($,()=>{oe&&G()&&C.setOpen(!0,yt(Qn,X,ne))}):oe&&G()&&C.setOpen(!0,yt(Qn,X,ne)))}function J(X){if(H()){V();return}P();const ee=C.select("domReferenceElement"),$=Ht(ee);T.restTimeout.clear(),T.restTimeoutPending=!1;const U=S.current.floatingContext??(p==null?void 0:p());if(Wp(X.relatedTarget,C.context.triggerElements))return;if(M.current&&U){C.select("open")||T.openChangeTimeout.clear();const Y=m.current;T.handler=M.current({...U,tree:E,x:X.clientX,y:X.clientY,onClose(){V(),P(),O.current&&!H()&&Y===C.select("domReferenceElement")&&q(X,!0)}}),$.addEventListener("mousemove",T.handler),T.handler(X);return}(T.pointerType==="touch"?!gt(C.select("floatingElement"),X.relatedTarget):!0)&&q(X)}function z(X){gt(W,X.relatedTarget)||(T.openChangeTimeout.clear(),T.restTimeout.clear(),T.restTimeoutPending=!1)}const L=w?$t(W,"mouseout",z):void 0;return f?oa($t(W,"mousemove",K,{once:!0}),$t(W,"mouseenter",K),$t(W,"mouseleave",J),L):oa($t(W,"mouseenter",K),$t(W,"mouseleave",J),L)},[P,V,S,A,C,r,M,T,g,B,H,c,f,k,m,E,O,p,_,G,w]),x.useMemo(()=>{if(!r)return;function q(W){T.pointerType=W.pointerType}return{onPointerDown:q,onPointerEnter:q,onMouseMove(W){var U,F,Y;const{nativeEvent:K}=W,J=W.currentTarget,z=C.select("domReferenceElement"),L=C.select("open"),X=B(z,J,W.target);if(c&&!Hi(T.pointerType))return;if(L&&X&&((U=T.handleCloseOptions)!=null&&U.blockPointerEvents)){const ne=C.select("floatingElement");if(ne){const te=((Y=(F=T.handleCloseOptions)==null?void 0:F.getScope)==null?void 0:Y.call(F))??J.ownerDocument.body;VM(T,{scopeElement:te,referenceElement:J,floatingElement:ne})}}const ee=Uk(k.current);if(L&&!X||ee===0||!X&&T.restTimeoutPending&&W.movementX**2+W.movementY**2<2)return;T.restTimeout.clear();function $(){if(T.restTimeoutPending=!1,H())return;const ne=C.select("open");!T.blockMouseMove&&(!ne||X)&&G()&&C.setOpen(!0,yt(Qn,K,J))}T.pointerType==="touch"?go.flushSync(()=>{$()}):X&&L?$():(T.restTimeoutPending=!0,T.restTimeout.start(ee,$))}}},[r,T,H,B,c,C,k,G])}const sV="Escape";function m5(e){return ri&&e.movementX===0&&e.movementY===0}function lx(e,t,r){switch(e){case"vertical":return t;case"horizontal":return r;default:return t||r}}function Lm(e,t){return lx(t,e===JA||e===h2,e===Kg||e===Xg)}function Mv(e,t,r){return lx(t,e===h2,r?e===Kg:e===Xg)||e==="Enter"||e===" "||e===""}function rV(e,t,r){return lx(t,r?e===Kg:e===Xg,e===h2)}function oV(e,t,r,a){const i=r?e===Xg:e===Kg,c=e===JA;return t==="both"||t==="horizontal"&&a?e===sV:lx(t,i,c)}function UM(e,t){const{listRef:r,activeIndex:a,onNavigate:i=()=>{},enabled:c=!0,selectedIndex:u=null,allowEscape:f=!1,loopFocus:m=!1,nested:h=!1,rtl:g=!1,virtual:p=!1,focusItemOnOpen:b="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:w=!0,disabledIndices:C=void 0,orientation:S="vertical",parentOrientation:N,id:E,resetOnPointerLeave:T=!0,externalTree:R,grid:M}=t,A=M!=null,k="rootStore"in e?e.rootStore:e,O=k.useState("open"),D=k.useState("floatingElement"),_=k.useState("domReferenceElement"),H=k.context.dataRef,G=Qp(D),B=My(_),P=qn(G),V=ol(),q=al(R),W=x.useRef(b),K=x.useRef(u??-1),J=x.useRef(null),z=x.useRef(!0),L=st(fe=>{i(K.current===-1?null:K.current,fe)}),X=x.useRef(!!D),ee=x.useRef(O),$=x.useRef(!1),U=x.useRef(!1),F=x.useRef(null),Y=qn(C),ne=qn(O),te=qn(u),ye=qn(T),ae=Eu(),ue=Eu(),se=st(()=>{function fe(he){p?q==null||q.events.emit("virtualfocus",he):F.current=vp(he,{sync:$.current,preventScroll:!0})}const Re=r.current[K.current],Oe=U.current;Re&&fe(Re),($.current?he=>he():he=>ae.request(he))(()=>{var ge;const he=r.current[K.current]||Re;if(!he)return;Re||fe(he),je&&(Oe||!z.current)&&((ge=he.scrollIntoView)==null||ge.call(he,{block:"nearest",inline:"nearest"}))})});We(()=>{H.current.orientation=S},[H,S]),We(()=>{c&&(O&&D?(K.current=u??-1,W.current&&u!=null&&(U.current=!0,L())):X.current&&(K.current=-1,L()))},[c,O,D,u,L]),We(()=>{if(c){if(!O){$.current=!1;return}if(D)if(a==null){if($.current=!1,te.current!=null)return;if(X.current&&(K.current=-1,se()),(!ee.current||!X.current)&&W.current&&(J.current!=null||W.current===!0&&J.current==null)){let fe=0;const Re=()=>{r.current[0]==null?(fe<2&&(fe?ke=>ue.request(ke):queueMicrotask)(Re),fe+=1):(K.current=J.current==null||Mv(J.current,S,g)||h?bp(r):Dy(r),J.current=null,L())};Re()}}else sf(r.current,a)||(K.current=a,se(),U.current=!1)}},[c,O,D,a,te,h,r,S,g,L,se,ue]),We(()=>{var he,Ae;if(!c||D||!q||p||!X.current)return;const fe=q.nodesRef.current,Re=(Ae=(he=fe.find(ge=>ge.id===V))==null?void 0:he.context)==null?void 0:Ae.elements.floating,Oe=Xs(Ht(_??Re??null)),ke=fe.some(ge=>ge.context&&gt(ge.context.elements.floating,Oe));Re&&!ke&&z.current&&Re.focus({preventScroll:!0})},[c,D,_,q,V,p]),We(()=>{ee.current=O,X.current=!!D}),We(()=>{O||(J.current=null,W.current=b)},[O,b]);const Q=a!=null,ie=st(fe=>{if(!ne.current)return;const Re=r.current.indexOf(fe.currentTarget);Re!==-1&&(K.current!==Re||a!==Re)&&(K.current=Re,L(fe))}),oe=st(()=>{var fe,Re,Oe;return N??((Oe=(Re=(fe=q==null?void 0:q.nodesRef.current.find(ke=>ke.id===V))==null?void 0:fe.context)==null?void 0:Re.dataRef)==null?void 0:Oe.current.orientation)}),pe=st(()=>bp(r,Y.current)),xe=st(fe=>{if(z.current=!1,$.current=!0,fe.which===229||!ne.current&&fe.currentTarget===P.current)return;if(h&&oV(fe.key,S,g,A)){Lm(fe.key,oe())||ta(fe),k.setOpen(!1,yt(Ty,fe.nativeEvent)),wn(_)&&(p?q==null||q.events.emit("virtualfocus",_):_.focus());return}const Re=K.current,Oe=bp(r,C),ke=Dy(r,C);if(B||(fe.key==="Home"&&(ta(fe),K.current=Oe,L(fe)),fe.key==="End"&&(ta(fe),K.current=ke,L(fe))),M!=null){const he=M(fe,K.current,r,S,m,g,C,Oe,ke);if(he!=null&&(K.current=he,L(fe)),S==="both")return}if(Lm(fe.key,S)){if(ta(fe),O&&!p&&Xs(fe.currentTarget.ownerDocument)===fe.currentTarget){K.current=Mv(fe.key,S,g)?Oe:ke,L(fe);return}Mv(fe.key,S,g)?m?Re>=ke?f&&Re!==r.current.length?K.current=-1:($.current=!1,K.current=Oe):K.current=Ba(r.current,{startingIndex:Re,disabledIndices:C}):K.current=Math.min(ke,Ba(r.current,{startingIndex:Re,disabledIndices:C})):m?Re<=Oe?f&&Re!==-1?K.current=r.current.length:($.current=!1,K.current=ke):K.current=Ba(r.current,{startingIndex:Re,decrement:!0,disabledIndices:C}):K.current=Math.max(Oe,Ba(r.current,{startingIndex:Re,decrement:!0,disabledIndices:C})),sf(r.current,K.current)&&(K.current=-1),L(fe)}}),je=x.useMemo(()=>({onFocus(Re){$.current=!0,ie(Re)},onClick:({currentTarget:Re})=>Re.focus({preventScroll:!0}),onMouseMove(Re){m5(Re)||($.current=!0,U.current=!1,v&&ie(Re))},onPointerLeave(Re){var ke;if(!ne.current||!z.current||Re.pointerType==="touch")return;$.current=!0;const Oe=Re.relatedTarget;if(!(!v||r.current.includes(Oe))&&ye.current&&((ke=F.current)==null||ke.call(F),F.current=null,K.current=-1,L(Re),!p)){const he=P.current,Ae=Xs(Ht(he));he&&gt(he,Ae)&&he.focus({preventScroll:!0})}}}),[ie,ne,P,v,r,L,ye,p]),Ie=x.useMemo(()=>p&&O&&Q&&{"aria-activedescendant":`${E}-${a}`},[p,O,Q,E,a]),ce=x.useMemo(()=>({...B?{}:Ie,onKeyDown(fe){if(fe.key==="Tab"&&fe.shiftKey&&O&&!p){const Re=Vs(fe.nativeEvent);if(Re&&!gt(P.current,Re))return;ta(fe),k.setOpen(!1,yt(Ji,fe.nativeEvent)),wn(_)&&_.focus();return}xe(fe)},onPointerMove(fe){m5(fe)||(z.current=!0)}}),[Ie,xe,P,B,k,O,p,_]),Te=x.useMemo(()=>{function fe(ke){k.setOpen(!0,yt(Ty,ke.nativeEvent,ke.currentTarget))}function Re(ke){b==="auto"&&Yg(ke.nativeEvent)&&(W.current=!p)}function Oe(ke){W.current=b,b==="auto"&&f2(ke.nativeEvent)&&(W.current=!0)}return{onKeyDown(ke){const he=k.select("open");z.current=!1;const Ae=ke.key.startsWith("Arrow"),ge=rV(ke.key,oe(),g),Pe=Lm(ke.key,S),Fe=(h?ge:Pe)||ke.key==="Enter"||ke.key.trim()==="";if(p&&he)return xe(ke);if(!(!he&&!w&&Ae)){if(Fe){const _e=Lm(ke.key,oe());J.current=h&&_e?null:ke.key}if(h){ge&&(ta(ke),he?(K.current=pe(),L(ke)):fe(ke));return}Pe&&(te.current!=null&&(K.current=te.current),ta(ke),!he&&w?fe(ke):xe(ke),he&&L(ke))}},onFocus(ke){k.select("open")&&!p&&(K.current=-1,L(ke))},onPointerDown:Oe,onPointerEnter:Oe,onMouseDown:Re,onClick:Re}},[xe,b,pe,h,L,k,w,S,oe,g,te,p]),re=x.useMemo(()=>({...Ie,...Te}),[Ie,Te]);return x.useMemo(()=>c?{reference:re,floating:ce,item:je,trigger:Te}:{},[c,re,ce,Te,je])}function HM(e,t){const{listRef:r,elementsRef:a,activeIndex:i,onMatch:c,disabledIndices:u,onTyping:f,enabled:m=!0,resetMs:h=750,selectedIndex:g=null}=t,p="rootStore"in e?e.rootStore:e,b=p.useState("open"),v=us(),w=x.useRef(""),C=x.useRef(g??i??-1),S=x.useRef(null),N=st(R=>{function M(P){return a==null?void 0:a.current[P]}function A(P){const V=M(P);return V&&!Qg(V)||V!=null&&V.matches(":disabled")?!1:u==null||!xu(Vr,P,u)}function k(P,V,q=0){if(P.length===0)return-1;const W=(q%P.length+P.length)%P.length,K=V.toLowerCase();for(let J=0;J<P.length;J+=1){const z=(W+J)%P.length,L=P[z];if(!(!(L!=null&&L.toLowerCase().startsWith(K))||!A(z)))return z}return-1}const O=r.current;if(w.current.length>0&&R.key===" "&&(ta(R),f==null||f(!0)),w.current.length>0&&w.current[0]!==" "&&k(O,w.current)===-1&&R.key!==" "&&(f==null||f(!1)),O==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;b&&R.key!==" "&&(ta(R),f==null||f(!0));const D=w.current==="";D&&(C.current=g??i??-1),O.every((P,V)=>{var q,W;return P&&A(V)?((q=P[0])==null?void 0:q.toLowerCase())!==((W=P[1])==null?void 0:W.toLowerCase()):!0})&&w.current===R.key&&(w.current="",C.current=S.current),w.current+=R.key,v.start(h,()=>{w.current="",C.current=S.current,f==null||f(!1)});const G=((D?g??i??-1:C.current)??0)+1,B=k(O,w.current,G);B!==-1?(c==null||c(B),S.current=B):R.key!==" "&&(w.current="",f==null||f(!1))}),E=st(R=>{const M=R.relatedTarget,A=p.select("domReferenceElement"),k=p.select("floatingElement");gt(A,M)||gt(k,M)||(v.clear(),w.current="",C.current=S.current,f==null||f(!1))});We(()=>{!b&&g!==null||(v.clear(),S.current=null,w.current!==""&&(w.current=""))},[b,g,v]);const T=x.useMemo(()=>({onKeyDown:N,onBlur:E}),[N,E]);return x.useMemo(()=>m?{reference:T,floating:T}:{},[m,T])}const p5=.1,aV=p5*p5,kn=.5;function $m(e,t,r,a,i,c){return a>=t!=c>=t&&e<=(i-r)*(t-a)/(c-a)+r}function Bm(e,t,r,a,i,c,u,f,m,h){let g=!1;return $m(e,t,r,a,i,c)&&(g=!g),$m(e,t,i,c,u,f)&&(g=!g),$m(e,t,u,f,m,h)&&(g=!g),$m(e,t,m,h,r,a)&&(g=!g),g}function iV(e,t,r){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height}function Vm(e,t,r,a,i,c){const u=Math.min(r,i),f=Math.max(r,i),m=Math.min(a,c),h=Math.max(a,c);return e>=u&&e<=f&&t>=m&&t<=h}function _2(e={}){const{blockPointerEvents:t=!1}=e,r=new xo,a=({x:i,y:c,placement:u,elements:f,onClose:m,nodeId:h,tree:g})=>{const p=u==null?void 0:u.split("-")[0];let b=!1,v=null,w=null,C=typeof performance<"u"?performance.now():0;function S(E,T){const R=performance.now(),M=R-C;if(v===null||w===null||M===0)return v=E,w=T,C=R,!1;const A=E-v,k=T-w,O=A*A+k*k,D=M*M*aV;return v=E,w=T,C=R,O<D}function N(){r.clear(),m()}return function(T){r.clear();const R=f.domReference,M=f.floating;if(!R||!M||p==null||i==null||c==null)return;const{clientX:A,clientY:k}=T,O=Vs(T),D=T.type==="mouseleave",_=gt(M,O),H=gt(R,O);if(_&&(b=!0,!D))return;if(H&&(b=!1,!D)){b=!0;return}if(D&&Ft(T.relatedTarget)&&gt(M,T.relatedTarget))return;function G(){return!!(g&&nl(g.nodesRef.current,h).length>0)}function B(){G()||N()}if(G())return;const P=R.getBoundingClientRect(),V=M.getBoundingClientRect(),q=i>V.right-V.width/2,W=c>V.bottom-V.height/2,K=V.width>P.width,J=V.height>P.height,z=(K?P:V).left,L=(K?P:V).right,X=(J?P:V).top,ee=(J?P:V).bottom;if(p==="top"&&c>=P.bottom-1||p==="bottom"&&c<=P.top+1||p==="left"&&i>=P.right-1||p==="right"&&i<=P.left+1){B();return}let $=!1;switch(p){case"top":$=Vm(A,k,z,P.top+1,L,V.bottom-1);break;case"bottom":$=Vm(A,k,z,V.top+1,L,P.bottom-1);break;case"left":$=Vm(A,k,V.right-1,ee,P.left+1,X);break;case"right":$=Vm(A,k,P.right-1,ee,V.left+1,X);break}if($)return;if(b&&!iV(A,k,P)){B();return}if(!D&&S(A,k)){B();return}let U=!1;switch(p){case"top":{const F=K?kn/2:kn*4,Y=K||q?i+F:i-F,ne=K?i-F:q?i+F:i-F,te=c+kn+1,ye=q||K?V.bottom-kn:V.top,ae=q?K?V.bottom-kn:V.top:V.bottom-kn;U=Bm(A,k,Y,te,ne,te,V.left,ye,V.right,ae);break}case"bottom":{const F=K?kn/2:kn*4,Y=K||q?i+F:i-F,ne=K?i-F:q?i+F:i-F,te=c-kn,ye=q||K?V.top+kn:V.bottom,ae=q?K?V.top+kn:V.bottom:V.top+kn;U=Bm(A,k,Y,te,ne,te,V.left,ye,V.right,ae);break}case"left":{const F=J?kn/2:kn*4,Y=J||W?c+F:c-F,ne=J?c-F:W?c+F:c-F,te=i+kn+1,ye=W||J?V.right-kn:V.left,ae=W?J?V.right-kn:V.left:V.right-kn;U=Bm(A,k,ye,V.top,ae,V.bottom,te,Y,te,ne);break}case"right":{const F=J?kn/2:kn*4,Y=J||W?c+F:c-F,ne=J?c-F:W?c+F:c-F,te=i-kn,ye=W||J?V.left+kn:V.right,ae=W?J?V.left+kn:V.right:V.left+kn;U=Bm(A,k,te,Y,te,ne,ye,V.top,ae,V.bottom);break}}U?b||r.start(40,B):B()}};return a.__options={...e,blockPointerEvents:t},a}const FM=x.createContext(void 0);function lV(){const e=x.useContext(FM);if(e===void 0)throw new Error(rn(26));return e}const Ly="ArrowUp",$y="ArrowDown",By="ArrowLeft",Vy="ArrowRight",Uy="Home",Hy="End",Zf=new Set([Ly,$y,By,Vy,Uy,Hy]),cV="Shift",uV=[cV,"Control","Alt","Meta"];function dV(e){return wn(e)&&e.tagName==="INPUT"}function g5(e){return!!(dV(e)&&e.selectionStart!=null||wn(e)&&e.tagName==="TEXTAREA")}function x5(e,t,r,a){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,c=e.scrollTop;const u=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(u&&a!=="vertical"){const m=b5(e,t,"left"),h=Um(e),g=Um(t);r==="ltr"&&(m+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-h.scrollPaddingRight?i=m+t.offsetWidth+g.scrollMarginRight-e.clientWidth+h.scrollPaddingRight:m-g.scrollMarginLeft<e.scrollLeft+h.scrollPaddingLeft&&(i=m-g.scrollMarginLeft-h.scrollPaddingLeft)),r==="rtl"&&(m-g.scrollMarginLeft<e.scrollLeft+h.scrollPaddingLeft?i=m-g.scrollMarginLeft-h.scrollPaddingLeft:m+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-h.scrollPaddingRight&&(i=m+t.offsetWidth+g.scrollMarginRight-e.clientWidth+h.scrollPaddingRight))}if(f&&a!=="horizontal"){const m=b5(e,t,"top"),h=Um(e),g=Um(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:i,top:c,behavior:"auto"})}function b5(e,t,r){const a=r==="left"?"offsetLeft":"offsetTop";let i=0;for(;t.offsetParent&&(i+=t[a],t.offsetParent!==e);)t=t.offsetParent;return i}function Um(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 fV="--nested-dialogs",hV="data-nested-dialog-open",mV={...qf,...si,nestedDialogOpen(e){return e?{[hV]:""}:null}},L2=x.forwardRef(function(t,r){const{render:a,className:i,style:c,finalFocus:u,initialFocus:f,...m}=t,h=mc(),g=h.useState("descriptionElementId"),p=h.useState("disablePointerDismissal"),b=h.useState("floatingRootContext"),v=h.useState("popupProps"),w=h.useState("modal"),C=h.useState("mounted"),S=h.useState("nested"),N=h.useState("nestedOpenDialogCount"),E=h.useState("open"),T=h.useState("openMethod"),R=h.useState("titleElementId"),M=h.useState("transitionStatus"),A=h.useState("role"),k=b.useState("floatingId");lV(),Sr({open:E,ref:h.context.popupRef,onComplete(){var B,P;E&&((P=(B=h.context).onOpenChangeComplete)==null||P.call(B,!0))}});const O=f===void 0?_M(h.context.popupRef):f,D=N>0,_=h.useStateSetter("popupElement"),G=Nt("div",t,{state:{open:E,nested:S,transitionStatus:M,nestedDialogOpen:D},props:[v,{id:k,"aria-labelledby":R,"aria-describedby":g,role:A,...Wf,hidden:!C,onKeyDown(B){Zf.has(B.key)&&B.stopPropagation()},style:{[fV]:N}},m],ref:[r,h.context.popupRef,_],stateAttributesMapping:mV});return n.jsx(Jg,{context:b,openInteractionType:T,disabled:!C,closeOnFocusOut:!p,initialFocus:O,returnFocus:u,modal:w!==!1,restoreFocus:"popup",children:G})});function Jf(e){return G1(19)?e:e?"true":void 0}const cx=x.forwardRef(function(t,r){const{cutout:a,...i}=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 n.jsx("div",{ref:r,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),$2=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t,c=mc(),u=c.useState("mounted"),f=c.useState("modal"),m=c.useState("open");return u||a?n.jsx(FM.Provider,{value:a,children:n.jsxs(Zg,{ref:r,...i,children:[u&&f===!0&&n.jsx(cx,{ref:c.context.internalBackdropRef,inert:Jf(!m)}),t.children]})}):null});let v5={},y5={},w5="";function ux(e,t){return zf(e)?e:t}function j5(e,t,r){return/hidden|clip/.test(e.getComputedStyle(ux(t,r)).overflowY)}function pV(e){if(typeof document>"u")return!1;const t=Ht(e);return Rn(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=Ht(e),a=r.documentElement,i=r.body,c=ux(a,i),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=Ht(e),r=t.documentElement,a=t.body,i=ux(r,a),c={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,c)}}function bV(e){var v;const t=Ht(e),r=t.documentElement,a=t.body,i=Rn(r);let c=0,u=0,f=!1;const m=wr.create();if(ri&&(((v=i.visualViewport)==null?void 0:v.scale)??1)!==1)return()=>{};function h(){const w=i.getComputedStyle(r),C=i.getComputedStyle(a),E=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=r.scrollTop,u=r.scrollLeft,v5={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},w5=r.style.scrollBehavior,y5={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};const T=r.scrollHeight>r.clientHeight,R=r.scrollWidth>r.clientWidth,M=w.overflowY==="scroll"||C.overflowY==="scroll",A=w.overflowX==="scroll"||C.overflowX==="scroll",k=Math.max(0,i.innerWidth-a.clientWidth),O=Math.max(0,i.innerHeight-a.clientHeight),D=parseFloat(C.marginTop)+parseFloat(C.marginBottom),_=parseFloat(C.marginLeft)+parseFloat(C.marginRight),H=ux(r,a);if(f=gV(e),f){r.style.scrollbarGutter=E,H.style.overflowY="hidden",H.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(T||M)&&(r.style.overflowY="scroll"),(R||A)&&(r.style.overflowX="scroll"),Object.assign(a.style,{position:"relative",height:D||O?`calc(100dvh - ${D+O}px)`:"100dvh",width:_||k?`calc(100vw - ${_+k}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,v5),Object.assign(a.style,y5),f||(r.scrollTop=c,r.scrollLeft=u,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=w5)}function p(){g(),m.request(h)}h();const b=$t(i,"resize",p);return()=>{m.cancel(),g(),typeof i.removeEventListener=="function"&&b()}}class vV{constructor(){ln(this,"lockCount",0);ln(this,"restore",null);ln(this,"timeoutLock",xo.create());ln(this,"timeoutUnlock",xo.create());ln(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});ln(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=Ht(t),a=r.documentElement,i=r.body,c=Rn(a);if(j5(c,a,i)){const f=new c.MutationObserver(()=>{j5(c,a,i)||(f.disconnect(),this.restore=null,this.lock(t))}),m={attributes:!0};f.observe(a,m),f.observe(i,m),this.restore=()=>f.disconnect();return}const u=qg||!pV(t);this.restore=u?xV(t):bV(t)}}const yV=new vV;function GM(e=!0,t=null){We(()=>{if(e)return yV.acquire(t)},[e,t])}function wV({store:e,parentContext:t,isDrawer:r}){const a=e.useState("open"),i=e.useState("disablePointerDismissal"),c=e.useState("modal"),u=e.useState("popupElement"),f=e.useState("floatingRootContext"),[m,h]=x.useState(0),[g,p]=x.useState(0),b=m===0,v=Kf(f,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(w){if(!e.context.outsidePressEnabledRef.current||"button"in w&&w.button!==0)return!1;if("touches"in w){if(w.type==="touchend"){if(w.changedTouches.length!==1||w.touches.length!==0)return!1}else if(w.touches.length!==1)return!1}const C=Vs(w);if(b&&!i){if(c){const S=e.context.internalBackdropRef.current,N=e.context.backdropRef.current;return S||N?S===C||N===C||gt(C,u)&&!(C!=null&&C.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:b});return GM(a&&c===!0,u),e.useContextCallback("onNestedDialogOpen",(w,C)=>{h(w),p(C)}),We(()=>(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]),ox(e,{activeTriggerProps:v.reference,inactiveTriggerProps:v.trigger,popupProps:v.floating,nestedOpenDialogCount:m,nestedOpenDrawerCount:g}),null}const jV={...ix,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 SV extends _u{constructor(r,a,i){const c=new Qf,u=NV(r,c,a,i);super(u,CV(c),jV);ln(this,"setOpen",(r,a)=>{var i,c;a.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!r&&a.trigger==null&&this.state.activeTriggerId!=null&&(a.trigger=this.state.activeTriggerElement??void 0),(c=(i=this.context).onOpenChange)==null||c.call(i,r,a),!a.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(r,a),this.update(nx(this.state,r,a.trigger)))})}}function NV(e,t,r,a=!1){return{...ax(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 CV(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function qM(e,t){const{children:r,open:a,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:u,disablePointerDismissal:f=!1,modal:m=!0,actionsRef:h,handle:g,triggerId:p,defaultTriggerId:b=null}=t,v=e==="drawer",w=e==="alert-dialog",C=w?!0:m,S=w||f,N=w?"alertdialog":"dialog",E=mc(!0),T=E!=null,R={modal:C,disablePointerDismissal:S,nested:T,role:N},M=E2((H,G)=>new SV({open:i,openProp:a,activeTriggerId:b,triggerIdProp:p,...R},H,G),!0);M.useControlledProp("openProp",a),M.useControlledProp("triggerIdProp",p),M.useSyncedValues(R),M.useContextCallback("onOpenChange",c),M.useContextCallback("onOpenChangeComplete",u);const A=M.useState("open"),k=M.useState("mounted"),O=M.useState("payload");LM(M,A),sx(M);const{forceUnmount:D}=rx(A,M);x.useImperativeHandle(h,()=>({unmount:D,close:()=>M.setOpen(!1,yt(Ug))}),[D,M]);const _=A||k;return n.jsxs(WA.Provider,{value:M,children:[g&&n.jsx(tx,{handle:g,store:M}),_&&n.jsx(wV,{store:M,parentContext:E==null?void 0:E.context,isDrawer:v}),typeof r=="function"?r({payload:O}):r]})}const YM=Xf(function(t){return qM("dialog",t)}),B2=x.forwardRef(function(t,r){const{render:a,className:i,style:c,id:u,...f}=t,m=mc(),h=ys(u);return m.useSyncedValueWithCleanup("titleElementId",h),Nt("h2",t,{ref:r,props:[{id:h},f]})});function kV(e){const t=x.useRef(""),r=x.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:x.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:r}}function KM(e,t){const r=st((c,u)=>{(typeof e=="function"?e():e)||t(u||(qg?"touch":""))}),{onClick:a,onPointerDown:i}=kV(r);return x.useMemo(()=>({onClick:a,onPointerDown:i}),[a,i])}function XM(e){const[t,r]=x.useState(null),a=KM(e,r);return Ff(e,i=>{i&&!e&&r(null)}),x.useMemo(()=>({openMethod:t,triggerProps:a}),[t,a])}function tn({...e}){return n.jsx(YM,{"data-slot":"dialog",...e})}function TV({...e}){return n.jsx($2,{"data-slot":"dialog-portal",...e})}function EV({className:e,...t}){return n.jsx(l2,{"data-slot":"dialog-overlay",className:Ve("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 nn({className:e,children:t,showCloseButton:r=!0,...a}){return n.jsxs(TV,{children:[n.jsx(EV,{}),n.jsxs(L2,{"data-slot":"dialog-content",className:Ve("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&&n.jsxs(Fg,{"data-slot":"dialog-close",render:n.jsx(le,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[n.jsx(In,{}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function sn({className:e,...t}){return n.jsx("div",{"data-slot":"dialog-header",className:Ve("flex flex-col gap-2",e),...t})}function Hr({className:e,showCloseButton:t=!1,children:r,...a}){return n.jsxs("div",{"data-slot":"dialog-footer",className:Ve("-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&&n.jsx(Fg,{render:n.jsx(le,{variant:"outline"}),children:"Close"})]})}function Qt({className:e,...t}){return n.jsx(B2,{"data-slot":"dialog-title",className:Ve("font-heading text-base leading-none font-medium",e),...t})}function Sn({className:e,...t}){return n.jsx(c2,{"data-slot":"dialog-description",className:Ve("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const dx=x.createContext(null);function Zn({location:e,children:t}){var m;const r=Bf(),a=js(),i=a!=null&&a.localViewer&&(e!=null&&e.target)?e.target:r.target,c=i==="cloud"?((m=a==null?void 0:a.status)==null?void 0:m.owner)??r.owner:r.owner,u=x.useMemo(()=>lr(i,r.signal,e==null?void 0:e.context,c),[i,r.signal,e==null?void 0:e.context,c]),f=x.useMemo(()=>({location:e,api:u}),[e,u]);return n.jsx(d7,{target:e==null?void 0:e.target,children:n.jsx(dx.Provider,{value:f,children:t})})}function Pt(){var t;const e=Bf();return((t=x.useContext(dx))==null?void 0:t.api)??e}function gn(){var e;return((e=x.useContext(dx))==null?void 0:e.location)??null}function WM({api:e,location:t=null,children:r}){return n.jsx(dx.Provider,{value:{location:t,api:e},children:r})}function fx({record:e}){return n.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[s2(e).map(t=>n.jsx(Hs,{location:t.location},ht(t))),e.configurationCount>1&&n.jsx("span",{className:"text-[10px] leading-tight text-muted-foreground",title:"Configurations differ. Open the row and select a source to inspect or edit its copy.",children:"Varies by source"})]})}function wf({record:e,onChange:t,disabled:r}){const a=s2(e);return n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Source"}),a.map(i=>{var c;return n.jsx("button",{type:"button",disabled:r||((c=i.location)==null?void 0:c.connected)===!1,"aria-pressed":ht(i)===ht(e),"aria-label":`Edit in ${Dn(i.location)}`,onClick:()=>t({...i,copies:a}),className:"rounded-full p-0.5 outline-none aria-pressed:ring-2 aria-pressed:ring-ring focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:n.jsx(Hs,{location:i.location})},ht(i))})]})}function hx({record:e,type:t,offer:r,children:a}){const i=Pt(),c=gn(),u=x.useMemo(()=>{const f={groups:["saveGroup"],network:["savePolicy"],setups:["deleteSetupItem"],templates:["buildImageTemplate"]}[t]??[];return{...i,...Object.fromEntries(f.map(m=>[m,async(...h)=>{var p;const g=await i[m](...h);return(p=h[0])!=null&&p.isNew||r({type:t,before:e,method:m,args:h}),g}]))}},[i,e,t,r]);return n.jsx(WM,{api:u,location:c,children:a})}function mx(e,t,r){const[a,i]=x.useState(null),[c,u]=x.useState([]),[f,m]=x.useState({}),[h,g]=x.useState(!1),p=v=>{var C,S;if(!((C=v.before)!=null&&C.name)||!((S=v.before)!=null&&S.location))return;const w=p7(v.before,e);w.length&&(i({...v,targets:w}),u([]),m({}))},b=a&&n.jsx(tn,{open:!0,onOpenChange:v=>{!v&&!h&&i(null)},children:n.jsxs(nn,{className:"sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Apply to other sources?"}),n.jsxs(Sn,{children:["Saved in ",Dn(a.before.location),". Choose where to apply the same change to “",a.before.name,"”."]})]}),n.jsx("div",{className:"divide-y rounded-lg border",children:a.targets.map(v=>{const w=ht(v),C=Bi(a.type,v)!==Bi(a.type,a.before);return n.jsxs("label",{className:"flex items-start gap-3 p-3 text-xs",children:[n.jsx($o,{checked:c.includes(w),disabled:h||!v.location.connected||f[w]==="Applied",onCheckedChange:S=>u(N=>S?[...N,w]:N.filter(E=>E!==w))}),n.jsxs("span",{className:"space-y-1",children:[n.jsx(Hs,{location:v.location}),C&&n.jsx("span",{className:"block text-muted-foreground",children:"Different configuration · only changed fields will be applied."}),!v.location.connected&&n.jsx("span",{className:"block text-muted-foreground",children:"Disconnected"}),f[w]&&n.jsx("span",{role:"status",className:"block",children:f[w]})]})]},w)})}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{variant:"ghost",disabled:h,onClick:()=>i(null),children:Object.values(f).includes("Applied")?"Done":"Only this source"}),n.jsx(le,{disabled:h||!c.some(v=>f[v]!=="Applied"),onClick:async()=>{var v,w,C;g(!0);for(const S of a.targets.filter(N=>c.includes(ht(N))&&f[ht(N)]!=="Applied")){let N;try{const E=await g7(a,S,t(S.location));N=(v=E==null?void 0:E.sync)!=null&&v.error||(C=(w=E==null?void 0:E.sync)==null?void 0:w.failed)!=null&&C.length?"Saved; sandbox synchronization needs attention.":"Applied"}catch(E){N=E.message}m(E=>({...E,[ht(S)]:N}))}try{await r()}finally{g(!1)}},children:h?"Applying…":"Apply selected"})]})]})});return{offer:p,dialog:b}}const QM=[{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."}],RV=QM,AV=QM.filter(e=>e.config&&e.skills),Fy=e=>AV.find(t=>t.id===e),MV=e=>e.filter(t=>!!Fy(t)),OV=x.forwardRef(function(t,r){const{render:a,className:i,id:c,name:u,value:f,disabled:m=!1,onValueChange:h,defaultValue:g,autoFocus:p=!1,style:b,...v}=t,{state:w,name:C,disabled:S,setTouched:N,setDirty:E,validityData:T,setFocused:R,setFilled:M,validationMode:A,validation:k}=Pu(),{clearErrors:O,elementRef:D,submitCountRef:_}=Bg(),H=S||m,G=C??u,B={...w,disabled:H},{labelId:P}=Vf(),V=Uf({id:c}),[q]=po({controlled:f,default:g,name:"FieldControl",state:"value"}),W=f!==void 0,K=W?q:void 0,J=K==null?void 0:String(K),z=st(()=>{var $;return($=k.inputRef.current)==null?void 0:$.value});$g(k.inputRef,V,J,z,!H,u),We(()=>{var U;const $=J??((U=k.inputRef.current)==null?void 0:U.value);$!==void 0&&M($!=="")},[J,k.inputRef,M]),Ff(J,()=>{J!==void 0&&(O(G),E(J!==(T.initialValue??"")),k.change(J))});const L=x.useRef(null),X=us();return We(()=>{p&&L.current===Xs(Ht(L.current))&&R(!0)},[p,R]),Nt("input",t,{ref:[r,L],state:B,props:[{id:V,disabled:H,name:G,ref:k.inputRef,"aria-labelledby":P,autoFocus:p,...W?{value:K}:{defaultValue:g},onChange($){const U=$.currentTarget.value,F=yt(Ur,$.nativeEvent);h==null||h(U,F),!W&&(E(U!==(T.initialValue??"")),M(U!==""),!$.nativeEvent.defaultPrevented&&!F.isCanceled&&(O(G),k.change(U)))},onFocus(){R(!0)},onBlur($){if(N(!0),R(!1),A==="onBlur"){const U=$.currentTarget.value;k.commit(U),W&&queueMicrotask(()=>{var Y;const F=(Y=k.inputRef.current)==null?void 0:Y.value;F!==void 0&&F!==U&&F!==(T.initialValue??"")&&k.commit(F)})}},onKeyDown($){if($.currentTarget.tagName==="INPUT"&&$.key==="Enter"){N(!0);const U=$.currentTarget.value,F=$.currentTarget.form;if(F&&F===D.current&&!$.defaultPrevented){const Y=$.currentTarget,ne=_.current;X.start(0,()=>{_.current===ne&&k.commit(Y.value)})}else k.commit(U)}}},v,$=>k.getValidationProps(H,$)],stateAttributesMapping:Lg})}),DV=x.forwardRef(function(t,r){return n.jsx(OV,{ref:r,...t})});function Ot({className:e,type:t,...r}){return n.jsx(DV,{type:t,"data-slot":"input",className:Ve("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})}function zV({className:e,...t}){return n.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:n.jsx("table",{"data-slot":"table",className:ws("w-full caption-bottom text-sm",e),...t})})}function IV({className:e,...t}){return n.jsx("thead",{"data-slot":"table-header",className:ws("[&_tr]:border-b",e),...t})}function PV({className:e,...t}){return n.jsx("tbody",{"data-slot":"table-body",className:ws("[&_tr:last-child]:border-0",e),...t})}function S5({className:e,...t}){return n.jsx("tr",{"data-slot":"table-row",className:ws("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function Ov({className:e,...t}){return n.jsx("th",{"data-slot":"table-head",className:ws("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function $l({className:e,...t}){return n.jsx("td",{"data-slot":"table-cell",className:ws("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function Lu(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 jf(e){return!e||!Number.isFinite(Date.parse(e))?"Not reported":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}function _V(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}function LV(e){const[t,r]=x.useState({current:e,previous:null});return Object.is(e,t.current)||r({current:e,previous:t.current}),t.previous}function ZM(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const JM=x.createContext(void 0),e3=x.createContext(void 0),t3=x.createContext(void 0);function wa(){const e=x.useContext(JM);if(e===void 0)throw new Error(rn(60));return e}function px(){const e=x.useContext(e3);if(e===void 0)throw new Error(rn(101));return e}function n3(){const e=x.useContext(t3);if(e===void 0)throw new Error(rn(61));return e}function $V(e,t,r=Object.is){const{length:a}=e;if(a!==t.length)return!1;for(let i=0;i<a;i+=1)if(!r(e[i],t[i]))return!1;return!0}const s3=(e,t)=>Object.is(e,t);function ac(e,t,r){return e==null||t==null?Object.is(e,t):r(e,t)}function BV(e,t,r){return Array.isArray(e)&&Array.isArray(t)?!$V(e,t,(a,i)=>ac(a,i,r)):e!==t}function Gy(e,t,r){return e?e.some(a=>a===void 0?!1:ac(t,a,r)):!1}function wp(e,t,r){return e?e.findIndex(a=>a===void 0?!1:ac(a,t,r)):-1}function VV(e,t){if(t!==s3)return a=>Gy(e,a,t);const r=new Set(e);return r.delete(void 0),a=>r.has(a)&&(a!==0||e.some(i=>Object.is(a,i)))}function r3(e,t,r,a){const i=a&&Array.isArray(t)?e.findIndex(VV(t,r)):wp(e,t,r);return i===-1?null:i}function UV(e,t,r,a,i,c){return Gy(a,t,i)?c!=null&&e>c&&Gy(a,r[c],i)?c:e:e===c?r3(r,a,i,!0):c}function HV(e,t,r){return e.filter(a=>!ac(t,a,r))}function qy(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function FV(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function o3(e){return FV(e==null?void 0:e[0])}function GV(e){return o3(e)?e.flatMap(t=>t.items):e}function qV(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(o3(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 a3(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 qy(e)}function iu(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?qy(e.value):qy(e)}function i3(e,t,r){function a(){return a3(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=GV(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 YV(e,t,r){return e.reduce((a,i,c)=>(c>0&&a.push(", "),a.push(n.jsx(x.Fragment,{children:i3(i,t,r)},c)),a),[])}const KV={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:iu(t,a)!==""},hasNullItemLabel:(e,t)=>t?qV(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(i=>ac(t,i,r)):ac(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 Wd(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}const zo=1;function V2(e,t){return Math.max(0,e-t)}function sg(e,t){if(t<=0)return 0;const r=Wd(e,0,t),a=r,i=t-r,c=a<=zo,u=i<=zo;return c&&u?a<=i?0:t:c?0:u?t:r}function XV(e){const{id:t,value:r,defaultValue:a=null,onValueChange:i,open:c,defaultOpen:u=!1,onOpenChange:f,name:m,form:h,autoComplete:g,disabled:p=!1,readOnly:b=!1,required:v=!1,modal:w=!0,actionsRef:C,inputRef:S,onOpenChangeComplete:N,items:E,multiple:T=!1,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:A=s3,highlightItemOnHover:k=!0,children:O}=e,{clearErrors:D}=Bg(),{setDirty:_,setTouched:H,setFocused:G,validityData:B,setFilled:P,name:V,disabled:q,validation:W,validationMode:K}=Pu(),J=Uf({id:t}),z=q||p,L=V??m,[X,ee]=po({controlled:r,default:T?a??Vr:a,name:"Select",state:"value"}),[$,U]=po({controlled:c,default:u,name:"Select",state:"open"}),F=x.useRef([]),Y=x.useRef([]),ne=x.useRef(null),te=x.useRef(null),ye=x.useRef(0),ae=x.useRef(null),ue=x.useRef([]),se=x.useRef(!1),Q=x.useRef(null),ie=x.useRef(null),oe=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=x.useRef(!1),xe=x.useRef(X),{mounted:je,setMounted:Ie,transitionStatus:ce}=ni($),{openMethod:Te,triggerProps:re}=XM($),fe=bs(()=>new _u({id:J,labelId:void 0,modal:w,multiple:T,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:A,value:X,open:$,mounted:je,transitionStatus:ce,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:En,triggerProps:En,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:Ln,setOpen:Ln,handleScrollArrowVisibility:Ln,onOpenChangeComplete:Ln,listRef:F,popupRef:ne,scrollHandlerRef:te,scrollArrowsMountedCountRef:ye,valueRef:ae,valuesRef:ue,labelsRef:Y,typingRef:se,selectionRef:oe,firstItemTextRef:Q,selectedItemTextRef:ie,alignItemWithTriggerActiveRef:pe,initialValueRef:xe},KV)).current,Re=fe.useState("activeIndex"),Oe=fe.useState("selectedIndex"),ke=fe.useState("triggerElement"),he=fe.useState("positionerElement"),Ae=LV(Te),ge=Te??Ae,Pe=x.useMemo(()=>T?"":iu(X,M),[T,X,M]),Fe=x.useMemo(()=>T&&Array.isArray(X)?X.map(lt=>iu(lt,M)):iu(X,M),[T,X,M]),_e=qn(ke),Xe=st(()=>Fe);$g(_e,J,X,Xe,!z,m);const Je=T?Array.isArray(X)&&X.length>0:X!=null&&Pe!=="";We(()=>{P(Je)},[Je,P]),We(function(){const wt=r3(ue.current,X,A,T);wt===null&&(ie.current=null),!$&&fe.set("selectedIndex",wt)},[T,$,X,A,fe]),Ff(X,()=>{D(L),_(BV(X,B.initialValue,A)),W.change(X)});const ct=st((lt,wt)=>{f==null||f(lt,wt),!wt.isCanceled&&(U(lt),!lt&&(wt.reason===Ji||wt.reason===Vg)&&(H(!0),G(!1),K==="onBlur"&&W.commit(X)))}),At=st(()=>{Ie(!1),fe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),N==null||N(!1)});Sr({enabled:!C,open:$,ref:ne,onComplete(){$||At()}}),x.useImperativeHandle(C,()=>({unmount:At}),[At]);const rt=st((lt,wt)=>{i==null||i(lt,wt),!wt.isCanceled&&ee(lt)}),ve=st(lt=>{const wt=V2(lt.scrollHeight,lt.clientHeight),cn=sg(lt.scrollTop,wt),Gt=cn>0,fn=cn<wt;fe.set("scrollUpArrowVisible",Gt),fe.set("scrollDownArrowVisible",fn)}),Ue=JB({open:$,onOpenChange:ct,elements:{reference:ke,floating:he}}),Qe=S2(Ue,{enabled:!z,event:"mousedown"}),xt=Kf(Ue),Ke=UM(Ue,{enabled:!z,listRef:F,activeIndex:Re,selectedIndex:Oe,disabledIndices:Vr,onNavigate(lt){lt===null&&!$||fe.set("activeIndex",lt)},focusItemOnHover:k}),Be=HM(Ue,{enabled:!z&&($||!b&&!T),listRef:Y,activeIndex:Re,selectedIndex:Oe,disabledIndices:lt=>ZM(F.current[lt]),onMatch(lt){$?fe.set("activeIndex",lt):rt(ue.current[lt],yt(Ur))},onTyping(lt){se.current=lt}}),jt=x.useMemo(()=>Qs(Be.reference,Ke.reference,xt.reference,Qe.reference,re),[Qe.reference,Be.reference,Ke.reference,xt.reference,re]),Ze=x.useMemo(()=>Qs(Wf,Be.floating,Ke.floating,xt.floating),[Be.floating,Ke.floating,xt.floating]),Tt=Ke.item??En;fe.useContextCallback("setValue",rt),fe.useContextCallback("setOpen",ct),fe.useContextCallback("handleScrollArrowVisibility",ve),fe.useContextCallback("onOpenChangeComplete",N),_V(()=>{fe.update({popupProps:Ze,triggerProps:jt})}),fe.useSyncedValues({id:J,modal:w,multiple:T,value:X,open:$,mounted:je,transitionStatus:ce,popupProps:Ze,triggerProps:jt,items:E,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:A,openMethod:ge});const Se=x.useMemo(()=>({disabled:z,readOnly:b,required:v,multiple:T,highlightItemOnHover:k,itemProps:Tt}),[z,b,v,T,k,Tt]),Ye=mo(S,W.inputRef),et=T?void 0:L,it=x.useMemo(()=>!T||!Array.isArray(X)||!L?null:X.map(lt=>{const wt=iu(lt,M);return n.jsx("input",{type:"hidden",form:h,name:L,value:wt,disabled:z},wt)}),[T,X,h,L,M,z]);return n.jsxs(JM.Provider,{value:fe,children:[n.jsx(e3.Provider,{value:Se,children:n.jsx(t3.Provider,{value:Ue,children:O})}),n.jsx("input",{...W.getValidationProps(z,{onFocus(){var lt;(lt=fe.state.triggerElement)==null||lt.focus({focusVisible:!0})},onChange(lt){if(lt.nativeEvent.defaultPrevented||z||b)return;const wt=lt.currentTarget.value,cn=yt(Ur,lt.nativeEvent);function Gt(){if(T)return;const fn=wt.toLowerCase();let Bn=ue.current.findIndex(de=>iu(de,M).toLowerCase()===fn||a3(de,R).toLowerCase()===fn);Bn===-1&&(Bn=ue.current.findIndex((de,tt)=>{const Et=Y.current[tt];return Et!=null&&Et.toLowerCase()===fn}));const Kn=ue.current[Bn];Kn!=null&&rt(Kn,cn)}fe.set("forceMount",!0),queueMicrotask(Gt)}}),id:J&&et==null?`${J}-hidden-input`:void 0,form:h,name:et,autoComplete:g,value:Pe,disabled:z,required:v&&!(T&&Je),readOnly:b,ref:Ye,style:L?r2:_g,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),it]})}function WV(e,t){return e??t}const Hm=5;function l3(e,t){const r=QV(t);return e.clientX>=r.left-Hm&&e.clientX<=r.right+Hm&&e.clientY>=r.top-Hm&&e.clientY<=r.bottom+Hm}function QV(e){const t=e.getBoundingClientRect(),r=Rn(e);if(d2)return t;const a=r.getComputedStyle(e,"::before"),i=r.getComputedStyle(e,"::after");if(!(a.content!=="none"||i.content!=="none"))return t;const u=parseFloat(a.width)||0,f=parseFloat(a.height)||0,m=parseFloat(i.width)||0,h=parseFloat(i.height)||0,g=Math.max(t.width,u,m),p=Math.max(t.height,f,h),b=g-t.width,v=p-t.height;return{left:t.left-b/2,right:t.right+b/2,top:t.top-v/2,bottom:t.bottom+v/2}}const ZV="data-popup-side",JV=400,e9={...Xp,...Lg,popupSide:e=>e?{[ZV]:e}:null,value:()=>null},t9=x.forwardRef(function(t,r){var ye;const{render:a,className:i,id:c,disabled:u=!1,nativeButton:f=!0,style:m,...h}=t,{setTouched:g,setFocused:p,validationMode:b,validation:v,state:w,disabled:C}=Pu(),{labelId:S}=Vf(),N=wa(),{readOnly:E,required:T,disabled:R}=px(),M=C||R||u,A=N.useState("open"),k=N.useState("mounted"),O=N.useState("value"),D=N.useState("triggerProps"),_=N.useState("positionerElement"),H=N.useState("listElement"),G=N.useState("popupSide"),B=N.useState("id"),P=N.useState("labelId"),V=N.useState("hasSelectedValue"),q=k&&_?G:null,W=c??B,K=WV(S,P);Uf({id:c});const J=qn(_),z=x.useRef(null),{getButtonProps:L,buttonRef:X}=bo({disabled:M,native:f}),ee=N.useStateSetter("triggerElement"),$=us(),U=us(),F=us();x.useEffect(()=>{if(A)return F.start(JV,()=>{N.context.selectionRef.current.allowUnselectedMouseUp=!0,N.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{F.clear()};N.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[A,N,U,F]);const Y=Qs(D,{id:W,role:"combobox","aria-expanded":A,"aria-haspopup":"listbox","aria-controls":A?(H==null?void 0:H.id)??((ye=Qp(_))==null?void 0:ye.id):void 0,"aria-labelledby":K,"aria-readonly":E||void 0,"aria-required":T||void 0,tabIndex:M?-1:0,onFocus(ae){p(!0),A&&N.context.alignItemWithTriggerActiveRef.current&&N.context.setOpen(!1,yt(Ur,ae.nativeEvent)),$.start(0,()=>{N.set("forceMount",!0)})},onBlur(ae){gt(_,ae.relatedTarget)||(g(!0),p(!1),b==="onBlur"&&v.commit(O))},onMouseDown(ae){if(A)return;const ue=Ht(ae.currentTarget);function se(Q){if(!z.current)return;const ie=Q.target;gt(z.current,ie)||gt(J.current,ie)||l3(Q,z.current)||N.context.setOpen(!1,yt(KA,Q))}U.start(0,()=>{ue.addEventListener("mouseup",se,{once:!0})})}},h,L),ne=v.getValidationProps(M,Y);ne.role="combobox";const te={...w,open:A,disabled:M,value:O,readOnly:E,popupSide:q,placeholder:!V};return Nt("button",t,{ref:[r,z,X,ee],state:te,stateAttributesMapping:e9,props:ne})}),n9={value:()=>null},s9=x.forwardRef(function(t,r){const{className:a,render:i,children:c,placeholder:u,style:f,...m}=t,h=wa(),g=h.useState("value"),p=h.useState("items"),b=h.useState("itemToStringLabel"),v=h.useState("hasSelectedValue"),w=!v&&u!=null&&c==null,C=h.useState("hasNullItemLabel",w),S={value:g,placeholder:!v};let N=null;return typeof c=="function"?N=c(g):c!=null?N=c:w&&!C?N=u:Array.isArray(g)?N=YV(g,p,b):N=i3(g,p,b),Nt("span",t,{state:S,ref:[r,h.context.valueRef],props:[{children:N},m],stateAttributesMapping:n9})}),r9=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,h={open:wa().useState("open")};return Nt("span",t,{state:h,ref:r,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:i2})}),o9=x.forwardRef(function(t,r){const a=wa(),i=a.useState("mounted"),c=a.useState("forceMount");return i||c?n.jsx(Zg,{ref:r,...t}):null}),c3=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function a9(){return x.useContext(c3)}function eh(e){const{children:t,elementsRef:r,labelsRef:a,onMapChange:i}=e,c=st(i),[,u]=x.useState(!1),f=bs(l9).current,m=bs(i9).current,h=x.useRef(0),g=x.useRef(!0),p=x.useRef(null),b=x.useRef(null),v=st(()=>{g.current||(g.current=!0,u(M=>!M))}),w=st((M,A)=>{m.set(M,A),v()}),C=st(M=>{m.delete(M),v()}),S=st(M=>{const A=new Map;return r.current.length=0,a&&(a.current.length=0),M.forEach(k=>{var O,D;A.set(k.element,{...k.registration.metadata??{},index:k.index}),r.current[k.index]=k.element,a&&(a.current[k.index]=k.registration.label!==void 0?k.registration.label:((D=(O=k.registration.textRef)==null?void 0:O.current)==null?void 0:D.textContent)??k.element.textContent)}),h.current=r.current.length,A});function N(M){var O;if((O=b.current)==null||O.disconnect(),b.current=null,typeof MutationObserver!="function"||M.length<2)return;const A=new MutationObserver(D=>{if(!d9(D))return;let _=null;for(const H of M)if(H.isConnected){if(_&&u3(_,H)>0){A.disconnect(),v();return}_=H}});b.current=A;const k=new Set;for(let D=1;D<M.length;D+=1){const _=u9(M[D-1],M[D]);_&&k.add(_)}k.forEach(D=>A.observe(D,{childList:!0}))}const E=st(()=>{const[M,A]=c9(m),k=S(M),O=p.current,D=!O||O.length!==M.length||M.some((_,H)=>{const G=O[H];return _.index!==G.index||_.element!==G.element||_.registration.index!==G.registration.index||_.registration.metadata!==G.registration.metadata});N(A),p.current=M,g.current=!1,D&&(f.forEach(_=>_(k)),c(k))});We(()=>(!g.current&&p.current&&S(p.current),()=>{r.current=[],a&&(a.current=[])}),[r,a,S]),We(()=>{g.current&&E()}),We(()=>()=>{var M;(M=b.current)==null||M.disconnect(),g.current=!0},[]);const T=st(M=>(f.add(M),()=>{f.delete(M)})),R=x.useMemo(()=>({register:w,unregister:C,subscribeMapChange:T,nextIndexRef:h}),[w,C,T,h]);return n.jsx(c3.Provider,{value:R,children:t})}function i9(){return new Map}function l9(){return new Set}function c9(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 i=0;return a.sort((c,u)=>u3(c.element,u.element)),a.forEach(c=>{for(;t.has(i);)i+=1;c.index=i,r.push(c),i+=1}),t.size>0&&r.sort((c,u)=>c.index-u.index),[r,a.map(c=>c.element)]}function u9(e,t){let r=e.parentElement;for(;r&&!r.contains(t);)r=r.parentElement;return r}function d9(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 u3(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const f9=x.createContext(void 0);function gx(){const e=x.useContext(f9);return(e==null?void 0:e.direction)??"ltr"}const h9=e=>({name:"arrow",options:e,async fn(t){var J,z;const{x:r,y:a,placement:i,rects:c,platform:u,elements:f,middlewareData:m}=t,{element:h,padding:g=0,offsetParent:p="real"}=tl(e,t)||{};if(h==null)return{};const b=sM(g),v={x:r,y:a},w=g2(i),C=p2(w),S=await u.getDimensions(h),N=w==="y",E=N?"top":"left",T=N?"bottom":"right",R=N?"clientHeight":"clientWidth",M=c.reference[C]+c.reference[w]-v[w]-c.floating[C],A=v[w]-c.reference[w],k=p==="real"?await((J=u.getOffsetParent)==null?void 0:J.call(u,h)):f.floating;let O=f.floating[R]||c.floating[C];(!O||!await((z=u.isElement)==null?void 0:z.call(u,k)))&&(O=f.floating[R]||c.floating[C]);const D=M/2-A/2,_=O/2-S[C]/2-1,H=Math.min(b[E],_),G=Math.min(b[T],_),B=H,P=O-S[C]-G,V=O/2-S[C]/2+D,q=nM(B,V,P),W=!m.arrow&&Xa(i)!=null&&V!==q&&c.reference[C]/2-(V<B?H:G)-S[C]/2<0,K=W?V<B?V-B:V-P:0;return{[w]:v[w]+K,data:{[w]:q,centerOffset:V-q-K,...W&&{alignmentOffset:K}},reset:W}}}),m9=(e,t)=>{const{name:r,fn:a}=h9(e);return{name:r,fn:a,options:[e,t]}},p9={name:"hide",async fn(e){const{width:t,height:r,x:a,y:i}=e.rects.reference,c=t===0&&r===0&&a===0&&i===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}}}},g9={sideX:"left",sideY:"top"},x9="--available-width",b9="--available-height",v9="--anchor-width",y9="--anchor-height",w9="--transform-origin",N5=x9,C5=b9;function d3(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 k5(e,t,r){const{rects:a,placement:i}=e;return{side:d3(t,uo(i),r),align:Xa(i)||"center",anchor:{width:a.reference.width,height:a.reference.height},positioner:{width:a.floating.width,height:a.floating.height}}}function xx(e){return j9(e,eV)}function j9(e,t){var xt,Ke;const{anchor:r,positionMethod:a="absolute",side:i="bottom",sideOffset:c=0,align:u="center",alignOffset:f=0,collisionBoundary:m,collisionPadding:h=5,sticky:g=!1,arrowPadding:p=5,disableAnchorTracking:b=!1,inline:v,keepMounted:w=!1,floatingRootContext:C,mounted:S,collisionAvoidance:N,shift:E,nodeId:T,adaptiveOrigin:R,lazyFlip:M=!1,externalTree:A}=e,[k,O]=x.useState(null);!S&&k!==null&&O(null);const D=N.side||"flip",_=N.align||"flip",H=N.fallbackAxisSide||"end",G=(E==null?void 0:E.crossAxis)??!1,B=E==null?void 0:E.rootBoundary,P=typeof r=="function"?r:void 0,V=st(P),q=P?V:r,W=qn(r),K=qn(S),z=gx()==="rtl",L=k||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":z?"left":"right","inline-start":z?"right":"left"}[i],X=u==="center"?L:`${L}-${u}`;let ee=h;typeof ee=="number"?ee={top:ee,right:ee,bottom:ee,left:ee}:ee&&(ee={top:ee.top||0,right:ee.right||0,bottom:ee.bottom||0,left:ee.left||0});const $=1,U=i==="bottom"?$:0,F=i==="top"?$:0,Y=i==="right"?$:0,ne=i==="left"?$:0,te={boundary:m==="clipping-ancestors"?"clippingAncestors":m,padding:ee},ye=x.useRef(null),ae=qn(c),ue=qn(f),se=typeof c!="function"?c:0,Q=typeof f!="function"?f:0,ie=[];v&&ie.push(v),ie.push(MB(Be=>{const jt=k5(Be,i,z),Ze=typeof ae.current=="function"?ae.current(jt):ae.current,Tt=typeof ue.current=="function"?ue.current(jt):ue.current;return{mainAxis:Ze,crossAxis:Tt,alignmentAxis:Tt}},[se,Q,z,i]));const oe=_==="none"&&D!=="shift",pe=!oe&&(g||G||D==="shift"),xe=D==="none"?null:zB({...te,padding:{top:ee.top+$+U,right:ee.right+$+ne,bottom:ee.bottom+$+F,left:ee.left+$+Y},mainAxis:!G&&D==="flip",crossAxis:_==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),je=oe?null:OB({...te,rootBoundary:B,mainAxis:_!=="none",crossAxis:pe,limiter:g||G?void 0:DB(Be=>{if(!ye.current)return{};const{width:jt,height:Ze}=ye.current.getBoundingClientRect(),Tt=co(uo(Be.placement)),Se=Tt==="y"?jt:Ze,Ye=Tt==="y"?ee.left+ee.right:ee.top+ee.bottom;return{offset:Se/2+Ye/2}})},[te,g,G,B,ee,_]);D==="shift"||_==="shift"||u==="center"?ie.push(je,xe):ie.push(xe,je),ie.push(IB({...te,apply({elements:{floating:Be},availableWidth:jt,availableHeight:Ze,rects:Tt}){if(!K.current)return;const Se=Be.style;Se.setProperty(N5,`${jt}px`),Se.setProperty(C5,`${Ze}px`);const Ye=Rn(Be).devicePixelRatio||1,{x:et,y:it,width:lt,height:wt}=Tt.reference,cn=(Math.round((et+lt)*Ye)-Math.round(et*Ye))/Ye,Gt=(Math.round((it+wt)*Ye)-Math.round(it*Ye))/Ye;Se.setProperty(v9,`${cn}px`),Se.setProperty(y9,`${Gt}px`)}}),m9(Be=>({element:ye.current||Ht(Be.elements.floating).createElement("div"),padding:ye.current?p:0,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(Be){var Kn,de,tt,Et,on,xn;const{elements:{floating:jt},middlewareData:Ze,placement:Tt,platform:Se,rects:Ye,y:et}=Be,it=uo(Tt),lt=Xa(Tt),wt=co(it)==="y",cn=ye.current,Gt=typeof c=="function"?c(k5(Be,i,z)):c;let fn;if(!cn&&lt&&Math.abs(wt?((Kn=Ze.shift)==null?void 0:Kn.x)||0:((de=Ze.shift)==null?void 0:de.y)||0)<=1)fn=lt==="start"===(wt&&((tt=Se.isRTL)==null?void 0:tt.call(Se,jt))===!0)?"100%":"0%";else{const Wt=wt?((Et=Ze.arrow)==null?void 0:Et.x)||0:((on=Ze.arrow)==null?void 0:on.y)||0,un=wt?(cn==null?void 0:cn.clientWidth)||0:(cn==null?void 0:cn.clientHeight)||0;fn=`${Wt+un/2}px`}let Bn=it==="top"||it==="left"?`calc(100% + ${Gt}px)`:`${-Gt}px`;return pe&&wt&&Math.abs(((xn=Ze.shift)==null?void 0:xn.y)||0)>Gt&&(Bn=`${Ye.reference.y+Ye.reference.height/2-et}px`),jt.style.setProperty(w9,wt?`${fn} ${Bn}`:`${Bn} ${fn}`),{}}},p9,R),We(()=>{!S&&C&&C.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[S,C]);const Ie=x.useMemo(()=>({ancestorScroll:!b,elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:ce,elements:Te,x:re,y:fe,middlewareData:Re,update:Oe,placement:ke,context:he,isPositioned:Ae,floatingStyles:ge}=t({rootContext:C,open:w?S:void 0,placement:X,middleware:ie,strategy:a,whileElementsMounted:w?void 0:(...Be)=>a5(...Be,Ie),nodeId:T,externalTree:A}),{sideX:Pe,sideY:Fe}=Re.adaptiveOrigin||g9,_e=Ae?a:"fixed",Xe=x.useMemo(()=>{let Be;return Ae?R?Be={position:_e,[Pe]:re,[Fe]:fe}:Be={...ge,position:_e}:Be={position:_e,top:0,left:0},Be[N5]="100vw",Be[C5]="100vh",Ae||(Be.opacity=0),Be},[R,_e,Pe,re,Fe,fe,ge,Ae]),Je=x.useRef(null);We(()=>{if(!S)return;const Be=W.current,jt=typeof Be=="function"?Be():Be,Tt=(T5(jt)?jt.current:jt)||null||null;Tt!==Je.current&&(ce.setPositionReference(Tt),Je.current=Tt)},[S,ce,q,W]),x.useEffect(()=>{if(!S)return;const Be=W.current;typeof Be!="function"&&T5(Be)&&Be.current!==Je.current&&(ce.setPositionReference(Be.current),Je.current=Be.current)},[S,ce,q,W]),x.useEffect(()=>{if(w&&S&&Te.reference&&Te.floating)return a5(Te.reference,Te.floating,Oe,Ie)},[w,S,Te,Oe,Ie]);const ct=uo(ke),At=d3(i,ct,z),rt=Xa(ke)||"center",ve=!!((xt=Re.hide)!=null&&xt.referenceHidden);We(()=>{M&&S&&Ae&&ct!==L&&O(ct)},[M,S,Ae,ct,L]);const Ue=x.useMemo(()=>{var Be,jt;return{position:"absolute",top:(Be=Re.arrow)==null?void 0:Be.y,left:(jt=Re.arrow)==null?void 0:jt.x}},[Re.arrow]),Qe=((Ke=Re.arrow)==null?void 0:Ke.centerOffset)!==0;return x.useMemo(()=>({positionerStyles:Xe,arrowStyles:Ue,arrowRef:ye,arrowUncentered:Qe,side:At,align:rt,physicalSide:ct,anchorHidden:ve,refs:ce,context:he,isPositioned:Ae,update:Oe}),[Xe,Ue,ye,Qe,At,rt,ct,ve,ce,he,Ae,Oe])}function T5(e){return e!=null&&"current"in e}const f3=x.createContext(void 0);function U2(){const e=x.useContext(f3);if(!e)throw new Error(rn(59));return e}function rg(e,t){e&&Object.assign(e.style,t)}const h3={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};function th(e){return e==="starting"?H$:En}function bx(e,t,{styles:r,transitionStatus:a,props:i,refs:c,hidden:u,inert:f=!1}){const m={...r};return f&&(m.pointerEvents="none"),Nt("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:u,style:m},th(a),i],stateAttributesMapping:qf})}const S9=20;function H2(e,t,r,a){const[i,c]=x.useState(!1);We(()=>{if(!e||!t||r==null){c(!1);return}const u=Ht(r).documentElement.clientWidth,f=r.offsetWidth;c(u>0&&f>0&&f>=u-S9)},[e,t,r]),GM(e&&(!t||i),a)}const N9={position:"fixed"},C9=x.forwardRef(function(t,r){const{anchor:a,className:i,render:c,positionMethod:u,side:f,align:m,sideOffset:h,alignOffset:g,collisionBoundary:p="clipping-ancestors",collisionPadding:b,arrowPadding:v,sticky:w,disableAnchorTracking:C,alignItemWithTrigger:S=!0,collisionAvoidance:N=xM,style:E,...T}=t,R=wa(),M=n3(),A=R.useState("open"),k=R.useState("mounted"),O=R.useState("modal"),D=R.useState("value"),_=R.useState("openMethod"),H=R.useState("positionerElement"),G=R.useState("triggerElement"),B=R.useState("isItemEqualToValue"),P=R.useState("transitionStatus"),V=x.useRef(null),q=x.useRef(null),[W,K]=x.useState(S),J=k&&W&&_!=="touch";!k&&W!==S&&K(S),x.useImperativeHandle(R.context.alignItemWithTriggerActiveRef,()=>J),H2((J||O)&&A,_==="touch",H,G);const z=xx({anchor:a,floatingRootContext:M,positionMethod:u,mounted:k,side:f,sideOffset:h,align:m,alignOffset:g,arrowPadding:v,collisionBoundary:p,collisionPadding:b,sticky:w,disableAnchorTracking:C??J,collisionAvoidance:N,keepMounted:!0}),L=J?"none":z.side,X=J?N9:z.positionerStyles,ee={open:A,side:L,align:z.align,anchorHidden:z.anchorHidden};We(()=>{R.set("popupSide",z.side)},[R,z.side]);const $=R.useStateSetter("positionerElement"),U=bx(t,ee,{styles:X,transitionStatus:P,props:T,refs:[r,$],hidden:!k,inert:!A}),F=x.useRef(0),Y=st(te=>{if(R.context.valuesRef.current.length===0)return;const ye=F.current;F.current=te.size;const ae=yt(Ur);if(ye!==0&&!R.state.multiple&&D!==null&&wp(R.context.valuesRef.current,D,B)===-1){const se=R.context.initialValueRef.current,ie=se!=null&&wp(R.context.valuesRef.current,se,B)!==-1?se:null;R.context.setValue(ie,ae),ie===null&&(R.set("selectedIndex",null),R.context.selectedItemTextRef.current=null)}if(ye!==0&&R.state.multiple&&Array.isArray(D)){const ue=D.filter(se=>wp(R.context.valuesRef.current,se,B)!==-1);ue.length!==D.length&&(R.context.setValue(ue,ae),ue.length===0&&(R.set("selectedIndex",null),R.context.selectedItemTextRef.current=null))}if(A&&J){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ue={height:""};rg(H,ue),rg(R.context.popupRef.current,ue)}}),ne=x.useMemo(()=>({...z,side:L,alignItemWithTriggerActive:J,setControlledAlignItemWithTrigger:K,scrollUpArrowRef:V,scrollDownArrowRef:q}),[z,L,J,K]);return n.jsx(eh,{elementsRef:R.context.listRef,labelsRef:R.context.labelsRef,onMapChange:Y,children:n.jsxs(f3.Provider,{value:ne,children:[k&&O&&n.jsx(cx,{inert:Jf(!A),cutout:G}),U]})})}),Fm="base-ui-disable-scrollbar",Yy={className:Fm,getElement(e){return n.jsx("style",{nonce:e,href:Fm,precedence:"base-ui:low",children:`.${Fm}{scrollbar-width:none}.${Fm}::-webkit-scrollbar{display:none}`})}},k9=x.createContext(void 0);function vx(e){return x.useContext(k9)}const T9=x.createContext(void 0),E9={disableStyleElements:!1};function R9(){return x.useContext(T9)??E9}const E5="--transform-origin",A9={...qf,...si},M9=x.forwardRef(function(t,r){const{render:a,className:i,style:c,finalFocus:u,...f}=t,m=wa(),{multiple:h,readOnly:g,highlightItemOnHover:p}=px(),b=n3(),{side:v,align:w,alignItemWithTriggerActive:C,isPositioned:S,setControlledAlignItemWithTrigger:N}=U2(),E=vx()!=null,T=gx(),{nonce:R,disableStyleElements:M}=R9(),A=m.useState("id"),k=m.useState("open"),O=m.useState("openMethod"),D=m.useState("mounted"),_=m.useState("popupProps"),H=m.useState("transitionStatus"),G=m.useState("triggerElement"),B=m.useState("positionerElement"),P=m.useState("listElement"),V=x.useRef(!1),q=x.useRef(!1),W=x.useRef({}),K=Eu(),J=st(ee=>{if(!B||!m.context.popupRef.current||!q.current)return;const $=B.style.top==="0px",U=B.style.bottom==="0px";if(V.current||!C||!$&&!U){m.context.handleScrollArrowVisibility(ee);return}const F=A5(B),Y=Qd(B.getBoundingClientRect().height,"y",F),ne=Ht(B),te=Rn(B),ye=te.getComputedStyle(B),ae=parseFloat(ye.marginTop),ue=parseFloat(ye.marginBottom),se=R5(te.getComputedStyle(m.context.popupRef.current)),Q=Math.min(ne.documentElement.clientHeight-ae-ue,se),ie=ee.scrollTop,oe=Gm(ee);let pe=null;const xe=Te=>{B.style.height=`${Te}px`},je=$?oe-ie:ie,Ie=Math.min(Y+je,Q);if(je<=zo){const Te=Wd(je,0,Q-Y);Te>0&&xe(Y+Te),ee.scrollTop=$?oe:0,Q-(Y+Te)<=zo&&(V.current=!0),m.context.handleScrollArrowVisibility(ee);return}if(Q-Ie>zo)pe=$?1/0:0;else if(U&&ie<oe){const Te=Y+je-Q;pe=ie-(je-Te)}const ce=Math.ceil(Ie);if(ce!==0&&xe(ce),pe!=null){const Te=Wd(pe,0,Gm(ee));Math.abs(ee.scrollTop-Te)>zo&&(ee.scrollTop=Te)}ce>=Q-zo&&(V.current=!0),m.context.handleScrollArrowVisibility(ee)});x.useImperativeHandle(m.context.scrollHandlerRef,()=>J,[J]),Sr({open:k,ref:m.context.popupRef,onComplete(){k&&m.context.onOpenChangeComplete(!0)}});const z={open:k,transitionStatus:H,side:v,align:w};We(()=>{!B||!m.context.popupRef.current||Object.keys(W.current).length||(W.current={top:B.style.top||"0",left:B.style.left||"0",right:B.style.right,height:B.style.height,bottom:B.style.bottom,minHeight:B.style.minHeight,maxHeight:B.style.maxHeight,marginTop:B.style.marginTop,marginBottom:B.style.marginBottom})},[m,B]),We(()=>{k||C||(q.current=!1,V.current=!1,rg(B,W.current))},[k,C,B]),We(()=>{var U,F;const ee=m.context.popupRef.current;if(!k||!G||!B||!ee||C&&!S||m.state.transitionStatus==="ending")return;if(q.current=!0,ee.style.removeProperty(E5),!C){K.request(()=>m.context.handleScrollArrowVisibility(P||ee));return}const $=O9(ee);try{let Y=m.context.selectedItemTextRef.current;Y!=null&&Y.isConnected||(Y=!m.select("hasSelectedValue")&&((U=m.context.firstItemTextRef.current)!=null&&U.isConnected)?m.context.firstItemTextRef.current:null);const ne=m.context.valueRef.current,te=Rn(B),ye=te.getComputedStyle(B),ae=te.getComputedStyle(ee),ue=Ht(G),se=A5(G),Q=qm(G.getBoundingClientRect(),se),ie=qm(B.getBoundingClientRect(),se),oe=Q.height,pe=P||ee,xe=pe.scrollHeight,je=parseFloat(ae.borderBottomWidth),Ie=parseFloat(ye.marginTop)||10,ce=parseFloat(ye.marginBottom)||10,Te=parseFloat(ye.minHeight)||100,re=R5(ae),fe=5,Re=5,Oe=20,ke=ue.documentElement.clientHeight-Ie-ce,he=ue.documentElement.clientWidth,Ae=ke-Q.bottom+oe;let ge,Pe=T==="rtl"?Q.right-ie.width:Q.left,Fe=0;if(Y&&ne){const Ke=qm(ne.getBoundingClientRect(),se);ge=qm(Y.getBoundingClientRect(),se),Pe=ie.left+(T==="rtl"?Ke.right-ge.right:Ke.left-ge.left);const Be=Ke.top-Q.top+Ke.height/2;Fe=ge.top-ie.top+ge.height/2-Be}const _e=Ae+Fe+ce+je;let Xe=Math.min(ke,_e);const Je=ke-Ie-ce,ct=_e-Xe,At=he-Re;B.style.left=`${Wd(Pe,fe,At-ie.width)}px`,B.style.height=`${Xe}px`,B.style.maxHeight="none",B.style.marginTop=`${Ie}px`,B.style.marginBottom=`${ce}px`,ee.style.height="100%";const rt=Gm(pe),ve=ct>=rt-zo;ve&&(Xe=Math.min(ke,ie.height)-(ct-rt));const Ue=Q.top<Oe||Q.bottom>ke-Oe||Math.ceil(Xe)+zo<Math.min(xe,Te),Qe=(((F=te.visualViewport)==null?void 0:F.scale)??1)!==1&&ri;if(Ue||Qe){rg(B,W.current),N(!1);return}const xt=Math.max(Te,Xe);if(ve){const Ke=Math.max(0,ke-_e);B.style.top=ie.height>=Je?"0":`${Ke}px`,B.style.height=`${Xe}px`,pe.scrollTop=Gm(pe)}else B.style.bottom="0",pe.scrollTop=ct;if(ge){const Ke=ie.top,Be=ie.height,jt=ge.top+ge.height/2,Ze=Wd(Be>0?(jt-Ke)/Be*100:50,0,100);ee.style.setProperty(E5,`50% ${Ze}%`)}(xt===ke||Xe>=re)&&(V.current=!0),m.context.handleScrollArrowVisibility(pe),p&&m.state.selectedIndex===null&&m.state.activeIndex===null&&m.context.listRef.current[0]!=null&&m.set("activeIndex",0)}finally{$()}},[m,k,B,G,C,N,K,P,p,T,S]),x.useEffect(()=>{if(!C||!B||!k)return;const ee=Rn(B);function $(U){m.context.setOpen(!1,yt(V7,U))}return $t(ee,"resize",$)},[m,C,B,k]);const L={...P?{role:"presentation"}:{role:"listbox","aria-multiselectable":h||void 0,"aria-readonly":g||void 0,id:`${A}-list`},onKeyDown(ee){E&&Zf.has(ee.key)&&ee.stopPropagation()},onScroll(ee){P||J(ee.currentTarget)},...C&&{style:P?{height:"100%"}:h3},className:!P&&C?Yy.className:void 0},X=Nt("div",t,{ref:[r,m.context.popupRef],state:z,stateAttributesMapping:A9,props:[_,L,th(H),f]});return n.jsxs(x.Fragment,{children:[!M&&Yy.getElement(R),n.jsx(Jg,{context:b,modal:!1,disabled:!D,openInteractionType:O,returnFocus:u,restoreFocus:!0,children:X})]})});function R5(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Gm(e){return V2(e.scrollHeight,e.clientHeight)}function A5(e){return MM.getScale(e)}function Qd(e,t,r){return e/r[t]}function qm(e,t){return vf({x:Qd(e.x,"x",t),y:Qd(e.y,"y",t),width:Qd(e.width,"x",t),height:Qd(e.height,"y",t)})}const M5=[["transform","none"],["scale","1"],["translate","0 0"]];function O9(e){const{style:t}=e,r={};for(const[a,i]of M5)r[a]=t.getPropertyValue(a),t.setProperty(a,i,"important");return()=>{for(const[a]of M5){const i=r[a];i?t.setProperty(a,i):t.removeProperty(a)}}}const D9=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=wa(),{multiple:m,readOnly:h}=px(),{alignItemWithTriggerActive:g}=U2(),p=f.useState("hasScrollArrows"),b=f.useState("openMethod"),w={id:`${f.useState("id")}-list`,role:"listbox","aria-multiselectable":m||void 0,"aria-readonly":h||void 0,onScroll(S){var N,E;(E=(N=f.context.scrollHandlerRef).current)==null||E.call(N,S.currentTarget)},...g&&{style:h3},className:p&&b!=="touch"?Yy.className:void 0},C=f.useStateSetter("listElement");return Nt("div",t,{ref:[r,C],props:[w,u]})});function pc(e={}){const{guess:t,label:r,metadata:a,textRef:i,index:c}=e,{register:u,unregister:f,subscribeMapChange:m,nextIndexRef:h}=a9(),g=x.useRef(-1),[p,b]=x.useState(c==null&&t?()=>{if(g.current===-1){const S=h.current;h.current+=1,g.current=S}return g.current}:-1),v=c??p,w=x.useRef(null),C=x.useCallback(S=>{const N=w.current;N&&f(N),w.current=S,S&&u(S,{metadata:a??null,index:c??null,label:r,textRef:i})},[c,u,f,a,r,i]);return We(()=>{if(c==null)return m(S=>{var E;const N=w.current?(E=S.get(w.current))==null?void 0:E.index:null;N!=null&&b(N)})},[c,m]),{ref:C,index:v}}const m3=x.createContext(void 0);function F2(){const e=x.useContext(m3);if(!e)throw new Error(rn(57));return e}const z9=x.memo(x.forwardRef(function(t,r){const{render:a,className:i,style:c,value:u=null,label:f,disabled:m=!1,nativeButton:h=!1,...g}=t,p=x.useRef(null),b=pc({guess:!0,label:f,textRef:p}),v=wa(),{itemProps:w,multiple:C,disabled:S,readOnly:N}=px(),E=S||m,T=v.useState("isActive",b.index),R=v.useState("open"),M=v.useState("isSelected",u),A=v.useState("isSelectedByFocus",b.index),k=v.useState("isItemEqualToValue"),O=b.index,D=x.useRef(null);We(()=>{const z=v.context.valuesRef.current;return z[O]=u,()=>{delete z[O]}},[O,u,v]),We(()=>{const z=v.state.value,L=v.state.selectedIndex;let X=L,ee;C&&Array.isArray(z)?(X=UV(O,u,v.context.valuesRef.current,z,k,L),ee=X===O,O===L&&!ee&&(v.context.selectedItemTextRef.current=null)):(ee=z!==void 0&&ac(u,z,k),ee&&(X=O)),v.set("selectedIndex",X),ee&&p.current&&(v.context.selectedItemTextRef.current=p.current)},[O,C,k,v,u]);const _=x.useRef("mouse"),H=x.useRef(!1),{getButtonProps:G,buttonRef:B}=bo({disabled:E,focusableWhenDisabled:!0,native:h,composite:!0}),P={disabled:E,selected:M,highlighted:T};function V(z){if(S||N)return;const L=v.state.value;if(C){const X=Array.isArray(L)?L:[],ee=M?HV(X,u,k):[...X,u];v.context.setValue(ee,yt(Zl,z))}else v.context.setValue(u,yt(Zl,z)),v.context.setOpen(!1,yt(Zl,z))}function q(){v.context.selectionRef.current.dragY=0}const W={role:"option","aria-selected":M,tabIndex:R&&T?0:-1,onKeyDown(z){v.set("activeIndex",O),z.key===" "&&v.context.typingRef.current&&z.preventDefault()},onClick(z){const L=_.current!=="touch",X=z.nativeEvent.pointerType,ee=L&&Yg(z.nativeEvent)&&(X!==void 0||T),$=L&&!ee&&!H.current;H.current=!1,!(E||$)&&V(z.nativeEvent)},onPointerEnter(z){_.current=z.pointerType},onPointerMove(z){if(z.pointerType==="mouse"&&z.buttons===1){const L=v.context.selectionRef.current;L.dragY+=z.movementY,L.dragY**2>=64&&(L.allowUnselectedMouseUp=!0)}},onPointerDown(z){_.current=z.pointerType,H.current=!0,q()},onMouseUp(){var X;if(q(),E||_.current==="touch"||H.current)return;const z=!v.context.selectionRef.current.allowSelectedMouseUp&&M,L=!v.context.selectionRef.current.allowUnselectedMouseUp&&!M;z||L||(H.current=!0,(X=D.current)==null||X.click(),H.current=!1)}},K=Nt("div",t,{ref:[B,r,b.ref,D],state:P,props:[w,W,g,G]}),J=x.useMemo(()=>({selected:M,index:O,textRef:p,selectedByFocus:A}),[M,O,p,A]);return n.jsx(m3.Provider,{value:J,children:K})})),I9=x.forwardRef(function(t,r){const{selected:a}=F2();return t.keepMounted||a?n.jsx(P9,{...t,ref:r}):null}),P9=x.memo(x.forwardRef((e,t)=>{const{render:r,className:a,style:i,keepMounted:c,...u}=e,{selected:f}=F2(),m=x.useRef(null),{transitionStatus:h,setMounted:g}=ni(f),b=Nt("span",e,{ref:[t,m],state:{selected:f,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:si});return Sr({batch:!0,enabled:!f,open:f,ref:m,onComplete(){f||g(!1)}}),b})),_9=x.memo(x.forwardRef(function(t,r){const{index:a,textRef:i,selectedByFocus:c}=F2(),u=wa(),{render:f,className:m,style:h,...g}=t,p=x.useCallback(v=>{v&&(a===0&&(u.context.firstItemTextRef.current=v),c&&(u.context.selectedItemTextRef.current=v))},[u,a,c]);return Nt("div",t,{ref:[p,r,i],props:g})})),p3=x.forwardRef(function(t,r){const{render:a,className:i,style:c,direction:u,keepMounted:f,...m}=t,h=u==="up",g=wa(),{side:p,scrollDownArrowRef:b,scrollUpArrowRef:v}=U2(),w=h?"scrollUpArrowVisible":"scrollDownArrowVisible",C=g.useState(w),S=g.useState("openMethod"),N=C&&S!=="touch",E=us(),T=h?v:b,{mounted:R,transitionStatus:M,setMounted:A}=ni(N);We(()=>(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]),Sr({open:N,ref:T,onComplete(){N||A(!1)}});const D=Nt("div",t,{ref:[r,T],state:{direction:u,visible:N,side:p,transitionStatus:M},props:[{"aria-hidden":!0,children:h?"▲":"▼",style:{position:"absolute"},onMouseMove(H){if(H.movementX===0&&H.movementY===0||E.isStarted())return;g.set("activeIndex",null);function G(){var K;const B=g.state.listElement??g.context.popupRef.current;if(!B)return;g.set("activeIndex",null),g.context.handleScrollArrowVisibility(B);const P=V2(B.scrollHeight,B.clientHeight),V=sg(B.scrollTop,P),q=V===(h?0:P),W=g.context.listRef.current;if(V!==B.scrollTop&&(B.scrollTop=V),q){E.clear();return}if(W.length>0){const J=((K=T.current)==null?void 0:K.offsetHeight)||0;B.scrollTop=L9(W,h,V,B.clientHeight,J,P)}E.start(40,G)}E.start(40,G)},onMouseLeave(){E.clear()}},m],stateAttributesMapping:si});return R||f?D:null});function L9(e,t,r,a,i,c){if(t){let g=0;const p=r+i-zo;for(let w=0;w<e.length;w+=1){const C=e[w];if(C&&C.offsetTop>=p){g=w;break}}const b=Math.max(0,g-1),v=e[b];return b<g&&v?sg(v.offsetTop-i,c):0}let u=e.length-1;const f=r+a-i+zo;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?sg(h.offsetTop+h.offsetHeight-a+i,c):c}const $9=x.forwardRef(function(t,r){return n.jsx(p3,{...t,ref:r,direction:"down"})}),B9=x.forwardRef(function(t,r){return n.jsx(p3,{...t,ref:r,direction:"up"})}),V9=x.createContext(void 0),U9=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,[f,m]=x.useState(),h=x.useMemo(()=>({labelId:f,setLabelId:m}),[f,m]),g=Nt("div",t,{ref:r,props:[{role:"group","aria-labelledby":f},u]});return n.jsx(V9.Provider,{value:h,children:g})}),jp=XV;function O5({className:e,...t}){return n.jsx(U9,{"data-slot":"select-group",className:Ve("scroll-my-1 p-1",e),...t})}function Sp({className:e,...t}){return n.jsx(s9,{"data-slot":"select-value",className:Ve("flex flex-1 text-left",e),...t})}function Np({className:e,size:t="default",children:r,...a}){return n.jsxs(t9,{"data-slot":"select-trigger","data-size":t,className:Ve("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,n.jsx(r9,{render:n.jsx(ha,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Cp({className:e,children:t,side:r="bottom",sideOffset:a=4,align:i="center",alignOffset:c=0,alignItemWithTrigger:u=!0,...f}){return n.jsx(o9,{children:n.jsx(C9,{side:r,sideOffset:a,align:i,alignOffset:c,alignItemWithTrigger:u,className:"isolate z-50",children:n.jsxs(M9,{"data-slot":"select-content","data-align-trigger":u,className:Ve("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:[n.jsx(H9,{}),n.jsx(D9,{children:t}),n.jsx(F9,{})]})})})}function Zd({className:e,children:t,...r}){return n.jsxs(z9,{"data-slot":"select-item",className:Ve("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:[n.jsx(_9,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),n.jsx(I9,{render:n.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:n.jsx(Yn,{className:"pointer-events-none"})})]})}function H9({className:e,...t}){return n.jsx(B9,{"data-slot":"select-scroll-up-button",className:Ve("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:n.jsx(EA,{})})}function F9({className:e,...t}){return n.jsx($9,{"data-slot":"select-scroll-down-button",className:Ve("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:n.jsx(ha,{})})}function pn({children:e,value:t,onChange:r,className:a,disabled:i,...c}){const u=m=>x.Children.toArray(m).join(""),f=x.Children.toArray(e).map(m=>({value:m.props.value??u(m.props.children),label:u(m.props.children),disabled:m.props.disabled}));return n.jsxs(jp,{items:f,value:t,disabled:i,onValueChange:m=>r==null?void 0:r({target:{value:m}}),children:[n.jsx(Np,{className:a,...c,children:n.jsx(Sp,{})}),n.jsx(Cp,{align:"start",alignItemWithTrigger:!1,children:f.map(m=>n.jsx(Zd,{className:"text-xs",value:m.value,disabled:m.disabled,children:m.label},m.value))})]})}const g3=x.createContext(void 0);function G2(){const e=x.useContext(g3);if(e===void 0)throw new Error(rn(64));return e}const G9="data-activation-direction",yx={tabActivationDirection:e=>({[G9]:e})},q9=x.forwardRef(function(t,r){const{className:a,defaultValue:i=0,onValueChange:c,orientation:u="horizontal",render:f,value:m,style:h,...g}=t,p=t.defaultValue!==void 0,b=x.useRef([]),[v,w]=x.useState(()=>new Map),[C,S]=po({controlled:m,default:i,name:"Tabs",state:"value"}),N=m!==void 0,[E,T]=x.useState(()=>new Map),R=x.useRef(void 0),M=x.useCallback(ne=>Ky(E,ne),[E]),[A,k]=x.useState(()=>({previousValue:C,tabActivationDirection:"none"})),{previousValue:O,tabActivationDirection:D}=A;let _=D,H=!1;O!==C&&(_=D5(O,C,u,E),H=O!=null&&C!=null&&M(C)==null);const G=H?O:C,B=O!==G||D!==_;We(()=>{B&&k({previousValue:G,tabActivationDirection:_})},[G,B,_]);const P=st((ne,te)=>{const ye=D5(C,ne,u,E);te.activationDirection=ye,c==null||c(ne,te),!te.isCanceled&&S(ne)}),V=st((ne,te)=>{c==null||c(ne,yt(te,void 0,void 0,{activationDirection:"none"}))}),q=st((ne,te)=>(w(ye=>{const ae=new Map(ye);return ae.set(ne,te),ae}),()=>{w(ye=>{if(ye.get(ne)!==te)return ye;const ae=new Map(ye);return ae.delete(ne),ae})})),W=x.useCallback(ne=>v.get(ne),[v]),K=x.useCallback(ne=>{for(const te of E.values())if(ne===te.value)return te.id},[E]),J=x.useMemo(()=>({getTabElementBySelectedValue:M,getTabIdByPanelValue:K,getTabPanelIdByValue:W,onValueChange:P,orientation:u,registerMountedTabPanel:q,setTabMap:T,tabActivationDirection:_,value:C}),[M,K,W,P,u,q,T,_,C]),z=x.useMemo(()=>{for(const ne of E.values())if(ne.value===C)return ne},[E,C]),L=x.useMemo(()=>{for(const ne of E.values())if(!ne.disabled)return ne.value},[E]),X=x.useRef(!p),ee=x.useRef(i),$=x.useRef(p),U=x.useRef(!1);We(()=>{var ue;if(N)return;function ne(se,Q){S(se),k({previousValue:se,tabActivationDirection:"none"}),V(se,Q),X.current=!1}if(E.size===0){U.current&&C!==null&&!((ue=R.current)!=null&&ue.isConnected)&&ne(null,$k);return}U.current=!0,R.current=E.keys().next().value;const te=z==null?void 0:z.disabled,ye=z==null&&C!==null;if(!te&&C===ee.current&&($.current=!1),$.current&&te&&C===ee.current)return;const ae=X.current;if(te||ye){const se=L??null;if(C===se){X.current=!1;return}let Q=$k;ae?Q=Bk:te&&(Q=XA),ne(se,Q);return}ae&&z!=null&&(V(C,Bk),X.current=!1)},[L,N,V,z,S,E,C]);const Y=Nt("div",t,{state:{orientation:u,tabActivationDirection:_},ref:r,props:g,stateAttributesMapping:yx});return n.jsx(g3.Provider,{value:J,children:n.jsx(eh,{elementsRef:b,children:Y})})});function Ky(e,t){for(const[r,a]of e.entries())if(t===a.value)return r;return null}function D5(e,t,r,a){if(e==null||t==null)return"none";const[i,c,u]=r==="horizontal"?["left","left","right"]:["top","up","down"],f=Ky(a,e),m=Ky(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()[i],g=m.getBoundingClientRect()[i];return g<h?c:g>h?u:"none"}const q2="data-composite-item-active";function x3(e={}){const{highlightItemOnHover:t,highlightedIndex:r,onHighlightedIndexChange:a}=Dg(),{ref:i,index:c}=pc(e),u=r===c,f=x.useRef(null),m=mo(i,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 b3=x.createContext(void 0);function Y9(){const e=x.useContext(b3);if(e===void 0)throw new Error(rn(65));return e}const K9=x.forwardRef(function(t,r){const{className:a,disabled:i=!1,render:c,value:u,id:f,nativeButton:m=!0,style:h,...g}=t,{value:p,getTabPanelIdByValue:b,onValueChange:v,orientation:w,tabActivationDirection:C}=G2(),{activateOnFocus:S,registerTabResizeObserverElement:N,tabsListElement:E}=Y9(),{highlightedIndex:T,onHighlightedIndexChange:R}=Dg(),M=ys(f),A=x.useMemo(()=>({disabled:i,id:M,value:u}),[i,M,u]),{compositeProps:k,compositeRef:O,index:D}=x3({metadata:A}),_=u===p,H=x.useRef(!1),G=x.useRef(null),B=st(U=>{var F;(F=G.current)==null||F.call(G),G.current=U?N(U):null});We(()=>{if(H.current){H.current=!1;return}if(!(_&&D>-1&&T!==D))return;const U=E;if(U!=null){const F=Xs(Ht(U));if(F&&gt(U,F))return}i||R(D)},[_,D,T,R,i,E]);const{getButtonProps:P,buttonRef:V}=bo({disabled:i,native:m,focusableWhenDisabled:!0}),q=b(u),W=x.useRef(!1),K=x.useRef(!1);function J(U){v(u,yt(Ur,U.nativeEvent,void 0,{activationDirection:"none"}))}function z(U){_||i||J(U)}function L(U){_||i||S&&(!W.current||K.current)&&J(U)}function X(U){if(_||i)return;W.current=!0,K.current=U.button===0;const F=Ht(U.currentTarget);function Y(){W.current=!1,K.current=!1,F.removeEventListener("pointerup",Y),F.removeEventListener("pointercancel",Y)}F.addEventListener("pointerup",Y),F.addEventListener("pointercancel",Y)}return Nt("button",t,{state:{disabled:i,active:_,orientation:w,tabActivationDirection:C},ref:[r,V,O,B],props:[k,{role:"tab","aria-controls":q,"aria-selected":_,id:M,onClick:z,onFocus:L,onPointerDown:X,[q2]:_?"":void 0,onKeyDownCapture(){H.current=!0}},g,P],stateAttributesMapping:yx})}),X9="data-index",W9={...yx,...si},Q9=x.forwardRef(function(t,r){const{className:a,value:i,render:c,keepMounted:u=!1,style:f,...m}=t,{value:h,getTabIdByPanelValue:g,orientation:p,tabActivationDirection:b,registerMountedTabPanel:v}=G2(),w=ys(),{ref:C,index:S}=pc(),N=i===h,{mounted:E,transitionStatus:T,setMounted:R}=ni(N),M=!E,A=g(i),k={hidden:M,orientation:p,tabActivationDirection:b,transitionStatus:T},O=x.useRef(null),D=Nt("div",t,{state:k,ref:[r,C,O],props:[{"aria-labelledby":A,hidden:M,id:w,role:"tabpanel",tabIndex:N?0:-1,inert:Jf(!N),[X9]:S},m],stateAttributesMapping:W9});return Sr({open:N,ref:O,onComplete(){N||R(!1)}}),We(()=>{if(!(w==null||M&&!u))return v(i,w)},[M,u,i,w,v]),u||E?D:null});function Z9(e){const{loopFocus:t=!0,orientation:r="both",grid:a,onLoop:i,direction:c,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:m,enableHomeAndEndKeys:h=!1,stopEventPropagation:g,disabledIndices:p,modifierKeys:b=Vr}=e,[v,w]=x.useState(0),C=a!=null,S=x.useRef(null),N=mo(S,m),E=x.useRef([]),T=x.useRef(!1),R=x.useRef(null),M=u??v,A=st((H,G=!1)=>{if(R.current=E.current[H]??null,(f??w)(H),G){const B=E.current[H];x5(S.current,B,c,r)}}),k=st(H=>{var V;if(H.size===0)return;if(T.current){const q=E.current,W=q.indexOf(R.current);if(W===-1){const K=q[M];!K||xu(q,M,p)?A(J9(q,p)):R.current=K}else W!==M&&A(W);return}T.current=!0;const G=Array.from(H.keys()),B=G.find(q=>q==null?void 0:q.hasAttribute(q2))??null,P=B?((V=H.get(B))==null?void 0:V.index)??-1:-1;if(P!==-1)A(P);else if(xu(G,M,p)){const q=Ba(G,{disabledIndices:p});sf(G,q)||A(q)}x5(S.current,B,c,r)});We(()=>{if(p==null||u!=null||!T.current)return;const H=E.current;if(xu(H,M,p)){const G=Ba(H,{disabledIndices:p});sf(H,G)||A(G)}},[p,u,M,E,A]);const O=st((H,G,B)=>i?i(H,G,B,E):B),D=st(H=>{const G=H.key===Uy||H.key===Hy;if(!Zf.has(H.key)||!h&&G||eU(H,b)||!S.current)return;const P=c==="rtl",V=P?By:Vy,q=P?Vy:By,W=r==="vertical"?$y:V,K=r==="vertical"?Ly:q,J=Vs(H.nativeEvent);if(J!=null&&g5(J)&&!ZM(J)){const U=J.selectionStart,F=J.selectionEnd,Y=J.value;if(U==null||H.shiftKey||U!==F||H.key!==K&&U<Y.length||H.key!==W&&U>0)return}let z=M;const L=bp(E,p),X=Dy(E,p);a!=null&&(z=a({disabledIndices:p,elementsRef:E,event:H,highlightedIndex:M,loopFocus:t,maxIndex:X,minIndex:L,onLoop:O,orientation:r,rtl:P}));const ee=r!=="vertical"&&H.key===V||r!=="horizontal"&&H.key===$y,$=r!=="vertical"&&H.key===q||r!=="horizontal"&&H.key===Ly;h&&(H.key===Uy?z=L:H.key===Hy&&(z=X)),z===M&&(ee||$)&&(t&&z===X&&ee?(z=L,i&&(z=i(H,M,z,E))):t&&z===L&&$?(z=X,i&&(z=i(H,M,z,E))):z=Ba(E.current,{startingIndex:z,decrement:$,disabledIndices:p})),z!==M&&!sf(E.current,z)&&(g&&H.stopPropagation(),(C||G||ee||$)&&H.preventDefault(),A(z,!0),queueMicrotask(()=>{var U;(U=E.current[z])==null||U.focus()}))});return{props:{ref:N,onFocus(H){const G=S.current,B=Vs(H.nativeEvent);!G||B==null||!g5(B)||B.setSelectionRange(0,B.value.length)},onKeyDown:D},highlightedIndex:M,onHighlightedIndexChange:A,elementsRef:E,onMapChange:k,relayKeyboardEvent:D}}function J9(e,t){let r=-1;for(let a=0;a<e.length;a+=1){const i=e[a];if(!(!i||xu(e,a,t))){if(i.hasAttribute(q2))return a;r===-1&&(r=a)}}return Math.max(r,0)}function eU(e,t){for(const r of uV)if(!t.includes(r)&&e.getModifierState(r))return!0;return!1}function v3(e){const{render:t,className:r,style:a,refs:i=Vr,props:c=Vr,state:u=En,stateAttributesMapping:f,highlightedIndex:m,onHighlightedIndexChange:h,orientation:g,grid:p,loopFocus:b,onLoop:v,enableHomeAndEndKeys:w,onMapChange:C,stopEventPropagation:S=!0,rootRef:N,disabledIndices:E,modifierKeys:T,highlightItemOnHover:R=!1,tag:M="div",...A}=e,k=gx(),{props:O,highlightedIndex:D,onHighlightedIndexChange:_,elementsRef:H,onMapChange:G,relayKeyboardEvent:B}=Z9({grid:p,loopFocus:b,onLoop:v,orientation:g,highlightedIndex:m,onHighlightedIndexChange:h,rootRef:N,stopEventPropagation:S,enableHomeAndEndKeys:w,direction:k,disabledIndices:E,modifierKeys:T}),P=Nt(M,e,{state:u,ref:i,props:[O,...c,A],stateAttributesMapping:f}),V=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:_,highlightItemOnHover:R,relayKeyboardEvent:B}),[D,_,R,B]);return n.jsx(nA.Provider,{value:V,children:n.jsx(eh,{elementsRef:H,onMapChange:q=>{C==null||C(q),G(q)},children:P})})}const tU=x.forwardRef(function(t,r){const{activateOnFocus:a=!1,className:i,loopFocus:c=!0,render:u,style:f,...m}=t,{orientation:h,setTabMap:g,tabActivationDirection:p}=G2(),[b,v]=x.useState(0),[w,C]=x.useState(null),S=x.useRef(new Set),N=x.useRef(new Set),E=x.useRef(null);We(()=>{if(typeof ResizeObserver>"u")return;const O=new ResizeObserver(()=>{S.current.forEach(D=>{D()})});return E.current=O,w&&O.observe(w),N.current.forEach(D=>{O.observe(D)}),()=>{O.disconnect(),E.current=null}},[w]);const T=st(O=>(S.current.add(O),()=>{S.current.delete(O)})),R=st(O=>{var D;return N.current.add(O),(D=E.current)==null||D.observe(O),()=>{var _;N.current.delete(O),(_=E.current)==null||_.unobserve(O)}}),M={orientation:h,tabActivationDirection:p},A={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},k=x.useMemo(()=>({activateOnFocus:a,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:R,tabsListElement:w}),[a,T,R,w]);return n.jsx(b3.Provider,{value:k,children:n.jsx(v3,{render:u,className:i,style:f,state:M,refs:[r,C],props:[A,m],stateAttributesMapping:yx,highlightedIndex:b,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:v,onMapChange:g,disabledIndices:Vr})})});function nh({className:e,orientation:t="horizontal",...r}){return n.jsx(q9,{"data-slot":"tabs","data-orientation":t,className:Ve("group/tabs flex gap-2 data-horizontal:flex-col",e),...r})}const nU=If("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 sh({className:e,variant:t="default",...r}){return n.jsx(tU,{"data-slot":"tabs-list","data-variant":t,className:Ve(nU({variant:t}),e),...r})}function Pr({className:e,...t}){return n.jsx(K9,{"data-slot":"tabs-trigger",className:Ve("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 Io({className:e,...t}){return n.jsx(Q9,{"data-slot":"tabs-content",className:Ve("flex-1 text-sm outline-none",e),...t})}const y3=x.createContext(void 0);function w3(){const e=x.useContext(y3);if(e===void 0)throw new Error(rn(10));return e}const sU={value:()=>null},rU=x.forwardRef(function(t,r){const{render:a,className:i,disabled:c=!1,hiddenUntilFound:u,keepMounted:f,loopFocus:m,onValueChange:h,multiple:g=!1,orientation:p="vertical",value:b,defaultValue:v,style:w,...C}=t,S=v??Vr,N=x.useRef([]),[E,T]=po({controlled:b,default:S,name:"Accordion",state:"value"}),R=st((O,D,_)=>{if(g)if(D){const H=E.slice();if(H.push(O),h==null||h(H,_),_.isCanceled)return;T(H)}else{const H=E.filter(G=>G!==O);if(h==null||h(H,_),_.isCanceled)return;T(H)}else{const H=E[0]===O?[]:[O];if(h==null||h(H,_),_.isCanceled)return;T(H)}}),M=x.useMemo(()=>({value:E,disabled:c,orientation:p}),[E,c,p]),A=x.useMemo(()=>({disabled:c,handleValueChange:R,hiddenUntilFound:u??!1,keepMounted:f??!1,state:M,value:E}),[c,R,u,f,M,E]),k=Nt("div",t,{state:M,ref:r,props:C,stateAttributesMapping:sU});return n.jsx(y3.Provider,{value:A,children:n.jsx(eh,{elementsRef:N,children:k})})});function oU(e){const{open:t,defaultOpen:r=!1,onOpenChange:a,disabled:i}=e,[c,u]=po({controlled:t,default:r,name:"Collapsible",state:"open"}),{mounted:f,setMounted:m,transitionStatus:h}=ni(c,!0,!0),g=ys(),[p,b]=x.useState(),v=p===null?void 0:p??g,w=st(C=>{const S=!c,N=yt(ma,C.nativeEvent);a(S,N),!N.isCanceled&&u(S)});return x.useMemo(()=>({defaultPanelId:g,disabled:i,handleTrigger:w,mounted:f,open:c,panelId:v,setMounted:m,setOpen:u,setPanelIdState:b,transitionStatus:h}),[g,i,w,f,c,v,m,u,b,h])}const j3=x.createContext(void 0);function S3(){const e=x.useContext(j3);if(e===void 0)throw new Error(rn(15));return e}const N3=x.createContext(void 0);function Y2(){const e=x.useContext(N3);if(e===void 0)throw new Error(rn(9));return e}const aU="data-open",iU="data-closed",lU=a2,cU="data-panel-open",uU={[aU]:""},dU={[iU]:""},fU={open(e){return e?{[cU]:""}:null}},hU={open(e){return e?uU:dU}},mU="data-index",K2={...hU,index:e=>({[mU]:String(e)}),...si,value:()=>null},pU=x.forwardRef(function(t,r){const{className:a,disabled:i=!1,onOpenChange:c,render:u,value:f,style:m,...h}=t,{ref:g,index:p}=pc(),b=mo(r,g),{disabled:v,handleValueChange:w,state:C,value:S}=w3(),N=ys(),E=f??N,T=i||v,R=S.indexOf(E)!==-1,M=st((q,W)=>{c==null||c(q,W),!W.isCanceled&&w(E,q,W)}),A=oU({open:R,onOpenChange:M,disabled:T}),k=x.useMemo(()=>({open:A.open,disabled:A.disabled,transitionStatus:A.transitionStatus}),[A.open,A.disabled,A.transitionStatus]),O=x.useMemo(()=>({...A,onOpenChange:M,state:k}),[A,k,M]),D=x.useMemo(()=>({...C,hidden:!R&&!A.mounted,index:p,disabled:T,open:R}),[A.mounted,T,p,R,C]),_=ys(),[H,G]=x.useState(),B=H===null?void 0:H??_,P=x.useMemo(()=>({defaultTriggerId:_,open:R,state:D,setTriggerId:G,triggerId:B}),[_,R,D,G,B]),V=Nt("div",t,{state:D,ref:b,props:h,stateAttributesMapping:K2});return n.jsx(j3.Provider,{value:O,children:n.jsx(N3.Provider,{value:P,children:V})})}),gU=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,{state:f}=Y2();return Nt("h3",t,{state:f,ref:r,props:u,stateAttributesMapping:K2})}),xU=x.forwardRef(function(t,r){const{disabled:a,className:i,id:c,render:u,nativeButton:f=!0,style:m,...h}=t,{panelId:g,open:p,handleTrigger:b,disabled:v}=S3(),w=a||v,{getButtonProps:C,buttonRef:S}=bo({disabled:w,focusableWhenDisabled:!0,native:f}),{defaultTriggerId:N,state:E,setTriggerId:T}=Y2(),R=c||void 0,M=R??N;return We(()=>(T(O=>R??(O===null?void 0:O)),()=>{T(O=>O===R?null:O)}),[R,T]),Nt("button",t,{state:E,ref:[r,S],props:[{"aria-controls":p?g:void 0,"aria-expanded":p,id:M,onClick:b},h,C],stateAttributesMapping:fU})}),Hd={height:void 0,width:void 0};function bU(e){const{externalRef:t,hiddenUntilFound:r,id:a,keepMounted:i,mounted:c,onOpenChange:u,open:f,setMounted:m,setOpen:h,transitionStatus:g}=e,p=x.useRef(null),b=x.useRef(null),[v,w]=x.useState(Hd),C=x.useRef(Hd),S=x.useRef(!1),N=x.useRef(f),E=x.useRef(!1),[T,R]=x.useState(!1),M=x.useRef(null),A=mo(t,p),k=qn(f),O=Gf(p),D=!f&&!c,_=T?"idle":g,H=f&&(N.current||E.current),G=!f&&c&&b.current==="css-animation"&&v.height===void 0&&v.width===void 0?C.current:v,B=r&&D&&b.current!=="css-animation",P=st((J,z=!0)=>{z&&(C.current=J),w(J)}),V=st(()=>{var J;(J=M.current)==null||J.call(M),M.current=null}),q=st(J=>{V(),M.current=()=>{M.current=null,J()}}),W=st(()=>{f&&c&&b.current==="css-animation"&&(E.current=!0)});We(()=>{!T||g==="starting"||R(!1)},[T,g]),x.useEffect(()=>()=>{W(),V()},[W,V]),We(()=>{const J=p.current;if(!J)return;!f&&M.current&&V();const z=vU(J,H);if(b.current=z,f&&g==="idle"&&N.current&&z==="css-animation"){C.current=ou(J);return}if(f&&g==="starting"){const ee=S.current;if(S.current=!1,z==="none"){P(ou(J)),R(!0);return}if(z==="css-transition"){const F=yU(J);if(P(ou(J)),!ee)return F;const Y=Ym(J,"transition-duration","0s");return q(Y),R(!0),F}P(ou(J));const $=Ym(J,"animation-name","none");if(!ee){$();return}const U=Ym(J,"animation-duration","0s");$(),q(U),R(!0);return}if(!f&&c&&(g==="idle"||g==="starting")){if(N.current=!1,E.current=!1,z==="none"){P(Hd,!1),m(!1);return}P(ou(J));return}if(g!=="ending")return;if(z==="none"){m(!1);return}const L=ou(J);if(!(L.height>0||L.width>0)){m(!1);return}P(L),z==="css-animation"&&Ym(J,"animation-name","none")()},[c,f,V,P,m,q,H,g]),Sr({enabled:f&&c&&_==="idle",open:!0,ref:p,onComplete(){f&&P(Hd,!1)}}),x.useEffect(()=>{if(f||!c||_!=="ending"||!p.current)return;const z=new AbortController;let L=-1;function X(){k.current||(m(!1),P(Hd,!1))}return L=wr.request(()=>{O(X,z.signal)}),()=>{wr.cancel(L),z.abort()}},[k,c,f,_,O,P,m]),We(()=>{const J=p.current;!J||!r||!D||J.setAttribute("hidden","until-found")},[D,r]),x.useEffect(function(){const z=p.current;if(!z)return;function L(X){const ee=yt(Ur,X);u(!0,ee),!ee.isCanceled&&(S.current=!0,h(!0))}return $t(z,"beforematch",L)},[u,h]);const K=i||r||c||f;return{height:G.height,props:{...B?{[lU]:""}:void 0,hidden:D,id:a},ref:A,shouldPreventOpenAnimation:H,shouldRender:K,transitionStatus:_,width:G.width}}function ou(e){return{height:e.scrollHeight,width:e.scrollWidth}}function vU(e,t){const r=Rn(e).getComputedStyle(e),a=(r.animationName.split(",").map(c=>c.trim()).some(c=>c!==""&&c!=="none")||t)&&z5(r.animationDuration),i=z5(r.transitionDuration);return a&&i||i?"css-transition":a?"css-animation":"none"}function z5(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function Ym(e,t,r){const a=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,r),()=>{if(a===""){e.style.removeProperty(t);return}e.style.setProperty(t,a,i)}}function yU(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(i=>{e.style.setProperty(i,"initial","important")});function r(){Object.entries(t).forEach(([i,c])=>{if(c===""){e.style.removeProperty(i);return}e.style.setProperty(i,c)})}const a=wr.request(r);return()=>{wr.cancel(a),r()}}const wU="--accordion-panel-height",jU="--accordion-panel-width",SU=x.forwardRef(function(t,r){const{className:a,hiddenUntilFound:i,keepMounted:c,id:u,render:f,style:m,...h}=t,{hiddenUntilFound:g,keepMounted:p}=w3(),{defaultPanelId:b,mounted:v,onOpenChange:w,open:C,setMounted:S,setOpen:N,setPanelIdState:E,transitionStatus:T}=S3(),R=i??g,M=c??p,A=u||void 0,k=u??b;We(()=>(E(z=>A??(z===null?void 0:z)),()=>{E(z=>z===A?null:z)}),[A,E]);const{height:O,props:D,ref:_,shouldPreventOpenAnimation:H,shouldRender:G,transitionStatus:B,width:P}=bU({externalRef:r,hiddenUntilFound:R,id:k,keepMounted:M,mounted:v,onOpenChange:w,open:C,setMounted:S,setOpen:N,transitionStatus:T}),{state:V,triggerId:q}=Y2(),W={...V,transitionStatus:B},K=oA(m,W),J=Nt("div",{...t,style:void 0},{state:W,ref:_,props:[D,{"aria-labelledby":q,role:"region",style:{[wU]:O===void 0?"auto":`${O}px`,[jU]:P===void 0?"auto":`${P}px`}},h,K?{style:K}:void 0,H?{style:{animationName:"none"}}:void 0],stateAttributesMapping:K2});return G?J:null});function NU({className:e,...t}){return n.jsx(rU,{"data-slot":"accordion",className:Ve("flex w-full flex-col",e),...t})}function CU({className:e,...t}){return n.jsx(pU,{"data-slot":"accordion-item",className:Ve("not-last:border-b",e),...t})}function kU({className:e,children:t,...r}){return n.jsx(gU,{className:"flex",children:n.jsxs(xU,{"data-slot":"accordion-trigger",className:Ve("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,n.jsx(ha,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),n.jsx(EA,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function TU({className:e,children:t,...r}){return n.jsx(SU,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...r,children:n.jsx("div",{className:Ve("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 X2=x.createContext({});function rh(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const EU=typeof window<"u",Au=EU?x.useLayoutEffect:x.useEffect,wx=x.createContext(null);function W2(e,t){e.indexOf(t)===-1&&e.push(t)}function og(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}const Bo=(e,t,r)=>r>t?t:r<e?e:r;let jx=()=>{};const Wa={},Q2=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),C3=e=>typeof e=="object"&&e!==null,Z2=e=>/^0[^.\s]+$/u.test(e);function k3(e){let t;return()=>(t===void 0&&(t=e()),t)}const _o=e=>e,oh=(...e)=>e.reduce((t,r)=>a=>r(t(a))),Sf=(e,t,r)=>{const a=t-e;return a?(r-e)/a:1};class ag{constructor(){this.subscriptions=[]}add(t){return W2(this.subscriptions,t),()=>this.remove(t)}remove(t){og(this.subscriptions,t)}notify(t,r,a){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,r,a);else for(let c=0;c<i;c++){const u=this.subscriptions[c];u&&u(t,r,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const fo=e=>e*1e3,_r=e=>e/1e3,T3=(e,t)=>t?e*(1e3/t):0,E3=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,RU=1e-7,AU=12;function MU(e,t,r,a,i){let c,u,f=0;do u=t+(r-t)/2,c=E3(u,a,i)-e,c>0?r=u:t=u;while(Math.abs(c)>RU&&++f<AU);return u}function ah(e,t,r,a){if(e===t&&r===a)return _o;const i=c=>MU(c,0,1,e,r);return c=>c===0||c===1?c:E3(i(c),t,a)}const R3=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,A3=e=>t=>1-e(1-t),M3=ah(.33,1.53,.69,.99),J2=A3(M3),O3=R3(J2),D3=e=>e>=1?1:(e*=2)<1?.5*J2(e):.5*(2-Math.pow(2,-10*(e-1))),ew=e=>1-Math.sin(Math.acos(e)),z3=A3(ew),I3=R3(ew),OU=ah(.42,0,1,1),DU=ah(0,0,.58,1),tw=ah(.42,0,.58,1),zU=e=>Array.isArray(e)&&typeof e[0]!="number",P3=e=>Array.isArray(e)&&typeof e[0]=="number",IU={linear:_o,easeIn:OU,easeInOut:tw,easeOut:DU,circIn:ew,circInOut:I3,circOut:z3,backIn:J2,backInOut:O3,backOut:M3,anticipate:D3},PU=e=>typeof e=="string",I5=e=>{if(P3(e)){jx(e.length===4);const[t,r,a,i]=e;return ah(t,r,a,i)}else if(PU(e))return IU[e];return e},Km=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function _U(e){let t=new Set,r=new Set,a=!1,i=!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){i=!0;return}a=!0;const g=t;t=r,r=g,t.forEach(f),t.clear(),a=!1,i&&(i=!1,m.process(h))}};return m}const LU=40;function _3(e,t){let r=!1,a=!0;const i={delta:0,timestamp:0,isProcessing:!1},c=()=>r=!0,u=Km.reduce((T,R)=>(T[R]=_U(c),T),{}),{setup:f,read:m,resolveKeyframes:h,preUpdate:g,update:p,preRender:b,render:v,postRender:w}=u,C=()=>{const T=Wa.useManualTiming,R=T?i.timestamp:performance.now();r=!1,T||(i.delta=a?1e3/60:Math.max(Math.min(R-i.timestamp,LU),1)),i.timestamp=R,i.isProcessing=!0,f.process(i),m.process(i),h.process(i),g.process(i),p.process(i),b.process(i),v.process(i),w.process(i),i.isProcessing=!1,r&&t&&(a=!1,e(C))},S=()=>{r=!0,a=!0,i.isProcessing||e(C)};return{schedule:Km.reduce((T,R)=>{const M=u[R];return T[R]=(A,k=!1,O=!1)=>(r||S(),M.schedule(A,k,O)),T},{}),cancel:T=>{for(let R=0;R<Km.length;R++)u[Km[R]].cancel(T)},state:i,steps:u}}const{schedule:jn,cancel:pa,state:Es,steps:Dv}=_3(typeof requestAnimationFrame<"u"?requestAnimationFrame:_o,!0);let kp;function $U(){kp=void 0}const As={now:()=>(kp===void 0&&As.set(Es.isProcessing||Wa.useManualTiming?Es.timestamp:performance.now()),kp),set:e=>{kp=e,queueMicrotask($U)}},yu=e=>Math.round(e*1e5)/1e5,L3=e=>t=>typeof t=="string"&&t.startsWith(e),$3=L3("--"),BU=L3("var(--"),nw=e=>BU(e)?VU.test(e.split("/*")[0].trim()):!1,VU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function P5(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const $u={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Nf={...$u,transform:e=>Bo(0,1,e)},Xm={...$u,default:1},sw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function UU(e){return e==null}const HU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,rw=(e,t)=>r=>!!(typeof r=="string"&&HU.test(r)&&r.startsWith(e)||t&&!UU(r)&&Object.prototype.hasOwnProperty.call(r,t)),B3=(e,t,r)=>a=>{if(typeof a!="string")return a;const[i,c,u,f]=a.match(sw);return{[e]:parseFloat(i),[t]:parseFloat(c),[r]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},FU=e=>Bo(0,255,e),zv={...$u,transform:e=>Math.round(FU(e))},Xl={test:rw("rgb","red"),parse:B3("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:a=1})=>"rgba("+zv.transform(e)+", "+zv.transform(t)+", "+zv.transform(r)+", "+yu(Nf.transform(a))+")"};function GU(e){let t="",r="",a="",i="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),a=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),a=e.substring(3,4),i=e.substring(4,5),t+=t,r+=r,a+=a,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(a,16),alpha:i?parseInt(i,16)/255:1}}const Xy={test:rw("#"),parse:GU,transform:Xl.transform},ih=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),La=ih("deg"),aa=ih("%"),pt=ih("px"),qU=ih("vh"),YU=ih("vw"),_5={...aa,parse:e=>aa.parse(e)/100,transform:e=>aa.transform(e*100)},uu={test:rw("hsl","hue"),parse:B3("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:a=1})=>"hsla("+Math.round(e)+", "+aa.transform(yu(t))+", "+aa.transform(yu(r))+", "+yu(Nf.transform(a))+")"},gs={test:e=>Xl.test(e)||Xy.test(e)||uu.test(e),parse:e=>Xl.test(e)?Xl.parse(e):uu.test(e)?uu.parse(e):Xy.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Xl.transform(e):uu.transform(e),getAnimatableNone:e=>{const t=gs.parse(e);return t.alpha=0,gs.transform(t)}},KU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,V3=new RegExp(sw.source),U3=new RegExp(KU.source,"i");function XU(e){return isNaN(e)&&typeof e=="string"&&(V3.test(e)||U3.test(e))}const H3="number",F3="color",WU="var",QU="var(",L5="${}",ZU=/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 JU(e){const t=e.toString();return V3.test(t)||U3.test(t)}function Cf(e){const t=e.toString(),r=[],a={color:[],number:[],var:[]},i=[];let c=0;const f=t.replace(ZU,m=>(gs.test(m)?(a.color.push(c),i.push(F3),r.push(gs.parse(m))):m.startsWith(QU)?(a.var.push(c),i.push(WU),r.push(m)):(a.number.push(c),i.push(H3),r.push(parseFloat(m))),++c,L5)).split(L5);return{values:r,split:f,indexes:a,types:i}}function eH(e){return Cf(e).values}function G3({split:e,types:t}){const r=e.length;return a=>{let i="";for(let c=0;c<r;c++)if(i+=e[c],a[c]!==void 0){const u=t[c];u===H3?i+=yu(a[c]):u===F3?i+=gs.transform(a[c]):i+=a[c]}return i}}function tH(e){return G3(Cf(e))}const nH=e=>typeof e=="number"?0:gs.test(e)?gs.getAnimatableNone(e):e,sH=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:nH(e);function rH(e){const t=Cf(e);return G3(t)(t.values.map((a,i)=>sH(a,t.split[i])))}const $r={test:XU,parse:eH,createTransformer:tH,getAnimatableNone:rH};function Iv(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 oH({hue:e,saturation:t,lightness:r,alpha:a}){e/=360,t/=100,r/=100;let i=0,c=0,u=0;if(!t)i=c=u=r;else{const f=r<.5?r*(1+t):r+t-r*t,m=2*r-f;i=Iv(m,f,e+1/3),c=Iv(m,f,e),u=Iv(m,f,e-1/3)}return{red:Math.round(i*255),green:Math.round(c*255),blue:Math.round(u*255),alpha:a}}function ig(e,t){return r=>r>0?t:e}const Tn=(e,t,r)=>e+(t-e)*r,Pv=(e,t,r)=>{const a=e*e,i=r*(t*t-a)+a;return i<0?0:Math.sqrt(i)},aH=[Xy,Xl,uu],iH=e=>aH.find(t=>t.test(e));function $5(e){const t=iH(e);if(!t)return!1;let r=t.parse(e);return t===uu&&(r=oH(r)),r}const B5=(e,t)=>{const r=$5(e),a=$5(t);if(!r||!a)return ig(e,t);const i={...r};return c=>(i.red=Pv(r.red,a.red,c),i.green=Pv(r.green,a.green,c),i.blue=Pv(r.blue,a.blue,c),i.alpha=Tn(r.alpha,a.alpha,c),Xl.transform(i))},Wy=new Set(["none","hidden"]);function lH(e,t){return Wy.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function cH(e,t){return r=>Tn(e,t,r)}function ow(e){return typeof e=="number"?cH:typeof e=="string"?nw(e)?ig:gs.test(e)?B5:fH:Array.isArray(e)?q3:typeof e=="object"?gs.test(e)?B5:uH:ig}function q3(e,t){const r=[...e],a=r.length,i=e.map((c,u)=>ow(c)(c,t[u]));return c=>{for(let u=0;u<a;u++)r[u]=i[u](c);return r}}function uH(e,t){const r={...e,...t},a={};for(const i in r)e[i]!==void 0&&t[i]!==void 0&&(a[i]=ow(e[i])(e[i],t[i]));return i=>{for(const c in a)r[c]=a[c](i);return r}}function dH(e,t){const r=[],a={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const c=t.types[i],u=e.indexes[c][a[c]],f=e.values[u]??0;r[i]=f,a[c]++}return r}const fH=(e,t)=>{const r=$r.createTransformer(t),a=Cf(e),i=Cf(t);return a.indexes.var.length===i.indexes.var.length&&a.indexes.color.length===i.indexes.color.length&&a.indexes.number.length>=i.indexes.number.length?Wy.has(e)&&!i.values.length||Wy.has(t)&&!a.values.length?lH(e,t):oh(q3(dH(a,i),i.values),r):ig(e,t)},V5=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function hH(e,t){const r=V5.exec(e);if(!r)return;const a=V5.exec(t);if(!a||r[2]!==a[2])return;const i=r[2],c=parseFloat(r[1]),u=parseFloat(a[1]);return f=>yu(Tn(c,u,f))+i}function aw(e,t,r){if(typeof e=="number"&&typeof t=="number"&&typeof r=="number")return Tn(e,t,r);if(typeof e=="string"&&typeof t=="string"){const i=hH(e,t);if(i)return i}return ow(e)(e,t)}const mH=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>jn.update(t,r),stop:()=>pa(t),now:()=>Es.isProcessing?Es.timestamp:As.now()}},Y3=(e,t,r=10)=>{let a="";const i=Math.max(Math.round(t/r),2);for(let c=0;c<i;c++)a+=Math.round(e(c/(i-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},iw=2e4;function lw(e,t=50,r=iw,a){let i=0,c=e.next(i);for(;!c.done&&i<r;)i+=t,c=e.next(i);return i>=r?1/0:i}function pH(e,t=100,r){const a=r({...e,keyframes:[0,t]}),i=Math.min(lw(a),iw);return{type:"keyframes",ease:c=>a.next(i*c).value/t,duration:_r(i)}}const Gn={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 Qy(e,t){return e*Math.sqrt(1-t*t)}const gH=12;function xH(e,t,r){let a=r;for(let i=1;i<gH;i++)a=a-e(a)/t(a);return a}const _v=.001;function bH({duration:e=Gn.duration,bounce:t=Gn.bounce,velocity:r=Gn.velocity,mass:a=Gn.mass}){let i,c,u=1-t;u=Bo(Gn.minDamping,Gn.maxDamping,u),e=Bo(Gn.minDuration,Gn.maxDuration,_r(e)),u<1?(i=h=>{const g=h*u,p=g*e,b=g-r,v=Qy(h,u),w=Math.exp(-p);return _v-b/v*w},c=h=>{const p=h*u*e,b=p*r+r,v=u*u*h*h*e,w=Math.exp(-p),C=Qy(h*h,u);return(-i(h)+_v>0?-1:1)*((b-v)*w)/C}):(i=h=>{const g=Math.exp(-h*e),p=(h-r)*e+1;return-_v+g*p},c=h=>{const g=Math.exp(-h*e),p=(r-h)*(e*e);return g*p});const f=5/e,m=xH(i,c,f);if(e=fo(e),isNaN(m))return{stiffness:Gn.stiffness,damping:Gn.damping,duration:e};{const h=m*m*a;return{stiffness:h,damping:u*2*Math.sqrt(a*h),duration:e}}}const vH=["duration","bounce"];function yH(e,t){return t.some(r=>e[r]!==void 0)}const Zy=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Lv(e,t){if(Zy(e,t))return e}function wH(e){const t=Lv(e.stiffness),r=Lv(e.damping,!0),a=Lv(e.mass);let i={...e,stiffness:t??Gn.stiffness,damping:r??Gn.damping,mass:a??Gn.mass,isResolvedFromDuration:!1,isTimeDefined:(t??r??a)===void 0&&yH(e,vH)};if(i.isTimeDefined){if(i.velocity=0,e.visualDuration){const c=e.visualDuration,u=2*Math.PI/(c*1.2),f=u*u,m=2*Bo(.05,1,1-(e.bounce||0))*Math.sqrt(f);i={...i,mass:Gn.mass,stiffness:f,damping:m}}else{const c=bH(i);i={...i,...c,mass:Gn.mass},i.isResolvedFromDuration=!0}(!Zy(i.stiffness)||!Zy(i.damping,!0))&&(i.stiffness=Gn.stiffness,i.damping=Gn.damping)}return i}function lg(e=Gn.visualDuration,t=Gn.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,a=r.keyframes[0],i=r.keyframes[r.keyframes.length-1],c={done:!1,value:a},{stiffness:u,damping:f,mass:m,duration:h,velocity:g,isResolvedFromDuration:p,isTimeDefined:b}=wH({...r,velocity:-_r(r.velocity||0)}),v=f/(2*Math.sqrt(u*m)),w=_r(Math.sqrt(u/m)),C=v*w,S={target:i,delta:i-a,velocity:g||0,restSpeed:0,restDelta:0},N=()=>{const k=Math.abs(S.delta)<5;S.restSpeed=r.restSpeed||(k?Gn.restSpeed.granular:Gn.restSpeed.default),S.restDelta=r.restDelta||(k?Gn.restDelta.granular:Gn.restDelta.default)};N();let E,T,R;if(v<1){const k=Qy(w,v),O={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};R=()=>{O.A=(S.velocity+C*S.delta)/k,O.sinC=C*O.A+S.delta*k,O.cosC=C*S.delta-O.A*k};const D=_=>{_!==O.t&&(O.t=_,O.env=Math.exp(-C*_),O.sin=Math.sin(k*_),O.cos=Math.cos(k*_))};E=_=>(D(_),S.target-O.env*(O.A*O.sin+S.delta*O.cos)),T=_=>(D(_),O.env*(O.sinC*O.sin+O.cosC*O.cos))}else if(v===1){E=O=>S.target-Math.exp(-w*O)*(S.delta+(S.velocity+w*S.delta)*O);const k={C:0};R=()=>{k.C=S.velocity+w*S.delta},T=O=>Math.exp(-w*O)*(w*k.C*O-S.velocity)}else{const k=w*Math.sqrt(v*v-1);E=D=>{const _=Math.exp(-C*D),H=Math.min(k*D,300);return S.target-_*((S.velocity+C*S.delta)*Math.sinh(H)+k*S.delta*Math.cosh(H))/k};const O={P:0,sinh:0,cosh:0};R=()=>{O.P=(S.velocity+C*S.delta)/k,O.sinh=C*O.P-S.delta*k,O.cosh=C*S.delta-O.P*k},T=D=>{const _=Math.exp(-C*D),H=Math.min(k*D,300);return _*(O.sinh*Math.sinh(H)+O.cosh*Math.cosh(H))}}R();const M=p&&h||null,A={calculatedDuration:M,retarget:(k,O)=>{S.target=k[k.length-1],S.delta=S.target-k[0],S.velocity=b?0:-_r(O),r.restSpeed&&r.restDelta||N(),A.calculatedDuration=M,c.done=!1,R()},velocity:k=>fo(T(k)),next:k=>{const O=E(k);if(p)c.done=k>=h;else{const D=fo(T(k));c.done=Math.abs(D)<=S.restSpeed&&Math.abs(S.target-O)<=S.restDelta}return c.value=c.done?S.target:O,c},toString:()=>{const k=Math.min(lw(A),iw),O=Y3(D=>A.next(k*D).value,k,30);return k+"ms "+O},toTransition:()=>{}};return A}lg.applyToOptions=e=>{const t=pH(e,100,lg);return e.ease=t.ease,e.duration=fo(t.duration),e.type="keyframes",e};function Jy({keyframes:e,velocity:t=0,power:r=.8,timeConstant:a=325,bounceDamping:i=10,bounceStiffness:c=500,modifyTarget:u,min:f,max:m,restDelta:h=.5,restSpeed:g}){const p=e[0],b={done:!1,value:p},v=k=>k<f||k>m,w=k=>f===void 0?m:m===void 0||Math.abs(f-k)<Math.abs(m-k)?f:m;let C=r*t;const S=p+C,N=u===void 0?S:u(S);N!==S&&(C=N-p);const E=k=>-C*Math.exp(-k/a),T=k=>{const O=E(k);b.done=Math.abs(O)<=h,b.value=b.done?N:N+O};let R,M;const A=k=>{v(b.value)&&(R=k,M=lg({keyframes:[b.value,w(b.value)],velocity:-E(k)/a*1e3,damping:i,stiffness:c,restDelta:h,restSpeed:g}))};return A(0),{calculatedDuration:null,next:k=>{let O=!1;return!M&&R===void 0&&(O=!0,T(k),A(k)),R!==void 0&&k>=R?M.next(k-R):(!O&&T(k),b)}}}function jH(e,t,r){const a=[],i=r||Wa.mix||aw,c=e.length-1;for(let u=0;u<c;u++){let f=i(e[u],e[u+1]);if(t){const m=Array.isArray(t)?t[u]||_o:t;f=oh(m,f)}a.push(f)}return a}function K3(e,t,{clamp:r=!0,ease:a,mixer:i}={}){const c=e.length;if(jx(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=jH(t,a,i),m=f.length,h=g=>{if(u&&g<e[0])return t[0];let p=0;if(m>1)for(;p<e.length-2&&!(g<e[p+1]);p++);const b=Sf(e[p],e[p+1],g);return f[p](b)};return r?g=>h(Bo(e[0],e[c-1],g)):h}function SH(e,t){const r=e[e.length-1];for(let a=1;a<=t;a++){const i=Sf(0,t,a);e.push(Tn(r,1,i))}}function NH(e){const t=[0];return SH(t,e.length-1),t}function CH(e,t){return e.map(r=>r*t)}function kH(e,t){return e.map(()=>t||tw).splice(0,e.length-1)}function wu({duration:e=300,keyframes:t,times:r,ease:a="easeInOut"}){const i=zU(a)?a.map(I5):I5(a)||tw,c={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(i)&&(!r||r.length!==2||r[0]===0&&r[1]===1)){const[m,h]=t,g=m===h?void 0:(Wa.mix||aw)(m,h);return{calculatedDuration:e,next:p=>(c.value=g?g(i(e>0?Bo(0,1,p/e):1)):h,c.done=p>=e,c)}}const u=CH(r&&r.length===t.length?r:NH(t),e),f=K3(u,t,{ease:Array.isArray(i)?i:kH(t,i)});return{calculatedDuration:e,next:m=>(c.value=f(m),c.done=m>=e,c)}}const TH=5;function EH(e,t,r){const a=Math.max(t-TH,0);return T3(r-e(a),t-a)}function X3(e,t,r=0){return t<=0?r:e.velocity?e.velocity(t):EH(a=>e.next(a).value,t,e.next(t).value)}const RH=e=>e!==null;function Sx(e,{repeat:t,repeatType:r="loop"},a,i=1){const c=e.filter(RH),f=i<0||t&&r!=="loop"&&t%2===1?0:c.length-1;return!f||a===void 0?c[f]:a}const AH={decay:Jy,inertia:Jy,tween:wu,keyframes:wu,spring:lg};function cw(e){typeof e.type=="string"&&(e.type=AH[e.type])}function W3(e,t){return{kind:e,animation:t,timestamp:As.now(),frameTimestamp:Es.timestamp,frameIsProcessing:Es.isProcessing}}function Q3(e,t,r){const a=globalThis.__MOTION_INSPECT__;if(a)try{a({...W3("animation-start",e),options:r?{...t,...r}:t})}catch{}}function MH(e,t){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...W3("layout-animation-start",e),node:t})}catch{}}class Nx{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 OH=e=>e/100;class cg extends Nx{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,i;const{motionValue:r}=this.options;r&&r.updatedAt!==As.now()&&this.tick(As.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(a=this.options).onStop)==null||i.call(a))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause(),Q3(this,this.options)}initAnimation(){const{options:t}=this;cw(t);const{type:r=wu,repeat:a=0,repeatDelay:i=0,repeatType:c,velocity:u=0}=t;let{keyframes:f}=t;const m=r||wu;m!==wu&&typeof f[0]!="number"&&(this.mixKeyframes=oh(OH,aw(f[0],f[1])),f=[0,100]);const h=m(f===t.keyframes?t:{...t,keyframes:f});c==="mirror"&&(this.mirroredGenerator=m({...t,keyframes:[...f].reverse(),velocity:-u})),h.calculatedDuration===null&&(h.calculatedDuration=lw(h));const{calculatedDuration:g}=h;this.calculatedDuration=g,this.resolvedDuration=g+i,this.totalDuration=this.resolvedDuration*(a+1)-i,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:i,mixKeyframes:c,mirroredGenerator:u,resolvedDuration:f,calculatedDuration:m}=this;if(this.startTime===null)return a.next(0);const{delay:h=0,keyframes:g,repeat:p,repeatType:b,repeatDelay:v,type:w,onUpdate:C,finalKeyframe:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),r?this.currentTime=t:this.updateTime(t);const N=this.currentTime-h*(this.playbackSpeed>=0?1:-1),E=this.playbackSpeed>=0?N<0:N>i;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let T=this.currentTime,R=a;if(p){const O=Math.min(this.currentTime,i)/f;let D=Math.floor(O),_=O%1;!_&&O>=1&&(_=1),_===1&&D--,D=Math.min(D,p+1),!!(D%2)&&(b==="reverse"?(_=1-_,v&&(_-=v/f)):b==="mirror"&&(R=u)),T=Bo(0,1,_)*f}let M;E?(this.delayState.value=g[0],M=this.delayState):M=R.next(T),c&&!E&&(M.value=c(M.value));let{done:A}=M;!E&&m!==null&&(A=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return k&&w!==Jy&&(M.value=Sx(g,this.options,S,this.speed)),C&&C(M.value),k&&this.finish(),M}then(t,r){return this.finished.then(t,r)}get duration(){return _r(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+_r(t)}get time(){return _r(this.currentTime)}set time(t){t=fo(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 X3(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(As.now()),this.playbackSpeed=t,r&&this.driver&&(this.time=_r(this.currentTime))}play(){var i,c;if(this.isStopped)return;const{driver:t=mH,startTime:r}=this.options;this.driver||(this.driver=t(u=>this.tick(u))),(c=(i=this.options).onPlay)==null||c.call(i);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(As.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 DH=new Set(["brightness","contrast","saturate","opacity"]);function zH(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=r.match(sw)||[];if(!a)return e;const i=r.replace(a,"");let c=DH.has(t)?1:0;return a!==r&&(c*=100),t+"("+c+i+")"}const IH=/\b([a-z-]*)\(.*?\)/gu,e1={...$r,getAnimatableNone:e=>{const t=e.match(IH);return t?t.map(zH).join(" "):e}},t1={...$r,getAnimatableNone:e=>{const t=$r.parse(e);return $r.createTransformer(e)(t.map(a=>typeof a=="number"?0:typeof a=="object"?{...a,alpha:1}:a))}},U5={...$u,transform:Math.round},PH={rotate:La,pathRotation:La,rotateX:La,rotateY:La,rotateZ:La,scale:Xm,scaleX:Xm,scaleY:Xm,scaleZ:Xm,skew:La,skewX:La,skewY:La,distance:pt,translateX:pt,translateY:pt,translateZ:pt,x:pt,y:pt,z:pt,perspective:pt,transformPerspective:pt,opacity:Nf,originX:_5,originY:_5,originZ:pt},ug={borderWidth:pt,borderTopWidth:pt,borderRightWidth:pt,borderBottomWidth:pt,borderLeftWidth:pt,borderRadius:pt,borderTopLeftRadius:pt,borderTopRightRadius:pt,borderBottomRightRadius:pt,borderBottomLeftRadius:pt,width:pt,maxWidth:pt,height:pt,maxHeight:pt,top:pt,right:pt,bottom:pt,left:pt,inset:pt,insetBlock:pt,insetBlockStart:pt,insetBlockEnd:pt,insetInline:pt,insetInlineStart:pt,insetInlineEnd:pt,padding:pt,paddingTop:pt,paddingRight:pt,paddingBottom:pt,paddingLeft:pt,paddingBlock:pt,paddingBlockStart:pt,paddingBlockEnd:pt,paddingInline:pt,paddingInlineStart:pt,paddingInlineEnd:pt,margin:pt,marginTop:pt,marginRight:pt,marginBottom:pt,marginLeft:pt,marginBlock:pt,marginBlockStart:pt,marginBlockEnd:pt,marginInline:pt,marginInlineStart:pt,marginInlineEnd:pt,fontSize:pt,backgroundPositionX:pt,backgroundPositionY:pt,...PH,zIndex:U5,fillOpacity:Nf,strokeOpacity:Nf,numOctaves:U5},_H={...ug,color:gs,backgroundColor:gs,outlineColor:gs,fill:gs,stroke:gs,borderColor:gs,borderTopColor:gs,borderRightColor:gs,borderBottomColor:gs,borderLeftColor:gs,filter:e1,WebkitFilter:e1,mask:t1,WebkitMask:t1},Z3=e=>_H[e],LH=new Set([e1,t1]);function uw(e,t){let r=Z3(e);return LH.has(r)||(r=$r),r.getAnimatableNone?r.getAnimatableNone(t):void 0}function $H(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Wl=e=>e*180/Math.PI,n1=e=>{const t=Wl(Math.atan2(e[1],e[0]));return s1(t)},BH={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:n1,rotateZ:n1,skewX:e=>Wl(Math.atan(e[1])),skewY:e=>Wl(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},s1=e=>(e=e%360,e<0&&(e+=360),e),H5=n1,F5=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),G5=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),VH={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:F5,scaleY:G5,scale:e=>(F5(e)+G5(e))/2,rotateX:e=>s1(Wl(Math.atan2(e[6],e[5]))),rotateY:e=>s1(Wl(Math.atan2(-e[2],e[0]))),rotateZ:H5,rotate:H5,skewX:e=>Wl(Math.atan(e[4])),skewY:e=>Wl(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function r1(e){return e.includes("scale")?1:0}function o1(e,t){if(!e||e==="none")return r1(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,i;if(r)a=VH,i=r;else{const f=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=BH,i=f}if(!i)return r1(t);const c=a[t],u=i[1].split(",").map(HH);return typeof c=="function"?c(u):u[c]}const UH=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return o1(r,t)};function HH(e){return parseFloat(e.trim())}const Bu=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vu=new Set([...Bu,"pathRotation"]),q5=e=>e===$u||e===pt,FH=new Set(["x","y","z"]),GH=Bu.filter(e=>!FH.has(e));function qH(e){const t=[];return GH.forEach(r=>{const a=e.getValue(r);if(a!==void 0){const i=a.get(),c=r.startsWith("scale")?1:0;if(i===c)return;t.push([r,i]),a.set(c)}}),t}const YH=new Set(["bottom","right"]);function Y5(e,t,r,a,i,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(i)}const Jl={width:({width:e,paddingLeft:t="0",paddingRight:r="0",boxSizing:a},i)=>Y5(e,i,"x",t,r,a),height:({height:e,paddingTop:t="0",paddingBottom:r="0",boxSizing:a},i)=>Y5(e,i,"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})=>o1(e,"x"),y:({transform:e})=>o1(e,"y")};Jl.translateX=Jl.x;Jl.translateY=Jl.y;const ec=new Set;let a1=!1,i1=!1,l1=!1;function J3(){if(i1){const e=[],t=new Set,r=new Set;ec.forEach(i=>{i.needsMeasurement&&(e.push(i),t.add(i.element),YH.has(i.name)&&r.add(i.element))});const a=new Map;r.forEach(i=>{const c=qH(i);c.length&&(a.set(i,c),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const c=a.get(i);c&&c.forEach(([u,f])=>{var m;(m=i.getValue(u))==null||m.set(f)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}i1=!1,a1=!1,ec.forEach(e=>e.complete(l1)),ec.clear()}function eO(){ec.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(i1=!0)})}function KH(){l1=!0,eO(),J3(),l1=!1}function XH(e,t,r){if(typeof e=="string"){if(Q2(e)||Z2(e))return parseFloat(e);if(!$r.test(e)&&$r.test(r))return uw(t,r)}return e??void 0}class dw{constructor(t,r,a,i,c,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=a,this.motionValue=i,this.element=c,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(ec.add(this),a1||(a1=!0,jn.read(eO),jn.resolveKeyframes(J3))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:a,motionValue:i}=this;if(t[0]===null){const c=i==null?void 0:i.get(),u=t[t.length-1];if(c!==void 0)t[0]=c;else if(a&&r){const f=XH(a.readValue(r,u),r,u);f!==void 0&&(t[0]=f)}t[0]===void 0&&(t[0]=u),i&&c===void 0&&i.set(t[0])}$H(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ec.delete(this)}cancel(){this.state==="scheduled"&&(ec.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const WH=e=>e.startsWith("--");function tO(e,t,r){WH(t)?e.style.setProperty(t,r):e.style[t]=r}const QH={};function nO(e,t){const r=k3(e);return()=>QH[t]??r()}const ZH=nO(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),sO=nO(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Jd=([e,t,r,a])=>`cubic-bezier(${e}, ${t}, ${r}, ${a})`,K5={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Jd([0,.65,.55,1]),circOut:Jd([.55,0,1,.45]),backIn:Jd([.31,.01,.66,-.59]),backOut:Jd([.33,1.53,.69,.99])};function rO(e,t){if(e)return typeof e=="function"?sO()?Y3(e,t):"ease-out":P3(e)?Jd(e):Array.isArray(e)?e.map(r=>rO(r,t)||K5.easeOut):K5[e]}function JH(e,t,r,{delay:a=0,duration:i=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=rO(f,i);Array.isArray(p)&&(g.easing=p);const b={delay:a,duration:i,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:c+1,direction:u==="reverse"?"alternate":"normal"};return h&&(b.pseudoElement=h),e.animate(g,b)}function oO(e){return typeof e=="function"&&"applyToOptions"in e}function eF({type:e,...t}){return oO(e)&&sO()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class aO extends Nx{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:r,name:a,keyframes:i,pseudoElement:c,allowFlatten:u=!1,finalKeyframe:f,onComplete:m}=t;this.isPseudoElement=!!c,this.allowFlatten=u,this.options=t,jx(typeof t.type!="string");const h=eF(t);this.animation=JH(r,a,i,h,c),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const g=Sx(i,this.options,f,this.speed);this.updateMotionValue&&this.updateMotionValue(g),tO(r,a,g),this.animation.cancel()}m==null||m(),this.notifyFinished()},Q3(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,i;const t=(r=this.options)==null?void 0:r.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((i=(a=this.animation).commitStyles)==null||i.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 _r(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+_r(t)}get time(){return _r(Number(this.animation.currentTime)||0)}set time(t){const r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=fo(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:i}){var c;return this.allowFlatten&&((c=this.animation.effect)==null||c.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&ZH()?(this.animation.timeline=t,r&&(this.animation.rangeStart=r),a&&(this.animation.rangeEnd=a),_o):i(this)}}const iO={anticipate:D3,backInOut:O3,circInOut:I3};function tF(e){return e in iO}function nF(e){typeof e.ease=="string"&&tF(e.ease)&&(e.ease=iO[e.ease])}const $v=10;class sF extends aO{constructor(t){nF(t),cw(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:r,onUpdate:a,onComplete:i,element:c,...u}=this.options;if(!r)return;if(t!==void 0){r.set(t);return}const f=new cg({...u,autoplay:!1}),m=Math.max($v,As.now()-this.startTime),h=Bo(0,$v,m-$v),g=f.sample(m).value,{name:p}=this.options;c&&p&&tO(c,p,g),r.setWithVelocity(f.sample(Math.max(0,m-h)).value,g,h),f.stop()}}const X5=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&($r.test(e)||e==="0")&&!e.startsWith("url("));function rF(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 oF(e,t,r,a){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const c=e[e.length-1],u=X5(i,t),f=X5(c,t);return!u||!f?!1:rF(e)||(r==="spring"||oO(r))&&a}function c1(e){e.duration=0,e.type="keyframes"}const u1=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),aF=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function iF(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&aF.test(e[t]))return!0;return!1}const W5=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),lF=k3(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function cF(e){var p;const{motionValue:t,name:r,repeatDelay:a,repeatType:i,damping:c,type:u,keyframes:f}=e;if(!r||!(u1.has(r)||W5.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 lF()&&(u1.has(r)||W5.has(r)&&iF(f))&&(r!=="transform"||!g)&&!h&&!a&&i!=="mirror"&&c!==0&&u!=="inertia"}const uF=40;class dF extends Nx{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=As.now();const{keyframes:r,name:a,motionValue:i,element:c}=t,u=t;u.autoplay??(u.autoplay=!0),u.delay??(u.delay=0),u.type??(u.type="keyframes"),u.repeat??(u.repeat=0),u.repeatDelay??(u.repeatDelay=0),u.repeatType??(u.repeatType="loop");const f=(c==null?void 0:c.KeyframeResolver)||dw;this.keyframeResolver=new f(r,(h,g,p)=>this.onKeyframesResolved(h,g,u,!p),a,i,c),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(t,r,a,i){var S,N;this.keyframeResolver=void 0;const{name:c,type:u,velocity:f,delay:m,isHandoff:h,onUpdate:g}=a;this.resolvedAt=As.now();let p=!0;oF(t,c,u,f)||(p=!1,(Wa.instantAnimations||!m)&&(g==null||g(Sx(t,a,r))),t[0]=t[t.length-1],c1(a),a.repeat=0);const b=i?this.resolvedAt?this.resolvedAt-this.createdAt>uF?this.resolvedAt:this.createdAt:this.createdAt:void 0,{onComplete:v}=a;a.startTime??(a.startTime=b),a.finalKeyframe=r,a.keyframes=t,a.onComplete=()=>{v==null||v(),this.notifyFinished()};const w=p&&!h&&cF(a);let C;if(w){a.element=(N=(S=a.motionValue)==null?void 0:S.owner)==null?void 0:N.current;try{C=new sF(a)}catch{C=new cg(a)}}else C=new cg(a);this.pendingTimeline&&(this.stopTimeline=C.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=C}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(),KH()),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 lO(e,t,r,a=0,i=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):i===1?c*a:f-c*a}const Q5=30,fF=e=>!isNaN(parseFloat(e)),of={current:void 0};class hF{constructor(t,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const i=As.now();if(this.updatedAt!==i&&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=As.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=fF(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 ag)).add(r)}onChangeSubscribe(t){const{events:r}=this;return!r.change&&!this.changeSubscriber?this.changeSubscriber=t:(r.change||(r.change=new ag,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(){jn.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 of.current&&of.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=As.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Q5)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,Q5);return T3(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{var c;this.hasAnimated=!0;let a=!1,i;i=t(()=>{var u;a=!0,(u=this.events.animationComplete)==null||u.notify(),this.animation===i&&this.clearAnimation(),r()}),a||(this.animation=i),(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 ic(e,t){return new hF(e,t)}function cO(e,t){if(e!=null&&e.inherit&&t){const{inherit:r,...a}=e;return{...t,...a}}return e}function fw(e,t){const r=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return r!==e?cO(r,e):r}const mF={type:"spring",stiffness:500,damping:25,restSpeed:10},pF=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),gF={type:"keyframes",duration:.8},xF={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},bF=(e,{keyframes:t})=>t.length>2?gF:Vu.has(e)?e.startsWith("scale")?pF(t[1]):mF:xF,vF=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function yF(e){for(const t in e)if(!vF.has(t))return!0;return!1}const hw=(e,t,r,a={},i,c)=>u=>{const f=fw(a,e)||{},m=f.delay||a.delay||0;let{elapsed:h=0}=a;h=h-fo(m);const g={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...f,delay:-h,onUpdate:b=>{t.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{u(),f.onComplete&&f.onComplete()},name:e,motionValue:t,element:c?void 0:i};yF(f)||Object.assign(g,bF(e,g)),g.duration&&(g.duration=fo(g.duration)),g.repeatDelay&&(g.repeatDelay=fo(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let p=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(c1(g),g.delay===0&&(p=!0)),(Wa.instantAnimations||Wa.skipAnimations||i!=null&&i.shouldSkipAnimations||f.skipAnimations)&&(p=!0,c1(g),g.delay=0),g.allowFlatten=!f.type&&!f.ease,p&&!c&&t.get()!==void 0){const b=Sx(g.keyframes,f);if(b!==void 0){jn.update(()=>{g.onUpdate(b),g.onComplete()});return}}return f.isSync?new cg(g):new dF(g)},wF=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function jF(e){const t=wF.exec(e);if(!t)return[,];const[,r,a,i]=t;return[`--${r??a}`,i]}function uO(e,t,r=1){const[a,i]=jF(e);if(!a)return;const c=window.getComputedStyle(t).getPropertyValue(a);if(c){const u=c.trim();return Q2(u)?parseFloat(u):u}return nw(i)?uO(i,t,r+1):i}function Z5(e){const t=[{},{}];return e==null||e.values.forEach((r,a)=>{t[0][a]=r.get(),t[1][a]=r.getVelocity()}),t}function mw(e,t,r,a){if(typeof t=="function"){const[i,c]=Z5(a);t=t(r!==void 0?r:e.custom,i,c)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,c]=Z5(a);t=t(r!==void 0?r:e.custom,i,c)}return t}function tc(e,t,r){const a=e.getProps();return mw(a,t,r!==void 0?r:a.custom,e)}const dO=new Set(["width","height","top","left","right","bottom",...Bu]),d1=e=>Array.isArray(e);function SF(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,ic(r))}function NF(e){return d1(e)?e[e.length-1]||0:e}function CF(e,t){const r=tc(e,t);let{transitionEnd:a={},transition:i={},...c}=r||{};c={...c,...a};for(const u in c){const f=NF(c[u]);SF(e,u,f)}}const xs=e=>!!(e&&e.getVelocity);function kF(e){return!!(xs(e)&&e.add)}function f1(e,t){const r=e.getValue("willChange");if(kF(r))return r.add(t);if(!r&&Wa.WillChange){const a=new Wa.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function pw(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const TF="framerAppearId",fO="data-"+pw(TF);function hO(e){return e.props[fO]}const EF=typeof window<"u";function RF({protectedKeys:e,needsAnimating:t},r){const a=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,a}function mO(e,t,{delay:r=0,transitionOverride:a,type:i}={}){let{transition:c,transitionEnd:u,...f}=t;const m=e.getDefaultTransition();c=c?cO(c,m):m;const h=c==null?void 0:c.reduceMotion,g=c==null?void 0:c.skipAnimations;a&&(c=a);const p=[],b=i&&e.animationState&&e.animationState.getState()[i],v=c==null?void 0:c.path;v&&v.animateVisualElement(e,f,c,r,p);for(const w in f){const C=e.getValue(w,e.latestValues[w]??null),S=f[w];if(S===void 0||b&&RF(b,w))continue;const N={delay:r,...fw(c||{},w)};g&&(N.skipAnimations=!0);const E=C.get();if(E!==void 0&&!C.isAnimating()&&!Array.isArray(S)&&S===E&&!N.velocity){jn.update(()=>C.set(S));continue}let T=!1;if(EF&&window.MotionHandoffAnimation){const A=hO(e);if(A){const k=window.MotionHandoffAnimation(A,w,jn);k!==null&&(N.startTime=k,T=!0)}}f1(e,w);const R=h??e.shouldReduceMotion;C.start(hw(w,C,S,R&&dO.has(w)?{type:!1}:N,e,T));const M=C.animation;M&&p.push(M)}if(u){const w=()=>jn.update(()=>{u&&CF(e,u)});p.length?Promise.all(p).then(w):w()}return p}function h1(e,t,r={}){var m;const a=tc(e,t,r.type==="exit"?(m=e.presenceContext)==null?void 0:m.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=a||{};r.transitionOverride&&(i=r.transitionOverride);const c=a?()=>Promise.all(mO(e,a,r)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(h=0)=>{const{delayChildren:g=0,staggerChildren:p,staggerDirection:b}=i;return AF(e,t,h,g,p,b,r)}:()=>Promise.resolve(),{when:f}=i;if(f){const[h,g]=f==="beforeChildren"?[c,u]:[u,c];return h().then(()=>g())}else return Promise.all([c(),u(r.delay)])}function AF(e,t,r=0,a=0,i=0,c=1,u){const f=[];for(const m of e.variantChildren)m.notify("AnimationStart",t),f.push(h1(m,t,{...u,delay:r+(typeof a=="function"?0:a)+lO(e.variantChildren,m,a,i,c)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(f)}function MF(e,t,r={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const i=t.map(c=>h1(e,c,r));a=Promise.all(i)}else if(typeof t=="string")a=h1(e,t,r);else{const i=typeof t=="function"?tc(e,t,r.custom):t;a=Promise.all(mO(e,i,r))}return a.then(()=>{e.notify("AnimationComplete",t)})}const OF={test:e=>e==="auto",parse:e=>e},DF=e=>t=>t.test(e),zF=[$u,pt,aa,La,YU,qU,OF],J5=e=>zF.find(DF(e));function IF(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Z2(e):!0}const PF=new Set(["auto","none","0"]);function _F(e,t,r){let a=0,i;for(;a<e.length&&!i;){const c=e[a];typeof c=="string"&&!PF.has(c)&&JU(c)&&(i=e[a]),a++}if(i&&r)for(const c of t)e[c]!==i&&(e[c]=uw(r,i))}class LF extends dw{constructor(t,r,a,i,c){super(t,r,a,i,c,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:r,name:a}=this;if(!r||!r.current)return;super.readKeyframes();for(let g=0;g<t.length;g++){let p=t[g];if(typeof p=="string"&&(p=p.trim(),nw(p))){const b=uO(p,r.current);b!==void 0&&(t[g]=b),g===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!dO.has(a)||t.length!==2)return;const[i,c]=t;if(typeof i=="number"&&typeof c=="number")return;const u=J5(i),f=J5(c),m=P5(i),h=P5(c);if(m!==h&&Jl[a]){this.needsMeasurement=!0;return}if(u!==f)if(q5(u)&&q5(f))for(let g=0;g<t.length;g++){const p=t[g];typeof p=="string"&&(t[g]=parseFloat(p))}else Jl[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,a=[];for(let i=0;i<t.length;i++)(t[i]===null||IF(t[i]))&&a.push(i);a.length&&_F(t,a,r)}measure(){const{element:t,name:r}=this;return Jl[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 i=r[r.length-1];i!==void 0&&((c=this.motionValue)==null||c.jump(i,!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,i=r[a];r[a]=this.measure(),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),(u=this.removedTransforms)!=null&&u.length&&this.removedTransforms.forEach(([f,m])=>{t.getValue(f).set(m)}),this.resolveNoneKeyframes()}}const gw=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Tp(e){return C3(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function xw(e){return C3(e)&&"ownerSVGElement"in e}const m1=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function bw(e,t,r){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){const i=document.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(a=>a!=null)}const $F={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},BF=Bu.length;function VF(e,t,r){let a="",i=!0;for(let u=0;u<BF;u++){const f=Bu[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=m1(m,ug[f]);if(!h){i=!1;const p=$F[f]||f;a+=`${p}(${g}) `}r&&(t[f]=g)}}const c=e.pathRotation;return c&&(i=!1,a+=`rotate(${m1(c,ug.pathRotation)}) `),a=a.trim(),r?a=r(t,i?"":a):i&&(a="none"),a}function vw(e,t,r){const{style:a,vars:i,transformOrigin:c}=e;let u=!1,f=!1;for(const m in t){const h=t[m];if(Vu.has(m)){u=!0;continue}else if($3(m)){i[m]=h;continue}else{const g=m1(h,ug[m]);m.startsWith("origin")?(f=!0,c[m]=g):a[m]=g}}if(t.transform||(u||r?a.transform=VF(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 UF={offset:"stroke-dashoffset",array:"stroke-dasharray"},HF={offset:"strokeDashoffset",array:"strokeDasharray"};function FF(e,t,r=1,a=0,i=!0){e.pathLength=1;const c=i?UF:HF;e[c.offset]=`${-a}`,e[c.array]=`${t} ${r}`}const pO=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function gO(e,{attrX:t,attrY:r,attrScale:a,pathLength:i,pathSpacing:c=1,pathOffset:u=0,...f},m,h,g){if(vw(e,f,h),m){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:b}=e;for(const v of pO)p[v]!==void 0&&(b[v]=p[v],delete p[v]);(b.transform||p.transformOrigin)&&(b.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),b.transform&&(b.transformBox=(g==null?void 0:g.transformBox)??"fill-box",delete p.transformBox),t!==void 0&&(p.x=t),r!==void 0&&(p.y=r),a!==void 0&&(p.scale=a),i!==void 0&&FF(p,i,c,u,!1)}function xO({top:e,left:t,right:r,bottom:a}){return{x:{min:t,max:r},y:{min:e,max:a}}}function GF({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function qF(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 Bv(e){return e===void 0||e===1}function p1({scale:e,scaleX:t,scaleY:r}){return!Bv(e)||!Bv(t)||!Bv(r)}function Fl(e){return p1(e)||bO(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function bO(e){return eT(e.x)||eT(e.y)}function eT(e){return e&&e!=="0%"}function dg(e,t,r){const a=e-r,i=t*a;return r+i}function tT(e,t,r,a,i){return i!==void 0&&(e=dg(e,i,a)),dg(e,r,a)+t}function g1(e,t=0,r=1,a,i){e.min=tT(e.min,t,r,a,i),e.max=tT(e.max,t,r,a,i)}function vO(e,{x:t,y:r}){g1(e.x,t.translate,t.scale,t.originPoint),g1(e.y,r.translate,r.scale,r.originPoint)}const nT=.999999999999,sT=1.0000000000001;function YF(e,t,r,a=!1){var f;const i=r.length;if(!i)return;t.x=t.y=1;let c,u;for(let m=0;m<i;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&&(sa(e.x,-c.scroll.offset.x),sa(e.y,-c.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,vO(e,u)),a&&Fl(c.latestValues)&&Ep(e,c.latestValues,(f=c.layout)==null?void 0:f.layoutBox))}t.x<sT&&t.x>nT&&(t.x=1),t.y<sT&&t.y>nT&&(t.y=1)}function sa(e,t){e.min+=t,e.max+=t}function rT(e,t,r,a,i=.5){const c=Tn(e.min,e.max,i);g1(e,t,r,c,a)}function oT(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Ep(e,t,r){const a=r??e;rT(e.x,oT(t.x,a.x),t.scaleX,t.scale,t.originX),rT(e.y,oT(t.y,a.y),t.scaleY,t.scale,t.originY)}function yO(e,t){return xO(qF(e.getBoundingClientRect(),t))}function KF(e,t,r){const a=yO(e,r),{scroll:i}=t;return i&&(sa(a.x,i.offset.x),sa(a.y,i.offset.y)),a}const{schedule:yw}=_3(queueMicrotask,!1),Mo={x:!1,y:!1};function wO(){return Mo.x||Mo.y}function XF(e){return e==="x"||e==="y"?Mo[e]?null:(Mo[e]=!0,()=>{Mo[e]=!1}):Mo.x||Mo.y?null:(Mo.x=Mo.y=!0,()=>{Mo.x=Mo.y=!1})}function jO(e,t){const r=bw(e),a=new AbortController,i={passive:!0,...t,signal:a.signal};return[r,i,()=>a.abort()]}function WF(e){return!(e.pointerType==="touch"||wO())}function QF(e,t,r={}){const[a,i,c]=jO(e,r);return a.forEach(u=>{let f=!1,m=!1,h;const g=()=>{u.removeEventListener("pointerleave",w)},p=S=>{h&&(h(S),h=void 0),g()},b=S=>{f=!1,window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),m&&(m=!1,p(S))},v=()=>{f=!0,window.addEventListener("pointerup",b,i),window.addEventListener("pointercancel",b,i)},w=S=>{if(S.pointerType!=="touch"){if(f){m=!0;return}p(S)}},C=S=>{if(!WF(S))return;m=!1;const N=t(u,S);typeof N=="function"&&(h=N,u.addEventListener("pointerleave",w,i))};u.addEventListener("pointerenter",C,i),u.addEventListener("pointerdown",v,i)}),c}const SO=(e,t)=>t?e===t?!0:SO(e,t.parentElement):!1,ww=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,ZF=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function JF(e){return ZF.has(e.tagName)||e.isContentEditable===!0}const eG=new Set(["INPUT","SELECT","TEXTAREA"]);function tG(e){return eG.has(e.tagName)||e.isContentEditable===!0}const Rp=new WeakSet;function aT(e){return t=>{t.key==="Enter"&&e(t)}}function Vv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const nG=(e,t)=>{const r=e.currentTarget;if(!r)return;const a=aT(()=>{if(Rp.has(r))return;Vv(r,"down");const i=aT(()=>{Vv(r,"up")}),c=()=>Vv(r,"cancel");r.addEventListener("keyup",i,t),r.addEventListener("blur",c,t)});r.addEventListener("keydown",a,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",a),t)};function iT(e){return ww(e)&&!wO()}const lT=new WeakSet;function sG(e,t,r={}){const[a,i,c]=jO(e,r),u=f=>{const m=f.currentTarget;if(!iT(f)||lT.has(f))return;Rp.add(m),r.stopPropagation&&lT.add(f);const h=t(m,f),g={...i,capture:!0},p=(w,C)=>{window.removeEventListener("pointerup",b,g),window.removeEventListener("pointercancel",v,g),Rp.has(m)&&Rp.delete(m),iT(w)&&typeof h=="function"&&h(w,{success:C})},b=w=>{p(w,m===window||m===document||r.useGlobalTarget||SO(m,w.target))},v=w=>{p(w,!1)};window.addEventListener("pointerup",b,g),window.addEventListener("pointercancel",v,g)};return a.forEach(f=>{(r.useGlobalTarget?window:f).addEventListener("pointerdown",u,i),Tp(f)&&(f.addEventListener("focus",h=>nG(h,i)),!JF(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),c}const Ap=new WeakMap;let _i;const NO=(e,t,r)=>(a,i)=>i&&i[0]?i[0][e+"Size"]:xw(a)&&"getBBox"in a?a.getBBox()[t]:a[r],rG=NO("inline","width","offsetWidth"),oG=NO("block","height","offsetHeight");function aG({target:e,borderBoxSize:t}){var r;(r=Ap.get(e))==null||r.forEach(a=>{a(e,{get width(){return rG(e,t)},get height(){return oG(e,t)}})})}function iG(e){e.forEach(aG)}function lG(){typeof ResizeObserver>"u"||(_i=new ResizeObserver(iG))}function cG(e,t){_i||lG();const r=bw(e);return r.forEach(a=>{let i=Ap.get(a);i||(i=new Set,Ap.set(a,i)),i.add(t),_i==null||_i.observe(a)}),()=>{r.forEach(a=>{const i=Ap.get(a);i==null||i.delete(t),i!=null&&i.size||_i==null||_i.unobserve(a)})}}const Mp=new Set;let du;function uG(){du=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Mp.forEach(t=>t(e))},window.addEventListener("resize",du)}function dG(e){return Mp.add(e),du||uG(),()=>{Mp.delete(e),!Mp.size&&typeof du=="function"&&(window.removeEventListener("resize",du),du=void 0)}}function cT(e,t){return typeof e=="function"?dG(e):cG(e,t)}function fG(e){return xw(e)&&e.tagName==="svg"}function hG(...e){const t=!Array.isArray(e[0]),r=t?0:-1,a=e[0+r],i=e[1+r],c=e[2+r],u=e[3+r],f=K3(i,c,u);return t?f(a):f}const ef=new Set,uT=({timestamp:e})=>{ef.forEach(t=>t.tick(e))};class mG extends Nx{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,i;this.state!=="idle"&&(this.teardown(),(i=(a=this.options).onStop)==null||i.call(a))},this.options=t,cw(t),this.factory=t.type||wu,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():(ef.size||jn.update(uT,!0),ef.add(this))}setTarget(t,r){this.nextTarget=t,this.nextVelocity=r,this.hasNextTarget=!0}retarget(t,r){const{options:a,generator:i}=this;a.keyframes=t,a.velocity=r,this.startTime=this.now(),this.currentTime=0,i.retarget?i.retarget(t,r):this.generator=this.factory(a)}tick(t){var p;const{options:r,hasNextTarget:a}=this,{delay:i=0,onUpdate:c,onPlay:u}=r,f=Math.round(t-this.startTime)-i,m=this.currentTime=Math.max(0,f),h=this.generator.next(m),g=f<0?r.keyframes[0]:h.value;if(a){this.hasNextTarget=!1;const{keyframes:b}=r;b[0]=g,b[1]=this.nextTarget,this.retarget(b,this.nextVelocity??this.getGeneratorVelocity())}(a||!this.started)&&(this.started=!0,u==null||u()),this.state==="running"&&(c==null||c(g),h.done&&f>=0&&!a&&!this.hasNextTarget&&this.state==="running"&&(this.notifyFinished(),this.teardown(),this.state="finished",(p=r.onComplete)==null||p.call(r)))}getGeneratorVelocity(){return X3(this.generator,this.currentTime,this.options.velocity)}now(){return this.driver?this.driver.now():As.now()}teardown(){this.state="idle",this.driver?this.driver.stop():(ef.delete(this),ef.size||pa(uT))}}function pG(e,t,r={}){const a=e.get();let i=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=()=>{i&&(i.stop(),i=null),e.animation=void 0};if(e.attach((g,p)=>{c=p;const b=fT(g);if((i==null?void 0:i.state)==="running"){i.setTarget(b,r.velocity);return}const v=fT(e.get()),w=i?i.getGeneratorVelocity():e.getVelocity();if(h(),v===b)return;const C={keyframes:[v,b],velocity:w,type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:f},S=i=new mG({...C,onPlay:m});e.animation=S,S.then(()=>{var N;i===S&&(i=null,e.animation=void 0,(N=e.events.animationComplete)==null||N.notify())})},h),xs(t)){let g=r.skipInitialAnimation===!0;const p=t.on("change",v=>{g?(g=!1,e.jump(dT(v,u),!1)):e.set(dT(v,u))}),b=e.on("destroy",p);return()=>{p(),b()}}return h}function dT(e,t){return t?e+t:e}function fT(e){return typeof e=="number"?e:parseFloat(e)}const hT=()=>({translate:0,scale:1,origin:0,originPoint:0}),fu=()=>({x:hT(),y:hT()}),mT=()=>({min:0,max:0}),ps=()=>({x:mT(),y:mT()}),gG=new WeakMap;function Cx(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function kf(e){return typeof e=="string"||Array.isArray(e)}const jw=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fg=["initial",...jw];function kx(e){if(Cx(e.animate))return!0;for(let t=0;t<fg.length;t++)if(kf(e[fg[t]]))return!0;return!1}function CO(e){return!!(kx(e)||e.variants)}function xG(e,t,r){for(const a in t){const i=t[a],c=r[a];if(xs(i))e.addValue(a,i);else if(xs(c))e.addValue(a,ic(i,{owner:e}));else if(c!==i)if(e.hasValue(a)){const u=e.getValue(a);u.liveStyle===!0?u.jump(i):u.hasAnimated||u.set(i)}else{const u=e.getStaticValue(a);e.addValue(a,ic(u!==void 0?u:i,{owner:e}))}}for(const a in r)t[a]===void 0&&e.removeValue(a);return t}const hg={current:null},Sw={current:!1},bG=typeof window<"u";function kO(){if(Sw.current=!0,!!bG)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>hg.current=e.matches;e.addEventListener("change",t),t()}else hg.current=!1}const pT=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let mg={};function TO(e){mg=e}function vG(){return mg}class yG{scrapeMotionValuesFromProps(t,r,a){return{}}constructor({parent:t,props:r,presenceContext:a,reducedMotionConfig:i,skipAnimations:c,blockInitialAnimation:u,visualState:f},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=dw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const v=As.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,jn.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=i,this.skipAnimationsConfig=c,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=kx(r),this.isVariantNode=CO(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...b}=this.scrapeMotionValuesFromProps(r,{},this);for(const v in b){const w=b[v];h[v]!==void 0&&xs(w)&&w.set(h[v])}}mount(t){var r,a;if(this.hasBeenMounted)for(const i in this.initialValues)(r=this.values.get(i))==null||r.jump(this.initialValues[i]),this.latestValues[i]=this.initialValues[i];this.current=t,gG.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((i,c)=>this.bindToMotionValue(c,i)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Sw.current||kO(),this.shouldReduceMotion=hg.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(),pa(this.notifyUpdate),pa(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&&u1.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:f,times:m,ease:h,duration:g}=r.accelerate,p=new aO({element:this.current,name:t,keyframes:f,times:m,ease:h,duration:fo(g)}),b=u(p);this.valueSubscriptions.set(t,()=>{b(),p.cancel()});return}const a=Vu.has(t);a&&this.onBindTransform&&this.onBindTransform();const i=r.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&jn.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,()=>{i(),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 mg){const r=mg[t];if(!r)continue;const{isEnabled:a,Feature:i}=r;if(!this.features[t]&&i&&a(this.props)&&(this.features[t]=new i(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):ps()}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<pT.length;a++){const i=pT[a];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const c="on"+i,u=t[c];u&&(this.propEventSubscriptions[i]=this.on(i,u))}this.prevMotionValues=xG(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=ic(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"&&(Q2(a)||Z2(a))?a=parseFloat(a):typeof a!="number"&&!$r.test(a)&&$r.test(r)&&(a=uw(t,r)),this.setBaseTarget(t,xs(a)?a.get():a)),xs(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=mw(this.props,r,(c=this.presenceContext)==null?void 0:c.custom);u&&(a=u[t])}if(r&&a!==void 0)return a;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!xs(i)?i:this.initialValues[t]!==void 0&&a===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new ag),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){yw.render(this.render)}}class EO extends yG{constructor(){super(...arguments),this.KeyframeResolver=LF}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;xs(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class il{constructor(t){this.isMounted=!1,this.node=t}update(){}}function RO(e,{style:t,vars:r},a,i){const c=e.style;let u;for(u in t)c[u]=t[u];i==null||i.applyProjectionStyles(c,a);for(u in r)c.setProperty(u,r[u])}function gT(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Fd={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(pt.test(e))e=parseFloat(e);else return e;const r=gT(e,t.target.x),a=gT(e,t.target.y);return`${r}% ${a}%`}},wG={correct:(e,{treeScale:t,projectionDelta:r})=>{const a=e,i=$r.parse(e);if(i.length>5)return a;const c=$r.createTransformer(e),u=typeof i[0]!="number"?1:0,f=r.x.scale*t.x,m=r.y.scale*t.y;i[0+u]/=f,i[1+u]/=m;const h=Tn(f,m,.5);return typeof i[2+u]=="number"&&(i[2+u]/=h),typeof i[3+u]=="number"&&(i[3+u]/=h),c(i)}},x1={borderRadius:{...Fd,applyTo:[...gw]},borderTopLeftRadius:Fd,borderTopRightRadius:Fd,borderBottomLeftRadius:Fd,borderBottomRightRadius:Fd,boxShadow:wG};function AO(e,{layout:t,layoutId:r}){return Vu.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!x1[e]||e==="opacity")}function Nw(e,t,r){var u;const a=e.style,i=t==null?void 0:t.style,c={};if(!a)return c;for(const f in a)(xs(a[f])||i&&xs(i[f])||AO(f,e)||((u=r==null?void 0:r.getValue(f))==null?void 0:u.liveStyle)!==void 0)&&(c[f]=a[f]);return c}function jG(e){return window.getComputedStyle(e)}class SG extends EO{constructor(){super(...arguments),this.type="html",this.renderInstance=RO}mount(t){jx(!!t.style),super.mount(t)}readValueFromInstance(t,r){var a;if(Vu.has(r))return(a=this.projection)!=null&&a.isProjecting?r1(r):UH(t,r);{const i=jG(t),c=($3(r)?i.getPropertyValue(r):i[r])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(t,{transformPagePoint:r}){return yO(t,r)}build(t,r,a){vw(t,r,a.transformTemplate)}scrapeMotionValuesFromProps(t,r,a){return Nw(t,r,a)}}const MO=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"]),OO=e=>typeof e=="string"&&e.toLowerCase()==="svg";function NG(e,t,r,a){RO(e,t,void 0,a);for(const i in t.attrs)e.setAttribute(MO.has(i)?i:pw(i),t.attrs[i])}function DO(e,t,r){const a=Nw(e,t,r);for(const i in e)if(xs(e[i])||xs(t[i])){const c=Bu.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;a[c]=e[i]}return a}class CG extends EO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ps}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Vu.has(r)){const a=Z3(r);return a&&a.default||0}if(pO.includes(r)){const i=getComputedStyle(t)[r];if(typeof i=="string"&&i)return i.trim()}return r=MO.has(r)?r:pw(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,a){return DO(t,r,a)}build(t,r,a){gO(t,r,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,r,a,i){NG(t,r,a,i)}mount(t){this.isSVGTag=OO(t.tagName),super.mount(t)}}const kG=fg.length;function zO(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?zO(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<kG;r++){const a=fg[r],i=e.props[a];(kf(i)||i===!1)&&(t[a]=i)}return t}function IO(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 TG=[...jw].reverse(),EG=jw.length;function RG(e){return t=>Promise.all(t.map(({animation:r,options:a})=>MF(e,r,a)))}function AG(e){let t=RG(e),r=xT(),a=!0,i=!1;const c=h=>(g,p)=>{var v;const b=tc(e,p,h==="exit"?(v=e.presenceContext)==null?void 0:v.custom:void 0);if(b){const{transition:w,transitionEnd:C,...S}=b;g={...g,...S,...C}}return g};function u(h){t=h(e)}function f(h){const{props:g}=e,p=zO(e.parent)||{},b=[],v=new Set;let w={},C=1/0;for(let N=0;N<EG;N++){const E=TG[N],T=r[E],R=g[E]!==void 0?g[E]:p[E],M=kf(R),A=E===h?T.isActive:null;A===!1&&(C=N);let k=R===p[E]&&R!==g[E]&&M;if(k&&(a||i)&&e.manuallyAnimateOnMount&&(k=!1),T.protectedKeys={...w},!T.isActive&&A===null||!R&&!T.prevProp||Cx(R)||typeof R=="boolean")continue;if(E==="exit"&&T.isActive&&A!==!0){T.prevResolvedValues&&(w={...w,...T.prevResolvedValues});continue}const O=MG(T.prevProp,R);let D=O||E===h&&T.isActive&&!k&&M||N>C&&M,_=!1;const H=Array.isArray(R)?R:[R];let G=H.reduce(c(E),{});A===!1&&(G={});const{prevResolvedValues:B={}}=T,P={...B,...G},V=K=>{D=!0,v.has(K)&&(_=!0,v.delete(K)),T.needsAnimating[K]=!0;const J=e.getValue(K);J&&(J.liveStyle=!1)};for(const K in P){const J=G[K],z=B[K];if(w.hasOwnProperty(K))continue;let L=!1;d1(J)&&d1(z)?L=!IO(J,z)||O:L=J!==z,L?J!=null?V(K):v.add(K):J!==void 0&&v.has(K)?V(K):T.protectedKeys[K]=!0}T.prevProp=R,T.prevResolvedValues=G,T.isActive&&(w={...w,...G}),(a||i)&&e.blockInitialAnimation&&(D=!1);const q=k&&O;D&&(!q||_)&&b.push(...H.map(K=>{const J={type:E};if(typeof K=="string"&&(a||i)&&!q&&e.manuallyAnimateOnMount&&e.parent){const{parent:z}=e,L=tc(z,K);if(z.enteringChildren&&L){const{delayChildren:X}=L.transition||{};J.delay=lO(z.enteringChildren,e,X)}}return{animation:K,options:J}}))}if(v.size){const N={};if(typeof g.initial!="boolean"){const E=tc(e,Array.isArray(g.initial)?g.initial[0]:g.initial);E&&E.transition&&(N.transition=E.transition)}v.forEach(E=>{const T=e.getBaseTarget(E),R=e.getValue(E);R&&(R.liveStyle=!0),N[E]=T??null}),b.push({animation:N})}let S=!!b.length;return a&&(g.initial===!1||g.initial===g.animate)&&!e.manuallyAnimateOnMount&&(S=!1),a=!1,i=!1,S?t(b):Promise.resolve()}function m(h,g){var b;if(r[h].isActive===g)return Promise.resolve();(b=e.variantChildren)==null||b.forEach(v=>{var w;return(w=v.animationState)==null?void 0:w.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=xT(),i=!0}}}function MG(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!IO(t,e):!1}function Bl(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xT(){return{animate:Bl(!0),whileInView:Bl(),whileHover:Bl(),whileTap:Bl(),whileDrag:Bl(),whileFocus:Bl(),exit:Bl()}}function b1(e,t){e.min=t.min,e.max=t.max}function Ao(e,t){b1(e.x,t.x),b1(e.y,t.y)}function bT(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const PO=1e-4,OG=1-PO,DG=1+PO,_O=.01,zG=0-_O,IG=0+_O;function ar(e){return e.max-e.min}function PG(e,t,r){return Math.abs(e-t)<=r}function vT(e,t,r,a=.5){e.origin=a,e.originPoint=Tn(t.min,t.max,e.origin),e.scale=ar(r)/ar(t),e.translate=Tn(r.min,r.max,e.origin)-e.originPoint,(e.scale>=OG&&e.scale<=DG||isNaN(e.scale))&&(e.scale=1),(e.translate>=zG&&e.translate<=IG||isNaN(e.translate))&&(e.translate=0)}function af(e,t,r,a){vT(e.x,t.x,r.x,a?a.originX:void 0),vT(e.y,t.y,r.y,a?a.originY:void 0)}function yT(e,t,r,a=0){const i=a?Tn(r.min,r.max,a):r.min;e.min=i+t.min,e.max=e.min+ar(t)}function _G(e,t,r,a){yT(e.x,t.x,r.x,a==null?void 0:a.x),yT(e.y,t.y,r.y,a==null?void 0:a.y)}function wT(e,t,r,a=0){const i=a?Tn(r.min,r.max,a):r.min;e.min=t.min-i,e.max=e.min+ar(t)}function pg(e,t,r,a){wT(e.x,t.x,r.x,a==null?void 0:a.x),wT(e.y,t.y,r.y,a==null?void 0:a.y)}function jT(e,t,r,a,i){return e-=t,e=dg(e,1/r,a),i!==void 0&&(e=dg(e,1/i,a)),e}function LG(e,t=0,r=1,a=.5,i,c=e,u=e){if(aa.test(t)&&(t=parseFloat(t),t=Tn(u.min,u.max,t/100)-u.min),typeof t!="number")return;let f=Tn(c.min,c.max,a);e===c&&(f-=t),e.min=jT(e.min,t,r,f,i),e.max=jT(e.max,t,r,f,i)}function ST(e,t,[r,a,i],c,u){LG(e,t[r],t[a],t[i],t.scale,c,u)}const $G=["x","scaleX","originX"],BG=["y","scaleY","originY"];function NT(e,t,r,a){ST(e.x,t,$G,r?r.x:void 0,a?a.x:void 0),ST(e.y,t,BG,r?r.y:void 0,a?a.y:void 0)}function CT(e){return e.translate===0&&e.scale===1}function LO(e){return CT(e.x)&&CT(e.y)}function kT(e,t){return e.min===t.min&&e.max===t.max}function VG(e,t){return kT(e.x,t.x)&&kT(e.y,t.y)}function TT(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function $O(e,t){return TT(e.x,t.x)&&TT(e.y,t.y)}function ET(e){return ar(e.x)/ar(e.y)}function RT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function ea(e){return[e("x"),e("y")]}function UG(e,t,r){let a="";const i=e.x.translate/t.x,c=e.y.translate/t.y,u=(r==null?void 0:r.z)||0;if((i||c||u)&&(a=`translate3d(${i}px, ${c}px, ${u}px) `),(t.x!==1||t.y!==1)&&(a+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:h,rotate:g,pathRotation:p,rotateX:b,rotateY:v,skewX:w,skewY:C}=r;h&&(a=`perspective(${h}px) ${a}`),g&&(a+=`rotate(${g}deg) `),p&&(a+=`rotate(${p}deg) `),b&&(a+=`rotateX(${b}deg) `),v&&(a+=`rotateY(${v}deg) `),w&&(a+=`skewX(${w}deg) `),C&&(a+=`skewY(${C}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 HG=gw.length,AT=e=>typeof e=="string"?parseFloat(e):e,MT=e=>typeof e=="number"||pt.test(e);function FG(e,t,r,a,i,c){i?(e.opacity=Tn(0,r.opacity??1,GG(a)),e.opacityExit=Tn(t.opacity??1,0,qG(a))):c&&(e.opacity=Tn(t.opacity??1,r.opacity??1,a));for(let u=0;u<HG;u++){const f=gw[u];let m=OT(t,f),h=OT(r,f);if(m===void 0&&h===void 0)continue;m||(m=0),h||(h=0),m===0||h===0||MT(m)===MT(h)?(e[f]=Math.max(Tn(AT(m),AT(h),a),0),(aa.test(h)||aa.test(m))&&(e[f]+="%")):e[f]=h}(t.rotate||r.rotate)&&(e.rotate=Tn(t.rotate||0,r.rotate||0,a))}function OT(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const GG=BO(0,.5,z3),qG=BO(.5,.95,_o);function BO(e,t,r){return a=>a<e?0:a>t?1:r(Sf(e,t,a))}function YG(e,t,r){const a=xs(e)?e:ic(e);return a.start(hw("",a,t,r)),a.animation}function Tf(e,t,r,a={passive:!0}){return e.addEventListener(t,r,a),()=>e.removeEventListener(t,r,a)}const KG=(e,t)=>e.depth-t.depth;class XG{constructor(){this.children=[],this.isDirty=!1}add(t){W2(this.children,t),this.isDirty=!0}remove(t){og(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(KG),this.isDirty=!1,this.children.forEach(t)}}function WG(e,t){const r=As.now(),a=({timestamp:i})=>{const c=i-r;c>=t&&(pa(a),e(c-t))};return jn.setup(a,!0),()=>pa(a)}function Op(e){return xs(e)?e.get():e}class QG{constructor(){this.members=[]}add(t){W2(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 i=a.instance;(!i||i.isConnected===!1)&&!a.snapshot&&(og(this.members,a),a.unmount())}t.scheduleRender()}remove(t){if(og(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 i=this.members[a];if(i.isPresent!==!1&&((r=i.instance)==null?void 0:r.isConnected)!==!1)return this.promote(i),!0}return!1}promote(t,r){var i;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),(i=t.root)!=null&&i.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var r,a,i,c,u;(a=(r=t.options).onExitComplete)==null||a.call(r),(u=(i=t.resumingFrom)==null?void 0:(c=i.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 Dp={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Uv=["","X","Y","Z"],ZG=1e3;let JG=0;function Hv(e,t,r,a){const{latestValues:i}=t;i[e]&&(r[e]=i[e],t.setStaticValue(e,0),a&&(a[e]=0))}function VO(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=hO(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:c}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",jn,!(i||c))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&VO(a)}function UO({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:a,resetTransform:i}){return class{constructor(u={},f=t==null?void 0:t()){this.id=JG++,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(nq),this.nodes.forEach(lq),this.nodes.forEach(cq),this.nodes.forEach(sq)},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 XG)}addEventListener(u,f){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new ag),this.eventHandlers.get(u).add(f)}notifyListeners(u,...f){const m=this.eventHandlers.get(u);m&&m.notify(...f)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=xw(u)&&!fG(u),this.instance=u;const{layoutId:f,layout:m,visualElement:h}=this.options;if(h&&!h.current&&h.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||f)&&(this.isLayoutDirty=!0),e){let g,p=0;const b=()=>this.root.updateBlockedByResize=!1;jn.read(()=>{p=window.innerWidth}),e(u,()=>{const v=window.innerWidth;v!==p&&(p=v,this.root.updateBlockedByResize=!0,g&&g(),g=WG(b,250),Dp.hasAnimatedSinceResize&&(Dp.hasAnimatedSinceResize=!1,this.nodes.forEach(IT)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&h&&(f||m)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:p,hasRelativeLayoutChanged:b,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||h.getDefaultTransition()||mq,{onLayoutAnimationStart:C,onLayoutAnimationComplete:S}=h.getProps(),N=!this.targetLayout||!$O(this.targetLayout,v),E=!p&&b;if(this.options.layoutRoot||this.resumeFrom||E||p&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...fw(w,"layout"),onPlay:C,onComplete:S};(h.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(g,E,T.path)}else p||IT(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(),pa(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(uq),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&&VO(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(oq),this.nodes.forEach(DT);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(zT);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(aq),this.nodes.forEach(iq),this.nodes.forEach(eq),this.nodes.forEach(tq)):this.nodes.forEach(zT),this.clearAllSnapshots();const f=As.now();Es.delta=Bo(0,1e3/60,f-Es.timestamp),Es.timestamp=f,Es.isProcessing=!0,Dv.update.process(Es),Dv.preRender.process(Es),Dv.render.process(Es),Es.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,yw.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(rq),this.sharedNodes.forEach(dq)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,jn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){jn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!ar(this.snapshot.measuredBox.x)&&!ar(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=ps()),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(!i)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!LO(this.projectionDelta),m=this.getTransformTemplate(),h=m?m(this.latestValues,""):void 0,g=h!==this.prevTransformTemplateValue;u&&this.instance&&(f||Fl(this.latestValues)||g)&&(i(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)),pq(m),{animationId:this.root.animationId,measuredBox:f,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var h;const{visualElement:u}=this.options;if(!u)return ps();const f=u.measureViewportBox();if(!(((h=this.scroll)==null?void 0:h.wasRoot)||this.path.some(gq))){const{scroll:g}=this.root;g&&(sa(f.x,g.offset.x),sa(f.y,g.offset.y))}return f}removeElementScroll(u){var m;const f=ps();if(Ao(f,u),(m=this.scroll)!=null&&m.wasRoot)return f;for(let h=0;h<this.path.length;h++){const g=this.path[h],{scroll:p,options:b}=g;g!==this.root&&p&&b.layoutScroll&&(p.wasRoot&&Ao(f,u),sa(f.x,p.offset.x),sa(f.y,p.offset.y))}return f}applyTransform(u,f=!1,m){var g,p;const h=m||ps();Ao(h,u);for(let b=0;b<this.path.length;b++){const v=this.path[b];!f&&v.options.layoutScroll&&v.scroll&&v!==v.root&&(sa(h.x,-v.scroll.offset.x),sa(h.y,-v.scroll.offset.y)),Fl(v.latestValues)&&Ep(h,v.latestValues,(g=v.layout)==null?void 0:g.layoutBox)}return Fl(this.latestValues)&&Ep(h,this.latestValues,(p=this.layout)==null?void 0:p.layoutBox),h}removeTransform(u){var m;const f=ps();Ao(f,u);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!Fl(g.latestValues))continue;let p;g.instance&&(p1(g.latestValues)&&g.updateSnapshot(),p=ps(),Ao(p,g.measurePageBox())),NT(f,g.latestValues,(m=g.snapshot)==null?void 0:m.layoutBox,p)}return Fl(this.latestValues)&&NT(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!==Es.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=Es.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ps(),this.targetWithTransforms=ps()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),_G(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Ao(this.target,this.layout.layoutBox),vO(this.target,this.targetDelta)):Ao(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||p1(this.parent.latestValues)||bO(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=ps(),this.relativeTargetOrigin=ps(),pg(this.relativeTargetOrigin,f,m,this.options.layoutAnchor||void 0),Ao(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var w;const u=this.getLead(),f=!!this.resumingFrom||this!==u;let m=!0;if((this.isProjectionDirty||(w=this.parent)!=null&&w.isProjectionDirty)&&(m=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===Es.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;Ao(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,b=this.treeScale.y;YF(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=ps());const{target:v}=u;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(bT(this.prevProjectionDelta.x,this.projectionDelta.x),bT(this.prevProjectionDelta.y,this.projectionDelta.y)),af(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==b||!RT(this.projectionDelta.x,this.prevProjectionDelta.x)||!RT(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=fu(),this.projectionDelta=fu(),this.projectionDeltaWithTransform=fu()}setAnimationOrigin(u,f=!1,m){const h=this.snapshot,g=h?h.latestValues:{},p={...this.latestValues},b=fu();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const v=ps(),w=h?h.source:void 0,C=this.layout?this.layout.source:void 0,S=w!==C,N=this.getStack(),E=!N||N.members.length<=1,T=!!(S&&!E&&this.options.crossfade===!0&&!this.path.some(hq));this.animationProgress=0;let R;const M=m==null?void 0:m.interpolateProjection(u);this.mixTargetDelta=A=>{const k=A/1e3,O=M==null?void 0:M(k);O?(b.x.translate=O.x,b.x.scale=Tn(u.x.scale,1,k),b.x.origin=u.x.origin,b.x.originPoint=u.x.originPoint,b.y.translate=O.y,b.y.scale=Tn(u.y.scale,1,k),b.y.origin=u.y.origin,b.y.originPoint=u.y.originPoint):(PT(b.x,u.x,k),PT(b.y,u.y,k)),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(pg(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),fq(this.relativeTarget,this.relativeTargetOrigin,v,k),R&&VG(this.relativeTarget,R)&&(this.isProjectionDirty=!1),R||(R=ps()),Ao(R,this.relativeTarget)),S&&(this.animationValues=p,FG(p,g,this.latestValues,k,T,E)),O&&O.rotate!==void 0&&(this.animationValues||(this.animationValues=p),this.animationValues.pathRotation=O.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},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&&(pa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=jn.update(()=>{Dp.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ic(0)),this.motionValue.jump(0,!1),this.currentAnimation=YG(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()}}),MH(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(ZG),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&&HO(this.options.animationType,this.layout.layoutBox,m.layoutBox)){g=this.target||ps();const p=ar(this.layout.layoutBox.x);g.x.min=u.target.x.min,g.x.max=g.x.min+p;const b=ar(this.layout.layoutBox.y);g.y.min=u.target.y.min,g.y.max=g.y.min+b}Ao(f,g),Ep(f,h),af(this.projectionDeltaWithTransform,this.layoutCorrected,f,h)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new QG),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&&Hv("z",u,h,this.animationValues);for(let g=0;g<Uv.length;g++)Hv(`rotate${Uv[g]}`,u,h,this.animationValues),Hv(`skew${Uv[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=Op(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=Op(f==null?void 0:f.pointerEvents)||""),this.hasProjected&&!Fl(this.latestValues)&&(u.transform=m?m({},""):"none",this.hasProjected=!1);return}u.visibility="";const g=h.animationValues||h.latestValues;this.applyTransformsToTarget();let p=UG(this.projectionDeltaWithTransform,this.treeScale,g);m&&(p=m(g,p)),u.transform=p;const{x:b,y:v}=this.projectionDelta;u.transformOrigin=`${b.origin*100}% ${v.origin*100}% 0`,h.animationValues?u.opacity=h===this?g.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:g.opacityExit:u.opacity=h===this?g.opacity!==void 0?g.opacity:"":g.opacityExit!==void 0?g.opacityExit:0;for(const w in x1){if(g[w]===void 0)continue;const{correct:C,applyTo:S,isCSSVariable:N}=x1[w],E=p==="none"?g[w]:C(g[w],h);if(S){const T=S.length;for(let R=0;R<T;R++)u[S[R]]=E}else N?this.options.visualElement.renderState.vars[w]=E:u[w]=E}this.options.layoutId&&(u.pointerEvents=h===this?Op(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(DT),this.root.sharedNodes.clear()}}}function eq(e){e.updateLayout()}function tq(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:i}=e.layout,{animationType:c}=e.options,u=t.source!==e.layout.source;if(c==="size")ea(p=>{const b=u?t.measuredBox[p]:t.layoutBox[p],v=ar(b);b.min=a[p].min,b.max=b.min+v});else if(c==="x"||c==="y"){const p=c==="x"?"y":"x";b1(u?t.measuredBox[p]:t.layoutBox[p],a[p])}else HO(c,t.layoutBox,a)&&ea(p=>{const b=u?t.measuredBox[p]:t.layoutBox[p],v=ar(a[p]);b.max=b.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+v)});const f=fu();af(f,a,t.layoutBox);const m=fu();u?af(m,e.applyTransform(i,!0),t.measuredBox):af(m,a,t.layoutBox);const h=!LO(f);let g=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:b,layout:v}=p;if(b&&v){const w=e.options.layoutAnchor||void 0,C=ps();pg(C,t.layoutBox,b.layoutBox,w);const S=ps();pg(S,a,v.layoutBox,w),$O(C,S)||(g=!0),p.options.layoutRoot&&(e.relativeTarget=S,e.relativeTargetOrigin=C,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 nq(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 sq(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function rq(e){e.clearSnapshot()}function DT(e){e.clearMeasurements()}function oq(e){e.isLayoutDirty=!0,e.updateLayout()}function zT(e){e.isLayoutDirty=!1}function aq(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function iq(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function IT(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function lq(e){e.resolveTargetDelta()}function cq(e){e.calcProjection()}function uq(e){e.resetSkewAndRotation()}function dq(e){e.removeLeadSnapshot()}function PT(e,t,r){e.translate=Tn(t.translate,0,r),e.scale=Tn(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function _T(e,t,r,a){e.min=Tn(t.min,r.min,a),e.max=Tn(t.max,r.max,a)}function fq(e,t,r,a){_T(e.x,t.x,r.x,a),_T(e.y,t.y,r.y,a)}function hq(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const mq={duration:.45,ease:[.4,0,.1,1]},LT=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),$T=LT("applewebkit/")&&!LT("chrome/")?Math.round:_o;function BT(e){e.min=$T(e.min),e.max=$T(e.max)}function pq(e){BT(e.x),BT(e.y)}function HO(e,t,r){return e==="position"||e==="preserve-aspect"&&!PG(ET(t),ET(r),.2)}function gq(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const xq=UO({attachResizeListener:(e,t)=>Tf(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}),Fv={current:void 0},FO=UO({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Fv.current){const e=new xq({});e.mount(window),e.setOptions({layoutScroll:!0}),Fv.current=e}return Fv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),lh=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function VT(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function bq(...e){return t=>{let r=!1;const a=e.map(i=>{const c=VT(i,t);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let i=0;i<a.length;i++){const c=a[i];typeof c=="function"?c():VT(e[i],null)}}}}function vq(...e){return x.useCallback(bq(...e),e)}class yq extends x.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(Tp(r)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=r.offsetParent,i=Tp(a)&&a.offsetWidth||0,c=Tp(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=i-f.width-f.left,f.bottom=c-f.height-f.top,f.direction=u.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function wq({children:e,isPresent:t,anchorX:r,anchorY:a,root:i,pop:c}){var b;const u=x.useId(),f=x.useRef(null),m=x.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:h}=x.useContext(lh),g=c!==!1?((b=e.props)==null?void 0:b.ref)??(e==null?void 0:e.ref):void 0,p=vq(f,g);return x.useInsertionEffect(()=>{const{width:v,height:w,top:C,left:S,right:N,bottom:E,direction:T}=m.current;if(t||c===!1||!f.current||!v||!w)return;const R=T==="rtl",M=r==="left"?R?`right: ${N}`:`left: ${S}`:R?`left: ${S}`:`right: ${N}`,A=a==="bottom"?`bottom: ${E}`:`top: ${C}`;f.current.dataset.motionPopId=u;const k=document.createElement("style");h&&(k.nonce=h);const O=i??document.head;return O.appendChild(k),k.sheet&&k.sheet.insertRule(`
502
+ [data-motion-pop-id="${u}"] {
503
+ position: absolute !important;
504
+ width: ${v}px !important;
505
+ height: ${w}px !important;
506
+ ${M}px !important;
507
+ ${A}px !important;
508
+ }
509
+ `),()=>{var D;(D=f.current)==null||D.removeAttribute("data-motion-pop-id"),O.contains(k)&&O.removeChild(k)}},[t]),n.jsx(yq,{isPresent:t,childRef:f,sizeRef:m,pop:c,children:c===!1?e:x.cloneElement(e,{ref:p})})}const jq=({children:e,initial:t,isPresent:r,onExitComplete:a,custom:i,presenceAffectsLayout:c,mode:u,anchorX:f,anchorY:m,root:h})=>{const g=rh(Sq),p=x.useId(),b=x.useRef(r),v=x.useRef(a);Au(()=>{b.current=r,v.current=a});let w=!0,C=x.useMemo(()=>(w=!1,{id:p,initial:t,isPresent:r,custom:i,onExitComplete:S=>{g.set(S,!0);for(const N of g.values())if(!N)return;a&&a()},register:S=>(g.set(S,!1),()=>{var N;g.delete(S),!b.current&&!g.size&&((N=v.current)==null||N.call(v))})}),[r,g,a]);return c&&w&&(C={...C}),x.useMemo(()=>{g.forEach((S,N)=>g.set(N,!1))},[r]),x.useEffect(()=>{!r&&!g.size&&a&&a()},[r]),e=n.jsx(wq,{pop:u==="popLayout",isPresent:r,anchorX:f,anchorY:m,root:h,children:e}),n.jsx(wx.Provider,{value:C,children:e})};function Sq(){return new Map}function GO(e=!0){const t=x.useContext(wx);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:a,register:i}=t,c=x.useId();x.useEffect(()=>{if(e)return i(c)},[e]);const u=x.useCallback(()=>e&&a&&a(c),[c,a,e]);return!r&&a?[!1,u]:[!0]}const Wm=e=>e.key||"";function UT(e){const t=[];return x.Children.forEach(e,r=>{x.isValidElement(r)&&t.push(r)}),t}const lc=({children:e,custom:t,initial:r=!0,onExitComplete:a,presenceAffectsLayout:i=!0,mode:c="sync",propagate:u=!1,anchorX:f="left",anchorY:m="top",root:h})=>{const[g,p]=GO(u),b=x.useMemo(()=>UT(e),[e]),v=u&&!g?[]:b.map(Wm),w=x.useRef(!0),C=x.useRef(b),S=rh(()=>new Map),N=x.useRef(new Set),[E,T]=x.useState(b),[R,M]=x.useState(b);Au(()=>{u&&!g&&!R.length&&(p==null||p())},[g,u,R.length,p]),Au(()=>{w.current=!1,C.current=b;for(let O=0;O<R.length;O++){const D=Wm(R[O]);v.includes(D)?(S.delete(D),N.current.delete(D)):S.get(D)!==!0&&S.set(D,!1)}},[R,v.length,v.join("-")]);const A=[];if(b!==E){let O=[...b],D=0;for(const _ of R){const H=v.indexOf(Wm(_));H===-1?(O.splice(D++,0,_),A.push(_)):D=H+A.length+1}return c==="wait"&&A.length&&(O=A),M(UT(O)),T(b),null}const{forceRender:k}=x.useContext(X2);return n.jsx(n.Fragment,{children:R.map(O=>{const D=Wm(O),_=u&&!g?!1:b===R||v.includes(D),H=()=>{if(N.current.has(D))return;if(S.has(D))N.current.add(D),S.set(D,!0);else return;let G=!0;S.forEach(B=>{B||(G=!1)}),G&&(k==null||k(),M(C.current),u&&(p==null||p()),a&&a())};return n.jsx(jq,{isPresent:_,initial:!w.current||r?void 0:!1,custom:t,presenceAffectsLayout:i,mode:c,root:h,onExitComplete:_?void 0:H,anchorX:f,anchorY:m,children:O},D)})})},qO=x.createContext({strict:!1}),HT={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 FT=!1;function Nq(){if(FT)return;const e={};for(const t in HT)e[t]={isEnabled:r=>HT[t].some(a=>!!r[a])};TO(e),FT=!0}function YO(){return Nq(),vG()}function Cq(e){const t=YO();for(const r in e)t[r]={...t[r],...e[r]};TO(t)}const Tx=x.createContext({});function kq(e,t){if(kx(e)){const{initial:r,animate:a}=e;return{initial:r===!1||kf(r)?r:void 0,animate:kf(a)?a:void 0}}return e.inherit!==!1?t:{}}function Tq(e){const{initial:t,animate:r}=kq(e,x.useContext(Tx));return x.useMemo(()=>({initial:t,animate:r}),[GT(t),GT(r)])}function GT(e){return Array.isArray(e)?e.join(" "):e}const Cw=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function KO(e,t,r){for(const a in t)!xs(t[a])&&!AO(a,r)&&(e[a]=t[a])}function Eq({transformTemplate:e},t){return x.useMemo(()=>{const r=Cw();return vw(r,t,e),Object.assign({},r.vars,r.style)},[t])}function Rq(e,t){const r=e.style||{},a={};return KO(a,r,e),Object.assign(a,Eq(e,t)),a}function Aq(e,t){const r={},a=Rq(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 XO=()=>({...Cw(),attrs:{}});function Mq(e,t,r,a){const i=x.useMemo(()=>{const c=XO();return gO(c,t,OO(a),e.transformTemplate,e.style),{...c.attrs,style:{...c.style}}},[t]);if(e.style){const c={};KO(c,e.style,e),i.style={...c,...i.style}}return i}const Oq=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 gg(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Oq.has(e)}function Dq(e,t){return e.startsWith("on")?!gg(e):(t==null?void 0:t(e))??!gg(e)}function zq(e,t,r,a){const i={};for(const c in e)c==="values"&&typeof e.values=="object"||xs(e[c])||(Dq(c,a)||r===!0&&gg(c)||!t&&!gg(c)||e.draggable&&c.startsWith("onDrag"))&&(i[c]=e[c]);return i}const Iq=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function kw(e){return typeof e!="string"||e.includes("-")?!1:!!(Iq.indexOf(e)>-1||/[A-Z]/u.test(e))}function Pq(e,t,r,{latestValues:a},i,c=!1,u,f){const h=(u??kw(e)?Mq:Aq)(t,a,i,e),g=zq(t,typeof e=="string",c,f),p=e!==x.Fragment?{...g,...h,ref:r}:{},{children:b}=t,v=x.useMemo(()=>xs(b)?b.get():b,[b]);return x.createElement(e,{...p,children:v})}function _q({scrapeMotionValuesFromProps:e,createRenderState:t},r,a,i){return{latestValues:Lq(r,a,i,e),renderState:t()}}function Lq(e,t,r,a){const i={},c=a(e,{});for(const b in c)i[b]=Op(c[b]);let{initial:u,animate:f}=e;const m=kx(e),h=CO(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"&&!Cx(p)){const b=Array.isArray(p)?p:[p];for(let v=0;v<b.length;v++){const w=mw(e,b[v]);if(w){const{transitionEnd:C,transition:S,...N}=w;for(const E in N){let T=N[E];if(Array.isArray(T)){const R=g?T.length-1:0;T=T[R]}T!==null&&(i[E]=T)}for(const E in C)i[E]=C[E]}}}return i}const WO=e=>(t,r)=>{const a=x.useContext(Tx),i=x.useContext(wx),c=()=>_q(e,t,a,i);return r?c():rh(c)},$q=WO({scrapeMotionValuesFromProps:Nw,createRenderState:Cw}),Bq=WO({scrapeMotionValuesFromProps:DO,createRenderState:XO}),Vq=Symbol.for("motionComponentSymbol");function Uq(e,t,r){const a=x.useRef(r);x.useInsertionEffect(()=>{a.current=r});const i=x.useRef(null);return x.useCallback(c=>{var f;c&&((f=e.onMount)==null||f.call(e,c)),t&&(c?t.mount(c):t.unmount());const u=a.current;if(typeof u=="function")if(c){const m=u(c);typeof m=="function"&&(i.current=m)}else i.current?(i.current(),i.current=null):u(c);else u&&(u.current=c)},[t])}const QO=x.createContext({});function lu(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Hq(e,t,r,a,i,c){var T,R;const{visualElement:u}=x.useContext(Tx),f=x.useContext(qO),m=x.useContext(wx),h=x.useContext(lh),g=h.reducedMotion,p=h.skipAnimations,b=x.useRef(null),v=x.useRef(!1);a=a||f.renderer,!b.current&&a&&(b.current=a(e,{visualState:t,parent:u,props:r,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:g,skipAnimations:p,isSVG:c}),v.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const w=b.current,C=x.useContext(QO);w&&!w.projection&&i&&(w.type==="html"||w.type==="svg")&&Fq(b.current,r,i,C);const S=x.useRef(!1);x.useInsertionEffect(()=>{w&&S.current&&w.update(r,m)});const N=r[fO],E=x.useRef(!!N&&typeof window<"u"&&!((T=window.MotionHandoffIsComplete)!=null&&T.call(window,N))&&((R=window.MotionHasOptimisedAnimation)==null?void 0:R.call(window,N)));return Au(()=>{var M;!v.current||!w||((M=w.animationState)==null||M.animateChanges(),w.enteringChildren=void 0)},[]),Au(()=>{v.current=!0,w&&(S.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),E.current&&w.animationState&&w.animationState.animateChanges())}),x.useEffect(()=>{w&&(!E.current&&w.animationState&&w.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{var M;(M=window.MotionHandoffMarkAsComplete)==null||M.call(window,N)}),E.current=!1),w.enteringChildren=void 0)}),w}function Fq(e,t,r,a){const{layoutId:i,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:ZO(e.parent)),e.projection.setOptions({layoutId:i,layout:c,alwaysMeasureLayout:!!u||f&&lu(f),visualElement:e,animationType:typeof c=="string"?c:"both",initialPromotionConfig:a,crossfade:p,layoutScroll:m,layoutRoot:h,layoutAnchor:g})}function ZO(e){if(e)return e.options.allowProjection!==!1?e.projection:ZO(e.parent)}function Gv(e,{forwardMotionProps:t=!1,type:r}={},a,i){a&&Cq(a);const c=r?r==="svg":kw(e),u=c?Bq:$q;function f(h,g){let p;const b={...x.useContext(lh),...h,layoutId:Gq(h)},{isStatic:v,isValidProp:w}=b,C=Tq(h),S=u(h,v);if(!v&&typeof window<"u"){qq();const N=Yq(b);p=N.MeasureLayout,C.visualElement=Hq(e,S,b,i,N.ProjectionNode,c)}return n.jsxs(Tx.Provider,{value:C,children:[p&&C.visualElement?n.jsx(p,{visualElement:C.visualElement,...b}):null,Pq(e,h,Uq(S,C.visualElement,g),S,v,t,c,w)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=x.forwardRef(f);return m[Vq]=e,m}function Gq({layoutId:e}){const t=x.useContext(X2).id;return t&&e!==void 0?t+"-"+e:e}function qq(e,t){x.useContext(qO).strict}function Yq(e){const t=YO(),{drag:r,layout:a}=t;if(!r&&!a)return{};const i={...r,...a};return{MeasureLayout:r!=null&&r.isEnabled(e)||a!=null&&a.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function Kq(e,t){if(typeof Proxy>"u")return Gv;const r=new Map,a=(c,u)=>Gv(c,u,e,t),i=(c,u)=>a(c,u);return new Proxy(i,{get:(c,u)=>u==="create"?a:(r.has(u)||r.set(u,Gv(u,void 0,e,t)),r.get(u))})}const Xq=(e,t)=>t.isSVG??kw(e)?new CG(t):new SG(t,{allowProjection:e!==x.Fragment});class Wq extends il{constructor(t){super(t),t.animationState||(t.animationState=AG(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Cx(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 Qq=0;class Zq extends il{constructor(){super(...arguments),this.id=Qq++,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=tc(this.node,u,f);if(m){const{transition:h,transitionEnd:g,...p}=m;for(const b in p)(c=this.node.getValue(b))==null||c.jump(p[b])}}this.node.blockInitialAnimation=!1,this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1,this.exitAnimation=void 0;return}const i=this.exitAnimation=this.node.animationState.setActive("exit",!t);r&&!t&&i.then(()=>{this.exitAnimation===i&&(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 Jq={animation:{Feature:Wq},exit:{Feature:Zq}};function Ex(e){return{point:{x:e.pageX,y:e.pageY}}}const eY=e=>t=>ww(t)&&e(t,Ex(t));function lf(e,t,r,a){return Tf(e,t,eY(r),a)}const JO=({current:e})=>e?e.ownerDocument.defaultView:null,qT=(e,t)=>Math.abs(e-t);function tY(e,t){const r=qT(e.x,t.x),a=qT(e.y,t.y);return Math.sqrt(r**2+a**2)}const YT=new Set(["auto","scroll"]);class e4{constructor(t,r,{transformPagePoint:a,contextWindow:i=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=w=>{this.handleScroll(w.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Qm(this.lastRawMoveEventInfo,this.transformPagePoint));const w=qv(this.lastMoveEventInfo,this.history),C=this.startEvent!==null,S=tY(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!C&&!S)return;const{point:N}=w;this.history.push({...N,timestamp:As.now()});const{onStart:E,onMove:T}=this.handlers;C||(E&&E(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,w)},this.handlePointerMove=(w,C)=>{this.lastMoveEvent=w,this.lastRawMoveEventInfo=C,this.lastMoveEventInfo=Qm(C,this.transformPagePoint),this.hasPendingMove=!0,jn.update(this.updatePoint,!0)},this.handlePointerUp=(w,C)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:S,onSessionEnd:N,resumeAnimation:E}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=qv(w.type==="pointercancel"?this.lastMoveEventInfo:Qm(C,this.transformPagePoint),this.history);this.startEvent&&S&&S(w,T),N&&N(w,T)},!ww(t))return;this.dragSnapToOrigin=c,this.handlers=r,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=i||window;const m=Ex(t),h=Qm(m,this.transformPagePoint),{point:g}=h,{timestamp:p}=Es;this.history=[{...g,timestamp:p}];const{onSessionStart:b}=r;b&&b(t,qv(h,this.history));const v={passive:!0,capture:!0};this.removeListeners=oh(lf(this.contextWindow,"pointermove",this.handlePointerMove,v),lf(this.contextWindow,"pointerup",this.handlePointerUp,v),lf(this.contextWindow,"pointercancel",this.handlePointerUp,v)),f&&this.startScrollTracking(f)}startScrollTracking(t){let r=t.parentElement;for(;r;){const a=getComputedStyle(r);(YT.has(a.overflowX)||YT.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,i=a?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},c={x:i.x-r.x,y:i.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,i),jn.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),pa(this.updatePoint)}}function Qm(e,t){return t?{point:t(e.point)}:e}function KT(e,t){return{x:e.x-t.x,y:e.y-t.y}}function qv({point:e},t){return{point:e,delta:KT(e,t4(t)),offset:KT(e,nY(t)),velocity:sY(t,.1)}}function nY(e){return e[0]}function t4(e){return e[e.length-1]}function sY(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,a=null;const i=t4(e);for(;r>=0&&(a=e[r],!(i.timestamp-a.timestamp>fo(t)));)r--;if(!a)return{x:0,y:0};a===e[0]&&e.length>2&&i.timestamp-a.timestamp>fo(t)*2&&(a=e[1]);const c=_r(i.timestamp-a.timestamp);if(c===0)return{x:0,y:0};const u={x:(i.x-a.x)/c,y:(i.y-a.y)/c};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function rY(e,{min:t,max:r},a){return t!==void 0&&e<t?e=a?Tn(t,e,a.min):Math.max(e,t):r!==void 0&&e>r&&(e=a?Tn(r,e,a.max):Math.min(e,r)),e}function XT(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 oY(e,{top:t,left:r,bottom:a,right:i}){return{x:XT(e.x,r,i),y:XT(e.y,t,a)}}function WT(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 aY(e,t){return{x:WT(e.x,t.x),y:WT(e.y,t.y)}}function iY(e,t){let r=.5;const a=ar(e),i=ar(t);return i>a?r=Sf(t.min,t.max-a,e.min):a>i&&(r=Sf(e.min,e.max-i,t.min)),Bo(0,1,r)}function lY(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 v1=.35;function cY(e=v1){return e===!1?e=0:e===!0&&(e=v1),{x:QT(e,"left","right"),y:QT(e,"top","bottom")}}function QT(e,t,r){return{min:ZT(e,t),max:ZT(e,r)}}function ZT(e,t){return typeof e=="number"?e:e[t]||0}const uY=new WeakMap;class dY{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=ps(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:r=!1,distanceThreshold:a}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const c=p=>{r&&this.snapToCursor(p),this.stopAnimation()},u=(p,b)=>{const{drag:v,dragPropagation:w,onDragStart:C}=this.getProps();if(v&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=XF(v),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ea(N=>{let E=this.getAxisMotionValue(N).get()||0;if(aa.test(E)){const{projection:T}=this.visualElement;if(T&&T.layout){const R=T.layout.layoutBox[N];R&&(E=ar(R)*(parseFloat(E)/100))}}this.originPoint[N]=E}),C&&jn.update(()=>C(p,b),!1,!0),f1(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},f=(p,b)=>{this.latestPointerEvent=p,this.latestPanInfo=b;const{dragPropagation:v,dragDirectionLock:w,onDirectionLock:C,onDrag:S}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:N}=b;if(w&&this.currentDirection===null){this.currentDirection=hY(N),this.currentDirection!==null&&C&&C(this.currentDirection);return}this.updateAxis("x",b.point,N),this.updateAxis("y",b.point,N),this.visualElement.render(),S&&jn.update(()=>S(p,b),!1,!0)},m=(p,b)=>{this.latestPointerEvent=p,this.latestPanInfo=b,this.stop(p,b),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:p}=this.getProps();(p||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:g}=this.getProps();this.panSession=new e4(t,{onSessionStart:c,onStart:u,onMove:f,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:a,contextWindow:JO(this.visualElement),element:this.visualElement.current})}stop(t,r){const a=t||this.latestPointerEvent,i=r||this.latestPanInfo,c=this.isDragging;if(this.cancel(),!c||!i||!a)return;const{velocity:u}=i;this.startAnimation(u);const{onDragEnd:f}=this.getProps();f&&jn.postRender(()=>f(a,i))}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:i}=this.getProps();if(!a||!Zm(t,i,this.currentDirection))return;const c=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=rY(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,i=this.constraints;t&&lu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&a?this.constraints=oY(a.layoutBox,t):this.constraints=!1,this.elastic=cY(r),i!==this.constraints&&!lu(t)&&a&&this.constraints&&!this.hasMutatedConstraints&&ea(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=lY(a.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!lu(t))return!1;const a=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;i.root&&(i.root.scroll=void 0,i.root.updateScroll());const c=KF(a,i.root,this.visualElement.getTransformPagePoint());let u=aY(i.layout.layoutBox,c);if(r){const f=r(GF(u));this.hasMutatedConstraints=!!f,f&&(u=xO(f))}return u}startAnimation(t){const{drag:r,dragMomentum:a,dragElastic:i,dragTransition:c,dragSnapToOrigin:u,onDragTransitionEnd:f}=this.getProps(),m=this.constraints||{},h=ea(g=>{if(!Zm(g,r,this.currentDirection))return;let p=m&&m[g]||{};(u===!0||u===g)&&(p={min:0,max:0});const b=i?200:1e6,v=i?40:1e7,w={type:"inertia",velocity:a?t[g]:0,bounceStiffness:b,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...c,...p};return this.startAxisValueAnimation(g,w)});return Promise.all(h).then(f)}startAxisValueAnimation(t,r){const a=this.getAxisMotionValue(t);return f1(this.visualElement,t),a.start(hw(t,a,0,r,this.visualElement,!1))}stopAnimation(){ea(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps()[r];return i||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor({clientX:t,clientY:r}){var f;const{drag:a}=this.getProps(),i={x:t,y:r},c=((f=this.visualElement.getTransformPagePoint())==null?void 0:f(i))||i,u=this.visualElement.measureViewportBox();ea(m=>{if(!Zm(m,a,this.currentDirection))return;const h=this.getAxisMotionValue(m),{min:g,max:p}=u[m];h.set((h.get()||0)+c[m]-Tn(g,p,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:a}=this.visualElement;if(!lu(r)||!a||!this.constraints)return;this.stopAnimation();const i=this.constraints,c={x:0,y:0};ea(f=>{const m=this.getAxisMotionValue(f).get();c[f]=iY({min:m,max:m},i[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(),ea(f=>{const m=this.getAxisMotionValue(f);if(!Zm(f,t,null)||!m.get())return;const{min:h,max:g}=this.constraints[f];m.set(Tn(h,g,c[f]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;uY.set(this.visualElement,this);const t=this.visualElement.current,r=lf(t,"pointerdown",h=>{const{drag:g,dragListener:p=!0}=this.getProps(),b=h.target,v=b!==t&&tG(b);g&&p&&!v&&this.start(h)});let a;const i=()=>{const{dragConstraints:h}=this.getProps();lu(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(a=fY(t,h.current,()=>this.scalePositionWithinConstraints())))},{projection:c}=this.visualElement,u=c.addEventListener("measure",i);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),jn.read(i);const f=Tf(window,"resize",()=>this.scalePositionWithinConstraints()),m=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(ea(p=>{const b=this.getAxisMotionValue(p);b&&(this.originPoint[p]+=h[p].translate,b.set(b.get()+h[p].translate))}),this.visualElement.render())}));return()=>{f(),r(),u(),m&&m(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:a=!1,dragPropagation:i=!1,dragConstraints:c=!1,dragElastic:u=v1,dragMomentum:f=!0}=t;return{...t,drag:r,dragDirectionLock:a,dragPropagation:i,dragConstraints:c,dragElastic:u,dragMomentum:f}}}function JT(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function fY(e,t,r){const a=cT(e,JT(r)),i=cT(t,JT(r));return()=>{a(),i()}}function Zm(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function hY(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class mY extends il{constructor(t){super(t),this.removeGroupControls=_o,this.removeListeners=_o,this.controls=new dY(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||_o}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 Yv=e=>(t,r)=>{e&&jn.update(()=>e(t,r),!1,!0)};class pY extends il{constructor(){super(...arguments),this.removePointerDownListener=_o}onPointerDown(t){this.session=new e4(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JO(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:a,onPanEnd:i}=this.node.getProps();return{onSessionStart:Yv(t),onStart:Yv(r),onMove:Yv(a),onEnd:(c,u)=>{delete this.session,i&&jn.postRender(()=>i(c,u))}}}mount(){this.removePointerDownListener=lf(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 Kv=!1;class gY extends x.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:a,layoutId:i}=this.props,{projection:c}=t;c&&(r.group&&r.group.add(c),a&&a.register&&i&&a.register(c),Kv&&c.root.didUpdate(),c.addEventListener("animationComplete",()=>{this.safeToRemove()}),c.setOptions({...c.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Dp.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:a,drag:i,isPresent:c}=this.props,{projection:u}=a;return u&&(u.isPresent=c,t.layoutDependency!==r&&u.setOptions({...u.options,layoutDependency:r}),Kv=!0,i||t.layoutDependency!==r||r===void 0||t.isPresent!==c?u.willUpdate():this.safeToRemove(),t.isPresent!==c&&(c?u.promote():u.relegate()||jn.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(),yw.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:a}=this.props,{projection:i}=t;Kv=!0,i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),a&&a.deregister&&a.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function n4(e){const[t,r]=GO(),a=x.useContext(X2);return n.jsx(gY,{...e,layoutGroup:a,switchLayoutGroup:x.useContext(QO),isPresent:t,safeToRemove:r})}const xY={pan:{Feature:pY},drag:{Feature:mY,ProjectionNode:FO,MeasureLayout:n4}};function eE(e,t,r){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",r==="Start");const i="onHover"+r,c=a[i];c&&jn.postRender(()=>c(t,Ex(t)))}class bY extends il{mount(){const{current:t}=this.node;t&&(this.unmount=QF(t,(r,a)=>(eE(this.node,a,"Start"),i=>eE(this.node,i,"End"))))}unmount(){}}class vY extends il{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=oh(Tf(this.node.current,"focus",()=>this.onFocus()),Tf(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function tE(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 i="onTap"+(r==="End"?"":r),c=a[i];c&&jn.postRender(()=>c(t,Ex(t)))}class yY extends il{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:r,propagate:a}=this.node.props;this.unmount=sG(t,(i,c)=>(tE(this.node,c,"Start"),(u,{success:f})=>tE(this.node,u,f?"End":"Cancel")),{useGlobalTarget:r,stopPropagation:(a==null?void 0:a.tap)===!1})}unmount(){}}const y1=new WeakMap,Xv=new WeakMap,wY=e=>{const t=y1.get(e.target);t&&t(e)},jY=e=>{e.forEach(wY)};function SY({root:e,...t}){const r=e||document;Xv.has(r)||Xv.set(r,{});const a=Xv.get(r),i=JSON.stringify(t);return a[i]||(a[i]=new IntersectionObserver(jY,{root:e,...t})),a[i]}function NY(e,t,r){const a=SY(t);return y1.set(e,r),a.observe(e),()=>{y1.delete(e),a.unobserve(e)}}const CY={some:0,all:1};class kY extends il{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:i="some",once:c}=t,u={root:r?r.current:void 0,rootMargin:a,threshold:typeof i=="number"?i:CY[i]},f=h=>{const{isIntersecting:g}=h;if(this.isInView===g||(this.isInView=g,c&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:p,onViewportLeave:b}=this.node.getProps(),v=g?p:b;v&&v(h)};this.stopObserver=NY(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(TY(t,r))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function TY({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const EY={inView:{Feature:kY},tap:{Feature:yY},focus:{Feature:vY},hover:{Feature:bY}},RY={layout:{ProjectionNode:FO,MeasureLayout:n4}},AY={...Jq,...EY,...xY,...RY},MY=Kq(AY,Xq);function Tw(e){const t=rh(()=>ic(e)),{isStatic:r}=x.useContext(lh);if(r){const[,a]=x.useState(e);x.useEffect(()=>t.on("change",a),[])}return t}function s4(e,t){const r=Tw(t()),a=()=>r.set(t());return a(),Au(()=>{const i=()=>jn.preRender(a,!1,!0),c=e.map(u=>u.on("change",i));return()=>{c.forEach(u=>u()),pa(a)}}),r}function OY(e){of.current=[],e();const t=s4(of.current,e);return of.current=void 0,t}function DY(e,t,r,a){if(typeof e=="function")return OY(e);const c=hG(t,r,a),u=Array.isArray(e)?nE(e,c):nE([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 nE(e,t){const r=rh(()=>[]);return s4(e,()=>{r.length=0;const a=e.length;for(let i=0;i<a;i++)r[i]=e[i].get();return t(r)})}function zY(e,t={}){const{isStatic:r}=x.useContext(lh),a=()=>xs(e)?e.get():e;if(r)return DY(a);const i=Tw(a());return x.useInsertionEffect(()=>pG(i,e,t),[i,JSON.stringify(t)]),i}function IY(e,t={}){return zY(e,{type:"spring",...t})}function Zs(){!Sw.current&&kO();const[e]=x.useState(hg.current);return e}const PY={some:0,all:1};function _Y(e,t,{root:r,margin:a,amount:i="some"}={}){const c=bw(e),u=new WeakMap,f=h=>{h.forEach(g=>{const p=u.get(g.target);if(g.isIntersecting!==!!p)if(g.isIntersecting){const b=t(g.target,g);typeof b=="function"?u.set(g.target,b):m.unobserve(g.target)}else typeof p=="function"&&(p(g),u.delete(g.target))})},m=new IntersectionObserver(f,{root:r,rootMargin:a,threshold:typeof i=="number"?i:PY[i]});return c.forEach(h=>m.observe(h)),()=>m.disconnect()}function r4(e,{root:t,margin:r,amount:a,once:i=!1,initial:c=!1}={}){const[u,f]=x.useState(c);return x.useEffect(()=>{if(!e.current||i&&u)return;const m=()=>(f(!0),i?void 0:()=>f(!1)),h={root:t&&t.current||void 0,margin:r,amount:a};return _Y(e.current,m,h)},[t,e,r,i,a]),u}const $n=MY,sE=e=>typeof e=="function"?void 0:e.filter;function ho({children:e,className:t,variant:r,duration:a=.4,delay:i=0,offset:c=6,direction:u="down",inView:f=!1,inViewMargin:m="-50px",blur:h="6px",...g}){const p=x.useRef(null),b=r4(p,{once:!0,margin:m}),v=!f||b,w=Zs(),C={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)"}},S=r??C,N=sE(S.hidden),E=sE(S.visible),T=N!=null&&E!=null&&N!==E;return n.jsx(lc,{children:n.jsx($n.div,{ref:p,initial:w?!1:"hidden",animate:v?"visible":"hidden",exit:"hidden",variants:S,transition:{delay:.04+i,duration:w?0:a,ease:"easeOut",...T?{filter:{duration:a}}:{}},className:t,...g,children:e})})}const Rx=[{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 o4(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):[],i=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:i&&i!=="agent"?[i]:[]).flatMap(p=>{var v,w;const b=Rx.find(C=>{var S;return C.name.toLowerCase()===p.toLowerCase()||C.commands.includes(p.toLowerCase())||((S=C.aliases)==null?void 0:S.some(N=>N.toLowerCase()===p.toLowerCase()))});return b?[{resources:(w=(v=e==null?void 0:e.agentInventory)==null?void 0:v.resources)==null?void 0:w[b.name],name:b.name,logo:`/logos/agents/${b.logo}.svg`}]:u?[{name:p,logo:null}]:[]});return m.filter((p,b)=>m.findIndex(v=>v.name.toLowerCase()===p.name.toLowerCase())===b)}function Wv(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 LY=`
510
+ ## OpenShell website access
511
+
512
+ Network access is restricted per destination, not globally offline. A denied website or hosted search request does not mean another website is blocked.
513
+ 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.
514
+ 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.
515
+ 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.
516
+ `,xg=[{id:"ubuntu:24.04",name:"Ubuntu 24.04"},{id:"debian:12-slim",name:"Debian 12 slim"}],$Y=["git","curl","ripgrep"],Jm=(e,t="bash")=>`curl -fsSL ${e} -o /tmp/install-agent.sh && ${t} /tmp/install-agent.sh && rm /tmp/install-agent.sh`,BY=[{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:Jm("https://cursor.com/install")},{id:"antigravity",command:"agy",install:Jm("https://antigravity.google/cli/install.sh")},{id:"copilot",command:"copilot",npm:"@github/copilot"},{id:"kiro",command:"kiro-cli",packages:["unzip"],install:Jm("https://cli.kiro.dev/install")},{id:"droid",command:"droid",install:Jm("https://app.factory.ai/cli","sh")},{id:"aider",command:"aider",python:!0}],Ws=BY.map(e=>{const t=Rx.find(r=>r.commands.includes(e.command));return{...e,name:t.name,logo:`/logos/agents/${t.logo}.svg`}}),w1=e=>Ws.filter(t=>e.agents.includes(t.id)),j1=[{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}],VY="/run/openshell-supervisor-ca/material/ca-bundle.crt",bg=[...Ws.map(e=>({id:e.command,name:e.name})),{id:"",name:"Shell"}],UY=/^[a-z0-9]([a-z0-9-]{0,17}[a-z0-9])?$/,HY=8e3,Ax=e=>e.source==="build"&&Array.isArray(e.agents)&&new Set(e.agents).size+(Array.isArray(e.customAgents)?e.customAgents.length:0)>1;function na(e={}){const t={name:"",source:"build",agents:["claude"],customAgents:[],repository:"",runtimes:[],base:xg[0].id,packages:[...$Y],setup:"",image:"",environment:[],command:"claude",setups:[],setupRevisions:{},...e};return Ax(t)&&(t.command=""),t}const rE=e=>e.split(/[\s,]+/).filter(Boolean),Qv=e=>`openshell-image-recipe-v3:${e}`;function oE(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 FY(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 GY(e){let t=2166136261;for(const r of S1(e))t=Math.imul(t^r.charCodeAt(0),16777619);return(t>>>0).toString(16).padStart(8,"0")}const Zv=e=>"'"+e.replaceAll("'","'\\''")+"'",qY=/^[a-zA-Z0-9][a-zA-Z0-9._/:@-]{0,255}$/;function YY(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 i;return!((i=e.setups)!=null&&i.includes(r))||!/^[a-f0-9]{64}$/.test(a)}))&&(t.setups="Invalid pinned Setup revision."),UY.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=>!Ws.some(a=>a.id===r)))&&(t.agents="Choose a supported agent."),(!Array.isArray(e.runtimes)||e.runtimes.some(r=>!j1.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."}xg.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"?qY.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."),Ax(e)&&e.command!==""&&(t.command="Templates with multiple agents must start in Shell."),!Object.keys(t).length&&new TextEncoder().encode(JSON.stringify(FY(e))).length>HY&&(t.setup="This recipe is too large to store with the template. Shorten the setup commands or package list."),t}function S1(e){var u,f,m;const t=w1(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),i=[...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 ${i.map(Zv).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 = ${VY}' >> /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 -- ${Zv(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' ${LY.split(`
517
+ `).map(Zv).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(`
518
+ `)}const aE="openshell.console/session",KY="openshell.console/project",zp=e=>!!(e!=null&&e.remote&&/^console-ssh-[a-f0-9]{24}$/.test(e.name??e.gateway??"")),XY=e=>{var r;const t=(r=e==null?void 0:e.labels)==null?void 0:r[KY];return typeof t=="string"&&/^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(t)?t:null},WY={shell:"/bin/bash -l",...Object.fromEntries(Ws.map(e=>[e.command,e.command]))},QY=e=>Object.hasOwn(WY,e??""),ZY=e=>{var t;return QY((t=e==null?void 0:e.labels)==null?void 0:t[aE])?e.labels[aE]:"shell"},a4=e=>{var t;return e==="shell"?"Shell":((t=Ws.find(r=>r.command===e))==null?void 0:t.name)??e};function ite(e){const t=ZY(e),r=o4(e).flatMap(i=>Ws.filter(c=>c.name===i.name).map(c=>c.command)),a=[...new Set([...t==="shell"?[]:[t],...r])];return[{id:"shell",name:"Shell"},...a.map(i=>({id:i,name:a4(i)}))]}function vg(e,t,r,a=typeof r=="string"?r:(r==null?void 0:r.target)??qR()){var m,h;const i=new URLSearchParams;t&&i.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&&(i.set("gateway",c),i.set("workspace",u),r!=null&&r.remote&&i.set("remote","1"));const f=i.toString();return`?target=${a}#terminal/${encodeURIComponent(e)}${f?`?${f}`:""}`}function Ew(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 Mx=(e,t)=>e.appliesTo.everyone||Ew(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)),JY=e=>e.startsWith("*")||!e.includes(".")?[e]:[e,`**.${e}`],eK=e=>e.flatMap(JY);function i4(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 l4=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48).replace(/-$/,""),ir=(e,t)=>{var r;return Ew((r=e==null?void 0:e.assignments)==null?void 0:r[t])},c4=(e,t)=>(e??[]).filter(r=>Mx(r,t)),Rw=(e,t)=>(e??[]).filter(r=>!r.appliesTo.everyone&&r.appliesTo.groups.includes(t));function iE({pressed:e,onClick:t,children:r,count:a,muted:i}){return n.jsxs("button",{type:"button","aria-pressed":e,onClick:t,className:Ve("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?n.jsx(Yn,{className:"size-3","aria-hidden":"true"}):!i&&n.jsx(Ka,{className:"size-3 text-muted-foreground","aria-hidden":"true"}),r,a!=null&&n.jsx("span",{className:"font-mono text-[10px] tabular-nums text-faint",children:a})]})}function tK({onCreated:e,existing:t}){const r=Pt(),[a,i]=x.useState(!1),[c,u]=x.useState(""),[f,m]=x.useState(!1),[h,g]=x.useState(null),p=l4(c),b=t.some(w=>w.id===p);async function v(){if(!(!p||b)){m(!0),g(null);try{const{group:w}=await r.saveGroup({id:p,name:c.trim(),description:"",isNew:!0});i(!1),u(""),e(w)}catch(w){g(w.message)}finally{m(!1)}}}return a?n.jsxs("div",{className:"grid w-full gap-1",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Ot,{value:c,onChange:w=>u(w.target.value),autoFocus:!0,placeholder:"Frontend","aria-label":"New group name",className:"h-7 max-w-52 text-xs",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),v()),w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),i(!1))}}),n.jsxs(le,{type:"button",size:"xs",onClick:v,disabled:f||!p||b,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&n.jsx(kt,{"aria-hidden":"true"}),"Create"]}),n.jsx(le,{type:"button",size:"xs",variant:"ghost",onClick:()=>{i(!1),u("")},children:"Cancel"})]}),(h||b)&&n.jsx("p",{className:"text-[11px] text-red-700",children:h??`A group called "${c.trim()}" already exists.`})]}):n.jsxs("button",{type:"button",onClick:()=>i(!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:[n.jsx(vs,{className:"size-3","aria-hidden":"true"}),"New group"]})}function cc({groups:e,counts:t={},value:r,onChange:a,multiple:i=!1,required:c=!1,allowCreate:u=!0,onCreated:f}){const m=x.useId(),h=i?r:r?[r]:[],g=p=>{a(i?h.includes(p)?h.filter(b=>b!==p):[...h,p]:p)};return n.jsxs("div",{role:"group","aria-label":i?"Choose groups":"Choose a group",className:"flex flex-wrap items-center gap-1.5",children:[!i&&!c&&n.jsx(iE,{pressed:!r,onClick:()=>a(null),muted:!0,children:"No group"}),e.map(p=>c&&!i?n.jsxs("label",{className:"relative min-w-0 cursor-pointer",children:[n.jsx("input",{type:"radio",name:m,value:p.id,checked:r===p.id,onChange:()=>a(p.id),required:!0,className:"peer sr-only"}),n.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?n.jsx(Yn,{className:"size-3 shrink-0","aria-hidden":"true"}):n.jsx(Ka,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":"true"}),n.jsx("span",{className:"break-words",children:p.name}),t[p.id]!=null&&n.jsx("span",{"aria-label":`${t[p.id]} sandboxes`,className:"font-mono text-[10px] text-faint",children:t[p.id]})]})]},p.id):n.jsx(iE,{pressed:h.includes(p.id),onClick:()=>g(p.id),count:t[p.id],children:p.name},p.id)),u&&n.jsx(tK,{existing:e,onCreated:p=>{f==null||f(p),g(p.id)}})]})}function ga({location:e}){return e?n.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:[Dn(e),!e.connected&&" · Disconnected"]}):null}function nK(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 sK=e=>{switch(e){case"success":return aK;case"info":return lK;case"warning":return iK;case"error":return cK;default:return null}},rK=Array(12).fill(0),oK=({visible:e,className:t})=>nt.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},nt.createElement("div",{className:"sonner-spinner"},rK.map((r,a)=>nt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),aK=nt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},nt.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"})),iK=nt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},nt.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"})),lK=nt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},nt.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"})),cK=nt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},nt.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"})),uK=nt.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"},nt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),nt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),dK=()=>{const[e,t]=nt.useState(document.hidden);return nt.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)},[]),e};let fK=1;const hK=100,lE=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:fK++};class mK{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-hK;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,i=lE(t),c=this.pendingDismissals.get(i);c!==void 0&&(cancelAnimationFrame(c),this.pendingDismissals.delete(i),this.dismissedToasts.delete(i));const u=this.dismissedToasts.has(i),f=t.dismissible===void 0?!0:t.dismissible;return u&&(this.dismissedToasts.delete(i),this.toasts=this.toasts.filter(h=>h.id!==i)),(u?void 0:this.toasts.find(h=>h.id===i))?this.toasts=this.toasts.map(h=>h.id===i?(this.publish({...h,...t,id:i,title:r}),{...h,...t,id:i,dismissible:f,title:r}):h):this.addToast({title:r,...a,dismissible:f,id:i}),i},this.dismiss=t=>{if(t==null)return this.getActiveToasts().forEach(a=>{this.dismissedToasts.add(a.id),this.subscribers.forEach(i=>i({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 i=Promise.resolve(t instanceof Function?t():t);let c=a!==void 0,u;const f=i.then(async h=>{if(u=["resolve",h],nt.isValidElement(h))c=!1,this.create({id:a,type:"default",message:h});else if(gK(h)&&!h.ok){c=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,b=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,w=typeof p=="object"&&!nt.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:b,...w})}else if(h instanceof Error){c=!1;const p=typeof r.error=="function"?await r.error(h):r.error,b=typeof r.description=="function"?await r.description(h):r.description,w=typeof p=="object"&&!nt.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:b,...w})}else if(r.success!==void 0){c=!1;const p=typeof r.success=="function"?await r.success(h):r.success,b=typeof r.description=="function"?await r.description(h):r.description,w=typeof p=="object"&&!nt.isValidElement(p)?p:{message:p};this.create({id:a,type:"success",description:b,...w})}}).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"&&!nt.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=lE(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 vr=new mK,pK=(e,t)=>vr.message(e,t),gK=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",xK=pK,bK=()=>vr.toasts,vK=()=>vr.getActiveToasts(),He=Object.assign(xK,{success:vr.success,info:vr.info,warning:vr.warning,error:vr.error,custom:vr.custom,message:vr.message,promise:vr.promise,dismiss:vr.dismiss,loading:vr.loading},{getHistory:bK,getToasts:vK});nK("[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 ep(e){return e.label!==void 0}const yK=3,wK="24px",jK="16px",cE=4e3,SK=356,NK=14,CK=45,kK=200;function Jo(...e){return e.filter(Boolean).join(" ")}function TK(e){const[t,r]=e.split("-"),a=[];return t&&a.push(t),r&&a.push(r),a}const EK=e=>{var t,r,a,i,c,u,f,m,h;const{invert:g,toast:p,unstyled:b,interacting:v,setHeights:w,visibleToasts:C,heights:S,index:N,toasts:E,expanded:T,removeToast:R,defaultRichColors:M,closeButton:A,style:k,cancelButtonStyle:O,actionButtonStyle:D,className:_="",descriptionClassName:H="",duration:G,position:B,gap:P,expandByDefault:V,classNames:q,icons:W,closeButtonAriaLabel:K="Close toast"}=e,[J,z]=nt.useState(null),[L,X]=nt.useState(null),[ee,$]=nt.useState(!1),[U,F]=nt.useState(!1),[Y,ne]=nt.useState(!1),[te,ye]=nt.useState(!1),[ae,ue]=nt.useState(!1),[se,Q]=nt.useState(0),[ie,oe]=nt.useState(0),pe=nt.useRef(p.duration||G||cE),xe=nt.useRef(null),je=nt.useRef(null),Ie=N===0,ce=N+1<=C,Te=p.type,re=Te??"default",fe=p.dismissible!==!1,Re=p.className||"",Oe=p.descriptionClassName||"",ke=nt.useMemo(()=>S.findIndex(Ze=>Ze.toastId===p.id)||0,[S,p.id]),he=nt.useMemo(()=>{var Ze;return(Ze=p.closeButton)!=null?Ze:A},[p.closeButton,A]),Ae=nt.useMemo(()=>p.duration||G||cE,[p.duration,G]),ge=nt.useRef(0),Pe=nt.useRef(0),Fe=nt.useRef(0),_e=nt.useRef(null),[Xe,Je]=B.split("-"),ct=nt.useMemo(()=>S.reduce((Ze,Tt,Se)=>Se>=ke?Ze:Ze+Tt.height,0),[S,ke]),At=dK(),rt=nt.useMemo(()=>{var Ze;return(Ze=e.swipeDirections)!=null?Ze:TK(B)},[e.swipeDirections,B]),ve=p.invert||g,Ue=Te==="loading";Pe.current=nt.useMemo(()=>ke*P+ct,[ke,ct]),nt.useEffect(()=>{pe.current=Ae},[Ae]),nt.useEffect(()=>{$(!0)},[]),nt.useEffect(()=>{const Ze=je.current;if(Ze){const Tt=Ze.getBoundingClientRect().height;return oe(Tt),w(Se=>[{toastId:p.id,height:Tt,position:p.position},...Se]),()=>w(Se=>Se.filter(Ye=>Ye.toastId!==p.id))}},[w,p.id]),nt.useLayoutEffect(()=>{if(!ee)return;const Ze=je.current,Tt=Ze.style.height;Ze.style.height="auto";const Se=Ze.getBoundingClientRect().height;Ze.style.height=Tt,oe(Se),w(Ye=>Ye.find(it=>it.toastId===p.id)?Ye.map(it=>it.toastId===p.id?{...it,height:Se}:it):[{toastId:p.id,height:Se,position:p.position},...Ye])},[ee,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const Qe=nt.useCallback(()=>{F(!0),Q(Pe.current),w(Ze=>Ze.filter(Tt=>Tt.toastId!==p.id)),setTimeout(()=>{R(p)},kK)},[p,R,w,Pe]);nt.useEffect(()=>{if(p.promise&&Te==="loading"||p.duration===1/0||p.type==="loading")return;let Ze;return T||v||At?(()=>{if(Fe.current<ge.current){const Ye=new Date().getTime()-ge.current;pe.current=pe.current-Ye}Fe.current=new Date().getTime()})():(()=>{pe.current!==1/0&&(ge.current=new Date().getTime(),Ze=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),Qe()},pe.current))})(),()=>clearTimeout(Ze)},[T,v,p,Te,At,Qe]),nt.useEffect(()=>{p.delete&&(Qe(),p.onDismiss==null||p.onDismiss.call(p,p))},[Qe,p.delete]);function xt(){var Ze;if(W!=null&&W.loading){var Tt;return nt.createElement("div",{className:Jo(q==null?void 0:q.loader,p==null||(Tt=p.classNames)==null?void 0:Tt.loader,"sonner-loader"),"data-visible":Te==="loading"},W.loading)}return nt.createElement(oK,{className:Jo(q==null?void 0:q.loader,p==null||(Ze=p.classNames)==null?void 0:Ze.loader),visible:Te==="loading"})}const Ke=p.icon||(W==null?void 0:W[Te])||sK(Te);var Be,jt;return nt.createElement("li",{tabIndex:0,ref:je,className:Jo(_,Re,q==null?void 0:q.toast,p==null||(t=p.classNames)==null?void 0:t.toast,q==null?void 0:q[re],p==null||(r=p.classNames)==null?void 0:r[re]),"data-sonner-toast":"","data-rich-colors":(Be=p.richColors)!=null?Be:M,"data-styled":!(p.jsx||p.unstyled||b),"data-mounted":ee,"data-promise":!!p.promise,"data-swiped":ae,"data-removed":U,"data-visible":ce,"data-y-position":Xe,"data-x-position":Je,"data-index":N,"data-front":Ie,"data-swiping":Y,"data-dismissible":fe,"data-type":Te,"data-invert":ve,"data-swipe-out":te,"data-swipe-direction":L,"data-expanded":!!(T||V&&ee),"data-testid":p.testId,style:{"--index":N,"--toasts-before":N,"--z-index":E.length-N,"--offset":`${U?se:Pe.current}px`,"--initial-height":V?"auto":`${ie}px`,...k,...p.style},onDragEnd:()=>{ne(!1),z(null),_e.current=null},onPointerDown:Ze=>{Ze.button!==2&&(Ue||!fe||(xe.current=new Date,Q(Pe.current),Ze.target.setPointerCapture(Ze.pointerId),Ze.target.tagName!=="BUTTON"&&(ne(!0),_e.current={x:Ze.clientX,y:Ze.clientY})))},onPointerUp:()=>{var Ze,Tt,Se;if(te||!fe)return;_e.current=null;const Ye=Number(((Ze=je.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),et=Number(((Tt=je.current)==null?void 0:Tt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),it=new Date().getTime()-((Se=xe.current)==null?void 0:Se.getTime()),lt=J==="x"?Ye:et,wt=Math.abs(lt)/it;if((J==="x"?rt.includes(Ye>0?"right":"left"):rt.includes(et>0?"bottom":"top"))&&(Math.abs(lt)>=CK||wt>.11)){Q(Pe.current),p.onDismiss==null||p.onDismiss.call(p,p),X(J==="x"?Ye>0?"right":"left":et>0?"down":"up"),Qe(),ye(!0);return}else{var Gt,fn;(Gt=je.current)==null||Gt.style.setProperty("--swipe-amount-x","0px"),(fn=je.current)==null||fn.style.setProperty("--swipe-amount-y","0px")}ue(!1),ne(!1),z(null)},onPointerMove:Ze=>{var Tt,Se,Ye;if(!_e.current||!fe||((Tt=window.getSelection())==null?void 0:Tt.toString().length)>0)return;const it=Ze.clientY-_e.current.y,lt=Ze.clientX-_e.current.x;!J&&(Math.abs(lt)>1||Math.abs(it)>1)&&z(Math.abs(lt)>Math.abs(it)?"x":"y");let wt={x:0,y:0};const cn=Gt=>1/(1.5+Math.abs(Gt)/20);if(J==="y"){if(rt.includes("top")||rt.includes("bottom"))if(rt.includes("top")&&it<0||rt.includes("bottom")&&it>0)wt.y=it;else{const Gt=it*cn(it);wt.y=Math.abs(Gt)<Math.abs(it)?Gt:it}}else if(J==="x"&&(rt.includes("left")||rt.includes("right")))if(rt.includes("left")&&lt<0||rt.includes("right")&&lt>0)wt.x=lt;else{const Gt=lt*cn(lt);wt.x=Math.abs(Gt)<Math.abs(lt)?Gt:lt}(Math.abs(wt.x)>0||Math.abs(wt.y)>0)&&ue(!0),(Se=je.current)==null||Se.style.setProperty("--swipe-amount-x",`${wt.x}px`),(Ye=je.current)==null||Ye.style.setProperty("--swipe-amount-y",`${wt.y}px`)}},he&&!p.jsx&&Te!=="loading"?nt.createElement("button",{"aria-label":K,"data-disabled":Ue,"data-close-button":!0,onClick:Ue||!fe?()=>{}:()=>{Qe(),p.onDismiss==null||p.onDismiss.call(p,p)},className:Jo(q==null?void 0:q.closeButton,p==null||(a=p.classNames)==null?void 0:a.closeButton)},(jt=W==null?void 0:W.close)!=null?jt:uK):null,(Te||p.icon||p.promise)&&p.icon!==null&&((W==null?void 0:W[Te])!==null||p.icon)?nt.createElement("div",{"data-icon":"",className:Jo(q==null?void 0:q.icon,p==null||(i=p.classNames)==null?void 0:i.icon)},Te==="loading"?p.icon||xt():p.promise?xt():null,Te!=="loading"?Ke:null):null,nt.createElement("div",{"data-content":"",className:Jo(q==null?void 0:q.content,p==null||(c=p.classNames)==null?void 0:c.content)},nt.createElement("div",{"data-title":"",className:Jo(q==null?void 0:q.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?nt.createElement("div",{"data-description":"",className:Jo(H,Oe,q==null?void 0:q.description,p==null||(f=p.classNames)==null?void 0:f.description)},typeof p.description=="function"?p.description():p.description):null),nt.isValidElement(p.cancel)?p.cancel:p.cancel&&ep(p.cancel)?nt.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||O,onClick:Ze=>{ep(p.cancel)&&fe&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Ze),Qe())},className:Jo(q==null?void 0:q.cancelButton,p==null||(m=p.classNames)==null?void 0:m.cancelButton)},p.cancel.label):null,nt.isValidElement(p.action)?p.action:p.action&&ep(p.action)?nt.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||D,onClick:Ze=>{ep(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Ze),!Ze.defaultPrevented&&Qe())},className:Jo(q==null?void 0:q.actionButton,p==null||(h=p.classNames)==null?void 0:h.actionButton)},p.action.label):null)};function uE(){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 RK(e,t){const r={};return[e,t].forEach((a,i)=>{const c=i===1,u=c?"--mobile-offset":"--offset",f=c?jK:wK;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 AK=nt.forwardRef(function(t,r){const{id:a,invert:i,position:c="bottom-right",hotkey:u=["altKey","KeyT"],expand:f,closeButton:m,className:h,offset:g,mobileOffset:p,theme:b="light",richColors:v,duration:w,style:C,visibleToasts:S=yK,toastOptions:N,dir:E=uE(),gap:T=NK,icons:R,customAriaLabel:M,containerAriaLabel:A="Notifications"}=t,[k,O]=nt.useState([]),D=nt.useMemo(()=>a?k.filter($=>$.toasterId===a):k.filter($=>!$.toasterId),[k,a]),_=nt.useMemo(()=>Array.from(new Set([c].concat(D.filter($=>$.position).map($=>$.position)))),[D,c]),[H,G]=nt.useState([]),[B,P]=nt.useState(!1),[V,q]=nt.useState(!1),[W,K]=nt.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),J=nt.useRef(null),z=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),L=nt.useRef(null),X=nt.useRef(!1),ee=nt.useCallback($=>{O(U=>{var F;return(F=U.find(Y=>Y.id===$.id))!=null&&F.delete||vr.dismiss($.id),U.filter(({id:Y})=>Y!==$.id)})},[]);return nt.useEffect(()=>vr.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{O(U=>U.map(F=>F.id===$.id?{...F,delete:!0}:F))});return}setTimeout(()=>{F7.flushSync(()=>{O(U=>{const F=U.findIndex(Y=>Y.id===$.id);return F!==-1?[...U.slice(0,F),{...U[F],...$},...U.slice(F+1)]:[$,...U]})})})}),[]),nt.useEffect(()=>{if(b!=="system"){K(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:U})=>{K(U?"dark":"light")})}catch{$.addListener(({matches:F})=>{try{K(F?"dark":"light")}catch(Y){console.error(Y)}})}},[b]),nt.useEffect(()=>{k.length<=1&&P(!1)},[k]),nt.useEffect(()=>{const $=U=>{var F;if(u.length>0&&u.every(te=>U[te]||U.code===te)){var ne;P(!0),(ne=J.current)==null||ne.focus()}U.code==="Escape"&&(document.activeElement===J.current||(F=J.current)!=null&&F.contains(document.activeElement))&&P(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[u]),nt.useEffect(()=>{if(J.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,X.current=!1)}},[J.current]),nt.createElement("section",{ref:r,"aria-label":M??`${A} ${z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},_.map(($,U)=>{var F;const[Y,ne]=$.split("-");return D.length?nt.createElement("ol",{key:$,dir:E==="auto"?uE():E,tabIndex:-1,ref:J,className:h,"data-sonner-toaster":!0,"data-sonner-theme":W,"data-y-position":Y,"data-x-position":ne,style:{"--front-toast-height":`${((F=H[0])==null?void 0:F.height)||0}px`,"--width":`${SK}px`,"--gap":`${T}px`,...C,...RK(g,p)},onBlur:te=>{X.current&&!te.currentTarget.contains(te.relatedTarget)&&(X.current=!1,L.current&&(L.current.focus({preventScroll:!0}),L.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||X.current||(X.current=!0,L.current=te.relatedTarget)},onMouseEnter:()=>P(!0),onMouseMove:()=>P(!0),onMouseLeave:()=>{V||P(!1)},onDragEnd:()=>P(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||q(!0)},onPointerUp:()=>q(!1)},D.filter(te=>!te.position&&U===0||te.position===$).map((te,ye)=>{var ae,ue;return nt.createElement(EK,{key:te.id,icons:R,index:ye,toast:te,defaultRichColors:v,duration:(ae=N==null?void 0:N.duration)!=null?ae:w,className:N==null?void 0:N.className,descriptionClassName:N==null?void 0:N.descriptionClassName,invert:i,visibleToasts:S,closeButton:(ue=N==null?void 0:N.closeButton)!=null?ue:m,interacting:V,position:$,style:N==null?void 0:N.style,unstyled:N==null?void 0:N.unstyled,classNames:N==null?void 0:N.classNames,cancelButtonStyle:N==null?void 0:N.cancelButtonStyle,actionButtonStyle:N==null?void 0:N.actionButtonStyle,closeButtonAriaLabel:N==null?void 0:N.closeButtonAriaLabel,removeToast:ee,toasts:D.filter(se=>se.position==te.position),heights:H.filter(se=>se.position==te.position),setHeights:G,expandByDefault:f,gap:T,expanded:B,swipeDirections:t.swipeDirections})})):null}))}),MK={info:{icon:n.jsx(Du,{className:"size-4 text-muted-foreground"}),role:"status"},progress:{icon:n.jsx(kt,{className:"size-4 text-muted-foreground"}),role:"status"},success:{icon:n.jsx(Yn,{className:"size-4 text-emerald-600"}),role:"status"},warning:{icon:n.jsx(ti,{className:"size-4 text-amber-600"}),role:"alert"},error:{icon:n.jsx(zA,{className:"size-4 text-destructive"}),role:"alert"}};function OK({tone:e="info",title:t,children:r,actions:a,onDismiss:i,dismissLabel:c}){const{icon:u,role:f}=MK[e];return n.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:[n.jsx("span",{className:"mt-px shrink-0","aria-hidden":"true",children:u}),n.jsxs("div",{className:"min-w-0 flex-1",children:[t&&n.jsx("p",{className:"break-words font-medium",children:t}),r&&n.jsx("div",{className:"mt-0.5 break-words text-muted-foreground",children:r}),a&&n.jsx("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:a})]}),i&&n.jsx("button",{type:"button","aria-label":c??"Dismiss notification",onClick:i,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:n.jsx(In,{className:"mx-auto size-3.5"})})]})}function Qa({id:e,...t}){return x.useEffect(()=>{const r=setTimeout(()=>He.custom(()=>n.jsx(OK,{...t}),{id:e,duration:1/0,dismissible:!1,unstyled:!0}));return()=>clearTimeout(r)}),x.useEffect(()=>()=>{He.dismiss(e)},[e]),null}const DK="Not downloaded yet. Import downloads this npm package and checks that it starts, in a temporary sandbox.",Aw=e=>e===DK||e.startsWith("Prepare package"),Mw=e=>e.kind==="mcp"&&!e.disabled&&!e.config&&!e.configuration&&!e.package;function zK(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 u4(e){var r;const t=new Set(e.preparationIssues||[]);return!!(!e.disabled&&e.package&&!e.artifact&&!((r=e.credentialFields)!=null&&r.length)&&e.issues.every(a=>Aw(a)||t.has(a)))}function IK(e){return!e.disabled&&(!e.issues.length||u4(e))}function PK(e){const t=e.requirements||[];return[...t,...zK(e.package).filter(r=>!t.some(a=>a.host===r.host&&a.phase===r.phase))]}const dE=e=>e.items.some(t=>!t.disabled&&t.issues.length>0),d4=e=>!!(e!=null&&e.useSourceSecrets||e!=null&&e.provider||Object.values((e==null?void 0:e.secrets)||{}).some(Boolean)),f4=(e,t)=>e.issues.filter(r=>{var a;return!Aw(r)&&!((a=e.preparationIssues)!=null&&a.includes(r))&&!(r.startsWith("Connect credentials")&&d4(t))}),_K=(e,t={})=>new Map(e.items.map(r=>[r.id,new Set(f4(r,t[r.id]))])),LK=(e,t={})=>e.items.filter(r=>!r.disabled&&f4(r,t[r.id]).length>0),$K=(e,t)=>t.items.some(r=>!r.disabled&&r.issues.some(a=>{var i;return!((i=e.get(r.id))!=null&&i.has(a))}));async function BK(e,t,r,a,{onProgress:i=()=>{},onReview:c=()=>{},isCancelled:u=()=>!1,resumeJob:f,wait:m=h=>new Promise(g=>setTimeout(g,h))}={}){const h=_K(t,a);let g=f||await e.prepareSetup(t.token,a);i(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}i(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 $K(h,g.review)?{status:"needs-attention",review:g.review}:(i({...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)})}const ia={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"]}},yg=["org","policy","group","agent","own","secret"],qa=e=>e.startsWith("_provider_")?"secret":e.startsWith("egress_")?"policy":e.startsWith("org_")?"org":e.startsWith("group_")?"group":e.startsWith("agent-")?"agent":"own",cf=e=>e.replace(/^_provider_/,"").replace(/^(org|group|egress)_/,"").replace(/_/g,"-");function Ow(e){if(!e)return null;try{return new URL(e.includes("://")?e:`https://${e}`).hostname}catch{return e.split("/")[0].replace(/:\d+$/,"")}}function h4(e){try{const t=new URL(e.includes("://")?e:`https://${e}`);return Number(t.port)||(t.protocol==="http:"?80:443)}catch{return 443}}const wg=e=>e.split("/").pop(),m4=e=>/^\d+\.\d+\.\d+\.\d+$/.test(e);function VK(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 p4(e,t,r){var m,h;const a=new Map,i=new Map,c=new Map;for(const g of e){const p=new Set,b={};for(const v of g.rules){const w=qa(v.key);b[w]=(b[w]??0)+1;for(const C of v.endpoints){if(C.blocked)continue;p.add(C.host);const S=a.get(C.host)??{host:C.host,sources:new Set,access:new Set,ports:new Set,sandboxes:new Set,grants:[],hits:0,hitsBySandbox:new Map};S.sources.add(w),S.access.add(C.access),C.ports.forEach(E=>S.ports.add(E)),S.sandboxes.add(g.name);let N=S.grants.find(E=>E.sandbox===g.name&&E.key===v.key);N||(N={sandbox:g.name,key:v.key,source:w,access:[],ports:[]},S.grants.push(N)),N.access.push(C.access),N.ports.push(...C.ports),a.set(C.host,S)}}i.set(g.name,p),c.set(g.name,{counts:b,blocked:0})}const u=new Map;for(const g of t){if(g.kind!=="audit"||!g.verdict)continue;const p=Ow(g.destination);if(!p||m4(p))continue;if(g.verdict==="allowed"){const w=a.get(p);w&&(w.hits+=1,w.hitsBySandbox.set(g.sandbox,(w.hitsBySandbox.get(g.sandbox)??0)+1));continue}if(g.verdict!=="denied"||(m=i.get(g.sandbox))!=null&&m.has(p))continue;const b=u.get(p)??{host:p,port:h4(g.destination),sandboxes:new Set,attempts:0,programs:new Set,lastAt:null};b.attempts+=1,b.sandboxes.add(g.sandbox),g.binary&&b.programs.add(g.binary),g.at&&(!b.lastAt||g.at>b.lastAt)&&(b.lastAt=g.at),u.set(p,b);const v=c.get(g.sandbox);v&&(v.blocked+=1)}const f=eK([...((h=r==null?void 0:r.org)==null?void 0:h.blocked)??[],...((r==null?void 0:r.policies)??[]).filter(g=>g.action==="block").flatMap(g=>g.destinations)]);return{destinations:[...a.values()].sort((g,p)=>p.sandboxes.size-g.sandboxes.size||p.hits-g.hits||g.host.localeCompare(p.host)),blocked:[...u.values()].filter(g=>!f.some(p=>i4(p,g.host))).sort((g,p)=>p.sandboxes.size-g.sandboxes.size||p.attempts-g.attempts),perSandbox:c}}function UK(e){const t=e.map(r=>{var a,i,c,u,f;return{location:r.location,...p4(((i=(a=r.data)==null?void 0:a.fleetPolicy)==null?void 0:i.sandboxes)??[],((u=(c=r.data)==null?void 0:c.activity)==null?void 0:u.events)??[],(f=r.data)==null?void 0:f.org)}});return{destinations:t.flatMap(r=>r.destinations.map(a=>({...a,location:r.location}))),blocked:t.flatMap(r=>r.blocked.map(a=>({...a,location:r.location}))),perSandbox:new Map(t.flatMap(r=>[...r.perSandbox].map(([a,i])=>[ht({name:a,location:r.location}),i])))}}function HK(e){var r;const t={locations:[],sandboxes:[],templates:[]};for(const{target:a,inventory:i,cloud:c=a==="cloud"}of e){const u=new Map((i.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 i[f]??[]){const h=u.get((r=m.location)==null?void 0:r.context);h&&t[f].push({...m,location:h})}}return t}function vo(){var h;const e=js(),t=!!(e!=null&&e.localViewer),r=t&&e.connected,a=`${t}:${r?(h=e.user)==null?void 0:h.uid:""}`,[i,c]=x.useState(null),[u,f]=x.useReducer(g=>g+1,0);x.useEffect(()=>{let g=!0,p;const b=new AbortController,v=lr("local",b.signal);let w=null;const C=async()=>{var R,M;const S=await Promise.allSettled([v.inventory(),...r?[Ha("inventory",void 0,{signal:b.signal})]:[]]);if(!g)return;const N=[],E=[];for(let A=0;A<S.length;A++){const k=A===0?"local":"cloud",O=A!==0||!t,D=S[A];if(D.status==="fulfilled")N.push({target:k,cloud:O,inventory:D.value}),(R=D.value.machine)!=null&&R.error&&E.push(D.value.machine.error);else{E.push(`${O?"Cloud":"Local"} inventory unavailable: ${D.reason.message}`);const _=(M=w==null?void 0:w.filter(H=>H.target===k)[0])==null?void 0:M.inventory;if(_){const H=_.locations.map(G=>({...G,connected:!1,error:D.reason.message}));N.push({target:k,cloud:O,inventory:{..._,locations:H}})}}}w=N;const T=HK(N);en.observeTemplates(T.templates),c({scope:a,inventory:T,error:E.join("; ")||null}),p=setTimeout(C,T.templates.some(A=>A.status==="building")?1200:5e3)};return C(),()=>{g=!1,b.abort(),clearTimeout(p)}},[a,u,t,r]);const m=(i==null?void 0:i.scope)===a?i:null;return{...(m==null?void 0:m.inventory)??{sandboxes:[],templates:[],locations:[]},error:(m==null?void 0:m.error)??null,loading:!m,refresh:f}}async function FK(e,t,r,a=[]){const i=new Map(a.map(c=>[c.location.id??c.location.context,c.data]));return Promise.all(e.map(async c=>{const u=i.get(c.id??c.context);if(!c.connected)return{location:c,data:u??null,error:null};const f=await Promise.allSettled(t.map(g=>r(c)[g]())),m={},h=[];return f.forEach((g,p)=>{g.status==="fulfilled"?m[t[p]]=g.value:((u==null?void 0:u[t[p]])!==void 0&&(m[t[p]]=u[t[p]]),h.push(g.reason.message))}),{location:h.length&&h.length===t.length?{...c,connected:!1}:c,data:Object.keys(m).length?m:null,error:[...new Set(h)].join("; ")||null}}))}function GK(e,t){const r=c=>t.every(u=>{var f;return((f=c.data)==null?void 0:f[u])!==void 0}),a=e.filter(c=>c.error),i=e.filter(c=>!c.error&&!r(c)&&c.location.connected===!1);return{failed:a,offline:i,any:a.length+i.length>0,unavailable:e.length>0&&e.every(c=>!r(c)&&(c.error||c.location.connected===!1))}}const fE=new Map;function Uu(e){var N,E;const t=Bf(),r=js(),a=vo(),i=e.join(","),c=`${t.owner??""}:${((N=r==null?void 0:r.user)==null?void 0:N.uid)??""}:${i}`,u=JSON.stringify(a.locations.map(({id:T,context:R,connected:M})=>[T,R,M])),f=x.useRef(a.locations);f.current=a.locations;const[m,h]=x.useState(null),[g,p]=x.useState(!0),b=x.useRef(0),v=x.useCallback(T=>{var M;const R=r!=null&&r.localViewer?T.target:t.target;return lr(R,t.signal,T.context,R==="cloud"?((M=r==null?void 0:r.status)==null?void 0:M.owner)??t.owner:t.owner)},[t,r==null?void 0:r.localViewer,(E=r==null?void 0:r.status)==null?void 0:E.owner]),w=x.useCallback(async()=>{var M;const T=++b.current;p(!0);const R=await FK(f.current,i.split(",").filter(Boolean),v,fE.get(c));if(!(T!==b.current||(M=t.signal)!=null&&M.aborted))return fE.set(c,R),h({scope:c,sources:R}),p(!1),R},[v,i,c,t.signal]);x.useEffect(()=>{if(a.loading)return;w();const T=setInterval(w,15e3),R=()=>w();return window.addEventListener("openrod-resources-changed",R),()=>{b.current++,clearInterval(T),window.removeEventListener("openrod-resources-changed",R)}},[w,u,a.loading]);const C=x.useMemo(()=>(m==null?void 0:m.scope)===c?m.sources.map(T=>({...T,location:{...T.location,connected:T.location.connected&&f.current.some(R=>R.id===T.location.id&&R.connected)}})):[],[m,c,u]),S=x.useMemo(()=>GK(C,i.split(",").filter(Boolean)),[C,i]);return{sources:C,status:S,loading:a.loading||g,refresh:w,apiFor:v,locations:a.locations,inventory:a,error:C.filter(T=>T.error).map(T=>`${T.location.label}: ${T.error}`).join("; ")}}function Mu({model:e,what:t,offline:r=!0}){const{failed:a,offline:i}=e.status,c=i.map(u=>Dn(u.location));return n.jsxs(n.Fragment,{children:[a.map(u=>n.jsxs("div",{role:"alert",className:"flex items-center gap-3 border-b border-border px-4 py-2 text-xs text-red-600 sm:px-6",children:[n.jsxs("span",{className:"min-w-0",children:[Dn(u.location),": ",u.error]}),n.jsx(le,{variant:"outline",size:"sm",className:"shrink-0",onClick:e.refresh,children:"Retry"})]},u.location.id??u.location.context)),r&&c.length>0&&n.jsxs("p",{role:"status",className:"border-b border-border px-4 py-1.5 text-[11px] text-muted-foreground sm:px-6",children:[c.join(", ")," ",c.length===1?"is":"are"," offline. Reconnect to see ",c.length===1?"its":"their"," ",t,"."]})]})}const Ef=e=>e.id||`${e.sandbox}|${e.at}|${e.source}|${e.target}|${e.message}`,jg={CRITICAL:6,FATAL:6,HIGH:5,MED:4,MEDIUM:4,LOW:3,INFO:2,INFORMATIONAL:2},qK={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},YK={NET:"Network",HTTP:"HTTP",SSH:"Session",CONFIG:"Configuration",PROC:"Process",FILE:"File",AUTH:"Authentication",FINDING:"Finding",EVENT:"Event"};function Dw(e){var u,f,m,h,g;const t=((u=e.binary)==null?void 0:u.split("/").pop())||"",r=Rx.find(p=>p.commands.includes(t.toLowerCase())&&t.toLowerCase()!=="agent"),a=r?{name:r.name,logo:`/logos/agents/${r.logo}.svg`}:null,i=e.direction||(e.kind==="inbound"&&["NET","HTTP","SSH"].includes(e.category)?"in":e.kind==="audit"&&["NET","HTTP"].includes(e.category)?"out":"unknown"),c={source:((f=e.location)==null?void 0:f.label)??"",time:e.at??"",sandbox:e.sandbox??"",scope:e.scope??"",sandboxId:e.sandboxId??((m=e.original)==null?void 0:m.sandboxId)??"",agent:(a==null?void 0:a.name)??"Unknown",category:YK[e.category]??(e.kind==="log"?"Log":"Unclassified"),severity:e.severity||"Not reported",logLevel:e.level&&e.level!=="OCSF"?e.level:"Not reported",direction:i,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:qK[e.reason]??e.reason??""};return{event:e,agent:a,key:Ef(e),values:c,timestamp:Date.parse(e.at),search:[...Object.values(c),e.message,e.detail,e.source,e.target,JSON.stringify(((h=e.original)==null?void 0:h.fields)??((g=e.original)==null?void 0:g.metadata)??{})].join(" ").toLowerCase()}}function N1(e,{query:t="",direction:r="all",sandboxes:a=[],verdicts:i=[],agents:c=[],filters:u={},range:f="all",from:m="",to:h="",now:g=Date.now(),sort:p={key:"time",direction:"desc"}}={}){const b=new Set(a),v=t.trim().toLowerCase(),w=f==="custom"?m?Date.parse(m):-1/0:f==="all"?-1/0:g-Number(f)*6e4,C=f==="custom"&&h?Date.parse(h):1/0;return e.filter(S=>r!=="all"&&S.values.direction!==r||b.size&&!b.has(S.values.sandbox)||c.length&&!c.includes(S.values.agent)||i.length&&!i.includes(S.values.verdict)||v&&!S.search.includes(v)||f!=="all"&&(!Number.isFinite(S.timestamp)||S.timestamp<w||S.timestamp>C)?!1:Object.entries(u).every(([N,E])=>{var T;return!((T=E==null?void 0:E.value)!=null&&T.trim())||(E.mode==="equals"?(S.values[N]??"").toLowerCase()===E.value.trim().toLowerCase():(S.values[N]??"").toLowerCase().includes(E.value.trim().toLowerCase()))!==(E.mode==="excludes")})).sort((S,N)=>{const E=p.key==="severity"?jg[S.values.severity.toUpperCase()]??-1:p.key==="time"?Number.isFinite(S.timestamp)?S.timestamp:0:S.values[p.key]??"",T=p.key==="severity"?jg[N.values.severity.toUpperCase()]??-1:p.key==="time"?Number.isFinite(N.timestamp)?N.timestamp:0:N.values[p.key]??"",R=typeof E=="number"?E-T:E.localeCompare(T,void 0,{numeric:!0});return(p.direction==="asc"?R:-R)||S.key.localeCompare(N.key)})}const g4=x.createContext(null),Jv=2e3;function Rf({children:e}){const t=Pt(),r=gn(),[a,i]=x.useState(null),[c,u]=x.useState(null),[f,m]=x.useState([]),[h,g]=x.useState("connecting"),[p,b]=x.useState(null),[v,w]=x.useState(null),C=x.useRef(new Set),S=x.useRef(0),[N,E]=x.useState(0),T=x.useCallback(k=>{const O=k.filter(D=>{const _=Ef(D);return C.current.has(_)?!1:(C.current.add(_),!0)});O.length&&m(D=>{const _=[...O,...D].sort((H,G)=>(G.at??"").localeCompare(H.at??""));if(_.length<=Jv)return _;for(const H of _.slice(Jv))C.current.delete(Ef(H));return _.slice(0,Jv)})},[]),R=x.useCallback(async()=>{try{u(await t.overview())}catch(k){u(O=>O??{error:k.message})}},[t]),M=x.useCallback(async()=>{const k=S.current;try{const O=await t.activity({limit:500});if(k!==S.current)return;T(O.events),b(O.coverage),w(null)}catch(O){w(O.message)}},[T,t]);x.useEffect(()=>{let k,O,D=!1;const _=()=>{S.current++,C.current.clear(),m([]),E(H=>H+1),M()};return i(null),u(null),m([]),C.current.clear(),S.current++,t.context().then(async H=>{if(D)return;if(!r&&!H.configured){g("setup-required"),i([]);return}R(),M(),O=setInterval(R,15e3);const G=await t.contextKey();D||(k=new EventSource(t.url("/stream",{context:G,...r?{location:"1"}:{}})),k.onopen=()=>{g("live"),_()},k.addEventListener("context-changed",()=>window.location.reload()),k.addEventListener("activity-deleted",B=>{b(JSON.parse(B.data).coverage),_()}),k.onerror=()=>g("reconnecting"),k.addEventListener("sandboxes",B=>{g("live"),i(JSON.parse(B.data))}),k.addEventListener("log",B=>T([JSON.parse(B.data)])),k.addEventListener("collection",B=>b(JSON.parse(B.data))),k.addEventListener("gateway-health",()=>g("live")),k.addEventListener("gateway-error",()=>g("gateway-down")))}).catch(()=>{D||g("gateway-down")}),()=>{D=!0,k==null||k.close(),clearInterval(O)}},[T,M,R,t,r==null?void 0:r.context]);const A=x.useMemo(()=>({sandboxes:a??(c==null?void 0:c.sandboxes)??null,overview:c,events:f,connection:h,collection:p,historyError:v,activityRevision:N,refresh:()=>{R(),M()}}),[a,c,f,h,p,v,N,R,M]);return n.jsx(g4.Provider,{value:A,children:e})}function oi(){const e=x.useContext(g4);if(!e)throw new Error("useLive outside LiveProvider");return e}function KK(e,t,r){var c,u;const a=e.job&&["working","needs-install","needs-docker"].includes(e.job.status)?e.job:null,i=r??t??(a==null?void 0:a.host)??((c=e.active)==null?void 0:c.host)??((u=e.hosts[0])==null?void 0:u.name)??"";return{host:i,job:(a==null?void 0:a.host)===i?a:null}}const x4=({className:e,containerRef:t,fromRef:r,toRef:a,curvature:i=0,reverse:c=!1,duration:u=5,delay:f=0,pathColor:m="gray",pathWidth:h=2,pathOpacity:g=.2,gradientStartColor:p="#ffaa40",gradientStopColor:b="#9c40ff",repeat:v=1/0,repeatDelay:w=0,startXOffset:C=0,startYOffset:S=0,endXOffset:N=0,endYOffset:E=0})=>{const T=x.useId(),[R,M]=x.useState(""),[A,k]=x.useState({width:0,height:0}),O=c?{x1:["90%","-10%"],x2:["100%","0%"],y1:["0%","0%"],y2:["0%","0%"]}:{x1:["10%","110%"],x2:["0%","100%"],y1:["0%","0%"],y2:["0%","0%"]};return x.useEffect(()=>{const D=()=>{if(t.current&&r.current&&a.current){const H=t.current.getBoundingClientRect(),G=r.current.getBoundingClientRect(),B=a.current.getBoundingClientRect(),P=H.width,V=H.height;k({width:P,height:V});const q=G.left-H.left+G.width/2+C,W=G.top-H.top+G.height/2+S,K=B.left-H.left+B.width/2+N,J=B.top-H.top+B.height/2+E,z=W-i,L=`M ${q},${W} Q ${(q+K)/2},${z} ${K},${J}`;M(L)}},_=new ResizeObserver(()=>{D()});return t.current&&_.observe(t.current),D(),()=>{_.disconnect()}},[t,r,a,i,C,S,N,E]),n.jsxs("svg",{fill:"none",width:A.width,height:A.height,xmlns:"http://www.w3.org/2000/svg",className:Ve("pointer-events-none absolute top-0 left-0 transform-gpu stroke-2",e),viewBox:`0 0 ${A.width} ${A.height}`,children:[n.jsx("path",{d:R,stroke:m,strokeWidth:h,strokeOpacity:g,strokeLinecap:"round"}),n.jsx("path",{d:R,strokeWidth:h,stroke:`url(#${T})`,strokeOpacity:"1",strokeLinecap:"round"}),n.jsx("defs",{children:n.jsxs($n.linearGradient,{className:"transform-gpu",id:T,gradientUnits:"userSpaceOnUse",initial:{x1:"0%",x2:"0%",y1:"0%",y2:"0%"},animate:{x1:O.x1,x2:O.x2,y1:O.y1,y2:O.y2},transition:{delay:f,duration:u,ease:[.16,1,.3,1],repeat:v,repeatDelay:w},children:[n.jsx("stop",{stopColor:p,stopOpacity:"0"}),n.jsx("stop",{stopColor:p}),n.jsx("stop",{offset:"32.5%",stopColor:b}),n.jsx("stop",{offset:"100%",stopColor:b,stopOpacity:"0"})]})})]})};function zn({className:e,...t}){return n.jsx("label",{"data-slot":"label",className:ws("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 hE={working:{icon:Ql,tone:"text-muted-foreground animate-spin motion-reduce:animate-none",title:e=>`Connecting to ${e.host}`},"needs-docker":{icon:Ek,tone:"text-amber-500",title:e=>`Docker isn’t installed on ${e.host}`},"needs-install":{icon:Ek,tone:"text-amber-500",title:e=>`${e.host} needs the runtime images`},failed:{icon:OL,tone:"text-destructive",title:e=>`Couldn’t connect to ${e.host}`}};function zw({onConnected:e,onBack:t,initialHost:r,connectedHost:a=null,onUseConnected:i}){var $,U;const[c,u]=x.useState(null),[f,m]=x.useState("download"),[h,g]=x.useState(""),[p,b]=x.useState(null),[v,w]=x.useState(null),[C,S]=x.useState(null),[N,E]=x.useState(!1),[T,R]=x.useState(null),[M,A]=x.useState(null),[k,O]=x.useState(0),D=x.useRef(0),_=x.useRef(null),H=x.useRef(!1),G=x.useRef(null),B=x.useId(),P=x.useCallback(F=>{H.current||(H.current=!0,en.finishFlow(G.current,"connected"),e(F))},[e]);x.useEffect(()=>{!p||!G.current||(p.status==="needs-docker"?en.step(G.current,"needs_docker","blocked","docker_missing"):p.status==="needs-install"?en.step(G.current,"needs_runtime","blocked","runtime_missing"):p.status==="failed"&&en.finishFlow(G.current,"failed",Cu({message:p.error})))},[p==null?void 0:p.status,p==null?void 0:p.id]),x.useEffect(()=>{const F=new AbortController,Y=++D.current,ne=setTimeout(()=>F.abort(new Error("Reading hosts timed out. Try refreshing.")),1e4);return E(!0),R(null),A(null),cs.connections(F.signal).then(te=>{if(D.current!==Y)return;u(te);const{host:ye,job:ae}=KK(te,r,_.current);b(ae),ae&&m(ae.runtimeInstallation||"download"),g(ye)}).catch(te=>{D.current===Y&&te.name!=="AbortError"&&R(te.message)}).finally(()=>{clearTimeout(ne),D.current===Y&&E(!1)}),()=>{F.abort(),clearTimeout(ne),D.current+=1}},[k,r]),x.useEffect(()=>{if((p==null?void 0:p.status)!=="working"||M||C)return;const F=new AbortController;let Y;async function ne(){try{const te=await cs.connectionJob(p.id,F.signal);if(F.signal.aborted)return;b(te),te.status==="ready"?P(te):te.status==="working"&&(Y=setTimeout(ne,1e3))}catch(te){F.signal.aborted||A(te.message)}}return Y=setTimeout(ne,500),()=>{F.abort(),clearTimeout(Y)}},[p==null?void 0:p.id,p==null?void 0:p.status,M,C,P]);async function V(F,Y){var ne;(F==="connect"||((ne=G.current)==null?void 0:ne.outcome)==="failed")&&(G.current=en.startFlow("gateway_connection",{location_type:"ssh"},G.current)),S(F),R(null),A(null);try{const te=await Y();b(te),te.status==="ready"&&P(te)}catch(te){en.finishFlow(G.current,"failed",Cu(te)),R(te.message)}finally{S(null)}}const q=(c==null?void 0:c.hosts)??[],W=q.find(F=>F.name===h),K=!!C||(p==null?void 0:p.status)==="working",J=(p==null?void 0:p.status)==="needs-install"||(p==null?void 0:p.status)==="needs-docker",z=c&&!c.tools.ssh,L=p&&p.host===h&&hE[p.status]?hE[p.status]:null,X=()=>O(F=>F+1),ee=!!(a&&i&&h===a&&!p);return n.jsxs("div",{className:"grid gap-6 text-xs",children:[n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 md:gap-8",children:[n.jsx("div",{className:"grid min-w-0 content-start gap-5",children:n.jsx(WK,{host:(W==null?void 0:W.label)??(h||"Your server"),live:(p==null?void 0:p.status)==="working"||ee})}),n.jsxs("div",{className:"grid min-w-0 content-start gap-5",children:[n.jsxs("div",{className:"grid gap-2",children:[n.jsx(zn,{htmlFor:`${B}-host`,className:"text-xs",children:"SSH host"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(pn,{id:`${B}-host`,className:"flex-1",value:h,disabled:K||!q.length,onChange:F=>{_.current=F.target.value,g(F.target.value),b(null),w(null),R(null),A(null)},children:[n.jsx("option",{value:"",disabled:!0,children:q.length?"Choose a host":"No hosts in ~/.ssh/config"}),!!h&&!W&&n.jsxs("option",{value:h,disabled:!0,children:[h," · Missing from SSH config"]}),q.map(F=>n.jsx("option",{value:F.name,children:F.label??F.name},F.name))]}),n.jsx(le,{type:"button",variant:"outline",size:"icon","aria-label":"Refresh hosts",disabled:!!C||N,onClick:X,children:n.jsx(rl,{className:`size-3.5 ${N?"animate-spin motion-reduce:animate-none":""}`})})]}),c&&h&&!W&&n.jsxs("p",{role:"status",className:"text-muted-foreground",children:[h," is no longer in your SSH config. Add it again in Connections, or restore its SSH config entry and refresh."]}),ee?n.jsx("p",{className:"text-muted-foreground",children:"Connected now. Choose another host to replace this connection."}):a&&W&&n.jsxs("p",{className:"text-muted-foreground",children:["Connecting ",h," replaces the connection to ",a,"."]}),W&&!W.managed&&!ee&&n.jsxs("p",{className:"text-muted-foreground",children:["First time? Run ",n.jsxs("code",{className:"rounded bg-muted px-1 font-mono text-foreground",children:["ssh ",h]})," once to trust the machine."]}),z&&n.jsx(tp,{children:"OpenSSH isn’t installed on this computer. Install it, then refresh."})]}),n.jsxs(XK,{children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("p",{className:"font-medium text-foreground",children:"If the host is missing the runtime images"}),n.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(([F,Y])=>n.jsx("button",{type:"button",role:"radio","aria-checked":f===F,disabled:K||J,onClick:()=>m(F),className:`rounded-md px-2.5 py-1 transition-colors disabled:opacity-60 ${f===F?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:Y},F))})]}),n.jsxs("ul",{className:"grid list-disc gap-1.5 pl-4",children:[n.jsx("li",{children:"Needs Linux with Docker. On Ubuntu or Debian, OpenRod can install Docker (it asks first; needs passwordless sudo)."}),n.jsx("li",{children:"Docker access is admin access. Connect only to machines you trust."}),n.jsx("li",{children:"The host gets credentials for its own gateway, never your main one."}),n.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."})]})]})]})]}),L&&n.jsxs("div",{role:"status","aria-live":"polite",className:"grid gap-3 rounded-xl border border-border bg-muted/20 p-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(L.icon,{className:`mt-0.5 size-4 shrink-0 ${L.tone}`}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"font-medium text-foreground",children:L.title(p)}),p.stage&&p.stage!=="Connection failed"&&n.jsx("p",{className:"mt-0.5 break-words whitespace-pre-wrap text-muted-foreground",children:p.stage})]})]}),p.probe&&n.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(F=>n.jsx("span",{className:"rounded-full border border-border bg-background px-2 py-0.5 text-[10px] text-muted-foreground",children:F},F))}),p.status==="needs-docker"&&(($=p.probe)!=null&&$.dockerInstallSupported?n.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[n.jsxs("p",{className:"text-muted-foreground",children:["OpenRod will install ",n.jsx("code",{className:"font-mono",children:"docker.io"}),", start it, and add your SSH user to the ",n.jsx("code",{className:"font-mono",children:"docker"})," group (root-equivalent). Nothing changes unless you approve."]}),n.jsx(le,{type:"button",size:"sm",className:"justify-self-start",disabled:K,onClick:()=>V("docker",()=>cs.installConnectionDocker(p.id)),children:C==="docker"?"Starting…":"Install Docker and continue"})]}):n.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[n.jsxs("p",{className:"text-muted-foreground",children:[((U=p.probe)==null?void 0:U.dockerInstallReason)||"Automatic install works on Ubuntu and Debian only."," Install Docker yourself, then check again."]}),n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:K,onClick:()=>V("connect",()=>cs.connect({host:p.host,runtimeInstallation:f})),children:"Check again"})]})),p.status==="needs-install"&&n.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:K,onClick:()=>V("download",()=>cs.installConnectionRuntime(p.id)),children:C==="download"?"Starting download…":"Download on host"}),n.jsxs("p",{className:"text-muted-foreground",children:["Or upload a ",n.jsx("code",{className:"font-mono",children:"docker save"})," .tar with the sandbox, supervisor and gateway images for this host’s architecture."]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ot,{"aria-label":"Docker-save package (.tar)",type:"file",accept:".tar,application/x-tar",className:"h-8 flex-1 text-xs",disabled:K,onChange:F=>{var Y;w(((Y=F.target.files)==null?void 0:Y[0])??null),R(null)}}),n.jsx(le,{type:"button",variant:"outline",size:"sm",disabled:K||!(v!=null&&v.name.toLowerCase().endsWith(".tar")),onClick:()=>V("upload",()=>cs.uploadConnectionPackage(p.id,v)),children:C==="upload"?"Uploading…":"Upload"})]}),v&&!v.name.toLowerCase().endsWith(".tar")&&n.jsx(tp,{children:"Choose an uncompressed .tar archive."})]})]}),(T||L&&p.error)&&n.jsx(tp,{children:T||p.error}),M&&n.jsxs(tp,{children:["Lost track of progress: ",M," It may still be running. Refresh to check."]}),n.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-4",children:[n.jsx(le,{type:"button",variant:"ghost",className:"mr-auto",disabled:!!C,onClick:t,children:"Back"}),ee?n.jsxs(le,{type:"button",onClick:i,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:["Continue with ",a]}):n.jsx(le,{type:"button",disabled:K||!W||z||J,onClick:()=>V("connect",()=>cs.connect({host:h,runtimeInstallation:f})),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:C==="connect"||(p==null?void 0:p.status)==="working"?n.jsxs(n.Fragment,{children:[n.jsx(Ql,{className:"size-3.5 animate-spin"}),"Connecting…"]}):(p==null?void 0:p.status)==="failed"&&p.host===h?"Try again":"Connect"})]})]})}function tp({children:e}){return n.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 XK({children:e}){const[t,r]=x.useState(!1);return n.jsxs("div",{children:[n.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:[n.jsx(Du,{className:"size-3.5"}),"Requirements & safety",n.jsx(ha,{className:`ml-auto size-3.5 transition-transform ${t?"rotate-180":""}`})]}),t&&n.jsx("div",{className:"grid gap-4 pt-3 text-muted-foreground",children:e})]})}function WK({host:e,live:t}){const r=x.useRef(null),a=x.useRef(null),i=x.useRef(null),c=(u,f,m,h)=>n.jsxs("div",{className:"z-10 flex flex-col items-center gap-2 text-center",children:[n.jsx("span",{ref:u,className:"flex size-11 items-center justify-center rounded-2xl border border-border bg-background shadow-sm",children:n.jsx(f,{className:"size-5"})}),n.jsxs("span",{children:[n.jsx("span",{className:"block max-w-32 truncate font-medium text-foreground",children:m}),n.jsx("span",{className:"block text-[10px] text-muted-foreground",children:h})]})]});return n.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,Z1,"This computer","Gateway"),n.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(i,$f,e,"Docker · sandboxes"),n.jsx(x4,{containerRef:r,fromRef:a,toRef:i,duration:t?2.5:5,pathOpacity:.25,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})}function QK({width:e=16,height:t=16,x:r=0,y:a=0,cx:i=1,cy:c=1,cr:u=1,className:f,glow:m=!1,...h}){const g=x.useId(),p=x.useRef(null),[b,v]=x.useState({width:0,height:0});x.useEffect(()=>{const C=()=>{if(p.current){const{width:S,height:N}=p.current.getBoundingClientRect();v({width:S,height:N})}};return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const w=Array.from({length:Math.ceil(b.width/e)*Math.ceil(b.height/t)},(C,S)=>{const N=S%Math.ceil(b.width/e),E=Math.floor(S/Math.ceil(b.width/e));return{x:N*e+i+r,y:E*t+c+a,delay:Math.random()*5,duration:Math.random()*3+2}});return n.jsxs("svg",{ref:p,"aria-hidden":"true",className:Ve("pointer-events-none absolute inset-0 h-full w-full text-neutral-400/80",f),...h,children:[n.jsx("defs",{children:n.jsxs("radialGradient",{id:`${g}-gradient`,children:[n.jsx("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),n.jsx("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0"})]})}),w.map(C=>n.jsx($n.circle,{cx:C.x,cy:C.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:C.duration,repeat:1/0,repeatType:"reverse",delay:C.delay,ease:"easeInOut"}:{}},`${C.x}-${C.y}`))]})}function Iw({step:e,subject:t="sandbox"}){return n.jsx("ol",{"aria-label":"Steps",className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:["Location",t==="setup"?"Setup":t==="template"?"Template":"Sandbox"].map((r,a)=>{const i=a+1===e,c=a+1<e;return n.jsxs(x.Fragment,{children:[a>0&&n.jsx("span",{"aria-hidden":"true",className:`h-px w-6 transition-colors ${c||i?"bg-foreground/40":"bg-border"}`}),n.jsxs("li",{"aria-current":i?"step":void 0,className:`flex items-center gap-1.5 transition-colors ${i?"text-foreground":""}`,children:[n.jsx("span",{className:`flex size-4 items-center justify-center rounded-full text-[9px] font-semibold transition-colors ${i?"bg-foreground text-background":c?"bg-foreground/15 text-foreground":"border border-border"}`,children:a+1}),r]})]},r)})})}function b4({location:e,onChange:t}){return n.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.cloud||(e==null?void 0:e.target)==="cloud"?n.jsx(Kp,{"aria-hidden":"true",className:"size-3"}):e!=null&&e.remote?n.jsx($f,{"aria-hidden":"true",className:"size-3"}):n.jsx(Z1,{"aria-hidden":"true",className:"size-3"}),n.jsx("span",{className:"max-w-40 truncate text-foreground",children:e!=null&&e.cloud||(e==null?void 0:e.target)==="cloud"?"OpenRod Cloud":e!=null&&e.remote?tf(e):"This computer"}),n.jsx(le,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-full px-2 text-[11px]",onClick:t,children:"Change"})]})}const tf=e=>{var t;return((t=e==null?void 0:e.label)==null?void 0:t.replace(/^SSH · /,""))??(e==null?void 0:e.gateway)};function mE({live:e}){const t=Zs(),r=x.useId();return n.jsxs("svg",{viewBox:"0 0 72 48",className:"h-16 w-auto text-foreground","aria-hidden":"true",children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:`${r}-screen`,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0",stopColor:"currentColor",stopOpacity:"0.14"}),n.jsx("stop",{offset:"1",stopColor:"currentColor",stopOpacity:"0.03"})]})}),n.jsx("rect",{x:"10",y:"2",width:"52",height:"34",rx:"3.5",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55"}),n.jsx("rect",{x:"13.5",y:"5.5",width:"45",height:"27",rx:"1.5",fill:`url(#${r}-screen)`}),n.jsx("rect",{x:"18",y:"11",width:"14",height:"1.6",rx:"0.8",fill:"currentColor",fillOpacity:"0.45"}),n.jsx("rect",{x:"18",y:"16",width:"22",height:"1.6",rx:"0.8",fill:"currentColor",fillOpacity:"0.3"}),n.jsx("rect",{x:"18",y:"21",width:"9",height:"1.6",rx:"0.8",fill:"#10b981",fillOpacity:"0.8"}),n.jsx($n.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]}}),n.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"}),n.jsx("rect",{x:"30",y:"38.5",width:"12",height:"1.6",rx:"0.8",fill:"currentColor",fillOpacity:"0.35"})]})}function v4({live:e}){const t=Zs();return n.jsx("svg",{viewBox:"0 0 52 50",className:"h-[60px] w-auto text-foreground","aria-hidden":"true",children:[0,1,2].map(r=>n.jsxs("g",{children:[n.jsx("rect",{x:"2",y:2+r*16,width:"48",height:"13",rx:"3",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55"}),n.jsxs(n.Fragment,{children:[n.jsx($n.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}}),n.jsx("circle",{cx:"14.5",cy:8.5+r*16,r:"1.6",fill:"currentColor",fillOpacity:"0.25"}),[0,1,2,3].map(a=>n.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 y4(){return n.jsx("svg",{viewBox:"0 0 76 48",className:"h-16 w-auto text-foreground","aria-hidden":"true",children:n.jsxs("g",{transform:"translate(0 3)",children:[n.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=>n.jsx("rect",{x:24+e*10,y:"26",width:"7",height:"7",rx:"1.5",fill:"currentColor",fillOpacity:.3-e*.07},e))]})})}function ZK({kind:e,live:t}){const r=x.useRef(null),a=x.useRef(null),i=x.useRef(null);return n.jsxs("div",{ref:r,className:"relative flex h-36 items-center justify-center gap-14",children:[n.jsx(QK,{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"&&n.jsx("span",{className:"relative z-10",children:n.jsx(y4,{})}),e==="local"&&n.jsx("span",{className:"relative z-10 transition-transform duration-500 group-hover:scale-105",children:n.jsx(mE,{live:t})}),e==="remote"&&n.jsxs(n.Fragment,{children:[n.jsx("span",{ref:a,className:"relative z-10 transition-transform duration-500 group-hover:-translate-x-1",children:n.jsx(mE,{live:t})}),n.jsx("span",{ref:i,className:"relative z-10 transition-transform duration-500 group-hover:translate-x-1",children:n.jsx(v4,{live:t})}),n.jsx(x4,{containerRef:r,fromRef:a,toRef:i,duration:t?2.5:4,pathOpacity:.3,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})]})}function ey({index:e,scene:t,live:r,title:a,caption:i,tone:c="idle",disabled:u,onClick:f,trailing:m}){const h=Zs(),g=p=>{const b=p.currentTarget.getBoundingClientRect();p.currentTarget.style.setProperty("--x",`${p.clientX-b.left}px`),p.currentTarget.style.setProperty("--y",`${p.clientY-b.top}px`)};return n.jsxs($n.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:[n.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%)"}}),n.jsx(ZK,{kind:t,live:r}),n.jsxs("span",{className:"relative flex items-center gap-3 px-4 pt-1 pb-4",children:[n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-sm font-medium",children:a}),n.jsxs("span",{className:"flex items-center gap-1.5 truncate text-xs text-muted-foreground",children:[c!=="idle"&&n.jsx("span",{"aria-hidden":"true",className:`size-1.5 shrink-0 rounded-full ${c==="live"?"bg-emerald-500":"bg-amber-500"}`}),i]})]}),m||n.jsx(Zi,{"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 Ox({locations:e,allowRemote:t,onPick:r,onConnected:a,onCancel:i,connecting:c,subject:u="sandbox"}){const f=Zs(),m=js(),[h,g]=x.useState("choose"),[p,b]=x.useState(!1),[v,w]=x.useState(""),[C,S]=x.useState(!1),N=x.useRef(null);x.useEffect(()=>()=>{var z;return(z=N.current)==null?void 0:z.abort()},[]);const[E,T]=x.useState(null),[R,M]=x.useState(!1),[A,k]=x.useState(!1),[O,D]=x.useState(null),_=e.find(z=>z.cloud||z.target==="cloud"),H=e.find(z=>!z.remote&&!z.cloud&&z.target!=="cloud"),G=e.find(z=>z.remote&&!z.cloud&&z.target!=="cloud"),B=!(m!=null&&m.localViewer)&&!!_;x.useEffect(()=>{C&&(_!=null&&_.connected)&&(S(!1),b(!1),r(_.id??_.context))},[C,_,r]),x.useEffect(()=>{if(!C)return;const z=setTimeout(()=>{S(!1),b(!1),D("Cloud is ready but its locations could not load. Refresh the connection and try again.")},6e4);return()=>clearTimeout(z)},[C]);async function P(){if(_!=null&&_.connected){r(_.id??_.context);return}const z=new AbortController;N.current=z,D(null),b(!0),w(m!=null&&m.connected?"Preparing…":"Signing in…");try{await m.prepare({signal:z.signal,onProgress:L=>{var X;return w(((X=L.machine)==null?void 0:X.status)==="ready"?"Loading workspace…":"Preparing…")}}),z.signal.throwIfAborted(),S(!0),a==null||a({target:"cloud",gateway:null})}catch(L){L.name!=="AbortError"&&D(L.message),b(!1),S(!1)}finally{N.current=null}}function V(){var z,L;(z=N.current)==null||z.abort(),(L=m==null?void 0:m.cancelConnect)==null||L.call(m),S(!1),b(!1)}x.useEffect(()=>{if(H||!t)return;let z=!0;return cs.connections().then(L=>{var X;z&&(T(L.locals),M(((X=L.tools)==null?void 0:X.openshell)===!1))}).catch(()=>{z&&T([])}),()=>{z=!1}},[H,t]);async function q(){k(!0),D(null);try{const z=await x7(cs,E[0].name);a(z)}catch(z){D(z.message),k(!1)}}const W=f?{}:{initial:{opacity:0,x:h==="remote"?24:-24},animate:{opacity:1,x:0},exit:{opacity:0,x:h==="remote"?-24:24},transition:{duration:.22,ease:[.22,1,.36,1]}},K=H?H.connected?"Local gateway":"Disconnected":E!=null&&E.length?`Use ${E[0].name}`:E?R?"OpenShell isn’t installed":"No local gateway running":"Checking…",J=p?v:_!=null&&_.connected?"Ready to use":m!=null&&m.checking?"Checking connection…":m!=null&&m.available?m!=null&&m.connected?"Start cloud machine":"Connect your account":"Coming soon";return n.jsxs("div",{className:"flex min-h-0 flex-col gap-6 rounded-xl bg-popover p-7 ring-1 ring-foreground/10",children:[n.jsxs(sn,{className:"gap-3",children:[!["workspace","resource"].includes(u)&&n.jsx(Iw,{step:1,subject:u}),n.jsxs("div",{className:"flex items-center gap-2",children:[h==="remote"&&n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Back to locations",onClick:()=>g("choose"),children:n.jsx(K1,{})}),n.jsx(Qt,{children:h==="remote"?"Connect a machine":u==="resource"?"Create in":u==="workspace"?"Work in":u==="setup"?"Import to":"Where should it run?"})]}),n.jsx(Sn,{className:h==="remote"||["setup","workspace","resource"].includes(u)?"sr-only":"text-xs",children:h==="remote"?`Connect an SSH host to ${u==="workspace"?"work on":u==="setup"?"import your setup to":u==="sandbox"?"run sandboxes on":"build templates on"}.`:u==="workspace"?"Choose a working location.":`Pick a location for this ${u}.`})]}),n.jsx("div",{className:"-m-2 min-h-0 flex-1 overflow-x-hidden overflow-y-auto p-2",children:n.jsx(lc,{mode:"wait",initial:!1,children:h==="choose"?n.jsxs($n.div,{...W,className:"grid gap-3",children:[n.jsxs("div",{className:`grid gap-4 ${t?"sm:grid-cols-3":_&&!B?"sm:grid-cols-2":""}`,children:[!B&&n.jsx(ey,{index:0,scene:"local",live:H==null?void 0:H.connected,title:"This computer",caption:K,tone:H!=null&&H.connected?"live":"idle",disabled:H?!H.connected:!(E!=null&&E.length)||A,onClick:()=>H?r(H.id??H.context):q(),trailing:A&&n.jsx(Ql,{className:"size-4 animate-spin text-muted-foreground"})}),t&&n.jsx(ey,{index:1,scene:"remote",live:G==null?void 0:G.connected,title:"Remote machine",caption:G!=null&&G.connected?`Connected · ${tf(G)}`:G?`${tf(G)} · Disconnected`:"Your server, over SSH",tone:G!=null&&G.connected?"live":G?"warn":"idle",onClick:()=>g("remote")}),(t||_)&&n.jsx(ey,{index:2,scene:"cloud",title:"OpenRod Cloud",caption:J,live:_==null?void 0:_.connected,tone:_!=null&&_.connected?"live":p?"warn":"idle",disabled:p||!(_!=null&&_.connected)&&(!(m!=null&&m.available)||(m==null?void 0:m.checking)),onClick:P,trailing:p?n.jsx(Ql,{className:"size-4 animate-spin text-muted-foreground"}):void 0})]}),p&&n.jsxs("div",{role:"status",className:"flex items-center justify-between gap-3 text-xs text-muted-foreground",children:[n.jsx("span",{children:v==="Signing in…"?"Complete sign-in in the new window.":C?"Loading your cloud locations…":"Preparing OpenRod Cloud. The first start can take a few minutes."}),n.jsx(le,{variant:"ghost",size:"sm",onClick:V,children:"Cancel"})]}),O&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:O}),n.jsx("div",{className:"mt-3 flex justify-end",children:n.jsx(le,{type:"button",variant:"ghost",onClick:()=>{V(),i()},children:"Cancel"})})]},"choose"):n.jsx($n.div,{...W,children:c?n.jsxs("div",{role:"status",className:"grid place-items-center gap-3 py-16 text-xs text-muted-foreground",children:[n.jsx(Ql,{className:"size-5 animate-spin"}),"Connected. Opening the ",u," form…"]}):n.jsx(zw,{initialHost:G?tf(G):void 0,connectedHost:G!=null&&G.connected?tf(G):null,onUseConnected:()=>r(G.id??G.context),onConnected:a,onBack:()=>g("choose")})},"remote")})})]})}function JK(e,{offerCloud:t=!1}={}){const[r]=e;return e.length===1&&!r.remote&&r.connected&&!t?r:null}function Dx({children:e,onClose:t,subject:r="resource"}){const a=vo(),i=js(),[c,u]=x.useState(null),[f,m]=x.useState(null);x.useEffect(()=>{if(!f)return;const b=a.locations.find(v=>v.target==="local"&&v.gateway===f&&v.connected);b&&(u(b),m(null))},[f,a.locations]);const h=a.loading||(i==null?void 0:i.localViewer)&&(i==null?void 0:i.checking),g=!c&&!h?JK(a.locations,{offerCloud:!!(i!=null&&i.localViewer&&(i!=null&&i.available))}):null;g&&u(g);const p=c??g;return p?n.jsx(Zn,{location:p,children:e(p,t)}):n.jsx(tn,{open:!0,onOpenChange:b=>{b||t()},children:n.jsx(nn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:n.jsx(Ox,{locations:a.locations,allowRemote:!!(i!=null&&i.localViewer),subject:r,connecting:!!f,onPick:b=>u(a.locations.find(v=>(v.id??v.context)===b&&v.connected)),onConnected:b=>{m(b.gateway),a.refresh()},onCancel:t})})})}function Af({value:e,startValue:t=0,direction:r="up",delay:a=0,className:i,decimalPlaces:c=0,...u}){const f=x.useRef(null),m=Zs(),h=Tw(r==="down"?e:t),g=IY(h,{damping:60,stiffness:100}),p=r4(f,{once:!0,margin:"0px"}),b=x.useCallback(v=>Intl.NumberFormat("en-US",{minimumFractionDigits:c,maximumFractionDigits:c}).format(Number(v.toFixed(c))),[c]);return x.useEffect(()=>{if(!p)return;const v=setTimeout(()=>h.set(r==="down"?t:e),a*1e3);return()=>clearTimeout(v)},[h,p,a,e,r,t]),x.useEffect(()=>g.on("change",v=>{f.current&&!m&&(f.current.textContent=b(v))}),[g,b,m]),x.useEffect(()=>{f.current&&m&&(f.current.textContent=b(e))},[m,e,b]),n.jsx("span",{ref:f,className:Ve("inline-block tabular-nums",i),...u,children:m?b(e):t})}function w4(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 i=[a[0]];for(let u=1;u<t-1;u++)i[u]=a[u-1]*a[u]<=0?0:(a[u-1]+a[u])/2;i[t-1]=a[t-2];for(let u=0;u<t-1;u++){if(a[u]===0){i[u]=0,i[u+1]=0;continue}const f=i[u]/a[u],m=i[u+1]/a[u],h=Math.hypot(f,m);h>3&&(i[u]=3*f/h*a[u],i[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]+i[u]*f).toFixed(2)} ${(e[u+1][0]-f).toFixed(2)} ${(e[u+1][1]-i[u+1]*f).toFixed(2)} ${e[u+1][0].toFixed(2)} ${e[u+1][1].toFixed(2)}`}return c}function j4(e,t,r){const a=r-t*6e4,i=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));i[f][c.verdict]+=1}return i}const eX=e=>new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function S4({points:e,height:t=34,title:r,action:a}){const i=x.useRef(null),c=x.useId(),u=Zs(),[f,m]=x.useState(280),[h,g]=x.useState(null);x.useLayoutEffect(()=>{const M=i.current;if(!M)return;const A=()=>m(M.clientWidth);A();const k=new ResizeObserver(A);return k.observe(M),()=>k.disconnect()},[]);const p=Math.max(4,Math.round(t*.18)),b=e.map(M=>M.allowed+M.denied),v=Math.max(1,...b),w=M=>(e.length<2?f-12:M/(e.length-1)*(f-12))+6,C=M=>t-p-M/v*(t-p*2),S=b.map((M,A)=>[w(A),C(M)]),N=w4(S),E=`${N} L${w(e.length-1).toFixed(2)} ${t} L${w(0).toFixed(2)} ${t} Z`,T=h===null?null:e[h],R=M=>e.reduce((A,k)=>A+k[M],0);return n.jsxs("div",{className:"relative w-full",onMouseLeave:()=>g(null),onMouseMove:M=>{const A=M.currentTarget.getBoundingClientRect(),k=(M.clientX-A.left)/Math.max(1,A.width);g(Math.min(e.length-1,Math.max(0,Math.round(k*(e.length-1)))))},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h2",{className:"min-w-0 truncate text-[10px] font-bold tracking-widest text-faint uppercase",children:T?n.jsxs("span",{className:"font-mono normal-case tracking-normal text-muted-foreground",children:[eX(T.at)," · ",T.allowed," allowed",T.denied?n.jsxs("span",{className:"text-red-600",children:[" · ",T.denied," denied"]}):null]}):r}),n.jsx("span",{className:"ml-auto shrink-0",children:a})]}),n.jsx("div",{ref:i,className:"w-full",children:n.jsxs("svg",{width:f,height:t,role:"img","aria-label":`${R("allowed")} allowed and ${R("denied")} denied connections over ${e.length} minutes`,children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:c,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:"var(--ink)",stopOpacity:"0.1"}),n.jsx("stop",{offset:"100%",stopColor:"var(--ink)",stopOpacity:"0"})]})}),n.jsx("path",{d:E,fill:`url(#${c})`}),n.jsx($n.path,{d:N,fill:"none",stroke:"var(--ink)",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.72",initial:u?!1:{pathLength:0},animate:{pathLength:1},transition:{duration:.9,ease:"easeOut"}}),e.map((M,A)=>M.denied?n.jsx("circle",{cx:w(A),cy:t-2,r:"1.75",fill:"var(--status-error)",opacity:h===A?1:.75},M.at):null),T&&n.jsxs("g",{children:[n.jsx("line",{x1:w(h),x2:w(h),y1:"0",y2:t,stroke:"var(--ink)",strokeWidth:"1",strokeDasharray:"2 3",opacity:"0.25"}),n.jsx("circle",{cx:w(h),cy:C(b[h]),r:"3",fill:"var(--surface)",stroke:"var(--ink)",strokeWidth:"1.5"})]})]})})]})}function yo({value:e,onValueChange:t,className:r,ref:a,...i}){return n.jsxs("div",{className:Ve("relative",r),children:[n.jsx(M8,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground"}),n.jsx(Ot,{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",...i}),e&&n.jsx("button",{type:"button","aria-label":"Clear search",className:"absolute top-1/2 right-2 -translate-y-1/2",onClick:()=>t(""),children:n.jsx(In,{className:"size-3.5"})})]})}function Lo({...e}){return n.jsx(YM,{"data-slot":"sheet",...e})}function tX({...e}){return n.jsx($2,{"data-slot":"sheet-portal",...e})}function nX({className:e,...t}){return n.jsx(l2,{"data-slot":"sheet-overlay",className:Ve("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 la({className:e,children:t,side:r="right",showCloseButton:a=!0,...i}){return n.jsxs(tX,{children:[n.jsx(nX,{}),n.jsxs(L2,{"data-slot":"sheet-content","data-side":r,className:Ve("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),...i,children:[t,a&&n.jsxs(Fg,{"data-slot":"sheet-close",render:n.jsx(le,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[n.jsx(In,{}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ca({className:e,...t}){return n.jsx("div",{"data-slot":"sheet-header",className:Ve("flex flex-col gap-0.5 p-4",e),...t})}function ua({className:e,...t}){return n.jsx(B2,{"data-slot":"sheet-title",className:Ve("font-heading text-base font-medium text-foreground",e),...t})}function da({className:e,...t}){return n.jsx(c2,{"data-slot":"sheet-description",className:Ve("text-sm text-muted-foreground",e),...t})}function sX(e){return qM("alert-dialog",e)}function Fr({...e}){return n.jsx(sX,{"data-slot":"alert-dialog",...e})}function rX({...e}){return n.jsx($2,{"data-slot":"alert-dialog-portal",...e})}function oX({className:e,...t}){return n.jsx(l2,{"data-slot":"alert-dialog-overlay",className:ws("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 Gr({className:e,size:t="default",...r}){return n.jsxs(rX,{children:[n.jsx(oX,{}),n.jsx(L2,{"data-slot":"alert-dialog-content","data-size":t,className:ws("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 qr({className:e,...t}){return n.jsx("div",{"data-slot":"alert-dialog-header",className:ws("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 Yr({className:e,...t}){return n.jsx("div",{"data-slot":"alert-dialog-footer",className:ws("-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 Kr({className:e,...t}){return n.jsx(B2,{"data-slot":"alert-dialog-title",className:ws("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 Xr({className:e,...t}){return n.jsx(c2,{"data-slot":"alert-dialog-description",className:ws("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function Wr({className:e,...t}){return n.jsx(le,{"data-slot":"alert-dialog-action",className:ws(e),...t})}function Qr({className:e,variant:t="outline",size:r="default",...a}){return n.jsx(Fg,{"data-slot":"alert-dialog-cancel",className:ws(e),render:n.jsx(le,{variant:t,size:r}),...a})}const N4=x.createContext(void 0);function zx(e){const t=x.useContext(N4);if(t===void 0&&!e)throw new Error(rn(33));return t}const C4=x.createContext(void 0);function ll(e){const t=x.useContext(C4);if(t===void 0&&!e)throw new Error(rn(36));return t}const aX=x.createContext(void 0);function Pw(e=!0){const t=x.useContext(aX);if(t===void 0&&!e)throw new Error(rn(25));return t}const k4=x.createContext(void 0);function iX(){const e=x.useContext(k4);if(e===void 0)throw new Error(rn(30));return e}function lX(e){const{closeOnClick:t,highlighted:r,id:a,nodeId:i,store:c,typingRef:u,itemRef:f,itemMetadata:m}=e,{events:h}=c.useState("floatingTreeRoot"),g=c.useState("open"),p=Pw(!0),b=p!==void 0;return x.useMemo(()=>({id:a,role:"menuitem",tabIndex:g&&r?0:-1,onKeyDown(v){v.key===" "&&(u!=null&&u.current)&&v.preventDefault()},onMouseMove(v){i&&h.emit("itemhover",{nodeId:i,target:v.currentTarget})},onClick(v){t&&h.emit("close",{domEvent:v,reason:Zl})},onMouseUp(v){if(p){const w=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,b&&w&&Math.abs(v.clientX-w.x)<=1&&Math.abs(v.clientY-w.y)<=1||b&&!u2&&v.button===2)return}f.current&&c.context.allowMouseUpTriggerRef.current&&(!b||v.button===2)&&m.type==="regular-item"&&hu(f.current,v,{detail:1})}}),[t,r,a,h,i,g,c,u,f,p,b,m])}const _w={type:"regular-item"};function Lw(e){const{closeOnClick:t,disabled:r,highlighted:a,id:i,store:c,typingRef:u=c.context.typingRef,nativeButton:f,itemMetadata:m,nodeId:h}=e,g=x.useRef(null),{getButtonProps:p,buttonRef:b}=bo({disabled:r,focusableWhenDisabled:!0,native:f,composite:!0}),v=lX({closeOnClick:t,highlighted:a,id:i,nodeId:h,store:c,typingRef:u,itemRef:g,itemMetadata:m}),w=x.useCallback(S=>Qs(v,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},S,p),[v,p,m]),C=mo(g,b);return x.useMemo(()=>({getItemProps:w,itemRef:C}),[w,C])}const cX="data-checked",uX="data-unchecked",Ix={checked(e){return e?{[cX]:""}:{[uX]:""}},...si},dX=x.forwardRef(function(t,r){const{render:a,className:i,id:c,label:u,nativeButton:f=!1,disabled:m=!1,closeOnClick:h=!1,checked:g,defaultChecked:p,onCheckedChange:b,style:v,...w}=t,C=pc({guess:!0,label:u}),S=zx(!0),N=ys(c),{store:E}=ll(),T=E.useState("disabled"),R=m||T,M=E.useState("isActive",C.index),A=E.useState("itemProps"),[k,O]=po({controlled:g,default:p??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:D,itemRef:_}=Lw({closeOnClick:h,disabled:R,highlighted:M,id:N,store:E,nativeButton:f,nodeId:S==null?void 0:S.context.nodeId,itemMetadata:_w}),H=x.useMemo(()=>({disabled:R,highlighted:M,checked:k}),[R,M,k]);function G(P){const V=yt(Zl,P.nativeEvent,void 0,{preventUnmountOnClose:Ln});b==null||b(!k,V),!V.isCanceled&&O(q=>!q)}const B=Nt("div",t,{state:H,stateAttributesMapping:Ix,props:[A,{role:"menuitemcheckbox","aria-checked":k,onClick:G},w,D],ref:[_,r,C.ref]});return n.jsx(k4.Provider,{value:H,children:B})}),fX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,keepMounted:u=!1,...f}=t,m=iX(),h=x.useRef(null),{transitionStatus:g,mounted:p,setMounted:b}=ni(m.checked);Sr({batch:!0,enabled:!m.checked,open:m.checked,ref:h,onComplete(){m.checked||b(!1)}});const v={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return Nt("span",t,{state:v,ref:[r,h],stateAttributesMapping:Ix,props:{"aria-hidden":!0,...f},enabled:u||p})}),$w=x.createContext(void 0);function hX(){const e=x.useContext($w);if(e===void 0)throw new Error(rn(31));return e}const mX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,[f,m]=x.useState(void 0),h=Nt("div",t,{ref:r,props:{role:"group","aria-labelledby":f,...u}});return n.jsx($w.Provider,{value:m,children:h})}),pX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,id:u,...f}=t,m=ys(u),h=hX();return We(()=>(h(m),()=>{h(g=>g===m?void 0:g)}),[h,m]),Nt("div",t,{ref:r,props:{id:m,"aria-hidden":!0,...f}})}),gX=x.forwardRef(function(t,r){const{render:a,className:i,id:c,label:u,nativeButton:f=!1,disabled:m=!1,closeOnClick:h=!0,style:g,...p}=t,b=pc({guess:!0,label:u}),v=zx(!0),w=ys(c),{store:C}=ll(),S=C.useState("disabled"),N=m||S,E=C.useState("isActive",b.index),T=C.useState("itemProps"),{getItemProps:R,itemRef:M}=Lw({closeOnClick:h,disabled:N,highlighted:E,id:w,store:C,nativeButton:f,nodeId:v==null?void 0:v.context.nodeId,itemMetadata:_w});return Nt("div",t,{state:{disabled:N,highlighted:E},props:[T,p,R],ref:[M,r,b.ref]})}),xX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,finalFocus:u,...f}=t,{store:m}=ll(),{side:h,align:g}=zx(),p=vx()!=null,b=m.useState("open"),v=m.useState("transitionStatus"),w=m.useState("popupProps"),C=m.useState("mounted"),S=m.useState("instantType"),N=m.useState("activeTriggerElement"),E=m.useState("parent"),T=m.useState("lastOpenChangeReason"),R=m.useState("rootId"),M=m.useState("floatingRootContext"),A=m.useState("floatingTreeRoot"),k=m.useState("closeDelay"),O=m.useState("hoverEnabled"),D=m.useState("disabled"),_=m.useState("openMethod"),H=E.type==="context-menu";Sr({open:b,ref:m.context.popupRef,onComplete(){var q,W;b&&((W=(q=m.context).onOpenChangeComplete)==null||W.call(q,!0))}}),x.useEffect(()=>{function q(W){m.setOpen(!1,yt(W.reason,W.domEvent))}return A.events.on("close",q),()=>{A.events.off("close",q)}},[A.events,m]),I2(M,{enabled:O&&!D&&!H&&E.type!=="menubar",closeDelay:k});const G=m.useStateSetter("popupElement"),B={transitionStatus:v,side:h,align:g,open:b,nested:E.type==="menu",instant:S},P=Nt("div",t,{state:B,ref:[r,m.context.popupRef,G],stateAttributesMapping:Hg,props:[w,{onKeyDown(q){p&&Zf.has(q.key)&&q.stopPropagation()}},th(v),f,{"data-rootownerid":R}]});let V=E.type===void 0||H;return(N||E.type==="menubar"&&T!==Vg)&&(V=!0),n.jsx(Jg,{context:M,openInteractionType:_,modal:H,disabled:!C,returnFocus:u===void 0?V:u,initialFocus:E.type!=="menu",restoreFocus:!0,externalTree:E.type!=="menubar"?A:void 0,previousFocusableElement:N,nextFocusableElement:E.type===void 0?m.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:E.type===void 0?m.context.beforeContentFocusGuardRef:void 0,children:P})}),T4=x.createContext(void 0);function bX(){const e=x.useContext(T4);if(e===void 0)throw new Error(rn(32));return e}const vX=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t,{store:c,parent:u}=ll();if(!(c.useState("mounted")||a))return null;const h=u.type==="menu"||u.type==="menubar"?"group":void 0;return n.jsx(T4.Provider,{value:a,children:n.jsx(Zg,{ref:r,...i,portalOwnerRole:h})})}),yX=x.forwardRef(function(t,r){var Ie;const{anchor:a,positionMethod:i="absolute",className:c,render:u,side:f,align:m,sideOffset:h=0,alignOffset:g=0,collisionBoundary:p="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:w=!1,disableAnchorTracking:C=!1,collisionAvoidance:S=xM,style:N,...E}=t,{store:T}=ll(),R=bX(),M=Pw(!0),A=T.useState("parent"),k=T.useState("floatingRootContext"),O=T.useState("floatingTreeRoot"),D=T.useState("mounted"),_=T.useState("open"),H=T.useState("modal"),G=T.useState("openMethod"),B=T.useState("activeTriggerElement"),P=T.useState("transitionStatus"),V=T.useState("positionerElement"),q=T.useState("instantType"),W=T.useState("adaptiveOrigin"),K=T.useState("lastOpenChangeReason"),J=T.useState("floatingNodeId"),z=T.useState("floatingParentNodeId"),L=k.useState("domReferenceElement"),X=x.useRef(null),ee=Gf(V);let $=a,U=h,F=g,Y=m,ne=S;A.type==="context-menu"&&($=a??((Ie=A.context)==null?void 0:Ie.anchor),Y=Y??"start",!f&&Y!=="center"&&(F=t.alignOffset??2,U=t.sideOffset??-5));let te=f,ye=Y;A.type==="menu"?(te=te??"inline-end",ye=ye??"start",ne=t.collisionAvoidance??v2):A.type==="menubar"&&(te=te??(A.context.orientation==="vertical"?"inline-end":"bottom"),ye=ye??"start");const ae=A.type==="context-menu",ue=xx({anchor:$,floatingRootContext:k,positionMethod:M?"fixed":i,mounted:D,side:te,sideOffset:U,align:ye,alignOffset:F,arrowPadding:ae?0:v,collisionBoundary:p,collisionPadding:b,sticky:w,nodeId:J,keepMounted:R,disableAnchorTracking:C,collisionAvoidance:ne,shift:ae?{crossAxis:!("side"in ne&&ne.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:O,adaptiveOrigin:W});x.useEffect(()=>{function ce(Te){Te.open&&(Te.parentNodeId===J&&T.set("hoverEnabled",!1),Te.nodeId!==J&&Te.parentNodeId===T.select("floatingParentNodeId")&&T.setOpen(!1,yt(Xd)))}return O.events.on("menuopenchange",ce),()=>{O.events.off("menuopenchange",ce)}},[T,O.events,J]),x.useEffect(()=>{if(T.select("floatingParentNodeId")==null)return;function ce(Te){if(Te.open||Te.nodeId!==T.select("floatingParentNodeId"))return;const re=Te.reason??Xd;T.setOpen(!1,yt(re))}return O.events.on("menuopenchange",ce),()=>{O.events.off("menuopenchange",ce)}},[O.events,T]);const se=us();x.useEffect(()=>{_||se.clear()},[_,se]),x.useEffect(()=>{function ce(Te){if(!(!_||Te.nodeId!==T.select("floatingParentNodeId")))if(Te.target&&B&&B!==Te.target){const re=T.select("closeDelay");re>0?se.isStarted()||se.start(re,()=>{T.setOpen(!1,yt(Xd))}):T.setOpen(!1,yt(Xd))}else se.clear()}return O.events.on("itemhover",ce),()=>{O.events.off("itemhover",ce)}},[O.events,_,B,T,se]),x.useEffect(()=>{const ce={open:_,nodeId:J,parentNodeId:z,reason:T.select("lastOpenChangeReason")};O.events.emit("menuopenchange",ce)},[O.events,_,T,J,z]),We(()=>{const ce=L,Te=X.current;if(ce&&(X.current=ce),Te&&ce&&ce!==Te){T.set("instantType",void 0);const re=new AbortController;return ee(()=>{T.set("instantType","trigger-change")},re.signal),()=>{re.abort()}}},[L,ee,T]);const Q={open:_,side:ue.side,align:ue.align,anchorHidden:ue.anchorHidden,nested:A.type==="menu",instant:q},ie=A.type==="menubar"&&A.context.modal;H2(_&&(ie||H&&K!==Qn),G==="touch",V,B);const pe=bx(t,Q,{styles:ue.positionerStyles,transitionStatus:P,props:E,refs:[r,T.useStateSetter("positionerElement")],hidden:!D,inert:!_}),xe=D&&A.type!=="menu"&&(A.type!=="menubar"&&H&&K!==Qn||A.type==="menubar"&&A.context.modal);let je=null;return A.type==="menubar"?je=A.context.contentElement:A.type===void 0&&(je=B),n.jsxs(N4.Provider,{value:ue,children:[xe&&n.jsx(cx,{ref:A.type==="context-menu"||A.type==="nested-context-menu"?A.context.internalBackdropRef:null,inert:Jf(!_),cutout:je}),n.jsx(NM,{id:J,children:n.jsx(eh,{elementsRef:T.context.itemDomElements,labelsRef:T.context.itemLabels,children:pe})})]})}),E4=x.createContext(void 0);function wX(){const e=x.useContext(E4);if(e===void 0)throw new Error(rn(34));return e}const jX=x.memo(x.forwardRef(function(t,r){const{render:a,className:i,value:c,defaultValue:u,onValueChange:f,disabled:m=!1,style:h,"aria-labelledby":g,...p}=t,[b,v]=x.useState(void 0),[w,C]=po({controlled:c,default:u,name:"MenuRadioGroup"}),S=st((R,M)=>{f==null||f(R,M),!M.isCanceled&&C(R)}),E=Nt("div",t,{state:{disabled:m},ref:r,props:{role:"group","aria-labelledby":g??b,"aria-disabled":m||void 0,...p}}),T=x.useMemo(()=>({value:w,setValue:S,disabled:m}),[w,S,m]);return n.jsx($w.Provider,{value:v,children:n.jsx(E4.Provider,{value:T,children:E})})})),R4=x.createContext(void 0);function SX(){const e=x.useContext(R4);if(e===void 0)throw new Error(rn(35));return e}const NX=x.forwardRef(function(t,r){const{render:a,className:i,id:c,label:u,nativeButton:f=!1,disabled:m=!1,closeOnClick:h=!1,value:g,style:p,...b}=t,v=pc({guess:!0,label:u}),w=zx(!0),C=ys(c),{store:S}=ll(),N=S.useState("isActive",v.index),E=S.useState("itemProps"),{value:T,setValue:R,disabled:M}=wX(),A=S.useState("disabled"),k=m||M||A,O=T===g,{getItemProps:D,itemRef:_}=Lw({closeOnClick:h,disabled:k,highlighted:N,id:C,store:S,nativeButton:f,nodeId:w==null?void 0:w.context.nodeId,itemMetadata:_w}),H=x.useMemo(()=>({disabled:k,highlighted:N,checked:O}),[k,N,O]);function G(P){const V=yt(Zl,P.nativeEvent,void 0,{preventUnmountOnClose:Ln});R(g,V)}const B=Nt("div",t,{state:H,stateAttributesMapping:Ix,props:[E,{role:"menuitemradio","aria-checked":O,onClick:G},b,D],ref:[_,r,v.ref]});return n.jsx(R4.Provider,{value:H,children:B})}),CX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,keepMounted:u=!1,...f}=t,m=SX(),h=x.useRef(null),{transitionStatus:g,mounted:p,setMounted:b}=ni(m.checked);Sr({batch:!0,enabled:!m.checked,open:m.checked,ref:h,onComplete(){m.checked||b(!1)}});const v={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return Nt("span",t,{state:v,stateAttributesMapping:Ix,ref:[r,h],props:{"aria-hidden":!0,...f},enabled:u||p})}),kX=x.createContext(null);function A4(e){return x.useContext(kX)}const TX={...ix,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 EX extends _u{constructor(r,a,i=!1){const c=new Qf,u=AX(c,a,i,r);super(u,RX(c),TX);ln(this,"unsubscribeParentListener",null);this.unsubscribeParentListener=this.observe("parent",f=>{var m;if((m=this.unsubscribeParentListener)==null||m.call(this),f.type==="menu"){let h=f.store.select("rootId"),g=f.store.select("floatingTreeRoot"),p=f.store.select("keyboardEventRelay");this.unsubscribeParentListener=f.store.subscribe(()=>{const b=f.store.select("rootId"),v=f.store.select("floatingTreeRoot"),w=f.store.select("keyboardEventRelay");h===b&&g===v&&p===w||(h=b,g=v,p=w,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 RX(e){return{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function AX(e,t,r=!1,a){return{...ax(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 y2,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:En,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...a}}const MX=x.createContext(void 0);function OX(){return x.useContext(MX)}const DX=Xf(function(t){const{children:r,open:a,onOpenChange:i,onOpenChangeComplete:c,defaultOpen:u=!1,disabled:f=!1,modal:m,loopFocus:h=!0,orientation:g="vertical",actionsRef:p,closeParentOnEsc:b=!1,handle:v,triggerId:w,defaultTriggerId:C=null,highlightItemOnHover:S=!0}=t,N=Pw(!0),E=ll(!0),T=A4(!0),R=OX(),M=x.useMemo(()=>R&&E?{type:"menu",store:E.store}:T?{type:"menubar",context:T}:N&&!E?{type:"context-menu",context:N}:{type:void 0},[N,E,T,R]),A=sc(),k=sc(),O=ol(),D=M.type==="menu"?M.store:void 0,_=(a??u)&&(D==null?void 0:D.state.transitionStatus)==="starting",H=bs(()=>_?D==null?void 0:D.state.instantType:void 0).current,G=zX({open:u,openProp:a,activeTriggerId:C,triggerIdProp:w,parent:M,disabled:f,highlightItemOnHover:S,modal:M.type===void 0?m:void 0,rootId:A,instantType:H},k,O!=null);G.useControlledProp("openProp",a),G.useControlledProp("triggerIdProp",w),G.useContextCallback("onOpenChangeComplete",c);const B=G.useState("floatingTreeRoot"),P=w2(B),V=G.useState("open"),q=G.useState("activeTriggerElement"),W=G.useState("positionerElement"),K=G.useState("hoverEnabled"),J=G.useState("disabled"),z=G.useState("lastOpenChangeReason"),L=G.useState("parent"),X=G.useState("activeIndex"),ee=G.useState("payload"),$=G.useState("floatingParentNodeId"),U=x.useRef(null),F=x.useRef(L.type!=="context-menu"),Y=us(),ne=x.useRef(!0),te=us(),ye=$!=null,{openMethod:ae,triggerProps:ue}=XM(V);G.useSyncedValues({disabled:f,highlightItemOnHover:S,modal:L.type===void 0?m:void 0,openMethod:ae,rootId:A}),sx(G);const{forceUnmount:se,transitionStatus:Q}=rx(V,G,()=>{G.set("allowMouseEnter",!1)},_),ie=Gf(G.context.popupRef);x.useEffect(()=>{if(H===void 0)return;const _e=()=>{G.state.instantType===H&&G.set("instantType",void 0)};if(!V){_e();return}if(Q!==void 0)return;if(G.context.popupRef.current==null){_e();return}const Xe=new AbortController;return ie(_e,Xe.signal),()=>{Xe.abort()}},[H,V,Q,ie,G]),We(()=>{N&&!E?G.update({parent:{type:"context-menu",context:N},floatingNodeId:P,floatingParentNodeId:O}):E&&G.update({floatingNodeId:P,floatingParentNodeId:O})},[N,E,P,O,G]),x.useEffect(()=>{if(V||(U.current=null),L.type==="context-menu"){if(!V){Y.clear(),F.current=!1;return}Y.start(500,()=>{F.current=!0})}},[Y,V,L.type]),We(()=>{!V&&!K&&G.set("hoverEnabled",!0)},[V,K,G]);const oe=st((_e,Xe)=>{const Je=Xe.reason;if(!_e&&!G.select("open")||V===_e&&Xe.trigger===q&&z===Je)return;const ct=R2(Xe);if(!_e&&Xe.trigger==null&&(Xe.trigger=q??void 0),i==null||i(_e,Xe),Xe.isCanceled)return;G.state.floatingRootContext.dispatchOpenChange(_e,Xe);const At=Xe.event;if(_e===!1&&(At==null?void 0:At.type)==="click"&&At.pointerType==="touch"&&!ne.current)return;_e&&Je===gu?(ne.current=!1,te.start(300,()=>{ne.current=!0})):(ne.current=!0,te.clear());const rt=(Je===ma||Je===Zl)&&At.detail===0,ve=!_e&&(Je===Hf||Je==null);U.current=Xe.event;const Ue=nx(G.state,_e,Xe.trigger,ct());Ue.openChangeReason=Je,L.type==="menubar"&&(Je===gu||Je===Ji||Je===Qn||Je===Ty||Je===Xd)?Ue.instantType="group":rt||ve?Ue.instantType=rt?"click":"dismiss":Ue.instantType=void 0,G.update(Ue)}),pe=PM({popupStore:G,floatingRootContext:G.state.floatingRootContext,floatingId:k,nested:O!=null,onOpenChange:oe}),xe=pe.context.events;We(()=>{const _e=({open:Xe,eventDetails:Je})=>oe(Xe,Je);return xe.on("setOpen",_e),()=>{xe==null||xe.off("setOpen",_e)}},[xe,oe]);const je=x.useCallback(()=>{G.setOpen(!1,yt(Ug))},[G]);x.useImperativeHandle(p,()=>({unmount:se,close:je}),[se,je]);let Ie;L.type==="context-menu"&&(Ie=L.context),x.useImperativeHandle(Ie==null?void 0:Ie.positionerRef,()=>W,[W]),x.useImperativeHandle(Ie==null?void 0:Ie.actionsRef,()=>({setOpen:oe}),[oe]);const ce=Kf(pe,{enabled:!J,bubbles:{escapeKey:b&&L.type==="menu"},outsidePress(){var _e;return L.type!=="context-menu"||((_e=U.current)==null?void 0:_e.type)==="contextmenu"?!0:F.current},externalTree:ye?B:void 0}),Te=gx(),re=x.useCallback(_e=>{G.select("activeIndex")!==_e&&G.set("activeIndex",_e)},[G]),fe=UM(pe,{enabled:!J,listRef:G.context.itemDomElements,activeIndex:X,nested:L.type!==void 0,loopFocus:h,orientation:g,parentOrientation:L.type==="menubar"?L.context.orientation:void 0,rtl:Te==="rtl",disabledIndices:Vr,onNavigate:re,openOnArrowKeyDown:L.type!=="context-menu",externalTree:ye?B:void 0,focusItemOnHover:S}),Re=x.useCallback(_e=>{G.context.typingRef.current=_e},[G]),Oe=HM(pe,{enabled:!J,listRef:G.context.itemLabels,elementsRef:G.context.itemDomElements,activeIndex:X,resetMs:U$,onMatch:_e=>{V&&_e!==X&&G.set("activeIndex",_e)},onTyping:Re}),ke=x.useMemo(()=>{const _e=Qs(Oe.reference,fe.reference,ce.reference,{onMouseMove(){G.set("allowMouseEnter",!0)}},ue);return _e["aria-haspopup"]="menu",_e["aria-expanded"]=V,_e},[G,Oe.reference,fe.reference,ce.reference,ue,V]),he=x.useMemo(()=>{const _e=Qs(fe.trigger,ce.trigger,ue);return _e["aria-haspopup"]="menu",_e["aria-expanded"]=!1,_e},[fe.trigger,ce.trigger,ue]);bs(()=>(G.update({inactiveTriggerProps:he}),null));const Ae=x.useMemo(()=>Qs(Wf,{id:k,role:"menu","aria-orientation":g==="horizontal"?"horizontal":void 0,"aria-labelledby":q==null?void 0:q.id,onMouseMove(){G.set("allowMouseEnter",!0),L.type==="menu"&&G.set("hoverEnabled",!1)},onClick(){G.select("hoverEnabled")&&G.set("hoverEnabled",!1)},onKeyDown(_e){const Xe=G.select("keyboardEventRelay");Xe&&!_e.isPropagationStopped()&&Xe(_e)}},Oe.floating,fe.floating,ce.floating),[q,k,g,L.type,G,Oe.floating,fe.floating,ce.floating]),ge=fe.item??En;ox(G,{floatingRootContext:pe,activeTriggerProps:ke,inactiveTriggerProps:he,popupProps:Ae,itemProps:ge});const Pe=x.useMemo(()=>({store:G,parent:M}),[G,M]),Fe=n.jsxs(C4.Provider,{value:Pe,children:[v&&n.jsx(tx,{handle:v,store:G}),typeof r=="function"?r({payload:ee}):r]});return L.type===void 0||L.type==="context-menu"?n.jsx(CM,{externalTree:B,children:Fe}):Fe});function zX(e,t,r){return bs(()=>new EX(e,t,r)).current}function M4(e){const{render:t,className:r,style:a,state:i=En,props:c=Vr,refs:u=Vr,metadata:f,stateAttributesMapping:m,tag:h="div",...g}=e,{compositeProps:p,compositeRef:b}=x3({metadata:f});return Nt(h,e,{state:i,ref:[b,...u],props:[p,...c,g],stateAttributesMapping:m})}function O4(e){if(wn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Ua(e))return O4(Ya(e))}function D4(e,t){const r=x.useRef(null);function a(c){go.flushSync(()=>{e.setOpen(!1,yt(Ji,c.nativeEvent,c.currentTarget))});const u=L$(r.current);u==null||u.focus()}function i(c){var f;const u=e.select("positionerElement");if(u&&bu(c,u))(f=e.context.beforeContentFocusGuardRef.current)==null||f.focus();else{go.flushSync(()=>{e.setOpen(!1,yt(Ji,c.nativeEvent,c.currentTarget))});let m=_$(e.context.triggerFocusTargetRef.current||t.current);for(;m!==null&&gt(u,m);){const h=m;if(m=b2(m),m===h)break}m==null||m.focus()}}return{preFocusGuardRef:r,handlePreFocusGuardFocus:a,handleFocusTargetFocus:i}}function IX(e){const{enabled:t=!0,mouseDownAction:r,open:a}=e,i=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:c=>{(r==="open"&&!a||r==="close"&&a)&&(i.current=!0,Ht(c.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:c=>{i.current&&(i.current=!1,c.preventBaseUIHandler())}}:En,[t,r,a])}const PX=k2(function(t,r){const{render:a,className:i,style:c,disabled:u=!1,nativeButton:f=!0,id:m,openOnHover:h,delay:g=100,closeDelay:p=0,handle:b,payload:v,...w}=t,C=ll(!0),N=O2(b)??(C==null?void 0:C.store);if(!N)throw new Error(rn(85));const E=ys(m),T=N.useState("isTriggerActive",E),R=N.useState("floatingRootContext"),M=N.useState("isOpenedByTrigger",E),A=N.useState("triggerPopupId",E),k=x.useRef(null),O=LX(),D=Dg(!0),_=al(),H=x.useMemo(()=>_??new y2,[_]),G=w2(H),B=ol(),{registerTrigger:P,isMountedByThisTrigger:V}=A2(E,k,N,{payload:v,closeDelay:p,parent:O,floatingTreeRoot:H,floatingNodeId:G,floatingParentNodeId:B,keyboardEventRelay:D==null?void 0:D.relayKeyboardEvent}),q=O.type==="menubar",W=N.useState("disabled"),K=u||W||q&&O.context.disabled,{getButtonProps:J,buttonRef:z}=bo({disabled:K,native:f});x.useEffect(()=>{!M&&O.type===void 0&&(N.context.allowMouseUpTriggerRef.current=!1)},[N,M,O.type]);const L=x.useRef(null),X=us(),ee=st(Ie=>{if(!L.current)return;X.clear(),N.context.allowMouseUpTriggerRef.current=!1;const ce=Ie.target;gt(L.current,ce)||gt(N.select("positionerElement"),ce)||ce===L.current||ce!=null&&O4(ce)===N.select("rootId")||l3(Ie,L.current)||H.events.emit("close",{domEvent:Ie,reason:KA})});x.useEffect(()=>{M&&N.select("lastOpenChangeReason")===Qn&&Ht(L.current).addEventListener("mouseup",ee,{once:!0})},[M,ee,N]);const $=q&&O.context.hasSubmenuOpen,F=P2(R,{enabled:(h??$)&&!K&&(!q||$&&!V),handleClose:_2({blockPointerEvents:!q}),mouseOnly:!0,move:!1,restMs:O.type===void 0?g:void 0,delay:{close:p},triggerElementRef:k,externalTree:H,isActiveTrigger:T,isClosing:()=>N.select("transitionStatus")==="ending"}),Y=_X(M,N.select("lastOpenChangeReason")),ne=S2(R,{enabled:!K,event:M&&q?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:O.type===void 0?Y:!1}),te=BM(R,{enabled:!K&&$}),ye=IX({open:M,enabled:q,mouseDownAction:"open"}),ae=x.useMemo(()=>Qs(te.reference,ne.reference),[te.reference,ne.reference]),ue=N.useState("triggerProps",V),{preFocusGuardRef:se,handlePreFocusGuardFocus:Q,handleFocusTargetFocus:ie}=D4(N,k),oe={disabled:K,open:M},pe=[L,r,z,P,k],xe=[ae,F??En,ue,{"aria-haspopup":"menu","aria-controls":A,id:E,onMouseDown:Ie=>{if(N.select("open"))return;X.start(200,()=>{N.context.allowMouseUpTriggerRef.current=!0}),Ht(Ie.currentTarget).addEventListener("mouseup",ee,{once:!0})}},q?{role:"menuitem"}:{},ye,w,J],je=Nt("button",t,{enabled:!q,stateAttributesMapping:Xp,state:oe,ref:pe,props:xe});return q?n.jsx(M4,{tag:"button",render:a,className:i,style:c,state:oe,refs:pe,props:xe,stateAttributesMapping:Xp}):M?n.jsxs(x.Fragment,{children:[n.jsx(el,{ref:se,onFocus:Q},`${E}-pre-focus-guard`),n.jsx(x.Fragment,{children:je},E),n.jsx(el,{ref:N.context.triggerFocusTargetRef,onFocus:ie},`${E}-post-focus-guard`)]}):n.jsx(x.Fragment,{children:je},E)});function _X(e,t){const r=us(),[a,i]=x.useState(!1);return We(()=>{e&&t===Qn?(i(!0),r.start(pM,()=>{i(!1)})):e||(r.clear(),i(!1))},[e,t,r]),a}function LX(){const e=A4();return x.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}const $X=x.forwardRef(function(t,r){const{className:a,render:i,orientation:c="horizontal",style:u,...f}=t;return Nt("div",t,{state:{orientation:c},ref:r,props:[{role:"separator","aria-orientation":c},f]})});function Fi({...e}){return n.jsx(DX,{"data-slot":"dropdown-menu",...e})}function Gi({...e}){return n.jsx(PX,{"data-slot":"dropdown-menu-trigger",...e})}function qi({align:e="start",alignOffset:t=0,side:r="bottom",sideOffset:a=4,className:i,positionerRender:c,...u}){return n.jsx(vX,{children:n.jsx(yX,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:r,sideOffset:a,render:c,children:n.jsx(xX,{"data-slot":"dropdown-menu-content",className:Ve("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",i),...u})})})}function Ip({...e}){return n.jsx(mX,{"data-slot":"dropdown-menu-group",...e})}function C1({className:e,inset:t,...r}){return n.jsx(pX,{"data-slot":"dropdown-menu-label","data-inset":t,className:Ve("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",e),...r})}function Rs({className:e,inset:t,variant:r="default",...a}){return n.jsx(gX,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:Ve("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...a})}x.createContext(null);function Bw({className:e,children:t,checked:r,inset:a,...i}){return n.jsxs(dX,{"data-slot":"dropdown-menu-checkbox-item","data-inset":a,className:Ve("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,...i,children:[n.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:n.jsx(fX,{children:n.jsx(Yn,{})})}),t]})}function BX({...e}){return n.jsx(jX,{"data-slot":"dropdown-menu-radio-group",...e})}function pE({className:e,children:t,inset:r,...a}){return n.jsxs(NX,{"data-slot":"dropdown-menu-radio-item","data-inset":r,className:Ve("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:[n.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:n.jsx(CX,{children:n.jsx(Yn,{})})}),t]})}function ju({className:e,...t}){return n.jsx($X,{"data-slot":"dropdown-menu-separator",className:Ve("-mx-1 my-1 h-px bg-border",e),...t})}const VX=[{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"}],z4=[{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"}],UX=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],Oo=(e={})=>({host:"",ports:"443",protocol:"rest",access:"read-only",allow:[],deny:[],enforcement:"enforce",allowedIps:"",...e}),HX=[{id:"github-api-read",label:"GitHub API · read",rule:{name:"github-api-read",binaries:[],endpoints:[Oo({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:[Oo({host:"github.com"}),Oo({host:"codeload.github.com"})]}},{id:"npm",label:"npm registry",rule:{name:"npm-registry",binaries:["/usr/bin/node","/usr/local/bin/node"],endpoints:[Oo({host:"registry.npmjs.org"})]}},{id:"pypi",label:"PyPI",rule:{name:"pypi",binaries:["/usr/bin/python3*","/usr/local/bin/pip*"],endpoints:[Oo({host:"pypi.org"}),Oo({host:"files.pythonhosted.org"})]}},{id:"huggingface",label:"Hugging Face · downloads",rule:{name:"huggingface",binaries:["/usr/bin/python3*"],endpoints:[Oo({host:"huggingface.co"}),Oo({host:"**.hf.co"})]}}];function ty(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:[Oo()]).map(r=>{var a;return Oo({...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 FX(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 GX(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=z4.find(h=>h.id===u.access))==null?void 0:m.label.toLowerCase())??""} requests to ${f}`}),i=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 ")}${i.length?`, except ${i.join(", ")}`:""}.${c?" Audit only: violations are logged but allowed.":""}`}function Su({options:e,value:t,onChange:r,label:a}){return n.jsx("div",{role:"radiogroup","aria-label":a,className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:e.map(i=>n.jsx("button",{type:"button",role:"radio","aria-checked":t===i.id,onClick:()=>r(i.id),title:i.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===i.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:i.label},i.id))})}function Sg({items:e,onChange:t,kind:r}){return n.jsxs("div",{className:"space-y-1.5",children:[e.map((a,i)=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(pn,{value:a.method,onChange:c=>t(e.map((u,f)=>f===i?{...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:UX.map(c=>n.jsx("option",{children:c},c))}),n.jsx(Ot,{value:a.path,onChange:c=>t(e.map((u,f)=>f===i?{...u,path:c.target.value}:u)),className:"h-8 font-mono text-[11px]",placeholder:"/repos/**","aria-label":"Path pattern"}),n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${r} rule`,onClick:()=>t(e.filter((c,u)=>u!==i)),children:n.jsx(In,{className:"size-3.5"})})]},i)),n.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:[n.jsx(vs,{className:"size-3"}),r==="deny"?"Block request":"Allow request"]})]})}function qX({open:e,onOpenChange:t,initial:r,onSubmit:a,knownPrograms:i=[],title:c="New rule",submitLabel:u="Add rule",lockName:f=!1}){const[m,h]=x.useState(()=>ty(r)),[g,p]=x.useState(""),[b,v]=x.useState(!1),[w,C]=x.useState(null);x.useEffect(()=>{e&&(h(ty(r)),C(null),p(""))},[e,r]);const S=(M,A)=>h(k=>({...k,endpoints:k.endpoints.map((O,D)=>D===M?{...O,...A}:O)})),N=M=>{const A=M.trim();A&&!m.binaries.includes(A)&&h(k=>({...k,binaries:[...k.binaries,A]})),p("")},E=FX(m),T=i.filter(M=>!m.binaries.includes(M));async function R(M){M.preventDefault(),v(!0),C(null);try{await a(E),t(!1)}catch(A){C(A.message)}finally{v(!1)}}return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:n.jsxs("form",{onSubmit:R,className:"grid gap-5",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:c}),n.jsx(Sn,{className:"sr-only",children:"Everything not allowed by a rule stays denied."})]}),!f&&n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[n.jsx("span",{className:"self-center text-[11px] text-muted-foreground",children:"Presets"}),HX.map(M=>n.jsx("button",{type:"button",onClick:()=>h(ty(M.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:M.label},M.id))]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"rule-name",className:"text-xs",children:"Rule name"}),n.jsx(Ot,{id:"rule-name",value:m.name,disabled:f,onChange:M=>h(A=>({...A,name:M.target.value.toLowerCase()})),className:"font-mono text-xs",placeholder:"github-api-read",required:!0})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium",children:"Programs"}),n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[m.binaries.map(M=>n.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:[M,n.jsx("button",{type:"button","aria-label":`Remove ${M}`,onClick:()=>h(A=>({...A,binaries:A.binaries.filter(k=>k!==M)})),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(In,{className:"size-3"})})]},M)),!m.binaries.length&&n.jsx("span",{className:"text-[11px] text-amber-700",children:"Add at least one program"})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx(Ot,{value:g,onChange:M=>p(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),N(g))},className:"h-8 font-mono text-[11px]",placeholder:"/usr/bin/curl",title:"Globs like /usr/bin/python3* work","aria-label":"Program path"}),n.jsx(le,{type:"button",variant:"outline",size:"sm",onClick:()=>N(g),disabled:!g.trim(),children:"Add"})]}),T.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Seen"}),T.slice(0,6).map(M=>n.jsxs("button",{type:"button",onClick:()=>N(M),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:["+ ",M]},M))]})]}),n.jsxs("div",{className:"grid gap-3",children:[n.jsx("span",{className:"text-xs font-medium",children:"Destinations"}),m.endpoints.map((M,A)=>n.jsxs("div",{className:"grid gap-3 rounded-lg border border-border p-3",children:[n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsxs("div",{className:"grid flex-1 gap-1",children:[n.jsx(zn,{className:"text-[11px] text-muted-foreground",htmlFor:`host-${A}`,children:"Host"}),n.jsx(Ot,{id:`host-${A}`,value:M.host,onChange:k=>S(A,{host:k.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"api.github.com",title:"Wildcards like *.example.com work",required:!0})]}),n.jsxs("div",{className:"grid w-24 gap-1",children:[n.jsx(zn,{className:"text-[11px] text-muted-foreground",htmlFor:`ports-${A}`,children:"Ports"}),n.jsx(Ot,{id:`ports-${A}`,value:M.ports,onChange:k=>S(A,{ports:k.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"443",required:!0})]}),m.endpoints.length>1&&n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Remove destination",onClick:()=>h(k=>({...k,endpoints:k.endpoints.filter((O,D)=>D!==A)})),children:n.jsx(ts,{className:"size-3.5"})})]}),n.jsx(Su,{label:"Inspection",options:VX,value:M.protocol,onChange:k=>S(A,{protocol:k})}),M.protocol!=="tcp"&&n.jsxs(n.Fragment,{children:[n.jsx(Su,{label:"Access",options:z4,value:M.access,onChange:k=>S(A,{access:k,allow:k==="custom"&&!M.allow.length?[{method:"GET",path:""}]:M.allow})}),M.access==="custom"&&n.jsx(Sg,{kind:"allow",items:M.allow,onChange:k=>S(A,{allow:k})}),n.jsx(Sg,{kind:"deny",items:M.deny,onChange:k=>S(A,{deny:k})})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsx("div",{className:"w-52",children:n.jsx(Su,{label:"Enforcement",options:[{id:"enforce",label:"Enforce"},{id:"audit",label:"Audit only"}],value:M.enforcement,onChange:k=>S(A,{enforcement:k})})}),M.enforcement==="audit"&&n.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-700",children:[n.jsx(ti,{className:"size-3"}),"Logged, not blocked"]})]}),n.jsxs("details",{className:"group",children:[n.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"}),n.jsx("div",{className:"mt-2 grid gap-1",children:n.jsx(Ot,{value:M.allowedIps,onChange:k=>S(A,{allowedIps:k.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"10.0.5.20/32","aria-label":"Allowed IPs"})})]})]},A)),n.jsxs(le,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>h(M=>({...M,endpoints:[...M.endpoints,Oo()]})),children:[n.jsx(vs,{}),"Add destination"]})]}),n.jsx("p",{className:"rounded-md border border-border bg-muted/40 px-3 py-2 text-[11px] leading-relaxed",children:GX(E)}),w&&n.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:w}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:b||!m.binaries.length,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[b&&n.jsx(kt,{"aria-hidden":"true"}),u]})]})]})})})}function Hu({className:e,...t}){return n.jsx("textarea",{"data-slot":"textarea",className:ws("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 Yi={ports:[443,80],programs:[],requests:"any",allow:[],deny:[],enforcement:"enforce",privateIps:[]},I4=[{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"}],YX=[{label:"GitHub · read and clone",policy:{name:"GitHub read",destinations:["github.com","api.github.com","codeload.github.com"],advanced:{...Yi,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:{...Yi,ports:[443]}}},{label:"PyPI",policy:{name:"PyPI",destinations:["pypi.org","files.pythonhosted.org"],advanced:{...Yi,ports:[443],requests:"read-only"}}}],Ki=(e={})=>({name:"",action:"allow",destinations:[],appliesTo:{everyone:!1,groups:[],sandboxes:[]},advanced:Yi,...e}),KX=e=>e.split(`
519
+ `).map(t=>t.trim()).filter(Boolean),Ng=e=>e.split(/[\s,]+/).filter(Boolean),XX=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40).replace(/-$/,""),Pp=e=>e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`,WX=e=>JSON.stringify({...Yi,...e})===JSON.stringify(Yi);function np(e){const t={...Yi,...(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 QX(e,t){return{id:t?XX(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:Ng(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:Ng(e.privateIps)}}:{}}}const ZX=e=>{var t;return((t=e.setup)==null?void 0:t.name)??"an MCPs & Skills setup"};function uf(e,t){var i;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,...(i=r.setups)!=null&&i.length?[`sandboxes using “${ZX(e)}”`]:[]];return a.length?Pp(a):null}function JX(e,t=[]){var g;const r=e.destinations.length>3?`${e.destinations.slice(0,3).join(", ")} and ${e.destinations.length-3} more`:Pp(e.destinations),a=uf(e,t),i=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. ${i}`;const c={...Yi,...e.advanced},u=c.requests==="custom"?`only ${c.allow.map(p=>`${p.method} ${p.path}`).join(", ")||"the listed requests"}`:((g=I4.find(p=>p.id===c.requests))==null?void 0:g.label.toLowerCase())+" requests",f=c.programs.length?`from ${Pp([...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"} ${Pp(c.ports.map(String))}, ${f}.${h} ${i}`}function Vw({open:e,onOpenChange:t,initial:r,groups:a=[],sandboxes:i=[],assignments:c={},setupMembers:u={},knownPrograms:f=[],onSaved:m,onGroupCreated:h,sourceControl:g}){var ee,$;const p=Pt(),b=!(r!=null&&r.id),[v,w]=x.useState(()=>np(r)),[C,S]=x.useState([]),N=[...a,...C.filter(U=>!a.some(F=>F.id===U.id))].sort((U,F)=>U.name.localeCompare(F.name)),[E,T]=x.useState(""),[R,M]=x.useState(""),[A,k]=x.useState(!1),[O,D]=x.useState(null),[_,H]=x.useState(!1);x.useEffect(()=>{e&&(w(np(r)),D(null),T(""),M(""),H(!1))},[e,r]);const G=U=>w(F=>({...F,...U})),B=U=>w(F=>({...F,appliesTo:{...F.appliesTo,...U}})),P=((ee=v.appliesTo.setups)==null?void 0:ee.length)>0,V=!v.appliesTo.everyone&&!v.appliesTo.sandboxes.length&&(P||v.appliesTo.groups.length>0)&&v.appliesTo.groups.every(U=>N.some(F=>F.id===U)),q=QX(v,b),W=U=>{const F=Ng(U).filter((Y,ne,te)=>!v.destinations.includes(Y)&&te.indexOf(Y)===ne);F.length&&G({destinations:[...v.destinations,...F]}),M("")},K=U=>{const F=U.trim();F&&!v.programs.includes(F)&&G({programs:[...v.programs,F]}),T("")},J=Object.fromEntries(N.map(U=>[U.id,i.filter(F=>ir({assignments:c},F).includes(U.id)).length])),z=i.filter(U=>Mx(q,{name:U,groups:ir({assignments:c},U),setups:u[U]??[]}));async function L(U){if(U.preventDefault(),!V){D("Choose at least one group for this network rule.");return}k(!0),D(null);const F=Ng(R).filter(ne=>!q.destinations.includes(ne)),Y={...q,destinations:[...q.destinations,...F]};try{m(await p.savePolicy({...Y,isNew:b}),Y),t(!1)}catch(ne){D(ne.message)}finally{k(!1)}}async function X(){k(!0),D(null);try{m({...await p.deletePolicy(r.id),deleted:!0},r),t(!1)}catch(U){D(U.message)}finally{k(!1)}}return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:n.jsxs("form",{onSubmit:L,className:"grid gap-5",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:b?"Add network rule":`Edit ${r.name}`}),n.jsx(Sn,{className:"text-xs",children:"Sandboxes start locked down: nothing leaves them unless a rule allows it. A block beats every allow."})]}),n.jsx("fieldset",{disabled:A||JSON.stringify(v)!==JSON.stringify(np(r))||!!(R||E),children:g}),b&&n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[n.jsx("span",{className:"self-center text-[11px] text-muted-foreground",children:"Start from"}),YX.map(U=>n.jsx("button",{type:"button",onClick:()=>w(F=>({...np(Ki(U.policy)),appliesTo:F.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:U.label},U.label))]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"policy-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"policy-name",value:v.name,onChange:U=>G({name:U.target.value}),className:"text-xs",placeholder:"GitHub read",required:!0,autoFocus:b})]}),n.jsxs("fieldset",{className:"grid gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("legend",{className:"px-1 text-xs font-medium",children:["Groups ",n.jsxs("span",{className:"text-muted-foreground",children:["· ",P?"Optional":"Required"]})]}),P&&n.jsxs("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:["Applies to sandboxes that use the MCPs & Skills setup",($=v.setup)!=null&&$.name?n.jsxs(n.Fragment,{children:[" “",n.jsx("span",{className:"text-foreground",children:v.setup.name}),"”"]}):"",". Groups you pick here also get it."]}),n.jsx(cc,{multiple:!0,required:!P,groups:N,counts:J,value:v.appliesTo.groups,onChange:U=>B({everyone:!1,groups:U,sandboxes:[]}),onCreated:U=>{S(F=>[...F,U]),h==null||h(U)}}),z.length>0&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[z.length," ",z.length===1?"sandbox":"sandboxes"," currently in scope."]}),!b&&!P&&(r.appliesTo.everyone||r.appliesTo.sandboxes.length||!r.appliesTo.groups.length)&&n.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."})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium",children:"Action"}),n.jsx("div",{className:"w-48",children:n.jsx(Su,{label:"Action",options:[{id:"allow",label:"Allow"},{id:"block",label:"Block"}],value:v.action,onChange:U=>G({action:U})})})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"policy-destinations",className:"text-xs",children:"Destinations"}),n.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:[v.destinations.map(U=>n.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:[U,n.jsx("button",{type:"button","aria-label":`Remove ${U}`,onClick:()=>G({destinations:v.destinations.filter(F=>F!==U)}),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(In,{className:"size-3"})})]},U)),n.jsx("input",{id:"policy-destinations",value:R,onChange:U=>/[\s,]$/.test(U.target.value)?W(U.target.value):M(U.target.value),onKeyDown:U=>{U.key==="Enter"?(U.preventDefault(),W(R)):U.key==="Backspace"&&!R&&v.destinations.length&&G({destinations:v.destinations.slice(0,-1)})},onBlur:()=>W(R),className:"min-w-32 flex-1 bg-transparent font-mono text-[11px] outline-none placeholder:text-muted-foreground",placeholder:v.destinations.length?"":v.action==="block"?"pastebin.com":"github.com","aria-label":"Destinations"})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:v.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."})]}),v.action==="allow"&&n.jsxs("details",{className:"group rounded-lg border border-border",open:!WX(r==null?void 0:r.advanced)||void 0,children:[n.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"}),n.jsxs("div",{className:"grid gap-4 border-t border-border p-3",children:[n.jsxs("div",{className:"grid gap-1",children:[n.jsx(zn,{htmlFor:"policy-ports",className:"text-[11px] text-muted-foreground",children:"Ports"}),n.jsx(Ot,{id:"policy-ports",value:v.ports,onChange:U=>G({ports:U.target.value}),className:"h-8 w-40 font-mono text-[11px]",placeholder:"443, 80"})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Requests"}),n.jsx(Su,{label:"Requests",options:I4,value:v.requests,onChange:U=>G({requests:U,allow:U==="custom"&&!v.allow.length?[{method:"GET",path:""}]:v.allow})}),v.requests==="custom"&&n.jsx(Sg,{kind:"allow",items:v.allow,onChange:U=>G({allow:U})}),n.jsx(Sg,{kind:"deny",items:v.deny,onChange:U=>G({deny:U})})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Programs"}),n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[v.programs.map(U=>n.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:[U,n.jsx("button",{type:"button","aria-label":`Remove ${U}`,onClick:()=>G({programs:v.programs.filter(F=>F!==U)}),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(In,{className:"size-3"})})]},U)),!v.programs.length&&n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Any program"})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx(Ot,{value:E,onChange:U=>T(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),K(E))},className:"h-8 font-mono text-[11px]",placeholder:"/usr/bin/git",title:"Globs like /usr/bin/python3* work","aria-label":"Program path"}),n.jsx(le,{type:"button",variant:"outline",size:"sm",onClick:()=>K(E),disabled:!E.trim(),children:"Add"})]}),f.filter(U=>!v.programs.includes(U)).length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Seen"}),f.filter(U=>!v.programs.includes(U)).slice(0,6).map(U=>n.jsxs("button",{type:"button",onClick:()=>K(U),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:["+ ",U]},U))]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsx("div",{className:"w-52",children:n.jsx(Su,{label:"Enforcement",options:[{id:"enforce",label:"Enforce"},{id:"audit",label:"Audit only"}],value:v.enforcement,onChange:U=>G({enforcement:U})})}),v.enforcement==="audit"&&n.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-700",children:[n.jsx(ti,{className:"size-3"}),"Request rules are logged, not enforced"]})]}),n.jsxs("div",{className:"grid gap-1",children:[n.jsx(zn,{htmlFor:"policy-ips",className:"text-[11px] text-muted-foreground",title:"Loopback and cloud metadata stay blocked",children:"Private addresses"}),n.jsx(Ot,{id:"policy-ips",value:v.privateIps,onChange:U=>G({privateIps:U.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"10.0.5.0/24"})]})]})]}),n.jsx("p",{className:"rounded-md border border-border bg-muted/40 px-3 py-2 text-[11px] leading-relaxed",children:JX(q,N)}),O&&n.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:O}),n.jsxs(Hr,{className:"sm:justify-between",children:[b?n.jsx("span",{}):_?n.jsxs("span",{className:"grid gap-1.5",children:[v.setup&&n.jsxs("span",{className:"max-w-64 text-[11px] text-muted-foreground",children:["Sandboxes that use “",v.setup.name,"” lose access to these websites. Enabling the setup again asks you to approve them for each sandbox."]}),n.jsx(le,{type:"button",variant:"destructive",disabled:A,onClick:X,children:"Delete rule"})]}):n.jsx(le,{type:"button",variant:"ghost",className:"text-muted-foreground hover:text-destructive",onClick:()=>H(!0),children:"Delete"}),n.jsxs("span",{className:"flex gap-2",children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:A||!V||!v.name.trim()||!v.destinations.length&&!R.trim(),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[A&&n.jsx(kt,{"aria-hidden":"true"}),b?"Add rule":"Save rule"]})]})]})]})})})}function P4({open:e,onOpenChange:t,org:r,onSaved:a}){const i=Pt(),[c,u]=x.useState(""),[f,m]=x.useState(!1),[h,g]=x.useState(null);x.useEffect(()=>{e&&(u(((r==null?void 0:r.blocked)??[]).join(`
520
+ `)),g(null))},[e,r]);async function p(b){b.preventDefault(),m(!0),g(null);try{a(await i.saveOrg({...r,blocked:KX(c)})),t(!1)}catch(v){g(v.message)}finally{m(!1)}}return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:p,className:"grid gap-4",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Blocked everywhere"}),n.jsx(Sn,{className:"text-xs",children:"Blocked in every sandbox, with their subdomains. No rule can open them."})]}),n.jsx(Hu,{rows:6,value:c,onChange:b=>u(b.target.value),className:"font-mono text-[11px]",placeholder:`pastebin.com
521
+ **.ngrok.io`,"aria-label":"Blocked hosts"}),h&&n.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}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:f,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&n.jsx(kt,{"aria-hidden":"true"}),"Save"]})]})]})})})}function gE({className:e,size:t="default",...r}){return n.jsx("div",{"data-slot":"card","data-size":t,className:Ve("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 _4({borderWidth:e=1,duration:t=14,shineColor:r="#000000",className:a,style:i,...c}){return n.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)",...i},className:Ve("motion-safe:animate-shine pointer-events-none absolute inset-0 size-full rounded-[inherit] will-change-[background-position]",a),...c})}const L4=x.createContext(void 0);function ch(e){const t=x.useContext(L4);if(t===void 0&&!e)throw new Error(rn(72));return t}const eW={...ix,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 tW extends _u{constructor(r,a,i){const c=new Qf;super(nW(r,c,a,i),sW(c),eW);ln(this,"setOpen",(r,a)=>{QB(this,r,a,{extraState:{openChangeReason:a.reason}})})}cancelPendingOpen(r){this.state.floatingRootContext.dispatchOpenChange(!1,yt(ma,r))}}function nW(e,t,r,a=!1){return{...ax(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 sW(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const rW=Xf(function(t){const{disabled:r=!1,defaultOpen:a=!1,open:i,disableHoverablePopup:c=!1,trackCursorAxis:u="none",actionsRef:f,onOpenChange:m,onOpenChangeComplete:h,handle:g,triggerId:p,defaultTriggerId:b=null,children:v}=t,w=E2((H,G)=>new tW({open:a,openProp:i,activeTriggerId:b,triggerIdProp:p},H,G));w.useControlledProp("openProp",i),w.useControlledProp("triggerIdProp",p),w.useContextCallback("onOpenChange",m),w.useContextCallback("onOpenChangeComplete",h);const C=w.useState("open"),S=!r&&C,N=w.useState("activeTriggerId"),E=w.useState("mounted"),T=w.useState("payload");w.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:c,disabled:r}),sx(w,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:M}=rx(S,w),A=w.useState("isInstantPhase"),k=w.useState("instantType"),O=w.useState("lastOpenChangeReason"),D=x.useRef(null);We(()=>{C&&r&&w.setOpen(!1,yt(XA))},[C,r,w]),We(()=>{M==="ending"&&O===Ur||M!=="ending"&&A?(k!=="delay"&&(D.current=k),w.set("instantType","delay")):D.current!==null&&(w.set("instantType",D.current),D.current=null)},[M,A,O,k,w]),We(()=>{S&&N==null&&w.set("payload",void 0)},[w,N,S]),x.useImperativeHandle(f,()=>({unmount:R,close:()=>w.setOpen(!1,yt(Ug))}),[R,w]);const _=S||E||!r&&u!=="none";return n.jsxs(L4.Provider,{value:w,children:[g&&n.jsx(tx,{handle:g,store:w}),_&&n.jsx(oW,{store:w,disabled:r,trackCursorAxis:u}),typeof v=="function"?v({payload:T}):v]})});function oW({store:e,disabled:t,trackCursorAxis:r}){const a=e.useState("floatingRootContext"),i=Kf(a,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=X$(a,{enabled:!t&&r!=="none",axis:r==="none"?void 0:r}),u=x.useMemo(()=>Qs(c.reference,i.reference),[c.reference,i.reference]);return ox(e,{activeTriggerProps:u,inactiveTriggerProps:u,popupProps:i.floating??En}),null}const $4=x.createContext(void 0);function aW(){return x.useContext($4)}const iW=600,B4="data-base-ui-tooltip-trigger";function xE(e){if("composedPath"in e){const r=e.composedPath();for(let a=0;a<r.length;a+=1){const i=r[a];if(Ft(i))return i}}const t=e.target;return Ft(t)?t:null}function lW(e){let t=e;for(;t;){const r=t.closest(`[${B4}]`);if(r)return r;const a=t.getRootNode();t="host"in a&&Ft(a.host)?a.host:null}return null}const cW=k2(function(t,r){const{render:a,className:i,style:c,handle:u,payload:f,disabled:m,delay:h,closeOnClick:g=!0,closeDelay:p,id:b,...v}=t,w=ch(!0),S=O2(u)??w;if(!S)throw new Error(rn(82));const N=ys(b),E=S.useState("isTriggerActive",N),T=S.useState("isOpenedByTrigger",N),R=S.useState("floatingRootContext"),M=x.useRef(null),A=p??0,{registerTrigger:k,isMountedByThisTrigger:O}=A2(N,M,S,{payload:f,closeOnClick:g,closeDelay:A}),D=aW(),{activeIdRef:_,delayRef:H,isInstantPhase:G,hasProvider:B}=w$(R,{open:T}),P=z2(R);S.useSyncedValue("isInstantPhase",G);const V=S.useState("disabled"),q=m??V,W=qn(q),K=S.useState("trackCursorAxis"),J=S.useState("disableHoverablePopup"),z=x.useRef(!1),L=us(),X=x.useRef(void 0);function ee(){return B&&_.current!=null?0:h??D??iW}function $(se){const Q=M.current;if(!Q||!se)return!1;const ie=lW(se);return ie!==null&&ie!==Q&&gt(Q,ie)}function U(se){const Q=$(se);return z.current=Q,Q&&(P.openChangeTimeout.clear(),P.restTimeout.clear(),P.restTimeoutPending=!1,L.clear()),Q}const F=P2(R,{enabled:!q,mouseOnly:!0,move:!1,handleClose:!J&&K!=="both"?_2():null,restMs:ee,delay(){return p==null&&B?{close:rc(H.current,"close")}:{close:A}},triggerElementRef:M,isActiveTrigger:E,isClosing:()=>S.select("transitionStatus")==="ending",shouldOpen(){return!z.current}}),Y=BM(R,{enabled:!q}).reference,ne=se=>{const Q=z.current,ie=xE(se),oe=U(ie),pe=M.current,xe=pe&&ie&&gt(pe,ie);if(oe&&S.select("open")&&S.select("lastOpenChangeReason")===Qn){S.setOpen(!1,yt(Qn,se));return}if(Q&&!oe&&xe&&!W.current&&!S.select("open")&&pe&&Hi(X.current)){const je=()=>{!z.current&&!W.current&&!S.select("open")&&S.setOpen(!0,yt(Qn,se,pe))},Ie=ee();Ie===0?(L.clear(),je()):L.start(Ie,je)}},te=S.useState("triggerProps",O);return Nt("button",t,{state:{open:T},ref:[r,k,M],props:[F,Y,O||K!=="none"?te:void 0,{onMouseOver(se){ne(se.nativeEvent)},onFocus(se){$(xE(se.nativeEvent))&&se.preventBaseUIHandler()},onMouseLeave(){z.current=!1,L.clear(),X.current=void 0},onPointerEnter(se){X.current=se.pointerType},onPointerDown(se){X.current=se.pointerType,S.set("closeOnClick",g),g&&!S.select("open")&&S.cancelPendingOpen(se.nativeEvent)},onClick(se){g&&!S.select("open")&&S.cancelPendingOpen(se.nativeEvent)},id:N,[Ay]:q?"":void 0,[B4]:q?void 0:""},v],stateAttributesMapping:i2})}),V4=x.createContext(void 0);function uW(){const e=x.useContext(V4);if(e===void 0)throw new Error(rn(70));return e}const dW=x.forwardRef(function(t,r){const{children:a,container:i,className:c,render:u,style:f,...m}=t,{node:h,subtree:g}=yM({container:i,ref:r,componentProps:t,elementProps:m});return!g&&!h?null:n.jsxs(x.Fragment,{children:[g,h&&go.createPortal(a,h)]})}),fW=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t;return ch().useState("mounted")||a?n.jsx(V4.Provider,{value:a,children:n.jsx(dW,{ref:r,...i})}):null}),U4=x.createContext(void 0);function H4(){const e=x.useContext(U4);if(e===void 0)throw new Error(rn(71));return e}const hW=x.forwardRef(function(t,r){const{render:a,className:i,anchor:c,positionMethod:u="absolute",side:f="top",align:m="center",sideOffset:h=0,alignOffset:g=0,collisionBoundary:p="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:w=!1,disableAnchorTracking:C=!1,collisionAvoidance:S=v2,style:N,...E}=t,T=ch(),R=uW(),M=T.useState("open"),A=T.useState("mounted"),k=T.useState("trackCursorAxis"),O=T.useState("disableHoverablePopup"),D=T.useState("floatingRootContext"),_=T.useState("instantType"),H=T.useState("transitionStatus"),G=T.useState("adaptiveOrigin"),B=xx({anchor:c,positionMethod:u,floatingRootContext:D,mounted:A,side:f,sideOffset:h,align:m,alignOffset:g,collisionBoundary:p,collisionPadding:b,sticky:w,arrowPadding:v,disableAnchorTracking:C,keepMounted:R,collisionAvoidance:S,adaptiveOrigin:G}),P=x.useMemo(()=>({open:M,side:B.side,align:B.align,anchorHidden:B.anchorHidden,instant:k!=="none"?"tracking-cursor":_}),[M,B.side,B.align,B.anchorHidden,k,_]),V=bx(t,P,{styles:B.positionerStyles,transitionStatus:H,props:E,refs:[r,T.useStateSetter("positionerElement")],hidden:!A,inert:!M||k==="both"||O});return n.jsx(U4.Provider,{value:B,children:V})}),mW=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=ch(),{side:m,align:h}=H4(),g=f.useState("open"),p=f.useState("instantType"),b=f.useState("transitionStatus"),v=f.useState("popupProps"),w=f.useState("floatingRootContext"),C=f.useState("disabled"),S=f.useState("closeDelay");Sr({open:g,ref:f.context.popupRef,onComplete(){var R,M;g&&((M=(R=f.context).onOpenChangeComplete)==null||M.call(R,!0))}}),I2(w,{enabled:!C,closeDelay:S});const N=f.useStateSetter("popupElement");return Nt("div",t,{state:{open:g,side:m,align:h,instant:p,transitionStatus:b},ref:[r,f.context.popupRef,N],props:[Wf,v,th(b),u],stateAttributesMapping:Hg})}),pW=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=ch(),{arrowRef:m,side:h,align:g,arrowUncentered:p,arrowStyles:b}=H4(),v=f.useState("open"),w=f.useState("instantType");return Nt("div",t,{state:{open:v,side:h,align:g,uncentered:p,instant:w},ref:[r,m],props:[{style:b,"aria-hidden":!0},u],stateAttributesMapping:qf})}),gW=function(t){const{delay:r,closeDelay:a,timeout:i=400}=t,c=x.useMemo(()=>({open:r,close:a}),[r,a]);return n.jsx($4.Provider,{value:r,children:n.jsx(y$,{delay:c,timeoutMs:i,children:t.children})})};function Fu({delay:e=0,...t}){return n.jsx(gW,{"data-slot":"tooltip-provider",delay:e,...t})}function xa({...e}){return n.jsx(rW,{"data-slot":"tooltip",...e})}function ba({...e}){return n.jsx(cW,{"data-slot":"tooltip-trigger",...e})}function va({className:e,side:t="top",sideOffset:r=4,align:a="center",alignOffset:i=0,children:c,...u}){return n.jsx(fW,{children:n.jsx(hW,{align:a,alignOffset:i,side:t,sideOffset:r,className:"isolate z-50",children:n.jsxs(mW,{"data-slot":"tooltip-content",className:Ve("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,n.jsx(pW,{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"})]})})})}function Uw({host:e,tone:t="default",className:r}){return n.jsx("span",{"aria-hidden":"true",className:Ve("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:VK(e).charAt(0).toUpperCase()})}const bE=x.forwardRef(function({item:t,denied:r,active:a,onFocus:i,onBlur:c,onAllow:u},f){const m=ia[t.source]??ia.own;return n.jsxs("div",{ref:f,className:Ve("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:[n.jsxs(xa,{children:[n.jsxs(ba,{render:n.jsx("button",{type:"button"}),onMouseEnter:i,onMouseLeave:c,onFocus:i,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:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-foreground",children:t.host}),r?n.jsxs("span",{className:"shrink-0 text-[10px] tabular-nums text-muted-foreground",children:[t.count,"×"]}):n.jsx("span",{className:Ve("size-1 shrink-0 rounded-full",m.swatch)})]}),n.jsxs(va,{className:"max-w-sm break-all font-sans",children:[t.host," · ",r?"Blocked in recent activity":`Allowed · ${m.label}`]})]}),r&&u&&n.jsx(le,{size:"sm",variant:"ghost",className:"mr-1 px-2 text-[11px]",onClick:u,children:"Review"})]})}),sp=x.forwardRef(function({title:t,count:r,icon:a,summary:i,open:c,onToggle:u,tone:f="neutral",children:m,className:h,...g},p){const b=x.useId();return n.jsxs("section",{ref:p,...g,className:Ve("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:[n.jsxs("button",{type:"button","aria-expanded":c,"aria-controls":b,"aria-label":`${c?"Collapse":"Expand"} ${t}`,onClick:u,className:"group flex w-full items-center gap-2.5 rounded-none px-4 py-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[n.jsx("span",{className:Ve("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:n.jsx(a,{className:"size-3.5",strokeWidth:1.5})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-2 text-[11px] font-medium",children:[t,n.jsx("span",{className:"text-[10px] font-normal tabular-nums text-muted-foreground",children:r})]}),n.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",title:i,children:i})]}),n.jsx(ha,{className:Ve("size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none",c&&"rotate-180")})]}),n.jsx($n.div,{id:b,initial:!1,animate:{height:c?"auto":0,opacity:c?1:0},transition:{duration:Zs()?0:.22,ease:[.22,1,.36,1]},inert:!c,"aria-hidden":!c,className:"overflow-hidden",children:n.jsx("div",{className:"space-y-0.5 border-t border-black/5 p-2",children:m})})]})});function au({children:e,canvas:t,label:r}){var m;const[a,i]=x.useState({x:0,y:0}),c=x.useRef(null),u=x.useRef(!1),f=(h,g,p)=>{const b=t.current.getBoundingClientRect(),v=h.getBoundingClientRect(),w=b.width/t.current.offsetWidth||1,C=(v.left-b.left)/w-a.x,S=(v.top-b.top)/w-a.y;return{x:Math.max(-C,Math.min(g,b.width/w-C-v.width/w)),y:Math.max(-S,Math.min(p,b.height/w-S-v.height/w))}};return x.useLayoutEffect(()=>{var h;(h=t.current)==null||h.dispatchEvent(new Event("graph-move"))},[a,t]),x.cloneElement(e,{tabIndex:0,"aria-label":`${r}. Drag to move or use arrow keys`,className:Ve(e.props.className,"cursor-grab touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing"),style:{...e.props.style,transform:`translate(${a.x}px, ${a.y}px)`,zIndex:(m=c.current)!=null&&m.moved?30:10},onDragStart:h=>h.preventDefault(),onPointerDown:h=>{h.button!==0||!h.isPrimary||h.target.closest("[data-resource-list]")||h.target.closest("button")&&!h.target.closest("button[aria-expanded], [data-graph-drag-handle]")||(u.current=!1,c.current={id:h.pointerId,x:h.clientX,y:h.clientY,offset:a,moved:!1})},onPointerLeave:()=>{var h;(h=c.current)!=null&&h.moved||(c.current=null)},onPointerMove:h=>{const g=c.current;if(!g||g.id!==h.pointerId)return;const p=h.clientX-g.x,b=h.clientY-g.y;if(!g.moved&&Math.hypot(p,b)<5)return;g.moved=!0,u.current=!0,h.currentTarget.setPointerCapture(h.pointerId);const v=t.current.getBoundingClientRect().width/t.current.offsetWidth||1;i(f(h.currentTarget,g.offset.x+p/v,g.offset.y+b/v))},onPointerUp:h=>{h.currentTarget.hasPointerCapture(h.pointerId)&&h.currentTarget.releasePointerCapture(h.pointerId),c.current=null,i(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;i(f(h.currentTarget,a.x+g[0]*p,a.y+g[1]*p))}})}function xW({name:e,phase:t,agents:r=[],agentStatus:a="Agent inventory not checked",allowed:i,denied:c,onAllow:u,compact:f=!1,fill:m=!1,owner:h="Not reported",secrets:g=[],gateway:p}){const b=x.useRef(null),v=x.useRef(null),w=x.useRef(null),C=x.useMemo(()=>({agents:x.createRef(),owner:x.createRef(),secrets:x.createRef(),blocked:x.createRef(),allowed:x.createRef()}),[]),[S,N]=x.useReducer(D=>D+1,0);x.useEffect(()=>{var H;let D=(H=b.current)==null?void 0:H.clientWidth;const _=new ResizeObserver(()=>{var B;const G=(B=b.current)==null?void 0:B.clientWidth;G!==D&&(D=G,N())});return _.observe(b.current),()=>_.disconnect()},[]);const[E,T]=x.useState({}),[R,M]=x.useState(null),A=D=>T(_=>({..._,[D]:!_[D]})),k=["secrets","blocked","allowed",...r.flatMap(D=>[`${D.name}:mcps`,`${D.name}:skills`])],O=k.every(D=>E[D]);return n.jsx(Fu,{delay:150,children:n.jsxs("div",{className:Ve("@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:[n.jsx("div",{className:"flex items-center justify-end gap-3 border-b border-border/50 px-4 py-1.5",children:n.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[n.jsx("button",{type:"button",onClick:N,className:"rounded px-1 text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:"Reset layout"}),n.jsx("button",{type:"button",onClick:()=>T(Object.fromEntries(k.map(D=>[D,!O]))),className:"rounded px-1 text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:O?"Collapse all":"Expand all"})]})}),n.jsxs("div",{ref:b,className:Ve("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:[n.jsx("div",{ref:C.agents,"aria-label":"Agent types",className:"relative z-10 order-3 flex flex-col items-center gap-7 @2xl:order-none @2xl:col-start-1 @2xl:row-start-1 @2xl:row-span-4",children:(r.length?r:[{name:a,logo:null}]).map(D=>n.jsx(au,{canvas:b,label:D.name,children:n.jsxs("div",{className:"flex w-full max-w-[280px] flex-col items-center gap-2",children:[n.jsxs(gE,{"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:[n.jsx(_4,{shineColor:["var(--edge-neutral)","var(--frame-highlight)","var(--ink-faint)"],duration:18,"aria-hidden":"true"}),n.jsx("div",{className:"flex size-full items-center justify-center rounded-[9px] border border-stone-200/80 bg-card shadow-[inset_0_2px_4px_#1c191708,0_1px_0_var(--frame-highlight)]",children:D.logo?n.jsx("img",{src:D.logo,alt:"",className:"size-6 object-contain"}):n.jsx(TA,{className:"size-5 text-muted-foreground",strokeWidth:1.3,"aria-hidden":"true"})})]}),n.jsx("span",{className:"max-w-full break-words bg-card px-2 text-center text-xs font-medium",children:D.name}),r.length>0&&n.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:n.jsx("div",{role:"group","aria-label":`${D.name} resources`,className:"overflow-hidden rounded-xl border border-border/80 bg-card shadow-[0_2px_8px_#1c191705]",children:[{kind:"mcps",title:"MCPs",icon:e2},{kind:"skills",title:"Skills",icon:pL}].map(({kind:_,title:H,icon:G})=>{var K;const B=(K=D.resources)==null?void 0:K[_],P=(B==null?void 0:B.status)==="checked",V=(B==null?void 0:B.status)==="unsupported",q=P?B.items:[],W=`${D.name}:${_}`;return n.jsx(sp,{title:H,"aria-label":`${D.name} ${H}`,count:P?q.length:"-",icon:G,summary:V?"Setup integration unavailable":P?"In agent user configuration":"Inventory unavailable",open:!!E[W],onToggle:()=>A(W),className:Ve("border-0 shadow-none",_==="skills"&&"border-t border-border/60"),children:n.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:[q.map(J=>n.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:[n.jsx("span",{className:"min-w-0 flex-1 break-words",children:_==="skills"?J.name.replace(/^os-[a-f0-9]{8}-(?=.)/i,""):J.name}),J.disabled&&n.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"Disabled"})]},J.name)),!q.length&&n.jsx("p",{className:"px-2 py-2 text-center text-[11px] text-muted-foreground",children:V?`${H} integration unavailable`:P?`No ${H} found in user configuration`:`${H} inventory unavailable`})]})},_)})})})]})},`${e}-${S}-${D.name}`))}),n.jsx(au,{canvas:b,label:"Owner",children:n.jsxs(gE,{ref:C.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:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground",children:[n.jsx(J8,{className:"size-3 shrink-0",strokeWidth:1.5,"aria-hidden":"true"}),n.jsx("span",{children:"Owner"})]}),n.jsx("p",{className:"min-w-0 whitespace-normal text-[11px] font-medium leading-relaxed [overflow-wrap:anywhere]",children:h})]})},`${e}-${S}-owner`),n.jsx(au,{canvas:b,label:e,children:n.jsxs("div",{ref:w,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:[n.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:n.jsx(hc,{className:"size-6 text-stone-600",strokeWidth:1.3})}),n.jsx("p",{className:"mt-2 max-w-[156px] truncate text-xs font-medium",title:e,children:e})]})},`${e}-${S}-sandbox`),n.jsx(au,{canvas:b,label:"Gateway",children:n.jsx("div",{className:"relative z-10 flex justify-center @2xl:col-start-2 @2xl:row-start-3",children:n.jsxs(xa,{children:[n.jsxs(ba,{"data-graph-drag-handle":!0,render:n.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:[n.jsx($f,{className:"size-3 shrink-0",strokeWidth:1.5}),n.jsx("span",{children:p?p.remote?"Remote endpoint":"Local/tunnel endpoint":"Gateway not reported"})]}),n.jsxs(va,{className:"max-w-64 font-sans",children:[p?`Connected through ${p.name}. `:"","The sandbox’s host machine is not reported."]})]})})},`${e}-${S}-gateway`),n.jsx(au,{canvas:b,label:"Network access",children:n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/60 px-4 py-3",children:[n.jsx(Ig,{className:"size-3.5 text-muted-foreground",strokeWidth:1.5,"aria-hidden":"true"}),n.jsx("h4",{className:"text-[11px] font-medium",children:"Network"}),n.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Outbound access"})]}),n.jsxs(sp,{ref:C.allowed,title:"Approved network",count:i.length,icon:Yn,summary:"Destinations in policy",tone:"allowed",open:!!E.allowed,onToggle:()=>A("allowed"),className:"border-0 shadow-none",children:[i.map(D=>n.jsx(bE,{item:D,active:R===D.host,onFocus:()=>M(D.host),onBlur:()=>M(null)},D.host)),!i.length&&n.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No approved destinations"})]}),n.jsxs(sp,{ref:C.blocked,title:"Blocked network",count:c.length,icon:hL,summary:"Recent connection attempts",tone:"blocked",open:!!E.blocked,onToggle:()=>A("blocked"),className:"border-0 border-t border-border/60 shadow-none",children:[c.map(D=>n.jsx(bE,{item:D,denied:!0,active:R===D.host,onFocus:()=>M(D.host),onBlur:()=>M(null),onAllow:u?()=>u(D):void 0},D.host)),!c.length&&n.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No blocked attempts"})]})]})},`${e}-${S}-network`),n.jsx(au,{canvas:b,label:"Secrets",children:n.jsxs(sp,{ref:C.secrets,title:"Secrets",count:g.length,icon:zu,summary:g.length?g.map(D=>D.name).join(", "):"None attached",open:!!E.secrets,onToggle:()=>A("secrets"),className:"@2xl:col-start-2 @2xl:row-start-4",children:[g.map(D=>{var _;return n.jsxs(xa,{children:[n.jsx(ba,{render:n.jsx("button",{type:"button"}),className:"block w-full truncate rounded-lg border border-border/70 bg-card px-2.5 py-1.5 text-left text-[11px] outline-none focus-visible:ring-2 focus-visible:ring-ring",children:D.name}),n.jsxs(va,{className:"max-w-72 break-words font-sans",children:[D.name,D.type?` · ${D.type}`:"",(_=D.credentialKeys)!=null&&_.length?` · ${D.credentialKeys.join(", ")}`:""]})]},D.name)}),!g.length&&n.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No secrets attached"})]})},`${e}-${S}-secrets`),n.jsx(bW,{container:b,core:v,hub:w,groups:C},`${e}-${S}-${r.map(D=>D.name).join(",")}`)]})]})})}function bW({container:e,core:t,hub:r,groups:a}){const i=x.useRef(null),[c,u]=x.useState([]);return x.useEffect(()=>{function f(){var N;if(!e.current||!t.current||!r.current)return;const g=(N=i.current)==null?void 0:N.getScreenCTM();if(!g)return;const p=g.inverse(),b=E=>{const T=E.getBoundingClientRect(),R=new DOMPoint(T.left,T.top).matrixTransform(p),M=new DOMPoint(T.right,T.bottom).matrixTransform(p);return{left:R.x,top:R.y,right:M.x,bottom:M.y,width:M.x-R.x,height:M.y-R.y}},v=b(t.current),w=b(r.current),C=v.left+v.width/2,S=v.top+v.height/2;u(Object.entries(a).flatMap(([E,T])=>{const R=T.current?b(T.current):null;if(!R)return[];if(E==="owner"||E==="secrets"){const H=E==="owner"?v.top:w.bottom,G=E==="owner"?R.bottom:R.top,B=R.left+R.width/2,P=(H+G)/2;return[{key:E,d:`M ${C} ${H} C ${C} ${P}, ${B} ${P}, ${B} ${G}`,x:B,y:G}]}if(E==="agents")return[...T.current.querySelectorAll("[data-agent-node]")].map((H,G)=>{const B=b(H),P=v.left,V=B.right,q=B.top+B.height/2,W=(P+V)/2;return{key:`agent-${G}`,d:`M ${P} ${S} C ${W} ${S}, ${W} ${q}, ${V} ${q}`,x:V,y:q}});const M=v.right,A=R.left,k=b(T.current.querySelector("button")),O=k.top+k.height/2,D=M+(A-M)*.4,_=D+(A-D)*.5;return[{key:E,d:`M ${M} ${S} H ${D} C ${_} ${S}, ${_} ${O}, ${A} ${O}`,x:A,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]),n.jsx("svg",{ref:i,className:"pointer-events-none absolute inset-0 hidden size-full overflow-visible @2xl:block","aria-hidden":"true",fill:"none",children:c.map(f=>n.jsxs("g",{children:[n.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"}),n.jsx("circle",{cx:f.x,cy:f.y,r:"2.5",fill:"var(--card)",stroke:"var(--edge-neutral)"})]},f.key))})}async function vW(e,t){const r=[],a=[],i=[];for(const c of e)try{const u=await t(c.id);r.push(c.id);for(const f of u.failed??[])i.push({...f,rule:c.name})}catch(u){a.push({id:c.id,name:c.name,message:u.message})}return{deleted:r,failed:a,syncFailures:i}}const Gl={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"}},k1=["running","sleeping","provisioning","error","unknown"],yW={ready:"running",provisioning:"provisioning",starting:"provisioning",stopping:"provisioning",stopped:"sleeping",completed:"sleeping",error:"error",deleting:"unknown",unknown:"unknown",unspecified:"unknown"},Cg={ready:"Ready",provisioning:"Provisioning",starting:"Starting",stopping:"Stopping",stopped:"Stopped",completed:"Completed",error:"Error",deleting:"Deleting",unknown:"Unknown",unspecified:"Unknown"},Px=e=>yW[e]??"unknown",Za=e=>Gl[Px(e)],wW=e=>["ready","provisioning","starting"].includes(e),jW=e=>e==="stopped",SW=e=>e!=null&&e.length?e.join(" "):"Scratch shell",_p=(e,t)=>t||(/^sha256:[a-f0-9]{64}$/i.test(e??"")?"Unknown template":e)||"Gateway default";function NW(e){const t=Object.fromEntries(k1.map(r=>[r,0]));for(const r of e)t[Px(r.phase)]+=1;return{total:e.length,status:t}}function df(e,t){var a,i;const r=e.owner||((a=e.labels)==null?void 0:a["openshell.console/owner"])||((i=e.labels)==null?void 0:i.owner);return r&&r===(t==null?void 0:t.uid)&&t.email||r||"Not reported"}function F4(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 CW(e,t=Date.now()){return["stopped","completed"].includes(e.phase)?"Not running":e.phase==="ready"?F4(e.startedAt,t):"-"}const fa={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"}},Hw={"read-only":"Read only","read-write":"Read & write",full:"Any request",custom:"Specific requests",connect:"Connection",none:"No access",blocked:"Blocked"},kW=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],TW={own:AA,agent:hc,org:vL,group:Ka,policy:Iu,secret:zu},Po=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,G4=e=>e.replace(/^\*\*?\./,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,56);function Gd({children:e,tone:t="",title:r}){return n.jsx("span",{title:r,className:Ve("rounded-md border px-1.5 py-px font-mono text-[10.5px]",t||"border-border text-muted-foreground"),children:e})}function q4({source:e}){return n.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:[n.jsx("span",{className:Ve("size-1.5 rounded-full",ia[e].swatch),"aria-hidden":"true"}),ia[e].label]})}function Nu({className:e,children:t}){return n.jsx("div",{className:Ve("rounded-lg border border-border bg-card",e),children:t})}function EW({options:e,value:t,onChange:r,label:a}){return n.jsx("div",{role:"tablist","aria-label":a,className:"flex items-center gap-0.5 rounded-lg bg-muted p-0.5",children:e.map(i=>n.jsxs("button",{role:"tab","aria-selected":t===i.id,onClick:()=>r(i.id),className:Ve("rounded-md px-2.5 py-1 text-[12px] outline-none transition-all focus-visible:ring-2 focus-visible:ring-ring",t===i.id?"bg-card text-foreground shadow-[0_1px_2px_#0000001a]":"text-muted-foreground hover:text-foreground"),children:[i.label,i.count!=null&&n.jsx("span",{className:"ml-1 text-faint tabular-nums",children:i.count})]},i.id))})}function Y4({n:e,total:t}){return n.jsxs("span",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"h-1 w-14 overflow-hidden rounded-full bg-muted",children:n.jsx("span",{className:"block h-full rounded-full bg-stone-700",style:{width:`${t?e/t*100:0}%`}})}),n.jsxs("span",{className:"text-[12px] tabular-nums",children:[n.jsx("span",{className:"text-foreground",children:e}),n.jsxs("span",{className:"text-faint",children:["/",t]})]})]})}const K4="grid-cols-[minmax(0,2fr)_minmax(0,1fr)_8rem_7rem_5rem_1rem]",X4="grid-cols-[minmax(0,1.6fr)_7.5rem_5rem_minmax(0,1fr)_13.5rem]",vE="grid-cols-[minmax(0,1.2fr)_minmax(0,1.3fr)_8rem_5rem_1rem]",RW="grid-cols-[1rem_minmax(0,1.1fr)_4.5rem_minmax(0,1.5fr)_minmax(0,1fr)_7.5rem_5rem]",W4="grid-cols-[minmax(0,2fr)_5.5rem_minmax(0,1fr)_8rem_7rem_5rem_1rem]",Q4="grid-cols-[minmax(0,1.6fr)_5.5rem_7.5rem_5rem_minmax(0,1fr)_13.5rem]",yE="grid-cols-[minmax(0,1.2fr)_5.5rem_minmax(0,1.3fr)_8rem_5rem_1rem]",AW="grid-cols-[1rem_minmax(0,1.1fr)_5.5rem_4.5rem_minmax(0,1.5fr)_minmax(0,1fr)_7.5rem_5rem]";function MW({d:e,total:t,onOpen:r}){const[a,i]=x.useState(!1),c=Zs(),u=x.useId(),f=yg.filter(h=>e.sources.has(h)),m=[...e.grants].sort((h,g)=>h.sandbox.localeCompare(g.sandbox)||h.key.localeCompare(g.key));return n.jsxs("li",{children:[n.jsxs("button",{onClick:()=>i(!a),"aria-expanded":a,"aria-controls":u,className:Ve("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",e.location?W4:K4),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[n.jsx(Uw,{host:e.host,className:"size-6 text-[13px]"}),n.jsx("span",{className:"min-w-0",children:n.jsxs("span",{className:"block truncate font-mono text-[11px]",title:e.host,children:[e.host,n.jsx("span",{className:"ml-2 text-faint",children:[...e.ports].map(h=>`:${h}`).join(" ")})]})})]}),e.location&&n.jsx(Hs,{location:e.location}),n.jsx("span",{className:"flex flex-wrap gap-1",children:f.map(h=>n.jsx(q4,{source:h},h))}),n.jsx("span",{className:"text-[12px] text-muted-foreground",children:e.access.size===1?Hw[[...e.access][0]]??[...e.access][0]:"Mixed"}),n.jsx("span",{className:"block",children:n.jsx(Y4,{n:e.sandboxes.size,total:t})}),n.jsx("span",{className:"text-right text-[12px] tabular-nums text-muted-foreground",children:e.hits?e.hits.toLocaleString():"-"}),n.jsx(Lr,{className:Ve("size-3.5 text-faint transition-transform",a&&"rotate-90"),"aria-hidden":"true"})]}),n.jsx(lc,{initial:!1,children:a&&n.jsx($n.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:n.jsxs($n.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:[n.jsxs("div",{className:"mb-2 flex items-baseline gap-2",children:[n.jsx("h3",{className:"text-xs font-medium",children:"Sandbox access"}),n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[Po(e.sandboxes.size,"sandbox","sandboxes")," · ",Po(m.length,"rule assignment")]})]}),n.jsx("div",{className:"overflow-hidden rounded-md border border-border bg-card",children:n.jsxs("table",{className:"w-full table-fixed text-left text-xs","aria-label":`Sandbox access to ${e.host}`,children:[n.jsxs("colgroup",{children:[n.jsx("col",{className:"w-[35%]"}),n.jsx("col",{className:"w-[35%]"}),n.jsx("col",{className:"w-[15%]"}),n.jsx("col",{className:"w-[15%]"})]}),n.jsx("thead",{className:"border-b border-border bg-muted/40 text-[11px] text-muted-foreground",children:n.jsxs("tr",{children:[["Sandbox","Rule","Source"].map(h=>n.jsx("th",{scope:"col",className:"h-8 px-3 font-medium",children:h},h)),n.jsx("th",{scope:"col",className:"px-3",children:n.jsx("span",{className:"sr-only",children:"Actions"})})]})}),n.jsx("tbody",{className:"divide-y divide-border/60",children:m.map(h=>{const g=ia[qa(h.key)];return n.jsxs("tr",{className:"transition-colors hover:bg-muted/30 focus-within:bg-muted/30",children:[n.jsx("td",{className:"h-10 px-3",children:n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(hc,{"aria-hidden":"true",strokeWidth:1.4,className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate font-medium",title:h.sandbox,children:h.sandbox})]})}),n.jsx("td",{className:"px-3",children:n.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",title:cf(h.key),children:cf(h.key)})}),n.jsx("td",{className:"px-3 text-muted-foreground",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{"aria-hidden":"true",className:Ve("size-1.5 shrink-0 rounded-full",g.swatch)}),g.label]})}),n.jsx("td",{className:"px-2 text-right",children:n.jsxs(le,{variant:"ghost",size:"sm",className:"h-7 text-[11px] text-muted-foreground","aria-label":`View ${h.sandbox} policy for ${cf(h.key)}`,onClick:()=>r(h.sandbox),children:["View rules",n.jsx(Zi,{className:"size-3"})]})})]},`${h.sandbox}:${h.key}`)})})]})})]})})})]})}function OW({b:e,onDecide:t}){var r,a;return n.jsxs("li",{className:Ve("grid items-center gap-4 px-6 py-2",e.location?Q4:X4),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[n.jsx(Uw,{host:e.host,tone:"denied",className:"size-6 text-[13px]"}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block truncate font-mono text-xs",children:e.host}),n.jsxs("span",{className:"block text-[11.5px] text-muted-foreground",children:[":",e.port,e.lastAt?` · ${Lu(e.lastAt)}`:""]})]})]}),e.location&&n.jsx(Hs,{location:e.location}),n.jsx("span",{className:"text-[12px] tabular-nums",children:Po(e.sandboxes.size,"sandbox","sandboxes")}),n.jsxs("span",{className:"text-[12px] tabular-nums text-red-600/90",children:[e.attempts,"×"]}),n.jsx("span",{className:"truncate font-mono text-[11.5px] text-muted-foreground",children:[...e.programs].map(wg).join(", ")||"-"}),n.jsxs("span",{className:"flex items-center justify-end gap-1.5",children:[n.jsxs(Fi,{children:[n.jsxs(Gi,{disabled:((r=e.location)==null?void 0:r.connected)===!1,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",n.jsx(ha,{className:"size-3 opacity-70"})]}),n.jsx(qi,{align:"end",className:"w-60",children:n.jsxs(Ip,{children:[n.jsxs(C1,{children:["Allow ",e.host]}),n.jsxs(Rs,{onClick:()=>t("allow-org",e),children:[n.jsx(Ka,{}),"Choose groups",n.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"new rule"})]}),e.sandboxes.size===1&&n.jsxs(Rs,{onClick:()=>t("allow-one",e),children:[n.jsx(Ka,{}),"Groups of ",[...e.sandboxes][0]]})]})})]}),n.jsx(le,{disabled:((a=e.location)==null?void 0:a.connected)===!1,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 T1({title:e,count:t,actions:r,children:a}){return n.jsxs("section",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsx("h3",{className:"text-[16px] font-semibold tracking-[-0.01em]",children:e}),t!=null&&n.jsx("span",{className:"rounded-full bg-muted px-2 py-px text-[12px] tabular-nums text-muted-foreground",children:t}),r&&n.jsx("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:r})]}),a]})}function Lp({className:e,children:t}){return n.jsx("div",{className:Ve("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 wE({action:e}){return e==="block"?n.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"}):n.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 jE({hosts:e}){return n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",title:e.join(`
522
+ `),children:e.slice(0,3).join(", ")}),e.length>3&&n.jsxs("span",{className:"shrink-0 text-[11px] text-faint",children:["+",e.length-3]})]})}function SE({label:e,checked:t,mixed:r=!1,disabled:a,onChange:i}){const c=x.useRef(null);return x.useEffect(()=>{c.current&&(c.current.indeterminate=r)},[r]),n.jsx("input",{ref:c,type:"checkbox","aria-label":e,checked:t,disabled:a,onChange:i,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 NE({policies:e,org:t,sandboxes:r,groups:a,assignments:i,setupMembers:c,onEdit:u,onEditBlocked:f,onClearBlocked:m,selected:h,onSelect:g,onSelectAll:p,onDelete:b,deleting:v,location:w,sources:C,selectionSummary:S,showHeader:N=!0}){var k;const E=w?AW:RW,T=w?"col-span-6":"col-span-5",R=((k=t==null?void 0:t.org)==null?void 0:k.blocked)??[],M=e.filter(O=>h.has(O.id)).length,A=e.length>0&&M===e.length;return n.jsxs(n.Fragment,{children:[N&&n.jsxs(Lp,{className:E,children:[n.jsx(SE,{label:"Select all matching network rules",checked:(S==null?void 0:S.all)??A,mixed:(S==null?void 0:S.mixed)??(M>0&&!A),disabled:v||(S?!S.count:!e.length),onChange:p}),n.jsx("span",{children:"Rule"}),w&&n.jsx("span",{children:"Source"}),n.jsx("span",{children:"Action"}),n.jsx("span",{children:"Destinations"}),n.jsx("span",{children:"Groups"}),n.jsx("span",{children:"Enforced"}),n.jsx("span",{className:"text-right",children:"Actions"})]}),n.jsxs("ul",{className:"divide-y divide-border/60",children:[R.length>0&&n.jsxs("li",{className:Ve("grid min-h-10 items-center gap-4 px-6 py-2 transition-colors hover:bg-muted/60",E),children:[n.jsx("span",{}),n.jsxs("button",{disabled:v,onClick:f,"aria-label":"Edit blocked everywhere",className:Ve(T,"grid grid-cols-subgrid items-center gap-4 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx(t2,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate text-xs font-medium",children:"Blocked everywhere"})]}),w&&n.jsx(Hs,{location:w}),n.jsx(wE,{action:"block"}),n.jsx(jE,{hosts:R}),n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:"Every sandbox · beats every rule"}),n.jsx("span",{className:"text-[12px] text-faint",children:"Always"})]}),n.jsxs(le,{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:[n.jsx(ts,{className:"size-3.5"}),"Delete"]})]}),e.map(O=>{var q;const D=O.copies??[O],_=D.map(W=>{var L,X,ee;const K=C==null?void 0:C.find($=>{var U;return $.location.id===((U=W.location)==null?void 0:U.id)}),J=(L=K==null?void 0:K.data)==null?void 0:L.org,z=(((ee=(X=K==null?void 0:K.data)==null?void 0:X.fleetPolicy)==null?void 0:ee.sandboxes)??r).filter($=>{var U;return Mx(W,{name:$.name,groups:ir({assignments:(J==null?void 0:J.assignments)??i},$.name),setups:((U=(J==null?void 0:J.setupMembers)??c)==null?void 0:U[$.name])??[]})});return{total:z.length,enforced:z.filter($=>$.status==="loaded"&&$.rules.some(U=>U.key===`egress_${W.id}`)).length}}),H=_.reduce((W,K)=>W+K.total,0),G=_.reduce((W,K)=>W+K.enforced,0),B=[...new Set(D.map(W=>W.action))],P=[...new Set(D.flatMap(W=>W.destinations))],V=[...new Set(D.map(W=>{var K;return uf(W,((K=W.sourceOrg)==null?void 0:K.groups)??a)}))];return n.jsxs("li",{className:Ve("grid min-h-10 items-center gap-4 px-6 py-2 transition-colors hover:bg-muted/60",E,h.has(O.id)&&"bg-accent/40"),children:[n.jsx(SE,{label:`Select ${O.name}`,checked:h.has(O.id),disabled:v,onChange:()=>g(O.id)}),n.jsxs("button",{onClick:()=>u(O),disabled:v,"aria-label":`Edit ${O.name}`,title:w?`Details shown for ${w.label}. Open to choose a source.`:void 0,className:Ve(T,"grid grid-cols-subgrid items-center gap-4 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx(Iu,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate text-xs font-medium",children:O.name})]}),w&&n.jsx(fx,{record:O}),n.jsx("span",{className:"flex flex-wrap gap-1",children:B.map(W=>n.jsx(wE,{action:W},W))}),n.jsx(jE,{hosts:P}),n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:V.length>1?n.jsx("span",{title:V.join(`
523
+ `),children:"Varies by source"}):O.appliesTo.everyone||O.appliesTo.sandboxes.length||!O.appliesTo.groups.length&&!((q=O.appliesTo.setups)!=null&&q.length)?n.jsx("span",{className:"text-amber-700",title:`Current scope: ${uf(O,a)||"none"}`,children:"Assign a group"}):uf(O,a)}),H?n.jsx(Y4,{n:G,total:H}):n.jsx("span",{className:"text-[12px] text-faint",children:"No sandboxes"})]}),n.jsxs(le,{variant:"ghost",size:"sm",className:"h-7 justify-self-end px-2 text-xs text-muted-foreground hover:text-destructive","aria-label":`Delete ${O.name}`,title:w?`Delete from ${w.label}`:void 0,disabled:v,onClick:()=>b([O]),children:[n.jsx(ts,{className:"size-3.5"}),"Delete"]})]},O.id)})]})]})}function Z4({model:e,fleet:t,org:r,events:a,onOpen:i,onOpenGlobal:c,onDecide:u,onNavigate:f,onRefresh:m,onEditPolicy:h,onAddPolicy:g,onEditBlocked:p,onClearBlocked:b,forSandbox:v,onClearSandbox:w}){var he,Ae;const C=Pt(),[S,N]=x.useState(()=>new Set),[E,T]=x.useState(null),[R,M]=x.useState(!1),[A,k]=x.useState([]),O=x.useRef(!1),[D,_]=x.useState("all"),[H,G]=x.useState(""),[B,P]=x.useState(100),[V,q]=x.useState("rules"),[W,K]=x.useState(Date.now),J=x.useRef(null),z=x.useRef(null);x.useEffect(()=>{const ge=setInterval(()=>K(Date.now()),3e4),Pe=Fe=>{var _e;(Fe.metaKey||Fe.ctrlKey)&&Fe.key.toLowerCase()==="k"&&(Fe.preventDefault(),(_e=J.current)==null||_e.focus())};return window.addEventListener("keydown",Pe),()=>{clearInterval(ge),window.removeEventListener("keydown",Pe)}},[]),x.useEffect(()=>{var ge;P(100),(ge=z.current)==null||ge.scrollTo({top:0})},[H,D,V]);const L=x.useMemo(()=>j4(a,15,W),[a,W]),X=t.sandboxes,ee=X.length,$=e?xf("network",e.sources.flatMap(ge=>{var Pe,Fe;return(((Fe=(Pe=ge.data)==null?void 0:Pe.org)==null?void 0:Fe.policies)??[]).map(_e=>({..._e,location:ge.location,sourceOrg:ge.data.org,sourceSetups:ge.data.setups}))})):(r==null?void 0:r.policies)??[],U=(r==null?void 0:r.groups)??[],F=ge=>e?ht(ge):ge.id,{destinations:Y,blocked:ne,perSandbox:te}=x.useMemo(()=>e?UK(e.sources):p4(X,a,r),[X,a,r,e==null?void 0:e.sources]),ye=X.filter(ge=>ge.status==="loaded").length,ae=H.trim().toLowerCase(),ue=Y.filter(ge=>(D==="all"||ge.sources.has(D))&&(!ae||[ge.host,...ge.grants.flatMap(Pe=>[Pe.sandbox,Pe.key])].join(" ").toLowerCase().includes(ae))),se=ue.length,Q=[{id:"all",label:"All"},...yg.filter(ge=>ge===D||Y.some(Pe=>Pe.sources.has(ge))).map(ge=>({id:ge,label:ia[ge].label}))],ie=ne.filter(ge=>!ae||[ge.host,...ge.programs,...ge.sandboxes].join(" ").toLowerCase().includes(ae)),oe=X.filter(ge=>!ae||ge.name.toLowerCase().includes(ae)),pe=ge=>{var Pe;return!v||Mx(ge,{name:v,groups:ir(r,v),setups:((Pe=r==null?void 0:r.setupMembers)==null?void 0:Pe[v])??[]})},xe=$.filter(ge=>pe(ge)).filter(ge=>!ae||(ge.copies??[ge]).some(Pe=>{var Fe;return[Pe.name,Pe.action,...Pe.destinations,uf(Pe,((Fe=Pe.sourceOrg)==null?void 0:Fe.groups)??U)].join(" ").toLowerCase().includes(ae)})),je=$.filter(ge=>S.has(F(ge))),Ie=xe.filter(ge=>S.has(F(ge))).length;function ce(ge){N(Pe=>{const Fe=new Set(Pe);return Fe.has(ge)?Fe.delete(ge):Fe.add(ge),Fe})}function Te(){N(ge=>{const Pe=new Set(ge),Fe=xe.filter(Xe=>{var Je;return((Je=Xe.location)==null?void 0:Je.connected)!==!1}),_e=Fe.every(Xe=>ge.has(F(Xe)));for(const Xe of Fe)_e?Pe.delete(F(Xe)):Pe.add(F(Xe));return Pe})}async function re(){if(!(O.current||!(E!=null&&E.length))){O.current=!0,M(!0),k([]);try{const ge=e?E.map(Fe=>({...Fe,id:F(Fe)})):E,Pe=await vW(ge,Fe=>{if(!e)return C.deletePolicy(Fe);const _e=E.find(Xe=>F(Xe)===Fe);return e.apiFor(_e.location).deletePolicy(_e.id)});N(Fe=>{const _e=new Set(Fe);return Pe.deleted.forEach(Xe=>_e.delete(Xe)),Pe.failed.forEach(({id:Xe})=>_e.add(Xe)),_e}),k(Pe.failed),Pe.deleted.length&&He.success(`Deleted ${Po(Pe.deleted.length,"network rule")}`),Pe.failed.length&&He.error(`${Po(Pe.failed.length,"network rule")} could not be deleted. Review the errors and retry.`),Pe.syncFailures.length&&He.warning("Rules deleted, but some sandboxes could not be updated",{description:Pe.syncFailures.map(Fe=>`${Fe.rule} · ${Fe.sandbox}: ${Fe.error}`).join(`
524
+ `)}),T(null),await m()}finally{M(!1),O.current=!1}}}const fe=V==="rules"?xe.length:V==="destinations"?se:V==="blocked"?ie.length:oe.length,Re=V==="rules"?$.length:V==="destinations"?Y.length:V==="blocked"?ne.length:ee,Oe=!!(H||V==="destinations"&&D!=="all"),ke=()=>{G(""),_("all")};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 pt-4 pb-3 sm:px-6",children:[n.jsx("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Egress inventory",children:[{id:"rules",label:"Rules",count:$.length},{id:"destinations",label:"Destinations",count:Y.length},{id:"blocked",label:"Blocked hosts",count:ne.length,dot:"bg-red-500"},{id:"sandboxes",label:"Sandboxes",count:ee}].map(ge=>n.jsxs("button",{"aria-pressed":V===ge.id,onClick:()=>{q(ge.id),ke()},className:Ve("rounded-md px-3 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",V===ge.id?"bg-accent/70":"hover:bg-muted/60"),children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[ge.dot&&n.jsx("span",{className:Ve("size-1.5 rounded-full",ge.dot)}),ge.label]}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Af,{value:ge.count})})]},ge.id))}),n.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:n.jsx(S4,{points:L,height:34,title:"Connections · 15m"})})]}),n.jsxs("div",{className:"flex h-[3px] shrink-0 overflow-hidden bg-border",role:"img","aria-label":`${ye} of ${ee} sandbox policies enforced`,children:[ye>0&&n.jsx("span",{className:"bg-emerald-400/70",style:{width:`${ye/ee*100}%`}}),ee>ye&&n.jsx("span",{className:"flex-1 bg-amber-400/70"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 sm:px-6",children:[n.jsx(yo,{ref:J,value:H,onValueChange:G,placeholder:V==="sandboxes"?"Search sandbox…":V==="rules"?"Search rule, destination…":"Search destination, sandbox, rule…","aria-label":"Search egress",className:"mr-auto w-full sm:w-64"}),V==="destinations"&&n.jsx(pn,{"aria-label":"Filter by source",value:D,onChange:ge=>_(ge.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:Q.map(ge=>n.jsx("option",{value:ge.id,children:ge.id==="all"?"All sources":ge.label},ge.id))}),Oe&&n.jsxs(le,{variant:"ghost",size:"sm",onClick:ke,children:[n.jsx(In,{className:"size-3"}),"Clear"]}),v&&V==="rules"&&n.jsxs(n.Fragment,{children:[n.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 ",n.jsx("span",{className:"font-mono",children:v}),n.jsx("button",{"aria-label":"Show every rule",onClick:w,className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(In,{className:"size-3"})})]}),n.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>i(v),children:["Rules & history",n.jsx(Zi,{className:"size-3"})]})]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh egress",onClick:m,children:n.jsx(rl,{className:"size-3.5"})}),n.jsxs(le,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:g,children:[n.jsx(vs,{className:"size-3.5"}),"Add rule"]})]}),V==="rules"&&je.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border bg-accent/30 px-6 py-2",children:[n.jsxs("span",{role:"status",className:"mr-auto text-xs",children:[n.jsx("strong",{children:je.length})," selected",je.length>Ie&&n.jsxs("span",{className:"text-muted-foreground",children:[" · ",je.length-Ie," outside current filters"]})]}),n.jsx(le,{variant:"ghost",size:"sm",disabled:R,onClick:()=>N(new Set),children:"Clear selection"}),n.jsxs(le,{variant:"destructive",size:"sm",disabled:R||je.some(ge=>{var Pe;return((Pe=ge.location)==null?void 0:Pe.connected)===!1}),onClick:()=>T([...je]),children:[n.jsx(ts,{className:"size-3.5"}),R?"Deleting…":"Delete selected"]})]}),X.some(ge=>ge.source==="global")&&n.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:[n.jsx(ti,{className:"size-3.5"}),n.jsx("span",{className:"mr-auto",children:"A global policy overrides every sandbox's network rules."}),n.jsx(le,{variant:"outline",size:"sm",onClick:c,children:"Review"})]}),A.length>0&&n.jsxs(Qa,{id:"egress:delete-errors",tone:"error",title:"Some rules could not be deleted",onDismiss:()=>k([]),dismissLabel:"Dismiss deletion errors",children:[n.jsx("p",{children:"Failed rules remain selected for retry."}),n.jsx("ul",{className:"mt-1 max-h-28 overflow-auto",children:A.map(ge=>n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:ge.name}),": ",ge.message]},ge.id))})]}),e&&n.jsx(Mu,{model:e,what:"network rules"}),n.jsx("div",{ref:z,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:fe===0&&!(V==="rules"&&!Oe&&((Ae=(he=r==null?void 0:r.org)==null?void 0:he.blocked)!=null&&Ae.length||e!=null&&e.sources.some(ge=>{var Pe,Fe,_e,Xe;return(Xe=(_e=(Fe=(Pe=ge.data)==null?void 0:Pe.org)==null?void 0:Fe.org)==null?void 0:_e.blocked)==null?void 0:Xe.length})))?n.jsxs("div",{className:"py-20 text-center",children:[n.jsx(AA,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),n.jsx("p",{className:"text-sm",children:Oe?"No matching results":e!=null&&e.status.unavailable?"Egress unavailable":V==="rules"?v?`No rule applies to ${v} yet`:"No network rules yet":V==="blocked"?"No blocked hosts to review":V==="sandboxes"?"No sandboxes yet":"No open destinations"}),n.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:e!=null&&e.status.unavailable?"":!Oe&&V==="rules"?"Sandboxes are locked down: nothing leaves them until a rule allows it.":!Oe&&V==="destinations"?"Destinations appear when a sandbox policy allows access.":!Oe&&V==="blocked"?"Blocked connection attempts will appear here.":""}),Oe?n.jsx(le,{variant:"outline",className:"mt-4",onClick:ke,children:"Clear filters"}):V==="rules"&&!(e!=null&&e.status.any)&&n.jsxs(le,{className:"mt-4 bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:g,children:[n.jsx(vs,{}),"Add rule"]})]}):n.jsxs("div",{className:"min-w-[960px] bg-card",children:[V==="rules"&&e&&e.sources.map((ge,Pe)=>{var Xe,Je,ct;const Fe=(Xe=ge.data)==null?void 0:Xe.org,_e=xe.filter(At=>At.location.id===ge.location.id);return n.jsx(NE,{sources:e.sources,selectionSummary:{all:xe.length>0&&Ie===xe.length,mixed:Ie>0&&Ie<xe.length,count:xe.length},location:ge.location,showHeader:Pe===0,policies:_e,org:Oe?null:Fe,sandboxes:((ct=(Je=ge.data)==null?void 0:Je.fleetPolicy)==null?void 0:ct.sandboxes)??[],groups:(Fe==null?void 0:Fe.groups)??[],assignments:Fe==null?void 0:Fe.assignments,setupMembers:Fe==null?void 0:Fe.setupMembers,onEdit:h,onEditBlocked:()=>p(ge.location),onClearBlocked:()=>b(ge.location),selected:new Set(_e.filter(At=>S.has(F(At))).map(At=>At.id)),onSelect:At=>ce(F(_e.find(rt=>rt.id===At))),onSelectAll:Te,onDelete:T,deleting:R||!ge.location.connected},ge.location.id)}),V==="rules"&&!e&&n.jsx(NE,{policies:xe,org:Oe?null:r,sandboxes:X,groups:U,assignments:r==null?void 0:r.assignments,setupMembers:r==null?void 0:r.setupMembers,onEdit:h,onEditBlocked:p,onClearBlocked:b,selected:S,onSelect:ce,onSelectAll:Te,onDelete:T,deleting:R}),V==="destinations"&&n.jsxs(n.Fragment,{children:[n.jsxs(Lp,{className:e?W4:K4,children:[n.jsx("span",{children:"Destination"}),e&&n.jsx("span",{children:"Source"}),n.jsx("span",{children:e?"Granted by":"Source"}),n.jsx("span",{children:"Access"}),n.jsx("span",{children:"Sandboxes"}),n.jsx("span",{className:"text-right",children:"Requests"}),n.jsx("span",{})]}),n.jsx("ul",{className:"divide-y divide-border/60",children:ue.slice(0,B).map(ge=>{var Pe,Fe,_e,Xe;return n.jsx(MW,{d:ge,total:e?((Xe=(_e=(Fe=(Pe=e.sources.find(Je=>Je.location.id===ge.location.id))==null?void 0:Pe.data)==null?void 0:Fe.fleetPolicy)==null?void 0:_e.sandboxes)==null?void 0:Xe.length)??0:ee,onOpen:Je=>{var ct;((ct=ge.location)==null?void 0:ct.connected)!==!1&&i(Je,ge.location)}},ht({name:ge.host,location:ge.location}))})})]}),V==="blocked"&&n.jsxs(n.Fragment,{children:[n.jsxs(Lp,{className:e?Q4:X4,children:[n.jsx("span",{children:"Destination"}),e&&n.jsx("span",{children:"Source"}),n.jsx("span",{children:"Sandboxes"}),n.jsx("span",{children:"Attempts"}),n.jsx("span",{children:"Program"}),n.jsx("span",{className:"text-right",children:"Actions"})]}),n.jsx("ul",{className:"divide-y divide-border/60",children:ie.slice(0,B).map(ge=>n.jsx(OW,{b:ge,onDecide:(Pe,Fe)=>{var _e;((_e=ge.location)==null?void 0:_e.connected)!==!1&&u(Pe,Fe,ge.location)}},ht({name:ge.host,location:ge.location})))})]}),V==="sandboxes"&&n.jsxs(n.Fragment,{children:[n.jsxs(Lp,{className:e?yE:vE,children:[n.jsx("span",{children:"Sandbox"}),e&&n.jsx("span",{children:"Source"}),n.jsx("span",{children:"Rules by source"}),n.jsx("span",{children:"Policy"}),n.jsx("span",{className:"text-right",children:"Blocked"}),n.jsx("span",{})]}),n.jsx("ul",{className:"divide-y divide-border/70",children:oe.slice(0,B).map(ge=>{var Fe,_e,Xe;const Pe=te.get(e?ht({name:ge.name,location:ge.location}):ge.name)??{counts:{},blocked:0};return n.jsx("li",{children:n.jsxs("button",{disabled:((Fe=ge.location)==null?void 0:Fe.connected)===!1,onClick:()=>i(ge.name,ge.location),className:Ve("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",e?yE:vE),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx("span",{className:Ve("size-2 shrink-0 rounded-[3px]",Za(ge.phase).cell),"aria-hidden":"true"}),n.jsx("span",{className:"truncate font-mono text-xs",children:ge.name})]}),ge.location&&n.jsx(Hs,{location:ge.location}),n.jsx("span",{className:"items-center gap-3 flex",children:yg.filter(Je=>Pe.counts[Je]).map(Je=>n.jsxs("span",{className:"flex items-center gap-1.5 text-[12px] tabular-nums",title:ia[Je].label,children:[n.jsx("span",{className:Ve("size-1.5 rounded-full",ia[Je].swatch)}),Pe.counts[Je]]},Je))}),n.jsxs("span",{className:"items-center gap-1.5 text-[12px] flex",children:[n.jsx("span",{className:Ve("size-1.5 rounded-full",((_e=fa[ge.status])==null?void 0:_e.dot)??"bg-stone-200")}),ge.error?"Unavailable":ge.version?`v${ge.version} ${(Xe=fa[ge.status])==null?void 0:Xe.label.toLowerCase()}`:"-"]}),n.jsx("span",{className:Ve("text-right text-[12px] tabular-nums",Pe.blocked?"text-red-600/90":"text-faint"),children:Pe.blocked||"-"}),n.jsx(Lr,{className:"size-3.5 text-faint","aria-hidden":"true"})]})},ht(ge))})})]}),V!=="rules"&&fe>B&&n.jsxs("button",{onClick:()=>P(ge=>ge+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,fe-B)," more"]})]})}),n.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:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-medium text-foreground",children:fe.toLocaleString()}),Oe?` of ${Re.toLocaleString()}`:""," ",V==="blocked"?"blocked hosts":V]}),n.jsxs("span",{className:"hidden sm:inline",children:[ye,"/",ee," policies enforced · ⌘K to search"]})]}),n.jsx(Fr,{open:E!==null,onOpenChange:ge=>{!ge&&!O.current&&T(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",Po((E==null?void 0:E.length)??0,"network rule"),"?"]}),n.jsx(Xr,{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."})]}),n.jsx("ul",{"aria-label":"Network rules to delete",className:"max-h-48 overflow-auto rounded-md border border-border p-3 text-xs",children:E==null?void 0:E.map(ge=>n.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[ge.location&&n.jsx(Hs,{location:ge.location}),ge.name]},F(ge)))}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:R,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:R||!(E!=null&&E.length),onClick:re,children:R?"Deleting…":"Delete rules"})]})]})})]})}function CE({kind:e,onAdd:t}){const[r,a]=x.useState(!1),[i,c]=x.useState("GET"),[u,f]=x.useState("");return r?n.jsxs("form",{className:"flex items-center gap-1.5",onSubmit:async m=>{m.preventDefault(),await t({method:i,path:u})&&(a(!1),f(""))},children:[n.jsx(pn,{value:i,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:kW.map(m=>n.jsx("option",{children:m},m))}),n.jsx(Ot,{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}),n.jsx(le,{type:"submit",size:"xs",variant:e==="deny"?"destructive":"outline",disabled:!u.startsWith("/"),children:e==="deny"?"Block":"Allow"}),n.jsx(le,{type:"button",size:"icon-xs",variant:"ghost",onClick:()=>a(!1),"aria-label":"Cancel",children:n.jsx(In,{})})]}):n.jsxs("button",{onClick:()=>a(!0),className:Ve("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:[n.jsx(vs,{className:"size-3"}),e==="deny"?"Block request":"Allow request"]})}function DW(e){const t=[...new Set(e.endpoints.map(r=>Hw[r.access]??r.access))];return t.length===1?t[0]:"Mixed"}function Fw({rule:e,onOp:t,onDelete:r,busy:a,locked:i,managedBy:c,onManage:u}){const[f,m]=x.useState(!1),h=qa(e.key),g=TW[h],p=e.endpoints.map(v=>v.host),b=e.endpoints.some(v=>v.protocol!=="tcp"&&v.enforcement==="audit"||v.credentialRisk);return n.jsxs("div",{children:[n.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:[n.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:ia[h].label,children:n.jsx(g,{strokeWidth:1.5,className:"size-3.5 text-stone-600"})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-[13.5px] font-medium",children:cf(e.key)}),b&&n.jsx(ti,{className:"size-3 shrink-0 text-amber-600","aria-label":"Audit only or uninspected"})]}),n.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5",children:[n.jsx("span",{className:"truncate font-mono text-[11.5px] text-muted-foreground",children:p[0]}),p.length>1&&n.jsxs("span",{className:"shrink-0 text-[11.5px] text-faint",children:["+",p.length-1]})]})]}),n.jsx("span",{className:"hidden shrink-0 sm:block",children:n.jsx(q4,{source:h})}),n.jsx("span",{className:"hidden w-24 shrink-0 text-[12px] text-muted-foreground sm:block",children:DW(e)}),n.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(wg))].join(", ")}),n.jsx(Lr,{className:Ve("size-3.5 shrink-0 text-faint transition-transform duration-200",f&&"rotate-90 text-muted-foreground"),"aria-hidden":"true"})]}),n.jsx(lc,{initial:!1,children:f&&n.jsx($n.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:n.jsxs("div",{className:"space-y-4 px-5 pt-1 pb-5 pl-[4.25rem]",children:[h==="agent"&&n.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=>n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsxs("span",{className:"font-mono text-[12.5px] font-medium",children:[v.host,n.jsx("span",{className:"text-muted-foreground",children:v.ports.length?`:${v.ports.join(",")}`:""}),v.path?` ${v.path}`:""]}),n.jsx(Gd,{children:v.protocol}),n.jsx(Gd,{children:(Hw[v.access]??v.access).toLowerCase()}),v.protocol!=="tcp"&&v.enforcement==="audit"&&n.jsx(Gd,{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&&n.jsxs(Gd,{title:"Private addresses allowed",children:["ips ",v.allowedIps.join(", ")]}),v.credentialRisk&&n.jsx(Gd,{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"}),!i&&e.endpoints.length>1&&n.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)&&n.jsxs("ul",{className:"space-y-1 border-l border-border pl-3 font-mono text-[11.5px]",children:[v.allow.map((w,C)=>n.jsxs("li",{children:[n.jsx("span",{className:"text-emerald-700",children:"allow"})," ",n.jsxs("span",{className:"text-foreground/75",children:[w.method," ",w.path]})]},`a${C}`)),v.deny.map((w,C)=>n.jsxs("li",{children:[n.jsx("span",{className:"text-red-600",children:"block"})," ",n.jsxs("span",{className:"text-foreground/75",children:[w.method," ",w.path]})]},`d${C}`))]}),!i&&v.protocol!=="tcp"&&n.jsxs("div",{className:"flex flex-wrap gap-x-5 gap-y-1.5",children:[n.jsx(CE,{kind:"allow",onAdd:w=>t({kind:"addAllow",ruleName:e.key,host:v.host,ports:v.ports,binaries:e.binaries,match:w})}),n.jsx(CE,{kind:"deny",onAdd:w=>t({kind:"addDeny",ruleName:e.key,host:v.host,ports:v.ports,binaries:e.binaries,match:w})})]})]},`${v.host}:${v.ports.join(",")}:${v.path??""}`)),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.binaries.map(v=>n.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:[wg(v),!i&&e.binaries.length>1?n.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:n.jsx(In,{className:"size-2.5"})}):n.jsx("span",{className:"w-1"})]},v)),n.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[c&&(u?n.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]}):n.jsxs("span",{className:"text-[12px] text-muted-foreground",children:["Managed in ",c]})),!i&&r&&n.jsxs(le,{variant:"ghost",size:"xs",className:"text-muted-foreground hover:text-destructive",disabled:a,onClick:r,children:[n.jsx(ts,{}),"Delete"]})]})]})]})})})]})}function zW({revisions:e,onOpen:t}){const r=e.slice(0,10).reverse();return n.jsx("div",{className:"flex items-center gap-1","aria-label":"Revisions",children:r.map((a,i)=>{var c,u;return n.jsx("button",{onClick:()=>t(a.version),title:`v${a.version} · ${(c=fa[a.status])==null?void 0:c.label} · ${Lu(a.createdAt)}`,className:Ve("rounded-full outline-none transition-transform hover:scale-125 focus-visible:ring-2 focus-visible:ring-ring",i===r.length-1?"size-2.5":"size-1.5",((u=fa[a.status])==null?void 0:u.dot)??"bg-stone-200"),"aria-label":`Revision ${a.version}`},a.version)})})}function IW({sandbox:e,version:t,latest:r,onClose:a,onRestore:i}){var m,h,g,p;const c=Pt(),[u,f]=x.useState(null);return x.useEffect(()=>{f(null),t!=null&&c.revision(e,t).then(f).catch(b=>f({error:b.message}))},[e,t,c]),n.jsx(Lo,{open:t!=null,onOpenChange:b=>{b||a()},children:n.jsxs(la,{className:"w-full! overflow-y-auto sm:max-w-[460px]!",children:[n.jsxs(ca,{className:"border-b p-6",children:[n.jsxs(ua,{className:"font-mono text-base",children:[e," · v",t]}),n.jsx(da,{children:u!=null&&u.revision?`${(m=fa[u.revision.status])==null?void 0:m.label} · ${jf(u.revision.createdAt)}`:"Loading…"})]}),n.jsxs("div",{className:"space-y-4 px-6 pb-6",children:[(u==null?void 0:u.error)&&n.jsx("p",{className:"text-sm text-muted-foreground",children:u.error}),((h=u==null?void 0:u.revision)==null?void 0:h.loadError)&&n.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"])&&n.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?n.jsx(Nu,{className:"divide-y divide-border/70 overflow-hidden",children:u.policy.rules.map(b=>n.jsx(Fw,{rule:b,locked:!0,onOp:()=>{}},b.key))}):n.jsx("p",{className:"text-[12px] text-muted-foreground",children:"No rules."})),(u==null?void 0:u.policy)&&t!==r&&n.jsxs(le,{variant:"outline",size:"sm",onClick:()=>i(t),children:[n.jsx(E8,{}),"Restore"]})]})]})})}function J4({onClick:e}){return n.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:[n.jsx(K1,{className:"size-3.5 transition-transform group-hover:-translate-x-0.5"}),"All sandboxes"]})}function PW({onBack:e}){var f,m,h;const t=Pt(),[r,a]=x.useState(null),[i,c]=x.useState(!1),u=x.useCallback(()=>t.globalPolicy().then(a).catch(g=>a({error:g.message})),[t]);return x.useEffect(()=>{u()},[u]),n.jsxs("div",{className:"space-y-6 px-4 py-5 sm:px-6",children:[n.jsx(J4,{onClick:e}),r?r.error?n.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:r.error}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.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"}),n.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&&n.jsxs(le,{variant:"outline",className:"mt-5 rounded-lg border-destructive/30 text-destructive hover:bg-destructive/5",onClick:()=>c(!0),children:[n.jsx(t2,{}),"Remove"]})]}),((h=(m=r.current)==null?void 0:m.policy)==null?void 0:h.rules.length)>0&&n.jsx(Nu,{className:"divide-y divide-border/70 overflow-hidden",children:r.current.policy.rules.map(g=>n.jsx(Fw,{rule:g,locked:!0,onOp:()=>{}},g.key))}),r.revisions.length>0&&n.jsx(T1,{title:"History",children:n.jsx(Nu,{className:"divide-y divide-border/60",children:r.revisions.map(g=>{var p,b;return n.jsxs("div",{className:"flex h-11 items-center gap-3 px-5 text-[12.5px]",children:[n.jsx("span",{className:Ve("size-1.5 rounded-full",(p=fa[g.status])==null?void 0:p.dot),"aria-hidden":"true"}),n.jsxs("span",{className:"font-mono",children:["v",g.version]}),n.jsx("span",{className:"text-muted-foreground",children:(b=fa[g.status])==null?void 0:b.label}),n.jsx("span",{className:"ml-auto text-muted-foreground",children:Lu(g.createdAt)})]},g.version)})})})]}):n.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"}),n.jsx(Fr,{open:i,onOpenChange:c,children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsx(Kr,{children:"Remove the global policy?"}),n.jsx(Xr,{children:"Every sandbox reverts to its own rules."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{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 kE=[{id:"all",label:"All"},...yg.map(e=>({id:e,label:ia[e].label}))];function _W({name:e,sandbox:t,events:r,onBack:a,onNavigate:i,onDraft:c,onEditPolicy:u,onEditBlocked:f,onOpenGlobal:m,reloadSignal:h}){var q,W,K,J,z,L;const g=Pt(),p=gn(),[b,v]=x.useState(null),[w,C]=x.useState(!1),[S,N]=x.useState(null),[E,T]=x.useState(null),[R,M]=x.useState("all"),A=x.useCallback(async()=>{try{const X=await g.policy(e);return v(X),X}catch(X){v({error:X.message})}},[e,g]);x.useEffect(()=>{v(null),A()},[A]),x.useEffect(()=>{h&&A()},[h]);async function k(X){var ee;for(let $=0;$<20;$++){const U=await A(),F=(ee=U==null?void 0:U.revisions)==null?void 0:ee.find(Y=>Y.version===X);if((F==null?void 0:F.status)==="loaded"){He.success(`Policy v${X} is enforced in ${e}`);return}if((F==null?void 0:F.status)==="failed"){He.error(`v${X} failed to load: ${F.loadError??"unknown error"}`);return}await new Promise(Y=>setTimeout(Y,1500))}He.warning(`v${X} saved; not yet loaded by ${e}`)}async function O(X){C(!0);try{const ee=await g.applyOps(e,X);return He(`Saved as v${ee.version}`),k(ee.version),!0}catch(ee){return He.error(ee.message),!1}finally{C(!1)}}async function D(X){C(!0);try{const ee=await g.restore(e,X);He(`Restored v${X} as v${ee.version}`),T(null),k(ee.version)}catch(ee){He.error(ee.message)}finally{C(!1)}}const _=((q=b==null?void 0:b.effective)==null?void 0:q.rules)??[],H=new Set(_.flatMap(X=>X.endpoints.filter(ee=>!ee.blocked).map(ee=>ee.host))),G=x.useMemo(()=>{const X=new Map;for(const ee of r){if(ee.sandbox!==e||ee.verdict!=="denied")continue;const $=Ow(ee.destination);if(!$||m4($)||H.has($))continue;const U=X.get($)??{host:$,port:h4(ee.destination),count:0,binary:null,lastAt:null};U.count+=1,!U.binary&&ee.binary&&(U.binary=ee.binary),ee.at&&(!U.lastAt||ee.at>U.lastAt)&&(U.lastAt=ee.at),X.set($,U)}return[...X.values()].sort((ee,$)=>$.count-ee.count)},[r,e,b]),B=(b==null?void 0:b.source)==="global",P=Object.fromEntries(kE.map(X=>[X.id,_.filter(ee=>X.id==="all"||qa(ee.key)===X.id).length])),V=_.filter(X=>R==="all"||qa(X.key)===R);return n.jsxs("div",{className:"space-y-6 px-4 py-5 sm:px-6",children:[n.jsxs("div",{className:"space-y-5",children:[n.jsx(J4,{onClick:a}),b?b.error?n.jsx("p",{role:"alert",className:"py-16 text-center text-sm text-muted-foreground",children:b.error}):n.jsxs("header",{className:"flex flex-wrap items-end gap-x-6 gap-y-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("p",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:[n.jsx("span",{className:Ve("size-2 rounded-[3px]",Za(t==null?void 0:t.phase).cell)}),"Sandbox"]}),n.jsx("h2",{className:"mt-2 truncate text-xl font-semibold tracking-tight",children:e}),n.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4",children:[b.latest&&n.jsxs("span",{className:Ve("flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[12px]",(W=fa[b.latest.status])==null?void 0:W.cls),children:[n.jsxs("span",{className:"relative flex size-1.5",children:[b.latest.status==="loaded"&&n.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-emerald-400 opacity-60"}),n.jsx("span",{className:Ve("relative inline-flex size-1.5 rounded-full",(K=fa[b.latest.status])==null?void 0:K.dot)})]}),"v",b.latest.version," ",(J=fa[b.latest.status])==null?void 0:J.label.toLowerCase()]}),n.jsx(zW,{revisions:b.revisions,onOpen:T}),n.jsxs("span",{className:"text-[12.5px] text-muted-foreground tabular-nums",children:[Po(H.size,"destination")," open"]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(le,{variant:"outline",className:"rounded-lg",onClick:()=>{try{sessionStorage.setItem("gateway-box",p?JSON.stringify({name:e,location:p}):e)}catch{}i("sandboxes")},children:[n.jsx(Ig,{}),"View sandbox"]}),n.jsxs(le,{className:"rounded-lg bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",disabled:w||B,onClick:()=>c(null,k),children:[n.jsx(vs,{}),"Add rule"]})]})]}):n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"})]}),b&&!b.error&&n.jsxs(n.Fragment,{children:[B&&n.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:[n.jsx(ti,{className:"size-3.5"}),n.jsx("span",{className:"mr-auto",children:"Global policy in force · editing disabled"}),n.jsx(le,{variant:"outline",size:"sm",onClick:m,children:"Review"})]}),b.configurationError&&n.jsx("p",{className:"rounded-xl border border-red-200 bg-red-50/60 px-4 py-3 font-mono text-[11.5px] text-red-700",children:b.configurationError}),G.length>0&&!B&&n.jsx(T1,{title:"Blocked recently",count:G.length,children:n.jsx(Nu,{className:"divide-y divide-border/70 overflow-hidden",children:G.slice(0,6).map(X=>n.jsxs("div",{className:"flex items-center gap-3 px-5 py-3",children:[n.jsx(Uw,{host:X.host,tone:"denied",className:"size-7 text-[15px]"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"block truncate font-mono text-[12.5px]",children:[X.host,n.jsxs("span",{className:"text-muted-foreground",children:[":",X.port]})]}),n.jsxs("span",{className:"block text-[11.5px] text-muted-foreground",children:[X.binary?wg(X.binary):"Unknown program",X.lastAt?` · ${Lu(X.lastAt)}`:""]})]}),n.jsxs("span",{className:"text-[12px] tabular-nums text-red-600/90",children:[X.count,"×"]}),n.jsx(le,{variant:"outline",size:"sm",className:"h-7 rounded-lg text-[12px]",onClick:()=>c({name:G4(X.host),binaries:X.binary?[X.binary]:[],endpoints:[{host:X.host,ports:[X.port],protocol:X.port===443||X.port===80?"rest":"tcp",access:"read-only",enforcement:"enforce"}]},k),children:"Allow"})]},X.host))})}),n.jsx(T1,{title:"Rules",count:_.length,actions:n.jsx(EW,{label:"Filter rules",options:kE.filter(X=>X.id==="all"||P[X.id]>0).map(X=>({...X,count:P[X.id]})),value:R,onChange:M}),children:V.length===0?n.jsx(Nu,{className:"flex flex-col items-center border-dashed py-12 shadow-none",children:n.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No rules yet"})}):n.jsx(Nu,{className:"divide-y divide-border/70 overflow-hidden",children:V.map(X=>{const ee=qa(X.key);return n.jsx(Fw,{rule:X,busy:w,locked:!["own","agent"].includes(ee)||B,onOp:$=>O([$]),onDelete:["own","agent"].includes(ee)?()=>N(X.key):null,managedBy:ee==="secret"?"Secrets":ee==="policy"?"Network rules":ee==="org"?"Blocked everywhere":ee==="group"?"Groups":null,onManage:ee==="secret"?()=>i("secrets"):ee==="policy"?()=>u(X.key.replace(/^egress_/,"")):ee==="org"?f:ee==="group"?()=>i("groups"):void 0},X.key)})})})]}),n.jsx(Fr,{open:!!S,onOpenChange:X=>{X||N(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete rule ",S,"?"]}),n.jsxs(Xr,{children:[e," loses access immediately. Restorable from revisions."]})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:async()=>{await O([{kind:"removeRule",ruleName:S}]),N(null)},children:"Delete rule"})]})]})}),n.jsx(IW,{sandbox:e,version:E,latest:(L=(z=b==null?void 0:b.revisions)==null?void 0:z[0])==null?void 0:L.version,onClose:()=>T(null),onRestore:D})]})}function LW(e){const t=e.port===443||e.port===80;return{name:G4(e.host),binaries:[...e.programs],endpoints:[{host:e.host,ports:[e.port],protocol:t?"rest":"tcp",...t?{access:"read-only"}:{},enforcement:"enforce"}]}}const E1="egress-allow",kg="egress-sandbox",Ja="egress-policy",Tg=()=>{try{const e=JSON.parse(sessionStorage.getItem(Ja)??"null");return sessionStorage.removeItem(Ja),e}catch{return null}};function $W({combined:e,...t}){const r=gn();return e?n.jsx(BW,{...t}):n.jsx(R1,{...t},(r==null?void 0:r.id)??(r==null?void 0:r.context)??"default")}function R1({onNavigate:e,initialScope:t,initialGlobal:r=!1}){var ye,ae,ue,se,Q;const a=Pt(),i=gn(),c=ie=>e(ie,i),u=oi(),[f,m]=x.useState(t??null),[h,g]=x.useState(r),[p,b]=x.useState(()=>{try{const ie=sessionStorage.getItem(kg);return sessionStorage.removeItem(kg),ie}catch{return null}}),[v,w]=x.useState(null),[C,S]=x.useState(null),[N,E]=x.useState(null),[T,R]=x.useState(null),[M,A]=x.useState(!1),[k,O]=x.useState(!1),[D,_]=x.useState(!1),[H,G]=x.useState(null),[B,P]=x.useState(0),V=x.useRef(null),q=x.useCallback(async()=>{try{w(await a.fleetPolicy())}catch(ie){w({error:ie.message,sandboxes:[]})}try{S(await a.org())}catch{S(null)}},[a]);x.useEffect(()=>{q()},[q]);const[W,K]=x.useState(Tg);x.useEffect(()=>{const ie=()=>{const oe=Tg();oe&&(K(oe),q())};return window.addEventListener(Ja,ie),()=>window.removeEventListener(Ja,ie)},[q]),x.useEffect(()=>{W!=null&&W.new&&R({initial:Ki({appliesTo:{everyone:!1,groups:[],sandboxes:[],...W.new.appliesTo}})})},[W]);const J=x.useRef(null);x.useEffect(()=>{if(!(W!=null&&W.edit)||!C||J.current===W)return;const ie=C.policies.find(oe=>oe.id===W.edit);ie&&(J.current=W,R({initial:ie}))},[W,C]),x.useEffect(()=>{let ie=null;try{ie=JSON.parse(sessionStorage.getItem(E1)??"null"),sessionStorage.removeItem(E1)}catch{}!(ie!=null&&ie.sandbox)||!(ie!=null&&ie.host)||(m(ie.sandbox),E({sandbox:ie.sandbox,initial:LW({host:ie.host,port:Number(ie.port)||443,programs:new Set(ie.binary?[ie.binary]:[])}),after:()=>P(oe=>oe+1)}))},[]);const z=x.useMemo(()=>{const ie=new Set;for(const oe of u.events)oe.binary&&ie.add(oe.binary);return[...ie].sort()},[u.events]),L=ie=>{var oe;m(ie),(oe=V.current)==null||oe.scrollTo({top:0})},X=()=>{var ie;g(!0),(ie=V.current)==null||ie.scrollTo({top:0})},ee=()=>{var ie;m(null),g(!1),q(),(ie=V.current)==null||ie.scrollTo({top:0})};function $(ie,oe){const xe={everyone:!1,groups:ie==="allow-one"?ir(C,[...oe.sandboxes][0]):[],sandboxes:[]};if(ie.startsWith("allow")){R({initial:Ki({name:oe.host,destinations:[oe.host],appliesTo:xe})});return}G({kind:ie,b:oe})}function U(ie){const oe=((C==null?void 0:C.policies)??[]).find(pe=>pe.id===ie);oe&&R({initial:oe})}function F(ie,oe){var xe,je;const pe=((xe=ie.applied)==null?void 0:xe.length)??0;(je=ie.failed)!=null&&je.length?He.warning(`${oe}. ${Po(ie.failed.length,"sandbox","sandboxes")} could not be updated`,{description:ie.failed.map(Ie=>`${Ie.sandbox}: ${Ie.error}`).join(`
525
+ `)}):He.success(oe,{description:pe?`Updated ${Po(pe,"sandbox","sandboxes")}.`:void 0}),q(),P(Ie=>Ie+1)}async function Y(){_(!0);try{const ie=C??await a.org();F(await a.saveOrg({...ie.org,blocked:[]}),"Cleared blocked hosts"),O(!1)}catch(ie){He.error(ie.message)}finally{_(!1)}}async function ne(){const{b:ie}=H;try{const oe=C??await a.org();F(await a.saveOrg({...oe.org,blocked:[...oe.org.blocked,ie.host]}),`${ie.host} blocked everywhere`),G(null)}catch(oe){He.error(oe.message)}}const te=((ye=v==null?void 0:v.sandboxes)==null?void 0:ye.length)??0;return n.jsxs("div",{ref:V,className:"h-full overflow-y-auto",children:[h?n.jsx(PW,{onBack:ee}):f?n.jsx(_W,{name:f,sandbox:((ae=v==null?void 0:v.sandboxes)==null?void 0:ae.find(ie=>ie.name===f))??((ue=u.sandboxes)==null?void 0:ue.find(ie=>ie.name===f)),events:u.events,onBack:ee,onNavigate:c,onOpenGlobal:X,reloadSignal:B,onDraft:(ie,oe)=>E({sandbox:f,initial:ie,after:oe}),onEditPolicy:U,onEditBlocked:()=>A(!0)},f):v?v.error?n.jsx("p",{role:"alert",className:"py-24 text-center text-sm text-muted-foreground",children:v.error}):n.jsx(Z4,{fleet:v,org:C,events:u.events,onOpen:L,onOpenGlobal:X,onDecide:$,onNavigate:c,onRefresh:q,onEditPolicy:ie=>R({initial:ie}),onEditBlocked:()=>A(!0),onClearBlocked:()=>O(!0),onAddPolicy:()=>R({initial:Ki(p?{appliesTo:{everyone:!1,groups:ir(C,p),sandboxes:[]}}:{})}),forSandbox:p,onClearSandbox:()=>b(null)}):n.jsx("p",{role:"status",className:"py-24 text-center text-sm text-muted-foreground",children:"Loading…"}),n.jsx(Vw,{open:!!T,onOpenChange:ie=>{ie||R(null)},initial:T==null?void 0:T.initial,groups:(C==null?void 0:C.groups)??[],sandboxes:((v==null?void 0:v.sandboxes)??u.sandboxes??[]).map(ie=>ie.name),assignments:(C==null?void 0:C.assignments)??{},setupMembers:(C==null?void 0:C.setupMembers)??{},knownPrograms:z,onGroupCreated:()=>a.org().then(S).catch(()=>{}),onSaved:(ie,oe)=>F(ie,`${ie.deleted?"Deleted":"Saved"} ${oe.name}`)}),n.jsx(Fr,{open:k,onOpenChange:ie=>{!ie&&!D&&O(!1)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Unblock ",Po(((Q=(se=C==null?void 0:C.org)==null?void 0:se.blocked)==null?void 0:Q.length)??0,"host")," everywhere?"]}),n.jsx(Xr,{children:"Removes the shared blocked list and updates every sandbox. These hosts can then be reached if another rule allows them."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:D,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:D,onClick:Y,children:D?"Removing…":"Unblock all"})]})]})}),n.jsx(P4,{open:M,onOpenChange:A,org:C==null?void 0:C.org,onSaved:ie=>F(ie,"Saved blocked hosts")}),n.jsx(qX,{open:!!N,onOpenChange:ie=>{ie||E(null)},initial:N==null?void 0:N.initial,knownPrograms:z,onSubmit:async ie=>{var pe;const oe=await a.applyOps(N.sandbox,[{kind:"addRule",rule:ie}]);He(`Saved as v${oe.version}`),P(xe=>xe+1),(pe=N.after)==null||pe.call(N,oe.version)}}),n.jsx(Fr,{open:!!H,onOpenChange:ie=>{ie||G(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Block ",H==null?void 0:H.b.host," everywhere?"]}),n.jsxs(Xr,{children:["Adds it, with its subdomains, to the hosts blocked in every sandbox. No rule can open it. Applies to ",Po(te,"sandbox","sandboxes"),"."]})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:ne,children:"Block everywhere"})]})]})})]})}function BW({onNavigate:e,requestedLocation:t}){var T,R,M;const r=Uu(["fleetPolicy","org","activity","setups"]),a=r.sources.flatMap(A=>{var k,O;return(((O=(k=A.data)==null?void 0:k.org)==null?void 0:O.policies)??[]).map(D=>({...D,location:A.location,sourceOrg:A.data.org,sourceSetups:A.data.setups}))}),i=mx(a,r.apiFor,r.refresh),[c,u]=x.useState(null),[f,m]=x.useState(!1),[h,g]=x.useState(null),[p,b]=x.useState(null),[v,w]=x.useState(Tg);x.useEffect(()=>{const A=()=>w(Tg());return window.addEventListener(Ja,A),()=>window.removeEventListener(Ja,A)},[]),x.useEffect(()=>{var D,_;if(!v||r.loading)return;const A=v.location??t??r.locations.find(H=>H.connected&&!H.remote),k=(_=(D=r.sources.find(H=>H.location.id===(A==null?void 0:A.id)))==null?void 0:D.data)==null?void 0:_.org;if(!(A!=null&&A.connected)||!k)return;const O=v.new?Ki({appliesTo:{everyone:!1,groups:[],sandboxes:[],...v.new.appliesTo}}):k.policies.find(H=>H.id===v.edit);O&&(u({initial:O,location:A}),w(null))},[v,r.sources,r.loading,t]),x.useEffect(()=>{let A,k;try{A=sessionStorage.getItem(kg),sessionStorage.removeItem(kg),k=JSON.parse(sessionStorage.getItem(E1)??"null")}catch{}if(A||k!=null&&k.sandbox){const O=t;O!=null&&O.connected&&g({location:O,name:A??k.sandbox})}},[t]);const C=A=>r.sources.find(k=>k.location.id===(A==null?void 0:A.id)),S=r.sources.flatMap(A=>{var k,O;return(((O=(k=A.data)==null?void 0:k.fleetPolicy)==null?void 0:O.sandboxes)??[]).map(D=>({...D,location:A.location}))}),N=r.sources.flatMap(A=>{var k,O;return((O=(k=A.data)==null?void 0:k.activity)==null?void 0:O.events)??[]});function E(A,k,O){var H,G,B,P,V;const D=C(A),_=(H=D==null?void 0:D.data)==null?void 0:H.org;return n.jsx(Zn,{location:A,children:n.jsx(hx,{record:{...k,location:A},type:"network",offer:i.offer,children:n.jsx(Vw,{sourceControl:k.copies&&n.jsx(wf,{record:{...k,location:A},onChange:q=>u({initial:{...q,...a.find(W=>ht(W)===ht(q)),copies:k.copies,configurationCount:k.configurationCount},location:q.location})}),open:!0,onOpenChange:q=>{q||O()},initial:k,groups:(_==null?void 0:_.groups)??[],sandboxes:(((B=(G=D==null?void 0:D.data)==null?void 0:G.fleetPolicy)==null?void 0:B.sandboxes)??[]).map(q=>q.name),assignments:(_==null?void 0:_.assignments)??{},setupMembers:(_==null?void 0:_.setupMembers)??{},knownPrograms:[...new Set((((V=(P=D==null?void 0:D.data)==null?void 0:P.activity)==null?void 0:V.events)??[]).map(q=>q.binary).filter(Boolean))],onGroupCreated:r.refresh,onSaved:()=>{r.refresh(),He.success("Saved rule")}},ht({...k,location:A}))})})}return r.loading&&!r.sources.length?n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading egress…"}):n.jsxs(n.Fragment,{children:[n.jsx(Z4,{model:r,fleet:{sandboxes:S},events:N,org:null,onRefresh:r.refresh,onNavigate:e,onOpen:(A,k)=>g({name:A,location:k}),onOpenGlobal:()=>m("global"),onEditPolicy:A=>u({initial:A,location:A.location}),onAddPolicy:()=>m({initial:Ki()}),onEditBlocked:A=>{var k,O,D;return b({location:A,org:(D=(O=(k=C(A))==null?void 0:k.data)==null?void 0:O.org)==null?void 0:D.org})},onClearBlocked:A=>{var k,O,D;return b({location:A,org:{...(D=(O=(k=C(A))==null?void 0:k.data)==null?void 0:O.org)==null?void 0:D.org,blocked:[]}})},onDecide:(A,k,O)=>{var D,_,H,G,B;if(A.startsWith("allow")){const P=(_=(D=C(O))==null?void 0:D.data)==null?void 0:_.org;u({location:O,initial:Ki({name:k.host,destinations:[k.host],appliesTo:{everyone:!1,groups:A==="allow-one"?ir(P,[...k.sandboxes][0]):[],sandboxes:[]}})})}else{const P=(B=(G=(H=C(O))==null?void 0:H.data)==null?void 0:G.org)==null?void 0:B.org;b({location:O,org:{...P,blocked:[...(P==null?void 0:P.blocked)??[],k.host]}})}}}),f&&n.jsx(Dx,{onClose:()=>m(!1),children:(A,k)=>f==="global"?n.jsx(Lo,{open:!0,onOpenChange:O=>{O||k()},children:n.jsxs(la,{className:"overflow-auto sm:max-w-4xl",children:[n.jsxs(ca,{children:[n.jsx(ua,{children:"Global policy"}),n.jsx(da,{children:n.jsx(Hs,{location:A})})]}),n.jsx(Zn,{location:A,children:n.jsx(Rf,{children:n.jsx(R1,{onNavigate:e,initialGlobal:!0})})})]})}):E(A,f.initial,k)}),c&&E(c.location,c.initial,()=>u(null)),i.dialog,p&&n.jsx(Zn,{location:p.location,children:n.jsx(P4,{open:!0,onOpenChange:A=>{A||b(null)},org:p.org??{...(M=(R=(T=C(p.location))==null?void 0:T.data)==null?void 0:R.org)==null?void 0:M.org,...p.clear?{blocked:[]}:{}},onSaved:()=>{r.refresh(),He.success("Saved blocked hosts")}})}),h&&n.jsx(Lo,{open:!0,onOpenChange:A=>{A||(g(null),r.refresh())},children:n.jsxs(la,{className:"flex w-full flex-col gap-0 p-0 sm:max-w-5xl",children:[n.jsxs(ca,{className:"shrink-0 border-b px-6 py-4",children:[n.jsx(ua,{children:h.name}),n.jsx(da,{children:n.jsx(Hs,{location:h.location})})]}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Zn,{location:h.location,children:n.jsx(Rf,{children:n.jsx(R1,{onNavigate:e,initialScope:h.name})})})})]})})]})}const VW=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 UW(e,t=BK){let r=[];const a=new Set,i=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(i.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=i.get(u);if(!f)return;f.cancelled=!0;const m=r.find(g=>g.id===u);((h=m==null?void 0:m.preparation)==null?void 0:h.status)==="running"&&await f.api.cancelSetupPreparation(m.preparation.id)},start({id:u=crypto.randomUUID(),review:f,name:m,choices:h={},resumeJob:g,saveOnly:p=!1,api:b=e,location:v=null},w={}){if(i.has(u))return{id:u,promise:i.get(u).promise};const C={cancelled:!1,api:b};return i.set(u,C),r=[...r.filter(S=>S.id!==u),{id:u,name:m,review:f,location:v,prepared:p,status:"importing",message:p?"Saving your setup…":"Preparing your tools…"}],a.forEach(S=>S()),C.promise=(async()=>{var S;try{const N=p?{status:"saved",setup:await b.saveSetup(f.token,m,!0),inactive:f.items.filter(E=>{var T;return!E.disabled&&((T=E.issues)==null?void 0:T.length)}).map(E=>E.name)}:await t(b,f,m,h,{resumeJob:g,isCancelled:()=>C.cancelled,onProgress:E=>{var T;c(u,{preparation:E,message:E.message}),(T=w.onProgress)==null||T.call(w,E)},onReview:E=>{var T;c(u,{review:E,prepared:!0}),(T=w.onReview)==null||T.call(w,E)}});return c(u,{status:N.status,setup:N.setup,...N.status==="cancelled"?{prepared:!1}:{},message:N.status==="saved"?`Available in templates and sandboxes.${(S=N.inactive)!=null&&S.length?` Inactive: ${N.inactive.join(", ")}.`:""}${VW(N.setup)}`:N.status==="needs-attention"?"Some items need attention. Open the import to remove or fix them.":"Import cancelled. You can resume from the completed preparation."}),N}catch(N){throw c(u,{status:"failed",message:N.message}),N}finally{i.delete(u)}})(),{id:u,promise:C.promise}}}}const Xi=UW(cs),HW=(e,t)=>(e??[]).filter(r=>{var a;return r.action==="allow"&&(((a=r.appliesTo)==null?void 0:a.setups)??[]).some(i=>{var c;return i===t.id||i===((c=t.preparedFrom)==null?void 0:c.id)})}),FW=(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)},GW=(e,t,r)=>HW(e,t).some(a=>{var i;return FW(a.advanced)&&(((i=a.advanced)==null?void 0:i.ports)??[443,80]).map(Number).includes(Number(r.port??443))&&a.destinations.some(c=>i4(c,r.host))}),eD=e=>{var t;return!!(e.credentialRef||(t=e.credentialFields)!=null&&t.length)},qW=(e,t)=>String(e??"").toLowerCase()===String(t??"").toLowerCase(),TE=(e,t)=>!eD(e)&&(t.phase==="runtime"||t.phase==="auth"&&(e.requirements??[]).some(r=>r.phase==="runtime"&&qW(r.host,t.host))),A1=e=>`${e.host}${Number(e.port??443)===443?"":`:${e.port}`}`,YW=e=>`${A1(e)}${e.path||""}`;function KW(e,t,r,a=i=>i.requirements??[]){const i=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"&&eD(m))&&GW(t,f,h)?i.add(A1(h)):c.set(YW(h),A1(h));const u=new Set(c.values());return{covered:[...i].filter(f=>!u.has(f)),uncovered:[...c.keys()]}}function XW(e){const t=(e==null?void 0:e.hosts)??[],r=a=>[...new Set(t.filter(i=>i.host===a).flatMap(i=>i.items??[]))];return[...new Set((e==null?void 0:e.destinations)??t.map(a=>a.host))].filter(a=>{var i;return!((i=e==null?void 0:e.blocked)!=null&&i.includes(a))}).map(a=>({host:a,items:r(a)}))}const Gw=[{id:"codex",name:"Codex",logo:"codex"},{id:"claude",name:"Claude Code",logo:"claudecode"},{id:"cursor",name:"Cursor",logo:"cursor"}],M1=(e,t)=>e.items.filter(r=>r.kind===t).length,Va=e=>e.issues.filter(t=>!Aw(t)),WW=e=>e.items.filter(t=>!t.disabled&&!Va(t).length).length,Eg=e=>e.items.filter(t=>Va(t).length).length,EE=e=>e.sources.map(t=>{var r;return((r=Gw.find(a=>a.id===t))==null?void 0:r.name)||t}).join(", "),QW=e=>`${e.host}${e.port&&Number(e.port)!==443?`:${e.port}`:""}${e.path||""}`,ZW={build:"Downloads from",runtime:"Connects to",auth:"Sign-in"},RE={connected:"Connected","needs-sign-in":"Needs sign-in","needs-credentials":"Needs credentials",unverified:"Couldn’t check"},JW={prepared:"Ready","sign-in-in-sandbox":"Sign in after install","needs-attention":"Needs attention",disabled:"Inactive"},AE=e=>{var t,r,a;return e.disabled?"Inactive":Mw(e)?"Can’t run in a sandbox":Va(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"},eQ=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"),tD=(e=[])=>e.some(t=>!eQ(t))?"Enter domain names like api.github.com (no wildcards, IP addresses or local names).":e.length>20?"Add up to 20 websites.":"",nD=e=>{var t;return((t=e.credentialFields)==null?void 0:t.length)>0&&!e.requirements.some(r=>r.phase==="runtime")},sD=(e,t)=>{var r;return nD(e)&&d4(t)&&!((r=t==null?void 0:t.hosts)!=null&&r.length)},ff=e=>(e==null?void 0:e.egressPolicy)??(e!=null&&e.egressPolicyError?{error:e.egressPolicyError}:null),tQ=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function Mf({children:e}){return e?n.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/20 bg-destructive/5 p-3 text-xs text-destructive",children:e}):null}function rD({children:e}){return n.jsxs("div",{className:"flex gap-2 rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed text-muted-foreground",children:[n.jsx(Iu,{className:"mt-0.5 size-3.5 shrink-0"}),n.jsx("span",{children:e})]})}const ME=[{kind:"mcp",label:"MCPs",icon:e2},{kind:"skill",label:"Skills",icon:W1}];function oD({items:e,children:t}){return n.jsxs(nh,{defaultValue:e.some(r=>r.kind==="mcp")?"mcp":"skill",className:"min-w-0 gap-3",children:[n.jsx(sh,{"aria-label":"Setup item categories",className:"w-full",children:ME.map(({kind:r,label:a,icon:i})=>n.jsxs(Pr,{value:r,className:"gap-2 text-xs",children:[n.jsx(i,{className:"size-3.5"}),a,n.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))}),ME.map(({kind:r,label:a,icon:i})=>n.jsx(Io,{value:r,keepMounted:!0,className:"min-w-0",children:n.jsx(ho,{duration:.16,offset:2,blur:"0px",children:e.some(c=>c.kind===r)?t(e.filter(c=>c.kind===r)):n.jsxs("div",{className:"rounded-lg border border-dashed px-4 py-8 text-center",children:[n.jsx(i,{className:"mx-auto mb-2 size-5 text-muted-foreground",strokeWidth:1.5}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["No ",a," in this setup."]})]})})},r))]})}function nQ(e){const t=Uu(["setups"]);return n.jsx(iD,{...e,model:t})}function aD({combined:e,...t}){const r=gn();return e?n.jsx(nQ,{...t}):n.jsx(iD,{...t},(r==null?void 0:r.id)??(r==null?void 0:r.context)??"default")}function iD({sandbox:e=null,setupIds:t=[],model:r}){const a=Pt(),i=gn(),{locations:c}=vo(),[u,f]=x.useState(null),m=i??c.find(F=>F.context===u&&F.target===(a.target??"local"))??null;x.useEffect(()=>{if(i)return;let F=!0;return a.contextKey().then(Y=>{F&&f(Y)}).catch(()=>{}),()=>{F=!1}},[a,i]);const[h,g]=x.useState(null),p=x.useMemo(()=>r?r.sources.flatMap(F=>{var Y;return(((Y=F.data)==null?void 0:Y.setups)??[]).map(ne=>({...ne,location:F.location}))}):h,[r==null?void 0:r.sources,h]),b=x.useMemo(()=>r?xf("setups",p??[]):p,[p,!!r]),v=F=>r&&F.location?r.apiFor(F.location):a,[w,C]=x.useState(""),[S,N]=x.useState(!1),[E,T]=x.useState(null),[R,M]=x.useState(null),[A,k]=x.useState(!1),[O,D]=x.useState(""),[_,H]=x.useState(""),[G,B]=x.useState("all"),[P,V]=x.useState(!1),[q,W]=x.useState(!1),[K,J]=x.useState(null),z=x.useCallback(async()=>{W(!0);try{r?await r.refresh():g(await a.setups()),C("")}catch(F){C(F.message)}finally{W(!1)}},[a,r==null?void 0:r.refresh]),L=mx(p??[],F=>r.apiFor(F),z),ee=x.useSyncExternalStore(Xi.subscribe,Xi.getSnapshot).filter(F=>{var Y;return F.status==="saved"&&(r||((Y=F.location)==null?void 0:Y.context)===(m==null?void 0:m.context))}).map(F=>F.id).join(",");x.useEffect(()=>{z()},[z,ee]);const $=x.useMemo(()=>(b||[]).filter(F=>{const Y=F.copies??[F],ne=Y.some(te=>[te.name,...te.items.flatMap(ye=>[ye.name,...ye.sources||[]])].join(" ").toLowerCase().includes(_.trim().toLowerCase()));return(!e||t.includes(F.id))&&ne&&(G==="all"||(G==="review"?Y.some(te=>Eg(te)>0):Y.every(te=>Eg(te)===0)))}).sort((F,Y)=>F.name.localeCompare(Y.name,void 0,{numeric:!0})*(P?-1:1)),[b,_,G,P,e,t]),U=!!(_||G!=="all");return n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 py-3 sm:px-6",children:[n.jsx(yo,{"aria-label":"Search setups",placeholder:"Search…",value:_,onValueChange:H,className:"mr-auto min-w-32 flex-1 sm:max-w-60"}),n.jsxs(pn,{"aria-label":"Filter setups by status",value:G,onChange:F=>B(F.target.value),className:"h-8 w-36 bg-card text-xs",children:[n.jsx("option",{value:"all",children:"All statuses"}),n.jsx("option",{value:"imported",children:"Imported"}),n.jsx("option",{value:"review",children:"Needs review"})]}),U&&n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>{H(""),B("all")},children:"Clear"}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh setups",disabled:q,onClick:z,children:q?n.jsx(kt,{className:"size-3.5"}):n.jsx(rl,{className:"size-3.5"})}),n.jsxs(le,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>N(!0),children:[n.jsx(vs,{}),"Bring my setup"]})]}),w&&n.jsxs("div",{className:"space-y-2 border-b px-4 py-3 sm:px-6",children:[n.jsx(Mf,{children:w}),n.jsx(le,{variant:"outline",size:"sm",disabled:q,onClick:z,children:"Try again"})]}),r&&n.jsx(Mu,{model:r,what:"setups"}),n.jsx("div",{className:"flex-1",children:(!b||r!=null&&r.loading&&!r.sources.length)&&!w?n.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 py-12 text-xs text-muted-foreground",children:[n.jsx(kt,{}),"Loading setups…"]}):r!=null&&r.status.unavailable?n.jsx("p",{className:"px-4 py-16 text-center text-sm text-muted-foreground",children:"Setups unavailable"}):b&&!$.length?n.jsxs("div",{className:"px-4 py-16 text-center",children:[n.jsx(gf,{className:"mx-auto mb-3 size-6 text-muted-foreground",strokeWidth:1.5}),n.jsx("p",{className:"text-sm font-medium",children:e&&!U?"No setups in this sandbox":b.length?"No matching setups":"No setups yet"}),n.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:e&&!U?"Choose a setup from MCPs & Skills to enable it here.":b.length?"Try another name, tool, source agent, or status.":"Import MCPs and Skills from Codex, Claude Code, or Cursor."}),(!e||U)&&(b.length>0||!(r!=null&&r.status.any))&&n.jsx(le,{variant:"outline",size:"sm",className:"mt-4",onClick:()=>b.length?(H(""),B("all")):N(!0),children:b.length?"Clear filters":"Bring my setup"})]}):b&&n.jsx(ho,{duration:.15,offset:0,blur:"0px",children:n.jsxs(zV,{"aria-label":"MCPs & Skills",className:"min-w-[740px] text-xs",children:[n.jsx(IV,{children:n.jsxs(S5,{className:"hover:bg-transparent",children:[n.jsx(Ov,{scope:"col","aria-sort":P?"descending":"ascending",className:"h-9 px-4 text-[11px] font-normal text-muted-foreground sm:pl-6",children:n.jsxs("button",{className:"flex items-center gap-1.5 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>V(F=>!F),children:["Name",P?n.jsx(Pf,{className:"size-3"}):n.jsx(_f,{className:"size-3"})]})}),["Source","Source agents","MCPs","Skills","Created"].map(F=>n.jsx(Ov,{scope:"col",className:"h-9 px-4 text-[11px] font-normal text-muted-foreground",children:F},F)),n.jsx(Ov,{className:"w-12",children:n.jsx("span",{className:"sr-only",children:"Actions"})})]})}),n.jsx(PV,{children:$.map(F=>{var ye,ae,ue;const Y=F.copies??[F],ne=Gw.filter(se=>Y.some(Q=>Q.items.some(ie=>{var oe;return(oe=ie.sources)==null?void 0:oe.includes(se.id)}))),te=se=>{const Q=Y.map(pe=>M1(pe,se)),ie=Math.min(...Q),oe=Math.max(...Q);return ie===oe?ie:`${ie}–${oe}`};return n.jsxs(S5,{className:((ye=F.location)==null?void 0:ye.connected)===!1?"opacity-60":"cursor-pointer hover:bg-muted/40",onClick:()=>{var se;((se=F.location)==null?void 0:se.connected)!==!1&&T(F)},children:[n.jsx($l,{className:"max-w-72 px-4 py-2 sm:pl-6",children:n.jsxs("button",{disabled:((ae=F.location)==null?void 0:ae.connected)===!1,"aria-label":`Open setup ${F.name}`,onClick:se=>{se.stopPropagation(),T(F)},className:"group flex max-w-full items-center gap-2 rounded text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border bg-muted/40 text-muted-foreground",children:n.jsx(J1,{className:"size-3.5",strokeWidth:1.5})}),n.jsx("span",{className:"truncate font-mono text-xs font-medium group-hover:underline",children:F.name})]})}),n.jsx($l,{className:"px-4 py-2",children:F.location??m?n.jsx(fx,{record:{...F,location:F.location??m}}):n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Loading…"})}),n.jsx($l,{className:"px-4 py-2",children:n.jsxs("div",{className:"flex items-center gap-2",children:[ne.map(se=>n.jsx("img",{src:`/logos/agents/${se.logo}.svg`,alt:se.name,title:se.name,className:"size-4 object-contain"},se.id)),!ne.length&&n.jsx("span",{className:"text-muted-foreground",children:"Not reported"})]})}),n.jsx($l,{className:"px-4 py-2 tabular-nums",children:n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(e2,{"aria-hidden":"true",className:"size-3.5 text-muted-foreground",strokeWidth:1.5}),te("mcp")]})}),n.jsx($l,{className:"px-4 py-2 tabular-nums",children:n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(W1,{"aria-hidden":"true",className:"size-3.5 text-muted-foreground",strokeWidth:1.5}),te("skill")]})}),n.jsx($l,{className:"px-4 py-2 text-[11px] text-muted-foreground",children:F.createdAt?jf(F.createdAt):"Not reported"}),n.jsx($l,{className:"px-4 py-2 text-right sm:pr-6",children:n.jsx(le,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive",disabled:((ue=F.location)==null?void 0:ue.connected)===!1,"aria-label":`Delete setup ${F.name}`,title:F.location?`Delete from ${F.location.label}`:void 0,onClick:se=>{se.stopPropagation(),D(""),M(F)},children:n.jsx(ts,{className:"size-3.5"})})})]},ht(F))})})]})})}),n.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:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-medium text-foreground",children:$.length}),U?` of ${(b==null?void 0:b.length)||0}`:""," ",(b==null?void 0:b.length)===1?"setup":"setups"]}),n.jsx("span",{children:"Available in templates and sandboxes"})]}),R&&n.jsx(tn,{open:!0,onOpenChange:F=>{!F&&!A&&M(null)},children:n.jsxs(nn,{className:"sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["Delete “",R.name,"”?"]}),n.jsx(Sn,{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."})]}),n.jsx(Mf,{children:O}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{variant:"ghost",disabled:A,onClick:()=>M(null),children:"Cancel"}),n.jsxs(le,{variant:"destructive",disabled:A,onClick:async()=>{k(!0),D("");try{await v(R).deleteSetup(R.id,R.revision),r?z():g(F=>F.filter(Y=>ht(Y)!==ht(R))),T(F=>F&&ht(F)===ht(R)?null:F),M(null)}catch(F){D(F.message)}finally{k(!1)}},children:[A&&n.jsx(kt,{}),"Delete setup"]})]})]})}),S&&n.jsx(Zn,{location:S.location??m,children:n.jsx(cD,{initialReview:S.review,initialName:S.name,onClose:()=>N(!1),onSaved:(F,Y=S.location??m)=>{N(!1),!r&&Y&&(Y.context!==(m==null?void 0:m.context)||Y.target!==(m==null?void 0:m.target))?window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"setups",location:Y}})):(z(),J(ff(F)?{...ff(F),location:Y}:null))}})}),K&&n.jsx(Zn,{location:K.location??m,children:n.jsx(lD,{policy:K,onClose:()=>J(null)})}),E&&n.jsx(Zn,{location:E.location??m,children:n.jsx(hx,{record:E,type:"setups",offer:L.offer,children:n.jsx(lQ,{sourceControl:n.jsx(wf,{record:E,onChange:F=>T({...F,...p.find(Y=>ht(Y)===ht(F)),copies:E.copies})}),setup:E,sandbox:e,onPrepare:async()=>{try{const F=await v(E).prepareSavedSetup(E.id);N({review:F,name:E.name+" (updated)",location:E.location??m}),T(null)}catch(F){C(F.message)}},onUpdated:F=>{var Y;T({...F,location:E.location,copies:(Y=E.copies)==null?void 0:Y.map(ne=>ht(ne)===ht(E)?{...F,location:E.location}:ne)}),r?z():g(ne=>ne.map(te=>te.id===F.id?F:te))},onClose:()=>T(null)},ht(E))})}),L.dialog]})}function sQ(){const e=x.useSyncExternalStore(Xi.subscribe,Xi.getSnapshot),[t,r]=x.useState(null),[a,i]=x.useState(null);return n.jsxs(n.Fragment,{children:[e.map(c=>n.jsx(Qa,{id:`setup-import:${c.id}`,tone:c.status==="importing"?"progress":c.status==="saved"?"success":c.status==="failed"?"error":"warning",title:n.jsxs(n.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:n.jsxs(n.Fragment,{children:[n.jsx(ga,{location:c.location}),!["importing","saved"].includes(c.status)&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>r(c),children:"Review import"}),c.status==="saved"&&ff(c.setup)&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>i({policy:ff(c.setup),location:c.location}),children:"View egress policy"})]}),onDismiss:c.status==="importing"?void 0:()=>Xi.dismiss(c.id),dismissLabel:`Dismiss import notification for ${c.name}`,children:c.message},c.id)),t&&n.jsx(Zn,{location:t.location,children:n.jsx(cD,{initialJob:t,initialReview:t.review,initialName:t.name,onClose:()=>r(null),onSaved:c=>{i({policy:ff(c),location:t.location}),r(null)}},t.id)}),(a==null?void 0:a.policy)&&n.jsx(Zn,{location:a.location,children:n.jsx(lD,{policy:a.policy,onClose:()=>i(null)})})]})}function lD({policy:e,onClose:t}){var R,M,A,k,O;const r=Pt(),a=gn(),[i,c]=x.useState([]),[u,f]=x.useState(null),[m,h]=x.useState([]),[g,p]=x.useState(!1),[b,v]=x.useState(""),[w,C]=x.useState(!1);x.useEffect(()=>{if(e.error)return;let D=!0;return r.org().then(_=>{var G;if(!D)return;const H=(_.policies??[]).find(B=>B.id===e.id);h(_.groups??[]),f(H??null),c(((G=H==null?void 0:H.appliesTo)==null?void 0:G.groups)??[])}).catch(_=>{D&&v(`Could not load groups: ${_.message}`)}),()=>{D=!1}},[r,e.id,e.error]);const S=async()=>{p(!0),v("");try{await r.savePolicy({...u,appliesTo:{...u.appliesTo,everyone:!1,groups:i},isNew:!1}),f({...u,appliesTo:{...u.appliesTo,groups:i}}),C(!0)}catch(D){v(D.message)}finally{p(!1)}},N=u&&(i.length!==u.appliesTo.groups.length||i.some(D=>!u.appliesTo.groups.includes(D))),E=XW(e),T=()=>{try{sessionStorage.setItem(Ja,JSON.stringify({edit:e.id}))}catch{}t(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"egress",location:a}})),window.dispatchEvent(new Event(Ja))};return e.error?n.jsx(tn,{open:!0,onOpenChange:D=>{D||t()},children:n.jsxs(nn,{className:"sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Egress policy not saved"}),n.jsx(Sn,{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."})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:e.error}),n.jsx("div",{className:"flex justify-end",children:n.jsx(le,{onClick:t,children:"Done"})})]})}):n.jsx(tn,{open:!0,onOpenChange:D=>{D||t()},children:n.jsxs(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:e.created?"Egress policy created":"Egress policy updated"}),n.jsxs(Sn,{children:["We ",e.created?"created":"updated"," the egress policy “",e.name,"”. Sandboxes that use this setup can now reach the websites below. This policy doesn’t open anything else."]})]}),E.length>0&&n.jsx("ul",{"aria-label":"Allowed websites",className:"max-h-64 divide-y overflow-y-auto rounded-lg border text-xs",children:E.map(D=>n.jsxs("li",{className:"flex items-baseline justify-between gap-3 px-3 py-2",children:[n.jsx("span",{className:"min-w-0 break-all font-mono",children:D.host}),D.items.length>0&&n.jsx("span",{className:"max-w-[50%] text-right text-muted-foreground",children:D.items.join(", ")})]},D.host))}),((R=e.blocked)==null?void 0:R.length)>0&&n.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:["Not allowed because your organization blocks them: ",e.blocked.join(", "),"."]}),((M=e.approval)==null?void 0:M.length)>0&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Not in this policy, because an MCP sends credentials there or names it as its sign-in service: ",e.approval.map(D=>`${D.host} (${D.items.join(", ")})`).join(", "),". You approve these for each sandbox when you enable the setup there."]}),(((A=e.sync)==null?void 0:A.error)||((O=(k=e.sync)==null?void 0:k.failed)==null?void 0:O.length)>0)&&n.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&&n.jsxs("fieldset",{className:"grid gap-1.5 text-xs",children:[n.jsx("legend",{className:"font-medium",children:"Assign to groups"}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sandboxes in these groups get this policy, whether or not they use the setup."}),n.jsx(cc,{multiple:!0,groups:m,value:i,onChange:D=>{C(!1),c(D)},onCreated:D=>h(_=>[..._,D])}),b&&n.jsx("p",{role:"alert",className:"text-[11px] text-red-700",children:b}),w&&!N&&n.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"Groups saved."})]}),!u&&b&&n.jsx("p",{role:"alert",className:"text-[11px] text-red-700",children:b}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"To let an MCP reach another website, add it to this policy in Network › Egress."}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{variant:"outline",onClick:T,children:"Edit policy"}),N&&n.jsxs(le,{disabled:g,onClick:S,children:[g&&n.jsx(kt,{}),"Save groups"]}),n.jsx(le,{variant:N?"ghost":"default",disabled:g,onClick:t,children:N?"Skip":"Done"})]})]})})}function rQ({item:e}){var i;const t=c=>[...new Set(e.requirements.filter(u=>["runtime","auth"].includes(u.phase)&&c(u)).map(u=>u.host.toLowerCase()))],r=t(c=>TE(e,c)),a=t(c=>!TE(e,c));return n.jsxs(n.Fragment,{children:[r.length>0&&n.jsxs("p",{className:"text-muted-foreground",children:["Import adds ",r.join(", ")," to this setup’s egress policy."]}),a.length>0&&n.jsxs("p",{className:"text-muted-foreground",children:["You approve ",a.join(", ")," for each sandbox when you enable the setup there",e.credentialRef||(i=e.credentialFields)!=null&&i.length?", because this MCP sends credentials":"","."]})]})}function oQ({preparation:e,onCancel:t}){var p,b;const r=e.status==="running",[a,i]=x.useState(Date.now);x.useEffect(()=>{if(!r)return;i(Date.now());const v=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(v)},[r]);const c=Date.parse(e.createdAt),u=r?e.current:null,f=((p=e.items)==null?void 0:p.filter(v=>v.kind==="mcp"))??[],m=((b=e.items)==null?void 0:b.filter(v=>v.kind==="skill"))??[],h=m.every(v=>v.state),g=n.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/40"});return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(kt,{}),n.jsx("span",{className:"min-w-0 flex-1",children:u&&f.length?"Preparing your tools…":e.message}),r&&!Number.isNaN(c)&&n.jsx("span",{"aria-hidden":"true",className:"tabular-nums text-muted-foreground",children:tQ(Math.max(0,Math.floor((a-c)/1e3)))}),r&&n.jsx(le,{size:"sm",variant:"outline",onClick:t,children:"Cancel import"})]}),(f.length>0||m.length>0)&&n.jsxs("ul",{"aria-label":"Import progress",className:"space-y-1.5 border-t pt-2",children:[f.map(v=>{const w=(u==null?void 0:u.id)===v.id,C=!w&&Mw(v);return n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:w?n.jsx(kt,{className:"size-3.5"}):C||!v.state||v.state==="disabled"?g:v.state==="needs-attention"?n.jsx(Iu,{className:"size-3.5 text-amber-600"}):n.jsx(Yn,{className:"size-3.5 text-emerald-600"})}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:v.name}),n.jsx("span",{className:"min-w-0 max-w-[60%] truncate text-right text-muted-foreground",children:w?u.message:C?"Skipped":JW[v.state]||"Waiting"})]},v.id)}),m.length>0&&n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:h?n.jsx(Yn,{className:"size-3.5 text-emerald-600"}):g}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[m.length," ",m.length===1?"skill":"skills"]}),n.jsx("span",{className:"text-muted-foreground",children:h?"Done":"Waiting"})]})]})]})}function aQ({item:e,choice:t,disabled:r,onChange:a}){const i=tD(t==null?void 0:t.hosts)||(sD(e,t)?"Enter at least one website, for example api.github.com.":"");return nD(e)?n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("p",{className:"font-medium",children:"Where should this MCP send its credentials?"}),n.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."]}),n.jsx(Ot,{"aria-label":`Websites for ${e.name}`,"aria-invalid":i?!0:void 0,disabled:r,placeholder:"e.g. api.github.com",value:(t==null?void 0:t.hostsText)??"",onChange:c=>a(c.target.value)}),n.jsx("span",{className:"text-muted-foreground",children:"Domain names only, separated by commas or spaces. HTTPS only."}),i&&n.jsx("p",{className:"text-amber-700 dark:text-amber-400",children:i})]}):null}function cD(e){return e.initialReview||e.initialJob?n.jsx(uD,{...e}):n.jsx(iQ,{...e})}function iQ({onClose:e,onSaved:t,...r}){const a=js(),{locations:i,refresh:c}=vo(),[u,f]=x.useState(null),[m,h]=x.useState(null);return x.useEffect(()=>{if(!m)return;const g=i.find(p=>p.gateway===m&&p.connected);g&&(f(g),h(null))},[m,i]),u?n.jsx(Zn,{location:u,children:n.jsx(uD,{...r,onClose:e,onChangeLocation:()=>f(null),onSaved:g=>t(g,u)})}):n.jsx(tn,{open:!0,onOpenChange:g=>{g||e()},children:n.jsx(nn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:n.jsx(Ox,{locations:i,allowRemote:!!(a!=null&&a.localViewer),subject:"setup",connecting:!!m,onPick:g=>{const p=i.find(b=>(b.id??b.context)===g&&b.connected);if(p){if(a!=null&&a.localViewer&&(p.cloud||p.target==="cloud")){e(),window.dispatchEvent(new CustomEvent("openrod-import",{detail:{destination:p,type:"setups"}}));return}f(p)}},onConnected:g=>{h(g.gateway),c()},onCancel:e})})})}function uD({onClose:e,onSaved:t,onChangeLocation:r,initialReview:a=null,initialName:i="My setup",initialJob:c=null}){const u=Pt(),f=gn(),[m,h]=x.useState([]),[g,p]=x.useState(null),[b,v]=x.useState([]),[w,C]=x.useState(a),[S,N]=x.useState(i),[E,T]=x.useState(""),[R,M]=x.useState(null),[A,k]=x.useState(!1),[O,D]=x.useState("");async function _(se){k(!0),D("");try{await se()}catch(Q){D(Q.message)}finally{k(!1)}}const[H,G]=x.useState({}),[B,P]=x.useState((c==null?void 0:c.preparation)??null),[V,q]=x.useState((c==null?void 0:c.prepared)??!1),[W,K]=x.useState(!1),[J,z]=x.useState(!!c),L=x.useRef(c==null?void 0:c.id),X=x.useRef(!0);x.useEffect(()=>(X.current=!0,()=>{X.current=!1}),[]);const ee=(B==null?void 0:B.status)==="running"||A&&!!B,$=(se,Q)=>{q(!1),G(ie=>({...ie,[se]:{...ie[se],...Q}}))};async function U(se){const Q=await u.removeSetupReviewItem(w.token,se);C(Q),v(ie=>ie.filter(oe=>oe!==se)),G(ie=>Object.fromEntries(Object.entries(ie).filter(([oe])=>oe!==se))),P(null),L.current&&Xi.updateReview(L.current,Q,V)}async function F(se=!1){z(!0),K(!0);const Q=Xi.start({id:L.current,review:w,name:S,choices:H,saveOnly:se,api:u,location:f,resumeJob:(B==null?void 0:B.status)==="running"?B:void 0},{onProgress:ie=>{X.current&&P(ie)},onReview:ie=>{X.current&&(C(ie),q(!0),G({}))}});L.current=Q.id;try{const ie=await Q.promise;if(!X.current)return;ie.status==="saved"?t(ie.setup):ie.status==="needs-attention"?D("Some items couldn’t be prepared. Remove them or fix them, then retry the import."):(q(!1),D("Import cancelled. Completed preparation is kept here for retry."))}finally{X.current&&K(!1)}}const Y=(g==null?void 0:g.items.filter(se=>`${se.name} ${se.kind} ${se.sources.join(" ")}`.toLowerCase().includes(E.toLowerCase())))??[],ne=new Set(b),te=(se,Q)=>v(ie=>{const oe=new Set(ie);for(const pe of se)Q?oe.add(pe.id):oe.delete(pe.id);return[...oe]}),ye=Y.length>0&&Y.every(se=>ne.has(se.id)),ae=w?LK(w,H):[],ue=Object.values(H).some(se=>tD(se.hosts))||!!(w!=null&&w.items.some(se=>!se.disabled&&sD(se,H[se.id])));return n.jsxs(tn,{open:!0,onOpenChange:se=>{!se&&(L.current||W||!A&&!ee)&&e()},children:[n.jsxs(nn,{className:"flex max-h-[90svh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl",children:[n.jsxs(sn,{className:"shrink-0 px-6 pb-4 pt-6 pr-12",children:[n.jsx(Qt,{children:w?"Import setup":g?"Choose what to bring":"Bring my setup"}),n.jsx(Sn,{children:w?"Import downloads and checks your MCPs, then saves the setup.":g?"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."})]}),n.jsxs("div",{className:"min-h-0 space-y-5 overflow-y-auto px-6 pb-5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx(ga,{location:f}),r&&!L.current&&n.jsx(le,{size:"sm",variant:"ghost",disabled:A||ee,onClick:r,children:"Change"})]}),!g&&!w&&n.jsx(n.Fragment,{children:n.jsx("div",{className:"grid gap-2 sm:grid-cols-3",children:Gw.map(se=>n.jsxs("button",{type:"button","aria-pressed":m.includes(se.id),onClick:()=>h(Q=>Q.includes(se.id)?Q.filter(ie=>ie!==se.id):[...Q,se.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 ${m.includes(se.id)?"border-ring bg-muted":"bg-card"}`,children:[n.jsx("span",{className:"flex size-7 items-center justify-center rounded-lg border bg-muted/30",children:n.jsx("img",{src:`/logos/agents/${se.logo}.svg`,alt:"",className:"size-4"})}),se.name,m.includes(se.id)&&n.jsx(Yn,{className:"ml-auto size-3.5"})]},se.id))})}),g&&!w&&n.jsxs(n.Fragment,{children:[n.jsx(yo,{"aria-label":"Search discovered tools",placeholder:"Search MCPs and Skills…",value:E,onValueChange:T}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("p",{role:"status",className:"text-xs text-muted-foreground",children:[b.length," of ",g.items.length," selected",E.trim()?` · ${Y.length} matching`:""]}),n.jsx(le,{size:"sm",variant:"outline",disabled:A||!Y.length,onClick:()=>te(Y,!ye),children:ye?E.trim()?"Clear results":"Clear all":E.trim()?"Select all results":"Select all"})]}),n.jsx("div",{className:"grid items-start gap-3 sm:grid-cols-2",children:[{kind:"mcp",label:"MCPs"},{kind:"skill",label:"Skills"}].map(({kind:se,label:Q})=>{const ie=Y.filter(xe=>xe.kind===se),oe=ie.filter(xe=>ne.has(xe.id)).length,pe=ie.length>0&&oe===ie.length;return n.jsxs("section",{"aria-label":Q,className:"min-w-0 overflow-hidden rounded-xl border",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 border-b bg-muted px-3 py-2",children:[n.jsxs("h3",{className:"text-xs font-medium",children:[Q,n.jsxs("span",{className:"ml-2 font-normal text-muted-foreground",children:[oe,"/",ie.length]})]}),n.jsx(le,{size:"sm",variant:"ghost",className:"h-7 text-xs",disabled:A||!ie.length,"aria-label":`${pe?"Clear":"Select all"} ${Q}${E.trim()?" in search results":""}`,onClick:()=>te(ie,!pe),children:pe?"Clear":"Select all"})]}),n.jsxs("div",{className:"max-h-64 divide-y overflow-y-auto",children:[ie.map(xe=>n.jsxs("label",{className:"flex cursor-pointer items-start gap-3 p-3",children:[n.jsx($o,{disabled:A,"aria-label":`Import ${xe.name} from ${EE(xe)}`,checked:ne.has(xe.id),onCheckedChange:je=>te([xe],je)}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:xe.name}),n.jsxs("span",{className:"mt-1 block text-[11px] text-muted-foreground",children:[EE(xe),Mw(xe)?" · Can’t run in a sandbox":Va(xe).length?" · Needs attention":""]})]})]},xe.id)),!ie.length&&n.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:E.trim()?`No matching ${Q}`:`No ${Q} found`})]})]},se)})}),E.trim()&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Select all only affects the search results. Other selections are kept."}),g.warnings.map(se=>n.jsx("p",{className:"text-[11px] text-muted-foreground",children:se},se))]}),w&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"grid gap-1.5 text-xs",children:["Setup name",n.jsx(Ot,{disabled:A,value:S,onChange:se=>N(se.target.value),maxLength:80})]}),n.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground",children:n.jsxs("span",{children:[WW(w)," ready · ",Eg(w)," need attention"]})}),n.jsx(oD,{items:w.items,children:se=>n.jsx(NU,{className:"overflow-hidden rounded-lg border",children:se.map(Q=>{var ie,oe,pe,xe,je,Ie,ce,Te;return n.jsxs(CU,{value:Q.id,children:[n.jsxs("div",{className:"flex items-center [&>h3]:min-w-0 [&>h3]:flex-1",children:[n.jsxs(kU,{className:"items-center gap-3 rounded-none px-3 py-3 text-xs hover:bg-muted/30 hover:no-underline",children:[n.jsx("span",{className:"min-w-0 flex-1 break-words",children:Q.name}),n.jsx("span",{className:`shrink-0 text-[11px] font-normal ${["Needs attention","Can’t run in a sandbox"].includes(AE(Q))?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:AE(Q)})]}),n.jsx(le,{variant:"ghost",size:"icon",className:"mr-2 size-7 shrink-0 text-muted-foreground hover:text-destructive",disabled:A||ee,"aria-label":`Remove ${Q.name} from import`,title:"Remove from this import",onClick:()=>_(()=>U(Q.id)),children:n.jsx(ts,{className:"size-3.5"})})]}),n.jsxs(TU,{className:"space-y-3 border-t bg-muted/10 px-4 py-4 text-xs leading-relaxed [&_p:not(:last-child)]:mb-0",children:[Va(Q).length>0&&n.jsx("div",{className:"space-y-1 text-amber-700 dark:text-amber-400",children:Va(Q).map(re=>n.jsx("p",{children:re},re))}),Q.requirements.length>0&&n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"text-[11px] font-medium text-muted-foreground",children:"Network access"}),Q.requirements.map((re,fe)=>n.jsxs("p",{children:[n.jsxs("span",{className:"font-medium",children:[ZW[re.phase]||re.phase,":"]})," ",QW(re),n.jsxs("span",{className:"text-muted-foreground",children:[" · ",re.reason]})]},fe)),Q.kind==="mcp"&&!Q.disabled&&!Va(Q).some(re=>!re.startsWith("Connect credentials"))&&n.jsx(rQ,{item:Q})]}),Q.package&&n.jsxs("p",{children:["npm package ",Q.package.name,"@",((ie=Q.artifact)==null?void 0:ie.version)||Q.package.requested,Q.artifact?" · downloaded and version-locked":" · downloads when you press Import"]}),Q.verification&&n.jsxs("p",{children:["Connection: ",RE[Q.verification.status]||Q.verification.status,Q.verification.reason?` · ${Q.verification.reason}`:""]}),((oe=Q.artifact)==null?void 0:oe.verification)&&n.jsxs("p",{children:["Startup check: ",RE[Q.artifact.verification.status]||Q.artifact.verification.status,Q.artifact.verification.toolCount!==void 0?` · ${Q.artifact.verification.toolCount} tools found`:""]}),Q.credentialRef&&n.jsxs("p",{children:["Credentials connected · ",Q.credentialRef.provider,". Values are held by the gateway."]}),((pe=Q.configuration)==null?void 0:pe.endpoint)&&!Q.credentialRef&&n.jsx(rD,{children:"If this MCP needs an account, sign in from the agent inside the sandbox. Your desktop sign-in isn’t copied."}),Q.kind==="mcp"&&!Q.disabled&&(Q.configuration||Q.package)&&!((xe=Q.configuration)!=null&&xe.endpoint)&&n.jsx(aQ,{item:Q,choice:H[Q.id],disabled:A||ee,onChange:re=>$(Q.id,{hostsText:re,hosts:re.split(/[\s,]+/).map(fe=>fe.replace(/^https?:\/\//i,"").split("/")[0].toLowerCase()).filter(Boolean)})}),((je=Q.credentialFields)==null?void 0:je.length)>0&&n.jsxs("div",{className:"space-y-2 rounded border p-3",children:[n.jsx("p",{className:"font-medium",children:"Connect credentials"}),((Ie=Q.sourceCredentialFields)==null?void 0:Ie.length)>0&&n.jsxs("label",{className:"flex items-start gap-2",children:[n.jsx($o,{disabled:A||ee,checked:((ce=H[Q.id])==null?void 0:ce.useSourceSecrets)||!1,onCheckedChange:re=>$(Q.id,{useSourceSecrets:!!re})}),"Use the credentials from your config file (",Q.sourceCredentialFields.join(", "),")."]}),Q.credentialFields.filter(re=>{var fe,Re;return!((fe=H[Q.id])!=null&&fe.useSourceSecrets)||!((Re=Q.sourceCredentialFields)!=null&&Re.includes(re))}).map(re=>{var fe,Re;return n.jsxs("label",{className:"grid gap-1",children:[re,n.jsx(Ot,{type:"password",autoComplete:"new-password","aria-label":`${Q.name} ${re}`,disabled:A||ee,value:((Re=(fe=H[Q.id])==null?void 0:fe.secrets)==null?void 0:Re[re])||"",onChange:Oe=>{var ke;return $(Q.id,{secrets:{...(ke=H[Q.id])==null?void 0:ke.secrets,[re]:Oe.target.value}})}})]},re)}),n.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."})]}),Q.configuration&&n.jsxs("details",{className:"group/config",children:[n.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:[n.jsx(Lr,{className:"size-3 transition-transform group-open/config:rotate-90"}),"Configuration"]}),n.jsx("pre",{className:"mt-2 overflow-x-auto rounded border bg-muted/30 p-3 text-[11px]",children:JSON.stringify(Q.configuration,null,2)})]}),(Te=Q.files)==null?void 0:Te.map(re=>n.jsxs("button",{disabled:A,onClick:()=>_(async()=>M({path:re.path,...await u.setupFile(w.token,Q.id,re.path)})),className:"flex w-full items-center gap-1.5 rounded px-1 py-1 text-left hover:bg-muted",children:[n.jsx(W1,{className:"size-3"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:re.path}),n.jsxs("span",{className:"text-muted-foreground",children:[re.bytes," B"]})]},re.path))]})]},Q.id)})})}),B&&n.jsx("div",{role:"status","aria-live":"polite",className:"space-y-2 rounded-lg border bg-muted/30 p-3 text-xs",children:ee?n.jsx(oQ,{preparation:B,onCancel:()=>{Xi.cancel(L.current).catch(se=>D(se.message))}}):n.jsx("p",{children:V?dE(w)?"Checks finished. Some items need attention.":"Checks finished. Ready to save.":"Not finished. Press Import to continue."})}),a&&n.jsx(le,{variant:"ghost",disabled:ee||A,onClick:()=>{C(null),h([...new Set(a.items.flatMap(se=>se.sources))]),P(null),q(!1),G({})},children:"Re-scan sources"})]}),n.jsx(Mf,{children:O})]}),n.jsxs("div",{className:"shrink-0 space-y-4 border-t bg-muted/20 px-6 py-4",children:[w&&!ee&&!V&&ae.length>0&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[ae.map(se=>se.name).join(", ")," will be saved as inactive. You can fix ",ae.length===1?"it":"them"," later."]}),n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[g&&n.jsx(le,{variant:"ghost",disabled:A||ee,onClick:()=>{w?(C(null),q(!1),P(null),G({})):(p(null),v([])),D("")},children:"Back"}),n.jsx(le,{variant:"ghost",disabled:!L.current&&!W&&(A||ee),onClick:e,children:W?"Continue in background":L.current?"Close":"Cancel"}),w?n.jsxs(le,{disabled:A||!S.trim()||!w.items.length||ue,onClick:()=>_(()=>F(V&&!dE(w))),children:[A&&n.jsx(kt,{}),A?"Importing…":ee?"Resume import":J?"Retry import":"Import"]}):g?n.jsxs(le,{disabled:A||!b.length,onClick:()=>_(async()=>{C(await u.reviewSetup(g.token,b)),z(!1)}),children:[A&&n.jsx(kt,{}),"Review selection"]}):n.jsxs(le,{disabled:A||!m.length,onClick:()=>_(async()=>p(await u.discoverSetups(m))),children:[A&&n.jsx(kt,{}),"Discover tools"]})]})]})]}),R&&n.jsx(tn,{open:!0,onOpenChange:()=>M(null),children:n.jsxs(nn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-3xl",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:R.path}),n.jsx(Sn,{children:"Read-only file preview. Content is not executed."})]}),n.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-lg border bg-muted/30 p-4 font-mono text-xs",children:R.content})]})})]})}function lQ({setup:e,sandbox:t,onUpdated:r,onClose:a,onPrepare:i,sourceControl:c}){var G,B;const u=Pt(),f=gn(),[m,h]=x.useState([]),[g,p]=x.useState(null),[b,v]=x.useState(t||""),[w,C]=x.useState([]),[S,N]=x.useState(null),[E,T]=x.useState(null),[R,M]=x.useState([]),[A,k]=x.useState(!1),[O,D]=x.useState("");x.useEffect(()=>{let P=!0;return u.overview().then(V=>{P&&(h(V.sandboxes),p({...V.gateway,target:f==null?void 0:f.target}))}).catch(V=>{P&&D(V.message)}),()=>{P=!1}},[u]),x.useEffect(()=>{let P=!1,V;const q=async()=>{try{const W=await u.setupJobs(e.id);if(P)return;M(W),W.some(K=>K.status==="waiting")&&(V=setTimeout(q,2e3))}catch{}};return q(),()=>{P=!0,clearTimeout(V)}},[e.id,E,u]);async function _(P){k(!0),D("");try{await P()}catch(V){D(V.message),N(null)}finally{k(!1)}}const H=e.items.filter(P=>{var V;return!P.disabled&&!P.issues.length&&!P.credentialRef&&((V=P.auth)==null?void 0:V.mode)==="agent-session"});return n.jsx(tn,{open:!0,onOpenChange:P=>{!P&&!A&&a()},children:n.jsxs(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-lg",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:e.name}),n.jsx(Sn,{className:"sr-only",children:"Manage the MCPs and Skills in this saved setup."})]}),n.jsx("fieldset",{disabled:A,children:c}),n.jsx(oD,{items:e.items,children:P=>n.jsx("div",{className:"max-h-72 divide-y overflow-y-auto rounded-lg border",children:P.map(V=>{var q,W;return n.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[n.jsx("div",{className:"min-w-0 flex-1 self-center",children:V.issues.length||((q=V.auth)==null?void 0:q.mode)==="agent-session"?n.jsxs("details",{className:"group/item",children:[n.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:[n.jsx(Lr,{className:"size-3 shrink-0 text-muted-foreground transition-transform group-open/item:rotate-90"}),n.jsx("span",{className:"min-w-0 flex-1 break-words font-medium",children:V.name}),n.jsx("span",{className:`shrink-0 text-[10px] ${Va(V).length?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:Va(V).length?"Needs review":V.issues.length?"Installs automatically":"Sign-in needed"})]}),n.jsxs("div",{className:"space-y-1.5 pb-1 pl-5 pt-2 text-[11px] leading-relaxed text-muted-foreground",children:[V.issues.map(K=>n.jsx("p",{children:K},K)),((W=V.auth)==null?void 0:W.mode)==="agent-session"&&n.jsx("p",{children:"Sign in inside the sandbox after installation."})]})]}):n.jsx("p",{className:"break-words pl-5 text-xs font-medium",children:V.name})}),n.jsx(le,{variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground hover:text-destructive",disabled:A,"aria-label":`Delete ${V.name} from setup`,title:V.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:()=>_(async()=>{const{egressPolicyError:K,...J}=await u.deleteSetupItem(e.id,V.id,e.revision);N(null),T(null),r(J),K&&D(`Removed. The setup’s egress policy wasn’t updated: ${K}`)}),children:n.jsx(ts,{className:"size-3.5"})})]},V.id)})})}),n.jsx("div",{className:"flex items-center justify-between gap-3",children:n.jsxs(le,{variant:"outline",size:"sm",onClick:i,disabled:A,children:[Eg(e)?"Resolve issues":"Prepare setup",n.jsx(Lr,{className:"size-3.5"})]})}),n.jsxs("details",{className:"group/install border-t pt-3",open:t?!0:void 0,children:[n.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",n.jsx(Lr,{className:"size-3.5 text-muted-foreground transition-transform group-open/install:rotate-90"})]}),n.jsxs("div",{className:"space-y-3 pt-4",children:[n.jsxs("fieldset",{disabled:A,className:"grid gap-3",children:[n.jsxs("label",{className:"grid gap-1.5 text-xs",children:["Sandbox",n.jsxs(pn,{"aria-label":"Setup destination",value:b,onChange:P=>{v(P.target.value),N(null),T(null)},className:"w-full text-xs",children:[n.jsx("option",{value:"",children:"Choose a sandbox"}),m.map(P=>n.jsxs("option",{value:P.name,children:[P.name," · ",P.phase]},P.name))]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"mb-2 text-xs",children:"Enable for agents"}),n.jsx("div",{className:"flex flex-wrap gap-4",children:RV.map(P=>n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx($o,{disabled:!P.config,title:P.reason,checked:w.includes(P.id),onCheckedChange:V=>{C(q=>V?[...q,P.id]:q.filter(W=>W!==P.id)),N(null),T(null)}}),P.name,!P.config&&n.jsx("span",{className:"text-muted-foreground",children:" · Unavailable"})]},P.id))})]}),n.jsxs(le,{variant:"outline",disabled:!b||!w.length||A,onClick:()=>_(async()=>{T(null),N(await u.previewSetup(e.id,b,w))}),children:[A&&n.jsx(kt,{}),"Check requirements"]})]}),S&&n.jsxs("div",{className:"space-y-3",children:[S.problems.map(P=>n.jsx("p",{className:"text-xs text-amber-700",children:P},P)),S.network.map((P,V)=>{var q;return n.jsxs("div",{className:"rounded-lg border p-3 text-xs",children:[n.jsxs("p",{className:"flex justify-between gap-2 font-medium",children:[n.jsxs("span",{children:[P.item," · ",P.host,":",P.port,P.path||""]}),n.jsx("span",{children:P.status==="allowed"?"Existing access":P.status==="policy"?"Allowed by setup policy":P.status==="blocked"?"Blocked":P.status==="proposed"?"Requested access":"Needs review"})]}),n.jsx("p",{className:"mt-1 text-muted-foreground",children:P.reason}),((q=P.binaries)==null?void 0:q.length)>0&&n.jsx("p",{className:"mt-1 break-all font-mono text-muted-foreground",children:P.binaries.join(", ")}),P.credentialProvider&&n.jsxs("p",{children:["Credential binding: ",P.credentialProvider]})]},V)}),(G=S.inactive)==null?void 0:G.map(P=>n.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.name,": inactive · ",P.issues.join(" ")]},P.name)),S.notes.length>0&&n.jsx(rD,{children:S.notes.join(" ")}),!S.canEnable&&n.jsx("button",{type:"button",onClick:()=>{a(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"egress",location:f}}))},className:"inline-block text-xs underline underline-offset-4",children:"Review access in Network › Egress"}),n.jsxs("div",{className:"flex justify-end gap-2",children:[S.installed&&n.jsx(le,{variant:"outline",disabled:A,onClick:()=>_(async()=>{T(await u.removeSetup(e.id,b,S.token)),N(null)}),children:"Remove from sandbox"}),n.jsxs(le,{disabled:A||!S.canEnable,onClick:()=>_(async()=>{T(await u.enableSetup(e.id,b,S.token,S.requiresApproval)),N(null)}),children:[A&&n.jsx(kt,{}),S.requiresApproval?"Approve access & enable":S.installed?"Check & reapply":"Enable & check"]})]})]}),E&&n.jsx("p",{role:"status",className:"rounded-lg border bg-muted/30 p-3 text-xs",children:E.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."}),(B=E==null?void 0:E.checks)==null?void 0:B.map((P,V)=>n.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.item,": ",P.status,P.toolCount!==void 0?` · ${P.toolCount} tools discovered`:"",P.reason?` · ${P.reason}`:""]},V)),((E==null?void 0:E.status)==="installed"||(S==null?void 0:S.installed)||R.some(P=>P.sandbox===b&&P.status==="installed"))&&b&&(g==null?void 0:g.name)&&(g==null?void 0:g.workspace)&&H.length>0&&n.jsxs("div",{className:"space-y-2 text-xs",children:[n.jsxs("p",{className:"font-medium",children:["Sign in to ",H.map(P=>P.name).join(", ")]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(P=>{var V,q;return n.jsxs("a",{className:"rounded-md border px-3 py-2 hover:bg-muted",href:vg(b,((V=Fy(P))==null?void 0:V.command)||P,g),target:"_blank",rel:"noreferrer",children:["Open ",(q=Fy(P))==null?void 0:q.name]},P)})}),w.includes("codex")&&H.filter(P=>{var V;return(V=P.configuration)==null?void 0:V.endpoint}).map(P=>n.jsxs("a",{className:"block underline underline-offset-4",href:`${vg(b,"codex",g)}&setupLogin=${e.id}&mcp=${encodeURIComponent(P.id)}`,target:"_blank",rel:"noreferrer",children:["Sign in to ",P.name," with Codex"]},P.id)),n.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[n.jsx("summary",{className:"cursor-pointer",children:"About sign-in"}),n.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."})]})]}),R.filter(P=>!b||P.sandbox===b).map((P,V)=>n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[P.sandbox,": ",P.status,P.error?` · ${P.error}`:""]},V))]})]}),n.jsx(Mf,{children:O})]})})}function dD(e){const t=gn();return n.jsx(cQ,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}const OE=[];function cQ({value:e=[],onChange:t,inherited:r=OE,accessReview:a,onAccessReview:i,automaticAccess:c=!1,autoPrepare:u=!1,preparationContext:f="sandbox",localCatalog:m,retained:h=OE}){const g=Pt(),[p,b]=x.useState([]),[v,w]=x.useState(""),[C,S]=x.useState(null),N=!!i;x.useEffect(()=>{let D=!0;return g.setups().then(_=>{D&&b(_.filter(H=>!(m!=null&&m.available)||!H.localSource||m.setups.includes(H.id)||r.includes(H.id)||h.includes(H.id)))}).catch(_=>{D&&w(_.message)}),()=>{D=!1}},[g,m,r,h]),x.useEffect(()=>{if(!N)return;let D=!0;return g.org().then(_=>{D&&S(_.policies??null)}).catch(()=>{D&&S(null)}),()=>{D=!1}},[N,g]);const E=p.filter(D=>e.includes(D.id)||r.includes(D.id)),T=D=>u?IK(D):!D.disabled&&!D.issues.length,R=D=>u?D.items.filter(u4):[],M=D=>D.items.filter(_=>!T(_)),A=KW(E,C,D=>D.items.filter(T),D=>u?PK(D):D.requirements),k=E.some(D=>D.items.some(_=>{var H;return T(_)&&!_.credentialRef&&((H=_.auth)==null?void 0:H.mode)==="agent-session"})),O=JSON.stringify(E.map(D=>[D.id,D.revision]));return x.useEffect(()=>{i==null||i(c?Object.fromEntries(JSON.parse(O)):null)},[O,c,i]),n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-xs font-medium",children:"MCPs & Skills"}),p.map(D=>n.jsxs("div",{className:"rounded-lg border p-2.5 text-xs",children:[n.jsxs("label",{className:"flex items-start gap-2",children:[n.jsx($o,{"aria-label":`Use ${D.name}`,disabled:r.includes(D.id)||!D.items.some(T),checked:e.includes(D.id)||r.includes(D.id),onCheckedChange:_=>t(_?[...e,D.id]:e.filter(H=>H!==D.id))}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"block truncate",children:[D.name,r.includes(D.id)?" · From image template":""]}),n.jsxs("span",{className:"mt-1 block text-[11px] text-muted-foreground",children:[M1(D,"mcp")," MCPs · ",M1(D,"skill")," Skills",R(D).length?` · ${R(D).length} install automatically`:"",M(D).length?` · ${M(D).length} inactive`:""]})]})]}),M(D).length>0&&n.jsxs("details",{className:"mt-2 pl-6 text-[11px] text-muted-foreground",children:[n.jsx("summary",{className:"cursor-pointer",children:"Items that will stay inactive"}),n.jsxs("div",{className:"mt-2 space-y-2",children:[M(D).map(_=>n.jsxs("p",{children:[n.jsxs("span",{className:"font-medium text-foreground",children:[_.name,":"]})," ",_.issues.join(" ")]},_.id)),n.jsx("p",{children:"Resolve these items in MCPs & Skills."})]})]})]},D.id)),i&&A.uncovered.length>0&&n.jsxs("div",{className:"space-y-2 pt-1 text-xs",children:[n.jsx("p",{className:"font-medium",children:c?"Required access":"Network access"}),n.jsx("ul",{className:"divide-y text-[11px] text-muted-foreground",children:A.uncovered.map(D=>n.jsx("li",{className:"break-all py-1",children:D},D))}),!c&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"flex items-start gap-2",children:[n.jsx($o,{checked:!!a,onCheckedChange:D=>i(D?Object.fromEntries(E.map(_=>[_.id,_.revision])):null)}),"Allow these destinations for tools and connection checks."]}),!a&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Otherwise, review access in MCPs & Skills before installation."})]})]}),i&&A.covered.length>0&&n.jsxs("div",{className:"space-y-2 pt-1 text-xs",children:[n.jsx("p",{className:"font-medium",children:E.length>1?"Allowed by the setups’ egress policies":"Allowed by the setup’s egress policy"}),n.jsx("ul",{className:"divide-y text-[11px] text-muted-foreground",children:A.covered.map(D=>n.jsx("li",{className:"break-all py-1",children:D},D))})]}),n.jsx(Mf,{children:v}),k&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:f==="template"?"Sign in after launching the sandbox.":"Sign in inside the sandbox after installation."})]})}const uQ=e=>/failed to resolve .*image/i.test(e??"")&&/docker\.io/.test(e??""),dQ=e=>{var t;return Array.isArray(e==null?void 0:e.sandboxes)&&!e.sandboxes.length&&!((t=e.stranded)!=null&&t.length)&&!e.conflict},DE=e=>(e??[]).map(t=>typeof t=="string"?t:`${t.workspace}/${t.name}`);function fQ(e,{schedule:t=setTimeout,cancel:r=clearTimeout}={}){let a={status:null,asking:null,error:null},i=null,c=null;const u=new Set,f=b=>{a={...a,...b},u.forEach(v=>v())};function m(){var b;r(i),i=null,u.size&&(i=t(()=>{g()},((b=a.status)==null?void 0:b.state)==="working"?2e3:15e3))}function h(b){var C,S;if(!c||((C=b==null?void 0:b.job)==null?void 0:C.status)==="working")return;const{id:v,then:w}=c;c=null,((S=b==null?void 0:b.job)==null?void 0:S.id)===v&&b.job.status==="done"&&(w==null||w())}async function g(b=!1){try{const v=await e.gatewayDocker(b);return f({status:v}),h(v),v}catch{return a.status}finally{m()}}async function p(b,v,w,C=!0){var S;f({asking:a.asking&&{...a.asking,busy:!0},error:null});try{const N=await(b==="undo"?e.undoGatewayDocker(DE(v)):e.connectGatewayDocker(DE(v),C));return f({status:N,asking:null}),N.state==="working"&&N.job?c={id:N.job.id,then:w}:N.state!=="mismatch"&&(w==null||w()),N}catch(N){if(N.code==="GATEWAY_DOCKER_MISMATCH"&&!(b==="undo"&&N.fix==="manual")){const E=await g(!0);f({asking:{kind:N.fix==="manual"?"steps":b,then:w,sandboxes:b==="undo"?N.sandboxes??null:(E==null?void 0:E.sandboxes)??N.sandboxes??null,busy:!1}})}else f({error:N.message,asking:{...a.asking??{kind:b,then:w,sandboxes:((S=a.status)==null?void 0:S.sandboxes)??null},busy:!1}});return null}finally{m()}}return{subscribe(b){return u.add(b),u.size===1&&g(),()=>{u.delete(b),u.size||(r(i),i=null)}},getSnapshot:()=>a,refresh:g,connect:(b=(v=>(v=a.asking)==null?void 0:v.sandboxes)())=>{var w;return p("connect",b,(w=a.asking)==null?void 0:w.then)},undo:(b=(v=>(v=a.asking)==null?void 0:v.sandboxes)())=>{var w;return p("undo",b,(w=a.asking)==null?void 0:w.then)},ask({kind:b,then:v}={}){const w=a.status;if(b??(b=(w==null?void 0:w.fix)==="manual"?"steps":"connect"),b==="connect"&&((w==null?void 0:w.state)!=="mismatch"||dQ(w)))return p("connect",[],v,(w==null?void 0:w.state)==="mismatch");f({asking:{kind:b,then:v,sandboxes:b==="connect"?(w==null?void 0:w.sandboxes)??null:null,busy:!1},error:null})},close:()=>f({asking:null,error:null})}}const jr=fQ(lr("local"));function hQ({telemetry:e=en}={}){let t=[];const r=new Set,a=new Map,i=()=>r.forEach(f=>f()),c=(f,m)=>{t=t.map(g=>g.id===f?{...g,...typeof m=="function"?m(g):m}:g);const h=t.find(g=>g.id===f);(h==null?void 0:h.status)==="created"&&h.phase==="ready"&&e.ready(h.analyticsFlow),i()};function u(f){const m=t.find(v=>v.id===f),{task:h}=a.get(f),g=new AbortController,p=e.startFlow("sandbox_creation",m.analyticsProperties,m.analyticsFlow);a.set(f,{task:h,controller:g}),c(f,{status:"preparing",message:"Preparing environment…",error:null,build:null,analyticsFlow:p});const b={signal:g.signal,progress:v=>c(f,{message:v}),build:v=>{e.step(p,"building_image"),c(f,w=>{var C;return{build:{...v,logs:v.logs??((C=w.build)==null?void 0:C.logs)}}})},creating:()=>{e.step(p,"creating"),c(f,{status:"creating",message:"Creating sandbox…"})}};h(b).then(v=>{if(g.signal.aborted)return e.finishFlow(p,"cancelled"),c(f,{status:"cancelled",message:"Creation cancelled."});e.finishFlow(p,"created"),c(f,{status:"created",sandbox:{...v,location:v.location??m.location},message:""})}).catch(v=>{var w,C;g.signal.aborted||v.name==="AbortError"?(e.finishFlow(p,"cancelled"),c(f,{status:"cancelled",message:"Creation cancelled."})):(e.finishFlow(p,"failed",((C=(w=t.find(S=>S.id===f))==null?void 0:w.build)==null?void 0:C.status)==="failed"?"image_build":Cu(v)),c(f,{status:"failed",error:v.message,code:v.code??null,fix:v.fix??null,message:""}))})}return{subscribe:f=>(r.add(f),()=>r.delete(f)),getSnapshot:()=>t,start({name:f,location:m,task:h,analyticsProperties:g,analyticsFlow:p}){const b=crypto.randomUUID();return t=[...t,{id:b,name:f,location:m,status:"preparing",analyticsProperties:g,analyticsFlow:p}],a.set(b,{task:h}),u(b),b},retry(f){var m;a.has(f)&&((m=t.find(h=>h.id===f))==null?void 0:m.status)==="failed"&&u(f)},cancel(f){var h,g;const m=t.find(p=>p.id===f);(m==null?void 0:m.status)==="preparing"&&((g=(h=a.get(f))==null?void 0:h.controller)==null||g.abort(),c(f,{message:"Cancelling…"}))},update:c,dismiss(f){a.delete(f),t=t.filter(m=>m.id!==f),i()}}}const lo=hQ(),ql="gateway-box",fD=["error","stopped","completed","deleting"],zE=(e,t)=>JSON.stringify([e==null?void 0:e.context,t]),IE=e=>e.status==="created"&&e.phase!=="ready"&&!fD.includes(e.phase);function mQ({jobs:e}){const{sandboxes:t,loading:r}=vo();return x.useEffect(()=>{if(r)return;const a=new Map(t.map(i=>[zE(i.location,i.name),i]));for(const i of e){const c=a.get(zE(i.location,i.name));c?(c.phase!==i.phase||!i.reported)&&lo.update(i.id,{phase:c.phase,reported:!0,sandbox:c}):i.reported&&lo.dismiss(i.id)}},[t,r,e]),null}function PE(e){try{sessionStorage.setItem(ql,JSON.stringify({name:e.name,location:e.location}))}catch{}window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"sandboxes"}})),window.dispatchEvent(new Event(ql))}function pQ({job:e,onClose:t}){const r=x.useRef(null),a=x.useRef(!0),i=e.build;return x.useEffect(()=>{a.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[i==null?void 0:i.logs,e.message]),n.jsx(tn,{open:!0,onOpenChange:c=>{c||t()},children:n.jsxs(nn,{className:"flex h-[min(36rem,90svh)] flex-col gap-3 sm:max-w-2xl",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["Build logs · ",e.name]}),n.jsx(Sn,{children:(i==null?void 0:i.status)==="failed"?"Build failed":e.status==="failed"?"Creation failed":e.status==="cancelled"?"Creation cancelled":(i==null?void 0:i.status)==="ready"?"Build complete":e.message||"Preparing environment…"})]}),(i==null?void 0:i.name)&&n.jsx("p",{className:"truncate font-mono text-[11px] text-muted-foreground",children:i.name}),n.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:(i==null?void 0:i.logs)||((i==null?void 0:i.status)==="ready"?"Using a ready image template. No build was needed.":"Waiting for build output…")}),((i==null?void 0:i.error)||e.error)&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:(i==null?void 0:i.error)||e.error})]})})}function gQ(){const e=x.useSyncExternalStore(lo.subscribe,lo.getSnapshot),[t,r]=x.useState(null),a=e.filter(c=>c.status==="created"),i=e.find(c=>c.id===t);return n.jsxs(n.Fragment,{children:[a.some(IE)&&n.jsx(mQ,{jobs:a}),e.map(c=>{var p;const u=c.status==="created"&&c.phase==="ready",f=c.status==="created"&&fD.includes(c.phase),m=c.status==="preparing"||c.status==="creating"||IE(c),h=c.build&&n.jsx(le,{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:n.jsxs(n.Fragment,{children:[h,n.jsx(le,{size:"xs",variant:"ghost",onClick:()=>lo.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:n.jsxs(n.Fragment,{children:[h,c.code==="GATEWAY_DOCKER_MISMATCH"&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask({kind:c.fix==="manual"?"steps":void 0,then:()=>lo.retry(c.id)}),children:c.fix==="manual"?"Show steps":"Connect"}),n.jsx(le,{size:"xs",variant:"outline",onClick:()=>lo.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:n.jsxs(le,{size:"xs",variant:"outline",disabled:((p=c.location)==null?void 0:p.connected)===!1,onClick:()=>PE(c),children:["Open sandbox",n.jsx(Zi,{className:"size-3"})]})}:f?{tone:"error",title:`${c.name} needs attention`,body:`Status: ${Cg[c.phase]}. Open the sandbox to inspect it.`,actions:n.jsxs(le,{size:"xs",variant:"outline",onClick:()=>PE(c),children:["Open sandbox",n.jsx(Zi,{className:"size-3"})]})}:{tone:"progress",title:`Starting ${c.name}…`,body:"Your new sandbox is starting. You can keep browsing while it gets ready."};return n.jsx(Qa,{id:`sandbox-creation:${c.id}`,tone:g.tone,title:g.title,actions:n.jsxs(n.Fragment,{children:[n.jsx(ga,{location:c.location}),g.actions]}),onDismiss:m?void 0:()=>lo.dismiss(c.id),dismissLabel:`Dismiss status for ${c.name}`,children:g.body},c.id)}),i&&n.jsx(pQ,{job:i,onClose:()=>r(null)})]})}function uc({command:e,label:t}){const[r,a]=x.useState(!1);return n.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:[n.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[11px]",title:t?void 0:e,children:t??e}),n.jsx(le,{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?n.jsx(Yn,{className:"size-3.5 text-emerald-600"}):n.jsx(Lf,{className:"size-3.5"})})]})}const ny="openrod.gateway-docker.dismissed",_E="openrod.gateway-docker.shown",LE="openrod.gateway-docker.failed",sy=e=>{try{return localStorage.getItem(e)}catch{return null}},rp=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},qd=e=>{var t,r;return`${((t=e.build)==null?void 0:t.engineId)??""}|${((r=e.conflict)==null?void 0:r.dockerHost)??""}`},hD=()=>x.useSyncExternalStore(jr.subscribe,jr.getSnapshot),xQ=e=>`${e.workspace}/${e.name}`;function $E({label:e,sandboxes:t,className:r=""}){return n.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=>n.jsxs("li",{className:"break-all py-1",children:[a.name,n.jsxs("span",{className:"text-muted-foreground",children:[" · ",a.workspace]})]},xQ(a)))})}function bQ({status:e,asking:t,error:r}){var h;const a=t.kind==="undo",{sandboxes:i,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?n.jsx("span",{className:"font-mono",children:e.steps.file}):"OpenShell’s settings";return n.jsx(Fr,{open:!0,onOpenChange:g=>{!g&&!c&&jr.close()},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsx(Kr,{children:a?"Undo the Docker change?":"Connect OpenShell to Docker?"}),n.jsxs(Xr,{children:[u&&n.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?n.jsxs(n.Fragment,{children:["OpenRod removes its line from ",m," and restarts OpenShell. Sandboxes from templates won’t start after that."]}):n.jsxs(n.Fragment,{children:["OpenRod will set DOCKER_HOST in ",m," and restart OpenShell."]})]})]}),i==null&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Running sandboxes restart too. Files in /sandbox are kept; open sessions end."}),(i==null?void 0:i.length)>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:"These sandboxes restart. Files in /sandbox are kept; open sessions end."}),n.jsx($E,{label:"Sandboxes that restart",sandboxes:i})]}),f.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-destructive",children:"These won’t start again: their images aren’t in this Docker."}),n.jsx($E,{label:"Sandboxes that won’t start again",sandboxes:f,className:"text-destructive"})]}),!a&&(e==null?void 0:e.alternative)&&n.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&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:r}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:c,children:"Cancel"}),n.jsx(Wr,{variant:f.length?"destructive":"default",disabled:c,onClick:()=>a?jr.undo():jr.connect(),children:c?"Restarting…":a?"Undo and restart":u?"Switch and restart":"Restart OpenShell"})]})]})})}function vQ({status:e,asking:t}){const[r,a]=x.useState(!1),[i,c]=x.useState(!1),u=e==null?void 0:e.steps;async function f(){var h;a(!0);const m=await jr.refresh(!0);if(a(!1),(m==null?void 0:m.state)!=="ok")return c(!0);He.success("OpenShell can see Docker now"),jr.close(),(h=t.then)==null||h.call(t)}return n.jsx(tn,{open:!0,onOpenChange:m=>{m||jr.close()},children:n.jsxs(nn,{className:"sm:max-w-xl",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Connect OpenShell to Docker"}),n.jsx(Sn,{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&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"break-all font-mono text-[11px]",children:u.file}),n.jsx(uc,{command:u.append,label:u.line}),u.restart?n.jsx(uc,{command:u.restart}):n.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)&&n.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”."}),i&&!r&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"OpenShell still can’t see your Docker images."}),n.jsx(le,{variant:"outline",disabled:r,onClick:f,children:r?"Checking…":"Check again"})]})})}function yQ(){const{status:e,asking:t,error:r}=hD(),[a,i]=x.useState(()=>sy(ny)),[c,u]=x.useState(()=>sy(LE)),[f,m]=x.useState(null),h=x.useRef(null),g=e==null?void 0:e.lastChange,p=e==null?void 0:e.job;x.useEffect(()=>{if(!g)return;const S=()=>{if(!(document.visibilityState!=="visible"||sy(_E)===g.id||Date.now()-Date.parse(g.at)>36e5)){if(document.removeEventListener("visibilitychange",S),rp(_E,g.id),g.kind==="connect")return m(g.id);He.success("Undid the Docker change"),e.build&&(rp(ny,qd(e)),i(qd(e)))}};return S(),document.addEventListener("visibilitychange",S),()=>document.removeEventListener("visibilitychange",S)},[g==null?void 0:g.id]),x.useEffect(()=>{if(!f)return;let S;const N=()=>{clearTimeout(S),document.visibilityState==="visible"&&(S=setTimeout(()=>m(null),15e3))};return N(),document.addEventListener("visibilitychange",N),()=>{clearTimeout(S),document.removeEventListener("visibilitychange",N)}},[f]),x.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 b=()=>{rp(ny,qd(e)),i(qd(e))},v=!!(e!=null&&e.build)&&a===qd(e),w=(p==null?void 0:p.kind)==="undo"?"Undoing the Docker change…":"Connecting OpenShell to Docker…",C=(e==null?void 0:e.state)==="working"&&p?{tone:"progress",title:w,body:p.stage!==w&&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:()=>{b(),rp(LE,p.id),u(p.id)},actions:n.jsxs(n.Fragment,{children:[e.state==="mismatch"&&e.fix!=="manual"&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask({kind:"connect"}),children:"Try again"}),e.steps&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.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&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.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:n.jsxs(n.Fragment,{children:[n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask(),children:e.fix==="manual"?"Show steps":"Connect"}),n.jsx(le,{size:"xs",variant:"ghost",onClick:b,children:"Not now"})]})}:null;return n.jsxs(n.Fragment,{children:[C&&n.jsx(Qa,{id:"gateway-docker",tone:C.tone,title:C.title,actions:C.actions||void 0,onDismiss:C.onDismiss,children:C.body}),t&&(t.kind==="steps"?n.jsx(vQ,{status:e,asking:t}):n.jsx(bQ,{status:e,asking:t,error:r}))]})}const O1="mt-1 text-[11px] text-red-700";function wQ(){const{status:e}=hD();return(e==null?void 0:e.state)==="mismatch"?n.jsxs("div",{className:`${O1} flex flex-wrap items-center gap-2`,children:["OpenShell can’t see your Docker images.",n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask(),children:e.fix==="manual"?"Show steps":"Connect"})]}):n.jsx("p",{className:O1,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 jQ({local:e}){return e?n.jsx(wQ,{}):n.jsx("p",{className:O1,children:"Start Docker, then delete this sandbox and create it again."})}const mD=x.createContext(void 0);function SQ(){return x.useContext(mD)}const NQ=x.forwardRef(function(t,r){const{className:a,defaultPressed:i=!1,disabled:c=!1,form:u,onPressedChange:f,pressed:m,render:h,type:g,value:p,nativeButton:b=!0,style:v,...w}=t,C=ys(p||void 0),S=SQ(),N=(S==null?void 0:S.value)??[],E=(c||(S==null?void 0:S.disabled))??!1,[T,R]=po({controlled:S?C!==void 0&&N.indexOf(C)>-1:m,default:i,name:"Toggle",state:"pressed"}),{getButtonProps:M,buttonRef:A}=bo({disabled:E,native:b}),k={disabled:E,pressed:T},O=[A,r],D=[{"aria-pressed":T,onClick(G){var V;const B=!T,P=yt(Ur,G.nativeEvent);f==null||f(B,P),!P.isCanceled&&(C&&((V=S==null?void 0:S.setGroupValue)==null||V.call(S,C,B,P)),!P.isCanceled&&R(B))}},w,M],_=Nt("button",t,{enabled:!S,state:k,ref:O,props:D}),H=x.useMemo(()=>({disabled:E,focusableWhenDisabled:!1}),[E]);return S?n.jsx(M4,{tag:"button",render:h,className:a,style:v,metadata:H,state:k,refs:O,props:D}):_}),CQ=x.createContext(void 0);function kQ(){return x.useContext(CQ)}const TQ=x.forwardRef(function(t,r){const{defaultValue:a,disabled:i=!1,loopFocus:c=!0,onValueChange:u,orientation:f="horizontal",multiple:m=!1,value:h,className:g,render:p,style:b,...v}=t,w=vx(),C=kQ(),S=a??Vr,N=h!==void 0||a!==void 0,E=((w==null?void 0:w.disabled)??!1)||((C==null?void 0:C.disabled)??!1)||i,[T,R]=po({controlled:h,default:S,name:"ToggleGroup",state:"value"}),M=st((_,H,G)=>{let B;m?(B=T.slice(),H?B.push(_):B.splice(T.indexOf(_),1)):B=H?[_]:[],u==null||u(B,G),!G.isCanceled&&R(B)}),A={disabled:E,multiple:m,orientation:f},k=x.useMemo(()=>({disabled:E,setGroupValue:M,value:T,isValueInitialized:N}),[E,M,T,N]),O={role:"group"},D=Nt("div",t,{enabled:!!w,state:A,ref:r,props:[O,v]});return n.jsx(mD.Provider,{value:k,children:w?D:n.jsx(v3,{render:p,className:g,style:b,state:A,refs:[r],props:[O,v],loopFocus:c,enableHomeAndEndKeys:!0,orientation:f})})}),EQ=If("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"}}),pD=x.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function RQ({className:e,variant:t,size:r,spacing:a=2,orientation:i="horizontal",children:c,...u}){return n.jsx(TQ,{"data-slot":"toggle-group","data-variant":t,"data-size":r,"data-spacing":a,"data-orientation":i,style:{"--gap":a},className:Ve("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:n.jsx(pD.Provider,{value:{variant:t,size:r,spacing:a,orientation:i},children:c})})}function AQ({className:e,children:t,variant:r="default",size:a="default",...i}){const c=x.useContext(pD);return n.jsx(NQ,{"data-slot":"toggle-group-item","data-variant":c.variant||r,"data-size":c.size||a,"data-spacing":c.spacing,className:Ve("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",EQ({variant:c.variant||r,size:c.size||a}),e),...i,children:t})}const BE=[{value:"light",label:"Light mode",icon:G8},{value:"dark",label:"Dark mode",icon:m8},{value:"system",label:"Auto · Follow computer",icon:f8}];function MQ(){const{theme:e="system",setTheme:t}=HR(),r=Zs(),a=Math.max(0,BE.findIndex(i=>i.value===e));return n.jsx(Fu,{delay:200,children:n.jsxs(RQ,{"aria-label":"Appearance",value:[e],onValueChange:i=>{i.length&&t(i[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:[n.jsx($n.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:n.jsx(_4,{duration:12,shineColor:["var(--border)","var(--frame-highlight)","var(--ink-faint)"]})}),BE.map(({value:i,label:c,icon:u})=>n.jsxs(xa,{children:[n.jsx(ba,{render:n.jsx(AQ,{value:i,"aria-label":c}),className:Ve("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===i&&"text-foreground"),children:n.jsx($n.span,{"aria-hidden":"true",initial:!1,animate:{rotate:e===i&&i==="light"?45:e===i&&i==="dark"?-12:0,scale:e===i?1:.9},transition:{duration:r?0:.22},className:"flex items-center justify-center",children:n.jsx(u,{className:"size-3.5",strokeWidth:1.7})})}),n.jsx(va,{side:"top",children:c})]},i))]})})}const gD=x.createContext(void 0);function uh(e){const t=x.useContext(gD);if(t===void 0&&!e)throw new Error(rn(47));return t}const OQ={...ix,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 DQ extends _u{constructor(r,a,i){const c=new Qf;super(zQ(r,c,a,i),IQ(c),OQ);ln(this,"setOpen",(r,a)=>{var p,b;const i=a.reason===Qn,c=a.reason===ma&&a.event.detail===0,u=!r&&(a.reason===Hf||a.reason==null),f=R2(a),m=this.select("activeTriggerId");if(!r&&a.reason===YA&&a.trigger==null&&m!=null&&(a.trigger=this.context.triggerElements.getById(m)??this.select("activeTriggerElement")??void 0),(b=(p=this.context).onOpenChange)==null||b.call(p,r,a),a.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(r,a);const h=()=>{const v=nx(this.state,r,a.trigger,f());v.openChangeReason=a.reason,this.update(v)};i?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(pM,()=>{this.set("stickIfOpen",!1)}),go.flushSync(h)):h();let g;c?g="click":u?g="dismiss":a.reason===Ji&&(g="focus"),this.set("instantType",g)})}}function zQ(e,t,r,a=!1){const i={...ax(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 i.open&&(e==null?void 0:e.mounted)===void 0&&(i.mounted=!0),i}function IQ(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new xo,triggerElements:e}}const VE=Xf(function({props:t}){const{children:r,open:a,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:u,modal:f=!1,handle:m,triggerId:h,defaultTriggerId:g=null}=t,p=_Q(m,{modal:f,open:i,openProp:a,activeTriggerId:g,triggerIdProp:h});p.useControlledProp("openProp",a),p.useControlledProp("triggerIdProp",h);const b=p.useState("open"),v=p.useState("mounted"),w=p.useState("payload");p.useContextCallback("onOpenChange",c),p.useContextCallback("onOpenChangeComplete",u),LM(p,b),sx(p);const{forceUnmount:C}=rx(b,p,()=>{p.update({stickIfOpen:!0,openChangeReason:null})});p.useSyncedValues({modal:f}),x.useEffect(()=>{b||p.context.stickIfOpenTimeout.clear()},[p,b]),x.useImperativeHandle(t.actionsRef,()=>({unmount:C,close:()=>p.setOpen(!1,yt(Ug))}),[C,p]);const S=b||v;return n.jsxs(gD.Provider,{value:p,children:[m&&n.jsx(tx,{handle:m,store:p}),S&&n.jsx(LQ,{store:p,modal:f}),typeof r=="function"?r({payload:w}):r]})});function PQ(e){return uh(!0)?n.jsx(VE,{props:e}):n.jsx(CM,{children:n.jsx(VE,{props:e})})}function _Q(e,t){const r=E2((a,i)=>new DQ(t,a,i));return x.useEffect(()=>r.context.stickIfOpenTimeout.disposeEffect(),[r]),r}function LQ({store:e,modal:t}){const r=e.useState("floatingRootContext"),a=Kf(r,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=a.reference,c=a.floating;return ox(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:c}),null}const $Q=300,BQ=k2(function(t,r){const{render:a,className:i,style:c,disabled:u=!1,nativeButton:f=!0,handle:m,payload:h,openOnHover:g=!1,delay:p=$Q,closeDelay:b=0,id:v,...w}=t,C=uh(!0),N=O2(m)??C;if(!N)throw new Error(rn(74));const E=ys(v),T=N.useState("isTriggerActive",E),R=N.useState("floatingRootContext"),M=N.useState("isOpenedByTrigger",E),A=N.useState("triggerPopupId",E),k=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:D}=A2(E,k,N,{payload:h,disabled:u,openOnHover:g,closeDelay:b}),_=N.useState("openChangeReason"),H=N.useState("stickIfOpen"),G=N.useState("openMethod"),B=N.useState("focusManagerModal"),P=P2(R,{enabled:!u&&g&&(G!=="touch"||_!==ma),mouseOnly:!0,move:!1,handleClose:_2(),restMs:p,delay:{close:b},triggerElementRef:k,isActiveTrigger:T,isClosing:()=>N.select("transitionStatus")==="ending"}),V=S2(R,{stickIfOpen:H}),q=KM(()=>N.select("open"),Y=>{N.set("openMethod",Y)}),W=N.useState("triggerProps",D),{getButtonProps:K,buttonRef:J}=bo({disabled:u,native:f}),z={open(Y){return Y&&_===ma?Xp.open(Y):i2.open(Y)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:X,handleFocusTargetFocus:ee}=D4(N,k),U=Nt("button",t,{state:{disabled:u,open:M},ref:[J,r,O,k],props:[V.reference,P,W,q,{[gM]:"",id:E,"aria-haspopup":"dialog","aria-expanded":M,"aria-controls":A},w,K],stateAttributesMapping:z}),F=n.jsx(x.Fragment,{children:U},E);return D&&!B?n.jsxs(x.Fragment,{children:[n.jsx(el,{ref:L,onFocus:X}),F,n.jsx(el,{ref:N.context.triggerFocusTargetRef,onFocus:ee})]}):F}),xD=x.createContext(void 0);function VQ(){const e=x.useContext(xD);if(e===void 0)throw new Error(rn(45));return e}const UQ=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t;return uh().useState("mounted")||a?n.jsx(xD.Provider,{value:a,children:n.jsx(Zg,{ref:r,...i})}):null}),bD=x.createContext(void 0);function HQ(){const e=x.useContext(bD);if(!e)throw new Error(rn(46));return e}const FQ=x.forwardRef(function(t,r){const{render:a,className:i,style:c,anchor:u,positionMethod:f,side:m,align:h,sideOffset:g,alignOffset:p,collisionBoundary:b="clipping-ancestors",collisionPadding:v,arrowPadding:w,sticky:C,disableAnchorTracking:S=!1,collisionAvoidance:N=v2,...E}=t,T=uh(),R=VQ(),M=w2(),A=T.useState("floatingRootContext"),k=T.useState("mounted"),O=T.useState("open"),D=T.useState("openChangeReason"),_=T.useState("activeTriggerElement"),H=T.useState("modal"),G=T.useState("openMethod"),B=T.useState("positionerElement"),P=T.useState("instantType"),V=T.useState("transitionStatus"),q=T.useState("adaptiveOrigin"),W=x.useRef(null),K=Gf(B),J=xx({anchor:u,floatingRootContext:A,positionMethod:f,mounted:k,side:m,sideOffset:g,align:h,alignOffset:p,arrowPadding:w,collisionBoundary:b,collisionPadding:v,sticky:C,disableAnchorTracking:S,keepMounted:R,nodeId:M,collisionAvoidance:N,adaptiveOrigin:q}),z=A.useState("domReferenceElement");We(()=>{const U=z,F=W.current;if(U&&(W.current=U),F&&U&&U!==F){T.set("instantType",void 0);const Y=new AbortController;return K(()=>{T.set("instantType","trigger-change")},Y.signal),()=>{Y.abort()}}},[z,K,T]);const L=H===!0&&D!==Qn;H2(O&&L,G==="touch",B,_);const X=T.useStateSetter("positionerElement"),ee={open:O,side:J.side,align:J.align,anchorHidden:J.anchorHidden,instant:P},$=bx(t,ee,{styles:J.positionerStyles,transitionStatus:V,props:E,refs:[r,X],hidden:!k,inert:!O});return n.jsxs(bD.Provider,{value:J,children:[k&&L&&n.jsx(cx,{inert:Jf(!O),cutout:_}),n.jsx(NM,{id:M,children:$})]})}),GQ=x.createContext(void 0);function qQ(){const[e,t]=x.useState(0),r=st(()=>(t(i=>i+1),()=>{t(i=>Math.max(0,i-1))}));return{context:x.useMemo(()=>({register:r}),[r]),hasClosePart:e>0}}const YQ=x.forwardRef(function(t,r){const{render:a,className:i,style:c,initialFocus:u,finalFocus:f,...m}=t,h=uh(),g=HQ(),p=vx()!=null,{context:b,hasClosePart:v}=qQ(),w=h.useState("open"),C=h.useState("openMethod"),S=h.useState("instantType"),N=h.useState("transitionStatus"),E=h.useState("popupProps"),T=h.useState("titleElementId"),R=h.useState("descriptionElementId"),M=h.useState("modal"),A=h.useState("mounted"),k=h.useState("openChangeReason"),O=h.useState("activeTriggerElement"),D=h.useState("floatingRootContext"),_=D.useState("floatingId"),H=h.useState("disabled"),G=h.useState("openOnHover"),B=h.useState("closeDelay");Sr({open:w,ref:h.context.popupRef,onComplete(){var J,z;w&&((z=(J=h.context).onOpenChangeComplete)==null||z.call(J,!0))}}),I2(D,{enabled:G&&!H,closeDelay:B});const P=u===void 0?_M(h.context.popupRef):u,V=M!==!1&&v;h.useSyncedValue("focusManagerModal",V);const q=h.useStateSetter("popupElement"),W={open:w,side:g.side,align:g.align,instant:S,transitionStatus:N},K=Nt("div",t,{state:W,ref:[r,h.context.popupRef,q],props:[E,{id:_,role:"dialog",...Wf,"aria-labelledby":T,"aria-describedby":R,onKeyDown(J){p&&Zf.has(J.key)&&J.stopPropagation()}},th(N),m],stateAttributesMapping:Hg});return n.jsx(Jg,{context:D,openInteractionType:C,modal:V,disabled:!A||k===Qn,initialFocus:P,returnFocus:f,restoreFocus:"popup",previousFocusableElement:wn(O)?O:void 0,nextFocusableElement:h.context.triggerFocusTargetRef,beforeContentFocusGuardRef:h.context.beforeContentFocusGuardRef,children:n.jsx(GQ.Provider,{value:b,children:K})})});function $p({...e}){return n.jsx(PQ,{"data-slot":"popover",...e})}function Bp({...e}){return n.jsx(BQ,{"data-slot":"popover-trigger",...e})}function Vp({className:e,align:t="center",alignOffset:r=0,side:a="bottom",sideOffset:i=4,...c}){return n.jsx(UQ,{children:n.jsx(FQ,{align:t,alignOffset:r,side:a,sideOffset:i,className:"isolate z-50",children:n.jsx(YQ,{"data-slot":"popover-content",className:ws("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 qw(e){return Nt(e.defaultTagName??"div",e,e)}const ry=768;function KQ(){const[e,t]=x.useState(void 0);return x.useEffect(()=>{const r=window.matchMedia(`(max-width: ${ry-1}px)`),a=()=>{t(window.innerWidth<ry)};return r.addEventListener("change",a),t(window.innerWidth<ry),()=>r.removeEventListener("change",a)},[]),!!e}const XQ="sidebar_state",WQ=3600*24*7,QQ="16rem",ZQ="18rem",JQ="3rem",eZ="b",vD=x.createContext(null);function Yw(){const e=x.useContext(vD);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function tZ({defaultOpen:e=!0,open:t,onOpenChange:r,className:a,style:i,children:c,...u}){const f=KQ(),[m,h]=x.useState(!1),[g,p]=x.useState(e),b=t??g,v=x.useCallback(N=>{const E=typeof N=="function"?N(b):N;r?r(E):p(E),document.cookie=`${XQ}=${E}; path=/; max-age=${WQ}`},[r,b]),w=x.useCallback(()=>f?h(N=>!N):v(N=>!N),[f,v,h]);x.useEffect(()=>{const N=E=>{E.key===eZ&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),w())};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[w]);const C=b?"expanded":"collapsed",S=x.useMemo(()=>({state:C,open:b,setOpen:v,isMobile:f,openMobile:m,setOpenMobile:h,toggleSidebar:w}),[C,b,v,f,m,h,w]);return n.jsx(vD.Provider,{value:S,children:n.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":QQ,"--sidebar-width-icon":JQ,...i},className:Ve("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...u,children:c})})}function nZ({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:a,children:i,dir:c,...u}){const{isMobile:f,state:m,openMobile:h,setOpenMobile:g}=Yw();return r==="none"?n.jsx("div",{"data-slot":"sidebar",className:Ve("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...u,children:i}):f?n.jsx(Lo,{open:h,onOpenChange:g,...u,children:n.jsxs(la,{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":ZQ},side:e,children:[n.jsxs(ca,{className:"sr-only",children:[n.jsx(ua,{children:"Sidebar"}),n.jsx(da,{children:"Displays the mobile sidebar."})]}),n.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):n.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:[n.jsx("div",{"data-slot":"sidebar-gap",className:Ve("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)")}),n.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:Ve("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:n.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:i})})]})}function sZ({className:e,onClick:t,...r}){const{toggleSidebar:a}=Yw();return n.jsxs(le,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:Ve(e),onClick:i=>{t==null||t(i),a()},...r,children:[n.jsx(v8,{}),n.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function rZ({className:e,...t}){return n.jsx("main",{"data-slot":"sidebar-inset",className:Ve("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 oZ({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:Ve("flex flex-col gap-2 p-2",e),...t})}function aZ({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:Ve("flex flex-col gap-2 p-2",e),...t})}function iZ({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:Ve("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function UE({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Ve("relative flex w-full min-w-0 flex-col p-2",e),...t})}function HE({className:e,render:t,...r}){return qw({defaultTagName:"div",props:Qs({className:Ve("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 FE({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:Ve("w-full text-sm",e),...t})}function GE({className:e,...t}){return n.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Ve("flex w-full min-w-0 flex-col gap-0",e),...t})}function qE({className:e,...t}){return n.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Ve("group/menu-item relative",e),...t})}const lZ=If("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 D1({render:e,isActive:t=!1,variant:r="default",size:a="default",tooltip:i,className:c,...u}){const{isMobile:f,state:m}=Yw(),h=qw({defaultTagName:"button",props:Qs({className:Ve(lZ({variant:r,size:a}),c)},u),render:i?n.jsx(ba,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:t}});return i?(typeof i=="string"&&(i={children:i}),n.jsxs(xa,{children:[h,n.jsx(va,{side:"right",align:"center",hidden:m!=="collapsed"||f,...i})]})):h}const cZ=If("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function uZ({className:e,variant:t="default",render:r,...a}){return qw({defaultTagName:"span",props:Qs({className:Ve(cZ({variant:t}),e)},a),render:r,state:{slot:"badge",variant:t}})}const yD=x.createContext(null),Kw=()=>x.useSyncExternalStore(en.subscribe,en.getSnapshot);function dZ({children:e}){const t=Kw(),[r,a]=x.useState(null),i=x.useRef(!1);x.useEffect(()=>{(r==="usage"||r==="usage-details")&&(!t.available||t.sharing!==null)?a(null):t.available&&t.sharing===null&&!r&&!i.current&&!window.location.hash.startsWith("#terminal/")&&(i.current=!0,a("usage"))},[t.available,t.sharing,r]),x.useEffect(()=>{const h=()=>en.refresh();return window.addEventListener("storage",h),window.addEventListener("focus",h),()=>{window.removeEventListener("storage",h),window.removeEventListener("focus",h)}},[]);const c=x.useCallback((h="settings")=>a(h),[]);function u(h,g=!0){!h&&g?en.declineSharing():en.setSharing(h),a(null)}function f(){r==="usage-details"?a("usage"):r==="usage"?u(!1,!1):a(null)}const m=r==="details"||r==="usage-details";return n.jsxs(yD.Provider,{value:c,children:[e,n.jsx(tn,{open:!!r,onOpenChange:h=>{h||f()},children:n.jsx(nn,{className:m?"flex max-h-[calc(100dvh-2rem)] flex-col gap-0 overflow-hidden p-0 sm:max-w-lg":"sm:max-w-sm",children:r==="usage"?n.jsxs(n.Fragment,{children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Help improve OpenRod"}),n.jsx(Sn,{children:"Share anonymous usage data with us? Declining sends one anonymous count, then stops usage sharing."})]}),n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx(le,{type:"button",size:"sm",variant:"outline",onClick:()=>u(!1),children:"Don’t send data"}),n.jsx(le,{type:"button",size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>u(!0),children:"Share"})]}),n.jsx(le,{type:"button",size:"sm",variant:"ghost",className:"justify-self-start text-muted-foreground",onClick:()=>a("usage-details"),children:"What do you collect?"})]}):r==="settings"?n.jsxs(n.Fragment,{children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Usage and feedback"}),n.jsx(Sn,{children:"Anonymous usage data helps us improve OpenRod."})]}),n.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",role:"status",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground",children:"Usage sharing"}),n.jsx(uZ,{variant:t.available&&t.sharing?"secondary":"outline",children:t.available&&t.sharing?"On":"Off"})]}),t.available&&(t.sharing?n.jsx(le,{size:"sm",variant:"outline",onClick:()=>u(!1),children:"Turn off"}):n.jsx(le,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>u(!0),children:"Share"}))]}),!t.available&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Usage sharing and feedback are turned off for this console."}),n.jsxs("div",{className:"flex flex-wrap gap-2 border-t pt-3",children:[n.jsx(le,{size:"sm",variant:"outline",onClick:()=>a("feedback"),children:"Give feedback"}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>c("details"),children:"What do you collect?"})]})]}):m?n.jsx(hZ,{onClose:f}):r==="feedback"?n.jsx(mZ,{canSend:t.available,onClose:()=>a(null)}):null})})]})}function fZ(){const e=x.useContext(yD);return e?n.jsxs(D1,{size:"sm",className:"text-muted-foreground",onClick:()=>e(),children:[n.jsx(u8,{"aria-hidden":"true"}),"Usage & feedback"]}):null}function hZ({onClose:e}){return n.jsxs(n.Fragment,{children:[n.jsxs(sn,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[n.jsx(Qt,{children:"What we collect"}),n.jsx(Sn,{className:"sr-only",children:"What usage sharing sends"})]}),n.jsxs("div",{className:"grid gap-3 px-5 py-4 text-xs leading-relaxed",children:[n.jsxs("ul",{className:"grid list-disc gap-1 pl-4",children:[n.jsx("li",{children:"Which features you use and whether they work"}),n.jsx("li",{children:"Your OpenRod version and approximate location (country, city)"}),n.jsx("li",{children:"A random ID, never your name or account"})]}),n.jsx("p",{className:"text-muted-foreground",children:"Choosing “Don’t send data” or “Turn off” sends one anonymous choice event, without a saved ID or location. Closing this prompt sends nothing."}),n.jsx("p",{className:"text-muted-foreground",children:"Never your commands, files, terminal output, names, paths or credentials. Change this anytime in Usage & feedback."})]}),n.jsx(Hr,{className:"mx-0 mb-0 shrink-0 rounded-none px-5 py-3",children:n.jsx(le,{type:"button",size:"sm",variant:"outline",onClick:e,children:"Done"})})]})}function mZ({canSend:e,onClose:t}){const[r,a]=x.useState(""),[i,c]=x.useState(!1),u=x.useId(),f=()=>{try{navigator.clipboard.writeText(r).then(()=>He.success("Copied"),()=>{})}catch{}};function m(h){if(h.preventDefault(),!en.submitFeedback({prompt:"general",category:"general",text:r})){c(!0);return}He.success("Thanks for the feedback"),t()}return n.jsxs("form",{onSubmit:m,className:"grid gap-4",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Give feedback"}),n.jsx(Sn,{children:"Sent to the OpenRod team through PostHog. Leave out private details."})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:`${u}-text`,children:"Feedback"}),n.jsx(Hu,{id:`${u}-text`,value:r,onChange:h=>{a(h.target.value),c(!1)},maxLength:2e3,rows:4})]}),e?i&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Couldn’t send it right now. Copy your text, or try again."}):n.jsx("p",{className:"text-xs text-muted-foreground",children:"Feedback is turned off for this console. Copy your text to share it another way."}),n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx(le,{type:"button",variant:"ghost",size:"sm",onClick:t,children:"Cancel"}),n.jsx(le,{type:"button",variant:"outline",size:"sm",disabled:!r.trim(),onClick:f,children:"Copy text"}),n.jsx(le,{type:"submit",size:"sm",disabled:!e||!r.trim(),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:"Send feedback"})]})]})}const pZ=[{label:"Sandboxes",icon:hc,view:"sandboxes"},{label:"Templates",icon:s8,view:"templates"},{label:"MCPs & Skills",icon:J1,view:"setups"},{label:"Activity",icon:aL,view:"activity"},{label:"Connections",icon:wL,view:"connections"}],gZ=[{label:"Groups",icon:Ka,view:"groups"},{label:"Network",icon:Ig,view:"egress",also:["ingress"]},{label:"Secrets",icon:zu,view:"secrets"}],YE={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 xZ({view:e,onNavigate:t}){const{connection:r,overview:a}=oi(),i=YE[r]??YE.connecting,c=a==null?void 0:a.gateway;return n.jsxs(nZ,{collapsible:"offcanvas",className:"border-r border-sidebar-border",children:[n.jsx(oZ,{className:"h-14 shrink-0 justify-center px-6 py-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"sidebar-icon-hover inline-flex shrink-0",children:n.jsx("img",{src:"/openrod.png",alt:"","aria-hidden":"true",className:"sidebar-icon size-9 object-contain"})}),n.jsxs("span",{className:"flex flex-col leading-none",children:[n.jsx("span",{className:"sidebar-wordmark text-lg font-normal tracking-tight whitespace-nowrap",children:"OpenRod"}),n.jsx("span",{className:"mt-0.5 text-[10px] whitespace-nowrap text-muted-foreground",children:"for OpenShell"})]})]})}),n.jsxs(iZ,{className:"px-3 pt-4",children:[n.jsxs(UE,{className:"p-0",children:[n.jsx(HE,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Environment"}),n.jsx(FE,{children:n.jsx(GE,{children:pZ.map(({label:u,icon:f,view:m})=>n.jsx(qE,{children:n.jsxs(D1,{isActive:e===m,onClick:()=>t(m),children:[n.jsx(f,{}),u]})},m))})})]}),n.jsxs(UE,{className:"p-0 pt-4",children:[n.jsx(HE,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Security"}),n.jsx(FE,{children:n.jsx(GE,{children:gZ.map(({label:u,icon:f,view:m,also:h=[]})=>n.jsx(qE,{children:n.jsxs(D1,{isActive:e===m||h.includes(e),onClick:()=>t(h.includes(e)?e:m),children:[n.jsx(f,{}),u]})},m))})})]})]}),n.jsxs(aZ,{className:"border-t border-sidebar-border p-4",children:[n.jsx(fZ,{}),n.jsx(MQ,{}),n.jsxs($p,{children:[n.jsxs(Bp,{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:[n.jsxs("span",{className:"relative flex size-1.5 shrink-0","aria-hidden":"true",children:[r==="live"&&n.jsx("span",{className:"absolute inline-flex size-full rounded-full bg-emerald-400/55 motion-safe:animate-ping"}),n.jsx("span",{className:`relative inline-flex size-1.5 rounded-full ${i.dot}`})]}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:(c==null?void 0:c.name)??"Gateway"}),n.jsxs("span",{className:"block truncate font-mono text-[10px] text-muted-foreground",children:[i.label,c!=null&&c.version?` · v${c.version}`:""]})]})]}),n.jsxs(Vp,{side:"top",align:"start",sideOffset:10,className:"w-64 gap-3 p-4",children:[n.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-medium",children:[n.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?n.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])=>n.jsxs("div",{children:[n.jsx("dt",{className:"text-[10px] text-muted-foreground",children:u}),n.jsx("dd",{className:`break-all ${m?"font-mono text-[11px]":"text-xs"}`,children:f})]},u))}):a!=null&&a.error?n.jsx("p",{className:"font-mono text-[10px] text-muted-foreground",children:a.error}):null,n.jsx(bZ,{})]})]})]})]})}function bZ(){const[e,t]=x.useState(null),[r,a]=x.useState(!1),[i,c]=x.useState(null);if(x.useEffect(()=>{let f=!0;return cs.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 cs.disconnectRemote(),t(null)}catch(f){c(f.message)}finally{a(!1)}}return n.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx($f,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:e.host}),n.jsx("span",{className:"block text-[10px] text-muted-foreground",children:"SSH machine · connected"})]}),n.jsx(le,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:r,onClick:u,children:r?"Disconnecting…":"Disconnect"})]}),i&&n.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:i})]})}const vZ=864e5;function yZ(e,t,r){const a=e.map(f=>Date.parse(f.createdAt)).filter(Number.isFinite).sort((f,m)=>f-m),i=e.length-a.length,c=[];let u=0;for(let f=t-1;f>=0;f--){const m=r-f*vZ;for(;u<a.length&&a[u]<=m;)u++;c.push({at:m,count:u+i})}return c}const wZ=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"});function jZ({points:e,height:t=34,title:r}){const a=x.useRef(null),i=x.useId(),c=Zs(),[u,f]=x.useState(280),[m,h]=x.useState(null);x.useLayoutEffect(()=>{const R=a.current;if(!R)return;const M=()=>f(R.clientWidth);M();const A=new ResizeObserver(M);return A.observe(R),()=>A.disconnect()},[]);const g=Math.max(4,Math.round(t*.18)),p=e.map(R=>R.count),b=Math.max(1,...p),v=R=>(e.length<2?u-12:R/(e.length-1)*(u-12))+6,w=R=>t-g-R/b*(t-g*2),C=w4(p.map((R,M)=>[v(M),w(R)])),S=`${C} L${v(e.length-1).toFixed(2)} ${t} L${v(0).toFixed(2)} ${t} Z`,N=m===null?null:e[m],E=p[0]??0,T=p[p.length-1]??0;return n.jsxs("div",{className:"relative w-full",onMouseLeave:()=>h(null),onMouseMove:R=>{const M=R.currentTarget.getBoundingClientRect(),A=(R.clientX-M.left)/Math.max(1,M.width);h(Math.min(e.length-1,Math.max(0,Math.round(A*(e.length-1)))))},children:[n.jsx("h2",{className:"min-w-0 truncate text-[10px] font-bold tracking-widest text-faint uppercase",children:N?n.jsxs("span",{className:"font-mono normal-case tracking-normal text-muted-foreground",children:[wZ(N.at)," · ",N.count.toLocaleString("en-US")," ",N.count===1?"box":"boxes"]}):r}),n.jsx("div",{ref:a,className:"w-full",children:n.jsxs("svg",{width:u,height:t,role:"img","aria-label":`${E} boxes ${e.length} days ago, ${T} now`,children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:"var(--ink)",stopOpacity:"0.1"}),n.jsx("stop",{offset:"100%",stopColor:"var(--ink)",stopOpacity:"0"})]})}),n.jsx("path",{d:S,fill:`url(#${i})`}),n.jsx($n.path,{d:C,fill:"none",stroke:"var(--ink)",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.72",initial:c?!1:{pathLength:0},animate:{pathLength:1},transition:{duration:.9,ease:"easeOut"}}),N&&n.jsxs("g",{children:[n.jsx("line",{x1:v(m),x2:v(m),y1:"0",y2:t,stroke:"var(--ink)",strokeWidth:"1",strokeDasharray:"2 3",opacity:"0.25"}),n.jsx("circle",{cx:v(m),cy:w(p[m]),r:"3",fill:"var(--surface)",stroke:"var(--ink)",strokeWidth:"1.5"})]})]})})]})}const SZ=e=>e?new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"",NZ={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},CZ=e=>e?NZ[e]??e:null;function kZ({event:e,dense:t=!1,showSandbox:r=!1}){var i;const a=e.verdict==="denied";return n.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:[n.jsx("span",{className:"w-[4.5rem] shrink-0 tabular-nums text-muted-foreground",children:SZ(e.at)}),n.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&&n.jsx("span",{className:"hidden w-24 shrink-0 truncate text-muted-foreground md:block",children:e.sandbox}),!t&&n.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:"-"}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[e.method&&t?`${e.method} `:"",e.destination??e.detail]}),!t&&n.jsx("span",{className:"hidden w-56 shrink-0 truncate text-right text-[10px] text-muted-foreground xl:block",children:a?CZ(e.reason):(i=e.policy)==null?void 0:i.replace(/^_provider_/,"provider · ")})]})}function TZ({children:e,className:t,variant:r="outline",size:a="sm"}){return n.jsx(Fu,{delay:200,children:n.jsxs(xa,{children:[n.jsxs(ba,{render:n.jsx(le,{type:"button",variant:r,size:a,disabled:!0,focusableWhenDisabled:!0,className:Ve("cursor-not-allowed opacity-50",t)}),children:[e,n.jsxs("span",{className:"sr-only",children:[" ",mk]})]}),n.jsx(va,{side:"bottom",className:"max-w-60",children:mk})]})})}function wD(e=[],t){const r=Ew(t);return e.filter(a=>!a.appliesTo.everyone&&a.appliesTo.groups.some(i=>r.includes(i)))}function Xw(){const[e,t]=x.useState(null),[r,a]=x.useState(""),i=x.useRef(null),c=x.useRef(!0),u=x.useCallback((g,p,b=!0)=>{const v=i.current;v&&(i.current=null,v.cleanup(),b&&t(null),p?v.reject(p):v.resolve(g))},[]),f=x.useCallback(()=>u(void 0,new DOMException("Workspace transfer cancelled.","AbortError")),[u]);x.useEffect(()=>(c.current=!0,()=>{c.current=!1,u(void 0,new DOMException("Workspace transfer cancelled.","AbortError"),!1)}),[u]);const m=x.useCallback(async(g,p,b)=>{b==null||b.throwIfAborted();const v=await g.org();if(!c.current)throw new DOMException("Workspace transfer cancelled.","AbortError");b==null||b.throwIfAborted();const w=(v.groups??[]).filter(C=>wD(v.policies??[],[C.id]).length>0);if(!w.length)throw new Error(`Add a group with a network rule in ${p} before copying this workspace.`);if(w.length!==1){if(i.current)throw new Error("Finish the current workspace transfer first.");return a(""),t({groups:w,label:p}),new Promise((C,S)=>{const N=()=>u(void 0,new DOMException("Workspace transfer cancelled.","AbortError"));i.current={resolve:C,reject:S,cleanup:()=>b==null?void 0:b.removeEventListener("abort",N)},b==null||b.addEventListener("abort",N,{once:!0}),b!=null&&b.aborted&&N()})}},[u]),h=n.jsx(tn,{open:!!e,onOpenChange:g=>{g||f()},children:n.jsxs(nn,{className:"sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Choose a destination group"}),n.jsxs(Sn,{children:["The copied sandbox inherits this group’s network rules in ",e==null?void 0:e.label,"."]})]}),n.jsxs(pn,{"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:[n.jsx("option",{value:"",children:"Choose a group"}),e==null?void 0:e.groups.map(g=>n.jsx("option",{value:g.id,children:g.name},g.id))]}),n.jsxs(Hr,{children:[n.jsx(le,{variant:"ghost",onClick:f,children:"Cancel"}),n.jsx(le,{disabled:!(e!=null&&e.groups.some(g=>g.id===r)),onClick:()=>u([r]),children:"Copy workspace"})]})]})});return{chooseGroups:m,dialog:h,cancel:f}}const Rg="http://127.0.0.1:4600",EZ=e=>`${Rg}/?handoff=cloud&target=local#cloud-return=${encodeURIComponent(e)}`;function KE(e,t,r,a){var i;return!!(t&&e.source===t&&e.origin===Rg&&((i=e.data)==null?void 0:i.type)===a&&e.data.nonce===r)}function RZ({name:e,sandbox:t}){const r=Pt(),a=js(),i=gn(),{refresh:c}=vo(),{chooseGroups:u,dialog:f}=Xw(),m=x.useRef(null);x.useEffect(()=>()=>{var b;return(b=m.current)==null?void 0:b.abort()},[]);const[h,g]=x.useState(null);async function p(){if(h||(i==null?void 0:i.connected)===!1)return;const b=new AbortController;m.current=b;const v=r.signal?AbortSignal.any([r.signal,b.signal]):b.signal;g("signin");try{await a.prepare({signal:v,onProgress:()=>g("prepare")});const w=lr("cloud",v);g("groups");const C=await u(w,"cloud",v);g("transfer");const S=await $A(lr(r.target,v,i==null?void 0:i.context),w,e,C);v.throwIfAborted(),He.success("Workspace ready in cloud",{description:S.warning||"Reconnect your agent credentials to continue."});const N=await w.contextKey();try{sessionStorage.setItem("gateway-box",JSON.stringify({name:S.name,context:N,target:"cloud"}))}catch{}c(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"sandboxes"}})),window.dispatchEvent(new CustomEvent("openrod-sandbox-handoff",{detail:{name:S.name,context:N,target:"cloud"}}))}catch(w){w.name!=="AbortError"&&He.error("Couldn’t continue in cloud",{description:w.message})}finally{b.signal.aborted||g(null),m.current===b&&(m.current=null)}}return(t==null?void 0:t.phase)!=="ready"?null:a!=null&&a.available?n.jsxs("div",{className:"flex items-center gap-1",children:[f,n.jsxs(le,{variant:"outline",size:"sm",className:"flex-1 justify-start text-xs",disabled:!!h||(i==null?void 0:i.connected)===!1,onClick:p,children:[h?n.jsx(kt,{className:"size-3.5"}):n.jsx(Kp,{className:"size-3.5","aria-hidden":"true"}),h==="signin"?"Sign in to cloud…":h==="prepare"?"Preparing cloud machine…":h==="groups"?"Choose destination group…":h==="transfer"?"Copying and rebuilding…":"Continue in cloud"]}),n.jsx(Fu,{delay:200,children:n.jsxs(xa,{children:[n.jsx(ba,{render:n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"What this does",className:"text-muted-foreground"}),children:n.jsx(Du,{className:"size-3.5","aria-hidden":"true"})}),n.jsx(va,{side:"bottom",className:"max-w-60",children:"Copies workspace files and rebuilds saved templates. Your local source stays available. Credential files are excluded; reconnect agents in cloud."})]})})]}):n.jsxs(TZ,{className:"w-full justify-start text-xs",children:[n.jsx(Kp,{className:"size-3.5","aria-hidden":"true"}),"Continue in cloud"]})}function AZ({name:e,sandbox:t}){const r=Pt(),a=js(),i=gn(),{locations:c,refresh:u}=vo(),{chooseGroups:f,dialog:m}=Xw(),h=x.useRef(null);x.useEffect(()=>()=>{var w;return(w=h.current)==null?void 0:w.abort()},[]);const[g,p]=x.useState(null),b=x.useRef(null);if(x.useEffect(()=>{let w=!0;const C=async N=>{const E=b.current;if(E){if(KE(N,E.popup,E.nonce,"openrod-local-result")&&E.accepted){if(w){if(typeof N.data.error=="string")He.error("Couldn’t continue locally",{description:N.data.error});else if(typeof N.data.name=="string")He.success("Workspace ready locally",{description:N.data.warning||E.warning||"Reconnect your agent credentials locally to continue."});else return;p(null)}b.current=null;return}if(!(E.accepted||!KE(N,E.popup,E.nonce,"openrod-local-ready"))){E.accepted=!0,p("transfer");try{const T=await r.cloudExport(E.name);E.warning=T.warning,E.popup.postMessage({type:"openrod-local-bundle",nonce:E.nonce,bundle:T.bundle,warning:T.warning},Rg)}catch(T){E.popup.postMessage({type:"openrod-local-bundle",nonce:E.nonce,error:T.message},Rg),b.current===E&&(b.current=null),w&&(p(null),He.error("Couldn’t continue locally",{description:T.message}))}}}};window.addEventListener("message",C);const S=setInterval(()=>{const N=b.current;N&&(N.popup.closed||Date.now()>N.expires)&&(b.current=null,p(null),N.popup.closed||He.error("Local transfer timed out. Try again."))},1e3);return()=>{w=!1,window.removeEventListener("message",C),clearInterval(S),b.current=null}},[e,r]),(t==null?void 0:t.phase)!=="ready")return null;async function v(){if(g||(i==null?void 0:i.connected)===!1)return;const w=c.find(N=>N.target!=="cloud"&&!N.remote&&N.connected);if(!w){He.error("Connect a local gateway before importing this workspace.");return}const C=new AbortController;h.current=C;const S=r.signal?AbortSignal.any([r.signal,C.signal]):C.signal;p("transfer");try{const N=lr("local",S,w.context);p("groups");const E=await f(N,"local OpenRod",S);p("transfer");const T=await l7(lr(r.target,S,i==null?void 0:i.context),N,e,E);S.throwIfAborted(),He.success("Workspace running locally",{description:T.warning||"Your cloud source is unchanged. Reconnect agent credentials locally."});try{sessionStorage.setItem("gateway-box",JSON.stringify({name:T.name,context:w.context,target:"local"}))}catch{}u(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"sandboxes"}})),window.dispatchEvent(new CustomEvent("openrod-sandbox-handoff",{detail:{name:T.name,context:w.context,target:"local"}}))}catch(N){N.name!=="AbortError"&&He.error("Couldn’t import locally",{description:N.message})}finally{C.signal.aborted||p(null),h.current===C&&(h.current=null)}}return a!=null&&a.localViewer&&!a.available?null:n.jsxs("div",{className:"flex items-center gap-1",children:[m,n.jsxs(le,{variant:"outline",size:"sm",className:"flex-1 justify-start text-xs",disabled:!!g||(i==null?void 0:i.connected)===!1,onClick:()=>{if(a!=null&&a.localViewer){v();return}const w=crypto.randomUUID(),C=window.open(EZ(w),"_blank");if(!C){He.error("Allow popups to continue locally.");return}b.current={popup:C,nonce:w,name:e,accepted:!1,expires:Date.now()+40*6e4},p("connect")},children:[g?n.jsx(kt,{className:"size-3.5"}):n.jsx(Z1,{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"]}),n.jsx(Fu,{delay:200,children:n.jsxs(xa,{children:[n.jsx(ba,{render:n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"What this does",className:"text-muted-foreground"}),children:n.jsx(Du,{className:"size-3.5","aria-hidden":"true"})}),n.jsxs(va,{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 $a="/sandbox",XE=1024**3;function br(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 Ou(e){return/^[\w@%+=:,./~-]+$/.test(e)?e:`'${e.replaceAll("'","'\\''")}'`}const jD=e=>e.startsWith("~/")?`~/${Ou(e.slice(2))}`:Ou(e),z1=(e,t,r=$a)=>`openshell sandbox upload ${Ou(e)} ${jD(t)} ${Ou(r)}`,MZ=(e,t,r=".")=>`openshell sandbox download ${Ou(e)} ${Ou(t)} ${jD(r)}`,Up=new Set(["waiting","uploading","cloning"]),OZ=(e,t)=>e==="/"?`/${t}`:`${e}/${t}`,op=e=>e.type==="dir"||e.targetType==="dir";function DZ(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 zZ(e){const t=[];async function r(a,i){if(a instanceof window.File){t.push({path:a.name,file:a});return}if(a.isFile)t.push({path:i+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,`${i}${a.name}/`)}}}for(const a of e)await r(a,"");return t}function IZ({seed:e,onRetry:t}){if(!e)return null;const r=e.kind==="folder"?"Uploading":"Cloning";return Up.has(e.state)?n.jsxs("p",{className:"flex items-center gap-2 border-b border-border bg-muted/30 px-5 py-2 text-xs",children:[n.jsx(kt,{"aria-hidden":"true"}),e.state==="waiting"?"Waiting for the sandbox to start, then "+r.toLowerCase():r,n.jsx("span",{className:"min-w-0 truncate font-mono text-[11px]",children:e.source}),"→",n.jsx("span",{className:"font-mono text-[11px]",children:e.dest})]}):e.state==="failed"?n.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:[n.jsx(ti,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("p",{className:"font-medium",children:[e.kind==="folder"?"Upload":"Clone"," of ",n.jsx("span",{className:"font-mono text-[11px]",children:e.source})," failed"]}),n.jsx("p",{className:"mt-0.5 text-[11px]",children:e.error})]}),n.jsx(le,{variant:"outline",size:"sm",onClick:t,className:"shrink-0",children:"Retry"})]}):n.jsxs("p",{className:"flex items-center gap-2 border-b border-border px-5 py-2 text-[11px] text-muted-foreground",children:[n.jsx(YL,{className:"size-3.5 shrink-0","aria-hidden":"true"}),"Started from ",n.jsx("span",{className:"min-w-0 truncate font-mono",children:e.source}),e.files!=null&&n.jsxs("span",{children:["· ",e.files.toLocaleString()," files, ",br(e.bytes)]}),n.jsxs("span",{children:["→ ",n.jsx("span",{className:"font-mono",children:e.dest})]})]})}function PZ(e){const t=gn();return n.jsx(_Z,{...e},`${(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default"}:${e.sandbox.name}`)}function _Z({sandbox:e,demo:t}){const r=Pt(),a=gn(),i=e.name,c=e.phase==="ready",u=XY(e),[f,m]=x.useState(u?`${$a}/${u}`:$a),[h,g]=x.useState(null),[p,b]=x.useState(null),[v,w]=x.useState(!1),[C,S]=x.useState(null),[N,E]=x.useState(!1),[T,R]=x.useState(null),[M,A]=x.useState(null),[k,O]=x.useState(null),D=x.useRef(null),_=x.useCallback(async z=>{w(!0);try{const L=await r.files(i,z);g(L),b(null),L.path!==z&&m(L.path)}catch(L){if(z!==$a&&/does not exist/.test(L.message)){m($a);return}b(L.message)}finally{w(!1)}},[i,r]);x.useEffect(()=>{c&&!t&&_(f)},[f,c,t,_]);const H=C==null?void 0:C.state;x.useEffect(()=>{if(t)return;let z=!1,L;const X=async()=>{try{const ee=await r.seed(i);if(z)return;S(ee),ee&&Up.has(ee.state)&&(L=setTimeout(X,2e3))}catch{}};return(!C||Up.has(H))&&X(),()=>{z=!0,clearTimeout(L)}},[i,t,H,r]);const G=x.useRef(null);x.useEffect(()=>{if(Up.has(G.current)&&H==="done"&&c){const z=u?`${$a}/${u}`:f;z!==f?m(z):_(f)}G.current=H},[H]);async function B(){try{S(await r.retrySeed(i))}catch(z){He.error(z.message)}}async function P(z,L){O(z);const X=He.loading(`Preparing ${L}…`);try{const{token:ee,filename:$,bytes:U}=await r.prepareDownload(i,z),F=document.createElement("a");F.href=r.url(`/downloads/${ee}`,{context:await r.contextKey(),...a?{location:"1"}:{}}),F.download=$,document.body.append(F),F.click(),F.remove(),He.success(`Downloading ${$}`,{id:X,description:br(U)})}catch(ee){He.error(ee.message,{id:X})}finally{O(null)}}function V(z){if(!z.length){He.error("Nothing to upload. Empty folders are skipped.");return}const L=z.reduce((U,F)=>U+F.file.size,0);if(L>XE){He.error(`That is ${br(L)}; the console uploads up to ${br(XE)}.`,{description:`From a terminal: ${z1(i,"./my-files",f)}`});return}if(h&&L>h.free){He.error(`The sandbox has ${br(h.free)} free; this is ${br(L)}.`);return}const ee=[...new Set(z.map(U=>U.path.split("/")[0]))].filter(U=>h==null?void 0:h.entries.some(F=>F.name===U)),$={files:z,bytes:L,dir:f,taken:ee};ee.length?A($):q($)}async function q({files:z,bytes:L,dir:X}){A(null);const ee=new AbortController;let $;R({done:0,total:z.length,sent:0,bytes:L,committing:!1,controller:ee});try{({id:$}=await r.startUpload(i));let U=0;await Promise.all(Array.from({length:Math.min(4,z.length)},async()=>{for(;U<z.length&&!ee.signal.aborted;){const Y=z[U++];try{await r.uploadFile(i,$,Y.path,Y.file,ee.signal)}catch(ne){throw ee.abort(),ne}R(ne=>ne&&{...ne,done:ne.done+1,sent:ne.sent+Y.file.size})}})),R(Y=>Y&&{...Y,committing:!0});const F=await r.commitUpload(i,$,X);He.success(`Uploaded ${F.files.toLocaleString()} ${F.files===1?"file":"files"} to ${F.dest}`,{description:br(F.bytes)}),X===f&&_(f)}catch(U){$&&r.cancelUpload(i,$).catch(()=>{}),He.error(ee.signal.aborted&&U.name==="AbortError"?"Upload cancelled.":U.message)}finally{R(null)}}async function W(z){if(z.preventDefault(),E(!1),!c||T)return;const L=DZ(z.dataTransfer);try{V(await zZ(L))}catch(X){He.error(`Could not read the dropped files: ${X.message}`)}}if(t)return n.jsx("p",{className:"p-5 text-sm text-muted-foreground",children:"Files are unavailable for synthetic sandboxes."});const K=f.split("/").filter(Boolean).map((z,L,X)=>({label:z,path:`/${X.slice(0,L+1).join("/")}`})),J=(h==null?void 0:h.path)===f?h.entries:[];return n.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",onDragOver:z=>{c&&!T&&Array.from(z.dataTransfer.types).includes("Files")&&(z.preventDefault(),E(!0))},onDragLeave:z=>{z.currentTarget.contains(z.relatedTarget)||E(!1)},onDrop:W,children:[n.jsx(IZ,{seed:C,onRetry:B}),n.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-5 py-2",children:[n.jsx("nav",{"aria-label":"Folder",className:"flex min-w-0 flex-1 items-center gap-0.5 font-mono text-[11px]",children:K.map((z,L)=>n.jsxs(x.Fragment,{children:[L>0&&n.jsx(Lr,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":"true"}),L===K.length-1?n.jsx("span",{className:"truncate px-1 text-foreground","aria-current":"page",children:z.label}):n.jsx("button",{type:"button",onClick:()=>m(z.path),className:"truncate rounded px-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:z.label})]},z.path))}),h&&n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[br(h.free)," free"]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh",disabled:!c||v,onClick:()=>_(f),children:n.jsx(rl,{className:v?"animate-spin":void 0,"aria-hidden":"true"})}),n.jsxs(le,{variant:"outline",size:"sm",disabled:!c||!!k,onClick:()=>P(f,`${f.split("/").pop()}.tar.gz`),children:[k===f?n.jsx(kt,{"aria-hidden":"true"}):n.jsx(pu,{"aria-hidden":"true"}),"Download folder"]}),n.jsxs(le,{variant:"outline",size:"sm",disabled:!c||!!T,onClick:()=>{var z;return(z=D.current)==null?void 0:z.click()},children:[n.jsx(Q8,{"aria-hidden":"true"}),"Upload"]}),n.jsx("input",{ref:D,type:"file",multiple:!0,hidden:!0,onChange:z=>{const L=[...z.target.files].map(X=>({path:X.name,file:X}));z.target.value="",V(L)}})]}),T&&n.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:[n.jsx(kt,{"aria-hidden":"true"}),n.jsx("span",{className:"flex-1",children:T.committing?`Sending ${T.total.toLocaleString()} ${T.total===1?"file":"files"} to ${f}…`:`Reading ${T.done.toLocaleString()} of ${T.total.toLocaleString()} files · ${br(T.sent)} of ${br(T.bytes)}`}),!T.committing&&n.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>T.controller.abort(),children:[n.jsx(In,{"aria-hidden":"true"}),"Cancel"]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:c?p?n.jsx("p",{role:"alert",className:"p-5 text-sm text-destructive",children:p}):h?n.jsxs("ul",{"aria-label":`Files in ${f}`,className:"divide-y divide-border/60",children:[f!==$a&&n.jsx("li",{children:n.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:[n.jsx(Ak,{className:"size-3.5","aria-hidden":"true"}),".."]})}),J.map(z=>{const L=OZ(f,z.name),X=z.type==="link"?DA:op(z)?Ak:GL,ee=n.jsxs(n.Fragment,{children:[n.jsx(X,{className:`size-3.5 shrink-0 ${op(z)?"text-sky-600":"text-muted-foreground"}`,"aria-hidden":"true"}),n.jsx("span",{className:"truncate",children:z.name}),z.target&&n.jsxs("span",{className:"truncate text-muted-foreground",children:["→ ",z.target]})]});return n.jsxs("li",{className:"group flex items-center gap-3 px-5 py-1 hover:bg-muted/50",children:[op(z)?n.jsx("button",{type:"button",onClick:()=>m(L),className:"flex min-w-0 flex-1 items-center gap-2 py-0.5 text-left font-mono text-xs",children:ee}):n.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 py-0.5 font-mono text-xs",children:ee}),n.jsx("span",{className:"w-16 shrink-0 text-right text-[11px] text-muted-foreground",children:z.size!=null?br(z.size):""}),n.jsx("span",{className:"hidden w-16 shrink-0 text-right text-[11px] text-muted-foreground sm:block",title:z.modifiedAt,children:Lu(z.modifiedAt)}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":`Download ${z.name}`,className:"opacity-60 group-hover:opacity-100",disabled:!!k||z.targetType==="missing",onClick:()=>P(L,op(z)?`${z.name}.tar.gz`:z.name),children:k===L?n.jsx(kt,{"aria-hidden":"true"}):n.jsx(pu,{"aria-hidden":"true"})})]},z.name)}),!J.length&&n.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&&n.jsxs("li",{className:"px-5 py-2 text-[11px] text-muted-foreground",children:["Showing the first ",J.length.toLocaleString()," entries."]})]}):n.jsx("p",{className:"p-5 text-sm text-muted-foreground",children:"Loading files…"}):n.jsx("p",{className:"p-5 text-sm text-muted-foreground",children:"Start the sandbox to browse its files."})}),n.jsxs("div",{className:"shrink-0 space-y-1.5 border-t border-border bg-muted/20 px-5 py-3",children:[n.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:"}),n.jsxs("div",{className:"grid gap-1.5 lg:grid-cols-2",children:[n.jsx(uc,{command:z1(i,"./my-files",f)}),n.jsx(uc,{command:MZ(i,f,".")})]})]}),N&&n.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 ",n.jsx("span",{className:"ml-1 font-mono",children:f})]}),n.jsx(Fr,{open:!!M,onOpenChange:z=>{z||A(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Replace ",(M==null?void 0:M.taken.length)===1?`“${M.taken[0]}”`:`${M==null?void 0:M.taken.length} items`,"?"]}),n.jsxs(Xr,{children:[(M==null?void 0:M.taken.length)>1&&n.jsxs("span",{className:"mb-2 block font-mono text-[11px]",children:[M.taken.slice(0,6).join(", "),M.taken.length>6?", …":""]}),"Files with the same name in ",M==null?void 0:M.dir," are replaced. Folders are merged: matching files inside are replaced, and nothing is deleted."]})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{onClick:()=>q(M),children:"Replace"})]})]})})]})}function Hp({agent:e={name:"Not reported"}}){return n.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?n.jsx("img",{src:e.logo,alt:"",className:"size-3.5 shrink-0 object-contain"}):n.jsx(TA,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground",strokeWidth:1.5}),n.jsx("span",{className:"truncate",children:e.name})]})}function WE({agents:e=[],status:t="Agent inventory not checked"}){return e.length?n.jsx("span",{title:t,className:"flex min-w-0 flex-col items-start gap-1.5",children:e.map(r=>n.jsx(Hp,{agent:r},r.name))}):n.jsx("span",{className:"text-muted-foreground",children:t})}function Yl({title:e,icon:t,children:r,aside:a,className:i}){return n.jsxs("section",{className:i,children:[n.jsxs("h3",{className:"mb-2 flex items-center gap-1.5 text-sm font-medium text-foreground",children:[t&&n.jsx(t,{className:"size-3","aria-hidden":"true"}),e,a&&n.jsx("span",{className:"ml-auto font-normal normal-case tracking-normal",children:a})]}),r]})}function LZ(){const e=Pt(),t=js(),r=!!(t!=null&&t.nativeActions),[a,i]=x.useState([]);return x.useEffect(()=>{if(!r)return;let c=!1,u,f;const m=()=>{f??(f=e.editors().then(h=>h.filter(g=>g.installed))),f.then(h=>{c||i(h)}).catch(()=>{f=void 0,c||(u=setTimeout(m,3e3))})};return m(),()=>{c=!0,clearTimeout(u)}},[r,e]),a}function $Z({name:e,editors:t,cloud:r,context:a,cursorAgent:i=!1}){var G;const c=Pt(),u=gn(),f=x.useRef(null);function m(B){const P=f.current;return f.current=en.startFlow("session_launch",{launch_target:B,location_type:mf(u)},(P==null?void 0:P.outcome)==="failed"&&P.properties.launch_target===B?P:null),f.current}const[h,g]=x.useState(null),[p,b]=x.useState(null),[v,w]=x.useState("ssh"),[C,S]=x.useState(!1),[N,E]=x.useState(!1),[T,R]=x.useState(null);x.useEffect(()=>{if(r)return;let B=!1;return g(null),b(null),w("ssh"),R(null),c.sshConnection(e).then(P=>{B||(g(P),w(P.defaultMode))}).catch(P=>{B||b(P.message)}),()=>{B=!0}},[e,r,c]);const M=(h==null?void 0:h.modes[v])??(h==null?void 0:h.modes.ssh),A=v==="ssh"?"Open SSH in terminal":v==="attach"?"Attach canonical TTY":`New ${((G=a4(M==null?void 0:M.session))==null?void 0:G.toLowerCase())??"session"}`,k=p||(h?h.cliInstalled?h.sshInstalled?h.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 O(B){const P=m(B.id);S(!0);try{await c.openEditor(e,B.id),en.finishFlow(P,"handoff_requested"),He.success(`Opening ${e} in ${B.label}`)}catch(V){en.finishFlow(P,"failed",Cu(V)),He.error(`Couldn’t open ${B.label}`,{description:V.message})}finally{S(!1)}}async function D(){const B=m("terminal");S(!0);try{await c.openSshTerminal(e,v),en.finishFlow(B,"handoff_requested"),He.success(v==="ssh"?`Opening SSH to ${e}`:v==="attach"?`Attaching to ${e}`:`Starting a new session in ${e}`)}catch(P){en.finishFlow(B,"failed",Cu(P)),He.error("Couldn’t open SSH terminal",{description:P.message})}finally{S(!1)}}async function _(){E(!0);try{R(await c.sshConfig(e))}catch(B){He.error("Couldn’t generate SSH config",{description:B.message})}finally{E(!1)}}const H=n.jsxs(le,{variant:"outline",size:"sm",className:"justify-start text-xs",nativeButton:!1,disabled:!r&&(!(a!=null&&a.name)||!(a!=null&&a.workspace)),render:n.jsx("a",{href:r||a!=null&&a.name&&(a!=null&&a.workspace)?vg(e,void 0,a):void 0,onClick:B=>en.terminalClick(B,{location_type:mf(u)}),target:"_blank",rel:"noreferrer"}),children:[n.jsx(Q1,{className:"size-3.5"}),"Browser"]});return r?n.jsx(Yl,{title:"Open in",children:n.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:H})}):n.jsxs(n.Fragment,{children:[n.jsxs(Yl,{title:"Open in",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[n.jsxs(le,{variant:"outline",size:"sm",className:"justify-start text-xs",disabled:!(h!=null&&h.canOpenTerminal)||C,title:k??A,onClick:D,children:[C?n.jsx(kt,{className:"size-3.5"}):n.jsx(_A,{className:"size-3.5"}),"Terminal"]}),[...i?[{id:"cursor",label:"Cursor"}]:[],{id:"vscode",label:"VS Code"}].map(B=>{const P=t.some(V=>V.id===B.id);return n.jsxs(le,{variant:"outline",size:"sm",className:"justify-start text-xs",disabled:!P||C,title:P?"Connects over SSH through OpenShell. The first time, OpenShell adds one Include line to ~/.ssh/config.":`${B.label} is not installed.`,onClick:()=>O(B),children:[n.jsx("img",{src:`/logos/${B.id}.svg`,alt:"",className:"size-3.5 dark:invert"}),B.label]},B.id)}),H]}),k&&n.jsx("p",{role:p?"alert":"status",className:"mt-2 text-[11px] text-muted-foreground",children:k}),h&&n.jsxs("details",{className:"group mt-2 text-[11px] text-muted-foreground",children:[n.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1 py-1 hover:text-foreground [&::-webkit-details-marker]:hidden",children:[n.jsx(Lr,{className:"size-3 transition-transform group-open:rotate-90","aria-hidden":"true"}),"Connection options"]}),n.jsxs("div",{className:"mt-1.5 space-y-2",children:[n.jsxs("div",{className:"flex flex-wrap gap-1 rounded-md bg-muted p-1",children:[n.jsx(le,{type:"button",variant:v==="ssh"?"secondary":"ghost",size:"xs",onClick:()=>w("ssh"),children:"SSH shell"}),n.jsx(le,{type:"button",variant:v==="exec"?"secondary":"ghost",size:"xs",onClick:()=>w("exec"),children:"New session"}),h.modes.attach&&n.jsx(le,{type:"button",variant:v==="attach"?"secondary":"ghost",size:"xs",onClick:()=>w("attach"),children:"Attach"})]}),n.jsx("p",{className:"text-[10px] leading-relaxed",children:v==="ssh"?"Login shell over SSH.":v==="attach"?"Reconnects to the sandbox’s running terminal.":"Starts a separate shell or agent in the sandbox."}),M&&n.jsx(uc,{command:M.command,label:v==="ssh"?`ssh ${M.alias}`:`openshell sandbox ${v==="attach"?"connect":"exec --name"} ${e}`}),h.gateway.remote&&n.jsxs("p",{className:"break-all text-[10px]",children:["Via gateway ",n.jsxs("span",{className:"font-mono",children:[h.gateway.name,"/",h.gateway.workspace]})," at ",n.jsx("span",{className:"font-mono",children:h.gateway.endpoint})]}),n.jsxs(le,{variant:"outline",size:"sm",className:"w-full justify-start text-xs font-normal text-muted-foreground",disabled:!h.cliInstalled||N,onClick:_,children:[N?n.jsx(kt,{className:"size-3.5"}):n.jsx(L8,{className:"size-3.5"}),"SSH configuration"]})]})]})]}),n.jsx(tn,{open:!!T,onOpenChange:B=>{B||R(null)},children:n.jsxs(nn,{className:"sm:max-w-2xl",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["SSH configuration for ",e]}),n.jsx(Sn,{children:"The console does not change ~/.ssh/config. Review and add this Host block yourself, then connect with the command below."})]}),T&&n.jsxs(n.Fragment,{children:[n.jsx("pre",{className:"max-h-[50svh] overflow-auto whitespace-pre rounded-md border bg-muted/30 p-3 font-mono text-[11px]",children:T.config}),n.jsx(uc,{command:T.command}),n.jsx(le,{variant:"outline",onClick:async()=>{try{await navigator.clipboard.writeText(T.config),He.success("SSH config copied")}catch{He.error("Couldn’t copy SSH config")}},children:"Copy Host block"})]})]})})]})}const BZ={"read-only":"read-only","read-write":"read-write",full:"full",custom:"custom rules",blocked:"blocked"},VZ={secret:"from provider",policy:"network rule",org:"blocked everywhere",group:"inherited",agent:"agent defaults",own:"rule"};function UZ(e){var r;const t=gn();return t&&!((r=e.liveData)!=null&&r.demo)?n.jsx(Rf,{children:n.jsx(QE,{...e,scoped:!0},e.name)},t.id??t.context):n.jsx(QE,{...e},e.name)}function QE({name:e,sandbox:t,onClose:r,onNavigate:a,onChanged:i,liveData:c,scoped:u}){var $,U,F,Y,ne,te,ye;const f=Pt(),m=gn(),h=oi(),g=u?h:c??h,p=ae=>a(ae,m),[b,v]=x.useState(15),[w,C]=x.useState(Date.now);x.useEffect(()=>{const ae=setInterval(()=>C(Date.now()),3e4);return()=>clearInterval(ae)},[]);const[S,N]=x.useState(null),[E,T]=x.useState(null),[R,M]=x.useState(null),[A,k]=x.useState(!1),O=js(),D=!!(O!=null&&O.nativeActions),_=!!(m!=null&&m.cloud||((m==null?void 0:m.target)??(O==null?void 0:O.target))==="cloud"),H=LZ(),G=(($=g.sandboxes)==null?void 0:$.find(ae=>ae.name===e))??t,B=G?`${G.phase}|${G.policyVersion}`:null;x.useEffect(()=>{if(!e||(m==null?void 0:m.connected)===!1){N(null),T((m==null?void 0:m.error)??null);return}if(N(null),T(null),g.demo)return;let ae=!1,ue,se=3e4;const Q=async()=>{var ie;try{const oe=await f.sandbox(e);ae||(N(oe),T(null),se=(ie=oe.setupJobs)!=null&&ie.some(pe=>pe.status==="waiting")?2e3:3e4)}catch(oe){ae||T(oe.message)}ae||(ue=setTimeout(Q,se))};return Q(),()=>{ae=!0,clearTimeout(ue)}},[e,B,g.demo,f,m==null?void 0:m.connected,m==null?void 0:m.error]);const P=(S==null?void 0:S.name)===e?S:G,V=x.useMemo(()=>g.events.filter(ae=>ae.sandbox===e&&ae.kind==="audit"&&ae.verdict).slice(0,14),[g.events,e]);async function q(ae){var ue;if((m==null?void 0:m.connected)!==!1){M(ae);try{await f.lifecycle(e,ae),He.success(ae==="delete"?`Deleting ${e}`:ae==="stop"?`Stopping ${e}`:`Starting ${e}`),i==null||i(),(ue=g.refresh)==null||ue.call(g),ae==="delete"&&r()}catch(se){He.error(se.message)}finally{M(null),k(!1)}}}const W=x.useMemo(()=>g.events.filter(ae=>ae.sandbox===e),[g.events,e]),K=x.useMemo(()=>j4(W,b,w),[W,b,w]),J=x.useMemo(()=>{var ue;const ae=new Map;for(const se of((ue=S==null?void 0:S.policy)==null?void 0:ue.rules)??[])for(const Q of se.endpoints)!Q.blocked&&!ae.has(Q.host)&&ae.set(Q.host,{host:Q.host,source:qa(se.key)});return[...ae.values()]},[S]),z=x.useMemo(()=>{const ae=new Map;for(const ue of W){if(ue.kind!=="audit"||ue.verdict!=="denied")continue;const se=Ow(ue.destination);if(!se)continue;const Q=ae.get(se)??{host:se,count:0};Q.count+=1,ae.set(se,Q)}return[...ae.values()].sort((ue,se)=>se.count-ue.count)},[W]),L=o4(P),X=P==null?void 0:P.phase,ee=((U=S==null?void 0:S.policy)==null?void 0:U.rules)??[];return n.jsxs(n.Fragment,{children:[n.jsx(tn,{open:!!e,onOpenChange:ae=>{ae||r()},children:n.jsxs(nn,{className:"flex! h-[min(900px,94svh)] w-[calc(100%-1.5rem)]! max-w-[1280px]! flex-col gap-0! overflow-hidden p-0!",children:[n.jsxs(sn,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-6 gap-y-3",children:[n.jsxs(Qt,{className:"flex min-w-0 items-center gap-2 text-base",children:[n.jsx(hc,{"aria-hidden":"true",strokeWidth:1.5,className:"size-4 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate",children:e}),n.jsx(ga,{location:m}),X&&n.jsxs("span",{className:"ml-2 flex shrink-0 items-center gap-1.5 text-xs font-normal text-muted-foreground",children:[n.jsx("span",{className:`size-1.5 rounded-full ${Za(X).cell}`}),Cg[X]]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-xs text-muted-foreground",children:[n.jsxs("span",{children:[n.jsx("strong",{className:"mr-1 font-sans font-medium text-foreground",children:S!=null&&S.policy?J.length:"-"}),"allowed hosts"]}),n.jsxs("span",{children:[n.jsx("strong",{className:"mr-1 font-sans font-medium text-foreground",children:z.length}),"blocked hosts"]})]})]}),n.jsx(Sn,{className:"sr-only",children:"Sandbox access graph, details, rules, files, and connection activity."})]}),E&&n.jsx("p",{role:"alert",className:"shrink-0 border-b px-5 py-2 text-xs text-destructive",children:E}),P?n.jsxs(nh,{defaultValue:"overview",className:"min-h-0 flex-1 gap-0!",children:[n.jsx("div",{className:"shrink-0 border-b border-border px-5 py-2",children:n.jsxs(sh,{variant:"line","aria-label":"Sandbox information",className:"max-w-full",children:[n.jsx(Pr,{value:"overview",className:"px-3 text-xs",children:"Overview"}),n.jsxs(Pr,{value:"rules",className:"px-3 text-xs",children:["Rules",(S==null?void 0:S.policy)&&n.jsx("span",{className:"text-muted-foreground",children:ee.length})]}),n.jsx(Pr,{value:"setups",className:"px-3 text-xs",children:"MCPs & Skills"}),n.jsx(Pr,{value:"files",className:"px-3 text-xs",children:"Files"}),n.jsx(Pr,{value:"activity",className:"px-3 text-xs",children:"Activity"}),n.jsx(Pr,{value:"details",className:"px-3 text-xs",children:"Details"})]})}),n.jsx(Io,{value:"overview",className:"min-h-0 overflow-y-auto",children:n.jsxs("div",{className:"grid min-h-full grid-cols-1 lg:h-full lg:grid-cols-[minmax(0,1fr)_250px]",children:[n.jsx("div",{className:"flex min-w-0 flex-col p-4 sm:p-5",children:n.jsx(Yl,{title:"Access graph",className:"flex flex-1 flex-col",children:S!=null&&S.policy?n.jsx(xW,{compact:!0,fill:!0,agentStatus:Wv(P),agents:L,name:e,phase:X,allowed:J,denied:z,owner:df(P,O!=null&&O.connected?O.user:null),gateway:g.demo||(F=g.overview)==null?void 0:F.gateway,secrets:(P.providers??[]).map(ae=>{var ue,se;return((se=(ue=g.overview)==null?void 0:ue.providers)==null?void 0:se.find(Q=>Q.name===ae))??{name:ae}})}):n.jsx("p",{className:"rounded-lg border border-border p-5 text-sm text-muted-foreground",children:g.demo?"Policy data is unavailable for synthetic sandboxes.":E?"The access graph is unavailable because the policy could not be loaded.":S?"No policy was reported by the gateway.":"Loading access graph…"})})}),n.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:[X==="ready"&&!g.demo&&(m==null?void 0:m.connected)!==!1&&n.jsx($Z,{name:e,editors:H,cursorAgent:L.some(ae=>ae.name==="Cursor"),cloud:!D,context:m?{name:m.gateway,workspace:m.workspace,target:m.target}:{...(Y=g.overview)==null?void 0:Y.gateway,target:O==null?void 0:O.target}},e),!g.demo&&X==="ready"&&(m==null?void 0:m.connected)!==!1&&(_?n.jsx(AZ,{name:e,sandbox:P},e):n.jsx(RZ,{name:e,sandbox:P},e)),n.jsxs(Yl,{title:"At a glance",children:[(ne=P.setupJobs)==null?void 0:ne.filter(ae=>["waiting","failed","blocked"].includes(ae.status)).map(ae=>n.jsx("p",{role:"status",className:"mb-3 text-xs text-muted-foreground",children:ae.status==="waiting"?"Installing included MCPs and skills…":`Included tools could not be activated: ${ae.error} Open MCPs & Skills to retry.`},ae.setup)),n.jsx("dl",{className:"grid grid-cols-2 gap-4 lg:grid-cols-1",children:[["Status",n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{className:`size-1.5 rounded-full ${Za(X).cell}`,"aria-hidden":"true"}),Cg[X]??"Unknown"]})],["Owner",df(P,O!=null&&O.connected?O.user:null)],[L.length===1?"AI agent":"AI agents",n.jsx(WE,{agents:L,status:Wv(P)})],["Image",_p(P.image,P.imageTemplateName)],["Providers",P.providers.join(", ")||"None"],["Created",jf(P.createdAt)],["Policy",S?`v${S.policyVersionNumber??P.policyVersion} · ${S.policySource??"sandbox"}`:"Not reported"]].map(([ae,ue])=>n.jsxs("div",{className:"min-w-0",children:[n.jsx("dt",{className:"text-[11px] text-muted-foreground",children:ae}),n.jsx("dd",{className:"mt-1 break-words text-xs",children:ue})]},ae))})]}),P.problem&&Px(X)==="error"&&n.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50/60 p-3",children:[n.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-medium text-red-700",children:[n.jsx(ti,{className:"size-3.5","aria-hidden":"true"}),"Failed to start"]}),uQ(P.problem)&&n.jsx(jQ,{local:!_&&!(m?m.remote:(ye=(te=g.overview)==null?void 0:te.gateway)!=null&&ye.remote)}),n.jsx("p",{className:"mt-1 max-h-28 overflow-y-auto font-mono text-[10px] leading-relaxed break-words text-red-700/80",children:P.problem})]})]})]})}),n.jsx(Io,{value:"rules",className:"min-h-0 space-y-6 overflow-y-auto p-5",children:n.jsx(Yl,{title:"Network rules",icon:Q1,aside:n.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:S!=null&&S.policy?ee.length===0?n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No rules. All outbound denied."}):n.jsx("ul",{className:"divide-y divide-border/70 rounded-md border border-border",children:ee.map(ae=>n.jsxs("li",{className:"px-3 py-2",children:[n.jsxs("p",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{className:"truncate font-mono font-medium",children:qa(ae.key)==="own"?ae.name:cf(ae.key)}),n.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:VZ[qa(ae.key)]})]}),n.jsx("ul",{className:"mt-1.5 space-y-0.5",children:ae.endpoints.map(ue=>n.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[n.jsx("span",{className:`size-1.5 shrink-0 rounded-full ${ue.blocked?"bg-red-500":"bg-emerald-500"}`,"aria-hidden":"true"}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[ue.host,ue.port?`:${ue.port}`:""]}),n.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[BZ[ue.access]??ue.access,ue.tlsSkip?" · TLS passthrough":"",ue.protocol!=="tcp"&&ue.enforcement==="audit"?" · audit only":""]})]},`${ue.host}:${ue.port}`))}),ae.binaries.length>0&&n.jsx("p",{className:"mt-1.5 truncate font-mono text-[10px] text-muted-foreground",title:ae.binaries.join(", "),children:ae.binaries.map(ue=>ue.split("/").pop()).filter((ue,se,Q)=>Q.indexOf(ue)===se).join(", ")})]},ae.key))}):n.jsx("p",{className:"text-sm text-muted-foreground",children:g.demo?"Policy data is unavailable in this preview.":E?"Rules could not be loaded. Close and reopen to retry.":S?"No policy reported.":"Loading rules…"})})}),n.jsx(Io,{value:"setups",className:"min-h-0 overflow-y-auto",children:(m==null?void 0:m.connected)===!1?n.jsx("p",{role:"status",className:"p-5 text-sm text-muted-foreground",children:"Reconnect this location to manage MCPs & Skills."}):n.jsx(aD,{sandbox:e,setupIds:(S==null?void 0:S.setupIds)??[]})}),n.jsx(Io,{value:"files",className:"flex min-h-0 flex-col",children:(m==null?void 0:m.connected)===!1?n.jsx("p",{role:"status",className:"p-5 text-sm text-muted-foreground",children:"Reconnect this location to access files."}):n.jsx(PZ,{sandbox:P,demo:g.demo})}),n.jsxs(Io,{value:"activity",className:"min-h-0 space-y-6 overflow-y-auto p-5",children:[n.jsxs(Yl,{title:"Connection activity",aside:n.jsx("div",{className:"flex gap-1",children:[15,60].map(ae=>n.jsx("button",{onClick:()=>v(ae),"aria-pressed":b===ae,className:`rounded px-2 py-1 text-xs ${b===ae?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:ae===15?"15m":"1h"},ae))}),children:[n.jsx("div",{className:"rounded-lg border border-border p-4",children:n.jsx(S4,{points:K,height:100,title:"Outbound decisions per minute"})}),n.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Based on the recent event buffer",g.demo?" · synthetic preview":"","."]})]}),n.jsx(Yl,{title:"Egress",aside:V.length?n.jsx("button",{onClick:()=>{r(),p("activity")},className:"text-[11px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:"All"}):null,children:V.length?n.jsx("div",{className:"rounded-md border border-border",children:V.map(ae=>n.jsx(kZ,{event:ae,dense:!0},`${ae.at}|${ae.message}`))}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No connections yet"})})]}),n.jsx(Io,{value:"details",className:"min-h-0 space-y-5 overflow-y-auto p-5",children:n.jsx("dl",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2",children:[["Owner",df(P,O!=null&&O.connected?O.user:null)],["Image",_p(P.image,P.imageTemplateName),!0],...P.image&&_p(P.image,P.imageTemplateName)!==P.image?[["Image reference",P.image,!0]]:[],["Command",SW(P.command),!0],[L.length===1?"AI agent":"AI agents",n.jsx(WE,{agents:L,status:Wv(P)})],["Providers",P.providers.join(", ")||"None"],["Created",jf(P.createdAt)],["Workspace",P.workspace],["Policy",S?`v${S.policyVersionNumber??P.policyVersion} · ${S.policySource??"sandbox"}`:`v${P.policyVersion??"-"}`],["Sandbox ID",P.id,!0,!0]].map(([ae,ue,se,Q])=>n.jsxs("div",{className:Q?"sm:col-span-2":void 0,children:[n.jsx("dt",{className:"mb-1 text-[11px] text-muted-foreground",children:ae}),n.jsx("dd",{className:`break-all ${se?"font-mono text-xs":"text-sm"}`,children:ue??"Not reported"})]},ae))})})]}):n.jsx("p",{role:"status",className:"flex-1 p-5 text-sm text-muted-foreground",children:E?"Sandbox details unavailable.":"Loading sandbox…"}),P&&!g.demo&&n.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2 border-t border-border bg-muted/20 px-5 py-3",children:[wW(X)&&n.jsxs(le,{variant:"outline",size:"sm",disabled:!!R||(m==null?void 0:m.connected)===!1,onClick:()=>q("stop"),children:[R==="stop"?n.jsx(kt,{"aria-hidden":"true"}):n.jsx(H8,{"aria-hidden":"true"}),"Stop"]}),jW(X)&&n.jsxs(le,{variant:"outline",size:"sm",disabled:!!R||(m==null?void 0:m.connected)===!1,onClick:()=>q("start"),children:[R==="start"?n.jsx(kt,{"aria-hidden":"true"}):n.jsx(IA,{"aria-hidden":"true"}),"Start"]}),n.jsxs(le,{variant:"outline",size:"sm",disabled:!!R||(m==null?void 0:m.connected)===!1||X==="deleting",className:"border-destructive/30 text-destructive hover:bg-destructive/5 hover:text-destructive",onClick:()=>k(!0),children:[n.jsx(ts,{"aria-hidden":"true"}),"Delete"]})]})]})}),n.jsx(Fr,{open:A,onOpenChange:k,children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",e,"?"]}),n.jsx(Xr,{children:"All files inside will be lost."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsxs(Wr,{variant:"destructive",onClick:()=>q("delete"),disabled:R==="delete",children:[R==="delete"&&n.jsx(kt,{"aria-hidden":"true"}),"Delete"]})]})]})})]})}function Kl({title:e,summary:t,children:r,...a}){return n.jsxs("details",{className:"group/setup min-w-0 border-t border-border",...a,children:[n.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:[n.jsx(Lr,{className:"size-3.5 shrink-0 text-muted-foreground transition-transform group-open/setup:rotate-90","aria-hidden":"true"}),n.jsx("span",{className:"shrink-0 text-xs font-medium",children:e}),n.jsx("span",{className:"ml-auto truncate text-right text-[11px] text-muted-foreground",title:t,children:t})]}),n.jsx("div",{className:"grid min-w-0 gap-4 pb-4 pt-1",children:r})]})}const Do=(e,t="read-write")=>({host:e,ports:[443],protocol:"rest",access:t,enforcement:"enforce"}),ap=["/usr/local/bin/node","/usr/bin/node"],oy=["generativelanguage.googleapis.com","cloudcode-pa.googleapis.com","oauth2.googleapis.com","accounts.google.com","www.googleapis.com","aiplatform.googleapis.com","*.aiplatform.googleapis.com"],HZ=new Set(["cloudcode-pa.googleapis.com","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"]),FZ=e=>({...Do(e),...HZ.has(e)?{deny:["fetchFromTrawlerCache","rewriteUri","generateContent"].map(t=>({method:"*",path:`/**:${t}*`}))}:{}}),ip=["api.anthropic.com","api.openai.com","openrouter.ai","api.groq.com","api.deepseek.com","api.mistral.ai","api.x.ai","generativelanguage.googleapis.com"],Pi=(e,t,r)=>({name:e,binaries:t,endpoints:[...new Set(r)].map(a=>Do(a))}),hf={claude:{name:"Claude Code",binaries:["/usr/bin/claude","/usr/local/bin/claude"],endpoints:["api.anthropic.com","platform.claude.com","claude.ai"].map(e=>Do(e)),authentication:"Attach a Claude credential or sign in with your subscription after connecting.",connectors:{name:"claude.ai connectors",hosts:["mcp-proxy.anthropic.com"]}},opencode:{name:"OpenCode",binaries:["/usr/local/lib/node_modules/opencode-ai/bin/opencode.exe","/usr/local/bin/opencode","/sandbox/.opencode/bin/opencode"],endpoints:[Do("models.opencode.ai","read-only"),Do("models.dev","read-only"),Do("opencode.ai"),...ip.map(e=>Do(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=>Do(e)),connectors:{name:"ChatGPT connectors and plugins",paths:{"chatgpt.com":["/backend-api/ps/mcp","/backend-api/ps/mcp/**","/backend-api/connectors/**"]}},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:Pi("Gemini CLI",[...ap,"/usr/local/bin/gemini"],oy),pi:{...Pi("Pi",[...ap,"/usr/local/bin/pi"],[...ip,...oy,"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:Pi("Aider",["/usr/local/bin/aider","/opt/aider/bin/python*","/usr/bin/python3*","/usr/local/bin/python3*"],ip),copilot:Pi("GitHub Copilot",[...ap,"/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:{...Pi("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=>Do(e)),{host:"agentn.global.api5.cursor.sh",ports:[443],protocol:"tcp",tlsSkip:!0}]},antigravity:{...Pi("Antigravity",["/sandbox/.local/bin/agy","/sandbox/.antigravity/**","/sandbox/.local/share/antigravity/**","/usr/local/bin/agy",...ap],[]),endpoints:[...[...oy,"antigravity.google","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"].map(FZ),Do("lh3.googleusercontent.com","read-only")]},kiro:Pi("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:Pi("Factory Droid",["/sandbox/.local/bin/droid","/sandbox/.factory/bin/**","/usr/local/bin/droid"],["factory.ai","*.factory.ai",...ip])},GZ=e=>({host:e,ports:[443],protocol:"rest",enforcement:"enforce",allow:[{method:"GET",path:"/**"}]}),ZE={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(GZ)}},Ww=(e=[])=>e.filter(t=>{var r;return(r=hf[t])==null?void 0:r.connectors}),qZ=["ANTHROPIC_API_KEY","CLAUDE_API_KEY","OPENAI_API_KEY"],YZ=e=>{var t;return!!((t=e==null?void 0:e.credentialKeys)!=null&&t.some(r=>qZ.includes(r)))};function KZ(e,t){const{hosts:r=[],paths:a={}}=e.connectors??{},i=e.endpoints.map(c=>!t&&a[c.host]?{...c,deny:[...c.deny??[],...a[c.host].map(u=>({method:"*",path:u}))]}:c);return{...e,endpoints:t?[...i,...r.map(c=>Do(c))]:i}}function SD(e,{connectors:t=[]}={}){if((e==null?void 0:e.source)!=="build")return{profiles:[],unsupported:[]};const r=[...new Set(e.agents??[])];if(!Array.isArray(t)||t.some(a=>!Ww(r).includes(a)))throw new Error("Connectors can be turned on only for this sandbox’s Claude Code or Codex.");return{profiles:[...r.filter(a=>hf[a]).map(a=>({id:a,rule:`agent-${a}`,...KZ(hf[a],t.includes(a))})),...[...new Set(e.runtimes??[])].filter(a=>ZE[a]).map(a=>({id:a,...ZE[a]}))],unsupported:r.filter(a=>!hf[a])}}const dc=Ws.filter(e=>!SD({source:"build",agents:[e.id]}).unsupported.length);function Qw(e){const t=Array.isArray(e)?e:e==="terminal"?[]:[e];if(t.some(r=>!dc.some(a=>a.id===r)))throw new Error("Choose a supported agent.");return dc.filter(r=>t.includes(r.id)).map(r=>r.id)}function XZ(e,t){const r=Qw(e);if(r.length!==1||t==="shell")return"shell";const a=dc.find(i=>i.id===t&&r.includes(i.id));if(!a)throw new Error("Choose Shell or a selected agent.");return a.command}function Zw(e,t="",r="agent",a=!1,i=[]){if(!["agent","shell"].includes(r))throw new Error("Choose Shell or the selected agent.");const c=a||i.length?["python","node"]:[],u=Qw(e),f=dc.find(m=>m.id===u[0]);return na({name:t,agents:u,runtimes:c,setups:i.map(m=>m.id),setupRevisions:Object.fromEntries(i.map(m=>[m.id,m.revision])),command:Array.isArray(e)||r==="shell"?"":(f==null?void 0:f.command)||""})}function WZ(e,t,r="agent",a=!1,i=[]){const c=Zw(t,"",r,a,i);return e.find(u=>u.managed&&u.status==="ready"&&u.image&&u.build===GY(c)&&JSON.stringify(na({...u.recipe,name:""}))===JSON.stringify(c))}function JE(e,t){const r={claude:["claude-code"],codex:["codex"]}[t]||[];return e.filter(a=>r.includes(a.type))}const ND=(e,t)=>new Promise((r,a)=>{const i=()=>{clearTimeout(c),a(new DOMException("Preparation cancelled.","AbortError"))},c=setTimeout(()=>{t==null||t.removeEventListener("abort",i),r()},e);t==null||t.addEventListener("abort",i,{once:!0}),t!=null&&t.aborted&&i()});async function QZ(e,t,{openIn:r="agent",withSetups:a=!1,setups:i=[],signal:c,onProgress:u=()=>{},onBuild:f=()=>{},onBuildUpdate:m=()=>{},wait:h=ND}={}){const g=()=>{if(c!=null&&c.aborted)throw new DOMException("Preparation cancelled.","AbortError")};g();const p=await e.imageTemplates();g();const b=WZ(p,t,r,a,i);if(b)return m(b),b;const v=Qw(t),C=`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 S=await e.buildImageTemplate(Zw(t,C,r,a,i));if(f(C),m({...S,name:C}),g(),S.status==="failed")throw new Error(S.error||"Environment build failed.");for(let N=0;N<900;N++){await h(2e3,c),g();const E=(await e.imageTemplates()).find(T=>T.name===C);if(g(),!E)throw new Error("The environment build disappeared. Check Templates and try again.");if(m(E),E.status==="failed")throw new Error(E.error||"Environment build failed.");if(E.status==="ready")return E}throw new Error("The build is still running. Check Templates before trying again.")}async function CD(e,t,r,{signal:a,expectedRevisions:i={},onProgress:c=()=>{},wait:u=ND}={}){const f=()=>{if(a!=null&&a.aborted)throw new DOMException("Preparation cancelled.","AbortError")};if(f(),!t.length)return{setups:[],accessReview:null};const m=await e.setups(),h=[],g=r?{}:null;for(const p of t){f();const b=m.find(w=>w.id===p);if(!b||r&&r[p]!==b.revision||i[p]&&i[p]!==b.revision)throw new Error("A selected Setup changed. Reopen the dialog and review it again.");c(`Preparing MCP packages for ${b.name}…`);let v;try{v=await e.prepareLaunchSetup(p,b.revision);for(let w=0;v.status==="running"&&w<900;w++)f(),c(v.message||`Preparing ${b.name}…`),await u(2e3,a),f(),v=await e.setupPreparation(v.id);if(f(),v.status!=="complete"||!v.setup)throw new Error(v.message||"Package preparation did not finish. Retry creation.");h.push(v.setup),g&&(g[v.setup.id]=v.setup.revision)}catch(w){throw v!=null&&v.id&&v.status==="running"&&await e.cancelSetupPreparation(v.id).catch(()=>{}),w}}return{setups:h,accessReview:g}}const yr=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),kD=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>dc.find(t=>t.id===e)).filter(Boolean),eR=dc.filter(e=>!kD.includes(e)),ZZ=[{id:"empty",label:"Empty"},{id:"folder",label:"Local folder"},{id:"repo",label:"Git repository"}];function JZ(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?`${$a}/${/^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(a)?a:"repo"}`:null}catch{return null}}const eJ={gitignore:".gitignore applied","gitignore-empty":".gitignore matched nothing, so everything is sent",none:"Not a git repository, so everything is sent"},tJ={included:e=>`git history included (${br(e.gitBytes)})`,worktree:()=>"Git worktree: history not included",subfolder:()=>"Inside a repository: history not included",none:()=>null};function nJ({plan:e,sandbox:t}){return n.jsxs("div",{className:"grid min-w-0 gap-1 text-[11px]",children:[e.over?n.jsxs("p",{className:"text-red-700",children:["Over ",br(e.limit),". Add a .gitignore, or upload it from a terminal."]}):n.jsxs("p",{children:[e.files.toLocaleString()," ",e.files===1?"file":"files"," · ",br(e.bytes)," → ",n.jsx("span",{className:"font-mono",children:e.dest})]}),n.jsx("p",{className:"text-muted-foreground",children:[eJ[e.filter],tJ[e.git](e),e.links?`${e.links} ${e.links===1?"symlink":"symlinks"} kept as links`:null].filter(Boolean).join(" · ")}),e.secretCount>0&&n.jsxs("p",{className:"text-amber-700",children:["May hold secrets: ",n.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."]}),n.jsxs("details",{className:"mt-1",children:[n.jsx("summary",{className:"cursor-pointer text-muted-foreground",children:"Upload from a terminal instead"}),e.git==="included"&&n.jsx("p",{className:"mt-1 text-muted-foreground",children:"Without git history."}),n.jsx(uc,{command:z1(t||"NAME",e.display,$a)})]})]})}function sJ({org:e,value:t,onChange:r,onCreated:a,onAddPolicy:i,invalid:c=!1}){const u=Zs(),f=wD(e.policies,t),m=Object.fromEntries(e.groups.map(g=>{var p,b;return[g.id,((b=(p=e.members)==null?void 0:p[g.id])==null?void 0:b.length)??0]})),h=e.groups.filter(g=>t.includes(g.id));return n.jsx("div",{id:"sandbox-groups",className:`-m-3 rounded-lg p-3 transition-colors ${c?"bg-destructive/5 ring-1 ring-destructive/60":""}`,children:n.jsxs("fieldset",{"aria-invalid":c||void 0,className:"grid min-w-0 gap-2.5",children:[n.jsxs("legend",{className:"mb-2.5 text-xs font-medium",children:["Groups ",n.jsx("span",{className:"text-muted-foreground",children:"· Optional"})]}),n.jsx(cc,{multiple:!0,groups:e.groups,counts:m,value:t,onChange:r,onCreated:a}),n.jsx($n.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?n.jsxs(n.Fragment,{children:["Gets ",f.length===1?"this network rule":`these ${f.length} network rules`,": ",n.jsx("span",{className:"text-foreground",children:f.map(g=>g.name).join(", ")}),"."]}):h.length?n.jsx(n.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&&n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:i,children:"Add network rule"})]})})}function tR(e,t){const r=lo.getSnapshot().filter(a=>a.status!=="failed"&&a.status!=="cancelled"&&yr(a.location)===yr(t));return new Set([...e.map(a=>a.name),...r.map(a=>a.name)])}function nR(e,t="sandbox"){for(let r=1;r<1e3;r++){const a=`${t}-${r}`;if(!e.has(a))return a}return""}function TD({locations:e,location:t,onLocationChange:r,onRefreshLocations:a,allowRemote:i=!1,initialLocationConfirmed:c=!1,...u}){var O;const f=gn(),m=Pt(),[h,g]=x.useState(null),p=(O=u.initialImageTemplate)==null?void 0:O.location,b=e??[],v=p??t,w=v?b.find(D=>yr(D)===yr(v))??(yr(f)===yr(v)?f:v):b.find(D=>yr(D)===h)??f??b.find(D=>D.target===m.target&&D.connected)??null,C=!u.initialImageTemplate&&(i||b.length>1),[S,N]=x.useState("where"),[E,T]=x.useState(null),R=x.useRef(null);x.useEffect(()=>{u.open&&!R.current&&(R.current=en.exploreFlow("sandbox_creation")),u.open||(R.current=null)},[u.open]),x.useEffect(()=>{u.open&&en.step(R.current,C&&S==="where"?"location":"configuration")},[u.open,C,S]);function M(D){var _;!D&&!((_=R.current)!=null&&_.submitted)&&en.finishFlow(R.current,"cancelled"),u.onOpenChange(D)}x.useEffect(()=>{u.open||g(null),N(c?"form":"where"),T(null)},[u.open,c]);const A=D=>{const _=b.find(H=>yr(H)===D&&H.connected);_&&(g(D),r==null||r(_))};x.useEffect(()=>{if(!E)return;const D=b.find(H=>H.gateway===E&&H.connected);if(D){T(null),A(yr(D)),N("form");return}const _=setInterval(()=>a==null?void 0:a(),1500);return()=>clearInterval(_)},[E,b]);const k=C&&S==="where"?n.jsx(Ox,{locations:b,allowRemote:i,connecting:!!E,onPick:D=>{A(D),N("form")},onConnected:D=>{T(D.gateway),a==null||a()},onCancel:()=>M(!1)}):null;return n.jsx(Zn,{location:w,children:n.jsx(rJ,{...u,onOpenChange:M,analyticsFlow:R,locations:b,onLocationChange:A,chooser:k,onChangeLocation:C?()=>N("where"):void 0},yr(w)??"default")})}function rJ({open:e,onOpenChange:t,onStarted:r,initialImageTemplate:a=null,locations:i,onLocationChange:c,chooser:u,onChangeLocation:f,analyticsFlow:m}){var Ze,Tt;const h=Pt(),g=gn(),p=Zs(),[b,v]=x.useState([]),[w,C]=x.useState([]),[S,N]=x.useState(""),E=x.useRef(!1),[T,R]=x.useState([]),[M,A]=x.useState([]),[k,O]=x.useState(null),[D,_]=x.useState(""),[H,G]=x.useState([]),[B,P]=x.useState("quick"),[V,q]=x.useState([]),[W,K]=x.useState("shell"),[J,z]=x.useState({}),[L,X]=x.useState([]),[ee,$]=x.useState(null),[U,F]=x.useState(null),[Y,ne]=x.useState("empty"),te=js(),ye=!!(g!=null&&g.cloud||((g==null?void 0:g.target)??(te==null?void 0:te.target))==="cloud"),[ae,ue]=x.useState(""),[se,Q]=x.useState(null),[ie,oe]=x.useState(""),[pe,xe]=x.useState(null),[je,Ie]=x.useState([]),[ce,Te]=x.useState(null),[re,fe]=x.useState(!1),[Re,Oe]=x.useState(0),[ke,he]=x.useState(!1);x.useEffect(()=>{if(!e||(g==null?void 0:g.connected)===!1)return;let Se=!0;return E.current=!1,v([]),C([]),h.overview().then(et=>{if(!Se)return;const it=et.sandboxes??[],lt=et.providers??[];v(it),C(lt),E.current||N(nR(tR(it,g))),G(lt.map(wt=>wt.name))}).catch(et=>{Se&&$(et.message)}),N(""),P(a?"template":"quick"),q([]),K("shell"),z({}),X([]),A([]),_((a==null?void 0:a.name)||""),R(a?[a]:[]),h.imageTemplates().then(et=>{Se&&R(et.filter(it=>it.status==="ready"||it.exists))}).catch(et=>{Se&&$(et.message)}),G([]),$(null),F(null),xe(null),ne("empty"),ue(""),Q(null),oe(""),Ie([]),he(!1),Te(null),fe(zp(g)),(zp(g)?h.syncLocalCatalog():Promise.resolve(null)).then(async et=>{if(!Se)return;const it=await h.org();Se&&(et!=null&&et.available&&(it.groups=it.groups.filter(lt=>!et.importedGroups.includes(lt.id)||et.groups.includes(lt.id))),xe(it),Te(et))}).catch(et=>{Se&&(xe(null),$(`Could not load sandbox settings: ${et.message}`))}).finally(()=>{Se&&fe(!1)}),()=>{Se=!1}},[e,h,g==null?void 0:g.connected,g==null?void 0:g.remote,a,Re]);const Ae=B==="template"?T.find(Se=>Se.name===D):null,ge=dc.filter(Se=>V.includes(Se.id)),Pe=B==="quick"?[...new Set(ge.flatMap(Se=>{const Ye=J[Se.id];return JE(w,Se.id).some(et=>et.name===Ye)?[Ye]:[]}))]:H,Fe=Ae!=null&&Ae.managed&&Ae.recipe.source==="build"?Ws.filter(Se=>Ae.recipe.agents.includes(Se.id)):null,_e=B==="quick"?V:(Fe??[]).map(Se=>Se.id),Xe=B==="quick"?Object.keys(J).filter(Se=>YZ(w.find(Ye=>Ye.name===J[Se]))):[],Je=Ww(_e).filter(Se=>L.includes(Se)&&!Xe.includes(Se)),ct=SD(B==="quick"?Zw(V):Ae!=null&&Ae.managed?Ae.recipe:null,{connectors:Je}),At=MV(_e),rt=B==="quick"?M.length>0:!!((Tt=(Ze=Ae==null?void 0:Ae.recipe)==null?void 0:Ze.setups)!=null&&Tt.length),ve=rt&&!At.length;function Ue(Se){const Ye=V.includes(Se)?V.filter(et=>et!==Se):[...V,Se];q(Ye),$(null),(Ye.length!==1||!Ye.includes(W))&&K("shell"),z(et=>Object.fromEntries(Object.entries(et).filter(([it])=>Ye.includes(it)))),/^(sandbox|terminal|claude|codex|cursor|opencode|pi|antigravity|copilot|kiro|droid|aider)-\d+$/.test(S)&&N(nR(tR(b??[],g),Ye.length===1?Ye[0]:"sandbox"))}x.useEffect(()=>{if(Y!=="folder"||!ae.trim()){Q(null);return}let Se=!1;Q({loading:!0});const Ye=setTimeout(()=>{h.localFolder(ae.trim()).then(et=>{Se||Q({data:et})}).catch(et=>{Se||Q({error:et.message})})},400);return()=>{Se=!0,clearTimeout(Ye)}},[Y,ae,h]);const Qe=je.every(Se=>pe==null?void 0:pe.groups.some(Ye=>Ye.id===Se)),xt=Y==="repo"?JZ(ie):null,Ke=Y==="empty"||(Y==="folder"?!!(se!=null&&se.data&&!se.data.over):!!xt),Be=Y==="folder"?ae.trim():Y==="repo"?ie.trim():"";function jt(Se){var on;if(Se.preventDefault(),(g==null?void 0:g.connected)===!1)return;const Ye=[!S&&"sandbox-name",B==="template"&&!Ae&&"sandbox-image-template",!Qe&&"sandbox-groups"].find(Boolean);if(Ye||!Ke||ve){en.step(m==null?void 0:m.current,"validation","blocked","unknown"),he(!0),Ye&&((on=document.getElementById(Ye))==null||on.scrollIntoView({behavior:p?"auto":"smooth",block:"center"}));return}const et=Y==="folder"?{folder:se.data.path}:Y==="repo"?{repository:ie.trim()}:{},it=S.trim(),lt=B==="quick",wt=V,cn=lt?{session:XZ(V,W)}:{},Gt=M,fn=k,Bn=Je,Kn=Pe,de=At,tt=je,Et=Ae;m!=null&&m.current&&(m.current.submitted=!0),lo.start({name:it,location:g,analyticsFlow:m==null?void 0:m.current,analyticsProperties:{location_type:mf(g),creation_mode:B,file_source:Y,agent_ids:V,setup_count:Gt.length,provider_count:Kn.length,group_count:tt.length},task:async({signal:xn,progress:Wt,build:un,creating:ns})=>{let Jn=Et,wo=[],jo=null,cr=null;const Fs=()=>{cr&&h.cancelImageBuild(cr).catch(Ms=>He.error(Ms.message))};xn.addEventListener("abort",Fs);try{if(lt){const Ms=await CD(h,Gt,fn,{signal:xn,onProgress:Wt});wo=Ms.setups.map(Pn=>Pn.id),jo=Ms.accessReview,Jn=await QZ(h,wt,{withSetups:Gt.length>0,setups:Ms.setups,signal:xn,onProgress:Wt,onBuildUpdate:un,onBuild:Pn=>{cr=Pn,xn.aborted&&Fs()}})}}finally{xn.removeEventListener("abort",Fs)}if(xn.aborted)throw new DOMException("Cancelled","AbortError");ns();const ds=await h.create({name:it,imageTemplate:Jn.name,includeTemplateAccess:!lt,...cn,providers:Kn,setups:wo,setupAccessReview:jo,setupTargets:de,connectors:Bn,groups:tt,...et});ds.seed&&He(`${ds.seed.kind==="folder"?"Uploading":"Cloning"} ${ds.seed.source}`,{description:`Into ${ds.seed.dest} once the sandbox starts. Progress is in its Files tab.`});for(const Ms of ds.opened??[])He(`Opened ${Ms.name||"default"} on port ${Ms.port}`,{description:Ms.url??void 0});return{...ds,image:Jn.image,providers:Kn,createdAt:new Date().toISOString(),...g?{location:g}:{}}}}),t(!1),r==null||r()}return n.jsxs(n.Fragment,{children:[n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"max-h-[90svh] gap-4 bg-transparent p-0 ring-0 sm:max-w-4xl",children:u??n.jsx(n.Fragment,{children:n.jsx("form",{onSubmit:jt,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:n.jsxs(nh,{value:B,onValueChange:Se=>{P(Se),$(null)},className:"contents",children:[n.jsxs(sn,{className:"shrink-0 gap-3 px-5 pt-5 pb-4 @3xl:px-7 @3xl:pt-6",children:[f&&n.jsx("div",{className:"pr-8",children:n.jsx(Iw,{step:2})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 pr-8",children:[n.jsx(Qt,{children:"New sandbox"}),f?n.jsx(b4,{location:g,onChange:f}):!a&&i.length>0?null:n.jsx(ga,{location:g}),n.jsxs(sh,{className:"ml-auto w-fit","aria-label":"Sandbox creation method",children:[n.jsx(Pr,{value:"quick",className:"px-3 text-xs",children:"Quick setup"}),n.jsx(Pr,{value:"template",className:"px-3 text-xs",children:"From template"})]})]}),!f&&i.length>0&&!a&&n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"sandbox-location",className:"text-xs",children:"Location"}),n.jsxs(jp,{value:yr(g)??"",onValueChange:c,items:i.map(Se=>({value:yr(Se),label:`${Dn(Se)}${Se.connected?"":" · Disconnected"}`})),children:[n.jsx(Np,{id:"sandbox-location",className:"w-full text-xs",children:n.jsx(Sp,{placeholder:"Choose a connected location"})}),n.jsx(Cp,{align:"start",alignItemWithTrigger:!1,children:i.map(Se=>n.jsxs(Zd,{value:yr(Se),disabled:!Se.connected,children:[Dn(Se),Se.connected?"":" · Disconnected"]},yr(Se)))})]})]}),(g==null?void 0:g.connected)===!1&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"This location is disconnected. Choose a connected location to create a sandbox."}),re&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading your local network policies, MCPs & Skills, and Groups…"}),(ce==null?void 0:ce.available)&&n.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."}),zp(g)&&!re&&!pe&&n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>Oe(Se=>Se+1),children:"Retry loading settings"})]}),n.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:n.jsxs("fieldset",{disabled:(g==null?void 0:g.connected)===!1,className:"contents",children:[n.jsxs($n.div,{initial:p?!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:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"sandbox-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"sandbox-name",value:S,onChange:Se=>{E.current=!0,N(Se.target.value.toLowerCase())},className:"h-10 font-mono text-sm",required:!0,"aria-invalid":ke&&!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})]}),n.jsxs(Io,{value:"quick",className:"grid gap-4",children:[n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Agents"}),n.jsx("div",{className:"grid grid-cols-2 gap-2 @3xl:grid-cols-3",children:kD.map(Se=>n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:"checkbox",checked:V.includes(Se.id),onChange:()=>Ue(Se.id),className:"peer sr-only"}),n.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:[n.jsx("img",{src:Se.logo,alt:"",className:"size-4 shrink-0 object-contain"}),n.jsx("span",{className:"min-w-0 flex-1",children:Se.name}),V.includes(Se.id)&&n.jsx(Yn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]})]},Se.id))}),n.jsxs(Fi,{children:[n.jsxs(Gi,{render:n.jsx(le,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[n.jsx("span",{className:"truncate",children:eR.filter(Se=>V.includes(Se.id)).map(Se=>Se.name).join(", ")||"More agents"}),n.jsx(ha,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),n.jsx(qi,{align:"start",children:eR.map(Se=>n.jsxs(Bw,{checked:V.includes(Se.id),onCheckedChange:()=>Ue(Se.id),closeOnClick:!1,className:"text-xs",children:[n.jsx("img",{src:Se.logo,alt:"",className:"size-4 shrink-0 object-contain"}),Se.name]},Se.id))})]})]}),ge.length>0&&n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Open in"}),n.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{id:"shell",name:"Shell"},...ge.length===1?ge:[]].map(Se=>n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:"radio",name:"quick-open-in",value:Se.id,checked:W===Se.id,onChange:()=>K(Se.id),className:"peer sr-only"}),n.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:[Se.id==="shell"?n.jsx(n2,{className:"size-5 shrink-0","aria-hidden":"true"}):n.jsx("img",{src:Se.logo,alt:"",className:"size-5 shrink-0 object-contain"}),n.jsx("span",{className:"min-w-0 flex-1 font-medium",children:Se.name}),n.jsx("span",{"aria-hidden":"true",className:`flex size-3.5 shrink-0 items-center justify-center rounded-full border ${W===Se.id?"border-foreground":"border-muted-foreground/40"}`,children:W===Se.id&&n.jsx("span",{className:"size-1.5 rounded-full bg-foreground"})})]})]},Se.id))})]}),ge.map(Se=>{const Ye=JE(w,Se.id);return Ye.length?n.jsxs("div",{className:"grid gap-1.5",children:[n.jsxs(zn,{htmlFor:`quick-sign-in-${Se.id}`,className:"text-xs",children:[Se.name," API key"]}),n.jsxs(jp,{value:J[Se.id]||"",onValueChange:et=>z(it=>({...it,[Se.id]:et??""})),children:[n.jsx(Np,{id:`quick-sign-in-${Se.id}`,className:"w-full text-xs",children:n.jsx(Sp,{children:J[Se.id]||"None, I’ll use my subscription"})}),n.jsx(Cp,{align:"start",alignItemWithTrigger:!1,children:n.jsxs(O5,{children:[n.jsx(Zd,{value:"",className:"text-xs",children:"None, I’ll use my subscription"}),Ye.map(et=>n.jsx(Zd,{value:et.name,className:"text-xs",children:et.name},et.name))]})})]})]},Se.id):null}),n.jsx(sR,{agents:V,keyed:Xe,value:L,onChange:X})]}),n.jsxs(Io,{value:"template",className:"grid gap-4",children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"sandbox-image-template",className:"text-xs",children:"Environment"}),n.jsxs(jp,{value:D,onValueChange:Se=>_(Se??""),children:[n.jsx(Np,{id:"sandbox-image-template","aria-invalid":ke&&!Ae||void 0,className:"w-full text-xs",children:n.jsx(Sp,{children:D||"Choose a template"})}),n.jsx(Cp,{align:"start",alignItemWithTrigger:!1,children:n.jsx(O5,{children:T.map(Se=>n.jsx(Zd,{value:Se.name,className:"text-xs",children:Se.name},Se.name))})})]}),ke&&!Ae&&T.length>0&&n.jsx("p",{className:"text-[11px] text-destructive",children:"Choose a template to create a sandbox."}),!T.length&&n.jsx("p",{className:`text-[11px] ${ke?"text-destructive":"text-muted-foreground"}`,children:"No ready templates. Use Quick setup or create one in Templates."}),Ae&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:Fe?`Included tools: ${[...Fe.map(Se=>Se.name),...(Ae.recipe.customAgents??[]).map(Se=>Se.name),"Terminal"].join(", ")}`:"Installed tools are not reported by this template."})]}),n.jsx(sR,{agents:_e,value:L,onChange:X})]}),B==="template"&&n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium",children:"Providers"}),w.length?n.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map(Se=>{const Ye=H.includes(Se.name);return n.jsxs("button",{type:"button","aria-pressed":Ye,onClick:()=>G(et=>Ye?et.filter(it=>it!==Se.name):[...et,Se.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 ${Ye?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[n.jsx("span",{className:`size-1.5 rounded-full ${Ye?"bg-emerald-500":"bg-stone-300"}`,"aria-hidden":"true"}),n.jsx("span",{className:"font-mono",children:Se.name}),n.jsx("span",{className:"text-muted-foreground",children:Se.type})]},Se.name)})}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No providers"})]}),ee&&n.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:ee})]}),n.jsxs($n.aside,{initial:p?!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:[pe?n.jsx(sJ,{org:pe,value:je,onChange:Ie,invalid:ke&&!Qe,onAddPolicy:()=>F(Ki({appliesTo:{everyone:!1,groups:je,sandboxes:[]}})),onCreated:Se=>xe(Ye=>({...Ye,groups:[...Ye.groups,Se].sort((et,it)=>et.name.localeCompare(it.name)),members:{...Ye.members,[Se.id]:[]}}))}):n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:ee?"Groups unavailable. Reopen this dialog to retry.":"Loading groups…"}),(B==="quick"||rt&&(ve||_e.includes("aider")))&&n.jsxs("div",{className:"space-y-3",children:[B==="quick"&&!re&&n.jsx(dD,{localCatalog:ce,autoPrepare:!0,automaticAccess:!0,preparationContext:"sandbox",accessReview:k,onAccessReview:O,value:M,onChange:A}),rt&&ve&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:_e.includes("aider")?"Setup installation is unavailable for Aider. Choose another agent.":B==="quick"?"Choose an agent to use this Setup.":"Choose a template with a supported agent to use this Setup."}),rt&&!ve&&_e.includes("aider")&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Setup installation is unavailable for Aider."})]}),n.jsxs("div",{className:"grid min-w-0",children:[n.jsx(Kl,{title:"Add project files",summary:Be,children:n.jsxs("div",{className:"grid min-w-0 gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium",children:"Start with"}),n.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:ZZ.filter(Se=>!ye||Se.id!=="folder").map(Se=>n.jsx("button",{type:"button",onClick:()=>ne(Se.id),"aria-pressed":Y===Se.id,className:`flex-1 rounded px-2.5 py-1 text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${Y===Se.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:Se.label},Se.id))}),Y==="folder"&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{value:ae,onChange:Se=>ue(Se.target.value),className:"font-mono text-xs",placeholder:"~/code/my-project","aria-label":"Folder on this computer"}),(se==null?void 0:se.loading)&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Checking the folder…"}),(se==null?void 0:se.error)&&n.jsx("p",{className:"text-[11px] text-red-700",children:se.error}),(se==null?void 0:se.data)&&n.jsx(nJ,{plan:se.data,sandbox:S})]}),Y==="repo"&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{value:ie,onChange:Se=>oe(Se.target.value),className:"font-mono text-xs",placeholder:"https://github.com/org/repo","aria-label":"Git repository URL"}),n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[xt?n.jsxs(n.Fragment,{children:["Cloned into ",n.jsx("span",{className:"font-mono",children:xt})," once the sandbox starts. "]}):"An https:// URL. ","Public repositories only. Your access rules must allow Git connections to this host."]})]})]})}),ct.profiles.length>0&&n.jsx(Kl,{title:ct.profiles.some(Se=>Se.rule.startsWith("tool-"))?"Agent and tool connections":"Agent connections",summary:`${new Set(ct.profiles.flatMap(Se=>Se.endpoints.map(Ye=>`${Ye.host}:${Ye.ports.join(",")}`))).size} destinations`,children:n.jsx("div",{className:"max-h-52 divide-y overflow-y-auto",children:ct.profiles.map(Se=>n.jsxs("details",{className:"px-3 py-2",children:[n.jsxs("summary",{className:"cursor-pointer text-xs",children:[Se.name,n.jsxs("span",{className:"ml-2 text-[11px] text-muted-foreground",children:[Se.endpoints.length," destinations · ",Se.rule]})]}),n.jsx("ul",{className:"mt-2 space-y-1",children:Se.endpoints.map(Ye=>{var et,it;return n.jsxs("li",{className:"flex flex-wrap items-baseline justify-between gap-x-3 text-[11px]",children:[n.jsxs("span",{className:"break-all font-mono",children:[Ye.host,":",Ye.ports.join(",")]}),n.jsxs("span",{className:"text-muted-foreground",children:[Ye.tlsSkip?"TLS passthrough":(et=Ye.allow)!=null&&et.length?`${Ye.allow.map(lt=>lt.method).join(", ")} only`:Ye.access==="read-only"?"Read only":"Read & write",(it=Ye.deny)!=null&&it.length?` · ${Ye.deny.length} paths blocked`:""]})]},Ye.host)})}),Se.authentication&&n.jsx("p",{className:"mt-2 text-[11px]",children:Se.authentication}),n.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:"Allowed programs"}),n.jsx("ul",{className:"mt-1 space-y-1 break-all font-mono text-[10px] text-muted-foreground",children:Se.binaries.map(Ye=>n.jsx("li",{children:Ye},Ye))})]},Se.id))})})]})]})]})}),n.jsxs(Hr,{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:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsx(le,{type:"submit",disabled:(g==null?void 0:g.connected)===!1,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:"Create sandbox"})]})]})})})})}),n.jsx(Vw,{open:!!U,initial:U,onOpenChange:Se=>{Se||F(null)},groups:(pe==null?void 0:pe.groups)??[],sandboxes:(b??[]).map(Se=>Se.name),assignments:(pe==null?void 0:pe.assignments)??{},onGroupCreated:Se=>xe(Ye=>({...Ye,groups:[...Ye.groups,Se]})),onSaved:(Se,Ye)=>{var et;Ie(it=>[...new Set([...it,...Ye.appliesTo.groups])]),xe(it=>({...it,policies:[...it.policies.filter(lt=>lt.id!==Ye.id),Ye]})),(et=Se.failed)!=null&&et.length?He.error("Rule saved, but some sandboxes could not be updated."):He.success(`Saved ${Ye.name}`)}})]})}function sR({agents:e,keyed:t=[],value:r,onChange:a}){const i=Ww(e);return i.length?n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Connectors"}),n.jsx("div",{className:"grid gap-2",children:i.map(c=>n.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs has-disabled:cursor-default has-disabled:text-muted-foreground",children:[n.jsx($o,{disabled:t.includes(c),checked:r.includes(c)&&!t.includes(c),onCheckedChange:u=>a(u?[...r,c]:r.filter(f=>f!==c))}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Use my ",hf[c].connectors.name]}),t.includes(c)&&n.jsx("span",{className:"text-[11px]",children:"Subscription only"})]},c))})]}):null}function _x({count:e,rowHeight:t,overscan:r=8}){const[a,i]=x.useState(null),[c,u]=x.useState(0),[f,m]=x.useState(0);x.useLayoutEffect(()=>{if(!a)return;const b=()=>m(a.clientHeight);b();const v=new ResizeObserver(b);return v.observe(a),()=>v.disconnect()},[a]);const h=Math.max(0,Math.floor(c/t)-r),g=Math.ceil((f||600)/t)+r*2,p=Math.min(e,h+g);return{ref:i,onScroll:b=>u(b.currentTarget.scrollTop),start:h,end:p,paddingTop:h*t,totalHeight:e*t,scrollToTop:()=>{a==null||a.scrollTo({top:0}),u(0)}}}const rR=["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"],oR=new Set(["pastebin.com","ngrok.io","api.stripe.com"]);function oJ(e){let t=e>>>0;return()=>(t=t*1664525+1013904223>>>0)/2**32}const aJ=(e,t)=>t[Math.floor(e()*t.length)];function ED(e,t=Math.random,r=new Date().toISOString()){const a=e[Math.floor(t()**2.2*e.length)],i=t()<.08?aJ(t,[...oR]):rR[Math.floor(t()**1.8*(rR.length-3))],c=oR.has(i)?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:`${i}: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) -> ${i}:443 #${Math.floor(t()*1e9)}`,detail:`/usr/local/bin/claude(0) -> ${i}:443`}}function iJ(e,t=2e3){const r=oJ(11),a=Date.now(),i=new Map(e.map(c=>[c.name,c.phase]));return Array.from({length:t},(c,u)=>ED(e,r,new Date(a-u*1500).toISOString())).filter(c=>["ready","error"].includes(i.get(c.sandbox)))}function RD(e){const t=x.useMemo(()=>null,[]),[r,a]=x.useState(()=>t?iJ(t):[]);return x.useEffect(()=>{if(!t)return;const i=t.filter(u=>u.phase==="ready"),c=setInterval(()=>{const u=Array.from({length:1+Math.floor(Math.random()*6)},()=>ED(i));a(f=>[...u,...f].slice(0,2e3))},450);return()=>clearInterval(c)},[t]),t?{...e,sandboxes:t,events:r,demo:!0}:e}const aR=[],lJ={context:'["preview","default"]',gateway:"preview",workspace:"default",label:"Local",remote:!1,connected:!0},iR=40,cJ=["all","running","sleeping","provisioning","error","unknown"],Ys=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),gr=ht,lp=e=>JSON.stringify([Ys(e.location),e.name]),Li=e=>e.toLocaleString("en-US"),ay=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),lR=[{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"}],uJ=[{value:"1",label:"Last 24 hours"},{value:"7",label:"Last 7 days"},{value:"30",label:"Last 30 days"}],iy={type:[],phase:[],owner:[],image:[],createdAt:""},dJ=Object.fromEntries(Object.entries(nc).map(([e,t])=>[t.label,e])),AD=()=>n.jsx(OA,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),ly={type:e=>n.jsx(UA,{type:dJ[e.value]}),phase:e=>n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n.jsx("span",{"aria-hidden":"true",className:`size-1.5 shrink-0 rounded-full ${Gl[e.value].bar}`}),n.jsx("span",{className:"truncate",children:e.label})]}),image:e=>n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n.jsx(AD,{}),n.jsx("span",{className:"truncate font-mono text-[11px]",children:e.label})]})},cR={type:e=>e.type,phase:e=>Px(e.sandbox.phase),owner:e=>e.owner,image:e=>e.image},uR=Object.keys(nc);function fJ({onNavigate:e,allowRemote:t=!1,createRequest:r=0,onCreateRequestHandled:a}){const i=Pt(),c=js(),u=RD(oi()),f=vo(),{locations:m}=f,[h,g]=x.useState(null),p=gn(),[b,v]=x.useState(null),w=Ys(p)??b,[C,S]=x.useState(null),[N,E]=x.useState(!1),[T,R]=x.useState(null),M=t;x.useEffect(()=>{let ve=!0;return i.contextKey().then(Ue=>{ve&&v(JSON.stringify([i.target,Ue]))}).catch(()=>{}),()=>{ve=!1}},[i]);const A=m.find(ve=>Ys(ve)===w),k=(A!=null&&A.connected?A:null)??m.find(ve=>ve.target===i.target&&!ve.remote&&ve.connected)??m.find(ve=>ve.target===i.target&&ve.connected),O=m.find(ve=>Ys(ve)===Ys(C))??C??k,D=x.useSyncExternalStore(lo.subscribe,lo.getSnapshot),_=x.useMemo(()=>D.filter(ve=>ve.status==="created"&&!ve.reported).map(ve=>ve.sandbox),[D]),H=x.useMemo(()=>u.demo?(u.sandboxes??aR).map((ve,Ue)=>{const Qe=A??k??lJ,xt=uR[Ue%uR.length];return{...ve,location:xt===xp(Qe)?Qe:{...Qe,placement:xt,host:`${xt}-demo`}}}):f.sandboxes,[u.demo,u.sandboxes,A,k,f.sandboxes]),G=x.useMemo(()=>{const ve=new Set(H.map(lp));return[..._.filter(Ue=>!ve.has(lp(Ue))).map(Ue=>({...Ue,location:m.find(Qe=>Ys(Qe)===Ys(Ue.location))??Ue.location})),...H]},[H,_,m]),[B,P]=x.useState(""),[V,q]=x.useState(iy),W=(ve,Ue)=>q(Qe=>({...Qe,[ve]:Ue})),[K,J]=x.useState({key:"name",direction:"asc"}),z=x.useDeferredValue(B),[L,X]=x.useState(null),[ee,$]=x.useState(()=>new Set),[U,F]=x.useState(null),[Y,ne]=x.useState(!1),te=x.useRef(!1),[ye,ae]=x.useState([]),[ue,se]=x.useState(!!(c!=null&&c.createRequested));x.useEffect(()=>{c!=null&&c.createRequested&&(c.createRequested.location&&(S(c.createRequested.location),E(!0)),se(!0),c.requestCreate(!1))},[c==null?void 0:c.createRequested]);const[Q,ie]=x.useState(Date.now),oe=x.useRef(null);x.useEffect(()=>{const ve=setInterval(()=>ie(Date.now()),3e4),Ue=Ke=>{var Be;(Ke.metaKey||Ke.ctrlKey)&&Ke.key.toLowerCase()==="k"&&(Ke.preventDefault(),(Be=oe.current)==null||Be.focus())};window.addEventListener("keydown",Ue);const Qe=()=>{try{const Ke=sessionStorage.getItem(ql);if(sessionStorage.removeItem(ql),Ke){let Be;try{Be=JSON.parse(Ke)}catch{}R(Be&&typeof Be.name=="string"?{name:Be.name,context:Ys(Be.location)??(Be.context&&Be.target?JSON.stringify([Be.target,Be.context]):Be.context)}:{name:Ke})}}catch{}},xt=Ke=>{var jt;const Be=Ke.detail;typeof(Be==null?void 0:Be.name)=="string"&&(R({name:Be.name,context:((jt=Be.location)==null?void 0:jt.id)??(Be.context?JSON.stringify([Be.target??i.target,Be.context]):void 0)}),f.refresh())};return Qe(),window.addEventListener("openrod-sandbox-handoff",xt),window.addEventListener(ql,Qe),()=>{clearInterval(ve),window.removeEventListener("keydown",Ue),window.removeEventListener(ql,Qe),window.removeEventListener("openrod-sandbox-handoff",xt)}},[]),x.useEffect(()=>{const ve=(T==null?void 0:T.context)??w;if(!T||!ve||f.loading)return;const Ue=G.find(Qe=>Qe.name===T.name&&Ys(Qe.location)===ve);if(Ue!=null&&Ue.location.connected){X(Ue),R(null);try{sessionStorage.removeItem(ql)}catch{}}},[T,w,f.loading,G]);const pe=x.useRef(null);x.useEffect(()=>{const ve=D.filter(Qe=>Qe.status==="created");if(!pe.current){pe.current=new Set(ve.map(Qe=>Qe.id));return}const Ue=ve.filter(Qe=>!pe.current.has(Qe.id));Ue.length&&(Ue.forEach(Qe=>pe.current.add(Qe.id)),X(null),P(""),q(iy),J({key:"createdAt",direction:"desc"}),f.refresh())},[D]);const xe=x.useMemo(()=>NW(G),[G]),je=x.useMemo(()=>G.map(ve=>({sandbox:ve,owner:df(ve,c!=null&&c.connected?c.user:null),type:nc[xp(ve.location)].label,image:_p(ve.image,ve.imageTemplateName),search:[ve.name,ve.id,ve.image,ve.imageTemplateName,Dn(ve.location),nc[xp(ve.location)].label,df(ve,c!=null&&c.connected?c.user:null),...ve.providers??[]].join(" ").toLowerCase()})),[G,c==null?void 0:c.connected,c==null?void 0:c.user]),Ie=x.useMemo(()=>Object.fromEntries(Object.entries(cR).map(([ve,Ue])=>{const Qe=new Map;for(const Ke of je)Qe.set(Ue(Ke),(Qe.get(Ue(Ke))??0)+1);for(const Ke of V[ve])Qe.has(Ke)||Qe.set(Ke,0);const xt=[...Qe.keys()].sort(ve==="phase"?(Ke,Be)=>k1.indexOf(Ke)-k1.indexOf(Be):ay.compare);return[ve,xt.map(Ke=>({value:Ke,label:ve==="phase"?Gl[Ke].label:Ke,count:Qe.get(Ke)}))]})),[je,V]),ce=x.useMemo(()=>{const ve=z.trim().toLowerCase(),Ue=V.createdAt?Q-Number(V.createdAt)*864e5:null,Qe=je.filter(Ke=>Object.entries(cR).every(([Be,jt])=>!V[Be].length||V[Be].includes(jt(Ke)))&&(Ue===null||Date.parse(Ke.sandbox.createdAt)>=Ue)&&(!ve||Ke.search.includes(ve))),xt=Ke=>K.key==="owner"||K.key==="image"||K.key==="type"?Ke[K.key]:K.key==="startedAt"?Ke.sandbox.phase==="ready"?Ke.sandbox.startedAt:null:Ke.sandbox[K.key];return Qe.sort((Ke,Be)=>{const jt=xt(Ke),Ze=xt(Be);if(!jt&&Ze)return 1;if(jt&&!Ze)return-1;const Tt=ay.compare(jt??"",Ze??"");return(K.direction==="asc"?Tt:-Tt)||ay.compare(Ke.sandbox.name,Be.sandbox.name)})},[je,V,z,K,Q]);x.useEffect(()=>{const ve=new Set(G.filter(Ue=>{var Qe;return((Qe=Ue.location)==null?void 0:Qe.connected)&&!u.demo}).map(gr));$(Ue=>{const Qe=new Set([...Ue].filter(xt=>ve.has(xt)));return Qe.size===Ue.size?Ue:Qe})},[G,u.demo]);const Te=x.useMemo(()=>G.filter(ve=>{var Ue;return((Ue=ve.location)==null?void 0:Ue.connected)&&ee.has(gr(ve))}),[G,ee]),re=ce.filter(ve=>{var Ue;return((Ue=ve.sandbox.location)==null?void 0:Ue.connected)&&!u.demo}),fe=re.reduce((ve,Ue)=>ve+Number(ee.has(gr(Ue.sandbox))),0),Re=re.length>0&&fe===re.length,Oe=x.useCallback(ve=>{var Ue;(Ue=ve.location)!=null&&Ue.connected&&$(Qe=>{const xt=new Set(Qe),Ke=gr(ve);return xt.has(Ke)?xt.delete(Ke):xt.add(Ke),xt})},[]),ke=()=>$(ve=>{const Ue=new Set(ve);for(const{sandbox:Qe}of re)Re?Ue.delete(gr(Qe)):Ue.add(gr(Qe));return Ue});async function he(){if(te.current||u.demo||!(U!=null&&U.length))return;te.current=!0,ne(!0),ae([]);const ve=new Set,Ue=[];let Qe=0;const xt=async()=>{for(;Qe<U.length;){const Ke=U[Qe++];try{const Be=m.find(jt=>Ys(jt)===Ys(Ke.location));if(!(Be!=null&&Be.connected))throw new Error("Location is disconnected. Reconnect before deleting.");await lr(c!=null&&c.localViewer?Be.target??"local":i.target,i.signal,Be.context).lifecycle(Ke.name,"delete"),ve.add(gr(Ke))}catch(Be){Ue.push({key:gr(Ke),name:Ke.name,location:Ke.location,message:Be.message})}}};try{await Promise.all(Array.from({length:Math.min(4,U.length)},xt)),$(Ke=>new Set([...Ke].filter(Be=>!ve.has(Be)))),ae(Ue),ve.size&&He.success(`Deletion requested for ${Li(ve.size)} ${ve.size===1?"sandbox":"sandboxes"}`),Ue.length&&He.error(`${Li(Ue.length)} ${Ue.length===1?"sandbox could":"sandboxes could"} not be deleted. Review the errors and retry.`),f.refresh()}finally{te.current=!1,ne(!1),F(null)}}const Ae=_x({count:ce.length,rowHeight:iR});x.useEffect(()=>{Ae.scrollToTop()},[z,V,K]);const ge=x.useMemo(()=>yZ(G,30,Q),[G,Q]),Pe=()=>{P(""),q(iy)},Fe=B||Object.values(V).some(ve=>ve.length),_e=G.length===0&&f.loading&&!u.demo,Xe=G.length===0&&f.error,Je=L&&(G.find(ve=>gr(ve)===gr(L))??(L.id==null?G.find(ve=>lp(ve)===lp(L)):null)??L),ct=Je&&(m.find(ve=>Ys(ve)===Ys(Je.location))??Je.location),At=Je?{...u,sandboxes:[Je],events:Ys(ct)===w?u.events:aR,overview:Ys(ct)===w?u.overview:{gateway:{name:ct==null?void 0:ct.gateway,workspace:ct==null?void 0:ct.workspace,remote:ct==null?void 0:ct.remote}},refresh:f.refresh}:null,rt=()=>{E(!1),S(k??null),se(!0)};return x.useEffect(()=>{r&&(rt(),a==null||a())},[r]),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex h-[calc(100svh-3.5rem)] min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 pt-4 pb-3 sm:px-6",children:[n.jsx("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Sandbox status",children:cJ.filter(ve=>["all","running","sleeping"].includes(ve)||xe.status[ve]>0||V.phase.includes(ve)).map(ve=>n.jsxs("button",{"aria-pressed":ve==="all"?!V.phase.length:V.phase.length===1&&V.phase[0]===ve,onClick:()=>W("phase",ve==="all"?[]:[ve]),className:`rounded-md px-3 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${(ve==="all"?!V.phase.length:V.phase.length===1&&V.phase[0]===ve)?"bg-accent/70":"hover:bg-muted/60"}`,children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[ve!=="all"&&n.jsx("span",{"aria-hidden":"true",className:`size-1.5 rounded-full ${Gl[ve].bar}`}),ve==="all"?"Sandboxes":Gl[ve].label]}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Af,{value:ve==="all"?xe.total:xe.status[ve]})})]},ve))}),n.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:n.jsx(jZ,{points:ge,height:34,title:"Boxes · 30d"})})]}),n.jsx("div",{className:"flex h-[3px] shrink-0 overflow-hidden",role:"img","aria-label":Object.entries(xe.status).map(([ve,Ue])=>`${Ue} ${Gl[ve].label}`).join(", "),children:Object.entries(xe.status).map(([ve,Ue])=>Ue>0&&n.jsx("span",{className:Gl[ve].strip,style:{width:`${Ue/xe.total*100}%`}},ve))}),f.error&&G.length>0&&n.jsxs(Qa,{id:"sandboxes:inventory-error",tone:"warning",title:"Inventory refresh failed",actions:n.jsx(le,{size:"xs",variant:"outline",onClick:f.refresh,children:"Retry"}),children:["Showing the last reading. ",f.error]}),u.demo&&n.jsx("p",{className:"border-b border-border px-6 py-2 text-xs text-amber-700",children:"Preview · synthetic sandbox data"}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 sm:px-6",children:[n.jsx(yo,{ref:oe,value:B,onValueChange:P,placeholder:"Search name, owner, image…","aria-label":"Search sandboxes",className:"mr-auto w-full sm:w-64"}),Fe&&n.jsxs(le,{variant:"ghost",size:"sm",onClick:Pe,children:[n.jsx(In,{className:"size-3"}),"Clear"]}),m.filter(ve=>ve.remote&&!ve.connected&&ve.host).map(ve=>n.jsxs(le,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 rounded-full px-2 text-[11px] text-muted-foreground",title:`Reconnect to ${ve.host}`,onClick:()=>g(ve.host),children:[n.jsx("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-stone-400"}),ve.host," · Offline"]},Ys(ve))),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh sandboxes",onClick:f.refresh,children:n.jsx(rl,{className:"size-3.5"})}),n.jsxs(le,{size:"sm",disabled:!k&&!M,onClick:rt,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(vs,{className:"size-3.5"}),"New sandbox"]})]}),Te.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border bg-accent/30 px-6 py-2",children:[n.jsxs("span",{role:"status",className:"mr-auto text-xs",children:[n.jsx("strong",{children:Li(Te.length)})," selected",Te.length>fe&&n.jsxs("span",{className:"text-muted-foreground",children:[" · ",Li(Te.length-fe)," outside current filters"]})]}),n.jsx(le,{variant:"ghost",size:"sm",disabled:Y,onClick:()=>$(new Set),children:"Clear selection"}),n.jsxs(le,{variant:"destructive",size:"sm",disabled:Y||u.demo,title:u.demo?"Deletion is unavailable for synthetic preview data":void 0,onClick:()=>F([...Te]),children:[n.jsx(ts,{className:"size-3.5"}),Y?"Deleting…":"Delete selected"]})]}),ye.length>0&&n.jsxs(Qa,{id:"sandboxes:delete-errors",tone:"error",title:"Some sandboxes could not be deleted",onDismiss:()=>ae([]),dismissLabel:"Dismiss deletion errors",children:[n.jsx("p",{children:"Failed boxes remain selected for retry."}),n.jsx("ul",{className:"mt-1 max-h-28 overflow-auto",children:ye.map(ve=>n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:ve.name})," ",n.jsx(ga,{location:ve.location}),": ",ve.message]},ve.key))})]}),n.jsx("div",{ref:Ae.ref,onScroll:Ae.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:_e?n.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Loading sandboxes…"}):Xe?n.jsxs("div",{role:"alert",className:"py-16 text-center",children:[n.jsx("p",{children:"Inventory unavailable"}),n.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:f.error}),n.jsx(le,{variant:"outline",onClick:f.refresh,className:"mt-4",children:"Retry"})]}):ce.length?n.jsxs("table",{"aria-label":"Sandboxes","aria-rowcount":ce.length+1,className:"w-full min-w-[1040px] table-fixed border-separate border-spacing-0 text-xs",children:[n.jsxs("colgroup",{children:[n.jsx("col",{style:{width:48}}),lR.map(ve=>n.jsx("col",{style:{width:ve.width}},ve.id))]}),n.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:n.jsxs("tr",{"aria-rowindex":1,children:[n.jsx("th",{scope:"col",className:"h-9 border-b border-border px-4 sm:pl-6",children:n.jsx(MD,{label:"Select all matching sandboxes",checked:Re,mixed:fe>0&&!Re,disabled:Y||!re.length,onChange:ke})}),lR.map(ve=>n.jsx("th",{scope:"col","aria-sort":K.key===ve.id?K.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:n.jsxs("div",{className:"flex h-9 items-center gap-1",children:[n.jsxs("button",{onClick:()=>J(Ue=>({key:ve.id,direction:Ue.key===ve.id&&Ue.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:[n.jsx("span",{className:"truncate",children:ve.label}),K.key===ve.id&&(K.direction==="asc"?n.jsx(_f,{className:"size-3 shrink-0"}):n.jsx(Pf,{className:"size-3 shrink-0"}))]}),n.jsx(mJ,{column:ve,sort:K,onSort:Ue=>J({key:ve.id,direction:Ue}),values:Ie[ve.id],value:V[ve.id],onFilter:Ue=>W(ve.id,Ue)})]})},ve.id))]})}),n.jsxs("tbody",{children:[Ae.paddingTop>0&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:8,style:{height:Ae.paddingTop,padding:0,border:0}})}),ce.slice(Ae.start,Ae.end).map((ve,Ue)=>{var Qe;return n.jsx(hJ,{row:ve,now:Q,index:Ae.start+Ue+2,onOpen:X,selected:ee.has(gr(ve.sandbox)),onSelect:Oe,disabled:Y||u.demo||!((Qe=ve.sandbox.location)!=null&&Qe.connected)},gr(ve.sandbox))}),Ae.end<ce.length&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:8,style:{height:(ce.length-Ae.end)*iR,padding:0,border:0}})})]})]}):n.jsxs("div",{className:"py-20 text-center",children:[n.jsx(hc,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),n.jsx("p",{className:"text-sm",children:G.length?"No matching sandboxes":"No sandboxes yet"}),n.jsx(le,{variant:"outline",disabled:!G.length&&!k&&!M,className:"mt-4",onClick:()=>G.length?Pe():rt(),children:G.length?"Clear filters":"Create sandbox"})]})}),n.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:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-medium text-foreground",children:Li(ce.length)}),Fe?` of ${Li(G.length)}`:""," sandboxes"]}),n.jsx("span",{className:"hidden sm:inline",children:"Click a row to inspect · ⌘K to search"})]})]}),Je&&(ct==null?void 0:ct.connected)&&n.jsx(Zn,{location:ct,children:n.jsx(UZ,{name:Je.name,sandbox:Je,liveData:At,onClose:()=>X(null),onNavigate:e,onChanged:f.refresh})},gr(Je)),n.jsx(Fr,{open:U!==null,onOpenChange:ve=>{!ve&&!te.current&&F(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",Li((U==null?void 0:U.length)??0)," ",(U==null?void 0:U.length)===1?"sandbox":"sandboxes","?"]}),n.jsx(Xr,{children:"This permanently deletes the selected sandboxes and their data. This cannot be undone."})]}),n.jsx("ul",{"aria-label":"Sandboxes to delete",className:"max-h-48 overflow-auto rounded-md border border-border p-3 text-xs",children:U==null?void 0:U.map(ve=>n.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[ve.name,n.jsx(ga,{location:ve.location})]},gr(ve)))}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:Y,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:Y||!(U!=null&&U.length),onClick:he,children:Y?"Deleting…":"Delete sandboxes"})]})]})}),n.jsx(tn,{open:!!h,onOpenChange:ve=>{ve||g(null)},children:n.jsxs(nn,{className:"sm:max-w-3xl","aria-describedby":void 0,children:[n.jsx(sn,{children:n.jsxs(Qt,{children:["Connect to ",h]})}),h&&n.jsx(zw,{initialHost:h,onConnected:()=>{g(null),f.refresh()},onBack:()=>g(null)},h)]})}),n.jsx(Zn,{location:O,children:n.jsx(TD,{initialLocationConfirmed:N,open:ue,onOpenChange:se,locations:m,location:O,onLocationChange:S,onRefreshLocations:f.refresh,allowRemote:M})})]})}const hJ=x.memo(function({row:t,now:r,index:a,onOpen:i,selected:c,onSelect:u,disabled:f}){var w;const{sandbox:m,owner:h,image:g}=t,p="h-10 border-b border-border/60 px-4 py-0 align-middle text-muted-foreground",b=!((w=m.location)!=null&&w.connected),v=`${m.name} at ${Dn(m.location)}`;return n.jsxs("tr",{"aria-rowindex":a,"aria-disabled":b||void 0,onClick:()=>{b||i(m)},className:`group transition-colors ${b?"opacity-60":"cursor-pointer hover:bg-muted/60 focus-within:bg-muted/60"} ${c?"bg-accent/40":"bg-card"}`,children:[n.jsx("td",{className:`${p} sm:pl-6`,onClick:C=>C.stopPropagation(),children:n.jsx(MD,{label:`Select ${v}`,checked:c,disabled:f,onChange:()=>u(m)})}),n.jsx("td",{className:`${p} pl-6`,children:n.jsxs("button",{disabled:b,"aria-haspopup":"dialog","aria-label":`Open ${v}`,onClick:C=>{C.stopPropagation(),b||i(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:[n.jsx(hc,{"aria-hidden":"true",strokeWidth:1.4,className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate font-medium text-foreground",title:m.name,children:m.name}),n.jsx(Zi,{className:"ml-auto size-3 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"})]})}),n.jsx("td",{className:p,children:n.jsx(Hs,{location:m.location})}),n.jsx("td",{className:p,children:n.jsxs("span",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[n.jsx("span",{className:`size-1.5 shrink-0 rounded-full ${Za(m.phase).bar}`}),Cg[m.phase]??"Unknown"]})}),n.jsx("td",{className:p,children:n.jsx("span",{className:"block truncate",title:h,children:h})}),n.jsx("td",{className:p,children:n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",title:m.image||g,children:[n.jsx(AD,{}),n.jsx("span",{className:"truncate font-mono text-[11px]",children:g})]})}),n.jsx("td",{className:p,children:n.jsx("span",{className:"block truncate font-mono text-[11px]",title:"Uptime requires a reported start time",children:CW(m,r)})}),n.jsx("td",{className:p,children:n.jsxs("span",{className:"block truncate tabular-nums",title:m.createdAt||"Not reported",children:[F4(m.createdAt,r),m.createdAt?" ago":""]})})]})});function MD({label:e,checked:t,mixed:r=!1,disabled:a,onChange:i}){const c=x.useRef(null);return x.useEffect(()=>{c.current&&(c.current.indeterminate=r)},[r]),n.jsx("input",{ref:c,type:"checkbox","aria-label":e,checked:t,disabled:a,onChange:i,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 mJ({column:e,sort:t,onSort:r,values:a,value:i,onFilter:c}){const u=e.filter==="values"?i.length>0:e.filter==="recent"?!!i:!1,f=t.key===e.id?t.direction:null,m=h=>c(i.includes(h)?i.filter(g=>g!==h):[...i,h]);return n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.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:n.jsx(a8,{className:"size-3.5 shrink-0"})}),n.jsxs(qi,{align:"start",className:"w-56",children:[n.jsxs(Ip,{children:[n.jsxs(Rs,{className:"text-xs",onClick:()=>r("asc"),children:[n.jsx(_f,{className:"size-3.5"}),"Sort ascending",f==="asc"&&n.jsx(Yn,{className:"ml-auto size-3.5"})]}),n.jsxs(Rs,{className:"text-xs",onClick:()=>r("desc"),children:[n.jsx(Pf,{className:"size-3.5"}),"Sort descending",f==="desc"&&n.jsx(Yn,{className:"ml-auto size-3.5"})]})]}),e.filter==="values"&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Ip,{children:[n.jsx(C1,{className:"text-[11px]",children:"Show only"}),n.jsx("div",{className:"max-h-64 overflow-y-auto",children:a.map(h=>{var g;return n.jsxs(Bw,{checked:i.includes(h.value),onCheckedChange:()=>m(h.value),closeOnClick:!1,className:"text-xs",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:((g=ly[e.id])==null?void 0:g.call(ly,h))??h.label}),n.jsx("span",{className:"ml-2 font-mono text-[10px] tabular-nums text-muted-foreground",children:Li(h.count)})]},h.value)})})]})]}),e.filter==="recent"&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Ip,{children:[n.jsx(C1,{className:"text-[11px]",children:"Created"}),n.jsxs(BX,{value:i,onValueChange:c,children:[n.jsx(pE,{value:"",className:"text-xs",children:"Any time"}),uJ.map(h=>n.jsx(pE,{value:h.value,className:"text-xs",children:h.label},h.value))]})]})]}),u&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Rs,{className:"text-xs",onClick:()=>c(e.filter==="values"?[]:""),children:[n.jsx(In,{className:"size-3.5"}),"Clear filter"]})]})]})]})}const pJ=new Set(["time","sandbox","scope","sandboxId","agent","category","severity","logLevel","direction","verdict","outcome","process","action","destination","policy","session","correlation","why"]),I1=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];)r++;return r<e.length&&r<t.length?e.codePointAt(r)-t.codePointAt(r):e.length-t.length},gJ=e=>typeof e=="boolean"?Number(e):typeof e=="number"?Number.isFinite(e)?e:null:e==null?null:typeof e=="object"?JSON.stringify(e):String(e),dR=e=>e===null?0:typeof e=="number"?1:2,xJ=(e,t)=>dR(e)-dR(t)||(typeof e=="number"?e-t:typeof e=="string"?I1(e,t):0),bJ=e=>{const t=String(e??"").replace(/[a-z]+/g,r=>r.toUpperCase());return Object.hasOwn(jg,t)?jg[t]:-1};function vJ(e,t){const r=pJ.has(t==null?void 0:t.key)?t.key:"time",a=(t==null?void 0:t.direction)==="asc"?1:-1,i=c=>r==="time"?Number.isFinite(c.timestamp)?c.timestamp:0:r==="severity"?bJ(c.values.severity):gJ(c.values[r]);return e.map(c=>[i(c),c]).sort(([c,u],[f,m])=>a*xJ(c,f)||I1(String(u.event.originalId??u.event.id??""),String(m.event.originalId??m.event.id??""))||I1(u.key,m.key)).map(([,c])=>c)}function yJ(e,t,r){const a=new Map,i=new Map;let c=0;return{...e,async activity(u={}){const{offset:f=0,limit:m=50,snapshot:h={},exportAll:g,...p}=u,b=p.now??Date.now(),{now:v,...w}=p,C=JSON.stringify(w),S=t(),N=[],E=await Promise.all(S.map(async(A,k)=>{const O=A.id??A.context,D=`${O}:${C}`,_=g?null:a.get(D);if(!A.connected)return N[k]={label:Dn(A),offline:!0},_?{..._,total:_.events.length,events:_.events.map(H=>({...H,location:A}))}:null;try{const H=[];let G,B=0,P=h==null?void 0:h[O];const V=g?1/0:f+m;do G=await r(A).activity({...p,now:b,offset:B,limit:Math.min(1e3,V-B),...P!=null?{snapshot:P}:{}}),P=G.snapshot,H.push(...G.events.map(W=>({...W,originalId:W.id,id:ht({id:W.id,location:A}),location:A}))),B+=G.events.length;while(B<V&&B<G.total&&G.events.length);const q={...G,events:H,identity:O,snapshot:P};return g||a.set(D,q),q}catch(H){return N[k]={label:Dn(A),error:H.message},_?{..._,total:_.events.length,events:_.events.map(G=>({...G,location:{...A,connected:!1}}))}:{error:H}}})),T=E.filter(A=>A&&!A.error);if(!T.length&&E.some(A=>A==null?void 0:A.error))throw E.find(A=>A==null?void 0:A.error).error;const R=vJ(N1(T.flatMap(A=>A.events).map(Dw),{...p,now:b,sort:{key:"time"}}),p.sort).map(A=>A.event),M=T.reduce((A,k)=>A+k.total,0);return{events:g?R:R.slice(f,f+m),total:M,now:b,snapshot:Object.fromEntries(T.map(A=>[A.identity,A.snapshot])),sandboxes:[...new Set(T.flatMap(A=>A.sandboxes??[]))],agents:[...new Set(T.flatMap(A=>A.agents??[]))],nextOffset:f+m<M?f+m:null,unavailable:N.filter(Boolean)}},async previewActivityDeletion({mode:u,ids:f=[],query:m}){const g=t().filter(v=>u!=="selected"||f.some(w=>{try{return JSON.parse(w)[0][0]===(v.target??"local")&&JSON.parse(w)[0][1]===v.context}catch{return!1}}));if(u==="selected"&&g.some(v=>!v.connected))throw new Error("Reconnect the source of the selected logs before deleting them.");const p=[];for(const v of g.filter(w=>w.connected)){const w=f.filter(S=>{try{const[N]=JSON.parse(S);return N[0]===(v.target??"local")&&N[1]===v.context}catch{return!1}}).map(S=>JSON.parse(S)[1]),C=await r(v).previewActivityDeletion({mode:u,...u==="selected"?{ids:w}:{},query:m});p.push({location:v,plan:C})}const b=`combined:${++c}`;return i.set(b,{entries:p,deleted:0}),{token:b,mode:u,count:p.reduce((v,w)=>v+w.plan.count,0),expiresAt:p.length?Math.min(...p.map(v=>v.plan.expiresAt)):Date.now(),sources:p.map(v=>({label:Dn(v.location),count:v.plan.count})),skipped:g.filter(v=>!v.connected).map(Dn)}},async deleteActivity(u){const f=i.get(u);if(!f)throw new Error("Review the log deletion again.");for(;f.entries.length;){const m=f.entries[0],h=await r(m.location).deleteActivity(m.plan.token);f.deleted+=h.deleted,f.entries.shift()}return i.delete(u),{deleted:f.deleted}}}}const cy=()=>({name:"",url:"",format:"ocsf",auth:"none",token:"",sandboxes:"",category:"",verdict:""}),cp="h-9 w-full rounded-md border border-border bg-card px-2 text-xs",uy=e=>e?new Date(e).toLocaleString():"Never";function fR(){const e=Pt(),[t,r]=x.useState([]),[a,i]=x.useState(cy),[c,u]=x.useState(!1),[f,m]=x.useState(null),[h,g]=x.useState(null),[p,b]=x.useState(null),[v,w]=x.useState(!1),C=x.useCallback(async()=>{try{r(await e.activityDestinations()),b(null),w(!0)}catch(T){b(T.message)}},[e]);x.useEffect(()=>{C();const T=setInterval(C,5e3);return()=>clearInterval(T)},[C]);const S=T=>({value:a[T],onChange:R=>i(M=>({...M,[T]:R.target.value}))});async function N(T,R){g(T);try{const M=await e.activityDestinationAction(T,R);R==="test"&&He.success(`Test accepted · HTTP ${M.status}`),await C(),m(null)}catch(M){He.error(M.message),await C()}finally{g(null)}}async function E(T){T.preventDefault(),g("new");try{await e.createActivityDestination({name:a.name,url:a.url,format:a.format,auth:a.auth,token:a.token,filters:{sandboxes:a.sandboxes.split(",").map(R=>R.trim()).filter(Boolean),categories:a.category?[a.category]:[],verdicts:a.verdict?[a.verdict]:[]}}),i(cy()),u(!1),await C(),He.success("Webhook saved. Test it, then enable forwarding.")}catch(R){He.error(R.message)}finally{g(null)}}return n.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-5",children:[n.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Webhooks start paused. Test the connection, then enable forwarding."}),p&&n.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-xs",children:[p,n.jsx("button",{className:"ml-2 underline",onClick:C,children:"Retry"})]}),!v&&!p&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading webhooks…"}),t.map(T=>n.jsxs("section",{className:"space-y-3 rounded-lg border border-border p-4",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("h3",{className:"truncate text-sm font-medium",children:T.name}),n.jsx("span",{className:`text-xs ${T.error?"text-amber-700":"text-muted-foreground"}`,children:T.enabled?T.error?"Retrying":"Enabled":T.error?"Needs attention":"Paused"})]}),n.jsx("p",{className:"break-all font-mono text-[11px] text-muted-foreground",children:T.url}),n.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[T.delivered.toLocaleString()," delivered · ",T.backlog.toLocaleString()," pending"]}),n.jsxs("details",{className:"text-xs",children:[n.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Delivery details"}),n.jsxs("div",{className:"mt-3 space-y-3",children:[n.jsxs("p",{className:"text-xs text-muted-foreground",children:[T.format==="ocsf"?"OCSF JSON":"Console JSON"," · ",T.auth==="none"?"No authentication":T.auth==="bearer"?"Bearer token":"API key"]}),n.jsxs("p",{className:"text-xs",children:[T.filters.sandboxes.join(", ")||"All sandboxes"," · ",T.filters.categories.join(", ")||"All event types"," · ",T.filters.verdicts.join(", ")||"All decisions"]}),n.jsxs("dl",{className:"grid grid-cols-3 gap-3 text-xs",children:[n.jsxs("div",{children:[n.jsx("dt",{className:"text-muted-foreground",children:"Delivered"}),n.jsx("dd",{className:"mt-1",children:T.delivered.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx("dt",{className:"text-muted-foreground",children:"Pending"}),n.jsx("dd",{className:"mt-1",children:T.backlog.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx("dt",{className:"text-muted-foreground",children:"Filtered out"}),n.jsx("dd",{className:"mt-1",children:T.skipped.toLocaleString()})]})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Last delivery: ",uy(T.lastDeliveredAt),T.lastStatus?` · HTTP ${T.lastStatus}`:""]}),T.lastTest&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Test: ",T.lastTest.ok?`Accepted · HTTP ${T.lastTest.status}`:T.lastTest.error," · ",uy(T.lastTest.at)]})]})]}),T.error&&n.jsxs("p",{role:"status",className:"text-xs text-amber-700",children:[T.error," · Attempt ",T.attempts,"/8",T.enabled?` · Next retry ${uy(T.nextAttempt)}`:" · Forwarding paused; queued events retained"]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx(le,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>N(T.id,"test"),children:"Send test"}),n.jsx(le,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>N(T.id,T.enabled?"pause":"resume"),children:T.enabled?"Pause":"Enable forwarding"}),T.error&&n.jsx(le,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>N(T.id,"retry"),children:"Retry now"}),n.jsx(le,{size:"xs",variant:"ghost",disabled:!!h,onClick:()=>m(T.id),children:"Remove"})]}),f===T.id&&n.jsxs("div",{className:"space-y-2 border-t border-border pt-3 text-xs",children:[n.jsx("p",{children:"Remove this webhook and its delivery position? Activity history will remain."}),n.jsx(le,{size:"xs",variant:"destructive",disabled:!!h,onClick:()=>N(T.id,"remove"),children:"Remove webhook"}),n.jsx(le,{size:"xs",variant:"ghost",onClick:()=>m(null),children:"Cancel"})]})]},T.id)),v&&!t.length&&!c&&n.jsxs("div",{className:"rounded-lg border border-dashed border-border p-6 text-center",children:[n.jsx("p",{className:"text-sm",children:"No webhooks connected"}),n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Send activity to your monitoring tools."})]}),c?n.jsxs("form",{onSubmit:E,className:"space-y-4 rounded-lg border border-border p-4",children:[n.jsx("h3",{className:"text-sm font-medium",children:"New webhook"}),n.jsxs("label",{className:"block space-y-1 text-xs",children:[n.jsx("span",{children:"Name"}),n.jsx(Ot,{required:!0,maxLength:80,placeholder:"Security monitoring",...S("name")})]}),n.jsxs("label",{className:"block space-y-1 text-xs",children:[n.jsx("span",{children:"HTTPS endpoint"}),n.jsx(Ot,{required:!0,type:"url",placeholder:"https://logs.example.com/events",...S("url")})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use a public HTTPS endpoint that accepts JSON."}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsxs("label",{className:"space-y-1 text-xs",children:[n.jsx("span",{children:"Event format"}),n.jsxs(pn,{className:cp,...S("format"),children:[n.jsx("option",{value:"ocsf",children:"OCSF JSON"}),n.jsx("option",{value:"json",children:"Console JSON"})]})]}),n.jsxs("label",{className:"space-y-1 text-xs",children:[n.jsx("span",{children:"Authentication"}),n.jsxs(pn,{className:cp,...S("auth"),children:[n.jsx("option",{value:"none",children:"None"}),n.jsx("option",{value:"bearer",children:"Bearer token"}),n.jsx("option",{value:"api-key",children:"X-API-Key"})]})]})]}),a.auth!=="none"&&n.jsxs("label",{className:"block space-y-1 text-xs",children:[n.jsx("span",{children:a.auth==="bearer"?"Bearer token":"API key"}),n.jsx(Ot,{required:!0,type:"password",autoComplete:"new-password",...S("token")})]}),n.jsxs("details",{className:"rounded-md border border-border p-3",children:[n.jsxs("summary",{className:"cursor-pointer text-xs font-medium",children:["Event filters ",n.jsxs("span",{className:"font-normal text-muted-foreground",children:["· ",a.sandboxes||a.category||a.verdict?"Custom":"All events"]})]}),n.jsxs("div",{className:"mt-3 space-y-3",children:[n.jsxs("label",{className:"block space-y-1 text-xs",children:[n.jsx("span",{children:"Sandboxes"}),n.jsx(Ot,{placeholder:"All sandboxes, or comma-separated names",...S("sandboxes")})]}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsxs("label",{className:"space-y-1 text-xs",children:[n.jsx("span",{children:"Event type"}),n.jsxs(pn,{className:cp,...S("category"),children:[n.jsx("option",{value:"",children:"All event types"}),Object.entries({NET:"Network",HTTP:"HTTP",SSH:"Session",AUTH:"Authentication",PROC:"Process",FILE:"File",CONFIG:"Configuration",FINDING:"Finding",EVENT:"Event"}).map(([T,R])=>n.jsx("option",{value:T,children:R},T))]})]}),n.jsxs("label",{className:"space-y-1 text-xs",children:[n.jsx("span",{children:"Decision"}),n.jsxs(pn,{className:cp,...S("verdict"),children:[n.jsx("option",{value:"",children:"All decisions"}),n.jsx("option",{value:"allowed",children:"Allowed"}),n.jsx("option",{value:"denied",children:"Denied"})]})]})]})]})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Forwarding includes original log data. You can enable it after saving."}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(le,{type:"submit",size:"sm",disabled:!!h,children:"Save paused"}),n.jsx(le,{type:"button",size:"sm",variant:"ghost",onClick:()=>{u(!1),i(cy())},children:"Cancel"})]})]}):n.jsx(le,{size:"sm",variant:"outline",onClick:()=>u(!0),children:"Add webhook"}),n.jsxs("details",{className:"border-t border-border pt-4 text-[11px] text-muted-foreground",children:[n.jsx("summary",{className:"cursor-pointer text-xs hover:text-foreground",children:"Integration details"}),n.jsxs("div",{className:"mt-3 space-y-3 leading-relaxed",children:[n.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."}),n.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."}),n.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."}),n.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 OD="1.4.0";function hR(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,i=e.action||e.method;return{category_uid:0,class_uid:0,activity_id:i?99:0,type_uid:i?99:0,...i?{activity_name:i}:{},severity_id:a,time:Number.isFinite(t)?t:r,metadata:{version:OD,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 wJ(e,t="json",r){if(!Array.isArray(r))return t==="ocsf"?hR(e):e;const a=Dw(e).values,i=Object.fromEntries(r.filter(u=>Object.hasOwn(a,u)).map(u=>[u,a[u]]));if(t!=="ocsf")return i;const c=hR(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:OD,product:c.metadata.product},unmapped:{openshell:i,time_basis:c.unmapped.time_basis}}}function jJ(e,t,r="json"){const a=e.map(i=>wJ(i,r,t==null?void 0:t.columns));return r==="ocsf"?a:{exportedAt:new Date().toISOString(),context:t,events:a}}function SJ(e,{paused:t,demo:r,activityRevision:a}){const i=Pt(),c=x.useRef(t);c.current=t;const u=JSON.stringify(e),[f,m]=x.useState({events:[],total:0,nextOffset:null}),[h,g]=x.useState(0),[p,b]=x.useState(null),[v,w]=x.useState(!1),[C,S]=x.useReducer(R=>R+1,0),N=x.useRef(0),E=x.useRef(0);return x.useEffect(()=>{const R=++N.current;if(r)return;let M=!0;const A=async(O=!1)=>{const D=++E.current;w(!0);try{const _=await i.activity(JSON.parse(u));M&&N.current===R&&D===E.current&&(!O||!c.current)&&(m(_),b(null))}catch(_){M&&D===E.current&&b(_.message)}finally{M&&D===E.current&&w(!1)}};g(0),m({events:[],total:0,nextOffset:null}),A();const k=setInterval(()=>{c.current||A(!0)},5e3);return()=>{M=!1,clearInterval(k)}},[u,r,C,a,i]),{...f,loading:v,error:p,page:h,goToPage:async R=>{if(v||R<0||R>=Math.ceil(f.total/e.limit))return;const M=N.current,A=++E.current;w(!0);try{const k=await i.activity({...JSON.parse(u),snapshot:f.snapshot,offset:R*e.limit,now:f.now});M===N.current&&A===E.current&&(m(k),g(R),b(null))}catch(k){M===N.current&&A===E.current&&b(k.message)}finally{M===N.current&&A===E.current&&w(!1)}},refresh:S}}const Vl=50,up=[{id:"time",label:"Time",width:150},{id:"severity",label:"Security severity",width:150},{id:"logLevel",label:"Log level",width:110},{id:"source",label:"Source",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}],NJ=Object.fromEntries(Rx.map(e=>[e.name,{name:e.name,logo:`/logos/agents/${e.logo}.svg`}])),dp={all:"Available history",15:"Last 15 minutes",60:"Last hour",1440:"Last 24 hours",custom:"Custom range"},xr="h-8 rounded-md border border-border bg-card px-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",CJ=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"}):"-",mR=e=>new Intl.ListFormat("en",{type:"conjunction"}).format(e),pR=e=>e.offline?`${e.label} is offline`:`Could not load logs from ${e.label}`;function dy({options:e,selected:t,onChange:r,label:a}){const[i,c]=x.useState(""),u=x.useDeferredValue(i),f=x.useMemo(()=>e.filter(g=>g.toLowerCase().includes(u.toLowerCase())),[e,u]),m=_x({count:f.length,rowHeight:32});x.useEffect(()=>{m.scrollToTop()},[u]);const h=new Set(t);return n.jsxs(n.Fragment,{children:[n.jsx(yo,{"aria-label":`Search ${a}`,placeholder:`Search ${a.toLowerCase()}…`,value:i,onValueChange:c}),n.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[n.jsxs("span",{children:[t.length.toLocaleString()," selected · ",f.length.toLocaleString()," matches"]}),n.jsx("button",{onClick:()=>r([]),className:"underline",children:"Clear"})]}),n.jsxs("div",{ref:m.ref,onScroll:m.onScroll,className:"h-56 overflow-auto",role:"group","aria-label":a,children:[n.jsx("div",{style:{height:m.totalHeight,position:"relative"},children:n.jsx("div",{style:{transform:`translateY(${m.paddingTop}px)`},children:f.slice(m.start,m.end).map(g=>n.jsxs("label",{className:"flex h-8 cursor-pointer items-center gap-2 rounded px-2 text-xs hover:bg-muted",children:[n.jsx("input",{type:"checkbox",checked:h.has(g),onChange:()=>r(h.has(g)?t.filter(p=>p!==g):[...t,g])}),n.jsx("span",{className:"truncate",title:g,children:g})]},g))})}),!f.length&&n.jsx("p",{className:"py-5 text-center text-xs text-muted-foreground",children:"No matches"})]})]})}function fp(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 kJ(){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),DD(t)}catch{return{}}}function DD(e){var a,i;if(((i=(a=e.filters)==null?void 0:a.agent)==null?void 0:i.mode)!=="equals")return e;const{agent:t,...r}=e.filters;return{...e,agents:e.agents??(t.value?[t.value]:[]),filters:r}}function TJ(){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 gR(e,t,r){const a=new Blob([JSON.stringify(jJ(e,t,r),null,2)],{type:"application/json"}),i=URL.createObjectURL(a),c=document.createElement("a");c.href=i,c.download=r==="ocsf"?"openshell-activity-ocsf.json":"openshell-activity.json",c.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}function EJ(){const e=Pt(),t=Uu([]),r=x.useRef(t.locations);r.current=t.locations;const a=JSON.stringify(t.locations.map(c=>[c.id,c.connected])),i=x.useMemo(()=>yJ(e,()=>r.current,t.apiFor),[e,t.apiFor]);return t.inventory.loading?n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading activity…"}):n.jsx(WM,{api:i,children:n.jsx(zD,{combined:!0,sourceRevision:a})})}function RJ({combined:e}){const t=gn();return e?n.jsx(EJ,{}):n.jsx(zD,{},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function zD({combined:e,sourceRevision:t}){var wt,cn,Gt,fn,Bn,Kn;const r=Pt(),a=gn(),i=RD(oi()),[c]=x.useState(kJ),[u,f]=x.useState(["time","source","sandbox","agent","action","verdict","destination"]),m=up.filter(de=>u.includes(de.id)),[h,g]=x.useState(TJ),[p,b]=x.useState(""),[v,w]=x.useState(!1),[C,S]=x.useState("columns"),[N,E]=x.useState(null),[T,R]=x.useState(!1),[M,A]=x.useState(null),[k,O]=x.useState(Date.now),[D,_]=x.useState(c.query??""),[H,G]=x.useState(c.direction??"all"),[B,P]=x.useState(c.sandboxes??[]),[V,q]=x.useState(c.agents??[]),[W,K]=x.useState(c.verdicts??[]),[J,z]=x.useState(c.filters??{}),[L,X]=x.useState(c.range??"all"),[ee,$]=x.useState(fp(c.from)),[U,F]=x.useState(fp(c.to)),[Y,ne]=x.useState(c.sort??{key:"time",direction:"desc"}),[te,ye]=x.useState(null),[ae,ue]=x.useState(()=>new Set),[se,Q]=x.useState(null),[ie,oe]=x.useState(!1),[pe,xe]=x.useState(null),je=x.useDeferredValue(D),Ie={query:je,direction:H,sandboxes:B,verdicts:W,agents:V,filters:J,range:L,from:ee&&Number.isFinite(Date.parse(ee))?new Date(ee).toISOString():ee,to:U&&Number.isFinite(Date.parse(U))?new Date(U).toISOString():U,sort:Y},ce=JSON.stringify(Ie),[Te,re]=x.useState({query:ce,page:0}),fe=SJ({...Ie,limit:Vl},{paused:!!M,demo:i.demo,activityRevision:e?`${i.activityRevision}:${t}`:i.activityRevision});x.useEffect(()=>{ue(new Set),ye(null)},[i.activityRevision]),x.useEffect(()=>{ue(new Set)},[je,H,B,W,V,J,L,ee,U]);async function Re(de,tt){Xe(),oe(!0),xe(null);try{const Et=await r.previewActivityDeletion({mode:de,ids:tt||[...ae],query:Ie});Q(Et)}catch(Et){He.error(Et.message)}finally{oe(!1)}}async function Oe(){oe(!0),xe(null);try{const de=await r.deleteActivity(se.token);Q(null),ye(null),ue(new Set),A([]),fe.refresh(),i.refresh();const tt=se.skipped??[];He.success(`Deleted ${de.deleted.toLocaleString()} log${de.deleted===1?"":"s"}`,tt.length?{description:`${mR(tt)} ${tt.length===1?"was offline; its":"were offline; their"} logs were kept.`}:void 0)}catch(de){xe(de.message)}finally{oe(!1)}}function ke(de){Xe(),ue(tt=>{const Et=new Set(tt);return Et.has(de)?Et.delete(de):Et.size<5e3&&Et.add(de),Et})}const he=i.demo?M??i.events:fe.events;function Ae(de){i.demo||en.capture("feature_used",{feature:"activity",action:"filter_applied"}),de=DD(de),Xe(),_(de.query||""),G(de.direction||"all"),P(de.sandboxes||[]),K(de.verdicts||[]),q(de.agents||[]),z(de.filters||{}),X(de.range||"all"),$(fp(de.from)),F(fp(de.to)),ne(de.sort||{key:"time",direction:"desc"})}function ge(de,tt){Ae({filters:{[de]:{mode:"equals",value:tt}}}),ye(null)}function Pe(de){E({format:de,columns:[...u],range:L,from:ee,to:U})}const Fe=N&&(!N.columns.length||N.range==="custom"&&(!N.from&&!N.to||N.from&&!Number.isFinite(Date.parse(N.from))||N.to&&!Number.isFinite(Date.parse(N.to))||N.from&&N.to&&Date.parse(N.from)>Date.parse(N.to)));async function _e(){var un;if(!N||Fe)return;const{format:de,columns:tt,range:Et,from:on,to:xn}=N,Wt={...Ie,columns:tt,range:Et,from:on?new Date(on).toISOString():"",to:xn?new Date(xn).toISOString():""};R(!0);try{if(i.demo){gR(N1(ct,{...Wt,now:k}).map(Jn=>Jn.event),{...Wt,demo:!0},de),E(null);return}if(e){const Jn=await r.activity({...Wt,exportAll:!0});gR(Jn.events.map(({originalId:wo,id:jo,...cr})=>({...cr,id:wo})),Wt,de),E(null),(un=Jn.unavailable)!=null&&un.length&&He.warning("Some logs were not exported",{description:Jn.unavailable.map(pR).join(`
526
+ `)});return}const ns=document.createElement("a");ns.href=r.url("/activity/export",{format:de,query:JSON.stringify(Wt),context:await r.contextKey(),...a?{location:"1"}:{}}),ns.download=de==="ocsf"?"openshell-activity-ocsf.json":"openshell-activity.json",document.body.appendChild(ns),ns.click(),ns.remove(),E(null)}catch(ns){He.error(`Export failed: ${ns.message}`)}finally{R(!1)}}const Xe=()=>{M||(A(he),O(Date.now()))},Je=de=>tt=>{Xe(),de(tt)},ct=x.useMemo(()=>he.map(Dw),[he]),At=x.useMemo(()=>[...new Set([...(i.sandboxes??[]).map(de=>de.name),...fe.sandboxes??[],...he.map(de=>de.sandbox),...B].filter(Boolean))].sort(),[i.sandboxes,fe.sandboxes,he,B]),rt=x.useMemo(()=>[...new Set(i.demo?ct.map(de=>de.values.agent):fe.agents??ct.map(de=>de.values.agent))].filter(Boolean).sort((de,tt)=>de.localeCompare(tt)),[i.demo,ct,fe.agents]),ve=L==="custom"&&(!ee&&!U||ee&&U&&Date.parse(ee)>Date.parse(U)),Ue=x.useMemo(()=>ve?[]:i.demo?N1(ct,{query:je,direction:H,sandboxes:B,verdicts:W,agents:V,filters:J,range:L,from:ee,to:U,now:k,sort:Y}):ct,[ct,je,H,B,W,V,J,L,ee,U,k,Y,ve,i.demo]),Qe=ve?0:i.demo?Ue.length:fe.total||0,xt=Math.max(1,Math.ceil(Qe/Vl)),Ke=i.demo?Math.min(Te.query===ce?Te.page:0,xt-1):fe.page,Be=i.demo?Ue.slice(Ke*Vl,(Ke+1)*Vl):Ue;function jt(de){Xe(),ue(new Set),ye(null),i.demo?re({query:ce,page:de}):fe.goToPage(de)}const Ze=_x({count:Be.length,rowHeight:48});x.useEffect(()=>{Ze.scrollToTop()},[je,H,B,W,V,J,L,ee,U,Y,Ke]);const Tt=x.useMemo(()=>{if(!M)return 0;const de=new Set(M.map(Ef));return i.events.filter(tt=>!de.has(Ef(tt))).length},[M,i.events]),Se=Be.filter(de=>de.values.verdict==="denied").length,Ye=Be.filter(de=>de.values.verdict==="allowed").length,et=D||B.length||W.length||V.length||H!=="all"||L!=="all"||Object.values(J).some(de=>de.value);function it(){Xe(),_(""),G("all"),P([]),K([]),q([]),z({}),X("all"),$(""),F("")}const lt=[...H!=="all"?[{label:`Direction: ${H}`,clear:()=>G("all")}]:[],...D?[{label:`Search: ${D}`,clear:()=>_("")}]:[],...B.length?[{label:`${B.length} sandbox${B.length===1?`: ${B[0]}`:"es"}`,clear:()=>P([])}]:[],...V.length?[{label:`Observed agents: ${V.join(", ")}`,clear:()=>q([])}]:[],...W.length?[{label:`Decision: ${W.join(", ")}`,clear:()=>K([])}]:[],...L!=="all"?[{label:dp[L],clear:()=>X("all")}]:[],...Object.entries(J).filter(([,de])=>de.value).map(([de,tt])=>{var Et;return{label:`${((Et=up.find(on=>on.id===de))==null?void 0:Et.label)??de}${de==="agent"?"":` ${tt.mode}`}: ${tt.value}`,clear:()=>z(on=>({...on,[de]:{...tt,value:""}}))}})];return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex h-[calc(100svh-3.5rem)] min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-3 sm:px-6",children:[n.jsx(yo,{"aria-label":"Search activity",placeholder:"Search activity…",value:D,onValueChange:Je(_),className:"min-w-44 flex-1 basis-full sm:basis-44"}),n.jsxs($p,{children:[n.jsxs(Bp,{className:`${xr} flex items-center gap-2 hover:bg-muted`,children:[n.jsx(Mk,{className:"size-3.5"}),"Filters",(L!=="all"||H!=="all"||B.length>0||W.length>0||Object.values(J).some(de=>de.value))&&n.jsx("span",{className:"rounded bg-foreground px-1.5 text-[10px] text-background",children:+(L!=="all")+ +(H!=="all")+ +(B.length>0)+ +(W.length>0)+Object.values(J).filter(de=>de.value).length})]}),n.jsxs(Vp,{align:"end",className:"max-h-[min(38rem,80svh)] w-80 max-w-[calc(100vw-2rem)] overflow-y-auto p-4",children:[n.jsx("p",{className:"text-xs font-medium",children:"Filter activity"}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Time frame",n.jsx(pn,{"aria-label":"Time range",className:xr,value:L,onChange:de=>Je(X)(de.target.value),children:Object.entries(dp).map(([de,tt])=>n.jsx("option",{value:de,children:tt},de))})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Direction",n.jsxs(pn,{"aria-label":"Direction",className:xr,value:H,onChange:de=>Je(G)(de.target.value),children:[n.jsx("option",{value:"all",children:"All directions"}),n.jsx("option",{value:"unknown",children:"Direction not applicable / unknown"}),n.jsx("option",{value:"out",children:"Outbound"}),n.jsx("option",{value:"in",children:"Inbound"})]})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Event type",n.jsxs(pn,{"aria-label":"Event category",className:xr,value:((wt=J.category)==null?void 0:wt.value)||"",onChange:de=>Je(z)({...J,category:{mode:"equals",value:de.target.value}}),children:[n.jsx("option",{value:"",children:"All event types"}),["Network","HTTP","Session","Configuration","Process","File","Authentication","Finding","Event","Log","Unclassified"].map(de=>n.jsx("option",{children:de},de))]})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Security severity",n.jsxs(pn,{"aria-label":"Security severity",className:xr,value:((cn=J.severity)==null?void 0:cn.value)||"",onChange:de=>Je(z)({...J,severity:{mode:"equals",value:de.target.value}}),children:[n.jsx("option",{value:"",children:"All severities"}),["FATAL","CRITICAL","HIGH","MED","LOW","INFO","Not reported"].map(de=>n.jsx("option",{children:de},de))]})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Log level",n.jsxs(pn,{"aria-label":"Log level",className:xr,value:((Gt=J.logLevel)==null?void 0:Gt.value)||"",onChange:de=>Je(z)({...J,logLevel:{mode:"equals",value:de.target.value}}),children:[n.jsx("option",{value:"",children:"All log levels"}),["ERROR","WARN","INFO","DEBUG","TRACE","Not reported"].map(de=>n.jsx("option",{children:de},de))]})]}),n.jsxs("div",{className:"mt-1 border-t pt-3",children:[n.jsx("p",{className:"mb-2 text-[11px] font-medium",children:"Decision"}),n.jsx("div",{className:"grid grid-cols-2 gap-2",children:["allowed","denied","not reported","not applicable"].map(de=>n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx("input",{type:"checkbox",checked:W.includes(de),onChange:()=>Je(K)(W.includes(de)?W.filter(tt=>tt!==de):[...W,de])}),de]},de))})]}),n.jsxs("div",{className:"mt-1 flex flex-col gap-2 border-t pt-3",children:[n.jsx("p",{className:"text-[11px] font-medium",children:"Sandboxes"}),n.jsx(dy,{label:"Sandboxes",options:At,selected:B,onChange:Je(P)})]})]})]}),n.jsxs($p,{children:[n.jsxs(Bp,{className:`${xr} flex items-center gap-2 hover:bg-muted`,children:[n.jsx(P8,{className:"size-3.5"}),"View",n.jsx(ha,{className:"size-3"})]}),n.jsxs(Vp,{align:"end",className:"w-72 p-3",children:[n.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(([de,tt])=>n.jsx("button",{"aria-pressed":C===de,onClick:()=>S(de),className:`flex-1 rounded px-2 py-1.5 text-xs transition-colors ${C===de?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:tt},de))}),C==="columns"?n.jsx("div",{children:up.map(de=>n.jsxs("label",{className:"flex items-center gap-2 py-1 text-xs",children:[n.jsx("input",{type:"checkbox",disabled:de.id==="time",checked:u.includes(de.id),onChange:tt=>f(tt.target.checked?[...u,de.id]:u.filter(Et=>Et!==de.id))}),de.label]},de.id))}):n.jsxs("div",{className:"flex max-h-80 flex-col gap-3 overflow-auto",children:[n.jsx(Ot,{"aria-label":"View name",value:p,onChange:de=>b(de.target.value),placeholder:"Name this investigation…"}),n.jsx(le,{size:"sm",disabled:!p.trim(),onClick:()=>{try{const de=[...h.filter(tt=>tt.name!==p.trim()),{name:p.trim(),query:Ie}];localStorage.setItem("openshell.activity.views",JSON.stringify(de)),g(de),b(""),He.success("View saved in this browser")}catch{He.error("Could not save view")}},children:"Save view"}),h.map(de=>n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{className:"min-w-0 flex-1 truncate text-left text-xs",onClick:()=>Ae(de.query),children:de.name}),n.jsx("button",{"aria-label":`Delete view ${de.name}`,onClick:()=>{try{const tt=h.filter(Et=>Et.name!==de.name);localStorage.setItem("openshell.activity.views",JSON.stringify(tt)),g(tt)}catch{He.error("Could not delete view")}},children:n.jsx(In,{className:"size-3"})})]},de.name)),!h.length&&n.jsx("p",{className:"py-2 text-center text-xs text-muted-foreground",children:"No saved views yet."})]})]})]}),n.jsxs(Fi,{children:[n.jsxs(Gi,{"aria-label":"Activity actions",className:`${xr} flex items-center gap-2 hover:bg-muted`,children:["Actions",n.jsx(ha,{className:"size-3"})]}),n.jsxs(qi,{align:"end",className:"w-60",children:[n.jsxs(Rs,{disabled:T||!!ve,onClick:()=>Pe("json"),children:[n.jsx(pu,{}),"Export Console JSON"]}),n.jsxs(Rs,{disabled:T||!!ve,onClick:()=>Pe("ocsf"),children:[n.jsx(pu,{}),"Export OCSF JSON"]}),n.jsxs(Rs,{onClick:()=>w(!0),children:[n.jsx(Ik,{}),"Webhooks"]}),!i.demo&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Rs,{disabled:ie||!ae.size,variant:"destructive",onClick:()=>Re("selected"),children:[n.jsx(ts,{}),"Delete selected logs",ae.size?` (${ae.size})`:""]}),n.jsxs(Rs,{disabled:ie||!!ve||fe.loading||!fe.total,variant:"destructive",onClick:()=>Re("matching"),children:[n.jsx(ts,{}),"Delete matching logs"]}),n.jsxs(Rs,{disabled:ie,variant:"destructive",onClick:()=>Re("all"),children:[n.jsx(ts,{}),"Delete all logs"]})]})]})]})]}),(fe.error||!e&&i.historyError)&&!i.demo&&n.jsx(Qa,{id:"activity:history-error",tone:"error",title:"History unavailable",actions:n.jsx(le,{size:"xs",variant:"outline",onClick:fe.refresh,children:"Retry"}),children:fe.error||!e&&i.historyError}),L==="custom"&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border px-6 py-2 text-xs",children:[n.jsxs("label",{className:"flex items-center gap-2",children:["From",n.jsx("input",{type:"datetime-local","aria-label":"From time",className:xr,value:ee,onInput:de=>Je($)(de.currentTarget.value)})]}),n.jsxs("label",{className:"flex items-center gap-2",children:["To",n.jsx("input",{type:"datetime-local","aria-label":"To time",className:xr,value:U,onInput:de=>Je(F)(de.currentTarget.value)})]}),n.jsx("span",{className:"text-muted-foreground",children:Intl.DateTimeFormat().resolvedOptions().timeZone}),ve&&n.jsx("span",{role:"alert",className:"text-red-600",children:"Choose a start or end time; the end must follow the start."})]}),!!et&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border px-6 py-2",children:[lt.map(de=>n.jsxs("button",{onClick:de.clear,title:`Remove ${de.label}`,className:"flex max-w-72 items-center gap-2 rounded border border-border bg-muted/40 px-2 py-1 text-[11px]",children:[n.jsx("span",{className:"truncate",children:de.label}),n.jsx(In,{className:"size-3 shrink-0"})]},de.label)),n.jsx(le,{size:"xs",variant:"ghost",onClick:it,children:"Clear all"})]}),n.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:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-mono text-foreground",children:Qe.toLocaleString()})," ",i.demo?"demo events":"matching events"]}),n.jsxs("span",{children:[Ye.toLocaleString()," allowed · ",n.jsxs("span",{className:Se?"text-red-600":"",children:[Se.toLocaleString()," denied"]})," ",n.jsx("span",{className:"text-muted-foreground/70",children:"on this page"})]}),e&&!i.demo&&!fe.error&&((fn=fe.unavailable)==null?void 0:fn.map((de,tt)=>n.jsx("span",{title:de.error,className:"text-amber-700 dark:text-amber-400",children:pR(de)},tt))),n.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:()=>{M?(A(null),re({query:ce,page:0}),O(Date.now()),fe.refresh(),Ze.scrollToTop()):Xe()},children:[M?n.jsx(IA,{className:"size-3"}):n.jsx(w8,{className:"size-3"}),M?"Resume":"Pause"]}),M&&n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{children:"View paused"}),n.jsx("button",{className:"rounded text-foreground underline underline-offset-4 disabled:opacity-40",disabled:i.demo&&!Tt,onClick:()=>{A(i.demo?i.events:he),O(Date.now()),fe.refresh(),Ze.scrollToTop()},children:i.demo?`${Tt.toLocaleString()} new events`:"Refresh"})]}),ae.size>0&&n.jsxs("span",{className:"flex items-center gap-2",children:[ae.size.toLocaleString()," selected",n.jsx("button",{className:"underline",onClick:()=>ue(new Set),children:"Clear selection"})]}),n.jsx("span",{className:"ml-auto",children:Intl.DateTimeFormat().resolvedOptions().timeZone})]}),n.jsxs("div",{ref:Ze.ref,onScroll:de=>{Ze.onScroll(de),de.currentTarget.scrollTop>0&&Xe()},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:[n.jsxs("table",{style:{minWidth:m.reduce((de,tt)=>de+tt.width,i.demo?0:40)},className:"w-full table-fixed border-separate border-spacing-0 text-xs","aria-label":"Activity","aria-rowcount":Be.length+1,children:[n.jsxs("colgroup",{children:[!i.demo&&n.jsx("col",{style:{width:52}}),m.map(de=>n.jsx("col",{style:{width:de.width}},de.id))]}),n.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:n.jsxs("tr",{children:[!i.demo&&n.jsx("th",{scope:"col",className:"h-10 border-b border-border pr-3 pl-4 text-left sm:pl-6",children:n.jsx("input",{type:"checkbox","aria-label":"Select logs on this page",disabled:!Be.length||Be.length>5e3,checked:Be.length>0&&Be.every(de=>ae.has(de.key)),ref:de=>{de&&(de.indeterminate=Be.some(tt=>ae.has(tt.key))&&!Be.every(tt=>ae.has(tt.key)))},onChange:de=>{Xe(),ue(de.target.checked?new Set(Be.filter(tt=>{var Et;return((Et=tt.event.location)==null?void 0:Et.connected)!==!1}).map(tt=>tt.key)):new Set)}})}),m.map(de=>{var tt,Et,on,xn;return n.jsx("th",{scope:"col","aria-sort":Y.key===de.id?Y.direction==="asc"?"ascending":"descending":"none",className:"h-10 border-b border-border px-3 text-left font-medium text-muted-foreground",children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsxs("button",{className:"flex h-9 flex-1 items-center gap-1 outline-none focus-visible:ring-2 focus-visible:ring-ring",disabled:de.id==="source",onClick:()=>Je(ne)({key:de.id,direction:Y.key===de.id&&Y.direction==="asc"?"desc":"asc"}),children:[de.label,Y.key===de.id&&(Y.direction==="asc"?n.jsx(_f,{className:"size-3"}):n.jsx(Pf,{className:"size-3"}))]}),de.id!=="source"&&n.jsxs($p,{children:[n.jsx(Bp,{"aria-label":`Filter ${de.label}`,className:`rounded p-1 hover:bg-accent ${(de.id==="time"?L!=="all":de.id==="sandbox"?B.length:de.id==="verdict"?W.length:de.id==="agent"?V.length||(tt=J.agent)!=null&&tt.value:(Et=J[de.id])!=null&&Et.value)?"bg-accent text-foreground":""}`,children:n.jsx(Mk,{className:"size-3"})}),n.jsxs(Vp,{align:"start",children:[n.jsxs("p",{className:"text-xs font-medium",children:["Filter ",de.label.toLowerCase()]}),de.id==="agent"?n.jsxs("div",{role:"group","aria-label":"Observed agents",className:"max-h-64 overflow-y-auto",children:[n.jsxs("div",{className:"mb-1 flex items-center justify-between px-2 text-[11px] text-muted-foreground",children:[n.jsx("span",{children:V.length?`${V.length} selected`:"All agents"}),n.jsx("button",{className:"underline",onClick:()=>{Xe(),q([]),z(({agent:Wt,...un})=>un)},children:"Clear"})]}),rt.map(Wt=>n.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:[n.jsx("input",{type:"checkbox",checked:V.includes(Wt),onChange:()=>{Xe(),z(({agent:un,...ns})=>ns),q(un=>un.includes(Wt)?un.filter(ns=>ns!==Wt):[...un,Wt])},className:"accent-foreground"}),n.jsx(Hp,{agent:NJ[Wt]??{name:Wt}})]},Wt)),!rt.length&&n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No agents in the logs"})]}):de.id==="sandbox"?n.jsx(dy,{label:"Sandboxes",options:At,selected:B,onChange:Je(P)}):de.id==="verdict"?n.jsx(dy,{label:"Decisions",options:["allowed","denied","not reported","not applicable"],selected:W,onChange:Je(K)}):de.id==="time"?n.jsxs(n.Fragment,{children:[n.jsx(pn,{"aria-label":"Filter time",className:xr,value:L,onChange:Wt=>Je(X)(Wt.target.value),children:Object.entries(dp).map(([Wt,un])=>n.jsx("option",{value:Wt,children:un},Wt))}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Custom dates appear above the table."})]}):n.jsxs(n.Fragment,{children:[n.jsxs(pn,{"aria-label":`${de.label} match mode`,className:xr,value:((on=J[de.id])==null?void 0:on.mode)??"contains",onChange:Wt=>{var un;return Je(z)({...J,[de.id]:{value:((un=J[de.id])==null?void 0:un.value)??"",mode:Wt.target.value}})},children:[n.jsx("option",{value:"equals",children:"Equals"}),n.jsx("option",{value:"contains",children:"Contains"}),n.jsx("option",{value:"excludes",children:"Excludes"})]}),n.jsx(Ot,{"aria-label":`${de.label} filter value`,placeholder:`Filter ${de.label.toLowerCase()}…`,value:((xn=J[de.id])==null?void 0:xn.value)??"",onChange:Wt=>{var un;return Je(z)({...J,[de.id]:{mode:((un=J[de.id])==null?void 0:un.mode)??"contains",value:Wt.target.value}})},className:"h-8 text-xs"})]})]})]})]})},de.id)})]})}),n.jsxs("tbody",{children:[Ze.paddingTop>0&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:m.length+(i.demo?0:1),style:{height:Ze.paddingTop,padding:0}})}),Be.slice(Ze.start,Ze.end).map((de,tt)=>{var Et;return n.jsxs("tr",{"aria-rowindex":Ze.start+tt+2,onClick:()=>{Xe(),ye(de)},className:`group cursor-pointer hover:bg-muted/70 ${(te==null?void 0:te.key)===de.key?"bg-accent":"bg-card"}`,children:[!i.demo&&n.jsx("td",{className:"h-12 border-b border-border/60 pr-3 pl-4 sm:pl-6",onClick:on=>on.stopPropagation(),children:n.jsx("input",{type:"checkbox","aria-label":`Select log ${de.values.sandbox} ${de.values.time}`,checked:ae.has(de.key),disabled:((Et=de.event.location)==null?void 0:Et.connected)===!1||!ae.has(de.key)&&ae.size>=5e3,onChange:()=>ke(de.key)})}),m.map(on=>n.jsx("td",{className:`h-12 border-b border-border/60 px-3 py-0 font-mono text-[11px] ${on.id==="verdict"?de.values.verdict==="denied"?"text-red-600":de.values.verdict==="allowed"?"text-emerald-700":"text-muted-foreground":on.id==="destination"?"text-foreground":"text-muted-foreground"}`,children:on.id==="source"?n.jsx(Hs,{location:de.event.location??a}):on.id==="time"?n.jsx("button",{"aria-label":`Inspect event ${de.values.sandbox} ${de.values.time}`,"aria-haspopup":"dialog",className:"h-8 w-full truncate text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:xn=>{xn.stopPropagation(),Xe(),ye(de)},children:CJ(de.values.time)}):on.id==="action"?n.jsxs("span",{className:"block truncate",title:`${de.values.category} · ${de.values.action} · ${de.values.process}`,children:[n.jsxs("span",{className:"block truncate text-foreground",children:[de.values.category," · ",de.event.method||de.event.action||"Not reported"]}),n.jsx("span",{className:"block truncate text-[10px]",children:de.values.process||de.event.detail||de.event.message||"Process not reported"})]}):on.id==="agent"&&de.agent?n.jsx("span",{className:"font-sans text-foreground",children:n.jsx(Hp,{agent:de.agent})}):n.jsx("span",{className:"block truncate",title:de.values[on.id],children:de.values[on.id]||"-"})},on.id))]},de.key)}),Ze.end<Be.length&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:m.length+(i.demo?0:1),style:{height:(Be.length-Ze.end)*48,padding:0}})})]})]}),!Be.length&&n.jsxs("div",{className:"py-20 text-center text-sm text-muted-foreground",children:[n.jsx("p",{children:fe.error&&!i.demo?"Could not load retained events":fe.loading&&!i.demo?"Searching retained events…":ve?"Set a valid time range":et?"No matching events in available history":"No activity available"}),!!et&&n.jsx(le,{variant:"outline",size:"sm",className:"mt-3",onClick:it,children:"Clear filters"})]})]}),Qe>Vl&&n.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:[n.jsxs("span",{"aria-live":"polite",className:"text-xs tabular-nums text-muted-foreground",children:[(Ke*Vl+1).toLocaleString(),"-",Math.min((Ke+1)*Vl,Qe).toLocaleString()," of ",Qe.toLocaleString()," logs"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{variant:"outline",size:"sm","aria-label":"First page",disabled:Ke===0||!i.demo&&fe.loading,onClick:()=>jt(0),children:"First"}),n.jsx(le,{variant:"outline",size:"sm","aria-label":"Previous page",disabled:Ke===0||!i.demo&&fe.loading,onClick:()=>jt(Ke-1),children:"Previous"}),n.jsx("span",{"aria-live":"polite",className:"px-2 text-xs tabular-nums text-muted-foreground",children:!i.demo&&fe.loading?"Loading…":`Page ${Ke+1} of ${xt.toLocaleString()}`}),n.jsx(le,{variant:"outline",size:"sm","aria-label":"Next page",disabled:Ke>=xt-1||!i.demo&&fe.loading,onClick:()=>jt(Ke+1),children:"Next"}),n.jsx(le,{variant:"outline",size:"sm","aria-label":"Last page",disabled:Ke>=xt-1||!i.demo&&fe.loading,onClick:()=>jt(xt-1),children:"Last"})]})]})]}),n.jsx(tn,{open:!!N,onOpenChange:de=>{de||E(null)},children:n.jsxs(nn,{className:"sm:max-w-md max-h-[85vh] overflow-y-auto",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["Export ",(N==null?void 0:N.format)==="ocsf"?"OCSF JSON":"Console JSON"]}),n.jsx(Sn,{children:"Your current columns and time frame are ready to export. Other table filters still apply."})]}),N&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"grid gap-2 text-xs font-medium",children:["Time frame",n.jsx(pn,{className:xr,value:N.range,onChange:de=>E({...N,range:de.target.value}),children:Object.entries(dp).map(([de,tt])=>n.jsx("option",{value:de,children:tt},de))})]}),N.range==="custom"&&n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[["from","to"].map(de=>n.jsxs("label",{className:"grid gap-1 text-xs",children:[n.jsx("span",{children:de==="from"?"From":"To"}),n.jsx("input",{type:"datetime-local",className:xr+" w-full min-w-0",value:N[de],onChange:tt=>E({...N,[de]:tt.target.value})})]},de)),n.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."]})]}),n.jsxs("fieldset",{className:"space-y-3",children:[n.jsx("legend",{className:"text-xs font-medium",children:"Columns"}),n.jsx("div",{className:"grid grid-cols-2 gap-3",children:up.map(de=>n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx("input",{type:"checkbox",checked:N.columns.includes(de.id),disabled:de.id==="time"&&N.format==="ocsf",onChange:tt=>E({...N,columns:tt.target.checked?[...N.columns,de.id]:N.columns.filter(Et=>Et!==de.id)})}),de.label]},de.id))})]}),N.format==="ocsf"&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"OCSF includes the required event time and schema fields alongside your selected columns."}),Fe&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Choose at least one column and a valid time frame."}),n.jsxs(Hr,{children:[n.jsx(le,{variant:"outline",onClick:()=>E(null),children:"Cancel"}),n.jsxs(le,{disabled:T||Fe,onClick:_e,children:[n.jsx(pu,{}),T?"Exporting…":"Export"]})]})]})]})}),n.jsx(Fr,{open:!!se,onOpenChange:de=>{!de&&!ie&&Q(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsx(Kr,{children:(se==null?void 0:se.mode)==="all"?"Delete all retained logs?":(se==null?void 0:se.mode)==="matching"?"Delete matching logs?":"Delete selected logs?"}),n.jsxs(Xr,{children:[se==null?void 0:se.count.toLocaleString()," log",(se==null?void 0:se.count)===1?"":"s"," will be permanently removed from Activity and pending webhook delivery. This cannot be undone."]})]}),((Bn=se==null?void 0:se.sources)==null?void 0:Bn.length)>1&&n.jsx("p",{className:"text-xs text-muted-foreground",children:se.sources.map(de=>`${de.label}: ${de.count.toLocaleString()}`).join(", ")}),((Kn=se==null?void 0:se.skipped)==null?void 0:Kn.length)>0&&n.jsxs("p",{className:"text-xs font-medium text-amber-700 dark:text-amber-400",children:[mR(se.skipped)," ",se.skipped.length===1?"is offline; its":"are offline; their"," logs won’t be deleted."]}),n.jsxs("p",{className:"text-xs leading-relaxed text-muted-foreground",children:[(se==null?void 0:se.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."]}),pe&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:pe}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:ie,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:ie||!(se!=null&&se.count)||!!pe,onClick:Oe,children:ie?"Deleting…":`Delete ${se==null?void 0:se.count.toLocaleString()} log${(se==null?void 0:se.count)===1?"":"s"}`})]})]})}),n.jsx(Lo,{open:v&&!e,onOpenChange:w,children:n.jsxs(la,{className:"gap-0 data-[side=right]:w-full sm:data-[side=right]:max-w-2xl",children:[n.jsxs(ca,{className:"border-b border-border pr-12",children:[n.jsxs(ua,{className:"flex items-center gap-2",children:[n.jsx(Ik,{"aria-hidden":"true",className:"size-4 text-muted-foreground",strokeWidth:1.5}),"Webhooks"]}),n.jsx(da,{children:"Send activity to an HTTPS endpoint."})]}),v&&n.jsx(fR,{})]})}),e&&v&&n.jsx(Dx,{subject:"workspace",onClose:()=>w(!1),children:(de,tt)=>n.jsx(Lo,{open:!0,onOpenChange:Et=>{Et||tt()},children:n.jsxs(la,{className:"overflow-auto sm:max-w-xl",children:[n.jsxs(ca,{children:[n.jsx(ua,{children:"Webhooks"}),n.jsx(da,{children:n.jsx(Hs,{location:de})})]}),n.jsx(fR,{})]})})}),n.jsx(Lo,{open:!!te,onOpenChange:de=>{de||ye(null)},children:n.jsxs(la,{className:"w-full gap-0 sm:max-w-lg",children:[n.jsxs(ca,{className:"border-b border-border pr-12",children:[n.jsx(ua,{children:"Event details"}),n.jsx(da,{children:"Full values from this event. The activity view stays paused."})]}),te&&n.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-auto p-5",children:[n.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(([,de])=>de).map(([de,tt,Et])=>n.jsx(le,{size:"xs",variant:"outline",onClick:()=>ge(de,tt),children:Et},de))}),!i.demo&&n.jsxs(le,{size:"sm",variant:"destructive",disabled:ie,onClick:()=>Re("selected",[te.key]),children:[n.jsx(ts,{}),"Delete log"]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Pivots match recorded fields. An executable match does not prove the same process instance."}),n.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(([de,tt])=>n.jsxs("div",{children:[n.jsx("dt",{className:"mb-1 text-[11px] text-muted-foreground",children:de}),n.jsxs("dd",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-xs",children:de==="Agent"&&te.agent?n.jsx(Hp,{agent:te.agent}):tt||"-"}),tt&&n.jsx(xR,{label:de,value:tt})]})]},de))}),n.jsxs("div",{children:[n.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-medium",children:"Raw event"}),n.jsx(xR,{label:"raw event",value:JSON.stringify(te.event,null,2)})]}),n.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 xR({label:e,value:t}){const[r,a]=x.useState(!1);return x.useEffect(()=>{if(r){const i=setTimeout(()=>a(!1),1500);return()=>clearTimeout(i)}},[r]),n.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?n.jsx(Yn,{className:"size-3.5"}):n.jsx(Lf,{className:"size-3.5"})})}const Wi=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,bR="groups-show-sandboxes";function ID(e){try{sessionStorage.setItem(Ja,JSON.stringify(e))}catch{}}function Of(e,t){var r,a;(r=e.failed)!=null&&r.length?He.warning(`${t}. ${Wi(e.failed.length,"sandbox","sandboxes")} could not be updated`,{description:e.failed.map(i=>`${i.sandbox}: ${i.error}`).join(`
527
+ `)}):He.success(t,{description:(a=e.applied)!=null&&a.length?`Network access updated in ${Wi(e.applied.length,"sandbox","sandboxes")}.`:void 0})}function AJ({policy:e,onClick:t}){const r=e.action==="block"?t2:Iu;return n.jsxs("button",{type:"button",onClick:t,title:`${e.action==="block"?"Blocks":"Allows"} ${e.destinations.join(", ")}`,className:Ve("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:[n.jsx(r,{className:"size-3 shrink-0","aria-hidden":"true"}),n.jsx("span",{className:"truncate",children:e.name})]})}function MJ({names:e,limit:t=4}){return e.length?n.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.slice(0,t).map(r=>n.jsx("span",{title:r,className:"max-w-full truncate 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&&n.jsxs("span",{className:"text-[11px] text-faint",children:["+",e.length-t]})]}):n.jsx("span",{className:"text-[11px] text-faint",children:"No sandboxes yet"})}const OJ=[{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 PD({onCreate:e,onPolicy:t}){return n.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[n.jsx(ho,{children:n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-9 items-center justify-center rounded-xl border border-stone-300 bg-card shadow-[0_3px_8px_#1c191708]",children:n.jsx(Ka,{className:"size-4.5 text-stone-600",strokeWidth:1.4})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-[15px] font-medium tracking-tight",children:"Give sandboxes the same network access, together"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Instead of one rule per sandbox, make a group and aim rules at the group."})]})]})}),n.jsxs("ol",{className:"relative mt-8 grid gap-3 sm:grid-cols-3",children:[n.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"}),OJ.map((r,a)=>n.jsx(ho,{delay:.08+a*.08,className:"relative",children:n.jsxs("li",{className:"flex h-full flex-col rounded-lg border border-border bg-card p-4",children:[n.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}),n.jsx("p",{className:"mt-3 text-xs font-medium",children:r.title}),n.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:r.body})]})},r.title))]}),n.jsx(ho,{delay:.34,children:n.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-2",children:[n.jsxs(le,{onClick:e,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(vs,{}),"Create your first group"]}),n.jsxs(le,{variant:"ghost",onClick:t,className:"text-muted-foreground",children:["Network rules",n.jsx(mu,{})]})]})})]})}function _D({open:e,onOpenChange:t,groups:r,sandboxes:a,assignments:i,onCreated:c}){const u=Pt(),[f,m]=x.useState(""),[h,g]=x.useState(""),[p,b]=x.useState([]),[v,w]=x.useState(!1),[C,S]=x.useState(null);x.useEffect(()=>{e&&(m(""),g(""),b([]),S(null))},[e]);const N=l4(f),E=r.some(M=>M.id===N),T=M=>ir({assignments:i},M).map(A=>{var k;return(k=r.find(O=>O.id===A))==null?void 0:k.name}).filter(Boolean).join(", ");async function R(M){M.preventDefault(),w(!0),S(null);try{const{group:A}=await u.saveGroup({id:N,name:f.trim(),description:h.trim(),isNew:!0});let k=null;if(p.length)try{k=await u.setGroupMembers(p,[A.id],"add")}catch(O){He.warning(`Created ${A.name}, but could not add sandboxes`,{description:O.message})}t(!1),c(A,k,p.length)}catch(A){S(A.message)}finally{w(!1)}}return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:n.jsxs("form",{onSubmit:R,className:"grid gap-4",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"New group"}),n.jsx(Sn,{className:"text-xs",children:"Network rules aimed at this group reach every sandbox in it."})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"group-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"group-name",value:f,onChange:M=>m(M.target.value),placeholder:"Frontend",className:"text-xs",required:!0,autoFocus:!0}),E&&n.jsx("p",{className:"text-[11px] text-red-700",children:"A group with this name already exists."})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsxs(zn,{htmlFor:"group-description",className:"text-xs",children:["Description ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),n.jsx(Hu,{id:"group-description",rows:2,value:h,onChange:M=>g(M.target.value),placeholder:"Web apps: npm and GitHub",className:"text-xs"})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsxs("span",{className:"text-xs font-medium",children:["Add sandboxes ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.length?n.jsx("ul",{className:"max-h-48 divide-y divide-border/60 overflow-y-auto rounded-md border border-border",children:a.map(M=>{const A=p.includes(M.name),k=T(M.name);return n.jsx("li",{children:n.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 px-3 py-1.5 text-xs hover:bg-muted/50",children:[n.jsx("input",{type:"checkbox",checked:A,onChange:()=>b(O=>A?O.filter(D=>D!==M.name):[...O,M.name]),className:"size-3.5"}),n.jsx("span",{className:Ve("size-1.5 shrink-0 rounded-full",Za(M.phase).cell),"aria-hidden":"true"}),n.jsx("span",{className:"truncate font-mono",children:M.name}),k&&n.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-muted-foreground",children:`also in ${k}`})]})},M.name)})}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No sandboxes yet. Pick this group when you create one."})]}),C&&n.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:C}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:v||!N||E,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[v&&n.jsx(kt,{"aria-hidden":"true"}),"Create group",p.length?` with ${Wi(p.length,"sandbox","sandboxes")}`:""]})]})]})})})}function LD({group:e,org:t,sandboxes:r,onClose:a,onChanged:i,onPolicy:c,sourceControl:u}){const f=Pt(),[m,h]=x.useState(""),[g,p]=x.useState(""),[b,v]=x.useState(!1),[w,C]=x.useState(!1);if(x.useEffect(()=>{e&&(h(e.name),p(e.description))},[e]),!e)return n.jsx(Lo,{open:!1,onOpenChange:()=>{}});const S=t.members[e.id]??[],N=Rw(t.policies,e.id),E=t.policies.filter(D=>D.appliesTo.everyone),T=r.filter(D=>!S.includes(D.name)),R=D=>ir(t,D).map(_=>{var H;return(H=t.groups.find(G=>G.id===_))==null?void 0:H.name}).filter(Boolean).join(", "),M=m.trim()!==e.name||g.trim()!==e.description;async function A(){v(!0);try{await f.saveGroup({...e,name:m.trim()||e.name,description:g.trim()}),He.success(`Saved ${m.trim()||e.name}`),i()}catch(D){He.error(D.message)}finally{v(!1)}}async function k(D,_){v(!0);try{Of(await f.setGroupMembers(D,[e.id],_?"add":"remove"),_?`Added ${D.join(", ")} to ${e.name}`:`Removed ${D.join(", ")} from ${e.name}`),i()}catch(H){He.error(H.message)}finally{v(!1)}}async function O(){v(!0);try{Of(await f.deleteGroup(e.id),`Deleted ${e.name}`),a(),i()}catch(D){He.error(D.message)}finally{v(!1),C(!1)}}return n.jsx(Lo,{open:!0,onOpenChange:D=>{D||a()},children:n.jsxs(la,{className:"w-full! overflow-y-auto sm:max-w-[460px]!",children:[n.jsxs(ca,{className:"border-b p-6",children:[n.jsxs(ua,{className:"flex items-center gap-2 text-base",children:[n.jsx(Ka,{className:"size-4 text-muted-foreground",strokeWidth:1.5}),e.name]}),n.jsxs(da,{children:[Wi(S.length,"sandbox","sandboxes")," · ",Wi(N.length,"rule")," aimed at this group"]})]}),n.jsxs("div",{className:"space-y-6 px-6 pb-6",children:[n.jsx("fieldset",{disabled:b||M,children:u}),n.jsxs("section",{className:"grid gap-3",children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"edit-group-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"edit-group-name",value:m,onChange:D=>h(D.target.value),className:"text-xs"})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"edit-group-description",className:"text-xs",children:"Description"}),n.jsx(Hu,{id:"edit-group-description",rows:2,value:g,onChange:D=>p(D.target.value),className:"text-xs"})]}),M&&n.jsxs(le,{size:"sm",className:"w-fit bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",disabled:b,onClick:A,children:[b&&n.jsx(kt,{}),"Save"]})]}),n.jsxs("section",{className:"grid gap-2",children:[n.jsx("h3",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Sandboxes"}),S.length?n.jsx("ul",{className:"divide-y divide-border/60 rounded-md border border-border",children:S.map(D=>{const _=r.find(H=>H.name===D);return n.jsxs("li",{className:"flex items-center gap-2.5 px-3 py-1.5",children:[n.jsx("span",{className:Ve("size-1.5 shrink-0 rounded-full",Za(_==null?void 0:_.phase).cell),"aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:D}),n.jsx(le,{size:"icon-xs",variant:"ghost","aria-label":`Remove ${D} from ${e.name}`,disabled:b,onClick:()=>k([D],null),children:n.jsx(In,{})})]},D)})}):n.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&&n.jsxs(pn,{value:"","aria-label":`Add a sandbox to ${e.name}`,disabled:b,onChange:D=>D.target.value&&k([D.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:[n.jsx("option",{value:"",children:"+ Add sandbox"}),T.map(D=>n.jsxs("option",{value:D.name,children:[D.name,R(D.name)?` (also in ${R(D.name)})`:""]},D.name))]})]}),n.jsxs("section",{className:"grid gap-2",children:[n.jsx("h3",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Network access"}),N.length?n.jsx("div",{className:"flex flex-wrap gap-1.5",children:N.map(D=>n.jsx(AJ,{policy:D,onClick:()=>c({edit:D.id})},D.id))}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No network rules yet."}),E.length>0&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Also, like every sandbox: ",E.map(D=>D.name).join(", "),"."]}),n.jsxs(le,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>c({new:{appliesTo:{groups:[e.id]}}}),children:[n.jsx(vs,{}),"Add rule for ",e.name]})]}),n.jsxs("section",{className:"border-t border-border pt-4",children:[(S.length>0||N.length>0)&&n.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."}),n.jsxs(le,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-destructive",disabled:b||S.length>0||N.length>0,onClick:()=>C(!0),children:[n.jsx(ts,{}),"Delete group"]})]})]}),n.jsx(Fr,{open:w,onOpenChange:C,children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",e.name,"?"]}),n.jsx(Xr,{children:"This empty group will be deleted."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:O,children:"Delete group"})]})]})})]})})}function $D({group:e,members:t,policies:r,onOpen:a,delay:i,disabled:c=!1}){return n.jsx(ho,{delay:i,className:"flex min-w-0 flex-1 flex-col",children:n.jsxs("button",{disabled:c,onClick:a,className:"group/card flex min-w-0 flex-1 w-full disabled:cursor-not-allowed disabled:opacity-60 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:[n.jsxs("span",{className:"flex items-start gap-2",children:[n.jsx(Ka,{className:"mt-0.5 size-3.5 shrink-0 text-muted-foreground",strokeWidth:1.5,"aria-hidden":"true"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:e.name}),e.description&&n.jsx("span",{className:"mt-0.5 line-clamp-2 block text-[11px] text-muted-foreground",children:e.description})]}),n.jsx(Lr,{className:"size-3.5 shrink-0 text-faint transition-transform group-hover/card:translate-x-0.5","aria-hidden":"true"})]}),n.jsx(MJ,{names:t}),n.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(u=>n.jsx("span",{className:Ve("max-w-full truncate rounded-full border px-2 py-px text-[10.5px]",u.action==="block"?"border-red-200 bg-red-50 text-red-700":"border-emerald-600/20 bg-emerald-50 text-emerald-800"),children:u.name},u.id)):n.jsx("span",{className:"text-[11px] text-faint",children:"No rules yet"}),r.length>3&&n.jsxs("span",{className:"text-[11px] text-faint",children:["+",r.length-3]})]})]})})}function DJ({onNavigate:e}){const t=Pt(),r=oi(),[a,i]=x.useState(null),[c,u]=x.useState(!1),[f,m]=x.useState(null),[h,g]=x.useState(""),[p,b]=x.useState([]),[v,w]=x.useState([]),[C,S]=x.useState(!1),[N,E]=x.useState(()=>{try{return localStorage.getItem(bR)==="1"}catch{return!1}}),T=()=>E(V=>{try{localStorage.setItem(bR,V?"0":"1")}catch{}return!V}),R=x.useCallback(async()=>{try{i(await t.org())}catch(V){i({error:V.message})}},[]);x.useEffect(()=>{R()},[R]);const M=x.useMemo(()=>[...r.sandboxes??[]].filter(V=>V.phase!=="deleting").sort((V,q)=>V.name.localeCompare(q.name)),[r.sandboxes]),A=V=>{ID(V),e("egress")};if(!a)return n.jsx("p",{role:"status",className:"py-24 text-center text-sm text-muted-foreground",children:"Loading…"});if(a.error)return n.jsx("p",{role:"alert",className:"py-24 text-center text-sm text-muted-foreground",children:a.error});const k=a.groups,O=a.assignments??{},D=M.filter(V=>ir(a,V.name).length).length,_=h.trim().toLowerCase(),H=M.filter(V=>!_||V.name.includes(_)||k.some(q=>ir(a,V.name).includes(q.id)&&q.name.toLowerCase().includes(_))),G=H.length>0&&H.every(V=>p.includes(V.name));async function B(V,q,W="replace"){S(!0);try{Of(await t.setGroupMembers(V,q,W),`Updated groups for ${Wi(V.length,"sandbox","sandboxes")}`),b([]),await R()}catch(K){He.error(K.message)}finally{S(!1)}}const P=n.jsx(_D,{open:c,onOpenChange:u,groups:k,sandboxes:M,assignments:O,onCreated:async(V,q,W)=>{q?Of(q,`Created ${V.name} with ${Wi(W,"sandbox","sandboxes")}`):He.success(`Created ${V.name}`,{description:"Add sandboxes and network rules to it in any order."}),await R(),m(V.id)}});return k.length?n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 pt-4 pb-3 sm:px-6",children:[n.jsx("div",{className:"flex flex-wrap gap-1",children:[{label:"Groups",value:k.length},{label:"In a group",value:D},{label:"No group",value:M.length-D}].map(V=>n.jsxs("div",{className:"rounded-md px-3 py-1.5",children:[n.jsx("span",{className:"block text-[11px] text-muted-foreground",children:V.label}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Af,{value:V.value})})]},V.label))}),n.jsxs(le,{size:"sm",className:"ml-auto bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>u(!0),children:[n.jsx(vs,{className:"size-3.5"}),"New group"]})]}),n.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:[k.map((V,q)=>n.jsx($D,{group:V,members:a.members[V.id]??[],policies:Rw(a.policies,V.id),onOpen:()=>m(V.id),delay:q*.04},V.id)),n.jsx(ho,{delay:k.length*.04,className:"h-full",children:n.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:[n.jsx(vs,{className:"size-4",strokeWidth:1.5,"aria-hidden":"true"}),"New group"]})})]}),n.jsxs("section",{"aria-label":"Sandboxes and their groups",className:"border-t border-border",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 sm:px-6",children:[n.jsxs("button",{type:"button",onClick:T,"aria-expanded":N,className:"flex items-center gap-1.5 rounded text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(Lr,{className:Ve("size-3.5 text-muted-foreground transition-transform",N&&"rotate-90"),"aria-hidden":"true"}),n.jsx("span",{className:"font-medium",children:"Sandboxes"}),n.jsx("span",{className:"font-mono text-[11px] tabular-nums text-muted-foreground",children:M.length}),M.length-D>0&&n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["· ",M.length-D," not in a group"]})]}),N&&n.jsx(yo,{value:h,onValueChange:g,placeholder:"Search sandbox or group…","aria-label":"Search sandboxes",className:"ml-auto w-full sm:w-56"})]}),N&&n.jsxs(n.Fragment,{children:[p.length>0&&n.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:[n.jsx(Yn,{className:"size-3.5","aria-hidden":"true"}),Wi(p.length,"sandbox","sandboxes")," selected",n.jsx("fieldset",{disabled:C,className:"min-w-0",children:n.jsx(cc,{multiple:!0,allowCreate:!1,groups:k,value:v,onChange:w})}),n.jsx(le,{variant:"outline",size:"sm",disabled:C||!v.length,onClick:()=>B(p,v,"add"),children:"Add to groups"}),n.jsx(le,{variant:"outline",size:"sm",disabled:C||!v.length,onClick:()=>B(p,v,"remove"),children:"Remove from groups"}),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>b([]),children:"Clear"}),C&&n.jsx(kt,{"aria-hidden":"true"})]}),M.length?n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("div",{className:"min-w-[640px]",children:[n.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:[n.jsx("input",{type:"checkbox","aria-label":"Select every sandbox shown",checked:G,onChange:()=>b(G?[]:H.map(V=>V.name)),className:"size-3.5"}),n.jsx("span",{children:"Sandbox"}),n.jsx("span",{children:"Groups"}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(Ig,{className:"size-3","aria-hidden":"true"}),"Network rules"]})]}),n.jsxs("ul",{className:"divide-y divide-border/60 bg-card",children:[H.map(V=>{var J;const q=ir(a,V.name),W=c4(a.policies,{name:V.name,groups:q,setups:((J=a.setupMembers)==null?void 0:J[V.name])??[]}),K=p.includes(V.name);return n.jsxs("li",{className:Ve("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",K&&"bg-accent/40"),children:[n.jsx("input",{type:"checkbox","aria-label":`Select ${V.name}`,checked:K,onChange:()=>b(z=>K?z.filter(L=>L!==V.name):[...z,V.name]),className:"size-3.5"}),n.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx("span",{className:Ve("size-2 shrink-0 rounded-[3px]",Za(V.phase).cell),"aria-hidden":"true"}),n.jsx("span",{className:"truncate font-mono text-xs",children:V.name})]}),n.jsx("fieldset",{disabled:C,"aria-label":`Groups for ${V.name}`,className:"min-w-0",children:n.jsx(cc,{multiple:!0,allowCreate:!1,groups:k,value:q,onChange:z=>{const L=z.filter(ee=>!q.includes(ee)),X=q.filter(ee=>!z.includes(ee));B([V.name],L.length?L:X,L.length?"add":"remove")}})}),n.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:W.map(z=>z.name).join(`
528
+ `),children:W.length?W.map(z=>z.name).join(", "):n.jsx("span",{className:"text-faint",title:"Its policy and agent rules still apply",children:"No network rules"})})]},V.name)}),!H.length&&n.jsxs("li",{className:"px-6 py-8 text-center text-xs text-muted-foreground",children:["No sandbox matches “",h,"”."]})]})]})}):n.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."})]})]}),P,n.jsx(LD,{group:k.find(V=>V.id===f)??null,org:a,sandboxes:M,onClose:()=>m(null),onChanged:R,onPolicy:A})]}):n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[n.jsx(PD,{onCreate:()=>u(!0),onPolicy:()=>e("egress")}),P]})}function zJ({combined:e,...t}){return e?n.jsx(IJ,{...t}):n.jsx(DJ,{...t})}function IJ({onNavigate:e}){const t=Uu(["org"]),[r,a]=x.useState(!1),[i,c]=x.useState(null),[u,f]=x.useState(""),[m,h]=x.useState(!1),[g,p]=x.useState([]),[b,v]=x.useState([]),[w,C]=x.useState(!1),S=t.sources.flatMap(B=>{var P,V;return(((V=(P=B.data)==null?void 0:P.org)==null?void 0:V.groups)??[]).map(q=>({...q,location:B.location,sourceOrg:B.data.org}))}),N=xf("groups",S),E=mx(S,t.apiFor,t.refresh),T=B=>{var P,V;return(V=(P=t.sources.find(q=>q.location.id===B.id))==null?void 0:P.data)==null?void 0:V.org},R=t.inventory.sandboxes.filter(B=>B.phase!=="deleting"),M=R.filter(B=>ir(T(B.location),B.name).length).length,A=R.filter(B=>!u||[B.name,...ir(T(B.location),B.name).map(P=>{var V,q;return((q=(V=T(B.location))==null?void 0:V.groups.find(W=>W.id===P))==null?void 0:q.name)??""})].join(" ").toLowerCase().includes(u.toLowerCase())),k=R.filter(B=>g.includes(ht(B))),O=k.length>0&&k.every(B=>B.location.id===k[0].location.id),D=O?k[0].location.id:null;x.useEffect(()=>v([]),[D]);const _=O?T(k[0].location):null;async function H(B,P,V){C(!0);try{Of(await t.apiFor(B[0].location).setGroupMembers(B.map(q=>q.name),P,V),"Updated groups"),p([]),await t.refresh()}catch(q){He.error(q.message)}finally{C(!1)}}const G=r&&n.jsx(Dx,{onClose:()=>a(!1),children:(B,P)=>{const V=T(B);return n.jsx(_D,{open:!0,onOpenChange:q=>{q||P()},groups:(V==null?void 0:V.groups)??[],assignments:(V==null?void 0:V.assignments)??{},sandboxes:R.filter(q=>q.location.id===B.id),onCreated:async(q,W,K)=>{await t.refresh(),P(),He.success(`Created ${q.name}`)}})}});return t.loading&&!t.sources.length?n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Reading groups…"}):t.status.unavailable?n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[n.jsx(Mu,{model:t,what:"groups"}),n.jsx("p",{className:"py-24 text-center text-sm text-muted-foreground",children:"Groups unavailable"})]}):n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 pt-4 pb-3 sm:px-6",children:[[["Groups",N.length],["In a group",M],["No group",R.length-M]].map(([B,P])=>n.jsxs("div",{className:"rounded-md px-3 py-1.5",children:[n.jsx("span",{className:"block text-[11px] text-muted-foreground",children:B}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none",children:P})]},B)),n.jsxs(le,{size:"sm",className:"ml-auto bg-[var(--action)] text-[var(--action-foreground)]",onClick:()=>a(!0),children:[n.jsx(vs,{}),"New group"]})]}),n.jsx(Mu,{model:t,what:"groups"}),n.jsx("section",{"aria-label":"Groups",className:"grid gap-3 px-4 py-5 sm:grid-cols-2 sm:px-6 xl:grid-cols-3",children:N.map(B=>{var P;return n.jsxs("div",{className:"relative flex min-w-0 flex-col gap-2",children:[n.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[n.jsx(fx,{record:B}),B.location.connected===!1&&n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Offline"})]}),n.jsx($D,{group:B,members:((P=B.sourceOrg.members)==null?void 0:P[B.id])??[],policies:Rw(B.sourceOrg.policies,B.id),disabled:!B.location.connected,onOpen:()=>c(B),delay:0})]},ht(B))})}),!N.length&&!t.status.any&&n.jsx(PD,{onCreate:()=>a(!0),onPolicy:()=>e("egress")}),n.jsxs("section",{"aria-label":"Sandboxes and their groups",className:"border-t",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-3 sm:px-6",children:[n.jsxs(le,{variant:"ghost",size:"sm","aria-expanded":m,onClick:()=>h(!m),children:[n.jsx(Lr,{className:m?"rotate-90":""}),"Sandboxes ",R.length]}),m&&n.jsx(yo,{className:"ml-auto w-full sm:w-56","aria-label":"Search sandboxes",value:u,onValueChange:f,placeholder:"Search sandboxes…"})]}),m&&n.jsxs(n.Fragment,{children:[k.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-y bg-accent/30 px-6 py-2 text-xs",children:[n.jsxs("span",{children:[k.length," selected"]}),O?n.jsxs(n.Fragment,{children:[n.jsx(cc,{multiple:!0,allowCreate:!1,groups:(_==null?void 0:_.groups)??[],value:b,onChange:v}),n.jsx(le,{size:"sm",disabled:w||!b.length||!k[0].location.connected,onClick:()=>H(k,b,"add"),children:"Add to groups"}),n.jsx(le,{size:"sm",variant:"outline",disabled:w||!b.length||!k[0].location.connected,onClick:()=>H(k,b,"remove"),children:"Remove from groups"})]}):n.jsx("span",{className:"text-muted-foreground",children:"Select sandboxes from one source to change their groups."}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>p([]),children:"Clear"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{"aria-label":"Sandboxes and groups",className:"w-full min-w-[640px] text-left text-xs",children:[n.jsx("thead",{className:"border-y bg-muted text-muted-foreground",children:n.jsx("tr",{children:["","Sandbox","Source","Groups","Network rules"].map((B,P)=>n.jsx("th",{className:"px-4 py-2 font-normal",children:B},P))})}),n.jsxs("tbody",{className:"divide-y",children:[A.map(B=>{var K;const P=T(B.location),V=ir(P,B.name),q=ht(B),W=c4((P==null?void 0:P.policies)??[],{name:B.name,groups:V,setups:((K=P==null?void 0:P.setupMembers)==null?void 0:K[B.name])??[]});return n.jsxs("tr",{className:"bg-card",children:[n.jsx("td",{className:"px-4",children:n.jsx("input",{type:"checkbox","aria-label":`Select ${B.name} at ${B.location.label}`,disabled:!B.location.connected,checked:g.includes(q),onChange:()=>p(J=>J.includes(q)?J.filter(z=>z!==q):[...J,q])})}),n.jsx("td",{className:"px-4 py-3 font-mono",children:B.name}),n.jsx("td",{className:"px-4",children:n.jsx(Hs,{location:B.location})}),n.jsx("td",{className:"px-4",children:n.jsx("fieldset",{disabled:w||!B.location.connected,children:n.jsx(cc,{multiple:!0,allowCreate:!1,groups:(P==null?void 0:P.groups)??[],value:V,onChange:J=>{const z=J.filter(X=>!V.includes(X)),L=V.filter(X=>!J.includes(X));H([B],z.length?z:L,z.length?"add":"remove")}})})}),n.jsx("td",{className:"px-4 text-muted-foreground",children:W.map(J=>J.name).join(", ")||"No network rules"})]},q)}),!A.length&&n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:u?`No sandbox matches “${u}”.`:"No sandboxes yet."})})]})]})})]})]}),G,i&&n.jsx(Zn,{location:i.location,children:n.jsx(hx,{record:i,type:"groups",offer:E.offer,children:n.jsx(LD,{sourceControl:n.jsx(wf,{record:i,onChange:B=>c({...B,...S.find(P=>ht(P)===ht(B)),copies:i.copies})}),group:i,org:T(i.location),sandboxes:R.filter(B=>B.location.id===i.location.id),onClose:()=>c(null),onChanged:async()=>{var V,q,W;const B=await t.refresh(),P=(W=(q=(V=B==null?void 0:B.find(K=>K.location.id===i.location.id))==null?void 0:V.data)==null?void 0:q.org)==null?void 0:W.groups.find(K=>K.id===i.id);P&&c({...i,...P})},onPolicy:B=>{ID({...B,location:i.location}),e("egress",i.location)}},ht(i))})}),E.dialog]})}const PJ=({className:e,size:t=50,delay:r=0,duration:a=6,colorFrom:i="#ffaa40",colorTo:c="#9c40ff",transition:u,style:f,reverse:m=!1,initialOffset:h=0,borderWidth:g=1})=>n.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:n.jsx($n.div,{className:Ve("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":i,"--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}})}),_J=[{minutes:60,label:"1 hour"},{minutes:480,label:"8 hours"},{minutes:1440,label:"1 day"},{minutes:null,label:"Until I close it"}],LJ=[{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 $J(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 BJ(e=3e4){const[t,r]=x.useState(Date.now());return x.useEffect(()=>{const a=setInterval(()=>r(Date.now()),e);return()=>clearInterval(a)},[e]),t}function BD({value:e,onChange:t,label:r="Close automatically"}){return n.jsx("div",{role:"radiogroup","aria-label":r,className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:_J.map(a=>n.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 VJ({text:e}){const[t,r]=x.useState(!1);return n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Copy URL",onClick:async()=>{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)},children:t?n.jsx(Yn,{className:"size-3.5 text-emerald-600"}):n.jsx(Lf,{className:"size-3.5"})})}function UJ({service:e,visits:t,now:r,onChanged:a,remote:i,canExpose:c}){var w;const u=Pt(),[f,m]=x.useState(null),[h,g]=x.useState(!1),p=e.name||"default",b=t.filter(C=>C.verdict==="denied").length;async function v(C,S,N){m(C);try{await S(),He.success(N),a()}catch(E){He.error(E.message)}finally{m(null),g(!1)}}return n.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border bg-card",children:[e.expiresAt&&Date.parse(e.expiresAt)-r<15*6e4&&n.jsx(PJ,{size:60,duration:8,colorFrom:"#f59e0b",colorTo:"#fde68a"}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-3",children:[n.jsx(X1,{strokeWidth:1.4,className:"size-4 text-emerald-600","aria-hidden":"true"}),n.jsx("span",{className:"font-mono text-[13px] font-medium",children:p}),n.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["→ port ",e.port]}),n.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-[11px]",children:[n.jsx(zk,{className:`size-3.5 ${e.expiresAt?"text-amber-600":"text-muted-foreground"}`,"aria-hidden":"true"}),e.expiresAt?n.jsxs("span",{className:"text-amber-800",children:["closes in ",$J(e.expiresAt,r)]}):n.jsx("span",{className:"text-muted-foreground",children:"no timer"})]})]}),i&&n.jsx("p",{className:"border-t border-border/70 px-4 py-2 text-[11px] text-muted-foreground",children:"Reachable by anyone with gateway access."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-border/70 px-4 py-2",children:[e.url?n.jsxs(n.Fragment,{children:[n.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}),n.jsx(VJ,{text:e.url}),n.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:n.jsx(VL,{className:"size-3.5"})})]}):n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"No URL"}),n.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",b?n.jsxs("span",{className:"text-red-600",children:[" · ",b," failed"]}):null]})]}),b>0&&((w=t[0])==null?void 0:w.verdict)==="denied"&&n.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,"."]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-border/70 px-4 py-2",children:[c&&(h?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-full sm:w-96",children:n.jsx(BD,{value:void 0,onChange:C=>v("extend",()=>u.extendService(e,C),C?"Timer reset":"Timer removed"),label:"New auto-close"})}),n.jsx(le,{size:"icon-xs",variant:"ghost",onClick:()=>g(!1),"aria-label":"Cancel",children:n.jsx(In,{})})]}):n.jsxs(le,{size:"xs",variant:"ghost",onClick:()=>g(!0),disabled:!!f,children:[n.jsx(zk,{}),"Change timer"]})),n.jsxs(le,{size:"xs",variant:"outline",className:"ml-auto border-destructive/30 text-destructive hover:bg-destructive/5 hover:text-destructive",disabled:!!f,onClick:()=>v("close",()=>u.closeService(e),`Closed ${p}`),children:[f==="close"?n.jsx(kt,{}):n.jsx(RA,{}),"Close now"]})]})]})}function HJ({sandbox:e,onOpened:t}){const r=Pt(),[a,i]=x.useState(""),[c,u]=x.useState(""),[f,m]=x.useState(60),[h,g]=x.useState(!1),[p,b]=x.useState(null);async function v(w){w.preventDefault(),g(!0),b(null);try{const C=await r.exposeService({sandbox:e,name:c.trim(),port:Number(a),closeAfterMinutes:f});He.success(`Opened ${c||"default"} on port ${a}`,{description:C.url??void 0}),i(""),u(""),t()}catch(C){b(C.message)}finally{g(!1)}}return n.jsxs("form",{onSubmit:v,className:"space-y-3 rounded-lg border border-dashed border-border p-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px] font-medium",children:"Open a port"}),LJ.map(w=>n.jsxs("button",{type:"button",onClick:()=>{i(String(w.port)),u(w.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(w.port)?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[w.label," ",n.jsx("span",{className:"font-mono opacity-60",children:w.port})]},w.port))]}),n.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[n.jsxs("div",{className:"grid w-24 gap-1",children:[n.jsx(zn,{htmlFor:"door-port",className:"text-[11px] text-muted-foreground",children:"Port"}),n.jsx(Ot,{id:"door-port",value:a,onChange:w=>i(w.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"})]}),n.jsxs("div",{className:"grid w-36 gap-1",children:[n.jsx(zn,{htmlFor:"door-name",className:"text-[11px] text-muted-foreground",children:"Name"}),n.jsx(Ot,{id:"door-name",value:c,onChange:w=>u(w.target.value.toLowerCase()),className:"h-8 font-mono text-xs",placeholder:"default"})]}),n.jsxs("div",{className:"min-w-72 flex-1",children:[n.jsx("span",{className:"mb-1 block text-[11px] text-muted-foreground",children:"Auto-close"}),n.jsx(BD,{value:f,onChange:m})]}),n.jsxs(le,{type:"submit",size:"sm",disabled:h||!a,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[h?n.jsx(kt,{}):n.jsx(X1,{}),"Open"]})]}),p&&n.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 hp={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 FJ(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 GJ({combined:e}){const t=gn();return e?n.jsx(qJ,{}):n.jsx(VD,{},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function VD({selectedSandbox:e}){var D,_,H,G,B;const t=Pt(),r=gn(),a=r?`ingress-scope:${r.context}`:"ingress-scope",i=oi(),c=BJ(),u=(i.sandboxes??[]).filter(P=>P.phase!=="deleting"),[f,m]=x.useState(()=>{try{return sessionStorage.getItem(a)}catch{return null}}),h=e??((D=u.find(P=>P.name===f))==null?void 0:D.name)??((_=u[0])==null?void 0:_.name)??null;x.useEffect(()=>{try{h&&sessionStorage.setItem(a,h)}catch{}},[h,a]);const[g,p]=x.useState(null),[b,v]=x.useState(null),[w,C]=x.useState("");x.useEffect(()=>{let P=!0;return v(null),C(""),t.capabilities().then(V=>{P&&v(V)}).catch(V=>{P&&C(V.message)}),()=>{P=!1}},[t]);const S=((H=b==null?void 0:b.features)==null?void 0:H.publicIngress)===!0,N=x.useCallback(()=>t.ingress().then(p).catch(P=>p({error:P.message})),[t]);x.useEffect(()=>{N();const P=setInterval(N,15e3);return()=>clearInterval(P)},[N]);const E=((g==null?void 0:g.services)??[]).filter(P=>P.sandbox===h),T=x.useMemo(()=>{const P={};for(const V of(g==null?void 0:g.services)??[])P[V.sandbox]=(P[V.sandbox]??0)+1;return P},[g]),R=x.useMemo(()=>FJ(i.events.filter(P=>P.kind==="inbound"&&P.sandbox===h)),[i.events,h]),M=P=>R.filter(V=>V.type==="visit"&&V.port===P&&Date.parse(V.at)>c-36e5),A=R.filter(P=>P.type==="session"||P.type==="command"),k=(G=g==null?void 0:g.sessions)==null?void 0:G.ttlSeconds,O=(g==null?void 0:g.error)??(i.sandboxes==null?((B=i.overview)==null?void 0:B.error)??(i.connection==="gateway-down"?"The gateway is unavailable.":null):null);return n.jsxs("div",{className:"flex h-full min-h-0",children:[!e&&n.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:[n.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Sandboxes"}),u.map(P=>n.jsxs("button",{onClick:()=>m(P.name),"aria-current":h===P.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 ${h===P.name?"bg-accent":"hover:bg-muted/60"}`,children:[n.jsx("span",{className:`size-2 shrink-0 rounded-[2px] ${Za(P.phase).cell}`,"aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px]",children:P.name}),T[P.name]?n.jsxs("span",{className:"rounded bg-emerald-50 px-1 font-mono text-[10px] text-emerald-800",title:"Open services",children:[T[P.name]," open"]}):n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:"closed"})]},P.id))]}),n.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:O?n.jsxs("div",{role:"alert",className:"grid justify-items-center gap-3 py-16 text-center text-sm text-muted-foreground",children:[n.jsx("p",{children:O}),n.jsx(le,{variant:"outline",size:"sm",onClick:()=>{N(),i.refresh()},children:"Retry"})]}):!g||i.sandboxes==null?n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"}):h?n.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:[n.jsxs("div",{className:"min-w-0 space-y-6",children:[!e&&n.jsx(pn,{value:h,onChange:P=>m(P.target.value),className:"h-8 rounded-md border border-input bg-transparent px-2 font-mono text-xs md:hidden","aria-label":"Sandbox",children:u.map(P=>n.jsx("option",{children:P.name},P.id))}),n.jsx(ho,{duration:.22,offset:3,blur:"1px",children:n.jsx("div",{className:`rounded-lg border p-5 ${E.length?"border-emerald-600/20 bg-emerald-50/40":"border-border bg-card"}`,children:n.jsxs("p",{className:"flex items-center gap-2 text-sm font-medium",children:[E.length?n.jsx(X1,{className:"size-4 text-emerald-600"}):n.jsx(RA,{className:"size-4 text-muted-foreground"}),E.length?`${E.length} service${E.length===1?"":"s"} open`:`${h} is closed`]})})}),n.jsxs("section",{className:"space-y-3",children:[n.jsxs("h2",{className:"flex items-center gap-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:[n.jsx(Q1,{className:"size-3"}),"Web services"]}),E.map(P=>n.jsx(UJ,{remote:g.auth.remote,canExpose:S,service:P,visits:M(P.port),now:c,onChanged:()=>{N(),i.refresh()}},`${P.sandbox}/${P.name}`)),S?n.jsx(HJ,{sandbox:h,onOpened:()=>{N(),i.refresh()}}):n.jsx("p",{role:"status",className:"rounded-lg border border-border bg-muted/20 px-4 py-3 text-xs text-muted-foreground",children:w?`Could not check service forwarding: ${w}`:b?"Public service forwarding is not available at this location. Terminal and file access remain available.":"Checking service forwarding…"})]}),n.jsxs("section",{className:"space-y-2",children:[n.jsxs("h2",{className:"flex items-center gap-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:[n.jsx(_A,{className:"size-3"}),"Terminal access"]}),n.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[n.jsx("p",{className:"px-4 py-3 text-[11px] text-muted-foreground",children:k===null?"Default session lifetime":k===0?"Sessions never expire":`Sessions expire after ${Math.round(k/60)} min`}),n.jsx("div",{className:"border-t border-border/70",children:A.length?A.slice(0,8).map(P=>n.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:[n.jsx("span",{className:"w-16 shrink-0 text-muted-foreground",children:new Date(P.at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),n.jsx("span",{children:hp[P.type](P)})]},`${P.at}|${P.message}`)):n.jsx("p",{className:"px-4 py-2.5 text-[11px] text-muted-foreground",children:"No recent sessions"})})]})]})]}),n.jsxs("aside",{className:"space-y-4",children:[n.jsxs("section",{className:"rounded-lg border border-border bg-card p-4",children:[n.jsxs("h3",{className:"flex items-center gap-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:[n.jsx(zu,{className:"size-3"}),"Access"]}),n.jsx("p",{className:"mt-2 text-[11px] leading-relaxed",children:g.auth.mode==="mtls"?"Client certificate (this Mac)":`Sign-in: ${g.auth.mode}`})]}),n.jsxs("section",{children:[n.jsx("h3",{className:"mb-2 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Recent inbound"}),n.jsx("ol",{className:"rounded-lg border border-border bg-card",children:R.length?R.slice(0,14).map(P=>{var V;return n.jsxs("li",{className:"flex items-start gap-2 border-b border-border/50 px-3 py-1.5 text-[11px] last:border-0",children:[n.jsx("span",{className:`mt-1.5 size-1.5 shrink-0 rounded-full ${P.verdict==="denied"?"bg-red-500":P.type.startsWith("service")?"bg-emerald-500":"bg-stone-400"}`,"aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 flex-1",children:((V=hp[P.type])==null?void 0:V.call(hp,P))??P.type}),n.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:Lu(P.at)})]},`${P.at}|${P.message}`)}):n.jsx("li",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:"Nothing yet."})})]})]})]}):n.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"No sandboxes yet."})})]})}function qJ(){const e=Uu(["ingress","capabilities"]),[t,r]=x.useState(null),[a,i]=x.useState(""),c=e.inventory.sandboxes.filter(u=>u.phase!=="deleting"&&u.name.toLowerCase().includes(a.toLowerCase()));return n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[n.jsx("div",{className:"flex items-center gap-2 border-b px-4 py-3 sm:px-6",children:n.jsx(yo,{className:"w-60","aria-label":"Search ingress",placeholder:"Search sandboxes…",value:a,onValueChange:i})}),n.jsx(Mu,{model:e,offline:!1}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[n.jsxs("table",{"aria-label":"Ingress",className:"w-full min-w-[560px] text-left text-xs",children:[n.jsx("thead",{className:"sticky top-0 border-b bg-muted text-muted-foreground",children:n.jsx("tr",{children:["Sandbox","Source","Web services","Access"].map(u=>n.jsx("th",{className:"h-9 px-6 font-normal",children:u},u))})}),n.jsx("tbody",{className:"divide-y",children:c.map(u=>{var g,p,b,v;const f=e.sources.find(w=>w.location.id===u.location.id),m=(f==null?void 0:f.location)??u.location,h=((p=(g=f==null?void 0:f.data)==null?void 0:g.ingress)==null?void 0:p.services.filter(w=>w.sandbox===u.name))??[];return n.jsxs("tr",{className:"bg-card hover:bg-muted/40",children:[n.jsx("td",{className:"px-6 py-3 font-mono",children:u.name}),n.jsx("td",{className:"px-6",children:n.jsx(Hs,{location:m})}),n.jsx("td",{className:"px-6 text-muted-foreground",children:f!=null&&f.data?((v=(b=f.data.capabilities)==null?void 0:b.features)==null?void 0:v.publicIngress)===!1?"Not supported":h.length?h.map(w=>`${w.name} · ${w.port}`).join(", "):"Closed":m.connected?"Loading…":"Offline"}),n.jsx("td",{className:"px-6",children:n.jsx(le,{variant:"ghost",size:"sm",disabled:!m.connected,onClick:()=>r({...u,location:m}),children:m.connected?"Manage access":"Offline"})})]},ht(u))})})]}),!c.length&&n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:e.inventory.loading?"Loading ingress…":"No matching sandboxes."})]}),t&&n.jsx(Lo,{open:!0,onOpenChange:u=>{u||(r(null),e.refresh())},children:n.jsxs(la,{className:"flex w-full flex-col gap-0 p-0 sm:max-w-5xl",children:[n.jsxs(ca,{className:"shrink-0 border-b px-6 py-4",children:[n.jsx(ua,{children:t.name}),n.jsx(da,{children:n.jsx(Hs,{location:t.location})})]}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Zn,{location:t.location,children:n.jsx(Rf,{children:n.jsx(VD,{selectedSandbox:t.name})})})})]})})]})}function YJ({tab:e,onNavigate:t,combined:r,requestedLocation:a}){const i=gn();return n.jsxs(nh,{value:e,onValueChange:c=>t(c,r?void 0:i),className:"h-[calc(100svh-3.5rem)] min-h-0 gap-0",children:[n.jsx("div",{className:"shrink-0 border-b bg-card px-4 sm:px-8",children:n.jsxs(sh,{variant:"line",className:"h-11! gap-5 p-0",children:[n.jsx(Pr,{value:"egress",className:"h-full px-0 text-xs after:bottom-0!",children:"Egress"}),n.jsx(Pr,{value:"ingress",className:"h-full px-0 text-xs after:bottom-0!",children:"Ingress"})]})}),n.jsx(Io,{value:"egress",className:"min-h-0",children:n.jsx($W,{onNavigate:t,combined:r,requestedLocation:a})}),n.jsx(Io,{value:"ingress",className:"min-h-0",children:n.jsx(GJ,{combined:r})})]})}const fy=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function vR(e,t,r=Date.now()){const a=new Map(t.map(i=>[i.id,i]));return e.map(i=>{const c=a.get(i.type),u=Object.values(i.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:i,profile:c,expiry:u,status:f,service:(c==null?void 0:c.name)??i.type,hosts:m,search:[i.name,i.type,c==null?void 0:c.name,...i.credentialKeys,...i.attachedTo,...m].join(" ").toLowerCase()}})}function KJ(e,{query:t,scope:r,service:a,expiry:i,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)&&(!i||f.status===i)).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?fy.compare(f.secret.name,m.secret.name):1;if(p===null)return-1;const b=typeof g=="number"?g-p:fy.compare(g,p);return(c.direction==="asc"?b:-b)||fy.compare(f.secret.name,m.secret.name)})}const XJ=[{id:"agent",label:"Agents"},{id:"inference",label:"Models"},{id:"code",label:"Code"}],UD=[{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_…"}],HD=e=>UD.find(t=>t.id===e)??null,WJ=e=>HD(e)?`/logos/${e}.svg`:null;function Lx({type:e,size:t="md",className:r}){const a=WJ(e),i=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 n.jsx("span",{className:Ve("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]",i,r),children:a?n.jsx("img",{src:a,alt:"","aria-hidden":"true",className:Ve("object-contain",c),draggable:!1}):n.jsx(zu,{strokeWidth:1.4,className:Ve("text-muted-foreground",c),"aria-hidden":"true"})})}function FD(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 QJ(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 ZJ(e,t){const r=FD(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??[],i=new Set(a.flatMap(u=>u.envVars??[])),c={};for(const[u,f]of Object.entries(t)){if(!i.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 JJ({query:e,setQuery:t,have:r,onPick:a,picking:i}){const c=e.trim().toLowerCase(),u=m=>!c||`${m.name} ${m.blurb} ${m.id}`.toLowerCase().includes(c),f=XJ.map(m=>({...m,items:UD.filter(h=>h.group===m.id&&u(h))})).filter(m=>m.items.length);return n.jsxs("div",{className:"space-y-3",children:[n.jsx(yo,{value:e,onValueChange:t,placeholder:"Search services","aria-label":"Search services",autoFocus:!0}),n.jsxs("div",{className:"-mx-1 max-h-[60svh] space-y-3 overflow-y-auto px-1 pt-1",children:[f.map(m=>n.jsxs("section",{children:[n.jsx("h3",{className:"mb-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:m.label}),n.jsx("div",{className:"grid grid-cols-3 gap-1.5 sm:grid-cols-4",children:m.items.map(h=>n.jsxs("button",{type:"button",onClick:()=>a(h),disabled:!!i,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:[i===h.id?n.jsx("span",{className:"flex size-6 items-center justify-center",children:n.jsx(kt,{className:"size-3.5"})}):n.jsx(Lx,{type:h.id,size:"sm"}),n.jsx("span",{className:"min-w-0 truncate text-[12px] font-medium",children:h.name}),r.has(h.id)&&n.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:n.jsx(Yn,{className:"size-2.5",strokeWidth:3})})]},h.id))})]},m.id)),!f.length&&n.jsxs("p",{className:"py-6 text-center text-[11px] text-muted-foreground",children:["No service matches “",e,"”."]})]})]})}function eee({service:e,profile:t,taken:r,sandboxes:a,onBack:i,onDone:c}){const u=Pt(),[f,m]=x.useState(()=>{const A=`my-${e.id}`;if(!r.has(A))return A;for(let k=2;;k++)if(!r.has(`${A}-${k}`))return`${A}-${k}`}),[h,g]=x.useState({}),[p,b]=x.useState([]),[v,w]=x.useState(!1),[C,S]=x.useState(null),N=t.endpoints.map(A=>A.host),E=QJ(t),T=FD(t),R=t.id==="codex"&&E.some(A=>A.key==="CODEX_AUTH_ACCESS_TOKEN");async function M(A){A.preventDefault(),w(!0),S(null);try{await u.createSecret({name:f,type:t.id,credentials:ZJ(t,h)}),g({});const k=[];for(const O of p)try{await u.attachSecret(f,O,!0)}catch{k.push(O)}He.success(`Stored ${f}`,{description:p.length?`Attached to ${p.filter(O=>!k.includes(O)).join(", ")||"none"}${k.length?` · failed: ${k.join(", ")}`:""}`:"Credential saved. Vendor connection not tested."}),c()}catch(k){S(k.message)}finally{w(!1)}}return n.jsxs("form",{onSubmit:M,autoComplete:"off",className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm",onClick:i,"aria-label":"Choose another service",children:n.jsx(K1,{})}),n.jsx(Lx,{type:e.id,size:"lg"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-[14px] font-medium",children:e.name}),n.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:e.blurb})]}),e.keyUrl&&!T&&n.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",n.jsx(Zi,{className:"size-3"})]})]}),R&&n.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. ",n.jsx("a",{className:"underline",href:e.helpUrl,target:"_blank",rel:"noreferrer",children:"Authentication guide"})]}),T&&n.jsx("p",{role:"status",className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5 text-xs leading-relaxed",children:T}),n.jsx("div",{className:"space-y-2.5",children:!T&&E.map((A,k)=>{const O=A.key;return n.jsxs("label",{className:"block",children:[n.jsxs("span",{className:"mb-1 flex items-baseline gap-2 text-[11px]",children:[n.jsxs("span",{className:"font-medium",children:[A.label,A.required?n.jsx("span",{className:"text-muted-foreground",children:" · required"}):n.jsx("span",{className:"font-normal text-muted-foreground",children:" · optional"})]}),n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:O})]}),n.jsxs("span",{className:"relative block",children:[n.jsx(Ok,{className:"absolute top-2.5 left-3 size-3.5 text-muted-foreground","aria-hidden":"true"}),n.jsx(Ot,{"aria-label":A.label,type:A.inputType,value:h[O]??"",onChange:D=>g(_=>({..._,[O]:D.target.value})),className:"h-9 pl-9 font-mono text-xs",placeholder:E.length===1&&e.keyHint?e.keyHint:A.placeholder,required:A.required,maxLength:8192,autoFocus:k===0,spellCheck:!1,autoComplete:"off"})]})]},O)})}),n.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5",children:[n.jsx("p",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Profile destinations"}),n.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:N.map(A=>n.jsx("span",{className:"rounded border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:A},A))}),n.jsxs("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:["Allowed program paths: ",t.binaries.join(", ")||"None declared",". These must match the programs installed in your sandbox."]})]}),!T&&n.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[n.jsxs("label",{className:"grid w-44 gap-1",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Name"}),n.jsx(Ot,{value:f,onChange:A=>m(A.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&&n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"mb-1 block text-[11px] text-muted-foreground",children:"Attach to"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:a.map(A=>{const k=p.includes(A.name);return n.jsxs("button",{type:"button","aria-pressed":k,onClick:()=>b(O=>k?O.filter(D=>D!==A.name):[...O,A.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 ${k?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[n.jsx("span",{className:`size-1.5 rounded-full ${k?"bg-emerald-500":"bg-stone-300"}`,"aria-hidden":"true"}),A.name]},A.id)})})]})]}),C&&n.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:C}),n.jsxs(le,{type:"submit",disabled:v||!!T,className:"h-9 w-full bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[v?n.jsx(kt,{}):n.jsx(Ok,{}),"Store ",e.name," secret"]})]})}function GD({open:e,onOpenChange:t,profiles:r,providers:a,sandboxes:i,reload:c}){const u=Pt(),f=Zs(),[m,h]=x.useState(""),[g,p]=x.useState(null),[b,v]=x.useState(null),[w,C]=x.useState(r);x.useEffect(()=>C(r),[r]),x.useEffect(()=>{e||(p(null),h(""),v(null))},[e]);const S=new Set(a.map(A=>A.type)),N=new Set(a.map(A=>A.name)),E=g&&w.find(A=>A.id===g.id);async function T(A){if(w.some(k=>k.id===A.id)){p(A);return}v(A.id);try{await u.importProfile(A.id);const k=await c();C((k==null?void 0:k.profiles)??w),p(A)}catch(k){He.error(`Couldn't set up ${A.name}: ${k.message}`)}finally{v(null)}}const R=g&&E?"key":"pick",M=f?{}:{initial:{opacity:0,x:R==="key"?12:-12},animate:{opacity:1,x:0},exit:{opacity:0,x:R==="key"?-12:12},transition:{duration:.16,ease:"easeOut"}};return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsxs(nn,{className:"gap-0 overflow-hidden p-0 sm:max-w-[580px]","aria-describedby":void 0,children:[n.jsxs("div",{className:"border-b border-border px-5 pt-4 pb-3",children:[n.jsx(Qt,{className:"text-[14px]",children:R==="pick"?"Add secret":"Add credentials"}),n.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:R==="pick"?"Pick the service it's for.":"Stored by the gateway. Saving does not verify the vendor connection."})]}),n.jsx("div",{className:"max-h-[75svh] overflow-y-auto p-5",children:n.jsx(lc,{mode:"wait",initial:!1,children:n.jsx($n.div,{...M,children:R==="pick"?n.jsx(JJ,{query:m,setQuery:h,have:S,onPick:T,picking:b}):n.jsx(eee,{service:g,profile:E,taken:N,sandboxes:i,onBack:()=>p(null),onDone:()=>{t(!1),c()}})},R)})})]})})}const tee={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"},nee=e=>(tee[e.authStyle]??(()=>"resolved by the proxy"))(e),see=e=>e&&Date.parse(e)-Date.now()<7*864e5;function ree({id:e,label:t,hint:r,value:a,onChange:i,required:c}){return n.jsxs("div",{className:"grid gap-1",children:[n.jsxs(zn,{htmlFor:e,className:"font-mono text-[11px]",children:[t,c&&n.jsx("span",{className:"text-red-600",children:" *"})]}),n.jsx(Ot,{id:e,type:"password",value:a,onChange:u=>i(u.target.value),autoComplete:"off",spellCheck:!1,className:"font-mono text-xs",placeholder:"Paste the value",required:c,title:r})]})}function oee({secret:e,onClose:t,onDone:r}){const a=Pt(),[i,c]=x.useState({}),[u,f]=x.useState(!1),[m,h]=x.useState(null);return x.useEffect(()=>{c({}),h(null)},[e]),n.jsx(tn,{open:!!e,onOpenChange:g=>{g||t()},children:n.jsx(nn,{className:"sm:max-w-md","aria-describedby":void 0,children:n.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,i);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:[n.jsx(sn,{children:n.jsxs(Qt,{children:["Rotate ",e==null?void 0:e.name]})}),e==null?void 0:e.credentialKeys.map(g=>n.jsx(ree,{id:`rot-${g}`,label:g,value:i[g]??"",onChange:p=>c(b=>({...b,[g]:p}))},g)),m&&n.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}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",onClick:t,children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:u||!Object.values(i).some(Boolean),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[u&&n.jsx(kt,{"aria-hidden":"true"}),"Rotate"]})]})]})})})}function aee({secret:e,keyName:t,onDone:r}){var h;const a=Pt(),i=(h=e.expires)==null?void 0:h[t],[c,u]=x.useState(!1),[f,m]=x.useState("");return c?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Ot,{type:"date",value:f,onChange:g=>m(g.target.value),className:"h-7 w-36 text-[11px]","aria-label":`Expiry for ${t}`}),n.jsx(le,{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"}),i&&n.jsx(le,{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"}),n.jsx(le,{size:"icon-xs",variant:"ghost",onClick:()=>u(!1),"aria-label":"Cancel",children:n.jsx(In,{})})]}):n.jsxs("button",{onClick:()=>{m(i?i.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 ${see(i)?"text-amber-700":"text-muted-foreground"}`,children:[n.jsx(SL,{className:"size-3"}),i?`expires ${jf(i)}`:"no expiry"]})}function iee({secret:e,profile:t,sandboxes:r,onRotate:a,onDelete:i,onDone:c}){var p;const u=Pt(),[f,m]=x.useState(!1),h=r.filter(b=>!e.attachedTo.includes(b.name));async function g(b,v){m(!0);try{await u.attachSecret(e.name,b,v),He.success(v?`Attached to ${b}`:`Detached from ${b}`),c()}catch(w){He.error(w.message)}finally{m(!1)}}return n.jsxs("div",{className:"bg-card",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border/70 px-4 py-3",children:[n.jsx(Lx,{type:e.type}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"truncate font-mono text-[13px] font-medium",children:e.name}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:((p=HD(e.type))==null?void 0:p.name)??(t==null?void 0:t.name)??e.type})]}),n.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[e.credentialKeys.length>0&&n.jsxs(le,{size:"sm",variant:"outline",onClick:a,children:[n.jsx(rl,{}),"Rotate"]}),n.jsx(le,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground hover:text-destructive",onClick:i,"aria-label":`Delete ${e.name}`,children:n.jsx(ts,{className:"size-3.5"})})]})]}),n.jsxs("div",{className:"grid gap-4 px-4 py-3 ",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("h4",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Credentials"}),e.credentialKeys.length===0&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"None. Access only."}),e.credentialKeys.map(b=>{const v=t==null?void 0:t.credentials.find(w=>w.envVars.includes(b));return n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("p",{className:"flex items-center gap-1.5 font-mono text-[11px]",title:v?nee(v):void 0,children:[n.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500","aria-hidden":"true"}),b]}),n.jsx("div",{className:"pl-3",children:n.jsx(aee,{secret:e,keyName:b,onDone:c})})]},b)})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("h4",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Allowed hosts"}),t?n.jsxs(n.Fragment,{children:[n.jsx("ul",{className:"space-y-0.5 font-mono text-[11px]",children:t.endpoints.map(b=>n.jsxs("li",{children:[b.host,b.port?`:${b.port}`:"",n.jsxs("span",{className:"font-sans text-[10px] text-muted-foreground",children:[" ",b.access??""]})]},`${b.host}:${b.port}`))}),n.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["by ",t.binaries.map(b=>b.split("/").pop()).filter((b,v,w)=>w.indexOf(b)===v).join(", ")||"any program"]})]}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Profile not found."})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-border/70 px-4 py-2.5 text-[11px]",children:[n.jsx(DA,{className:"size-3 text-muted-foreground","aria-hidden":"true"}),n.jsx("span",{className:"text-muted-foreground",children:"Attached to"}),e.attachedTo.map(b=>n.jsxs("span",{className:"flex items-center gap-0.5 rounded bg-muted py-0.5 pr-0.5 pl-1.5 font-mono text-[10px]",children:[b,n.jsx("button",{onClick:()=>g(b,!1),disabled:f,"aria-label":`Detach from ${b}`,className:"rounded p-0.5 text-muted-foreground outline-none hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(In,{className:"size-2.5"})})]},b)),!e.attachedTo.length&&n.jsx("span",{className:"text-muted-foreground/70",children:"no sandbox"}),h.length>0&&n.jsxs(pn,{value:"",disabled:f,onChange:b=>b.target.value&&g(b.target.value,!0),"aria-label":"Attach to a sandbox",className:"ml-auto h-7 rounded-md border border-input bg-transparent px-1.5 text-[11px] text-muted-foreground",children:[n.jsx("option",{value:"",children:"Attach to…"}),h.map(b=>n.jsx("option",{value:b.name,children:b.name},b.id))]}),f&&n.jsx(kt,{className:"size-3"})]})]})}const mp=[],pp=[{id:"name",label:"Secret",width:"22%"},{id:"source",label:"Source",width:"10%"},{id:"service",label:"Service",width:"14%"},{id:"credentials",label:"Credentials",width:"12%"},{id:"attached",label:"Sandboxes",width:"14%"},{id:"expiry",label:"Next expiry",width:"12%"},{id:"hosts",label:"Allowed hosts",width:"12%"}],lee={none:"No expiry",expired:"Expired",expiring:"Within 7 days",scheduled:"Scheduled"};function cee(){const e=Uu(["secrets"]);return n.jsx(qD,{model:e})}function uee({combined:e}){const t=gn();return e?n.jsx(cee,{}):n.jsx(qD,{},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function qD({model:e}){const t=Pt(),r=gn(),a=oi(),[i,c]=x.useState(null),u=e?e.loading&&!e.sources.length||e.status.unavailable?null:{providers:mp,profiles:mp,sources:e.sources}:i,[f,m]=x.useState(null),h=e?e.status.unavailable:f&&!u,[g,p]=x.useState(!1),[b,v]=x.useState(!1),[w,C]=x.useState(null),[S,N]=x.useState(null),[E,T]=x.useState(null),[R,M]=x.useState(""),[A,k]=x.useState("all"),[O,D]=x.useState(""),[_,H]=x.useState(""),[G,B]=x.useState({key:"name",direction:"asc"}),[P,V]=x.useState(Date.now),q=x.useRef(null),W=x.useDeferredValue(R),K=x.useCallback(async()=>{p(!0);try{const Q=e?await e.refresh():await t.secrets();return e||c(Q),m(null),Q}catch(Q){return m(Q.message),null}finally{p(!1)}},[t,e==null?void 0:e.refresh]);x.useEffect(()=>{K()},[K]),x.useEffect(()=>{const Q=setInterval(()=>V(Date.now()),6e4),ie=oe=>{var pe;(oe.metaKey||oe.ctrlKey)&&oe.key.toLowerCase()==="k"&&!E&&!b&&!w&&!S&&(oe.preventDefault(),(pe=q.current)==null||pe.focus())};return window.addEventListener("keydown",ie),()=>{clearInterval(Q),window.removeEventListener("keydown",ie)}},[E,b,w,S]);const J=(u==null?void 0:u.providers)??mp,z=(u==null?void 0:u.profiles)??mp,L=x.useMemo(()=>e?e.sources.flatMap(Q=>{var ie,oe,pe,xe;return vR(((oe=(ie=Q.data)==null?void 0:ie.secrets)==null?void 0:oe.providers)??[],((xe=(pe=Q.data)==null?void 0:pe.secrets)==null?void 0:xe.profiles)??[],P).map(je=>({...je,secret:{...je.secret,location:Q.location}}))}):vR(J,z,P),[J,z,P,e==null?void 0:e.sources]),X=x.useMemo(()=>KJ(L,{query:W,scope:A,service:O,expiry:_,sort:G}),[L,W,A,O,_,G]),ee=x.useMemo(()=>{const Q=new Map(L.map(ie=>[ie.secret.type,ie.service]));return O&&!Q.has(O)&&Q.set(O,O),[...Q.entries()].sort((ie,oe)=>ie[1].localeCompare(oe[1]))},[L,O]),$=_x({count:X.length,rowHeight:40});x.useEffect(()=>{$.scrollToTop()},[W,A,O,_,G]);const U=L.find(Q=>ht(Q.secret)===E),F=(e?e.inventory.sandboxes:a.sandboxes??[]).filter(Q=>Q.phase!=="deleting"),Y=L.filter(Q=>Q.secret.attachedTo.length>0).length,ne=L.filter(Q=>Q.status==="expiring").length,te=L.filter(Q=>Q.status==="expired").length,ye=R||A!=="all"||O||_,ae=()=>{M(""),k("all"),D(""),H("")},ue=()=>{K(),a.refresh()},se="h-10 border-b border-border/60 px-4 py-0 align-middle text-muted-foreground";return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex h-[calc(100svh-3.5rem)] min-h-0 flex-col overflow-hidden",children:[n.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",L.length],["attached","Attached",Y],["unattached","Unattached",L.length-Y]].map(([Q,ie,oe])=>n.jsxs("button",{"aria-pressed":A===Q,onClick:()=>k(Q),className:`rounded-md px-3 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${A===Q?"bg-accent/70":"hover:bg-muted/60"}`,children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:ie}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Af,{value:oe})})]},Q)),n.jsx("div",{className:"ml-auto flex gap-1",children:[["expiring","Expiring in 7 days",ne],["expired","Expired",te]].map(([Q,ie,oe])=>n.jsxs("button",{"aria-pressed":_===Q,onClick:()=>H(_===Q?"":Q),className:`rounded-md px-3 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${_===Q?"bg-accent/70":"hover:bg-muted/60"}`,children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:ie}),n.jsx("span",{className:`mt-1 block font-mono text-lg leading-none tabular-nums ${oe?Q==="expired"?"text-red-600":"text-amber-700":"text-muted-foreground"}`,children:n.jsx(Af,{value:oe})})]},Q))})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 sm:px-6",children:[n.jsx(yo,{ref:q,value:R,onValueChange:M,placeholder:"Search name, sandbox, host…","aria-label":"Search secrets",className:"mr-auto w-full sm:w-72"}),n.jsxs(pn,{"aria-label":"Filter by service",value:O,onChange:Q=>D(Q.target.value),className:"h-8 max-w-44 rounded-md border border-border bg-card px-2 text-xs",children:[n.jsx("option",{value:"",children:"All services"}),ee.map(([Q,ie])=>n.jsx("option",{value:Q,children:ie},Q))]}),n.jsxs(pn,{"aria-label":"Filter by expiry",value:_,onChange:Q=>H(Q.target.value),className:"h-8 rounded-md border border-border bg-card px-2 text-xs",children:[n.jsx("option",{value:"",children:"Any expiry"}),Object.entries(lee).map(([Q,ie])=>n.jsx("option",{value:Q,children:ie},Q))]}),ye&&n.jsxs(le,{variant:"ghost",size:"sm",onClick:ae,children:[n.jsx(In,{}),"Clear"]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh secrets",disabled:g,onClick:ue,children:n.jsx(rl,{className:g?"animate-spin":""})}),n.jsxs(le,{size:"sm",disabled:!u,onClick:()=>v(!0),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(vs,{}),"Add secret"]})]}),f&&n.jsxs("div",{role:"alert",className:"flex items-center gap-3 border-b border-border px-6 py-2 text-xs text-red-600",children:[n.jsxs("span",{children:[u?"Could not refresh. Showing the last reading. ":"",f]}),n.jsx(le,{variant:"outline",size:"sm",onClick:K,children:"Retry"})]}),e&&n.jsx(Mu,{model:e,what:"secrets"}),n.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:!u&&!h?n.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Loading secrets…"}):X.length?n.jsxs("table",{"aria-label":"Secrets","aria-rowcount":X.length+1,className:"w-full min-w-[900px] table-fixed border-separate border-spacing-0 text-xs",children:[n.jsx("colgroup",{children:pp.map(Q=>n.jsx("col",{style:{width:Q.width}},Q.id))}),n.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:n.jsx("tr",{"aria-rowindex":1,children:pp.map(Q=>n.jsx("th",{scope:"col","aria-sort":G.key===Q.id?G.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:["hosts","source"].includes(Q.id)?Q.label:n.jsxs("button",{className:"flex h-9 w-full items-center gap-1.5 outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>B({key:Q.id,direction:G.key===Q.id&&G.direction==="asc"?"desc":"asc"}),children:[Q.label,G.key===Q.id&&(G.direction==="asc"?n.jsx(_f,{className:"size-3"}):n.jsx(Pf,{className:"size-3"}))]})},Q.id))})}),n.jsxs("tbody",{children:[$.paddingTop>0&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:pp.length,style:{height:$.paddingTop,padding:0}})}),X.slice($.start,$.end).map((Q,ie)=>{var oe;return n.jsxs("tr",{"aria-rowindex":$.start+ie+2,onClick:()=>{var pe;((pe=Q.secret.location)==null?void 0:pe.connected)!==!1&&T(ht(Q.secret))},className:"group cursor-pointer bg-card hover:bg-muted/60 focus-within:bg-muted/60",children:[n.jsx("td",{className:`${se} pl-6`,children:n.jsxs("button",{disabled:((oe=Q.secret.location)==null?void 0:oe.connected)===!1,"aria-haspopup":"dialog","aria-label":`Open ${Q.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:pe=>{pe.stopPropagation(),T(ht(Q.secret))},children:[n.jsx(Lx,{type:Q.secret.type,size:"sm"}),n.jsx("span",{title:Q.secret.name,className:"truncate font-medium text-foreground",children:Q.secret.name}),n.jsx(Zi,{className:"ml-auto size-3 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"})]})}),n.jsx("td",{className:se,children:n.jsx(Hs,{location:Q.secret.location??r})}),n.jsx("td",{className:se,children:n.jsx("span",{className:"block truncate",title:Q.service,children:Q.service})}),n.jsx("td",{className:se,children:n.jsx("span",{className:"font-mono text-[11px]",children:Q.secret.credentialKeys.length||"Access only"})}),n.jsx("td",{className:se,children:n.jsx("span",{className:"block truncate",title:Q.secret.attachedTo.slice(0,10).join(", "),children:Q.secret.attachedTo.length===1?Q.secret.attachedTo[0]:Q.secret.attachedTo.length?`${Q.secret.attachedTo.length.toLocaleString()} sandboxes`:"Unattached"})}),n.jsx("td",{className:se,children:n.jsxs("span",{className:Q.status==="expired"?"text-red-600":Q.status==="expiring"?"text-amber-700":"",title:Q.expiry?new Date(Q.expiry).toLocaleString():void 0,children:[Q.status==="expired"?"Expired · ":"",Q.expiry?new Date(Q.expiry).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):"No expiry"]})}),n.jsx("td",{className:se,children:n.jsx("span",{className:"block truncate font-mono text-[11px]",title:Q.hosts.join(", "),children:Q.hosts.length===1?Q.hosts[0]:Q.hosts.length?`${Q.hosts.length} hosts`:"-"})})]},ht(Q.secret))}),$.end<X.length&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:pp.length,style:{height:(X.length-$.end)*40,padding:0}})})]})]}):n.jsxs("div",{className:"py-20 text-center",children:[n.jsx(zu,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),n.jsx("p",{className:"text-sm",children:h?"Secrets unavailable":L.length?"No matching secrets":"No secrets yet"}),u&&(L.length>0||!(e!=null&&e.status.any))&&n.jsx(le,{variant:"outline",className:"mt-4",onClick:L.length?ae:()=>v(!0),children:L.length?"Clear filters":"Add secret"})]})}),n.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:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-medium text-foreground",children:X.length.toLocaleString()}),ye?` of ${L.length.toLocaleString()}`:""," secrets"]}),n.jsx("span",{className:"hidden sm:inline",children:"Click a row to inspect · ⌘K to search"})]})]}),n.jsx(Lo,{open:!!U,onOpenChange:Q=>{Q||T(null)},children:n.jsxs(la,{className:"w-full gap-0 sm:max-w-lg","aria-describedby":"secret-description",children:[n.jsxs(ca,{className:"border-b border-border px-4 py-4 pr-12",children:[n.jsx(ua,{children:"Secret details"}),n.jsx(da,{id:"secret-description",className:"text-xs",children:"Manage credentials, expiry, and sandbox access."})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:U&&n.jsx(Zn,{location:U.secret.location??r,children:n.jsx(iee,{secret:U.secret,profile:U.profile,sandboxes:F.filter(Q=>{var ie,oe;return!e||((ie=Q.location)==null?void 0:ie.id)===((oe=U.secret.location)==null?void 0:oe.id)}),onRotate:()=>C(U.secret),onDelete:()=>N(U.secret),onDone:ue},ht(U.secret))})})]})}),!e&&n.jsx(GD,{open:b,onOpenChange:v,profiles:z,providers:J,sandboxes:F,reload:async()=>{const Q=await K();return a.refresh(),Q}}),e&&b&&n.jsx(Dx,{onClose:()=>v(!1),children:(Q,ie)=>n.jsx(dee,{model:e,location:Q,onClose:ie})}),n.jsx(Zn,{location:(w==null?void 0:w.location)??r,children:n.jsx(oee,{secret:w,onClose:()=>C(null),onDone:ue})}),n.jsx(Fr,{open:!!S,onOpenChange:Q=>{Q||N(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",S==null?void 0:S.name,"?"]}),n.jsx(Xr,{children:S!=null&&S.attachedTo.length?`Detach from ${S.attachedTo.join(", ")} first.`:"This cannot be undone."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:!!(S!=null&&S.attachedTo.length),onClick:async()=>{try{await(e?e.apiFor(S.location):t).deleteSecret(S.name),He.success(`Deleted ${S.name}`),ue()}catch(Q){He.error(Q.message)}finally{N(null)}},children:"Delete"})]})]})})]})}function dee({model:e,location:t,onClose:r}){const a=Pt(),[i,c]=x.useState(null),[u,f]=x.useState(null);return x.useEffect(()=>{let m=!0;return a.secrets().then(h=>{m&&c(h)}).catch(h=>{m&&f(h.message)}),()=>{m=!1}},[a]),i?n.jsx(GD,{open:!0,onOpenChange:m=>{m||r()},profiles:(i==null?void 0:i.profiles)??[],providers:(i==null?void 0:i.providers)??[],sandboxes:e.inventory.sandboxes.filter(m=>m.location.id===t.id),reload:async()=>{const m=await a.secrets();return e.refresh(),m}}):n.jsx(tn,{open:!0,onOpenChange:m=>{m||r()},children:n.jsx(nn,{children:n.jsxs(sn,{children:[n.jsx(Qt,{children:"Add secret"}),n.jsx(Sn,{children:u||"Loading credentials…"})]})})})}async function fee(e,t,r,a={}){var u,f,m;const i=await CD(e,t.setups||[],null,{...a,expectedRevisions:t.setupRevisions});if((u=a.signal)!=null&&u.aborted)throw new DOMException("Preparation cancelled.","AbortError");const c=na({...t,setups:i.setups.map(h=>h.id),setupRevisions:Object.fromEntries(i.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 hee="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",YD=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>Ws.find(t=>t.id===e)).filter(Boolean),yR=Ws.filter(e=>!YD.includes(e)),wR={runtimes:"runtimes",repository:"repository",customAgents:"custom",base:"system",packages:"system",setup:"system",environment:"environment"};function nf({label:e,hint:t,htmlFor:r,children:a}){return n.jsxs("div",{className:"grid content-start gap-1.5",children:[n.jsx(zn,{htmlFor:r,className:"text-xs",children:e}),a,t&&n.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:t})]})}function jR({type:e="checkbox",name:t,checked:r,onChange:a,disabled:i,children:c}){return n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:e,name:t,checked:r,onChange:a,disabled:i,className:"peer sr-only"}),n.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 mee(e){const t=gn();return n.jsx(pee,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function pee({initial:e,draftKey:t,onClose:r,onStarted:a,onChangeLocation:i,sourceControl:c}){var xe,je,Ie;const u=Pt(),f=gn(),m=Zs(),[h,g]=x.useState(()=>na(e==null?void 0:e.recipe)),p=!!(e!=null&&e.replace),[b]=x.useState(()=>(e==null?void 0:e.baseline)??JSON.stringify(na(e==null?void 0:e.recipe))),[v,w]=x.useState(()=>new Set(Array.isArray(e==null?void 0:e.advanced)?e.advanced:e!=null&&e.advanced?["system","environment"]:na(e==null?void 0:e.recipe).customAgents.length?["custom"]:[])),C=ce=>({open:v.has(ce),onToggle:Te=>{const re=Te.currentTarget.open;w(fe=>re===fe.has(ce)?fe:new Set(re?[...fe,ce]:[...fe].filter(Re=>Re!==ce)))}}),[S,N]=x.useState(()=>!bg.some(ce=>ce.id===na(e==null?void 0:e.recipe).command)),[E,T]=x.useState(""),[R,M]=x.useState(!1),[A,k]=x.useState(!1),[O,D]=x.useState(""),_=x.useRef(null);x.useEffect(()=>()=>{var ce;return(ce=_.current)==null?void 0:ce.abort()},[]);const[H,G]=x.useState(null),[B,P]=x.useState(!1),[V,q]=x.useState(!1),W=h.source==="build",K=ce=>{Ax({...h,...ce})&&N(!1),g(Te=>na({...Te,...ce,...ce.setups?{setupRevisions:Object.fromEntries(Object.entries(Te.setupRevisions||{}).filter(([re])=>ce.setups.includes(re)))}:{}}))},J=JSON.stringify(h)!==b,z=YY(h);x.useEffect(()=>{try{sessionStorage.setItem(t,JSON.stringify({recipe:h,replace:p,baseline:b,advanced:[...v]}))}catch{}},[t,h,p,b,v]);const L=zp(f),[X,ee]=x.useState({loading:L,value:null,error:""}),[$,U]=x.useState(0),[F]=x.useState(()=>na(e==null?void 0:e.recipe).setups);x.useEffect(()=>{if(!L)return;let ce=!0;return ee({loading:!0,value:null,error:""}),u.syncLocalCatalog().then(Te=>{ce&&ee({loading:!1,value:Te,error:""})}).catch(Te=>{ce&&ee({loading:!1,value:null,error:Te.message})}),()=>{ce=!1}},[u,L,$]),x.useEffect(()=>{let ce=!0;return u.localImages().then(Te=>{ce&&G(Te)}).catch(Te=>{ce&&G({images:[],error:Te.message})}),()=>{ce=!1}},[u]),x.useEffect(()=>{const ce=Te=>{J&&(Te.preventDefault(),Te.returnValue="")};return window.addEventListener("beforeunload",ce),()=>window.removeEventListener("beforeunload",ce)},[J]);function Y(ce){var fe;const Te=h.agents.includes(ce)?h.agents.filter(Re=>Re!==ce):Ws.filter(Re=>Re.id===ce||h.agents.includes(Re.id)).map(Re=>Re.id),re=!S&&(h.command===""?h.agents.length===0:Ws.some(Re=>Re.command===h.command));Te.length>1&&N(!1),K({agents:Te,...re?{command:((fe=Ws.find(Re=>Re.id===Te[0]))==null?void 0:fe.command)??""}:{}})}const ne=ce=>K({runtimes:h.runtimes.includes(ce)?h.runtimes.filter(Te=>Te!==ce):[...h.runtimes,ce]}),te=[w1(h).some(ce=>ce.npm)&&!h.runtimes.includes("node")&&"Node.js 22",w1(h).some(ce=>ce.python)&&!h.runtimes.includes("python")&&"Python 3"].filter(Boolean),ye=bg.filter(ce=>{var Te;return!W||ce.id===""||h.agents.includes((Te=Ws.find(re=>re.command===ce.id))==null?void 0:Te.id)}),ae=[...j1.filter(ce=>h.runtimes.includes(ce.id)).map(ce=>ce.name),...te].join(", "),ue=[(xe=xg.find(ce=>ce.id===h.base))==null?void 0:xe.name,`${h.packages.length} ${h.packages.length===1?"package":"packages"}`,h.setup.trim()&&"setup commands"].filter(Boolean).join(" · "),se=h.environment.length?`${h.environment.length} ${h.environment.length===1?"variable":"variables"}`:"";async function Q(ce){ce.preventDefault();const Te=Object.entries(z)[0]??(S&&!h.command.trim()?["command","Enter a start command, or pick one of the options."]:null);if(Te){wR[Te[0]]&&w(fe=>new Set([...fe,wR[Te[0]]])),T(Te[1]);return}if(R||(f==null?void 0:f.connected)===!1)return;M(!0),k(!0),T(""),D("");const re=new AbortController;_.current=re;try{const fe=await fee(u,h,p,{signal:re.signal,onProgress:D,onPrepared:()=>k(!1)});en.templateStarted(fe,f),a(fe)}catch(fe){fe.name!=="AbortError"&&T(fe.message)}finally{M(!1),k(!1),D(""),_.current=null}}function ie(){const ce=URL.createObjectURL(new Blob([S1(h)],{type:"text/plain"})),Te=document.createElement("a");Te.href=ce,Te.download="Dockerfile",Te.click(),URL.revokeObjectURL(ce)}function oe(){R||(J?q(!0):r())}const pe=(ce=0)=>({initial:m?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,delay:ce,ease:[.22,1,.36,1]}});return n.jsx(tn,{open:!0,onOpenChange:ce=>{ce||oe()},children:n.jsx(nn,{className:"max-h-[90svh] gap-4 bg-transparent p-0 ring-0 sm:max-w-4xl",children:n.jsxs("form",{onSubmit:Q,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:[n.jsxs(nh,{value:h.source,onValueChange:ce=>{K({source:ce}),ce==="build"&&h.agents.length>1&&N(!1),T("")},className:"contents",children:[n.jsxs(sn,{className:"shrink-0 gap-3 px-5 pt-5 pb-4 @3xl:px-7 @3xl:pt-6",children:[i&&n.jsx("div",{className:"pr-8",children:n.jsx(Iw,{step:2,subject:"template"})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 pr-8",children:[n.jsx(Qt,{className:"truncate",children:p?`Edit ${h.name}`:"New template"}),i?n.jsx(b4,{location:f,onChange:i}):n.jsx(ga,{location:f}),n.jsxs(sh,{className:"ml-auto w-fit","aria-label":"Template image source",children:[n.jsx(Pr,{value:"build",className:"px-3 text-xs",children:"Build an image"}),n.jsx(Pr,{value:"image",className:"px-3 text-xs",children:"Existing image"})]})]}),n.jsx(Sn,{className:"text-xs",children:W?"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."}),n.jsx("fieldset",{disabled:R||JSON.stringify(h)!==JSON.stringify(na(e==null?void 0:e.recipe)),children:c}),(f==null?void 0:f.connected)===!1&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"This location is disconnected. Choose a connected location to save a template."})]}),n.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:n.jsxs("fieldset",{disabled:R||(f==null?void 0:f.connected)===!1,className:"contents",children:[n.jsxs($n.div,{...pe(),className:"grid min-w-0 content-start gap-6 p-5 @3xl:overflow-y-auto @3xl:p-7",children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"template-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"template-name",value:h.name,disabled:p,maxLength:19,onChange:ce=>K({name:ce.target.value.toLowerCase()}),placeholder:"frontend-app",className:"h-10 font-mono text-sm",autoFocus:!p,"aria-invalid":E&&z.name&&h.name?!0:void 0}),h.name&&z.name&&n.jsx("p",{className:"text-[11px] text-destructive",children:z.name})]}),W?n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Agents"}),n.jsx("div",{className:"grid grid-cols-2 gap-2 @3xl:grid-cols-3",children:YD.map(ce=>n.jsxs(jR,{checked:h.agents.includes(ce.id),onChange:()=>Y(ce.id),children:[n.jsx("img",{src:ce.logo,alt:"",className:"size-4 shrink-0 object-contain"}),n.jsx("span",{className:"min-w-0 flex-1",children:ce.name}),h.agents.includes(ce.id)&&n.jsx(Yn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]},ce.id))}),n.jsxs(Fi,{children:[n.jsxs(Gi,{render:n.jsx(le,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[n.jsx("span",{className:"truncate",children:yR.filter(ce=>h.agents.includes(ce.id)).map(ce=>ce.name).join(", ")||"More agents"}),n.jsx(ha,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),n.jsx(qi,{align:"start",children:yR.map(ce=>n.jsxs(Bw,{checked:h.agents.includes(ce.id),onCheckedChange:()=>Y(ce.id),closeOnClick:!1,className:"text-xs",children:[n.jsx("img",{src:ce.logo,alt:"",className:"size-4 shrink-0 object-contain"}),ce.name]},ce.id))})]})]}):n.jsxs(nf,{label:"Image",htmlFor:"template-image",hint:H!=null&&H.error?H.error:"An image on the selected Docker engine, or a registry reference Docker is signed in to.",children:[n.jsx(Ot,{id:"template-image",value:h.image,onChange:ce=>K({image:ce.target.value.trim()}),placeholder:"ghcr.io/your-team/workspace:latest",className:"font-mono text-xs"}),((je=H==null?void 0:H.images)==null?void 0:je.length)>0&&n.jsxs(pn,{"aria-label":"Choose an available image",value:H.images.some(ce=>ce.reference===h.image)?h.image:"",onChange:ce=>K({image:ce.target.value}),className:"w-full text-xs",children:[n.jsx("option",{value:"",disabled:!0,children:"Choose an available image"}),H.images.map(ce=>n.jsx("option",{value:ce.reference,children:ce.reference},ce.reference))]})]}),n.jsx(gee,{starts:ye,recipe:h,custom:S,setCustom:N,patch:K}),E&&n.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:E})]}),n.jsxs($n.aside,{...pe(.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:[X.loading&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading your local MCPs & Skills…"}),((Ie=X.value)==null?void 0:Ie.available)&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Your local MCPs & Skills are available here. Existing remote templates keep their settings."}),X.error&&n.jsxs("div",{className:"grid gap-2",children:[n.jsxs("p",{role:"alert",className:"text-xs text-destructive",children:["Could not load your local MCPs & Skills: ",X.error]}),n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>U(ce=>ce+1),children:"Retry"})]}),!X.loading&&n.jsx(dD,{localCatalog:X.value,retained:F,autoPrepare:!0,preparationContext:"template",value:h.setups,onChange:ce=>K({setups:ce})}),n.jsxs("div",{className:"grid min-w-0",children:[W&&n.jsxs(Kl,{title:"Runtimes and tools",summary:ae,...C("runtimes"),children:[n.jsx("div",{className:"grid gap-2",children:j1.filter(ce=>!ce.retired||h.runtimes.includes(ce.id)).map(ce=>n.jsxs(jR,{checked:h.runtimes.includes(ce.id),onChange:()=>ne(ce.id),children:[n.jsx("img",{src:ce.logo,alt:"",className:`size-4 shrink-0 object-contain ${ce.id==="vscode"?"dark:invert":""}`}),n.jsx("span",{className:"min-w-0 flex-1",children:ce.name}),h.runtimes.includes(ce.id)&&n.jsx(Yn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]},ce.id))}),te.length>0&&n.jsxs("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:[te.join(" and ")," ",te.length>1?"are":"is"," included for the selected agents."]})]}),W&&n.jsx(Kl,{title:"Repository",summary:h.repository,...C("repository"),children:n.jsx(nf,{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:n.jsx(Ot,{id:"template-repository",value:h.repository,onChange:ce=>K({repository:ce.target.value.trim()}),placeholder:"https://github.com/your-team/project.git",className:"font-mono text-xs"})})}),W&&n.jsx(Kl,{title:"Custom agent",summary:h.customAgents.length?"Install command set":"",...C("custom"),children:n.jsx(bee,{agents:h.customAgents,onChange:ce=>{ce.length>h.customAgents.length&&N(!1),K({customAgents:ce,...ce.length>h.customAgents.length?{command:""}:{}})},error:E?z.customAgents:void 0})}),W&&n.jsxs(Kl,{title:"System",summary:ue,...C("system"),children:[n.jsx(nf,{label:"Operating system",htmlFor:"template-base",children:n.jsx(pn,{id:"template-base",value:h.base,onChange:ce=>K({base:ce.target.value}),className:"w-full text-xs",children:xg.map(ce=>n.jsx("option",{value:ce.id,children:ce.name},ce.id))})}),n.jsx(xee,{packages:h.packages,onChange:ce=>K({packages:ce})}),n.jsx(nf,{label:"Setup commands",htmlFor:"template-setup",hint:`Run with bash in ${h.repository?"/sandbox/project":"/sandbox"} as the sandbox user, at build time. A failing command stops the build.`,children:n.jsx(Hu,{id:"template-setup",value:h.setup,onChange:ce=>K({setup:ce.target.value}),rows:4,placeholder:h.runtimes.includes("python")?"pip install -r requirements.txt":"npm ci",className:"font-mono text-xs",spellCheck:!1})})]}),n.jsxs(Kl,{title:"Environment variables",summary:se,...C("environment"),children:[n.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."}),h.environment.map((ce,Te)=>n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx(Ot,{"aria-label":`Variable ${Te+1} name`,className:"min-w-0 flex-1 font-mono text-xs",value:ce.name,onChange:re=>K({environment:h.environment.map((fe,Re)=>Te===Re?{...fe,name:re.target.value}:fe)}),placeholder:"NODE_ENV"}),n.jsx(Ot,{"aria-label":`Variable ${Te+1} value`,className:"min-w-0 flex-1 font-mono text-xs",value:ce.value,onChange:re=>K({environment:h.environment.map((fe,Re)=>Te===Re?{...fe,value:re.target.value}:fe)}),placeholder:"development"}),n.jsx(le,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove variable ${Te+1}`,onClick:()=>K({environment:h.environment.filter((re,fe)=>fe!==Te)}),children:n.jsx(ts,{})})]},Te)),n.jsxs(le,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:h.environment.length>=40,onClick:()=>K({environment:[...h.environment,{name:"",value:""}]}),children:[n.jsx(vs,{}),"Add variable"]})]})]}),n.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."})]})]})}),(O||p)&&n.jsx("p",{role:O?"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:O||n.jsxs(n.Fragment,{children:[n.jsx(Du,{className:"size-3.5 shrink-0","aria-hidden":"true"}),W?"Rebuilding replaces this template.":"Saving replaces this template."," Sandboxes already running from it keep their current image."]})}),n.jsxs(Hr,{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:[W&&n.jsxs(le,{type:"button",variant:"ghost",className:"sm:mr-auto",onClick:()=>P(!0),children:[n.jsx(MA,{}),"View Dockerfile"]}),n.jsx(le,{type:"button",variant:"ghost",disabled:R&&!A,onClick:()=>{var ce;return A?(ce=_.current)==null?void 0:ce.abort():oe()},children:A?"Cancel preparation":"Cancel"}),n.jsxs(le,{type:"submit",className:hee,disabled:R||(f==null?void 0:f.connected)===!1,children:[R?n.jsx(kt,{}):n.jsx(J1,{}),A?"Preparing MCPs…":W?p?"Rebuild template":"Build template":"Save template"]})]})]}),n.jsx(tn,{open:B,onOpenChange:P,children:n.jsxs(nn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Generated Dockerfile"}),n.jsx(Sn,{children:"Setup commands are added as a separate build-context file."})]}),n.jsx("pre",{className:"overflow-x-auto rounded-md border bg-muted/30 p-4 font-mono text-[11px] leading-relaxed",children:W?S1(h):""}),n.jsxs(le,{type:"button",variant:"outline",onClick:ie,children:[n.jsx(pu,{}),"Download Dockerfile"]})]})}),n.jsx(tn,{open:V,onOpenChange:q,children:n.jsxs(nn,{children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Discard this template?"}),n.jsx(Sn,{children:"Your changes haven’t been built yet."})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>q(!1),children:"Keep editing"}),n.jsx(le,{type:"button",variant:"destructive",onClick:r,children:"Discard"})]})]})})]})})})}function gee({starts:e,recipe:t,custom:r,setCustom:a,patch:i}){const c=Ax(t),u=[...c?bg.filter(m=>m.id===""):e].sort((m,h)=>(m.id===""?-1:0)-(h.id===""?-1:0)),f=(m,h,g,p,b)=>n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:"radio",name:"template-open-in",checked:m,disabled:c,onChange:p,className:"peer sr-only"}),n.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,n.jsx("span",{className:"min-w-0 flex-1 font-medium",children:g}),n.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&&n.jsx("span",{className:"size-1.5 rounded-full bg-foreground"})})]})]},b);return n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Open in"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 @3xl:grid-cols-3",children:[u.map(m=>{const h=Ws.find(g=>g.command===m.id);return f(c||!r&&t.command===m.id,h?n.jsx("img",{src:h.logo,alt:"",className:"size-5 shrink-0 object-contain"}):n.jsx(n2,{"aria-hidden":"true",className:"size-5 shrink-0"}),m.name,()=>{a(!1),i({command:m.id})},m.id||"shell")}),!c&&f(r,n.jsx(MA,{"aria-hidden":"true",className:"size-5 shrink-0"}),"Custom command",()=>{r||(a(!0),i({command:""}))},"custom")]}),!c&&r&&n.jsx(Ot,{"aria-label":"Start command",value:t.command,onChange:m=>i({command:m.target.value}),placeholder:"npm run dev",className:"mt-2 font-mono text-xs"}),n.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 xee({packages:e,onChange:t}){const[r,a]=x.useState(""),i=x.useRef(null);function c(){const u=rE(r);u.length&&t([...new Set([...e,...u])]),a("")}return n.jsx(nf,{label:"System packages",htmlFor:"template-packages",hint:"Press Enter to add. Paste several separated by spaces, commas or new lines.",children:n.jsxs("div",{className:"rounded-lg border bg-background p-2",children:[e.length>0&&n.jsx("ul",{"aria-label":"System packages",className:"mb-3 flex flex-wrap gap-1.5",children:e.map(u=>n.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:[n.jsx("span",{className:"min-w-0 break-all font-mono text-[11px]",children:u}),n.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:n.jsx(In,{className:"size-3"})})]},u))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ot,{ref:i,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,...rE(h)])]),a("")}},placeholder:"jq, unzip…",className:"min-w-0 flex-1 font-mono text-xs",autoComplete:"off",spellCheck:!1}),n.jsxs(le,{type:"button",variant:"outline",size:"sm",onClick:()=>{var u;c(),(u=i.current)==null||u.focus()},children:[n.jsx(vs,{}),"Add"]})]})]})})}function bee({agents:e,onChange:t,error:r}){return n.jsxs("div",{className:"space-y-2",children:[n.jsx(zn,{htmlFor:"custom-agent-install",className:"text-xs",children:"Install command"}),n.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:[n.jsx(n2,{"aria-hidden":"true",className:"mt-2 size-3.5 shrink-0 text-muted-foreground"}),n.jsx(Hu,{id:"custom-agent-install",value:e.map(a=>a.install).join(`
529
+ `),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&&n.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:r})]})}const or=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),SR="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",io=e=>e.status==="building",gp=e=>e.status==="ready"||e.exists,vee=e=>io(e)?e.exists?"Rebuilding":"Building":e.status==="failed"?e.exists?"Rebuild failed":"Build failed":"Ready";function NR({record:e}){var t;return((t=e.location)==null?void 0:t.connected)===!1?n.jsxs("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-[11px] text-muted-foreground",children:[n.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/50"}),"Offline"]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-[11px]",children:[io(e)?n.jsx(kt,{className:"size-3 text-amber-600"}):n.jsx("span",{className:`size-1.5 rounded-full ${e.status==="failed"?"bg-amber-500":"bg-emerald-500"}`}),vee(e)]})}const CR=e=>{var t;return((t=bg.find(r=>r.id===e))==null?void 0:t.name)??e};function yee(){var Ie,ce,Te;const e=Pt(),t=js(),{templates:r,locations:a,error:i,refresh:c,loading:u}=vo(),[f,m]=x.useState(""),[h,g]=x.useState(""),[p,b]=x.useState(null),[v,w]=x.useState(null),C=v?Qv(or(v.location)):null,[S,N]=x.useState(null),[E,T]=x.useState(!1),[R,M]=x.useState(null),A=x.useRef(!1),[k,O]=x.useState(null),[D,_]=x.useState(null),[H,G]=x.useState(!1),B=x.useRef(!1),[P,V]=x.useState(()=>new Set),[q,W]=x.useState([]);x.useEffect(()=>{let re=!0;return e.contextKey().then(fe=>{re&&b(JSON.stringify([e.target,fe]))}).catch(fe=>He.error(fe.message)),()=>{re=!1}},[e]),x.useEffect(()=>{if(A.current||!p)return;const re=a.find(Re=>or(Re)===p);if(!(re!=null&&re.connected))return;A.current=!0;const fe=oE(Qv(or(re)));fe&&w(Re=>Re??{...fe,location:re})},[p,a]);const K=r.find(re=>ht(re)===S),J=re=>a.find(fe=>or(fe)===or(re.location))??re.location,z=a.length>1,L=re=>J(re).connected!==!1,X=re=>{if(!L(re))throw new Error(`${Dn(J(re))} is disconnected. Reconnect before continuing.`);return lr(t!=null&&t.localViewer?J(re).target??"local":e.target,e.signal,re.location.context)},ee=mx(r,re=>X({location:re}),c),$=xf("templates",r),U=xf("templates",r.filter(re=>(!z||!h||or(re.location)===h)&&`${re.name} ${re.image||""} ${re.recipe.repository||""}`.toLowerCase().includes(f.toLowerCase()))),F=U.filter(re=>!io(re)&&L(re)),Y=r.filter(re=>P.has(ht(re))&&!io(re)&&L(re)),ne=F.filter(re=>P.has(ht(re))).length,te=F.length>0&&ne===F.length;x.useEffect(()=>{const re=new Set(r.filter(fe=>!io(fe)&&(a.find(Re=>or(Re)===or(fe.location))??fe.location).connected!==!1).map(ht));V(fe=>new Set([...fe].filter(Re=>re.has(Re))))},[r,a]);function ye(re){V(fe=>{const Re=new Set(fe);return Re.has(re)?Re.delete(re):Re.add(re),Re})}function ae(){V(re=>{const fe=new Set(re);for(const Re of F)te?fe.delete(ht(Re)):fe.add(ht(Re));return fe})}async function ue(re){const fe=[];for(const Re of re)try{const Oe=await X(Re).imageTemplateUsage(Re.name);Oe.sandboxes.length&&fe.push({target:Re,message:"This template cannot be deleted while sandboxes use it.",sandboxes:Oe.sandboxes})}catch(Oe){fe.push({target:Re,message:Oe.message})}W(fe)}async function se(re){if(!B.current){B.current=!0,G(!0),W([]),N(null),O(re);try{await ue(re)}finally{B.current=!1,G(!1)}}}async function Q(re,fe){if(!B.current){B.current=!0,G(!0);try{await X(re).lifecycle(fe,"delete"),He.success(`Deleted sandbox ${fe}`),await ue(k),await c()}catch(Re){He.error(Re.message)}finally{B.current=!1,G(!1)}}}async function ie(){if(B.current||!(k!=null&&k.length))return;B.current=!0,G(!0),W([]);const re=new Set,fe=[],Re=new Map;try{for(const Oe of k)try{const ke=await X(Oe).deleteImageTemplate(Oe.name);re.add(ht(Oe));const he=ke==null?void 0:ke.imageCleanup,Ae=JSON.stringify([or(Oe.location),he==null?void 0:he.image]);(he==null?void 0:he.status)==="retained"?Re.set(Ae,{image:he.image,reason:he.reason,location:J(Oe)}):he!=null&&he.image&&Re.delete(Ae)}catch(ke){fe.push({target:Oe,message:ke.message,sandboxes:ke.sandboxes})}for(const{image:Oe,reason:ke,location:he}of Re.values())He.warning(ke,{description:`${Dn(he)} · ${Oe}`,duration:1e4});V(Oe=>new Set([...Oe].filter(ke=>!re.has(ke)))),N(Oe=>re.has(Oe)?null:Oe),W(fe),re.size&&He.success(`Deleted ${re.size} ${re.size===1?"template":"templates"}`),O(fe.length?k.filter(Oe=>!re.has(ht(Oe))):null),await c()}finally{B.current=!1,G(!1)}}function oe(re,fe,Re){L(re)&&(N(null),w({recipe:fe,replace:Re,location:J(re),record:re.copies?re:$.find(Oe=>Oe.copies.some(ke=>ht(ke)===ht(re)))?{...re,copies:$.find(Oe=>Oe.copies.some(ke=>ht(ke)===ht(re))).copies}:re}))}function pe(re){if(!(re!=null&&re.connected))return;const fe=oE(Qv(or(re)));w({...fe??{},location:re}),T(!1)}x.useEffect(()=>{if(!R)return;const re=a.find(Re=>Re.gateway===R&&Re.connected);if(re){M(null),pe(re);return}const fe=setInterval(c,1500);return()=>clearInterval(fe)},[R,a]);function xe(){try{sessionStorage.removeItem(C)}catch{}w(null)}async function je(re){try{await re(),await c()}catch(fe){He.error(fe.message)}}return n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[ee.dialog,v&&n.jsx(Zn,{location:J(v),children:n.jsx(hx,{record:v.record??{...v,name:(Ie=v.recipe)==null?void 0:Ie.name},type:"templates",offer:v.replace?ee.offer:()=>{},children:n.jsx(mee,{sourceControl:v.record&&n.jsx(wf,{record:v.record,onChange:re=>oe(re,re.recipe,!0)}),initial:v,draftKey:C,onClose:xe,onChangeLocation:v.replace?void 0:()=>{w(null),T(!0)},onStarted:re=>{N(ht({...re,location:v.location})),xe(),c()}},JSON.stringify([or(v.location),((ce=v.recipe)==null?void 0:ce.name)||"new"]))})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 py-3 sm:px-6",children:[n.jsx(yo,{"aria-label":"Search image templates",value:f,onValueChange:m,placeholder:"Search…",className:"mr-auto min-w-32 flex-1 sm:max-w-60"}),z&&n.jsxs(pn,{"aria-label":"Filter template location",value:h,onChange:re=>g(re.target.value),className:"h-8 rounded-md border bg-card px-2 text-xs",children:[n.jsx("option",{value:"",children:"All locations"}),a.map(re=>n.jsxs("option",{value:or(re),children:[Dn(re),or(re)===p?" (default)":"",re.connected===!1?" · disconnected":""]},or(re)))]}),n.jsxs(le,{size:"sm",className:SR,onClick:()=>T(!0),children:[n.jsx(vs,{}),"New template"]})]}),Y.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b bg-accent/30 px-4 py-2 sm:px-6",children:[n.jsxs("span",{role:"status",className:"mr-auto text-xs",children:[Y.length," selected",Y.length>ne&&n.jsxs("span",{className:"text-muted-foreground",children:[" · ",Y.length-ne," outside current filters"]})]}),n.jsx(le,{variant:"ghost",size:"sm",disabled:H,onClick:()=>V(new Set),children:"Clear selection"}),n.jsxs(le,{variant:"destructive",size:"sm",disabled:H,onClick:()=>se(Y),children:[n.jsx(ts,{}),"Delete selected"]})]}),i&&n.jsxs("div",{role:"alert",className:"px-4 py-4 text-xs sm:px-6",children:[n.jsx("p",{children:i}),n.jsx(le,{variant:"outline",size:"sm",className:"mt-3",onClick:c,children:"Try again"})]}),u&&!r.length?n.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 py-10 text-xs text-muted-foreground",children:[n.jsx(kt,{}),"Loading…"]}):U.length?n.jsx(ho,{duration:.15,offset:0,blur:"0px",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{"aria-label":"Image templates",className:"w-full min-w-[580px] text-left",children:[n.jsx("thead",{className:"border-b text-[11px] text-muted-foreground",children:n.jsxs("tr",{children:[n.jsx("th",{className:"w-10 px-4 py-2 sm:pl-6",children:n.jsx($o,{"aria-label":"Select all matching templates",checked:te,indeterminate:ne>0&&!te,disabled:H||!F.length,onCheckedChange:ae})}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Name"}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Source"}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Starts in"}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Image"}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Status"}),n.jsx("th",{className:"px-4 py-2",children:n.jsx("span",{className:"sr-only",children:"Actions"})})]})}),n.jsx("tbody",{className:"divide-y",children:U.map(re=>n.jsxs("tr",{className:P.has(ht(re))?"bg-accent/40 hover:bg-muted/40":"hover:bg-muted/40",children:[n.jsx("td",{className:"px-4 py-2 sm:pl-6",children:n.jsx($o,{"aria-label":`Select ${re.name} in ${Dn(J(re))}`,checked:P.has(ht(re)),disabled:H||io(re)||!L(re),onCheckedChange:()=>ye(ht(re))})}),n.jsx("td",{className:"max-w-72 px-4 py-2",children:n.jsxs("button",{className:"group flex max-w-full items-center gap-2 rounded text-left font-mono text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>N(ht(re)),children:[n.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:n.jsx(OA,{className:"size-4",strokeWidth:1.5})}),n.jsx("span",{className:"truncate group-hover:underline",children:re.name})]})}),n.jsx("td",{className:"px-4 py-2",children:n.jsx(fx,{record:re})}),n.jsx("td",{className:"px-4 py-2 text-[11px] text-muted-foreground",children:re.managed===!1?"-":CR(re.recipe.command)}),n.jsx("td",{className:"px-4 py-2",children:n.jsx("span",{className:"block max-w-64 truncate font-mono text-[11px] text-muted-foreground",title:re.image||"",children:re.image||(re.recipe.source==="image"?re.recipe.image:"Not built yet")})}),n.jsx("td",{className:"px-4 py-2",children:n.jsx(NR,{record:re})}),n.jsx("td",{className:"px-4 py-2 text-right sm:pr-6",children:n.jsxs("div",{className:"flex items-center justify-end gap-1",children:[!io(re)&&(re.status==="failed"||re.status==="ready"&&re.managed)&&n.jsxs(le,{variant:"ghost",size:"xs",disabled:!L(re),"aria-label":`Edit ${re.name} in ${Dn(J(re))}`,onClick:()=>oe(re,re.recipe,re.status==="ready"||!!re.exists),children:[n.jsx(Dk,{}),"Edit"]}),n.jsxs(le,{variant:"ghost",size:"xs",disabled:gp(re)&&!L(re),onClick:()=>gp(re)?_(re):N(ht(re)),children:[gp(re)?"Use template":io(re)?"View progress":"Details",n.jsx(mu,{})]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${re.name} in ${Dn(J(re))}`,title:io(re)?"Cancel the build before deleting this template":`Delete ${re.name}`,disabled:H||io(re)||!L(re),onClick:()=>se([re]),children:n.jsx(ts,{})})]})})]},ht(re)))})]})})}):n.jsxs("div",{className:"py-12 text-center text-xs text-muted-foreground",children:[n.jsx("p",{children:r.length?"No matching templates.":"No image templates yet."}),f&&n.jsx(le,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>m(""),children:"Clear search"})]}),n.jsx(tn,{open:!!K,onOpenChange:re=>{re||N(null)},children:n.jsx(nn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:K&&n.jsxs(n.Fragment,{children:[n.jsxs(sn,{children:[n.jsx(Qt,{className:"font-mono",children:K.name}),n.jsx(Sn,{children:K.managed===!1?"Created outside the console. Edit it with the openshell CLI.":"OpenShell sandbox template"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(wf,{record:{...K,copies:(Te=$.find(re=>re.copies.some(fe=>ht(fe)===ht(K))))==null?void 0:Te.copies},onChange:re=>N(ht(re))}),n.jsx(NR,{record:K})]}),!L(K)&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"This location is disconnected. Reconnect to use or change this template."}),n.jsx("dl",{className:"divide-y rounded-lg border px-4 text-xs",children:[["Image",n.jsx("span",{className:"break-all font-mono",children:K.image||(K.recipe.source==="image"?K.recipe.image:"Not built yet")},"i")],...K.managed===!1?[]:[["Starts in",CR(K.recipe.command)]],...K.recipe.source==="build"&&K.managed!==!1?[["Agents",[...K.recipe.agents.map(re=>{var fe;return(fe=Ws.find(Re=>Re.id===re))==null?void 0:fe.name}),...(K.recipe.customAgents??[]).map(re=>re.name)].join(", ")||"None"],["Repository",K.recipe.repository?n.jsx("span",{className:"break-all font-mono",children:K.recipe.repository},"r"):"None"]]:[],["Environment",K.recipe.environment.length?n.jsx("span",{className:"font-mono",children:K.recipe.environment.map(re=>re.name).join(", ")},"e"):"None"],["CLI",n.jsxs("code",{className:"font-mono",children:["openshell sandbox create --template ",K.name]},"c")]].map(([re,fe])=>n.jsxs("div",{className:"flex gap-4 py-2",children:[n.jsx("dt",{className:"w-24 shrink-0 text-muted-foreground",children:re}),n.jsx("dd",{className:"min-w-0",children:fe})]},re))}),K.error&&n.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:K.error}),K.logs&&n.jsxs("details",{open:io(K)||K.status==="failed",className:"overflow-hidden rounded-lg border",children:[n.jsx("summary",{className:"cursor-pointer bg-muted/35 px-3 py-2 text-xs",children:"Build log"}),n.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:K.logs})]}),n.jsx("div",{className:"flex flex-wrap items-center gap-2 border-t pt-4",children:io(K)?n.jsxs(le,{variant:"outline",disabled:!L(K),onClick:()=>je(()=>X(K).cancelImageBuild(K.name)),children:[n.jsx(In,{}),"Cancel build"]}):n.jsxs(n.Fragment,{children:[K.status==="failed"&&n.jsxs(le,{variant:"outline",size:"sm",disabled:!L(K),onClick:()=>oe(K,K.recipe,!!K.exists),children:[n.jsx(PA,{}),"Edit and retry"]}),K.status==="failed"&&K.exists&&n.jsx(le,{variant:"ghost",size:"sm",disabled:!L(K),onClick:()=>je(()=>X(K).dismissImageBuild(K.name)),children:"Dismiss"}),K.status==="ready"&&K.managed&&n.jsxs(le,{variant:"ghost",size:"sm",disabled:!L(K),onClick:()=>oe(K,K.recipe,!0),children:[n.jsx(Dk,{}),"Edit"]}),K.managed!==!1&&n.jsxs(le,{variant:"ghost",size:"sm",disabled:!L(K),onClick:()=>oe(K,{...K.recipe,name:`${K.name.slice(0,14)}-copy`},!1),children:[n.jsx(Lf,{}),"Duplicate"]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Delete image template",disabled:H||!L(K),onClick:()=>se([K]),children:n.jsx(ts,{})}),gp(K)&&n.jsxs(le,{className:`ml-auto ${SR}`,disabled:!L(K),onClick:()=>{_(K),N(null)},children:["Use template",n.jsx(mu,{})]})]})})]})})}),n.jsx(tn,{open:!!k,onOpenChange:re=>{!re&&!B.current&&O(null)},children:n.jsxs(nn,{className:"max-h-[85svh] overflow-y-auto",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["Delete ",(k==null?void 0:k.length)===1?"this template":`${(k==null?void 0:k.length)??0} templates`,"?"]}),n.jsx(Sn,{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."})]}),n.jsx("ul",{className:"max-h-40 overflow-y-auto text-xs",children:k==null?void 0:k.map(re=>n.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[n.jsx("span",{className:"font-mono",children:re.name}),n.jsx(ga,{location:J(re)})]},ht(re)))}),q.length>0&&n.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/5 p-3 text-xs",children:[n.jsxs("p",{children:["Cannot delete ",(k==null?void 0:k.length)===1?"this template":"these templates","."]}),n.jsx("ul",{className:"mt-2 space-y-3",children:q.map(re=>{var fe;return n.jsxs("li",{children:[n.jsxs("p",{children:[n.jsx("span",{className:"font-mono",children:re.target.name})," ",n.jsx(ga,{location:J(re.target)}),": ",re.message]}),((fe=re.sandboxes)==null?void 0:fe.length)>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-1 text-muted-foreground",children:"Delete the sandboxes below, then retry. Deleting a sandbox permanently removes its files."}),n.jsx("ul",{className:"mt-2 space-y-2",children:re.sandboxes.map(Re=>n.jsxs("li",{className:"flex items-center justify-between gap-3",children:[n.jsx("span",{className:"break-all font-mono",children:Re.name}),n.jsxs(le,{variant:"destructive",size:"sm",disabled:H||!L(re.target),"aria-label":`Delete sandbox ${Re.name} in ${Dn(J(re.target))}`,onClick:()=>Q(re.target,Re.name),children:[n.jsx(ts,{}),"Delete sandbox"]})]},ht({...Re,location:re.target.location})))})]})]},ht(re.target))})})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{variant:"ghost",disabled:H,onClick:()=>O(null),children:"Cancel"}),n.jsxs(le,{variant:"destructive",disabled:H||!(k!=null&&k.some(L)),onClick:ie,children:[H&&n.jsx(kt,{}),H?"Deleting…":q.length?"Retry deletion":(k==null?void 0:k.length)===1?"Delete template":"Delete templates"]})]})]})}),n.jsx(tn,{open:E,onOpenChange:re=>{T(re),re||M(null)},children:n.jsx(nn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:n.jsx(Ox,{locations:a,allowRemote:!!(t!=null&&t.localViewer),subject:"template",connecting:!!R,onPick:re=>pe(a.find(fe=>or(fe)===re)),onConnected:re=>{M(re.gateway),c()},onCancel:()=>T(!1)})})}),D&&n.jsx(Zn,{location:J(D),children:n.jsx(TD,{open:!0,initialImageTemplate:D,onOpenChange:re=>{re||_(null)},onStarted:()=>_(null)})})]})}const KD=x.createContext(void 0);function wee(){const e=x.useContext(KD);if(e===void 0)throw new Error(rn(63));return e}const jee="data-checked",See="data-unchecked",XD={...Lg,checked(e){return e?{[jee]:""}:{[See]:""}}},Nee=x.forwardRef(function(t,r){const{checked:a,className:i,defaultChecked:c,"aria-labelledby":u,form:f,id:m,inputRef:h,name:g,nativeButton:p=!1,onCheckedChange:b,readOnly:v=!1,required:w=!1,disabled:C=!1,render:S,uncheckedValue:N,value:E,style:T,...R}=t,{clearErrors:M}=Bg(),{state:A,setTouched:k,setDirty:O,validityData:D,setFilled:_,setFocused:H,validationMode:G,disabled:B,name:P,validation:V}=Pu(),{labelId:q}=Vf(),W=B||C,K=P??g,J=x.useRef(null),z=mo(J,h,V.inputRef),L=x.useRef(null),X=ys(),ee=Uf({id:m}),$=p?void 0:ee,[U,F]=po({controlled:a,default:!!c,name:"Switch",state:"checked"});$g(L,X,U,void 0,!W,g),We(()=>{_(U)},[U,_]),Ff(U,()=>{M(K),O(U!==D.initialValue),V.change(U)});const{getButtonProps:Y,buttonRef:ne}=bo({disabled:W,native:p}),te=GA(u,q,J,!p,$),ye={id:p?ee:X,role:"switch","aria-checked":U,"aria-readonly":v||void 0,"aria-required":w||void 0,"aria-labelledby":te,onFocus(){W||H(!0)},onBlur(){const Q=J.current;!Q||W||(k(!0),H(!1),G==="onBlur"&&V.commit(Q.checked))},onClick(Q){if(v||W)return;Q.preventDefault();const ie=J.current;ie&&hu(ie,Q)}},ae={...V.getValidationProps(W),checked:U,disabled:W,form:f,id:$,name:K,required:w,style:K?r2:_g,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:z,onChange(Q){if(Q.nativeEvent.defaultPrevented)return;if(v){Q.preventDefault();return}const ie=Q.currentTarget.checked,oe=yt(Ur,Q.nativeEvent);b==null||b(ie,oe),!oe.isCanceled&&F(ie)},onClick(Q){Q.stopPropagation()},onFocus(){var Q;(Q=L.current)==null||Q.focus()},...E!==void 0?{value:E}:En},ue=x.useMemo(()=>({...A,checked:U,disabled:W,readOnly:v,required:w}),[A,U,W,v,w]),se=Nt("span",t,{state:ue,ref:[r,L,ne],props:[ye,R,Y,Q=>V.getValidationProps(W,Q)],stateAttributesMapping:XD});return n.jsxs(KD.Provider,{value:ue,children:[se,!U&&K&&N!==void 0&&n.jsx("input",{type:"hidden",form:f,name:K,value:N,disabled:W}),n.jsx("input",{...ae,suppressHydrationWarning:!0})]})}),Cee=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=wee();return Nt("span",t,{state:f,ref:r,stateAttributesMapping:XD,props:u})});function kee({className:e,...t}){return n.jsx(Nee,{"data-slot":"switch",className:Ve("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:n.jsx(Cee,{"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 Tee=({children:e,className:t,shimmerWidth:r=100,...a})=>n.jsx("span",{style:{"--shiny-width":`${r}px`},className:Ve("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}),Eee=`Create a Linux VM I can connect to OpenRod (a sandbox console) over SSH.
530
+ 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.
531
+
532
+ Requirements:
533
+ - Ubuntu 22.04/24.04 LTS (or Debian 12), amd64 or arm64. A full VM, not a container.
534
+ - At least 2 vCPU, 4 GB RAM, 30 GB disk.
535
+ - 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.
536
+ - A non-root user with that key in ~/.ssh/authorized_keys.
537
+ - Docker Engine (rootful, the docker.io or docker-ce package), running and enabled. Not Docker Desktop, not rootless.
538
+ - Add that user to the docker group, so \`docker ps\` works without sudo.
539
+ - Python 3 installed.
540
+ - In sshd_config: AllowTcpForwarding yes and AllowStreamLocalForwarding yes, then restart sshd.
541
+ - Open the SSH port (22 or a custom one) to my IP in the firewall/security group.
542
+
543
+ Verify, from my machine: \`ssh <user>@<host> 'docker ps && python3 --version'\` succeeds with no password prompt.
544
+
545
+ When you're done, reply with ONLY this, nothing else:
546
+
547
+ - Display name: <short name for the VM>
548
+ - Hostname: <user>@<public IP or DNS>
549
+ - SSH port: <port, or 22>
550
+ - 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>"
551
+ - Host key fingerprint (ED25519): <output of \`ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub\` on the VM>
552
+ `;async function Ree(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 Aee={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 Mee({className:e}){const[t,r]=x.useState(!1),a=Zs();x.useEffect(()=>{if(!t)return;const u=setTimeout(()=>r(!1),2e3);return()=>clearTimeout(u)},[t]);const i=async u=>{await Ree(Eee,u.currentTarget)?r(!0):He.error("Couldn’t copy the prompt",{description:"Your browser blocked clipboard access."})},c=a?{}:{...Aee,transition:{duration:.18,ease:"easeOut"}};return n.jsx(Fu,{delay:300,children:n.jsxs(xa,{children:[n.jsxs(ba,{render:n.jsx(le,{type:"button",variant:"outline",size:"sm",onClick:i,"aria-label":t?"Prompt copied":"Copy a VM setup prompt for your AI agent",className:Ve("h-8 gap-1.5 px-3 text-xs",e)}),children:[n.jsx("span",{className:"relative grid size-3.5 place-items-center","aria-hidden":"true",children:n.jsx(lc,{initial:!1,mode:"popLayout",children:n.jsx($n.span,{className:"grid place-items-center",...c,children:t?n.jsx(Yn,{className:"size-3.5 text-emerald-600 dark:text-emerald-400"}):n.jsx(Lf,{className:"size-3.5"})},t?"check":"copy")})}),n.jsx(lc,{initial:!1,mode:"wait",children:n.jsx($n.span,{...a?{}:{initial:{opacity:0,y:3},animate:{opacity:1,y:0},exit:{opacity:0,y:-3},transition:{duration:.15}},children:t?n.jsx("span",{className:"text-foreground",children:"Copied — paste into your agent"}):n.jsx(Tee,{className:"mx-0 text-inherit motion-reduce:animate-none dark:text-inherit",children:"Need a VM? Copy agent prompt"})},t?"copied":"idle")}),n.jsx("span",{role:"status",className:"sr-only",children:t?"VM setup prompt copied to clipboard":""})]}),n.jsx(va,{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 kR={name:"",hostname:"",port:"",auth:"default",identityFile:""},Oee=[["default","SSH agent / default keys"],["identity","Key file"]];function Dee({open:e,onOpenChange:t,onAdded:r}){const[a,i]=x.useState(kR),[c,u]=x.useState(null),[f,m]=x.useState(!1),[h,g]=x.useState(null),p=x.useId();x.useEffect(()=>{e&&(i(kR),u(null),g(null),m(!1))},[e]);const b=N=>E=>{i(T=>({...T,[N]:E.target.value})),g(null)},v=a.name.trim()&&a.hostname.trim()&&(a.auth==="default"||a.identityFile.trim());async function w(N){m(!0),g(null);try{await N()}catch(E){g(E.message)}finally{m(!1)}}const C=N=>{N.preventDefault(),v&&!f&&w(async()=>u(await cs.scanSshHost(a)))},S=()=>w(async()=>{const N=await cs.addSshHost(c.token);r(N)});return n.jsx(tn,{open:e,onOpenChange:N=>{f||t(N)},children:n.jsxs(nn,{className:"sm:max-w-md","aria-describedby":void 0,children:[n.jsx(sn,{children:n.jsx(Qt,{children:c?"Trust this machine?":"Add SSH connection"})}),c?n.jsxs("div",{className:"grid gap-4 text-xs",children:[n.jsxs("p",{className:"text-muted-foreground",children:["OpenRod reached ",n.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."]}),n.jsx("ul",{className:"grid gap-2",children:c.fingerprints.map(N=>n.jsxs("li",{className:"rounded-lg border border-border bg-muted/20 px-3 py-2",children:[n.jsx("span",{className:"block text-[10px] text-muted-foreground",children:N.type}),n.jsx("span",{className:"block font-mono break-all text-foreground",children:N.fingerprint})]},N.type))}),n.jsxs("p",{className:"text-muted-foreground",children:["On the server, ",n.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&&n.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}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",disabled:f,onClick:()=>{u(null),g(null)},children:"Back"}),n.jsxs(le,{type:"button",disabled:f,onClick:S,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f?n.jsx(kt,{"aria-hidden":"true"}):n.jsx(Iu,{"aria-hidden":"true",className:"size-4"}),"Trust and save"]})]})]}):n.jsxs("form",{autoComplete:"off",className:"grid gap-4 text-xs",onSubmit:C,children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:`${p}-name`,className:"text-xs",children:"Display name"}),n.jsx(Ot,{id:`${p}-name`,value:a.name,onChange:b("name"),maxLength:60,placeholder:"Build server",autoFocus:!0})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:`${p}-host`,className:"text-xs",children:"Hostname"}),n.jsx(Ot,{id:`${p}-host`,value:a.hostname,onChange:b("hostname"),spellCheck:!1,autoCapitalize:"none",placeholder:"host.com or user@host.com",className:"font-mono"})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsxs(zn,{htmlFor:`${p}-port`,className:"text-xs",children:["SSH port ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),n.jsx(Ot,{id:`${p}-port`,value:a.port,onChange:b("port"),inputMode:"numeric",placeholder:"22",className:"font-mono"})]}),n.jsxs("div",{className:"grid gap-2",children:[n.jsx("div",{role:"radiogroup","aria-label":"Authentication",className:"inline-flex w-fit rounded-lg bg-muted p-0.5",children:Oee.map(([N,E])=>n.jsx("button",{type:"button",role:"radio","aria-checked":a.auth===N,onClick:()=>{i(T=>({...T,auth:N})),g(null)},className:`rounded-md px-3 py-1 transition-colors ${a.auth===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:E},N))}),a.auth==="identity"?n.jsx(Ot,{"aria-label":"Private key file",value:a.identityFile,onChange:b("identityFile"),spellCheck:!1,autoCapitalize:"none",placeholder:"~/.ssh/id_ed25519",className:"font-mono"}):n.jsx("p",{className:"text-muted-foreground",children:"Uses your SSH agent and the keys SSH tries by default. Password logins aren’t supported."})]}),h&&n.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}),n.jsxs(Hr,{children:[n.jsx(Mee,{className:"sm:mr-auto"}),n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:!v||f,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&n.jsx(kt,{"aria-hidden":"true"}),f?"Checking…":"Continue"]})]})]})]})})}const WD={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"}},TR=e=>WD[e]?e:"off",QD=(e,t,r)=>`${e} ${e===1?t:r}`;function zee({row:e,count:t}){const r=WD[e.state];return n.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsx("span",{"aria-hidden":"true",className:Ve("size-1.5 shrink-0 rounded-full",r.dot,e.state==="connecting"&&"motion-safe:animate-pulse")}),n.jsx("span",{children:r.label}),e.state==="connected"&&n.jsxs("span",{className:"hidden sm:inline",children:["· ",QD(t,"sandbox","sandboxes")]})]})}function Iee({row:e,count:t,working:r,onToggle:a,onCreate:i,menu:c}){const u=e.state==="connected",f=e.label??e.name,m=e.address;return n.jsxs("li",{className:"px-4 py-2 sm:px-5",children:[n.jsxs("div",{className:"flex items-center gap-3.5",children:[n.jsx("span",{className:"flex h-[18px] w-8 shrink-0 items-center justify-center",children:r||e.state==="connecting"?n.jsx(kt,{"aria-label":"Working",className:"size-3.5"}):n.jsx(kee,{checked:u,"aria-label":`${u?"Disconnect from":"Connect to"} ${f}`,onCheckedChange:h=>a(e,h)})}),n.jsx("span",{"aria-hidden":"true",className:Ve("flex w-6 shrink-0 justify-center transition-opacity duration-300 [&_svg]:block [&_svg]:h-[22px]",!u&&"opacity-50"),children:n.jsx(v4,{live:u})}),n.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-2.5",children:[n.jsx("span",{className:"truncate text-[13px] font-medium",children:f}),m&&n.jsx("span",{className:"hidden min-w-0 truncate font-mono text-[11px] text-muted-foreground md:block",children:m})]}),n.jsx(zee,{row:e,count:t}),n.jsxs("span",{className:"flex w-[60px] shrink-0 items-center justify-end gap-0.5",children:[u&&i&&n.jsxs(xa,{children:[n.jsx(ba,{render:n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":`New sandbox on ${f}`,onClick:i,className:"size-7 text-muted-foreground hover:text-foreground"}),children:n.jsx(B8,{className:"size-4"})}),n.jsx(va,{children:"New sandbox"})]}),c]})]}),e.state==="failed"&&e.error&&n.jsx("p",{className:"mt-1 truncate pl-[46px] font-mono text-[11px] text-destructive",title:e.error,children:e.error})]})}function Pee({onCreateSandbox:e}){var $,U,F;const t=vo(),r=js(),[a,i]=x.useState(!1),[c,u]=x.useState(""),[f,m]=x.useState(!1),h=x.useRef(null);x.useEffect(()=>()=>{var Y;return(Y=h.current)==null?void 0:Y.abort()},[]);const g=t.locations.find(Y=>Y.cloud||Y.target==="cloud"),p=!!(g!=null&&g.connected);async function b(){const Y=new AbortController;h.current=Y,i(!0),u("");try{await r.prepare({signal:Y.signal}),Y.signal.throwIfAborted(),m(!0),t.refresh()}catch(ne){ne.name!=="AbortError"&&u(ne.message)}finally{i(!1),h.current=null}}const[v,w]=x.useState(null),[C,S]=x.useState(null),[N,E]=x.useState(null),[T,R]=x.useState(null),[M,A]=x.useState(!1),[k,O]=x.useState(null),D=x.useCallback(async Y=>{try{w(await cs.connections(Y)),S(null)}catch(ne){ne.name!=="AbortError"&&S(ne.message)}},[]);x.useEffect(()=>{const Y=new AbortController;return D(Y.signal),()=>Y.abort()},[D]);const _=(v==null?void 0:v.active)??null,H=TR(_==null?void 0:_.status),G=H==="connected",B=x.useMemo(()=>{if(!v)return[];const Y=v.hosts.map(ne=>({...ne,state:(_==null?void 0:_.host)===ne.name?TR(_.status):"off",error:(_==null?void 0:_.host)===ne.name?_.error:null}));return _&&!Y.some(ne=>ne.name===_.host)&&Y.push({name:_.host,state:H,error:_.error}),Y},[v,_,H]),P=B.filter(Y=>Y.managed||Y.name===(_==null?void 0:_.host)).sort((Y,ne)=>(ne.state==="connected")-(Y.state==="connected")||(Y.label??Y.name).localeCompare(ne.label??ne.name)),V=B.filter(Y=>!P.includes(Y)),q=Y=>t.sandboxes.filter(ne=>{var te;return((te=ne.location)==null?void 0:te.remote)&&ne.location.host===Y.name}).length;async function W(Y,ne,te){E(Y);try{await ne(),await D(),t.refresh()}catch(ye){He.error(te,{description:ye.message})}finally{E(null)}}const K=(Y,ne)=>{ne?R({host:Y.name,replacing:G?_.host:void 0}):W(Y.name,async()=>{await cs.disconnectRemote(),He.success(`Disconnected from ${Y.label??Y.name}`)},"Couldn’t disconnect")};function J(){const{kind:Y,row:ne}=k;O(null);const te=ne.label??ne.name;Y==="forget"?W(ne.name,async()=>{await cs.forgetRemote(),He.success(`Forgot ${te}`)},"Couldn’t forget it"):W(ne.name,async()=>{(_==null?void 0:_.host)===ne.name&&await cs.forgetRemote(),await cs.removeSshHost(ne.name),He.success(`Deleted ${te}`)},"Couldn’t delete it")}function z(Y){const ne=Y.name===(_==null?void 0:_.host);return!Y.managed&&!ne?null:n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":`More actions for ${Y.label??Y.name}`,className:"size-7 text-muted-foreground hover:text-foreground"}),children:n.jsx(Rk,{className:"size-4"})}),n.jsxs(qi,{align:"end",className:"min-w-44",children:[Y.state==="connected"&&n.jsx(Rs,{onClick:()=>K(Y,!1),children:"Disconnect"}),Y.state!=="connected"&&Y.state!=="connecting"&&n.jsx(Rs,{onClick:()=>K(Y,!0),children:Y.state==="failed"?"Try again":"Connect"}),ne&&!Y.managed&&n.jsx(Rs,{onClick:()=>O({kind:"forget",row:Y}),children:"Forget"}),Y.managed&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Rs,{variant:"destructive",disabled:Y.state==="connected"||Y.state==="connecting",onClick:()=>O({kind:"delete",row:Y}),children:["Delete",Y.state==="connected"?" (disconnect first)":""]})]})]})]})}const L=(Y,ne)=>n.jsx(ho,{delay:.04*ne,offset:4,blur:"3px",className:"contents",children:n.jsx(Iee,{row:Y,count:q(Y),working:N===Y.name,onToggle:K,onCreate:e,menu:z(Y)})},Y.name),X=(k==null?void 0:k.row.label)??(k==null?void 0:k.row.name),ee="divide-y divide-border/60 overflow-hidden rounded-xl border border-border/80 bg-card";return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:n.jsxs("div",{className:"grid gap-8 px-4 py-5 sm:px-6",children:[n.jsxs("section",{"aria-label":"OpenRod Cloud",className:"grid gap-4",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-sm font-medium",children:"OpenRod Cloud"}),n.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Manage your cloud connection."})]}),n.jsx(ho,{duration:.2,offset:4,blur:"3px",children:n.jsxs("div",{className:ee,children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-3.5 px-4 py-3 sm:px-5",children:[n.jsx("span",{"aria-hidden":"true",className:"flex w-8 shrink-0 justify-center [&_svg]:h-7",children:n.jsx(y4,{})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-[13px] font-medium",children:(($=r==null?void 0:r.user)==null?void 0:$.email)||"OpenRod Cloud"}),n.jsxs("p",{role:"status",className:"mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground",children:[p&&n.jsx("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-emerald-500"}),r!=null&&r.checking?"Checking connection…":a?r!=null&&r.connecting?"Signing in…":"Starting cloud machine…":p?`Connected · ${QD(t.sandboxes.filter(Y=>{var ne;return(ne=Y.location)==null?void 0:ne.cloud}).length,"sandbox","sandboxes")}`:r!=null&&r.connected?"Signed in · machine not ready":r!=null&&r.available?"Not connected":((U=r==null?void 0:r.status)==null?void 0:U.reason)||"Coming soon"]})]}),n.jsx("div",{className:"flex items-center gap-1.5",children:a?n.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>{var Y;(Y=h.current)==null||Y.abort(),r.cancelConnect()},children:[n.jsx(kt,{}),"Cancel"]}):n.jsxs(n.Fragment,{children:[p&&!f?n.jsxs(le,{variant:"outline",size:"sm",onClick:()=>window.dispatchEvent(new CustomEvent("openrod-import",{detail:{destination:g}})),children:[n.jsx(gf,{className:"size-3.5"}),"Import data"]}):!p&&n.jsxs(le,{variant:"outline",size:"sm",disabled:!(r!=null&&r.available)||(r==null?void 0:r.checking),onClick:b,children:[n.jsx(Kp,{className:"size-3.5"}),r!=null&&r.connected?"Start cloud machine":"Connect"]}),(r==null?void 0:r.connected)&&n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"OpenRod Cloud actions"}),children:n.jsx(Rk,{className:"size-4"})}),n.jsxs(qi,{align:"end",children:[n.jsx(Rs,{onClick:()=>r.refresh().then(()=>t.refresh()).catch(Y=>u(Y.message)),children:"Refresh connection"}),n.jsx(ju,{}),n.jsx(Rs,{onClick:()=>r.disconnect().catch(Y=>u(Y.message)),children:"Disconnect account"})]})]})]})})]}),f&&p&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t px-4 py-3 sm:px-5",children:[n.jsx("p",{className:"min-w-0 flex-1 text-xs text-muted-foreground",children:"Bring your local setup?"}),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>m(!1),children:"Not now"}),n.jsxs(le,{size:"sm",onClick:()=>{m(!1),window.dispatchEvent(new CustomEvent("openrod-import",{detail:{destination:g}}))},children:[n.jsx(gf,{className:"size-3.5"}),"Import data"]})]}),(c||(r==null?void 0:r.error))&&n.jsx("p",{role:"alert",className:"border-t px-4 py-2 text-xs text-destructive sm:px-5",children:c||r.error})]})})]}),C&&n.jsxs("div",{role:"alert",className:"flex items-center gap-3 text-xs text-red-600",children:[n.jsx("span",{children:C}),n.jsx(le,{variant:"outline",size:"sm",onClick:()=>D(),children:"Retry"})]}),!v&&!C&&n.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Reading connections…"}),v&&n.jsxs(n.Fragment,{children:[n.jsxs("section",{"aria-label":"SSH connections",className:"grid gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{className:"text-sm font-medium",children:"SSH connections"}),n.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Added in OpenRod. One machine is connected at a time."})]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh connections",onClick:()=>D(),className:"text-muted-foreground",children:n.jsx(rl,{})}),((F=v.forgottenHosts)==null?void 0:F.length)>0&&n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.jsx(le,{variant:"ghost",size:"sm"}),children:"Restore"}),n.jsx(qi,{align:"end",children:v.forgottenHosts.map(Y=>n.jsxs(Rs,{onClick:()=>W(Y,()=>cs.restoreSshHost(Y),"Couldn’t restore it"),children:["Restore ",Y]},Y))})]}),n.jsxs(le,{size:"sm",onClick:()=>A(!0),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(vs,{className:"size-3.5"}),"Add"]})]}),P.length>0?n.jsx("ul",{className:ee,children:P.map(L)}):n.jsxs("div",{className:"rounded-xl border border-border bg-card py-14 text-center",children:[n.jsx($f,{className:"mx-auto mb-3 size-6 text-muted-foreground",strokeWidth:1.5}),n.jsx("p",{className:"text-sm",children:"No saved connections"}),n.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."}),n.jsx(le,{variant:"outline",className:"mt-4",onClick:()=>A(!0),children:"Add connection"})]})]}),V.length>0&&n.jsxs("section",{"aria-label":"Hosts in your SSH config",className:"grid gap-4",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-sm font-medium",children:"From your SSH config"}),n.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Found in ",n.jsx("span",{className:"font-mono",children:"~/.ssh/config"}),". OpenRod reads these and never edits them."]})]}),n.jsx("ul",{className:ee,children:V.map(L)})]})]})]})}),n.jsx(Fr,{open:!!k,onOpenChange:Y=>{Y||O(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:[(k==null?void 0:k.kind)==="forget"?"Forget":"Delete"," ",X,"?"]}),n.jsx(Xr,{children:(k==null?void 0:k.kind)==="forget"?`${(k==null?void 0:k.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."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:J,children:(k==null?void 0:k.kind)==="forget"?"Forget":"Delete"})]})]})}),n.jsx(Dee,{open:M,onOpenChange:A,onAdded:Y=>{A(!1),He.success(`Added ${Y.name}`),D(),R({host:Y.alias})}}),n.jsx(tn,{open:!!T,onOpenChange:Y=>{Y||R(null)},children:n.jsxs(nn,{className:"sm:max-w-3xl","aria-describedby":void 0,children:[n.jsx(sn,{children:n.jsx(Qt,{children:T!=null&&T.replacing?"Switch host":"Connect a remote machine"})}),T&&n.jsx(zw,{initialHost:T.host,connectedHost:T.replacing??null,onUseConnected:()=>R(null),onConnected:Y=>{R(null),He.success(`Connected to ${Y.host}`),D(),t.refresh()},onBack:()=>R(null)},T.host)]})})]})}const ER=({...e})=>{const{resolvedTheme:t}=HR();return n.jsx(AK,{theme:t??"system",className:"toaster group",icons:{success:n.jsx(AL,{className:"size-4"}),info:n.jsx(Du,{className:"size-4"}),warning:n.jsx(ti,{className:"size-4"}),error:n.jsx(zA,{className:"size-4"}),loading:n.jsx(Ql,{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})},RR=["Claude Code","Codex","OpenCode","Pi","Cursor"];function ZD(){const[e,t]=x.useState(RR.slice(0,3));return x.useEffect(()=>{const r=window.matchMedia("(prefers-reduced-motion: reduce)");let a,i=-1;function c(){clearTimeout(a),!(r.matches||document.hidden)&&(a=setTimeout(()=>{const u=[0,1,2].filter(h=>h!==i),f=u[Math.floor(Math.random()*u.length)];i=f;const m=Math.random();t(h=>{const g=RR.filter(p=>!h.includes(p));return h.map((p,b)=>b===f?g[Math.floor(m*g.length)]:p)}),c()},1100+Math.random()*900))}return c(),r.addEventListener("change",c),document.addEventListener("visibilitychange",c),()=>{clearTimeout(a),r.removeEventListener("change",c),document.removeEventListener("visibilitychange",c)}},[]),n.jsxs("svg",{className:"cloud-agents",viewBox:"50 10 540 340",role:"img","aria-labelledby":"cloud-agents-title cloud-agents-desc",children:[n.jsx("title",{id:"cloud-agents-title",children:"Your agents in OpenRod Cloud"}),n.jsx("desc",{id:"cloud-agents-desc",children:"Claude Code, Codex, OpenCode, Pi, and Cursor on OpenRod Cloud."}),n.jsxs("g",{className:"cloud-spark",children:[n.jsx("path",{d:"M93 105h4v-8h4v8h8v4h-8v8h-4v-8h-8v-4z"}),n.jsx("path",{d:"M544 72h4v-7h4v7h7v4h-7v7h-4v-7h-7v-4z"}),n.jsx("path",{d:"M563 268h4v-6h4v6h6v4h-6v6h-4v-6h-6v-4z"})]}),n.jsx("path",{d:"M98 292h-28v-76h28v-35h55v-48h55v-35h80V74h72v24h48v35h48v48h53v35h30v76h-29v31H98z",fill:"#cadbd7",transform:"translate(0 13)"}),n.jsx("path",{d:"M98 292h-28v-76h28v-35h55v-48h55v-35h80V74h72v24h48v35h48v48h53v35h30v76h-29v31H98z",fill:"#f4f1e8",stroke:"#b3c8c2",strokeWidth:"2"}),n.jsx("path",{d:"M106 291h397",stroke:"#d8ded2",strokeWidth:"2",strokeDasharray:"3 7"}),n.jsxs("g",{className:"cloud-card-slot",transform:"translate(165 165)",children:[n.jsxs("g",{className:`cloud-card-face ${e[0]==="Claude Code"?"is-active":""}`,"data-agent":"Claude Code",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#f0dccb"}),n.jsx("image",{href:"/logos/agents/claudecode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Claude Code"})]}),n.jsxs("g",{className:`cloud-card-face ${e[0]==="Codex"?"is-active":""}`,"data-agent":"Codex",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e3e3ec"}),n.jsx("svg",{x:"7",y:"1",width:"68",height:"81",viewBox:"335 265 625 735",children:n.jsx("image",{href:"/cloud-agents/codex-character.png",width:"1312",height:"1199"})}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Codex"})]}),n.jsxs("g",{className:`cloud-card-face ${e[0]==="OpenCode"?"is-active":""}`,"data-agent":"OpenCode",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e1e6d9"}),n.jsx("image",{href:"/logos/agents/opencode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"OpenCode"})]}),n.jsxs("g",{className:`cloud-card-face ${e[0]==="Pi"?"is-active":""}`,"data-agent":"Pi",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e6dfd0"}),n.jsx("image",{href:"/logos/agents/pi.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Pi"})]}),n.jsxs("g",{className:`cloud-card-face ${e[0]==="Cursor"?"is-active":""}`,"data-agent":"Cursor",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e2e5df"}),n.jsx("image",{href:"/logos/agents/cursor.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Cursor"})]})]}),n.jsxs("g",{className:"cloud-card-slot",transform:"translate(267 146)",children:[n.jsxs("g",{className:`cloud-card-face ${e[1]==="Codex"?"is-active":""}`,"data-agent":"Codex",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e3e3ec"}),n.jsx("svg",{x:"7",y:"1",width:"68",height:"81",viewBox:"335 265 625 735",children:n.jsx("image",{href:"/cloud-agents/codex-character.png",width:"1312",height:"1199"})}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Codex"})]}),n.jsxs("g",{className:`cloud-card-face ${e[1]==="OpenCode"?"is-active":""}`,"data-agent":"OpenCode",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e1e6d9"}),n.jsx("image",{href:"/logos/agents/opencode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"OpenCode"})]}),n.jsxs("g",{className:`cloud-card-face ${e[1]==="Pi"?"is-active":""}`,"data-agent":"Pi",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e6dfd0"}),n.jsx("image",{href:"/logos/agents/pi.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Pi"})]}),n.jsxs("g",{className:`cloud-card-face ${e[1]==="Cursor"?"is-active":""}`,"data-agent":"Cursor",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e2e5df"}),n.jsx("image",{href:"/logos/agents/cursor.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Cursor"})]}),n.jsxs("g",{className:`cloud-card-face ${e[1]==="Claude Code"?"is-active":""}`,"data-agent":"Claude Code",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#f0dccb"}),n.jsx("image",{href:"/logos/agents/claudecode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Claude Code"})]})]}),n.jsxs("g",{className:"cloud-card-slot",transform:"translate(369 165)",children:[n.jsxs("g",{className:`cloud-card-face ${e[2]==="OpenCode"?"is-active":""}`,"data-agent":"OpenCode",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e1e6d9"}),n.jsx("image",{href:"/logos/agents/opencode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"OpenCode"})]}),n.jsxs("g",{className:`cloud-card-face ${e[2]==="Pi"?"is-active":""}`,"data-agent":"Pi",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e6dfd0"}),n.jsx("image",{href:"/logos/agents/pi.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Pi"})]}),n.jsxs("g",{className:`cloud-card-face ${e[2]==="Cursor"?"is-active":""}`,"data-agent":"Cursor",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e2e5df"}),n.jsx("image",{href:"/logos/agents/cursor.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Cursor"})]}),n.jsxs("g",{className:`cloud-card-face ${e[2]==="Claude Code"?"is-active":""}`,"data-agent":"Claude Code",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#f0dccb"}),n.jsx("image",{href:"/logos/agents/claudecode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Claude Code"})]}),n.jsxs("g",{className:`cloud-card-face ${e[2]==="Codex"?"is-active":""}`,"data-agent":"Codex",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e3e3ec"}),n.jsx("svg",{x:"7",y:"1",width:"68",height:"81",viewBox:"335 265 625 735",children:n.jsx("image",{href:"/cloud-agents/codex-character.png",width:"1312",height:"1199"})}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Codex"})]})]}),n.jsx("g",{role:"img","aria-label":"OpenRod Cloud",children:n.jsx("path",{fill:"#536f67",d:"M226.25 30h2.5v2.5h-2.5zM228.75 30h2.5v2.5h-2.5zM231.25 30h2.5v2.5h-2.5zM223.75 32.5h2.5v2.5h-2.5zM233.75 32.5h2.5v2.5h-2.5zM223.75 35h2.5v2.5h-2.5zM233.75 35h2.5v2.5h-2.5zM223.75 37.5h2.5v2.5h-2.5zM233.75 37.5h2.5v2.5h-2.5zM223.75 40h2.5v2.5h-2.5zM233.75 40h2.5v2.5h-2.5zM223.75 42.5h2.5v2.5h-2.5zM233.75 42.5h2.5v2.5h-2.5zM226.25 45h2.5v2.5h-2.5zM228.75 45h2.5v2.5h-2.5zM231.25 45h2.5v2.5h-2.5zM238.75 30h2.5v2.5h-2.5zM241.25 30h2.5v2.5h-2.5zM243.75 30h2.5v2.5h-2.5zM246.25 30h2.5v2.5h-2.5zM238.75 32.5h2.5v2.5h-2.5zM248.75 32.5h2.5v2.5h-2.5zM238.75 35h2.5v2.5h-2.5zM248.75 35h2.5v2.5h-2.5zM238.75 37.5h2.5v2.5h-2.5zM241.25 37.5h2.5v2.5h-2.5zM243.75 37.5h2.5v2.5h-2.5zM246.25 37.5h2.5v2.5h-2.5zM238.75 40h2.5v2.5h-2.5zM238.75 42.5h2.5v2.5h-2.5zM238.75 45h2.5v2.5h-2.5zM253.75 30h2.5v2.5h-2.5zM256.25 30h2.5v2.5h-2.5zM258.75 30h2.5v2.5h-2.5zM261.25 30h2.5v2.5h-2.5zM263.75 30h2.5v2.5h-2.5zM253.75 32.5h2.5v2.5h-2.5zM253.75 35h2.5v2.5h-2.5zM253.75 37.5h2.5v2.5h-2.5zM256.25 37.5h2.5v2.5h-2.5zM258.75 37.5h2.5v2.5h-2.5zM261.25 37.5h2.5v2.5h-2.5zM253.75 40h2.5v2.5h-2.5zM253.75 42.5h2.5v2.5h-2.5zM253.75 45h2.5v2.5h-2.5zM256.25 45h2.5v2.5h-2.5zM258.75 45h2.5v2.5h-2.5zM261.25 45h2.5v2.5h-2.5zM263.75 45h2.5v2.5h-2.5zM268.75 30h2.5v2.5h-2.5zM278.75 30h2.5v2.5h-2.5zM268.75 32.5h2.5v2.5h-2.5zM271.25 32.5h2.5v2.5h-2.5zM278.75 32.5h2.5v2.5h-2.5zM268.75 35h2.5v2.5h-2.5zM271.25 35h2.5v2.5h-2.5zM278.75 35h2.5v2.5h-2.5zM268.75 37.5h2.5v2.5h-2.5zM273.75 37.5h2.5v2.5h-2.5zM278.75 37.5h2.5v2.5h-2.5zM268.75 40h2.5v2.5h-2.5zM276.25 40h2.5v2.5h-2.5zM278.75 40h2.5v2.5h-2.5zM268.75 42.5h2.5v2.5h-2.5zM276.25 42.5h2.5v2.5h-2.5zM278.75 42.5h2.5v2.5h-2.5zM268.75 45h2.5v2.5h-2.5zM278.75 45h2.5v2.5h-2.5zM283.75 30h2.5v2.5h-2.5zM286.25 30h2.5v2.5h-2.5zM288.75 30h2.5v2.5h-2.5zM291.25 30h2.5v2.5h-2.5zM283.75 32.5h2.5v2.5h-2.5zM293.75 32.5h2.5v2.5h-2.5zM283.75 35h2.5v2.5h-2.5zM293.75 35h2.5v2.5h-2.5zM283.75 37.5h2.5v2.5h-2.5zM286.25 37.5h2.5v2.5h-2.5zM288.75 37.5h2.5v2.5h-2.5zM291.25 37.5h2.5v2.5h-2.5zM283.75 40h2.5v2.5h-2.5zM288.75 40h2.5v2.5h-2.5zM283.75 42.5h2.5v2.5h-2.5zM291.25 42.5h2.5v2.5h-2.5zM283.75 45h2.5v2.5h-2.5zM293.75 45h2.5v2.5h-2.5zM301.25 30h2.5v2.5h-2.5zM303.75 30h2.5v2.5h-2.5zM306.25 30h2.5v2.5h-2.5zM298.75 32.5h2.5v2.5h-2.5zM308.75 32.5h2.5v2.5h-2.5zM298.75 35h2.5v2.5h-2.5zM308.75 35h2.5v2.5h-2.5zM298.75 37.5h2.5v2.5h-2.5zM308.75 37.5h2.5v2.5h-2.5zM298.75 40h2.5v2.5h-2.5zM308.75 40h2.5v2.5h-2.5zM298.75 42.5h2.5v2.5h-2.5zM308.75 42.5h2.5v2.5h-2.5zM301.25 45h2.5v2.5h-2.5zM303.75 45h2.5v2.5h-2.5zM306.25 45h2.5v2.5h-2.5zM313.75 30h2.5v2.5h-2.5zM316.25 30h2.5v2.5h-2.5zM318.75 30h2.5v2.5h-2.5zM321.25 30h2.5v2.5h-2.5zM313.75 32.5h2.5v2.5h-2.5zM323.75 32.5h2.5v2.5h-2.5zM313.75 35h2.5v2.5h-2.5zM323.75 35h2.5v2.5h-2.5zM313.75 37.5h2.5v2.5h-2.5zM323.75 37.5h2.5v2.5h-2.5zM313.75 40h2.5v2.5h-2.5zM323.75 40h2.5v2.5h-2.5zM313.75 42.5h2.5v2.5h-2.5zM323.75 42.5h2.5v2.5h-2.5zM313.75 45h2.5v2.5h-2.5zM316.25 45h2.5v2.5h-2.5zM318.75 45h2.5v2.5h-2.5zM321.25 45h2.5v2.5h-2.5zM346.25 30h2.5v2.5h-2.5zM348.75 30h2.5v2.5h-2.5zM351.25 30h2.5v2.5h-2.5zM353.75 30h2.5v2.5h-2.5zM343.75 32.5h2.5v2.5h-2.5zM343.75 35h2.5v2.5h-2.5zM343.75 37.5h2.5v2.5h-2.5zM343.75 40h2.5v2.5h-2.5zM343.75 42.5h2.5v2.5h-2.5zM346.25 45h2.5v2.5h-2.5zM348.75 45h2.5v2.5h-2.5zM351.25 45h2.5v2.5h-2.5zM353.75 45h2.5v2.5h-2.5zM358.75 30h2.5v2.5h-2.5zM358.75 32.5h2.5v2.5h-2.5zM358.75 35h2.5v2.5h-2.5zM358.75 37.5h2.5v2.5h-2.5zM358.75 40h2.5v2.5h-2.5zM358.75 42.5h2.5v2.5h-2.5zM358.75 45h2.5v2.5h-2.5zM361.25 45h2.5v2.5h-2.5zM363.75 45h2.5v2.5h-2.5zM366.25 45h2.5v2.5h-2.5zM368.75 45h2.5v2.5h-2.5zM376.25 30h2.5v2.5h-2.5zM378.75 30h2.5v2.5h-2.5zM381.25 30h2.5v2.5h-2.5zM373.75 32.5h2.5v2.5h-2.5zM383.75 32.5h2.5v2.5h-2.5zM373.75 35h2.5v2.5h-2.5zM383.75 35h2.5v2.5h-2.5zM373.75 37.5h2.5v2.5h-2.5zM383.75 37.5h2.5v2.5h-2.5zM373.75 40h2.5v2.5h-2.5zM383.75 40h2.5v2.5h-2.5zM373.75 42.5h2.5v2.5h-2.5zM383.75 42.5h2.5v2.5h-2.5zM376.25 45h2.5v2.5h-2.5zM378.75 45h2.5v2.5h-2.5zM381.25 45h2.5v2.5h-2.5zM388.75 30h2.5v2.5h-2.5zM398.75 30h2.5v2.5h-2.5zM388.75 32.5h2.5v2.5h-2.5zM398.75 32.5h2.5v2.5h-2.5zM388.75 35h2.5v2.5h-2.5zM398.75 35h2.5v2.5h-2.5zM388.75 37.5h2.5v2.5h-2.5zM398.75 37.5h2.5v2.5h-2.5zM388.75 40h2.5v2.5h-2.5zM398.75 40h2.5v2.5h-2.5zM388.75 42.5h2.5v2.5h-2.5zM398.75 42.5h2.5v2.5h-2.5zM391.25 45h2.5v2.5h-2.5zM393.75 45h2.5v2.5h-2.5zM396.25 45h2.5v2.5h-2.5zM403.75 30h2.5v2.5h-2.5zM406.25 30h2.5v2.5h-2.5zM408.75 30h2.5v2.5h-2.5zM411.25 30h2.5v2.5h-2.5zM403.75 32.5h2.5v2.5h-2.5zM413.75 32.5h2.5v2.5h-2.5zM403.75 35h2.5v2.5h-2.5zM413.75 35h2.5v2.5h-2.5zM403.75 37.5h2.5v2.5h-2.5zM413.75 37.5h2.5v2.5h-2.5zM403.75 40h2.5v2.5h-2.5zM413.75 40h2.5v2.5h-2.5zM403.75 42.5h2.5v2.5h-2.5zM413.75 42.5h2.5v2.5h-2.5zM403.75 45h2.5v2.5h-2.5zM406.25 45h2.5v2.5h-2.5zM408.75 45h2.5v2.5h-2.5zM411.25 45h2.5v2.5h-2.5z"})})]})}function _ee({children:e,user:t,logout:r}){const[a]=x.useState(()=>window.location.hash.startsWith("#local-connect=")?r7(window.location.hash)??!1:null),[i,c]=x.useState(""),u=x.useRef(null),f=a&&window.opener&&!window.opener.closed;return x.useEffect(()=>{if(!f)return;let m=!0;u.current??(u.current=c7(a));const h=setTimeout(()=>{m&&c("Could not reach local OpenRod. Close this window and try again.")},3e4);return u.current.then(({code:g})=>{m&&window.opener.postMessage({type:"openrod-local-connected",nonce:a.nonce,code:g},a.origin)}).catch(g=>{clearTimeout(h),m&&c(g.message)}),()=>{m=!1,clearTimeout(h)}},[a,f]),a===null?e:n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-sm text-center",children:[f&&!i&&n.jsx(ZD,{}),n.jsx("h1",{className:"text-2xl font-semibold",children:i||!f?"Sign-in interrupted":"Finishing sign-in…"}),n.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:f&&!i?n.jsxs(n.Fragment,{children:["Signed in as ",t.email,".",n.jsx("br",{}),"High demand may slow this down."]}):"Start again from local OpenRod."}),i&&n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:i}),(i||!f)&&n.jsx("button",{className:"mt-5 block w-full text-xs underline",onClick:r,children:"Sign out"})]})})}function Lee({children:e}){var S,N;const t=js(),r=((S=t==null?void 0:t.status)==null?void 0:S.origin)||ku,{chooseGroups:a,dialog:i,cancel:c}=Xw(),u=x.useRef(new AbortController),f=x.useMemo(()=>lr("local",u.current.signal),[]),m=x.useRef(0);x.useEffect(()=>{const E=++m.current;return()=>queueMicrotask(()=>{m.current===E&&u.current.abort()})},[]);const h=x.useRef((N=/^#cloud-return=([a-f0-9-]{36})$/.exec(window.location.hash))==null?void 0:N[1]),[g,p]=x.useState(h.current&&window.opener?"waiting":"normal"),[b,v]=x.useState(""),w=x.useRef(!1),C=x.useRef(!1);return x.useEffect(()=>{if(g!=="waiting"||!(t!=null&&t.available)||!r)return;const E=async T=>{var R;if(!(w.current||T.origin!==r||T.source!==window.opener||((R=T.data)==null?void 0:R.type)!=="openrod-local-bundle"||T.data.nonce!==h.current)){w.current=!0,p("importing");try{if(typeof T.data.error=="string")throw Error(T.data.error);const A=(await f.inventory()).locations.find(_=>!_.remote&&_.connected);if(!A)throw Error("Connect a local gateway before importing this workspace.");const k=f.forContext(A.context),O=await a(k,"local OpenRod",u.current.signal);if(C.current)return;const D=await k.importCloud({...T.data.bundle,...O?{destinationGroups:O}:{}});if(window.opener.postMessage({type:"openrod-local-result",nonce:h.current,name:D.name},r),C.current)return;v(T.data.warning??"Workspace copied locally. Reconnect agent credentials to continue."),window.location.href=vg(D.name,"shell",{...A,target:"local"}),p("done")}catch(M){if(C.current||u.current.signal.aborted)return;v(M.message),p("error"),window.opener.postMessage({type:"openrod-local-result",nonce:h.current,error:M.message},r)}}};return window.addEventListener("message",E),window.opener.postMessage({type:"openrod-local-ready",nonce:h.current},r),()=>window.removeEventListener("message",E)},[g,r,t==null?void 0:t.available]),x.useEffect(()=>{if(!["waiting","importing"].includes(g))return;const E=Date.now()+35*6e4,T=setInterval(()=>{var R;((R=window.opener)!=null&&R.closed||Date.now()>E)&&(u.current.abort(),c(),v("The cloud tab closed or the copy timed out. Open the workspace to check whether a copy was created."),p("error"))},1e3);return()=>clearInterval(T)},[g]),g==="normal"||g==="done"?n.jsxs(n.Fragment,{children:[b&&n.jsx(Qa,{id:"local-return",tone:g==="done"?"success":"warning",title:g==="done"?"Workspace continued locally":"Workspace copy didn’t finish",onDismiss:()=>v(""),children:b}),e]}):n.jsxs(n.Fragment,{children:[i,n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-md text-center",children:[n.jsx("h1",{className:"text-2xl font-semibold",children:"Continuing your workspace locally…"}),n.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."}),b&&n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:b}),n.jsx("button",{className:"mt-6 text-sm underline",onClick:()=>{u.current.abort(),c(),C.current=!0,w.current=!0,window.location.hash="",p("normal")},children:"Open local workspace"})]})})]})}function $ee(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 hy(e,t="GET"){const r=await fetch(`/api/cloud/${e}`,{method:t,headers:t==="POST"?{"x-openshell-console":"1","content-type":"application/json"}:void 0,body:t==="POST"?"{}":void 0}),a=await r.json();if(!r.ok)throw Error(a.error??"Cloud machine unavailable");return a}function Bee({children:e,logout:t}){const[r,a]=x.useState(null),[i,c]=x.useState(""),[u,f]=x.useState(null),[m,h]=x.useState(!1),[g,p]=x.useReducer(S=>S+1,0);async function b(){h(!0),c("");try{a(await hy("machine","POST")),p()}catch(S){c(S.message)}finally{h(!1)}}const v=x.useRef($ee(window.location.hash)),w=x.useRef(!1);if(x.useEffect(()=>{let S=!0,N;async function E(){try{const T=await hy("machine");S&&(a(T),c(T.error??""),["ready","none","error"].includes(T.status)||(N=setTimeout(E,5e3)))}catch(T){S&&(c(T.message),N=setTimeout(E,1e4))}}return E(),()=>{S=!1,clearTimeout(N)}},[g]),x.useEffect(()=>{const S=v.current;if((r==null?void 0:r.status)!=="ready"||!S||!window.opener||w.current)return;w.current=!0,f({status:"waiting"});const N=R=>{var M;if(v.current&&!(R.source!==window.opener||R.origin!==S.origin||((M=R.data)==null?void 0:M.type)!=="openrod-cloud-result"||R.data.nonce!==S.nonce)){if(R.data.error){f({status:"error",message:R.data.error});return}f({status:"done",message:R.data.warning??"Workspace copied. Reconnect your agent credentials to continue."}),/^[a-z0-9-]{1,63}$/.test(R.data.name??"")&&(window.location.hash=`terminal/${R.data.name}?session=shell`)}};window.addEventListener("message",N),hy("handoff","POST").then(({ticket:R})=>window.opener.postMessage({type:"openrod-cloud-ready",nonce:S.nonce,ticket:R},S.origin)).catch(R=>f({status:"error",message:R.message}));const E=Date.now()+35*6e4,T=setInterval(()=>{var R;v.current&&((R=window.opener)!=null&&R.closed||Date.now()>E)&&(f({status:"error",message:"The source tab closed or the copy timed out. Open your workspace to check whether a copy was created."}),clearInterval(T))},1e3);return()=>{window.removeEventListener("message",N),clearInterval(T)}},[r==null?void 0:r.status]),(r==null?void 0:r.status)==="ready"&&(!u||u.status==="done"))return n.jsxs(n.Fragment,{children:[(u==null?void 0:u.message)&&n.jsx(Qa,{id:"cloud-transfer",tone:"success",title:"Workspace continued in the cloud",onDismiss:()=>f(null),children:u.message}),e]});const C=!u&&!i&&(m||r&&!["none","ready","error"].includes(r.status));return n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-md text-center",children:[C&&n.jsx(ZD,{}),n.jsx("h1",{className:"text-2xl font-semibold",children:u?"Continuing your workspace…":!C&&(r==null?void 0:r.status)==="none"?"Start OpenRod Cloud":"Setting up your cloud machine…"}),n.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:u?"Keep your local OpenRod tab open.":C?"High demand may slow this down.":"The first start takes a few minutes."}),C&&n.jsxs("div",{role:"status",className:"mt-5 flex items-center justify-center gap-2 rounded-lg bg-muted/50 p-4 text-sm",children:[n.jsx(kt,{"aria-hidden":"true"}),n.jsx("span",{children:"Opens automatically when ready"})]}),(i||(u==null?void 0:u.message))&&n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:(u==null?void 0:u.message)??i}),!u&&((r==null?void 0:r.status)==="none"||i)&&n.jsxs(le,{disabled:m,className:"mt-5",onClick:b,children:[m&&n.jsx(kt,{}),i?"Try again":"Start cloud machine"]}),u&&n.jsx("button",{onClick:()=>{v.current=null,f(null),window.location.hash=""},className:"mt-4 text-sm underline",children:"Open cloud workspace"}),n.jsx("button",{onClick:t,className:"mt-6 block w-full text-xs underline",children:"Sign out"})]})})}function Vee({localConnect:e=!1,error:t,busy:r,available:a,onLogin:i}){return n.jsx("main",{className:"grid min-h-svh grid-cols-1 place-items-center bg-background px-4 py-6 sm:px-6 sm:py-10",children:n.jsxs("section",{"aria-labelledby":"cloud-sign-in-title",className:"min-w-0 w-full max-w-sm rounded-xl border border-border bg-card px-5 py-7 text-center shadow-sm sm:px-8 sm:py-9",children:[n.jsx("img",{src:"/openrod.png",alt:"",width:"96",height:"96",className:"mx-auto mb-6 size-24 object-contain"}),n.jsx("h1",{id:"cloud-sign-in-title",className:"text-2xl font-semibold tracking-tight",children:"OpenRod Cloud"}),e&&n.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Sign in to connect this computer."}),n.jsx("button",{type:"button",disabled:!a||r,"aria-busy":r||void 0,onClick:i,className:"mt-7 inline-flex h-10 w-full items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:r?"Signing in…":"Continue with Google"}),t&&n.jsx("p",{role:"alert",className:"mt-4 text-xs leading-relaxed text-destructive",children:t})]})})}const Uee={"auth/network-request-failed":"Couldn’t reach Google. Check your connection and try again.","auth/popup-closed-by-user":"Sign-in cancelled.","auth/cancelled-popup-request":"Sign-in cancelled.","auth/popup-blocked":"Allow popups, then try again.","auth/unauthorized-domain":"Sign-in isn’t configured for this address. Contact your administrator.","auth/user-disabled":"This account is disabled. Contact your administrator.","auth/too-many-requests":"Too many attempts. Try again shortly."};function Hee(e){return Uee[e==null?void 0:e.code]||"Couldn’t sign in. Try again."}const AR=()=>Promise.all([gy(()=>import("./index.esm-Cj6nXjOx.js"),__vite__mapDeps([0,1])),gy(()=>import("./index.esm-Z1y-oluO.js"),__vite__mapDeps([2,1]))]);async function my(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===$i&&window.dispatchEvent(new Event($i)),!r.ok)throw Object.assign(new Error(a.error??"Sign-in unavailable"),{code:a.code});return a}function Fee(){var t;const e=js();return e!=null&&e.localViewer?null:n.jsxs("div",{className:"ml-auto flex items-center gap-3 text-xs",children:[n.jsx("span",{className:"max-w-40 truncate text-muted-foreground",children:(t=e==null?void 0:e.user)==null?void 0:t.email}),n.jsx("button",{className:"underline underline-offset-4",onClick:e==null?void 0:e.logout,children:"Sign out"})]})}function Gee({children:e}){const[t,r]=x.useState(null),[a,i]=x.useState(null),[c,u]=x.useState(!0),[f,m]=x.useState(""),[h,g]=x.useState(!1),[p,b]=x.useState(!1);x.useEffect(()=>{let C=!0;async function S(){try{const T=await my("config");if(!["local","cloud"].includes(T.mode))throw Error("Invalid console configuration");if(!C)return;if(en.configure({mode:T.mode,enabled:T.telemetryEnabled===!0}),r(T),T.mode==="cloud"){const R=await fetch("/api/auth/me");if(R.ok){const M=await R.json();C&&i(M.user)}else if(R.status!==401){const M=await R.json();throw Error(M.error??"Authentication unavailable")}}}catch(T){C&&m(T.message)}finally{C&&u(!1)}}S();const N=()=>{i(null),m("Your session expired. Sign in again.")},E=()=>{en.stop(),g(!0)};return window.addEventListener("openrod-session-expired",N),window.addEventListener($i,E),()=>{C=!1,window.removeEventListener("openrod-session-expired",N),window.removeEventListener($i,E)}},[]),x.useEffect(()=>{t!=null&&t.firebase&&!a&&AR().catch(()=>{})},[t==null?void 0:t.firebase,a]);async function v(){if(p||!(t!=null&&t.firebase))return;b(!0),m("");let C,S;try{const[{initializeApp:N,getApps:E},T]=await AR();S=T;const R=E().find(O=>O.name==="openrod-cloud")??N(t.firebase,"openrod-cloud");C=S.getAuth(R),await S.setPersistence(C,S.inMemoryPersistence);const M=new S.GoogleAuthProvider;M.setCustomParameters({prompt:"select_account"});const A=await S.signInWithPopup(C,M),k=await my("session",{idToken:await A.user.getIdToken(!0)});i(k.user)}catch(N){m(Hee(N))}finally{C&&await S.signOut(C).catch(()=>{}),b(!1)}}async function w(){try{await my("logout",{})}catch(C){m(C.message)}finally{i(null)}}return h?n.jsx("main",{className:"grid min-h-screen place-items-center bg-background px-6",children:n.jsxs("section",{className:"w-full max-w-md rounded-xl border border-border bg-card p-8 text-center shadow-sm",children:[n.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Open the console link"}),n.jsxs("p",{className:"mt-3 text-sm text-muted-foreground",children:["Open the link printed by ",n.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?n.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"?n.jsx(m7,{children:n.jsx(Lee,{children:n.jsx(dZ,{children:e})})}):a?n.jsx(_ee,{user:a,logout:w,children:n.jsx(f7,{user:a,logout:w,children:n.jsx(Bee,{logout:w,children:e},a.uid)})}):n.jsx(Vee,{localConnect:window.location.hash.startsWith("#local-connect="),error:f,busy:p,available:!!(t!=null&&t.firebase),onLogin:v})}const MR=e=>e?JSON.stringify([e.target??"local",e.context]):null;function qee(e,t,r="local"){return e.find(a=>a.target===r&&!a.remote&&a.connected)??e.find(a=>a.target===r&&a.connected)??null}const $x=[{id:"groups",label:"Groups",description:"Definitions and policy relationships"},{id:"network",label:"Network",description:"Egress rules with destination targets"},{id:"setups",label:"MCPs & Skills",description:"Saved setups and skill files"},{id:"templates",label:"Templates",description:"Portable image recipes"},{id:"activity",label:"Activity history",description:"Historical events, in batches of up to 500",optional:!0}],Yee=$x.filter(e=>!e.optional).map(e=>e.id),Ul=e=>["running","cancelling"].includes(e==null?void 0:e.status),Kee=e=>e&&!["planned","running","cancelling"].includes(e.status);function Xee(e,t){var c;const r=new Map(e.map(u=>[u.key,u])),a=new Set;function i(u){if(a.has(u))return;const f=r.get(u);if(!f)throw new Error(`Missing import dependency: ${u}`);a.add(u);for(const m of f.dependencies??[])i(m)}t.forEach(i);for(let u=-1;u!==a.size;){u=a.size;for(const f of e)(c=f.requiredForGroups)!=null&&c.some(m=>a.has(`groups:${m}`))&&i(f.key)}return[...a]}const Ts=e=>(e==null?void 0:e.id)??JSON.stringify([e==null?void 0:e.target,e==null?void 0:e.context]);function OR({from:e="",to:t="",offset:r=0,snapshot:a}={}){const i={offset:r};for(const[c,u]of Object.entries({from:e,to:t})){if(!u)continue;const f=new Date(u);if(!Number.isFinite(f.getTime()))throw new Error("Choose a valid activity date range.");i[c]=f.toISOString()}if(i.from&&i.to&&i.from>i.to)throw new Error("Activity start must be before its end.");return a!=null&&(i.snapshot=a),i}function DR(e){var r;if(!((r=e==null?void 0:e.items)!=null&&r.length))return 0;const t=e.items.filter(a=>["created","completed","reused","skipped","blocked","failed","cancelled"].includes(a.status)).length;return Math.round(t/e.items.length*100)}function Wee(e){const t=[...$x,{id:"policyTemplates",label:"Base policies"}].map(a=>({...a,items:e.filter(i=>i.type===a.id)})),r=e.filter(a=>!t.some(i=>i.id===a.type));return r.length&&t.push({id:"other",label:"Other resources",items:r}),t.filter(a=>a.items.length).map(a=>{if(a.id!=="setups")return a;const i=u=>{var f;return new Set((((f=u.data)==null?void 0:f.items)??[]).map(m=>m.kind))},c=u=>{const f=i(u);return f.has("mcp")&&f.has("skill")?"mixed":f.has("mcp")?"mcps":f.has("skill")?"skills":"saved"};return{...a,groups:[{id:"mcps",label:"MCPs"},{id:"skills",label:"Skills"},{id:"mixed",label:"MCPs & Skills together"},{id:"saved",label:"Saved setups"}].map(u=>({...u,items:a.items.filter(f=>c(f)===u.id)})).filter(u=>u.items.length)}})}const Yd={...Object.fromEntries($x.map(e=>[e.id,e.label])),policyTemplates:"Base policy"},py=e=>({created:"Imported",completed:"Imported",reused:"Reused",failed:"Failed",blocked:"Dependency failed",pending:"Waiting",running:"Importing",cancelled:"Cancelled",skipped:"Skipped",planned:"Ready to import",partial:"Needs attention",interrupted:"Interrupted"})[e]??e;function Qee({request:e,onClose:t}){var xe,je,Ie,ce,Te,re,fe,Re,Oe,ke;const r=js(),a=Bf(),i=vo(),[c,u]=x.useState(""),[f,m]=x.useState(()=>e!=null&&e.destination?Ts(e.destination):r!=null&&r.localViewer?"cloud":""),[h,g]=x.useState((e==null?void 0:e.destination)??null),[p,b]=x.useState(()=>e!=null&&e.type&&Yd[e.type]?[e.type]:Yee),[v,w]=x.useState({from:"",to:""}),[C,S]=x.useState(null),[N,E]=x.useState({}),[T,R]=x.useState(null),[M,A]=x.useState([]),[k,O]=x.useState(null),[D,_]=x.useState([]),[H,G]=x.useState(""),[B,P]=x.useState(""),[V,q]=x.useState(null),W=i.locations.filter(he=>he.connected),K=h&&(i.locations.find(he=>Ts(he)===Ts(h))??h),J=K!=null&&K.connected&&!W.some(he=>Ts(he)===Ts(h))?[...W,K]:W,z=J.find(he=>Ts(he)===c),L=J.find(he=>Ts(he)===f),X=x.useRef(new AbortController),ee=x.useRef(0);x.useEffect(()=>{const he=++ee.current;return()=>queueMicrotask(()=>{ee.current===he&&X.current.abort()})},[]);const $=x.useRef(((xe=r==null?void 0:r.status)==null?void 0:xe.owner)??null);!$.current&&((je=r==null?void 0:r.status)!=null&&je.owner)&&($.current=r.status.owner);const U=x.useMemo(()=>a.signal?AbortSignal.any([a.signal,X.current.signal]):X.current.signal,[a.signal]),F=x.useCallback(he=>lr(r!=null&&r.localViewer?he.target:a.target,U,he.context,$.current),[r==null?void 0:r.localViewer,a.target,U]);x.useEffect(()=>{!c&&W.length&&u(Ts(W.find(he=>!he.cloud&&!he.remote)??W[0]))},[c,W.map(Ts).join("|")]),x.useEffect(()=>{if(f!=="cloud")return;const he=J.find(Ae=>(Ae.cloud||Ae.target==="cloud")&&Ae.connected);he&&m(Ts(he))},[f,J.map(he=>`${Ts(he)}:${he.connected}`).join("|")]),x.useEffect(()=>{if(_([]),!(L!=null&&L.connected))return;const he=F(L);let Ae=!0;return he.importJobs().then(ge=>{Ae&&_(ge.jobs??[])}).catch(()=>{Ae&&_([])}),()=>{Ae=!1}},[f,L==null?void 0:L.context,L==null?void 0:L.connected,F,k==null?void 0:k.id,k==null?void 0:k.status]),x.useEffect(()=>{if(!k||!Ul(k)||!V)return;let he=!0,Ae;const ge=async()=>{try{const Pe=await V.importJob(k.id);if(!he)return;O(Pe),Ul(Pe)?Ae=setTimeout(ge,1e3):(i.refresh(),window.dispatchEvent(new Event("openrod-resources-changed")))}catch(Pe){he&&(P(Pe.message),Ae=setTimeout(ge,3e3))}};return ge(),()=>{he=!1,clearTimeout(Ae)}},[k==null?void 0:k.id,k==null?void 0:k.status,V]);async function Y(he,Ae){G(he),P("");try{await Ae()}catch(ge){ge.name!=="AbortError"&&P(ge.message)}finally{U.aborted||G("")}}async function ne(){var Fe;if(L!=null&&L.connected)return L;if(f!=="cloud")throw Error("Choose a connected destination.");if(!(r!=null&&r.localViewer))throw Error("Choose the cloud workspace from the list.");U.throwIfAborted(),G(r.connected?"Preparing cloud workspace…":"Connecting to OpenRod Cloud…");const he=await r.prepare({signal:U,onProgress:()=>{U.aborted||G("Preparing cloud workspace…")}});if($.current&&$.current!==he.owner)throw Error("Your cloud account changed. Start a new import.");$.current=he.owner,U.throwIfAborted();const ge=(Fe=(await Ha("inventory",void 0,{signal:U,owner:he.owner})).locations)==null?void 0:Fe.find(_e=>_e.connected);if(!ge)throw Error("The cloud gateway is still preparing. Try again shortly.");const Pe={...ge,cloud:!0,target:"cloud",label:"OpenRod Cloud",id:JSON.stringify(["cloud",ge.context])};return g(Pe),m(Pe.id),i.refresh(),Pe}async function te(he=v){if(!z)throw Error("Choose a connected source.");const Ae=F(z),ge=p.includes("activity")?OR(he):void 0,Pe=await ne();if(U.throwIfAborted(),G("Reading configuration…"),Ts(z)===Ts(Pe))throw Error("Choose a different destination.");const Fe=F(Pe),_e=await Fe.importCapabilities(),Xe=p.filter(ct=>{var At,rt;return!((rt=(At=_e.types)==null?void 0:At[ct])!=null&&rt.supported)});if(Xe.length)throw Error(`This destination cannot import ${Xe.map(ct=>Yd[ct]).join(", ")}.`);const Je=await Ae.exportResources({types:p,...ge?{activity:ge}:{}});S(_e),E({}),q(Fe),R(Je),A(Je.resources.filter(ct=>p.includes(ct.type)).map(ct=>ct.key))}const ye=x.useMemo(()=>{try{const he=T?Xee(T.resources,M):[],Ae=[...new Set((T==null?void 0:T.resources.filter(ge=>{var Pe,Fe;return he.includes(ge.key)&&C&&!((Fe=(Pe=C.types)==null?void 0:Pe[ge.type])!=null&&Fe.supported)}).map(ge=>ge.type))??[])];return{included:he,error:Ae.length?`Required dependencies cannot be imported here: ${Ae.map(ge=>Yd[ge]??ge).join(", ")}.`:""}}catch(he){return{included:M,error:`${he.message}. Deselect the resource that requires it, or fix the source and read it again.`}}},[T,M,C]);async function ae(he,Ae){const ge={...N};Ae==="reuse"?ge[he.key]={action:Ae,targetId:he.sourceId}:delete ge[he.key];const Pe=await V.planImport({bundle:T,selection:M,conflicts:ge});E(ge),O(Pe)}const ue=ye.included,se=k?"result":T?"select":"source",Q=!!H||Ul(k);function ie(){R(null),O(null),A([]),E({}),w(he=>({from:he.from,to:he.to})),P("")}const oe=he=>{var Ae;return n.jsxs("label",{className:"flex items-start gap-3 p-3",children:[n.jsx($o,{"aria-label":`Import ${he.name}`,checked:ue.includes(he.key),disabled:Q||!M.includes(he.key)&&ue.includes(he.key),onCheckedChange:ge=>A(Pe=>ge?[...Pe,he.key]:Pe.filter(Fe=>Fe!==he.key))}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:he.name}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:ue.includes(he.key)&&!M.includes(he.key)?"Required dependency":""}),he.type==="setups"&&["mcp","skill"].map(ge=>{var Fe;const Pe=(((Fe=he.data)==null?void 0:Fe.items)??[]).filter(_e=>_e.kind===ge);return Pe.length>0&&n.jsxs("span",{className:"mt-1 block text-[11px] leading-relaxed text-muted-foreground",children:[n.jsxs("span",{className:"font-medium",children:[ge==="mcp"?"MCPs":"Skills",":"]})," ",Pe.map(_e=>_e.name).join(", ")]},ge)}),(Ae=he.warnings)==null?void 0:Ae.map((ge,Pe)=>n.jsx("span",{className:"mt-1 block text-[11px] text-amber-700 dark:text-amber-400",children:ge},Pe))]})]},he.key)},pe=k?`${((Ie=k.counts)==null?void 0:Ie.completed)??0} of ${k.items.length} resources complete. Your source stays available.`:T?"Choose what to copy. Required dependencies are included in the review.":"Copy saved configuration between your computer, connected hosts, and OpenRod Cloud.";return n.jsx(tn,{open:!0,onOpenChange:he=>{!he&&!H&&t()},children:n.jsxs(nn,{className:"gap-4 sm:max-w-xl",children:[n.jsxs(sn,{className:"pr-6",children:[n.jsx(Qt,{children:k?py(k.status):"Import data"}),n.jsx(Sn,{className:"text-xs leading-relaxed",children:pe})]}),n.jsx("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground","aria-label":"Import steps",children:["Locations","Selection","Review & import"].map((he,Ae)=>n.jsxs(x.Fragment,{children:[Ae>0&&n.jsx(mu,{className:"size-3"}),n.jsx("span",{className:Ae===(se==="source"?0:se==="select"?1:2)?"font-medium text-foreground":"",children:he})]},he))}),n.jsxs("div",{className:"max-h-[60svh] overflow-y-auto pr-1",children:[se==="source"&&n.jsxs(ho,{duration:.15,offset:3,className:"space-y-5",children:[n.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-end gap-3",children:[n.jsxs("label",{className:"grid gap-2 text-xs font-medium",children:["From",n.jsxs(pn,{"aria-label":"Import source",value:c,onChange:he=>{u(he.target.value),w(Ae=>({from:Ae.from,to:Ae.to}))},disabled:Q,className:"w-full text-xs",children:[n.jsx("option",{value:"",children:"Choose source"}),W.map(he=>n.jsx("option",{value:Ts(he),children:Dn(he)},Ts(he)))]})]}),n.jsx(mu,{className:"mb-2 size-4 text-muted-foreground"}),n.jsxs("label",{className:"grid gap-2 text-xs font-medium",children:["To",n.jsxs(pn,{"aria-label":"Import destination",value:f,onChange:he=>{m(he.target.value),_([])},disabled:Q,className:"w-full text-xs",children:[n.jsx("option",{value:"",children:"Choose destination"}),(r==null?void 0:r.localViewer)&&(f==="cloud"||!J.some(he=>he.cloud||he.target==="cloud"))&&n.jsxs("option",{value:"cloud",disabled:!(r!=null&&r.available),children:["OpenRod Cloud",r!=null&&r.available?"":" · Coming soon"]}),J.map(he=>n.jsx("option",{value:Ts(he),disabled:Ts(he)===c,children:Dn(he)},Ts(he)))]})]})]}),n.jsxs("fieldset",{className:"space-y-1",children:[n.jsx("legend",{className:"mb-2 text-xs font-medium",children:"Include"}),$x.map(he=>n.jsxs("label",{className:"flex cursor-pointer items-center gap-3 rounded-md p-2 hover:bg-muted/50",children:[n.jsx($o,{checked:p.includes(he.id),disabled:Q,onCheckedChange:Ae=>b(ge=>Ae?[...ge,he.id]:ge.filter(Pe=>Pe!==he.id))}),n.jsxs("span",{children:[n.jsx("span",{className:"block text-xs font-medium",children:he.label}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:he.description})]})]},he.id))]}),p.includes("activity")&&n.jsxs("div",{className:"grid gap-2 rounded-lg border bg-muted/20 p-3",children:[n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 500 events per reviewed batch. Leave dates empty for the latest history. Dates use your current timezone."}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsxs("label",{className:"grid gap-1.5 text-[11px]",children:["From",n.jsx(Ot,{type:"datetime-local",value:v.from,disabled:Q,onChange:he=>w(Ae=>({from:he.target.value,to:Ae.to})),className:"text-xs"})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px]",children:["To",n.jsx(Ot,{type:"datetime-local",value:v.to,disabled:Q,onChange:he=>w(Ae=>({from:Ae.from,to:he.target.value})),className:"text-xs"})]})]})]}),n.jsx("p",{className:"rounded-md border border-border bg-muted/20 p-3 text-[11px] leading-relaxed text-muted-foreground",children:"Credentials must be connected at the destination. Sandbox workspace copying is available from each sandbox. Activity history is copied only when selected; raw payloads and credential values are excluded."}),D.length>0&&n.jsxs("div",{className:"space-y-1 border-t pt-3",children:[n.jsx("p",{className:"mb-2 text-xs font-medium",children:"Recent imports at this destination"}),D.slice(0,5).map(he=>{var Ae,ge,Pe;return n.jsxs("button",{className:"flex w-full items-center justify-between rounded-md p-2 text-left text-xs hover:bg-muted",disabled:Q,onClick:()=>{q(F(L)),O(he)},children:[n.jsxs("span",{children:[((Ae=he.source)==null?void 0:Ae.label)||"Configuration import"," ",n.jsxs("span",{className:"text-muted-foreground",children:["· ",((ge=he.items)==null?void 0:ge.length)??((Pe=he.counts)==null?void 0:Pe.total)??0," resources"]})]}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:py(he.status)})]},he.id)})]})]}),se==="select"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("p",{className:"flex items-center gap-2 text-xs",children:[n.jsx("span",{children:Dn(z)}),n.jsx(mu,{className:"size-3 text-muted-foreground"}),n.jsx("span",{children:Dn(L)})]}),!T.resources.length&&n.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"No saved resources were found for these categories. For MCPs and skills, use Bring my setup on the source first."}),n.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[n.jsxs("span",{children:[ue.length," selected",ue.length>M.length?` · ${ue.length-M.length} required dependencies`:""]}),n.jsx(le,{variant:"ghost",size:"sm",disabled:Q,onClick:()=>A(M.length?[]:T.resources.filter(he=>p.includes(he.type)).map(he=>he.key)),children:M.length?"Clear selection":"Select all"})]}),n.jsx("div",{className:"space-y-5",children:Wee(T.resources).map(he=>n.jsxs("section",{"aria-labelledby":`import-section-${he.id}`,className:"space-y-2",children:[n.jsxs("h3",{id:`import-section-${he.id}`,className:"flex items-center justify-between text-xs font-semibold",children:[n.jsx("span",{children:he.label}),n.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground",children:[he.items.filter(Ae=>ue.includes(Ae.key)).length," / ",he.items.length]})]}),he.groups?n.jsx("div",{className:"space-y-3",children:he.groups.map(Ae=>n.jsxs("section",{"aria-labelledby":`import-subsection-${Ae.id}`,className:"space-y-1.5",children:[n.jsx("h4",{id:`import-subsection-${Ae.id}`,className:"text-[11px] font-medium text-muted-foreground",children:Ae.label}),n.jsx("div",{className:"divide-y rounded-lg border",children:Ae.items.map(oe)})]},Ae.id))}):n.jsx("div",{className:"divide-y rounded-lg border",children:he.items.map(oe)})]},he.id))}),ye.error&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:ye.error}),((ce=T.pages)==null?void 0:ce.activity)&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[T.pages.activity.exported," of ",T.pages.activity.total," matching activity events in this batch.",T.pages.activity.nextOffset!=null?" After importing, load the next batch to continue with older history.":""]}),((Te=T.excluded)==null?void 0:Te.length)>0&&n.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[n.jsxs("summary",{className:"cursor-pointer",children:[T.excluded.length," excluded or needing attention"]}),n.jsx("ul",{className:"mt-2 space-y-1",children:T.excluded.map((he,Ae)=>n.jsxs("li",{children:[he.name??Yd[he.type]??he.type,": ",he.reason]},Ae))})]})]}),k&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsxs("span",{children:[((re=k.source)==null?void 0:re.label)||"Source"," → ",L?Dn(L):"Destination"]}),n.jsxs("span",{className:"text-muted-foreground",children:[k.items.length," resources"]})]}),k.status!=="planned"&&n.jsx("div",{role:"progressbar","aria-label":"Import progress","aria-valuenow":DR(k),"aria-valuemin":0,"aria-valuemax":100,className:"h-1 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full bg-primary transition-[width] motion-reduce:transition-none",style:{width:`${DR(k)}%`}})}),n.jsx("div",{className:"divide-y rounded-lg border",children:k.items.map(he=>{var Ae;return n.jsxs("div",{className:"flex items-start gap-3 p-3",children:[he.status==="running"?n.jsx(kt,{className:"mt-0.5 size-3.5"}):["created","completed","reused"].includes(he.status)?n.jsx(Yn,{className:"mt-0.5 size-3.5 text-emerald-600"}):he.status==="failed"?n.jsx(In,{className:"mt-0.5 size-3.5 text-destructive"}):n.jsx(gf,{className:"mt-0.5 size-3.5 text-muted-foreground"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:he.name}),n.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:[Yd[he.type]," · ",k.status==="planned"?he.action==="reuse"?"Use existing":"Create a copy":py(he.status)]}),(Ae=he.warnings)==null?void 0:Ae.map((ge,Pe)=>n.jsx("span",{className:"mt-1 block text-[11px] text-amber-700 dark:text-amber-400",children:ge},Pe)),he.error&&n.jsx("span",{className:"mt-1 block text-[11px] text-destructive",children:typeof he.error=="string"?he.error:he.error.message}),k.status==="planned"&&T&&he.type!=="activity"&&n.jsxs(pn,{"aria-label":`Import action for ${he.name}`,value:he.action,disabled:Q,onChange:ge=>Y("Updating review…",()=>ae(he,ge.target.value)),className:"mt-2 h-7 w-fit min-w-40 text-[11px]",children:[n.jsx("option",{value:"create",children:"Create a copy"}),n.jsx("option",{value:"reuse",children:"Use identical existing"})]})]})]},he.key)})}),k.status==="planned"&&T&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Existing resources can be reused only when their ID and configuration match. Copies receive a new ID when needed."}),(fe=k.warnings)==null?void 0:fe.map((he,Ae)=>n.jsx("p",{className:"text-[11px] text-muted-foreground",children:he},Ae)),Ul(k)&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"You can close this dialog. Reopen Import data at this destination to check progress."})]})]}),B&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:B}),n.jsxs(Hr,{children:[H&&!Ul(k)&&n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>{X.current.abort(),t()},children:"Cancel"}),se!=="source"&&!Ul(k)&&n.jsx(le,{size:"sm",variant:"ghost",disabled:!!H,onClick:ie,children:"Start another import"}),se==="source"&&n.jsxs(le,{size:"sm",disabled:Q||!z||!f||!p.length||c===f||f==="cloud"&&!(r!=null&&r.available),onClick:()=>Y("Reading configuration…",()=>te()),children:[H?n.jsx(kt,{}):n.jsx(gf,{}),H||"Choose resources"]}),se==="select"&&n.jsxs(le,{size:"sm",disabled:Q||!M.length||!!ye.error,onClick:()=>Y("Preparing review…",async()=>O(await V.planImport({bundle:T,selection:M,conflicts:N}))),children:[H&&n.jsx(kt,{}),H||`Review ${ue.length} resources`]}),(k==null?void 0:k.status)==="planned"&&n.jsxs(le,{size:"sm",disabled:Q,onClick:()=>Y("Starting import…",async()=>O(await V.executeImport(k.id))),children:[H&&n.jsx(kt,{}),H||"Import selected data"]}),Ul(k)&&n.jsx(le,{size:"sm",variant:"outline",disabled:!!H||k.cancelRequested||k.status==="cancelling",onClick:()=>Y("Cancelling…",async()=>O(await V.cancelImport(k.id))),children:k.cancelRequested?"Cancelling…":"Cancel import"}),Kee(k)&&(((Re=k.counts)==null?void 0:Re.failed)>0||k.items.some(he=>["failed","blocked","cancelled","pending"].includes(he.status)))&&n.jsxs(le,{size:"sm",disabled:!!H,onClick:()=>Y("Retrying…",async()=>O(await V.retryImport(k.id))),children:[n.jsx(PA,{}),"Retry unfinished"]}),(k==null?void 0:k.status)==="completed"&&k.items.some(he=>he.type==="activity")&&((ke=(Oe=T==null?void 0:T.pages)==null?void 0:Oe.activity)==null?void 0:ke.nextOffset)!=null&&n.jsx(le,{size:"sm",variant:"outline",disabled:!!H||!z,onClick:()=>Y("Reading older history…",async()=>{const he={...v,offset:T.pages.activity.nextOffset,snapshot:T.pages.activity.snapshot};w(he),b(["activity"]);const ge=await F(z).exportResources({types:["activity"],activity:OR(he)});R(ge),A(ge.resources.map(Pe=>Pe.key)),E({}),O(null)}),children:"Next history batch"}),k&&k.status!=="planned"&&n.jsx(le,{size:"sm",variant:"outline",onClick:t,children:"Close"})]})]})})}var Jw={};(function e(t,r,a,i){var c=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),u=typeof Path2D=="function"&&typeof DOMMatrix=="function",f=(function(){if(!t.OffscreenCanvas)return!1;try{var z=new OffscreenCanvas(1,1),L=z.getContext("2d");L.fillRect(0,0,1,1);var X=z.transferToImageBitmap();L.createPattern(X,"no-repeat")}catch{return!1}return!0})();function m(){}function h(z){var L=r.exports.Promise,X=L!==void 0?L:t.Promise;return typeof X=="function"?new X(z):(z(m,m),null)}var g=(function(z,L){return{transform:function(X){if(z)return X;if(L.has(X))return L.get(X);var ee=new OffscreenCanvas(X.width,X.height),$=ee.getContext("2d");return $.drawImage(X,0,0),L.set(X,ee),ee},clear:function(){L.clear()}}})(f,new Map),p=(function(){var z=Math.floor(16.666666666666668),L,X,ee={},$=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(L=function(U){var F=Math.random();return ee[F]=requestAnimationFrame(function Y(ne){$===ne||$+z-1<ne?($=ne,delete ee[F],U()):ee[F]=requestAnimationFrame(Y)}),F},X=function(U){ee[U]&&cancelAnimationFrame(ee[U])}):(L=function(U){return setTimeout(U,z)},X=function(U){return clearTimeout(U)}),{frame:L,cancel:X}})(),b=(function(){var z,L,X={};function ee($){function U(F,Y){$.postMessage({options:F||{},callback:Y})}$.init=function(Y){var ne=Y.transferControlToOffscreen();$.postMessage({canvas:ne},[ne])},$.fire=function(Y,ne,te){if(L)return U(Y,null),L;var ye=Math.random().toString(36).slice(2);return L=h(function(ae){function ue(se){se.data.callback===ye&&(delete X[ye],$.removeEventListener("message",ue),L=null,g.clear(),te(),ae())}$.addEventListener("message",ue),U(Y,ye),X[ye]=ue.bind(null,{data:{callback:ye}})}),L},$.reset=function(){$.postMessage({reset:!0});for(var Y in X)X[Y](),delete X[Y]}}return function(){if(z)return z;if(!a&&c){var $=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
553
+ `);try{z=new Worker(URL.createObjectURL(new Blob([$])))}catch(U){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",U),null}ee(z)}return z}})(),v={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function w(z,L){return L?L(z):z}function C(z){return z!=null}function S(z,L,X){return w(z&&C(z[L])?z[L]:v[L],X)}function N(z){return z<0?0:Math.floor(z)}function E(z,L){return Math.floor(Math.random()*(L-z))+z}function T(z){return parseInt(z,16)}function R(z){return z.map(M)}function M(z){var L=String(z).replace(/[^0-9a-f]/gi,"");return L.length<6&&(L=L[0]+L[0]+L[1]+L[1]+L[2]+L[2]),{r:T(L.substring(0,2)),g:T(L.substring(2,4)),b:T(L.substring(4,6))}}function A(z){var L=S(z,"origin",Object);return L.x=S(L,"x",Number),L.y=S(L,"y",Number),L}function k(z){z.width=document.documentElement.clientWidth,z.height=document.documentElement.clientHeight}function O(z){var L=z.getBoundingClientRect();z.width=L.width,z.height=L.height}function D(z){var L=document.createElement("canvas");return L.style.position="fixed",L.style.top="0px",L.style.left="0px",L.style.pointerEvents="none",L.style.zIndex=z,L}function _(z,L,X,ee,$,U,F,Y,ne){z.save(),z.translate(L,X),z.rotate(U),z.scale(ee,$),z.arc(0,0,1,F,Y,ne),z.restore()}function H(z){var L=z.angle*(Math.PI/180),X=z.spread*(Math.PI/180);return{x:z.x,y:z.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:z.startVelocity*.5+Math.random()*z.startVelocity,angle2D:-L+(.5*X-Math.random()*X),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:z.color,shape:z.shape,tick:0,totalTicks:z.ticks,decay:z.decay,drift:z.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:z.gravity*3,ovalScalar:.6,scalar:z.scalar,flat:z.flat}}function G(z,L){L.x+=Math.cos(L.angle2D)*L.velocity+L.drift,L.y+=Math.sin(L.angle2D)*L.velocity+L.gravity,L.velocity*=L.decay,L.flat?(L.wobble=0,L.wobbleX=L.x+10*L.scalar,L.wobbleY=L.y+10*L.scalar,L.tiltSin=0,L.tiltCos=0,L.random=1):(L.wobble+=L.wobbleSpeed,L.wobbleX=L.x+10*L.scalar*Math.cos(L.wobble),L.wobbleY=L.y+10*L.scalar*Math.sin(L.wobble),L.tiltAngle+=.1,L.tiltSin=Math.sin(L.tiltAngle),L.tiltCos=Math.cos(L.tiltAngle),L.random=Math.random()+2);var X=L.tick++/L.totalTicks,ee=L.x+L.random*L.tiltCos,$=L.y+L.random*L.tiltSin,U=L.wobbleX+L.random*L.tiltCos,F=L.wobbleY+L.random*L.tiltSin;if(z.fillStyle="rgba("+L.color.r+", "+L.color.g+", "+L.color.b+", "+(1-X)+")",z.beginPath(),u&&L.shape.type==="path"&&typeof L.shape.path=="string"&&Array.isArray(L.shape.matrix))z.fill(W(L.shape.path,L.shape.matrix,L.x,L.y,Math.abs(U-ee)*.1,Math.abs(F-$)*.1,Math.PI/10*L.wobble));else if(L.shape.type==="bitmap"){var Y=Math.PI/10*L.wobble,ne=Math.abs(U-ee)*.1,te=Math.abs(F-$)*.1,ye=L.shape.bitmap.width*L.scalar,ae=L.shape.bitmap.height*L.scalar,ue=new DOMMatrix([Math.cos(Y)*ne,Math.sin(Y)*ne,-Math.sin(Y)*te,Math.cos(Y)*te,L.x,L.y]);ue.multiplySelf(new DOMMatrix(L.shape.matrix));var se=z.createPattern(g.transform(L.shape.bitmap),"no-repeat");se.setTransform(ue),z.globalAlpha=1-X,z.fillStyle=se,z.fillRect(L.x-ye/2,L.y-ae/2,ye,ae),z.globalAlpha=1}else if(L.shape==="circle")z.ellipse?z.ellipse(L.x,L.y,Math.abs(U-ee)*L.ovalScalar,Math.abs(F-$)*L.ovalScalar,Math.PI/10*L.wobble,0,2*Math.PI):_(z,L.x,L.y,Math.abs(U-ee)*L.ovalScalar,Math.abs(F-$)*L.ovalScalar,Math.PI/10*L.wobble,0,2*Math.PI);else if(L.shape==="star")for(var Q=Math.PI/2*3,ie=4*L.scalar,oe=8*L.scalar,pe=L.x,xe=L.y,je=5,Ie=Math.PI/je;je--;)pe=L.x+Math.cos(Q)*oe,xe=L.y+Math.sin(Q)*oe,z.lineTo(pe,xe),Q+=Ie,pe=L.x+Math.cos(Q)*ie,xe=L.y+Math.sin(Q)*ie,z.lineTo(pe,xe),Q+=Ie;else z.moveTo(Math.floor(L.x),Math.floor(L.y)),z.lineTo(Math.floor(L.wobbleX),Math.floor($)),z.lineTo(Math.floor(U),Math.floor(F)),z.lineTo(Math.floor(ee),Math.floor(L.wobbleY));return z.closePath(),z.fill(),L.tick<L.totalTicks}function B(z,L,X,ee,$){var U=L.slice(),F=z.getContext("2d"),Y,ne,te=h(function(ye){function ae(){Y=ne=null,F.clearRect(0,0,ee.width,ee.height),g.clear(),$(),ye()}function ue(){a&&!(ee.width===i.width&&ee.height===i.height)&&(ee.width=z.width=i.width,ee.height=z.height=i.height),!ee.width&&!ee.height&&(X(z),ee.width=z.width,ee.height=z.height),F.clearRect(0,0,ee.width,ee.height),U=U.filter(function(se){return G(F,se)}),U.length?Y=p.frame(ue):ae()}Y=p.frame(ue),ne=ae});return{addFettis:function(ye){return U=U.concat(ye),te},canvas:z,promise:te,reset:function(){Y&&p.cancel(Y),ne&&ne()}}}function P(z,L){var X=!z,ee=!!S(L||{},"resize"),$=!1,U=S(L,"disableForReducedMotion",Boolean),F=c&&!!S(L||{},"useWorker"),Y=F?b():null,ne=X?k:O,te=z&&Y?!!z.__confetti_initialized:!1,ye=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ae;function ue(Q,ie,oe){for(var pe=S(Q,"particleCount",N),xe=S(Q,"angle",Number),je=S(Q,"spread",Number),Ie=S(Q,"startVelocity",Number),ce=S(Q,"decay",Number),Te=S(Q,"gravity",Number),re=S(Q,"drift",Number),fe=S(Q,"colors",R),Re=S(Q,"ticks",Number),Oe=S(Q,"shapes"),ke=S(Q,"scalar"),he=!!S(Q,"flat"),Ae=A(Q),ge=pe,Pe=[],Fe=z.width*Ae.x,_e=z.height*Ae.y;ge--;)Pe.push(H({x:Fe,y:_e,angle:xe,spread:je,startVelocity:Ie,color:fe[ge%fe.length],shape:Oe[E(0,Oe.length)],ticks:Re,decay:ce,gravity:Te,drift:re,scalar:ke,flat:he}));return ae?ae.addFettis(Pe):(ae=B(z,Pe,ne,ie,oe),ae.promise)}function se(Q){var ie=U||S(Q,"disableForReducedMotion",Boolean),oe=S(Q,"zIndex",Number);if(ie&&ye)return h(function(Ie){Ie()});X&&ae?z=ae.canvas:X&&!z&&(z=D(oe),document.body.appendChild(z)),ee&&!te&&ne(z);var pe={width:z.width,height:z.height};Y&&!te&&Y.init(z),te=!0,Y&&(z.__confetti_initialized=!0);function xe(){if(Y){var Ie={getBoundingClientRect:function(){if(!X)return z.getBoundingClientRect()}};ne(Ie),Y.postMessage({resize:{width:Ie.width,height:Ie.height}});return}pe.width=pe.height=null}function je(){ae=null,ee&&($=!1,t.removeEventListener("resize",xe)),X&&z&&(document.body.contains(z)&&document.body.removeChild(z),z=null,te=!1)}return ee&&!$&&($=!0,t.addEventListener("resize",xe,!1)),Y?Y.fire(Q,pe,je):ue(Q,pe,je)}return se.reset=function(){Y&&Y.reset(),ae&&ae.reset()},se}var V;function q(){return V||(V=P(null,{useWorker:!0,resize:!0})),V}function W(z,L,X,ee,$,U,F){var Y=new Path2D(z),ne=new Path2D;ne.addPath(Y,new DOMMatrix(L));var te=new Path2D;return te.addPath(ne,new DOMMatrix([Math.cos(F)*$,Math.sin(F)*$,-Math.sin(F)*U,Math.cos(F)*U,X,ee])),te}function K(z){if(!u)throw new Error("path confetti are not supported in this browser");var L,X;typeof z=="string"?L=z:(L=z.path,X=z.matrix);var ee=new Path2D(L),$=document.createElement("canvas"),U=$.getContext("2d");if(!X){for(var F=1e3,Y=F,ne=F,te=0,ye=0,ae,ue,se=0;se<F;se+=2)for(var Q=0;Q<F;Q+=2)U.isPointInPath(ee,se,Q,"nonzero")&&(Y=Math.min(Y,se),ne=Math.min(ne,Q),te=Math.max(te,se),ye=Math.max(ye,Q));ae=te-Y,ue=ye-ne;var ie=10,oe=Math.min(ie/ae,ie/ue);X=[oe,0,0,oe,-Math.round(ae/2+Y)*oe,-Math.round(ue/2+ne)*oe]}return{type:"path",path:L,matrix:X}}function J(z){var L,X=1,ee="#000000",$='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof z=="string"?L=z:(L=z.text,X="scalar"in z?z.scalar:X,$="fontFamily"in z?z.fontFamily:$,ee="color"in z?z.color:ee);var U=10*X,F=""+U+"px "+$,Y=new OffscreenCanvas(U,U),ne=Y.getContext("2d");ne.font=F;var te=ne.measureText(L),ye=Math.ceil(te.actualBoundingBoxRight+te.actualBoundingBoxLeft),ae=Math.ceil(te.actualBoundingBoxAscent+te.actualBoundingBoxDescent),ue=2,se=te.actualBoundingBoxLeft+ue,Q=te.actualBoundingBoxAscent+ue;ye+=ue+ue,ae+=ue+ue,Y=new OffscreenCanvas(ye,ae),ne=Y.getContext("2d"),ne.font=F,ne.fillStyle=ee,ne.fillText(L,se,Q);var ie=1/X;return{type:"bitmap",bitmap:Y.transferToImageBitmap(),matrix:[ie,0,0,ie,-ye*ie/2,-ae*ie/2]}}r.exports=function(){return q().apply(this,arguments)},r.exports.reset=function(){q().reset()},r.exports.create=P,r.exports.shapeFromPath=K,r.exports.shapeFromText=J})((function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}})(),Jw,!1);const Zee=Jw.exports;Jw.exports.create;const zR="openrod:cloud-announcement:v1:dismissed";let IR,PR=!1;function Jee(){return IR??(IR=fetch("/api/os/announcements/cloud",{method:"POST",headers:{"content-type":"application/json","x-openshell-console":"1"},body:"{}"}).then(e=>e.ok?e.json():{show:!1}).catch(()=>({show:!1}))),IR}function ete(){const[e,t]=x.useState(!0),r=x.useRef(null);x.useEffect(()=>{let i=!0;return Jee().then(({show:c})=>{let u=PR;try{u||(u=localStorage.getItem(zR)==="true")}catch{}i&&t(!c||u)}),()=>{i=!1}},[]),x.useEffect(()=>{if(e||!r.current)return;const i=Zee.create(r.current,{resize:!0}),c={particleCount:35,spread:75,startVelocity:16,gravity:.45,ticks:160,scalar:.65,disableForReducedMotion:!0,colors:["#4c88df","#e6b75a","#95bde0","#c0a3e8"]};return i({...c,angle:65,origin:{x:.1,y:1}}),i({...c,angle:115,origin:{x:.9,y:1}}),()=>i.reset()},[e]);function a(){PR=!0,t(!0);try{localStorage.setItem(zR,"true")}catch{}}return e?null:n.jsxs("section",{"aria-label":"OpenRod Cloud announcement",className:"sticky top-0 z-20 flex min-h-12 shrink-0 items-center justify-center overflow-hidden border-b border-blue-900/10 bg-[#e4eeff] py-2 pl-4 pr-12 text-[#234c88] dark:border-blue-200/10 dark:bg-[#1c3050] dark:text-[#d5e5ff]",children:[n.jsx("canvas",{ref:r,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-full"}),n.jsxs("div",{className:"relative flex items-center gap-2.5 text-[13px] leading-5",children:[n.jsx("img",{src:"/openrod.png",alt:"OpenRod",className:"size-7 shrink-0 object-contain"}),n.jsxs("p",{children:[n.jsx("span",{className:"opacity-75",children:"New in OpenRod:"})," ",n.jsx("strong",{className:"font-semibold",children:"Meet OpenRod Cloud!"})]})]}),n.jsx(le,{variant:"ghost",size:"icon-sm",onClick:a,"aria-label":"Dismiss OpenRod Cloud announcement",className:"absolute right-2 top-1/2 -translate-y-1/2 text-current hover:bg-blue-950/10 hover:text-current dark:hover:bg-white/10 focus-visible:ring-blue-600",children:n.jsx(In,{"aria-hidden":"true",className:"size-3.5"})})]})}const tte=x.lazy(()=>gy(()=>import("./terminal-view-Sk9ve2lh.js"),__vite__mapDeps([3,4])).then(e=>({default:e.TerminalView}))),P1={sandboxes:"Sandboxes",activity:"Activity",groups:"Groups",egress:"Network",ingress:"Network",secrets:"Secrets",templates:"Templates",setups:"MCPs & Skills",connections:"Connections"};class nte extends x.Component{constructor(){super(...arguments);ln(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?n.jsxs("div",{role:"alert",className:"mx-auto mt-10 max-w-md rounded-lg border border-border p-5 text-center text-sm",children:[n.jsx("p",{children:"This page hit an error."}),n.jsx("p",{className:"mt-1 font-mono text-[11px] text-muted-foreground",children:this.state.error.message}),n.jsx("button",{className:"mt-3 text-xs underline underline-offset-2",onClick:()=>this.setState({error:null}),children:"Try again"})]}):this.props.children}}function _R(){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",i=e.get("target")??new URLSearchParams(window.location.search).get("target")??void 0;return{id:JSON.stringify([i??"local",JSON.stringify([t,r])]),context:JSON.stringify([t,r]),gateway:t,workspace:r,connected:!0,remote:a,target:i,cloud:i==="cloud",label:e.get("label")||(a?`SSH · ${t}`:"Local")}}function LR(){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"),i=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:i}}function $R(){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"):P1[e]?e:"sandboxes"}function ste(){const{connection:e}=oi(),t=Kw();return x.useEffect(()=>{en.observeConsole(e)},[e,t.sharing]),null}function rte(){var E,T;const e=Bf(),t=js(),r=!(t!=null&&t.localViewer),[a,i]=x.useState($R),[c,u]=x.useState(LR),[f,m]=x.useState(0),[h,g]=x.useState(_R),p=Kw();x.useEffect(()=>{en.observeView(c?"terminal":a)},[a,!!c,p.sharing]);const[b,v]=x.useState(null),w=vo(),C=x.useMemo(()=>qee(w.locations,null,e.target??"local"),[w.locations,e.target]),S=x.useCallback((R,M)=>{var O;const A=M??null;if((O=e.signal)!=null&&O.aborted||!P1[R])return;i(R),g(A);const k=A?`?${new URLSearchParams({gateway:A.gateway,workspace:A.workspace,label:A.label,remote:A.remote?"1":"0",...A.target?{target:A.target}:{}})}`:"";window.history.pushState(null,"",R==="sandboxes"&&!A?window.location.pathname:`#${R}${k}`)},[e.signal]),N=r?void 0:()=>{S("sandboxes"),m(R=>R+1)};return x.useEffect(()=>{const R=()=>{i($R()),u(LR()),g(_R())};window.addEventListener("popstate",R),window.addEventListener("hashchange",R);const M=A=>S(A.detail.view,A.detail.location);return window.addEventListener("openrod-navigate",M),()=>{window.removeEventListener("popstate",R),window.removeEventListener("hashchange",R),window.removeEventListener("openrod-navigate",M)}},[S]),x.useEffect(()=>{const R=M=>{var A,k,O;return v({...M.detail,type:((A=M.detail)==null?void 0:A.type)??((O=(k=M.detail)==null?void 0:k.types)==null?void 0:O[0]),key:Date.now()})};return window.addEventListener("openrod-import",R),()=>window.removeEventListener("openrod-import",R)},[]),c?((E=c.location)==null?void 0:E.target)==="cloud"&&(t!=null&&t.localViewer)&&(t.checking||!t.connected)?n.jsx("main",{className:"grid min-h-svh place-items-center p-6",children:n.jsxs("section",{className:"text-center text-sm",children:[n.jsx("p",{role:"status",children:t.checking?"Checking cloud connection…":"Connect to OpenRod Cloud to open this terminal."}),!t.checking&&n.jsx("a",{href:"#connections",className:"mt-4 inline-block underline underline-offset-4",children:"Open Connections"})]})}):n.jsxs(n.Fragment,{children:[n.jsx(x.Suspense,{fallback:null,children:n.jsx(Zn,{location:c.location,children:n.jsx(tte,{name:c.name,session:c.session,setupLogin:c.setupLogin,mcp:c.mcp},`${t==null?void 0:t.target} ${((T=c.location)==null?void 0:T.context)??""} ${c.name} ${c.session??""}`)})}),n.jsx(ER,{position:"bottom-right"})]}):n.jsx(Zn,{location:C,children:n.jsxs(Rf,{children:[n.jsx(ste,{}),n.jsxs(tZ,{children:[n.jsx(xZ,{view:a,onNavigate:S}),n.jsxs(rZ,{className:"min-w-0 bg-background",children:[n.jsx(ete,{}),n.jsxs("header",{className:"flex h-14 shrink-0 items-center border-b border-border bg-card px-4 sm:px-6",children:[n.jsx(sZ,{className:"mr-2 md:hidden"}),n.jsx("h1",{className:"text-[18px] font-semibold tracking-tight",children:P1[a]}),n.jsx(Fee,{})]}),n.jsx(sQ,{}),n.jsx(gQ,{}),!r&&n.jsx(yQ,{}),n.jsxs(nte,{view:a,children:[a==="sandboxes"&&n.jsx(fJ,{onNavigate:S,allowRemote:!r,createRequest:f,onCreateRequestHandled:()=>m(0)}),a==="activity"&&n.jsx(RJ,{combined:!0}),a==="groups"&&n.jsx(zJ,{combined:!0,onNavigate:S}),(a==="egress"||a==="ingress")&&n.jsx(YJ,{combined:!0,tab:a,onNavigate:S,requestedLocation:h}),a==="secrets"&&n.jsx(uee,{combined:!0}),a==="templates"&&n.jsx(yee,{}),a==="setups"&&n.jsx(aD,{combined:!0}),a==="connections"&&!r&&n.jsx(Pee,{onCreateSandbox:N})]},`${a}:${MR(C)??"unscoped"}`)]}),n.jsx(ER,{position:"bottom-right"}),b&&n.jsx(Qee,{request:b,onClose:()=>v(null)},b.key)]})]},MR(C)??"unscoped")})}XP.createRoot(document.getElementById("root")).render(n.jsx(nt.StrictMode,{children:n.jsx(LP,{attribute:"class",defaultTheme:"system",enableSystem:!0,storageKey:"openshell-theme",children:n.jsx(Gee,{children:n.jsx(rte,{})})})}));export{le as B,ha as C,Fi as D,ga as L,E8 as R,n2 as T,gn as a,en as b,mf as c,ZY as d,Cu as e,ite as f,Gi as g,qi as h,Rs as i,n as j,zp as p,x as r,a4 as s,vg as t,Pt as u};