@cmmd-center/forge 0.9.16 → 0.9.17
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 +175 -33
- package/dist/bin.mjs +199 -57
- package/dist/client/assets/{CanvasPanel-Dc8j2ouo.js → CanvasPanel-D9sKevpO.js} +2 -2
- package/dist/client/assets/{CompositeItem-Cn5DdObI.js → CompositeItem-Bsi2e5qV.js} +2 -2
- package/dist/client/assets/{DiffPanel-CRdkVPEz.js → DiffPanel-ClMWe6-c.js} +2 -2
- package/dist/client/assets/{DiffPanel.logic-BIPcNz_o.js → DiffPanel.logic-o7tDdTzf.js} +2 -2
- package/dist/client/assets/{DiffPanelShell-tIdXu7mn.js → DiffPanelShell-R1Q66jTc.js} +2 -2
- package/dist/client/assets/{DiffWorkerPoolProvider-tFSGuVfC.js → DiffWorkerPoolProvider-lEFZi8QR.js} +2 -2
- package/dist/client/assets/{PullRequestCodePanel-inwJYfZC.js → PullRequestCodePanel-BpbniIb5.js} +2 -2
- package/dist/client/assets/{Virtualizer-DeKxnAeU.js → Virtualizer-B5NXbN5f.js} +2 -2
- package/dist/client/assets/{canvasStateStore-Dlm4tanv.js → canvasStateStore-qioLqOoT.js} +2 -2
- package/dist/client/assets/{cmmdAuthRedirect-C1FjO86g.js → cmmdAuthRedirect-lmPzseq5.js} +2 -2
- package/dist/client/assets/{index-BvXPD-Rk.js → index-D0769c3n.js} +18 -18
- package/dist/client/assets/{src-DljvAdHI.js → src-BL6J64vk.js} +3 -3
- package/dist/client/assets/{toggle-It2CvaLA.js → toggle-CW3yNjj1.js} +2 -2
- package/dist/client/assets/{useTriggerFocusGuards-DfUh9uvu.js → useTriggerFocusGuards-mvO6ygs-.js} +2 -2
- package/dist/client/index.html +10 -10
- package/dist/{open-D8mGyWmt.mjs → open-FIgTDosf.mjs} +3 -3
- package/package.json +1 -1
package/dist/client/assets/{DiffWorkerPoolProvider-tFSGuVfC.js → DiffWorkerPoolProvider-lEFZi8QR.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`forge-web@0.9.10`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`07a0a477-7785-472b-a9ea-a15ba7b52508`,e._sentryDebugIdIdentifier=`sentry-dbid-07a0a477-7785-472b-a9ea-a15ba7b52508`)}catch{}})();import{n as e,r as t,t as n}from"./rolldown-runtime-BaTzPAyU.js";import{Ba as r,Va as i,za as a}from"./Stream-D8tJNlvy.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-DfUh9uvu.js";import{$ as Ge,An as Ke,At as qe,B as Je,Bn as Ye,Bs as Xe,Bt as Ze,Cs as Qe,Ct as $e,Dr as et,Dt as tt,Es as nt,Et as rt,F as it,Ft as at,G as ot,Gn as st,Gs as ct,H as lt,I as ut,In as dt,Io as ft,It as pt,J as mt,Js as ht,K as gt,Kn as _t,Ks as vt,L as yt,Lo as bt,Lt as xt,M as St,Mn as Ct,Mt as wt,N as Tt,No as Et,Nt as Dt,On as Ot,Os as kt,Ot as At,P as jt,Pr as Mt,Pt as Nt,Q as Pt,Qi as Ft,Qt as It,R as Lt,Rt,Sa as zt,Sn as Bt,Sr as Vt,Ss as Ht,St as Ut,Ts as Wt,Tt as Gt,U as Kt,Us as qt,Ut as Jt,V as Yt,Vi as Xt,Vs as Zt,W as Qt,Ws as $t,X as en,Xs as tn,Xt as nn,Y as rn,Z as an,Zt as on,_ as sn,_t as cn,a as ln,ac as un,an as dn,at as fn,ba as pn,bn as mn,bt as hn,ct as gn,dc as _n,dn as vn,dt as yn,es as bn,et as xn,ft as Sn,g as Cn,ga as wn,gc as Tn,gn as En,gt as Dn,hr as On,ht as kn,it as An,jt as jn,kt as Mn,lc as Nn,ln as Pn,lt as Fn,m as In,mt as Ln,na as Rn,nt as zn,o as Bn,oc as Vn,ot as Hn,pi as Un,pn as Wn,pt as Gn,q as Kn,qi as qn,qn as Jn,rs as Yn,rt as Xn,s as Zn,st as Qn,tc as $n,tt as er,ua as tr,ut as nr,vt as rr,wt as ir,xi as ar,xn as or,xt as sr,yr as cr,ys as lr,yt as ur,z as dr,zn as fr,zt as pr}from"./DiffPanelShell-tIdXu7mn.js";import{$ as mr,A as hr,At as gr,En as _r,F as vr,Ft as yr,Ht as br,It as xr,K as Sr,Kt as Cr,L as wr,Lt as Tr,Mt as Er,Nn as Dr,Nt as Or,On as kr,Pt as Ar,Q as jr,R as Mr,Rt as Nr,S as Pr,Tn 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,jn as Qr,jt 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-Cn5DdObI.js";import{Ct as bi,Et as xi,z as Si}from"./src-DljvAdHI.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=Tn();return I.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Di(e){let t=Tn(),n=Ei(),r=I.useRef(null);return Ci(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}var Oi=class extends Zt{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:qt(t,n.data),hasPreviousPage:$t(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ki=class extends ct{#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=vt({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),ht.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 Nn{#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),un(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&tn(t.mutationKey)!==tn(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){ht.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=Xe(t),[r]=I.useState(()=>new ji(n,e));I.useEffect(()=>{r.setOptions(e)},[r,e]);let i=I.useSyncExternalStore(I.useCallback(e=>r.subscribe(ht.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=I.useCallback((e,t)=>{r.mutate(e,t).catch($n)},[r]);if(i.error&&Vn(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=Dr(`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=Dr(`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=Dr(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),zi=Dr(`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=Dr(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Vi=Dr(`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=Dr(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ui=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Qi=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=yr(e);Ar(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=Or(w(this.state.viewport));if(!this.state.viewport||!Ar(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`&&yr(t)!==e&&(t.preventDefault(),s.set(`prevFocusElement`,Or(n)),e?.focus({preventScroll:!0}),s.pauseTimers(),s.set(`focused`,!0))}function i(e){yr(e)===t&&(s.set(`isWindowFocused`,!1),s.pauseTimers())}function a(n){if(n.relatedTarget)return;let r=yr(n),i=Or(w(e));(r===t||!Ar(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&&yr(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(Or(w(s.state.viewport)))&&(s.set(`focused`,!0),s.pauseTimers())}function M(e){!m||Ar(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(),yr(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||!Ar(A.current,Or(w(A.current))))return;d.closeToast(n.id)}}I.useEffect(()=>{let e=A.current;if(!u||!e)return;function t(t){ie.current===null||!Ar(e,yr(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}=Sr({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}=Sr({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===Tr:e===Nr,e===xr)}function Za(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Ga:qa(t,n?e===Nr:e===Tr,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=Or(w(O??t??null)),r=e.some(e=>e.context&&Ar(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())||Er(e),T.setOpen(!1,Pr(wr,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`&&(Er(e),F.current=r,re(e)),e.key===`End`&&(Er(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(Er(e),E&&!f&&Or(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=Or(w(e));e&&Ar(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=yr(e.nativeEvent);if(t&&!Ar(M.current,t))return;Er(e),T.setOpen(!1,Pr(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,Pr(wr,e.nativeEvent,e.currentTarget))}function t(e){p===`auto`&&gr(e.nativeEvent)&&(P.current=!f)}function n(e){P.current=p,p===`auto`&&$r(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&&(Er(t),n?(F.current=Se(),re(t)):e(t));return}a&&(fe.current!=null&&(F.current=fe.current),Er(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===` `&&(Er(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!==` `&&(Er(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`);Ar(n,t)||Ar(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=`size-touch shrink-0 touch-manipulation rounded-lg sm:size-touch md:size-5 md:rounded-md`,uo=`min-h-touch touch-manipulation sm:min-h-touch md:min-h-0`,fo=`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`,po=`relative ${fo}`,mo=`text-no-zoom md:text-sm`,ho=Qr(`[&_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)] ${fo} 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 go(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(ho({className:n,size:a,variant:o})),"data-slot":`button`,type:s};u=so,c=`button`,l=jr(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 _o({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 vo(e,t){return t<=1?!1:e>0}function yo(e){let t=0;return{frontmostHeight:bo(e[0]?.height),items:e.map((e,n)=>{let r={toast:e,visibleIndex:n,offsetY:t};return t+=bo(e.height),r})}}function bo(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function xo(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 So(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 Co(e){return e.type===`error`&&typeof e.description==`string`&&!e.hideCopyButton}function wo(e){return e.hasAnchor}function To(e){return e.tooltipStyle?`tooltip`:`card`}var Eo=ao(),Do=ao(),Oo=new Map,ko={error:zi,info:Gi,loading:Zi,success:Bi,warning:ca};function Ao(e){let t=(0,R.c)(8),{text:n}=e,{copyToClipboard:r,isCopied:i}=_o(),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 jo(){let e=(0,R.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:Mo},e[0]=t):t=e[0];let n=_n(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=zt(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 Mo(e){return pn(e)}function No(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=Oo.get(n)??r;let t=null,i=null,a=!1,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{a||(a=!0,Oo.delete(n),Eo.close(n))},c=()=>{t!==null&&(e=Math.max(0,e-(Date.now()-t)),t=null,o(),Oo.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 Po(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)(Fo,{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:Eo,...r,children:[n,o]}),t[6]=n,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Fo(e){let t=(0,R.c)(17),{position:n}=e,r=n===void 0?`top-right`:n,{toasts:i}=io(),a=jo(),o=r.startsWith(`top`),s;t[0]===a?s=t[1]:(s=e=>xo(e.data,a),t[0]=a,t[1]=s);let c=yo(i.filter(s)),l,u;t[2]===i?(l=t[3],u=t[4]):(l=()=>{let e=new Set(i.map(Io));for(let t of Oo.keys())e.has(t)||Oo.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?ko[t.type]:null,s=vo(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:So({position:r,isTop:o}),toast:t,children:[(0,L.jsx)(No,{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`}),Co({type:t.type,description:t.description,hideCopyButton:t.data?.hideCopyButton})&&(0,L.jsx)(Ao,{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(ho({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 Io(e){return e.id}function Lo(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)(Ro,{}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,L.jsxs)(va,{toastManager:Do,...r,children:[n,i]}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function Ro(){let e=(0,R.c)(7),{toasts:t}=io(),n=jo(),r;if(e[0]!==n||e[1]!==t){let i;e[3]===n?i=e[4]:(i=e=>xo(e.data,n),e[3]=n,e[4]=i),r=t.filter(i).map(zo),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 zo(e){let t=e.type?ko[e.type]:null,n=To({tooltipStyle:e.data?.tooltipStyle})===`tooltip`,r=e.positionerProps;return!wo({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`}),Co({type:e.type,description:e.description,hideCopyButton:e.data?.hideCopyButton})&&(0,L.jsx)(Ao,{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(ho({size:`xs`}),`shrink-0`),"data-slot":`toast-action`,children:e.actionProps.children})]})})},e.id)}var Bo=I.createContext(void 0);function Vo(){let e=I.useContext(Bo);if(e===void 0)throw Error(Jr(53));return e}function Ho(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 Uo=`base-ui-disable-scrollbar`,Wo={className:Uo,getElement(e){return(0,L.jsx)(`style`,{nonce:e,href:Uo,precedence:`base-ui:low`,children:`.${Uo}{scrollbar-width:none}.${Uo}::-webkit-scrollbar{display:none}`})}},Go=e=>t=>t?{[e]:``}:null,Ko={hasOverflowX:Go(`data-has-overflow-x`),hasOverflowY:Go(`data-has-overflow-y`),overflowXStart:Go(`data-overflow-x-start`),overflowXEnd:Go(`data-overflow-x-end`),overflowYStart:Go(`data-overflow-y-start`),overflowYEnd:Go(`data-overflow-y-end`),cornerHidden:()=>null},qo=I.createContext(void 0),Jo={disableStyleElements:!1};function Yo(){return I.useContext(qo)??Jo}var Xo={x:0,y:0},Zo={width:0,height:0},Qo={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},$o={x:!0,y:!0,corner:!0},es=I.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=ts(i),d=qr(),f=Se(),p=Se(),{nonce:m,disableStyleElements:h}=Yo(),[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(Zo),[O,k]=I.useState(Zo),[A,j]=I.useState(Qo),[M,N]=I.useState($o),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(Xo),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=Ho(i,`padding`,a),s=Ho(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=Ar(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:Ko}),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)(Bo.Provider,{value:Te,children:[!h&&Wo.getElement(m),we]})});function ts(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 ns=I.createContext(void 0);function rs(e,t){return Math.max(0,e-t)}function is(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 as=[`--scroll-area-overflow-x-start`,`--scroll-area-overflow-x-end`,`--scroll-area-overflow-y-start`,`--scroll-area-overflow-y-end`],os=!1;function ss(){os||p||(typeof CSS<`u`&&`registerProperty`in CSS&&as.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),os=!0)}var cs=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}=Vo(),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=ls(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=is(T===`rtl`?-w:w,ee),te=ee-F);let ne=A?0:is(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=Ho(n,`padding`,`x`),fe=Ho(t,`padding`,`y`),pe=Ho(i,`margin`,`x`),me=Ho(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=>us(e,{width:ye,height:be})),t&&r){let e=ds(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=ds(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];as.forEach((t,n)=>{e.style.setProperty(t,`${xe[n]}px`)}),a&&p(e=>us(e,{width:oe,height:se})),g(e=>us(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=>us(e,Se))});Kr(()=>{ss()},[]),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:Wo.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:Ko}),ee=I.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,L.jsx)(ns.Provider,{value:ee,children:N})});function ls(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function us(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function ds(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 fs=I.createContext(void 0);function ps(){let e=I.useContext(fs);if(e===void 0)throw Error(Jr(54));return e}var ms=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}=Vo(),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=yr(e.nativeEvent),n=E?h.current:g.current;if(n&&Ar(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=Ho(n,`margin`,a),s=Ho(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:Ko});return j?(0,L.jsx)(fs.Provider,{value:i,children:N}):null}),hs=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}=Vo(),m=ps(),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]})}),gs=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=Vo(),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 _s(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)(cs,{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)(vs,{orientation:`vertical`}),(0,L.jsx)(vs,{orientation:`horizontal`}),(0,L.jsx)(gs,{"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)(es,{className:d,...i,children:[g,_]}),t[18]=i,t[19]=_,t[20]=d,t[21]=g,t[22]=v):v=t[22],v}function vs(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)(hs,{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)(ms,{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 ys(){return[{id:`cloud`,enabled:!0},{id:`desktop-local`,enabled:!0}]}function bs(e,t){let n=t.find(t=>t.id===e);return n?.enabled?n.id:`cloud`}function xs(e){let t=e.capabilities??ys();return{requestedDefault:e.requestedDefault,effectiveDefault:bs(e.requestedDefault,t),capabilities:t}}function Ss(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 Cs(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function ws(e){if(e.latestUserMessageAt)return Cs(e.latestUserMessageAt)??-1/0;let t=null;for(let n of e.messages??[]){if(n.role!==`user`)continue;let e=Cs(n.createdAt);e!==null&&(t=t===null?e:Math.max(t,e))}return t===null?Cs(e.updatedAt??e.createdAt)??-1/0:t}function Ts(e,t){return t===`created_at`?Cs(e.createdAt)??-1/0:ws(e)}function Es(e,t){return e.toSorted((e,n)=>{let r=Ts(n,t),i=Ts(e,t),a=r===i?0:r>i?1:-1;return a===0?n.id.localeCompare(e.id):a})}function Ds(e,t,n){return Es(e.filter(e=>e.projectId===t&&e.archivedAt===null),n)[0]??null}function Os(e){return typeof e==`string`&&e.trim().length>0}function ks(e){return e?.status===`running`&&Os(e.activeTurnId)}function As(e){return e?e.status===`connecting`||e.status===`running`&&!Os(e.activeTurnId):!1}function js(e){return e?.status===`error`}var Ms=`[data-thread-item], [data-thread-selection-safe]`,Ns=10,Ps={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 Fs(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 Is(){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=Fs({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 Ls(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 Rs(e){return e===null||!e.closest(Ms)}function zs(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 Bs(e,t=Ns){return e.slice(0,Math.max(0,t))}function Vs(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 Hs(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`,Ss(e))}function Us(e){let{thread:t}=e;return js(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}:ks(t.session)||t.status===`running`?{label:`Working`,colorClass:`text-hue-sky-foreground`,dotClass:`bg-hue-sky dark:bg-hue-sky/80`,pulse:!0}:As(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`&&On(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}:Ls(t)?{label:`Completed`,colorClass:`text-success-foreground`,dotClass:`bg-success dark:bg-success/90`,pulse:!1}:null}function Ws(e){let t=null;for(let n of e)n!==null&&(t===null||Ps[n.label]>Ps[t.label])&&(t=n);return t}function Gs(e){let{deletedThreadId:t,deletedThreadIds:n,sortOrder:r,threads:i}=e,a=i.find(e=>e.id===t);return a?Es(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 Ks(e,t,n){return t.length>0?t.reduce((e,t)=>Math.max(e,Ts(t,n)),-1/0):n===`created_at`?Cs(e.createdAt)??-1/0:Cs(e.updatedAt??e.createdAt)??-1/0}function qs(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=Ks(t,r.get(t.id)??[],n),a=Ks(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 Js={links:[],loaded:!1},Ys=Js,Xs=null,Zs=0,Qs=!1,$s=null,ec=1e3,tc=new Set,nc=3e4;function rc(e){if(!e||typeof e!=`object`)return!0;let t=e.status;return typeof t!=`number`||t===408||t===429||t>=500}function ic(){for(let e of tc)e()}function ac(e){Ys=e,ic()}function oc(){$s!==null&&(clearTimeout($s),$s=null)}async function sc(){let e=await bn.listProjectLinks();return{links:e.links.map(e=>({forgeEnvironmentId:e.forgeEnvironmentId,forgeProjectId:e.forgeProjectId,cmmdProjectId:e.cmmdProjectId})),loaded:e.sources?.cmmdAvailable!==!1}}function cc(){if($s!==null||tc.size===0)return;let e=ec;ec=Math.min(ec*2,nc),$s=setTimeout(()=>{$s=null,!(tc.size===0||Ys.loaded)&&lc()},e)}function lc(){if(Ys.loaded||Xs!==null)return;let e=Zs;Xs=Promise.resolve().then(()=>sc()).then(t=>{e===Zs&&(ac(t),t.loaded?ec=1e3:cc())}).catch(t=>{e===Zs&&!Ys.loaded&&rc(t)&&cc()}).finally(()=>{Xs=null,Qs&&tc.size>0&&!Ys.loaded&&(Qs=!1,lc())})}function uc(){if(oc(),ec=1e3,Zs+=1,ac(Js),Xs!==null){Qs=!0;return}tc.size>0&&lc()}function dc(e){return tc.add(e),lc(),()=>{tc.delete(e),tc.size===0&&oc()}}function fc(){return Ys}function pc(){return(0,I.useSyncExternalStore)(dc,fc,fc)}var mc=I.createContext(void 0);function hc(e){let t=I.useContext(mc);if(t===void 0&&!e)throw Error(Jr(33));return t}var gc=I.createContext(void 0);function _c(e){let t=I.useContext(gc);if(t===void 0&&!e)throw Error(Jr(36));return t}var vc=I.createContext(void 0);function yc(e=!0){let t=I.useContext(vc);if(t===void 0&&!e)throw Error(Jr(25));return t}var bc=I.createContext(void 0);function xc(){let e=I.useContext(bc);if(e===void 0)throw Error(Jr(30));return e}function Sc(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=yc(!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:vr})},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&&!Cr&&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 Cc={type:`regular-item`};function wc(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}=Sr({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Sc({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=I.useCallback(e=>jr(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 Tc=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),Ec={checked(e){return e?{[Tc.checked]:``}:{[Tc.unchecked]:``}},...he},Dc=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=hc(!0),g=qr(i),{store:_}=_c(),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}=wc({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:Cc}),E=I.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function D(e){let t=Pr(vr,e.nativeEvent,void 0,{preventUnmountOnClose:Wr});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=Br(`div`,e,{state:E,stateAttributesMapping:Ec,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:D},p,w],ref:[T,t,m.ref]});return(0,L.jsx)(bc.Provider,{value:E,children:O})}),Oc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=xc(),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:Ec,props:{"aria-hidden":!0,...o},enabled:a||u})}),kc=I.createContext(void 0);function Ac(){let e=I.useContext(kc);if(e===void 0)throw Error(Jr(31));return e}var jc=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)(kc.Provider,{value:s,children:c})}),Mc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=qr(a),c=Ac();return Kr(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Br(`div`,e,{ref:t,props:{id:s,role:`presentation`,...o}})}),Nc=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=hc(!0),p=qr(i),{store:m}=_c(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=wc({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Cc});return Br(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),Pc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=_c(),{side:c,align:l}=hc(),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,Pr(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})}),Fc=I.createContext(void 0);function Ic(){let e=I.useContext(Fc);if(e===void 0)throw Error(Jr(32));return e}var Lc=I.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=_c();return i.useState(`mounted`)||n?(0,L.jsx)(Fc.Provider,{value:n,children:(0,L.jsx)(je,{ref:t,...r})}):null}),Rc=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}=_c(),y=Ic(),b=yc(!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,Pr(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,Pr(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,Pr(Ir))}):v.setOpen(!1,Pr(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)(mc.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)(st,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:xe})})]})}),zc=I.createContext(void 0);function Bc(){let e=I.useContext(zc);if(e===void 0)throw Error(Jr(34));return e}var Vc=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)(kc.Provider,{value:f,children:(0,L.jsx)(zc.Provider,{value:_,children:g})})})),Hc=I.createContext(void 0);function Uc(){let e=I.useContext(Hc);if(e===void 0)throw Error(Jr(35));return e}var Wc=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=hc(!0),m=qr(i),{store:h}=_c(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Bc(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=wc({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:Cc}),E=I.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=Pr(vr,e.nativeEvent,void 0,{preventUnmountOnClose:Wr});y(l,t)}let O=Br(`div`,e,{state:E,stateAttributesMapping:Ec,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,L.jsx)(Hc.Provider,{value:E,children:O})}),Gc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Uc(),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:Ec,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),Kc=I.createContext(null);function qc(e){let t=I.useContext(Kc);if(t===null&&!e)throw Error(Jr(5));return t}var Jc={...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`)}},Yc=class extends h{constructor(e){super({...Zc(),...e},Xc(),Jc),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 Xc(){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 Zc(){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 Qc=I.createContext(void 0);function $c(){return I.useContext(Qc)}var el=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=yc(!0),S=_c(!0),w=qc(!0),T=$c(),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=tl({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,Pr(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=jr(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=jr(ke.trigger,Ee.trigger,ve);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ke.trigger,Ee.trigger,ve]),Ie=I.useMemo(()=>jr(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)(gc.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 tl(e){return Vr(()=>new Yc(e)).current}function nl(e){let t=_c().store,n=I.useMemo(()=>({parentMenu:t}),[t]);return(0,L.jsx)(Qc.Provider,{value:n,children:(0,L.jsx)(el,{...e})})}var rl=5;function il(e,t){let n=al(t);return e.clientX>=n.left-rl&&e.clientX<=n.right+rl&&e.clientY>=n.top-rl&&e.clientY<=n.bottom+rl}function al(e){let t=e.getBoundingClientRect(),n=ri(e);if(br)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 ol(e){if(Hr(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!ii(e))return ol(fi(e))}function sl(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 cl=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=_c(!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=ul(),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}=Sr({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;Ar(ae.current,t)||Ar(y.select(`positionerElement`),t)||t===ae.current||(t==null||ol(t)!==y.select(`rootId`))&&(il(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=ll(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=sl({open:C,enabled:P,mouseDownAction:`open`}),ge=I.useMemo(()=>jr(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 ll(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 ul(){let e=qc(!0);return I.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var dl={"aria-expanded":void 0},fl=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=$c();if(!m?.parentMenu)throw Error(Jr(37));let h=ci({guess:!0,label:a}),g=hc(),{store:_}=_c(),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}=wc({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?dl: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]})}),pl=I.createContext(!1);function ml(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(pl.Provider,{value:!0,children:(0,L.jsx)(jc,{"data-slot":`menu-group`,...e})}),t[0]=e,t[1]=n),n}function hl(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(pl.Provider,{value:!0,children:(0,L.jsx)(Vc,{"data-slot":`menu-radio-group`,...e})}),t[0]=e,t[1]=n),n}var gl=`px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8`;function _l(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(pl)){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(gl,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(gl,n),t[16]=n,t[17]=a);let o;return t[18]!==r||t[19]!==i||t[20]!==a?(o=(0,L.jsx)(Mc,{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 vl=el;function yl(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)(cl,{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 bl(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)(Pc,{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)(Lc,{children:(0,L.jsx)(Rc,{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 xl(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)(Nc,{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 Sl(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)(Oc,{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)(Oc,{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)(Dc,{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 Cl(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)(Gc,{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)(Wc,{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 wl(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)(wn,{className:i,"data-slot":`menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}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(`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 El(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(nl,{"data-slot":`menu-sub`,...e}),t[0]=e,t[1]=n),n}function Dl(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)(lr,{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)(fl,{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 Ol(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)(bl,{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 kl(e){if(!e.environmentId)return null;let t=e.readEnvironmentApi(e.environmentId);return t?{environmentId:e.environmentId,api:t}:null}function Al(e){let t=xs({requestedDefault:e.requestedRuntime}),n=kl({environmentId:e.activeEnvironmentId,readEnvironmentApi:e.readEnvironmentApi}),r=kl({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 jl(e){return e.projectRef}function Ml(e){let t=e.latestActiveDraft;return!t||e.routeTargetKind!==`draft`||t.logicalProjectKey!==e.logicalProjectKey?!1:t.promotedTo==null}async function Nl(e){e.openBrowserPreview&&Ye.getState().revealBrowser(fr(e.draftId)),await e.router.navigate({to:`/draft/$draftId`,params:{draftId:e.draftId},...e.viewTransition?{viewTransition:!0}:{}})}function Pl(){let e=Rn(e=>e.activeEnvironmentId),t=Rn(e=>e.environmentStateById),n=(0,I.useMemo)(()=>({activeEnvironmentId:e,environmentStateById:t}),[e,t]);return(0,I.useMemo)(()=>qn(n),[n])}var Fl=`package`;function Il(e,t){let n=t.repositoryIdentity?.canonicalKey;return n?e[n]??`package`:Fl}function Ll(e,t=Fl){if(t===`repository`)return e.canonicalKey;let n=e.repositorySubpath?.trim();return n&&n.length>0?`${e.canonicalKey}#${n}`:e.canonicalKey}function Rl(e,t=Fl){return e.repositoryIdentity?Ll(e.repositoryIdentity,t):Wt(Qe(e.environmentId,e.id))}function zl(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 Bl(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 Vl(e,t=()=>Fl){let n=new Map;for(let r of e){if(!r.repositoryIdentity)continue;let e=zl(r.cwd)??Bl(r.cwd,r.repositoryIdentity.repositorySubpath);if(!e)continue;let i=n.get(e)??new Set;i.add(Rl(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=Wt(Qe(n.environmentId,n.id)),a=n.repositoryIdentity?null:zl(n.cwd);i.set(e,(a?r.get(a):void 0)??Rl(n,n.repositoryIdentity?t(n.repositoryIdentity):void 0))}return i}function Hl(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 Ul(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 Wl(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 Gl(e){let{branch:t,worktreePath:n,envMode:r,cmmdTaskId:i,linkedPullRequest:a}=Wl(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 Kl(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 ql(){let e=(0,R.c)(6),t=Pl(),n=Tn(),r;e[0]===n.state.matches?r=e[1]:(r=()=>{let e=n.state.matches[n.state.matches.length-1]?.params??{};return pn(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}=zt.getState(),d=i(),f=t.find(t=>t.id===e.projectId&&t.environmentId===e.environmentId),p=f?Rl(f):Wt(e),m=Wl(r),h=Gl(r),g=Ul(r),_=a(p),v=tu(d,{getDraftThread:s,getDraftSession:o}),y=e=>{let t=zt.getState();Hl({target:e,prompt:r?.initialPrompt,...r?.autoSubmit===void 0?{}:{autoSubmit:r.autoSubmit},setPrompt:t.setPrompt,setPendingAutoSubmit:t.setPendingAutoSubmit})},b=Jl(_,r?.draftReuse);if(b)return(async()=>(Yl({mentionsContext:g,draftId:b.draftId,contextPatch:m,setDraftThreadContext:l}),u(p,e,b.draftId,{threadId:b.threadId,...Xl(r?.cmmdTaskId)}),y(b.draftId),await Nl({router:n,draftId:b.draftId,openBrowserPreview:r?.openBrowserPreview,viewTransition:r?.viewTransition}),Zl(b)))();let x=Jl(v,r?.draftReuse);if(x&&d?.kind===`draft`&&Ml({latestActiveDraft:x,routeTargetKind:d.kind,logicalProjectKey:p}))return Yl({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=kr(),w=new Date().toISOString();return(async()=>(u(p,e,S,Kl(r,{threadId:C,createdAt:w,runtimeMode:Si})),c(S),y(S),await Nl({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 Jl(e,t){return t===`never`?null:e}function Yl(e){e.mentionsContext&&e.setDraftThreadContext(e.draftId,e.contextPatch)}function Xl(e){return e===void 0?{}:{cmmdTaskId:e}}function Zl(e){return{draftId:e.draftId,threadId:e.threadId,projectRef:Qe(e.environmentId,e.projectId)}}function Ql(){let e=(0,R.c)(5),t=ql(),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 $l(){let e=ar(e=>e.projectOrder),t=_n({strict:!1,select:e=>pn(e)}),n=t?.kind===`server`?t.threadRef:null,r=Rn((0,I.useMemo)(()=>dt(n),[n])),i=zt(e=>e.getDraftThread),a=zt(()=>t?t.kind===`server`?i(t.threadRef):zt.getState().getDraftSession(t.draftId):null),o=bt(),s=Vt(e=>e.defaultThreadRuntime),c=Pl(),l=(0,I.useMemo)(()=>zs({items:c,preferredIds:e,getId:e=>Wt(Qe(e.environmentId,e.id))}),[e,c]),u=ql(),d=(0,I.useCallback)(async(...e)=>{await u(...e)},[u]),f=(0,I.useMemo)(()=>{let e=l[0];return e?jl({requestedRuntime:s,primaryEnvironmentId:o,projects:c,projectRef:Qe(e.environmentId,e.id)}):null},[s,l,o,c]);return{activeComposerTarget:eu(t),activeDraftThread:a,activeThread:r,defaultProjectRef:f,handleNewThread:d,openNewThread:u,routeThreadRef:n}}function eu(e){return e===null?null:e.kind===`server`?e.threadRef:e.draftId}function tu(e,t){return e?e.kind===`server`?t.getDraftThread(e.threadRef):t.getDraftSession(e.draftId):null}function nu(e){let t=e.replace(/[/\\]+$/,``)||e,n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return(n>=0?t.slice(n+1):t)||e}var ru=`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`,iu=`size-3.5 shrink-0 opacity-85`,au=`truncate select-none leading-tight`,ou=`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`,su=`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`,cu=`<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>`,lu=(0,I.createContext)(null);function uu(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function du(){let e=(0,I.useContext)(lu);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 fu(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 pu=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,mu=pu&&`documentMode`in document?document.documentMode:null,hu=pu&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),gu=pu&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_u=!(!pu||!(`InputEvent`in window)||mu)&&`getTargetRanges`in new window.InputEvent(`input`),vu=pu&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,yu=pu&&/Android/.test(navigator.userAgent),bu=pu&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!yu,xu=pu&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Su=pu&&yu&&xu,Cu=pu&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&hu&&!xu,wu=0,Tu=1,Eu=2,Du=1,Ou=2,ku=3,Au=4,ju=5,Mu=6,Nu=bu||vu||Cu?`\xA0`:``,Pu=`
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`forge-web@0.9.10`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`07a0a477-7785-472b-a9ea-a15ba7b52508`,e._sentryDebugIdIdentifier=`sentry-dbid-07a0a477-7785-472b-a9ea-a15ba7b52508`)}catch{}})();import{n as e,r as t,t as n}from"./rolldown-runtime-BaTzPAyU.js";import{Ba as r,Va as i,za as a}from"./Stream-D8tJNlvy.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-mvO6ygs-.js";import{$ as Ge,An as Ke,At as qe,B as Je,Bn as Ye,Bs as Xe,Bt as Ze,Cs as Qe,Ct as $e,Dr as et,Dt as tt,Es as nt,Et as rt,F as it,Ft as at,G as ot,Gn as st,Gs as ct,H as lt,I as ut,In as dt,Io as ft,It as pt,J as mt,Js as ht,K as gt,Kn as _t,Ks as vt,L as yt,Lo as bt,Lt as xt,M as St,Mn as Ct,Mt as wt,N as Tt,No as Et,Nt as Dt,On as Ot,Os as kt,Ot as At,P as jt,Pr as Mt,Pt as Nt,Q as Pt,Qi as Ft,Qt as It,R as Lt,Rt,Sa as zt,Sn as Bt,Sr as Vt,Ss as Ht,St as Ut,Ts as Wt,Tt as Gt,U as Kt,Us as qt,Ut as Jt,V as Yt,Vi as Xt,Vs as Zt,W as Qt,Ws as $t,X as en,Xs as tn,Xt as nn,Y as rn,Z as an,Zt as on,_ as sn,_t as cn,a as ln,ac as un,an as dn,at as fn,ba as pn,bn as mn,bt as hn,ct as gn,dc as _n,dn as vn,dt as yn,es as bn,et as xn,ft as Sn,g as Cn,ga as wn,gc as Tn,gn as En,gt as Dn,hr as On,ht as kn,it as An,jt as jn,kt as Mn,lc as Nn,ln as Pn,lt as Fn,m as In,mt as Ln,na as Rn,nt as zn,o as Bn,oc as Vn,ot as Hn,pi as Un,pn as Wn,pt as Gn,q as Kn,qi as qn,qn as Jn,rs as Yn,rt as Xn,s as Zn,st as Qn,tc as $n,tt as er,ua as tr,ut as nr,vt as rr,wt as ir,xi as ar,xn as or,xt as sr,yr as cr,ys as lr,yt as ur,z as dr,zn as fr,zt as pr}from"./DiffPanelShell-R1Q66jTc.js";import{$ as mr,A as hr,At as gr,En as _r,F as vr,Ft as yr,Ht as br,It as xr,K as Sr,Kt as Cr,L as wr,Lt as Tr,Mt as Er,Nn as Dr,Nt as Or,On as kr,Pt as Ar,Q as jr,R as Mr,Rt as Nr,S as Pr,Tn 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,jn as Qr,jt 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-Bsi2e5qV.js";import{Ct as bi,Et as xi,z as Si}from"./src-BL6J64vk.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=Tn();return I.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Di(e){let t=Tn(),n=Ei(),r=I.useRef(null);return Ci(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}var Oi=class extends Zt{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:qt(t,n.data),hasPreviousPage:$t(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ki=class extends ct{#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=vt({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),ht.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 Nn{#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),un(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&tn(t.mutationKey)!==tn(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){ht.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=Xe(t),[r]=I.useState(()=>new ji(n,e));I.useEffect(()=>{r.setOptions(e)},[r,e]);let i=I.useSyncExternalStore(I.useCallback(e=>r.subscribe(ht.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=I.useCallback((e,t)=>{r.mutate(e,t).catch($n)},[r]);if(i.error&&Vn(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=Dr(`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=Dr(`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=Dr(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),zi=Dr(`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=Dr(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Vi=Dr(`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=Dr(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ui=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Qi=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=Dr(`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=yr(e);Ar(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=Or(w(this.state.viewport));if(!this.state.viewport||!Ar(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`&&yr(t)!==e&&(t.preventDefault(),s.set(`prevFocusElement`,Or(n)),e?.focus({preventScroll:!0}),s.pauseTimers(),s.set(`focused`,!0))}function i(e){yr(e)===t&&(s.set(`isWindowFocused`,!1),s.pauseTimers())}function a(n){if(n.relatedTarget)return;let r=yr(n),i=Or(w(e));(r===t||!Ar(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&&yr(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(Or(w(s.state.viewport)))&&(s.set(`focused`,!0),s.pauseTimers())}function M(e){!m||Ar(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(),yr(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||!Ar(A.current,Or(w(A.current))))return;d.closeToast(n.id)}}I.useEffect(()=>{let e=A.current;if(!u||!e)return;function t(t){ie.current===null||!Ar(e,yr(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}=Sr({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}=Sr({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===Tr:e===Nr,e===xr)}function Za(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Ga:qa(t,n?e===Nr:e===Tr,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=Or(w(O??t??null)),r=e.some(e=>e.context&&Ar(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())||Er(e),T.setOpen(!1,Pr(wr,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`&&(Er(e),F.current=r,re(e)),e.key===`End`&&(Er(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(Er(e),E&&!f&&Or(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=Or(w(e));e&&Ar(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=yr(e.nativeEvent);if(t&&!Ar(M.current,t))return;Er(e),T.setOpen(!1,Pr(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,Pr(wr,e.nativeEvent,e.currentTarget))}function t(e){p===`auto`&&gr(e.nativeEvent)&&(P.current=!f)}function n(e){P.current=p,p===`auto`&&$r(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&&(Er(t),n?(F.current=Se(),re(t)):e(t));return}a&&(fe.current!=null&&(F.current=fe.current),Er(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===` `&&(Er(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!==` `&&(Er(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`);Ar(n,t)||Ar(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=`size-touch shrink-0 touch-manipulation rounded-lg sm:size-touch md:size-5 md:rounded-md`,uo=`min-h-touch touch-manipulation sm:min-h-touch md:min-h-0`,fo=`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`,po=`relative ${fo}`,mo=`text-no-zoom md:text-sm`,ho=Qr(`[&_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)] ${fo} 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 go(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(ho({className:n,size:a,variant:o})),"data-slot":`button`,type:s};u=so,c=`button`,l=jr(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 _o({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 vo(e,t){return t<=1?!1:e>0}function yo(e){let t=0;return{frontmostHeight:bo(e[0]?.height),items:e.map((e,n)=>{let r={toast:e,visibleIndex:n,offsetY:t};return t+=bo(e.height),r})}}function bo(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function xo(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 So(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 Co(e){return e.type===`error`&&typeof e.description==`string`&&!e.hideCopyButton}function wo(e){return e.hasAnchor}function To(e){return e.tooltipStyle?`tooltip`:`card`}var Eo=ao(),Do=ao(),Oo=new Map,ko={error:zi,info:Gi,loading:Zi,success:Bi,warning:ca};function Ao(e){let t=(0,R.c)(8),{text:n}=e,{copyToClipboard:r,isCopied:i}=_o(),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 jo(){let e=(0,R.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:Mo},e[0]=t):t=e[0];let n=_n(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=zt(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 Mo(e){return pn(e)}function No(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=Oo.get(n)??r;let t=null,i=null,a=!1,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{a||(a=!0,Oo.delete(n),Eo.close(n))},c=()=>{t!==null&&(e=Math.max(0,e-(Date.now()-t)),t=null,o(),Oo.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 Po(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)(Fo,{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:Eo,...r,children:[n,o]}),t[6]=n,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Fo(e){let t=(0,R.c)(17),{position:n}=e,r=n===void 0?`top-right`:n,{toasts:i}=io(),a=jo(),o=r.startsWith(`top`),s;t[0]===a?s=t[1]:(s=e=>xo(e.data,a),t[0]=a,t[1]=s);let c=yo(i.filter(s)),l,u;t[2]===i?(l=t[3],u=t[4]):(l=()=>{let e=new Set(i.map(Io));for(let t of Oo.keys())e.has(t)||Oo.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?ko[t.type]:null,s=vo(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:So({position:r,isTop:o}),toast:t,children:[(0,L.jsx)(No,{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`}),Co({type:t.type,description:t.description,hideCopyButton:t.data?.hideCopyButton})&&(0,L.jsx)(Ao,{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(ho({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 Io(e){return e.id}function Lo(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)(Ro,{}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,L.jsxs)(va,{toastManager:Do,...r,children:[n,i]}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function Ro(){let e=(0,R.c)(7),{toasts:t}=io(),n=jo(),r;if(e[0]!==n||e[1]!==t){let i;e[3]===n?i=e[4]:(i=e=>xo(e.data,n),e[3]=n,e[4]=i),r=t.filter(i).map(zo),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 zo(e){let t=e.type?ko[e.type]:null,n=To({tooltipStyle:e.data?.tooltipStyle})===`tooltip`,r=e.positionerProps;return!wo({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`}),Co({type:e.type,description:e.description,hideCopyButton:e.data?.hideCopyButton})&&(0,L.jsx)(Ao,{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(ho({size:`xs`}),`shrink-0`),"data-slot":`toast-action`,children:e.actionProps.children})]})})},e.id)}var Bo=I.createContext(void 0);function Vo(){let e=I.useContext(Bo);if(e===void 0)throw Error(Jr(53));return e}function Ho(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 Uo=`base-ui-disable-scrollbar`,Wo={className:Uo,getElement(e){return(0,L.jsx)(`style`,{nonce:e,href:Uo,precedence:`base-ui:low`,children:`.${Uo}{scrollbar-width:none}.${Uo}::-webkit-scrollbar{display:none}`})}},Go=e=>t=>t?{[e]:``}:null,Ko={hasOverflowX:Go(`data-has-overflow-x`),hasOverflowY:Go(`data-has-overflow-y`),overflowXStart:Go(`data-overflow-x-start`),overflowXEnd:Go(`data-overflow-x-end`),overflowYStart:Go(`data-overflow-y-start`),overflowYEnd:Go(`data-overflow-y-end`),cornerHidden:()=>null},qo=I.createContext(void 0),Jo={disableStyleElements:!1};function Yo(){return I.useContext(qo)??Jo}var Xo={x:0,y:0},Zo={width:0,height:0},Qo={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},$o={x:!0,y:!0,corner:!0},es=I.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=ts(i),d=qr(),f=Se(),p=Se(),{nonce:m,disableStyleElements:h}=Yo(),[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(Zo),[O,k]=I.useState(Zo),[A,j]=I.useState(Qo),[M,N]=I.useState($o),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(Xo),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=Ho(i,`padding`,a),s=Ho(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=Ar(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:Ko}),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)(Bo.Provider,{value:Te,children:[!h&&Wo.getElement(m),we]})});function ts(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 ns=I.createContext(void 0);function rs(e,t){return Math.max(0,e-t)}function is(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 as=[`--scroll-area-overflow-x-start`,`--scroll-area-overflow-x-end`,`--scroll-area-overflow-y-start`,`--scroll-area-overflow-y-end`],os=!1;function ss(){os||p||(typeof CSS<`u`&&`registerProperty`in CSS&&as.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),os=!0)}var cs=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}=Vo(),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=ls(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=is(T===`rtl`?-w:w,ee),te=ee-F);let ne=A?0:is(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=Ho(n,`padding`,`x`),fe=Ho(t,`padding`,`y`),pe=Ho(i,`margin`,`x`),me=Ho(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=>us(e,{width:ye,height:be})),t&&r){let e=ds(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=ds(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];as.forEach((t,n)=>{e.style.setProperty(t,`${xe[n]}px`)}),a&&p(e=>us(e,{width:oe,height:se})),g(e=>us(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=>us(e,Se))});Kr(()=>{ss()},[]),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:Wo.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:Ko}),ee=I.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,L.jsx)(ns.Provider,{value:ee,children:N})});function ls(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function us(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function ds(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 fs=I.createContext(void 0);function ps(){let e=I.useContext(fs);if(e===void 0)throw Error(Jr(54));return e}var ms=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}=Vo(),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=yr(e.nativeEvent),n=E?h.current:g.current;if(n&&Ar(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=Ho(n,`margin`,a),s=Ho(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:Ko});return j?(0,L.jsx)(fs.Provider,{value:i,children:N}):null}),hs=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}=Vo(),m=ps(),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]})}),gs=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=Vo(),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 _s(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)(cs,{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)(vs,{orientation:`vertical`}),(0,L.jsx)(vs,{orientation:`horizontal`}),(0,L.jsx)(gs,{"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)(es,{className:d,...i,children:[g,_]}),t[18]=i,t[19]=_,t[20]=d,t[21]=g,t[22]=v):v=t[22],v}function vs(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)(hs,{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)(ms,{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 ys(){return[{id:`cloud`,enabled:!0},{id:`desktop-local`,enabled:!0}]}function bs(e,t){let n=t.find(t=>t.id===e);return n?.enabled?n.id:`cloud`}function xs(e){let t=e.capabilities??ys();return{requestedDefault:e.requestedDefault,effectiveDefault:bs(e.requestedDefault,t),capabilities:t}}function Ss(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 Cs(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function ws(e){if(e.latestUserMessageAt)return Cs(e.latestUserMessageAt)??-1/0;let t=null;for(let n of e.messages??[]){if(n.role!==`user`)continue;let e=Cs(n.createdAt);e!==null&&(t=t===null?e:Math.max(t,e))}return t===null?Cs(e.updatedAt??e.createdAt)??-1/0:t}function Ts(e,t){return t===`created_at`?Cs(e.createdAt)??-1/0:ws(e)}function Es(e,t){return e.toSorted((e,n)=>{let r=Ts(n,t),i=Ts(e,t),a=r===i?0:r>i?1:-1;return a===0?n.id.localeCompare(e.id):a})}function Ds(e,t,n){return Es(e.filter(e=>e.projectId===t&&e.archivedAt===null),n)[0]??null}function Os(e){return typeof e==`string`&&e.trim().length>0}function ks(e){return e?.status===`running`&&Os(e.activeTurnId)}function As(e){return e?e.status===`connecting`||e.status===`running`&&!Os(e.activeTurnId):!1}function js(e){return e?.status===`error`}var Ms=`[data-thread-item], [data-thread-selection-safe]`,Ns=10,Ps={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 Fs(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 Is(){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=Fs({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 Ls(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 Rs(e){return e===null||!e.closest(Ms)}function zs(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 Bs(e,t=Ns){return e.slice(0,Math.max(0,t))}function Vs(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 Hs(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`,Ss(e))}function Us(e){let{thread:t}=e;return js(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}:ks(t.session)||t.status===`running`?{label:`Working`,colorClass:`text-hue-sky-foreground`,dotClass:`bg-hue-sky dark:bg-hue-sky/80`,pulse:!0}:As(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`&&On(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}:Ls(t)?{label:`Completed`,colorClass:`text-success-foreground`,dotClass:`bg-success dark:bg-success/90`,pulse:!1}:null}function Ws(e){let t=null;for(let n of e)n!==null&&(t===null||Ps[n.label]>Ps[t.label])&&(t=n);return t}function Gs(e){let{deletedThreadId:t,deletedThreadIds:n,sortOrder:r,threads:i}=e,a=i.find(e=>e.id===t);return a?Es(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 Ks(e,t,n){return t.length>0?t.reduce((e,t)=>Math.max(e,Ts(t,n)),-1/0):n===`created_at`?Cs(e.createdAt)??-1/0:Cs(e.updatedAt??e.createdAt)??-1/0}function qs(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=Ks(t,r.get(t.id)??[],n),a=Ks(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 Js={links:[],loaded:!1},Ys=Js,Xs=null,Zs=0,Qs=!1,$s=null,ec=1e3,tc=new Set,nc=3e4;function rc(e){if(!e||typeof e!=`object`)return!0;let t=e.status;return typeof t!=`number`||t===408||t===429||t>=500}function ic(){for(let e of tc)e()}function ac(e){Ys=e,ic()}function oc(){$s!==null&&(clearTimeout($s),$s=null)}async function sc(){let e=await bn.listProjectLinks();return{links:e.links.map(e=>({forgeEnvironmentId:e.forgeEnvironmentId,forgeProjectId:e.forgeProjectId,cmmdProjectId:e.cmmdProjectId})),loaded:e.sources?.cmmdAvailable!==!1}}function cc(){if($s!==null||tc.size===0)return;let e=ec;ec=Math.min(ec*2,nc),$s=setTimeout(()=>{$s=null,!(tc.size===0||Ys.loaded)&&lc()},e)}function lc(){if(Ys.loaded||Xs!==null)return;let e=Zs;Xs=Promise.resolve().then(()=>sc()).then(t=>{e===Zs&&(ac(t),t.loaded?ec=1e3:cc())}).catch(t=>{e===Zs&&!Ys.loaded&&rc(t)&&cc()}).finally(()=>{Xs=null,Qs&&tc.size>0&&!Ys.loaded&&(Qs=!1,lc())})}function uc(){if(oc(),ec=1e3,Zs+=1,ac(Js),Xs!==null){Qs=!0;return}tc.size>0&&lc()}function dc(e){return tc.add(e),lc(),()=>{tc.delete(e),tc.size===0&&oc()}}function fc(){return Ys}function pc(){return(0,I.useSyncExternalStore)(dc,fc,fc)}var mc=I.createContext(void 0);function hc(e){let t=I.useContext(mc);if(t===void 0&&!e)throw Error(Jr(33));return t}var gc=I.createContext(void 0);function _c(e){let t=I.useContext(gc);if(t===void 0&&!e)throw Error(Jr(36));return t}var vc=I.createContext(void 0);function yc(e=!0){let t=I.useContext(vc);if(t===void 0&&!e)throw Error(Jr(25));return t}var bc=I.createContext(void 0);function xc(){let e=I.useContext(bc);if(e===void 0)throw Error(Jr(30));return e}function Sc(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=yc(!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:vr})},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&&!Cr&&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 Cc={type:`regular-item`};function wc(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}=Sr({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Sc({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=I.useCallback(e=>jr(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 Tc=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),Ec={checked(e){return e?{[Tc.checked]:``}:{[Tc.unchecked]:``}},...he},Dc=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=hc(!0),g=qr(i),{store:_}=_c(),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}=wc({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:Cc}),E=I.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function D(e){let t=Pr(vr,e.nativeEvent,void 0,{preventUnmountOnClose:Wr});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=Br(`div`,e,{state:E,stateAttributesMapping:Ec,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:D},p,w],ref:[T,t,m.ref]});return(0,L.jsx)(bc.Provider,{value:E,children:O})}),Oc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=xc(),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:Ec,props:{"aria-hidden":!0,...o},enabled:a||u})}),kc=I.createContext(void 0);function Ac(){let e=I.useContext(kc);if(e===void 0)throw Error(Jr(31));return e}var jc=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)(kc.Provider,{value:s,children:c})}),Mc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=qr(a),c=Ac();return Kr(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Br(`div`,e,{ref:t,props:{id:s,role:`presentation`,...o}})}),Nc=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=hc(!0),p=qr(i),{store:m}=_c(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=wc({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Cc});return Br(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),Pc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=_c(),{side:c,align:l}=hc(),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,Pr(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})}),Fc=I.createContext(void 0);function Ic(){let e=I.useContext(Fc);if(e===void 0)throw Error(Jr(32));return e}var Lc=I.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=_c();return i.useState(`mounted`)||n?(0,L.jsx)(Fc.Provider,{value:n,children:(0,L.jsx)(je,{ref:t,...r})}):null}),Rc=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}=_c(),y=Ic(),b=yc(!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,Pr(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,Pr(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,Pr(Ir))}):v.setOpen(!1,Pr(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)(mc.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)(st,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:xe})})]})}),zc=I.createContext(void 0);function Bc(){let e=I.useContext(zc);if(e===void 0)throw Error(Jr(34));return e}var Vc=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)(kc.Provider,{value:f,children:(0,L.jsx)(zc.Provider,{value:_,children:g})})})),Hc=I.createContext(void 0);function Uc(){let e=I.useContext(Hc);if(e===void 0)throw Error(Jr(35));return e}var Wc=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=hc(!0),m=qr(i),{store:h}=_c(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Bc(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=wc({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:Cc}),E=I.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=Pr(vr,e.nativeEvent,void 0,{preventUnmountOnClose:Wr});y(l,t)}let O=Br(`div`,e,{state:E,stateAttributesMapping:Ec,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,L.jsx)(Hc.Provider,{value:E,children:O})}),Gc=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Uc(),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:Ec,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),Kc=I.createContext(null);function qc(e){let t=I.useContext(Kc);if(t===null&&!e)throw Error(Jr(5));return t}var Jc={...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`)}},Yc=class extends h{constructor(e){super({...Zc(),...e},Xc(),Jc),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 Xc(){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 Zc(){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 Qc=I.createContext(void 0);function $c(){return I.useContext(Qc)}var el=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=yc(!0),S=_c(!0),w=qc(!0),T=$c(),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=tl({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,Pr(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=jr(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=jr(ke.trigger,Ee.trigger,ve);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ke.trigger,Ee.trigger,ve]),Ie=I.useMemo(()=>jr(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)(gc.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 tl(e){return Vr(()=>new Yc(e)).current}function nl(e){let t=_c().store,n=I.useMemo(()=>({parentMenu:t}),[t]);return(0,L.jsx)(Qc.Provider,{value:n,children:(0,L.jsx)(el,{...e})})}var rl=5;function il(e,t){let n=al(t);return e.clientX>=n.left-rl&&e.clientX<=n.right+rl&&e.clientY>=n.top-rl&&e.clientY<=n.bottom+rl}function al(e){let t=e.getBoundingClientRect(),n=ri(e);if(br)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 ol(e){if(Hr(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!ii(e))return ol(fi(e))}function sl(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 cl=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=_c(!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=ul(),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}=Sr({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;Ar(ae.current,t)||Ar(y.select(`positionerElement`),t)||t===ae.current||(t==null||ol(t)!==y.select(`rootId`))&&(il(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=ll(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=sl({open:C,enabled:P,mouseDownAction:`open`}),ge=I.useMemo(()=>jr(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 ll(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 ul(){let e=qc(!0);return I.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var dl={"aria-expanded":void 0},fl=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=$c();if(!m?.parentMenu)throw Error(Jr(37));let h=ci({guess:!0,label:a}),g=hc(),{store:_}=_c(),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}=wc({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?dl: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]})}),pl=I.createContext(!1);function ml(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(pl.Provider,{value:!0,children:(0,L.jsx)(jc,{"data-slot":`menu-group`,...e})}),t[0]=e,t[1]=n),n}function hl(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(pl.Provider,{value:!0,children:(0,L.jsx)(Vc,{"data-slot":`menu-radio-group`,...e})}),t[0]=e,t[1]=n),n}var gl=`px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8`;function _l(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(pl)){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(gl,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(gl,n),t[16]=n,t[17]=a);let o;return t[18]!==r||t[19]!==i||t[20]!==a?(o=(0,L.jsx)(Mc,{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 vl=el;function yl(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)(cl,{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 bl(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)(Pc,{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)(Lc,{children:(0,L.jsx)(Rc,{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 xl(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)(Nc,{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 Sl(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)(Oc,{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)(Oc,{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)(Dc,{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 Cl(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)(Gc,{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)(Wc,{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 wl(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)(wn,{className:i,"data-slot":`menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}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(`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 El(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(nl,{"data-slot":`menu-sub`,...e}),t[0]=e,t[1]=n),n}function Dl(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)(lr,{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)(fl,{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 Ol(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)(bl,{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 kl(e){if(!e.environmentId)return null;let t=e.readEnvironmentApi(e.environmentId);return t?{environmentId:e.environmentId,api:t}:null}function Al(e){let t=xs({requestedDefault:e.requestedRuntime}),n=kl({environmentId:e.activeEnvironmentId,readEnvironmentApi:e.readEnvironmentApi}),r=kl({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 jl(e){return e.projectRef}function Ml(e){let t=e.latestActiveDraft;return!t||e.routeTargetKind!==`draft`||t.logicalProjectKey!==e.logicalProjectKey?!1:t.promotedTo==null}async function Nl(e){e.openBrowserPreview&&Ye.getState().revealBrowser(fr(e.draftId)),await e.router.navigate({to:`/draft/$draftId`,params:{draftId:e.draftId},...e.viewTransition?{viewTransition:!0}:{}})}function Pl(){let e=Rn(e=>e.activeEnvironmentId),t=Rn(e=>e.environmentStateById),n=(0,I.useMemo)(()=>({activeEnvironmentId:e,environmentStateById:t}),[e,t]);return(0,I.useMemo)(()=>qn(n),[n])}var Fl=`package`;function Il(e,t){let n=t.repositoryIdentity?.canonicalKey;return n?e[n]??`package`:Fl}function Ll(e,t=Fl){if(t===`repository`)return e.canonicalKey;let n=e.repositorySubpath?.trim();return n&&n.length>0?`${e.canonicalKey}#${n}`:e.canonicalKey}function Rl(e,t=Fl){return e.repositoryIdentity?Ll(e.repositoryIdentity,t):Wt(Qe(e.environmentId,e.id))}function zl(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 Bl(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 Vl(e,t=()=>Fl){let n=new Map;for(let r of e){if(!r.repositoryIdentity)continue;let e=zl(r.cwd)??Bl(r.cwd,r.repositoryIdentity.repositorySubpath);if(!e)continue;let i=n.get(e)??new Set;i.add(Rl(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=Wt(Qe(n.environmentId,n.id)),a=n.repositoryIdentity?null:zl(n.cwd);i.set(e,(a?r.get(a):void 0)??Rl(n,n.repositoryIdentity?t(n.repositoryIdentity):void 0))}return i}function Hl(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 Ul(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 Wl(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 Gl(e){let{branch:t,worktreePath:n,envMode:r,cmmdTaskId:i,linkedPullRequest:a}=Wl(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 Kl(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 ql(){let e=(0,R.c)(6),t=Pl(),n=Tn(),r;e[0]===n.state.matches?r=e[1]:(r=()=>{let e=n.state.matches[n.state.matches.length-1]?.params??{};return pn(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}=zt.getState(),d=i(),f=t.find(t=>t.id===e.projectId&&t.environmentId===e.environmentId),p=f?Rl(f):Wt(e),m=Wl(r),h=Gl(r),g=Ul(r),_=a(p),v=tu(d,{getDraftThread:s,getDraftSession:o}),y=e=>{let t=zt.getState();Hl({target:e,prompt:r?.initialPrompt,...r?.autoSubmit===void 0?{}:{autoSubmit:r.autoSubmit},setPrompt:t.setPrompt,setPendingAutoSubmit:t.setPendingAutoSubmit})},b=Jl(_,r?.draftReuse);if(b)return(async()=>(Yl({mentionsContext:g,draftId:b.draftId,contextPatch:m,setDraftThreadContext:l}),u(p,e,b.draftId,{threadId:b.threadId,...Xl(r?.cmmdTaskId)}),y(b.draftId),await Nl({router:n,draftId:b.draftId,openBrowserPreview:r?.openBrowserPreview,viewTransition:r?.viewTransition}),Zl(b)))();let x=Jl(v,r?.draftReuse);if(x&&d?.kind===`draft`&&Ml({latestActiveDraft:x,routeTargetKind:d.kind,logicalProjectKey:p}))return Yl({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=kr(),w=new Date().toISOString();return(async()=>(u(p,e,S,Kl(r,{threadId:C,createdAt:w,runtimeMode:Si})),c(S),y(S),await Nl({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 Jl(e,t){return t===`never`?null:e}function Yl(e){e.mentionsContext&&e.setDraftThreadContext(e.draftId,e.contextPatch)}function Xl(e){return e===void 0?{}:{cmmdTaskId:e}}function Zl(e){return{draftId:e.draftId,threadId:e.threadId,projectRef:Qe(e.environmentId,e.projectId)}}function Ql(){let e=(0,R.c)(5),t=ql(),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 $l(){let e=ar(e=>e.projectOrder),t=_n({strict:!1,select:e=>pn(e)}),n=t?.kind===`server`?t.threadRef:null,r=Rn((0,I.useMemo)(()=>dt(n),[n])),i=zt(e=>e.getDraftThread),a=zt(()=>t?t.kind===`server`?i(t.threadRef):zt.getState().getDraftSession(t.draftId):null),o=bt(),s=Vt(e=>e.defaultThreadRuntime),c=Pl(),l=(0,I.useMemo)(()=>zs({items:c,preferredIds:e,getId:e=>Wt(Qe(e.environmentId,e.id))}),[e,c]),u=ql(),d=(0,I.useCallback)(async(...e)=>{await u(...e)},[u]),f=(0,I.useMemo)(()=>{let e=l[0];return e?jl({requestedRuntime:s,primaryEnvironmentId:o,projects:c,projectRef:Qe(e.environmentId,e.id)}):null},[s,l,o,c]);return{activeComposerTarget:eu(t),activeDraftThread:a,activeThread:r,defaultProjectRef:f,handleNewThread:d,openNewThread:u,routeThreadRef:n}}function eu(e){return e===null?null:e.kind===`server`?e.threadRef:e.draftId}function tu(e,t){return e?e.kind===`server`?t.getDraftThread(e.threadRef):t.getDraftSession(e.draftId):null}function nu(e){let t=e.replace(/[/\\]+$/,``)||e,n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return(n>=0?t.slice(n+1):t)||e}var ru=`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`,iu=`size-3.5 shrink-0 opacity-85`,au=`truncate select-none leading-tight`,ou=`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`,su=`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`,cu=`<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>`,lu=(0,I.createContext)(null);function uu(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function du(){let e=(0,I.useContext)(lu);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 fu(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 pu=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,mu=pu&&`documentMode`in document?document.documentMode:null,hu=pu&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),gu=pu&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_u=!(!pu||!(`InputEvent`in window)||mu)&&`getTargetRanges`in new window.InputEvent(`input`),vu=pu&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,yu=pu&&/Android/.test(navigator.userAgent),bu=pu&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!yu,xu=pu&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Su=pu&&yu&&xu,Cu=pu&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&hu&&!xu,wu=0,Tu=1,Eu=2,Du=1,Ou=2,ku=3,Au=4,ju=5,Mu=6,Nu=bu||vu||Cu?`\xA0`:``,Pu=`
|
|
2
2
|
|
|
3
3
|
`,Fu=gu?`\xA0`:Nu,Iu={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Lu={directionless:1,unmergeable:2},Ru={center:2,end:6,justify:4,left:1,right:3,start:5},zu={[Ou]:`center`,[Mu]:`end`,[Au]:`justify`,[Du]:`left`,[ku]:`right`,[ju]:`start`},Bu={normal:0,segmented:2,token:1},Vu={[wu]:`normal`,[Eu]:`segmented`,[Tu]:`token`},Hu=`$config`;function Uu(){return Nv()._blockCursorElement}function Wu(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-slot`)}var Gu=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=Ku(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=Ku(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 Ku(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;return n}var qu=class e extends Gu{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(;Wu(t);)e=t,t=t.nextSibling;let n=e?e.nextSibling:this.element.firstChild;return n!==null&&n===Uu()?n:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{let t=e===`decorator`&&(Cu||vu||bu);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=mv().createElement(`br`);if(i.setAttribute(`data-lexical-managed-linebreak`,`true`),n.insertBefore(i,r),e){let e=mv().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=Uu(),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=Ju(t,n);i.push(r);let a=Ju(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 Ju(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 Yu;try{Yu=`0.49.0+prod.esm`}catch{}var Xu=Yu??`"<unknown>+source"`,Zu=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]()}},Qu=null;function $u(e,t=1e3){return e instanceof ed?e.clone():e.size<t?new Map(e):new ed().init(new Map(e),void 0,e.size)}var ed=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===Qu?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===Qu?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!==Qu&&n!==void 0||(this._size++,n===Qu&&r.delete(e)),r.set(e,t),this}delete(e){let t=this.has(e);return t&&(this.getNursery().set(e,Qu),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!==Qu&&(r!==void 0&&(n[1]=r),yield n)}if(e)for(let n of e)n[1]===Qu||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 td(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)||oy(o)&&o.__slots!==null)&&td(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}for(let o of oy(e)&&e.__slots!==null?e.__slots.values():[]){let e=r.get(o);e!==void 0&&sy(e)&&e.__slotHost===t&&((W(e)||oy(e)&&e.__slots!==null)&&td(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o))}}var nd=!1,rd=0;function id(e){rd=e.timeStamp}function ad(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&g_(e,n)!==void 0}function od(e,t,n){let r=sv(X_(n)),i=r&&_v(r,n._rootElement),a=null,o=null;i!==null&&i.anchorNode===e&&(a=i.anchorOffset,o=i.focusOffset);let s=e.nodeValue;s!==null&&k_(t,s,a,o,!1)}function sd(e,t,n){if(H(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return r_(t)&&n.isAttached()}function cd(e,t,n){for(let r=e;r&&!qv(r);r=W_(r)){let e=g_(r,t);if(e!==void 0){let t=p_(e,n);if(t)return hg(t)||!Tv(r)?void 0:[r,t]}}}function ld(e,t,n){nd=!0;let r=performance.now()-rd>100;try{ug(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=cd(f,e,o);if(!p)continue;let[m,h]=p;if(d===`characterData`)r&&V(h)&&r_(f)&&sd(i,f,h)&&od(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=m_(r),a=r.parentNode;if(!(a==null||r===s||i!==null||ad(r,a,e)||e._slotsUsed&&Tv(r)&&r.hasAttribute(`data-lexical-slot`)||qv(r))){if(gu){let e=(Tv(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];(ad(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`||ad(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(c&&x_(i),gu&&H_(e)&&i.insertRawText(l))})}finally{nd=!1}}function ud(e){let t=e._observer;t!==null&&ld(e,t.takeRecords(),t)}function dd(e){(function(e){rd===0&&X_(e).addEventListener(`textInput`,id,!0)})(e),e._observer=new MutationObserver((t,n)=>{ld(e,t,n)})}var fd=`latest`,pd=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Cd).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function md(e,t){return new pd(e,t)}function hd(e,t,n=fd){let r=(n===`latest`?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function gd(e,t,n){let r;if(Wh(),typeof n==`function`){let i=e.getLatest(),a=hd(i,t);if(r=n(a),t.isEqual(a,r))return i}else r=n;let i=e.getWritable();return bd(i).updateFromKnown(t,r),i}function _d(e){let t=new Map,n=new Set;for(let{ownNodeConfig:r}of ey(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 vd=new Set([`__proto__`,`constructor`,`prototype`]),yd=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 Sd(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(vd.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=Sd(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){if(vd.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 bd(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new yd(t,xd(t));return t.__state=n,n}function xd(e){return e.__state?e.__state.sharedNodeState:qg(Nv(),e.getType()).sharedNodeState}function Sd(e){if(e)for(let t in e)return e}function Cd(e){return e}function wd(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 Td(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 Ed(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Dd(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&&wd(n,e,t)||t&&wd(n,t,e)||e&&Td(n,e,t)||t&&Td(n,t,e))}(c,l))}function Od(e,t){let n=e.mergeWithSibling(t),r=Jh()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function kd(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(Dd(t,r)){r=Od(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&V(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(Dd(r,n)){r=Od(r,n);break}break}n.remove()}}else r.remove()}function Ad(e){return jd(e.anchor),jd(e.focus),e}function jd(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 Md=Symbol.for(`@lexical/CachedTextSize`);function Nd(e,t){return Xd.read(()=>{let n=0,r=e;for(let e=0;e<t&&r!==null;e++){let i=Yd.get(r);if(i===void 0&&z(345,r),W(i)){let a=Zd.get(r);if(a!==void 0&&W(a)&&a.__parent!==i.__parent)n+=i.getTextContentSize();else{let e=Qd.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[Md];e===void 0&&z(347,i.getType(),r),n+=e}r=i.__next}return n},{editor:Ld})}function Pd(e){W(e)||e[Md]===void 0&&(e[Md]=V(e)?e.__text.length:e.getTextContentSize())}var Fd=4,Id,Ld,Rd,zd=``,Bd=null,Vd=null,Hd=null;function Ud(){return{firstTextKey:Hd,format:Bd,style:Vd}}function Wd(e){e.firstTextKey!==null&&(Bd=e.format,Vd=e.style,Hd=e.firstTextKey)}function Gd(e){if(Hd!==null)return;let t=e.__lexicalFirstTextKey;if(t===void 0&&z(348),t===null)return;let n=Zd.get(t);V(n)&&(Bd=n.getFormat(),Vd=n.getStyle(),Hd=t)}var Kd,qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf=!1,rf=!1;function af(e,t){let n=Yd.get(e),r=Zd.has(e);if(t!==null){let n=kf(e);n.parentNode===t&&t.removeChild(n)}if(!r){if(Ld._keyToDOMMap.delete(e),W(n)){let e=ry(n,Yd);of(e,0,e.length-1,null)}if(n!==void 0){for(let e of hf(n).values()){let t=_f(e);af(e,null),t!==null&&t.remove()}z_(ef,Rd,Kd,n,`destroyed`)}}}function of(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&af(t,r)}}function sf(e,t){e.setProperty(`text-align`,t)}var cf=`40px`;function lf(e,t){let n=Id.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, ${cf}))`)}function uf(e,t){let n=e.style;t===0?sf(n,``):t===1?sf(n,`left`):t===2?sf(n,`center`):t===3?sf(n,`right`):t===4?sf(n,`justify`):t===5?sf(n,`start`):t===6&&sf(n,`end`)}function df(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(_g(e))return null;let n=e.getParent();return n===null||ev(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function ff(e){let t=mv().createElement(`div`);return t.setAttribute(`data-lexical-slot`,e),t.style.display=`none`,t}function pf(e,t,n){t||e.contentEditable===`false`?Jv(n,Ld):n.removeAttribute(`contenteditable`)}function mf(e,t,n){let r=zd,i=Ud();zd=``;let a=``,o=hg(e);for(let[r,i]of n){let n=ff(r);pf(t,o,n),t.appendChild(n),zd=``;let s=Ud();yf(i,Fv(e,n,Ld)),Wd(s),gf(e,r,t,n),a+=zd}return Wd(i),zd=r,a}function hf(e){return oy(e)&&e.__slots!==null?e.__slots:ay}function gf(e,t,n,r){let i=tf.$getSlotTargetElement(e,t,n,Ld);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display=``)}function _f(e){let t=Qd.get(e);return t===void 0?null:t.parentElement}function vf(e,t,n){let r=hf(e),i=hf(t);for(let[e,t]of r)if(!i.has(e)){let e=_f(t);af(t,null),e!==null&&e.remove()}let a=zd,o=Ud(),s=``,c=null,l=hg(t);for(let[e,a]of i){let i=r.get(e),o=i===void 0?null:_f(i);zd=``;let u=Ud();if(o===null){o=ff(e);let r=null;for(let e of n.children)if(!e.hasAttribute(`data-lexical-slot`)){r=e;break}n.insertBefore(o,r),yf(a,Fv(t,o,Ld))}else i===a?wf(a,o):(i!==void 0&&af(i,o),yf(a,Fv(t,o,Ld)));if(Wd(u),pf(n,l,o),gf(t,e,n,o),s+=zd,o.parentElement===n){let e=c===null?n.firstChild:c.nextSibling;e!==o&&n.insertBefore(o,e),c=o}}return Wd(o),zd=a,s}function yf(e,t){let n=Zd.get(e);if(n===void 0&&z(60),t!==null){let r=Yd.get(e);if(r!==void 0){let i=Qd.get(e);if(i!==void 0){let a=sy(r)?r.__slotHost:null,o=sy(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),wf(e,t.element)}}}let r=tf.$createDOM(n,Ld);if(function(e,t,n){let r=n._keyToDOMMap;h_(t,n,e),r.set(e,t)}(e,r,Ld),V(n)?r.setAttribute(`data-lexical-text`,`true`):hg(n)&&(r.setAttribute(`data-lexical-decorator`,`true`),Kv(r,{captureSelection:!0})),W(n)){let e=n.__indent,t=n.__size;df(r,n),e!==0&&lf(r,e);let i=hf(n),a=i.size>0?mf(n,r,i):``;if(t===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,zd+=a,i.size>0&&(r.__lexicalSlotTextLength=a.length);else{let e=zd,o=t-1;if(bf(ry(n,Zd),n,0,o,Fv(n,r,Ld)),a!==``){let t=r.__lexicalTextContent||``;r.__lexicalTextContent=a+t,zd=e+a+t}i.size>0&&(r.__lexicalSlotTextLength=a.length)}let o=n.__format;o!==0&&uf(r,o),n.isInline()||xf(null,n,r)}else{let t=n.getTextContent();if(hg(n)){let t=n.decorate(Ld,Id);t!==null&&Tf(e,t),r.contentEditable=`false`;let i=hf(n);i.size>0&&mf(n,r,i)}zd+=t}return t!==null&&t.insertChild(r),tf.$decorateDOM(n,null,r,Ld),Pd(n),z_(ef,Rd,Kd,n,`created`),r}function bf(e,t,n,r,i){let a=zd,o=Ud();zd=``,Bd=null,Vd=null,Hd=null;let s=n;for(;s<=r;++s){let t=Ud();yf(e[s],i);let n=Zd.get(e[s]);n!==null&&V(n)?Bd===null&&(Bd=n.getFormat(),Vd=n.getStyle(),Hd=n.__key):W(n)&&s<r&&!n.isInline()&&(zd+=Pu),Wd(t)}let c=Ld._keyToDOMMap.get(t.__key);c===void 0&&z(349,t.__key),c.__lexicalTextContent=zd,c.__lexicalFirstTextKey=Hd,zd=a+zd,Wd(o)}function xf(e,t,n){let r=Fv(t,n,Ld),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 Dg(e)?`line-break`:hg(e)&&e.isInline()?`decorator`:null}return hf(e).size>0?null:`empty`}return null}(t,Zd);i!==a&&r.setManagedLineBreak(a)}function Sf(e,t,n){var r;Bd=null,Vd=null,Hd=null,function(e,t,n){let r=zd,i=e.__size,a=t.__size;zd=``;let o=n.element,s=Ld._keyToDOMMap.get(t.__key);s===void 0&&z(351,t.__key);let c=a-i;if(!nf&&Math.abs(c)<=1&&i>=Fd&&e.__first===t.__first&&(c!==0||!Ld._cloneNotNeeded.has(e.__key))){let i=s.__lexicalTextContent,l=$d.get(e.__key);if(!nf&&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=Zd.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=Nd(a,u),n=a,c=0;for(;n!==null&&c<u;){let e=Zd.get(n);if(e===void 0)break;let t=Ud();wf(n,o),V(e)&&Bd===null&&(Bd=e.getFormat(),Vd=e.getStyle(),Hd=e.__key),Wd(t),n=e.__next,c++}let d=``;for(n=a,c=0;n!==null&&c<u;){let e=Zd.get(n);if(e===void 0)break;let t;if(W(e)){let r=Ld._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+=Pu),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,zd=r+m,Cf(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=Yd.get(l);if(e===void 0)return!1;l=e.__prev}if(l===null)return!1;let u=Zd.get(a),d=Yd.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=Zd.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=Yd.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=Nd(l,c);for(let e of _){let t=Ud();if(e.kind===`reconcile`)wf(e.key,n.element);else if(e.kind===`destroy`)af(e.key,n.element);else{let t=null;for(let n=e.nextIndex+1;n<o;n++){let e=Ld._keyToDOMMap.get(f[n]);if(e!==void 0){t=e;break}}yf(e.key,n.withBefore(t??n.before))}if(e.kind!==`destroy`){let t=Zd.get(e.key);t&&V(t)&&Bd===null&&(Bd=t.getFormat(),Vd=t.getStyle(),Hd=t.__key)}Wd(t)}let x=``;for(let e=0;e<o;e++){let t=Zd.get(f[e]);if(t===void 0)return!1;let n;if(W(t)){let r=Ld._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+=Pu)}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),zd=r+e,Cf(t,s,l);return}}}if(c===0){let t=e.__first,n=0;for(;t!==null;){let e=Zd.get(t);if(e===void 0)break;let r=nf||Jd.has(t)||qd.has(t),i=Ud();if(r)wf(t,o);else{let n,r;if(W(e)){r=Qd.get(t);let i=r&&r.__lexicalTextContent;typeof i!=`string`&&z(354,e.getType()),n=i}else n=e.getTextContent();zd+=n,r!==void 0&&Gd(r)}V(e)?Bd===null&&(Bd=e.getFormat(),Vd=e.getStyle(),Hd=e.__key):W(e)&&n<a-1&&!e.isInline()&&(zd+=Pu),Wd(i),t=e.__next,n++}s.__lexicalTextContent=zd,s.__lexicalFirstTextKey=Hd,zd=r+zd;return}}if(i===1&&a===1){let r=e.__first,i=t.__first;if(r===i)wf(r,o);else{let e=kf(r),t=yf(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}af(r,null)}let a=Zd.get(i);V(a)&&Bd===null&&(Bd=a.getFormat(),Vd=a.getStyle(),Hd=a.__key)}else{let r=ry(e,Yd),s=ry(t,Zd);if(r.length!==i&&z(227),s.length!==a&&z(228),i===0)a!==0&&bf(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&hf(t).size===0&&n.element.__lexicalLineBreak==null;of(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=Ud();if(e===r)u=Ef(wf(r,a.element)),d++,f++;else{if(l===void 0&&(l=Df(n,f)),c===void 0)c=Df(t,d);else if(!c.has(e)){d++,Wd(i);continue}if(!l.has(e)){u=Ef(kf(e)),af(e,a.element),d++,c.delete(e),Wd(i);continue}if(c.has(r)){let e=U_(Ld,r);e!==u&&a.withBefore(u??a.before).insertChild(e),u=Ef(wf(r,a.element)),d++,f++}else yf(r,a.withBefore(u??a.before)),f++}let o=Zd.get(r);o!==null&&V(o)?Bd===null&&(Bd=o.getFormat(),Vd=o.getStyle(),Hd=o.__key):W(o)&&f<=s&&!o.isInline()&&(zd+=Pu),Wd(i)}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:Ld.getElementByKey(t);bf(n,e,f,s,a.withBefore(r??a.before))}else m&&!p&&of(t,d,o,a.element)})(t,r,s,i,a,n)}s.__lexicalTextContent=zd,s.__lexicalFirstTextKey=Hd,zd=r+zd}(e,t,Fv(t,n,Ld)),ev(t)||(r=t,Bd==null||Bd===r.__textFormat||rf||r.setTextFormat(Bd),function(e){Vd==null||Vd===e.__textStyle||rf||e.setTextStyle(Vd)}(t))}function Cf(e,t,n){let r=t.__lexicalFirstTextKey;if(r!=null){let t=e.__key,i=r;for(;i!==null;){let e=Zd.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=Zd.get(r);if(V(e))return Bd=e.getFormat(),void(Vd=e.getStyle())}}t.__lexicalFirstTextKey=Hd}function wf(e,t){let n=Yd.get(e),r=Zd.get(e);n!==void 0&&r!==void 0||z(61);let i=nf||Jd.has(e)||qd.has(e),a=U_(Ld,e);if(n===r&&!i){let e;if(W(n)){let t=a.__lexicalTextContent;typeof t!=`string`&&z(355,n.getType()),e=t,Gd(a)}else e=n.getTextContent();return zd+=e,a}if(n!==r&&i&&z_(ef,Rd,Kd,r,`updated`),tf.$updateDOM(r,n,a,Ld)){let n=yf(e,null);return t===null&&z(62),t.replaceChild(n,a),af(e,null),n}if(W(n)){W(r)||z(334,e);let t=r.__indent;(nf||t!==n.__indent)&&lf(a,t);let o=r.__format;(nf||o!==n.__format)&&uf(a,o);let s=i&&(hf(r).size>0||hf(n).size>0)?vf(n,r,a):``;if(i){let e=zd;if(Sf(n,r,a),_g(r)||r.isInline()||xf(0,r,a),s!==``){let t=a.__lexicalTextContent||``;a.__lexicalTextContent=s+t,zd=e+s+t,a.__lexicalSlotTextLength=s.length}else(hf(r).size>0||hf(n).size>0)&&(a.__lexicalSlotTextLength=0)}else{let e=a.__lexicalTextContent;typeof e!=`string`&&z(356,n.getType()),zd+=e,Gd(a)}if((nf||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(df(a,r),_g(r)&&!nf))for(let e of r.getChildren())W(e)&&df(U_(Ld,e.getKey()),e)}else{let t=r.getTextContent();if(hg(r)){let t=r.decorate(Ld,Id);t!==null&&Tf(e,t),i&&(hf(r).size>0||hf(n).size>0)&&vf(n,r,a)}zd+=t}if(!rf&&_g(r)){let e=r.getLatest();if(e.__cachedText!==zd){let t=e.getWritable();t.__cachedText=zd,r=t}}return tf.$decorateDOM(r,n,a,Ld),Pd(r),a}function Tf(e,t){let n=Ld._pendingDecorators,r=Ld._decorators;if(n===null){if(r[e]===t)return;n=v_(Ld)}n[e]=t}function Ef(e){let t=e.nextSibling;return t!==null&&t===Ld._blockCursorElement&&(t=t.nextSibling),t}function Df(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function Of(e,t,n,r,i,a){zd=``,Bd=null,Vd=null,Hd=null,nf=r===2,Ld=n,Id=n._config,tf=n._config.dom||Rg,Rd=n._nodes,Kd=Ld._listeners.mutation,qd=i,Jd=a,Yd=e._nodeMap,Xd=e,Zd=t._nodeMap,rf=t._readOnly,Qd=$u(n._keyToDOMMap),$d=function(){let e=new Map,t=t=>{for(let n of t){let t=Zd.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(Jd),e}();let o=new Map;return ef=o,wf(`root`,null),Ld=void 0,Rd=void 0,qd=void 0,Jd=void 0,Yd=void 0,Xd=void 0,Zd=void 0,Id=void 0,Qd=void 0,$d=void 0,ef=void 0,tf=Rg,o}function kf(e){let t=Qd.get(e);return t===void 0&&z(75,e),t}function B(e){return{type:e}}var Af=B(`SELECTION_CHANGE_COMMAND`),jf=B(`SELECTION_INSERT_CLIPBOARD_NODES_COMMAND`),Mf=B(`CLICK_COMMAND`),Nf=B(`BEFORE_INPUT_COMMAND`),Pf=B(`INPUT_COMMAND`),Ff=B(`COMPOSITION_START_COMMAND`),If=B(`COMPOSITION_END_COMMAND`),Lf=B(`DELETE_CHARACTER_COMMAND`),Rf=B(`INSERT_LINE_BREAK_COMMAND`),zf=B(`INSERT_PARAGRAPH_COMMAND`),Bf=B(`CONTROLLED_TEXT_INSERTION_COMMAND`),Vf=B(`PASTE_COMMAND`),Hf=B(`REMOVE_TEXT_COMMAND`),Uf=B(`DELETE_WORD_COMMAND`),Wf=B(`DELETE_LINE_COMMAND`),Gf=B(`FORMAT_TEXT_COMMAND`),Kf=B(`SET_TEXT_FORMAT_COMMAND`),qf=B(`UNDO_COMMAND`),Jf=B(`REDO_COMMAND`),Yf=B(`KEYDOWN_COMMAND`),Xf=B(`KEY_ARROW_RIGHT_COMMAND`),Zf=B(`MOVE_TO_END`),Qf=B(`KEY_ARROW_LEFT_COMMAND`),$f=B(`MOVE_TO_START`),ep=B(`KEY_ARROW_UP_COMMAND`),tp=B(`KEY_ARROW_DOWN_COMMAND`),np=B(`KEY_ENTER_COMMAND`),rp=B(`KEY_SPACE_COMMAND`),ip=B(`KEY_BACKSPACE_COMMAND`),ap=B(`KEY_ESCAPE_COMMAND`),op=B(`KEY_DELETE_COMMAND`),sp=B(`KEY_TAB_COMMAND`),cp=B(`INSERT_TAB_COMMAND`),lp=B(`INDENT_CONTENT_COMMAND`),up=B(`OUTDENT_CONTENT_COMMAND`),dp=B(`DROP_COMMAND`),fp=B(`FORMAT_ELEMENT_COMMAND`),pp=B(`DRAGSTART_COMMAND`),mp=B(`DRAGOVER_COMMAND`),hp=B(`DRAGEND_COMMAND`),gp=B(`COPY_COMMAND`),_p=B(`CUT_COMMAND`),vp=B(`SELECT_ALL_COMMAND`),yp=B(`CLEAR_EDITOR_COMMAND`),bp=B(`CLEAR_HISTORY_COMMAND`),xp=B(`CAN_REDO_COMMAND`),Sp=B(`CAN_UNDO_COMMAND`),Cp=B(`FOCUS_COMMAND`),wp=B(`BLUR_COMMAND`),Tp=B(`KEY_MODIFIER_COMMAND`);function Ep(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 Dp(e,t,n,r){return e.addEventListener(t,n,r),e.removeEventListener.bind(e,t,n,r)}var Op=Object.freeze({}),kp=[[`keydown`,function(e,t){let n=t._inputState;n.lastKeyDownTimeStamp=e.timeStamp,n.lastKeyCode=e.key,e.key!==`Backspace`&&Bp(n),!t.isComposing()&&G(t,Yf,e)}],[`pointerdown`,function(e,t){let n=Cv(e),r=e.pointerType;Ev(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&ug(t,()=>{Yv(n,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}],[`compositionstart`,function(e,t){G(t,Ff,e)}],[`compositionend`,function(e,t){let n=t._inputState;gu?n.compositionPhase=`ending-firefox`:vu||!bu&&!Cu?G(t,If,e):(n.compositionPhase=`ending-safari`,n.compositionEndData=e.data)}],[`input`,function(e,t){e.stopPropagation();let n=t._inputState;Bp(n),ug(t,()=>{Hp(e,t)||t.dispatchCommand(Pf,e)},{event:e}),n.unprocessedBeforeInputData=null}],[`click`,function(e,t){ug(t,()=>{let n=U(),r=sv(X_(t)),i=vh();if(r){if(H(n)){let e=n.anchor,t=e.getNode();e.type===`element`&&e.offset===0&&n.isCollapsed()&&!_g(t)&&b_().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=_v(r,t._rootElement).anchorNode;(Tv(n)||r_(n))&&x_(_h(i,r,t,e))}}if(gu&&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(Tv(t)){let n=t.getBoundingClientRect();if(a<=(n.top+n.bottom)/2){o=e;break}}}r.setBaseAndExtent(n,o,n,o);let s=_h(i,r,t,e);s===null?r.removeAllRanges():x_(s)}}G(t,Mf,e)})}],[`cut`,Op],[`copy`,Op],[`dragstart`,Op],[`dragover`,Op],[`dragend`,Op],[`paste`,Op],[`focus`,Op],[`blur`,Op],[`drop`,Op]];_u&&kp.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||gu&&H_(t)||n!==`insertCompositionText`&&ug(t,()=>{Hp(e,t)||G(t,Nf,e)},{event:e})}(e,t)]);var Ap=new WeakMap,jp=new WeakMap,Mp=Ep(e=>(e.addEventListener(`selectionchange`,Qp),()=>e.removeEventListener(`selectionchange`,Qp)));function Np(e,t,n,r,i,a){let o=e.anchor,s=e.focus,c=o.getNode(),l=Jh(),u;if(a!==void 0)u=a;else{let e=sv(X_(l));u=e===null?null:_v(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&&(!_u||l._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&m<2||w_(n))&&o.offset!==s.offset&&!c.isComposing()||n_(c)||c.isDirty()&&m>1||(i||!_u)&&p!==null&&!c.isComposing()&&d!==Lv(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=t_(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 Pp(e,t){return r_(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function Fp(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=_v(e,t._rootElement),s=t._inputState;s.isSelectionChangeFromDOMUpdate&&(s.isSelectionChangeFromDOMUpdate=!1,Pp(r,i)&&Pp(a,o)&&!s.postDeleteSelectionToRestore)||ug(t,()=>{if(!n)return void x_(null);if(!Zg(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(),x_(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=X_(t).event,o=i?i.timeStamp:performance.now(),{format:u,style:d,offset:f,key:p,timeStamp:m}=s.collapsedSelectionFormat,h=b_(),g=!1===t.isComposing()&&h.getTextContent()===``;if(o<m+200&&n.offset===f&&n.key===p)Ip(c,u,d);else if(n.type===`text`)V(l)||z(141),Lp(c,l);else if(n.type===`element`&&!g){W(l)||z(259);let e=n.getNode();e.isEmpty()?function(e,t){Ip(e,t.getTextFormat(),t.getTextStyle())}(c,e):Ip(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,Af)})}function Ip(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function Lp(e,t){Ip(e,t.getFormat(),t.getStyle())}function Rp(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function zp(e){let{lastKeyCode:t}=Jh()._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 Zq(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 Qq(e){let[t,n]=(0,I.useState)(null),r=$l(),{openNewThread:i}=Ql(),a=Ye(t=>cJ(t.byThreadKey,r.activeComposerTarget,e.detail,e.sourceProject.environmentId)),o=sJ(e.targetProject,r,a);return{currentThreadMatches:o!==null,pendingAction:t,run:async(a,s=e.targetProject,c)=>{if(t===null){n(a);try{await $q({...e,targetProject:s,action:a,...c===void 0?{}:{finding:c},currentTarget:o,thread:r,openNewThread:i,canLinkPullRequest:e.canLinkPullRequest}),hJ(a)}catch(e){gJ(e)}finally{n(null)}}}}}async function $q(e){let t=Iq({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=Qe(e.targetProject.environmentId,e.targetProject.id),r=e.canLinkPullRequest?nJ(e.detail,e.reference):null,i=iJ(e.action,e.currentTarget);await eJ[i.kind]({input:e,projectRef:n,execution:i,prompt:t,linkedPullRequest:r})}var eJ={current:async e=>{let t=e.execution;await rJ(t.target,e.linkedPullRequest),fJ(t.target,mJ(e.prompt))},"new-without-checkout":async e=>{fJ((await e.input.openNewThread(e.projectRef,{draftReuse:`never`,...e.linkedPullRequest?{linkedPullRequest:e.linkedPullRequest}:{}})).draftId,mJ(e.prompt))},checkout:async e=>{let t=e.execution;await tJ(e.input,e.projectRef,t.checkout,e.prompt,e.linkedPullRequest)}};async function tJ(e,t,n,r,i){return Eq({openDraft:()=>e.openNewThread(t,{draftReuse:`never`,...i?{linkedPullRequest:i}:{}}),prepareCheckout:r=>_t(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=>fJ(e.draftId,r)})}function nJ(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 rJ(e,t){if(t!==null){if(typeof e==`string`){zt.getState().setDraftThreadContext(e,{linkedPullRequest:t});return}await _t(e.environmentId).orchestration.dispatchCommand({type:`thread.meta.update`,commandId:Fr(),threadId:e.threadId,linkedPullRequest:t})}}function iJ(e,t){return t!==null&&aJ.has(e)?{kind:`current`,target:t}:oJ[e]}var aJ=new Set([`ask`,`explain`,`fix`,`fix-finding`,`resolve-conflicts`,`selection`]),oJ={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 sJ(e,t,n){if(!n||t.activeComposerTarget===null)return null;let r=dJ(t);return r===null?null:uJ(r,e)?t.activeComposerTarget:null}function cJ(e,t,n,r){return t!==null&&(e[typeof t==`string`?fr(t):nt(t)]?.surfaces??[]).some(e=>lJ(e,n,r))}function lJ(e,t,n){return e.kind===`pull-request`&&e.environmentId===n&&e.projectId===t.projectId&&e.repository===t.repository&&e.number===t.number}function uJ(e,t){return e.projectId===t.id&&e.environmentId===t.environmentId}function dJ(e){return e.activeThread?Qe(e.activeThread.environmentId,e.activeThread.projectId):e.activeDraftThread===null?null:Qe(e.activeDraftThread.environmentId,e.activeDraftThread.projectId)}function fJ(e,t){let n=zt.getState(),r=Tq(n.getComposerDraft(e)?.prompt??``,n.getComposerDraft(e)?.lastGeneratedPullRequestPrompt,t);n.setPrompt(e,r),n.setGeneratedPullRequestPrompt(e,t),n.setPendingAutoSubmit(e,!1)}var pJ=new Set([`checkout-local`,`checkout-worktree`]);function mJ(e){if(e===null)throw Error(`This pull request action has no composer message.`);return e}function hJ(e){let t=pJ.has(e);Eo.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 gJ(e){Eo.add({type:`error`,title:`Pull request handoff failed`,description:e instanceof Error?e.message:`Try the handoff again.`})}function _J(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 vJ(e){return`${e.environmentId}:${e.id}`}function yJ(e,t){let n=t.get(e.environmentId)?.trim();return n?`${e.name} · ${n}`:e.name}function bJ(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=vJ(e),o=i.find(e=>vJ(e)===a),s=i.filter(e=>vJ(e)!==a).toSorted(xJ);return o===void 0?s:[o,...s]}function xJ(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 SJ(e){return`${e.environmentId}:${e.repository.trim().toLowerCase()}#${e.number}`}function CJ(e){let t=e.selection;return t===null||t.pullRequestKey!==e.pullRequestKey?e.sourceProject:e.targets.find(e=>vJ(e)===t.targetKey)??e.sourceProject}function wJ(e){let t=SJ({environmentId:e.environmentId,repository:e.detail.repository,number:e.detail.number});return{pullRequestKey:t,targetProject:e.canPickTarget?CJ({pullRequestKey:t,sourceProject:e.sourceProject,targets:e.targets,selection:e.selection}):e.sourceProject}}var TJ=(0,I.createContext)(null);function EJ(e){let t=(0,R.c)(24),n=Pl(),r=ft(),i=tr(OJ),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=kJ({primary:r,savedRuntimeById:i}),u;t[10]!==r||t[11]!==i?(u=_J({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(DJ)]),t[15]=i,t[16]=d,t[17]=f):f=t[17],o=f,s=AJ({projects:n,canonicalRepositoryKey:jJ(e.detail),preferredEnvironmentId:e.environmentId,pullRequestProjectId:e.reference.projectId,readyEnvironmentIds:l}),c=s===void 0?[]:bJ(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)(MJ,{...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 DJ(e){let[t,n]=e;return n.connectionState===`connected`&&n.authState===`authenticated`&&n.descriptor?.capabilities.threadPullRequestLinking===!0?[t]:[]}function OJ(e){return e.byId}function kJ(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 AJ(e){if(e.canonicalRepositoryKey===null)return;let t=e.projects.filter(t=>t.repositoryIdentity?.canonicalKey.toLowerCase()===e.canonicalRepositoryKey&&e.readyEnvironmentIds.has(t.environmentId)).toSorted(xJ),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 jJ(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 MJ(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}=wJ({canPickTarget:i,environmentId:e.environmentId,detail:e.detail,sourceProject:e.sourceProject,targets:e.targets,selection:n}),p=Qq,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:vJ(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)(TJ.Provider,{value:b,children:e.children}),t[42]=b,t[43]=e.children,t[44]=x):x=t[44],x}function NJ(){return(0,I.useContext)(TJ)}function PJ(e){let t=(0,R.c)(11),n=NJ(),r=bt(),i=Mt(),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=tr(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)(wq,{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)(RH,{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 FJ(e,t){let n=Xe(),r=(0,I.useRef)(null),i=(0,I.useRef)(!1),a=Ni(fU({environmentId:e,reference:t,queryClient:n,command:()=>IJ(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,LJ)}}}async function IJ(e){if(e===null)throw Error(`No pull request command was selected.`);await e()}function LJ(){}var RJ=[[`thumbs-up`,`👍`],[`thumbs-down`,`👎`],[`laugh`,`😄`],[`hooray`,`🎉`],[`confused`,`😕`],[`heart`,`❤️`],[`eyes`,`👀`],[`rocket`,`🚀`]];function zJ(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?RJ:RJ.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)(BJ,{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 BJ(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=VJ(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)(go,{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 VJ(e){let t=e!==void 0&&e.viewerHasReacted;return{viewerHasReacted:t,actionLabel:t?`Remove`:`Add`,countLabel:e===void 0?``:` ${e.count}`}}function HJ(e,t,n){let r=new Set([...e,...t].map(e=>e.id));return[...t,...n.filter(e=>!r.has(e.id))]}var UJ=65536;function WJ(e){return JSON.stringify(e)}function GJ(e,t){return!t&&e.trim().length>0&&e.length<=65536}function KJ(e){return e.length>65536?`Replies are limited to ${UJ.toLocaleString()} characters.`:null}function qJ(e,t,n){let r=(0,R.c)(19),i,a;r[0]===n?(i=r[1],a=r[2]):(i=WJ(n),a=JJ(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),YJ(t,n.id,l.cursor).then(e=>XJ(c,i,n.comments,e)).catch(e=>p(ZJ(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 JJ(e,t){return{snapshotKey:e,loaded:[],cursor:t.nextCommentsCursor??null}}async function YJ(e,t,n){return bn.getPullRequestThreadComments({...YH(e),threadId:t,cursor:n})}function XJ(e,t,n,r){e(e=>e.snapshotKey===t?{...e,loaded:HJ(n,e.loaded,r.comments),cursor:r.nextCursor}:e)}function ZJ(e){return e instanceof Error?e:Error(`Older replies could not be loaded.`)}function QJ(e){let t=(0,R.c)(29),[n,r]=(0,I.useState)(``),i=qJ(e.environmentId,e.reference,e.thread),a=FJ(e.environmentId,e.reference),o=NJ(),s;t[0]===e.thread?s=t[1]:(s=(0,L.jsx)(eY,{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)(tY,{...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)(rY,{pagination:i}),t[6]=i,t[7]=l);let u;t[8]!==a||t[9]!==e?(u=(0,L.jsx)(iY,{...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)($J,{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)(aY,{...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)(sY,{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 $J(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)(go,{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 eY(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 tY(e){return e.comments.map(t=>(0,L.jsx)(nY,{...e,comment:t},t.id))}function nY(e){let t=(0,R.c)(22),n=e.comment.author?.login??`Unknown author`,r;t[0]===e.comment.createdAt?r=t[1]:(r=cr(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)(PJ,{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 bn.setPullRequestReaction({...YH(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)(zJ,{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 rY(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)(go,{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 iY(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)(go,{type:`button`,size:`sm`,variant:`outline`,className:`mt-3`,disabled:e.command.isPending,onClick:()=>e.command.mutate(async()=>{await bn.setPullRequestThreadResolution({...YH(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 aY(e){let t=(0,R.c)(17);if(!e.canReply)return null;let n;t[0]===e.reply?n=t[1]:(n=KJ(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)(hq,{value:e.reply,ariaLabel:`Reply to review thread`,placeholder:`Reply to thread`,density:`compact`,maxLength:UJ,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=!GJ(e.reply,e.command.isPending),o;t[6]===e?o=t[7]:(o=()=>oY(e),t[6]=e,t[7]=o);let s;t[8]!==a||t[9]!==o?(s=(0,L.jsx)(go,{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 oY(e){let t=e.reply.trim();e.command.mutate(async()=>{await bn.replyToPullRequestThread({...YH(e.reference),idempotencyKey:crypto.randomUUID(),threadId:e.thread.id,body:t})},()=>e.onReplyChange(``))}function sY(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 cY(e){return e??`Unknown author`}function lY(e){return e===`review`?`reviewed`:`commented`}function uY(e){return e.author?.login??`Unknown author`}function dY(e,t){return t?e.capabilities.reactions===!0:!1}function fY(e,t){return t?e.capabilities.edit?.comment===!0:!1}function pY(e,t){return t&&e.capabilities.review.reply?e.viewerPermissions.comment:!1}function mY(e,t){return t&&e.capabilities.review.resolve?e.viewerPermissions.resolve:!1}function hY({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:dn,children:l}),a!=null&&o?.map((e,t)=>(0,L.jsx)(`div`,{slot:Qn(e),children:a(e)},t)),s!=null&&(0,L.jsx)(`div`,{slot:`gutter-utility-slot`,style:Zn,children:s(c)})]})}function gY(e){return new Worker(`/assets/worker-Cvq2iJN1.js`,{name:e?.name})}function _Y(e){let t=(0,R.c)(4),{themeName:n}=e,r=Bn(),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(vY)},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 vY(e){Yn(e,{route:`diff-worker-theme-sync`})}function yY(e){let t=(0,R.c)(10),{children:n}=e,{resolvedTheme:r}=In(),i;t[0]===r?i=t[1]:(i=sn(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:bY,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)(_Y,{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)(ln,{poolOptions:l,highlighterOptions:u,children:[d,n]}),t[6]=n,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function bY(){return new gY}export{Kb as $,Eo as $n,ou as $t,RH as A,pc as An,Ni as Ar,vu as At,WC as B,Is as Bn,ep as Bt,cU as C,yl as Cn,Gi as Cr,Cu as Ct,oU as D,il as Dn,zi as Dr,sp as Dt,lU as E,hl as En,Bi as Er,Ng as Et,qw as F,Ws as Fn,Ti as Fr,x_ as Ft,kS as G,_s as Gn,pp as Gt,IC as H,Ds as Hn,H as Ht,Iw as I,Hs as In,wi as Ir,Qf as It,CS as J,Yo as Jn,du as Jt,OS as K,rs as Kn,um as Kt,Lw as L,Us as Ln,Ci as Lr,Uf as Lt,UV as M,Bs as Mn,Oi as Mr,pu as Mt,HV as N,zs as Nn,Di as Nr,b_ as Nt,dU as O,sc as On,Ri as Or,Bf as Ot,$w as P,Vs as Pn,Ei as Pr,dy as Pt,nx as Q,Do as Qn,au as Qt,Nw as R,Rs as Rn,Eg as Rt,YH as S,Dl as Sn,qi as Sr,np as St,uU as T,_l as Tn,Vi as Tr,Xf as Tt,VC as U,Es as Un,gp as Ut,RC as V,ks as Vn,ip as Vt,FS as W,Ss as Wn,L_ as Wt,lx as X,Lo as Xn,su as Xt,dS as Y,Wo as Yn,ru as Yt,ax as Z,Po as Zn,iu as Zt,yJ as _,Cl as _n,ea as _r,Tm as _t,fY as a,Rl as an,mo as ar,kb as at,hq as b,El as bn,Xi as br,Dg as bt,pY as c,Fl as cn,so as cr,zf as ct,zJ as d,jl as dn,Wa as dr,mg as dt,cu as en,_o as er,Hb as et,FJ as f,Al as fn,wa as fr,W as ft,vJ as g,bl as gn,ta as gr,nv as gt,NJ as h,xl as hn,ia as hr,Hf as ht,cY as i,Hl as in,lo as ir,dm as it,VV as j,Gs as jn,ki as jr,tp as jt,sU as k,uc as kn,Pi as kr,vp as kt,mY as l,Il as ln,$a as lr,Vf as lt,EJ as m,Sl as mn,oa as mr,Rf as mt,hY as n,$l as nn,po as nr,Nb as nt,lY as o,Vl as on,co as or,hh as ot,PJ as p,vl as pn,ca as pr,_p as pt,TS as q,is as qn,dp as qt,uY as r,Ql as rn,fo as rr,Lf as rt,dY as s,zl as sn,uo as sr,Pm as st,yY as t,nu as tn,go as tr,Lb as tt,QJ as u,Pl as un,Qa as ur,U as ut,Dq as v,wl as vn,Qi as vr,V as vt,fU as w,ml as wn,Ui as wr,op as wt,KH as x,Ol as xn,Ji as xr,bu as xt,wq as y,Tl as yn,Zi as yr,Wf as yt,Dw as z,qs as zn,_u as zt};
|
|
73
|
-
//# sourceMappingURL=DiffWorkerPoolProvider-
|
|
73
|
+
//# sourceMappingURL=DiffWorkerPoolProvider-lEFZi8QR.js.map
|