openrod 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/THIRD_PARTY_NOTICES.md +84 -1
- package/dist/assets/index-DBqg9X9x.js +553 -0
- package/dist/assets/index-HZ0q_FBv.css +1 -0
- package/dist/assets/index.esm-BqjC2fhp.js +376 -0
- package/dist/assets/index.esm-Cj6nXjOx.js +16 -0
- package/dist/assets/index.esm-Z1y-oluO.js +1666 -0
- package/dist/assets/terminal-view-D-SQcdM5.js +40 -0
- package/dist/index.html +3 -3
- package/package.json +8 -1
- package/server/announcements.js +22 -0
- package/server/api.js +54 -11
- package/server/capabilities.js +13 -0
- package/server/cli.js +18 -2
- package/server/cloud-deployment.js +29 -0
- package/server/cloud-proxy.js +19 -9
- package/server/cloud-runtime.js +72 -0
- package/server/cloud-ssh-proxy.cjs +22 -4
- package/server/cloud-transfer.js +1 -1
- package/server/compute.js +18 -7
- package/server/image-templates.js +17 -0
- package/server/ingress.js +3 -0
- package/server/local-cloud-native.js +7 -1
- package/server/local-cloud.js +3 -3
- package/server/machines.js +33 -18
- package/server/policy-template-store.js +1 -0
- package/server/remote-gateway.js +26 -6
- package/server/remote-http.js +1 -1
- package/server/resource-import-portable.js +155 -0
- package/server/resource-imports.js +412 -0
- package/server/sandbox-identity.js +1 -1
- package/server/security.js +30 -14
- package/server/setup-discovery.js +2 -1
- package/server/setup-packages.js +138 -59
- package/server/setup-preparation.js +4 -3
- package/server/start.js +29 -7
- package/server/worker-auth.js +2 -2
- package/shared/agent-access.js +26 -4
- package/shared/analytics-release.json +5 -0
- package/src/lib/activity-inventory.js +1 -1
- package/src/lib/analytics.js +334 -0
- package/src/lib/api.js +28 -11
- package/src/lib/cloud-sign-in-error.js +13 -0
- package/src/lib/cloud-transfer.js +1 -1
- package/src/lib/combined-activity.js +95 -0
- package/src/lib/connection-host.js +6 -0
- package/src/lib/egress-inventory.js +63 -0
- package/src/lib/local-cloud.js +16 -3
- package/src/lib/location-choice.js +7 -0
- package/src/lib/location-data-reader.js +25 -0
- package/src/lib/locations.js +18 -8
- package/src/lib/placement.js +1 -1
- package/src/lib/resource-imports.js +63 -0
- package/src/lib/resource-sources.js +105 -0
- package/src/lib/sandbox-creations.js +14 -9
- package/src/lib/sandboxes.js +5 -1
- package/src/lib/working-location.js +10 -0
- package/dist/assets/index-89TNohi_.css +0 -1
- package/dist/assets/index-DoKK2G9s.js +0 -545
- package/dist/assets/terminal-view-DzqQnmh2.js +0 -40
|
@@ -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-D-SQcdM5.js","assets/terminal-view-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var kP=Object.defineProperty;var TP=(e,t,r)=>t in e?kP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var an=(e,t,r)=>TP(e,typeof t!="symbol"?t+"":t,r);function EP(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 BA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ny={exports:{}},Pd={};/**
|
|
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 RP(){if(XC)return Pd;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 Pd.Fragment=t,Pd.jsx=r,Pd.jsxs=r,Pd}var WC;function AP(){return WC||(WC=1,ny.exports=RP()),ny.exports}var n=AP(),sy={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 OP(){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"),y=Symbol.iterator;function w($){return $===null||typeof $!="object"?null:($=y&&$[y]||$["@@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 k(){}k.prototype=E.prototype;function A($,U,F){this.props=$,this.context=U,this.refs=N,this.updater=F||C}var O=A.prototype=new k;O.constructor=A,S(O,E.prototype),O.isPureReactComponent=!0;var R=Array.isArray;function T(){}var M={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function _($,U,F){var K=F.ref;return{$$typeof:e,type:$,key:U,ref:K!==void 0?K: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 Y($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(T,T):($.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,K,se){var ne=typeof $;(ne==="undefined"||ne==="boolean")&&($=null);var ve=!1;if($===null)ve=!0;else switch(ne){case"bigint":case"string":case"number":ve=!0;break;case"object":switch($.$$typeof){case e:case t:ve=!0;break;case g:return ve=$._init,W(ve($._payload),U,F,K,se)}}if(ve)return se=se($),ve=K===""?"."+V($,0):K,R(se)?(F="",ve!=null&&(F=ve.replace(P,"$&/")+"/"),W(se,U,F,"",function(re){return re})):se!=null&&(G(se)&&(se=H(se,F+(se.key==null||$&&$.key===se.key?"":(""+se.key).replace(P,"$&/")+"/")+ve)),U.push(se)),1;ve=0;var ae=K===""?".":K+":";if(R($))for(var le=0;le<$.length;le++)K=$[le],ne=ae+V(K,le),ve+=W(K,U,F,ne,se);else if(le=w($),typeof le=="function")for($=le.call($),le=0;!(K=$.next()).done;)K=K.value,ne=ae+V(K,le++),ve+=W(K,U,F,ne,se);else if(ne==="object"){if(typeof $.then=="function")return W(Y($),U,F,K,se);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 ve}function q($,U,F){if($==null)return $;var K=[],se=0;return W($,K,"","",function(ne){return U.call(F,ne,se++)}),K}function ee($){if($._status===-1){var U=$._result,F=U();F.then(function(K){($._status===0||$._status===-1)&&($._status=1,$._result=K,F.status===void 0&&(F.status="fulfilled",F.value=K))},function(K){($._status===0||$._status===-1)&&($._status=2,$._result=K,F.status===void 0&&(F.status="rejected",F.reason=K))}),$._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=M.T,F={};F.types=U!==null?U.types:null,M.T=F;try{var K=$(),se=M.S;se!==null&&se(F,K),typeof K=="object"&&K!==null&&typeof K.then=="function"&&K.then(T,z)}catch(ne){z(ne)}finally{U!==null&&F.types!==null&&(U.types=F.types),M.T=U}}function X($){var U=M.T;if(U!==null){var F=U.types;F===null?U.types=[$]:F.indexOf($)===-1&&F.push($)}else L(X.bind(null,$))}var te={map:q,forEach:function($,U,F){q($,function(){U.apply(this,arguments)},F)},count:function($){var U=0;return q($,function(){U++}),U},toArray:function($){return q($,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=te,Dt.Component=E,Dt.Fragment=r,Dt.Profiler=i,Dt.PureComponent=A,Dt.StrictMode=a,Dt.Suspense=m,Dt.ViewTransition=b,Dt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,Dt.__COMPILER_RUNTIME={__proto__:null,c:function($){return M.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 K=S({},$.props),se=$.key;if(U!=null)for(ne in U.key!==void 0&&(se=""+U.key),U)!D.call(U,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&U.ref===void 0||(K[ne]=U[ne]);var ne=arguments.length-2;if(ne===1)K.children=F;else if(1<ne){for(var ve=Array(ne),ae=0;ae<ne;ae++)ve[ae]=arguments[ae+2];K.children=ve}return _($.type,se,K)},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 K,se={},ne=null;if(U!=null)for(K in U.key!==void 0&&(ne=""+U.key),U)D.call(U,K)&&K!=="key"&&K!=="__self"&&K!=="__source"&&(se[K]=U[K]);var ve=arguments.length-2;if(ve===1)se.children=F;else if(1<ve){for(var ae=Array(ve),le=0;le<ve;le++)ae[le]=arguments[le+2];se.children=ae}if($&&$.defaultProps)for(K in ve=$.defaultProps,ve)se[K]===void 0&&(se[K]=ve[K]);return _($,ne,se)},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:ee}},Dt.memo=function($,U){return{$$typeof:h,type:$,compare:U===void 0?null:U}},Dt.startTransition=L,Dt.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},Dt.use=function($){return M.H.use($)},Dt.useActionState=function($,U,F){return M.H.useActionState($,U,F)},Dt.useCallback=function($,U){return M.H.useCallback($,U)},Dt.useContext=function($){return M.H.useContext($)},Dt.useDebugValue=function(){},Dt.useDeferredValue=function($,U){return M.H.useDeferredValue($,U)},Dt.useEffect=function($,U){return M.H.useEffect($,U)},Dt.useEffectEvent=function($){return M.H.useEffectEvent($)},Dt.useId=function(){return M.H.useId()},Dt.useImperativeHandle=function($,U,F){return M.H.useImperativeHandle($,U,F)},Dt.useInsertionEffect=function($,U){return M.H.useInsertionEffect($,U)},Dt.useLayoutEffect=function($,U){return M.H.useLayoutEffect($,U)},Dt.useMemo=function($,U){return M.H.useMemo($,U)},Dt.useOptimistic=function($,U){return M.H.useOptimistic($,U)},Dt.useReducer=function($,U,F){return M.H.useReducer($,U,F)},Dt.useRef=function($){return M.H.useRef($)},Dt.useState=function($){return M.H.useState($)},Dt.useSyncExternalStore=function($,U,F){return M.H.useSyncExternalStore($,U,F)},Dt.useTransition=function(){return M.H.useTransition()},Dt.version="19.3.0",Dt}var ZC;function Mf(){return ZC||(ZC=1,sy.exports=OP()),sy.exports}var x=Mf();const nt=BA(x),MP=EP({__proto__:null,default:nt},[x]);var DP=(e,t,r,a,i,c,u,f)=>{let m=document.documentElement,h=["light","dark"];function g(y){(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[y]?c[y]:y)):m.setAttribute(w,y)}),p(y)}function p(y){f&&h.includes(y)&&(m.style.colorScheme=y)}function b(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(a)g(a);else try{let y=localStorage.getItem(t)||r,w=u&&y==="system"?b():y;g(w)}catch{}},JC=["light","dark"],VA="(prefers-color-scheme: dark)",zP=typeof window>"u",_1=x.createContext(void 0),IP={setTheme:e=>{},themes:[]},UA=()=>{var e;return(e=x.useContext(_1))!=null?e:IP},PP=e=>x.useContext(_1)?x.createElement(x.Fragment,null,e.children):x.createElement(LP,{...e}),_P=["light","dark"],LP=({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,y]=x.useState(()=>BP(i,u)),[w,C]=x.useState(()=>b==="system"?ry():b),S=m?Object.values(m):c,N=x.useCallback(O=>{let R=O;if(!R)return;O==="system"&&r&&(R=ry());let T=m?m[R]:R,M=t?VP(g):null,D=document.documentElement,_=H=>{H==="class"?(D.classList.remove(...S),T&&D.classList.add(T)):H.startsWith("data-")&&(T?D.setAttribute(H,T):D.removeAttribute(H))};if(Array.isArray(f)?f.forEach(_):_(f),a){let H=JC.includes(u)?u:null,G=JC.includes(R)?R:H;D.style.colorScheme=G}M==null||M()},[g]),E=x.useCallback(O=>{let R=typeof O=="function"?O(b):O;y(R);try{localStorage.setItem(i,R)}catch{}},[b]),k=x.useCallback(O=>{let R=ry(O);C(R),b==="system"&&r&&!e&&N("system")},[b,e]);x.useEffect(()=>{let O=window.matchMedia(VA);return O.addListener(k),k(O),()=>O.removeListener(k)},[k]),x.useEffect(()=>{let O=R=>{R.key===i&&(R.newValue?y(R.newValue):E(u))};return window.addEventListener("storage",O),()=>window.removeEventListener("storage",O)},[E]),x.useEffect(()=>{N(e??b)},[e,b]);let A=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:A},x.createElement($P,{forcedTheme:e,storageKey:i,attribute:f,enableSystem:r,enableColorScheme:a,defaultTheme:u,value:m,themes:c,nonce:g,scriptProps:p}),h)},$P=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:`(${DP.toString()})(${g})`}})}),BP=(e,t)=>{if(zP)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},VP=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)}},ry=e=>(e||(e=window.matchMedia(VA)),e.matches?"dark":"light"),oy={exports:{}},_d={},ay={exports:{}},iy={};/**
|
|
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 UP(){return ek||(ek=1,(function(e){function t(Y,W){var q=Y.length;Y.push(W);e:for(;0<q;){var ee=q-1>>>1,z=Y[ee];if(0<i(z,W))Y[ee]=W,Y[q]=z,q=ee;else break e}}function r(Y){return Y.length===0?null:Y[0]}function a(Y){if(Y.length===0)return null;var W=Y[0],q=Y.pop();if(q!==W){Y[0]=q;e:for(var ee=0,z=Y.length,L=z>>>1;ee<L;){var X=2*(ee+1)-1,te=Y[X],$=X+1,U=Y[$];if(0>i(te,q))$<z&&0>i(U,te)?(Y[ee]=U,Y[$]=q,ee=$):(Y[ee]=te,Y[X]=q,ee=X);else if($<z&&0>i(U,q))Y[ee]=U,Y[$]=q,ee=$;else break e}}return W}function i(Y,W){var q=Y.sortIndex-W.sortIndex;return q!==0?q:Y.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,y=!1,w=!1,C=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function A(Y){for(var W=r(h);W!==null;){if(W.callback===null)a(h);else if(W.startTime<=Y)a(h),W.sortIndex=W.expirationTime,t(m,W);else break;W=r(h)}}function O(Y){if(C=!1,A(Y),!w)if(r(m)!==null)w=!0,R||(R=!0,G());else{var W=r(h);W!==null&&V(O,W.startTime-Y)}}var R=!1,T=-1,M=5,D=-1;function _(){return S?!0:!(e.unstable_now()-D<M)}function H(){if(S=!1,R){var Y=e.unstable_now();D=Y;var W=!0;try{e:{w=!1,C&&(C=!1,E(T),T=-1),y=!0;var q=b;try{t:{for(A(Y),p=r(m);p!==null&&!(p.expirationTime>Y&&_());){var ee=p.callback;if(typeof ee=="function"){p.callback=null,b=p.priorityLevel;var z=ee(p.expirationTime<=Y);if(Y=e.unstable_now(),typeof z=="function"){p.callback=z,A(Y),W=!0;break t}p===r(m)&&a(m),A(Y)}else a(m);p=r(m)}if(p!==null)W=!0;else{var L=r(h);L!==null&&V(O,L.startTime-Y),W=!1}}break e}finally{p=null,b=q,y=!1}W=void 0}}finally{W?G():R=!1}}}var G;if(typeof k=="function")G=function(){k(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(Y,W){T=N(function(){Y(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(Y){Y.callback=null},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(Y){switch(b){case 1:case 2:case 3:var W=3;break;default:W=b}var q=b;b=W;try{return Y()}finally{b=q}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(Y,W){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var q=b;b=Y;try{return W()}finally{b=q}},e.unstable_scheduleCallback=function(Y,W,q){var ee=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?ee+q:ee):q=ee,Y){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=q+z,Y={id:g++,callback:W,priorityLevel:Y,startTime:q,expirationTime:z,sortIndex:-1},q>ee?(Y.sortIndex=q,t(h,Y),r(m)===null&&Y===r(h)&&(C?(E(T),T=-1):C=!0,V(O,q-ee))):(Y.sortIndex=z,t(m,Y),w||y||(w=!0,R||(R=!0,G()))),Y},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(Y){var W=b;return function(){var q=b;b=W;try{return Y.apply(this,arguments)}finally{b=q}}}})(iy)),iy}var tk;function HP(){return tk||(tk=1,ay.exports=UP()),ay.exports}var ly={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 FP(){if(nk)return Bs;nk=1;var e=Mf();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 y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:y==null?null:y===u?u:""+y,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,y=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:y,integrity:w,fetchPriority:C}):b==="script"&&a.d.X(g,{crossOrigin:y,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,y=h(b,p.crossOrigin);a.d.L(g,b,{crossOrigin:y,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 HA(){if(sk)return ly.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(),ly.exports=FP(),ly.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 GP(){if(rk)return _d;rk=1;var e=HP(),t=Mf(),r=HA();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 v=l.return;if(v===null)break;var j=v.alternate;if(j===null){if(d=v.return,d!==null){l=d;continue}break}if(v.child===j.child){for(j=v.child;j;){if(j===l)return m(v),s;if(j===d)return m(v),o;j=j.sibling}throw Error(a(188))}if(l.return!==d.return)l=v,d=j;else{for(var I=!1,J=v.child;J;){if(J===l){I=!0,l=v,d=j;break}if(J===d){I=!0,d=v,l=j;break}J=J.sibling}if(!I){for(J=j.child;J;){if(J===l){I=!0,l=j,d=v;break}if(J===d){I=!0,d=j,l=v;break}J=J.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,v,j){for(;s!==null;){if((s.tag===5||s.tag===27||s.tag===6)&&l(s,d,v,j)||(s.tag!==22||s.memoizedState===null)&&(o||s.tag!==5&&s.tag!==27)&&p(s.child,o,l,d,v,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 y(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 k(s,o,l){return s===l?!0:s===o?(N=s,!0):!1}function A(s,o,l){return s===l?(E=s,!1):s===o?(E!==null&&(N=s),!0):!1}function O(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 R(s,o,l){for(var d=0,v=s;v;v=l(v))d++;v=0;for(var j=o;j;j=l(j))v++;for(;0<d-v;)s=l(s),d--;for(;0<v-d;)o=l(o),v--;for(;d--;){if(s===o||o!==null&&s===o.alternate)return s;s=l(s),o=l(o)}return null}var T=Object.assign,M=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"),Y=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),X=Symbol.for("react.legacy_hidden"),te=Symbol.for("react.memo_cache_sentinel"),$=Symbol.for("react.view_transition"),U=Symbol.for("react.recoverable"),F=Symbol.iterator;function K(s){return s===null||typeof s!="object"?null:(s=F&&s[F]||s["@@iterator"],typeof s=="function"?s:null)}var se=Symbol.for("react.client.reference");function ne(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===se?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 q: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 Y:var o=s.render;return s=s.displayName,s||(s=o.displayName||o.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case ee:return o=s.displayName||null,o!==null?o:ne(s.type)||"Memo";case z:o=s._payload,s=s._init;try{return ne(s(o))}catch{}}return null}var ve=Array.isArray,ae=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},Q=[],Z=-1;function pe(s){return{current:s}}function ue(s){0>Z||(s.current=Q[Z],Q[Z]=null,Z--)}function ye(s,o){Z++,Q[Z]=s.current,s.current=o}var Ce=pe(null),Ie=pe(null),de=pe(null),Te=pe(null);function oe(s,o){switch(ye(de,o),ye(Ie,s),ye(Ce,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}}ue(Ce),ye(Ce,s)}function fe(){ue(Ce),ue(Ie),ue(de)}function Re(s){var o=s.memoizedState;o!==null&&(nu._currentValue=o.memoizedState,ye(Te,s)),o=Ce.current;var l=oC(o,s.type);o!==l&&(ye(Ie,s),ye(Ce,l))}function Me(s){Ie.current===s&&(ue(Ce),ue(Ie)),Te.current===s&&(ue(Te),nu._currentValue=re)}var ke,me;function Ae(s){if(ke===void 0)try{throw Error()}catch(l){var o=l.stack.trim().match(/\n( *(at )?)/);ke=o&&o[1]||"",me=-1<l.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+ke+s+me}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 Oe=Object.getOwnPropertyDescriptor(s.prototype,"props");Object.defineProperty(s.prototype,"props",{configurable:!0,set:function(){throw Error()}}),$e=!0,new s}finally{$e&&(Oe!==void 0?Object.defineProperty(s.prototype,"props",Oe):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 v=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=d.DetermineComponentFrameRoot(),I=j[0],J=j[1];if(I&&J){var he=I.split(`
|
|
45
|
+
`),Ne=J.split(`
|
|
46
|
+
`);for(v=d=0;d<he.length&&!he[d].includes("DetermineComponentFrameRoot");)d++;for(;v<Ne.length&&!Ne[v].includes("DetermineComponentFrameRoot");)v++;if(d===he.length||v===Ne.length)for(d=he.length-1,v=Ne.length-1;1<=d&&0<=v&&he[d]!==Ne[v];)v--;for(;1<=d&&0<=v;d--,v--)if(he[d]!==Ne[v]){if(d!==1||v!==1)do if(d--,v--,0>v||he[d]!==Ne[v]){var ze=`
|
|
47
|
+
`+he[d].replace(" at new "," at ");return s.displayName&&ze.includes("<anonymous>")&&(ze=ze.replace("<anonymous>",s.displayName)),ze}while(1<=d&&0<=v);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,be=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,kt=e.unstable_setDisableYieldValue,je=null,Ye=null;function et(s){if(typeof Ze=="function"&&kt(s),Ye&&typeof Ye.setStrictMode=="function")try{Ye.setStrictMode(je,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 ce(s,o,l){var d=s.pendingLanes;if(d===0)return 0;var v=0,j=s.suspendedLanes,I=s.pingedLanes;s=s.warmLanes;var J=d&134217727;return J!==0?(d=J&~j,d!==0?v=Kn(d):(I&=J,I!==0?v=Kn(I):l||(l=J&~s,l!==0&&(v=Kn(l))))):(J=d&~j,J!==0?v=Kn(J):I!==0?v=Kn(I):l||(l=d&~s,l!==0&&(v=Kn(l)))),v===0?0:o!==0&&o!==v&&(o&j)===0&&(j=v&-v,l=o&-o,j>=l||j===32&&(l&4194048)!==0)?o:v}function tt(s,o){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&o)===0}function Tt(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),v=1<<d;o|=s[d],l&=~v}return o}function rn(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,v,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 J=s.entanglements,he=s.expirationTimes,Ne=s.hiddenUpdates;for(l=I&~l;0<l;){var ze=31-it(l),$e=1<<ze;J[ze]=0,he[ze]=-1;var we=Ne[ze];if(we!==null)for(Ne[ze]=null,ze=0;ze<we.length;ze++){var Oe=we[ze];Oe!==null&&(Oe.lane&=-536870913)}l&=~$e}d!==0&&Jn(s,d,0),j!==0&&v===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),v=1<<d;v&o|s[d]&o&&(s[d]|=o),l&=~v}}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=le.p;return s!==0?s:(s=window.event,s===void 0?32:UC(s.type))}function Os(s,o){var l=le.p;try{return le.p=s,o()}finally{le.p=l}}var Pn=Math.random().toString(36).slice(2),Un="__reactFiber$"+Pn,Ms="__reactProps$"+Pn,Nr="__reactContainer$"+Pn,Fu="__reactEvents$"+Pn,gc="__reactListeners$"+Pn,xc="__reactHandles$"+Pn,ai="__reactResources$"+Pn,cl="__reactMarker$"+Pn,bc="__reactLoad$"+Pn;function yc(s){delete s[Un],delete s[Ms],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,Ot={};function Bt(s,o){Sn(s,o),Sn(s+"Capture",o)}function Sn(s,o){for(Ot[s]=o,s=0;s<o.length;s++)zt.add(o[s])}var mn=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 on(s){return Xe.call(It,s)?!0:Xe.call(Ct,s)?!1:mn.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(on(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 vc(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Gu(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 v=d.get,j=d.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return v.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=vc(s)?"checked":"value";s._valueTracker=Gu(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=vc(s)?s.checked?"true":"false":s.value),s=d,s!==l?(o.setValue(s),!0):!1}var dm=/[\n"\\]/g;function _n(s){return s.replace(dm,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Gs(s,o,l,d,v,j,I,J){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"),v==null&&j!=null&&(s.defaultChecked=!!j),v!=null&&(s.checked=v&&typeof v!="function"&&typeof v!="symbol"),J!=null&&typeof J!="function"&&typeof J!="symbol"&&typeof J!="boolean"?s.name=""+rs(J):s.removeAttribute("name")}function ii(s,o,l,d,v,j,I,J){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,J||o===s.value||(s.value=o),s.defaultValue=o}d=d??v,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=J?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 v=0;v<l.length;v++)o["$"+l[v]]=!0;for(l=0;l<s.length;l++)v=o.hasOwnProperty("$"+s[l].value),s[l].selected!==v&&(s[l].selected=v),v&&d&&(s[l].defaultSelected=!0)}else{for(l=""+rs(l),o=null,v=0;v<s.length;v++){if(s[v].value===l){s[v].selected=!0,d&&(s[v].defaultSelected=!0);return}o!==null||s[v].disabled||(o=s[v])}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(ve(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 qu(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 v in o)d=o[v],o.hasOwnProperty(v)&&l[v]!==d&&(qu(s,v,d),St=!0)}else for(var j in o)o.hasOwnProperty(j)&&qu(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 Yu=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"]]),Ku=/^[\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 Ku.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function er(){}var fl=null;function ml(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[Ms]||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 v=d[Ms]||null;if(!v)throw Error(a(90));Gs(d,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.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 hl(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)&&(dh(),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[Ms]||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 Xu={};Object.defineProperty(Xu,"passive",{get:function(){pl=!0}}),window.addEventListener("test",Xu,Xu),window.removeEventListener("test",Xu,Xu)}catch{pl=!1}var ci=null,Bx=null,fm=null;function e2(){if(fm)return fm;var s,o=Bx,l=o.length,d,v="value"in ci?ci.value:ci.textContent,j=v.length;for(s=0;s<l&&o[s]===v[s];s++);var I=l-s;for(d=1;d<=I&&o[l-d]===v[j-d];d++);return fm=v.slice(s,1<d?1-d:void 0)}function mm(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 hm(){return!0}function t2(){return!1}function tr(s){function o(l,d,v,j,I){this._reactName=l,this._targetInst=v,this.type=d,this.nativeEvent=j,this.target=I,this.currentTarget=null;for(var J in s)s.hasOwnProperty(J)&&(l=s[J],this[J]=l?l(j):j[J]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?hm:t2,this.isPropagationStopped=t2,this}return T(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=hm)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=hm)},persist:function(){},isPersistent:hm}),o}var ui={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pm=tr(ui),Wu=T({},ui,{view:0,detail:0}),QD=tr(Wu),Vx,Ux,Qu,gm=T({},Wu,{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!==Qu&&(Qu&&s.type==="mousemove"?(Vx=s.screenX-Qu.screenX,Ux=s.screenY-Qu.screenY):Ux=Vx=0,Qu=s),Vx)},movementY:function(s){return"movementY"in s?s.movementY:Ux}}),n2=tr(gm),ZD=T({},gm,{dataTransfer:0}),JD=tr(ZD),ez=T({},Wu,{relatedTarget:0}),Hx=tr(ez),tz=T({},ui,{animationName:0,elapsedTime:0,pseudoElement:0}),nz=tr(tz),sz=T({},ui,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),rz=tr(sz),oz=T({},ui,{data:0}),s2=tr(oz),az={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},iz={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"},lz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cz(s){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(s):(s=lz[s])?!!o[s]:!1}function Fx(){return cz}var uz=T({},Wu,{key:function(s){if(s.key){var o=az[s.key]||s.key;if(o!=="Unidentified")return o}return s.type==="keypress"?(s=mm(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?iz[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"?mm(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?mm(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),dz=tr(uz),fz=T({},gm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),r2=tr(fz),mz=T({},ui,{submitter:0}),hz=tr(mz),pz=T({},Wu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fx}),gz=tr(pz),xz=T({},ui,{propertyName:0,elapsedTime:0,pseudoElement:0}),bz=tr(xz),yz=T({},gm,{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}),vz=tr(yz),wz=T({},ui,{newState:0,oldState:0,source:0}),jz=tr(wz),Sz=[9,13,27,32],Gx=zs&&"CompositionEvent"in window,Zu=null;zs&&"documentMode"in document&&(Zu=document.documentMode);var Nz=zs&&"TextEvent"in window&&!Zu,o2=zs&&(!Gx||Zu&&8<Zu&&11>=Zu),a2=" ",i2=!1;function l2(s,o){switch(s){case"keyup":return Sz.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function c2(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Nc=!1;function Cz(s,o){switch(s){case"compositionend":return c2(o);case"keypress":return o.which!==32?null:(i2=!0,a2);case"textInput":return s=o.data,s===a2&&i2?null:s;default:return null}}function kz(s,o){if(Nc)return s==="compositionend"||!Gx&&l2(s,o)?(s=e2(),fm=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 o2&&o.locale!=="ko"?null:o.data;default:return null}}var Tz={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 u2(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o==="input"?!!Tz[s.type]:o==="textarea"}function d2(s,o,l,d){Zt?Ss?Ss.push(d):Ss=[d]:Zt=d,o=xh(o,"onChange"),0<o.length&&(l=new pm("onChange","change",null,l,d),s.push({event:l,listeners:o}))}var Ju=null,ed=null;function Ez(s){ZN(s,0)}function xm(s){var o=De(s);if(wc(o))return s}function f2(s,o){if(s==="change")return o}var m2=!1;if(zs){var qx;if(zs){var Yx="oninput"in document;if(!Yx){var h2=document.createElement("div");h2.setAttribute("oninput","return;"),Yx=typeof h2.oninput=="function"}qx=Yx}else qx=!1;m2=qx&&(!document.documentMode||9<document.documentMode)}function p2(){Ju&&(Ju.detachEvent("onpropertychange",g2),ed=Ju=null)}function g2(s){if(s.propertyName==="value"&&xm(ed)){var o=[];d2(o,ed,s,ml(s)),hl(Ez,o)}}function Rz(s,o,l){s==="focusin"?(p2(),Ju=o,ed=l,Ju.attachEvent("onpropertychange",g2)):s==="focusout"&&p2()}function Az(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return xm(ed)}function Oz(s,o){if(s==="click")return xm(o)}function Mz(s,o){if(s==="input"||s==="change")return xm(o)}function Dz(s,o){return s===o&&(s!==0||1/s===1/o)||s!==s&&o!==o}var Rr=typeof Object.is=="function"?Object.is:Dz;function td(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 v=l[d];if(!Xe.call(o,v)||!Rr(s[v],o[v]))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 x2(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function b2(s,o){var l=x2(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=x2(l)}}function y2(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?y2(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function v2(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 zz=zs&&"documentMode"in document&&11>=document.documentMode,Cc=null,Wx=null,nd=null,Qx=!1;function w2(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}),nd&&td(nd,d)||(nd=d,d=xh(Wx,"onSelect"),0<d.length&&(o=new pm("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={},j2={};zs&&(j2=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 j2)return Zx[s]=o[l];return s}var S2=xl("animationend"),N2=xl("animationiteration"),C2=xl("animationstart"),Iz=xl("transitionrun"),Pz=xl("transitionstart"),_z=xl("transitioncancel"),k2=xl("transitionend"),T2=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){T2.set(s,o),Bt(o,[s])}var Lz=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=Lz++;return s="_"+s+"t_"+l.toString(32)+"_",o.autoName=s}function E2(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 v=s[l[d]];if(v!=null){if(v==="none")return"none";o=o==null?v:o+(" "+v)}}return o??s.default}function Ca(s,o){return s=E2(s),o=E2(o),o==null?s==="auto"?null:s:o==="auto"?null:o}var bm=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 ym(){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 v=Jr[o];Jr[o++]=null;var j=Jr[o];if(Jr[o++]=null,d!==null&&v!==null){var I=d.pending;I===null?v.next=v:(v.next=I.next,I.next=v),d.pending=v}j!==0&&R2(l,v,j)}}function vm(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 vm(s,o,l,d),wm(s)}function bl(s,o){return vm(s,null,null,o),wm(s)}function R2(s,o,l){s.lanes|=l;var d=s.alternate;d!==null&&(d.lanes|=l);for(var v=!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||(v=!0)),s=j,j=j.return;return s.tag===3?(j=s.stateNode,v&&o!==null&&(v=31-it(l),s=j.hiddenUpdates,d=s[v],d===null?s[v]=[o]:d.push(o),o.lane=l|536870912),j):null}function wm(s){if(50<Nd)throw Nd=0,uh=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 $z(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 $z(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 A2(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 jm(s,o,l,d,v,j){var I=0;if(d=s,typeof d=="function")nb(d)&&(I=1);else if(typeof d=="string")I=mP(s,l,Ce.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(d){case L:return s=dr(31,l,o,v),s.elementType=L,s.lanes=j,s;case H:return yl(l.children,v,j,o);case G:I=8,v|=24;break;case B:return s=dr(12,l,o,v|2),s.elementType=B,s.lanes=j,s;case W:return s=dr(13,l,o,v),s.elementType=W,s.lanes=j,s;case q:return s=dr(19,l,o,v),s.elementType=q,s.lanes=j,s;case X:case $:return s=v|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 Y:I=11;break e;case ee: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,v),o.elementType=s,o.type=d,o.lanes=j,o}function yl(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 O2(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 M2=new WeakMap;function eo(s,o){if(typeof s=="object"&&s!==null){var l=M2.get(s);return l!==void 0?l:(o={value:s,source:o,stack:_e(o)},M2.set(s,o),o)}return{value:s,source:o,stack:_e(o)}}var Rc=[],Ac=0,Sm=null,sd=0,to=[],no=0,di=null,Vo=1,Uo="";function Ta(s,o){Rc[Ac++]=sd,Rc[Ac++]=Sm,Sm=s,sd=o}function D2(s,o,l){to[no++]=Vo,to[no++]=Uo,to[no++]=di,di=s;var d=Vo;s=Uo;var v=32-it(d)-1;d&=~(1<<v),l+=1;var j=32-it(o)+v;if(30<j){var I=v-v%5;j=(d&(1<<I)-1).toString(32),d>>=I,v-=I,Vo=1<<32-it(o)+v|l<<v|d,Uo=j+s}else Vo=1<<j|l<<v|d,Uo=s}function Nm(s){s.return!==null&&(Ta(s,1),D2(s,1,0))}function ob(s){for(;s===Sm;)Sm=Rc[--Ac],Rc[Ac]=null,sd=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 z2(s,o){to[no++]=Vo,to[no++]=Uo,to[no++]=di,Vo=o.id,Uo=o.overflow,di=s}var Ns=null,On=null,Vt=!1,fi=null,so=!1,ab=Error(a(519));function mi(s){var o=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw rd(eo(o,s)),ab}function I2(s){var o=s.stateNode,l=s.type,d=s.memoizedProps;switch(o[Un]=s,o[Ms]=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<kd.length;l++)Yt(kd[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||mi(s,!0)}function Cm(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 Oc(s){if(s!==Ns)return!1;if(!Vt)return Cm(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&&On&&mi(s),Cm(s),o===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));On=wC(s)}else if(o===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));On=wC(s)}else o===27?(o=On,Ri(s.type)?(s=G0,G0=null,On=s):On=o):On=Ns?oo(s.stateNode.nextSibling):null;return!0}function vl(){On=Ns=null,Vt=!1}function ib(){var s=fi;return s!==null&&(hr===null?hr=s:hr.push.apply(hr,s),fi=null),s}function rd(s){fi===null?fi=[s]:fi.push(s)}var lb=pe(null),wl=null,Ea=null;function hi(s,o,l){ye(lb,o._currentValue),o._currentValue=l}function Ra(s){s._currentValue=lb.current,ue(lb)}function km(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 v=s.child;for(v!==null&&(v.return=s);v!==null;){var j=v.dependencies;if(j!==null){var I=v.child;j=j.firstContext;e:for(;j!==null;){var J=j;j=v;for(var he=0;he<o.length;he++)if(J.context===o[he]){j.lanes|=l,J=j.alternate,J!==null&&(J.lanes|=l),km(j.return,l,s),d||(I=null);break e}j=J.next}}else if(v.tag===18){if(I=v.return,I===null)throw Error(a(341));I.lanes|=l,j=I.alternate,j!==null&&(j.lanes|=l),km(I,l,s),I=null}else v.tag===13&&v.memoizedState!==null&&v.memoizedState.dehydrated===null?(v.lanes|=l,I=v.alternate,I!==null&&(I.lanes|=l),km(v.return,l,s),I=v.child,I=I!==null?I.sibling:null):I=v.child;if(I!==null)I.return=v;else for(I=v;I!==null;){if(I===s){I=null;break}if(v=I.sibling,v!==null){v.return=I.return,I=v;break}I=I.return}v=I}}function jl(s,o,l,d){s=null;for(var v=o,j=!1;v!==null;){if(!j){if((v.flags&524288)!==0)j=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var I=v.alternate;if(I===null)throw Error(a(387));if(I=I.memoizedProps,I!==null){var J=v.type;Rr(v.pendingProps.value,I.value)||(s!==null?s.push(J):s=[J])}}else if(v===Te.current){if(I=v.alternate,I===null)throw Error(a(387));I.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(s!==null?s.push(nu):s=[nu])}v=v.return}return s!==null&&cb(o,s,l,d),o.flags|=262144,s!==null}function Tm(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 P2(wl,s)}function Em(s,o){return wl===null&&Sl(s),P2(s,o)}function P2(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 Bz=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()})}},Vz=e.unstable_scheduleCallback,Uz=e.unstable_NormalPriority,os={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ub(){return{controller:new Bz,data:new Map,refCount:0}}function od(s){s.refCount--,s.refCount===0&&Vz(Uz,function(){s.controller.abort()})}function _2(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 ad=null;function Hz(s){var o=s.transitionTypes;return s.transitionTypes=null,o}var id=null,db=0,Nl=0,Mc=null;function Fz(s,o){if(id===null){var l=id=[];db=0,Nl=T0(),Mc={status:"pending",value:void 0,then:function(d){l.push(d)}}}return db++,o.then(L2,L2),o}function L2(){if(--db===0&&(ad=null,id!==null)){Mc!==null&&(Mc.status="fulfilled");var s=id;id=null,Nl=0,Mc=null;for(var o=0;o<s.length;o++)(0,s[o])()}}function Gz(s,o){var l=[],d={status:"pending",value:null,reason:null,then:function(v){l.push(v)}};return s.then(function(){d.status="fulfilled",d.value=o;for(var v=0;v<l.length;v++)(0,l[v])(o)},function(v){for(d.status="rejected",d.reason=v,v=0;v<l.length;v++)(0,l[v])(void 0)}),d}var $2=ae.S;ae.S=function(s,o){if(ON=be(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&Fz(s,o),ad!==null)for(var l=Wc;l!==null;)_2(l,ad),l=l.next;if(l=s.types,l!==null){for(var d=Wc;d!==null;)_2(d,l),d=d.next;if(Nl!==0){d=ad,d===null&&(d=ad=[]);for(var v=0;v<l.length;v++){var j=l[v];d.indexOf(j)===-1&&d.push(j)}}}$2!==null&&$2(s,o)};var Cl=pe(null);function fb(){var s=Cl.current;return s!==null?s:An.pooledCache}function Rm(s,o){o===null?ye(Cl,Cl.current):ye(Cl,o.pool)}function B2(){var s=fb();return s===null?null:{parent:os._currentValue,pool:s}}var Dc=Error(a(460)),mb=Error(a(474)),Am=Error(a(542)),Om={then:function(){}};function V2(s){return s=s.status,s==="fulfilled"||s==="rejected"}function U2(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,F2(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 v=o;v.status="fulfilled",v.value=d}},function(d){if(o.status==="pending"){var v=o;v.status="rejected",v.reason=d}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw s=o.reason,F2(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 H2(){if(Tl===null)throw Error(a(459));var s=Tl;return Tl=null,s}function F2(s){if(s===Dc||s===Am)throw Error(a(483))}var zc=null,ld=0;function Mm(s){var o=ld;return ld+=1,zc===null&&(zc=[]),U2(zc,s,o)}function pi(s,o){o=o.props.ref,s.ref=o!==void 0?o:null}function Dm(s,o){throw o.$$typeof===M?Error(a(525)):(s=Object.prototype.toString.call(o),Error(a(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s)))}function G2(s){function o(Se,xe){if(s){var Ee=Se.deletions;Ee===null?(Se.deletions=[xe],Se.flags|=16):Ee.push(xe)}}function l(Se,xe){if(!s)return null;for(;xe!==null;)o(Se,xe),xe=xe.sibling;return null}function d(Se){for(var xe=new Map;Se!==null;)Se.key===null?xe.set(Se.index,Se):xe.set(Se.key,Se),Se=Se.sibling;return xe}function v(Se,xe){return Se=ka(Se,xe),Se.index=0,Se.sibling=null,Se}function j(Se,xe,Ee){return Se.index=Ee,s?(Ee=Se.alternate,Ee!==null?(Ee=Ee.index,Ee<xe?(Se.flags|=2,xe):Ee):(Se.flags|=134217730,xe)):(Se.flags|=1048576,xe)}function I(Se){return s&&Se.alternate===null&&(Se.flags|=134217730),Se}function J(Se,xe,Ee,Le){return xe===null||xe.tag!==6?(xe=sb(Ee,Se.mode,Le),xe.return=Se,xe):(xe=v(xe,Ee),xe.return=Se,xe)}function he(Se,xe,Ee,Le){var ut=Ee.type;return ut===H?(Se=ze(Se,xe,Ee.props.children,Le,Ee.key),pi(Se,Ee),Se):xe!==null&&(xe.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===z&&kl(ut)===xe.type)?(xe=v(xe,Ee.props),pi(xe,Ee),xe.return=Se,xe):(xe=jm(Ee.type,Ee.key,Ee.props,null,Se.mode,Le),pi(xe,Ee),xe.return=Se,xe)}function Ne(Se,xe,Ee,Le){return xe===null||xe.tag!==4||xe.stateNode.containerInfo!==Ee.containerInfo||xe.stateNode.implementation!==Ee.implementation?(xe=rb(Ee,Se.mode,Le),xe.return=Se,xe):(xe=v(xe,Ee.children||[]),xe.return=Se,xe)}function ze(Se,xe,Ee,Le,ut){return xe===null||xe.tag!==7?(xe=yl(Ee,Se.mode,Le,ut),xe.return=Se,xe):(xe=v(xe,Ee),xe.return=Se,xe)}function $e(Se,xe,Ee){if(typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint")return xe=sb(""+xe,Se.mode,Ee),xe.return=Se,xe;if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case D:return Ee=jm(xe.type,xe.key,xe.props,null,Se.mode,Ee),pi(Ee,xe),Ee.return=Se,Ee;case _:return xe=rb(xe,Se.mode,Ee),xe.return=Se,xe;case z:return xe=kl(xe),$e(Se,xe,Ee)}if(ve(xe)||K(xe))return xe=yl(xe,Se.mode,Ee,null),xe.return=Se,xe;if(typeof xe.then=="function")return $e(Se,Mm(xe),Ee);if(xe.$$typeof===V)return $e(Se,Em(Se,xe),Ee);Dm(Se,xe)}return null}function we(Se,xe,Ee,Le){var ut=xe!==null?xe.key:null;if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return ut!==null?null:J(Se,xe,""+Ee,Le);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case D:return Ee.key===ut?he(Se,xe,Ee,Le):null;case _:return Ee.key===ut?Ne(Se,xe,Ee,Le):null;case z:return Ee=kl(Ee),we(Se,xe,Ee,Le)}if(ve(Ee)||K(Ee))return ut!==null?null:ze(Se,xe,Ee,Le,null);if(typeof Ee.then=="function")return we(Se,xe,Mm(Ee),Le);if(Ee.$$typeof===V)return we(Se,xe,Em(Se,Ee),Le);Dm(Se,Ee)}return null}function Oe(Se,xe,Ee,Le,ut){if(typeof Le=="string"&&Le!==""||typeof Le=="number"||typeof Le=="bigint")return Se=Se.get(Ee)||null,J(xe,Se,""+Le,ut);if(typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case D:return Se=Se.get(Le.key===null?Ee:Le.key)||null,he(xe,Se,Le,ut);case _:return Se=Se.get(Le.key===null?Ee:Le.key)||null,Ne(xe,Se,Le,ut);case z:return Le=kl(Le),Oe(Se,xe,Ee,Le,ut)}if(ve(Le)||K(Le))return Se=Se.get(Ee)||null,ze(xe,Se,Le,ut,null);if(typeof Le.then=="function")return Oe(Se,xe,Ee,Mm(Le),ut);if(Le.$$typeof===V)return Oe(Se,xe,Ee,Em(xe,Le),ut);Dm(xe,Le)}return null}function ot(Se,xe,Ee,Le){for(var ut=null,Xt=null,yt=xe,Et=xe=0,ls=null;yt!==null&&Et<Ee.length;Et++){yt.index>Et?(ls=yt,yt=null):ls=yt.sibling;var Jt=we(Se,yt,Ee[Et],Le);if(Jt===null){yt===null&&(yt=ls);break}s&&yt&&Jt.alternate===null&&o(Se,yt),xe=j(Jt,xe,Et),Xt===null?ut=Jt:Xt.sibling=Jt,Xt=Jt,yt=ls}if(Et===Ee.length)return l(Se,yt),Vt&&Ta(Se,Et),ut;if(yt===null){for(;Et<Ee.length;Et++)yt=$e(Se,Ee[Et],Le),yt!==null&&(xe=j(yt,xe,Et),Xt===null?ut=yt:Xt.sibling=yt,Xt=yt);return Vt&&Ta(Se,Et),ut}for(yt=d(yt);Et<Ee.length;Et++)ls=Oe(yt,Se,Et,Ee[Et],Le),ls!==null&&(s&&(Jt=ls.alternate,Jt!==null&&yt.delete(Jt.key===null?Et:Jt.key)),xe=j(ls,xe,Et),Xt===null?ut=ls:Xt.sibling=ls,Xt=ls);return s&&yt.forEach(function(zi){return o(Se,zi)}),Vt&&Ta(Se,Et),ut}function ht(Se,xe,Ee,Le){if(Ee==null)throw Error(a(151));for(var ut=null,Xt=null,yt=xe,Et=xe=0,ls=null,Jt=Ee.next();yt!==null&&!Jt.done;Et++,Jt=Ee.next()){yt.index>Et?(ls=yt,yt=null):ls=yt.sibling;var zi=we(Se,yt,Jt.value,Le);if(zi===null){yt===null&&(yt=ls);break}s&&yt&&zi.alternate===null&&o(Se,yt),xe=j(zi,xe,Et),Xt===null?ut=zi:Xt.sibling=zi,Xt=zi,yt=ls}if(Jt.done)return l(Se,yt),Vt&&Ta(Se,Et),ut;if(yt===null){for(;!Jt.done;Et++,Jt=Ee.next())Jt=$e(Se,Jt.value,Le),Jt!==null&&(xe=j(Jt,xe,Et),Xt===null?ut=Jt:Xt.sibling=Jt,Xt=Jt);return Vt&&Ta(Se,Et),ut}for(yt=d(yt);!Jt.done;Et++,Jt=Ee.next())Jt=Oe(yt,Se,Et,Jt.value,Le),Jt!==null&&(s&&(ls=Jt.alternate,ls!==null&&yt.delete(ls.key===null?Et:ls.key)),xe=j(Jt,xe,Et),Xt===null?ut=Jt:Xt.sibling=Jt,Xt=Jt);return s&&yt.forEach(function(CP){return o(Se,CP)}),Vt&&Ta(Se,Et),ut}function Lt(Se,xe,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;xe!==null;){if(xe.key===ut){if(ut=Ee.type,ut===H){if(xe.tag===7){l(Se,xe.sibling),Le=v(xe,Ee.props.children),pi(Le,Ee),Le.return=Se,Se=Le;break e}}else if(xe.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===z&&kl(ut)===xe.type){l(Se,xe.sibling),Le=v(xe,Ee.props),pi(Le,Ee),Le.return=Se,Se=Le;break e}l(Se,xe);break}else o(Se,xe);xe=xe.sibling}Ee.type===H?(Le=yl(Ee.props.children,Se.mode,Le,Ee.key),pi(Le,Ee),Le.return=Se,Se=Le):(Le=jm(Ee.type,Ee.key,Ee.props,null,Se.mode,Le),pi(Le,Ee),Le.return=Se,Se=Le)}return I(Se);case _:e:{for(ut=Ee.key;xe!==null;){if(xe.key===ut)if(xe.tag===4&&xe.stateNode.containerInfo===Ee.containerInfo&&xe.stateNode.implementation===Ee.implementation){l(Se,xe.sibling),Le=v(xe,Ee.children||[]),Le.return=Se,Se=Le;break e}else{l(Se,xe);break}else o(Se,xe);xe=xe.sibling}Le=rb(Ee,Se.mode,Le),Le.return=Se,Se=Le}return I(Se);case z:return Ee=kl(Ee),Lt(Se,xe,Ee,Le)}if(ve(Ee))return ot(Se,xe,Ee,Le);if(K(Ee)){if(ut=K(Ee),typeof ut!="function")throw Error(a(150));return Ee=ut.call(Ee),ht(Se,xe,Ee,Le)}if(typeof Ee.then=="function")return Lt(Se,xe,Mm(Ee),Le);if(Ee.$$typeof===V)return Lt(Se,xe,Em(Se,Ee),Le);Dm(Se,Ee)}return typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint"?(Ee=""+Ee,xe!==null&&xe.tag===6?(l(Se,xe.sibling),Le=v(xe,Ee),Le.return=Se,Se=Le):(l(Se,xe),Le=sb(Ee,Se.mode,Le),Le.return=Se,Se=Le),I(Se)):l(Se,xe)}return function(Se,xe,Ee,Le){try{ld=0;var ut=Lt(Se,xe,Ee,Le);return zc=null,ut}catch(yt){if(yt===Dc||yt===Am)throw yt;var Xt=dr(29,yt,null,Se.mode);return Xt.lanes=Le,Xt.return=Se,Xt}finally{}}}var El=G2(!0),q2=G2(!1),gi=!1;function hb(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 v=d.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),d.pending=o,o=wm(s),R2(s,null,l),o}return vm(s,d,o,l),wm(s)}function cd(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 v=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?v=j=I:j=j.next=I,l=l.next}while(l!==null);j===null?v=j=o:j=j.next=o}else v=j=o;l={baseState:d.baseState,firstBaseUpdate:v,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 ud(){if(xb){var s=Mc;if(s!==null)throw s}}function dd(s,o,l,d){xb=!1;var v=s.updateQueue;gi=!1;var j=v.firstBaseUpdate,I=v.lastBaseUpdate,J=v.shared.pending;if(J!==null){v.shared.pending=null;var he=J,Ne=he.next;he.next=null,I===null?j=Ne:I.next=Ne,I=he;var ze=s.alternate;ze!==null&&(ze=ze.updateQueue,J=ze.lastBaseUpdate,J!==I&&(J===null?ze.firstBaseUpdate=Ne:J.next=Ne,ze.lastBaseUpdate=he))}if(j!==null){var $e=v.baseState;I=0,ze=Ne=he=null,J=j;do{var we=J.lane&-536870913,Oe=we!==J.lane;if(Oe?(Kt&we)===we:(d&we)===we){we!==0&&we===Nl&&(xb=!0),ze!==null&&(ze=ze.next={lane:0,tag:J.tag,payload:J.payload,callback:null,next:null});e:{var ot=s,ht=J;we=o;var Lt=l;switch(ht.tag){case 1:if(ot=ht.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=ht.payload,we=typeof ot=="function"?ot.call(Lt,$e,we):ot,we==null)break e;$e=T({},$e,we);break e;case 2:gi=!0}}we=J.callback,we!==null&&(s.flags|=64,Oe&&(s.flags|=8192),Oe=v.callbacks,Oe===null?v.callbacks=[we]:Oe.push(we))}else Oe={lane:we,tag:J.tag,payload:J.payload,callback:J.callback,next:null},ze===null?(Ne=ze=Oe,he=$e):ze=ze.next=Oe,I|=we;if(J=J.next,J===null){if(J=v.shared.pending,J===null)break;Oe=J,J=Oe.next,Oe.next=null,v.lastBaseUpdate=Oe,v.shared.pending=null}}while(!0);ze===null&&(he=$e),v.baseState=he,v.firstBaseUpdate=Ne,v.lastBaseUpdate=ze,j===null&&(v.shared.lanes=0),Ci|=I,s.lanes=I,s.memoizedState=$e}}function Y2(s,o){if(typeof s!="function")throw Error(a(191,s));s.call(o)}function K2(s,o){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)Y2(l[s],o)}var yi=pe(null),zm=pe(0);function X2(s,o){s=za,ye(zm,s),ye(yi,o),za=s|o.baseLanes}function bb(){ye(zm,za),ye(yi,yi.current)}function yb(){za=zm.current,ue(yi),ue(zm)}var Ps=pe(null),qs=null;function vi(s){var o=s.alternate;ye(_s,_s.current&1),ye(Ps,s),qs===null&&(o===null||yi.current!==null||o.memoizedState!==null)&&(qs=s)}function vb(s){ye(_s,_s.current),ye(Ps,s),qs===null&&(qs=s)}function W2(s){s.tag===22?(ye(_s,_s.current),ye(Ps,s),qs===null&&(qs=s)):wi()}function wi(){ye(_s,_s.current),ye(Ps,Ps.current)}function Ar(s){ue(Ps),qs===s&&(qs=null),ue(_s)}var _s=pe(0);function fd(s,o){ye(Ps,Ps.current),ye(_s,o)}function wb(s){ue(_s),ue(Ps),qs===s&&(qs=null)}function Im(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,Nn=null,as=null,Pm=!1,Ic=!1,Rl=!1,_m=0,md=0,Pc=null,qz=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,v,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,v),Rl=!1,Ic&&(j=Z2(o,l,d,v)),Q2(s),j}function Q2(s){ae.H=Fm;var o=Nn!==null&&Nn.next!==null;if(Aa=0,as=Nn=_t=null,Pm=!1,md=0,Pc=null,o)throw Error(a(300));s===null||is||(s=s.dependencies,s!==null&&Tm(s)&&(is=!0))}function Z2(s,o,l,d){_t=s;var v=0;do{if(Ic&&(Pc=null),md=0,Ic=!1,25<=v)throw Error(a(301));if(v+=1,as=Nn=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=eI,j=o(l,d)}while(Ic);return j}function Yz(){var s=ae.H,o=s.useState()[0];return o=typeof o.then=="function"?hd(o):o,s=s.useState()[0],(Nn!==null?Nn.memoizedState:null)!==s&&(_t.flags|=1024),o}function Nb(){var s=_m!==0;return _m=0,s}function Cb(s,o,l){o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~l}function kb(s){if(Pm){for(s=s.memoizedState;s!==null;){var o=s.queue;o!==null&&(o.pending=null),s=s.next}Pm=!1}Aa=0,as=Nn=_t=null,Ic=!1,md=_m=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(Nn===null){var s=_t.alternate;s=s!==null?s.memoizedState:null}else s=Nn.next;var o=as===null?_t.memoizedState:as.next;if(o!==null)as=o,Nn=s;else{if(s===null)throw _t.alternate===null?Error(a(467)):Error(a(310));Nn=s,s={memoizedState:Nn.memoizedState,baseState:Nn.baseState,baseQueue:Nn.baseQueue,queue:Nn.queue,next:null},as===null?_t.memoizedState=as=s:as=as.next=s}return as}function Lm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hd(s){var o=md;return md+=1,Pc===null&&(Pc=[]),s=U2(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 $m(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return hd(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(v){return v.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),l===null&&(l=Lm(),_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]=te;return o.index++,l}function Oa(s,o){return typeof o=="function"?o(s):o}function Bm(s){var o=es();return Eb(o,Nn,s)}function Eb(s,o,l){var d=s.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=l;var v=s.baseQueue,j=d.pending;if(j!==null){if(v!==null){var I=v.next;v.next=j.next,j.next=I}o.baseQueue=v=j,d.pending=null}if(j=s.baseState,v===null)s.memoizedState=j;else{o=v.next;var J=I=null,he=null,Ne=o,ze=!1;do{var $e=Ne.lane&-536870913;if($e!==Ne.lane?(Kt&$e)===$e:(Aa&$e)===$e){var we=Ne.revertLane;if(we===0)he!==null&&(he=he.next={lane:0,revertLane:0,gesture:null,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null}),$e===Nl&&(ze=!0);else if((Aa&we)===we){Ne=Ne.next,we===Nl&&(ze=!0);continue}else $e={lane:0,revertLane:Ne.revertLane,gesture:null,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null},he===null?(J=he=$e,I=j):he=he.next=$e,_t.lanes|=we,Ci|=we;$e=Ne.action,Rl&&l(j,$e),j=Ne.hasEagerState?Ne.eagerState:l(j,$e)}else we={lane:$e,revertLane:Ne.revertLane,gesture:Ne.gesture,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null},he===null?(J=he=we,I=j):he=he.next=we,_t.lanes|=$e,Ci|=$e;Ne=Ne.next}while(Ne!==null&&Ne!==o);if(he===null?I=j:he.next=J,!Rr(j,s.memoizedState)&&(is=!0,ze&&(l=Mc,l!==null)))throw l;s.memoizedState=j,s.baseState=I,s.baseQueue=he,d.lastRenderedState=j}return v===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,v=l.pending,j=o.memoizedState;if(v!==null){l.pending=null;var I=v=v.next;do j=s(j,I.action),I=I.next;while(I!==v);Rr(j,o.memoizedState)||(is=!0),o.memoizedState=j,o.baseQueue===null&&(o.baseState=j),l.lastRenderedState=j}return[j,d]}function J2(s,o,l){var d=_t,v=es(),j=Vt;if(j){if(l===void 0)throw Error(a(407));l=l()}else l=o();var I=!Rr((Nn||v).memoizedState,l);if(I&&(v.memoizedState=l,is=!0),v=v.queue,Mb(nS.bind(null,d,v,s),[s]),s=v.getSnapshot!==o||I||as!==null&&(as.memoizedState.tag&1)!==0,_c(s?9:8,{destroy:void 0},tS.bind(null,d,v,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=Lm(),_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:Oa,lastRenderedState:s},o}function oS(s,o,l,d){return s.baseState=l,Eb(s,Nn,typeof d=="function"?d:Oa)}function Kz(s,o,l,d,v){if(Hm(s))throw Error(a(485));if(s=o.action,s!==null){var j={payload:v,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,v=s.state;if(o.isTransition){var j=ae.T,I={};I.types=j!==null?j.types:null,ae.T=I;try{var J=l(v,d),he=ae.S;he!==null&&he(I,J),iS(s,o,J)}catch(Ne){Ob(s,o,Ne)}finally{j!==null&&I.types!==null&&(j.types=I.types),ae.T=j}}else try{j=l(v,d),iS(s,o,j)}catch(Ne){Ob(s,o,Ne)}}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 Ob(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 Ob(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(On){t:{for(var v=On,j=so;v.nodeType!==8;){if(!j){v=null;break t}if(v=oo(v.nextSibling),v===null){v=null;break t}}j=v.data,v=j==="F!"||j==="F"?v:null}if(v){On=oo(v.nextSibling),d=v.data==="F!";break e}}mi(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(),v={state:o,dispatch:null,action:s,pending:null},d.queue=v,l=Kz.bind(null,_t,v,j,l),v.dispatch=l,d.memoizedState=s,[o,l,!1]}function fS(s){var o=es();return mS(o,Nn,s)}function mS(s,o,l){if(o=Eb(s,o,uS)[0],s=Bm(Oa)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var d=hd(o)}catch(I){throw I===Dc?Am:I}else d=o;o=es();var v=o.queue,j=v.dispatch;return l!==o.memoizedState&&(_t.flags|=2048,_c(9,{destroy:void 0},Xz.bind(null,v,l),null)),[d,j,s]}function Xz(s,o){s.action=o}function hS(s){var o=es(),l=Nn;if(l!==null)return mS(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=Lm(),_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 Vm(s,o,l,d){var v=nr();_t.flags|=s,v.memoizedState=_c(1|o,{destroy:void 0},l,d===void 0?null:d)}function Um(s,o,l,d){var v=es();d=d===void 0?null:d;var j=v.memoizedState.inst;Nn!==null&&d!==null&&jb(d,Nn.memoizedState.deps)?v.memoizedState=_c(o,j,l,d):(_t.flags|=s,v.memoizedState=_c(1|o,j,l,d))}function gS(s,o){Vm(8390656,8,s,o)}function Mb(s,o){Um(2048,8,s,o)}function Wz(s){_t.flags|=4;var o=_t.updateQueue;if(o===null)o=Lm(),_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 Wz({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 Um(4,2,s,o)}function yS(s,o){return Um(4,4,s,o)}function vS(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,Um(4,4,vS.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:yi.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,v){var j=le.p;le.p=j!==0&&8>j?j:8;var I=ae.T,J={};J.types=I!==null?I.types:null,ae.T=J,_b(s,!1,o,l);try{var he=v(),Ne=ae.S;if(Ne!==null&&Ne(J,he),he!==null&&typeof he=="object"&&typeof he.then=="function"){var ze=Gz(he,d);pd(s,o,ze,zr(s))}else pd(s,o,d,zr(s))}catch($e){pd(s,o,{then:function(){},status:"rejected",reason:$e},zr())}finally{le.p=j,I!==null&&J.types!==null&&(I.types=J.types),ae.T=I}}function Qz(){}function Ib(s,o,l,d){if(s.tag!==5)throw Error(a(476));var v=kS(s).queue;CS(s,v,o,re,l===null?Qz:function(){return TS(s),l(d)})}function kS(s){var o=s.memoizedState;if(o!==null)return o;o={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oa,lastRenderedState:re},next:null};var l={};return o.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oa,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),pd(s,o.next.queue,{},zr())}function Pb(){return Is(nu)}function ES(){return es().memoizedState}function RS(){return es().memoizedState}function Zz(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),cd(d,o,l)),o={cache:ub()},s.payload=o;return}o=o.return}}function Jz(s,o,l){var d=zr();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Hm(s)?OS(o,l):(l=tb(s,o,l,d),l!==null&&(pr(l,s,d),MS(l,o,d)))}function AS(s,o,l){var d=zr();pd(s,o,l,d)}function pd(s,o,l,d){var v={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Hm(s))OS(o,v);else{var j=s.alternate;if(s.lanes===0&&(j===null||j.lanes===0)&&(j=o.lastRenderedReducer,j!==null))try{var I=o.lastRenderedState,J=j(I,l);if(v.hasEagerState=!0,v.eagerState=J,Rr(J,I))return vm(s,o,v,0),An===null&&ym(),!1}catch{}finally{}if(l=tb(s,o,v,d),l!==null)return pr(l,s,d),MS(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},Hm(s)){if(o)throw Error(a(479))}else o=tb(s,l,d,2),o!==null&&pr(o,s,2)}function Hm(s){var o=s.alternate;return s===_t||o!==null&&o===_t}function OS(s,o){Ic=Pm=!0;var l=s.pending;l===null?o.next=o:(o.next=l.next,l.next=o),s.pending=o}function MS(s,o,l){if((l&4194048)!==0){var d=o.lanes;d&=s.pendingLanes,l|=d,o.lanes=l,wo(s,l)}}var Fm={readContext:Is,use:$m,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:$m,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,Vm(4194308,4,vS.bind(null,o,s),l)},useLayoutEffect:function(s,o){return Vm(4194308,4,s,o)},useInsertionEffect:function(s,o){Vm(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 v=l(o);if(Rl){et(!0);try{l(o)}finally{et(!1)}}}else v=o;return d.memoizedState=d.baseState=v,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:v},d.queue=s,s=s.dispatch=Jz.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,v=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)}v.memoizedState=l;var j={value:l,getSnapshot:o};return v.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=_m++,0<l&&(o+="H"+l.toString(32)),o+="_"}else l=qz++,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=Zz.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:$m,useCallback:jS,useContext:Is,useEffect:Mb,useImperativeHandle:wS,useInsertionEffect:bS,useLayoutEffect:yS,useMemo:SS,useReducer:Bm,useRef:pS,useState:function(){return Bm(Oa)},useDebugValue:Db,useDeferredValue:function(s,o){var l=es();return NS(l,Nn.memoizedState,s,o)},useTransition:function(){var s=Bm(Oa)[0],o=es().memoizedState;return[typeof s=="boolean"?s:hd(s),o]},useSyncExternalStore:J2,useId:ES,useHostTransitionStatus:Pb,useFormState:fS,useActionState:fS,useOptimistic:function(s,o){var l=es();return oS(l,Nn,s,o)},useMemoCache:Tb,useCacheRefresh:RS,useEffectEvent:xS},eI={readContext:Is,use:$m,useCallback:jS,useContext:Is,useEffect:Mb,useImperativeHandle:wS,useInsertionEffect:bS,useLayoutEffect:yS,useMemo:SS,useReducer:Rb,useRef:pS,useState:function(){return Rb(Oa)},useDebugValue:Db,useDeferredValue:function(s,o){var l=es();return Nn===null?zb(l,s,o):NS(l,Nn.memoizedState,s,o)},useTransition:function(){var s=Rb(Oa)[0],o=es().memoizedState;return[typeof s=="boolean"?s:hd(s),o]},useSyncExternalStore:J2,useId:ES,useHostTransitionStatus:Pb,useFormState:hS,useActionState:hS,useOptimistic:function(s,o){var l=es();return Nn!==null?oS(l,Nn,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:T({},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(),v=xi(d);v.payload=o,l!=null&&(v.callback=l),o=bi(s,v,d),o!==null&&(pr(o,s,d),cd(o,s,d))},enqueueReplaceState:function(s,o,l){s=s._reactInternals;var d=zr(),v=xi(d);v.tag=1,v.payload=o,l!=null&&(v.callback=l),o=bi(s,v,d),o!==null&&(pr(o,s,d),cd(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),cd(o,s,l))}};function IS(s,o,l,d,v,j,I){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,j,I):o.prototype&&o.prototype.isPureReactComponent?!td(l,d)||!td(v,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=T({},l));for(var v in s)l[v]===void 0&&(l[v]=s[v])}return l}function _S(s){bm(s)}function LS(s){console.error(s)}function $S(s){bm(s)}function Gm(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(v){setTimeout(function(){throw v})}}function Bb(s,o,l){return l=xi(l),l.tag=3,l.payload={element:null},l.callback=function(){Gm(s,o)},l}function VS(s){return s=xi(s),s.tag=3,s}function US(s,o,l,d){var v=l.type.getDerivedStateFromError;if(typeof v=="function"){var j=d.value;s.payload=function(){return v(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 v!="function"&&(ki===null?ki=new Set([this]):ki.add(this));var J=d.stack;this.componentDidCatch(d.value,{componentStack:J!==null?J:""})})}function tI(s,o,l,d,v){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=l.alternate,o!==null&&jl(o,l,v,!0),l=Ps.current,l!==null){switch(l.tag){case 31:case 13:case 19:return qs===null?fh():l.alternate===null&&Wn===0&&(Wn=3),l.flags&=-257,l.flags|=65536,l.lanes=v,d===Om?l.flags|=16384:(o=l.updateQueue,o===null?l.updateQueue=new Set([d]):o.add(d),N0(s,d,v)),!1;case 22:return l.flags|=65536,d===Om?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,v)),!1}throw Error(a(435,l.tag))}return N0(s,d,v),fh(),!1}if(Vt)return o=Ps.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=v,d!==ab&&(s=Error(a(422),{cause:d}),rd(eo(s,l)))):(d!==ab&&(o=Error(a(423),{cause:d}),rd(eo(o,l))),s=s.current.alternate,s.flags|=65536,v&=-v,s.lanes|=v,d=eo(d,l),v=Bb(s.stateNode,d,v),gb(s,v),Wn!==4&&(Wn=2)),!1;var j=Error(a(520),{cause:d});if(j=eo(j,l),Sd===null?Sd=[j]:Sd.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=v&-v,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,v&=-v,l.lanes|=v,v=VS(v),US(v,s,l,d),gb(l,v),!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 ms(s,o,l,d){o.child=s===null?q2(o,null,l,d):El(o,s.child,l,d)}function HS(s,o,l,d,v){l=l.render;var j=o.ref;if("ref"in d){var I={};for(var J in d)J!=="ref"&&(I[J]=d[J])}else I=d;return Sl(o),d=Sb(s,o,l,I,j,v),J=Nb(),s!==null&&!is?(Cb(s,o,v),Ma(s,o,v)):(Vt&&J&&Nm(o),o.flags|=1,ms(s,o,d,v),o.child)}function FS(s,o,l,d,v){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,v)):(s=jm(l.type,null,d,o,o.mode,v),s.ref=o.ref,s.return=o,o.child=s)}if(j=s.child,!Xb(s,v)){var I=j.memoizedProps;if(l=l.compare,l=l!==null?l:td,l(I,d)&&s.ref===o.ref)return Ma(s,o,v)}return o.flags|=1,s=ka(j,d),s.ref=o.ref,s.return=o,o.child=s}function GS(s,o,l,d,v){if(s!==null){var j=s.memoizedProps;if(td(j,d)&&s.ref===o.ref)if(is=!1,o.pendingProps=d=j,Xb(s,v))(s.flags&131072)!==0&&(is=!0);else return o.lanes=s.lanes,Ma(s,o,v)}return Ub(s,o,l,d,v)}function qS(s,o,l,d){var v=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,v=0;d!==null;)v=v|d.lanes|d.childLanes,d=d.sibling;d=v&~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&&Rm(o,j!==null?j.cachePool:null),j!==null?X2(o,j):bb(),W2(o);else return d=o.lanes=536870912,YS(s,o,j!==null?j.baseLanes|l:l,l,d)}else j!==null?(Rm(o,j.cachePool),X2(o,j),wi(),o.memoizedState=null):(s!==null&&Rm(o,null),bb(),wi());return ms(s,o,v,l),o.child}function gd(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,v){var j=fb();return j=j===null?null:{parent:os._currentValue,pool:j},o.memoizedState={baseLanes:l,cachePool:j},s!==null&&Rm(o,null),bb(),W2(o),s!==null&&jl(s,o,d,!0),o.childLanes=v,null}function qm(s,o){return o=Ym({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=qm(o,o.pendingProps),s.flags|=2,Ar(o),o.memoizedState=null,s}function nI(s,o,l){var d=o.pendingProps,v=(o.flags&128)!==0;if(o.flags&=-129,s===null){if(Vt){if(d.mode==="hidden")return s=qm(o,d),o.lanes=536870912,s.memoizedState={baseLanes:0,cachePool:null},gd(null,s);if(vb(o),(s=On)?(s=vC(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=O2(s),l.return=o,o.child=l,Ns=o,On=null)):s=null,s===null)throw mi(o);return o.lanes=536870912,null}return qm(o,d)}var j=s.memoizedState;if(j!==null){var I=j.dehydrated;if(vb(o),v)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),v=(l&s.childLanes)!==0,is||v){if(yi.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;fh()}o=KS(s,o,l)}else s=j.treeContext,On=oo(I.nextSibling),Ns=o,Vt=!0,fi=null,so=!1,s!==null&&z2(o,s),o=qm(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,v){return Sl(o),l=Sb(s,o,l,d,void 0,v),d=Nb(),s!==null&&!is?(Cb(s,o,v),Ma(s,o,v)):(Vt&&d&&Nm(o),o.flags|=1,ms(s,o,l,v),o.child)}function XS(s,o,l,d,v,j){return Sl(o),o.updateQueue=null,l=Z2(o,d,l,v),Q2(s),d=Nb(),s!==null&&!is?(Cb(s,o,j),Ma(s,o,j)):(Vt&&d&&Nm(o),o.flags|=1,ms(s,o,l,j),o.child)}function WS(s,o,l,d,v){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={},hb(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),dd(o,d,j,v),ud(),j.state=o.memoizedState),typeof j.componentDidMount=="function"&&(o.flags|=4194308),d=!0}else if(s===null){j=o.stateNode;var J=o.memoizedProps,he=Al(l,J);j.props=he;var Ne=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",J=o.pendingProps!==J,ze||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(J||Ne!==I)&&PS(o,j,d,I),gi=!1;var we=o.memoizedState;j.state=we,dd(o,d,j,v),ud(),Ne=o.memoizedState,J||we!==Ne||gi?(typeof $e=="function"&&(Lb(o,l,$e,d),Ne=o.memoizedState),(he=gi||IS(o,l,he,d,we,Ne,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=Ne),j.props=d,j.state=Ne,j.context=I,d=he):(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,Ne=l.contextType,he=Ec,typeof Ne=="object"&&Ne!==null&&(he=Is(Ne)),J=l.getDerivedStateFromProps,(Ne=typeof J=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(I!==$e||we!==he)&&PS(o,j,d,he),gi=!1,we=o.memoizedState,j.state=we,dd(o,d,j,v),ud();var Oe=o.memoizedState;I!==$e||we!==Oe||gi||s!==null&&s.dependencies!==null&&Tm(s.dependencies)?(typeof J=="function"&&(Lb(o,l,J,d),Oe=o.memoizedState),(ze=gi||IS(o,l,ze,d,we,Oe,he)||s!==null&&s.dependencies!==null&&Tm(s.dependencies))?(Ne||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(d,Oe,he),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(d,Oe,he)),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=Oe),j.props=d,j.state=Oe,j.context=he,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,v),o.child=El(o,null,l,v)):ms(s,o,l,v),o.memoizedState=j.state,s=o.child):s=Ma(s,o,v),s}function QS(s,o,l,d){return vl(),o.flags|=256,ms(s,o,l,d),o.child}var Hb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fb(s){return{baseLanes:s,cachePool:B2()}}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,v=!1,j=(o.flags&128)!==0,I;if((I=j)||(I=s!==null&&s.memoizedState===null?!1:(_s.current&2)!==0),I&&(v=!0,o.flags&=-129),I=(o.flags&32)!==0,o.flags&=-33,s===null){if(Vt){if(v?vi(o):wi(),(s=On)?(s=vC(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=O2(s),l.return=o,o.child=l,Ns=o,On=null)):s=null,s===null)throw mi(o);return F0(s)?o.lanes=32:o.lanes=536870912,null}return j=d.children,d=d.fallback,v?(wi(),v=o.mode,j=Ym({mode:"hidden",children:j},v),d=yl(d,v,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,gd(null,d)):(vi(o),qb(o,j))}var J=s.memoizedState;if(J!==null){var he=J.dehydrated;if(he!==null)return sI(s,o,j,I,d,he,J,l)}return v?(wi(),v=d.fallback,j=o.mode,J=s.child,he=J.sibling,d=ka(J,{mode:"hidden",children:d.children}),d.subtreeFlags=J.subtreeFlags&1206910976,he!==null?v=ka(he,v):(v=yl(v,j,l,null),v.flags|=2),v.return=o,d.return=o,d.sibling=v,o.child=d,gd(null,d),d=o.child,v=s.child.memoizedState,v===null?v=Fb(l):(j=v.cachePool,j!==null?(J=os._currentValue,j=j.parent!==J?{parent:J,pool:J}:j):j=B2(),v={baseLanes:v.baseLanes|l,cachePool:j}),d.memoizedState=v,d.childLanes=Gb(s,I,l),o.memoizedState=Hb,gd(s.child,d)):(vi(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=Ym({mode:"visible",children:o},s.mode),o.return=s,s.child=o}function Ym(s,o){return s=dr(22,s,null,o),s.lanes=0,s}function Km(s,o,l){return El(o,s.child,null,l),s=qb(o,o.pendingProps.children),s.flags|=2,o.memoizedState=null,s}function sI(s,o,l,d,v,j,I,J){if(l)return o.flags&256?(vi(o),o.flags&=-257,Km(s,o,J)):o.memoizedState!==null?(wi(),o.child=s.child,o.flags|=128,null):(wi(),j=v.fallback,I=o.mode,v=Ym({mode:"visible",children:v.children},I),j=yl(j,I,J,null),j.flags|=2,v.return=o,j.return=o,v.sibling=j,o.child=v,El(o,s.child,null,J),v=o.child,v.memoizedState=Fb(J),v.childLanes=Gb(s,d,J),o.memoizedState=Hb,gd(null,v));if(vi(o),F0(j)){if(d=j.nextSibling&&j.nextSibling.dataset,d)var he=d.dgst;return d=he,d!==""&&(v=Error(a(419)),v.stack="",v.digest=d,rd({value:v,source:null,stack:null})),Km(s,o,J)}if(is||jl(s,o,J,!1),d=(J&s.childLanes)!==0,is||d){if(yi.current!==null)return Km(s,o,J);if(d=An,d!==null&&(v=jo(d,J),v!==0&&v!==I.retryLane))throw I.retryLane=v,bl(s,v),pr(d,s,v),Vb;return H0(j)||fh(),Km(s,o,J)}return H0(j)?(o.flags|=192,o.child=s.child,null):(s=I.treeContext,On=oo(j.nextSibling),Ns=o,Vt=!0,fi=null,so=!1,s!==null&&z2(o,s),o=qb(o,v.children),o.flags|=134221824,o)}function JS(s,o,l){s.lanes|=o;var d=s.alternate;d!==null&&(d.lanes|=o),km(s.return,o,l)}function eN(s){for(var o=null;s!==null;){var l=s.alternate;l!==null&&Im(l)===null&&(o=s),s=s.sibling}return o}function Xm(s,o,l,d,v,j){var I=s.memoizedState;I===null?s.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:v,treeForkCount:j}:(I.isBackwards=o,I.rendering=null,I.renderingStartTime=0,I.last=d,I.tail=l,I.tailMode=v,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,v=d.revealOrder,j=d.tail;d=d.children;var I=_s.current;if(o.flags&128)return fd(o,I),null;var J=(I&2)!==0;if(J?(I=I&1|2,o.flags|=128):I&=1,fd(o,I),v==="backwards"&&s!==null?(Yb(s),ms(s,o,d,l),Yb(s)):ms(s,o,d,l),d=Vt?sd:0,!J&&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(v){case"backwards":l=eN(o.child),l===null?(v=o.child,o.child=null):(v=l.sibling,l.sibling=null,Yb(o)),Xm(o,!0,v,null,j,d);break;case"unstable_legacy-backwards":for(l=null,v=o.child,o.child=null;v!==null;){if(s=v.alternate,s!==null&&Im(s)===null){o.child=v;break}s=v.sibling,v.sibling=l,l=v,v=s}Xm(o,!0,l,null,j,d);break;case"together":Xm(o,!1,null,null,void 0,d);break;case"independent":o.memoizedState=null;break;default:l=eN(o.child),l===null?(v=o.child,o.child=null):(v=l.sibling,l.sibling=null),Xm(o,!1,v,l,j,d)}return o.child}function tN(s,o,l){var d=o.pendingProps;return hi(o,o.type,d.value),ms(s,o,d.children,l),o.child}function Ma(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&&Tm(s)))}function rI(s,o,l){switch(o.tag){case 3:oe(o,o.stateNode.containerInfo),hi(o,os,s.memoizedState.cache),vl();break;case 27:case 5:Re(o);break;case 4:oe(o,o.stateNode.containerInfo);break;case 10:hi(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,vb(o),null;break;case 13:var d=o.memoizedState;if(d!==null){if(d.dehydrated!==null)return vi(o),o.flags|=128,null;d=jl(s,o,l,!1);var v=o.child.childLanes;return d||(l&v)!==0?ZS(s,o,l):(vi(o),s=Ma(s,o,l),s!==null?s.sibling:null)}vi(o);break;case 19:if(o.flags&128)return Kb(s,o,l);if(v=(s.flags&128)!==0,d=(l&o.childLanes)!==0,d||(jl(s,o,l,!1),d=(l&o.childLanes)!==0),v){if(d)return Kb(s,o,l);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),fd(o,_s.current),d)break;return null;case 22:return o.lanes=0,qS(s,o,l,o.pendingProps);case 24:hi(o,os,s.memoizedState.cache)}return Ma(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,rI(s,o,l);is=(s.flags&131072)!==0}else is=!1,Vt&&(o.flags&1048576)!==0&&D2(o,sd,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 v=s.$$typeof;if(v===Y){o.tag=11,o=HS(null,o,s,d,l);break e}else if(v===ee){o.tag=14,o=FS(null,o,s,d,l);break e}else if(v===V){o.tag=10,o.type=s,o=tN(null,o,l);break e}}throw o=ne(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,v=Al(d,o.pendingProps),WS(s,o,d,v,l);case 3:e:{if(oe(o,o.stateNode.containerInfo),s===null)throw Error(a(387));d=o.pendingProps;var j=o.memoizedState;v=j.element,pb(s,o),dd(o,d,null,l);var I=o.memoizedState;if(d=I.cache,hi(o,os,d),d!==j.cache&&cb(o,[os],l,!0),ud(),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!==v){v=eo(Error(a(424)),o),rd(v),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(On=oo(s.firstChild),Ns=o,Vt=!0,fi=null,so=!0,l=q2(o,null,d,l),o.child=l;l;)l.flags=l.flags&-3|134221824,l=l.sibling}else{if(vl(),d===v){o=Ma(s,o,l);break e}ms(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,de.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,de.current),Ns=o,so=!0,v=On,Ri(o.type)?(G0=v,On=oo(d.firstChild)):On=v),ms(s,o,o.pendingProps.children,l),Lc(s,o),s===null&&(o.flags|=4194304),o.child;case 5:return s===null&&Vt&&((v=d=On)&&(d=ZI(d,o.type,o.pendingProps,so),d!==null?(o.stateNode=d,Ns=o,On=oo(d.firstChild),so=!1,v=!0):v=!1),v||mi(o)),Re(o),v=o.type,j=o.pendingProps,I=s!==null?s.memoizedProps:null,d=j.children,P0(v,j)?d=null:I!==null&&P0(v,I)&&(o.flags|=32),o.memoizedState!==null&&(v=Sb(s,o,Yz,null,null,l),nu._currentValue=v),Lc(s,o),ms(s,o,d,l),o.child;case 6:return s===null&&Vt&&((s=l=On)&&(l=JI(l,o.pendingProps,so),l!==null?(o.stateNode=l,Ns=o,On=null,s=!0):s=!1),s||mi(o)),null;case 13:return ZS(s,o,l);case 4:return oe(o,o.stateNode.containerInfo),d=o.pendingProps,s===null?o.child=El(o,null,d,l):ms(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),ms(s,o,d,l),o.child;case 8:return ms(s,o,o.pendingProps.children,l),o.child;case 12:return ms(s,o,o.pendingProps.children,l),o.child;case 10:return tN(s,o,l);case 9:return v=o.type._context,d=o.pendingProps.children,Sl(o),v=Is(v),d=d(v),o.flags|=1,ms(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 nI(s,o,l);case 22:return qS(s,o,l,o.pendingProps);case 24:return Sl(o),d=Is(os),s===null?(v=fb(),v===null&&(v=An,j=ub(),v.pooledCache=j,j.refCount++,j!==null&&(v.pooledCacheLanes|=l),v=j),o.memoizedState={parent:d,cache:v},hb(o),hi(o,os,v)):((s.lanes&l)!==0&&(pb(s,o),dd(o,null,null,l),ud()),v=s.memoizedState,j=o.memoizedState,v.parent!==d?(v={parent:d,cache:d},o.memoizedState=v,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=v),hi(o,os,d)):(d=j.cache,hi(o,os,d),d!==v.cache&&cb(o,[os],l,!0))),ms(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&&Nm(o),s!==null&&s.memoizedProps.name!==d.name?o.flags|=4194816:Lc(s,o),ms(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,v){var j;if((j=(s.mode&32)!==0)&&(j=l===null?OC(o,d):OC(o,d)&&(d.src!==l.src||d.srcSet!==l.srcSet)),j){if(s.flags|=16777216,(v&335544128)===v)if(s.stateNode.complete)s.flags|=8192;else if(_N())s.flags|=8192;else throw Tl=Om,mb}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,!MC(o))if(_N())s.flags|=8192;else throw Tl=Om,mb}function Wm(s,o){o!==null&&(s.flags|=4),s.flags&16384&&(o=s.tag!==22?xn():536870912,s.lanes|=o,Hc|=o)}function xd(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 Mn(s){var o=s.alternate!==null&&s.alternate.child===s.child,l=0,d=0;if(o)for(var v=s.child;v!==null;)l|=v.lanes|v.childLanes,d|=v.subtreeFlags&1206910976,d|=v.flags&1206910976,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)l|=v.lanes|v.childLanes,d|=v.subtreeFlags,d|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=d,s.childLanes=l,o}function oI(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 Mn(o),null;case 1:return Mn(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)&&(Oc(o)?Da(o):s===null||s.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,ib())),Mn(o),null;case 26:var v=o.type,j=o.memoizedState;return s===null?(Da(o),j!==null?(Mn(o),sN(o,j)):(Mn(o),Wb(o,v,null,d,l))):j?j!==s.memoizedState?(Da(o),Mn(o),sN(o,j)):(Mn(o),o.flags&=-16777217):(s=s.memoizedProps,s!==d&&Da(o),Mn(o),Wb(o,v,s,d,l)),null;case 27:if(Me(o),l=de.current,v=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==d&&Da(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return Mn(o),o.subtreeFlags&=-33554433,null}s=Ce.current,Oc(o)?I2(o):(s=SC(v,d,l),o.stateNode=s,Da(o))}return Mn(o),o.subtreeFlags&=-33554433,null;case 5:if(Me(o),v=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==d&&Da(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return Mn(o),o.subtreeFlags&=-33554433,null}if(j=Ce.current,Oc(o))I2(o);else{var I=Ed(de.current);switch(j){case 1:j=I.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:j=I.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":j=I.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":j=I.createElementNS("http://www.w3.org/1998/Math/MathML",v);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(v,{is:d.is}):I.createElement(v)}}j[Un]=o,j[Ms]=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,v,d),v){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 Mn(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=de.current,Oc(o)){if(s=o.stateNode,l=o.memoizedProps,d=null,v=Ns,v!==null)switch(v.tag){case 27:case 5:d=v.memoizedProps}s[Un]=o,s=!!(s.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||nC(s.nodeValue,l)),s||mi(o,!0)}else s=Ed(s).createTextNode(d),s[Un]=o,o.stateNode=s}return Mn(o),null;case 31:if(l=o.memoizedState,s===null||s.memoizedState!==null){if(d=Oc(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 vl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Mn(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 Mn(o),null;case 13:if(d=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(v=Oc(o),d!==null&&d.dehydrated!==null){if(s===null){if(!v)throw Error(a(318));if(v=o.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(a(317));v[Un]=o}else vl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Mn(o),v=!1}else v=ib(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=v),v=!0;if(!v)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,v=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(v=d.alternate.memoizedState.cachePool.pool),j=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(j=d.memoizedState.cachePool.pool),j!==v&&(d.flags|=2048)),l!==s&&l&&(o.child.flags|=8192),Wm(o,o.updateQueue),Mn(o),null);case 4:return fe(),s===null&&O0(o.stateNode.containerInfo),o.flags|=67108864,Mn(o),null;case 10:return Ra(o.type),Mn(o),null;case 19:if(wb(o),d=o.memoizedState,d===null)return Mn(o),null;if(v=(o.flags&128)!==0,j=d.rendering,j===null)if(v)xd(d,!1);else{if(Wn!==0||s!==null&&(s.flags&128)!==0)for(s=o.child;s!==null;){if(j=Im(s),j!==null){for(o.flags|=128,xd(d,!1),s=j.updateQueue,o.updateQueue=s,Wm(o,s),o.subtreeFlags=0,s=l,l=o.child;l!==null;)A2(l,s),l=l.sibling;return fd(o,_s.current&1|2),Vt&&Ta(o,d.treeForkCount),o.child}s=s.sibling}d.tail!==null&&be()>lh&&(o.flags|=128,v=!0,xd(d,!1),o.lanes=4194304)}else{if(!v)if(s=Im(j),s!==null){if(o.flags|=128,v=!0,s=s.updateQueue,o.updateQueue=s,Wm(o,s),xd(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!j.alternate&&!Vt)return Mn(o),null}else 2*be()-d.renderingStartTime>lh&&l!==536870912&&(o.flags|=128,v=!0,xd(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=be(),s.sibling=null,j=_s.current,j=v?j&1|2:j&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!l||Vt?fd(o,j):(l=j,ye(Ps,o),ye(_s,l),qs===null&&(qs=o)),Vt&&Ta(o,d.treeForkCount),s}return Mn(o),null;case 22:case 23:return Ar(o),yb(),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&&(Mn(o),o.subtreeFlags&6&&(o.flags|=8192)):Mn(o),l=o.updateQueue,l!==null&&Wm(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&&ue(Cl),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),o.memoizedState.cache!==l&&(o.flags|=2048),Ra(os),Mn(o),null;case 25:return null;case 30:return o.flags|=33554432,Mn(o),null}throw Error(a(156,o.tag))}function aI(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 Me(o),null;case 31:if(o.memoizedState!==null){if(Ar(o),o.alternate===null)throw Error(a(340));vl()}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));vl()}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),yb(),s!==null&&ue(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:Me(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),yb(),s!==null&&ue(Cl);break;case 24:Ra(os)}}function bd(s,o){try{var l=o.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var v=d.next;l=v;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!==v)}}catch(J){yn(o,o.return,J)}}function ji(s,o,l){try{var d=o.updateQueue,v=d!==null?d.lastEffect:null;if(v!==null){var j=v.next;d=j;do{if((d.tag&s)===s){var I=d.inst,J=I.destroy;if(J!==void 0){I.destroy=void 0,v=o;var he=l,Ne=J;try{Ne()}catch(ze){yn(v,he,ze)}}}d=d.next}while(d!==j)}}catch(ze){yn(o,o.return,ze)}}function oN(s){var o=s.updateQueue;if(o!==null){var l=s.stateNode;try{K2(o,l)}catch(d){yn(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){yn(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 v=s.stateNode,j=Na(s.memoizedProps,v);(v.ref===null||v.ref.name!==j)&&(v.ref=mC(j)),d=v.ref;break;case 7:if(s.stateNode===null){var I=new Ir(s);p(s.child,!1,WI,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(J){yn(s,o,J)}}function Ls(s,o){var l=s.ref,d=s.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(v){yn(s,o,v)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(v){yn(s,o,v)}else l.current=null}function Qm(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++)yC(s.stateNode,o[l])}function iN(s){for(var o=s.return;o!==null&&(Zb(o)&&yC(s.stateNode,o.stateNode),!Qb(o));)o=o.return}function yd(s){for(var o=s.return;o!==null&&(Zb(o)&&QI(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(v){yn(s,s.return,v)}}function e0(s,o,l){try{var d=s.stateNode;MI(d,s.type,l,o),d[Ms]=o}catch(v){yn(s,s.return,v)}}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 v=s.tag;if(v===5||v===6)v=s.stateNode,o?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(v,o):(o=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,o.appendChild(v),l=l._reactRootContainer,l!=null||o.onclick!==null||(o.onclick=er)),Qm(s,d),St=!0;else if(v!==4&&(v===27&&(Qm(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 Zm(s,o,l,d){var v=s.tag;if(v===5||v===6)v=s.stateNode,o?l.insertBefore(v,o):l.appendChild(v),Qm(s,d),St=!0;else if(v!==4&&(v===27&&(Qm(s,d),d=null,Ri(s.type)&&(l=s.stateNode)),s=s.child,s!==null))for(Zm(s,o,l,d),s=s.sibling;s!==null;)Zm(s,o,l,d),s=s.sibling}function cN(s){var o=s.stateNode,l=s.memoizedProps;try{for(var d=s.type,v=o.attributes;v.length;)o.removeAttributeNode(v[0]);$s(o,d,l),o[Un]=s,o[Ms]=l}catch(j){yn(s,s.return,j)}}var Jm=!1,Or=null;function uN(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(Jm=!0)}var Fo=null;function dN(){var s=Fo;return Fo=null,s}var fr=0;function $c(s,o,l,d,v){return fr=0,fN(s.child,o,l,d,v)}function fN(s,o,l,d,v){for(var j=!1;s!==null;){if(s.tag===5){var I=s.stateNode;if(d!==null){var J=$0(I);d.push(J),J.view&&(j=!0)}else j||$0(I).view&&(j=!0);Jm=!0,dC(I,fr===0?o:o+"_"+fr,l),fr++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&v||fN(s.child,o,l,d,v)&&(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 eh(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if((s.tag!==22||s.memoizedState===null)&&(eh(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,v=Na(d,l),j=Ca(d.default,l.paired?d.share:d.enter);j!=="none"?$c(s,v,j,null,!1)?(eh(s),l.paired||o||Yc(s,d.onEnter)):Go(s.child,!1):eh(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)s0(s,o),s=s.sibling;else eh(s)}function r0(s){if(Or!==null&&Or.size!==0){var o=Or;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 v=o.get(d);if(v!==void 0){var j=Ca(l.default,l.share);if(j!=="none"&&($c(s,d,j,null,!1)?(j=s.stateNode,v.paired=j,j.paired=v,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=Or!==null?Or.get(l):void 0,v=Ca(o.default,d!==void 0?o.share:o.exit);v!=="none"&&($c(s,l,v,null,!1)?d!==void 0?(v=s.stateNode,d.paired=v,v.paired=d,Or.delete(l),Yc(s,o.onShare)):Yc(s,o.onExit):Go(s.child,!1)),Or!==null&&r0(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)o0(s),s=s.sibling;else Or!==null&&r0(s)}function mN(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&&mN(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 th(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;)th(s),s=s.sibling;else a0(s)}function hN(s){for(s=s.child;s!==null;)s.tag===30?Go(s.child,!1):(s.subtreeFlags&33554432)!==0&&hN(s),s=s.sibling}function i0(s,o,l,d,v,j,I){for(var J=!1;o!==null;){if(o.tag===5){var he=o.stateNode;if(j!==null&&fr<j.length){var Ne=j[fr],ze=$0(he);(Ne.view||ze.view)&&(J=!0);var $e;if($e=(s.flags&4)===0)if(ze.clip)$e=!0;else{$e=Ne.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=!Ne.abs:(Ne=Ne.rect,ze=ze.rect,ze=Ne.height!==ze.height||Ne.width!==ze.width),ze&&(s.flags|=32)}else s.flags|=32;(s.flags&4)!==0&&dC(he,fr===0?l:l+"_"+fr,v),J&&(s.flags&4)!==0||(Fo===null&&(Fo=[]),Fo.push(he,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,v,j,I)&&(J=!0));o=o.sibling}return J}function pN(s,o){for(s=s.child;s!==null;){if(s.tag===30){var l=s.memoizedProps,d=s.stateNode,v=Na(l,d),j=Ca(l.default,l.update),I;I=s.memoizedState,s.memoizedState=null,d=s;var J=s.child;fr=0,v=i0(d,J,v,v,j,I,!1),(s.flags&4)!==0&&v&&Yc(s,l.onUpdate)}else(s.subtreeFlags&33554432)!==0&&pN(s);s=s.sibling}}var Cs=!1,hn=!1,qo=!1,l0=!1,gN=typeof WeakSet=="function"?WeakSet:Set,ks=null,Yo=!1,vd=!1,nh=!1,c0=!1;function iI(s,o,l){if(s=s.containerInfo,z0=su,s=v2(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 v=d.getSelection&&d.getSelection();if(v&&v.rangeCount!==0){d=v.anchorNode;var j=v.anchorOffset,I=v.focusNode;v=v.focusOffset;try{d.nodeType,I.nodeType}catch{d=null;break e}var J=0,he=-1,Ne=-1,ze=0,$e=0,we=s,Oe=null;t:for(;;){for(var ot;we!==d||j!==0&&we.nodeType!==3||(he=J+j),we!==I||v!==0&&we.nodeType!==3||(Ne=J+v),we.nodeType===3&&(J+=we.nodeValue.length),(ot=we.firstChild)!==null;)Oe=we,we=ot;for(;;){if(we===s)break t;if(Oe===d&&++ze===j&&(he=J),Oe===I&&++$e===v&&(Ne=J),(ot=we.nextSibling)!==null)break;we=Oe,Oe=we.parentNode}we=ot}d=he===-1||Ne===-1?null:{start:he,end:Ne}}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),sh(l);else{if(s.tag===22){if(d=s.alternate,s.memoizedState!==null){d!==null&&d.memoizedState===null&&l&&o0(d),sh(l);continue}else if(d!==null&&d.memoizedState!==null){l&&uN(s),sh(l);continue}}d=s.child,(s.subtreeFlags&o)!==0&&d!==null?(d.return=s,ks=d):(l&&mN(s),sh(l))}}Or=null}function sh(s){for(;ks!==null;){var o=ks,l=s,d=o.alternate,v=o.flags;switch(o.tag){case 0:case 11:case 15:break;case 1:if((v&1024)!==0&&d!==null){l=void 0,v=d.memoizedProps,d=d.memoizedState;var j=o.stateNode;try{var I=Al(o.type,v);l=j.getSnapshotBeforeUpdate(I,d),j.__reactInternalSnapshotBeforeUpdate=l}catch(J){yn(o,o.return,J)}}break;case 3:if((v&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),v=o.memoizedProps,v=Ca(v.default,v.update),v!=="none"&&$c(d,l,v,d.memoizedState=[],!0));break;default:if((v&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&&bd(5,l);break;case 1:if(Ko(s,l),d&4)if(s=l.stateNode,o===null)try{s.componentDidMount()}catch(I){yn(l,l.return,I)}else{var v=Al(l.type,o.memoizedProps);o=o.memoizedState;try{s.componentDidUpdate(v,o,s.__reactInternalSnapshotBeforeUpdate)}catch(I){yn(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{K2(s,o)}catch(I){yn(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=yI.bind(null,l),eP(s,l))));break;case 22:if(d=l.memoizedState!==null||Cs,!d){var j=o!==null&&o.memoizedState!==null||hn;o=Cs,v=hn,Cs=d,(hn=j)&&!v?(d=2,(l.subtreeFlags&8772)!==0&&(d|=1),To(s,l,d)):Ko(s,l),Cs=o,hn=v}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 v=s.stateNode,j=s.memoizedProps.style,I=j!=null&&j.hasOwnProperty("display")?j.display:null;v.style.display=I==null||typeof I=="boolean"?"":(""+I).trim()}}catch(he){yn(s,s.return,he)}d0(s,o);break;case 6:try{s.stateNode.nodeValue=o?"":s.memoizedProps,St=!0}catch(he){yn(s,s.return,he)}break;case 18:try{var J=s.stateNode;o?uC(J,!0):uC(s.stateNode,!1)}catch(he){yn(s,s.return,he)}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 yN(s){var o=s.alternate;o!==null&&(s.alternate=null,yN(o)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(o=s.stateNode,o!==null&&yc(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,mr=!1;function Co(s,o,l){for(l=l.child;l!==null;)vN(s,o,l),l=l.sibling}function vN(s,o,l){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(je,l)}catch{}switch(l.tag){case 26:hn||Ls(l,o),Co(s,o,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&!hn&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:hn||Ls(l,o),yd(l);var d=Vn,v=mr;Ri(l.type)&&(Vn=l.stateNode,mr=!1),Co(s,o,l),NC(l.stateNode,l.type,l.memoizedProps),Vn=d,mr=v;break;case 5:hn||Ls(l,o),yd(l);case 6:if(l.tag===6&&yd(l),d=Vn,v=mr,Vn=null,Co(s,o,l),Vn=d,mr=v,Vn!==null)if(mr)try{(Vn.nodeType===9?Vn.body:Vn.nodeName==="HTML"?Vn.ownerDocument.body:Vn).removeChild(l.stateNode),St=!0}catch(j){yn(l,o,j)}else try{Vn.removeChild(l.stateNode),St=!0}catch(j){yn(l,o,j)}break;case 18:Vn!==null&&(mr?(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,v=mr,Vn=l.stateNode.containerInfo,mr=!0,Co(s,o,l),Vn=d,mr=v;break;case 0:case 11:case 14:case 15:ji(2,l,o),hn||ji(4,l,o),Co(s,o,l);break;case 1:hn||(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:hn=(d=hn)||l.memoizedState!==null,Co(s,o,l),hn=d;break;case 30:Ls(l,o),Co(s,o,l);break;case 7:hn||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){yn(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){yn(o,o.return,l)}}function lI(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 rh(s,o){var l=lI(s);o.forEach(function(d){if(!l.has(d)){l.add(d);var v=vI.bind(null,s,d);d.then(v,v)}})}function sr(s,o,l){var d=o.deletions;if(d!==null)for(var v=0;v<d.length;v++){var j=d[v],I=s,J=o,he=J;e:for(;he!==null;){switch(he.tag){case 27:if(Ri(he.type)){Vn=he.stateNode,mr=!1;break e}break;case 5:Vn=he.stateNode,mr=!1;break e;case 3:case 4:Vn=he.stateNode.containerInfo,mr=!0;break e}he=he.return}if(Vn===null)throw Error(a(160));vN(I,J,j),Vn=null,mr=!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,v=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(v&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),v&4&&(ji(3,s,s.return),bd(3,s),ji(5,s,s.return));break;case 1:sr(o,s,l),rr(s),v&512&&(hn||d===null||Ls(d,d.return)),v&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),v&512&&(hn||d===null||Ls(d,d.return)),v&4)if(v=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,v=j.ownerDocument||j;t:switch(o){case"title":d=v.getElementsByTagName("title")[0],(!d||d[cl]||d[Un]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=v.createElement(o),v.head.insertBefore(d,v.querySelector("head > title"))),$s(d,o,l),d[Un]=s,qe(d),o=d;break e;case"link":if(j=AC("link","href",v).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=v.createElement(o),$s(d,o,l),v.head.appendChild(d);break;case"meta":if(j=AC("meta","content",v).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=v.createElement(o),$s(d,o,l),v.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 v!==l?(v===null?(o=d.stateNode,o===null||hn||o.parentNode.removeChild(o)):v.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),v&512&&(hn||d===null||Ls(d,d.return)),d!==null&&v&4&&e0(s,s.memoizedProps,d.memoizedProps);break;case 5:if(j=qo,qo=!1,sr(o,s,l),qo=j,rr(s),v&512&&(hn||d===null||Ls(d,d.return)),s.flags&32){o=s.stateNode;try{Js(o,""),St=!0}catch(ze){yn(s,s.return,ze)}}v&4&&s.stateNode!=null&&(o=s.memoizedProps,e0(s,o,d!==null?d.memoizedProps:o)),v&1024&&(l0=!0);break;case 6:if(sr(o,s,l),rr(s),v&4){if(s.stateNode===null)throw Error(a(162));o=s.memoizedProps,l=s.stateNode;try{l.nodeValue=o,St=!0}catch(ze){yn(s,s.return,ze)}}break;case 3:if(St=!1,yh=null,j=ko,ko=Rd(o.containerInfo),sr(o,s,l),ko=j,rr(s),v&4&&d!==null&&d.memoizedState.isDehydrated)try{ru(o.containerInfo)}catch(ze){yn(s,s.return,ze)}l0&&(l0=!1,NN(s)),St=!1;break;case 4:v=qo,qo=Cs,d=fs(),j=ko,ko=Rd(s.stateNode.containerInfo),sr(o,s,l),rr(s),ko=j,St&&vd&&(nh=!0),St=d,qo=v;break;case 12:sr(o,s,l),rr(s);break;case 31:sr(o,s,l),rr(s),v&4&&(o=s.updateQueue,o!==null&&(s.updateQueue=null,rh(s,o)));break;case 13:sr(o,s,l),rr(s),s.child.flags&8192&&s.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(ih=be()),v&4&&(o=s.updateQueue,o!==null&&(s.updateQueue=null,rh(s,o)));break;case 22:j=s.memoizedState!==null,I=d!==null&&d.memoizedState!==null;var J=Cs,he=hn,Ne=qo;Cs=J||j,qo=Ne||j,hn=he||I,sr(o,s,l),hn=he,qo=Ne,Cs=J,rr(s),v&8192&&(o=s.stateNode,o._visibility=j?o._visibility&-2:o._visibility|1,!j||d===null||I||Cs||hn||(o=I||hn,l=Cs,d=hn,Cs=j||Cs,hn=o,Si(s,2),Cs=l,hn=d),!j&&qo||u0(s,j)),v&4&&(o=s.updateQueue,o!==null&&(l=o.retryQueue,l!==null&&(o.retryQueue=null,rh(s,l))));break;case 19:sr(o,s,l),rr(s),v&4&&(o=s.updateQueue,o!==null&&(s.updateQueue=null,rh(s,o)));break;case 30:v&512&&(hn||d===null||Ls(d,d.return)),v=fs(),j=vd,I=(l&335544064)===l,J=s.memoizedProps,vd=I&&Ca(J.default,J.update)!=="none",sr(o,s,l),rr(s),I&&d!==null&&St&&(s.flags|=4),vd=j,St=v;break;case 21:break;case 7:v&512&&(hn||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 v=s.return;v!==null;){if(Zb(v)){var j=v.stateNode;d===null?d=[j]:d.push(j)}if(Qb(v))break;v=v.return}var I=d;if(l==null)throw Error(a(160));switch(l.tag){case 27:var J=l.stateNode,he=t0(s);Zm(s,he,J,I);break;case 5:var Ne=l.stateNode;l.flags&32&&(Js(Ne,""),l.flags&=-33);var ze=t0(s);Zm(s,ze,Ne,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(Oe){yn(s,s.return,Oe)}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&&!nh){if(s=Fo,s!==null)for(var d=0;d<s.length;d+=3){l=s[d];var v=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("+v+")"})}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&&(nh=!0),Yo=d;break;case 22:s.memoizedState===null&&(l.memoizedState!==null?s0(s,!1):Bc(o,s));break;case 30:d=Yo,v=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 J=Ca(j.default,j.update);J==="none"?o=!1:(j=l.memoizedState,l.memoizedState=null,l=s.child,fr=0,o=i0(s,l,o,I,J,j,!0),fr!==(j===null?0:j.length)&&(s.flags|=32)),(s.flags&4)!==0&&o?(Yc(s,s.memoizedProps.onUpdate),Fo=v):v!==null&&(v.push.apply(v,Fo),Fo=v),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 v=l.stateNode;typeof v.componentWillUnmount=="function"&&aN(l,l.return,v),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),v=l.stateNode,l.memoizedState!==null||v===null||hn||v.parentNode.removeChild(v),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,v=s,j=o,I=j.flags,J=(l&1)!==0;switch(j.tag){case 0:case 11:case 15:To(v,j,l),bd(4,j);break;case 1:if(To(v,j,l),d=j,v=d.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ze){yn(d,d.return,ze)}if(d=j,v=d.updateQueue,v!==null){var he=d.stateNode;try{var Ne=v.shared.hiddenCallbacks;if(Ne!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Ne.length;v++)Y2(Ne[v],he)}catch(ze){yn(d,d.return,ze)}}J&&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(v,j,l),J&&d===null&&I&4&&Jb(j),Ho(j,j.return);break;case 6:iN(j);break;case 26:he=j.stateNode,j.memoizedState!==null||he===null||Cs||X0(Rd(he.ownerDocument),j.type,he),To(v,j,l),J&&d===null&&I&4&&Jb(j),Ho(j,j.return);break;case 12:To(v,j,l);break;case 31:To(v,j,l),J&&I&4&&wN(v,j);break;case 13:To(v,j,l),J&&I&4&&jN(v,j);break;case 22:j.memoizedState===null&&To(v,j,l),Ho(j,j.return);break;case 30:To(v,j,l),Ho(j,j.return);break;case 7:Ho(j,j.return);default:To(v,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&&od(l))}function m0(s,o){s=null,o.alternate!==null&&(s=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==s&&(o.refCount++,s!=null&&od(s))}function ro(s,o,l,d){var v=(l&335544064)===l;if(o.subtreeFlags&(v?10262:10256))for(o=o.child;o!==null;)kN(s,o,l,d),o=o.sibling;else v&&hN(o)}function kN(s,o,l,d){var v=(l&335544064)===l;v&&o.alternate===null&&o.return!==null&&o.return.alternate!==null&&th(o);var j=o.flags;switch(o.tag){case 0:case 11:case 15:ro(s,o,l,d),j&2048&&bd(9,o);break;case 1:ro(s,o,l,d);break;case 3:ro(s,o,l,d),v&&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&&od(j)));break;case 12:if(j&2048){ro(s,o,l,d),j=o.stateNode;try{var I=o.memoizedProps,J=I.id,he=I.onPostCommit;typeof he=="function"&&he(J,o.alternate===null?"mount":"update",j.passiveEffectDuration,-0)}catch(Ne){yn(o,o.return,Ne)}}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,J=o.alternate,o.memoizedState!==null?(v&&J!==null&&J.memoizedState===null&&th(J),I._visibility&2?ro(s,o,l,d):wd(s,o)):(v&&J!==null&&J.memoizedState!==null&&th(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(J,o);break;case 24:ro(s,o,l,d),j&2048&&m0(o.alternate,o);break;case 30:v&&(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,v){for(v=v&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var j=s,I=o,J=l,he=d,Ne=I.flags;switch(I.tag){case 0:case 11:case 15:Vc(j,I,J,he,v),bd(8,I);break;case 23:break;case 22:var ze=I.stateNode;I.memoizedState!==null?ze._visibility&2?Vc(j,I,J,he,v):wd(j,I):(ze._visibility|=2,Vc(j,I,J,he,v)),v&&Ne&2048&&f0(I.alternate,I);break;case 24:Vc(j,I,J,he,v),v&&Ne&2048&&m0(I.alternate,I);break;default:Vc(j,I,J,he,v)}o=o.sibling}}function wd(s,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var l=s,d=o,v=d.flags;switch(d.tag){case 22:wd(l,d),v&2048&&f0(d.alternate,d);break;case 24:wd(l,d),v&2048&&m0(d.alternate,d);break;default:wd(l,d)}o=o.sibling}}var Ol=8192;function Ml(s,o,l){if(s.subtreeFlags&Ol)for(s=s.child;s!==null;)TN(s,o,l),s=s.sibling}function TN(s,o,l){switch(s.tag){case 26:Ml(s,o,l),s.flags&Ol&&(s.memoizedState!==null?hP(l,ko,s.memoizedState,s.memoizedProps):(s=s.stateNode,(o&335544128)===o&&zC(l,s)));break;case 5:Ml(s,o,l),s.flags&Ol&&(s=s.stateNode,(o&335544128)===o&&zC(l,s));break;case 3:case 4:var d=ko;ko=Rd(s.stateNode.containerInfo),Ml(s,o,l),ko=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Ol,Ol=16777216,Ml(s,o,l),Ol=d):Ml(s,o,l));break;case 30:if((s.flags&Ol)!==0&&(d=s.memoizedProps.name,d!=null&&d!=="auto")){var v=s.stateNode;v.paired=null,Or===null&&(Or=new Map),Or.set(d,v)}Ml(s,o,l);break;default:Ml(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 jd(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:jd(s),s.flags&2048&&ji(9,s,s.return);break;case 3:jd(s);break;case 12:jd(s);break;case 22:var o=s.stateNode;s.memoizedState!==null&&o._visibility&2&&(s.return===null||s.return.tag!==13)?(o._visibility&=-3,oh(s)):jd(s);break;default:jd(s)}}function oh(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),oh(o);break;case 22:l=o.stateNode,l._visibility&2&&(l._visibility&=-3,oh(o));break;default:oh(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:od(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,ks=d;else e:for(l=s;ks!==null;){d=ks;var v=d.sibling,j=d.return;if(yN(d),d===l){ks=null;break e}if(v!==null){v.return=j,ks=v;break e}ks=j}}}var cI={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}},uI=typeof WeakMap=="function"?WeakMap:Map,dn=0,An=null,qt=null,Kt=0,bn=0,Mr=null,Ni=!1,Uc=!1,h0=!1,za=0,Wn=0,Ci=0,Dl=0,ah=0,Dr=0,Hc=0,Sd=null,hr=null,p0=!1,ih=0,ON=0,lh=1/0,ch=null,ki=null,Fn=0,Eo=null,zl=null,Xo=0,g0=0,x0=null,MN=null,Fc=null,Gc=null,qc=null,Nd=0,uh=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=mC(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),v=d?mI(s,o):y0(s,o,!0),j=d;do{if(v===0){Uc&&!d&&Ti(s,o,0,!1);break}else{if(l=s.current.alternate,j&&!dI(l)){v=y0(s,o,!1),j=!1;continue}if(v===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 J=s;v=Sd;var he=J.current.memoizedState.isDehydrated;if(he&&(Kc(J,I).flags|=256),I=y0(J,I,!1),I!==2&&I!==6){if(h0&&!he){J.errorRecoveryDisabledLanes|=j,Dl|=j,v=4;break e}j=hr,hr=v,j!==null&&(hr===null?hr=j:hr.push.apply(hr,j))}v=I}if(j=!1,v!==2)continue}}if(v===1){Kc(s,0),Ti(s,o,0,!0);break}e:{switch(d=s,j=v,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:hr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((o&62914560)===o&&(v=ih+300-be(),10<v)){if(Ti(d,o,Dr,!Ni),ce(d,0,!0)!==0)break e;Xo=o,d.timeoutHandle=L0(IN.bind(null,d,l,hr,ch,p0,o,Dr,Dl,Hc,Ni,j,"Throttled",-0,0),v);break e}IN(d,l,hr,ch,p0,o,Dr,Dl,Hc,Ni,j,null,-0,0)}}break}while(!0);Wo(s)}function IN(s,o,l,d,v,j,I,J,he,Ne,ze,$e,we,Oe){s.timeoutHandle=-1;var ot=o.subtreeFlags,ht=(j&335544064)===j;if($e=null,(ht||ot&8192||(ot&16785408)===16785408)&&($e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:er},Or=null,TN(o,j,$e),ht&&(ot=$e,ht=s.containerInfo,ht=(ht.nodeType===9?ht:ht.ownerDocument).__reactViewTransition,ht!=null&&(ot.count++,ot.waitingForViewTransition=!0,ot=Md.bind(ot),ht.finished.then(ot,ot))),ot=(j&62914560)===j?ih-be():(j&4194048)===j?ON-be():0,ot=pP($e,ot),ot!==null)){Xo=j,s.cancelPendingCommit=ot(HN.bind(null,s,o,j,l,d,v,I,J,he,Ne,ze,$e,null,we,Oe)),Ti(s,j,I,!Ne);return}HN(s,o,j,l,d,v,I,J,he,Ne,ze,$e)}function dI(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 v=l[d],j=v.getSnapshot;v=v.value;try{if(!Rr(j(),v))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=Tt(s,o),o&=~ah,o&=~Dl,s.suspendedLanes|=o,s.pingedLanes&=~o,d&&(s.warmLanes|=o),d=s.expirationTimes;for(var v=o;0<v;){var j=31-it(v),I=1<<j;d[j]=-1,v&=~I}l!==0&&Jn(s,l,o)}function dh(){return(dn&6)===0?(Cd(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,ld=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,II(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,Mr=null,Ni=!1,Uc=tt(s,o),h0=!1,Hc=Dr=ah=Dl=Ci=Wn=0,hr=Sd=null,p0=!1,za=Tt(s,o),ym(),l}function PN(s,o){_t=null,ae.H=Fm,o===Dc||o===Am?(o=H2(),bn=3):o===mb?(o=H2(),bn=4):bn=o===Vb?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Mr=o,qt===null&&(Wn=1,Gm(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=Fm,s===null?Fm:s}function $N(){var s=ae.A;return ae.A=cI,s}function fh(){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 y0(s,o,l){var d=dn;dn|=2;var v=LN(),j=$N();(An!==s||Kt!==o)&&(ch=null,Kc(s,o)),o=!1;var I=Wn;e:do try{if(bn!==0&&qt!==null){var J=qt,he=Mr;switch(bn){case 8:b0(),I=6;break e;case 3:case 2:case 9:case 6:Ps.current===null&&(o=!0);var Ne=bn;if(bn=0,Mr=null,Xc(s,J,he,Ne),l&&Uc){I=0;break e}break;default:Ne=bn,bn=0,Mr=null,Xc(s,J,he,Ne)}}fI(),I=Wn;break}catch(ze){PN(s,ze)}while(!0);return o&&s.shellSuspendCounter++,Ea=wl=null,dn=d,ae.H=v,ae.A=j,qt===null&&(An=null,Kt=0,ym()),I}function fI(){for(;qt!==null;)BN(qt)}function mI(s,o){var l=dn;dn|=2;var d=LN(),v=$N();An!==s||Kt!==o?(ch=null,lh=be()+500,Kc(s,o)):Uc=tt(s,o);e:do try{if(bn!==0&&qt!==null){o=qt;var j=Mr;t:switch(bn){case 1:bn=0,Mr=null,Xc(s,o,j,1);break;case 2:case 9:if(V2(j)){bn=0,Mr=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:V2(j)?(bn=0,Mr=null,VN(o)):(bn=0,Mr=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 J=qt;if(I?MC(I):J.stateNode.complete){bn=0,Mr=null;var he=J.sibling;if(he!==null)qt=he;else{var Ne=J.return;Ne!==null?(qt=Ne,mh(Ne)):qt=null}break t}}bn=0,Mr=null,Xc(s,o,j,5);break;case 6:bn=0,Mr=null,Xc(s,o,j,6);break;case 8:b0(),Wn=6;break e;default:throw Error(a(462))}}hI();break}catch(ze){PN(s,ze)}while(!0);return Ea=wl=null,ae.H=d,ae.A=v,dn=l,qt!==null?0:(An=null,Kt=0,ym(),Wn)}function hI(){for(;qt!==null&&!At();)BN(qt)}function BN(s){var o=nN(s.alternate,s,za);s.memoizedProps=s.pendingProps,o===null?mh(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?(Cm(d),d.tag===5&&d.stateNode!=null&&(On=d.stateNode)):(Cm(d),Vt=!0));default:rN(l,o),o=qt=A2(o,za),o=nN(l,o,za)}s.memoizedProps=s.pendingProps,o===null?mh(s):qt=o}function Xc(s,o,l,d){Ea=wl=null,kb(o),zc=null,ld=0;var v=o.return;try{if(tI(s,v,o,l,Kt)){Wn=1,Gm(s,eo(l,s.current)),qt=null;return}}catch(j){if(v!==null)throw qt=v,j;Wn=1,Gm(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)):mh(o)}function mh(s){var o=s;do{if((o.flags&32768)!==0){UN(o,Ni);return}s=o.return;var l=oI(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=aI(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,v,j,I,J,he,Ne,ze,$e){s.cancelPendingCommit=null;do hh();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=v,MN=d,pI(s,o,l,I,J,he,$e)}}function pI(s,o,l,d,v,j,I){var J=o.lanes|o.childLanes;if(g0=J,J|=eb,ns(s,l,J,d,v,j),Gc=null,(l&335544064)===l?(qc=Hz(s),d=10262):(qc=null,d=10256),(o.subtreeFlags&d)!==0||(o.flags&d)!==0?(s.callbackNode=null,s.callbackPriority=0,wI(Ke,function(){return S0(),null})):(s.callbackNode=null,s.callbackPriority=0),Jm=!1,d=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||d){d=ae.T,ae.T=null,v=le.p,le.p=2,j=dn,dn|=4;try{iI(s,o,l)}finally{dn=j,le.p=v,ae.T=d}}Fn=1,Jm?Fc=VI(I,s.containerInfo,qc,v0,w0,xI,j0,S0,gI):(v0(),w0(),j0())}function gI(s){if(Fn!==0){var o=Eo.onRecoverableError;o(s,{componentStack:null})}}function xI(){Fn===3&&(Fn=0,CN(zl,Eo),Fn=4)}function v0(){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 v=le.p;le.p=2;var j=dn;dn|=4;try{vd=nh=!1,SN(o,s,l),l=I0;var I=v2(s.containerInfo),J=l.focusedElem,he=l.selectionRange;if(I!==J&&J&&J.ownerDocument&&y2(J.ownerDocument.documentElement,J)){if(he!==null&&Xx(J)){var Ne=he.start,ze=he.end;if(ze===void 0&&(ze=Ne),"selectionStart"in J)J.selectionStart=Ne,J.selectionEnd=Math.min(ze,J.value.length);else{var $e=J.ownerDocument||document,we=$e&&$e.defaultView||window;if(we.getSelection){var Oe=we.getSelection(),ot=J.textContent.length,ht=Math.min(he.start,ot),Lt=he.end===void 0?ht:Math.min(he.end,ot);!Oe.extend&&ht>Lt&&(I=Lt,Lt=ht,ht=I);var Se=b2(J,ht),xe=b2(J,Lt);if(Se&&xe&&(Oe.rangeCount!==1||Oe.anchorNode!==Se.node||Oe.anchorOffset!==Se.offset||Oe.focusNode!==xe.node||Oe.focusOffset!==xe.offset)){var Ee=$e.createRange();Ee.setStart(Se.node,Se.offset),Oe.removeAllRanges(),ht>Lt?(Oe.addRange(Ee),Oe.extend(xe.node,xe.offset)):(Ee.setEnd(xe.node,xe.offset),Oe.addRange(Ee))}}}}for($e=[],Oe=J;Oe=Oe.parentNode;)Oe.nodeType===1&&$e.push({element:Oe,left:Oe.scrollLeft,top:Oe.scrollTop});for(typeof J.focus=="function"&&J.focus(),J=0;J<$e.length;J++){var Le=$e[J];Le.element.scrollLeft=Le.left,Le.element.scrollTop=Le.top}}su=!!z0,I0=z0=null}finally{dn=j,le.p=v,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=le.p;le.p=2;var v=dn;dn|=4;try{xN(s,o.alternate,o)}finally{dn=v,le.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,v=MN,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(je,l,void 0,(l.current.flags&128)===128)}catch{}if(v!==null){l=ae.T,j=le.p,le.p=2,ae.T=null;try{for(var I=o.onRecoverableError,J=0;J<v.length;J++){var he=v[J];I(he.value,{componentStack:he.stack})}}finally{ae.T=l,le.p=j}}if(v=Gc,I=qc,qc=null,v!==null&&(Gc=null,I===null&&(I=[]),s!==null))for(he=0;he<v.length;he++)l=(0,v[he])(I),l!==void 0&&s.finished.finally(l);(Xo&3)!==0&&hh(),Wo(o),j=o.pendingLanes,(d&261930)!==0&&(j&42)!==0?o===uh?Nd++:(Nd=0,uh=o):(Nd=0,uh=null),Cd(0)}}function FN(s,o){(s.pooledCacheLanes&=o)===0&&(o=s.pooledCache,o!=null&&(s.pooledCache=null,od(o)))}function hh(){return Fc!==null&&(Fc.skipTransition(),Fc=null),v0(),w0(),j0(),S0()}function S0(){if(Fn!==5)return!1;var s=Eo,o=g0;g0=0;var l=Fs(Xo),d=ae.T,v=le.p;try{le.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 J=dn;if(dn|=4,RN(j.current),kN(j,j.current,I,l),dn=J,Cd(0,!1),Ye&&typeof Ye.onPostCommitFiberRoot=="function")try{Ye.onPostCommitFiberRoot(je,j)}catch{}return!0}finally{le.p=v,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 yn(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 uI;var v=new Set;d.set(o,v)}else v=d.get(o),v===void 0&&(v=new Set,d.set(o,v));v.has(l)||(h0=!0,v.add(l),s=bI.bind(null,s,o,l),o.then(s,s))}function bI(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>be()-ih)&&(dn&2)===0?Kc(s,0):ah|=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 yI(s){var o=s.memoizedState,l=0;o!==null&&(l=o.retryLane),qN(s,l)}function vI(s,o){var l=0;switch(s.tag){case 31:case 13:var d=s.stateNode,v=s.memoizedState;v!==null&&(l=v.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 wI(s,o){return Je(s,o)}var Wc=null,Qc=null,C0=!1,ph=!1,k0=!1,Ei=0;function Wo(s){s!==Qc&&s.next===null&&(Qc===null?Wc=Qc=s:Qc=Qc.next=s),ph=!0,C0||(C0=!0,SI())}function Cd(s,o){if(!k0&&ph){k0=!0;do for(var l=!1,d=Wc;d!==null;){if(s!==0){var v=d.pendingLanes;if(v===0)var j=0;else{var I=d.suspendedLanes,J=d.pingedLanes;j=(1<<31-it(42|s)+1)-1,j&=v&~(I&~J),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(l=!0,WN(d,j))}else j=Kt,j=ce(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 jI(){YN()}function YN(){ph=C0=!1;var s=0;Ei!==0&&zI()&&(s=Ei);for(var o=be(),l=null,d=Wc;d!==null;){var v=d.next,j=KN(d,o);j===0?(d.next=null,l===null?Wc=v:l.next=v,v===null&&(Qc=l)):(l=d,(s!==0||(j&3)!==0)&&(ph=!0)),d=v}Fn!==0&&Fn!==5||Cd(s),Ei!==0&&(Ei=0)}function KN(s,o){for(var l=s.suspendedLanes,d=s.pingedLanes,v=s.expirationTimes,j=s.pendingLanes&-62914561;0<j;){var I=31-it(j),J=1<<I,he=v[I];he===-1?((J&l)===0||(J&d)!==0)&&(v[I]=rn(J,o)):he<=o&&(s.expiredLanes|=J),j&=~J}if(o=An,l=Kt,l=ce(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(hh()&&s.callbackNode!==l)return null;var d=Kt;return d=ce(s,s===An?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(zN(s,d,o),KN(s,be()),s.callbackNode!=null&&s.callbackNode===l?XN.bind(null,s):null)}function WN(s,o){if(hh())return null;zN(s,o,!0)}function SI(){PI(function(){(dn&6)!==0?Je(Qe,jI):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 NI(s,o,l,d,v){if(o==="submit"&&l&&l.stateNode===v){var j=QN((v[Ms]||null).action),I=d.submitter;I&&(o=(o=I[Ms]||null)?QN(o.formAction):I.getAttribute("formAction"),o!==null&&(j=o,I=null));var J=new pm("action","action",null,d,v);s.push({event:J,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Ei!==0){var he=new FormData(v,I);Ib(l,{pending:!0,data:he,method:v.method,action:j},null,he)}}else typeof j=="function"&&(J.preventDefault(),he=new FormData(v,I),Ib(l,{pending:!0,data:he,method:v.method,action:j},j,he))},currentTarget:v}]})}}for(var E0=0;E0<Jx.length;E0++){var R0=Jx[E0],CI=R0.toLowerCase(),kI=R0[0].toUpperCase()+R0.slice(1);No(CI,"on"+kI)}No(S2,"onAnimationEnd"),No(N2,"onAnimationIteration"),No(C2,"onAnimationStart"),No("dblclick","onDoubleClick"),No("focusin","onFocus"),No("focusout","onBlur"),No(Iz,"onTransitionRun"),No(Pz,"onTransitionStart"),No(_z,"onTransitionCancel"),No(k2,"onTransitionEnd"),Sn("onMouseEnter",["mouseout","mouseover"]),Sn("onMouseLeave",["mouseout","mouseover"]),Sn("onPointerEnter",["pointerout","pointerover"]),Sn("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 kd="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(" "),TI=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(kd));function ZN(s,o){o=(o&4)!==0;for(var l=0;l<s.length;l++){var d=s[l],v=d.event;d=d.listeners;e:{var j=void 0;if(o)for(var I=d.length-1;0<=I;I--){var J=d[I],he=J.instance,Ne=J.currentTarget;if(J=J.listener,he!==j&&v.isPropagationStopped())break e;j=J,v.currentTarget=Ne;try{j(v)}catch(ze){bm(ze)}v.currentTarget=null,j=he}else for(I=0;I<d.length;I++){if(J=d[I],he=J.instance,Ne=J.currentTarget,J=J.listener,he!==j&&v.isPropagationStopped())break e;j=J,v.currentTarget=Ne;try{j(v)}catch(ze){bm(ze)}v.currentTarget=null,j=he}}}}function Yt(s,o){var l=o[Fu];l===void 0&&(l=o[Fu]=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 gh="_reactListening"+Math.random().toString(36).slice(2);function O0(s){if(!s[gh]){s[gh]=!0,zt.forEach(function(l){l!=="selectionchange"&&(TI.has(l)||A0(l,!1,s),A0(l,!0,s))});var o=s.nodeType===9?s:s.ownerDocument;o===null||o[gh]||(o[gh]=!0,A0("selectionchange",!1,o))}}function JN(s,o,l,d){switch(UC(o)){case 2:var v=yP;break;case 8:v=vP;break;default:v=Q0}l=v.bind(null,o,l,s),v=void 0,!pl||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),d?v!==void 0?s.addEventListener(o,l,{capture:!0,passive:v}):s.addEventListener(o,l,!0):v!==void 0?s.addEventListener(o,l,{passive:v}):s.addEventListener(o,l,!1)}function M0(s,o,l,d,v){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 J=d.stateNode.containerInfo;if(J===v)break;if(I===4)for(I=d.return;I!==null;){var he=I.tag;if((he===3||he===4)&&I.stateNode.containerInfo===v)return;I=I.return}for(;J!==null;){if(I=So(J),I===null)return;if(he=I.tag,he===5||he===6||he===26||he===27){d=j=I;continue e}J=J.parentNode}}d=d.return}hl(function(){var Ne=j,ze=ml(l),$e=[];e:{var we=T2.get(s);if(we!==void 0){var Oe=pm,ot=s;switch(s){case"keypress":if(mm(l)===0)break e;case"keydown":case"keyup":Oe=dz;break;case"focusin":ot="focus",Oe=Hx;break;case"focusout":ot="blur",Oe=Hx;break;case"beforeblur":case"afterblur":Oe=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":Oe=n2;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Oe=JD;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Oe=gz;break;case S2:case N2:case C2:Oe=nz;break;case k2:Oe=bz;break;case"scroll":case"scrollend":Oe=QD;break;case"wheel":Oe=vz;break;case"copy":case"cut":case"paste":Oe=rz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Oe=r2;break;case"submit":Oe=hz;break;case"toggle":case"beforetoggle":Oe=jz}var ht=(o&4)!==0,Lt=!ht&&(s==="scroll"||s==="scrollend"),Se=ht?we!==null?we+"Capture":null:we;ht=[];for(var xe=Ne,Ee;xe!==null;){var Le=xe;if(Ee=Le.stateNode,Le=Le.tag,Le!==5&&Le!==26&&Le!==27||Ee===null||Se===null||(Le=Sa(xe,Se),Le!=null&&ht.push(Td(xe,Le,Ee))),Lt)break;xe=xe.return}0<ht.length&&(we=new Oe(we,ot,null,l,ze),$e.push({event:we,listeners:ht}))}}if((o&7)===0){e:{if(Oe=s==="mouseover"||s==="pointerover",we=s==="mouseout"||s==="pointerout",Oe&&l!==fl&&(ot=l.relatedTarget||l.fromElement)&&(So(ot)||ot[Nr]))break e;(we||Oe)&&(ot=ze.window===ze?ze:(Oe=ze.ownerDocument)?Oe.defaultView||Oe.parentWindow:window,we?(Oe=l.relatedTarget||l.toElement,we=Ne,Oe=Oe?So(Oe):null,Oe!==null&&(Lt=c(Oe),ht=Oe.tag,Oe!==Lt||ht!==5&&ht!==27&&ht!==6)&&(Oe=null)):(we=null,Oe=Ne),we!==Oe&&(ht=n2,Le="onMouseLeave",Se="onMouseEnter",xe="mouse",(s==="pointerout"||s==="pointerover")&&(ht=r2,Le="onPointerLeave",Se="onPointerEnter",xe="pointer"),Lt=we==null?ot:De(we),Ee=Oe==null?ot:De(Oe),ot=new ht(Le,xe+"leave",we,l,ze),ot.target=Lt,ot.relatedTarget=Ee,Le=null,So(ze)===Ne&&(ht=new ht(Se,xe+"enter",Oe,l,ze),ht.target=Ee,ht.relatedTarget=Lt,Le=ht),Lt=Le,ht=we&&Oe?R(we,Oe,EI):null,we!==null&&eC($e,ot,we,ht,!1),Oe!==null&&Lt!==null&&eC($e,Lt,Oe,ht,!0)))}e:{if(we=Ne?De(Ne):window,Oe=we.nodeName&&we.nodeName.toLowerCase(),Oe==="select"||Oe==="input"&&we.type==="file")var ut=f2;else if(u2(we))if(m2)ut=Mz;else{ut=Az;var Xt=Rz}else Oe=we.nodeName,!Oe||Oe.toLowerCase()!=="input"||we.type!=="checkbox"&&we.type!=="radio"?Ne&&dl(Ne.elementType)&&(ut=f2):ut=Oz;if(ut&&(ut=ut(s,Ne))){d2($e,ut,l,ze);break e}Xt&&Xt(s,we,Ne)}switch(Xt=Ne?De(Ne):window,s){case"focusin":(u2(Xt)||Xt.contentEditable==="true")&&(Cc=Xt,Wx=Ne,nd=null);break;case"focusout":nd=Wx=Cc=null;break;case"mousedown":Qx=!0;break;case"contextmenu":case"mouseup":case"dragend":Qx=!1,w2($e,l,ze);break;case"selectionchange":if(zz)break;case"keydown":case"keyup":w2($e,l,ze)}var yt;if(Gx)e:{switch(s){case"compositionstart":var Et="onCompositionStart";break e;case"compositionend":Et="onCompositionEnd";break e;case"compositionupdate":Et="onCompositionUpdate";break e}Et=void 0}else Nc?l2(s,l)&&(Et="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Et="onCompositionStart");Et&&(o2&&l.locale!=="ko"&&(Nc||Et!=="onCompositionStart"?Et==="onCompositionEnd"&&Nc&&(yt=e2()):(ci=ze,Bx="value"in ci?ci.value:ci.textContent,Nc=!0)),Xt=xh(Ne,Et),0<Xt.length&&(Et=new s2(Et,s,null,l,ze),$e.push({event:Et,listeners:Xt}),yt?Et.data=yt:(yt=c2(l),yt!==null&&(Et.data=yt)))),(yt=Nz?Cz(s,l):kz(s,l))&&(Et=xh(Ne,"onBeforeInput"),0<Et.length&&(Xt=new s2("onBeforeInput","beforeinput",null,l,ze),$e.push({event:Xt,listeners:Et}),Xt.data=yt)),NI($e,s,Ne,l,ze)}ZN($e,o)})}function Td(s,o,l){return{instance:s,listener:o,currentTarget:l}}function xh(s,o){for(var l=o+"Capture",d=[];s!==null;){var v=s,j=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||j===null||(v=Sa(s,l),v!=null&&d.unshift(Td(s,v,j)),v=Sa(s,o),v!=null&&d.push(Td(s,v,j))),s.tag===3)return d;s=s.return}return[]}function EI(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,v){for(var j=o._reactName,I=[];l!==null&&l!==d;){var J=l,he=J.alternate,Ne=J.stateNode;if(J=J.tag,he!==null&&he===d)break;J!==5&&J!==26&&J!==27||Ne===null||(he=Ne,v?(Ne=Sa(l,j),Ne!=null&&I.unshift(Td(l,Ne,he))):v||(Ne=Sa(l,j),Ne!=null&&I.push(Td(l,Ne,he)))),l=l.return}I.length!==0&&s.push({event:o,listeners:I})}var RI=/\r\n?/g,AI=/\u0000|\uFFFD/g;function tC(s){return(typeof s=="string"?s:""+s).replace(RI,`
|
|
50
|
+
`).replace(AI,"")}function nC(s,o){return o=tC(o),tC(s)===o}function vn(s,o,l,d,v,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"&&vn(s,o,"name",v.name,v,null),vn(s,o,"formEncType",v.formEncType,v,null),vn(s,o,"formMethod",v.formMethod,v,null),vn(s,o,"formTarget",v.formTarget,v,null)):(vn(s,o,"encType",v.encType,v,null),vn(s,o,"method",v.method,v,null),vn(s,o,"target",v.target,v,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(v.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=Yu.get(l)||l,Hn(s,l,d);else return}St=!0}function D0(s,o,l,d,v,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(v.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(!Ot.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(v=l.endsWith("Capture"),j=l.slice(2,v?l.length-7:void 0),o=s[Ms]||null,o=o!=null?o[l]:null,typeof o=="function"&&s.removeEventListener(j,o,v),typeof d=="function")){typeof o!="function"&&o!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(j,d,v);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,v=!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":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:vn(s,o,j,I,l,null)}}v&&vn(s,o,"srcSet",l.srcSet,l,null),d&&vn(s,o,"src",l.src,l,null);return;case"input":Yt("invalid",s);var J=j=I=v=null,he=null,Ne=null;for(d in l)if(l.hasOwnProperty(d)){var ze=l[d];if(ze!=null)switch(d){case"name":v=ze;break;case"type":I=ze;break;case"checked":he=ze;break;case"defaultChecked":Ne=ze;break;case"value":j=ze;break;case"defaultValue":J=ze;break;case"children":case"dangerouslySetInnerHTML":if(ze!=null)throw Error(a(137,o));break;default:vn(s,o,d,ze,l,null)}}ii(s,j,J,he,Ne,I,v,!1);return;case"select":Yt("invalid",s),d=I=j=null;for(v in l)if(l.hasOwnProperty(v)&&(J=l[v],J!=null))switch(v){case"value":j=J;break;case"defaultValue":I=J;break;case"multiple":d=J;default:vn(s,o,v,J,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=v=d=null;for(I in l)if(l.hasOwnProperty(I)&&(J=l[I],J!=null))switch(I){case"value":d=J;break;case"defaultValue":v=J;break;case"children":j=J;break;case"dangerouslySetInnerHTML":if(J!=null)throw Error(a(91));break;default:vn(s,o,I,J,l,null)}kr(s,d,v,j);return;case"option":for(he in l)if(l.hasOwnProperty(he)&&(d=l[he],d!=null))switch(he){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:vn(s,o,he,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<kd.length;d++)Yt(kd[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(Ne in l)if(l.hasOwnProperty(Ne)&&(d=l[Ne],d!=null))switch(Ne){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:vn(s,o,Ne,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(J in l)l.hasOwnProperty(J)&&(d=l[J],d!=null&&vn(s,o,J,d,l,null))}var OI={};function MI(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 v=null,j=null,I=null,J=null,he=null,Ne=null,ze=null;for(Oe in l){var $e=l[Oe];if(l.hasOwnProperty(Oe)&&$e!=null)switch(Oe){case"checked":break;case"value":break;case"defaultValue":he=$e;default:d.hasOwnProperty(Oe)||vn(s,o,Oe,null,d,$e)}}for(var we in d){var Oe=d[we];if($e=l[we],d.hasOwnProperty(we)&&(Oe!=null||$e!=null))switch(we){case"type":Oe!==$e&&(St=!0),j=Oe;break;case"name":Oe!==$e&&(St=!0),v=Oe;break;case"checked":Oe!==$e&&(St=!0),Ne=Oe;break;case"defaultChecked":Oe!==$e&&(St=!0),ze=Oe;break;case"value":Oe!==$e&&(St=!0),I=Oe;break;case"defaultValue":Oe!==$e&&(St=!0),J=Oe;break;case"children":case"dangerouslySetInnerHTML":if(Oe!=null)throw Error(a(137,o));break;default:Oe!==$e&&vn(s,o,we,Oe,d,$e)}}Gs(s,I,J,he,Ne,ze,j,v);return;case"select":Oe=I=J=we=null;for(j in l)if(he=l[j],l.hasOwnProperty(j)&&he!=null)switch(j){case"value":break;case"multiple":Oe=he;default:d.hasOwnProperty(j)||vn(s,o,j,null,d,he)}for(v in d)if(j=d[v],he=l[v],d.hasOwnProperty(v)&&(j!=null||he!=null))switch(v){case"value":j!==he&&(St=!0),we=j;break;case"defaultValue":j!==he&&(St=!0),J=j;break;case"multiple":j!==he&&(St=!0),I=j;default:j!==he&&vn(s,o,v,j,d,he)}o=J,l=I,d=Oe,we!=null?ur(s,!!l,we,!1):!!d!=!!l&&(o!=null?ur(s,!!l,o,!0):ur(s,!!l,l?[]:"",!1));return;case"textarea":Oe=we=null;for(J in l)if(v=l[J],l.hasOwnProperty(J)&&v!=null&&!d.hasOwnProperty(J))switch(J){case"value":break;case"children":break;default:vn(s,o,J,null,d,v)}for(I in d)if(v=d[I],j=l[I],d.hasOwnProperty(I)&&(v!=null||j!=null))switch(I){case"value":v!==j&&(St=!0),we=v;break;case"defaultValue":v!==j&&(St=!0),Oe=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(a(91));break;default:v!==j&&vn(s,o,I,v,d,j)}Sc(s,we,Oe);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:vn(s,o,ot,null,d,we)}for(he in d)if(we=d[he],Oe=l[he],d.hasOwnProperty(he)&&we!==Oe&&(we!=null||Oe!=null))switch(he){case"selected":we!==Oe&&(St=!0),s.selected=we&&typeof we!="function"&&typeof we!="symbol";break;default:vn(s,o,he,we,d,Oe)}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 ht in l)we=l[ht],l.hasOwnProperty(ht)&&we!=null&&!d.hasOwnProperty(ht)&&vn(s,o,ht,null,d,we);for(Ne in d)if(we=d[Ne],Oe=l[Ne],d.hasOwnProperty(Ne)&&we!==Oe&&(we!=null||Oe!=null))switch(Ne){case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(a(137,o));break;default:vn(s,o,Ne,we,d,Oe)}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],Oe=l[ze],!d.hasOwnProperty(ze)||we===Oe||we===void 0&&Oe===void 0||D0(s,o,ze,we,d,Oe);return}}for(var Se in l)we=l[Se],l.hasOwnProperty(Se)&&we!=null&&!d.hasOwnProperty(Se)&&vn(s,o,Se,null,d,we);for($e in d)we=d[$e],Oe=l[$e],!d.hasOwnProperty($e)||we===Oe||we==null&&Oe==null||vn(s,o,$e,we,d,Oe)}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 DI(){if(typeof performance.getEntriesByType=="function"){for(var s=0,o=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var v=l[d],j=v.transferSize,I=v.initiatorType,J=v.duration;if(j&&J&&sC(I)){for(I=0,J=v.responseEnd,d+=1;d<l.length;d++){var he=l[d],Ne=he.startTime;if(Ne>J)break;var ze=he.transferSize,$e=he.initiatorType;ze&&sC($e)&&(he=he.responseEnd,I+=ze*(he<J?1:(J-Ne)/(he-Ne)))}if(--d,o+=8*(j+I)/(v.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 Ed(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=Ed(l).createElement(s),l[Un]=d,l[Ms]=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 zI(){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,II=typeof clearTimeout=="function"?clearTimeout:void 0,iC=typeof Promise=="function"?Promise:void 0,lC=typeof requestAnimationFrame=="function"?requestAnimationFrame:L0,PI=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 v=l.nextSibling;if(s.removeChild(l),v&&v.nodeType===8)if(l=v.data,l==="/$"||l==="/&"){if(d===0){s.removeChild(v),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,J=j.nodeName;j[cl]||J==="SCRIPT"||J==="STYLE"||J==="LINK"&&j.rel.toLowerCase()==="stylesheet"||l.removeChild(j),j=I}}else l==="body"&&q0(s.ownerDocument.body);l=v}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 v=d=0;v<o.length;v++){var j=o[v];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 LI(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 LI(o,l,s)}function $I(s){return s.documentElement.clientHeight}function BI(s){this.addEventListener("load",s),this.addEventListener("error",s)}function VI(s,o,l,d,v,j,I,J,he){var Ne=o.nodeType===9?o:o.ownerDocument;try{var ze=Ne.startViewTransition({update:function(){var we=Ne.defaultView,Oe=we.navigation&&we.navigation.transition,ot=Ne.fonts.status;d();var ht=[];if(ot==="loaded"&&($I(Ne),Ne.fonts.status==="loading"&&ht.push(Ne.fonts.ready)),ot=ht.length,s!==null)for(var Lt=s.suspenseyImages,Se=0,xe=0;xe<Lt.length;xe++){var Ee=Lt[xe];if(!Ee.complete){var Le=Ee.getBoundingClientRect();if(0<Le.bottom&&0<Le.right&&Le.top<we.innerHeight&&Le.left<we.innerWidth){if(Se+=DC(Ee),Se>vh){ht.length=ot;break}Ee=new Promise(BI.bind(Ee)),ht.push(Ee)}}}if(0<ht.length)return we=Promise.race([Promise.all(ht),new Promise(function(ut){return setTimeout(ut,500)})]).then(v,v),(Oe?Promise.allSettled([Oe.finished,we]):we).then(j,j);if(v(),Oe)return Oe.finished.then(j,j);j()},types:l});Ne.__reactViewTransition=ze;var $e=[];return ze.ready.then(function(){for(var we=Ne.documentElement.getAnimations({subtree:!0}),Oe=0;Oe<we.length;Oe++){var ot=we[Oe],ht=ot.effect,Lt=ht.pseudoElement;if(Lt!=null&&Lt.startsWith("::view-transition")){$e.push(ot),ot=ht.getKeyframes();for(var Se=Lt=void 0,xe=!0,Ee=0;Ee<ot.length;Ee++){var Le=ot[Ee],ut=Le.width;if(Lt===void 0)Lt=ut;else if(Lt!==ut){xe=!1;break}if(ut=Le.height,Se===void 0)Se=ut;else if(Se!==ut){xe=!1;break}delete Le.width,delete Le.height,Le.transform==="none"&&delete Le.transform}xe&&Lt!==void 0&&Se!==void 0&&(ht.setKeyframes(ot),xe=getComputedStyle(ht.target,ht.pseudoElement),xe.width!==Lt||xe.height!==Se)&&(xe=ot[0],xe.width=Lt,xe.height=Se,xe=ot[ot.length-1],xe.width=Lt,xe.height=Se,ht.setKeyframes(ot))}}I()},function(we){Ne.__reactViewTransition===ze&&(Ne.__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&&he(we)}finally{d(),v(),I()}}),ze.finished.finally(function(){for(var we=0;we<$e.length;we++)$e[we].cancel();Ne.__reactViewTransition===ze&&(Ne.__reactViewTransition=null),J()}),ze}catch{return d(),v(),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}:T({},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=[],v=0;v<l.length;v++){var j=l[v].effect;j!==null&&j.target===s&&j.pseudoElement===o&&d.push(l[v])}return d},Il.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function mC(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,v=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,J=o;l!=null&&typeof l!="boolean"&&l.once===!0&&(J=function(he){I.removeEventListener(s,o,l),typeof o=="function"?o.call(this,he):o.handleEvent(he)}),d!==null&&(v=I.removeEventListener.bind(I,s,o,l),d.addEventListener("abort",v,{once:!0}),v=d.removeEventListener.bind(d,"abort",v)),d=Zc(l),j.push({type:s,listener:o,optionsOrUseCapture:l,attachedListener:J,cleanup:v}),p(this._fragmentFiber.child,!1,UI,s,J,d)}this._eventListeners=j}};function UI(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 v=d[o];l=v.attachedListener;var j=v.cleanup;v=Zc(v.optionsOrUseCapture),p(this._fragmentFiber.child,!1,HI,s,l,v),d.splice(o,1),j!==null&&j()}};function HI(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 hC(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=hC(d);for(var v=0;v<s.length;v++){var j=s[v];if(j.type===o&&j.listener===l&&hC(j.optionsOrUseCapture)===d)return v}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 v=0;v<l.length;v++){var j=l[v];d.addEventListener(j.type,j.attachedListener,Zc(j.optionsOrUseCapture))}if(o.appendChild(d),s=d.dispatchEvent(s),l)for(v=0;v<l.length;v++)j=l[v],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),tP(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=Ed(s).activeElement,s!==null&&p(this._fragmentFiber.child,!1,FI,s,void 0,void 0))};function FI(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,GI,s,void 0,void 0)};function GI(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,qI,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 qI(s,o){return s.tag===6||(s=S(s),o.unobserve(s)),!1}var Ro=[],V0=!1;function YI(s,o,l){Ro.push({fragmentInstance:s,observer:o,instance:l}),V0||(V0=!0,nP(function(){V0=!1;var d=Ro;Ro=[];for(var v=0;v<d.length;v++){var j=d[v];j.observer.unobserve(j.instance)}}))}Ir.prototype.getClientRects=function(){var s=[];return p(this._fragmentFiber.child,!1,KI,s,void 0,void 0),s};function KI(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,y(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 v=d=l.compareDocumentPosition(s);return l===s?v=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(l=w(o)[1],l===null?v=Node.DOCUMENT_POSITION_PRECEDING:(s=S(l).compareDocumentPosition(s),v=s===0||s&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),v|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}o=S(l[0]),v=S(l[l.length-1]);var j=y(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(v)&Node.DOCUMENT_POSITION_CONTAINED_BY;var I=o.compareDocumentPosition(s),J=v.compareDocumentPosition(s),he=I&Node.DOCUMENT_POSITION_CONTAINED_BY||J&Node.DOCUMENT_POSITION_CONTAINED_BY;return J=d&&j&&I&Node.DOCUMENT_POSITION_FOLLOWING&&J&Node.DOCUMENT_POSITION_PRECEDING,o=d&&o===s||j&&v===s||he||J?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&o===s||!j&&v===s?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:I,o&Node.DOCUMENT_POSITION_DISCONNECTED||o&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||XI(o,this._fragmentFiber,l[0],l[l.length-1],s)?o:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function XI(s,o,l,d,v){var j=So(v);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=v.ownerDocument,v===j||v===j.documentElement||v===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=R(l,j,O),o===null?o=!1:(p(o,!0,k,j,l),j=N,N=null,o=j!==null)),o):s&Node.DOCUMENT_POSITION_FOLLOWING?((o=!!j)&&!(o=j===d)&&(o=R(d,j,O),o===null?o=!1:(p(o,!0,A,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 v=o[d];v.tag===6?(v=S(v),xC(v,l)):S(v).scrollIntoView(s),d+=l?-1:1}};function WI(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 yC(s,o){var l=o._eventListeners;if(l!==null)for(var d=0;d<l.length;d++){var v=l[d];s.addEventListener(v.type,v.attachedListener,Zc(v.optionsOrUseCapture))}s.nodeType!==3&&(l=o._observers,l!==null&&l.forEach(function(j){for(var I=0,J=0;J<Ro.length;J++){var he=Ro[J];(he.fragmentInstance!==o||he.observer!==j||he.instance!==s)&&(Ro[I++]=he)}Ro.length=I,j.observe(s)}),bC(s,o))}function QI(s,o){var l=o._eventListeners;if(l!==null)for(var d=0;d<l.length;d++){var v=l[d];s.removeEventListener(v.type,v.attachedListener,Zc(v.optionsOrUseCapture))}s.nodeType!==3&&(l=o._observers,l!==null&&l.forEach(function(j){typeof j.rootMargin=="string"?YI(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),yc(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function ZI(s,o,l,d){for(;s.nodeType===1;){var v=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!==v.rel||s.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||s.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||s.getAttribute("title")!==(v.title==null?null:v.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(j=s.getAttribute("src"),(j!==(v.src==null?null:v.src)||s.getAttribute("type")!==(v.type==null?null:v.type)||s.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&j&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(o==="input"&&s.type==="hidden"){var j=v.name==null?null:""+v.name;if(v.type==="hidden"&&s.getAttribute("name")===j)return s}else return s;if(s=oo(s.nextSibling),s===null)break}return null}function JI(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 vC(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 eP(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 tP(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 nP(s){lC(function(){lC(function(o){return s(o)})})}function SC(s,o,l){switch(o=Ed(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 v=l[d];l.hasOwnProperty(d)&&v!=null&&vn(s,o,d,null,OI,v)}l.dangerouslySetInnerHTML!=null&&(s.textContent=""),s.onclick===er&&(s.onclick=null),yc(s)}function q0(s){for(var o=s.attributes;o.length;)s.removeAttributeNode(o[0]);yc(s)}var ao=new Map,CC=new Set;function Rd(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=le.d;le.d={f:sP,r:rP,D:oP,C:aP,L:iP,m:lP,X:uP,S:cP,M:dP};function sP(){var s=Ia.f(),o=dh();return s||o}function rP(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 v=_n(o);v='link[rel="'+s+'"][href="'+v+'"]',typeof l=="string"&&(v+='[crossorigin="'+l+'"]'),CC.has(v)||(CC.add(v),s={rel:s,crossOrigin:l,href:o},d.querySelector(v)===null&&(o=d.createElement("link"),$s(o,"link",s),qe(o),d.head.appendChild(o)))}}function oP(s){Ia.D(s),kC("dns-prefetch",s,null)}function aP(s,o){Ia.C(s,o),kC("preconnect",s,o)}function iP(s,o,l){Ia.L(s,o,l);var d=Jc;if(d&&s&&o){var v='link[rel="preload"][as="'+_n(o)+'"]';o==="image"&&l&&l.imageSrcSet?(v+='[imagesrcset="'+_n(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(v+='[imagesizes="'+_n(l.imageSizes)+'"]')):v+='[href="'+_n(s)+'"]';var j=v;switch(o){case"style":j=eu(s);break;case"script":j=tu(s)}if(!(ao.has(j)||(s=T({rel:"preload",href:o==="image"&&l&&l.imageSrcSet?void 0:s,as:o},l),ao.set(j,s),d.querySelector(v)!==null||o==="style"&&d.querySelector(Ad(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 lP(s,o){Ia.m(s,o);var l=Jc;if(l&&s){var d=o&&typeof o.as=="string"?o.as:"script",v='link[rel="modulepreload"][as="'+_n(d)+'"][href="'+_n(s)+'"]',j=v;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=tu(s)}if(!ao.has(j)&&(s=T({rel:"modulepreload",href:s},o),ao.set(j,s),l.querySelector(v)===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 cP(s,o,l){Ia.S(s,o,l);var d=Jc;if(d&&s){var v=Ge(d).hoistableStyles,j=eu(s);o=o||"default";var I=v.get(j);if(!I){var J={loading:0,preload:null};if(I=d.querySelector(Ad(j)))J.loading=5;else{s=T({rel:"stylesheet",href:s,"data-precedence":o},l),(l=ao.get(j))&&Y0(s,l);var he=I=d.createElement("link");qe(he),$s(he,"link",s),he._p=new Promise(function(Ne,ze){he.onload=Ne,he.onerror=ze}),he.addEventListener("load",function(){J.loading|=1}),he.addEventListener("error",function(){J.loading|=2}),J.loading|=4,bh(I,o,d)}I={type:"stylesheet",instance:I,count:1,state:J},v.set(j,I)}}}function uP(s,o){Ia.X(s,o);var l=Jc;if(l&&s){var d=Ge(l).hoistableScripts,v=tu(s),j=d.get(v);j||(j=l.querySelector(Od(v)),j||(s=T({src:s,async:!0},o),(o=ao.get(v))&&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(v,j))}}function dP(s,o){Ia.M(s,o);var l=Jc;if(l&&s){var d=Ge(l).hoistableScripts,v=tu(s),j=d.get(v);j||(j=l.querySelector(Od(v)),j||(s=T({src:s,async:!0,type:"module"},o),(o=ao.get(v))&&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(v,j))}}function TC(s,o,l,d){var v=(v=de.current)?Rd(v):null;if(!v)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(v).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(v).hoistableStyles,I=j.get(s);if(I||(v=v.ownerDocument||v,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(s,I),(j=v.querySelector(Ad(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)),fP(v,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(v).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 Ad(s){return'link[rel="stylesheet"]['+s+"]"}function EC(s){return T({},s,{"data-precedence":s.precedence,precedence:null})}function fP(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 v=T({},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",v),bh(d,l.precedence,s),o.instance=d;case"stylesheet":v=eu(l.href);var j=s.querySelector(Ad(v));if(j)return o.state.loading|=4,o.instance=j,qe(j),j;d=EC(l),(v=ao.get(v))&&Y0(d,v),j=(s.ownerDocument||s).createElement("link"),qe(j);var I=j;return I._p=new Promise(function(J,he){I.onload=J,I.onerror=he}),$s(j,"link",d),o.state.loading|=4,bh(j,l.precedence,s),o.instance=j;case"script":return j=tu(l.src),(v=s.querySelector(Od(j)))?(o.instance=v,qe(v),v):(d=l,(v=ao.get(j))&&(d=T({},l),K0(d,v)),s=s.ownerDocument||s,v=s.createElement("script"),qe(v),$s(v,"link",d),s.head.appendChild(v),o.instance=v);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,bh(d,l.precedence,s));return o.instance}function bh(s,o,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=d.length?d[d.length-1]:null,j=v,I=0;I<d.length;I++){var J=d[I];if(J.dataset.precedence===o)j=J;else if(j!==v)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 yh=null;function AC(s,o,l){if(yh===null){var d=new Map,v=yh=new Map;v.set(l,d)}else v=yh,d=v.get(l),d||(d=new Map,v.set(l,d));if(d.has(s))return d;for(d.set(s,null),l=l.getElementsByTagName(s),v=0;v<l.length;v++){var j=l[v];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 J=d.get(I);J?J.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 mP(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 OC(s,o){return s==="img"&&o.src!=null&&o.src!==""&&o.onLoad==null&&o.loading!=="lazy"}function MC(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=gP.bind(s),o.decode().then(s,s))}function hP(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 v=eu(d.href),j=o.querySelector(Ad(v));if(j){o=j._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(s.count++,s=Md.bind(s),o.then(s,s)),l.state.loading|=4,l.instance=j,qe(j);return}j=o.ownerDocument||o,d=EC(d),(v=ao.get(v))&&Y0(d,v),j=j.createElement("link"),qe(j);var I=j;I._p=new Promise(function(J,he){I.onload=J,I.onerror=he}),$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=Md.bind(s),o.addEventListener("load",l),o.addEventListener("error",l))}}var vh=0;function pP(s,o){return s.stylesheets&&s.count===0&&jh(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var d=setTimeout(function(){if(s.stylesheets&&jh(s,s.stylesheets),s.unsuspend){var j=s.unsuspend;s.unsuspend=null,j()}},6e4+o);0<s.imgBytes&&vh===0&&(vh=62500*DI());var v=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&jh(s,s.stylesheets),s.unsuspend)){var j=s.unsuspend;s.unsuspend=null,j()}},(s.imgBytes>vh?50:800)+o);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(v)}}:null}function IC(s){if(s.count===0&&(s.imgCount===0||!s.waitingForImages)){if(s.stylesheets)jh(s,s.stylesheets);else if(s.unsuspend){var o=s.unsuspend;s.unsuspend=null,o()}}}function Md(){this.count--,IC(this)}function gP(){this.imgCount--,IC(this)}var wh=null;function jh(s,o){s.stylesheets=null,s.unsuspend!==null&&(s.count++,wh=new Map,o.forEach(xP,s),wh=null,Md.call(s))}function xP(s,o){if(!(o.state.loading&4)){var l=wh.get(s);if(l)var d=l.get(null);else{l=new Map,wh.set(s,l);for(var v=s.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<v.length;j++){var I=v[j];(I.nodeName==="LINK"||I.getAttribute("media")!=="not all")&&(l.set(I.dataset.precedence,I),d=I)}d&&l.set(null,d)}v=o.instance,I=v.getAttribute("data-precedence"),j=l.get(I)||d,j===d&&l.set(null,v),l.set(I,v),this.count++,d=Md.bind(this),v.addEventListener("load",d),v.addEventListener("error",d),j?j.parentNode.insertBefore(v,j.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(v,s.firstChild)),o.state.loading|=4}}var nu={$$typeof:V,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function bP(s,o,l,d,v,j,I,J,he){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=v,this.onCaughtError=j,this.onRecoverableError=I,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=he,this.transitionTypes=null,this.incompleteTransitions=new Map}function PC(s,o,l,d,v,j,I,J,he,Ne,ze,$e){return s=new bP(s,o,l,I,he,Ne,ze,$e,J),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},hb(j),s}function _C(s){return s?(s=Ec,s):Ec}function LC(s,o,l,d,v,j){v=_C(v),d.context===null?d.context=v:d.pendingContext=v,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),cd(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 yP(s,o,l,d){var v=ae.T;ae.T=null;var j=le.p;try{le.p=2,Q0(s,o,l,d)}finally{le.p=j,ae.T=v}}function vP(s,o,l,d){var v=ae.T;ae.T=null;var j=le.p;try{le.p=8,Q0(s,o,l,d)}finally{le.p=j,ae.T=v}}function Q0(s,o,l,d){if(su){var v=Z0(d);if(v===null)M0(s,o,d,Sh,l),HC(s,d);else if(jP(v,s,o,l,d))d.stopPropagation();else if(HC(s,d),o&4&&-1<wP.indexOf(s)){for(;v!==null;){var j=ul(v);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 J=j;for(J.pendingLanes|=2,J.entangledLanes|=2;I;){var he=1<<31-it(I);J.entanglements[1]|=he,I&=~he}Wo(j),(dn&6)===0&&(lh=be()+500,Cd(0))}}break;case 31:case 13:J=bl(j,2),J!==null&&pr(J,j,2),dh(),W0(j,2)}if(j=Z0(d),j===null&&M0(s,o,d,Sh,l),j===v)break;v=j}v!==null&&d.stopPropagation()}else M0(s,o,d,null,l)}}function Z0(s){return s=ml(s),J0(s)}var Sh=null;function J0(s){if(Sh=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 Sh=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 ey=!1,Ai=null,Oi=null,Mi=null,Dd=new Map,zd=new Map,Di=[],wP="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":Oi=null;break;case"mouseover":case"mouseout":Mi=null;break;case"pointerover":case"pointerout":Dd.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":zd.delete(o.pointerId)}}function Id(s,o,l,d,v,j){return s===null||s.nativeEvent!==j?(s={blockedOn:o,domEventName:l,eventSystemFlags:d,nativeEvent:j,targetContainers:[v]},o!==null&&(o=ul(o),o!==null&&BC(o)),s):(s.eventSystemFlags|=d,o=s.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),s)}function jP(s,o,l,d,v){switch(o){case"focusin":return Ai=Id(Ai,s,o,l,d,v),!0;case"dragenter":return Oi=Id(Oi,s,o,l,d,v),!0;case"mouseover":return Mi=Id(Mi,s,o,l,d,v),!0;case"pointerover":var j=v.pointerId;return Dd.set(j,Id(Dd.get(j)||null,s,o,l,d,v)),!0;case"gotpointercapture":return j=v.pointerId,zd.set(j,Id(zd.get(j)||null,s,o,l,d,v)),!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,Os(s.priority,function(){VC(l)});return}}else if(o===31){if(o=f(l),o!==null){s.blockedOn=o,Os(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 Nh(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){Nh(s)&&l.delete(o)}function SP(){ey=!1,Ai!==null&&Nh(Ai)&&(Ai=null),Oi!==null&&Nh(Oi)&&(Oi=null),Mi!==null&&Nh(Mi)&&(Mi=null),Dd.forEach(GC),zd.forEach(GC)}function Ch(s,o){s.blockedOn===o&&(s.blockedOn=null,ey||(ey=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,SP)))}var kh=null;function qC(s){kh!==s&&(kh=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){kh===s&&(kh=null);for(var o=0;o<s.length;o+=3){var l=s[o],d=s[o+1],v=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:v,method:l.method,action:d},d,v))}}))}function ru(s){function o(he){return Ch(he,s)}Ai!==null&&Ch(Ai,s),Oi!==null&&Ch(Oi,s),Mi!==null&&Ch(Mi,s),Dd.forEach(o),zd.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 v=l[d],j=l[d+1],I=v[Ms]||null;if(typeof j=="function")I||qC(l);else if(I){var J=null;if(j&&j.hasAttribute("formAction")){if(v=j,I=j[Ms]||null)J=I.formAction;else if(J0(v)!==null)continue}else J=I.action;typeof J=="function"?l[d+1]=J:(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 v=I})},focusReset:"manual",scroll:"manual"})}function o(){v!==null&&(v(),v=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,v=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),v!==null&&(v(),v=null)}}}function ty(s){this._internalRoot=s}Th.prototype.render=ty.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)},Th.prototype.unmount=ty.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),dh(),o[Nr]=null}};function Th(s){this._internalRoot=s}Th.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"));le.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 NP={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:ae,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Eh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Eh.isDisabled&&Eh.supportsFiber)try{je=Eh.inject(NP),Ye=Eh}catch{}}return _d.createRoot=function(s,o){if(!i(s))throw Error(a(299));var l=!1,d="",v=_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&&(v=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,v,j,I,YC),s[Nr]=o.current,O0(s),new ty(o)},_d.hydrateRoot=function(s,o,l){if(!i(s))throw Error(a(299));var d=!1,v="",j=_S,I=LS,J=$S,he=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(v=l.identifierPrefix),l.onUncaughtError!==void 0&&(j=l.onUncaughtError),l.onCaughtError!==void 0&&(I=l.onCaughtError),l.onRecoverableError!==void 0&&(J=l.onRecoverableError),l.formState!==void 0&&(he=l.formState)),o=PC(s,1,!0,o,l??null,d,v,he,j,I,J,YC),o.context=_C(null),l=o.current,d=zr(),d=cr(d),v=xi(d),v.callback=null,bi(l,v,d),l=d,o.current.lanes=l,un(o,l),Wo(o),s[Nr]=o.current,O0(s),new Th(o)},_d.version="19.3.0",_d}var ok;function qP(){if(ok)return oy.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(),oy.exports=GP(),oy.exports}var YP=qP();const KP="modulepreload",XP=function(e){return"/"+e},ak={},gv=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=XP(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":KP,g||(b.as="script"),b.crossOrigin="",b.href=h,m&&b.setAttribute("nonce",m),document.head.appendChild(b),g)return new Promise((y,w)=>{b.addEventListener("load",y),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)})},WP="openrod.compute-target";function QP(e,t){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");return`${e==="cloud"?"/api/remote/os":"/api/os"}${t}`}let FA="local";const GA=()=>FA;function qA(e){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");FA=e}function ZP(e,t){const r=t??null;return{uid:r,revision:e.revision+(e.uid&&e.uid!==r?1:0)}}let YA=null;const KA=()=>YA;function ik(e){YA=typeof e=="string"&&/^[a-f0-9]{16}$/.test(e)?e:null}var lk={projectToken:"phc_t8z9eNB6eJABMR9iLkDbqAZH5wFh7wmjjDqEpAxnPPAU",host:"https://us.i.posthog.com",version:"0.1.3",environment:"production",enabled:!0};const JP=/^[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",Ld="openrod.usage-id.v1",cy="openrod.usage-session.v1",Rh="openrod.terminal-flows.v1",Ks=(...e)=>t=>e.includes(t)?t:void 0,cu=e=>typeof e=="string"&&JP.test(e)?e:void 0,Ui=e=>Number.isFinite(e)&&e>=0?Math.min(Math.round(e),864e5):void 0,uy=e=>typeof e=="boolean"?e:void 0,L1=Ks("sandboxes","activity","groups","egress","ingress","secrets","templates","setups","connections","terminal"),xv=Ks("gateway_connection","sandbox_creation","session_launch"),bv=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"),dy={flow:xv,flow_id:cu,attempt:Ui,location_type:bv,launch_target:Ks("browser","terminal","vscode","cursor")},e_=e=>typeof e=="string"?e.trim().slice(0,2e3):void 0,t_=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:t_,setup_count:Ui,provider_count:Ui,group_count:Ui},fk={console_opened:{gateway_state:Ks("available","setup_required","unavailable"),first_observed_visit:uy,connection_method:Ks("automatic","manual","existing","unknown")},view_opened:{previous_view:L1},flow_started:{...dy,...dk},flow_step_changed:{...dy,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:{...dy,...dk,outcome:Ks("connected","created","live","handoff_requested","failed","cancelled"),duration_ms:Ui,start_observed:uy,error_category:uk},sandbox_ready:{flow_id:cu,duration_ms:Ui,location_type:bv},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:bv},feedback_submitted:{prompt:Ks("general"),category:Ks("general"),text:e_,feedback_only:uy}};function Ah(e,t={}){if(!Object.hasOwn(fk,e))return null;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 n_=[[/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 n_)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 s_({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,y,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,k=new Map,A=new Set,O=new Map,R=new Map;let T=[],M=0;const D=()=>e(),_=(Z,pe)=>{try{return Z()}catch{return pe}};function H(){M++;for(const[Z,pe]of k)Z.abort(),u(pe);k.clear(),A.clear(),O.clear(),R.clear(),T=[],w=!1,y=void 0,C=void 0}function G(){const Z=new URL(t());return!Z.searchParams.has("token")&&!Z.searchParams.has("handoff")&&!/^#local-(connect|return)=/.test(Z.hash)&&!(m.environment==="development"&&Z.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 Z=null;try{const ue=D().getItem(ck);Z=ue==="yes"?!0:ue==="no"?!1:null}catch{p=!0,H()}Z!==!0&&N.sharing===!0&&H();const pe={available:B(),sharing:Z,destination:S};if(Object.keys(pe).some(ue=>pe[ue]!==N[ue])){N=Object.freeze(pe);for(const ue of E)_(ue)}})}function V({enabled:Z=!1,mode:pe="local"}={}){_(()=>{h=pe==="local",g=Z,(!h||!Z)&&H(),P()})}function Y(Z){_(()=>{try{if(D().setItem(ck,Z?"yes":"no"),!Z){for(const pe of[Ld,cy,Rh])D().removeItem(pe);H()}}catch{p=!0,H()}P()})}function W(){const Z=D();let pe=cu(Z.getItem(Ld)),ue;C??(C=!pe),pe||(pe=r(),Z.setItem(Ld,pe));try{ue=JSON.parse(Z.getItem(cy))}catch{}return(!cu(ue==null?void 0:ue.id)||!Number.isFinite(ue==null?void 0:ue.at)||a()-ue.at>18e5)&&(ue={id:r()}),Z.setItem(cy,JSON.stringify({id:ue.id,at:a()})),{id:pe,session:ue.id,first:C}}function q(Z,pe={},{explicitFeedback:ue=!1}={}){return _(()=>{if(P(),!N.available||N.sharing!==!0&&!(ue&&Z==="feedback_submitted"))return!1;const ye=Ah(Z,pe);if(!ye)return!1;const Ce=N.sharing===!0;let Ie;try{Ie=Ce?W():{id:r()}}catch{return p=!0,H(),P(),!1}if(T=T.filter(Re=>a()-Re<6e4),k.size>=6||T.length>=120)return!1;const de=new AbortController,Te=c(()=>{de.abort(),k.delete(de)},3e3);k.set(de,Te),T.push(a());const oe={api_key:m.projectToken,event:Z,distinct_id:Ie.id,timestamp:new Date(a()).toISOString(),properties:{schema_version:1,app_version:m.version,environment:m.environment,...Ce&&Ie.session?{$session_id:Ie.session}:{},...Ce&&b?{view:b}:{},...ye,$process_person_profile:!1,...Ce?{}:{$geoip_disable:!0},...Z==="console_opened"?{first_observed_visit:Ie.first}:{},...ue?{feedback_only:!Ce}:{}}},fe=()=>{u(Te),k.delete(de)};Z==="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:de.signal,credentials:"omit",referrerPolicy:"no-referrer",cache:"no-store",redirect:"error",keepalive:!0})).then(fe,fe)}catch{fe()}return!0},!1)}function ee(Z){_(()=>{w||!["live","setup-required","gateway-down"].includes(Z)||q("console_opened",{gateway_state:Z==="live"?"available":Z==="setup-required"?"setup_required":"unavailable",connection_method:"existing"})&&(w=!0)})}function z(Z){_(()=>{b=L1(Z),b&&b!==y&&q("view_opened",{previous_view:y})&&(y=b)})}function L(Z,pe={},ue=null){return _(()=>{if(P(),!N.available||N.sharing!==!0||!xv(Z))return null;const ye=W().id;((ue==null?void 0:ue.generation)!==M||(ue==null?void 0:ue.installationId)!==ye||(ue==null?void 0:ue.flow)!==Z)&&(ue=null),ue&&ue.outcome!=="failed"&&ue.started!==null&&(ue.outcome||F(ue,"cancelled"),ue=null);const Ce={generation:M,installationId:ye,id:(ue==null?void 0:ue.id)??r(),flow:Z,attempt:((ue==null?void 0:ue.attempt)??0)+1,started:a(),properties:Ah("flow_started",pe)};return q("flow_started",{...Ce.properties,flow:Z,flow_id:Ce.id,attempt:Ce.attempt}),U(Ce,Z==="session_launch"?"requesting":Z==="gateway_connection"?"connecting":"preparing_tools"),Ce},null)}function X(Z,pe={}){return _(()=>(P(),!N.available||N.sharing!==!0||!xv(Z)?null:{generation:M,installationId:W().id,id:r(),flow:Z,attempt:0,started:null,properties:Ah("flow_started",pe)}),null)}const te=Z=>Z&&Z.generation===M&&N.available&&N.sharing===!0&&cu(Z.installationId)&&Z.installationId===D().getItem(Ld),$=Z=>({...Z.properties,flow:Z.flow,flow_id:Z.id,attempt:Z.attempt});function U(Z,pe,ue="entered",ye){_(()=>{if(P(),!te(Z))return;const Ce=`${Z.id}:${Z.attempt}`,Ie=`${pe}:${ue}:${ye}`;O.get(Ce)!==Ie&&(O.size>=100&&O.delete(O.keys().next().value),O.set(Ce,Ie),q("flow_step_changed",{...$(Z),step:pe,state:ue,error_category:ye}))})}function F(Z,pe,ue){_(()=>{if(P(),!te(Z))return;const ye=`${Z.id}:${Z.attempt}`;A.has(ye)||(A.size>=200&&A.delete(A.values().next().value),A.add(ye),O.delete(ye),Z.outcome=pe,q("flow_finished",{...$(Z),outcome:pe,start_observed:Z.started!==null,duration_ms:Z.started===null?void 0:a()-Z.started,error_category:ue}))})}function K(Z){_(()=>{if(P(),!te(Z))return;const pe=`${Z.id}:ready`;A.has(pe)||(A.size>=200&&A.delete(A.values().next().value),A.add(pe),q("sandbox_ready",{flow_id:Z.id,duration_ms:a()-Z.started,location_type:Z.properties.location_type}))})}function se(Z){return q("feedback_submitted",Z,{explicitFeedback:!0})}function ne(Z,pe={}){_(()=>{const ue=L("session_launch",{...pe,launch_target:"browser"});if(P(),!te(ue))return;const ye=new URL(Z.currentTarget.href),[Ce,Ie=""]=ye.hash.split("?"),de=new URLSearchParams(Ie);de.set("analyticsFlow",ue.id),ye.hash=`${Ce}?${de}`;try{const Te=ae();Te.push(ue),D().setItem(Rh,JSON.stringify(Te.slice(-20))),Z.currentTarget.href=ye.href}catch{}})}function ve(Z,pe){try{D().setItem(Rh,JSON.stringify(Z.filter(ue=>ue.id!==pe)))}catch{}_(()=>{const ue=new URL(t()),[ye,Ce=""]=ue.hash.split("?"),Ie=new URLSearchParams(Ce);Ie.delete("analyticsFlow"),ue.hash=Ie.toString()?`${ye}?${Ie}`:ye,f(ue.href)})}function ae(){let Z=[];try{Z=JSON.parse(D().getItem(Rh)||"[]")}catch{}return Array.isArray(Z)?Z.filter(pe=>cu(pe.id)&&pe.flow==="session_launch"&&Number.isFinite(pe.started)&&a()-pe.started<18e5).slice(-20):[]}function le(Z,pe){return _(()=>{if(P(),!N.available||N.sharing!==!0)return null;if(pe)return L("session_launch",Z,pe);const ue=new URLSearchParams(new URL(t()).hash.split("?")[1]).get("analyticsFlow"),ye=W().id,Ce=ae(),Ie=Ce.find(de=>de.id===ue&&de.installationId===ye);return ue&&ve(Ce,ue),Ie?{generation:M,installationId:ye,id:Ie.id,flow:"session_launch",attempt:Ui(Ie.attempt)??1,started:Ie.started,properties:Ah("flow_started",Ie.properties)}:L("session_launch",{...Z,launch_target:"browser"})},null)}function re(Z,pe){_(()=>{if(P(),!(!N.available||N.sharing!==!0)){if(Z.status==="ready"){q("feature_used",{feature:"template",action:"built",location_type:mf(pe)});return}Z.status==="building"&&(R.size>=100&&R.delete(R.keys().next().value),R.set(JSON.stringify([pe==null?void 0:pe.context,Z.name]),{installationId:W().id,startedAt:Z.startedAt,at:a(),location_type:mf(pe)}))}})}function Q(Z){_(()=>{var pe,ue;for(const ye of Z){const Ce=JSON.stringify([(pe=ye.location)==null?void 0:pe.context,ye.name]),Ie=R.get(Ce);if(Ie){if(Ie.installationId!==D().getItem(Ld)||a()-Ie.at>18e5){R.delete(Ce);continue}ye.startedAt&&ye.startedAt!==Ie.startedAt||((ue=ye.location)==null?void 0:ue.connected)===!1||(ye.status==="ready"?(R.delete(Ce),q("feature_used",{feature:"template",action:"built",location_type:Ie.location_type})):ye.status==="failed"&&R.delete(Ce))}}})}return{configure:V,setSharing:Y,refresh:P,capture:q,observeConsole:ee,observeView:z,startFlow:L,exploreFlow:X,step:U,finishFlow:F,ready:K,templateStarted:re,observeTemplates:Q,submitFeedback:se,terminalClick:ne,terminalFlow:le,subscribe:Z=>(E.add(Z),()=>E.delete(Z)),getSnapshot:()=>N,stop:()=>{h=!1,H(),P()}}}const ln=s_(),mf=e=>(e==null?void 0:e.target)==="cloud"?"cloud":e!=null&&e.remote?"ssh":"local";function r_(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&&ln.capture("feature_used",{feature:a[1],action:a[2]})}const $i="CONSOLE_TOKEN_REQUIRED";function lr(e,t,r=null,a=KA()){const i=()=>e??GA(),c=a;let u,f;const m=y=>QP(i(),y),h=y=>t&&y?AbortSignal.any([t,y]):t??y;async function g(){t==null||t.throwIfAborted();const y=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 y.json();if(t==null||t.throwIfAborted(),w.code===$i?window.dispatchEvent(new Event($i)):(y.status===401||w.code==="CLOUD_OWNER_CHANGED")&&window.dispatchEvent(new Event("openrod-session-expired")),!y.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(y,{method:w="GET",body:C,signal:S,scoped:N=!0,raw:E=!1}={}){const k=h(S);k==null||k.throwIfAborted();const A=N?await p():null;k==null||k.throwIfAborted();const O=await fetch(m(y),{method:w,signal:k,headers:{...i()==="cloud"&&c?{"x-openrod-local-owner":c}:{},...A?{"x-openshell-context":A}:{},...A&&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)}),R=await O.json().catch(()=>({}));if(k==null||k.throwIfAborted(),R.code===$i?window.dispatchEvent(new Event($i)):(O.status===401||R.code==="CLOUD_OWNER_CHANGED")&&window.dispatchEvent(new Event("openrod-session-expired")),!O.ok)throw Object.assign(new Error(R.error??`Request failed (${O.status})`),{status:O.status,code:R.code,sandboxes:R.sandboxes,fix:R.fix});return r_(y,w),R}return{target:e,signal:t,path:m,owner:c,url:(y,w={})=>{const C=new URLSearchParams({...w,...i()==="cloud"&&c?{owner:c}:{}});return m(y)+(C.size?"?"+C:"")},forContext:y=>lr(e,t,y,c),inventory:y=>b("/inventory",{signal:y,scoped:!1}),context:g,contextKey:p,capabilities:()=>b("/capabilities",{scoped:!1}),importCapabilities:()=>b("/resource-imports/capabilities"),exportResources:y=>b("/resource-imports/export",{method:"POST",body:y}),planImport:y=>b("/resource-imports/plan",{method:"POST",body:y}),importJobs:()=>b("/resource-imports"),importJob:y=>b(`/resource-imports/${encodeURIComponent(y)}`),executeImport:y=>b(`/resource-imports/${encodeURIComponent(y)}/execute`,{method:"POST",body:{acknowledged:!0}}),retryImport:y=>b(`/resource-imports/${encodeURIComponent(y)}/retry`,{method:"POST",body:{acknowledged:!0}}),cancelImport:y=>b(`/resource-imports/${encodeURIComponent(y)}/cancel`,{method:"POST",body:{}}),connections:y=>b("/connections",{signal:y,scoped:!1}),connectionJob:(y,w)=>b(`/connections/jobs/${encodeURIComponent(y)}`,{signal:w,scoped:!1}),connect:y=>b("/connections/connect",{method:"POST",body:y,scoped:!1}),installConnectionDocker:y=>b(`/connections/jobs/${encodeURIComponent(y)}/docker`,{method:"POST",body:{approve:!0},scoped:!1}),installConnectionRuntime:y=>b(`/connections/jobs/${encodeURIComponent(y)}/install`,{method:"POST",body:{method:"download"},scoped:!1}),uploadConnectionPackage:(y,w)=>b(`/connections/jobs/${encodeURIComponent(y)}/package`,{method:"POST",body:w,raw:!0,scoped:!1}),scanSshHost:y=>b("/connections/hosts/scan",{method:"POST",body:y,scoped:!1}),addSshHost:y=>b("/connections/hosts",{method:"POST",body:{token:y},scoped:!1}),removeSshHost:y=>b("/connections/hosts/remove",{method:"POST",body:{alias:y},scoped:!1}),restoreSshHost:y=>b("/connections/hosts/restore",{method:"POST",body:{host:y},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:(y=!1)=>b(`/gateway-docker${y?"?fresh=1":""}`,{scoped:!1}),connectGatewayDocker:(y=[],w=!0)=>b("/gateway-docker/connect",{method:"POST",body:{confirm:w,seen:y},scoped:!1}),undoGatewayDocker:(y=[])=>b("/gateway-docker/undo",{method:"POST",body:{confirm:!0,seen:y},scoped:!1}),setups:()=>b("/setups"),discoverSetups:y=>b("/setups/scan",{method:"POST",body:{sources:y}}),reviewSetup:(y,w)=>b("/setups/review",{method:"POST",body:{token:y,ids:w}}),removeSetupReviewItem:(y,w)=>b("/setups/remove-review-item",{method:"POST",body:{token:y,item:w}}),prepareSetup:(y,w)=>b("/setups/prepare",{method:"POST",body:{token:y,items:w,approved:!0}}),prepareLaunchSetup:(y,w)=>b(`/setups/${y}/prepare-launch`,{method:"POST",body:{revision:w}}),prepareSavedSetup:y=>b(`/setups/${y}/prepare`,{method:"POST",body:{}}),setupPreparation:y=>b(`/setups/preparations/${y}`),cancelSetupPreparation:y=>b(`/setups/preparations/${y}/cancel`,{method:"POST",body:{}}),setupFile:(y,w,C)=>b("/setups/file",{method:"POST",body:{token:y,item:w,path:C}}),saveSetup:(y,w,C)=>b("/setups/save",{method:"POST",body:{token:y,name:w,acknowledged:C}}),deleteSetup:(y,w)=>b(`/setups/${y}/delete`,{method:"POST",body:{revision:w}}),deleteSetupItem:(y,w,C)=>b(`/setups/${y}/delete-item`,{method:"POST",body:{item:w,revision:C}}),previewSetup:(y,w,C)=>b(`/setups/${y}/preview`,{method:"POST",body:{sandbox:w,targets:C}}),enableSetup:(y,w,C,S=!1)=>b(`/setups/${y}/enable`,{method:"POST",body:{sandbox:w,token:C,approveAccess:S}}),removeSetup:(y,w,C)=>b(`/setups/${y}/remove`,{method:"POST",body:{sandbox:w,token:C}}),setupJobs:y=>b(`/setups/${y}/jobs`),cloudExport:y=>b(`/cloud-export?name=${encodeURIComponent(y)}`),importCloud:y=>b("/cloud-import",{method:"POST",body:y}),cloudTransfer:(y,w)=>b("/cloud-transfer",{method:"POST",body:{name:y,ticket:w}}),selectContext:y=>b("/context",{method:"POST",body:y}),previewActivityDeletion:y=>b("/activity/delete-preview",{method:"POST",body:y}),deleteActivity:y=>b("/activity/delete",{method:"POST",body:{token:y}}),activityDestinations:()=>b("/activity-destinations"),createActivityDestination:y=>b("/activity-destinations",{method:"POST",body:y}),activityDestinationAction:(y,w)=>b(`/activity-destinations/${encodeURIComponent(y)}/${w}`,{method:"POST",body:{}}),overview:()=>b("/overview"),sandbox:y=>b(`/sandboxes/${encodeURIComponent(y)}`),activity:(y={})=>b(`/activity?query=${encodeURIComponent(JSON.stringify(y))}`),create:y=>b("/sandboxes",{method:"POST",body:y}),sshConnection:y=>b(`/sandboxes/${encodeURIComponent(y)}/ssh`),openSshTerminal:(y,w)=>b(`/sandboxes/${encodeURIComponent(y)}/ssh-open`,{method:"POST",body:{mode:w}}),sshConfig:y=>b(`/sandboxes/${encodeURIComponent(y)}/ssh-config`,{method:"POST",body:{}}),terminalSession:(y,w)=>b(`/sandboxes/${encodeURIComponent(y)}/terminal-session`,{method:"POST",body:w}),lifecycle:(y,w)=>b(`/sandboxes/${encodeURIComponent(y)}/${w}`,{method:"POST",body:{}}),editors:()=>b("/editors"),openEditor:(y,w)=>b(`/sandboxes/${encodeURIComponent(y)}/editor`,{method:"POST",body:{editor:w}}),fleetPolicy:()=>b("/policy/fleet"),policy:y=>b(`/policy/${encodeURIComponent(y)}`),revision:(y,w)=>b(`/policy/${encodeURIComponent(y)}/revisions/${w}`),applyOps:(y,w)=>b(`/policy/${encodeURIComponent(y)}/ops`,{method:"POST",body:{ops:w}}),restore:(y,w)=>b(`/policy/${encodeURIComponent(y)}/restore`,{method:"POST",body:{version:w}}),globalPolicy:()=>b("/policy/global"),removeGlobal:()=>b("/policy/global/remove",{method:"POST",body:{}}),settings:y=>b(`/settings${y?`/${encodeURIComponent(y)}`:""}`),setSetting:y=>b("/settings",{method:"POST",body:y}),secrets:()=>b("/secrets"),createSecret:y=>b("/secrets",{method:"POST",body:y}),rotateSecret:(y,w)=>b(`/secrets/${encodeURIComponent(y)}/rotate`,{method:"POST",body:{credentials:w}}),secretExpiry:(y,w,C)=>b(`/secrets/${encodeURIComponent(y)}/expiry`,{method:"POST",body:{key:w,expiresAt:C}}),deleteSecret:y=>b(`/secrets/${encodeURIComponent(y)}/delete`,{method:"POST",body:{}}),attachSecret:(y,w,C)=>b(`/secrets/${encodeURIComponent(y)}/${C?"attach":"detach"}`,{method:"POST",body:{sandbox:w}}),importProfile:y=>b("/profiles/import",{method:"POST",body:{id:y}}),deleteTemplates:y=>b("/templates/delete",{method:"POST",body:{ids:y}}),templates:()=>b("/templates"),imageTemplates:()=>b("/image-templates"),localImages:()=>b("/image-templates/local-images"),buildImageTemplate:(y,w=!1)=>b("/image-templates",{method:"POST",body:{recipe:y,replace:w}}),cancelImageBuild:y=>b(`/image-templates/${encodeURIComponent(y)}/cancel`,{method:"POST",body:{}}),dismissImageBuild:y=>b(`/image-templates/${encodeURIComponent(y)}/dismiss`,{method:"POST",body:{}}),imageTemplateUsage:y=>b(`/image-templates/${encodeURIComponent(y)}/usage`),deleteImageTemplate:y=>b(`/image-templates/${encodeURIComponent(y)}/delete`,{method:"POST",body:{}}),org:()=>b("/org"),saveOrg:y=>b("/org",{method:"POST",body:y}),saveGroup:y=>b("/org/groups",{method:"POST",body:y}),deleteGroup:y=>b(`/org/groups/${encodeURIComponent(y)}/delete`,{method:"POST",body:{}}),setGroupMembers:(y,w,C="replace")=>b("/org/members",{method:"POST",body:{sandboxes:y,groups:w,mode:C}}),savePolicy:y=>b("/egress/policies",{method:"POST",body:y}),deletePolicy:y=>b(`/egress/policies/${encodeURIComponent(y)}/delete`,{method:"POST",body:{}}),saveTemplate:y=>b("/templates",{method:"POST",body:y}),deleteTemplate:y=>b(`/templates/${encodeURIComponent(y)}/delete`,{method:"POST",body:{}}),localFolder:y=>b("/local-folder",{method:"POST",body:{path:y}}),files:(y,w)=>b(`/files/${encodeURIComponent(y)}?path=${encodeURIComponent(w)}`),seed:y=>b(`/files/${encodeURIComponent(y)}/seed`),retrySeed:y=>b(`/files/${encodeURIComponent(y)}/seed/retry`,{method:"POST",body:{}}),prepareDownload:(y,w)=>b(`/files/${encodeURIComponent(y)}/download`,{method:"POST",body:{path:w}}),startUpload:y=>b(`/files/${encodeURIComponent(y)}/uploads`,{method:"POST",body:{}}),uploadFile:(y,w,C,S,N)=>b(`/files/${encodeURIComponent(y)}/uploads/${w}?path=${encodeURIComponent(C)}`,{method:"POST",body:S,raw:!0,signal:N}),commitUpload:(y,w,C)=>b(`/files/${encodeURIComponent(y)}/uploads/${w}/commit`,{method:"POST",body:{dir:C}}),cancelUpload:(y,w)=>b(`/files/${encodeURIComponent(y)}/uploads/${w}/cancel`,{method:"POST",body:{}}),ingress:()=>b("/ingress"),exposeService:y=>b("/ingress/expose",{method:"POST",body:y}),closeService:y=>b("/ingress/close",{method:"POST",body:{sandbox:y.sandbox,name:y.name}}),extendService:(y,w)=>b("/ingress/extend",{method:"POST",body:{sandbox:y.sandbox,name:y.name,closeAfterMinutes:w}})}}const cs=lr(),mk="",Df=/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(mk)?mk:"",hk="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 En(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 En(e).Node:!1}function Ft(e){return Ag()?e instanceof Element||e instanceof En(e).Element:!1}function wn(e){return Ag()?e instanceof HTMLElement||e instanceof En(e).HTMLElement:!1}function ku(e){return!Ag()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof En(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 o_(e){return/^(table|td|th)$/.test(Us(e))}function Og(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const a_=/transform|translate|scale|rotate|perspective|filter/,i_=/paint|layout|strict|content/,Pl=e=>!!e&&e!=="none";let fy;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))||a_.test(t.willChange||"")||i_.test(t.contain||"")}function l_(e){let t=Ya(e);for(;wn(t)&&!Ua(t);){if(B1(t))return t;if(Og(t))return null;t=Ya(t)}return null}function V1(){return fy==null&&(fy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fy}function Ua(e){return/^(html|body|#document)$/.test(Us(e))}function Br(e){return En(e).getComputedStyle(e)}function Mg(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||ku(e)&&e.host||ei(e);return ku(t)?t.host:t}function XA(e){const t=Ya(e);return Ua(t)?(e.ownerDocument||e).body:wn(t)&&zf(t)?t:XA(t)}function hf(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=XA(e),c=i===((a=e.ownerDocument)==null?void 0:a.body),u=En(i);if(c){const f=yv(u);return t.concat(u,u.visualViewport||[],zf(i)?i:[],f&&r?hf(f):[])}else return t.concat(i,hf(i,[],r))}function yv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const U1={...MP},pk={};function bs(e,t){const r=x.useRef(pk);return r.current===pk&&(r.current=e(t)),r}const my=U1.useInsertionEffect,c_=my&&my!==U1.useLayoutEffect?my:e=>e();function st(e){const t=bs(u_).current;return t.next=e,c_(t.effect),t.trampoline}function u_(){const e={next:void 0,callback:d_,trampoline:(...t)=>{var r;return(r=e.callback)==null?void 0:r.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function d_(){}const f_=()=>{},We=typeof document<"u"?x.useLayoutEffect:f_;function vv(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=Yd(c,t)),r&&(c=Yd(c,r)),a&&(c=Yd(c,a)),i&&(c=Yd(c,i)),c}function m_(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=Yd(t,e[r]);return t}function Fp(e){return F1(e)?{...QA(e,H1)}:h_(e)}function Yd(e,t){return F1(t)?QA(t,e):p_(e,t)}function h_(e){const t={...e};for(const r in t){const a=t[r];WA(r,a)&&(t[r]=ZA(a))}return t}function p_(e,t){if(!t)return e;for(const r in t){const a=t[r];switch(r){case"style":{e[r]=vv(e.style,a);break}case"className":{e[r]=JA(e.className,a);break}default:WA(r,a)?e[r]=g_(e[r],a):e[r]=a}}return e}function WA(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 QA(e,t){return F1(e)?e(t):e??H1}function g_(e,t){return t?e?(...r)=>{const a=r[0];if(eO(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}:ZA(t):e}function ZA(e){return e&&((...t)=>{const r=t[0];return eO(r)&&Gp(r),e(...t)})}function Gp(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function JA(e,t){return t?e?t+" "+e:t:e}function eO(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function x_(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 sn=x_("https://base-ui.com/production-error","Base UI"),tO=x.createContext(void 0);function Dg(e=!1){const t=x.useContext(tO);if(t===void 0&&!e)throw new Error(sn(16));return t}function b_(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 mu(e,t,{detail:r=0}={}){e.dispatchEvent(new(En(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}=b_({focusableWhenDisabled:r,disabled:t,composite:m,tabIndex:a,isNativeButton:i}),g=x.useCallback(()=>{const y=u.current;hy(y)&&m&&t&&h.disabled===void 0&&y.disabled&&(y.disabled=!1)},[t,h.disabled,m]);We(g,[g]);const p=x.useCallback((y={})=>{const{onClick:w,onMouseDown:C,onKeyUp:S,onKeyDown:N,onPointerDown:E,...k}=y;return Qs({onClick(A){if(t){A.preventDefault();return}w==null||w(A)},onMouseDown(A){t||C==null||C(A)},onKeyDown(A){if(t||(Gp(A),N==null||N(A),A.baseUIHandlerPrevented))return;const O=A.target===A.currentTarget,R=A.currentTarget,T=hy(R),M=!i&&y_(R),D=O&&(i?T:!M),_=A.key==="Enter",H=A.key===" ",G=R.getAttribute("role"),B=(G==null?void 0:G.startsWith("menuitem"))||G==="option"||G==="gridcell";if(O&&m&&H){if(A.defaultPrevented&&B)return;A.preventDefault(),(!i||T)&&(A.preventBaseUIHandler(),mu(R,A));return}if(!D||i||!H&&!_){O&&M&&H&&A.preventDefault();return}A.defaultPrevented||(A.preventDefault(),_&&(A.preventBaseUIHandler(),mu(R,A)))},onKeyUp(A){if(!t){if(Gp(A),S==null||S(A),A.target===A.currentTarget&&i&&m&&hy(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!i&&!m&&!A.defaultPrevented&&A.key===" "&&(A.preventBaseUIHandler(),mu(A.currentTarget,A))}},onPointerDown(A){if(t){A.preventDefault();return}E==null||E(A)}},i?{type:"button"}:{role:"button"},h,k)},[t,h,m,i]),b=st(y=>{u.current=y,g()});return{getButtonProps:p,buttonRef:b}}function hy(e){return wn(e)&&e.tagName==="BUTTON"}function y_(e){return wn(e)&&e.tagName==="A"&&!!e.href}function ho(e,t,r,a){const i=bs(nO).current;return w_(i,e,t,r,a)&&sO(i,[e,t,r,a]),i.callback}function v_(e){const t=bs(nO).current;return j_(t,e)&&sO(t,e),t.callback}function nO(){return{callback:null,cleanup:null,refs:[]}}function w_(e,t,r,a,i){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==a||e.refs[3]!==i}function j_(e,t){return e.refs.length!==t.length||e.refs.some((r,a)=>r!==t[a])}function sO(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 S_=parseInt(x.version,10);function G1(e){return S_>=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([]),Tn=Object.freeze({});function N_(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 C_(e,t){return typeof e=="function"?e(t):e}function rO(e,t){return typeof e=="function"?e(t):e}function Nt(e,t,r={}){let a=t.render;r.enabled!==!1&&(a=R_(a));const i=k_(t,r,a);if(r.enabled===!1)return null;const c=r.state??Tn;return A_(e,a,i,c)}function k_(e,t,r){const{className:a,style:i}=e,{state:c=Tn,ref:u,props:f,stateAttributesMapping:m,enabled:h=!0}=t,g=h?C_(a,c):void 0,p=h?rO(i,c):void 0,b=h?N_(c,m):Tn,y=h&&f?T_(f):void 0,w=h?vv(b,y)??{}:Tn;return typeof document<"u"&&(h?Array.isArray(u)?w.ref=v_([w.ref,gk(r),...u]):w.ref=ho(w.ref,gk(r),u):ho(null,null)),h?(g!==void 0&&(w.className=JA(w.className,g)),p!==void 0&&(w.style=vv(w.style,p)),w):Tn}function T_(e){return Array.isArray(e)?m_(e):Qs(void 0,e)}const E_=Symbol.for("react.lazy");function R_(e){if((e==null?void 0:e.$$typeof)!==E_)return e;const t=x.Children.toArray(e)[0];return x.isValidElement(t)?t:e}function A_(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 O_(e,r);throw new Error(sn(8))}function O_(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 M_=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 oO(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=oO(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function aO(){for(var e,t,r=0,a="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=oO(e))&&(a&&(a+=" "),a+=t);return a}const xk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,bk=aO,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,...y}=g;return Object.entries(y).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)},D_=(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},z_=(e,t)=>({classGroupId:e,validator:t}),iO=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),qp="-",yk=[],I_="arbitrary..",P_=e=>{const t=L_(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return __(u);const f=u.split(qp),m=f[0]===""&&f.length>1?1:0;return lO(f,m,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const m=a[u],h=r[u];return m?h?D_(h,m):m:h||yk}return r[u]||yk}}},lO=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],c=r.nextPart.get(i);if(c){const h=lO(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}},__=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?I_+a:void 0})(),L_=e=>{const{theme:t,classGroups:r}=e;return $_(r,t)},$_=(e,t)=>{const r=iO();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];B_(u,t,r,a)}},B_=(e,t,r,a)=>{if(typeof e=="string"){V_(e,t,r);return}if(typeof e=="function"){U_(e,t,r,a);return}H_(e,t,r,a)},V_=(e,t,r)=>{const a=e===""?t:cO(t,e);a.classGroupId=r},U_=(e,t,r,a)=>{if(F_(e)){q1(e(a),t,r,a);return}t.validators===null&&(t.validators=[]),t.validators.push(z_(r,e))},H_=(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,cO(t,f),r,a)}},cO=(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=iO(),r.nextPart.set(u,f)),r=f}return r},F_=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,G_=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)}}},wv="!",vk=":",q_=[],wk=(e,t,r,a,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:a,isExternal:i}),Y_=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===vk){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,y=!1;p.endsWith(wv)?(b=p.slice(0,-1),y=!0):p.startsWith(wv)&&(b=p.slice(1),y=!0);const w=h&&h>m?h-m:void 0;return wk(c,y,b,w)};if(t){const i=t+vk,c=a;a=u=>u.startsWith(i)?c(u.slice(i.length)):wk(q_,!1,u,void 0,!0)}if(r){const i=a;a=c=>r({className:c,parseClassName:i})}return a},K_=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}},X_=e=>({cache:G_(e.cacheSize),parseClassName:Y_(e),sortModifiers:K_(e),postfixLookupClassGroupIds:W_(e),...P_(e)}),W_=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},Q_=/\s+/,Z_=(e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:i,sortModifiers:c,postfixLookupClassGroupIds:u}=t,f=[],m=e.trim().split(Q_);let h="";for(let g=m.length-1;g>=0;g-=1){const p=m[g],{isExternal:b,modifiers:y,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 T=C.substring(0,S);E=a(T);const M=E&&u[E]?a(C):void 0;M&&M!==E&&(E=M,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 k=y.length===0?"":y.length===1?y[0]:c(y).join(":"),A=w?k+wv:k,O=A+E;if(f.indexOf(O)>-1)continue;f.push(O);const R=i(E,N);for(let T=0;T<R.length;++T){const M=R[T];f.push(A+M)}h=p+(h.length>0?" "+h:h)}return h},J_=(...e)=>{let t=0,r,a,i="";for(;t<e.length;)(r=e[t++])&&(a=uO(r))&&(i&&(i+=" "),i+=a);return i},uO=e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=uO(e[a]))&&(r&&(r+=" "),r+=t);return r},e6=(e,...t)=>{let r,a,i,c;const u=m=>{const h=t.reduce((g,p)=>p(g),e());return r=X_(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=Z_(m,r);return i(m,g),g};return c=u,(...m)=>c(J_(...m))},t6=[],hs=e=>{const t=r=>r[e]||t6;return t.isThemeGetter=!0,t.themeKey=e,t},dO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,n6=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,s6=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r6=/\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$/,o6=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,a6=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,i6=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ii=e=>n6.test(e),Ut=e=>!!e&&!Number.isNaN(Number(e)),Qo=e=>!!e&&Number.isInteger(Number(e)),py=e=>e.endsWith("%")&&Ut(e.slice(0,-1)),Pa=e=>s6.test(e),mO=()=>!0,l6=e=>r6.test(e)&&!o6.test(e),Y1=()=>!1,c6=e=>a6.test(e),u6=e=>i6.test(e),d6=e=>!dt(e)&&!ft(e),f6=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)),m6=e=>sl(e,gO,Y1),dt=e=>dO.test(e),_l=e=>sl(e,xO,l6),jk=e=>sl(e,w6,Ut),h6=e=>sl(e,yO,mO),p6=e=>sl(e,bO,Y1),Sk=e=>sl(e,hO,Y1),g6=e=>sl(e,pO,u6),Oh=e=>sl(e,vO,c6),ft=e=>fO.test(e),$d=e=>fc(e,xO),x6=e=>fc(e,bO),Nk=e=>fc(e,hO),b6=e=>fc(e,gO),y6=e=>fc(e,pO),Mh=e=>fc(e,vO,!0),v6=e=>fc(e,yO,!0),sl=(e,t,r)=>{const a=dO.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},fc=(e,t,r=!1)=>{const a=fO.exec(e);return a?a[1]?t(a[1]):r:!1},hO=e=>e==="position"||e==="percentage",pO=e=>e==="image"||e==="url",gO=e=>e==="length"||e==="size"||e==="bg-size",xO=e=>e==="length",w6=e=>e==="number",bO=e=>e==="family-name",yO=e=>e==="number"||e==="weight",vO=e=>e==="shadow",j6=()=>{const e=hs("color"),t=hs("font"),r=hs("text"),a=hs("font-weight"),i=hs("tracking"),c=hs("leading"),u=hs("breakpoint"),f=hs("container"),m=hs("spacing"),h=hs("radius"),g=hs("shadow"),p=hs("inset-shadow"),b=hs("text-shadow"),y=hs("drop-shadow"),w=hs("blur"),C=hs("perspective"),S=hs("aspect"),N=hs("ease"),E=hs("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...A(),ft,dt],R=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],M=()=>[ft,dt,m],D=()=>[Ii,"full","auto",...M()],_=()=>[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"],Y=()=>["auto",...M()],W=()=>[Ii,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],q=()=>[f,Ii,"screen","full","dvw","lvw","svw","min","max","fit",...M()],ee=()=>[Ii,"screen","full","lh","dvh","lvh","svh","min","max","fit",...M()],z=()=>[e,ft,dt],L=()=>[...A(),Nk,Sk,{position:[ft,dt]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",b6,m6,{size:[ft,dt]}],$=()=>[py,$d,_l],U=()=>["","none","full",h,ft,dt],F=()=>["",Ut,$d,_l],K=()=>["solid","dashed","dotted","double"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[Ut,py,Nk,Sk],ve=()=>["","none",w,ft,dt],ae=()=>["none",Ut,ft,dt],le=()=>["none",Ut,ft,dt],re=()=>[Ut,ft,dt],Q=()=>[Ii,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Pa],breakpoint:[Pa],color:[mO],container:[Pa],"drop-shadow":[Pa],ease:["in","out","in-out"],font:[d6],"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":[f6],columns:[{columns:[Ut,"auto",dt,ft,f]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],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,...M()]}],"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:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"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:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pbs:[{pbs:M()}],pbe:[{pbe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mbs:[{mbs:Y()}],mbe:[{mbe:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...q()]}],"min-inline-size":[{"min-inline":["auto",...q()]}],"max-inline-size":[{"max-inline":["none",...q()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],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,$d,_l]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,v6,h6]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",py,dt]}],"font-family":[{font:[x6,p6,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,...M()]}],"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:[...K(),"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:M()}],"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:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Qo,ft,dt],radial:["",ft,dt],conic:["",Qo,ft,dt]},y6,g6]}],"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:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"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:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ut,ft,dt]}],"outline-w":[{outline:["",Ut,$d,_l]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","inner","none",g,Mh,Oh]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",p,Mh,Oh]}],"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,Mh,Oh]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[Ut,ft,dt]}],"mix-blend":[{"mix-blend":[...se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":se()}],"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":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"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":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"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":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"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":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"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":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"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":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"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":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"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":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"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":A()}],"mask-image-conic-pos":[{"mask-conic":[Ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"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:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ft,dt]}],filter:[{filter:["","none",ft,dt]}],blur:[{blur:ve()}],brightness:[{brightness:[Ut,ft,dt]}],contrast:[{contrast:[Ut,ft,dt]}],"drop-shadow":[{"drop-shadow":["","none",y,Mh,Oh]}],"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":ve()}],"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":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"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":O()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[ft,dt,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"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":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mbs":[{"scroll-mbs":M()}],"scroll-mbe":[{"scroll-mbe":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pbs":[{"scroll-pbs":M()}],"scroll-pbe":[{"scroll-pbe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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,$d,_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"]}},S6=e6(j6);function Ve(...e){return S6(aO(e))}const N6=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 ie({className:e,variant:t="default",size:r="default",...a}){return n.jsx(M_,{"data-slot":"button",className:Ve(N6({variant:t,size:r,className:e})),...a})}const wO=48,va=(e,t=0)=>{const r=new Int32Array(e.length);for(let a=0;a<e.length;a++)r[a]=e.charCodeAt(a)-wO-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)-wO;r+=i>>>1^-(i&1),t[a]=r}return t},C6=384,k6=[],Hl=zg(va("E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010")),T6=zg(va(":11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3")),E6="@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",R6=(()=>{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})(),A6=va("02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000",1),O6=zg(va("1233333593464636351265367151576")),M6=va("93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0324325853;D>E?3257D>03258432585:0325B:;0328B:032"),D6=va("012123445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EJK4444::EJ4444441691;644444114244444:;L6666555555555555555999666664444444444444444444444226?6:66644M9N?D:111::::6DJ199"),z6=Qi("0202002020020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200"),I6=(()=>{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})(),P6="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"),_6=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"),L6=Qi("02222222222222222222222222222222222222222222222222222222222222222203062222222222IL2200IL021042222]`222IL0gj2e50n2222U00X202[^2y0000560|{~22>22|22222222222G000qOVI00000}2>40000B00000I¨000°00000000000000021Q²±00´000000000000000000000222HGHa5¾222Ã6À2222ÍÐ000°2±"),jO=new Int32Array(991),SO=new Int32Array(991),NO=new Int32Array(991);let jv="";const Sv=new Int32Array(1030);{const e=new Map;let t=0,r=0;for(let a=0;a<Ck.length;a++)for(const i of P6[L6[a]]){let c=e.get(i);c===void 0&&(c=t++,e.set(i,c),Sv[c*2]=jv.length,Sv[c*2+1]=i.length,jv+=i),jO[r]=Ck[a],SO[r]=_6[a],NO[r]=c,r++}}const $6=Qi("0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p"),B6=zg(va("1::22222432:222:22:22>222222:22:2221322511111311111114")),V6=Qi("24A;33N=C@H4A;33N=C@<2;363@QTQʰ222ˉºŴŽ2R2=18cƴÅŇÜÛŲǝȈ:ħ25=11D3A@216Er25;11B3?<438Cn9@7=<8192>2E121@9@EHE@9>2T25511<398216=V25511<398216=ƧNž2Đå242L222290000f22500ɛ000ǘ222"),U6=va("ij"),H6=va(""),F6=va("1"),G6="* ** after backdrop before details-content file first-letter first-line marker placeholder selection";var q6={GROUP_COUNT:C6,customValidatorNames:k6,edgeStart:Hl,labelStart:T6,labelText:E6,edgeTarget:R6,nodeGroup:A6,nodeVlist:I6,vlistPat:O6,vlistOps:M6,vlistRef:D6,vlistGroup:z6,litAnchor:jO,litGroup:SO,litPool:NO,poolOffsets:Sv,poolText:jv,adjGid:$6,adjStart:B6,adjTgt:V6,patGid:U6,patTgt:H6,postfixLookupGroups:F6,orderSensitiveModifiers:G6};const Y6="line"in new Error,Zo=-1,Ll=-1,gy=(e,t,r)=>{let a=2166136261;for(let i=t;i<r;i++)a=Math.imul(a^e.charCodeAt(i),16777619);return a},xy=(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},K6=(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:y,litAnchor:w,litGroup:C,litPool:S,poolOffsets:N,poolText:E,adjGid:k,adjStart:A,adjTgt:O,patGid:R,patTgt:T,postfixLookupGroups:M,customValidatorNames:D,orderSensitiveModifiers:_}=e,H=new Int32Array(a).fill(-1);for(let De=0;De<k.length;De++)H[k[De]]=De;let G=0;for(let De=0;De+1<A.length;De++){const Ge=A[De+1]-A[De];Ge>G&&(G=Ge)}let B=32;for(;B<2*(1+G+R.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<M.length;De++)V[M[De]]=1;const Y=i.length-1,W=new Uint8Array(Y);let q=0,ee=!0;for(let De=0;De<w.length;De++){W[w[De]]=1;const Ge=N[S[De]*2+1];Ge>q&&(q=Ge);const qe=E.charCodeAt(N[S[De]*2]);(qe===91||qe===40)&&(ee=!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=(gy(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=(gy(Ge,qe,bt)^Math.imul(De,2654435761)|0)&z-1;const Ot=bt-qe;for(;;){const Bt=L[zt];if(Bt===-1)return-1;if(w[Bt]===De&&N[S[Bt]*2+1]===Ot){const Sn=N[S[Bt]*2];let mn=!0;for(let Ct=0;Ct<Ot;Ct++)if(E.charCodeAt(Sn+Ct)!==Ge.charCodeAt(qe+Ct)){mn=!1;break}if(mn)return C[Bt]}zt=zt+1&z-1}},te=r.cacheSize??8192,$=r.prefix??e.prefix??"",U=$===""?"":$+":",F=U.length,K=(D??[]).map(De=>{throw new Error("cn: missing validator "+De)}),se=/\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$/,ne=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ve=/^(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 le=0,re=-1,Q=-1,Z=-1,pe=-1;const ue=De=>De>=97&&De<=122||De>=65&&De<=90||De>=48&&De<=57||De===95,ye=De=>/\s/.test(String.fromCharCode(De)),Ce=(De,Ge,qe)=>{if(le=0,re=-1,qe-Ge<3)return;const bt=De.charCodeAt(Ge),zt=De.charCodeAt(qe-1);if(bt===91&&zt===93)le=1;else if(bt===40&&zt===41)le=2;else return;Z=Ge+1,pe=qe-1;let Ot=Ge+1;if(ue(De.charCodeAt(Ot))){for(Ot++;Ot<qe-1;){const Bt=De.charCodeAt(Ot);if(!ue(Bt)&&Bt!==45)break;Ot++}Ot<qe-2&&De.charCodeAt(Ot)===58&&(re=Ge+1,Q=Ot,Z=Ot+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},de=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Te=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oe=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],Me="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],me=(De,Ge,qe,bt)=>{if(De>=10){if(De>=25)return K[De-25](Ge.slice(qe,bt));const zt=De-10;if(le!==Re[zt])return!1;if(re>=0){for(const Ot of Me[zt])if(Ie(Ge,re,Q,Ot))return!0;return!1}switch(ke[zt]){case 0:return!1;case 1:return!0;case 2:{const Ot=Ge.slice(Z,pe);return se.test(Ot)&&!ne.test(Ot)}case 3:return oe(Ge.slice(Z,pe));case 4:return ae.test(Ge.slice(Z,pe));default:return ve.test(Ge.slice(Z,pe))}}switch(De){case 0:return!0;case 1:return le===0;case 2:return le===1;case 3:return le===2;case 4:return de.test(Ge.slice(qe,bt));case 5:return oe(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&&oe(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,Ot)=>{const Bt=gy(Ge,qe,bt)^(zt?2654435769:0)|0;let Sn=De.get(Bt);if(Sn!==void 0)e:for(let It=0;It<Sn.length;It++){const on=Sn[It];if(!(on.imp!==zt||on.k.length!==bt-qe)){for(let St=0;St<on.k.length;St++)if(on.k.charCodeAt(St)!==Ge.charCodeAt(qe+St))continue e;return on.id}}else De.set(Bt,Sn=[]);const mn=Ge.slice(qe,bt),Ct=Ot(mn);return Sn.push({k:mn,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,Ot=0;for(let Ct=0;Ct<De.length;Ct++){const It=De.charCodeAt(Ct);bt===0&&zt===0&&It===58?(qe.push(De.slice(Ot,Ct)),Ot=Ct+1):It===91?bt++:It===93?bt--:It===40?zt++:It===41&&zt--}qe.push(De.slice(Ot));let Bt=qe[0];if(qe.length>1){const Ct=[];let It=[];for(const on of qe)on.charCodeAt(0)===91||Ae.has(on)?(It.length&&(Ct.push(...It.sort()),It=[]),Ct.push(on)):It.push(on);It.length&&Ct.push(...It.sort()),Bt=Ct.join(":")}const Sn=Ge?Bt+" !":Bt;let mn=Fe.get(Sn);return mn===void 0&&Fe.set(Sn,mn=_e++),mn};let ct=new Map,At=a;const rt=a+4096,be=()=>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 kt=0;const je=(De,Ge,qe,bt,zt,Ot,Bt,Sn)=>{let mn=De;if(Ke[De]!==null)if(Ke[De|1]===null)mn=De|1;else if((kt++&3)===0)mn=De|kt>>2&1;else return;Ke[mn]=Ge.slice(qe,bt),xt[mn]=zt,Be[mn]=Ot,jt[mn]=Bt,Ze[mn]=Sn},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 ce=64,tt=new Int32Array(ce),Tt=new Int32Array(ce);const rn=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 rn[Ge]===Jn?1:(rn[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 Ot=-1;for(let Bt=Ge+1;Bt<qe-1;Bt++)if(De.charCodeAt(Bt)===58){Ot=Bt;break}return Ot===-1||Ot===Ge+1?Zo:ge(ct,De,Ge+1,Ot,0,be)}if(bt>=0&&m[bt]>=0)return m[bt];for(let Ot=zt-1;Ot>=0;Ot--){const Bt=Tt[Ot];if(Bt>qe)continue;const Sn=tt[Ot],mn=qe-Bt;if(W[Sn]===1&&mn>0&&mn<=q){const Hn=De.charCodeAt(Bt);if(ee===!1||Hn!==91&&Hn!==40){const Cr=X(Sn,De,Bt,qe);if(Cr>=0)return Cr}}const Ct=h[Sn];if(Ct<0)continue;const It=b[Ct],on=g[It],St=g[It+1];if(on===St)continue;Ce(De,Bt,qe);const fs=P[Ct]-on;for(let Hn=on;Hn<St;Hn++)if(me(p[Hn],De,Bt,qe))return y[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 Ot=0;for(;Ot<Ge;){let Ct=De.charCodeAt(Ot);if(Ct===32||Ct>=9&&Ct<=13||Ct>=160&&ye(Ct)){Ct!==32&&(zt=!0),Ot++;continue}const It=Ot;let on=0;for(;Ot<Ge;){if(Ct=De.charCodeAt(Ot),Ct<=32){if(Ct===32)break;if(Ct>=9&&Ct<=13){zt=!0;break}}else if(Ct>=160&&ye(Ct)){zt=!0;break}on=Math.imul(on^Ct,16777619),Ot++}const St=Ot,fs=St-It;qe===et&&Kn();const Hn=qe++;lt[Hn]=It,wt[Hn]=St,bt+=fs,on^=Math.imul(fs,2654435761);const Cr=on^on>>>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,je(ss,De,It,St,Cr,Zo,0,0);continue}rs=It+F}let vc=0,Gu=0,ja=-1,wc=-1;for(let Zt=rs;Zt<St;Zt++){const Ss=De.charCodeAt(Zt);if(vc===0&&Gu===0){if(Ss===58){ja=Zt;continue}if(Ss===47){wc=Zt;continue}}Ss===91?vc++:Ss===93?vc--:Ss===40?Gu++:Ss===41&&Gu--}const dm=ja>=rs?ja+1:rs;let _n=dm,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>dm&&(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,qu=-1,Tr=0;(h[0]>=0||W[0]===1)&&(tt[0]=0,Tt[0]=Sc,Tr=1);let dl=Ll,Yu=0;for(let Zt=Sc;Zt<Gs;Zt++)if(Zt===ur&&(dl=Js<li?Ll:kr,Yu=Tr),kr!==Ll){const Ss=De.charCodeAt(Zt);let Zr=-1;if(Js<li)u.charCodeAt(Js)===Ss?(Js++,Js===li&&(Zr=kr=qu)):kr=Ll;else{const Er=i[kr],hl=i[kr+1];let Sa=Ll;for(let zs=Er;zs<hl;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],qu=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===ce){ce*=2;const Er=new Int32Array(ce);Er.set(tt),tt=Er;const hl=new Int32Array(ce);hl.set(Tt),Tt=hl}tt[Tr]=Zr,Tt[Tr]=Zt+2,Tr++}}ur===Gs&&(dl=Js<li?Ll:kr,Yu=Tr);const Ku=Js<li?Ll:kr;let Ds,er=!1;if(ur>=0)if(er=!0,Ds=jo(De,_n,ur,dl,Yu),Ds!==Zo&&Ds<a&&V[Ds]){const Zt=jo(De,_n,Gs,Ku,Tr);Zt!==Zo&&Zt!==Ds&&(Ds=Zt,er=!1)}else Ds===Zo&&(Ds=jo(De,_n,Gs,Ku,Tr),er=!1);else Ds=jo(De,_n,Gs,Ku,Tr);let fl=0,ml=0;Ds===Zo?cn[Hn]=Zo:(ml=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]=ml,Gt[Hn]=fl),je(ss,De,It,St,Cr,Ds,fl,ml)}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&&(rn.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 on=Gt[Ct];if(wo(on,It)===1){Bn[Ct]=0,Bt=!0;continue}if(Bn[Ct]=1,It<a){const St=H[It];if(St>=0)for(let fs=A[St];fs<A[St+1];fs++)wo(on,O[fs]);if(fn[Ct]&1)for(let fs=0;fs<R.length;fs++)R[fs]===It&&wo(on,T[fs])}}if(!Bt&&!zt&&Ge===bt+qe-1)return De;let Sn="",mn=0;for(;mn<qe;){if(!Bn[mn]){mn++;continue}const Ct=lt[mn];let It=wt[mn],on=mn+1;for(;on<qe&&Bn[on]&<[on]===It+1&&De.charCodeAt(It)===32;)It=wt[on],on++;Sn.length>0&&(Sn+=" "),Sn+=De.slice(Ct,It),mn=on}return Sn},Fs=16384,ds=new Int32Array(Fs*2);let Os=0,Pn=1,Un=Object.create(null),Ms=Object.create(null),Nr=new Map,Fu=new Map,gc=0,xc=0;const ai=()=>{Os^=Fs,Pn=Pn+1|0,xc=0},cl=De=>{let Ge=Un[De];if(Ge!==void 0)return Ge;const qe=xy(De,0,De.length),bt=(qe&16383)+Os,zt=ds[bt]===(qe^Pn)||ds[bt^Fs]===(qe^Pn-1);return zt&&(Ge=Ms[De],Ge!==void 0)?(Un[De]=Ge,Ge):(Ge=cr(De),zt?(Un[De]=Ge,++gc>te&&(gc=0,Ms=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=xy(De,0,De.length),bt=(qe&16383)+Os,zt=ds[bt]===(qe^Pn)||ds[bt^Fs]===(qe^Pn-1);return zt&&(Ge=Fu.get(De),Ge!==void 0)?(Nr.set(De,Ge),Ge):(Ge=cr(De),zt?(Nr.set(De,Ge),++gc>te&&(gc=0,Fu=Nr,Nr=new Map,ai())):(ds[bt]=qe^Pn,++xc>Fs&&ai()),Ge)},yc=De=>{const Ge=xy(De,0,De.length),qe=(Ge&16383)+Os;return ds[qe]===(Ge^Pn)||ds[qe^Fs]===(Ge^Pn-1)?!0:(ds[qe]=Ge^Pn,++xc>Fs&&ai(),!1)},So=te===0?cr:Y6?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(W6.apply(null,arguments))},mergeString:So,seenBefore:te===0?()=>!1:yc,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},X6=(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},W6=function(){return X6(arguments,!1)},Q6=(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,y,w,C)=>{let S=0;if(y){if(y!==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,y)=>{const w=b.a;let C=0;for(let S=0;S<y.length;S++){const N=y[S];if(N){if(N!==w[C])return!1;C++}}return C===b.t},g=(b,y)=>{const w=b.length,C=f===null?null:f.n;if(!y){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,k=!1;for(let R=0;R<w;R++){let T=b[R];if(T){if(typeof T!="string"){if(T=b[R]=Yp(T,!0),!T)continue;k=!0}N<0&&(S=T,N=R),E++}}if(E===0)return"";if(E===1)return e(S);if(k){if(C!==null&&h(C,b))return f=C,C.r;if(f!==null&&f!==C&&h(f,b))return f.r}let A=i.get(S);A===void 0&&(A=c.get(S),A!==void 0&&i.set(S,A));let O=null;if(A!==void 0)e:for(let R=0;R<A.length;R++){const T=A[R];if(T.t!==E)continue;const M=T.a;let D=1;for(let _=N+1;_<w;_++){const H=b[_];if(H&&H!==M[D++])continue e}O=T;break}if(O===null){let R=S;const T=[S];for(let M=N+1;M<w;M++){const D=b[M];D&&(R+=" "+D,T.push(D))}if(!r(R))return a(R);O={r:e(R),t:T.length,a0:T[0],a1:T[1],a2:T[2]??"",a:T,n:null},A===void 0&&i.set(S,A=[]),A.length>=256&&A.shift(),A.push(O),++u>1e3&&(u=0,c=i,i=new Map)}return f!==null&&f!==O&&(f.n=O),f=O,O.r},p=b=>Array.isArray(b)?g(b.slice(),!1):e(Yp(b,!0));return function(b,y,w){const C=arguments.length;if((C|1)===3){const E=f;if(E!==null){const k=E.n;if(k!==null&&m(k,b,y,w))return f=k,k.r;if(E!==k&&m(E,b,y,w))return E.r}return g([b,y,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 k=E.a;let A=0,O=!0;for(let R=0;R<C;R++){const T=arguments[R];if(T){if(T!==k[A]){O=!1;break}A++}}if(O&&A===E.t)return f=E,E.r}if(S!==E){const k=S.a;let A=0,O=!0;for(let R=0;R<C;R++){const T=arguments[R];if(T){if(T!==k[A]){O=!1;break}A++}}if(O&&A===S.t)return S.r}}const N=[];for(let E=0;E<C;E++)N.push(arguments[E]);return g(N,!0)}},kk=K6(q6),ws=Q6(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 CO=(...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 Z6=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 J6=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=J6(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 eL={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 tL=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 nL=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,...eL,width:t,height:t,stroke:e,strokeWidth:a?Number(r)*24/Number(t):r,className:CO("lucide",i),...!c&&!tL(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(nL,{ref:c,iconNode:t,className:CO(`lucide-${Z6(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 sL=[["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"}]],rL=at("activity",sL);/**
|
|
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 oL=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Pf=at("arrow-down",oL);/**
|
|
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 aL=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],K1=at("arrow-left",aL);/**
|
|
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 iL=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],hu=at("arrow-right",iL);/**
|
|
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 lL=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Zi=at("arrow-up-right",lL);/**
|
|
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 cL=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],_f=at("arrow-up",cL);/**
|
|
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 uL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],dL=at("ban",uL);/**
|
|
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 fL=[["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"}]],mL=at("book-open",fL);/**
|
|
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 hL=[["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"}]],kO=at("bot",hL);/**
|
|
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 pL=[["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"}]],mc=at("box",pL);/**
|
|
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 gL=[["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"}]],xL=at("building-2",gL);/**
|
|
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 bL=[["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"}]],yL=at("cable",bL);/**
|
|
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 vL=[["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"}]],wL=at("calendar-clock",vL);/**
|
|
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 jL=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Yn=at("check",jL);/**
|
|
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 SL=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ma=at("chevron-down",SL);/**
|
|
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 NL=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Lr=at("chevron-right",NL);/**
|
|
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 CL=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],TO=at("chevron-up",CL);/**
|
|
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 kL=[["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",kL);/**
|
|
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 TL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],EL=at("circle-check",TL);/**
|
|
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 RL=[["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"}]],AL=at("circle-x",RL);/**
|
|
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 OL=[["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",OL);/**
|
|
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 ML=[["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",ML);/**
|
|
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 DL=[["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",DL);/**
|
|
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 zL=[["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"}]],EO=at("door-closed",zL);/**
|
|
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 IL=[["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",IL);/**
|
|
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 PL=[["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"}]],RO=at("earth",PL);/**
|
|
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 LL=[["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"}]],$L=at("external-link",LL);/**
|
|
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 BL=[["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"}]],AO=at("file-code-corner",BL);/**
|
|
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 VL=[["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",VL);/**
|
|
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 UL=[["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"}]],HL=at("file",UL);/**
|
|
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 FL=[["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"}]],GL=at("folder-git-2",FL);/**
|
|
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 qL=[["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"}]],pf=at("folder-input",qL);/**
|
|
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 YL=[["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",YL);/**
|
|
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 KL=[["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"}]],Ok=at("funnel",KL);/**
|
|
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 XL=[["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",XL);/**
|
|
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 WL=[["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"}]],OO=at("hard-drive",WL);/**
|
|
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 QL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Mu=at("info",QL);/**
|
|
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 ZL=[["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"}]],Du=at("key-round",ZL);/**
|
|
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 JL=[["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",JL);/**
|
|
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 e$=[["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"}]],t$=at("layers",e$);/**
|
|
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 n$=[["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"}]],MO=at("link-2",n$);/**
|
|
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 s$=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],r$=at("list-filter",s$);/**
|
|
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 o$=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ql=at("loader-circle",o$);/**
|
|
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 a$=[["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"}]],Mk=at("lock",a$);/**
|
|
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 i$=[["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"}]],l$=at("message-square",i$);/**
|
|
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 c$=[["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"}]],u$=at("monitor",c$);/**
|
|
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 d$=[["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"}]],f$=at("moon",d$);/**
|
|
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 m$=[["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",m$);/**
|
|
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 h$=[["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"}]],DO=at("octagon-x",h$);/**
|
|
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 p$=[["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",p$);/**
|
|
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 g$=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],x$=at("panel-left",g$);/**
|
|
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 b$=[["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"}]],y$=at("pause",b$);/**
|
|
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 v$=[["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",v$);/**
|
|
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 w$=[["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"}]],zO=at("play",w$);/**
|
|
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 j$=[["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"}]],ew=at("plug",j$);/**
|
|
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 S$=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ys=at("plus",S$);/**
|
|
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 N$=[["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",N$);/**
|
|
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 C$=[["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"}]],k$=at("rotate-ccw",C$);/**
|
|
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 T$=[["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"}]],IO=at("rotate-cw",T$);/**
|
|
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 E$=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],R$=at("search",E$);/**
|
|
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 A$=[["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",A$);/**
|
|
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 O$=[["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"}]],zu=at("shield-check",O$);/**
|
|
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 M$=[["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"}]],tw=at("shield-off",M$);/**
|
|
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 D$=[["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"}]],z$=at("sliders-horizontal",D$);/**
|
|
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 I$=[["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"}]],P$=at("square-code",I$);/**
|
|
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 _$=[["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"}]],L$=at("square-plus",_$);/**
|
|
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 $$=[["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"}]],PO=at("square-terminal",$$);/**
|
|
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 B$=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],V$=at("square",B$);/**
|
|
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 U$=[["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"}]],H$=at("sun",U$);/**
|
|
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 F$=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],nw=at("terminal",F$);/**
|
|
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 G$=[["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",G$);/**
|
|
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 q$=[["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",q$);/**
|
|
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 Y$=[["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",Y$);/**
|
|
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 K$=[["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"}]],X$=at("upload",K$);/**
|
|
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 W$=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Q$=at("user-round",W$);/**
|
|
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 Z$=[["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",Z$);/**
|
|
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 J$=[["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",J$);/**
|
|
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 eB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],In=at("x",eB);function Rt({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 tB(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 nB(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!tB(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 sB(e,t,r,a=Df){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=KA()}={}){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 rB=(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 _O(e,{signal:t,onProgress:r=()=>{},wait:a=rB,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 oB({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 _O(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 LO(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 aB(e,t,r,a){if(t.target!=="local")throw Error("Choose a local destination for this workspace.");return LO(e,t,r,a)}async function iB(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 lB({popup:e,origin:t,cloud:r=Df,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,y;const w=new Promise((O,R)=>{b=O,y=R}),C=async()=>{h&&await a("cancel",{nonce:h}).catch(()=>{})},S=()=>{f(A),i.removeEventListener("message",E)};function N(O="Cloud sign-in was cancelled."){return p?Promise.resolve():(p=!0,S(),e.close(),y(new Error(O)),C())}const E=async O=>{if(!(p||g||!h||!sB(O,e,h,r))){g=!0;try{const R=await a("finish",{nonce:h,code:O.data.code});if(p){await C();return}if(!R.connected||!R.user)throw new Error("Sign-in did not finish. Try again.");p=!0,S(),e.close(),c(),b(R)}catch(R){if(p){await C();return}await N(R.message)}}},k=m()+15*6e4,A=u(()=>{(e.closed||m()>k)&&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 O=await a("start",{origin:t});if(h=O.nonce,p){await C();return}e.location.href=O.url}).catch(O=>{p||N(O.message)}),{promise:w,cancel:N}}const Pg=x.createContext(null),$O=x.createContext(null),js=()=>x.useContext(Pg);function Bf(){const e=x.useContext($O);if(!e)throw new Error("useApi outside ComputeSession");return e}function cB({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 Nv({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($O.Provider,{value:a.api,children:r})}function uB({children:e,user:t,logout:r}){qA("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(Nv,{target:"local",children:e})})}function dB({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,y]=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):_O(()=>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(ie,{className:"mt-5",onClick:()=>y(!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:()=>{y(!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"}),Df]})})}function fB({children:e}){var R;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 T=>{const M=await Ha("status",void 0,{signal:T});return i(D=>({...D,...M})),u(M.error??""),M},[]),y=x.useRef({uid:null,revision:0});qA(t),ik(a!=null&&a.connected?a.owner:null),x.useEffect(()=>{let T=!0;Ha("status").then(D=>{T&&(i(D),u(D.error??""))}).catch(D=>{T&&(u(D.message),i({connected:!1,available:!1}))});const M=()=>{i(D=>({...D,connected:!1,machine:null})),u("Your cloud connection expired. Connect again to continue.")};return window.addEventListener("openrod-session-expired",M),()=>{var D;T=!1,window.removeEventListener("openrod-session-expired",M),(D=p.current)==null||D.cancel("Cloud connection cancelled.")}},[]),x.useEffect(()=>{if(!(a!=null&&a.connected)||!a.expires)return;const T=typeof a.expires=="number"?a.expires:Date.parse(a.expires);if(!Number.isFinite(T))return;const M=setTimeout(()=>{i(D=>({...D,connected:!1,machine:null})),u("Your cloud connection expired. Connect again to continue.")},Math.max(0,T-Date.now()));return()=>clearTimeout(M)},[a]);function w(T){if(!["local","cloud"].includes(T))return;try{sessionStorage.setItem(WP,T)}catch{}const M=new URL(window.location.href);M.searchParams.delete("target"),M.hash="",window.history.replaceState(null,"",M),window.dispatchEvent(new HashChangeEvent("hashchange")),r(T)}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 T=window.open("about:blank","_blank","popup,width=760,height=720");if(!T)throw new Error("Allow popups to connect your local OpenRod to cloud.");const M=lB({popup:T,origin:window.location.origin,cloud:a.origin||Df});p.current=M,m(!0),u("");try{const D=await M.promise;if(p.current!==M)throw new Error("Cloud sign-in was cancelled.");return ik(D.owner),i(_=>({..._,...D})),D}catch(D){throw p.current===M&&u(D.message),D}finally{p.current===M&&(p.current=null,m(!1))}}function S(T="Cloud connection cancelled."){const M=p.current;if(M)return p.current=null,m(!1),u(T),M.cancel(T)}async function N(){try{const T=await Ha("disconnect",{});i(T),w("local")}catch(T){throw[401,403].includes(T.status)&&(i(M=>({...M,connected:!1,machine:null})),w("local")),u(T.message),T}}async function E({signal:T,onProgress:M}={}){T==null||T.throwIfAborted();const D=C(),_=p.current,H=()=>{_&&p.current===_&&S()};T==null||T.addEventListener("abort",H,{once:!0});let G;try{G=await D}finally{T==null||T.removeEventListener("abort",H)}T==null||T.throwIfAborted();const B=G.owner;return oB({owner:B,signal:T,onProgress:V=>{if(V.owner!==B)throw new Error("Your cloud account changed. Choose the destination again.");i(Y=>({...Y,...V})),M==null||M(V)}})}y.current=ZP(y.current,a!=null&&a.connected?(R=a.user)==null?void 0:R.uid:null);const k=y.current.revision,A=`${t}:${k}`,O={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:O,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(ie,{disabled:!(a!=null&&a.available)||f,className:"mt-6",onClick:()=>C().catch(()=>{}),children:[f&&n.jsx(Rt,{}),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(dB,{status:a,onStatus:i,onCancel:()=>w("local"),children:n.jsx(Nv,{target:t,ownerScope:k,children:e},A)},`cloud:${k}`):n.jsx(Nv,{target:t,ownerScope:k,children:e},A)})}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 by=(e,t)=>Object.fromEntries(Object.entries(e).filter(([r])=>!t.includes(r))),Cv=["location","copies","sourceOrg","sourceSetups","id","createdAt","updatedAt","revision","importedAt","importSource","localSource","configurationCount"];function kv(e,t){if(e==="network"&&t.sourceOrg){const r=u=>{var m;const f=t.sourceOrg.groups.find(h=>h.id===u);return f?by(kv("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?kv("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=by(t,Cv);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}:by(t,Cv)}const Bi=(e,t)=>JSON.stringify(ra(kv(e,t)));function gf(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 sw=e=>(e==null?void 0:e.copies)??(e?[e]:[]);function mB(e,t){const r=sw(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 BO(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]=BO(e==null?void 0:e[i],c,r==null?void 0:r[i]));return a}return t}async function hB({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]),y=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(y.length!==1)throw new Error("The matching item differs on this source. Edit it separately.");return c.deleteSetupItem(f.id,y[0].id,f.revision)}const m={},h=e==="templates"?t.recipe:t;for(const[b,y]of Object.entries(r[0]))Cv.includes(b)||b==="isNew"||e==="templates"&&b==="environment"||JSON.stringify(ra(h[b]))!==JSON.stringify(ra(y))&&(m[b]=BO(h[b],y,(e==="templates"?f.recipe:f)[b]));if(a==="savePolicy"){const b=await c.org(),y={...f,...m,id:f.id,isNew:!1};if(m.appliesTo){y.appliesTo={...f.appliesTo};for(const[w,C]of Object.entries(m.appliesTo))JSON.stringify(ra(C))!==JSON.stringify(ra(t.appliesTo[w]))&&(w==="groups"?y.appliesTo.groups=C.map(S=>{var k;const N=(k=t.sourceOrg)==null?void 0:k.groups.find(A=>A.id===S),E=N?b.groups.filter(A=>Bi("groups",A)===Bi("groups",N)):b.groups.filter(A=>A.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}):y.appliesTo[w]=C)}if(y.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=y.appliesTo.setups)!=null&&p.length){const w=await c.setups();if(y.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(y)}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"),mt=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 pB(e,t,r=1e3){const a=Pk.get(e),i=ln.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 ln.finishFlow(i,"connected"),c}catch(c){throw ln.finishFlow(i,"failed",Cu(c)),c}}const yy=({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`})]}),gB={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(yy,{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(yy,{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(yy,{x:7.6,y:9.6})]})},xB={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 bB({type:e,className:t="size-3.5"}){const r=gB[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 VO({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 ${xB[e]}`,children:[n.jsx(bB,{type:e}),nc[e].label]})}function Hs({location:e}){const t=xp(e);return n.jsx(VO,{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 UO={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},_g={...UO,position:"fixed",top:0,left:0},rw={...UO,position:"absolute"};function yB(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 vB="data-valid",wB="data-invalid",jB={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},SB={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},NB={disabled:!1,...SB},Lg={valid(e){return e===null?null:e?{[vB]:""}:{[wB]:""}}},CB="data-checked",kB="data-unchecked";function HO(e){return{checked(t){return e.indeterminate?{}:t?{[CB]:""}:{[kB]:""}},...Lg}}let _k=0;function TB(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 TB(e,t)}function vs(e){return sc(e,"base-ui")}const EB={invalid:void 0,name:void 0,validityData:{state:jB,errors:[],error:"",value:"",initialValue:null},setValidityData:Ln,disabled:void 0,setTouched:Ln,setDirty:Ln,setFilled:Ln,setFocused:Ln,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:NB,registerFieldControl:Ln,validation:{getValidationProps:(e,t=Tn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Ln,getInputControl:()=>null,commit:async()=>{},change:Ln}},RB=x.createContext(EB);function Iu(e=!0){const t=x.useContext(RB);if(t.setValidityData===Ln&&!e)throw new Error(sn(28));return t}function $g(e,t,r,a,i=!0,c){const{registerFieldControl:u}=Iu(),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 AB=x.createContext({disabled:!1});function OB(){return x.useContext(AB)}const MB=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Ln,validationMode:"onSubmit",submitCountRef:{current:0}});function Bg(){return x.useContext(MB)}const DB=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(DB)}function FO(e,t,r,a=!0,i){const[c,u]=x.useState(),f=vs(i?`${i}-label`:void 0),m=e??t??c;return We(()=>{const h=e||t||!a?void 0:zB(r.current,f);c!==h&&u(h)}),m}function zB(e,t){const r=IB(e);if(r)return!r.id&&t&&(r.id=t),r.id||void 0}function IB(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=vs(),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 PB=x.createContext(void 0);function _B(){return x.useContext(PB)}const GO=x.createContext(void 0);function LB(){const e=x.useContext(GO);if(e===void 0)throw new Error(sn(14));return e}const Ur="none",ha="trigger-press",Qn="trigger-hover",gu="trigger-focus",Vg="outside-press",Zl="item-press",qO="close-press",Ji="focus-out",Hf="escape-key",Tv="list-navigation",YO="cancel-open",Kd="sibling-open",KO="disabled",$k="missing",Bk="initial",Ug="imperative-action",$B="window-resize";function vt(e,t,r,a){let i=!1,c=!1;const u=a??Tn;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 BB="data-parent",VB=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:y,parent:w=!1,readOnly:C=!1,render:S,required:N=!1,uncheckedValue:E,value:k,nativeButton:A=!1,style:O,...R}=t,{clearErrors:T}=Bg(),{disabled:M,name:D,setDirty:_,setFilled:H,setFocused:G,setTouched:B,state:P,validationMode:V,validityData:Y,validation:W}=Iu(),q=OB(),{labelId:ee,registerControlId:z,getDescriptionProps:L}=Vf(),X=_B(),te=(X==null?void 0:X.allValues)===void 0?void 0:X.parent,$=te!==void 0,U=M||q.disabled||(X==null?void 0:X.disabled)||f,F=D??b,K=k??F,se=vs(),ne=(X==null?void 0:X.registerControlId)!==z,ve=Uf({id:h||void 0,enabled:ne}),ae=A?ve:se;let le={};$&&(w?le=te.getParentProps():K!==void 0&&(le=te.getChildProps(K)));const{checked:re=a,indeterminate:Q=g,onCheckedChange:Z,...pe}=le,ue=X==null?void 0:X.value,ye=x.useRef(null),{getButtonProps:Ce,buttonRef:Ie}=bo({disabled:U,native:A}),de=(X==null?void 0:X.validation)??W,[Te,oe]=po({controlled:K!==void 0&&ue!==void 0&&!w?ue.includes(K):re,default:c,name:"Checkbox",state:"checked"}),fe=$?!!re:Te,Re=$&&Q||g;$g(ye,se,Te,void 0,!X&&!U,b);const Me=te==null?void 0:te.registerChildId,ke=x.useRef(null),me=de.registerInput,Ae=X?K:void 0,ge=x.useCallback(rt=>me(rt,{controlRef:ye,value:Ae}),[me,Ae]),Pe=ho(p,ke,w?void 0:ge),Fe=FO(u,ee,ke,!A,ve);We(()=>{ke.current&&(ke.current.indeterminate=Re),X||H(Te)},[Te,Re,X,H]),Ff(Te,()=>{X||(T(F),_(Te!==Y.initialValue),de.change(Te))});const _e=Qs({checked:Te,disabled:U,form:m,name:w?void 0:F,id:A?void 0:ve,required:N,ref:Pe,style:F?rw:_g,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(rt){if(rt.nativeEvent.defaultPrevented)return;if(C){rt.preventDefault();return}const be=rt.currentTarget.checked,Ue=vt(Ur,rt.nativeEvent);if(y==null||y(be,Ue),!Ue.isCanceled&&(Z==null||Z(be,Ue),!Ue.isCanceled&&(oe(be),K!==void 0&&X!==void 0&&!w&&!$))){const Qe=be?[...X.value,K]:X.value.filter(xt=>xt!==K);X.setValue(Qe,Ue)}},onClick(rt){rt.stopPropagation()},onFocus(){var rt;(rt=ye.current)==null||rt.focus()}},k!==void 0?{value:(X?Te&&k:k)||""}:Tn,L,rt=>de.getValidationProps(U,rt));x.useEffect(()=>{if(!te||K===void 0)return;const rt=te.disabledStatesRef.current;return rt.set(K,U),()=>{rt.delete(K)}},[te,U,K]);const Xe=x.useMemo(()=>({...P,checked:fe,disabled:U,readOnly:C,required:N,indeterminate:Re}),[P,fe,U,C,N,Re]),Je=HO(Xe),ct=Nt("span",t,{state:Xe,ref:[Ie,ye,r],props:[{id:ae,role:"checkbox","aria-checked":Re?"mixed":fe,"aria-readonly":C||void 0,"aria-required":N||void 0,"aria-labelledby":Fe,[BB]:w?"":void 0,onFocus(){U||G(!0)},onBlur(){const rt=ke.current;rt&&(B(!0),G(!1),V==="onBlur"&&de.commit(X?ue:rt.checked))},onKeyDown(rt){var jt;if(rt.key!=="Enter"||(rt.preventBaseUIHandler(),rt.defaultPrevented))return;const be=((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),En(Ue).queueMicrotask(()=>{var Ze;rt.preventDefault=xt,Qe.preventDefault=Ke,Be||(Ze=yB(be))==null||Ze.click()})},onClick(rt){if(C||U)return;rt.preventDefault();const be=ke.current;be&&mu(be,rt)}},R,pe,Ce,L,rt=>de.getValidationProps(U,rt)],stateAttributesMapping:Je}),At=ct.props.id;return We(()=>{if(!(!Me||w||K===void 0||At===void 0))return Me(K,At)},[Me,w,K,At]),n.jsxs(GO.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=HA();const UB=BA(go);function ow(e){x.useEffect(e,Vr)}const Dh=null;class HB{constructor(){an(this,"callbacks",[]);an(this,"callbacksCount",0);an(this,"nextId",1);an(this,"startId",1);an(this,"isScheduled",!1);an(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 zh=new HB;class wr{constructor(){an(this,"currentId",Dh);an(this,"cancel",()=>{this.currentId!==Dh&&(zh.cancel(this.currentId),this.currentId=Dh)});an(this,"disposeEffect",()=>this.cancel)}static create(){return new wr}static request(t){return zh.request(t)}static cancel(t){return zh.cancel(t)}request(t){this.cancel(),this.currentId=zh.request(()=>{this.currentId=Dh,t()})}}function Tu(){const e=bs(wr.create).current;return ow(e.disposeEffect),e}function _a(e){return e==null?e:"current"in e?e.current:e}const aw="data-starting-style",FB="data-ending-style";let Ih=null;function GB(e){if(!Ih){const t=[];Ih=t,queueMicrotask(()=>{Ih=null,go.flushSync(()=>{for(const r of t)r()})})}Ih.push(e)}function Gf(e,t=!1,r=!1){const a=Tu();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}GB(()=>{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=aw;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 qB={[aw]:""},YB={[FB]:""},si={transitionStatus(e){return e==="starting"?qB:e==="ending"?YB:null}},KB=x.forwardRef(function(t,r){const{render:a,className:i,style:c,keepMounted:u=!1,...f}=t,m=LB(),h=m.checked||m.indeterminate,{mounted:g,transitionStatus:p,setMounted:b}=ni(h),y=x.useRef(null),w={...m,transitionStatus:p};Sr({batch:!0,enabled:!h,open:h,ref:y,onComplete(){h||b(!1)}});const S={...HO(m),...si},N=u||g,E=Nt("span",t,{ref:[r,y],state:w,stateAttributesMapping:S,props:f});return N?E:null});function $o({className:e,...t}){return n.jsx(VB,{"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(KB,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:n.jsx(Yn,{})})})}const XO=x.createContext(void 0);function hc(e){const t=x.useContext(XO);if(!e&&t===void 0)throw new Error(sn(27));return t}const XB="data-open",WB="data-closed",QB="data-anchor-hidden",WO="data-popup-open",ZB="data-pressed",JB={[WO]:""},e8={[WO]:"",[ZB]:""},t8={[XB]:""},n8={[WB]:""},s8={[QB]:""},iw={open(e){return e?JB:null}},Xp={open(e){return e?e8:null}},qf={open(e){return e?t8:n8},anchorHidden(e){return e?s8:null}},Hg={...qf,...si},lw=x.forwardRef(function(t,r){const{render:a,className:i,style:c,forceRender:u=!1,...f}=t,m=hc(),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=hc(),g=h.useState("open"),{getButtonProps:p,buttonRef:b}=bo({disabled:u,native:f}),y={disabled:u};function w(C){g&&h.setOpen(!1,vt(qO,C.nativeEvent))}return Nt("button",t,{state:y,ref:[r,b],props:[{onClick:w},m,p]})}),cw=x.forwardRef(function(t,r){const{render:a,className:i,style:c,id:u,...f}=t,m=hc(),h=vs(u);return m.useSyncedValueWithCleanup("descriptionElementId",h),Nt("p",t,{ref:r,props:[{id:h},f]})}),Bd=0;class xo{constructor(){an(this,"currentId",Bd);an(this,"clear",()=>{this.currentId!==Bd&&(clearTimeout(this.currentId),this.currentId=Bd)});an(this,"disposeEffect",()=>this.clear)}static create(){return new xo}start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Bd,r()},t)}isStarted(){return this.currentId!==Bd}}function us(){const e=bs(xo.create).current;return ow(e.disposeEffect),e}function r8(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:o8,platform:a8,maxTouchPoints:i8}=r8(),Gg=o8.toLowerCase(),xf=a8.toLowerCase(),qg=/^i(os$|p)/.test(xf)||xf==="macintel"&&i8>1,Vk="android",Ev=xf===Vk||Gg.includes(Vk),uw=!qg&&xf.startsWith("mac");xf.startsWith("win");const l8=uw||qg;var $A;const ri=typeof CSS<"u"&&!!(($A=CSS.supports)!=null&&$A.call(CSS,"-webkit-backdrop-filter:none"));!ri&&Gg.includes("firefox");!ri&&Gg.includes("chrom");const c8=l8,dw=/jsdom|happydom/.test(Gg);function ta(e){e.preventDefault(),e.stopPropagation()}function u8(e){return"nativeEvent"in e}function Yg(e){return e.pointerType===""&&e.isTrusted?!0:Ev&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function fw(e){return dw?!1:!Ev&&e.width===0&&e.height===0||Ev&&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 d8(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&&ku(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 Rv="data-base-ui-focusable",QO="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Kg="ArrowLeft",Xg="ArrowRight",ZO="ArrowUp",mw="ArrowDown",Av="data-trigger-disabled";function Wp(e,t){if(!Ft(e))return!1;const r=e;if(t.hasElement(r))return!r.hasAttribute(Av);for(const[,a]of t.entries())if(gt(a,r))return!a.hasAttribute(Av);return!1}function vy(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 f8(e){return e.matches("html,body")}function Wg(e){return wn(e)&&e.matches(QO)}function m8(e){return(e==null?void 0:e.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${QO}`))!=null}function Ov(e){return e?e.getAttribute("role")==="combobox"&&Wg(e):!1}function h8(e){if(!e||dw)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Qp(e){return e?e.hasAttribute(Rv)?e:e.querySelector(`[${Rv}]`)||e:null}function p8(e,t){return t!=null&&!Hi(t)?0:typeof e=="function"?e():e}function rc(e,t,r){const a=p8(e,r);return typeof a=="number"?a:a==null?void 0:a[t]}function Uk(e){return typeof e=="function"?e():e}function JO(e,t){return t||e==="click"||e==="mousedown"}function g8(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}const e5=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new xo,currentIdRef:{current:null},currentContextRef:{current:null}});function x8(e,t){e.current=t.current}function b8(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(e5.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:c,currentIdRef:u,timeoutMs:a,currentContextRef:f,timeout:m}),[a,m]),children:t})}function y8(e,t={open:!1}){const{open:r}=t,a="rootStore"in e?e.rootStore:e,i=a.useState("floatingId"),c=x.useContext(e5),{currentIdRef:u,delayRef:f,timeoutMs:m,initialDelayRef:h,currentContextRef:g,hasProvider:p,timeout:b}=c,[y,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,vt(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,x8(f,h),b.clear()}},[g,u,f,i,h,b]),x.useMemo(()=>({activeIdRef:u,hasProvider:p,delayRef:f,isInstantPhase:y}),[u,p,f,y])}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(v8,e).current;return t.next=e,We(t.effect),t}function v8(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(()=>{c8&&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":""})}),Eu=Math.min,Fa=Math.max,Zp=Math.round,Ph=Math.floor,Ga=e=>({x:e,y:e}),w8={left:"right",right:"left",bottom:"top",top:"bottom"};function t5(e,t,r){return Fa(e,Eu(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 hw(e){return e==="x"?"y":"x"}function pw(e){return e==="y"?"height":"width"}function co(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function gw(e){return hw(co(e))}function j8(e,t,r){r===void 0&&(r=!1);const a=Xa(e),i=gw(e),c=pw(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 S8(e){const t=Jp(e);return[Mv(e),t,Mv(t)]}function Mv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Hk=["left","right"],Fk=["right","left"],N8=["top","bottom"],C8=["bottom","top"];function k8(e,t,r){switch(e){case"top":case"bottom":return r?t?Fk:Hk:t?Hk:Fk;case"left":case"right":return t?N8:C8;default:return[]}}function T8(e,t,r,a){const i=Xa(e);let c=k8(uo(e),r==="start",a);return i&&(c=c.map(u=>u+"-"+i),t&&(c=c.concat(c.map(Mv)))),c}function Jp(e){const t=uo(e);return w8[t]+e.slice(t.length)}function E8(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 n5(e){return typeof e!="number"?E8(e):{top:e,right:e,bottom:e,left:e}}function bf(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 nf(e,t){return t<0||t>=e.length}function bp(e,t){return Ba(e.current,{disabledIndices:t})}function Dv(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 R8(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Qg(e,t=e?Br(e):null){return!e||!e.isConnected||!t||R8(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const A8='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function O8(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const r=e.getRootNode();return ku(r)?r.host:null}function zv(e){for(const t of Array.from(e.children))if(Us(t)==="summary")return t;return null}function M8(e,t){const r=zv(t);return!!r&&(e===r||gt(r,e))}function s5(e){const t=e?Us(e):"";return e!=null&&e.matches(A8)&&(t!=="summary"||e.parentElement!=null&&Us(e.parentElement)==="details"&&zv(e.parentElement)===e)&&(t!=="details"||zv(e)==null)&&(t!=="input"||e.type!=="hidden")}function r5(e){if(!s5(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=O8(t)){const r=t!==e,a=Us(t)==="slot";if(t.hasAttribute("inert")||r&&Us(t)==="details"&&!t.open&&!M8(e,t)||t.hasAttribute("hidden")||!a&&!D8(t,r))return!1}return!0}function D8(e,t){const r=Br(e);return t?r.display!=="none":Qg(e,r)}function o5(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 wy(e){if(Us(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function z8(e,t){const r=wy(e);if(!r)return!0;const a=t.find(i=>{const c=wy(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=wy(i);return(c==null?void 0:c.name)===r.name&&c.form===r.form})===r}function a5(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 i5(e,t){a5(e).forEach(r=>{s5(r)&&t.push(r),i5(r,t)})}function l5(e,t,r){a5(e).forEach(a=>{wn(a)&&a.matches(t)&&r.push(a),l5(a,t,r)})}function xw(e){return r5(e)&&o5(e)>=0}function c5(e){const t=[];return i5(e,t),t.filter(r5)}function Yf(e){const t=c5(e);return t.filter(r=>o5(r)>=0&&z8(r,t))}function u5(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 bw(e){return u5(Ht(e).body,1)||e}function d5(e){return u5(Ht(e).body,-1)||e}function f5(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 I8(e){return f5(e,1)}function P8(e){return f5(e,-1)}function bu(e,t){const r=t||e.currentTarget,a=e.relatedTarget;return!a||!gt(r,a)}function _8(e){Yf(e).forEach(r=>{r.dataset.tabindex=r.getAttribute("tabindex")||"",r.setAttribute("tabindex","-1")})}function Gk(e){const t=[];l5(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 _h=0;function yp(e,t={}){const{preventScroll:r=!1,sync:a=!1,shouldFocus:i}=t;cancelAnimationFrame(_h);function c(){i&&!i()||e==null||e.focus({preventScroll:r})}if(a)return c(),Ln;const u=requestAnimationFrame(c);return _h=u,()=>{_h===u&&(cancelAnimationFrame(u),_h=0)}}const jy={inert:new WeakMap,"aria-hidden":new WeakMap},Yk="data-base-ui-inert",Iv={inert:new WeakSet,"aria-hidden":new WeakSet};let Vd=new WeakMap,Sy=0;function L8(e){return Iv[e]}function m5(e){return e?ku(e)?e.host:m5(e.parentNode):null}const Kk=(e,t)=>t.map(r=>{if(e.contains(r))return r;const a=m5(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 $8(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=jy[c],y=L8(c);f=y,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),k=E!==null&&E!=="false",A=(b.get(N)||0)+1;b.set(N,A),g.push(N),A===1&&k&&y.add(N),k||N.setAttribute(c,c==="inert"?"":"true")})}return i&&h.forEach(b=>{const y=(Vd.get(b)||0)+1;Vd.set(b,y),p.push(b),y===1&&b.setAttribute(Yk,"")}),Sy+=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 y=(Vd.get(b)||0)-1;Vd.set(b,y),y||b.removeAttribute(Yk)}),Sy-=1,Sy||(jy.inert=new WeakMap,jy["aria-hidden"]=new WeakMap,Iv.inert=new WeakSet,Iv["aria-hidden"]=new WeakSet,Vd=new WeakMap)}}function Qk(e,t={}){const{ariaHidden:r=!1,inert:a=!1,mark:i=!0}=t,c=Ht(e[0]).body;return $8(e,c,r,a,{mark:i})}const B8=500,h5=500,V8={style:{transition:"none"}},p5="data-base-ui-click-trigger",g5={fallbackAxisSide:"none"},yw={fallbackAxisSide:"end"},U8={clipPath:"inset(50%)",position:"fixed",top:0,left:0},x5=x.createContext(null),b5=()=>x.useContext(x5),H8=yf("portal");function y5(e={}){const{ref:t,container:r,componentProps:a=Tn,elementProps:i}=e,c=sc(),u=b5(),f=u==null?void 0:u.portalNode,[m,h]=x.useState(null),[g,p]=x.useState(null),b=st(S=>{S!==null&&p(S)}),y=x.useRef(null);We(()=>{if(r===null){y.current&&(y.current=null,p(null),h(null));return}const S=(r&&($1(r)?r:r.current))??f??document.body;if(S==null){y.current&&(y.current=null,p(null),h(null));return}y.current!==S&&(y.current=S,p(null),h(S))},[r,f]);const w=Nt("div",a,{ref:[t,b],props:[{id:c,[H8]:""},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}=y5({container:f,ref:r,componentProps:t,elementProps:h}),y=x.useRef(null),w=x.useRef(null),C=x.useRef(null),S=x.useRef(null),[N,E]=x.useState(null),k=x.useRef(!1),A=N==null?void 0:N.modal,O=N==null?void 0:N.open,R=!!N&&!N.modal&&N.open&&!!g;x.useEffect(()=>{if(!g||A)return;function M(D){g&&D.relatedTarget&&bu(D)&&(D.type==="focusin"?k.current&&(Gk(g),k.current=!1):(_8(g),k.current=!0))}return oa($t(g,"focusin",M,!0),$t(g,"focusout",M,!0))},[g,A]),We(()=>{!g||O!==!0||!k.current||(Gk(g),k.current=!1)},[O,g]);const T=x.useMemo(()=>({beforeOutsideRef:y,afterOutsideRef:w,beforeInsideRef:C,afterInsideRef:S,portalNode:g,setFocusManagerState:E}),[g]);return n.jsxs(x.Fragment,{children:[b,n.jsxs(x5.Provider,{value:T,children:[R&&g&&n.jsx(el,{"data-type":"outside",ref:y,onFocus:M=>{var D;if(bu(M,g))(D=C.current)==null||D.focus();else{const _=N?N.domReference:null,H=d5(_);H==null||H.focus()}}}),R&&g&&n.jsx("span",{role:m,"aria-owns":p,style:U8}),g&&go.createPortal(u,g),R&&g&&n.jsx(el,{"data-type":"outside",ref:w,onFocus:M=>{var D;if(bu(M,g))(D=S.current)==null||D.focus();else{const _=N?N.domReference:null,H=bw(_);H==null||H.focus(),N!=null&&N.closeOnFocusOut&&(N==null||N.onOpenChange(!1,vt(Ji,M.nativeEvent)))}}})]})]})});function v5(){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 vw{constructor(){an(this,"nodesRef",{current:[]});an(this,"events",v5())}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 w5=x.createContext(null),j5=x.createContext(null),ol=()=>{var e;return((e=x.useContext(w5))==null?void 0:e.id)||null},al=e=>{const t=x.useContext(j5);return e??t};function ww(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 S5(e){const{children:t,id:r}=e,a=ol();return n.jsx(w5.Provider,{value:x.useMemo(()=>({id:r,parentId:a}),[r,a]),children:t})}function N5(e){const{children:t,externalTree:r}=e,a=bs(()=>r??new vw).current;return n.jsx(j5.Provider,{value:a,children:t})}function F8(e,t){const r=En(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 jw(){Vi=Vi.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function Jk(e){jw(),e&&Us(e)!=="body"&&(Vi.push(new WeakRef(e)),Vi.length>Zk&&(Vi=Vi.slice(-Zk)))}function eT(){var e;return jw(),(e=Vi[Vi.length-1])==null?void 0:e.deref()}function G8(e){return e?xw(e)?e:Yf(e)[0]||e:null}function tT(e){var i;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!((i=e.getAttribute("role"))!=null&&i.includes("dialog")))return;const r=c5(e).filter(c=>{const u=c.getAttribute("data-tabindex")||"";return xw(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:y,getInsideElements:w}=e,C="rootStore"in t?t.rootStore:t,S=C.useState("open"),N=C.useState("domReferenceElement"),E=C.useState("floatingElement"),{events:k,dataRef:A}=C.context,O=st(()=>{var le;return(le=A.current.floatingContext)==null?void 0:le.nodeId}),R=i===!1,T=Ov(N)&&R,M=qn(i),D=qn(c),_=qn(h),H=qn(S),G=al(y),B=b5(),P=x.useRef(!1),V=x.useRef(!1),Y=x.useRef(!1),W=x.useRef(null),q=x.useRef(""),ee=x.useRef(""),z=x.useRef(null),L=x.useRef(null),X=ho(z,b,B==null?void 0:B.beforeInsideRef),te=ho(L,B==null?void 0:B.afterInsideRef),$=us(),U=us(),F=Tu(),K=B!=null,se=Qp(E),ne=st((le=se)=>le?Yf(le):[]),ve=st(()=>(w==null?void 0:w().filter(le=>le!=null))??[]);x.useEffect(()=>{if(a||!f)return;function le(Q){Q.key==="Tab"&>(se,Xs(Ht(se)))&&ne().length===0&&!T&&ta(Q)}const re=Ht(se);return $t(re,"keydown",le)},[a,se,f,T,ne]),x.useEffect(()=>{if(a||!S)return;const le=Ht(se);function re(){Y.current=!1}function Q(pe){const ue=Vs(pe),ye=ve(),Ce=gt(E,ue)||gt(N,ue)||gt(B==null?void 0:B.portalNode,ue)||ye.some(Ie=>Ie===ue||gt(Ie,ue));Y.current=!Ce,ee.current=pe.pointerType||"keyboard",ue!=null&&ue.closest(`[${p5}]`)&&(V.current=!0,U.start(0,()=>{V.current=!1}))}function Z(){ee.current="keyboard"}return oa($t(le,"pointerdown",Q,!0),$t(le,"pointerup",re,!0),$t(le,"pointercancel",re,!0),$t(le,"keydown",Z,!0),re)},[a,E,N,se,S,B,U,ve]),x.useEffect(()=>{if(a||!m)return;const le=Ht(se);function re(){V.current=!0,U.start(0,()=>{V.current=!1})}function Q(ye){const Ce=Vs(ye);xw(Ce)&&(W.current=Ce)}function Z(ye){const Ce=ye.relatedTarget,Ie=ye.currentTarget,de=Vs(ye);f&&Ce==null&&de!=null&>(E,de)&&Jk(de),queueMicrotask(()=>{const Te=O(),oe=C.context.triggerElements,fe=ve(),Re=(Ce==null?void 0:Ce.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(Ce),Me=!(gt(N,Ce)||gt(E,Ce)||gt(Ce,E)||gt(B==null?void 0:B.portalNode,Ce)||fe.some(ke=>ke===Ce||gt(ke,Ce))||oe.hasMatchingElement(ke=>gt(ke,Ce))||Re||G&&(nl(G.nodesRef.current,Te).find(ke=>{var me,Ae;return gt((me=ke.context)==null?void 0:me.elements.floating,Ce)||gt((Ae=ke.context)==null?void 0:Ae.elements.domReference,Ce)})||qk(G.nodesRef.current,Te).find(ke=>{var me,Ae,ge;return[(me=ke.context)==null?void 0:me.elements.floating,Qp((Ae=ke.context)==null?void 0:Ae.elements.floating)].includes(Ce)||((ge=ke.context)==null?void 0:ge.elements.domReference)===Ce})));if(Ie===N&&se&&tT(se),u&&Ie!==N&&!Qg(de)&&Xs(le)===le.body){if(wn(se)&&(se.focus(),u==="popup")){F.request(()=>{se.focus()});return}const ke=ne(),me=W.current,Ae=(me&&ke.includes(me)?me:null)||ke[ke.length-1]||se;wn(Ae)&&Ae.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(T||!f)&&Ce&&Me&&!V.current&&(T||Ce!==eT())&&(P.current=!0,C.setOpen(!1,vt(Ji,ye)))})}function pe(){Y.current||(A.current.insideReactTree=!0,$.start(0,()=>{A.current.insideReactTree=!1}))}const ue=wn(N)?N:null;if(!(!E&&!ue))return oa(ue&&$t(ue,"focusout",Z),ue&&$t(ue,"pointerdown",re),E&&$t(E,"focusin",Q),E&&$t(E,"focusout",Z),E&&B&&$t(E,"focusout",pe,!0))},[a,N,E,se,f,G,B,C,m,u,ne,T,O,A,$,U,F,g,p,ve]),x.useEffect(()=>{var Ie,de,Te;if(a||!E||!S)return;const le=Array.from(((Ie=B==null?void 0:B.portalNode)==null?void 0:Ie.querySelectorAll(`[${yf("portal")}]`))||[]),Q=(Te=(de=(G?qk(G.nodesRef.current,O()):[]).find(oe=>{var fe;return Ov(((fe=oe.context)==null?void 0:fe.elements.domReference)||null)}))==null?void 0:de.context)==null?void 0:Te.elements.domReference,pe=[...[E,...le,z.current,L.current,B==null?void 0:B.beforeOutsideRef.current,B==null?void 0:B.afterOutsideRef.current,...ve()],Q,_a(p),_a(g),T?N:null].filter(oe=>oe!=null),ue=Qk(pe,{ariaHidden:f||T,mark:!1}),ye=[E,...le].filter(oe=>oe!=null),Ce=Qk(ye);return()=>{Ce(),ue()}},[S,a,N,E,f,B,T,G,O,g,p,ve]),We(()=>{if(!S||a||!wn(se))return;q.current="",ee.current="";const le=Ht(se),re=Xs(le);queueMicrotask(()=>{const Q=M.current,Z=typeof Q=="function"?Q(_.current||""):Q;if(Z===void 0||Z===!1||gt(se,re))return;let ue=null;const ye=()=>(ue==null&&(ue=ne(se)),ue[0]||se);let Ce;Z===!0||Z===null?Ce=ye():Ce=_a(Z),Ce=Ce||ye();const Ie=gt(se,Xs(le));yp(Ce,{preventScroll:Ce===se,shouldFocus(){if(!H.current)return!1;if(Ie)return!0;const de=Xs(le);return!(de!==Ce&>(se,de))}})})},[a,S,se,ne,M,_,H]),We(()=>{if(a||!se)return;const le=Ht(se),re=Xs(le),Q=_.current==null;Jk(re);function Z(ue){if(ue.open||(q.current=F8(ue.nativeEvent,ee.current)),ue.reason===Qn&&ue.nativeEvent.type==="mouseleave"&&(P.current=!0),ue.reason===Vg)if(ue.nested)P.current=!1;else if(Yg(ue.nativeEvent)||fw(ue.nativeEvent))P.current=!1;else{let ye=!1;Ht(se).createElement("div").focus({get preventScroll(){return ye=!0,!1}}),ye?P.current=!1:P.current=!0}}k.on("openchange",Z);function pe(ue){const ye=D.current;let Ce=typeof ye=="function"?ye(ue):ye;if(Ce===void 0||Ce===!1)return null;Ce===null&&(Ce=!0);const Ie=N!=null&&N.isConnected?N:null,de=re!=null&&re.isConnected&&Us(re)!=="body"?re:null;let Te=Q?de||Ie:Ie||de;return Te||(Te=eT()||null),typeof Ce=="boolean"?Te:_a(Ce)||Te||null}return()=>{k.off("openchange",Z);const ue=Xs(le),ye=ve(),Ce=gt(E,ue)||ye.some(oe=>oe===ue||gt(oe,ue))||G&&nl(G.nodesRef.current,O(),!1).some(oe=>{var fe;return gt((fe=oe.context)==null?void 0:fe.elements.floating,ue)}),Ie=D.current,de=q.current,Te=pe(de);queueMicrotask(()=>{const oe=G8(Te),fe=typeof Ie!="boolean";if(Ie&&!P.current&&wn(oe)&&(!(!fe&&oe!==ue&&ue!==le.body)||Ce)){const Re={preventScroll:!0};de==="keyboard"&&(Re.focusVisible=!0),oe.focus(Re)}P.current=!1})}},[a,E,se,D,_,k,G,N,O,ve]),We(()=>{if(!ri||S||!E)return;const le=Xs(Ht(E));!wn(le)||!Wg(le)||gt(E,le)&&le.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||!se))return tT(se),()=>{queueMicrotask(jw)}},[a,se]);const ae=!a&&(f?!T:!0)&&(K||f);return n.jsxs(x.Fragment,{children:[ae&&n.jsx(el,{"data-type":"inside",ref:X,onFocus:le=>{var re;if(f){const Q=ne();yp(Q[Q.length-1])}else if(B!=null&&B.portalNode)if(P.current=!1,bu(le,B.portalNode)){const Q=bw(N);Q==null||Q.focus()}else(re=_a(p??B.beforeOutsideRef))==null||re.focus()}}),r,ae&&n.jsx(el,{"data-type":"inside",ref:te,onFocus:le=>{var re;if(f)yp(ne()[0]);else if(B!=null&&B.portalNode)if(m&&(P.current=!0),bu(le,B.portalNode)){const Q=d5(N);Q==null||Q.focus()}else(re=_a(g??B.afterOutsideRef))==null||re.focus()}})]})}function Sw(e,t={}){const{enabled:r=!0,event:a="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:f=0,reason:m=ha}=t,h="rootStore"in e?e.rootStore:e,g=h.context.dataRef,p=x.useRef(void 0),b=Tu(),y=us(),w=x.useMemo(()=>{function C(N,E,k,A){const O=vt(m,E,k);N&&A==="touch"&&f>0?y.start(f,()=>{h.setOpen(!0,O)}):h.setOpen(N,O)}function S(N,E,k){const A=g.current.openEvent,O=h.select("domReferenceElement")!==E;return N&&O||!N||!i?!0:A&&u?!k(A.type):!1}return{onPointerDown(N){p.current=Hi(N.pointerType,!0)&&fw(N.nativeEvent)?"virtual":N.pointerType},onMouseDown(N){const E=p.current,k=N.nativeEvent,A=h.select("open");if(N.button!==0||a==="click"||Hi(E,!0)&&c)return;const O=S(A,N.currentTarget,M=>M==="click"||M==="mousedown"),R=Vs(k);if(Wg(R)){C(O,k,R,E);return}const T=N.currentTarget;b.request(()=>{C(O,k,T,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 k=h.select("open"),A=S(k,N.currentTarget,O=>O==="click"||O==="mousedown"||O==="keydown"||O==="keyup");C(A,N.nativeEvent,N.currentTarget,E)},onKeyDown(){p.current=void 0}}},[g,a,c,m,h,u,i,b,y,f]);return x.useMemo(()=>r?{reference:w}:Tn,[r,w])}function q8(e,t){let r=null,a=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){var y;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(((y=t.dataRef.current.openEvent)==null?void 0:y.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 nT(e){return e!=null&&e.clientX!=null}function Y8(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(),[y,w]=x.useState([]),C=st(A=>{i.set("positionReference",A)}),S=st((A,O,R)=>{h.current||m.current.openEvent&&!nT(m.current.openEvent)||i.set("positionReference",q8(R??f,{x:A,y:O,axis:a,dataRef:m,pointerType:p}))}),N=st(A=>{c?g.current||(S(A.clientX,A.clientY,A.currentTarget),w([])):S(A.clientX,A.clientY,A.currentTarget)}),E=Hi(p)?u:c;x.useEffect(()=>{if(!r){C(f);return}if(!E)return;function A(){var T;(T=g.current)==null||T.call(g),g.current=null}const O=En(u);function R(T){const M=Vs(T);gt(u,M)?A():S(T.clientX,T.clientY)}return!m.current.openEvent||nT(m.current.openEvent)?g.current=$t(O,"mousemove",R):C(f),A},[E,r,u,m,f,i,S,C,y]),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 k=x.useMemo(()=>{function A(O){b(O.pointerType)}return{onPointerDown:A,onPointerEnter:A,onMouseMove:N,onMouseEnter:N}},[N]);return x.useMemo(()=>r?{reference:k,trigger:k}:{},[r,k])}function K8(){return!1}function X8(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=K8,bubbles:f,externalTree:m}=t,h="rootStore"in e?e.rootStore:e,g=h.useState("open"),p=h.useState("floatingElement"),{dataRef:b,events:y}=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:k,outsidePress:A}=X8(f),O=x.useRef(!1),R=x.useRef(!1),T=x.useRef(!1),M=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 K;const U=(K=b.current.floatingContext)==null?void 0:K.nodeId;return(w?nl(w.nodesRef.current,U):[]).some(se=>{var ne;return((ne=se.context)==null?void 0:ne.open)&&!se.context.dataRef.current[$]})}),Y=st($=>vy($,h.select("floatingElement"))||vy($,h.select("domReferenceElement"))),W=st($=>{u()&&h.setOpen(!1,vt(ha,$.nativeEvent))}),q=st($=>{if(!g||!r||!a||$.key!=="Escape"||D.current||!k&&V("__escapeKeyBubbles"))return;const U=u8($)?$.nativeEvent:$,F=vt(Hf,U);h.setOpen(!1,F),F.isCanceled||$.preventDefault(),!k&&!F.isPropagationAllowed&&$.stopPropagation()}),ee=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)&&(O.current||(O.current=!0,R.current=!1))}),L=st($=>{!g||!r||($.defaultPrevented||$.nativeEvent.defaultPrevented)&&O.current&&(R.current=!0)});x.useEffect(()=>{function $(U){U.open||(M.current=!1)}return y.on("openchange",$),()=>{y.off("openchange",$)}},[y]),x.useEffect(()=>{if(!g||!r)return g||(M.current=!1),P;b.current.__escapeKeyBubbles=k,b.current.__outsidePressBubbles=A;const $=new xo,U=new xo,F=Ht(p);function K(){$.clear(),D.current=!0}function se(){$.start(ri?5:0,()=>{D.current=!1})}function ne(){T.current=!0,U.start(0,()=>{T.current=!1})}function ve(){O.current=!1,R.current=!1}function ae(){const Me=_.current,ke=Me==="pen"||!Me?"mouse":Me,me=E(),Ae=typeof me=="function"?me():me;return typeof Ae=="string"?Ae:Ae[ke]}function le(Me){const ke=ae();return ke==="intentional"&&Me.type!=="click"||ke==="sloppy"&&Me.type==="click"}function re(Me){var Ae;const ke=(Ae=b.current.floatingContext)==null?void 0:Ae.nodeId,me=w&&nl(w.nodesRef.current,ke).some(ge=>{var Pe;return vy(Me,(Pe=ge.context)==null?void 0:Pe.elements.floating)});return Y(Me)||me}function Q(Me){if(le(Me)){Me.type!=="click"&&!Y(Me)&&(U.clear(),T.current=!1),P();return}if(b.current.insideReactTree){P();return}const ke=Vs(Me),me=`[${yf("inert")}]`,Ae=Ft(ke)?ke.getRootNode():null,ge=Array.from((ku(Ae)?Ae:Ht(h.select("floatingElement"))).querySelectorAll(me)),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)&&!f8(ke)&&!gt(ke,h.select("floatingElement"))&&ge.every(_e=>!gt(Fe,_e)))){if(wn(ke)&&!("touches"in Me)){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,be=At&&ke.clientHeight>0&&ke.scrollHeight>ke.clientHeight,Ue=Xe.direction==="rtl",Qe=be&&(Ue?Me.offsetX<=ke.offsetWidth-ke.clientWidth:Me.offsetX>ke.clientWidth),xt=rt&&Me.offsetY>ke.clientHeight;if(Qe||xt)return}if(!re(Me)){if(ae()==="intentional"){if(Me.detail!==0&&!Yg(Me)&&!M.current)return;if(T.current){U.clear(),T.current=!1;return}}typeof S=="function"&&!S(Me)||V("__outsidePressBubbles")||(h.setOpen(!1,vt(Vg,Me)),P())}}}function Z(Me){ae()!=="sloppy"||Me.pointerType==="touch"||!h.select("open")||!r||Y(Me)||Q(Me)}function pe(Me){if(ae()!=="sloppy"||!h.select("open")||!r||Y(Me))return;const ke=Me.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 ue(Me,ke){const me=Vs(Me);if(!me)return;const Ae=$t(me,Me.type,()=>{ke(Me),Ae()})}function ye(Me){_.current="touch",ue(Me,pe)}function Ce(Me){G.clear(),Me.type==="pointerdown"&&(Me.button===0&&(M.current=!0),_.current=Me.pointerType),!(Me.type==="mousedown"&&H.current&&!H.current.dismissOnMouseDown)&&ue(Me,ke=>{ke.type==="pointerdown"?Z(ke):Q(ke)})}function Ie(Me){if(Me.type==="pointercancel"&&(M.current=!1),!O.current)return;const ke=R.current;if(ve(),ae()==="intentional"){if(Me.type==="pointercancel"){ke&&ne();return}if(!re(Me)){if(ke){ne();return}typeof S=="function"&&!S(Me)||(U.clear(),T.current=!0,P())}}}function de(Me){if(ae()!=="sloppy"||!H.current||Y(Me))return;const ke=Me.touches[0];if(!ke)return;const me=Math.abs(ke.clientX-H.current.startX),Ae=Math.abs(ke.clientY-H.current.startY),ge=Math.sqrt(me*me+Ae*Ae);ge>5&&(H.current.dismissOnTouchEnd=!0),ge>10&&(Q(Me),G.clear(),H.current=null)}function Te(Me){ue(Me,de)}function oe(Me){ae()!=="sloppy"||!H.current||Y(Me)||(H.current.dismissOnTouchEnd&&Q(Me),G.clear(),H.current=null)}function fe(Me){ue(Me,oe)}const Re=oa(a&&oa($t(F,"keydown",q),$t(F,"compositionstart",K),$t(F,"compositionend",se)),N&&oa($t(F,"click",Ce,!0),$t(F,"pointerdown",Ce,!0),$t(F,"pointerup",Ie,!0),$t(F,"pointercancel",Ie,!0),$t(F,"mousedown",Ce,!0),$t(F,"mouseup",Ie,!0),$t(F,"touchstart",ye,{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(),ve(),T.current=!1,P()}},[b,p,a,N,S,g,r,k,A,q,P,E,V,Y,w,h,G]);const X=x.useMemo(()=>({onKeyDown:q,onPointerDown:W,onClick:W}),[q,W]),te=x.useMemo(()=>({onKeyDown:q,onPointerDown:L,onMouseDown:L,onClickCapture:ee,onMouseDownCapture($){ee(),z($)},onPointerDownCapture($){ee(),z($)},onMouseUpCapture:ee,onTouchEndCapture:ee,onTouchMoveCapture:ee}),[q,ee,z,L]);return x.useMemo(()=>r?{reference:X,floating:te,trigger:X}:{},[r,X,te])}function sT(e,t,r){let{reference:a,floating:i}=e;const c=co(t),u=gw(t),f=pw(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 y;switch(m){case"top":y={x:g,y:a.y-i.height};break;case"bottom":y={x:g,y:a.y+a.height};break;case"right":y={x:a.x+a.width,y:p};break;case"left":y={x:a.x-i.width,y:p};break;default:y={x:a.x,y:a.y}}const w=Xa(t);return w&&(y[u]+=b*(w==="end"?1:-1)*(r&&h?-1:1)),y}async function W8(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:y=0}=tl(t,e),w=n5(y),S=f[b?p==="floating"?"reference":"floating":p],N=bf(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,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),A=await(c.isElement==null?void 0:c.isElement(k))&&await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1},O=bf(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:E,offsetParent:k,strategy:m}):E);return{top:(N.top-O.top+w.top)/A.y,bottom:(O.bottom-N.bottom+w.bottom)/A.y,left:(N.left-O.left+w.left)/A.x,right:(O.right-N.right+w.right)/A.x}}const Q8=50,Z8=async(e,t,r)=>{const{placement:a="bottom",strategy:i="absolute",middleware:c=[],platform:u}=r,f=u.detectOverflow?u:{...u,detectOverflow:W8},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}=sT(h,a,m),b=a,y=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:k,y:A,data:O,reset:R}=await E({x:g,y:p,initialPlacement:a,placement:b,strategy:i,middlewareData:w,rects:h,platform:f,elements:{reference:e,floating:t}});g=k??g,p=A??p,w[N]={...w[N],...O},R&&y<Q8&&(y++,typeof R=="object"&&(R.placement&&(b=R.placement),R.rects&&(h=R.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):R.rects),{x:g,y:p}=sT(h,b,m)),C=-1)}return{x:g,y:p,placement:b,strategy:i,middlewareData:w}},J8=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:y="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),k=uo(f)===f,A=await(m.isRTL==null?void 0:m.isRTL(h.floating)),O=b||(k||!C?[Jp(f)]:S8(f)),R=w!=="none";!b&&R&&O.push(...T8(f,C,w,A));const T=[f,...O],M=await m.detectOverflow(t,S),D=[];let _=((a=c.flip)==null?void 0:a.overflows)||[];if(g&&D.push(M[N]),p){const P=j8(i,u,A);D.push(M[P[0]],M[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=T[P];if(V&&(!(p==="alignment"?E!==co(V):!1)||_.every(q=>co(q.placement)===E?q.overflows[0]>0:!0)))return{data:{index:P,overflows:_},reset:{placement:V}};let Y=(G=_.filter(W=>W.overflows[0]<=0).sort((W,q)=>W.overflows[1]-q.overflows[1])[0])==null?void 0:G.placement;if(!Y)switch(y){case"bestFit":{var B;const W=(B=_.filter(q=>{if(R){const ee=co(q.placement);return ee===E||ee==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(ee=>ee>0).reduce((ee,z)=>ee+z,0)]).sort((q,ee)=>q[1]-ee[1])[0])==null?void 0:B[0];W&&(Y=W);break}case"initialPlacement":Y=f;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}},C5=new Set(["left","top"]);async function eV(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=C5.has(u)?-1:1,g=c&&m?-1:1,p=tl(t,e);let{mainAxis:b,crossAxis:y,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"&&(y=f==="end"?w*-1:w),m?{x:y*g,y:b*h}:{x:b*h,y:y*g}}const tV=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 eV(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}}}}},nV=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:k,y:A}=E;return{x:k,y:A}}},...h}=tl(e,t),g={x:r,y:a},p=await c.detectOverflow(t,h),b=co(i),y=hw(b);let w=g[y],C=g[b];const S=(E,k)=>t5(k+p[E==="y"?"top":"left"],k,k-p[E==="y"?"bottom":"right"]);u&&(w=S(y,w)),f&&(C=S(b,C));const N=m.fn({...t,[y]:w,[b]:C});return{...N,data:{x:N.x-r,y:N.y-a,enabled:{[y]:u,[b]:f}}}}}},sV=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},y=co(u),w=hw(y);let C=b[w],S=b[y];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 O=w==="y"?"height":"width",R=f.reference[w]-f.floating[O]+E.mainAxis,T=f.reference[w]+f.reference[O]-E.mainAxis;C<R?C=R:C>T&&(C=T)}if(p){var k,A;const O=w==="y"?"width":"height",R=C5.has(uo(u)),T=f.reference[y]-f.floating[O]+(R&&((k=m.offset)==null?void 0:k[y])||0)+(R?0:E.crossAxis),M=f.reference[y]+f.reference[O]+(R?0:((A=m.offset)==null?void 0:A[y])||0)-(R?E.crossAxis:0);S<T?S=T:S>M&&(S=M)}return{[w]:C,[y]:S}}}},rV=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:y}=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=y-m.top-m.bottom,N=b-m.left-m.right,E=Eu(y-m[w],S),k=Eu(b-m[C],N),A=t.middlewareData.shift,O=!A;let R=E,T=k;A!=null&&A.enabled.x&&(T=N),A!=null&&A.enabled.y&&(R=S),O&&!g&&(p?T=b-2*Fa(m.left,m.right):R=y-2*Fa(m.top,m.bottom)),await u({...t,availableWidth:T,availableHeight:R});const M=await i.getDimensions(c.floating);return b!==M.width||y!==M.height?{reset:{rects:!0}}:{}}}};function k5(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 Nw(e){return Ft(e)?e:e.contextElement}function yu(e){const t=Nw(e);if(!wn(t))return Ga(1);const r=t.getBoundingClientRect(),{width:a,height:i,$:c}=k5(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 oV=Ga(0);function T5(e){const t=En(e);return!V1()||!t.visualViewport?oV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function aV(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===En(e)}function oc(e,t,r,a){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),c=Nw(e);let u=Ga(1);t&&(a?Ft(a)&&(u=yu(a)):u=yu(e));const f=aV(c,r,a)?T5(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=En(c),y=Ft(a)?En(a):a;let w=b,C=yv(w);for(;C&&y!==w;){const S=yu(C),N=C.getBoundingClientRect(),E=Br(C),k=N.left+(C.clientLeft+parseFloat(E.paddingLeft))*S.x,A=N.top+(C.clientTop+parseFloat(E.paddingTop))*S.y;m*=S.x,h*=S.y,g*=S.x,p*=S.y,m+=k,h+=A,w=En(C),C=yv(w)}}return bf({width:g,height:p,x:m,y:h})}function ex(e,t){const r=Mg(e).scrollLeft;return t?t.left+r:oc(ei(e)).left+r}function E5(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 iV(e){let{elements:t,rect:r,offsetParent:a,strategy:i}=e;const c=i==="fixed",u=ei(a),f=t?Og(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=Mg(a)),p)){const y=oc(a);h=yu(a),g.x=y.x+a.clientLeft,g.y=y.y+a.clientTop}const b=u&&!p&&!c?E5(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 lV(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function cV(e){const t=Mg(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 uV=25;function dV(e,t,r){r===void 0&&(r="viewport");const a=r==="layoutViewport",i=En(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,y=b.body,w=getComputedStyle(y),C=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,S=Math.abs(c.clientWidth-y.clientWidth-C),N=getComputedStyle(c).scrollbarGutter==="stable both-edges"?S/2:S;N<=uV&&(f-=N)}return{width:f,height:m,x:h,y:g}}function fV(e,t){const r=oc(e,!0,t==="fixed"),a=r.top+e.clientTop,i=r.left+e.clientLeft,c=yu(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 rT(e,t,r){let a;if(t==="viewport"||t==="layoutViewport")a=dV(e,r,t);else if(t==="document")a=cV(ei(e));else if(Ft(t))a=fV(t,r);else{const i=T5(e);a={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return bf(a)}function mV(e,t){const r=t.get(e);if(r)return r;let a=hf(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 hV(e){let{element:t,boundary:r,rootBoundary:a,strategy:i}=e;const u=[...r==="clippingAncestors"?Og(t)?[]:mV(t,this._c):[].concat(r),a],f=rT(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 y=rT(t,u[b],i);m=Fa(y.top,m),h=Eu(y.right,h),g=Eu(y.bottom,g),p=Fa(y.left,p)}return{width:h-p,height:g-m,x:p,y:m}}function pV(e){const{width:t,height:r}=k5(e);return{width:t,height:r}}function gV(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=Mg(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?E5(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 Ny(e){return Br(e).position==="static"}function oT(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 R5(e,t){const r=En(e);if(Og(e))return r;if(!wn(e)){let i=Ya(e);for(;i&&!Ua(i);){if(Ft(i)&&!Ny(i))return i;i=Ya(i)}return r}let a=oT(e,t);for(;a&&o_(a)&&Ny(a);)a=oT(a,t);return a&&Ua(a)&&Ny(a)&&!B1(a)?r:a||l_(e)||r}const xV=async function(e){const t=this.getOffsetParent||R5,r=this.getDimensions,a=await r(e.floating);return{reference:gV(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function bV(e){return Br(e).direction==="rtl"}const A5={convertOffsetParentRelativeRectToViewportRelativeRect:iV,getDocumentElement:ei,getClippingRect:hV,getOffsetParent:R5,getElementRects:xV,getClientRects:lV,getDimensions:pV,getScale:yu,isElement:Ft,isRTL:bV};function O5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yV(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:y,top:w,width:C,height:S}=b;if(g||t(),!C||!S)return;const N=Ph(w),E=Ph(c.clientWidth-(y+C)),k=Ph(c.clientHeight-(w+S)),A=Ph(y),R={rootMargin:-N+"px "+-E+"px "+-k+"px "+-A+"px",threshold:Fa(0,Eu(1,p))||1};let T=!0;function M(D){const _=D[0].intersectionRatio;if(!O5(b,e.getBoundingClientRect()))return f();if(_!==p){if(!T)return f();_?f(!1,_):i=setTimeout(()=>{f(!1,1e-7)},1e3)}T=!1}try{a=new IntersectionObserver(M,{...R,root:c.ownerDocument})}catch{a=new IntersectionObserver(M,R)}a.observe(e)}const m=En(e),h=()=>f(r);return m.addEventListener("resize",h),f(!0),()=>{m.removeEventListener("resize",h),u()}}function aT(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=Nw(e),g=i||c?[...h?hf(h):[],...t?hf(t):[]]:[];g.forEach(N=>{i&&N.addEventListener("scroll",r),c&&N.addEventListener("resize",r)});const p=h&&f?yV(h,r,c):null;let b=-1,y=null;u&&(y=new ResizeObserver(N=>{let[E]=N;E&&E.target===h&&y&&t&&(y.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var k;(k=y)==null||k.observe(t)})),r()}),h&&!m&&y.observe(h),t&&y.observe(t));let w,C=m?oc(e):null;m&&S();function S(){const N=oc(e);C&&!O5(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=y)==null||N.disconnect(),y=null,m&&cancelAnimationFrame(w)}}const vV=tV,wV=nV,jV=J8,SV=rV,NV=sV,CV=(e,t,r)=>{const a=new Map,i=r??{},c={...A5,...i.platform,_c:a};return Z8(e,t,{...i,platform:c})};var kV=typeof document<"u",TV=function(){},vp=kV?x.useLayoutEffect:TV;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 M5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iT(e,t){const r=M5(e);return Math.round(t*r)/r}function Cy(e){const t=x.useRef(e);return vp(()=>{t.current=e}),t}function EV(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,y]=x.useState(a);eg(b,a)||y(a);const[w,C]=x.useState(null),[S,N]=x.useState(null),E=x.useCallback(q=>{q!==R.current&&(R.current=q,C(q))},[]),k=x.useCallback(q=>{q!==T.current&&(T.current=q,N(q))},[]),A=c||w,O=u||S,R=x.useRef(null),T=x.useRef(null),M=x.useRef(g),D=m!=null,_=Cy(m),H=Cy(i),G=Cy(h),B=x.useCallback(()=>{if(!R.current||!T.current)return;const q={placement:t,strategy:r,middleware:b};H.current&&(q.platform=H.current),CV(R.current,T.current,q).then(ee=>{const z={...ee,isPositioned:G.current!==!1};P.current&&!eg(M.current,z)&&(M.current=z,go.flushSync(()=>{p(z)}))})},[b,t,r,H,G]);vp(()=>{h===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,p(q=>({...q,isPositioned:!1})))},[h]);const P=x.useRef(!1);vp(()=>(P.current=!0,()=>{P.current=!1}),[]),vp(()=>{if(A&&(R.current=A),O&&(T.current=O),A&&O){if(_.current)return _.current(A,O,B);B()}},[A,O,B,_,D]);const V=x.useMemo(()=>({reference:R,floating:T,setReference:E,setFloating:k}),[E,k]),Y=x.useMemo(()=>({reference:A,floating:O}),[A,O]),W=x.useMemo(()=>{const q={position:r,left:0,top:0};if(!Y.floating)return q;const ee=iT(Y.floating,g.x),z=iT(Y.floating,g.y);return f?{...q,transform:"translate("+ee+"px, "+z+"px)",...M5(Y.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ee,top:z}},[r,f,Y.floating,g.x,g.y]);return x.useMemo(()=>({...g,update:B,refs:V,elements:Y,floatingStyles:W}),[g,B,V,Y,W])}const RV=(e,t)=>{const r=vV(e);return{name:r.name,fn:r.fn,options:[e,t]}},AV=(e,t)=>{const r=wV(e);return{name:r.name,fn:r.fn,options:[e,t]}},OV=(e,t)=>({fn:NV(e).fn,options:[e,t]}),MV=(e,t)=>{const r=jV(e);return{name:r.name,fn:r.fn,options:[e,t]}},DV=(e,t)=>{const r=SV(e);return{name:r.name,fn:r.fn,options:[e,t]}};var ky={exports:{}},Ty={};/**
|
|
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 lT;function zV(){if(lT)return Ty;lT=1;var e=Mf();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 y=b(),w=a({inst:{value:y,getSnapshot:b}}),C=w[0].inst,S=w[1];return c(function(){C.value=y,C.getSnapshot=b,m(C)&&S({inst:C})},[p,y,b]),i(function(){return m(C)&&S({inst:C}),p(function(){m(C)&&S({inst:C})})},[p]),u(y),y}function m(p){var b=p.getSnapshot;p=p.value;try{var y=b();return!r(p,y)}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 Ty.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Ty}var cT;function D5(){return cT||(cT=1,ky.exports=zV()),ky.exports}var Cw=D5(),Ey={exports:{}},Ry={};/**
|
|
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 uT;function IV(){if(uT)return Ry;uT=1;var e=Mf(),t=D5();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 Ry.useSyncExternalStoreWithSelector=function(h,g,p,b,y){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(R){if(!E){if(E=!0,k=R,R=b(R),y!==void 0&&C.hasValue){var T=C.value;if(y(T,R))return A=T}return A=R}if(T=A,a(k,R))return T;var M=b(R);return y!==void 0&&y(T,M)?(k=R,T):(k=R,A=M)}var E=!1,k,A,O=p===void 0?null:p;return[function(){return N(g())},O===null?void 0:function(){return N(O())}]},[g,p,b,y]);var S=i(h,w[0],w[1]);return u(function(){C.hasValue=!0,C.value=S},[S]),m(S),S},Ry}var dT;function PV(){return dT||(dT=1,Ey.exports=IV()),Ey.exports}var _V=PV();const Pv=[];let _v;function LV(){return _v}function $V(e){Pv.push(e)}function Xf(e){const t=(r,a)=>{const i=bs(BV).current;let c;try{_v=i;for(const u of Pv)u.before(i);c=e(r,a);for(const u of Pv)u.after(i);i.didInitialize=!0}finally{_v=void 0}return c};return t.displayName=e.displayName||e.name,t}function kw(e){return x.forwardRef(Xf(e))}function BV(){return{didInitialize:!1}}const VV=G1(19),UV=VV?FV:GV;function z5(e,t,r,a,i){return UV(e,t,r,a,i)}function HV(e,t,r,a,i){const c=x.useCallback(()=>t(e.getSnapshot(),r,a,i),[e,t,r,a,i]);return Cw.useSyncExternalStore(e.subscribe,c,c)}$V({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()}}),Cw.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function FV(e,t,r,a,i){const c=LV();if(!c)return HV(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 GV(e,t,r,a,i){return _V.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,r,a,i))}class qV{constructor(t){an(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));an(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 z5(this,t,r,a,i)}}class Pu extends qV{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),z5(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 YV={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 Tw extends Pu{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:v5(),nested:i,triggerElements:u},YV);an(this,"syncOpenEvent",(r,a)=>{(!r||!this.state.open||a!=null&&d8(a))&&(this.context.dataRef.current.openEvent=r?a:void 0)});an(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)});an(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 I5(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 Tw({open:f,transitionStatus:void 0,referenceElement:m,floatingElement:h,triggerElements:g,onOpenChange:p,floatingId:i,syncOnly:!0,nested:c}));const y=a??b.current;return t.useSyncedValue("floatingId",i),We(()=>{const w={open:f,floatingId:i,referenceElement:m,floatingElement:h};Ft(m)&&(w.domReferenceElement=m),y.state.positionReference===y.state.referenceElement&&(w.positionReference=m),y.update(w)},[f,i,m,h,y]),y.context.onOpenChange=p,y.context.nested=c,y}const Wf={tabIndex:-1,[Rv]:""};function P5(e){return t=>t==="touch"?e.current:!0}function Ew(e,t=!1){const r=sc(),a=ol()!=null,i=bs(()=>e(r,a)).current;return I5({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 fT(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function KV(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),fT(c))}a!==null&&e!==void 0&&(r.current={store:t,id:e,element:a},t.context.triggerElements.add(e,a),fT(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 Rw(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function XV(e,t,r,a={}){var g,p,b;const i=r.reason,c=i===Qn,u=t&&i===gu,f=!t&&(i===ha||i===Hf),m=Rw(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 y=nx(e.state,t,r.trigger,m()),w={...a.extraState,...y};u?w.instantType="focus":f?w.instantType="dismiss":c&&(w.instantType=void 0),e.update(w)};c?go.flushSync(h):h()}function Aw(e,t,r,a){const i=r.useState("isMountedByTrigger",e),c=KV(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[y,w]of e.context.triggerElements.entries())if(w===e.state.activeTriggerElement){h.activeTriggerId=y,h.activeTriggerElement=w,a.current=y;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[y,w]=b.value;h.activeTriggerId=y,h.activeTriggerElement=w,a.current=y}}(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=vt(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:Tn,inactiveTriggerProps:Tn,popupProps:Tn})},[e])}function _5(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 Tw({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:Tn,inactiveTriggerProps:Tn,popupProps:Tn}}const sf=e=>e.triggerIdProp??e.activeTriggerId,Ow=e=>e.openProp??e.open,mT=e=>{var r;return(((r=e.popupElement)==null?void 0:r.id)??e.floatingId)||void 0};function L5(e,t){return t!==void 0&&Ow(e)&&sf(e)===t}function WV(e,t){return L5(e,t)?!0:t!==void 0&&Ow(e)&&sf(e)==null&&e.triggerCount===1}const ix={open:Ow,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:sf,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:mT,isTriggerActive:(e,t)=>t!==void 0&&sf(e)===t,isOpenedByTrigger:(e,t)=>L5(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&sf(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>WV(e,t)?mT(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Mw(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 Cw.useSyncExternalStore(t,r,()=>e==null?void 0:e.serverStore)}function QV(e){const{open:t=!1,onOpenChange:r,elements:a={}}=e,i=sc(),c=ol()!=null,u=bs(()=>new Tw({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 ZV(e){return JV(e,e.rootContext)}function JV(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),[y,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=EV({...e,elements:{...N,...h&&{reference:h}}}),k=Ft(p)?p:null,A=y===void 0?t.state.floatingElement:y;t.useSyncedValue("referenceElement",p??null),t.useSyncedValue("domReferenceElement",p===void 0?u:k),t.useSyncedValue("floatingElement",A);const O=x.useCallback(H=>{const G=Ft(H)?{getBoundingClientRect:()=>H.getBoundingClientRect(),getClientRects:()=>H.getClientRects(),contextElement:H}:H;g(G),E.refs.setReference(G)},[E.refs]),R=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]),T=x.useCallback(H=>{w(H),E.refs.setFloating(H)},[E.refs]),M=x.useMemo(()=>({...E.refs,setReference:R,setFloating:T,setPositionReference:O,domReference:C}),[E.refs,R,T,O]),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:M,elements:D,nodeId:r,rootStore:t}),[E,M,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:M,elements:D,rootStore:t}),[E,M,D,_,t])}const Ay=uw&&ri;function $5(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 y=En(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(y,"blur",w),Ay&&$t(y,"keydown",C,!0),Ay&&$t(y,"pointerdown",S,!0))},[i,r]),x.useEffect(()=>{if(!r)return;function b(y){if(y.reason===ha||y.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(y){const w=y.currentTarget;if(f.current){if(m.current===w)return;b()}const C=Vs(y.nativeEvent);if(Ft(C)){if(Ay&&!y.relatedTarget){if(!h.current&&!Wg(C))return}else if(!h8(C))return}const S=Wp(y.relatedTarget,i.context.triggerElements),{nativeEvent:N,currentTarget:E}=y,k=typeof a=="function"?a():a;if(i.select("open")&&S||k===0||k===void 0){i.setOpen(!0,vt(gu,N,E));return}g.start(k,()=>{f.current||i.setOpen(!0,vt(gu,N,E))})},onBlur(y){b();const w=y.relatedTarget,C=y.nativeEvent,S=Ft(w)&&w.hasAttribute(yf("focus-guard"))&&w.getAttribute("data-type")==="outside";g.start(0,()=>{var A;const N=i.select("domReferenceElement"),E=Xs(Ht(N));!w&&E===N||gt((A=u.current.floatingContext)==null?void 0:A.refs.floating.current,E)||gt(N,E)||S||Wp(w??E,i.context.triggerElements)||i.setOpen(!1,vt(gu,C))})}}},[u,a,i,g]);return x.useMemo(()=>r?{reference:p,trigger:p}:{},[r,p])}class Dw{constructor(){an(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});an(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 Dw}}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 B5(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 zw(e){const t=e.context.dataRef.current,r=bs(()=>t.hoverInteractionState??Dw.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=r),ow(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Iw(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=zw(c),y=us(),w=st(()=>{var N;return JO((N=h.current.openEvent)==null?void 0:N.type,b.interactedInside)}),C=st(()=>{var N;return g8((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,k,A,O;if(r&&u&&(N=b.handleCloseOptions)!=null&&N.blockPointerEvents&&C()&&Ft(m)&&f){const R=m,T=f,M=Ht(f),D=(k=(E=g==null?void 0:g.nodesRef.current.find(B=>B.id===p))==null?void 0:E.context)==null?void 0:k.elements.floating;D&&(D.style.pointerEvents="");const _=b.pointerEventsScopeElement!==T?b.pointerEventsScopeElement:null,H=D!==T?D:null,G=((O=(A=b.handleCloseOptions)==null?void 0:A.getScope)==null?void 0:O.call(A))??_??H??R.closest("[data-rootownerid]")??M.body;return B5(b,{scopeElement:G,referenceElement:R,floatingElement:T}),()=>{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(M){const D=rc(a,"close",b.pointerType),_=()=>{c.setOpen(!1,vt(Qn,M)),g==null||g.events.emit("floating.closed",M)};D?b.openChangeTimeout.start(D,_):(b.openChangeTimeout.clear(),_())}function k(M){const D=Vs(M);if(!m8(D)){b.interactedInside=!1;return}b.interactedInside=(D==null?void 0:D.closest("[aria-haspopup]"))!=null}function A(){b.openChangeTimeout.clear(),y.clear(),g==null||g.events.off("floating.closed",R),S()}function O(M){var G;if(N()&&g){g.events.on("floating.closed",R);return}if(Wp(M.relatedTarget,c.context.triggerElements))return;const D=((G=h.current.floatingContext)==null?void 0:G.nodeId)??i,_=M.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(M);return}S(),C()&&!w()&&E(M)}}function R(M){!g||!p||N()||y.start(0,()=>{g.events.off("floating.closed",R),c.setOpen(!1,vt(Qn,M)),g.events.emit("floating.closed",M)})}const T=f;return oa(T&&$t(T,"mouseenter",A),T&&$t(T,"mouseleave",O),T&&$t(T,"pointerdown",k,!0),()=>{g==null||g.events.off("floating.closed",R)})},[r,f,c,h,a,i,C,w,S,b,g,p,y])}const eU={current:null};function Pw(e,t={}){const{enabled:r=!0,delay:a=0,handleClose:i=null,mouseOnly:c=!1,restMs:u=0,move:f=!0,triggerElementRef:m=eU,externalTree:h,isActiveTrigger:g=!0,getHandleCloseContext:p,isClosing:b,shouldOpen:y,guardStaleOpen:w=!1}=t,C="rootStore"in e?e.rootStore:e,{dataRef:S,events:N}=C.context,E=al(h),k=zw(C),A=x.useRef(!1),O=qn(i),R=qn(a),T=qn(u),M=qn(r),D=qn(y),_=qn(b),H=st(()=>{var Y;return JO((Y=S.current.openEvent)==null?void 0:Y.type,k.interactedInside)}),G=st(()=>{var Y;return((Y=D.current)==null?void 0:Y.call(D))!==!1}),B=st((Y,W,q)=>{const ee=C.context.triggerElements;if(ee.hasElement(W))return!Y||!gt(Y,W);if(!Ft(q))return!1;const z=q;return ee.hasMatchingElement(L=>gt(L,z))&&(!Y||!gt(Y,z))}),P=st(()=>{if(!k.handler)return;Ht(C.select("domReferenceElement")).removeEventListener("mousemove",k.handler),k.handler=void 0}),V=st(()=>{ng(k)});return g&&(k.handleCloseOptions=i==null?void 0:i.__options),x.useEffect(()=>P,[P]),x.useEffect(()=>{if(!r)return;function Y(W){W.open?A.current=!1:(A.current=W.reason===Qn,P(),k.openChangeTimeout.clear(),k.restTimeout.clear(),k.blockMouseMove=!0,k.restTimeoutPending=!1)}return N.on("openchange",Y),()=>{N.off("openchange",Y)}},[r,N,k,P]),x.useEffect(()=>{if(!r)return;function Y(X,te=!0){const $=rc(R.current,"close",k.pointerType);$?k.openChangeTimeout.start($,()=>{C.setOpen(!1,vt(Qn,X)),E==null||E.events.emit("floating.closed",X)}):te&&(k.openChangeTimeout.clear(),C.setOpen(!1,vt(Qn,X)),E==null||E.events.emit("floating.closed",X))}const W=m.current??(g?C.select("domReferenceElement"):null);if(!Ft(W))return;function q(X){var ue;if(k.openChangeTimeout.clear(),k.blockMouseMove=!1,c&&!Hi(k.pointerType))return;const te=Uk(T.current),$=rc(R.current,"open",k.pointerType),U=Vs(X),F=X.currentTarget??null,K=C.select("domReferenceElement");let se=F;if(Ft(U)&&!C.context.triggerElements.hasElement(U)){for(const ye of C.context.triggerElements.elements())if(gt(ye,U)){se=ye;break}}Ft(F)&&Ft(K)&&!C.context.triggerElements.hasElement(F)&>(F,K)&&(se=K);const ne=se==null?!1:B(K,se,U),ve=C.select("open"),ae=((ue=_.current)==null?void 0:ue.call(_))??C.select("transitionStatus")==="ending",le=!ve&&ae&&A.current,re=!ne&&Ft(se)&&Ft(K)&>(K,se)&&le,Q=te>0&&!$,Z=ne&&(ve||le)||re,pe=!ve||ne;if(Z){G()&&C.setOpen(!0,vt(Qn,X,se));return}Q||($?k.openChangeTimeout.start($,()=>{pe&&G()&&C.setOpen(!0,vt(Qn,X,se))}):pe&&G()&&C.setOpen(!0,vt(Qn,X,se)))}function ee(X){if(H()){V();return}P();const te=C.select("domReferenceElement"),$=Ht(te);k.restTimeout.clear(),k.restTimeoutPending=!1;const U=S.current.floatingContext??(p==null?void 0:p());if(Wp(X.relatedTarget,C.context.triggerElements))return;if(O.current&&U){C.select("open")||k.openChangeTimeout.clear();const K=m.current;k.handler=O.current({...U,tree:E,x:X.clientX,y:X.clientY,onClose(){V(),P(),M.current&&!H()&&K===C.select("domReferenceElement")&&Y(X,!0)}}),$.addEventListener("mousemove",k.handler),k.handler(X);return}(k.pointerType==="touch"?!gt(C.select("floatingElement"),X.relatedTarget):!0)&&Y(X)}function z(X){gt(W,X.relatedTarget)||(k.openChangeTimeout.clear(),k.restTimeout.clear(),k.restTimeoutPending=!1)}const L=w?$t(W,"mouseout",z):void 0;return f?oa($t(W,"mousemove",q,{once:!0}),$t(W,"mouseenter",q),$t(W,"mouseleave",ee),L):oa($t(W,"mouseenter",q),$t(W,"mouseleave",ee),L)},[P,V,S,R,C,r,O,k,g,B,H,c,f,T,m,E,M,p,_,G,w]),x.useMemo(()=>{if(!r)return;function Y(W){k.pointerType=W.pointerType}return{onPointerDown:Y,onPointerEnter:Y,onMouseMove(W){var U,F,K;const{nativeEvent:q}=W,ee=W.currentTarget,z=C.select("domReferenceElement"),L=C.select("open"),X=B(z,ee,W.target);if(c&&!Hi(k.pointerType))return;if(L&&X&&((U=k.handleCloseOptions)!=null&&U.blockPointerEvents)){const se=C.select("floatingElement");if(se){const ne=((K=(F=k.handleCloseOptions)==null?void 0:F.getScope)==null?void 0:K.call(F))??ee.ownerDocument.body;B5(k,{scopeElement:ne,referenceElement:ee,floatingElement:se})}}const te=Uk(T.current);if(L&&!X||te===0||!X&&k.restTimeoutPending&&W.movementX**2+W.movementY**2<2)return;k.restTimeout.clear();function $(){if(k.restTimeoutPending=!1,H())return;const se=C.select("open");!k.blockMouseMove&&(!se||X)&&G()&&C.setOpen(!0,vt(Qn,q,ee))}k.pointerType==="touch"?go.flushSync(()=>{$()}):X&&L?$():(k.restTimeoutPending=!0,k.restTimeout.start(te,$))}}},[r,k,H,B,c,C,T,G])}const tU="Escape";function hT(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 Lh(e,t){return lx(t,e===ZO||e===mw,e===Kg||e===Xg)}function Oy(e,t,r){return lx(t,e===mw,r?e===Kg:e===Xg)||e==="Enter"||e===" "||e===""}function nU(e,t,r){return lx(t,r?e===Kg:e===Xg,e===mw)}function sU(e,t,r,a){const i=r?e===Xg:e===Kg,c=e===ZO;return t==="both"||t==="horizontal"&&a?e===tU:lx(t,i,c)}function V5(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:y=!0,openOnArrowKeyDown:w=!0,disabledIndices:C=void 0,orientation:S="vertical",parentOrientation:N,id:E,resetOnPointerLeave:k=!0,externalTree:A,grid:O}=t,R=O!=null,T="rootStore"in e?e.rootStore:e,M=T.useState("open"),D=T.useState("floatingElement"),_=T.useState("domReferenceElement"),H=T.context.dataRef,G=Qp(D),B=Ov(_),P=qn(G),V=ol(),Y=al(A),W=x.useRef(b),q=x.useRef(u??-1),ee=x.useRef(null),z=x.useRef(!0),L=st(fe=>{i(q.current===-1?null:q.current,fe)}),X=x.useRef(!!D),te=x.useRef(M),$=x.useRef(!1),U=x.useRef(!1),F=x.useRef(null),K=qn(C),se=qn(M),ne=qn(u),ve=qn(k),ae=Tu(),le=Tu(),re=st(()=>{function fe(me){p?Y==null||Y.events.emit("virtualfocus",me):F.current=yp(me,{sync:$.current,preventScroll:!0})}const Re=r.current[q.current],Me=U.current;Re&&fe(Re),($.current?me=>me():me=>ae.request(me))(()=>{var ge;const me=r.current[q.current]||Re;if(!me)return;Re||fe(me),Ce&&(Me||!z.current)&&((ge=me.scrollIntoView)==null||ge.call(me,{block:"nearest",inline:"nearest"}))})});We(()=>{H.current.orientation=S},[H,S]),We(()=>{c&&(M&&D?(q.current=u??-1,W.current&&u!=null&&(U.current=!0,L())):X.current&&(q.current=-1,L()))},[c,M,D,u,L]),We(()=>{if(c){if(!M){$.current=!1;return}if(D)if(a==null){if($.current=!1,ne.current!=null)return;if(X.current&&(q.current=-1,re()),(!te.current||!X.current)&&W.current&&(ee.current!=null||W.current===!0&&ee.current==null)){let fe=0;const Re=()=>{r.current[0]==null?(fe<2&&(fe?ke=>le.request(ke):queueMicrotask)(Re),fe+=1):(q.current=ee.current==null||Oy(ee.current,S,g)||h?bp(r):Dv(r),ee.current=null,L())};Re()}}else nf(r.current,a)||(q.current=a,re(),U.current=!1)}},[c,M,D,a,ne,h,r,S,g,L,re,le]),We(()=>{var me,Ae;if(!c||D||!Y||p||!X.current)return;const fe=Y.nodesRef.current,Re=(Ae=(me=fe.find(ge=>ge.id===V))==null?void 0:me.context)==null?void 0:Ae.elements.floating,Me=Xs(Ht(_??Re??null)),ke=fe.some(ge=>ge.context&>(ge.context.elements.floating,Me));Re&&!ke&&z.current&&Re.focus({preventScroll:!0})},[c,D,_,Y,V,p]),We(()=>{te.current=M,X.current=!!D}),We(()=>{M||(ee.current=null,W.current=b)},[M,b]);const Q=a!=null,Z=st(fe=>{if(!se.current)return;const Re=r.current.indexOf(fe.currentTarget);Re!==-1&&(q.current!==Re||a!==Re)&&(q.current=Re,L(fe))}),pe=st(()=>{var fe,Re,Me;return N??((Me=(Re=(fe=Y==null?void 0:Y.nodesRef.current.find(ke=>ke.id===V))==null?void 0:fe.context)==null?void 0:Re.dataRef)==null?void 0:Me.current.orientation)}),ue=st(()=>bp(r,K.current)),ye=st(fe=>{if(z.current=!1,$.current=!0,fe.which===229||!se.current&&fe.currentTarget===P.current)return;if(h&&sU(fe.key,S,g,R)){Lh(fe.key,pe())||ta(fe),T.setOpen(!1,vt(Tv,fe.nativeEvent)),wn(_)&&(p?Y==null||Y.events.emit("virtualfocus",_):_.focus());return}const Re=q.current,Me=bp(r,C),ke=Dv(r,C);if(B||(fe.key==="Home"&&(ta(fe),q.current=Me,L(fe)),fe.key==="End"&&(ta(fe),q.current=ke,L(fe))),O!=null){const me=O(fe,q.current,r,S,m,g,C,Me,ke);if(me!=null&&(q.current=me,L(fe)),S==="both")return}if(Lh(fe.key,S)){if(ta(fe),M&&!p&&Xs(fe.currentTarget.ownerDocument)===fe.currentTarget){q.current=Oy(fe.key,S,g)?Me:ke,L(fe);return}Oy(fe.key,S,g)?m?Re>=ke?f&&Re!==r.current.length?q.current=-1:($.current=!1,q.current=Me):q.current=Ba(r.current,{startingIndex:Re,disabledIndices:C}):q.current=Math.min(ke,Ba(r.current,{startingIndex:Re,disabledIndices:C})):m?Re<=Me?f&&Re!==-1?q.current=r.current.length:($.current=!1,q.current=ke):q.current=Ba(r.current,{startingIndex:Re,decrement:!0,disabledIndices:C}):q.current=Math.max(Me,Ba(r.current,{startingIndex:Re,decrement:!0,disabledIndices:C})),nf(r.current,q.current)&&(q.current=-1),L(fe)}}),Ce=x.useMemo(()=>({onFocus(Re){$.current=!0,Z(Re)},onClick:({currentTarget:Re})=>Re.focus({preventScroll:!0}),onMouseMove(Re){hT(Re)||($.current=!0,U.current=!1,y&&Z(Re))},onPointerLeave(Re){var ke;if(!se.current||!z.current||Re.pointerType==="touch")return;$.current=!0;const Me=Re.relatedTarget;if(!(!y||r.current.includes(Me))&&ve.current&&((ke=F.current)==null||ke.call(F),F.current=null,q.current=-1,L(Re),!p)){const me=P.current,Ae=Xs(Ht(me));me&>(me,Ae)&&me.focus({preventScroll:!0})}}}),[Z,se,P,y,r,L,ve,p]),Ie=x.useMemo(()=>p&&M&&Q&&{"aria-activedescendant":`${E}-${a}`},[p,M,Q,E,a]),de=x.useMemo(()=>({...B?{}:Ie,onKeyDown(fe){if(fe.key==="Tab"&&fe.shiftKey&&M&&!p){const Re=Vs(fe.nativeEvent);if(Re&&!gt(P.current,Re))return;ta(fe),T.setOpen(!1,vt(Ji,fe.nativeEvent)),wn(_)&&_.focus();return}ye(fe)},onPointerMove(fe){hT(fe)||(z.current=!0)}}),[Ie,ye,P,B,T,M,p,_]),Te=x.useMemo(()=>{function fe(ke){T.setOpen(!0,vt(Tv,ke.nativeEvent,ke.currentTarget))}function Re(ke){b==="auto"&&Yg(ke.nativeEvent)&&(W.current=!p)}function Me(ke){W.current=b,b==="auto"&&fw(ke.nativeEvent)&&(W.current=!0)}return{onKeyDown(ke){const me=T.select("open");z.current=!1;const Ae=ke.key.startsWith("Arrow"),ge=nU(ke.key,pe(),g),Pe=Lh(ke.key,S),Fe=(h?ge:Pe)||ke.key==="Enter"||ke.key.trim()==="";if(p&&me)return ye(ke);if(!(!me&&!w&&Ae)){if(Fe){const _e=Lh(ke.key,pe());ee.current=h&&_e?null:ke.key}if(h){ge&&(ta(ke),me?(q.current=ue(),L(ke)):fe(ke));return}Pe&&(ne.current!=null&&(q.current=ne.current),ta(ke),!me&&w?fe(ke):ye(ke),me&&L(ke))}},onFocus(ke){T.select("open")&&!p&&(q.current=-1,L(ke))},onPointerDown:Me,onPointerEnter:Me,onMouseDown:Re,onClick:Re}},[ye,b,ue,h,L,T,w,S,pe,g,ne,p]),oe=x.useMemo(()=>({...Ie,...Te}),[Ie,Te]);return x.useMemo(()=>c?{reference:oe,floating:de,item:Ce,trigger:Te}:{},[c,oe,de,Te,Ce])}function U5(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"),y=us(),w=x.useRef(""),C=x.useRef(g??i??-1),S=x.useRef(null),N=st(A=>{function O(P){return a==null?void 0:a.current[P]}function R(P){const V=O(P);return V&&!Qg(V)||V!=null&&V.matches(":disabled")?!1:u==null||!xu(Vr,P,u)}function T(P,V,Y=0){if(P.length===0)return-1;const W=(Y%P.length+P.length)%P.length,q=V.toLowerCase();for(let ee=0;ee<P.length;ee+=1){const z=(W+ee)%P.length,L=P[z];if(!(!(L!=null&&L.toLowerCase().startsWith(q))||!R(z)))return z}return-1}const M=r.current;if(w.current.length>0&&A.key===" "&&(ta(A),f==null||f(!0)),w.current.length>0&&w.current[0]!==" "&&T(M,w.current)===-1&&A.key!==" "&&(f==null||f(!1)),M==null||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;b&&A.key!==" "&&(ta(A),f==null||f(!0));const D=w.current==="";D&&(C.current=g??i??-1),M.every((P,V)=>{var Y,W;return P&&R(V)?((Y=P[0])==null?void 0:Y.toLowerCase())!==((W=P[1])==null?void 0:W.toLowerCase()):!0})&&w.current===A.key&&(w.current="",C.current=S.current),w.current+=A.key,y.start(h,()=>{w.current="",C.current=S.current,f==null||f(!1)});const G=((D?g??i??-1:C.current)??0)+1,B=T(M,w.current,G);B!==-1?(c==null||c(B),S.current=B):A.key!==" "&&(w.current="",f==null||f(!1))}),E=st(A=>{const O=A.relatedTarget,R=p.select("domReferenceElement"),T=p.select("floatingElement");gt(R,O)||gt(T,O)||(y.clear(),w.current="",C.current=S.current,f==null||f(!1))});We(()=>{!b&&g!==null||(y.clear(),S.current=null,w.current!==""&&(w.current=""))},[b,g,y]);const k=x.useMemo(()=>({onKeyDown:N,onBlur:E}),[N,E]);return x.useMemo(()=>m?{reference:k,floating:k}:{},[m,k])}const pT=.1,rU=pT*pT,Cn=.5;function $h(e,t,r,a,i,c){return a>=t!=c>=t&&e<=(i-r)*(t-a)/(c-a)+r}function Bh(e,t,r,a,i,c,u,f,m,h){let g=!1;return $h(e,t,r,a,i,c)&&(g=!g),$h(e,t,i,c,u,f)&&(g=!g),$h(e,t,u,f,m,h)&&(g=!g),$h(e,t,m,h,r,a)&&(g=!g),g}function oU(e,t,r){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height}function Vh(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 _w(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,y=null,w=null,C=typeof performance<"u"?performance.now():0;function S(E,k){const A=performance.now(),O=A-C;if(y===null||w===null||O===0)return y=E,w=k,C=A,!1;const R=E-y,T=k-w,M=R*R+T*T,D=O*O*rU;return y=E,w=k,C=A,M<D}function N(){r.clear(),m()}return function(k){r.clear();const A=f.domReference,O=f.floating;if(!A||!O||p==null||i==null||c==null)return;const{clientX:R,clientY:T}=k,M=Vs(k),D=k.type==="mouseleave",_=gt(O,M),H=gt(A,M);if(_&&(b=!0,!D))return;if(H&&(b=!1,!D)){b=!0;return}if(D&&Ft(k.relatedTarget)&>(O,k.relatedTarget))return;function G(){return!!(g&&nl(g.nodesRef.current,h).length>0)}function B(){G()||N()}if(G())return;const P=A.getBoundingClientRect(),V=O.getBoundingClientRect(),Y=i>V.right-V.width/2,W=c>V.bottom-V.height/2,q=V.width>P.width,ee=V.height>P.height,z=(q?P:V).left,L=(q?P:V).right,X=(ee?P:V).top,te=(ee?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":$=Vh(R,T,z,P.top+1,L,V.bottom-1);break;case"bottom":$=Vh(R,T,z,V.top+1,L,P.bottom-1);break;case"left":$=Vh(R,T,V.right-1,te,P.left+1,X);break;case"right":$=Vh(R,T,P.right-1,te,V.left+1,X);break}if($)return;if(b&&!oU(R,T,P)){B();return}if(!D&&S(R,T)){B();return}let U=!1;switch(p){case"top":{const F=q?Cn/2:Cn*4,K=q||Y?i+F:i-F,se=q?i-F:Y?i+F:i-F,ne=c+Cn+1,ve=Y||q?V.bottom-Cn:V.top,ae=Y?q?V.bottom-Cn:V.top:V.bottom-Cn;U=Bh(R,T,K,ne,se,ne,V.left,ve,V.right,ae);break}case"bottom":{const F=q?Cn/2:Cn*4,K=q||Y?i+F:i-F,se=q?i-F:Y?i+F:i-F,ne=c-Cn,ve=Y||q?V.top+Cn:V.bottom,ae=Y?q?V.top+Cn:V.bottom:V.top+Cn;U=Bh(R,T,K,ne,se,ne,V.left,ve,V.right,ae);break}case"left":{const F=ee?Cn/2:Cn*4,K=ee||W?c+F:c-F,se=ee?c-F:W?c+F:c-F,ne=i+Cn+1,ve=W||ee?V.right-Cn:V.left,ae=W?ee?V.right-Cn:V.left:V.right-Cn;U=Bh(R,T,ve,V.top,ae,V.bottom,ne,K,ne,se);break}case"right":{const F=ee?Cn/2:Cn*4,K=ee||W?c+F:c-F,se=ee?c-F:W?c+F:c-F,ne=i-Cn,ve=W||ee?V.left+Cn:V.right,ae=W?ee?V.left+Cn:V.right:V.left+Cn;U=Bh(R,T,ne,K,ne,se,ve,V.top,ae,V.bottom);break}}U?b||r.start(40,B):B()}};return a.__options={...e,blockPointerEvents:t},a}const H5=x.createContext(void 0);function aU(){const e=x.useContext(H5);if(e===void 0)throw new Error(sn(26));return e}const Lv="ArrowUp",$v="ArrowDown",Bv="ArrowLeft",Vv="ArrowRight",Uv="Home",Hv="End",Zf=new Set([Lv,$v,Bv,Vv,Uv,Hv]),iU="Shift",lU=[iU,"Control","Alt","Meta"];function cU(e){return wn(e)&&e.tagName==="INPUT"}function gT(e){return!!(cU(e)&&e.selectionStart!=null||wn(e)&&e.tagName==="TEXTAREA")}function xT(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=bT(e,t,"left"),h=Uh(e),g=Uh(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=bT(e,t,"top"),h=Uh(e),g=Uh(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 bT(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 Uh(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 uU="--nested-dialogs",dU="data-nested-dialog-open",fU={...qf,...si,nestedDialogOpen(e){return e?{[dU]:""}:null}},Lw=x.forwardRef(function(t,r){const{render:a,className:i,style:c,finalFocus:u,initialFocus:f,...m}=t,h=hc(),g=h.useState("descriptionElementId"),p=h.useState("disablePointerDismissal"),b=h.useState("floatingRootContext"),y=h.useState("popupProps"),w=h.useState("modal"),C=h.useState("mounted"),S=h.useState("nested"),N=h.useState("nestedOpenDialogCount"),E=h.useState("open"),k=h.useState("openMethod"),A=h.useState("titleElementId"),O=h.useState("transitionStatus"),R=h.useState("role"),T=b.useState("floatingId");aU(),Sr({open:E,ref:h.context.popupRef,onComplete(){var B,P;E&&((P=(B=h.context).onOpenChangeComplete)==null||P.call(B,!0))}});const M=f===void 0?P5(h.context.popupRef):f,D=N>0,_=h.useStateSetter("popupElement"),G=Nt("div",t,{state:{open:E,nested:S,transitionStatus:O,nestedDialogOpen:D},props:[y,{id:T,"aria-labelledby":A,"aria-describedby":g,role:R,...Wf,hidden:!C,onKeyDown(B){Zf.has(B.key)&&B.stopPropagation()},style:{[uU]:N}},m],ref:[r,h.context.popupRef,_],stateAttributesMapping:fU});return n.jsx(Jg,{context:b,openInteractionType:k,disabled:!C,closeOnFocusOut:!p,initialFocus:M,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}})}),$w=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t,c=hc(),u=c.useState("mounted"),f=c.useState("modal"),m=c.useState("open");return u||a?n.jsx(H5.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 yT={},vT={},wT="";function ux(e,t){return zf(e)?e:t}function jT(e,t,r){return/hidden|clip/.test(e.getComputedStyle(ux(t,r)).overflowY)}function mU(e){if(typeof document>"u")return!1;const t=Ht(e);return En(t).innerWidth-t.documentElement.clientWidth>0}function hU(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 pU(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 gU(e){var y;const t=Ht(e),r=t.documentElement,a=t.body,i=En(r);let c=0,u=0,f=!1;const m=wr.create();if(ri&&(((y=i.visualViewport)==null?void 0:y.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,yT={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},wT=r.style.scrollBehavior,vT={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};const k=r.scrollHeight>r.clientHeight,A=r.scrollWidth>r.clientWidth,O=w.overflowY==="scroll"||C.overflowY==="scroll",R=w.overflowX==="scroll"||C.overflowX==="scroll",T=Math.max(0,i.innerWidth-a.clientWidth),M=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=hU(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"}),(k||O)&&(r.style.overflowY="scroll"),(A||R)&&(r.style.overflowX="scroll"),Object.assign(a.style,{position:"relative",height:D||M?`calc(100dvh - ${D+M}px)`:"100dvh",width:_||T?`calc(100vw - ${_+T}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,yT),Object.assign(a.style,vT),f||(r.scrollTop=c,r.scrollLeft=u,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=wT)}function p(){g(),m.request(h)}h();const b=$t(i,"resize",p);return()=>{m.cancel(),g(),typeof i.removeEventListener=="function"&&b()}}class xU{constructor(){an(this,"lockCount",0);an(this,"restore",null);an(this,"timeoutLock",xo.create());an(this,"timeoutUnlock",xo.create());an(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});an(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=En(a);if(jT(c,a,i)){const f=new c.MutationObserver(()=>{jT(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||!mU(t);this.restore=u?pU(t):gU(t)}}const bU=new xU;function F5(e=!0,t=null){We(()=>{if(e)return bU.acquire(t)},[e,t])}function yU({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,y=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 F5(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:y.reference,inactiveTriggerProps:y.trigger,popupProps:y.floating,nestedOpenDialogCount:m,nestedOpenDrawerCount:g}),null}const vU={...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 wU extends Pu{constructor(r,a,i){const c=new Qf,u=jU(r,c,a,i);super(u,SU(c),vU);an(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 jU(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 SU(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function G5(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,y=e==="drawer",w=e==="alert-dialog",C=w?!0:m,S=w||f,N=w?"alertdialog":"dialog",E=hc(!0),k=E!=null,A={modal:C,disablePointerDismissal:S,nested:k,role:N},O=Ew((H,G)=>new wU({open:i,openProp:a,activeTriggerId:b,triggerIdProp:p,...A},H,G),!0);O.useControlledProp("openProp",a),O.useControlledProp("triggerIdProp",p),O.useSyncedValues(A),O.useContextCallback("onOpenChange",c),O.useContextCallback("onOpenChangeComplete",u);const R=O.useState("open"),T=O.useState("mounted"),M=O.useState("payload");_5(O,R),sx(O);const{forceUnmount:D}=rx(R,O);x.useImperativeHandle(h,()=>({unmount:D,close:()=>O.setOpen(!1,vt(Ug))}),[D,O]);const _=R||T;return n.jsxs(XO.Provider,{value:O,children:[g&&n.jsx(tx,{handle:g,store:O}),_&&n.jsx(yU,{store:O,parentContext:E==null?void 0:E.context,isDrawer:y}),typeof r=="function"?r({payload:M}):r]})}const q5=Xf(function(t){return G5("dialog",t)}),Bw=x.forwardRef(function(t,r){const{render:a,className:i,style:c,id:u,...f}=t,m=hc(),h=vs(u);return m.useSyncedValueWithCleanup("titleElementId",h),Nt("h2",t,{ref:r,props:[{id:h},f]})});function NU(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 Y5(e,t){const r=st((c,u)=>{(typeof e=="function"?e():e)||t(u||(qg?"touch":""))}),{onClick:a,onPointerDown:i}=NU(r);return x.useMemo(()=>({onClick:a,onPointerDown:i}),[a,i])}function K5(e){const[t,r]=x.useState(null),a=Y5(e,r);return Ff(e,i=>{i&&!e&&r(null)}),x.useMemo(()=>({openMethod:t,triggerProps:a}),[t,a])}function en({...e}){return n.jsx(q5,{"data-slot":"dialog",...e})}function CU({...e}){return n.jsx($w,{"data-slot":"dialog-portal",...e})}function kU({className:e,...t}){return n.jsx(lw,{"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 tn({className:e,children:t,showCloseButton:r=!0,...a}){return n.jsxs(CU,{children:[n.jsx(kU,{}),n.jsxs(Lw,{"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(ie,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[n.jsx(In,{}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function nn({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(ie,{variant:"outline"}),children:"Close"})]})}function Qt({className:e,...t}){return n.jsx(Bw,{"data-slot":"dialog-title",className:Ve("font-heading text-base leading-none font-medium",e),...t})}function Rn({className:e,...t}){return n.jsx(cw,{"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(cB,{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 X5({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:[sw(e).map(t=>n.jsx(Hs,{location:t.location},mt(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 vf({record:e,onChange:t,disabled:r}){const a=sw(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":mt(i)===mt(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})},mt(i))})]})}function mx({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(X5,{api:u,location:c,children:a})}function hx(e,t,r){const[a,i]=x.useState(null),[c,u]=x.useState([]),[f,m]=x.useState({}),[h,g]=x.useState(!1),p=y=>{var C,S;if(!((C=y.before)!=null&&C.name)||!((S=y.before)!=null&&S.location))return;const w=mB(y.before,e);w.length&&(i({...y,targets:w}),u([]),m({}))},b=a&&n.jsx(en,{open:!0,onOpenChange:y=>{!y&&!h&&i(null)},children:n.jsxs(tn,{className:"sm:max-w-md",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:"Apply to other sources?"}),n.jsxs(Rn,{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(y=>{const w=mt(y),C=Bi(a.type,y)!==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||!y.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:y.location}),C&&n.jsx("span",{className:"block text-muted-foreground",children:"Different configuration · only changed fields will be applied."}),!y.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(ie,{variant:"ghost",disabled:h,onClick:()=>i(null),children:Object.values(f).includes("Applied")?"Done":"Only this source"}),n.jsx(ie,{disabled:h||!c.some(y=>f[y]!=="Applied"),onClick:async()=>{var y,w,C;g(!0);for(const S of a.targets.filter(N=>c.includes(mt(N))&&f[mt(N)]!=="Applied")){let N;try{const E=await hB(a,S,t(S.location));N=(y=E==null?void 0:E.sync)!=null&&y.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,[mt(S)]:N}))}try{await r()}finally{g(!1)}},children:h?"Applying…":"Apply selected"})]})]})});return{offer:p,dialog:b}}const W5=[{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."}],TU=W5,EU=W5.filter(e=>e.config&&e.skills),Fv=e=>EU.find(t=>t.id===e),RU=e=>e.filter(t=>!!Fv(t)),AU=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,...y}=t,{state:w,name:C,disabled:S,setTouched:N,setDirty:E,validityData:k,setFocused:A,setFilled:O,validationMode:R,validation:T}=Iu(),{clearErrors:M,elementRef:D,submitCountRef:_}=Bg(),H=S||m,G=C??u,B={...w,disabled:H},{labelId:P}=Vf(),V=Uf({id:c}),[Y]=po({controlled:f,default:g,name:"FieldControl",state:"value"}),W=f!==void 0,q=W?Y:void 0,ee=q==null?void 0:String(q),z=st(()=>{var $;return($=T.inputRef.current)==null?void 0:$.value});$g(T.inputRef,V,ee,z,!H,u),We(()=>{var U;const $=ee??((U=T.inputRef.current)==null?void 0:U.value);$!==void 0&&O($!=="")},[ee,T.inputRef,O]),Ff(ee,()=>{ee!==void 0&&(M(G),E(ee!==(k.initialValue??"")),T.change(ee))});const L=x.useRef(null),X=us();return We(()=>{p&&L.current===Xs(Ht(L.current))&&A(!0)},[p,A]),Nt("input",t,{ref:[r,L],state:B,props:[{id:V,disabled:H,name:G,ref:T.inputRef,"aria-labelledby":P,autoFocus:p,...W?{value:q}:{defaultValue:g},onChange($){const U=$.currentTarget.value,F=vt(Ur,$.nativeEvent);h==null||h(U,F),!W&&(E(U!==(k.initialValue??"")),O(U!==""),!$.nativeEvent.defaultPrevented&&!F.isCanceled&&(M(G),T.change(U)))},onFocus(){A(!0)},onBlur($){if(N(!0),A(!1),R==="onBlur"){const U=$.currentTarget.value;T.commit(U),W&&queueMicrotask(()=>{var K;const F=(K=T.inputRef.current)==null?void 0:K.value;F!==void 0&&F!==U&&F!==(k.initialValue??"")&&T.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 K=$.currentTarget,se=_.current;X.start(0,()=>{_.current===se&&T.commit(K.value)})}else T.commit(U)}}},y,$=>T.getValidationProps(H,$)],stateAttributesMapping:Lg})}),OU=x.forwardRef(function(t,r){return n.jsx(AU,{ref:r,...t})});function Mt({className:e,type:t,...r}){return n.jsx(OU,{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 MU({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 DU({className:e,...t}){return n.jsx("thead",{"data-slot":"table-header",className:ws("[&_tr]:border-b",e),...t})}function zU({className:e,...t}){return n.jsx("tbody",{"data-slot":"table-body",className:ws("[&_tr:last-child]:border-0",e),...t})}function ST({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 My({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 _u(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 wf(e){return!e||!Number.isFinite(Date.parse(e))?"Not reported":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}function IU(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}function PU(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 Q5(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const Z5=x.createContext(void 0),J5=x.createContext(void 0),eM=x.createContext(void 0);function wa(){const e=x.useContext(Z5);if(e===void 0)throw new Error(sn(60));return e}function px(){const e=x.useContext(J5);if(e===void 0)throw new Error(sn(101));return e}function tM(){const e=x.useContext(eM);if(e===void 0)throw new Error(sn(61));return e}function _U(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 nM=(e,t)=>Object.is(e,t);function ac(e,t,r){return e==null||t==null?Object.is(e,t):r(e,t)}function LU(e,t,r){return Array.isArray(e)&&Array.isArray(t)?!_U(e,t,(a,i)=>ac(a,i,r)):e!==t}function Gv(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 $U(e,t){if(t!==nM)return a=>Gv(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 sM(e,t,r,a){const i=a&&Array.isArray(t)?e.findIndex($U(t,r)):wp(e,t,r);return i===-1?null:i}function BU(e,t,r,a,i,c){return Gv(a,t,i)?c!=null&&e>c&&Gv(a,r[c],i)?c:e:e===c?sM(r,a,i,!0):c}function VU(e,t,r){return e.filter(a=>!ac(t,a,r))}function qv(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function UU(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function rM(e){return UU(e==null?void 0:e[0])}function HU(e){return rM(e)?e.flatMap(t=>t.items):e}function FU(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(rM(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 oM(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 qv(e)}function iu(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?qv(e.value):qv(e)}function aM(e,t,r){function a(){return oM(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=HU(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 GU(e,t,r){return e.reduce((a,i,c)=>(c>0&&a.push(", "),a.push(n.jsx(x.Fragment,{children:aM(i,t,r)},c)),a),[])}const qU={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?FU(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 Xd(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}const zo=1;function Vw(e,t){return Math.max(0,e-t)}function sg(e,t){if(t<=0)return 0;const r=Xd(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 YU(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:y=!1,modal:w=!0,actionsRef:C,inputRef:S,onOpenChangeComplete:N,items:E,multiple:k=!1,itemToStringLabel:A,itemToStringValue:O,isItemEqualToValue:R=nM,highlightItemOnHover:T=!0,children:M}=e,{clearErrors:D}=Bg(),{setDirty:_,setTouched:H,setFocused:G,validityData:B,setFilled:P,name:V,disabled:Y,validation:W,validationMode:q}=Iu(),ee=Uf({id:t}),z=Y||p,L=V??m,[X,te]=po({controlled:r,default:k?a??Vr:a,name:"Select",state:"value"}),[$,U]=po({controlled:c,default:u,name:"Select",state:"open"}),F=x.useRef([]),K=x.useRef([]),se=x.useRef(null),ne=x.useRef(null),ve=x.useRef(0),ae=x.useRef(null),le=x.useRef([]),re=x.useRef(!1),Q=x.useRef(null),Z=x.useRef(null),pe=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ue=x.useRef(!1),ye=x.useRef(X),{mounted:Ce,setMounted:Ie,transitionStatus:de}=ni($),{openMethod:Te,triggerProps:oe}=K5($),fe=bs(()=>new Pu({id:ee,labelId:void 0,modal:w,multiple:k,itemToStringLabel:A,itemToStringValue:O,isItemEqualToValue:R,value:X,open:$,mounted:Ce,transitionStatus:de,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Tn,triggerProps:Tn,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:se,scrollHandlerRef:ne,scrollArrowsMountedCountRef:ve,valueRef:ae,valuesRef:le,labelsRef:K,typingRef:re,selectionRef:pe,firstItemTextRef:Q,selectedItemTextRef:Z,alignItemWithTriggerActiveRef:ue,initialValueRef:ye},qU)).current,Re=fe.useState("activeIndex"),Me=fe.useState("selectedIndex"),ke=fe.useState("triggerElement"),me=fe.useState("positionerElement"),Ae=PU(Te),ge=Te??Ae,Pe=x.useMemo(()=>k?"":iu(X,O),[k,X,O]),Fe=x.useMemo(()=>k&&Array.isArray(X)?X.map(lt=>iu(lt,O)):iu(X,O),[k,X,O]),_e=qn(ke),Xe=st(()=>Fe);$g(_e,ee,X,Xe,!z,m);const Je=k?Array.isArray(X)&&X.length>0:X!=null&&Pe!=="";We(()=>{P(Je)},[Je,P]),We(function(){const wt=sM(le.current,X,R,k);wt===null&&(Z.current=null),!$&&fe.set("selectedIndex",wt)},[k,$,X,R,fe]),Ff(X,()=>{D(L),_(LU(X,B.initialValue,R)),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),q==="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:se,onComplete(){$||At()}}),x.useImperativeHandle(C,()=>({unmount:At}),[At]);const rt=st((lt,wt)=>{i==null||i(lt,wt),!wt.isCanceled&&te(lt)}),be=st(lt=>{const wt=Vw(lt.scrollHeight,lt.clientHeight),cn=sg(lt.scrollTop,wt),Gt=cn>0,fn=cn<wt;fe.set("scrollUpArrowVisible",Gt),fe.set("scrollDownArrowVisible",fn)}),Ue=QV({open:$,onOpenChange:ct,elements:{reference:ke,floating:me}}),Qe=Sw(Ue,{enabled:!z,event:"mousedown"}),xt=Kf(Ue),Ke=V5(Ue,{enabled:!z,listRef:F,activeIndex:Re,selectedIndex:Me,disabledIndices:Vr,onNavigate(lt){lt===null&&!$||fe.set("activeIndex",lt)},focusItemOnHover:T}),Be=U5(Ue,{enabled:!z&&($||!b&&!k),listRef:K,activeIndex:Re,selectedIndex:Me,disabledIndices:lt=>Q5(F.current[lt]),onMatch(lt){$?fe.set("activeIndex",lt):rt(le.current[lt],vt(Ur))},onTyping(lt){re.current=lt}}),jt=x.useMemo(()=>Qs(Be.reference,Ke.reference,xt.reference,Qe.reference,oe),[Qe.reference,Be.reference,Ke.reference,xt.reference,oe]),Ze=x.useMemo(()=>Qs(Wf,Be.floating,Ke.floating,xt.floating),[Be.floating,Ke.floating,xt.floating]),kt=Ke.item??Tn;fe.useContextCallback("setValue",rt),fe.useContextCallback("setOpen",ct),fe.useContextCallback("handleScrollArrowVisibility",be),fe.useContextCallback("onOpenChangeComplete",N),IU(()=>{fe.update({popupProps:Ze,triggerProps:jt})}),fe.useSyncedValues({id:ee,modal:w,multiple:k,value:X,open:$,mounted:Ce,transitionStatus:de,popupProps:Ze,triggerProps:jt,items:E,itemToStringLabel:A,itemToStringValue:O,isItemEqualToValue:R,openMethod:ge});const je=x.useMemo(()=>({disabled:z,readOnly:b,required:y,multiple:k,highlightItemOnHover:T,itemProps:kt}),[z,b,y,k,T,kt]),Ye=ho(S,W.inputRef),et=k?void 0:L,it=x.useMemo(()=>!k||!Array.isArray(X)||!L?null:X.map(lt=>{const wt=iu(lt,O);return n.jsx("input",{type:"hidden",form:h,name:L,value:wt,disabled:z},wt)}),[k,X,h,L,O,z]);return n.jsxs(Z5.Provider,{value:fe,children:[n.jsx(J5.Provider,{value:je,children:n.jsx(eM.Provider,{value:Ue,children:M})}),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=vt(Ur,lt.nativeEvent);function Gt(){if(k)return;const fn=wt.toLowerCase();let Bn=le.current.findIndex(ce=>iu(ce,O).toLowerCase()===fn||oM(ce,A).toLowerCase()===fn);Bn===-1&&(Bn=le.current.findIndex((ce,tt)=>{const Tt=K.current[tt];return Tt!=null&&Tt.toLowerCase()===fn}));const Kn=le.current[Bn];Kn!=null&&rt(Kn,cn)}fe.set("forceMount",!0),queueMicrotask(Gt)}}),id:ee&&et==null?`${ee}-hidden-input`:void 0,form:h,name:et,autoComplete:g,value:Pe,disabled:z,required:y&&!(k&&Je),readOnly:b,ref:Ye,style:L?rw:_g,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),it]})}function KU(e,t){return e??t}const Hh=5;function iM(e,t){const r=XU(t);return e.clientX>=r.left-Hh&&e.clientX<=r.right+Hh&&e.clientY>=r.top-Hh&&e.clientY<=r.bottom+Hh}function XU(e){const t=e.getBoundingClientRect(),r=En(e);if(dw)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,y=p-t.height;return{left:t.left-b/2,right:t.right+b/2,top:t.top-y/2,bottom:t.bottom+y/2}}const WU="data-popup-side",QU=400,ZU={...Xp,...Lg,popupSide:e=>e?{[WU]:e}:null,value:()=>null},JU=x.forwardRef(function(t,r){var ve;const{render:a,className:i,id:c,disabled:u=!1,nativeButton:f=!0,style:m,...h}=t,{setTouched:g,setFocused:p,validationMode:b,validation:y,state:w,disabled:C}=Iu(),{labelId:S}=Vf(),N=wa(),{readOnly:E,required:k,disabled:A}=px(),O=C||A||u,R=N.useState("open"),T=N.useState("mounted"),M=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"),Y=T&&_?G:null,W=c??B,q=KU(S,P);Uf({id:c});const ee=qn(_),z=x.useRef(null),{getButtonProps:L,buttonRef:X}=bo({disabled:O,native:f}),te=N.useStateSetter("triggerElement"),$=us(),U=us(),F=us();x.useEffect(()=>{if(R)return F.start(QU,()=>{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()},[R,N,U,F]);const K=Qs(D,{id:W,role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":R?(H==null?void 0:H.id)??((ve=Qp(_))==null?void 0:ve.id):void 0,"aria-labelledby":q,"aria-readonly":E||void 0,"aria-required":k||void 0,tabIndex:O?-1:0,onFocus(ae){p(!0),R&&N.context.alignItemWithTriggerActiveRef.current&&N.context.setOpen(!1,vt(Ur,ae.nativeEvent)),$.start(0,()=>{N.set("forceMount",!0)})},onBlur(ae){gt(_,ae.relatedTarget)||(g(!0),p(!1),b==="onBlur"&&y.commit(M))},onMouseDown(ae){if(R)return;const le=Ht(ae.currentTarget);function re(Q){if(!z.current)return;const Z=Q.target;gt(z.current,Z)||gt(ee.current,Z)||iM(Q,z.current)||N.context.setOpen(!1,vt(YO,Q))}U.start(0,()=>{le.addEventListener("mouseup",re,{once:!0})})}},h,L),se=y.getValidationProps(O,K);se.role="combobox";const ne={...w,open:R,disabled:O,value:M,readOnly:E,popupSide:Y,placeholder:!V};return Nt("button",t,{ref:[r,z,X,te],state:ne,stateAttributesMapping:ZU,props:se})}),e7={value:()=>null},t7=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"),y=h.useState("hasSelectedValue"),w=!y&&u!=null&&c==null,C=h.useState("hasNullItemLabel",w),S={value:g,placeholder:!y};let N=null;return typeof c=="function"?N=c(g):c!=null?N=c:w&&!C?N=u:Array.isArray(g)?N=GU(g,p,b):N=aM(g,p,b),Nt("span",t,{state:S,ref:[r,h.context.valueRef],props:[{children:N},m],stateAttributesMapping:e7})}),n7=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:iw})}),s7=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}),lM=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function r7(){return x.useContext(lM)}function em(e){const{children:t,elementsRef:r,labelsRef:a,onMapChange:i}=e,c=st(i),[,u]=x.useState(!1),f=bs(a7).current,m=bs(o7).current,h=x.useRef(0),g=x.useRef(!0),p=x.useRef(null),b=x.useRef(null),y=st(()=>{g.current||(g.current=!0,u(O=>!O))}),w=st((O,R)=>{m.set(O,R),y()}),C=st(O=>{m.delete(O),y()}),S=st(O=>{const R=new Map;return r.current.length=0,a&&(a.current.length=0),O.forEach(T=>{var M,D;R.set(T.element,{...T.registration.metadata??{},index:T.index}),r.current[T.index]=T.element,a&&(a.current[T.index]=T.registration.label!==void 0?T.registration.label:((D=(M=T.registration.textRef)==null?void 0:M.current)==null?void 0:D.textContent)??T.element.textContent)}),h.current=r.current.length,R});function N(O){var M;if((M=b.current)==null||M.disconnect(),b.current=null,typeof MutationObserver!="function"||O.length<2)return;const R=new MutationObserver(D=>{if(!c7(D))return;let _=null;for(const H of O)if(H.isConnected){if(_&&cM(_,H)>0){R.disconnect(),y();return}_=H}});b.current=R;const T=new Set;for(let D=1;D<O.length;D+=1){const _=l7(O[D-1],O[D]);_&&T.add(_)}T.forEach(D=>R.observe(D,{childList:!0}))}const E=st(()=>{const[O,R]=i7(m),T=S(O),M=p.current,D=!M||M.length!==O.length||O.some((_,H)=>{const G=M[H];return _.index!==G.index||_.element!==G.element||_.registration.index!==G.registration.index||_.registration.metadata!==G.registration.metadata});N(R),p.current=O,g.current=!1,D&&(f.forEach(_=>_(T)),c(T))});We(()=>(!g.current&&p.current&&S(p.current),()=>{r.current=[],a&&(a.current=[])}),[r,a,S]),We(()=>{g.current&&E()}),We(()=>()=>{var O;(O=b.current)==null||O.disconnect(),g.current=!0},[]);const k=st(O=>(f.add(O),()=>{f.delete(O)})),A=x.useMemo(()=>({register:w,unregister:C,subscribeMapChange:k,nextIndexRef:h}),[w,C,k,h]);return n.jsx(lM.Provider,{value:A,children:t})}function o7(){return new Map}function a7(){return new Set}function i7(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)=>cM(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 l7(e,t){let r=e.parentElement;for(;r&&!r.contains(t);)r=r.parentElement;return r}function c7(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 cM(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const u7=x.createContext(void 0);function gx(){const e=x.useContext(u7);return(e==null?void 0:e.direction)??"ltr"}const d7=e=>({name:"arrow",options:e,async fn(t){var ee,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=n5(g),y={x:r,y:a},w=gw(i),C=pw(w),S=await u.getDimensions(h),N=w==="y",E=N?"top":"left",k=N?"bottom":"right",A=N?"clientHeight":"clientWidth",O=c.reference[C]+c.reference[w]-y[w]-c.floating[C],R=y[w]-c.reference[w],T=p==="real"?await((ee=u.getOffsetParent)==null?void 0:ee.call(u,h)):f.floating;let M=f.floating[A]||c.floating[C];(!M||!await((z=u.isElement)==null?void 0:z.call(u,T)))&&(M=f.floating[A]||c.floating[C]);const D=O/2-R/2,_=M/2-S[C]/2-1,H=Math.min(b[E],_),G=Math.min(b[k],_),B=H,P=M-S[C]-G,V=M/2-S[C]/2+D,Y=t5(B,V,P),W=!m.arrow&&Xa(i)!=null&&V!==Y&&c.reference[C]/2-(V<B?H:G)-S[C]/2<0,q=W?V<B?V-B:V-P:0;return{[w]:y[w]+q,data:{[w]:Y,centerOffset:V-Y-q,...W&&{alignmentOffset:q}},reset:W}}}),f7=(e,t)=>{const{name:r,fn:a}=d7(e);return{name:r,fn:a,options:[e,t]}},m7={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}}}},h7={sideX:"left",sideY:"top"},p7="--available-width",g7="--available-height",x7="--anchor-width",b7="--anchor-height",y7="--transform-origin",NT=p7,CT=g7;function uM(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 kT(e,t,r){const{rects:a,placement:i}=e;return{side:uM(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 v7(e,ZV)}function v7(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:y,keepMounted:w=!1,floatingRootContext:C,mounted:S,collisionAvoidance:N,shift:E,nodeId:k,adaptiveOrigin:A,lazyFlip:O=!1,externalTree:R}=e,[T,M]=x.useState(null);!S&&T!==null&&M(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),Y=P?V:r,W=qn(r),q=qn(S),z=gx()==="rtl",L=T||{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 te=h;typeof te=="number"?te={top:te,right:te,bottom:te,left:te}:te&&(te={top:te.top||0,right:te.right||0,bottom:te.bottom||0,left:te.left||0});const $=1,U=i==="bottom"?$:0,F=i==="top"?$:0,K=i==="right"?$:0,se=i==="left"?$:0,ne={boundary:m==="clipping-ancestors"?"clippingAncestors":m,padding:te},ve=x.useRef(null),ae=qn(c),le=qn(f),re=typeof c!="function"?c:0,Q=typeof f!="function"?f:0,Z=[];y&&Z.push(y),Z.push(RV(Be=>{const jt=kT(Be,i,z),Ze=typeof ae.current=="function"?ae.current(jt):ae.current,kt=typeof le.current=="function"?le.current(jt):le.current;return{mainAxis:Ze,crossAxis:kt,alignmentAxis:kt}},[re,Q,z,i]));const pe=_==="none"&&D!=="shift",ue=!pe&&(g||G||D==="shift"),ye=D==="none"?null:MV({...ne,padding:{top:te.top+$+U,right:te.right+$+se,bottom:te.bottom+$+F,left:te.left+$+K},mainAxis:!G&&D==="flip",crossAxis:_==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),Ce=pe?null:AV({...ne,rootBoundary:B,mainAxis:_!=="none",crossAxis:ue,limiter:g||G?void 0:OV(Be=>{if(!ve.current)return{};const{width:jt,height:Ze}=ve.current.getBoundingClientRect(),kt=co(uo(Be.placement)),je=kt==="y"?jt:Ze,Ye=kt==="y"?te.left+te.right:te.top+te.bottom;return{offset:je/2+Ye/2}})},[ne,g,G,B,te,_]);D==="shift"||_==="shift"||u==="center"?Z.push(Ce,ye):Z.push(ye,Ce),Z.push(DV({...ne,apply({elements:{floating:Be},availableWidth:jt,availableHeight:Ze,rects:kt}){if(!q.current)return;const je=Be.style;je.setProperty(NT,`${jt}px`),je.setProperty(CT,`${Ze}px`);const Ye=En(Be).devicePixelRatio||1,{x:et,y:it,width:lt,height:wt}=kt.reference,cn=(Math.round((et+lt)*Ye)-Math.round(et*Ye))/Ye,Gt=(Math.round((it+wt)*Ye)-Math.round(it*Ye))/Ye;je.setProperty(x7,`${cn}px`),je.setProperty(b7,`${Gt}px`)}}),f7(Be=>({element:ve.current||Ht(Be.elements.floating).createElement("div"),padding:ve.current?p:0,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(Be){var Kn,ce,tt,Tt,rn,xn;const{elements:{floating:jt},middlewareData:Ze,placement:kt,platform:je,rects:Ye,y:et}=Be,it=uo(kt),lt=Xa(kt),wt=co(it)==="y",cn=ve.current,Gt=typeof c=="function"?c(kT(Be,i,z)):c;let fn;if(!cn&<&&Math.abs(wt?((Kn=Ze.shift)==null?void 0:Kn.x)||0:((ce=Ze.shift)==null?void 0:ce.y)||0)<=1)fn=lt==="start"===(wt&&((tt=je.isRTL)==null?void 0:tt.call(je,jt))===!0)?"100%":"0%";else{const Wt=wt?((Tt=Ze.arrow)==null?void 0:Tt.x)||0:((rn=Ze.arrow)==null?void 0:rn.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 ue&&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(y7,wt?`${fn} ${Bn}`:`${Bn} ${fn}`),{}}},m7,A),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:de,elements:Te,x:oe,y:fe,middlewareData:Re,update:Me,placement:ke,context:me,isPositioned:Ae,floatingStyles:ge}=t({rootContext:C,open:w?S:void 0,placement:X,middleware:Z,strategy:a,whileElementsMounted:w?void 0:(...Be)=>aT(...Be,Ie),nodeId:k,externalTree:R}),{sideX:Pe,sideY:Fe}=Re.adaptiveOrigin||h7,_e=Ae?a:"fixed",Xe=x.useMemo(()=>{let Be;return Ae?A?Be={position:_e,[Pe]:oe,[Fe]:fe}:Be={...ge,position:_e}:Be={position:_e,top:0,left:0},Be[NT]="100vw",Be[CT]="100vh",Ae||(Be.opacity=0),Be},[A,_e,Pe,oe,Fe,fe,ge,Ae]),Je=x.useRef(null);We(()=>{if(!S)return;const Be=W.current,jt=typeof Be=="function"?Be():Be,kt=(TT(jt)?jt.current:jt)||null||null;kt!==Je.current&&(de.setPositionReference(kt),Je.current=kt)},[S,de,Y,W]),x.useEffect(()=>{if(!S)return;const Be=W.current;typeof Be!="function"&&TT(Be)&&Be.current!==Je.current&&(de.setPositionReference(Be.current),Je.current=Be.current)},[S,de,Y,W]),x.useEffect(()=>{if(w&&S&&Te.reference&&Te.floating)return aT(Te.reference,Te.floating,Me,Ie)},[w,S,Te,Me,Ie]);const ct=uo(ke),At=uM(i,ct,z),rt=Xa(ke)||"center",be=!!((xt=Re.hide)!=null&&xt.referenceHidden);We(()=>{O&&S&&Ae&&ct!==L&&M(ct)},[O,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:ve,arrowUncentered:Qe,side:At,align:rt,physicalSide:ct,anchorHidden:be,refs:de,context:me,isPositioned:Ae,update:Me}),[Xe,Ue,ve,Qe,At,rt,ct,be,de,me,Ae,Me])}function TT(e){return e!=null&&"current"in e}const dM=x.createContext(void 0);function Uw(){const e=x.useContext(dM);if(!e)throw new Error(sn(59));return e}function rg(e,t){e&&Object.assign(e.style,t)}const fM={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};function tm(e){return e==="starting"?V8:Tn}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},tm(a),i],stateAttributesMapping:qf})}const w7=20;function Hw(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-w7)},[e,t,r]),F5(e&&(!t||i),a)}const j7={position:"fixed"},S7=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:y,sticky:w,disableAnchorTracking:C,alignItemWithTrigger:S=!0,collisionAvoidance:N=g5,style:E,...k}=t,A=wa(),O=tM(),R=A.useState("open"),T=A.useState("mounted"),M=A.useState("modal"),D=A.useState("value"),_=A.useState("openMethod"),H=A.useState("positionerElement"),G=A.useState("triggerElement"),B=A.useState("isItemEqualToValue"),P=A.useState("transitionStatus"),V=x.useRef(null),Y=x.useRef(null),[W,q]=x.useState(S),ee=T&&W&&_!=="touch";!T&&W!==S&&q(S),x.useImperativeHandle(A.context.alignItemWithTriggerActiveRef,()=>ee),Hw((ee||M)&&R,_==="touch",H,G);const z=xx({anchor:a,floatingRootContext:O,positionMethod:u,mounted:T,side:f,sideOffset:h,align:m,alignOffset:g,arrowPadding:y,collisionBoundary:p,collisionPadding:b,sticky:w,disableAnchorTracking:C??ee,collisionAvoidance:N,keepMounted:!0}),L=ee?"none":z.side,X=ee?j7:z.positionerStyles,te={open:R,side:L,align:z.align,anchorHidden:z.anchorHidden};We(()=>{A.set("popupSide",z.side)},[A,z.side]);const $=A.useStateSetter("positionerElement"),U=bx(t,te,{styles:X,transitionStatus:P,props:k,refs:[r,$],hidden:!T,inert:!R}),F=x.useRef(0),K=st(ne=>{if(A.context.valuesRef.current.length===0)return;const ve=F.current;F.current=ne.size;const ae=vt(Ur);if(ve!==0&&!A.state.multiple&&D!==null&&wp(A.context.valuesRef.current,D,B)===-1){const re=A.context.initialValueRef.current,Z=re!=null&&wp(A.context.valuesRef.current,re,B)!==-1?re:null;A.context.setValue(Z,ae),Z===null&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null)}if(ve!==0&&A.state.multiple&&Array.isArray(D)){const le=D.filter(re=>wp(A.context.valuesRef.current,re,B)!==-1);le.length!==D.length&&(A.context.setValue(le,ae),le.length===0&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null))}if(R&&ee){A.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const le={height:""};rg(H,le),rg(A.context.popupRef.current,le)}}),se=x.useMemo(()=>({...z,side:L,alignItemWithTriggerActive:ee,setControlledAlignItemWithTrigger:q,scrollUpArrowRef:V,scrollDownArrowRef:Y}),[z,L,ee,q]);return n.jsx(em,{elementsRef:A.context.listRef,labelsRef:A.context.labelsRef,onMapChange:K,children:n.jsxs(dM.Provider,{value:se,children:[T&&M&&n.jsx(cx,{inert:Jf(!R),cutout:G}),U]})})}),Fh="base-ui-disable-scrollbar",Yv={className:Fh,getElement(e){return n.jsx("style",{nonce:e,href:Fh,precedence:"base-ui:low",children:`.${Fh}{scrollbar-width:none}.${Fh}::-webkit-scrollbar{display:none}`})}},N7=x.createContext(void 0);function yx(e){return x.useContext(N7)}const C7=x.createContext(void 0),k7={disableStyleElements:!1};function T7(){return x.useContext(C7)??k7}const ET="--transform-origin",E7={...qf,...si},R7=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=tM(),{side:y,align:w,alignItemWithTriggerActive:C,isPositioned:S,setControlledAlignItemWithTrigger:N}=Uw(),E=yx()!=null,k=gx(),{nonce:A,disableStyleElements:O}=T7(),R=m.useState("id"),T=m.useState("open"),M=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),Y=x.useRef(!1),W=x.useRef({}),q=Tu(),ee=st(te=>{if(!B||!m.context.popupRef.current||!Y.current)return;const $=B.style.top==="0px",U=B.style.bottom==="0px";if(V.current||!C||!$&&!U){m.context.handleScrollArrowVisibility(te);return}const F=AT(B),K=Wd(B.getBoundingClientRect().height,"y",F),se=Ht(B),ne=En(B),ve=ne.getComputedStyle(B),ae=parseFloat(ve.marginTop),le=parseFloat(ve.marginBottom),re=RT(ne.getComputedStyle(m.context.popupRef.current)),Q=Math.min(se.documentElement.clientHeight-ae-le,re),Z=te.scrollTop,pe=Gh(te);let ue=null;const ye=Te=>{B.style.height=`${Te}px`},Ce=$?pe-Z:Z,Ie=Math.min(K+Ce,Q);if(Ce<=zo){const Te=Xd(Ce,0,Q-K);Te>0&&ye(K+Te),te.scrollTop=$?pe:0,Q-(K+Te)<=zo&&(V.current=!0),m.context.handleScrollArrowVisibility(te);return}if(Q-Ie>zo)ue=$?1/0:0;else if(U&&Z<pe){const Te=K+Ce-Q;ue=Z-(Ce-Te)}const de=Math.ceil(Ie);if(de!==0&&ye(de),ue!=null){const Te=Xd(ue,0,Gh(te));Math.abs(te.scrollTop-Te)>zo&&(te.scrollTop=Te)}de>=Q-zo&&(V.current=!0),m.context.handleScrollArrowVisibility(te)});x.useImperativeHandle(m.context.scrollHandlerRef,()=>ee,[ee]),Sr({open:T,ref:m.context.popupRef,onComplete(){T&&m.context.onOpenChangeComplete(!0)}});const z={open:T,transitionStatus:H,side:y,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(()=>{T||C||(Y.current=!1,V.current=!1,rg(B,W.current))},[T,C,B]),We(()=>{var U,F;const te=m.context.popupRef.current;if(!T||!G||!B||!te||C&&!S||m.state.transitionStatus==="ending")return;if(Y.current=!0,te.style.removeProperty(ET),!C){q.request(()=>m.context.handleScrollArrowVisibility(P||te));return}const $=A7(te);try{let K=m.context.selectedItemTextRef.current;K!=null&&K.isConnected||(K=!m.select("hasSelectedValue")&&((U=m.context.firstItemTextRef.current)!=null&&U.isConnected)?m.context.firstItemTextRef.current:null);const se=m.context.valueRef.current,ne=En(B),ve=ne.getComputedStyle(B),ae=ne.getComputedStyle(te),le=Ht(G),re=AT(G),Q=qh(G.getBoundingClientRect(),re),Z=qh(B.getBoundingClientRect(),re),pe=Q.height,ue=P||te,ye=ue.scrollHeight,Ce=parseFloat(ae.borderBottomWidth),Ie=parseFloat(ve.marginTop)||10,de=parseFloat(ve.marginBottom)||10,Te=parseFloat(ve.minHeight)||100,oe=RT(ae),fe=5,Re=5,Me=20,ke=le.documentElement.clientHeight-Ie-de,me=le.documentElement.clientWidth,Ae=ke-Q.bottom+pe;let ge,Pe=k==="rtl"?Q.right-Z.width:Q.left,Fe=0;if(K&&se){const Ke=qh(se.getBoundingClientRect(),re);ge=qh(K.getBoundingClientRect(),re),Pe=Z.left+(k==="rtl"?Ke.right-ge.right:Ke.left-ge.left);const Be=Ke.top-Q.top+Ke.height/2;Fe=ge.top-Z.top+ge.height/2-Be}const _e=Ae+Fe+de+Ce;let Xe=Math.min(ke,_e);const Je=ke-Ie-de,ct=_e-Xe,At=me-Re;B.style.left=`${Xd(Pe,fe,At-Z.width)}px`,B.style.height=`${Xe}px`,B.style.maxHeight="none",B.style.marginTop=`${Ie}px`,B.style.marginBottom=`${de}px`,te.style.height="100%";const rt=Gh(ue),be=ct>=rt-zo;be&&(Xe=Math.min(ke,Z.height)-(ct-rt));const Ue=Q.top<Me||Q.bottom>ke-Me||Math.ceil(Xe)+zo<Math.min(ye,Te),Qe=(((F=ne.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(be){const Ke=Math.max(0,ke-_e);B.style.top=Z.height>=Je?"0":`${Ke}px`,B.style.height=`${Xe}px`,ue.scrollTop=Gh(ue)}else B.style.bottom="0",ue.scrollTop=ct;if(ge){const Ke=Z.top,Be=Z.height,jt=ge.top+ge.height/2,Ze=Xd(Be>0?(jt-Ke)/Be*100:50,0,100);te.style.setProperty(ET,`50% ${Ze}%`)}(xt===ke||Xe>=oe)&&(V.current=!0),m.context.handleScrollArrowVisibility(ue),p&&m.state.selectedIndex===null&&m.state.activeIndex===null&&m.context.listRef.current[0]!=null&&m.set("activeIndex",0)}finally{$()}},[m,T,B,G,C,N,q,P,p,k,S]),x.useEffect(()=>{if(!C||!B||!T)return;const te=En(B);function $(U){m.context.setOpen(!1,vt($B,U))}return $t(te,"resize",$)},[m,C,B,T]);const L={...P?{role:"presentation"}:{role:"listbox","aria-multiselectable":h||void 0,"aria-readonly":g||void 0,id:`${R}-list`},onKeyDown(te){E&&Zf.has(te.key)&&te.stopPropagation()},onScroll(te){P||ee(te.currentTarget)},...C&&{style:P?{height:"100%"}:fM},className:!P&&C?Yv.className:void 0},X=Nt("div",t,{ref:[r,m.context.popupRef],state:z,stateAttributesMapping:E7,props:[_,L,tm(H),f]});return n.jsxs(x.Fragment,{children:[!O&&Yv.getElement(A),n.jsx(Jg,{context:b,modal:!1,disabled:!D,openInteractionType:M,returnFocus:u,restoreFocus:!0,children:X})]})});function RT(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Gh(e){return Vw(e.scrollHeight,e.clientHeight)}function AT(e){return A5.getScale(e)}function Wd(e,t,r){return e/r[t]}function qh(e,t){return bf({x:Wd(e.x,"x",t),y:Wd(e.y,"y",t),width:Wd(e.width,"x",t),height:Wd(e.height,"y",t)})}const OT=[["transform","none"],["scale","1"],["translate","0 0"]];function A7(e){const{style:t}=e,r={};for(const[a,i]of OT)r[a]=t.getPropertyValue(a),t.setProperty(a,i,"important");return()=>{for(const[a]of OT){const i=r[a];i?t.setProperty(a,i):t.removeProperty(a)}}}const O7=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=wa(),{multiple:m,readOnly:h}=px(),{alignItemWithTriggerActive:g}=Uw(),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:fM},className:p&&b!=="touch"?Yv.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}=r7(),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),y=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:y}}const mM=x.createContext(void 0);function Fw(){const e=x.useContext(mM);if(!e)throw new Error(sn(57));return e}const M7=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}),y=wa(),{itemProps:w,multiple:C,disabled:S,readOnly:N}=px(),E=S||m,k=y.useState("isActive",b.index),A=y.useState("open"),O=y.useState("isSelected",u),R=y.useState("isSelectedByFocus",b.index),T=y.useState("isItemEqualToValue"),M=b.index,D=x.useRef(null);We(()=>{const z=y.context.valuesRef.current;return z[M]=u,()=>{delete z[M]}},[M,u,y]),We(()=>{const z=y.state.value,L=y.state.selectedIndex;let X=L,te;C&&Array.isArray(z)?(X=BU(M,u,y.context.valuesRef.current,z,T,L),te=X===M,M===L&&!te&&(y.context.selectedItemTextRef.current=null)):(te=z!==void 0&&ac(u,z,T),te&&(X=M)),y.set("selectedIndex",X),te&&p.current&&(y.context.selectedItemTextRef.current=p.current)},[M,C,T,y,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:O,highlighted:k};function V(z){if(S||N)return;const L=y.state.value;if(C){const X=Array.isArray(L)?L:[],te=O?VU(X,u,T):[...X,u];y.context.setValue(te,vt(Zl,z))}else y.context.setValue(u,vt(Zl,z)),y.context.setOpen(!1,vt(Zl,z))}function Y(){y.context.selectionRef.current.dragY=0}const W={role:"option","aria-selected":O,tabIndex:A&&k?0:-1,onKeyDown(z){y.set("activeIndex",M),z.key===" "&&y.context.typingRef.current&&z.preventDefault()},onClick(z){const L=_.current!=="touch",X=z.nativeEvent.pointerType,te=L&&Yg(z.nativeEvent)&&(X!==void 0||k),$=L&&!te&&!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=y.context.selectionRef.current;L.dragY+=z.movementY,L.dragY**2>=64&&(L.allowUnselectedMouseUp=!0)}},onPointerDown(z){_.current=z.pointerType,H.current=!0,Y()},onMouseUp(){var X;if(Y(),E||_.current==="touch"||H.current)return;const z=!y.context.selectionRef.current.allowSelectedMouseUp&&O,L=!y.context.selectionRef.current.allowUnselectedMouseUp&&!O;z||L||(H.current=!0,(X=D.current)==null||X.click(),H.current=!1)}},q=Nt("div",t,{ref:[B,r,b.ref,D],state:P,props:[w,W,g,G]}),ee=x.useMemo(()=>({selected:O,index:M,textRef:p,selectedByFocus:R}),[O,M,p,R]);return n.jsx(mM.Provider,{value:ee,children:q})})),D7=x.forwardRef(function(t,r){const{selected:a}=Fw();return t.keepMounted||a?n.jsx(z7,{...t,ref:r}):null}),z7=x.memo(x.forwardRef((e,t)=>{const{render:r,className:a,style:i,keepMounted:c,...u}=e,{selected:f}=Fw(),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})),I7=x.memo(x.forwardRef(function(t,r){const{index:a,textRef:i,selectedByFocus:c}=Fw(),u=wa(),{render:f,className:m,style:h,...g}=t,p=x.useCallback(y=>{y&&(a===0&&(u.context.firstItemTextRef.current=y),c&&(u.context.selectedItemTextRef.current=y))},[u,a,c]);return Nt("div",t,{ref:[p,r,i],props:g})})),hM=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:y}=Uw(),w=h?"scrollUpArrowVisible":"scrollDownArrowVisible",C=g.useState(w),S=g.useState("openMethod"),N=C&&S!=="touch",E=us(),k=h?y:b,{mounted:A,transitionStatus:O,setMounted:R}=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:k,onComplete(){N||R(!1)}});const D=Nt("div",t,{ref:[r,k],state:{direction:u,visible:N,side:p,transitionStatus:O},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 q;const B=g.state.listElement??g.context.popupRef.current;if(!B)return;g.set("activeIndex",null),g.context.handleScrollArrowVisibility(B);const P=Vw(B.scrollHeight,B.clientHeight),V=sg(B.scrollTop,P),Y=V===(h?0:P),W=g.context.listRef.current;if(V!==B.scrollTop&&(B.scrollTop=V),Y){E.clear();return}if(W.length>0){const ee=((q=k.current)==null?void 0:q.offsetHeight)||0;B.scrollTop=P7(W,h,V,B.clientHeight,ee,P)}E.start(40,G)}E.start(40,G)},onMouseLeave(){E.clear()}},m],stateAttributesMapping:si});return A||f?D:null});function P7(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),y=e[b];return b<g&&y?sg(y.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 _7=x.forwardRef(function(t,r){return n.jsx(hM,{...t,ref:r,direction:"down"})}),L7=x.forwardRef(function(t,r){return n.jsx(hM,{...t,ref:r,direction:"up"})}),$7=x.createContext(void 0),B7=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($7.Provider,{value:h,children:g})}),jp=YU;function MT({className:e,...t}){return n.jsx(B7,{"data-slot":"select-group",className:Ve("scroll-my-1 p-1",e),...t})}function Sp({className:e,...t}){return n.jsx(t7,{"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(JU,{"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(n7,{render:n.jsx(ma,{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(s7,{children:n.jsx(S7,{side:r,sideOffset:a,align:i,alignOffset:c,alignItemWithTrigger:u,className:"isolate z-50",children:n.jsxs(R7,{"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(V7,{}),n.jsx(O7,{children:t}),n.jsx(U7,{})]})})})}function Qd({className:e,children:t,...r}){return n.jsxs(M7,{"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(I7,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),n.jsx(D7,{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 V7({className:e,...t}){return n.jsx(L7,{"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(TO,{})})}function U7({className:e,...t}){return n.jsx(_7,{"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(ma,{})})}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(Qd,{className:"text-xs",value:m.value,disabled:m.disabled,children:m.label},m.value))})]})}const pM=x.createContext(void 0);function Gw(){const e=x.useContext(pM);if(e===void 0)throw new Error(sn(64));return e}const H7="data-activation-direction",vx={tabActivationDirection:e=>({[H7]:e})},F7=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([]),[y,w]=x.useState(()=>new Map),[C,S]=po({controlled:m,default:i,name:"Tabs",state:"value"}),N=m!==void 0,[E,k]=x.useState(()=>new Map),A=x.useRef(void 0),O=x.useCallback(se=>Kv(E,se),[E]),[R,T]=x.useState(()=>({previousValue:C,tabActivationDirection:"none"})),{previousValue:M,tabActivationDirection:D}=R;let _=D,H=!1;M!==C&&(_=DT(M,C,u,E),H=M!=null&&C!=null&&O(C)==null);const G=H?M:C,B=M!==G||D!==_;We(()=>{B&&T({previousValue:G,tabActivationDirection:_})},[G,B,_]);const P=st((se,ne)=>{const ve=DT(C,se,u,E);ne.activationDirection=ve,c==null||c(se,ne),!ne.isCanceled&&S(se)}),V=st((se,ne)=>{c==null||c(se,vt(ne,void 0,void 0,{activationDirection:"none"}))}),Y=st((se,ne)=>(w(ve=>{const ae=new Map(ve);return ae.set(se,ne),ae}),()=>{w(ve=>{if(ve.get(se)!==ne)return ve;const ae=new Map(ve);return ae.delete(se),ae})})),W=x.useCallback(se=>y.get(se),[y]),q=x.useCallback(se=>{for(const ne of E.values())if(se===ne.value)return ne.id},[E]),ee=x.useMemo(()=>({getTabElementBySelectedValue:O,getTabIdByPanelValue:q,getTabPanelIdByValue:W,onValueChange:P,orientation:u,registerMountedTabPanel:Y,setTabMap:k,tabActivationDirection:_,value:C}),[O,q,W,P,u,Y,k,_,C]),z=x.useMemo(()=>{for(const se of E.values())if(se.value===C)return se},[E,C]),L=x.useMemo(()=>{for(const se of E.values())if(!se.disabled)return se.value},[E]),X=x.useRef(!p),te=x.useRef(i),$=x.useRef(p),U=x.useRef(!1);We(()=>{var le;if(N)return;function se(re,Q){S(re),T({previousValue:re,tabActivationDirection:"none"}),V(re,Q),X.current=!1}if(E.size===0){U.current&&C!==null&&!((le=A.current)!=null&&le.isConnected)&&se(null,$k);return}U.current=!0,A.current=E.keys().next().value;const ne=z==null?void 0:z.disabled,ve=z==null&&C!==null;if(!ne&&C===te.current&&($.current=!1),$.current&&ne&&C===te.current)return;const ae=X.current;if(ne||ve){const re=L??null;if(C===re){X.current=!1;return}let Q=$k;ae?Q=Bk:ne&&(Q=KO),se(re,Q);return}ae&&z!=null&&(V(C,Bk),X.current=!1)},[L,N,V,z,S,E,C]);const K=Nt("div",t,{state:{orientation:u,tabActivationDirection:_},ref:r,props:g,stateAttributesMapping:vx});return n.jsx(pM.Provider,{value:ee,children:n.jsx(em,{elementsRef:b,children:K})})});function Kv(e,t){for(const[r,a]of e.entries())if(t===a.value)return r;return null}function DT(e,t,r,a){if(e==null||t==null)return"none";const[i,c,u]=r==="horizontal"?["left","left","right"]:["top","up","down"],f=Kv(a,e),m=Kv(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 qw="data-composite-item-active";function gM(e={}){const{highlightItemOnHover:t,highlightedIndex:r,onHighlightedIndexChange:a}=Dg(),{ref:i,index:c}=pc(e),u=r===c,f=x.useRef(null),m=ho(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 xM=x.createContext(void 0);function G7(){const e=x.useContext(xM);if(e===void 0)throw new Error(sn(65));return e}const q7=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:y,orientation:w,tabActivationDirection:C}=Gw(),{activateOnFocus:S,registerTabResizeObserverElement:N,tabsListElement:E}=G7(),{highlightedIndex:k,onHighlightedIndexChange:A}=Dg(),O=vs(f),R=x.useMemo(()=>({disabled:i,id:O,value:u}),[i,O,u]),{compositeProps:T,compositeRef:M,index:D}=gM({metadata:R}),_=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&&k!==D))return;const U=E;if(U!=null){const F=Xs(Ht(U));if(F&>(U,F))return}i||A(D)},[_,D,k,A,i,E]);const{getButtonProps:P,buttonRef:V}=bo({disabled:i,native:m,focusableWhenDisabled:!0}),Y=b(u),W=x.useRef(!1),q=x.useRef(!1);function ee(U){y(u,vt(Ur,U.nativeEvent,void 0,{activationDirection:"none"}))}function z(U){_||i||ee(U)}function L(U){_||i||S&&(!W.current||q.current)&&ee(U)}function X(U){if(_||i)return;W.current=!0,q.current=U.button===0;const F=Ht(U.currentTarget);function K(){W.current=!1,q.current=!1,F.removeEventListener("pointerup",K),F.removeEventListener("pointercancel",K)}F.addEventListener("pointerup",K),F.addEventListener("pointercancel",K)}return Nt("button",t,{state:{disabled:i,active:_,orientation:w,tabActivationDirection:C},ref:[r,V,M,B],props:[T,{role:"tab","aria-controls":Y,"aria-selected":_,id:O,onClick:z,onFocus:L,onPointerDown:X,[qw]:_?"":void 0,onKeyDownCapture(){H.current=!0}},g,P],stateAttributesMapping:vx})}),Y7="data-index",K7={...vx,...si},X7=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:y}=Gw(),w=vs(),{ref:C,index:S}=pc(),N=i===h,{mounted:E,transitionStatus:k,setMounted:A}=ni(N),O=!E,R=g(i),T={hidden:O,orientation:p,tabActivationDirection:b,transitionStatus:k},M=x.useRef(null),D=Nt("div",t,{state:T,ref:[r,C,M],props:[{"aria-labelledby":R,hidden:O,id:w,role:"tabpanel",tabIndex:N?0:-1,inert:Jf(!N),[Y7]:S},m],stateAttributesMapping:K7});return Sr({open:N,ref:M,onComplete(){N||A(!1)}}),We(()=>{if(!(w==null||O&&!u))return y(i,w)},[O,u,i,w,y]),u||E?D:null});function W7(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,[y,w]=x.useState(0),C=a!=null,S=x.useRef(null),N=ho(S,m),E=x.useRef([]),k=x.useRef(!1),A=x.useRef(null),O=u??y,R=st((H,G=!1)=>{if(A.current=E.current[H]??null,(f??w)(H),G){const B=E.current[H];xT(S.current,B,c,r)}}),T=st(H=>{var V;if(H.size===0)return;if(k.current){const Y=E.current,W=Y.indexOf(A.current);if(W===-1){const q=Y[O];!q||xu(Y,O,p)?R(Q7(Y,p)):A.current=q}else W!==O&&R(W);return}k.current=!0;const G=Array.from(H.keys()),B=G.find(Y=>Y==null?void 0:Y.hasAttribute(qw))??null,P=B?((V=H.get(B))==null?void 0:V.index)??-1:-1;if(P!==-1)R(P);else if(xu(G,O,p)){const Y=Ba(G,{disabledIndices:p});nf(G,Y)||R(Y)}xT(S.current,B,c,r)});We(()=>{if(p==null||u!=null||!k.current)return;const H=E.current;if(xu(H,O,p)){const G=Ba(H,{disabledIndices:p});nf(H,G)||R(G)}},[p,u,O,E,R]);const M=st((H,G,B)=>i?i(H,G,B,E):B),D=st(H=>{const G=H.key===Uv||H.key===Hv;if(!Zf.has(H.key)||!h&&G||Z7(H,b)||!S.current)return;const P=c==="rtl",V=P?Bv:Vv,Y=P?Vv:Bv,W=r==="vertical"?$v:V,q=r==="vertical"?Lv:Y,ee=Vs(H.nativeEvent);if(ee!=null&&gT(ee)&&!Q5(ee)){const U=ee.selectionStart,F=ee.selectionEnd,K=ee.value;if(U==null||H.shiftKey||U!==F||H.key!==q&&U<K.length||H.key!==W&&U>0)return}let z=O;const L=bp(E,p),X=Dv(E,p);a!=null&&(z=a({disabledIndices:p,elementsRef:E,event:H,highlightedIndex:O,loopFocus:t,maxIndex:X,minIndex:L,onLoop:M,orientation:r,rtl:P}));const te=r!=="vertical"&&H.key===V||r!=="horizontal"&&H.key===$v,$=r!=="vertical"&&H.key===Y||r!=="horizontal"&&H.key===Lv;h&&(H.key===Uv?z=L:H.key===Hv&&(z=X)),z===O&&(te||$)&&(t&&z===X&&te?(z=L,i&&(z=i(H,O,z,E))):t&&z===L&&$?(z=X,i&&(z=i(H,O,z,E))):z=Ba(E.current,{startingIndex:z,decrement:$,disabledIndices:p})),z!==O&&!nf(E.current,z)&&(g&&H.stopPropagation(),(C||G||te||$)&&H.preventDefault(),R(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||!gT(B)||B.setSelectionRange(0,B.value.length)},onKeyDown:D},highlightedIndex:O,onHighlightedIndexChange:R,elementsRef:E,onMapChange:T,relayKeyboardEvent:D}}function Q7(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(qw))return a;r===-1&&(r=a)}}return Math.max(r,0)}function Z7(e,t){for(const r of lU)if(!t.includes(r)&&e.getModifierState(r))return!0;return!1}function bM(e){const{render:t,className:r,style:a,refs:i=Vr,props:c=Vr,state:u=Tn,stateAttributesMapping:f,highlightedIndex:m,onHighlightedIndexChange:h,orientation:g,grid:p,loopFocus:b,onLoop:y,enableHomeAndEndKeys:w,onMapChange:C,stopEventPropagation:S=!0,rootRef:N,disabledIndices:E,modifierKeys:k,highlightItemOnHover:A=!1,tag:O="div",...R}=e,T=gx(),{props:M,highlightedIndex:D,onHighlightedIndexChange:_,elementsRef:H,onMapChange:G,relayKeyboardEvent:B}=W7({grid:p,loopFocus:b,onLoop:y,orientation:g,highlightedIndex:m,onHighlightedIndexChange:h,rootRef:N,stopEventPropagation:S,enableHomeAndEndKeys:w,direction:T,disabledIndices:E,modifierKeys:k}),P=Nt(O,e,{state:u,ref:i,props:[M,...c,R],stateAttributesMapping:f}),V=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:_,highlightItemOnHover:A,relayKeyboardEvent:B}),[D,_,A,B]);return n.jsx(tO.Provider,{value:V,children:n.jsx(em,{elementsRef:H,onMapChange:Y=>{C==null||C(Y),G(Y)},children:P})})}const J7=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}=Gw(),[b,y]=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 M=new ResizeObserver(()=>{S.current.forEach(D=>{D()})});return E.current=M,w&&M.observe(w),N.current.forEach(D=>{M.observe(D)}),()=>{M.disconnect(),E.current=null}},[w]);const k=st(M=>(S.current.add(M),()=>{S.current.delete(M)})),A=st(M=>{var D;return N.current.add(M),(D=E.current)==null||D.observe(M),()=>{var _;N.current.delete(M),(_=E.current)==null||_.unobserve(M)}}),O={orientation:h,tabActivationDirection:p},R={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},T=x.useMemo(()=>({activateOnFocus:a,registerIndicatorUpdateListener:k,registerTabResizeObserverElement:A,tabsListElement:w}),[a,k,A,w]);return n.jsx(xM.Provider,{value:T,children:n.jsx(bM,{render:u,className:i,style:f,state:O,refs:[r,C],props:[R,m],stateAttributesMapping:vx,highlightedIndex:b,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:y,onMapChange:g,disabledIndices:Vr})})});function nm({className:e,orientation:t="horizontal",...r}){return n.jsx(F7,{"data-slot":"tabs","data-orientation":t,className:Ve("group/tabs flex gap-2 data-horizontal:flex-col",e),...r})}const eH=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 sm({className:e,variant:t="default",...r}){return n.jsx(J7,{"data-slot":"tabs-list","data-variant":t,className:Ve(eH({variant:t}),e),...r})}function Pr({className:e,...t}){return n.jsx(q7,{"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(X7,{"data-slot":"tabs-content",className:Ve("flex-1 text-sm outline-none",e),...t})}const yM=x.createContext(void 0);function vM(){const e=x.useContext(yM);if(e===void 0)throw new Error(sn(10));return e}const tH={value:()=>null},nH=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:y,style:w,...C}=t,S=y??Vr,N=x.useRef([]),[E,k]=po({controlled:b,default:S,name:"Accordion",state:"value"}),A=st((M,D,_)=>{if(g)if(D){const H=E.slice();if(H.push(M),h==null||h(H,_),_.isCanceled)return;k(H)}else{const H=E.filter(G=>G!==M);if(h==null||h(H,_),_.isCanceled)return;k(H)}else{const H=E[0]===M?[]:[M];if(h==null||h(H,_),_.isCanceled)return;k(H)}}),O=x.useMemo(()=>({value:E,disabled:c,orientation:p}),[E,c,p]),R=x.useMemo(()=>({disabled:c,handleValueChange:A,hiddenUntilFound:u??!1,keepMounted:f??!1,state:O,value:E}),[c,A,u,f,O,E]),T=Nt("div",t,{state:O,ref:r,props:C,stateAttributesMapping:tH});return n.jsx(yM.Provider,{value:R,children:n.jsx(em,{elementsRef:N,children:T})})});function sH(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=vs(),[p,b]=x.useState(),y=p===null?void 0:p??g,w=st(C=>{const S=!c,N=vt(ha,C.nativeEvent);a(S,N),!N.isCanceled&&u(S)});return x.useMemo(()=>({defaultPanelId:g,disabled:i,handleTrigger:w,mounted:f,open:c,panelId:y,setMounted:m,setOpen:u,setPanelIdState:b,transitionStatus:h}),[g,i,w,f,c,y,m,u,b,h])}const wM=x.createContext(void 0);function jM(){const e=x.useContext(wM);if(e===void 0)throw new Error(sn(15));return e}const SM=x.createContext(void 0);function Yw(){const e=x.useContext(SM);if(e===void 0)throw new Error(sn(9));return e}const rH="data-open",oH="data-closed",aH=aw,iH="data-panel-open",lH={[rH]:""},cH={[oH]:""},uH={open(e){return e?{[iH]:""}:null}},dH={open(e){return e?lH:cH}},fH="data-index",Kw={...dH,index:e=>({[fH]:String(e)}),...si,value:()=>null},mH=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=ho(r,g),{disabled:y,handleValueChange:w,state:C,value:S}=vM(),N=vs(),E=f??N,k=i||y,A=S.indexOf(E)!==-1,O=st((Y,W)=>{c==null||c(Y,W),!W.isCanceled&&w(E,Y,W)}),R=sH({open:A,onOpenChange:O,disabled:k}),T=x.useMemo(()=>({open:R.open,disabled:R.disabled,transitionStatus:R.transitionStatus}),[R.open,R.disabled,R.transitionStatus]),M=x.useMemo(()=>({...R,onOpenChange:O,state:T}),[R,T,O]),D=x.useMemo(()=>({...C,hidden:!A&&!R.mounted,index:p,disabled:k,open:A}),[R.mounted,k,p,A,C]),_=vs(),[H,G]=x.useState(),B=H===null?void 0:H??_,P=x.useMemo(()=>({defaultTriggerId:_,open:A,state:D,setTriggerId:G,triggerId:B}),[_,A,D,G,B]),V=Nt("div",t,{state:D,ref:b,props:h,stateAttributesMapping:Kw});return n.jsx(wM.Provider,{value:M,children:n.jsx(SM.Provider,{value:P,children:V})})}),hH=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,{state:f}=Yw();return Nt("h3",t,{state:f,ref:r,props:u,stateAttributesMapping:Kw})}),pH=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:y}=jM(),w=a||y,{getButtonProps:C,buttonRef:S}=bo({disabled:w,focusableWhenDisabled:!0,native:f}),{defaultTriggerId:N,state:E,setTriggerId:k}=Yw(),A=c||void 0,O=A??N;return We(()=>(k(M=>A??(M===null?void 0:M)),()=>{k(M=>M===A?null:M)}),[A,k]),Nt("button",t,{state:E,ref:[r,S],props:[{"aria-controls":p?g:void 0,"aria-expanded":p,id:O,onClick:b},h,C],stateAttributesMapping:uH})}),Ud={height:void 0,width:void 0};function gH(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),[y,w]=x.useState(Ud),C=x.useRef(Ud),S=x.useRef(!1),N=x.useRef(f),E=x.useRef(!1),[k,A]=x.useState(!1),O=x.useRef(null),R=ho(t,p),T=qn(f),M=Gf(p),D=!f&&!c,_=k?"idle":g,H=f&&(N.current||E.current),G=!f&&c&&b.current==="css-animation"&&y.height===void 0&&y.width===void 0?C.current:y,B=r&&D&&b.current!=="css-animation",P=st((ee,z=!0)=>{z&&(C.current=ee),w(ee)}),V=st(()=>{var ee;(ee=O.current)==null||ee.call(O),O.current=null}),Y=st(ee=>{V(),O.current=()=>{O.current=null,ee()}}),W=st(()=>{f&&c&&b.current==="css-animation"&&(E.current=!0)});We(()=>{!k||g==="starting"||A(!1)},[k,g]),x.useEffect(()=>()=>{W(),V()},[W,V]),We(()=>{const ee=p.current;if(!ee)return;!f&&O.current&&V();const z=xH(ee,H);if(b.current=z,f&&g==="idle"&&N.current&&z==="css-animation"){C.current=ou(ee);return}if(f&&g==="starting"){const te=S.current;if(S.current=!1,z==="none"){P(ou(ee)),A(!0);return}if(z==="css-transition"){const F=bH(ee);if(P(ou(ee)),!te)return F;const K=Yh(ee,"transition-duration","0s");return Y(K),A(!0),F}P(ou(ee));const $=Yh(ee,"animation-name","none");if(!te){$();return}const U=Yh(ee,"animation-duration","0s");$(),Y(U),A(!0);return}if(!f&&c&&(g==="idle"||g==="starting")){if(N.current=!1,E.current=!1,z==="none"){P(Ud,!1),m(!1);return}P(ou(ee));return}if(g!=="ending")return;if(z==="none"){m(!1);return}const L=ou(ee);if(!(L.height>0||L.width>0)){m(!1);return}P(L),z==="css-animation"&&Yh(ee,"animation-name","none")()},[c,f,V,P,m,Y,H,g]),Sr({enabled:f&&c&&_==="idle",open:!0,ref:p,onComplete(){f&&P(Ud,!1)}}),x.useEffect(()=>{if(f||!c||_!=="ending"||!p.current)return;const z=new AbortController;let L=-1;function X(){T.current||(m(!1),P(Ud,!1))}return L=wr.request(()=>{M(X,z.signal)}),()=>{wr.cancel(L),z.abort()}},[T,c,f,_,M,P,m]),We(()=>{const ee=p.current;!ee||!r||!D||ee.setAttribute("hidden","until-found")},[D,r]),x.useEffect(function(){const z=p.current;if(!z)return;function L(X){const te=vt(Ur,X);u(!0,te),!te.isCanceled&&(S.current=!0,h(!0))}return $t(z,"beforematch",L)},[u,h]);const q=i||r||c||f;return{height:G.height,props:{...B?{[aH]:""}:void 0,hidden:D,id:a},ref:R,shouldPreventOpenAnimation:H,shouldRender:q,transitionStatus:_,width:G.width}}function ou(e){return{height:e.scrollHeight,width:e.scrollWidth}}function xH(e,t){const r=En(e).getComputedStyle(e),a=(r.animationName.split(",").map(c=>c.trim()).some(c=>c!==""&&c!=="none")||t)&&zT(r.animationDuration),i=zT(r.transitionDuration);return a&&i||i?"css-transition":a?"css-animation":"none"}function zT(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function Yh(e,t,r){const a=e.style.getPropertyValue(t),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 bH(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 yH="--accordion-panel-height",vH="--accordion-panel-width",wH=x.forwardRef(function(t,r){const{className:a,hiddenUntilFound:i,keepMounted:c,id:u,render:f,style:m,...h}=t,{hiddenUntilFound:g,keepMounted:p}=vM(),{defaultPanelId:b,mounted:y,onOpenChange:w,open:C,setMounted:S,setOpen:N,setPanelIdState:E,transitionStatus:k}=jM(),A=i??g,O=c??p,R=u||void 0,T=u??b;We(()=>(E(z=>R??(z===null?void 0:z)),()=>{E(z=>z===R?null:z)}),[R,E]);const{height:M,props:D,ref:_,shouldPreventOpenAnimation:H,shouldRender:G,transitionStatus:B,width:P}=gH({externalRef:r,hiddenUntilFound:A,id:T,keepMounted:O,mounted:y,onOpenChange:w,open:C,setMounted:S,setOpen:N,transitionStatus:k}),{state:V,triggerId:Y}=Yw(),W={...V,transitionStatus:B},q=rO(m,W),ee=Nt("div",{...t,style:void 0},{state:W,ref:_,props:[D,{"aria-labelledby":Y,role:"region",style:{[yH]:M===void 0?"auto":`${M}px`,[vH]:P===void 0?"auto":`${P}px`}},h,q?{style:q}:void 0,H?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Kw});return G?ee:null});function jH({className:e,...t}){return n.jsx(nH,{"data-slot":"accordion",className:Ve("flex w-full flex-col",e),...t})}function SH({className:e,...t}){return n.jsx(mH,{"data-slot":"accordion-item",className:Ve("not-last:border-b",e),...t})}function NH({className:e,children:t,...r}){return n.jsx(hH,{className:"flex",children:n.jsxs(pH,{"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(ma,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),n.jsx(TO,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function CH({className:e,children:t,...r}){return n.jsx(wH,{"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 Xw=x.createContext({});function rm(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const kH=typeof window<"u",Ru=kH?x.useLayoutEffect:x.useEffect,wx=x.createContext(null);function Ww(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={},Qw=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),NM=e=>typeof e=="object"&&e!==null,Zw=e=>/^0[^.\s]+$/u.test(e);function CM(e){let t;return()=>(t===void 0&&(t=e()),t)}const _o=e=>e,om=(...e)=>e.reduce((t,r)=>a=>r(t(a))),jf=(e,t,r)=>{const a=t-e;return a?(r-e)/a:1};class ag{constructor(){this.subscriptions=[]}add(t){return Ww(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,kM=(e,t)=>t?e*(1e3/t):0,TM=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,TH=1e-7,EH=12;function RH(e,t,r,a,i){let c,u,f=0;do u=t+(r-t)/2,c=TM(u,a,i)-e,c>0?r=u:t=u;while(Math.abs(c)>TH&&++f<EH);return u}function am(e,t,r,a){if(e===t&&r===a)return _o;const i=c=>RH(c,0,1,e,r);return c=>c===0||c===1?c:TM(i(c),t,a)}const EM=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,RM=e=>t=>1-e(1-t),AM=am(.33,1.53,.69,.99),Jw=RM(AM),OM=EM(Jw),MM=e=>e>=1?1:(e*=2)<1?.5*Jw(e):.5*(2-Math.pow(2,-10*(e-1))),ej=e=>1-Math.sin(Math.acos(e)),DM=RM(ej),zM=EM(ej),AH=am(.42,0,1,1),OH=am(0,0,.58,1),tj=am(.42,0,.58,1),MH=e=>Array.isArray(e)&&typeof e[0]!="number",IM=e=>Array.isArray(e)&&typeof e[0]=="number",DH={linear:_o,easeIn:AH,easeInOut:tj,easeOut:OH,circIn:ej,circInOut:zM,circOut:DM,backIn:Jw,backInOut:OM,backOut:AM,anticipate:MM},zH=e=>typeof e=="string",IT=e=>{if(IM(e)){jx(e.length===4);const[t,r,a,i]=e;return am(t,r,a,i)}else if(zH(e))return DH[e];return e},Kh=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function IH(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 y=p&&a?t:r;return g&&c.add(h),y.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 PH=40;function PM(e,t){let r=!1,a=!0;const i={delta:0,timestamp:0,isProcessing:!1},c=()=>r=!0,u=Kh.reduce((k,A)=>(k[A]=IH(c),k),{}),{setup:f,read:m,resolveKeyframes:h,preUpdate:g,update:p,preRender:b,render:y,postRender:w}=u,C=()=>{const k=Wa.useManualTiming,A=k?i.timestamp:performance.now();r=!1,k||(i.delta=a?1e3/60:Math.max(Math.min(A-i.timestamp,PH),1)),i.timestamp=A,i.isProcessing=!0,f.process(i),m.process(i),h.process(i),g.process(i),p.process(i),b.process(i),y.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:Kh.reduce((k,A)=>{const O=u[A];return k[A]=(R,T=!1,M=!1)=>(r||S(),O.schedule(R,T,M)),k},{}),cancel:k=>{for(let A=0;A<Kh.length;A++)u[Kh[A]].cancel(k)},state:i,steps:u}}const{schedule:jn,cancel:pa,state:Es,steps:Dy}=PM(typeof requestAnimationFrame<"u"?requestAnimationFrame:_o,!0);let kp;function _H(){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(_H)}},vu=e=>Math.round(e*1e5)/1e5,_M=e=>t=>typeof t=="string"&&t.startsWith(e),LM=_M("--"),LH=_M("var(--"),nj=e=>LH(e)?$H.test(e.split("/*")[0].trim()):!1,$H=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function PT(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Lu={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Sf={...Lu,transform:e=>Bo(0,1,e)},Xh={...Lu,default:1},sj=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function BH(e){return e==null}const VH=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,rj=(e,t)=>r=>!!(typeof r=="string"&&VH.test(r)&&r.startsWith(e)||t&&!BH(r)&&Object.prototype.hasOwnProperty.call(r,t)),$M=(e,t,r)=>a=>{if(typeof a!="string")return a;const[i,c,u,f]=a.match(sj);return{[e]:parseFloat(i),[t]:parseFloat(c),[r]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},UH=e=>Bo(0,255,e),zy={...Lu,transform:e=>Math.round(UH(e))},Xl={test:rj("rgb","red"),parse:$M("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:a=1})=>"rgba("+zy.transform(e)+", "+zy.transform(t)+", "+zy.transform(r)+", "+vu(Sf.transform(a))+")"};function HH(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 Xv={test:rj("#"),parse:HH,transform:Xl.transform},im=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),La=im("deg"),aa=im("%"),pt=im("px"),FH=im("vh"),GH=im("vw"),_T={...aa,parse:e=>aa.parse(e)/100,transform:e=>aa.transform(e*100)},uu={test:rj("hsl","hue"),parse:$M("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:a=1})=>"hsla("+Math.round(e)+", "+aa.transform(vu(t))+", "+aa.transform(vu(r))+", "+vu(Sf.transform(a))+")"},gs={test:e=>Xl.test(e)||Xv.test(e)||uu.test(e),parse:e=>Xl.test(e)?Xl.parse(e):uu.test(e)?uu.parse(e):Xv.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)}},qH=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,BM=new RegExp(sj.source),VM=new RegExp(qH.source,"i");function YH(e){return isNaN(e)&&typeof e=="string"&&(BM.test(e)||VM.test(e))}const UM="number",HM="color",KH="var",XH="var(",LT="${}",WH=/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 QH(e){const t=e.toString();return BM.test(t)||VM.test(t)}function Nf(e){const t=e.toString(),r=[],a={color:[],number:[],var:[]},i=[];let c=0;const f=t.replace(WH,m=>(gs.test(m)?(a.color.push(c),i.push(HM),r.push(gs.parse(m))):m.startsWith(XH)?(a.var.push(c),i.push(KH),r.push(m)):(a.number.push(c),i.push(UM),r.push(parseFloat(m))),++c,LT)).split(LT);return{values:r,split:f,indexes:a,types:i}}function ZH(e){return Nf(e).values}function FM({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===UM?i+=vu(a[c]):u===HM?i+=gs.transform(a[c]):i+=a[c]}return i}}function JH(e){return FM(Nf(e))}const e9=e=>typeof e=="number"?0:gs.test(e)?gs.getAnimatableNone(e):e,t9=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:e9(e);function n9(e){const t=Nf(e);return FM(t)(t.values.map((a,i)=>t9(a,t.split[i])))}const $r={test:YH,parse:ZH,createTransformer:JH,getAnimatableNone:n9};function Iy(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 s9({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=Iy(m,f,e+1/3),c=Iy(m,f,e),u=Iy(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 kn=(e,t,r)=>e+(t-e)*r,Py=(e,t,r)=>{const a=e*e,i=r*(t*t-a)+a;return i<0?0:Math.sqrt(i)},r9=[Xv,Xl,uu],o9=e=>r9.find(t=>t.test(e));function $T(e){const t=o9(e);if(!t)return!1;let r=t.parse(e);return t===uu&&(r=s9(r)),r}const BT=(e,t)=>{const r=$T(e),a=$T(t);if(!r||!a)return ig(e,t);const i={...r};return c=>(i.red=Py(r.red,a.red,c),i.green=Py(r.green,a.green,c),i.blue=Py(r.blue,a.blue,c),i.alpha=kn(r.alpha,a.alpha,c),Xl.transform(i))},Wv=new Set(["none","hidden"]);function a9(e,t){return Wv.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function i9(e,t){return r=>kn(e,t,r)}function oj(e){return typeof e=="number"?i9:typeof e=="string"?nj(e)?ig:gs.test(e)?BT:u9:Array.isArray(e)?GM:typeof e=="object"?gs.test(e)?BT:l9:ig}function GM(e,t){const r=[...e],a=r.length,i=e.map((c,u)=>oj(c)(c,t[u]));return c=>{for(let u=0;u<a;u++)r[u]=i[u](c);return r}}function l9(e,t){const r={...e,...t},a={};for(const i in r)e[i]!==void 0&&t[i]!==void 0&&(a[i]=oj(e[i])(e[i],t[i]));return i=>{for(const c in a)r[c]=a[c](i);return r}}function c9(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 u9=(e,t)=>{const r=$r.createTransformer(t),a=Nf(e),i=Nf(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?Wv.has(e)&&!i.values.length||Wv.has(t)&&!a.values.length?a9(e,t):om(GM(c9(a,i),i.values),r):ig(e,t)},VT=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function d9(e,t){const r=VT.exec(e);if(!r)return;const a=VT.exec(t);if(!a||r[2]!==a[2])return;const i=r[2],c=parseFloat(r[1]),u=parseFloat(a[1]);return f=>vu(kn(c,u,f))+i}function aj(e,t,r){if(typeof e=="number"&&typeof t=="number"&&typeof r=="number")return kn(e,t,r);if(typeof e=="string"&&typeof t=="string"){const i=d9(e,t);if(i)return i}return oj(e)(e,t)}const f9=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()}},qM=(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)})`},ij=2e4;function lj(e,t=50,r=ij,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 m9(e,t=100,r){const a=r({...e,keyframes:[0,t]}),i=Math.min(lj(a),ij);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 Qv(e,t){return e*Math.sqrt(1-t*t)}const h9=12;function p9(e,t,r){let a=r;for(let i=1;i<h9;i++)a=a-e(a)/t(a);return a}const _y=.001;function g9({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,y=Qv(h,u),w=Math.exp(-p);return _y-b/y*w},c=h=>{const p=h*u*e,b=p*r+r,y=u*u*h*h*e,w=Math.exp(-p),C=Qv(h*h,u);return(-i(h)+_y>0?-1:1)*((b-y)*w)/C}):(i=h=>{const g=Math.exp(-h*e),p=(h-r)*e+1;return-_y+g*p},c=h=>{const g=Math.exp(-h*e),p=(r-h)*(e*e);return g*p});const f=5/e,m=p9(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 x9=["duration","bounce"];function b9(e,t){return t.some(r=>e[r]!==void 0)}const Zv=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Ly(e,t){if(Zv(e,t))return e}function y9(e){const t=Ly(e.stiffness),r=Ly(e.damping,!0),a=Ly(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&&b9(e,x9)};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=g9(i);i={...i,...c,mass:Gn.mass},i.isResolvedFromDuration=!0}(!Zv(i.stiffness)||!Zv(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}=y9({...r,velocity:-_r(r.velocity||0)}),y=f/(2*Math.sqrt(u*m)),w=_r(Math.sqrt(u/m)),C=y*w,S={target:i,delta:i-a,velocity:g||0,restSpeed:0,restDelta:0},N=()=>{const T=Math.abs(S.delta)<5;S.restSpeed=r.restSpeed||(T?Gn.restSpeed.granular:Gn.restSpeed.default),S.restDelta=r.restDelta||(T?Gn.restDelta.granular:Gn.restDelta.default)};N();let E,k,A;if(y<1){const T=Qv(w,y),M={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};A=()=>{M.A=(S.velocity+C*S.delta)/T,M.sinC=C*M.A+S.delta*T,M.cosC=C*S.delta-M.A*T};const D=_=>{_!==M.t&&(M.t=_,M.env=Math.exp(-C*_),M.sin=Math.sin(T*_),M.cos=Math.cos(T*_))};E=_=>(D(_),S.target-M.env*(M.A*M.sin+S.delta*M.cos)),k=_=>(D(_),M.env*(M.sinC*M.sin+M.cosC*M.cos))}else if(y===1){E=M=>S.target-Math.exp(-w*M)*(S.delta+(S.velocity+w*S.delta)*M);const T={C:0};A=()=>{T.C=S.velocity+w*S.delta},k=M=>Math.exp(-w*M)*(w*T.C*M-S.velocity)}else{const T=w*Math.sqrt(y*y-1);E=D=>{const _=Math.exp(-C*D),H=Math.min(T*D,300);return S.target-_*((S.velocity+C*S.delta)*Math.sinh(H)+T*S.delta*Math.cosh(H))/T};const M={P:0,sinh:0,cosh:0};A=()=>{M.P=(S.velocity+C*S.delta)/T,M.sinh=C*M.P-S.delta*T,M.cosh=C*S.delta-M.P*T},k=D=>{const _=Math.exp(-C*D),H=Math.min(T*D,300);return _*(M.sinh*Math.sinh(H)+M.cosh*Math.cosh(H))}}A();const O=p&&h||null,R={calculatedDuration:O,retarget:(T,M)=>{S.target=T[T.length-1],S.delta=S.target-T[0],S.velocity=b?0:-_r(M),r.restSpeed&&r.restDelta||N(),R.calculatedDuration=O,c.done=!1,A()},velocity:T=>fo(k(T)),next:T=>{const M=E(T);if(p)c.done=T>=h;else{const D=fo(k(T));c.done=Math.abs(D)<=S.restSpeed&&Math.abs(S.target-M)<=S.restDelta}return c.value=c.done?S.target:M,c},toString:()=>{const T=Math.min(lj(R),ij),M=qM(D=>R.next(T*D).value,T,30);return T+"ms "+M},toTransition:()=>{}};return R}lg.applyToOptions=e=>{const t=m9(e,100,lg);return e.ease=t.ease,e.duration=fo(t.duration),e.type="keyframes",e};function Jv({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},y=T=>T<f||T>m,w=T=>f===void 0?m:m===void 0||Math.abs(f-T)<Math.abs(m-T)?f:m;let C=r*t;const S=p+C,N=u===void 0?S:u(S);N!==S&&(C=N-p);const E=T=>-C*Math.exp(-T/a),k=T=>{const M=E(T);b.done=Math.abs(M)<=h,b.value=b.done?N:N+M};let A,O;const R=T=>{y(b.value)&&(A=T,O=lg({keyframes:[b.value,w(b.value)],velocity:-E(T)/a*1e3,damping:i,stiffness:c,restDelta:h,restSpeed:g}))};return R(0),{calculatedDuration:null,next:T=>{let M=!1;return!O&&A===void 0&&(M=!0,k(T),R(T)),A!==void 0&&T>=A?O.next(T-A):(!M&&k(T),b)}}}function v9(e,t,r){const a=[],i=r||Wa.mix||aj,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=om(m,f)}a.push(f)}return a}function YM(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=v9(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=jf(e[p],e[p+1],g);return f[p](b)};return r?g=>h(Bo(e[0],e[c-1],g)):h}function w9(e,t){const r=e[e.length-1];for(let a=1;a<=t;a++){const i=jf(0,t,a);e.push(kn(r,1,i))}}function j9(e){const t=[0];return w9(t,e.length-1),t}function S9(e,t){return e.map(r=>r*t)}function N9(e,t){return e.map(()=>t||tj).splice(0,e.length-1)}function wu({duration:e=300,keyframes:t,times:r,ease:a="easeInOut"}){const i=MH(a)?a.map(IT):IT(a)||tj,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||aj)(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=S9(r&&r.length===t.length?r:j9(t),e),f=YM(u,t,{ease:Array.isArray(i)?i:N9(t,i)});return{calculatedDuration:e,next:m=>(c.value=f(m),c.done=m>=e,c)}}const C9=5;function k9(e,t,r){const a=Math.max(t-C9,0);return kM(r-e(a),t-a)}function KM(e,t,r=0){return t<=0?r:e.velocity?e.velocity(t):k9(a=>e.next(a).value,t,e.next(t).value)}const T9=e=>e!==null;function Sx(e,{repeat:t,repeatType:r="loop"},a,i=1){const c=e.filter(T9),f=i<0||t&&r!=="loop"&&t%2===1?0:c.length-1;return!f||a===void 0?c[f]:a}const E9={decay:Jv,inertia:Jv,tween:wu,keyframes:wu,spring:lg};function cj(e){typeof e.type=="string"&&(e.type=E9[e.type])}function XM(e,t){return{kind:e,animation:t,timestamp:As.now(),frameTimestamp:Es.timestamp,frameIsProcessing:Es.isProcessing}}function WM(e,t,r){const a=globalThis.__MOTION_INSPECT__;if(a)try{a({...XM("animation-start",e),options:r?{...t,...r}:t})}catch{}}function R9(e,t){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...XM("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 A9=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(),WM(this,this.options)}initAnimation(){const{options:t}=this;cj(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=om(A9,aj(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=lj(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:y,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 k=this.currentTime,A=a;if(p){const M=Math.min(this.currentTime,i)/f;let D=Math.floor(M),_=M%1;!_&&M>=1&&(_=1),_===1&&D--,D=Math.min(D,p+1),!!(D%2)&&(b==="reverse"?(_=1-_,y&&(_-=y/f)):b==="mirror"&&(A=u)),k=Bo(0,1,_)*f}let O;E?(this.delayState.value=g[0],O=this.delayState):O=A.next(k),c&&!E&&(O.value=c(O.value));let{done:R}=O;!E&&m!==null&&(R=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&R);return T&&w!==Jv&&(O.value=Sx(g,this.options,S,this.speed)),C&&C(O.value),T&&this.finish(),O}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 KM(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=f9,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 O9=new Set(["brightness","contrast","saturate","opacity"]);function M9(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=r.match(sj)||[];if(!a)return e;const i=r.replace(a,"");let c=O9.has(t)?1:0;return a!==r&&(c*=100),t+"("+c+i+")"}const D9=/\b([a-z-]*)\(.*?\)/gu,e1={...$r,getAnimatableNone:e=>{const t=e.match(D9);return t?t.map(M9).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))}},UT={...Lu,transform:Math.round},z9={rotate:La,pathRotation:La,rotateX:La,rotateY:La,rotateZ:La,scale:Xh,scaleX:Xh,scaleY:Xh,scaleZ:Xh,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:Sf,originX:_T,originY:_T,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,...z9,zIndex:UT,fillOpacity:Sf,strokeOpacity:Sf,numOctaves:UT},I9={...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},QM=e=>I9[e],P9=new Set([e1,t1]);function uj(e,t){let r=QM(e);return P9.has(r)||(r=$r),r.getAnimatableNone?r.getAnimatableNone(t):void 0}function _9(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)},L9={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),HT=n1,FT=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),GT=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),$9={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:FT,scaleY:GT,scale:e=>(FT(e)+GT(e))/2,rotateX:e=>s1(Wl(Math.atan2(e[6],e[5]))),rotateY:e=>s1(Wl(Math.atan2(-e[2],e[0]))),rotateZ:HT,rotate:HT,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=$9,i=r;else{const f=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=L9,i=f}if(!i)return r1(t);const c=a[t],u=i[1].split(",").map(V9);return typeof c=="function"?c(u):u[c]}const B9=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return o1(r,t)};function V9(e){return parseFloat(e.trim())}const $u=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Bu=new Set([...$u,"pathRotation"]),qT=e=>e===Lu||e===pt,U9=new Set(["x","y","z"]),H9=$u.filter(e=>!U9.has(e));function F9(e){const t=[];return H9.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 G9=new Set(["bottom","right"]);function YT(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)=>YT(e,i,"x",t,r,a),height:({height:e,paddingTop:t="0",paddingBottom:r="0",boxSizing:a},i)=>YT(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 ZM(){if(i1){const e=[],t=new Set,r=new Set;ec.forEach(i=>{i.needsMeasurement&&(e.push(i),t.add(i.element),G9.has(i.name)&&r.add(i.element))});const a=new Map;r.forEach(i=>{const c=F9(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 JM(){ec.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(i1=!0)})}function q9(){l1=!0,JM(),ZM(),l1=!1}function Y9(e,t,r){if(typeof e=="string"){if(Qw(e)||Zw(e))return parseFloat(e);if(!$r.test(e)&&$r.test(r))return uj(t,r)}return e??void 0}class dj{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(JM),jn.resolveKeyframes(ZM))):(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=Y9(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])}_9(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 K9=e=>e.startsWith("--");function e3(e,t,r){K9(t)?e.style.setProperty(t,r):e.style[t]=r}const X9={};function t3(e,t){const r=CM(e);return()=>X9[t]??r()}const W9=t3(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),n3=t3(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Zd=([e,t,r,a])=>`cubic-bezier(${e}, ${t}, ${r}, ${a})`,KT={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Zd([0,.65,.55,1]),circOut:Zd([.55,0,1,.45]),backIn:Zd([.31,.01,.66,-.59]),backOut:Zd([.33,1.53,.69,.99])};function s3(e,t){if(e)return typeof e=="function"?n3()?qM(e,t):"ease-out":IM(e)?Zd(e):Array.isArray(e)?e.map(r=>s3(r,t)||KT.easeOut):KT[e]}function Q9(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=s3(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 r3(e){return typeof e=="function"&&"applyToOptions"in e}function Z9({type:e,...t}){return r3(e)&&n3()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class o3 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=Z9(t);this.animation=Q9(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),e3(r,a,g),this.animation.cancel()}m==null||m(),this.notifyFinished()},WM(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&&W9()?(this.animation.timeline=t,r&&(this.animation.rangeStart=r),a&&(this.animation.rangeEnd=a),_o):i(this)}}const a3={anticipate:MM,backInOut:OM,circInOut:zM};function J9(e){return e in a3}function eF(e){typeof e.ease=="string"&&J9(e.ease)&&(e.ease=a3[e.ease])}const $y=10;class tF extends o3{constructor(t){eF(t),cj(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($y,As.now()-this.startTime),h=Bo(0,$y,m-$y),g=f.sample(m).value,{name:p}=this.options;c&&p&&e3(c,p,g),r.setWithVelocity(f.sample(Math.max(0,m-h)).value,g,h),f.stop()}}const XT=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&($r.test(e)||e==="0")&&!e.startsWith("url("));function nF(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 sF(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=XT(i,t),f=XT(c,t);return!u||!f?!1:nF(e)||(r==="spring"||r3(r))&&a}function c1(e){e.duration=0,e.type="keyframes"}const u1=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),rF=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function oF(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&rF.test(e[t]))return!0;return!1}const WT=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),aF=CM(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function iF(e){var p;const{motionValue:t,name:r,repeatDelay:a,repeatType:i,damping:c,type:u,keyframes:f}=e;if(!r||!(u1.has(r)||WT.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 aF()&&(u1.has(r)||WT.has(r)&&oF(f))&&(r!=="transform"||!g)&&!h&&!a&&i!=="mirror"&&c!==0&&u!=="inertia"}const lF=40;class cF 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)||dj;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;sF(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>lF?this.resolvedAt:this.createdAt:this.createdAt:void 0,{onComplete:y}=a;a.startTime??(a.startTime=b),a.finalKeyframe=r,a.keyframes=t,a.onComplete=()=>{y==null||y(),this.notifyFinished()};const w=p&&!h&&iF(a);let C;if(w){a.element=(N=(S=a.motionValue)==null?void 0:S.owner)==null?void 0:N.current;try{C=new tF(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(),q9()),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 i3(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 QT=30,uF=e=>!isNaN(parseFloat(e)),rf={current:void 0};class dF{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=uF(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 rf.current&&rf.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=As.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>QT)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,QT);return kM(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 dF(e,t)}function l3(e,t){if(e!=null&&e.inherit&&t){const{inherit:r,...a}=e;return{...t,...a}}return e}function fj(e,t){const r=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return r!==e?l3(r,e):r}const fF={type:"spring",stiffness:500,damping:25,restSpeed:10},mF=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),hF={type:"keyframes",duration:.8},pF={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},gF=(e,{keyframes:t})=>t.length>2?hF:Bu.has(e)?e.startsWith("scale")?mF(t[1]):fF:pF,xF=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function bF(e){for(const t in e)if(!xF.has(t))return!0;return!1}const mj=(e,t,r,a={},i,c)=>u=>{const f=fj(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};bF(f)||Object.assign(g,gF(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 cF(g)},yF=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function vF(e){const t=yF.exec(e);if(!t)return[,];const[,r,a,i]=t;return[`--${r??a}`,i]}function c3(e,t,r=1){const[a,i]=vF(e);if(!a)return;const c=window.getComputedStyle(t).getPropertyValue(a);if(c){const u=c.trim();return Qw(u)?parseFloat(u):u}return nj(i)?c3(i,t,r+1):i}function ZT(e){const t=[{},{}];return e==null||e.values.forEach((r,a)=>{t[0][a]=r.get(),t[1][a]=r.getVelocity()}),t}function hj(e,t,r,a){if(typeof t=="function"){const[i,c]=ZT(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]=ZT(a);t=t(r!==void 0?r:e.custom,i,c)}return t}function tc(e,t,r){const a=e.getProps();return hj(a,t,r!==void 0?r:a.custom,e)}const u3=new Set(["width","height","top","left","right","bottom",...$u]),d1=e=>Array.isArray(e);function wF(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,ic(r))}function jF(e){return d1(e)?e[e.length-1]||0:e}function SF(e,t){const r=tc(e,t);let{transitionEnd:a={},transition:i={},...c}=r||{};c={...c,...a};for(const u in c){const f=jF(c[u]);wF(e,u,f)}}const xs=e=>!!(e&&e.getVelocity);function NF(e){return!!(xs(e)&&e.add)}function f1(e,t){const r=e.getValue("willChange");if(NF(r))return r.add(t);if(!r&&Wa.WillChange){const a=new Wa.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function pj(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const CF="framerAppearId",d3="data-"+pj(CF);function f3(e){return e.props[d3]}const kF=typeof window<"u";function TF({protectedKeys:e,needsAnimating:t},r){const a=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,a}function m3(e,t,{delay:r=0,transitionOverride:a,type:i}={}){let{transition:c,transitionEnd:u,...f}=t;const m=e.getDefaultTransition();c=c?l3(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],y=c==null?void 0:c.path;y&&y.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&&TF(b,w))continue;const N={delay:r,...fj(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 k=!1;if(kF&&window.MotionHandoffAnimation){const R=f3(e);if(R){const T=window.MotionHandoffAnimation(R,w,jn);T!==null&&(N.startTime=T,k=!0)}}f1(e,w);const A=h??e.shouldReduceMotion;C.start(mj(w,C,S,A&&u3.has(w)?{type:!1}:N,e,k));const O=C.animation;O&&p.push(O)}if(u){const w=()=>jn.update(()=>{u&&SF(e,u)});p.length?Promise.all(p).then(w):w()}return p}function m1(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(m3(e,a,r)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(h=0)=>{const{delayChildren:g=0,staggerChildren:p,staggerDirection:b}=i;return EF(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 EF(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(m1(m,t,{...u,delay:r+(typeof a=="function"?0:a)+i3(e.variantChildren,m,a,i,c)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(f)}function RF(e,t,r={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const i=t.map(c=>m1(e,c,r));a=Promise.all(i)}else if(typeof t=="string")a=m1(e,t,r);else{const i=typeof t=="function"?tc(e,t,r.custom):t;a=Promise.all(m3(e,i,r))}return a.then(()=>{e.notify("AnimationComplete",t)})}const AF={test:e=>e==="auto",parse:e=>e},OF=e=>t=>t.test(e),MF=[Lu,pt,aa,La,GH,FH,AF],JT=e=>MF.find(OF(e));function DF(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Zw(e):!0}const zF=new Set(["auto","none","0"]);function IF(e,t,r){let a=0,i;for(;a<e.length&&!i;){const c=e[a];typeof c=="string"&&!zF.has(c)&&QH(c)&&(i=e[a]),a++}if(i&&r)for(const c of t)e[c]!==i&&(e[c]=uj(r,i))}class PF extends dj{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(),nj(p))){const b=c3(p,r.current);b!==void 0&&(t[g]=b),g===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!u3.has(a)||t.length!==2)return;const[i,c]=t;if(typeof i=="number"&&typeof c=="number")return;const u=JT(i),f=JT(c),m=PT(i),h=PT(c);if(m!==h&&Jl[a]){this.needsMeasurement=!0;return}if(u!==f)if(qT(u)&&qT(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||DF(t[i]))&&a.push(i);a.length&&IF(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 gj=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Tp(e){return NM(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function xj(e){return NM(e)&&"ownerSVGElement"in e}const h1=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function bj(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"},LF=$u.length;function $F(e,t,r){let a="",i=!0;for(let u=0;u<LF;u++){const f=$u[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=h1(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(${h1(c,ug.pathRotation)}) `),a=a.trim(),r?a=r(t,i?"":a):i&&(a="none"),a}function yj(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(Bu.has(m)){u=!0;continue}else if(LM(m)){i[m]=h;continue}else{const g=h1(h,ug[m]);m.startsWith("origin")?(f=!0,c[m]=g):a[m]=g}}if(t.transform||(u||r?a.transform=$F(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 BF={offset:"stroke-dashoffset",array:"stroke-dasharray"},VF={offset:"strokeDashoffset",array:"strokeDasharray"};function UF(e,t,r=1,a=0,i=!0){e.pathLength=1;const c=i?BF:VF;e[c.offset]=`${-a}`,e[c.array]=`${t} ${r}`}const h3=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function p3(e,{attrX:t,attrY:r,attrScale:a,pathLength:i,pathSpacing:c=1,pathOffset:u=0,...f},m,h,g){if(yj(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 y of h3)p[y]!==void 0&&(b[y]=p[y],delete p[y]);(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&&UF(p,i,c,u,!1)}function g3({top:e,left:t,right:r,bottom:a}){return{x:{min:t,max:r},y:{min:e,max:a}}}function HF({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function FF(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 By(e){return e===void 0||e===1}function p1({scale:e,scaleX:t,scaleY:r}){return!By(e)||!By(t)||!By(r)}function Fl(e){return p1(e)||x3(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function x3(e){return eE(e.x)||eE(e.y)}function eE(e){return e&&e!=="0%"}function dg(e,t,r){const a=e-r,i=t*a;return r+i}function tE(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=tE(e.min,t,r,a,i),e.max=tE(e.max,t,r,a,i)}function b3(e,{x:t,y:r}){g1(e.x,t.translate,t.scale,t.originPoint),g1(e.y,r.translate,r.scale,r.originPoint)}const nE=.999999999999,sE=1.0000000000001;function GF(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,b3(e,u)),a&&Fl(c.latestValues)&&Ep(e,c.latestValues,(f=c.layout)==null?void 0:f.layoutBox))}t.x<sE&&t.x>nE&&(t.x=1),t.y<sE&&t.y>nE&&(t.y=1)}function sa(e,t){e.min+=t,e.max+=t}function rE(e,t,r,a,i=.5){const c=kn(e.min,e.max,i);g1(e,t,r,c,a)}function oE(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Ep(e,t,r){const a=r??e;rE(e.x,oE(t.x,a.x),t.scaleX,t.scale,t.originX),rE(e.y,oE(t.y,a.y),t.scaleY,t.scale,t.originY)}function y3(e,t){return g3(FF(e.getBoundingClientRect(),t))}function qF(e,t,r){const a=y3(e,r),{scroll:i}=t;return i&&(sa(a.x,i.offset.x),sa(a.y,i.offset.y)),a}const{schedule:vj}=PM(queueMicrotask,!1),Oo={x:!1,y:!1};function v3(){return Oo.x||Oo.y}function YF(e){return e==="x"||e==="y"?Oo[e]?null:(Oo[e]=!0,()=>{Oo[e]=!1}):Oo.x||Oo.y?null:(Oo.x=Oo.y=!0,()=>{Oo.x=Oo.y=!1})}function w3(e,t){const r=bj(e),a=new AbortController,i={passive:!0,...t,signal:a.signal};return[r,i,()=>a.abort()]}function KF(e){return!(e.pointerType==="touch"||v3())}function XF(e,t,r={}){const[a,i,c]=w3(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))},y=()=>{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(!KF(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",y,i)}),c}const j3=(e,t)=>t?e===t?!0:j3(e,t.parentElement):!1,wj=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,WF=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function QF(e){return WF.has(e.tagName)||e.isContentEditable===!0}const ZF=new Set(["INPUT","SELECT","TEXTAREA"]);function JF(e){return ZF.has(e.tagName)||e.isContentEditable===!0}const Rp=new WeakSet;function aE(e){return t=>{t.key==="Enter"&&e(t)}}function Vy(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const eG=(e,t)=>{const r=e.currentTarget;if(!r)return;const a=aE(()=>{if(Rp.has(r))return;Vy(r,"down");const i=aE(()=>{Vy(r,"up")}),c=()=>Vy(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 iE(e){return wj(e)&&!v3()}const lE=new WeakSet;function tG(e,t,r={}){const[a,i,c]=w3(e,r),u=f=>{const m=f.currentTarget;if(!iE(f)||lE.has(f))return;Rp.add(m),r.stopPropagation&&lE.add(f);const h=t(m,f),g={...i,capture:!0},p=(w,C)=>{window.removeEventListener("pointerup",b,g),window.removeEventListener("pointercancel",y,g),Rp.has(m)&&Rp.delete(m),iE(w)&&typeof h=="function"&&h(w,{success:C})},b=w=>{p(w,m===window||m===document||r.useGlobalTarget||j3(m,w.target))},y=w=>{p(w,!1)};window.addEventListener("pointerup",b,g),window.addEventListener("pointercancel",y,g)};return a.forEach(f=>{(r.useGlobalTarget?window:f).addEventListener("pointerdown",u,i),Tp(f)&&(f.addEventListener("focus",h=>eG(h,i)),!QF(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),c}const Ap=new WeakMap;let _i;const S3=(e,t,r)=>(a,i)=>i&&i[0]?i[0][e+"Size"]:xj(a)&&"getBBox"in a?a.getBBox()[t]:a[r],nG=S3("inline","width","offsetWidth"),sG=S3("block","height","offsetHeight");function rG({target:e,borderBoxSize:t}){var r;(r=Ap.get(e))==null||r.forEach(a=>{a(e,{get width(){return nG(e,t)},get height(){return sG(e,t)}})})}function oG(e){e.forEach(rG)}function aG(){typeof ResizeObserver>"u"||(_i=new ResizeObserver(oG))}function iG(e,t){_i||aG();const r=bj(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 Op=new Set;let du;function lG(){du=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Op.forEach(t=>t(e))},window.addEventListener("resize",du)}function cG(e){return Op.add(e),du||lG(),()=>{Op.delete(e),!Op.size&&typeof du=="function"&&(window.removeEventListener("resize",du),du=void 0)}}function cE(e,t){return typeof e=="function"?cG(e):iG(e,t)}function uG(e){return xj(e)&&e.tagName==="svg"}function dG(...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=YM(i,c,u);return t?f(a):f}const Jd=new Set,uE=({timestamp:e})=>{Jd.forEach(t=>t.tick(e))};class fG 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,cj(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():(Jd.size||jn.update(uE,!0),Jd.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 KM(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():(Jd.delete(this),Jd.size||pa(uE))}}function mG(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=fE(g);if((i==null?void 0:i.state)==="running"){i.setTarget(b,r.velocity);return}const y=fE(e.get()),w=i?i.getGeneratorVelocity():e.getVelocity();if(h(),y===b)return;const C={keyframes:[y,b],velocity:w,type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:f},S=i=new fG({...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",y=>{g?(g=!1,e.jump(dE(y,u),!1)):e.set(dE(y,u))}),b=e.on("destroy",p);return()=>{p(),b()}}return h}function dE(e,t){return t?e+t:e}function fE(e){return typeof e=="number"?e:parseFloat(e)}const mE=()=>({translate:0,scale:1,origin:0,originPoint:0}),fu=()=>({x:mE(),y:mE()}),hE=()=>({min:0,max:0}),ps=()=>({x:hE(),y:hE()}),hG=new WeakMap;function Cx(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Cf(e){return typeof e=="string"||Array.isArray(e)}const jj=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fg=["initial",...jj];function kx(e){if(Cx(e.animate))return!0;for(let t=0;t<fg.length;t++)if(Cf(e[fg[t]]))return!0;return!1}function N3(e){return!!(kx(e)||e.variants)}function pG(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 mg={current:null},Sj={current:!1},gG=typeof window<"u";function C3(){if(Sj.current=!0,!!gG)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>mg.current=e.matches;e.addEventListener("change",t),t()}else mg.current=!1}const pE=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let hg={};function k3(e){hg=e}function xG(){return hg}class bG{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=dj,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 y=As.now();this.renderScheduledAt<y&&(this.renderScheduledAt=y,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=N3(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...b}=this.scrapeMotionValuesFromProps(r,{},this);for(const y in b){const w=b[y];h[y]!==void 0&&xs(w)&&w.set(h[y])}}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,hG.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:(Sj.current||C3(),this.shouldReduceMotion=mg.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 o3({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=Bu.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 hg){const r=hg[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<pE.length;a++){const i=pE[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=pG(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"&&(Qw(a)||Zw(a))?a=parseFloat(a):typeof a!="number"&&!$r.test(a)&&$r.test(r)&&(a=uj(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=hj(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(){vj.render(this.render)}}class T3 extends bG{constructor(){super(...arguments),this.KeyframeResolver=PF}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 E3(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 gE(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Hd={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(pt.test(e))e=parseFloat(e);else return e;const r=gE(e,t.target.x),a=gE(e,t.target.y);return`${r}% ${a}%`}},yG={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=kn(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:{...Hd,applyTo:[...gj]},borderTopLeftRadius:Hd,borderTopRightRadius:Hd,borderBottomLeftRadius:Hd,borderBottomRightRadius:Hd,boxShadow:yG};function R3(e,{layout:t,layoutId:r}){return Bu.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!x1[e]||e==="opacity")}function Nj(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])||R3(f,e)||((u=r==null?void 0:r.getValue(f))==null?void 0:u.liveStyle)!==void 0)&&(c[f]=a[f]);return c}function vG(e){return window.getComputedStyle(e)}class wG extends T3{constructor(){super(...arguments),this.type="html",this.renderInstance=E3}mount(t){jx(!!t.style),super.mount(t)}readValueFromInstance(t,r){var a;if(Bu.has(r))return(a=this.projection)!=null&&a.isProjecting?r1(r):B9(t,r);{const i=vG(t),c=(LM(r)?i.getPropertyValue(r):i[r])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(t,{transformPagePoint:r}){return y3(t,r)}build(t,r,a){yj(t,r,a.transformTemplate)}scrapeMotionValuesFromProps(t,r,a){return Nj(t,r,a)}}const A3=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"]),O3=e=>typeof e=="string"&&e.toLowerCase()==="svg";function jG(e,t,r,a){E3(e,t,void 0,a);for(const i in t.attrs)e.setAttribute(A3.has(i)?i:pj(i),t.attrs[i])}function M3(e,t,r){const a=Nj(e,t,r);for(const i in e)if(xs(e[i])||xs(t[i])){const c=$u.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;a[c]=e[i]}return a}class SG extends T3{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ps}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Bu.has(r)){const a=QM(r);return a&&a.default||0}if(h3.includes(r)){const i=getComputedStyle(t)[r];if(typeof i=="string"&&i)return i.trim()}return r=A3.has(r)?r:pj(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,a){return M3(t,r,a)}build(t,r,a){p3(t,r,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,r,a,i){jG(t,r,a,i)}mount(t){this.isSVGTag=O3(t.tagName),super.mount(t)}}const NG=fg.length;function D3(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?D3(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<NG;r++){const a=fg[r],i=e.props[a];(Cf(i)||i===!1)&&(t[a]=i)}return t}function z3(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 CG=[...jj].reverse(),kG=jj.length;function TG(e){return t=>Promise.all(t.map(({animation:r,options:a})=>RF(e,r,a)))}function EG(e){let t=TG(e),r=xE(),a=!0,i=!1;const c=h=>(g,p)=>{var y;const b=tc(e,p,h==="exit"?(y=e.presenceContext)==null?void 0:y.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=D3(e.parent)||{},b=[],y=new Set;let w={},C=1/0;for(let N=0;N<kG;N++){const E=CG[N],k=r[E],A=g[E]!==void 0?g[E]:p[E],O=Cf(A),R=E===h?k.isActive:null;R===!1&&(C=N);let T=A===p[E]&&A!==g[E]&&O;if(T&&(a||i)&&e.manuallyAnimateOnMount&&(T=!1),k.protectedKeys={...w},!k.isActive&&R===null||!A&&!k.prevProp||Cx(A)||typeof A=="boolean")continue;if(E==="exit"&&k.isActive&&R!==!0){k.prevResolvedValues&&(w={...w,...k.prevResolvedValues});continue}const M=RG(k.prevProp,A);let D=M||E===h&&k.isActive&&!T&&O||N>C&&O,_=!1;const H=Array.isArray(A)?A:[A];let G=H.reduce(c(E),{});R===!1&&(G={});const{prevResolvedValues:B={}}=k,P={...B,...G},V=q=>{D=!0,y.has(q)&&(_=!0,y.delete(q)),k.needsAnimating[q]=!0;const ee=e.getValue(q);ee&&(ee.liveStyle=!1)};for(const q in P){const ee=G[q],z=B[q];if(w.hasOwnProperty(q))continue;let L=!1;d1(ee)&&d1(z)?L=!z3(ee,z)||M:L=ee!==z,L?ee!=null?V(q):y.add(q):ee!==void 0&&y.has(q)?V(q):k.protectedKeys[q]=!0}k.prevProp=A,k.prevResolvedValues=G,k.isActive&&(w={...w,...G}),(a||i)&&e.blockInitialAnimation&&(D=!1);const Y=T&&M;D&&(!Y||_)&&b.push(...H.map(q=>{const ee={type:E};if(typeof q=="string"&&(a||i)&&!Y&&e.manuallyAnimateOnMount&&e.parent){const{parent:z}=e,L=tc(z,q);if(z.enteringChildren&&L){const{delayChildren:X}=L.transition||{};ee.delay=i3(z.enteringChildren,e,X)}}return{animation:q,options:ee}}))}if(y.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)}y.forEach(E=>{const k=e.getBaseTarget(E),A=e.getValue(E);A&&(A.liveStyle=!0),N[E]=k??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(y=>{var w;return(w=y.animationState)==null?void 0:w.setActive(h,g)}),r[h].isActive=g;const p=f(h);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:f,setActive:m,setAnimateFunction:u,getState:()=>r,reset:()=>{r=xE(),i=!0}}}function RG(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!z3(t,e):!1}function Bl(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xE(){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 bE(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const I3=1e-4,AG=1-I3,OG=1+I3,P3=.01,MG=0-P3,DG=0+P3;function ar(e){return e.max-e.min}function zG(e,t,r){return Math.abs(e-t)<=r}function yE(e,t,r,a=.5){e.origin=a,e.originPoint=kn(t.min,t.max,e.origin),e.scale=ar(r)/ar(t),e.translate=kn(r.min,r.max,e.origin)-e.originPoint,(e.scale>=AG&&e.scale<=OG||isNaN(e.scale))&&(e.scale=1),(e.translate>=MG&&e.translate<=DG||isNaN(e.translate))&&(e.translate=0)}function of(e,t,r,a){yE(e.x,t.x,r.x,a?a.originX:void 0),yE(e.y,t.y,r.y,a?a.originY:void 0)}function vE(e,t,r,a=0){const i=a?kn(r.min,r.max,a):r.min;e.min=i+t.min,e.max=e.min+ar(t)}function IG(e,t,r,a){vE(e.x,t.x,r.x,a==null?void 0:a.x),vE(e.y,t.y,r.y,a==null?void 0:a.y)}function wE(e,t,r,a=0){const i=a?kn(r.min,r.max,a):r.min;e.min=t.min-i,e.max=e.min+ar(t)}function pg(e,t,r,a){wE(e.x,t.x,r.x,a==null?void 0:a.x),wE(e.y,t.y,r.y,a==null?void 0:a.y)}function jE(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 PG(e,t=0,r=1,a=.5,i,c=e,u=e){if(aa.test(t)&&(t=parseFloat(t),t=kn(u.min,u.max,t/100)-u.min),typeof t!="number")return;let f=kn(c.min,c.max,a);e===c&&(f-=t),e.min=jE(e.min,t,r,f,i),e.max=jE(e.max,t,r,f,i)}function SE(e,t,[r,a,i],c,u){PG(e,t[r],t[a],t[i],t.scale,c,u)}const _G=["x","scaleX","originX"],LG=["y","scaleY","originY"];function NE(e,t,r,a){SE(e.x,t,_G,r?r.x:void 0,a?a.x:void 0),SE(e.y,t,LG,r?r.y:void 0,a?a.y:void 0)}function CE(e){return e.translate===0&&e.scale===1}function _3(e){return CE(e.x)&&CE(e.y)}function kE(e,t){return e.min===t.min&&e.max===t.max}function $G(e,t){return kE(e.x,t.x)&&kE(e.y,t.y)}function TE(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function L3(e,t){return TE(e.x,t.x)&&TE(e.y,t.y)}function EE(e){return ar(e.x)/ar(e.y)}function RE(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function ea(e){return[e("x"),e("y")]}function BG(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:y,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) `),y&&(a+=`rotateY(${y}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 VG=gj.length,AE=e=>typeof e=="string"?parseFloat(e):e,OE=e=>typeof e=="number"||pt.test(e);function UG(e,t,r,a,i,c){i?(e.opacity=kn(0,r.opacity??1,HG(a)),e.opacityExit=kn(t.opacity??1,0,FG(a))):c&&(e.opacity=kn(t.opacity??1,r.opacity??1,a));for(let u=0;u<VG;u++){const f=gj[u];let m=ME(t,f),h=ME(r,f);if(m===void 0&&h===void 0)continue;m||(m=0),h||(h=0),m===0||h===0||OE(m)===OE(h)?(e[f]=Math.max(kn(AE(m),AE(h),a),0),(aa.test(h)||aa.test(m))&&(e[f]+="%")):e[f]=h}(t.rotate||r.rotate)&&(e.rotate=kn(t.rotate||0,r.rotate||0,a))}function ME(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const HG=$3(0,.5,DM),FG=$3(.5,.95,_o);function $3(e,t,r){return a=>a<e?0:a>t?1:r(jf(e,t,a))}function GG(e,t,r){const a=xs(e)?e:ic(e);return a.start(mj("",a,t,r)),a.animation}function kf(e,t,r,a={passive:!0}){return e.addEventListener(t,r,a),()=>e.removeEventListener(t,r,a)}const qG=(e,t)=>e.depth-t.depth;class YG{constructor(){this.children=[],this.isDirty=!1}add(t){Ww(this.children,t),this.isDirty=!0}remove(t){og(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(qG),this.isDirty=!1,this.children.forEach(t)}}function KG(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 Mp(e){return xs(e)?e.get():e}class XG{constructor(){this.members=[]}add(t){Ww(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},Uy=["","X","Y","Z"],WG=1e3;let QG=0;function Hy(e,t,r,a){const{latestValues:i}=t;i[e]&&(r[e]=i[e],t.setStaticValue(e,0),a&&(a[e]=0))}function B3(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=f3(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&&B3(a)}function V3({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:a,resetTransform:i}){return class{constructor(u={},f=t==null?void 0:t()){this.id=QG++,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(eq),this.nodes.forEach(aq),this.nodes.forEach(iq),this.nodes.forEach(tq)},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 YG)}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=xj(u)&&!uG(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 y=window.innerWidth;y!==p&&(p=y,this.root.updateBlockedByResize=!0,g&&g(),g=KG(b,250),Dp.hasAnimatedSinceResize&&(Dp.hasAnimatedSinceResize=!1,this.nodes.forEach(IE)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&h&&(f||m)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:p,hasRelativeLayoutChanged:b,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||h.getDefaultTransition()||fq,{onLayoutAnimationStart:C,onLayoutAnimationComplete:S}=h.getProps(),N=!this.targetLayout||!L3(this.targetLayout,y),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 k={...fj(w,"layout"),onPlay:C,onComplete:S};(h.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(g,E,k.path)}else p||IE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}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(lq),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&&B3(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(sq),this.nodes.forEach(DE);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(zE);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(rq),this.nodes.forEach(oq),this.nodes.forEach(ZG),this.nodes.forEach(JG)):this.nodes.forEach(zE),this.clearAllSnapshots();const f=As.now();Es.delta=Bo(0,1e3/60,f-Es.timestamp),Es.timestamp=f,Es.isProcessing=!0,Dy.update.process(Es),Dy.preRender.process(Es),Dy.render.process(Es),Es.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,vj.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(nq),this.sharedNodes.forEach(cq)}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&&!_3(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)),mq(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(hq))){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 y=this.path[b];!f&&y.options.layoutScroll&&y.scroll&&y!==y.root&&(sa(h.x,-y.scroll.offset.x),sa(h.y,-y.scroll.offset.y)),Fl(y.latestValues)&&Ep(h,y.latestValues,(g=y.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())),NE(f,g.latestValues,(m=g.snapshot)==null?void 0:m.layoutBox,p)}return Fl(this.latestValues)&&NE(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 y;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||(y=this.parent)!=null&&y.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(),IG(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),b3(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)||x3(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;GF(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:y}=u;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(bE(this.prevProjectionDelta.x,this.projectionDelta.x),bE(this.prevProjectionDelta.y,this.projectionDelta.y)),of(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==b||!RE(this.projectionDelta.x,this.prevProjectionDelta.x)||!RE(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y))}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 y=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,k=!!(S&&!E&&this.options.crossfade===!0&&!this.path.some(dq));this.animationProgress=0;let A;const O=m==null?void 0:m.interpolateProjection(u);this.mixTargetDelta=R=>{const T=R/1e3,M=O==null?void 0:O(T);M?(b.x.translate=M.x,b.x.scale=kn(u.x.scale,1,T),b.x.origin=u.x.origin,b.x.originPoint=u.x.originPoint,b.y.translate=M.y,b.y.scale=kn(u.y.scale,1,T),b.y.origin=u.y.origin,b.y.originPoint=u.y.originPoint):(PE(b.x,u.x,T),PE(b.y,u.y,T)),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(pg(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),uq(this.relativeTarget,this.relativeTargetOrigin,y,T),A&&$G(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=ps()),Ao(A,this.relativeTarget)),S&&(this.animationValues=p,UG(p,g,this.latestValues,T,k,E)),M&&M.rotate!==void 0&&(this.animationValues||(this.animationValues=p),this.animationValues.pathRotation=M.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},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=GG(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()}}),R9(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(WG),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&&U3(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),of(this.projectionDeltaWithTransform,this.layoutCorrected,f,h)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new XG),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&&Hy("z",u,h,this.animationValues);for(let g=0;g<Uy.length;g++)Hy(`rotate${Uy[g]}`,u,h,this.animationValues),Hy(`skew${Uy[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=Mp(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=Mp(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=BG(this.projectionDeltaWithTransform,this.treeScale,g);m&&(p=m(g,p)),u.transform=p;const{x:b,y}=this.projectionDelta;u.transformOrigin=`${b.origin*100}% ${y.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 k=S.length;for(let A=0;A<k;A++)u[S[A]]=E}else N?this.options.visualElement.renderState.vars[w]=E:u[w]=E}this.options.layoutId&&(u.pointerEvents=h===this?Mp(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(DE),this.root.sharedNodes.clear()}}}function ZG(e){e.updateLayout()}function JG(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],y=ar(b);b.min=a[p].min,b.max=b.min+y});else if(c==="x"||c==="y"){const p=c==="x"?"y":"x";b1(u?t.measuredBox[p]:t.layoutBox[p],a[p])}else U3(c,t.layoutBox,a)&&ea(p=>{const b=u?t.measuredBox[p]:t.layoutBox[p],y=ar(a[p]);b.max=b.min+y,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+y)});const f=fu();of(f,a,t.layoutBox);const m=fu();u?of(m,e.applyTransform(i,!0),t.measuredBox):of(m,a,t.layoutBox);const h=!_3(f);let g=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:b,layout:y}=p;if(b&&y){const w=e.options.layoutAnchor||void 0,C=ps();pg(C,t.layoutBox,b.layoutBox,w);const S=ps();pg(S,a,y.layoutBox,w),L3(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 eq(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 tq(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function nq(e){e.clearSnapshot()}function DE(e){e.clearMeasurements()}function sq(e){e.isLayoutDirty=!0,e.updateLayout()}function zE(e){e.isLayoutDirty=!1}function rq(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function oq(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function IE(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function aq(e){e.resolveTargetDelta()}function iq(e){e.calcProjection()}function lq(e){e.resetSkewAndRotation()}function cq(e){e.removeLeadSnapshot()}function PE(e,t,r){e.translate=kn(t.translate,0,r),e.scale=kn(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function _E(e,t,r,a){e.min=kn(t.min,r.min,a),e.max=kn(t.max,r.max,a)}function uq(e,t,r,a){_E(e.x,t.x,r.x,a),_E(e.y,t.y,r.y,a)}function dq(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const fq={duration:.45,ease:[.4,0,.1,1]},LE=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),$E=LE("applewebkit/")&&!LE("chrome/")?Math.round:_o;function BE(e){e.min=$E(e.min),e.max=$E(e.max)}function mq(e){BE(e.x),BE(e.y)}function U3(e,t,r){return e==="position"||e==="preserve-aspect"&&!zG(EE(t),EE(r),.2)}function hq(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const pq=V3({attachResizeListener:(e,t)=>kf(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}),Fy={current:void 0},H3=V3({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Fy.current){const e=new pq({});e.mount(window),e.setOptions({layoutScroll:!0}),Fy.current=e}return Fy.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),lm=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function VE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gq(...e){return t=>{let r=!1;const a=e.map(i=>{const c=VE(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():VE(e[i],null)}}}}function xq(...e){return x.useCallback(gq(...e),e)}class bq 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 yq({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(lm),g=c!==!1?((b=e.props)==null?void 0:b.ref)??(e==null?void 0:e.ref):void 0,p=xq(f,g);return x.useInsertionEffect(()=>{const{width:y,height:w,top:C,left:S,right:N,bottom:E,direction:k}=m.current;if(t||c===!1||!f.current||!y||!w)return;const A=k==="rtl",O=r==="left"?A?`right: ${N}`:`left: ${S}`:A?`left: ${S}`:`right: ${N}`,R=a==="bottom"?`bottom: ${E}`:`top: ${C}`;f.current.dataset.motionPopId=u;const T=document.createElement("style");h&&(T.nonce=h);const M=i??document.head;return M.appendChild(T),T.sheet&&T.sheet.insertRule(`
|
|
502
|
+
[data-motion-pop-id="${u}"] {
|
|
503
|
+
position: absolute !important;
|
|
504
|
+
width: ${y}px !important;
|
|
505
|
+
height: ${w}px !important;
|
|
506
|
+
${O}px !important;
|
|
507
|
+
${R}px !important;
|
|
508
|
+
}
|
|
509
|
+
`),()=>{var D;(D=f.current)==null||D.removeAttribute("data-motion-pop-id"),M.contains(T)&&M.removeChild(T)}},[t]),n.jsx(bq,{isPresent:t,childRef:f,sizeRef:m,pop:c,children:c===!1?e:x.cloneElement(e,{ref:p})})}const vq=({children:e,initial:t,isPresent:r,onExitComplete:a,custom:i,presenceAffectsLayout:c,mode:u,anchorX:f,anchorY:m,root:h})=>{const g=rm(wq),p=x.useId(),b=x.useRef(r),y=x.useRef(a);Ru(()=>{b.current=r,y.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=y.current)==null||N.call(y))})}),[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(yq,{pop:u==="popLayout",isPresent:r,anchorX:f,anchorY:m,root:h,children:e}),n.jsx(wx.Provider,{value:C,children:e})};function wq(){return new Map}function F3(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 Wh=e=>e.key||"";function UE(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]=F3(u),b=x.useMemo(()=>UE(e),[e]),y=u&&!g?[]:b.map(Wh),w=x.useRef(!0),C=x.useRef(b),S=rm(()=>new Map),N=x.useRef(new Set),[E,k]=x.useState(b),[A,O]=x.useState(b);Ru(()=>{u&&!g&&!A.length&&(p==null||p())},[g,u,A.length,p]),Ru(()=>{w.current=!1,C.current=b;for(let M=0;M<A.length;M++){const D=Wh(A[M]);y.includes(D)?(S.delete(D),N.current.delete(D)):S.get(D)!==!0&&S.set(D,!1)}},[A,y.length,y.join("-")]);const R=[];if(b!==E){let M=[...b],D=0;for(const _ of A){const H=y.indexOf(Wh(_));H===-1?(M.splice(D++,0,_),R.push(_)):D=H+R.length+1}return c==="wait"&&R.length&&(M=R),O(UE(M)),k(b),null}const{forceRender:T}=x.useContext(Xw);return n.jsx(n.Fragment,{children:A.map(M=>{const D=Wh(M),_=u&&!g?!1:b===A||y.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&&(T==null||T(),O(C.current),u&&(p==null||p()),a&&a())};return n.jsx(vq,{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:M},D)})})},G3=x.createContext({strict:!1}),HE={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 FE=!1;function jq(){if(FE)return;const e={};for(const t in HE)e[t]={isEnabled:r=>HE[t].some(a=>!!r[a])};k3(e),FE=!0}function q3(){return jq(),xG()}function Sq(e){const t=q3();for(const r in e)t[r]={...t[r],...e[r]};k3(t)}const Tx=x.createContext({});function Nq(e,t){if(kx(e)){const{initial:r,animate:a}=e;return{initial:r===!1||Cf(r)?r:void 0,animate:Cf(a)?a:void 0}}return e.inherit!==!1?t:{}}function Cq(e){const{initial:t,animate:r}=Nq(e,x.useContext(Tx));return x.useMemo(()=>({initial:t,animate:r}),[GE(t),GE(r)])}function GE(e){return Array.isArray(e)?e.join(" "):e}const Cj=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Y3(e,t,r){for(const a in t)!xs(t[a])&&!R3(a,r)&&(e[a]=t[a])}function kq({transformTemplate:e},t){return x.useMemo(()=>{const r=Cj();return yj(r,t,e),Object.assign({},r.vars,r.style)},[t])}function Tq(e,t){const r=e.style||{},a={};return Y3(a,r,e),Object.assign(a,kq(e,t)),a}function Eq(e,t){const r={},a=Tq(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 K3=()=>({...Cj(),attrs:{}});function Rq(e,t,r,a){const i=x.useMemo(()=>{const c=K3();return p3(c,t,O3(a),e.transformTemplate,e.style),{...c.attrs,style:{...c.style}}},[t]);if(e.style){const c={};Y3(c,e.style,e),i.style={...c,...i.style}}return i}const Aq=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")||Aq.has(e)}function Oq(e,t){return e.startsWith("on")?!gg(e):(t==null?void 0:t(e))??!gg(e)}function Mq(e,t,r,a){const i={};for(const c in e)c==="values"&&typeof e.values=="object"||xs(e[c])||(Oq(c,a)||r===!0&&gg(c)||!t&&!gg(c)||e.draggable&&c.startsWith("onDrag"))&&(i[c]=e[c]);return i}const Dq=["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 kj(e){return typeof e!="string"||e.includes("-")?!1:!!(Dq.indexOf(e)>-1||/[A-Z]/u.test(e))}function zq(e,t,r,{latestValues:a},i,c=!1,u,f){const h=(u??kj(e)?Rq:Eq)(t,a,i,e),g=Mq(t,typeof e=="string",c,f),p=e!==x.Fragment?{...g,...h,ref:r}:{},{children:b}=t,y=x.useMemo(()=>xs(b)?b.get():b,[b]);return x.createElement(e,{...p,children:y})}function Iq({scrapeMotionValuesFromProps:e,createRenderState:t},r,a,i){return{latestValues:Pq(r,a,i,e),renderState:t()}}function Pq(e,t,r,a){const i={},c=a(e,{});for(const b in c)i[b]=Mp(c[b]);let{initial:u,animate:f}=e;const m=kx(e),h=N3(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 y=0;y<b.length;y++){const w=hj(e,b[y]);if(w){const{transitionEnd:C,transition:S,...N}=w;for(const E in N){let k=N[E];if(Array.isArray(k)){const A=g?k.length-1:0;k=k[A]}k!==null&&(i[E]=k)}for(const E in C)i[E]=C[E]}}}return i}const X3=e=>(t,r)=>{const a=x.useContext(Tx),i=x.useContext(wx),c=()=>Iq(e,t,a,i);return r?c():rm(c)},_q=X3({scrapeMotionValuesFromProps:Nj,createRenderState:Cj}),Lq=X3({scrapeMotionValuesFromProps:M3,createRenderState:K3}),$q=Symbol.for("motionComponentSymbol");function Bq(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 W3=x.createContext({});function lu(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Vq(e,t,r,a,i,c){var k,A;const{visualElement:u}=x.useContext(Tx),f=x.useContext(G3),m=x.useContext(wx),h=x.useContext(lm),g=h.reducedMotion,p=h.skipAnimations,b=x.useRef(null),y=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}),y.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const w=b.current,C=x.useContext(W3);w&&!w.projection&&i&&(w.type==="html"||w.type==="svg")&&Uq(b.current,r,i,C);const S=x.useRef(!1);x.useInsertionEffect(()=>{w&&S.current&&w.update(r,m)});const N=r[d3],E=x.useRef(!!N&&typeof window<"u"&&!((k=window.MotionHandoffIsComplete)!=null&&k.call(window,N))&&((A=window.MotionHasOptimisedAnimation)==null?void 0:A.call(window,N)));return Ru(()=>{var O;!y.current||!w||((O=w.animationState)==null||O.animateChanges(),w.enteringChildren=void 0)},[]),Ru(()=>{y.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 O;(O=window.MotionHandoffMarkAsComplete)==null||O.call(window,N)}),E.current=!1),w.enteringChildren=void 0)}),w}function Uq(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:Q3(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 Q3(e){if(e)return e.options.allowProjection!==!1?e.projection:Q3(e.parent)}function Gy(e,{forwardMotionProps:t=!1,type:r}={},a,i){a&&Sq(a);const c=r?r==="svg":kj(e),u=c?Lq:_q;function f(h,g){let p;const b={...x.useContext(lm),...h,layoutId:Hq(h)},{isStatic:y,isValidProp:w}=b,C=Cq(h),S=u(h,y);if(!y&&typeof window<"u"){Fq();const N=Gq(b);p=N.MeasureLayout,C.visualElement=Vq(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,zq(e,h,Bq(S,C.visualElement,g),S,y,t,c,w)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=x.forwardRef(f);return m[$q]=e,m}function Hq({layoutId:e}){const t=x.useContext(Xw).id;return t&&e!==void 0?t+"-"+e:e}function Fq(e,t){x.useContext(G3).strict}function Gq(e){const t=q3(),{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 qq(e,t){if(typeof Proxy>"u")return Gy;const r=new Map,a=(c,u)=>Gy(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,Gy(u,void 0,e,t)),r.get(u))})}const Yq=(e,t)=>t.isSVG??kj(e)?new SG(t):new wG(t,{allowProjection:e!==x.Fragment});class Kq extends il{constructor(t){super(t),t.animationState||(t.animationState=EG(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 Xq=0;class Wq extends il{constructor(){super(...arguments),this.id=Xq++,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 Qq={animation:{Feature:Kq},exit:{Feature:Wq}};function Ex(e){return{point:{x:e.pageX,y:e.pageY}}}const Zq=e=>t=>wj(t)&&e(t,Ex(t));function af(e,t,r,a){return kf(e,t,Zq(r),a)}const Z3=({current:e})=>e?e.ownerDocument.defaultView:null,qE=(e,t)=>Math.abs(e-t);function Jq(e,t){const r=qE(e.x,t.x),a=qE(e.y,t.y);return Math.sqrt(r**2+a**2)}const YE=new Set(["auto","scroll"]);class J3{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=Qh(this.lastRawMoveEventInfo,this.transformPagePoint));const w=qy(this.lastMoveEventInfo,this.history),C=this.startEvent!==null,S=Jq(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:k}=this.handlers;C||(E&&E(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,w)},this.handlePointerMove=(w,C)=>{this.lastMoveEvent=w,this.lastRawMoveEventInfo=C,this.lastMoveEventInfo=Qh(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 k=qy(w.type==="pointercancel"?this.lastMoveEventInfo:Qh(C,this.transformPagePoint),this.history);this.startEvent&&S&&S(w,k),N&&N(w,k)},!wj(t))return;this.dragSnapToOrigin=c,this.handlers=r,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=i||window;const m=Ex(t),h=Qh(m,this.transformPagePoint),{point:g}=h,{timestamp:p}=Es;this.history=[{...g,timestamp:p}];const{onSessionStart:b}=r;b&&b(t,qy(h,this.history));const y={passive:!0,capture:!0};this.removeListeners=om(af(this.contextWindow,"pointermove",this.handlePointerMove,y),af(this.contextWindow,"pointerup",this.handlePointerUp,y),af(this.contextWindow,"pointercancel",this.handlePointerUp,y)),f&&this.startScrollTracking(f)}startScrollTracking(t){let r=t.parentElement;for(;r;){const a=getComputedStyle(r);(YE.has(a.overflowX)||YE.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 Qh(e,t){return t?{point:t(e.point)}:e}function KE(e,t){return{x:e.x-t.x,y:e.y-t.y}}function qy({point:e},t){return{point:e,delta:KE(e,e4(t)),offset:KE(e,eY(t)),velocity:tY(t,.1)}}function eY(e){return e[0]}function e4(e){return e[e.length-1]}function tY(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,a=null;const i=e4(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 nY(e,{min:t,max:r},a){return t!==void 0&&e<t?e=a?kn(t,e,a.min):Math.max(e,t):r!==void 0&&e>r&&(e=a?kn(r,e,a.max):Math.min(e,r)),e}function XE(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 sY(e,{top:t,left:r,bottom:a,right:i}){return{x:XE(e.x,r,i),y:XE(e.y,t,a)}}function WE(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 rY(e,t){return{x:WE(e.x,t.x),y:WE(e.y,t.y)}}function oY(e,t){let r=.5;const a=ar(e),i=ar(t);return i>a?r=jf(t.min,t.max-a,e.min):a>i&&(r=jf(e.min,e.max-i,t.min)),Bo(0,1,r)}function aY(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 y1=.35;function iY(e=y1){return e===!1?e=0:e===!0&&(e=y1),{x:QE(e,"left","right"),y:QE(e,"top","bottom")}}function QE(e,t,r){return{min:ZE(e,t),max:ZE(e,r)}}function ZE(e,t){return typeof e=="number"?e:e[t]||0}const lY=new WeakMap;class cY{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:y,dragPropagation:w,onDragStart:C}=this.getProps();if(y&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=YF(y),!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:k}=this.visualElement;if(k&&k.layout){const A=k.layout.layoutBox[N];A&&(E=ar(A)*(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:y,dragDirectionLock:w,onDirectionLock:C,onDrag:S}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:N}=b;if(w&&this.currentDirection===null){this.currentDirection=dY(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 J3(t,{onSessionStart:c,onStart:u,onMove:f,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:a,contextWindow:Z3(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||!Zh(t,i,this.currentDirection))return;const c=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=nY(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=sY(a.layoutBox,t):this.constraints=!1,this.elastic=iY(r),i!==this.constraints&&!lu(t)&&a&&this.constraints&&!this.hasMutatedConstraints&&ea(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=aY(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=qF(a,i.root,this.visualElement.getTransformPagePoint());let u=rY(i.layout.layoutBox,c);if(r){const f=r(HF(u));this.hasMutatedConstraints=!!f,f&&(u=g3(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(!Zh(g,r,this.currentDirection))return;let p=m&&m[g]||{};(u===!0||u===g)&&(p={min:0,max:0});const b=i?200:1e6,y=i?40:1e7,w={type:"inertia",velocity:a?t[g]:0,bounceStiffness:b,bounceDamping:y,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(mj(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(!Zh(m,a,this.currentDirection))return;const h=this.getAxisMotionValue(m),{min:g,max:p}=u[m];h.set((h.get()||0)+c[m]-kn(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]=oY({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(!Zh(f,t,null)||!m.get())return;const{min:h,max:g}=this.constraints[f];m.set(kn(h,g,c[f]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;lY.set(this.visualElement,this);const t=this.visualElement.current,r=af(t,"pointerdown",h=>{const{drag:g,dragListener:p=!0}=this.getProps(),b=h.target,y=b!==t&&JF(b);g&&p&&!y&&this.start(h)});let a;const i=()=>{const{dragConstraints:h}=this.getProps();lu(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(a=uY(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=kf(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=y1,dragMomentum:f=!0}=t;return{...t,drag:r,dragDirectionLock:a,dragPropagation:i,dragConstraints:c,dragElastic:u,dragMomentum:f}}}function JE(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function uY(e,t,r){const a=cE(e,JE(r)),i=cE(t,JE(r));return()=>{a(),i()}}function Zh(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function dY(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class fY extends il{constructor(t){super(t),this.removeGroupControls=_o,this.removeListeners=_o,this.controls=new cY(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 Yy=e=>(t,r)=>{e&&jn.update(()=>e(t,r),!1,!0)};class mY extends il{constructor(){super(...arguments),this.removePointerDownListener=_o}onPointerDown(t){this.session=new J3(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Z3(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:a,onPanEnd:i}=this.node.getProps();return{onSessionStart:Yy(t),onStart:Yy(r),onMove:Yy(a),onEnd:(c,u)=>{delete this.session,i&&jn.postRender(()=>i(c,u))}}}mount(){this.removePointerDownListener=af(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 Ky=!1;class hY 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),Ky&&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}),Ky=!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(),vj.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:a}=this.props,{projection:i}=t;Ky=!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 t4(e){const[t,r]=F3(),a=x.useContext(Xw);return n.jsx(hY,{...e,layoutGroup:a,switchLayoutGroup:x.useContext(W3),isPresent:t,safeToRemove:r})}const pY={pan:{Feature:mY},drag:{Feature:fY,ProjectionNode:H3,MeasureLayout:t4}};function eR(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 gY extends il{mount(){const{current:t}=this.node;t&&(this.unmount=XF(t,(r,a)=>(eR(this.node,a,"Start"),i=>eR(this.node,i,"End"))))}unmount(){}}class xY 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=om(kf(this.node.current,"focus",()=>this.onFocus()),kf(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function tR(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 bY extends il{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:r,propagate:a}=this.node.props;this.unmount=tG(t,(i,c)=>(tR(this.node,c,"Start"),(u,{success:f})=>tR(this.node,u,f?"End":"Cancel")),{useGlobalTarget:r,stopPropagation:(a==null?void 0:a.tap)===!1})}unmount(){}}const v1=new WeakMap,Xy=new WeakMap,yY=e=>{const t=v1.get(e.target);t&&t(e)},vY=e=>{e.forEach(yY)};function wY({root:e,...t}){const r=e||document;Xy.has(r)||Xy.set(r,{});const a=Xy.get(r),i=JSON.stringify(t);return a[i]||(a[i]=new IntersectionObserver(vY,{root:e,...t})),a[i]}function jY(e,t,r){const a=wY(t);return v1.set(e,r),a.observe(e),()=>{v1.delete(e),a.unobserve(e)}}const SY={some:0,all:1};class NY 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:SY[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(),y=g?p:b;y&&y(h)};this.stopObserver=jY(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(CY(t,r))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function CY({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const kY={inView:{Feature:NY},tap:{Feature:bY},focus:{Feature:xY},hover:{Feature:gY}},TY={layout:{ProjectionNode:H3,MeasureLayout:t4}},EY={...Qq,...kY,...pY,...TY},RY=qq(EY,Yq);function Tj(e){const t=rm(()=>ic(e)),{isStatic:r}=x.useContext(lm);if(r){const[,a]=x.useState(e);x.useEffect(()=>t.on("change",a),[])}return t}function n4(e,t){const r=Tj(t()),a=()=>r.set(t());return a(),Ru(()=>{const i=()=>jn.preRender(a,!1,!0),c=e.map(u=>u.on("change",i));return()=>{c.forEach(u=>u()),pa(a)}}),r}function AY(e){rf.current=[],e();const t=n4(rf.current,e);return rf.current=void 0,t}function OY(e,t,r,a){if(typeof e=="function")return AY(e);const c=dG(t,r,a),u=Array.isArray(e)?nR(e,c):nR([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 nR(e,t){const r=rm(()=>[]);return n4(e,()=>{r.length=0;const a=e.length;for(let i=0;i<a;i++)r[i]=e[i].get();return t(r)})}function MY(e,t={}){const{isStatic:r}=x.useContext(lm),a=()=>xs(e)?e.get():e;if(r)return OY(a);const i=Tj(a());return x.useInsertionEffect(()=>mG(i,e,t),[i,JSON.stringify(t)]),i}function DY(e,t={}){return MY(e,{type:"spring",...t})}function Zs(){!Sj.current&&C3();const[e]=x.useState(mg.current);return e}const zY={some:0,all:1};function IY(e,t,{root:r,margin:a,amount:i="some"}={}){const c=bj(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:zY[i]});return c.forEach(h=>m.observe(h)),()=>m.disconnect()}function s4(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 IY(e.current,m,h)},[t,e,r,i,a]),u}const $n=RY,sR=e=>typeof e=="function"?void 0:e.filter;function mo({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=s4(p,{once:!0,margin:m}),y=!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=sR(S.hidden),E=sR(S.visible),k=N!=null&&E!=null&&N!==E;return n.jsx(lc,{children:n.jsx($n.div,{ref:p,initial:w?!1:"hidden",animate:y?"visible":"hidden",exit:"hidden",variants:S,transition:{delay:.04+i,duration:w?0:a,ease:"easeOut",...k?{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 r4(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 y,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=(y=e==null?void 0:e.agentInventory)==null?void 0:y.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(y=>y.name.toLowerCase()===p.name.toLowerCase())===b)}function Wy(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 PY=`
|
|
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"],Jh=(e,t="bash")=>`curl -fsSL ${e} -o /tmp/install-agent.sh && ${t} /tmp/install-agent.sh && rm /tmp/install-agent.sh`,LY=[{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:Jh("https://cursor.com/install")},{id:"antigravity",command:"agy",install:Jh("https://antigravity.google/cli/install.sh")},{id:"copilot",command:"copilot",npm:"@github/copilot"},{id:"kiro",command:"kiro-cli",packages:["unzip"],install:Jh("https://cli.kiro.dev/install")},{id:"droid",command:"droid",install:Jh("https://app.factory.ai/cli","sh")},{id:"aider",command:"aider",python:!0}],Ws=LY.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}],$Y="/run/openshell-supervisor-ca/material/ca-bundle.crt",bg=[...Ws.map(e=>({id:e.command,name:e.name})),{id:"",name:"Shell"}],BY=/^[a-z0-9]([a-z0-9-]{0,17}[a-z0-9])?$/,VY=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 rR=e=>e.split(/[\s,]+/).filter(Boolean),Qy=e=>`openshell-image-recipe-v3:${e}`;function oR(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 UY(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 HY(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 Zy=e=>"'"+e.replaceAll("'","'\\''")+"'",FY=/^[a-zA-Z0-9][a-zA-Z0-9._/:@-]{0,255}$/;function GY(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."),BY.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"?FY.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(UY(e))).length>VY&&(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(Zy).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 = ${$Y}' >> /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 -- ${Zy(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' ${PY.split(`
|
|
517
|
+
`).map(Zy).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 aR="openshell.console/session",qY="openshell.console/project",zp=e=>!!(e!=null&&e.remote&&/^console-ssh-[a-f0-9]{24}$/.test(e.name??e.gateway??"")),YY=e=>{var r;const t=(r=e==null?void 0:e.labels)==null?void 0:r[qY];return typeof t=="string"&&/^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(t)?t:null},KY={shell:"/bin/bash -l",...Object.fromEntries(Ws.map(e=>[e.command,e.command]))},XY=e=>Object.hasOwn(KY,e??""),WY=e=>{var t;return XY((t=e==null?void 0:e.labels)==null?void 0:t[aR])?e.labels[aR]:"shell"},o4=e=>{var t;return e==="shell"?"Shell":((t=Ws.find(r=>r.command===e))==null?void 0:t.name)??e};function ote(e){const t=WY(e),r=r4(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:o4(i)}))]}function yg(e,t,r,a=typeof r=="string"?r:(r==null?void 0:r.target)??GA()){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 Ej(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 Ox=(e,t)=>e.appliesTo.everyone||Ej(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)),QY=e=>e.startsWith("*")||!e.includes(".")?[e]:[e,`**.${e}`],ZY=e=>e.flatMap(QY);function a4(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 i4=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48).replace(/-$/,""),ir=(e,t)=>{var r;return Ej((r=e==null?void 0:e.assignments)==null?void 0:r[t])},l4=(e,t)=>(e??[]).filter(r=>Ox(r,t)),Rj=(e,t)=>(e??[]).filter(r=>!r.appliesTo.everyone&&r.appliesTo.groups.includes(t));function iR({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 JY({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=i4(c),b=t.some(w=>w.id===p);async function y(){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(Mt,{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(),y()),w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),i(!1))}}),n.jsxs(ie,{type:"button",size:"xs",onClick:y,disabled:f||!p||b,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&n.jsx(Rt,{"aria-hidden":"true"}),"Create"]}),n.jsx(ie,{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(ys,{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(iR,{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(iR,{pressed:h.includes(p.id),onClick:()=>g(p.id),count:t[p.id],children:p.name},p.id)),u&&n.jsx(JY,{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 eK(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 tK=e=>{switch(e){case"success":return rK;case"info":return aK;case"warning":return oK;case"error":return iK;default:return null}},nK=Array(12).fill(0),sK=({visible:e,className:t})=>nt.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},nt.createElement("div",{className:"sonner-spinner"},nK.map((r,a)=>nt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),rK=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"})),oK=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"})),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:"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"})),iK=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"})),lK=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"})),cK=()=>{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 uK=1;const dK=100,lR=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:uK++};class fK{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-dK;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=lR(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(hK(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,y=typeof g=="object"&&!nt.isValidElement(g)?g:{message:g};this.create({id:a,type:"error",description:p,...y})}}).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=lR(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 yr=new fK,mK=(e,t)=>yr.message(e,t),hK=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",pK=mK,gK=()=>yr.toasts,xK=()=>yr.getActiveToasts(),He=Object.assign(pK,{success:yr.success,info:yr.info,warning:yr.warning,error:yr.error,custom:yr.custom,message:yr.message,promise:yr.promise,dismiss:yr.dismiss,loading:yr.loading},{getHistory:gK,getToasts:xK});eK("[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 bK=3,yK="24px",vK="16px",cR=4e3,wK=356,jK=14,SK=45,NK=200;function Jo(...e){return e.filter(Boolean).join(" ")}function CK(e){const[t,r]=e.split("-"),a=[];return t&&a.push(t),r&&a.push(r),a}const kK=e=>{var t,r,a,i,c,u,f,m,h;const{invert:g,toast:p,unstyled:b,interacting:y,setHeights:w,visibleToasts:C,heights:S,index:N,toasts:E,expanded:k,removeToast:A,defaultRichColors:O,closeButton:R,style:T,cancelButtonStyle:M,actionButtonStyle:D,className:_="",descriptionClassName:H="",duration:G,position:B,gap:P,expandByDefault:V,classNames:Y,icons:W,closeButtonAriaLabel:q="Close toast"}=e,[ee,z]=nt.useState(null),[L,X]=nt.useState(null),[te,$]=nt.useState(!1),[U,F]=nt.useState(!1),[K,se]=nt.useState(!1),[ne,ve]=nt.useState(!1),[ae,le]=nt.useState(!1),[re,Q]=nt.useState(0),[Z,pe]=nt.useState(0),ue=nt.useRef(p.duration||G||cR),ye=nt.useRef(null),Ce=nt.useRef(null),Ie=N===0,de=N+1<=C,Te=p.type,oe=Te??"default",fe=p.dismissible!==!1,Re=p.className||"",Me=p.descriptionClassName||"",ke=nt.useMemo(()=>S.findIndex(Ze=>Ze.toastId===p.id)||0,[S,p.id]),me=nt.useMemo(()=>{var Ze;return(Ze=p.closeButton)!=null?Ze:R},[p.closeButton,R]),Ae=nt.useMemo(()=>p.duration||G||cR,[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,kt,je)=>je>=ke?Ze:Ze+kt.height,0),[S,ke]),At=cK(),rt=nt.useMemo(()=>{var Ze;return(Ze=e.swipeDirections)!=null?Ze:CK(B)},[e.swipeDirections,B]),be=p.invert||g,Ue=Te==="loading";Pe.current=nt.useMemo(()=>ke*P+ct,[ke,ct]),nt.useEffect(()=>{ue.current=Ae},[Ae]),nt.useEffect(()=>{$(!0)},[]),nt.useEffect(()=>{const Ze=Ce.current;if(Ze){const kt=Ze.getBoundingClientRect().height;return pe(kt),w(je=>[{toastId:p.id,height:kt,position:p.position},...je]),()=>w(je=>je.filter(Ye=>Ye.toastId!==p.id))}},[w,p.id]),nt.useLayoutEffect(()=>{if(!te)return;const Ze=Ce.current,kt=Ze.style.height;Ze.style.height="auto";const je=Ze.getBoundingClientRect().height;Ze.style.height=kt,pe(je),w(Ye=>Ye.find(it=>it.toastId===p.id)?Ye.map(it=>it.toastId===p.id?{...it,height:je}:it):[{toastId:p.id,height:je,position:p.position},...Ye])},[te,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(kt=>kt.toastId!==p.id)),setTimeout(()=>{A(p)},NK)},[p,A,w,Pe]);nt.useEffect(()=>{if(p.promise&&Te==="loading"||p.duration===1/0||p.type==="loading")return;let Ze;return k||y||At?(()=>{if(Fe.current<ge.current){const Ye=new Date().getTime()-ge.current;ue.current=ue.current-Ye}Fe.current=new Date().getTime()})():(()=>{ue.current!==1/0&&(ge.current=new Date().getTime(),Ze=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),Qe()},ue.current))})(),()=>clearTimeout(Ze)},[k,y,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 kt;return nt.createElement("div",{className:Jo(Y==null?void 0:Y.loader,p==null||(kt=p.classNames)==null?void 0:kt.loader,"sonner-loader"),"data-visible":Te==="loading"},W.loading)}return nt.createElement(sK,{className:Jo(Y==null?void 0:Y.loader,p==null||(Ze=p.classNames)==null?void 0:Ze.loader),visible:Te==="loading"})}const Ke=p.icon||(W==null?void 0:W[Te])||tK(Te);var Be,jt;return nt.createElement("li",{tabIndex:0,ref:Ce,className:Jo(_,Re,Y==null?void 0:Y.toast,p==null||(t=p.classNames)==null?void 0:t.toast,Y==null?void 0:Y[oe],p==null||(r=p.classNames)==null?void 0:r[oe]),"data-sonner-toast":"","data-rich-colors":(Be=p.richColors)!=null?Be:O,"data-styled":!(p.jsx||p.unstyled||b),"data-mounted":te,"data-promise":!!p.promise,"data-swiped":ae,"data-removed":U,"data-visible":de,"data-y-position":Xe,"data-x-position":Je,"data-index":N,"data-front":Ie,"data-swiping":K,"data-dismissible":fe,"data-type":Te,"data-invert":be,"data-swipe-out":ne,"data-swipe-direction":L,"data-expanded":!!(k||V&&te),"data-testid":p.testId,style:{"--index":N,"--toasts-before":N,"--z-index":E.length-N,"--offset":`${U?re:Pe.current}px`,"--initial-height":V?"auto":`${Z}px`,...T,...p.style},onDragEnd:()=>{se(!1),z(null),_e.current=null},onPointerDown:Ze=>{Ze.button!==2&&(Ue||!fe||(ye.current=new Date,Q(Pe.current),Ze.target.setPointerCapture(Ze.pointerId),Ze.target.tagName!=="BUTTON"&&(se(!0),_e.current={x:Ze.clientX,y:Ze.clientY})))},onPointerUp:()=>{var Ze,kt,je;if(ne||!fe)return;_e.current=null;const Ye=Number(((Ze=Ce.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),et=Number(((kt=Ce.current)==null?void 0:kt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),it=new Date().getTime()-((je=ye.current)==null?void 0:je.getTime()),lt=ee==="x"?Ye:et,wt=Math.abs(lt)/it;if((ee==="x"?rt.includes(Ye>0?"right":"left"):rt.includes(et>0?"bottom":"top"))&&(Math.abs(lt)>=SK||wt>.11)){Q(Pe.current),p.onDismiss==null||p.onDismiss.call(p,p),X(ee==="x"?Ye>0?"right":"left":et>0?"down":"up"),Qe(),ve(!0);return}else{var Gt,fn;(Gt=Ce.current)==null||Gt.style.setProperty("--swipe-amount-x","0px"),(fn=Ce.current)==null||fn.style.setProperty("--swipe-amount-y","0px")}le(!1),se(!1),z(null)},onPointerMove:Ze=>{var kt,je,Ye;if(!_e.current||!fe||((kt=window.getSelection())==null?void 0:kt.toString().length)>0)return;const it=Ze.clientY-_e.current.y,lt=Ze.clientX-_e.current.x;!ee&&(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(ee==="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(ee==="x"&&(rt.includes("left")||rt.includes("right")))if(rt.includes("left")&<<0||rt.includes("right")&<>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)&&le(!0),(je=Ce.current)==null||je.style.setProperty("--swipe-amount-x",`${wt.x}px`),(Ye=Ce.current)==null||Ye.style.setProperty("--swipe-amount-y",`${wt.y}px`)}},me&&!p.jsx&&Te!=="loading"?nt.createElement("button",{"aria-label":q,"data-disabled":Ue,"data-close-button":!0,onClick:Ue||!fe?()=>{}:()=>{Qe(),p.onDismiss==null||p.onDismiss.call(p,p)},className:Jo(Y==null?void 0:Y.closeButton,p==null||(a=p.classNames)==null?void 0:a.closeButton)},(jt=W==null?void 0:W.close)!=null?jt:lK):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(Y==null?void 0:Y.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(Y==null?void 0:Y.content,p==null||(c=p.classNames)==null?void 0:c.content)},nt.createElement("div",{"data-title":"",className:Jo(Y==null?void 0:Y.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,Me,Y==null?void 0:Y.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||M,onClick:Ze=>{ep(p.cancel)&&fe&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Ze),Qe())},className:Jo(Y==null?void 0:Y.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(Y==null?void 0:Y.actionButton,p==null||(h=p.classNames)==null?void 0:h.actionButton)},p.action.label):null)};function uR(){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 TK(e,t){const r={};return[e,t].forEach((a,i)=>{const c=i===1,u=c?"--mobile-offset":"--offset",f=c?vK:yK;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 EK=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:y,duration:w,style:C,visibleToasts:S=bK,toastOptions:N,dir:E=uR(),gap:k=jK,icons:A,customAriaLabel:O,containerAriaLabel:R="Notifications"}=t,[T,M]=nt.useState([]),D=nt.useMemo(()=>a?T.filter($=>$.toasterId===a):T.filter($=>!$.toasterId),[T,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,Y]=nt.useState(!1),[W,q]=nt.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ee=nt.useRef(null),z=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),L=nt.useRef(null),X=nt.useRef(!1),te=nt.useCallback($=>{M(U=>{var F;return(F=U.find(K=>K.id===$.id))!=null&&F.delete||yr.dismiss($.id),U.filter(({id:K})=>K!==$.id)})},[]);return nt.useEffect(()=>yr.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{M(U=>U.map(F=>F.id===$.id?{...F,delete:!0}:F))});return}setTimeout(()=>{UB.flushSync(()=>{M(U=>{const F=U.findIndex(K=>K.id===$.id);return F!==-1?[...U.slice(0,F),{...U[F],...$},...U.slice(F+1)]:[$,...U]})})})}),[]),nt.useEffect(()=>{if(b!=="system"){q(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:U})=>{q(U?"dark":"light")})}catch{$.addListener(({matches:F})=>{try{q(F?"dark":"light")}catch(K){console.error(K)}})}},[b]),nt.useEffect(()=>{T.length<=1&&P(!1)},[T]),nt.useEffect(()=>{const $=U=>{var F;if(u.length>0&&u.every(ne=>U[ne]||U.code===ne)){var se;P(!0),(se=ee.current)==null||se.focus()}U.code==="Escape"&&(document.activeElement===ee.current||(F=ee.current)!=null&&F.contains(document.activeElement))&&P(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[u]),nt.useEffect(()=>{if(ee.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,X.current=!1)}},[ee.current]),nt.createElement("section",{ref:r,"aria-label":O??`${R} ${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[K,se]=$.split("-");return D.length?nt.createElement("ol",{key:$,dir:E==="auto"?uR():E,tabIndex:-1,ref:ee,className:h,"data-sonner-toaster":!0,"data-sonner-theme":W,"data-y-position":K,"data-x-position":se,style:{"--front-toast-height":`${((F=H[0])==null?void 0:F.height)||0}px`,"--width":`${wK}px`,"--gap":`${k}px`,...C,...TK(g,p)},onBlur:ne=>{X.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(X.current=!1,L.current&&(L.current.focus({preventScroll:!0}),L.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||X.current||(X.current=!0,L.current=ne.relatedTarget)},onMouseEnter:()=>P(!0),onMouseMove:()=>P(!0),onMouseLeave:()=>{V||P(!1)},onDragEnd:()=>P(!1),onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||Y(!0)},onPointerUp:()=>Y(!1)},D.filter(ne=>!ne.position&&U===0||ne.position===$).map((ne,ve)=>{var ae,le;return nt.createElement(kK,{key:ne.id,icons:A,index:ve,toast:ne,defaultRichColors:y,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:(le=N==null?void 0:N.closeButton)!=null?le: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:te,toasts:D.filter(re=>re.position==ne.position),heights:H.filter(re=>re.position==ne.position),setHeights:G,expandByDefault:f,gap:k,expanded:B,swipeDirections:t.swipeDirections})})):null}))}),RK={info:{icon:n.jsx(Mu,{className:"size-4 text-muted-foreground"}),role:"status"},progress:{icon:n.jsx(Rt,{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(DO,{className:"size-4 text-destructive"}),role:"alert"}};function AK({tone:e="info",title:t,children:r,actions:a,onDismiss:i,dismissLabel:c}){const{icon:u,role:f}=RK[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(AK,{...t}),{id:e,duration:1/0,dismissible:!1,unstyled:!0}));return()=>clearTimeout(r)}),x.useEffect(()=>()=>{He.dismiss(e)},[e]),null}const OK="Not downloaded yet. Import downloads this npm package and checks that it starts, in a temporary sandbox.",Aj=e=>e===OK||e.startsWith("Prepare package"),Oj=e=>e.kind==="mcp"&&!e.disabled&&!e.config&&!e.configuration&&!e.package;function MK(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 c4(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=>Aj(a)||t.has(a)))}function DK(e){return!e.disabled&&(!e.issues.length||c4(e))}function zK(e){const t=e.requirements||[];return[...t,...MK(e.package).filter(r=>!t.some(a=>a.host===r.host&&a.phase===r.phase))]}const dR=e=>e.items.some(t=>!t.disabled&&t.issues.length>0),u4=e=>!!(e!=null&&e.useSourceSecrets||e!=null&&e.provider||Object.values((e==null?void 0:e.secrets)||{}).some(Boolean)),d4=(e,t)=>e.issues.filter(r=>{var a;return!Aj(r)&&!((a=e.preparationIssues)!=null&&a.includes(r))&&!(r.startsWith("Connect credentials")&&u4(t))}),IK=(e,t={})=>new Map(e.items.map(r=>[r.id,new Set(d4(r,t[r.id]))])),PK=(e,t={})=>e.items.filter(r=>!r.disabled&&d4(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 LK(e,t,r,a,{onProgress:i=()=>{},onReview:c=()=>{},isCancelled:u=()=>!1,resumeJob:f,wait:m=h=>new Promise(g=>setTimeout(g,h))}={}){const h=IK(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(y){if(++p>=20)throw y;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(y=>!y.disabled&&y.issues.length).map(y=>y.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"]}},vg=["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",lf=e=>e.replace(/^_provider_/,"").replace(/^(org|group|egress)_/,"").replace(/_/g,"-");function Mj(e){if(!e)return null;try{return new URL(e.includes("://")?e:`https://${e}`).hostname}catch{return e.split("/")[0].replace(/:\d+$/,"")}}function f4(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 $K(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 h4(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 y of g.rules){const w=qa(y.key);b[w]=(b[w]??0)+1;for(const C of y.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===y.key);N||(N={sandbox:g.name,key:y.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=Mj(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:f4(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 y=c.get(g.sandbox);y&&(y.blocked+=1)}const f=ZY([...((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=>a4(p,g.host))).sort((g,p)=>p.sandboxes.size-g.sandboxes.size||p.attempts-g.attempts),perSandbox:c}}function BK(e){const t=e.map(r=>{var a,i,c,u,f;return{location:r.location,...h4(((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])=>[mt({name:a,location:r.location}),i])))}}function VK(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 yo(){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,y=lr("local",b.signal);let w=null;const C=async()=>{var A,O;const S=await Promise.allSettled([y.inventory(),...r?[Ha("inventory",void 0,{signal:b.signal})]:[]]);if(!g)return;const N=[],E=[];for(let R=0;R<S.length;R++){const T=R===0?"local":"cloud",M=R!==0||!t,D=S[R];if(D.status==="fulfilled")N.push({target:T,cloud:M,inventory:D.value}),(A=D.value.machine)!=null&&A.error&&E.push(D.value.machine.error);else{E.push(`${M?"Cloud":"Local"} inventory unavailable: ${D.reason.message}`);const _=(O=w==null?void 0:w.filter(H=>H.target===T)[0])==null?void 0:O.inventory;if(_){const H=_.locations.map(G=>({...G,connected:!1,error:D.reason.message}));N.push({target:T,cloud:M,inventory:{..._,locations:H}})}}}w=N;const k=VK(N);ln.observeTemplates(k.templates),c({scope:a,inventory:k,error:E.join("; ")||null}),p=setTimeout(C,k.templates.some(R=>R.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 UK(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 HK(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 fR=new Map;function Vu(e){var N,E;const t=Bf(),r=js(),a=yo(),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:k,context:A,connected:O})=>[k,A,O])),f=x.useRef(a.locations);f.current=a.locations;const[m,h]=x.useState(null),[g,p]=x.useState(!0),b=x.useRef(0),y=x.useCallback(k=>{var O;const A=r!=null&&r.localViewer?k.target:t.target;return lr(A,t.signal,k.context,A==="cloud"?((O=r==null?void 0:r.status)==null?void 0:O.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 O;const k=++b.current;p(!0);const A=await UK(f.current,i.split(",").filter(Boolean),y,fR.get(c));if(!(k!==b.current||(O=t.signal)!=null&&O.aborted))return fR.set(c,A),h({scope:c,sources:A}),p(!1),A},[y,i,c,t.signal]);x.useEffect(()=>{if(a.loading)return;w();const k=setInterval(w,15e3),A=()=>w();return window.addEventListener("openrod-resources-changed",A),()=>{b.current++,clearInterval(k),window.removeEventListener("openrod-resources-changed",A)}},[w,u,a.loading]);const C=x.useMemo(()=>(m==null?void 0:m.scope)===c?m.sources.map(k=>({...k,location:{...k.location,connected:k.location.connected&&f.current.some(A=>A.id===k.location.id&&A.connected)}})):[],[m,c,u]),S=x.useMemo(()=>HK(C,i.split(",").filter(Boolean)),[C,i]);return{sources:C,status:S,loading:a.loading||g,refresh:w,apiFor:y,locations:a.locations,inventory:a,error:C.filter(k=>k.error).map(k=>`${k.location.label}: ${k.error}`).join("; ")}}function Au({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(ie,{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 Tf=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},FK={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},GK={NET:"Network",HTTP:"HTTP",SSH:"Session",CONFIG:"Configuration",PROC:"Process",FILE:"File",AUTH:"Authentication",FINDING:"Finding",EVENT:"Event"};function Dj(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:GK[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:FK[e.reason]??e.reason??""};return{event:e,agent:a,key:Tf(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),y=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)||y&&!S.search.includes(y)||f!=="all"&&(!Number.isFinite(S.timestamp)||S.timestamp<w||S.timestamp>C)?!1:Object.entries(u).every(([N,E])=>{var k;return!((k=E==null?void 0:E.value)!=null&&k.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]??"",k=p.key==="severity"?jg[N.values.severity.toUpperCase()]??-1:p.key==="time"?Number.isFinite(N.timestamp)?N.timestamp:0:N.values[p.key]??"",A=typeof E=="number"?E-k:E.localeCompare(k,void 0,{numeric:!0});return(p.direction==="asc"?A:-A)||S.key.localeCompare(N.key)})}const p4=x.createContext(null),Jy=2e3;function Ef({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),[y,w]=x.useState(null),C=x.useRef(new Set),S=x.useRef(0),[N,E]=x.useState(0),k=x.useCallback(T=>{const M=T.filter(D=>{const _=Tf(D);return C.current.has(_)?!1:(C.current.add(_),!0)});M.length&&m(D=>{const _=[...M,...D].sort((H,G)=>(G.at??"").localeCompare(H.at??""));if(_.length<=Jy)return _;for(const H of _.slice(Jy))C.current.delete(Tf(H));return _.slice(0,Jy)})},[]),A=x.useCallback(async()=>{try{u(await t.overview())}catch(T){u(M=>M??{error:T.message})}},[t]),O=x.useCallback(async()=>{const T=S.current;try{const M=await t.activity({limit:500});if(T!==S.current)return;k(M.events),b(M.coverage),w(null)}catch(M){w(M.message)}},[k,t]);x.useEffect(()=>{let T,M,D=!1;const _=()=>{S.current++,C.current.clear(),m([]),E(H=>H+1),O()};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}A(),O(),M=setInterval(A,15e3);const G=await t.contextKey();D||(T=new EventSource(t.url("/stream",{context:G,...r?{location:"1"}:{}})),T.onopen=()=>{g("live"),_()},T.addEventListener("context-changed",()=>window.location.reload()),T.addEventListener("activity-deleted",B=>{b(JSON.parse(B.data).coverage),_()}),T.onerror=()=>g("reconnecting"),T.addEventListener("sandboxes",B=>{g("live"),i(JSON.parse(B.data))}),T.addEventListener("log",B=>k([JSON.parse(B.data)])),T.addEventListener("collection",B=>b(JSON.parse(B.data))),T.addEventListener("gateway-health",()=>g("live")),T.addEventListener("gateway-error",()=>g("gateway-down")))}).catch(()=>{D||g("gateway-down")}),()=>{D=!0,T==null||T.close(),clearInterval(M)}},[k,O,A,t,r==null?void 0:r.context]);const R=x.useMemo(()=>({sandboxes:a??(c==null?void 0:c.sandboxes)??null,overview:c,events:f,connection:h,collection:p,historyError:y,activityRevision:N,refresh:()=>{A(),O()}}),[a,c,f,h,p,y,N,A,O]);return n.jsx(p4.Provider,{value:R,children:e})}function oi(){const e=x.useContext(p4);if(!e)throw new Error("useLive outside LiveProvider");return e}function qK(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 g4=({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:y=1/0,repeatDelay:w=0,startXOffset:C=0,startYOffset:S=0,endXOffset:N=0,endYOffset:E=0})=>{const k=x.useId(),[A,O]=x.useState(""),[R,T]=x.useState({width:0,height:0}),M=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;T({width:P,height:V});const Y=G.left-H.left+G.width/2+C,W=G.top-H.top+G.height/2+S,q=B.left-H.left+B.width/2+N,ee=B.top-H.top+B.height/2+E,z=W-i,L=`M ${Y},${W} Q ${(Y+q)/2},${z} ${q},${ee}`;O(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:R.width,height:R.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 ${R.width} ${R.height}`,children:[n.jsx("path",{d:A,stroke:m,strokeWidth:h,strokeOpacity:g,strokeLinecap:"round"}),n.jsx("path",{d:A,strokeWidth:h,stroke:`url(#${k})`,strokeOpacity:"1",strokeLinecap:"round"}),n.jsx("defs",{children:n.jsxs($n.linearGradient,{className:"transform-gpu",id:k,gradientUnits:"userSpaceOnUse",initial:{x1:"0%",x2:"0%",y1:"0%",y2:"0%"},animate:{x1:M.x1,x2:M.x2,y1:M.y1,y2:M.y2},transition:{delay:f,duration:u,ease:[.16,1,.3,1],repeat:y,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 mR={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:AL,tone:"text-destructive",title:e=>`Couldn’t connect to ${e.host}`}};function zj({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),[y,w]=x.useState(null),[C,S]=x.useState(null),[N,E]=x.useState(!1),[k,A]=x.useState(null),[O,R]=x.useState(null),[T,M]=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,ln.finishFlow(G.current,"connected"),e(F))},[e]);x.useEffect(()=>{!p||!G.current||(p.status==="needs-docker"?ln.step(G.current,"needs_docker","blocked","docker_missing"):p.status==="needs-install"?ln.step(G.current,"needs_runtime","blocked","runtime_missing"):p.status==="failed"&&ln.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,K=++D.current,se=setTimeout(()=>F.abort(new Error("Reading hosts timed out. Try refreshing.")),1e4);return E(!0),A(null),R(null),cs.connections(F.signal).then(ne=>{if(D.current!==K)return;u(ne);const{host:ve,job:ae}=qK(ne,r,_.current);b(ae),ae&&m(ae.runtimeInstallation||"download"),g(ve)}).catch(ne=>{D.current===K&&ne.name!=="AbortError"&&A(ne.message)}).finally(()=>{clearTimeout(se),D.current===K&&E(!1)}),()=>{F.abort(),clearTimeout(se),D.current+=1}},[T,r]),x.useEffect(()=>{if((p==null?void 0:p.status)!=="working"||O||C)return;const F=new AbortController;let K;async function se(){try{const ne=await cs.connectionJob(p.id,F.signal);if(F.signal.aborted)return;b(ne),ne.status==="ready"?P(ne):ne.status==="working"&&(K=setTimeout(se,1e3))}catch(ne){F.signal.aborted||R(ne.message)}}return K=setTimeout(se,500),()=>{F.abort(),clearTimeout(K)}},[p==null?void 0:p.id,p==null?void 0:p.status,O,C,P]);async function V(F,K){var se;(F==="connect"||((se=G.current)==null?void 0:se.outcome)==="failed")&&(G.current=ln.startFlow("gateway_connection",{location_type:"ssh"},G.current)),S(F),A(null),R(null);try{const ne=await K();b(ne),ne.status==="ready"&&P(ne)}catch(ne){ln.finishFlow(G.current,"failed",Cu(ne)),A(ne.message)}finally{S(null)}}const Y=(c==null?void 0:c.hosts)??[],W=Y.find(F=>F.name===h),q=!!C||(p==null?void 0:p.status)==="working",ee=(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&&mR[p.status]?mR[p.status]:null,X=()=>M(F=>F+1),te=!!(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(KK,{host:(W==null?void 0:W.label)??(h||"Your server"),live:(p==null?void 0:p.status)==="working"||te})}),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:q||!Y.length,onChange:F=>{_.current=F.target.value,g(F.target.value),b(null),w(null),A(null),R(null)},children:[n.jsx("option",{value:"",disabled:!0,children:Y.length?"Choose a host":"No hosts in ~/.ssh/config"}),!!h&&!W&&n.jsxs("option",{value:h,disabled:!0,children:[h," · Missing from SSH config"]}),Y.map(F=>n.jsx("option",{value:F.name,children:F.label??F.name},F.name))]}),n.jsx(ie,{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."]}),te?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&&!te&&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(YK,{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,K])=>n.jsx("button",{type:"button",role:"radio","aria-checked":f===F,disabled:q||ee,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:K},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(ie,{type:"button",size:"sm",className:"justify-self-start",disabled:q,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(ie,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:q,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(ie,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:q,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(Mt,{"aria-label":"Docker-save package (.tar)",type:"file",accept:".tar,application/x-tar",className:"h-8 flex-1 text-xs",disabled:q,onChange:F=>{var K;w(((K=F.target.files)==null?void 0:K[0])??null),A(null)}}),n.jsx(ie,{type:"button",variant:"outline",size:"sm",disabled:q||!(y!=null&&y.name.toLowerCase().endsWith(".tar")),onClick:()=>V("upload",()=>cs.uploadConnectionPackage(p.id,y)),children:C==="upload"?"Uploading…":"Upload"})]}),y&&!y.name.toLowerCase().endsWith(".tar")&&n.jsx(tp,{children:"Choose an uncompressed .tar archive."})]})]}),(k||L&&p.error)&&n.jsx(tp,{children:k||p.error}),O&&n.jsxs(tp,{children:["Lost track of progress: ",O," 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(ie,{type:"button",variant:"ghost",className:"mr-auto",disabled:!!C,onClick:t,children:"Back"}),te?n.jsxs(ie,{type:"button",onClick:i,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:["Continue with ",a]}):n.jsx(ie,{type:"button",disabled:q||!W||z||ee,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 YK({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(Mu,{className:"size-3.5"}),"Requirements & safety",n.jsx(ma,{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 KK({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(g4,{containerRef:r,fromRef:a,toRef:i,duration:t?2.5:5,pathOpacity:.25,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})}function XK({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,y]=x.useState({width:0,height:0});x.useEffect(()=>{const C=()=>{if(p.current){const{width:S,height:N}=p.current.getBoundingClientRect();y({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 Ij({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 x4({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?ef(e):"This computer"}),n.jsx(ie,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-full px-2 text-[11px]",onClick:t,children:"Change"})]})}const ef=e=>{var t;return((t=e==null?void 0:e.label)==null?void 0:t.replace(/^SSH · /,""))??(e==null?void 0:e.gateway)};function hR({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 b4({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 WK({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(XK,{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(hR,{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(hR,{live:t})}),n.jsx("span",{ref:i,className:"relative z-10 transition-transform duration-500 group-hover:translate-x-1",children:n.jsx(b4,{live:t})}),n.jsx(g4,{containerRef:r,fromRef:a,toRef:i,duration:t?2.5:4,pathOpacity:.3,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})]})}function ev({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(WK,{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 Mx({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),[y,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,k]=x.useState(null),[A,O]=x.useState(!1),[R,T]=x.useState(!1),[M,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&&(k(L.locals),O(((X=L.tools)==null?void 0:X.openshell)===!1))}).catch(()=>{z&&k([])}),()=>{z=!1}},[H,t]);async function Y(){T(!0),D(null);try{const z=await pB(cs,E[0].name);a(z)}catch(z){D(z.message),T(!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]}},q=H?H.connected?"Local gateway":"Disconnected":E!=null&&E.length?`Use ${E[0].name}`:E?A?"OpenShell isn’t installed":"No local gateway running":"Checking…",ee=p?y:_!=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(nn,{className:"gap-3",children:[!["workspace","resource"].includes(u)&&n.jsx(Ij,{step:1,subject:u}),n.jsxs("div",{className:"flex items-center gap-2",children:[h==="remote"&&n.jsx(ie,{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(Rn,{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(ev,{index:0,scene:"local",live:H==null?void 0:H.connected,title:"This computer",caption:q,tone:H!=null&&H.connected?"live":"idle",disabled:H?!H.connected:!(E!=null&&E.length)||R,onClick:()=>H?r(H.id??H.context):Y(),trailing:R&&n.jsx(Ql,{className:"size-4 animate-spin text-muted-foreground"})}),t&&n.jsx(ev,{index:1,scene:"remote",live:G==null?void 0:G.connected,title:"Remote machine",caption:G!=null&&G.connected?`Connected · ${ef(G)}`:G?`${ef(G)} · Disconnected`:"Your server, over SSH",tone:G!=null&&G.connected?"live":G?"warn":"idle",onClick:()=>g("remote")}),(t||_)&&n.jsx(ev,{index:2,scene:"cloud",title:"OpenRod Cloud",caption:ee,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:y==="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(ie,{variant:"ghost",size:"sm",onClick:V,children:"Cancel"})]}),M&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:M}),n.jsx("div",{className:"mt-3 flex justify-end",children:n.jsx(ie,{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(zj,{initialHost:G?ef(G):void 0,connectedHost:G!=null&&G.connected?ef(G):null,onUseConnected:()=>r(G.id??G.context),onConnected:a,onBack:()=>g("choose")})},"remote")})})]})}function QK(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=yo(),i=js(),[c,u]=x.useState(null),[f,m]=x.useState(null);x.useEffect(()=>{if(!f)return;const b=a.locations.find(y=>y.target==="local"&&y.gateway===f&&y.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?QK(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(en,{open:!0,onOpenChange:b=>{b||t()},children:n.jsx(tn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:n.jsx(Mx,{locations:a.locations,allowRemote:!!(i!=null&&i.localViewer),subject:r,connecting:!!f,onPick:b=>u(a.locations.find(y=>(y.id??y.context)===b&&y.connected)),onConnected:b=>{m(b.gateway),a.refresh()},onCancel:t})})})}function Rf({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=Tj(r==="down"?e:t),g=DY(h,{damping:60,stiffness:100}),p=s4(f,{once:!0,margin:"0px"}),b=x.useCallback(y=>Intl.NumberFormat("en-US",{minimumFractionDigits:c,maximumFractionDigits:c}).format(Number(y.toFixed(c))),[c]);return x.useEffect(()=>{if(!p)return;const y=setTimeout(()=>h.set(r==="down"?t:e),a*1e3);return()=>clearTimeout(y)},[h,p,a,e,r,t]),x.useEffect(()=>g.on("change",y=>{f.current&&!m&&(f.current.textContent=b(y))}),[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 v4(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 w4(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 ZK=e=>new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function j4({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 O=i.current;if(!O)return;const R=()=>m(O.clientWidth);R();const T=new ResizeObserver(R);return T.observe(O),()=>T.disconnect()},[]);const p=Math.max(4,Math.round(t*.18)),b=e.map(O=>O.allowed+O.denied),y=Math.max(1,...b),w=O=>(e.length<2?f-12:O/(e.length-1)*(f-12))+6,C=O=>t-p-O/y*(t-p*2),S=b.map((O,R)=>[w(R),C(O)]),N=v4(S),E=`${N} L${w(e.length-1).toFixed(2)} ${t} L${w(0).toFixed(2)} ${t} Z`,k=h===null?null:e[h],A=O=>e.reduce((R,T)=>R+T[O],0);return n.jsxs("div",{className:"relative w-full",onMouseLeave:()=>g(null),onMouseMove:O=>{const R=O.currentTarget.getBoundingClientRect(),T=(O.clientX-R.left)/Math.max(1,R.width);g(Math.min(e.length-1,Math.max(0,Math.round(T*(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:k?n.jsxs("span",{className:"font-mono normal-case tracking-normal text-muted-foreground",children:[ZK(k.at)," · ",k.allowed," allowed",k.denied?n.jsxs("span",{className:"text-red-600",children:[" · ",k.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":`${A("allowed")} allowed and ${A("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((O,R)=>O.denied?n.jsx("circle",{cx:w(R),cy:t-2,r:"1.75",fill:"var(--status-error)",opacity:h===R?1:.75},O.at):null),k&&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 vo({value:e,onValueChange:t,className:r,ref:a,...i}){return n.jsxs("div",{className:Ve("relative",r),children:[n.jsx(R$,{"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(Mt,{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(q5,{"data-slot":"sheet",...e})}function JK({...e}){return n.jsx($w,{"data-slot":"sheet-portal",...e})}function eX({className:e,...t}){return n.jsx(lw,{"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(JK,{children:[n.jsx(eX,{}),n.jsxs(Lw,{"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(ie,{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(Bw,{"data-slot":"sheet-title",className:Ve("font-heading text-base font-medium text-foreground",e),...t})}function da({className:e,...t}){return n.jsx(cw,{"data-slot":"sheet-description",className:Ve("text-sm text-muted-foreground",e),...t})}function tX(e){return G5("alert-dialog",e)}function Fr({...e}){return n.jsx(tX,{"data-slot":"alert-dialog",...e})}function nX({...e}){return n.jsx($w,{"data-slot":"alert-dialog-portal",...e})}function sX({className:e,...t}){return n.jsx(lw,{"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(nX,{children:[n.jsx(sX,{}),n.jsx(Lw,{"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(Bw,{"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(cw,{"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(ie,{"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(ie,{variant:t,size:r}),...a})}const S4=x.createContext(void 0);function zx(e){const t=x.useContext(S4);if(t===void 0&&!e)throw new Error(sn(33));return t}const N4=x.createContext(void 0);function ll(e){const t=x.useContext(N4);if(t===void 0&&!e)throw new Error(sn(36));return t}const rX=x.createContext(void 0);function Pj(e=!0){const t=x.useContext(rX);if(t===void 0&&!e)throw new Error(sn(25));return t}const C4=x.createContext(void 0);function oX(){const e=x.useContext(C4);if(e===void 0)throw new Error(sn(30));return e}function aX(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=Pj(!0),b=p!==void 0;return x.useMemo(()=>({id:a,role:"menuitem",tabIndex:g&&r?0:-1,onKeyDown(y){y.key===" "&&(u!=null&&u.current)&&y.preventDefault()},onMouseMove(y){i&&h.emit("itemhover",{nodeId:i,target:y.currentTarget})},onClick(y){t&&h.emit("close",{domEvent:y,reason:Zl})},onMouseUp(y){if(p){const w=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,b&&w&&Math.abs(y.clientX-w.x)<=1&&Math.abs(y.clientY-w.y)<=1||b&&!uw&&y.button===2)return}f.current&&c.context.allowMouseUpTriggerRef.current&&(!b||y.button===2)&&m.type==="regular-item"&&mu(f.current,y,{detail:1})}}),[t,r,a,h,i,g,c,u,f,p,b,m])}const _j={type:"regular-item"};function Lj(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}),y=aX({closeOnClick:t,highlighted:a,id:i,nodeId:h,store:c,typingRef:u,itemRef:g,itemMetadata:m}),w=x.useCallback(S=>Qs(y,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},S,p),[y,p,m]),C=ho(g,b);return x.useMemo(()=>({getItemProps:w,itemRef:C}),[w,C])}const iX="data-checked",lX="data-unchecked",Ix={checked(e){return e?{[iX]:""}:{[lX]:""}},...si},cX=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:y,...w}=t,C=pc({guess:!0,label:u}),S=zx(!0),N=vs(c),{store:E}=ll(),k=E.useState("disabled"),A=m||k,O=E.useState("isActive",C.index),R=E.useState("itemProps"),[T,M]=po({controlled:g,default:p??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:D,itemRef:_}=Lj({closeOnClick:h,disabled:A,highlighted:O,id:N,store:E,nativeButton:f,nodeId:S==null?void 0:S.context.nodeId,itemMetadata:_j}),H=x.useMemo(()=>({disabled:A,highlighted:O,checked:T}),[A,O,T]);function G(P){const V=vt(Zl,P.nativeEvent,void 0,{preventUnmountOnClose:Ln});b==null||b(!T,V),!V.isCanceled&&M(Y=>!Y)}const B=Nt("div",t,{state:H,stateAttributesMapping:Ix,props:[R,{role:"menuitemcheckbox","aria-checked":T,onClick:G},w,D],ref:[_,r,C.ref]});return n.jsx(C4.Provider,{value:H,children:B})}),uX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,keepMounted:u=!1,...f}=t,m=oX(),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 y={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return Nt("span",t,{state:y,ref:[r,h],stateAttributesMapping:Ix,props:{"aria-hidden":!0,...f},enabled:u||p})}),$j=x.createContext(void 0);function dX(){const e=x.useContext($j);if(e===void 0)throw new Error(sn(31));return e}const fX=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($j.Provider,{value:m,children:h})}),mX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,id:u,...f}=t,m=vs(u),h=dX();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}})}),hX=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}),y=zx(!0),w=vs(c),{store:C}=ll(),S=C.useState("disabled"),N=m||S,E=C.useState("isActive",b.index),k=C.useState("itemProps"),{getItemProps:A,itemRef:O}=Lj({closeOnClick:h,disabled:N,highlighted:E,id:w,store:C,nativeButton:f,nodeId:y==null?void 0:y.context.nodeId,itemMetadata:_j});return Nt("div",t,{state:{disabled:N,highlighted:E},props:[k,p,A],ref:[O,r,b.ref]})}),pX=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=yx()!=null,b=m.useState("open"),y=m.useState("transitionStatus"),w=m.useState("popupProps"),C=m.useState("mounted"),S=m.useState("instantType"),N=m.useState("activeTriggerElement"),E=m.useState("parent"),k=m.useState("lastOpenChangeReason"),A=m.useState("rootId"),O=m.useState("floatingRootContext"),R=m.useState("floatingTreeRoot"),T=m.useState("closeDelay"),M=m.useState("hoverEnabled"),D=m.useState("disabled"),_=m.useState("openMethod"),H=E.type==="context-menu";Sr({open:b,ref:m.context.popupRef,onComplete(){var Y,W;b&&((W=(Y=m.context).onOpenChangeComplete)==null||W.call(Y,!0))}}),x.useEffect(()=>{function Y(W){m.setOpen(!1,vt(W.reason,W.domEvent))}return R.events.on("close",Y),()=>{R.events.off("close",Y)}},[R.events,m]),Iw(O,{enabled:M&&!D&&!H&&E.type!=="menubar",closeDelay:T});const G=m.useStateSetter("popupElement"),B={transitionStatus:y,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(Y){p&&Zf.has(Y.key)&&Y.stopPropagation()}},tm(y),f,{"data-rootownerid":A}]});let V=E.type===void 0||H;return(N||E.type==="menubar"&&k!==Vg)&&(V=!0),n.jsx(Jg,{context:O,openInteractionType:_,modal:H,disabled:!C,returnFocus:u===void 0?V:u,initialFocus:E.type!=="menu",restoreFocus:!0,externalTree:E.type!=="menubar"?R: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})}),k4=x.createContext(void 0);function gX(){const e=x.useContext(k4);if(e===void 0)throw new Error(sn(32));return e}const xX=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(k4.Provider,{value:a,children:n.jsx(Zg,{ref:r,...i,portalOwnerRole:h})})}),bX=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:y=5,sticky:w=!1,disableAnchorTracking:C=!1,collisionAvoidance:S=g5,style:N,...E}=t,{store:k}=ll(),A=gX(),O=Pj(!0),R=k.useState("parent"),T=k.useState("floatingRootContext"),M=k.useState("floatingTreeRoot"),D=k.useState("mounted"),_=k.useState("open"),H=k.useState("modal"),G=k.useState("openMethod"),B=k.useState("activeTriggerElement"),P=k.useState("transitionStatus"),V=k.useState("positionerElement"),Y=k.useState("instantType"),W=k.useState("adaptiveOrigin"),q=k.useState("lastOpenChangeReason"),ee=k.useState("floatingNodeId"),z=k.useState("floatingParentNodeId"),L=T.useState("domReferenceElement"),X=x.useRef(null),te=Gf(V);let $=a,U=h,F=g,K=m,se=S;R.type==="context-menu"&&($=a??((Ie=R.context)==null?void 0:Ie.anchor),K=K??"start",!f&&K!=="center"&&(F=t.alignOffset??2,U=t.sideOffset??-5));let ne=f,ve=K;R.type==="menu"?(ne=ne??"inline-end",ve=ve??"start",se=t.collisionAvoidance??yw):R.type==="menubar"&&(ne=ne??(R.context.orientation==="vertical"?"inline-end":"bottom"),ve=ve??"start");const ae=R.type==="context-menu",le=xx({anchor:$,floatingRootContext:T,positionMethod:O?"fixed":i,mounted:D,side:ne,sideOffset:U,align:ve,alignOffset:F,arrowPadding:ae?0:y,collisionBoundary:p,collisionPadding:b,sticky:w,nodeId:ee,keepMounted:A,disableAnchorTracking:C,collisionAvoidance:se,shift:ae?{crossAxis:!("side"in se&&se.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:M,adaptiveOrigin:W});x.useEffect(()=>{function de(Te){Te.open&&(Te.parentNodeId===ee&&k.set("hoverEnabled",!1),Te.nodeId!==ee&&Te.parentNodeId===k.select("floatingParentNodeId")&&k.setOpen(!1,vt(Kd)))}return M.events.on("menuopenchange",de),()=>{M.events.off("menuopenchange",de)}},[k,M.events,ee]),x.useEffect(()=>{if(k.select("floatingParentNodeId")==null)return;function de(Te){if(Te.open||Te.nodeId!==k.select("floatingParentNodeId"))return;const oe=Te.reason??Kd;k.setOpen(!1,vt(oe))}return M.events.on("menuopenchange",de),()=>{M.events.off("menuopenchange",de)}},[M.events,k]);const re=us();x.useEffect(()=>{_||re.clear()},[_,re]),x.useEffect(()=>{function de(Te){if(!(!_||Te.nodeId!==k.select("floatingParentNodeId")))if(Te.target&&B&&B!==Te.target){const oe=k.select("closeDelay");oe>0?re.isStarted()||re.start(oe,()=>{k.setOpen(!1,vt(Kd))}):k.setOpen(!1,vt(Kd))}else re.clear()}return M.events.on("itemhover",de),()=>{M.events.off("itemhover",de)}},[M.events,_,B,k,re]),x.useEffect(()=>{const de={open:_,nodeId:ee,parentNodeId:z,reason:k.select("lastOpenChangeReason")};M.events.emit("menuopenchange",de)},[M.events,_,k,ee,z]),We(()=>{const de=L,Te=X.current;if(de&&(X.current=de),Te&&de&&de!==Te){k.set("instantType",void 0);const oe=new AbortController;return te(()=>{k.set("instantType","trigger-change")},oe.signal),()=>{oe.abort()}}},[L,te,k]);const Q={open:_,side:le.side,align:le.align,anchorHidden:le.anchorHidden,nested:R.type==="menu",instant:Y},Z=R.type==="menubar"&&R.context.modal;Hw(_&&(Z||H&&q!==Qn),G==="touch",V,B);const ue=bx(t,Q,{styles:le.positionerStyles,transitionStatus:P,props:E,refs:[r,k.useStateSetter("positionerElement")],hidden:!D,inert:!_}),ye=D&&R.type!=="menu"&&(R.type!=="menubar"&&H&&q!==Qn||R.type==="menubar"&&R.context.modal);let Ce=null;return R.type==="menubar"?Ce=R.context.contentElement:R.type===void 0&&(Ce=B),n.jsxs(S4.Provider,{value:le,children:[ye&&n.jsx(cx,{ref:R.type==="context-menu"||R.type==="nested-context-menu"?R.context.internalBackdropRef:null,inert:Jf(!_),cutout:Ce}),n.jsx(S5,{id:ee,children:n.jsx(em,{elementsRef:k.context.itemDomElements,labelsRef:k.context.itemLabels,children:ue})})]})}),T4=x.createContext(void 0);function yX(){const e=x.useContext(T4);if(e===void 0)throw new Error(sn(34));return e}const vX=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,y]=x.useState(void 0),[w,C]=po({controlled:c,default:u,name:"MenuRadioGroup"}),S=st((A,O)=>{f==null||f(A,O),!O.isCanceled&&C(A)}),E=Nt("div",t,{state:{disabled:m},ref:r,props:{role:"group","aria-labelledby":g??b,"aria-disabled":m||void 0,...p}}),k=x.useMemo(()=>({value:w,setValue:S,disabled:m}),[w,S,m]);return n.jsx($j.Provider,{value:y,children:n.jsx(T4.Provider,{value:k,children:E})})})),E4=x.createContext(void 0);function wX(){const e=x.useContext(E4);if(e===void 0)throw new Error(sn(35));return e}const jX=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,y=pc({guess:!0,label:u}),w=zx(!0),C=vs(c),{store:S}=ll(),N=S.useState("isActive",y.index),E=S.useState("itemProps"),{value:k,setValue:A,disabled:O}=yX(),R=S.useState("disabled"),T=m||O||R,M=k===g,{getItemProps:D,itemRef:_}=Lj({closeOnClick:h,disabled:T,highlighted:N,id:C,store:S,nativeButton:f,nodeId:w==null?void 0:w.context.nodeId,itemMetadata:_j}),H=x.useMemo(()=>({disabled:T,highlighted:N,checked:M}),[T,N,M]);function G(P){const V=vt(Zl,P.nativeEvent,void 0,{preventUnmountOnClose:Ln});A(g,V)}const B=Nt("div",t,{state:H,stateAttributesMapping:Ix,props:[E,{role:"menuitemradio","aria-checked":M,onClick:G},b,D],ref:[_,r,y.ref]});return n.jsx(E4.Provider,{value:H,children:B})}),SX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,keepMounted:u=!1,...f}=t,m=wX(),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 y={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return Nt("span",t,{state:y,stateAttributesMapping:Ix,ref:[r,h],props:{"aria-hidden":!0,...f},enabled:u||p})}),NX=x.createContext(null);function R4(e){return x.useContext(NX)}const CX={...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 kX extends Pu{constructor(r,a,i=!1){const c=new Qf,u=EX(c,a,i,r);super(u,TX(c),CX);an(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"),y=f.store.select("floatingTreeRoot"),w=f.store.select("keyboardEventRelay");h===b&&g===y&&p===w||(h=b,g=y,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 TX(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 EX(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 vw,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Tn,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...a}}const RX=x.createContext(void 0);function AX(){return x.useContext(RX)}const OX=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:y,triggerId:w,defaultTriggerId:C=null,highlightItemOnHover:S=!0}=t,N=Pj(!0),E=ll(!0),k=R4(!0),A=AX(),O=x.useMemo(()=>A&&E?{type:"menu",store:E.store}:k?{type:"menubar",context:k}:N&&!E?{type:"context-menu",context:N}:{type:void 0},[N,E,k,A]),R=sc(),T=sc(),M=ol(),D=O.type==="menu"?O.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=MX({open:u,openProp:a,activeTriggerId:C,triggerIdProp:w,parent:O,disabled:f,highlightItemOnHover:S,modal:O.type===void 0?m:void 0,rootId:R,instantType:H},T,M!=null);G.useControlledProp("openProp",a),G.useControlledProp("triggerIdProp",w),G.useContextCallback("onOpenChangeComplete",c);const B=G.useState("floatingTreeRoot"),P=ww(B),V=G.useState("open"),Y=G.useState("activeTriggerElement"),W=G.useState("positionerElement"),q=G.useState("hoverEnabled"),ee=G.useState("disabled"),z=G.useState("lastOpenChangeReason"),L=G.useState("parent"),X=G.useState("activeIndex"),te=G.useState("payload"),$=G.useState("floatingParentNodeId"),U=x.useRef(null),F=x.useRef(L.type!=="context-menu"),K=us(),se=x.useRef(!0),ne=us(),ve=$!=null,{openMethod:ae,triggerProps:le}=K5(V);G.useSyncedValues({disabled:f,highlightItemOnHover:S,modal:L.type===void 0?m:void 0,openMethod:ae,rootId:R}),sx(G);const{forceUnmount:re,transitionStatus:Q}=rx(V,G,()=>{G.set("allowMouseEnter",!1)},_),Z=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 Z(_e,Xe.signal),()=>{Xe.abort()}},[H,V,Q,Z,G]),We(()=>{N&&!E?G.update({parent:{type:"context-menu",context:N},floatingNodeId:P,floatingParentNodeId:M}):E&&G.update({floatingNodeId:P,floatingParentNodeId:M})},[N,E,P,M,G]),x.useEffect(()=>{if(V||(U.current=null),L.type==="context-menu"){if(!V){K.clear(),F.current=!1;return}K.start(500,()=>{F.current=!0})}},[K,V,L.type]),We(()=>{!V&&!q&&G.set("hoverEnabled",!0)},[V,q,G]);const pe=st((_e,Xe)=>{const Je=Xe.reason;if(!_e&&!G.select("open")||V===_e&&Xe.trigger===Y&&z===Je)return;const ct=Rw(Xe);if(!_e&&Xe.trigger==null&&(Xe.trigger=Y??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"&&!se.current)return;_e&&Je===gu?(se.current=!1,ne.start(300,()=>{se.current=!0})):(se.current=!0,ne.clear());const rt=(Je===ha||Je===Zl)&&At.detail===0,be=!_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===Tv||Je===Kd)?Ue.instantType="group":rt||be?Ue.instantType=rt?"click":"dismiss":Ue.instantType=void 0,G.update(Ue)}),ue=I5({popupStore:G,floatingRootContext:G.state.floatingRootContext,floatingId:T,nested:M!=null,onOpenChange:pe}),ye=ue.context.events;We(()=>{const _e=({open:Xe,eventDetails:Je})=>pe(Xe,Je);return ye.on("setOpen",_e),()=>{ye==null||ye.off("setOpen",_e)}},[ye,pe]);const Ce=x.useCallback(()=>{G.setOpen(!1,vt(Ug))},[G]);x.useImperativeHandle(p,()=>({unmount:re,close:Ce}),[re,Ce]);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:pe}),[pe]);const de=Kf(ue,{enabled:!ee,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:ve?B:void 0}),Te=gx(),oe=x.useCallback(_e=>{G.select("activeIndex")!==_e&&G.set("activeIndex",_e)},[G]),fe=V5(ue,{enabled:!ee,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:oe,openOnArrowKeyDown:L.type!=="context-menu",externalTree:ve?B:void 0,focusItemOnHover:S}),Re=x.useCallback(_e=>{G.context.typingRef.current=_e},[G]),Me=U5(ue,{enabled:!ee,listRef:G.context.itemLabels,elementsRef:G.context.itemDomElements,activeIndex:X,resetMs:B8,onMatch:_e=>{V&&_e!==X&&G.set("activeIndex",_e)},onTyping:Re}),ke=x.useMemo(()=>{const _e=Qs(Me.reference,fe.reference,de.reference,{onMouseMove(){G.set("allowMouseEnter",!0)}},le);return _e["aria-haspopup"]="menu",_e["aria-expanded"]=V,_e},[G,Me.reference,fe.reference,de.reference,le,V]),me=x.useMemo(()=>{const _e=Qs(fe.trigger,de.trigger,le);return _e["aria-haspopup"]="menu",_e["aria-expanded"]=!1,_e},[fe.trigger,de.trigger,le]);bs(()=>(G.update({inactiveTriggerProps:me}),null));const Ae=x.useMemo(()=>Qs(Wf,{id:T,role:"menu","aria-orientation":g==="horizontal"?"horizontal":void 0,"aria-labelledby":Y==null?void 0:Y.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)}},Me.floating,fe.floating,de.floating),[Y,T,g,L.type,G,Me.floating,fe.floating,de.floating]),ge=fe.item??Tn;ox(G,{floatingRootContext:ue,activeTriggerProps:ke,inactiveTriggerProps:me,popupProps:Ae,itemProps:ge});const Pe=x.useMemo(()=>({store:G,parent:O}),[G,O]),Fe=n.jsxs(N4.Provider,{value:Pe,children:[y&&n.jsx(tx,{handle:y,store:G}),typeof r=="function"?r({payload:te}):r]});return L.type===void 0||L.type==="context-menu"?n.jsx(N5,{externalTree:B,children:Fe}):Fe});function MX(e,t,r){return bs(()=>new kX(e,t,r)).current}function A4(e){const{render:t,className:r,style:a,state:i=Tn,props:c=Vr,refs:u=Vr,metadata:f,stateAttributesMapping:m,tag:h="div",...g}=e,{compositeProps:p,compositeRef:b}=gM({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 M4(e,t){const r=x.useRef(null);function a(c){go.flushSync(()=>{e.setOpen(!1,vt(Ji,c.nativeEvent,c.currentTarget))});const u=P8(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,vt(Ji,c.nativeEvent,c.currentTarget))});let m=I8(e.context.triggerFocusTargetRef.current||t.current);for(;m!==null&>(u,m);){const h=m;if(m=bw(m),m===h)break}m==null||m.focus()}}return{preFocusGuardRef:r,handlePreFocusGuardFocus:a,handleFocusTargetFocus:i}}function DX(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())}}:Tn,[t,r,a])}const zX=kw(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:y,...w}=t,C=ll(!0),N=Mw(b)??(C==null?void 0:C.store);if(!N)throw new Error(sn(85));const E=vs(m),k=N.useState("isTriggerActive",E),A=N.useState("floatingRootContext"),O=N.useState("isOpenedByTrigger",E),R=N.useState("triggerPopupId",E),T=x.useRef(null),M=PX(),D=Dg(!0),_=al(),H=x.useMemo(()=>_??new vw,[_]),G=ww(H),B=ol(),{registerTrigger:P,isMountedByThisTrigger:V}=Aw(E,T,N,{payload:y,closeDelay:p,parent:M,floatingTreeRoot:H,floatingNodeId:G,floatingParentNodeId:B,keyboardEventRelay:D==null?void 0:D.relayKeyboardEvent}),Y=M.type==="menubar",W=N.useState("disabled"),q=u||W||Y&&M.context.disabled,{getButtonProps:ee,buttonRef:z}=bo({disabled:q,native:f});x.useEffect(()=>{!O&&M.type===void 0&&(N.context.allowMouseUpTriggerRef.current=!1)},[N,O,M.type]);const L=x.useRef(null),X=us(),te=st(Ie=>{if(!L.current)return;X.clear(),N.context.allowMouseUpTriggerRef.current=!1;const de=Ie.target;gt(L.current,de)||gt(N.select("positionerElement"),de)||de===L.current||de!=null&&O4(de)===N.select("rootId")||iM(Ie,L.current)||H.events.emit("close",{domEvent:Ie,reason:YO})});x.useEffect(()=>{O&&N.select("lastOpenChangeReason")===Qn&&Ht(L.current).addEventListener("mouseup",te,{once:!0})},[O,te,N]);const $=Y&&M.context.hasSubmenuOpen,F=Pw(A,{enabled:(h??$)&&!q&&(!Y||$&&!V),handleClose:_w({blockPointerEvents:!Y}),mouseOnly:!0,move:!1,restMs:M.type===void 0?g:void 0,delay:{close:p},triggerElementRef:T,externalTree:H,isActiveTrigger:k,isClosing:()=>N.select("transitionStatus")==="ending"}),K=IX(O,N.select("lastOpenChangeReason")),se=Sw(A,{enabled:!q,event:O&&Y?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:M.type===void 0?K:!1}),ne=$5(A,{enabled:!q&&$}),ve=DX({open:O,enabled:Y,mouseDownAction:"open"}),ae=x.useMemo(()=>Qs(ne.reference,se.reference),[ne.reference,se.reference]),le=N.useState("triggerProps",V),{preFocusGuardRef:re,handlePreFocusGuardFocus:Q,handleFocusTargetFocus:Z}=M4(N,T),pe={disabled:q,open:O},ue=[L,r,z,P,T],ye=[ae,F??Tn,le,{"aria-haspopup":"menu","aria-controls":R,id:E,onMouseDown:Ie=>{if(N.select("open"))return;X.start(200,()=>{N.context.allowMouseUpTriggerRef.current=!0}),Ht(Ie.currentTarget).addEventListener("mouseup",te,{once:!0})}},Y?{role:"menuitem"}:{},ve,w,ee],Ce=Nt("button",t,{enabled:!Y,stateAttributesMapping:Xp,state:pe,ref:ue,props:ye});return Y?n.jsx(A4,{tag:"button",render:a,className:i,style:c,state:pe,refs:ue,props:ye,stateAttributesMapping:Xp}):O?n.jsxs(x.Fragment,{children:[n.jsx(el,{ref:re,onFocus:Q},`${E}-pre-focus-guard`),n.jsx(x.Fragment,{children:Ce},E),n.jsx(el,{ref:N.context.triggerFocusTargetRef,onFocus:Z},`${E}-post-focus-guard`)]}):n.jsx(x.Fragment,{children:Ce},E)});function IX(e,t){const r=us(),[a,i]=x.useState(!1);return We(()=>{e&&t===Qn?(i(!0),r.start(h5,()=>{i(!1)})):e||(r.clear(),i(!1))},[e,t,r]),a}function PX(){const e=R4();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(OX,{"data-slot":"dropdown-menu",...e})}function Gi({...e}){return n.jsx(zX,{"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(xX,{children:n.jsx(bX,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:r,sideOffset:a,render:c,children:n.jsx(pX,{"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(fX,{"data-slot":"dropdown-menu-group",...e})}function C1({className:e,inset:t,...r}){return n.jsx(mX,{"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(hX,{"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 Bj({className:e,children:t,checked:r,inset:a,...i}){return n.jsxs(cX,{"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(uX,{children:n.jsx(Yn,{})})}),t]})}function LX({...e}){return n.jsx(vX,{"data-slot":"dropdown-menu-radio-group",...e})}function pR({className:e,children:t,inset:r,...a}){return n.jsxs(jX,{"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(SX,{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 $X=[{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"}],D4=[{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"}],BX=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],Mo=(e={})=>({host:"",ports:"443",protocol:"rest",access:"read-only",allow:[],deny:[],enforcement:"enforce",allowedIps:"",...e}),VX=[{id:"github-api-read",label:"GitHub API · read",rule:{name:"github-api-read",binaries:[],endpoints:[Mo({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:[Mo({host:"github.com"}),Mo({host:"codeload.github.com"})]}},{id:"npm",label:"npm registry",rule:{name:"npm-registry",binaries:["/usr/bin/node","/usr/local/bin/node"],endpoints:[Mo({host:"registry.npmjs.org"})]}},{id:"pypi",label:"PyPI",rule:{name:"pypi",binaries:["/usr/bin/python3*","/usr/local/bin/pip*"],endpoints:[Mo({host:"pypi.org"}),Mo({host:"files.pythonhosted.org"})]}},{id:"huggingface",label:"Hugging Face · downloads",rule:{name:"huggingface",binaries:["/usr/bin/python3*"],endpoints:[Mo({host:"huggingface.co"}),Mo({host:"**.hf.co"})]}}];function tv(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:[Mo()]).map(r=>{var a;return Mo({...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 UX(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 HX(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=D4.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:BX.map(c=>n.jsx("option",{children:c},c))}),n.jsx(Mt,{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(ie,{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(ys,{className:"size-3"}),r==="deny"?"Block request":"Allow request"]})]})}function FX({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(()=>tv(r)),[g,p]=x.useState(""),[b,y]=x.useState(!1),[w,C]=x.useState(null);x.useEffect(()=>{e&&(h(tv(r)),C(null),p(""))},[e,r]);const S=(O,R)=>h(T=>({...T,endpoints:T.endpoints.map((M,D)=>D===O?{...M,...R}:M)})),N=O=>{const R=O.trim();R&&!m.binaries.includes(R)&&h(T=>({...T,binaries:[...T.binaries,R]})),p("")},E=UX(m),k=i.filter(O=>!m.binaries.includes(O));async function A(O){O.preventDefault(),y(!0),C(null);try{await a(E),t(!1)}catch(R){C(R.message)}finally{y(!1)}}return n.jsx(en,{open:e,onOpenChange:t,children:n.jsx(tn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:n.jsxs("form",{onSubmit:A,className:"grid gap-5",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:c}),n.jsx(Rn,{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"}),VX.map(O=>n.jsx("button",{type:"button",onClick:()=>h(tv(O.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:O.label},O.id))]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"rule-name",className:"text-xs",children:"Rule name"}),n.jsx(Mt,{id:"rule-name",value:m.name,disabled:f,onChange:O=>h(R=>({...R,name:O.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(O=>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:[O,n.jsx("button",{type:"button","aria-label":`Remove ${O}`,onClick:()=>h(R=>({...R,binaries:R.binaries.filter(T=>T!==O)})),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"})})]},O)),!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(Mt,{value:g,onChange:O=>p(O.target.value),onKeyDown:O=>{O.key==="Enter"&&(O.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(ie,{type:"button",variant:"outline",size:"sm",onClick:()=>N(g),disabled:!g.trim(),children:"Add"})]}),k.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"}),k.slice(0,6).map(O=>n.jsxs("button",{type:"button",onClick:()=>N(O),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:["+ ",O]},O))]})]}),n.jsxs("div",{className:"grid gap-3",children:[n.jsx("span",{className:"text-xs font-medium",children:"Destinations"}),m.endpoints.map((O,R)=>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-${R}`,children:"Host"}),n.jsx(Mt,{id:`host-${R}`,value:O.host,onChange:T=>S(R,{host:T.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-${R}`,children:"Ports"}),n.jsx(Mt,{id:`ports-${R}`,value:O.ports,onChange:T=>S(R,{ports:T.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"443",required:!0})]}),m.endpoints.length>1&&n.jsx(ie,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Remove destination",onClick:()=>h(T=>({...T,endpoints:T.endpoints.filter((M,D)=>D!==R)})),children:n.jsx(ts,{className:"size-3.5"})})]}),n.jsx(Su,{label:"Inspection",options:$X,value:O.protocol,onChange:T=>S(R,{protocol:T})}),O.protocol!=="tcp"&&n.jsxs(n.Fragment,{children:[n.jsx(Su,{label:"Access",options:D4,value:O.access,onChange:T=>S(R,{access:T,allow:T==="custom"&&!O.allow.length?[{method:"GET",path:""}]:O.allow})}),O.access==="custom"&&n.jsx(Sg,{kind:"allow",items:O.allow,onChange:T=>S(R,{allow:T})}),n.jsx(Sg,{kind:"deny",items:O.deny,onChange:T=>S(R,{deny:T})})]}),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:O.enforcement,onChange:T=>S(R,{enforcement:T})})}),O.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(Mt,{value:O.allowedIps,onChange:T=>S(R,{allowedIps:T.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"10.0.5.20/32","aria-label":"Allowed IPs"})})]})]},R)),n.jsxs(ie,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>h(O=>({...O,endpoints:[...O.endpoints,Mo()]})),children:[n.jsx(ys,{}),"Add destination"]})]}),n.jsx("p",{className:"rounded-md border border-border bg-muted/40 px-3 py-2 text-[11px] leading-relaxed",children:HX(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(ie,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(ie,{type:"submit",disabled:b||!m.binaries.length,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[b&&n.jsx(Rt,{"aria-hidden":"true"}),u]})]})]})})})}function Uu({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:[]},z4=[{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"}],GX=[{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}),qX=e=>e.split(`
|
|
519
|
+
`).map(t=>t.trim()).filter(Boolean),Ng=e=>e.split(/[\s,]+/).filter(Boolean),YX=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)}`,KX=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 XX(e,t){return{id:t?YX(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 WX=e=>{var t;return((t=e.setup)==null?void 0:t.name)??"an MCPs & Skills setup"};function cf(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 “${WX(e)}”`]:[]];return a.length?Pp(a):null}function QX(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=cf(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=z4.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 Vj({open:e,onOpenChange:t,initial:r,groups:a=[],sandboxes:i=[],assignments:c={},setupMembers:u={},knownPrograms:f=[],onSaved:m,onGroupCreated:h,sourceControl:g}){var te,$;const p=Pt(),b=!(r!=null&&r.id),[y,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,k]=x.useState(""),[A,O]=x.useState(""),[R,T]=x.useState(!1),[M,D]=x.useState(null),[_,H]=x.useState(!1);x.useEffect(()=>{e&&(w(np(r)),D(null),k(""),O(""),H(!1))},[e,r]);const G=U=>w(F=>({...F,...U})),B=U=>w(F=>({...F,appliesTo:{...F.appliesTo,...U}})),P=((te=y.appliesTo.setups)==null?void 0:te.length)>0,V=!y.appliesTo.everyone&&!y.appliesTo.sandboxes.length&&(P||y.appliesTo.groups.length>0)&&y.appliesTo.groups.every(U=>N.some(F=>F.id===U)),Y=XX(y,b),W=U=>{const F=Ng(U).filter((K,se,ne)=>!y.destinations.includes(K)&&ne.indexOf(K)===se);F.length&&G({destinations:[...y.destinations,...F]}),O("")},q=U=>{const F=U.trim();F&&!y.programs.includes(F)&&G({programs:[...y.programs,F]}),k("")},ee=Object.fromEntries(N.map(U=>[U.id,i.filter(F=>ir({assignments:c},F).includes(U.id)).length])),z=i.filter(U=>Ox(Y,{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}T(!0),D(null);const F=Ng(A).filter(se=>!Y.destinations.includes(se)),K={...Y,destinations:[...Y.destinations,...F]};try{m(await p.savePolicy({...K,isNew:b}),K),t(!1)}catch(se){D(se.message)}finally{T(!1)}}async function X(){T(!0),D(null);try{m({...await p.deletePolicy(r.id),deleted:!0},r),t(!1)}catch(U){D(U.message)}finally{T(!1)}}return n.jsx(en,{open:e,onOpenChange:t,children:n.jsx(tn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:n.jsxs("form",{onSubmit:L,className:"grid gap-5",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:b?"Add network rule":`Edit ${r.name}`}),n.jsx(Rn,{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:R||JSON.stringify(y)!==JSON.stringify(np(r))||!!(A||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"}),GX.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(Mt,{id:"policy-name",value:y.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",($=y.setup)!=null&&$.name?n.jsxs(n.Fragment,{children:[" “",n.jsx("span",{className:"text-foreground",children:y.setup.name}),"”"]}):"",". Groups you pick here also get it."]}),n.jsx(cc,{multiple:!0,required:!P,groups:N,counts:ee,value:y.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:y.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:[y.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:y.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:A,onChange:U=>/[\s,]$/.test(U.target.value)?W(U.target.value):O(U.target.value),onKeyDown:U=>{U.key==="Enter"?(U.preventDefault(),W(A)):U.key==="Backspace"&&!A&&y.destinations.length&&G({destinations:y.destinations.slice(0,-1)})},onBlur:()=>W(A),className:"min-w-32 flex-1 bg-transparent font-mono text-[11px] outline-none placeholder:text-muted-foreground",placeholder:y.destinations.length?"":y.action==="block"?"pastebin.com":"github.com","aria-label":"Destinations"})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:y.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."})]}),y.action==="allow"&&n.jsxs("details",{className:"group rounded-lg border border-border",open:!KX(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(Mt,{id:"policy-ports",value:y.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:z4,value:y.requests,onChange:U=>G({requests:U,allow:U==="custom"&&!y.allow.length?[{method:"GET",path:""}]:y.allow})}),y.requests==="custom"&&n.jsx(Sg,{kind:"allow",items:y.allow,onChange:U=>G({allow:U})}),n.jsx(Sg,{kind:"deny",items:y.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:[y.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:y.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)),!y.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(Mt,{value:E,onChange:U=>k(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),q(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(ie,{type:"button",variant:"outline",size:"sm",onClick:()=>q(E),disabled:!E.trim(),children:"Add"})]}),f.filter(U=>!y.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=>!y.programs.includes(U)).slice(0,6).map(U=>n.jsxs("button",{type:"button",onClick:()=>q(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:y.enforcement,onChange:U=>G({enforcement:U})})}),y.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(Mt,{id:"policy-ips",value:y.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:QX(Y,N)}),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,{className:"sm:justify-between",children:[b?n.jsx("span",{}):_?n.jsxs("span",{className:"grid gap-1.5",children:[y.setup&&n.jsxs("span",{className:"max-w-64 text-[11px] text-muted-foreground",children:["Sandboxes that use “",y.setup.name,"” lose access to these websites. Enabling the setup again asks you to approve them for each sandbox."]}),n.jsx(ie,{type:"button",variant:"destructive",disabled:R,onClick:X,children:"Delete rule"})]}):n.jsx(ie,{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(ie,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(ie,{type:"submit",disabled:R||!V||!y.name.trim()||!y.destinations.length&&!A.trim(),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[R&&n.jsx(Rt,{"aria-hidden":"true"}),b?"Add rule":"Save rule"]})]})]})]})})})}function I4({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:qX(c)})),t(!1)}catch(y){g(y.message)}finally{m(!1)}}return n.jsx(en,{open:e,onOpenChange:t,children:n.jsx(tn,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:p,className:"grid gap-4",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:"Blocked everywhere"}),n.jsx(Rn,{className:"text-xs",children:"Blocked in every sandbox, with their subdomains. No rule can open them."})]}),n.jsx(Uu,{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(ie,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(ie,{type:"submit",disabled:f,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&n.jsx(Rt,{"aria-hidden":"true"}),"Save"]})]})]})})})}function gR({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 P4({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 _4=x.createContext(void 0);function cm(e){const t=x.useContext(_4);if(t===void 0&&!e)throw new Error(sn(72));return t}const ZX={...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 JX extends Pu{constructor(r,a,i){const c=new Qf;super(eW(r,c,a,i),tW(c),ZX);an(this,"setOpen",(r,a)=>{XV(this,r,a,{extraState:{openChangeReason:a.reason}})})}cancelPendingOpen(r){this.state.floatingRootContext.dispatchOpenChange(!1,vt(ha,r))}}function eW(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 tW(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const nW=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:y}=t,w=Ew((H,G)=>new JX({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"),k=w.useState("payload");w.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:c,disabled:r}),sx(w,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:A,transitionStatus:O}=rx(S,w),R=w.useState("isInstantPhase"),T=w.useState("instantType"),M=w.useState("lastOpenChangeReason"),D=x.useRef(null);We(()=>{C&&r&&w.setOpen(!1,vt(KO))},[C,r,w]),We(()=>{O==="ending"&&M===Ur||O!=="ending"&&R?(T!=="delay"&&(D.current=T),w.set("instantType","delay")):D.current!==null&&(w.set("instantType",D.current),D.current=null)},[O,R,M,T,w]),We(()=>{S&&N==null&&w.set("payload",void 0)},[w,N,S]),x.useImperativeHandle(f,()=>({unmount:A,close:()=>w.setOpen(!1,vt(Ug))}),[A,w]);const _=S||E||!r&&u!=="none";return n.jsxs(_4.Provider,{value:w,children:[g&&n.jsx(tx,{handle:g,store:w}),_&&n.jsx(sW,{store:w,disabled:r,trackCursorAxis:u}),typeof y=="function"?y({payload:k}):y]})});function sW({store:e,disabled:t,trackCursorAxis:r}){const a=e.useState("floatingRootContext"),i=Kf(a,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=Y8(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??Tn}),null}const L4=x.createContext(void 0);function rW(){return x.useContext(L4)}const oW=600,$4="data-base-ui-tooltip-trigger";function xR(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 aW(e){let t=e;for(;t;){const r=t.closest(`[${$4}]`);if(r)return r;const a=t.getRootNode();t="host"in a&&Ft(a.host)?a.host:null}return null}const iW=kw(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,...y}=t,w=cm(!0),S=Mw(u)??w;if(!S)throw new Error(sn(82));const N=vs(b),E=S.useState("isTriggerActive",N),k=S.useState("isOpenedByTrigger",N),A=S.useState("floatingRootContext"),O=x.useRef(null),R=p??0,{registerTrigger:T,isMountedByThisTrigger:M}=Aw(N,O,S,{payload:f,closeOnClick:g,closeDelay:R}),D=rW(),{activeIdRef:_,delayRef:H,isInstantPhase:G,hasProvider:B}=y8(A,{open:k}),P=zw(A);S.useSyncedValue("isInstantPhase",G);const V=S.useState("disabled"),Y=m??V,W=qn(Y),q=S.useState("trackCursorAxis"),ee=S.useState("disableHoverablePopup"),z=x.useRef(!1),L=us(),X=x.useRef(void 0);function te(){return B&&_.current!=null?0:h??D??oW}function $(re){const Q=O.current;if(!Q||!re)return!1;const Z=aW(re);return Z!==null&&Z!==Q&>(Q,Z)}function U(re){const Q=$(re);return z.current=Q,Q&&(P.openChangeTimeout.clear(),P.restTimeout.clear(),P.restTimeoutPending=!1,L.clear()),Q}const F=Pw(A,{enabled:!Y,mouseOnly:!0,move:!1,handleClose:!ee&&q!=="both"?_w():null,restMs:te,delay(){return p==null&&B?{close:rc(H.current,"close")}:{close:R}},triggerElementRef:O,isActiveTrigger:E,isClosing:()=>S.select("transitionStatus")==="ending",shouldOpen(){return!z.current}}),K=$5(A,{enabled:!Y}).reference,se=re=>{const Q=z.current,Z=xR(re),pe=U(Z),ue=O.current,ye=ue&&Z&>(ue,Z);if(pe&&S.select("open")&&S.select("lastOpenChangeReason")===Qn){S.setOpen(!1,vt(Qn,re));return}if(Q&&!pe&&ye&&!W.current&&!S.select("open")&&ue&&Hi(X.current)){const Ce=()=>{!z.current&&!W.current&&!S.select("open")&&S.setOpen(!0,vt(Qn,re,ue))},Ie=te();Ie===0?(L.clear(),Ce()):L.start(Ie,Ce)}},ne=S.useState("triggerProps",M);return Nt("button",t,{state:{open:k},ref:[r,T,O],props:[F,K,M||q!=="none"?ne:void 0,{onMouseOver(re){se(re.nativeEvent)},onFocus(re){$(xR(re.nativeEvent))&&re.preventBaseUIHandler()},onMouseLeave(){z.current=!1,L.clear(),X.current=void 0},onPointerEnter(re){X.current=re.pointerType},onPointerDown(re){X.current=re.pointerType,S.set("closeOnClick",g),g&&!S.select("open")&&S.cancelPendingOpen(re.nativeEvent)},onClick(re){g&&!S.select("open")&&S.cancelPendingOpen(re.nativeEvent)},id:N,[Av]:Y?"":void 0,[$4]:Y?void 0:""},y],stateAttributesMapping:iw})}),B4=x.createContext(void 0);function lW(){const e=x.useContext(B4);if(e===void 0)throw new Error(sn(70));return e}const cW=x.forwardRef(function(t,r){const{children:a,container:i,className:c,render:u,style:f,...m}=t,{node:h,subtree:g}=y5({container:i,ref:r,componentProps:t,elementProps:m});return!g&&!h?null:n.jsxs(x.Fragment,{children:[g,h&&go.createPortal(a,h)]})}),uW=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t;return cm().useState("mounted")||a?n.jsx(B4.Provider,{value:a,children:n.jsx(cW,{ref:r,...i})}):null}),V4=x.createContext(void 0);function U4(){const e=x.useContext(V4);if(e===void 0)throw new Error(sn(71));return e}const dW=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:y=5,sticky:w=!1,disableAnchorTracking:C=!1,collisionAvoidance:S=yw,style:N,...E}=t,k=cm(),A=lW(),O=k.useState("open"),R=k.useState("mounted"),T=k.useState("trackCursorAxis"),M=k.useState("disableHoverablePopup"),D=k.useState("floatingRootContext"),_=k.useState("instantType"),H=k.useState("transitionStatus"),G=k.useState("adaptiveOrigin"),B=xx({anchor:c,positionMethod:u,floatingRootContext:D,mounted:R,side:f,sideOffset:h,align:m,alignOffset:g,collisionBoundary:p,collisionPadding:b,sticky:w,arrowPadding:y,disableAnchorTracking:C,keepMounted:A,collisionAvoidance:S,adaptiveOrigin:G}),P=x.useMemo(()=>({open:O,side:B.side,align:B.align,anchorHidden:B.anchorHidden,instant:T!=="none"?"tracking-cursor":_}),[O,B.side,B.align,B.anchorHidden,T,_]),V=bx(t,P,{styles:B.positionerStyles,transitionStatus:H,props:E,refs:[r,k.useStateSetter("positionerElement")],hidden:!R,inert:!O||T==="both"||M});return n.jsx(V4.Provider,{value:B,children:V})}),fW=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=cm(),{side:m,align:h}=U4(),g=f.useState("open"),p=f.useState("instantType"),b=f.useState("transitionStatus"),y=f.useState("popupProps"),w=f.useState("floatingRootContext"),C=f.useState("disabled"),S=f.useState("closeDelay");Sr({open:g,ref:f.context.popupRef,onComplete(){var A,O;g&&((O=(A=f.context).onOpenChangeComplete)==null||O.call(A,!0))}}),Iw(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,y,tm(b),u],stateAttributesMapping:Hg})}),mW=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=cm(),{arrowRef:m,side:h,align:g,arrowUncentered:p,arrowStyles:b}=U4(),y=f.useState("open"),w=f.useState("instantType");return Nt("div",t,{state:{open:y,side:h,align:g,uncentered:p,instant:w},ref:[r,m],props:[{style:b,"aria-hidden":!0},u],stateAttributesMapping:qf})}),hW=function(t){const{delay:r,closeDelay:a,timeout:i=400}=t,c=x.useMemo(()=>({open:r,close:a}),[r,a]);return n.jsx(L4.Provider,{value:r,children:n.jsx(b8,{delay:c,timeoutMs:i,children:t.children})})};function Hu({delay:e=0,...t}){return n.jsx(hW,{"data-slot":"tooltip-provider",delay:e,...t})}function xa({...e}){return n.jsx(nW,{"data-slot":"tooltip",...e})}function ba({...e}){return n.jsx(iW,{"data-slot":"tooltip-trigger",...e})}function ya({className:e,side:t="top",sideOffset:r=4,align:a="center",alignOffset:i=0,children:c,...u}){return n.jsx(uW,{children:n.jsx(dW,{align:a,alignOffset:i,side:t,sideOffset:r,className:"isolate z-50",children:n.jsxs(fW,{"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(mW,{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 Uj({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:$K(e).charAt(0).toUpperCase()})}const bR=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(ya,{className:"max-w-sm break-all font-sans",children:[t.host," · ",r?"Blocked in recent activity":`Allowed · ${m.label}`]})]}),r&&u&&n.jsx(ie,{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(ma,{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(),y=h.getBoundingClientRect(),w=b.width/t.current.offsetWidth||1,C=(y.left-b.left)/w-a.x,S=(y.top-b.top)/w-a.y;return{x:Math.max(-C,Math.min(g,b.width/w-C-y.width/w)),y:Math.max(-S,Math.min(p,b.height/w-S-y.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 y=t.current.getBoundingClientRect().width/t.current.offsetWidth||1;i(f(h.currentTarget,g.offset.x+p/y,g.offset.y+b/y))},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 pW({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),y=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,k]=x.useState({}),[A,O]=x.useState(null),R=D=>k(_=>({..._,[D]:!_[D]})),T=["secrets","blocked","allowed",...r.flatMap(D=>[`${D.name}:mcps`,`${D.name}:skills`])],M=T.every(D=>E[D]);return n.jsx(Hu,{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:()=>k(Object.fromEntries(T.map(D=>[D,!M]))),className:"rounded px-1 text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:M?"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(gR,{"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(P4,{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(kO,{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:ew},{kind:"skills",title:"Skills",icon:mL}].map(({kind:_,title:H,icon:G})=>{var q;const B=(q=D.resources)==null?void 0:q[_],P=(B==null?void 0:B.status)==="checked",V=(B==null?void 0:B.status)==="unsupported",Y=P?B.items:[],W=`${D.name}:${_}`;return n.jsx(sp,{title:H,"aria-label":`${D.name} ${H}`,count:P?Y.length:"-",icon:G,summary:V?"Setup integration unavailable":P?"In agent user configuration":"Inventory unavailable",open:!!E[W],onToggle:()=>R(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:[Y.map(ee=>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"?ee.name.replace(/^os-[a-f0-9]{8}-(?=.)/i,""):ee.name}),ee.disabled&&n.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"Disabled"})]},ee.name)),!Y.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(gR,{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(Q$,{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:y,className:"flex size-14 items-center justify-center rounded-2xl border border-stone-300 bg-card shadow-[0_3px_8px_#1c191708]",children:n.jsx(mc,{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(ya,{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:()=>R("allowed"),className:"border-0 shadow-none",children:[i.map(D=>n.jsx(bR,{item:D,active:A===D.host,onFocus:()=>O(D.host),onBlur:()=>O(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:dL,summary:"Recent connection attempts",tone:"blocked",open:!!E.blocked,onToggle:()=>R("blocked"),className:"border-0 border-t border-border/60 shadow-none",children:[c.map(D=>n.jsx(bR,{item:D,denied:!0,active:A===D.host,onFocus:()=>O(D.host),onBlur:()=>O(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:Du,summary:g.length?g.map(D=>D.name).join(", "):"None attached",open:!!E.secrets,onToggle:()=>R("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(ya,{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(gW,{container:b,core:y,hub:w,groups:C},`${e}-${S}-${r.map(D=>D.name).join(",")}`)]})]})})}function gW({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 k=E.getBoundingClientRect(),A=new DOMPoint(k.left,k.top).matrixTransform(p),O=new DOMPoint(k.right,k.bottom).matrixTransform(p);return{left:A.x,top:A.y,right:O.x,bottom:O.y,width:O.x-A.x,height:O.y-A.y}},y=b(t.current),w=b(r.current),C=y.left+y.width/2,S=y.top+y.height/2;u(Object.entries(a).flatMap(([E,k])=>{const A=k.current?b(k.current):null;if(!A)return[];if(E==="owner"||E==="secrets"){const H=E==="owner"?y.top:w.bottom,G=E==="owner"?A.bottom:A.top,B=A.left+A.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[...k.current.querySelectorAll("[data-agent-node]")].map((H,G)=>{const B=b(H),P=y.left,V=B.right,Y=B.top+B.height/2,W=(P+V)/2;return{key:`agent-${G}`,d:`M ${P} ${S} C ${W} ${S}, ${W} ${Y}, ${V} ${Y}`,x:V,y:Y}});const O=y.right,R=A.left,T=b(k.current.querySelector("button")),M=T.top+T.height/2,D=O+(R-O)*.4,_=D+(R-D)*.5;return[{key:E,d:`M ${O} ${S} H ${D} C ${_} ${S}, ${_} ${M}, ${R} ${M}`,x:R,y:M}]}))}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 xW(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"],bW={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=>bW[e]??"unknown",Za=e=>Gl[Px(e)],yW=e=>["ready","provisioning","starting"].includes(e),vW=e=>e==="stopped",wW=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 jW(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 uf(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 H4(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 SW(e,t=Date.now()){return["stopped","completed"].includes(e.phase)?"Not running":e.phase==="ready"?H4(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"}},Hj={"read-only":"Read only","read-write":"Read & write",full:"Any request",custom:"Specific requests",connect:"Connection",none:"No access",blocked:"Blocked"},NW=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],CW={own:RO,agent:mc,org:xL,group:Ka,policy:zu,secret:Du},Po=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,F4=e=>e.replace(/^\*\*?\./,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,56);function Fd({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 G4({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 kW({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 q4({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 Y4="grid-cols-[minmax(0,2fr)_minmax(0,1fr)_8rem_7rem_5rem_1rem]",K4="grid-cols-[minmax(0,1.6fr)_7.5rem_5rem_minmax(0,1fr)_13.5rem]",yR="grid-cols-[minmax(0,1.2fr)_minmax(0,1.3fr)_8rem_5rem_1rem]",TW="grid-cols-[1rem_minmax(0,1.1fr)_4.5rem_minmax(0,1.5fr)_minmax(0,1fr)_7.5rem_5rem]",X4="grid-cols-[minmax(0,2fr)_5.5rem_minmax(0,1fr)_8rem_7rem_5rem_1rem]",W4="grid-cols-[minmax(0,1.6fr)_5.5rem_7.5rem_5rem_minmax(0,1fr)_13.5rem]",vR="grid-cols-[minmax(0,1.2fr)_5.5rem_minmax(0,1.3fr)_8rem_5rem_1rem]",EW="grid-cols-[1rem_minmax(0,1.1fr)_5.5rem_4.5rem_minmax(0,1.5fr)_minmax(0,1fr)_7.5rem_5rem]";function RW({d:e,total:t,onOpen:r}){const[a,i]=x.useState(!1),c=Zs(),u=x.useId(),f=vg.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?X4:Y4),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[n.jsx(Uj,{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(G4,{source:h},h))}),n.jsx("span",{className:"text-[12px] text-muted-foreground",children:e.access.size===1?Hj[[...e.access][0]]??[...e.access][0]:"Mixed"}),n.jsx("span",{className:"block",children:n.jsx(q4,{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(mc,{"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:lf(h.key),children:lf(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(ie,{variant:"ghost",size:"sm",className:"h-7 text-[11px] text-muted-foreground","aria-label":`View ${h.sandbox} policy for ${lf(h.key)}`,onClick:()=>r(h.sandbox),children:["View rules",n.jsx(Zi,{className:"size-3"})]})})]},`${h.sandbox}:${h.key}`)})})]})})]})})})]})}function AW({b:e,onDecide:t}){var r,a;return n.jsxs("li",{className:Ve("grid items-center gap-4 px-6 py-2",e.location?W4:K4),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[n.jsx(Uj,{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?` · ${_u(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(ma,{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(ie,{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 wR({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 jR({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 SR({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 NR({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:y,location:w,sources:C,selectionSummary:S,showHeader:N=!0}){var T;const E=w?EW:TW,k=w?"col-span-6":"col-span-5",A=((T=t==null?void 0:t.org)==null?void 0:T.blocked)??[],O=e.filter(M=>h.has(M.id)).length,R=e.length>0&&O===e.length;return n.jsxs(n.Fragment,{children:[N&&n.jsxs(Lp,{className:E,children:[n.jsx(SR,{label:"Select all matching network rules",checked:(S==null?void 0:S.all)??R,mixed:(S==null?void 0:S.mixed)??(O>0&&!R),disabled:y||(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:[A.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:y,onClick:f,"aria-label":"Edit blocked everywhere",className:Ve(k,"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(tw,{"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(wR,{action:"block"}),n.jsx(jR,{hosts:A}),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(ie,{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:y,onClick:m,children:[n.jsx(ts,{className:"size-3.5"}),"Delete"]})]}),e.map(M=>{var Y;const D=M.copies??[M],_=D.map(W=>{var L,X,te;const q=C==null?void 0:C.find($=>{var U;return $.location.id===((U=W.location)==null?void 0:U.id)}),ee=(L=q==null?void 0:q.data)==null?void 0:L.org,z=(((te=(X=q==null?void 0:q.data)==null?void 0:X.fleetPolicy)==null?void 0:te.sandboxes)??r).filter($=>{var U;return Ox(W,{name:$.name,groups:ir({assignments:(ee==null?void 0:ee.assignments)??i},$.name),setups:((U=(ee==null?void 0:ee.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,q)=>W+q.total,0),G=_.reduce((W,q)=>W+q.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 q;return cf(W,((q=W.sourceOrg)==null?void 0:q.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(M.id)&&"bg-accent/40"),children:[n.jsx(SR,{label:`Select ${M.name}`,checked:h.has(M.id),disabled:y,onChange:()=>g(M.id)}),n.jsxs("button",{onClick:()=>u(M),disabled:y,"aria-label":`Edit ${M.name}`,title:w?`Details shown for ${w.label}. Open to choose a source.`:void 0,className:Ve(k,"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(zu,{"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:M.name})]}),w&&n.jsx(fx,{record:M}),n.jsx("span",{className:"flex flex-wrap gap-1",children:B.map(W=>n.jsx(wR,{action:W},W))}),n.jsx(jR,{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"}):M.appliesTo.everyone||M.appliesTo.sandboxes.length||!M.appliesTo.groups.length&&!((Y=M.appliesTo.setups)!=null&&Y.length)?n.jsx("span",{className:"text-amber-700",title:`Current scope: ${cf(M,a)||"none"}`,children:"Assign a group"}):cf(M,a)}),H?n.jsx(q4,{n:G,total:H}):n.jsx("span",{className:"text-[12px] text-faint",children:"No sandboxes"})]}),n.jsxs(ie,{variant:"ghost",size:"sm",className:"h-7 justify-self-end px-2 text-xs text-muted-foreground hover:text-destructive","aria-label":`Delete ${M.name}`,title:w?`Delete from ${w.label}`:void 0,disabled:y,onClick:()=>b([M]),children:[n.jsx(ts,{className:"size-3.5"}),"Delete"]})]},M.id)})]})]})}function Q4({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:y,onClearSandbox:w}){var me,Ae;const C=Pt(),[S,N]=x.useState(()=>new Set),[E,k]=x.useState(null),[A,O]=x.useState(!1),[R,T]=x.useState([]),M=x.useRef(!1),[D,_]=x.useState("all"),[H,G]=x.useState(""),[B,P]=x.useState(100),[V,Y]=x.useState("rules"),[W,q]=x.useState(Date.now),ee=x.useRef(null),z=x.useRef(null);x.useEffect(()=>{const ge=setInterval(()=>q(Date.now()),3e4),Pe=Fe=>{var _e;(Fe.metaKey||Fe.ctrlKey)&&Fe.key.toLowerCase()==="k"&&(Fe.preventDefault(),(_e=ee.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(()=>w4(a,15,W),[a,W]),X=t.sandboxes,te=X.length,$=e?gf("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?mt(ge):ge.id,{destinations:K,blocked:se,perSandbox:ne}=x.useMemo(()=>e?BK(e.sources):h4(X,a,r),[X,a,r,e==null?void 0:e.sources]),ve=X.filter(ge=>ge.status==="loaded").length,ae=H.trim().toLowerCase(),le=K.filter(ge=>(D==="all"||ge.sources.has(D))&&(!ae||[ge.host,...ge.grants.flatMap(Pe=>[Pe.sandbox,Pe.key])].join(" ").toLowerCase().includes(ae))),re=le.length,Q=[{id:"all",label:"All"},...vg.filter(ge=>ge===D||K.some(Pe=>Pe.sources.has(ge))).map(ge=>({id:ge,label:ia[ge].label}))],Z=se.filter(ge=>!ae||[ge.host,...ge.programs,...ge.sandboxes].join(" ").toLowerCase().includes(ae)),pe=X.filter(ge=>!ae||ge.name.toLowerCase().includes(ae)),ue=ge=>{var Pe;return!y||Ox(ge,{name:y,groups:ir(r,y),setups:((Pe=r==null?void 0:r.setupMembers)==null?void 0:Pe[y])??[]})},ye=$.filter(ge=>ue(ge)).filter(ge=>!ae||(ge.copies??[ge]).some(Pe=>{var Fe;return[Pe.name,Pe.action,...Pe.destinations,cf(Pe,((Fe=Pe.sourceOrg)==null?void 0:Fe.groups)??U)].join(" ").toLowerCase().includes(ae)})),Ce=$.filter(ge=>S.has(F(ge))),Ie=ye.filter(ge=>S.has(F(ge))).length;function de(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=ye.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 oe(){if(!(M.current||!(E!=null&&E.length))){M.current=!0,O(!0),T([]);try{const ge=e?E.map(Fe=>({...Fe,id:F(Fe)})):E,Pe=await xW(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}),T(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
|
+
`)}),k(null),await m()}finally{O(!1),M.current=!1}}}const fe=V==="rules"?ye.length:V==="destinations"?re:V==="blocked"?Z.length:pe.length,Re=V==="rules"?$.length:V==="destinations"?K.length:V==="blocked"?se.length:te,Me=!!(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:K.length},{id:"blocked",label:"Blocked hosts",count:se.length,dot:"bg-red-500"},{id:"sandboxes",label:"Sandboxes",count:te}].map(ge=>n.jsxs("button",{"aria-pressed":V===ge.id,onClick:()=>{Y(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(Rf,{value:ge.count})})]},ge.id))}),n.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:n.jsx(j4,{points:L,height:34,title:"Connections · 15m"})})]}),n.jsxs("div",{className:"flex h-[3px] shrink-0 overflow-hidden bg-border",role:"img","aria-label":`${ve} of ${te} sandbox policies enforced`,children:[ve>0&&n.jsx("span",{className:"bg-emerald-400/70",style:{width:`${ve/te*100}%`}}),te>ve&&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(vo,{ref:ee,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))}),Me&&n.jsxs(ie,{variant:"ghost",size:"sm",onClick:ke,children:[n.jsx(In,{className:"size-3"}),"Clear"]}),y&&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:y}),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(ie,{variant:"ghost",size:"sm",onClick:()=>i(y),children:["Rules & history",n.jsx(Zi,{className:"size-3"})]})]}),n.jsx(ie,{variant:"ghost",size:"icon-sm","aria-label":"Refresh egress",onClick:m,children:n.jsx(rl,{className:"size-3.5"})}),n.jsxs(ie,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:g,children:[n.jsx(ys,{className:"size-3.5"}),"Add rule"]})]}),V==="rules"&&Ce.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:Ce.length})," selected",Ce.length>Ie&&n.jsxs("span",{className:"text-muted-foreground",children:[" · ",Ce.length-Ie," outside current filters"]})]}),n.jsx(ie,{variant:"ghost",size:"sm",disabled:A,onClick:()=>N(new Set),children:"Clear selection"}),n.jsxs(ie,{variant:"destructive",size:"sm",disabled:A||Ce.some(ge=>{var Pe;return((Pe=ge.location)==null?void 0:Pe.connected)===!1}),onClick:()=>k([...Ce]),children:[n.jsx(ts,{className:"size-3.5"}),A?"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(ie,{variant:"outline",size:"sm",onClick:c,children:"Review"})]}),R.length>0&&n.jsxs(Qa,{id:"egress:delete-errors",tone:"error",title:"Some rules could not be deleted",onDismiss:()=>T([]),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:R.map(ge=>n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:ge.name}),": ",ge.message]},ge.id))})]}),e&&n.jsx(Au,{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"&&!Me&&((Ae=(me=r==null?void 0:r.org)==null?void 0:me.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(RO,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),n.jsx("p",{className:"text-sm",children:Me?"No matching results":e!=null&&e.status.unavailable?"Egress unavailable":V==="rules"?y?`No rule applies to ${y} 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?"":!Me&&V==="rules"?"Sandboxes are locked down: nothing leaves them until a rule allows it.":!Me&&V==="destinations"?"Destinations appear when a sandbox policy allows access.":!Me&&V==="blocked"?"Blocked connection attempts will appear here.":""}),Me?n.jsx(ie,{variant:"outline",className:"mt-4",onClick:ke,children:"Clear filters"}):V==="rules"&&!(e!=null&&e.status.any)&&n.jsxs(ie,{className:"mt-4 bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:g,children:[n.jsx(ys,{}),"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=ye.filter(At=>At.location.id===ge.location.id);return n.jsx(NR,{sources:e.sources,selectionSummary:{all:ye.length>0&&Ie===ye.length,mixed:Ie>0&&Ie<ye.length,count:ye.length},location:ge.location,showHeader:Pe===0,policies:_e,org:Me?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=>de(F(_e.find(rt=>rt.id===At))),onSelectAll:Te,onDelete:k,deleting:A||!ge.location.connected},ge.location.id)}),V==="rules"&&!e&&n.jsx(NR,{policies:ye,org:Me?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:de,onSelectAll:Te,onDelete:k,deleting:A}),V==="destinations"&&n.jsxs(n.Fragment,{children:[n.jsxs(Lp,{className:e?X4:Y4,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:le.slice(0,B).map(ge=>{var Pe,Fe,_e,Xe;return n.jsx(RW,{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:te,onOpen:Je=>{var ct;((ct=ge.location)==null?void 0:ct.connected)!==!1&&i(Je,ge.location)}},mt({name:ge.host,location:ge.location}))})})]}),V==="blocked"&&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:"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:Z.slice(0,B).map(ge=>n.jsx(AW,{b:ge,onDecide:(Pe,Fe)=>{var _e;((_e=ge.location)==null?void 0:_e.connected)!==!1&&u(Pe,Fe,ge.location)}},mt({name:ge.host,location:ge.location})))})]}),V==="sandboxes"&&n.jsxs(n.Fragment,{children:[n.jsxs(Lp,{className:e?vR:yR,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:pe.slice(0,B).map(ge=>{var Fe,_e,Xe;const Pe=ne.get(e?mt({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?vR:yR),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:vg.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"})]})},mt(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()}),Me?` of ${Re.toLocaleString()}`:""," ",V==="blocked"?"blocked hosts":V]}),n.jsxs("span",{className:"hidden sm:inline",children:[ve,"/",te," policies enforced · ⌘K to search"]})]}),n.jsx(Fr,{open:E!==null,onOpenChange:ge=>{!ge&&!M.current&&k(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:A,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:A||!(E!=null&&E.length),onClick:oe,children:A?"Deleting…":"Delete rules"})]})]})})]})}function CR({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:NW.map(m=>n.jsx("option",{children:m},m))}),n.jsx(Mt,{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(ie,{type:"submit",size:"xs",variant:e==="deny"?"destructive":"outline",disabled:!u.startsWith("/"),children:e==="deny"?"Block":"Allow"}),n.jsx(ie,{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(ys,{className:"size-3"}),e==="deny"?"Block request":"Allow request"]})}function OW(e){const t=[...new Set(e.endpoints.map(r=>Hj[r.access]??r.access))];return t.length===1?t[0]:"Mixed"}function Fj({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=CW[h],p=e.endpoints.map(y=>y.host),b=e.endpoints.some(y=>y.protocol!=="tcp"&&y.enforcement==="audit"||y.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:lf(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(G4,{source:h})}),n.jsx("span",{className:"hidden w-24 shrink-0 text-[12px] text-muted-foreground sm:block",children:OW(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(y=>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:[y.host,n.jsx("span",{className:"text-muted-foreground",children:y.ports.length?`:${y.ports.join(",")}`:""}),y.path?` ${y.path}`:""]}),n.jsx(Fd,{children:y.protocol}),n.jsx(Fd,{children:(Hj[y.access]??y.access).toLowerCase()}),y.protocol!=="tcp"&&y.enforcement==="audit"&&n.jsx(Fd,{tone:"border-amber-500/40 bg-amber-50 text-amber-800",title:y.enforcementUnset?"Unset, treated as audit":void 0,children:"audit only"}),y.allowedIps.length>0&&n.jsxs(Fd,{title:"Private addresses allowed",children:["ips ",y.allowedIps.join(", ")]}),y.credentialRisk&&n.jsx(Fd,{tone:"border-amber-500/40 bg-amber-50 text-amber-800",title:y.tlsSkip?"Encrypted traffic passes through without request inspection":"Credentials are uninspected",children:y.tlsSkip?"TLS passthrough":"uninspected"}),!i&&e.endpoints.length>1&&n.jsx("button",{onClick:()=>t({kind:"removeEndpoint",ruleName:e.key,host:y.host,port:y.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"})]}),(y.allow.length>0||y.deny.length>0)&&n.jsxs("ul",{className:"space-y-1 border-l border-border pl-3 font-mono text-[11.5px]",children:[y.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}`)),y.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&&y.protocol!=="tcp"&&n.jsxs("div",{className:"flex flex-wrap gap-x-5 gap-y-1.5",children:[n.jsx(CR,{kind:"allow",onAdd:w=>t({kind:"addAllow",ruleName:e.key,host:y.host,ports:y.ports,binaries:e.binaries,match:w})}),n.jsx(CR,{kind:"deny",onAdd:w=>t({kind:"addDeny",ruleName:e.key,host:y.host,ports:y.ports,binaries:e.binaries,match:w})})]})]},`${y.host}:${y.ports.join(",")}:${y.path??""}`)),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.binaries.map(y=>n.jsxs("span",{title:y,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(y),!i&&e.binaries.length>1?n.jsx("button",{onClick:()=>t({kind:"removeBinary",ruleName:e.key,binary:y}),disabled:a,"aria-label":`Remove ${y}`,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"})]},y)),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(ie,{variant:"ghost",size:"xs",className:"text-muted-foreground hover:text-destructive",disabled:a,onClick:r,children:[n.jsx(ts,{}),"Delete"]})]})]})]})})})]})}function MW({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} · ${_u(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 DW({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} · ${wf(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(Fj,{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(ie,{variant:"outline",size:"sm",onClick:()=>i(t),children:[n.jsx(k$,{}),"Restore"]})]})]})})}function Z4({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 zW({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(Z4,{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(ie,{variant:"outline",className:"mt-5 rounded-lg border-destructive/30 text-destructive hover:bg-destructive/5",onClick:()=>c(!0),children:[n.jsx(tw,{}),"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(Fj,{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:_u(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 kR=[{id:"all",label:"All"},...vg.map(e=>({id:e,label:ia[e].label}))];function IW({name:e,sandbox:t,events:r,onBack:a,onNavigate:i,onDraft:c,onEditPolicy:u,onEditBlocked:f,onOpenGlobal:m,reloadSignal:h}){var Y,W,q,ee,z,L;const g=Pt(),p=gn(),[b,y]=x.useState(null),[w,C]=x.useState(!1),[S,N]=x.useState(null),[E,k]=x.useState(null),[A,O]=x.useState("all"),R=x.useCallback(async()=>{try{const X=await g.policy(e);return y(X),X}catch(X){y({error:X.message})}},[e,g]);x.useEffect(()=>{y(null),R()},[R]),x.useEffect(()=>{h&&R()},[h]);async function T(X){var te;for(let $=0;$<20;$++){const U=await R(),F=(te=U==null?void 0:U.revisions)==null?void 0:te.find(K=>K.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(K=>setTimeout(K,1500))}He.warning(`v${X} saved; not yet loaded by ${e}`)}async function M(X){C(!0);try{const te=await g.applyOps(e,X);return He(`Saved as v${te.version}`),T(te.version),!0}catch(te){return He.error(te.message),!1}finally{C(!1)}}async function D(X){C(!0);try{const te=await g.restore(e,X);He(`Restored v${X} as v${te.version}`),k(null),T(te.version)}catch(te){He.error(te.message)}finally{C(!1)}}const _=((Y=b==null?void 0:b.effective)==null?void 0:Y.rules)??[],H=new Set(_.flatMap(X=>X.endpoints.filter(te=>!te.blocked).map(te=>te.host))),G=x.useMemo(()=>{const X=new Map;for(const te of r){if(te.sandbox!==e||te.verdict!=="denied")continue;const $=Mj(te.destination);if(!$||m4($)||H.has($))continue;const U=X.get($)??{host:$,port:f4(te.destination),count:0,binary:null,lastAt:null};U.count+=1,!U.binary&&te.binary&&(U.binary=te.binary),te.at&&(!U.lastAt||te.at>U.lastAt)&&(U.lastAt=te.at),X.set($,U)}return[...X.values()].sort((te,$)=>$.count-te.count)},[r,e,b]),B=(b==null?void 0:b.source)==="global",P=Object.fromEntries(kR.map(X=>[X.id,_.filter(te=>X.id==="all"||qa(te.key)===X.id).length])),V=_.filter(X=>A==="all"||qa(X.key)===A);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(Z4,{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",(q=fa[b.latest.status])==null?void 0:q.dot)})]}),"v",b.latest.version," ",(ee=fa[b.latest.status])==null?void 0:ee.label.toLowerCase()]}),n.jsx(MW,{revisions:b.revisions,onOpen:k}),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(ie,{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(ie,{className:"rounded-lg bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",disabled:w||B,onClick:()=>c(null,T),children:[n.jsx(ys,{}),"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(ie,{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(Uj,{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?` · ${_u(X.lastAt)}`:""]})]}),n.jsxs("span",{className:"text-[12px] tabular-nums text-red-600/90",children:[X.count,"×"]}),n.jsx(ie,{variant:"outline",size:"sm",className:"h-7 rounded-lg text-[12px]",onClick:()=>c({name:F4(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"}]},T),children:"Allow"})]},X.host))})}),n.jsx(T1,{title:"Rules",count:_.length,actions:n.jsx(kW,{label:"Filter rules",options:kR.filter(X=>X.id==="all"||P[X.id]>0).map(X=>({...X,count:P[X.id]})),value:A,onChange:O}),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 te=qa(X.key);return n.jsx(Fj,{rule:X,busy:w,locked:!["own","agent"].includes(te)||B,onOp:$=>M([$]),onDelete:["own","agent"].includes(te)?()=>N(X.key):null,managedBy:te==="secret"?"Secrets":te==="policy"?"Network rules":te==="org"?"Blocked everywhere":te==="group"?"Groups":null,onManage:te==="secret"?()=>i("secrets"):te==="policy"?()=>u(X.key.replace(/^egress_/,"")):te==="org"?f:te==="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 M([{kind:"removeRule",ruleName:S}]),N(null)},children:"Delete rule"})]})]})}),n.jsx(DW,{sandbox:e,version:E,latest:(L=(z=b==null?void 0:b.revisions)==null?void 0:z[0])==null?void 0:L.version,onClose:()=>k(null),onRestore:D})]})}function PW(e){const t=e.port===443||e.port===80;return{name:F4(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(LW,{...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 ve,ae,le,re,Q;const a=Pt(),i=gn(),c=Z=>e(Z,i),u=oi(),[f,m]=x.useState(t??null),[h,g]=x.useState(r),[p,b]=x.useState(()=>{try{const Z=sessionStorage.getItem(kg);return sessionStorage.removeItem(kg),Z}catch{return null}}),[y,w]=x.useState(null),[C,S]=x.useState(null),[N,E]=x.useState(null),[k,A]=x.useState(null),[O,R]=x.useState(!1),[T,M]=x.useState(!1),[D,_]=x.useState(!1),[H,G]=x.useState(null),[B,P]=x.useState(0),V=x.useRef(null),Y=x.useCallback(async()=>{try{w(await a.fleetPolicy())}catch(Z){w({error:Z.message,sandboxes:[]})}try{S(await a.org())}catch{S(null)}},[a]);x.useEffect(()=>{Y()},[Y]);const[W,q]=x.useState(Tg);x.useEffect(()=>{const Z=()=>{const pe=Tg();pe&&(q(pe),Y())};return window.addEventListener(Ja,Z),()=>window.removeEventListener(Ja,Z)},[Y]),x.useEffect(()=>{W!=null&&W.new&&A({initial:Ki({appliesTo:{everyone:!1,groups:[],sandboxes:[],...W.new.appliesTo}})})},[W]);const ee=x.useRef(null);x.useEffect(()=>{if(!(W!=null&&W.edit)||!C||ee.current===W)return;const Z=C.policies.find(pe=>pe.id===W.edit);Z&&(ee.current=W,A({initial:Z}))},[W,C]),x.useEffect(()=>{let Z=null;try{Z=JSON.parse(sessionStorage.getItem(E1)??"null"),sessionStorage.removeItem(E1)}catch{}!(Z!=null&&Z.sandbox)||!(Z!=null&&Z.host)||(m(Z.sandbox),E({sandbox:Z.sandbox,initial:PW({host:Z.host,port:Number(Z.port)||443,programs:new Set(Z.binary?[Z.binary]:[])}),after:()=>P(pe=>pe+1)}))},[]);const z=x.useMemo(()=>{const Z=new Set;for(const pe of u.events)pe.binary&&Z.add(pe.binary);return[...Z].sort()},[u.events]),L=Z=>{var pe;m(Z),(pe=V.current)==null||pe.scrollTo({top:0})},X=()=>{var Z;g(!0),(Z=V.current)==null||Z.scrollTo({top:0})},te=()=>{var Z;m(null),g(!1),Y(),(Z=V.current)==null||Z.scrollTo({top:0})};function $(Z,pe){const ye={everyone:!1,groups:Z==="allow-one"?ir(C,[...pe.sandboxes][0]):[],sandboxes:[]};if(Z.startsWith("allow")){A({initial:Ki({name:pe.host,destinations:[pe.host],appliesTo:ye})});return}G({kind:Z,b:pe})}function U(Z){const pe=((C==null?void 0:C.policies)??[]).find(ue=>ue.id===Z);pe&&A({initial:pe})}function F(Z,pe){var ye,Ce;const ue=((ye=Z.applied)==null?void 0:ye.length)??0;(Ce=Z.failed)!=null&&Ce.length?He.warning(`${pe}. ${Po(Z.failed.length,"sandbox","sandboxes")} could not be updated`,{description:Z.failed.map(Ie=>`${Ie.sandbox}: ${Ie.error}`).join(`
|
|
525
|
+
`)}):He.success(pe,{description:ue?`Updated ${Po(ue,"sandbox","sandboxes")}.`:void 0}),Y(),P(Ie=>Ie+1)}async function K(){_(!0);try{const Z=C??await a.org();F(await a.saveOrg({...Z.org,blocked:[]}),"Cleared blocked hosts"),M(!1)}catch(Z){He.error(Z.message)}finally{_(!1)}}async function se(){const{b:Z}=H;try{const pe=C??await a.org();F(await a.saveOrg({...pe.org,blocked:[...pe.org.blocked,Z.host]}),`${Z.host} blocked everywhere`),G(null)}catch(pe){He.error(pe.message)}}const ne=((ve=y==null?void 0:y.sandboxes)==null?void 0:ve.length)??0;return n.jsxs("div",{ref:V,className:"h-full overflow-y-auto",children:[h?n.jsx(zW,{onBack:te}):f?n.jsx(IW,{name:f,sandbox:((ae=y==null?void 0:y.sandboxes)==null?void 0:ae.find(Z=>Z.name===f))??((le=u.sandboxes)==null?void 0:le.find(Z=>Z.name===f)),events:u.events,onBack:te,onNavigate:c,onOpenGlobal:X,reloadSignal:B,onDraft:(Z,pe)=>E({sandbox:f,initial:Z,after:pe}),onEditPolicy:U,onEditBlocked:()=>R(!0)},f):y?y.error?n.jsx("p",{role:"alert",className:"py-24 text-center text-sm text-muted-foreground",children:y.error}):n.jsx(Q4,{fleet:y,org:C,events:u.events,onOpen:L,onOpenGlobal:X,onDecide:$,onNavigate:c,onRefresh:Y,onEditPolicy:Z=>A({initial:Z}),onEditBlocked:()=>R(!0),onClearBlocked:()=>M(!0),onAddPolicy:()=>A({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(Vj,{open:!!k,onOpenChange:Z=>{Z||A(null)},initial:k==null?void 0:k.initial,groups:(C==null?void 0:C.groups)??[],sandboxes:((y==null?void 0:y.sandboxes)??u.sandboxes??[]).map(Z=>Z.name),assignments:(C==null?void 0:C.assignments)??{},setupMembers:(C==null?void 0:C.setupMembers)??{},knownPrograms:z,onGroupCreated:()=>a.org().then(S).catch(()=>{}),onSaved:(Z,pe)=>F(Z,`${Z.deleted?"Deleted":"Saved"} ${pe.name}`)}),n.jsx(Fr,{open:T,onOpenChange:Z=>{!Z&&!D&&M(!1)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Unblock ",Po(((Q=(re=C==null?void 0:C.org)==null?void 0:re.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:K,children:D?"Removing…":"Unblock all"})]})]})}),n.jsx(I4,{open:O,onOpenChange:R,org:C==null?void 0:C.org,onSaved:Z=>F(Z,"Saved blocked hosts")}),n.jsx(FX,{open:!!N,onOpenChange:Z=>{Z||E(null)},initial:N==null?void 0:N.initial,knownPrograms:z,onSubmit:async Z=>{var ue;const pe=await a.applyOps(N.sandbox,[{kind:"addRule",rule:Z}]);He(`Saved as v${pe.version}`),P(ye=>ye+1),(ue=N.after)==null||ue.call(N,pe.version)}}),n.jsx(Fr,{open:!!H,onOpenChange:Z=>{Z||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(ne,"sandbox","sandboxes"),"."]})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:se,children:"Block everywhere"})]})]})})]})}function LW({onNavigate:e,requestedLocation:t}){var k,A,O;const r=Vu(["fleetPolicy","org","activity","setups"]),a=r.sources.flatMap(R=>{var T,M;return(((M=(T=R.data)==null?void 0:T.org)==null?void 0:M.policies)??[]).map(D=>({...D,location:R.location,sourceOrg:R.data.org,sourceSetups:R.data.setups}))}),i=hx(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),[y,w]=x.useState(Tg);x.useEffect(()=>{const R=()=>w(Tg());return window.addEventListener(Ja,R),()=>window.removeEventListener(Ja,R)},[]),x.useEffect(()=>{var D,_;if(!y||r.loading)return;const R=y.location??t??r.locations.find(H=>H.connected&&!H.remote),T=(_=(D=r.sources.find(H=>H.location.id===(R==null?void 0:R.id)))==null?void 0:D.data)==null?void 0:_.org;if(!(R!=null&&R.connected)||!T)return;const M=y.new?Ki({appliesTo:{everyone:!1,groups:[],sandboxes:[],...y.new.appliesTo}}):T.policies.find(H=>H.id===y.edit);M&&(u({initial:M,location:R}),w(null))},[y,r.sources,r.loading,t]),x.useEffect(()=>{let R,T;try{R=sessionStorage.getItem(kg),sessionStorage.removeItem(kg),T=JSON.parse(sessionStorage.getItem(E1)??"null")}catch{}if(R||T!=null&&T.sandbox){const M=t;M!=null&&M.connected&&g({location:M,name:R??T.sandbox})}},[t]);const C=R=>r.sources.find(T=>T.location.id===(R==null?void 0:R.id)),S=r.sources.flatMap(R=>{var T,M;return(((M=(T=R.data)==null?void 0:T.fleetPolicy)==null?void 0:M.sandboxes)??[]).map(D=>({...D,location:R.location}))}),N=r.sources.flatMap(R=>{var T,M;return((M=(T=R.data)==null?void 0:T.activity)==null?void 0:M.events)??[]});function E(R,T,M){var H,G,B,P,V;const D=C(R),_=(H=D==null?void 0:D.data)==null?void 0:H.org;return n.jsx(Zn,{location:R,children:n.jsx(mx,{record:{...T,location:R},type:"network",offer:i.offer,children:n.jsx(Vj,{sourceControl:T.copies&&n.jsx(vf,{record:{...T,location:R},onChange:Y=>u({initial:{...Y,...a.find(W=>mt(W)===mt(Y)),copies:T.copies,configurationCount:T.configurationCount},location:Y.location})}),open:!0,onOpenChange:Y=>{Y||M()},initial:T,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(Y=>Y.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(Y=>Y.binary).filter(Boolean))],onGroupCreated:r.refresh,onSaved:()=>{r.refresh(),He.success("Saved rule")}},mt({...T,location:R}))})})}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(Q4,{model:r,fleet:{sandboxes:S},events:N,org:null,onRefresh:r.refresh,onNavigate:e,onOpen:(R,T)=>g({name:R,location:T}),onOpenGlobal:()=>m("global"),onEditPolicy:R=>u({initial:R,location:R.location}),onAddPolicy:()=>m({initial:Ki()}),onEditBlocked:R=>{var T,M,D;return b({location:R,org:(D=(M=(T=C(R))==null?void 0:T.data)==null?void 0:M.org)==null?void 0:D.org})},onClearBlocked:R=>{var T,M,D;return b({location:R,org:{...(D=(M=(T=C(R))==null?void 0:T.data)==null?void 0:M.org)==null?void 0:D.org,blocked:[]}})},onDecide:(R,T,M)=>{var D,_,H,G,B;if(R.startsWith("allow")){const P=(_=(D=C(M))==null?void 0:D.data)==null?void 0:_.org;u({location:M,initial:Ki({name:T.host,destinations:[T.host],appliesTo:{everyone:!1,groups:R==="allow-one"?ir(P,[...T.sandboxes][0]):[],sandboxes:[]}})})}else{const P=(B=(G=(H=C(M))==null?void 0:H.data)==null?void 0:G.org)==null?void 0:B.org;b({location:M,org:{...P,blocked:[...(P==null?void 0:P.blocked)??[],T.host]}})}}}),f&&n.jsx(Dx,{onClose:()=>m(!1),children:(R,T)=>f==="global"?n.jsx(Lo,{open:!0,onOpenChange:M=>{M||T()},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:R})})]}),n.jsx(Zn,{location:R,children:n.jsx(Ef,{children:n.jsx(R1,{onNavigate:e,initialGlobal:!0})})})]})}):E(R,f.initial,T)}),c&&E(c.location,c.initial,()=>u(null)),i.dialog,p&&n.jsx(Zn,{location:p.location,children:n.jsx(I4,{open:!0,onOpenChange:R=>{R||b(null)},org:p.org??{...(O=(A=(k=C(p.location))==null?void 0:k.data)==null?void 0:A.org)==null?void 0:O.org,...p.clear?{blocked:[]}:{}},onSaved:()=>{r.refresh(),He.success("Saved blocked hosts")}})}),h&&n.jsx(Lo,{open:!0,onOpenChange:R=>{R||(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(Ef,{children:n.jsx(R1,{onNavigate:e,initialScope:h.name})})})})]})})]})}const $W=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 BW(e,t=LK){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:y=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:y,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 k;return!E.disabled&&((k=E.issues)==null?void 0:k.length)}).map(E=>E.name)}:await t(b,f,m,h,{resumeJob:g,isCancelled:()=>C.cancelled,onProgress:E=>{var k;c(u,{preparation:E,message:E.message}),(k=w.onProgress)==null||k.call(w,E)},onReview:E=>{var k;c(u,{review:E,prepared:!0}),(k=w.onReview)==null||k.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(", ")}.`:""}${$W(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=BW(cs),VW=(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)})}),UW=(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)},HW=(e,t,r)=>VW(e,t).some(a=>{var i;return UW(a.advanced)&&(((i=a.advanced)==null?void 0:i.ports)??[443,80]).map(Number).includes(Number(r.port??443))&&a.destinations.some(c=>a4(c,r.host))}),J4=e=>{var t;return!!(e.credentialRef||(t=e.credentialFields)!=null&&t.length)},FW=(e,t)=>String(e??"").toLowerCase()===String(t??"").toLowerCase(),TR=(e,t)=>!J4(e)&&(t.phase==="runtime"||t.phase==="auth"&&(e.requirements??[]).some(r=>r.phase==="runtime"&&FW(r.host,t.host))),A1=e=>`${e.host}${Number(e.port??443)===443?"":`:${e.port}`}`,GW=e=>`${A1(e)}${e.path||""}`;function qW(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"&&J4(m))&&HW(t,f,h)?i.add(A1(h)):c.set(GW(h),A1(h));const u=new Set(c.values());return{covered:[...i].filter(f=>!u.has(f)),uncovered:[...c.keys()]}}function YW(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 Gj=[{id:"codex",name:"Codex",logo:"codex"},{id:"claude",name:"Claude Code",logo:"claudecode"},{id:"cursor",name:"Cursor",logo:"cursor"}],O1=(e,t)=>e.items.filter(r=>r.kind===t).length,Va=e=>e.issues.filter(t=>!Aj(t)),KW=e=>e.items.filter(t=>!t.disabled&&!Va(t).length).length,Eg=e=>e.items.filter(t=>Va(t).length).length,ER=e=>e.sources.map(t=>{var r;return((r=Gj.find(a=>a.id===t))==null?void 0:r.name)||t}).join(", "),XW=e=>`${e.host}${e.port&&Number(e.port)!==443?`:${e.port}`:""}${e.path||""}`,WW={build:"Downloads from",runtime:"Connects to",auth:"Sign-in"},RR={connected:"Connected","needs-sign-in":"Needs sign-in","needs-credentials":"Needs credentials",unverified:"Couldn’t check"},QW={prepared:"Ready","sign-in-in-sandbox":"Sign in after install","needs-attention":"Needs attention",disabled:"Inactive"},AR=e=>{var t,r,a;return e.disabled?"Inactive":Oj(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"},ZW=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"),eD=(e=[])=>e.some(t=>!ZW(t))?"Enter domain names like api.github.com (no wildcards, IP addresses or local names).":e.length>20?"Add up to 20 websites.":"",tD=e=>{var t;return((t=e.credentialFields)==null?void 0:t.length)>0&&!e.requirements.some(r=>r.phase==="runtime")},nD=(e,t)=>{var r;return tD(e)&&u4(t)&&!((r=t==null?void 0:t.hosts)!=null&&r.length)},df=e=>(e==null?void 0:e.egressPolicy)??(e!=null&&e.egressPolicyError?{error:e.egressPolicyError}:null),JW=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function Af({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 sD({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(zu,{className:"mt-0.5 size-3.5 shrink-0"}),n.jsx("span",{children:e})]})}const OR=[{kind:"mcp",label:"MCPs",icon:ew},{kind:"skill",label:"Skills",icon:W1}];function rD({items:e,children:t}){return n.jsxs(nm,{defaultValue:e.some(r=>r.kind==="mcp")?"mcp":"skill",className:"min-w-0 gap-3",children:[n.jsx(sm,{"aria-label":"Setup item categories",className:"w-full",children:OR.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))}),OR.map(({kind:r,label:a,icon:i})=>n.jsx(Io,{value:r,keepMounted:!0,className:"min-w-0",children:n.jsx(mo,{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 eQ(e){const t=Vu(["setups"]);return n.jsx(aD,{...e,model:t})}function oD({combined:e,...t}){const r=gn();return e?n.jsx(eQ,{...t}):n.jsx(aD,{...t},(r==null?void 0:r.id)??(r==null?void 0:r.context)??"default")}function aD({sandbox:e=null,setupIds:t=[],model:r}){const a=Pt(),i=gn(),{locations:c}=yo(),[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(K=>{F&&f(K)}).catch(()=>{}),()=>{F=!1}},[a,i]);const[h,g]=x.useState(null),p=x.useMemo(()=>r?r.sources.flatMap(F=>{var K;return(((K=F.data)==null?void 0:K.setups)??[]).map(se=>({...se,location:F.location}))}):h,[r==null?void 0:r.sources,h]),b=x.useMemo(()=>r?gf("setups",p??[]):p,[p,!!r]),y=F=>r&&F.location?r.apiFor(F.location):a,[w,C]=x.useState(""),[S,N]=x.useState(!1),[E,k]=x.useState(null),[A,O]=x.useState(null),[R,T]=x.useState(!1),[M,D]=x.useState(""),[_,H]=x.useState(""),[G,B]=x.useState("all"),[P,V]=x.useState(!1),[Y,W]=x.useState(!1),[q,ee]=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=hx(p??[],F=>r.apiFor(F),z),te=x.useSyncExternalStore(Xi.subscribe,Xi.getSnapshot).filter(F=>{var K;return F.status==="saved"&&(r||((K=F.location)==null?void 0:K.context)===(m==null?void 0:m.context))}).map(F=>F.id).join(",");x.useEffect(()=>{z()},[z,te]);const $=x.useMemo(()=>(b||[]).filter(F=>{const K=F.copies??[F],se=K.some(ne=>[ne.name,...ne.items.flatMap(ve=>[ve.name,...ve.sources||[]])].join(" ").toLowerCase().includes(_.trim().toLowerCase()));return(!e||t.includes(F.id))&&se&&(G==="all"||(G==="review"?K.some(ne=>Eg(ne)>0):K.every(ne=>Eg(ne)===0)))}).sort((F,K)=>F.name.localeCompare(K.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(vo,{"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(ie,{variant:"ghost",size:"sm",onClick:()=>{H(""),B("all")},children:"Clear"}),n.jsx(ie,{variant:"ghost",size:"icon-sm","aria-label":"Refresh setups",disabled:Y,onClick:z,children:Y?n.jsx(Rt,{className:"size-3.5"}):n.jsx(rl,{className:"size-3.5"})}),n.jsxs(ie,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>N(!0),children:[n.jsx(ys,{}),"Bring my setup"]})]}),w&&n.jsxs("div",{className:"space-y-2 border-b px-4 py-3 sm:px-6",children:[n.jsx(Af,{children:w}),n.jsx(ie,{variant:"outline",size:"sm",disabled:Y,onClick:z,children:"Try again"})]}),r&&n.jsx(Au,{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(Rt,{}),"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(pf,{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(ie,{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(mo,{duration:.15,offset:0,blur:"0px",children:n.jsxs(MU,{"aria-label":"MCPs & Skills",className:"min-w-[740px] text-xs",children:[n.jsx(DU,{children:n.jsxs(ST,{className:"hover:bg-transparent",children:[n.jsx(My,{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(My,{scope:"col",className:"h-9 px-4 text-[11px] font-normal text-muted-foreground",children:F},F)),n.jsx(My,{className:"w-12",children:n.jsx("span",{className:"sr-only",children:"Actions"})})]})}),n.jsx(zU,{children:$.map(F=>{var ve,ae,le;const K=F.copies??[F],se=Gj.filter(re=>K.some(Q=>Q.items.some(Z=>{var pe;return(pe=Z.sources)==null?void 0:pe.includes(re.id)}))),ne=re=>{const Q=K.map(ue=>O1(ue,re)),Z=Math.min(...Q),pe=Math.max(...Q);return Z===pe?Z:`${Z}–${pe}`};return n.jsxs(ST,{className:((ve=F.location)==null?void 0:ve.connected)===!1?"opacity-60":"cursor-pointer hover:bg-muted/40",onClick:()=>{var re;((re=F.location)==null?void 0:re.connected)!==!1&&k(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:re=>{re.stopPropagation(),k(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:[se.map(re=>n.jsx("img",{src:`/logos/agents/${re.logo}.svg`,alt:re.name,title:re.name,className:"size-4 object-contain"},re.id)),!se.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(ew,{"aria-hidden":"true",className:"size-3.5 text-muted-foreground",strokeWidth:1.5}),ne("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}),ne("skill")]})}),n.jsx($l,{className:"px-4 py-2 text-[11px] text-muted-foreground",children:F.createdAt?wf(F.createdAt):"Not reported"}),n.jsx($l,{className:"px-4 py-2 text-right sm:pr-6",children:n.jsx(ie,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive",disabled:((le=F.location)==null?void 0:le.connected)===!1,"aria-label":`Delete setup ${F.name}`,title:F.location?`Delete from ${F.location.label}`:void 0,onClick:re=>{re.stopPropagation(),D(""),O(F)},children:n.jsx(ts,{className:"size-3.5"})})})]},mt(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"})]}),A&&n.jsx(en,{open:!0,onOpenChange:F=>{!F&&!R&&O(null)},children:n.jsxs(tn,{className:"sm:max-w-md",children:[n.jsxs(nn,{children:[n.jsxs(Qt,{children:["Delete “",A.name,"”?"]}),n.jsx(Rn,{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(Af,{children:M}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(ie,{variant:"ghost",disabled:R,onClick:()=>O(null),children:"Cancel"}),n.jsxs(ie,{variant:"destructive",disabled:R,onClick:async()=>{T(!0),D("");try{await y(A).deleteSetup(A.id,A.revision),r?z():g(F=>F.filter(K=>mt(K)!==mt(A))),k(F=>F&&mt(F)===mt(A)?null:F),O(null)}catch(F){D(F.message)}finally{T(!1)}},children:[R&&n.jsx(Rt,{}),"Delete setup"]})]})]})}),S&&n.jsx(Zn,{location:S.location??m,children:n.jsx(lD,{initialReview:S.review,initialName:S.name,onClose:()=>N(!1),onSaved:(F,K=S.location??m)=>{N(!1),!r&&K&&(K.context!==(m==null?void 0:m.context)||K.target!==(m==null?void 0:m.target))?window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"setups",location:K}})):(z(),ee(df(F)?{...df(F),location:K}:null))}})}),q&&n.jsx(Zn,{location:q.location??m,children:n.jsx(iD,{policy:q,onClose:()=>ee(null)})}),E&&n.jsx(Zn,{location:E.location??m,children:n.jsx(mx,{record:E,type:"setups",offer:L.offer,children:n.jsx(aQ,{sourceControl:n.jsx(vf,{record:E,onChange:F=>k({...F,...p.find(K=>mt(K)===mt(F)),copies:E.copies})}),setup:E,sandbox:e,onPrepare:async()=>{try{const F=await y(E).prepareSavedSetup(E.id);N({review:F,name:E.name+" (updated)",location:E.location??m}),k(null)}catch(F){C(F.message)}},onUpdated:F=>{var K;k({...F,location:E.location,copies:(K=E.copies)==null?void 0:K.map(se=>mt(se)===mt(E)?{...F,location:E.location}:se)}),r?z():g(se=>se.map(ne=>ne.id===F.id?F:ne))},onClose:()=>k(null)},mt(E))})}),L.dialog]})}function tQ(){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(ie,{size:"xs",variant:"outline",onClick:()=>r(c),children:"Review import"}),c.status==="saved"&&df(c.setup)&&n.jsx(ie,{size:"xs",variant:"outline",onClick:()=>i({policy:df(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(lD,{initialJob:t,initialReview:t.review,initialName:t.name,onClose:()=>r(null),onSaved:c=>{i({policy:df(c),location:t.location}),r(null)}},t.id)}),(a==null?void 0:a.policy)&&n.jsx(Zn,{location:a.location,children:n.jsx(iD,{policy:a.policy,onClose:()=>i(null)})})]})}function iD({policy:e,onClose:t}){var A,O,R,T,M;const r=Pt(),a=gn(),[i,c]=x.useState([]),[u,f]=x.useState(null),[m,h]=x.useState([]),[g,p]=x.useState(!1),[b,y]=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&&y(`Could not load groups: ${_.message}`)}),()=>{D=!1}},[r,e.id,e.error]);const S=async()=>{p(!0),y("");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){y(D.message)}finally{p(!1)}},N=u&&(i.length!==u.appliesTo.groups.length||i.some(D=>!u.appliesTo.groups.includes(D))),E=YW(e),k=()=>{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(en,{open:!0,onOpenChange:D=>{D||t()},children:n.jsxs(tn,{className:"sm:max-w-md",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:"Egress policy not saved"}),n.jsx(Rn,{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(ie,{onClick:t,children:"Done"})})]})}):n.jsx(en,{open:!0,onOpenChange:D=>{D||t()},children:n.jsxs(tn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:e.created?"Egress policy created":"Egress policy updated"}),n.jsxs(Rn,{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))}),((A=e.blocked)==null?void 0:A.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(", "),"."]}),((O=e.approval)==null?void 0:O.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."]}),(((R=e.sync)==null?void 0:R.error)||((M=(T=e.sync)==null?void 0:T.failed)==null?void 0:M.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(ie,{variant:"outline",onClick:k,children:"Edit policy"}),N&&n.jsxs(ie,{disabled:g,onClick:S,children:[g&&n.jsx(Rt,{}),"Save groups"]}),n.jsx(ie,{variant:N?"ghost":"default",disabled:g,onClick:t,children:N?"Skip":"Done"})]})]})})}function nQ({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=>TR(e,c)),a=t(c=>!TR(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 sQ({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 y=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(y)},[r]);const c=Date.parse(e.createdAt),u=r?e.current:null,f=((p=e.items)==null?void 0:p.filter(y=>y.kind==="mcp"))??[],m=((b=e.items)==null?void 0:b.filter(y=>y.kind==="skill"))??[],h=m.every(y=>y.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(Rt,{}),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:JW(Math.max(0,Math.floor((a-c)/1e3)))}),r&&n.jsx(ie,{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(y=>{const w=(u==null?void 0:u.id)===y.id,C=!w&&Oj(y);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(Rt,{className:"size-3.5"}):C||!y.state||y.state==="disabled"?g:y.state==="needs-attention"?n.jsx(zu,{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:y.name}),n.jsx("span",{className:"min-w-0 max-w-[60%] truncate text-right text-muted-foreground",children:w?u.message:C?"Skipped":QW[y.state]||"Waiting"})]},y.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 rQ({item:e,choice:t,disabled:r,onChange:a}){const i=eD(t==null?void 0:t.hosts)||(nD(e,t)?"Enter at least one website, for example api.github.com.":"");return tD(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(Mt,{"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 lD(e){return e.initialReview||e.initialJob?n.jsx(cD,{...e}):n.jsx(oQ,{...e})}function oQ({onClose:e,onSaved:t,...r}){const a=js(),{locations:i,refresh:c}=yo(),[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(cD,{...r,onClose:e,onChangeLocation:()=>f(null),onSaved:g=>t(g,u)})}):n.jsx(en,{open:!0,onOpenChange:g=>{g||e()},children:n.jsx(tn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:n.jsx(Mx,{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 cD({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,y]=x.useState([]),[w,C]=x.useState(a),[S,N]=x.useState(i),[E,k]=x.useState(""),[A,O]=x.useState(null),[R,T]=x.useState(!1),[M,D]=x.useState("");async function _(re){T(!0),D("");try{await re()}catch(Q){D(Q.message)}finally{T(!1)}}const[H,G]=x.useState({}),[B,P]=x.useState((c==null?void 0:c.preparation)??null),[V,Y]=x.useState((c==null?void 0:c.prepared)??!1),[W,q]=x.useState(!1),[ee,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 te=(B==null?void 0:B.status)==="running"||R&&!!B,$=(re,Q)=>{Y(!1),G(Z=>({...Z,[re]:{...Z[re],...Q}}))};async function U(re){const Q=await u.removeSetupReviewItem(w.token,re);C(Q),y(Z=>Z.filter(pe=>pe!==re)),G(Z=>Object.fromEntries(Object.entries(Z).filter(([pe])=>pe!==re))),P(null),L.current&&Xi.updateReview(L.current,Q,V)}async function F(re=!1){z(!0),q(!0);const Q=Xi.start({id:L.current,review:w,name:S,choices:H,saveOnly:re,api:u,location:f,resumeJob:(B==null?void 0:B.status)==="running"?B:void 0},{onProgress:Z=>{X.current&&P(Z)},onReview:Z=>{X.current&&(C(Z),Y(!0),G({}))}});L.current=Q.id;try{const Z=await Q.promise;if(!X.current)return;Z.status==="saved"?t(Z.setup):Z.status==="needs-attention"?D("Some items couldn’t be prepared. Remove them or fix them, then retry the import."):(Y(!1),D("Import cancelled. Completed preparation is kept here for retry."))}finally{X.current&&q(!1)}}const K=(g==null?void 0:g.items.filter(re=>`${re.name} ${re.kind} ${re.sources.join(" ")}`.toLowerCase().includes(E.toLowerCase())))??[],se=new Set(b),ne=(re,Q)=>y(Z=>{const pe=new Set(Z);for(const ue of re)Q?pe.add(ue.id):pe.delete(ue.id);return[...pe]}),ve=K.length>0&&K.every(re=>se.has(re.id)),ae=w?PK(w,H):[],le=Object.values(H).some(re=>eD(re.hosts))||!!(w!=null&&w.items.some(re=>!re.disabled&&nD(re,H[re.id])));return n.jsxs(en,{open:!0,onOpenChange:re=>{!re&&(L.current||W||!R&&!te)&&e()},children:[n.jsxs(tn,{className:"flex max-h-[90svh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl",children:[n.jsxs(nn,{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(Rn,{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(ie,{size:"sm",variant:"ghost",disabled:R||te,onClick:r,children:"Change"})]}),!g&&!w&&n.jsx(n.Fragment,{children:n.jsx("div",{className:"grid gap-2 sm:grid-cols-3",children:Gj.map(re=>n.jsxs("button",{type:"button","aria-pressed":m.includes(re.id),onClick:()=>h(Q=>Q.includes(re.id)?Q.filter(Z=>Z!==re.id):[...Q,re.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(re.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/${re.logo}.svg`,alt:"",className:"size-4"})}),re.name,m.includes(re.id)&&n.jsx(Yn,{className:"ml-auto size-3.5"})]},re.id))})}),g&&!w&&n.jsxs(n.Fragment,{children:[n.jsx(vo,{"aria-label":"Search discovered tools",placeholder:"Search MCPs and Skills…",value:E,onValueChange:k}),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()?` · ${K.length} matching`:""]}),n.jsx(ie,{size:"sm",variant:"outline",disabled:R||!K.length,onClick:()=>ne(K,!ve),children:ve?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:re,label:Q})=>{const Z=K.filter(ye=>ye.kind===re),pe=Z.filter(ye=>se.has(ye.id)).length,ue=Z.length>0&&pe===Z.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:[pe,"/",Z.length]})]}),n.jsx(ie,{size:"sm",variant:"ghost",className:"h-7 text-xs",disabled:R||!Z.length,"aria-label":`${ue?"Clear":"Select all"} ${Q}${E.trim()?" in search results":""}`,onClick:()=>ne(Z,!ue),children:ue?"Clear":"Select all"})]}),n.jsxs("div",{className:"max-h-64 divide-y overflow-y-auto",children:[Z.map(ye=>n.jsxs("label",{className:"flex cursor-pointer items-start gap-3 p-3",children:[n.jsx($o,{disabled:R,"aria-label":`Import ${ye.name} from ${ER(ye)}`,checked:se.has(ye.id),onCheckedChange:Ce=>ne([ye],Ce)}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:ye.name}),n.jsxs("span",{className:"mt-1 block text-[11px] text-muted-foreground",children:[ER(ye),Oj(ye)?" · Can’t run in a sandbox":Va(ye).length?" · Needs attention":""]})]})]},ye.id)),!Z.length&&n.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:E.trim()?`No matching ${Q}`:`No ${Q} found`})]})]},re)})}),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(re=>n.jsx("p",{className:"text-[11px] text-muted-foreground",children:re},re))]}),w&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"grid gap-1.5 text-xs",children:["Setup name",n.jsx(Mt,{disabled:R,value:S,onChange:re=>N(re.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:[KW(w)," ready · ",Eg(w)," need attention"]})}),n.jsx(rD,{items:w.items,children:re=>n.jsx(jH,{className:"overflow-hidden rounded-lg border",children:re.map(Q=>{var Z,pe,ue,ye,Ce,Ie,de,Te;return n.jsxs(SH,{value:Q.id,children:[n.jsxs("div",{className:"flex items-center [&>h3]:min-w-0 [&>h3]:flex-1",children:[n.jsxs(NH,{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(AR(Q))?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:AR(Q)})]}),n.jsx(ie,{variant:"ghost",size:"icon",className:"mr-2 size-7 shrink-0 text-muted-foreground hover:text-destructive",disabled:R||te,"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(CH,{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(oe=>n.jsx("p",{children:oe},oe))}),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((oe,fe)=>n.jsxs("p",{children:[n.jsxs("span",{className:"font-medium",children:[WW[oe.phase]||oe.phase,":"]})," ",XW(oe),n.jsxs("span",{className:"text-muted-foreground",children:[" · ",oe.reason]})]},fe)),Q.kind==="mcp"&&!Q.disabled&&!Va(Q).some(oe=>!oe.startsWith("Connect credentials"))&&n.jsx(nQ,{item:Q})]}),Q.package&&n.jsxs("p",{children:["npm package ",Q.package.name,"@",((Z=Q.artifact)==null?void 0:Z.version)||Q.package.requested,Q.artifact?" · downloaded and version-locked":" · downloads when you press Import"]}),Q.verification&&n.jsxs("p",{children:["Connection: ",RR[Q.verification.status]||Q.verification.status,Q.verification.reason?` · ${Q.verification.reason}`:""]}),((pe=Q.artifact)==null?void 0:pe.verification)&&n.jsxs("p",{children:["Startup check: ",RR[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."]}),((ue=Q.configuration)==null?void 0:ue.endpoint)&&!Q.credentialRef&&n.jsx(sD,{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)&&!((ye=Q.configuration)!=null&&ye.endpoint)&&n.jsx(rQ,{item:Q,choice:H[Q.id],disabled:R||te,onChange:oe=>$(Q.id,{hostsText:oe,hosts:oe.split(/[\s,]+/).map(fe=>fe.replace(/^https?:\/\//i,"").split("/")[0].toLowerCase()).filter(Boolean)})}),((Ce=Q.credentialFields)==null?void 0:Ce.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:R||te,checked:((de=H[Q.id])==null?void 0:de.useSourceSecrets)||!1,onCheckedChange:oe=>$(Q.id,{useSourceSecrets:!!oe})}),"Use the credentials from your config file (",Q.sourceCredentialFields.join(", "),")."]}),Q.credentialFields.filter(oe=>{var fe,Re;return!((fe=H[Q.id])!=null&&fe.useSourceSecrets)||!((Re=Q.sourceCredentialFields)!=null&&Re.includes(oe))}).map(oe=>{var fe,Re;return n.jsxs("label",{className:"grid gap-1",children:[oe,n.jsx(Mt,{type:"password",autoComplete:"new-password","aria-label":`${Q.name} ${oe}`,disabled:R||te,value:((Re=(fe=H[Q.id])==null?void 0:fe.secrets)==null?void 0:Re[oe])||"",onChange:Me=>{var ke;return $(Q.id,{secrets:{...(ke=H[Q.id])==null?void 0:ke.secrets,[oe]:Me.target.value}})}})]},oe)}),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(oe=>n.jsxs("button",{disabled:R,onClick:()=>_(async()=>O({path:oe.path,...await u.setupFile(w.token,Q.id,oe.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:oe.path}),n.jsxs("span",{className:"text-muted-foreground",children:[oe.bytes," B"]})]},oe.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:te?n.jsx(sQ,{preparation:B,onCancel:()=>{Xi.cancel(L.current).catch(re=>D(re.message))}}):n.jsx("p",{children:V?dR(w)?"Checks finished. Some items need attention.":"Checks finished. Ready to save.":"Not finished. Press Import to continue."})}),a&&n.jsx(ie,{variant:"ghost",disabled:te||R,onClick:()=>{C(null),h([...new Set(a.items.flatMap(re=>re.sources))]),P(null),Y(!1),G({})},children:"Re-scan sources"})]}),n.jsx(Af,{children:M})]}),n.jsxs("div",{className:"shrink-0 space-y-4 border-t bg-muted/20 px-6 py-4",children:[w&&!te&&!V&&ae.length>0&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[ae.map(re=>re.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(ie,{variant:"ghost",disabled:R||te,onClick:()=>{w?(C(null),Y(!1),P(null),G({})):(p(null),y([])),D("")},children:"Back"}),n.jsx(ie,{variant:"ghost",disabled:!L.current&&!W&&(R||te),onClick:e,children:W?"Continue in background":L.current?"Close":"Cancel"}),w?n.jsxs(ie,{disabled:R||!S.trim()||!w.items.length||le,onClick:()=>_(()=>F(V&&!dR(w))),children:[R&&n.jsx(Rt,{}),R?"Importing…":te?"Resume import":ee?"Retry import":"Import"]}):g?n.jsxs(ie,{disabled:R||!b.length,onClick:()=>_(async()=>{C(await u.reviewSetup(g.token,b)),z(!1)}),children:[R&&n.jsx(Rt,{}),"Review selection"]}):n.jsxs(ie,{disabled:R||!m.length,onClick:()=>_(async()=>p(await u.discoverSetups(m))),children:[R&&n.jsx(Rt,{}),"Discover tools"]})]})]})]}),A&&n.jsx(en,{open:!0,onOpenChange:()=>O(null),children:n.jsxs(tn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-3xl",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:A.path}),n.jsx(Rn,{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:A.content})]})})]})}function aQ({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,y]=x.useState(t||""),[w,C]=x.useState([]),[S,N]=x.useState(null),[E,k]=x.useState(null),[A,O]=x.useState([]),[R,T]=x.useState(!1),[M,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 Y=async()=>{try{const W=await u.setupJobs(e.id);if(P)return;O(W),W.some(q=>q.status==="waiting")&&(V=setTimeout(Y,2e3))}catch{}};return Y(),()=>{P=!0,clearTimeout(V)}},[e.id,E,u]);async function _(P){T(!0),D("");try{await P()}catch(V){D(V.message),N(null)}finally{T(!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(en,{open:!0,onOpenChange:P=>{!P&&!R&&a()},children:n.jsxs(tn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-lg",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:e.name}),n.jsx(Rn,{className:"sr-only",children:"Manage the MCPs and Skills in this saved setup."})]}),n.jsx("fieldset",{disabled:R,children:c}),n.jsx(rD,{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 Y,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||((Y=V.auth)==null?void 0:Y.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(q=>n.jsx("p",{children:q},q)),((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(ie,{variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground hover:text-destructive",disabled:R,"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:q,...ee}=await u.deleteSetupItem(e.id,V.id,e.revision);N(null),k(null),r(ee),q&&D(`Removed. The setup’s egress policy wasn’t updated: ${q}`)}),children:n.jsx(ts,{className:"size-3.5"})})]},V.id)})})}),n.jsx("div",{className:"flex items-center justify-between gap-3",children:n.jsxs(ie,{variant:"outline",size:"sm",onClick:i,disabled:R,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:R,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=>{y(P.target.value),N(null),k(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:TU.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(Y=>V?[...Y,P.id]:Y.filter(W=>W!==P.id)),N(null),k(null)}}),P.name,!P.config&&n.jsx("span",{className:"text-muted-foreground",children:" · Unavailable"})]},P.id))})]}),n.jsxs(ie,{variant:"outline",disabled:!b||!w.length||R,onClick:()=>_(async()=>{k(null),N(await u.previewSetup(e.id,b,w))}),children:[R&&n.jsx(Rt,{}),"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 Y;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}),((Y=P.binaries)==null?void 0:Y.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(sD,{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(ie,{variant:"outline",disabled:R,onClick:()=>_(async()=>{k(await u.removeSetup(e.id,b,S.token)),N(null)}),children:"Remove from sandbox"}),n.jsxs(ie,{disabled:R||!S.canEnable,onClick:()=>_(async()=>{k(await u.enableSetup(e.id,b,S.token,S.requiresApproval)),N(null)}),children:[R&&n.jsx(Rt,{}),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)||A.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,Y;return n.jsxs("a",{className:"rounded-md border px-3 py-2 hover:bg-muted",href:yg(b,((V=Fv(P))==null?void 0:V.command)||P,g),target:"_blank",rel:"noreferrer",children:["Open ",(Y=Fv(P))==null?void 0:Y.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:`${yg(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."})]})]}),A.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(Af,{children:M})]})})}function uD(e){const t=gn();return n.jsx(iQ,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}const MR=[];function iQ({value:e=[],onChange:t,inherited:r=MR,accessReview:a,onAccessReview:i,automaticAccess:c=!1,autoPrepare:u=!1,preparationContext:f="sandbox",localCatalog:m,retained:h=MR}){const g=Pt(),[p,b]=x.useState([]),[y,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)),k=D=>u?DK(D):!D.disabled&&!D.issues.length,A=D=>u?D.items.filter(c4):[],O=D=>D.items.filter(_=>!k(_)),R=qW(E,C,D=>D.items.filter(k),D=>u?zK(D):D.requirements),T=E.some(D=>D.items.some(_=>{var H;return k(_)&&!_.credentialRef&&((H=_.auth)==null?void 0:H.mode)==="agent-session"})),M=JSON.stringify(E.map(D=>[D.id,D.revision]));return x.useEffect(()=>{i==null||i(c?Object.fromEntries(JSON.parse(M)):null)},[M,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(k),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:[O1(D,"mcp")," MCPs · ",O1(D,"skill")," Skills",A(D).length?` · ${A(D).length} install automatically`:"",O(D).length?` · ${O(D).length} inactive`:""]})]})]}),O(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:[O(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&&R.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:R.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&&R.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:R.covered.map(D=>n.jsx("li",{className:"break-all py-1",children:D},D))})]}),n.jsx(Af,{children:y}),T&&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 lQ=e=>/failed to resolve .*image/i.test(e??"")&&/docker\.io/.test(e??""),cQ=e=>{var t;return Array.isArray(e==null?void 0:e.sandboxes)&&!e.sandboxes.length&&!((t=e.stranded)!=null&&t.length)&&!e.conflict},DR=e=>(e??[]).map(t=>typeof t=="string"?t:`${t.workspace}/${t.name}`);function uQ(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(y=>y())};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:y,then:w}=c;c=null,((S=b==null?void 0:b.job)==null?void 0:S.id)===y&&b.job.status==="done"&&(w==null||w())}async function g(b=!1){try{const y=await e.gatewayDocker(b);return f({status:y}),h(y),y}catch{return a.status}finally{m()}}async function p(b,y,w,C=!0){var S;f({asking:a.asking&&{...a.asking,busy:!0},error:null});try{const N=await(b==="undo"?e.undoGatewayDocker(DR(y)):e.connectGatewayDocker(DR(y),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=(y=>(y=a.asking)==null?void 0:y.sandboxes)())=>{var w;return p("connect",b,(w=a.asking)==null?void 0:w.then)},undo:(b=(y=>(y=a.asking)==null?void 0:y.sandboxes)())=>{var w;return p("undo",b,(w=a.asking)==null?void 0:w.then)},ask({kind:b,then:y}={}){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"||cQ(w)))return p("connect",[],y,(w==null?void 0:w.state)==="mismatch");f({asking:{kind:b,then:y,sandboxes:b==="connect"?(w==null?void 0:w.sandboxes)??null:null,busy:!1},error:null})},close:()=>f({asking:null,error:null})}}const jr=uQ(lr("local"));function dQ({telemetry:e=ln}={}){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(y=>y.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:y=>c(f,{message:y}),build:y=>{e.step(p,"building_image"),c(f,w=>{var C;return{build:{...y,logs:y.logs??((C=w.build)==null?void 0:C.logs)}}})},creating:()=>{e.step(p,"creating"),c(f,{status:"creating",message:"Creating sandbox…"})}};h(b).then(y=>{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:{...y,location:y.location??m.location},message:""})}).catch(y=>{var w,C;g.signal.aborted||y.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(y)),c(f,{status:"failed",error:y.message,code:y.code??null,fix:y.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=dQ(),ql="gateway-box",dD=["error","stopped","completed","deleting"],zR=(e,t)=>JSON.stringify([e==null?void 0:e.context,t]),IR=e=>e.status==="created"&&e.phase!=="ready"&&!dD.includes(e.phase);function fQ({jobs:e}){const{sandboxes:t,loading:r}=yo();return x.useEffect(()=>{if(r)return;const a=new Map(t.map(i=>[zR(i.location,i.name),i]));for(const i of e){const c=a.get(zR(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 PR(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 mQ({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(en,{open:!0,onOpenChange:c=>{c||t()},children:n.jsxs(tn,{className:"flex h-[min(36rem,90svh)] flex-col gap-3 sm:max-w-2xl",children:[n.jsxs(nn,{children:[n.jsxs(Qt,{children:["Build logs · ",e.name]}),n.jsx(Rn,{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 hQ(){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(IR)&&n.jsx(fQ,{jobs:a}),e.map(c=>{var p;const u=c.status==="created"&&c.phase==="ready",f=c.status==="created"&&dD.includes(c.phase),m=c.status==="preparing"||c.status==="creating"||IR(c),h=c.build&&n.jsx(ie,{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(ie,{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(ie,{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(ie,{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(ie,{size:"xs",variant:"outline",disabled:((p=c.location)==null?void 0:p.connected)===!1,onClick:()=>PR(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(ie,{size:"xs",variant:"outline",onClick:()=>PR(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(mQ,{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(ie,{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 nv="openrod.gateway-docker.dismissed",_R="openrod.gateway-docker.shown",LR="openrod.gateway-docker.failed",sv=e=>{try{return localStorage.getItem(e)}catch{return null}},rp=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},Gd=e=>{var t,r;return`${((t=e.build)==null?void 0:t.engineId)??""}|${((r=e.conflict)==null?void 0:r.dockerHost)??""}`},fD=()=>x.useSyncExternalStore(jr.subscribe,jr.getSnapshot),pQ=e=>`${e.workspace}/${e.name}`;function $R({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]})]},pQ(a)))})}function gQ({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($R,{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($R,{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 xQ({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(en,{open:!0,onOpenChange:m=>{m||jr.close()},children:n.jsxs(tn,{className:"sm:max-w-xl",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:"Connect OpenShell to Docker"}),n.jsx(Rn,{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(ie,{variant:"outline",disabled:r,onClick:f,children:r?"Checking…":"Check again"})]})})}function bQ(){const{status:e,asking:t,error:r}=fD(),[a,i]=x.useState(()=>sv(nv)),[c,u]=x.useState(()=>sv(LR)),[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"||sv(_R)===g.id||Date.now()-Date.parse(g.at)>36e5)){if(document.removeEventListener("visibilitychange",S),rp(_R,g.id),g.kind==="connect")return m(g.id);He.success("Undid the Docker change"),e.build&&(rp(nv,Gd(e)),i(Gd(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(nv,Gd(e)),i(Gd(e))},y=!!(e!=null&&e.build)&&a===Gd(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(LR,p.id),u(p.id)},actions:n.jsxs(n.Fragment,{children:[e.state==="mismatch"&&e.fix!=="manual"&&n.jsx(ie,{size:"xs",variant:"outline",onClick:()=>jr.ask({kind:"connect"}),children:"Try again"}),e.steps&&n.jsx(ie,{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(ie,{size:"xs",variant:"outline",onClick:()=>jr.ask({kind:"undo"}),children:"Undo"})}:(e==null?void 0:e.state)==="mismatch"&&e.fix!=="auto"&&!y?{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(ie,{size:"xs",variant:"outline",onClick:()=>jr.ask(),children:e.fix==="manual"?"Show steps":"Connect"}),n.jsx(ie,{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(xQ,{status:e,asking:t}):n.jsx(gQ,{status:e,asking:t,error:r}))]})}const M1="mt-1 text-[11px] text-red-700";function yQ(){const{status:e}=fD();return(e==null?void 0:e.state)==="mismatch"?n.jsxs("div",{className:`${M1} flex flex-wrap items-center gap-2`,children:["OpenShell can’t see your Docker images.",n.jsx(ie,{size:"xs",variant:"outline",onClick:()=>jr.ask(),children:e.fix==="manual"?"Show steps":"Connect"})]}):n.jsx("p",{className:M1,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 vQ({local:e}){return e?n.jsx(yQ,{}):n.jsx("p",{className:M1,children:"Start Docker, then delete this sandbox and create it again."})}const mD=x.createContext(void 0);function wQ(){return x.useContext(mD)}const jQ=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:y,...w}=t,C=vs(p||void 0),S=wQ(),N=(S==null?void 0:S.value)??[],E=(c||(S==null?void 0:S.disabled))??!1,[k,A]=po({controlled:S?C!==void 0&&N.indexOf(C)>-1:m,default:i,name:"Toggle",state:"pressed"}),{getButtonProps:O,buttonRef:R}=bo({disabled:E,native:b}),T={disabled:E,pressed:k},M=[R,r],D=[{"aria-pressed":k,onClick(G){var V;const B=!k,P=vt(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&&A(B))}},w,O],_=Nt("button",t,{enabled:!S,state:T,ref:M,props:D}),H=x.useMemo(()=>({disabled:E,focusableWhenDisabled:!1}),[E]);return S?n.jsx(A4,{tag:"button",render:h,className:a,style:y,metadata:H,state:T,refs:M,props:D}):_}),SQ=x.createContext(void 0);function NQ(){return x.useContext(SQ)}const CQ=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,...y}=t,w=yx(),C=NQ(),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,[k,A]=po({controlled:h,default:S,name:"ToggleGroup",state:"value"}),O=st((_,H,G)=>{let B;m?(B=k.slice(),H?B.push(_):B.splice(k.indexOf(_),1)):B=H?[_]:[],u==null||u(B,G),!G.isCanceled&&A(B)}),R={disabled:E,multiple:m,orientation:f},T=x.useMemo(()=>({disabled:E,setGroupValue:O,value:k,isValueInitialized:N}),[E,O,k,N]),M={role:"group"},D=Nt("div",t,{enabled:!!w,state:R,ref:r,props:[M,y]});return n.jsx(mD.Provider,{value:T,children:w?D:n.jsx(bM,{render:p,className:g,style:b,state:R,refs:[r],props:[M,y],loopFocus:c,enableHomeAndEndKeys:!0,orientation:f})})}),kQ=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"}}),hD=x.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function TQ({className:e,variant:t,size:r,spacing:a=2,orientation:i="horizontal",children:c,...u}){return n.jsx(CQ,{"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(hD.Provider,{value:{variant:t,size:r,spacing:a,orientation:i},children:c})})}function EQ({className:e,children:t,variant:r="default",size:a="default",...i}){const c=x.useContext(hD);return n.jsx(jQ,{"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",kQ({variant:c.variant||r,size:c.size||a}),e),...i,children:t})}const BR=[{value:"light",label:"Light mode",icon:H$},{value:"dark",label:"Dark mode",icon:f$},{value:"system",label:"Auto · Follow computer",icon:u$}];function RQ(){const{theme:e="system",setTheme:t}=UA(),r=Zs(),a=Math.max(0,BR.findIndex(i=>i.value===e));return n.jsx(Hu,{delay:200,children:n.jsxs(TQ,{"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(P4,{duration:12,shineColor:["var(--border)","var(--frame-highlight)","var(--ink-faint)"]})}),BR.map(({value:i,label:c,icon:u})=>n.jsxs(xa,{children:[n.jsx(ba,{render:n.jsx(EQ,{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(ya,{side:"top",children:c})]},i))]})})}const pD=x.createContext(void 0);function um(e){const t=x.useContext(pD);if(t===void 0&&!e)throw new Error(sn(47));return t}const AQ={...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 OQ extends Pu{constructor(r,a,i){const c=new Qf;super(MQ(r,c,a,i),DQ(c),AQ);an(this,"setOpen",(r,a)=>{var p,b;const i=a.reason===Qn,c=a.reason===ha&&a.event.detail===0,u=!r&&(a.reason===Hf||a.reason==null),f=Rw(a),m=this.select("activeTriggerId");if(!r&&a.reason===qO&&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 y=nx(this.state,r,a.trigger,f());y.openChangeReason=a.reason,this.update(y)};i?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(h5,()=>{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 MQ(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 DQ(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new xo,triggerElements:e}}const VR=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=IQ(m,{modal:f,open:i,openProp:a,activeTriggerId:g,triggerIdProp:h});p.useControlledProp("openProp",a),p.useControlledProp("triggerIdProp",h);const b=p.useState("open"),y=p.useState("mounted"),w=p.useState("payload");p.useContextCallback("onOpenChange",c),p.useContextCallback("onOpenChangeComplete",u),_5(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,vt(Ug))}),[C,p]);const S=b||y;return n.jsxs(pD.Provider,{value:p,children:[m&&n.jsx(tx,{handle:m,store:p}),S&&n.jsx(PQ,{store:p,modal:f}),typeof r=="function"?r({payload:w}):r]})});function zQ(e){return um(!0)?n.jsx(VR,{props:e}):n.jsx(N5,{children:n.jsx(VR,{props:e})})}function IQ(e,t){const r=Ew((a,i)=>new OQ(t,a,i));return x.useEffect(()=>r.context.stickIfOpenTimeout.disposeEffect(),[r]),r}function PQ({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,LQ=kw(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:y,...w}=t,C=um(!0),N=Mw(m)??C;if(!N)throw new Error(sn(74));const E=vs(y),k=N.useState("isTriggerActive",E),A=N.useState("floatingRootContext"),O=N.useState("isOpenedByTrigger",E),R=N.useState("triggerPopupId",E),T=x.useRef(null),{registerTrigger:M,isMountedByThisTrigger:D}=Aw(E,T,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=Pw(A,{enabled:!u&&g&&(G!=="touch"||_!==ha),mouseOnly:!0,move:!1,handleClose:_w(),restMs:p,delay:{close:b},triggerElementRef:T,isActiveTrigger:k,isClosing:()=>N.select("transitionStatus")==="ending"}),V=Sw(A,{stickIfOpen:H}),Y=Y5(()=>N.select("open"),K=>{N.set("openMethod",K)}),W=N.useState("triggerProps",D),{getButtonProps:q,buttonRef:ee}=bo({disabled:u,native:f}),z={open(K){return K&&_===ha?Xp.open(K):iw.open(K)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:X,handleFocusTargetFocus:te}=M4(N,T),U=Nt("button",t,{state:{disabled:u,open:O},ref:[ee,r,M,T],props:[V.reference,P,W,Y,{[p5]:"",id:E,"aria-haspopup":"dialog","aria-expanded":O,"aria-controls":R},w,q],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:te})]}):F}),gD=x.createContext(void 0);function $Q(){const e=x.useContext(gD);if(e===void 0)throw new Error(sn(45));return e}const BQ=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t;return um().useState("mounted")||a?n.jsx(gD.Provider,{value:a,children:n.jsx(Zg,{ref:r,...i})}):null}),xD=x.createContext(void 0);function VQ(){const e=x.useContext(xD);if(!e)throw new Error(sn(46));return e}const UQ=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:y,arrowPadding:w,sticky:C,disableAnchorTracking:S=!1,collisionAvoidance:N=yw,...E}=t,k=um(),A=$Q(),O=ww(),R=k.useState("floatingRootContext"),T=k.useState("mounted"),M=k.useState("open"),D=k.useState("openChangeReason"),_=k.useState("activeTriggerElement"),H=k.useState("modal"),G=k.useState("openMethod"),B=k.useState("positionerElement"),P=k.useState("instantType"),V=k.useState("transitionStatus"),Y=k.useState("adaptiveOrigin"),W=x.useRef(null),q=Gf(B),ee=xx({anchor:u,floatingRootContext:R,positionMethod:f,mounted:T,side:m,sideOffset:g,align:h,alignOffset:p,arrowPadding:w,collisionBoundary:b,collisionPadding:y,sticky:C,disableAnchorTracking:S,keepMounted:A,nodeId:O,collisionAvoidance:N,adaptiveOrigin:Y}),z=R.useState("domReferenceElement");We(()=>{const U=z,F=W.current;if(U&&(W.current=U),F&&U&&U!==F){k.set("instantType",void 0);const K=new AbortController;return q(()=>{k.set("instantType","trigger-change")},K.signal),()=>{K.abort()}}},[z,q,k]);const L=H===!0&&D!==Qn;Hw(M&&L,G==="touch",B,_);const X=k.useStateSetter("positionerElement"),te={open:M,side:ee.side,align:ee.align,anchorHidden:ee.anchorHidden,instant:P},$=bx(t,te,{styles:ee.positionerStyles,transitionStatus:V,props:E,refs:[r,X],hidden:!T,inert:!M});return n.jsxs(xD.Provider,{value:ee,children:[T&&L&&n.jsx(cx,{inert:Jf(!M),cutout:_}),n.jsx(S5,{id:O,children:$})]})}),HQ=x.createContext(void 0);function FQ(){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 GQ=x.forwardRef(function(t,r){const{render:a,className:i,style:c,initialFocus:u,finalFocus:f,...m}=t,h=um(),g=VQ(),p=yx()!=null,{context:b,hasClosePart:y}=FQ(),w=h.useState("open"),C=h.useState("openMethod"),S=h.useState("instantType"),N=h.useState("transitionStatus"),E=h.useState("popupProps"),k=h.useState("titleElementId"),A=h.useState("descriptionElementId"),O=h.useState("modal"),R=h.useState("mounted"),T=h.useState("openChangeReason"),M=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 ee,z;w&&((z=(ee=h.context).onOpenChangeComplete)==null||z.call(ee,!0))}}),Iw(D,{enabled:G&&!H,closeDelay:B});const P=u===void 0?P5(h.context.popupRef):u,V=O!==!1&&y;h.useSyncedValue("focusManagerModal",V);const Y=h.useStateSetter("popupElement"),W={open:w,side:g.side,align:g.align,instant:S,transitionStatus:N},q=Nt("div",t,{state:W,ref:[r,h.context.popupRef,Y],props:[E,{id:_,role:"dialog",...Wf,"aria-labelledby":k,"aria-describedby":A,onKeyDown(ee){p&&Zf.has(ee.key)&&ee.stopPropagation()}},tm(N),m],stateAttributesMapping:Hg});return n.jsx(Jg,{context:D,openInteractionType:C,modal:V,disabled:!R||T===Qn,initialFocus:P,returnFocus:f,restoreFocus:"popup",previousFocusableElement:wn(M)?M:void 0,nextFocusableElement:h.context.triggerFocusTargetRef,beforeContentFocusGuardRef:h.context.beforeContentFocusGuardRef,children:n.jsx(HQ.Provider,{value:b,children:q})})});function $p({...e}){return n.jsx(zQ,{"data-slot":"popover",...e})}function Bp({...e}){return n.jsx(LQ,{"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(BQ,{children:n.jsx(UQ,{align:t,alignOffset:r,side:a,sideOffset:i,className:"isolate z-50",children:n.jsx(GQ,{"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 qj(e){return Nt(e.defaultTagName??"div",e,e)}const rv=768;function qQ(){const[e,t]=x.useState(void 0);return x.useEffect(()=>{const r=window.matchMedia(`(max-width: ${rv-1}px)`),a=()=>{t(window.innerWidth<rv)};return r.addEventListener("change",a),t(window.innerWidth<rv),()=>r.removeEventListener("change",a)},[]),!!e}const YQ="sidebar_state",KQ=3600*24*7,XQ="16rem",WQ="18rem",QQ="3rem",ZQ="b",bD=x.createContext(null);function Yj(){const e=x.useContext(bD);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function JQ({defaultOpen:e=!0,open:t,onOpenChange:r,className:a,style:i,children:c,...u}){const f=qQ(),[m,h]=x.useState(!1),[g,p]=x.useState(e),b=t??g,y=x.useCallback(N=>{const E=typeof N=="function"?N(b):N;r?r(E):p(E),document.cookie=`${YQ}=${E}; path=/; max-age=${KQ}`},[r,b]),w=x.useCallback(()=>f?h(N=>!N):y(N=>!N),[f,y,h]);x.useEffect(()=>{const N=E=>{E.key===ZQ&&(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:y,isMobile:f,openMobile:m,setOpenMobile:h,toggleSidebar:w}),[C,b,y,f,m,h,w]);return n.jsx(bD.Provider,{value:S,children:n.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":XQ,"--sidebar-width-icon":QQ,...i},className:Ve("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...u,children:c})})}function eZ({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}=Yj();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":WQ},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 tZ({className:e,onClick:t,...r}){const{toggleSidebar:a}=Yj();return n.jsxs(ie,{"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(x$,{}),n.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function nZ({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 sZ({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 rZ({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 oZ({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 UR({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 HR({className:e,render:t,...r}){return qj({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 FR({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 GR({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 qR({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 aZ=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}=Yj(),h=qj({defaultTagName:"button",props:Qs({className:Ve(aZ({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(ya,{side:"right",align:"center",hidden:m!=="collapsed"||f,...i})]})):h}const iZ=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 lZ({className:e,variant:t="default",render:r,...a}){return qj({defaultTagName:"span",props:Qs({className:Ve(iZ({variant:t}),e)},a),render:r,state:{slot:"badge",variant:t}})}const yD=x.createContext(null),Kj=()=>x.useSyncExternalStore(ln.subscribe,ln.getSnapshot);function cZ({children:e}){const t=Kj(),[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=()=>ln.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){ln.setSharing(h),a(null)}function f(){r==="usage-details"?a("usage"):r==="usage"?u(!1):a(null)}const m=r==="details"||r==="usage-details";return n.jsxs(yD.Provider,{value:c,children:[e,n.jsx(en,{open:!!r,onOpenChange:h=>{h||f()},children:n.jsx(tn,{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(nn,{children:[n.jsx(Qt,{children:"Help improve OpenRod"}),n.jsx(Rn,{children:"Share anonymous usage data with us?"})]}),n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx(ie,{type:"button",size:"sm",variant:"outline",onClick:()=>u(!1),children:"No thanks"}),n.jsx(ie,{type:"button",size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>u(!0),children:"Share"})]}),n.jsx(ie,{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(nn,{children:[n.jsx(Qt,{children:"Usage and feedback"}),n.jsx(Rn,{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(lZ,{variant:t.available&&t.sharing?"secondary":"outline",children:t.available&&t.sharing?"On":"Off"})]}),t.available&&(t.sharing?n.jsx(ie,{size:"sm",variant:"outline",onClick:()=>u(!1),children:"Turn off"}):n.jsx(ie,{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(ie,{size:"sm",variant:"outline",onClick:()=>a("feedback"),children:"Give feedback"}),n.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>c("details"),children:"What do you collect?"})]})]}):m?n.jsx(dZ,{onClose:f}):r==="feedback"?n.jsx(fZ,{canSend:t.available,onClose:()=>a(null)}):null})})]})}function uZ(){const e=x.useContext(yD);return e?n.jsxs(D1,{size:"sm",className:"text-muted-foreground",onClick:()=>e(),children:[n.jsx(l$,{"aria-hidden":"true"}),"Usage & feedback"]}):null}function dZ({onClose:e}){return n.jsxs(n.Fragment,{children:[n.jsxs(nn,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[n.jsx(Qt,{children:"What we collect"}),n.jsx(Rn,{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:"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(ie,{type:"button",size:"sm",variant:"outline",onClick:e,children:"Done"})})]})}function fZ({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(),!ln.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(nn,{children:[n.jsx(Qt,{children:"Give feedback"}),n.jsx(Rn,{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(Uu,{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(ie,{type:"button",variant:"ghost",size:"sm",onClick:t,children:"Cancel"}),n.jsx(ie,{type:"button",variant:"outline",size:"sm",disabled:!r.trim(),onClick:f,children:"Copy text"}),n.jsx(ie,{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 mZ=[{label:"Sandboxes",icon:mc,view:"sandboxes"},{label:"Templates",icon:t$,view:"templates"},{label:"MCPs & Skills",icon:J1,view:"setups"},{label:"Activity",icon:rL,view:"activity"},{label:"Connections",icon:yL,view:"connections"}],hZ=[{label:"Groups",icon:Ka,view:"groups"},{label:"Network",icon:Ig,view:"egress",also:["ingress"]},{label:"Secrets",icon:Du,view:"secrets"}],YR={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 pZ({view:e,onNavigate:t}){const{connection:r,overview:a}=oi(),i=YR[r]??YR.connecting,c=a==null?void 0:a.gateway;return n.jsxs(eZ,{collapsible:"offcanvas",className:"border-r border-sidebar-border",children:[n.jsx(sZ,{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(oZ,{className:"px-3 pt-4",children:[n.jsxs(UR,{className:"p-0",children:[n.jsx(HR,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Environment"}),n.jsx(FR,{children:n.jsx(GR,{children:mZ.map(({label:u,icon:f,view:m})=>n.jsx(qR,{children:n.jsxs(D1,{isActive:e===m,onClick:()=>t(m),children:[n.jsx(f,{}),u]})},m))})})]}),n.jsxs(UR,{className:"p-0 pt-4",children:[n.jsx(HR,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Security"}),n.jsx(FR,{children:n.jsx(GR,{children:hZ.map(({label:u,icon:f,view:m,also:h=[]})=>n.jsx(qR,{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(rZ,{className:"border-t border-sidebar-border p-4",children:[n.jsx(uZ,{}),n.jsx(RQ,{}),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(gZ,{})]})]})]})]})}function gZ(){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(ie,{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 xZ=864e5;function bZ(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*xZ;for(;u<a.length&&a[u]<=m;)u++;c.push({at:m,count:u+i})}return c}const yZ=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"});function vZ({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 A=a.current;if(!A)return;const O=()=>f(A.clientWidth);O();const R=new ResizeObserver(O);return R.observe(A),()=>R.disconnect()},[]);const g=Math.max(4,Math.round(t*.18)),p=e.map(A=>A.count),b=Math.max(1,...p),y=A=>(e.length<2?u-12:A/(e.length-1)*(u-12))+6,w=A=>t-g-A/b*(t-g*2),C=v4(p.map((A,O)=>[y(O),w(A)])),S=`${C} L${y(e.length-1).toFixed(2)} ${t} L${y(0).toFixed(2)} ${t} Z`,N=m===null?null:e[m],E=p[0]??0,k=p[p.length-1]??0;return n.jsxs("div",{className:"relative w-full",onMouseLeave:()=>h(null),onMouseMove:A=>{const O=A.currentTarget.getBoundingClientRect(),R=(A.clientX-O.left)/Math.max(1,O.width);h(Math.min(e.length-1,Math.max(0,Math.round(R*(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:[yZ(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, ${k} 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:y(m),x2:y(m),y1:"0",y2:t,stroke:"var(--ink)",strokeWidth:"1",strokeDasharray:"2 3",opacity:"0.25"}),n.jsx("circle",{cx:y(m),cy:w(p[m]),r:"3",fill:"var(--surface)",stroke:"var(--ink)",strokeWidth:"1.5"})]})]})})]})}const wZ=e=>e?new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"",jZ={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},SZ=e=>e?jZ[e]??e:null;function NZ({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:wZ(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?SZ(e.reason):(i=e.policy)==null?void 0:i.replace(/^_provider_/,"provider · ")})]})}function CZ({children:e,className:t,variant:r="outline",size:a="sm"}){return n.jsx(Hu,{delay:200,children:n.jsxs(xa,{children:[n.jsxs(ba,{render:n.jsx(ie,{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:[" ",hk]})]}),n.jsx(ya,{side:"bottom",className:"max-w-60",children:hk})]})})}function vD(e=[],t){const r=Ej(t);return e.filter(a=>!a.appliesTo.everyone&&a.appliesTo.groups.some(i=>r.includes(i)))}function Xj(){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 y=i.current;y&&(i.current=null,y.cleanup(),b&&t(null),p?y.reject(p):y.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 y=await g.org();if(!c.current)throw new DOMException("Workspace transfer cancelled.","AbortError");b==null||b.throwIfAborted();const w=(y.groups??[]).filter(C=>vD(y.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(en,{open:!!e,onOpenChange:g=>{g||f()},children:n.jsxs(tn,{className:"sm:max-w-md",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:"Choose a destination group"}),n.jsxs(Rn,{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(ie,{variant:"ghost",onClick:f,children:"Cancel"}),n.jsx(ie,{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",kZ=e=>`${Rg}/?handoff=cloud&target=local#cloud-return=${encodeURIComponent(e)}`;function KR(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 TZ({name:e,sandbox:t}){const r=Pt(),a=js(),i=gn(),{refresh:c}=yo(),{chooseGroups:u,dialog:f}=Xj(),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 y=r.signal?AbortSignal.any([r.signal,b.signal]):b.signal;g("signin");try{await a.prepare({signal:y,onProgress:()=>g("prepare")});const w=lr("cloud",y);g("groups");const C=await u(w,"cloud",y);g("transfer");const S=await LO(lr(r.target,y,i==null?void 0:i.context),w,e,C);y.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(ie,{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(Rt,{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(Hu,{delay:200,children:n.jsxs(xa,{children:[n.jsx(ba,{render:n.jsx(ie,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"What this does",className:"text-muted-foreground"}),children:n.jsx(Mu,{className:"size-3.5","aria-hidden":"true"})}),n.jsx(ya,{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(CZ,{className:"w-full justify-start text-xs",children:[n.jsx(Kp,{className:"size-3.5","aria-hidden":"true"}),"Continue in cloud"]})}function EZ({name:e,sandbox:t}){const r=Pt(),a=js(),i=gn(),{locations:c,refresh:u}=yo(),{chooseGroups:f,dialog:m}=Xj(),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(KR(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||!KR(N,E.popup,E.nonce,"openrod-local-ready"))){E.accepted=!0,p("transfer");try{const k=await r.cloudExport(E.name);E.warning=k.warning,E.popup.postMessage({type:"openrod-local-bundle",nonce:E.nonce,bundle:k.bundle,warning:k.warning},Rg)}catch(k){E.popup.postMessage({type:"openrod-local-bundle",nonce:E.nonce,error:k.message},Rg),b.current===E&&(b.current=null),w&&(p(null),He.error("Couldn’t continue locally",{description:k.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 y(){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 k=await aB(lr(r.target,S,i==null?void 0:i.context),N,e,E);S.throwIfAborted(),He.success("Workspace running locally",{description:k.warning||"Your cloud source is unchanged. Reconnect agent credentials locally."});try{sessionStorage.setItem("gateway-box",JSON.stringify({name:k.name,context:w.context,target:"local"}))}catch{}u(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"sandboxes"}})),window.dispatchEvent(new CustomEvent("openrod-sandbox-handoff",{detail:{name:k.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(ie,{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){y();return}const w=crypto.randomUUID(),C=window.open(kZ(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(Rt,{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(Hu,{delay:200,children:n.jsxs(xa,{children:[n.jsx(ba,{render:n.jsx(ie,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"What this does",className:"text-muted-foreground"}),children:n.jsx(Mu,{className:"size-3.5","aria-hidden":"true"})}),n.jsxs(ya,{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",XR=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 wD=e=>e.startsWith("~/")?`~/${Ou(e.slice(2))}`:Ou(e),z1=(e,t,r=$a)=>`openshell sandbox upload ${Ou(e)} ${wD(t)} ${Ou(r)}`,RZ=(e,t,r=".")=>`openshell sandbox download ${Ou(e)} ${Ou(t)} ${wD(r)}`,Up=new Set(["waiting","uploading","cloning"]),AZ=(e,t)=>e==="/"?`/${t}`:`${e}/${t}`,op=e=>e.type==="dir"||e.targetType==="dir";function OZ(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 MZ(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 DZ({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(Rt,{"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(ie,{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(GL,{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 zZ(e){const t=gn();return n.jsx(IZ,{...e},`${(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default"}:${e.sandbox.name}`)}function IZ({sandbox:e,demo:t}){const r=Pt(),a=gn(),i=e.name,c=e.phase==="ready",u=YY(e),[f,m]=x.useState(u?`${$a}/${u}`:$a),[h,g]=x.useState(null),[p,b]=x.useState(null),[y,w]=x.useState(!1),[C,S]=x.useState(null),[N,E]=x.useState(!1),[k,A]=x.useState(null),[O,R]=x.useState(null),[T,M]=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 te=await r.seed(i);if(z)return;S(te),te&&Up.has(te.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){M(z);const X=He.loading(`Preparing ${L}…`);try{const{token:te,filename:$,bytes:U}=await r.prepareDownload(i,z),F=document.createElement("a");F.href=r.url(`/downloads/${te}`,{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(te){He.error(te.message,{id:X})}finally{M(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>XR){He.error(`That is ${br(L)}; the console uploads up to ${br(XR)}.`,{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 te=[...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:te};te.length?R($):Y($)}async function Y({files:z,bytes:L,dir:X}){R(null);const te=new AbortController;let $;A({done:0,total:z.length,sent:0,bytes:L,committing:!1,controller:te});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&&!te.signal.aborted;){const K=z[U++];try{await r.uploadFile(i,$,K.path,K.file,te.signal)}catch(se){throw te.abort(),se}A(se=>se&&{...se,done:se.done+1,sent:se.sent+K.file.size})}})),A(K=>K&&{...K,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(te.signal.aborted&&U.name==="AbortError"?"Upload cancelled.":U.message)}finally{A(null)}}async function W(z){if(z.preventDefault(),E(!1),!c||k)return;const L=OZ(z.dataTransfer);try{V(await MZ(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 q=f.split("/").filter(Boolean).map((z,L,X)=>({label:z,path:`/${X.slice(0,L+1).join("/")}`})),ee=(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&&!k&&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(DZ,{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:q.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===q.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(ie,{variant:"ghost",size:"icon-sm","aria-label":"Refresh",disabled:!c||y,onClick:()=>_(f),children:n.jsx(rl,{className:y?"animate-spin":void 0,"aria-hidden":"true"})}),n.jsxs(ie,{variant:"outline",size:"sm",disabled:!c||!!T,onClick:()=>P(f,`${f.split("/").pop()}.tar.gz`),children:[T===f?n.jsx(Rt,{"aria-hidden":"true"}):n.jsx(pu,{"aria-hidden":"true"}),"Download folder"]}),n.jsxs(ie,{variant:"outline",size:"sm",disabled:!c||!!k,onClick:()=>{var z;return(z=D.current)==null?void 0:z.click()},children:[n.jsx(X$,{"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)}})]}),k&&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(Rt,{"aria-hidden":"true"}),n.jsx("span",{className:"flex-1",children:k.committing?`Sending ${k.total.toLocaleString()} ${k.total===1?"file":"files"} to ${f}…`:`Reading ${k.done.toLocaleString()} of ${k.total.toLocaleString()} files · ${br(k.sent)} of ${br(k.bytes)}`}),!k.committing&&n.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>k.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"}),".."]})}),ee.map(z=>{const L=AZ(f,z.name),X=z.type==="link"?MO:op(z)?Ak:HL,te=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:te}):n.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 py-0.5 font-mono text-xs",children:te}),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:_u(z.modifiedAt)}),n.jsx(ie,{variant:"ghost",size:"icon-sm","aria-label":`Download ${z.name}`,className:"opacity-60 group-hover:opacity-100",disabled:!!T||z.targetType==="missing",onClick:()=>P(L,op(z)?`${z.name}.tar.gz`:z.name),children:T===L?n.jsx(Rt,{"aria-hidden":"true"}):n.jsx(pu,{"aria-hidden":"true"})})]},z.name)}),!ee.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 ",ee.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:RZ(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:!!O,onOpenChange:z=>{z||R(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Replace ",(O==null?void 0:O.taken.length)===1?`“${O.taken[0]}”`:`${O==null?void 0:O.taken.length} items`,"?"]}),n.jsxs(Xr,{children:[(O==null?void 0:O.taken.length)>1&&n.jsxs("span",{className:"mb-2 block font-mono text-[11px]",children:[O.taken.slice(0,6).join(", "),O.taken.length>6?", …":""]}),"Files with the same name in ",O==null?void 0:O.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:()=>Y(O),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(kO,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground",strokeWidth:1.5}),n.jsx("span",{className:"truncate",children:e.name})]})}function WR({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 PZ(){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=ln.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),[y,w]=x.useState("ssh"),[C,S]=x.useState(!1),[N,E]=x.useState(!1),[k,A]=x.useState(null);x.useEffect(()=>{if(r)return;let B=!1;return g(null),b(null),w("ssh"),A(null),c.sshConnection(e).then(P=>{B||(g(P),w(P.defaultMode))}).catch(P=>{B||b(P.message)}),()=>{B=!0}},[e,r,c]);const O=(h==null?void 0:h.modes[y])??(h==null?void 0:h.modes.ssh),R=y==="ssh"?"Open SSH in terminal":y==="attach"?"Attach canonical TTY":`New ${((G=o4(O==null?void 0:O.session))==null?void 0:G.toLowerCase())??"session"}`,T=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 M(B){const P=m(B.id);S(!0);try{await c.openEditor(e,B.id),ln.finishFlow(P,"handoff_requested"),He.success(`Opening ${e} in ${B.label}`)}catch(V){ln.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,y),ln.finishFlow(B,"handoff_requested"),He.success(y==="ssh"?`Opening SSH to ${e}`:y==="attach"?`Attaching to ${e}`:`Starting a new session in ${e}`)}catch(P){ln.finishFlow(B,"failed",Cu(P)),He.error("Couldn’t open SSH terminal",{description:P.message})}finally{S(!1)}}async function _(){E(!0);try{A(await c.sshConfig(e))}catch(B){He.error("Couldn’t generate SSH config",{description:B.message})}finally{E(!1)}}const H=n.jsxs(ie,{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)?yg(e,void 0,a):void 0,onClick:B=>ln.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(ie,{variant:"outline",size:"sm",className:"justify-start text-xs",disabled:!(h!=null&&h.canOpenTerminal)||C,title:T??R,onClick:D,children:[C?n.jsx(Rt,{className:"size-3.5"}):n.jsx(PO,{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(ie,{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:()=>M(B),children:[n.jsx("img",{src:`/logos/${B.id}.svg`,alt:"",className:"size-3.5 dark:invert"}),B.label]},B.id)}),H]}),T&&n.jsx("p",{role:p?"alert":"status",className:"mt-2 text-[11px] text-muted-foreground",children:T}),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(ie,{type:"button",variant:y==="ssh"?"secondary":"ghost",size:"xs",onClick:()=>w("ssh"),children:"SSH shell"}),n.jsx(ie,{type:"button",variant:y==="exec"?"secondary":"ghost",size:"xs",onClick:()=>w("exec"),children:"New session"}),h.modes.attach&&n.jsx(ie,{type:"button",variant:y==="attach"?"secondary":"ghost",size:"xs",onClick:()=>w("attach"),children:"Attach"})]}),n.jsx("p",{className:"text-[10px] leading-relaxed",children:y==="ssh"?"Login shell over SSH.":y==="attach"?"Reconnects to the sandbox’s running terminal.":"Starts a separate shell or agent in the sandbox."}),O&&n.jsx(uc,{command:O.command,label:y==="ssh"?`ssh ${O.alias}`:`openshell sandbox ${y==="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(ie,{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(Rt,{className:"size-3.5"}):n.jsx(P$,{className:"size-3.5"}),"SSH configuration"]})]})]})]}),n.jsx(en,{open:!!k,onOpenChange:B=>{B||A(null)},children:n.jsxs(tn,{className:"sm:max-w-2xl",children:[n.jsxs(nn,{children:[n.jsxs(Qt,{children:["SSH configuration for ",e]}),n.jsx(Rn,{children:"The console does not change ~/.ssh/config. Review and add this Host block yourself, then connect with the command below."})]}),k&&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:k.config}),n.jsx(uc,{command:k.command}),n.jsx(ie,{variant:"outline",onClick:async()=>{try{await navigator.clipboard.writeText(k.config),He.success("SSH config copied")}catch{He.error("Couldn’t copy SSH config")}},children:"Copy Host block"})]})]})})]})}const LZ={"read-only":"read-only","read-write":"read-write",full:"full",custom:"custom rules",blocked:"blocked"},$Z={secret:"from provider",policy:"network rule",org:"blocked everywhere",group:"inherited",agent:"agent defaults",own:"rule"};function BZ(e){var r;const t=gn();return t&&!((r=e.liveData)!=null&&r.demo)?n.jsx(Ef,{children:n.jsx(QR,{...e,scoped:!0},e.name)},t.id??t.context):n.jsx(QR,{...e},e.name)}function QR({name:e,sandbox:t,onClose:r,onNavigate:a,onChanged:i,liveData:c,scoped:u}){var $,U,F,K,se,ne,ve;const f=Pt(),m=gn(),h=oi(),g=u?h:c??h,p=ae=>a(ae,m),[b,y]=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,k]=x.useState(null),[A,O]=x.useState(null),[R,T]=x.useState(!1),M=js(),D=!!(M!=null&&M.nativeActions),_=!!(m!=null&&m.cloud||((m==null?void 0:m.target)??(M==null?void 0:M.target))==="cloud"),H=PZ(),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),k((m==null?void 0:m.error)??null);return}if(N(null),k(null),g.demo)return;let ae=!1,le,re=3e4;const Q=async()=>{var Z;try{const pe=await f.sandbox(e);ae||(N(pe),k(null),re=(Z=pe.setupJobs)!=null&&Z.some(ue=>ue.status==="waiting")?2e3:3e4)}catch(pe){ae||k(pe.message)}ae||(le=setTimeout(Q,re))};return Q(),()=>{ae=!0,clearTimeout(le)}},[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 Y(ae){var le;if((m==null?void 0:m.connected)!==!1){O(ae);try{await f.lifecycle(e,ae),He.success(ae==="delete"?`Deleting ${e}`:ae==="stop"?`Stopping ${e}`:`Starting ${e}`),i==null||i(),(le=g.refresh)==null||le.call(g),ae==="delete"&&r()}catch(re){He.error(re.message)}finally{O(null),T(!1)}}}const W=x.useMemo(()=>g.events.filter(ae=>ae.sandbox===e),[g.events,e]),q=x.useMemo(()=>w4(W,b,w),[W,b,w]),ee=x.useMemo(()=>{var le;const ae=new Map;for(const re of((le=S==null?void 0:S.policy)==null?void 0:le.rules)??[])for(const Q of re.endpoints)!Q.blocked&&!ae.has(Q.host)&&ae.set(Q.host,{host:Q.host,source:qa(re.key)});return[...ae.values()]},[S]),z=x.useMemo(()=>{const ae=new Map;for(const le of W){if(le.kind!=="audit"||le.verdict!=="denied")continue;const re=Mj(le.destination);if(!re)continue;const Q=ae.get(re)??{host:re,count:0};Q.count+=1,ae.set(re,Q)}return[...ae.values()].sort((le,re)=>re.count-le.count)},[W]),L=r4(P),X=P==null?void 0:P.phase,te=((U=S==null?void 0:S.policy)==null?void 0:U.rules)??[];return n.jsxs(n.Fragment,{children:[n.jsx(en,{open:!!e,onOpenChange:ae=>{ae||r()},children:n.jsxs(tn,{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(nn,{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(mc,{"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?ee.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(Rn,{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(nm,{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(sm,{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:te.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(pW,{compact:!0,fill:!0,agentStatus:Wy(P),agents:L,name:e,phase:X,allowed:ee,denied:z,owner:uf(P,M!=null&&M.connected?M.user:null),gateway:g.demo||(F=g.overview)==null?void 0:F.gateway,secrets:(P.providers??[]).map(ae=>{var le,re;return((re=(le=g.overview)==null?void 0:le.providers)==null?void 0:re.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}:{...(K=g.overview)==null?void 0:K.gateway,target:M==null?void 0:M.target}},e),!g.demo&&X==="ready"&&(m==null?void 0:m.connected)!==!1&&(_?n.jsx(EZ,{name:e,sandbox:P},e):n.jsx(TZ,{name:e,sandbox:P},e)),n.jsxs(Yl,{title:"At a glance",children:[(se=P.setupJobs)==null?void 0:se.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",uf(P,M!=null&&M.connected?M.user:null)],[L.length===1?"AI agent":"AI agents",n.jsx(WR,{agents:L,status:Wy(P)})],["Image",_p(P.image,P.imageTemplateName)],["Providers",P.providers.join(", ")||"None"],["Created",wf(P.createdAt)],["Policy",S?`v${S.policyVersionNumber??P.policyVersion} · ${S.policySource??"sandbox"}`:"Not reported"]].map(([ae,le])=>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:le})]},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"]}),lQ(P.problem)&&n.jsx(vQ,{local:!_&&!(m?m.remote:(ve=(ne=g.overview)==null?void 0:ne.gateway)!=null&&ve.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?te.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:te.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:lf(ae.key)}),n.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:$Z[qa(ae.key)]})]}),n.jsx("ul",{className:"mt-1.5 space-y-0.5",children:ae.endpoints.map(le=>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 ${le.blocked?"bg-red-500":"bg-emerald-500"}`,"aria-hidden":"true"}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[le.host,le.port?`:${le.port}`:""]}),n.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[LZ[le.access]??le.access,le.tlsSkip?" · TLS passthrough":"",le.protocol!=="tcp"&&le.enforcement==="audit"?" · audit only":""]})]},`${le.host}:${le.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(le=>le.split("/").pop()).filter((le,re,Q)=>Q.indexOf(le)===re).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(oD,{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(zZ,{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:()=>y(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(j4,{points:q,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(NZ,{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",uf(P,M!=null&&M.connected?M.user:null)],["Image",_p(P.image,P.imageTemplateName),!0],...P.image&&_p(P.image,P.imageTemplateName)!==P.image?[["Image reference",P.image,!0]]:[],["Command",wW(P.command),!0],[L.length===1?"AI agent":"AI agents",n.jsx(WR,{agents:L,status:Wy(P)})],["Providers",P.providers.join(", ")||"None"],["Created",wf(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,le,re,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 ${re?"font-mono text-xs":"text-sm"}`,children:le??"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:[yW(X)&&n.jsxs(ie,{variant:"outline",size:"sm",disabled:!!A||(m==null?void 0:m.connected)===!1,onClick:()=>Y("stop"),children:[A==="stop"?n.jsx(Rt,{"aria-hidden":"true"}):n.jsx(V$,{"aria-hidden":"true"}),"Stop"]}),vW(X)&&n.jsxs(ie,{variant:"outline",size:"sm",disabled:!!A||(m==null?void 0:m.connected)===!1,onClick:()=>Y("start"),children:[A==="start"?n.jsx(Rt,{"aria-hidden":"true"}):n.jsx(zO,{"aria-hidden":"true"}),"Start"]}),n.jsxs(ie,{variant:"outline",size:"sm",disabled:!!A||(m==null?void 0:m.connected)===!1||X==="deleting",className:"border-destructive/30 text-destructive hover:bg-destructive/5 hover:text-destructive",onClick:()=>T(!0),children:[n.jsx(ts,{"aria-hidden":"true"}),"Delete"]})]})]})}),n.jsx(Fr,{open:R,onOpenChange:T,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:()=>Y("delete"),disabled:A==="delete",children:[A==="delete"&&n.jsx(Rt,{"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"],ov=["generativelanguage.googleapis.com","cloudcode-pa.googleapis.com","oauth2.googleapis.com","accounts.google.com","www.googleapis.com","aiplatform.googleapis.com","*.aiplatform.googleapis.com"],VZ=new Set(["cloudcode-pa.googleapis.com","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"]),UZ=e=>({...Do(e),...VZ.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))}),ff={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"],ov),pi:{...Pi("Pi",[...ap,"/usr/local/bin/pi"],[...ip,...ov,"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:[...[...ov,"antigravity.google","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"].map(UZ),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])},HZ=e=>({host:e,ports:[443],protocol:"rest",enforcement:"enforce",allow:[{method:"GET",path:"/**"}]}),ZR={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(HZ)}},Wj=(e=[])=>e.filter(t=>{var r;return(r=ff[t])==null?void 0:r.connectors}),FZ=["ANTHROPIC_API_KEY","CLAUDE_API_KEY","OPENAI_API_KEY"],GZ=e=>{var t;return!!((t=e==null?void 0:e.credentialKeys)!=null&&t.some(r=>FZ.includes(r)))};function qZ(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 jD(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=>!Wj(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=>ff[a]).map(a=>({id:a,rule:`agent-${a}`,...qZ(ff[a],t.includes(a))})),...[...new Set(e.runtimes??[])].filter(a=>ZR[a]).map(a=>({id:a,...ZR[a]}))],unsupported:r.filter(a=>!ff[a])}}const dc=Ws.filter(e=>!jD({source:"build",agents:[e.id]}).unsupported.length);function Qj(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 YZ(e,t){const r=Qj(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 Zj(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=Qj(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 KZ(e,t,r="agent",a=!1,i=[]){const c=Zj(t,"",r,a,i);return e.find(u=>u.managed&&u.status==="ready"&&u.image&&u.build===HY(c)&&JSON.stringify(na({...u.recipe,name:""}))===JSON.stringify(c))}function JR(e,t){const r={claude:["claude-code"],codex:["codex"]}[t]||[];return e.filter(a=>r.includes(a.type))}const SD=(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 XZ(e,t,{openIn:r="agent",withSetups:a=!1,setups:i=[],signal:c,onProgress:u=()=>{},onBuild:f=()=>{},onBuildUpdate:m=()=>{},wait:h=SD}={}){const g=()=>{if(c!=null&&c.aborted)throw new DOMException("Preparation cancelled.","AbortError")};g();const p=await e.imageTemplates();g();const b=KZ(p,t,r,a,i);if(b)return m(b),b;const y=Qj(t),C=`q-${(y.length>1?"agents":y[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(Zj(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(k=>k.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 ND(e,t,r,{signal:a,expectedRevisions:i={},onProgress:c=()=>{},wait:u=SD}={}){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 y;try{y=await e.prepareLaunchSetup(p,b.revision);for(let w=0;y.status==="running"&&w<900;w++)f(),c(y.message||`Preparing ${b.name}…`),await u(2e3,a),f(),y=await e.setupPreparation(y.id);if(f(),y.status!=="complete"||!y.setup)throw new Error(y.message||"Package preparation did not finish. Retry creation.");h.push(y.setup),g&&(g[y.setup.id]=y.setup.revision)}catch(w){throw y!=null&&y.id&&y.status==="running"&&await e.cancelSetupPreparation(y.id).catch(()=>{}),w}}return{setups:h,accessReview:g}}const vr=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),CD=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>dc.find(t=>t.id===e)).filter(Boolean),eA=dc.filter(e=>!CD.includes(e)),WZ=[{id:"empty",label:"Empty"},{id:"folder",label:"Local folder"},{id:"repo",label:"Git repository"}];function QZ(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 ZZ={gitignore:".gitignore applied","gitignore-empty":".gitignore matched nothing, so everything is sent",none:"Not a git repository, so everything is sent"},JZ={included:e=>`git history included (${br(e.gitBytes)})`,worktree:()=>"Git worktree: history not included",subfolder:()=>"Inside a repository: history not included",none:()=>null};function eJ({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:[ZZ[e.filter],JZ[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 tJ({org:e,value:t,onChange:r,onCreated:a,onAddPolicy:i,invalid:c=!1}){const u=Zs(),f=vD(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(ie,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:i,children:"Add network rule"})]})})}function tA(e,t){const r=lo.getSnapshot().filter(a=>a.status!=="failed"&&a.status!=="cancelled"&&vr(a.location)===vr(t));return new Set([...e.map(a=>a.name),...r.map(a=>a.name)])}function nA(e,t="sandbox"){for(let r=1;r<1e3;r++){const a=`${t}-${r}`;if(!e.has(a))return a}return""}function kD({locations:e,location:t,onLocationChange:r,onRefreshLocations:a,allowRemote:i=!1,initialLocationConfirmed:c=!1,...u}){var M;const f=gn(),m=Pt(),[h,g]=x.useState(null),p=(M=u.initialImageTemplate)==null?void 0:M.location,b=e??[],y=p??t,w=y?b.find(D=>vr(D)===vr(y))??(vr(f)===vr(y)?f:y):b.find(D=>vr(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,k]=x.useState(null),A=x.useRef(null);x.useEffect(()=>{u.open&&!A.current&&(A.current=ln.exploreFlow("sandbox_creation")),u.open||(A.current=null)},[u.open]),x.useEffect(()=>{u.open&&ln.step(A.current,C&&S==="where"?"location":"configuration")},[u.open,C,S]);function O(D){var _;!D&&!((_=A.current)!=null&&_.submitted)&&ln.finishFlow(A.current,"cancelled"),u.onOpenChange(D)}x.useEffect(()=>{u.open||g(null),N(c?"form":"where"),k(null)},[u.open,c]);const R=D=>{const _=b.find(H=>vr(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){k(null),R(vr(D)),N("form");return}const _=setInterval(()=>a==null?void 0:a(),1500);return()=>clearInterval(_)},[E,b]);const T=C&&S==="where"?n.jsx(Mx,{locations:b,allowRemote:i,connecting:!!E,onPick:D=>{R(D),N("form")},onConnected:D=>{k(D.gateway),a==null||a()},onCancel:()=>O(!1)}):null;return n.jsx(Zn,{location:w,children:n.jsx(nJ,{...u,onOpenChange:O,analyticsFlow:A,locations:b,onLocationChange:R,chooser:T,onChangeLocation:C?()=>N("where"):void 0},vr(w)??"default")})}function nJ({open:e,onOpenChange:t,onStarted:r,initialImageTemplate:a=null,locations:i,onLocationChange:c,chooser:u,onChangeLocation:f,analyticsFlow:m}){var Ze,kt;const h=Pt(),g=gn(),p=Zs(),[b,y]=x.useState([]),[w,C]=x.useState([]),[S,N]=x.useState(""),E=x.useRef(!1),[k,A]=x.useState([]),[O,R]=x.useState([]),[T,M]=x.useState(null),[D,_]=x.useState(""),[H,G]=x.useState([]),[B,P]=x.useState("quick"),[V,Y]=x.useState([]),[W,q]=x.useState("shell"),[ee,z]=x.useState({}),[L,X]=x.useState([]),[te,$]=x.useState(null),[U,F]=x.useState(null),[K,se]=x.useState("empty"),ne=js(),ve=!!(g!=null&&g.cloud||((g==null?void 0:g.target)??(ne==null?void 0:ne.target))==="cloud"),[ae,le]=x.useState(""),[re,Q]=x.useState(null),[Z,pe]=x.useState(""),[ue,ye]=x.useState(null),[Ce,Ie]=x.useState([]),[de,Te]=x.useState(null),[oe,fe]=x.useState(!1),[Re,Me]=x.useState(0),[ke,me]=x.useState(!1);x.useEffect(()=>{if(!e||(g==null?void 0:g.connected)===!1)return;let je=!0;return E.current=!1,y([]),C([]),h.overview().then(et=>{if(!je)return;const it=et.sandboxes??[],lt=et.providers??[];y(it),C(lt),E.current||N(nA(tA(it,g))),G(lt.map(wt=>wt.name))}).catch(et=>{je&&$(et.message)}),N(""),P(a?"template":"quick"),Y([]),q("shell"),z({}),X([]),R([]),_((a==null?void 0:a.name)||""),A(a?[a]:[]),h.imageTemplates().then(et=>{je&&A(et.filter(it=>it.status==="ready"||it.exists))}).catch(et=>{je&&$(et.message)}),G([]),$(null),F(null),ye(null),se("empty"),le(""),Q(null),pe(""),Ie([]),me(!1),Te(null),fe(zp(g)),(zp(g)?h.syncLocalCatalog():Promise.resolve(null)).then(async et=>{if(!je)return;const it=await h.org();je&&(et!=null&&et.available&&(it.groups=it.groups.filter(lt=>!et.importedGroups.includes(lt.id)||et.groups.includes(lt.id))),ye(it),Te(et))}).catch(et=>{je&&(ye(null),$(`Could not load sandbox settings: ${et.message}`))}).finally(()=>{je&&fe(!1)}),()=>{je=!1}},[e,h,g==null?void 0:g.connected,g==null?void 0:g.remote,a,Re]);const Ae=B==="template"?k.find(je=>je.name===D):null,ge=dc.filter(je=>V.includes(je.id)),Pe=B==="quick"?[...new Set(ge.flatMap(je=>{const Ye=ee[je.id];return JR(w,je.id).some(et=>et.name===Ye)?[Ye]:[]}))]:H,Fe=Ae!=null&&Ae.managed&&Ae.recipe.source==="build"?Ws.filter(je=>Ae.recipe.agents.includes(je.id)):null,_e=B==="quick"?V:(Fe??[]).map(je=>je.id),Xe=B==="quick"?Object.keys(ee).filter(je=>GZ(w.find(Ye=>Ye.name===ee[je]))):[],Je=Wj(_e).filter(je=>L.includes(je)&&!Xe.includes(je)),ct=jD(B==="quick"?Zj(V):Ae!=null&&Ae.managed?Ae.recipe:null,{connectors:Je}),At=RU(_e),rt=B==="quick"?O.length>0:!!((kt=(Ze=Ae==null?void 0:Ae.recipe)==null?void 0:Ze.setups)!=null&&kt.length),be=rt&&!At.length;function Ue(je){const Ye=V.includes(je)?V.filter(et=>et!==je):[...V,je];Y(Ye),$(null),(Ye.length!==1||!Ye.includes(W))&&q("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(nA(tA(b??[],g),Ye.length===1?Ye[0]:"sandbox"))}x.useEffect(()=>{if(K!=="folder"||!ae.trim()){Q(null);return}let je=!1;Q({loading:!0});const Ye=setTimeout(()=>{h.localFolder(ae.trim()).then(et=>{je||Q({data:et})}).catch(et=>{je||Q({error:et.message})})},400);return()=>{je=!0,clearTimeout(Ye)}},[K,ae,h]);const Qe=Ce.every(je=>ue==null?void 0:ue.groups.some(Ye=>Ye.id===je)),xt=K==="repo"?QZ(Z):null,Ke=K==="empty"||(K==="folder"?!!(re!=null&&re.data&&!re.data.over):!!xt),Be=K==="folder"?ae.trim():K==="repo"?Z.trim():"";function jt(je){var rn;if(je.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||be){ln.step(m==null?void 0:m.current,"validation","blocked","unknown"),me(!0),Ye&&((rn=document.getElementById(Ye))==null||rn.scrollIntoView({behavior:p?"auto":"smooth",block:"center"}));return}const et=K==="folder"?{folder:re.data.path}:K==="repo"?{repository:Z.trim()}:{},it=S.trim(),lt=B==="quick",wt=V,cn=lt?{session:YZ(V,W)}:{},Gt=O,fn=T,Bn=Je,Kn=Pe,ce=At,tt=Ce,Tt=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:K,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=Tt,wo=[],jo=null,cr=null;const Fs=()=>{cr&&h.cancelImageBuild(cr).catch(Os=>He.error(Os.message))};xn.addEventListener("abort",Fs);try{if(lt){const Os=await ND(h,Gt,fn,{signal:xn,onProgress:Wt});wo=Os.setups.map(Pn=>Pn.id),jo=Os.accessReview,Jn=await XZ(h,wt,{withSetups:Gt.length>0,setups:Os.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:ce,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 Os of ds.opened??[])He(`Opened ${Os.name||"default"} on port ${Os.port}`,{description:Os.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(en,{open:e,onOpenChange:t,children:n.jsx(tn,{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(nm,{value:B,onValueChange:je=>{P(je),$(null)},className:"contents",children:[n.jsxs(nn,{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(Ij,{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(x4,{location:g,onChange:f}):!a&&i.length>0?null:n.jsx(ga,{location:g}),n.jsxs(sm,{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:vr(g)??"",onValueChange:c,items:i.map(je=>({value:vr(je),label:`${Dn(je)}${je.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(je=>n.jsxs(Qd,{value:vr(je),disabled:!je.connected,children:[Dn(je),je.connected?"":" · Disconnected"]},vr(je)))})]})]}),(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."}),oe&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading your local network policies, MCPs & Skills, and Groups…"}),(de==null?void 0:de.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)&&!oe&&!ue&&n.jsx(ie,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>Me(je=>je+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(Mt,{id:"sandbox-name",value:S,onChange:je=>{E.current=!0,N(je.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:CD.map(je=>n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:"checkbox",checked:V.includes(je.id),onChange:()=>Ue(je.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:je.logo,alt:"",className:"size-4 shrink-0 object-contain"}),n.jsx("span",{className:"min-w-0 flex-1",children:je.name}),V.includes(je.id)&&n.jsx(Yn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]})]},je.id))}),n.jsxs(Fi,{children:[n.jsxs(Gi,{render:n.jsx(ie,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[n.jsx("span",{className:"truncate",children:eA.filter(je=>V.includes(je.id)).map(je=>je.name).join(", ")||"More agents"}),n.jsx(ma,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),n.jsx(qi,{align:"start",children:eA.map(je=>n.jsxs(Bj,{checked:V.includes(je.id),onCheckedChange:()=>Ue(je.id),closeOnClick:!1,className:"text-xs",children:[n.jsx("img",{src:je.logo,alt:"",className:"size-4 shrink-0 object-contain"}),je.name]},je.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(je=>n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:"radio",name:"quick-open-in",value:je.id,checked:W===je.id,onChange:()=>q(je.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:[je.id==="shell"?n.jsx(nw,{className:"size-5 shrink-0","aria-hidden":"true"}):n.jsx("img",{src:je.logo,alt:"",className:"size-5 shrink-0 object-contain"}),n.jsx("span",{className:"min-w-0 flex-1 font-medium",children:je.name}),n.jsx("span",{"aria-hidden":"true",className:`flex size-3.5 shrink-0 items-center justify-center rounded-full border ${W===je.id?"border-foreground":"border-muted-foreground/40"}`,children:W===je.id&&n.jsx("span",{className:"size-1.5 rounded-full bg-foreground"})})]})]},je.id))})]}),ge.map(je=>{const Ye=JR(w,je.id);return Ye.length?n.jsxs("div",{className:"grid gap-1.5",children:[n.jsxs(zn,{htmlFor:`quick-sign-in-${je.id}`,className:"text-xs",children:[je.name," API key"]}),n.jsxs(jp,{value:ee[je.id]||"",onValueChange:et=>z(it=>({...it,[je.id]:et??""})),children:[n.jsx(Np,{id:`quick-sign-in-${je.id}`,className:"w-full text-xs",children:n.jsx(Sp,{children:ee[je.id]||"None, I’ll use my subscription"})}),n.jsx(Cp,{align:"start",alignItemWithTrigger:!1,children:n.jsxs(MT,{children:[n.jsx(Qd,{value:"",className:"text-xs",children:"None, I’ll use my subscription"}),Ye.map(et=>n.jsx(Qd,{value:et.name,className:"text-xs",children:et.name},et.name))]})})]})]},je.id):null}),n.jsx(sA,{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:je=>_(je??""),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(MT,{children:k.map(je=>n.jsx(Qd,{value:je.name,className:"text-xs",children:je.name},je.name))})})]}),ke&&!Ae&&k.length>0&&n.jsx("p",{className:"text-[11px] text-destructive",children:"Choose a template to create a sandbox."}),!k.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(je=>je.name),...(Ae.recipe.customAgents??[]).map(je=>je.name),"Terminal"].join(", ")}`:"Installed tools are not reported by this template."})]}),n.jsx(sA,{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(je=>{const Ye=H.includes(je.name);return n.jsxs("button",{type:"button","aria-pressed":Ye,onClick:()=>G(et=>Ye?et.filter(it=>it!==je.name):[...et,je.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:je.name}),n.jsx("span",{className:"text-muted-foreground",children:je.type})]},je.name)})}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No providers"})]}),te&&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:te})]}),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:[ue?n.jsx(tJ,{org:ue,value:Ce,onChange:Ie,invalid:ke&&!Qe,onAddPolicy:()=>F(Ki({appliesTo:{everyone:!1,groups:Ce,sandboxes:[]}})),onCreated:je=>ye(Ye=>({...Ye,groups:[...Ye.groups,je].sort((et,it)=>et.name.localeCompare(it.name)),members:{...Ye.members,[je.id]:[]}}))}):n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:te?"Groups unavailable. Reopen this dialog to retry.":"Loading groups…"}),(B==="quick"||rt&&(be||_e.includes("aider")))&&n.jsxs("div",{className:"space-y-3",children:[B==="quick"&&!oe&&n.jsx(uD,{localCatalog:de,autoPrepare:!0,automaticAccess:!0,preparationContext:"sandbox",accessReview:T,onAccessReview:M,value:O,onChange:R}),rt&&be&&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&&!be&&_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:WZ.filter(je=>!ve||je.id!=="folder").map(je=>n.jsx("button",{type:"button",onClick:()=>se(je.id),"aria-pressed":K===je.id,className:`flex-1 rounded px-2.5 py-1 text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${K===je.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:je.label},je.id))}),K==="folder"&&n.jsxs(n.Fragment,{children:[n.jsx(Mt,{value:ae,onChange:je=>le(je.target.value),className:"font-mono text-xs",placeholder:"~/code/my-project","aria-label":"Folder on this computer"}),(re==null?void 0:re.loading)&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Checking the folder…"}),(re==null?void 0:re.error)&&n.jsx("p",{className:"text-[11px] text-red-700",children:re.error}),(re==null?void 0:re.data)&&n.jsx(eJ,{plan:re.data,sandbox:S})]}),K==="repo"&&n.jsxs(n.Fragment,{children:[n.jsx(Mt,{value:Z,onChange:je=>pe(je.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(je=>je.rule.startsWith("tool-"))?"Agent and tool connections":"Agent connections",summary:`${new Set(ct.profiles.flatMap(je=>je.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(je=>n.jsxs("details",{className:"px-3 py-2",children:[n.jsxs("summary",{className:"cursor-pointer text-xs",children:[je.name,n.jsxs("span",{className:"ml-2 text-[11px] text-muted-foreground",children:[je.endpoints.length," destinations · ",je.rule]})]}),n.jsx("ul",{className:"mt-2 space-y-1",children:je.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)})}),je.authentication&&n.jsx("p",{className:"mt-2 text-[11px]",children:je.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:je.binaries.map(Ye=>n.jsx("li",{children:Ye},Ye))})]},je.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(ie,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsx(ie,{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(Vj,{open:!!U,initial:U,onOpenChange:je=>{je||F(null)},groups:(ue==null?void 0:ue.groups)??[],sandboxes:(b??[]).map(je=>je.name),assignments:(ue==null?void 0:ue.assignments)??{},onGroupCreated:je=>ye(Ye=>({...Ye,groups:[...Ye.groups,je]})),onSaved:(je,Ye)=>{var et;Ie(it=>[...new Set([...it,...Ye.appliesTo.groups])]),ye(it=>({...it,policies:[...it.policies.filter(lt=>lt.id!==Ye.id),Ye]})),(et=je.failed)!=null&&et.length?He.error("Rule saved, but some sandboxes could not be updated."):He.success(`Saved ${Ye.name}`)}})]})}function sA({agents:e,keyed:t=[],value:r,onChange:a}){const i=Wj(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 ",ff[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 y=new ResizeObserver(b);return y.observe(a),()=>y.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 rA=["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"],oA=new Set(["pastebin.com","ngrok.io","api.stripe.com"]);function sJ(e){let t=e>>>0;return()=>(t=t*1664525+1013904223>>>0)/2**32}const rJ=(e,t)=>t[Math.floor(e()*t.length)];function TD(e,t=Math.random,r=new Date().toISOString()){const a=e[Math.floor(t()**2.2*e.length)],i=t()<.08?rJ(t,[...oA]):rA[Math.floor(t()**1.8*(rA.length-3))],c=oA.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 oJ(e,t=2e3){const r=sJ(11),a=Date.now(),i=new Map(e.map(c=>[c.name,c.phase]));return Array.from({length:t},(c,u)=>TD(e,r,new Date(a-u*1500).toISOString())).filter(c=>["ready","error"].includes(i.get(c.sandbox)))}function ED(e){const t=x.useMemo(()=>null,[]),[r,a]=x.useState(()=>t?oJ(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)},()=>TD(i));a(f=>[...u,...f].slice(0,2e3))},450);return()=>clearInterval(c)},[t]),t?{...e,sandboxes:t,events:r,demo:!0}:e}const aA=[],aJ={context:'["preview","default"]',gateway:"preview",workspace:"default",label:"Local",remote:!1,connected:!0},iA=40,iJ=["all","running","sleeping","provisioning","error","unknown"],Ys=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),gr=mt,lp=e=>JSON.stringify([Ys(e.location),e.name]),Li=e=>e.toLocaleString("en-US"),av=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),lA=[{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"}],lJ=[{value:"1",label:"Last 24 hours"},{value:"7",label:"Last 7 days"},{value:"30",label:"Last 30 days"}],iv={type:[],phase:[],owner:[],image:[],createdAt:""},cJ=Object.fromEntries(Object.entries(nc).map(([e,t])=>[t.label,e])),RD=()=>n.jsx(OO,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),lv={type:e=>n.jsx(VO,{type:cJ[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(RD,{}),n.jsx("span",{className:"truncate font-mono text-[11px]",children:e.label})]})},cA={type:e=>e.type,phase:e=>Px(e.sandbox.phase),owner:e=>e.owner,image:e=>e.image},uA=Object.keys(nc);function uJ({onNavigate:e,allowRemote:t=!1,createRequest:r=0,onCreateRequestHandled:a}){const i=Pt(),c=js(),u=ED(oi()),f=yo(),{locations:m}=f,[h,g]=x.useState(null),p=gn(),[b,y]=x.useState(null),w=Ys(p)??b,[C,S]=x.useState(null),[N,E]=x.useState(!1),[k,A]=x.useState(null),O=t;x.useEffect(()=>{let be=!0;return i.contextKey().then(Ue=>{be&&y(JSON.stringify([i.target,Ue]))}).catch(()=>{}),()=>{be=!1}},[i]);const R=m.find(be=>Ys(be)===w),T=(R!=null&&R.connected?R:null)??m.find(be=>be.target===i.target&&!be.remote&&be.connected)??m.find(be=>be.target===i.target&&be.connected),M=m.find(be=>Ys(be)===Ys(C))??C??T,D=x.useSyncExternalStore(lo.subscribe,lo.getSnapshot),_=x.useMemo(()=>D.filter(be=>be.status==="created"&&!be.reported).map(be=>be.sandbox),[D]),H=x.useMemo(()=>u.demo?(u.sandboxes??aA).map((be,Ue)=>{const Qe=R??T??aJ,xt=uA[Ue%uA.length];return{...be,location:xt===xp(Qe)?Qe:{...Qe,placement:xt,host:`${xt}-demo`}}}):f.sandboxes,[u.demo,u.sandboxes,R,T,f.sandboxes]),G=x.useMemo(()=>{const be=new Set(H.map(lp));return[..._.filter(Ue=>!be.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,Y]=x.useState(iv),W=(be,Ue)=>Y(Qe=>({...Qe,[be]:Ue})),[q,ee]=x.useState({key:"name",direction:"asc"}),z=x.useDeferredValue(B),[L,X]=x.useState(null),[te,$]=x.useState(()=>new Set),[U,F]=x.useState(null),[K,se]=x.useState(!1),ne=x.useRef(!1),[ve,ae]=x.useState([]),[le,re]=x.useState(!!(c!=null&&c.createRequested));x.useEffect(()=>{c!=null&&c.createRequested&&(c.createRequested.location&&(S(c.createRequested.location),E(!0)),re(!0),c.requestCreate(!1))},[c==null?void 0:c.createRequested]);const[Q,Z]=x.useState(Date.now),pe=x.useRef(null);x.useEffect(()=>{const be=setInterval(()=>Z(Date.now()),3e4),Ue=Ke=>{var Be;(Ke.metaKey||Ke.ctrlKey)&&Ke.key.toLowerCase()==="k"&&(Ke.preventDefault(),(Be=pe.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{}A(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"&&(A({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(be),window.removeEventListener("keydown",Ue),window.removeEventListener(ql,Qe),window.removeEventListener("openrod-sandbox-handoff",xt)}},[]),x.useEffect(()=>{const be=(k==null?void 0:k.context)??w;if(!k||!be||f.loading)return;const Ue=G.find(Qe=>Qe.name===k.name&&Ys(Qe.location)===be);if(Ue!=null&&Ue.location.connected){X(Ue),A(null);try{sessionStorage.removeItem(ql)}catch{}}},[k,w,f.loading,G]);const ue=x.useRef(null);x.useEffect(()=>{const be=D.filter(Qe=>Qe.status==="created");if(!ue.current){ue.current=new Set(be.map(Qe=>Qe.id));return}const Ue=be.filter(Qe=>!ue.current.has(Qe.id));Ue.length&&(Ue.forEach(Qe=>ue.current.add(Qe.id)),X(null),P(""),Y(iv),ee({key:"createdAt",direction:"desc"}),f.refresh())},[D]);const ye=x.useMemo(()=>jW(G),[G]),Ce=x.useMemo(()=>G.map(be=>({sandbox:be,owner:uf(be,c!=null&&c.connected?c.user:null),type:nc[xp(be.location)].label,image:_p(be.image,be.imageTemplateName),search:[be.name,be.id,be.image,be.imageTemplateName,Dn(be.location),nc[xp(be.location)].label,uf(be,c!=null&&c.connected?c.user:null),...be.providers??[]].join(" ").toLowerCase()})),[G,c==null?void 0:c.connected,c==null?void 0:c.user]),Ie=x.useMemo(()=>Object.fromEntries(Object.entries(cA).map(([be,Ue])=>{const Qe=new Map;for(const Ke of Ce)Qe.set(Ue(Ke),(Qe.get(Ue(Ke))??0)+1);for(const Ke of V[be])Qe.has(Ke)||Qe.set(Ke,0);const xt=[...Qe.keys()].sort(be==="phase"?(Ke,Be)=>k1.indexOf(Ke)-k1.indexOf(Be):av.compare);return[be,xt.map(Ke=>({value:Ke,label:be==="phase"?Gl[Ke].label:Ke,count:Qe.get(Ke)}))]})),[Ce,V]),de=x.useMemo(()=>{const be=z.trim().toLowerCase(),Ue=V.createdAt?Q-Number(V.createdAt)*864e5:null,Qe=Ce.filter(Ke=>Object.entries(cA).every(([Be,jt])=>!V[Be].length||V[Be].includes(jt(Ke)))&&(Ue===null||Date.parse(Ke.sandbox.createdAt)>=Ue)&&(!be||Ke.search.includes(be))),xt=Ke=>q.key==="owner"||q.key==="image"||q.key==="type"?Ke[q.key]:q.key==="startedAt"?Ke.sandbox.phase==="ready"?Ke.sandbox.startedAt:null:Ke.sandbox[q.key];return Qe.sort((Ke,Be)=>{const jt=xt(Ke),Ze=xt(Be);if(!jt&&Ze)return 1;if(jt&&!Ze)return-1;const kt=av.compare(jt??"",Ze??"");return(q.direction==="asc"?kt:-kt)||av.compare(Ke.sandbox.name,Be.sandbox.name)})},[Ce,V,z,q,Q]);x.useEffect(()=>{const be=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=>be.has(xt)));return Qe.size===Ue.size?Ue:Qe})},[G,u.demo]);const Te=x.useMemo(()=>G.filter(be=>{var Ue;return((Ue=be.location)==null?void 0:Ue.connected)&&te.has(gr(be))}),[G,te]),oe=de.filter(be=>{var Ue;return((Ue=be.sandbox.location)==null?void 0:Ue.connected)&&!u.demo}),fe=oe.reduce((be,Ue)=>be+Number(te.has(gr(Ue.sandbox))),0),Re=oe.length>0&&fe===oe.length,Me=x.useCallback(be=>{var Ue;(Ue=be.location)!=null&&Ue.connected&&$(Qe=>{const xt=new Set(Qe),Ke=gr(be);return xt.has(Ke)?xt.delete(Ke):xt.add(Ke),xt})},[]),ke=()=>$(be=>{const Ue=new Set(be);for(const{sandbox:Qe}of oe)Re?Ue.delete(gr(Qe)):Ue.add(gr(Qe));return Ue});async function me(){if(ne.current||u.demo||!(U!=null&&U.length))return;ne.current=!0,se(!0),ae([]);const be=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"),be.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=>!be.has(Be)))),ae(Ue),be.size&&He.success(`Deletion requested for ${Li(be.size)} ${be.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{ne.current=!1,se(!1),F(null)}}const Ae=_x({count:de.length,rowHeight:iA});x.useEffect(()=>{Ae.scrollToTop()},[z,V,q]);const ge=x.useMemo(()=>bZ(G,30,Q),[G,Q]),Pe=()=>{P(""),Y(iv)},Fe=B||Object.values(V).some(be=>be.length),_e=G.length===0&&f.loading&&!u.demo,Xe=G.length===0&&f.error,Je=L&&(G.find(be=>gr(be)===gr(L))??(L.id==null?G.find(be=>lp(be)===lp(L)):null)??L),ct=Je&&(m.find(be=>Ys(be)===Ys(Je.location))??Je.location),At=Je?{...u,sandboxes:[Je],events:Ys(ct)===w?u.events:aA,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(T??null),re(!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:iJ.filter(be=>["all","running","sleeping"].includes(be)||ye.status[be]>0||V.phase.includes(be)).map(be=>n.jsxs("button",{"aria-pressed":be==="all"?!V.phase.length:V.phase.length===1&&V.phase[0]===be,onClick:()=>W("phase",be==="all"?[]:[be]),className:`rounded-md px-3 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${(be==="all"?!V.phase.length:V.phase.length===1&&V.phase[0]===be)?"bg-accent/70":"hover:bg-muted/60"}`,children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[be!=="all"&&n.jsx("span",{"aria-hidden":"true",className:`size-1.5 rounded-full ${Gl[be].bar}`}),be==="all"?"Sandboxes":Gl[be].label]}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Rf,{value:be==="all"?ye.total:ye.status[be]})})]},be))}),n.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:n.jsx(vZ,{points:ge,height:34,title:"Boxes · 30d"})})]}),n.jsx("div",{className:"flex h-[3px] shrink-0 overflow-hidden",role:"img","aria-label":Object.entries(ye.status).map(([be,Ue])=>`${Ue} ${Gl[be].label}`).join(", "),children:Object.entries(ye.status).map(([be,Ue])=>Ue>0&&n.jsx("span",{className:Gl[be].strip,style:{width:`${Ue/ye.total*100}%`}},be))}),f.error&&G.length>0&&n.jsxs(Qa,{id:"sandboxes:inventory-error",tone:"warning",title:"Inventory refresh failed",actions:n.jsx(ie,{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(vo,{ref:pe,value:B,onValueChange:P,placeholder:"Search name, owner, image…","aria-label":"Search sandboxes",className:"mr-auto w-full sm:w-64"}),Fe&&n.jsxs(ie,{variant:"ghost",size:"sm",onClick:Pe,children:[n.jsx(In,{className:"size-3"}),"Clear"]}),m.filter(be=>be.remote&&!be.connected&&be.host).map(be=>n.jsxs(ie,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 rounded-full px-2 text-[11px] text-muted-foreground",title:`Reconnect to ${be.host}`,onClick:()=>g(be.host),children:[n.jsx("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-stone-400"}),be.host," · Offline"]},Ys(be))),n.jsx(ie,{variant:"ghost",size:"icon-sm","aria-label":"Refresh sandboxes",onClick:f.refresh,children:n.jsx(rl,{className:"size-3.5"})}),n.jsxs(ie,{size:"sm",disabled:!T&&!O,onClick:rt,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(ys,{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(ie,{variant:"ghost",size:"sm",disabled:K,onClick:()=>$(new Set),children:"Clear selection"}),n.jsxs(ie,{variant:"destructive",size:"sm",disabled:K||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"}),K?"Deleting…":"Delete selected"]})]}),ve.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:ve.map(be=>n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:be.name})," ",n.jsx(ga,{location:be.location}),": ",be.message]},be.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(ie,{variant:"outline",onClick:f.refresh,className:"mt-4",children:"Retry"})]}):de.length?n.jsxs("table",{"aria-label":"Sandboxes","aria-rowcount":de.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}}),lA.map(be=>n.jsx("col",{style:{width:be.width}},be.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(AD,{label:"Select all matching sandboxes",checked:Re,mixed:fe>0&&!Re,disabled:K||!oe.length,onChange:ke})}),lA.map(be=>n.jsx("th",{scope:"col","aria-sort":q.key===be.id?q.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:()=>ee(Ue=>({key:be.id,direction:Ue.key===be.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:be.label}),q.key===be.id&&(q.direction==="asc"?n.jsx(_f,{className:"size-3 shrink-0"}):n.jsx(Pf,{className:"size-3 shrink-0"}))]}),n.jsx(fJ,{column:be,sort:q,onSort:Ue=>ee({key:be.id,direction:Ue}),values:Ie[be.id],value:V[be.id],onFilter:Ue=>W(be.id,Ue)})]})},be.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}})}),de.slice(Ae.start,Ae.end).map((be,Ue)=>{var Qe;return n.jsx(dJ,{row:be,now:Q,index:Ae.start+Ue+2,onOpen:X,selected:te.has(gr(be.sandbox)),onSelect:Me,disabled:K||u.demo||!((Qe=be.sandbox.location)!=null&&Qe.connected)},gr(be.sandbox))}),Ae.end<de.length&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:8,style:{height:(de.length-Ae.end)*iA,padding:0,border:0}})})]})]}):n.jsxs("div",{className:"py-20 text-center",children:[n.jsx(mc,{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(ie,{variant:"outline",disabled:!G.length&&!T&&!O,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(de.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(BZ,{name:Je.name,sandbox:Je,liveData:At,onClose:()=>X(null),onNavigate:e,onChanged:f.refresh})},gr(Je)),n.jsx(Fr,{open:U!==null,onOpenChange:be=>{!be&&!ne.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(be=>n.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[be.name,n.jsx(ga,{location:be.location})]},gr(be)))}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:K,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:K||!(U!=null&&U.length),onClick:me,children:K?"Deleting…":"Delete sandboxes"})]})]})}),n.jsx(en,{open:!!h,onOpenChange:be=>{be||g(null)},children:n.jsxs(tn,{className:"sm:max-w-3xl","aria-describedby":void 0,children:[n.jsx(nn,{children:n.jsxs(Qt,{children:["Connect to ",h]})}),h&&n.jsx(zj,{initialHost:h,onConnected:()=>{g(null),f.refresh()},onBack:()=>g(null)},h)]})}),n.jsx(Zn,{location:M,children:n.jsx(kD,{initialLocationConfirmed:N,open:le,onOpenChange:re,locations:m,location:M,onLocationChange:S,onRefreshLocations:f.refresh,allowRemote:O})})]})}const dJ=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),y=`${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(AD,{label:`Select ${y}`,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 ${y}`,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(mc,{"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(RD,{}),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:SW(m,r)})}),n.jsx("td",{className:p,children:n.jsxs("span",{className:"block truncate tabular-nums",title:m.createdAt||"Not reported",children:[H4(m.createdAt,r),m.createdAt?" ago":""]})})]})});function AD({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 fJ({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(r$,{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(Bj,{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=lv[e.id])==null?void 0:g.call(lv,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(LX,{value:i,onValueChange:c,children:[n.jsx(pR,{value:"",className:"text-xs",children:"Any time"}),lJ.map(h=>n.jsx(pR,{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 mJ=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},hJ=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),dA=e=>e===null?0:typeof e=="number"?1:2,pJ=(e,t)=>dA(e)-dA(t)||(typeof e=="number"?e-t:typeof e=="string"?I1(e,t):0),gJ=e=>{const t=String(e??"").replace(/[a-z]+/g,r=>r.toUpperCase());return Object.hasOwn(jg,t)?jg[t]:-1};function xJ(e,t){const r=mJ.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"?gJ(c.values.severity):hJ(c.values[r]);return e.map(c=>[i(c),c]).sort(([c,u],[f,m])=>a*pJ(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 bJ(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:y,...w}=p,C=JSON.stringify(w),S=t(),N=[],E=await Promise.all(S.map(async(R,T)=>{const M=R.id??R.context,D=`${M}:${C}`,_=g?null:a.get(D);if(!R.connected)return N[T]={label:Dn(R),offline:!0},_?{..._,total:_.events.length,events:_.events.map(H=>({...H,location:R}))}:null;try{const H=[];let G,B=0,P=h==null?void 0:h[M];const V=g?1/0:f+m;do G=await r(R).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:mt({id:W.id,location:R}),location:R}))),B+=G.events.length;while(B<V&&B<G.total&&G.events.length);const Y={...G,events:H,identity:M,snapshot:P};return g||a.set(D,Y),Y}catch(H){return N[T]={label:Dn(R),error:H.message},_?{..._,total:_.events.length,events:_.events.map(G=>({...G,location:{...R,connected:!1}}))}:{error:H}}})),k=E.filter(R=>R&&!R.error);if(!k.length&&E.some(R=>R==null?void 0:R.error))throw E.find(R=>R==null?void 0:R.error).error;const A=xJ(N1(k.flatMap(R=>R.events).map(Dj),{...p,now:b,sort:{key:"time"}}),p.sort).map(R=>R.event),O=k.reduce((R,T)=>R+T.total,0);return{events:g?A:A.slice(f,f+m),total:O,now:b,snapshot:Object.fromEntries(k.map(R=>[R.identity,R.snapshot])),sandboxes:[...new Set(k.flatMap(R=>R.sandboxes??[]))],agents:[...new Set(k.flatMap(R=>R.agents??[]))],nextOffset:f+m<O?f+m:null,unavailable:N.filter(Boolean)}},async previewActivityDeletion({mode:u,ids:f=[],query:m}){const g=t().filter(y=>u!=="selected"||f.some(w=>{try{return JSON.parse(w)[0][0]===(y.target??"local")&&JSON.parse(w)[0][1]===y.context}catch{return!1}}));if(u==="selected"&&g.some(y=>!y.connected))throw new Error("Reconnect the source of the selected logs before deleting them.");const p=[];for(const y of g.filter(w=>w.connected)){const w=f.filter(S=>{try{const[N]=JSON.parse(S);return N[0]===(y.target??"local")&&N[1]===y.context}catch{return!1}}).map(S=>JSON.parse(S)[1]),C=await r(y).previewActivityDeletion({mode:u,...u==="selected"?{ids:w}:{},query:m});p.push({location:y,plan:C})}const b=`combined:${++c}`;return i.set(b,{entries:p,deleted:0}),{token:b,mode:u,count:p.reduce((y,w)=>y+w.plan.count,0),expiresAt:p.length?Math.min(...p.map(y=>y.plan.expiresAt)):Date.now(),sources:p.map(y=>({label:Dn(y.location),count:y.plan.count})),skipped:g.filter(y=>!y.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 cv=()=>({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",uv=e=>e?new Date(e).toLocaleString():"Never";function fA(){const e=Pt(),[t,r]=x.useState([]),[a,i]=x.useState(cv),[c,u]=x.useState(!1),[f,m]=x.useState(null),[h,g]=x.useState(null),[p,b]=x.useState(null),[y,w]=x.useState(!1),C=x.useCallback(async()=>{try{r(await e.activityDestinations()),b(null),w(!0)}catch(k){b(k.message)}},[e]);x.useEffect(()=>{C();const k=setInterval(C,5e3);return()=>clearInterval(k)},[C]);const S=k=>({value:a[k],onChange:A=>i(O=>({...O,[k]:A.target.value}))});async function N(k,A){g(k);try{const O=await e.activityDestinationAction(k,A);A==="test"&&He.success(`Test accepted · HTTP ${O.status}`),await C(),m(null)}catch(O){He.error(O.message),await C()}finally{g(null)}}async function E(k){k.preventDefault(),g("new");try{await e.createActivityDestination({name:a.name,url:a.url,format:a.format,auth:a.auth,token:a.token,filters:{sandboxes:a.sandboxes.split(",").map(A=>A.trim()).filter(Boolean),categories:a.category?[a.category]:[],verdicts:a.verdict?[a.verdict]:[]}}),i(cv()),u(!1),await C(),He.success("Webhook saved. Test it, then enable forwarding.")}catch(A){He.error(A.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"})]}),!y&&!p&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading webhooks…"}),t.map(k=>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:k.name}),n.jsx("span",{className:`text-xs ${k.error?"text-amber-700":"text-muted-foreground"}`,children:k.enabled?k.error?"Retrying":"Enabled":k.error?"Needs attention":"Paused"})]}),n.jsx("p",{className:"break-all font-mono text-[11px] text-muted-foreground",children:k.url}),n.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[k.delivered.toLocaleString()," delivered · ",k.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:[k.format==="ocsf"?"OCSF JSON":"Console JSON"," · ",k.auth==="none"?"No authentication":k.auth==="bearer"?"Bearer token":"API key"]}),n.jsxs("p",{className:"text-xs",children:[k.filters.sandboxes.join(", ")||"All sandboxes"," · ",k.filters.categories.join(", ")||"All event types"," · ",k.filters.verdicts.join(", ")||"All decisions"]}),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:k.delivered.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx("dt",{className:"text-muted-foreground",children:"Pending"}),n.jsx("dd",{className:"mt-1",children:k.backlog.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx("dt",{className:"text-muted-foreground",children:"Filtered out"}),n.jsx("dd",{className:"mt-1",children:k.skipped.toLocaleString()})]})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Last delivery: ",uv(k.lastDeliveredAt),k.lastStatus?` · HTTP ${k.lastStatus}`:""]}),k.lastTest&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Test: ",k.lastTest.ok?`Accepted · HTTP ${k.lastTest.status}`:k.lastTest.error," · ",uv(k.lastTest.at)]})]})]}),k.error&&n.jsxs("p",{role:"status",className:"text-xs text-amber-700",children:[k.error," · Attempt ",k.attempts,"/8",k.enabled?` · Next retry ${uv(k.nextAttempt)}`:" · Forwarding paused; queued events retained"]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx(ie,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>N(k.id,"test"),children:"Send test"}),n.jsx(ie,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>N(k.id,k.enabled?"pause":"resume"),children:k.enabled?"Pause":"Enable forwarding"}),k.error&&n.jsx(ie,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>N(k.id,"retry"),children:"Retry now"}),n.jsx(ie,{size:"xs",variant:"ghost",disabled:!!h,onClick:()=>m(k.id),children:"Remove"})]}),f===k.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(ie,{size:"xs",variant:"destructive",disabled:!!h,onClick:()=>N(k.id,"remove"),children:"Remove webhook"}),n.jsx(ie,{size:"xs",variant:"ghost",onClick:()=>m(null),children:"Cancel"})]})]},k.id)),y&&!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(Mt,{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(Mt,{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(Mt,{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(Mt,{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(([k,A])=>n.jsx("option",{value:k,children:A},k))]})]}),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(ie,{type:"submit",size:"sm",disabled:!!h,children:"Save paused"}),n.jsx(ie,{type:"button",size:"sm",variant:"ghost",onClick:()=>{u(!1),i(cv())},children:"Cancel"})]})]}):n.jsx(ie,{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 mA(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 yJ(e,t="json",r){if(!Array.isArray(r))return t==="ocsf"?mA(e):e;const a=Dj(e).values,i=Object.fromEntries(r.filter(u=>Object.hasOwn(a,u)).map(u=>[u,a[u]]));if(t!=="ocsf")return i;const c=mA(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 vJ(e,t,r="json"){const a=e.map(i=>yJ(i,r,t==null?void 0:t.columns));return r==="ocsf"?a:{exportedAt:new Date().toISOString(),context:t,events:a}}function wJ(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),[y,w]=x.useState(!1),[C,S]=x.useReducer(A=>A+1,0),N=x.useRef(0),E=x.useRef(0);return x.useEffect(()=>{const A=++N.current;if(r)return;let O=!0;const R=async(M=!1)=>{const D=++E.current;w(!0);try{const _=await i.activity(JSON.parse(u));O&&N.current===A&&D===E.current&&(!M||!c.current)&&(m(_),b(null))}catch(_){O&&D===E.current&&b(_.message)}finally{O&&D===E.current&&w(!1)}};g(0),m({events:[],total:0,nextOffset:null}),R();const T=setInterval(()=>{c.current||R(!0)},5e3);return()=>{O=!1,clearInterval(T)}},[u,r,C,a,i]),{...f,loading:y,error:p,page:h,goToPage:async A=>{if(y||A<0||A>=Math.ceil(f.total/e.limit))return;const O=N.current,R=++E.current;w(!0);try{const T=await i.activity({...JSON.parse(u),snapshot:f.snapshot,offset:A*e.limit,now:f.now});O===N.current&&R===E.current&&(m(T),g(A),b(null))}catch(T){O===N.current&&R===E.current&&b(T.message)}finally{O===N.current&&R===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}],jJ=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",SJ=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"}):"-",hA=e=>new Intl.ListFormat("en",{type:"conjunction"}).format(e),pA=e=>e.offline?`${e.label} is offline`:`Could not load logs from ${e.label}`;function dv({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(vo,{"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 NJ(){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),MD(t)}catch{return{}}}function MD(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 CJ(){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 gA(e,t,r){const a=new Blob([JSON.stringify(vJ(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 kJ(){const e=Pt(),t=Vu([]),r=x.useRef(t.locations);r.current=t.locations;const a=JSON.stringify(t.locations.map(c=>[c.id,c.connected])),i=x.useMemo(()=>bJ(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(X5,{api:i,children:n.jsx(DD,{combined:!0,sourceRevision:a})})}function TJ({combined:e}){const t=gn();return e?n.jsx(kJ,{}):n.jsx(DD,{},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function DD({combined:e,sourceRevision:t}){var wt,cn,Gt,fn,Bn,Kn;const r=Pt(),a=gn(),i=ED(oi()),[c]=x.useState(NJ),[u,f]=x.useState(["time","source","sandbox","agent","action","verdict","destination"]),m=up.filter(ce=>u.includes(ce.id)),[h,g]=x.useState(CJ),[p,b]=x.useState(""),[y,w]=x.useState(!1),[C,S]=x.useState("columns"),[N,E]=x.useState(null),[k,A]=x.useState(!1),[O,R]=x.useState(null),[T,M]=x.useState(Date.now),[D,_]=x.useState(c.query??""),[H,G]=x.useState(c.direction??"all"),[B,P]=x.useState(c.sandboxes??[]),[V,Y]=x.useState(c.agents??[]),[W,q]=x.useState(c.verdicts??[]),[ee,z]=x.useState(c.filters??{}),[L,X]=x.useState(c.range??"all"),[te,$]=x.useState(fp(c.from)),[U,F]=x.useState(fp(c.to)),[K,se]=x.useState(c.sort??{key:"time",direction:"desc"}),[ne,ve]=x.useState(null),[ae,le]=x.useState(()=>new Set),[re,Q]=x.useState(null),[Z,pe]=x.useState(!1),[ue,ye]=x.useState(null),Ce=x.useDeferredValue(D),Ie={query:Ce,direction:H,sandboxes:B,verdicts:W,agents:V,filters:ee,range:L,from:te&&Number.isFinite(Date.parse(te))?new Date(te).toISOString():te,to:U&&Number.isFinite(Date.parse(U))?new Date(U).toISOString():U,sort:K},de=JSON.stringify(Ie),[Te,oe]=x.useState({query:de,page:0}),fe=wJ({...Ie,limit:Vl},{paused:!!O,demo:i.demo,activityRevision:e?`${i.activityRevision}:${t}`:i.activityRevision});x.useEffect(()=>{le(new Set),ve(null)},[i.activityRevision]),x.useEffect(()=>{le(new Set)},[Ce,H,B,W,V,ee,L,te,U]);async function Re(ce,tt){Xe(),pe(!0),ye(null);try{const Tt=await r.previewActivityDeletion({mode:ce,ids:tt||[...ae],query:Ie});Q(Tt)}catch(Tt){He.error(Tt.message)}finally{pe(!1)}}async function Me(){pe(!0),ye(null);try{const ce=await r.deleteActivity(re.token);Q(null),ve(null),le(new Set),R([]),fe.refresh(),i.refresh();const tt=re.skipped??[];He.success(`Deleted ${ce.deleted.toLocaleString()} log${ce.deleted===1?"":"s"}`,tt.length?{description:`${hA(tt)} ${tt.length===1?"was offline; its":"were offline; their"} logs were kept.`}:void 0)}catch(ce){ye(ce.message)}finally{pe(!1)}}function ke(ce){Xe(),le(tt=>{const Tt=new Set(tt);return Tt.has(ce)?Tt.delete(ce):Tt.size<5e3&&Tt.add(ce),Tt})}const me=i.demo?O??i.events:fe.events;function Ae(ce){i.demo||ln.capture("feature_used",{feature:"activity",action:"filter_applied"}),ce=MD(ce),Xe(),_(ce.query||""),G(ce.direction||"all"),P(ce.sandboxes||[]),q(ce.verdicts||[]),Y(ce.agents||[]),z(ce.filters||{}),X(ce.range||"all"),$(fp(ce.from)),F(fp(ce.to)),se(ce.sort||{key:"time",direction:"desc"})}function ge(ce,tt){Ae({filters:{[ce]:{mode:"equals",value:tt}}}),ve(null)}function Pe(ce){E({format:ce,columns:[...u],range:L,from:te,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:ce,columns:tt,range:Tt,from:rn,to:xn}=N,Wt={...Ie,columns:tt,range:Tt,from:rn?new Date(rn).toISOString():"",to:xn?new Date(xn).toISOString():""};A(!0);try{if(i.demo){gA(N1(ct,{...Wt,now:T}).map(Jn=>Jn.event),{...Wt,demo:!0},ce),E(null);return}if(e){const Jn=await r.activity({...Wt,exportAll:!0});gA(Jn.events.map(({originalId:wo,id:jo,...cr})=>({...cr,id:wo})),Wt,ce),E(null),(un=Jn.unavailable)!=null&&un.length&&He.warning("Some logs were not exported",{description:Jn.unavailable.map(pA).join(`
|
|
526
|
+
`)});return}const ns=document.createElement("a");ns.href=r.url("/activity/export",{format:ce,query:JSON.stringify(Wt),context:await r.contextKey(),...a?{location:"1"}:{}}),ns.download=ce==="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{A(!1)}}const Xe=()=>{O||(R(me),M(Date.now()))},Je=ce=>tt=>{Xe(),ce(tt)},ct=x.useMemo(()=>me.map(Dj),[me]),At=x.useMemo(()=>[...new Set([...(i.sandboxes??[]).map(ce=>ce.name),...fe.sandboxes??[],...me.map(ce=>ce.sandbox),...B].filter(Boolean))].sort(),[i.sandboxes,fe.sandboxes,me,B]),rt=x.useMemo(()=>[...new Set(i.demo?ct.map(ce=>ce.values.agent):fe.agents??ct.map(ce=>ce.values.agent))].filter(Boolean).sort((ce,tt)=>ce.localeCompare(tt)),[i.demo,ct,fe.agents]),be=L==="custom"&&(!te&&!U||te&&U&&Date.parse(te)>Date.parse(U)),Ue=x.useMemo(()=>be?[]:i.demo?N1(ct,{query:Ce,direction:H,sandboxes:B,verdicts:W,agents:V,filters:ee,range:L,from:te,to:U,now:T,sort:K}):ct,[ct,Ce,H,B,W,V,ee,L,te,U,T,K,be,i.demo]),Qe=be?0:i.demo?Ue.length:fe.total||0,xt=Math.max(1,Math.ceil(Qe/Vl)),Ke=i.demo?Math.min(Te.query===de?Te.page:0,xt-1):fe.page,Be=i.demo?Ue.slice(Ke*Vl,(Ke+1)*Vl):Ue;function jt(ce){Xe(),le(new Set),ve(null),i.demo?oe({query:de,page:ce}):fe.goToPage(ce)}const Ze=_x({count:Be.length,rowHeight:48});x.useEffect(()=>{Ze.scrollToTop()},[Ce,H,B,W,V,ee,L,te,U,K,Ke]);const kt=x.useMemo(()=>{if(!O)return 0;const ce=new Set(O.map(Tf));return i.events.filter(tt=>!ce.has(Tf(tt))).length},[O,i.events]),je=Be.filter(ce=>ce.values.verdict==="denied").length,Ye=Be.filter(ce=>ce.values.verdict==="allowed").length,et=D||B.length||W.length||V.length||H!=="all"||L!=="all"||Object.values(ee).some(ce=>ce.value);function it(){Xe(),_(""),G("all"),P([]),q([]),Y([]),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:()=>Y([])}]:[],...W.length?[{label:`Decision: ${W.join(", ")}`,clear:()=>q([])}]:[],...L!=="all"?[{label:dp[L],clear:()=>X("all")}]:[],...Object.entries(ee).filter(([,ce])=>ce.value).map(([ce,tt])=>{var Tt;return{label:`${((Tt=up.find(rn=>rn.id===ce))==null?void 0:Tt.label)??ce}${ce==="agent"?"":` ${tt.mode}`}: ${tt.value}`,clear:()=>z(rn=>({...rn,[ce]:{...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(vo,{"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(Ok,{className:"size-3.5"}),"Filters",(L!=="all"||H!=="all"||B.length>0||W.length>0||Object.values(ee).some(ce=>ce.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(ee).filter(ce=>ce.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:ce=>Je(X)(ce.target.value),children:Object.entries(dp).map(([ce,tt])=>n.jsx("option",{value:ce,children:tt},ce))})]}),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:ce=>Je(G)(ce.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=ee.category)==null?void 0:wt.value)||"",onChange:ce=>Je(z)({...ee,category:{mode:"equals",value:ce.target.value}}),children:[n.jsx("option",{value:"",children:"All event types"}),["Network","HTTP","Session","Configuration","Process","File","Authentication","Finding","Event","Log","Unclassified"].map(ce=>n.jsx("option",{children:ce},ce))]})]}),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=ee.severity)==null?void 0:cn.value)||"",onChange:ce=>Je(z)({...ee,severity:{mode:"equals",value:ce.target.value}}),children:[n.jsx("option",{value:"",children:"All severities"}),["FATAL","CRITICAL","HIGH","MED","LOW","INFO","Not reported"].map(ce=>n.jsx("option",{children:ce},ce))]})]}),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=ee.logLevel)==null?void 0:Gt.value)||"",onChange:ce=>Je(z)({...ee,logLevel:{mode:"equals",value:ce.target.value}}),children:[n.jsx("option",{value:"",children:"All log levels"}),["ERROR","WARN","INFO","DEBUG","TRACE","Not reported"].map(ce=>n.jsx("option",{children:ce},ce))]})]}),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(ce=>n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx("input",{type:"checkbox",checked:W.includes(ce),onChange:()=>Je(q)(W.includes(ce)?W.filter(tt=>tt!==ce):[...W,ce])}),ce]},ce))})]}),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(dv,{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(z$,{className:"size-3.5"}),"View",n.jsx(ma,{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(([ce,tt])=>n.jsx("button",{"aria-pressed":C===ce,onClick:()=>S(ce),className:`flex-1 rounded px-2 py-1.5 text-xs transition-colors ${C===ce?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:tt},ce))}),C==="columns"?n.jsx("div",{children:up.map(ce=>n.jsxs("label",{className:"flex items-center gap-2 py-1 text-xs",children:[n.jsx("input",{type:"checkbox",disabled:ce.id==="time",checked:u.includes(ce.id),onChange:tt=>f(tt.target.checked?[...u,ce.id]:u.filter(Tt=>Tt!==ce.id))}),ce.label]},ce.id))}):n.jsxs("div",{className:"flex max-h-80 flex-col gap-3 overflow-auto",children:[n.jsx(Mt,{"aria-label":"View name",value:p,onChange:ce=>b(ce.target.value),placeholder:"Name this investigation…"}),n.jsx(ie,{size:"sm",disabled:!p.trim(),onClick:()=>{try{const ce=[...h.filter(tt=>tt.name!==p.trim()),{name:p.trim(),query:Ie}];localStorage.setItem("openshell.activity.views",JSON.stringify(ce)),g(ce),b(""),He.success("View saved in this browser")}catch{He.error("Could not save view")}},children:"Save view"}),h.map(ce=>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(ce.query),children:ce.name}),n.jsx("button",{"aria-label":`Delete view ${ce.name}`,onClick:()=>{try{const tt=h.filter(Tt=>Tt.name!==ce.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"})})]},ce.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(ma,{className:"size-3"})]}),n.jsxs(qi,{align:"end",className:"w-60",children:[n.jsxs(Rs,{disabled:k||!!be,onClick:()=>Pe("json"),children:[n.jsx(pu,{}),"Export Console JSON"]}),n.jsxs(Rs,{disabled:k||!!be,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:Z||!ae.size,variant:"destructive",onClick:()=>Re("selected"),children:[n.jsx(ts,{}),"Delete selected logs",ae.size?` (${ae.size})`:""]}),n.jsxs(Rs,{disabled:Z||!!be||fe.loading||!fe.total,variant:"destructive",onClick:()=>Re("matching"),children:[n.jsx(ts,{}),"Delete matching logs"]}),n.jsxs(Rs,{disabled:Z,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(ie,{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:te,onInput:ce=>Je($)(ce.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:ce=>Je(F)(ce.currentTarget.value)})]}),n.jsx("span",{className:"text-muted-foreground",children:Intl.DateTimeFormat().resolvedOptions().timeZone}),be&&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(ce=>n.jsxs("button",{onClick:ce.clear,title:`Remove ${ce.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:ce.label}),n.jsx(In,{className:"size-3 shrink-0"})]},ce.label)),n.jsx(ie,{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:je?"text-red-600":"",children:[je.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((ce,tt)=>n.jsx("span",{title:ce.error,className:"text-amber-700 dark:text-amber-400",children:pA(ce)},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:()=>{O?(R(null),oe({query:de,page:0}),M(Date.now()),fe.refresh(),Ze.scrollToTop()):Xe()},children:[O?n.jsx(zO,{className:"size-3"}):n.jsx(y$,{className:"size-3"}),O?"Resume":"Pause"]}),O&&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&&!kt,onClick:()=>{R(i.demo?i.events:me),M(Date.now()),fe.refresh(),Ze.scrollToTop()},children:i.demo?`${kt.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:()=>le(new Set),children:"Clear selection"})]}),n.jsx("span",{className:"ml-auto",children:Intl.DateTimeFormat().resolvedOptions().timeZone})]}),n.jsxs("div",{ref:Ze.ref,onScroll:ce=>{Ze.onScroll(ce),ce.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((ce,tt)=>ce+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(ce=>n.jsx("col",{style:{width:ce.width}},ce.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(ce=>ae.has(ce.key)),ref:ce=>{ce&&(ce.indeterminate=Be.some(tt=>ae.has(tt.key))&&!Be.every(tt=>ae.has(tt.key)))},onChange:ce=>{Xe(),le(ce.target.checked?new Set(Be.filter(tt=>{var Tt;return((Tt=tt.event.location)==null?void 0:Tt.connected)!==!1}).map(tt=>tt.key)):new Set)}})}),m.map(ce=>{var tt,Tt,rn,xn;return n.jsx("th",{scope:"col","aria-sort":K.key===ce.id?K.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:ce.id==="source",onClick:()=>Je(se)({key:ce.id,direction:K.key===ce.id&&K.direction==="asc"?"desc":"asc"}),children:[ce.label,K.key===ce.id&&(K.direction==="asc"?n.jsx(_f,{className:"size-3"}):n.jsx(Pf,{className:"size-3"}))]}),ce.id!=="source"&&n.jsxs($p,{children:[n.jsx(Bp,{"aria-label":`Filter ${ce.label}`,className:`rounded p-1 hover:bg-accent ${(ce.id==="time"?L!=="all":ce.id==="sandbox"?B.length:ce.id==="verdict"?W.length:ce.id==="agent"?V.length||(tt=ee.agent)!=null&&tt.value:(Tt=ee[ce.id])!=null&&Tt.value)?"bg-accent text-foreground":""}`,children:n.jsx(Ok,{className:"size-3"})}),n.jsxs(Vp,{align:"start",children:[n.jsxs("p",{className:"text-xs font-medium",children:["Filter ",ce.label.toLowerCase()]}),ce.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(),Y([]),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),Y(un=>un.includes(Wt)?un.filter(ns=>ns!==Wt):[...un,Wt])},className:"accent-foreground"}),n.jsx(Hp,{agent:jJ[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"})]}):ce.id==="sandbox"?n.jsx(dv,{label:"Sandboxes",options:At,selected:B,onChange:Je(P)}):ce.id==="verdict"?n.jsx(dv,{label:"Decisions",options:["allowed","denied","not reported","not applicable"],selected:W,onChange:Je(q)}):ce.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":`${ce.label} match mode`,className:xr,value:((rn=ee[ce.id])==null?void 0:rn.mode)??"contains",onChange:Wt=>{var un;return Je(z)({...ee,[ce.id]:{value:((un=ee[ce.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(Mt,{"aria-label":`${ce.label} filter value`,placeholder:`Filter ${ce.label.toLowerCase()}…`,value:((xn=ee[ce.id])==null?void 0:xn.value)??"",onChange:Wt=>{var un;return Je(z)({...ee,[ce.id]:{mode:((un=ee[ce.id])==null?void 0:un.mode)??"contains",value:Wt.target.value}})},className:"h-8 text-xs"})]})]})]})]})},ce.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((ce,tt)=>{var Tt;return n.jsxs("tr",{"aria-rowindex":Ze.start+tt+2,onClick:()=>{Xe(),ve(ce)},className:`group cursor-pointer hover:bg-muted/70 ${(ne==null?void 0:ne.key)===ce.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:rn=>rn.stopPropagation(),children:n.jsx("input",{type:"checkbox","aria-label":`Select log ${ce.values.sandbox} ${ce.values.time}`,checked:ae.has(ce.key),disabled:((Tt=ce.event.location)==null?void 0:Tt.connected)===!1||!ae.has(ce.key)&&ae.size>=5e3,onChange:()=>ke(ce.key)})}),m.map(rn=>n.jsx("td",{className:`h-12 border-b border-border/60 px-3 py-0 font-mono text-[11px] ${rn.id==="verdict"?ce.values.verdict==="denied"?"text-red-600":ce.values.verdict==="allowed"?"text-emerald-700":"text-muted-foreground":rn.id==="destination"?"text-foreground":"text-muted-foreground"}`,children:rn.id==="source"?n.jsx(Hs,{location:ce.event.location??a}):rn.id==="time"?n.jsx("button",{"aria-label":`Inspect event ${ce.values.sandbox} ${ce.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(),ve(ce)},children:SJ(ce.values.time)}):rn.id==="action"?n.jsxs("span",{className:"block truncate",title:`${ce.values.category} · ${ce.values.action} · ${ce.values.process}`,children:[n.jsxs("span",{className:"block truncate text-foreground",children:[ce.values.category," · ",ce.event.method||ce.event.action||"Not reported"]}),n.jsx("span",{className:"block truncate text-[10px]",children:ce.values.process||ce.event.detail||ce.event.message||"Process not reported"})]}):rn.id==="agent"&&ce.agent?n.jsx("span",{className:"font-sans text-foreground",children:n.jsx(Hp,{agent:ce.agent})}):n.jsx("span",{className:"block truncate",title:ce.values[rn.id],children:ce.values[rn.id]||"-"})},rn.id))]},ce.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…":be?"Set a valid time range":et?"No matching events in available history":"No activity available"}),!!et&&n.jsx(ie,{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(ie,{variant:"outline",size:"sm","aria-label":"First page",disabled:Ke===0||!i.demo&&fe.loading,onClick:()=>jt(0),children:"First"}),n.jsx(ie,{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(ie,{variant:"outline",size:"sm","aria-label":"Next page",disabled:Ke>=xt-1||!i.demo&&fe.loading,onClick:()=>jt(Ke+1),children:"Next"}),n.jsx(ie,{variant:"outline",size:"sm","aria-label":"Last page",disabled:Ke>=xt-1||!i.demo&&fe.loading,onClick:()=>jt(xt-1),children:"Last"})]})]})]}),n.jsx(en,{open:!!N,onOpenChange:ce=>{ce||E(null)},children:n.jsxs(tn,{className:"sm:max-w-md max-h-[85vh] overflow-y-auto",children:[n.jsxs(nn,{children:[n.jsxs(Qt,{children:["Export ",(N==null?void 0:N.format)==="ocsf"?"OCSF JSON":"Console JSON"]}),n.jsx(Rn,{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:ce=>E({...N,range:ce.target.value}),children:Object.entries(dp).map(([ce,tt])=>n.jsx("option",{value:ce,children:tt},ce))})]}),N.range==="custom"&&n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[["from","to"].map(ce=>n.jsxs("label",{className:"grid gap-1 text-xs",children:[n.jsx("span",{children:ce==="from"?"From":"To"}),n.jsx("input",{type:"datetime-local",className:xr+" w-full min-w-0",value:N[ce],onChange:tt=>E({...N,[ce]:tt.target.value})})]},ce)),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(ce=>n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx("input",{type:"checkbox",checked:N.columns.includes(ce.id),disabled:ce.id==="time"&&N.format==="ocsf",onChange:tt=>E({...N,columns:tt.target.checked?[...N.columns,ce.id]:N.columns.filter(Tt=>Tt!==ce.id)})}),ce.label]},ce.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(ie,{variant:"outline",onClick:()=>E(null),children:"Cancel"}),n.jsxs(ie,{disabled:k||Fe,onClick:_e,children:[n.jsx(pu,{}),k?"Exporting…":"Export"]})]})]})]})}),n.jsx(Fr,{open:!!re,onOpenChange:ce=>{!ce&&!Z&&Q(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsx(Kr,{children:(re==null?void 0:re.mode)==="all"?"Delete all retained logs?":(re==null?void 0:re.mode)==="matching"?"Delete matching logs?":"Delete selected logs?"}),n.jsxs(Xr,{children:[re==null?void 0:re.count.toLocaleString()," log",(re==null?void 0:re.count)===1?"":"s"," will be permanently removed from Activity and pending webhook delivery. This cannot be undone."]})]}),((Bn=re==null?void 0:re.sources)==null?void 0:Bn.length)>1&&n.jsx("p",{className:"text-xs text-muted-foreground",children:re.sources.map(ce=>`${ce.label}: ${ce.count.toLocaleString()}`).join(", ")}),((Kn=re==null?void 0:re.skipped)==null?void 0:Kn.length)>0&&n.jsxs("p",{className:"text-xs font-medium text-amber-700 dark:text-amber-400",children:[hA(re.skipped)," ",re.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:[(re==null?void 0:re.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."]}),ue&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:ue}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:Z,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:Z||!(re!=null&&re.count)||!!ue,onClick:Me,children:Z?"Deleting…":`Delete ${re==null?void 0:re.count.toLocaleString()} log${(re==null?void 0:re.count)===1?"":"s"}`})]})]})}),n.jsx(Lo,{open:y&&!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."})]}),y&&n.jsx(fA,{})]})}),e&&y&&n.jsx(Dx,{subject:"workspace",onClose:()=>w(!1),children:(ce,tt)=>n.jsx(Lo,{open:!0,onOpenChange:Tt=>{Tt||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:ce})})]}),n.jsx(fA,{})]})})}),n.jsx(Lo,{open:!!ne,onOpenChange:ce=>{ce||ve(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."})]}),ne&&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:[[ne.event.scope?"scope":"sandbox",ne.event.scope||ne.values.sandbox,"Sandbox timeline"],["destination",ne.values.destination,"Same target"],["process",ne.values.process,"Same executable"],["policy",ne.values.policy,"Same policy"],["session",ne.values.session,"Same session"],["correlation",ne.values.correlation,"Same correlation"]].filter(([,ce])=>ce).map(([ce,tt,Tt])=>n.jsx(ie,{size:"xs",variant:"outline",onClick:()=>ge(ce,tt),children:Tt},ce))}),!i.demo&&n.jsxs(ie,{size:"sm",variant:"destructive",disabled:Z,onClick:()=>Re("selected",[ne.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",ne.values.time],["Sandbox",ne.values.sandbox],["Sandbox ID",ne.values.sandboxId],["Collection scope",ne.event.scope],["Direction",ne.values.direction],["Category",ne.values.category],["Security severity",ne.values.severity],["Log level",ne.values.logLevel],["Decision",ne.values.verdict],["Agent",ne.values.agent],["Attribution",ne.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",ne.values.session],["Correlation ID",ne.values.correlation],["Action",ne.values.action],["Executable",ne.event.binary],["Destination",ne.values.destination],["Policy",ne.event.policy],["Policy revision at event time",ne.event.policyVersion??"Not reported"],["Enforcement mode at event time",ne.event.enforcement??"Not reported"],["Event ID",ne.key],["Source cursor",ne.event.sourceCursor],["Identity evidence",ne.event.idSource||"No source event ID reported"],["Received at",ne.event.receivedAt],["Source",ne.event.source],["Parser target",ne.event.target],["Reason",ne.event.reason],["Why",ne.values.why]].map(([ce,tt])=>n.jsxs("div",{children:[n.jsx("dt",{className:"mb-1 text-[11px] text-muted-foreground",children:ce}),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:ce==="Agent"&&ne.agent?n.jsx(Hp,{agent:ne.agent}):tt||"-"}),tt&&n.jsx(xA,{label:ce,value:tt})]})]},ce))}),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(xA,{label:"raw event",value:JSON.stringify(ne.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(ne.event,null,2)})]})]})]})})]})}function xA({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}`,bA="groups-show-sandboxes";function zD(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 EJ({policy:e,onClick:t}){const r=e.action==="block"?tw:zu;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 RJ({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 AJ=[{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 ID({onCreate:e,onPolicy:t}){return n.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[n.jsx(mo,{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"}),AJ.map((r,a)=>n.jsx(mo,{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(mo,{delay:.34,children:n.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-2",children:[n.jsxs(ie,{onClick:e,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(ys,{}),"Create your first group"]}),n.jsxs(ie,{variant:"ghost",onClick:t,className:"text-muted-foreground",children:["Network rules",n.jsx(hu,{})]})]})})]})}function PD({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([]),[y,w]=x.useState(!1),[C,S]=x.useState(null);x.useEffect(()=>{e&&(m(""),g(""),b([]),S(null))},[e]);const N=i4(f),E=r.some(O=>O.id===N),k=O=>ir({assignments:i},O).map(R=>{var T;return(T=r.find(M=>M.id===R))==null?void 0:T.name}).filter(Boolean).join(", ");async function A(O){O.preventDefault(),w(!0),S(null);try{const{group:R}=await u.saveGroup({id:N,name:f.trim(),description:h.trim(),isNew:!0});let T=null;if(p.length)try{T=await u.setGroupMembers(p,[R.id],"add")}catch(M){He.warning(`Created ${R.name}, but could not add sandboxes`,{description:M.message})}t(!1),c(R,T,p.length)}catch(R){S(R.message)}finally{w(!1)}}return n.jsx(en,{open:e,onOpenChange:t,children:n.jsx(tn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:n.jsxs("form",{onSubmit:A,className:"grid gap-4",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:"New group"}),n.jsx(Rn,{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(Mt,{id:"group-name",value:f,onChange:O=>m(O.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(Uu,{id:"group-description",rows:2,value:h,onChange:O=>g(O.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(O=>{const R=p.includes(O.name),T=k(O.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:R,onChange:()=>b(M=>R?M.filter(D=>D!==O.name):[...M,O.name]),className:"size-3.5"}),n.jsx("span",{className:Ve("size-1.5 shrink-0 rounded-full",Za(O.phase).cell),"aria-hidden":"true"}),n.jsx("span",{className:"truncate font-mono",children:O.name}),T&&n.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-muted-foreground",children:`also in ${T}`})]})},O.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(ie,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(ie,{type:"submit",disabled:y||!N||E,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[y&&n.jsx(Rt,{"aria-hidden":"true"}),"Create group",p.length?` with ${Wi(p.length,"sandbox","sandboxes")}`:""]})]})]})})})}function _D({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,y]=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=Rj(t.policies,e.id),E=t.policies.filter(D=>D.appliesTo.everyone),k=r.filter(D=>!S.includes(D.name)),A=D=>ir(t,D).map(_=>{var H;return(H=t.groups.find(G=>G.id===_))==null?void 0:H.name}).filter(Boolean).join(", "),O=m.trim()!==e.name||g.trim()!==e.description;async function R(){y(!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{y(!1)}}async function T(D,_){y(!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{y(!1)}}async function M(){y(!0);try{Of(await f.deleteGroup(e.id),`Deleted ${e.name}`),a(),i()}catch(D){He.error(D.message)}finally{y(!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||O,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(Mt,{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(Uu,{id:"edit-group-description",rows:2,value:g,onChange:D=>p(D.target.value),className:"text-xs"})]}),O&&n.jsxs(ie,{size:"sm",className:"w-fit bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",disabled:b,onClick:R,children:[b&&n.jsx(Rt,{}),"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(ie,{size:"icon-xs",variant:"ghost","aria-label":`Remove ${D} from ${e.name}`,disabled:b,onClick:()=>T([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."]}),k.length>0&&n.jsxs(pn,{value:"","aria-label":`Add a sandbox to ${e.name}`,disabled:b,onChange:D=>D.target.value&&T([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"}),k.map(D=>n.jsxs("option",{value:D.name,children:[D.name,A(D.name)?` (also in ${A(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(EJ,{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(ie,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>c({new:{appliesTo:{groups:[e.id]}}}),children:[n.jsx(ys,{}),"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(ie,{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:M,children:"Delete group"})]})]})})]})})}function LD({group:e,members:t,policies:r,onOpen:a,delay:i,disabled:c=!1}){return n.jsx(mo,{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(RJ,{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 OJ({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([]),[y,w]=x.useState([]),[C,S]=x.useState(!1),[N,E]=x.useState(()=>{try{return localStorage.getItem(bA)==="1"}catch{return!1}}),k=()=>E(V=>{try{localStorage.setItem(bA,V?"0":"1")}catch{}return!V}),A=x.useCallback(async()=>{try{i(await t.org())}catch(V){i({error:V.message})}},[]);x.useEffect(()=>{A()},[A]);const O=x.useMemo(()=>[...r.sandboxes??[]].filter(V=>V.phase!=="deleting").sort((V,Y)=>V.name.localeCompare(Y.name)),[r.sandboxes]),R=V=>{zD(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 T=a.groups,M=a.assignments??{},D=O.filter(V=>ir(a,V.name).length).length,_=h.trim().toLowerCase(),H=O.filter(V=>!_||V.name.includes(_)||T.some(Y=>ir(a,V.name).includes(Y.id)&&Y.name.toLowerCase().includes(_))),G=H.length>0&&H.every(V=>p.includes(V.name));async function B(V,Y,W="replace"){S(!0);try{Of(await t.setGroupMembers(V,Y,W),`Updated groups for ${Wi(V.length,"sandbox","sandboxes")}`),b([]),await A()}catch(q){He.error(q.message)}finally{S(!1)}}const P=n.jsx(PD,{open:c,onOpenChange:u,groups:T,sandboxes:O,assignments:M,onCreated:async(V,Y,W)=>{Y?Of(Y,`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 A(),m(V.id)}});return T.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:T.length},{label:"In a group",value:D},{label:"No group",value:O.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(Rf,{value:V.value})})]},V.label))}),n.jsxs(ie,{size:"sm",className:"ml-auto bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>u(!0),children:[n.jsx(ys,{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:[T.map((V,Y)=>n.jsx(LD,{group:V,members:a.members[V.id]??[],policies:Rj(a.policies,V.id),onOpen:()=>m(V.id),delay:Y*.04},V.id)),n.jsx(mo,{delay:T.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(ys,{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:k,"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:O.length}),O.length-D>0&&n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["· ",O.length-D," not in a group"]})]}),N&&n.jsx(vo,{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:T,value:y,onChange:w})}),n.jsx(ie,{variant:"outline",size:"sm",disabled:C||!y.length,onClick:()=>B(p,y,"add"),children:"Add to groups"}),n.jsx(ie,{variant:"outline",size:"sm",disabled:C||!y.length,onClick:()=>B(p,y,"remove"),children:"Remove from groups"}),n.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>b([]),children:"Clear"}),C&&n.jsx(Rt,{"aria-hidden":"true"})]}),O.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 ee;const Y=ir(a,V.name),W=l4(a.policies,{name:V.name,groups:Y,setups:((ee=a.setupMembers)==null?void 0:ee[V.name])??[]}),q=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",q&&"bg-accent/40"),children:[n.jsx("input",{type:"checkbox","aria-label":`Select ${V.name}`,checked:q,onChange:()=>b(z=>q?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:T,value:Y,onChange:z=>{const L=z.filter(te=>!Y.includes(te)),X=Y.filter(te=>!z.includes(te));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(_D,{group:T.find(V=>V.id===f)??null,org:a,sandboxes:O,onClose:()=>m(null),onChanged:A,onPolicy:R})]}):n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[n.jsx(ID,{onCreate:()=>u(!0),onPolicy:()=>e("egress")}),P]})}function MJ({combined:e,...t}){return e?n.jsx(DJ,{...t}):n.jsx(OJ,{...t})}function DJ({onNavigate:e}){const t=Vu(["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,y]=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(Y=>({...Y,location:B.location,sourceOrg:B.data.org}))}),N=gf("groups",S),E=hx(S,t.apiFor,t.refresh),k=B=>{var P,V;return(V=(P=t.sources.find(Y=>Y.location.id===B.id))==null?void 0:P.data)==null?void 0:V.org},A=t.inventory.sandboxes.filter(B=>B.phase!=="deleting"),O=A.filter(B=>ir(k(B.location),B.name).length).length,R=A.filter(B=>!u||[B.name,...ir(k(B.location),B.name).map(P=>{var V,Y;return((Y=(V=k(B.location))==null?void 0:V.groups.find(W=>W.id===P))==null?void 0:Y.name)??""})].join(" ").toLowerCase().includes(u.toLowerCase())),T=A.filter(B=>g.includes(mt(B))),M=T.length>0&&T.every(B=>B.location.id===T[0].location.id),D=M?T[0].location.id:null;x.useEffect(()=>y([]),[D]);const _=M?k(T[0].location):null;async function H(B,P,V){C(!0);try{Of(await t.apiFor(B[0].location).setGroupMembers(B.map(Y=>Y.name),P,V),"Updated groups"),p([]),await t.refresh()}catch(Y){He.error(Y.message)}finally{C(!1)}}const G=r&&n.jsx(Dx,{onClose:()=>a(!1),children:(B,P)=>{const V=k(B);return n.jsx(PD,{open:!0,onOpenChange:Y=>{Y||P()},groups:(V==null?void 0:V.groups)??[],assignments:(V==null?void 0:V.assignments)??{},sandboxes:A.filter(Y=>Y.location.id===B.id),onCreated:async(Y,W,q)=>{await t.refresh(),P(),He.success(`Created ${Y.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(Au,{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",O],["No group",A.length-O]].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(ie,{size:"sm",className:"ml-auto bg-[var(--action)] text-[var(--action-foreground)]",onClick:()=>a(!0),children:[n.jsx(ys,{}),"New group"]})]}),n.jsx(Au,{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(LD,{group:B,members:((P=B.sourceOrg.members)==null?void 0:P[B.id])??[],policies:Rj(B.sourceOrg.policies,B.id),disabled:!B.location.connected,onOpen:()=>c(B),delay:0})]},mt(B))})}),!N.length&&!t.status.any&&n.jsx(ID,{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(ie,{variant:"ghost",size:"sm","aria-expanded":m,onClick:()=>h(!m),children:[n.jsx(Lr,{className:m?"rotate-90":""}),"Sandboxes ",A.length]}),m&&n.jsx(vo,{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:[T.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:[T.length," selected"]}),M?n.jsxs(n.Fragment,{children:[n.jsx(cc,{multiple:!0,allowCreate:!1,groups:(_==null?void 0:_.groups)??[],value:b,onChange:y}),n.jsx(ie,{size:"sm",disabled:w||!b.length||!T[0].location.connected,onClick:()=>H(T,b,"add"),children:"Add to groups"}),n.jsx(ie,{size:"sm",variant:"outline",disabled:w||!b.length||!T[0].location.connected,onClick:()=>H(T,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(ie,{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:[R.map(B=>{var q;const P=k(B.location),V=ir(P,B.name),Y=mt(B),W=l4((P==null?void 0:P.policies)??[],{name:B.name,groups:V,setups:((q=P==null?void 0:P.setupMembers)==null?void 0:q[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(Y),onChange:()=>p(ee=>ee.includes(Y)?ee.filter(z=>z!==Y):[...ee,Y])})}),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:ee=>{const z=ee.filter(X=>!V.includes(X)),L=V.filter(X=>!ee.includes(X));H([B],z.length?z:L,z.length?"add":"remove")}})})}),n.jsx("td",{className:"px-4 text-muted-foreground",children:W.map(ee=>ee.name).join(", ")||"No network rules"})]},Y)}),!R.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(mx,{record:i,type:"groups",offer:E.offer,children:n.jsx(_D,{sourceControl:n.jsx(vf,{record:i,onChange:B=>c({...B,...S.find(P=>mt(P)===mt(B)),copies:i.copies})}),group:i,org:k(i.location),sandboxes:A.filter(B=>B.location.id===i.location.id),onClose:()=>c(null),onChanged:async()=>{var V,Y,W;const B=await t.refresh(),P=(W=(Y=(V=B==null?void 0:B.find(q=>q.location.id===i.location.id))==null?void 0:V.data)==null?void 0:Y.org)==null?void 0:W.groups.find(q=>q.id===i.id);P&&c({...i,...P})},onPolicy:B=>{zD({...B,location:i.location}),e("egress",i.location)}},mt(i))})}),E.dialog]})}const zJ=({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}})}),IJ=[{minutes:60,label:"1 hour"},{minutes:480,label:"8 hours"},{minutes:1440,label:"1 day"},{minutes:null,label:"Until I close it"}],PJ=[{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 LJ(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 $D({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:IJ.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 $J({text:e}){const[t,r]=x.useState(!1);return n.jsx(ie,{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 BJ({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 y(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(zJ,{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($J,{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($L,{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($D,{value:void 0,onChange:C=>y("extend",()=>u.extendService(e,C),C?"Timer reset":"Timer removed"),label:"New auto-close"})}),n.jsx(ie,{size:"icon-xs",variant:"ghost",onClick:()=>g(!1),"aria-label":"Cancel",children:n.jsx(In,{})})]}):n.jsxs(ie,{size:"xs",variant:"ghost",onClick:()=>g(!0),disabled:!!f,children:[n.jsx(zk,{}),"Change timer"]})),n.jsxs(ie,{size:"xs",variant:"outline",className:"ml-auto border-destructive/30 text-destructive hover:bg-destructive/5 hover:text-destructive",disabled:!!f,onClick:()=>y("close",()=>u.closeService(e),`Closed ${p}`),children:[f==="close"?n.jsx(Rt,{}):n.jsx(EO,{}),"Close now"]})]})]})}function VJ({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 y(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:y,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"}),PJ.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(Mt,{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(Mt,{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($D,{value:f,onChange:m})]}),n.jsxs(ie,{type:"submit",size:"sm",disabled:h||!a,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[h?n.jsx(Rt,{}):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 mp={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 UJ(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 HJ({combined:e}){const t=gn();return e?n.jsx(FJ,{}):n.jsx(BD,{},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function BD({selectedSandbox:e}){var D,_,H,G,B;const t=Pt(),r=gn(),a=r?`ingress-scope:${r.context}`:"ingress-scope",i=oi(),c=LJ(),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,y]=x.useState(null),[w,C]=x.useState("");x.useEffect(()=>{let P=!0;return y(null),C(""),t.capabilities().then(V=>{P&&y(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),k=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]),A=x.useMemo(()=>UJ(i.events.filter(P=>P.kind==="inbound"&&P.sandbox===h)),[i.events,h]),O=P=>A.filter(V=>V.type==="visit"&&V.port===P&&Date.parse(V.at)>c-36e5),R=A.filter(P=>P.type==="session"||P.type==="command"),T=(G=g==null?void 0:g.sessions)==null?void 0:G.ttlSeconds,M=(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}),k[P.name]?n.jsxs("span",{className:"rounded bg-emerald-50 px-1 font-mono text-[10px] text-emerald-800",title:"Open services",children:[k[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:M?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:M}),n.jsx(ie,{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(mo,{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(EO,{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(BJ,{remote:g.auth.remote,canExpose:S,service:P,visits:O(P.port),now:c,onChanged:()=>{N(),i.refresh()}},`${P.sandbox}/${P.name}`)),S?n.jsx(VJ,{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(PO,{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:T===null?"Default session lifetime":T===0?"Sessions never expire":`Sessions expire after ${Math.round(T/60)} min`}),n.jsx("div",{className:"border-t border-border/70",children:R.length?R.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:mp[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(Du,{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:A.length?A.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=mp[P.type])==null?void 0:V.call(mp,P))??P.type}),n.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:_u(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 FJ(){const e=Vu(["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(vo,{className:"w-60","aria-label":"Search ingress",placeholder:"Search sandboxes…",value:a,onValueChange:i})}),n.jsx(Au,{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,y;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?((y=(b=f.data.capabilities)==null?void 0:b.features)==null?void 0:y.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(ie,{variant:"ghost",size:"sm",disabled:!m.connected,onClick:()=>r({...u,location:m}),children:m.connected?"Manage access":"Offline"})})]},mt(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(Ef,{children:n.jsx(BD,{selectedSandbox:t.name})})})})]})})]})}function GJ({tab:e,onNavigate:t,combined:r,requestedLocation:a}){const i=gn();return n.jsxs(nm,{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(sm,{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(HJ,{combined:r})})]})}const fv=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function yA(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 qJ(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=y=>({name:y.secret.name,service:y.service,credentials:y.secret.credentialKeys.length,attached:y.secret.attachedTo.length,expiry:y.expiry})[c.key],g=h(f),p=h(m);if(g===null)return p===null?fv.compare(f.secret.name,m.secret.name):1;if(p===null)return-1;const b=typeof g=="number"?g-p:fv.compare(g,p);return(c.direction==="asc"?b:-b)||fv.compare(f.secret.name,m.secret.name)})}const YJ=[{id:"agent",label:"Agents"},{id:"inference",label:"Models"},{id:"code",label:"Code"}],VD=[{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_…"}],UD=e=>VD.find(t=>t.id===e)??null,KJ=e=>UD(e)?`/logos/${e}.svg`:null;function Lx({type:e,size:t="md",className:r}){const a=KJ(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(Du,{strokeWidth:1.4,className:Ve("text-muted-foreground",c),"aria-hidden":"true"})})}function HD(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 XJ(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 WJ(e,t){const r=HD(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 QJ({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=YJ.map(m=>({...m,items:VD.filter(h=>h.group===m.id&&u(h))})).filter(m=>m.items.length);return n.jsxs("div",{className:"space-y-3",children:[n.jsx(vo,{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(Rt,{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 ZJ({service:e,profile:t,taken:r,sandboxes:a,onBack:i,onDone:c}){const u=Pt(),[f,m]=x.useState(()=>{const R=`my-${e.id}`;if(!r.has(R))return R;for(let T=2;;T++)if(!r.has(`${R}-${T}`))return`${R}-${T}`}),[h,g]=x.useState({}),[p,b]=x.useState([]),[y,w]=x.useState(!1),[C,S]=x.useState(null),N=t.endpoints.map(R=>R.host),E=XJ(t),k=HD(t),A=t.id==="codex"&&E.some(R=>R.key==="CODEX_AUTH_ACCESS_TOKEN");async function O(R){R.preventDefault(),w(!0),S(null);try{await u.createSecret({name:f,type:t.id,credentials:WJ(t,h)}),g({});const T=[];for(const M of p)try{await u.attachSecret(f,M,!0)}catch{T.push(M)}He.success(`Stored ${f}`,{description:p.length?`Attached to ${p.filter(M=>!T.includes(M)).join(", ")||"none"}${T.length?` · failed: ${T.join(", ")}`:""}`:"Credential saved. Vendor connection not tested."}),c()}catch(T){S(T.message)}finally{w(!1)}}return n.jsxs("form",{onSubmit:O,autoComplete:"off",className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ie,{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&&!k&&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"})]})]}),A&&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"})]}),k&&n.jsx("p",{role:"status",className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5 text-xs leading-relaxed",children:k}),n.jsx("div",{className:"space-y-2.5",children:!k&&E.map((R,T)=>{const M=R.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:[R.label,R.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:M})]}),n.jsxs("span",{className:"relative block",children:[n.jsx(Mk,{className:"absolute top-2.5 left-3 size-3.5 text-muted-foreground","aria-hidden":"true"}),n.jsx(Mt,{"aria-label":R.label,type:R.inputType,value:h[M]??"",onChange:D=>g(_=>({..._,[M]:D.target.value})),className:"h-9 pl-9 font-mono text-xs",placeholder:E.length===1&&e.keyHint?e.keyHint:R.placeholder,required:R.required,maxLength:8192,autoFocus:T===0,spellCheck:!1,autoComplete:"off"})]})]},M)})}),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(R=>n.jsx("span",{className:"rounded border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:R},R))}),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."]})]}),!k&&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(Mt,{value:f,onChange:R=>m(R.target.value.toLowerCase()),className:"h-8 font-mono text-xs",required:!0,pattern:"[a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?"})]}),a.length>0&&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(R=>{const T=p.includes(R.name);return n.jsxs("button",{type:"button","aria-pressed":T,onClick:()=>b(M=>T?M.filter(D=>D!==R.name):[...M,R.name]),className:`flex h-8 items-center gap-1.5 rounded-md border px-2 font-mono text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${T?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[n.jsx("span",{className:`size-1.5 rounded-full ${T?"bg-emerald-500":"bg-stone-300"}`,"aria-hidden":"true"}),R.name]},R.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(ie,{type:"submit",disabled:y||!!k,className:"h-9 w-full bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[y?n.jsx(Rt,{}):n.jsx(Mk,{}),"Store ",e.name," secret"]})]})}function FD({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,y]=x.useState(null),[w,C]=x.useState(r);x.useEffect(()=>C(r),[r]),x.useEffect(()=>{e||(p(null),h(""),y(null))},[e]);const S=new Set(a.map(R=>R.type)),N=new Set(a.map(R=>R.name)),E=g&&w.find(R=>R.id===g.id);async function k(R){if(w.some(T=>T.id===R.id)){p(R);return}y(R.id);try{await u.importProfile(R.id);const T=await c();C((T==null?void 0:T.profiles)??w),p(R)}catch(T){He.error(`Couldn't set up ${R.name}: ${T.message}`)}finally{y(null)}}const A=g&&E?"key":"pick",O=f?{}:{initial:{opacity:0,x:A==="key"?12:-12},animate:{opacity:1,x:0},exit:{opacity:0,x:A==="key"?-12:12},transition:{duration:.16,ease:"easeOut"}};return n.jsx(en,{open:e,onOpenChange:t,children:n.jsxs(tn,{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:A==="pick"?"Add secret":"Add credentials"}),n.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:A==="pick"?"Pick the service it's for.":"Stored by the gateway. Saving does not verify the vendor connection."})]}),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,{...O,children:A==="pick"?n.jsx(QJ,{query:m,setQuery:h,have:S,onPick:k,picking:b}):n.jsx(ZJ,{service:g,profile:E,taken:N,sandboxes:i,onBack:()=>p(null),onDone:()=>{t(!1),c()}})},A)})})]})})}const JJ={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"},eee=e=>(JJ[e.authStyle]??(()=>"resolved by the proxy"))(e),tee=e=>e&&Date.parse(e)-Date.now()<7*864e5;function nee({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(Mt,{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 see({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(en,{open:!!e,onOpenChange:g=>{g||t()},children:n.jsx(tn,{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(nn,{children:n.jsxs(Qt,{children:["Rotate ",e==null?void 0:e.name]})}),e==null?void 0:e.credentialKeys.map(g=>n.jsx(nee,{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(ie,{type:"button",variant:"ghost",onClick:t,children:"Cancel"}),n.jsxs(ie,{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(Rt,{"aria-hidden":"true"}),"Rotate"]})]})]})})})}function ree({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(Mt,{type:"date",value:f,onChange:g=>m(g.target.value),className:"h-7 w-36 text-[11px]","aria-label":`Expiry for ${t}`}),n.jsx(ie,{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(ie,{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(ie,{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 ${tee(i)?"text-amber-700":"text-muted-foreground"}`,children:[n.jsx(wL,{className:"size-3"}),i?`expires ${wf(i)}`:"no expiry"]})}function oee({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,y){m(!0);try{await u.attachSecret(e.name,b,y),He.success(y?`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=UD(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(ie,{size:"sm",variant:"outline",onClick:a,children:[n.jsx(rl,{}),"Rotate"]}),n.jsx(ie,{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 y=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:y?eee(y):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(ree,{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,y,w)=>w.indexOf(b)===y).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(MO,{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(Rt,{className:"size-3"})]})]})}const hp=[],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%"}],aee={none:"No expiry",expired:"Expired",expiring:"Within 7 days",scheduled:"Scheduled"};function iee(){const e=Vu(["secrets"]);return n.jsx(GD,{model:e})}function lee({combined:e}){const t=gn();return e?n.jsx(iee,{}):n.jsx(GD,{},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function GD({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:hp,profiles:hp,sources:e.sources}:i,[f,m]=x.useState(null),h=e?e.status.unavailable:f&&!u,[g,p]=x.useState(!1),[b,y]=x.useState(!1),[w,C]=x.useState(null),[S,N]=x.useState(null),[E,k]=x.useState(null),[A,O]=x.useState(""),[R,T]=x.useState("all"),[M,D]=x.useState(""),[_,H]=x.useState(""),[G,B]=x.useState({key:"name",direction:"asc"}),[P,V]=x.useState(Date.now),Y=x.useRef(null),W=x.useDeferredValue(A),q=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(()=>{q()},[q]),x.useEffect(()=>{const Q=setInterval(()=>V(Date.now()),6e4),Z=pe=>{var ue;(pe.metaKey||pe.ctrlKey)&&pe.key.toLowerCase()==="k"&&!E&&!b&&!w&&!S&&(pe.preventDefault(),(ue=Y.current)==null||ue.focus())};return window.addEventListener("keydown",Z),()=>{clearInterval(Q),window.removeEventListener("keydown",Z)}},[E,b,w,S]);const ee=(u==null?void 0:u.providers)??hp,z=(u==null?void 0:u.profiles)??hp,L=x.useMemo(()=>e?e.sources.flatMap(Q=>{var Z,pe,ue,ye;return yA(((pe=(Z=Q.data)==null?void 0:Z.secrets)==null?void 0:pe.providers)??[],((ye=(ue=Q.data)==null?void 0:ue.secrets)==null?void 0:ye.profiles)??[],P).map(Ce=>({...Ce,secret:{...Ce.secret,location:Q.location}}))}):yA(ee,z,P),[ee,z,P,e==null?void 0:e.sources]),X=x.useMemo(()=>qJ(L,{query:W,scope:R,service:M,expiry:_,sort:G}),[L,W,R,M,_,G]),te=x.useMemo(()=>{const Q=new Map(L.map(Z=>[Z.secret.type,Z.service]));return M&&!Q.has(M)&&Q.set(M,M),[...Q.entries()].sort((Z,pe)=>Z[1].localeCompare(pe[1]))},[L,M]),$=_x({count:X.length,rowHeight:40});x.useEffect(()=>{$.scrollToTop()},[W,R,M,_,G]);const U=L.find(Q=>mt(Q.secret)===E),F=(e?e.inventory.sandboxes:a.sandboxes??[]).filter(Q=>Q.phase!=="deleting"),K=L.filter(Q=>Q.secret.attachedTo.length>0).length,se=L.filter(Q=>Q.status==="expiring").length,ne=L.filter(Q=>Q.status==="expired").length,ve=A||R!=="all"||M||_,ae=()=>{O(""),T("all"),D(""),H("")},le=()=>{q(),a.refresh()},re="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",K],["unattached","Unattached",L.length-K]].map(([Q,Z,pe])=>n.jsxs("button",{"aria-pressed":R===Q,onClick:()=>T(Q),className:`rounded-md px-3 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${R===Q?"bg-accent/70":"hover:bg-muted/60"}`,children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:Z}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Rf,{value:pe})})]},Q)),n.jsx("div",{className:"ml-auto flex gap-1",children:[["expiring","Expiring in 7 days",se],["expired","Expired",ne]].map(([Q,Z,pe])=>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:Z}),n.jsx("span",{className:`mt-1 block font-mono text-lg leading-none tabular-nums ${pe?Q==="expired"?"text-red-600":"text-amber-700":"text-muted-foreground"}`,children:n.jsx(Rf,{value:pe})})]},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(vo,{ref:Y,value:A,onValueChange:O,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:M,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"}),te.map(([Q,Z])=>n.jsx("option",{value:Q,children:Z},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(aee).map(([Q,Z])=>n.jsx("option",{value:Q,children:Z},Q))]}),ve&&n.jsxs(ie,{variant:"ghost",size:"sm",onClick:ae,children:[n.jsx(In,{}),"Clear"]}),n.jsx(ie,{variant:"ghost",size:"icon-sm","aria-label":"Refresh secrets",disabled:g,onClick:le,children:n.jsx(rl,{className:g?"animate-spin":""})}),n.jsxs(ie,{size:"sm",disabled:!u,onClick:()=>y(!0),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(ys,{}),"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(ie,{variant:"outline",size:"sm",onClick:q,children:"Retry"})]}),e&&n.jsx(Au,{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,Z)=>{var pe;return n.jsxs("tr",{"aria-rowindex":$.start+Z+2,onClick:()=>{var ue;((ue=Q.secret.location)==null?void 0:ue.connected)!==!1&&k(mt(Q.secret))},className:"group cursor-pointer bg-card hover:bg-muted/60 focus-within:bg-muted/60",children:[n.jsx("td",{className:`${re} pl-6`,children:n.jsxs("button",{disabled:((pe=Q.secret.location)==null?void 0:pe.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:ue=>{ue.stopPropagation(),k(mt(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:re,children:n.jsx(Hs,{location:Q.secret.location??r})}),n.jsx("td",{className:re,children:n.jsx("span",{className:"block truncate",title:Q.service,children:Q.service})}),n.jsx("td",{className:re,children:n.jsx("span",{className:"font-mono text-[11px]",children:Q.secret.credentialKeys.length||"Access only"})}),n.jsx("td",{className:re,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:re,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:re,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`:"-"})})]},mt(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(Du,{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(ie,{variant:"outline",className:"mt-4",onClick:L.length?ae:()=>y(!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()}),ve?` 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||k(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(oee,{secret:U.secret,profile:U.profile,sandboxes:F.filter(Q=>{var Z,pe;return!e||((Z=Q.location)==null?void 0:Z.id)===((pe=U.secret.location)==null?void 0:pe.id)}),onRotate:()=>C(U.secret),onDelete:()=>N(U.secret),onDone:le},mt(U.secret))})})]})}),!e&&n.jsx(FD,{open:b,onOpenChange:y,profiles:z,providers:ee,sandboxes:F,reload:async()=>{const Q=await q();return a.refresh(),Q}}),e&&b&&n.jsx(Dx,{onClose:()=>y(!1),children:(Q,Z)=>n.jsx(cee,{model:e,location:Q,onClose:Z})}),n.jsx(Zn,{location:(w==null?void 0:w.location)??r,children:n.jsx(see,{secret:w,onClose:()=>C(null),onDone:le})}),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}`),le()}catch(Q){He.error(Q.message)}finally{N(null)}},children:"Delete"})]})]})})]})}function cee({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(FD,{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(en,{open:!0,onOpenChange:m=>{m||r()},children:n.jsx(tn,{children:n.jsxs(nn,{children:[n.jsx(Qt,{children:"Add secret"}),n.jsx(DialogDescription,{children:u||"Loading credentials…"})]})})})}async function uee(e,t,r,a={}){var u,f,m;const i=await ND(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 dee="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",qD=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>Ws.find(t=>t.id===e)).filter(Boolean),vA=Ws.filter(e=>!qD.includes(e)),wA={runtimes:"runtimes",repository:"repository",customAgents:"custom",base:"system",packages:"system",setup:"system",environment:"environment"};function tf({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 jA({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 fee(e){const t=gn();return n.jsx(mee,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function mee({initial:e,draftKey:t,onClose:r,onStarted:a,onChangeLocation:i,sourceControl:c}){var ye,Ce,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))),[y,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=de=>({open:y.has(de),onToggle:Te=>{const oe=Te.currentTarget.open;w(fe=>oe===fe.has(de)?fe:new Set(oe?[...fe,de]:[...fe].filter(Re=>Re!==de)))}}),[S,N]=x.useState(()=>!bg.some(de=>de.id===na(e==null?void 0:e.recipe).command)),[E,k]=x.useState(""),[A,O]=x.useState(!1),[R,T]=x.useState(!1),[M,D]=x.useState(""),_=x.useRef(null);x.useEffect(()=>()=>{var de;return(de=_.current)==null?void 0:de.abort()},[]);const[H,G]=x.useState(null),[B,P]=x.useState(!1),[V,Y]=x.useState(!1),W=h.source==="build",q=de=>{Ax({...h,...de})&&N(!1),g(Te=>na({...Te,...de,...de.setups?{setupRevisions:Object.fromEntries(Object.entries(Te.setupRevisions||{}).filter(([oe])=>de.setups.includes(oe)))}:{}}))},ee=JSON.stringify(h)!==b,z=GY(h);x.useEffect(()=>{try{sessionStorage.setItem(t,JSON.stringify({recipe:h,replace:p,baseline:b,advanced:[...y]}))}catch{}},[t,h,p,b,y]);const L=zp(f),[X,te]=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 de=!0;return te({loading:!0,value:null,error:""}),u.syncLocalCatalog().then(Te=>{de&&te({loading:!1,value:Te,error:""})}).catch(Te=>{de&&te({loading:!1,value:null,error:Te.message})}),()=>{de=!1}},[u,L,$]),x.useEffect(()=>{let de=!0;return u.localImages().then(Te=>{de&&G(Te)}).catch(Te=>{de&&G({images:[],error:Te.message})}),()=>{de=!1}},[u]),x.useEffect(()=>{const de=Te=>{ee&&(Te.preventDefault(),Te.returnValue="")};return window.addEventListener("beforeunload",de),()=>window.removeEventListener("beforeunload",de)},[ee]);function K(de){var fe;const Te=h.agents.includes(de)?h.agents.filter(Re=>Re!==de):Ws.filter(Re=>Re.id===de||h.agents.includes(Re.id)).map(Re=>Re.id),oe=!S&&(h.command===""?h.agents.length===0:Ws.some(Re=>Re.command===h.command));Te.length>1&&N(!1),q({agents:Te,...oe?{command:((fe=Ws.find(Re=>Re.id===Te[0]))==null?void 0:fe.command)??""}:{}})}const se=de=>q({runtimes:h.runtimes.includes(de)?h.runtimes.filter(Te=>Te!==de):[...h.runtimes,de]}),ne=[w1(h).some(de=>de.npm)&&!h.runtimes.includes("node")&&"Node.js 22",w1(h).some(de=>de.python)&&!h.runtimes.includes("python")&&"Python 3"].filter(Boolean),ve=bg.filter(de=>{var Te;return!W||de.id===""||h.agents.includes((Te=Ws.find(oe=>oe.command===de.id))==null?void 0:Te.id)}),ae=[...j1.filter(de=>h.runtimes.includes(de.id)).map(de=>de.name),...ne].join(", "),le=[(ye=xg.find(de=>de.id===h.base))==null?void 0:ye.name,`${h.packages.length} ${h.packages.length===1?"package":"packages"}`,h.setup.trim()&&"setup commands"].filter(Boolean).join(" · "),re=h.environment.length?`${h.environment.length} ${h.environment.length===1?"variable":"variables"}`:"";async function Q(de){de.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){wA[Te[0]]&&w(fe=>new Set([...fe,wA[Te[0]]])),k(Te[1]);return}if(A||(f==null?void 0:f.connected)===!1)return;O(!0),T(!0),k(""),D("");const oe=new AbortController;_.current=oe;try{const fe=await uee(u,h,p,{signal:oe.signal,onProgress:D,onPrepared:()=>T(!1)});ln.templateStarted(fe,f),a(fe)}catch(fe){fe.name!=="AbortError"&&k(fe.message)}finally{O(!1),T(!1),D(""),_.current=null}}function Z(){const de=URL.createObjectURL(new Blob([S1(h)],{type:"text/plain"})),Te=document.createElement("a");Te.href=de,Te.download="Dockerfile",Te.click(),URL.revokeObjectURL(de)}function pe(){A||(ee?Y(!0):r())}const ue=(de=0)=>({initial:m?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,delay:de,ease:[.22,1,.36,1]}});return n.jsx(en,{open:!0,onOpenChange:de=>{de||pe()},children:n.jsx(tn,{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(nm,{value:h.source,onValueChange:de=>{q({source:de}),de==="build"&&h.agents.length>1&&N(!1),k("")},className:"contents",children:[n.jsxs(nn,{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(Ij,{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(x4,{location:f,onChange:i}):n.jsx(ga,{location:f}),n.jsxs(sm,{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(Rn,{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:A||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:A||(f==null?void 0:f.connected)===!1,className:"contents",children:[n.jsxs($n.div,{...ue(),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(Mt,{id:"template-name",value:h.name,disabled:p,maxLength:19,onChange:de=>q({name:de.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:qD.map(de=>n.jsxs(jA,{checked:h.agents.includes(de.id),onChange:()=>K(de.id),children:[n.jsx("img",{src:de.logo,alt:"",className:"size-4 shrink-0 object-contain"}),n.jsx("span",{className:"min-w-0 flex-1",children:de.name}),h.agents.includes(de.id)&&n.jsx(Yn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]},de.id))}),n.jsxs(Fi,{children:[n.jsxs(Gi,{render:n.jsx(ie,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[n.jsx("span",{className:"truncate",children:vA.filter(de=>h.agents.includes(de.id)).map(de=>de.name).join(", ")||"More agents"}),n.jsx(ma,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),n.jsx(qi,{align:"start",children:vA.map(de=>n.jsxs(Bj,{checked:h.agents.includes(de.id),onCheckedChange:()=>K(de.id),closeOnClick:!1,className:"text-xs",children:[n.jsx("img",{src:de.logo,alt:"",className:"size-4 shrink-0 object-contain"}),de.name]},de.id))})]})]}):n.jsxs(tf,{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(Mt,{id:"template-image",value:h.image,onChange:de=>q({image:de.target.value.trim()}),placeholder:"ghcr.io/your-team/workspace:latest",className:"font-mono text-xs"}),((Ce=H==null?void 0:H.images)==null?void 0:Ce.length)>0&&n.jsxs(pn,{"aria-label":"Choose an available image",value:H.images.some(de=>de.reference===h.image)?h.image:"",onChange:de=>q({image:de.target.value}),className:"w-full text-xs",children:[n.jsx("option",{value:"",disabled:!0,children:"Choose an available image"}),H.images.map(de=>n.jsx("option",{value:de.reference,children:de.reference},de.reference))]})]}),n.jsx(hee,{starts:ve,recipe:h,custom:S,setCustom:N,patch:q}),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,{...ue(.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(ie,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>U(de=>de+1),children:"Retry"})]}),!X.loading&&n.jsx(uD,{localCatalog:X.value,retained:F,autoPrepare:!0,preparationContext:"template",value:h.setups,onChange:de=>q({setups:de})}),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(de=>!de.retired||h.runtimes.includes(de.id)).map(de=>n.jsxs(jA,{checked:h.runtimes.includes(de.id),onChange:()=>se(de.id),children:[n.jsx("img",{src:de.logo,alt:"",className:`size-4 shrink-0 object-contain ${de.id==="vscode"?"dark:invert":""}`}),n.jsx("span",{className:"min-w-0 flex-1",children:de.name}),h.runtimes.includes(de.id)&&n.jsx(Yn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]},de.id))}),ne.length>0&&n.jsxs("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:[ne.join(" and ")," ",ne.length>1?"are":"is"," included for the selected agents."]})]}),W&&n.jsx(Kl,{title:"Repository",summary:h.repository,...C("repository"),children:n.jsx(tf,{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(Mt,{id:"template-repository",value:h.repository,onChange:de=>q({repository:de.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(gee,{agents:h.customAgents,onChange:de=>{de.length>h.customAgents.length&&N(!1),q({customAgents:de,...de.length>h.customAgents.length?{command:""}:{}})},error:E?z.customAgents:void 0})}),W&&n.jsxs(Kl,{title:"System",summary:le,...C("system"),children:[n.jsx(tf,{label:"Operating system",htmlFor:"template-base",children:n.jsx(pn,{id:"template-base",value:h.base,onChange:de=>q({base:de.target.value}),className:"w-full text-xs",children:xg.map(de=>n.jsx("option",{value:de.id,children:de.name},de.id))})}),n.jsx(pee,{packages:h.packages,onChange:de=>q({packages:de})}),n.jsx(tf,{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(Uu,{id:"template-setup",value:h.setup,onChange:de=>q({setup:de.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:re,...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((de,Te)=>n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx(Mt,{"aria-label":`Variable ${Te+1} name`,className:"min-w-0 flex-1 font-mono text-xs",value:de.name,onChange:oe=>q({environment:h.environment.map((fe,Re)=>Te===Re?{...fe,name:oe.target.value}:fe)}),placeholder:"NODE_ENV"}),n.jsx(Mt,{"aria-label":`Variable ${Te+1} value`,className:"min-w-0 flex-1 font-mono text-xs",value:de.value,onChange:oe=>q({environment:h.environment.map((fe,Re)=>Te===Re?{...fe,value:oe.target.value}:fe)}),placeholder:"development"}),n.jsx(ie,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove variable ${Te+1}`,onClick:()=>q({environment:h.environment.filter((oe,fe)=>fe!==Te)}),children:n.jsx(ts,{})})]},Te)),n.jsxs(ie,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:h.environment.length>=40,onClick:()=>q({environment:[...h.environment,{name:"",value:""}]}),children:[n.jsx(ys,{}),"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."})]})]})}),(M||p)&&n.jsx("p",{role:M?"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:M||n.jsxs(n.Fragment,{children:[n.jsx(Mu,{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(ie,{type:"button",variant:"ghost",className:"sm:mr-auto",onClick:()=>P(!0),children:[n.jsx(AO,{}),"View Dockerfile"]}),n.jsx(ie,{type:"button",variant:"ghost",disabled:A&&!R,onClick:()=>{var de;return R?(de=_.current)==null?void 0:de.abort():pe()},children:R?"Cancel preparation":"Cancel"}),n.jsxs(ie,{type:"submit",className:dee,disabled:A||(f==null?void 0:f.connected)===!1,children:[A?n.jsx(Rt,{}):n.jsx(J1,{}),R?"Preparing MCPs…":W?p?"Rebuild template":"Build template":"Save template"]})]})]}),n.jsx(en,{open:B,onOpenChange:P,children:n.jsxs(tn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:"Generated Dockerfile"}),n.jsx(Rn,{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(ie,{type:"button",variant:"outline",onClick:Z,children:[n.jsx(pu,{}),"Download Dockerfile"]})]})}),n.jsx(en,{open:V,onOpenChange:Y,children:n.jsxs(tn,{children:[n.jsxs(nn,{children:[n.jsx(Qt,{children:"Discard this template?"}),n.jsx(Rn,{children:"Your changes haven’t been built yet."})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(ie,{type:"button",variant:"ghost",onClick:()=>Y(!1),children:"Keep editing"}),n.jsx(ie,{type:"button",variant:"destructive",onClick:r,children:"Discard"})]})]})})]})})})}function hee({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(nw,{"aria-hidden":"true",className:"size-5 shrink-0"}),m.name,()=>{a(!1),i({command:m.id})},m.id||"shell")}),!c&&f(r,n.jsx(AO,{"aria-hidden":"true",className:"size-5 shrink-0"}),"Custom command",()=>{r||(a(!0),i({command:""}))},"custom")]}),!c&&r&&n.jsx(Mt,{"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 pee({packages:e,onChange:t}){const[r,a]=x.useState(""),i=x.useRef(null);function c(){const u=rR(r);u.length&&t([...new Set([...e,...u])]),a("")}return n.jsx(tf,{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(Mt,{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,...rR(h)])]),a("")}},placeholder:"jq, unzip…",className:"min-w-0 flex-1 font-mono text-xs",autoComplete:"off",spellCheck:!1}),n.jsxs(ie,{type:"button",variant:"outline",size:"sm",onClick:()=>{var u;c(),(u=i.current)==null||u.focus()},children:[n.jsx(ys,{}),"Add"]})]})]})})}function gee({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(nw,{"aria-hidden":"true",className:"mt-2 size-3.5 shrink-0 text-muted-foreground"}),n.jsx(Uu,{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),SA="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",io=e=>e.status==="building",gp=e=>e.status==="ready"||e.exists,xee=e=>io(e)?e.exists?"Rebuilding":"Building":e.status==="failed"?e.exists?"Rebuild failed":"Build failed":"Ready";function NA({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(Rt,{className:"size-3 text-amber-600"}):n.jsx("span",{className:`size-1.5 rounded-full ${e.status==="failed"?"bg-amber-500":"bg-emerald-500"}`}),xee(e)]})}const CA=e=>{var t;return((t=bg.find(r=>r.id===e))==null?void 0:t.name)??e};function bee(){var Ie,de,Te;const e=Pt(),t=js(),{templates:r,locations:a,error:i,refresh:c,loading:u}=yo(),[f,m]=x.useState(""),[h,g]=x.useState(""),[p,b]=x.useState(null),[y,w]=x.useState(null),C=y?Qy(or(y.location)):null,[S,N]=x.useState(null),[E,k]=x.useState(!1),[A,O]=x.useState(null),R=x.useRef(!1),[T,M]=x.useState(null),[D,_]=x.useState(null),[H,G]=x.useState(!1),B=x.useRef(!1),[P,V]=x.useState(()=>new Set),[Y,W]=x.useState([]);x.useEffect(()=>{let oe=!0;return e.contextKey().then(fe=>{oe&&b(JSON.stringify([e.target,fe]))}).catch(fe=>He.error(fe.message)),()=>{oe=!1}},[e]),x.useEffect(()=>{if(R.current||!p)return;const oe=a.find(Re=>or(Re)===p);if(!(oe!=null&&oe.connected))return;R.current=!0;const fe=oR(Qy(or(oe)));fe&&w(Re=>Re??{...fe,location:oe})},[p,a]);const q=r.find(oe=>mt(oe)===S),ee=oe=>a.find(fe=>or(fe)===or(oe.location))??oe.location,z=a.length>1,L=oe=>ee(oe).connected!==!1,X=oe=>{if(!L(oe))throw new Error(`${Dn(ee(oe))} is disconnected. Reconnect before continuing.`);return lr(t!=null&&t.localViewer?ee(oe).target??"local":e.target,e.signal,oe.location.context)},te=hx(r,oe=>X({location:oe}),c),$=gf("templates",r),U=gf("templates",r.filter(oe=>(!z||!h||or(oe.location)===h)&&`${oe.name} ${oe.image||""} ${oe.recipe.repository||""}`.toLowerCase().includes(f.toLowerCase()))),F=U.filter(oe=>!io(oe)&&L(oe)),K=r.filter(oe=>P.has(mt(oe))&&!io(oe)&&L(oe)),se=F.filter(oe=>P.has(mt(oe))).length,ne=F.length>0&&se===F.length;x.useEffect(()=>{const oe=new Set(r.filter(fe=>!io(fe)&&(a.find(Re=>or(Re)===or(fe.location))??fe.location).connected!==!1).map(mt));V(fe=>new Set([...fe].filter(Re=>oe.has(Re))))},[r,a]);function ve(oe){V(fe=>{const Re=new Set(fe);return Re.has(oe)?Re.delete(oe):Re.add(oe),Re})}function ae(){V(oe=>{const fe=new Set(oe);for(const Re of F)ne?fe.delete(mt(Re)):fe.add(mt(Re));return fe})}async function le(oe){const fe=[];for(const Re of oe)try{const Me=await X(Re).imageTemplateUsage(Re.name);Me.sandboxes.length&&fe.push({target:Re,message:"This template cannot be deleted while sandboxes use it.",sandboxes:Me.sandboxes})}catch(Me){fe.push({target:Re,message:Me.message})}W(fe)}async function re(oe){if(!B.current){B.current=!0,G(!0),W([]),N(null),M(oe);try{await le(oe)}finally{B.current=!1,G(!1)}}}async function Q(oe,fe){if(!B.current){B.current=!0,G(!0);try{await X(oe).lifecycle(fe,"delete"),He.success(`Deleted sandbox ${fe}`),await le(T),await c()}catch(Re){He.error(Re.message)}finally{B.current=!1,G(!1)}}}async function Z(){if(B.current||!(T!=null&&T.length))return;B.current=!0,G(!0),W([]);const oe=new Set,fe=[],Re=new Map;try{for(const Me of T)try{const ke=await X(Me).deleteImageTemplate(Me.name);oe.add(mt(Me));const me=ke==null?void 0:ke.imageCleanup,Ae=JSON.stringify([or(Me.location),me==null?void 0:me.image]);(me==null?void 0:me.status)==="retained"?Re.set(Ae,{image:me.image,reason:me.reason,location:ee(Me)}):me!=null&&me.image&&Re.delete(Ae)}catch(ke){fe.push({target:Me,message:ke.message,sandboxes:ke.sandboxes})}for(const{image:Me,reason:ke,location:me}of Re.values())He.warning(ke,{description:`${Dn(me)} · ${Me}`,duration:1e4});V(Me=>new Set([...Me].filter(ke=>!oe.has(ke)))),N(Me=>oe.has(Me)?null:Me),W(fe),oe.size&&He.success(`Deleted ${oe.size} ${oe.size===1?"template":"templates"}`),M(fe.length?T.filter(Me=>!oe.has(mt(Me))):null),await c()}finally{B.current=!1,G(!1)}}function pe(oe,fe,Re){L(oe)&&(N(null),w({recipe:fe,replace:Re,location:ee(oe),record:oe.copies?oe:$.find(Me=>Me.copies.some(ke=>mt(ke)===mt(oe)))?{...oe,copies:$.find(Me=>Me.copies.some(ke=>mt(ke)===mt(oe))).copies}:oe}))}function ue(oe){if(!(oe!=null&&oe.connected))return;const fe=oR(Qy(or(oe)));w({...fe??{},location:oe}),k(!1)}x.useEffect(()=>{if(!A)return;const oe=a.find(Re=>Re.gateway===A&&Re.connected);if(oe){O(null),ue(oe);return}const fe=setInterval(c,1500);return()=>clearInterval(fe)},[A,a]);function ye(){try{sessionStorage.removeItem(C)}catch{}w(null)}async function Ce(oe){try{await oe(),await c()}catch(fe){He.error(fe.message)}}return n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[te.dialog,y&&n.jsx(Zn,{location:ee(y),children:n.jsx(mx,{record:y.record??{...y,name:(Ie=y.recipe)==null?void 0:Ie.name},type:"templates",offer:y.replace?te.offer:()=>{},children:n.jsx(fee,{sourceControl:y.record&&n.jsx(vf,{record:y.record,onChange:oe=>pe(oe,oe.recipe,!0)}),initial:y,draftKey:C,onClose:ye,onChangeLocation:y.replace?void 0:()=>{w(null),k(!0)},onStarted:oe=>{N(mt({...oe,location:y.location})),ye(),c()}},JSON.stringify([or(y.location),((de=y.recipe)==null?void 0:de.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(vo,{"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:oe=>g(oe.target.value),className:"h-8 rounded-md border bg-card px-2 text-xs",children:[n.jsx("option",{value:"",children:"All locations"}),a.map(oe=>n.jsxs("option",{value:or(oe),children:[Dn(oe),or(oe)===p?" (default)":"",oe.connected===!1?" · disconnected":""]},or(oe)))]}),n.jsxs(ie,{size:"sm",className:SA,onClick:()=>k(!0),children:[n.jsx(ys,{}),"New template"]})]}),K.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:[K.length," selected",K.length>se&&n.jsxs("span",{className:"text-muted-foreground",children:[" · ",K.length-se," outside current filters"]})]}),n.jsx(ie,{variant:"ghost",size:"sm",disabled:H,onClick:()=>V(new Set),children:"Clear selection"}),n.jsxs(ie,{variant:"destructive",size:"sm",disabled:H,onClick:()=>re(K),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(ie,{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(Rt,{}),"Loading…"]}):U.length?n.jsx(mo,{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:ne,indeterminate:se>0&&!ne,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(oe=>n.jsxs("tr",{className:P.has(mt(oe))?"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 ${oe.name} in ${Dn(ee(oe))}`,checked:P.has(mt(oe)),disabled:H||io(oe)||!L(oe),onCheckedChange:()=>ve(mt(oe))})}),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(mt(oe)),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(OO,{className:"size-4",strokeWidth:1.5})}),n.jsx("span",{className:"truncate group-hover:underline",children:oe.name})]})}),n.jsx("td",{className:"px-4 py-2",children:n.jsx(fx,{record:oe})}),n.jsx("td",{className:"px-4 py-2 text-[11px] text-muted-foreground",children:oe.managed===!1?"-":CA(oe.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:oe.image||"",children:oe.image||(oe.recipe.source==="image"?oe.recipe.image:"Not built yet")})}),n.jsx("td",{className:"px-4 py-2",children:n.jsx(NA,{record:oe})}),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(oe)&&(oe.status==="failed"||oe.status==="ready"&&oe.managed)&&n.jsxs(ie,{variant:"ghost",size:"xs",disabled:!L(oe),"aria-label":`Edit ${oe.name} in ${Dn(ee(oe))}`,onClick:()=>pe(oe,oe.recipe,oe.status==="ready"||!!oe.exists),children:[n.jsx(Dk,{}),"Edit"]}),n.jsxs(ie,{variant:"ghost",size:"xs",disabled:gp(oe)&&!L(oe),onClick:()=>gp(oe)?_(oe):N(mt(oe)),children:[gp(oe)?"Use template":io(oe)?"View progress":"Details",n.jsx(hu,{})]}),n.jsx(ie,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${oe.name} in ${Dn(ee(oe))}`,title:io(oe)?"Cancel the build before deleting this template":`Delete ${oe.name}`,disabled:H||io(oe)||!L(oe),onClick:()=>re([oe]),children:n.jsx(ts,{})})]})})]},mt(oe)))})]})})}):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(ie,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>m(""),children:"Clear search"})]}),n.jsx(en,{open:!!q,onOpenChange:oe=>{oe||N(null)},children:n.jsx(tn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:q&&n.jsxs(n.Fragment,{children:[n.jsxs(nn,{children:[n.jsx(Qt,{className:"font-mono",children:q.name}),n.jsx(Rn,{children:q.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(vf,{record:{...q,copies:(Te=$.find(oe=>oe.copies.some(fe=>mt(fe)===mt(q))))==null?void 0:Te.copies},onChange:oe=>N(mt(oe))}),n.jsx(NA,{record:q})]}),!L(q)&&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:q.image||(q.recipe.source==="image"?q.recipe.image:"Not built yet")},"i")],...q.managed===!1?[]:[["Starts in",CA(q.recipe.command)]],...q.recipe.source==="build"&&q.managed!==!1?[["Agents",[...q.recipe.agents.map(oe=>{var fe;return(fe=Ws.find(Re=>Re.id===oe))==null?void 0:fe.name}),...(q.recipe.customAgents??[]).map(oe=>oe.name)].join(", ")||"None"],["Repository",q.recipe.repository?n.jsx("span",{className:"break-all font-mono",children:q.recipe.repository},"r"):"None"]]:[],["Environment",q.recipe.environment.length?n.jsx("span",{className:"font-mono",children:q.recipe.environment.map(oe=>oe.name).join(", ")},"e"):"None"],["CLI",n.jsxs("code",{className:"font-mono",children:["openshell sandbox create --template ",q.name]},"c")]].map(([oe,fe])=>n.jsxs("div",{className:"flex gap-4 py-2",children:[n.jsx("dt",{className:"w-24 shrink-0 text-muted-foreground",children:oe}),n.jsx("dd",{className:"min-w-0",children:fe})]},oe))}),q.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:q.error}),q.logs&&n.jsxs("details",{open:io(q)||q.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:q.logs})]}),n.jsx("div",{className:"flex flex-wrap items-center gap-2 border-t pt-4",children:io(q)?n.jsxs(ie,{variant:"outline",disabled:!L(q),onClick:()=>Ce(()=>X(q).cancelImageBuild(q.name)),children:[n.jsx(In,{}),"Cancel build"]}):n.jsxs(n.Fragment,{children:[q.status==="failed"&&n.jsxs(ie,{variant:"outline",size:"sm",disabled:!L(q),onClick:()=>pe(q,q.recipe,!!q.exists),children:[n.jsx(IO,{}),"Edit and retry"]}),q.status==="failed"&&q.exists&&n.jsx(ie,{variant:"ghost",size:"sm",disabled:!L(q),onClick:()=>Ce(()=>X(q).dismissImageBuild(q.name)),children:"Dismiss"}),q.status==="ready"&&q.managed&&n.jsxs(ie,{variant:"ghost",size:"sm",disabled:!L(q),onClick:()=>pe(q,q.recipe,!0),children:[n.jsx(Dk,{}),"Edit"]}),q.managed!==!1&&n.jsxs(ie,{variant:"ghost",size:"sm",disabled:!L(q),onClick:()=>pe(q,{...q.recipe,name:`${q.name.slice(0,14)}-copy`},!1),children:[n.jsx(Lf,{}),"Duplicate"]}),n.jsx(ie,{variant:"ghost",size:"icon-sm","aria-label":"Delete image template",disabled:H||!L(q),onClick:()=>re([q]),children:n.jsx(ts,{})}),gp(q)&&n.jsxs(ie,{className:`ml-auto ${SA}`,disabled:!L(q),onClick:()=>{_(q),N(null)},children:["Use template",n.jsx(hu,{})]})]})})]})})}),n.jsx(en,{open:!!T,onOpenChange:oe=>{!oe&&!B.current&&M(null)},children:n.jsxs(tn,{className:"max-h-[85svh] overflow-y-auto",children:[n.jsxs(nn,{children:[n.jsxs(Qt,{children:["Delete ",(T==null?void 0:T.length)===1?"this template":`${(T==null?void 0:T.length)??0} templates`,"?"]}),n.jsx(Rn,{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:T==null?void 0:T.map(oe=>n.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[n.jsx("span",{className:"font-mono",children:oe.name}),n.jsx(ga,{location:ee(oe)})]},mt(oe)))}),Y.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 ",(T==null?void 0:T.length)===1?"this template":"these templates","."]}),n.jsx("ul",{className:"mt-2 space-y-3",children:Y.map(oe=>{var fe;return n.jsxs("li",{children:[n.jsxs("p",{children:[n.jsx("span",{className:"font-mono",children:oe.target.name})," ",n.jsx(ga,{location:ee(oe.target)}),": ",oe.message]}),((fe=oe.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:oe.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(ie,{variant:"destructive",size:"sm",disabled:H||!L(oe.target),"aria-label":`Delete sandbox ${Re.name} in ${Dn(ee(oe.target))}`,onClick:()=>Q(oe.target,Re.name),children:[n.jsx(ts,{}),"Delete sandbox"]})]},mt({...Re,location:oe.target.location})))})]})]},mt(oe.target))})})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(ie,{variant:"ghost",disabled:H,onClick:()=>M(null),children:"Cancel"}),n.jsxs(ie,{variant:"destructive",disabled:H||!(T!=null&&T.some(L)),onClick:Z,children:[H&&n.jsx(Rt,{}),H?"Deleting…":Y.length?"Retry deletion":(T==null?void 0:T.length)===1?"Delete template":"Delete templates"]})]})]})}),n.jsx(en,{open:E,onOpenChange:oe=>{k(oe),oe||O(null)},children:n.jsx(tn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:n.jsx(Mx,{locations:a,allowRemote:!!(t!=null&&t.localViewer),subject:"template",connecting:!!A,onPick:oe=>ue(a.find(fe=>or(fe)===oe)),onConnected:oe=>{O(oe.gateway),c()},onCancel:()=>k(!1)})})}),D&&n.jsx(Zn,{location:ee(D),children:n.jsx(kD,{open:!0,initialImageTemplate:D,onOpenChange:oe=>{oe||_(null)},onStarted:()=>_(null)})})]})}const YD=x.createContext(void 0);function yee(){const e=x.useContext(YD);if(e===void 0)throw new Error(sn(63));return e}const vee="data-checked",wee="data-unchecked",KD={...Lg,checked(e){return e?{[vee]:""}:{[wee]:""}}},jee=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:y=!1,required:w=!1,disabled:C=!1,render:S,uncheckedValue:N,value:E,style:k,...A}=t,{clearErrors:O}=Bg(),{state:R,setTouched:T,setDirty:M,validityData:D,setFilled:_,setFocused:H,validationMode:G,disabled:B,name:P,validation:V}=Iu(),{labelId:Y}=Vf(),W=B||C,q=P??g,ee=x.useRef(null),z=ho(ee,h,V.inputRef),L=x.useRef(null),X=vs(),te=Uf({id:m}),$=p?void 0:te,[U,F]=po({controlled:a,default:!!c,name:"Switch",state:"checked"});$g(L,X,U,void 0,!W,g),We(()=>{_(U)},[U,_]),Ff(U,()=>{O(q),M(U!==D.initialValue),V.change(U)});const{getButtonProps:K,buttonRef:se}=bo({disabled:W,native:p}),ne=FO(u,Y,ee,!p,$),ve={id:p?te:X,role:"switch","aria-checked":U,"aria-readonly":y||void 0,"aria-required":w||void 0,"aria-labelledby":ne,onFocus(){W||H(!0)},onBlur(){const Q=ee.current;!Q||W||(T(!0),H(!1),G==="onBlur"&&V.commit(Q.checked))},onClick(Q){if(y||W)return;Q.preventDefault();const Z=ee.current;Z&&mu(Z,Q)}},ae={...V.getValidationProps(W),checked:U,disabled:W,form:f,id:$,name:q,required:w,style:q?rw:_g,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:z,onChange(Q){if(Q.nativeEvent.defaultPrevented)return;if(y){Q.preventDefault();return}const Z=Q.currentTarget.checked,pe=vt(Ur,Q.nativeEvent);b==null||b(Z,pe),!pe.isCanceled&&F(Z)},onClick(Q){Q.stopPropagation()},onFocus(){var Q;(Q=L.current)==null||Q.focus()},...E!==void 0?{value:E}:Tn},le=x.useMemo(()=>({...R,checked:U,disabled:W,readOnly:y,required:w}),[R,U,W,y,w]),re=Nt("span",t,{state:le,ref:[r,L,se],props:[ve,A,K,Q=>V.getValidationProps(W,Q)],stateAttributesMapping:KD});return n.jsxs(YD.Provider,{value:le,children:[re,!U&&q&&N!==void 0&&n.jsx("input",{type:"hidden",form:f,name:q,value:N,disabled:W}),n.jsx("input",{...ae,suppressHydrationWarning:!0})]})}),See=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=yee();return Nt("span",t,{state:f,ref:r,stateAttributesMapping:KD,props:u})});function Nee({className:e,...t}){return n.jsx(jee,{"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(See,{"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 Cee=({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}),kee=`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 Tee(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 Eee={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 Ree({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 Tee(kee,u.currentTarget)?r(!0):He.error("Couldn’t copy the prompt",{description:"Your browser blocked clipboard access."})},c=a?{}:{...Eee,transition:{duration:.18,ease:"easeOut"}};return n.jsx(Hu,{delay:300,children:n.jsxs(xa,{children:[n.jsxs(ba,{render:n.jsx(ie,{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(Cee,{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(ya,{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 kA={name:"",hostname:"",port:"",auth:"default",identityFile:""},Aee=[["default","SSH agent / default keys"],["identity","Key file"]];function Oee({open:e,onOpenChange:t,onAdded:r}){const[a,i]=x.useState(kA),[c,u]=x.useState(null),[f,m]=x.useState(!1),[h,g]=x.useState(null),p=x.useId();x.useEffect(()=>{e&&(i(kA),u(null),g(null),m(!1))},[e]);const b=N=>E=>{i(k=>({...k,[N]:E.target.value})),g(null)},y=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(),y&&!f&&w(async()=>u(await cs.scanSshHost(a)))},S=()=>w(async()=>{const N=await cs.addSshHost(c.token);r(N)});return n.jsx(en,{open:e,onOpenChange:N=>{f||t(N)},children:n.jsxs(tn,{className:"sm:max-w-md","aria-describedby":void 0,children:[n.jsx(nn,{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(ie,{type:"button",variant:"ghost",disabled:f,onClick:()=>{u(null),g(null)},children:"Back"}),n.jsxs(ie,{type:"button",disabled:f,onClick:S,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f?n.jsx(Rt,{"aria-hidden":"true"}):n.jsx(zu,{"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(Mt,{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(Mt,{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(Mt,{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:Aee.map(([N,E])=>n.jsx("button",{type:"button",role:"radio","aria-checked":a.auth===N,onClick:()=>{i(k=>({...k,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(Mt,{"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(Ree,{className:"sm:mr-auto"}),n.jsx(ie,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(ie,{type:"submit",disabled:!y||f,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&n.jsx(Rt,{"aria-hidden":"true"}),f?"Checking…":"Continue"]})]})]})]})})}const XD={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"}},TA=e=>XD[e]?e:"off",WD=(e,t,r)=>`${e} ${e===1?t:r}`;function Mee({row:e,count:t}){const r=XD[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:["· ",WD(t,"sandbox","sandboxes")]})]})}function Dee({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(Rt,{"aria-label":"Working",className:"size-3.5"}):n.jsx(Nee,{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(b4,{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(Mee,{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(ie,{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(L$,{className:"size-4"})}),n.jsx(ya,{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 zee({onCreateSandbox:e}){var $,U,F;const t=yo(),r=js(),[a,i]=x.useState(!1),[c,u]=x.useState(""),[f,m]=x.useState(!1),h=x.useRef(null);x.useEffect(()=>()=>{var K;return(K=h.current)==null?void 0:K.abort()},[]);const g=t.locations.find(K=>K.cloud||K.target==="cloud"),p=!!(g!=null&&g.connected);async function b(){const K=new AbortController;h.current=K,i(!0),u("");try{await r.prepare({signal:K.signal}),K.signal.throwIfAborted(),m(!0),t.refresh()}catch(se){se.name!=="AbortError"&&u(se.message)}finally{i(!1),h.current=null}}const[y,w]=x.useState(null),[C,S]=x.useState(null),[N,E]=x.useState(null),[k,A]=x.useState(null),[O,R]=x.useState(!1),[T,M]=x.useState(null),D=x.useCallback(async K=>{try{w(await cs.connections(K)),S(null)}catch(se){se.name!=="AbortError"&&S(se.message)}},[]);x.useEffect(()=>{const K=new AbortController;return D(K.signal),()=>K.abort()},[D]);const _=(y==null?void 0:y.active)??null,H=TA(_==null?void 0:_.status),G=H==="connected",B=x.useMemo(()=>{if(!y)return[];const K=y.hosts.map(se=>({...se,state:(_==null?void 0:_.host)===se.name?TA(_.status):"off",error:(_==null?void 0:_.host)===se.name?_.error:null}));return _&&!K.some(se=>se.name===_.host)&&K.push({name:_.host,state:H,error:_.error}),K},[y,_,H]),P=B.filter(K=>K.managed||K.name===(_==null?void 0:_.host)).sort((K,se)=>(se.state==="connected")-(K.state==="connected")||(K.label??K.name).localeCompare(se.label??se.name)),V=B.filter(K=>!P.includes(K)),Y=K=>t.sandboxes.filter(se=>{var ne;return((ne=se.location)==null?void 0:ne.remote)&&se.location.host===K.name}).length;async function W(K,se,ne){E(K);try{await se(),await D(),t.refresh()}catch(ve){He.error(ne,{description:ve.message})}finally{E(null)}}const q=(K,se)=>{se?A({host:K.name,replacing:G?_.host:void 0}):W(K.name,async()=>{await cs.disconnectRemote(),He.success(`Disconnected from ${K.label??K.name}`)},"Couldn’t disconnect")};function ee(){const{kind:K,row:se}=T;M(null);const ne=se.label??se.name;K==="forget"?W(se.name,async()=>{await cs.forgetRemote(),He.success(`Forgot ${ne}`)},"Couldn’t forget it"):W(se.name,async()=>{(_==null?void 0:_.host)===se.name&&await cs.forgetRemote(),await cs.removeSshHost(se.name),He.success(`Deleted ${ne}`)},"Couldn’t delete it")}function z(K){const se=K.name===(_==null?void 0:_.host);return!K.managed&&!se?null:n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.jsx(ie,{variant:"ghost",size:"icon-sm","aria-label":`More actions for ${K.label??K.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:[K.state==="connected"&&n.jsx(Rs,{onClick:()=>q(K,!1),children:"Disconnect"}),K.state!=="connected"&&K.state!=="connecting"&&n.jsx(Rs,{onClick:()=>q(K,!0),children:K.state==="failed"?"Try again":"Connect"}),se&&!K.managed&&n.jsx(Rs,{onClick:()=>M({kind:"forget",row:K}),children:"Forget"}),K.managed&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Rs,{variant:"destructive",disabled:K.state==="connected"||K.state==="connecting",onClick:()=>M({kind:"delete",row:K}),children:["Delete",K.state==="connected"?" (disconnect first)":""]})]})]})]})}const L=(K,se)=>n.jsx(mo,{delay:.04*se,offset:4,blur:"3px",className:"contents",children:n.jsx(Dee,{row:K,count:Y(K),working:N===K.name,onToggle:q,onCreate:e,menu:z(K)})},K.name),X=(T==null?void 0:T.row.label)??(T==null?void 0:T.row.name),te="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(mo,{duration:.2,offset:4,blur:"3px",children:n.jsxs("div",{className:te,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 · ${WD(t.sandboxes.filter(K=>{var se;return(se=K.location)==null?void 0:se.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(ie,{variant:"ghost",size:"sm",onClick:()=>{var K;(K=h.current)==null||K.abort(),r.cancelConnect()},children:[n.jsx(Rt,{}),"Cancel"]}):n.jsxs(n.Fragment,{children:[p&&!f?n.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>window.dispatchEvent(new CustomEvent("openrod-import",{detail:{destination:g}})),children:[n.jsx(pf,{className:"size-3.5"}),"Import data"]}):!p&&n.jsxs(ie,{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(ie,{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(K=>u(K.message)),children:"Refresh connection"}),n.jsx(ju,{}),n.jsx(Rs,{onClick:()=>r.disconnect().catch(K=>u(K.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(ie,{variant:"ghost",size:"sm",onClick:()=>m(!1),children:"Not now"}),n.jsxs(ie,{size:"sm",onClick:()=>{m(!1),window.dispatchEvent(new CustomEvent("openrod-import",{detail:{destination:g}}))},children:[n.jsx(pf,{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(ie,{variant:"outline",size:"sm",onClick:()=>D(),children:"Retry"})]}),!y&&!C&&n.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Reading connections…"}),y&&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(ie,{variant:"ghost",size:"icon-sm","aria-label":"Refresh connections",onClick:()=>D(),className:"text-muted-foreground",children:n.jsx(rl,{})}),((F=y.forgottenHosts)==null?void 0:F.length)>0&&n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.jsx(ie,{variant:"ghost",size:"sm"}),children:"Restore"}),n.jsx(qi,{align:"end",children:y.forgottenHosts.map(K=>n.jsxs(Rs,{onClick:()=>W(K,()=>cs.restoreSshHost(K),"Couldn’t restore it"),children:["Restore ",K]},K))})]}),n.jsxs(ie,{size:"sm",onClick:()=>R(!0),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(ys,{className:"size-3.5"}),"Add"]})]}),P.length>0?n.jsx("ul",{className:te,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(ie,{variant:"outline",className:"mt-4",onClick:()=>R(!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:te,children:V.map(L)})]})]})]})}),n.jsx(Fr,{open:!!T,onOpenChange:K=>{K||M(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:[(T==null?void 0:T.kind)==="forget"?"Forget":"Delete"," ",X,"?"]}),n.jsx(Xr,{children:(T==null?void 0:T.kind)==="forget"?`${(T==null?void 0:T.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:ee,children:(T==null?void 0:T.kind)==="forget"?"Forget":"Delete"})]})]})}),n.jsx(Oee,{open:O,onOpenChange:R,onAdded:K=>{R(!1),He.success(`Added ${K.name}`),D(),A({host:K.alias})}}),n.jsx(en,{open:!!k,onOpenChange:K=>{K||A(null)},children:n.jsxs(tn,{className:"sm:max-w-3xl","aria-describedby":void 0,children:[n.jsx(nn,{children:n.jsx(Qt,{children:k!=null&&k.replacing?"Switch host":"Connect a remote machine"})}),k&&n.jsx(zj,{initialHost:k.host,connectedHost:k.replacing??null,onUseConnected:()=>A(null),onConnected:K=>{A(null),He.success(`Connected to ${K.host}`),D(),t.refresh()},onBack:()=>A(null)},k.host)]})})]})}const EA=({...e})=>{const{resolvedTheme:t}=UA();return n.jsx(EK,{theme:t??"system",className:"toaster group",icons:{success:n.jsx(EL,{className:"size-4"}),info:n.jsx(Mu,{className:"size-4"}),warning:n.jsx(ti,{className:"size-4"}),error:n.jsx(DO,{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})};function Iee({children:e,user:t,logout:r}){const[a]=x.useState(()=>window.location.hash.startsWith("#local-connect=")?nB(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=iB(a));const h=setTimeout(()=>{m&&c("Could not return to your local console. Close this window and connect again from OpenRod.")},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:[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:i?"Start a new connection from your local console.":f?`Returning to local OpenRod as ${t.email}. This window will close automatically.`:"This sign-in request is invalid or its local OpenRod tab closed. Start again from local OpenRod."}),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 Pee({children:e}){var S,N;const t=js(),r=((S=t==null?void 0:t.status)==null?void 0:S.origin)||Df,{chooseGroups:a,dialog:i,cancel:c}=Xj(),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,y]=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 k=>{var A;if(!(w.current||k.origin!==r||k.source!==window.opener||((A=k.data)==null?void 0:A.type)!=="openrod-local-bundle"||k.data.nonce!==h.current)){w.current=!0,p("importing");try{if(typeof k.data.error=="string")throw Error(k.data.error);const R=(await f.inventory()).locations.find(_=>!_.remote&&_.connected);if(!R)throw Error("Connect a local gateway before importing this workspace.");const T=f.forContext(R.context),M=await a(T,"local OpenRod",u.current.signal);if(C.current)return;const D=await T.importCloud({...k.data.bundle,...M?{destinationGroups:M}:{}});if(window.opener.postMessage({type:"openrod-local-result",nonce:h.current,name:D.name},r),C.current)return;y(k.data.warning??"Workspace copied locally. Reconnect agent credentials to continue."),window.location.href=yg(D.name,"shell",{...R,target:"local"}),p("done")}catch(O){if(C.current||u.current.signal.aborted)return;y(O.message),p("error"),window.opener.postMessage({type:"openrod-local-result",nonce:h.current,error:O.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,k=setInterval(()=>{var A;((A=window.opener)!=null&&A.closed||Date.now()>E)&&(u.current.abort(),c(),y("The cloud tab closed or the copy timed out. Open the workspace to check whether a copy was created."),p("error"))},1e3);return()=>clearInterval(k)},[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:()=>y(""),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 mv(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 Lee({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(C=>C+1,0);async function b(){h(!0),c("");try{a(await mv("machine","POST")),p()}catch(C){c(C.message)}finally{h(!1)}}const y=x.useRef(_ee(window.location.hash)),w=x.useRef(!1);return x.useEffect(()=>{let C=!0,S;async function N(){try{const E=await mv("machine");C&&(a(E),c(E.error??""),["ready","none","error"].includes(E.status)||(S=setTimeout(N,5e3)))}catch(E){C&&(c(E.message),S=setTimeout(N,1e4))}}return N(),()=>{C=!1,clearTimeout(S)}},[g]),x.useEffect(()=>{const C=y.current;if((r==null?void 0:r.status)!=="ready"||!C||!window.opener||w.current)return;w.current=!0,f({status:"waiting"});const S=k=>{var A;if(y.current&&!(k.source!==window.opener||k.origin!==C.origin||((A=k.data)==null?void 0:A.type)!=="openrod-cloud-result"||k.data.nonce!==C.nonce)){if(k.data.error){f({status:"error",message:k.data.error});return}f({status:"done",message:k.data.warning??"Workspace copied. Reconnect your agent credentials to continue."}),/^[a-z0-9-]{1,63}$/.test(k.data.name??"")&&(window.location.hash=`terminal/${k.data.name}?session=shell`)}};window.addEventListener("message",S),mv("handoff","POST").then(({ticket:k})=>window.opener.postMessage({type:"openrod-cloud-ready",nonce:C.nonce,ticket:k},C.origin)).catch(k=>f({status:"error",message:k.message}));const N=Date.now()+35*6e4,E=setInterval(()=>{var k;y.current&&((k=window.opener)!=null&&k.closed||Date.now()>N)&&(f({status:"error",message:"The source tab closed or the copy timed out. Open your workspace to check whether a copy was created."}),clearInterval(E))},1e3);return()=>{window.removeEventListener("message",S),clearInterval(E)}},[r==null?void 0:r.status]),(r==null?void 0:r.status)==="ready"&&(!u||u.status==="done")?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]}):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:u?"Continuing your workspace…":(r==null?void 0:r.status)==="none"?"Start OpenRod Cloud":"Starting your cloud machine…"}),n.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:u?"Keep the local OpenRod tab open while your files are copied and your template is rebuilt.":"Your account has one dedicated machine. Its first start can take several minutes."}),(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(ie,{disabled:m,className:"mt-5",onClick:b,children:[m&&n.jsx(Rt,{}),i?"Try again":"Start cloud machine"]}),u&&n.jsx("button",{onClick:()=>{y.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 $ee({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 Bee={"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 Vee(e){return Bee[e==null?void 0:e.code]||"Couldn’t sign in. Try again."}const RA=()=>Promise.all([gv(()=>import("./index.esm-Cj6nXjOx.js"),__vite__mapDeps([0,1])),gv(()=>import("./index.esm-Z1y-oluO.js"),__vite__mapDeps([2,1]))]);async function hv(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 Uee(){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 Hee({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 k=await hv("config");if(!["local","cloud"].includes(k.mode))throw Error("Invalid console configuration");if(!C)return;if(ln.configure({mode:k.mode,enabled:k.telemetryEnabled===!0}),r(k),k.mode==="cloud"){const A=await fetch("/api/auth/me");if(A.ok){const O=await A.json();C&&i(O.user)}else if(A.status!==401){const O=await A.json();throw Error(O.error??"Authentication unavailable")}}}catch(k){C&&m(k.message)}finally{C&&u(!1)}}S();const N=()=>{i(null),m("Your session expired. Sign in again.")},E=()=>{ln.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&&RA().catch(()=>{})},[t==null?void 0:t.firebase,a]);async function y(){if(p||!(t!=null&&t.firebase))return;b(!0),m("");let C,S;try{const[{initializeApp:N,getApps:E},k]=await RA();S=k;const A=E().find(M=>M.name==="openrod-cloud")??N(t.firebase,"openrod-cloud");C=S.getAuth(A),await S.setPersistence(C,S.inMemoryPersistence);const O=new S.GoogleAuthProvider;O.setCustomParameters({prompt:"select_account"});const R=await S.signInWithPopup(C,O),T=await hv("session",{idToken:await R.user.getIdToken(!0)});i(T.user)}catch(N){m(Vee(N))}finally{C&&await S.signOut(C).catch(()=>{}),b(!1)}}async function w(){try{await hv("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(fB,{children:n.jsx(Pee,{children:n.jsx(cZ,{children:e})})}):a?n.jsx(Iee,{user:a,logout:w,children:n.jsx(uB,{user:a,logout:w,children:n.jsx(Lee,{logout:w,children:e},a.uid)})}):n.jsx($ee,{localConnect:window.location.hash.startsWith("#local-connect="),error:f,busy:p,available:!!(t!=null&&t.firebase),onLogin:y})}const AA=e=>e?JSON.stringify([e.target??"local",e.context]):null;function Fee(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}],Gee=$x.filter(e=>!e.optional).map(e=>e.id),Ul=e=>["running","cancelling"].includes(e==null?void 0:e.status),qee=e=>e&&!["planned","running","cancelling"].includes(e.status);function Yee(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 OA({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 MA(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 Kee(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 qd={...Object.fromEntries($x.map(e=>[e.id,e.label])),policyTemplates:"Base policy"},pv=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 Xee({request:e,onClose:t}){var ye,Ce,Ie,de,Te,oe,fe,Re,Me,ke;const r=js(),a=Bf(),i=yo(),[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&&qd[e.type]?[e.type]:Gee),[y,w]=x.useState({from:"",to:""}),[C,S]=x.useState(null),[N,E]=x.useState({}),[k,A]=x.useState(null),[O,R]=x.useState([]),[T,M]=x.useState(null),[D,_]=x.useState([]),[H,G]=x.useState(""),[B,P]=x.useState(""),[V,Y]=x.useState(null),W=i.locations.filter(me=>me.connected),q=h&&(i.locations.find(me=>Ts(me)===Ts(h))??h),ee=q!=null&&q.connected&&!W.some(me=>Ts(me)===Ts(h))?[...W,q]:W,z=ee.find(me=>Ts(me)===c),L=ee.find(me=>Ts(me)===f),X=x.useRef(new AbortController),te=x.useRef(0);x.useEffect(()=>{const me=++te.current;return()=>queueMicrotask(()=>{te.current===me&&X.current.abort()})},[]);const $=x.useRef(((ye=r==null?void 0:r.status)==null?void 0:ye.owner)??null);!$.current&&((Ce=r==null?void 0:r.status)!=null&&Ce.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(me=>lr(r!=null&&r.localViewer?me.target:a.target,U,me.context,$.current),[r==null?void 0:r.localViewer,a.target,U]);x.useEffect(()=>{!c&&W.length&&u(Ts(W.find(me=>!me.cloud&&!me.remote)??W[0]))},[c,W.map(Ts).join("|")]),x.useEffect(()=>{if(f!=="cloud")return;const me=ee.find(Ae=>(Ae.cloud||Ae.target==="cloud")&&Ae.connected);me&&m(Ts(me))},[f,ee.map(me=>`${Ts(me)}:${me.connected}`).join("|")]),x.useEffect(()=>{if(_([]),!(L!=null&&L.connected))return;const me=F(L);let Ae=!0;return me.importJobs().then(ge=>{Ae&&_(ge.jobs??[])}).catch(()=>{Ae&&_([])}),()=>{Ae=!1}},[f,L==null?void 0:L.context,L==null?void 0:L.connected,F,T==null?void 0:T.id,T==null?void 0:T.status]),x.useEffect(()=>{if(!T||!Ul(T)||!V)return;let me=!0,Ae;const ge=async()=>{try{const Pe=await V.importJob(T.id);if(!me)return;M(Pe),Ul(Pe)?Ae=setTimeout(ge,1e3):(i.refresh(),window.dispatchEvent(new Event("openrod-resources-changed")))}catch(Pe){me&&(P(Pe.message),Ae=setTimeout(ge,3e3))}};return ge(),()=>{me=!1,clearTimeout(Ae)}},[T==null?void 0:T.id,T==null?void 0:T.status,V]);async function K(me,Ae){G(me),P("");try{await Ae()}catch(ge){ge.name!=="AbortError"&&P(ge.message)}finally{U.aborted||G("")}}async function se(){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 me=await r.prepare({signal:U,onProgress:()=>{U.aborted||G("Preparing cloud workspace…")}});if($.current&&$.current!==me.owner)throw Error("Your cloud account changed. Start a new import.");$.current=me.owner,U.throwIfAborted();const ge=(Fe=(await Ha("inventory",void 0,{signal:U,owner:me.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 ne(me=y){if(!z)throw Error("Choose a connected source.");const Ae=F(z),ge=p.includes("activity")?OA(me):void 0,Pe=await se();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=>qd[ct]).join(", ")}.`);const Je=await Ae.exportResources({types:p,...ge?{activity:ge}:{}});S(_e),E({}),Y(Fe),A(Je),R(Je.resources.filter(ct=>p.includes(ct.type)).map(ct=>ct.key))}const ve=x.useMemo(()=>{try{const me=k?Yee(k.resources,O):[],Ae=[...new Set((k==null?void 0:k.resources.filter(ge=>{var Pe,Fe;return me.includes(ge.key)&&C&&!((Fe=(Pe=C.types)==null?void 0:Pe[ge.type])!=null&&Fe.supported)}).map(ge=>ge.type))??[])];return{included:me,error:Ae.length?`Required dependencies cannot be imported here: ${Ae.map(ge=>qd[ge]??ge).join(", ")}.`:""}}catch(me){return{included:O,error:`${me.message}. Deselect the resource that requires it, or fix the source and read it again.`}}},[k,O,C]);async function ae(me,Ae){const ge={...N};Ae==="reuse"?ge[me.key]={action:Ae,targetId:me.sourceId}:delete ge[me.key];const Pe=await V.planImport({bundle:k,selection:O,conflicts:ge});E(ge),M(Pe)}const le=ve.included,re=T?"result":k?"select":"source",Q=!!H||Ul(T);function Z(){A(null),M(null),R([]),E({}),w(me=>({from:me.from,to:me.to})),P("")}const pe=me=>{var Ae;return n.jsxs("label",{className:"flex items-start gap-3 p-3",children:[n.jsx($o,{"aria-label":`Import ${me.name}`,checked:le.includes(me.key),disabled:Q||!O.includes(me.key)&&le.includes(me.key),onCheckedChange:ge=>R(Pe=>ge?[...Pe,me.key]:Pe.filter(Fe=>Fe!==me.key))}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:me.name}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:le.includes(me.key)&&!O.includes(me.key)?"Required dependency":""}),me.type==="setups"&&["mcp","skill"].map(ge=>{var Fe;const Pe=(((Fe=me.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=me.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))]})]},me.key)},ue=T?`${((Ie=T.counts)==null?void 0:Ie.completed)??0} of ${T.items.length} resources complete. Your source stays available.`:k?"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(en,{open:!0,onOpenChange:me=>{!me&&!H&&t()},children:n.jsxs(tn,{className:"gap-4 sm:max-w-xl",children:[n.jsxs(nn,{className:"pr-6",children:[n.jsx(Qt,{children:T?pv(T.status):"Import data"}),n.jsx(Rn,{className:"text-xs leading-relaxed",children:ue})]}),n.jsx("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground","aria-label":"Import steps",children:["Locations","Selection","Review & import"].map((me,Ae)=>n.jsxs(x.Fragment,{children:[Ae>0&&n.jsx(hu,{className:"size-3"}),n.jsx("span",{className:Ae===(re==="source"?0:re==="select"?1:2)?"font-medium text-foreground":"",children:me})]},me))}),n.jsxs("div",{className:"max-h-[60svh] overflow-y-auto pr-1",children:[re==="source"&&n.jsxs(mo,{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:me=>{u(me.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(me=>n.jsx("option",{value:Ts(me),children:Dn(me)},Ts(me)))]})]}),n.jsx(hu,{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:me=>{m(me.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"||!ee.some(me=>me.cloud||me.target==="cloud"))&&n.jsxs("option",{value:"cloud",disabled:!(r!=null&&r.available),children:["OpenRod Cloud",r!=null&&r.available?"":" · Coming soon"]}),ee.map(me=>n.jsx("option",{value:Ts(me),disabled:Ts(me)===c,children:Dn(me)},Ts(me)))]})]})]}),n.jsxs("fieldset",{className:"space-y-1",children:[n.jsx("legend",{className:"mb-2 text-xs font-medium",children:"Include"}),$x.map(me=>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(me.id),disabled:Q,onCheckedChange:Ae=>b(ge=>Ae?[...ge,me.id]:ge.filter(Pe=>Pe!==me.id))}),n.jsxs("span",{children:[n.jsx("span",{className:"block text-xs font-medium",children:me.label}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:me.description})]})]},me.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(Mt,{type:"datetime-local",value:y.from,disabled:Q,onChange:me=>w(Ae=>({from:me.target.value,to:Ae.to})),className:"text-xs"})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px]",children:["To",n.jsx(Mt,{type:"datetime-local",value:y.to,disabled:Q,onChange:me=>w(Ae=>({from:Ae.from,to:me.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(me=>{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:()=>{Y(F(L)),M(me)},children:[n.jsxs("span",{children:[((Ae=me.source)==null?void 0:Ae.label)||"Configuration import"," ",n.jsxs("span",{className:"text-muted-foreground",children:["· ",((ge=me.items)==null?void 0:ge.length)??((Pe=me.counts)==null?void 0:Pe.total)??0," resources"]})]}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:pv(me.status)})]},me.id)})]})]}),re==="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(hu,{className:"size-3 text-muted-foreground"}),n.jsx("span",{children:Dn(L)})]}),!k.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:[le.length," selected",le.length>O.length?` · ${le.length-O.length} required dependencies`:""]}),n.jsx(ie,{variant:"ghost",size:"sm",disabled:Q,onClick:()=>R(O.length?[]:k.resources.filter(me=>p.includes(me.type)).map(me=>me.key)),children:O.length?"Clear selection":"Select all"})]}),n.jsx("div",{className:"space-y-5",children:Kee(k.resources).map(me=>n.jsxs("section",{"aria-labelledby":`import-section-${me.id}`,className:"space-y-2",children:[n.jsxs("h3",{id:`import-section-${me.id}`,className:"flex items-center justify-between text-xs font-semibold",children:[n.jsx("span",{children:me.label}),n.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground",children:[me.items.filter(Ae=>le.includes(Ae.key)).length," / ",me.items.length]})]}),me.groups?n.jsx("div",{className:"space-y-3",children:me.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(pe)})]},Ae.id))}):n.jsx("div",{className:"divide-y rounded-lg border",children:me.items.map(pe)})]},me.id))}),ve.error&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:ve.error}),((de=k.pages)==null?void 0:de.activity)&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[k.pages.activity.exported," of ",k.pages.activity.total," matching activity events in this batch.",k.pages.activity.nextOffset!=null?" After importing, load the next batch to continue with older history.":""]}),((Te=k.excluded)==null?void 0:Te.length)>0&&n.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[n.jsxs("summary",{className:"cursor-pointer",children:[k.excluded.length," excluded or needing attention"]}),n.jsx("ul",{className:"mt-2 space-y-1",children:k.excluded.map((me,Ae)=>n.jsxs("li",{children:[me.name??qd[me.type]??me.type,": ",me.reason]},Ae))})]})]}),T&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsxs("span",{children:[((oe=T.source)==null?void 0:oe.label)||"Source"," → ",L?Dn(L):"Destination"]}),n.jsxs("span",{className:"text-muted-foreground",children:[T.items.length," resources"]})]}),T.status!=="planned"&&n.jsx("div",{role:"progressbar","aria-label":"Import progress","aria-valuenow":MA(T),"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:`${MA(T)}%`}})}),n.jsx("div",{className:"divide-y rounded-lg border",children:T.items.map(me=>{var Ae;return n.jsxs("div",{className:"flex items-start gap-3 p-3",children:[me.status==="running"?n.jsx(Rt,{className:"mt-0.5 size-3.5"}):["created","completed","reused"].includes(me.status)?n.jsx(Yn,{className:"mt-0.5 size-3.5 text-emerald-600"}):me.status==="failed"?n.jsx(In,{className:"mt-0.5 size-3.5 text-destructive"}):n.jsx(pf,{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:me.name}),n.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:[qd[me.type]," · ",T.status==="planned"?me.action==="reuse"?"Use existing":"Create a copy":pv(me.status)]}),(Ae=me.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)),me.error&&n.jsx("span",{className:"mt-1 block text-[11px] text-destructive",children:typeof me.error=="string"?me.error:me.error.message}),T.status==="planned"&&k&&me.type!=="activity"&&n.jsxs(pn,{"aria-label":`Import action for ${me.name}`,value:me.action,disabled:Q,onChange:ge=>K("Updating review…",()=>ae(me,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"})]})]})]},me.key)})}),T.status==="planned"&&k&&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=T.warnings)==null?void 0:fe.map((me,Ae)=>n.jsx("p",{className:"text-[11px] text-muted-foreground",children:me},Ae)),Ul(T)&&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(T)&&n.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>{X.current.abort(),t()},children:"Cancel"}),re!=="source"&&!Ul(T)&&n.jsx(ie,{size:"sm",variant:"ghost",disabled:!!H,onClick:Z,children:"Start another import"}),re==="source"&&n.jsxs(ie,{size:"sm",disabled:Q||!z||!f||!p.length||c===f||f==="cloud"&&!(r!=null&&r.available),onClick:()=>K("Reading configuration…",()=>ne()),children:[H?n.jsx(Rt,{}):n.jsx(pf,{}),H||"Choose resources"]}),re==="select"&&n.jsxs(ie,{size:"sm",disabled:Q||!O.length||!!ve.error,onClick:()=>K("Preparing review…",async()=>M(await V.planImport({bundle:k,selection:O,conflicts:N}))),children:[H&&n.jsx(Rt,{}),H||`Review ${le.length} resources`]}),(T==null?void 0:T.status)==="planned"&&n.jsxs(ie,{size:"sm",disabled:Q,onClick:()=>K("Starting import…",async()=>M(await V.executeImport(T.id))),children:[H&&n.jsx(Rt,{}),H||"Import selected data"]}),Ul(T)&&n.jsx(ie,{size:"sm",variant:"outline",disabled:!!H||T.cancelRequested||T.status==="cancelling",onClick:()=>K("Cancelling…",async()=>M(await V.cancelImport(T.id))),children:T.cancelRequested?"Cancelling…":"Cancel import"}),qee(T)&&(((Re=T.counts)==null?void 0:Re.failed)>0||T.items.some(me=>["failed","blocked","cancelled","pending"].includes(me.status)))&&n.jsxs(ie,{size:"sm",disabled:!!H,onClick:()=>K("Retrying…",async()=>M(await V.retryImport(T.id))),children:[n.jsx(IO,{}),"Retry unfinished"]}),(T==null?void 0:T.status)==="completed"&&T.items.some(me=>me.type==="activity")&&((ke=(Me=k==null?void 0:k.pages)==null?void 0:Me.activity)==null?void 0:ke.nextOffset)!=null&&n.jsx(ie,{size:"sm",variant:"outline",disabled:!!H||!z,onClick:()=>K("Reading older history…",async()=>{const me={...y,offset:k.pages.activity.nextOffset,snapshot:k.pages.activity.snapshot};w(me),b(["activity"]);const ge=await F(z).exportResources({types:["activity"],activity:OA(me)});A(ge),R(ge.resources.map(Pe=>Pe.key)),E({}),M(null)}),children:"Next history batch"}),T&&T.status!=="planned"&&n.jsx(ie,{size:"sm",variant:"outline",onClick:t,children:"Close"})]})]})})}var Jj={};(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 te=new OffscreenCanvas(X.width,X.height),$=te.getContext("2d");return $.drawImage(X,0,0),L.set(X,te),te},clear:function(){L.clear()}}})(f,new Map),p=(function(){var z=Math.floor(16.666666666666668),L,X,te={},$=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(L=function(U){var F=Math.random();return te[F]=requestAnimationFrame(function K(se){$===se||$+z-1<se?($=se,delete te[F],U()):te[F]=requestAnimationFrame(K)}),F},X=function(U){te[U]&&cancelAnimationFrame(te[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 te($){function U(F,K){$.postMessage({options:F||{},callback:K})}$.init=function(K){var se=K.transferControlToOffscreen();$.postMessage({canvas:se},[se])},$.fire=function(K,se,ne){if(L)return U(K,null),L;var ve=Math.random().toString(36).slice(2);return L=h(function(ae){function le(re){re.data.callback===ve&&(delete X[ve],$.removeEventListener("message",le),L=null,g.clear(),ne(),ae())}$.addEventListener("message",le),U(K,ve),X[ve]=le.bind(null,{data:{callback:ve}})}),L},$.reset=function(){$.postMessage({reset:!0});for(var K in X)X[K](),delete X[K]}}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}te(z)}return z}})(),y={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]:y[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 k(z){return parseInt(z,16)}function A(z){return z.map(O)}function O(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:k(L.substring(0,2)),g:k(L.substring(2,4)),b:k(L.substring(4,6))}}function R(z){var L=S(z,"origin",Object);return L.x=S(L,"x",Number),L.y=S(L,"y",Number),L}function T(z){z.width=document.documentElement.clientWidth,z.height=document.documentElement.clientHeight}function M(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,te,$,U,F,K,se){z.save(),z.translate(L,X),z.rotate(U),z.scale(te,$),z.arc(0,0,1,F,K,se),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,te=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-te)*.1,Math.abs(F-$)*.1,Math.PI/10*L.wobble));else if(L.shape.type==="bitmap"){var K=Math.PI/10*L.wobble,se=Math.abs(U-te)*.1,ne=Math.abs(F-$)*.1,ve=L.shape.bitmap.width*L.scalar,ae=L.shape.bitmap.height*L.scalar,le=new DOMMatrix([Math.cos(K)*se,Math.sin(K)*se,-Math.sin(K)*ne,Math.cos(K)*ne,L.x,L.y]);le.multiplySelf(new DOMMatrix(L.shape.matrix));var re=z.createPattern(g.transform(L.shape.bitmap),"no-repeat");re.setTransform(le),z.globalAlpha=1-X,z.fillStyle=re,z.fillRect(L.x-ve/2,L.y-ae/2,ve,ae),z.globalAlpha=1}else if(L.shape==="circle")z.ellipse?z.ellipse(L.x,L.y,Math.abs(U-te)*L.ovalScalar,Math.abs(F-$)*L.ovalScalar,Math.PI/10*L.wobble,0,2*Math.PI):_(z,L.x,L.y,Math.abs(U-te)*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,Z=4*L.scalar,pe=8*L.scalar,ue=L.x,ye=L.y,Ce=5,Ie=Math.PI/Ce;Ce--;)ue=L.x+Math.cos(Q)*pe,ye=L.y+Math.sin(Q)*pe,z.lineTo(ue,ye),Q+=Ie,ue=L.x+Math.cos(Q)*Z,ye=L.y+Math.sin(Q)*Z,z.lineTo(ue,ye),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(te),Math.floor(L.wobbleY));return z.closePath(),z.fill(),L.tick<L.totalTicks}function B(z,L,X,te,$){var U=L.slice(),F=z.getContext("2d"),K,se,ne=h(function(ve){function ae(){K=se=null,F.clearRect(0,0,te.width,te.height),g.clear(),$(),ve()}function le(){a&&!(te.width===i.width&&te.height===i.height)&&(te.width=z.width=i.width,te.height=z.height=i.height),!te.width&&!te.height&&(X(z),te.width=z.width,te.height=z.height),F.clearRect(0,0,te.width,te.height),U=U.filter(function(re){return G(F,re)}),U.length?K=p.frame(le):ae()}K=p.frame(le),se=ae});return{addFettis:function(ve){return U=U.concat(ve),ne},canvas:z,promise:ne,reset:function(){K&&p.cancel(K),se&&se()}}}function P(z,L){var X=!z,te=!!S(L||{},"resize"),$=!1,U=S(L,"disableForReducedMotion",Boolean),F=c&&!!S(L||{},"useWorker"),K=F?b():null,se=X?T:M,ne=z&&K?!!z.__confetti_initialized:!1,ve=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ae;function le(Q,Z,pe){for(var ue=S(Q,"particleCount",N),ye=S(Q,"angle",Number),Ce=S(Q,"spread",Number),Ie=S(Q,"startVelocity",Number),de=S(Q,"decay",Number),Te=S(Q,"gravity",Number),oe=S(Q,"drift",Number),fe=S(Q,"colors",A),Re=S(Q,"ticks",Number),Me=S(Q,"shapes"),ke=S(Q,"scalar"),me=!!S(Q,"flat"),Ae=R(Q),ge=ue,Pe=[],Fe=z.width*Ae.x,_e=z.height*Ae.y;ge--;)Pe.push(H({x:Fe,y:_e,angle:ye,spread:Ce,startVelocity:Ie,color:fe[ge%fe.length],shape:Me[E(0,Me.length)],ticks:Re,decay:de,gravity:Te,drift:oe,scalar:ke,flat:me}));return ae?ae.addFettis(Pe):(ae=B(z,Pe,se,Z,pe),ae.promise)}function re(Q){var Z=U||S(Q,"disableForReducedMotion",Boolean),pe=S(Q,"zIndex",Number);if(Z&&ve)return h(function(Ie){Ie()});X&&ae?z=ae.canvas:X&&!z&&(z=D(pe),document.body.appendChild(z)),te&&!ne&&se(z);var ue={width:z.width,height:z.height};K&&!ne&&K.init(z),ne=!0,K&&(z.__confetti_initialized=!0);function ye(){if(K){var Ie={getBoundingClientRect:function(){if(!X)return z.getBoundingClientRect()}};se(Ie),K.postMessage({resize:{width:Ie.width,height:Ie.height}});return}ue.width=ue.height=null}function Ce(){ae=null,te&&($=!1,t.removeEventListener("resize",ye)),X&&z&&(document.body.contains(z)&&document.body.removeChild(z),z=null,ne=!1)}return te&&!$&&($=!0,t.addEventListener("resize",ye,!1)),K?K.fire(Q,ue,Ce):le(Q,ue,Ce)}return re.reset=function(){K&&K.reset(),ae&&ae.reset()},re}var V;function Y(){return V||(V=P(null,{useWorker:!0,resize:!0})),V}function W(z,L,X,te,$,U,F){var K=new Path2D(z),se=new Path2D;se.addPath(K,new DOMMatrix(L));var ne=new Path2D;return ne.addPath(se,new DOMMatrix([Math.cos(F)*$,Math.sin(F)*$,-Math.sin(F)*U,Math.cos(F)*U,X,te])),ne}function q(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 te=new Path2D(L),$=document.createElement("canvas"),U=$.getContext("2d");if(!X){for(var F=1e3,K=F,se=F,ne=0,ve=0,ae,le,re=0;re<F;re+=2)for(var Q=0;Q<F;Q+=2)U.isPointInPath(te,re,Q,"nonzero")&&(K=Math.min(K,re),se=Math.min(se,Q),ne=Math.max(ne,re),ve=Math.max(ve,Q));ae=ne-K,le=ve-se;var Z=10,pe=Math.min(Z/ae,Z/le);X=[pe,0,0,pe,-Math.round(ae/2+K)*pe,-Math.round(le/2+se)*pe]}return{type:"path",path:L,matrix:X}}function ee(z){var L,X=1,te="#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:$,te="color"in z?z.color:te);var U=10*X,F=""+U+"px "+$,K=new OffscreenCanvas(U,U),se=K.getContext("2d");se.font=F;var ne=se.measureText(L),ve=Math.ceil(ne.actualBoundingBoxRight+ne.actualBoundingBoxLeft),ae=Math.ceil(ne.actualBoundingBoxAscent+ne.actualBoundingBoxDescent),le=2,re=ne.actualBoundingBoxLeft+le,Q=ne.actualBoundingBoxAscent+le;ve+=le+le,ae+=le+le,K=new OffscreenCanvas(ve,ae),se=K.getContext("2d"),se.font=F,se.fillStyle=te,se.fillText(L,re,Q);var Z=1/X;return{type:"bitmap",bitmap:K.transferToImageBitmap(),matrix:[Z,0,0,Z,-ve*Z/2,-ae*Z/2]}}r.exports=function(){return Y().apply(this,arguments)},r.exports.reset=function(){Y().reset()},r.exports.create=P,r.exports.shapeFromPath=q,r.exports.shapeFromText=ee})((function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}})(),Jj,!1);const Wee=Jj.exports;Jj.exports.create;const DA="openrod:cloud-announcement:v1:dismissed";let zA,IA=!1;function Qee(){return zA??(zA=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}))),zA}function Zee(){const[e,t]=x.useState(!0),r=x.useRef(null);x.useEffect(()=>{let i=!0;return Qee().then(({show:c})=>{let u=IA;try{u||(u=localStorage.getItem(DA)==="true")}catch{}i&&t(!c||u)}),()=>{i=!1}},[]),x.useEffect(()=>{if(e||!r.current)return;const i=Wee.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(){IA=!0,t(!0);try{localStorage.setItem(DA,"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(ie,{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 Jee=x.lazy(()=>gv(()=>import("./terminal-view-D-SQcdM5.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 ete extends x.Component{constructor(){super(...arguments);an(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 PA(){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 _A(){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 LA(){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 tte(){const{connection:e}=oi(),t=Kj();return x.useEffect(()=>{ln.observeConsole(e)},[e,t.sharing]),null}function nte(){var E,k;const e=Bf(),t=js(),r=!(t!=null&&t.localViewer),[a,i]=x.useState(LA),[c,u]=x.useState(_A),[f,m]=x.useState(0),[h,g]=x.useState(PA),p=Kj();x.useEffect(()=>{ln.observeView(c?"terminal":a)},[a,!!c,p.sharing]);const[b,y]=x.useState(null),w=yo(),C=x.useMemo(()=>Fee(w.locations,null,e.target??"local"),[w.locations,e.target]),S=x.useCallback((A,O)=>{var M;const R=O??null;if((M=e.signal)!=null&&M.aborted||!P1[A])return;i(A),g(R);const T=R?`?${new URLSearchParams({gateway:R.gateway,workspace:R.workspace,label:R.label,remote:R.remote?"1":"0",...R.target?{target:R.target}:{}})}`:"";window.history.pushState(null,"",A==="sandboxes"&&!R?window.location.pathname:`#${A}${T}`)},[e.signal]),N=r?void 0:()=>{S("sandboxes"),m(A=>A+1)};return x.useEffect(()=>{const A=()=>{i(LA()),u(_A()),g(PA())};window.addEventListener("popstate",A),window.addEventListener("hashchange",A);const O=R=>S(R.detail.view,R.detail.location);return window.addEventListener("openrod-navigate",O),()=>{window.removeEventListener("popstate",A),window.removeEventListener("hashchange",A),window.removeEventListener("openrod-navigate",O)}},[S]),x.useEffect(()=>{const A=O=>{var R,T,M;return y({...O.detail,type:((R=O.detail)==null?void 0:R.type)??((M=(T=O.detail)==null?void 0:T.types)==null?void 0:M[0]),key:Date.now()})};return window.addEventListener("openrod-import",A),()=>window.removeEventListener("openrod-import",A)},[]),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(Jee,{name:c.name,session:c.session,setupLogin:c.setupLogin,mcp:c.mcp},`${t==null?void 0:t.target} ${((k=c.location)==null?void 0:k.context)??""} ${c.name} ${c.session??""}`)})}),n.jsx(EA,{position:"bottom-right"})]}):n.jsx(Zn,{location:C,children:n.jsxs(Ef,{children:[n.jsx(tte,{}),n.jsxs(JQ,{children:[n.jsx(pZ,{view:a,onNavigate:S}),n.jsxs(nZ,{className:"min-w-0 bg-background",children:[n.jsx(Zee,{}),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(tZ,{className:"mr-2 md:hidden"}),n.jsx("h1",{className:"text-[18px] font-semibold tracking-tight",children:P1[a]}),n.jsx(Uee,{})]}),n.jsx(tQ,{}),n.jsx(hQ,{}),!r&&n.jsx(bQ,{}),n.jsxs(ete,{view:a,children:[a==="sandboxes"&&n.jsx(uJ,{onNavigate:S,allowRemote:!r,createRequest:f,onCreateRequestHandled:()=>m(0)}),a==="activity"&&n.jsx(TJ,{combined:!0}),a==="groups"&&n.jsx(MJ,{combined:!0,onNavigate:S}),(a==="egress"||a==="ingress")&&n.jsx(GJ,{combined:!0,tab:a,onNavigate:S,requestedLocation:h}),a==="secrets"&&n.jsx(lee,{combined:!0}),a==="templates"&&n.jsx(bee,{}),a==="setups"&&n.jsx(oD,{combined:!0}),a==="connections"&&!r&&n.jsx(zee,{onCreateSandbox:N})]},`${a}:${AA(C)??"unscoped"}`)]}),n.jsx(EA,{position:"bottom-right"}),b&&n.jsx(Xee,{request:b,onClose:()=>y(null)},b.key)]})]},AA(C)??"unscoped")})}YP.createRoot(document.getElementById("root")).render(n.jsx(nt.StrictMode,{children:n.jsx(PP,{attribute:"class",defaultTheme:"system",enableSystem:!0,storageKey:"openshell-theme",children:n.jsx(Hee,{children:n.jsx(nte,{})})})}));export{ie as B,ma as C,Fi as D,ga as L,k$ as R,nw as T,gn as a,ln as b,mf as c,WY as d,Cu as e,ote as f,Gi as g,qi as h,Rs as i,n as j,zp as p,x as r,o4 as s,yg as t,Pt as u};
|