@cmmd-center/forge 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +409 -134
- package/dist/bin.mjs +433 -158
- package/dist/client/assets/{CanvasPanel-BUdwnabz.js → CanvasPanel-BrVen-8G.js} +2 -2
- package/dist/client/assets/{CompositeItem-BxaZQRyb.js → CompositeItem-BNZfMUvm.js} +2 -2
- package/dist/client/assets/{DiffPanel-BOLibNHF.js → DiffPanel-Bh9UFe_U.js} +2 -2
- package/dist/client/assets/{DiffPanel.logic-BrRjlJeM.js → DiffPanel.logic-A3r3u_Vr.js} +2 -2
- package/dist/client/assets/{DiffPanelShell-CgycIPfE.js → DiffPanelShell-B30xoHOs.js} +3 -3
- package/dist/client/assets/{DiffWorkerPoolProvider-jWJpEXVo.js → DiffWorkerPoolProvider-CYkhfTpq.js} +2 -2
- package/dist/client/assets/{PullRequestCodePanel-BW7XdaG8.js → PullRequestCodePanel-T32DALQE.js} +2 -2
- package/dist/client/assets/{Virtualizer-qjNwH1hl.js → Virtualizer-DbDh3RHG.js} +2 -2
- package/dist/client/assets/{canvasStateStore-DDwjZ3AG.js → canvasStateStore-DN5mPB5B.js} +2 -2
- package/dist/client/assets/{cmmdAuthRedirect-CPfIOB5Y.js → cmmdAuthRedirect-sqR8W6vY.js} +2 -2
- package/dist/client/assets/{index-9clxg-cN.js → index-FpNJGy15.js} +59 -59
- package/dist/client/assets/{src-dZ5rHSKC.js → src-CFqnisEM.js} +2 -2
- package/dist/client/assets/{toggle-Bn-2EZmB.js → toggle-CLUqZXdO.js} +2 -2
- package/dist/client/assets/{useTriggerFocusGuards-DRINKzwL.js → useTriggerFocusGuards-CaUimC-O.js} +2 -2
- package/dist/client/index.html +10 -10
- package/dist/forge-build.json +1 -1
- package/dist/{open-D8mGyWmt.mjs → open-FIgTDosf.mjs} +3 -3
- package/package.json +1 -1
package/dist/client/assets/{DiffWorkerPoolProvider-jWJpEXVo.js → DiffWorkerPoolProvider-CYkhfTpq.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Ba as r,Va as i,za as a}from"./Stream-C4tOsbfQ.js";import{$ as o,A as s,At as c,Bt as l,C as u,Ct as d,D as f,Dt as p,E as m,Ft as h,G as g,H as _,I as v,K as y,L as b,M as x,Mt as S,N as C,Nt as w,O as T,Ot as E,P as D,Pt as O,Q as k,R as A,Rt as j,S as M,T as N,Tt as ee,U as P,Ut as F,Vt as te,W as ne,X as re,Y as ie,Z as ae,_ as oe,_t as se,at as ce,b as le,ct as ue,dt as de,et as fe,ft as pe,g as me,gt as he,h as ge,ht as _e,i as ve,it as ye,j as be,jt as xe,kt as Se,mt as Ce,n as we,nt as Te,o as Ee,ot as De,pt as Oe,r as ke,rt as Ae,st as je,t as Me,tt as Ne,u as Pe,ut as Fe,vt as Ie,w as Le,wt as Re,x as ze,xt as Be,y as Ve,yt as He,z as Ue,zt as We}from"./useTriggerFocusGuards-DRINKzwL.js";import{$ as Ge,$s as Ke,An as qe,At as Je,B as Ye,Bn as Xe,Bt as Ze,Ct as Qe,Da as $e,Dt as et,Et as tt,F as nt,Fs as rt,Ft as it,G as at,H as ot,Ho as st,I as ct,Ir as lt,Is as ut,It as dt,J as ft,Jn as pt,K as mt,Kn as ht,L as gt,Ln as _t,Lt as vt,M as yt,Mn as bt,Ms as xt,Mt as St,N as Ct,Nt as wt,On as Tt,Ot as Et,P as Dt,Pt as Ot,Q as kt,Qt as At,R as jt,Ro as Mt,Rs as Nt,Rt as Pt,Sc as Ft,Sn as It,St as Lt,Tt as Rt,U as zt,Ut as Bt,V as Vt,Vn as Ht,Vs as Ut,W as Wt,Wi as Gt,Wo as Kt,X as qt,Xi as Jt,Xt as Yt,Y as Xt,Z as Zt,Zt as Qt,_ as $t,_t as en,a as tn,aa as nn,ac as rn,an,at as on,ba as sn,bn as cn,bt as ln,ct as un,dn,ds as fn,dt as pn,ec as mn,et as hn,ft as gn,g as _n,gn as vn,gr as yn,gt as bn,hi as xn,ht as Sn,ic as Cn,it as wn,jt as Tn,kc as En,kr as Dn,kt as On,lc as kn,ln as An,lt as jn,m as Mn,ma as Nn,mc as Pn,mt as Fn,nc as In,nt as Ln,o as Rn,ot as zn,pn as Bn,pt as Vn,q as Hn,qn as Un,rc as Wn,rt as Gn,s as Kn,sc as qn,ss as Jn,st as Yn,ta as Xn,tt as Zn,ut as Qn,vc as $n,vt as er,wa as tr,wc as nr,wi as rr,wr as ir,wt as ar,xn as or,xr as sr,xt as cr,yc as lr,yt as ur,z as dr,zs as fr,zt as pr}from"./DiffPanelShell-CgycIPfE.js";import{$ as mr,A as hr,At as gr,Dn as _r,En as vr,F as yr,Ft as br,Ht as xr,It as Sr,K as Cr,Kt as wr,L as Tr,Lt as Er,Mn as Dr,Mt as Or,Nt as kr,Pn as Ar,Pt as jr,Q as Mr,R as Nr,Rt as Pr,S as Fr,V as Ir,W as Lr,X as Rr,Y as zr,Z as Br,_n as Vr,an as Hr,at as Ur,bn as Wr,et as Gr,gn as Kr,h as qr,hn as Jr,in as Yr,it as Xr,j as Zr,jt as Qr,kn as $r,l as ei,m as ti,n as ni,nn as ri,on as ii,ot as ai,pn as oi,q as si,r as ci,rt as li,st as ui,t as di,tn as fi,tt as pi,vn as mi,w as hi,x as gi,xn as _i,yn as vi,zt as yi}from"./CompositeItem-BxaZQRyb.js";import{R as bi,St as xi,Tt as Si}from"./src-dZ5rHSKC.js";var I=t(i(),1),Ci=I.useLayoutEffect;function wi(e,t,n){I.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function Ti(e){let t=I.useRef(null);return I.useImperativeHandle(e,()=>t.current,[]),t}function Ei(e){let t=En();return I.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Di(e){let t=En(),n=Ei(),r=I.useRef(null);return Ci(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}var Oi=class extends mn{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:In(t,n.data),hasPreviousPage:Wn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ki=class extends Cn{#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||Ai(),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){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=rn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,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{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),qn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ai(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ji=class extends Ft{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),$n(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&kn(t.mutationKey)!==kn(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ai();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){qn.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Mi(e){return e}function Ni(e,t){let n=Ke(t),[r]=I.useState(()=>new ji(n,e));I.useEffect(()=>{r.setOptions(e)},[r,e]);let i=I.useSyncExternalStore(I.useCallback(e=>r.subscribe(qn.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=I.useCallback((e,t)=>{r.mutate(e,t).catch(Pn)},[r]);if(i.error&&lr(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Pi(e){return e}function Fi(){let e=new Map,t=new Map;return{enqueueCommand:(t,n)=>{let r=(e.get(t)??Promise.resolve()).then(n,n),i=r.then(()=>void 0,()=>void 0);return e.set(t,i),r.finally(()=>{e.get(t)===i&&e.delete(t)})},read:(e,n)=>{let r=t.get(e);if(r!==void 0)return r;let i=Promise.resolve().then(n);return t.set(e,i),i.then(()=>{t.get(e)===i&&t.delete(e)},()=>{t.get(e)===i&&t.delete(e)}),i},commandLaneCount:()=>e.size}}var Ii=Ar(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),Li=Ar(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Ri=Ar(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),zi=Ar(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Bi=Ar(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Vi=Ar(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Hi=Ar(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ui=Ar(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Wi=Ar(`heading-2`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`,key:`9jr5yi`}]]),Gi=Ar(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Ki=Ar(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),qi=Ar(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ji=Ar(`link`,[[`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`}]]),Yi=Ar(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Xi=Ar(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Zi=Ar(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Qi=Ar(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),$i=Ar(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),ea=Ar(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),ta=Ar(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),na=Ar(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 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-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),ra=Ar(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),ia=Ar(`refresh-cw`,[[`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`}]]),aa=Ar(`remove-formatting`,[[`path`,{d:`M4 7V4h16v3`,key:`9msm58`}],[`path`,{d:`M5 20h6`,key:`1h6pxn`}],[`path`,{d:`M13 4 8 20`,key:`kqq6aj`}],[`path`,{d:`m15 15 5 5`,key:`me55sn`}],[`path`,{d:`m20 15-5 5`,key:`11p7ol`}]]),oa=Ar(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),sa=Ar(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),ca=Ar(`triangle-alert`,[[`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`}]]),la=I.createContext(void 0);function ua(){let e=I.useContext(la);if(!e)throw Error(Jr(73));return e}var da=0;function fa(e){return da+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${da}`}function pa(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}function ma(e){let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}function ha(e,t){let n=0;return e.map(e=>{if(e.transitionStatus===`ending`)return e;let r=n>=t;return n+=1,e.limited===r?e:{...e,limited:r}})}var ga={toasts:e=>e.toasts,isEmpty:e=>e.toasts.length===0,toast:(e,t)=>e.toastMetadata.get(t)?.value,toastIndex:(e,t)=>e.toastMetadata.get(t)?.domIndex??-1,toastOffsetY:(e,t)=>e.toastMetadata.get(t)?.offsetY??0,toastVisibleIndex:(e,t)=>e.toastMetadata.get(t)?.visibleIndex??-1,focused:e=>e.focused,expanded:e=>e.hovering||e.focused,expandedOrOutOfFocus:e=>e.hovering||e.focused||!e.isWindowFocused,prevFocusElement:e=>e.prevFocusElement},_a=class extends h{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:ma(e.toasts)},{},ga)}setViewport=e=>{this.set(`viewport`,e)};syncProviderProps(e,t){let n=this.state.limit!==t;if(this.state.timeout===e&&!n)return;let r={timeout:e,limit:t};if(n){let e=ha(this.state.toasts,t);r.toasts=e,r.toastMetadata=ma(e)}this.update(r)}disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,t=!1){let n=ga.toastIndex(this.state,e);if(n===-1)return;let r=this.state.toasts[n];t||r?.onRemove?.();let i=[...this.state.toasts];i.splice(n,1),this.setToasts(i)}addToast=e=>{let{timeout:t,limit:n}=this.state,r=e.id||fa(`toast`);if(e.id){let t=ga.toast(this.state,e.id);if(t)if(t.transitionStatus===`ending`)this.removeToast(e.id,!0);else{let{id:t,transitionStatus:n,...r}=e;return this.updateToastInternal(e.id,r,!0,!0),e.id}}let i={...e,id:r,updateKey:0,transitionStatus:`starting`},a=[i,...this.state.toasts];this.setToasts(ha(a,n));let o=i.timeout??t;return i.type!==`loading`&&o>0&&this.scheduleTimer(r,o,()=>this.closeToast(r)),ga.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,t)=>{this.updateToastInternal(e,t,!1,!0)};updateToastInternal=(e,t,n=!1,r=!1)=>{let{timeout:i,toasts:a}=this.state,o=ga.toast(this.state,e);if(!o||o.transitionStatus===`ending`)return;let s={...o,...t,...r&&{updateKey:o.updateKey+1}};this.setToasts(a.map(t=>t.id===e?s:t));let c=s.timeout??i,l=o.timeout??i,u=Object.hasOwn(t,`timeout`),d=s.transitionStatus!==`ending`&&s.type!==`loading`&&c>0,f=this.timers.has(e),p=l!==c,m=o.type===`loading`;if(!d&&f){this.clearTimer(e);return}d&&(!f||p||u||m||n)&&(this.clearTimer(e),this.scheduleTimer(e,c,()=>this.closeToast(e)),ga.expandedOrOutOfFocus(this.state)&&this.pauseTimers())};closeToast=e=>{let t=e===void 0,{limit:n,toasts:r}=this.state,i;if(t)i=r,this.clearTimers();else{let t=ga.toast(this.state,e);if(!t)return;i=[t],this.clearTimer(e)}let a=ha(r.map(n=>t||n.id===e?{...n,transitionStatus:`ending`,height:0}:n),n);this.setToasts(a,!a.some(e=>e.transitionStatus!==`ending`)),i.forEach(e=>{e.transitionStatus!==`ending`&&e.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,t)=>{let n=pa(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=pa(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=pa(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{e.timeout&&(e.timeout.clear(),e.remaining=Math.max(e.remaining-(Date.now()-e.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=E.create(),e.timeout.start(e.remaining,()=>{this.handleTimerFired(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=br(e);jr(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=ga.expandedOrOutOfFocus(this.state)?void 0:E.create();i?.start(t,()=>{this.handleTimerFired(e),n()}),this.timers.set(e,{timeout:i,start:r,delay:t,remaining:t,callback:n})}clearTimers(){this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(e){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(e){this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(e,t=e.length===0){let n={toasts:e,toastMetadata:ma(e)};t&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(e){let t=kr(w(this.state.viewport));if(!this.state.viewport||!jr(this.state.viewport,t)||!Re(t))return;if(e===void 0){this.restoreFocusToPrevElement();return}let n=ga.toasts(this.state),r=ga.toastIndex(this.state,e),i=(e,t)=>{for(let r=e;r>=0&&r<n.length;r+=t)if(n[r].transitionStatus!==`ending`)return n[r];return null},a=i(r+1,1)??i(r-1,-1);a?a.ref?.current?.focus():this.restoreFocusToPrevElement()}},L=r(),va=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=Vr(()=>new _a({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return l(a.disposeEffect),I.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`?a.closeToast(n):a.addToast(t)})},[a,i]),(0,L.jsxs)(la.Provider,{value:a,children:[(0,L.jsx)(ya,{store:a,timeout:n,limit:r}),t]})};function ya(e){let{store:t,timeout:n,limit:r}=e;return Kr(()=>{t.syncProviderProps(n,r)},[t,n,r]),null}var ba=I.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=ua(),c=Se(),l=I.useRef(!1),u=I.useRef(!1),d=I.useRef(!1),f=s.useState(`isEmpty`),p=s.useState(`toasts`),m=s.useState(`focused`),h=s.useState(`expanded`),g=s.useState(`prevFocusElement`),_=p[0]?.height,v=p.some(e=>e.transitionStatus===`ending`),y=p.filter(e=>e.priority===`high`);I.useEffect(()=>{let e=s.state.viewport;if(!e||f)return;let t=ri(e),n=w(e);function r(t){t.key===`F6`&&br(t)!==e&&(t.preventDefault(),s.set(`prevFocusElement`,kr(n)),e?.focus({preventScroll:!0}),s.pauseTimers(),s.set(`focused`,!0))}function i(e){br(e)===t&&(s.set(`isWindowFocused`,!1),s.pauseTimers())}function a(n){if(n.relatedTarget)return;let r=br(n),i=kr(w(e));(r===t||!jr(e,r)||!Re(i))&&s.resumeTimers(),c.start(0,()=>s.set(`isWindowFocused`,!0))}return O(S(t,`keydown`,r),S(t,`blur`,i,!0),S(t,`focus`,a,!0),S(n,`pointerdown`,s.handleDocumentPointerDown,!0))},[s,c,f]);function b(e){l.current=!0;let t=e.relatedTarget===s.state.viewport?p.find(e=>e.transitionStatus!==`ending`&&!e.limited):void 0;t?t.ref?.current?.focus():s.restoreFocusToPrevElement()}function x(e){e.key===`Tab`&&e.shiftKey&&br(e.nativeEvent)===s.state.viewport&&(e.preventDefault(),s.restoreFocusToPrevElement())}function C(){s.state.toasts.some(e=>e.transitionStatus===`ending`)||d.current||!u.current||(s.state.isWindowFocused&&s.resumeTimers(),s.set(`hovering`,!1),u.current=!1)}I.useEffect(C,[v,s]);function T(){s.pauseTimers(),s.set(`hovering`,!0),u.current=!1}function E(){s.state.isWindowFocused&&s.resumeTimers()}function D(){u.current=!0,C()}function k(e){e.pointerType===`touch`&&(d.current=!0)}function A(e){e.pointerType===`touch`&&(d.current=!1,C())}function j(){if(l.current){l.current=!1;return}m||Re(kr(w(s.state.viewport)))&&(s.set(`focused`,!0),s.pauseTimers())}function M(e){!m||jr(s.state.viewport,e.relatedTarget)||(s.set(`focused`,!1),E())}let N={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:T,onMouseMove:T,onMouseLeave:D,onFocus:j,onBlur:M,onKeyDown:x,onClick:j,onPointerDown:k,onPointerUp:A,onPointerCancel:A,style:{"--toast-frontmost-height":_?`${_}px`:void 0}},ee={expanded:h},P=!f&&g&&(0,L.jsx)(Ie,{onFocus:b}),F=Br(`div`,e,{ref:[t,s.setViewport],state:ee,props:[N,o,{children:(0,L.jsxs)(I.Fragment,{children:[P,a,P]})}]});return(0,L.jsxs)(I.Fragment,{children:[P,F,!m&&y.length>0&&(0,L.jsx)(`div`,{style:He,children:y.map(e=>(0,L.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,L.jsx)(`div`,{children:e.title}),(0,L.jsx)(`div`,{children:e.description})]},e.id))})]})}),xa=t(F(),1),Sa=I.createContext(void 0);function Ca(){let e=I.useContext(Sa);if(!e)throw Error(Jr(66));return e}function wa(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function Ta(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function Ea(e){let t=ri(e).getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var Da={...he,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Oa=40,ka=10,Aa=.5,ja=1,Ma=`${ue},${de}`,Na=I.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],style:o,...s}=e,c=n.positionerProps?.anchor!==void 0,l=[];c||(l=Array.isArray(a)?a:[a]);let u=l.length>0,d=ua(),[f,p]=I.useState(void 0),[m,h]=I.useState(!1),[g,_]=I.useState(!1),[v,y]=I.useState({x:0,y:0}),[b,x]=I.useState({x:0,y:0,scale:1}),[C,T]=I.useState(),[E,D]=I.useState(),[O,k]=I.useState(null),A=I.useRef(null),j=I.useRef(void 0),M=I.useRef({x:0,y:0}),N=I.useRef({x:0,y:0,scale:1}),ee=I.useRef(void 0),P=I.useRef(0),F=I.useRef(!1),te=I.useRef({x:0,y:0}),ne=I.useRef(!1),re=I.useRef({x:0,y:0}),ie=I.useRef(null),ae=I.useRef(null),oe=d.useState(`toastIndex`,n.id),ce=d.useState(`toastVisibleIndex`,n.id),le=d.useState(`toastOffsetY`,n.id),ue=d.useState(`focused`),de=d.useState(`expanded`);Oe({open:n.transitionStatus!==`ending`,ref:A,onComplete(){n.transitionStatus===`ending`&&d.removeToast(n.id)}});let fe=oi((e=!1)=>{let t=A.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){d.updateToastInternal(n.id,{ref:A,height:i,transitionStatus:void 0})}e?xa.flushSync(a):a()});Kr(()=>{let e=j.current;(n.transitionStatus===`starting`||e!==n.id)&&(e!==void 0&&(p(void 0),x({x:0,y:0,scale:1}),pe({x:0,y:0})),j.current=n.id,fe())},[fe,n.id,n.transitionStatus]);function pe(e){re.current=e,y(e)}Kr(()=>()=>{ae.current?.abort()},[]);function me(e,t){let n=e=>e>0?e**Aa:-(Math.abs(e)**Aa),r=e>0&&!l.includes(`right`)||e<0&&!l.includes(`left`),i=t>0&&!l.includes(`down`)||t<0&&!l.includes(`up`);return{x:r?n(e):e,y:i?n(t):t}}let he=oi(e=>{if(e.pointerId!==ie.current)return;ie.current=null,ae.current?.abort(),ae.current=null,h(!1),_(!1),k(null);let t=N.current;if(e.type===`pointercancel`||F.current){pe({x:t.x,y:t.y}),p(void 0);return}let r=re.current,i=r.x-t.x,a=r.y-t.y,o;for(let e of l)if(Ta(e,i,a)>Oa){o=e;break}o?(p(o),d.closeToast(n.id)):(pe({x:t.x,y:t.y}),p(void 0))});function ge(e){if(e.button!==0||(e.pointerType===`touch`&&d.pauseTimers(),br(e.nativeEvent)?.closest(`button,a,input,textarea,[role="button"],${Ma}`)))return;F.current=!1,ee.current=void 0,P.current=0,ie.current=e.pointerId,M.current={x:e.clientX,y:e.clientY},te.current=M.current;let t=e.currentTarget,n=Ea(t);N.current=n,x(n),pe({x:n.x,y:n.y}),d.set(`hovering`,!0),h(!0),_(!1),k(null),ne.current=!0,ae.current?.abort();let r=new AbortController;ae.current=r;let i=w(t);i.addEventListener(`pointerup`,he,{signal:r.signal}),i.addEventListener(`pointercancel`,he,{signal:r.signal}),t.setPointerCapture?.(e.pointerId)}function _e(e){if(e.pointerId!==ie.current)return;e.preventDefault(),ne.current&&=(M.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>te.current.y||i>0&&t<te.current.y)&&(te.current={x:te.current.x,y:t}),(r<0&&n>te.current.x||r>0&&n<te.current.x)&&(te.current={x:n,y:te.current.y});let a=n-M.current.x,o=t-M.current.y,s=t-te.current.y,c=n-te.current.x,u=O;if(!g&&Math.sqrt(a*a+o*o)>=ja){_(!0);let e=l.includes(`left`)||l.includes(`right`),t=l.includes(`up`)||l.includes(`down`);e&&t&&(u=Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`,k(u))}let d;if(!ee.current)u===`vertical`?o>0?d=`down`:o<0&&(d=`up`):u===`horizontal`?a>0?d=`right`:a<0&&(d=`left`):d=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,d&&l.includes(d)&&(ee.current=d,P.current=Ta(d,a,o),p(d));else{let e=ee.current,t=Ta(e,c,s);t>Oa?(F.current=!1,p(e)):!(l.includes(`left`)&&l.includes(`right`))&&!(l.includes(`up`)&&l.includes(`down`))&&P.current-t>=ka&&(F.current=!0)}let f=me(a,o),m=N.current.x,h=N.current.y,v=l.includes(`left`)||l.includes(`right`),y=l.includes(`up`)||l.includes(`down`);u!==`vertical`&&v&&(m+=f.x),u!==`horizontal`&&y&&(h+=f.y),pe({x:m,y:h})}function ve(e){if(e.key===`Escape`){if(!A.current||!jr(A.current,kr(w(A.current))))return;d.closeToast(n.id)}}I.useEffect(()=>{let e=A.current;if(!u||!e)return;function t(t){ie.current===null||!jr(e,br(t))||t.preventDefault()}return S(e,`touchmove`,t,{passive:!1})},[u]);function ye(){let e=v.x-b.x,t=v.y-b.y;return{transition:m?`none`:void 0,transform:m?`translateX(${v.x}px) translateY(${v.y}px) scale(${b.scale})`:void 0,"--toast-swipe-movement-x":`${e}px`,"--toast-swipe-movement-y":`${t}px`}}let be=n.priority===`high`,xe={role:be?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":C,"aria-describedby":E,"aria-hidden":be&&!ue?!0:void 0,onPointerDown:u?ge:void 0,onPointerMove:u?_e:void 0,onPointerUp:u?he:void 0,onPointerCancel:u?he:void 0,onKeyDown:ve,inert:se(n.limited),style:{...ye(),"--toast-index":n.transitionStatus===`ending`?oe:ce,"--toast-offset-y":`${le}px`,"--toast-height":n.height?`${n.height}px`:void 0}},Se=I.useMemo(()=>({toast:n,setTitleId:T,setDescriptionId:D,recalculateHeight:fe,visibleIndex:ce,expanded:de}),[n,T,D,fe,ce,de]),Ce={transitionStatus:n.transitionStatus,expanded:de,limited:n.limited||!1,type:n.type,swiping:m,swipeDirection:f},we=Br(`div`,e,{ref:[t,A],state:Ce,stateAttributesMapping:Da,props:[xe,s]});return(0,L.jsx)(Sa.Provider,{value:Se,children:we})}),Pa=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{visibleIndex:o,expanded:s,recalculateHeight:c}=Ca(),l=I.useRef(null);return Kr(()=>{c();let e=l.current;if(!e||typeof ResizeObserver!=`function`||typeof MutationObserver!=`function`)return;let t=new ResizeObserver(()=>c(!0)),n=new MutationObserver(()=>c(!0));return t.observe(e),n.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[c]),Br(`div`,e,{ref:[t,l],state:{expanded:s,behind:o>0},props:a})});function Fa(e){return e==null||typeof e==`boolean`||e===``?!1:!Array.isArray(e)||e.some(Fa)}function Ia(e){return I.isValidElement(e)&&Fa(e.props.children)}function La(e,t,n){let{toast:r,setTitleId:i,setDescriptionId:a}=Ca(),o=n===`title`?i:a,s=t??(n===`title`?r.title:r.description);return{id:Rr(e),children:s,type:r.type,setId:o}}function Ra(e,t,n){let r=Ia(e);return Kr(()=>{if(r)return n(t),()=>{n(e=>e===t?void 0:e)}},[r,t,n]),r?e:null}var za=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=La(a,o,`description`);return Ra(Br(`p`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),Ba=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=La(a,o,`title`);return Ra(Br(`h2`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),Va=I.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,c=ua(),{toast:l,expanded:u}=Ca(),[d,f]=I.useState(!1),{getButtonProps:p,buttonRef:m}=Cr({disabled:a,native:o}),h={type:l.type};return Br(`button`,e,{ref:[t,m],state:h,props:[{"aria-hidden":!u&&!d,onClick(){c.closeToast(l.id)},onFocus(){f(!0)},onBlur(){f(!1)}},s,p]})}),Ha=I.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,{toast:c}=Ca(),l=c.actionProps?.children??s.children,{getButtonProps:u,buttonRef:d}=Cr({disabled:a,native:o}),f={type:c.type},p=Br(`button`,e,{ref:[t,d],state:f,props:[s,c.actionProps,u,{children:l}]});return Ia(p)?p:null}),Ua=I.forwardRef(function(e,t){return(0,L.jsx)(De,{ref:t,...e})});function Wa(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Rr(),a=Ne()!=null,o=Vr(()=>new y({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new be,floatingId:i,syncOnly:!1,nested:a})).current;return Kr(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=Yr(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var Ga=`Escape`;function Ka(e){return p&&e.movementX===0&&e.movementY===0}function qa(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Ja(e,t){return qa(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Ya(e,t,n){return qa(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Xa(e,t,n){return qa(t,n?e===Er:e===Pr,e===Sr)}function Za(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Ga:qa(t,n?e===Pr:e===Er,e===yi)}function Qa(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:f=!1,focusItemOnOpen:p=`auto`,focusItemOnHover:m=!0,openOnArrowKeyDown:h=!0,disabledIndices:g=void 0,orientation:_=`vertical`,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:x,grid:S}=t,C=S!=null,T=`rootStore`in e?e.rootStore:e,E=T.useState(`open`),D=T.useState(`floatingElement`),O=T.useState(`domReferenceElement`),k=T.context.dataRef,A=Be(D),j=d(O),M=ce(A),N=Ne(),ee=Te(x),P=I.useRef(p),F=I.useRef(o??-1),te=I.useRef(null),ne=I.useRef(!0),re=oi(e=>{i(F.current===-1?null:F.current,e)}),ie=I.useRef(!!D),ae=I.useRef(E),oe=I.useRef(!1),se=I.useRef(!1),le=I.useRef(null),ue=ce(g),de=ce(E),fe=ce(o),pe=ce(b),me=xe(),he=xe(),ge=oi(()=>{function e(e){f?ee?.events.emit(`virtualfocus`,e):le.current=ye(e,{sync:oe.current,preventScroll:!0})}let t=n.current[F.current],r=se.current;t&&e(t),(oe.current?e=>e():e=>me.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),we&&(r||!ne.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Kr(()=>{k.current.orientation=_},[k,_]),Kr(()=>{a&&(E&&D?(F.current=o??-1,P.current&&o!=null&&(se.current=!0,re())):ie.current&&(F.current=-1,re()))},[a,E,D,o,re]),Kr(()=>{if(a){if(!E){oe.current=!1;return}if(D)if(r==null){if(oe.current=!1,fe.current!=null)return;if(ie.current&&(F.current=-1,ge()),(!ae.current||!ie.current)&&P.current&&(te.current!=null||P.current===!0&&te.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>he.request(e):queueMicrotask)(t),e+=1):(F.current=te.current==null||Ya(te.current,_,u)||l?Xr(n):li(n),te.current=null,re())};t()}}else ai(n.current,r)||(F.current=r,ge(),se.current=!1)}},[a,E,D,r,fe,l,n,_,u,re,ge,he]),Kr(()=>{if(!a||D||!ee||f||!ie.current)return;let e=ee.nodesRef.current,t=e.find(e=>e.id===N)?.context?.elements.floating,n=kr(w(O??t??null)),r=e.some(e=>e.context&&jr(e.context.elements.floating,n));t&&!r&&ne.current&&t.focus({preventScroll:!0})},[a,D,O,ee,N,f]),Kr(()=>{ae.current=E,ie.current=!!D}),Kr(()=>{E||(te.current=null,P.current=p)},[E,p]);let _e=r!=null,ve=oi(e=>{if(!de.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,re(e))}),be=oi(()=>v??ee?.nodesRef.current.find(e=>e.id===N)?.context?.dataRef?.current.orientation),Se=oi(()=>Xr(n,ue.current)),Ce=oi(e=>{if(ne.current=!1,oe.current=!0,e.which===229||!de.current&&e.currentTarget===M.current)return;if(l&&Za(e.key,_,u,C)){Ja(e.key,be())||Or(e),T.setOpen(!1,Fr(Tr,e.nativeEvent)),Hr(O)&&(f?ee?.events.emit(`virtualfocus`,O):O.focus());return}let t=F.current,r=Xr(n,g),i=li(n,g);if(j||(e.key===`Home`&&(Or(e),F.current=r,re(e)),e.key===`End`&&(Or(e),F.current=i,re(e))),S!=null){let t=S(e,F.current,n,_,c,u,g,r,i);if(t!=null&&(F.current=t,re(e)),_===`both`)return}if(Ja(e.key,_)){if(Or(e),E&&!f&&kr(e.currentTarget.ownerDocument)===e.currentTarget){F.current=Ya(e.key,_,u)?r:i,re(e);return}Ya(e.key,_,u)?c?t>=i?s&&t!==n.current.length?F.current=-1:(oe.current=!1,F.current=r):F.current=pi(n.current,{startingIndex:t,disabledIndices:g}):F.current=Math.min(i,pi(n.current,{startingIndex:t,disabledIndices:g})):c?t<=r?s&&t!==-1?F.current=n.current.length:(oe.current=!1,F.current=i):F.current=pi(n.current,{startingIndex:t,decrement:!0,disabledIndices:g}):F.current=Math.max(r,pi(n.current,{startingIndex:t,decrement:!0,disabledIndices:g})),ai(n.current,F.current)&&(F.current=-1),re(e)}}),we=I.useMemo(()=>({onFocus(e){oe.current=!0,ve(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Ka(e)||(oe.current=!0,se.current=!1,m&&ve(e))},onPointerLeave(e){if(!de.current||!ne.current||e.pointerType===`touch`)return;oe.current=!0;let t=e.relatedTarget;if(!(!m||n.current.includes(t))&&pe.current&&(le.current?.(),le.current=null,F.current=-1,re(e),!f)){let e=M.current,t=kr(w(e));e&&jr(e,t)&&e.focus({preventScroll:!0})}}}),[ve,de,M,m,n,re,pe,f]),Ee=I.useMemo(()=>f&&E&&_e&&{"aria-activedescendant":`${y}-${r}`},[f,E,_e,y,r]),De=I.useMemo(()=>({"aria-orientation":_===`both`?void 0:_,...j?{}:Ee,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&E&&!f){let t=br(e.nativeEvent);if(t&&!jr(M.current,t))return;Or(e),T.setOpen(!1,Fr(hr,e.nativeEvent)),Hr(O)&&O.focus();return}Ce(e)},onPointerMove(e){Ka(e)||(ne.current=!0)}}),[Ee,Ce,M,_,j,T,E,f,O]),Oe=I.useMemo(()=>{function e(e){T.setOpen(!0,Fr(Tr,e.nativeEvent,e.currentTarget))}function t(e){p===`auto`&&gr(e.nativeEvent)&&(P.current=!f)}function n(e){P.current=p,p===`auto`&&Qr(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(t){let n=T.select(`open`);ne.current=!1;let r=t.key.startsWith(`Arrow`),i=Xa(t.key,be(),u),a=Ja(t.key,_),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(f&&n)return Ce(t);if(!(!n&&!h&&r)){if(o){let e=Ja(t.key,be());te.current=l&&e?null:t.key}if(l){i&&(Or(t),n?(F.current=Se(),re(t)):e(t));return}a&&(fe.current!=null&&(F.current=fe.current),Or(t),!n&&h?e(t):Ce(t),n&&re(t))}},onFocus(e){T.select(`open`)&&!f&&(F.current=-1,re(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[Ce,p,Se,l,re,T,h,_,be,u,fe,f]),ke=I.useMemo(()=>({...Ee,...Oe}),[Ee,Oe]);return I.useMemo(()=>a?{reference:ke,floating:De,item:we,trigger:Oe}:{},[a,ke,De,Oe,we])}function $a(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=Se(),m=I.useRef(``),h=I.useRef(u??i??-1),g=I.useRef(null),_=oi(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!Ur(n)||n?.matches(`:disabled`)?!1:o==null||!ui(mi,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!c(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(Or(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(Or(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=oi(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);jr(n,t)||jr(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});Kr(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=I.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return I.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var eo=I.createContext(void 0);function to(){let e=I.useContext(eo);if(e===void 0)throw Error(Jr(84));return e}var no=I.forwardRef(function(e,t){let{toast:n,...r}=e,i=ua(),a=n.positionerProps??vi,{render:o,className:s,anchor:c=a.anchor,positionMethod:l=a.positionMethod??`absolute`,side:u=a.side??`top`,align:d=a.align??`center`,sideOffset:f=a.sideOffset??0,alignOffset:p=a.alignOffset??0,collisionBoundary:m=a.collisionBoundary??`clipping-ancestors`,collisionPadding:h=a.collisionPadding??5,arrowPadding:g=a.arrowPadding??5,sticky:_=a.sticky??!1,disableAnchorTracking:v=a.disableAnchorTracking??!1,collisionAvoidance:y=a.collisionAvoidance??pe,style:b,...x}=r,[S,C]=I.useState(null),w=i.useState(`toastIndex`,n.id),T=i.useState(`toastVisibleIndex`,n.id),E=Yr(c)?c:null,D=Wa({open:!0,onOpenChange:Wr,elements:{floating:S,reference:E}}),O=M({anchor:E,positionMethod:l,floatingRootContext:D,mounted:!0,side:u,sideOffset:f,align:d,alignOffset:p,collisionBoundary:m,collisionPadding:h,sticky:_,arrowPadding:g,disableAnchorTracking:v,keepMounted:!0,collisionAvoidance:y}),k={side:O.side,align:O.align,anchorHidden:O.anchorHidden},A=me(e,k,{styles:{...O.positionerStyles,"--toast-index":n.transitionStatus===`ending`?w:T},transitionStatus:n.transitionStatus,props:x,refs:[t,C]});return(0,L.jsx)(eo.Provider,{value:O,children:A})}),ro=I.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{arrowRef:o,side:s,align:c,arrowUncentered:l,arrowStyles:u}=to();return Br(`div`,e,{state:{side:s,align:c,uncentered:l},ref:[t,o],props:[{style:u,"aria-hidden":!0},a]})});function io(){let e=ua(),t=e.useState(`toasts`);return I.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function ao(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||fa(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var oo=e({Action:()=>Ha,Arrow:()=>ro,Close:()=>Va,Content:()=>Pa,Description:()=>za,Portal:()=>Ua,Positioner:()=>no,Provider:()=>va,Root:()=>Na,Title:()=>Ba,Viewport:()=>ba,createToastManager:()=>ao,useToastManager:()=>io});function so(e){return Br(e.defaultTagName??`div`,e,e)}var R=a(),co=`inline-flex size-touch shrink-0 touch-manipulation items-center justify-center rounded-lg leading-none sm:size-touch md:size-7 md:rounded-md`,lo=`min-h-touch min-w-touch touch-manipulation sm:min-h-touch sm:min-w-touch`,uo=`size-touch shrink-0 touch-manipulation rounded-lg sm:size-touch md:size-5 md:rounded-md`,fo=`min-h-touch touch-manipulation sm:min-h-touch md:min-h-0`,po=`pointer-coarse:after:absolute pointer-coarse:after:top-1/2 pointer-coarse:after:left-1/2 pointer-coarse:after:size-full pointer-coarse:after:min-h-touch pointer-coarse:after:min-w-touch pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2`,mo=`relative ${po}`,ho=`text-no-zoom md:text-sm`,go=Dr(`[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[var(--control-radius)] border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--control-radius)-1px)] ${po} focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-9 px-[calc(--spacing(3)-1px)] sm:h-8`,icon:`size-9 sm:size-8`,"icon-lg":`size-10 sm:size-9`,"icon-sm":`size-8 sm:size-7`,"icon-xl":`size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,"icon-xs":`size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5`,lg:`h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9`,sm:`h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7`,xl:`h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,xs:`h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5`},variant:{default:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-primary/90`,destructive:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-destructive/90`,"destructive-outline":`border-input bg-popover not-dark:bg-clip-padding text-destructive-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive-border [:hover,[data-pressed]]:bg-destructive-surface`,ghost:`border-transparent text-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent`,link:`border-transparent underline-offset-4 [:hover,[data-pressed]]:underline`,outline:`border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64`,secondary:`border-transparent bg-secondary text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 [:hover,[data-pressed]]:bg-secondary/90`,white:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/32%)] border-white/60 bg-white text-neutral-950 shadow-white/10 shadow-xs [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-neutral-100 [:hover,[data-pressed]]:text-neutral-950`}}});function _o(e){let t=(0,R.c)(18),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,variant:o,size:a,render:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i?void 0:`button`,c,l,u;if(t[6]!==n||t[7]!==r||t[8]!==a||t[9]!==s||t[10]!==o){let e={className:_i(go({className:n,size:a,variant:o})),"data-slot":`button`,type:s};u=so,c=`button`,l=Mr(e,r),t[6]=n,t[7]=r,t[8]=a,t[9]=s,t[10]=o,t[11]=c,t[12]=l,t[13]=u}else c=t[11],l=t[12],u=t[13];let d;return t[14]!==i||t[15]!==c||t[16]!==l?(d={defaultTagName:c,props:l,render:i},t[14]=i,t[15]=c,t[16]=l,t[17]=d):d=t[17],u(d)}function vo({timeout:e=2e3,onCopy:t,onError:n}={}){let[r,i]=I.useState(!1),a=I.useRef(null),o=I.useRef(t),s=I.useRef(n),c=I.useRef(e);o.current=t,s.current=n,c.current=e;let l=I.useCallback((e,t)=>{if(typeof window>`u`||!navigator.clipboard?.writeText){s.current?.(Error(`Clipboard API unavailable.`),t);return}e&&navigator.clipboard.writeText(e).then(()=>{a.current&&clearTimeout(a.current),i(!0),o.current?.(t),c.current!==0&&(a.current=setTimeout(()=>{i(!1),a.current=null},c.current))},e=>{s.current?s.current(e,t):console.error(e)})},[]);return I.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),{copyToClipboard:l,isCopied:r}}function yo(e,t){return t<=1?!1:e>0}function bo(e){let t=0;return{frontmostHeight:xo(e[0]?.height),items:e.map((e,n)=>{let r={toast:e,visibleIndex:n,offsetY:t};return t+=xo(e.height),r})}}function xo(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function So(e,t){if(e?.threadRef)return t!==null&&e.threadRef.environmentId===t.environmentId&&e.threadRef.threadId===t.threadId;let n=e?.threadId;return!n||t?.threadId===n}function Co(e){return e.position.includes(`center`)?[e.isTop?`up`:`down`]:e.position.includes(`left`)?[`left`,e.isTop?`up`:`down`]:[`right`,e.isTop?`up`:`down`]}function wo(e){return e.type===`error`&&typeof e.description==`string`&&!e.hideCopyButton}function To(e){return e.hasAnchor}function Eo(e){return e.tooltipStyle?`tooltip`:`card`}var Do=ao(),Oo=ao(),ko=new Map,Ao={error:zi,info:Gi,loading:Zi,success:Bi,warning:ca};function jo(e){let t=(0,R.c)(8),{text:n}=e,{copyToClipboard:r,isCopied:i}=vo(),a;t[0]!==r||t[1]!==n?(a=()=>r(n),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=i?(0,L.jsx)(Ri,{className:`size-3.5 text-success`}):(0,L.jsx)(Ui,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,L.jsx)(`button`,{className:`shrink-0 cursor-pointer rounded-md p-1 text-muted-foreground opacity-60 transition-opacity hover:opacity-100`,onClick:a,title:`Copy error`,type:`button`,children:o}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Mo(){let e=(0,R.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:No},e[0]=t):t=e[0];let n=nr(t),r;e[1]===n?r=e[2]:(r=e=>n?.kind===`draft`?e.getDraftSession(n.draftId):null,e[1]=n,e[2]=r);let i=$e(r),a;bb0:{if(n?.kind===`server`){a=n.threadRef;break bb0}if(n?.kind===`draft`&&i){let t;e[3]!==i.environmentId||e[4]!==i.threadId?(t={environmentId:i.environmentId,threadId:i.threadId},e[3]=i.environmentId,e[4]=i.threadId,e[5]=t):t=e[5],a=t;break bb0}a=null}return a}function No(e){return tr(e)}function Po(e){let t=(0,R.c)(4),{toastId:n,dismissAfterVisibleMs:r}=e,i,a;return t[0]!==r||t[1]!==n?(i=()=>{if(!r||r<=0||typeof window>`u`||typeof document>`u`)return;let e;e=ko.get(n)??r;let t=null,i=null,a=!1,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{a||(a=!0,ko.delete(n),Do.close(n))},c=()=>{t!==null&&(e=Math.max(0,e-(Date.now()-t)),t=null,o(),ko.set(n,e))},l=()=>{if(!(a||t!==null)){if(e<=0){s();return}t=Date.now(),o(),i=window.setTimeout(()=>{e=0,t=null,s()},e)}},u=()=>{if(document.visibilityState===`visible`&&document.hasFocus()){l();return}c()};return u(),document.addEventListener(`visibilitychange`,u),window.addEventListener(`focus`,u),window.addEventListener(`blur`,u),()=>{document.removeEventListener(`visibilitychange`,u),window.removeEventListener(`focus`,u),window.removeEventListener(`blur`,u),c(),o()}},a=[r,n],t[0]=r,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,I.useEffect)(i,a),null}function Fo(e){let t=(0,R.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,position:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`top-right`:i,o;t[4]===a?o=t[5]:(o=(0,L.jsx)(Io,{position:a}),t[4]=a,t[5]=o);let s;return t[6]!==n||t[7]!==r||t[8]!==o?(s=(0,L.jsxs)(va,{toastManager:Do,...r,children:[n,o]}),t[6]=n,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Io(e){let t=(0,R.c)(17),{position:n}=e,r=n===void 0?`top-right`:n,{toasts:i}=io(),a=Mo(),o=r.startsWith(`top`),s;t[0]===a?s=t[1]:(s=e=>So(e.data,a),t[0]=a,t[1]=s);let c=bo(i.filter(s)),l,u;t[2]===i?(l=t[3],u=t[4]):(l=()=>{let e=new Set(i.map(Lo));for(let t of ko.keys())e.has(t)||ko.delete(t)},u=[i],t[2]=i,t[3]=l,t[4]=u),(0,I.useEffect)(l,u);let d=oo,f=oo,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=_i(`fixed z-100 mx-auto flex w-[calc(100%-var(--toast-inset)*2)] max-w-90 [--toast-header-offset:52px] [--toast-inset:--spacing(4)] sm:[--toast-inset:--spacing(8)]`,`data-[position*=top]:top-[calc(var(--toast-inset)+var(--toast-header-offset))]`,`data-[position*=bottom]:bottom-(--toast-inset)`,`data-[position*=left]:left-(--toast-inset)`,`data-[position*=right]:right-(--toast-inset)`,`data-[position*=center]:-translate-x-1/2 data-[position*=center]:left-1/2`),t[5]=p):p=t[5];let m=`${c.frontmostHeight}px`,h;t[6]===m?h=t[7]:(h={"--toast-frontmost-height":m},t[6]=m,t[7]=h);let g=h,_=c.items.map(e=>{let{toast:t,visibleIndex:n,offsetY:i}=e,a=t.type?Ao[t.type]:null,s=yo(n,c.items.length);return(0,L.jsxs)(Na,{className:_i(`dropdown-glass absolute z-[calc(9999-var(--toast-index))] h-(--toast-calc-height) w-full select-none rounded-lg text-popover-foreground shadow-xl shadow-black/25 [transition:transform_.5s_cubic-bezier(.22,1,.36,1),opacity_.5s,height_.15s]`,`data-[position*=right]:right-0 data-[position*=right]:left-auto`,`data-[position*=left]:right-auto data-[position*=left]:left-0`,`data-[position*=center]:right-0 data-[position*=center]:left-0`,`data-[position*=top]:top-0 data-[position*=top]:bottom-auto data-[position*=top]:origin-top`,`data-[position*=bottom]:top-auto data-[position*=bottom]:bottom-0 data-[position*=bottom]:origin-bottom`,`after:absolute after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full`,`data-[position*=top]:after:top-full`,`data-[position*=bottom]:after:bottom-full`,`[--toast-calc-height:max(var(--toast-frontmost-height,var(--toast-height)),var(--toast-height))] [--toast-gap:--spacing(3)] [--toast-peek:--spacing(3)] [--toast-scale:calc(max(0,1-(var(--toast-index)*.1)))] [--toast-shrink:calc(1-var(--toast-scale))]`,`data-[position*=top]:[--toast-calc-offset-y:calc(var(--toast-offset-y)+var(--toast-index)*var(--toast-gap)+var(--toast-swipe-movement-y))]`,`data-[position*=bottom]:[--toast-calc-offset-y:calc(var(--toast-offset-y)*-1+var(--toast-index)*var(--toast-gap)*-1+var(--toast-swipe-movement-y))]`,`data-[position*=top]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--toast-peek))+(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]`,`data-[position*=bottom]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--toast-peek))-(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]`,`data-limited:opacity-0`,`data-expanded:h-(--toast-height)`,`data-position:data-expanded:transform-[translateX(var(--toast-swipe-movement-x))_translateY(var(--toast-calc-offset-y))]`,`data-[position*=top]:data-starting-style:transform-[translateY(calc(-100%-var(--toast-inset)))]`,`data-[position*=bottom]:data-starting-style:transform-[translateY(calc(100%+var(--toast-inset)))]`,`data-[position*=top]:data-[position*=right]:data-starting-style:transform-[translateX(calc(100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:opacity-0`,`data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateY(calc(100%+var(--toast-inset)))]`,`data-[position*=top]:data-[position*=right]:data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateX(calc(100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]`,`data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]`,`data-expanded:data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]`,`data-expanded:data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]`),"data-position":r,style:{"--toast-index":n,"--toast-offset-y":`${i}px`},swipeDirection:Co({position:r,isTop:o}),toast:t,children:[(0,L.jsx)(Po,{dismissAfterVisibleMs:t.data?.dismissAfterVisibleMs,toastId:t.id}),(0,L.jsxs)(Pa,{className:_i(`pointer-events-auto flex items-center justify-between gap-1.5 overflow-hidden px-3.5 py-3 text-sm transition-opacity duration-250 data-expanded:opacity-100`,s&&`not-data-expanded:pointer-events-none not-data-expanded:opacity-0`),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-2`,children:[a&&(0,L.jsx)(`div`,{className:`[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,"data-slot":`toast-icon`,children:(0,L.jsx)(a,{className:`in-data-[type=loading]:animate-spin in-data-[type=error]:text-destructive in-data-[type=info]:text-info in-data-[type=success]:text-success in-data-[type=warning]:text-warning in-data-[type=loading]:opacity-80`})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-1`,children:[(0,L.jsx)(Ba,{className:`min-w-0 wrap-break-word font-medium`,"data-slot":`toast-title`}),wo({type:t.type,description:t.description,hideCopyButton:t.data?.hideCopyButton})&&(0,L.jsx)(jo,{text:t.description})]}),(0,L.jsx)(za,{className:`min-w-0 select-text wrap-break-word text-muted-foreground`,"data-slot":`toast-description`})]})]}),t.actionProps&&(0,L.jsx)(Ha,{className:_i(go({size:`xs`}),`shrink-0`),"data-slot":`toast-action`,children:t.actionProps.children})]})]},t.id)}),v;t[8]!==r||t[9]!==g||t[10]!==_||t[11]!==f.Viewport||t[12]!==p?(v=(0,L.jsx)(f.Viewport,{className:p,"data-position":r,"data-slot":`toast-viewport`,style:g,children:_}),t[8]=r,t[9]=g,t[10]=_,t[11]=f.Viewport,t[12]=p,t[13]=v):v=t[13];let y;return t[14]!==v||t[15]!==d.Portal?(y=(0,L.jsx)(d.Portal,{"data-slot":`toast-portal`,children:v}),t[14]=v,t[15]=d.Portal,t[16]=y):y=t[16],y}function Lo(e){return e.id}function Ro(e){let t=(0,R.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,L.jsx)(zo,{}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,L.jsxs)(va,{toastManager:Oo,...r,children:[n,i]}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function zo(){let e=(0,R.c)(7),{toasts:t}=io(),n=Mo(),r;if(e[0]!==n||e[1]!==t){let i;e[3]===n?i=e[4]:(i=e=>So(e.data,n),e[3]=n,e[4]=i),r=t.filter(i).map(Bo),e[0]=n,e[1]=t,e[2]=r}else r=e[2];let i;return e[5]===r?i=e[6]:(i=(0,L.jsx)(Ua,{"data-slot":`toast-portal-anchored`,children:(0,L.jsx)(ba,{className:`outline-none`,"data-slot":`toast-viewport-anchored`,children:r})}),e[5]=r,e[6]=i),i}function Bo(e){let t=e.type?Ao[e.type]:null,n=Eo({tooltipStyle:e.data?.tooltipStyle})===`tooltip`,r=e.positionerProps;return!To({hasAnchor:!!r?.anchor})||!r?null:(0,L.jsx)(no,{className:`z-100 max-w-[min(--spacing(64),var(--available-width))]`,"data-slot":`toast-positioner`,sideOffset:r.sideOffset??4,toast:e,children:(0,L.jsx)(Na,{className:_i(`dropdown-glass relative text-balance text-popover-foreground text-xs shadow-xl shadow-black/25 transition-[scale,opacity] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,n?`rounded-md`:`rounded-lg`),"data-slot":`toast-popup`,toast:e,children:n?(0,L.jsx)(Pa,{className:`pointer-events-auto px-2 py-1`,children:(0,L.jsx)(Ba,{"data-slot":`toast-title`})}):(0,L.jsxs)(Pa,{className:`pointer-events-auto flex items-center justify-between gap-1.5 overflow-hidden px-3.5 py-3 text-sm`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-2`,children:[t&&(0,L.jsx)(`div`,{className:`[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,"data-slot":`toast-icon`,children:(0,L.jsx)(t,{className:`in-data-[type=loading]:animate-spin in-data-[type=error]:text-destructive in-data-[type=info]:text-info in-data-[type=success]:text-success in-data-[type=warning]:text-warning in-data-[type=loading]:opacity-80`})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(Ba,{className:`min-w-0 wrap-break-word font-medium`,"data-slot":`toast-title`}),wo({type:e.type,description:e.description,hideCopyButton:e.data?.hideCopyButton})&&(0,L.jsx)(jo,{text:e.description})]}),(0,L.jsx)(za,{className:`min-w-0 select-text wrap-break-word text-muted-foreground`,"data-slot":`toast-description`})]})]}),e.actionProps&&(0,L.jsx)(Ha,{className:_i(go({size:`xs`}),`shrink-0`),"data-slot":`toast-action`,children:e.actionProps.children})]})})},e.id)}var Vo=I.createContext(void 0);function Ho(){let e=I.useContext(Vo);if(e===void 0)throw Error(Jr(53));return e}function Uo(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var Wo=`base-ui-disable-scrollbar`,Go={className:Wo,getElement(e){return(0,L.jsx)(`style`,{nonce:e,href:Wo,precedence:`base-ui:low`,children:`.${Wo}{scrollbar-width:none}.${Wo}::-webkit-scrollbar{display:none}`})}},Ko=e=>t=>t?{[e]:``}:null,qo={hasOverflowX:Ko(`data-has-overflow-x`),hasOverflowY:Ko(`data-has-overflow-y`),overflowXStart:Ko(`data-overflow-x-start`),overflowXEnd:Ko(`data-overflow-x-end`),overflowYStart:Ko(`data-overflow-y-start`),overflowYEnd:Ko(`data-overflow-y-end`),cornerHidden:()=>null},Jo=I.createContext(void 0),Yo={disableStyleElements:!1};function Xo(){return I.useContext(Jo)??Yo}var Zo={x:0,y:0},Qo={width:0,height:0},$o={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},es={x:!0,y:!0,corner:!0},ts=I.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=ns(i),d=qr(),f=Se(),p=Se(),{nonce:m,disableStyleElements:h}=Xo(),[g,_]=I.useState(!1),[v,y]=I.useState(!1),[b,x]=I.useState(!1),[S,C]=I.useState(!1),[w,T]=I.useState(!1),[E,D]=I.useState(Qo),[O,k]=I.useState(Qo),[A,j]=I.useState($o),[M,N]=I.useState(es),ee=I.useRef(null),P=I.useRef(null),F=I.useRef(null),te=I.useRef(null),ne=I.useRef(null),re=I.useRef(null),ie=I.useRef(null),ae=I.useRef(null),oe=I.useRef(0),se=I.useRef(0),ce=I.useRef(0),le=I.useRef(0),ue=I.useRef(`vertical`),de=I.useRef(Zo),fe=I.useRef(null);function pe(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let me=oi(e=>{let t=e.x-de.current.x,n=e.y-de.current.y;de.current=e,n!==0&&pe(!0),t!==0&&pe(!1)}),he=oi(()=>{let e=P.current;e&&fe.current===null&&(fe.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),ge=oi(e=>{if(e.button!==0||ae.current!==null&&(ue.current===`vertical`?ne.current:re.current)?.hasPointerCapture(ae.current))return;ae.current=e.pointerId,oe.current=e.clientY,se.current=e.clientX,ue.current=e.currentTarget.getAttribute(`data-orientation`);let t=P.current;t&&(ce.current=t.scrollTop,le.current=t.scrollLeft,he()),(ue.current===`vertical`?ne.current:re.current)?.setPointerCapture(e.pointerId)}),_e=oi(e=>{if(e.pointerId!==ae.current)return;ae.current=null,(ue.current===`vertical`?x:y)(!1),fe.current!==null&&(P.current&&(P.current.style.scrollSnapType=fe.current),fe.current=null);let t=ue.current===`vertical`?ne.current:re.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),ve=oi(e=>{if(e.pointerId!==ae.current)return;if(e.buttons%2==0){_e(e);return}let t=P.current;if(!t)return;let n=ue.current===`vertical`,r=n?ne.current:re.current,i=n?F.current:te.current;if(!r||!i)return;let a=n?`y`:`x`,o=Uo(i,`padding`,a),s=Uo(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-oe.current:e.clientX-se.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?ce.current:le.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),pe(n)});function ye(e){C(e.pointerType===`touch`)}function be(e){if(ye(e),e.pointerType!==`touch`){let t=jr(ee.current,e.target);_(t)}}let xe=I.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),Ce={role:`presentation`,onPointerEnter:be,onPointerMove:be,onPointerDown:ye,onPointerLeave(){_(!1)},style:{position:`relative`,"--scroll-area-corner-height":`${E.height}px`,"--scroll-area-corner-width":`${E.width}px`}},we=Br(`div`,e,{state:xe,ref:[t,ee],props:[Ce,o],stateAttributesMapping:qo}),Te=I.useMemo(()=>({handlePointerDown:ge,handlePointerMove:ve,handlePointerUp:_e,handleScroll:me,disableViewportSnap:he,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:ie,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:P,scrollbarYRef:F,scrollbarXRef:te,thumbYRef:ne,thumbXRef:re,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:xe,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[ge,ve,_e,me,he,E,O,w,S,v,b,g,d,M,A,xe,s,c,l,u]);return(0,L.jsxs)(Vo.Provider,{value:Te,children:[!h&&Go.getElement(m),we]})});function ns(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var rs=I.createContext(void 0);function is(e,t){return Math.max(0,e-t)}function as(e,t){if(t<=0)return 0;let n=wa(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var os=[`--scroll-area-overflow-x-start`,`--scroll-area-overflow-x-end`,`--scroll-area-overflow-y-start`,`--scroll-area-overflow-y-end`],ss=!1;function cs(){ss||p||(typeof CSS<`u`&&`registerProperty`in CSS&&os.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),ss=!0)}var ls=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=Ho(),T=gi(),E=I.useRef(!0),D=I.useRef([NaN,NaN,NaN,NaN]),O=Se(),k=Se(),A=oi(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=us(e),A=k.y,j=k.x,M=b/_,N=y/h,ee=Math.max(0,_-b),P=Math.max(0,h-y),F=0,te=0;j||(F=as(T===`rtl`?-w:w,ee),te=ee-F);let ne=A?0:as(x,P),re=A?0:P-ne,ie=j?0:b,ae=A?0:y,oe=0,se=0;!j&&!A&&(oe=t?.offsetWidth||0,se=n?.offsetHeight||0);let ce=f.width===0&&f.height===0,le=ce?oe:0,ue=ce?se:0,de=Uo(n,`padding`,`x`),fe=Uo(t,`padding`,`y`),pe=Uo(i,`margin`,`x`),me=Uo(r,`margin`,`y`),he=ie-de-pe,ge=ae-fe-me,_e=n?Math.min(n.offsetWidth-le,he):he,ve=t?Math.min(t.offsetHeight-ue,ge):ge,ye=Math.max(16,_e*M),be=Math.max(16,ve*N);if(m(e=>ds(e,{width:ye,height:be})),t&&r){let e=fs(r,`--scroll-area-thumb-height`,x,P,h,be,t.offsetHeight-be-fe-me);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-ye-de-pe,t=fs(i,`--scroll-area-thumb-width`,T===`rtl`?-w:w,ee,_,ye,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let xe=[F,te,ne,re];os.forEach((t,n)=>{e.style.setProperty(t,`${xe[n]}px`)}),a&&p(e=>ds(e,{width:oe,height:se})),g(e=>ds(e,k));let Se={xStart:!j&&F>C.xStart,xEnd:!j&&te>C.xEnd,yStart:!A&&ne>C.yStart,yEnd:!A&&re>C.yEnd};S(e=>ds(e,Se))});Kr(()=>{cs()},[]),Kr(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),Kr(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),Kr(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished)).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={role:`presentation`,...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:Go.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=Br(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:qo}),ee=I.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,L.jsx)(rs.Provider,{value:ee,children:N})});function us(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function ds(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function fs(e,t,n,r,i,a,o){let s=wa(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var ps=I.createContext(void 0);function ms(){let e=I.useContext(ps);if(e===void 0)throw Error(Jr(54));return e}var hs=I.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:C,hasMeasuredScrollbar:w,viewportState:T}=Ho(),E=i===`vertical`,D={...T,hovering:c,scrolling:E?u:l,orientation:i},O=gi(),k=!w&&!a,A=E?d.y:d.x,j=a||!A;I.useEffect(()=>{if(!j)return;let e=m.current,t=E?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!E,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&O===`rtl`?-a:0,s=n&&O===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return S(t,`wheel`,n,{passive:!1})},[O,y,E,p,f,j,m]);let M={...x&&{"data-id":`${x}-scrollbar`},onPointerDown(e){if(e.button!==0)return;let t=br(e.nativeEvent),n=E?h.current:g.current;if(n&&jr(n,t))return;let r=m.current;if(!r)return;let i=E?f.current:p.current;if(!n||!i)return;let a=E?`y`:`x`,o=Uo(n,`margin`,a),s=Uo(i,`padding`,a),c=E?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=E?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=E?r.scrollHeight:r.scrollWidth,v=E?r.clientHeight:r.clientWidth,x=(E?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),E?r.scrollTop=S*C:r.scrollLeft=O===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:k?`hidden`:void 0,...E?{top:0,bottom:`var(--scroll-area-corner-height)`,insetInlineEnd:0,"--scroll-area-thumb-height":`${C.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(--scroll-area-corner-width)`,bottom:0,"--scroll-area-thumb-width":`${C.width}px`}}},N=Br(`div`,e,{ref:[t,E?f:p],state:D,props:[M,s],stateAttributesMapping:qo});return j?(0,L.jsx)(ps.Provider,{value:i,children:N}):null}),gs=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=Ho(),m=ms(),h=m===`vertical`;return Br(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),_s=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=Ho(),l=Br(`div`,e,{ref:[t,o],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},a]});return c.corner?null:l});function vs(e){let t=(0,R.c)(23),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,children:n,scrollFade:a,scrollbarGutter:o,hideScrollbars:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a!==void 0&&a,l=o!==void 0&&o,u=s!==void 0&&s,d;t[7]===r?d=t[8]:(d=_i(`size-full min-h-0`,r),t[7]=r,t[8]=d);let f=c&&`mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]`,p=l&&`data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5`,m=u&&`[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,h;t[9]!==f||t[10]!==p||t[11]!==m?(h=_i(`h-full overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain`,f,p,m),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==n||t[14]!==h?(g=(0,L.jsx)(ls,{className:h,"data-slot":`scroll-area-viewport`,children:n}),t[13]=n,t[14]=h,t[15]=g):g=t[15];let _;t[16]===u?_=t[17]:(_=!u&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ys,{orientation:`vertical`}),(0,L.jsx)(ys,{orientation:`horizontal`}),(0,L.jsx)(_s,{"data-slot":`scroll-area-corner`})]}),t[16]=u,t[17]=_);let v;return t[18]!==i||t[19]!==_||t[20]!==d||t[21]!==g?(v=(0,L.jsxs)(ts,{className:d,...i,children:[g,_]}),t[18]=i,t[19]=_,t[20]=d,t[21]=g,t[22]=v):v=t[22],v}function ys(e){let t=(0,R.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]===n?o=t[5]:(o=_i(`m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(gs,{className:`relative flex-1 rounded-full bg-foreground/20`,"data-slot":`scroll-area-thumb`}),t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==r||t[9]!==o?(c=(0,L.jsx)(hs,{className:o,"data-slot":`scroll-area-scrollbar`,orientation:a,...r,children:s}),t[7]=a,t[8]=r,t[9]=o,t[10]=c):c=t[10],c}function bs(){return[{id:`cloud`,enabled:!0},{id:`desktop-local`,enabled:!0}]}function xs(e,t){let n=t.find(t=>t.id===e);return n?.enabled?n.id:`cloud`}function Ss(e){let t=e.capabilities??bs();return{requestedDefault:e.requestedDefault,effectiveDefault:xs(e.requestedDefault,t),capabilities:t}}function Cs(e){return _i(e.isActive?`bg-sidebar-row-active text-sidebar-foreground`:e.isSelected?`bg-sidebar-row-selected text-sidebar-foreground`:e.shouldRecede?`text-sidebar-muted-foreground/75 hover:bg-sidebar-row-hover hover:text-sidebar-foreground`:`bg-transparent text-sidebar-foreground hover:bg-sidebar-row-hover`)}function ws(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Ts(e){if(e.latestUserMessageAt)return ws(e.latestUserMessageAt)??-1/0;let t=null;for(let n of e.messages??[]){if(n.role!==`user`)continue;let e=ws(n.createdAt);e!==null&&(t=t===null?e:Math.max(t,e))}return t===null?ws(e.updatedAt??e.createdAt)??-1/0:t}function Es(e,t){return t===`created_at`?ws(e.createdAt)??-1/0:Ts(e)}function Ds(e,t){return e.toSorted((e,n)=>{let r=Es(n,t),i=Es(e,t),a=r===i?0:r>i?1:-1;return a===0?n.id.localeCompare(e.id):a})}function Os(e,t,n){return Ds(e.filter(e=>e.projectId===t&&e.archivedAt===null),n)[0]??null}function ks(e){return typeof e==`string`&&e.trim().length>0}function As(e){return e?.status===`running`&&ks(e.activeTurnId)}function js(e){return e?e.status===`connecting`||e.status===`running`&&!ks(e.activeTurnId):!1}function Ms(e){return e?.status===`error`}var Ns=`[data-thread-item], [data-thread-selection-safe]`,Ps=10,Fs={Failed:8,Conflicted:7,Stuck:6,"Pending Approval":5,"Awaiting Input":4,Working:3,Connecting:3,"Plan Ready":2,"Needs Review":2,Interrupted:2,Completed:1};function Is(e){let t=e.setTimeoutFn??globalThis.setTimeout,n=e.clearTimeoutFn??globalThis.clearTimeout,r=!1,i=null,a=()=>{i!==null&&(n(i),i=null)};return{sync:n=>{if(!n){a(),r&&(r=!1,e.onVisibilityChange(!1));return}r||i!==null||(i=t(()=>{i=null,r=!0,e.onVisibilityChange(!0)},e.delayMs))},dispose:()=>{a()}}}function Ls(){let e=(0,R.c)(5),[t,n]=I.useState(!1),r=I.useRef(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Is({delayMs:100,onVisibilityChange:e=>{n(e)},setTimeoutFn:window.setTimeout.bind(window),clearTimeoutFn:window.clearTimeout.bind(window)});return r.current=e,()=>{e.dispose(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),I.useEffect(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{r.current?.sync(e)},e[2]=o):o=e[2];let s=o,c;return e[3]===t?c=e[4]:(c={showThreadJumpHints:t,updateThreadJumpHintsVisibility:s},e[3]=t,e[4]=c),c}function Rs(e){if(!e.latestTurn?.completedAt)return!1;let t=Date.parse(e.latestTurn.completedAt);if(Number.isNaN(t))return!1;if(!e.lastVisitedAt)return!0;let n=Date.parse(e.lastVisitedAt);return Number.isNaN(n)?!0:t>n}function zs(e){return e===null||!e.closest(Ns)}function Bs(e){let{getId:t,items:n,preferredIds:r}=e;if(r.length===0)return[...n];let i=new Map(n.map(e=>[t(e),e])),a=new Set(r),o=new Set,s=r.flatMap(e=>{if(o.has(e))return[];let t=i.get(e);return t?(o.add(e),[t]):[]}),c=n.filter(e=>!a.has(t(e)));return[...s,...c]}function Vs(e,t=Ps){return e.slice(0,Math.max(0,t))}function Hs(e){let{currentThreadId:t,direction:n,threadIds:r}=e;if(r.length===0)return null;if(t===null)return n===`previous`?r.at(-1)??null:r[0]??null;let i=r.indexOf(t);return i===-1?null:n===`previous`?i>0?r[i-1]??null:null:i<r.length-1?r[i+1]??null:null}function Us(e){return _i(`h-7 w-full translate-x-0 cursor-pointer justify-start px-2 text-left select-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,Cs(e))}function Ws(e){let{thread:t}=e;return Ms(t.session)||t.latestTurn?.state===`error`?{label:`Failed`,colorClass:`text-destructive-foreground`,dotClass:`bg-destructive dark:bg-destructive/90`,pulse:!1}:t.status===`conflicted`?{label:`Conflicted`,colorClass:`text-destructive-foreground`,dotClass:`bg-destructive dark:bg-destructive/90`,pulse:!1}:t.status===`stuck`?{label:`Stuck`,colorClass:`text-hue-orange-foreground`,dotClass:`bg-hue-orange dark:bg-hue-orange/90`,pulse:!1}:t.hasPendingApprovals?{label:`Pending Approval`,colorClass:`text-warning-foreground`,dotClass:`bg-warning dark:bg-warning/90`,pulse:!1}:t.hasPendingUserInput?{label:`Awaiting Input`,colorClass:`text-hue-indigo-foreground`,dotClass:`bg-hue-indigo dark:bg-hue-indigo/90`,pulse:!1}:As(t.session)||t.status===`running`?{label:`Working`,colorClass:`text-hue-sky-foreground`,dotClass:`bg-hue-sky dark:bg-hue-sky/80`,pulse:!0}:js(t.session)?{label:`Connecting`,colorClass:`text-hue-sky-foreground`,dotClass:`bg-hue-sky dark:bg-hue-sky/80`,pulse:!0}:t.status===`needs-review`?{label:`Needs Review`,colorClass:`text-hue-violet-foreground`,dotClass:`bg-hue-violet dark:bg-hue-violet/90`,pulse:!1}:!t.hasPendingUserInput&&t.interactionMode===`plan`&&yn(t.latestTurn,t.session)&&t.hasActionableProposedPlan?{label:`Plan Ready`,colorClass:`text-hue-violet-foreground`,dotClass:`bg-hue-violet dark:bg-hue-violet/90`,pulse:!1}:t.latestTurn?.state===`interrupted`?{label:`Interrupted`,colorClass:`text-warning-foreground`,dotClass:`bg-warning dark:bg-warning/90`,pulse:!1}:Rs(t)?{label:`Completed`,colorClass:`text-success-foreground`,dotClass:`bg-success dark:bg-success/90`,pulse:!1}:null}function Gs(e){let t=null;for(let n of e)n!==null&&(t===null||Fs[n.label]>Fs[t.label])&&(t=n);return t}function Ks(e){let{deletedThreadId:t,deletedThreadIds:n,sortOrder:r,threads:i}=e,a=i.find(e=>e.id===t);return a?Ds(i.filter(e=>e.projectId===a.projectId&&e.id!==t&&!n?.has(e.id)&&(e.archivedAt??null)===null&&(e.deletedAt??null)===null),r)[0]?.id??null:null}function qs(e,t,n){return t.length>0?t.reduce((e,t)=>Math.max(e,Es(t,n)),-1/0):n===`created_at`?ws(e.createdAt)??-1/0:ws(e.updatedAt??e.createdAt)??-1/0}function Js(e,t,n){if(n===`manual`)return[...e];let r=new Map;for(let e of t){let t=r.get(e.projectId)??[];t.push(e),r.set(e.projectId,t)}return[...e].toSorted((e,t)=>{let i=qs(t,r.get(t.id)??[],n),a=qs(e,r.get(e.id)??[],n),o=i===a?0:i>a?1:-1;return o===0?e.name.localeCompare(t.name)||e.id.localeCompare(t.id):o})}var Ys={links:[],loaded:!1},Xs=Ys,Zs=null,Qs=0,$s=!1,ec=null,tc=1e3,nc=new Set,rc=3e4;function ic(e){if(!e||typeof e!=`object`)return!0;let t=e.status;return typeof t!=`number`||t===408||t===429||t>=500}function ac(){for(let e of nc)e()}function oc(e){Xs=e,ac()}function sc(){ec!==null&&(clearTimeout(ec),ec=null)}async function cc(){let e=await Jn.listProjectLinks();return{links:e.links.map(e=>({forgeEnvironmentId:e.forgeEnvironmentId,forgeProjectId:e.forgeProjectId,cmmdProjectId:e.cmmdProjectId})),loaded:e.sources?.cmmdAvailable!==!1}}function lc(){if(ec!==null||nc.size===0)return;let e=tc;tc=Math.min(tc*2,rc),ec=setTimeout(()=>{ec=null,!(nc.size===0||Xs.loaded)&&uc()},e)}function uc(){if(Xs.loaded||Zs!==null)return;let e=Qs;Zs=Promise.resolve().then(()=>cc()).then(t=>{e===Qs&&(oc(t),t.loaded?tc=1e3:lc())}).catch(t=>{e===Qs&&!Xs.loaded&&ic(t)&&lc()}).finally(()=>{Zs=null,$s&&nc.size>0&&!Xs.loaded&&($s=!1,uc())})}function dc(){if(sc(),tc=1e3,Qs+=1,oc(Ys),Zs!==null){$s=!0;return}nc.size>0&&uc()}function fc(e){return nc.add(e),uc(),()=>{nc.delete(e),nc.size===0&&sc()}}function pc(){return Xs}function mc(){return(0,I.useSyncExternalStore)(fc,pc,pc)}var hc=I.createContext(void 0);function gc(e){let t=I.useContext(hc);if(t===void 0&&!e)throw Error(Jr(33));return t}var _c=I.createContext(void 0);function vc(e){let t=I.useContext(_c);if(t===void 0&&!e)throw Error(Jr(36));return t}var yc=I.createContext(void 0);function bc(e=!0){let t=I.useContext(yc);if(t===void 0&&!e)throw Error(Jr(25));return t}var xc=I.createContext(void 0);function Sc(){let e=I.useContext(xc);if(e===void 0)throw Error(Jr(30));return e}function Cc(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=bc(!0),f=d!==void 0;return I.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:yr})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!wr&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&si(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var wc={type:`regular-item`};function Tc(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=I.useRef(null),{getButtonProps:d,buttonRef:f}=Cr({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Cc({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=I.useCallback(e=>Mr(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=Gr(u,f);return I.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Ec=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),Dc={checked(e){return e?{[Ec.checked]:``}:{[Ec.unchecked]:``}},...he},Oc=I.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,style:f,...p}=e,m=ci({guess:!0,label:a}),h=gc(!0),g=qr(i),{store:_}=vc(),v=_.useState(`disabled`),y=s||v,b=_.useState(`isActive`,m.index),x=_.useState(`itemProps`),[S,C]=ti({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:w,itemRef:T}=Tc({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:wc}),E=I.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function D(e){let t=Fr(yr,e.nativeEvent,void 0,{preventUnmountOnClose:Wr});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=Br(`div`,e,{state:E,stateAttributesMapping:Dc,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:D},p,w],ref:[T,t,m.ref]});return(0,L.jsx)(xc.Provider,{value:E,children:O})}),kc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Sc(),c=I.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=ne(s.checked);Oe({open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return Br(`span`,e,{state:f,ref:[t,c],stateAttributesMapping:Dc,props:{"aria-hidden":!0,...o},enabled:a||u})}),Ac=I.createContext(void 0);function jc(){let e=I.useContext(Ac);if(e===void 0)throw Error(Jr(31));return e}var Mc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=I.useState(void 0),c=Br(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,L.jsx)(Ac.Provider,{value:s,children:c})}),Nc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=qr(a),c=jc();return Kr(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Br(`div`,e,{ref:t,props:{id:s,role:`presentation`,...o}})}),Pc=I.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=ci({guess:!0,label:a}),f=gc(!0),p=qr(i),{store:m}=vc(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Tc({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:wc});return Br(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),Fc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=vc(),{side:c,align:l}=gc(),u=ni(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;Oe({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),I.useEffect(()=>{function e(e){s.setOpen(!1,Fr(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),N(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O={transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},k=Br(`div`,e,{state:O,ref:[t,s.context.popupRef,D],stateAttributesMapping:Ve,props:[p,{onKeyDown(e){u&&ei.has(e.key)&&e.stopPropagation()}},oe(f),o,{"data-rootownerid":y}]}),A=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(A=!0),(0,L.jsx)(ae,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?A:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:k})}),Ic=I.createContext(void 0);function Lc(){let e=I.useContext(Ic);if(e===void 0)throw Error(Jr(32));return e}var Rc=I.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=vc();return i.useState(`mounted`)||n?(0,L.jsx)(Ic.Provider,{value:n,children:(0,L.jsx)(je,{ref:t,...r})}):null}),zc=I.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Fe,style:g,..._}=e,{store:v}=vc(),y=Lc(),b=bc(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),A=v.useState(`transitionStatus`),j=v.useState(`positionerElement`),N=v.useState(`instantType`),ee=v.useState(`adaptiveOrigin`),P=v.useState(`lastOpenChangeReason`),F=v.useState(`floatingNodeId`),te=v.useState(`floatingParentNodeId`),ne=S.useState(`domReferenceElement`),re=I.useRef(null),ie=Ce(j),ae=n,oe=c,ce=l,le=s,ue=h;x.type===`context-menu`&&(ae=n??x.context?.anchor,le??=`start`,!o&&le!==`center`&&(ce=e.alignOffset??2,oe=e.sideOffset??-5));let de=o,fe=le;x.type===`menu`?(de??=`inline-end`,fe??=`start`,ue=e.collisionAvoidance??pe):x.type===`menubar`&&(de??=x.context.orientation===`vertical`?`inline-end`:`bottom`,fe??=`start`);let he=x.type===`context-menu`,_e=M({anchor:ae,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:de,sideOffset:oe,align:fe,alignOffset:ce,arrowPadding:he?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:F,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:ue,shift:he?{crossAxis:!(`side`in ue&&ue.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:ee});I.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===F&&v.set(`hoverEnabled`,!1),e.nodeId!==F&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,Fr(Ir)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,F]),I.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,Fr(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ve=Se();I.useEffect(()=>{T||ve.clear()},[T,ve]),I.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ve.isStarted()||ve.start(e,()=>{v.setOpen(!1,Fr(Ir))}):v.setOpen(!1,Fr(Ir))}else ve.clear()}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ve]),I.useEffect(()=>{let e={open:T,nodeId:F,parentNodeId:te,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,F,te]),Kr(()=>{let e=ne,t=re.current;if(e&&(re.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ie(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[ne,ie,v]);let ye={open:T,side:_e.side,align:_e.align,anchorHidden:_e.anchorHidden,nested:x.type===`menu`,instant:N},be=x.type===`menubar`&&x.context.modal;we(T&&(be||E&&P!==`trigger-hover`),D===`touch`,j,O);let xe=me(e,ye,{styles:_e.positionerStyles,transitionStatus:A,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),Te=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&P!==`trigger-hover`||x.type===`menubar`&&x.context.modal),Ee=null;return x.type===`menubar`?Ee=x.context.contentElement:x.type===void 0&&(Ee=O),(0,L.jsxs)(hc.Provider,{value:_e,children:[Te&&(0,L.jsx)(ge,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:se(!T),cutout:Ee}),(0,L.jsx)(k,{id:F,children:(0,L.jsx)(ht,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:xe})})]})}),Bc=I.createContext(void 0);function Vc(){let e=I.useContext(Bc);if(e===void 0)throw Error(Jr(34));return e}var Hc=I.memo(I.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=I.useState(void 0),[p,m]=ti({controlled:i,default:a,name:`MenuRadioGroup`}),h=oi((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=Br(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=I.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,L.jsx)(Ac.Provider,{value:f,children:(0,L.jsx)(Bc.Provider,{value:_,children:g})})})),Uc=I.createContext(void 0);function Wc(){let e=I.useContext(Uc);if(e===void 0)throw Error(Jr(35));return e}var Gc=I.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=ci({guess:!0,label:a}),p=gc(!0),m=qr(i),{store:h}=vc(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Vc(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=Tc({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:wc}),E=I.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=Fr(yr,e.nativeEvent,void 0,{preventUnmountOnClose:Wr});y(l,t)}let O=Br(`div`,e,{state:E,stateAttributesMapping:Dc,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,L.jsx)(Uc.Provider,{value:E,children:O})}),Kc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Wc(),c=I.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=ne(s.checked);Oe({open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return Br(`span`,e,{state:f,stateAttributesMapping:Dc,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),qc=I.createContext(null);function Jc(e){let t=I.useContext(qc);if(t===null&&!e)throw Error(Jr(5));return t}var Yc={...s,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},Xc=class extends h{constructor(e){super({...Qc(),...e},Zc(),Yc),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function Zc(){return{positionerRef:I.createRef(),popupRef:I.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:I.createRef(),beforeContentFocusGuardRef:I.createRef(),onOpenChangeComplete:void 0,triggerElements:new be}}function Qc(){return{...T(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Ae,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:vi,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var $c=I.createContext(void 0);function el(){return I.useContext($c)}var tl=j(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:_=!0}=e,y=bc(!0),S=vc(!0),w=Jc(!0),T=el(),E=I.useMemo(()=>T&&S?{type:`menu`,store:S.store}:w?{type:`menubar`,context:w}:y&&!S?{type:`context-menu`,context:y}:{type:void 0},[y,S,w,T]),O=nl({open:a,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:E});O.useControlledProp(`openProp`,n),O.useControlledProp(`triggerIdProp`,m),O.useContextCallback(`onOpenChangeComplete`,i);let k=Rr(),j=Rr(),M=O.useState(`floatingTreeRoot`),N=fe(M),ee=Ne(),P=O.useState(`open`),F=O.useState(`activeTriggerElement`),te=O.useState(`positionerElement`),ne=O.useState(`hoverEnabled`),re=O.useState(`disabled`),ae=O.useState(`lastOpenChangeReason`),oe=O.useState(`parent`),se=O.useState(`activeIndex`),ce=O.useState(`payload`),le=O.useState(`floatingParentNodeId`),ue=I.useRef(null),de=I.useRef(oe.type!==`context-menu`),pe=Se(),me=I.useRef(!0),he=Se(),ge=le!=null,{openMethod:_e,triggerProps:ve}=Pe(P);O.useSyncedValues({disabled:s,highlightItemOnHover:_,modal:oe.type===void 0?c:void 0,openMethod:_e,rootId:k}),b(O);let{forceUnmount:ye}=A(P,O,()=>{O.set(`allowMouseEnter`,!1)});Kr(()=>{y&&!S?O.update({parent:{type:`context-menu`,context:y},floatingNodeId:N,floatingParentNodeId:ee}):S&&O.update({floatingNodeId:N,floatingParentNodeId:ee})},[y,S,N,ee,O]),I.useEffect(()=>{if(P||(ue.current=null),oe.type===`context-menu`){if(!P){pe.clear(),de.current=!1;return}pe.start(500,()=>{de.current=!0})}},[pe,P,oe.type]),Kr(()=>{!P&&!ne&&O.set(`hoverEnabled`,!0)},[P,ne,O]);let be=oi((e,t)=>{let n=t.reason;if(!e&&!O.select(`open`)||P===e&&t.trigger===F&&ae===n)return;let i=D(t);if(!e&&t.trigger==null&&(t.trigger=F??void 0),r?.(e,t),t.isCanceled)return;O.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!me.current)return;e&&n===`trigger-focus`?(me.current=!1,he.start(300,()=>{me.current=!0})):(me.current=!0,he.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};ue.current=t.event,v(c,e,t.trigger,i()),O.update(c),oe.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?O.set(`instantType`,`group`):o||s?O.set(`instantType`,o?`click`:`dismiss`):O.set(`instantType`,void 0)}),xe=g({popupStore:O,floatingId:j,nested:ee!=null,onOpenChange:be}),Ce=xe.context.events;Kr(()=>{let e=({open:e,eventDetails:t})=>be(e,t);return Ce.on(`setOpen`,e),()=>{Ce?.off(`setOpen`,e)}},[Ce,be]);let we=I.useCallback(()=>{O.setOpen(!1,Fr(Zr))},[O]);I.useImperativeHandle(d,()=>({unmount:ye,close:we}),[ye,we]);let Te;oe.type===`context-menu`&&(Te=oe.context),I.useImperativeHandle(Te?.positionerRef,()=>te,[te]),I.useImperativeHandle(Te?.actionsRef,()=>({setOpen:be}),[be]);let Ee=ie(xe,{enabled:!re,bubbles:{escapeKey:f&&oe.type===`menu`},outsidePress(){return oe.type!==`context-menu`||ue.current?.type===`contextmenu`||de.current},externalTree:ge?M:void 0}),De=gi(),Oe=I.useCallback(e=>{O.select(`activeIndex`)!==e&&O.set(`activeIndex`,e)},[O]),ke=Qa(xe,{enabled:!re,listRef:O.context.itemDomElements,activeIndex:se,nested:oe.type!==void 0,loopFocus:l,orientation:u,parentOrientation:oe.type===`menubar`?oe.context.orientation:void 0,rtl:De===`rtl`,disabledIndices:mi,onNavigate:Oe,openOnArrowKeyDown:oe.type!==`context-menu`,externalTree:ge?M:void 0,focusItemOnHover:_}),Ae=I.useCallback(e=>{O.context.typingRef.current=e},[O]),je=$a(xe,{enabled:!re,listRef:O.context.itemLabels,elementsRef:O.context.itemDomElements,activeIndex:se,resetMs:500,onMatch:e=>{P&&e!==se&&O.set(`activeIndex`,e)},onTyping:Ae}),Me=I.useMemo(()=>{let e=Mr(je.reference,ke.reference,Ee.reference,{onMouseMove(){O.set(`allowMouseEnter`,!0)}},ve);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=P,e},[O,je.reference,ke.reference,Ee.reference,ve,P]),Fe=I.useMemo(()=>{let e=Mr(ke.trigger,Ee.trigger,ve);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ke.trigger,Ee.trigger,ve]),Ie=I.useMemo(()=>Mr(x,{id:j,role:`menu`,"aria-labelledby":F?.id,onMouseMove(){O.set(`allowMouseEnter`,!0),oe.type===`menu`&&O.set(`hoverEnabled`,!1)},onClick(){O.select(`hoverEnabled`)&&O.set(`hoverEnabled`,!1)},onKeyDown(e){let t=O.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},je.floating,ke.floating,Ee.floating),[F,j,oe.type,O,je.floating,ke.floating,Ee.floating]),Le=ke.item??vi;Ue(O,{floatingRootContext:xe,activeTriggerProps:Me,inactiveTriggerProps:Fe,popupProps:Ie,itemProps:Le});let Re=I.useMemo(()=>({store:O,parent:E}),[O,E]),ze=(0,L.jsxs)(_c.Provider,{value:Re,children:[p&&(0,L.jsx)(C,{handle:p,store:O}),typeof t==`function`?t({payload:ce}):t]});return oe.type===void 0||oe.type===`context-menu`?(0,L.jsx)(o,{externalTree:M,children:ze}):ze});function nl(e){return Vr(()=>new Xc(e)).current}function rl(e){let t=vc().store,n=I.useMemo(()=>({parentMenu:t}),[t]);return(0,L.jsx)($c.Provider,{value:n,children:(0,L.jsx)(tl,{...e})})}var il=5;function al(e,t){let n=ol(t);return e.clientX>=n.left-il&&e.clientX<=n.right+il&&e.clientY>=n.top-il&&e.clientY<=n.bottom+il}function ol(e){let t=e.getBoundingClientRect(),n=ri(e);if(xr)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function sl(e){if(Hr(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!ii(e))return sl(fi(e))}function cl(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=I.useRef(!1);return I.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,w(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:vi,[t,n,r])}var ll=We(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:d=0,handle:p,payload:h,...g}=e,v=vc(!0),y=f(p)??v?.store;if(!y)throw Error(Jr(85));let b=qr(s),x=y.useState(`isTriggerActive`,b),S=y.useState(`floatingRootContext`),C=y.useState(`isOpenedByTrigger`,b),T=y.useState(`triggerPopupId`,b),E=I.useRef(null),D=dl(),O=zr(!0),k=Te(),A=I.useMemo(()=>k??new Ae,[k]),j=fe(A),M=Ne(),{registerTrigger:N,isMountedByThisTrigger:ee}=_(b,E,y,{payload:h,closeDelay:d,parent:D,floatingTreeRoot:A,floatingNodeId:j,floatingParentNodeId:M,keyboardEventRelay:O?.relayKeyboardEvent}),P=D.type===`menubar`,F=y.useState(`disabled`),te=a||F||P&&D.context.disabled,{getButtonProps:ne,buttonRef:ie}=Cr({disabled:te,native:o});I.useEffect(()=>{!C&&D.type===void 0&&(y.context.allowMouseUpTriggerRef.current=!1)},[y,C,D.type]);let ae=I.useRef(null),oe=Se(),se=oi(e=>{if(!ae.current)return;oe.clear(),y.context.allowMouseUpTriggerRef.current=!1;let t=e.target;jr(ae.current,t)||jr(y.select(`positionerElement`),t)||t===ae.current||(t==null||sl(t)!==y.select(`rootId`))&&(al(e,ae.current)||A.events.emit(`close`,{domEvent:e,reason:hi}))});I.useEffect(()=>{C&&y.select(`lastOpenChangeReason`)===`trigger-hover`&&w(ae.current).addEventListener(`mouseup`,se,{once:!0})},[C,se,y]);let ce=P&&D.context.hasSubmenuOpen,ue=Le(S,{enabled:(c??ce)&&!te&&(!P||ce&&!ee),handleClose:u({blockPointerEvents:!P}),mouseOnly:!0,move:!1,restMs:D.type===void 0?l:void 0,delay:{close:d},triggerElementRef:E,externalTree:A,isActiveTrigger:x,isClosing:()=>y.select(`transitionStatus`)===`ending`}),de=ul(C,y.select(`lastOpenChangeReason`)),pe=re(S,{enabled:!te,event:C&&P?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:D.type===void 0&&de}),me=m(S,{enabled:!te&&ce}),he=cl({open:C,enabled:P,mouseDownAction:`open`}),ge=I.useMemo(()=>Mr(me.reference,pe.reference),[me.reference,pe.reference]),_e=y.useState(`triggerProps`,ee),{preFocusGuardRef:ve,handlePreFocusGuardFocus:ye,handleFocusTargetFocus:be}=Me(y,E),xe={disabled:te,open:C},Ce=[ae,t,ie,N,E],we=[ge,ue??vi,_e,{"aria-haspopup":`menu`,"aria-controls":T,id:b,onMouseDown:e=>{y.select(`open`)||(oe.start(200,()=>{y.context.allowMouseUpTriggerRef.current=!0}),w(e.currentTarget).addEventListener(`mouseup`,se,{once:!0}))}},P?{role:`menuitem`}:{},he,g,ne],Ee=Br(`button`,e,{enabled:!P,stateAttributesMapping:le,state:xe,ref:Ce,props:we});return P?(0,L.jsx)(di,{tag:`button`,render:n,className:r,style:i,state:xe,refs:Ce,props:we,stateAttributesMapping:le}):C?(0,L.jsxs)(I.Fragment,{children:[(0,L.jsx)(Ie,{ref:ve,onFocus:ye},`${b}-pre-focus-guard`),(0,L.jsx)(I.Fragment,{children:Ee},b),(0,L.jsx)(Ie,{ref:y.context.triggerFocusTargetRef,onFocus:be},`${b}-post-focus-guard`)]}):(0,L.jsx)(I.Fragment,{children:Ee},b)});function ul(e,t){let n=Se(),[r,i]=I.useState(!1);return Kr(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function dl(){let e=Jc(!0);return I.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var fl={"aria-expanded":void 0},pl=I.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:d=0,disabled:f=!1,...p}=e,m=el();if(!m?.parentMenu)throw Error(Jr(37));let h=ci({guess:!0,label:a}),g=gc(),{store:_}=vc(),v=qr(o),y=_.useState(`open`),b=_.useState(`floatingRootContext`),x=_.useState(`floatingTreeRoot`),S=_.useState(`triggerPopupId`,v),C=P(v,_),w=I.useCallback(e=>{let t=C(e);return e!==null&&_.select(`open`)&&_.select(`activeTriggerId`)==null&&_.update({activeTriggerId:v,activeTriggerElement:e,closeDelay:d}),t},[C,d,_,v]),T=I.useRef(null),E=I.useCallback(e=>{T.current=e,_.set(`activeTriggerElement`,e)},[_]);_.useSyncedValue(`closeDelay`,d);let D=m.parentMenu,O=_.useState(`disabled`),k=D.useState(`disabled`),A=f||O||k,j=D.useState(`itemProps`),M=D.useState(`isActive`,h.index),N=I.useMemo(()=>({type:`submenu-trigger`,setActive(){D.select(`highlightItemOnHover`)&&D.set(`activeIndex`,h.index)}}),[D,h.index]),{getItemProps:F,itemRef:te}=Tc({closeOnClick:!1,disabled:A,highlighted:M,id:v,store:_,typingRef:D.context.typingRef,nativeButton:s,itemMetadata:N,nodeId:g?.context.nodeId}),ne=_.useState(`hoverEnabled`),ie=Le(b,{enabled:ne&&c&&!A,handleClose:u({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:d},shouldOpen:l>0?()=>D.select(`allowMouseEnter`):void 0,triggerElementRef:T,externalTree:x,isClosing:()=>_.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),ae=re(b,{enabled:!A,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??vi,oe=_.useState(`triggerProps`,!0);delete oe.id;let se={disabled:A,highlighted:M,open:y},ce=_.useState(`openMethod`),le=_.useState(`lastOpenChangeReason`)===`list-navigation`||ce===`keyboard`;return Br(`div`,e,{state:se,stateAttributesMapping:ze,props:[ae,ie,oe,j,y&&le&&ee?fl:void 0,{"aria-controls":S,tabIndex:y||M?0:-1,onBlur(){M&&D.set(`activeIndex`,null)}},p,F],ref:[t,h.ref,te,w,E]})}),ml=I.createContext(!1);function hl(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(ml.Provider,{value:!0,children:(0,L.jsx)(Mc,{"data-slot":`menu-group`,...e})}),t[0]=e,t[1]=n),n}function gl(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(ml.Provider,{value:!0,children:(0,L.jsx)(Hc,{"data-slot":`menu-radio-group`,...e})}),t[0]=e,t[1]=n),n}var _l=`px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8`;function vl(e){let t=(0,R.c)(22),n,r,i;if(t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i),!I.useContext(ml)){let e,a,o;if(t[4]!==i){let{render:n,style:r,children:s,...c}=i;o=r,e=s,a=c,t[4]=i,t[5]=e,t[6]=a,t[7]=o}else e=t[5],a=t[6],o=t[7];let s;t[8]===n?s=t[9]:(s=_i(_l,n),t[8]=n,t[9]=s);let c=typeof o==`function`?void 0:o,l=typeof e==`function`?null:e,u;return t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==c||t[14]!==l?(u=(0,L.jsx)(`div`,{className:s,"data-inset":r,"data-slot":`menu-label`,role:`presentation`,style:c,...a,children:l}),t[10]=r,t[11]=a,t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15],u}let a;t[16]===n?a=t[17]:(a=_i(_l,n),t[16]=n,t[17]=a);let o;return t[18]!==r||t[19]!==i||t[20]!==a?(o=(0,L.jsx)(Nc,{className:a,"data-inset":r,"data-slot":`menu-label`,...i}),t[18]=r,t[19]=i,t[20]=a,t[21]=o):o=t[21],o}var yl=tl;function bl(e){let t=(0,R.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,L.jsx)(ll,{className:r,"data-slot":`menu-trigger`,...i,children:n}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xl(e){let t=(0,R.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({children:i,className:a,sideOffset:s,align:c,alignOffset:n,side:l,anchor:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=s===void 0?4:s,d=c===void 0?`center`:c,f=l===void 0?`bottom`:l,p;t[9]===a?p=t[10]:(p=_i(`dropdown-glass relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg shadow-[0_16px_40px_-18px_rgb(0_0_0/55%)] outline-none focus:outline-none dark:shadow-[0_18px_44px_-18px_rgb(0_0_0/80%)]`,a),t[9]=a,t[10]=p);let m;t[11]===i?m=t[12]:(m=(0,L.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1`,children:i}),t[11]=i,t[12]=m);let h;t[13]!==o||t[14]!==p||t[15]!==m?(h=(0,L.jsx)(Fc,{className:p,"data-slot":`menu-popup`,...o,children:m}),t[13]=o,t[14]=p,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==d||t[18]!==n||t[19]!==r||t[20]!==f||t[21]!==u||t[22]!==h?(g=(0,L.jsx)(Rc,{children:(0,L.jsx)(zc,{align:d,alignOffset:n,anchor:r,className:`z-50`,"data-slot":`menu-positioner`,side:f,sideOffset:u,children:h})}),t[17]=d,t[18]=n,t[19]=r,t[20]=f,t[21]=u,t[22]=h,t[23]=g):g=t[23],g}function Sl(e){let t=(0,R.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=_i(`[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:shrink-0`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,L.jsx)(Pc,{className:s,"data-inset":r,"data-slot":`menu-item`,"data-variant":o,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function Cl(e){let t=(0,R.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,variant:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=o===void 0?`default`:o,c=s===`switch`?`grid-cols-[1fr_auto] gap-4 pe-1.5`:`grid-cols-[1rem_1fr] pe-4`,l;t[6]!==i||t[7]!==c?(l=_i(`grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 ps-2 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,c,i),t[6]=i,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==s?(u=s===`switch`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`col-start-1`,children:r}),(0,L.jsx)(kc,{className:`inset-shadow-[0_1px_--theme(--color-black/4%)] inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(4)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:opacity-64 sm:[--thumb-size:--spacing(3)]`,keepMounted:!0,children:(0,L.jsx)(`span`,{className:`pointer-events-none block aspect-square h-full in-[[data-slot=menu-checkbox-item][data-checked]]:origin-[var(--thumb-size)_50%] origin-left in-[[data-slot=menu-checkbox-item][data-checked]]:translate-x-[calc(var(--thumb-size)-4px)] in-[[data-slot=menu-checkbox-item]:active]:not-data-disabled:scale-x-110 in-[[data-slot=menu-checkbox-item]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.10)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s]`})})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(kc,{className:`col-start-1`,children:(0,L.jsx)(`svg`,{fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,L.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})}),(0,L.jsx)(`span`,{className:`col-start-2`,children:r})]}),t[9]=r,t[10]=s,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==a||t[14]!==l||t[15]!==u?(d=(0,L.jsx)(Oc,{checked:n,className:l,"data-slot":`menu-checkbox-item`,...a,children:u}),t[12]=n,t[13]=a,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function wl(e){let t=(0,R.c)(18),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,hideIndicator:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a!==void 0&&a,s=o?`flex px-2 data-checked:bg-foreground/[0.12] data-checked:data-highlighted:bg-foreground/[0.18]`:`grid grid-cols-[1rem_1fr] ps-2 pe-4`,c;t[5]!==r||t[6]!==s?(c=_i(`min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,s,r),t[5]=r,t[6]=s,t[7]=c):c=t[7];let l;t[8]===o?l=t[9]:(l=o?null:(0,L.jsx)(Kc,{className:`col-start-1`,children:(0,L.jsx)(`svg`,{fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,L.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})}),t[8]=o,t[9]=l);let u=o?`min-w-0 flex-1`:`col-start-2`,d;t[10]!==n||t[11]!==u?(d=(0,L.jsx)(`span`,{className:u,children:n}),t[10]=n,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==i||t[14]!==c||t[15]!==l||t[16]!==d?(f=(0,L.jsxs)(Gc,{className:c,"data-slot":`menu-radio-item`,...i,children:[l,d]}),t[13]=i,t[14]=c,t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function Tl(e){let t=(0,R.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=_i(`mx-2 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(sn,{className:i,"data-slot":`menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function El(e){let t=(0,R.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=_i(`ms-auto font-medium font-sans text-muted-foreground/72 text-xs tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(`kbd`,{className:i,"data-slot":`menu-shortcut`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dl(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(rl,{"data-slot":`menu-sub`,...e}),t[0]=e,t[1]=n),n}function Ol(e){let t=(0,R.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=_i(`flex min-h-8 items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-popup-open:bg-accent data-inset:ps-8 data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(xt,{className:`-me-0.5 ms-auto opacity-80`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,L.jsxs)(pl,{className:o,"data-inset":i,"data-slot":`menu-sub-trigger`,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function kl(e){let t=(0,R.c)(12),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,sideOffset:a,alignOffset:n,align:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?0:a,c=o===void 0?`start`:o,l=n??(c===`center`?void 0:-5),u;return t[6]!==c||t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==l?(u=(0,L.jsx)(xl,{align:c,alignOffset:l,className:r,"data-slot":`menu-sub-content`,side:`inline-end`,sideOffset:s,...i}),t[6]=c,t[7]=r,t[8]=i,t[9]=s,t[10]=l,t[11]=u):u=t[11],u}function Al(e){if(!e.environmentId)return null;let t=e.readEnvironmentApi(e.environmentId);return t?{environmentId:e.environmentId,api:t}:null}function jl(e){let t=Ss({requestedDefault:e.requestedRuntime}),n=Al({environmentId:e.activeEnvironmentId,readEnvironmentApi:e.readEnvironmentApi}),r=Al({environmentId:e.primaryEnvironmentId,readEnvironmentApi:e.readEnvironmentApi}),i=t.effectiveDefault===`cloud`?r:n??r;return i?{runtime:t.effectiveDefault,environmentId:i.environmentId,api:i.api}:null}function Ml(e){return e.projectRef}function Nl(e){let t=e.latestActiveDraft;return!t||e.routeTargetKind!==`draft`||t.logicalProjectKey!==e.logicalProjectKey?!1:t.promotedTo==null}async function Pl(e){e.openBrowserPreview&&Ht.getState().revealBrowser(Xe(e.draftId));let t=e.viewTransition&&typeof document<`u`&&typeof document.startViewTransition==`function`,n=()=>e.router.navigate({to:`/draft/$draftId`,params:{draftId:e.draftId},...t?{viewTransition:!1}:{}});if(!t){await n();return}let r=document.startViewTransition(n);r.ready.catch(()=>void 0),await r.updateCallbackDone}function Fl(){let e=nn(e=>e.activeEnvironmentId),t=nn(e=>e.environmentStateById),n=(0,I.useMemo)(()=>({activeEnvironmentId:e,environmentStateById:t}),[e,t]);return(0,I.useMemo)(()=>Jt(n),[n])}var Il=`package`;function Ll(e,t){let n=t.repositoryIdentity?.canonicalKey;return n?e[n]??`package`:Il}function Rl(e,t=Il){if(t===`repository`)return e.canonicalKey;let n=e.repositorySubpath?.trim();return n&&n.length>0?`${e.canonicalKey}#${n}`:e.canonicalKey}function zl(e,t=Il){return e.repositoryIdentity?Rl(e.repositoryIdentity,t):Nt(ut(e.environmentId,e.id))}function Bl(e){if(!e)return null;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`).filter(e=>e.length>0);for(let e=t.length-1;e>=0;--e){if(t[e]?.toLowerCase()!==`conductor`||t[e+1]?.toLowerCase()!==`workspaces`)continue;let n=t[e+2],r=t[e+3];if(!n||!r)return null;let i=t.slice(e+4).join(`/`);return`worktree-shape:${n.toLowerCase()}#${i.toLowerCase()}`}for(let e=t.length-1;e>=0;--e){if(t[e]?.toLowerCase()!==`.claude`||t[e+1]?.toLowerCase()!==`worktrees`)continue;let n=t[e-1],r=t[e+2];if(!n||!r)return null;let i=t.slice(e+3).join(`/`);return`worktree-shape:${n.toLowerCase()}#${i.toLowerCase()}`}let n=-1;for(let e=t.length-1;e>=0;--e){let r=t[e];if(r===`worktrees`||r===`.worktrees`){n=e;break}}if(n===-1||n+2>=t.length)return null;let r=n>0&&t[n-1]?.toLowerCase()===`.codex`?t[n+2]:t[n+1];if(!r)return null;let i=t.slice(n+3).join(`/`);return`worktree-shape:${r.toLowerCase()}#${i.toLowerCase()}`}function Vl(e,t){if(!e)return null;let n=e.replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`).filter(e=>e.length>0),r=(t??``).replace(/\\/g,`/`).replace(/^\/+|\/+$/g,``).split(`/`).filter(e=>e.length>0&&e!==`.`);if(r.length>n.length)return null;let i=n.length-r.length;if(!r.every((e,t)=>n[i+t]?.toLowerCase()===e.toLowerCase()))return null;let a=n.slice(0,i).at(-1);return a?`worktree-shape:${a.toLowerCase()}#${r.map(e=>e.toLowerCase()).join(`/`)}`:null}function Hl(e,t=()=>Il){let n=new Map;for(let r of e){if(!r.repositoryIdentity)continue;let e=Bl(r.cwd)??Vl(r.cwd,r.repositoryIdentity.repositorySubpath);if(!e)continue;let i=n.get(e)??new Set;i.add(zl(r,t(r.repositoryIdentity))),n.set(e,i)}let r=new Map;for(let[e,t]of n){if(t.size!==1)continue;let n=t.values().next().value;n&&r.set(e,n)}let i=new Map;for(let n of e){let e=Nt(ut(n.environmentId,n.id)),a=n.repositoryIdentity?null:Bl(n.cwd);i.set(e,(a?r.get(a):void 0)??zl(n,n.repositoryIdentity?t(n.repositoryIdentity):void 0))}return i}function Ul(e){let t=e.prompt?.trim(),n=e.existingPrompt?.trim(),r=e.replaceExistingPrompt?.trim();!t||n&&n!==r||(e.setPrompt(e.target,t),e.autoSubmit===!0&&e.setPendingAutoSubmit(e.target,!0))}function Wl(e){return e?e.branch!==void 0||e.worktreePath!==void 0||e.envMode!==void 0||e.anchorKind!==void 0||e.anchorCmmdId!==void 0||e.cmmdTaskId!==void 0||e.linkedPullRequest!==void 0:!1}function Gl(e){return e?{...e.branch===void 0?{}:{branch:e.branch??null},...e.worktreePath===void 0?{}:{worktreePath:e.worktreePath??null},...e.envMode===void 0?{}:{envMode:e.envMode},...e.anchorKind===void 0?{}:{anchorKind:e.anchorKind},...e.anchorCmmdId===void 0?{}:{anchorCmmdId:e.anchorCmmdId},...e.cmmdTaskId===void 0?{}:{cmmdTaskId:e.cmmdTaskId},...e.linkedPullRequest===void 0?{}:{linkedPullRequest:e.linkedPullRequest}}:{}}function Kl(e){let{branch:t,worktreePath:n,envMode:r,cmmdTaskId:i,linkedPullRequest:a}=Gl(e);return{...t===void 0?{}:{branch:t},...n===void 0?{}:{worktreePath:n},...r===void 0?{}:{envMode:r},...i===void 0?{}:{cmmdTaskId:i},...a===void 0?{}:{linkedPullRequest:a}}}function ql(e,t){return{threadId:t.threadId,createdAt:t.createdAt,runtimeMode:t.runtimeMode,branch:e?.branch??null,worktreePath:e?.worktreePath??null,envMode:e?.envMode??`local`,...e?.anchorKind===void 0?{}:{anchorKind:e.anchorKind},...e?.anchorCmmdId===void 0?{}:{anchorCmmdId:e.anchorCmmdId},...e?.cmmdTaskId===void 0?{}:{cmmdTaskId:e.cmmdTaskId},...e?.linkedPullRequest===void 0?{}:{linkedPullRequest:e.linkedPullRequest}}}function Jl(){let e=(0,R.c)(6),t=Fl(),n=En(),r;e[0]===n.state.matches?r=e[1]:(r=()=>{let e=n.state.matches[n.state.matches.length-1]?.params??{};return tr(e)},e[0]=n.state.matches,e[1]=r);let i=r,a;return e[2]!==i||e[3]!==t||e[4]!==n?(a=(e,r)=>{let{getDraftSessionByLogicalProjectKey:a,getDraftSession:o,getDraftThread:s,applyStickyState:c,setDraftThreadContext:l,setLogicalProjectDraftThreadId:u}=$e.getState(),d=i(),f=t.find(t=>t.id===e.projectId&&t.environmentId===e.environmentId),p=f?zl(f):Nt(e),m=Gl(r),h=Kl(r),g=Wl(r),_=a(p),v=nu(d,{getDraftThread:s,getDraftSession:o}),y=e=>{let t=$e.getState();Ul({target:e,prompt:r?.initialPrompt,...r?.autoSubmit===void 0?{}:{autoSubmit:r.autoSubmit},setPrompt:t.setPrompt,setPendingAutoSubmit:t.setPendingAutoSubmit})},b=Yl(_,r?.draftReuse);if(b)return(async()=>(Xl({mentionsContext:g,draftId:b.draftId,contextPatch:m,setDraftThreadContext:l}),u(p,e,b.draftId,{threadId:b.threadId,...Zl(r?.cmmdTaskId)}),y(b.draftId),await Pl({router:n,draftId:b.draftId,openBrowserPreview:r?.openBrowserPreview,viewTransition:r?.viewTransition}),Ql(b)))();let x=Yl(v,r?.draftReuse);if(x&&d?.kind===`draft`&&Nl({latestActiveDraft:x,routeTargetKind:d.kind,logicalProjectKey:p}))return Xl({mentionsContext:g,draftId:d.draftId,contextPatch:m,setDraftThreadContext:l}),u(p,e,d.draftId,{threadId:x.threadId,createdAt:x.createdAt,runtimeMode:x.runtimeMode,interactionMode:x.interactionMode,...h}),y(d.draftId),Promise.resolve({draftId:d.draftId,threadId:x.threadId,projectRef:e});let S=_r(),C=$r(),w=new Date().toISOString();return(async()=>(u(p,e,S,ql(r,{threadId:C,createdAt:w,runtimeMode:bi})),c(S),y(S),await Pl({router:n,draftId:S,openBrowserPreview:r?.openBrowserPreview,viewTransition:r?.viewTransition}),{draftId:S,threadId:C,projectRef:e}))()},e[2]=i,e[3]=t,e[4]=n,e[5]=a):a=e[5],a}function Yl(e,t){return t===`never`?null:e}function Xl(e){e.mentionsContext&&e.setDraftThreadContext(e.draftId,e.contextPatch)}function Zl(e){return e===void 0?{}:{cmmdTaskId:e}}function Ql(e){return{draftId:e.draftId,threadId:e.threadId,projectRef:ut(e.environmentId,e.projectId)}}function $l(){let e=(0,R.c)(5),t=Jl(),n;e[0]===t?n=e[1]:(n=async(...e)=>{await t(...e)},e[0]=t,e[1]=n);let r=n,i;return e[2]!==r||e[3]!==t?(i={handleNewThread:r,openNewThread:t},e[2]=r,e[3]=t,e[4]=i):i=e[4],i}function eu(){let e=rr(e=>e.projectOrder),t=nr({strict:!1,select:e=>tr(e)}),n=t?.kind===`server`?t.threadRef:null,r=nn((0,I.useMemo)(()=>_t(n),[n])),i=$e(e=>e.getDraftThread),a=$e(()=>t?t.kind===`server`?i(t.threadRef):$e.getState().getDraftSession(t.draftId):null),o=Kt(),s=ir(e=>e.defaultThreadRuntime),c=Fl(),l=(0,I.useMemo)(()=>Bs({items:c,preferredIds:e,getId:e=>Nt(ut(e.environmentId,e.id))}),[e,c]),u=Jl(),d=(0,I.useCallback)(async(...e)=>{await u(...e)},[u]),f=(0,I.useMemo)(()=>{let e=l[0];return e?Ml({requestedRuntime:s,primaryEnvironmentId:o,projects:c,projectRef:ut(e.environmentId,e.id)}):null},[s,l,o,c]);return{activeComposerTarget:tu(t),activeDraftThread:a,activeThread:r,defaultProjectRef:f,handleNewThread:d,openNewThread:u,routeThreadRef:n}}function tu(e){return e===null?null:e.kind===`server`?e.threadRef:e.draftId}function nu(e,t){return e?e.kind===`server`?t.getDraftThread(e.threadRef):t.getDraftSession(e.draftId):null}function ru(e){let t=e.replace(/[/\\]+$/,``)||e,n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return(n>=0?t.slice(n+1):t)||e}var iu=`inline-flex max-w-full select-none items-center gap-1 rounded-md border border-border/70 bg-accent/40 px-1.5 py-px font-medium text-[12px] leading-[1.1] text-foreground align-middle`,au=`size-3.5 shrink-0 opacity-85`,ou=`truncate select-none leading-tight`,su=`inline-flex max-w-full select-none items-center gap-1 rounded-md border border-hue-violet-border bg-hue-violet-surface px-1.5 py-px font-medium text-[12px] leading-[1.1] text-hue-violet-foreground align-middle`,cu=`ml-0.5 inline-flex size-3.5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/6 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,lu=`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>`;function uu(e){return e.split(/[\s:_-]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function du(e){return e.replaceAll(`\\`,`/`)}function fu(e){return e.displayName?.trim()||uu(e.name)}function pu(e){let t=du(e.path);if(t.includes(`/.codex/plugins/`)||t.includes(`/.agents/plugins/`))return`App`;let n=e.scope?.trim().toLowerCase();return n===`system`?`System`:n===`project`||n===`workspace`||n===`local`?`Project`:n===`user`||n===`personal`?`Personal`:n?uu(n):null}var mu=(0,I.createContext)(null);function hu(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function gu(){let e=(0,I.useContext)(mu);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function z(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _u(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var vu=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,yu=vu&&`documentMode`in document?document.documentMode:null,bu=vu&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),xu=vu&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Su=!(!vu||!(`InputEvent`in window)||yu)&&`getTargetRanges`in new window.InputEvent(`input`),Cu=vu&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,wu=vu&&/Android/.test(navigator.userAgent),Tu=vu&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!wu,Eu=vu&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Du=vu&&wu&&Eu,Ou=vu&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&bu&&!Eu,ku=0,Au=1,ju=2,Mu=1,Nu=2,Pu=3,Fu=4,Iu=5,Lu=6,Ru=Tu||Cu||Ou?`\xA0`:``,zu=`
|
|
1
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Ba as r,Va as i,za as a}from"./Stream-C4tOsbfQ.js";import{$ as o,A as s,At as c,Bt as l,C as u,Ct as d,D as f,Dt as p,E as m,Ft as h,G as g,H as _,I as v,K as y,L as b,M as x,Mt as S,N as C,Nt as w,O as T,Ot as E,P as D,Pt as O,Q as k,R as A,Rt as j,S as M,T as N,Tt as ee,U as P,Ut as F,Vt as te,W as ne,X as re,Y as ie,Z as ae,_ as oe,_t as se,at as ce,b as le,ct as ue,dt as de,et as fe,ft as pe,g as me,gt as he,h as ge,ht as _e,i as ve,it as ye,j as be,jt as xe,kt as Se,mt as Ce,n as we,nt as Te,o as Ee,ot as De,pt as Oe,r as ke,rt as Ae,st as je,t as Me,tt as Ne,u as Pe,ut as Fe,vt as Ie,w as Le,wt as Re,x as ze,xt as Be,y as Ve,yt as He,z as Ue,zt as We}from"./useTriggerFocusGuards-CaUimC-O.js";import{$ as Ge,$s as Ke,An as qe,At as Je,B as Ye,Bn as Xe,Bt as Ze,Ct as Qe,Da as $e,Dt as et,Et as tt,F as nt,Fs as rt,Ft as it,G as at,H as ot,Ho as st,I as ct,Ir as lt,Is as ut,It as dt,J as ft,Jn as pt,K as mt,Kn as ht,L as gt,Ln as _t,Lt as vt,M as yt,Mn as bt,Ms as xt,Mt as St,N as Ct,Nt as wt,On as Tt,Ot as Et,P as Dt,Pt as Ot,Q as kt,Qt as At,R as jt,Ro as Mt,Rs as Nt,Rt as Pt,Sc as Ft,Sn as It,St as Lt,Tt as Rt,U as zt,Ut as Bt,V as Vt,Vn as Ht,Vs as Ut,W as Wt,Wi as Gt,Wo as Kt,X as qt,Xi as Jt,Xt as Yt,Y as Xt,Z as Zt,Zt as Qt,_ as $t,_t as en,a as tn,aa as nn,ac as rn,an,at as on,ba as sn,bn as cn,bt as ln,ct as un,dn,ds as fn,dt as pn,ec as mn,et as hn,ft as gn,g as _n,gn as vn,gr as yn,gt as bn,hi as xn,ht as Sn,ic as Cn,it as wn,jt as Tn,kc as En,kr as Dn,kt as On,lc as kn,ln as An,lt as jn,m as Mn,ma as Nn,mc as Pn,mt as Fn,nc as In,nt as Ln,o as Rn,ot as zn,pn as Bn,pt as Vn,q as Hn,qn as Un,rc as Wn,rt as Gn,s as Kn,sc as qn,ss as Jn,st as Yn,ta as Xn,tt as Zn,ut as Qn,vc as $n,vt as er,wa as tr,wc as nr,wi as rr,wr as ir,wt as ar,xn as or,xr as sr,xt as cr,yc as lr,yt as ur,z as dr,zs as fr,zt as pr}from"./DiffPanelShell-B30xoHOs.js";import{$ as mr,A as hr,At as gr,Dn as _r,En as vr,F as yr,Ft as br,Ht as xr,It as Sr,K as Cr,Kt as wr,L as Tr,Lt as Er,Mn as Dr,Mt as Or,Nt as kr,Pn as Ar,Pt as jr,Q as Mr,R as Nr,Rt as Pr,S as Fr,V as Ir,W as Lr,X as Rr,Y as zr,Z as Br,_n as Vr,an as Hr,at as Ur,bn as Wr,et as Gr,gn as Kr,h as qr,hn as Jr,in as Yr,it as Xr,j as Zr,jt as Qr,kn as $r,l as ei,m as ti,n as ni,nn as ri,on as ii,ot as ai,pn as oi,q as si,r as ci,rt as li,st as ui,t as di,tn as fi,tt as pi,vn as mi,w as hi,x as gi,xn as _i,yn as vi,zt as yi}from"./CompositeItem-BNZfMUvm.js";import{R as bi,St as xi,Tt as Si}from"./src-CFqnisEM.js";var I=t(i(),1),Ci=I.useLayoutEffect;function wi(e,t,n){I.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function Ti(e){let t=I.useRef(null);return I.useImperativeHandle(e,()=>t.current,[]),t}function Ei(e){let t=En();return I.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Di(e){let t=En(),n=Ei(),r=I.useRef(null);return Ci(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}var Oi=class extends mn{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:In(t,n.data),hasPreviousPage:Wn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ki=class extends Cn{#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||Ai(),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){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=rn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,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{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),qn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ai(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ji=class extends Ft{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),$n(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&kn(t.mutationKey)!==kn(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ai();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){qn.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Mi(e){return e}function Ni(e,t){let n=Ke(t),[r]=I.useState(()=>new ji(n,e));I.useEffect(()=>{r.setOptions(e)},[r,e]);let i=I.useSyncExternalStore(I.useCallback(e=>r.subscribe(qn.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=I.useCallback((e,t)=>{r.mutate(e,t).catch(Pn)},[r]);if(i.error&&lr(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Pi(e){return e}function Fi(){let e=new Map,t=new Map;return{enqueueCommand:(t,n)=>{let r=(e.get(t)??Promise.resolve()).then(n,n),i=r.then(()=>void 0,()=>void 0);return e.set(t,i),r.finally(()=>{e.get(t)===i&&e.delete(t)})},read:(e,n)=>{let r=t.get(e);if(r!==void 0)return r;let i=Promise.resolve().then(n);return t.set(e,i),i.then(()=>{t.get(e)===i&&t.delete(e)},()=>{t.get(e)===i&&t.delete(e)}),i},commandLaneCount:()=>e.size}}var Ii=Ar(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),Li=Ar(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Ri=Ar(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),zi=Ar(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Bi=Ar(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Vi=Ar(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Hi=Ar(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ui=Ar(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Wi=Ar(`heading-2`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`,key:`9jr5yi`}]]),Gi=Ar(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Ki=Ar(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),qi=Ar(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ji=Ar(`link`,[[`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`}]]),Yi=Ar(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Xi=Ar(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Zi=Ar(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Qi=Ar(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),$i=Ar(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),ea=Ar(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),ta=Ar(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),na=Ar(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 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-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),ra=Ar(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),ia=Ar(`refresh-cw`,[[`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`}]]),aa=Ar(`remove-formatting`,[[`path`,{d:`M4 7V4h16v3`,key:`9msm58`}],[`path`,{d:`M5 20h6`,key:`1h6pxn`}],[`path`,{d:`M13 4 8 20`,key:`kqq6aj`}],[`path`,{d:`m15 15 5 5`,key:`me55sn`}],[`path`,{d:`m20 15-5 5`,key:`11p7ol`}]]),oa=Ar(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),sa=Ar(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),ca=Ar(`triangle-alert`,[[`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`}]]),la=I.createContext(void 0);function ua(){let e=I.useContext(la);if(!e)throw Error(Jr(73));return e}var da=0;function fa(e){return da+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${da}`}function pa(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}function ma(e){let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}function ha(e,t){let n=0;return e.map(e=>{if(e.transitionStatus===`ending`)return e;let r=n>=t;return n+=1,e.limited===r?e:{...e,limited:r}})}var ga={toasts:e=>e.toasts,isEmpty:e=>e.toasts.length===0,toast:(e,t)=>e.toastMetadata.get(t)?.value,toastIndex:(e,t)=>e.toastMetadata.get(t)?.domIndex??-1,toastOffsetY:(e,t)=>e.toastMetadata.get(t)?.offsetY??0,toastVisibleIndex:(e,t)=>e.toastMetadata.get(t)?.visibleIndex??-1,focused:e=>e.focused,expanded:e=>e.hovering||e.focused,expandedOrOutOfFocus:e=>e.hovering||e.focused||!e.isWindowFocused,prevFocusElement:e=>e.prevFocusElement},_a=class extends h{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:ma(e.toasts)},{},ga)}setViewport=e=>{this.set(`viewport`,e)};syncProviderProps(e,t){let n=this.state.limit!==t;if(this.state.timeout===e&&!n)return;let r={timeout:e,limit:t};if(n){let e=ha(this.state.toasts,t);r.toasts=e,r.toastMetadata=ma(e)}this.update(r)}disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,t=!1){let n=ga.toastIndex(this.state,e);if(n===-1)return;let r=this.state.toasts[n];t||r?.onRemove?.();let i=[...this.state.toasts];i.splice(n,1),this.setToasts(i)}addToast=e=>{let{timeout:t,limit:n}=this.state,r=e.id||fa(`toast`);if(e.id){let t=ga.toast(this.state,e.id);if(t)if(t.transitionStatus===`ending`)this.removeToast(e.id,!0);else{let{id:t,transitionStatus:n,...r}=e;return this.updateToastInternal(e.id,r,!0,!0),e.id}}let i={...e,id:r,updateKey:0,transitionStatus:`starting`},a=[i,...this.state.toasts];this.setToasts(ha(a,n));let o=i.timeout??t;return i.type!==`loading`&&o>0&&this.scheduleTimer(r,o,()=>this.closeToast(r)),ga.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,t)=>{this.updateToastInternal(e,t,!1,!0)};updateToastInternal=(e,t,n=!1,r=!1)=>{let{timeout:i,toasts:a}=this.state,o=ga.toast(this.state,e);if(!o||o.transitionStatus===`ending`)return;let s={...o,...t,...r&&{updateKey:o.updateKey+1}};this.setToasts(a.map(t=>t.id===e?s:t));let c=s.timeout??i,l=o.timeout??i,u=Object.hasOwn(t,`timeout`),d=s.transitionStatus!==`ending`&&s.type!==`loading`&&c>0,f=this.timers.has(e),p=l!==c,m=o.type===`loading`;if(!d&&f){this.clearTimer(e);return}d&&(!f||p||u||m||n)&&(this.clearTimer(e),this.scheduleTimer(e,c,()=>this.closeToast(e)),ga.expandedOrOutOfFocus(this.state)&&this.pauseTimers())};closeToast=e=>{let t=e===void 0,{limit:n,toasts:r}=this.state,i;if(t)i=r,this.clearTimers();else{let t=ga.toast(this.state,e);if(!t)return;i=[t],this.clearTimer(e)}let a=ha(r.map(n=>t||n.id===e?{...n,transitionStatus:`ending`,height:0}:n),n);this.setToasts(a,!a.some(e=>e.transitionStatus!==`ending`)),i.forEach(e=>{e.transitionStatus!==`ending`&&e.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,t)=>{let n=pa(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=pa(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=pa(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{e.timeout&&(e.timeout.clear(),e.remaining=Math.max(e.remaining-(Date.now()-e.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=E.create(),e.timeout.start(e.remaining,()=>{this.handleTimerFired(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=br(e);jr(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=ga.expandedOrOutOfFocus(this.state)?void 0:E.create();i?.start(t,()=>{this.handleTimerFired(e),n()}),this.timers.set(e,{timeout:i,start:r,delay:t,remaining:t,callback:n})}clearTimers(){this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(e){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(e){this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(e,t=e.length===0){let n={toasts:e,toastMetadata:ma(e)};t&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(e){let t=kr(w(this.state.viewport));if(!this.state.viewport||!jr(this.state.viewport,t)||!Re(t))return;if(e===void 0){this.restoreFocusToPrevElement();return}let n=ga.toasts(this.state),r=ga.toastIndex(this.state,e),i=(e,t)=>{for(let r=e;r>=0&&r<n.length;r+=t)if(n[r].transitionStatus!==`ending`)return n[r];return null},a=i(r+1,1)??i(r-1,-1);a?a.ref?.current?.focus():this.restoreFocusToPrevElement()}},L=r(),va=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=Vr(()=>new _a({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return l(a.disposeEffect),I.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`?a.closeToast(n):a.addToast(t)})},[a,i]),(0,L.jsxs)(la.Provider,{value:a,children:[(0,L.jsx)(ya,{store:a,timeout:n,limit:r}),t]})};function ya(e){let{store:t,timeout:n,limit:r}=e;return Kr(()=>{t.syncProviderProps(n,r)},[t,n,r]),null}var ba=I.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=ua(),c=Se(),l=I.useRef(!1),u=I.useRef(!1),d=I.useRef(!1),f=s.useState(`isEmpty`),p=s.useState(`toasts`),m=s.useState(`focused`),h=s.useState(`expanded`),g=s.useState(`prevFocusElement`),_=p[0]?.height,v=p.some(e=>e.transitionStatus===`ending`),y=p.filter(e=>e.priority===`high`);I.useEffect(()=>{let e=s.state.viewport;if(!e||f)return;let t=ri(e),n=w(e);function r(t){t.key===`F6`&&br(t)!==e&&(t.preventDefault(),s.set(`prevFocusElement`,kr(n)),e?.focus({preventScroll:!0}),s.pauseTimers(),s.set(`focused`,!0))}function i(e){br(e)===t&&(s.set(`isWindowFocused`,!1),s.pauseTimers())}function a(n){if(n.relatedTarget)return;let r=br(n),i=kr(w(e));(r===t||!jr(e,r)||!Re(i))&&s.resumeTimers(),c.start(0,()=>s.set(`isWindowFocused`,!0))}return O(S(t,`keydown`,r),S(t,`blur`,i,!0),S(t,`focus`,a,!0),S(n,`pointerdown`,s.handleDocumentPointerDown,!0))},[s,c,f]);function b(e){l.current=!0;let t=e.relatedTarget===s.state.viewport?p.find(e=>e.transitionStatus!==`ending`&&!e.limited):void 0;t?t.ref?.current?.focus():s.restoreFocusToPrevElement()}function x(e){e.key===`Tab`&&e.shiftKey&&br(e.nativeEvent)===s.state.viewport&&(e.preventDefault(),s.restoreFocusToPrevElement())}function C(){s.state.toasts.some(e=>e.transitionStatus===`ending`)||d.current||!u.current||(s.state.isWindowFocused&&s.resumeTimers(),s.set(`hovering`,!1),u.current=!1)}I.useEffect(C,[v,s]);function T(){s.pauseTimers(),s.set(`hovering`,!0),u.current=!1}function E(){s.state.isWindowFocused&&s.resumeTimers()}function D(){u.current=!0,C()}function k(e){e.pointerType===`touch`&&(d.current=!0)}function A(e){e.pointerType===`touch`&&(d.current=!1,C())}function j(){if(l.current){l.current=!1;return}m||Re(kr(w(s.state.viewport)))&&(s.set(`focused`,!0),s.pauseTimers())}function M(e){!m||jr(s.state.viewport,e.relatedTarget)||(s.set(`focused`,!1),E())}let N={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:T,onMouseMove:T,onMouseLeave:D,onFocus:j,onBlur:M,onKeyDown:x,onClick:j,onPointerDown:k,onPointerUp:A,onPointerCancel:A,style:{"--toast-frontmost-height":_?`${_}px`:void 0}},ee={expanded:h},P=!f&&g&&(0,L.jsx)(Ie,{onFocus:b}),F=Br(`div`,e,{ref:[t,s.setViewport],state:ee,props:[N,o,{children:(0,L.jsxs)(I.Fragment,{children:[P,a,P]})}]});return(0,L.jsxs)(I.Fragment,{children:[P,F,!m&&y.length>0&&(0,L.jsx)(`div`,{style:He,children:y.map(e=>(0,L.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,L.jsx)(`div`,{children:e.title}),(0,L.jsx)(`div`,{children:e.description})]},e.id))})]})}),xa=t(F(),1),Sa=I.createContext(void 0);function Ca(){let e=I.useContext(Sa);if(!e)throw Error(Jr(66));return e}function wa(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function Ta(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function Ea(e){let t=ri(e).getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var Da={...he,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Oa=40,ka=10,Aa=.5,ja=1,Ma=`${ue},${de}`,Na=I.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],style:o,...s}=e,c=n.positionerProps?.anchor!==void 0,l=[];c||(l=Array.isArray(a)?a:[a]);let u=l.length>0,d=ua(),[f,p]=I.useState(void 0),[m,h]=I.useState(!1),[g,_]=I.useState(!1),[v,y]=I.useState({x:0,y:0}),[b,x]=I.useState({x:0,y:0,scale:1}),[C,T]=I.useState(),[E,D]=I.useState(),[O,k]=I.useState(null),A=I.useRef(null),j=I.useRef(void 0),M=I.useRef({x:0,y:0}),N=I.useRef({x:0,y:0,scale:1}),ee=I.useRef(void 0),P=I.useRef(0),F=I.useRef(!1),te=I.useRef({x:0,y:0}),ne=I.useRef(!1),re=I.useRef({x:0,y:0}),ie=I.useRef(null),ae=I.useRef(null),oe=d.useState(`toastIndex`,n.id),ce=d.useState(`toastVisibleIndex`,n.id),le=d.useState(`toastOffsetY`,n.id),ue=d.useState(`focused`),de=d.useState(`expanded`);Oe({open:n.transitionStatus!==`ending`,ref:A,onComplete(){n.transitionStatus===`ending`&&d.removeToast(n.id)}});let fe=oi((e=!1)=>{let t=A.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){d.updateToastInternal(n.id,{ref:A,height:i,transitionStatus:void 0})}e?xa.flushSync(a):a()});Kr(()=>{let e=j.current;(n.transitionStatus===`starting`||e!==n.id)&&(e!==void 0&&(p(void 0),x({x:0,y:0,scale:1}),pe({x:0,y:0})),j.current=n.id,fe())},[fe,n.id,n.transitionStatus]);function pe(e){re.current=e,y(e)}Kr(()=>()=>{ae.current?.abort()},[]);function me(e,t){let n=e=>e>0?e**Aa:-(Math.abs(e)**Aa),r=e>0&&!l.includes(`right`)||e<0&&!l.includes(`left`),i=t>0&&!l.includes(`down`)||t<0&&!l.includes(`up`);return{x:r?n(e):e,y:i?n(t):t}}let he=oi(e=>{if(e.pointerId!==ie.current)return;ie.current=null,ae.current?.abort(),ae.current=null,h(!1),_(!1),k(null);let t=N.current;if(e.type===`pointercancel`||F.current){pe({x:t.x,y:t.y}),p(void 0);return}let r=re.current,i=r.x-t.x,a=r.y-t.y,o;for(let e of l)if(Ta(e,i,a)>Oa){o=e;break}o?(p(o),d.closeToast(n.id)):(pe({x:t.x,y:t.y}),p(void 0))});function ge(e){if(e.button!==0||(e.pointerType===`touch`&&d.pauseTimers(),br(e.nativeEvent)?.closest(`button,a,input,textarea,[role="button"],${Ma}`)))return;F.current=!1,ee.current=void 0,P.current=0,ie.current=e.pointerId,M.current={x:e.clientX,y:e.clientY},te.current=M.current;let t=e.currentTarget,n=Ea(t);N.current=n,x(n),pe({x:n.x,y:n.y}),d.set(`hovering`,!0),h(!0),_(!1),k(null),ne.current=!0,ae.current?.abort();let r=new AbortController;ae.current=r;let i=w(t);i.addEventListener(`pointerup`,he,{signal:r.signal}),i.addEventListener(`pointercancel`,he,{signal:r.signal}),t.setPointerCapture?.(e.pointerId)}function _e(e){if(e.pointerId!==ie.current)return;e.preventDefault(),ne.current&&=(M.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>te.current.y||i>0&&t<te.current.y)&&(te.current={x:te.current.x,y:t}),(r<0&&n>te.current.x||r>0&&n<te.current.x)&&(te.current={x:n,y:te.current.y});let a=n-M.current.x,o=t-M.current.y,s=t-te.current.y,c=n-te.current.x,u=O;if(!g&&Math.sqrt(a*a+o*o)>=ja){_(!0);let e=l.includes(`left`)||l.includes(`right`),t=l.includes(`up`)||l.includes(`down`);e&&t&&(u=Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`,k(u))}let d;if(!ee.current)u===`vertical`?o>0?d=`down`:o<0&&(d=`up`):u===`horizontal`?a>0?d=`right`:a<0&&(d=`left`):d=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,d&&l.includes(d)&&(ee.current=d,P.current=Ta(d,a,o),p(d));else{let e=ee.current,t=Ta(e,c,s);t>Oa?(F.current=!1,p(e)):!(l.includes(`left`)&&l.includes(`right`))&&!(l.includes(`up`)&&l.includes(`down`))&&P.current-t>=ka&&(F.current=!0)}let f=me(a,o),m=N.current.x,h=N.current.y,v=l.includes(`left`)||l.includes(`right`),y=l.includes(`up`)||l.includes(`down`);u!==`vertical`&&v&&(m+=f.x),u!==`horizontal`&&y&&(h+=f.y),pe({x:m,y:h})}function ve(e){if(e.key===`Escape`){if(!A.current||!jr(A.current,kr(w(A.current))))return;d.closeToast(n.id)}}I.useEffect(()=>{let e=A.current;if(!u||!e)return;function t(t){ie.current===null||!jr(e,br(t))||t.preventDefault()}return S(e,`touchmove`,t,{passive:!1})},[u]);function ye(){let e=v.x-b.x,t=v.y-b.y;return{transition:m?`none`:void 0,transform:m?`translateX(${v.x}px) translateY(${v.y}px) scale(${b.scale})`:void 0,"--toast-swipe-movement-x":`${e}px`,"--toast-swipe-movement-y":`${t}px`}}let be=n.priority===`high`,xe={role:be?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":C,"aria-describedby":E,"aria-hidden":be&&!ue?!0:void 0,onPointerDown:u?ge:void 0,onPointerMove:u?_e:void 0,onPointerUp:u?he:void 0,onPointerCancel:u?he:void 0,onKeyDown:ve,inert:se(n.limited),style:{...ye(),"--toast-index":n.transitionStatus===`ending`?oe:ce,"--toast-offset-y":`${le}px`,"--toast-height":n.height?`${n.height}px`:void 0}},Se=I.useMemo(()=>({toast:n,setTitleId:T,setDescriptionId:D,recalculateHeight:fe,visibleIndex:ce,expanded:de}),[n,T,D,fe,ce,de]),Ce={transitionStatus:n.transitionStatus,expanded:de,limited:n.limited||!1,type:n.type,swiping:m,swipeDirection:f},we=Br(`div`,e,{ref:[t,A],state:Ce,stateAttributesMapping:Da,props:[xe,s]});return(0,L.jsx)(Sa.Provider,{value:Se,children:we})}),Pa=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{visibleIndex:o,expanded:s,recalculateHeight:c}=Ca(),l=I.useRef(null);return Kr(()=>{c();let e=l.current;if(!e||typeof ResizeObserver!=`function`||typeof MutationObserver!=`function`)return;let t=new ResizeObserver(()=>c(!0)),n=new MutationObserver(()=>c(!0));return t.observe(e),n.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[c]),Br(`div`,e,{ref:[t,l],state:{expanded:s,behind:o>0},props:a})});function Fa(e){return e==null||typeof e==`boolean`||e===``?!1:!Array.isArray(e)||e.some(Fa)}function Ia(e){return I.isValidElement(e)&&Fa(e.props.children)}function La(e,t,n){let{toast:r,setTitleId:i,setDescriptionId:a}=Ca(),o=n===`title`?i:a,s=t??(n===`title`?r.title:r.description);return{id:Rr(e),children:s,type:r.type,setId:o}}function Ra(e,t,n){let r=Ia(e);return Kr(()=>{if(r)return n(t),()=>{n(e=>e===t?void 0:e)}},[r,t,n]),r?e:null}var za=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=La(a,o,`description`);return Ra(Br(`p`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),Ba=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=La(a,o,`title`);return Ra(Br(`h2`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),Va=I.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,c=ua(),{toast:l,expanded:u}=Ca(),[d,f]=I.useState(!1),{getButtonProps:p,buttonRef:m}=Cr({disabled:a,native:o}),h={type:l.type};return Br(`button`,e,{ref:[t,m],state:h,props:[{"aria-hidden":!u&&!d,onClick(){c.closeToast(l.id)},onFocus(){f(!0)},onBlur(){f(!1)}},s,p]})}),Ha=I.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,{toast:c}=Ca(),l=c.actionProps?.children??s.children,{getButtonProps:u,buttonRef:d}=Cr({disabled:a,native:o}),f={type:c.type},p=Br(`button`,e,{ref:[t,d],state:f,props:[s,c.actionProps,u,{children:l}]});return Ia(p)?p:null}),Ua=I.forwardRef(function(e,t){return(0,L.jsx)(De,{ref:t,...e})});function Wa(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Rr(),a=Ne()!=null,o=Vr(()=>new y({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new be,floatingId:i,syncOnly:!1,nested:a})).current;return Kr(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=Yr(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var Ga=`Escape`;function Ka(e){return p&&e.movementX===0&&e.movementY===0}function qa(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Ja(e,t){return qa(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Ya(e,t,n){return qa(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Xa(e,t,n){return qa(t,n?e===Er:e===Pr,e===Sr)}function Za(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Ga:qa(t,n?e===Pr:e===Er,e===yi)}function Qa(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:f=!1,focusItemOnOpen:p=`auto`,focusItemOnHover:m=!0,openOnArrowKeyDown:h=!0,disabledIndices:g=void 0,orientation:_=`vertical`,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:x,grid:S}=t,C=S!=null,T=`rootStore`in e?e.rootStore:e,E=T.useState(`open`),D=T.useState(`floatingElement`),O=T.useState(`domReferenceElement`),k=T.context.dataRef,A=Be(D),j=d(O),M=ce(A),N=Ne(),ee=Te(x),P=I.useRef(p),F=I.useRef(o??-1),te=I.useRef(null),ne=I.useRef(!0),re=oi(e=>{i(F.current===-1?null:F.current,e)}),ie=I.useRef(!!D),ae=I.useRef(E),oe=I.useRef(!1),se=I.useRef(!1),le=I.useRef(null),ue=ce(g),de=ce(E),fe=ce(o),pe=ce(b),me=xe(),he=xe(),ge=oi(()=>{function e(e){f?ee?.events.emit(`virtualfocus`,e):le.current=ye(e,{sync:oe.current,preventScroll:!0})}let t=n.current[F.current],r=se.current;t&&e(t),(oe.current?e=>e():e=>me.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),we&&(r||!ne.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Kr(()=>{k.current.orientation=_},[k,_]),Kr(()=>{a&&(E&&D?(F.current=o??-1,P.current&&o!=null&&(se.current=!0,re())):ie.current&&(F.current=-1,re()))},[a,E,D,o,re]),Kr(()=>{if(a){if(!E){oe.current=!1;return}if(D)if(r==null){if(oe.current=!1,fe.current!=null)return;if(ie.current&&(F.current=-1,ge()),(!ae.current||!ie.current)&&P.current&&(te.current!=null||P.current===!0&&te.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>he.request(e):queueMicrotask)(t),e+=1):(F.current=te.current==null||Ya(te.current,_,u)||l?Xr(n):li(n),te.current=null,re())};t()}}else ai(n.current,r)||(F.current=r,ge(),se.current=!1)}},[a,E,D,r,fe,l,n,_,u,re,ge,he]),Kr(()=>{if(!a||D||!ee||f||!ie.current)return;let e=ee.nodesRef.current,t=e.find(e=>e.id===N)?.context?.elements.floating,n=kr(w(O??t??null)),r=e.some(e=>e.context&&jr(e.context.elements.floating,n));t&&!r&&ne.current&&t.focus({preventScroll:!0})},[a,D,O,ee,N,f]),Kr(()=>{ae.current=E,ie.current=!!D}),Kr(()=>{E||(te.current=null,P.current=p)},[E,p]);let _e=r!=null,ve=oi(e=>{if(!de.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,re(e))}),be=oi(()=>v??ee?.nodesRef.current.find(e=>e.id===N)?.context?.dataRef?.current.orientation),Se=oi(()=>Xr(n,ue.current)),Ce=oi(e=>{if(ne.current=!1,oe.current=!0,e.which===229||!de.current&&e.currentTarget===M.current)return;if(l&&Za(e.key,_,u,C)){Ja(e.key,be())||Or(e),T.setOpen(!1,Fr(Tr,e.nativeEvent)),Hr(O)&&(f?ee?.events.emit(`virtualfocus`,O):O.focus());return}let t=F.current,r=Xr(n,g),i=li(n,g);if(j||(e.key===`Home`&&(Or(e),F.current=r,re(e)),e.key===`End`&&(Or(e),F.current=i,re(e))),S!=null){let t=S(e,F.current,n,_,c,u,g,r,i);if(t!=null&&(F.current=t,re(e)),_===`both`)return}if(Ja(e.key,_)){if(Or(e),E&&!f&&kr(e.currentTarget.ownerDocument)===e.currentTarget){F.current=Ya(e.key,_,u)?r:i,re(e);return}Ya(e.key,_,u)?c?t>=i?s&&t!==n.current.length?F.current=-1:(oe.current=!1,F.current=r):F.current=pi(n.current,{startingIndex:t,disabledIndices:g}):F.current=Math.min(i,pi(n.current,{startingIndex:t,disabledIndices:g})):c?t<=r?s&&t!==-1?F.current=n.current.length:(oe.current=!1,F.current=i):F.current=pi(n.current,{startingIndex:t,decrement:!0,disabledIndices:g}):F.current=Math.max(r,pi(n.current,{startingIndex:t,decrement:!0,disabledIndices:g})),ai(n.current,F.current)&&(F.current=-1),re(e)}}),we=I.useMemo(()=>({onFocus(e){oe.current=!0,ve(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Ka(e)||(oe.current=!0,se.current=!1,m&&ve(e))},onPointerLeave(e){if(!de.current||!ne.current||e.pointerType===`touch`)return;oe.current=!0;let t=e.relatedTarget;if(!(!m||n.current.includes(t))&&pe.current&&(le.current?.(),le.current=null,F.current=-1,re(e),!f)){let e=M.current,t=kr(w(e));e&&jr(e,t)&&e.focus({preventScroll:!0})}}}),[ve,de,M,m,n,re,pe,f]),Ee=I.useMemo(()=>f&&E&&_e&&{"aria-activedescendant":`${y}-${r}`},[f,E,_e,y,r]),De=I.useMemo(()=>({"aria-orientation":_===`both`?void 0:_,...j?{}:Ee,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&E&&!f){let t=br(e.nativeEvent);if(t&&!jr(M.current,t))return;Or(e),T.setOpen(!1,Fr(hr,e.nativeEvent)),Hr(O)&&O.focus();return}Ce(e)},onPointerMove(e){Ka(e)||(ne.current=!0)}}),[Ee,Ce,M,_,j,T,E,f,O]),Oe=I.useMemo(()=>{function e(e){T.setOpen(!0,Fr(Tr,e.nativeEvent,e.currentTarget))}function t(e){p===`auto`&&gr(e.nativeEvent)&&(P.current=!f)}function n(e){P.current=p,p===`auto`&&Qr(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(t){let n=T.select(`open`);ne.current=!1;let r=t.key.startsWith(`Arrow`),i=Xa(t.key,be(),u),a=Ja(t.key,_),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(f&&n)return Ce(t);if(!(!n&&!h&&r)){if(o){let e=Ja(t.key,be());te.current=l&&e?null:t.key}if(l){i&&(Or(t),n?(F.current=Se(),re(t)):e(t));return}a&&(fe.current!=null&&(F.current=fe.current),Or(t),!n&&h?e(t):Ce(t),n&&re(t))}},onFocus(e){T.select(`open`)&&!f&&(F.current=-1,re(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[Ce,p,Se,l,re,T,h,_,be,u,fe,f]),ke=I.useMemo(()=>({...Ee,...Oe}),[Ee,Oe]);return I.useMemo(()=>a?{reference:ke,floating:De,item:we,trigger:Oe}:{},[a,ke,De,Oe,we])}function $a(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=Se(),m=I.useRef(``),h=I.useRef(u??i??-1),g=I.useRef(null),_=oi(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!Ur(n)||n?.matches(`:disabled`)?!1:o==null||!ui(mi,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!c(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(Or(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(Or(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=oi(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);jr(n,t)||jr(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});Kr(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=I.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return I.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var eo=I.createContext(void 0);function to(){let e=I.useContext(eo);if(e===void 0)throw Error(Jr(84));return e}var no=I.forwardRef(function(e,t){let{toast:n,...r}=e,i=ua(),a=n.positionerProps??vi,{render:o,className:s,anchor:c=a.anchor,positionMethod:l=a.positionMethod??`absolute`,side:u=a.side??`top`,align:d=a.align??`center`,sideOffset:f=a.sideOffset??0,alignOffset:p=a.alignOffset??0,collisionBoundary:m=a.collisionBoundary??`clipping-ancestors`,collisionPadding:h=a.collisionPadding??5,arrowPadding:g=a.arrowPadding??5,sticky:_=a.sticky??!1,disableAnchorTracking:v=a.disableAnchorTracking??!1,collisionAvoidance:y=a.collisionAvoidance??pe,style:b,...x}=r,[S,C]=I.useState(null),w=i.useState(`toastIndex`,n.id),T=i.useState(`toastVisibleIndex`,n.id),E=Yr(c)?c:null,D=Wa({open:!0,onOpenChange:Wr,elements:{floating:S,reference:E}}),O=M({anchor:E,positionMethod:l,floatingRootContext:D,mounted:!0,side:u,sideOffset:f,align:d,alignOffset:p,collisionBoundary:m,collisionPadding:h,sticky:_,arrowPadding:g,disableAnchorTracking:v,keepMounted:!0,collisionAvoidance:y}),k={side:O.side,align:O.align,anchorHidden:O.anchorHidden},A=me(e,k,{styles:{...O.positionerStyles,"--toast-index":n.transitionStatus===`ending`?w:T},transitionStatus:n.transitionStatus,props:x,refs:[t,C]});return(0,L.jsx)(eo.Provider,{value:O,children:A})}),ro=I.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{arrowRef:o,side:s,align:c,arrowUncentered:l,arrowStyles:u}=to();return Br(`div`,e,{state:{side:s,align:c,uncentered:l},ref:[t,o],props:[{style:u,"aria-hidden":!0},a]})});function io(){let e=ua(),t=e.useState(`toasts`);return I.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function ao(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||fa(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var oo=e({Action:()=>Ha,Arrow:()=>ro,Close:()=>Va,Content:()=>Pa,Description:()=>za,Portal:()=>Ua,Positioner:()=>no,Provider:()=>va,Root:()=>Na,Title:()=>Ba,Viewport:()=>ba,createToastManager:()=>ao,useToastManager:()=>io});function so(e){return Br(e.defaultTagName??`div`,e,e)}var R=a(),co=`inline-flex size-touch shrink-0 touch-manipulation items-center justify-center rounded-lg leading-none sm:size-touch md:size-7 md:rounded-md`,lo=`min-h-touch min-w-touch touch-manipulation sm:min-h-touch sm:min-w-touch`,uo=`size-touch shrink-0 touch-manipulation rounded-lg sm:size-touch md:size-5 md:rounded-md`,fo=`min-h-touch touch-manipulation sm:min-h-touch md:min-h-0`,po=`pointer-coarse:after:absolute pointer-coarse:after:top-1/2 pointer-coarse:after:left-1/2 pointer-coarse:after:size-full pointer-coarse:after:min-h-touch pointer-coarse:after:min-w-touch pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2`,mo=`relative ${po}`,ho=`text-no-zoom md:text-sm`,go=Dr(`[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[var(--control-radius)] border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--control-radius)-1px)] ${po} focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-9 px-[calc(--spacing(3)-1px)] sm:h-8`,icon:`size-9 sm:size-8`,"icon-lg":`size-10 sm:size-9`,"icon-sm":`size-8 sm:size-7`,"icon-xl":`size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,"icon-xs":`size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5`,lg:`h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9`,sm:`h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7`,xl:`h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,xs:`h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5`},variant:{default:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-primary/90`,destructive:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-destructive/90`,"destructive-outline":`border-input bg-popover not-dark:bg-clip-padding text-destructive-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive-border [:hover,[data-pressed]]:bg-destructive-surface`,ghost:`border-transparent text-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent`,link:`border-transparent underline-offset-4 [:hover,[data-pressed]]:underline`,outline:`border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64`,secondary:`border-transparent bg-secondary text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 [:hover,[data-pressed]]:bg-secondary/90`,white:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/32%)] border-white/60 bg-white text-neutral-950 shadow-white/10 shadow-xs [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-neutral-100 [:hover,[data-pressed]]:text-neutral-950`}}});function _o(e){let t=(0,R.c)(18),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,variant:o,size:a,render:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i?void 0:`button`,c,l,u;if(t[6]!==n||t[7]!==r||t[8]!==a||t[9]!==s||t[10]!==o){let e={className:_i(go({className:n,size:a,variant:o})),"data-slot":`button`,type:s};u=so,c=`button`,l=Mr(e,r),t[6]=n,t[7]=r,t[8]=a,t[9]=s,t[10]=o,t[11]=c,t[12]=l,t[13]=u}else c=t[11],l=t[12],u=t[13];let d;return t[14]!==i||t[15]!==c||t[16]!==l?(d={defaultTagName:c,props:l,render:i},t[14]=i,t[15]=c,t[16]=l,t[17]=d):d=t[17],u(d)}function vo({timeout:e=2e3,onCopy:t,onError:n}={}){let[r,i]=I.useState(!1),a=I.useRef(null),o=I.useRef(t),s=I.useRef(n),c=I.useRef(e);o.current=t,s.current=n,c.current=e;let l=I.useCallback((e,t)=>{if(typeof window>`u`||!navigator.clipboard?.writeText){s.current?.(Error(`Clipboard API unavailable.`),t);return}e&&navigator.clipboard.writeText(e).then(()=>{a.current&&clearTimeout(a.current),i(!0),o.current?.(t),c.current!==0&&(a.current=setTimeout(()=>{i(!1),a.current=null},c.current))},e=>{s.current?s.current(e,t):console.error(e)})},[]);return I.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),{copyToClipboard:l,isCopied:r}}function yo(e,t){return t<=1?!1:e>0}function bo(e){let t=0;return{frontmostHeight:xo(e[0]?.height),items:e.map((e,n)=>{let r={toast:e,visibleIndex:n,offsetY:t};return t+=xo(e.height),r})}}function xo(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function So(e,t){if(e?.threadRef)return t!==null&&e.threadRef.environmentId===t.environmentId&&e.threadRef.threadId===t.threadId;let n=e?.threadId;return!n||t?.threadId===n}function Co(e){return e.position.includes(`center`)?[e.isTop?`up`:`down`]:e.position.includes(`left`)?[`left`,e.isTop?`up`:`down`]:[`right`,e.isTop?`up`:`down`]}function wo(e){return e.type===`error`&&typeof e.description==`string`&&!e.hideCopyButton}function To(e){return e.hasAnchor}function Eo(e){return e.tooltipStyle?`tooltip`:`card`}var Do=ao(),Oo=ao(),ko=new Map,Ao={error:zi,info:Gi,loading:Zi,success:Bi,warning:ca};function jo(e){let t=(0,R.c)(8),{text:n}=e,{copyToClipboard:r,isCopied:i}=vo(),a;t[0]!==r||t[1]!==n?(a=()=>r(n),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=i?(0,L.jsx)(Ri,{className:`size-3.5 text-success`}):(0,L.jsx)(Ui,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,L.jsx)(`button`,{className:`shrink-0 cursor-pointer rounded-md p-1 text-muted-foreground opacity-60 transition-opacity hover:opacity-100`,onClick:a,title:`Copy error`,type:`button`,children:o}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Mo(){let e=(0,R.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:No},e[0]=t):t=e[0];let n=nr(t),r;e[1]===n?r=e[2]:(r=e=>n?.kind===`draft`?e.getDraftSession(n.draftId):null,e[1]=n,e[2]=r);let i=$e(r),a;bb0:{if(n?.kind===`server`){a=n.threadRef;break bb0}if(n?.kind===`draft`&&i){let t;e[3]!==i.environmentId||e[4]!==i.threadId?(t={environmentId:i.environmentId,threadId:i.threadId},e[3]=i.environmentId,e[4]=i.threadId,e[5]=t):t=e[5],a=t;break bb0}a=null}return a}function No(e){return tr(e)}function Po(e){let t=(0,R.c)(4),{toastId:n,dismissAfterVisibleMs:r}=e,i,a;return t[0]!==r||t[1]!==n?(i=()=>{if(!r||r<=0||typeof window>`u`||typeof document>`u`)return;let e;e=ko.get(n)??r;let t=null,i=null,a=!1,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{a||(a=!0,ko.delete(n),Do.close(n))},c=()=>{t!==null&&(e=Math.max(0,e-(Date.now()-t)),t=null,o(),ko.set(n,e))},l=()=>{if(!(a||t!==null)){if(e<=0){s();return}t=Date.now(),o(),i=window.setTimeout(()=>{e=0,t=null,s()},e)}},u=()=>{if(document.visibilityState===`visible`&&document.hasFocus()){l();return}c()};return u(),document.addEventListener(`visibilitychange`,u),window.addEventListener(`focus`,u),window.addEventListener(`blur`,u),()=>{document.removeEventListener(`visibilitychange`,u),window.removeEventListener(`focus`,u),window.removeEventListener(`blur`,u),c(),o()}},a=[r,n],t[0]=r,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,I.useEffect)(i,a),null}function Fo(e){let t=(0,R.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,position:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`top-right`:i,o;t[4]===a?o=t[5]:(o=(0,L.jsx)(Io,{position:a}),t[4]=a,t[5]=o);let s;return t[6]!==n||t[7]!==r||t[8]!==o?(s=(0,L.jsxs)(va,{toastManager:Do,...r,children:[n,o]}),t[6]=n,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Io(e){let t=(0,R.c)(17),{position:n}=e,r=n===void 0?`top-right`:n,{toasts:i}=io(),a=Mo(),o=r.startsWith(`top`),s;t[0]===a?s=t[1]:(s=e=>So(e.data,a),t[0]=a,t[1]=s);let c=bo(i.filter(s)),l,u;t[2]===i?(l=t[3],u=t[4]):(l=()=>{let e=new Set(i.map(Lo));for(let t of ko.keys())e.has(t)||ko.delete(t)},u=[i],t[2]=i,t[3]=l,t[4]=u),(0,I.useEffect)(l,u);let d=oo,f=oo,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=_i(`fixed z-100 mx-auto flex w-[calc(100%-var(--toast-inset)*2)] max-w-90 [--toast-header-offset:52px] [--toast-inset:--spacing(4)] sm:[--toast-inset:--spacing(8)]`,`data-[position*=top]:top-[calc(var(--toast-inset)+var(--toast-header-offset))]`,`data-[position*=bottom]:bottom-(--toast-inset)`,`data-[position*=left]:left-(--toast-inset)`,`data-[position*=right]:right-(--toast-inset)`,`data-[position*=center]:-translate-x-1/2 data-[position*=center]:left-1/2`),t[5]=p):p=t[5];let m=`${c.frontmostHeight}px`,h;t[6]===m?h=t[7]:(h={"--toast-frontmost-height":m},t[6]=m,t[7]=h);let g=h,_=c.items.map(e=>{let{toast:t,visibleIndex:n,offsetY:i}=e,a=t.type?Ao[t.type]:null,s=yo(n,c.items.length);return(0,L.jsxs)(Na,{className:_i(`dropdown-glass absolute z-[calc(9999-var(--toast-index))] h-(--toast-calc-height) w-full select-none rounded-lg text-popover-foreground shadow-xl shadow-black/25 [transition:transform_.5s_cubic-bezier(.22,1,.36,1),opacity_.5s,height_.15s]`,`data-[position*=right]:right-0 data-[position*=right]:left-auto`,`data-[position*=left]:right-auto data-[position*=left]:left-0`,`data-[position*=center]:right-0 data-[position*=center]:left-0`,`data-[position*=top]:top-0 data-[position*=top]:bottom-auto data-[position*=top]:origin-top`,`data-[position*=bottom]:top-auto data-[position*=bottom]:bottom-0 data-[position*=bottom]:origin-bottom`,`after:absolute after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full`,`data-[position*=top]:after:top-full`,`data-[position*=bottom]:after:bottom-full`,`[--toast-calc-height:max(var(--toast-frontmost-height,var(--toast-height)),var(--toast-height))] [--toast-gap:--spacing(3)] [--toast-peek:--spacing(3)] [--toast-scale:calc(max(0,1-(var(--toast-index)*.1)))] [--toast-shrink:calc(1-var(--toast-scale))]`,`data-[position*=top]:[--toast-calc-offset-y:calc(var(--toast-offset-y)+var(--toast-index)*var(--toast-gap)+var(--toast-swipe-movement-y))]`,`data-[position*=bottom]:[--toast-calc-offset-y:calc(var(--toast-offset-y)*-1+var(--toast-index)*var(--toast-gap)*-1+var(--toast-swipe-movement-y))]`,`data-[position*=top]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--toast-peek))+(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]`,`data-[position*=bottom]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--toast-peek))-(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]`,`data-limited:opacity-0`,`data-expanded:h-(--toast-height)`,`data-position:data-expanded:transform-[translateX(var(--toast-swipe-movement-x))_translateY(var(--toast-calc-offset-y))]`,`data-[position*=top]:data-starting-style:transform-[translateY(calc(-100%-var(--toast-inset)))]`,`data-[position*=bottom]:data-starting-style:transform-[translateY(calc(100%+var(--toast-inset)))]`,`data-[position*=top]:data-[position*=right]:data-starting-style:transform-[translateX(calc(100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:opacity-0`,`data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateY(calc(100%+var(--toast-inset)))]`,`data-[position*=top]:data-[position*=right]:data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateX(calc(100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]`,`data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]`,`data-expanded:data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]`,`data-expanded:data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]`),"data-position":r,style:{"--toast-index":n,"--toast-offset-y":`${i}px`},swipeDirection:Co({position:r,isTop:o}),toast:t,children:[(0,L.jsx)(Po,{dismissAfterVisibleMs:t.data?.dismissAfterVisibleMs,toastId:t.id}),(0,L.jsxs)(Pa,{className:_i(`pointer-events-auto flex items-center justify-between gap-1.5 overflow-hidden px-3.5 py-3 text-sm transition-opacity duration-250 data-expanded:opacity-100`,s&&`not-data-expanded:pointer-events-none not-data-expanded:opacity-0`),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-2`,children:[a&&(0,L.jsx)(`div`,{className:`[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,"data-slot":`toast-icon`,children:(0,L.jsx)(a,{className:`in-data-[type=loading]:animate-spin in-data-[type=error]:text-destructive in-data-[type=info]:text-info in-data-[type=success]:text-success in-data-[type=warning]:text-warning in-data-[type=loading]:opacity-80`})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-1`,children:[(0,L.jsx)(Ba,{className:`min-w-0 wrap-break-word font-medium`,"data-slot":`toast-title`}),wo({type:t.type,description:t.description,hideCopyButton:t.data?.hideCopyButton})&&(0,L.jsx)(jo,{text:t.description})]}),(0,L.jsx)(za,{className:`min-w-0 select-text wrap-break-word text-muted-foreground`,"data-slot":`toast-description`})]})]}),t.actionProps&&(0,L.jsx)(Ha,{className:_i(go({size:`xs`}),`shrink-0`),"data-slot":`toast-action`,children:t.actionProps.children})]})]},t.id)}),v;t[8]!==r||t[9]!==g||t[10]!==_||t[11]!==f.Viewport||t[12]!==p?(v=(0,L.jsx)(f.Viewport,{className:p,"data-position":r,"data-slot":`toast-viewport`,style:g,children:_}),t[8]=r,t[9]=g,t[10]=_,t[11]=f.Viewport,t[12]=p,t[13]=v):v=t[13];let y;return t[14]!==v||t[15]!==d.Portal?(y=(0,L.jsx)(d.Portal,{"data-slot":`toast-portal`,children:v}),t[14]=v,t[15]=d.Portal,t[16]=y):y=t[16],y}function Lo(e){return e.id}function Ro(e){let t=(0,R.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,L.jsx)(zo,{}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,L.jsxs)(va,{toastManager:Oo,...r,children:[n,i]}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function zo(){let e=(0,R.c)(7),{toasts:t}=io(),n=Mo(),r;if(e[0]!==n||e[1]!==t){let i;e[3]===n?i=e[4]:(i=e=>So(e.data,n),e[3]=n,e[4]=i),r=t.filter(i).map(Bo),e[0]=n,e[1]=t,e[2]=r}else r=e[2];let i;return e[5]===r?i=e[6]:(i=(0,L.jsx)(Ua,{"data-slot":`toast-portal-anchored`,children:(0,L.jsx)(ba,{className:`outline-none`,"data-slot":`toast-viewport-anchored`,children:r})}),e[5]=r,e[6]=i),i}function Bo(e){let t=e.type?Ao[e.type]:null,n=Eo({tooltipStyle:e.data?.tooltipStyle})===`tooltip`,r=e.positionerProps;return!To({hasAnchor:!!r?.anchor})||!r?null:(0,L.jsx)(no,{className:`z-100 max-w-[min(--spacing(64),var(--available-width))]`,"data-slot":`toast-positioner`,sideOffset:r.sideOffset??4,toast:e,children:(0,L.jsx)(Na,{className:_i(`dropdown-glass relative text-balance text-popover-foreground text-xs shadow-xl shadow-black/25 transition-[scale,opacity] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,n?`rounded-md`:`rounded-lg`),"data-slot":`toast-popup`,toast:e,children:n?(0,L.jsx)(Pa,{className:`pointer-events-auto px-2 py-1`,children:(0,L.jsx)(Ba,{"data-slot":`toast-title`})}):(0,L.jsxs)(Pa,{className:`pointer-events-auto flex items-center justify-between gap-1.5 overflow-hidden px-3.5 py-3 text-sm`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-2`,children:[t&&(0,L.jsx)(`div`,{className:`[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,"data-slot":`toast-icon`,children:(0,L.jsx)(t,{className:`in-data-[type=loading]:animate-spin in-data-[type=error]:text-destructive in-data-[type=info]:text-info in-data-[type=success]:text-success in-data-[type=warning]:text-warning in-data-[type=loading]:opacity-80`})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(Ba,{className:`min-w-0 wrap-break-word font-medium`,"data-slot":`toast-title`}),wo({type:e.type,description:e.description,hideCopyButton:e.data?.hideCopyButton})&&(0,L.jsx)(jo,{text:e.description})]}),(0,L.jsx)(za,{className:`min-w-0 select-text wrap-break-word text-muted-foreground`,"data-slot":`toast-description`})]})]}),e.actionProps&&(0,L.jsx)(Ha,{className:_i(go({size:`xs`}),`shrink-0`),"data-slot":`toast-action`,children:e.actionProps.children})]})})},e.id)}var Vo=I.createContext(void 0);function Ho(){let e=I.useContext(Vo);if(e===void 0)throw Error(Jr(53));return e}function Uo(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var Wo=`base-ui-disable-scrollbar`,Go={className:Wo,getElement(e){return(0,L.jsx)(`style`,{nonce:e,href:Wo,precedence:`base-ui:low`,children:`.${Wo}{scrollbar-width:none}.${Wo}::-webkit-scrollbar{display:none}`})}},Ko=e=>t=>t?{[e]:``}:null,qo={hasOverflowX:Ko(`data-has-overflow-x`),hasOverflowY:Ko(`data-has-overflow-y`),overflowXStart:Ko(`data-overflow-x-start`),overflowXEnd:Ko(`data-overflow-x-end`),overflowYStart:Ko(`data-overflow-y-start`),overflowYEnd:Ko(`data-overflow-y-end`),cornerHidden:()=>null},Jo=I.createContext(void 0),Yo={disableStyleElements:!1};function Xo(){return I.useContext(Jo)??Yo}var Zo={x:0,y:0},Qo={width:0,height:0},$o={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},es={x:!0,y:!0,corner:!0},ts=I.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=ns(i),d=qr(),f=Se(),p=Se(),{nonce:m,disableStyleElements:h}=Xo(),[g,_]=I.useState(!1),[v,y]=I.useState(!1),[b,x]=I.useState(!1),[S,C]=I.useState(!1),[w,T]=I.useState(!1),[E,D]=I.useState(Qo),[O,k]=I.useState(Qo),[A,j]=I.useState($o),[M,N]=I.useState(es),ee=I.useRef(null),P=I.useRef(null),F=I.useRef(null),te=I.useRef(null),ne=I.useRef(null),re=I.useRef(null),ie=I.useRef(null),ae=I.useRef(null),oe=I.useRef(0),se=I.useRef(0),ce=I.useRef(0),le=I.useRef(0),ue=I.useRef(`vertical`),de=I.useRef(Zo),fe=I.useRef(null);function pe(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let me=oi(e=>{let t=e.x-de.current.x,n=e.y-de.current.y;de.current=e,n!==0&&pe(!0),t!==0&&pe(!1)}),he=oi(()=>{let e=P.current;e&&fe.current===null&&(fe.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),ge=oi(e=>{if(e.button!==0||ae.current!==null&&(ue.current===`vertical`?ne.current:re.current)?.hasPointerCapture(ae.current))return;ae.current=e.pointerId,oe.current=e.clientY,se.current=e.clientX,ue.current=e.currentTarget.getAttribute(`data-orientation`);let t=P.current;t&&(ce.current=t.scrollTop,le.current=t.scrollLeft,he()),(ue.current===`vertical`?ne.current:re.current)?.setPointerCapture(e.pointerId)}),_e=oi(e=>{if(e.pointerId!==ae.current)return;ae.current=null,(ue.current===`vertical`?x:y)(!1),fe.current!==null&&(P.current&&(P.current.style.scrollSnapType=fe.current),fe.current=null);let t=ue.current===`vertical`?ne.current:re.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),ve=oi(e=>{if(e.pointerId!==ae.current)return;if(e.buttons%2==0){_e(e);return}let t=P.current;if(!t)return;let n=ue.current===`vertical`,r=n?ne.current:re.current,i=n?F.current:te.current;if(!r||!i)return;let a=n?`y`:`x`,o=Uo(i,`padding`,a),s=Uo(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-oe.current:e.clientX-se.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?ce.current:le.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),pe(n)});function ye(e){C(e.pointerType===`touch`)}function be(e){if(ye(e),e.pointerType!==`touch`){let t=jr(ee.current,e.target);_(t)}}let xe=I.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),Ce={role:`presentation`,onPointerEnter:be,onPointerMove:be,onPointerDown:ye,onPointerLeave(){_(!1)},style:{position:`relative`,"--scroll-area-corner-height":`${E.height}px`,"--scroll-area-corner-width":`${E.width}px`}},we=Br(`div`,e,{state:xe,ref:[t,ee],props:[Ce,o],stateAttributesMapping:qo}),Te=I.useMemo(()=>({handlePointerDown:ge,handlePointerMove:ve,handlePointerUp:_e,handleScroll:me,disableViewportSnap:he,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:ie,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:P,scrollbarYRef:F,scrollbarXRef:te,thumbYRef:ne,thumbXRef:re,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:xe,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[ge,ve,_e,me,he,E,O,w,S,v,b,g,d,M,A,xe,s,c,l,u]);return(0,L.jsxs)(Vo.Provider,{value:Te,children:[!h&&Go.getElement(m),we]})});function ns(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var rs=I.createContext(void 0);function is(e,t){return Math.max(0,e-t)}function as(e,t){if(t<=0)return 0;let n=wa(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var os=[`--scroll-area-overflow-x-start`,`--scroll-area-overflow-x-end`,`--scroll-area-overflow-y-start`,`--scroll-area-overflow-y-end`],ss=!1;function cs(){ss||p||(typeof CSS<`u`&&`registerProperty`in CSS&&os.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),ss=!0)}var ls=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=Ho(),T=gi(),E=I.useRef(!0),D=I.useRef([NaN,NaN,NaN,NaN]),O=Se(),k=Se(),A=oi(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=us(e),A=k.y,j=k.x,M=b/_,N=y/h,ee=Math.max(0,_-b),P=Math.max(0,h-y),F=0,te=0;j||(F=as(T===`rtl`?-w:w,ee),te=ee-F);let ne=A?0:as(x,P),re=A?0:P-ne,ie=j?0:b,ae=A?0:y,oe=0,se=0;!j&&!A&&(oe=t?.offsetWidth||0,se=n?.offsetHeight||0);let ce=f.width===0&&f.height===0,le=ce?oe:0,ue=ce?se:0,de=Uo(n,`padding`,`x`),fe=Uo(t,`padding`,`y`),pe=Uo(i,`margin`,`x`),me=Uo(r,`margin`,`y`),he=ie-de-pe,ge=ae-fe-me,_e=n?Math.min(n.offsetWidth-le,he):he,ve=t?Math.min(t.offsetHeight-ue,ge):ge,ye=Math.max(16,_e*M),be=Math.max(16,ve*N);if(m(e=>ds(e,{width:ye,height:be})),t&&r){let e=fs(r,`--scroll-area-thumb-height`,x,P,h,be,t.offsetHeight-be-fe-me);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-ye-de-pe,t=fs(i,`--scroll-area-thumb-width`,T===`rtl`?-w:w,ee,_,ye,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let xe=[F,te,ne,re];os.forEach((t,n)=>{e.style.setProperty(t,`${xe[n]}px`)}),a&&p(e=>ds(e,{width:oe,height:se})),g(e=>ds(e,k));let Se={xStart:!j&&F>C.xStart,xEnd:!j&&te>C.xEnd,yStart:!A&&ne>C.yStart,yEnd:!A&&re>C.yEnd};S(e=>ds(e,Se))});Kr(()=>{cs()},[]),Kr(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),Kr(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),Kr(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished)).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={role:`presentation`,...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:Go.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=Br(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:qo}),ee=I.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,L.jsx)(rs.Provider,{value:ee,children:N})});function us(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function ds(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function fs(e,t,n,r,i,a,o){let s=wa(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var ps=I.createContext(void 0);function ms(){let e=I.useContext(ps);if(e===void 0)throw Error(Jr(54));return e}var hs=I.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:C,hasMeasuredScrollbar:w,viewportState:T}=Ho(),E=i===`vertical`,D={...T,hovering:c,scrolling:E?u:l,orientation:i},O=gi(),k=!w&&!a,A=E?d.y:d.x,j=a||!A;I.useEffect(()=>{if(!j)return;let e=m.current,t=E?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!E,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&O===`rtl`?-a:0,s=n&&O===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return S(t,`wheel`,n,{passive:!1})},[O,y,E,p,f,j,m]);let M={...x&&{"data-id":`${x}-scrollbar`},onPointerDown(e){if(e.button!==0)return;let t=br(e.nativeEvent),n=E?h.current:g.current;if(n&&jr(n,t))return;let r=m.current;if(!r)return;let i=E?f.current:p.current;if(!n||!i)return;let a=E?`y`:`x`,o=Uo(n,`margin`,a),s=Uo(i,`padding`,a),c=E?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=E?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=E?r.scrollHeight:r.scrollWidth,v=E?r.clientHeight:r.clientWidth,x=(E?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),E?r.scrollTop=S*C:r.scrollLeft=O===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:k?`hidden`:void 0,...E?{top:0,bottom:`var(--scroll-area-corner-height)`,insetInlineEnd:0,"--scroll-area-thumb-height":`${C.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(--scroll-area-corner-width)`,bottom:0,"--scroll-area-thumb-width":`${C.width}px`}}},N=Br(`div`,e,{ref:[t,E?f:p],state:D,props:[M,s],stateAttributesMapping:qo});return j?(0,L.jsx)(ps.Provider,{value:i,children:N}):null}),gs=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=Ho(),m=ms(),h=m===`vertical`;return Br(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),_s=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=Ho(),l=Br(`div`,e,{ref:[t,o],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},a]});return c.corner?null:l});function vs(e){let t=(0,R.c)(23),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,children:n,scrollFade:a,scrollbarGutter:o,hideScrollbars:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a!==void 0&&a,l=o!==void 0&&o,u=s!==void 0&&s,d;t[7]===r?d=t[8]:(d=_i(`size-full min-h-0`,r),t[7]=r,t[8]=d);let f=c&&`mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]`,p=l&&`data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5`,m=u&&`[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,h;t[9]!==f||t[10]!==p||t[11]!==m?(h=_i(`h-full overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain`,f,p,m),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==n||t[14]!==h?(g=(0,L.jsx)(ls,{className:h,"data-slot":`scroll-area-viewport`,children:n}),t[13]=n,t[14]=h,t[15]=g):g=t[15];let _;t[16]===u?_=t[17]:(_=!u&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ys,{orientation:`vertical`}),(0,L.jsx)(ys,{orientation:`horizontal`}),(0,L.jsx)(_s,{"data-slot":`scroll-area-corner`})]}),t[16]=u,t[17]=_);let v;return t[18]!==i||t[19]!==_||t[20]!==d||t[21]!==g?(v=(0,L.jsxs)(ts,{className:d,...i,children:[g,_]}),t[18]=i,t[19]=_,t[20]=d,t[21]=g,t[22]=v):v=t[22],v}function ys(e){let t=(0,R.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]===n?o=t[5]:(o=_i(`m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(gs,{className:`relative flex-1 rounded-full bg-foreground/20`,"data-slot":`scroll-area-thumb`}),t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==r||t[9]!==o?(c=(0,L.jsx)(hs,{className:o,"data-slot":`scroll-area-scrollbar`,orientation:a,...r,children:s}),t[7]=a,t[8]=r,t[9]=o,t[10]=c):c=t[10],c}function bs(){return[{id:`cloud`,enabled:!0},{id:`desktop-local`,enabled:!0}]}function xs(e,t){let n=t.find(t=>t.id===e);return n?.enabled?n.id:`cloud`}function Ss(e){let t=e.capabilities??bs();return{requestedDefault:e.requestedDefault,effectiveDefault:xs(e.requestedDefault,t),capabilities:t}}function Cs(e){return _i(e.isActive?`bg-sidebar-row-active text-sidebar-foreground`:e.isSelected?`bg-sidebar-row-selected text-sidebar-foreground`:e.shouldRecede?`text-sidebar-muted-foreground/75 hover:bg-sidebar-row-hover hover:text-sidebar-foreground`:`bg-transparent text-sidebar-foreground hover:bg-sidebar-row-hover`)}function ws(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Ts(e){if(e.latestUserMessageAt)return ws(e.latestUserMessageAt)??-1/0;let t=null;for(let n of e.messages??[]){if(n.role!==`user`)continue;let e=ws(n.createdAt);e!==null&&(t=t===null?e:Math.max(t,e))}return t===null?ws(e.updatedAt??e.createdAt)??-1/0:t}function Es(e,t){return t===`created_at`?ws(e.createdAt)??-1/0:Ts(e)}function Ds(e,t){return e.toSorted((e,n)=>{let r=Es(n,t),i=Es(e,t),a=r===i?0:r>i?1:-1;return a===0?n.id.localeCompare(e.id):a})}function Os(e,t,n){return Ds(e.filter(e=>e.projectId===t&&e.archivedAt===null),n)[0]??null}function ks(e){return typeof e==`string`&&e.trim().length>0}function As(e){return e?.status===`running`&&ks(e.activeTurnId)}function js(e){return e?e.status===`connecting`||e.status===`running`&&!ks(e.activeTurnId):!1}function Ms(e){return e?.status===`error`}var Ns=`[data-thread-item], [data-thread-selection-safe]`,Ps=10,Fs={Failed:8,Conflicted:7,Stuck:6,"Pending Approval":5,"Awaiting Input":4,Working:3,Connecting:3,"Plan Ready":2,"Needs Review":2,Interrupted:2,Completed:1};function Is(e){let t=e.setTimeoutFn??globalThis.setTimeout,n=e.clearTimeoutFn??globalThis.clearTimeout,r=!1,i=null,a=()=>{i!==null&&(n(i),i=null)};return{sync:n=>{if(!n){a(),r&&(r=!1,e.onVisibilityChange(!1));return}r||i!==null||(i=t(()=>{i=null,r=!0,e.onVisibilityChange(!0)},e.delayMs))},dispose:()=>{a()}}}function Ls(){let e=(0,R.c)(5),[t,n]=I.useState(!1),r=I.useRef(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Is({delayMs:100,onVisibilityChange:e=>{n(e)},setTimeoutFn:window.setTimeout.bind(window),clearTimeoutFn:window.clearTimeout.bind(window)});return r.current=e,()=>{e.dispose(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),I.useEffect(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{r.current?.sync(e)},e[2]=o):o=e[2];let s=o,c;return e[3]===t?c=e[4]:(c={showThreadJumpHints:t,updateThreadJumpHintsVisibility:s},e[3]=t,e[4]=c),c}function Rs(e){if(!e.latestTurn?.completedAt)return!1;let t=Date.parse(e.latestTurn.completedAt);if(Number.isNaN(t))return!1;if(!e.lastVisitedAt)return!0;let n=Date.parse(e.lastVisitedAt);return Number.isNaN(n)?!0:t>n}function zs(e){return e===null||!e.closest(Ns)}function Bs(e){let{getId:t,items:n,preferredIds:r}=e;if(r.length===0)return[...n];let i=new Map(n.map(e=>[t(e),e])),a=new Set(r),o=new Set,s=r.flatMap(e=>{if(o.has(e))return[];let t=i.get(e);return t?(o.add(e),[t]):[]}),c=n.filter(e=>!a.has(t(e)));return[...s,...c]}function Vs(e,t=Ps){return e.slice(0,Math.max(0,t))}function Hs(e){let{currentThreadId:t,direction:n,threadIds:r}=e;if(r.length===0)return null;if(t===null)return n===`previous`?r.at(-1)??null:r[0]??null;let i=r.indexOf(t);return i===-1?null:n===`previous`?i>0?r[i-1]??null:null:i<r.length-1?r[i+1]??null:null}function Us(e){return _i(`h-7 w-full translate-x-0 cursor-pointer justify-start px-2 text-left select-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,Cs(e))}function Ws(e){let{thread:t}=e;return Ms(t.session)||t.latestTurn?.state===`error`?{label:`Failed`,colorClass:`text-destructive-foreground`,dotClass:`bg-destructive dark:bg-destructive/90`,pulse:!1}:t.status===`conflicted`?{label:`Conflicted`,colorClass:`text-destructive-foreground`,dotClass:`bg-destructive dark:bg-destructive/90`,pulse:!1}:t.status===`stuck`?{label:`Stuck`,colorClass:`text-hue-orange-foreground`,dotClass:`bg-hue-orange dark:bg-hue-orange/90`,pulse:!1}:t.hasPendingApprovals?{label:`Pending Approval`,colorClass:`text-warning-foreground`,dotClass:`bg-warning dark:bg-warning/90`,pulse:!1}:t.hasPendingUserInput?{label:`Awaiting Input`,colorClass:`text-hue-indigo-foreground`,dotClass:`bg-hue-indigo dark:bg-hue-indigo/90`,pulse:!1}:As(t.session)||t.status===`running`?{label:`Working`,colorClass:`text-hue-sky-foreground`,dotClass:`bg-hue-sky dark:bg-hue-sky/80`,pulse:!0}:js(t.session)?{label:`Connecting`,colorClass:`text-hue-sky-foreground`,dotClass:`bg-hue-sky dark:bg-hue-sky/80`,pulse:!0}:t.status===`needs-review`?{label:`Needs Review`,colorClass:`text-hue-violet-foreground`,dotClass:`bg-hue-violet dark:bg-hue-violet/90`,pulse:!1}:!t.hasPendingUserInput&&t.interactionMode===`plan`&&yn(t.latestTurn,t.session)&&t.hasActionableProposedPlan?{label:`Plan Ready`,colorClass:`text-hue-violet-foreground`,dotClass:`bg-hue-violet dark:bg-hue-violet/90`,pulse:!1}:t.latestTurn?.state===`interrupted`?{label:`Interrupted`,colorClass:`text-warning-foreground`,dotClass:`bg-warning dark:bg-warning/90`,pulse:!1}:Rs(t)?{label:`Completed`,colorClass:`text-success-foreground`,dotClass:`bg-success dark:bg-success/90`,pulse:!1}:null}function Gs(e){let t=null;for(let n of e)n!==null&&(t===null||Fs[n.label]>Fs[t.label])&&(t=n);return t}function Ks(e){let{deletedThreadId:t,deletedThreadIds:n,sortOrder:r,threads:i}=e,a=i.find(e=>e.id===t);return a?Ds(i.filter(e=>e.projectId===a.projectId&&e.id!==t&&!n?.has(e.id)&&(e.archivedAt??null)===null&&(e.deletedAt??null)===null),r)[0]?.id??null:null}function qs(e,t,n){return t.length>0?t.reduce((e,t)=>Math.max(e,Es(t,n)),-1/0):n===`created_at`?ws(e.createdAt)??-1/0:ws(e.updatedAt??e.createdAt)??-1/0}function Js(e,t,n){if(n===`manual`)return[...e];let r=new Map;for(let e of t){let t=r.get(e.projectId)??[];t.push(e),r.set(e.projectId,t)}return[...e].toSorted((e,t)=>{let i=qs(t,r.get(t.id)??[],n),a=qs(e,r.get(e.id)??[],n),o=i===a?0:i>a?1:-1;return o===0?e.name.localeCompare(t.name)||e.id.localeCompare(t.id):o})}var Ys={links:[],loaded:!1},Xs=Ys,Zs=null,Qs=0,$s=!1,ec=null,tc=1e3,nc=new Set,rc=3e4;function ic(e){if(!e||typeof e!=`object`)return!0;let t=e.status;return typeof t!=`number`||t===408||t===429||t>=500}function ac(){for(let e of nc)e()}function oc(e){Xs=e,ac()}function sc(){ec!==null&&(clearTimeout(ec),ec=null)}async function cc(){let e=await Jn.listProjectLinks();return{links:e.links.map(e=>({forgeEnvironmentId:e.forgeEnvironmentId,forgeProjectId:e.forgeProjectId,cmmdProjectId:e.cmmdProjectId})),loaded:e.sources?.cmmdAvailable!==!1}}function lc(){if(ec!==null||nc.size===0)return;let e=tc;tc=Math.min(tc*2,rc),ec=setTimeout(()=>{ec=null,!(nc.size===0||Xs.loaded)&&uc()},e)}function uc(){if(Xs.loaded||Zs!==null)return;let e=Qs;Zs=Promise.resolve().then(()=>cc()).then(t=>{e===Qs&&(oc(t),t.loaded?tc=1e3:lc())}).catch(t=>{e===Qs&&!Xs.loaded&&ic(t)&&lc()}).finally(()=>{Zs=null,$s&&nc.size>0&&!Xs.loaded&&($s=!1,uc())})}function dc(){if(sc(),tc=1e3,Qs+=1,oc(Ys),Zs!==null){$s=!0;return}nc.size>0&&uc()}function fc(e){return nc.add(e),uc(),()=>{nc.delete(e),nc.size===0&&sc()}}function pc(){return Xs}function mc(){return(0,I.useSyncExternalStore)(fc,pc,pc)}var hc=I.createContext(void 0);function gc(e){let t=I.useContext(hc);if(t===void 0&&!e)throw Error(Jr(33));return t}var _c=I.createContext(void 0);function vc(e){let t=I.useContext(_c);if(t===void 0&&!e)throw Error(Jr(36));return t}var yc=I.createContext(void 0);function bc(e=!0){let t=I.useContext(yc);if(t===void 0&&!e)throw Error(Jr(25));return t}var xc=I.createContext(void 0);function Sc(){let e=I.useContext(xc);if(e===void 0)throw Error(Jr(30));return e}function Cc(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=bc(!0),f=d!==void 0;return I.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:yr})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!wr&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&si(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var wc={type:`regular-item`};function Tc(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=I.useRef(null),{getButtonProps:d,buttonRef:f}=Cr({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Cc({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=I.useCallback(e=>Mr(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=Gr(u,f);return I.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Ec=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),Dc={checked(e){return e?{[Ec.checked]:``}:{[Ec.unchecked]:``}},...he},Oc=I.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,style:f,...p}=e,m=ci({guess:!0,label:a}),h=gc(!0),g=qr(i),{store:_}=vc(),v=_.useState(`disabled`),y=s||v,b=_.useState(`isActive`,m.index),x=_.useState(`itemProps`),[S,C]=ti({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:w,itemRef:T}=Tc({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:wc}),E=I.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function D(e){let t=Fr(yr,e.nativeEvent,void 0,{preventUnmountOnClose:Wr});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=Br(`div`,e,{state:E,stateAttributesMapping:Dc,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:D},p,w],ref:[T,t,m.ref]});return(0,L.jsx)(xc.Provider,{value:E,children:O})}),kc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Sc(),c=I.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=ne(s.checked);Oe({open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return Br(`span`,e,{state:f,ref:[t,c],stateAttributesMapping:Dc,props:{"aria-hidden":!0,...o},enabled:a||u})}),Ac=I.createContext(void 0);function jc(){let e=I.useContext(Ac);if(e===void 0)throw Error(Jr(31));return e}var Mc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=I.useState(void 0),c=Br(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,L.jsx)(Ac.Provider,{value:s,children:c})}),Nc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=qr(a),c=jc();return Kr(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Br(`div`,e,{ref:t,props:{id:s,role:`presentation`,...o}})}),Pc=I.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=ci({guess:!0,label:a}),f=gc(!0),p=qr(i),{store:m}=vc(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Tc({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:wc});return Br(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),Fc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=vc(),{side:c,align:l}=gc(),u=ni(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;Oe({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),I.useEffect(()=>{function e(e){s.setOpen(!1,Fr(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),N(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O={transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},k=Br(`div`,e,{state:O,ref:[t,s.context.popupRef,D],stateAttributesMapping:Ve,props:[p,{onKeyDown(e){u&&ei.has(e.key)&&e.stopPropagation()}},oe(f),o,{"data-rootownerid":y}]}),A=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(A=!0),(0,L.jsx)(ae,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?A:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:k})}),Ic=I.createContext(void 0);function Lc(){let e=I.useContext(Ic);if(e===void 0)throw Error(Jr(32));return e}var Rc=I.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=vc();return i.useState(`mounted`)||n?(0,L.jsx)(Ic.Provider,{value:n,children:(0,L.jsx)(je,{ref:t,...r})}):null}),zc=I.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Fe,style:g,..._}=e,{store:v}=vc(),y=Lc(),b=bc(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),A=v.useState(`transitionStatus`),j=v.useState(`positionerElement`),N=v.useState(`instantType`),ee=v.useState(`adaptiveOrigin`),P=v.useState(`lastOpenChangeReason`),F=v.useState(`floatingNodeId`),te=v.useState(`floatingParentNodeId`),ne=S.useState(`domReferenceElement`),re=I.useRef(null),ie=Ce(j),ae=n,oe=c,ce=l,le=s,ue=h;x.type===`context-menu`&&(ae=n??x.context?.anchor,le??=`start`,!o&&le!==`center`&&(ce=e.alignOffset??2,oe=e.sideOffset??-5));let de=o,fe=le;x.type===`menu`?(de??=`inline-end`,fe??=`start`,ue=e.collisionAvoidance??pe):x.type===`menubar`&&(de??=x.context.orientation===`vertical`?`inline-end`:`bottom`,fe??=`start`);let he=x.type===`context-menu`,_e=M({anchor:ae,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:de,sideOffset:oe,align:fe,alignOffset:ce,arrowPadding:he?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:F,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:ue,shift:he?{crossAxis:!(`side`in ue&&ue.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:ee});I.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===F&&v.set(`hoverEnabled`,!1),e.nodeId!==F&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,Fr(Ir)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,F]),I.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,Fr(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ve=Se();I.useEffect(()=>{T||ve.clear()},[T,ve]),I.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ve.isStarted()||ve.start(e,()=>{v.setOpen(!1,Fr(Ir))}):v.setOpen(!1,Fr(Ir))}else ve.clear()}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ve]),I.useEffect(()=>{let e={open:T,nodeId:F,parentNodeId:te,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,F,te]),Kr(()=>{let e=ne,t=re.current;if(e&&(re.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ie(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[ne,ie,v]);let ye={open:T,side:_e.side,align:_e.align,anchorHidden:_e.anchorHidden,nested:x.type===`menu`,instant:N},be=x.type===`menubar`&&x.context.modal;we(T&&(be||E&&P!==`trigger-hover`),D===`touch`,j,O);let xe=me(e,ye,{styles:_e.positionerStyles,transitionStatus:A,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),Te=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&P!==`trigger-hover`||x.type===`menubar`&&x.context.modal),Ee=null;return x.type===`menubar`?Ee=x.context.contentElement:x.type===void 0&&(Ee=O),(0,L.jsxs)(hc.Provider,{value:_e,children:[Te&&(0,L.jsx)(ge,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:se(!T),cutout:Ee}),(0,L.jsx)(k,{id:F,children:(0,L.jsx)(ht,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:xe})})]})}),Bc=I.createContext(void 0);function Vc(){let e=I.useContext(Bc);if(e===void 0)throw Error(Jr(34));return e}var Hc=I.memo(I.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=I.useState(void 0),[p,m]=ti({controlled:i,default:a,name:`MenuRadioGroup`}),h=oi((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=Br(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=I.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,L.jsx)(Ac.Provider,{value:f,children:(0,L.jsx)(Bc.Provider,{value:_,children:g})})})),Uc=I.createContext(void 0);function Wc(){let e=I.useContext(Uc);if(e===void 0)throw Error(Jr(35));return e}var Gc=I.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=ci({guess:!0,label:a}),p=gc(!0),m=qr(i),{store:h}=vc(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Vc(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=Tc({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:wc}),E=I.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=Fr(yr,e.nativeEvent,void 0,{preventUnmountOnClose:Wr});y(l,t)}let O=Br(`div`,e,{state:E,stateAttributesMapping:Dc,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,L.jsx)(Uc.Provider,{value:E,children:O})}),Kc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Wc(),c=I.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=ne(s.checked);Oe({open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return Br(`span`,e,{state:f,stateAttributesMapping:Dc,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),qc=I.createContext(null);function Jc(e){let t=I.useContext(qc);if(t===null&&!e)throw Error(Jr(5));return t}var Yc={...s,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},Xc=class extends h{constructor(e){super({...Qc(),...e},Zc(),Yc),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function Zc(){return{positionerRef:I.createRef(),popupRef:I.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:I.createRef(),beforeContentFocusGuardRef:I.createRef(),onOpenChangeComplete:void 0,triggerElements:new be}}function Qc(){return{...T(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Ae,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:vi,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var $c=I.createContext(void 0);function el(){return I.useContext($c)}var tl=j(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:_=!0}=e,y=bc(!0),S=vc(!0),w=Jc(!0),T=el(),E=I.useMemo(()=>T&&S?{type:`menu`,store:S.store}:w?{type:`menubar`,context:w}:y&&!S?{type:`context-menu`,context:y}:{type:void 0},[y,S,w,T]),O=nl({open:a,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:E});O.useControlledProp(`openProp`,n),O.useControlledProp(`triggerIdProp`,m),O.useContextCallback(`onOpenChangeComplete`,i);let k=Rr(),j=Rr(),M=O.useState(`floatingTreeRoot`),N=fe(M),ee=Ne(),P=O.useState(`open`),F=O.useState(`activeTriggerElement`),te=O.useState(`positionerElement`),ne=O.useState(`hoverEnabled`),re=O.useState(`disabled`),ae=O.useState(`lastOpenChangeReason`),oe=O.useState(`parent`),se=O.useState(`activeIndex`),ce=O.useState(`payload`),le=O.useState(`floatingParentNodeId`),ue=I.useRef(null),de=I.useRef(oe.type!==`context-menu`),pe=Se(),me=I.useRef(!0),he=Se(),ge=le!=null,{openMethod:_e,triggerProps:ve}=Pe(P);O.useSyncedValues({disabled:s,highlightItemOnHover:_,modal:oe.type===void 0?c:void 0,openMethod:_e,rootId:k}),b(O);let{forceUnmount:ye}=A(P,O,()=>{O.set(`allowMouseEnter`,!1)});Kr(()=>{y&&!S?O.update({parent:{type:`context-menu`,context:y},floatingNodeId:N,floatingParentNodeId:ee}):S&&O.update({floatingNodeId:N,floatingParentNodeId:ee})},[y,S,N,ee,O]),I.useEffect(()=>{if(P||(ue.current=null),oe.type===`context-menu`){if(!P){pe.clear(),de.current=!1;return}pe.start(500,()=>{de.current=!0})}},[pe,P,oe.type]),Kr(()=>{!P&&!ne&&O.set(`hoverEnabled`,!0)},[P,ne,O]);let be=oi((e,t)=>{let n=t.reason;if(!e&&!O.select(`open`)||P===e&&t.trigger===F&&ae===n)return;let i=D(t);if(!e&&t.trigger==null&&(t.trigger=F??void 0),r?.(e,t),t.isCanceled)return;O.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!me.current)return;e&&n===`trigger-focus`?(me.current=!1,he.start(300,()=>{me.current=!0})):(me.current=!0,he.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};ue.current=t.event,v(c,e,t.trigger,i()),O.update(c),oe.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?O.set(`instantType`,`group`):o||s?O.set(`instantType`,o?`click`:`dismiss`):O.set(`instantType`,void 0)}),xe=g({popupStore:O,floatingId:j,nested:ee!=null,onOpenChange:be}),Ce=xe.context.events;Kr(()=>{let e=({open:e,eventDetails:t})=>be(e,t);return Ce.on(`setOpen`,e),()=>{Ce?.off(`setOpen`,e)}},[Ce,be]);let we=I.useCallback(()=>{O.setOpen(!1,Fr(Zr))},[O]);I.useImperativeHandle(d,()=>({unmount:ye,close:we}),[ye,we]);let Te;oe.type===`context-menu`&&(Te=oe.context),I.useImperativeHandle(Te?.positionerRef,()=>te,[te]),I.useImperativeHandle(Te?.actionsRef,()=>({setOpen:be}),[be]);let Ee=ie(xe,{enabled:!re,bubbles:{escapeKey:f&&oe.type===`menu`},outsidePress(){return oe.type!==`context-menu`||ue.current?.type===`contextmenu`||de.current},externalTree:ge?M:void 0}),De=gi(),Oe=I.useCallback(e=>{O.select(`activeIndex`)!==e&&O.set(`activeIndex`,e)},[O]),ke=Qa(xe,{enabled:!re,listRef:O.context.itemDomElements,activeIndex:se,nested:oe.type!==void 0,loopFocus:l,orientation:u,parentOrientation:oe.type===`menubar`?oe.context.orientation:void 0,rtl:De===`rtl`,disabledIndices:mi,onNavigate:Oe,openOnArrowKeyDown:oe.type!==`context-menu`,externalTree:ge?M:void 0,focusItemOnHover:_}),Ae=I.useCallback(e=>{O.context.typingRef.current=e},[O]),je=$a(xe,{enabled:!re,listRef:O.context.itemLabels,elementsRef:O.context.itemDomElements,activeIndex:se,resetMs:500,onMatch:e=>{P&&e!==se&&O.set(`activeIndex`,e)},onTyping:Ae}),Me=I.useMemo(()=>{let e=Mr(je.reference,ke.reference,Ee.reference,{onMouseMove(){O.set(`allowMouseEnter`,!0)}},ve);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=P,e},[O,je.reference,ke.reference,Ee.reference,ve,P]),Fe=I.useMemo(()=>{let e=Mr(ke.trigger,Ee.trigger,ve);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ke.trigger,Ee.trigger,ve]),Ie=I.useMemo(()=>Mr(x,{id:j,role:`menu`,"aria-labelledby":F?.id,onMouseMove(){O.set(`allowMouseEnter`,!0),oe.type===`menu`&&O.set(`hoverEnabled`,!1)},onClick(){O.select(`hoverEnabled`)&&O.set(`hoverEnabled`,!1)},onKeyDown(e){let t=O.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},je.floating,ke.floating,Ee.floating),[F,j,oe.type,O,je.floating,ke.floating,Ee.floating]),Le=ke.item??vi;Ue(O,{floatingRootContext:xe,activeTriggerProps:Me,inactiveTriggerProps:Fe,popupProps:Ie,itemProps:Le});let Re=I.useMemo(()=>({store:O,parent:E}),[O,E]),ze=(0,L.jsxs)(_c.Provider,{value:Re,children:[p&&(0,L.jsx)(C,{handle:p,store:O}),typeof t==`function`?t({payload:ce}):t]});return oe.type===void 0||oe.type===`context-menu`?(0,L.jsx)(o,{externalTree:M,children:ze}):ze});function nl(e){return Vr(()=>new Xc(e)).current}function rl(e){let t=vc().store,n=I.useMemo(()=>({parentMenu:t}),[t]);return(0,L.jsx)($c.Provider,{value:n,children:(0,L.jsx)(tl,{...e})})}var il=5;function al(e,t){let n=ol(t);return e.clientX>=n.left-il&&e.clientX<=n.right+il&&e.clientY>=n.top-il&&e.clientY<=n.bottom+il}function ol(e){let t=e.getBoundingClientRect(),n=ri(e);if(xr)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function sl(e){if(Hr(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!ii(e))return sl(fi(e))}function cl(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=I.useRef(!1);return I.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,w(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:vi,[t,n,r])}var ll=We(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:d=0,handle:p,payload:h,...g}=e,v=vc(!0),y=f(p)??v?.store;if(!y)throw Error(Jr(85));let b=qr(s),x=y.useState(`isTriggerActive`,b),S=y.useState(`floatingRootContext`),C=y.useState(`isOpenedByTrigger`,b),T=y.useState(`triggerPopupId`,b),E=I.useRef(null),D=dl(),O=zr(!0),k=Te(),A=I.useMemo(()=>k??new Ae,[k]),j=fe(A),M=Ne(),{registerTrigger:N,isMountedByThisTrigger:ee}=_(b,E,y,{payload:h,closeDelay:d,parent:D,floatingTreeRoot:A,floatingNodeId:j,floatingParentNodeId:M,keyboardEventRelay:O?.relayKeyboardEvent}),P=D.type===`menubar`,F=y.useState(`disabled`),te=a||F||P&&D.context.disabled,{getButtonProps:ne,buttonRef:ie}=Cr({disabled:te,native:o});I.useEffect(()=>{!C&&D.type===void 0&&(y.context.allowMouseUpTriggerRef.current=!1)},[y,C,D.type]);let ae=I.useRef(null),oe=Se(),se=oi(e=>{if(!ae.current)return;oe.clear(),y.context.allowMouseUpTriggerRef.current=!1;let t=e.target;jr(ae.current,t)||jr(y.select(`positionerElement`),t)||t===ae.current||(t==null||sl(t)!==y.select(`rootId`))&&(al(e,ae.current)||A.events.emit(`close`,{domEvent:e,reason:hi}))});I.useEffect(()=>{C&&y.select(`lastOpenChangeReason`)===`trigger-hover`&&w(ae.current).addEventListener(`mouseup`,se,{once:!0})},[C,se,y]);let ce=P&&D.context.hasSubmenuOpen,ue=Le(S,{enabled:(c??ce)&&!te&&(!P||ce&&!ee),handleClose:u({blockPointerEvents:!P}),mouseOnly:!0,move:!1,restMs:D.type===void 0?l:void 0,delay:{close:d},triggerElementRef:E,externalTree:A,isActiveTrigger:x,isClosing:()=>y.select(`transitionStatus`)===`ending`}),de=ul(C,y.select(`lastOpenChangeReason`)),pe=re(S,{enabled:!te,event:C&&P?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:D.type===void 0&&de}),me=m(S,{enabled:!te&&ce}),he=cl({open:C,enabled:P,mouseDownAction:`open`}),ge=I.useMemo(()=>Mr(me.reference,pe.reference),[me.reference,pe.reference]),_e=y.useState(`triggerProps`,ee),{preFocusGuardRef:ve,handlePreFocusGuardFocus:ye,handleFocusTargetFocus:be}=Me(y,E),xe={disabled:te,open:C},Ce=[ae,t,ie,N,E],we=[ge,ue??vi,_e,{"aria-haspopup":`menu`,"aria-controls":T,id:b,onMouseDown:e=>{y.select(`open`)||(oe.start(200,()=>{y.context.allowMouseUpTriggerRef.current=!0}),w(e.currentTarget).addEventListener(`mouseup`,se,{once:!0}))}},P?{role:`menuitem`}:{},he,g,ne],Ee=Br(`button`,e,{enabled:!P,stateAttributesMapping:le,state:xe,ref:Ce,props:we});return P?(0,L.jsx)(di,{tag:`button`,render:n,className:r,style:i,state:xe,refs:Ce,props:we,stateAttributesMapping:le}):C?(0,L.jsxs)(I.Fragment,{children:[(0,L.jsx)(Ie,{ref:ve,onFocus:ye},`${b}-pre-focus-guard`),(0,L.jsx)(I.Fragment,{children:Ee},b),(0,L.jsx)(Ie,{ref:y.context.triggerFocusTargetRef,onFocus:be},`${b}-post-focus-guard`)]}):(0,L.jsx)(I.Fragment,{children:Ee},b)});function ul(e,t){let n=Se(),[r,i]=I.useState(!1);return Kr(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function dl(){let e=Jc(!0);return I.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var fl={"aria-expanded":void 0},pl=I.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:d=0,disabled:f=!1,...p}=e,m=el();if(!m?.parentMenu)throw Error(Jr(37));let h=ci({guess:!0,label:a}),g=gc(),{store:_}=vc(),v=qr(o),y=_.useState(`open`),b=_.useState(`floatingRootContext`),x=_.useState(`floatingTreeRoot`),S=_.useState(`triggerPopupId`,v),C=P(v,_),w=I.useCallback(e=>{let t=C(e);return e!==null&&_.select(`open`)&&_.select(`activeTriggerId`)==null&&_.update({activeTriggerId:v,activeTriggerElement:e,closeDelay:d}),t},[C,d,_,v]),T=I.useRef(null),E=I.useCallback(e=>{T.current=e,_.set(`activeTriggerElement`,e)},[_]);_.useSyncedValue(`closeDelay`,d);let D=m.parentMenu,O=_.useState(`disabled`),k=D.useState(`disabled`),A=f||O||k,j=D.useState(`itemProps`),M=D.useState(`isActive`,h.index),N=I.useMemo(()=>({type:`submenu-trigger`,setActive(){D.select(`highlightItemOnHover`)&&D.set(`activeIndex`,h.index)}}),[D,h.index]),{getItemProps:F,itemRef:te}=Tc({closeOnClick:!1,disabled:A,highlighted:M,id:v,store:_,typingRef:D.context.typingRef,nativeButton:s,itemMetadata:N,nodeId:g?.context.nodeId}),ne=_.useState(`hoverEnabled`),ie=Le(b,{enabled:ne&&c&&!A,handleClose:u({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:d},shouldOpen:l>0?()=>D.select(`allowMouseEnter`):void 0,triggerElementRef:T,externalTree:x,isClosing:()=>_.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),ae=re(b,{enabled:!A,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??vi,oe=_.useState(`triggerProps`,!0);delete oe.id;let se={disabled:A,highlighted:M,open:y},ce=_.useState(`openMethod`),le=_.useState(`lastOpenChangeReason`)===`list-navigation`||ce===`keyboard`;return Br(`div`,e,{state:se,stateAttributesMapping:ze,props:[ae,ie,oe,j,y&&le&&ee?fl:void 0,{"aria-controls":S,tabIndex:y||M?0:-1,onBlur(){M&&D.set(`activeIndex`,null)}},p,F],ref:[t,h.ref,te,w,E]})}),ml=I.createContext(!1);function hl(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(ml.Provider,{value:!0,children:(0,L.jsx)(Mc,{"data-slot":`menu-group`,...e})}),t[0]=e,t[1]=n),n}function gl(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(ml.Provider,{value:!0,children:(0,L.jsx)(Hc,{"data-slot":`menu-radio-group`,...e})}),t[0]=e,t[1]=n),n}var _l=`px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8`;function vl(e){let t=(0,R.c)(22),n,r,i;if(t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i),!I.useContext(ml)){let e,a,o;if(t[4]!==i){let{render:n,style:r,children:s,...c}=i;o=r,e=s,a=c,t[4]=i,t[5]=e,t[6]=a,t[7]=o}else e=t[5],a=t[6],o=t[7];let s;t[8]===n?s=t[9]:(s=_i(_l,n),t[8]=n,t[9]=s);let c=typeof o==`function`?void 0:o,l=typeof e==`function`?null:e,u;return t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==c||t[14]!==l?(u=(0,L.jsx)(`div`,{className:s,"data-inset":r,"data-slot":`menu-label`,role:`presentation`,style:c,...a,children:l}),t[10]=r,t[11]=a,t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15],u}let a;t[16]===n?a=t[17]:(a=_i(_l,n),t[16]=n,t[17]=a);let o;return t[18]!==r||t[19]!==i||t[20]!==a?(o=(0,L.jsx)(Nc,{className:a,"data-inset":r,"data-slot":`menu-label`,...i}),t[18]=r,t[19]=i,t[20]=a,t[21]=o):o=t[21],o}var yl=tl;function bl(e){let t=(0,R.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,L.jsx)(ll,{className:r,"data-slot":`menu-trigger`,...i,children:n}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xl(e){let t=(0,R.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({children:i,className:a,sideOffset:s,align:c,alignOffset:n,side:l,anchor:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=s===void 0?4:s,d=c===void 0?`center`:c,f=l===void 0?`bottom`:l,p;t[9]===a?p=t[10]:(p=_i(`dropdown-glass relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg shadow-[0_16px_40px_-18px_rgb(0_0_0/55%)] outline-none focus:outline-none dark:shadow-[0_18px_44px_-18px_rgb(0_0_0/80%)]`,a),t[9]=a,t[10]=p);let m;t[11]===i?m=t[12]:(m=(0,L.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1`,children:i}),t[11]=i,t[12]=m);let h;t[13]!==o||t[14]!==p||t[15]!==m?(h=(0,L.jsx)(Fc,{className:p,"data-slot":`menu-popup`,...o,children:m}),t[13]=o,t[14]=p,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==d||t[18]!==n||t[19]!==r||t[20]!==f||t[21]!==u||t[22]!==h?(g=(0,L.jsx)(Rc,{children:(0,L.jsx)(zc,{align:d,alignOffset:n,anchor:r,className:`z-50`,"data-slot":`menu-positioner`,side:f,sideOffset:u,children:h})}),t[17]=d,t[18]=n,t[19]=r,t[20]=f,t[21]=u,t[22]=h,t[23]=g):g=t[23],g}function Sl(e){let t=(0,R.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=_i(`[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:shrink-0`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,L.jsx)(Pc,{className:s,"data-inset":r,"data-slot":`menu-item`,"data-variant":o,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function Cl(e){let t=(0,R.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,variant:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=o===void 0?`default`:o,c=s===`switch`?`grid-cols-[1fr_auto] gap-4 pe-1.5`:`grid-cols-[1rem_1fr] pe-4`,l;t[6]!==i||t[7]!==c?(l=_i(`grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 ps-2 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,c,i),t[6]=i,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==s?(u=s===`switch`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`col-start-1`,children:r}),(0,L.jsx)(kc,{className:`inset-shadow-[0_1px_--theme(--color-black/4%)] inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(4)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:opacity-64 sm:[--thumb-size:--spacing(3)]`,keepMounted:!0,children:(0,L.jsx)(`span`,{className:`pointer-events-none block aspect-square h-full in-[[data-slot=menu-checkbox-item][data-checked]]:origin-[var(--thumb-size)_50%] origin-left in-[[data-slot=menu-checkbox-item][data-checked]]:translate-x-[calc(var(--thumb-size)-4px)] in-[[data-slot=menu-checkbox-item]:active]:not-data-disabled:scale-x-110 in-[[data-slot=menu-checkbox-item]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.10)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s]`})})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(kc,{className:`col-start-1`,children:(0,L.jsx)(`svg`,{fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,L.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})}),(0,L.jsx)(`span`,{className:`col-start-2`,children:r})]}),t[9]=r,t[10]=s,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==a||t[14]!==l||t[15]!==u?(d=(0,L.jsx)(Oc,{checked:n,className:l,"data-slot":`menu-checkbox-item`,...a,children:u}),t[12]=n,t[13]=a,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function wl(e){let t=(0,R.c)(18),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,hideIndicator:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a!==void 0&&a,s=o?`flex px-2 data-checked:bg-foreground/[0.12] data-checked:data-highlighted:bg-foreground/[0.18]`:`grid grid-cols-[1rem_1fr] ps-2 pe-4`,c;t[5]!==r||t[6]!==s?(c=_i(`min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,s,r),t[5]=r,t[6]=s,t[7]=c):c=t[7];let l;t[8]===o?l=t[9]:(l=o?null:(0,L.jsx)(Kc,{className:`col-start-1`,children:(0,L.jsx)(`svg`,{fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,L.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})}),t[8]=o,t[9]=l);let u=o?`min-w-0 flex-1`:`col-start-2`,d;t[10]!==n||t[11]!==u?(d=(0,L.jsx)(`span`,{className:u,children:n}),t[10]=n,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==i||t[14]!==c||t[15]!==l||t[16]!==d?(f=(0,L.jsxs)(Gc,{className:c,"data-slot":`menu-radio-item`,...i,children:[l,d]}),t[13]=i,t[14]=c,t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function Tl(e){let t=(0,R.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=_i(`mx-2 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(sn,{className:i,"data-slot":`menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function El(e){let t=(0,R.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=_i(`ms-auto font-medium font-sans text-muted-foreground/72 text-xs tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(`kbd`,{className:i,"data-slot":`menu-shortcut`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dl(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(rl,{"data-slot":`menu-sub`,...e}),t[0]=e,t[1]=n),n}function Ol(e){let t=(0,R.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=_i(`flex min-h-8 items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-popup-open:bg-accent data-inset:ps-8 data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(xt,{className:`-me-0.5 ms-auto opacity-80`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,L.jsxs)(pl,{className:o,"data-inset":i,"data-slot":`menu-sub-trigger`,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function kl(e){let t=(0,R.c)(12),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,sideOffset:a,alignOffset:n,align:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?0:a,c=o===void 0?`start`:o,l=n??(c===`center`?void 0:-5),u;return t[6]!==c||t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==l?(u=(0,L.jsx)(xl,{align:c,alignOffset:l,className:r,"data-slot":`menu-sub-content`,side:`inline-end`,sideOffset:s,...i}),t[6]=c,t[7]=r,t[8]=i,t[9]=s,t[10]=l,t[11]=u):u=t[11],u}function Al(e){if(!e.environmentId)return null;let t=e.readEnvironmentApi(e.environmentId);return t?{environmentId:e.environmentId,api:t}:null}function jl(e){let t=Ss({requestedDefault:e.requestedRuntime}),n=Al({environmentId:e.activeEnvironmentId,readEnvironmentApi:e.readEnvironmentApi}),r=Al({environmentId:e.primaryEnvironmentId,readEnvironmentApi:e.readEnvironmentApi}),i=t.effectiveDefault===`cloud`?r:n??r;return i?{runtime:t.effectiveDefault,environmentId:i.environmentId,api:i.api}:null}function Ml(e){return e.projectRef}function Nl(e){let t=e.latestActiveDraft;return!t||e.routeTargetKind!==`draft`||t.logicalProjectKey!==e.logicalProjectKey?!1:t.promotedTo==null}async function Pl(e){e.openBrowserPreview&&Ht.getState().revealBrowser(Xe(e.draftId));let t=e.viewTransition&&typeof document<`u`&&typeof document.startViewTransition==`function`,n=()=>e.router.navigate({to:`/draft/$draftId`,params:{draftId:e.draftId},...t?{viewTransition:!1}:{}});if(!t){await n();return}let r=document.startViewTransition(n);r.ready.catch(()=>void 0),await r.updateCallbackDone}function Fl(){let e=nn(e=>e.activeEnvironmentId),t=nn(e=>e.environmentStateById),n=(0,I.useMemo)(()=>({activeEnvironmentId:e,environmentStateById:t}),[e,t]);return(0,I.useMemo)(()=>Jt(n),[n])}var Il=`package`;function Ll(e,t){let n=t.repositoryIdentity?.canonicalKey;return n?e[n]??`package`:Il}function Rl(e,t=Il){if(t===`repository`)return e.canonicalKey;let n=e.repositorySubpath?.trim();return n&&n.length>0?`${e.canonicalKey}#${n}`:e.canonicalKey}function zl(e,t=Il){return e.repositoryIdentity?Rl(e.repositoryIdentity,t):Nt(ut(e.environmentId,e.id))}function Bl(e){if(!e)return null;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`).filter(e=>e.length>0);for(let e=t.length-1;e>=0;--e){if(t[e]?.toLowerCase()!==`conductor`||t[e+1]?.toLowerCase()!==`workspaces`)continue;let n=t[e+2],r=t[e+3];if(!n||!r)return null;let i=t.slice(e+4).join(`/`);return`worktree-shape:${n.toLowerCase()}#${i.toLowerCase()}`}for(let e=t.length-1;e>=0;--e){if(t[e]?.toLowerCase()!==`.claude`||t[e+1]?.toLowerCase()!==`worktrees`)continue;let n=t[e-1],r=t[e+2];if(!n||!r)return null;let i=t.slice(e+3).join(`/`);return`worktree-shape:${n.toLowerCase()}#${i.toLowerCase()}`}let n=-1;for(let e=t.length-1;e>=0;--e){let r=t[e];if(r===`worktrees`||r===`.worktrees`){n=e;break}}if(n===-1||n+2>=t.length)return null;let r=n>0&&t[n-1]?.toLowerCase()===`.codex`?t[n+2]:t[n+1];if(!r)return null;let i=t.slice(n+3).join(`/`);return`worktree-shape:${r.toLowerCase()}#${i.toLowerCase()}`}function Vl(e,t){if(!e)return null;let n=e.replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`).filter(e=>e.length>0),r=(t??``).replace(/\\/g,`/`).replace(/^\/+|\/+$/g,``).split(`/`).filter(e=>e.length>0&&e!==`.`);if(r.length>n.length)return null;let i=n.length-r.length;if(!r.every((e,t)=>n[i+t]?.toLowerCase()===e.toLowerCase()))return null;let a=n.slice(0,i).at(-1);return a?`worktree-shape:${a.toLowerCase()}#${r.map(e=>e.toLowerCase()).join(`/`)}`:null}function Hl(e,t=()=>Il){let n=new Map;for(let r of e){if(!r.repositoryIdentity)continue;let e=Bl(r.cwd)??Vl(r.cwd,r.repositoryIdentity.repositorySubpath);if(!e)continue;let i=n.get(e)??new Set;i.add(zl(r,t(r.repositoryIdentity))),n.set(e,i)}let r=new Map;for(let[e,t]of n){if(t.size!==1)continue;let n=t.values().next().value;n&&r.set(e,n)}let i=new Map;for(let n of e){let e=Nt(ut(n.environmentId,n.id)),a=n.repositoryIdentity?null:Bl(n.cwd);i.set(e,(a?r.get(a):void 0)??zl(n,n.repositoryIdentity?t(n.repositoryIdentity):void 0))}return i}function Ul(e){let t=e.prompt?.trim(),n=e.existingPrompt?.trim(),r=e.replaceExistingPrompt?.trim();!t||n&&n!==r||(e.setPrompt(e.target,t),e.autoSubmit===!0&&e.setPendingAutoSubmit(e.target,!0))}function Wl(e){return e?e.branch!==void 0||e.worktreePath!==void 0||e.envMode!==void 0||e.anchorKind!==void 0||e.anchorCmmdId!==void 0||e.cmmdTaskId!==void 0||e.linkedPullRequest!==void 0:!1}function Gl(e){return e?{...e.branch===void 0?{}:{branch:e.branch??null},...e.worktreePath===void 0?{}:{worktreePath:e.worktreePath??null},...e.envMode===void 0?{}:{envMode:e.envMode},...e.anchorKind===void 0?{}:{anchorKind:e.anchorKind},...e.anchorCmmdId===void 0?{}:{anchorCmmdId:e.anchorCmmdId},...e.cmmdTaskId===void 0?{}:{cmmdTaskId:e.cmmdTaskId},...e.linkedPullRequest===void 0?{}:{linkedPullRequest:e.linkedPullRequest}}:{}}function Kl(e){let{branch:t,worktreePath:n,envMode:r,cmmdTaskId:i,linkedPullRequest:a}=Gl(e);return{...t===void 0?{}:{branch:t},...n===void 0?{}:{worktreePath:n},...r===void 0?{}:{envMode:r},...i===void 0?{}:{cmmdTaskId:i},...a===void 0?{}:{linkedPullRequest:a}}}function ql(e,t){return{threadId:t.threadId,createdAt:t.createdAt,runtimeMode:t.runtimeMode,branch:e?.branch??null,worktreePath:e?.worktreePath??null,envMode:e?.envMode??`local`,...e?.anchorKind===void 0?{}:{anchorKind:e.anchorKind},...e?.anchorCmmdId===void 0?{}:{anchorCmmdId:e.anchorCmmdId},...e?.cmmdTaskId===void 0?{}:{cmmdTaskId:e.cmmdTaskId},...e?.linkedPullRequest===void 0?{}:{linkedPullRequest:e.linkedPullRequest}}}function Jl(){let e=(0,R.c)(6),t=Fl(),n=En(),r;e[0]===n.state.matches?r=e[1]:(r=()=>{let e=n.state.matches[n.state.matches.length-1]?.params??{};return tr(e)},e[0]=n.state.matches,e[1]=r);let i=r,a;return e[2]!==i||e[3]!==t||e[4]!==n?(a=(e,r)=>{let{getDraftSessionByLogicalProjectKey:a,getDraftSession:o,getDraftThread:s,applyStickyState:c,setDraftThreadContext:l,setLogicalProjectDraftThreadId:u}=$e.getState(),d=i(),f=t.find(t=>t.id===e.projectId&&t.environmentId===e.environmentId),p=f?zl(f):Nt(e),m=Gl(r),h=Kl(r),g=Wl(r),_=a(p),v=nu(d,{getDraftThread:s,getDraftSession:o}),y=e=>{let t=$e.getState();Ul({target:e,prompt:r?.initialPrompt,...r?.autoSubmit===void 0?{}:{autoSubmit:r.autoSubmit},setPrompt:t.setPrompt,setPendingAutoSubmit:t.setPendingAutoSubmit})},b=Yl(_,r?.draftReuse);if(b)return(async()=>(Xl({mentionsContext:g,draftId:b.draftId,contextPatch:m,setDraftThreadContext:l}),u(p,e,b.draftId,{threadId:b.threadId,...Zl(r?.cmmdTaskId)}),y(b.draftId),await Pl({router:n,draftId:b.draftId,openBrowserPreview:r?.openBrowserPreview,viewTransition:r?.viewTransition}),Ql(b)))();let x=Yl(v,r?.draftReuse);if(x&&d?.kind===`draft`&&Nl({latestActiveDraft:x,routeTargetKind:d.kind,logicalProjectKey:p}))return Xl({mentionsContext:g,draftId:d.draftId,contextPatch:m,setDraftThreadContext:l}),u(p,e,d.draftId,{threadId:x.threadId,createdAt:x.createdAt,runtimeMode:x.runtimeMode,interactionMode:x.interactionMode,...h}),y(d.draftId),Promise.resolve({draftId:d.draftId,threadId:x.threadId,projectRef:e});let S=_r(),C=$r(),w=new Date().toISOString();return(async()=>(u(p,e,S,ql(r,{threadId:C,createdAt:w,runtimeMode:bi})),c(S),y(S),await Pl({router:n,draftId:S,openBrowserPreview:r?.openBrowserPreview,viewTransition:r?.viewTransition}),{draftId:S,threadId:C,projectRef:e}))()},e[2]=i,e[3]=t,e[4]=n,e[5]=a):a=e[5],a}function Yl(e,t){return t===`never`?null:e}function Xl(e){e.mentionsContext&&e.setDraftThreadContext(e.draftId,e.contextPatch)}function Zl(e){return e===void 0?{}:{cmmdTaskId:e}}function Ql(e){return{draftId:e.draftId,threadId:e.threadId,projectRef:ut(e.environmentId,e.projectId)}}function $l(){let e=(0,R.c)(5),t=Jl(),n;e[0]===t?n=e[1]:(n=async(...e)=>{await t(...e)},e[0]=t,e[1]=n);let r=n,i;return e[2]!==r||e[3]!==t?(i={handleNewThread:r,openNewThread:t},e[2]=r,e[3]=t,e[4]=i):i=e[4],i}function eu(){let e=rr(e=>e.projectOrder),t=nr({strict:!1,select:e=>tr(e)}),n=t?.kind===`server`?t.threadRef:null,r=nn((0,I.useMemo)(()=>_t(n),[n])),i=$e(e=>e.getDraftThread),a=$e(()=>t?t.kind===`server`?i(t.threadRef):$e.getState().getDraftSession(t.draftId):null),o=Kt(),s=ir(e=>e.defaultThreadRuntime),c=Fl(),l=(0,I.useMemo)(()=>Bs({items:c,preferredIds:e,getId:e=>Nt(ut(e.environmentId,e.id))}),[e,c]),u=Jl(),d=(0,I.useCallback)(async(...e)=>{await u(...e)},[u]),f=(0,I.useMemo)(()=>{let e=l[0];return e?Ml({requestedRuntime:s,primaryEnvironmentId:o,projects:c,projectRef:ut(e.environmentId,e.id)}):null},[s,l,o,c]);return{activeComposerTarget:tu(t),activeDraftThread:a,activeThread:r,defaultProjectRef:f,handleNewThread:d,openNewThread:u,routeThreadRef:n}}function tu(e){return e===null?null:e.kind===`server`?e.threadRef:e.draftId}function nu(e,t){return e?e.kind===`server`?t.getDraftThread(e.threadRef):t.getDraftSession(e.draftId):null}function ru(e){let t=e.replace(/[/\\]+$/,``)||e,n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return(n>=0?t.slice(n+1):t)||e}var iu=`inline-flex max-w-full select-none items-center gap-1 rounded-md border border-border/70 bg-accent/40 px-1.5 py-px font-medium text-[12px] leading-[1.1] text-foreground align-middle`,au=`size-3.5 shrink-0 opacity-85`,ou=`truncate select-none leading-tight`,su=`inline-flex max-w-full select-none items-center gap-1 rounded-md border border-hue-violet-border bg-hue-violet-surface px-1.5 py-px font-medium text-[12px] leading-[1.1] text-hue-violet-foreground align-middle`,cu=`ml-0.5 inline-flex size-3.5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/6 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,lu=`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>`;function uu(e){return e.split(/[\s:_-]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function du(e){return e.replaceAll(`\\`,`/`)}function fu(e){return e.displayName?.trim()||uu(e.name)}function pu(e){let t=du(e.path);if(t.includes(`/.codex/plugins/`)||t.includes(`/.agents/plugins/`))return`App`;let n=e.scope?.trim().toLowerCase();return n===`system`?`System`:n===`project`||n===`workspace`||n===`local`?`Project`:n===`user`||n===`personal`?`Personal`:n?uu(n):null}var mu=(0,I.createContext)(null);function hu(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function gu(){let e=(0,I.useContext)(mu);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function z(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _u(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var vu=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,yu=vu&&`documentMode`in document?document.documentMode:null,bu=vu&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),xu=vu&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Su=!(!vu||!(`InputEvent`in window)||yu)&&`getTargetRanges`in new window.InputEvent(`input`),Cu=vu&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,wu=vu&&/Android/.test(navigator.userAgent),Tu=vu&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!wu,Eu=vu&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Du=vu&&wu&&Eu,Ou=vu&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&bu&&!Eu,ku=0,Au=1,ju=2,Mu=1,Nu=2,Pu=3,Fu=4,Iu=5,Lu=6,Ru=Tu||Cu||Ou?`\xA0`:``,zu=`
|
|
2
2
|
|
|
3
3
|
`,Bu=xu?`\xA0`:Ru,Vu={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Hu={directionless:1,unmergeable:2},Uu={center:2,end:6,justify:4,left:1,right:3,start:5},Wu={[Nu]:`center`,[Lu]:`end`,[Fu]:`justify`,[Mu]:`left`,[Pu]:`right`,[Iu]:`start`},Gu={normal:0,segmented:2,token:1},Ku={[ku]:`normal`,[ju]:`segmented`,[Au]:`token`},qu=`$config`;function Ju(){return Rv()._blockCursorElement}function Yu(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-slot`)}var Xu=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&z(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&z(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&z(359),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,n){if(this.element===e)return t===e&&n===0?`before`:`after`;let r=Zu(e,this.element);if(r===null)return`after`;let i=Array.prototype.indexOf.call(e.childNodes,r);if(i<0)return`after`;if(t===e)return n<=i?`before`:`after`;let a=Zu(e,t);if(a===null)return`after`;let o=Array.prototype.indexOf.call(e.childNodes,a);return o>=0&&o<=i?`before`:`after`}getInsertionAnchor(){return this.before}};function Zu(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;return n}var Qu=class e extends Xu{withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;Yu(t);)e=t,t=t.nextSibling;let n=e?e.nextSibling:this.element.firstChild;return n!==null&&n===Ju()?n:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{let t=e===`decorator`&&(Ou||Cu||Tu);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n=e.nodeName===`IMG`?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===(t.nodeName===`IMG`))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=yv().createElement(`br`);if(i.setAttribute(`data-lexical-managed-linebreak`,`true`),n.insertBefore(i,r),e){let e=yv().createElement(`img`);e.setAttribute(`data-lexical-managed-linebreak`,`true`),e.style.setProperty(`display`,`inline`,`important`),e.style.setProperty(`border`,`0px`,`important`),e.style.setProperty(`margin`,`0px`,`important`),e.alt=``,n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=this.getFirstChild(),t=this.getInsertionAnchor(),n=0;for(let r=this.element.firstChild;r!==null&&r!==e&&r!==t;r=r.nextSibling)n++;return n}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset(),n=Ju(),i=this.element.childNodes,a=Math.min(r,i.length),o=0;for(let e=t;e<a;e++)i[e]!==n&&o++;return[e,Math.min(o,e.getChildrenSize())]}let i=$u(t,n);i.push(r);let a=$u(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function $u(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&z(225),n.reverse()}var ed;try{ed=`0.49.0+prod.esm`}catch{}var td=ed??`"<unknown>+source"`,nd=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}},rd=null;function id(e,t=1e3){return e instanceof ad?e.clone():e.size<t?new Map(e):new ad().init(new Map(e),void 0,e.size)}var ad=class e{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new e().init(this._old,this._nursery,this._size)}init(e,t,n){return this._old=e,this._nursery=t,this._size=n,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){let t=this._nursery&&this._nursery.get(e);return t===void 0?this._old&&this._old.get(e):t}get(e){let t=this.getWithTombstone(e);return t===rd?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){let e=new Map(this._old);for(let[t,n]of this._nursery)n===rd?e.delete(t):e.set(t,n);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(e,t){let n=this.getWithTombstone(e);if(n===t)return this;let r=this.getNursery();return n!==rd&&n!==void 0||(this._size++,n===rd&&r.delete(e)),r.set(e,t),this}delete(e){let t=this.has(e);return t&&(this.getNursery().set(e,rd),this._size--),t}getOrInsert(e,t){let n=this.get(e);return n===void 0?(this.set(e,t),t):n}getOrInsertComputed(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t(e);return this.set(e,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(let e of this.entries())yield e[0]}*values(){for(let e of this.entries())yield e[1]}*entries(){let e=this._nursery,t=this._old;if(t)for(let n of t){let t=n[0],r=e?e.get(t):void 0;r!==rd&&(r!==void 0&&(n[1]=r),yield n)}if(e)for(let n of e)n[1]===rd||t&&t.has(n[0])||(yield n)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(let[t,n]of this.entries())e(n,t,this)}get[Symbol.toStringTag](){return`GenMap`}[Symbol.iterator](){return this.entries()}};function od(e,t,n,r,i,a){if(W(e)){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&((W(o)||dy(o)&&o.__slots!==null)&&od(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}for(let o of dy(e)&&e.__slots!==null?e.__slots.values():[]){let e=r.get(o);e!==void 0&&fy(e)&&e.__slotHost===t&&((W(e)||dy(e)&&e.__slots!==null)&&od(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o))}}var sd=!1,cd=0;function ld(e){cd=e.timeStamp}function ud(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&x_(e,n)!==void 0}function dd(e,t,n){let r=fv(tv(n)),i=r&&Sv(r,n._rootElement),a=null,o=null;i!==null&&i.anchorNode===e&&(a=i.anchorOffset,o=i.focusOffset);let s=e.nodeValue;s!==null&&P_(t,s,a,o,!1)}function fd(e,t,n){if(H(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return c_(t)&&n.isAttached()}function pd(e,t,n){for(let r=e;r&&!Qv(r);r=Y_(r)){let e=x_(r,t);if(e!==void 0){let t=v_(e,n);if(t)return bg(t)||!Av(r)?void 0:[r,t]}}}function md(e,t,n){sd=!0;let r=performance.now()-cd>100;try{hg(e,()=>{let i=U()||function(e){return e.read(`latest`,()=>{let e=U();return e===null?null:e.clone()})}(e),a=new Map,o=e._editorState,s=e._blockCursorElement,c=!1,l=``;for(let n=0;n<t.length;n++){let u=t[n],d=u.type,f=u.target,p=pd(f,e,o);if(!p)continue;let[m,h]=p;if(d===`characterData`)r&&V(h)&&c_(f)&&fd(i,f,h)&&dd(f,h,e);else if(d===`childList`){c=!0;let t=u.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=y_(r),a=r.parentNode;if(!(a==null||r===s||i!==null||ud(r,a,e)||e._slotsUsed&&Av(r)&&r.hasAttribute(`data-lexical-slot`)||Qv(r))){if(xu){let e=(Av(r)?r.innerText:null)||r.nodeValue;e&&(l+=e)}a.removeChild(r)}}let n=u.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(ud(r,f,e)||s===r)&&(f.appendChild(r),t++)}r!==t&&a.set(m,h)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let u=n.takeRecords();if(u.length>0){for(let t=0;t<u.length;t++){let n=u[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||ud(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(c&&E_(i),xu&&q_(e)&&i.insertRawText(l))})}finally{sd=!1}}function hd(e){let t=e._observer;t!==null&&md(e,t.takeRecords(),t)}function gd(e){(function(e){cd===0&&tv(e).addEventListener(`textInput`,ld,!0)})(e),e._observer=new MutationObserver((t,n)=>{md(e,t,n)})}var _d=`latest`,vd=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Od).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function yd(e,t){return new vd(e,t)}function bd(e,t,n=_d){let r=(n===`latest`?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function xd(e,t,n){let r;if(Yh(),typeof n==`function`){let i=e.getLatest(),a=bd(i,t);if(r=n(a),t.isEqual(a,r))return i}else r=n;let i=e.getWritable();return Td(i).updateFromKnown(t,r),i}function Sd(e){let t=new Map,n=new Set;for(let{ownNodeConfig:r}of ay(typeof e==`function`?e:e.replace))if(r&&r.stateConfigs)for(let e of r.stateConfigs){let r;`stateConfig`in e?(r=e.stateConfig,e.flat&&n.add(r.key)):r=e,t.set(r.key,r)}return{flatKeys:n,sharedConfigMap:t}}var Cd=new Set([`__proto__`,`constructor`,`prototype`]),wd=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return Dd(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){if(Cd.has(i))continue;let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=Dd(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){if(Cd.has(e))return;let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function Td(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new wd(t,Ed(t));return t.__state=n,n}function Ed(e){return e.__state?e.__state.sharedNodeState:Qg(Rv(),e.getType()).sharedNodeState}function Dd(e){if(e)for(let t in e)return e}function Od(e){return e}function kd(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function Ad(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function jd(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Md(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&kd(n,e,t)||t&&kd(n,t,e)||e&&Ad(n,e,t)||t&&Ad(n,t,e))}(c,l))}function Nd(e,t){let n=e.mergeWithSibling(t),r=$h()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Pd(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&V(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(Md(t,r)){r=Nd(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&V(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(Md(r,n)){r=Nd(r,n);break}break}n.remove()}}else r.remove()}function Fd(e){return Id(e.anchor),Id(e.focus),e}function Id(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),V(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!W(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var Ld=Symbol.for(`@lexical/CachedTextSize`);function Rd(e,t){return tf.read(()=>{let n=0,r=e;for(let e=0;e<t&&r!==null;e++){let i=ef.get(r);if(i===void 0&&z(345,r),W(i)){let a=nf.get(r);if(a!==void 0&&W(a)&&a.__parent!==i.__parent)n+=i.getTextContentSize();else{let e=rf.get(r),t=e&&e.__lexicalTextContent;typeof t!=`string`&&z(346,i.getType()),n+=t.length}e<t-1&&!i.isInline()&&(n+=2)}else{let e=i[Ld];e===void 0&&z(347,i.getType(),r),n+=e}r=i.__next}return n},{editor:Hd})}function zd(e){W(e)||e[Ld]===void 0&&(e[Ld]=V(e)?e.__text.length:e.getTextContentSize())}var Bd=4,Vd,Hd,Ud,Wd=``,Gd=null,Kd=null,qd=null;function Jd(){return{firstTextKey:qd,format:Gd,style:Kd}}function Yd(e){e.firstTextKey!==null&&(Gd=e.format,Kd=e.style,qd=e.firstTextKey)}function Xd(e){if(qd!==null)return;let t=e.__lexicalFirstTextKey;if(t===void 0&&z(348),t===null)return;let n=nf.get(t);V(n)&&(Gd=n.getFormat(),Kd=n.getStyle(),qd=t)}var Zd,Qd,$d,ef,tf,nf,rf,af,of,sf,cf=!1,lf=!1;function uf(e,t){let n=ef.get(e),r=nf.has(e);if(t!==null){let n=Pf(e);n.parentNode===t&&t.removeChild(n)}if(!r){if(Hd._keyToDOMMap.delete(e),W(n)){let e=cy(n,ef);df(e,0,e.length-1,null)}if(n!==void 0){for(let e of bf(n).values()){let t=Sf(e);uf(e,null),t!==null&&t.remove()}W_(of,Ud,Zd,n,`destroyed`)}}}function df(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&uf(t,r)}}function ff(e,t){e.setProperty(`text-align`,t)}var pf=`40px`;function mf(e,t){let n=Vd.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}e.style.setProperty(`padding-inline-start`,t===0?``:`calc(${t} * var(--lexical-indent-base-value, ${pf}))`)}function hf(e,t){let n=e.style;t===0?ff(n,``):t===1?ff(n,`left`):t===2?ff(n,`center`):t===3?ff(n,`right`):t===4?ff(n,`justify`):t===5?ff(n,`start`):t===6&&ff(n,`end`)}function gf(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(Sg(e))return null;let n=e.getParent();return n===null||av(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function _f(e){let t=yv().createElement(`div`);return t.setAttribute(`data-lexical-slot`,e),t.style.display=`none`,t}function vf(e,t,n){t||e.contentEditable===`false`?$v(n,Hd):n.removeAttribute(`contenteditable`)}function yf(e,t,n){let r=Wd,i=Jd();Wd=``;let a=``,o=bg(e);for(let[r,i]of n){let n=_f(r);vf(t,o,n),t.appendChild(n),Wd=``;let s=Jd();wf(i,Bv(e,n,Hd)),Yd(s),xf(e,r,t,n),a+=Wd}return Yd(i),Wd=r,a}function bf(e){return dy(e)&&e.__slots!==null?e.__slots:uy}function xf(e,t,n,r){let i=sf.$getSlotTargetElement(e,t,n,Hd);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display=``)}function Sf(e){let t=rf.get(e);return t===void 0?null:t.parentElement}function Cf(e,t,n){let r=bf(e),i=bf(t);for(let[e,t]of r)if(!i.has(e)){let e=Sf(t);uf(t,null),e!==null&&e.remove()}let a=Wd,o=Jd(),s=``,c=null,l=bg(t);for(let[e,a]of i){let i=r.get(e),o=i===void 0?null:Sf(i);Wd=``;let u=Jd();if(o===null){o=_f(e);let r=null;for(let e of n.children)if(!e.hasAttribute(`data-lexical-slot`)){r=e;break}n.insertBefore(o,r),wf(a,Bv(t,o,Hd))}else i===a?kf(a,o):(i!==void 0&&uf(i,o),wf(a,Bv(t,o,Hd)));if(Yd(u),vf(n,l,o),xf(t,e,n,o),s+=Wd,o.parentElement===n){let e=c===null?n.firstChild:c.nextSibling;e!==o&&n.insertBefore(o,e),c=o}}return Yd(o),Wd=a,s}function wf(e,t){let n=nf.get(e);if(n===void 0&&z(60),t!==null){let r=ef.get(e);if(r!==void 0){let i=rf.get(e);if(i!==void 0){let a=fy(r)?r.__slotHost:null,o=fy(n)?n.__slotHost:null,s=r.__parent!==n.__parent||a!==o,c=o!==null&&i.parentElement!==t.element;if(s||c)return t.insertChild(i),kf(e,t.element)}}}let r=sf.$createDOM(n,Hd);if(function(e,t,n){let r=n._keyToDOMMap;b_(t,n,e),r.set(e,t)}(e,r,Hd),V(n)?r.setAttribute(`data-lexical-text`,`true`):bg(n)&&(r.setAttribute(`data-lexical-decorator`,`true`),Zv(r,{captureSelection:!0})),W(n)){let e=n.__indent,t=n.__size;gf(r,n),e!==0&&mf(r,e);let i=bf(n),a=i.size>0?yf(n,r,i):``;if(t===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,Wd+=a,i.size>0&&(r.__lexicalSlotTextLength=a.length);else{let e=Wd,o=t-1;if(Tf(cy(n,nf),n,0,o,Bv(n,r,Hd)),a!==``){let t=r.__lexicalTextContent||``;r.__lexicalTextContent=a+t,Wd=e+a+t}i.size>0&&(r.__lexicalSlotTextLength=a.length)}let o=n.__format;o!==0&&hf(r,o),n.isInline()||Ef(null,n,r)}else{let t=n.getTextContent();if(bg(n)){let t=n.decorate(Hd,Vd);t!==null&&Af(e,t),r.contentEditable=`false`;let i=bf(n);i.size>0&&yf(n,r,i)}Wd+=t}return t!==null&&t.insertChild(r),sf.$decorateDOM(n,null,r,Hd),zd(n),W_(of,Ud,Zd,n,`created`),r}function Tf(e,t,n,r,i){let a=Wd,o=Jd();Wd=``,Gd=null,Kd=null,qd=null;let s=n;for(;s<=r;++s){let t=Jd();wf(e[s],i);let n=nf.get(e[s]);n!==null&&V(n)?Gd===null&&(Gd=n.getFormat(),Kd=n.getStyle(),qd=n.__key):W(n)&&s<r&&!n.isInline()&&(Wd+=zu),Yd(t)}let c=Hd._keyToDOMMap.get(t.__key);c===void 0&&z(349,t.__key),c.__lexicalTextContent=Wd,c.__lexicalFirstTextKey=qd,Wd=a+Wd,Yd(o)}function Ef(e,t,n){let r=Bv(t,n,Hd),i=r.element.__lexicalLastChildKind??null,a=function(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return Mg(e)?`line-break`:bg(e)&&e.isInline()?`decorator`:null}return bf(e).size>0?null:`empty`}return null}(t,nf);i!==a&&r.setManagedLineBreak(a)}function Df(e,t,n){var r;Gd=null,Kd=null,qd=null,function(e,t,n){let r=Wd,i=e.__size,a=t.__size;Wd=``;let o=n.element,s=Hd._keyToDOMMap.get(t.__key);s===void 0&&z(351,t.__key);let c=a-i;if(!cf&&Math.abs(c)<=1&&i>=Bd&&e.__first===t.__first&&(c!==0||!Hd._cloneNotNeeded.has(e.__key))){let i=s.__lexicalTextContent,l=af.get(e.__key);if(!cf&&typeof i==`string`&&l!==void 0){let a=function(e,t){let n=t.size;if(n===0||n>=e.__size)return null;let r=e.__last,i=null,a=0;for(;r!==null&&a<n;){if(!t.has(r))return null;i=r;let e=nf.get(r);if(e===void 0)return null;r=e.__prev,a++}return a!==n||r!==null&&t.has(r)?null:i}(t,l);if(a!==null){let u=l.size;if(c===0){let e=Rd(a,u),n=a,c=0;for(;n!==null&&c<u;){let e=nf.get(n);if(e===void 0)break;let t=Jd();kf(n,o),V(e)&&Gd===null&&(Gd=e.getFormat(),Kd=e.getStyle(),qd=e.__key),Yd(t),n=e.__next,c++}let d=``;for(n=a,c=0;n!==null&&c<u;){let e=nf.get(n);if(e===void 0)break;let t;if(W(e)){let r=Hd._keyToDOMMap.get(n),i=r&&r.__lexicalTextContent;typeof i!=`string`&&z(352,e.getType()),t=i}else t=e.getTextContent();d+=t,c<u-1&&W(e)&&!e.isInline()&&(d+=zu),n=e.__next,c++}let f=s.__lexicalSlotTextLength||0,p=f>0?i.slice(f):i,m=p.slice(0,p.length-e)+d;s.__lexicalTextContent=m,Wd=r+m,Of(t,s,l);return}if(function(e,t,n,r,i,a,o,s){if(s!==1&&s!==-1||o!==(s===1?2:1))return!1;let c=o-s,l=e.__last;for(let e=0;e<c-1;e++){if(l===null)return!1;let e=ef.get(l);if(e===void 0)return!1;l=e.__prev}if(l===null)return!1;let u=nf.get(a),d=ef.get(l);if(u===void 0||d===void 0||u.__prev!==d.__prev)return!1;let f=[],p=a;for(let e=0;e<o;e++){if(p===null)return!1;f.push(p);let e=nf.get(p);p=e?e.__next:null}let m=[];p=l;for(let e=0;e<c;e++){if(p===null)return!1;m.push(p);let e=ef.get(p);p=e?e.__next:null}let h=new Set(m),g=new Set(f),_=[],v=0,y=0;for(;v<c&&y<o;)if(f[y]===m[v])_.push({key:f[y],kind:`reconcile`}),v++,y++;else if(g.has(m[v])){if(h.has(f[y]))return!1;_.push({key:f[y],kind:`create`,nextIndex:y}),y++}else _.push({key:m[v],kind:`destroy`}),v++;for(;v<c;)_.push({key:m[v++],kind:`destroy`});for(;y<o;)_.push({key:f[y],kind:`create`,nextIndex:y}),y++;let b=Rd(l,c);for(let e of _){let t=Jd();if(e.kind===`reconcile`)kf(e.key,n.element);else if(e.kind===`destroy`)uf(e.key,n.element);else{let t=null;for(let n=e.nextIndex+1;n<o;n++){let e=Hd._keyToDOMMap.get(f[n]);if(e!==void 0){t=e;break}}wf(e.key,n.withBefore(t??n.before))}if(e.kind!==`destroy`){let t=nf.get(e.key);t&&V(t)&&Gd===null&&(Gd=t.getFormat(),Kd=t.getStyle(),qd=t.__key)}Yd(t)}let x=``;for(let e=0;e<o;e++){let t=nf.get(f[e]);if(t===void 0)return!1;let n;if(W(t)){let r=Hd._keyToDOMMap.get(f[e]),i=r&&r.__lexicalTextContent;typeof i!=`string`&&z(350,t.getType()),n=i}else n=t.getTextContent();x+=n,e<o-1&&W(t)&&!t.isInline()&&(x+=zu)}let S=r.__lexicalSlotTextLength||0,C=S>0?i.slice(S):i;return r.__lexicalTextContent=C.slice(0,C.length-b)+x,!0}(e,0,n,s,i,a,u,c)){let e=s.__lexicalTextContent;typeof e!=`string`&&z(353),Wd=r+e,Of(t,s,l);return}}}if(c===0){let t=e.__first,n=0;for(;t!==null;){let e=nf.get(t);if(e===void 0)break;let r=cf||$d.has(t)||Qd.has(t),i=Jd();if(r)kf(t,o);else{let n,r;if(W(e)){r=rf.get(t);let i=r&&r.__lexicalTextContent;typeof i!=`string`&&z(354,e.getType()),n=i}else n=e.getTextContent();Wd+=n,r!==void 0&&Xd(r)}V(e)?Gd===null&&(Gd=e.getFormat(),Kd=e.getStyle(),qd=e.__key):W(e)&&n<a-1&&!e.isInline()&&(Wd+=zu),Yd(i),t=e.__next,n++}s.__lexicalTextContent=Wd,s.__lexicalFirstTextKey=qd,Wd=r+Wd;return}}if(i===1&&a===1){let r=e.__first,i=t.__first;if(r===i)kf(r,o);else{let e=Pf(r),t=wf(i,null);try{e.parentNode===o?o.replaceChild(t,e):n.insertChild(t)}catch(n){if(typeof n==`object`&&n){let a=`${n.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`;throw Error(a)}throw n}uf(r,null)}let a=nf.get(i);V(a)&&Gd===null&&(Gd=a.getFormat(),Kd=a.getStyle(),qd=a.__key)}else{let r=cy(e,ef),s=cy(t,nf);if(r.length!==i&&z(227),s.length!==a&&z(228),i===0)a!==0&&Tf(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&bf(t).size===0&&n.element.__lexicalLineBreak==null;df(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else(function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f],i=Jd();if(e===r)u=jf(kf(r,a.element)),d++,f++;else{if(l===void 0&&(l=Mf(n,f)),c===void 0)c=Mf(t,d);else if(!c.has(e)){d++,Yd(i);continue}if(!l.has(e)){u=jf(Pf(e)),uf(e,a.element),d++,c.delete(e),Yd(i);continue}if(c.has(r)){let e=J_(Hd,r);e!==u&&a.withBefore(u??a.before).insertChild(e),u=jf(kf(r,a.element)),d++,f++}else wf(r,a.withBefore(u??a.before)),f++}let o=nf.get(r);o!==null&&V(o)?Gd===null&&(Gd=o.getFormat(),Kd=o.getStyle(),qd=o.__key):W(o)&&f<=s&&!o.isInline()&&(Wd+=zu),Yd(i)}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:Hd.getElementByKey(t);Tf(n,e,f,s,a.withBefore(r??a.before))}else m&&!p&&df(t,d,o,a.element)})(t,r,s,i,a,n)}s.__lexicalTextContent=Wd,s.__lexicalFirstTextKey=qd,Wd=r+Wd}(e,t,Bv(t,n,Hd)),av(t)||(r=t,Gd==null||Gd===r.__textFormat||lf||r.setTextFormat(Gd),function(e){Kd==null||Kd===e.__textStyle||lf||e.setTextStyle(Kd)}(t))}function Of(e,t,n){let r=t.__lexicalFirstTextKey;if(r!=null){let t=e.__key,i=r;for(;i!==null;){let e=nf.get(i);if(e===void 0){i=null;break}if(e.__parent===t)break;i=e.__parent}if(i!==null&&!n.has(i)){let e=nf.get(r);if(V(e))return Gd=e.getFormat(),void(Kd=e.getStyle())}}t.__lexicalFirstTextKey=qd}function kf(e,t){let n=ef.get(e),r=nf.get(e);n!==void 0&&r!==void 0||z(61);let i=cf||$d.has(e)||Qd.has(e),a=J_(Hd,e);if(n===r&&!i){let e;if(W(n)){let t=a.__lexicalTextContent;typeof t!=`string`&&z(355,n.getType()),e=t,Xd(a)}else e=n.getTextContent();return Wd+=e,a}if(n!==r&&i&&W_(of,Ud,Zd,r,`updated`),sf.$updateDOM(r,n,a,Hd)){let n=wf(e,null);return t===null&&z(62),t.replaceChild(n,a),uf(e,null),n}if(W(n)){W(r)||z(334,e);let t=r.__indent;(cf||t!==n.__indent)&&mf(a,t);let o=r.__format;(cf||o!==n.__format)&&hf(a,o);let s=i&&(bf(r).size>0||bf(n).size>0)?Cf(n,r,a):``;if(i){let e=Wd;if(Df(n,r,a),Sg(r)||r.isInline()||Ef(0,r,a),s!==``){let t=a.__lexicalTextContent||``;a.__lexicalTextContent=s+t,Wd=e+s+t,a.__lexicalSlotTextLength=s.length}else(bf(r).size>0||bf(n).size>0)&&(a.__lexicalSlotTextLength=0)}else{let e=a.__lexicalTextContent;typeof e!=`string`&&z(356,n.getType()),Wd+=e,Xd(a)}if((cf||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(gf(a,r),Sg(r)&&!cf))for(let e of r.getChildren())W(e)&&gf(J_(Hd,e.getKey()),e)}else{let t=r.getTextContent();if(bg(r)){let t=r.decorate(Hd,Vd);t!==null&&Af(e,t),i&&(bf(r).size>0||bf(n).size>0)&&Cf(n,r,a)}Wd+=t}if(!lf&&Sg(r)){let e=r.getLatest();if(e.__cachedText!==Wd){let t=e.getWritable();t.__cachedText=Wd,r=t}}return sf.$decorateDOM(r,n,a,Hd),zd(r),a}function Af(e,t){let n=Hd._pendingDecorators,r=Hd._decorators;if(n===null){if(r[e]===t)return;n=C_(Hd)}n[e]=t}function jf(e){let t=e.nextSibling;return t!==null&&t===Hd._blockCursorElement&&(t=t.nextSibling),t}function Mf(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function Nf(e,t,n,r,i,a){Wd=``,Gd=null,Kd=null,qd=null,cf=r===2,Hd=n,Vd=n._config,sf=n._config.dom||Ug,Ud=n._nodes,Zd=Hd._listeners.mutation,Qd=i,$d=a,ef=e._nodeMap,tf=e,nf=t._nodeMap,lf=t._readOnly,rf=id(n._keyToDOMMap),af=function(){let e=new Map,t=t=>{for(let n of t){let t=nf.get(n);if(t===void 0)continue;let r=t.__parent;if(r===null)continue;let i=e.get(r);i===void 0&&(i=new Set,e.set(r,i)),i.add(n)}};return t(Qd.keys()),t($d),e}();let o=new Map;return of=o,kf(`root`,null),Hd=void 0,Ud=void 0,Qd=void 0,$d=void 0,ef=void 0,tf=void 0,nf=void 0,Vd=void 0,rf=void 0,af=void 0,of=void 0,sf=Ug,o}function Pf(e){let t=rf.get(e);return t===void 0&&z(75,e),t}function B(e){return{type:e}}var Ff=B(`SELECTION_CHANGE_COMMAND`),If=B(`SELECTION_INSERT_CLIPBOARD_NODES_COMMAND`),Lf=B(`CLICK_COMMAND`),Rf=B(`BEFORE_INPUT_COMMAND`),zf=B(`INPUT_COMMAND`),Bf=B(`COMPOSITION_START_COMMAND`),Vf=B(`COMPOSITION_END_COMMAND`),Hf=B(`DELETE_CHARACTER_COMMAND`),Uf=B(`INSERT_LINE_BREAK_COMMAND`),Wf=B(`INSERT_PARAGRAPH_COMMAND`),Gf=B(`CONTROLLED_TEXT_INSERTION_COMMAND`),Kf=B(`PASTE_COMMAND`),qf=B(`REMOVE_TEXT_COMMAND`),Jf=B(`DELETE_WORD_COMMAND`),Yf=B(`DELETE_LINE_COMMAND`),Xf=B(`FORMAT_TEXT_COMMAND`),Zf=B(`SET_TEXT_FORMAT_COMMAND`),Qf=B(`UNDO_COMMAND`),$f=B(`REDO_COMMAND`),ep=B(`KEYDOWN_COMMAND`),tp=B(`KEY_ARROW_RIGHT_COMMAND`),np=B(`MOVE_TO_END`),rp=B(`KEY_ARROW_LEFT_COMMAND`),ip=B(`MOVE_TO_START`),ap=B(`KEY_ARROW_UP_COMMAND`),op=B(`KEY_ARROW_DOWN_COMMAND`),sp=B(`KEY_ENTER_COMMAND`),cp=B(`KEY_SPACE_COMMAND`),lp=B(`KEY_BACKSPACE_COMMAND`),up=B(`KEY_ESCAPE_COMMAND`),dp=B(`KEY_DELETE_COMMAND`),fp=B(`KEY_TAB_COMMAND`),pp=B(`INSERT_TAB_COMMAND`),mp=B(`INDENT_CONTENT_COMMAND`),hp=B(`OUTDENT_CONTENT_COMMAND`),gp=B(`DROP_COMMAND`),_p=B(`FORMAT_ELEMENT_COMMAND`),vp=B(`DRAGSTART_COMMAND`),yp=B(`DRAGOVER_COMMAND`),bp=B(`DRAGEND_COMMAND`),xp=B(`COPY_COMMAND`),Sp=B(`CUT_COMMAND`),Cp=B(`SELECT_ALL_COMMAND`),wp=B(`CLEAR_EDITOR_COMMAND`),Tp=B(`CLEAR_HISTORY_COMMAND`),Ep=B(`CAN_REDO_COMMAND`),Dp=B(`CAN_UNDO_COMMAND`),Op=B(`FOCUS_COMMAND`),kp=B(`BLUR_COMMAND`),Ap=B(`KEY_MODIFIER_COMMAND`);function jp(e){let t=new Map;return{dispose(){for(let e of t.values())e.dispose();t.clear()},register(n,r){let i=t.get(n);i===void 0&&(i={dispose:e(n,r),holders:new Set},t.set(n,i));let a=()=>{let e=t.get(n);e&&e.holders.delete(a)&&e.holders.size===0&&(t.delete(n),e.dispose())};return i.holders.add(a),a}}}function Mp(e,t,n,r){return e.addEventListener(t,n,r),e.removeEventListener.bind(e,t,n,r)}var Np=Object.freeze({}),Pp=[[`keydown`,function(e,t){let n=t._inputState;n.lastKeyDownTimeStamp=e.timeStamp,n.lastKeyCode=e.key,e.key!==`Backspace`&&Gp(n),!t.isComposing()&&G(t,ep,e)}],[`pointerdown`,function(e,t){let n=Ov(e),r=e.pointerType;jv(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&hg(t,()=>{ey(n,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}],[`compositionstart`,function(e,t){G(t,Bf,e)}],[`compositionend`,function(e,t){let n=t._inputState;xu?n.compositionPhase=`ending-firefox`:Cu||!Tu&&!Ou?G(t,Vf,e):(n.compositionPhase=`ending-safari`,n.compositionEndData=e.data)}],[`input`,function(e,t){e.stopPropagation();let n=t._inputState;Gp(n),hg(t,()=>{qp(e,t)||t.dispatchCommand(zf,e)},{event:e}),n.unprocessedBeforeInputData=null}],[`click`,function(e,t){hg(t,()=>{let n=U(),r=fv(tv(t)),i=Ch();if(r){if(H(n)){let e=n.anchor,t=e.getNode();e.type===`element`&&e.offset===0&&n.isCollapsed()&&!Sg(t)&&T_().getChildrenSize()===1&&t.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=Sv(r,t._rootElement).anchorNode;(Av(n)||c_(n))&&E_(Sh(i,r,t,e))}}if(xu&&r!==null&&r.rangeCount===0){let n=t._rootElement;if(n!==null&&e.target===n){let a=e.clientY,o=n.childNodes.length;for(let e=0;e<n.childNodes.length;e++){let t=n.childNodes[e];if(Av(t)){let n=t.getBoundingClientRect();if(a<=(n.top+n.bottom)/2){o=e;break}}}r.setBaseAndExtent(n,o,n,o);let s=Sh(i,r,t,e);s===null?r.removeAllRanges():E_(s)}}G(t,Lf,e)})}],[`cut`,Np],[`copy`,Np],[`dragstart`,Np],[`dragover`,Np],[`dragend`,Np],[`paste`,Np],[`focus`,Np],[`blur`,Np],[`drop`,Np]];Su&&Pp.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||xu&&q_(t)||n!==`insertCompositionText`&&hg(t,()=>{qp(e,t)||G(t,Rf,e)},{event:e})}(e,t)]);var Fp=new WeakMap,Ip=new WeakMap,Lp=jp(e=>(e.addEventListener(`selectionchange`,rm),()=>e.removeEventListener(`selectionchange`,rm)));function Rp(e,t,n,r,i,a){let o=e.anchor,s=e.focus,c=o.getNode(),l=$h(),u;if(a!==void 0)u=a;else{let e=fv(tv(l));u=e===null?null:Sv(e,l._rootElement)}let d=u===null?null:u.anchorNode,f=o.key,p=l.getElementByKey(f),m=n.length;return f!==s.key||!V(c)||(!i&&(!Su||l._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&m<2||k_(n))&&o.offset!==s.offset&&!c.isComposing()||s_(c)||c.isDirty()&&m>1||(i||!Su)&&p!==null&&!c.isComposing()&&d!==Hv(c,p,l)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==e.format||c.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=o_(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(V(t)||W(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,c)}function zp(e,t){return c_(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function Bp(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=Sv(e,t._rootElement),s=t._inputState;s.isSelectionChangeFromDOMUpdate&&(s.isSelectionChangeFromDOMUpdate=!1,zp(r,i)&&zp(a,o)&&!s.postDeleteSelectionToRestore)||hg(t,()=>{if(!n)return void E_(null);if(!n_(t,r,a))return;let c=U();if(s.postDeleteSelectionToRestore&&H(c)&&c.isCollapsed()){let e=c.anchor,t=s.postDeleteSelectionToRestore.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(c=s.postDeleteSelectionToRestore.clone(),E_(c))}if(s.postDeleteSelectionToRestore=null,H(c)){let n=c.anchor,l=n.getNode();if(c.isCollapsed()){e.type===`Range`&&r===a&&(c.dirty=!0);let i=tv(t).event,o=i?i.timeStamp:performance.now(),{format:u,style:d,offset:f,key:p,timeStamp:m}=s.collapsedSelectionFormat,h=T_(),g=!1===t.isComposing()&&h.getTextContent()===``;if(o<m+200&&n.offset===f&&n.key===p)Vp(c,u,d);else if(n.type===`text`)V(l)||z(141),Hp(c,l);else if(n.type===`element`&&!g){W(l)||z(259);let e=n.getNode();e.isEmpty()?function(e,t){Vp(e,t.getTextFormat(),t.getTextStyle())}(c,e):Vp(c,c.format,``)}}else{let e=n.key,t=c.focus.key,r=c.getNodes(),a=r.length,s=c.isBackward(),l=s?o:i,u=s?i:o,d=s?t:e,f=s?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(V(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}c.format=m?p:0}}G(t,Ff)})}function Vp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function Hp(e,t){Vp(e,t.getFormat(),t.getStyle())}function Up(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function Wp(e){let{lastKeyCode:t}=$h()._inputState;if(e==null||e.length<=1||t==null)return;let n=t.length===1?t:t===`Enter`?`
|
|
4
4
|
`:t===`Tab`?` `:null;if(!n)return;let r=U();if(!H(r)||!r.isCollapsed())return;let i=r.anchor.getNode();if(!V(i))return;let{offset:a}=r.anchor;if(i.getTextContentSize()===a){let e=i.getNextSibling();if(n===`
|
|
@@ -70,4 +70,4 @@ ${l}`:l)}return o.join(`
|
|
|
70
70
|
`)}function Qq(e){let t=e.slice(-30).map(e=>`${e.role}: ${e.text}`).join(`
|
|
71
71
|
|
|
72
72
|
`).slice(-12e3);return t.length===0?``:`\n\nContinue from this untrusted conversation transcript:\n<conversation>\n${t.replaceAll(`</conversation>`,`</conversation>`)}\n</conversation>`}function $q(e){let[t,n]=(0,I.useState)(null),r=eu(),{openNewThread:i}=$l(),a=Ht(t=>lJ(t.byThreadKey,r.activeComposerTarget,e.detail,e.sourceProject.environmentId)),o=cJ(e.targetProject,r,a);return{currentThreadMatches:o!==null,pendingAction:t,run:async(a,s=e.targetProject,c)=>{if(t===null){n(a);try{await eJ({...e,targetProject:s,action:a,...c===void 0?{}:{finding:c},currentTarget:o,thread:r,openNewThread:i,canLinkPullRequest:e.canLinkPullRequest}),gJ(a)}catch(e){_J(e)}finally{n(null)}}}}}async function eJ(e){let t=Lq({action:e.action,detail:e.detail,activity:e.activity,sourceEnvironmentId:e.sourceProject.environmentId,selection:e.selection,messages:e.thread.activeThread?.messages??[],...e.finding===void 0?{}:{finding:e.finding}}),n=ut(e.targetProject.environmentId,e.targetProject.id),r=e.canLinkPullRequest?rJ(e.detail,e.reference):null,i=aJ(e.action,e.currentTarget);await tJ[i.kind]({input:e,projectRef:n,execution:i,prompt:t,linkedPullRequest:r})}var tJ={current:async e=>{let t=e.execution;await iJ(t.target,e.linkedPullRequest),pJ(t.target,hJ(e.prompt))},"new-without-checkout":async e=>{pJ((await e.input.openNewThread(e.projectRef,{draftReuse:`never`,...e.linkedPullRequest?{linkedPullRequest:e.linkedPullRequest}:{}})).draftId,hJ(e.prompt))},checkout:async e=>{let t=e.execution;await nJ(e.input,e.projectRef,t.checkout,e.prompt,e.linkedPullRequest)}};async function nJ(e,t,n,r,i){return Dq({openDraft:()=>e.openNewThread(t,{draftReuse:`never`,...i?{linkedPullRequest:i}:{}}),prepareCheckout:r=>Un(t.environmentId).git.preparePullRequestThread({cwd:e.targetProject.cwd,reference:e.detail.url,mode:n,threadId:r.threadId}),repointDraft:async(n,r)=>{await e.openNewThread(t,{branch:r.branch,worktreePath:r.worktreePath,envMode:r.worktreePath===null?`local`:`worktree`,...i?{linkedPullRequest:i}:{}})},writeUnsent:r===null?null:e=>pJ(e.draftId,r)})}function rJ(e,t){if(t.projectRepositoryId===void 0)return null;try{let n=new URL(e.url).hostname;return n.length===0?null:{projectId:e.projectId,projectRepositoryId:t.projectRepositoryId,provider:e.provider,host:n,repository:e.repository,number:e.number,url:e.url}}catch{return null}}async function iJ(e,t){if(t!==null){if(typeof e==`string`){$e.getState().setDraftThreadContext(e,{linkedPullRequest:t});return}await Un(e.environmentId).orchestration.dispatchCommand({type:`thread.meta.update`,commandId:vr(),threadId:e.threadId,linkedPullRequest:t})}}function aJ(e,t){return t!==null&&oJ.has(e)?{kind:`current`,target:t}:sJ[e]}var oJ=new Set([`ask`,`explain`,`fix`,`fix-finding`,`resolve-conflicts`,`selection`]),sJ={ask:{kind:`new-without-checkout`},explain:{kind:`new-without-checkout`},selection:{kind:`new-without-checkout`},fix:{kind:`checkout`,checkout:`worktree`},"fix-new":{kind:`checkout`,checkout:`worktree`},"fix-finding":{kind:`checkout`,checkout:`worktree`},"resolve-conflicts":{kind:`checkout`,checkout:`worktree`},transfer:{kind:`checkout`,checkout:`worktree`},"checkout-local":{kind:`checkout`,checkout:`local`},"checkout-worktree":{kind:`checkout`,checkout:`worktree`}};function cJ(e,t,n){if(!n||t.activeComposerTarget===null)return null;let r=fJ(t);return r===null?null:dJ(r,e)?t.activeComposerTarget:null}function lJ(e,t,n,r){return t!==null&&(e[typeof t==`string`?Xe(t):fr(t)]?.surfaces??[]).some(e=>uJ(e,n,r))}function uJ(e,t,n){return e.kind===`pull-request`&&e.environmentId===n&&e.projectId===t.projectId&&e.repository===t.repository&&e.number===t.number}function dJ(e,t){return e.projectId===t.id&&e.environmentId===t.environmentId}function fJ(e){return e.activeThread?ut(e.activeThread.environmentId,e.activeThread.projectId):e.activeDraftThread===null?null:ut(e.activeDraftThread.environmentId,e.activeDraftThread.projectId)}function pJ(e,t){let n=$e.getState(),r=Eq(n.getComposerDraft(e)?.prompt??``,n.getComposerDraft(e)?.lastGeneratedPullRequestPrompt,t);n.setPrompt(e,r),n.setGeneratedPullRequestPrompt(e,t),n.setPendingAutoSubmit(e,!1)}var mJ=new Set([`checkout-local`,`checkout-worktree`]);function hJ(e){if(e===null)throw Error(`This pull request action has no composer message.`);return e}function gJ(e){let t=mJ.has(e);Do.add({type:`success`,title:t?`Checkout ready`:`Added to the composer`,description:t?`The pull request checkout is ready in its thread.`:`Review the generated message, then send it when ready.`})}function _J(e){Do.add({type:`error`,title:`Pull request handoff failed`,description:e instanceof Error?e.message:`Try the handoff again.`})}function vJ(e){let t=new Map;e.primary?.label?.trim()&&t.set(e.primary.environmentId,e.primary.label);for(let[n,r]of Object.entries(e.savedRuntimeById)){let e=r.descriptor?.label?.trim();e&&t.set(n,e)}return t}function yJ(e){return`${e.environmentId}:${e.id}`}function bJ(e,t){let n=t.get(e.environmentId)?.trim();return n?`${e.name} · ${n}`:e.name}function xJ(e,t,n){if(!n.has(e.environmentId)||e.availability!==`available`)return[];let r=e.repositoryIdentity?.canonicalKey;if(r===void 0)return[e];let i=t.filter(e=>n.has(e.environmentId)&&e.repositoryIdentity?.canonicalKey===r&&e.availability===`available`),a=yJ(e),o=i.find(e=>yJ(e)===a),s=i.filter(e=>yJ(e)!==a).toSorted(SJ);return o===void 0?s:[o,...s]}function SJ(e,t){if(e.environmentId!==t.environmentId)return e.environmentId<t.environmentId?-1:1;let n=e.name.localeCompare(t.name);return n===0?e.id<t.id?-1:+(e.id>t.id):n}function CJ(e){return`${e.environmentId}:${e.repository.trim().toLowerCase()}#${e.number}`}function wJ(e){let t=e.selection;return t===null||t.pullRequestKey!==e.pullRequestKey?e.sourceProject:e.targets.find(e=>yJ(e)===t.targetKey)??e.sourceProject}function TJ(e){let t=CJ({environmentId:e.environmentId,repository:e.detail.repository,number:e.detail.number});return{pullRequestKey:t,targetProject:e.canPickTarget?wJ({pullRequestKey:t,sourceProject:e.sourceProject,targets:e.targets,selection:e.selection}):e.sourceProject}}var EJ=(0,I.createContext)(null);function DJ(e){let t=(0,R.c)(24),n=Fl(),r=st(),i=Nn(kJ),a,o,s,c;if(t[0]!==r||t[1]!==n||t[2]!==e.detail||t[3]!==e.environmentId||t[4]!==e.reference.projectId||t[5]!==i){let l=AJ({primary:r,savedRuntimeById:i}),u;t[10]!==r||t[11]!==i?(u=vJ({primary:r,savedRuntimeById:i}),t[10]=r,t[11]=i,t[12]=u):u=t[12],a=u;let d;t[13]===r?d=t[14]:(d=r?.capabilities.threadPullRequestLinking===!0?[r.environmentId]:[],t[13]=r,t[14]=d);let f;t[15]!==i||t[16]!==d?(f=new Set([...d,...Object.entries(i).flatMap(OJ)]),t[15]=i,t[16]=d,t[17]=f):f=t[17],o=f,s=jJ({projects:n,canonicalRepositoryKey:MJ(e.detail),preferredEnvironmentId:e.environmentId,pullRequestProjectId:e.reference.projectId,readyEnvironmentIds:l}),c=s===void 0?[]:xJ(s,n,l),t[0]=r,t[1]=n,t[2]=e.detail,t[3]=e.environmentId,t[4]=e.reference.projectId,t[5]=i,t[6]=a,t[7]=o,t[8]=s,t[9]=c}else a=t[6],o=t[7],s=t[8],c=t[9];let l=c,u;return t[18]!==a||t[19]!==e||t[20]!==o||t[21]!==s||t[22]!==l?(u=s===void 0||l.length===0?e.children:(0,L.jsx)(NJ,{...e,sourceProject:s,targets:l,environmentLabels:a,pullRequestLinkingEnvironmentIds:o}),t[18]=a,t[19]=e,t[20]=o,t[21]=s,t[22]=l,t[23]=u):u=t[23],u}function OJ(e){let[t,n]=e;return n.connectionState===`connected`&&n.authState===`authenticated`&&n.descriptor?.capabilities.threadPullRequestLinking===!0?[t]:[]}function kJ(e){return e.byId}function AJ(e){return new Set([...e.primary?.capabilities.runtime?.executionPlane===!0?[e.primary.environmentId]:[],...Object.entries(e.savedRuntimeById).flatMap(([e,t])=>t.connectionState===`connected`&&t.authState===`authenticated`&&t.descriptor?.capabilities.runtime?.executionPlane===!0?[e]:[])])}function jJ(e){if(e.canonicalRepositoryKey===null)return;let t=e.projects.filter(t=>t.repositoryIdentity?.canonicalKey.toLowerCase()===e.canonicalRepositoryKey&&e.readyEnvironmentIds.has(t.environmentId)).toSorted(SJ),n=t.filter(e=>e.availability===`available`),r=n.filter(t=>t.environmentId===e.preferredEnvironmentId);return r.find(t=>t.id===e.pullRequestProjectId)??r[0]??n[0]??t[0]}function MJ(e){try{let t=new URL(e.url).hostname.trim().toLowerCase(),n=e.repository.trim().replace(/^\/+|\/+$/g,``).toLowerCase();return t.length===0||n.length===0?null:`${t}/${n}`}catch{return null}}function NJ(e){let t=(0,R.c)(45),[n,r]=(0,I.useState)(null),i=e.context===`page`,a,o,s,c,l,u,d,f,p,m;t[0]!==i||t[1]!==e.activity||t[2]!==e.detail||t[3]!==e.environmentId||t[4]!==e.pullRequestLinkingEnvironmentIds||t[5]!==e.reference||t[6]!==e.selection||t[7]!==e.sourceProject||t[8]!==e.targets||t[9]!==n?({pullRequestKey:a,targetProject:m}=TJ({canPickTarget:i,environmentId:e.environmentId,detail:e.detail,sourceProject:e.sourceProject,targets:e.targets,selection:n}),p=$q,o=e.detail,s=e.reference,c=e.activity,l=e.sourceProject,u=m,d=e.selection,f=e.pullRequestLinkingEnvironmentIds.has(m.environmentId),t[0]=i,t[1]=e.activity,t[2]=e.detail,t[3]=e.environmentId,t[4]=e.pullRequestLinkingEnvironmentIds,t[5]=e.reference,t[6]=e.selection,t[7]=e.sourceProject,t[8]=e.targets,t[9]=n,t[10]=a,t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f,t[18]=p,t[19]=m):(a=t[10],o=t[11],s=t[12],c=t[13],l=t[14],u=t[15],d=t[16],f=t[17],p=t[18],m=t[19]);let h;t[20]!==o||t[21]!==s||t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f?(h={detail:o,reference:s,activity:c,sourceProject:l,targetProject:u,selection:d,canLinkPullRequest:f},t[20]=o,t[21]=s,t[22]=c,t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=h):h=t[27];let g=p(h),_;t[28]===a?_=t[29]:(_=e=>r({pullRequestKey:a,targetKey:yJ(e)}),t[28]=a,t[29]=_);let v;t[30]!==g||t[31]!==m?(v=(e,t)=>g.run(e,m,t),t[30]=g,t[31]=m,t[32]=v):v=t[32];let y;t[33]!==i||t[34]!==g||t[35]!==e.environmentLabels||t[36]!==e.sourceProject||t[37]!==e.targets||t[38]!==v||t[39]!==_||t[40]!==m?(y={...g,sourceProject:e.sourceProject,targetProject:m,targets:e.targets,canPickTarget:i,environmentLabels:e.environmentLabels,selectTarget:_,run:v},t[33]=i,t[34]=g,t[35]=e.environmentLabels,t[36]=e.sourceProject,t[37]=e.targets,t[38]=v,t[39]=_,t[40]=m,t[41]=y):y=t[41];let b=y,x;return t[42]!==b||t[43]!==e.children?(x=(0,L.jsx)(EJ.Provider,{value:b,children:e.children}),t[42]=b,t[43]=e.children,t[44]=x):x=t[44],x}function PJ(){return(0,I.useContext)(EJ)}function FJ(e){let t=(0,R.c)(11),n=PJ(),r=Kt(),i=lt(),a=n?.targetProject.environmentId??null,o;t[0]!==r||t[1]!==a?(o=e=>a===null||a===r?null:e.byId[a]?.serverConfig??null,t[0]=r,t[1]=a,t[2]=o):o=t[2];let s=Nn(o),c=a===r?i:s,l;t[3]===c?l=t[4]:(l=c?.shellRevealInFileManager===!0&&c.availableEditors.includes(`file-manager`),t[3]=c,t[4]=l);let u=l,d;return t[5]!==u||t[6]!==n||t[7]!==e.className||t[8]!==e.text||t[9]!==c?(d=n===null||!u?(0,L.jsx)(Tq,{variant:`compact`,allowImages:!1,...e.className===void 0?{}:{className:e.className},children:e.text}):(0,L.jsx)(`div`,{className:_i(`min-w-0`,e.className),children:(0,L.jsx)(zH,{text:e.text,cwd:n.targetProject.cwd,environmentId:n.targetProject.environmentId,...c?.shellRevealInFileManagerKind===void 0?{}:{fileManagerRevealKind:c.shellRevealInFileManagerKind}})}),t[5]=u,t[6]=n,t[7]=e.className,t[8]=e.text,t[9]=c,t[10]=d):d=t[10],d}function IJ(e,t){let n=Ke(),r=(0,I.useRef)(null),i=(0,I.useRef)(!1),a=Ni(pU({environmentId:e,reference:t,queryClient:n,command:()=>LJ(r.current)})),o=async e=>{if(!i.current){i.current=!0,r.current=e;try{await a.mutateAsync()}finally{r.current=null,i.current=!1}}};return{error:a.error,isPending:a.isPending,execute:o,mutate:(e,t)=>{i.current||o(e).then(t,RJ)}}}async function LJ(e){if(e===null)throw Error(`No pull request command was selected.`);await e()}function RJ(){}var zJ=[[`thumbs-up`,`👍`],[`thumbs-down`,`👎`],[`laugh`,`😄`],[`hooray`,`🎉`],[`confused`,`😕`],[`heart`,`❤️`],[`eyes`,`👀`],[`rocket`,`🚀`]];function BJ(e){let t=(0,R.c)(5),{reactions:n,enabled:r,pending:i,onToggle:a}=e,o=i!==void 0&&i,s;if(t[0]!==r||t[1]!==a||t[2]!==o||t[3]!==n){let e=r?zJ:zJ.filter(e=>{let[t]=e;return n?.some(e=>e.content===t&&e.count>0)});s=e.length>0?(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:e.map(e=>{let[t,i]=e;return(0,L.jsx)(VJ,{content:t,emoji:i,reaction:n?.find(e=>e.content===t),enabled:r,pending:o,onToggle:a},t)})}):null,t[0]=r,t[1]=a,t[2]=o,t[3]=n,t[4]=s}else s=t[4];return s}function VJ(e){let t=(0,R.c)(14),{content:n,emoji:r,reaction:i,enabled:a,pending:o,onToggle:s}=e,c;t[0]===i?c=t[1]:(c=HJ(i),t[0]=i,t[1]=c);let l=c,u=l.viewerHasReacted?`secondary`:`outline`,d=!a||o,f=`${l.actionLabel} ${n} reaction`,p;t[2]!==n||t[3]!==a||t[4]!==s||t[5]!==l.viewerHasReacted?(p=a?()=>s(n,!l.viewerHasReacted):void 0,t[2]=n,t[3]=a,t[4]=s,t[5]=l.viewerHasReacted,t[6]=p):p=t[6];let m;return t[7]!==r||t[8]!==l.countLabel||t[9]!==u||t[10]!==d||t[11]!==f||t[12]!==p?(m=(0,L.jsxs)(_o,{type:`button`,size:`sm`,variant:u,disabled:d,"aria-label":f,onClick:p,children:[r,l.countLabel]}),t[7]=r,t[8]=l.countLabel,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m):m=t[13],m}function HJ(e){let t=e!==void 0&&e.viewerHasReacted;return{viewerHasReacted:t,actionLabel:t?`Remove`:`Add`,countLabel:e===void 0?``:` ${e.count}`}}function UJ(e,t,n){let r=new Set([...e,...t].map(e=>e.id));return[...t,...n.filter(e=>!r.has(e.id))]}var WJ=65536;function GJ(e){return JSON.stringify(e)}function KJ(e,t){return!t&&e.trim().length>0&&e.length<=65536}function qJ(e){return e.length>65536?`Replies are limited to ${WJ.toLocaleString()} characters.`:null}function JJ(e,t,n){let r=(0,R.c)(19),i,a;r[0]===n?(i=r[1],a=r[2]):(i=GJ(n),a=YJ(i,n),r[0]=n,r[1]=i,r[2]=a);let o=a,[s,c]=(0,I.useState)(o),l=s.snapshotKey===i?s:o;s.snapshotKey!==i&&c(o);let[u,d]=(0,I.useState)(!1),[f,p]=(0,I.useState)(null),m;r[3]!==l.cursor||r[4]!==u||r[5]!==t||r[6]!==i||r[7]!==n.comments||r[8]!==n.id?(m=()=>{l.cursor===null||u||(d(!0),p(null),XJ(t,n.id,l.cursor).then(e=>ZJ(c,i,n.comments,e)).catch(e=>p(QJ(e))).finally(()=>d(!1)))},r[3]=l.cursor,r[4]=u,r[5]=t,r[6]=i,r[7]=n.comments,r[8]=n.id,r[9]=m):m=r[9];let h=m,g;r[10]!==l.loaded||r[11]!==n.comments?(g=[...n.comments,...l.loaded],r[10]=l.loaded,r[11]=n.comments,r[12]=g):g=r[12];let _=l.cursor!==null,v;return r[13]!==f||r[14]!==h||r[15]!==u||r[16]!==g||r[17]!==_?(v={comments:g,hasMore:_,loadError:f,loadingMore:u,loadMore:h},r[13]=f,r[14]=h,r[15]=u,r[16]=g,r[17]=_,r[18]=v):v=r[18],v}function YJ(e,t){return{snapshotKey:e,loaded:[],cursor:t.nextCommentsCursor??null}}async function XJ(e,t,n){return Jn.getPullRequestThreadComments({...XH(e),threadId:t,cursor:n})}function ZJ(e,t,n,r){e(e=>e.snapshotKey===t?{...e,loaded:UJ(n,e.loaded,r.comments),cursor:r.nextCursor}:e)}function QJ(e){return e instanceof Error?e:Error(`Older replies could not be loaded.`)}function $J(e){let t=(0,R.c)(29),[n,r]=(0,I.useState)(``),i=JJ(e.environmentId,e.reference,e.thread),a=IJ(e.environmentId,e.reference),o=PJ(),s;t[0]===e.thread?s=t[1]:(s=(0,L.jsx)(tY,{thread:e.thread}),t[0]=e.thread,t[1]=s);let c;t[2]!==a||t[3]!==i.comments||t[4]!==e?(c=(0,L.jsx)(nY,{...e,comments:i.comments,command:a}),t[2]=a,t[3]=i.comments,t[4]=e,t[5]=c):c=t[5];let l;t[6]===i?l=t[7]:(l=(0,L.jsx)(iY,{pagination:i}),t[6]=i,t[7]=l);let u;t[8]!==a||t[9]!==e?(u=(0,L.jsx)(aY,{...e,command:a}),t[8]=a,t[9]=e,t[10]=u):u=t[10];let d;t[11]!==o||t[12]!==e.thread?(d=(0,L.jsx)(eY,{handoff:o,thread:e.thread}),t[11]=o,t[12]=e.thread,t[13]=d):d=t[13];let f;t[14]!==a||t[15]!==e||t[16]!==n?(f=(0,L.jsx)(oY,{...e,command:a,reply:n,onReplyChange:r}),t[14]=a,t[15]=e,t[16]=n,t[17]=f):f=t[17];let p;t[18]!==a||t[19]!==i?(p=(0,L.jsx)(cY,{command:a,pagination:i}),t[18]=a,t[19]=i,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f||t[27]!==p?(m=(0,L.jsxs)(`article`,{className:`rounded-md border border-border/60 p-3`,children:[s,c,l,u,d,f,p]}),t[21]=s,t[22]=c,t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=p,t[28]=m):m=t[28],m}function eY(e){let t=(0,R.c)(7);if(e.handoff===null)return null;let n=e.handoff.pendingAction!==null,r;t[0]!==e.handoff||t[1]!==e.thread?(r=()=>void e.handoff?.run(`fix-finding`,{kind:`thread`,thread:e.thread}),t[0]=e.handoff,t[1]=e.thread,t[2]=r):r=t[2];let i=e.handoff.currentThreadMatches?`Fix in this thread`:`Fix in a new thread`,a;return t[3]!==n||t[4]!==r||t[5]!==i?(a=(0,L.jsx)(_o,{type:`button`,size:`sm`,variant:`outline`,className:`mt-3`,disabled:n,onClick:r,children:i}),t[3]=n,t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function tY(e){let t=(0,R.c)(5),{thread:n}=e,r=n.line===null?``:`:${n.line}`,i=n.isResolved?`Resolved`:`Unresolved`,a=n.isOutdated?` · Outdated`:``,o;return t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==n.path?(o=(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[n.path,r,` ·`,` `,i,a]}),t[0]=r,t[1]=i,t[2]=a,t[3]=n.path,t[4]=o):o=t[4],o}function nY(e){return e.comments.map(t=>(0,L.jsx)(rY,{...e,comment:t},t.id))}function rY(e){let t=(0,R.c)(22),n=e.comment.author?.login??`Unknown author`,r;t[0]===e.comment.createdAt?r=t[1]:(r=sr(e.comment.createdAt),t[0]=e.comment.createdAt,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,L.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:r}),t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=(0,L.jsxs)(`p`,{className:`text-xs font-medium`,children:[n,` ·`,` `,i]}),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;t[7]===e.comment.body?o=t[8]:(o=(0,L.jsx)(FJ,{text:e.comment.body,className:`mt-1`}),t[7]=e.comment.body,t[8]=o);let s;t[9]!==e.command||t[10]!==e.comment.id||t[11]!==e.reference?(s=(t,n)=>e.command.mutate(async()=>{await Jn.setPullRequestReaction({...XH(e.reference),idempotencyKey:crypto.randomUUID(),subjectId:e.comment.id,content:t,reacted:n})}),t[9]=e.command,t[10]=e.comment.id,t[11]=e.reference,t[12]=s):s=t[12];let c;t[13]!==e.command.isPending||t[14]!==e.comment.reactions||t[15]!==e.reactionsEnabled||t[16]!==s?(c=(0,L.jsx)(BJ,{reactions:e.comment.reactions,enabled:e.reactionsEnabled,pending:e.command.isPending,onToggle:s}),t[13]=e.command.isPending,t[14]=e.comment.reactions,t[15]=e.reactionsEnabled,t[16]=s,t[17]=c):c=t[17];let l;return t[18]!==a||t[19]!==o||t[20]!==c?(l=(0,L.jsxs)(`div`,{className:`mt-2`,children:[a,o,c]}),t[18]=a,t[19]=o,t[20]=c,t[21]=l):l=t[21],l}function iY(e){let t=(0,R.c)(4),{pagination:n}=e,r;return t[0]!==n.hasMore||t[1]!==n.loadMore||t[2]!==n.loadingMore?(r=n.hasMore?(0,L.jsx)(_o,{type:`button`,size:`sm`,variant:`outline`,className:`mt-3`,disabled:n.loadingMore,onClick:n.loadMore,children:n.loadingMore?`Loading replies…`:`Load older replies`}):null,t[0]=n.hasMore,t[1]=n.loadMore,t[2]=n.loadingMore,t[3]=r):r=t[3],r}function aY(e){let t=(0,R.c)(5),n;return t[0]!==e.canResolve||t[1]!==e.command||t[2]!==e.reference||t[3]!==e.thread?(n=e.canResolve?(0,L.jsx)(_o,{type:`button`,size:`sm`,variant:`outline`,className:`mt-3`,disabled:e.command.isPending,onClick:()=>e.command.mutate(async()=>{await Jn.setPullRequestThreadResolution({...XH(e.reference),idempotencyKey:crypto.randomUUID(),threadId:e.thread.id,resolved:!e.thread.isResolved})}),children:e.thread.isResolved?`Reopen thread`:`Resolve thread`}):null,t[0]=e.canResolve,t[1]=e.command,t[2]=e.reference,t[3]=e.thread,t[4]=n):n=t[4],n}function oY(e){let t=(0,R.c)(17);if(!e.canReply)return null;let n;t[0]===e.reply?n=t[1]:(n=qJ(e.reply),t[0]=e.reply,t[1]=n);let r=n,i;t[2]!==e.command.isPending||t[3]!==e.onReplyChange||t[4]!==e.reply?(i=(0,L.jsx)(gq,{value:e.reply,ariaLabel:`Reply to review thread`,placeholder:`Reply to thread`,density:`compact`,maxLength:WJ,disabled:e.command.isPending,onChange:e.onReplyChange}),t[2]=e.command.isPending,t[3]=e.onReplyChange,t[4]=e.reply,t[5]=i):i=t[5];let a=!KJ(e.reply,e.command.isPending),o;t[6]===e?o=t[7]:(o=()=>sY(e),t[6]=e,t[7]=o);let s;t[8]!==a||t[9]!==o?(s=(0,L.jsx)(_o,{type:`button`,size:`sm`,disabled:a,onClick:o,children:`Reply`}),t[8]=a,t[9]=o,t[10]=s):s=t[10];let c;t[11]===r?c=t[12]:(c=r===null?null:(0,L.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r}),t[11]=r,t[12]=c);let l;return t[13]!==i||t[14]!==s||t[15]!==c?(l=(0,L.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[i,s,c]}),t[13]=i,t[14]=s,t[15]=c,t[16]=l):l=t[16],l}function sY(e){let t=e.reply.trim();e.command.mutate(async()=>{await Jn.replyToPullRequestThread({...XH(e.reference),idempotencyKey:crypto.randomUUID(),threadId:e.thread.id,body:t})},()=>e.onReplyChange(``))}function cY(e){let t=(0,R.c)(7),n;t[0]===e.pagination.loadError?n=t[1]:(n=e.pagination.loadError?(0,L.jsxs)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:[`Older replies could not be loaded: `,e.pagination.loadError.message]}):null,t[0]=e.pagination.loadError,t[1]=n);let r;t[2]===e.command.error?r=t[3]:(r=e.command.error?(0,L.jsxs)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:[`Thread update failed: `,e.command.error.message]}):null,t[2]=e.command.error,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,L.jsxs)(L.Fragment,{children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function lY(e){return e??`Unknown author`}function uY(e){return e===`review`?`reviewed`:`commented`}function dY(e){return e.author?.login??`Unknown author`}function fY(e,t){return t?e.capabilities.reactions===!0:!1}function pY(e,t){return t?e.capabilities.edit?.comment===!0:!1}function mY(e,t){return t&&e.capabilities.review.reply?e.viewerPermissions.comment:!1}function hY(e,t){return t&&e.capabilities.review.resolve?e.viewerPermissions.resolve:!1}function gY({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c}){let l=t?.(e),u=n?.(e),d=r?.(e),f=i?.(e);return(0,L.jsxs)(L.Fragment,{children:[l==null?(0,L.jsxs)(L.Fragment,{children:[u!=null&&(0,L.jsx)(`div`,{slot:`header-prefix`,children:u}),d!=null&&(0,L.jsx)(`div`,{slot:`header-filename-suffix`,children:d}),f!=null&&(0,L.jsx)(`div`,{slot:`header-metadata`,children:f})]}):(0,L.jsx)(`div`,{slot:an,children:l}),a!=null&&o?.map((e,t)=>(0,L.jsx)(`div`,{slot:Yn(e),children:a(e)},t)),s!=null&&(0,L.jsx)(`div`,{slot:`gutter-utility-slot`,style:Kn,children:s(c)})]})}function _Y(e){return new Worker(`/assets/worker-Cvq2iJN1.js`,{name:e?.name})}function vY(e){let t=(0,R.c)(4),{themeName:n}=e,r=Rn(),i,a;return t[0]!==n||t[1]!==r?(i=()=>{if(!r)return;let e=r.getDiffRenderOptions();e.theme!==n&&r.setRenderOptions({...e,theme:n}).catch(yY)},a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,I.useEffect)(i,a),null}function yY(e){fn(e,{route:`diff-worker-theme-sync`})}function bY(e){let t=(0,R.c)(10),{children:n}=e,{resolvedTheme:r}=Mn(),i;t[0]===r?i=t[1]:(i=$t(r),t[0]=r,t[1]=i);let a=i,o,s=typeof navigator>`u`?4:Math.max(1,navigator.hardwareConcurrency||4);o=Math.max(2,Math.min(6,Math.floor(s/2)));let c=o,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l={workerFactory:xY,poolSize:c,totalASTLRUCacheSize:240},t[2]=l):l=t[2];let u,d;t[3]===a?(u=t[4],d=t[5]):(u={theme:a,tokenizeMaxLineLength:1e3},d=(0,L.jsx)(vY,{themeName:a}),t[3]=a,t[4]=u,t[5]=d);let f;return t[6]!==n||t[7]!==u||t[8]!==d?(f=(0,L.jsxs)(tn,{poolOptions:l,highlighterOptions:u,children:[d,n]}),t[6]=n,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function xY(){return new _Y}export{Hb as $,Do as $n,su as $t,zH as A,mc as An,Ri as Ar,vu as At,VC as B,Ls as Bn,H as Bt,lU as C,bl as Cn,Ji as Cr,tp as Ct,sU as D,al as Dn,Vi as Dr,Cp as Dt,uU as E,gl as En,Ui as Er,Gf as Et,Jw as F,Gs as Fn,Di as Fr,Jf as Ft,AS as G,vs as Gn,gp as Gt,BS as H,Os as Hn,H_ as Ht,Rw as I,Us as In,Ei as Ir,jg as It,mx as J,Xo as Jn,pu as Jt,OS as K,is as Kn,gu as Kt,Mw as L,Ws as Ln,Ti as Lr,Su as Lt,WV as M,Vs as Mn,Ni as Mr,gy as Mt,UV as N,Bs as Nn,ki as Nr,E_ as Nt,fU as O,cc as On,Bi as Or,Cu as Ot,eT as P,Hs as Pn,Oi as Pr,rp as Pt,qb as Q,Oo as Qn,ou as Qt,YC as R,zs as Rn,wi as Rr,ap as Rt,XH as S,Ol as Sn,Xi as Sr,dp as St,dU as T,vl as Tn,Gi as Tr,fp as Tt,PS as U,Ds as Un,vp as Ut,KC as V,As as Vn,xp as Vt,NS as W,Cs as Wn,hm as Wt,sx as X,Ro as Xn,cu as Xt,ux as Y,Go as Yn,iu as Yt,Zb as Z,Fo as Zn,au as Zt,bJ as _,wl as _n,ia as _r,Yf as _t,pY as a,zl as an,uo as ar,zm as at,gq as b,Dl as bn,Qi as br,sp as bt,mY as c,Il as cn,co as cr,U as ct,BJ as d,Ml as dn,$a as dr,Sp as dt,lu as en,vo as er,Rb as et,IJ as f,jl as fn,Qa as fr,Uf as ft,yJ as g,xl as gn,oa as gr,V as gt,PJ as h,Sl as hn,ca as hr,Am as ht,lY as i,Ul as in,po as ir,bh as it,HV as j,Ks as jn,Pi as jr,T_ as jt,cU as k,dc as kn,zi as kr,op as kt,hY as l,Ll as ln,fo as lr,yg as lt,DJ as m,Cl as mn,wa as mr,sv as mt,gY as n,eu as nn,go as nr,gm as nt,uY as o,Hl as on,ho as or,Wf as ot,FJ as p,yl as pn,Wa as pr,qf as pt,gS as q,as as qn,fu as qt,dY as r,$l as rn,mo as rr,Pb as rt,fY as s,Bl as sn,lo as sr,Kf as st,bY as t,ru as tn,_o as tr,Hf as tt,$J as u,Fl as un,so as ur,W as ut,Oq as v,Tl as vn,ta as vr,Mg as vt,pU as w,hl as wn,qi as wr,Rg as wt,qH as x,kl as xn,Zi as xr,Ou as xt,Tq as y,El as yn,ea as yr,Tu as yt,UC as z,Js as zn,Ci as zr,lp as zt};
|
|
73
|
-
//# sourceMappingURL=DiffWorkerPoolProvider-
|
|
73
|
+
//# sourceMappingURL=DiffWorkerPoolProvider-CYkhfTpq.js.map
|