import{r as m,R as Q,a as uS,b as dS,c as _N,d as eg,e as $d,u as tg,L as Kp,N as zu,O as fS,f as jN,g as CN,h as EN,i as Nn,B as RN}from"./react-B75e6Si-.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function a(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(l){if(l.ep)return;l.ep=!0;const u=a(l);fetch(l.href,u)}})();var Ip={exports:{}},El={};var Jb;function NN(){if(Jb)return El;Jb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(i,l,u){var d=null;if(u!==void 0&&(d=""+u),l.key!==void 0&&(d=""+l.key),"key"in l){u={};for(var f in l)f!=="key"&&(u[f]=l[f])}else u=l;return l=u.ref,{$$typeof:e,type:i,key:d,ref:l!==void 0?l:null,props:u}}return El.Fragment=t,El.jsx=a,El.jsxs=a,El}var Wb;function ON(){return Wb||(Wb=1,Ip.exports=NN()),Ip.exports}var o=ON(),AN=(e,t,a,i,l,u,d,f)=>{let g=document.documentElement,y=["light","dark"];function x(_){(Array.isArray(e)?e:[e]).forEach(R=>{let S=R==="class",A=S&&u?l.map(M=>u[M]||M):l;S?(g.classList.remove(...A),g.classList.add(u&&u[_]?u[_]:_)):g.setAttribute(R,_)}),v(_)}function v(_){f&&y.includes(_)&&(g.style.colorScheme=_)}function w(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(i)x(i);else try{let _=localStorage.getItem(t)||a,R=d&&_==="system"?w():_;x(R)}catch{}},ew=["light","dark"],hS="(prefers-color-scheme: dark)",TN=typeof window>"u",ng=m.createContext(void 0),DN={setTheme:e=>{},themes:[]},MN=()=>{var e;return(e=m.useContext(ng))!=null?e:DN},kN=e=>m.useContext(ng)?m.createElement(m.Fragment,null,e.children):m.createElement(PN,{...e}),zN=["light","dark"],PN=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:a=!0,enableColorScheme:i=!0,storageKey:l="theme",themes:u=zN,defaultTheme:d=a?"system":"light",attribute:f="data-theme",value:g,children:y,nonce:x,scriptProps:v})=>{let[w,_]=m.useState(()=>IN(l,d)),[R,S]=m.useState(()=>w==="system"?Lp():w),A=g?Object.values(g):u,M=m.useCallback(D=>{let I=D;if(!I)return;D==="system"&&a&&(I=Lp());let U=g?g[I]:I,F=t?LN(x):null,fe=document.documentElement,ge=he=>{he==="class"?(fe.classList.remove(...A),U&&fe.classList.add(U)):he.startsWith("data-")&&(U?fe.setAttribute(he,U):fe.removeAttribute(he))};if(Array.isArray(f)?f.forEach(ge):ge(f),i){let he=ew.includes(d)?d:null,ne=ew.includes(I)?I:he;fe.style.colorScheme=ne}F?.()},[x]),T=m.useCallback(D=>{let I=typeof D=="function"?D(w):D;_(I);try{localStorage.setItem(l,I)}catch{}},[w]),N=m.useCallback(D=>{let I=Lp(D);S(I),w==="system"&&a&&!e&&M("system")},[w,e]);m.useEffect(()=>{let D=window.matchMedia(hS);return D.addListener(N),N(D),()=>D.removeListener(N)},[N]),m.useEffect(()=>{let D=I=>{I.key===l&&(I.newValue?_(I.newValue):T(d))};return window.addEventListener("storage",D),()=>window.removeEventListener("storage",D)},[T]),m.useEffect(()=>{M(e??w)},[e,w]);let E=m.useMemo(()=>({theme:w,setTheme:T,forcedTheme:e,resolvedTheme:w==="system"?R:w,themes:a?[...u,"system"]:u,systemTheme:a?R:void 0}),[w,T,e,R,a,u]);return m.createElement(ng.Provider,{value:E},m.createElement(KN,{forcedTheme:e,storageKey:l,attribute:f,enableSystem:a,enableColorScheme:i,defaultTheme:d,value:g,themes:u,nonce:x,scriptProps:v}),y)},KN=m.memo(({forcedTheme:e,storageKey:t,attribute:a,enableSystem:i,enableColorScheme:l,defaultTheme:u,value:d,themes:f,nonce:g,scriptProps:y})=>{let x=JSON.stringify([a,t,u,e,f,d,i,l]).slice(1,-1);return m.createElement("script",{...y,suppressHydrationWarning:!0,nonce:typeof window>"u"?g:"",dangerouslySetInnerHTML:{__html:`(${AN.toString()})(${x})`}})}),IN=(e,t)=>{if(TN)return;let a;try{a=localStorage.getItem(e)||void 0}catch{}return a||t},LN=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)}},Lp=e=>(e||(e=window.matchMedia(hS)),e.matches?"dark":"light");function UN({children:e,defaultTheme:t="system",storageKey:a="vite-ui-theme"}){return o.jsx(kN,{attribute:"class",defaultTheme:t,enableSystem:!0,storageKey:a,disableTransitionOnChange:!0,children:e})}var Es=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},qN={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},FN=class{#e=qN;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Yi=new FN;function $N(e){setTimeout(e,0)}var Wi=typeof window>"u"||"Deno"in globalThis;function Dn(){}function VN(e,t){return typeof e=="function"?e(t):e}function mm(e){return typeof e=="number"&&e>=0&&e!==1/0}function pS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function gi(e,t){return typeof e=="function"?e(t):e}function Ea(e,t){return typeof e=="function"?e(t):e}function tw(e,t){const{type:a="all",exact:i,fetchStatus:l,predicate:u,queryKey:d,stale:f}=e;if(d){if(i){if(t.queryHash!==ag(d,t.options))return!1}else if(!Wl(t.queryKey,d))return!1}if(a!=="all"){const g=t.isActive();if(a==="active"&&!g||a==="inactive"&&g)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||l&&l!==t.state.fetchStatus||u&&!u(t))}function nw(e,t){const{exact:a,status:i,predicate:l,mutationKey:u}=e;if(u){if(!t.options.mutationKey)return!1;if(a){if(eo(t.options.mutationKey)!==eo(u))return!1}else if(!Wl(t.options.mutationKey,u))return!1}return!(i&&t.state.status!==i||l&&!l(t))}function ag(e,t){return(t?.queryKeyHashFn||eo)(e)}function eo(e){return JSON.stringify(e,(t,a)=>gm(a)?Object.keys(a).sort().reduce((i,l)=>(i[l]=a[l],i),{}):a)}function Wl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(a=>Wl(e[a],t[a])):!1}var BN=Object.prototype.hasOwnProperty;function mS(e,t){if(e===t)return e;const a=aw(e)&&aw(t);if(!a&&!(gm(e)&&gm(t)))return t;const l=(a?e:Object.keys(e)).length,u=a?t:Object.keys(t),d=u.length,f=a?new Array(d):{};let g=0;for(let y=0;y{Yi.setTimeout(t,e)})}function ym(e,t,a){return typeof a.structuralSharing=="function"?a.structuralSharing(e,t):a.structuralSharing!==!1?mS(e,t):t}function HN(e,t,a=0){const i=[...e,t];return a&&i.length>a?i.slice(1):i}function XN(e,t,a=0){const i=[t,...e];return a&&i.length>a?i.slice(0,-1):i}var rg=Symbol();function gS(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===rg?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function yS(e,t){return typeof e=="function"?e(...t):!!e}var ZN=class extends Es{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Wi&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ig=new ZN;function vm(){let e,t;const a=new Promise((l,u)=>{e=l,t=u});a.status="pending",a.catch(()=>{});function i(l){Object.assign(a,l),delete a.resolve,delete a.reject}return a.resolve=l=>{i({status:"fulfilled",value:l}),e(l)},a.reject=l=>{i({status:"rejected",reason:l}),t(l)},a}var YN=$N;function QN(){let e=[],t=0,a=f=>{f()},i=f=>{f()},l=YN;const u=f=>{t?e.push(f):l(()=>{a(f)})},d=()=>{const f=e;e=[],f.length&&l(()=>{i(()=>{f.forEach(g=>{a(g)})})})};return{batch:f=>{let g;t++;try{g=f()}finally{t--,t||d()}return g},batchCalls:f=>(...g)=>{u(()=>{f(...g)})},schedule:u,setNotifyFunction:f=>{a=f},setBatchNotifyFunction:f=>{i=f},setScheduler:f=>{l=f}}}var cn=QN(),JN=class extends Es{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Wi&&window.addEventListener){const t=()=>e(!0),a=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",a)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(a=>{a(e)}))}isOnline(){return this.#e}},gd=new JN;function WN(e){return Math.min(1e3*2**e,3e4)}function vS(e){return(e??"online")==="online"?gd.isOnline():!0}var xm=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function xS(e){let t=!1,a=0,i;const l=vm(),u=()=>l.status!=="pending",d=S=>{if(!u()){const A=new xm(S);w(A),e.onCancel?.(A)}},f=()=>{t=!0},g=()=>{t=!1},y=()=>ig.isFocused()&&(e.networkMode==="always"||gd.isOnline())&&e.canRun(),x=()=>vS(e.networkMode)&&e.canRun(),v=S=>{u()||(i?.(),l.resolve(S))},w=S=>{u()||(i?.(),l.reject(S))},_=()=>new Promise(S=>{i=A=>{(u()||y())&&S(A)},e.onPause?.()}).then(()=>{i=void 0,u()||e.onContinue?.()}),R=()=>{if(u())return;let S;const A=a===0?e.initialPromise:void 0;try{S=A??e.fn()}catch(M){S=Promise.reject(M)}Promise.resolve(S).then(v).catch(M=>{if(u())return;const T=e.retry??(Wi?0:3),N=e.retryDelay??WN,E=typeof N=="function"?N(a,M):N,D=T===!0||typeof T=="number"&&ay()?void 0:_()).then(()=>{t?w(M):R()})})};return{promise:l,status:()=>l.status,cancel:d,continue:()=>(i?.(),l),cancelRetry:f,continueRetry:g,canStart:x,start:()=>(x()?R():_().then(R),l)}}var bS=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mm(this.gcTime)&&(this.#e=Yi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wi?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Yi.clearTimeout(this.#e),this.#e=void 0)}},eO=class extends bS{#e;#t;#n;#r;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=ow(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=ow(this.options);t.data!==void 0&&(this.setState(iw(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const a=ym(this.state.data,e,this.options);return this.#i({data:a,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),a}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Dn).catch(Dn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Ea(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>gi(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!pS(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(g=>g.options.queryFn);f&&this.setOptions(f.options)}const a=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(this.#s=!0,a.signal)})},l=()=>{const f=gS(this.options,t),y=(()=>{const x={client:this.#r,queryKey:this.queryKey,meta:this.meta};return i(x),x})();return this.#s=!1,this.options.persister?this.options.persister(f,y,this):f(y)},d=(()=>{const f={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:l};return i(f),f})();this.options.behavior?.onFetch(d,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)&&this.#i({type:"fetch",meta:d.fetchOptions?.meta}),this.#a=xS({initialPromise:t?.initialPromise,fn:d.fetchFn,onCancel:f=>{f instanceof xm&&f.revert&&this.setState({...this.#t,fetchStatus:"idle"}),a.abort()},onFail:(f,g)=>{this.#i({type:"failed",failureCount:f,error:g})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0});try{const f=await this.#a.start();if(f===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(f),this.#n.config.onSuccess?.(f,this),this.#n.config.onSettled?.(f,this.state.error,this),f}catch(f){if(f instanceof xm){if(f.silent)return this.#a.promise;if(f.revert){if(this.state.data===void 0)throw f;return this.state.data}}throw this.#i({type:"error",error:f}),this.#n.config.onError?.(f,this),this.#n.config.onSettled?.(this.state.data,f,this),f}finally{this.scheduleGc()}}#i(e){const t=a=>{switch(e.type){case"failed":return{...a,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...wS(a.data,this.options),fetchMeta:e.meta??null};case"success":const i={...a,...iw(e.data,e.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?i:void 0,i;case"error":const l=e.error;return{...a,error:l,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error"};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...e.state}}};this.state=t(this.state),cn.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function wS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:vS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function iw(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ow(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,a=t!==void 0,i=a?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:a?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var tO=class extends Es{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#s=vm(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#a;#o;#s;#i;#m;#f;#h;#c;#u;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),sw(this.#t,this.options)?this.#d():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,a=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ea(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!md(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&lw(this.#t,a,this.options,t)&&this.#d(),this.updateResult(),i&&(this.#t!==a||Ea(this.options.enabled,this.#t)!==Ea(t.enabled,this.#t)||gi(this.options.staleTime,this.#t)!==gi(t.staleTime,this.#t))&&this.#g();const l=this.#y();i&&(this.#t!==a||Ea(this.options.enabled,this.#t)!==Ea(t.enabled,this.#t)||l!==this.#l)&&this.#v(l)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),a=this.createResult(t,e);return aO(this,a)&&(this.#r=a,this.#o=this.options,this.#a=this.#t.state),a}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(a,i)=>(this.trackProp(i),t?.(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#s.status==="pending"&&this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,i))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),a=this.#e.getQueryCache().build(this.#e,t);return a.fetch().then(()=>this.createResult(a,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#d(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Dn)),t}#g(){this.#b();const e=gi(this.options.staleTime,this.#t);if(Wi||this.#r.isStale||!mm(e))return;const a=pS(this.#r.dataUpdatedAt,e)+1;this.#c=Yi.setTimeout(()=>{this.#r.isStale||this.updateResult()},a)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#w(),this.#l=e,!(Wi||Ea(this.options.enabled,this.#t)===!1||!mm(this.#l)||this.#l===0)&&(this.#u=Yi.setInterval(()=>{(this.options.refetchIntervalInBackground||ig.isFocused())&&this.#d()},this.#l))}#x(){this.#g(),this.#v(this.#y())}#b(){this.#c&&(Yi.clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(Yi.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const a=this.#t,i=this.options,l=this.#r,u=this.#a,d=this.#o,g=e!==a?e.state:this.#n,{state:y}=e;let x={...y},v=!1,w;if(t._optimisticResults){const F=this.hasListeners(),fe=!F&&sw(e,t),ge=F&&lw(e,a,t,i);(fe||ge)&&(x={...x,...wS(y.data,e.options)}),t._optimisticResults==="isRestoring"&&(x.fetchStatus="idle")}let{error:_,errorUpdatedAt:R,status:S}=x;w=x.data;let A=!1;if(t.placeholderData!==void 0&&w===void 0&&S==="pending"){let F;l?.isPlaceholderData&&t.placeholderData===d?.placeholderData?(F=l.data,A=!0):F=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,F!==void 0&&(S="success",w=ym(l?.data,F,t),v=!0)}if(t.select&&w!==void 0&&!A)if(l&&w===u?.data&&t.select===this.#m)w=this.#f;else try{this.#m=t.select,w=t.select(w),w=ym(l?.data,w,t),this.#f=w,this.#i=null}catch(F){this.#i=F}this.#i&&(_=this.#i,w=this.#f,R=Date.now(),S="error");const M=x.fetchStatus==="fetching",T=S==="pending",N=S==="error",E=T&&M,D=w!==void 0,U={status:S,fetchStatus:x.fetchStatus,isPending:T,isSuccess:S==="success",isError:N,isInitialLoading:E,isLoading:E,data:w,dataUpdatedAt:x.dataUpdatedAt,error:_,errorUpdatedAt:R,failureCount:x.fetchFailureCount,failureReason:x.fetchFailureReason,errorUpdateCount:x.errorUpdateCount,isFetched:x.dataUpdateCount>0||x.errorUpdateCount>0,isFetchedAfterMount:x.dataUpdateCount>g.dataUpdateCount||x.errorUpdateCount>g.errorUpdateCount,isFetching:M,isRefetching:M&&!T,isLoadingError:N&&!D,isPaused:x.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:N&&D,isStale:og(e,t),refetch:this.refetch,promise:this.#s,isEnabled:Ea(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const F=he=>{U.status==="error"?he.reject(U.error):U.data!==void 0&&he.resolve(U.data)},fe=()=>{const he=this.#s=U.promise=vm();F(he)},ge=this.#s;switch(ge.status){case"pending":e.queryHash===a.queryHash&&F(ge);break;case"fulfilled":(U.status==="error"||U.data!==ge.value)&&fe();break;case"rejected":(U.status!=="error"||U.error!==ge.reason)&&fe();break}}return U}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#o=this.options,this.#a.data!==void 0&&(this.#h=this.#t),md(t,e))return;this.#r=t;const a=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,l=typeof i=="function"?i():i;if(l==="all"||!l&&!this.#p.size)return!0;const u=new Set(l??this.#p);return this.options.throwOnError&&u.add("error"),Object.keys(this.#r).some(d=>{const f=d;return this.#r[f]!==e[f]&&u.has(f)})};this.#_({listeners:a()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#_(e){cn.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function nO(e,t){return Ea(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function sw(e,t){return nO(e,t)||e.state.data!==void 0&&bm(e,t,t.refetchOnMount)}function bm(e,t,a){if(Ea(t.enabled,e)!==!1&&gi(t.staleTime,e)!=="static"){const i=typeof a=="function"?a(e):a;return i==="always"||i!==!1&&og(e,t)}return!1}function lw(e,t,a,i){return(e!==t||Ea(i.enabled,e)===!1)&&(!a.suspense||e.state.status!=="error")&&og(e,a)}function og(e,t){return Ea(t.enabled,e)!==!1&&e.isStaleByTime(gi(t.staleTime,e))}function aO(e,t){return!md(e.getCurrentResult(),t)}function cw(e){return{onFetch:(t,a)=>{const i=t.options,l=t.fetchOptions?.meta?.fetchMore?.direction,u=t.state.data?.pages||[],d=t.state.data?.pageParams||[];let f={pages:[],pageParams:[]},g=0;const y=async()=>{let x=!1;const v=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(t.signal.aborted?x=!0:t.signal.addEventListener("abort",()=>{x=!0}),t.signal)})},w=gS(t.options,t.fetchOptions),_=async(R,S,A)=>{if(x)return Promise.reject();if(S==null&&R.pages.length)return Promise.resolve(R);const T=(()=>{const I={client:t.client,queryKey:t.queryKey,pageParam:S,direction:A?"backward":"forward",meta:t.options.meta};return v(I),I})(),N=await w(T),{maxPages:E}=t.options,D=A?XN:HN;return{pages:D(R.pages,N,E),pageParams:D(R.pageParams,S,E)}};if(l&&u.length){const R=l==="backward",S=R?rO:uw,A={pages:u,pageParams:d},M=S(i,A);f=await _(A,M,R)}else{const R=e??u.length;do{const S=g===0?d[0]??i.initialPageParam:uw(i,f);if(g>0&&S==null)break;f=await _(f,S),g++}while(gt.options.persister?.(y,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},a):t.fetchFn=y}}}function uw(e,{pages:t,pageParams:a}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,a[i],a):void 0}function rO(e,{pages:t,pageParams:a}){return t.length>0?e.getPreviousPageParam?.(t[0],t,a[0],a):void 0}var iO=class extends bS{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||SS(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#a({type:"continue"})},a={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=xS({fn:()=>this.options.mutationFn?this.options.mutationFn(e,a):Promise.reject(new Error("No mutationFn found")),onFail:(u,d)=>{this.#a({type:"failed",failureCount:u,error:d})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const i=this.state.status==="pending",l=!this.#r.canStart();try{if(i)t();else{this.#a({type:"pending",variables:e,isPaused:l}),await this.#n.config.onMutate?.(e,this,a);const d=await this.options.onMutate?.(e,a);d!==this.state.context&&this.#a({type:"pending",context:d,variables:e,isPaused:l})}const u=await this.#r.start();return await this.#n.config.onSuccess?.(u,e,this.state.context,this,a),await this.options.onSuccess?.(u,e,this.state.context,a),await this.#n.config.onSettled?.(u,null,this.state.variables,this.state.context,this,a),await this.options.onSettled?.(u,null,e,this.state.context,a),this.#a({type:"success",data:u}),u}catch(u){try{throw await this.#n.config.onError?.(u,e,this.state.context,this,a),await this.options.onError?.(u,e,this.state.context,a),await this.#n.config.onSettled?.(void 0,u,this.state.variables,this.state.context,this,a),await this.options.onSettled?.(void 0,u,e,this.state.context,a),u}finally{this.#a({type:"error",error:u})}}finally{this.#n.runNext(this)}}#a(e){const t=a=>{switch(e.type){case"failed":return{...a,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...a,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:e.error,failureCount:a.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),cn.batch(()=>{this.#t.forEach(a=>{a.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function SS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var oO=class extends Es{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,a){const i=new iO({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:a});return this.add(i),i}add(e){this.#e.add(e);const t=Pu(e);if(typeof t=="string"){const a=this.#t.get(t);a?a.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Pu(e);if(typeof t=="string"){const a=this.#t.get(t);if(a)if(a.length>1){const i=a.indexOf(e);i!==-1&&a.splice(i,1)}else a[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Pu(e);if(typeof t=="string"){const i=this.#t.get(t)?.find(l=>l.state.status==="pending");return!i||i===e}else return!0}runNext(e){const t=Pu(e);return typeof t=="string"?this.#t.get(t)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){cn.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(a=>nw(t,a))}findAll(e={}){return this.getAll().filter(t=>nw(e,t))}notify(e){cn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return cn.batch(()=>Promise.all(e.map(t=>t.continue().catch(Dn))))}};function Pu(e){return e.options.scope?.id}var sO=class extends Es{#e;#t=void 0;#n;#r;constructor(t,a){super(),this.#e=t,this.setOptions(a),this.bindMethods(),this.#a()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const a=this.options;this.options=this.#e.defaultMutationOptions(t),md(this.options,a)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),a?.mutationKey&&this.options.mutationKey&&eo(a.mutationKey)!==eo(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#a(),this.#o(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#a(),this.#o()}mutate(t,a){return this.#r=a,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#a(){const t=this.#n?.state??SS();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){cn.batch(()=>{if(this.#r&&this.hasListeners()){const a=this.#t.variables,i=this.#t.context,l={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#r.onSuccess?.(t.data,a,i,l),this.#r.onSettled?.(t.data,null,a,i,l)):t?.type==="error"&&(this.#r.onError?.(t.error,a,i,l),this.#r.onSettled?.(void 0,t.error,a,i,l))}this.listeners.forEach(a=>{a(this.#t)})})}},lO=class extends Es{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,a){const i=t.queryKey,l=t.queryHash??ag(i,t);let u=this.get(l);return u||(u=new eO({client:e,queryKey:i,queryHash:l,options:e.defaultQueryOptions(t),state:a,defaultOptions:e.getQueryDefaults(i)}),this.add(u)),u}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){cn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(a=>tw(t,a))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(a=>tw(e,a)):t}notify(e){cn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){cn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){cn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},cO=class{#e;#t;#n;#r;#a;#o;#s;#i;constructor(e={}){this.#e=e.queryCache||new lO,this.#t=e.mutationCache||new oO,this.#n=e.defaultOptions||{},this.#r=new Map,this.#a=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#s=ig.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=gd.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#s?.(),this.#s=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),a=this.#e.build(this,t),i=a.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&a.isStaleByTime(gi(t.staleTime,a))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:a})=>{const i=a.data;return[t,i]})}setQueryData(e,t,a){const i=this.defaultQueryOptions({queryKey:e}),u=this.#e.get(i.queryHash)?.state.data,d=VN(t,u);if(d!==void 0)return this.#e.build(this,i).setData(d,{...a,manual:!0})}setQueriesData(e,t,a){return cn.batch(()=>this.#e.findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,a)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;cn.batch(()=>{t.findAll(e).forEach(a=>{t.remove(a)})})}resetQueries(e,t){const a=this.#e;return cn.batch(()=>(a.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const a={revert:!0,...t},i=cn.batch(()=>this.#e.findAll(e).map(l=>l.cancel(a)));return Promise.all(i).then(Dn).catch(Dn)}invalidateQueries(e,t={}){return cn.batch(()=>(this.#e.findAll(e).forEach(a=>{a.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const a={...t,cancelRefetch:t.cancelRefetch??!0},i=cn.batch(()=>this.#e.findAll(e).filter(l=>!l.isDisabled()&&!l.isStatic()).map(l=>{let u=l.fetch(void 0,a);return a.throwOnError||(u=u.catch(Dn)),l.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(i).then(Dn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const a=this.#e.build(this,t);return a.isStaleByTime(gi(t.staleTime,a))?a.fetch(t):Promise.resolve(a.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dn).catch(Dn)}fetchInfiniteQuery(e){return e.behavior=cw(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Dn).catch(Dn)}ensureInfiniteQueryData(e){return e.behavior=cw(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gd.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(eo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],a={};return t.forEach(i=>{Wl(e,i.queryKey)&&Object.assign(a,i.defaultOptions)}),a}setMutationDefaults(e,t){this.#a.set(eo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#a.values()],a={};return t.forEach(i=>{Wl(e,i.mutationKey)&&Object.assign(a,i.defaultOptions)}),a}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ag(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===rg&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},_S=m.createContext(void 0),Xn=e=>{const t=m.useContext(_S);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},uO=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(_S.Provider,{value:e,children:t})),jS=m.createContext(!1),dO=()=>m.useContext(jS);jS.Provider;function fO(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var hO=m.createContext(fO()),pO=()=>m.useContext(hO),mO=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},gO=e=>{m.useEffect(()=>{e.clearReset()},[e])},yO=({result:e,errorResetBoundary:t,throwOnError:a,query:i,suspense:l})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(l&&e.data===void 0||yS(a,[e.error,i])),vO=e=>{if(e.suspense){const a=l=>l==="static"?l:Math.max(l??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...l)=>a(i(...l)):a(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},xO=(e,t)=>e.isLoading&&e.isFetching&&!t,bO=(e,t)=>e?.suspense&&t.isPending,dw=(e,t,a)=>t.fetchOptimistic(e).catch(()=>{a.clearReset()});function wO(e,t,a){const i=dO(),l=pO(),u=Xn(),d=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(d),d._optimisticResults=i?"isRestoring":"optimistic",vO(d),mO(d,l),gO(l);const f=!u.getQueryCache().get(d.queryHash),[g]=m.useState(()=>new t(u,d)),y=g.getOptimisticResult(d),x=!i&&e.subscribed!==!1;if(m.useSyncExternalStore(m.useCallback(v=>{const w=x?g.subscribe(cn.batchCalls(v)):Dn;return g.updateResult(),w},[g,x]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),m.useEffect(()=>{g.setOptions(d)},[d,g]),bO(d,y))throw dw(d,g,l);if(yO({result:y,errorResetBoundary:l,throwOnError:d.throwOnError,query:u.getQueryCache().get(d.queryHash),suspense:d.suspense}))throw y.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(d,y),d.experimental_prefetchInRender&&!Wi&&xO(y,i)&&(f?dw(d,g,l):u.getQueryCache().get(d.queryHash)?.promise)?.catch(Dn).finally(()=>{g.updateResult()}),d.notifyOnChangeProps?y:g.trackResult(y)}function Zt(e,t){return wO(e,tO)}function lt(e,t){const a=Xn(),[i]=m.useState(()=>new sO(a,e));m.useEffect(()=>{i.setOptions(e)},[i,e]);const l=m.useSyncExternalStore(m.useCallback(d=>i.subscribe(cn.batchCalls(d)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),u=m.useCallback((d,f)=>{i.mutate(d,f).catch(Dn)},[i]);if(l.error&&yS(i.options.throwOnError,[l.error]))throw l.error;return{...l,mutate:u,mutateAsync:l.mutate}}const SO=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_O=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,i)=>i?i.toUpperCase():a.toLowerCase()),fw=e=>{const t=_O(e);return t.charAt(0).toUpperCase()+t.slice(1)},CS=(...e)=>e.filter((t,a,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===a).join(" ").trim(),jO=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var CO={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"};const EO=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:l="",children:u,iconNode:d,...f},g)=>m.createElement("svg",{ref:g,...CO,width:t,height:t,stroke:e,strokeWidth:i?Number(a)*24/Number(t):a,className:CS("lucide",l),...!u&&!jO(f)&&{"aria-hidden":"true"},...f},[...d.map(([y,x])=>m.createElement(y,x)),...Array.isArray(u)?u:[u]]));const ct=(e,t)=>{const a=m.forwardRef(({className:i,...l},u)=>m.createElement(EO,{ref:u,iconNode:t,className:CS(`lucide-${SO(fw(e))}`,`lucide-${e}`,i),...l}));return a.displayName=fw(e),a};const RO=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],NO=ct("boxes",RO);const OO=[["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"}]],ES=ct("building-2",OO);const AO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],RS=ct("check",AO);const TO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],NS=ct("chevron-down",TO);const DO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],MO=ct("chevron-right",DO);const kO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zO=ct("chevron-up",kO);const PO=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],KO=ct("chevrons-up-down",PO);const IO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],LO=ct("circle-check",IO);const UO=[["path",{d:"M22 2 2 22",key:"y4kqgn"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sg=ct("circle-slash-2",UO);const qO=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],FO=ct("clipboard",qO);const $O=[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]],VO=ct("component",$O);const BO=[["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"}]],GO=ct("download",BO);const HO=[["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"}]],OS=ct("ellipsis",HO);const XO=[["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"}]],ZO=ct("external-link",XO);const YO=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],wm=ct("eye",YO);const QO=[["path",{d:"M10.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v10.1",key:"1a2hbp"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m10 15 1 1",key:"1h4vmv"}],["path",{d:"m11 14-4.586 4.586",key:"maylof"}],["circle",{cx:"5",cy:"20",r:"2",key:"860zyv"}]],JO=ct("file-key",QO);const WO=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],e2=ct("git-commit-horizontal",WO);const t2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],AS=ct("info",t2);const n2=[["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"}]],a2=ct("key-round",n2);const r2=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Ku=ct("link",r2);const i2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],lr=ct("loader-circle",i2);const o2=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],s2=ct("lock-keyhole",o2);const l2=[["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"}]],c2=ct("octagon-x",l2);const u2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],d2=ct("panel-left",u2);const f2=[["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"}]],sc=ct("pencil",f2);const h2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Si=ct("plus",h2);const p2=[["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"}]],m2=ct("refresh-cw",p2);const g2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],dr=ct("search",g2);const y2=[["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"}]],TS=ct("server",y2);const v2=[["path",{d:"M3 3h.01",key:"159qn6"}],["path",{d:"M7 5h.01",key:"1hq22a"}],["path",{d:"M11 7h.01",key:"1osv80"}],["path",{d:"M3 7h.01",key:"1xzrh3"}],["path",{d:"M7 9h.01",key:"19b3jx"}],["path",{d:"M3 11h.01",key:"1eifu7"}],["rect",{width:"4",height:"4",x:"15",y:"5",key:"mri9e4"}],["path",{d:"m19 9 2 2v10c0 .6-.4 1-1 1h-6c-.6 0-1-.4-1-1V11l2-2",key:"aib6hk"}],["path",{d:"m13 14 8-2",key:"1d7bmk"}],["path",{d:"m13 19 8-2",key:"1y2vml"}]],x2=ct("spray-can",v2);const b2=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],Vd=ct("tags",b2);const w2=[["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"}]],lg=ct("trash-2",w2);const S2=[["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"}]],Sm=ct("triangle-alert",S2);const _2=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],j2=ct("user-round",_2);const C2=[["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"}]],DS=ct("users",C2);const E2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],cg=ct("x",E2);function R2(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",t.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}const N2=e=>{switch(e){case"success":return T2;case"info":return M2;case"warning":return D2;case"error":return k2;default:return null}},O2=Array(12).fill(0),A2=({visible:e,className:t})=>Q.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Q.createElement("div",{className:"sonner-spinner"},O2.map((a,i)=>Q.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),T2=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Q.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"})),D2=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Q.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"})),M2=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Q.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"})),k2=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Q.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"})),z2=Q.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"},Q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),P2=()=>{const[e,t]=Q.useState(document.hidden);return Q.useEffect(()=>{const a=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",a),()=>window.removeEventListener("visibilitychange",a)},[]),e};let _m=1;class K2{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const a=this.subscribers.indexOf(t);this.subscribers.splice(a,1)}),this.publish=t=>{this.subscribers.forEach(a=>a(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var a;const{message:i,...l}=t,u=typeof t?.id=="number"||((a=t.id)==null?void 0:a.length)>0?t.id:_m++,d=this.toasts.find(g=>g.id===u),f=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(u)&&this.dismissedToasts.delete(u),d?this.toasts=this.toasts.map(g=>g.id===u?(this.publish({...g,...t,id:u,title:i}),{...g,...t,id:u,dismissible:f,title:i}):g):this.addToast({title:i,...l,dismissible:f,id:u}),u},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(a=>a({id:t,dismiss:!0})))):this.toasts.forEach(a=>{this.subscribers.forEach(i=>i({id:a.id,dismiss:!0}))}),t),this.message=(t,a)=>this.create({...a,message:t}),this.error=(t,a)=>this.create({...a,message:t,type:"error"}),this.success=(t,a)=>this.create({...a,type:"success",message:t}),this.info=(t,a)=>this.create({...a,type:"info",message:t}),this.warning=(t,a)=>this.create({...a,type:"warning",message:t}),this.loading=(t,a)=>this.create({...a,type:"loading",message:t}),this.promise=(t,a)=>{if(!a)return;let i;a.loading!==void 0&&(i=this.create({...a,promise:t,type:"loading",message:a.loading,description:typeof a.description!="function"?a.description:void 0}));const l=Promise.resolve(t instanceof Function?t():t);let u=i!==void 0,d;const f=l.then(async y=>{if(d=["resolve",y],Q.isValidElement(y))u=!1,this.create({id:i,type:"default",message:y});else if(L2(y)&&!y.ok){u=!1;const v=typeof a.error=="function"?await a.error(`HTTP error! status: ${y.status}`):a.error,w=typeof a.description=="function"?await a.description(`HTTP error! status: ${y.status}`):a.description,R=typeof v=="object"&&!Q.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:w,...R})}else if(y instanceof Error){u=!1;const v=typeof a.error=="function"?await a.error(y):a.error,w=typeof a.description=="function"?await a.description(y):a.description,R=typeof v=="object"&&!Q.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:w,...R})}else if(a.success!==void 0){u=!1;const v=typeof a.success=="function"?await a.success(y):a.success,w=typeof a.description=="function"?await a.description(y):a.description,R=typeof v=="object"&&!Q.isValidElement(v)?v:{message:v};this.create({id:i,type:"success",description:w,...R})}}).catch(async y=>{if(d=["reject",y],a.error!==void 0){u=!1;const x=typeof a.error=="function"?await a.error(y):a.error,v=typeof a.description=="function"?await a.description(y):a.description,_=typeof x=="object"&&!Q.isValidElement(x)?x:{message:x};this.create({id:i,type:"error",description:v,..._})}}).finally(()=>{u&&(this.dismiss(i),i=void 0),a.finally==null||a.finally.call(a)}),g=()=>new Promise((y,x)=>f.then(()=>d[0]==="reject"?x(d[1]):y(d[1])).catch(x));return typeof i!="string"&&typeof i!="number"?{unwrap:g}:Object.assign(i,{unwrap:g})},this.custom=(t,a)=>{const i=a?.id||_m++;return this.create({jsx:t(i),id:i,...a}),i},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Gn=new K2,I2=(e,t)=>{const a=t?.id||_m++;return Gn.addToast({title:e,...t,id:a}),a},L2=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",U2=I2,q2=()=>Gn.toasts,F2=()=>Gn.getActiveToasts(),xe=Object.assign(U2,{success:Gn.success,info:Gn.info,warning:Gn.warning,error:Gn.error,custom:Gn.custom,message:Gn.message,promise:Gn.promise,dismiss:Gn.dismiss,loading:Gn.loading},{getHistory:q2,getToasts:F2});R2("[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}[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(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);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]{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 Iu(e){return e.label!==void 0}const $2=3,V2="24px",B2="16px",hw=4e3,G2=356,H2=14,X2=45,Z2=200;function ir(...e){return e.filter(Boolean).join(" ")}function Y2(e){const[t,a]=e.split("-"),i=[];return t&&i.push(t),a&&i.push(a),i}const Q2=e=>{var t,a,i,l,u,d,f,g,y;const{invert:x,toast:v,unstyled:w,interacting:_,setHeights:R,visibleToasts:S,heights:A,index:M,toasts:T,expanded:N,removeToast:E,defaultRichColors:D,closeButton:I,style:U,cancelButtonStyle:F,actionButtonStyle:fe,className:ge="",descriptionClassName:he="",duration:ne,position:le,gap:ce,expandByDefault:ve,classNames:O,icons:j,closeButtonAriaLabel:z="Close toast"}=e,[J,me]=Q.useState(null),[Te,H]=Q.useState(null),[Y,oe]=Q.useState(!1),[se,we]=Q.useState(!1),[ee,Se]=Q.useState(!1),[De,He]=Q.useState(!1),[Qe,Ye]=Q.useState(!1),[Ft,G]=Q.useState(0),[Xe,qe]=Q.useState(0),Je=Q.useRef(v.duration||ne||hw),Qa=Q.useRef(null),En=Q.useRef(null),P=M===0,V=M+1<=S,Z=v.type,be=v.dismissible!==!1,ue=v.className||"",pe=v.descriptionClassName||"",Ie=Q.useMemo(()=>A.findIndex(Ze=>Ze.toastId===v.id)||0,[A,v.id]),ft=Q.useMemo(()=>{var Ze;return(Ze=v.closeButton)!=null?Ze:I},[v.closeButton,I]),ht=Q.useMemo(()=>v.duration||ne||hw,[v.duration,ne]),pn=Q.useRef(0),zn=Q.useRef(0),Qn=Q.useRef(0),Ja=Q.useRef(null),[Ta,an]=le.split("-"),Jn=Q.useMemo(()=>A.reduce((Ze,Kt,mn)=>mn>=Ie?Ze:Ze+Kt.height,0),[A,Ie]),rn=P2(),Ps=v.invert||x,qr=Z==="loading";zn.current=Q.useMemo(()=>Ie*ce+Jn,[Ie,Jn]),Q.useEffect(()=>{Je.current=ht},[ht]),Q.useEffect(()=>{oe(!0)},[]),Q.useEffect(()=>{const Ze=En.current;if(Ze){const Kt=Ze.getBoundingClientRect().height;return qe(Kt),R(mn=>[{toastId:v.id,height:Kt,position:v.position},...mn]),()=>R(mn=>mn.filter(Rn=>Rn.toastId!==v.id))}},[R,v.id]),Q.useLayoutEffect(()=>{if(!Y)return;const Ze=En.current,Kt=Ze.style.height;Ze.style.height="auto";const mn=Ze.getBoundingClientRect().height;Ze.style.height=Kt,qe(mn),R(Rn=>Rn.find(Ut=>Ut.toastId===v.id)?Rn.map(Ut=>Ut.toastId===v.id?{...Ut,height:mn}:Ut):[{toastId:v.id,height:mn,position:v.position},...Rn])},[Y,v.title,v.description,R,v.id,v.jsx,v.action,v.cancel]);const Wa=Q.useCallback(()=>{we(!0),G(zn.current),R(Ze=>Ze.filter(Kt=>Kt.toastId!==v.id)),setTimeout(()=>{E(v)},Z2)},[v,E,R,zn]);Q.useEffect(()=>{if(v.promise&&Z==="loading"||v.duration===1/0||v.type==="loading")return;let Ze;return N||_||rn?(()=>{if(Qn.current{Je.current!==1/0&&(pn.current=new Date().getTime(),Ze=setTimeout(()=>{v.onAutoClose==null||v.onAutoClose.call(v,v),Wa()},Je.current))})(),()=>clearTimeout(Ze)},[N,_,v,Z,rn,Wa]),Q.useEffect(()=>{v.delete&&(Wa(),v.onDismiss==null||v.onDismiss.call(v,v))},[Wa,v.delete]);function ho(){var Ze;if(j?.loading){var Kt;return Q.createElement("div",{className:ir(O?.loader,v==null||(Kt=v.classNames)==null?void 0:Kt.loader,"sonner-loader"),"data-visible":Z==="loading"},j.loading)}return Q.createElement(A2,{className:ir(O?.loader,v==null||(Ze=v.classNames)==null?void 0:Ze.loader),visible:Z==="loading"})}const po=v.icon||j?.[Z]||N2(Z);var Oi,er;return Q.createElement("li",{tabIndex:0,ref:En,className:ir(ge,ue,O?.toast,v==null||(t=v.classNames)==null?void 0:t.toast,O?.default,O?.[Z],v==null||(a=v.classNames)==null?void 0:a[Z]),"data-sonner-toast":"","data-rich-colors":(Oi=v.richColors)!=null?Oi:D,"data-styled":!(v.jsx||v.unstyled||w),"data-mounted":Y,"data-promise":!!v.promise,"data-swiped":Qe,"data-removed":se,"data-visible":V,"data-y-position":Ta,"data-x-position":an,"data-index":M,"data-front":P,"data-swiping":ee,"data-dismissible":be,"data-type":Z,"data-invert":Ps,"data-swipe-out":De,"data-swipe-direction":Te,"data-expanded":!!(N||ve&&Y),"data-testid":v.testId,style:{"--index":M,"--toasts-before":M,"--z-index":T.length-M,"--offset":`${se?Ft:zn.current}px`,"--initial-height":ve?"auto":`${Xe}px`,...U,...v.style},onDragEnd:()=>{Se(!1),me(null),Ja.current=null},onPointerDown:Ze=>{Ze.button!==2&&(qr||!be||(Qa.current=new Date,G(zn.current),Ze.target.setPointerCapture(Ze.pointerId),Ze.target.tagName!=="BUTTON"&&(Se(!0),Ja.current={x:Ze.clientX,y:Ze.clientY})))},onPointerUp:()=>{var Ze,Kt,mn;if(De||!be)return;Ja.current=null;const Rn=Number(((Ze=En.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Fr=Number(((Kt=En.current)==null?void 0:Kt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ut=new Date().getTime()-((mn=Qa.current)==null?void 0:mn.getTime()),Pn=J==="x"?Rn:Fr,Ai=Math.abs(Pn)/Ut;if(Math.abs(Pn)>=X2||Ai>.11){G(zn.current),v.onDismiss==null||v.onDismiss.call(v,v),H(J==="x"?Rn>0?"right":"left":Fr>0?"down":"up"),Wa(),He(!0);return}else{var Kn,In;(Kn=En.current)==null||Kn.style.setProperty("--swipe-amount-x","0px"),(In=En.current)==null||In.style.setProperty("--swipe-amount-y","0px")}Ye(!1),Se(!1),me(null)},onPointerMove:Ze=>{var Kt,mn,Rn;if(!Ja.current||!be||((Kt=window.getSelection())==null?void 0:Kt.toString().length)>0)return;const Ut=Ze.clientY-Ja.current.y,Pn=Ze.clientX-Ja.current.x;var Ai;const Kn=(Ai=e.swipeDirections)!=null?Ai:Y2(le);!J&&(Math.abs(Pn)>1||Math.abs(Ut)>1)&&me(Math.abs(Pn)>Math.abs(Ut)?"x":"y");let In={x:0,y:0};const mo=Da=>1/(1.5+Math.abs(Da)/20);if(J==="y"){if(Kn.includes("top")||Kn.includes("bottom"))if(Kn.includes("top")&&Ut<0||Kn.includes("bottom")&&Ut>0)In.y=Ut;else{const Da=Ut*mo(Ut);In.y=Math.abs(Da)0)In.x=Pn;else{const Da=Pn*mo(Pn);In.x=Math.abs(Da)0||Math.abs(In.y)>0)&&Ye(!0),(mn=En.current)==null||mn.style.setProperty("--swipe-amount-x",`${In.x}px`),(Rn=En.current)==null||Rn.style.setProperty("--swipe-amount-y",`${In.y}px`)}},ft&&!v.jsx&&Z!=="loading"?Q.createElement("button",{"aria-label":z,"data-disabled":qr,"data-close-button":!0,onClick:qr||!be?()=>{}:()=>{Wa(),v.onDismiss==null||v.onDismiss.call(v,v)},className:ir(O?.closeButton,v==null||(i=v.classNames)==null?void 0:i.closeButton)},(er=j?.close)!=null?er:z2):null,(Z||v.icon||v.promise)&&v.icon!==null&&(j?.[Z]!==null||v.icon)?Q.createElement("div",{"data-icon":"",className:ir(O?.icon,v==null||(l=v.classNames)==null?void 0:l.icon)},v.promise||v.type==="loading"&&!v.icon?v.icon||ho():null,v.type!=="loading"?po:null):null,Q.createElement("div",{"data-content":"",className:ir(O?.content,v==null||(u=v.classNames)==null?void 0:u.content)},Q.createElement("div",{"data-title":"",className:ir(O?.title,v==null||(d=v.classNames)==null?void 0:d.title)},v.jsx?v.jsx:typeof v.title=="function"?v.title():v.title),v.description?Q.createElement("div",{"data-description":"",className:ir(he,pe,O?.description,v==null||(f=v.classNames)==null?void 0:f.description)},typeof v.description=="function"?v.description():v.description):null),Q.isValidElement(v.cancel)?v.cancel:v.cancel&&Iu(v.cancel)?Q.createElement("button",{"data-button":!0,"data-cancel":!0,style:v.cancelButtonStyle||F,onClick:Ze=>{Iu(v.cancel)&&be&&(v.cancel.onClick==null||v.cancel.onClick.call(v.cancel,Ze),Wa())},className:ir(O?.cancelButton,v==null||(g=v.classNames)==null?void 0:g.cancelButton)},v.cancel.label):null,Q.isValidElement(v.action)?v.action:v.action&&Iu(v.action)?Q.createElement("button",{"data-button":!0,"data-action":!0,style:v.actionButtonStyle||fe,onClick:Ze=>{Iu(v.action)&&(v.action.onClick==null||v.action.onClick.call(v.action,Ze),!Ze.defaultPrevented&&Wa())},className:ir(O?.actionButton,v==null||(y=v.classNames)==null?void 0:y.actionButton)},v.action.label):null)};function pw(){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 J2(e,t){const a={};return[e,t].forEach((i,l)=>{const u=l===1,d=u?"--mobile-offset":"--offset",f=u?B2:V2;function g(y){["top","right","bottom","left"].forEach(x=>{a[`${d}-${x}`]=typeof y=="number"?`${y}px`:y})}typeof i=="number"||typeof i=="string"?g(i):typeof i=="object"?["top","right","bottom","left"].forEach(y=>{i[y]===void 0?a[`${d}-${y}`]=f:a[`${d}-${y}`]=typeof i[y]=="number"?`${i[y]}px`:i[y]}):g(f)}),a}const W2=Q.forwardRef(function(t,a){const{id:i,invert:l,position:u="bottom-right",hotkey:d=["altKey","KeyT"],expand:f,closeButton:g,className:y,offset:x,mobileOffset:v,theme:w="light",richColors:_,duration:R,style:S,visibleToasts:A=$2,toastOptions:M,dir:T=pw(),gap:N=H2,icons:E,containerAriaLabel:D="Notifications"}=t,[I,U]=Q.useState([]),F=Q.useMemo(()=>i?I.filter(Y=>Y.toasterId===i):I.filter(Y=>!Y.toasterId),[I,i]),fe=Q.useMemo(()=>Array.from(new Set([u].concat(F.filter(Y=>Y.position).map(Y=>Y.position)))),[F,u]),[ge,he]=Q.useState([]),[ne,le]=Q.useState(!1),[ce,ve]=Q.useState(!1),[O,j]=Q.useState(w!=="system"?w:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),z=Q.useRef(null),J=d.join("+").replace(/Key/g,"").replace(/Digit/g,""),me=Q.useRef(null),Te=Q.useRef(!1),H=Q.useCallback(Y=>{U(oe=>{var se;return(se=oe.find(we=>we.id===Y.id))!=null&&se.delete||Gn.dismiss(Y.id),oe.filter(({id:we})=>we!==Y.id)})},[]);return Q.useEffect(()=>Gn.subscribe(Y=>{if(Y.dismiss){requestAnimationFrame(()=>{U(oe=>oe.map(se=>se.id===Y.id?{...se,delete:!0}:se))});return}setTimeout(()=>{uS.flushSync(()=>{U(oe=>{const se=oe.findIndex(we=>we.id===Y.id);return se!==-1?[...oe.slice(0,se),{...oe[se],...Y},...oe.slice(se+1)]:[Y,...oe]})})})}),[I]),Q.useEffect(()=>{if(w!=="system"){j(w);return}if(w==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?j("dark"):j("light")),typeof window>"u")return;const Y=window.matchMedia("(prefers-color-scheme: dark)");try{Y.addEventListener("change",({matches:oe})=>{j(oe?"dark":"light")})}catch{Y.addListener(({matches:se})=>{try{j(se?"dark":"light")}catch(we){console.error(we)}})}},[w]),Q.useEffect(()=>{I.length<=1&&le(!1)},[I]),Q.useEffect(()=>{const Y=oe=>{var se;if(d.every(Se=>oe[Se]||oe.code===Se)){var ee;le(!0),(ee=z.current)==null||ee.focus()}oe.code==="Escape"&&(document.activeElement===z.current||(se=z.current)!=null&&se.contains(document.activeElement))&&le(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[d]),Q.useEffect(()=>{if(z.current)return()=>{me.current&&(me.current.focus({preventScroll:!0}),me.current=null,Te.current=!1)}},[z.current]),Q.createElement("section",{ref:a,"aria-label":`${D} ${J}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},fe.map((Y,oe)=>{var se;const[we,ee]=Y.split("-");return F.length?Q.createElement("ol",{key:Y,dir:T==="auto"?pw():T,tabIndex:-1,ref:z,className:y,"data-sonner-toaster":!0,"data-sonner-theme":O,"data-y-position":we,"data-x-position":ee,style:{"--front-toast-height":`${((se=ge[0])==null?void 0:se.height)||0}px`,"--width":`${G2}px`,"--gap":`${N}px`,...S,...J2(x,v)},onBlur:Se=>{Te.current&&!Se.currentTarget.contains(Se.relatedTarget)&&(Te.current=!1,me.current&&(me.current.focus({preventScroll:!0}),me.current=null))},onFocus:Se=>{Se.target instanceof HTMLElement&&Se.target.dataset.dismissible==="false"||Te.current||(Te.current=!0,me.current=Se.relatedTarget)},onMouseEnter:()=>le(!0),onMouseMove:()=>le(!0),onMouseLeave:()=>{ce||le(!1)},onDragEnd:()=>le(!1),onPointerDown:Se=>{Se.target instanceof HTMLElement&&Se.target.dataset.dismissible==="false"||ve(!0)},onPointerUp:()=>ve(!1)},F.filter(Se=>!Se.position&&oe===0||Se.position===Y).map((Se,De)=>{var He,Qe;return Q.createElement(Q2,{key:Se.id,icons:E,index:De,toast:Se,defaultRichColors:_,duration:(He=M?.duration)!=null?He:R,className:M?.className,descriptionClassName:M?.descriptionClassName,invert:l,visibleToasts:A,closeButton:(Qe=M?.closeButton)!=null?Qe:g,interacting:ce,position:Y,style:M?.style,unstyled:M?.unstyled,classNames:M?.classNames,cancelButtonStyle:M?.cancelButtonStyle,actionButtonStyle:M?.actionButtonStyle,closeButtonAriaLabel:M?.closeButtonAriaLabel,removeToast:H,toasts:F.filter(Ye=>Ye.position==Se.position),heights:ge.filter(Ye=>Ye.position==Se.position),setHeights:he,expandByDefault:f,gap:N,expanded:ne,swipeDirections:t.swipeDirections})})):null}))}),eA=({...e})=>{const{theme:t="system"}=MN();return o.jsx(W2,{theme:t,className:"toaster group",icons:{success:o.jsx(LO,{className:"size-4"}),info:o.jsx(AS,{className:"size-4"}),warning:o.jsx(Sm,{className:"size-4"}),error:o.jsx(c2,{className:"size-4"}),loading:o.jsx(lr,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...e})},tA=new cO,nA=({children:e})=>o.jsx(uO,{client:tA,children:o.jsxs(UN,{defaultTheme:"system",storageKey:"dragon-theme",children:[e,o.jsx(eA,{richColors:!0,expand:!0,position:"top-center"})]})});var Up={exports:{}},Rl={},qp={exports:{}},Fp={};var mw;function aA(){return mw||(mw=1,(function(e){function t(O,j){var z=O.length;O.push(j);e:for(;0>>1,me=O[J];if(0>>1;Jl(Y,z))oel(se,Y)?(O[J]=se,O[oe]=z,J=oe):(O[J]=Y,O[H]=z,J=H);else if(oel(se,z))O[J]=se,O[oe]=z,J=oe;else break e}}return j}function l(O,j){var z=O.sortIndex-j.sortIndex;return z!==0?z:O.id-j.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var g=[],y=[],x=1,v=null,w=3,_=!1,R=!1,S=!1,A=!1,M=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function E(O){for(var j=a(y);j!==null;){if(j.callback===null)i(y);else if(j.startTime<=O)i(y),j.sortIndex=j.expirationTime,t(g,j);else break;j=a(y)}}function D(O){if(S=!1,E(O),!R)if(a(g)!==null)R=!0,I||(I=!0,ne());else{var j=a(y);j!==null&&ve(D,j.startTime-O)}}var I=!1,U=-1,F=5,fe=-1;function ge(){return A?!0:!(e.unstable_now()-feO&&ge());){var J=v.callback;if(typeof J=="function"){v.callback=null,w=v.priorityLevel;var me=J(v.expirationTime<=O);if(O=e.unstable_now(),typeof me=="function"){v.callback=me,E(O),j=!0;break t}v===a(g)&&i(g),E(O)}else i(g);v=a(g)}if(v!==null)j=!0;else{var Te=a(y);Te!==null&&ve(D,Te.startTime-O),j=!1}}break e}finally{v=null,w=z,_=!1}j=void 0}}finally{j?ne():I=!1}}}var ne;if(typeof N=="function")ne=function(){N(he)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,ce=le.port2;le.port1.onmessage=he,ne=function(){ce.postMessage(null)}}else ne=function(){M(he,0)};function ve(O,j){U=M(function(){O(e.unstable_now())},j)}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(O){O.callback=null},e.unstable_forceFrameRate=function(O){0>O||125J?(O.sortIndex=z,t(y,O),a(g)===null&&O===a(y)&&(S?(T(U),U=-1):S=!0,ve(D,z-J))):(O.sortIndex=me,t(g,O),R||_||(R=!0,I||(I=!0,ne()))),O},e.unstable_shouldYield=ge,e.unstable_wrapCallback=function(O){var j=w;return function(){var z=w;w=j;try{return O.apply(this,arguments)}finally{w=z}}}})(Fp)),Fp}var gw;function rA(){return gw||(gw=1,qp.exports=aA()),qp.exports}var yw;function iA(){if(yw)return Rl;yw=1;var e=rA(),t=dS(),a=_N();function i(n){var r="https://react.dev/errors/"+n;if(1me||(n.current=J[me],J[me]=null,me--)}function Y(n,r){me++,J[me]=n.current,n.current=r}var oe=Te(null),se=Te(null),we=Te(null),ee=Te(null);function Se(n,r){switch(Y(we,r),Y(se,n),Y(oe,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?wb(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=wb(r),n=Sb(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}H(oe),Y(oe,n)}function De(){H(oe),H(se),H(we)}function He(n){n.memoizedState!==null&&Y(ee,n);var r=oe.current,s=Sb(r,n.type);r!==s&&(Y(se,n),Y(oe,s))}function Qe(n){se.current===n&&(H(oe),H(se)),ee.current===n&&(H(ee),Sl._currentValue=z)}var Ye,Ft;function G(n){if(Ye===void 0)try{throw Error()}catch(s){var r=s.stack.trim().match(/\n( *(at )?)/);Ye=r&&r[1]||"",Ft=-1)":-1h||k[c]!==$[h]){var W=` `+k[c].replace(" at new "," at ");return n.displayName&&W.includes("")&&(W=W.replace("",n.displayName)),W}while(1<=c&&0<=h);break}}}finally{Xe=!1,Error.prepareStackTrace=s}return(s=n?n.displayName||n.name:"")?G(s):""}function Je(n,r){switch(n.tag){case 26:case 27:case 5:return G(n.type);case 16:return G("Lazy");case 13:return n.child!==r&&r!==null?G("Suspense Fallback"):G("Suspense");case 19:return G("SuspenseList");case 0:case 15:return qe(n.type,!1);case 11:return qe(n.type.render,!1);case 1:return qe(n.type,!0);case 31:return G("Activity");default:return""}}function Qa(n){try{var r="",s=null;do r+=Je(n,s),s=n,n=n.return;while(n);return r}catch(c){return` Error generating stack: `+c.message+` `+c.stack}}var En=Object.prototype.hasOwnProperty,P=e.unstable_scheduleCallback,V=e.unstable_cancelCallback,Z=e.unstable_shouldYield,be=e.unstable_requestPaint,ue=e.unstable_now,pe=e.unstable_getCurrentPriorityLevel,Ie=e.unstable_ImmediatePriority,ft=e.unstable_UserBlockingPriority,ht=e.unstable_NormalPriority,pn=e.unstable_LowPriority,zn=e.unstable_IdlePriority,Qn=e.log,Ja=e.unstable_setDisableYieldValue,Ta=null,an=null;function Jn(n){if(typeof Qn=="function"&&Ja(n),an&&typeof an.setStrictMode=="function")try{an.setStrictMode(Ta,n)}catch{}}var rn=Math.clz32?Math.clz32:Wa,Ps=Math.log,qr=Math.LN2;function Wa(n){return n>>>=0,n===0?32:31-(Ps(n)/qr|0)|0}var ho=256,po=262144,Oi=4194304;function er(n){var r=n&42;if(r!==0)return r;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Ze(n,r,s){var c=n.pendingLanes;if(c===0)return 0;var h=0,p=n.suspendedLanes,b=n.pingedLanes;n=n.warmLanes;var C=c&134217727;return C!==0?(c=C&~p,c!==0?h=er(c):(b&=C,b!==0?h=er(b):s||(s=C&~n,s!==0&&(h=er(s))))):(C=c&~p,C!==0?h=er(C):b!==0?h=er(b):s||(s=c&~n,s!==0&&(h=er(s)))),h===0?0:r!==0&&r!==h&&(r&p)===0&&(p=h&-h,s=r&-r,p>=s||p===32&&(s&4194048)!==0)?r:h}function Kt(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function mn(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Rn(){var n=Oi;return Oi<<=1,(Oi&62914560)===0&&(Oi=4194304),n}function Fr(n){for(var r=[],s=0;31>s;s++)r.push(n);return r}function Ut(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Pn(n,r,s,c,h,p){var b=n.pendingLanes;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=s,n.entangledLanes&=s,n.errorRecoveryDisabledLanes&=s,n.shellSuspendCounter=0;var C=n.entanglements,k=n.expirationTimes,$=n.hiddenUpdates;for(s=b&~s;0"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var yE=/[\n"\\]/g;function ga(n){return n.replace(yE,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Tf(n,r,s,c,h,p,b,C){n.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?n.type=b:n.removeAttribute("type"),r!=null?b==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+ma(r)):n.value!==""+ma(r)&&(n.value=""+ma(r)):b!=="submit"&&b!=="reset"||n.removeAttribute("value"),r!=null?Df(n,b,ma(r)):s!=null?Df(n,b,ma(s)):c!=null&&n.removeAttribute("value"),h==null&&p!=null&&(n.defaultChecked=!!p),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?n.name=""+ma(C):n.removeAttribute("name")}function my(n,r,s,c,h,p,b,C){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(n.type=p),r!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||r!=null)){Af(n);return}s=s!=null?""+ma(s):"",r=r!=null?""+ma(r):s,C||r===n.value||(n.value=r),n.defaultValue=r}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=C?n.checked:!!c,n.defaultChecked=!!c,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(n.name=b),Af(n)}function Df(n,r,s){r==="number"&&Cc(n.ownerDocument)===n||n.defaultValue===""+s||(n.defaultValue=""+s)}function wo(n,r,s,c){if(n=n.options,r){r={};for(var h=0;h"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kf=!1;if(vr)try{var Us={};Object.defineProperty(Us,"passive",{get:function(){Kf=!0}}),window.addEventListener("test",Us,Us),window.removeEventListener("test",Us,Us)}catch{Kf=!1}var Vr=null,If=null,Rc=null;function Sy(){if(Rc)return Rc;var n,r=If,s=r.length,c,h="value"in Vr?Vr.value:Vr.textContent,p=h.length;for(n=0;n=$s),Ny=" ",Oy=!1;function Ay(n,r){switch(n){case"keyup":return BE.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ty(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Co=!1;function HE(n,r){switch(n){case"compositionend":return Ty(r);case"keypress":return r.which!==32?null:(Oy=!0,Ny);case"textInput":return n=r.data,n===Ny&&Oy?null:n;default:return null}}function XE(n,r){if(Co)return n==="compositionend"||!$f&&Ay(n,r)?(n=Sy(),Rc=If=Vr=null,Co=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1=r)return{node:s,offset:r-n};n=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Ly(s)}}function qy(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?qy(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function Fy(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=Cc(n.document);r instanceof n.HTMLIFrameElement;){try{var s=typeof r.contentWindow.location.href=="string"}catch{s=!1}if(s)n=r.contentWindow;else break;r=Cc(n.document)}return r}function Gf(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var nR=vr&&"documentMode"in document&&11>=document.documentMode,Eo=null,Hf=null,Hs=null,Xf=!1;function $y(n,r,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Xf||Eo==null||Eo!==Cc(c)||(c=Eo,"selectionStart"in c&&Gf(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Hs&&Gs(Hs,c)||(Hs=c,c=bu(Hf,"onSelect"),0>=b,h-=b,tr=1<<32-rn(r)+h|s<et?(st=Le,Le=null):st=Le.sibling;var mt=B(L,Le,q[et],te);if(mt===null){Le===null&&(Le=st);break}n&&Le&&mt.alternate===null&&r(L,Le),K=p(mt,K,et),pt===null?$e=mt:pt.sibling=mt,pt=mt,Le=st}if(et===q.length)return s(L,Le),ut&&br(L,et),$e;if(Le===null){for(;etet?(st=Le,Le=null):st=Le.sibling;var fi=B(L,Le,mt.value,te);if(fi===null){Le===null&&(Le=st);break}n&&Le&&fi.alternate===null&&r(L,Le),K=p(fi,K,et),pt===null?$e=fi:pt.sibling=fi,pt=fi,Le=st}if(mt.done)return s(L,Le),ut&&br(L,et),$e;if(Le===null){for(;!mt.done;et++,mt=q.next())mt=ae(L,mt.value,te),mt!==null&&(K=p(mt,K,et),pt===null?$e=mt:pt.sibling=mt,pt=mt);return ut&&br(L,et),$e}for(Le=c(Le);!mt.done;et++,mt=q.next())mt=X(Le,L,et,mt.value,te),mt!==null&&(n&&mt.alternate!==null&&Le.delete(mt.key===null?et:mt.key),K=p(mt,K,et),pt===null?$e=mt:pt.sibling=mt,pt=mt);return n&&Le.forEach(function(SN){return r(L,SN)}),ut&&br(L,et),$e}function Et(L,K,q,te){if(typeof q=="object"&&q!==null&&q.type===S&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case _:e:{for(var $e=q.key;K!==null;){if(K.key===$e){if($e=q.type,$e===S){if(K.tag===7){s(L,K.sibling),te=h(K,q.props.children),te.return=L,L=te;break e}}else if(K.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===F&&qi($e)===K.type){s(L,K.sibling),te=h(K,q.props),Ws(te,q),te.return=L,L=te;break e}s(L,K);break}else r(L,K);K=K.sibling}q.type===S?(te=Pi(q.props.children,L.mode,te,q.key),te.return=L,L=te):(te=Kc(q.type,q.key,q.props,null,L.mode,te),Ws(te,q),te.return=L,L=te)}return b(L);case R:e:{for($e=q.key;K!==null;){if(K.key===$e)if(K.tag===4&&K.stateNode.containerInfo===q.containerInfo&&K.stateNode.implementation===q.implementation){s(L,K.sibling),te=h(K,q.children||[]),te.return=L,L=te;break e}else{s(L,K);break}else r(L,K);K=K.sibling}te=th(q,L.mode,te),te.return=L,L=te}return b(L);case F:return q=qi(q),Et(L,K,q,te)}if(ve(q))return Oe(L,K,q,te);if(ne(q)){if($e=ne(q),typeof $e!="function")throw Error(i(150));return q=$e.call(q),Ge(L,K,q,te)}if(typeof q.then=="function")return Et(L,K,Vc(q),te);if(q.$$typeof===N)return Et(L,K,Uc(L,q),te);Bc(L,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,K!==null&&K.tag===6?(s(L,K.sibling),te=h(K,q),te.return=L,L=te):(s(L,K),te=eh(q,L.mode,te),te.return=L,L=te),b(L)):s(L,K)}return function(L,K,q,te){try{Js=0;var $e=Et(L,K,q,te);return Ko=null,$e}catch(Le){if(Le===Po||Le===Fc)throw Le;var pt=ea(29,Le,null,L.mode);return pt.lanes=te,pt.return=L,pt}finally{}}}var $i=fv(!0),hv=fv(!1),Zr=!1;function hh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ph(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Yr(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Qr(n,r,s){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(gt&2)!==0){var h=c.pending;return h===null?r.next=r:(r.next=h.next,h.next=r),c.pending=r,r=Pc(n),Yy(n,null,s),r}return zc(n,c,r,s),Pc(n)}function el(n,r,s){if(r=r.updateQueue,r!==null&&(r=r.shared,(s&4194048)!==0)){var c=r.lanes;c&=n.pendingLanes,s|=c,r.lanes=s,Kn(n,s)}}function mh(n,r){var s=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var h=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var b={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?h=p=b:p=p.next=b,s=s.next}while(s!==null);p===null?h=p=r:p=p.next=r}else h=p=r;s={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:c.shared,callbacks:c.callbacks},n.updateQueue=s;return}n=s.lastBaseUpdate,n===null?s.firstBaseUpdate=r:n.next=r,s.lastBaseUpdate=r}var gh=!1;function tl(){if(gh){var n=zo;if(n!==null)throw n}}function nl(n,r,s,c){gh=!1;var h=n.updateQueue;Zr=!1;var p=h.firstBaseUpdate,b=h.lastBaseUpdate,C=h.shared.pending;if(C!==null){h.shared.pending=null;var k=C,$=k.next;k.next=null,b===null?p=$:b.next=$,b=k;var W=n.alternate;W!==null&&(W=W.updateQueue,C=W.lastBaseUpdate,C!==b&&(C===null?W.firstBaseUpdate=$:C.next=$,W.lastBaseUpdate=k))}if(p!==null){var ae=h.baseState;b=0,W=$=k=null,C=p;do{var B=C.lane&-536870913,X=B!==C.lane;if(X?(ot&B)===B:(c&B)===B){B!==0&&B===ko&&(gh=!0),W!==null&&(W=W.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Oe=n,Ge=C;B=r;var Et=s;switch(Ge.tag){case 1:if(Oe=Ge.payload,typeof Oe=="function"){ae=Oe.call(Et,ae,B);break e}ae=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Ge.payload,B=typeof Oe=="function"?Oe.call(Et,ae,B):Oe,B==null)break e;ae=v({},ae,B);break e;case 2:Zr=!0}}B=C.callback,B!==null&&(n.flags|=64,X&&(n.flags|=8192),X=h.callbacks,X===null?h.callbacks=[B]:X.push(B))}else X={lane:B,tag:C.tag,payload:C.payload,callback:C.callback,next:null},W===null?($=W=X,k=ae):W=W.next=X,b|=B;if(C=C.next,C===null){if(C=h.shared.pending,C===null)break;X=C,C=X.next,X.next=null,h.lastBaseUpdate=X,h.shared.pending=null}}while(!0);W===null&&(k=ae),h.baseState=k,h.firstBaseUpdate=$,h.lastBaseUpdate=W,p===null&&(h.shared.lanes=0),ni|=b,n.lanes=b,n.memoizedState=ae}}function pv(n,r){if(typeof n!="function")throw Error(i(191,n));n.call(r)}function mv(n,r){var s=n.callbacks;if(s!==null)for(n.callbacks=null,n=0;np?p:8;var b=O.T,C={};O.T=C,zh(n,!1,r,s);try{var k=h(),$=O.S;if($!==null&&$(C,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var W=dR(k,c);il(n,r,W,ia(n))}else il(n,r,c,ia(n))}catch(ae){il(n,r,{then:function(){},status:"rejected",reason:ae},ia())}finally{j.p=p,b!==null&&C.types!==null&&(b.types=C.types),O.T=b}}function yR(){}function Mh(n,r,s,c){if(n.tag!==5)throw Error(i(476));var h=Hv(n).queue;Gv(n,h,r,z,s===null?yR:function(){return Xv(n),s(c)})}function Hv(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:z},next:null};var s={};return r.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:s},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function Xv(n){var r=Hv(n);r.next===null&&(r=n.alternate.memoizedState),il(n,r.next.queue,{},ia())}function kh(){return bn(Sl)}function Zv(){return Xt().memoizedState}function Yv(){return Xt().memoizedState}function vR(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var s=ia();n=Yr(s);var c=Qr(r,n,s);c!==null&&(Bn(c,r,s),el(c,r,s)),r={cache:ch()},n.payload=r;return}r=r.return}}function xR(n,r,s){var c=ia();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},tu(n)?Jv(r,s):(s=Jf(n,r,s,c),s!==null&&(Bn(s,n,c),Wv(s,r,c)))}function Qv(n,r,s){var c=ia();il(n,r,s,c)}function il(n,r,s,c){var h={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(tu(n))Jv(r,h);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=r.lastRenderedReducer,p!==null))try{var b=r.lastRenderedState,C=p(b,s);if(h.hasEagerState=!0,h.eagerState=C,Wn(C,b))return zc(n,r,h,0),Rt===null&&kc(),!1}catch{}finally{}if(s=Jf(n,r,h,c),s!==null)return Bn(s,n,c),Wv(s,r,c),!0}return!1}function zh(n,r,s,c){if(c={lane:2,revertLane:hp(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},tu(n)){if(r)throw Error(i(479))}else r=Jf(n,s,c,2),r!==null&&Bn(r,n,2)}function tu(n){var r=n.alternate;return n===We||r!==null&&r===We}function Jv(n,r){Lo=Xc=!0;var s=n.pending;s===null?r.next=r:(r.next=s.next,s.next=r),n.pending=r}function Wv(n,r,s){if((s&4194048)!==0){var c=r.lanes;c&=n.pendingLanes,s|=c,r.lanes=s,Kn(n,s)}}var ol={readContext:bn,use:Qc,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useLayoutEffect:$t,useInsertionEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useSyncExternalStore:$t,useId:$t,useHostTransitionStatus:$t,useFormState:$t,useActionState:$t,useOptimistic:$t,useMemoCache:$t,useCacheRefresh:$t};ol.useEffectEvent=$t;var ex={readContext:bn,use:Qc,useCallback:function(n,r){return On().memoizedState=[n,r===void 0?null:r],n},useContext:bn,useEffect:Kv,useImperativeHandle:function(n,r,s){s=s!=null?s.concat([n]):null,Wc(4194308,4,qv.bind(null,r,n),s)},useLayoutEffect:function(n,r){return Wc(4194308,4,n,r)},useInsertionEffect:function(n,r){Wc(4,2,n,r)},useMemo:function(n,r){var s=On();r=r===void 0?null:r;var c=n();if(Vi){Jn(!0);try{n()}finally{Jn(!1)}}return s.memoizedState=[c,r],c},useReducer:function(n,r,s){var c=On();if(s!==void 0){var h=s(r);if(Vi){Jn(!0);try{s(r)}finally{Jn(!1)}}}else h=r;return c.memoizedState=c.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},c.queue=n,n=n.dispatch=xR.bind(null,We,n),[c.memoizedState,n]},useRef:function(n){var r=On();return n={current:n},r.memoizedState=n},useState:function(n){n=Nh(n);var r=n.queue,s=Qv.bind(null,We,r);return r.dispatch=s,[n.memoizedState,s]},useDebugValue:Th,useDeferredValue:function(n,r){var s=On();return Dh(s,n,r)},useTransition:function(){var n=Nh(!1);return n=Gv.bind(null,We,n.queue,!0,!1),On().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,s){var c=We,h=On();if(ut){if(s===void 0)throw Error(i(407));s=s()}else{if(s=r(),Rt===null)throw Error(i(349));(ot&127)!==0||wv(c,r,s)}h.memoizedState=s;var p={value:s,getSnapshot:r};return h.queue=p,Kv(_v.bind(null,c,p,n),[n]),c.flags|=2048,qo(9,{destroy:void 0},Sv.bind(null,c,p,s,r),null),s},useId:function(){var n=On(),r=Rt.identifierPrefix;if(ut){var s=nr,c=tr;s=(c&~(1<<32-rn(c)-1)).toString(32)+s,r="_"+r+"R_"+s,s=Zc++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof c.is=="string"?b.createElement("select",{is:c.is}):b.createElement("select"),c.multiple?p.multiple=!0:c.size&&(p.size=c.size);break;default:p=typeof c.is=="string"?b.createElement(h,{is:c.is}):b.createElement(h)}}p[vn]=r,p[Ln]=c;e:for(b=r.child;b!==null;){if(b.tag===5||b.tag===6)p.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===r)break e;for(;b.sibling===null;){if(b.return===null||b.return===r)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}r.stateNode=p;e:switch(Sn(p,h,c),h){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Er(r)}}return Tt(r),Zh(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,s),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==c&&Er(r);else{if(typeof c!="string"&&r.stateNode===null)throw Error(i(166));if(n=we.current,Do(r)){if(n=r.stateNode,s=r.memoizedProps,c=null,h=xn,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}n[vn]=r,n=!!(n.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||xb(n.nodeValue,s)),n||Hr(r,!0)}else n=wu(n).createTextNode(c),n[vn]=r,r.stateNode=n}return Tt(r),null;case 31:if(s=r.memoizedState,n===null||n.memoizedState!==null){if(c=Do(r),s!==null){if(n===null){if(!c)throw Error(i(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[vn]=r}else Ki(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Tt(r),n=!1}else s=ih(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=s),n=!0;if(!n)return r.flags&256?(na(r),r):(na(r),null);if((r.flags&128)!==0)throw Error(i(558))}return Tt(r),null;case 13:if(c=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Do(r),c!==null&&c.dehydrated!==null){if(n===null){if(!h)throw Error(i(318));if(h=r.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[vn]=r}else Ki(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Tt(r),h=!1}else h=ih(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return r.flags&256?(na(r),r):(na(r),null)}return na(r),(r.flags&128)!==0?(r.lanes=s,r):(s=c!==null,n=n!==null&&n.memoizedState!==null,s&&(c=r.child,h=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(h=c.alternate.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==h&&(c.flags|=2048)),s!==n&&s&&(r.child.flags|=8192),ou(r,r.updateQueue),Tt(r),null);case 4:return De(),n===null&&yp(r.stateNode.containerInfo),Tt(r),null;case 10:return Sr(r.type),Tt(r),null;case 19:if(H(Ht),c=r.memoizedState,c===null)return Tt(r),null;if(h=(r.flags&128)!==0,p=c.rendering,p===null)if(h)ll(c,!1);else{if(Vt!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(p=Hc(n),p!==null){for(r.flags|=128,ll(c,!1),n=p.updateQueue,r.updateQueue=n,ou(r,n),r.subtreeFlags=0,n=s,s=r.child;s!==null;)Qy(s,n),s=s.sibling;return Y(Ht,Ht.current&1|2),ut&&br(r,c.treeForkCount),r.child}n=n.sibling}c.tail!==null&&ue()>du&&(r.flags|=128,h=!0,ll(c,!1),r.lanes=4194304)}else{if(!h)if(n=Hc(p),n!==null){if(r.flags|=128,h=!0,n=n.updateQueue,r.updateQueue=n,ou(r,n),ll(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!ut)return Tt(r),null}else 2*ue()-c.renderingStartTime>du&&s!==536870912&&(r.flags|=128,h=!0,ll(c,!1),r.lanes=4194304);c.isBackwards?(p.sibling=r.child,r.child=p):(n=c.last,n!==null?n.sibling=p:r.child=p,c.last=p)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=ue(),n.sibling=null,s=Ht.current,Y(Ht,h?s&1|2:s&1),ut&&br(r,c.treeForkCount),n):(Tt(r),null);case 22:case 23:return na(r),vh(),c=r.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(r.flags|=8192):c&&(r.flags|=8192),c?(s&536870912)!==0&&(r.flags&128)===0&&(Tt(r),r.subtreeFlags&6&&(r.flags|=8192)):Tt(r),s=r.updateQueue,s!==null&&ou(r,s.retryQueue),s=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==s&&(r.flags|=2048),n!==null&&H(Ui),null;case 24:return s=null,n!==null&&(s=n.memoizedState.cache),r.memoizedState.cache!==s&&(r.flags|=2048),Sr(Qt),Tt(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function jR(n,r){switch(ah(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Sr(Qt),De(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return Qe(r),null;case 31:if(r.memoizedState!==null){if(na(r),r.alternate===null)throw Error(i(340));Ki()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(na(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Ki()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return H(Ht),null;case 4:return De(),null;case 10:return Sr(r.type),null;case 22:case 23:return na(r),vh(),n!==null&&H(Ui),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return Sr(Qt),null;case 25:return null;default:return null}}function jx(n,r){switch(ah(r),r.tag){case 3:Sr(Qt),De();break;case 26:case 27:case 5:Qe(r);break;case 4:De();break;case 31:r.memoizedState!==null&&na(r);break;case 13:na(r);break;case 19:H(Ht);break;case 10:Sr(r.type);break;case 22:case 23:na(r),vh(),n!==null&&H(Ui);break;case 24:Sr(Qt)}}function cl(n,r){try{var s=r.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var h=c.next;s=h;do{if((s.tag&n)===n){c=void 0;var p=s.create,b=s.inst;c=p(),b.destroy=c}s=s.next}while(s!==h)}}catch(C){vt(r,r.return,C)}}function ei(n,r,s){try{var c=r.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var p=h.next;c=p;do{if((c.tag&n)===n){var b=c.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,h=r;var k=s,$=C;try{$()}catch(W){vt(h,k,W)}}}c=c.next}while(c!==p)}}catch(W){vt(r,r.return,W)}}function Cx(n){var r=n.updateQueue;if(r!==null){var s=n.stateNode;try{mv(r,s)}catch(c){vt(n,n.return,c)}}}function Ex(n,r,s){s.props=Bi(n.type,n.memoizedProps),s.state=n.memoizedState;try{s.componentWillUnmount()}catch(c){vt(n,r,c)}}function ul(n,r){try{var s=n.ref;if(s!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof s=="function"?n.refCleanup=s(c):s.current=c}}catch(h){vt(n,r,h)}}function ar(n,r){var s=n.ref,c=n.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(h){vt(n,r,h)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){vt(n,r,h)}else s.current=null}function Rx(n){var r=n.type,s=n.memoizedProps,c=n.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(h){vt(n,n.return,h)}}function Yh(n,r,s){try{var c=n.stateNode;GR(c,n.type,s,r),c[Ln]=r}catch(h){vt(n,n.return,h)}}function Nx(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&si(n.type)||n.tag===4}function Qh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Nx(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&si(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Jh(n,r,s){var c=n.tag;if(c===5||c===6)n=n.stateNode,r?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(n,r):(r=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,r.appendChild(n),s=s._reactRootContainer,s!=null||r.onclick!==null||(r.onclick=yr));else if(c!==4&&(c===27&&si(n.type)&&(s=n.stateNode,r=null),n=n.child,n!==null))for(Jh(n,r,s),n=n.sibling;n!==null;)Jh(n,r,s),n=n.sibling}function su(n,r,s){var c=n.tag;if(c===5||c===6)n=n.stateNode,r?s.insertBefore(n,r):s.appendChild(n);else if(c!==4&&(c===27&&si(n.type)&&(s=n.stateNode),n=n.child,n!==null))for(su(n,r,s),n=n.sibling;n!==null;)su(n,r,s),n=n.sibling}function Ox(n){var r=n.stateNode,s=n.memoizedProps;try{for(var c=n.type,h=r.attributes;h.length;)r.removeAttributeNode(h[0]);Sn(r,c,s),r[vn]=n,r[Ln]=s}catch(p){vt(n,n.return,p)}}var Rr=!1,en=!1,Wh=!1,Ax=typeof WeakSet=="function"?WeakSet:Set,yn=null;function CR(n,r){if(n=n.containerInfo,bp=Nu,n=Fy(n),Gf(n)){if("selectionStart"in n)var s={start:n.selectionStart,end:n.selectionEnd};else e:{s=(s=n.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var h=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{s.nodeType,p.nodeType}catch{s=null;break e}var b=0,C=-1,k=-1,$=0,W=0,ae=n,B=null;t:for(;;){for(var X;ae!==s||h!==0&&ae.nodeType!==3||(C=b+h),ae!==p||c!==0&&ae.nodeType!==3||(k=b+c),ae.nodeType===3&&(b+=ae.nodeValue.length),(X=ae.firstChild)!==null;)B=ae,ae=X;for(;;){if(ae===n)break t;if(B===s&&++$===h&&(C=b),B===p&&++W===c&&(k=b),(X=ae.nextSibling)!==null)break;ae=B,B=ae.parentNode}ae=X}s=C===-1||k===-1?null:{start:C,end:k}}else s=null}s=s||{start:0,end:0}}else s=null;for(wp={focusedElem:n,selectionRange:s},Nu=!1,yn=r;yn!==null;)if(r=yn,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,yn=n;else for(;yn!==null;){switch(r=yn,p=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.updateQueue,n=n!==null?n.events:null,n!==null))for(s=0;s title"))),Sn(p,c,s),p[vn]=n,gn(p),c=p;break e;case"link":var b=Pb("link","href",h).get(c+(s.href||""));if(b){for(var C=0;CEt&&(b=Et,Et=Ge,Ge=b);var L=Uy(C,Ge),K=Uy(C,Et);if(L&&K&&(X.rangeCount!==1||X.anchorNode!==L.node||X.anchorOffset!==L.offset||X.focusNode!==K.node||X.focusOffset!==K.offset)){var q=ae.createRange();q.setStart(L.node,L.offset),X.removeAllRanges(),Ge>Et?(X.addRange(q),X.extend(K.node,K.offset)):(q.setEnd(K.node,K.offset),X.addRange(q))}}}}for(ae=[],X=C;X=X.parentNode;)X.nodeType===1&&ae.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;Cs?32:s,O.T=null,s=op,op=null;var p=ri,b=Dr;if(on=0,Go=ri=null,Dr=0,(gt&6)!==0)throw Error(i(331));var C=gt;if(gt|=4,qx(p.current),Ix(p,p.current,b,s),gt=C,gl(0,!1),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(Ta,p)}catch{}return!0}finally{j.p=h,O.T=c,ib(n,r)}}function sb(n,r,s){r=va(s,r),r=Lh(n.stateNode,r,2),n=Qr(n,r,2),n!==null&&(Ut(n,2),rr(n))}function vt(n,r,s){if(n.tag===3)sb(n,n,s);else for(;r!==null;){if(r.tag===3){sb(r,n,s);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(ai===null||!ai.has(c))){n=va(s,n),s=lx(2),c=Qr(r,s,2),c!==null&&(cx(s,c,r,n),Ut(c,2),rr(c));break}}r=r.return}}function up(n,r,s){var c=n.pingCache;if(c===null){c=n.pingCache=new NR;var h=new Set;c.set(r,h)}else h=c.get(r),h===void 0&&(h=new Set,c.set(r,h));h.has(s)||(np=!0,h.add(s),n=MR.bind(null,n,r,s),r.then(n,n))}function MR(n,r,s){var c=n.pingCache;c!==null&&c.delete(r),n.pingedLanes|=n.suspendedLanes&s,n.warmLanes&=~s,Rt===n&&(ot&s)===s&&(Vt===4||Vt===3&&(ot&62914560)===ot&&300>ue()-uu?(gt&2)===0&&Ho(n,0):ap|=s,Bo===ot&&(Bo=0)),rr(n)}function lb(n,r){r===0&&(r=Rn()),n=zi(n,r),n!==null&&(Ut(n,r),rr(n))}function kR(n){var r=n.memoizedState,s=0;r!==null&&(s=r.retryLane),lb(n,s)}function zR(n,r){var s=0;switch(n.tag){case 31:case 13:var c=n.stateNode,h=n.memoizedState;h!==null&&(s=h.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(r),lb(n,s)}function PR(n,r){return P(n,r)}var yu=null,Zo=null,dp=!1,vu=!1,fp=!1,oi=0;function rr(n){n!==Zo&&n.next===null&&(Zo===null?yu=Zo=n:Zo=Zo.next=n),vu=!0,dp||(dp=!0,IR())}function gl(n,r){if(!fp&&vu){fp=!0;do for(var s=!1,c=yu;c!==null;){if(n!==0){var h=c.pendingLanes;if(h===0)var p=0;else{var b=c.suspendedLanes,C=c.pingedLanes;p=(1<<31-rn(42|n)+1)-1,p&=h&~(b&~C),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,fb(c,p))}else p=ot,p=Ze(c,c===Rt?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||Kt(c,p)||(s=!0,fb(c,p));c=c.next}while(s);fp=!1}}function KR(){cb()}function cb(){vu=dp=!1;var n=0;oi!==0&&XR()&&(n=oi);for(var r=ue(),s=null,c=yu;c!==null;){var h=c.next,p=ub(c,r);p===0?(c.next=null,s===null?yu=h:s.next=h,h===null&&(Zo=s)):(s=c,(n!==0||(p&3)!==0)&&(vu=!0)),c=h}on!==0&&on!==5||gl(n),oi!==0&&(oi=0)}function ub(n,r){for(var s=n.suspendedLanes,c=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0C)break;var W=k.transferSize,ae=k.initiatorType;W&&bb(ae)&&(k=k.responseEnd,b+=W*(k"u"?null:document;function Db(n,r,s){var c=Yo;if(c&&typeof r=="string"&&r){var h=ga(r);h='link[rel="'+n+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),Tb.has(h)||(Tb.add(h),n={rel:n,crossOrigin:s,href:r},c.querySelector(h)===null&&(r=c.createElement("link"),Sn(r,"link",n),gn(r),c.head.appendChild(r)))}}function aN(n){Mr.D(n),Db("dns-prefetch",n,null)}function rN(n,r){Mr.C(n,r),Db("preconnect",n,r)}function iN(n,r,s){Mr.L(n,r,s);var c=Yo;if(c&&n&&r){var h='link[rel="preload"][as="'+ga(r)+'"]';r==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+ga(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+ga(s.imageSizes)+'"]')):h+='[href="'+ga(n)+'"]';var p=h;switch(r){case"style":p=Qo(n);break;case"script":p=Jo(n)}ja.has(p)||(n=v({rel:"preload",href:r==="image"&&s&&s.imageSrcSet?void 0:n,as:r},s),ja.set(p,n),c.querySelector(h)!==null||r==="style"&&c.querySelector(bl(p))||r==="script"&&c.querySelector(wl(p))||(r=c.createElement("link"),Sn(r,"link",n),gn(r),c.head.appendChild(r)))}}function oN(n,r){Mr.m(n,r);var s=Yo;if(s&&n){var c=r&&typeof r.as=="string"?r.as:"script",h='link[rel="modulepreload"][as="'+ga(c)+'"][href="'+ga(n)+'"]',p=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Jo(n)}if(!ja.has(p)&&(n=v({rel:"modulepreload",href:n},r),ja.set(p,n),s.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(wl(p)))return}c=s.createElement("link"),Sn(c,"link",n),gn(c),s.head.appendChild(c)}}}function sN(n,r,s){Mr.S(n,r,s);var c=Yo;if(c&&n){var h=xo(c).hoistableStyles,p=Qo(n);r=r||"default";var b=h.get(p);if(!b){var C={loading:0,preload:null};if(b=c.querySelector(bl(p)))C.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":r},s),(s=ja.get(p))&&Np(n,s);var k=b=c.createElement("link");gn(k),Sn(k,"link",n),k._p=new Promise(function($,W){k.onload=$,k.onerror=W}),k.addEventListener("load",function(){C.loading|=1}),k.addEventListener("error",function(){C.loading|=2}),C.loading|=4,_u(b,r,c)}b={type:"stylesheet",instance:b,count:1,state:C},h.set(p,b)}}}function lN(n,r){Mr.X(n,r);var s=Yo;if(s&&n){var c=xo(s).hoistableScripts,h=Jo(n),p=c.get(h);p||(p=s.querySelector(wl(h)),p||(n=v({src:n,async:!0},r),(r=ja.get(h))&&Op(n,r),p=s.createElement("script"),gn(p),Sn(p,"link",n),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function cN(n,r){Mr.M(n,r);var s=Yo;if(s&&n){var c=xo(s).hoistableScripts,h=Jo(n),p=c.get(h);p||(p=s.querySelector(wl(h)),p||(n=v({src:n,async:!0,type:"module"},r),(r=ja.get(h))&&Op(n,r),p=s.createElement("script"),gn(p),Sn(p,"link",n),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function Mb(n,r,s,c){var h=(h=we.current)?Su(h):null;if(!h)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(r=Qo(s.href),s=xo(h).hoistableStyles,c=s.get(r),c||(c={type:"style",instance:null,count:0,state:null},s.set(r,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){n=Qo(s.href);var p=xo(h).hoistableStyles,b=p.get(n);if(b||(h=h.ownerDocument||h,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,b),(p=h.querySelector(bl(n)))&&!p._p&&(b.instance=p,b.state.loading=5),ja.has(n)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ja.set(n,s),p||uN(h,n,s,b.state))),r&&c===null)throw Error(i(528,""));return b}if(r&&c!==null)throw Error(i(529,""));return null;case"script":return r=s.async,s=s.src,typeof s=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Jo(s),s=xo(h).hoistableScripts,c=s.get(r),c||(c={type:"script",instance:null,count:0,state:null},s.set(r,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function Qo(n){return'href="'+ga(n)+'"'}function bl(n){return'link[rel="stylesheet"]['+n+"]"}function kb(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function uN(n,r,s,c){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?c.loading=1:(r=n.createElement("link"),c.preload=r,r.addEventListener("load",function(){return c.loading|=1}),r.addEventListener("error",function(){return c.loading|=2}),Sn(r,"link",s),gn(r),n.head.appendChild(r))}function Jo(n){return'[src="'+ga(n)+'"]'}function wl(n){return"script[async]"+n}function zb(n,r,s){if(r.count++,r.instance===null)switch(r.type){case"style":var c=n.querySelector('style[data-href~="'+ga(s.href)+'"]');if(c)return r.instance=c,gn(c),c;var h=v({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),gn(c),Sn(c,"style",h),_u(c,s.precedence,n),r.instance=c;case"stylesheet":h=Qo(s.href);var p=n.querySelector(bl(h));if(p)return r.state.loading|=4,r.instance=p,gn(p),p;c=kb(s),(h=ja.get(h))&&Np(c,h),p=(n.ownerDocument||n).createElement("link"),gn(p);var b=p;return b._p=new Promise(function(C,k){b.onload=C,b.onerror=k}),Sn(p,"link",c),r.state.loading|=4,_u(p,s.precedence,n),r.instance=p;case"script":return p=Jo(s.src),(h=n.querySelector(wl(p)))?(r.instance=h,gn(h),h):(c=s,(h=ja.get(p))&&(c=v({},s),Op(c,h)),n=n.ownerDocument||n,h=n.createElement("script"),gn(h),Sn(h,"link",c),n.head.appendChild(h),r.instance=h);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(c=r.instance,r.state.loading|=4,_u(c,s.precedence,n));return r.instance}function _u(n,r,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=c.length?c[c.length-1]:null,p=h,b=0;b title"):null)}function dN(n,r,s){if(s===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return n=r.disabled,typeof r.precedence=="string"&&n==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Ib(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function fN(n,r,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=Qo(c.href),p=r.querySelector(bl(h));if(p){r=p._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=Cu.bind(n),r.then(n,n)),s.state.loading|=4,s.instance=p,gn(p);return}p=r.ownerDocument||r,c=kb(c),(h=ja.get(h))&&Np(c,h),p=p.createElement("link"),gn(p);var b=p;b._p=new Promise(function(C,k){b.onload=C,b.onerror=k}),Sn(p,"link",c),s.instance=p}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(s,r),(r=s.state.preload)&&(s.state.loading&3)===0&&(n.count++,s=Cu.bind(n),r.addEventListener("load",s),r.addEventListener("error",s))}}var Ap=0;function hN(n,r){return n.stylesheets&&n.count===0&&Ru(n,n.stylesheets),0Ap?50:800)+r);return n.unsuspend=s,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(h)}}:null}function Cu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ru(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Eu=null;function Ru(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Eu=new Map,r.forEach(pN,n),Eu=null,Cu.call(n))}function pN(n,r){if(!(r.state.loading&4)){var s=Eu.get(n);if(s)var c=s.get(null);else{s=new Map,Eu.set(n,s);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Up.exports=iA(),Up.exports}var sA=oA();const yd="autoglue.tokens",jm="autoglue.auth-change";let or=Cm();function Cm(){try{const e=localStorage.getItem(yd);return e?JSON.parse(e):null}catch{return null}}function lA(e){e?localStorage.setItem(yd,JSON.stringify(e)):localStorage.removeItem(yd)}function cA(e){window.dispatchEvent(new CustomEvent(jm,{detail:e}))}const jn={get(){return or},set(e){or=e,lA(e),cA(e)},reload(){return or=Cm(),or},isAuthed(){return!!or?.access_token},getAccessToken(){return or?.access_token??null},isExpired(e=Math.floor(Date.now()/1e3)){const t=xw(or?.access_token);return t!==null?e>=t:!0},willExpireSoon(e=60,t=Math.floor(Date.now()/1e3)){const a=xw(or?.access_token);return a!==null?a-t<=e:!0},logout(){jn.set(null)},subscribe(e){const t=i=>e(i.detail??null),a=i=>{i.key===yd&&(or=Cm(),e(or))};return window.addEventListener(jm,t),window.addEventListener("storage",a),()=>{window.removeEventListener(jm,t),window.removeEventListener("storage",a)}}};function xw(e){if(!e)return null;const t=e.split(".");if(t.length<2)return null;try{const a=JSON.parse(atob(uA(t[1])));return(typeof a?.exp=="number"?a.exp:null)??null}catch{return null}}function uA(e){return e.replace(/-/g,"+").replace(/_/g,"/")+"==".slice((2-e.length*3%4)%4)}const Em="autoglue.org";let Lu=localStorage.getItem(Em);const qa={get(){return Lu},set(e){Lu=e,localStorage.setItem(Em,e),window.dispatchEvent(new CustomEvent("autoglue:org-change",{detail:e}))},subscribe(e){const t=i=>e(i.detail??null),a=i=>{i.key===Em&&(Lu=i.newValue,e(Lu))};return window.addEventListener("autoglue:org-change",t),window.addEventListener("storage",a),()=>{window.removeEventListener("autoglue:org-change",t),window.removeEventListener("storage",a)}}},dA="/api/v1".replace(/\/+$/,"");class MS{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:dA}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||kS}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const fA=new MS;class Zn{constructor(t=fA){this.configuration=t,this.middleware=t.middleware}static jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");middleware;withMiddleware(...t){const a=this.clone();return a.middleware=a.middleware.concat(...t),a}withPreMiddleware(...t){const a=t.map(i=>({pre:i}));return this.withMiddleware(...a)}withPostMiddleware(...t){const a=t.map(i=>({post:i}));return this.withMiddleware(...a)}isJsonMime(t){return t?Zn.jsonRegex.test(t):!1}async request(t,a){const{url:i,init:l}=await this.createFetchParams(t,a),u=await this.fetchApi(i,l);if(u&&u.status>=200&&u.status<300)return u;throw new mA(u,"Response returned an error code")}async createFetchParams(t,a){let i=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(i+="?"+this.configuration.queryParamsStringify(t.query));const l=Object.assign({},this.configuration.headers,t.headers);Object.keys(l).forEach(x=>l[x]===void 0?delete l[x]:{});const u=typeof a=="function"?a:async()=>a,d={method:t.method,headers:l,body:t.body,credentials:this.configuration.credentials},f={...d,...await u({init:d,context:t})};let g;pA(f.body)||f.body instanceof URLSearchParams||hA(f.body)?g=f.body:this.isJsonMime(l["Content-Type"])?g=JSON.stringify(f.body):g=f.body;const y={...f,body:g};return{url:i,init:y}}fetchApi=async(t,a)=>{let i={url:t,init:a};for(const u of this.middleware)u.pre&&(i=await u.pre({fetch:this.fetchApi,...i})||i);let l;try{l=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(u){for(const d of this.middleware)d.onError&&(l=await d.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:u,response:l?l.clone():void 0})||l);if(l===void 0)throw u instanceof Error?new gA(u,"The request failed and the interceptors did not return an alternative response"):u}for(const u of this.middleware)u.post&&(l=await u.post({fetch:this.fetchApi,url:i.url,init:i.init,response:l.clone()})||l);return l};clone(){const t=this.constructor,a=new t(this.configuration);return a.middleware=this.middleware.slice(),a}}function hA(e){return typeof Blob<"u"&&e instanceof Blob}function pA(e){return typeof FormData<"u"&&e instanceof FormData}class mA extends Error{constructor(t,a){super(a),this.response=t}name="ResponseError"}class gA extends Error{constructor(t,a){super(a),this.cause=t}name="FetchError"}class ye extends Error{constructor(t,a){super(a),this.field=t}name="RequiredError"}function kS(e,t=""){return Object.keys(e).map(a=>zS(a,e[a],t)).filter(a=>a.length>0).join("&")}function zS(e,t,a=""){const i=a+(a.length?`[${e}]`:e);if(t instanceof Array){const l=t.map(u=>encodeURIComponent(String(u))).join(`&${encodeURIComponent(i)}=`);return`${encodeURIComponent(i)}=${l}`}if(t instanceof Set){const l=Array.from(t);return zS(e,l,a)}return t instanceof Date?`${encodeURIComponent(i)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?kS(t,i):`${encodeURIComponent(i)}=${encodeURIComponent(String(t))}`}class Ne{constructor(t,a=i=>i){this.raw=t,this.transformer=a}async value(){return this.transformer(await this.raw.json())}}class ys{constructor(t){this.raw=t}async value(){}}class Tn{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function ds(e){return yA(e)}function yA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,id:e.id==null?void 0:e.id,key:e.key==null?void 0:e.key,organization_id:e.organization_id==null?void 0:e.organization_id,updated_at:e.updated_at==null?void 0:e.updated_at,value:e.value==null?void 0:e.value}}function vA(e){return xA(e,!1)}function xA(e,t=!1){return e==null?e:{annotation_ids:e.annotation_ids}}function bA(e){return wA(e,!1)}function wA(e,t=!1){return e==null?e:{label_ids:e.label_ids}}function SA(e){return _A(e,!1)}function _A(e,t=!1){return e==null?e:{server_ids:e.server_ids}}function jA(e){return CA(e,!1)}function CA(e,t=!1){return e==null?e:{taint_ids:e.taint_ids}}function EA(e){return RA(e)}function RA(e,t){return e==null?e:{auth_url:e.auth_url==null?void 0:e.auth_url}}function fs(e){return NA(e)}function NA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,effect:e.effect==null?void 0:e.effect,id:e.id==null?void 0:e.id,key:e.key==null?void 0:e.key,organization_id:e.organization_id==null?void 0:e.organization_id,updated_at:e.updated_at==null?void 0:e.updated_at,value:e.value==null?void 0:e.value}}function hs(e){return OA(e)}function OA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,id:e.id==null?void 0:e.id,key:e.key==null?void 0:e.key,organization_id:e.organization_id==null?void 0:e.organization_id,updated_at:e.updated_at==null?void 0:e.updated_at,value:e.value==null?void 0:e.value}}function ps(e){return AA(e)}function AA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,hostname:e.hostname==null?void 0:e.hostname,id:e.id==null?void 0:e.id,organization_id:e.organization_id==null?void 0:e.organization_id,private_ip_address:e.private_ip_address==null?void 0:e.private_ip_address,public_ip_address:e.public_ip_address==null?void 0:e.public_ip_address,role:e.role==null?void 0:e.role,ssh_key_id:e.ssh_key_id==null?void 0:e.ssh_key_id,ssh_user:e.ssh_user==null?void 0:e.ssh_user,status:e.status==null?void 0:e.status,updated_at:e.updated_at==null?void 0:e.updated_at}}function Uu(e){return TA(e)}function TA(e,t){return e==null?e:{annotations:e.annotations==null?void 0:e.annotations.map(ds),created_at:e.created_at==null?void 0:e.created_at,id:e.id==null?void 0:e.id,labels:e.labels==null?void 0:e.labels.map(hs),name:e.name==null?void 0:e.name,organization_id:e.organization_id==null?void 0:e.organization_id,role:e.role==null?void 0:e.role,servers:e.servers==null?void 0:e.servers.map(ps),taints:e.taints==null?void 0:e.taints.map(fs),updated_at:e.updated_at==null?void 0:e.updated_at}}function DA(e){return MA(e,!1)}function MA(e,t=!1){return e==null?e:{key:e.key,value:e.value}}function kA(e){return zA(e,!1)}function zA(e,t=!1){return e==null?e:{account_id:e.account_id,kind:e.kind,name:e.name,provider:e.provider,region:e.region,schema_version:e.schema_version,scope:e.scope,scope_kind:e.scope_kind,scope_version:e.scope_version,secret:e.secret}}function PA(e){return KA(e,!1)}function KA(e,t=!1){return e==null?e:{key:e.key,value:e.value}}function IA(e){return LA(e,!1)}function LA(e,t=!1){return e==null?e:{name:e.name,role:e.role}}function UA(e){return qA(e,!1)}function qA(e,t=!1){return e==null?e:{bits:e.bits,comment:e.comment,name:e.name,type:e.type}}function FA(e){return $A(e,!1)}function $A(e,t=!1){return e==null?e:{hostname:e.hostname,private_ip_address:e.private_ip_address,public_ip_address:e.public_ip_address,role:e.role,ssh_key_id:e.ssh_key_id,ssh_user:e.ssh_user,status:e.status}}function VA(e){return BA(e,!1)}function BA(e,t=!1){return e==null?e:{effect:e.effect,key:e.key,value:e.value}}function qu(e){return GA(e)}function GA(e,t){return e==null?e:{account_id:e.account_id==null?void 0:e.account_id,created_at:e.created_at==null?void 0:e.created_at,id:e.id==null?void 0:e.id,kind:e.kind==null?void 0:e.kind,name:e.name==null?void 0:e.name,provider:e.provider==null?void 0:e.provider,region:e.region==null?void 0:e.region,schema_version:e.schema_version==null?void 0:e.schema_version,scope:e.scope==null?void 0:e.scope,scope_kind:e.scope_kind==null?void 0:e.scope_kind,scope_version:e.scope_version==null?void 0:e.scope_version,updated_at:e.updated_at==null?void 0:e.updated_at}}function HA(e){return XA(e,!1)}function XA(e,t=!1){return e==null?e:{payload:e.payload,queue:e.queue,run_at:e.run_at,type:e.type}}function ZA(e){return YA(e)}function YA(e,t){return e==null?e:{alg:e.alg==null?void 0:e.alg,e:e.e==null?void 0:e.e,kid:e.kid==null?void 0:e.kid,kty:e.kty==null?void 0:e.kty,n:e.n==null?void 0:e.n,use:e.use==null?void 0:e.use,x:e.x==null?void 0:e.x}}function QA(e){return JA(e)}function JA(e,t){return e==null?e:{keys:e.keys==null?void 0:e.keys.map(ZA)}}function WA(e){return eT(e)}function eT(e,t){return e}function cd(e){return tT(e)}function tT(e,t){return e==null?e:{attempts:e.attempts==null?void 0:e.attempts,created_at:e.created_at==null?void 0:e.created_at,id:e.id==null?void 0:e.id,last_error:e.last_error==null?void 0:e.last_error,max_attempts:e.max_attempts==null?void 0:e.max_attempts,payload:e.payload==null?void 0:e.payload,queue:e.queue==null?void 0:e.queue,run_at:e.run_at==null?void 0:e.run_at,status:e.status==null?void 0:WA(e.status),type:e.type==null?void 0:e.type,updated_at:e.updated_at==null?void 0:e.updated_at}}function nT(e){return aT(e,!1)}function aT(e,t=!1){return e==null?e:{refresh_token:e.refresh_token}}function rT(e){return iT(e)}function iT(e,t){return e==null?e:{items:e.items==null?void 0:e.items.map(cd),page:e.page==null?void 0:e.page,page_size:e.page_size==null?void 0:e.page_size,total:e.total==null?void 0:e.total}}function oT(e){return sT(e)}function sT(e,t){return e==null?e:{failed:e.failed==null?void 0:e.failed,name:e.name==null?void 0:e.name,pending:e.pending==null?void 0:e.pending,running:e.running==null?void 0:e.running,scheduled:e.scheduled==null?void 0:e.scheduled}}function lT(e){return cT(e,!1)}function cT(e,t=!1){return e==null?e:{refresh_token:e.refresh_token}}function bw(e){return uT(e)}function uT(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,fingerprint:e.fingerprint==null?void 0:e.fingerprint,id:e.id==null?void 0:e.id,name:e.name==null?void 0:e.name,organization_id:e.organization_id==null?void 0:e.organization_id,public_key:e.public_key==null?void 0:e.public_key,updated_at:e.updated_at==null?void 0:e.updated_at}}function dT(e){return fT(e)}function fT(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,fingerprint:e.fingerprint==null?void 0:e.fingerprint,id:e.id==null?void 0:e.id,name:e.name==null?void 0:e.name,organization_id:e.organization_id==null?void 0:e.organization_id,private_key:e.private_key==null?void 0:e.private_key,public_key:e.public_key==null?void 0:e.public_key,updated_at:e.updated_at==null?void 0:e.updated_at}}function ww(e){return hT(e)}function hT(e,t){return e==null?e:{access_token:e.access_token==null?void 0:e.access_token,expires_in:e.expires_in==null?void 0:e.expires_in,refresh_token:e.refresh_token==null?void 0:e.refresh_token,token_type:e.token_type==null?void 0:e.token_type}}function pT(e){return mT(e,!1)}function mT(e,t=!1){return e==null?e:{key:e.key,value:e.value}}function gT(e){return yT(e,!1)}function yT(e,t=!1){return e==null?e:{account_id:e.account_id,name:e.name,region:e.region,scope:e.scope,scope_kind:e.scope_kind,scope_version:e.scope_version,secret:e.secret}}function vT(e){return xT(e,!1)}function xT(e,t=!1){return e==null?e:{key:e.key,value:e.value}}function bT(e){return wT(e,!1)}function wT(e,t=!1){return e==null?e:{name:e.name,role:e.role}}function ST(e){return _T(e,!1)}function _T(e,t=!1){return e==null?e:{hostname:e.hostname,private_ip_address:e.private_ip_address,public_ip_address:e.public_ip_address,role:e.role,ssh_key_id:e.ssh_key_id,ssh_user:e.ssh_user,status:e.status}}function jT(e){return CT(e,!1)}function CT(e,t=!1){return e==null?e:{effect:e.effect,key:e.key,value:e.value}}function ET(e){return RT(e,!1)}function RT(e,t=!1){return e==null?e:{expires_in_hours:e.expires_in_hours,name:e.name}}function PS(e){return NT(e)}function NT(e,t){return e==null?e:{avatar_url:e.avatar_url==null?void 0:e.avatar_url,created_at:e.created_at==null?void 0:new Date(e.created_at),display_name:e.display_name==null?void 0:e.display_name,id:e.id==null?void 0:e.id,is_admin:e.is_admin==null?void 0:e.is_admin,is_disabled:e.is_disabled==null?void 0:e.is_disabled,primary_email:e.primary_email==null?void 0:e.primary_email,updated_at:e.updated_at==null?void 0:new Date(e.updated_at)}}function OT(e){return AT(e)}function AT(e,t){return e==null?e:{created_at:e.created_at==null?void 0:new Date(e.created_at),email:e.email==null?void 0:e.email,id:e.id==null?void 0:e.id,is_primary:e.is_primary==null?void 0:e.is_primary,is_verified:e.is_verified==null?void 0:e.is_verified,updated_at:e.updated_at==null?void 0:new Date(e.updated_at),user:e.user==null?void 0:PS(e.user),user_id:e.user_id==null?void 0:e.user_id}}function ql(e){return TT(e)}function TT(e,t){return e==null?e:{created_at:e.created_at==null?void 0:new Date(e.created_at),domain:e.domain==null?void 0:e.domain,id:e.id==null?void 0:e.id,name:e.name==null?void 0:e.name,updated_at:e.updated_at==null?void 0:new Date(e.updated_at)}}function DT(e){return MT(e)}function MT(e,t){return e==null?e:{avatar_url:e.avatar_url==null?void 0:e.avatar_url,created_at:e.created_at==null?void 0:new Date(e.created_at),display_name:e.display_name==null?void 0:e.display_name,emails:e.emails==null?void 0:e.emails.map(OT),id:e.id==null?void 0:e.id,is_admin:e.is_admin==null?void 0:e.is_admin,is_disabled:e.is_disabled==null?void 0:e.is_disabled,organizations:e.organizations==null?void 0:e.organizations.map(ql),primary_email:e.primary_email==null?void 0:e.primary_email,updated_at:e.updated_at==null?void 0:new Date(e.updated_at)}}function Sw(e){return kT(e)}function kT(e,t){return e==null?e:{email:e.email==null?void 0:e.email,role:e.role==null?void 0:e.role,user_id:e.user_id==null?void 0:e.user_id}}function zT(e){return PT(e,!1)}function PT(e,t=!1){return e==null?e:{role:e.role,user_id:e.user_id}}function KT(e){return IT(e,!1)}function IT(e,t=!1){return e==null?e:{domain:e.domain,name:e.name}}function LT(e){return UT(e,!1)}function UT(e,t=!1){return e==null?e:{expires_in_hours:e.expires_in_hours,name:e.name}}function qT(e){return FT(e)}function FT(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,expires_at:e.expires_at==null?void 0:e.expires_at,id:e.id==null?void 0:e.id,name:e.name==null?void 0:e.name,org_key:e.org_key==null?void 0:e.org_key,org_secret:e.org_secret==null?void 0:e.org_secret,scope:e.scope==null?void 0:e.scope}}function $T(e){return VT(e,!1)}function VT(e,t=!1){return e==null?e:{domain:e.domain,name:e.name}}function BT(e){return GT(e,!1)}function GT(e,t=!1){return e==null?e:{display_name:e.display_name}}function _w(e){return HT(e)}function HT(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,expires_at:e.expires_at==null?void 0:e.expires_at,id:e.id==null?void 0:e.id,last_used_at:e.last_used_at==null?void 0:e.last_used_at,name:e.name==null?void 0:e.name,plain:e.plain==null?void 0:e.plain,scope:e.scope==null?void 0:e.scope}}function XT(e){return ZT(e)}function ZT(e,t){return e==null?e:{created_at:e.created_at==null?void 0:new Date(e.created_at),expires_at:e.expires_at==null?void 0:new Date(e.expires_at),id:e.id==null?void 0:e.id,last_used_at:e.last_used_at==null?void 0:new Date(e.last_used_at),name:e.name==null?void 0:e.name,org_id:e.org_id==null?void 0:e.org_id,prefix:e.prefix==null?void 0:e.prefix,revoked:e.revoked==null?void 0:e.revoked,scope:e.scope==null?void 0:e.scope,updated_at:e.updated_at==null?void 0:new Date(e.updated_at),user_id:e.user_id==null?void 0:e.user_id}}class YT extends Zn{async createAnnotationRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createAnnotation().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/annotations",method:"POST",headers:l,query:i,body:DA(t.body)},a);return new Ne(d,f=>ds(f))}async createAnnotation(t,a){return await(await this.createAnnotationRaw(t,a)).value()}async deleteAnnotationRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteAnnotation().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/annotations/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async deleteAnnotation(t,a){return await(await this.deleteAnnotationRaw(t,a)).value()}async getAnnotationRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling getAnnotation().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/annotations/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>ds(f))}async getAnnotation(t,a){return await(await this.getAnnotationRaw(t,a)).value()}async listAnnotationsRaw(t,a){const i={};t.key!=null&&(i.key=t.key),t.value!=null&&(i.value=t.value),t.q!=null&&(i.q=t.q);const l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/annotations",method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(ds))}async listAnnotations(t={},a){return await(await this.listAnnotationsRaw(t,a)).value()}async updateAnnotationRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling updateAnnotation().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling updateAnnotation().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/annotations/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:l,query:i,body:pT(t.body)},a);return new Ne(d,f=>ds(f))}async updateAnnotation(t,a){return await(await this.updateAnnotationRaw(t,a)).value()}}class QT extends Zn{async adminCancelArcherJobRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling adminCancelArcherJob().');const i={},l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/admin/archer/jobs/{id}/cancel";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:l,query:i},a);return new Ne(d,f=>cd(f))}async adminCancelArcherJob(t,a){return await(await this.adminCancelArcherJobRaw(t,a)).value()}async adminEnqueueArcherJobRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling adminEnqueueArcherJob().');const i={},l={};l["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/admin/archer/jobs",method:"POST",headers:l,query:i,body:HA(t.body)},a);return new Ne(d,f=>cd(f))}async adminEnqueueArcherJob(t,a){return await(await this.adminEnqueueArcherJobRaw(t,a)).value()}async adminListArcherJobsRaw(t,a){const i={};t.status!=null&&(i.status=t.status),t.queue!=null&&(i.queue=t.queue),t.q!=null&&(i.q=t.q),t.page!=null&&(i.page=t.page),t.pageSize!=null&&(i.page_size=t.pageSize);const l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/admin/archer/jobs",method:"GET",headers:l,query:i},a);return new Ne(d,f=>rT(f))}async adminListArcherJobs(t={},a){return await(await this.adminListArcherJobsRaw(t,a)).value()}async adminListArcherQueuesRaw(t){const a={},i={};this.configuration&&this.configuration.apiKey&&(i.Authorization=await this.configuration.apiKey("Authorization"));const u=await this.request({path:"/admin/archer/queues",method:"GET",headers:i,query:a},t);return new Ne(u,d=>d.map(oT))}async adminListArcherQueues(t){return await(await this.adminListArcherQueuesRaw(t)).value()}async adminRetryArcherJobRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling adminRetryArcherJob().');const i={},l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/admin/archer/jobs/{id}/retry";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:l,query:i},a);return new Ne(d,f=>cd(f))}async adminRetryArcherJob(t,a){return await(await this.adminRetryArcherJobRaw(t,a)).value()}}class JT extends Zn{async authCallbackRaw(t,a){if(t.provider==null)throw new ye("provider",'Required parameter "provider" was null or undefined when calling authCallback().');const i={},l={};let u="/auth/{provider}/callback";u=u.replace("{provider}",encodeURIComponent(String(t.provider)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>ww(f))}async authCallback(t,a){return await(await this.authCallbackRaw(t,a)).value()}async authStartRaw(t,a){if(t.provider==null)throw new ye("provider",'Required parameter "provider" was null or undefined when calling authStart().');const i={},l={};let u="/auth/{provider}/start";u=u.replace("{provider}",encodeURIComponent(String(t.provider)));const d=await this.request({path:u,method:"POST",headers:l,query:i},a);return new Ne(d,f=>EA(f))}async authStart(t,a){return await(await this.authStartRaw(t,a)).value()}async getJWKSRaw(t){const a={},i={},u=await this.request({path:"/.well-known/jwks.json",method:"GET",headers:i,query:a},t);return new Ne(u,d=>QA(d))}async getJWKS(t){return await(await this.getJWKSRaw(t)).value()}async logoutRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling logout().');const i={},l={};l["Content-Type"]="application/json";const d=await this.request({path:"/auth/logout",method:"POST",headers:l,query:i,body:nT(t.body)},a);return new ys(d)}async logout(t,a){await this.logoutRaw(t,a)}async refreshRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling refresh().');const i={},l={};l["Content-Type"]="application/json";const d=await this.request({path:"/auth/refresh",method:"POST",headers:l,query:i,body:lT(t.body)},a);return new Ne(d,f=>ww(f))}async refresh(t,a){return await(await this.refreshRaw(t,a)).value()}}class WT extends Zn{async createCredentialRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createCredential().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/credentials",method:"POST",headers:l,query:i,body:kA(t.body)},a);return new Ne(d,f=>qu(f))}async createCredential(t,a){return await(await this.createCredentialRaw(t,a)).value()}async deleteCredentialRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteCredential().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/credentials/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return new ys(d)}async deleteCredential(t,a){await this.deleteCredentialRaw(t,a)}async getCredentialRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling getCredential().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/credentials/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>qu(f))}async getCredential(t,a){return await(await this.getCredentialRaw(t,a)).value()}async listCredentialsRaw(t,a){const i={};t.provider!=null&&(i.provider=t.provider),t.kind!=null&&(i.kind=t.kind),t.scopeKind!=null&&(i.scope_kind=t.scopeKind);const l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/credentials",method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(qu))}async listCredentials(t={},a){return await(await this.listCredentialsRaw(t,a)).value()}async revealCredentialRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling revealCredential().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/credentials/{id}/reveal";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:l,query:i},a);return new Ne(d)}async revealCredential(t,a){return await(await this.revealCredentialRaw(t,a)).value()}async updateCredentialRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling updateCredential().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling updateCredential().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/credentials/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:l,query:i,body:gT(t.body)},a);return new Ne(d,f=>qu(f))}async updateCredential(t,a){return await(await this.updateCredentialRaw(t,a)).value()}}class eD extends Zn{async createLabelRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createLabel().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/labels",method:"POST",headers:l,query:i,body:PA(t.body)},a);return new Ne(d,f=>hs(f))}async createLabel(t,a){return await(await this.createLabelRaw(t,a)).value()}async deleteLabelRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteLabel().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/labels/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async deleteLabel(t,a){return await(await this.deleteLabelRaw(t,a)).value()}async getLabelRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling getLabel().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/labels/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>hs(f))}async getLabel(t,a){return await(await this.getLabelRaw(t,a)).value()}async listLabelsRaw(t,a){const i={};t.key!=null&&(i.key=t.key),t.value!=null&&(i.value=t.value),t.q!=null&&(i.q=t.q);const l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/labels",method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(hs))}async listLabels(t={},a){return await(await this.listLabelsRaw(t,a)).value()}async updateLabelRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling updateLabel().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling updateLabel().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/labels/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:l,query:i,body:vT(t.body)},a);return new Ne(d,f=>hs(f))}async updateLabel(t,a){return await(await this.updateLabelRaw(t,a)).value()}}class tD extends Zn{async getMeRaw(t){const a={},i={};this.configuration&&this.configuration.apiKey&&(i["X-API-KEY"]=await this.configuration.apiKey("X-API-KEY")),this.configuration&&this.configuration.apiKey&&(i.Authorization=await this.configuration.apiKey("Authorization"));const u=await this.request({path:"/me",method:"GET",headers:i,query:a},t);return new Ne(u,d=>DT(d))}async getMe(t){return await(await this.getMeRaw(t)).value()}async updateMeRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling updateMe().');const i={},l={};l["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(l["X-API-KEY"]=await this.configuration.apiKey("X-API-KEY")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/me",method:"PATCH",headers:l,query:i,body:BT(t.body)},a);return new Ne(d,f=>PS(f))}async updateMe(t,a){return await(await this.updateMeRaw(t,a)).value()}}class nD extends Zn{async createUserAPIKeyRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createUserAPIKey().');const i={},l={};l["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(l["X-API-KEY"]=await this.configuration.apiKey("X-API-KEY")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/me/api-keys",method:"POST",headers:l,query:i,body:ET(t.body)},a);return new Ne(d,f=>_w(f))}async createUserAPIKey(t,a){return await(await this.createUserAPIKeyRaw(t,a)).value()}async deleteUserAPIKeyRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteUserAPIKey().');const i={},l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/me/api-keys/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return new ys(d)}async deleteUserAPIKey(t,a){await this.deleteUserAPIKeyRaw(t,a)}async listUserAPIKeysRaw(t){const a={},i={};this.configuration&&this.configuration.apiKey&&(i["X-API-KEY"]=await this.configuration.apiKey("X-API-KEY")),this.configuration&&this.configuration.apiKey&&(i.Authorization=await this.configuration.apiKey("Authorization"));const u=await this.request({path:"/me/api-keys",method:"GET",headers:i,query:a},t);return new Ne(u,d=>d.map(_w))}async listUserAPIKeys(t){return await(await this.listUserAPIKeysRaw(t)).value()}}class aD extends Zn{async attachNodePoolAnnotationsRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling attachNodePoolAnnotations().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling attachNodePoolAnnotations().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/annotations";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:l,query:i,body:vA(t.body)},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async attachNodePoolAnnotations(t,a){return await(await this.attachNodePoolAnnotationsRaw(t,a)).value()}async attachNodePoolLabelsRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling attachNodePoolLabels().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling attachNodePoolLabels().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/labels";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:l,query:i,body:bA(t.body)},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async attachNodePoolLabels(t,a){return await(await this.attachNodePoolLabelsRaw(t,a)).value()}async attachNodePoolServersRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling attachNodePoolServers().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling attachNodePoolServers().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/servers";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:l,query:i,body:SA(t.body)},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async attachNodePoolServers(t,a){return await(await this.attachNodePoolServersRaw(t,a)).value()}async attachNodePoolTaintsRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling attachNodePoolTaints().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling attachNodePoolTaints().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/taints";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:l,query:i,body:jA(t.body)},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async attachNodePoolTaints(t,a){return await(await this.attachNodePoolTaintsRaw(t,a)).value()}async createNodePoolRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createNodePool().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/node-pools",method:"POST",headers:l,query:i,body:IA(t.body)},a);return new Ne(d,f=>Uu(f))}async createNodePool(t,a){return await(await this.createNodePoolRaw(t,a)).value()}async deleteNodePoolRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteNodePool().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async deleteNodePool(t,a){return await(await this.deleteNodePoolRaw(t,a)).value()}async detachNodePoolAnnotationRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling detachNodePoolAnnotation().');if(t.annotationId==null)throw new ye("annotationId",'Required parameter "annotationId" was null or undefined when calling detachNodePoolAnnotation().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/annotations/{annotationId}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{annotationId}",encodeURIComponent(String(t.annotationId)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async detachNodePoolAnnotation(t,a){return await(await this.detachNodePoolAnnotationRaw(t,a)).value()}async detachNodePoolLabelRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling detachNodePoolLabel().');if(t.labelId==null)throw new ye("labelId",'Required parameter "labelId" was null or undefined when calling detachNodePoolLabel().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/labels/{labelId}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{labelId}",encodeURIComponent(String(t.labelId)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async detachNodePoolLabel(t,a){return await(await this.detachNodePoolLabelRaw(t,a)).value()}async detachNodePoolServerRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling detachNodePoolServer().');if(t.serverId==null)throw new ye("serverId",'Required parameter "serverId" was null or undefined when calling detachNodePoolServer().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/servers/{serverId}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{serverId}",encodeURIComponent(String(t.serverId)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async detachNodePoolServer(t,a){return await(await this.detachNodePoolServerRaw(t,a)).value()}async detachNodePoolTaintRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling detachNodePoolTaint().');if(t.taintId==null)throw new ye("taintId",'Required parameter "taintId" was null or undefined when calling detachNodePoolTaint().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/taints/{taintId}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{taintId}",encodeURIComponent(String(t.taintId)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async detachNodePoolTaint(t,a){return await(await this.detachNodePoolTaintRaw(t,a)).value()}async getNodePoolRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling getNodePool().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>Uu(f))}async getNodePool(t,a){return await(await this.getNodePoolRaw(t,a)).value()}async listNodePoolAnnotationsRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling listNodePoolAnnotations().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/annotations";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(ds))}async listNodePoolAnnotations(t,a){return await(await this.listNodePoolAnnotationsRaw(t,a)).value()}async listNodePoolLabelsRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling listNodePoolLabels().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/labels";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(hs))}async listNodePoolLabels(t,a){return await(await this.listNodePoolLabelsRaw(t,a)).value()}async listNodePoolServersRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling listNodePoolServers().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/servers";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(ps))}async listNodePoolServers(t,a){return await(await this.listNodePoolServersRaw(t,a)).value()}async listNodePoolTaintsRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling listNodePoolTaints().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/taints";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(fs))}async listNodePoolTaints(t,a){return await(await this.listNodePoolTaintsRaw(t,a)).value()}async listNodePoolsRaw(t,a){const i={};t.q!=null&&(i.q=t.q);const l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/node-pools",method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(Uu))}async listNodePools(t={},a){return await(await this.listNodePoolsRaw(t,a)).value()}async updateNodePoolRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling updateNodePool().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling updateNodePool().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:l,query:i,body:bT(t.body)},a);return new Ne(d,f=>Uu(f))}async updateNodePool(t,a){return await(await this.updateNodePoolRaw(t,a)).value()}}class rD extends Zn{async addOrUpdateMemberRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling addOrUpdateMember().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling addOrUpdateMember().');const i={},l={};l["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/members";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:l,query:i,body:zT(t.body)},a);return new Ne(d,f=>Sw(f))}async addOrUpdateMember(t,a){return await(await this.addOrUpdateMemberRaw(t,a)).value()}async createOrgRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createOrg().');const i={},l={};l["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/orgs",method:"POST",headers:l,query:i,body:KT(t.body)},a);return new Ne(d,f=>ql(f))}async createOrg(t,a){return await(await this.createOrgRaw(t,a)).value()}async createOrgKeyRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling createOrgKey().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createOrgKey().');const i={},l={};l["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/api-keys";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:l,query:i,body:LT(t.body)},a);return new Ne(d,f=>qT(f))}async createOrgKey(t,a){return await(await this.createOrgKeyRaw(t,a)).value()}async deleteOrgRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteOrg().');const i={},l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return new ys(d)}async deleteOrg(t,a){await this.deleteOrgRaw(t,a)}async deleteOrgKeyRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteOrgKey().');if(t.keyId==null)throw new ye("keyId",'Required parameter "keyId" was null or undefined when calling deleteOrgKey().');const i={},l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/api-keys/{key_id}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{key_id}",encodeURIComponent(String(t.keyId)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return new ys(d)}async deleteOrgKey(t,a){await this.deleteOrgKeyRaw(t,a)}async getOrgRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling getOrg().');const i={},l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>ql(f))}async getOrg(t,a){return await(await this.getOrgRaw(t,a)).value()}async listMembersRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling listMembers().');const i={},l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/members";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(Sw))}async listMembers(t,a){return await(await this.listMembersRaw(t,a)).value()}async listMyOrgsRaw(t){const a={},i={};this.configuration&&this.configuration.apiKey&&(i.Authorization=await this.configuration.apiKey("Authorization"));const u=await this.request({path:"/orgs",method:"GET",headers:i,query:a},t);return new Ne(u,d=>d.map(ql))}async listMyOrgs(t){return await(await this.listMyOrgsRaw(t)).value()}async listOrgKeysRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling listOrgKeys().');const i={},l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/api-keys";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(XT))}async listOrgKeys(t,a){return await(await this.listOrgKeysRaw(t,a)).value()}async removeMemberRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling removeMember().');if(t.userId==null)throw new ye("userId",'Required parameter "userId" was null or undefined when calling removeMember().');const i={},l={};this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/members/{user_id}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{user_id}",encodeURIComponent(String(t.userId)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return new ys(d)}async removeMember(t,a){await this.removeMemberRaw(t,a)}async updateOrgRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling updateOrg().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling updateOrg().');const i={},l={};l["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:l,query:i,body:$T(t.body)},a);return new Ne(d,f=>ql(f))}async updateOrg(t,a){return await(await this.updateOrgRaw(t,a)).value()}}class iD extends Zn{async createServerRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createServer().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/servers",method:"POST",headers:l,query:i,body:FA(t.body)},a);return new Ne(d,f=>ps(f))}async createServer(t,a){return await(await this.createServerRaw(t,a)).value()}async deleteServerRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteServer().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/servers/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async deleteServer(t,a){return await(await this.deleteServerRaw(t,a)).value()}async getServerRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling getServer().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/servers/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>ps(f))}async getServer(t,a){return await(await this.getServerRaw(t,a)).value()}async listServersRaw(t,a){const i={};t.status!=null&&(i.status=t.status),t.role!=null&&(i.role=t.role);const l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/servers",method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(ps))}async listServers(t={},a){return await(await this.listServersRaw(t,a)).value()}async updateServerRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling updateServer().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling updateServer().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/servers/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:l,query:i,body:ST(t.body)},a);return new Ne(d,f=>ps(f))}async updateServer(t,a){return await(await this.updateServerRaw(t,a)).value()}}class oD extends Zn{async createSSHKeyRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createSSHKey().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/ssh",method:"POST",headers:l,query:i,body:UA(t.body)},a);return new Ne(d,f=>bw(f))}async createSSHKey(t,a){return await(await this.createSSHKeyRaw(t,a)).value()}async deleteSSHKeyRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteSSHKey().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/ssh/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async deleteSSHKey(t,a){return await(await this.deleteSSHKeyRaw(t,a)).value()}async downloadSSHKeyRaw(t,a){if(t.xOrgID==null)throw new ye("xOrgID",'Required parameter "xOrgID" was null or undefined when calling downloadSSHKey().');if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling downloadSSHKey().');if(t.part==null)throw new ye("part",'Required parameter "part" was null or undefined when calling downloadSSHKey().');const i={};t.part!=null&&(i.part=t.part);const l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/ssh/{id}/download";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async downloadSSHKey(t,a){return await(await this.downloadSSHKeyRaw(t,a)).value()}async getSSHKeyRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling getSSHKey().');const i={};t.reveal!=null&&(i.reveal=t.reveal);const l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/ssh/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>dT(f))}async getSSHKey(t,a){return await(await this.getSSHKeyRaw(t,a)).value()}async listPublicSshKeysRaw(t,a){const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/ssh",method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(bw))}async listPublicSshKeys(t={},a){return await(await this.listPublicSshKeysRaw(t,a)).value()}}class sD extends Zn{async createTaintRaw(t,a){if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling createTaint().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/taints",method:"POST",headers:l,query:i,body:VA(t.body)},a);return new Ne(d,f=>fs(f))}async createTaint(t,a){return await(await this.createTaintRaw(t,a)).value()}async deleteTaintRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling deleteTaint().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/taints/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:l,query:i},a);return this.isJsonMime(d.headers.get("content-type"))?new Ne(d):new Tn(d)}async deleteTaint(t,a){return await(await this.deleteTaintRaw(t,a)).value()}async getTaintRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling getTaint().');const i={},l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/taints/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:l,query:i},a);return new Ne(d,f=>fs(f))}async getTaint(t,a){return await(await this.getTaintRaw(t,a)).value()}async listTaintsRaw(t,a){const i={};t.key!=null&&(i.key=t.key),t.value!=null&&(i.value=t.value),t.q!=null&&(i.q=t.q);const l={};t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/taints",method:"GET",headers:l,query:i},a);return new Ne(d,f=>f.map(fs))}async listTaints(t={},a){return await(await this.listTaintsRaw(t,a)).value()}async updateTaintRaw(t,a){if(t.id==null)throw new ye("id",'Required parameter "id" was null or undefined when calling updateTaint().');if(t.body==null)throw new ye("body",'Required parameter "body" was null or undefined when calling updateTaint().');const i={},l={};l["Content-Type"]="application/json",t.xOrgID!=null&&(l["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(l["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(l["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(l.Authorization=await this.configuration.apiKey("Authorization"));let u="/taints/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:l,query:i,body:jT(t.body)},a);return new Ne(d,f=>fs(f))}async updateTaint(t,a){return await(await this.updateTaintRaw(t,a)).value()}}const ug="/api/v1";function lD(){return new MS({basePath:ug,accessToken:async()=>jn.getAccessToken()??"",middleware:[{async pre(e){const t=new Headers(e.init?.headers??{});e.init?.body!=null&&!(e.init.body instanceof FormData)&&!(e.init.body instanceof Blob)&&!t.has("Content-Type")&&t.set("Content-Type","application/json");const i=jn.getAccessToken();i&&t.set("Authorization",`Bearer ${i}`);const l=qa.get();return l&&t.set("X-Org-ID",l),{...e,init:{...e.init,headers:t}}},async post(e){return e.response}}]})}function Na(e){return new e(lD())}function cD(){return Na(JT)}function uD(){return Na(tD)}function dD(){return Na(nD)}function Bd(){return Na(rD)}function fD(){return Na(oD)}function hD(){return Na(iD)}function pD(){return Na(sD)}function mD(){return Na(eD)}function gD(){return Na(YT)}function yD(){return Na(QT)}function vD(){return Na(aD)}function xD(){return Na(WT)}let Fu=null;async function bD(){const e=jn.get();if(!e?.refresh_token)return!1;try{const t=await fetch(`${ug}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token})});if(!t.ok)return!1;const a=await t.json();return jn.set(a),!0}catch{return!1}}async function jw(){return Fu||(Fu=bD().finally(()=>{Fu=null})),Fu}function wD(e){return e?.status===401||e?.cause?.status===401||e?.response?.status===401||e instanceof Response&&e.status===401}async function ze(e){jn.willExpireSoon?.(30)&&await jw();try{return await e()}catch(t){if(!wD(t)||!await jw())throw t;return await e()}}const Cw=uD(),$p=dD(),Zi={getMe:()=>ze(async()=>await Cw.getMe()),updateMe:e=>ze(async()=>await Cw.updateMe({body:e})),listKeys:()=>ze(async()=>await $p.listUserAPIKeys()),createKey:e=>ze(async()=>await $p.createUserAPIKey({body:e})),deleteKey:e=>ze(async()=>(await $p.deleteUserAPIKey({id:e}),!0))},SD={footer:async()=>{const e=await fetch("/api/v1/version",{cache:"no-store"});if(!e.ok)throw new Error("failed to fetch version");return await e.json()}};function Ew(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Mn(...e){return t=>{let a=!1;const i=e.map(l=>{const u=Ew(l,t);return!a&&typeof u=="function"&&(a=!0),u});if(a)return()=>{for(let l=0;l{let{children:u,...d}=i;KS(u)&&typeof vd=="function"&&(u=vd(u._payload));const f=m.Children.toArray(u),g=f.find(RD);if(g){const y=g.props.children,x=f.map(v=>v===g?m.Children.count(y)>1?m.Children.only(null):m.isValidElement(y)?y.props.children:null:v);return o.jsx(t,{...d,ref:l,children:m.isValidElement(y)?m.cloneElement(y,void 0,x):null})}return o.jsx(t,{...d,ref:l,children:u})});return a.displayName=`${e}.Slot`,a}var Rs=lc("Slot");function CD(e){const t=m.forwardRef((a,i)=>{let{children:l,...u}=a;if(KS(l)&&typeof vd=="function"&&(l=vd(l._payload)),m.isValidElement(l)){const d=OD(l),f=ND(u,l.props);return l.type!==m.Fragment&&(f.ref=i?Mn(i,d):d),m.cloneElement(l,f)}return m.Children.count(l)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ED=Symbol("radix.slottable");function RD(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ED}function ND(e,t){const a={...t};for(const i in t){const l=e[i],u=t[i];/^on[A-Z]/.test(i)?l&&u?a[i]=(...f)=>{const g=u(...f);return l(...f),g}:l&&(a[i]=l):i==="style"?a[i]={...l,...u}:i==="className"&&(a[i]=[l,u].filter(Boolean).join(" "))}return{...e,...a}}function OD(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning;return a?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}function IS(e){var t,a,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,Nw=LS,dg=(e,t)=>a=>{var i;if(t?.variants==null)return Nw(e,a?.class,a?.className);const{variants:l,defaultVariants:u}=t,d=Object.keys(l).map(y=>{const x=a?.[y],v=u?.[y];if(x===null)return null;const w=Rw(x)||Rw(v);return l[y][w]}),f=a&&Object.entries(a).reduce((y,x)=>{let[v,w]=x;return w===void 0||(y[v]=w),y},{}),g=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((y,x)=>{let{class:v,className:w,..._}=x;return Object.entries(_).every(R=>{let[S,A]=R;return Array.isArray(A)?A.includes({...u,...f}[S]):{...u,...f}[S]===A})?[...y,v,w]:y},[]);return Nw(e,d,g,a?.class,a?.className)},AD=(e,t)=>{const a=new Array(e.length+t.length);for(let i=0;i({classGroupId:e,validator:t}),US=(e=new Map,t=null,a)=>({nextPart:e,validators:t,classGroupId:a}),xd="-",Ow=[],DD="arbitrary..",MD=e=>{const t=zD(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return kD(d);const f=d.split(xd),g=f[0]===""&&f.length>1?1:0;return qS(f,g,t)},getConflictingClassGroupIds:(d,f)=>{if(f){const g=i[d],y=a[d];return g?y?AD(y,g):g:y||Ow}return a[d]||Ow}}},qS=(e,t,a)=>{if(e.length-t===0)return a.classGroupId;const l=e[t],u=a.nextPart.get(l);if(u){const y=qS(e,t+1,u);if(y)return y}const d=a.validators;if(d===null)return;const f=t===0?e.join(xd):e.slice(t).join(xd),g=d.length;for(let y=0;ye.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),a=t.indexOf(":"),i=t.slice(0,a);return i?DD+i:void 0})(),zD=e=>{const{theme:t,classGroups:a}=e;return PD(a,t)},PD=(e,t)=>{const a=US();for(const i in e){const l=e[i];fg(l,a,i,t)}return a},fg=(e,t,a,i)=>{const l=e.length;for(let u=0;u{if(typeof e=="string"){ID(e,t,a);return}if(typeof e=="function"){LD(e,t,a,i);return}UD(e,t,a,i)},ID=(e,t,a)=>{const i=e===""?t:FS(t,e);i.classGroupId=a},LD=(e,t,a,i)=>{if(qD(e)){fg(e(i),t,a,i);return}t.validators===null&&(t.validators=[]),t.validators.push(TD(a,e))},UD=(e,t,a,i)=>{const l=Object.entries(e),u=l.length;for(let d=0;d{let a=e;const i=t.split(xd),l=i.length;for(let u=0;u"isThemeGetter"in e&&e.isThemeGetter===!0,FD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=Object.create(null),i=Object.create(null);const l=(u,d)=>{a[u]=d,t++,t>e&&(t=0,i=a,a=Object.create(null))};return{get(u){let d=a[u];if(d!==void 0)return d;if((d=i[u])!==void 0)return l(u,d),d},set(u,d){u in a?a[u]=d:l(u,d)}}},Rm="!",Aw=":",$D=[],Tw=(e,t,a,i,l)=>({modifiers:e,hasImportantModifier:t,baseClassName:a,maybePostfixModifierPosition:i,isExternal:l}),VD=e=>{const{prefix:t,experimentalParseClassName:a}=e;let i=l=>{const u=[];let d=0,f=0,g=0,y;const x=l.length;for(let S=0;Sg?y-g:void 0;return Tw(u,_,w,R)};if(t){const l=t+Aw,u=i;i=d=>d.startsWith(l)?u(d.slice(l.length)):Tw($D,!1,d,void 0,!0)}if(a){const l=i;i=u=>a({className:u,parseClassName:l})}return i},BD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((a,i)=>{t.set(a,1e6+i)}),a=>{const i=[];let l=[];for(let u=0;u0&&(l.sort(),i.push(...l),l=[]),i.push(d)):l.push(d)}return l.length>0&&(l.sort(),i.push(...l)),i}},GD=e=>({cache:FD(e.cacheSize),parseClassName:VD(e),sortModifiers:BD(e),...MD(e)}),HD=/\s+/,XD=(e,t)=>{const{parseClassName:a,getClassGroupId:i,getConflictingClassGroupIds:l,sortModifiers:u}=t,d=[],f=e.trim().split(HD);let g="";for(let y=f.length-1;y>=0;y-=1){const x=f[y],{isExternal:v,modifiers:w,hasImportantModifier:_,baseClassName:R,maybePostfixModifierPosition:S}=a(x);if(v){g=x+(g.length>0?" "+g:g);continue}let A=!!S,M=i(A?R.substring(0,S):R);if(!M){if(!A){g=x+(g.length>0?" "+g:g);continue}if(M=i(R),!M){g=x+(g.length>0?" "+g:g);continue}A=!1}const T=w.length===0?"":w.length===1?w[0]:u(w).join(":"),N=_?T+Rm:T,E=N+M;if(d.indexOf(E)>-1)continue;d.push(E);const D=l(M,A);for(let I=0;I0?" "+g:g)}return g},ZD=(...e)=>{let t=0,a,i,l="";for(;t{if(typeof e=="string")return e;let t,a="";for(let i=0;i{let a,i,l,u;const d=g=>{const y=t.reduce((x,v)=>v(x),e());return a=GD(y),i=a.cache.get,l=a.cache.set,u=f,f(g)},f=g=>{const y=i(g);if(y)return y;const x=XD(g,a);return l(g,x),x};return u=d,(...g)=>u(ZD(...g))},QD=[],sn=e=>{const t=a=>a[e]||QD;return t.isThemeGetter=!0,t},VS=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,BS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,JD=/^\d+\/\d+$/,WD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,eM=/\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$/,tM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,nM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,es=e=>JD.test(e),nt=e=>!!e&&!Number.isNaN(Number(e)),hi=e=>!!e&&Number.isInteger(Number(e)),Vp=e=>e.endsWith("%")&&nt(e.slice(0,-1)),kr=e=>WD.test(e),rM=()=>!0,iM=e=>eM.test(e)&&!tM.test(e),GS=()=>!1,oM=e=>nM.test(e),sM=e=>aM.test(e),lM=e=>!Me(e)&&!ke(e),cM=e=>Ns(e,ZS,GS),Me=e=>VS.test(e),Xi=e=>Ns(e,YS,iM),Bp=e=>Ns(e,pM,nt),Dw=e=>Ns(e,HS,GS),uM=e=>Ns(e,XS,sM),$u=e=>Ns(e,QS,oM),ke=e=>BS.test(e),Nl=e=>Os(e,YS),dM=e=>Os(e,mM),Mw=e=>Os(e,HS),fM=e=>Os(e,ZS),hM=e=>Os(e,XS),Vu=e=>Os(e,QS,!0),Ns=(e,t,a)=>{const i=VS.exec(e);return i?i[1]?t(i[1]):a(i[2]):!1},Os=(e,t,a=!1)=>{const i=BS.exec(e);return i?i[1]?t(i[1]):a:!1},HS=e=>e==="position"||e==="percentage",XS=e=>e==="image"||e==="url",ZS=e=>e==="length"||e==="size"||e==="bg-size",YS=e=>e==="length",pM=e=>e==="number",mM=e=>e==="family-name",QS=e=>e==="shadow",gM=()=>{const e=sn("color"),t=sn("font"),a=sn("text"),i=sn("font-weight"),l=sn("tracking"),u=sn("leading"),d=sn("breakpoint"),f=sn("container"),g=sn("spacing"),y=sn("radius"),x=sn("shadow"),v=sn("inset-shadow"),w=sn("text-shadow"),_=sn("drop-shadow"),R=sn("blur"),S=sn("perspective"),A=sn("aspect"),M=sn("ease"),T=sn("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...E(),ke,Me],I=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto","contain","none"],F=()=>[ke,Me,g],fe=()=>[es,"full","auto",...F()],ge=()=>[hi,"none","subgrid",ke,Me],he=()=>["auto",{span:["full",hi,ke,Me]},hi,ke,Me],ne=()=>[hi,"auto",ke,Me],le=()=>["auto","min","max","fr",ke,Me],ce=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ve=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...F()],j=()=>[es,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...F()],z=()=>[e,ke,Me],J=()=>[...E(),Mw,Dw,{position:[ke,Me]}],me=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Te=()=>["auto","cover","contain",fM,cM,{size:[ke,Me]}],H=()=>[Vp,Nl,Xi],Y=()=>["","none","full",y,ke,Me],oe=()=>["",nt,Nl,Xi],se=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>[nt,Vp,Mw,Dw],Se=()=>["","none",R,ke,Me],De=()=>["none",nt,ke,Me],He=()=>["none",nt,ke,Me],Qe=()=>[nt,ke,Me],Ye=()=>[es,"full",...F()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[kr],breakpoint:[kr],color:[rM],container:[kr],"drop-shadow":[kr],ease:["in","out","in-out"],font:[lM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[kr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[kr],shadow:[kr],spacing:["px",nt],text:[kr],"text-shadow":[kr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",es,Me,ke,A]}],container:["container"],columns:[{columns:[nt,Me,ke,f]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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:D()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:fe()}],"inset-x":[{"inset-x":fe()}],"inset-y":[{"inset-y":fe()}],start:[{start:fe()}],end:[{end:fe()}],top:[{top:fe()}],right:[{right:fe()}],bottom:[{bottom:fe()}],left:[{left:fe()}],visibility:["visible","invisible","collapse"],z:[{z:[hi,"auto",ke,Me]}],basis:[{basis:[es,"full","auto",f,...F()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nt,es,"auto","initial","none",Me]}],grow:[{grow:["",nt,ke,Me]}],shrink:[{shrink:["",nt,ke,Me]}],order:[{order:[hi,"first","last","none",ke,Me]}],"grid-cols":[{"grid-cols":ge()}],"col-start-end":[{col:he()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:he()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":le()}],"auto-rows":[{"auto-rows":le()}],gap:[{gap:F()}],"gap-x":[{"gap-x":F()}],"gap-y":[{"gap-y":F()}],"justify-content":[{justify:[...ce(),"normal"]}],"justify-items":[{"justify-items":[...ve(),"normal"]}],"justify-self":[{"justify-self":["auto",...ve()]}],"align-content":[{content:["normal",...ce()]}],"align-items":[{items:[...ve(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ve(),{baseline:["","last"]}]}],"place-content":[{"place-content":ce()}],"place-items":[{"place-items":[...ve(),"baseline"]}],"place-self":[{"place-self":["auto",...ve()]}],p:[{p:F()}],px:[{px:F()}],py:[{py:F()}],ps:[{ps:F()}],pe:[{pe:F()}],pt:[{pt:F()}],pr:[{pr:F()}],pb:[{pb:F()}],pl:[{pl:F()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":F()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":F()}],"space-y-reverse":["space-y-reverse"],size:[{size:j()}],w:[{w:[f,"screen",...j()]}],"min-w":[{"min-w":[f,"screen","none",...j()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...j()]}],h:[{h:["screen","lh",...j()]}],"min-h":[{"min-h":["screen","lh","none",...j()]}],"max-h":[{"max-h":["screen","lh",...j()]}],"font-size":[{text:["base",a,Nl,Xi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ke,Bp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Vp,Me]}],"font-family":[{font:[dM,Me,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,ke,Me]}],"line-clamp":[{"line-clamp":[nt,"none",ke,Bp]}],leading:[{leading:[u,...F()]}],"list-image":[{"list-image":["none",ke,Me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Me]}],"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:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[nt,"from-font","auto",ke,Xi]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[nt,"auto",ke,Me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Me]}],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",ke,Me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:me()}],"bg-size":[{bg:Te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},hi,ke,Me],radial:["",ke,Me],conic:[hi,ke,Me]},hM,uM]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"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-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:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[nt,ke,Me]}],"outline-w":[{outline:["",nt,Nl,Xi]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",x,Vu,$u]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",v,Vu,$u]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[nt,Xi]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",w,Vu,$u]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[nt,ke,Me]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"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":[nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":ee()}],"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":ee()}],"mask-image-t-to-pos":[{"mask-t-to":ee()}],"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":ee()}],"mask-image-r-to-pos":[{"mask-r-to":ee()}],"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":ee()}],"mask-image-b-to-pos":[{"mask-b-to":ee()}],"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":ee()}],"mask-image-l-to-pos":[{"mask-l-to":ee()}],"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":ee()}],"mask-image-x-to-pos":[{"mask-x-to":ee()}],"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":ee()}],"mask-image-y-to-pos":[{"mask-y-to":ee()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[ke,Me]}],"mask-image-radial-from-pos":[{"mask-radial-from":ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":ee()}],"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":E()}],"mask-image-conic-pos":[{"mask-conic":[nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":ee()}],"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:J()}],"mask-repeat":[{mask:me()}],"mask-size":[{mask:Te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Me]}],filter:[{filter:["","none",ke,Me]}],blur:[{blur:Se()}],brightness:[{brightness:[nt,ke,Me]}],contrast:[{contrast:[nt,ke,Me]}],"drop-shadow":[{"drop-shadow":["","none",_,Vu,$u]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",nt,ke,Me]}],"hue-rotate":[{"hue-rotate":[nt,ke,Me]}],invert:[{invert:["",nt,ke,Me]}],saturate:[{saturate:[nt,ke,Me]}],sepia:[{sepia:["",nt,ke,Me]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Me]}],"backdrop-blur":[{"backdrop-blur":Se()}],"backdrop-brightness":[{"backdrop-brightness":[nt,ke,Me]}],"backdrop-contrast":[{"backdrop-contrast":[nt,ke,Me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nt,ke,Me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nt,ke,Me]}],"backdrop-invert":[{"backdrop-invert":["",nt,ke,Me]}],"backdrop-opacity":[{"backdrop-opacity":[nt,ke,Me]}],"backdrop-saturate":[{"backdrop-saturate":[nt,ke,Me]}],"backdrop-sepia":[{"backdrop-sepia":["",nt,ke,Me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":F()}],"border-spacing-x":[{"border-spacing-x":F()}],"border-spacing-y":[{"border-spacing-y":F()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[nt,"initial",ke,Me]}],ease:[{ease:["linear","initial",M,ke,Me]}],delay:[{delay:[nt,ke,Me]}],animate:[{animate:["none",T,ke,Me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ke,Me]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:De()}],"rotate-x":[{"rotate-x":De()}],"rotate-y":[{"rotate-y":De()}],"rotate-z":[{"rotate-z":De()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"scale-3d":["scale-3d"],skew:[{skew:Qe()}],"skew-x":[{"skew-x":Qe()}],"skew-y":[{"skew-y":Qe()}],transform:[{transform:[ke,Me,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ye()}],"translate-x":[{"translate-x":Ye()}],"translate-y":[{"translate-y":Ye()}],"translate-z":[{"translate-z":Ye()}],"translate-none":["translate-none"],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",ke,Me]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"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",ke,Me]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[nt,Nl,Xi,Bp]}],stroke:[{stroke:["none",...z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["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-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["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-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},yM=YD(gM);function de(...e){return yM(LS(e))}function Ji(e,t=24){return!e||e.length<=t*2+3?e:`${e.slice(0,t)}…${e.slice(-t)}`}const vM=dg("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function ca({className:e,variant:t,asChild:a=!1,...i}){const l=a?Rs:"span";return o.jsx(l,{"data-slot":"badge",className:de(vM({variant:t}),e),...i})}const hg=dg("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ie({className:e,variant:t,size:a,asChild:i=!1,...l}){const u=i?Rs:"button";return o.jsx(u,{"data-slot":"button",className:de(hg({variant:t,size:a,className:e})),...l})}var xM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bM=xM.reduce((e,t)=>{const a=lc(`Primitive.${t}`),i=m.forwardRef((l,u)=>{const{asChild:d,...f}=l,g=d?a:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(g,{...f,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),wM="Separator",kw="horizontal",SM=["horizontal","vertical"],JS=m.forwardRef((e,t)=>{const{decorative:a,orientation:i=kw,...l}=e,u=_M(i)?i:kw,f=a?{role:"none"}:{"aria-orientation":u==="vertical"?u:void 0,role:"separator"};return o.jsx(bM.div,{"data-orientation":u,...f,...l,ref:t})});JS.displayName=wM;function _M(e){return SM.includes(e)}var jM=JS;function Fl({className:e,orientation:t="horizontal",decorative:a=!0,...i}){return o.jsx(jM,{"data-slot":"separator",decorative:a,orientation:t,className:de("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...i})}function Re(e,t,{checkForDefaultPrevented:a=!0}={}){return function(l){if(e?.(l),a===!1||!l.defaultPrevented)return t?.(l)}}function CM(e,t){const a=m.createContext(t),i=u=>{const{children:d,...f}=u,g=m.useMemo(()=>f,Object.values(f));return o.jsx(a.Provider,{value:g,children:d})};i.displayName=e+"Provider";function l(u){const d=m.useContext(a);if(d)return d;if(t!==void 0)return t;throw new Error(`\`${u}\` must be used within \`${e}\``)}return[i,l]}function Za(e,t=[]){let a=[];function i(u,d){const f=m.createContext(d),g=a.length;a=[...a,d];const y=v=>{const{scope:w,children:_,...R}=v,S=w?.[e]?.[g]||f,A=m.useMemo(()=>R,Object.values(R));return o.jsx(S.Provider,{value:A,children:_})};y.displayName=u+"Provider";function x(v,w){const _=w?.[e]?.[g]||f,R=m.useContext(_);if(R)return R;if(d!==void 0)return d;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[y,x]}const l=()=>{const u=a.map(d=>m.createContext(d));return function(f){const g=f?.[e]||u;return m.useMemo(()=>({[`__scope${e}`]:{...f,[e]:g}}),[f,g])}};return l.scopeName=e,[i,EM(l,...t)]}function EM(...e){const t=e[0];if(e.length===1)return t;const a=()=>{const i=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(u){const d=i.reduce((f,{useScope:g,scopeName:y})=>{const v=g(u)[`__scope${y}`];return{...f,...v}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return a.scopeName=t.scopeName,a}function RM(e){const t=NM(e),a=m.forwardRef((i,l)=>{const{children:u,...d}=i,f=m.Children.toArray(u),g=f.find(AM);if(g){const y=g.props.children,x=f.map(v=>v===g?m.Children.count(y)>1?m.Children.only(null):m.isValidElement(y)?y.props.children:null:v);return o.jsx(t,{...d,ref:l,children:m.isValidElement(y)?m.cloneElement(y,void 0,x):null})}return o.jsx(t,{...d,ref:l,children:u})});return a.displayName=`${e}.Slot`,a}function NM(e){const t=m.forwardRef((a,i)=>{const{children:l,...u}=a;if(m.isValidElement(l)){const d=DM(l),f=TM(u,l.props);return l.type!==m.Fragment&&(f.ref=i?Mn(i,d):d),m.cloneElement(l,f)}return m.Children.count(l)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var OM=Symbol("radix.slottable");function AM(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OM}function TM(e,t){const a={...t};for(const i in t){const l=e[i],u=t[i];/^on[A-Z]/.test(i)?l&&u?a[i]=(...f)=>{const g=u(...f);return l(...f),g}:l&&(a[i]=l):i==="style"?a[i]={...l,...u}:i==="className"&&(a[i]=[l,u].filter(Boolean).join(" "))}return{...e,...a}}function DM(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning;return a?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var MM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],at=MM.reduce((e,t)=>{const a=RM(`Primitive.${t}`),i=m.forwardRef((l,u)=>{const{asChild:d,...f}=l,g=d?a:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(g,{...f,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function WS(e,t){e&&$d.flushSync(()=>e.dispatchEvent(t))}function Ba(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...a)=>t.current?.(...a),[])}function kM(e,t=globalThis?.document){const a=Ba(e);m.useEffect(()=>{const i=l=>{l.key==="Escape"&&a(l)};return t.addEventListener("keydown",i,{capture:!0}),()=>t.removeEventListener("keydown",i,{capture:!0})},[a,t])}var zM="DismissableLayer",Nm="dismissableLayer.update",PM="dismissableLayer.pointerDownOutside",KM="dismissableLayer.focusOutside",zw,e1=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),As=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:f,...g}=e,y=m.useContext(e1),[x,v]=m.useState(null),w=x?.ownerDocument??globalThis?.document,[,_]=m.useState({}),R=dt(t,U=>v(U)),S=Array.from(y.layers),[A]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),M=S.indexOf(A),T=x?S.indexOf(x):-1,N=y.layersWithOutsidePointerEventsDisabled.size>0,E=T>=M,D=UM(U=>{const F=U.target,fe=[...y.branches].some(ge=>ge.contains(F));!E||fe||(l?.(U),d?.(U),U.defaultPrevented||f?.())},w),I=qM(U=>{const F=U.target;[...y.branches].some(ge=>ge.contains(F))||(u?.(U),d?.(U),U.defaultPrevented||f?.())},w);return kM(U=>{T===y.layers.size-1&&(i?.(U),!U.defaultPrevented&&f&&(U.preventDefault(),f()))},w),m.useEffect(()=>{if(x)return a&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(zw=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(x)),y.layers.add(x),Pw(),()=>{a&&y.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=zw)}},[x,w,a,y]),m.useEffect(()=>()=>{x&&(y.layers.delete(x),y.layersWithOutsidePointerEventsDisabled.delete(x),Pw())},[x,y]),m.useEffect(()=>{const U=()=>_({});return document.addEventListener(Nm,U),()=>document.removeEventListener(Nm,U)},[]),o.jsx(at.div,{...g,ref:R,style:{pointerEvents:N?E?"auto":"none":void 0,...e.style},onFocusCapture:Re(e.onFocusCapture,I.onFocusCapture),onBlurCapture:Re(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Re(e.onPointerDownCapture,D.onPointerDownCapture)})});As.displayName=zM;var IM="DismissableLayerBranch",LM=m.forwardRef((e,t)=>{const a=m.useContext(e1),i=m.useRef(null),l=dt(t,i);return m.useEffect(()=>{const u=i.current;if(u)return a.branches.add(u),()=>{a.branches.delete(u)}},[a.branches]),o.jsx(at.div,{...e,ref:l})});LM.displayName=IM;function UM(e,t=globalThis?.document){const a=Ba(e),i=m.useRef(!1),l=m.useRef(()=>{});return m.useEffect(()=>{const u=f=>{if(f.target&&!i.current){let g=function(){t1(PM,a,y,{discrete:!0})};const y={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",l.current),l.current=g,t.addEventListener("click",l.current,{once:!0})):g()}else t.removeEventListener("click",l.current);i.current=!1},d=window.setTimeout(()=>{t.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(d),t.removeEventListener("pointerdown",u),t.removeEventListener("click",l.current)}},[t,a]),{onPointerDownCapture:()=>i.current=!0}}function qM(e,t=globalThis?.document){const a=Ba(e),i=m.useRef(!1);return m.useEffect(()=>{const l=u=>{u.target&&!i.current&&t1(KM,a,{originalEvent:u},{discrete:!1})};return t.addEventListener("focusin",l),()=>t.removeEventListener("focusin",l)},[t,a]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function Pw(){const e=new CustomEvent(Nm);document.dispatchEvent(e)}function t1(e,t,a,{discrete:i}){const l=a.originalEvent.target,u=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:a});t&&l.addEventListener(e,t,{once:!0}),i?WS(l,u):l.dispatchEvent(u)}var hn=globalThis?.document?m.useLayoutEffect:()=>{},FM=eg[" useId ".trim().toString()]||(()=>{}),$M=0;function Cn(e){const[t,a]=m.useState(FM());return hn(()=>{a(i=>i??String($M++))},[e]),t?`radix-${t}`:""}const VM=["top","right","bottom","left"],yi=Math.min,sa=Math.max,bd=Math.round,Bu=Math.floor,ur=e=>({x:e,y:e}),BM={left:"right",right:"left",bottom:"top",top:"bottom"},GM={start:"end",end:"start"};function Om(e,t,a){return sa(e,yi(t,a))}function Ir(e,t){return typeof e=="function"?e(t):e}function Lr(e){return e.split("-")[0]}function Ts(e){return e.split("-")[1]}function pg(e){return e==="x"?"y":"x"}function mg(e){return e==="y"?"height":"width"}const HM=new Set(["top","bottom"]);function cr(e){return HM.has(Lr(e))?"y":"x"}function gg(e){return pg(cr(e))}function XM(e,t,a){a===void 0&&(a=!1);const i=Ts(e),l=gg(e),u=mg(l);let d=l==="x"?i===(a?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[u]>t.floating[u]&&(d=wd(d)),[d,wd(d)]}function ZM(e){const t=wd(e);return[Am(e),t,Am(t)]}function Am(e){return e.replace(/start|end/g,t=>GM[t])}const Kw=["left","right"],Iw=["right","left"],YM=["top","bottom"],QM=["bottom","top"];function JM(e,t,a){switch(e){case"top":case"bottom":return a?t?Iw:Kw:t?Kw:Iw;case"left":case"right":return t?YM:QM;default:return[]}}function WM(e,t,a,i){const l=Ts(e);let u=JM(Lr(e),a==="start",i);return l&&(u=u.map(d=>d+"-"+l),t&&(u=u.concat(u.map(Am)))),u}function wd(e){return e.replace(/left|right|bottom|top/g,t=>BM[t])}function ek(e){return{top:0,right:0,bottom:0,left:0,...e}}function n1(e){return typeof e!="number"?ek(e):{top:e,right:e,bottom:e,left:e}}function Sd(e){const{x:t,y:a,width:i,height:l}=e;return{width:i,height:l,top:a,left:t,right:t+i,bottom:a+l,x:t,y:a}}function Lw(e,t,a){let{reference:i,floating:l}=e;const u=cr(t),d=gg(t),f=mg(d),g=Lr(t),y=u==="y",x=i.x+i.width/2-l.width/2,v=i.y+i.height/2-l.height/2,w=i[f]/2-l[f]/2;let _;switch(g){case"top":_={x,y:i.y-l.height};break;case"bottom":_={x,y:i.y+i.height};break;case"right":_={x:i.x+i.width,y:v};break;case"left":_={x:i.x-l.width,y:v};break;default:_={x:i.x,y:i.y}}switch(Ts(t)){case"start":_[d]-=w*(a&&y?-1:1);break;case"end":_[d]+=w*(a&&y?-1:1);break}return _}const tk=async(e,t,a)=>{const{placement:i="bottom",strategy:l="absolute",middleware:u=[],platform:d}=a,f=u.filter(Boolean),g=await(d.isRTL==null?void 0:d.isRTL(t));let y=await d.getElementRects({reference:e,floating:t,strategy:l}),{x,y:v}=Lw(y,i,g),w=i,_={},R=0;for(let S=0;S({name:"arrow",options:e,async fn(t){const{x:a,y:i,placement:l,rects:u,platform:d,elements:f,middlewareData:g}=t,{element:y,padding:x=0}=Ir(e,t)||{};if(y==null)return{};const v=n1(x),w={x:a,y:i},_=gg(l),R=mg(_),S=await d.getDimensions(y),A=_==="y",M=A?"top":"left",T=A?"bottom":"right",N=A?"clientHeight":"clientWidth",E=u.reference[R]+u.reference[_]-w[_]-u.floating[R],D=w[_]-u.reference[_],I=await(d.getOffsetParent==null?void 0:d.getOffsetParent(y));let U=I?I[N]:0;(!U||!await(d.isElement==null?void 0:d.isElement(I)))&&(U=f.floating[N]||u.floating[R]);const F=E/2-D/2,fe=U/2-S[R]/2-1,ge=yi(v[M],fe),he=yi(v[T],fe),ne=ge,le=U-S[R]-he,ce=U/2-S[R]/2+F,ve=Om(ne,ce,le),O=!g.arrow&&Ts(l)!=null&&ce!==ve&&u.reference[R]/2-(cece<=0)){var he,ne;const ce=(((he=u.flip)==null?void 0:he.index)||0)+1,ve=U[ce];if(ve&&(!(v==="alignment"?T!==cr(ve):!1)||ge.every(z=>cr(z.placement)===T?z.overflows[0]>0:!0)))return{data:{index:ce,overflows:ge},reset:{placement:ve}};let O=(ne=ge.filter(j=>j.overflows[0]<=0).sort((j,z)=>j.overflows[1]-z.overflows[1])[0])==null?void 0:ne.placement;if(!O)switch(_){case"bestFit":{var le;const j=(le=ge.filter(z=>{if(I){const J=cr(z.placement);return J===T||J==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(J=>J>0).reduce((J,me)=>J+me,0)]).sort((z,J)=>z[1]-J[1])[0])==null?void 0:le[0];j&&(O=j);break}case"initialPlacement":O=f;break}if(l!==O)return{reset:{placement:O}}}return{}}}};function Uw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qw(e){return VM.some(t=>e[t]>=0)}const rk=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:a}=t,{strategy:i="referenceHidden",...l}=Ir(e,t);switch(i){case"referenceHidden":{const u=await ec(t,{...l,elementContext:"reference"}),d=Uw(u,a.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:qw(d)}}}case"escaped":{const u=await ec(t,{...l,altBoundary:!0}),d=Uw(u,a.floating);return{data:{escapedOffsets:d,escaped:qw(d)}}}default:return{}}}}},a1=new Set(["left","top"]);async function ik(e,t){const{placement:a,platform:i,elements:l}=e,u=await(i.isRTL==null?void 0:i.isRTL(l.floating)),d=Lr(a),f=Ts(a),g=cr(a)==="y",y=a1.has(d)?-1:1,x=u&&g?-1:1,v=Ir(t,e);let{mainAxis:w,crossAxis:_,alignmentAxis:R}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return f&&typeof R=="number"&&(_=f==="end"?R*-1:R),g?{x:_*x,y:w*y}:{x:w*y,y:_*x}}const ok=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,i;const{x:l,y:u,placement:d,middlewareData:f}=t,g=await ik(t,e);return d===((a=f.offset)==null?void 0:a.placement)&&(i=f.arrow)!=null&&i.alignmentOffset?{}:{x:l+g.x,y:u+g.y,data:{...g,placement:d}}}}},sk=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:a,y:i,placement:l}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:f={fn:A=>{let{x:M,y:T}=A;return{x:M,y:T}}},...g}=Ir(e,t),y={x:a,y:i},x=await ec(t,g),v=cr(Lr(l)),w=pg(v);let _=y[w],R=y[v];if(u){const A=w==="y"?"top":"left",M=w==="y"?"bottom":"right",T=_+x[A],N=_-x[M];_=Om(T,_,N)}if(d){const A=v==="y"?"top":"left",M=v==="y"?"bottom":"right",T=R+x[A],N=R-x[M];R=Om(T,R,N)}const S=f.fn({...t,[w]:_,[v]:R});return{...S,data:{x:S.x-a,y:S.y-i,enabled:{[w]:u,[v]:d}}}}}},lk=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:a,y:i,placement:l,rects:u,middlewareData:d}=t,{offset:f=0,mainAxis:g=!0,crossAxis:y=!0}=Ir(e,t),x={x:a,y:i},v=cr(l),w=pg(v);let _=x[w],R=x[v];const S=Ir(f,t),A=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(g){const N=w==="y"?"height":"width",E=u.reference[w]-u.floating[N]+A.mainAxis,D=u.reference[w]+u.reference[N]-A.mainAxis;_D&&(_=D)}if(y){var M,T;const N=w==="y"?"width":"height",E=a1.has(Lr(l)),D=u.reference[v]-u.floating[N]+(E&&((M=d.offset)==null?void 0:M[v])||0)+(E?0:A.crossAxis),I=u.reference[v]+u.reference[N]+(E?0:((T=d.offset)==null?void 0:T[v])||0)-(E?A.crossAxis:0);RI&&(R=I)}return{[w]:_,[v]:R}}}},ck=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var a,i;const{placement:l,rects:u,platform:d,elements:f}=t,{apply:g=()=>{},...y}=Ir(e,t),x=await ec(t,y),v=Lr(l),w=Ts(l),_=cr(l)==="y",{width:R,height:S}=u.floating;let A,M;v==="top"||v==="bottom"?(A=v,M=w===(await(d.isRTL==null?void 0:d.isRTL(f.floating))?"start":"end")?"left":"right"):(M=v,A=w==="end"?"top":"bottom");const T=S-x.top-x.bottom,N=R-x.left-x.right,E=yi(S-x[A],T),D=yi(R-x[M],N),I=!t.middlewareData.shift;let U=E,F=D;if((a=t.middlewareData.shift)!=null&&a.enabled.x&&(F=N),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(U=T),I&&!w){const ge=sa(x.left,0),he=sa(x.right,0),ne=sa(x.top,0),le=sa(x.bottom,0);_?F=R-2*(ge!==0||he!==0?ge+he:sa(x.left,x.right)):U=S-2*(ne!==0||le!==0?ne+le:sa(x.top,x.bottom))}await g({...t,availableWidth:F,availableHeight:U});const fe=await d.getDimensions(f.floating);return R!==fe.width||S!==fe.height?{reset:{rects:!0}}:{}}}};function Gd(){return typeof window<"u"}function Ds(e){return r1(e)?(e.nodeName||"").toLowerCase():"#document"}function ua(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mr(e){var t;return(t=(r1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function r1(e){return Gd()?e instanceof Node||e instanceof ua(e).Node:!1}function Ga(e){return Gd()?e instanceof Element||e instanceof ua(e).Element:!1}function fr(e){return Gd()?e instanceof HTMLElement||e instanceof ua(e).HTMLElement:!1}function Fw(e){return!Gd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ua(e).ShadowRoot}const uk=new Set(["inline","contents"]);function cc(e){const{overflow:t,overflowX:a,overflowY:i,display:l}=Ha(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+a)&&!uk.has(l)}const dk=new Set(["table","td","th"]);function fk(e){return dk.has(Ds(e))}const hk=[":popover-open",":modal"];function Hd(e){return hk.some(t=>{try{return e.matches(t)}catch{return!1}})}const pk=["transform","translate","scale","rotate","perspective"],mk=["transform","translate","scale","rotate","perspective","filter"],gk=["paint","layout","strict","content"];function yg(e){const t=vg(),a=Ga(e)?Ha(e):e;return pk.some(i=>a[i]?a[i]!=="none":!1)||(a.containerType?a.containerType!=="normal":!1)||!t&&(a.backdropFilter?a.backdropFilter!=="none":!1)||!t&&(a.filter?a.filter!=="none":!1)||mk.some(i=>(a.willChange||"").includes(i))||gk.some(i=>(a.contain||"").includes(i))}function yk(e){let t=vi(e);for(;fr(t)&&!Ss(t);){if(yg(t))return t;if(Hd(t))return null;t=vi(t)}return null}function vg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const vk=new Set(["html","body","#document"]);function Ss(e){return vk.has(Ds(e))}function Ha(e){return ua(e).getComputedStyle(e)}function Xd(e){return Ga(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function vi(e){if(Ds(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Fw(e)&&e.host||mr(e);return Fw(t)?t.host:t}function i1(e){const t=vi(e);return Ss(t)?e.ownerDocument?e.ownerDocument.body:e.body:fr(t)&&cc(t)?t:i1(t)}function tc(e,t,a){var i;t===void 0&&(t=[]),a===void 0&&(a=!0);const l=i1(e),u=l===((i=e.ownerDocument)==null?void 0:i.body),d=ua(l);if(u){const f=Tm(d);return t.concat(d,d.visualViewport||[],cc(l)?l:[],f&&a?tc(f):[])}return t.concat(l,tc(l,[],a))}function Tm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function o1(e){const t=Ha(e);let a=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const l=fr(e),u=l?e.offsetWidth:a,d=l?e.offsetHeight:i,f=bd(a)!==u||bd(i)!==d;return f&&(a=u,i=d),{width:a,height:i,$:f}}function xg(e){return Ga(e)?e:e.contextElement}function vs(e){const t=xg(e);if(!fr(t))return ur(1);const a=t.getBoundingClientRect(),{width:i,height:l,$:u}=o1(t);let d=(u?bd(a.width):a.width)/i,f=(u?bd(a.height):a.height)/l;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const xk=ur(0);function s1(e){const t=ua(e);return!vg()||!t.visualViewport?xk:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bk(e,t,a){return t===void 0&&(t=!1),!a||t&&a!==ua(e)?!1:t}function to(e,t,a,i){t===void 0&&(t=!1),a===void 0&&(a=!1);const l=e.getBoundingClientRect(),u=xg(e);let d=ur(1);t&&(i?Ga(i)&&(d=vs(i)):d=vs(e));const f=bk(u,a,i)?s1(u):ur(0);let g=(l.left+f.x)/d.x,y=(l.top+f.y)/d.y,x=l.width/d.x,v=l.height/d.y;if(u){const w=ua(u),_=i&&Ga(i)?ua(i):i;let R=w,S=Tm(R);for(;S&&i&&_!==R;){const A=vs(S),M=S.getBoundingClientRect(),T=Ha(S),N=M.left+(S.clientLeft+parseFloat(T.paddingLeft))*A.x,E=M.top+(S.clientTop+parseFloat(T.paddingTop))*A.y;g*=A.x,y*=A.y,x*=A.x,v*=A.y,g+=N,y+=E,R=ua(S),S=Tm(R)}}return Sd({width:x,height:v,x:g,y})}function Zd(e,t){const a=Xd(e).scrollLeft;return t?t.left+a:to(mr(e)).left+a}function l1(e,t){const a=e.getBoundingClientRect(),i=a.left+t.scrollLeft-Zd(e,a),l=a.top+t.scrollTop;return{x:i,y:l}}function wk(e){let{elements:t,rect:a,offsetParent:i,strategy:l}=e;const u=l==="fixed",d=mr(i),f=t?Hd(t.floating):!1;if(i===d||f&&u)return a;let g={scrollLeft:0,scrollTop:0},y=ur(1);const x=ur(0),v=fr(i);if((v||!v&&!u)&&((Ds(i)!=="body"||cc(d))&&(g=Xd(i)),fr(i))){const _=to(i);y=vs(i),x.x=_.x+i.clientLeft,x.y=_.y+i.clientTop}const w=d&&!v&&!u?l1(d,g):ur(0);return{width:a.width*y.x,height:a.height*y.y,x:a.x*y.x-g.scrollLeft*y.x+x.x+w.x,y:a.y*y.y-g.scrollTop*y.y+x.y+w.y}}function Sk(e){return Array.from(e.getClientRects())}function _k(e){const t=mr(e),a=Xd(e),i=e.ownerDocument.body,l=sa(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),u=sa(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let d=-a.scrollLeft+Zd(e);const f=-a.scrollTop;return Ha(i).direction==="rtl"&&(d+=sa(t.clientWidth,i.clientWidth)-l),{width:l,height:u,x:d,y:f}}const $w=25;function jk(e,t){const a=ua(e),i=mr(e),l=a.visualViewport;let u=i.clientWidth,d=i.clientHeight,f=0,g=0;if(l){u=l.width,d=l.height;const x=vg();(!x||x&&t==="fixed")&&(f=l.offsetLeft,g=l.offsetTop)}const y=Zd(i);if(y<=0){const x=i.ownerDocument,v=x.body,w=getComputedStyle(v),_=x.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,R=Math.abs(i.clientWidth-v.clientWidth-_);R<=$w&&(u-=R)}else y<=$w&&(u+=y);return{width:u,height:d,x:f,y:g}}const Ck=new Set(["absolute","fixed"]);function Ek(e,t){const a=to(e,!0,t==="fixed"),i=a.top+e.clientTop,l=a.left+e.clientLeft,u=fr(e)?vs(e):ur(1),d=e.clientWidth*u.x,f=e.clientHeight*u.y,g=l*u.x,y=i*u.y;return{width:d,height:f,x:g,y}}function Vw(e,t,a){let i;if(t==="viewport")i=jk(e,a);else if(t==="document")i=_k(mr(e));else if(Ga(t))i=Ek(t,a);else{const l=s1(e);i={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return Sd(i)}function c1(e,t){const a=vi(e);return a===t||!Ga(a)||Ss(a)?!1:Ha(a).position==="fixed"||c1(a,t)}function Rk(e,t){const a=t.get(e);if(a)return a;let i=tc(e,[],!1).filter(f=>Ga(f)&&Ds(f)!=="body"),l=null;const u=Ha(e).position==="fixed";let d=u?vi(e):e;for(;Ga(d)&&!Ss(d);){const f=Ha(d),g=yg(d);!g&&f.position==="fixed"&&(l=null),(u?!g&&!l:!g&&f.position==="static"&&!!l&&Ck.has(l.position)||cc(d)&&!g&&c1(e,d))?i=i.filter(x=>x!==d):l=f,d=vi(d)}return t.set(e,i),i}function Nk(e){let{element:t,boundary:a,rootBoundary:i,strategy:l}=e;const d=[...a==="clippingAncestors"?Hd(t)?[]:Rk(t,this._c):[].concat(a),i],f=d[0],g=d.reduce((y,x)=>{const v=Vw(t,x,l);return y.top=sa(v.top,y.top),y.right=yi(v.right,y.right),y.bottom=yi(v.bottom,y.bottom),y.left=sa(v.left,y.left),y},Vw(t,f,l));return{width:g.right-g.left,height:g.bottom-g.top,x:g.left,y:g.top}}function Ok(e){const{width:t,height:a}=o1(e);return{width:t,height:a}}function Ak(e,t,a){const i=fr(t),l=mr(t),u=a==="fixed",d=to(e,!0,u,t);let f={scrollLeft:0,scrollTop:0};const g=ur(0);function y(){g.x=Zd(l)}if(i||!i&&!u)if((Ds(t)!=="body"||cc(l))&&(f=Xd(t)),i){const _=to(t,!0,u,t);g.x=_.x+t.clientLeft,g.y=_.y+t.clientTop}else l&&y();u&&!i&&l&&y();const x=l&&!i&&!u?l1(l,f):ur(0),v=d.left+f.scrollLeft-g.x-x.x,w=d.top+f.scrollTop-g.y-x.y;return{x:v,y:w,width:d.width,height:d.height}}function Gp(e){return Ha(e).position==="static"}function Bw(e,t){if(!fr(e)||Ha(e).position==="fixed")return null;if(t)return t(e);let a=e.offsetParent;return mr(e)===a&&(a=a.ownerDocument.body),a}function u1(e,t){const a=ua(e);if(Hd(e))return a;if(!fr(e)){let l=vi(e);for(;l&&!Ss(l);){if(Ga(l)&&!Gp(l))return l;l=vi(l)}return a}let i=Bw(e,t);for(;i&&fk(i)&&Gp(i);)i=Bw(i,t);return i&&Ss(i)&&Gp(i)&&!yg(i)?a:i||yk(e)||a}const Tk=async function(e){const t=this.getOffsetParent||u1,a=this.getDimensions,i=await a(e.floating);return{reference:Ak(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Dk(e){return Ha(e).direction==="rtl"}const Mk={convertOffsetParentRelativeRectToViewportRelativeRect:wk,getDocumentElement:mr,getClippingRect:Nk,getOffsetParent:u1,getElementRects:Tk,getClientRects:Sk,getDimensions:Ok,getScale:vs,isElement:Ga,isRTL:Dk};function d1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kk(e,t){let a=null,i;const l=mr(e);function u(){var f;clearTimeout(i),(f=a)==null||f.disconnect(),a=null}function d(f,g){f===void 0&&(f=!1),g===void 0&&(g=1),u();const y=e.getBoundingClientRect(),{left:x,top:v,width:w,height:_}=y;if(f||t(),!w||!_)return;const R=Bu(v),S=Bu(l.clientWidth-(x+w)),A=Bu(l.clientHeight-(v+_)),M=Bu(x),N={rootMargin:-R+"px "+-S+"px "+-A+"px "+-M+"px",threshold:sa(0,yi(1,g))||1};let E=!0;function D(I){const U=I[0].intersectionRatio;if(U!==g){if(!E)return d();U?d(!1,U):i=setTimeout(()=>{d(!1,1e-7)},1e3)}U===1&&!d1(y,e.getBoundingClientRect())&&d(),E=!1}try{a=new IntersectionObserver(D,{...N,root:l.ownerDocument})}catch{a=new IntersectionObserver(D,N)}a.observe(e)}return d(!0),u}function zk(e,t,a,i){i===void 0&&(i={});const{ancestorScroll:l=!0,ancestorResize:u=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:g=!1}=i,y=xg(e),x=l||u?[...y?tc(y):[],...tc(t)]:[];x.forEach(M=>{l&&M.addEventListener("scroll",a,{passive:!0}),u&&M.addEventListener("resize",a)});const v=y&&f?kk(y,a):null;let w=-1,_=null;d&&(_=new ResizeObserver(M=>{let[T]=M;T&&T.target===y&&_&&(_.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var N;(N=_)==null||N.observe(t)})),a()}),y&&!g&&_.observe(y),_.observe(t));let R,S=g?to(e):null;g&&A();function A(){const M=to(e);S&&!d1(S,M)&&a(),S=M,R=requestAnimationFrame(A)}return a(),()=>{var M;x.forEach(T=>{l&&T.removeEventListener("scroll",a),u&&T.removeEventListener("resize",a)}),v?.(),(M=_)==null||M.disconnect(),_=null,g&&cancelAnimationFrame(R)}}const Pk=ok,Kk=sk,Ik=ak,Lk=ck,Uk=rk,Gw=nk,qk=lk,Fk=(e,t,a)=>{const i=new Map,l={platform:Mk,...a},u={...l.platform,_c:i};return tk(e,t,{...l,platform:u})};var $k=typeof document<"u",Vk=function(){},ud=$k?m.useLayoutEffect:Vk;function _d(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 a,i,l;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(i=a;i--!==0;)if(!_d(e[i],t[i]))return!1;return!0}if(l=Object.keys(e),a=l.length,a!==Object.keys(t).length)return!1;for(i=a;i--!==0;)if(!{}.hasOwnProperty.call(t,l[i]))return!1;for(i=a;i--!==0;){const u=l[i];if(!(u==="_owner"&&e.$$typeof)&&!_d(e[u],t[u]))return!1}return!0}return e!==e&&t!==t}function f1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Hw(e,t){const a=f1(e);return Math.round(t*a)/a}function Hp(e){const t=m.useRef(e);return ud(()=>{t.current=e}),t}function Bk(e){e===void 0&&(e={});const{placement:t="bottom",strategy:a="absolute",middleware:i=[],platform:l,elements:{reference:u,floating:d}={},transform:f=!0,whileElementsMounted:g,open:y}=e,[x,v]=m.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[w,_]=m.useState(i);_d(w,i)||_(i);const[R,S]=m.useState(null),[A,M]=m.useState(null),T=m.useCallback(z=>{z!==I.current&&(I.current=z,S(z))},[]),N=m.useCallback(z=>{z!==U.current&&(U.current=z,M(z))},[]),E=u||R,D=d||A,I=m.useRef(null),U=m.useRef(null),F=m.useRef(x),fe=g!=null,ge=Hp(g),he=Hp(l),ne=Hp(y),le=m.useCallback(()=>{if(!I.current||!U.current)return;const z={placement:t,strategy:a,middleware:w};he.current&&(z.platform=he.current),Fk(I.current,U.current,z).then(J=>{const me={...J,isPositioned:ne.current!==!1};ce.current&&!_d(F.current,me)&&(F.current=me,$d.flushSync(()=>{v(me)}))})},[w,t,a,he,ne]);ud(()=>{y===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,v(z=>({...z,isPositioned:!1})))},[y]);const ce=m.useRef(!1);ud(()=>(ce.current=!0,()=>{ce.current=!1}),[]),ud(()=>{if(E&&(I.current=E),D&&(U.current=D),E&&D){if(ge.current)return ge.current(E,D,le);le()}},[E,D,le,ge,fe]);const ve=m.useMemo(()=>({reference:I,floating:U,setReference:T,setFloating:N}),[T,N]),O=m.useMemo(()=>({reference:E,floating:D}),[E,D]),j=m.useMemo(()=>{const z={position:a,left:0,top:0};if(!O.floating)return z;const J=Hw(O.floating,x.x),me=Hw(O.floating,x.y);return f?{...z,transform:"translate("+J+"px, "+me+"px)",...f1(O.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:J,top:me}},[a,f,O.floating,x.x,x.y]);return m.useMemo(()=>({...x,update:le,refs:ve,elements:O,floatingStyles:j}),[x,le,ve,O,j])}const Gk=e=>{function t(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:e,fn(a){const{element:i,padding:l}=typeof e=="function"?e(a):e;return i&&t(i)?i.current!=null?Gw({element:i.current,padding:l}).fn(a):{}:i?Gw({element:i,padding:l}).fn(a):{}}}},Hk=(e,t)=>({...Pk(e),options:[e,t]}),Xk=(e,t)=>({...Kk(e),options:[e,t]}),Zk=(e,t)=>({...qk(e),options:[e,t]}),Yk=(e,t)=>({...Ik(e),options:[e,t]}),Qk=(e,t)=>({...Lk(e),options:[e,t]}),Jk=(e,t)=>({...Uk(e),options:[e,t]}),Wk=(e,t)=>({...Gk(e),options:[e,t]});var ez="Arrow",h1=m.forwardRef((e,t)=>{const{children:a,width:i=10,height:l=5,...u}=e;return o.jsx(at.svg,{...u,ref:t,width:i,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?a:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});h1.displayName=ez;var tz=h1;function p1(e){const[t,a]=m.useState(void 0);return hn(()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const u=l[0];let d,f;if("borderBoxSize"in u){const g=u.borderBoxSize,y=Array.isArray(g)?g[0]:g;d=y.inlineSize,f=y.blockSize}else d=e.offsetWidth,f=e.offsetHeight;a({width:d,height:f})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else a(void 0)},[e]),t}var bg="Popper",[m1,_i]=Za(bg),[nz,g1]=m1(bg),y1=e=>{const{__scopePopper:t,children:a}=e,[i,l]=m.useState(null);return o.jsx(nz,{scope:t,anchor:i,onAnchorChange:l,children:a})};y1.displayName=bg;var v1="PopperAnchor",x1=m.forwardRef((e,t)=>{const{__scopePopper:a,virtualRef:i,...l}=e,u=g1(v1,a),d=m.useRef(null),f=dt(t,d),g=m.useRef(null);return m.useEffect(()=>{const y=g.current;g.current=i?.current||d.current,y!==g.current&&u.onAnchorChange(g.current)}),i?null:o.jsx(at.div,{...l,ref:f})});x1.displayName=v1;var wg="PopperContent",[az,rz]=m1(wg),b1=m.forwardRef((e,t)=>{const{__scopePopper:a,side:i="bottom",sideOffset:l=0,align:u="center",alignOffset:d=0,arrowPadding:f=0,avoidCollisions:g=!0,collisionBoundary:y=[],collisionPadding:x=0,sticky:v="partial",hideWhenDetached:w=!1,updatePositionStrategy:_="optimized",onPlaced:R,...S}=e,A=g1(wg,a),[M,T]=m.useState(null),N=dt(t,ee=>T(ee)),[E,D]=m.useState(null),I=p1(E),U=I?.width??0,F=I?.height??0,fe=i+(u!=="center"?"-"+u:""),ge=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},he=Array.isArray(y)?y:[y],ne=he.length>0,le={padding:ge,boundary:he.filter(oz),altBoundary:ne},{refs:ce,floatingStyles:ve,placement:O,isPositioned:j,middlewareData:z}=Bk({strategy:"fixed",placement:fe,whileElementsMounted:(...ee)=>zk(...ee,{animationFrame:_==="always"}),elements:{reference:A.anchor},middleware:[Hk({mainAxis:l+F,alignmentAxis:d}),g&&Xk({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?Zk():void 0,...le}),g&&Yk({...le}),Qk({...le,apply:({elements:ee,rects:Se,availableWidth:De,availableHeight:He})=>{const{width:Qe,height:Ye}=Se.reference,Ft=ee.floating.style;Ft.setProperty("--radix-popper-available-width",`${De}px`),Ft.setProperty("--radix-popper-available-height",`${He}px`),Ft.setProperty("--radix-popper-anchor-width",`${Qe}px`),Ft.setProperty("--radix-popper-anchor-height",`${Ye}px`)}}),E&&Wk({element:E,padding:f}),sz({arrowWidth:U,arrowHeight:F}),w&&Jk({strategy:"referenceHidden",...le})]}),[J,me]=_1(O),Te=Ba(R);hn(()=>{j&&Te?.()},[j,Te]);const H=z.arrow?.x,Y=z.arrow?.y,oe=z.arrow?.centerOffset!==0,[se,we]=m.useState();return hn(()=>{M&&we(window.getComputedStyle(M).zIndex)},[M]),o.jsx("div",{ref:ce.setFloating,"data-radix-popper-content-wrapper":"",style:{...ve,transform:j?ve.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(az,{scope:a,placedSide:J,onArrowChange:D,arrowX:H,arrowY:Y,shouldHideArrow:oe,children:o.jsx(at.div,{"data-side":J,"data-align":me,...S,ref:N,style:{...S.style,animation:j?void 0:"none"}})})})});b1.displayName=wg;var w1="PopperArrow",iz={top:"bottom",right:"left",bottom:"top",left:"right"},S1=m.forwardRef(function(t,a){const{__scopePopper:i,...l}=t,u=rz(w1,i),d=iz[u.placedSide];return o.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[d]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:o.jsx(tz,{...l,ref:a,style:{...l.style,display:"block"}})})});S1.displayName=w1;function oz(e){return e!==null}var sz=e=>({name:"transformOrigin",options:e,fn(t){const{placement:a,rects:i,middlewareData:l}=t,d=l.arrow?.centerOffset!==0,f=d?0:e.arrowWidth,g=d?0:e.arrowHeight,[y,x]=_1(a),v={start:"0%",center:"50%",end:"100%"}[x],w=(l.arrow?.x??0)+f/2,_=(l.arrow?.y??0)+g/2;let R="",S="";return y==="bottom"?(R=d?v:`${w}px`,S=`${-g}px`):y==="top"?(R=d?v:`${w}px`,S=`${i.floating.height+g}px`):y==="right"?(R=`${-g}px`,S=d?v:`${_}px`):y==="left"&&(R=`${i.floating.width+g}px`,S=d?v:`${_}px`),{data:{x:R,y:S}}}});function _1(e){const[t,a="center"]=e.split("-");return[t,a]}var Yd=y1,uc=x1,Qd=b1,Jd=S1,lz="Portal",Ms=m.forwardRef((e,t)=>{const{container:a,...i}=e,[l,u]=m.useState(!1);hn(()=>u(!0),[]);const d=a||l&&globalThis?.document?.body;return d?uS.createPortal(o.jsx(at.div,{...i,ref:t}),d):null});Ms.displayName=lz;function cz(e,t){return m.useReducer((a,i)=>t[a][i]??a,e)}var Oa=e=>{const{present:t,children:a}=e,i=uz(t),l=typeof a=="function"?a({present:i.isPresent}):m.Children.only(a),u=dt(i.ref,dz(l));return typeof a=="function"||i.isPresent?m.cloneElement(l,{ref:u}):null};Oa.displayName="Presence";function uz(e){const[t,a]=m.useState(),i=m.useRef(null),l=m.useRef(e),u=m.useRef("none"),d=e?"mounted":"unmounted",[f,g]=cz(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const y=Gu(i.current);u.current=f==="mounted"?y:"none"},[f]),hn(()=>{const y=i.current,x=l.current;if(x!==e){const w=u.current,_=Gu(y);e?g("MOUNT"):_==="none"||y?.display==="none"?g("UNMOUNT"):g(x&&w!==_?"ANIMATION_OUT":"UNMOUNT"),l.current=e}},[e,g]),hn(()=>{if(t){let y;const x=t.ownerDocument.defaultView??window,v=_=>{const S=Gu(i.current).includes(CSS.escape(_.animationName));if(_.target===t&&S&&(g("ANIMATION_END"),!l.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",y=x.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},w=_=>{_.target===t&&(u.current=Gu(i.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{x.clearTimeout(y),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else g("ANIMATION_END")},[t,g]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:m.useCallback(y=>{i.current=y?getComputedStyle(y):null,a(y)},[])}}function Gu(e){return e?.animationName||"none"}function dz(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning;return a?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var fz=Symbol("radix.slottable");function hz(e){const t=({children:a})=>o.jsx(o.Fragment,{children:a});return t.displayName=`${e}.Slottable`,t.__radixId=fz,t}var pz=eg[" useInsertionEffect ".trim().toString()]||hn;function xi({prop:e,defaultProp:t,onChange:a=()=>{},caller:i}){const[l,u,d]=mz({defaultProp:t,onChange:a}),f=e!==void 0,g=f?e:l;{const x=m.useRef(e!==void 0);m.useEffect(()=>{const v=x.current;v!==f&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=f},[f,i])}const y=m.useCallback(x=>{if(f){const v=gz(x)?x(e):x;v!==e&&d.current?.(v)}else u(x)},[f,e,u,d]);return[g,y]}function mz({defaultProp:e,onChange:t}){const[a,i]=m.useState(e),l=m.useRef(a),u=m.useRef(t);return pz(()=>{u.current=t},[t]),m.useEffect(()=>{l.current!==a&&(u.current?.(a),l.current=a)},[a,l]),[a,i,u]}function gz(e){return typeof e=="function"}var j1=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),yz="VisuallyHidden",C1=m.forwardRef((e,t)=>o.jsx(at.span,{...e,ref:t,style:{...j1,...e.style}}));C1.displayName=yz;var vz=C1,[Wd]=Za("Tooltip",[_i]),ef=_i(),E1="TooltipProvider",xz=700,Dm="tooltip.open",[bz,Sg]=Wd(E1),R1=e=>{const{__scopeTooltip:t,delayDuration:a=xz,skipDelayDuration:i=300,disableHoverableContent:l=!1,children:u}=e,d=m.useRef(!0),f=m.useRef(!1),g=m.useRef(0);return m.useEffect(()=>{const y=g.current;return()=>window.clearTimeout(y)},[]),o.jsx(bz,{scope:t,isOpenDelayedRef:d,delayDuration:a,onOpen:m.useCallback(()=>{window.clearTimeout(g.current),d.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>d.current=!0,i)},[i]),isPointerInTransitRef:f,onPointerInTransitChange:m.useCallback(y=>{f.current=y},[]),disableHoverableContent:l,children:u})};R1.displayName=E1;var nc="Tooltip",[wz,dc]=Wd(nc),N1=e=>{const{__scopeTooltip:t,children:a,open:i,defaultOpen:l,onOpenChange:u,disableHoverableContent:d,delayDuration:f}=e,g=Sg(nc,e.__scopeTooltip),y=ef(t),[x,v]=m.useState(null),w=Cn(),_=m.useRef(0),R=d??g.disableHoverableContent,S=f??g.delayDuration,A=m.useRef(!1),[M,T]=xi({prop:i,defaultProp:l??!1,onChange:U=>{U?(g.onOpen(),document.dispatchEvent(new CustomEvent(Dm))):g.onClose(),u?.(U)},caller:nc}),N=m.useMemo(()=>M?A.current?"delayed-open":"instant-open":"closed",[M]),E=m.useCallback(()=>{window.clearTimeout(_.current),_.current=0,A.current=!1,T(!0)},[T]),D=m.useCallback(()=>{window.clearTimeout(_.current),_.current=0,T(!1)},[T]),I=m.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{A.current=!0,T(!0),_.current=0},S)},[S,T]);return m.useEffect(()=>()=>{_.current&&(window.clearTimeout(_.current),_.current=0)},[]),o.jsx(Yd,{...y,children:o.jsx(wz,{scope:t,contentId:w,open:M,stateAttribute:N,trigger:x,onTriggerChange:v,onTriggerEnter:m.useCallback(()=>{g.isOpenDelayedRef.current?I():E()},[g.isOpenDelayedRef,I,E]),onTriggerLeave:m.useCallback(()=>{R?D():(window.clearTimeout(_.current),_.current=0)},[D,R]),onOpen:E,onClose:D,disableHoverableContent:R,children:a})})};N1.displayName=nc;var Mm="TooltipTrigger",O1=m.forwardRef((e,t)=>{const{__scopeTooltip:a,...i}=e,l=dc(Mm,a),u=Sg(Mm,a),d=ef(a),f=m.useRef(null),g=dt(t,f,l.onTriggerChange),y=m.useRef(!1),x=m.useRef(!1),v=m.useCallback(()=>y.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),o.jsx(uc,{asChild:!0,...d,children:o.jsx(at.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...i,ref:g,onPointerMove:Re(e.onPointerMove,w=>{w.pointerType!=="touch"&&!x.current&&!u.isPointerInTransitRef.current&&(l.onTriggerEnter(),x.current=!0)}),onPointerLeave:Re(e.onPointerLeave,()=>{l.onTriggerLeave(),x.current=!1}),onPointerDown:Re(e.onPointerDown,()=>{l.open&&l.onClose(),y.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Re(e.onFocus,()=>{y.current||l.onOpen()}),onBlur:Re(e.onBlur,l.onClose),onClick:Re(e.onClick,l.onClose)})})});O1.displayName=Mm;var _g="TooltipPortal",[Sz,_z]=Wd(_g,{forceMount:void 0}),A1=e=>{const{__scopeTooltip:t,forceMount:a,children:i,container:l}=e,u=dc(_g,t);return o.jsx(Sz,{scope:t,forceMount:a,children:o.jsx(Oa,{present:a||u.open,children:o.jsx(Ms,{asChild:!0,container:l,children:i})})})};A1.displayName=_g;var _s="TooltipContent",T1=m.forwardRef((e,t)=>{const a=_z(_s,e.__scopeTooltip),{forceMount:i=a.forceMount,side:l="top",...u}=e,d=dc(_s,e.__scopeTooltip);return o.jsx(Oa,{present:i||d.open,children:d.disableHoverableContent?o.jsx(D1,{side:l,...u,ref:t}):o.jsx(jz,{side:l,...u,ref:t})})}),jz=m.forwardRef((e,t)=>{const a=dc(_s,e.__scopeTooltip),i=Sg(_s,e.__scopeTooltip),l=m.useRef(null),u=dt(t,l),[d,f]=m.useState(null),{trigger:g,onClose:y}=a,x=l.current,{onPointerInTransitChange:v}=i,w=m.useCallback(()=>{f(null),v(!1)},[v]),_=m.useCallback((R,S)=>{const A=R.currentTarget,M={x:R.clientX,y:R.clientY},T=Nz(M,A.getBoundingClientRect()),N=Oz(M,T),E=Az(S.getBoundingClientRect()),D=Dz([...N,...E]);f(D),v(!0)},[v]);return m.useEffect(()=>()=>w(),[w]),m.useEffect(()=>{if(g&&x){const R=A=>_(A,x),S=A=>_(A,g);return g.addEventListener("pointerleave",R),x.addEventListener("pointerleave",S),()=>{g.removeEventListener("pointerleave",R),x.removeEventListener("pointerleave",S)}}},[g,x,_,w]),m.useEffect(()=>{if(d){const R=S=>{const A=S.target,M={x:S.clientX,y:S.clientY},T=g?.contains(A)||x?.contains(A),N=!Tz(M,d);T?w():N&&(w(),y())};return document.addEventListener("pointermove",R),()=>document.removeEventListener("pointermove",R)}},[g,x,d,y,w]),o.jsx(D1,{...e,ref:u})}),[Cz,Ez]=Wd(nc,{isInside:!1}),Rz=hz("TooltipContent"),D1=m.forwardRef((e,t)=>{const{__scopeTooltip:a,children:i,"aria-label":l,onEscapeKeyDown:u,onPointerDownOutside:d,...f}=e,g=dc(_s,a),y=ef(a),{onClose:x}=g;return m.useEffect(()=>(document.addEventListener(Dm,x),()=>document.removeEventListener(Dm,x)),[x]),m.useEffect(()=>{if(g.trigger){const v=w=>{w.target?.contains(g.trigger)&&x()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[g.trigger,x]),o.jsx(As,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:v=>v.preventDefault(),onDismiss:x,children:o.jsxs(Qd,{"data-state":g.stateAttribute,...y,...f,ref:t,style:{...f.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(Rz,{children:i}),o.jsx(Cz,{scope:a,isInside:!0,children:o.jsx(vz,{id:g.contentId,role:"tooltip",children:l||i})})]})})});T1.displayName=_s;var M1="TooltipArrow",k1=m.forwardRef((e,t)=>{const{__scopeTooltip:a,...i}=e,l=ef(a);return Ez(M1,a).isInside?null:o.jsx(Jd,{...l,...i,ref:t})});k1.displayName=M1;function Nz(e,t){const a=Math.abs(t.top-e.y),i=Math.abs(t.bottom-e.y),l=Math.abs(t.right-e.x),u=Math.abs(t.left-e.x);switch(Math.min(a,i,l,u)){case u:return"left";case l:return"right";case a:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function Oz(e,t,a=5){const i=[];switch(t){case"top":i.push({x:e.x-a,y:e.y+a},{x:e.x+a,y:e.y+a});break;case"bottom":i.push({x:e.x-a,y:e.y-a},{x:e.x+a,y:e.y-a});break;case"left":i.push({x:e.x+a,y:e.y-a},{x:e.x+a,y:e.y+a});break;case"right":i.push({x:e.x-a,y:e.y-a},{x:e.x-a,y:e.y+a});break}return i}function Az(e){const{top:t,right:a,bottom:i,left:l}=e;return[{x:l,y:t},{x:a,y:t},{x:a,y:i},{x:l,y:i}]}function Tz(e,t){const{x:a,y:i}=e;let l=!1;for(let u=0,d=t.length-1;ui!=w>i&&a<(v-y)*(i-x)/(w-x)+y&&(l=!l)}return l}function Dz(e){const t=e.slice();return t.sort((a,i)=>a.xi.x?1:a.yi.y?1:0),Mz(t)}function Mz(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const u=t[t.length-1],d=t[t.length-2];if((u.x-d.x)*(l.y-d.y)>=(u.y-d.y)*(l.x-d.x))t.pop();else break}t.push(l)}t.pop();const a=[];for(let i=e.length-1;i>=0;i--){const l=e[i];for(;a.length>=2;){const u=a[a.length-1],d=a[a.length-2];if((u.x-d.x)*(l.y-d.y)>=(u.y-d.y)*(l.x-d.x))a.pop();else break}a.push(l)}return a.pop(),t.length===1&&a.length===1&&t[0].x===a[0].x&&t[0].y===a[0].y?t:t.concat(a)}var kz=R1,zz=N1,Pz=O1,Kz=A1,Iz=T1,Lz=k1;function fc({delayDuration:e=0,...t}){return o.jsx(kz,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function jd({...e}){return o.jsx(fc,{children:o.jsx(zz,{"data-slot":"tooltip",...e})})}function Cd({...e}){return o.jsx(Pz,{"data-slot":"tooltip-trigger",...e})}function Ed({className:e,sideOffset:t=0,children:a,...i}){return o.jsx(Kz,{children:o.jsxs(Iz,{"data-slot":"tooltip-content",sideOffset:t,className:de("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...i,children:[a,o.jsx(Lz,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function z1(e){return e&&e!=="none"?e.slice(0,7):"none"}function Uz(e){if(!e||e==="unknown")return"unknown";const t=new Date(e);return isNaN(+t)?e:t.toLocaleString()}function qz(e){return e?`v${e.version} (${z1(e.commit)}) • built ${e.built} • ${e.go} ${e.goOS}/${e.goArch}`:""}const Fz=m.memo(function({className:t}){const a=Zt({queryKey:["footer"],queryFn:()=>SD.footer(),staleTime:6e4,refetchOnWindowFocus:!1}),i=a.data,l=m.useMemo(()=>qz(i),[i]);return o.jsx("footer",{className:"bg-background text-muted-foreground w-full border-t px-3 py-2 text-xs sm:text-sm",children:o.jsxs("div",{className:"mx-auto flex max-w-screen-2xl items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs sm:text-sm",children:[o.jsxs("span",{children:["© ",new Date().getFullYear()," GlueOps"]}),o.jsx(Fl,{orientation:"vertical",className:"hidden h-4 sm:block"}),o.jsx("span",{className:"hidden sm:block",children:"All systems nominal."})]}),o.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs sm:text-sm",children:a.isLoading?o.jsx("span",{className:"animate-pulse",children:"loading version…"}):a.isError?o.jsx("span",{className:"text-destructive",children:"version unavailable"}):i?o.jsx(fc,{children:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ca,{variant:"secondary",className:"font-mono",children:i.version}),o.jsxs(jd,{children:[o.jsx(Cd,{asChild:!0,children:o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx(e2,{className:"h-3.5 w-3.5"}),o.jsx("span",{className:"font-mono",children:z1(i.commit)})]})}),o.jsx(Ed,{side:"top",children:o.jsx("div",{className:"font-mono text-xs",children:i.commit})})]}),o.jsx(Fl,{orientation:"vertical",className:"h-4"}),o.jsxs(jd,{children:[o.jsx(Cd,{asChild:!0,children:o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx(AS,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:i.go})]})}),o.jsx(Ed,{side:"top",children:o.jsxs("div",{className:"font-mono text-xs",children:[i.goOS,"/",i.goArch]})})]}),o.jsx(Fl,{orientation:"vertical",className:"hidden h-4 sm:block"}),o.jsxs("span",{className:"hidden sm:inline",children:["built ",o.jsx("span",{className:"font-mono",children:Uz(i.built)})]}),o.jsx(Fl,{orientation:"vertical",className:"hidden h-4 sm:block"}),o.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{navigator.clipboard?.writeText(l).catch(()=>{})},title:"Copy version details",children:o.jsx(FO,{className:"h-4 w-4"})}),o.jsxs("a",{href:"/api/v1/version",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs underline-offset-4 hover:underline",title:"Open raw version JSON",children:["JSON ",o.jsx(ZO,{className:"h-3.5 w-3.5"})]})]})}):null})]})})});var P1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Xw=Q.createContext&&Q.createContext(P1),$z=["attr","size","title"];function Vz(e,t){if(e==null)return{};var a=Bz(e,t),i,l;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(l=0;l=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(a[i]=e[i])}return a}function Bz(e,t){if(e==null)return{};var a={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(t.indexOf(i)>=0)continue;a[i]=e[i]}return a}function Rd(){return Rd=Object.assign?Object.assign.bind():function(e){for(var t=1;tQ.createElement(t.tag,Nd({key:a},t.attr),K1(t.child)))}function I1(e){return t=>Q.createElement(Zz,Rd({attr:Nd({},e.attr)},t),K1(e.child))}function Zz(e){var t=a=>{var{attr:i,size:l,title:u}=e,d=Vz(e,$z),f=l||a.size||"1em",g;return a.className&&(g=a.className),e.className&&(g=(g?g+" ":"")+e.className),Q.createElement("svg",Rd({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,i,d,{className:g,style:Nd(Nd({color:e.color||a.color},a.style),e.style),height:f,width:f,xmlns:"http://www.w3.org/2000/svg"}),u&&Q.createElement("title",null,u),e.children)};return Xw!==void 0?Q.createElement(Xw.Consumer,null,a=>t(a)):t(P1)}function Yz(e){return I1({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M888 680h-54V540H546v-92h238c8.8 0 16-7.2 16-16V168c0-8.8-7.2-16-16-16H240c-8.8 0-16 7.2-16 16v264c0 8.8 7.2 16 16 16h238v92H190v140h-54c-4.4 0-8 3.6-8 8v176c0 4.4 3.6 8 8 8h176c4.4 0 8-3.6 8-8V688c0-4.4-3.6-8-8-8h-54v-72h220v72h-54c-4.4 0-8 3.6-8 8v176c0 4.4 3.6 8 8 8h176c4.4 0 8-3.6 8-8V688c0-4.4-3.6-8-8-8h-54v-72h220v72h-54c-4.4 0-8 3.6-8 8v176c0 4.4 3.6 8 8 8h176c4.4 0 8-3.6 8-8V688c0-4.4-3.6-8-8-8zM256 805.3c0 1.5-1.2 2.7-2.7 2.7h-58.7c-1.5 0-2.7-1.2-2.7-2.7v-58.7c0-1.5 1.2-2.7 2.7-2.7h58.7c1.5 0 2.7 1.2 2.7 2.7v58.7zm288 0c0 1.5-1.2 2.7-2.7 2.7h-58.7c-1.5 0-2.7-1.2-2.7-2.7v-58.7c0-1.5 1.2-2.7 2.7-2.7h58.7c1.5 0 2.7 1.2 2.7 2.7v58.7zM288 384V216h448v168H288zm544 421.3c0 1.5-1.2 2.7-2.7 2.7h-58.7c-1.5 0-2.7-1.2-2.7-2.7v-58.7c0-1.5 1.2-2.7 2.7-2.7h58.7c1.5 0 2.7 1.2 2.7 2.7v58.7zM360 300a40 40 0 1 0 80 0 40 40 0 1 0-80 0z"},child:[]}]})(e)}function Qz(e){return I1({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",strokeWidth:"2",d:"M3,6 L21,6 L3,6 Z M10,2 L10,4 M14,2 L14,4 M16,12 C18.3736719,13.1826446 20,15.6506255 20,19 L20,23 L4,23 L4,19 C4,15.6457258 5.6310898,13.1754259 8,12 M12,16.5 L12,23 M12,13 C15.3137085,13 18,10.3137085 18,7 C18,3.6862915 15.3137085,1 12,1 C8.6862915,1 6,3.6862915 6,7 C6,10.3137085 8.6862915,13 12,13 Z M8,12 C8,14.209139 9.790861,16 12,16 L12,16 C14.209139,16 16,14.209139 16,12"},child:[]}]})(e)}const Jz=[{to:"/clusters",label:"Clusters",icon:Yz},{to:"/node-pools",label:"Node Pools",icon:NO},{to:"/annotations",label:"Annotations",icon:VO},{to:"/labels",label:"Labels",icon:Vd},{to:"/taints",label:"Taints",icon:x2},{to:"/servers",label:"Servers",icon:TS},{to:"/ssh",label:"SSH Keys",icon:JO},{to:"/credentials",label:"Credentials",icon:s2}],Wz=[{to:"/org/members",label:"Members",icon:DS},{to:"/org/api-keys",label:"Org API Keys",icon:a2},{to:"/org/settings",label:"Org Settings",icon:ES}],e4=[{to:"/me",label:"Profile",icon:j2}],t4=[{to:"/admin/users",label:"Users Admin",icon:DS},{to:"/admin/jobs",label:"Jobs Admin",icon:Qz}];var Yw=1,n4=.9,a4=.8,r4=.17,Xp=.1,Zp=.999,i4=.9999,o4=.99,s4=/[\\\/_+.#"@\[\(\{&]/,l4=/[\\\/_+.#"@\[\(\{&]/g,c4=/[\s-]/,L1=/[\s-]/g;function km(e,t,a,i,l,u,d){if(u===t.length)return l===e.length?Yw:o4;var f=`${l},${u}`;if(d[f]!==void 0)return d[f];for(var g=i.charAt(u),y=a.indexOf(g,l),x=0,v,w,_,R;y>=0;)v=km(e,t,a,i,y+1,u+1,d),v>x&&(y===l?v*=Yw:s4.test(e.charAt(y-1))?(v*=a4,_=e.slice(l,y-1).match(l4),_&&l>0&&(v*=Math.pow(Zp,_.length))):c4.test(e.charAt(y-1))?(v*=n4,R=e.slice(l,y-1).match(L1),R&&l>0&&(v*=Math.pow(Zp,R.length))):(v*=r4,l>0&&(v*=Math.pow(Zp,y-l))),e.charAt(y)!==t.charAt(u)&&(v*=i4)),(vv&&(v=w*Xp)),v>x&&(x=v),y=a.indexOf(g,y+1);return d[f]=x,x}function Qw(e){return e.toLowerCase().replace(L1," ")}function u4(e,t,a){return e=a&&a.length>0?`${e+" "+a.join(" ")}`:e,km(e,t,Qw(e),Qw(t),0,0,{})}var Yp="focusScope.autoFocusOnMount",Qp="focusScope.autoFocusOnUnmount",Jw={bubbles:!1,cancelable:!0},d4="FocusScope",hc=m.forwardRef((e,t)=>{const{loop:a=!1,trapped:i=!1,onMountAutoFocus:l,onUnmountAutoFocus:u,...d}=e,[f,g]=m.useState(null),y=Ba(l),x=Ba(u),v=m.useRef(null),w=dt(t,S=>g(S)),_=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(i){let S=function(N){if(_.paused||!f)return;const E=N.target;f.contains(E)?v.current=E:mi(v.current,{select:!0})},A=function(N){if(_.paused||!f)return;const E=N.relatedTarget;E!==null&&(f.contains(E)||mi(v.current,{select:!0}))},M=function(N){if(document.activeElement===document.body)for(const D of N)D.removedNodes.length>0&&mi(f)};document.addEventListener("focusin",S),document.addEventListener("focusout",A);const T=new MutationObserver(M);return f&&T.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",A),T.disconnect()}}},[i,f,_.paused]),m.useEffect(()=>{if(f){e0.add(_);const S=document.activeElement;if(!f.contains(S)){const M=new CustomEvent(Yp,Jw);f.addEventListener(Yp,y),f.dispatchEvent(M),M.defaultPrevented||(f4(y4(U1(f)),{select:!0}),document.activeElement===S&&mi(f))}return()=>{f.removeEventListener(Yp,y),setTimeout(()=>{const M=new CustomEvent(Qp,Jw);f.addEventListener(Qp,x),f.dispatchEvent(M),M.defaultPrevented||mi(S??document.body,{select:!0}),f.removeEventListener(Qp,x),e0.remove(_)},0)}}},[f,y,x,_]);const R=m.useCallback(S=>{if(!a&&!i||_.paused)return;const A=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,M=document.activeElement;if(A&&M){const T=S.currentTarget,[N,E]=h4(T);N&&E?!S.shiftKey&&M===E?(S.preventDefault(),a&&mi(N,{select:!0})):S.shiftKey&&M===N&&(S.preventDefault(),a&&mi(E,{select:!0})):M===T&&S.preventDefault()}},[a,i,_.paused]);return o.jsx(at.div,{tabIndex:-1,...d,ref:w,onKeyDown:R})});hc.displayName=d4;function f4(e,{select:t=!1}={}){const a=document.activeElement;for(const i of e)if(mi(i,{select:t}),document.activeElement!==a)return}function h4(e){const t=U1(e),a=Ww(t,e),i=Ww(t.reverse(),e);return[a,i]}function U1(e){const t=[],a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const l=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||l?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)t.push(a.currentNode);return t}function Ww(e,t){for(const a of e)if(!p4(a,{upTo:t}))return a}function p4(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function m4(e){return e instanceof HTMLInputElement&&"select"in e}function mi(e,{select:t=!1}={}){if(e&&e.focus){const a=document.activeElement;e.focus({preventScroll:!0}),e!==a&&m4(e)&&t&&e.select()}}var e0=g4();function g4(){let e=[];return{add(t){const a=e[0];t!==a&&a?.pause(),e=t0(e,t),e.unshift(t)},remove(t){e=t0(e,t),e[0]?.resume()}}}function t0(e,t){const a=[...e],i=a.indexOf(t);return i!==-1&&a.splice(i,1),a}function y4(e){return e.filter(t=>t.tagName!=="A")}var Jp=0;function tf(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??n0()),document.body.insertAdjacentElement("beforeend",e[1]??n0()),Jp++,()=>{Jp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Jp--}},[])}function n0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var sr=function(){return sr=Object.assign||function(t){for(var a,i=1,l=arguments.length;i"u")return k4;var t=z4(e),a=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-a+t[2]-t[0])}},K4=V1(),xs="data-scroll-locked",I4=function(e,t,a,i){var l=e.left,u=e.top,d=e.right,f=e.gap;return a===void 0&&(a="margin"),` .`.concat(x4,` { overflow: hidden `).concat(i,`; padding-right: `).concat(f,"px ").concat(i,`; } body[`).concat(xs,`] { overflow: hidden `).concat(i,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(i,";"),a==="margin"&&` padding-left: `.concat(l,`px; padding-top: `).concat(u,`px; padding-right: `).concat(d,`px; margin-left:0; margin-top:0; margin-right: `).concat(f,"px ").concat(i,`; `),a==="padding"&&"padding-right: ".concat(f,"px ").concat(i,";")].filter(Boolean).join(""),` } .`).concat(dd,` { right: `).concat(f,"px ").concat(i,`; } .`).concat(fd,` { margin-right: `).concat(f,"px ").concat(i,`; } .`).concat(dd," .").concat(dd,` { right: 0 `).concat(i,`; } .`).concat(fd," .").concat(fd,` { margin-right: 0 `).concat(i,`; } body[`).concat(xs,`] { `).concat(b4,": ").concat(f,`px; } `)},r0=function(){var e=parseInt(document.body.getAttribute(xs)||"0",10);return isFinite(e)?e:0},L4=function(){m.useEffect(function(){return document.body.setAttribute(xs,(r0()+1).toString()),function(){var e=r0()-1;e<=0?document.body.removeAttribute(xs):document.body.setAttribute(xs,e.toString())}},[])},U4=function(e){var t=e.noRelative,a=e.noImportant,i=e.gapMode,l=i===void 0?"margin":i;L4();var u=m.useMemo(function(){return P4(l)},[l]);return m.createElement(K4,{styles:I4(u,!t,l,a?"":"!important")})},zm=!1;if(typeof window<"u")try{var Hu=Object.defineProperty({},"passive",{get:function(){return zm=!0,!0}});window.addEventListener("test",Hu,Hu),window.removeEventListener("test",Hu,Hu)}catch{zm=!1}var ts=zm?{passive:!1}:!1,q4=function(e){return e.tagName==="TEXTAREA"},B1=function(e,t){if(!(e instanceof Element))return!1;var a=window.getComputedStyle(e);return a[t]!=="hidden"&&!(a.overflowY===a.overflowX&&!q4(e)&&a[t]==="visible")},F4=function(e){return B1(e,"overflowY")},$4=function(e){return B1(e,"overflowX")},i0=function(e,t){var a=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var l=G1(e,i);if(l){var u=H1(e,i),d=u[1],f=u[2];if(d>f)return!0}i=i.parentNode}while(i&&i!==a.body);return!1},V4=function(e){var t=e.scrollTop,a=e.scrollHeight,i=e.clientHeight;return[t,a,i]},B4=function(e){var t=e.scrollLeft,a=e.scrollWidth,i=e.clientWidth;return[t,a,i]},G1=function(e,t){return e==="v"?F4(t):$4(t)},H1=function(e,t){return e==="v"?V4(t):B4(t)},G4=function(e,t){return e==="h"&&t==="rtl"?-1:1},H4=function(e,t,a,i,l){var u=G4(e,window.getComputedStyle(t).direction),d=u*i,f=a.target,g=t.contains(f),y=!1,x=d>0,v=0,w=0;do{if(!f)break;var _=H1(e,f),R=_[0],S=_[1],A=_[2],M=S-A-u*R;(R||M)&&G1(e,f)&&(v+=M,w+=R);var T=f.parentNode;f=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!g&&f!==document.body||g&&(t.contains(f)||t===f));return(x&&Math.abs(v)<1||!x&&Math.abs(w)<1)&&(y=!0),y},Xu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},o0=function(e){return[e.deltaX,e.deltaY]},s0=function(e){return e&&"current"in e?e.current:e},X4=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Z4=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},Y4=0,ns=[];function Q4(e){var t=m.useRef([]),a=m.useRef([0,0]),i=m.useRef(),l=m.useState(Y4++)[0],u=m.useState(V1)[0],d=m.useRef(e);m.useEffect(function(){d.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(l));var S=v4([e.lockRef.current],(e.shards||[]).map(s0),!0).filter(Boolean);return S.forEach(function(A){return A.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),S.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(l))})}}},[e.inert,e.lockRef.current,e.shards]);var f=m.useCallback(function(S,A){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!d.current.allowPinchZoom;var M=Xu(S),T=a.current,N="deltaX"in S?S.deltaX:T[0]-M[0],E="deltaY"in S?S.deltaY:T[1]-M[1],D,I=S.target,U=Math.abs(N)>Math.abs(E)?"h":"v";if("touches"in S&&U==="h"&&I.type==="range")return!1;var F=i0(U,I);if(!F)return!0;if(F?D=U:(D=U==="v"?"h":"v",F=i0(U,I)),!F)return!1;if(!i.current&&"changedTouches"in S&&(N||E)&&(i.current=D),!D)return!0;var fe=i.current||D;return H4(fe,A,S,fe==="h"?N:E)},[]),g=m.useCallback(function(S){var A=S;if(!(!ns.length||ns[ns.length-1]!==u)){var M="deltaY"in A?o0(A):Xu(A),T=t.current.filter(function(D){return D.name===A.type&&(D.target===A.target||A.target===D.shadowParent)&&X4(D.delta,M)})[0];if(T&&T.should){A.cancelable&&A.preventDefault();return}if(!T){var N=(d.current.shards||[]).map(s0).filter(Boolean).filter(function(D){return D.contains(A.target)}),E=N.length>0?f(A,N[0]):!d.current.noIsolation;E&&A.cancelable&&A.preventDefault()}}},[]),y=m.useCallback(function(S,A,M,T){var N={name:S,delta:A,target:M,should:T,shadowParent:J4(M)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(E){return E!==N})},1)},[]),x=m.useCallback(function(S){a.current=Xu(S),i.current=void 0},[]),v=m.useCallback(function(S){y(S.type,o0(S),S.target,f(S,e.lockRef.current))},[]),w=m.useCallback(function(S){y(S.type,Xu(S),S.target,f(S,e.lockRef.current))},[]);m.useEffect(function(){return ns.push(u),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",g,ts),document.addEventListener("touchmove",g,ts),document.addEventListener("touchstart",x,ts),function(){ns=ns.filter(function(S){return S!==u}),document.removeEventListener("wheel",g,ts),document.removeEventListener("touchmove",g,ts),document.removeEventListener("touchstart",x,ts)}},[]);var _=e.removeScrollBar,R=e.inert;return m.createElement(m.Fragment,null,R?m.createElement(u,{styles:Z4(l)}):null,_?m.createElement(U4,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function J4(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const W4=R4($1,Q4);var pc=m.forwardRef(function(e,t){return m.createElement(nf,sr({},e,{ref:t,sideCar:W4}))});pc.classNames=nf.classNames;var e3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},as=new WeakMap,Zu=new WeakMap,Yu={},nm=0,X1=function(e){return e&&(e.host||X1(e.parentNode))},t3=function(e,t){return t.map(function(a){if(e.contains(a))return a;var i=X1(a);return i&&e.contains(i)?i:(console.error("aria-hidden",a,"in not contained inside",e,". Doing nothing"),null)}).filter(function(a){return!!a})},n3=function(e,t,a,i){var l=t3(t,Array.isArray(e)?e:[e]);Yu[a]||(Yu[a]=new WeakMap);var u=Yu[a],d=[],f=new Set,g=new Set(l),y=function(v){!v||f.has(v)||(f.add(v),y(v.parentNode))};l.forEach(y);var x=function(v){!v||g.has(v)||Array.prototype.forEach.call(v.children,function(w){if(f.has(w))x(w);else try{var _=w.getAttribute(i),R=_!==null&&_!=="false",S=(as.get(w)||0)+1,A=(u.get(w)||0)+1;as.set(w,S),u.set(w,A),d.push(w),S===1&&R&&Zu.set(w,!0),A===1&&w.setAttribute(a,"true"),R||w.setAttribute(i,"true")}catch(M){console.error("aria-hidden: cannot operate on ",w,M)}})};return x(t),f.clear(),nm++,function(){d.forEach(function(v){var w=as.get(v)-1,_=u.get(v)-1;as.set(v,w),u.set(v,_),w||(Zu.has(v)||v.removeAttribute(i),Zu.delete(v)),_||v.removeAttribute(a)}),nm--,nm||(as=new WeakMap,as=new WeakMap,Zu=new WeakMap,Yu={})}},af=function(e,t,a){a===void 0&&(a="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),l=e3(e);return l?(i.push.apply(i,Array.from(l.querySelectorAll("[aria-live], script"))),n3(i,l,a,"aria-hidden")):function(){return null}};function a3(e){const t=r3(e),a=m.forwardRef((i,l)=>{const{children:u,...d}=i,f=m.Children.toArray(u),g=f.find(o3);if(g){const y=g.props.children,x=f.map(v=>v===g?m.Children.count(y)>1?m.Children.only(null):m.isValidElement(y)?y.props.children:null:v);return o.jsx(t,{...d,ref:l,children:m.isValidElement(y)?m.cloneElement(y,void 0,x):null})}return o.jsx(t,{...d,ref:l,children:u})});return a.displayName=`${e}.Slot`,a}function r3(e){const t=m.forwardRef((a,i)=>{const{children:l,...u}=a;if(m.isValidElement(l)){const d=l3(l),f=s3(u,l.props);return l.type!==m.Fragment&&(f.ref=i?Mn(i,d):d),m.cloneElement(l,f)}return m.Children.count(l)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var i3=Symbol("radix.slottable");function o3(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===i3}function s3(e,t){const a={...t};for(const i in t){const l=e[i],u=t[i];/^on[A-Z]/.test(i)?l&&u?a[i]=(...f)=>{const g=u(...f);return l(...f),g}:l&&(a[i]=l):i==="style"?a[i]={...l,...u}:i==="className"&&(a[i]=[l,u].filter(Boolean).join(" "))}return{...e,...a}}function l3(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning;return a?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var rf="Dialog",[Z1,Y1]=Za(rf),[c3,Ya]=Z1(rf),Q1=e=>{const{__scopeDialog:t,children:a,open:i,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,f=m.useRef(null),g=m.useRef(null),[y,x]=xi({prop:i,defaultProp:l??!1,onChange:u,caller:rf});return o.jsx(c3,{scope:t,triggerRef:f,contentRef:g,contentId:Cn(),titleId:Cn(),descriptionId:Cn(),open:y,onOpenChange:x,onOpenToggle:m.useCallback(()=>x(v=>!v),[x]),modal:d,children:a})};Q1.displayName=rf;var J1="DialogTrigger",W1=m.forwardRef((e,t)=>{const{__scopeDialog:a,...i}=e,l=Ya(J1,a),u=dt(t,l.triggerRef);return o.jsx(at.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":Eg(l.open),...i,ref:u,onClick:Re(e.onClick,l.onOpenToggle)})});W1.displayName=J1;var jg="DialogPortal",[u3,e_]=Z1(jg,{forceMount:void 0}),t_=e=>{const{__scopeDialog:t,forceMount:a,children:i,container:l}=e,u=Ya(jg,t);return o.jsx(u3,{scope:t,forceMount:a,children:m.Children.map(i,d=>o.jsx(Oa,{present:a||u.open,children:o.jsx(Ms,{asChild:!0,container:l,children:d})}))})};t_.displayName=jg;var Od="DialogOverlay",n_=m.forwardRef((e,t)=>{const a=e_(Od,e.__scopeDialog),{forceMount:i=a.forceMount,...l}=e,u=Ya(Od,e.__scopeDialog);return u.modal?o.jsx(Oa,{present:i||u.open,children:o.jsx(f3,{...l,ref:t})}):null});n_.displayName=Od;var d3=a3("DialogOverlay.RemoveScroll"),f3=m.forwardRef((e,t)=>{const{__scopeDialog:a,...i}=e,l=Ya(Od,a);return o.jsx(pc,{as:d3,allowPinchZoom:!0,shards:[l.contentRef],children:o.jsx(at.div,{"data-state":Eg(l.open),...i,ref:t,style:{pointerEvents:"auto",...i.style}})})}),no="DialogContent",a_=m.forwardRef((e,t)=>{const a=e_(no,e.__scopeDialog),{forceMount:i=a.forceMount,...l}=e,u=Ya(no,e.__scopeDialog);return o.jsx(Oa,{present:i||u.open,children:u.modal?o.jsx(h3,{...l,ref:t}):o.jsx(p3,{...l,ref:t})})});a_.displayName=no;var h3=m.forwardRef((e,t)=>{const a=Ya(no,e.__scopeDialog),i=m.useRef(null),l=dt(t,a.contentRef,i);return m.useEffect(()=>{const u=i.current;if(u)return af(u)},[]),o.jsx(r_,{...e,ref:l,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Re(e.onCloseAutoFocus,u=>{u.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:Re(e.onPointerDownOutside,u=>{const d=u.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0;(d.button===2||f)&&u.preventDefault()}),onFocusOutside:Re(e.onFocusOutside,u=>u.preventDefault())})}),p3=m.forwardRef((e,t)=>{const a=Ya(no,e.__scopeDialog),i=m.useRef(!1),l=m.useRef(!1);return o.jsx(r_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{e.onCloseAutoFocus?.(u),u.defaultPrevented||(i.current||a.triggerRef.current?.focus(),u.preventDefault()),i.current=!1,l.current=!1},onInteractOutside:u=>{e.onInteractOutside?.(u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const d=u.target;a.triggerRef.current?.contains(d)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&l.current&&u.preventDefault()}})}),r_=m.forwardRef((e,t)=>{const{__scopeDialog:a,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:u,...d}=e,f=Ya(no,a),g=m.useRef(null),y=dt(t,g);return tf(),o.jsxs(o.Fragment,{children:[o.jsx(hc,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:l,onUnmountAutoFocus:u,children:o.jsx(As,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Eg(f.open),...d,ref:y,onDismiss:()=>f.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(g3,{titleId:f.titleId}),o.jsx(v3,{contentRef:g,descriptionId:f.descriptionId})]})]})}),Cg="DialogTitle",i_=m.forwardRef((e,t)=>{const{__scopeDialog:a,...i}=e,l=Ya(Cg,a);return o.jsx(at.h2,{id:l.titleId,...i,ref:t})});i_.displayName=Cg;var o_="DialogDescription",s_=m.forwardRef((e,t)=>{const{__scopeDialog:a,...i}=e,l=Ya(o_,a);return o.jsx(at.p,{id:l.descriptionId,...i,ref:t})});s_.displayName=o_;var l_="DialogClose",c_=m.forwardRef((e,t)=>{const{__scopeDialog:a,...i}=e,l=Ya(l_,a);return o.jsx(at.button,{type:"button",...i,ref:t,onClick:Re(e.onClick,()=>l.onOpenChange(!1))})});c_.displayName=l_;function Eg(e){return e?"open":"closed"}var u_="DialogTitleWarning",[m3,d_]=CM(u_,{contentName:no,titleName:Cg,docsSlug:"dialog"}),g3=({titleId:e})=>{const t=d_(u_),a=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(a))},[a,e]),null},y3="DialogDescriptionWarning",v3=({contentRef:e,descriptionId:t})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${d_(y3).contentName}}.`;return m.useEffect(()=>{const l=e.current?.getAttribute("aria-describedby");t&&l&&(document.getElementById(t)||console.warn(i))},[i,e,t]),null},of=Q1,f_=W1,sf=t_,lf=n_,cf=a_,Rg=i_,Ng=s_,mc=c_,x3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ji=x3.reduce((e,t)=>{const a=lc(`Primitive.${t}`),i=m.forwardRef((l,u)=>{const{asChild:d,...f}=l,g=d?a:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(g,{...f,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),Ol='[cmdk-group=""]',am='[cmdk-group-items=""]',b3='[cmdk-group-heading=""]',h_='[cmdk-item=""]',l0=`${h_}:not([aria-disabled="true"])`,Pm="cmdk-item-select",ss="data-value",w3=(e,t,a)=>u4(e,t,a),p_=m.createContext(void 0),gc=()=>m.useContext(p_),m_=m.createContext(void 0),Og=()=>m.useContext(m_),g_=m.createContext(void 0),y_=m.forwardRef((e,t)=>{let a=ls(()=>{var H,Y;return{search:"",value:(Y=(H=e.value)!=null?H:e.defaultValue)!=null?Y:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=ls(()=>new Set),l=ls(()=>new Map),u=ls(()=>new Map),d=ls(()=>new Set),f=v_(e),{label:g,children:y,value:x,onValueChange:v,filter:w,shouldFilter:_,loop:R,disablePointerSelection:S=!1,vimBindings:A=!0,...M}=e,T=Cn(),N=Cn(),E=Cn(),D=m.useRef(null),I=D3();ao(()=>{if(x!==void 0){let H=x.trim();a.current.value=H,U.emit()}},[x]),ao(()=>{I(6,le)},[]);let U=m.useMemo(()=>({subscribe:H=>(d.current.add(H),()=>d.current.delete(H)),snapshot:()=>a.current,setState:(H,Y,oe)=>{var se,we,ee,Se;if(!Object.is(a.current[H],Y)){if(a.current[H]=Y,H==="search")ne(),ge(),I(1,he);else if(H==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let De=document.getElementById(E);De?De.focus():(se=document.getElementById(T))==null||se.focus()}if(I(7,()=>{var De;a.current.selectedItemId=(De=ce())==null?void 0:De.id,U.emit()}),oe||I(5,le),((we=f.current)==null?void 0:we.value)!==void 0){let De=Y??"";(Se=(ee=f.current).onValueChange)==null||Se.call(ee,De);return}}U.emit()}},emit:()=>{d.current.forEach(H=>H())}}),[]),F=m.useMemo(()=>({value:(H,Y,oe)=>{var se;Y!==((se=u.current.get(H))==null?void 0:se.value)&&(u.current.set(H,{value:Y,keywords:oe}),a.current.filtered.items.set(H,fe(Y,oe)),I(2,()=>{ge(),U.emit()}))},item:(H,Y)=>(i.current.add(H),Y&&(l.current.has(Y)?l.current.get(Y).add(H):l.current.set(Y,new Set([H]))),I(3,()=>{ne(),ge(),a.current.value||he(),U.emit()}),()=>{u.current.delete(H),i.current.delete(H),a.current.filtered.items.delete(H);let oe=ce();I(4,()=>{ne(),oe?.getAttribute("id")===H&&he(),U.emit()})}),group:H=>(l.current.has(H)||l.current.set(H,new Set),()=>{u.current.delete(H),l.current.delete(H)}),filter:()=>f.current.shouldFilter,label:g||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:T,inputId:E,labelId:N,listInnerRef:D}),[]);function fe(H,Y){var oe,se;let we=(se=(oe=f.current)==null?void 0:oe.filter)!=null?se:w3;return H?we(H,a.current.search,Y):0}function ge(){if(!a.current.search||f.current.shouldFilter===!1)return;let H=a.current.filtered.items,Y=[];a.current.filtered.groups.forEach(se=>{let we=l.current.get(se),ee=0;we.forEach(Se=>{let De=H.get(Se);ee=Math.max(De,ee)}),Y.push([se,ee])});let oe=D.current;ve().sort((se,we)=>{var ee,Se;let De=se.getAttribute("id"),He=we.getAttribute("id");return((ee=H.get(He))!=null?ee:0)-((Se=H.get(De))!=null?Se:0)}).forEach(se=>{let we=se.closest(am);we?we.appendChild(se.parentElement===we?se:se.closest(`${am} > *`)):oe.appendChild(se.parentElement===oe?se:se.closest(`${am} > *`))}),Y.sort((se,we)=>we[1]-se[1]).forEach(se=>{var we;let ee=(we=D.current)==null?void 0:we.querySelector(`${Ol}[${ss}="${encodeURIComponent(se[0])}"]`);ee?.parentElement.appendChild(ee)})}function he(){let H=ve().find(oe=>oe.getAttribute("aria-disabled")!=="true"),Y=H?.getAttribute(ss);U.setState("value",Y||void 0)}function ne(){var H,Y,oe,se;if(!a.current.search||f.current.shouldFilter===!1){a.current.filtered.count=i.current.size;return}a.current.filtered.groups=new Set;let we=0;for(let ee of i.current){let Se=(Y=(H=u.current.get(ee))==null?void 0:H.value)!=null?Y:"",De=(se=(oe=u.current.get(ee))==null?void 0:oe.keywords)!=null?se:[],He=fe(Se,De);a.current.filtered.items.set(ee,He),He>0&&we++}for(let[ee,Se]of l.current)for(let De of Se)if(a.current.filtered.items.get(De)>0){a.current.filtered.groups.add(ee);break}a.current.filtered.count=we}function le(){var H,Y,oe;let se=ce();se&&(((H=se.parentElement)==null?void 0:H.firstChild)===se&&((oe=(Y=se.closest(Ol))==null?void 0:Y.querySelector(b3))==null||oe.scrollIntoView({block:"nearest"})),se.scrollIntoView({block:"nearest"}))}function ce(){var H;return(H=D.current)==null?void 0:H.querySelector(`${h_}[aria-selected="true"]`)}function ve(){var H;return Array.from(((H=D.current)==null?void 0:H.querySelectorAll(l0))||[])}function O(H){let Y=ve()[H];Y&&U.setState("value",Y.getAttribute(ss))}function j(H){var Y;let oe=ce(),se=ve(),we=se.findIndex(Se=>Se===oe),ee=se[we+H];(Y=f.current)!=null&&Y.loop&&(ee=we+H<0?se[se.length-1]:we+H===se.length?se[0]:se[we+H]),ee&&U.setState("value",ee.getAttribute(ss))}function z(H){let Y=ce(),oe=Y?.closest(Ol),se;for(;oe&&!se;)oe=H>0?A3(oe,Ol):T3(oe,Ol),se=oe?.querySelector(l0);se?U.setState("value",se.getAttribute(ss)):j(H)}let J=()=>O(ve().length-1),me=H=>{H.preventDefault(),H.metaKey?J():H.altKey?z(1):j(1)},Te=H=>{H.preventDefault(),H.metaKey?O(0):H.altKey?z(-1):j(-1)};return m.createElement(ji.div,{ref:t,tabIndex:-1,...M,"cmdk-root":"",onKeyDown:H=>{var Y;(Y=M.onKeyDown)==null||Y.call(M,H);let oe=H.nativeEvent.isComposing||H.keyCode===229;if(!(H.defaultPrevented||oe))switch(H.key){case"n":case"j":{A&&H.ctrlKey&&me(H);break}case"ArrowDown":{me(H);break}case"p":case"k":{A&&H.ctrlKey&&Te(H);break}case"ArrowUp":{Te(H);break}case"Home":{H.preventDefault(),O(0);break}case"End":{H.preventDefault(),J();break}case"Enter":{H.preventDefault();let se=ce();if(se){let we=new Event(Pm);se.dispatchEvent(we)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:k3},g),uf(e,H=>m.createElement(m_.Provider,{value:U},m.createElement(p_.Provider,{value:F},H))))}),S3=m.forwardRef((e,t)=>{var a,i;let l=Cn(),u=m.useRef(null),d=m.useContext(g_),f=gc(),g=v_(e),y=(i=(a=g.current)==null?void 0:a.forceMount)!=null?i:d?.forceMount;ao(()=>{if(!y)return f.item(l,d?.id)},[y]);let x=x_(l,u,[e.value,e.children,u],e.keywords),v=Og(),w=bi(I=>I.value&&I.value===x.current),_=bi(I=>y||f.filter()===!1?!0:I.search?I.filtered.items.get(l)>0:!0);m.useEffect(()=>{let I=u.current;if(!(!I||e.disabled))return I.addEventListener(Pm,R),()=>I.removeEventListener(Pm,R)},[_,e.onSelect,e.disabled]);function R(){var I,U;S(),(U=(I=g.current).onSelect)==null||U.call(I,x.current)}function S(){v.setState("value",x.current,!0)}if(!_)return null;let{disabled:A,value:M,onSelect:T,forceMount:N,keywords:E,...D}=e;return m.createElement(ji.div,{ref:Mn(u,t),...D,id:l,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!w,"data-disabled":!!A,"data-selected":!!w,onPointerMove:A||f.getDisablePointerSelection()?void 0:S,onClick:A?void 0:R},e.children)}),_3=m.forwardRef((e,t)=>{let{heading:a,children:i,forceMount:l,...u}=e,d=Cn(),f=m.useRef(null),g=m.useRef(null),y=Cn(),x=gc(),v=bi(_=>l||x.filter()===!1?!0:_.search?_.filtered.groups.has(d):!0);ao(()=>x.group(d),[]),x_(d,f,[e.value,e.heading,g]);let w=m.useMemo(()=>({id:d,forceMount:l}),[l]);return m.createElement(ji.div,{ref:Mn(f,t),...u,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},a&&m.createElement("div",{ref:g,"cmdk-group-heading":"","aria-hidden":!0,id:y},a),uf(e,_=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?y:void 0},m.createElement(g_.Provider,{value:w},_))))}),j3=m.forwardRef((e,t)=>{let{alwaysRender:a,...i}=e,l=m.useRef(null),u=bi(d=>!d.search);return!a&&!u?null:m.createElement(ji.div,{ref:Mn(l,t),...i,"cmdk-separator":"",role:"separator"})}),C3=m.forwardRef((e,t)=>{let{onValueChange:a,...i}=e,l=e.value!=null,u=Og(),d=bi(y=>y.search),f=bi(y=>y.selectedItemId),g=gc();return m.useEffect(()=>{e.value!=null&&u.setState("search",e.value)},[e.value]),m.createElement(ji.input,{ref:t,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":g.listId,"aria-labelledby":g.labelId,"aria-activedescendant":f,id:g.inputId,type:"text",value:l?e.value:d,onChange:y=>{l||u.setState("search",y.target.value),a?.(y.target.value)}})}),E3=m.forwardRef((e,t)=>{let{children:a,label:i="Suggestions",...l}=e,u=m.useRef(null),d=m.useRef(null),f=bi(y=>y.selectedItemId),g=gc();return m.useEffect(()=>{if(d.current&&u.current){let y=d.current,x=u.current,v,w=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let _=y.offsetHeight;x.style.setProperty("--cmdk-list-height",_.toFixed(1)+"px")})});return w.observe(y),()=>{cancelAnimationFrame(v),w.unobserve(y)}}},[]),m.createElement(ji.div,{ref:Mn(u,t),...l,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":i,id:g.listId},uf(e,y=>m.createElement("div",{ref:Mn(d,g.listInnerRef),"cmdk-list-sizer":""},y)))}),R3=m.forwardRef((e,t)=>{let{open:a,onOpenChange:i,overlayClassName:l,contentClassName:u,container:d,...f}=e;return m.createElement(of,{open:a,onOpenChange:i},m.createElement(sf,{container:d},m.createElement(lf,{"cmdk-overlay":"",className:l}),m.createElement(cf,{"aria-label":e.label,"cmdk-dialog":"",className:u},m.createElement(y_,{ref:t,...f}))))}),N3=m.forwardRef((e,t)=>bi(a=>a.filtered.count===0)?m.createElement(ji.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),O3=m.forwardRef((e,t)=>{let{progress:a,children:i,label:l="Loading...",...u}=e;return m.createElement(ji.div,{ref:t,...u,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":l},uf(e,d=>m.createElement("div",{"aria-hidden":!0},d)))}),ks=Object.assign(y_,{List:E3,Item:S3,Input:C3,Group:_3,Separator:j3,Dialog:R3,Empty:N3,Loading:O3});function A3(e,t){let a=e.nextElementSibling;for(;a;){if(a.matches(t))return a;a=a.nextElementSibling}}function T3(e,t){let a=e.previousElementSibling;for(;a;){if(a.matches(t))return a;a=a.previousElementSibling}}function v_(e){let t=m.useRef(e);return ao(()=>{t.current=e}),t}var ao=typeof window>"u"?m.useEffect:m.useLayoutEffect;function ls(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function bi(e){let t=Og(),a=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,a,a)}function x_(e,t,a,i=[]){let l=m.useRef(),u=gc();return ao(()=>{var d;let f=(()=>{var y;for(let x of a){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(y=x.current.textContent)==null?void 0:y.trim():l.current}})(),g=i.map(y=>y.trim());u.value(e,f,g),(d=t.current)==null||d.setAttribute(ss,f),l.current=f}),l}var D3=()=>{let[e,t]=m.useState(),a=ls(()=>new Map);return ao(()=>{a.current.forEach(i=>i()),a.current=new Map},[e]),(i,l)=>{a.current.set(i,l),t({})}};function M3(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function uf({asChild:e,children:t},a){return e&&m.isValidElement(t)?m.cloneElement(M3(t),{ref:t.ref},a(t.props.children)):a(t)}var k3={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function bt({...e}){return o.jsx(of,{"data-slot":"dialog",...e})}function Xa({...e}){return o.jsx(f_,{"data-slot":"dialog-trigger",...e})}function z3({...e}){return o.jsx(sf,{"data-slot":"dialog-portal",...e})}function Ad({...e}){return o.jsx(mc,{"data-slot":"dialog-close",...e})}function P3({className:e,...t}){return o.jsx(lf,{"data-slot":"dialog-overlay",className:de("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function wt({className:e,children:t,showCloseButton:a=!0,...i}){return o.jsxs(z3,{"data-slot":"dialog-portal",children:[o.jsx(P3,{}),o.jsxs(cf,{"data-slot":"dialog-content",className:de("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...i,children:[t,a&&o.jsxs(mc,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(cg,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function St({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-header",className:de("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Nt({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-footer",className:de("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function _t({className:e,...t}){return o.jsx(Rg,{"data-slot":"dialog-title",className:de("text-lg leading-none font-semibold",e),...t})}function rm({className:e,...t}){return o.jsx(Ng,{"data-slot":"dialog-description",className:de("text-muted-foreground text-sm",e),...t})}function K3({className:e,...t}){return o.jsx(ks,{"data-slot":"command",className:de("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function I3({className:e,...t}){return o.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[o.jsx(dr,{className:"size-4 shrink-0 opacity-50"}),o.jsx(ks.Input,{"data-slot":"command-input",className:de("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function L3({className:e,...t}){return o.jsx(ks.List,{"data-slot":"command-list",className:de("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function U3({...e}){return o.jsx(ks.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function q3({className:e,...t}){return o.jsx(ks.Group,{"data-slot":"command-group",className:de("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function F3({className:e,...t}){return o.jsx(ks.Item,{"data-slot":"command-item",className:de("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function $3(e){const t=V3(e),a=m.forwardRef((i,l)=>{const{children:u,...d}=i,f=m.Children.toArray(u),g=f.find(G3);if(g){const y=g.props.children,x=f.map(v=>v===g?m.Children.count(y)>1?m.Children.only(null):m.isValidElement(y)?y.props.children:null:v);return o.jsx(t,{...d,ref:l,children:m.isValidElement(y)?m.cloneElement(y,void 0,x):null})}return o.jsx(t,{...d,ref:l,children:u})});return a.displayName=`${e}.Slot`,a}function V3(e){const t=m.forwardRef((a,i)=>{const{children:l,...u}=a;if(m.isValidElement(l)){const d=X3(l),f=H3(u,l.props);return l.type!==m.Fragment&&(f.ref=i?Mn(i,d):d),m.cloneElement(l,f)}return m.Children.count(l)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var B3=Symbol("radix.slottable");function G3(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===B3}function H3(e,t){const a={...t};for(const i in t){const l=e[i],u=t[i];/^on[A-Z]/.test(i)?l&&u?a[i]=(...f)=>{const g=u(...f);return l(...f),g}:l&&(a[i]=l):i==="style"?a[i]={...l,...u}:i==="className"&&(a[i]=[l,u].filter(Boolean).join(" "))}return{...e,...a}}function X3(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning;return a?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var df="Popover",[b_]=Za(df,[_i]),yc=_i(),[Z3,Ci]=b_(df),w_=e=>{const{__scopePopover:t,children:a,open:i,defaultOpen:l,onOpenChange:u,modal:d=!1}=e,f=yc(t),g=m.useRef(null),[y,x]=m.useState(!1),[v,w]=xi({prop:i,defaultProp:l??!1,onChange:u,caller:df});return o.jsx(Yd,{...f,children:o.jsx(Z3,{scope:t,contentId:Cn(),triggerRef:g,open:v,onOpenChange:w,onOpenToggle:m.useCallback(()=>w(_=>!_),[w]),hasCustomAnchor:y,onCustomAnchorAdd:m.useCallback(()=>x(!0),[]),onCustomAnchorRemove:m.useCallback(()=>x(!1),[]),modal:d,children:a})})};w_.displayName=df;var S_="PopoverAnchor",Y3=m.forwardRef((e,t)=>{const{__scopePopover:a,...i}=e,l=Ci(S_,a),u=yc(a),{onCustomAnchorAdd:d,onCustomAnchorRemove:f}=l;return m.useEffect(()=>(d(),()=>f()),[d,f]),o.jsx(uc,{...u,...i,ref:t})});Y3.displayName=S_;var __="PopoverTrigger",j_=m.forwardRef((e,t)=>{const{__scopePopover:a,...i}=e,l=Ci(__,a),u=yc(a),d=dt(t,l.triggerRef),f=o.jsx(at.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":O_(l.open),...i,ref:d,onClick:Re(e.onClick,l.onOpenToggle)});return l.hasCustomAnchor?f:o.jsx(uc,{asChild:!0,...u,children:f})});j_.displayName=__;var Ag="PopoverPortal",[Q3,J3]=b_(Ag,{forceMount:void 0}),C_=e=>{const{__scopePopover:t,forceMount:a,children:i,container:l}=e,u=Ci(Ag,t);return o.jsx(Q3,{scope:t,forceMount:a,children:o.jsx(Oa,{present:a||u.open,children:o.jsx(Ms,{asChild:!0,container:l,children:i})})})};C_.displayName=Ag;var js="PopoverContent",E_=m.forwardRef((e,t)=>{const a=J3(js,e.__scopePopover),{forceMount:i=a.forceMount,...l}=e,u=Ci(js,e.__scopePopover);return o.jsx(Oa,{present:i||u.open,children:u.modal?o.jsx(e5,{...l,ref:t}):o.jsx(t5,{...l,ref:t})})});E_.displayName=js;var W3=$3("PopoverContent.RemoveScroll"),e5=m.forwardRef((e,t)=>{const a=Ci(js,e.__scopePopover),i=m.useRef(null),l=dt(t,i),u=m.useRef(!1);return m.useEffect(()=>{const d=i.current;if(d)return af(d)},[]),o.jsx(pc,{as:W3,allowPinchZoom:!0,children:o.jsx(R_,{...e,ref:l,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Re(e.onCloseAutoFocus,d=>{d.preventDefault(),u.current||a.triggerRef.current?.focus()}),onPointerDownOutside:Re(e.onPointerDownOutside,d=>{const f=d.detail.originalEvent,g=f.button===0&&f.ctrlKey===!0,y=f.button===2||g;u.current=y},{checkForDefaultPrevented:!1}),onFocusOutside:Re(e.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1})})})}),t5=m.forwardRef((e,t)=>{const a=Ci(js,e.__scopePopover),i=m.useRef(!1),l=m.useRef(!1);return o.jsx(R_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{e.onCloseAutoFocus?.(u),u.defaultPrevented||(i.current||a.triggerRef.current?.focus(),u.preventDefault()),i.current=!1,l.current=!1},onInteractOutside:u=>{e.onInteractOutside?.(u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const d=u.target;a.triggerRef.current?.contains(d)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&l.current&&u.preventDefault()}})}),R_=m.forwardRef((e,t)=>{const{__scopePopover:a,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:y,onInteractOutside:x,...v}=e,w=Ci(js,a),_=yc(a);return tf(),o.jsx(hc,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:l,onUnmountAutoFocus:u,children:o.jsx(As,{asChild:!0,disableOutsidePointerEvents:d,onInteractOutside:x,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:y,onDismiss:()=>w.onOpenChange(!1),children:o.jsx(Qd,{"data-state":O_(w.open),role:"dialog",id:w.contentId,..._,...v,ref:t,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),N_="PopoverClose",n5=m.forwardRef((e,t)=>{const{__scopePopover:a,...i}=e,l=Ci(N_,a);return o.jsx(at.button,{type:"button",...i,ref:t,onClick:Re(e.onClick,()=>l.onOpenChange(!1))})});n5.displayName=N_;var a5="PopoverArrow",r5=m.forwardRef((e,t)=>{const{__scopePopover:a,...i}=e,l=yc(a);return o.jsx(Jd,{...l,...i,ref:t})});r5.displayName=a5;function O_(e){return e?"open":"closed"}var i5=w_,o5=j_,s5=C_,l5=E_;function c5({...e}){return o.jsx(i5,{"data-slot":"popover",...e})}function u5({...e}){return o.jsx(o5,{"data-slot":"popover-trigger",...e})}function d5({className:e,align:t="center",sideOffset:a=4,...i}){return o.jsx(s5,{children:o.jsx(l5,{"data-slot":"popover-content",align:t,sideOffset:a,className:de("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...i})})}const f5=({orgs:e})=>{const[t,a]=m.useState(!1),[i,l]=m.useState(qa.get()??"");m.useEffect(()=>qa.subscribe(d=>l(d??"")),[]);const u=e.find(d=>d.id===i);return o.jsxs(c5,{open:t,onOpenChange:a,children:[o.jsx(u5,{asChild:!0,children:o.jsxs(ie,{variant:"ghost",className:"h-9 w-full justify-between px-2","aria-label":"Switch organization",children:[o.jsxs("span",{className:"flex items-center gap-2 truncate",children:[o.jsx(ES,{className:"h-4 w-4"}),o.jsx("span",{className:"truncate",children:u?.name??"Select org"})]}),o.jsx(KO,{className:"ml-2 h-4 w-4 opacity-50"})]})}),o.jsx(d5,{className:"w-[280px] p-0",align:"start",children:o.jsxs(K3,{children:[o.jsx(I3,{placeholder:"Search orgs..."}),o.jsxs(L3,{children:[o.jsx(U3,{children:"No orgs found."}),o.jsx(q3,{heading:"Organizations",children:e.map(d=>o.jsxs(F3,{value:d.id,onSelect:f=>{qa.set(f),a(!1)},children:[o.jsx(RS,{className:de("mr-2 h-4 w-4",i===d.id?"opacity-100":"opacity-0")}),o.jsx("span",{className:"truncate",children:d.name})]},d.id))})]})]})})]})};function h5(){return Zt({queryKey:["me"],queryFn:()=>Zi.getMe(),staleTime:300*1e3})}function p5(e,t=[]){let a=[];function i(u,d){const f=m.createContext(d);f.displayName=u+"Context";const g=a.length;a=[...a,d];const y=v=>{const{scope:w,children:_,...R}=v,S=w?.[e]?.[g]||f,A=m.useMemo(()=>R,Object.values(R));return o.jsx(S.Provider,{value:A,children:_})};y.displayName=u+"Provider";function x(v,w){const _=w?.[e]?.[g]||f,R=m.useContext(_);if(R)return R;if(d!==void 0)return d;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[y,x]}const l=()=>{const u=a.map(d=>m.createContext(d));return function(f){const g=f?.[e]||u;return m.useMemo(()=>({[`__scope${e}`]:{...f,[e]:g}}),[f,g])}};return l.scopeName=e,[i,m5(l,...t)]}function m5(...e){const t=e[0];if(e.length===1)return t;const a=()=>{const i=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(u){const d=i.reduce((f,{useScope:g,scopeName:y})=>{const v=g(u)[`__scope${y}`];return{...f,...v}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return a.scopeName=t.scopeName,a}var g5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tg=g5.reduce((e,t)=>{const a=lc(`Primitive.${t}`),i=m.forwardRef((l,u)=>{const{asChild:d,...f}=l,g=d?a:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(g,{...f,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),im={exports:{}},om={};var c0;function y5(){if(c0)return om;c0=1;var e=dS();function t(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}var a=typeof Object.is=="function"?Object.is:t,i=e.useState,l=e.useEffect,u=e.useLayoutEffect,d=e.useDebugValue;function f(v,w){var _=w(),R=i({inst:{value:_,getSnapshot:w}}),S=R[0].inst,A=R[1];return u(function(){S.value=_,S.getSnapshot=w,g(S)&&A({inst:S})},[v,_,w]),l(function(){return g(S)&&A({inst:S}),v(function(){g(S)&&A({inst:S})})},[v]),d(_),_}function g(v){var w=v.getSnapshot;v=v.value;try{var _=w();return!a(v,_)}catch{return!0}}function y(v,w){return w()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?y:f;return om.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,om}var u0;function v5(){return u0||(u0=1,im.exports=y5()),im.exports}var x5=v5();function b5(){return x5.useSyncExternalStore(w5,()=>!0,()=>!1)}function w5(){return()=>{}}var Dg="Avatar",[S5]=p5(Dg),[_5,A_]=S5(Dg),T_=m.forwardRef((e,t)=>{const{__scopeAvatar:a,...i}=e,[l,u]=m.useState("idle");return o.jsx(_5,{scope:a,imageLoadingStatus:l,onImageLoadingStatusChange:u,children:o.jsx(Tg.span,{...i,ref:t})})});T_.displayName=Dg;var D_="AvatarImage",j5=m.forwardRef((e,t)=>{const{__scopeAvatar:a,src:i,onLoadingStatusChange:l=()=>{},...u}=e,d=A_(D_,a),f=C5(i,u),g=Ba(y=>{l(y),d.onImageLoadingStatusChange(y)});return hn(()=>{f!=="idle"&&g(f)},[f,g]),f==="loaded"?o.jsx(Tg.img,{...u,ref:t,src:i}):null});j5.displayName=D_;var M_="AvatarFallback",k_=m.forwardRef((e,t)=>{const{__scopeAvatar:a,delayMs:i,...l}=e,u=A_(M_,a),[d,f]=m.useState(i===void 0);return m.useEffect(()=>{if(i!==void 0){const g=window.setTimeout(()=>f(!0),i);return()=>window.clearTimeout(g)}},[i]),d&&u.imageLoadingStatus!=="loaded"?o.jsx(Tg.span,{...l,ref:t}):null});k_.displayName=M_;function d0(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function C5(e,{referrerPolicy:t,crossOrigin:a}){const i=b5(),l=m.useRef(null),u=i?(l.current||(l.current=new window.Image),l.current):null,[d,f]=m.useState(()=>d0(u,e));return hn(()=>{f(d0(u,e))},[u,e]),hn(()=>{const g=v=>()=>{f(v)};if(!u)return;const y=g("loaded"),x=g("error");return u.addEventListener("load",y),u.addEventListener("error",x),t&&(u.referrerPolicy=t),typeof a=="string"&&(u.crossOrigin=a),()=>{u.removeEventListener("load",y),u.removeEventListener("error",x)}},[u,a,t]),d}var E5=T_,R5=k_;function N5({className:e,...t}){return o.jsx(E5,{"data-slot":"avatar",className:de("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function O5({className:e,...t}){return o.jsx(R5,{"data-slot":"avatar-fallback",className:de("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}function A5({...e}){return o.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function T5({className:e,...t}){return o.jsx("ol",{"data-slot":"breadcrumb-list",className:de("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function f0({className:e,...t}){return o.jsx("li",{"data-slot":"breadcrumb-item",className:de("inline-flex items-center gap-1.5",e),...t})}function h0({asChild:e,className:t,...a}){const i=e?Rs:"a";return o.jsx(i,{"data-slot":"breadcrumb-link",className:de("hover:text-foreground transition-colors",t),...a})}function D5({className:e,...t}){return o.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:de("text-foreground font-normal",e),...t})}function M5({children:e,className:t,...a}){return o.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:de("[&>svg]:size-3.5",t),...a,children:e??o.jsx(MO,{})})}const sm=768;function k5(){const[e,t]=m.useState(void 0);return m.useEffect(()=>{const a=window.matchMedia(`(max-width: ${sm-1}px)`),i=()=>{t(window.innerWidtha.removeEventListener("change",i)},[]),!!e}function Ae({className:e,type:t,...a}){return o.jsx("input",{type:t,"data-slot":"input",className:de("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...a})}function z5({...e}){return o.jsx(of,{"data-slot":"sheet",...e})}function P5({...e}){return o.jsx(sf,{"data-slot":"sheet-portal",...e})}function K5({className:e,...t}){return o.jsx(lf,{"data-slot":"sheet-overlay",className:de("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function I5({className:e,children:t,side:a="right",...i}){return o.jsxs(P5,{children:[o.jsx(K5,{}),o.jsxs(cf,{"data-slot":"sheet-content",className:de("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",a==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",a==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",a==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",a==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...i,children:[t,o.jsxs(mc,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[o.jsx(cg,{className:"size-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function L5({className:e,...t}){return o.jsx("div",{"data-slot":"sheet-header",className:de("flex flex-col gap-1.5 p-4",e),...t})}function U5({className:e,...t}){return o.jsx(Rg,{"data-slot":"sheet-title",className:de("text-foreground font-semibold",e),...t})}function q5({className:e,...t}){return o.jsx(Ng,{"data-slot":"sheet-description",className:de("text-muted-foreground text-sm",e),...t})}const F5="sidebar_state",$5=3600*24*7,V5="16rem",B5="18rem",G5="3rem",H5="b",z_=m.createContext(null);function Mg(){const e=m.useContext(z_);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function X5({defaultOpen:e=!0,open:t,onOpenChange:a,className:i,style:l,children:u,...d}){const f=k5(),[g,y]=m.useState(!1),[x,v]=m.useState(e),w=t??x,_=m.useCallback(M=>{const T=typeof M=="function"?M(w):M;a?a(T):v(T),document.cookie=`${F5}=${T}; path=/; max-age=${$5}`},[a,w]),R=m.useCallback(()=>f?y(M=>!M):_(M=>!M),[f,_,y]);m.useEffect(()=>{const M=T=>{T.key===H5&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),R())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[R]);const S=w?"expanded":"collapsed",A=m.useMemo(()=>({state:S,open:w,setOpen:_,isMobile:f,openMobile:g,setOpenMobile:y,toggleSidebar:R}),[S,w,_,f,g,y,R]);return o.jsx(z_.Provider,{value:A,children:o.jsx(fc,{delayDuration:0,children:o.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":V5,"--sidebar-width-icon":G5,...l},className:de("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",i),...d,children:u})})})}function Z5({side:e="left",variant:t="sidebar",collapsible:a="offcanvas",className:i,children:l,...u}){const{isMobile:d,state:f,openMobile:g,setOpenMobile:y}=Mg();return a==="none"?o.jsx("div",{"data-slot":"sidebar",className:de("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",i),...u,children:l}):d?o.jsx(z5,{open:g,onOpenChange:y,...u,children:o.jsxs(I5,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":B5},side:e,children:[o.jsxs(L5,{className:"sr-only",children:[o.jsx(U5,{children:"Sidebar"}),o.jsx(q5,{children:"Displays the mobile sidebar."})]}),o.jsx("div",{className:"flex h-full w-full flex-col",children:l})]})}):o.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":f,"data-collapsible":f==="collapsed"?a:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[o.jsx("div",{"data-slot":"sidebar-gap",className:de("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)")}),o.jsx("div",{"data-slot":"sidebar-container",className:de("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",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",i),...u,children:o.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:l})})]})}function Y5({className:e,onClick:t,...a}){const{toggleSidebar:i}=Mg();return o.jsxs(ie,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:de("size-7",e),onClick:l=>{t?.(l),i()},...a,children:[o.jsx(d2,{}),o.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Q5({className:e,...t}){return o.jsx("main",{"data-slot":"sidebar-inset",className:de("bg-background relative flex w-full flex-1 flex-col","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 J5({className:e,...t}){return o.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:de("flex flex-col gap-2 p-2",e),...t})}function W5({className:e,...t}){return o.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:de("flex flex-col gap-2 p-2",e),...t})}function e6({className:e,...t}){return o.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:de("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Qu({className:e,...t}){return o.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:de("relative flex w-full min-w-0 flex-col p-2",e),...t})}function Ju({className:e,asChild:t=!1,...a}){const i=t?Rs:"div";return o.jsx(i,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:de("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...a})}function Wu({className:e,...t}){return o.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:de("w-full text-sm",e),...t})}function ed({className:e,...t}){return o.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:de("flex w-full min-w-0 flex-col gap-1",e),...t})}function td({className:e,...t}){return o.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:de("group/menu-item relative",e),...t})}const t6=dg("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] 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 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(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 nd({asChild:e=!1,isActive:t=!1,variant:a="default",size:i="default",tooltip:l,className:u,...d}){const f=e?Rs:"button",{isMobile:g,state:y}=Mg(),x=o.jsx(f,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":i,"data-active":t,className:de(t6({variant:a,size:i}),u),...d});return l?(typeof l=="string"&&(l={children:l}),o.jsxs(jd,{children:[o.jsx(Cd,{asChild:!0,children:x}),o.jsx(Ed,{side:"right",align:"center",hidden:y!=="collapsed"||g,...l})]})):x}const n6=()=>{const e=tg(),{data:t,isLoading:a}=h5(),i=m.useMemo(()=>{const u=e.pathname.split("/").filter(Boolean),d=[];let f="";for(const g of u)f+=`/${g}`,d.push({to:f,label:g});return d},[e.pathname]),l=m.useMemo(()=>{if(!t)return"U";const d=(t.display_name||t.primary_email||"").trim().split(/\s+/);return d.length>=2?(d[0][0]+d[1][0]).toUpperCase():d.length===1&&d[0]?d[0][0].toUpperCase():"U"},[t]);return o.jsxs("div",{className:"flex h-12 items-center gap-2 border-b px-3",children:[o.jsx(Y5,{}),o.jsx("div",{className:"flex-1",children:o.jsx(A5,{children:o.jsxs(T5,{children:[o.jsx(f0,{children:o.jsx(h0,{asChild:!0,children:o.jsx(Kp,{to:"/",children:"Home"})})}),i.map((u,d)=>o.jsxs("span",{className:"flex items-center",children:[o.jsx(M5,{}),o.jsx(f0,{children:d===i.length-1?o.jsx(D5,{className:"capitalize",children:u.label}):o.jsx(h0,{asChild:!0,children:o.jsx(Kp,{to:u.to,className:"capitalize",children:u.label})})})]},u.to))]})})}),o.jsx(ie,{variant:"ghost",size:"sm",asChild:!0,children:o.jsx(Kp,{to:"/me",children:a?"…":t?.display_name||"Profile"})}),o.jsx(N5,{className:"h-7 w-7",children:o.jsx(O5,{children:l})})]})};async function a6(){const e=jn.get();if(!e?.refresh_token){jn.logout();return}try{const t={refresh_token:e.refresh_token};await cD().logout({body:t})}catch(t){console.warn("Logout API failed; clearing local state anyway",t)}finally{jn.logout()}}function r6(){return{logout:m.useCallback(()=>a6(),[])}}const i6=()=>{const[e,t]=m.useState([]),{logout:a}=r6();return m.useEffect(()=>{let i=!0;return(async()=>{try{const u=((await Zi.getMe()).organizations??[]).map(d=>({id:d.id,name:d.name??d.id}));if(!i)return;t(u),!qa.get()&&u.length>0&&qa.set(u[0].id)}catch{}})(),()=>{i=!1}},[]),o.jsxs(X5,{defaultOpen:!0,children:[o.jsxs(Z5,{collapsible:"icon",variant:"floating",children:[o.jsx(J5,{children:o.jsx("div",{className:"px-2 py-2",children:o.jsx(f5,{orgs:e})})}),o.jsxs(e6,{children:[o.jsxs(Qu,{children:[o.jsx(Ju,{children:"Navigation"}),o.jsx(Wu,{children:o.jsx(ed,{children:Jz.map(i=>o.jsx(td,{children:o.jsx(nd,{asChild:!0,tooltip:i.label,children:o.jsxs(zu,{to:i.to,className:({isActive:l})=>de("flex items-center gap-2",l&&"text-primary"),children:[o.jsx(i.icon,{className:"h-4 w-4"}),o.jsx("span",{children:i.label})]})})},i.to))})})]}),o.jsxs(Qu,{children:[o.jsx(Ju,{children:"Organization"}),o.jsx(Wu,{children:o.jsx(ed,{children:Wz.map(i=>o.jsx(td,{children:o.jsx(nd,{asChild:!0,tooltip:i.label,children:o.jsxs(zu,{to:i.to,className:({isActive:l})=>de("flex items-center gap-2",l&&"text-primary"),children:[o.jsx(i.icon,{className:"h-4 w-4"}),o.jsx("span",{children:i.label})]})})},i.to))})})]}),o.jsxs(Qu,{children:[o.jsx(Ju,{children:"User"}),o.jsx(Wu,{children:o.jsx(ed,{children:e4.map(i=>o.jsx(td,{children:o.jsx(nd,{asChild:!0,tooltip:i.label,children:o.jsxs(zu,{to:i.to,className:({isActive:l})=>de("flex items-center gap-2",l&&"text-primary"),children:[o.jsx(i.icon,{className:"h-4 w-4"}),o.jsx("span",{children:i.label})]})})},i.to))})})]}),o.jsxs(Qu,{children:[o.jsx(Ju,{children:"Admin"}),o.jsx(Wu,{children:o.jsx(ed,{children:t4.map(i=>o.jsx(td,{children:o.jsx(nd,{asChild:!0,tooltip:i.label,children:o.jsxs(zu,{to:i.to,className:({isActive:l})=>de("flex items-center gap-2",l&&"text-primary"),children:[o.jsx(i.icon,{className:"h-4 w-4"}),o.jsx("span",{children:i.label})]})})},i.to))})})]})]}),o.jsx(W5,{children:o.jsx("div",{className:"px-2 py-2",children:o.jsx(ie,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>void a(),children:"Sign out"})})})]}),o.jsxs(Q5,{className:"flex min-h-screen flex-col",children:[o.jsx(n6,{}),o.jsx("main",{className:"p-4",children:o.jsx(fS,{})}),o.jsx(Fz,{})]})]})},o6=()=>{const e=m.useSyncExternalStore(t=>jn.subscribe(t),()=>jn.get(),()=>jn.get());return{tokens:e,authed:!!e?.access_token,isExpired:jn.isExpired(),willExpireSoon:jn.willExpireSoon()}},s6=()=>{const{authed:e}=o6(),t=tg();return e?o.jsx(fS,{}):o.jsx(jN,{to:`/login?to=${encodeURIComponent(t.pathname+t.search)}`,replace:!0})},Al=gD(),$l={listAnnotations:()=>ze(async()=>await Al.listAnnotations()),createAnnotation:e=>ze(async()=>await Al.createAnnotation({body:e})),getAnnotation:e=>ze(async()=>await Al.getAnnotation({id:e})),deleteAnnotation:e=>ze(async()=>{await Al.deleteAnnotation({id:e})}),updateAnnotation:(e,t)=>ze(async()=>await Al.updateAnnotation({id:e,body:t}))},Tl=mD(),Vl={listLabels:()=>ze(async()=>await Tl.listLabels()),createLabel:e=>ze(async()=>await Tl.createLabel({body:e})),getLabel:e=>ze(async()=>await Tl.getLabel({id:e})),deleteLabel:e=>ze(async()=>{await Tl.deleteLabel({id:e})}),updateLabel:(e,t)=>ze(async()=>await Tl.updateLabel({id:e,body:t}))};var vc=e=>e.type==="checkbox",Qi=e=>e instanceof Date,Hn=e=>e==null;const P_=e=>typeof e=="object";var nn=e=>!Hn(e)&&!Array.isArray(e)&&P_(e)&&!Qi(e),K_=e=>nn(e)&&e.target?vc(e.target)?e.target.checked:e.target.value:e,l6=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,I_=(e,t)=>e.has(l6(t)),c6=e=>{const t=e.constructor&&e.constructor.prototype;return nn(t)&&t.hasOwnProperty("isPrototypeOf")},kg=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ln(e){let t;const a=Array.isArray(e),i=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(kg&&(e instanceof Blob||i))&&(a||nn(e)))if(t=a?[]:Object.create(Object.getPrototypeOf(e)),!a&&!c6(e))t=e;else for(const l in e)e.hasOwnProperty(l)&&(t[l]=ln(e[l]));else return e;return t}var ff=e=>/^\w*$/.test(e),Bt=e=>e===void 0,zg=e=>Array.isArray(e)?e.filter(Boolean):[],Pg=e=>zg(e.replace(/["|']|\]/g,"").split(/\.|\[/)),_e=(e,t,a)=>{if(!t||!nn(e))return a;const i=(ff(t)?[t]:Pg(t)).reduce((l,u)=>Hn(l)?l:l[u],e);return Bt(i)||i===e?Bt(e[t])?a:e[t]:i},oa=e=>typeof e=="boolean",xt=(e,t,a)=>{let i=-1;const l=ff(t)?[t]:Pg(t),u=l.length,d=u-1;for(;++iQ.useContext(Kg),u6=e=>{const{children:t,...a}=e;return Q.createElement(Kg.Provider,{value:a},t)};var L_=(e,t,a,i=!0)=>{const l={defaultValues:t._defaultValues};for(const u in e)Object.defineProperty(l,u,{get:()=>{const d=u;return t._proxyFormState[d]!==Ia.all&&(t._proxyFormState[d]=!i||Ia.all),a&&(a[d]=!0),e[d]}});return l};const Ig=typeof window<"u"?Q.useLayoutEffect:Q.useEffect;function U_(e){const t=hf(),{control:a=t.control,disabled:i,name:l,exact:u}=e||{},[d,f]=Q.useState(a._formState),g=Q.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ig(()=>a._subscribe({name:l,formState:g.current,exact:u,callback:y=>{!i&&f({...a._formState,...y})}}),[l,i,u]),Q.useEffect(()=>{g.current.isValid&&a._setValid(!0)},[a]),Q.useMemo(()=>L_(d,a,g.current,!1),[d,a])}var la=e=>typeof e=="string",Km=(e,t,a,i,l)=>la(e)?(i&&t.watch.add(e),_e(a,e,l)):Array.isArray(e)?e.map(u=>(i&&t.watch.add(u),_e(a,u))):(i&&(t.watchAll=!0),a),Im=e=>Hn(e)||!P_(e);function La(e,t,a=new WeakSet){if(Im(e)||Im(t))return e===t;if(Qi(e)&&Qi(t))return e.getTime()===t.getTime();const i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;if(a.has(e)||a.has(t))return!0;a.add(e),a.add(t);for(const u of i){const d=e[u];if(!l.includes(u))return!1;if(u!=="ref"){const f=t[u];if(Qi(d)&&Qi(f)||nn(d)&&nn(f)||Array.isArray(d)&&Array.isArray(f)?!La(d,f,a):d!==f)return!1}}return!0}function d6(e){const t=hf(),{control:a=t.control,name:i,defaultValue:l,disabled:u,exact:d,compute:f}=e||{},g=Q.useRef(l),y=Q.useRef(f),x=Q.useRef(void 0),v=Q.useRef(a),w=Q.useRef(i);y.current=f;const[_,R]=Q.useState(()=>{const E=a._getWatch(i,g.current);return y.current?y.current(E):E}),S=Q.useCallback(E=>{const D=Km(i,a._names,E||a._formValues,!1,g.current);return y.current?y.current(D):D},[a._formValues,a._names,i]),A=Q.useCallback(E=>{if(!u){const D=Km(i,a._names,E||a._formValues,!1,g.current);if(y.current){const I=y.current(D);La(I,x.current)||(R(I),x.current=I)}else R(D)}},[a._formValues,a._names,u,i]);Ig(()=>((v.current!==a||!La(w.current,i))&&(v.current=a,w.current=i,A()),a._subscribe({name:i,formState:{values:!0},exact:d,callback:E=>{A(E.values)}})),[a,d,i,A]),Q.useEffect(()=>a._removeUnmounted());const M=v.current!==a,T=w.current,N=Q.useMemo(()=>{if(u)return null;const E=!M&&!La(T,i);return M||E?S():null},[u,M,i,T,S]);return N!==null?N:_}function f6(e){const t=hf(),{name:a,disabled:i,control:l=t.control,shouldUnregister:u,defaultValue:d}=e,f=I_(l._names.array,a),g=Q.useMemo(()=>_e(l._formValues,a,_e(l._defaultValues,a,d)),[l,a,d]),y=d6({control:l,name:a,defaultValue:g,exact:!0}),x=U_({control:l,name:a,exact:!0}),v=Q.useRef(e),w=Q.useRef(void 0),_=Q.useRef(l.register(a,{...e.rules,value:y,...oa(e.disabled)?{disabled:e.disabled}:{}}));v.current=e;const R=Q.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!_e(x.errors,a)},isDirty:{enumerable:!0,get:()=>!!_e(x.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!_e(x.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!_e(x.validatingFields,a)},error:{enumerable:!0,get:()=>_e(x.errors,a)}}),[x,a]),S=Q.useCallback(N=>_.current.onChange({target:{value:K_(N),name:a},type:Td.CHANGE}),[a]),A=Q.useCallback(()=>_.current.onBlur({target:{value:_e(l._formValues,a),name:a},type:Td.BLUR}),[a,l._formValues]),M=Q.useCallback(N=>{const E=_e(l._fields,a);E&&N&&(E._f.ref={focus:()=>N.focus&&N.focus(),select:()=>N.select&&N.select(),setCustomValidity:D=>N.setCustomValidity(D),reportValidity:()=>N.reportValidity()})},[l._fields,a]),T=Q.useMemo(()=>({name:a,value:y,...oa(i)||x.disabled?{disabled:x.disabled||i}:{},onChange:S,onBlur:A,ref:M}),[a,i,x.disabled,S,A,M,y]);return Q.useEffect(()=>{const N=l._options.shouldUnregister||u,E=w.current;E&&E!==a&&!f&&l.unregister(E),l.register(a,{...v.current.rules,...oa(v.current.disabled)?{disabled:v.current.disabled}:{}});const D=(I,U)=>{const F=_e(l._fields,I);F&&F._f&&(F._f.mount=U)};if(D(a,!0),N){const I=ln(_e(l._options.defaultValues,a,v.current.defaultValue));xt(l._defaultValues,a,I),Bt(_e(l._formValues,a))&&xt(l._formValues,a,I)}return!f&&l.register(a),w.current=a,()=>{(f?N&&!l._state.action:N)?l.unregister(a):D(a,!1)}},[a,l,f,u]),Q.useEffect(()=>{l._setDisabledField({disabled:i,name:a})},[i,a,l]),Q.useMemo(()=>({field:T,formState:x,fieldState:R}),[T,x,R])}const Pa=e=>e.render(f6(e));var Lg=(e,t,a,i,l)=>t?{...a[e],types:{...a[e]&&a[e].types?a[e].types:{},[i]:l||!0}}:{},Yl=e=>Array.isArray(e)?e:[e],p0=()=>{let e=[];return{get observers(){return e},next:l=>{for(const u of e)u.next&&u.next(l)},subscribe:l=>(e.push(l),{unsubscribe:()=>{e=e.filter(u=>u!==l)}}),unsubscribe:()=>{e=[]}}};function q_(e,t){const a={};for(const i in e)if(e.hasOwnProperty(i)){const l=e[i],u=t[i];if(l&&nn(l)&&u){const d=q_(l,u);nn(d)&&(a[i]=d)}else e[i]&&(a[i]=u)}return a}var An=e=>nn(e)&&!Object.keys(e).length,Ug=e=>e.type==="file",Ua=e=>typeof e=="function",Dd=e=>{if(!kg)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},F_=e=>e.type==="select-multiple",qg=e=>e.type==="radio",h6=e=>qg(e)||vc(e),lm=e=>Dd(e)&&e.isConnected;function p6(e,t){const a=t.slice(0,-1).length;let i=0;for(;i{for(const t in e)if(Ua(e[t]))return!0;return!1};function $_(e){return Array.isArray(e)||nn(e)&&!g6(e)}function Lm(e,t={}){for(const a in e)$_(e[a])?(t[a]=Array.isArray(e[a])?[]:{},Lm(e[a],t[a])):Bt(e[a])||(t[a]=!0);return t}function cs(e,t,a){a||(a=Lm(t));for(const i in e)$_(e[i])?Bt(t)||Im(a[i])?a[i]=Lm(e[i],Array.isArray(e[i])?[]:{}):cs(e[i],Hn(t)?{}:t[i],a[i]):a[i]=!La(e[i],t[i]);return a}const m0={value:!1,isValid:!1},g0={value:!0,isValid:!0};var V_=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(a=>a&&a.checked&&!a.disabled).map(a=>a.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Bt(e[0].attributes.value)?Bt(e[0].value)||e[0].value===""?g0:{value:e[0].value,isValid:!0}:g0:m0}return m0},B_=(e,{valueAsNumber:t,valueAsDate:a,setValueAs:i})=>Bt(e)?e:t?e===""?NaN:e&&+e:a&&la(e)?new Date(e):i?i(e):e;const y0={isValid:!1,value:null};var G_=e=>Array.isArray(e)?e.reduce((t,a)=>a&&a.checked&&!a.disabled?{isValid:!0,value:a.value}:t,y0):y0;function v0(e){const t=e.ref;return Ug(t)?t.files:qg(t)?G_(e.refs).value:F_(t)?[...t.selectedOptions].map(({value:a})=>a):vc(t)?V_(e.refs).value:B_(Bt(t.value)?e.ref.value:t.value,e)}var y6=(e,t,a,i)=>{const l={};for(const u of e){const d=_e(t,u);d&&xt(l,u,d._f)}return{criteriaMode:a,names:[...e],fields:l,shouldUseNativeValidation:i}},Md=e=>e instanceof RegExp,Dl=e=>Bt(e)?e:Md(e)?e.source:nn(e)?Md(e.value)?e.value.source:e.value:e,x0=e=>({isOnSubmit:!e||e===Ia.onSubmit,isOnBlur:e===Ia.onBlur,isOnChange:e===Ia.onChange,isOnAll:e===Ia.all,isOnTouch:e===Ia.onTouched});const b0="AsyncFunction";var v6=e=>!!e&&!!e.validate&&!!(Ua(e.validate)&&e.validate.constructor.name===b0||nn(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===b0)),x6=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),w0=(e,t,a)=>!a&&(t.watchAll||t.watch.has(e)||[...t.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));const Ql=(e,t,a,i)=>{for(const l of a||Object.keys(e)){const u=_e(e,l);if(u){const{_f:d,...f}=u;if(d){if(d.refs&&d.refs[0]&&t(d.refs[0],l)&&!i)return!0;if(d.ref&&t(d.ref,d.name)&&!i)return!0;if(Ql(f,t))break}else if(nn(f)&&Ql(f,t))break}}};function S0(e,t,a){const i=_e(e,a);if(i||ff(a))return{error:i,name:a};const l=a.split(".");for(;l.length;){const u=l.join("."),d=_e(t,u),f=_e(e,u);if(d&&!Array.isArray(d)&&a!==u)return{name:a};if(f&&f.type)return{name:u,error:f};if(f&&f.root&&f.root.type)return{name:`${u}.root`,error:f.root};l.pop()}return{name:a}}var b6=(e,t,a,i)=>{a(e);const{name:l,...u}=e;return An(u)||Object.keys(u).length>=Object.keys(t).length||Object.keys(u).find(d=>t[d]===(!i||Ia.all))},w6=(e,t,a)=>!e||!t||e===t||Yl(e).some(i=>i&&(a?i===t:i.startsWith(t)||t.startsWith(i))),S6=(e,t,a,i,l)=>l.isOnAll?!1:!a&&l.isOnTouch?!(t||e):(a?i.isOnBlur:l.isOnBlur)?!e:(a?i.isOnChange:l.isOnChange)?e:!0,_6=(e,t)=>!zg(_e(e,t)).length&&tn(e,t),j6=(e,t,a)=>{const i=Yl(_e(e,a));return xt(i,"root",t[a]),xt(e,a,i),e};function _0(e,t,a="validate"){if(la(e)||Array.isArray(e)&&e.every(la)||oa(e)&&!e)return{type:a,message:la(e)?e:"",ref:t}}var rs=e=>nn(e)&&!Md(e)?e:{value:e,message:""},j0=async(e,t,a,i,l,u)=>{const{ref:d,refs:f,required:g,maxLength:y,minLength:x,min:v,max:w,pattern:_,validate:R,name:S,valueAsNumber:A,mount:M}=e._f,T=_e(a,S);if(!M||t.has(S))return{};const N=f?f[0]:d,E=ne=>{l&&N.reportValidity&&(N.setCustomValidity(oa(ne)?"":ne||""),N.reportValidity())},D={},I=qg(d),U=vc(d),F=I||U,fe=(A||Ug(d))&&Bt(d.value)&&Bt(T)||Dd(d)&&d.value===""||T===""||Array.isArray(T)&&!T.length,ge=Lg.bind(null,S,i,D),he=(ne,le,ce,ve=zr.maxLength,O=zr.minLength)=>{const j=ne?le:ce;D[S]={type:ne?ve:O,message:j,ref:d,...ge(ne?ve:O,j)}};if(u?!Array.isArray(T)||!T.length:g&&(!F&&(fe||Hn(T))||oa(T)&&!T||U&&!V_(f).isValid||I&&!G_(f).isValid)){const{value:ne,message:le}=la(g)?{value:!!g,message:g}:rs(g);if(ne&&(D[S]={type:zr.required,message:le,ref:N,...ge(zr.required,le)},!i))return E(le),D}if(!fe&&(!Hn(v)||!Hn(w))){let ne,le;const ce=rs(w),ve=rs(v);if(!Hn(T)&&!isNaN(T)){const O=d.valueAsNumber||T&&+T;Hn(ce.value)||(ne=O>ce.value),Hn(ve.value)||(le=Onew Date(new Date().toDateString()+" "+me),z=d.type=="time",J=d.type=="week";la(ce.value)&&T&&(ne=z?j(T)>j(ce.value):J?T>ce.value:O>new Date(ce.value)),la(ve.value)&&T&&(le=z?j(T)+ne.value,ve=!Hn(le.value)&&T.length<+le.value;if((ce||ve)&&(he(ce,ne.message,le.message),!i))return E(D[S].message),D}if(_&&!fe&&la(T)){const{value:ne,message:le}=rs(_);if(Md(ne)&&!T.match(ne)&&(D[S]={type:zr.pattern,message:le,ref:d,...ge(zr.pattern,le)},!i))return E(le),D}if(R){if(Ua(R)){const ne=await R(T,a),le=_0(ne,N);if(le&&(D[S]={...le,...ge(zr.validate,le.message)},!i))return E(le.message),D}else if(nn(R)){let ne={};for(const le in R){if(!An(ne)&&!i)break;const ce=_0(await R[le](T,a),N,le);ce&&(ne={...ce,...ge(le,ce.message)},E(ce.message),i&&(D[S]=ne))}if(!An(ne)&&(D[S]={ref:N,...ne},!i))return D}}return E(!0),D};const C6={mode:Ia.onSubmit,reValidateMode:Ia.onChange,shouldFocusError:!0};function E6(e={}){let t={...C6,...e},a={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ua(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},i={},l=nn(t.defaultValues)||nn(t.values)?ln(t.defaultValues||t.values)||{}:{},u=t.shouldUnregister?{}:ln(l),d={action:!1,mount:!1,watch:!1},f={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},g,y=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let v={...x};const w={array:p0(),state:p0()},_=t.criteriaMode===Ia.all,R=P=>V=>{clearTimeout(y),y=setTimeout(P,V)},S=async P=>{if(!t.disabled&&(x.isValid||v.isValid||P)){const V=t.resolver?An((await U()).errors):await fe(i,!0);V!==a.isValid&&w.state.next({isValid:V})}},A=(P,V)=>{!t.disabled&&(x.isValidating||x.validatingFields||v.isValidating||v.validatingFields)&&((P||Array.from(f.mount)).forEach(Z=>{Z&&(V?xt(a.validatingFields,Z,V):tn(a.validatingFields,Z))}),w.state.next({validatingFields:a.validatingFields,isValidating:!An(a.validatingFields)}))},M=(P,V=[],Z,be,ue=!0,pe=!0)=>{if(be&&Z&&!t.disabled){if(d.action=!0,pe&&Array.isArray(_e(i,P))){const Ie=Z(_e(i,P),be.argA,be.argB);ue&&xt(i,P,Ie)}if(pe&&Array.isArray(_e(a.errors,P))){const Ie=Z(_e(a.errors,P),be.argA,be.argB);ue&&xt(a.errors,P,Ie),_6(a.errors,P)}if((x.touchedFields||v.touchedFields)&&pe&&Array.isArray(_e(a.touchedFields,P))){const Ie=Z(_e(a.touchedFields,P),be.argA,be.argB);ue&&xt(a.touchedFields,P,Ie)}(x.dirtyFields||v.dirtyFields)&&(a.dirtyFields=cs(l,u)),w.state.next({name:P,isDirty:he(P,V),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else xt(u,P,V)},T=(P,V)=>{xt(a.errors,P,V),w.state.next({errors:a.errors})},N=P=>{a.errors=P,w.state.next({errors:a.errors,isValid:!1})},E=(P,V,Z,be)=>{const ue=_e(i,P);if(ue){const pe=_e(u,P,Bt(Z)?_e(l,P):Z);Bt(pe)||be&&be.defaultChecked||V?xt(u,P,V?pe:v0(ue._f)):ce(P,pe),d.mount&&S()}},D=(P,V,Z,be,ue)=>{let pe=!1,Ie=!1;const ft={name:P};if(!t.disabled){if(!Z||be){(x.isDirty||v.isDirty)&&(Ie=a.isDirty,a.isDirty=ft.isDirty=he(),pe=Ie!==ft.isDirty);const ht=La(_e(l,P),V);Ie=!!_e(a.dirtyFields,P),ht?tn(a.dirtyFields,P):xt(a.dirtyFields,P,!0),ft.dirtyFields=a.dirtyFields,pe=pe||(x.dirtyFields||v.dirtyFields)&&Ie!==!ht}if(Z){const ht=_e(a.touchedFields,P);ht||(xt(a.touchedFields,P,Z),ft.touchedFields=a.touchedFields,pe=pe||(x.touchedFields||v.touchedFields)&&ht!==Z)}pe&&ue&&w.state.next(ft)}return pe?ft:{}},I=(P,V,Z,be)=>{const ue=_e(a.errors,P),pe=(x.isValid||v.isValid)&&oa(V)&&a.isValid!==V;if(t.delayError&&Z?(g=R(()=>T(P,Z)),g(t.delayError)):(clearTimeout(y),g=null,Z?xt(a.errors,P,Z):tn(a.errors,P)),(Z?!La(ue,Z):ue)||!An(be)||pe){const Ie={...be,...pe&&oa(V)?{isValid:V}:{},errors:a.errors,name:P};a={...a,...Ie},w.state.next(Ie)}},U=async P=>{A(P,!0);const V=await t.resolver(u,t.context,y6(P||f.mount,i,t.criteriaMode,t.shouldUseNativeValidation));return A(P),V},F=async P=>{const{errors:V}=await U(P);if(P)for(const Z of P){const be=_e(V,Z);be?xt(a.errors,Z,be):tn(a.errors,Z)}else a.errors=V;return V},fe=async(P,V,Z={valid:!0})=>{for(const be in P){const ue=P[be];if(ue){const{_f:pe,...Ie}=ue;if(pe){const ft=f.array.has(pe.name),ht=ue._f&&v6(ue._f);ht&&x.validatingFields&&A([pe.name],!0);const pn=await j0(ue,f.disabled,u,_,t.shouldUseNativeValidation&&!V,ft);if(ht&&x.validatingFields&&A([pe.name]),pn[pe.name]&&(Z.valid=!1,V))break;!V&&(_e(pn,pe.name)?ft?j6(a.errors,pn,pe.name):xt(a.errors,pe.name,pn[pe.name]):tn(a.errors,pe.name))}!An(Ie)&&await fe(Ie,V,Z)}}return Z.valid},ge=()=>{for(const P of f.unMount){const V=_e(i,P);V&&(V._f.refs?V._f.refs.every(Z=>!lm(Z)):!lm(V._f.ref))&&ee(P)}f.unMount=new Set},he=(P,V)=>!t.disabled&&(P&&V&&xt(u,P,V),!La(me(),l)),ne=(P,V,Z)=>Km(P,f,{...d.mount?u:Bt(V)?l:la(P)?{[P]:V}:V},Z,V),le=P=>zg(_e(d.mount?u:l,P,t.shouldUnregister?_e(l,P,[]):[])),ce=(P,V,Z={})=>{const be=_e(i,P);let ue=V;if(be){const pe=be._f;pe&&(!pe.disabled&&xt(u,P,B_(V,pe)),ue=Dd(pe.ref)&&Hn(V)?"":V,F_(pe.ref)?[...pe.ref.options].forEach(Ie=>Ie.selected=ue.includes(Ie.value)):pe.refs?vc(pe.ref)?pe.refs.forEach(Ie=>{(!Ie.defaultChecked||!Ie.disabled)&&(Array.isArray(ue)?Ie.checked=!!ue.find(ft=>ft===Ie.value):Ie.checked=ue===Ie.value||!!ue)}):pe.refs.forEach(Ie=>Ie.checked=Ie.value===ue):Ug(pe.ref)?pe.ref.value="":(pe.ref.value=ue,pe.ref.type||w.state.next({name:P,values:ln(u)})))}(Z.shouldDirty||Z.shouldTouch)&&D(P,ue,Z.shouldTouch,Z.shouldDirty,!0),Z.shouldValidate&&J(P)},ve=(P,V,Z)=>{for(const be in V){if(!V.hasOwnProperty(be))return;const ue=V[be],pe=P+"."+be,Ie=_e(i,pe);(f.array.has(P)||nn(ue)||Ie&&!Ie._f)&&!Qi(ue)?ve(pe,ue,Z):ce(pe,ue,Z)}},O=(P,V,Z={})=>{const be=_e(i,P),ue=f.array.has(P),pe=ln(V);xt(u,P,pe),ue?(w.array.next({name:P,values:ln(u)}),(x.isDirty||x.dirtyFields||v.isDirty||v.dirtyFields)&&Z.shouldDirty&&w.state.next({name:P,dirtyFields:cs(l,u),isDirty:he(P,pe)})):be&&!be._f&&!Hn(pe)?ve(P,pe,Z):ce(P,pe,Z),w0(P,f)&&w.state.next({...a,name:P}),w.state.next({name:d.mount?P:void 0,values:ln(u)})},j=async P=>{d.mount=!0;const V=P.target;let Z=V.name,be=!0;const ue=_e(i,Z),pe=ht=>{be=Number.isNaN(ht)||Qi(ht)&&isNaN(ht.getTime())||La(ht,_e(u,Z,ht))},Ie=x0(t.mode),ft=x0(t.reValidateMode);if(ue){let ht,pn;const zn=V.type?v0(ue._f):K_(P),Qn=P.type===Td.BLUR||P.type===Td.FOCUS_OUT,Ja=!x6(ue._f)&&!t.resolver&&!_e(a.errors,Z)&&!ue._f.deps||S6(Qn,_e(a.touchedFields,Z),a.isSubmitted,ft,Ie),Ta=w0(Z,f,Qn);xt(u,Z,zn),Qn?(!V||!V.readOnly)&&(ue._f.onBlur&&ue._f.onBlur(P),g&&g(0)):ue._f.onChange&&ue._f.onChange(P);const an=D(Z,zn,Qn),Jn=!An(an)||Ta;if(!Qn&&w.state.next({name:Z,type:P.type,values:ln(u)}),Ja)return(x.isValid||v.isValid)&&(t.mode==="onBlur"?Qn&&S():Qn||S()),Jn&&w.state.next({name:Z,...Ta?{}:an});if(!Qn&&Ta&&w.state.next({...a}),t.resolver){const{errors:rn}=await U([Z]);if(pe(zn),be){const Ps=S0(a.errors,i,Z),qr=S0(rn,i,Ps.name||Z);ht=qr.error,Z=qr.name,pn=An(rn)}}else A([Z],!0),ht=(await j0(ue,f.disabled,u,_,t.shouldUseNativeValidation))[Z],A([Z]),pe(zn),be&&(ht?pn=!1:(x.isValid||v.isValid)&&(pn=await fe(i,!0)));be&&(ue._f.deps&&(!Array.isArray(ue._f.deps)||ue._f.deps.length>0)&&J(ue._f.deps),I(Z,pn,ht,an))}},z=(P,V)=>{if(_e(a.errors,V)&&P.focus)return P.focus(),1},J=async(P,V={})=>{let Z,be;const ue=Yl(P);if(t.resolver){const pe=await F(Bt(P)?P:ue);Z=An(pe),be=P?!ue.some(Ie=>_e(pe,Ie)):Z}else P?(be=(await Promise.all(ue.map(async pe=>{const Ie=_e(i,pe);return await fe(Ie&&Ie._f?{[pe]:Ie}:Ie)}))).every(Boolean),!(!be&&!a.isValid)&&S()):be=Z=await fe(i);return w.state.next({...!la(P)||(x.isValid||v.isValid)&&Z!==a.isValid?{}:{name:P},...t.resolver||!P?{isValid:Z}:{},errors:a.errors}),V.shouldFocus&&!be&&Ql(i,z,P?ue:f.mount),be},me=(P,V)=>{let Z={...d.mount?u:l};return V&&(Z=q_(V.dirtyFields?a.dirtyFields:a.touchedFields,Z)),Bt(P)?Z:la(P)?_e(Z,P):P.map(be=>_e(Z,be))},Te=(P,V)=>({invalid:!!_e((V||a).errors,P),isDirty:!!_e((V||a).dirtyFields,P),error:_e((V||a).errors,P),isValidating:!!_e(a.validatingFields,P),isTouched:!!_e((V||a).touchedFields,P)}),H=P=>{P&&Yl(P).forEach(V=>tn(a.errors,V)),w.state.next({errors:P?a.errors:{}})},Y=(P,V,Z)=>{const be=(_e(i,P,{_f:{}})._f||{}).ref,ue=_e(a.errors,P)||{},{ref:pe,message:Ie,type:ft,...ht}=ue;xt(a.errors,P,{...ht,...V,ref:be}),w.state.next({name:P,errors:a.errors,isValid:!1}),Z&&Z.shouldFocus&&be&&be.focus&&be.focus()},oe=(P,V)=>Ua(P)?w.state.subscribe({next:Z=>"values"in Z&&P(ne(void 0,V),Z)}):ne(P,V,!0),se=P=>w.state.subscribe({next:V=>{w6(P.name,V.name,P.exact)&&b6(V,P.formState||x,Je,P.reRenderRoot)&&P.callback({values:{...u},...a,...V,defaultValues:l})}}).unsubscribe,we=P=>(d.mount=!0,v={...v,...P.formState},se({...P,formState:v})),ee=(P,V={})=>{for(const Z of P?Yl(P):f.mount)f.mount.delete(Z),f.array.delete(Z),V.keepValue||(tn(i,Z),tn(u,Z)),!V.keepError&&tn(a.errors,Z),!V.keepDirty&&tn(a.dirtyFields,Z),!V.keepTouched&&tn(a.touchedFields,Z),!V.keepIsValidating&&tn(a.validatingFields,Z),!t.shouldUnregister&&!V.keepDefaultValue&&tn(l,Z);w.state.next({values:ln(u)}),w.state.next({...a,...V.keepDirty?{isDirty:he()}:{}}),!V.keepIsValid&&S()},Se=({disabled:P,name:V})=>{(oa(P)&&d.mount||P||f.disabled.has(V))&&(P?f.disabled.add(V):f.disabled.delete(V))},De=(P,V={})=>{let Z=_e(i,P);const be=oa(V.disabled)||oa(t.disabled);return xt(i,P,{...Z||{},_f:{...Z&&Z._f?Z._f:{ref:{name:P}},name:P,mount:!0,...V}}),f.mount.add(P),Z?Se({disabled:oa(V.disabled)?V.disabled:t.disabled,name:P}):E(P,!0,V.value),{...be?{disabled:V.disabled||t.disabled}:{},...t.progressive?{required:!!V.required,min:Dl(V.min),max:Dl(V.max),minLength:Dl(V.minLength),maxLength:Dl(V.maxLength),pattern:Dl(V.pattern)}:{},name:P,onChange:j,onBlur:j,ref:ue=>{if(ue){De(P,V),Z=_e(i,P);const pe=Bt(ue.value)&&ue.querySelectorAll&&ue.querySelectorAll("input,select,textarea")[0]||ue,Ie=h6(pe),ft=Z._f.refs||[];if(Ie?ft.find(ht=>ht===pe):pe===Z._f.ref)return;xt(i,P,{_f:{...Z._f,...Ie?{refs:[...ft.filter(lm),pe,...Array.isArray(_e(l,P))?[{}]:[]],ref:{type:pe.type,name:P}}:{ref:pe}}}),E(P,!1,void 0,pe)}else Z=_e(i,P,{}),Z._f&&(Z._f.mount=!1),(t.shouldUnregister||V.shouldUnregister)&&!(I_(f.array,P)&&d.action)&&f.unMount.add(P)}}},He=()=>t.shouldFocusError&&Ql(i,z,f.mount),Qe=P=>{oa(P)&&(w.state.next({disabled:P}),Ql(i,(V,Z)=>{const be=_e(i,Z);be&&(V.disabled=be._f.disabled||P,Array.isArray(be._f.refs)&&be._f.refs.forEach(ue=>{ue.disabled=be._f.disabled||P}))},0,!1))},Ye=(P,V)=>async Z=>{let be;Z&&(Z.preventDefault&&Z.preventDefault(),Z.persist&&Z.persist());let ue=ln(u);if(w.state.next({isSubmitting:!0}),t.resolver){const{errors:pe,values:Ie}=await U();a.errors=pe,ue=ln(Ie)}else await fe(i);if(f.disabled.size)for(const pe of f.disabled)tn(ue,pe);if(tn(a.errors,"root"),An(a.errors)){w.state.next({errors:{}});try{await P(ue,Z)}catch(pe){be=pe}}else V&&await V({...a.errors},Z),He(),setTimeout(He);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:An(a.errors)&&!be,submitCount:a.submitCount+1,errors:a.errors}),be)throw be},Ft=(P,V={})=>{_e(i,P)&&(Bt(V.defaultValue)?O(P,ln(_e(l,P))):(O(P,V.defaultValue),xt(l,P,ln(V.defaultValue))),V.keepTouched||tn(a.touchedFields,P),V.keepDirty||(tn(a.dirtyFields,P),a.isDirty=V.defaultValue?he(P,ln(_e(l,P))):he()),V.keepError||(tn(a.errors,P),x.isValid&&S()),w.state.next({...a}))},G=(P,V={})=>{const Z=P?ln(P):l,be=ln(Z),ue=An(P),pe=ue?l:be;if(V.keepDefaultValues||(l=Z),!V.keepValues){if(V.keepDirtyValues){const Ie=new Set([...f.mount,...Object.keys(cs(l,u))]);for(const ft of Array.from(Ie))_e(a.dirtyFields,ft)?xt(pe,ft,_e(u,ft)):O(ft,_e(pe,ft))}else{if(kg&&Bt(P))for(const Ie of f.mount){const ft=_e(i,Ie);if(ft&&ft._f){const ht=Array.isArray(ft._f.refs)?ft._f.refs[0]:ft._f.ref;if(Dd(ht)){const pn=ht.closest("form");if(pn){pn.reset();break}}}}if(V.keepFieldsRef)for(const Ie of f.mount)O(Ie,_e(pe,Ie));else i={}}u=t.shouldUnregister?V.keepDefaultValues?ln(l):{}:ln(pe),w.array.next({values:{...pe}}),w.state.next({values:{...pe}})}f={mount:V.keepDirtyValues?f.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},d.mount=!x.isValid||!!V.keepIsValid||!!V.keepDirtyValues||!t.shouldUnregister&&!An(pe),d.watch=!!t.shouldUnregister,w.state.next({submitCount:V.keepSubmitCount?a.submitCount:0,isDirty:ue?!1:V.keepDirty?a.isDirty:!!(V.keepDefaultValues&&!La(P,l)),isSubmitted:V.keepIsSubmitted?a.isSubmitted:!1,dirtyFields:ue?{}:V.keepDirtyValues?V.keepDefaultValues&&u?cs(l,u):a.dirtyFields:V.keepDefaultValues&&P?cs(l,P):V.keepDirty?a.dirtyFields:{},touchedFields:V.keepTouched?a.touchedFields:{},errors:V.keepErrors?a.errors:{},isSubmitSuccessful:V.keepIsSubmitSuccessful?a.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:l})},Xe=(P,V)=>G(Ua(P)?P(u):P,V),qe=(P,V={})=>{const Z=_e(i,P),be=Z&&Z._f;if(be){const ue=be.refs?be.refs[0]:be.ref;ue.focus&&(ue.focus(),V.shouldSelect&&Ua(ue.select)&&ue.select())}},Je=P=>{a={...a,...P}},En={control:{register:De,unregister:ee,getFieldState:Te,handleSubmit:Ye,setError:Y,_subscribe:se,_runSchema:U,_focusError:He,_getWatch:ne,_getDirty:he,_setValid:S,_setFieldArray:M,_setDisabledField:Se,_setErrors:N,_getFieldArray:le,_reset:G,_resetDefaultValues:()=>Ua(t.defaultValues)&&t.defaultValues().then(P=>{Xe(P,t.resetOptions),w.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:Qe,_subjects:w,_proxyFormState:x,get _fields(){return i},get _formValues(){return u},get _state(){return d},set _state(P){d=P},get _defaultValues(){return l},get _names(){return f},set _names(P){f=P},get _formState(){return a},get _options(){return t},set _options(P){t={...t,...P}}},subscribe:we,trigger:J,register:De,handleSubmit:Ye,watch:oe,setValue:O,getValues:me,reset:Xe,resetField:Ft,clearErrors:H,unregister:ee,setError:Y,setFocus:qe,getFieldState:Te};return{...En,formControl:En}}function un(e={}){const t=Q.useRef(void 0),a=Q.useRef(void 0),[i,l]=Q.useState({isDirty:!1,isValidating:!1,isLoading:Ua(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ua(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!Ua(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:d,...f}=E6(e);t.current={...f,formState:i}}const u=t.current.control;return u._options=e,Ig(()=>{const d=u._subscribe({formState:u._proxyFormState,callback:()=>l({...u._formState}),reRenderRoot:!0});return l(f=>({...f,isReady:!0})),u._formState.isReady=!0,d},[u]),Q.useEffect(()=>u._disableForm(e.disabled),[u,e.disabled]),Q.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),Q.useEffect(()=>{e.errors&&(u._setErrors(e.errors),u._focusError())},[u,e.errors]),Q.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),Q.useEffect(()=>{if(u._proxyFormState.isDirty){const d=u._getDirty();d!==i.isDirty&&u._subjects.state.next({isDirty:d})}},[u,i.isDirty]),Q.useEffect(()=>{e.values&&!La(e.values,a.current)?(u._reset(e.values,{keepFieldsRef:!0,...u._options.resetOptions}),a.current=e.values,l(d=>({...d}))):u._resetDefaultValues()},[u,e.values]),Q.useEffect(()=>{u._state.mount||(u._setValid(),u._state.mount=!0),u._state.watch&&(u._state.watch=!1,u._subjects.state.next({...u._formState})),u._removeUnmounted()}),t.current.formState=L_(i,u),t.current}const C0=(e,t,a)=>{if(e&&"reportValidity"in e){const i=_e(a,t);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Um=(e,t)=>{for(const a in t.fields){const i=t.fields[a];i&&i.ref&&"reportValidity"in i.ref?C0(i.ref,a,e):i&&i.refs&&i.refs.forEach(l=>C0(l,a,e))}},E0=(e,t)=>{t.shouldUseNativeValidation&&Um(e,t);const a={};for(const i in e){const l=_e(t.fields,i),u=Object.assign(e[i]||{},{ref:l&&l.ref});if(R6(t.names||Object.keys(e),i)){const d=Object.assign({},_e(a,i));xt(d,"root",u),xt(a,i,d)}else xt(a,i,u)}return a},R6=(e,t)=>{const a=R0(t);return e.some(i=>R0(i).match(`^${a}\\.\\d+`))};function R0(e){return e.replace(/\]|\[/g,"")}function re(e,t,a){function i(f,g){var y;Object.defineProperty(f,"_zod",{value:f._zod??{},enumerable:!1}),(y=f._zod).traits??(y.traits=new Set),f._zod.traits.add(e),t(f,g);for(const x in d.prototype)x in f||Object.defineProperty(f,x,{value:d.prototype[x].bind(f)});f._zod.constr=d,f._zod.def=g}const l=a?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(f){var g;const y=a?.Parent?new u:this;i(y,f),(g=y._zod).deferred??(g.deferred=[]);for(const x of y._zod.deferred)x();return y}return Object.defineProperty(d,"init",{value:i}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>a?.Parent&&f instanceof a.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}class bs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class H_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const X_={};function ro(e){return X_}function N6(e){const t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,l])=>t.indexOf(+i)===-1).map(([i,l])=>l)}function qm(e,t){return typeof t=="bigint"?t.toString():t}function Fg(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function $g(e){return e==null}function Vg(e){const t=e.startsWith("^")?1:0,a=e.endsWith("$")?e.length-1:e.length;return e.slice(t,a)}function O6(e,t){const a=(e.toString().split(".")[1]||"").length,i=t.toString();let l=(i.split(".")[1]||"").length;if(l===0&&/\d?e-\d?/.test(i)){const g=i.match(/\d?e-(\d?)/);g?.[1]&&(l=Number.parseInt(g[1]))}const u=a>l?a:l,d=Number.parseInt(e.toFixed(u).replace(".","")),f=Number.parseInt(t.toFixed(u).replace(".",""));return d%f/10**u}const N0=Symbol("evaluating");function Ot(e,t,a){let i;Object.defineProperty(e,t,{get(){if(i!==N0)return i===void 0&&(i=N0,i=a()),i},set(l){Object.defineProperty(e,t,{value:l})},configurable:!0})}function lo(e,t,a){Object.defineProperty(e,t,{value:a,writable:!0,enumerable:!0,configurable:!0})}function co(...e){const t={};for(const a of e){const i=Object.getOwnPropertyDescriptors(a);Object.assign(t,i)}return Object.defineProperties({},t)}function O0(e){return JSON.stringify(e)}const Z_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function kd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const A6=Fg(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ac(e){if(kd(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const a=t.prototype;return!(kd(a)===!1||Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)}function Y_(e){return ac(e)?{...e}:Array.isArray(e)?[...e]:e}const T6=new Set(["string","number","symbol"]);function Cs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ei(e,t,a){const i=new e._zod.constr(t??e._zod.def);return(!t||a?.parent)&&(i._zod.parent=e),i}function Ve(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function D6(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const M6={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function k6(e,t){const a=e._zod.def,i=co(e._zod.def,{get shape(){const l={};for(const u in t){if(!(u in a.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(l[u]=a.shape[u])}return lo(this,"shape",l),l},checks:[]});return Ei(e,i)}function z6(e,t){const a=e._zod.def,i=co(e._zod.def,{get shape(){const l={...e._zod.def.shape};for(const u in t){if(!(u in a.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete l[u]}return lo(this,"shape",l),l},checks:[]});return Ei(e,i)}function P6(e,t){if(!ac(t))throw new Error("Invalid input to extend: expected a plain object");const a=e._zod.def.checks;if(a&&a.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const l=co(e._zod.def,{get shape(){const u={...e._zod.def.shape,...t};return lo(this,"shape",u),u},checks:[]});return Ei(e,l)}function K6(e,t){if(!ac(t))throw new Error("Invalid input to safeExtend: expected a plain object");const a={...e._zod.def,get shape(){const i={...e._zod.def.shape,...t};return lo(this,"shape",i),i},checks:e._zod.def.checks};return Ei(e,a)}function I6(e,t){const a=co(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t._zod.def.shape};return lo(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return Ei(e,a)}function L6(e,t,a){const i=co(t._zod.def,{get shape(){const l=t._zod.def.shape,u={...l};if(a)for(const d in a){if(!(d in l))throw new Error(`Unrecognized key: "${d}"`);a[d]&&(u[d]=e?new e({type:"optional",innerType:l[d]}):l[d])}else for(const d in l)u[d]=e?new e({type:"optional",innerType:l[d]}):l[d];return lo(this,"shape",u),u},checks:[]});return Ei(t,i)}function U6(e,t,a){const i=co(t._zod.def,{get shape(){const l=t._zod.def.shape,u={...l};if(a)for(const d in a){if(!(d in u))throw new Error(`Unrecognized key: "${d}"`);a[d]&&(u[d]=new e({type:"nonoptional",innerType:l[d]}))}else for(const d in l)u[d]=new e({type:"nonoptional",innerType:l[d]});return lo(this,"shape",u),u},checks:[]});return Ei(t,i)}function ms(e,t=0){if(e.aborted===!0)return!0;for(let a=t;a{var i;return(i=a).path??(i.path=[]),a.path.unshift(e),a})}function ad(e){return typeof e=="string"?e:e?.message}function io(e,t,a){const i={...e,path:e.path??[]};if(!e.message){const l=ad(e.inst?._zod.def?.error?.(e))??ad(t?.error?.(e))??ad(a.customError?.(e))??ad(a.localeError?.(e))??"Invalid input";i.message=l}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Bg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function rc(...e){const[t,a,i]=e;return typeof t=="string"?{message:t,code:"custom",input:a,inst:i}:{...t}}const J_=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,qm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Gg=re("$ZodError",J_),pf=re("$ZodError",J_,{Parent:Error});function q6(e,t=a=>a.message){const a={},i=[];for(const l of e.issues)l.path.length>0?(a[l.path[0]]=a[l.path[0]]||[],a[l.path[0]].push(t(l))):i.push(t(l));return{formErrors:i,fieldErrors:a}}function F6(e,t=a=>a.message){const a={_errors:[]},i=l=>{for(const u of l.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d}));else if(u.code==="invalid_key")i({issues:u.issues});else if(u.code==="invalid_element")i({issues:u.issues});else if(u.path.length===0)a._errors.push(t(u));else{let d=a,f=0;for(;f(t,a,i,l)=>{const u=i?Object.assign(i,{async:!1}):{async:!1},d=t._zod.run({value:a,issues:[]},u);if(d instanceof Promise)throw new bs;if(d.issues.length){const f=new(l?.Err??e)(d.issues.map(g=>io(g,u,ro())));throw Z_(f,l?.callee),f}return d.value},$6=mf(pf),gf=e=>async(t,a,i,l)=>{const u=i?Object.assign(i,{async:!0}):{async:!0};let d=t._zod.run({value:a,issues:[]},u);if(d instanceof Promise&&(d=await d),d.issues.length){const f=new(l?.Err??e)(d.issues.map(g=>io(g,u,ro())));throw Z_(f,l?.callee),f}return d.value},V6=gf(pf),yf=e=>(t,a,i)=>{const l=i?{...i,async:!1}:{async:!1},u=t._zod.run({value:a,issues:[]},l);if(u instanceof Promise)throw new bs;return u.issues.length?{success:!1,error:new(e??Gg)(u.issues.map(d=>io(d,l,ro())))}:{success:!0,data:u.value}},B6=yf(pf),vf=e=>async(t,a,i)=>{const l=i?Object.assign(i,{async:!0}):{async:!0};let u=t._zod.run({value:a,issues:[]},l);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(d=>io(d,l,ro())))}:{success:!0,data:u.value}},G6=vf(pf),H6=e=>(t,a,i)=>{const l=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return mf(e)(t,a,l)},X6=e=>(t,a,i)=>mf(e)(t,a,i),Z6=e=>async(t,a,i)=>{const l=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return gf(e)(t,a,l)},Y6=e=>async(t,a,i)=>gf(e)(t,a,i),Q6=e=>(t,a,i)=>{const l=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return yf(e)(t,a,l)},J6=e=>(t,a,i)=>yf(e)(t,a,i),W6=e=>async(t,a,i)=>{const l=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return vf(e)(t,a,l)},eP=e=>async(t,a,i)=>vf(e)(t,a,i),tP=/^[cC][^\s-]{8,}$/,nP=/^[0-9a-z]+$/,aP=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rP=/^[0-9a-vA-V]{20}$/,iP=/^[A-Za-z0-9]{27}$/,oP=/^[a-zA-Z0-9_-]{21}$/,sP=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,lP=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,A0=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,cP=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,uP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function dP(){return new RegExp(uP,"u")}const fP=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,pP=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,mP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,gP=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,W_=/^[A-Za-z0-9_-]*$/,yP=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,vP=/^\+(?:[0-9]){6,14}[0-9]$/,ej="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",xP=new RegExp(`^${ej}$`);function tj(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function bP(e){return new RegExp(`^${tj(e)}$`)}function wP(e){const t=tj({precision:e.precision}),a=["Z"];e.local&&a.push(""),e.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${a.join("|")})`;return new RegExp(`^${ej}T(?:${i})$`)}const SP=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},_P=/^-?\d+$/,jP=/^-?\d+(?:\.\d+)?/,CP=/^[^A-Z]*$/,EP=/^[^a-z]*$/,Yn=re("$ZodCheck",(e,t)=>{var a;e._zod??(e._zod={}),e._zod.def=t,(a=e._zod).onattach??(a.onattach=[])}),nj={number:"number",bigint:"bigint",object:"date"},aj=re("$ZodCheckLessThan",(e,t)=>{Yn.init(e,t);const a=nj[typeof t.value];e._zod.onattach.push(i=>{const l=i._zod.bag,u=(t.inclusive?l.maximum:l.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?i.value<=t.value:i.value{Yn.init(e,t);const a=nj[typeof t.value];e._zod.onattach.push(i=>{const l=i._zod.bag,u=(t.inclusive?l.minimum:l.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>u&&(t.inclusive?l.minimum=t.value:l.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:a,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),RP=re("$ZodCheckMultipleOf",(e,t)=>{Yn.init(e,t),e._zod.onattach.push(a=>{var i;(i=a._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=a=>{if(typeof a.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof a.value=="bigint"?a.value%t.value===BigInt(0):O6(a.value,t.value)===0)||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:t.value,input:a.value,inst:e,continue:!t.abort})}}),NP=re("$ZodCheckNumberFormat",(e,t)=>{Yn.init(e,t),t.format=t.format||"float64";const a=t.format?.includes("int"),i=a?"int":"number",[l,u]=M6[t.format];e._zod.onattach.push(d=>{const f=d._zod.bag;f.format=t.format,f.minimum=l,f.maximum=u,a&&(f.pattern=_P)}),e._zod.check=d=>{const f=d.value;if(a){if(!Number.isInteger(f)){d.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?d.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):d.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});return}}fu&&d.issues.push({origin:"number",input:f,code:"too_big",maximum:u,inst:e})}}),OP=re("$ZodCheckMaxLength",(e,t)=>{var a;Yn.init(e,t),(a=e._zod.def).when??(a.when=i=>{const l=i.value;return!$g(l)&&l.length!==void 0}),e._zod.onattach.push(i=>{const l=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const l=i.value;if(l.length<=t.maximum)return;const d=Bg(l);i.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:l,inst:e,continue:!t.abort})}}),AP=re("$ZodCheckMinLength",(e,t)=>{var a;Yn.init(e,t),(a=e._zod.def).when??(a.when=i=>{const l=i.value;return!$g(l)&&l.length!==void 0}),e._zod.onattach.push(i=>{const l=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>l&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{const l=i.value;if(l.length>=t.minimum)return;const d=Bg(l);i.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:l,inst:e,continue:!t.abort})}}),TP=re("$ZodCheckLengthEquals",(e,t)=>{var a;Yn.init(e,t),(a=e._zod.def).when??(a.when=i=>{const l=i.value;return!$g(l)&&l.length!==void 0}),e._zod.onattach.push(i=>{const l=i._zod.bag;l.minimum=t.length,l.maximum=t.length,l.length=t.length}),e._zod.check=i=>{const l=i.value,u=l.length;if(u===t.length)return;const d=Bg(l),f=u>t.length;i.issues.push({origin:d,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),xf=re("$ZodCheckStringFormat",(e,t)=>{var a,i;Yn.init(e,t),e._zod.onattach.push(l=>{const u=l._zod.bag;u.format=t.format,t.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(t.pattern))}),t.pattern?(a=e._zod).check??(a.check=l=>{t.pattern.lastIndex=0,!t.pattern.test(l.value)&&l.issues.push({origin:"string",code:"invalid_format",format:t.format,input:l.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),DP=re("$ZodCheckRegex",(e,t)=>{xf.init(e,t),e._zod.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),MP=re("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=CP),xf.init(e,t)}),kP=re("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=EP),xf.init(e,t)}),zP=re("$ZodCheckIncludes",(e,t)=>{Yn.init(e,t);const a=Cs(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${a}`:a);t.pattern=i,e._zod.onattach.push(l=>{const u=l._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(i)}),e._zod.check=l=>{l.value.includes(t.includes,t.position)||l.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:l.value,inst:e,continue:!t.abort})}}),PP=re("$ZodCheckStartsWith",(e,t)=>{Yn.init(e,t);const a=new RegExp(`^${Cs(t.prefix)}.*`);t.pattern??(t.pattern=a),e._zod.onattach.push(i=>{const l=i._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(a)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),KP=re("$ZodCheckEndsWith",(e,t)=>{Yn.init(e,t);const a=new RegExp(`.*${Cs(t.suffix)}$`);t.pattern??(t.pattern=a),e._zod.onattach.push(i=>{const l=i._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(a)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}}),IP=re("$ZodCheckOverwrite",(e,t)=>{Yn.init(e,t),e._zod.check=a=>{a.value=t.tx(a.value)}});class LP{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const i=t.split(` `).filter(d=>d),l=Math.min(...i.map(d=>d.length-d.trimStart().length)),u=i.map(d=>d.slice(l)).map(d=>" ".repeat(this.indent*2)+d);for(const d of u)this.content.push(d)}compile(){const t=Function,a=this?.args,l=[...(this?.content??[""]).map(u=>` ${u}`)];return new t(...a,l.join(` `))}}const UP={major:4,minor:1,patch:12},Gt=re("$ZodType",(e,t)=>{var a;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=UP;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const l of i)for(const u of l._zod.onattach)u(e);if(i.length===0)(a=e._zod).deferred??(a.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const l=(d,f,g)=>{let y=ms(d),x;for(const v of f){if(v._zod.def.when){if(!v._zod.def.when(d))continue}else if(y)continue;const w=d.issues.length,_=v._zod.check(d);if(_ instanceof Promise&&g?.async===!1)throw new bs;if(x||_ instanceof Promise)x=(x??Promise.resolve()).then(async()=>{await _,d.issues.length!==w&&(y||(y=ms(d,w)))});else{if(d.issues.length===w)continue;y||(y=ms(d,w))}}return x?x.then(()=>d):d},u=(d,f,g)=>{if(ms(d))return d.aborted=!0,d;const y=l(f,i,g);if(y instanceof Promise){if(g.async===!1)throw new bs;return y.then(x=>e._zod.parse(x,g))}return e._zod.parse(y,g)};e._zod.run=(d,f)=>{if(f.skipChecks)return e._zod.parse(d,f);if(f.direction==="backward"){const y=e._zod.parse({value:d.value,issues:[]},{...f,skipChecks:!0});return y instanceof Promise?y.then(x=>u(x,d,f)):u(y,d,f)}const g=e._zod.parse(d,f);if(g instanceof Promise){if(f.async===!1)throw new bs;return g.then(y=>l(y,i,f))}return l(g,i,f)}}e["~standard"]={validate:l=>{try{const u=B6(e,l);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return G6(e,l).then(d=>d.success?{value:d.data}:{issues:d.error?.issues})}},vendor:"zod",version:1}}),Hg=re("$ZodString",(e,t)=>{Gt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??SP(e._zod.bag),e._zod.parse=(a,i)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),Lt=re("$ZodStringFormat",(e,t)=>{xf.init(e,t),Hg.init(e,t)}),qP=re("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=lP),Lt.init(e,t)}),FP=re("$ZodUUID",(e,t)=>{if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=A0(i))}else t.pattern??(t.pattern=A0());Lt.init(e,t)}),$P=re("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=cP),Lt.init(e,t)}),VP=re("$ZodURL",(e,t)=>{Lt.init(e,t),e._zod.check=a=>{try{const i=a.value.trim(),l=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(l.hostname)||a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:yP.source,input:a.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(l.protocol.endsWith(":")?l.protocol.slice(0,-1):l.protocol)||a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:a.value,inst:e,continue:!t.abort})),t.normalize?a.value=l.href:a.value=i;return}catch{a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:e,continue:!t.abort})}}}),BP=re("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=dP()),Lt.init(e,t)}),GP=re("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=oP),Lt.init(e,t)}),HP=re("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=tP),Lt.init(e,t)}),XP=re("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=nP),Lt.init(e,t)}),ZP=re("$ZodULID",(e,t)=>{t.pattern??(t.pattern=aP),Lt.init(e,t)}),YP=re("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rP),Lt.init(e,t)}),QP=re("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=iP),Lt.init(e,t)}),JP=re("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=wP(t)),Lt.init(e,t)}),WP=re("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xP),Lt.init(e,t)}),eK=re("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=bP(t)),Lt.init(e,t)}),tK=re("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=sP),Lt.init(e,t)}),nK=re("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=fP),Lt.init(e,t),e._zod.onattach.push(a=>{const i=a._zod.bag;i.format="ipv4"})}),aK=re("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=hP),Lt.init(e,t),e._zod.onattach.push(a=>{const i=a._zod.bag;i.format="ipv6"}),e._zod.check=a=>{try{new URL(`http://[${a.value}]`)}catch{a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:e,continue:!t.abort})}}}),rK=re("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pP),Lt.init(e,t)}),iK=re("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=mP),Lt.init(e,t),e._zod.check=a=>{const i=a.value.split("/");try{if(i.length!==2)throw new Error;const[l,u]=i;if(!u)throw new Error;const d=Number(u);if(`${d}`!==u)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${l}]`)}catch{a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:e,continue:!t.abort})}}});function ij(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const oK=re("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gP),Lt.init(e,t),e._zod.onattach.push(a=>{a._zod.bag.contentEncoding="base64"}),e._zod.check=a=>{ij(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:e,continue:!t.abort})}});function sK(e){if(!W_.test(e))return!1;const t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),a=t.padEnd(Math.ceil(t.length/4)*4,"=");return ij(a)}const lK=re("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=W_),Lt.init(e,t),e._zod.onattach.push(a=>{a._zod.bag.contentEncoding="base64url"}),e._zod.check=a=>{sK(a.value)||a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:e,continue:!t.abort})}}),cK=re("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vP),Lt.init(e,t)});function uK(e,t=null){try{const a=e.split(".");if(a.length!==3)return!1;const[i]=a;if(!i)return!1;const l=JSON.parse(atob(i));return!("typ"in l&&l?.typ!=="JWT"||!l.alg||t&&(!("alg"in l)||l.alg!==t))}catch{return!1}}const dK=re("$ZodJWT",(e,t)=>{Lt.init(e,t),e._zod.check=a=>{uK(a.value,t.alg)||a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:e,continue:!t.abort})}}),oj=re("$ZodNumber",(e,t)=>{Gt.init(e,t),e._zod.pattern=e._zod.bag.pattern??jP,e._zod.parse=(a,i)=>{if(t.coerce)try{a.value=Number(a.value)}catch{}const l=a.value;if(typeof l=="number"&&!Number.isNaN(l)&&Number.isFinite(l))return a;const u=typeof l=="number"?Number.isNaN(l)?"NaN":Number.isFinite(l)?void 0:"Infinity":void 0;return a.issues.push({expected:"number",code:"invalid_type",input:l,inst:e,...u?{received:u}:{}}),a}}),fK=re("$ZodNumber",(e,t)=>{NP.init(e,t),oj.init(e,t)}),hK=re("$ZodAny",(e,t)=>{Gt.init(e,t),e._zod.parse=a=>a}),pK=re("$ZodUnknown",(e,t)=>{Gt.init(e,t),e._zod.parse=a=>a}),mK=re("$ZodNever",(e,t)=>{Gt.init(e,t),e._zod.parse=(a,i)=>(a.issues.push({expected:"never",code:"invalid_type",input:a.value,inst:e}),a)});function T0(e,t,a){e.issues.length&&t.issues.push(...Q_(a,e.issues)),t.value[a]=e.value}const gK=re("$ZodArray",(e,t)=>{Gt.init(e,t),e._zod.parse=(a,i)=>{const l=a.value;if(!Array.isArray(l))return a.issues.push({expected:"array",code:"invalid_type",input:l,inst:e}),a;a.value=Array(l.length);const u=[];for(let d=0;dT0(y,a,d))):T0(g,a,d)}return u.length?Promise.all(u).then(()=>a):a}});function zd(e,t,a,i){e.issues.length&&t.issues.push(...Q_(a,e.issues)),e.value===void 0?a in i&&(t.value[a]=void 0):t.value[a]=e.value}function sj(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const a=D6(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function lj(e,t,a,i,l,u){const d=[],f=l.keySet,g=l.catchall._zod,y=g.def.type;for(const x of Object.keys(t)){if(f.has(x))continue;if(y==="never"){d.push(x);continue}const v=g.run({value:t[x],issues:[]},i);v instanceof Promise?e.push(v.then(w=>zd(w,a,x,t))):zd(v,a,x,t)}return d.length&&a.issues.push({code:"unrecognized_keys",keys:d,input:t,inst:u}),e.length?Promise.all(e).then(()=>a):a}const yK=re("$ZodObject",(e,t)=>{if(Gt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const g={...f};return Object.defineProperty(t,"shape",{value:g}),g}})}const i=Fg(()=>sj(t));Ot(e._zod,"propValues",()=>{const f=t.shape,g={};for(const y in f){const x=f[y]._zod;if(x.values){g[y]??(g[y]=new Set);for(const v of x.values)g[y].add(v)}}return g});const l=kd,u=t.catchall;let d;e._zod.parse=(f,g)=>{d??(d=i.value);const y=f.value;if(!l(y))return f.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),f;f.value={};const x=[],v=d.shape;for(const w of d.keys){const R=v[w]._zod.run({value:y[w],issues:[]},g);R instanceof Promise?x.push(R.then(S=>zd(S,f,w,y))):zd(R,f,w,y)}return u?lj(x,y,f,g,i.value,e):x.length?Promise.all(x).then(()=>f):f}}),vK=re("$ZodObjectJIT",(e,t)=>{yK.init(e,t);const a=e._zod.parse,i=Fg(()=>sj(t)),l=w=>{const _=new LP(["shape","payload","ctx"]),R=i.value,S=N=>{const E=O0(N);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};_.write("const input = payload.value;");const A=Object.create(null);let M=0;for(const N of R.keys)A[N]=`key_${M++}`;_.write("const newResult = {};");for(const N of R.keys){const E=A[N],D=O0(N);_.write(`const ${E} = ${S(N)};`),_.write(` if (${E}.issues.length) { payload.issues = payload.issues.concat(${E}.issues.map(iss => ({ ...iss, path: iss.path ? [${D}, ...iss.path] : [${D}] }))); } if (${E}.value === undefined) { if (${D} in input) { newResult[${D}] = undefined; } } else { newResult[${D}] = ${E}.value; } `)}_.write("payload.value = newResult;"),_.write("return payload;");const T=_.compile();return(N,E)=>T(w,N,E)};let u;const d=kd,f=!X_.jitless,y=f&&A6.value,x=t.catchall;let v;e._zod.parse=(w,_)=>{v??(v=i.value);const R=w.value;return d(R)?f&&y&&_?.async===!1&&_.jitless!==!0?(u||(u=l(t.shape)),w=u(w,_),x?lj([],R,w,_,v,e):w):a(w,_):(w.issues.push({expected:"object",code:"invalid_type",input:R,inst:e}),w)}});function D0(e,t,a,i){for(const u of e)if(u.issues.length===0)return t.value=u.value,t;const l=e.filter(u=>!ms(u));return l.length===1?(t.value=l[0].value,l[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:a,errors:e.map(u=>u.issues.map(d=>io(d,i,ro())))}),t)}const xK=re("$ZodUnion",(e,t)=>{Gt.init(e,t),Ot(e._zod,"optin",()=>t.options.some(l=>l._zod.optin==="optional")?"optional":void 0),Ot(e._zod,"optout",()=>t.options.some(l=>l._zod.optout==="optional")?"optional":void 0),Ot(e._zod,"values",()=>{if(t.options.every(l=>l._zod.values))return new Set(t.options.flatMap(l=>Array.from(l._zod.values)))}),Ot(e._zod,"pattern",()=>{if(t.options.every(l=>l._zod.pattern)){const l=t.options.map(u=>u._zod.pattern);return new RegExp(`^(${l.map(u=>Vg(u.source)).join("|")})$`)}});const a=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(l,u)=>{if(a)return i(l,u);let d=!1;const f=[];for(const g of t.options){const y=g._zod.run({value:l.value,issues:[]},u);if(y instanceof Promise)f.push(y),d=!0;else{if(y.issues.length===0)return y;f.push(y)}}return d?Promise.all(f).then(g=>D0(g,l,e,u)):D0(f,l,e,u)}}),bK=re("$ZodIntersection",(e,t)=>{Gt.init(e,t),e._zod.parse=(a,i)=>{const l=a.value,u=t.left._zod.run({value:l,issues:[]},i),d=t.right._zod.run({value:l,issues:[]},i);return u instanceof Promise||d instanceof Promise?Promise.all([u,d]).then(([g,y])=>M0(a,g,y)):M0(a,u,d)}});function Fm(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ac(e)&&ac(t)){const a=Object.keys(t),i=Object.keys(e).filter(u=>a.indexOf(u)!==-1),l={...e,...t};for(const u of i){const d=Fm(e[u],t[u]);if(!d.valid)return{valid:!1,mergeErrorPath:[u,...d.mergeErrorPath]};l[u]=d.data}return{valid:!0,data:l}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let i=0;i{Gt.init(e,t);const a=N6(t.entries),i=new Set(a);e._zod.values=i,e._zod.pattern=new RegExp(`^(${a.filter(l=>T6.has(typeof l)).map(l=>typeof l=="string"?Cs(l):l.toString()).join("|")})$`),e._zod.parse=(l,u)=>{const d=l.value;return i.has(d)||l.issues.push({code:"invalid_value",values:a,input:d,inst:e}),l}}),SK=re("$ZodLiteral",(e,t)=>{if(Gt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?Cs(a):a?Cs(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,i)=>{const l=a.value;return e._zod.values.has(l)||a.issues.push({code:"invalid_value",values:t.values,input:l,inst:e}),a}}),_K=re("$ZodTransform",(e,t)=>{Gt.init(e,t),e._zod.parse=(a,i)=>{if(i.direction==="backward")throw new H_(e.constructor.name);const l=t.transform(a.value,a);if(i.async)return(l instanceof Promise?l:Promise.resolve(l)).then(d=>(a.value=d,a));if(l instanceof Promise)throw new bs;return a.value=l,a}});function k0(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const jK=re("$ZodOptional",(e,t)=>{Gt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ot(e._zod,"pattern",()=>{const a=t.innerType._zod.pattern;return a?new RegExp(`^(${Vg(a.source)})?$`):void 0}),e._zod.parse=(a,i)=>{if(t.innerType._zod.optin==="optional"){const l=t.innerType._zod.run(a,i);return l instanceof Promise?l.then(u=>k0(u,a.value)):k0(l,a.value)}return a.value===void 0?a:t.innerType._zod.run(a,i)}}),CK=re("$ZodNullable",(e,t)=>{Gt.init(e,t),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),Ot(e._zod,"pattern",()=>{const a=t.innerType._zod.pattern;return a?new RegExp(`^(${Vg(a.source)}|null)$`):void 0}),Ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(a,i)=>a.value===null?a:t.innerType._zod.run(a,i)}),EK=re("$ZodDefault",(e,t)=>{Gt.init(e,t),e._zod.optin="optional",Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,i)=>{if(i.direction==="backward")return t.innerType._zod.run(a,i);if(a.value===void 0)return a.value=t.defaultValue,a;const l=t.innerType._zod.run(a,i);return l instanceof Promise?l.then(u=>z0(u,t)):z0(l,t)}});function z0(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const RK=re("$ZodPrefault",(e,t)=>{Gt.init(e,t),e._zod.optin="optional",Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,i)=>(i.direction==="backward"||a.value===void 0&&(a.value=t.defaultValue),t.innerType._zod.run(a,i))}),NK=re("$ZodNonOptional",(e,t)=>{Gt.init(e,t),Ot(e._zod,"values",()=>{const a=t.innerType._zod.values;return a?new Set([...a].filter(i=>i!==void 0)):void 0}),e._zod.parse=(a,i)=>{const l=t.innerType._zod.run(a,i);return l instanceof Promise?l.then(u=>P0(u,e)):P0(l,e)}});function P0(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const OK=re("$ZodCatch",(e,t)=>{Gt.init(e,t),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,i)=>{if(i.direction==="backward")return t.innerType._zod.run(a,i);const l=t.innerType._zod.run(a,i);return l instanceof Promise?l.then(u=>(a.value=u.value,u.issues.length&&(a.value=t.catchValue({...a,error:{issues:u.issues.map(d=>io(d,i,ro()))},input:a.value}),a.issues=[]),a)):(a.value=l.value,l.issues.length&&(a.value=t.catchValue({...a,error:{issues:l.issues.map(u=>io(u,i,ro()))},input:a.value}),a.issues=[]),a)}}),AK=re("$ZodPipe",(e,t)=>{Gt.init(e,t),Ot(e._zod,"values",()=>t.in._zod.values),Ot(e._zod,"optin",()=>t.in._zod.optin),Ot(e._zod,"optout",()=>t.out._zod.optout),Ot(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(a,i)=>{if(i.direction==="backward"){const u=t.out._zod.run(a,i);return u instanceof Promise?u.then(d=>rd(d,t.in,i)):rd(u,t.in,i)}const l=t.in._zod.run(a,i);return l instanceof Promise?l.then(u=>rd(u,t.out,i)):rd(l,t.out,i)}});function rd(e,t,a){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},a)}const TK=re("$ZodReadonly",(e,t)=>{Gt.init(e,t),Ot(e._zod,"propValues",()=>t.innerType._zod.propValues),Ot(e._zod,"values",()=>t.innerType._zod.values),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(a,i)=>{if(i.direction==="backward")return t.innerType._zod.run(a,i);const l=t.innerType._zod.run(a,i);return l instanceof Promise?l.then(K0):K0(l)}});function K0(e){return e.value=Object.freeze(e.value),e}const DK=re("$ZodCustom",(e,t)=>{Yn.init(e,t),Gt.init(e,t),e._zod.parse=(a,i)=>a,e._zod.check=a=>{const i=a.value,l=t.fn(i);if(l instanceof Promise)return l.then(u=>I0(u,a,i,e));I0(l,a,i,e)}});function I0(e,t,a,i){if(!e){const l={code:"custom",input:a,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(l.params=i._zod.def.params),t.issues.push(rc(l))}}class MK{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...a){const i=a[0];if(this._map.set(t,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const a=this._map.get(t);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(t),this}get(t){const a=t._zod.parent;if(a){const i={...this.get(a)??{}};delete i.id;const l={...i,...this._map.get(t)};return Object.keys(l).length?l:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function kK(){return new MK}const id=kK();function zK(e,t){return new e({type:"string",...Ve(t)})}function PK(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ve(t)})}function L0(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ve(t)})}function cj(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ve(t)})}function KK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ve(t)})}function IK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ve(t)})}function LK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ve(t)})}function UK(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ve(t)})}function qK(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ve(t)})}function FK(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ve(t)})}function $K(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ve(t)})}function VK(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ve(t)})}function BK(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ve(t)})}function GK(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ve(t)})}function HK(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ve(t)})}function XK(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ve(t)})}function ZK(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ve(t)})}function YK(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ve(t)})}function QK(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ve(t)})}function JK(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ve(t)})}function WK(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ve(t)})}function eI(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ve(t)})}function tI(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ve(t)})}function nI(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ve(t)})}function aI(e,t){return new e({type:"string",format:"date",check:"string_format",...Ve(t)})}function rI(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ve(t)})}function iI(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ve(t)})}function oI(e,t){return new e({type:"number",checks:[],...Ve(t)})}function sI(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ve(t)})}function lI(e){return new e({type:"any"})}function cI(e){return new e({type:"unknown"})}function uI(e,t){return new e({type:"never",...Ve(t)})}function U0(e,t){return new aj({check:"less_than",...Ve(t),value:e,inclusive:!1})}function cm(e,t){return new aj({check:"less_than",...Ve(t),value:e,inclusive:!0})}function q0(e,t){return new rj({check:"greater_than",...Ve(t),value:e,inclusive:!1})}function um(e,t){return new rj({check:"greater_than",...Ve(t),value:e,inclusive:!0})}function F0(e,t){return new RP({check:"multiple_of",...Ve(t),value:e})}function uj(e,t){return new OP({check:"max_length",...Ve(t),maximum:e})}function Pd(e,t){return new AP({check:"min_length",...Ve(t),minimum:e})}function dj(e,t){return new TP({check:"length_equals",...Ve(t),length:e})}function dI(e,t){return new DP({check:"string_format",format:"regex",...Ve(t),pattern:e})}function fI(e){return new MP({check:"string_format",format:"lowercase",...Ve(e)})}function hI(e){return new kP({check:"string_format",format:"uppercase",...Ve(e)})}function pI(e,t){return new zP({check:"string_format",format:"includes",...Ve(t),includes:e})}function mI(e,t){return new PP({check:"string_format",format:"starts_with",...Ve(t),prefix:e})}function gI(e,t){return new KP({check:"string_format",format:"ends_with",...Ve(t),suffix:e})}function xc(e){return new IP({check:"overwrite",tx:e})}function yI(e){return xc(t=>t.normalize(e))}function vI(){return xc(e=>e.trim())}function xI(){return xc(e=>e.toLowerCase())}function bI(){return xc(e=>e.toUpperCase())}function wI(e,t,a){return new e({type:"array",element:t,...Ve(a)})}function SI(e,t,a){return new e({type:"custom",check:"custom",fn:t,...Ve(a)})}function _I(e){const t=jI(a=>(a.addIssue=i=>{if(typeof i=="string")a.issues.push(rc(i,a.value,t._zod.def));else{const l=i;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=a.value),l.inst??(l.inst=t),l.continue??(l.continue=!t._zod.def.abort),a.issues.push(rc(l))}},e(a.value,a)));return t}function jI(e,t){const a=new Yn({check:"custom",...Ve(t)});return a._zod.check=e,a}function $0(e,t){try{var a=e()}catch(i){return t(i)}return a&&a.then?a.then(void 0,t):a}function CI(e,t){for(var a={};e.length;){var i=e[0],l=i.code,u=i.message,d=i.path.join(".");if(!a[d])if("unionErrors"in i){var f=i.unionErrors[0].errors[0];a[d]={message:f.message,type:f.code}}else a[d]={message:u,type:l};if("unionErrors"in i&&i.unionErrors.forEach(function(x){return x.errors.forEach(function(v){return e.push(v)})}),t){var g=a[d].types,y=g&&g[i.code];a[d]=Lg(d,t,a,l,y?[].concat(y,i.message):i.message)}e.shift()}return a}function EI(e,t){for(var a={};e.length;){var i=e[0],l=i.code,u=i.message,d=i.path.join(".");if(!a[d])if(i.code==="invalid_union"&&i.errors.length>0){var f=i.errors[0][0];a[d]={message:f.message,type:f.code}}else a[d]={message:u,type:l};if(i.code==="invalid_union"&&i.errors.forEach(function(x){return x.forEach(function(v){return e.push(v)})}),t){var g=a[d].types,y=g&&g[i.code];a[d]=Lg(d,t,a,l,y?[].concat(y,i.message):i.message)}e.shift()}return a}function dn(e,t,a){if(a===void 0&&(a={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(e))return function(i,l,u){try{return Promise.resolve($0(function(){return Promise.resolve(e[a.mode==="sync"?"parse":"parseAsync"](i,t)).then(function(d){return u.shouldUseNativeValidation&&Um({},u),{errors:{},values:a.raw?Object.assign({},i):d}})},function(d){if((function(f){return Array.isArray(f?.issues)})(d))return{values:{},errors:E0(CI(d.errors,!u.shouldUseNativeValidation&&u.criteriaMode==="all"),u)};throw d}))}catch(d){return Promise.reject(d)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(e))return function(i,l,u){try{return Promise.resolve($0(function(){return Promise.resolve((a.mode==="sync"?$6:V6)(e,i,t)).then(function(d){return u.shouldUseNativeValidation&&Um({},u),{errors:{},values:a.raw?Object.assign({},i):d}})},function(d){if((function(f){return f instanceof Gg})(d))return{values:{},errors:E0(EI(d.issues,!u.shouldUseNativeValidation&&u.criteriaMode==="all"),u)};throw d}))}catch(d){return Promise.reject(d)}};throw new Error("Invalid input: not a Zod schema")}const RI=re("ZodISODateTime",(e,t)=>{JP.init(e,t),qt.init(e,t)});function NI(e){return nI(RI,e)}const OI=re("ZodISODate",(e,t)=>{WP.init(e,t),qt.init(e,t)});function AI(e){return aI(OI,e)}const TI=re("ZodISOTime",(e,t)=>{eK.init(e,t),qt.init(e,t)});function DI(e){return rI(TI,e)}const MI=re("ZodISODuration",(e,t)=>{tK.init(e,t),qt.init(e,t)});function kI(e){return iI(MI,e)}const zI=(e,t)=>{Gg.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:a=>F6(e,a)},flatten:{value:a=>q6(e,a)},addIssue:{value:a=>{e.issues.push(a),e.message=JSON.stringify(e.issues,qm,2)}},addIssues:{value:a=>{e.issues.push(...a),e.message=JSON.stringify(e.issues,qm,2)}},isEmpty:{get(){return e.issues.length===0}}})},Aa=re("ZodError",zI,{Parent:Error}),PI=mf(Aa),KI=gf(Aa),II=yf(Aa),LI=vf(Aa),UI=H6(Aa),qI=X6(Aa),FI=Z6(Aa),$I=Y6(Aa),VI=Q6(Aa),BI=J6(Aa),GI=W6(Aa),HI=eP(Aa),Yt=re("ZodType",(e,t)=>(Gt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...a)=>e.clone(co(t,{checks:[...t.checks??[],...a.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]})),e.clone=(a,i)=>Ei(e,a,i),e.brand=()=>e,e.register=((a,i)=>(a.add(e,i),e)),e.parse=(a,i)=>PI(e,a,i,{callee:e.parse}),e.safeParse=(a,i)=>II(e,a,i),e.parseAsync=async(a,i)=>KI(e,a,i,{callee:e.parseAsync}),e.safeParseAsync=async(a,i)=>LI(e,a,i),e.spa=e.safeParseAsync,e.encode=(a,i)=>UI(e,a,i),e.decode=(a,i)=>qI(e,a,i),e.encodeAsync=async(a,i)=>FI(e,a,i),e.decodeAsync=async(a,i)=>$I(e,a,i),e.safeEncode=(a,i)=>VI(e,a,i),e.safeDecode=(a,i)=>BI(e,a,i),e.safeEncodeAsync=async(a,i)=>GI(e,a,i),e.safeDecodeAsync=async(a,i)=>HI(e,a,i),e.refine=(a,i)=>e.check(L8(a,i)),e.superRefine=a=>e.check(U8(a)),e.overwrite=a=>e.check(xc(a)),e.optional=()=>X0(e),e.nullable=()=>Z0(e),e.nullish=()=>X0(Z0(e)),e.nonoptional=a=>D8(e,a),e.array=()=>v8(e),e.or=a=>w8([e,a]),e.and=a=>_8(e,a),e.transform=a=>Y0(e,E8(a)),e.default=a=>O8(e,a),e.prefault=a=>T8(e,a),e.catch=a=>k8(e,a),e.pipe=a=>Y0(e,a),e.readonly=()=>K8(e),e.describe=a=>{const i=e.clone();return id.add(i,{description:a}),i},Object.defineProperty(e,"description",{get(){return id.get(e)?.description},configurable:!0}),e.meta=(...a)=>{if(a.length===0)return id.get(e);const i=e.clone();return id.add(i,a[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),fj=re("_ZodString",(e,t)=>{Hg.init(e,t),Yt.init(e,t);const a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,e.regex=(...i)=>e.check(dI(...i)),e.includes=(...i)=>e.check(pI(...i)),e.startsWith=(...i)=>e.check(mI(...i)),e.endsWith=(...i)=>e.check(gI(...i)),e.min=(...i)=>e.check(Pd(...i)),e.max=(...i)=>e.check(uj(...i)),e.length=(...i)=>e.check(dj(...i)),e.nonempty=(...i)=>e.check(Pd(1,...i)),e.lowercase=i=>e.check(fI(i)),e.uppercase=i=>e.check(hI(i)),e.trim=()=>e.check(vI()),e.normalize=(...i)=>e.check(yI(...i)),e.toLowerCase=()=>e.check(xI()),e.toUpperCase=()=>e.check(bI())}),XI=re("ZodString",(e,t)=>{Hg.init(e,t),fj.init(e,t),e.email=a=>e.check(PK(ZI,a)),e.url=a=>e.check(UK(YI,a)),e.jwt=a=>e.check(tI(d8,a)),e.emoji=a=>e.check(qK(QI,a)),e.guid=a=>e.check(L0(V0,a)),e.uuid=a=>e.check(cj(Bl,a)),e.uuidv4=a=>e.check(KK(Bl,a)),e.uuidv6=a=>e.check(IK(Bl,a)),e.uuidv7=a=>e.check(LK(Bl,a)),e.nanoid=a=>e.check(FK(JI,a)),e.guid=a=>e.check(L0(V0,a)),e.cuid=a=>e.check($K(WI,a)),e.cuid2=a=>e.check(VK(e8,a)),e.ulid=a=>e.check(BK(t8,a)),e.base64=a=>e.check(JK(l8,a)),e.base64url=a=>e.check(WK(c8,a)),e.xid=a=>e.check(GK(n8,a)),e.ksuid=a=>e.check(HK(a8,a)),e.ipv4=a=>e.check(XK(r8,a)),e.ipv6=a=>e.check(ZK(i8,a)),e.cidrv4=a=>e.check(YK(o8,a)),e.cidrv6=a=>e.check(QK(s8,a)),e.e164=a=>e.check(eI(u8,a)),e.datetime=a=>e.check(NI(a)),e.date=a=>e.check(AI(a)),e.time=a=>e.check(DI(a)),e.duration=a=>e.check(kI(a))});function Pt(e){return zK(XI,e)}const qt=re("ZodStringFormat",(e,t)=>{Lt.init(e,t),fj.init(e,t)}),ZI=re("ZodEmail",(e,t)=>{$P.init(e,t),qt.init(e,t)}),V0=re("ZodGUID",(e,t)=>{qP.init(e,t),qt.init(e,t)}),Bl=re("ZodUUID",(e,t)=>{FP.init(e,t),qt.init(e,t)});function hj(e){return cj(Bl,e)}const YI=re("ZodURL",(e,t)=>{VP.init(e,t),qt.init(e,t)}),QI=re("ZodEmoji",(e,t)=>{BP.init(e,t),qt.init(e,t)}),JI=re("ZodNanoID",(e,t)=>{GP.init(e,t),qt.init(e,t)}),WI=re("ZodCUID",(e,t)=>{HP.init(e,t),qt.init(e,t)}),e8=re("ZodCUID2",(e,t)=>{XP.init(e,t),qt.init(e,t)}),t8=re("ZodULID",(e,t)=>{ZP.init(e,t),qt.init(e,t)}),n8=re("ZodXID",(e,t)=>{YP.init(e,t),qt.init(e,t)}),a8=re("ZodKSUID",(e,t)=>{QP.init(e,t),qt.init(e,t)}),r8=re("ZodIPv4",(e,t)=>{nK.init(e,t),qt.init(e,t)}),i8=re("ZodIPv6",(e,t)=>{aK.init(e,t),qt.init(e,t)}),o8=re("ZodCIDRv4",(e,t)=>{rK.init(e,t),qt.init(e,t)}),s8=re("ZodCIDRv6",(e,t)=>{iK.init(e,t),qt.init(e,t)}),l8=re("ZodBase64",(e,t)=>{oK.init(e,t),qt.init(e,t)}),c8=re("ZodBase64URL",(e,t)=>{lK.init(e,t),qt.init(e,t)}),u8=re("ZodE164",(e,t)=>{cK.init(e,t),qt.init(e,t)}),d8=re("ZodJWT",(e,t)=>{dK.init(e,t),qt.init(e,t)}),pj=re("ZodNumber",(e,t)=>{oj.init(e,t),Yt.init(e,t),e.gt=(i,l)=>e.check(q0(i,l)),e.gte=(i,l)=>e.check(um(i,l)),e.min=(i,l)=>e.check(um(i,l)),e.lt=(i,l)=>e.check(U0(i,l)),e.lte=(i,l)=>e.check(cm(i,l)),e.max=(i,l)=>e.check(cm(i,l)),e.int=i=>e.check(B0(i)),e.safe=i=>e.check(B0(i)),e.positive=i=>e.check(q0(0,i)),e.nonnegative=i=>e.check(um(0,i)),e.negative=i=>e.check(U0(0,i)),e.nonpositive=i=>e.check(cm(0,i)),e.multipleOf=(i,l)=>e.check(F0(i,l)),e.step=(i,l)=>e.check(F0(i,l)),e.finite=()=>e;const a=e._zod.bag;e.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??.5),e.isFinite=!0,e.format=a.format??null});function Kd(e){return oI(pj,e)}const f8=re("ZodNumberFormat",(e,t)=>{fK.init(e,t),pj.init(e,t)});function B0(e){return sI(f8,e)}const h8=re("ZodAny",(e,t)=>{hK.init(e,t),Yt.init(e,t)});function G0(){return lI(h8)}const p8=re("ZodUnknown",(e,t)=>{pK.init(e,t),Yt.init(e,t)});function H0(){return cI(p8)}const m8=re("ZodNever",(e,t)=>{mK.init(e,t),Yt.init(e,t)});function g8(e){return uI(m8,e)}const y8=re("ZodArray",(e,t)=>{gK.init(e,t),Yt.init(e,t),e.element=t.element,e.min=(a,i)=>e.check(Pd(a,i)),e.nonempty=a=>e.check(Pd(1,a)),e.max=(a,i)=>e.check(uj(a,i)),e.length=(a,i)=>e.check(dj(a,i)),e.unwrap=()=>e.element});function v8(e,t){return wI(y8,e,t)}const x8=re("ZodObject",(e,t)=>{vK.init(e,t),Yt.init(e,t),Ot(e,"shape",()=>t.shape),e.keyof=()=>Fa(Object.keys(e._zod.def.shape)),e.catchall=a=>e.clone({...e._zod.def,catchall:a}),e.passthrough=()=>e.clone({...e._zod.def,catchall:H0()}),e.loose=()=>e.clone({...e._zod.def,catchall:H0()}),e.strict=()=>e.clone({...e._zod.def,catchall:g8()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=a=>P6(e,a),e.safeExtend=a=>K6(e,a),e.merge=a=>I6(e,a),e.pick=a=>k6(e,a),e.omit=a=>z6(e,a),e.partial=(...a)=>L6(mj,e,a[0]),e.required=(...a)=>U6(gj,e,a[0])});function pa(e,t){const a={type:"object",shape:e??{},...Ve(t)};return new x8(a)}const b8=re("ZodUnion",(e,t)=>{xK.init(e,t),Yt.init(e,t),e.options=t.options});function w8(e,t){return new b8({type:"union",options:e,...Ve(t)})}const S8=re("ZodIntersection",(e,t)=>{bK.init(e,t),Yt.init(e,t)});function _8(e,t){return new S8({type:"intersection",left:e,right:t})}const $m=re("ZodEnum",(e,t)=>{wK.init(e,t),Yt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const a=new Set(Object.keys(t.entries));e.extract=(i,l)=>{const u={};for(const d of i)if(a.has(d))u[d]=t.entries[d];else throw new Error(`Key ${d} not found in enum`);return new $m({...t,checks:[],...Ve(l),entries:u})},e.exclude=(i,l)=>{const u={...t.entries};for(const d of i)if(a.has(d))delete u[d];else throw new Error(`Key ${d} not found in enum`);return new $m({...t,checks:[],...Ve(l),entries:u})}});function Fa(e,t){const a=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new $m({type:"enum",entries:a,...Ve(t)})}const j8=re("ZodLiteral",(e,t)=>{SK.init(e,t),Yt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Id(e,t){return new j8({type:"literal",values:Array.isArray(e)?e:[e],...Ve(t)})}const C8=re("ZodTransform",(e,t)=>{_K.init(e,t),Yt.init(e,t),e._zod.parse=(a,i)=>{if(i.direction==="backward")throw new H_(e.constructor.name);a.addIssue=u=>{if(typeof u=="string")a.issues.push(rc(u,a.value,t));else{const d=u;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=a.value),d.inst??(d.inst=e),a.issues.push(rc(d))}};const l=t.transform(a.value,a);return l instanceof Promise?l.then(u=>(a.value=u,a)):(a.value=l,a)}});function E8(e){return new C8({type:"transform",transform:e})}const mj=re("ZodOptional",(e,t)=>{jK.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function X0(e){return new mj({type:"optional",innerType:e})}const R8=re("ZodNullable",(e,t)=>{CK.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Z0(e){return new R8({type:"nullable",innerType:e})}const N8=re("ZodDefault",(e,t)=>{EK.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function O8(e,t){return new N8({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Y_(t)}})}const A8=re("ZodPrefault",(e,t)=>{RK.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function T8(e,t){return new A8({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Y_(t)}})}const gj=re("ZodNonOptional",(e,t)=>{NK.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function D8(e,t){return new gj({type:"nonoptional",innerType:e,...Ve(t)})}const M8=re("ZodCatch",(e,t)=>{OK.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function k8(e,t){return new M8({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const z8=re("ZodPipe",(e,t)=>{AK.init(e,t),Yt.init(e,t),e.in=t.in,e.out=t.out});function Y0(e,t){return new z8({type:"pipe",in:e,out:t})}const P8=re("ZodReadonly",(e,t)=>{TK.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function K8(e){return new P8({type:"readonly",innerType:e})}const I8=re("ZodCustom",(e,t)=>{DK.init(e,t),Yt.init(e,t)});function L8(e,t={}){return SI(I8,e,t)}function U8(e){return _I(e)}const pi={custom:"custom"};var q8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],F8=q8.reduce((e,t)=>{const a=lc(`Primitive.${t}`),i=m.forwardRef((l,u)=>{const{asChild:d,...f}=l,g=d?a:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(g,{...f,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),$8="Label",yj=m.forwardRef((e,t)=>o.jsx(F8.label,{...e,ref:t,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(e.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));yj.displayName=$8;var V8=yj;function Kr({className:e,...t}){return o.jsx(V8,{"data-slot":"label",className:de("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 fn=u6,vj=m.createContext({}),Ke=({...e})=>o.jsx(vj.Provider,{value:{name:e.name},children:o.jsx(Pa,{...e})}),Xg=()=>{const e=m.useContext(vj),t=m.useContext(xj),{getFieldState:a}=hf(),i=U_({name:e.name}),l=a(e.name,i);if(!e)throw new Error("useFormField should be used within ");const{id:u}=t;return{id:u,name:e.name,formItemId:`${u}-form-item`,formDescriptionId:`${u}-form-item-description`,formMessageId:`${u}-form-item-message`,...l}},xj=m.createContext({});function Ce({className:e,...t}){const a=m.useId();return o.jsx(xj.Provider,{value:{id:a},children:o.jsx("div",{"data-slot":"form-item",className:de("grid gap-2",e),...t})})}function Ee({className:e,...t}){const{error:a,formItemId:i}=Xg();return o.jsx(Kr,{"data-slot":"form-label","data-error":!!a,className:de("data-[error=true]:text-destructive",e),htmlFor:i,...t})}function Be({...e}){const{error:t,formItemId:a,formDescriptionId:i,formMessageId:l}=Xg();return o.jsx(Rs,{"data-slot":"form-control",id:a,"aria-describedby":t?`${i} ${l}`:`${i}`,"aria-invalid":!!t,...e})}function Pe({className:e,...t}){const{error:a,formMessageId:i}=Xg(),l=a?String(a?.message??""):t.children;return l?o.jsx("p",{"data-slot":"form-message",id:i,className:de("text-destructive text-sm",e),...t,children:l}):null}function da({className:e,...t}){return o.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:o.jsx("table",{"data-slot":"table",className:de("w-full caption-bottom text-sm",e),...t})})}function fa({className:e,...t}){return o.jsx("thead",{"data-slot":"table-header",className:de("[&_tr]:border-b",e),...t})}function ha({className:e,...t}){return o.jsx("tbody",{"data-slot":"table-body",className:de("[&_tr:last-child]:border-0",e),...t})}function tt({className:e,...t}){return o.jsx("tr",{"data-slot":"table-row",className:de("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Ue({className:e,...t}){return o.jsx("th",{"data-slot":"table-head",className:de("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function je({className:e,...t}){return o.jsx("td",{"data-slot":"table-cell",className:de("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function B8({className:e,...t}){return o.jsx("caption",{"data-slot":"table-caption",className:de("text-muted-foreground mt-4 text-sm",e),...t})}const bj=pa({key:Pt().trim().min(1,"Key is required").max(120,"Max 120 chars"),value:Pt().trim().optional()}),G8=bj.partial();function H8({t:e}){const t=`${e.key}${e.value?`=${e.value}`:""}`;return o.jsxs(ca,{variant:"secondary",className:"font-mono text-xs",children:[o.jsx(Vd,{className:"mr-1 h-3 w-3"}),t]})}const X8=()=>{const[e,t]=m.useState(""),[a,i]=m.useState(!1),[l,u]=m.useState(!1),[d,f]=m.useState(null),[g,y]=m.useState(null),x=Xn(),v=Zt({queryKey:["annotations"],queryFn:()=>$l.listAnnotations()}),w=un({resolver:dn(bj),defaultValues:{key:"",value:""}}),_=lt({mutationFn:E=>$l.createAnnotation(E),onSuccess:async()=>{await x.invalidateQueries({queryKey:["annotations"]}),w.reset(),i(!1),xe.success("Annotation Created Successfully.")},onError:E=>{xe.error(E.message??"There was an error while creating Annotation")}}),R=E=>{_.mutate(E)},S=un({resolver:dn(G8),defaultValues:{}}),A=lt({mutationFn:({id:E,values:D})=>$l.updateAnnotation(E,D),onSuccess:async()=>{await x.invalidateQueries({queryKey:["annotations"]}),S.reset(),u(!1),xe.success("Annotation Updated Successfully.")},onError:E=>{xe.error(E.message??"There was an error while updating Annotation")}}),M=E=>{y(E.id),S.reset({key:E.key,value:E.value}),u(!0)},T=lt({mutationFn:E=>$l.deleteAnnotation(E),onSuccess:async()=>{await x.invalidateQueries({queryKey:["annotations"]}),f(null),xe.success("Annotation Deleted Successfully.")},onError:E=>{xe.error(E.message??"There was an error while deleting Annotation")}}),N=m.useMemo(()=>{const E=v.data??[],D=e.trim().toLowerCase();return D?E.filter(I=>I.key?.toLowerCase().includes(D)||I.value?.toLowerCase().includes(D)):E},[e,v.data]);return v.isLoading?o.jsx("div",{className:"p-6",children:"Loading annotations…"}):v.error?o.jsxs("div",{className:"p-6 text-red-500",children:["Error loading annotations.",o.jsx("pre",{children:JSON.stringify(v,null,2)})]}):o.jsxs("div",{className:"space-y-4 p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[o.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Annotations"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx(dr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),o.jsx(Ae,{value:e,onChange:E=>t(E.target.value),placeholder:"Search annotations",className:"w-64 pl-8"})]}),o.jsxs(bt,{open:a,onOpenChange:i,children:[o.jsx(Xa,{asChild:!0,children:o.jsxs(ie,{onClick:()=>i(!0),children:[o.jsx(Si,{className:"mr-2 h-4 w-4"}),"Create Annotation"]})}),o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Create Label"})}),o.jsx(fn,{...w,children:o.jsxs("form",{className:"space-y-4",onSubmit:w.handleSubmit(R),children:[o.jsx(Ke,{control:w.control,name:"key",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Key"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"environment",...E})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:w.control,name:"value",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Value"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"dev",...E})}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:w.formState.isSubmitting,children:w.formState.isSubmitting?"Creating…":"Create"})]})]})})]})]})]})]}),o.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Key"}),o.jsx(Ue,{children:"Value"}),o.jsx(Ue,{children:"Annotation"}),o.jsx(Ue,{className:"w-[180px] text-right",children:"Actions"})]})}),o.jsxs(ha,{children:[N.map(E=>o.jsxs(tt,{children:[o.jsx(je,{children:E.key}),o.jsx(je,{children:E.value}),o.jsx(je,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(H8,{t:E}),o.jsx("code",{className:"text-muted-foreground text-xs",children:Ji(E.id,6)})]})}),o.jsx(je,{children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>M(E),children:[o.jsx(sc,{className:"mr-2 h-4 w-4"})," Edit"]}),o.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>f(E.id),disabled:T.isPending&&d===E.id,children:T.isPending&&d===E.id?"Deleting…":"Delete"})]})})]},E.id)),N.length===0&&o.jsx(tt,{children:o.jsxs(je,{colSpan:4,className:"text-muted-foreground py-10 text-center",children:[o.jsx(sg,{className:"mx-auto mb-2 h-6 w-6 opacity-60"}),"No labels match your search."]})})]})]})})}),o.jsx(bt,{open:l,onOpenChange:u,children:o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Edit Annotation"})}),o.jsx(fn,{...S,children:o.jsxs("form",{className:"space-y-4",onSubmit:S.handleSubmit(E=>{g&&A.mutate({id:g,values:E})}),children:[o.jsx(Ke,{control:S.control,name:"key",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Key"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"dedicated",...E})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:S.control,name:"value",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Value (optional)"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"gpu",...E})}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:A.isPending,children:A.isPending?"Saving…":"Save changes"})]})]})})]})}),o.jsx(bt,{open:!!d,onOpenChange:E=>!E&&f(null),children:o.jsxs(wt,{className:"sm:max-w-md",children:[o.jsx(St,{children:o.jsx(_t,{children:"Delete annotation"})}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"This action cannot be undone. Are you sure you want to delete this annotation?"}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),o.jsx(ie,{variant:"destructive",onClick:()=>d&&T.mutate(d),disabled:T.isPending,children:T.isPending?"Deleting…":"Delete"})]})]})})]})};function $a({className:e,...t}){return o.jsx("div",{"data-slot":"card",className:de("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function hr({className:e,...t}){return o.jsx("div",{"data-slot":"card-header",className:de("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function pr({className:e,...t}){return o.jsx("div",{"data-slot":"card-title",className:de("leading-none font-semibold",e),...t})}function Vm({className:e,...t}){return o.jsx("div",{"data-slot":"card-description",className:de("text-muted-foreground text-sm",e),...t})}function Va({className:e,...t}){return o.jsx("div",{"data-slot":"card-content",className:de("px-6",e),...t})}function Z8(e,t="gsot-auth",a=520,i=640){const l=window.top.outerHeight/2+window.top.screenY-i/2,u=window.top.outerWidth/2+window.top.screenX-a/2;return window.open(e,t,`toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=${a},height=${i},top=${l},left=${u}`)}async function Y8(e){const t=new URLSearchParams({mode:"spa",origin:window.location.origin}),a=await fetch(`${ug}/auth/${e}/start?`+t,{method:"POST"});if(!a.ok)throw new Error("Failed to start auth");return(await a.json()).auth_url}const Q0=()=>{const e=CN(),t=tg(),a=m.useMemo(()=>{const l=new URLSearchParams(t.search).get("to")||"/me";try{const u=new URL(l,window.location.origin);return u.origin===window.location.origin?u.pathname+u.search:"/me"}catch{return"/me"}},[t.search]);m.useEffect(()=>{jn.get()?.access_token&&e(a,{replace:!0})},[e,a]),m.useEffect(()=>{const l=u=>{if(!(typeof u.data=="object"&&u.data?.type==="autoglue:auth"))return;const f=u.data.payload;jn.set(f),e(a,{replace:!0})};return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[e,a]);const i=async l=>{const u=await Y8(l);Z8(u)||alert("Please allow popups to sign in.")};return o.jsx("div",{className:"mx-auto flex items-center justify-center p-4",children:o.jsxs($a,{className:"w-full max-w-md",children:[o.jsxs(hr,{children:[o.jsx(pr,{className:"text-lg md:text-xl",children:"Sign In"}),o.jsx(Vm,{className:"text-xs md:text-sm",children:"Continue with a provider below to access your account."})]}),o.jsx(Va,{children:o.jsx("div",{className:"grid gap-4",children:o.jsx("div",{className:de("flex w-full items-center gap-2","flex-col justify-between"),children:o.jsxs(ie,{variant:"outline",className:"w-full gap-2",onClick:()=>i("google"),children:[o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"0.98em",height:"1em",viewBox:"0 0 256 262","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{fill:"#4285F4",d:"M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"}),o.jsx("path",{fill:"#34A853",d:"M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"}),o.jsx("path",{fill:"#FBBC05",d:"M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z"}),o.jsx("path",{fill:"#EB4335",d:"M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"})]}),"Sign in with Google"]})})})})]})})},is=xD(),Ml={listCredentials:()=>ze(async()=>await is.listCredentials()),createCredential:async e=>ze(async()=>await is.createCredential({body:e})),getCredential:async e=>ze(async()=>await is.getCredential({id:e})),deleteCredential:async e=>ze(async()=>{await is.deleteCredential({id:e})}),updateCredential:async(e,t)=>ze(async()=>await is.updateCredential({id:e,body:t})),revealCredential:async e=>ze(async()=>await is.revealCredential({id:e}))};var Q8=Symbol("radix.slottable");function J8(e){const t=({children:a})=>o.jsx(o.Fragment,{children:a});return t.displayName=`${e}.Slottable`,t.__radixId=Q8,t}var wj="AlertDialog",[W8]=Za(wj,[Y1]),Ur=Y1(),Sj=e=>{const{__scopeAlertDialog:t,...a}=e,i=Ur(t);return o.jsx(of,{...i,...a,modal:!0})};Sj.displayName=wj;var eL="AlertDialogTrigger",_j=m.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...i}=e,l=Ur(a);return o.jsx(f_,{...l,...i,ref:t})});_j.displayName=eL;var tL="AlertDialogPortal",jj=e=>{const{__scopeAlertDialog:t,...a}=e,i=Ur(t);return o.jsx(sf,{...i,...a})};jj.displayName=tL;var nL="AlertDialogOverlay",Cj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...i}=e,l=Ur(a);return o.jsx(lf,{...l,...i,ref:t})});Cj.displayName=nL;var ws="AlertDialogContent",[aL,rL]=W8(ws),iL=J8("AlertDialogContent"),Ej=m.forwardRef((e,t)=>{const{__scopeAlertDialog:a,children:i,...l}=e,u=Ur(a),d=m.useRef(null),f=dt(t,d),g=m.useRef(null);return o.jsx(m3,{contentName:ws,titleName:Rj,docsSlug:"alert-dialog",children:o.jsx(aL,{scope:a,cancelRef:g,children:o.jsxs(cf,{role:"alertdialog",...u,...l,ref:f,onOpenAutoFocus:Re(l.onOpenAutoFocus,y=>{y.preventDefault(),g.current?.focus({preventScroll:!0})}),onPointerDownOutside:y=>y.preventDefault(),onInteractOutside:y=>y.preventDefault(),children:[o.jsx(iL,{children:i}),o.jsx(sL,{contentRef:d})]})})})});Ej.displayName=ws;var Rj="AlertDialogTitle",Nj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...i}=e,l=Ur(a);return o.jsx(Rg,{...l,...i,ref:t})});Nj.displayName=Rj;var Oj="AlertDialogDescription",Aj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...i}=e,l=Ur(a);return o.jsx(Ng,{...l,...i,ref:t})});Aj.displayName=Oj;var oL="AlertDialogAction",Tj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...i}=e,l=Ur(a);return o.jsx(mc,{...l,...i,ref:t})});Tj.displayName=oL;var Dj="AlertDialogCancel",Mj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...i}=e,{cancelRef:l}=rL(Dj,a),u=Ur(a),d=dt(t,l);return o.jsx(mc,{...u,...i,ref:d})});Mj.displayName=Dj;var sL=({contentRef:e})=>{const t=`\`${ws}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${ws}\` by passing a \`${Oj}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${ws}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return m.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},lL=Sj,cL=_j,uL=jj,dL=Cj,fL=Ej,hL=Tj,pL=Mj,mL=Nj,gL=Aj;function kj({...e}){return o.jsx(lL,{"data-slot":"alert-dialog",...e})}function zj({...e}){return o.jsx(cL,{"data-slot":"alert-dialog-trigger",...e})}function yL({...e}){return o.jsx(uL,{"data-slot":"alert-dialog-portal",...e})}function vL({className:e,...t}){return o.jsx(dL,{"data-slot":"alert-dialog-overlay",className:de("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function Pj({className:e,...t}){return o.jsxs(yL,{children:[o.jsx(vL,{}),o.jsx(fL,{"data-slot":"alert-dialog-content",className:de("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function Kj({className:e,...t}){return o.jsx("div",{"data-slot":"alert-dialog-header",className:de("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Ij({className:e,...t}){return o.jsx("div",{"data-slot":"alert-dialog-footer",className:de("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Lj({className:e,...t}){return o.jsx(mL,{"data-slot":"alert-dialog-title",className:de("text-lg font-semibold",e),...t})}function Uj({className:e,...t}){return o.jsx(gL,{"data-slot":"alert-dialog-description",className:de("text-muted-foreground text-sm",e),...t})}function qj({className:e,...t}){return o.jsx(hL,{className:de(hg(),e),...t})}function Fj({className:e,...t}){return o.jsx(pL,{className:de(hg({variant:"outline"}),e),...t})}function J0(e){const t=xL(e),a=m.forwardRef((i,l)=>{const{children:u,...d}=i,f=m.Children.toArray(u),g=f.find(wL);if(g){const y=g.props.children,x=f.map(v=>v===g?m.Children.count(y)>1?m.Children.only(null):m.isValidElement(y)?y.props.children:null:v);return o.jsx(t,{...d,ref:l,children:m.isValidElement(y)?m.cloneElement(y,void 0,x):null})}return o.jsx(t,{...d,ref:l,children:u})});return a.displayName=`${e}.Slot`,a}function xL(e){const t=m.forwardRef((a,i)=>{const{children:l,...u}=a;if(m.isValidElement(l)){const d=_L(l),f=SL(u,l.props);return l.type!==m.Fragment&&(f.ref=i?Mn(i,d):d),m.cloneElement(l,f)}return m.Children.count(l)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bL=Symbol("radix.slottable");function wL(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bL}function SL(e,t){const a={...t};for(const i in t){const l=e[i],u=t[i];/^on[A-Z]/.test(i)?l&&u?a[i]=(...f)=>{const g=u(...f);return l(...f),g}:l&&(a[i]=l):i==="style"?a[i]={...l,...u}:i==="className"&&(a[i]=[l,u].filter(Boolean).join(" "))}return{...e,...a}}function _L(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning;return a?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}function Zg(e){const t=e+"CollectionProvider",[a,i]=Za(t),[l,u]=a(t,{collectionRef:{current:null},itemMap:new Map}),d=S=>{const{scope:A,children:M}=S,T=Q.useRef(null),N=Q.useRef(new Map).current;return o.jsx(l,{scope:A,itemMap:N,collectionRef:T,children:M})};d.displayName=t;const f=e+"CollectionSlot",g=J0(f),y=Q.forwardRef((S,A)=>{const{scope:M,children:T}=S,N=u(f,M),E=dt(A,N.collectionRef);return o.jsx(g,{ref:E,children:T})});y.displayName=f;const x=e+"CollectionItemSlot",v="data-radix-collection-item",w=J0(x),_=Q.forwardRef((S,A)=>{const{scope:M,children:T,...N}=S,E=Q.useRef(null),D=dt(A,E),I=u(x,M);return Q.useEffect(()=>(I.itemMap.set(E,{ref:E,...N}),()=>void I.itemMap.delete(E))),o.jsx(w,{[v]:"",ref:D,children:T})});_.displayName=x;function R(S){const A=u(e+"CollectionConsumer",S);return Q.useCallback(()=>{const T=A.collectionRef.current;if(!T)return[];const N=Array.from(T.querySelectorAll(`[${v}]`));return Array.from(A.itemMap.values()).sort((I,U)=>N.indexOf(I.ref.current)-N.indexOf(U.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:d,Slot:y,ItemSlot:_},R,i]}var jL=m.createContext(void 0);function Yg(e){const t=m.useContext(jL);return e||t||"ltr"}var dm="rovingFocusGroup.onEntryFocus",CL={bubbles:!1,cancelable:!0},bc="RovingFocusGroup",[Bm,$j,EL]=Zg(bc),[RL,Vj]=Za(bc,[EL]),[NL,OL]=RL(bc),Bj=m.forwardRef((e,t)=>o.jsx(Bm.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Bm.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(AL,{...e,ref:t})})}));Bj.displayName=bc;var AL=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:a,orientation:i,loop:l=!1,dir:u,currentTabStopId:d,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:g,onEntryFocus:y,preventScrollOnEntryFocus:x=!1,...v}=e,w=m.useRef(null),_=dt(t,w),R=Yg(u),[S,A]=xi({prop:d,defaultProp:f??null,onChange:g,caller:bc}),[M,T]=m.useState(!1),N=Ba(y),E=$j(a),D=m.useRef(!1),[I,U]=m.useState(0);return m.useEffect(()=>{const F=w.current;if(F)return F.addEventListener(dm,N),()=>F.removeEventListener(dm,N)},[N]),o.jsx(NL,{scope:a,orientation:i,dir:R,loop:l,currentTabStopId:S,onItemFocus:m.useCallback(F=>A(F),[A]),onItemShiftTab:m.useCallback(()=>T(!0),[]),onFocusableItemAdd:m.useCallback(()=>U(F=>F+1),[]),onFocusableItemRemove:m.useCallback(()=>U(F=>F-1),[]),children:o.jsx(at.div,{tabIndex:M||I===0?-1:0,"data-orientation":i,...v,ref:_,style:{outline:"none",...e.style},onMouseDown:Re(e.onMouseDown,()=>{D.current=!0}),onFocus:Re(e.onFocus,F=>{const fe=!D.current;if(F.target===F.currentTarget&&fe&&!M){const ge=new CustomEvent(dm,CL);if(F.currentTarget.dispatchEvent(ge),!ge.defaultPrevented){const he=E().filter(O=>O.focusable),ne=he.find(O=>O.active),le=he.find(O=>O.id===S),ve=[ne,le,...he].filter(Boolean).map(O=>O.ref.current);Xj(ve,x)}}D.current=!1}),onBlur:Re(e.onBlur,()=>T(!1))})})}),Gj="RovingFocusGroupItem",Hj=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:a,focusable:i=!0,active:l=!1,tabStopId:u,children:d,...f}=e,g=Cn(),y=u||g,x=OL(Gj,a),v=x.currentTabStopId===y,w=$j(a),{onFocusableItemAdd:_,onFocusableItemRemove:R,currentTabStopId:S}=x;return m.useEffect(()=>{if(i)return _(),()=>R()},[i,_,R]),o.jsx(Bm.ItemSlot,{scope:a,id:y,focusable:i,active:l,children:o.jsx(at.span,{tabIndex:v?0:-1,"data-orientation":x.orientation,...f,ref:t,onMouseDown:Re(e.onMouseDown,A=>{i?x.onItemFocus(y):A.preventDefault()}),onFocus:Re(e.onFocus,()=>x.onItemFocus(y)),onKeyDown:Re(e.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){x.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const M=ML(A,x.orientation,x.dir);if(M!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let N=w().filter(E=>E.focusable).map(E=>E.ref.current);if(M==="last")N.reverse();else if(M==="prev"||M==="next"){M==="prev"&&N.reverse();const E=N.indexOf(A.currentTarget);N=x.loop?kL(N,E+1):N.slice(E+1)}setTimeout(()=>Xj(N))}}),children:typeof d=="function"?d({isCurrentTabStop:v,hasTabStop:S!=null}):d})})});Hj.displayName=Gj;var TL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function DL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ML(e,t,a){const i=DL(e.key,a);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return TL[i]}function Xj(e,t=!1){const a=document.activeElement;for(const i of e)if(i===a||(i.focus({preventScroll:t}),document.activeElement!==a))return}function kL(e,t){return e.map((a,i)=>e[(t+i)%e.length])}var zL=Bj,PL=Hj;function KL(e){const t=IL(e),a=m.forwardRef((i,l)=>{const{children:u,...d}=i,f=m.Children.toArray(u),g=f.find(UL);if(g){const y=g.props.children,x=f.map(v=>v===g?m.Children.count(y)>1?m.Children.only(null):m.isValidElement(y)?y.props.children:null:v);return o.jsx(t,{...d,ref:l,children:m.isValidElement(y)?m.cloneElement(y,void 0,x):null})}return o.jsx(t,{...d,ref:l,children:u})});return a.displayName=`${e}.Slot`,a}function IL(e){const t=m.forwardRef((a,i)=>{const{children:l,...u}=a;if(m.isValidElement(l)){const d=FL(l),f=qL(u,l.props);return l.type!==m.Fragment&&(f.ref=i?Mn(i,d):d),m.cloneElement(l,f)}return m.Children.count(l)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var LL=Symbol("radix.slottable");function UL(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===LL}function qL(e,t){const a={...t};for(const i in t){const l=e[i],u=t[i];/^on[A-Z]/.test(i)?l&&u?a[i]=(...f)=>{const g=u(...f);return l(...f),g}:l&&(a[i]=l):i==="style"?a[i]={...l,...u}:i==="className"&&(a[i]=[l,u].filter(Boolean).join(" "))}return{...e,...a}}function FL(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning;return a?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var Gm=["Enter"," "],$L=["ArrowDown","PageUp","Home"],Zj=["ArrowUp","PageDown","End"],VL=[...$L,...Zj],BL={ltr:[...Gm,"ArrowRight"],rtl:[...Gm,"ArrowLeft"]},GL={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wc="Menu",[ic,HL,XL]=Zg(wc),[uo,Yj]=Za(wc,[XL,_i,Vj]),bf=_i(),Qj=Vj(),[ZL,fo]=uo(wc),[YL,Sc]=uo(wc),Jj=e=>{const{__scopeMenu:t,open:a=!1,children:i,dir:l,onOpenChange:u,modal:d=!0}=e,f=bf(t),[g,y]=m.useState(null),x=m.useRef(!1),v=Ba(u),w=Yg(l);return m.useEffect(()=>{const _=()=>{x.current=!0,document.addEventListener("pointerdown",R,{capture:!0,once:!0}),document.addEventListener("pointermove",R,{capture:!0,once:!0})},R=()=>x.current=!1;return document.addEventListener("keydown",_,{capture:!0}),()=>{document.removeEventListener("keydown",_,{capture:!0}),document.removeEventListener("pointerdown",R,{capture:!0}),document.removeEventListener("pointermove",R,{capture:!0})}},[]),o.jsx(Yd,{...f,children:o.jsx(ZL,{scope:t,open:a,onOpenChange:v,content:g,onContentChange:y,children:o.jsx(YL,{scope:t,onClose:m.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:x,dir:w,modal:d,children:i})})})};Jj.displayName=wc;var QL="MenuAnchor",Qg=m.forwardRef((e,t)=>{const{__scopeMenu:a,...i}=e,l=bf(a);return o.jsx(uc,{...l,...i,ref:t})});Qg.displayName=QL;var Jg="MenuPortal",[JL,Wj]=uo(Jg,{forceMount:void 0}),eC=e=>{const{__scopeMenu:t,forceMount:a,children:i,container:l}=e,u=fo(Jg,t);return o.jsx(JL,{scope:t,forceMount:a,children:o.jsx(Oa,{present:a||u.open,children:o.jsx(Ms,{asChild:!0,container:l,children:i})})})};eC.displayName=Jg;var Ra="MenuContent",[WL,Wg]=uo(Ra),tC=m.forwardRef((e,t)=>{const a=Wj(Ra,e.__scopeMenu),{forceMount:i=a.forceMount,...l}=e,u=fo(Ra,e.__scopeMenu),d=Sc(Ra,e.__scopeMenu);return o.jsx(ic.Provider,{scope:e.__scopeMenu,children:o.jsx(Oa,{present:i||u.open,children:o.jsx(ic.Slot,{scope:e.__scopeMenu,children:d.modal?o.jsx(eU,{...l,ref:t}):o.jsx(tU,{...l,ref:t})})})})}),eU=m.forwardRef((e,t)=>{const a=fo(Ra,e.__scopeMenu),i=m.useRef(null),l=dt(t,i);return m.useEffect(()=>{const u=i.current;if(u)return af(u)},[]),o.jsx(ey,{...e,ref:l,trapFocus:a.open,disableOutsidePointerEvents:a.open,disableOutsideScroll:!0,onFocusOutside:Re(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>a.onOpenChange(!1)})}),tU=m.forwardRef((e,t)=>{const a=fo(Ra,e.__scopeMenu);return o.jsx(ey,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>a.onOpenChange(!1)})}),nU=KL("MenuContent.ScrollLock"),ey=m.forwardRef((e,t)=>{const{__scopeMenu:a,loop:i=!1,trapFocus:l,onOpenAutoFocus:u,onCloseAutoFocus:d,disableOutsidePointerEvents:f,onEntryFocus:g,onEscapeKeyDown:y,onPointerDownOutside:x,onFocusOutside:v,onInteractOutside:w,onDismiss:_,disableOutsideScroll:R,...S}=e,A=fo(Ra,a),M=Sc(Ra,a),T=bf(a),N=Qj(a),E=HL(a),[D,I]=m.useState(null),U=m.useRef(null),F=dt(t,U,A.onContentChange),fe=m.useRef(0),ge=m.useRef(""),he=m.useRef(0),ne=m.useRef(null),le=m.useRef("right"),ce=m.useRef(0),ve=R?pc:m.Fragment,O=R?{as:nU,allowPinchZoom:!0}:void 0,j=J=>{const me=ge.current+J,Te=E().filter(ee=>!ee.disabled),H=document.activeElement,Y=Te.find(ee=>ee.ref.current===H)?.textValue,oe=Te.map(ee=>ee.textValue),se=pU(oe,me,Y),we=Te.find(ee=>ee.textValue===se)?.ref.current;(function ee(Se){ge.current=Se,window.clearTimeout(fe.current),Se!==""&&(fe.current=window.setTimeout(()=>ee(""),1e3))})(me),we&&setTimeout(()=>we.focus())};m.useEffect(()=>()=>window.clearTimeout(fe.current),[]),tf();const z=m.useCallback(J=>le.current===ne.current?.side&&gU(J,ne.current?.area),[]);return o.jsx(WL,{scope:a,searchRef:ge,onItemEnter:m.useCallback(J=>{z(J)&&J.preventDefault()},[z]),onItemLeave:m.useCallback(J=>{z(J)||(U.current?.focus(),I(null))},[z]),onTriggerLeave:m.useCallback(J=>{z(J)&&J.preventDefault()},[z]),pointerGraceTimerRef:he,onPointerGraceIntentChange:m.useCallback(J=>{ne.current=J},[]),children:o.jsx(ve,{...O,children:o.jsx(hc,{asChild:!0,trapped:l,onMountAutoFocus:Re(u,J=>{J.preventDefault(),U.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:d,children:o.jsx(As,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:y,onPointerDownOutside:x,onFocusOutside:v,onInteractOutside:w,onDismiss:_,children:o.jsx(zL,{asChild:!0,...N,dir:M.dir,orientation:"vertical",loop:i,currentTabStopId:D,onCurrentTabStopIdChange:I,onEntryFocus:Re(g,J=>{M.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(Qd,{role:"menu","aria-orientation":"vertical","data-state":yC(A.open),"data-radix-menu-content":"",dir:M.dir,...T,...S,ref:F,style:{outline:"none",...S.style},onKeyDown:Re(S.onKeyDown,J=>{const Te=J.target.closest("[data-radix-menu-content]")===J.currentTarget,H=J.ctrlKey||J.altKey||J.metaKey,Y=J.key.length===1;Te&&(J.key==="Tab"&&J.preventDefault(),!H&&Y&&j(J.key));const oe=U.current;if(J.target!==oe||!VL.includes(J.key))return;J.preventDefault();const we=E().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);Zj.includes(J.key)&&we.reverse(),fU(we)}),onBlur:Re(e.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(fe.current),ge.current="")}),onPointerMove:Re(e.onPointerMove,oc(J=>{const me=J.target,Te=ce.current!==J.clientX;if(J.currentTarget.contains(me)&&Te){const H=J.clientX>ce.current?"right":"left";le.current=H,ce.current=J.clientX}}))})})})})})})});tC.displayName=Ra;var aU="MenuGroup",ty=m.forwardRef((e,t)=>{const{__scopeMenu:a,...i}=e;return o.jsx(at.div,{role:"group",...i,ref:t})});ty.displayName=aU;var rU="MenuLabel",nC=m.forwardRef((e,t)=>{const{__scopeMenu:a,...i}=e;return o.jsx(at.div,{...i,ref:t})});nC.displayName=rU;var Ld="MenuItem",W0="menu.itemSelect",wf=m.forwardRef((e,t)=>{const{disabled:a=!1,onSelect:i,...l}=e,u=m.useRef(null),d=Sc(Ld,e.__scopeMenu),f=Wg(Ld,e.__scopeMenu),g=dt(t,u),y=m.useRef(!1),x=()=>{const v=u.current;if(!a&&v){const w=new CustomEvent(W0,{bubbles:!0,cancelable:!0});v.addEventListener(W0,_=>i?.(_),{once:!0}),WS(v,w),w.defaultPrevented?y.current=!1:d.onClose()}};return o.jsx(aC,{...l,ref:g,disabled:a,onClick:Re(e.onClick,x),onPointerDown:v=>{e.onPointerDown?.(v),y.current=!0},onPointerUp:Re(e.onPointerUp,v=>{y.current||v.currentTarget?.click()}),onKeyDown:Re(e.onKeyDown,v=>{const w=f.searchRef.current!=="";a||w&&v.key===" "||Gm.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});wf.displayName=Ld;var aC=m.forwardRef((e,t)=>{const{__scopeMenu:a,disabled:i=!1,textValue:l,...u}=e,d=Wg(Ld,a),f=Qj(a),g=m.useRef(null),y=dt(t,g),[x,v]=m.useState(!1),[w,_]=m.useState("");return m.useEffect(()=>{const R=g.current;R&&_((R.textContent??"").trim())},[u.children]),o.jsx(ic.ItemSlot,{scope:a,disabled:i,textValue:l??w,children:o.jsx(PL,{asChild:!0,...f,focusable:!i,children:o.jsx(at.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...u,ref:y,onPointerMove:Re(e.onPointerMove,oc(R=>{i?d.onItemLeave(R):(d.onItemEnter(R),R.defaultPrevented||R.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Re(e.onPointerLeave,oc(R=>d.onItemLeave(R))),onFocus:Re(e.onFocus,()=>v(!0)),onBlur:Re(e.onBlur,()=>v(!1))})})})}),iU="MenuCheckboxItem",rC=m.forwardRef((e,t)=>{const{checked:a=!1,onCheckedChange:i,...l}=e;return o.jsx(cC,{scope:e.__scopeMenu,checked:a,children:o.jsx(wf,{role:"menuitemcheckbox","aria-checked":Ud(a)?"mixed":a,...l,ref:t,"data-state":ay(a),onSelect:Re(l.onSelect,()=>i?.(Ud(a)?!0:!a),{checkForDefaultPrevented:!1})})})});rC.displayName=iU;var iC="MenuRadioGroup",[oU,sU]=uo(iC,{value:void 0,onValueChange:()=>{}}),oC=m.forwardRef((e,t)=>{const{value:a,onValueChange:i,...l}=e,u=Ba(i);return o.jsx(oU,{scope:e.__scopeMenu,value:a,onValueChange:u,children:o.jsx(ty,{...l,ref:t})})});oC.displayName=iC;var sC="MenuRadioItem",lC=m.forwardRef((e,t)=>{const{value:a,...i}=e,l=sU(sC,e.__scopeMenu),u=a===l.value;return o.jsx(cC,{scope:e.__scopeMenu,checked:u,children:o.jsx(wf,{role:"menuitemradio","aria-checked":u,...i,ref:t,"data-state":ay(u),onSelect:Re(i.onSelect,()=>l.onValueChange?.(a),{checkForDefaultPrevented:!1})})})});lC.displayName=sC;var ny="MenuItemIndicator",[cC,lU]=uo(ny,{checked:!1}),uC=m.forwardRef((e,t)=>{const{__scopeMenu:a,forceMount:i,...l}=e,u=lU(ny,a);return o.jsx(Oa,{present:i||Ud(u.checked)||u.checked===!0,children:o.jsx(at.span,{...l,ref:t,"data-state":ay(u.checked)})})});uC.displayName=ny;var cU="MenuSeparator",dC=m.forwardRef((e,t)=>{const{__scopeMenu:a,...i}=e;return o.jsx(at.div,{role:"separator","aria-orientation":"horizontal",...i,ref:t})});dC.displayName=cU;var uU="MenuArrow",fC=m.forwardRef((e,t)=>{const{__scopeMenu:a,...i}=e,l=bf(a);return o.jsx(Jd,{...l,...i,ref:t})});fC.displayName=uU;var dU="MenuSub",[Kq,hC]=uo(dU),Gl="MenuSubTrigger",pC=m.forwardRef((e,t)=>{const a=fo(Gl,e.__scopeMenu),i=Sc(Gl,e.__scopeMenu),l=hC(Gl,e.__scopeMenu),u=Wg(Gl,e.__scopeMenu),d=m.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:g}=u,y={__scopeMenu:e.__scopeMenu},x=m.useCallback(()=>{d.current&&window.clearTimeout(d.current),d.current=null},[]);return m.useEffect(()=>x,[x]),m.useEffect(()=>{const v=f.current;return()=>{window.clearTimeout(v),g(null)}},[f,g]),o.jsx(Qg,{asChild:!0,...y,children:o.jsx(aC,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":l.contentId,"data-state":yC(a.open),...e,ref:Mn(t,l.onTriggerChange),onClick:v=>{e.onClick?.(v),!(e.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),a.open||a.onOpenChange(!0))},onPointerMove:Re(e.onPointerMove,oc(v=>{u.onItemEnter(v),!v.defaultPrevented&&!e.disabled&&!a.open&&!d.current&&(u.onPointerGraceIntentChange(null),d.current=window.setTimeout(()=>{a.onOpenChange(!0),x()},100))})),onPointerLeave:Re(e.onPointerLeave,oc(v=>{x();const w=a.content?.getBoundingClientRect();if(w){const _=a.content?.dataset.side,R=_==="right",S=R?-5:5,A=w[R?"left":"right"],M=w[R?"right":"left"];u.onPointerGraceIntentChange({area:[{x:v.clientX+S,y:v.clientY},{x:A,y:w.top},{x:M,y:w.top},{x:M,y:w.bottom},{x:A,y:w.bottom}],side:_}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>u.onPointerGraceIntentChange(null),300)}else{if(u.onTriggerLeave(v),v.defaultPrevented)return;u.onPointerGraceIntentChange(null)}})),onKeyDown:Re(e.onKeyDown,v=>{const w=u.searchRef.current!=="";e.disabled||w&&v.key===" "||BL[i.dir].includes(v.key)&&(a.onOpenChange(!0),a.content?.focus(),v.preventDefault())})})})});pC.displayName=Gl;var mC="MenuSubContent",gC=m.forwardRef((e,t)=>{const a=Wj(Ra,e.__scopeMenu),{forceMount:i=a.forceMount,...l}=e,u=fo(Ra,e.__scopeMenu),d=Sc(Ra,e.__scopeMenu),f=hC(mC,e.__scopeMenu),g=m.useRef(null),y=dt(t,g);return o.jsx(ic.Provider,{scope:e.__scopeMenu,children:o.jsx(Oa,{present:i||u.open,children:o.jsx(ic.Slot,{scope:e.__scopeMenu,children:o.jsx(ey,{id:f.contentId,"aria-labelledby":f.triggerId,...l,ref:y,align:"start",side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{d.isUsingKeyboardRef.current&&g.current?.focus(),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:Re(e.onFocusOutside,x=>{x.target!==f.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Re(e.onEscapeKeyDown,x=>{d.onClose(),x.preventDefault()}),onKeyDown:Re(e.onKeyDown,x=>{const v=x.currentTarget.contains(x.target),w=GL[d.dir].includes(x.key);v&&w&&(u.onOpenChange(!1),f.trigger?.focus(),x.preventDefault())})})})})})});gC.displayName=mC;function yC(e){return e?"open":"closed"}function Ud(e){return e==="indeterminate"}function ay(e){return Ud(e)?"indeterminate":e?"checked":"unchecked"}function fU(e){const t=document.activeElement;for(const a of e)if(a===t||(a.focus(),document.activeElement!==t))return}function hU(e,t){return e.map((a,i)=>e[(t+i)%e.length])}function pU(e,t,a){const l=t.length>1&&Array.from(t).every(y=>y===t[0])?t[0]:t,u=a?e.indexOf(a):-1;let d=hU(e,Math.max(u,0));l.length===1&&(d=d.filter(y=>y!==a));const g=d.find(y=>y.toLowerCase().startsWith(l.toLowerCase()));return g!==a?g:void 0}function mU(e,t){const{x:a,y:i}=e;let l=!1;for(let u=0,d=t.length-1;ui!=w>i&&a<(v-y)*(i-x)/(w-x)+y&&(l=!l)}return l}function gU(e,t){if(!t)return!1;const a={x:e.clientX,y:e.clientY};return mU(a,t)}function oc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var yU=Jj,vU=Qg,xU=eC,bU=tC,wU=ty,SU=nC,_U=wf,jU=rC,CU=oC,EU=lC,RU=uC,NU=dC,OU=fC,AU=pC,TU=gC,Sf="DropdownMenu",[DU]=Za(Sf,[Yj]),kn=Yj(),[MU,vC]=DU(Sf),xC=e=>{const{__scopeDropdownMenu:t,children:a,dir:i,open:l,defaultOpen:u,onOpenChange:d,modal:f=!0}=e,g=kn(t),y=m.useRef(null),[x,v]=xi({prop:l,defaultProp:u??!1,onChange:d,caller:Sf});return o.jsx(MU,{scope:t,triggerId:Cn(),triggerRef:y,contentId:Cn(),open:x,onOpenChange:v,onOpenToggle:m.useCallback(()=>v(w=>!w),[v]),modal:f,children:o.jsx(yU,{...g,open:x,onOpenChange:v,dir:i,modal:f,children:a})})};xC.displayName=Sf;var bC="DropdownMenuTrigger",wC=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,disabled:i=!1,...l}=e,u=vC(bC,a),d=kn(a);return o.jsx(vU,{asChild:!0,...d,children:o.jsx(at.button,{type:"button",id:u.triggerId,"aria-haspopup":"menu","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":u.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...l,ref:Mn(t,u.triggerRef),onPointerDown:Re(e.onPointerDown,f=>{!i&&f.button===0&&f.ctrlKey===!1&&(u.onOpenToggle(),u.open||f.preventDefault())}),onKeyDown:Re(e.onKeyDown,f=>{i||(["Enter"," "].includes(f.key)&&u.onOpenToggle(),f.key==="ArrowDown"&&u.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});wC.displayName=bC;var kU="DropdownMenuPortal",SC=e=>{const{__scopeDropdownMenu:t,...a}=e,i=kn(t);return o.jsx(xU,{...i,...a})};SC.displayName=kU;var _C="DropdownMenuContent",jC=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=vC(_C,a),u=kn(a),d=m.useRef(!1);return o.jsx(bU,{id:l.contentId,"aria-labelledby":l.triggerId,...u,...i,ref:t,onCloseAutoFocus:Re(e.onCloseAutoFocus,f=>{d.current||l.triggerRef.current?.focus(),d.current=!1,f.preventDefault()}),onInteractOutside:Re(e.onInteractOutside,f=>{const g=f.detail.originalEvent,y=g.button===0&&g.ctrlKey===!0,x=g.button===2||y;(!l.modal||x)&&(d.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});jC.displayName=_C;var zU="DropdownMenuGroup",PU=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(wU,{...l,...i,ref:t})});PU.displayName=zU;var KU="DropdownMenuLabel",IU=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(SU,{...l,...i,ref:t})});IU.displayName=KU;var LU="DropdownMenuItem",CC=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(_U,{...l,...i,ref:t})});CC.displayName=LU;var UU="DropdownMenuCheckboxItem",qU=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(jU,{...l,...i,ref:t})});qU.displayName=UU;var FU="DropdownMenuRadioGroup",$U=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(CU,{...l,...i,ref:t})});$U.displayName=FU;var VU="DropdownMenuRadioItem",BU=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(EU,{...l,...i,ref:t})});BU.displayName=VU;var GU="DropdownMenuItemIndicator",HU=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(RU,{...l,...i,ref:t})});HU.displayName=GU;var XU="DropdownMenuSeparator",ZU=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(NU,{...l,...i,ref:t})});ZU.displayName=XU;var YU="DropdownMenuArrow",QU=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(OU,{...l,...i,ref:t})});QU.displayName=YU;var JU="DropdownMenuSubTrigger",WU=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(AU,{...l,...i,ref:t})});WU.displayName=JU;var e7="DropdownMenuSubContent",t7=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:a,...i}=e,l=kn(a);return o.jsx(TU,{...l,...i,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});t7.displayName=e7;var n7=xC,a7=wC,r7=SC,i7=jC,o7=CC;function EC({...e}){return o.jsx(n7,{"data-slot":"dropdown-menu",...e})}function RC({...e}){return o.jsx(a7,{"data-slot":"dropdown-menu-trigger",...e})}function NC({className:e,sideOffset:t=4,...a}){return o.jsx(r7,{children:o.jsx(i7,{"data-slot":"dropdown-menu-content",sideOffset:t,className:de("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...a})})}function Jl({className:e,inset:t,variant:a="default",...i}){return o.jsx(o7,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:de("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i})}function eS(e,[t,a]){return Math.min(a,Math.max(t,e))}function s7(e){const t=l7(e),a=m.forwardRef((i,l)=>{const{children:u,...d}=i,f=m.Children.toArray(u),g=f.find(u7);if(g){const y=g.props.children,x=f.map(v=>v===g?m.Children.count(y)>1?m.Children.only(null):m.isValidElement(y)?y.props.children:null:v);return o.jsx(t,{...d,ref:l,children:m.isValidElement(y)?m.cloneElement(y,void 0,x):null})}return o.jsx(t,{...d,ref:l,children:u})});return a.displayName=`${e}.Slot`,a}function l7(e){const t=m.forwardRef((a,i)=>{const{children:l,...u}=a;if(m.isValidElement(l)){const d=f7(l),f=d7(u,l.props);return l.type!==m.Fragment&&(f.ref=i?Mn(i,d):d),m.cloneElement(l,f)}return m.Children.count(l)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var c7=Symbol("radix.slottable");function u7(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===c7}function d7(e,t){const a={...t};for(const i in t){const l=e[i],u=t[i];/^on[A-Z]/.test(i)?l&&u?a[i]=(...f)=>{const g=u(...f);return l(...f),g}:l&&(a[i]=l):i==="style"?a[i]={...l,...u}:i==="className"&&(a[i]=[l,u].filter(Boolean).join(" "))}return{...e,...a}}function f7(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning;return a?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,a=t&&"isReactWarning"in t&&t.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}function OC(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var h7=[" ","Enter","ArrowUp","ArrowDown"],p7=[" ","Enter"],oo="Select",[_f,jf,m7]=Zg(oo),[zs]=Za(oo,[m7,_i]),Cf=_i(),[g7,Ri]=zs(oo),[y7,v7]=zs(oo),AC=e=>{const{__scopeSelect:t,children:a,open:i,defaultOpen:l,onOpenChange:u,value:d,defaultValue:f,onValueChange:g,dir:y,name:x,autoComplete:v,disabled:w,required:_,form:R}=e,S=Cf(t),[A,M]=m.useState(null),[T,N]=m.useState(null),[E,D]=m.useState(!1),I=Yg(y),[U,F]=xi({prop:i,defaultProp:l??!1,onChange:u,caller:oo}),[fe,ge]=xi({prop:d,defaultProp:f,onChange:g,caller:oo}),he=m.useRef(null),ne=A?R||!!A.closest("form"):!0,[le,ce]=m.useState(new Set),ve=Array.from(le).map(O=>O.props.value).join(";");return o.jsx(Yd,{...S,children:o.jsxs(g7,{required:_,scope:t,trigger:A,onTriggerChange:M,valueNode:T,onValueNodeChange:N,valueNodeHasChildren:E,onValueNodeHasChildrenChange:D,contentId:Cn(),value:fe,onValueChange:ge,open:U,onOpenChange:F,dir:I,triggerPointerDownPosRef:he,disabled:w,children:[o.jsx(_f.Provider,{scope:t,children:o.jsx(y7,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(O=>{ce(j=>new Set(j).add(O))},[]),onNativeOptionRemove:m.useCallback(O=>{ce(j=>{const z=new Set(j);return z.delete(O),z})},[]),children:a})}),ne?o.jsxs(JC,{"aria-hidden":!0,required:_,tabIndex:-1,name:x,autoComplete:v,value:fe,onChange:O=>ge(O.target.value),disabled:w,form:R,children:[fe===void 0?o.jsx("option",{value:""}):null,Array.from(le)]},ve):null]})})};AC.displayName=oo;var TC="SelectTrigger",DC=m.forwardRef((e,t)=>{const{__scopeSelect:a,disabled:i=!1,...l}=e,u=Cf(a),d=Ri(TC,a),f=d.disabled||i,g=dt(t,d.onTriggerChange),y=jf(a),x=m.useRef("touch"),[v,w,_]=eE(S=>{const A=y().filter(N=>!N.disabled),M=A.find(N=>N.value===d.value),T=tE(A,S,M);T!==void 0&&d.onValueChange(T.value)}),R=S=>{f||(d.onOpenChange(!0),_()),S&&(d.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return o.jsx(uc,{asChild:!0,...u,children:o.jsx(at.button,{type:"button",role:"combobox","aria-controls":d.contentId,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":WC(d.value)?"":void 0,...l,ref:g,onClick:Re(l.onClick,S=>{S.currentTarget.focus(),x.current!=="mouse"&&R(S)}),onPointerDown:Re(l.onPointerDown,S=>{x.current=S.pointerType;const A=S.target;A.hasPointerCapture(S.pointerId)&&A.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(R(S),S.preventDefault())}),onKeyDown:Re(l.onKeyDown,S=>{const A=v.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&w(S.key),!(A&&S.key===" ")&&h7.includes(S.key)&&(R(),S.preventDefault())})})})});DC.displayName=TC;var MC="SelectValue",kC=m.forwardRef((e,t)=>{const{__scopeSelect:a,className:i,style:l,children:u,placeholder:d="",...f}=e,g=Ri(MC,a),{onValueNodeHasChildrenChange:y}=g,x=u!==void 0,v=dt(t,g.onValueNodeChange);return hn(()=>{y(x)},[y,x]),o.jsx(at.span,{...f,ref:v,style:{pointerEvents:"none"},children:WC(g.value)?o.jsx(o.Fragment,{children:d}):u})});kC.displayName=MC;var x7="SelectIcon",zC=m.forwardRef((e,t)=>{const{__scopeSelect:a,children:i,...l}=e;return o.jsx(at.span,{"aria-hidden":!0,...l,ref:t,children:i||"▼"})});zC.displayName=x7;var b7="SelectPortal",PC=e=>o.jsx(Ms,{asChild:!0,...e});PC.displayName=b7;var so="SelectContent",KC=m.forwardRef((e,t)=>{const a=Ri(so,e.__scopeSelect),[i,l]=m.useState();if(hn(()=>{l(new DocumentFragment)},[]),!a.open){const u=i;return u?$d.createPortal(o.jsx(IC,{scope:e.__scopeSelect,children:o.jsx(_f.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),u):null}return o.jsx(LC,{...e,ref:t})});KC.displayName=so;var Ka=10,[IC,Ni]=zs(so),w7="SelectContentImpl",S7=s7("SelectContent.RemoveScroll"),LC=m.forwardRef((e,t)=>{const{__scopeSelect:a,position:i="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,side:f,sideOffset:g,align:y,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:_,sticky:R,hideWhenDetached:S,avoidCollisions:A,...M}=e,T=Ri(so,a),[N,E]=m.useState(null),[D,I]=m.useState(null),U=dt(t,ee=>E(ee)),[F,fe]=m.useState(null),[ge,he]=m.useState(null),ne=jf(a),[le,ce]=m.useState(!1),ve=m.useRef(!1);m.useEffect(()=>{if(N)return af(N)},[N]),tf();const O=m.useCallback(ee=>{const[Se,...De]=ne().map(Ye=>Ye.ref.current),[He]=De.slice(-1),Qe=document.activeElement;for(const Ye of ee)if(Ye===Qe||(Ye?.scrollIntoView({block:"nearest"}),Ye===Se&&D&&(D.scrollTop=0),Ye===He&&D&&(D.scrollTop=D.scrollHeight),Ye?.focus(),document.activeElement!==Qe))return},[ne,D]),j=m.useCallback(()=>O([F,N]),[O,F,N]);m.useEffect(()=>{le&&j()},[le,j]);const{onOpenChange:z,triggerPointerDownPosRef:J}=T;m.useEffect(()=>{if(N){let ee={x:0,y:0};const Se=He=>{ee={x:Math.abs(Math.round(He.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(He.pageY)-(J.current?.y??0))}},De=He=>{ee.x<=10&&ee.y<=10?He.preventDefault():N.contains(He.target)||z(!1),document.removeEventListener("pointermove",Se),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",Se),document.addEventListener("pointerup",De,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Se),document.removeEventListener("pointerup",De,{capture:!0})}}},[N,z,J]),m.useEffect(()=>{const ee=()=>z(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[z]);const[me,Te]=eE(ee=>{const Se=ne().filter(Qe=>!Qe.disabled),De=Se.find(Qe=>Qe.ref.current===document.activeElement),He=tE(Se,ee,De);He&&setTimeout(()=>He.ref.current.focus())}),H=m.useCallback((ee,Se,De)=>{const He=!ve.current&&!De;(T.value!==void 0&&T.value===Se||He)&&(fe(ee),He&&(ve.current=!0))},[T.value]),Y=m.useCallback(()=>N?.focus(),[N]),oe=m.useCallback((ee,Se,De)=>{const He=!ve.current&&!De;(T.value!==void 0&&T.value===Se||He)&&he(ee)},[T.value]),se=i==="popper"?Hm:UC,we=se===Hm?{side:f,sideOffset:g,align:y,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:_,sticky:R,hideWhenDetached:S,avoidCollisions:A}:{};return o.jsx(IC,{scope:a,content:N,viewport:D,onViewportChange:I,itemRefCallback:H,selectedItem:F,onItemLeave:Y,itemTextRefCallback:oe,focusSelectedItem:j,selectedItemText:ge,position:i,isPositioned:le,searchRef:me,children:o.jsx(pc,{as:S7,allowPinchZoom:!0,children:o.jsx(hc,{asChild:!0,trapped:T.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:Re(l,ee=>{T.trigger?.focus({preventScroll:!0}),ee.preventDefault()}),children:o.jsx(As,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:o.jsx(se,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:ee=>ee.preventDefault(),...M,...we,onPlaced:()=>ce(!0),ref:U,style:{display:"flex",flexDirection:"column",outline:"none",...M.style},onKeyDown:Re(M.onKeyDown,ee=>{const Se=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!Se&&ee.key.length===1&&Te(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let He=ne().filter(Qe=>!Qe.disabled).map(Qe=>Qe.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(He=He.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const Qe=ee.target,Ye=He.indexOf(Qe);He=He.slice(Ye+1)}setTimeout(()=>O(He)),ee.preventDefault()}})})})})})})});LC.displayName=w7;var _7="SelectItemAlignedPosition",UC=m.forwardRef((e,t)=>{const{__scopeSelect:a,onPlaced:i,...l}=e,u=Ri(so,a),d=Ni(so,a),[f,g]=m.useState(null),[y,x]=m.useState(null),v=dt(t,U=>x(U)),w=jf(a),_=m.useRef(!1),R=m.useRef(!0),{viewport:S,selectedItem:A,selectedItemText:M,focusSelectedItem:T}=d,N=m.useCallback(()=>{if(u.trigger&&u.valueNode&&f&&y&&S&&A&&M){const U=u.trigger.getBoundingClientRect(),F=y.getBoundingClientRect(),fe=u.valueNode.getBoundingClientRect(),ge=M.getBoundingClientRect();if(u.dir!=="rtl"){const Qe=ge.left-F.left,Ye=fe.left-Qe,Ft=U.left-Ye,G=U.width+Ft,Xe=Math.max(G,F.width),qe=window.innerWidth-Ka,Je=eS(Ye,[Ka,Math.max(Ka,qe-Xe)]);f.style.minWidth=G+"px",f.style.left=Je+"px"}else{const Qe=F.right-ge.right,Ye=window.innerWidth-fe.right-Qe,Ft=window.innerWidth-U.right-Ye,G=U.width+Ft,Xe=Math.max(G,F.width),qe=window.innerWidth-Ka,Je=eS(Ye,[Ka,Math.max(Ka,qe-Xe)]);f.style.minWidth=G+"px",f.style.right=Je+"px"}const he=w(),ne=window.innerHeight-Ka*2,le=S.scrollHeight,ce=window.getComputedStyle(y),ve=parseInt(ce.borderTopWidth,10),O=parseInt(ce.paddingTop,10),j=parseInt(ce.borderBottomWidth,10),z=parseInt(ce.paddingBottom,10),J=ve+O+le+z+j,me=Math.min(A.offsetHeight*5,J),Te=window.getComputedStyle(S),H=parseInt(Te.paddingTop,10),Y=parseInt(Te.paddingBottom,10),oe=U.top+U.height/2-Ka,se=ne-oe,we=A.offsetHeight/2,ee=A.offsetTop+we,Se=ve+O+ee,De=J-Se;if(Se<=oe){const Qe=he.length>0&&A===he[he.length-1].ref.current;f.style.bottom="0px";const Ye=y.clientHeight-S.offsetTop-S.offsetHeight,Ft=Math.max(se,we+(Qe?Y:0)+Ye+j),G=Se+Ft;f.style.height=G+"px"}else{const Qe=he.length>0&&A===he[0].ref.current;f.style.top="0px";const Ft=Math.max(oe,ve+S.offsetTop+(Qe?H:0)+we)+De;f.style.height=Ft+"px",S.scrollTop=Se-oe+S.offsetTop}f.style.margin=`${Ka}px 0`,f.style.minHeight=me+"px",f.style.maxHeight=ne+"px",i?.(),requestAnimationFrame(()=>_.current=!0)}},[w,u.trigger,u.valueNode,f,y,S,A,M,u.dir,i]);hn(()=>N(),[N]);const[E,D]=m.useState();hn(()=>{y&&D(window.getComputedStyle(y).zIndex)},[y]);const I=m.useCallback(U=>{U&&R.current===!0&&(N(),T?.(),R.current=!1)},[N,T]);return o.jsx(C7,{scope:a,contentWrapper:f,shouldExpandOnScrollRef:_,onScrollButtonChange:I,children:o.jsx("div",{ref:g,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:o.jsx(at.div,{...l,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});UC.displayName=_7;var j7="SelectPopperPosition",Hm=m.forwardRef((e,t)=>{const{__scopeSelect:a,align:i="start",collisionPadding:l=Ka,...u}=e,d=Cf(a);return o.jsx(Qd,{...d,...u,ref:t,align:i,collisionPadding:l,style:{boxSizing:"border-box",...u.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Hm.displayName=j7;var[C7,ry]=zs(so,{}),Xm="SelectViewport",qC=m.forwardRef((e,t)=>{const{__scopeSelect:a,nonce:i,...l}=e,u=Ni(Xm,a),d=ry(Xm,a),f=dt(t,u.onViewportChange),g=m.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),o.jsx(_f.Slot,{scope:a,children:o.jsx(at.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:Re(l.onScroll,y=>{const x=y.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=d;if(w?.current&&v){const _=Math.abs(g.current-x.scrollTop);if(_>0){const R=window.innerHeight-Ka*2,S=parseFloat(v.style.minHeight),A=parseFloat(v.style.height),M=Math.max(S,A);if(M0?E:0,v.style.justifyContent="flex-end")}}}g.current=x.scrollTop})})})]})});qC.displayName=Xm;var FC="SelectGroup",[E7,R7]=zs(FC),N7=m.forwardRef((e,t)=>{const{__scopeSelect:a,...i}=e,l=Cn();return o.jsx(E7,{scope:a,id:l,children:o.jsx(at.div,{role:"group","aria-labelledby":l,...i,ref:t})})});N7.displayName=FC;var $C="SelectLabel",O7=m.forwardRef((e,t)=>{const{__scopeSelect:a,...i}=e,l=R7($C,a);return o.jsx(at.div,{id:l.id,...i,ref:t})});O7.displayName=$C;var qd="SelectItem",[A7,VC]=zs(qd),BC=m.forwardRef((e,t)=>{const{__scopeSelect:a,value:i,disabled:l=!1,textValue:u,...d}=e,f=Ri(qd,a),g=Ni(qd,a),y=f.value===i,[x,v]=m.useState(u??""),[w,_]=m.useState(!1),R=dt(t,T=>g.itemRefCallback?.(T,i,l)),S=Cn(),A=m.useRef("touch"),M=()=>{l||(f.onValueChange(i),f.onOpenChange(!1))};if(i==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(A7,{scope:a,value:i,disabled:l,textId:S,isSelected:y,onItemTextChange:m.useCallback(T=>{v(N=>N||(T?.textContent??"").trim())},[]),children:o.jsx(_f.ItemSlot,{scope:a,value:i,disabled:l,textValue:x,children:o.jsx(at.div,{role:"option","aria-labelledby":S,"data-highlighted":w?"":void 0,"aria-selected":y&&w,"data-state":y?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...d,ref:R,onFocus:Re(d.onFocus,()=>_(!0)),onBlur:Re(d.onBlur,()=>_(!1)),onClick:Re(d.onClick,()=>{A.current!=="mouse"&&M()}),onPointerUp:Re(d.onPointerUp,()=>{A.current==="mouse"&&M()}),onPointerDown:Re(d.onPointerDown,T=>{A.current=T.pointerType}),onPointerMove:Re(d.onPointerMove,T=>{A.current=T.pointerType,l?g.onItemLeave?.():A.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Re(d.onPointerLeave,T=>{T.currentTarget===document.activeElement&&g.onItemLeave?.()}),onKeyDown:Re(d.onKeyDown,T=>{g.searchRef?.current!==""&&T.key===" "||(p7.includes(T.key)&&M(),T.key===" "&&T.preventDefault())})})})})});BC.displayName=qd;var Hl="SelectItemText",GC=m.forwardRef((e,t)=>{const{__scopeSelect:a,className:i,style:l,...u}=e,d=Ri(Hl,a),f=Ni(Hl,a),g=VC(Hl,a),y=v7(Hl,a),[x,v]=m.useState(null),w=dt(t,M=>v(M),g.onItemTextChange,M=>f.itemTextRefCallback?.(M,g.value,g.disabled)),_=x?.textContent,R=m.useMemo(()=>o.jsx("option",{value:g.value,disabled:g.disabled,children:_},g.value),[g.disabled,g.value,_]),{onNativeOptionAdd:S,onNativeOptionRemove:A}=y;return hn(()=>(S(R),()=>A(R)),[S,A,R]),o.jsxs(o.Fragment,{children:[o.jsx(at.span,{id:g.textId,...u,ref:w}),g.isSelected&&d.valueNode&&!d.valueNodeHasChildren?$d.createPortal(u.children,d.valueNode):null]})});GC.displayName=Hl;var HC="SelectItemIndicator",XC=m.forwardRef((e,t)=>{const{__scopeSelect:a,...i}=e;return VC(HC,a).isSelected?o.jsx(at.span,{"aria-hidden":!0,...i,ref:t}):null});XC.displayName=HC;var Zm="SelectScrollUpButton",ZC=m.forwardRef((e,t)=>{const a=Ni(Zm,e.__scopeSelect),i=ry(Zm,e.__scopeSelect),[l,u]=m.useState(!1),d=dt(t,i.onScrollButtonChange);return hn(()=>{if(a.viewport&&a.isPositioned){let f=function(){const y=g.scrollTop>0;u(y)};const g=a.viewport;return f(),g.addEventListener("scroll",f),()=>g.removeEventListener("scroll",f)}},[a.viewport,a.isPositioned]),l?o.jsx(QC,{...e,ref:d,onAutoScroll:()=>{const{viewport:f,selectedItem:g}=a;f&&g&&(f.scrollTop=f.scrollTop-g.offsetHeight)}}):null});ZC.displayName=Zm;var Ym="SelectScrollDownButton",YC=m.forwardRef((e,t)=>{const a=Ni(Ym,e.__scopeSelect),i=ry(Ym,e.__scopeSelect),[l,u]=m.useState(!1),d=dt(t,i.onScrollButtonChange);return hn(()=>{if(a.viewport&&a.isPositioned){let f=function(){const y=g.scrollHeight-g.clientHeight,x=Math.ceil(g.scrollTop)g.removeEventListener("scroll",f)}},[a.viewport,a.isPositioned]),l?o.jsx(QC,{...e,ref:d,onAutoScroll:()=>{const{viewport:f,selectedItem:g}=a;f&&g&&(f.scrollTop=f.scrollTop+g.offsetHeight)}}):null});YC.displayName=Ym;var QC=m.forwardRef((e,t)=>{const{__scopeSelect:a,onAutoScroll:i,...l}=e,u=Ni("SelectScrollButton",a),d=m.useRef(null),f=jf(a),g=m.useCallback(()=>{d.current!==null&&(window.clearInterval(d.current),d.current=null)},[]);return m.useEffect(()=>()=>g(),[g]),hn(()=>{f().find(x=>x.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[f]),o.jsx(at.div,{"aria-hidden":!0,...l,ref:t,style:{flexShrink:0,...l.style},onPointerDown:Re(l.onPointerDown,()=>{d.current===null&&(d.current=window.setInterval(i,50))}),onPointerMove:Re(l.onPointerMove,()=>{u.onItemLeave?.(),d.current===null&&(d.current=window.setInterval(i,50))}),onPointerLeave:Re(l.onPointerLeave,()=>{g()})})}),T7="SelectSeparator",D7=m.forwardRef((e,t)=>{const{__scopeSelect:a,...i}=e;return o.jsx(at.div,{"aria-hidden":!0,...i,ref:t})});D7.displayName=T7;var Qm="SelectArrow",M7=m.forwardRef((e,t)=>{const{__scopeSelect:a,...i}=e,l=Cf(a),u=Ri(Qm,a),d=Ni(Qm,a);return u.open&&d.position==="popper"?o.jsx(Jd,{...l,...i,ref:t}):null});M7.displayName=Qm;var k7="SelectBubbleInput",JC=m.forwardRef(({__scopeSelect:e,value:t,...a},i)=>{const l=m.useRef(null),u=dt(i,l),d=OC(t);return m.useEffect(()=>{const f=l.current;if(!f)return;const g=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(g,"value").set;if(d!==t&&x){const v=new Event("change",{bubbles:!0});x.call(f,t),f.dispatchEvent(v)}},[d,t]),o.jsx(at.select,{...a,style:{...j1,...a.style},ref:u,defaultValue:t})});JC.displayName=k7;function WC(e){return e===""||e===void 0}function eE(e){const t=Ba(e),a=m.useRef(""),i=m.useRef(0),l=m.useCallback(d=>{const f=a.current+d;t(f),(function g(y){a.current=y,window.clearTimeout(i.current),y!==""&&(i.current=window.setTimeout(()=>g(""),1e3))})(f)},[t]),u=m.useCallback(()=>{a.current="",window.clearTimeout(i.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(i.current),[]),[a,l,u]}function tE(e,t,a){const l=t.length>1&&Array.from(t).every(y=>y===t[0])?t[0]:t,u=a?e.indexOf(a):-1;let d=z7(e,Math.max(u,0));l.length===1&&(d=d.filter(y=>y!==a));const g=d.find(y=>y.textValue.toLowerCase().startsWith(l.toLowerCase()));return g!==a?g:void 0}function z7(e,t){return e.map((a,i)=>e[(t+i)%e.length])}var P7=AC,K7=DC,I7=kC,L7=zC,U7=PC,q7=KC,F7=qC,$7=BC,V7=GC,B7=XC,G7=ZC,H7=YC;function Dt({...e}){return o.jsx(P7,{"data-slot":"select",...e})}function Mt({...e}){return o.jsx(I7,{"data-slot":"select-value",...e})}function kt({className:e,size:t="default",children:a,...i}){return o.jsxs(K7,{"data-slot":"select-trigger","data-size":t,className:de("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[a,o.jsx(L7,{asChild:!0,children:o.jsx(NS,{className:"size-4 opacity-50"})})]})}function zt({className:e,children:t,position:a="popper",align:i="center",...l}){return o.jsx(U7,{children:o.jsxs(q7,{"data-slot":"select-content",className:de("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,align:i,...l,children:[o.jsx(X7,{}),o.jsx(F7,{className:de("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),o.jsx(Z7,{})]})})}function Fe({className:e,children:t,...a}){return o.jsxs($7,{"data-slot":"select-item",className:de("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none 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),...a,children:[o.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:o.jsx(B7,{children:o.jsx(RS,{className:"size-4"})})}),o.jsx(V7,{children:t})]})}function X7({className:e,...t}){return o.jsx(G7,{"data-slot":"select-scroll-up-button",className:de("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(zO,{className:"size-4"})})}function Z7({className:e,...t}){return o.jsx(H7,{"data-slot":"select-scroll-down-button",className:de("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(NS,{className:"size-4"})})}var Ef="Switch",[Y7]=Za(Ef),[Q7,J7]=Y7(Ef),nE=m.forwardRef((e,t)=>{const{__scopeSwitch:a,name:i,checked:l,defaultChecked:u,required:d,disabled:f,value:g="on",onCheckedChange:y,form:x,...v}=e,[w,_]=m.useState(null),R=dt(t,N=>_(N)),S=m.useRef(!1),A=w?x||!!w.closest("form"):!0,[M,T]=xi({prop:l,defaultProp:u??!1,onChange:y,caller:Ef});return o.jsxs(Q7,{scope:a,checked:M,disabled:f,children:[o.jsx(at.button,{type:"button",role:"switch","aria-checked":M,"aria-required":d,"data-state":oE(M),"data-disabled":f?"":void 0,disabled:f,value:g,...v,ref:R,onClick:Re(e.onClick,N=>{T(E=>!E),A&&(S.current=N.isPropagationStopped(),S.current||N.stopPropagation())})}),A&&o.jsx(iE,{control:w,bubbles:!S.current,name:i,value:g,checked:M,required:d,disabled:f,form:x,style:{transform:"translateX(-100%)"}})]})});nE.displayName=Ef;var aE="SwitchThumb",rE=m.forwardRef((e,t)=>{const{__scopeSwitch:a,...i}=e,l=J7(aE,a);return o.jsx(at.span,{"data-state":oE(l.checked),"data-disabled":l.disabled?"":void 0,...i,ref:t})});rE.displayName=aE;var W7="SwitchBubbleInput",iE=m.forwardRef(({__scopeSwitch:e,control:t,checked:a,bubbles:i=!0,...l},u)=>{const d=m.useRef(null),f=dt(d,u),g=OC(a),y=p1(t);return m.useEffect(()=>{const x=d.current;if(!x)return;const v=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(v,"checked").set;if(g!==a&&_){const R=new Event("click",{bubbles:i});_.call(x,a),x.dispatchEvent(R)}},[g,a,i]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...l,tabIndex:-1,ref:f,style:{...l.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});iE.displayName=W7;function oE(e){return e?"checked":"unchecked"}var e9=nE,t9=rE;function tS({className:e,...t}){return o.jsx(e9,{"data-slot":"switch",className:de("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(t9,{"data-slot":"switch-thumb",className:de("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function gs({className:e,...t}){return o.jsx("textarea",{"data-slot":"textarea",className:de("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}const Fd=["route53","s3","ec2","iam","rds","dynamodb"];Pt().min(2,"JSON required").refine(e=>{try{return JSON.parse(e),!0}catch{return!1}},"Invalid JSON").transform(e=>JSON.parse(e));const Jm=pa({provider:Fa(["aws","cloudflare","hetzner","digitalocean","generic"]),kind:Fa(["aws_access_key","api_token","basic_auth","oauth2"]),schema_version:Kd().default(1),name:Pt().min(1,"Name is required").max(100),scope_kind:Fa(["provider","service","resource"]),scope_version:Kd().default(1),scope:G0(),account_id:Pt().optional().or(Id("")).transform(e=>e||void 0),region:Pt().optional().or(Id("")).transform(e=>e||void 0),secret:G0()}).superRefine((e,t)=>{if(e.provider==="aws"){if(e.scope_kind==="service"){const a=e.scope?.service;Fd.includes(a)||t.addIssue({code:pi.custom,path:["scope"],message:`For AWS service scope, "service" must be one of: ${Fd.join(", ")}`})}if(e.scope_kind==="resource"){const a=e.scope?.arn;(typeof a!="string"||!a.startsWith("arn:"))&&t.addIssue({code:pi.custom,path:["scope"],message:'For AWS resource scope, "arn" must start with "arn:"'})}if(e.kind==="aws_access_key"){const a=e.secret??{},i=a.access_key_id;(typeof i!="string"||!/^[A-Z0-9]{20}$/.test(i))&&t.addIssue({code:pi.custom,path:["secret"],message:"access_key_id must be 20 chars (A-Z0-9)"}),(typeof a.secret_access_key!="string"||a.secret_access_key.length<10)&&t.addIssue({code:pi.custom,path:["secret"],message:"secret_access_key is required"})}}if(e.kind==="api_token"&&((e.secret??{}).token||t.addIssue({code:pi.custom,path:["secret"],message:"token is required"})),e.kind==="basic_auth"){const a=e.secret??{};(!a.username||!a.password)&&t.addIssue({code:pi.custom,path:["secret"],message:"username and password are required"})}if(e.kind==="oauth2"){const a=e.secret??{};(!a.client_id||!a.client_secret||!a.refresh_token)&&t.addIssue({code:pi.custom,path:["secret"],message:"client_id, client_secret, and refresh_token are required"})}e.scope_kind!=="provider"&&!e.scope&&t.addIssue({code:pi.custom,path:["scope"],message:"scope is required"})}),nS=Jm.partial().extend({name:Pt().min(1,"Name is required").max(100).optional()});function os(e){try{return JSON.stringify(e,null,2)}catch{return""}}function od(e){const t=e?.body??e?.response??e?.message;if(typeof t=="string")return t;try{const a=e?.response?.data?.message||e?.message;if(a)return String(a);const i=e?.response?.text?JSON.parse(e.response.text()):null;if(i?.message)return i.message}catch{}return"Unknown error"}function n9({provider:e,scope_kind:t}){return e==="aws"&&t==="service"}function a9({provider:e,scope_kind:t}){return e==="aws"&&t==="resource"}function r9({scope_kind:e}){return e==="provider"}function aS(){return{provider:"aws",kind:"aws_access_key",schema_version:1,name:"",scope_kind:"provider",scope_version:1,scope:{},account_id:"",region:"",secret:{}}}const i9=()=>{const[e,t]=m.useState(""),[a,i]=m.useState(!1),[l,u]=m.useState(!1),[d,f]=m.useState(!1),[g,y]=m.useState(null),[x,v]=m.useState(null),[w,_]=m.useState(!1),[R,S]=m.useState(!1),A=Xn(),M=Zt({queryKey:["credentials"],queryFn:()=>Ml.listCredentials()}),T=lt({mutationFn:j=>Ml.createCredential({provider:j.provider,kind:j.kind,schema_version:j.schema_version??1,name:j.name,scope_kind:j.scope_kind,scope_version:j.scope_version??1,scope:j.scope,account_id:j.account_id,region:j.region,secret:j.secret}),onSuccess:async()=>{await A.invalidateQueries({queryKey:["credentials"]}),xe.success("Credential created"),i(!1),I.reset(aS()),_(!1)},onError:j=>{xe.error("Failed to create credential",{description:od(j)})}}),N=lt({mutationFn:j=>Ml.updateCredential(j.id,j.body),onSuccess:async()=>{await A.invalidateQueries({queryKey:["credentials"]}),xe.success("Credential updated"),u(!1),v(null),S(!1)},onError:j=>{xe.error("Failed to update credential",{description:od(j)})}}),E=lt({mutationFn:j=>Ml.deleteCredential(j),onSuccess:async()=>{await A.invalidateQueries({queryKey:["credentials"]}),xe.success("Credential deleted")},onError:j=>{xe.error("Failed to delete credential",{description:od(j)})}}),D=lt({mutationFn:j=>Ml.revealCredential(j),onSuccess:j=>{y(j),f(!0)},onError:j=>{xe.error("Failed to reveal secret",{description:od(j)})}}),I=un({resolver:dn(Jm),defaultValues:aS(),mode:"onBlur"}),U=un({resolver:dn(nS),defaultValues:{},mode:"onBlur"});function F(j){v(j.id),U.reset({provider:j.provider,kind:j.kind,schema_version:j.schema_version??1,name:j.name,scope_kind:j.scope_kind,scope_version:j.scope_version??1,account_id:j.account_id??"",region:j.region??"",scope:j.scope??(j.scope_kind==="provider"?{}:void 0),secret:void 0}),S(!1),u(!0)}const fe=m.useMemo(()=>{const j=M.data??[];if(!e.trim())return j;const z=e.toLowerCase();return j.filter(J=>[J.name,J.provider,J.kind,J.scope_kind,J.account_id,J.region,JSON.stringify(J.scope??{})].filter(Boolean).map(me=>String(me).toLowerCase()).some(me=>me.includes(z)))},[M.data,e]);if(M.isLoading)return o.jsxs("div",{className:"flex items-center gap-2 p-6",children:[o.jsx(lr,{className:"h-4 w-4 animate-spin"})," Loading credentials…"]});if(M.error)return o.jsxs("div",{className:"p-6 text-red-500",children:["Error loading credentials.",o.jsx("pre",{className:"mt-2 text-xs opacity-80",children:JSON.stringify(M.error,null,2)})]});const ge=I.watch("provider"),he=I.watch("kind"),ne=I.watch("scope_kind"),le=j=>I.setValue("scope",j,{shouldDirty:!0,shouldValidate:!0}),ce=j=>I.setValue("secret",j,{shouldDirty:!0,shouldValidate:!0});function ve(){if(!w){if(ge==="aws"&&he==="aws_access_key"){const j=I.getValues("secret")??{};ce({access_key_id:j.access_key_id??"",secret_access_key:j.secret_access_key??""})}else if(he==="api_token"){const j=I.getValues("secret")??{};ce({token:j.token??""})}else if(he==="basic_auth"){const j=I.getValues("secret")??{};ce({username:j.username??"",password:j.password??""})}else if(he==="oauth2"){const j=I.getValues("secret")??{};ce({client_id:j.client_id??"",client_secret:j.client_secret??"",refresh_token:j.refresh_token??""})}}}function O(j){I.setValue("scope_kind",j),j==="provider"&&le({}),j==="service"&&le({service:"route53"}),j==="resource"&&le({arn:""})}return o.jsxs("div",{className:"space-y-4 p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"mb-1 text-2xl font-bold",children:"Credentials"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Store provider credentials. Secrets are encrypted server-side; revealing is a one-time read."})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx(dr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),o.jsx(Ae,{value:e,onChange:j=>t(j.target.value),placeholder:"Search by name, provider, kind, scope…",className:"w-64 pl-8"})]}),o.jsxs(bt,{open:a,onOpenChange:i,children:[o.jsx(Xa,{asChild:!0,children:o.jsxs(ie,{onClick:()=>i(!0),children:[o.jsx(Si,{className:"mr-2 h-4 w-4"}),"Create Credential"]})}),o.jsxs(wt,{className:"sm:max-w-2xl",children:[o.jsx(St,{children:o.jsx(_t,{children:"Create Credential"})}),o.jsx(fn,{...I,children:o.jsxs("form",{onSubmit:I.handleSubmit(j=>{const z=Jm.safeParse(j);if(!z.success){xe.error("Please fix validation errors");return}T.mutate(z.data)}),className:"space-y-5 pt-2",children:[o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsx(Ke,{control:I.control,name:"provider",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Provider"}),o.jsxs(Dt,{onValueChange:z=>{j.onChange(z),ve()},defaultValue:j.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"aws",children:"AWS"}),o.jsx(Fe,{value:"cloudflare",children:"Cloudflare"}),o.jsx(Fe,{value:"hetzner",children:"Hetzner"}),o.jsx(Fe,{value:"digitalocean",children:"DigitalOcean"}),o.jsx(Fe,{value:"generic",children:"Generic"})]})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:I.control,name:"kind",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Kind"}),o.jsxs(Dt,{onValueChange:z=>{j.onChange(z),ve()},defaultValue:j.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"aws_access_key",children:"AWS Access Key"}),o.jsx(Fe,{value:"api_token",children:"API Token"}),o.jsx(Fe,{value:"basic_auth",children:"Basic Auth"}),o.jsx(Fe,{value:"oauth2",children:"OAuth2"})]})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:I.control,name:"scope_kind",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Scope Kind"}),o.jsxs(Dt,{onValueChange:z=>{O(z)},defaultValue:j.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"provider",children:"Provider"}),o.jsx(Fe,{value:"service",children:"Service"}),o.jsx(Fe,{value:"resource",children:"Resource"})]})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:I.control,name:"name",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Name"}),o.jsx(Ae,{...j,placeholder:"My AWS Key"}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:I.control,name:"account_id",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Account ID (optional)"}),o.jsx(Ae,{...j,placeholder:"e.g. 123456789012"}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:I.control,name:"region",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Region (optional)"}),o.jsx(Ae,{...j,placeholder:"e.g. us-east-1"}),o.jsx(Pe,{})]})})]}),!r9({scope_kind:ne})&&o.jsx(o.Fragment,{children:n9({provider:ge,scope_kind:ne})?o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Service"}),o.jsx(Pa,{control:I.control,name:"scope",render:({field:j})=>o.jsxs(Dt,{onValueChange:z=>j.onChange({service:z}),value:j.value?.service??"route53",children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"Select an AWS service"})})}),o.jsx(zt,{children:Fd.map(z=>o.jsx(Fe,{value:z,children:z.toUpperCase()},z))})]})}),o.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["Must be one of: ",Fd.join(", "),"."]})]}):a9({provider:ge,scope_kind:ne})?o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Resource ARN"}),o.jsx(Pa,{control:I.control,name:"scope",render:({field:j})=>o.jsx(Ae,{value:j.value?.arn??"",onChange:z=>j.onChange({arn:z.target.value}),placeholder:"arn:aws:service:region:account:resource"})}),o.jsx(Pe,{})]}):o.jsx(Ke,{control:I.control,name:"scope",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Scope (JSON)"}),o.jsx(gs,{value:os(j.value??{}),onChange:z=>{try{const J=JSON.parse(z.target.value);j.onChange(J)}catch{j.onChange(z.target.value)}},rows:3,placeholder:'{"service":"route53"} or {"arn":"arn:aws:..."}',className:"font-mono"}),o.jsx(Pe,{})]})})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(tS,{checked:w,onCheckedChange:j=>{_(j),ve()},id:"raw-secret-toggle"}),o.jsx("label",{htmlFor:"raw-secret-toggle",className:"text-sm",children:"Edit secret as raw JSON"})]}),w?o.jsx(Ke,{control:I.control,name:"secret",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Secret (JSON)"}),o.jsx(gs,{value:os(j.value??{}),onChange:z=>{try{j.onChange(JSON.parse(z.target.value))}catch{j.onChange(z.target.value)}},rows:6,placeholder:he==="aws_access_key"?'{"access_key_id":"...","secret_access_key":"..."}':he==="api_token"?'{"token":"..."}':he==="basic_auth"?'{"username":"...","password":"..."}':'{"client_id":"...","client_secret":"...","refresh_token":"..."}',className:"font-mono"}),o.jsx(Pe,{})]})}):o.jsxs(o.Fragment,{children:[ge==="aws"&&he==="aws_access_key"&&o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Access Key ID"}),o.jsx(Pa,{control:I.control,name:"secret",render:({field:j})=>o.jsx(Ae,{value:(j.value??{}).access_key_id??"",onChange:z=>ce({...j.value??{},access_key_id:z.target.value.trim()}),placeholder:"AKIA..."})})]}),o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Secret Access Key"}),o.jsx(Pa,{control:I.control,name:"secret",render:({field:j})=>o.jsx(Ae,{type:"password",value:(j.value??{}).secret_access_key??"",onChange:z=>ce({...j.value??{},secret_access_key:z.target.value}),placeholder:"•••••••••••••••"})})]})]}),he==="api_token"&&o.jsxs(Ce,{children:[o.jsx(Ee,{children:"API Token"}),o.jsx(Pa,{control:I.control,name:"secret",render:({field:j})=>o.jsx(Ae,{value:(j.value??{}).token??"",onChange:z=>ce({...j.value??{},token:z.target.value}),placeholder:"token..."})})]}),he==="basic_auth"&&o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Username"}),o.jsx(Pa,{control:I.control,name:"secret",render:({field:j})=>o.jsx(Ae,{value:(j.value??{}).username??"",onChange:z=>ce({...j.value??{},username:z.target.value})})})]}),o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Password"}),o.jsx(Pa,{control:I.control,name:"secret",render:({field:j})=>o.jsx(Ae,{type:"password",value:(j.value??{}).password??"",onChange:z=>ce({...j.value??{},password:z.target.value})})})]})]}),he==="oauth2"&&o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Client ID"}),o.jsx(Pa,{control:I.control,name:"secret",render:({field:j})=>o.jsx(Ae,{value:(j.value??{}).client_id??"",onChange:z=>ce({...j.value??{},client_id:z.target.value})})})]}),o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Client Secret"}),o.jsx(Pa,{control:I.control,name:"secret",render:({field:j})=>o.jsx(Ae,{type:"password",value:(j.value??{}).client_secret??"",onChange:z=>ce({...j.value??{},client_secret:z.target.value})})})]}),o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Refresh Token"}),o.jsx(Pa,{control:I.control,name:"secret",render:({field:j})=>o.jsx(Ae,{value:(j.value??{}).refresh_token??"",onChange:z=>ce({...j.value??{},refresh_token:z.target.value})})})]})]})]}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{variant:"outline",type:"button",onClick:()=>i(!1),children:"Cancel"}),o.jsxs(ie,{type:"submit",disabled:T.isPending,children:[T.isPending&&o.jsx(lr,{className:"mr-2 h-4 w-4 animate-spin"}),"Create"]})]})]})})]})]})]})]}),o.jsx("div",{className:"overflow-x-auto rounded-xl border",children:o.jsxs("table",{className:"min-w-full text-sm",children:[o.jsx("thead",{className:"bg-muted/40 text-xs tracking-wide uppercase",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-[26%] px-4 py-2 text-left",children:"Name"}),o.jsx("th",{className:"px-4 py-2 text-left",children:"Provider"}),o.jsx("th",{className:"px-4 py-2 text-left",children:"Kind"}),o.jsx("th",{className:"px-4 py-2 text-left",children:"Scope"}),o.jsx("th",{className:"px-4 py-2 text-left",children:"Account"}),o.jsx("th",{className:"px-4 py-2 text-left",children:"Region"}),o.jsx("th",{className:"px-4 py-2 text-right",children:"Actions"})]})}),o.jsxs("tbody",{children:[fe.map(j=>o.jsxs("tr",{className:"border-t",children:[o.jsxs("td",{className:"px-4 py-2",children:[o.jsx("div",{className:"font-medium",children:j.name}),o.jsxs("div",{className:"text-muted-foreground text-xs",children:[o.jsx("span",{className:"mr-1",children:"id:"}),o.jsxs("code",{className:"bg-muted rounded px-1",children:[j.id.slice(0,8),"…"]})]})]}),o.jsx("td",{className:"px-4 py-2",children:j.provider}),o.jsx("td",{className:"px-4 py-2",children:j.kind}),o.jsx("td",{className:"px-4 py-2",children:o.jsx(ca,{variant:"secondary",children:j.scope_kind})}),o.jsx("td",{className:"px-4 py-2",children:j.account_id??"—"}),o.jsx("td",{className:"px-4 py-2",children:j.region??"—"}),o.jsx("td",{className:"px-4 py-2",children:o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsx(ie,{size:"icon",variant:"ghost",title:"Reveal secret (one-time read)",onClick:()=>D.mutate(j.id),children:o.jsx(wm,{className:"h-4 w-4"})}),o.jsx(ie,{size:"icon",variant:"ghost",title:"Edit",onClick:()=>F(j),children:o.jsx(sc,{className:"h-4 w-4"})}),o.jsxs(kj,{children:[o.jsx(zj,{asChild:!0,children:o.jsx(ie,{size:"icon",variant:"ghost",title:"Delete",children:o.jsx(lg,{className:"h-4 w-4"})})}),o.jsxs(Pj,{children:[o.jsxs(Kj,{children:[o.jsxs(Lj,{children:["Delete “",j.name,"”?"]}),o.jsx(Uj,{children:"This will permanently remove the credential metadata. Secrets are not recoverable."})]}),o.jsxs(Ij,{children:[o.jsx(Fj,{disabled:E.isPending,children:"Cancel"}),o.jsxs(qj,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>E.mutate(j.id),disabled:E.isPending,children:[E.isPending&&o.jsx(lr,{className:"mr-2 inline h-4 w-4 animate-spin"}),"Delete"]})]})]})]}),o.jsxs(EC,{children:[o.jsx(RC,{asChild:!0,children:o.jsx(ie,{size:"icon",variant:"ghost",children:o.jsx(OS,{className:"h-4 w-4"})})}),o.jsxs(NC,{align:"end",children:[o.jsx(Jl,{onClick:()=>F(j),children:"Edit"}),o.jsx(Jl,{onClick:()=>D.mutate(j.id),children:"Reveal secret"}),o.jsx(Jl,{className:"text-destructive",onClick:()=>E.mutate(j.id),children:"Delete"})]})]})]})})]},j.id)),fe.length===0&&o.jsx("tr",{children:o.jsx("td",{colSpan:7,className:"px-4 py-12 text-center",children:o.jsxs("div",{className:"mx-auto max-w-md",children:[o.jsx("div",{className:"mb-2 flex items-center justify-center",children:o.jsx(Sm,{className:"text-muted-foreground h-5 w-5"})}),o.jsx("p",{className:"text-muted-foreground",children:"No credentials match your search."})]})})})]})]})}),o.jsx(bt,{open:l,onOpenChange:u,children:o.jsxs(wt,{className:"sm:max-w-2xl",children:[o.jsx(St,{children:o.jsx(_t,{children:"Edit Credential"})}),o.jsx(fn,{...U,children:o.jsxs("form",{onSubmit:U.handleSubmit(j=>{if(!x)return;const z=nS.safeParse(j);if(!z.success){xe.error("Please fix validation errors");return}N.mutate({id:x,body:z.data})}),className:"space-y-5 pt-2",children:[o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsx(Ke,{control:U.control,name:"provider",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Provider"}),o.jsxs(Dt,{onValueChange:j.onChange,value:j.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"aws",children:"AWS"}),o.jsx(Fe,{value:"cloudflare",children:"Cloudflare"}),o.jsx(Fe,{value:"hetzner",children:"Hetzner"}),o.jsx(Fe,{value:"digitalocean",children:"DigitalOcean"}),o.jsx(Fe,{value:"generic",children:"Generic"})]})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:U.control,name:"kind",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Kind"}),o.jsxs(Dt,{onValueChange:j.onChange,value:j.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"aws_access_key",children:"AWS Access Key"}),o.jsx(Fe,{value:"api_token",children:"API Token"}),o.jsx(Fe,{value:"basic_auth",children:"Basic Auth"}),o.jsx(Fe,{value:"oauth2",children:"OAuth2"})]})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:U.control,name:"scope_kind",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Scope Kind"}),o.jsxs(Dt,{onValueChange:j.onChange,value:j.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"provider",children:"Provider"}),o.jsx(Fe,{value:"service",children:"Service"}),o.jsx(Fe,{value:"resource",children:"Resource"})]})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:U.control,name:"name",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Name"}),o.jsx(Ae,{...j}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:U.control,name:"account_id",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Account ID"}),o.jsx(Ae,{...j,placeholder:"optional"}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:U.control,name:"region",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Region"}),o.jsx(Ae,{...j,placeholder:"optional"}),o.jsx(Pe,{})]})})]}),o.jsx(Ke,{control:U.control,name:"scope",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Scope (JSON)"}),o.jsx(gs,{value:os(j.value??(U.getValues("scope_kind")==="provider"?{}:void 0)),onChange:z=>{try{j.onChange(JSON.parse(z.target.value))}catch{j.onChange(z.target.value)}},rows:3,className:"font-mono"}),o.jsx(Pe,{})]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(tS,{checked:R,onCheckedChange:S,id:"raw-edit-secret-toggle"}),o.jsx("label",{htmlFor:"raw-edit-secret-toggle",className:"text-sm",children:"Rotate secret with raw JSON (leave empty to keep existing)"})]}),R&&o.jsx(Ke,{control:U.control,name:"secret",render:({field:j})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Rotate Secret (JSON)"}),o.jsx(gs,{value:typeof j.value=="string"?j.value:os(j.value??{}),onChange:z=>{try{j.onChange(JSON.parse(z.target.value))}catch{j.onChange(z.target.value)}},rows:6,className:"font-mono",placeholder:'{"access_key_id":"...","secret_access_key":"..."}'}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{variant:"outline",type:"button",onClick:()=>u(!1),children:"Cancel"}),o.jsxs(ie,{type:"submit",disabled:N.isPending,children:[N.isPending&&o.jsx(lr,{className:"mr-2 h-4 w-4 animate-spin"}),"Save changes"]})]})]})})]})}),o.jsx(bt,{open:d,onOpenChange:f,children:o.jsxs(wt,{className:"sm:max-w-xl",children:[o.jsx(St,{children:o.jsxs(_t,{className:"flex items-center gap-2",children:[o.jsx(wm,{className:"h-4 w-4"})," Decrypted Secret"]})}),o.jsx("div",{className:"bg-muted/40 rounded-lg border p-3",children:o.jsx("pre",{className:"max-h-[50vh] overflow-auto text-xs leading-relaxed",children:os(g??{})})}),o.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[o.jsx(Sm,{className:"h-3.5 w-3.5"}),"One-time read. Close this dialog to hide the secret."]}),o.jsxs(Nt,{children:[o.jsx(ie,{variant:"outline",onClick:()=>{navigator.clipboard.writeText(os(g??{})),xe.success("Copied to clipboard")},children:"Copy"}),o.jsx(ie,{onClick:()=>f(!1),children:"Close"})]})]})})]})},kl=yD(),zl={listJobs:(e={})=>ze(async()=>await kl.adminListArcherJobs(e)),enqueue:e=>ze(async()=>await kl.adminEnqueueArcherJob({body:e})),retryJob:e=>ze(async()=>await kl.adminRetryArcherJob({id:e})),cancelJob:e=>ze(async()=>await kl.adminCancelArcherJob({id:e})),listQueues:()=>ze(async()=>await kl.adminListArcherQueues())},o9=["queued","running","succeeded","failed","canceled","retrying","scheduled"],s9={queued:"bg-amber-100 text-amber-800",running:"bg-sky-100 text-sky-800",succeeded:"bg-emerald-100 text-emerald-800",failed:"bg-red-100 text-red-800",canceled:"bg-zinc-200 text-zinc-700",retrying:"bg-orange-100 text-orange-800",scheduled:"bg-violet-100 text-violet-800"};function rS(e){if(!e)return"—";const t=new Date(e);return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function l9(e,t=300){const[a,i]=m.useState(e);return m.useEffect(()=>{const l=setTimeout(()=>i(e),t);return()=>clearTimeout(l)},[e,t]),a}const c9=()=>{const e=Xn(),[t,a]=m.useState(""),[i,l]=m.useState(""),[u,d]=m.useState(""),f=l9(u,300),[g,y]=m.useState(1),[x,v]=m.useState(25),_=Zt({queryKey:["archer","jobs",{status:t,queue:i,q:f,page:g,pageSize:x}],queryFn:()=>zl.listJobs({status:t,queue:i||void 0,q:f||void 0,page:g,pageSize:x}),placeholderData:D=>D,staleTime:1e4}),R=Zt({queryKey:["archer","queues"],queryFn:()=>zl.listQueues(),staleTime:3e4}),S=lt({mutationFn:D=>zl.enqueue(D),onSuccess:()=>e.invalidateQueries({queryKey:["archer","jobs"]})}),A=lt({mutationFn:D=>zl.retryJob(D),onSuccess:()=>e.invalidateQueries({queryKey:["archer","jobs"]})}),M=lt({mutationFn:D=>zl.cancelJob(D),onSuccess:()=>e.invalidateQueries({queryKey:["archer","jobs"]})}),T=_.isFetching,N=_.data,E=N?Math.max(1,Math.ceil(N.total/N.pageSize)):1;return o.jsxs("div",{className:"container mx-auto space-y-6 p-6",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-semibold",children:"Archer Jobs"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Inspect, enqueue, retry and cancel background jobs."})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(d9,{onSubmit:D=>S.mutateAsync(D),submitting:S.isPending}),o.jsxs(ie,{variant:"secondary",onClick:()=>e.invalidateQueries({queryKey:["archer","jobs"]}),disabled:T,children:[T?o.jsx(lr,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(m2,{className:"mr-2 h-4 w-4"}),"Refresh"]})]})]}),o.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:R.data?.map(D=>o.jsxs($a,{children:[o.jsx(hr,{children:o.jsx(pr,{className:"text-base",children:D.name})}),o.jsxs(Va,{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsx(sd,{label:"Pending",value:D.pending}),o.jsx(sd,{label:"Running",value:D.running}),o.jsx(sd,{label:"Failed",value:D.failed}),o.jsx(sd,{label:"Scheduled",value:D.scheduled})]})]},D.name))}),o.jsxs($a,{children:[o.jsx(hr,{children:o.jsx(pr,{children:"Filters"})}),o.jsxs(Va,{className:"grid gap-3 md:grid-cols-4",children:[o.jsxs("div",{className:"col-span-2 flex items-center gap-2",children:[o.jsx(Ae,{placeholder:"Search id, queue, error, payload…",value:u,onChange:D=>{d(D.target.value),y(1)},onKeyDown:D=>D.key==="Enter"&&e.invalidateQueries({queryKey:["archer","jobs"]})}),u&&o.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>d(""),children:o.jsx(cg,{className:"h-4 w-4"})}),o.jsxs(ie,{onClick:()=>e.invalidateQueries({queryKey:["archer","jobs"]}),children:[o.jsx(dr,{className:"mr-2 h-4 w-4"})," Search"]})]}),o.jsxs(Dt,{value:t||"all",onValueChange:D=>{a(D==="all"?"":D),y(1)},children:[o.jsx(kt,{children:o.jsx(Mt,{placeholder:"All statuses"})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"all",children:"All statuses"}),o9.map(D=>o.jsx(Fe,{value:D,children:D},D))]})]}),o.jsx(Ae,{placeholder:"Queue (optional)",value:i,onChange:D=>{l(D.target.value),y(1)}}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Kr,{className:"whitespace-nowrap",children:"Page size"}),o.jsxs(Dt,{value:String(x),onValueChange:D=>{v(Number(D)),y(1)},children:[o.jsx(kt,{className:"w-[120px]",children:o.jsx(Mt,{})}),o.jsx(zt,{children:[10,25,50,100].map(D=>o.jsx(Fe,{value:String(D),children:D},D))})]})]})]})]}),o.jsx($a,{children:o.jsxs(Va,{className:"p-0",children:[o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"ID"}),o.jsx(Ue,{children:"Queue"}),o.jsx(Ue,{children:"Status"}),o.jsx(Ue,{children:"Attempts"}),o.jsx(Ue,{children:"Run At"}),o.jsx(Ue,{children:"Updated"}),o.jsx(Ue,{className:"pr-4 text-right",children:"Actions"})]})}),o.jsxs(ha,{children:[_.isLoading&&o.jsx(tt,{children:o.jsx(je,{colSpan:7,className:"text-muted-foreground py-8 text-center",children:"Loading…"})}),_.isError&&o.jsx(tt,{children:o.jsx(je,{colSpan:7,className:"py-8 text-center text-red-600",children:"Failed to load jobs"})}),!_.isLoading&&N&&N.items.length===0&&o.jsx(tt,{children:o.jsx(je,{colSpan:7,className:"text-muted-foreground py-8 text-center",children:"No jobs match your filters."})}),N?.items.map(D=>o.jsxs(tt,{children:[o.jsx(je,{children:o.jsx("code",{className:"text-xs",children:D.id})}),o.jsx(je,{children:o.jsx(ca,{variant:"secondary",children:D.queue})}),o.jsx(je,{children:o.jsx("span",{className:de("rounded-md px-2 py-0.5 text-xs",s9[D.status]),children:D.status})}),o.jsx(je,{children:D.maxAttempts?`${D.attempts}/${D.maxAttempts}`:D.attempts}),o.jsx(je,{children:rS(D.runAt)}),o.jsx(je,{children:rS(D.updatedAt??D.createdAt)}),o.jsx(je,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[(D.status==="failed"||D.status==="canceled")&&o.jsx(ie,{size:"sm",variant:"outline",disabled:A.isPending,onClick:()=>A.mutate(D.id),children:"Retry"}),(D.status==="queued"||D.status==="running"||D.status==="scheduled")&&o.jsx(ie,{size:"sm",variant:"outline",disabled:M.isPending,onClick:()=>M.mutate(D.id),children:"Cancel"}),o.jsx(u9,{job:D})]})})]},D.id))]})]}),o.jsxs("div",{className:"flex items-center justify-between border-t p-3 text-sm",children:[o.jsxs("div",{children:["Page ",g," of ",E," • ",N?.total??0," total"]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{variant:"outline",disabled:g<=1||_.isFetching,onClick:()=>y(D=>Math.max(1,D-1)),children:"Prev"}),o.jsx(ie,{variant:"outline",disabled:g>=E||_.isFetching,onClick:()=>y(D=>D+1),children:"Next"})]})]})]})})]})};function sd({label:e,value:t}){return o.jsxs("div",{className:"bg-muted/30 rounded-lg border p-3",children:[o.jsx("div",{className:"text-muted-foreground text-xs",children:e}),o.jsx("div",{className:"text-lg font-semibold",children:t})]})}function u9({job:e}){return o.jsxs(bt,{children:[o.jsx(Xa,{asChild:!0,children:o.jsx(ie,{size:"sm",variant:"ghost",children:"Details"})}),o.jsxs(wt,{className:"max-w-2xl",children:[o.jsx(St,{children:o.jsxs(_t,{children:["Job ",e.id]})}),o.jsxs("div",{className:"grid gap-3",children:[e.lastError&&o.jsxs($a,{children:[o.jsx(hr,{children:o.jsx(pr,{className:"text-sm",children:"Last error"})}),o.jsx(Va,{children:o.jsx("pre",{className:"overflow-auto text-xs whitespace-pre-wrap",children:e.lastError})})]}),o.jsxs($a,{children:[o.jsx(hr,{children:o.jsx(pr,{className:"text-sm",children:"Payload"})}),o.jsx(Va,{children:o.jsx("pre",{className:"overflow-auto text-xs whitespace-pre-wrap",children:JSON.stringify(e.payload,null,2)})})]})]}),o.jsx(Nt,{children:o.jsx(Ad,{asChild:!0,children:o.jsx(ie,{variant:"secondary",children:"Close"})})})]})]})}function d9({onSubmit:e,submitting:t}){const[a,i]=m.useState(!1),[l,u]=m.useState(""),[d,f]=m.useState(""),[g,y]=m.useState("{}"),[x,v]=m.useState(""),w=l&&d&&!t;async function _(){const R=g?JSON.parse(g):void 0;await e({queue:l,type:d,payload:R,run_at:x||void 0}),i(!1),u(""),f(""),y("{}"),v("")}return o.jsxs(bt,{open:a,onOpenChange:i,children:[o.jsx(Xa,{asChild:!0,children:o.jsxs(ie,{children:[o.jsx(Si,{className:"mr-2 h-4 w-4"})," Enqueue"]})}),o.jsxs(wt,{children:[o.jsx(St,{children:o.jsx(_t,{children:"Enqueue Job"})}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Kr,{children:"Queue"}),o.jsx(Ae,{value:l,onChange:R=>u(R.target.value),placeholder:"e.g. bootstrap_bastion"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Kr,{children:"Type"}),o.jsx(Ae,{value:d,onChange:R=>f(R.target.value),placeholder:"e.g. bootstrap_bastion"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Kr,{children:"Payload (JSON)"}),o.jsx(gs,{value:g,onChange:R=>y(R.target.value),className:"min-h-[120px] font-mono text-xs"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Kr,{children:"Run at (optional)"}),o.jsx(Ae,{type:"datetime-local",value:x,onChange:R=>v(R.target.value)})]})]}),o.jsxs(Nt,{children:[o.jsx(Ad,{asChild:!0,children:o.jsx(ie,{variant:"secondary",children:"Cancel"})}),o.jsxs(ie,{onClick:_,disabled:!w,children:[t?o.jsx(lr,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Enqueue"]})]})]})]})}const sE=pa({key:Pt().trim().min(1,"Key is required").max(120,"Max 120 chars"),value:Pt().trim().optional()}),f9=sE.partial();function h9({t:e}){const t=`${e.key}${e.value?`=${e.value}`:""}`;return o.jsxs(ca,{variant:"secondary",className:"font-mono text-xs",children:[o.jsx(Vd,{className:"mr-1 h-3 w-3"}),t]})}const p9=()=>{const[e,t]=m.useState(""),[a,i]=m.useState(!1),[l,u]=m.useState(!1),[d,f]=m.useState(null),[g,y]=m.useState(null),x=Xn(),v=Zt({queryKey:["labels"],queryFn:()=>Vl.listLabels()}),w=un({resolver:dn(sE),defaultValues:{key:"",value:""}}),_=lt({mutationFn:E=>Vl.createLabel(E),onSuccess:async()=>{await x.invalidateQueries({queryKey:["labels"]}),w.reset(),i(!1),xe.success("Label Created Successfully.")},onError:E=>{xe.error(E.message??"There was an error while creating Label")}}),R=E=>{_.mutate(E)},S=un({resolver:dn(f9),defaultValues:{}}),A=lt({mutationFn:({id:E,values:D})=>Vl.updateLabel(E,D),onSuccess:async()=>{await x.invalidateQueries({queryKey:["labels"]}),S.reset(),u(!1),xe.success("Label Updated Successfully.")},onError:E=>{xe.error(E.message??"There was an error while updating Label")}}),M=E=>{y(E.id),S.reset({key:E.key,value:E.value}),u(!0)},T=lt({mutationFn:E=>Vl.deleteLabel(E),onSuccess:async()=>{await x.invalidateQueries({queryKey:["labels"]}),f(null),xe.success("Label Deleted Successfully.")},onError:E=>{xe.error(E.message??"There was an error while deleting Label")}}),N=m.useMemo(()=>{const E=v.data??[],D=e.trim().toLowerCase();return D?E.filter(I=>I.key?.toLowerCase().includes(D)||I.value?.toLowerCase().includes(D)):E},[e,v.data]);return v.isLoading?o.jsx("div",{className:"p-6",children:"Loading labels…"}):v.error?o.jsx("div",{className:"p-6 text-red-500",children:"Error loading labels."}):o.jsxs("div",{className:"space-y-4 p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[o.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Labels"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx(dr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),o.jsx(Ae,{value:e,onChange:E=>t(E.target.value),placeholder:"Search labels",className:"w-64 pl-8"})]}),o.jsxs(bt,{open:a,onOpenChange:i,children:[o.jsx(Xa,{asChild:!0,children:o.jsxs(ie,{onClick:()=>i(!0),children:[o.jsx(Si,{className:"mr-2 h-4 w-4"}),"Create Label"]})}),o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Create Label"})}),o.jsx(fn,{...w,children:o.jsxs("form",{className:"space-y-4",onSubmit:w.handleSubmit(R),children:[o.jsx(Ke,{control:w.control,name:"key",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Key"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"environment",...E})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:w.control,name:"value",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Value"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"dev",...E})}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:w.formState.isSubmitting,children:w.formState.isSubmitting?"Creating…":"Create"})]})]})})]})]})]})]}),o.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Key"}),o.jsx(Ue,{children:"Value"}),o.jsx(Ue,{children:"Label"}),o.jsx(Ue,{className:"w-[180px] text-right",children:"Actions"})]})}),o.jsxs(ha,{children:[N.map(E=>o.jsxs(tt,{children:[o.jsx(je,{children:E.key}),o.jsx(je,{children:E.value}),o.jsx(je,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(h9,{t:E}),o.jsx("code",{className:"text-muted-foreground text-xs",children:Ji(E.id,6)})]})}),o.jsx(je,{children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>M(E),children:[o.jsx(sc,{className:"mr-2 h-4 w-4"})," Edit"]}),o.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>f(E.id),disabled:T.isPending&&d===E.id,children:T.isPending&&d===E.id?"Deleting…":"Delete"})]})})]},E.id)),N.length===0&&o.jsx(tt,{children:o.jsxs(je,{colSpan:4,className:"text-muted-foreground py-10 text-center",children:[o.jsx(sg,{className:"mx-auto mb-2 h-6 w-6 opacity-60"}),"No labels match your search."]})})]})]})})}),o.jsx(bt,{open:l,onOpenChange:u,children:o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Edit Label"})}),o.jsx(fn,{...S,children:o.jsxs("form",{className:"space-y-4",onSubmit:S.handleSubmit(E=>{g&&A.mutate({id:g,values:E})}),children:[o.jsx(Ke,{control:S.control,name:"key",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Key"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"dedicated",...E})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:S.control,name:"value",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Value (optional)"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"gpu",...E})}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:A.isPending,children:A.isPending?"Saving…":"Save changes"})]})]})})]})}),o.jsx(bt,{open:!!d,onOpenChange:E=>!E&&f(null),children:o.jsxs(wt,{className:"sm:max-w-md",children:[o.jsx(St,{children:o.jsx(_t,{children:"Delete label"})}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"This action cannot be undone. Are you sure you want to delete this label?"}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),o.jsx(ie,{variant:"destructive",onClick:()=>d&&T.mutate(d),disabled:T.isPending,children:T.isPending?"Deleting…":"Delete"})]})]})})]})},m9=Bd(),g9={create:e=>ze(async()=>m9.createOrg({body:e}))},y9=pa({display_name:Pt().min(2,"Too short").max(100,"Too long")}),v9=pa({name:Pt().min(2,"Too short").max(100,"Too long"),expires_in_hours:Kd().min(1).max(43800)}),x9=pa({name:Pt().min(2,"Too short").max(100,"Too long"),domain:Pt().trim().toLowerCase().optional().or(Id("")).refine(e=>!e||/^[a-z0-9.-]+\.[a-z]{2,}$/i.test(e),"Invalid domain (e.g. example.com)")}),b9=()=>{const e=Xn(),t=Zt({queryKey:["me"],queryFn:()=>Zi.getMe()}),a=un({resolver:dn(y9),defaultValues:{display_name:""},values:t.data?{display_name:t.data.display_name??""}:void 0}),i=lt({mutationFn:N=>Zi.updateMe(N),onSuccess:()=>{e.invalidateQueries({queryKey:["me"]}),xe.success("Profile updated")},onError:N=>xe.error(N?.message??"Update failed")}),l=Zt({queryKey:["me","api-keys"],queryFn:()=>Zi.listKeys()}),[u,d]=m.useState(!1),[f,g]=m.useState(null),y=un({resolver:dn(v9),defaultValues:{name:"",expires_in_hours:720}}),x=lt({mutationFn:N=>Zi.createKey({name:N.name,expires_in_hours:N.expires_in_hours}),onSuccess:N=>{g(N),d(!1),e.invalidateQueries({queryKey:["me","api-keys"]}),xe.success("API key created")},onError:N=>xe.error(N?.message??"Failed to create key")}),[v,w]=m.useState(null),_=lt({mutationFn:N=>Zi.deleteKey(N),onSuccess:()=>{e.invalidateQueries({queryKey:["me","api-keys"]}),w(null),xe.success("Key deleted")},onError:N=>xe.error(N?.message??"Failed to delete key")}),R=m.useMemo(()=>t.data?.emails?.find(N=>N.is_primary)?.email??t.data?.primary_email??"",[t.data]),[S,A]=m.useState(!1),M=un({resolver:dn(x9),defaultValues:{name:"",domain:""}}),T=lt({mutationFn:N=>g9.create({name:N.name.trim(),domain:N.domain?.trim()?N.domain.trim().toLowerCase():void 0}),onSuccess:()=>{A(!1),M.reset(),e.invalidateQueries({queryKey:["me"]}),xe.success("Organization created")},onError:N=>xe.error(N?.message??"Failed to create organization")});return t.isLoading?o.jsx("div",{className:"p-6",children:"Loading…"}):t.error?o.jsx("div",{className:"text-destructive p-6",children:"Failed to load profile"}):o.jsxs("div",{className:"space-y-6 p-6",children:[o.jsxs($a,{children:[o.jsxs(hr,{children:[o.jsx(pr,{children:"Profile"}),o.jsx(Vm,{children:"Manage your personal information."})]}),o.jsx(Va,{children:o.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(Kr,{children:"Email"}),o.jsx("div",{className:"text-muted-foreground mt-1 text-sm",children:R||"—"})]}),o.jsxs("div",{children:[o.jsx(Kr,{children:"ID"}),o.jsx("div",{className:"text-muted-foreground mt-1 text-sm",children:t.data?.id||"—"}),o.jsx("div",{className:"text-muted-foreground mt-1 text-sm",children:"Share this ID with the organization owner of the Organization to join"})]}),o.jsx(fn,{...a,children:o.jsxs("form",{className:"space-y-4",onSubmit:a.handleSubmit(N=>i.mutate(N)),children:[o.jsx(Ke,{control:a.control,name:"display_name",render:({field:N})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Display name"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"Your name",...N})}),o.jsx(Pe,{})]})}),o.jsx(ie,{type:"submit",disabled:i.isPending,children:"Save"})]})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Kr,{children:"Organizations"}),o.jsxs(bt,{open:S,onOpenChange:A,children:[o.jsx(Xa,{asChild:!0,children:o.jsx(ie,{size:"sm",children:"New Organization"})}),o.jsxs(wt,{children:[o.jsxs(St,{children:[o.jsx(_t,{children:"Create organization"}),o.jsx(rm,{children:"Give it a name, and optionally assign your company domain."})]}),o.jsx(fn,{...M,children:o.jsxs("form",{className:"space-y-4",onSubmit:M.handleSubmit(N=>T.mutate(N)),children:[o.jsx(Ke,{control:M.control,name:"name",render:({field:N})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Name"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"Acme Inc.",...N})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:M.control,name:"domain",render:({field:N})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Domain (optional)"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"acme.com",...N})}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{children:[o.jsx(Ad,{asChild:!0,children:o.jsx(ie,{type:"button",variant:"outline",children:"Cancel"})}),o.jsx(ie,{type:"submit",disabled:T.isPending,children:"Create"})]})]})})]})]})]}),o.jsx("div",{className:"rounded-md border",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Name"}),o.jsx(Ue,{children:"Domain"})]})}),o.jsxs(ha,{children:[t.data?.organizations?.map(N=>o.jsxs(tt,{children:[o.jsx(je,{children:N.name}),o.jsx(je,{children:N.domain??"—"})]},N.id)),(!t.data?.organizations||t.data.organizations.length===0)&&o.jsx(tt,{children:o.jsx(je,{colSpan:2,className:"text-muted-foreground",children:"No organizations"})})]})]})})]})]})})]}),o.jsx(Fl,{}),o.jsxs($a,{children:[o.jsxs(hr,{className:"flex flex-row items-center justify-between space-y-0",children:[o.jsxs("div",{children:[o.jsx(pr,{children:"User API Keys"}),o.jsx(Vm,{children:"Personal keys for API access."})]}),o.jsxs(bt,{open:u,onOpenChange:d,children:[o.jsx(Xa,{asChild:!0,children:o.jsx(ie,{children:"New Key"})}),o.jsxs(wt,{children:[o.jsxs(St,{children:[o.jsx(_t,{children:"Create API Key"}),o.jsx(rm,{children:"Give it a label and expiry."})]}),o.jsx(fn,{...y,children:o.jsxs("form",{className:"space-y-4",onSubmit:y.handleSubmit(N=>x.mutate(N)),children:[o.jsx(Ke,{control:y.control,name:"name",render:({field:N})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Label"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"CI script, local dev, ...",...N})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:y.control,name:"expires_in_hours",render:({field:N})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Expires in hours"}),o.jsx(Be,{children:o.jsx(Ae,{type:"number",inputMode:"numeric",step:1,min:1,placeholder:"e.g. 720",...N,onChange:E=>N.onChange(E.target.value===""?"":Number(E.target.value))})}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{children:[o.jsx(Ad,{asChild:!0,children:o.jsx(ie,{type:"button",variant:"outline",children:"Cancel"})}),o.jsx(ie,{type:"submit",disabled:x.isPending,children:"Create"})]})]})})]})]})]}),o.jsx(Va,{children:o.jsx("div",{className:"overflow-x-auto rounded-md border",children:o.jsxs(da,{className:"text-sm",children:[o.jsx(B8,{children:"Your user-scoped API keys."}),o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Label"}),o.jsx(Ue,{children:"Created"}),o.jsx(Ue,{children:"Expires"}),o.jsx(Ue,{children:"Last used"}),o.jsx(Ue,{className:"w-24"})]})}),o.jsxs(ha,{children:[l.data?.map(N=>o.jsxs(tt,{children:[o.jsx(je,{children:N.name??"—"}),o.jsx(je,{children:new Date(N.created_at).toLocaleString()}),o.jsx(je,{children:N.expires_at?new Date(N.expires_at).toLocaleString():"—"}),o.jsx(je,{children:N.last_used_at?new Date(N.last_used_at).toLocaleString():"—"}),o.jsx(je,{className:"text-right",children:o.jsxs(kj,{open:v===N.id,onOpenChange:E=>!E&&w(null),children:[o.jsx(zj,{asChild:!0,children:o.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>w(N.id),children:"Delete"})}),o.jsxs(Pj,{children:[o.jsxs(Kj,{children:[o.jsx(Lj,{children:"Delete this key?"}),o.jsx(Uj,{children:"This action cannot be undone. Requests using this key will stop working."})]}),o.jsxs(Ij,{children:[o.jsx(Fj,{children:"Cancel"}),o.jsx(qj,{onClick:()=>_.mutate(N.id),children:"Delete"})]})]})]})})]},N.id)),(!l.data||l.data.length===0)&&o.jsx(tt,{children:o.jsx(je,{colSpan:5,className:"text-muted-foreground",children:"No API keys yet."})})]})]})})})]}),o.jsx(bt,{open:!!f,onOpenChange:N=>!N&&g(null),children:o.jsxs(wt,{children:[o.jsxs(St,{children:[o.jsx(_t,{children:"Copy your new API key"}),o.jsx(rm,{children:"This is only shown once. Store it securely."})]}),o.jsx("div",{className:"rounded-md border p-3 font-mono text-sm break-all",children:f?.plain??"—"}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(ie,{variant:"outline",onClick:()=>{const N=f?.plain;N&&(navigator.clipboard.writeText(N),xe.success("Copied"))},children:"Copy"}),o.jsx(ie,{onClick:()=>g(null),children:"Done"})]})]})})]})},_n=vD(),w9=(e,t)=>e?e===t:!0,Ca={listNodePools:()=>ze(async()=>await _n.listNodePools({})),createNodePool:e=>ze(async()=>await _n.createNodePool({body:e})),getNodePool:e=>ze(async()=>await _n.getNodePool({id:e})),deleteNodePool:e=>ze(async()=>{await _n.deleteNodePool({id:e})}),updateNodePool:(e,t)=>ze(async()=>await _n.updateNodePool({id:e,body:t})),listNodePoolServers:e=>ze(async()=>await _n.listNodePoolServers({id:e})),attachNodePoolServer:(e,t)=>ze(async()=>await _n.attachNodePoolServers({id:e,body:t})),detachNodePoolServers:(e,t)=>ze(async()=>await _n.detachNodePoolServer({id:e,serverId:t})),listNodePoolTaints:e=>ze(async()=>await _n.listNodePoolTaints({id:e})),attachNodePoolTaints:(e,t)=>ze(async()=>await _n.attachNodePoolTaints({id:e,body:t})),detachNodePoolTaints:(e,t)=>ze(async()=>await _n.detachNodePoolTaint({id:e,taintId:t})),listNodePoolLabels:e=>ze(async()=>await _n.listNodePoolLabels({id:e})),attachNodePoolLabels:(e,t)=>ze(async()=>await _n.attachNodePoolLabels({id:e,body:t})),detachNodePoolLabels:(e,t)=>ze(async()=>await _n.detachNodePoolLabel({id:e,labelId:t})),listNodePoolAnnotations:e=>ze(async()=>await _n.listNodePoolAnnotations({id:e})),attachNodePoolAnnotations:(e,t)=>ze(async()=>await _n.attachNodePoolAnnotations({id:e,body:t})),detachNodePoolAnnotations:(e,t)=>ze(async()=>await _n.detachNodePoolAnnotation({id:e,annotationId:t}))},Pl=hD(),Xl={listServers:()=>ze(async()=>await Pl.listServers()),createServer:e=>ze(async()=>await Pl.createServer({body:e})),getServer:e=>ze(async()=>await Pl.getServer({id:e})),updateServer:(e,t)=>ze(async()=>await Pl.updateServer({id:e,body:t})),deleteServer:e=>ze(async()=>{await Pl.deleteServer({id:e})})},Kl=pD(),Zl={listTaints:()=>ze(async()=>await Kl.listTaints()),createTaint:e=>ze(async()=>await Kl.createTaint({body:e})),getTaint:e=>ze(async()=>await Kl.getTaint({id:e})),deleteTaint:e=>ze(async()=>{await Kl.deleteTaint({id:e})}),updateTaint:(e,t)=>ze(async()=>await Kl.updateTaint({id:e,body:t}))},S9=["master","worker"];function iS({status:e}){const t=e==="ready"?"default":e==="provisioning"?"secondary":e==="failed"?"destructive":"outline";return o.jsx(ca,{variant:t,className:"capitalize",children:e||"unknown"})}function Pr(e,t){return(e??"").toLowerCase().includes(t)}function fm(e){const{open:t,title:a,onOpenChange:i,items:l,initialSelectedIds:u,onSave:d,columns:f,allowItem:g}=e,[y,x]=m.useState(""),[v,w]=m.useState(new Set(u)),[_,R]=m.useState(!1);m.useEffect(()=>{w(new Set(u)),x("")},[u,t]);const S=m.useMemo(()=>{const T=y.trim().toLowerCase();return l.filter(N=>g&&!g(N)?!1:T?Pr(N.name,T)||Pr(N.key,T)||Pr(N.value,T)||Pr(N.effect,T)||Pr(N.hostname,T)||Pr(N.private_ip_address,T)||Pr(N.public_ip_address,T)||Pr(N.role,T)||Pr(N.status,T):!0)},[l,y,g]),A=u,M=Array.from(v).some(T=>!A.has(T))||Array.from(A).some(T=>!v.has(T));return o.jsx(bt,{open:t,onOpenChange:i,children:o.jsxs(wt,{className:"sm:max-w-3xl",children:[o.jsx(St,{children:o.jsx(_t,{children:a})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"relative",children:[o.jsx(dr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),o.jsx(Ae,{value:y,onChange:T=>x(T.target.value),placeholder:"Search…",className:"pl-8"})]}),o.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{className:"w-[48px]"}),f.map((T,N)=>o.jsx(Ue,{children:T.header},N))]})}),o.jsxs(ha,{children:[S.map(T=>{const N=T.id,E=v.has(N);return o.jsxs(tt,{children:[o.jsx(je,{className:"text-center align-middle",children:o.jsx("input",{type:"checkbox",className:"h-4 w-4",checked:E,onChange:D=>{const I=new Set(v);D.target.checked?I.add(N):I.delete(N),w(I)}})}),f.map((D,I)=>o.jsx(je,{children:D.render(T)},I))]},N)}),S.length===0&&o.jsx(tt,{children:o.jsx(je,{colSpan:1+f.length,className:"text-muted-foreground py-8 text-center",children:"No items found."})})]})]})}),o.jsxs("div",{className:"text-muted-foreground text-sm",children:["Selected: ",o.jsx("span",{className:"text-foreground font-medium",children:v.size})]})]}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:_,children:"Close"}),o.jsx(ie,{onClick:async()=>{const T=[],N=[];for(const E of v)A.has(E)||T.push(E);for(const E of A)v.has(E)||N.push(E);try{R(!0),await d({toAttach:T,toDetach:N}),i(!1)}finally{R(!1)}},disabled:_||!M,children:_?"Saving…":"Save changes"})]})]})})}const lE=pa({name:Pt().trim().min(1,"Name is required").max(120,"Max 120 chars"),role:Fa(S9)}),_9=lE.partial();function j9(){const[e,t]=m.useState(""),[a,i]=m.useState(!1),[l,u]=m.useState(!1),[d,f]=m.useState(!1),[g,y]=m.useState(null),[x,v]=m.useState(null),[w,_]=m.useState(!1),[R,S]=m.useState(null),[A,M]=m.useState(new Set),[T,N]=m.useState(new Set),[E,D]=m.useState(""),[I,U]=m.useState(!1),[F,fe]=m.useState(!1),[ge,he]=m.useState(!1),[ne,le]=m.useState(null),[ce,ve]=m.useState(new Set),[O,j]=m.useState(new Set),[z,J]=m.useState(new Set),me=Xn(),Te=Zt({queryKey:["node-pools"],queryFn:()=>Ca.listNodePools()}),H=Zt({queryKey:["servers"],queryFn:()=>Xl.listServers()}),Y=Zt({queryKey:["annotations"],queryFn:()=>$l.listAnnotations()}),oe=Zt({queryKey:["labels"],queryFn:()=>Vl.listLabels()}),se=Zt({queryKey:["taints"],queryFn:()=>Zl.listTaints()}),we=un({resolver:dn(lE),defaultValues:{name:"",role:"worker"}}),ee=lt({mutationFn:G=>Ca.createNodePool(G),onSuccess:async()=>{await me.invalidateQueries({queryKey:["node-pools"]}),we.reset({name:"",role:"worker"}),i(!1),xe.success("Node pool created.")},onError:G=>xe.error(G?.message??"Unable to create node pool.")}),Se=G=>ee.mutate(G),De=un({resolver:dn(_9),defaultValues:{name:void 0,role:void 0}});m.useEffect(()=>{g?De.reset({name:g.name,role:g.role}):De.reset({name:void 0,role:void 0})},[g]);const He=lt({mutationFn:async G=>{if(!g)return;const Xe={};return G.name!==g.name&&(Xe.name=G.name),G.role!==g.role&&(Xe.role=G.role),await Ca.updateNodePool(g.id,Xe)},onSuccess:async()=>{await me.invalidateQueries({queryKey:["node-pools"]}),u(!1),y(null),xe.success("Node pool updated.")},onError:G=>xe.error(G?.message??"Unable to update node pool.")}),Qe=G=>He.mutate(G),Ye=lt({mutationFn:async()=>{x&&await Ca.deleteNodePool(x.id)},onSuccess:async()=>{await me.invalidateQueries({queryKey:["node-pools"]}),f(!1),v(null),xe.success("Node pool deleted.")},onError:G=>xe.error(G?.message??"Unable to delete node pool.")}),Ft=m.useMemo(()=>{const G=Te.data??[],Xe=e.trim().toLowerCase();return Xe?G.filter(qe=>qe.name?.toLowerCase().includes(Xe)||qe.role?.toLowerCase().includes(Xe)):G},[e,Te.data]);return Te.isLoading?o.jsx("div",{className:"p-6",children:"Loading node pools…"}):Te.error?o.jsxs("div",{className:"p-6 text-red-500",children:["Error loading node pools.",o.jsx("pre",{className:"bg-muted mt-3 rounded p-3 text-xs",children:JSON.stringify(Te.error,null,2)})]}):o.jsxs("div",{className:"space-y-4 p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[o.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Node Pools"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx(dr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),o.jsx(Ae,{value:e,onChange:G=>t(G.target.value),placeholder:"Search node pools",className:"w-64 pl-8"})]}),o.jsxs(bt,{open:a,onOpenChange:i,children:[o.jsx(Xa,{asChild:!0,children:o.jsxs(ie,{onClick:()=>i(!0),children:[o.jsx(Si,{className:"mr-2 h-4 w-4"}),"Create Node Pool"]})}),o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Create Node Pool"})}),o.jsx(fn,{...we,children:o.jsxs("form",{className:"space-y-4",onSubmit:we.handleSubmit(Se),children:[o.jsx(Ke,{control:we.control,name:"name",render:({field:G})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Name"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"master-pool",...G})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:we.control,name:"role",render:({field:G})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Role"}),o.jsxs(Dt,{onValueChange:Xe=>we.setValue("role",Xe,{shouldDirty:!0,shouldValidate:!0}),value:G.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"Select role"})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"master",children:"master"}),o.jsx(Fe,{value:"worker",children:"worker"})]})]}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:we.formState.isSubmitting,children:we.formState.isSubmitting?"Creating…":"Create"})]})]})})]})]})]})]}),o.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Name"}),o.jsx(Ue,{children:"Role"}),o.jsx(Ue,{children:"Servers"}),o.jsx(Ue,{children:"Annotations"}),o.jsx(Ue,{children:"Labels"}),o.jsx(Ue,{children:"Taints"}),o.jsx(Ue,{className:"w-[180px] text-right",children:"Actions"})]})}),o.jsxs(ha,{children:[Ft.map(G=>{const Xe=Array.isArray(G.servers)?G.servers.length:0;return o.jsxs(tt,{children:[o.jsx(je,{className:"font-medium",children:G.name}),o.jsx(je,{className:"font-medium",children:G.role}),o.jsx(je,{children:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(G.servers||[]).slice(0,6).map(qe=>o.jsxs(ca,{variant:"secondary",className:"gap-1",children:[o.jsx(TS,{className:"h-3 w-3"}),qe.hostname||qe.private_ip_address,o.jsx("span",{className:"ml-1",children:qe.role}),qe.status&&o.jsx("span",{className:"ml-1",children:o.jsx(iS,{status:qe.status})})]},qe.id)),Xe===0&&o.jsx("span",{className:"text-muted-foreground",children:"No servers"}),Xe>6&&o.jsxs("span",{className:"text-muted-foreground",children:["+",Xe-6," more"]}),o.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>{S(G);const qe=new Set((G.servers||[]).map(Je=>Je.id));M(new Set(qe)),N(new Set(qe)),D(""),_(!0)},children:[o.jsx(Ku,{className:"mr-2 h-4 w-4"}),"Manage Servers"]})]})}),o.jsx(je,{children:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(G.annotations||[]).slice(0,6).map(qe=>o.jsxs(ca,{variant:"outline",className:"gap-1",children:[qe.key,":",qe.value]},qe.id)),(G.annotations||[]).length===0&&o.jsx("span",{className:"text-muted-foreground",children:"No annotations"}),(G.annotations||[]).length>6&&o.jsxs("span",{className:"text-muted-foreground",children:["+",(G.annotations||[]).length-6," more"]}),o.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>{le(G),j(new Set((G.annotations||[]).map(qe=>qe.id))),fe(!0)},children:[o.jsx(Ku,{className:"mr-2 h-4 w-4"}),"Manage"]})]})}),o.jsx(je,{children:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(G.labels||[]).slice(0,6).map(qe=>o.jsxs(ca,{variant:"secondary",className:"gap-1",children:[qe.key,":",qe.value]},qe.id)),(G.labels||[]).length===0&&o.jsx("span",{className:"text-muted-foreground",children:"No labels"}),(G.labels||[]).length>6&&o.jsxs("span",{className:"text-muted-foreground",children:["+",(G.labels||[]).length-6," more"]}),o.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>{le(G),ve(new Set((G.labels||[]).map(qe=>qe.id))),U(!0)},children:[o.jsx(Ku,{className:"mr-2 h-4 w-4"}),"Manage"]})]})}),o.jsx(je,{children:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(G.taints||[]).slice(0,6).map(qe=>o.jsxs(ca,{variant:"outline",className:"gap-1",children:[qe.key,":",qe.value,qe.effect?o.jsxs("span",{className:"ml-1",children:["(",qe.effect,")"]}):null]},qe.id)),(G.taints||[]).length===0&&o.jsx("span",{className:"text-muted-foreground",children:"No taints"}),(G.taints||[]).length>6&&o.jsxs("span",{className:"text-muted-foreground",children:["+",(G.taints||[]).length-6," more"]}),o.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>{le(G),J(new Set((G.taints||[]).map(qe=>qe.id))),he(!0)},children:[o.jsx(Ku,{className:"mr-2 h-4 w-4"}),"Manage"]})]})}),o.jsx(je,{className:"text-right",children:o.jsxs(EC,{children:[o.jsx(RC,{asChild:!0,children:o.jsx(ie,{size:"icon",variant:"ghost",className:"h-8 w-8",children:o.jsx(OS,{className:"h-4 w-4"})})}),o.jsxs(NC,{align:"end",children:[o.jsxs(Jl,{onClick:()=>{y(G),u(!0)},children:[o.jsx(sc,{className:"mr-2 h-4 w-4"})," Edit"]}),o.jsxs(Jl,{className:"text-red-600 focus:text-red-600",onClick:()=>{v(G),f(!0)},children:[o.jsx(lg,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},G.id)}),Ft.length===0&&o.jsx(tt,{children:o.jsx(je,{colSpan:7,className:"text-muted-foreground py-10 text-center",children:"No node pools found."})})]})]})})}),o.jsx(bt,{open:l,onOpenChange:u,children:o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Edit Node Pool"})}),o.jsx(fn,{...De,children:o.jsxs("form",{className:"space-y-4",onSubmit:De.handleSubmit(Qe),children:[o.jsx(Ke,{control:De.control,name:"name",render:({field:G})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Name"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"pool-name",...G})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:De.control,name:"role",render:({field:G})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Role"}),o.jsxs(Dt,{onValueChange:Xe=>De.setValue("role",Xe,{shouldDirty:!0,shouldValidate:!0}),value:G.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"Select role"})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"master",children:"master"}),o.jsx(Fe,{value:"worker",children:"worker"})]})]}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>{u(!1),y(null)},children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:De.formState.isSubmitting,children:De.formState.isSubmitting?"Saving…":"Save changes"})]})]})})]})}),o.jsx(bt,{open:d,onOpenChange:f,children:o.jsxs(wt,{className:"sm:max-w-md",children:[o.jsx(St,{children:o.jsx(_t,{children:"Delete node pool"})}),o.jsxs("p",{className:"text-muted-foreground text-sm",children:["This will permanently delete"," ",o.jsx("span",{className:"text-foreground font-medium",children:x?.name}),"."]}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>{f(!1),v(null)},children:"Cancel"}),o.jsx(ie,{variant:"destructive",onClick:()=>Ye.mutate(),disabled:Ye.isPending,children:Ye.isPending?"Deleting…":"Delete"})]})]})}),o.jsx(bt,{open:w,onOpenChange:_,children:o.jsxs(wt,{className:"sm:max-w-3xl",children:[o.jsx(St,{children:o.jsxs(_t,{children:["Manage Servers",R?` — ${R.name}`:""]})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"relative",children:[o.jsx(dr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),o.jsx(Ae,{value:E,onChange:G=>D(G.target.value),placeholder:"Search by hostname, IP or role…",className:"pl-8"})]}),o.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{className:"w-[48px]"}),o.jsx(Ue,{children:"Hostname"}),o.jsx(Ue,{children:"Private IP"}),o.jsx(Ue,{children:"Public IP"}),o.jsx(Ue,{children:"Role"}),o.jsx(Ue,{children:"Status"})]})}),o.jsxs(ha,{children:[(H.data??[]).filter(G=>{if(R?.role&&!w9(R.role,G.role))return!1;const Xe=E.trim().toLowerCase();return Xe?(G.hostname??"").toLowerCase().includes(Xe)||(G.private_ip_address??"").toLowerCase().includes(Xe)||(G.public_ip_address??"").toLowerCase().includes(Xe)||(G.role??"").toLowerCase().includes(Xe):!0}).map(G=>{const Xe=G.id,qe=A.has(Xe);return o.jsxs(tt,{children:[o.jsx(je,{className:"text-center align-middle",children:o.jsx("input",{type:"checkbox",className:"h-4 w-4",checked:qe,onChange:Je=>{const Qa=new Set(A);Je.target.checked?Qa.add(Xe):Qa.delete(Xe),M(Qa)}})}),o.jsx(je,{className:"font-medium",children:G.hostname||"—"}),o.jsx(je,{children:G.private_ip_address||"—"}),o.jsx(je,{children:G.public_ip_address||"—"}),o.jsx(je,{className:"capitalize",children:G.role||"—"}),o.jsx(je,{children:o.jsx(iS,{status:G.status})})]},Xe)}),(H.data??[]).length===0&&o.jsx(tt,{children:o.jsx(je,{colSpan:6,className:"text-muted-foreground py-8 text-center",children:H.isLoading?"Loading servers…":"No servers found."})})]})]})}),o.jsxs("div",{className:"text-muted-foreground text-sm",children:["Selected: ",o.jsx("span",{className:"text-foreground font-medium",children:A.size})]})]}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>{_(!1),S(null),M(new Set),N(new Set),D("")},children:"Close"}),o.jsx(ie,{onClick:async()=>{if(!R)return;const G=R.id,Xe=[],qe=[];for(const Je of A)T.has(Je)||Xe.push(Je);for(const Je of T)A.has(Je)||qe.push(Je);try{Xe.length>0&&await Ca.attachNodePoolServer(G,{server_ids:Xe});for(const Je of qe)await Ca.detachNodePoolServers(G,Je);await me.invalidateQueries({queryKey:["node-pools"]}),await me.invalidateQueries({queryKey:["servers"]}),xe.success("Servers updated for node pool."),_(!1),S(null),M(new Set),N(new Set),D("")}catch(Je){xe.error(Je?.message??"Failed to update servers.")}},disabled:H.isLoading,children:"Save changes"})]})]})}),o.jsx(fm,{open:I,onOpenChange:G=>{U(G),G||le(null)},title:`Manage Labels${ne?` — ${ne.name}`:""}`,items:(oe.data??[]).map(G=>({id:G.id,key:G.key,value:G.value,name:`${G.key}:${G.value}`})),initialSelectedIds:ce,columns:[{header:"Key",render:G=>o.jsx("span",{className:"font-medium",children:G.key})},{header:"Value",render:G=>G.value??"—"}],onSave:async({toAttach:G,toDetach:Xe})=>{if(!ne)return;const qe=ne.id;try{G.length>0&&await Ca.attachNodePoolLabels(qe,{label_ids:G});for(const Je of Xe)await Ca.detachNodePoolLabels(qe,Je);await me.invalidateQueries({queryKey:["node-pools"]}),xe.success("Labels updated for node pool.")}catch(Je){throw xe.error(Je?.message??"Failed to update labels."),Je}}}),o.jsx(fm,{open:F,onOpenChange:G=>{fe(G),G||le(null)},title:`Manage Annotations${ne?` — ${ne.name}`:""}`,items:(Y.data??[]).map(G=>({id:G.id,key:G.key,value:G.value,name:`${G.key}:${G.value}`})),initialSelectedIds:O,columns:[{header:"Key",render:G=>o.jsx("span",{className:"font-medium",children:G.key})},{header:"Value",render:G=>G.value??"—"}],onSave:async({toAttach:G,toDetach:Xe})=>{if(!ne)return;const qe=ne.id;try{G.length>0&&await Ca.attachNodePoolAnnotations(qe,{annotation_ids:G});for(const Je of Xe)await Ca.detachNodePoolAnnotations(qe,Je);await me.invalidateQueries({queryKey:["node-pools"]}),xe.success("Annotations updated for node pool.")}catch(Je){throw xe.error(Je?.message??"Failed to update annotations."),Je}}}),o.jsx(fm,{open:ge,onOpenChange:G=>{he(G),G||le(null)},title:`Manage Taints${ne?` — ${ne.name}`:""}`,items:(se.data??[]).map(G=>({id:G.id,key:G.key,value:G.value,effect:G.effect,name:`${G.key}:${G.value}`})),initialSelectedIds:z,columns:[{header:"Key",render:G=>o.jsx("span",{className:"font-medium",children:G.key})},{header:"Value",render:G=>G.value??"—"},{header:"Effect",render:G=>G.effect??"—"}],onSave:async({toAttach:G,toDetach:Xe})=>{if(!ne)return;const qe=ne.id;try{G.length>0&&await Ca.attachNodePoolTaints(qe,{taint_ids:G});for(const Je of Xe)await Ca.detachNodePoolTaints(qe,Je);await me.invalidateQueries({queryKey:["node-pools"]}),xe.success("Taints updated for node pool.")}catch(Je){throw xe.error(Je?.message??"Failed to update taints."),Je}}})]})}const C9=pa({name:Pt(),expires_in_hours:Kd().min(1).max(43800)}),E9=()=>{const e=Bd(),t=Xn(),a=qa.get(),i=Zt({enabled:!!a,queryKey:["org:keys",a],queryFn:()=>ze(()=>e.listOrgKeys({id:a}))}),l=un({resolver:dn(C9),defaultValues:{name:"",expires_in_hours:720}}),[u,d]=m.useState(null),f=lt({mutationFn:y=>e.createOrgKey({id:a,body:y}),onSuccess:y=>{t.invalidateQueries({queryKey:["org:keys",a]}),d({key:y.org_key,secret:y.org_secret}),xe.success("Key created"),l.reset({name:"",expires_in_hours:void 0})},onError:y=>xe.error(y?.message??"Failed to create key")}),g=lt({mutationFn:y=>e.deleteOrgKey({id:a,keyId:y}),onSuccess:()=>{t.invalidateQueries({queryKey:["org:keys",a]}),xe.success("Key deleted")},onError:y=>xe.error(y?.message??"Failed to delete key")});return a?i.isLoading?o.jsx("p",{children:"Loading..."}):i.error?o.jsx("p",{className:"text-destructive",children:"Failed to load keys."}):o.jsxs($a,{children:[o.jsx(hr,{children:o.jsx(pr,{children:"Org API Keys"})}),o.jsxs(Va,{className:"space-y-6",children:[o.jsx(fn,{...l,children:o.jsxs("form",{onSubmit:l.handleSubmit(y=>f.mutate(y)),className:"grid grid-cols-1 items-end gap-3 md:grid-cols-12",children:[o.jsx("div",{className:"md:col-span-6",children:o.jsx(Ke,{control:l.control,name:"name",render:({field:y})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Name"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"automation-bot",...y})}),o.jsx(Pe,{})]})})}),o.jsx("div",{className:"md:col-span-4",children:o.jsx(Ke,{control:l.control,name:"expires_in_hours",render:({field:y})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Expires In (hours)"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"e.g. 720",...y})}),o.jsx(Pe,{})]})})}),o.jsx("div",{className:"md:col-span-2",children:o.jsx(ie,{type:"submit",className:"w-full",disabled:f.isPending,children:"Create"})})]})}),o.jsx("div",{className:"overflow-x-auto rounded-md border",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Name"}),o.jsx(Ue,{children:"Scope"}),o.jsx(Ue,{children:"Created"}),o.jsx(Ue,{children:"Expires"}),o.jsx(Ue,{className:"w-28"})]})}),o.jsxs(ha,{children:[i.data?.map(y=>o.jsxs(tt,{children:[o.jsx(je,{children:y.name??"-"}),o.jsx(je,{children:y.scope}),o.jsx(je,{children:new Date(y.created_at).toLocaleString()}),o.jsx(je,{children:y.expires_at?new Date(y.expires_at).toLocaleString():"-"}),o.jsx(je,{className:"text-right",children:o.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>g.mutate(y.id),children:"Delete"})})]},y.id)),i.data?.length===0&&o.jsx(tt,{children:o.jsx(je,{colSpan:5,className:"text-muted-foreground p-4",children:"No keys."})})]})]})}),o.jsx(bt,{open:!!u,onOpenChange:y=>!y&&d(null),children:o.jsxs(wt,{children:[o.jsx(St,{children:o.jsx(_t,{children:"Copy your credentials"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-muted-foreground mb-1 text-xs",children:"Org Key"}),o.jsx(Ae,{readOnly:!0,value:u?.key??"",onFocus:y=>y.currentTarget.select()})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-muted-foreground mb-1 text-xs",children:"Org Secret"}),o.jsx(Ae,{readOnly:!0,value:u?.secret??"",onFocus:y=>y.currentTarget.select()})]}),o.jsx("p",{className:"text-muted-foreground text-xs",children:"This secret is shown once. Store it securely."})]}),o.jsx(Nt,{children:o.jsx(ie,{onClick:()=>d(null),children:"Done"})})]})})]})]}):o.jsx("p",{className:"text-muted-foreground",children:"Pick an organization."})},R9=pa({user_id:hj("Invalid UUID"),role:Fa(["owner","admin","member"])}),N9=()=>{const e=Bd(),t=Xn(),a=qa.get(),[i,l]=m.useState(null),u=Zt({enabled:!!a,queryKey:["org:members",a],queryFn:()=>ze(()=>e.listMembers({id:a}))}),d=m.useMemo(()=>(u.data??[]).filter(w=>w.role==="owner").length,[u.data]),f=un({resolver:dn(R9),defaultValues:{user_id:"",role:"member"}}),g=lt({mutationFn:w=>e.addOrUpdateMember({id:a,body:w}),onSuccess:()=>{xe.success("Member added/updated"),t.invalidateQueries({queryKey:["org:members",a]}),f.reset({user_id:"",role:"member"})},onError:w=>xe.error(w?.message??"Failed")}),y=lt({mutationFn:w=>e.removeMember({id:a,userId:w}),onSuccess:()=>{xe.success("Member removed"),t.invalidateQueries({queryKey:["org:members",a]})},onError:w=>xe.error(w?.message??"Failed")}),x=lt({mutationFn:({userId:w,role:_})=>e.addOrUpdateMember({id:a,body:{user_id:w,role:_}}),onMutate:async({userId:w,role:_})=>{l(w),await t.cancelQueries({queryKey:["org:members",a]});const R=t.getQueryData(["org:members",a]);return t.setQueryData(["org:members",a],(S=[])=>S.map(A=>A.user_id===w?{...A,role:_}:A)),{prev:R}},onError:(w,_,R)=>{R?.prev&&t.setQueryData(["org:members",a],R.prev),xe.error(w?.message??"Failed to update role")},onSuccess:()=>{xe.success("Role updated")},onSettled:()=>{l(null),t.invalidateQueries({queryKey:["org:members",a]})}}),v=w=>!(w.role==="owner"&&d<=1);return a?u.isLoading?o.jsx("p",{children:"Loading..."}):u.error?o.jsx("p",{className:"text-destructive",children:"Failed to load members."}):o.jsxs($a,{children:[o.jsx(hr,{children:o.jsx(pr,{children:"Members"})}),o.jsxs(Va,{className:"space-y-6",children:[o.jsx(fn,{...f,children:o.jsxs("form",{className:"grid grid-cols-1 items-end gap-3 md:grid-cols-12",onSubmit:f.handleSubmit(w=>g.mutate(w)),children:[o.jsx("div",{className:"md:col-span-6",children:o.jsx(Ke,{control:f.control,name:"user_id",render:({field:w})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"User ID"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"UUID",...w})}),o.jsx(Pe,{})]})})}),o.jsx("div",{className:"md:col-span-4",children:o.jsx(Ke,{control:f.control,name:"role",render:({field:w})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Role"}),o.jsxs(Dt,{onValueChange:w.onChange,value:w.value,children:[o.jsx(kt,{children:o.jsx(Mt,{placeholder:"Select role"})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"member",children:"member"}),o.jsx(Fe,{value:"admin",children:"admin"}),o.jsx(Fe,{value:"owner",children:"owner"})]})]}),o.jsx(Pe,{})]})})}),o.jsx("div",{className:"md:col-span-2",children:o.jsx(ie,{type:"submit",className:"w-full",disabled:g.isPending,children:"Save"})})]})}),o.jsx("div",{className:"overflow-x-auto rounded-md border",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Id"}),o.jsx(Ue,{children:"User"}),o.jsx(Ue,{children:"Role"}),o.jsx(Ue,{className:"w-28"})]})}),o.jsxs(ha,{children:[u.data?.map(w=>{const _=i===w.user_id;return o.jsxs(tt,{className:"align-middle",children:[o.jsx(je,{className:"font-mono text-xs",children:w.user_id}),o.jsx(je,{children:w.email}),o.jsx(je,{className:"capitalize",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Dt,{value:w.role,onValueChange:R=>{if(w.role!==R){if(w.role==="owner"&&R!=="owner"&&!v(w)){xe.error("You cannot demote the last owner.");return}x.mutate({userId:w.user_id,role:R})}},disabled:_,children:[o.jsx(kt,{className:"h-8 w-[140px]",children:o.jsx(Mt,{})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"member",children:"member"}),o.jsx(Fe,{value:"admin",children:"admin"}),o.jsx(Fe,{value:"owner",children:"owner"})]})]}),_&&o.jsx(lr,{className:"h-4 w-4 animate-spin"})]})}),o.jsx(je,{className:"text-right",children:o.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>y.mutate(w.user_id),disabled:w.role==="owner"&&d<=1,title:w.role==="owner"&&d<=1?"Cannot remove the last owner":"",children:"Remove"})})]},w.user_id)}),u.data?.length===0&&o.jsx(tt,{children:o.jsx(je,{colSpan:3,className:"text-muted-foreground p-4",children:"No members."})})]})]})})]})]}):o.jsx("p",{className:"text-muted-foreground",children:"Pick an organization."})},O9=pa({name:Pt().min(1,"Required"),domain:Pt().optional()}),A9=()=>{const e=Bd(),t=Xn(),a=qa.get(),i=Zt({enabled:!!a,queryKey:["org",a],queryFn:()=>ze(()=>e.getOrg({id:a}))}),l=un({resolver:dn(O9),defaultValues:{name:"",domain:""}});m.useEffect(()=>{i.data&&l.reset({name:i.data.name??"",domain:i.data.domain??""})},[i.data]);const u=lt({mutationFn:g=>e.updateOrg({id:a,body:g}),onSuccess:()=>{t.invalidateQueries({queryKey:["org",a]}),xe.success("Organization updated")},onError:g=>xe.error(g?.message??"Update failed")}),d=lt({mutationFn:()=>e.deleteOrg({id:a}),onSuccess:()=>{xe.success("Organization deleted"),qa.set(""),t.invalidateQueries({queryKey:["orgs:mine"]})},onError:g=>xe.error(g?.message??"Delete failed")});if(!a)return o.jsx("p",{className:"text-muted-foreground",children:"Pick an organization."});if(i.isLoading)return o.jsx("p",{children:"Loading..."});if(i.error)return o.jsx("p",{className:"text-destructive",children:"Failed to load."});const f=g=>{const y={};g.name!==i.data?.name&&(y.name=g.name);const x=g.domain?.trim()||void 0;(x??null)!==(i.data?.domain??null)&&(y.domain=x),Object.keys(y).length!==0&&u.mutate(y)};return o.jsxs($a,{children:[o.jsx(hr,{children:o.jsx(pr,{children:"Organization Settings"})}),o.jsx(Va,{className:"space-y-6",children:o.jsx(fn,{...l,children:o.jsxs("form",{className:"space-y-4",onSubmit:l.handleSubmit(f),children:[o.jsx(Ke,{control:l.control,name:"name",render:({field:g})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Name"}),o.jsx(Be,{children:o.jsx(Ae,{...g})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:l.control,name:"domain",render:({field:g})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Domain (optional)"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"acme.com",...g})}),o.jsx(Pe,{})]})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{type:"submit",disabled:u.isPending,children:"Save"}),o.jsx(ie,{type:"button",variant:"destructive",onClick:()=>d.mutate(),disabled:d.isPending,children:"Delete Org"})]})]})})})]})},Il=fD();function T9(){const e=jn.getAccessToken(),t=qa.get();return{...e?{Authorization:`Bearer ${e}`}:{},...t?{"X-Org-ID":t}:{}}}async function oS(e,t={}){return fetch(e,{...t,headers:{...t.headers,...T9()},credentials:"include"})}const us={listSshKeys:()=>ze(async()=>await Il.listPublicSshKeys()),createSshKey:e=>ze(async()=>await Il.createSSHKey({body:e})),getSshKeyById:e=>ze(async()=>await Il.getSSHKey({id:e})),revealSshKeyById:e=>ze(async()=>await Il.getSSHKey({id:e,reveal:!0})),deleteSshKey:e=>ze(async()=>{await Il.deleteSSHKey({id:e})}),downloadJson:(e,t)=>ze(async()=>{const a=new URL(`/api/v1/ssh/${e}/download`,window.location.origin);a.searchParams.set("part",t),a.searchParams.set("mode","json");const i=await oS(a.toString());if(!i.ok)throw new Error(`Download failed: ${i.statusText}`);return await i.json()}),downloadBlob:(e,t)=>ze(async()=>{const a=new URL(`/api/v1/ssh/${e}/download`,window.location.origin);a.searchParams.set("part",t);const i=await oS(a.toString());if(!i.ok)throw new Error(`Download failed: ${i.statusText}`);const l=i.headers.get("Content-Disposition")||"",d=/filename="([^"]+)"/i.exec(l)?.[1]??"ssh-key-download",f=await i.blob();return{filename:d,blob:f}})},ld=43200,sS=1440,lS=Symbol.for("constructDateFrom");function iy(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&lS in e?e[lS](t):e instanceof Date?new e.constructor(t):new Date(t)}function wi(e,t){return iy(e,e)}let D9={};function M9(){return D9}function cS(e){const t=wi(e),a=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return a.setUTCFullYear(t.getFullYear()),+e-+a}function oy(e,...t){const a=iy.bind(null,e||t.find(i=>typeof i=="object"));return t.map(a)}function hd(e,t){const a=+wi(e)-+wi(t);return a<0?-1:a>0?1:a}function k9(e){return iy(e,Date.now())}function z9(e,t,a){const[i,l]=oy(a?.in,e,t),u=i.getFullYear()-l.getFullYear(),d=i.getMonth()-l.getMonth();return u*12+d}function P9(e){return t=>{const i=(e?Math[e]:Math.trunc)(t);return i===0?0:i}}function K9(e,t){return+wi(e)-+wi(t)}function I9(e,t){const a=wi(e);return a.setHours(23,59,59,999),a}function L9(e,t){const a=wi(e),i=a.getMonth();return a.setFullYear(a.getFullYear(),i+1,0),a.setHours(23,59,59,999),a}function U9(e,t){const a=wi(e);return+I9(a)==+L9(a)}function q9(e,t,a){const[i,l,u]=oy(a?.in,e,e,t),d=hd(l,u),f=Math.abs(z9(l,u));if(f<1)return 0;l.getMonth()===1&&l.getDate()>27&&l.setDate(30),l.setMonth(l.getMonth()-d*f);let g=hd(l,u)===-d;U9(i)&&f===1&&hd(i,u)===1&&(g=!1);const y=d*(f-+g);return y===0?0:y}function F9(e,t,a){const i=K9(e,t)/1e3;return P9(a?.roundingMethod)(i)}const $9={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},V9=(e,t,a)=>{let i;const l=$9[e];return typeof l=="string"?i=l:t===1?i=l.one:i=l.other.replace("{{count}}",t.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"in "+i:i+" ago":i};function hm(e){return(t={})=>{const a=t.width?String(t.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}const B9={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},G9={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},H9={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},X9={date:hm({formats:B9,defaultWidth:"full"}),time:hm({formats:G9,defaultWidth:"full"}),dateTime:hm({formats:H9,defaultWidth:"full"})},Z9={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Y9=(e,t,a,i)=>Z9[e];function Ll(e){return(t,a)=>{const i=a?.context?String(a.context):"standalone";let l;if(i==="formatting"&&e.formattingValues){const d=e.defaultFormattingWidth||e.defaultWidth,f=a?.width?String(a.width):d;l=e.formattingValues[f]||e.formattingValues[d]}else{const d=e.defaultWidth,f=a?.width?String(a.width):e.defaultWidth;l=e.values[f]||e.values[d]}const u=e.argumentCallback?e.argumentCallback(t):t;return l[u]}}const Q9={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},J9={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},W9={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},eq={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},tq={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},nq={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},aq=(e,t)=>{const a=Number(e),i=a%100;if(i>20||i<10)switch(i%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},rq={ordinalNumber:aq,era:Ll({values:Q9,defaultWidth:"wide"}),quarter:Ll({values:J9,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ll({values:W9,defaultWidth:"wide"}),day:Ll({values:eq,defaultWidth:"wide"}),dayPeriod:Ll({values:tq,defaultWidth:"wide",formattingValues:nq,defaultFormattingWidth:"wide"})};function Ul(e){return(t,a={})=>{const i=a.width,l=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],u=t.match(l);if(!u)return null;const d=u[0],f=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],g=Array.isArray(f)?oq(f,v=>v.test(d)):iq(f,v=>v.test(d));let y;y=e.valueCallback?e.valueCallback(g):g,y=a.valueCallback?a.valueCallback(y):y;const x=t.slice(d.length);return{value:y,rest:x}}}function iq(e,t){for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t(e[a]))return a}function oq(e,t){for(let a=0;a{const i=t.match(e.matchPattern);if(!i)return null;const l=i[0],u=t.match(e.parsePattern);if(!u)return null;let d=e.valueCallback?e.valueCallback(u[0]):u[0];d=a.valueCallback?a.valueCallback(d):d;const f=t.slice(l.length);return{value:d,rest:f}}}const lq=/^(\d+)(th|st|nd|rd)?/i,cq=/\d+/i,uq={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},dq={any:[/^b/i,/^(a|c)/i]},fq={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},hq={any:[/1/i,/2/i,/3/i,/4/i]},pq={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},mq={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},gq={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},yq={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},vq={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},xq={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},bq={ordinalNumber:sq({matchPattern:lq,parsePattern:cq,valueCallback:e=>parseInt(e,10)}),era:Ul({matchPatterns:uq,defaultMatchWidth:"wide",parsePatterns:dq,defaultParseWidth:"any"}),quarter:Ul({matchPatterns:fq,defaultMatchWidth:"wide",parsePatterns:hq,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ul({matchPatterns:pq,defaultMatchWidth:"wide",parsePatterns:mq,defaultParseWidth:"any"}),day:Ul({matchPatterns:gq,defaultMatchWidth:"wide",parsePatterns:yq,defaultParseWidth:"any"}),dayPeriod:Ul({matchPatterns:vq,defaultMatchWidth:"any",parsePatterns:xq,defaultParseWidth:"any"})},wq={code:"en-US",formatDistance:V9,formatLong:X9,formatRelative:Y9,localize:rq,match:bq,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Sq(e,t,a){const i=M9(),l=a?.locale??i.locale??wq,u=2520,d=hd(e,t);if(isNaN(d))throw new RangeError("Invalid time value");const f=Object.assign({},a,{addSuffix:a?.addSuffix,comparison:d}),[g,y]=oy(a?.in,...d>0?[t,e]:[e,t]),x=F9(y,g),v=(cS(y)-cS(g))/1e3,w=Math.round((x-v)/60);let _;if(w<2)return a?.includeSeconds?x<5?l.formatDistance("lessThanXSeconds",5,f):x<10?l.formatDistance("lessThanXSeconds",10,f):x<20?l.formatDistance("lessThanXSeconds",20,f):x<40?l.formatDistance("halfAMinute",0,f):x<60?l.formatDistance("lessThanXMinutes",1,f):l.formatDistance("xMinutes",1,f):w===0?l.formatDistance("lessThanXMinutes",1,f):l.formatDistance("xMinutes",w,f);if(w<45)return l.formatDistance("xMinutes",w,f);if(w<90)return l.formatDistance("aboutXHours",1,f);if(we.role!=="bastion"||e.public_ip_address&&e.public_ip_address.trim()!=="",{message:"Public IP required for bastion",path:["public_ip_address"]}),jq=uE.partial();function Cq({status:e}){const t=e==="ready"?"default":e==="provisioning"?"secondary":e==="failed"?"destructive":"outline";return o.jsx(ca,{variant:t,className:"capitalize",children:e})}const Eq=()=>{const[e,t]=m.useState(""),[a,i]=m.useState(!1),[l,u]=m.useState(!1),[d,f]=m.useState(null),[g,y]=m.useState(""),[x,v]=m.useState(""),[w,_]=m.useState(null),R=Xn(),S=Zt({queryKey:["servers"],queryFn:()=>Xl.listServers()}),A=Zt({queryKey:["ssh_keys"],queryFn:()=>us.listSshKeys()}),M=m.useMemo(()=>{const O=new Map;for(const j of A.data??[]){const z=j.name?j.name:"Unnamed key",J=j.fingerprint?Ji(j.fingerprint,8):"";O.set(j.id,J?`${z} — ${J}`:z)}return O},[A.data]),T=un({resolver:dn(uE),defaultValues:{hostname:"",private_ip_address:"",public_ip_address:"",role:"worker",ssh_key_id:"",ssh_user:"",status:"pending"},mode:"onChange"}),N=T.watch("role")==="bastion",E=T.watch("public_ip_address")?.trim()??"",D=N&&E==="",I=lt({mutationFn:O=>Xl.createServer(O),onSuccess:async()=>{await R.invalidateQueries({queryKey:["servers"]}),T.reset(),i(!1),xe.success("Server created successfully")},onError:O=>{xe.error(O?.message??"Failed to create server")}}),U=un({resolver:dn(jq),defaultValues:{},mode:"onChange"}),F=U.watch("role")==="bastion",fe=U.watch("public_ip_address")?.trim()??"",ge=F&&fe==="",he=lt({mutationFn:({id:O,values:j})=>Xl.updateServer(O,j),onSuccess:async()=>{await R.invalidateQueries({queryKey:["servers"]}),u(!1),_(null),xe.success("Server updated successfully")},onError:O=>{xe.error(O?.message??"Failed to update server")}}),ne=lt({mutationFn:O=>Xl.deleteServer(O),onSuccess:async()=>{await R.invalidateQueries({queryKey:["servers"]}),f(null),xe.success("Server deleted successfully")},onError:O=>{xe.error(O?.message??"Failed to delete server")}}),le=m.useMemo(()=>{const O=S.data??[],j=e.trim().toLowerCase(),z=j?O.filter(Te=>Te.hostname?.toLowerCase().includes(j)||Te.public_ip_address?.toLowerCase().includes(j)||Te.private_ip_address?.toLowerCase().includes(j)||Te.role?.toLowerCase().includes(j)||Te.ssh_user?.toLowerCase().includes(j)):O,J=x?z.filter(Te=>Te.role===x):z;return g?J.filter(Te=>Te.status===g):J},[e,x,g,S.data]),ce=O=>{I.mutate(O)},ve=O=>{_(O.id),U.reset({hostname:O.hostname??"",public_ip_address:O.public_ip_address??"",private_ip_address:O.private_ip_address??"",role:O.role??"worker",ssh_key_id:O.ssh_key_id??"",ssh_user:O.ssh_user??"",status:O.status??"pending"}),u(!0)};return A.data?.length===0?o.jsx("div",{className:"p-6",children:"Please create an SSH key for your organization first."}):S.isLoading?o.jsx("div",{className:"p-6",children:"Loading servers…"}):S.error?o.jsx("div",{className:"p-6 text-red-500",children:"Error loading servers."}):o.jsxs(fc,{children:[o.jsxs("div",{className:"space-y-4 p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[o.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Servers"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx(dr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),o.jsx(Ae,{value:e,onChange:O=>t(O.target.value),placeholder:"Search hostname, Public IP, Private IP, role, user…",className:"w-64 pl-8"})]}),o.jsxs(Dt,{value:x||"all",onValueChange:O=>v(O==="all"?"":O),children:[o.jsx(kt,{className:"w-36",children:o.jsx(Mt,{placeholder:"Role (all)"})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"all",children:"All roles"}),cE.map(O=>o.jsx(Fe,{value:O,children:O},O))]})]}),o.jsxs(Dt,{value:g||"all",onValueChange:O=>y(O==="all"?"":O),children:[o.jsx(kt,{className:"w-40",children:o.jsx(Mt,{placeholder:"Status (all)"})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"all",children:"All statuses"})," ",pd.map(O=>o.jsx(Fe,{value:O,children:O},O))]})]}),o.jsxs(bt,{open:a,onOpenChange:i,children:[o.jsx(Xa,{asChild:!0,children:o.jsxs(ie,{onClick:()=>i(!0),children:[o.jsx(Si,{className:"mr-2 h-4 w-4"}),"Create Server"]})}),o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Create server"})}),o.jsx(fn,{...T,children:o.jsxs("form",{className:"space-y-4",onSubmit:T.handleSubmit(ce),children:[o.jsx(Ke,{control:T.control,name:"hostname",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Hostname"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"worker-01",...O})}),o.jsx(Pe,{})]})}),o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsx(Ke,{control:T.control,name:"public_ip_address",render:({field:O})=>o.jsxs(Ce,{children:[o.jsxs(Ee,{className:"flex items-center justify-between",children:[o.jsx("span",{children:"Public IP Address"}),o.jsx("span",{className:de("rounded-full px-2 py-0.5 text-xs",N?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"),children:N?"Required for bastion":"Optional"})]}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:N?"Required for bastion (e.g. 34.12.56.78)":"34.12.56.78","aria-required":N,"aria-invalid":D||!!T.formState.errors.public_ip_address,required:N,...O,className:de(D&&"border-destructive focus-visible:ring-destructive")})}),N&&o.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 p-2 text-xs text-amber-900",children:["Bastion nodes must have a"," ",o.jsx("span",{className:"font-medium",children:"Public IP"}),"."]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:T.control,name:"private_ip_address",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Private IP Address"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"192.168.10.1",...O})}),o.jsx(Pe,{})]})})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsx(Ke,{control:T.control,name:"role",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Role"}),o.jsxs(Dt,{onValueChange:j=>T.setValue("role",j,{shouldDirty:!0,shouldValidate:!0}),value:O.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"Select role"})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"master",children:"master"}),o.jsx(Fe,{value:"worker",children:"worker"}),o.jsx(Fe,{value:"bastion",children:"bastion — requires Public IP"})]})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:T.control,name:"ssh_user",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"SSH user"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"ubuntu",...O})}),o.jsx(Pe,{})]})})]}),o.jsx(Ke,{control:T.control,name:"ssh_key_id",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"SSH key"}),o.jsxs(Dt,{onValueChange:O.onChange,value:O.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:A.data?.length?"Select SSH key":"No SSH keys found"})})}),o.jsx(zt,{children:A.data.map(j=>o.jsxs(Fe,{value:j.id,children:[j.name?j.name:"Unnamed key"," —"," ",Ji(j.fingerprint,8)]},j.id))})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:T.control,name:"status",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Initial status"}),o.jsxs(Dt,{onValueChange:O.onChange,value:O.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"pending"})})}),o.jsx(zt,{children:pd.map(j=>o.jsx(Fe,{value:j,children:j},j))})]}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:I.isPending||T.formState.isSubmitting||!T.formState.isValid,children:I.isPending?"Creating…":"Create"})]})]})})]})]})]})]}),o.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Hostname"}),o.jsx(Ue,{children:"IP address"}),o.jsx(Ue,{children:"Role"}),o.jsx(Ue,{children:"SSH user"}),o.jsx(Ue,{children:"SSH key"}),o.jsx(Ue,{children:"Status"}),o.jsx(Ue,{children:"Created"}),o.jsx(Ue,{className:"w-[220px] text-right",children:"Actions"})]})}),o.jsx(ha,{children:le.length===0?o.jsx(tt,{children:o.jsx(je,{colSpan:8,className:"text-muted-foreground py-10 text-center text-sm",children:"No servers found."})}):le.map(O=>o.jsxs(tt,{children:[o.jsx(je,{className:"font-medium",children:O.hostname}),o.jsx(je,{children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:de("tabular-nums",!O.public_ip_address&&"text-muted-foreground"),children:O.public_ip_address||"—"}),o.jsx("span",{className:"text-muted-foreground tabular-nums",children:O.private_ip_address})]})}),o.jsx(je,{className:"capitalize",children:o.jsx("span",{className:de(O.role==="bastion"&&"rounded bg-amber-50 px-2 py-0.5 dark:bg-amber-900"),children:O.role})}),o.jsx(je,{className:"tabular-nums",children:O.ssh_user}),o.jsx(je,{className:"truncate",children:M.get(O.ssh_key_id)??"—"}),o.jsx(je,{children:o.jsx(Cq,{status:O.status??"pending"})}),o.jsx(je,{title:O.created_at,children:O.created_at?`${_q(new Date(O.created_at),{addSuffix:!0})}`:"—"}),o.jsx(je,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ve(O),children:"Edit"}),o.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>f(O.id),disabled:ne.isPending&&d===O.id,children:ne.isPending&&d===O.id?"Deleting…":"Delete"})]})})]},O.id))})]})})})]}),o.jsx(bt,{open:l,onOpenChange:u,children:o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Edit server"})}),o.jsx(fn,{...U,children:o.jsxs("form",{className:"space-y-4",onSubmit:U.handleSubmit(O=>{w&&he.mutate({id:w,values:O})}),children:[o.jsx(Ke,{control:U.control,name:"hostname",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Hostname"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"worker-01",...O})}),o.jsx(Pe,{})]})}),o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsx(Ke,{control:U.control,name:"public_ip_address",render:({field:O})=>o.jsxs(Ce,{children:[o.jsxs(Ee,{className:"flex items-center justify-between",children:[o.jsx("span",{children:"Public IP Address"}),o.jsx("span",{className:de("rounded-full px-2 py-0.5 text-xs",F?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"),children:F?"Required for bastion":"Optional"})]}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:F?"Required for bastion (e.g. 34.12.56.78)":"34.12.56.78","aria-required":F,"aria-invalid":ge||!!U.formState.errors.public_ip_address,required:F,...O,className:de(ge&&"border-destructive focus-visible:ring-destructive")})}),F&&o.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 p-2 text-xs text-amber-900",children:["Bastion nodes must have a ",o.jsx("span",{className:"font-medium",children:"Public IP"}),"."]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:U.control,name:"private_ip_address",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Private IP Address"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"192.168.10.1",...O})}),o.jsx(Pe,{})]})})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[o.jsx(Ke,{control:U.control,name:"role",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Role"}),o.jsxs(Dt,{onValueChange:j=>U.setValue("role",j,{shouldDirty:!0,shouldValidate:!0}),value:O.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"Select role"})})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"master",children:"master"}),o.jsx(Fe,{value:"worker",children:"worker"}),o.jsx(Fe,{value:"bastion",children:"bastion — requires Public IP"})]})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:U.control,name:"ssh_user",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"SSH user"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"ubuntu",...O})}),o.jsx(Pe,{})]})})]}),o.jsx(Ke,{control:U.control,name:"ssh_key_id",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"SSH key"}),o.jsxs(Dt,{onValueChange:O.onChange,value:O.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"Select SSH key"})})}),o.jsx(zt,{children:A.data.map(j=>o.jsxs(Fe,{value:j.id,children:[j.name?j.name:"Unnamed key"," — ",Ji(j.fingerprint,8)]},j.id))})]}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:U.control,name:"status",render:({field:O})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Status"}),o.jsxs(Dt,{onValueChange:O.onChange,value:O.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"pending"})})}),o.jsx(zt,{children:pd.map(j=>o.jsx(Fe,{value:j,children:j},j))})]}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:he.isPending,children:he.isPending?"Saving…":"Save changes"})]})]})})]})}),o.jsx(bt,{open:!!d,onOpenChange:O=>!O&&f(null),children:o.jsxs(wt,{className:"sm:max-w-md",children:[o.jsx(St,{children:o.jsx(_t,{children:"Delete server"})}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"This action cannot be undone. Are you sure you want to delete this server?"}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),o.jsx(ie,{variant:"destructive",onClick:()=>d&&ne.mutate(d),disabled:ne.isPending,children:ne.isPending?"Deleting…":"Delete"})]})]})})]})},Rq=pa({name:Pt().trim().min(1,"Name is required").max(100,"Max 100 characters"),comment:Pt().trim().min(1,"Comment is required").max(100,"Max 100 characters"),bits:Fa(["2048","3072","4096"]).optional(),type:Fa(["rsa","ed25519"]).optional()});function Nq(e,t){const a=URL.createObjectURL(e),i=document.createElement("a");i.href=a,i.download=t,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(a)}function pm(e,t="Copied"){navigator.clipboard.writeText(e).then(()=>xe.success(t)).catch(()=>xe.error("Copy failed"))}function Oq(e){return e?.split(/\s+/)?.[0]??"ssh-key"}const Aq=()=>{const[e,t]=m.useState(""),[a,i]=m.useState(!1),[l,u]=m.useState(null),[d,f]=m.useState(null),g=Xn(),y=Zt({queryKey:["ssh"],queryFn:()=>us.listSshKeys()}),x=un({resolver:dn(Rq),defaultValues:{name:"",comment:"",type:"rsa",bits:"4096"}}),v=lt({mutationFn:async S=>{const A={name:S.name,comment:S.comment,bits:S.type==="rsa"&&S.bits?Number(S.bits):void 0,type:S.type};return await us.createSshKey(A)},onSuccess:()=>{g.invalidateQueries({queryKey:["ssh"]}),i(!1),x.reset({name:"",comment:"",type:"rsa",bits:"4096"}),xe.success("SSH Key created")},onError:S=>xe.error(S?.message??"SSH Key creation failed")}),w=lt({mutationFn:S=>us.revealSshKeyById(S),onSuccess:S=>u(S),onError:S=>xe.error(S?.message??"Failed to reveal key")}),_=lt({mutationFn:S=>us.deleteSshKey(S),onSuccess:async()=>{await g.invalidateQueries({queryKey:["ssh"]}),f(null),xe.success("SSH Key deleted")},onError:S=>xe.error(S?.message??"Delete failed")}),R=m.useMemo(()=>{const S=e.trim().toLowerCase();return S?(y.data??[]).filter(A=>A.name?.toLowerCase().includes(S)||A.fingerprint?.toLowerCase().includes(S)||A.public_key?.toLowerCase().includes(S)):y.data??[]},[e,y.data]);return y.isLoading?o.jsx("div",{className:"p-6",children:"Loading SSH Keys…"}):y.error?o.jsx("div",{className:"p-6 text-red-500",children:"Error Loading SSH Keys"}):o.jsx(fc,{children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("h1",{className:"text-2xl font-bold",children:"SSH Keys"}),o.jsx("div",{className:"w-full max-w-sm",children:o.jsx(Ae,{value:e,onChange:S=>t(S.target.value),placeholder:"Search by name, fingerprint or key"})}),o.jsxs(bt,{open:a,onOpenChange:i,children:[o.jsx(Xa,{asChild:!0,children:o.jsxs(ie,{onClick:()=>i(!0),children:[o.jsx(Si,{className:"mr-2 h-4 w-4"}),"Create New Keypair"]})}),o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Create SSH Keypair"})}),o.jsx(fn,{...x,children:o.jsxs("form",{onSubmit:x.handleSubmit(S=>v.mutate(S)),className:"space-y-4",children:[o.jsx(Ke,{control:x.control,name:"name",render:({field:S})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Name"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"e.g., CI deploy key",...S})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:x.control,name:"comment",render:({field:S})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Comment"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"e.g., deploy@autoglue",...S})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:x.control,name:"type",render:({field:S})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Type"}),o.jsx(Be,{children:o.jsxs(Dt,{value:S.value,onValueChange:A=>{S.onChange(A),A==="ed25519"?x.setValue("bits",void 0):x.setValue("bits","4096")},children:[o.jsx(kt,{className:"w-[180px]",children:o.jsx(Mt,{placeholder:"Select a ssh key type"})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"rsa",children:"RSA"}),o.jsx(Fe,{value:"ed25519",children:"ED25519"})]})]})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:x.control,name:"bits",render:({field:S})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Key size"}),o.jsx(Be,{children:o.jsxs(Dt,{value:S.value,disabled:x.watch("type")==="ed25519",onValueChange:S.onChange,children:[o.jsx(kt,{className:"w-[180px]",children:o.jsx(Mt,{placeholder:"RSA only"})}),o.jsxs(zt,{children:[o.jsx(Fe,{value:"2048",children:"2048"}),o.jsx(Fe,{value:"3072",children:"3072"}),o.jsx(Fe,{value:"4096",children:"4096"})]})]})}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:v.isPending,children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:v.isPending,children:v.isPending?o.jsxs(o.Fragment,{children:[o.jsx(lr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating…"]}):"Create"})]})]})})]})]})]}),o.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Name"}),o.jsx(Ue,{children:"Public Key"}),o.jsx(Ue,{children:"Fingerprint"}),o.jsx(Ue,{children:"Created"}),o.jsx(Ue,{className:"w-[160px] text-right",children:"Actions"})]})}),o.jsxs(ha,{children:[R.map(S=>{const A=Oq(S.public_key);return Ji(S.public_key,18),o.jsxs(tt,{children:[o.jsx(je,{className:"font-medium",children:S.name||"—"}),o.jsx(je,{children:o.jsxs(jd,{children:[o.jsx(Cd,{asChild:!0,children:o.jsx(ca,{variant:"secondary",className:"whitespace-nowrap",children:A})}),o.jsx(Ed,{className:"max-w-[70vw]",children:o.jsx("div",{className:"max-w-full",children:o.jsx("p",{className:"font-mono text-xs break-all",children:S.public_key})})})]})}),o.jsx(je,{className:"font-mono text-xs",children:S.fingerprint}),o.jsx(je,{children:S.created_at?new Date(S.created_at).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}),o.jsxs(je,{className:"space-x-2 text-right",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>pm(S.public_key??"","Public key copied"),children:"Copy Pub"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>pm(S.fingerprint??"","Fingerprint copied"),children:"Copy FP"}),o.jsxs(ie,{size:"sm",variant:"outline",onClick:()=>w.mutate(S.id),children:[o.jsx(wm,{className:"mr-1 h-4 w-4"}),"Reveal"]}),o.jsxs(ie,{size:"sm",variant:"outline",onClick:async()=>{try{const{filename:M,blob:T}=await us.downloadBlob(S.id,"both");Nq(T,M)}catch(M){xe.error(M?.message??"Download failed")}},children:[o.jsx(GO,{className:"mr-1 h-4 w-4"}),"Download"]}),o.jsxs(ie,{size:"sm",variant:"destructive",onClick:()=>f(S.id),children:[o.jsx(lg,{className:"mr-1 h-4 w-4"}),"Delete"]})]})]},S.id)}),R.length===0&&o.jsx(tt,{children:o.jsx(je,{colSpan:5,className:"text-muted-foreground py-10 text-center",children:"No SSH Keys"})})]})]})})}),o.jsx(bt,{open:!!l,onOpenChange:S=>!S&&u(null),children:o.jsxs(wt,{className:"sm:max-w-2xl",children:[o.jsx(St,{children:o.jsx(_t,{children:"Private Key (read-only)"})}),o.jsx("div",{className:"space-y-3",children:o.jsxs("div",{className:"text-sm",children:[o.jsx("div",{className:"font-medium",children:l?.name??"SSH key"}),o.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:l?.fingerprint}),o.jsx(gs,{readOnly:!0,className:"h-64 w-full rounded-md border p-3 font-mono text-xs",value:l?.private_key??""}),o.jsx("div",{className:"flex justify-end",children:o.jsx(ie,{onClick:()=>l?.private_key&&pm(l.private_key,"Private key copied"),children:"Copy"})})]})})]})}),o.jsx(bt,{open:!!d,onOpenChange:S=>!S&&f(null),children:o.jsxs(wt,{className:"sm:max-w-md",children:[o.jsx(St,{children:o.jsx(_t,{children:"Delete SSH Key"})}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"This will permanently delete the keypair. This action cannot be undone."}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),o.jsx(ie,{variant:"destructive",onClick:()=>d&&_.mutate(d),disabled:_.isPending,children:_.isPending?o.jsxs(o.Fragment,{children:[o.jsx(lr,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})})},Wm=["NoSchedule","PreferNoSchedule","NoExecute"],dE=pa({key:Pt().trim().min(1,"Key is required").max(120,"Max 120 chars"),value:Pt().trim().optional(),effect:Fa(Wm)}),Tq=dE.partial();function Dq({t:e}){const t=`${e.key}${e.value?`=${e.value}`:""}${e.effect?`:${e.effect}`:""}`;return o.jsxs(ca,{variant:"secondary",className:"font-mono text-xs",children:[o.jsx(Vd,{className:"mr-1 h-3 w-3"}),t]})}const Mq=()=>{const[e,t]=m.useState(""),[a,i]=m.useState(!1),[l,u]=m.useState(!1),[d,f]=m.useState(null),[g,y]=m.useState(null),x=Xn(),v=Zt({queryKey:["taints"],queryFn:()=>Zl.listTaints()}),w=un({resolver:dn(dE),defaultValues:{key:"",value:"",effect:void 0}}),_=lt({mutationFn:E=>Zl.createTaint(E),onSuccess:async()=>{await x.invalidateQueries({queryKey:["taints"]}),w.reset(),i(!1),xe.success("Taint Created Successfully.")},onError:E=>{xe.error(E.message??"There was an error while creating Taint")}}),R=E=>{_.mutate(E)},S=un({resolver:dn(Tq),defaultValues:{}}),A=lt({mutationFn:({id:E,values:D})=>Zl.updateTaint(E,D),onSuccess:async()=>{await x.invalidateQueries({queryKey:["taints"]}),S.reset(),u(!1),xe.success("Taint Updated Successfully.")},onError:E=>{xe.error(E.message??"There was an error while updating Taint")}}),M=E=>{y(E.id),S.reset({key:E.key,value:E.value,effect:E.effect}),u(!0)},T=lt({mutationFn:E=>Zl.deleteTaint(E),onSuccess:async()=>{await x.invalidateQueries({queryKey:["taints"]}),f(null),xe.success("Taint Deleted Successfully.")},onError:E=>{xe.error(E.message??"There was an error while deleting Taint")}}),N=m.useMemo(()=>{const E=v.data??[],D=e.trim().toLowerCase();return D?E.filter(I=>I.key?.toLowerCase().includes(D)||I.value?.toLowerCase().includes(D)||I.effect?.toLowerCase().includes(D)):E},[e,v.data]);return v.isLoading?o.jsx("div",{className:"p-6",children:"Loading taints…"}):v.error?o.jsx("div",{className:"p-6 text-red-500",children:"Error loading taints."}):o.jsxs("div",{className:"space-y-4 p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[o.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Taints"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx(dr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),o.jsx(Ae,{value:e,onChange:E=>t(E.target.value),placeholder:"Search taints",className:"w-64 pl-8"})]}),o.jsxs(bt,{open:a,onOpenChange:i,children:[o.jsx(Xa,{asChild:!0,children:o.jsxs(ie,{onClick:()=>i(!0),children:[o.jsx(Si,{className:"mr-2 h-4 w-4"})," Create Taint"]})}),o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Create taint"})}),o.jsx(fn,{...w,children:o.jsxs("form",{className:"space-y-4",onSubmit:w.handleSubmit(R),children:[o.jsx(Ke,{control:w.control,name:"key",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Key"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"dedicated",...E})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:w.control,name:"value",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Value (optional)"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"gpu",...E})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:w.control,name:"effect",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Effect"}),o.jsxs(Dt,{onValueChange:E.onChange,value:E.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"Select effect"})})}),o.jsx(zt,{children:Wm.map(D=>o.jsx(Fe,{value:D,children:D},D))})]}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:w.formState.isSubmitting,children:w.formState.isSubmitting?"Creating…":"Create"})]})]})})]})]})]})]}),o.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(da,{children:[o.jsx(fa,{children:o.jsxs(tt,{children:[o.jsx(Ue,{children:"Taint"}),o.jsx(Ue,{className:"w-[180px] text-right",children:"Actions"})]})}),o.jsxs(ha,{children:[N.map(E=>o.jsxs(tt,{children:[o.jsx(je,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Dq,{t:E}),o.jsx("code",{className:"text-muted-foreground text-xs",children:Ji(E.id,6)})]})}),o.jsx(je,{children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>M(E),children:[o.jsx(sc,{className:"mr-2 h-4 w-4"})," Edit"]}),o.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>f(E.id),disabled:T.isPending&&d===E.id,children:T.isPending&&d===E.id?"Deleting…":"Delete"})]})})]},E.id)),N.length===0&&o.jsx(tt,{children:o.jsxs(je,{colSpan:3,className:"text-muted-foreground py-10 text-center",children:[o.jsx(sg,{className:"mx-auto mb-2 h-6 w-6 opacity-60"}),"No taints match your search."]})})]})]})})}),o.jsx(bt,{open:l,onOpenChange:u,children:o.jsxs(wt,{className:"sm:max-w-lg",children:[o.jsx(St,{children:o.jsx(_t,{children:"Edit taint"})}),o.jsx(fn,{...S,children:o.jsxs("form",{className:"space-y-4",onSubmit:S.handleSubmit(E=>{g&&A.mutate({id:g,values:E})}),children:[o.jsx(Ke,{control:S.control,name:"key",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Key"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"dedicated",...E})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:S.control,name:"value",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Value (optional)"}),o.jsx(Be,{children:o.jsx(Ae,{placeholder:"gpu",...E})}),o.jsx(Pe,{})]})}),o.jsx(Ke,{control:S.control,name:"effect",render:({field:E})=>o.jsxs(Ce,{children:[o.jsx(Ee,{children:"Effect"}),o.jsxs(Dt,{onValueChange:E.onChange,value:E.value,children:[o.jsx(Be,{children:o.jsx(kt,{children:o.jsx(Mt,{placeholder:"Select effect"})})}),o.jsx(zt,{children:Wm.map(D=>o.jsx(Fe,{value:D,children:D},D))})]}),o.jsx(Pe,{})]})}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),o.jsx(ie,{type:"submit",disabled:A.isPending,children:A.isPending?"Saving…":"Save changes"})]})]})})]})}),o.jsx(bt,{open:!!d,onOpenChange:E=>!E&&f(null),children:o.jsxs(wt,{className:"sm:max-w-md",children:[o.jsx(St,{children:o.jsx(_t,{children:"Delete taint"})}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"This action cannot be undone. Are you sure you want to delete this taint?"}),o.jsxs(Nt,{className:"gap-2",children:[o.jsx(ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),o.jsx(ie,{variant:"destructive",onClick:()=>d&&T.mutate(d),disabled:T.isPending,children:T.isPending?"Deleting…":"Delete"})]})]})})]})};function kq(){return o.jsxs(EN,{children:[o.jsx(Nn,{path:"/login",element:o.jsx(Q0,{})}),o.jsx(Nn,{element:o.jsx(s6,{}),children:o.jsxs(Nn,{element:o.jsx(i6,{}),children:[o.jsx(Nn,{path:"/me",element:o.jsx(b9,{})}),o.jsx(Nn,{path:"/org/settings",element:o.jsx(A9,{})}),o.jsx(Nn,{path:"/org/members",element:o.jsx(N9,{})}),o.jsx(Nn,{path:"/org/api-keys",element:o.jsx(E9,{})}),o.jsx(Nn,{path:"/ssh",element:o.jsx(Aq,{})}),o.jsx(Nn,{path:"/servers",element:o.jsx(Eq,{})}),o.jsx(Nn,{path:"/taints",element:o.jsx(Mq,{})}),o.jsx(Nn,{path:"/labels",element:o.jsx(p9,{})}),o.jsx(Nn,{path:"/annotations",element:o.jsx(X8,{})}),o.jsx(Nn,{path:"/node-pools",element:o.jsx(j9,{})}),o.jsx(Nn,{path:"/credentials",element:o.jsx(i9,{})}),o.jsx(Nn,{path:"/admin/jobs",element:o.jsx(c9,{})})]})}),o.jsx(Nn,{path:"*",element:o.jsx(Q0,{})})]})}sA.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(RN,{children:o.jsx(nA,{children:o.jsx(kq,{})})})})); //# sourceMappingURL=index-52pog1DZ.js.map