@lacneu/atrium 0.81.0 → 0.81.1
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/assets/{AccessTab-BgWLWjSu.js → AccessTab-OP6MT853.js} +1 -1
- package/dist/assets/{AdvancedFilter-CDngwUem.js → AdvancedFilter-CYKmk_LK.js} +1 -1
- package/dist/assets/{AgentFilesTab-CL0cJrKE.js → AgentFilesTab-Bzj4n4RS.js} +1 -1
- package/dist/assets/{AnomaliesTab-CKSRbds6.js → AnomaliesTab-DIOsMkIt.js} +1 -1
- package/dist/assets/{AuditTab-BnDFtbaS.js → AuditTab-B-v9HjgO.js} +1 -1
- package/dist/assets/{BridgeTab-QW9px1z5.js → BridgeTab-D7jnblPV.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-XNB8jInh.js → ChatDefaultsTab-DE7qape9.js} +1 -1
- package/dist/assets/{DataTableShell-BWoSBli_.js → DataTableShell-CR2Pxo32.js} +1 -1
- package/dist/assets/{DetailChips-CUfCyLvN.js → DetailChips-BttzOfap.js} +1 -1
- package/dist/assets/{FeedbacksTab-Ba-zMA-p.js → FeedbacksTab-BPxuXa49.js} +1 -1
- package/dist/assets/{FieldLabel-8vj4ipPC.js → FieldLabel-DvlvfpGK.js} +1 -1
- package/dist/assets/{FilesTab-Dht0_RDj.js → FilesTab-Da5f-Q53.js} +1 -1
- package/dist/assets/{FilterBar-BJ1mhU3e.js → FilterBar-D8d3TG3L.js} +1 -1
- package/dist/assets/{GroupsTab-Bz7Mvvwj.js → GroupsTab-02Klvfu1.js} +1 -1
- package/dist/assets/InstancesTab-CvcFYqzZ.js +1 -0
- package/dist/assets/{IntegrationsTab-D3y4_fhI.js → IntegrationsTab-C3v_UYdO.js} +1 -1
- package/dist/assets/{KpiTab-D9ujtelb.js → KpiTab-NBnWW7mn.js} +1 -1
- package/dist/assets/{PreferencesTab-CHqxxQ3R.js → PreferencesTab-Dtc4NXr7.js} +1 -1
- package/dist/assets/{ProjectPage-Dom5dB_v.js → ProjectPage-3M9H_seP.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-D-7L-yZy.js → PromptInjectionsTab-ydfl3LIa.js} +1 -1
- package/dist/assets/{RolesTab-2nGoIoBg.js → RolesTab-rtjEoRka.js} +1 -1
- package/dist/assets/{ScheduledTab-_v_HWkIY.js → ScheduledTab-1Z--saSr.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-foQObSmk.js → ServiceAccountsTab-BDQcZy4S.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-DIzBgBj5.js → SubAgentReportsTab-BlttiEor.js} +1 -1
- package/dist/assets/{ThemeShowroom-Gqbq2MWW.js → ThemeShowroom-D1Av-z7w.js} +1 -1
- package/dist/assets/{TimeRangePicker-qNMV_Gj-.js → TimeRangePicker-CdzW5P7l.js} +1 -1
- package/dist/assets/{TimezoneCombobox-D2e6UjGY.js → TimezoneCombobox-Byz56evB.js} +1 -1
- package/dist/assets/{TracesTab-D_Z__oYy.js → TracesTab-DuT8lvo4.js} +1 -1
- package/dist/assets/{UsersTab-1HZ5mAYl.js → UsersTab-6m5HSxal.js} +1 -1
- package/dist/assets/{VoiceTab-DGQk5yGt.js → VoiceTab-DFVKbQpO.js} +1 -1
- package/dist/assets/{api-CCk5U5gB.js → api-Borb_oKz.js} +1 -1
- package/dist/assets/{button-CbUSFbZL.js → button-Bcf40mKN.js} +1 -1
- package/dist/assets/{card-PW6qFB8Z.js → card-BVQ_SWDd.js} +1 -1
- package/dist/assets/chevrons-up-down-DQp99IbP.js +1 -0
- package/dist/assets/{compatView-DgV9jG5C.js → compatView-CowuHUom.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-CW9VFOfh.js → dispatchErrorInfo-DwvABR74.js} +1 -1
- package/dist/assets/{dist-CeBeEhXM.js → dist-BCOYDeQS.js} +1 -1
- package/dist/assets/{dist-BF1pXGOi.js → dist-Bq0h0jBi.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-B0i3QCx_.js → highlighted-body-OFNGDK62-DSC5jaxG.js} +1 -1
- package/dist/assets/index-DEMhzN6j.css +1 -0
- package/dist/assets/{index-DY7zoioz.js → index-lMzb_P_p.js} +7 -7
- package/dist/assets/{list-wMpxVo2w.js → list-DfIPa6Dk.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BoodyZnM.js +1 -0
- package/dist/assets/{pdf-BFBPmq_U.js → pdf-CO5wvqSF.js} +1 -1
- package/dist/assets/roleDescriptions-xzqDDCcp.js +1 -0
- package/dist/assets/{table-BhYNJKZu.js → table-B5YoMU9b.js} +1 -1
- package/dist/assets/{tabs-BwhZusQZ.js → tabs-D7icC_cj.js} +1 -1
- package/dist/assets/x-XSJ8VGVc.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/InstancesTab-BTESpzxw.js +0 -1
- package/dist/assets/chevrons-up-down-DAdQ-ohu.js +0 -1
- package/dist/assets/index-vuXE_6pY.css +0 -1
- package/dist/assets/mermaid-GHXKKRXX-CWDFvVZH.js +0 -1
- package/dist/assets/roleDescriptions-Du6v2lbA.js +0 -1
- package/dist/assets/x-BvfQ_1AZ.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-
|
|
2
|
-
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./bundle-mjs-C73ZY4La.js";import{$ as l,$A as u,$I as d,$L as f,$_ as p,$d as m,$g as h,$h as g,$j as _,$l as v,$m as y,$o as b,$s as x,$t as S,$v as C,$x as w,$z as T,A as E,AA as D,AI as O,AM as k,A_ as A,Aa as ee,Af as j,Ag as M,Aj as te,Al as N,Am as P,Ar as ne,As as re,At as ie,Au as ae,B as oe,BA as se,BL as ce,BM as le,B_ as ue,Ba as de,Bf as fe,Bg as pe,Bi as me,Bj as he,Bl as ge,Bm as _e,Br as ve,Bu as ye,C as be,CA as xe,CC as Se,CM as Ce,C_ as we,Ca as Te,Cf as Ee,Cg as De,Cj as Oe,Ck as ke,Cm as Ae,Cn as je,Cr as Me,Cs as Ne,Ct as Pe,Cu as Fe,Cy as Ie,D as F,DA as Le,DC as Re,DI as ze,DM as Be,D_ as Ve,Da as He,Df as Ue,Dg as We,Dj as Ge,Dk as Ke,Dm as qe,Dr as Je,Ds as Ye,Dt as Xe,Du as Ze,E as Qe,EA as $e,EC as et,EI as tt,EM as nt,E_ as rt,Ea as it,Ef as at,Eg as ot,Ej as st,Ek as ct,Em as lt,Er as ut,Es as dt,Et as ft,Eu as pt,FA as mt,FM as ht,F_ as gt,Fa as _t,Ff as vt,Fi as yt,Fj as bt,Fl as xt,Fm as St,Fn as Ct,Fr as wt,Ft as Tt,Fu as Et,Fv as Dt,G as Ot,GA as kt,GL as At,GM as jt,G_ as Mt,Ga as Nt,Gf as Pt,Gg as Ft,Gi as It,Gj as Lt,Gl as Rt,Gm as zt,Gs as Bt,Gt as Vt,Gv as Ht,Gz as Ut,H as Wt,HA as Gt,HL as Kt,HM as qt,H_ as Jt,Ha as Yt,Hf as Xt,Hg as Zt,Hi as Qt,Hj as $t,Hl as en,Hm as tn,Hr as nn,Ht as rn,Hu as an,Hv as on,IA as sn,IM as cn,IR as ln,I_ as un,Ia as dn,If as fn,Ii as pn,Ij as mn,Il as hn,Im as gn,In as _n,Ir as vn,It as yn,Iu as bn,J as xn,JA as Sn,JL as Cn,JM as wn,J_ as Tn,Jg as En,Jj as Dn,Jl as On,Jm as kn,Js as An,Jt as jn,Jv as Mn,Jx as Nn,Jz as Pn,K as Fn,KA as In,KL as Ln,KM as Rn,K_ as zn,Ka as Bn,Kf as Vn,Kg as Hn,Ki as Un,Kj as Wn,Kl as Gn,Km as Kn,Ks as qn,Kt as Jn,Kv as Yn,Kx as Xn,Kz as Zn,LA as Qn,LL as $n,LM as er,L_ as tr,La as nr,Lf as rr,Li as ir,Lj as ar,Ll as or,Lm as sr,Ln as cr,Lr as lr,Lt as ur,Lu as dr,MA as fr,MI as pr,MM as mr,M_ as hr,Ma as gr,Mf as _r,Mj as vr,Ml as yr,Mm as br,Mr as xr,Ms as Sr,Mt as Cr,Mu as wr,Mv as Tr,NA as Er,NI as Dr,NM as Or,N_ as kr,Na as Ar,Nf as jr,Nj as Mr,Nl as Nr,Nm as Pr,Nr as Fr,Nt as Ir,Nu as Lr,O as Rr,OA as zr,OC as Br,OM as Vr,O_ as Hr,Oa as Ur,Of as Wr,Og as Gr,Oj as Kr,Ok as qr,Ol as Jr,Om as Yr,Or as Xr,Os as Zr,Ot as Qr,Ou as $r,PA as ei,PM as ti,P_ as ni,Pa as ri,Pf as ii,Pi as ai,Pj as oi,Pl as si,Pm as ci,Pr as li,Pt as ui,Pu as di,QA as fi,QI as pi,QL as mi,Q_ as hi,Qd as gi,Qg as _i,Qh as vi,Qj as yi,Ql as bi,Qm as xi,Qs as Si,Qt as Ci,Qv as wi,Qx as Ti,Qz as Ei,R as Di,RA as Oi,RL as ki,RM as Ai,R_ as ji,Ra as Mi,Rf as Ni,Rg as Pi,Ri as Fi,Rj as Ii,Rl as Li,Rm as Ri,Rr as zi,Ru as Bi,S as Vi,SA as Hi,SC as Ui,SM as Wi,SR as Gi,S_ as Ki,Sa as qi,Sf as Ji,Sg as Yi,Sj as Xi,Sk as Zi,Sm as Qi,Sn as $i,Sr as ea,Ss as ta,St as na,Su as ra,Sy as ia,T as aa,TA as oa,TC as sa,TI as ca,TM as la,T_ as ua,Ta as da,Tf as fa,Tg as pa,Tj as ma,Tk as ha,Tm as ga,Tn as _a,Tr as va,Ts as ya,Tt as ba,Tu as xa,U as Sa,UA as Ca,UL as wa,UM as Ta,U_ as Ea,Ua as Da,Uf as Oa,Ug as ka,Ui as Aa,Uj as ja,Ul as Ma,Um as Na,Uo as Pa,Ur as Fa,Us as Ia,Ut as La,Uu as Ra,Uv as za,V as Ba,VA as Va,VL as Ha,VM as Ua,V_ as Wa,Va as Ga,Vf as Ka,Vg as qa,Vi as Ja,Vj as Ya,Vl as Xa,Vm as Za,Vr as Qa,Vu as $a,Vv as eo,W as to,WA as no,WL as ro,WM as io,W_ as ao,Wa as oo,Wf as so,Wg as co,Wi as lo,Wj as uo,Wl as fo,Wm as po,Wo as mo,Wr as ho,Ws as go,Wt as _o,Wu as vo,Wv as yo,Wz as bo,X as xo,XA as So,XL as Co,X_ as wo,Xg as To,Xj as Eo,Xl as Do,Xm as Oo,Xo as ko,Xs as Ao,Xt as jo,Xv as Mo,Xx as No,Xz as Po,Y as Fo,YA as Io,YL as Lo,Y_ as Ro,Yg as zo,Yj as Bo,Yl as Vo,Ym as Ho,Yo as Uo,Ys as Wo,Yt as Go,Yv as Ko,Yx as qo,Yz as Jo,Z as Yo,ZA as Xo,ZL as Zo,Z_ as Qo,Zb as $o,Zd as es,Zg as ts,Zj as ns,Zl as rs,Zm as is,Zs as as,Zt as os,Zv as ss,Zx as cs,Zz as ls,_ as us,_B as ds,_C as fs,_M as ps,_R as ms,_S as hs,__ as gs,_a as _s,_f as vs,_g as ys,_i as bs,_j as xs,_k as Ss,_l as Cs,_n as ws,_o as Ts,_r as Es,_s as Ds,_t as Os,_u as ks,_v as As,_y as js,a as Ms,aB as Ns,aC as Ps,aL as Fs,aM as Is,aR as Ls,aS as Rs,a_ as zs,aa as Bs,af as Vs,ag as Hs,ah as Us,aj as Ws,al as Gs,an as Ks,ar as qs,as as Js,at as Ys,au as Xs,av as Zs,ay as Qs,b as $s,bA as ec,bC as tc,bM as nc,b_ as rc,ba as ic,bd as ac,bf as oc,bg as sc,bj as cc,bk as lc,bm as uc,bn as dc,br as fc,bs as pc,bt as mc,bu as hc,by as gc,c as _c,cB as vc,cC as yc,cM as bc,cR as xc,cS as Sc,c_ as Cc,ca as wc,cf as Tc,cg as Ec,cj as Dc,cl as Oc,cn as kc,cr as Ac,cs as jc,ct as Mc,cu as Nc,cv as Pc,cy as Fc,d as Ic,dB as Lc,dC as Rc,dM as zc,dR as Bc,dS as Vc,d_ as Hc,da as Uc,df as Wc,dg as Gc,dj as Kc,dl as qc,dn as Jc,dr as Yc,ds as Xc,dt as Zc,du as Qc,dv as $c,dy as el,eB as tl,eE as nl,eL as rl,eM as il,eR as al,eS as ol,e_ as sl,ec as cl,ef as ll,eg as ul,eh as dl,ej as fl,en as pl,er as ml,es as hl,et as gl,eu as _l,ev as vl,ey as yl,f as bl,fB as xl,fC as Sl,fM as Cl,fR as wl,fS as Tl,f_ as El,fa as Dl,ff as Ol,fg as kl,fj as Al,fk as jl,fl as Ml,fn as Nl,fo as Pl,fr as Fl,fs as Il,ft as Ll,fu as Rl,fv as zl,fy as Bl,g as Vl,gB as Hl,gC as Ul,gM as Wl,gR as Gl,gS as Kl,g_ as ql,ga as Jl,gf as Yl,gg as Xl,gi as Zl,gj as Ql,gk as $l,gl as eu,gn as tu,go as nu,gr as ru,gs as iu,gt as au,gu as ou,gv as su,gy as cu,hB as lu,hC as uu,hM as du,hR as fu,hS as pu,h_ as mu,ha as hu,hf as gu,hg as _u,hj as vu,hk as yu,hl as bu,hn as xu,ho as Su,hr as Cu,hs as wu,ht as Tu,hu as Eu,hv as Du,hy as Ou,i as ku,iB as Au,iC as ju,iL as Mu,iM as Nu,iR as Pu,iS as Fu,i_ as Iu,ia as Lu,if as Ru,ig as zu,ih as Bu,ij as Vu,il as Hu,in as Uu,ir as Wu,is as Gu,it as Ku,iu as qu,iv as Ju,iy as Yu,jA as Xu,jI as Zu,jM as Qu,j_ as $u,ja as ed,jf as td,jj as nd,jl as rd,jm as id,jr as ad,js as od,jt as sd,ju as cd,jv as ld,k as ud,kA as dd,kC as fd,kI as pd,kM as md,k_ as hd,ka as gd,kf as _d,kg as vd,kj as yd,kk as bd,kl as xd,km as Sd,kr as Cd,ks as wd,kt as Td,ku as Ed,l as Dd,lB as Od,lC as kd,lM as Ad,lR as jd,lS as Md,l_ as Nd,la as Pd,lf as Fd,lg as Id,lj as Ld,ll as Rd,ln as zd,lr as Bd,ls as Vd,lt as Hd,lu as Ud,ly as Wd,m as Gd,mB as Kd,mC as qd,mM as Jd,mR as Yd,mS as Xd,m_ as Zd,ma as Qd,mf as $d,mg as ef,mj as tf,mk as nf,ml as rf,mn as af,mo as of,mr as sf,ms as cf,mt as lf,mu as uf,mv as df,my as ff,n as pf,nB as mf,nL as hf,nM as gf,nR as _f,nS as vf,n_ as yf,nc as bf,nf as xf,ng as Sf,nh as Cf,nj as wf,nl as Tf,nn as Ef,nr as Df,ns as Of,nu as kf,nv as Af,ny as jf,o as Mf,oB as I,oC as Nf,oL as Pf,oM as Ff,oR as If,oS as Lf,o_ as Rf,oa as zf,of as Bf,og as Vf,oh as Hf,oj as Uf,ol as Wf,on as Gf,os as Kf,ot as qf,ou as Jf,ov as Yf,oy as Xf,p as Zf,pC as Qf,pM as $f,pR as ep,pS as tp,p_ as np,pa as rp,pf as ip,pg as ap,pj as op,pk as sp,pl as cp,pn as lp,po as up,pr as dp,ps as fp,pt as pp,pu as mp,pv as hp,py as gp,q as _p,qA as vp,qL as yp,qM as bp,q_ as xp,qf as Sp,qg as Cp,qi as wp,qj as Tp,ql as Ep,qm as Dp,qo as Op,qs as kp,qt as Ap,qv as jp,qx as Mp,qz as Np,r as Pp,rB as Fp,rC as Ip,rL as Lp,rM as Rp,rR as zp,rS as Bp,r_ as Vp,ra as Hp,rf as Up,rg as Wp,rh as Gp,rj as Kp,rl as qp,rn as Jp,rr as Yp,rs as Xp,rt as Zp,ru as Qp,rv as $p,ry as em,s as tm,sB as nm,sC as eee,sM as rm,sR as im,sS as tee,s_ as nee,sa as ree,sf as iee,sg as aee,sh as oee,sj as see,sl as cee,sn as lee,sr as uee,ss as am,st as dee,su as fee,sv as om,sy as sm,t as L,tB as cm,tL as lm,tM as um,tR as dm,tS as pee,t_ as mee,tc as fm,tf as hee,tg as pm,th as mm,tj as gee,tl as _ee,tn as vee,tr as hm,ts as yee,tu as bee,tv as gm,ty as _m,u as vm,uB as ym,uC as xee,uM as bm,uR as See,uS as Cee,u_ as xm,ua as Sm,uf as wee,ug as Tee,uj as Eee,ul as Dee,un as Oee,ur as kee,us as Aee,ut as jee,uu as Mee,uv as Nee,uy as Pee,v as Cm,vC as Fee,vM as Iee,vR as Lee,vS as wm,v_ as Ree,va as zee,vf as Bee,vg as Vee,vi as Hee,vj as Tm,vk as Em,vl as Dm,vn as Om,vr as km,vs as Am,vt as jm,vu as Mm,vv as Nm,vy as Pm,w as Fm,wA as Im,wC as Lm,wM as Rm,w_ as zm,wa as Bm,wf as Vm,wg as Hm,wi as Um,wj as Wm,wk as Gm,wm as Km,wn as qm,wr as Jm,ws as Ym,wt as Xm,wu as Zm,x as Qm,xA as $m,xC as eh,xM as th,xR as nh,x_ as rh,xa as ih,xb as ah,xf as oh,xg as sh,xj as ch,xk as lh,xm as uh,xn as dh,xr as fh,xs as ph,xt as mh,xu as hh,xy as gh,y as R,yC as _h,yM as Uee,yR as Wee,y_ as Gee,ya as Kee,yf as qee,yg as Jee,yj as Yee,yk as Xee,ym as Zee,yn as Qee,yr as vh,ys as $ee,yt as ete,yu as yh,yy as tte,yz as nte,z as rte,zA as ite,zL as ate,zM as ote,z_ as bh,za as ste,zf as xh,zg as cte,zi as lte,zj as ute,zl as dte,zm as fte,zr as pte,zu as mte}from"./api-CCk5U5gB.js";import{t as Sh}from"./x-BvfQ_1AZ.js";import{a as Ch,c as hte,i as wh,l as gte,n as Th,o as Eh,r as Dh,s as Oh,t as kh,u as Ah}from"./dist-BF1pXGOi.js";import{a as jh,i as Mh,n as Nh,r as Ph,t as Fh}from"./dist-CeBeEhXM.js";import{n as Ih,t as Lh}from"./button-CbUSFbZL.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var _te=a((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),vte=a(((e,t)=>{t.exports=_te()})),yte=a((t=>{var r=vte(),i=e(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var te=Array.isArray,N=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function ae(e){return{current:e}}function oe(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function se(e,t){ie++,re[ie]=e.current,e.current=t}var ce=ae(null),le=ae(null),ue=ae(null),de=ae(null);function fe(e,t){switch(se(ue,t),se(le,e),se(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?af(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=af(t),e=of(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}oe(ce),se(ce,e)}function pe(){oe(ce),oe(le),oe(ue)}function me(e){e.memoizedState!==null&&se(de,e);var t=ce.current,n=of(t,e.type);t!==n&&(se(le,e),se(ce,n))}function he(e){le.current===e&&(oe(ce),oe(le)),de.current===e&&(oe(de),mp._currentValue=ne)}var ge,_e;function ve(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-DSC5jaxG.js","assets/bundle-mjs-C73ZY4La.js","assets/RolesTab-rtjEoRka.js","assets/api-Borb_oKz.js","assets/roleDescriptions-xzqDDCcp.js","assets/button-Bcf40mKN.js","assets/InstancesTab-CvcFYqzZ.js","assets/FieldLabel-DvlvfpGK.js","assets/curation-CQksaIbm.js","assets/locales-CPjguROj.js","assets/BridgeTab-D7jnblPV.js","assets/compatView-CowuHUom.js","assets/tabs-D7icC_cj.js","assets/chevrons-up-down-DQp99IbP.js","assets/FilterBar-D8d3TG3L.js","assets/TimeRangePicker-CdzW5P7l.js","assets/table-B5YoMU9b.js","assets/dispatchErrorInfo-DwvABR74.js","assets/DataTableShell-CR2Pxo32.js","assets/PromptInjectionsTab-ydfl3LIa.js","assets/localePickerView-C2RmOS86.js","assets/confTabs-CCBW5ofF.css","assets/GroupsTab-02Klvfu1.js","assets/x-XSJ8VGVc.js","assets/DetailChips-BttzOfap.js","assets/IntegrationsTab-C3v_UYdO.js","assets/FeedbacksTab-BPxuXa49.js","assets/SubAgentReportsTab-BlttiEor.js","assets/FilesTab-Da5f-Q53.js","assets/ScheduledTab-1Z--saSr.js","assets/list-DfIPa6Dk.js","assets/TimezoneCombobox-Byz56evB.js","assets/AgentFilesTab-Bzj4n4RS.js","assets/PreferencesTab-Dtc4NXr7.js","assets/ChatDefaultsTab-DE7qape9.js","assets/AccessTab-OP6MT853.js","assets/ThemeShowroom-D1Av-z7w.js","assets/AdvancedFilter-CYKmk_LK.js","assets/card-BVQ_SWDd.js","assets/ProjectPage-3M9H_seP.js","assets/ProjectPage-BXsrYrrF.css","assets/TracesTab-DuT8lvo4.js","assets/VoiceTab-DFVKbQpO.js","assets/AuditTab-B-v9HjgO.js","assets/AnomaliesTab-DIOsMkIt.js","assets/KpiTab-NBnWW7mn.js","assets/ServiceAccountsTab-BDQcZy4S.js","assets/UsersTab-6m5HSxal.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./bundle-mjs-C73ZY4La.js";import{$ as l,$A as u,$I as d,$L as f,$_ as p,$d as m,$g as h,$h as g,$j as _,$l as v,$m as y,$o as b,$s as x,$t as S,$v as C,$x as w,$z as T,A as E,AA as D,AI as O,AM as k,A_ as A,Aa as ee,Af as j,Ag as M,Aj as te,Al as N,Am as P,Ar as ne,As as re,At as ie,Au as ae,B as oe,BA as se,BL as ce,BM as le,B_ as ue,Ba as de,Bf as fe,Bg as pe,Bi as me,Bj as he,Bl as ge,Bm as _e,Br as ve,Bu as ye,C as be,CA as xe,CC as Se,CM as Ce,C_ as we,Ca as Te,Cf as Ee,Cg as De,Cj as Oe,Ck as ke,Cm as Ae,Cn as je,Cr as Me,Cs as Ne,Ct as Pe,Cu as Fe,Cy as Ie,D as F,DA as Le,DC as Re,DI as ze,DM as Be,D_ as Ve,Da as He,Df as Ue,Dg as We,Dj as Ge,Dk as Ke,Dm as qe,Dr as Je,Ds as Ye,Dt as Xe,Du as Ze,E as Qe,EA as $e,EC as et,EI as tt,EM as nt,E_ as rt,Ea as it,Ef as at,Eg as ot,Ej as st,Ek as ct,Em as lt,Er as ut,Es as dt,Et as ft,Eu as pt,FA as mt,FM as ht,F_ as gt,Fa as _t,Ff as vt,Fi as yt,Fj as bt,Fl as xt,Fm as St,Fn as Ct,Fr as wt,Ft as Tt,Fu as Et,Fv as Dt,G as Ot,GA as kt,GL as At,GM as jt,G_ as Mt,Ga as Nt,Gf as Pt,Gg as Ft,Gi as It,Gj as Lt,Gl as Rt,Gm as zt,Gs as Bt,Gt as Vt,Gv as Ht,Gz as Ut,H as Wt,HA as Gt,HL as Kt,HM as qt,H_ as Jt,Ha as Yt,Hf as Xt,Hg as Zt,Hi as Qt,Hj as $t,Hl as en,Hm as tn,Hr as nn,Ht as rn,Hu as an,Hv as on,IA as sn,IM as cn,IR as ln,I_ as un,Ia as dn,If as fn,Ii as pn,Ij as mn,Il as hn,Im as gn,In as _n,Ir as vn,It as yn,Iu as bn,J as xn,JA as Sn,JL as Cn,JM as wn,J_ as Tn,Jg as En,Jj as Dn,Jl as On,Jm as kn,Js as An,Jt as jn,Jv as Mn,Jx as Nn,Jz as Pn,K as Fn,KA as In,KL as Ln,KM as Rn,K_ as zn,Ka as Bn,Kf as Vn,Kg as Hn,Ki as Un,Kj as Wn,Kl as Gn,Km as Kn,Ks as qn,Kt as Jn,Kv as Yn,Kx as Xn,Kz as Zn,LA as Qn,LL as $n,LM as er,L_ as tr,La as nr,Lf as rr,Li as ir,Lj as ar,Ll as or,Lm as sr,Ln as cr,Lr as lr,Lt as ur,Lu as dr,MA as fr,MI as pr,MM as mr,M_ as hr,Ma as gr,Mf as _r,Mj as vr,Ml as yr,Mm as br,Mr as xr,Ms as Sr,Mt as Cr,Mu as wr,Mv as Tr,NA as Er,NI as Dr,NM as Or,N_ as kr,Na as Ar,Nf as jr,Nj as Mr,Nl as Nr,Nm as Pr,Nr as Fr,Nt as Ir,Nu as Lr,O as Rr,OA as zr,OC as Br,OM as Vr,O_ as Hr,Oa as Ur,Of as Wr,Og as Gr,Oj as Kr,Ok as qr,Ol as Jr,Om as Yr,Or as Xr,Os as Zr,Ot as Qr,Ou as $r,PA as ei,PM as ti,P_ as ni,Pa as ri,Pf as ii,Pi as ai,Pj as oi,Pl as si,Pm as ci,Pr as li,Pt as ui,Pu as di,QA as fi,QI as pi,QL as mi,Q_ as hi,Qd as gi,Qg as _i,Qh as vi,Qj as yi,Ql as bi,Qm as xi,Qs as Si,Qt as Ci,Qv as wi,Qx as Ti,Qz as Ei,R as Di,RA as Oi,RL as ki,RM as Ai,R_ as ji,Ra as Mi,Rf as Ni,Rg as Pi,Ri as Fi,Rj as Ii,Rl as Li,Rm as Ri,Rr as zi,Ru as Bi,S as Vi,SA as Hi,SC as Ui,SM as Wi,SR as Gi,S_ as Ki,Sa as qi,Sf as Ji,Sg as Yi,Sj as Xi,Sk as Zi,Sm as Qi,Sn as $i,Sr as ea,Ss as ta,St as na,Su as ra,Sy as ia,T as aa,TA as oa,TC as sa,TI as ca,TM as la,T_ as ua,Ta as da,Tf as fa,Tg as pa,Tj as ma,Tk as ha,Tm as ga,Tn as _a,Tr as va,Ts as ya,Tt as ba,Tu as xa,U as Sa,UA as Ca,UL as wa,UM as Ta,U_ as Ea,Ua as Da,Uf as Oa,Ug as ka,Ui as Aa,Uj as ja,Ul as Ma,Um as Na,Uo as Pa,Ur as Fa,Us as Ia,Ut as La,Uu as Ra,Uv as za,V as Ba,VA as Va,VL as Ha,VM as Ua,V_ as Wa,Va as Ga,Vf as Ka,Vg as qa,Vi as Ja,Vj as Ya,Vl as Xa,Vm as Za,Vr as Qa,Vu as $a,Vv as eo,W as to,WA as no,WL as ro,WM as io,W_ as ao,Wa as oo,Wf as so,Wg as co,Wi as lo,Wj as uo,Wl as fo,Wm as po,Wo as mo,Wr as ho,Ws as go,Wt as _o,Wu as vo,Wv as yo,Wz as bo,X as xo,XA as So,XL as Co,X_ as wo,Xg as To,Xj as Eo,Xl as Do,Xm as Oo,Xo as ko,Xs as Ao,Xt as jo,Xv as Mo,Xx as No,Xz as Po,Y as Fo,YA as Io,YL as Lo,Y_ as Ro,Yg as zo,Yj as Bo,Yl as Vo,Ym as Ho,Yo as Uo,Ys as Wo,Yt as Go,Yv as Ko,Yx as qo,Yz as Jo,Z as Yo,ZA as Xo,ZL as Zo,Z_ as Qo,Zb as $o,Zd as es,Zg as ts,Zj as ns,Zl as rs,Zm as is,Zs as as,Zt as os,Zv as ss,Zx as cs,Zz as ls,_ as us,_B as ds,_C as fs,_M as ps,_R as ms,_S as hs,__ as gs,_a as _s,_f as vs,_g as ys,_i as bs,_j as xs,_k as Ss,_l as Cs,_n as ws,_o as Ts,_r as Es,_s as Ds,_t as Os,_u as ks,_v as As,_y as js,a as Ms,aB as Ns,aC as Ps,aL as Fs,aM as Is,aR as Ls,aS as Rs,a_ as zs,aa as Bs,af as Vs,ag as Hs,ah as Us,aj as Ws,al as Gs,an as Ks,ar as qs,as as Js,at as Ys,au as Xs,av as Zs,ay as Qs,b as $s,bA as ec,bC as tc,bM as nc,b_ as rc,ba as ic,bd as ac,bf as oc,bg as sc,bj as cc,bk as lc,bm as uc,bn as dc,br as fc,bs as pc,bt as mc,bu as hc,by as gc,c as _c,cB as vc,cC as yc,cM as bc,cR as xc,cS as Sc,c_ as Cc,ca as wc,cf as Tc,cg as Ec,cj as Dc,cl as Oc,cn as kc,cr as Ac,cs as jc,ct as Mc,cu as Nc,cv as Pc,cy as Fc,d as Ic,dB as Lc,dC as Rc,dM as zc,dR as Bc,dS as Vc,d_ as Hc,da as Uc,df as Wc,dg as Gc,dj as Kc,dl as qc,dn as Jc,dr as Yc,ds as Xc,dt as Zc,du as Qc,dv as $c,dy as el,eB as tl,eE as nl,eL as rl,eM as il,eR as al,eS as ol,e_ as sl,ec as cl,ef as ll,eg as ul,eh as dl,ej as fl,en as pl,er as ml,es as hl,et as gl,eu as _l,ev as vl,ey as yl,f as bl,fB as xl,fC as Sl,fM as Cl,fR as wl,fS as Tl,f_ as El,fa as Dl,ff as Ol,fg as kl,fj as Al,fk as jl,fl as Ml,fn as Nl,fo as Pl,fr as Fl,fs as Il,ft as Ll,fu as Rl,fv as zl,fy as Bl,g as Vl,gB as Hl,gC as Ul,gM as Wl,gR as Gl,gS as Kl,g_ as ql,ga as Jl,gf as Yl,gg as Xl,gi as Zl,gj as Ql,gk as $l,gl as eu,gn as tu,go as nu,gr as ru,gs as iu,gt as au,gu as ou,gv as su,gy as cu,hB as lu,hC as uu,hM as du,hR as fu,hS as pu,h_ as mu,ha as hu,hf as gu,hg as _u,hj as vu,hk as yu,hl as bu,hn as xu,ho as Su,hr as Cu,hs as wu,ht as Tu,hu as Eu,hv as Du,hy as Ou,i as ku,iB as Au,iC as ju,iL as Mu,iM as Nu,iR as Pu,iS as Fu,i_ as Iu,ia as Lu,if as Ru,ig as zu,ih as Bu,ij as Vu,il as Hu,in as Uu,ir as Wu,is as Gu,it as Ku,iu as qu,iv as Ju,iy as Yu,jA as Xu,jI as Zu,jM as Qu,j_ as $u,ja as ed,jf as td,jj as nd,jl as rd,jm as id,jr as ad,js as od,jt as sd,ju as cd,jv as ld,k as ud,kA as dd,kC as fd,kI as pd,kM as md,k_ as hd,ka as gd,kf as _d,kg as vd,kj as yd,kk as bd,kl as xd,km as Sd,kr as Cd,ks as wd,kt as Td,ku as Ed,l as Dd,lB as Od,lC as kd,lM as Ad,lR as jd,lS as Md,l_ as Nd,la as Pd,lf as Fd,lg as Id,lj as Ld,ll as Rd,ln as zd,lr as Bd,ls as Vd,lt as Hd,lu as Ud,ly as Wd,m as Gd,mB as Kd,mC as qd,mM as Jd,mR as Yd,mS as Xd,m_ as Zd,ma as Qd,mf as $d,mg as ef,mj as tf,mk as nf,ml as rf,mn as af,mo as of,mr as sf,ms as cf,mt as lf,mu as uf,mv as df,my as ff,n as pf,nB as mf,nL as hf,nM as gf,nR as _f,nS as vf,n_ as yf,nc as bf,nf as xf,ng as Sf,nh as Cf,nj as wf,nl as Tf,nn as Ef,nr as Df,ns as Of,nu as kf,nv as Af,ny as jf,o as Mf,oB as I,oC as Nf,oL as Pf,oM as Ff,oR as If,oS as Lf,o_ as Rf,oa as zf,of as Bf,og as Vf,oh as Hf,oj as Uf,ol as Wf,on as Gf,os as Kf,ot as qf,ou as Jf,ov as Yf,oy as Xf,p as Zf,pC as Qf,pM as $f,pR as ep,pS as tp,p_ as np,pa as rp,pf as ip,pg as ap,pj as op,pk as sp,pl as cp,pn as lp,po as up,pr as dp,ps as fp,pt as pp,pu as mp,pv as hp,py as gp,q as _p,qA as vp,qL as yp,qM as bp,q_ as xp,qf as Sp,qg as Cp,qi as wp,qj as Tp,ql as Ep,qm as Dp,qo as Op,qs as kp,qt as Ap,qv as jp,qx as Mp,qz as Np,r as Pp,rB as Fp,rC as Ip,rL as Lp,rM as Rp,rR as zp,rS as Bp,r_ as Vp,ra as Hp,rf as Up,rg as Wp,rh as Gp,rj as Kp,rl as qp,rn as Jp,rr as Yp,rs as Xp,rt as Zp,ru as Qp,rv as $p,ry as em,s as tm,sB as nm,sC as eee,sM as rm,sR as im,sS as tee,s_ as nee,sa as ree,sf as iee,sg as aee,sh as oee,sj as see,sl as cee,sn as lee,sr as uee,ss as am,st as dee,su as fee,sv as om,sy as sm,t as L,tB as cm,tL as lm,tM as um,tR as dm,tS as pee,t_ as mee,tc as fm,tf as hee,tg as pm,th as mm,tj as gee,tl as _ee,tn as vee,tr as hm,ts as yee,tu as bee,tv as gm,ty as _m,u as vm,uB as ym,uC as xee,uM as bm,uR as See,uS as Cee,u_ as xm,ua as Sm,uf as wee,ug as Tee,uj as Eee,ul as Dee,un as Oee,ur as kee,us as Aee,ut as jee,uu as Mee,uv as Nee,uy as Pee,v as Cm,vC as Fee,vM as Iee,vR as Lee,vS as wm,v_ as Ree,va as zee,vf as Bee,vg as Vee,vi as Hee,vj as Tm,vk as Em,vl as Dm,vn as Om,vr as km,vs as Am,vt as jm,vu as Mm,vv as Nm,vy as Pm,w as Fm,wA as Im,wC as Lm,wM as Rm,w_ as zm,wa as Bm,wf as Vm,wg as Hm,wi as Um,wj as Wm,wk as Gm,wm as Km,wn as qm,wr as Jm,ws as Ym,wt as Xm,wu as Zm,x as Qm,xA as $m,xC as eh,xM as th,xR as nh,x_ as rh,xa as ih,xb as ah,xf as oh,xg as sh,xj as ch,xk as lh,xm as uh,xn as dh,xr as fh,xs as ph,xt as mh,xu as hh,xy as gh,y as R,yC as _h,yM as Uee,yR as Wee,y_ as Gee,ya as Kee,yf as qee,yg as Jee,yj as Yee,yk as Xee,ym as Zee,yn as Qee,yr as vh,ys as $ee,yt as ete,yu as yh,yy as tte,yz as nte,z as rte,zA as ite,zL as ate,zM as ote,z_ as bh,za as ste,zf as xh,zg as cte,zi as lte,zj as ute,zl as dte,zm as fte,zr as pte,zu as mte}from"./api-Borb_oKz.js";import{t as Sh}from"./x-XSJ8VGVc.js";import{a as Ch,c as hte,i as wh,l as gte,n as Th,o as Eh,r as Dh,s as Oh,t as kh,u as Ah}from"./dist-Bq0h0jBi.js";import{a as jh,i as Mh,n as Nh,r as Ph,t as Fh}from"./dist-BCOYDeQS.js";import{n as Ih,t as Lh}from"./button-Bcf40mKN.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var _te=a((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),vte=a(((e,t)=>{t.exports=_te()})),yte=a((t=>{var r=vte(),i=e(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var te=Array.isArray,N=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function ae(e){return{current:e}}function oe(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function se(e,t){ie++,re[ie]=e.current,e.current=t}var ce=ae(null),le=ae(null),ue=ae(null),de=ae(null);function fe(e,t){switch(se(ue,t),se(le,e),se(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?af(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=af(t),e=of(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}oe(ce),se(ce,e)}function pe(){oe(ce),oe(le),oe(ue)}function me(e){e.memoizedState!==null&&se(de,e);var t=ce.current,n=of(t,e.type);t!==n&&(se(le,e),se(ce,n))}function he(e){le.current===e&&(oe(ce),oe(le)),de.current===e&&(oe(de),mp._currentValue=ne)}var ge,_e;function ve(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+ge+e+_e}var ye=!1;function be(e,t){if(!e||ye)return``;ye=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -214,14 +214,14 @@ ${e}</tr>
|
|
|
214
214
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${TQ(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=EQ(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+TQ(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=EQ(e);if(i===null)return TQ(n);e=i;let a=`<img src="${e}" alt="${TQ(n)}"`;return t&&(a+=` title="${TQ(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:TQ(e.text)}},NQ=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},PQ=class e{options;renderer;textRenderer;constructor(e){this.options=e||qZ,this.options.renderer=this.options.renderer||new MQ,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new NQ}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},FQ=class{options;block;constructor(e){this.options=e||qZ}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?jQ.lex:jQ.lexInline}provideParser(e=this.block){return e?PQ.parse:PQ.parseInline}},IQ=new class{defaults=KZ();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=PQ;Renderer=MQ;TextRenderer=NQ;Lexer=jQ;Tokenizer=AQ;Hooks=FQ;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new MQ(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new AQ(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new FQ;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];FQ.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&FQ.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return jQ.lex(e,t??this.defaults)}parser(e,t){return PQ.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?jQ.lex:jQ.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?PQ.parse:PQ.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?jQ.lex:jQ.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?PQ.parse:PQ.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
215
215
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+TQ(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function LQ(e,t){return IQ.parse(e,t)}LQ.options=LQ.setOptions=function(e){return IQ.setOptions(e),LQ.defaults=IQ.defaults,JZ(LQ.defaults),LQ},LQ.getDefaults=KZ,LQ.defaults=qZ,LQ.use=function(...e){return IQ.use(...e),LQ.defaults=IQ.defaults,JZ(LQ.defaults),LQ},LQ.walkTokens=function(e,t){return IQ.walkTokens(e,t)},LQ.parseInline=IQ.parseInline,LQ.Parser=PQ,LQ.parser=PQ.parse,LQ.Renderer=MQ,LQ.TextRenderer=NQ,LQ.Lexer=jQ,LQ.lexer=jQ.lex,LQ.Tokenizer=AQ,LQ.Hooks=FQ,LQ.parse=LQ,LQ.options,LQ.setOptions,LQ.use,LQ.walkTokens,LQ.parseInline,PQ.parse,jQ.lex;var Ype=`modulepreload`,Xpe=function(e){return`/`+e},RQ={},zQ=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Xpe(t,n),t in RQ)return;RQ[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ype,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Zpe=300,Qpe=`300px`,$pe=500;function eme(e={}){let{immediate:t=!1,debounceDelay:n=Zpe,rootMargin:r=Qpe,idleTimeout:i=$pe}=e,[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,z.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,z.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,z.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?p(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var BQ=/\s/,tme=/^\s+$/,nme=new Set([`code`,`pre`,`svg`,`math`,`annotation`]),rme=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,ime=e=>e.some(e=>rme(e)&&nme.has(e.tagName)),ame=e=>{let t=[],n=``,r=!1;for(let i of e){let e=BQ.test(i);e!==r&&n&&(t.push(n),n=``),n+=i,r=e}return n&&t.push(n),t},ome=e=>{let t=[],n=``;for(let r of e)BQ.test(r)?n+=r:(n&&=(t.push(n),``),t.push(r));return n&&t.push(n),t},sme=(e,t,n,r,i,a)=>{let o=`--sd-animation:sd-${t};--sd-duration:${i?0:n}ms;--sd-easing:${r}`;return a&&(o+=`;--sd-delay:${a}ms`),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},cme=(e,t,n,r,i)=>{let a=t.at(-1);if(!(a&&`children`in a))return;if(ime(t))return uL;let o=a,s=o.children.indexOf(e);if(s===-1)return;let c=e.value;if(!c.trim()){i.count+=c.length;return}let l=n.sep===`char`?ome(c):ame(c),u=r.prevContentLength,d=l.map(e=>{let t=i.count;if(i.count+=e.length,tme.test(e))return{type:`text`,value:e};let r=u>0&&t<u,a=r?0:i.newIndex++*n.stagger;return sme(e,n.animation,n.duration,n.easing,r,a)});return o.children.splice(s,1,...d),s+d.length},lme=0;function VQ(e){let t={animation:e?.animation??`fadeIn`,duration:e?.duration??150,easing:e?.easing??`ease`,sep:e?.sep??`word`,stagger:e?.stagger??40},n={prevContentLength:0,lastRenderCharCount:0},r=lme++,i=()=>e=>{let r={count:0,newIndex:0};dL(e,`text`,(e,i)=>cme(e,i,t,n,r)),n.lastRenderCharCount=r.count,n.prevContentLength=0};return Object.defineProperty(i,"name",{value:`rehypeAnimate$${r}`}),{name:`animate`,type:`animate`,rehypePlugin:i,setPrevContentLength(e){n.prevContentLength=e},getLastRenderCharCount(){let e=n.lastRenderCharCount;return n.lastRenderCharCount=0,e}}}VQ();var HQ=(0,z.createContext)(!1),ume=()=>(0,z.useContext)(HQ),UQ=(...e)=>c(i(e)),dme=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(` `)},fme=e=>e?(...t)=>dme(e,c(i(t))):UQ,WQ=(e,t,n)=>{let r=typeof t==`string`&&n.startsWith(`text/csv`)?``:``,i=typeof t==`string`?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},GQ=(0,z.createContext)(UQ),KQ=()=>(0,z.useContext)(GQ),pme=UQ(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-6`,`before:mr-4`,`before:text-[13px]`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),mme=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},qQ=(0,z.memo)(({children:e,result:t,language:n,className:r,startLine:i,lineNumbers:a=!0,...o})=>{let s=KQ(),c=(0,z.useMemo)(()=>s(pme),[s]),l=(0,z.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,mme(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,B.jsx)(`div`,{className:s(r,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,...o,children:(0,B.jsx)(`pre`,{className:s(r,`bg-[var(--sdm-bg,inherit]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]`),style:l,children:(0,B.jsx)(`code`,{className:a?s(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:a&&i&&i>1?{counterReset:`line ${i-1}`}:void 0,children:t.tokens.map((e,t)=>(0,B.jsx)(`span`,{className:a?c:void 0,children:e.length===0||e.length===1&&e[0].content===``?`
|
|
216
216
|
`:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,B.jsx)(`span`,{className:s(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),hme=({className:e,language:t,style:n,isIncomplete:r,...i})=>(0,B.jsx)(`div`,{className:KQ()(`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`,...n},...i}),JQ=(0,z.createContext)({code:``}),YQ=()=>(0,z.useContext)(JQ),gme=({language:e})=>{let t=KQ();return(0,B.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,B.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},_me=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
217
|
-
`;)t--;return e.slice(0,t)},vme=(0,z.lazy)(()=>zQ(()=>import(`./highlighted-body-OFNGDK62-
|
|
217
|
+
`;)t--;return e.slice(0,t)},vme=(0,z.lazy)(()=>zQ(()=>import(`./highlighted-body-OFNGDK62-DSC5jaxG.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),yme=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=KQ(),l=(0,z.useMemo)(()=>_me(e),[e]),u=(0,z.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
|
|
218
218
|
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[l]);return(0,B.jsx)(JQ.Provider,{value:{code:e},children:(0,B.jsxs)(hme,{isIncomplete:i,language:t,children:[(0,B.jsx)(gme,{language:t}),r?(0,B.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,B.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(qQ,{className:n,language:t,lineNumbers:o,result:u,startLine:a,...s}),children:(0,B.jsx)(vme,{className:n,code:l,language:t,lineNumbers:o,raw:u,startLine:a,...s})})]})})},XQ={CheckIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,B.jsxs)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,B.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},ZQ=(0,z.createContext)(XQ),bme=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>e[n]===t[n]):!1},QQ=({icons:e,children:t})=>{let n=(0,z.useRef)(e),r=(0,z.useRef)(e?{...XQ,...e}:XQ);bme(n.current,e)||(n.current=e,r.current=e?{...XQ,...e}:XQ);let i=r.current;return(0,B.jsx)(ZQ.Provider,{value:i,children:t})},$Q=()=>(0,z.useContext)(ZQ),e$={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},t$=(0,z.createContext)(e$),n$=()=>(0,z.useContext)(t$),r$=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=KQ(),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(0),{code:d}=YQ(),{isAnimating:f}=(0,z.useContext)(f1),p=n$(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,z.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=$Q(),_=c?g.CheckIcon:g.CopyIcon;return(0,B.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,B.jsx)(_,{size:14})})},i$={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},xme=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=KQ(),{code:c}=YQ(),{isAnimating:l}=(0,z.useContext)(f1),u=n$(),d=$Q(),f=a??c,p=`file.${n&&n in i$?i$[n]:`txt`}`;return(0,B.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{WQ(p,f,`text/plain`),e?.()}catch(e){t?.(e)}},title:u.downloadFile,type:`button`,...o,children:r??(0,B.jsx)(d.DownloadIcon,{size:14})})},a$=()=>{let{Loader2Icon:e}=$Q(),t=KQ();return(0,B.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,B.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,B.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,B.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},Sme=/\.[^/.]+$/,Cme=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,...o})=>{let{DownloadIcon:s}=$Q(),c=KQ(),l=(0,z.useRef)(null),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1),m=n$(),h=o.width!=null||o.height!=null,g=(u||h)&&!f,_=f&&!h;(0,z.useEffect)(()=>{let e=l.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;d(t),p(!t)}},[]);let v=(0,z.useCallback)(e=>{d(!0),p(!1),i?.(e)},[i]),y=(0,z.useCallback)(e=>{d(!1),p(!0),a?.(e)},[a]),b=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(Sme,``)}.${i}`}WQ(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,B.jsxs)(`div`,{className:c(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,B.jsx)(`img`,{alt:r,className:c(`max-w-full rounded-lg`,_&&`hidden`,t),"data-streamdown":`image`,onError:y,onLoad:v,ref:l,src:n,...o}),_&&(0,B.jsx)(`span`,{className:c(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:m.imageNotAvailable}),(0,B.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`)}),g&&(0,B.jsx)(`button`,{className:c(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:b,title:m.downloadImage,type:`button`,children:(0,B.jsx)(s,{size:14})})]}):null},o$=0,s$=()=>{o$+=1,o$===1&&(document.body.style.overflow=`hidden`)},c$=()=>{o$=Math.max(0,o$-1),o$===0&&(document.body.style.overflow=``)},wme=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=$Q(),c=KQ(),[l,u]=(0,z.useState)(!1),d=n$(),f=(0,z.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,z.useCallback)(()=>{r(),n()},[r,n]);return(0,z.useEffect)(()=>{if(t){s$();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),c$()}}},[t,n]),t?(0,B.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,B.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,B.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,B.jsx)(s,{size:16})}),(0,B.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,B.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,B.jsx)(o,{size:20}),(0,B.jsx)(`span`,{children:d.openExternalLink})]}),(0,B.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,B.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,B.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,B.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:f,type:`button`,children:l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i,{size:14}),(0,B.jsx)(`span`,{children:d.copied})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(a,{size:14}),(0,B.jsx)(`span`,{children:d.copyLink})]})}),(0,B.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:p,type:`button`,children:[(0,B.jsx)(o,{size:14}),(0,B.jsx)(`span`,{children:d.openLink})]})]})]})}):null},l$=(0,z.createContext)(null),u$=()=>(0,z.useContext)(l$),Tme=()=>u$()?.code??null,d$=()=>u$()?.mermaid??null,Eme=e=>{var t;let n=u$();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},Dme=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);if(!o){n(Error(`Failed to create 2D canvas context for PNG export`));return}o.drawImage(i,0,0,r,a),e.toBlob(e=>{if(!e){n(Error(`Failed to create PNG blob`));return}t(e)},`image/png`)},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),Ome=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=KQ(),[s,c]=(0,z.useState)(!1),l=(0,z.useRef)(null),{isAnimating:u}=(0,z.useContext)(f1),d=$Q(),f=d$(),p=n$(),m=async t=>{try{if(t===`mmd`){WQ(`diagram.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!f){a?.(Error(`Mermaid plugin not available`));return}let n=f.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}if(t===`svg`){WQ(`diagram.svg`,l,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){WQ(`diagram.png`,await Dme(l),`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,B.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,B.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:p.downloadDiagram,type:`button`,children:t??(0,B.jsx)(d.DownloadIcon,{size:14})}),s?(0,B.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`svg`),title:p.downloadDiagramAsSvg,type:`button`,children:p.mermaidFormatSvg}),(0,B.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`png`),title:p.downloadDiagramAsPng,type:`button`,children:p.mermaidFormatPng}),(0,B.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`mmd`),title:p.downloadDiagramAsMmd,type:`button`,children:p.mermaidFormatMmd})]}):null]})},kme=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=$Q(),c=KQ(),[l,u]=(0,z.useState)(!1),{isAnimating:d,controls:f}=(0,z.useContext)(f1),p=n$(),m=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0?!0:e.panZoom!==!1})(),h=()=>{u(!l)};return(0,z.useEffect)(()=>{if(l){s$();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),c$()}}},[l]),(0,z.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:h,title:p.viewFullscreen,type:`button`,...a,children:(0,B.jsx)(o,{size:14})}),l?(0,Bv.createPortal)((0,B.jsxs)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),onClick:h,onKeyDown:e=>{e.key===`Escape`&&h()},role:`button`,tabIndex:0,children:[(0,B.jsx)(`button`,{className:c(`absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:h,title:p.exitFullscreen,type:`button`,children:(0,B.jsx)(s,{size:20})}),(0,B.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,B.jsx)(h1,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})},f$=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(e.textContent?.trim()||``);let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(e.textContent?.trim()||``);n.push(t)}return{headers:t,rows:n}},p$=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1,n=!1;for(let r of e){if(r===`"`){t=!0,n=!0;break}(r===`,`||r===`
|
|
219
219
|
`)&&(t=!0)}return t?n?`"${e.replace(/"/g,`""`)}"`:`"${e}"`:e},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(`,`),o+=1);for(let e of n)a[o]=e.map(r).join(`,`),o+=1;return a.join(`
|
|
220
220
|
`)},Ame=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
|
|
221
221
|
`||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
|
|
222
222
|
`?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
|
|
223
223
|
`)},m$=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):n.push(t);return n.join(``)},h$=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0;r[i]=`| ${t.map(e=>m$(e)).join(` | `)} |`,i+=1;let a=Array(t.length);for(let e=0;e<t.length;e+=1)a[e]=`---`;r[i]=`| ${a.join(` | `)} |`,i+=1;for(let e of n)if(e.length<t.length){let n=Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?m$(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else r[i]=`| ${e.map(e=>m$(e)).join(` | `)} |`,i+=1;return r.join(`
|
|
224
|
-
`)},g$=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=KQ(),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=(0,z.useRef)(0),{isAnimating:f}=(0,z.useContext)(f1),p=n$(),m=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=f$(t),o=({csv:p$,tsv:Ame,md:h$}[e]||h$)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let h=$Q(),g=c?h.CheckIcon:h.CopyIcon;return(0,B.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,B.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:p.copyTable,type:`button`,children:e??(0,B.jsx)(g,{height:14,width:14})}),o?(0,B.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`md`),title:p.copyTableAsMarkdown,type:`button`,children:p.tableFormatMarkdown}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`csv`),title:p.copyTableAsCsv,type:`button`,children:p.tableFormatCsv}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`tsv`),title:p.copyTableAsTsv,type:`button`,children:p.tableFormatTsv})]}):null]})},_$=({children:e,className:t,onDownload:n,onError:r})=>{let i=KQ(),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),{isAnimating:c}=(0,z.useContext)(f1),l=n$(),u=$Q(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=f$(t),a=e===`csv`?p$(i):h$(i);WQ(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,B.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,B.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,B.jsx)(u.DownloadIcon,{size:14})}),a?(0,B.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},jme=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=$Q(),o=KQ(),[s,c]=(0,z.useState)(!1),{isAnimating:l}=(0,z.useContext)(f1),u=n$(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,z.useEffect)(()=>{if(s){s$();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),c$()}}},[s]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,B.jsx)(i,{size:14})}),s?(0,Bv.createPortal)((0,B.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,B.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,B.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,B.jsx)(g$,{}):null,r?(0,B.jsx)(_$,{}):null,(0,B.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,B.jsx)(a,{size:20})})]}),(0,B.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,B.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},Mme=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=KQ(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,B.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,B.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,B.jsx)(g$,{}):null,l?(0,B.jsx)(_$,{}):null,u?(0,B.jsx)(jme,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,B.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,B.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},Nme=/startLine=(\d+)/,Pme=/\bnoLineNumbers\b/,Fme=(0,z.lazy)(()=>zQ(()=>import(`./mermaid-GHXKKRXX-CWDFvVZH.js`).then(e=>({default:e.Mermaid})),[])),Ime=/language-([^\s]+)/;function v$(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function y$(e,t){return e.className===t.className&&v$(e.node,t.node)}var b$=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,x$=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},S$=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},C$=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},w$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ol`,{className:KQ()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>y$(e,t));w$.displayName=`MarkdownOl`;var T$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`li`,{className:KQ()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&v$(e.node,t.node));T$.displayName=`MarkdownLi`;var E$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ul`,{className:KQ()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>y$(e,t));E$.displayName=`MarkdownUl`;var D$=(0,z.memo)(({className:e,node:t,...n})=>(0,B.jsx)(`hr`,{className:KQ()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>y$(e,t));D$.displayName=`MarkdownHr`;var O$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`span`,{className:KQ()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>y$(e,t));O$.displayName=`MarkdownStrong`;var k$=(0,z.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=KQ(),{linkSafety:o}=(0,z.useContext)(f1),[s,c]=(0,z.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,z.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,z.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,z.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,B.jsx)(wme,{...p})]}):(0,B.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>y$(e,t)&&e.href===t.href);k$.displayName=`MarkdownA`;var A$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h1`,{className:KQ()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>y$(e,t));A$.displayName=`MarkdownH1`;var j$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h2`,{className:KQ()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>y$(e,t));j$.displayName=`MarkdownH2`;var M$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h3`,{className:KQ()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>y$(e,t));M$.displayName=`MarkdownH3`;var N$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h4`,{className:KQ()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>y$(e,t));N$.displayName=`MarkdownH4`;var P$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h5`,{className:KQ()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>y$(e,t));P$.displayName=`MarkdownH5`;var F$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h6`,{className:KQ()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>y$(e,t));F$.displayName=`MarkdownH6`;var I$=(0,z.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,z.useContext)(f1);return(0,B.jsx)(Mme,{className:t,showControls:b$(i,`table`),showCopy:x$(i,`copy`),showDownload:x$(i,`download`),showFullscreen:x$(i,`fullscreen`),...r,children:e})},(e,t)=>y$(e,t));I$.displayName=`MarkdownTable`;var L$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`thead`,{className:KQ()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>y$(e,t));L$.displayName=`MarkdownThead`;var R$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tbody`,{className:KQ()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>y$(e,t));R$.displayName=`MarkdownTbody`;var z$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tr`,{className:KQ()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>y$(e,t));z$.displayName=`MarkdownTr`;var B$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`th`,{className:KQ()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>y$(e,t));B$.displayName=`MarkdownTh`;var V$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`td`,{className:KQ()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>y$(e,t));V$.displayName=`MarkdownTd`;var H$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`blockquote`,{className:KQ()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>y$(e,t));H$.displayName=`MarkdownBlockquote`;var U$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sup`,{className:KQ()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>y$(e,t));U$.displayName=`MarkdownSup`;var W$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sub`,{className:KQ()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>y$(e,t));W$.displayName=`MarkdownSub`;var G$=(0,z.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,z.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,z.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,z.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,z.isValidElement)(e))return e;if(e.type===w$){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,B.jsx)(`section`,{className:t,...r,children:i}):null}return(0,B.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>y$(e,t));G$.displayName=`MarkdownSection`;var K$=(0,z.memo)(({node:e,className:t,children:n,...r})=>{let i=KQ(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,z.useContext)(f1),l=d$(),u=ume(),d=(t?.match(Ime))?.at(1)??``,f=Eme(d);if(a)return(0,B.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(Nme),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&Pme.test(p))&&c!==!1,v=``;if((0,z.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(a$,{}),children:(0,B.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=b$(s,`mermaid`),n=C$(s,`download`),r=C$(s,`copy`),a=C$(s,`fullscreen`),c=C$(s,`panZoom`),l=e&&(n||r||a);return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(a$,{}),children:(0,B.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,B.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,B.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,B.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,B.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,B.jsx)(Ome,{chart:v,config:o?.config}):null,r?(0,B.jsx)(r$,{code:v}):null,a?(0,B.jsx)(kme,{chart:v,config:o?.config}):null]})}):null,(0,B.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,B.jsx)(Fme,{chart:v,config:o?.config,showControls:c})})]})})}let y=b$(s,`code`),b=S$(s,`download`),x=S$(s,`copy`);return(0,B.jsx)(yme,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,B.jsxs)(B.Fragment,{children:[b?(0,B.jsx)(xme,{code:v,language:d}):null,x?(0,B.jsx)(r$,{}):null]}):null})},(e,t)=>e.className===t.className&&v$(e.node,t.node));K$.displayName=`MarkdownCode`;var q$=(0,z.memo)(Cme,(e,t)=>e.className===t.className&&v$(e.node,t.node));q$.displayName=`MarkdownImg`;var J$=(0,z.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,z.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,B.jsx)(B.Fragment,{children:e})}return(0,B.jsx)(`p`,{...n,children:e})},(e,t)=>y$(e,t));J$.displayName=`MarkdownParagraph`;var Lme={ol:w$,li:T$,ul:E$,hr:D$,strong:O$,a:k$,h1:A$,h2:j$,h3:M$,h4:N$,h5:P$,h6:F$,table:I$,thead:L$,tbody:R$,tr:z$,th:B$,td:V$,blockquote:H$,code:K$,img:q$,pre:({children:e})=>(0,z.isValidElement)(e)?(0,z.cloneElement)(e,{"data-block":`true`}):e,sup:U$,sub:W$,p:J$,section:G$},Rme=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,zme=/\p{L}/u;function Y$(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(Rme.test(e))return`rtl`;if(zme.test(e))return`ltr`}return`ltr`}var Bme=/^[ \t]{0,3}(`{3,}|~{3,})/,Vme=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,X$=e=>{let t=e.split(`
|
|
224
|
+
`)},g$=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=KQ(),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=(0,z.useRef)(0),{isAnimating:f}=(0,z.useContext)(f1),p=n$(),m=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=f$(t),o=({csv:p$,tsv:Ame,md:h$}[e]||h$)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let h=$Q(),g=c?h.CheckIcon:h.CopyIcon;return(0,B.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,B.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:p.copyTable,type:`button`,children:e??(0,B.jsx)(g,{height:14,width:14})}),o?(0,B.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`md`),title:p.copyTableAsMarkdown,type:`button`,children:p.tableFormatMarkdown}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`csv`),title:p.copyTableAsCsv,type:`button`,children:p.tableFormatCsv}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`tsv`),title:p.copyTableAsTsv,type:`button`,children:p.tableFormatTsv})]}):null]})},_$=({children:e,className:t,onDownload:n,onError:r})=>{let i=KQ(),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),{isAnimating:c}=(0,z.useContext)(f1),l=n$(),u=$Q(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=f$(t),a=e===`csv`?p$(i):h$(i);WQ(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,B.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,B.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,B.jsx)(u.DownloadIcon,{size:14})}),a?(0,B.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},jme=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=$Q(),o=KQ(),[s,c]=(0,z.useState)(!1),{isAnimating:l}=(0,z.useContext)(f1),u=n$(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,z.useEffect)(()=>{if(s){s$();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),c$()}}},[s]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,B.jsx)(i,{size:14})}),s?(0,Bv.createPortal)((0,B.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,B.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,B.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,B.jsx)(g$,{}):null,r?(0,B.jsx)(_$,{}):null,(0,B.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,B.jsx)(a,{size:20})})]}),(0,B.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,B.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},Mme=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=KQ(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,B.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,B.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,B.jsx)(g$,{}):null,l?(0,B.jsx)(_$,{}):null,u?(0,B.jsx)(jme,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,B.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,B.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},Nme=/startLine=(\d+)/,Pme=/\bnoLineNumbers\b/,Fme=(0,z.lazy)(()=>zQ(()=>import(`./mermaid-GHXKKRXX-BoodyZnM.js`).then(e=>({default:e.Mermaid})),[])),Ime=/language-([^\s]+)/;function v$(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function y$(e,t){return e.className===t.className&&v$(e.node,t.node)}var b$=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,x$=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},S$=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},C$=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},w$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ol`,{className:KQ()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>y$(e,t));w$.displayName=`MarkdownOl`;var T$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`li`,{className:KQ()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&v$(e.node,t.node));T$.displayName=`MarkdownLi`;var E$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ul`,{className:KQ()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>y$(e,t));E$.displayName=`MarkdownUl`;var D$=(0,z.memo)(({className:e,node:t,...n})=>(0,B.jsx)(`hr`,{className:KQ()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>y$(e,t));D$.displayName=`MarkdownHr`;var O$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`span`,{className:KQ()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>y$(e,t));O$.displayName=`MarkdownStrong`;var k$=(0,z.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=KQ(),{linkSafety:o}=(0,z.useContext)(f1),[s,c]=(0,z.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,z.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,z.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,z.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,B.jsx)(wme,{...p})]}):(0,B.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>y$(e,t)&&e.href===t.href);k$.displayName=`MarkdownA`;var A$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h1`,{className:KQ()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>y$(e,t));A$.displayName=`MarkdownH1`;var j$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h2`,{className:KQ()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>y$(e,t));j$.displayName=`MarkdownH2`;var M$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h3`,{className:KQ()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>y$(e,t));M$.displayName=`MarkdownH3`;var N$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h4`,{className:KQ()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>y$(e,t));N$.displayName=`MarkdownH4`;var P$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h5`,{className:KQ()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>y$(e,t));P$.displayName=`MarkdownH5`;var F$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h6`,{className:KQ()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>y$(e,t));F$.displayName=`MarkdownH6`;var I$=(0,z.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,z.useContext)(f1);return(0,B.jsx)(Mme,{className:t,showControls:b$(i,`table`),showCopy:x$(i,`copy`),showDownload:x$(i,`download`),showFullscreen:x$(i,`fullscreen`),...r,children:e})},(e,t)=>y$(e,t));I$.displayName=`MarkdownTable`;var L$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`thead`,{className:KQ()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>y$(e,t));L$.displayName=`MarkdownThead`;var R$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tbody`,{className:KQ()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>y$(e,t));R$.displayName=`MarkdownTbody`;var z$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tr`,{className:KQ()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>y$(e,t));z$.displayName=`MarkdownTr`;var B$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`th`,{className:KQ()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>y$(e,t));B$.displayName=`MarkdownTh`;var V$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`td`,{className:KQ()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>y$(e,t));V$.displayName=`MarkdownTd`;var H$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`blockquote`,{className:KQ()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>y$(e,t));H$.displayName=`MarkdownBlockquote`;var U$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sup`,{className:KQ()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>y$(e,t));U$.displayName=`MarkdownSup`;var W$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sub`,{className:KQ()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>y$(e,t));W$.displayName=`MarkdownSub`;var G$=(0,z.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,z.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,z.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,z.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,z.isValidElement)(e))return e;if(e.type===w$){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,B.jsx)(`section`,{className:t,...r,children:i}):null}return(0,B.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>y$(e,t));G$.displayName=`MarkdownSection`;var K$=(0,z.memo)(({node:e,className:t,children:n,...r})=>{let i=KQ(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,z.useContext)(f1),l=d$(),u=ume(),d=(t?.match(Ime))?.at(1)??``,f=Eme(d);if(a)return(0,B.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(Nme),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&Pme.test(p))&&c!==!1,v=``;if((0,z.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(a$,{}),children:(0,B.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=b$(s,`mermaid`),n=C$(s,`download`),r=C$(s,`copy`),a=C$(s,`fullscreen`),c=C$(s,`panZoom`),l=e&&(n||r||a);return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(a$,{}),children:(0,B.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,B.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,B.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,B.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,B.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,B.jsx)(Ome,{chart:v,config:o?.config}):null,r?(0,B.jsx)(r$,{code:v}):null,a?(0,B.jsx)(kme,{chart:v,config:o?.config}):null]})}):null,(0,B.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,B.jsx)(Fme,{chart:v,config:o?.config,showControls:c})})]})})}let y=b$(s,`code`),b=S$(s,`download`),x=S$(s,`copy`);return(0,B.jsx)(yme,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,B.jsxs)(B.Fragment,{children:[b?(0,B.jsx)(xme,{code:v,language:d}):null,x?(0,B.jsx)(r$,{}):null]}):null})},(e,t)=>e.className===t.className&&v$(e.node,t.node));K$.displayName=`MarkdownCode`;var q$=(0,z.memo)(Cme,(e,t)=>e.className===t.className&&v$(e.node,t.node));q$.displayName=`MarkdownImg`;var J$=(0,z.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,z.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,B.jsx)(B.Fragment,{children:e})}return(0,B.jsx)(`p`,{...n,children:e})},(e,t)=>y$(e,t));J$.displayName=`MarkdownParagraph`;var Lme={ol:w$,li:T$,ul:E$,hr:D$,strong:O$,a:k$,h1:A$,h2:j$,h3:M$,h4:N$,h5:P$,h6:F$,table:I$,thead:L$,tbody:R$,tr:z$,th:B$,td:V$,blockquote:H$,code:K$,img:q$,pre:({children:e})=>(0,z.isValidElement)(e)?(0,z.cloneElement)(e,{"data-block":`true`}):e,sup:U$,sub:W$,p:J$,section:G$},Rme=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,zme=/\p{L}/u;function Y$(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(Rme.test(e))return`rtl`;if(zme.test(e))return`ltr`}return`ltr`}var Bme=/^[ \t]{0,3}(`{3,}|~{3,})/,Vme=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,X$=e=>{let t=e.split(`
|
|
225
225
|
`),n=null,r=0;for(let e of t){let t=Bme.exec(e);if(n===null){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],i=e[0],a=e.length;i===n&&a>=r&&(n=null,r=0)}}return n!==null},Hme=e=>{let t=e.split(`
|
|
226
226
|
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&Vme.test(t))return!0}return!1},Ume=()=>e=>{pL(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},Z$=[],Q$={allowDangerousHtml:!0},$$=new WeakMap,e1=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let t=`default`;return this.keyCache.set(e,t),t}let a=e=>{if(!e||e.length===0)return``;let t=``;for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=`,`),Array.isArray(r)){let[e,n]=r;if(typeof e==`function`){let n=$$.get(e);n||(n=e.name,$$.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=$$.get(r);e||(e=r.name,$$.set(r,e)),t+=e}else t+=String(r)}return t},o=a(n),s=`${a(r)}::${o}::${i?JSON.stringify(i):``}`;return this.keyCache.set(e,s),s}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},t1=e=>{let t=Wme(e),n=e.children||``;return Zme(t.runSync(t.parse(n),n),e)},Wme=e=>{let t=e1.get(e);if(t)return t;let n=Kme(e);return e1.set(e,n),n},Gme=e=>e.some(e=>Array.isArray(e)?e[0]===RU:e===RU),Kme=e=>{let t=e.rehypePlugins||Z$,n=e.remarkPlugins||Z$,r=Gme(t)?n:[...n,Ume],i=e.remarkRehypeOptions?{...Q$,...e.remarkRehypeOptions}:Q$;return spe().use(XX).use(r).use(Ufe,i).use(t)},qme=e=>e,Jme=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},Yme=(e,t)=>{for(let n in dX)if(Object.hasOwn(dX,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=dX[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},Xme=(e,t,n,r,i,a)=>{let o=!1;return r?o=!r.includes(e.tagName):i&&(o=i.includes(e.tagName)),!o&&a&&typeof t==`number`&&(o=!a(e,t,n)),o},Zme=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:a,unwrapDisallowed:o,urlTransform:s}=t;if(n||r||i||a||s){let t=s||qme;pL(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return Jme(c,s,a,e.value),s;if(e.type===`element`&&(Yme(e,t),Xme(e,s,c,r,i,n)&&c&&typeof s==`number`))return o&&e.children?c.children.splice(s,1,...e.children):c.children.splice(s,1),s})}return UY(e,{Fragment:B.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:B.jsx,jsxs:B.jsxs,passKeys:!0,passNode:!0})},Qme=/\[\^[\w-]{1,200}\](?!:)/,$me=/\[\^[\w-]{1,200}\]:/,ehe=/<(\w+)[\s>]/,the=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),n1=new Map,r1=new Map,nhe=e=>{let t=e.toLowerCase(),n=n1.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return n1.set(t,r),r},rhe=e=>{let t=e.toLowerCase(),n=r1.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return r1.set(t,r),r},i1=(e,t)=>{if(the.has(t.toLowerCase()))return 0;let n=e.match(nhe(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},a1=(e,t)=>{let n=e.match(rhe(t));return n?n.length:0},ihe=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]===`$`&&e[n+1]===`$`&&(t+=1,n+=1);return t},ahe=e=>{let t=Qme.test(e),n=$me.test(e);if(t||n)return[e];let r=jQ.lex(e,{gfm:!0}),i=[],a=[],o=!1;for(let e of r){let t=e.raw,n=i.length;if(a.length>0){i[n-1]+=t;let e=a.at(-1),r=i1(t,e),o=a1(t,e);for(let t=0;t<r;t+=1)a.push(e);for(let t=0;t<o;t+=1)a.length>0&&a.at(-1)===e&&a.pop();continue}if(e.type===`html`&&e.block){let e=t.match(ehe);if(e){let n=e[1];i1(t,n)>a1(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(ihe(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},ohe=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>{if(!n.includes(`
|
|
227
227
|
|
|
@@ -236,9 +236,9 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
236
236
|
`})}return n},she=/([\\`*_~[\]|])/g,che=e=>e.replace(she,`\\$1`),lhe=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+che(n).replace(/\n\n/g,` `)+r)}return n},o1=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(o1).join(``):``,uhe=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));pL(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=o1(e);e.children=t?[{type:`text`,value:t}]:[]}})},dhe=()=>e=>{pL(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},fhe=/^[ \t]*<[\w!/?-]/,phe=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,mhe=e=>typeof e!=`string`||e.length===0||!fhe.test(e)?e:e.replace(phe,`$1`),s1={...BU,protocols:{...BU.protocols,href:[...BU.protocols?.href??[],`tel`]},attributes:{...BU.attributes,code:[...BU.attributes?.code??[],`metastring`]}},c1={raw:RU,sanitize:[rW,s1],harden:[hL,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},hhe={gfm:[bY,{}],codeMeta:dhe},l1=Object.values(c1),ghe=Object.values(hhe),_he={block:` ▋`,circle:` ●`},u1=[`github-light`,`github-dark`],d1={enabled:!0},f1=(0,z.createContext)({shikiTheme:u1,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:d1}),p1=(0,z.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{if(o){let e=o.getLastRenderCharCount();o.setPrevContentLength(e)}let c=typeof e==`string`&&n?mhe(e):e,l=(0,B.jsx)(t1,{...s,children:c});return(0,B.jsx)(HQ.Provider,{value:i,children:a?(0,B.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});p1.displayName=`Block`;var m1=(0,z.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=l1,remarkPlugins:s=ghe,className:c,shikiTheme:l=u1,mermaid:u,controls:d=!0,isAnimating:f=!1,animated:p,BlockComponent:m=p1,parseMarkdownIntoBlocksFn:h=ahe,caret:g,plugins:_,remend:v,linkSafety:y=d1,lineNumbers:b=!0,allowedTags:x,literalTagContent:S,translations:C,icons:w,prefix:T,onAnimationStart:E,onAnimationEnd:D,...O})=>{let k=(0,z.useId)(),[A,ee]=(0,z.useTransition)(),j=(0,z.useMemo)(()=>fme(T),[T]),M=(0,z.useRef)(null),te=(0,z.useRef)(E),N=(0,z.useRef)(D);te.current=E,N.current=D,(0,z.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=M.current;if(M.current=f,i===null){f&&((e=te.current)==null||e.call(te));return}f&&!i?(n=te.current)==null||n.call(te):!f&&i&&((r=N.current)==null||r.call(N))},[f,t]);let P=(0,z.useMemo)(()=>x?Object.keys(x):[],[x]),ne=(0,z.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?LI(e,v):e;return S&&S.length>0&&(n=lhe(n,S)),P.length>0&&(n=ohe(n,P)),n},[e,t,r,v,P,S]),re=(0,z.useMemo)(()=>h(ne),[ne,h]),[ie,ae]=(0,z.useState)(re);(0,z.useEffect)(()=>{t===`streaming`&&!ue?ee(()=>{ae(re)}):ae(re)},[re,t]);let oe=t===`streaming`?ie:re,se=(0,z.useMemo)(()=>n===`auto`?oe.map(Y$):void 0,[oe,n]),ce=(0,z.useMemo)(()=>oe.map((e,t)=>`${k}-${t}`),[oe.length,k]),le=(0,z.useMemo)(()=>p===!0?`true`:p?JSON.stringify(p):``,[p]),ue=(0,z.useMemo)(()=>le?le===`true`?VQ():VQ(p):null,[le]),de=(0,z.useMemo)(()=>({shikiTheme:(_?.code)?.getThemes()??l,controls:d,isAnimating:f,lineNumbers:b,mode:t,mermaid:u,linkSafety:y}),[l,d,f,b,t,u,y,_?.code]),fe=(0,z.useMemo)(()=>({...e$,...C}),[(0,z.useMemo)(()=>C?JSON.stringify(C):``,[C])]),pe=(0,z.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...Lme,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,z.createElement)(t,n):null:(0,z.createElement)(e,n)}return n},[a]),me=(0,z.useMemo)(()=>{let e=[];return _!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsBefore]),e=[...e,...s],_!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsAfter]),_!=null&&_.math&&(e=[...e,_.math.remarkPlugin]),e},[s,_?.math,_?.cjk]),he=(0,z.useMemo)(()=>{let e=o;if(x&&Object.keys(x).length>0&&o===l1){let t={...s1,tagNames:[...s1.tagNames??[],...Object.keys(x)],attributes:{...s1.attributes,...x}};e=[c1.raw,[rW,t],c1.harden]}return S&&S.length>0&&(e=[...e,[uhe,S]]),_!=null&&_.math&&(e=[...e,_.math.rehypePlugin]),ue&&f&&(e=[...e,ue.rehypePlugin]),e},[o,_?.math,ue,f,x,S]),ge=(0,z.useMemo)(()=>{if(!f||oe.length===0)return!1;let e=oe.at(-1);return X$(e)||Hme(e)},[f,oe]),_e=(0,z.useMemo)(()=>g&&f&&!ge?{"--streamdown-caret":`"${_he[g]}"`}:void 0,[g,f,ge]);return t===`static`?(0,B.jsx)(t$.Provider,{value:fe,children:(0,B.jsx)(l$.Provider,{value:_??null,children:(0,B.jsx)(f1.Provider,{value:de,children:(0,B.jsx)(QQ,{icons:w,children:(0,B.jsx)(GQ.Provider,{value:j,children:(0,B.jsx)(`div`,{className:j(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,c),dir:n===`auto`?Y$(ne):n,children:(0,B.jsx)(t1,{components:pe,rehypePlugins:he,remarkPlugins:me,...O,children:ne})})})})})})}):(0,B.jsx)(t$.Provider,{value:fe,children:(0,B.jsx)(l$.Provider,{value:_??null,children:(0,B.jsx)(f1.Provider,{value:de,children:(0,B.jsx)(QQ,{icons:w,children:(0,B.jsx)(GQ.Provider,{value:j,children:(0,B.jsxs)(`div`,{className:j(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,g&&!ge?`[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]`:null,c),style:_e,children:[oe.length===0&&g&&f&&(0,B.jsx)(`span`,{}),oe.map((e,t)=>{let a=t===oe.length-1,o=f&&a&&X$(e);return(0,B.jsx)(m,{animatePlugin:ue,components:pe,content:e,dir:se?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:he,remarkPlugins:me,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...O},ce[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);m1.displayName=`Streamdown`;var vhe=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:a=!0,initialZoom:o=1,fullscreen:s=!1})=>{let{RotateCcwIcon:c,ZoomInIcon:l,ZoomOutIcon:u}=$Q(),d=KQ(),f=(0,z.useRef)(null),p=(0,z.useRef)(null),[m,h]=(0,z.useState)(o),[g,_]=(0,z.useState)({x:0,y:0}),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)({x:0,y:0}),[S,C]=(0,z.useState)({x:0,y:0}),w=(0,z.useCallback)(e=>{h(t=>Math.max(n,Math.min(r,t+e)))},[n,r]),T=(0,z.useCallback)(()=>{w(i)},[w,i]),E=(0,z.useCallback)(()=>{w(-i)},[w,i]),D=(0,z.useCallback)(()=>{h(o),_({x:0,y:0})},[o]),O=(0,z.useCallback)(e=>{e.preventDefault(),w(e.deltaY>0?-i:i)},[w,i]),k=(0,z.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;y(!0),x({x:e.clientX,y:e.clientY}),C(g);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[g]),A=(0,z.useCallback)(e=>{if(!v)return;e.preventDefault();let t=e.clientX-b.x,n=e.clientY-b.y;_({x:S.x+t,y:S.y+n})},[v,b,S]),ee=(0,z.useCallback)(e=>{y(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);return(0,z.useEffect)(()=>{let e=f.current;if(e)return e.addEventListener(`wheel`,O,{passive:!1}),()=>{e.removeEventListener(`wheel`,O)}},[O]),(0,z.useEffect)(()=>{let e=p.current;if(e&&v)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,A,{passive:!1}),e.addEventListener(`pointerup`,ee),e.addEventListener(`pointercancel`,ee),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,A),e.removeEventListener(`pointerup`,ee),e.removeEventListener(`pointercancel`,ee)}},[v,A,ee]),(0,B.jsxs)(`div`,{className:d(`relative flex flex-col`,s?`h-full w-full`:`min-h-28 w-full`,t),ref:f,style:{cursor:v?`grabbing`:`grab`},children:[a?(0,B.jsxs)(`div`,{className:d(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,s?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m>=r,onClick:T,title:`Zoom in`,type:`button`,children:(0,B.jsx)(l,{size:16})}),(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m<=n,onClick:E,title:`Zoom out`,type:`button`,children:(0,B.jsx)(u,{size:16})}),(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:D,title:`Reset zoom and pan`,type:`button`,children:(0,B.jsx)(c,{size:16})})]}):null,(0,B.jsx)(`div`,{className:d(`flex-1 origin-center transition-transform duration-150 ease-out`,s?`flex h-full w-full items-center justify-center`:`flex w-full items-center justify-center`),onPointerDown:k,ref:p,role:`application`,style:{transform:`translate(${g.x}px, ${g.y}px) scale(${m})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},h1=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=KQ(),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(``),[m,h]=(0,z.useState)(0),{mermaid:g}=(0,z.useContext)(f1),_=d$(),v=g?.errorComponent,{shouldRender:y,containerRef:b}=eme({immediate:r});if((0,z.useEffect)(()=>{if(y){if(!_){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}(async()=>{try{s(null),l(!0);let t=_.getMermaid(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),i=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:a}=await t.render(i,e);d(a),p(a)}catch(e){f||u||s(e instanceof Error?e.message:`Failed to render Mermaid chart`)}finally{l(!1)}})()}},[e,n,m,y,_]),!(y||u||f))return(0,B.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:b});if(c&&!u&&!f)return(0,B.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:b,children:(0,B.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,B.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,B.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!f)return v?(0,B.jsx)(`div`,{ref:b,children:(0,B.jsx)(v,{chart:e,error:o,retry:()=>h(e=>e+1)})}):(0,B.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:b,children:[(0,B.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,B.jsxs)(`details`,{className:a(`mt-2`),children:[(0,B.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,B.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let x=u||f;return(0,B.jsx)(`div`,{className:a(`size-full`,t),"data-streamdown":`mermaid`,ref:b,children:(0,B.jsx)(vhe,{className:a(r?`size-full overflow-hidden`:`overflow-hidden`,t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,B.jsx)(`div`,{"aria-label":`Mermaid chart`,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:x},role:`img`})})})};function yhe(e){return[RU,[rW,{}],[hL,{allowedImagePrefixes:e.allowedImagePrefixes??[`*`],allowedLinkPrefixes:e.allowedLinkPrefixes??[`*`],allowedProtocols:e.allowedProtocols??[`*`],allowDataImages:e.allowDataImages??!0,defaultOrigin:e.defaultOrigin,blockedLinkClass:e.blockedLinkClass,blockedImageClass:e.blockedImageClass}]]}var g1=(0,z.forwardRef)(({components:e,componentsByLanguage:t,preprocess:n,defer:r=!1,smooth:i=!1,plugins:a,containerProps:o,containerClassName:s,caret:c,controls:l,linkSafety:u,remend:d,mermaid:f,parseIncompleteMarkdown:p,allowedTags:m,remarkRehypeOptions:h,security:g,BlockComponent:_,parseMarkdownIntoBlocksFn:v,mode:y=`streaming`,className:b,shikiTheme:x,...S},C)=>{let w=MP(),{text:T,status:E}=LP((0,z.useMemo)(()=>n?{...w,text:n(w.text)}:w,[w,n]),i),D=(0,z.useDeferredValue)(T),O=r?D:T,k=y===`streaming`&&p!==!1&&!v,A=(0,z.useMemo)(()=>k?qI(O,d):O,[k,O,d]),ee=k?!1:p,j=(0,z.useMemo)(()=>{let e=wde(a,{});return Object.keys(e).length>0?e:void 0},[a]),M=(0,z.useMemo)(()=>x??(j?.code?Sde:void 0),[x,j?.code]),te=eL({components:e,componentsByLanguage:t}),N=(0,z.useMemo)(()=>{let{SyntaxHighlighter:t,CodeHeader:n,...r}=e??{};return{...r,...te}},[e,te]),P=(0,z.useMemo)(()=>[s,o?.className].filter(Boolean).join(` `)||void 0,[s,o?.className]),ne=(0,z.useMemo)(()=>g?yhe(g):void 0,[g]),re={...b&&{className:b},...c&&{caret:c},...l!==void 0&&{controls:l},...u&&{linkSafety:u},...d&&{remend:d},...f&&{mermaid:f},...ee!==void 0&&{parseIncompleteMarkdown:ee},...m&&{allowedTags:m},...j&&{plugins:j},...M&&{shikiTheme:M},...h&&{remarkRehypeOptions:h},...ne&&{rehypePlugins:ne},..._&&{BlockComponent:_},...v&&{parseMarkdownIntoBlocksFn:v}};return(0,B.jsx)(`div`,{ref:C,"data-status":E.type,...o,className:P,children:(0,B.jsx)(m1,{mode:y,isAnimating:E.type===`running`,components:N,...re,...S,children:A})})});g1.displayName=`StreamdownTextPrimitive`;function bhe(e){return typeof e==`string`&&/^(https?:|mailto:)/i.test(e.trim())}function _1({href:e,children:t,node:n,...r}){return bhe(e)?(0,B.jsx)(`a`,{...r,href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}):(0,B.jsx)(`span`,{...r,children:t})}var xhe={a:_1},She={a:_1};function v1({text:e}){return(0,B.jsx)(m1,{className:`oc-md`,components:She,children:e})}var Che=(0,z.memo)(function(){return(0,B.jsx)(g1,{className:`oc-md`,smooth:!U(e=>e.metadata?.custom?.hasMergedRuns===!0),components:xhe})}),whe=new Set(`txt.md.markdown.csv.tsv.log.json.yaml.yml.xml.html.css.js.ts.tsx.jsx.py.rb.go.rs.java.c.h.cpp.hpp.sh.bash.sql.toml.ini.env`.split(`.`)),The=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`avif`,`bmp`]),Ehe=new Set([`application/vnd.openxmlformats-officedocument.presentationml.presentation`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-powerpoint`,`application/msword`,`application/vnd.ms-excel`,`application/vnd.oasis.opendocument.text`,`application/vnd.oasis.opendocument.presentation`,`application/vnd.oasis.opendocument.spreadsheet`,`application/rtf`]),Dhe=new Set([`pptx`,`ppt`,`docx`,`doc`,`xlsx`,`xls`,`odt`,`odp`,`ods`,`rtf`]);function y1(e,t){let n=(e??``).toLowerCase();if(Ehe.has(n))return!0;let r=b1(t);return r!==null&&Dhe.has(r)}function b1(e){if(!e)return null;let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?null:e.slice(t+1).toLowerCase()}function x1(e,t){let n=(e??``).split(`;`)[0].trim().toLowerCase(),r=b1(t);if(n===`application/pdf`)return`pdf`;if(n.startsWith(`image/`))return`image`;if(n.startsWith(`video/`))return`video`;if(n.startsWith(`audio/`))return`audio`;if(n===`text/markdown`)return`markdown`;if(n===`text/csv`||n===`text/tab-separated-values`)return`csv`;if(n===`application/json`||n.endsWith(`+json`))return`json`;if(n===`text/x-log`)return`log`;if(n===``||n===`text/plain`||n===`application/octet-stream`||n===`binary/octet-stream`){if(r===`md`||r===`markdown`)return`markdown`;if(r===`csv`||r===`tsv`)return`csv`;if(r===`json`)return`json`;if(r===`log`)return`log`}return n.startsWith(`text/`)||n===`application/json`||n===`application/xml`||n===`application/x-yaml`?`text`:r===`pdf`?`pdf`:r!==null&&The.has(r)?`image`:r!==null&&whe.has(r)?`text`:`none`}var Ohe=[`fit`,.5,.75,1,1.5,2];function S1(e,t){return Number.isFinite(e)?Math.min(Math.max(1,Math.floor(e)),Math.max(1,Math.floor(t))):1}var C1=512*1024,khe=1e3,Ahe=5e3;function jhe(e,t){if((e??``).split(`;`)[0].trim().toLowerCase()===`text/tab-separated-values`||b1(t)===`tsv`)return` `}function Mhe(e){let t=`,`,n=0;for(let r of[`,`,`;`,` `]){let i=w1(e,r).length;i>n&&(t=r,n=i)}return t}function w1(e,t){let n=[],r=``,i=!1;for(let a=0;a<e.length;a++){let o=e[a];i?o===`"`?e[a+1]===`"`?(r+=`"`,a++):i=!1:r+=o:o===`"`?i=!0:o===t?(n.push(r),r=``):r+=o}return n.push(r),n}function Nhe(e,t=khe,n){let r=[],i=``,a=!1,o=e.replace(/\r\n/g,`
|
|
237
237
|
`).replace(/\r/g,`
|
|
238
238
|
`);for(let e of o)e===`"`&&(a=!a),e===`
|
|
239
|
-
`&&!a?(r.push(i),i=``):i+=e;i!==``&&r.push(i);let s=r.findIndex(e=>e.trim()!==``);if(s===-1)return{header:[],rows:[],totalRows:0,truncatedRows:!1,delimiter:`,`};let c=n??Mhe(r[s]),l=w1(r[s],c),u=r.slice(s+1);return{header:l,rows:u.slice(0,t).map(e=>w1(e,c)),totalRows:u.length,truncatedRows:u.length>t,delimiter:c}}function Phe(e,t){let n=e.trim(),r=t.trim();if(/^-?\d+$/.test(n)&&/^-?\d+$/.test(r)){let e=BigInt(n),t=BigInt(r);return e<t?-1:+(e>t)}let i=Number(e),a=Number(t);return n!==``&&r!==``&&!Number.isNaN(i)&&!Number.isNaN(a)?i-a:e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Fhe(e){return/\b(error|err|fatal|critical|panic)\b/i.test(e)?`error`:/\b(warn|warning)\b/i.test(e)?`warn`:/\b(info|notice)\b/i.test(e)?`info`:/\b(debug|trace|verbose)\b/i.test(e)?`debug`:`plain`}var T1=60;function E1({url:e,filename:t}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(1),[c,l]=(0,z.useState)(`fit`);if((0,z.useEffect)(()=>{let t=!1,n=null;return r(null),a(!1),s(1),(async()=>{try{let i=await zQ(()=>import(`./pdf-BFBPmq_U.js`),[]);i.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CHFwMXne.mjs`,``+import.meta.url).toString();let a=i.getDocument({url:e}),o=await a.promise;if(t){a.destroy().catch(()=>{});return}n=a,r(o)}catch(e){console.error(`[docviewer] pdf load failed:`,e?.message??e),t||a(!0)}})(),()=>{t=!0,n&&n.destroy().catch(()=>{})}},[e]),i)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Uc()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:hu()})]});if(n===null)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:Dl()});let u=n.numPages,d=S1(o,u);return(0,B.jsxs)(`div`,{className:`oc-docviewer__pdf`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__toolbar`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>S1(e-1,u)),disabled:d<=1,"aria-label":Bs(),children:(0,B.jsx)(cy,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-docviewer__pageinfo`,children:[d,` / `,u]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>S1(e+1,u)),disabled:d>=u,"aria-label":Lu(),children:(0,B.jsx)(ly,{size:15})}),(0,B.jsx)(`select`,{className:`oc-docviewer__zoom`,value:String(c),onChange:e=>{let t=e.target.value;l(t===`fit`?`fit`:Number(t))},"aria-label":rp(),children:Ohe.map(e=>(0,B.jsx)(`option`,{value:String(e),children:e===`fit`?Qd():`${Math.round(e*100)}%`},String(e)))})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__pdfbody`,children:[u>1?(0,B.jsxs)(`div`,{className:`oc-docviewer__rail`,"aria-label":zf(),children:[Array.from({length:Math.min(u,T1)},(e,t)=>(0,B.jsx)(Lhe,{doc:n,page:t+1,active:t+1===d,onClick:()=>s(t+1)},t+1)),u>T1?(0,B.jsxs)(`span`,{className:`oc-docviewer__railmore`,children:[`+`,u-T1]}):null]}):null,(0,B.jsx)(Ihe,{doc:n,page:d,zoom:c,filename:t})]})]})}function Ihe({doc:e,page:t,zoom:n,filename:r}){let i=(0,z.useRef)(null),a=(0,z.useRef)(null),[o,s]=(0,z.useState)(0);return(0,z.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;s(e=>Math.abs(e-t)>1?t:e)});return t.observe(e),()=>t.disconnect()},[]),(0,z.useEffect)(()=>{let r=!1,i=null;return(async()=>{try{let s=await e.getPage(t),c=a.current;if(r||!c)return;let l=s.getViewport({scale:1}),u=n===`fit`?Math.max(.1,(o-16)/l.width):n,d=window.devicePixelRatio||1,f=s.getViewport({scale:u*d});c.width=Math.floor(f.width),c.height=Math.floor(f.height),c.style.width=`${Math.floor(f.width/d)}px`,c.style.height=`${Math.floor(f.height/d)}px`;let p=s.render({canvas:c,viewport:f});i=p,await p.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] page render failed:`,e?.message??e)}})(),()=>{r=!0,i?.cancel()}},[e,t,n,o]),(0,B.jsx)(`div`,{ref:i,className:`oc-docviewer__main`,children:(0,B.jsx)(`canvas`,{ref:a,className:`oc-docviewer__canvas`,"aria-label":r})})}function Lhe({doc:e,page:t,active:n,onClick:r}){let i=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let n=!1,r=null;return(async()=>{try{let a=await e.getPage(t),o=i.current;if(n||!o)return;let s=104/a.getViewport({scale:1}).width,c=a.getViewport({scale:s});o.width=Math.floor(c.width),o.height=Math.floor(c.height);let l=a.render({canvas:o,viewport:c});r=l,await l.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] thumbnail render failed:`,e?.message??e)}})(),()=>{n=!0,r?.cancel()}},[e,t]),(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__thumb${n?` is-active`:``}`,onClick:r,"aria-label":Hp({page:t}),"aria-current":n?`true`:void 0,children:[(0,B.jsx)(`canvas`,{ref:i,className:`oc-docviewer__thumbcanvas`}),(0,B.jsx)(`span`,{className:`oc-docviewer__thumbnum`,children:t})]})}var D1={current:null},O1=(0,z.createContext)(D1);function Rhe(e){let t=0,n=e.match(/`+/g);if(n!==null)for(let e of n)t=Math.max(t,e.length);return"`".repeat(Math.max(3,t+1))}function zhe(e,t,n){let r=Rhe(t);return`\n${e} ${n}\n${r}\n${t}\n${r}\n`}function Bhe(e,t){let n=e.length,r=1;for(let t=0;t<e.length;t++)e.charCodeAt(t)===10&&r++;return n<=8e3&&r<=150?{kind:`inline`,lines:r,chars:n}:{kind:`file`,filename:`texte-colle-${t}.txt`,lines:r,chars:n}}var k1=new WeakSet;function A1(e){k1.add(e)}function j1(e){return k1.has(e)}var M1=(0,z.createContext)({activeDoc:null,openFor:()=>{},openNewerVersion:()=>{},close:()=>{}});function N1(){return(0,z.useContext)(M1)}function P1({doc:e,chatId:t,onClose:n}){let r=x1(e.mimeType,e.filename),i=r===`none`&&e.sourceStorageId!==void 0,a=N1(),o=I(L.documentDrafts.latestDeliveredFile,t===null?`skip`:{chatId:t,filename:e.filename,...e.storageId===void 0?{}:{currentStorageId:e.storageId}}),s=o!=null&&(e.storageId===void 0?o.url!==e.url:o.storageId!==e.storageId)?o:null;return(0,B.jsxs)(`div`,{className:`oc-docviewer`,children:[(0,B.jsxs)(`header`,{className:`oc-docviewer__header`,children:[(0,B.jsx)(Ey,{size:15,"aria-hidden":!0,className:`oc-docviewer__icon`}),(0,B.jsx)(`span`,{className:`oc-docviewer__name`,title:e.filename,children:e.filename}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,title:hu(),"aria-label":hu(),children:(0,B.jsx)(Cy,{size:14})}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,download:e.filename,title:ee(),"aria-label":ee(),children:(0,B.jsx)(by,{size:14})}),(0,B.jsx)(Lh,{type:`button`,size:`icon-sm`,variant:`ghost`,onClick:n,"aria-label":ed(),children:(0,B.jsx)(Sh,{size:15})})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__body`,children:[s===null?null:(0,B.jsxs)(`div`,{className:`oc-docviewer__newversion`,role:`status`,children:[(0,B.jsx)(`span`,{children:jn()}),(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>a.openNewerVersion({url:s.url,filename:e.filename,mimeType:s.mimeType||null,storageId:s.storageId,sourceStorageId:y1(s.mimeType,e.filename)?s.storageId:void 0}),children:Ap()})]}),r===`pdf`?(0,B.jsx)(E1,{url:e.url,filename:e.filename}):r===`image`?(0,B.jsx)(`div`,{className:`oc-docviewer__imagewrap`,children:(0,B.jsx)(`img`,{src:e.url,alt:e.filename,className:`oc-docviewer__image`})}):r===`video`?(0,B.jsx)(`video`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__video`}):r===`audio`?(0,B.jsx)(`div`,{className:`oc-docviewer__audiowrap`,children:(0,B.jsx)(`audio`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__audio`})}):r===`text`?(0,B.jsx)(I1,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null},e.url):r===`markdown`||r===`csv`||r===`log`||r===`json`?(0,B.jsx)(I1,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null,rich:r,csvDelimiter:r===`csv`?jhe(e.mimeType,e.filename):void 0},e.url):i?(0,B.jsx)(Vhe,{sourceStorageId:e.sourceStorageId,downloadUrl:e.url,filename:e.filename}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Sm()}),(0,B.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:ee()})]})]})]})}function Vhe({sourceStorageId:e,downloadUrl:t,filename:n}){let r=I(L.fileRenditions.getRendition,{sourceStorageId:e}),i=Ns(L.fileRenditions.requestRendition),a=(0,z.useRef)(null);return(0,z.useEffect)(()=>{a.current=null},[e]),(0,z.useEffect)(()=>{r?.status===`pending`&&a.current!==e&&(a.current=e,i({sourceStorageId:e}).catch(e=>{console.error(`[docviewer] rendition request failed:`,e)}))},[r?.status,e,i]),r===void 0?(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:Dl()}):r.status===`ready`?(0,B.jsx)(E1,{url:r.pdfUrl,filename:r.filename}):r.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-docviewer__preparing`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__spinner`,"aria-hidden":!0}),(0,B.jsx)(`p`,{children:Pd()}),(0,B.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:ee()})]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:r.status===`unconfigured`?Sm():wc()}),(0,B.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:ee()})]})}function Hhe(e){switch(e){case`markdown`:return He();case`csv`:return it();case`log`:return da();case`json`:return Bm()}}var F1=e=>`oc.docviewer.raw.${e}`;function I1({url:e,chatId:t,filename:n,mimeType:r,storageId:i,rich:a,csvDelimiter:o}){let[s,c]=(0,z.useState)({phase:`loading`}),[l,u]=(0,z.useState)(()=>a?localStorage.getItem(F1(a))===`1`:!1),d=e=>{u(e),a&&localStorage.setItem(F1(a),e?`1`:`0`)},[f,p]=(0,z.useState)(!1),m=I(L.documentDrafts.getDraft,t===null?`skip`:{chatId:t,filename:n}),h=t!==null&&s.phase===`ready`&&!s.truncated&&m!==void 0;if((0,z.useEffect)(()=>{let t=!1;return c({phase:`loading`}),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.blob(),i=r.size>C1,a=await(i?r.slice(0,C1):r).text();t||c({phase:`ready`,text:a,truncated:i})}catch(e){console.error(`[docviewer] text fetch failed:`,e?.message??e),t||c({phase:`error`})}})(),()=>{t=!0}},[e]),s.phase===`loading`)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:Dl()});if(s.phase===`error`)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Uc()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:hu()})]});let g=a!==void 0&&!l,_=s.truncated?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:ree()}):null,v=m?.text??s.text,y=m==null?null:(0,B.jsx)(Uhe,{chatId:t,filename:n,diverged:m.sourceStorageId!==null&&i!==null&&m.sourceStorageId!==i}),b=f?(0,B.jsx)(Whe,{chatId:t,filename:n,mimeType:r,sourceStorageId:i,initialText:v,hasDraft:m!=null,onExit:()=>p(!1)}):g&&a===`markdown`?(0,B.jsx)(`div`,{className:`oc-docviewer__mdwrap`,children:(0,B.jsx)(v1,{text:v})}):g&&a===`csv`?(0,B.jsx)(Ghe,{text:v,textTruncated:s.truncated,delimiter:o}):g&&a===`log`?(0,B.jsx)(Khe,{text:v,textTruncated:s.truncated}):g&&a===`json`?(0,B.jsx)(qhe,{text:v}):(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:v});return a===void 0&&!h?(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap`,children:[_,y,b]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap oc-docviewer__textwrap--bar`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__mdbar`,role:`group`,"aria-label":gd(),children:[a===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:g&&!f?`secondary`:`ghost`,"aria-pressed":g&&!f,onClick:()=>{p(!1),d(!1)},children:Hhe(a)}),(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:l&&!f?`secondary`:`ghost`,"aria-pressed":l&&!f,onClick:()=>{p(!1),d(!0)},children:Ur()})]}),h?(0,B.jsxs)(Lh,{type:`button`,size:`sm`,variant:f?`secondary`:`ghost`,"aria-pressed":f,onClick:()=>p(e=>!e),className:`oc-docviewer__editbtn`,children:[(0,B.jsx)(ob,{size:13,"aria-hidden":!0}),Gf(),m==null?null:(0,B.jsx)(`span`,{className:`oc-docviewer__draftdot`,"aria-hidden":!0})]}):null]}),f?b:(0,B.jsx)(`div`,{className:`oc-docviewer__textscroll`,children:(0,B.jsxs)(`div`,{className:`oc-docviewer__scrollpad`,children:[_,y,b]})})]})}function Uhe({chatId:e,filename:t,diverged:n}){let r=Ns(L.documentDrafts.deleteDraft),i=VF();return(0,B.jsxs)(`p`,{className:`oc-docviewer__draftnote`,children:[n?Go():jo(),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__draftnote-discard`,onClick:()=>void r({chatId:e,filename:t}).then(e=>{e.applied===!1&&i.error(La())}).catch(()=>i.error(_o())),children:Ef()})]})}function Whe({chatId:e,filename:t,mimeType:n,sourceStorageId:r,initialText:i,hasDraft:a,onExit:o}){let s=Ns(L.documentDrafts.saveDraft),c=Ns(L.documentDrafts.deleteDraft),l=(0,z.useContext)(O1),u=VF(),d=`oc.docdraft.fallback.${e}.${t}`,[f,p]=(0,z.useState)(()=>{try{let e=localStorage.getItem(d);if(e!==null)return e}catch{}return i}),[m,h]=(0,z.useState)(`idle`),g=(0,z.useRef)(0),_=(0,z.useRef)(f);_.current=f;let v=(0,z.useRef)(!1),y=(0,z.useRef)(!1),b=(0,z.useCallback)(n=>{h(`saving`),s({chatId:e,filename:t,text:n,...r!==null&&(y.current||!a)?{sourceStorageId:r}:{}}).then(e=>{if(e.applied===!1){u.error(La()),h(`idle`);return}h(`saved`)}).catch(e=>{console.error(`[docviewer] draft save failed:`,e),u.error(Jp()),h(`idle`)})},[s,e,t,r,a,u]),x=e=>{y.current=!0,p(e),window.clearTimeout(g.current),g.current=window.setTimeout(()=>b(e),800)};return(0,z.useEffect)(()=>{try{localStorage.getItem(d)!==null&&(y.current=!0,s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>localStorage.removeItem(d)))}catch{}let n=()=>{if(!(!y.current||v.current))try{localStorage.setItem(d,_.current)}catch{}};return window.addEventListener(`pagehide`,n),()=>{if(window.removeEventListener(`pagehide`,n),window.clearTimeout(g.current),!v.current&&y.current){try{localStorage.setItem(d,_.current)}catch{}s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>{try{localStorage.removeItem(d)}catch{}}).catch(()=>{})}}},[]),(0,B.jsxs)(`div`,{className:`oc-docviewer__editor`,children:[(0,B.jsx)(`textarea`,{className:`oc-docviewer__editarea`,value:f,onChange:e=>x(e.target.value),spellCheck:!1,"aria-label":Gf()}),(0,B.jsxs)(`div`,{className:`oc-docviewer__editbar`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__savestate`,role:`status`,children:m===`saving`?Ks():m===`saved`?Uu():`\xA0`}),(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{v.current=!0,window.clearTimeout(g.current);try{localStorage.removeItem(d)}catch{}c({chatId:e,filename:t}).then(e=>{if(e.applied===!1){v.current=!1,u.error(La());return}o()}).catch(e=>{console.error(`[docviewer] draft discard failed:`,e),v.current=!1,u.error(_o())})},children:Ef()}),(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{let e=l?.current??null;if(e===null){u.error(os());return}if(window.clearTimeout(g.current),b(f),e.canAttach){let r=(n??`text/plain`).split(`;`)[0].trim(),i=new File([f],t,{type:`${r}; charset=utf-8`});e.attachFile(i).catch(e=>{console.error(`[docviewer] attach failed:`,e),u.error(Ci())})}else{if(f.length>8e3){u.error(Vt());return}e.insertText(zhe(t,f,Jn()))}},children:vee()})]})]})}function Ghe({text:e,textTruncated:t,delimiter:n}){let r=(0,z.useMemo)(()=>Nhe(e,void 0,n),[e,n]),[i,a]=(0,z.useState)(null),o=(0,z.useMemo)(()=>i?[...r.rows].sort((e,t)=>Phe(e[i.col]??``,t[i.col]??``)*i.dir):r.rows,[r.rows,i]);if(r.header.length===0)return(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e});let s=r.header.slice(0,100),c=r.header.length>s.length;return(0,B.jsxs)(`div`,{className:`oc-docviewer__csvwrap`,children:[r.truncatedRows?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?qi({shown:r.rows.length}):Te({shown:r.rows.length,total:r.totalRows})}):null,c?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:ih({shown:s.length,total:r.header.length})}):null,(0,B.jsxs)(`table`,{className:`oc-docviewer__csv`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsx)(`tr`,{children:s.map((e,t)=>(0,B.jsx)(`th`,{children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__csvsort`,onClick:()=>a(e=>e?.col===t?e.dir===1?{col:t,dir:-1}:null:{col:t,dir:1}),"aria-label":ic({column:e}),children:[e,i?.col===t?i.dir===1?` ▲`:` ▼`:``]})},t))})}),(0,B.jsx)(`tbody`,{children:o.map((e,t)=>(0,B.jsx)(`tr`,{children:s.map((t,n)=>(0,B.jsx)(`td`,{children:e[n]??``},n))},t))})]})]})}function Khe({text:e,textTruncated:t}){let n=(0,z.useMemo)(()=>{let t=e.split(`
|
|
239
|
+
`&&!a?(r.push(i),i=``):i+=e;i!==``&&r.push(i);let s=r.findIndex(e=>e.trim()!==``);if(s===-1)return{header:[],rows:[],totalRows:0,truncatedRows:!1,delimiter:`,`};let c=n??Mhe(r[s]),l=w1(r[s],c),u=r.slice(s+1);return{header:l,rows:u.slice(0,t).map(e=>w1(e,c)),totalRows:u.length,truncatedRows:u.length>t,delimiter:c}}function Phe(e,t){let n=e.trim(),r=t.trim();if(/^-?\d+$/.test(n)&&/^-?\d+$/.test(r)){let e=BigInt(n),t=BigInt(r);return e<t?-1:+(e>t)}let i=Number(e),a=Number(t);return n!==``&&r!==``&&!Number.isNaN(i)&&!Number.isNaN(a)?i-a:e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Fhe(e){return/\b(error|err|fatal|critical|panic)\b/i.test(e)?`error`:/\b(warn|warning)\b/i.test(e)?`warn`:/\b(info|notice)\b/i.test(e)?`info`:/\b(debug|trace|verbose)\b/i.test(e)?`debug`:`plain`}var T1=60;function E1({url:e,filename:t}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(1),[c,l]=(0,z.useState)(`fit`);if((0,z.useEffect)(()=>{let t=!1,n=null;return r(null),a(!1),s(1),(async()=>{try{let i=await zQ(()=>import(`./pdf-CO5wvqSF.js`),[]);i.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CHFwMXne.mjs`,``+import.meta.url).toString();let a=i.getDocument({url:e}),o=await a.promise;if(t){a.destroy().catch(()=>{});return}n=a,r(o)}catch(e){console.error(`[docviewer] pdf load failed:`,e?.message??e),t||a(!0)}})(),()=>{t=!0,n&&n.destroy().catch(()=>{})}},[e]),i)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Uc()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:hu()})]});if(n===null)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:Dl()});let u=n.numPages,d=S1(o,u);return(0,B.jsxs)(`div`,{className:`oc-docviewer__pdf`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__toolbar`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>S1(e-1,u)),disabled:d<=1,"aria-label":Bs(),children:(0,B.jsx)(cy,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-docviewer__pageinfo`,children:[d,` / `,u]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>S1(e+1,u)),disabled:d>=u,"aria-label":Lu(),children:(0,B.jsx)(ly,{size:15})}),(0,B.jsx)(`select`,{className:`oc-docviewer__zoom`,value:String(c),onChange:e=>{let t=e.target.value;l(t===`fit`?`fit`:Number(t))},"aria-label":rp(),children:Ohe.map(e=>(0,B.jsx)(`option`,{value:String(e),children:e===`fit`?Qd():`${Math.round(e*100)}%`},String(e)))})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__pdfbody`,children:[u>1?(0,B.jsxs)(`div`,{className:`oc-docviewer__rail`,"aria-label":zf(),children:[Array.from({length:Math.min(u,T1)},(e,t)=>(0,B.jsx)(Lhe,{doc:n,page:t+1,active:t+1===d,onClick:()=>s(t+1)},t+1)),u>T1?(0,B.jsxs)(`span`,{className:`oc-docviewer__railmore`,children:[`+`,u-T1]}):null]}):null,(0,B.jsx)(Ihe,{doc:n,page:d,zoom:c,filename:t})]})]})}function Ihe({doc:e,page:t,zoom:n,filename:r}){let i=(0,z.useRef)(null),a=(0,z.useRef)(null),[o,s]=(0,z.useState)(0);return(0,z.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;s(e=>Math.abs(e-t)>1?t:e)});return t.observe(e),()=>t.disconnect()},[]),(0,z.useEffect)(()=>{let r=!1,i=null;return(async()=>{try{let s=await e.getPage(t),c=a.current;if(r||!c)return;let l=s.getViewport({scale:1}),u=n===`fit`?Math.max(.1,(o-16)/l.width):n,d=window.devicePixelRatio||1,f=s.getViewport({scale:u*d});c.width=Math.floor(f.width),c.height=Math.floor(f.height),c.style.width=`${Math.floor(f.width/d)}px`,c.style.height=`${Math.floor(f.height/d)}px`;let p=s.render({canvas:c,viewport:f});i=p,await p.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] page render failed:`,e?.message??e)}})(),()=>{r=!0,i?.cancel()}},[e,t,n,o]),(0,B.jsx)(`div`,{ref:i,className:`oc-docviewer__main`,children:(0,B.jsx)(`canvas`,{ref:a,className:`oc-docviewer__canvas`,"aria-label":r})})}function Lhe({doc:e,page:t,active:n,onClick:r}){let i=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let n=!1,r=null;return(async()=>{try{let a=await e.getPage(t),o=i.current;if(n||!o)return;let s=104/a.getViewport({scale:1}).width,c=a.getViewport({scale:s});o.width=Math.floor(c.width),o.height=Math.floor(c.height);let l=a.render({canvas:o,viewport:c});r=l,await l.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] thumbnail render failed:`,e?.message??e)}})(),()=>{n=!0,r?.cancel()}},[e,t]),(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__thumb${n?` is-active`:``}`,onClick:r,"aria-label":Hp({page:t}),"aria-current":n?`true`:void 0,children:[(0,B.jsx)(`canvas`,{ref:i,className:`oc-docviewer__thumbcanvas`}),(0,B.jsx)(`span`,{className:`oc-docviewer__thumbnum`,children:t})]})}var D1={current:null},O1=(0,z.createContext)(D1);function Rhe(e){let t=0,n=e.match(/`+/g);if(n!==null)for(let e of n)t=Math.max(t,e.length);return"`".repeat(Math.max(3,t+1))}function zhe(e,t,n){let r=Rhe(t);return`\n${e} ${n}\n${r}\n${t}\n${r}\n`}function Bhe(e,t){let n=e.length,r=1;for(let t=0;t<e.length;t++)e.charCodeAt(t)===10&&r++;return n<=8e3&&r<=150?{kind:`inline`,lines:r,chars:n}:{kind:`file`,filename:`texte-colle-${t}.txt`,lines:r,chars:n}}var k1=new WeakSet;function A1(e){k1.add(e)}function j1(e){return k1.has(e)}var M1=(0,z.createContext)({activeDoc:null,openFor:()=>{},openNewerVersion:()=>{},close:()=>{}});function N1(){return(0,z.useContext)(M1)}function P1({doc:e,chatId:t,onClose:n}){let r=x1(e.mimeType,e.filename),i=r===`none`&&e.sourceStorageId!==void 0,a=N1(),o=I(L.documentDrafts.latestDeliveredFile,t===null?`skip`:{chatId:t,filename:e.filename,...e.storageId===void 0?{}:{currentStorageId:e.storageId}}),s=o!=null&&(e.storageId===void 0?o.url!==e.url:o.storageId!==e.storageId)?o:null;return(0,B.jsxs)(`div`,{className:`oc-docviewer`,children:[(0,B.jsxs)(`header`,{className:`oc-docviewer__header`,children:[(0,B.jsx)(Ey,{size:15,"aria-hidden":!0,className:`oc-docviewer__icon`}),(0,B.jsx)(`span`,{className:`oc-docviewer__name`,title:e.filename,children:e.filename}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,title:hu(),"aria-label":hu(),children:(0,B.jsx)(Cy,{size:14})}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,download:e.filename,title:ee(),"aria-label":ee(),children:(0,B.jsx)(by,{size:14})}),(0,B.jsx)(Lh,{type:`button`,size:`icon-sm`,variant:`ghost`,onClick:n,"aria-label":ed(),children:(0,B.jsx)(Sh,{size:15})})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__body`,children:[s===null?null:(0,B.jsxs)(`div`,{className:`oc-docviewer__newversion`,role:`status`,children:[(0,B.jsx)(`span`,{children:jn()}),(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>a.openNewerVersion({url:s.url,filename:e.filename,mimeType:s.mimeType||null,storageId:s.storageId,sourceStorageId:y1(s.mimeType,e.filename)?s.storageId:void 0}),children:Ap()})]}),r===`pdf`?(0,B.jsx)(E1,{url:e.url,filename:e.filename}):r===`image`?(0,B.jsx)(`div`,{className:`oc-docviewer__imagewrap`,children:(0,B.jsx)(`img`,{src:e.url,alt:e.filename,className:`oc-docviewer__image`})}):r===`video`?(0,B.jsx)(`video`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__video`}):r===`audio`?(0,B.jsx)(`div`,{className:`oc-docviewer__audiowrap`,children:(0,B.jsx)(`audio`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__audio`})}):r===`text`?(0,B.jsx)(I1,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null},e.url):r===`markdown`||r===`csv`||r===`log`||r===`json`?(0,B.jsx)(I1,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null,rich:r,csvDelimiter:r===`csv`?jhe(e.mimeType,e.filename):void 0},e.url):i?(0,B.jsx)(Vhe,{sourceStorageId:e.sourceStorageId,downloadUrl:e.url,filename:e.filename}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Sm()}),(0,B.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:ee()})]})]})]})}function Vhe({sourceStorageId:e,downloadUrl:t,filename:n}){let r=I(L.fileRenditions.getRendition,{sourceStorageId:e}),i=Ns(L.fileRenditions.requestRendition),a=(0,z.useRef)(null);return(0,z.useEffect)(()=>{a.current=null},[e]),(0,z.useEffect)(()=>{r?.status===`pending`&&a.current!==e&&(a.current=e,i({sourceStorageId:e}).catch(e=>{console.error(`[docviewer] rendition request failed:`,e)}))},[r?.status,e,i]),r===void 0?(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:Dl()}):r.status===`ready`?(0,B.jsx)(E1,{url:r.pdfUrl,filename:r.filename}):r.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-docviewer__preparing`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__spinner`,"aria-hidden":!0}),(0,B.jsx)(`p`,{children:Pd()}),(0,B.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:ee()})]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:r.status===`unconfigured`?Sm():wc()}),(0,B.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:ee()})]})}function Hhe(e){switch(e){case`markdown`:return He();case`csv`:return it();case`log`:return da();case`json`:return Bm()}}var F1=e=>`oc.docviewer.raw.${e}`;function I1({url:e,chatId:t,filename:n,mimeType:r,storageId:i,rich:a,csvDelimiter:o}){let[s,c]=(0,z.useState)({phase:`loading`}),[l,u]=(0,z.useState)(()=>a?localStorage.getItem(F1(a))===`1`:!1),d=e=>{u(e),a&&localStorage.setItem(F1(a),e?`1`:`0`)},[f,p]=(0,z.useState)(!1),m=I(L.documentDrafts.getDraft,t===null?`skip`:{chatId:t,filename:n}),h=t!==null&&s.phase===`ready`&&!s.truncated&&m!==void 0;if((0,z.useEffect)(()=>{let t=!1;return c({phase:`loading`}),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.blob(),i=r.size>C1,a=await(i?r.slice(0,C1):r).text();t||c({phase:`ready`,text:a,truncated:i})}catch(e){console.error(`[docviewer] text fetch failed:`,e?.message??e),t||c({phase:`error`})}})(),()=>{t=!0}},[e]),s.phase===`loading`)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:Dl()});if(s.phase===`error`)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Uc()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:hu()})]});let g=a!==void 0&&!l,_=s.truncated?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:ree()}):null,v=m?.text??s.text,y=m==null?null:(0,B.jsx)(Uhe,{chatId:t,filename:n,diverged:m.sourceStorageId!==null&&i!==null&&m.sourceStorageId!==i}),b=f?(0,B.jsx)(Whe,{chatId:t,filename:n,mimeType:r,sourceStorageId:i,initialText:v,hasDraft:m!=null,onExit:()=>p(!1)}):g&&a===`markdown`?(0,B.jsx)(`div`,{className:`oc-docviewer__mdwrap`,children:(0,B.jsx)(v1,{text:v})}):g&&a===`csv`?(0,B.jsx)(Ghe,{text:v,textTruncated:s.truncated,delimiter:o}):g&&a===`log`?(0,B.jsx)(Khe,{text:v,textTruncated:s.truncated}):g&&a===`json`?(0,B.jsx)(qhe,{text:v}):(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:v});return a===void 0&&!h?(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap`,children:[_,y,b]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap oc-docviewer__textwrap--bar`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__mdbar`,role:`group`,"aria-label":gd(),children:[a===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:g&&!f?`secondary`:`ghost`,"aria-pressed":g&&!f,onClick:()=>{p(!1),d(!1)},children:Hhe(a)}),(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:l&&!f?`secondary`:`ghost`,"aria-pressed":l&&!f,onClick:()=>{p(!1),d(!0)},children:Ur()})]}),h?(0,B.jsxs)(Lh,{type:`button`,size:`sm`,variant:f?`secondary`:`ghost`,"aria-pressed":f,onClick:()=>p(e=>!e),className:`oc-docviewer__editbtn`,children:[(0,B.jsx)(ob,{size:13,"aria-hidden":!0}),Gf(),m==null?null:(0,B.jsx)(`span`,{className:`oc-docviewer__draftdot`,"aria-hidden":!0})]}):null]}),f?b:(0,B.jsx)(`div`,{className:`oc-docviewer__textscroll`,children:(0,B.jsxs)(`div`,{className:`oc-docviewer__scrollpad`,children:[_,y,b]})})]})}function Uhe({chatId:e,filename:t,diverged:n}){let r=Ns(L.documentDrafts.deleteDraft),i=VF();return(0,B.jsxs)(`p`,{className:`oc-docviewer__draftnote`,children:[n?Go():jo(),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__draftnote-discard`,onClick:()=>void r({chatId:e,filename:t}).then(e=>{e.applied===!1&&i.error(La())}).catch(()=>i.error(_o())),children:Ef()})]})}function Whe({chatId:e,filename:t,mimeType:n,sourceStorageId:r,initialText:i,hasDraft:a,onExit:o}){let s=Ns(L.documentDrafts.saveDraft),c=Ns(L.documentDrafts.deleteDraft),l=(0,z.useContext)(O1),u=VF(),d=`oc.docdraft.fallback.${e}.${t}`,[f,p]=(0,z.useState)(()=>{try{let e=localStorage.getItem(d);if(e!==null)return e}catch{}return i}),[m,h]=(0,z.useState)(`idle`),g=(0,z.useRef)(0),_=(0,z.useRef)(f);_.current=f;let v=(0,z.useRef)(!1),y=(0,z.useRef)(!1),b=(0,z.useCallback)(n=>{h(`saving`),s({chatId:e,filename:t,text:n,...r!==null&&(y.current||!a)?{sourceStorageId:r}:{}}).then(e=>{if(e.applied===!1){u.error(La()),h(`idle`);return}h(`saved`)}).catch(e=>{console.error(`[docviewer] draft save failed:`,e),u.error(Jp()),h(`idle`)})},[s,e,t,r,a,u]),x=e=>{y.current=!0,p(e),window.clearTimeout(g.current),g.current=window.setTimeout(()=>b(e),800)};return(0,z.useEffect)(()=>{try{localStorage.getItem(d)!==null&&(y.current=!0,s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>localStorage.removeItem(d)))}catch{}let n=()=>{if(!(!y.current||v.current))try{localStorage.setItem(d,_.current)}catch{}};return window.addEventListener(`pagehide`,n),()=>{if(window.removeEventListener(`pagehide`,n),window.clearTimeout(g.current),!v.current&&y.current){try{localStorage.setItem(d,_.current)}catch{}s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>{try{localStorage.removeItem(d)}catch{}}).catch(()=>{})}}},[]),(0,B.jsxs)(`div`,{className:`oc-docviewer__editor`,children:[(0,B.jsx)(`textarea`,{className:`oc-docviewer__editarea`,value:f,onChange:e=>x(e.target.value),spellCheck:!1,"aria-label":Gf()}),(0,B.jsxs)(`div`,{className:`oc-docviewer__editbar`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__savestate`,role:`status`,children:m===`saving`?Ks():m===`saved`?Uu():`\xA0`}),(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{v.current=!0,window.clearTimeout(g.current);try{localStorage.removeItem(d)}catch{}c({chatId:e,filename:t}).then(e=>{if(e.applied===!1){v.current=!1,u.error(La());return}o()}).catch(e=>{console.error(`[docviewer] draft discard failed:`,e),v.current=!1,u.error(_o())})},children:Ef()}),(0,B.jsx)(Lh,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{let e=l?.current??null;if(e===null){u.error(os());return}if(window.clearTimeout(g.current),b(f),e.canAttach){let r=(n??`text/plain`).split(`;`)[0].trim(),i=new File([f],t,{type:`${r}; charset=utf-8`});e.attachFile(i).catch(e=>{console.error(`[docviewer] attach failed:`,e),u.error(Ci())})}else{if(f.length>8e3){u.error(Vt());return}e.insertText(zhe(t,f,Jn()))}},children:vee()})]})]})}function Ghe({text:e,textTruncated:t,delimiter:n}){let r=(0,z.useMemo)(()=>Nhe(e,void 0,n),[e,n]),[i,a]=(0,z.useState)(null),o=(0,z.useMemo)(()=>i?[...r.rows].sort((e,t)=>Phe(e[i.col]??``,t[i.col]??``)*i.dir):r.rows,[r.rows,i]);if(r.header.length===0)return(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e});let s=r.header.slice(0,100),c=r.header.length>s.length;return(0,B.jsxs)(`div`,{className:`oc-docviewer__csvwrap`,children:[r.truncatedRows?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?qi({shown:r.rows.length}):Te({shown:r.rows.length,total:r.totalRows})}):null,c?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:ih({shown:s.length,total:r.header.length})}):null,(0,B.jsxs)(`table`,{className:`oc-docviewer__csv`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsx)(`tr`,{children:s.map((e,t)=>(0,B.jsx)(`th`,{children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__csvsort`,onClick:()=>a(e=>e?.col===t?e.dir===1?{col:t,dir:-1}:null:{col:t,dir:1}),"aria-label":ic({column:e}),children:[e,i?.col===t?i.dir===1?` ▲`:` ▼`:``]})},t))})}),(0,B.jsx)(`tbody`,{children:o.map((e,t)=>(0,B.jsx)(`tr`,{children:s.map((t,n)=>(0,B.jsx)(`td`,{children:e[n]??``},n))},t))})]})]})}function Khe({text:e,textTruncated:t}){let n=(0,z.useMemo)(()=>{let t=e.split(`
|
|
240
240
|
`);return t.length>1&&t[t.length-1]===``&&t.pop(),t},[e]),r=(0,z.useMemo)(()=>n.slice(0,Ahe),[n]);return(0,B.jsxs)(B.Fragment,{children:[n.length>r.length?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?zee({shown:r.length}):Kee({shown:r.length,total:n.length})}):null,(0,B.jsx)(`pre`,{className:`oc-docviewer__text oc-docviewer__logview`,children:r.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-logline oc-logline--${Fhe(e)}`,children:[e,`
|
|
241
|
-
`]},t))})]})}function qhe({text:e}){let t=(0,z.useMemo)(()=>{try{return{ok:!0,value:JSON.parse(e,(e,t,n)=>{if(typeof t==`number`&&Number.isInteger(t)&&!Number.isSafeInteger(t)&&typeof n?.source==`string`&&/^-?\d+$/.test(n.source))try{return BigInt(n.source)}catch{return t}return t})}}catch{return{ok:!1}}},[e]);return t.ok?(0,B.jsx)(`div`,{className:`oc-docviewer__jsonwrap`,children:(0,B.jsx)(L1,{value:t.value,depth:0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:_s()}),(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e})]})}function Jhe(e){if(Array.isArray(e))return e.length;let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Yhe(e,t){if(Array.isArray(e))return e.slice(0,t).map((e,t)=>[String(t),e]);let n=[];for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(n.length>=t)break;n.push([r,e[r]])}return n}function L1({value:e,depth:t,name:n}){let r=typeof e==`object`&&!!e,i=r?Jhe(e):0,[a,o]=(0,z.useState)(t<2&&i<=100),s=n===void 0?null:(0,B.jsxs)(`span`,{className:`oc-json__key`,children:[n,`: `]});if(!r)return(0,B.jsxs)(`div`,{className:`oc-json__leaf`,children:[s,(0,B.jsx)(`span`,{className:`oc-json__val oc-json__val--${e===null?`null`:typeof e==`bigint`?`number`:typeof e}`,children:typeof e==`bigint`?e.toString():JSON.stringify(e)})]});let c=a?Yhe(e,500):[];return(0,B.jsxs)(`details`,{className:`oc-json__node`,open:a,onToggle:e=>o(e.target.open),children:[(0,B.jsxs)(`summary`,{children:[s,(0,B.jsx)(`span`,{className:`oc-json__summary`,children:Array.isArray(e)?`[${i}]`:`{${i}}`})]}),a?(0,B.jsxs)(`div`,{className:`oc-json__children`,children:[c.map(([e,n])=>(0,B.jsx)(L1,{name:e,value:n,depth:t+1},e)),i>c.length?(0,B.jsx)(`div`,{className:`oc-json__more`,children:Jl({count:i-c.length})}):null]}):null]})}var R1=(0,z.createContext)(null);function Xhe(){return(0,z.useContext)(R1)??{open:()=>{}}}function z1({children:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useCallback)(e=>{n(e),i(!1)},[]),l=(0,z.useCallback)(()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),n(null),o(!1)},[]);(0,z.useEffect)(()=>{if(t===null)return;let e=e=>{e.key===`Escape`&&l()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,l]),(0,z.useEffect)(()=>{let e=()=>o(document.fullscreenElement!==null);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let u=(0,z.useCallback)(()=>{let e=s.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]);return(0,B.jsxs)(R1.Provider,{value:{open:c},children:[e,t===null?null:(0,Bv.createPortal)((0,B.jsxs)(`div`,{ref:s,className:`oc-lightbox`,role:`dialog`,"aria-modal":`true`,"aria-label":t.name,onClick:e=>{e.target===e.currentTarget&&l()},children:[(0,B.jsxs)(`div`,{className:`oc-lightbox__bar`,children:[(0,B.jsx)(`span`,{className:`oc-lightbox__name`,title:t.name,children:t.name}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:()=>i(e=>!e),"aria-label":r?Vd():jc(),title:r?Vd():jc(),children:r?(0,B.jsx)(Lb,{size:18}):(0,B.jsx)(Ib,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:u,"aria-label":a?Kf():am(),title:a?Kf():am(),children:a?(0,B.jsx)(Zy,{size:18}):(0,B.jsx)(Gy,{size:18})}),(0,B.jsx)(`a`,{className:`oc-lightbox__btn`,href:t.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":Js(),title:Js(),children:(0,B.jsx)(Cy,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:l,"aria-label":Gu(),title:Gu(),children:(0,B.jsx)(Sh,{size:18})})]}),(0,B.jsx)(`div`,{className:`oc-lightbox__stage${r?` oc-lightbox__stage--scroll`:``}`,onClick:e=>{e.target===e.currentTarget&&l()},children:(0,B.jsx)(`img`,{src:t.url,alt:t.name,className:r?`oc-lightbox__img--actual`:`oc-lightbox__img--fit`,decoding:`async`})})]}),document.body)]})}function B1({className:e,...t}){return(0,B.jsx)(SA,{"data-slot":`checkbox`,className:Pp(`peer size-4 shrink-0 rounded-[4px] border border-input bg-background ring-offset-background transition-shadow outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground`,e),...t,children:(0,B.jsx)(wA,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,B.jsx)(Qy,{className:`size-3.5`}):(0,B.jsx)(oy,{className:`size-3.5`})})})}function V1(e,t){return t===`memory`?`memory`:e.context===!0||!e.file_name?`context`:`document`}function H1(e){let t={memory:0,documents:0,context:0};for(let n of e)for(let e of n.items){let r=V1(e,n.group);r===`memory`?t.memory+=1:r===`document`?t.documents+=1:t.context+=1}return t}function Zhe(e){return e.memory+e.documents+e.context>0}function U1(e){let t=[];return e.memory>0&&t.push(e.memory===1?Tp():Wn({count:e.memory})),e.documents>0&&t.push(e.documents===1?Lt():uo({count:e.documents})),e.context>0&&t.push(e.context===1?he():ute({count:e.context})),t.join(` · `)}function W1(e){return e.title??e.file_name??e.id??e.type??mn()}function G1(e){return e.title&&e.file_name?e.file_name:void 0}function Qhe(e){return e.file_name??W1(e)}function K1(e){let t=[];return e.type&&W1(e)!==e.type&&t.push(e.type),e.date&&t.push(e.date),e.collection&&t.push(e.collection),typeof e.score==`number`&&t.push(ar({score:e.score.toFixed(2)})),t}function q1(e,t){let n=[];return e.forEach((e,r)=>{e.group===t&&e.items.forEach((t,i)=>{n.push({key:`${e.pluginId}|${e.group}|${t.id??t.file_name??`?`}|${r}.${i}`,group:e.group,pluginId:e.pluginId,source:e.source,item:t})})}),n.sort((e,t)=>(t.item.score??0)-(e.item.score??0))}function J1(e,t){let n=t.trim().toLowerCase();return n===``?!0:[Z1(e),e.item.file_name??``,e.item.text??``,...K1(e.item)].join(` `).toLowerCase().includes(n)}function Y1(e){return V1(e.item,e.group)===`document`}function X1(e){return V1(e.item,e.group)===`context`}function Z1(e){return X1(e)?Ii():W1(e.item)}var Q1=(0,z.createContext)(null),$he=[];function ege(){let e=U(e=>e.metadata?.custom?.provenanceParts??$he),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.attachedDocCount??0),r=(0,z.useContext)(Q1),i=H1(e);if(e.length===0||!Zhe(i))return null;let a=r?.activeMessageId===t&&t!==void 0,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-actrow__counts`,children:U1(i)}),n>0?(0,B.jsxs)(`span`,{className:`oc-actrow__badge`,title:Ge({count:n}),children:[(0,B.jsx)(by,{size:12,"aria-hidden":!0}),n]}):null]});return(0,B.jsx)(tI,{icon:(0,B.jsx)(Ey,{size:14}),label:Dn(),trailing:o,active:a,ariaExpanded:a,ariaHasPopup:!0,ariaLabel:oi(),onClick:()=>t&&r?.openFor(t)})}function $1({messageId:e,onClose:t}){let n=I(L.messages.getProvenanceParts,{messageId:e}),r=(0,z.useMemo)(()=>n??[],[n]),i=I(L.agents.documentaryAvailable,{}),a=I(L.documentAttachments.getDocumentAttachments,{sourceMessageId:e}),o=Ns(L.documentAttachments.attachDocuments),s=VF(),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of a??[])e.set(t.entryKey,t);return e},[a]),l=(a??[]).some(e=>e.status===`pending`),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(!1),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(new Set);(0,z.useEffect)(()=>{d(``),p(!1),h(!1),_(!1),y(new Set)},[e]);let b=(0,z.useMemo)(()=>q1(r,`documents`).filter(e=>Y1(e)&&J1(e,u)),[r,u]),x=(0,z.useMemo)(()=>q1(r,`documents`).filter(e=>X1(e)&&J1(e,u)),[r,u]),S=(0,z.useMemo)(()=>q1(r,`memory`).filter(e=>J1(e,u)),[r,u]),C=H1(r),w=e=>y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),T=(e,t)=>y(n=>{let r=new Set(n);for(let n of e)t?r.add(n):r.delete(n);return r}),E=(0,z.useMemo)(()=>q1(r,`documents`).filter(e=>Y1(e)&&v.has(e.key)),[r,v]),D=i!=null&&E.length>0&&!l;async function O(){if(D)try{await o({sourceMessageId:e,items:E.map(e=>({entryKey:e.key,reference:Qhe(e.item)}))}),s.success(Oe())}catch(e){let t=BF(e);t.includes(`fetch_in_flight`)?s.error(Wm()):t.includes(`no_documentary_agent`)?s.error(ma()):s.error(Xi(),e)}}let k=n===void 0;return(0,B.jsxs)(`div`,{className:`oc-sources-panel`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__head`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__heading`,children:[(0,B.jsx)(`h2`,{className:`oc-sources-panel__title`,children:bt()}),(0,B.jsx)(`p`,{className:`oc-sources-panel__sub`,children:U1(C)})]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,onClick:t,"aria-label":Ql(),title:Ql(),children:(0,B.jsx)(Sh,{size:16,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-sources-panel__search`,children:[(0,B.jsx)(hb,{size:15,"aria-hidden":!0}),(0,B.jsx)(yF,{value:u,onChange:e=>d(e.target.value),placeholder:Mr(),"aria-label":Mr()})]}),(0,B.jsx)(`div`,{className:`oc-sources-panel__body`,children:k?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:(0,B.jsx)(Hy,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(e0,{icon:(0,B.jsx)(Ey,{size:14,"aria-hidden":!0}),label:$t(),count:b.length,expanded:f,onToggle:()=>p(e=>!e),entries:b,selectable:!0,selected:v,onToggle1:w,onToggleAll:e=>T(b.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(e0,{icon:(0,B.jsx)(tb,{size:14,"aria-hidden":!0}),label:Ya(),count:x.length,expanded:m,onToggle:()=>h(e=>!e),entries:x,selectable:!1,selected:v,onToggle1:w,onToggleAll:e=>T(x.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(e0,{icon:(0,B.jsx)(iy,{size:14,"aria-hidden":!0}),label:ja(),count:S.length,expanded:g,onToggle:()=>_(e=>!e),entries:S,selectable:!1,selected:v,onToggle1:w,onToggleAll:e=>T(S.map(e=>e.key),e),attachmentByKey:c}),b.length===0&&x.length===0&&S.length===0?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:vr()}):null]})}),E.length>0?(0,B.jsxs)(`div`,{className:`oc-sources-panel__actions`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__actrow`,children:[(0,B.jsx)(`span`,{className:`oc-sources-panel__selcount`,children:te({count:E.length})}),(0,B.jsxs)(Lh,{variant:`outline`,size:`sm`,disabled:!D,onClick:()=>void O(),children:[l?(0,B.jsx)(Hy,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,B.jsx)(xb,{size:14,"aria-hidden":!0}),yd()]})]}),(0,B.jsx)(`p`,{className:`oc-sources-panel__acthint`,children:i==null?ma():l?Wm():Kr()})]}):null]})}function e0({icon:e,label:t,count:n,expanded:r,onToggle:i,entries:a,selectable:o,selected:s,onToggle1:c,onToggleAll:l,attachmentByKey:u}){if(n===0)return null;let d=a.every(e=>s.has(e.key));return(0,B.jsxs)(`section`,{className:`oc-srcsec${r?` is-open`:``}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-srcsec__head`,"aria-expanded":r,onClick:i,children:[r?(0,B.jsx)(sy,{size:14,"aria-hidden":!0}):(0,B.jsx)(ly,{size:14,"aria-hidden":!0}),e,(0,B.jsx)(`span`,{className:`oc-srcsec__label`,children:t}),(0,B.jsx)(`span`,{className:`oc-srcsec__count`,children:n})]}),r?(0,B.jsxs)(`div`,{className:`oc-srcsec__body`,children:[o?(0,B.jsxs)(`label`,{className:`oc-srcsec__all`,children:[(0,B.jsx)(B1,{checked:d,onCheckedChange:e=>l(e===!0)}),(0,B.jsx)(`span`,{children:nd()})]}):null,a.map(e=>(0,B.jsx)(tge,{entry:e,selectable:o,selected:s.has(e.key),onToggle:()=>c(e.key),attachment:u.get(e.key)},e.key))]}):null]})}function tge({entry:e,selectable:t,selected:n,onToggle:r,attachment:i}){let[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(!1),{item:u}=e;(0,z.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight+1);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[u.text]);let d=K1(u),f=typeof u.score==`number`?Math.max(0,Math.min(1,u.score)):null,p=Y1(e);return(0,B.jsxs)(`div`,{className:`oc-srccard${t&&n?` is-selected`:``}`,children:[t?(0,B.jsx)(`label`,{className:`oc-srccard__pick`,children:(0,B.jsx)(B1,{checked:n,onCheckedChange:r})}):null,(0,B.jsxs)(`div`,{className:`oc-srccard__body`,children:[(0,B.jsx)(`div`,{className:`oc-srccard__title`,children:Z1(e)}),p&&G1(e.item)?(0,B.jsx)(`div`,{className:`oc-srccard__subid`,title:G1(e.item),children:G1(e.item)}):null,d.length>0||f!==null?(0,B.jsxs)(`div`,{className:`oc-srccard__meta`,children:[d.map(e=>(0,B.jsx)(`span`,{className:`oc-srccard__chip`,children:e},e)),f===null?null:(0,B.jsx)(`span`,{className:`oc-srccard__relev`,title:ar({score:f.toFixed(2)}),children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-track`,"aria-hidden":!0,children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-fill`,style:{width:`${Math.round(f*100)}%`}})})})]}):null,u.text?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`blockquote`,{ref:s,className:`oc-srccard__excerpt${a?` is-full`:``}`,children:u.text}),c||a?(0,B.jsx)(`button`,{type:`button`,className:`oc-srccard__more`,onClick:()=>o(e=>!e),children:a?xs():Tm()}):null]}):null,p?(0,B.jsx)(nge,{attachment:i}):null]})]})}function nge({attachment:e}){if(e?.status===`ready`&&e.url){let t=e.filename??cc();return(0,B.jsxs)(`a`,{className:`oc-srccard__origin oc-srccard__origin--ready`,href:e.url,download:e.filename??void 0,target:`_blank`,rel:`noreferrer`,title:cc(),children:[(0,B.jsx)(by,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-srccard__origin-name`,children:t})]})}return e?.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--pending`,children:[(0,B.jsx)(Hy,{size:13,"aria-hidden":!0}),ch()]}):e?.status===`not_found`||e?.status===`failed`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--missing`,"aria-disabled":!0,children:[(0,B.jsx)(Sh,{size:13,"aria-hidden":!0}),Yee()]}):(0,B.jsxs)(`div`,{className:`oc-srccard__origin`,"aria-disabled":!0,children:[(0,B.jsx)(by,{size:13,"aria-hidden":!0}),st()]})}function t0(e,t){return new Date(e).toLocaleString(T(),t)}function rge(e){return new Date(e).toLocaleDateString(T())}function n0(e){return new Date(e).toLocaleTimeString(T())}function ige(e){return e.toLocaleString(T())}function r0(e){if(!Number.isFinite(e)||e<0)return null;if(e<1e3)return`< 1 s`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r===0?`${n} min`:`${n} min ${String(r).padStart(2,`0`)} s`;let i=Math.floor(n/60),a=n%60;return a===0?`${i} h`:`${i} h ${String(a).padStart(2,`0`)} min`}var age=new Set([`status`,`exitCode`,`durationMs`]);function oge(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function sge(e){if(typeof e==`string`)return{kind:`text`,text:e};if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e,n=Object.keys(t);if(typeof t.exitCode==`number`&&n.every(e=>age.has(e)))return{kind:`outcome`,status:typeof t.status==`string`?t.status:null,exitCode:t.exitCode,durationMs:typeof t.durationMs==`number`?t.durationMs:null}}return{kind:`json`,text:oge(e)}}function cge(e){let t=[(e.exitCode===null?e.status===`completed`:e.exitCode===0)?oa():Im()];return e.exitCode!==null&&t.push(xe({code:e.exitCode})),e.durationMs!==null&&t.push(Hi({ms:e.durationMs})),t.join(` · `)}var lge=new Set([`complete`,`error`,`aborted`]),uge=new Set([`completed`,`error`]);function dge(e,t){if(e.length===0)return!1;if(t===`streaming`)return!0;if(t!==void 0&&lge.has(t))return!1;let n=e[e.length-1];return n.phase!==void 0&&uge.has(n.phase)?!1:n.result===void 0||n.result===null}var fge=[`command`,`query`,`url`,`path`,`pattern`,`file`,`cmd`,`prompt`];function pge(e,t){let n=``;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of fge){let r=t[e];if(typeof r==`string`&&r.trim()){n=r;break}}}return n||=t??(typeof e==`string`?e:``),n.replace(/\s+/g,` `).trim()}function mge(e,t){let n=e.length,r=n===1?Le({count:n}):$e({count:n});return{count:n,running:dge(e,t),label:r}}function i0({text:e}){let[t,n]=(0,z.useState)(!1);return(0,B.jsx)(`button`,{type:`button`,className:`oc-copybtn`,title:dn(),"aria-label":_t(),onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{n(!0),window.setTimeout(()=>n(!1),1200)})},children:t?(0,B.jsx)(oy,{size:13,"aria-hidden":!0}):(0,B.jsx)(gy,{size:13,"aria-hidden":!0})})}function hge(e,t,n){let r=typeof e==`string`?e:void 0;return r===`error`?`error`:t||r===`completed`||n?`completed`:`running`}function gge(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function a0({toolName:e,args:t,argsText:n,result:r,status:i,turnSettled:a}){let o=r!=null,s=hge(i?.type,o,a),c=n??gge(t),l=pge(t,n),u=o?sge(r):null,d=s===`running`?Hy:s===`error`?dy:cre;return(0,B.jsxs)(`details`,{className:`oc-tool oc-tool--${s}`,children:[(0,B.jsxs)(`summary`,{className:`oc-tool__header`,children:[(0,B.jsx)(d,{className:`oc-tool__status${s===`running`?` oc-tool__status--spin`:``}`,size:14,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-tool__name`,children:e}),l?(0,B.jsx)(`span`,{className:`oc-tool__preview`,title:l,children:l}):null,(0,B.jsx)(`span`,{className:`oc-tool__phase`,children:s}),(0,B.jsx)(ly,{size:15,className:`oc-tool__chevron`,"aria-hidden":!0})]}),(0,B.jsxs)(`div`,{className:`oc-tool__body`,children:[c?(0,B.jsxs)(`details`,{className:`oc-tool__io`,children:[(0,B.jsx)(`summary`,{children:`input`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:c}),(0,B.jsx)(i0,{text:c})]})]}):null,u&&u.kind===`outcome`?(0,B.jsxs)(`div`,{className:`oc-tool__outcome`,children:[(0,B.jsx)(`span`,{className:`oc-tool__outcome-label`,children:cge(u)}),(0,B.jsx)(`span`,{className:`oc-tool__outcome-note`,children:$m()})]}):u?(0,B.jsxs)(`details`,{className:`oc-tool__io`,open:!0,children:[(0,B.jsx)(`summary`,{children:`output`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:u.text}),(0,B.jsx)(i0,{text:u.text})]})]}):null]})]})}function o0({...e}){return(0,B.jsx)(Eh,{"data-slot":`dialog`,...e})}function _ge({...e}){return(0,B.jsx)(Ch,{"data-slot":`dialog-portal`,...e})}function vge({className:e,...t}){return(0,B.jsx)(wh,{"data-slot":`dialog-overlay`,className:Pp(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function s0({className:e,children:t,showCloseButton:n=!0,...r}){return(0,B.jsxs)(_ge,{children:[(0,B.jsx)(vge,{}),(0,B.jsxs)(Th,{"data-slot":`dialog-content`,className:Pp(`fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover bg-clip-padding p-5 text-sm text-popover-foreground shadow-lg duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,B.jsx)(kh,{"data-slot":`dialog-close`,asChild:!0,children:(0,B.jsxs)(Lh,{variant:`ghost`,size:`icon-sm`,className:`absolute top-3 right-3`,children:[(0,B.jsx)(Sh,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:xh()})]})})]})]})}function c0({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:Pp(`flex flex-col gap-1.5 pr-6`,e),...t})}function l0({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-footer`,className:Pp(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function u0({className:e,...t}){return(0,B.jsx)(Oh,{"data-slot":`dialog-title`,className:Pp(`text-base font-medium text-foreground`,e),...t})}function d0({className:e,...t}){return(0,B.jsx)(Dh,{"data-slot":`dialog-description`,className:Pp(`text-sm text-muted-foreground`,e),...t})}function f0(e){return(0,B.jsx)(EM,{"data-slot":`select`,...e})}function p0(e){return(0,B.jsx)(AM,{"data-slot":`select-value`,...e})}function m0({className:e,size:t=`default`,children:n,...r}){return(0,B.jsxs)(OM,{"data-slot":`select-trigger`,"data-size":t,className:Pp(`flex w-fit items-center justify-between gap-2 rounded-lg border border-input bg-background px-2.5 py-1 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,B.jsx)(jM,{asChild:!0,children:(0,B.jsx)(sy,{className:`size-4 opacity-50`})})]})}function h0({className:e,children:t,position:n=`popper`,...r}){return(0,B.jsx)(NM,{children:(0,B.jsxs)(FM,{"data-slot":`select-content`,className:Pp(`relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,B.jsx)(nN,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(uy,{className:`size-4`})}),(0,B.jsx)(GM,{className:Pp(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,B.jsx)(iN,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(sy,{className:`size-4`})})]})})}function g0({className:e,children:t,...n}){return(0,B.jsxs)(XM,{"data-slot":`select-item`,className:Pp(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(eN,{children:(0,B.jsx)(oy,{className:`size-4`})})}),(0,B.jsx)(QM,{children:t})]})}var _0=1e3;function yge(){return[{id:`hung`,label:Dee()},{id:`wrong_result`,label:Rd()},{id:`error`,label:Oc()},{id:`other`,label:cee()}]}function bge({target:e,onClose:t}){let n=Ns(L.subAgentReports.createSubAgentReport),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1);(0,z.useEffect)(()=>{e&&(i(``),o(``),c(!1),u(!1))},[e]);function d(e){e||t()}async function f(){if(!(!e||s)){c(!0);try{await n({subAgentId:e.subAgentId,category:r||void 0,comment:a.trim()||void 0}),u(!0)}catch{c(!1)}}}return(0,B.jsx)(o0,{open:e!==null,onOpenChange:d,children:e?(0,B.jsxs)(s0,{className:`sm:max-w-md`,children:[(0,B.jsxs)(c0,{children:[(0,B.jsx)(u0,{children:eu()}),(0,B.jsx)(d0,{children:l?rf():bu({label:e.label})})]}),l?(0,B.jsx)(`div`,{className:`oc-feedback__result`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-ok`,children:cp()})}):(0,B.jsxs)(`div`,{className:`oc-feedback__form`,children:[(0,B.jsx)(`label`,{className:`oc-feedback__label`,children:Ml()}),(0,B.jsxs)(f0,{value:r,onValueChange:i,children:[(0,B.jsx)(m0,{children:(0,B.jsx)(p0,{placeholder:qc()})}),(0,B.jsx)(h0,{children:yge().map(e=>(0,B.jsx)(g0,{value:e.id,children:e.label},e.id))})]}),(0,B.jsx)(`label`,{className:`oc-feedback__label`,htmlFor:`oc-subagentreport-comment`,children:Wf()}),(0,B.jsx)(`textarea`,{id:`oc-subagentreport-comment`,className:`oc-feedback__textarea`,placeholder:Gs(),value:a,maxLength:_0,onChange:e=>o(e.target.value.slice(0,_0)),rows:4}),(0,B.jsxs)(`div`,{className:`oc-feedback__count`,children:[a.length,`/`,_0]})]}),(0,B.jsx)(l0,{children:l?(0,B.jsx)(Lh,{onClick:()=>d(!1),children:_ee()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Lh,{variant:`outline`,onClick:()=>d(!1),children:Hu()}),(0,B.jsx)(Lh,{onClick:()=>void f(),disabled:s,children:s?Tf():qp()})]})})]}):null})}function xge(e,t=`md`){let n=(e??``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40);return`sous-agent${n?`-${n}`:``}.${t}`}function Sge(e){return JSON.stringify({kind:`sub-agent`,taskName:e.taskName??null,status:e.status,exportedAt:new Date(e.exportedAt).toISOString(),parentAgent:e.parentAgentLabel??null,config:e.sessionMeta??null,telemetry:e.telemetry??null,tools:e.tools.map(e=>({name:e.name,status:e.status,input:e.argsText??null,output:e.resultText??null})),result:e.result??null,error:e.error??null},null,2)}function Cge(e){let t=[],n=e.taskName?.trim()||dr();t.push(`# ${dr()} — ${n}`,``);let r=[];e.parentAgentLabel&&r.push(`- ${uf()} : ${e.parentAgentLabel}`);let i=e.sessionMeta;if(i?.model&&r.push(`- ${Fe()} : ${i.model}${i.modelProvider?` (${i.modelProvider})`:``}`),i?.thinkingLevel&&r.push(`- ${hh()} : ${i.thinkingLevel}`),i?.fastMode!==void 0&&r.push(`- ${hc()} : ${i.fastMode?yh():Mm()}`),i?.controlScope&&r.push(`- ${ks()} : ${i.controlScope}`),i?.subagentRole&&r.push(`- ${ou()} : ${i.subagentRole}`),i?.spawnDepth!==void 0&&r.push(`- ${Eu()} : ${i.spawnDepth}`),r.length&&t.push(...r,``),e.tools.length>0){t.push(`## ${Lr()} (${e.tools.length})`,``);for(let n of e.tools)t.push(`### ${n.name} — ${n.status}`,``),n.argsText&&t.push(`**Input**`,``,"```",n.argsText,"```",``),n.resultText&&t.push(`**Output**`,``,"```",n.resultText,"```",``)}return e.error&&t.push(`## ${wr()}`,``,e.error,``),e.result&&t.push(`## ${cd()}`,``,e.result,``),`${t.join(`
|
|
241
|
+
`]},t))})]})}function qhe({text:e}){let t=(0,z.useMemo)(()=>{try{return{ok:!0,value:JSON.parse(e,(e,t,n)=>{if(typeof t==`number`&&Number.isInteger(t)&&!Number.isSafeInteger(t)&&typeof n?.source==`string`&&/^-?\d+$/.test(n.source))try{return BigInt(n.source)}catch{return t}return t})}}catch{return{ok:!1}}},[e]);return t.ok?(0,B.jsx)(`div`,{className:`oc-docviewer__jsonwrap`,children:(0,B.jsx)(L1,{value:t.value,depth:0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:_s()}),(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e})]})}function Jhe(e){if(Array.isArray(e))return e.length;let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Yhe(e,t){if(Array.isArray(e))return e.slice(0,t).map((e,t)=>[String(t),e]);let n=[];for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(n.length>=t)break;n.push([r,e[r]])}return n}function L1({value:e,depth:t,name:n}){let r=typeof e==`object`&&!!e,i=r?Jhe(e):0,[a,o]=(0,z.useState)(t<2&&i<=100),s=n===void 0?null:(0,B.jsxs)(`span`,{className:`oc-json__key`,children:[n,`: `]});if(!r)return(0,B.jsxs)(`div`,{className:`oc-json__leaf`,children:[s,(0,B.jsx)(`span`,{className:`oc-json__val oc-json__val--${e===null?`null`:typeof e==`bigint`?`number`:typeof e}`,children:typeof e==`bigint`?e.toString():JSON.stringify(e)})]});let c=a?Yhe(e,500):[];return(0,B.jsxs)(`details`,{className:`oc-json__node`,open:a,onToggle:e=>o(e.target.open),children:[(0,B.jsxs)(`summary`,{children:[s,(0,B.jsx)(`span`,{className:`oc-json__summary`,children:Array.isArray(e)?`[${i}]`:`{${i}}`})]}),a?(0,B.jsxs)(`div`,{className:`oc-json__children`,children:[c.map(([e,n])=>(0,B.jsx)(L1,{name:e,value:n,depth:t+1},e)),i>c.length?(0,B.jsx)(`div`,{className:`oc-json__more`,children:Jl({count:i-c.length})}):null]}):null]})}var R1=(0,z.createContext)(null);function Xhe(){return(0,z.useContext)(R1)??{open:()=>{}}}function z1({children:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useCallback)(e=>{n(e),i(!1)},[]),l=(0,z.useCallback)(()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),n(null),o(!1)},[]);(0,z.useEffect)(()=>{if(t===null)return;let e=e=>{e.key===`Escape`&&l()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,l]),(0,z.useEffect)(()=>{let e=()=>o(document.fullscreenElement!==null);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let u=(0,z.useCallback)(()=>{let e=s.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]);return(0,B.jsxs)(R1.Provider,{value:{open:c},children:[e,t===null?null:(0,Bv.createPortal)((0,B.jsxs)(`div`,{ref:s,className:`oc-lightbox`,role:`dialog`,"aria-modal":`true`,"aria-label":t.name,onClick:e=>{e.target===e.currentTarget&&l()},children:[(0,B.jsxs)(`div`,{className:`oc-lightbox__bar`,children:[(0,B.jsx)(`span`,{className:`oc-lightbox__name`,title:t.name,children:t.name}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:()=>i(e=>!e),"aria-label":r?Vd():jc(),title:r?Vd():jc(),children:r?(0,B.jsx)(Lb,{size:18}):(0,B.jsx)(Ib,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:u,"aria-label":a?Kf():am(),title:a?Kf():am(),children:a?(0,B.jsx)(Zy,{size:18}):(0,B.jsx)(Gy,{size:18})}),(0,B.jsx)(`a`,{className:`oc-lightbox__btn`,href:t.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":Js(),title:Js(),children:(0,B.jsx)(Cy,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:l,"aria-label":Gu(),title:Gu(),children:(0,B.jsx)(Sh,{size:18})})]}),(0,B.jsx)(`div`,{className:`oc-lightbox__stage${r?` oc-lightbox__stage--scroll`:``}`,onClick:e=>{e.target===e.currentTarget&&l()},children:(0,B.jsx)(`img`,{src:t.url,alt:t.name,className:r?`oc-lightbox__img--actual`:`oc-lightbox__img--fit`,decoding:`async`})})]}),document.body)]})}function B1({className:e,...t}){return(0,B.jsx)(SA,{"data-slot":`checkbox`,className:Pp(`peer size-4 shrink-0 rounded-[4px] border border-input bg-background ring-offset-background transition-shadow outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground`,e),...t,children:(0,B.jsx)(wA,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,B.jsx)(Qy,{className:`size-3.5`}):(0,B.jsx)(oy,{className:`size-3.5`})})})}function V1(e,t){return t===`memory`?`memory`:e.context===!0||!e.file_name?`context`:`document`}function H1(e){let t={memory:0,documents:0,context:0};for(let n of e)for(let e of n.items){let r=V1(e,n.group);r===`memory`?t.memory+=1:r===`document`?t.documents+=1:t.context+=1}return t}function Zhe(e){return e.memory+e.documents+e.context>0}function U1(e){let t=[];return e.memory>0&&t.push(e.memory===1?Tp():Wn({count:e.memory})),e.documents>0&&t.push(e.documents===1?Lt():uo({count:e.documents})),e.context>0&&t.push(e.context===1?he():ute({count:e.context})),t.join(` · `)}function W1(e){return e.title??e.file_name??e.id??e.type??mn()}function G1(e){return e.title&&e.file_name?e.file_name:void 0}function Qhe(e){return e.file_name??W1(e)}function K1(e){let t=[];return e.type&&W1(e)!==e.type&&t.push(e.type),e.date&&t.push(e.date),e.collection&&t.push(e.collection),typeof e.score==`number`&&t.push(ar({score:e.score.toFixed(2)})),t}function q1(e,t){let n=[];return e.forEach((e,r)=>{e.group===t&&e.items.forEach((t,i)=>{n.push({key:`${e.pluginId}|${e.group}|${t.id??t.file_name??`?`}|${r}.${i}`,group:e.group,pluginId:e.pluginId,source:e.source,item:t})})}),n.sort((e,t)=>(t.item.score??0)-(e.item.score??0))}function J1(e,t){let n=t.trim().toLowerCase();return n===``?!0:[Z1(e),e.item.file_name??``,e.item.text??``,...K1(e.item)].join(` `).toLowerCase().includes(n)}function Y1(e){return V1(e.item,e.group)===`document`}function X1(e){return V1(e.item,e.group)===`context`}function Z1(e){return X1(e)?Ii():W1(e.item)}var Q1=(0,z.createContext)(null),$he=[];function ege(){let e=U(e=>e.metadata?.custom?.provenanceParts??$he),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.attachedDocCount??0),r=(0,z.useContext)(Q1),i=H1(e);if(e.length===0||!Zhe(i))return null;let a=r?.activeMessageId===t&&t!==void 0,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-actrow__counts`,children:U1(i)}),n>0?(0,B.jsxs)(`span`,{className:`oc-actrow__badge`,title:Ge({count:n}),children:[(0,B.jsx)(by,{size:12,"aria-hidden":!0}),n]}):null]});return(0,B.jsx)(tI,{icon:(0,B.jsx)(Ey,{size:14}),label:Dn(),trailing:o,active:a,ariaExpanded:a,ariaHasPopup:!0,ariaLabel:oi(),onClick:()=>t&&r?.openFor(t)})}function $1({messageId:e,onClose:t}){let n=I(L.messages.getProvenanceParts,{messageId:e}),r=(0,z.useMemo)(()=>n??[],[n]),i=I(L.agents.documentaryAvailable,{}),a=I(L.documentAttachments.getDocumentAttachments,{sourceMessageId:e}),o=Ns(L.documentAttachments.attachDocuments),s=VF(),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of a??[])e.set(t.entryKey,t);return e},[a]),l=(a??[]).some(e=>e.status===`pending`),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(!1),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(new Set);(0,z.useEffect)(()=>{d(``),p(!1),h(!1),_(!1),y(new Set)},[e]);let b=(0,z.useMemo)(()=>q1(r,`documents`).filter(e=>Y1(e)&&J1(e,u)),[r,u]),x=(0,z.useMemo)(()=>q1(r,`documents`).filter(e=>X1(e)&&J1(e,u)),[r,u]),S=(0,z.useMemo)(()=>q1(r,`memory`).filter(e=>J1(e,u)),[r,u]),C=H1(r),w=e=>y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),T=(e,t)=>y(n=>{let r=new Set(n);for(let n of e)t?r.add(n):r.delete(n);return r}),E=(0,z.useMemo)(()=>q1(r,`documents`).filter(e=>Y1(e)&&v.has(e.key)),[r,v]),D=i!=null&&E.length>0&&!l;async function O(){if(D)try{await o({sourceMessageId:e,items:E.map(e=>({entryKey:e.key,reference:Qhe(e.item)}))}),s.success(Oe())}catch(e){let t=BF(e);t.includes(`fetch_in_flight`)?s.error(Wm()):t.includes(`no_documentary_agent`)?s.error(ma()):s.error(Xi(),e)}}let k=n===void 0;return(0,B.jsxs)(`div`,{className:`oc-sources-panel`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__head`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__heading`,children:[(0,B.jsx)(`h2`,{className:`oc-sources-panel__title`,children:bt()}),(0,B.jsx)(`p`,{className:`oc-sources-panel__sub`,children:U1(C)})]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,onClick:t,"aria-label":Ql(),title:Ql(),children:(0,B.jsx)(Sh,{size:16,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-sources-panel__search`,children:[(0,B.jsx)(hb,{size:15,"aria-hidden":!0}),(0,B.jsx)(yF,{value:u,onChange:e=>d(e.target.value),placeholder:Mr(),"aria-label":Mr()})]}),(0,B.jsx)(`div`,{className:`oc-sources-panel__body`,children:k?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:(0,B.jsx)(Hy,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(e0,{icon:(0,B.jsx)(Ey,{size:14,"aria-hidden":!0}),label:$t(),count:b.length,expanded:f,onToggle:()=>p(e=>!e),entries:b,selectable:!0,selected:v,onToggle1:w,onToggleAll:e=>T(b.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(e0,{icon:(0,B.jsx)(tb,{size:14,"aria-hidden":!0}),label:Ya(),count:x.length,expanded:m,onToggle:()=>h(e=>!e),entries:x,selectable:!1,selected:v,onToggle1:w,onToggleAll:e=>T(x.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(e0,{icon:(0,B.jsx)(iy,{size:14,"aria-hidden":!0}),label:ja(),count:S.length,expanded:g,onToggle:()=>_(e=>!e),entries:S,selectable:!1,selected:v,onToggle1:w,onToggleAll:e=>T(S.map(e=>e.key),e),attachmentByKey:c}),b.length===0&&x.length===0&&S.length===0?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:vr()}):null]})}),E.length>0?(0,B.jsxs)(`div`,{className:`oc-sources-panel__actions`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__actrow`,children:[(0,B.jsx)(`span`,{className:`oc-sources-panel__selcount`,children:te({count:E.length})}),(0,B.jsxs)(Lh,{variant:`outline`,size:`sm`,disabled:!D,onClick:()=>void O(),children:[l?(0,B.jsx)(Hy,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,B.jsx)(xb,{size:14,"aria-hidden":!0}),yd()]})]}),(0,B.jsx)(`p`,{className:`oc-sources-panel__acthint`,children:i==null?ma():l?Wm():Kr()})]}):null]})}function e0({icon:e,label:t,count:n,expanded:r,onToggle:i,entries:a,selectable:o,selected:s,onToggle1:c,onToggleAll:l,attachmentByKey:u}){if(n===0)return null;let d=a.every(e=>s.has(e.key));return(0,B.jsxs)(`section`,{className:`oc-srcsec${r?` is-open`:``}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-srcsec__head`,"aria-expanded":r,onClick:i,children:[r?(0,B.jsx)(sy,{size:14,"aria-hidden":!0}):(0,B.jsx)(ly,{size:14,"aria-hidden":!0}),e,(0,B.jsx)(`span`,{className:`oc-srcsec__label`,children:t}),(0,B.jsx)(`span`,{className:`oc-srcsec__count`,children:n})]}),r?(0,B.jsxs)(`div`,{className:`oc-srcsec__body`,children:[o?(0,B.jsxs)(`label`,{className:`oc-srcsec__all`,children:[(0,B.jsx)(B1,{checked:d,onCheckedChange:e=>l(e===!0)}),(0,B.jsx)(`span`,{children:nd()})]}):null,a.map(e=>(0,B.jsx)(tge,{entry:e,selectable:o,selected:s.has(e.key),onToggle:()=>c(e.key),attachment:u.get(e.key)},e.key))]}):null]})}function tge({entry:e,selectable:t,selected:n,onToggle:r,attachment:i}){let[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(!1),{item:u}=e;(0,z.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight+1);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[u.text]);let d=K1(u),f=typeof u.score==`number`?Math.max(0,Math.min(1,u.score)):null,p=Y1(e);return(0,B.jsxs)(`div`,{className:`oc-srccard${t&&n?` is-selected`:``}`,children:[t?(0,B.jsx)(`label`,{className:`oc-srccard__pick`,children:(0,B.jsx)(B1,{checked:n,onCheckedChange:r})}):null,(0,B.jsxs)(`div`,{className:`oc-srccard__body`,children:[(0,B.jsx)(`div`,{className:`oc-srccard__title`,children:Z1(e)}),p&&G1(e.item)?(0,B.jsx)(`div`,{className:`oc-srccard__subid`,title:G1(e.item),children:G1(e.item)}):null,d.length>0||f!==null?(0,B.jsxs)(`div`,{className:`oc-srccard__meta`,children:[d.map(e=>(0,B.jsx)(`span`,{className:`oc-srccard__chip`,children:e},e)),f===null?null:(0,B.jsx)(`span`,{className:`oc-srccard__relev`,title:ar({score:f.toFixed(2)}),children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-track`,"aria-hidden":!0,children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-fill`,style:{width:`${Math.round(f*100)}%`}})})})]}):null,u.text?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`blockquote`,{ref:s,className:`oc-srccard__excerpt${a?` is-full`:``}`,children:u.text}),c||a?(0,B.jsx)(`button`,{type:`button`,className:`oc-srccard__more`,onClick:()=>o(e=>!e),children:a?xs():Tm()}):null]}):null,p?(0,B.jsx)(nge,{attachment:i}):null]})]})}function nge({attachment:e}){if(e?.status===`ready`&&e.url){let t=e.filename??cc();return(0,B.jsxs)(`a`,{className:`oc-srccard__origin oc-srccard__origin--ready`,href:e.url,download:e.filename??void 0,target:`_blank`,rel:`noreferrer`,title:cc(),children:[(0,B.jsx)(by,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-srccard__origin-name`,children:t})]})}return e?.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--pending`,children:[(0,B.jsx)(Hy,{size:13,"aria-hidden":!0}),ch()]}):e?.status===`not_found`||e?.status===`failed`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--missing`,"aria-disabled":!0,children:[(0,B.jsx)(Sh,{size:13,"aria-hidden":!0}),Yee()]}):(0,B.jsxs)(`div`,{className:`oc-srccard__origin`,"aria-disabled":!0,children:[(0,B.jsx)(by,{size:13,"aria-hidden":!0}),st()]})}function t0(e,t){return new Date(e).toLocaleString(T(),t)}function rge(e){return new Date(e).toLocaleDateString(T())}function n0(e){return new Date(e).toLocaleTimeString(T())}function ige(e){return e.toLocaleString(T())}function r0(e){if(!Number.isFinite(e)||e<0)return null;if(e<1e3)return`< 1 s`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r===0?`${n} min`:`${n} min ${String(r).padStart(2,`0`)} s`;let i=Math.floor(n/60),a=n%60;return a===0?`${i} h`:`${i} h ${String(a).padStart(2,`0`)} min`}var age=new Set([`status`,`exitCode`,`durationMs`]);function oge(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function sge(e){if(typeof e==`string`)return{kind:`text`,text:e};if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e,n=Object.keys(t);if(typeof t.exitCode==`number`&&n.every(e=>age.has(e)))return{kind:`outcome`,status:typeof t.status==`string`?t.status:null,exitCode:t.exitCode,durationMs:typeof t.durationMs==`number`?t.durationMs:null}}return{kind:`json`,text:oge(e)}}function cge(e){let t=[(e.exitCode===null?e.status===`completed`:e.exitCode===0)?oa():Im()];return e.exitCode!==null&&t.push(xe({code:e.exitCode})),e.durationMs!==null&&t.push(Hi({ms:e.durationMs})),t.join(` · `)}var lge=new Set([`complete`,`error`,`aborted`]),uge=new Set([`completed`,`error`]);function dge(e,t){if(e.length===0)return!1;if(t===`streaming`)return!0;if(t!==void 0&&lge.has(t))return!1;let n=e[e.length-1];return n.phase!==void 0&&uge.has(n.phase)?!1:n.result===void 0||n.result===null}var fge=[`command`,`query`,`url`,`path`,`pattern`,`file`,`cmd`,`prompt`];function pge(e,t){let n=``;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of fge){let r=t[e];if(typeof r==`string`&&r.trim()){n=r;break}}}return n||=t??(typeof e==`string`?e:``),n.replace(/\s+/g,` `).trim()}function mge(e,t){let n=e.length,r=n===1?Le({count:n}):$e({count:n});return{count:n,running:dge(e,t),label:r}}function i0({text:e}){let[t,n]=(0,z.useState)(!1);return(0,B.jsx)(`button`,{type:`button`,className:`oc-copybtn`,title:dn(),"aria-label":_t(),onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{n(!0),window.setTimeout(()=>n(!1),1200)})},children:t?(0,B.jsx)(oy,{size:13,"aria-hidden":!0}):(0,B.jsx)(gy,{size:13,"aria-hidden":!0})})}function hge(e,t,n){let r=typeof e==`string`?e:void 0;return r===`error`?`error`:t||r===`completed`||n?`completed`:`running`}function gge(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function a0({toolName:e,args:t,argsText:n,result:r,status:i,turnSettled:a}){let o=r!=null,s=hge(i?.type,o,a),c=n??gge(t),l=pge(t,n),u=o?sge(r):null,d=s===`running`?Hy:s===`error`?dy:cre;return(0,B.jsxs)(`details`,{className:`oc-tool oc-tool--${s}`,children:[(0,B.jsxs)(`summary`,{className:`oc-tool__header`,children:[(0,B.jsx)(d,{className:`oc-tool__status${s===`running`?` oc-tool__status--spin`:``}`,size:14,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-tool__name`,children:e}),l?(0,B.jsx)(`span`,{className:`oc-tool__preview`,title:l,children:l}):null,(0,B.jsx)(`span`,{className:`oc-tool__phase`,children:s}),(0,B.jsx)(ly,{size:15,className:`oc-tool__chevron`,"aria-hidden":!0})]}),(0,B.jsxs)(`div`,{className:`oc-tool__body`,children:[c?(0,B.jsxs)(`details`,{className:`oc-tool__io`,children:[(0,B.jsx)(`summary`,{children:`input`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:c}),(0,B.jsx)(i0,{text:c})]})]}):null,u&&u.kind===`outcome`?(0,B.jsxs)(`div`,{className:`oc-tool__outcome`,children:[(0,B.jsx)(`span`,{className:`oc-tool__outcome-label`,children:cge(u)}),(0,B.jsx)(`span`,{className:`oc-tool__outcome-note`,children:$m()})]}):u?(0,B.jsxs)(`details`,{className:`oc-tool__io`,open:!0,children:[(0,B.jsx)(`summary`,{children:`output`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:u.text}),(0,B.jsx)(i0,{text:u.text})]})]}):null]})]})}function o0({...e}){return(0,B.jsx)(Eh,{"data-slot":`dialog`,...e})}function _ge({...e}){return(0,B.jsx)(Ch,{"data-slot":`dialog-portal`,...e})}function vge({className:e,...t}){return(0,B.jsx)(wh,{"data-slot":`dialog-overlay`,className:Pp(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function s0({className:e,children:t,showCloseButton:n=!0,...r}){return(0,B.jsxs)(_ge,{children:[(0,B.jsx)(vge,{}),(0,B.jsxs)(Th,{"data-slot":`dialog-content`,className:Pp(`fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover bg-clip-padding p-5 text-sm text-popover-foreground shadow-lg duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,B.jsx)(kh,{"data-slot":`dialog-close`,asChild:!0,children:(0,B.jsxs)(Lh,{variant:`ghost`,size:`icon-sm`,className:`absolute top-3 right-3`,children:[(0,B.jsx)(Sh,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:xh()})]})})]})]})}function c0({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:Pp(`flex flex-col gap-1.5 pr-6`,e),...t})}function l0({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-footer`,className:Pp(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function u0({className:e,...t}){return(0,B.jsx)(Oh,{"data-slot":`dialog-title`,className:Pp(`text-base font-medium text-foreground`,e),...t})}function d0({className:e,...t}){return(0,B.jsx)(Dh,{"data-slot":`dialog-description`,className:Pp(`text-sm text-muted-foreground`,e),...t})}function f0(e){return(0,B.jsx)(EM,{"data-slot":`select`,...e})}function p0(e){return(0,B.jsx)(AM,{"data-slot":`select-value`,...e})}function m0({className:e,size:t=`default`,children:n,...r}){return(0,B.jsxs)(OM,{"data-slot":`select-trigger`,"data-size":t,className:Pp(`flex w-fit items-center justify-between gap-2 rounded-lg border border-input bg-background px-2.5 py-1 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`[&>[data-slot=select-value]]:min-w-0 [&>[data-slot=select-value]]:truncate`,e),...r,children:[n,(0,B.jsx)(jM,{asChild:!0,children:(0,B.jsx)(sy,{className:`size-4 opacity-50`})})]})}function h0({className:e,children:t,position:n=`popper`,...r}){return(0,B.jsx)(NM,{children:(0,B.jsxs)(FM,{"data-slot":`select-content`,className:Pp(`relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,B.jsx)(nN,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(uy,{className:`size-4`})}),(0,B.jsx)(GM,{className:Pp(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,B.jsx)(iN,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(sy,{className:`size-4`})})]})})}function g0({className:e,children:t,...n}){return(0,B.jsxs)(XM,{"data-slot":`select-item`,className:Pp(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(eN,{children:(0,B.jsx)(oy,{className:`size-4`})})}),(0,B.jsx)(QM,{children:t})]})}var _0=1e3;function yge(){return[{id:`hung`,label:Dee()},{id:`wrong_result`,label:Rd()},{id:`error`,label:Oc()},{id:`other`,label:cee()}]}function bge({target:e,onClose:t}){let n=Ns(L.subAgentReports.createSubAgentReport),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1);(0,z.useEffect)(()=>{e&&(i(``),o(``),c(!1),u(!1))},[e]);function d(e){e||t()}async function f(){if(!(!e||s)){c(!0);try{await n({subAgentId:e.subAgentId,category:r||void 0,comment:a.trim()||void 0}),u(!0)}catch{c(!1)}}}return(0,B.jsx)(o0,{open:e!==null,onOpenChange:d,children:e?(0,B.jsxs)(s0,{className:`sm:max-w-md`,children:[(0,B.jsxs)(c0,{children:[(0,B.jsx)(u0,{children:eu()}),(0,B.jsx)(d0,{children:l?rf():bu({label:e.label})})]}),l?(0,B.jsx)(`div`,{className:`oc-feedback__result`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-ok`,children:cp()})}):(0,B.jsxs)(`div`,{className:`oc-feedback__form`,children:[(0,B.jsx)(`label`,{className:`oc-feedback__label`,children:Ml()}),(0,B.jsxs)(f0,{value:r,onValueChange:i,children:[(0,B.jsx)(m0,{children:(0,B.jsx)(p0,{placeholder:qc()})}),(0,B.jsx)(h0,{children:yge().map(e=>(0,B.jsx)(g0,{value:e.id,children:e.label},e.id))})]}),(0,B.jsx)(`label`,{className:`oc-feedback__label`,htmlFor:`oc-subagentreport-comment`,children:Wf()}),(0,B.jsx)(`textarea`,{id:`oc-subagentreport-comment`,className:`oc-feedback__textarea`,placeholder:Gs(),value:a,maxLength:_0,onChange:e=>o(e.target.value.slice(0,_0)),rows:4}),(0,B.jsxs)(`div`,{className:`oc-feedback__count`,children:[a.length,`/`,_0]})]}),(0,B.jsx)(l0,{children:l?(0,B.jsx)(Lh,{onClick:()=>d(!1),children:_ee()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Lh,{variant:`outline`,onClick:()=>d(!1),children:Hu()}),(0,B.jsx)(Lh,{onClick:()=>void f(),disabled:s,children:s?Tf():qp()})]})})]}):null})}function xge(e,t=`md`){let n=(e??``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40);return`sous-agent${n?`-${n}`:``}.${t}`}function Sge(e){return JSON.stringify({kind:`sub-agent`,taskName:e.taskName??null,status:e.status,exportedAt:new Date(e.exportedAt).toISOString(),parentAgent:e.parentAgentLabel??null,config:e.sessionMeta??null,telemetry:e.telemetry??null,tools:e.tools.map(e=>({name:e.name,status:e.status,input:e.argsText??null,output:e.resultText??null})),result:e.result??null,error:e.error??null},null,2)}function Cge(e){let t=[],n=e.taskName?.trim()||dr();t.push(`# ${dr()} — ${n}`,``);let r=[];e.parentAgentLabel&&r.push(`- ${uf()} : ${e.parentAgentLabel}`);let i=e.sessionMeta;if(i?.model&&r.push(`- ${Fe()} : ${i.model}${i.modelProvider?` (${i.modelProvider})`:``}`),i?.thinkingLevel&&r.push(`- ${hh()} : ${i.thinkingLevel}`),i?.fastMode!==void 0&&r.push(`- ${hc()} : ${i.fastMode?yh():Mm()}`),i?.controlScope&&r.push(`- ${ks()} : ${i.controlScope}`),i?.subagentRole&&r.push(`- ${ou()} : ${i.subagentRole}`),i?.spawnDepth!==void 0&&r.push(`- ${Eu()} : ${i.spawnDepth}`),r.length&&t.push(...r,``),e.tools.length>0){t.push(`## ${Lr()} (${e.tools.length})`,``);for(let n of e.tools)t.push(`### ${n.name} — ${n.status}`,``),n.argsText&&t.push(`**Input**`,``,"```",n.argsText,"```",``),n.resultText&&t.push(`**Output**`,``,"```",n.resultText,"```",``)}return e.error&&t.push(`## ${wr()}`,``,e.error,``),e.result&&t.push(`## ${cd()}`,``,e.result,``),`${t.join(`
|
|
242
242
|
`).trim()}\n`}function wge(e,t,n=!1){if(e===void 0)return`thinking`;switch(e){case`streaming`:return t?`generating`:`thinking`;case`error`:return`error`;case`aborted`:return`aborted`;default:return n?`aborted`:null}}function Tge(e){return e?e.some(e=>e?.type===`text`&&typeof e.text==`string`&&e.text.trim().length>0):!1}var Ege={thinking:Tn,generating:Wa,error:np,aborted:Pi},v0={processing_history:xp,compacting:zn,querying_gateway:Mt,awaiting_subagents:ao,post_processing:Ea,awaiting_approval:Jt},Dge=[[`read`,/^(read|read_file|cat|open|view|notebook_read)$/i],[`exec`,/^(exec|bash|shell|run|command|terminal)$/i],[`search`,/^(web_search|search|grep|find|glob|rg)$/i],[`fetch`,/^(web_fetch|fetch|browser|http_get)$/i],[`write`,/^(write|write_file|apply_patch|edit|str_replace|notebook_edit)$/i]];function y0(e){for(let[t,n]of Dge)if(n.test(e))return t;return`other`}var Oge={read:()=>ue(),exec:()=>bh(),search:()=>ji(),fetch:()=>tr(),write:()=>un(),other:e=>gt({tool:e})};function b0(e){if(!e||e.length===0)return null;let t=e=>e.toolCallId??e.toolName,n=new Set;for(let r=e.length-1;r>=0;r--){let i=e[r],a=i.phase??`completed`;if(a===`completed`||a===`error`){n.add(t(i));continue}if((a===`start`||a===`started`||a===`running`)&&!n.has(t(i)))return{name:i.toolName,family:y0(i.toolName)}}return null}function kge(e,t,n,r,i){let a=wge(e,t,i??!1);if(a===null)return null;if(a===`thinking`||a===`generating`){if(r)return{kind:a,label:Oge[r.family](r.name),phased:!0};if(n&&v0[n])return{kind:a,label:v0[n](),phased:!0}}return{kind:a,label:Ege[a]()}}function Age(e,t){return!t||e!==`thinking`&&e!==`generating`?null:Ro()}var jge=new Set([`context_length`,`context_length_compacted`,`context_length_presend`]),x0={context_length:nee,context_length_compacted:Rf,context_length_presend:zs,rate_limit:qa,timeout:pe,refusal:cte,stream_orphaned:El,connection_lost:Hc,gateway_restarting:xm,connection_saturated:Nd,GATEWAY_RESTARTING:xm,CONNECTION_SATURATED:Nd,response_timeout:Cc,compaction_timeout:ts,empty_response:To,msgtool_args_unreadable:zo,awaiting_approval:En,empty_response_silent:Cp,provider_internal:Hn,session_init_conflict:ka,session_write_conflict:Zt,not_configured:lte,no_agent:Fi,agent_restricted:ir,send_failed:pn,DISPATCH_STALLED:rn,ATTACHMENT_TOO_LARGE:yt,ATTACHMENT_REJECTED:ai},Mge=/context overflow|prompt too large|maximum context length|context[- ]length exceeded|request_too_large|request too large|input (?:token count )?exceeds the maximum number of (?:input )?tokens|input is too long for the model|too many tokens/i,S0=new Set([`stream_orphaned`,`connection_lost`,`gateway_restarting`,`connection_saturated`,`response_timeout`,`not_configured`,`no_agent`,`agent_restricted`,`send_failed`,`ATTACHMENT_TOO_LARGE`,`ATTACHMENT_REJECTED`]);function C0(e,t){let n=(e??``).trim(),r=t&&x0[t]?t:S0.has(n)?n:Mge.test(n)?`context_length`:t??null,i=r===null?null:x0[r]?.()??null,a=(e??``).trim();return{headline:i,detail:a&&a!==r&&!S0.has(a)?a:null,code:r}}var w0=Tge;function Nge(e){let t=e.trim();if(t===``)return``;let n=t.slice(t.lastIndexOf(`:`)+1)||t;return n.length>10?`${n.slice(0,8)}…`:n}function Pge(e){return/^agent:(.+?):subagent:/.exec(e.trim())?.[1]?.trim()||void 0}function Fge(e){if(!Number.isFinite(e)||e<0)return``;if(e<1e3)return`< 1 s`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r>0?`${n} min ${r} s`:`${n} min`;let i=Math.floor(n/60),a=n%60;return a>0?`${i} h ${String(a).padStart(2,`0`)} min`:`${i} h`}function Ige(e){if(!Number.isFinite(e)||e<0)return``;let t=e>0&&e<.01?4:2;return`${e.toFixed(t).replace(`.`,`,`)} $`}function T0(e){return e.moaRole===`moa_aggregator`?bs():e.moaRole===`moa_reference`?Hee():dr()}function Lge(e){return e.kind===`task`?pd({tool:e.taskName?.trim()||`task`}):e.taskName?.trim()||Nge(e.childSessionKey)||Bi()}function Rge(e){return e.some(e=>e.status===`running`&&e.kind!==`task`)}function zge(e){return e===`running`?`running`:e===`done`?`done`:e===`aborted`?`aborted`:`failed`}function Bge(e){return e!==`running`}function Vge(e){return e!==void 0&&e.tone!==`running`&&e.sessionMeta?.cleanup===`delete`}function Hge(e){return e.startsWith(`fork:`)}function Uge(e){let t=zge(e.status),n=e.sessionMeta?.subagentRole;return{id:e._id,childSessionKey:e.childSessionKey,...e.kind===`task`?{isTask:!0}:{},...n===`moa_reference`||n===`moa_aggregator`?{moaRole:n}:{},taskName:e.taskName?.trim()||void 0,label:Lge(e),status:e.status,tone:t,failure:t===`failed`,phase:e.status===`running`?e.phase:void 0,errorMessage:e.errorMessage,errorCode:e.errorCode,resultText:e.resultText,tools:e.tools?.map(e=>({name:e.name,status:e.status,toolCallId:e.toolCallId})),sessionMeta:e.sessionMeta,telemetry:e.telemetry,childAgentId:Pge(e.childSessionKey)}}function E0(e){let t=[...e].sort((e,t)=>t.createdAt-e.createdAt).map(Uge).sort((e,t)=>{let n=e=>e.moaRole===`moa_aggregator`?0:e.moaRole===`moa_reference`?1:2,r=e=>e.moaRole?e.childSessionKey.replace(/:(ref\d+|aggregate)$/,``):``,i=r(e).localeCompare(r(t));if(e.moaRole&&t.moaRole&&i!==0)return i;let a=n(e),o=n(t);if(a!==o)return a-o;if(a===1){let n=e=>{let t=/ref(\d+)$/.exec(e.childSessionKey);return t?.[1]?Number.parseInt(t[1],10):0};return n(e)-n(t)}return 0});return{cards:t,total:t.length,done:t.filter(e=>e.tone===`done`).length,running:t.filter(e=>e.tone===`running`).length,failed:t.filter(e=>e.tone===`failed`).length,aborted:t.filter(e=>e.tone===`aborted`).length}}function Wge(e){if(e.total<=1)return[];let t={done:e.done,running:e.running,failed:e.failed,aborted:e.aborted};return[`done`,`running`,`failed`,`aborted`].filter(e=>t[e]>0).map(e=>({tone:e,count:t[e]}))}function D0(e,t,n){let r=new Set(t);return e.filter(e=>n!==void 0&&e.parentMessageId===n||r.has(e.childSessionKey))}function Gge(e){return e===1?vo({count:e}):Ra({count:e})}var O0=120,Kge=/EXTERNAL_UNTRUSTED_CONTENT|SECURITY\s*NOTICE|UNTRUSTED\s*CONTENT/i,qge=/DO NOT/;function k0(e){return Kge.test(e)||qge.test(e)}function A0(e){return e.length<=O0?e:`${e.slice(0,O0-1)}…`}function Jge(e){for(let t of e.split(/\r?\n/)){let e=t.replace(/\s+/g,` `).trim();if(!(e.length<3)&&/[\p{L}\p{N}]/u.test(e)&&!k0(e))return e}return null}function j0(e,t){let n=mte();if(t){let e=x0[t]?.();if(e)return e}if(e==null)return n;let r=e.trim();if(r===``)return n;let i=/([A-Za-z][\w.-]*)\s+failed\s*\(([^)]{1,40})\)/i.exec(r);if(i)return A0(`${i[1]} (${i[2].trim()})`);let a=Jge(r);return a&&!k0(a)?A0(a):n}function Yge(e){let t=document.querySelector(`[data-message-id="${CSS.escape(e)}"]`);if(!t)return;let n=t.closest(`.oc-thread__viewport`);if(n){let e=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTo({top:n.scrollTop+e-12,behavior:`smooth`})}else t.scrollIntoView({block:`start`,behavior:`smooth`});t.classList.remove(`oc-msg--highlight`),t.offsetWidth,t.classList.add(`oc-msg--highlight`),window.setTimeout(()=>t.classList.remove(`oc-msg--highlight`),2400)}function Xge(e,t){let n=new Blob([t],{type:`text/markdown;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}var M0=(0,z.createContext)(null);function Zge({card:e}){let t=e.tone===`running`?an():e.tone===`failed`?ye():$a();return(0,B.jsxs)(`span`,{className:`oc-subpanel__status oc-subpanel__status--${e.tone}`,children:[t,e.tone===`running`?(0,B.jsx)(Hy,{size:13,className:`oc-subagent__spin`,"aria-hidden":!0}):e.tone===`failed`?(0,B.jsx)(dy,{size:13,"aria-hidden":!0}):(0,B.jsx)(oy,{size:13,"aria-hidden":!0})]})}function Qge(e){if(e)try{return JSON.parse(e)}catch{return}}function $ge(e){return{type:e===`error`?`error`:e===`done`?`completed`:`running`}}function N0(e){return e.toolCallId??`name:${e.name}`}function e_e({summary:e,parts:t,subAgentRunning:n}){let[r,i]=(0,z.useState)(!1),a=n,o=e.length===1?Le({count:e.length}):$e({count:e.length}),s=a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Hy,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}),bd()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(oy,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sr-only`,children:qr()})]}),c=new Map;for(let e of t??[])c.set(e.toolCallId,e);return(0,B.jsxs)(`div`,{className:`oc-toolact`,children:[(0,B.jsx)(tI,{icon:(0,B.jsx)(Pb,{size:14}),label:o,trailing:s,open:r,ariaExpanded:r,title:r?ct():Ke(),onClick:()=>i(!r)}),r?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:e.map((e,t)=>{let r=c.get(N0(e));return(0,B.jsx)(a0,{toolName:e.name,args:r?Qge(r.argsText):void 0,argsText:r?.argsText,result:r?.resultText,status:$ge(r?.status??e.status),turnSettled:!n},`${N0(e)}-${t}`)})}):null]})}function t_e({meta:e,telemetry:t,childAgentId:n,instanceName:r,parentAgentLabel:i,onExport:a}){let[o,s]=(0,z.useState)(!1),c=!!e&&Object.values(e).some(e=>e!==void 0)||!!t&&Object.values(t).some(e=>e!==void 0)||n!==void 0;if(!c&&!i&&!a)return(0,B.jsx)(`div`,{className:`oc-subpanel__barslot`,"aria-hidden":!0});let l=e?.fastMode===void 0?null:e.fastMode?yh():Mm();return(0,B.jsxs)(`div`,{className:`oc-subpanel__bar`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__bar-chips`,children:[e?.model?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:e.modelProvider?la({provider:e.modelProvider}):Fe(),children:[(0,B.jsx)(yy,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.model})]}):null,e?.thinkingLevel?(0,B.jsxs)(`span`,{className:`oc-chip`,title:hh(),children:[(0,B.jsx)(iy,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.thinkingLevel})]}):null,l?(0,B.jsxs)(`span`,{className:`oc-chip`,title:hc(),children:[(0,B.jsx)(Ny,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:l})]}):null,e?.context?(0,B.jsxs)(`span`,{className:`oc-chip`,title:e.context===`fork`?Qc():Rl(),children:[(0,B.jsx)(Sb,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.context})]}):null,i?(0,B.jsxs)(`span`,{className:`oc-chip`,title:uf(),children:[(0,B.jsx)(ry,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:i})]}):null,a?(0,B.jsxs)(fF,{children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-chip oc-chip--btn oc-subpanel__bar-export`,title:Zm(),children:[(0,B.jsx)(by,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:xa()}),(0,B.jsx)(sy,{size:12,className:`oc-chip__chev`,"aria-hidden":!0})]})}),(0,B.jsxs)(mF,{align:`end`,className:`w-44`,children:[(0,B.jsx)(gF,{children:xa()}),(0,B.jsx)(hF,{onClick:()=>a(`md`),children:Ad()}),(0,B.jsx)(hF,{onClick:()=>a(`json`),children:bc()})]})]}):null]}),c?(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__adv-toggle${o?` is-open`:``}`,"aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,B.jsx)(bb,{size:13,"aria-hidden":!0}),mp(),(0,B.jsx)(ly,{size:13,className:`oc-subpanel__adv-chevron`,"aria-hidden":!0})]}):null,o&&c?(0,B.jsx)(r_e,{meta:e??{},telemetry:t,childAgentId:n,instanceName:r}):null]})}function n_e(e){return e===`leaf`?Ep():e===`orchestrator`?Gn():null}function r_e({meta:e,telemetry:t,childAgentId:n,instanceName:r}){let i=[];e.model&&i.push([Fe(),e.model]),e.modelProvider&&i.push([ra(),e.modelProvider]);let a=e.agentId??n;a&&i.push([qu(),a]),r&&i.push([Ee(),r]),e.label&&i.push([Qp(),e.label]),e.thinkingLevel&&i.push([hh(),e.thinkingLevel]),e.fastMode!==void 0&&i.push([hc(),e.fastMode?yh():Mm()]),e.context&&i.push([Rl(),e.context]),e.lightContext!==void 0&&i.push([kf(),e.lightContext?bee():_l()]),e.runtime&&i.push([Mee(),e.runtime]),e.mode&&i.push([Ud(),e.mode]),e.cleanup&&i.push([Nc(),e.cleanup]),e.sandbox&&i.push([fee(),e.sandbox]),e.controlScope&&i.push([ks(),e.controlScope]),e.subagentRole&&i.push([ou(),e.subagentRole]),e.spawnDepth!==void 0&&i.push([Eu(),String(e.spawnDepth)]);let o=n_e(e.subagentRole);if(o&&i.push([Xs(),o]),e.sessionId&&i.push([v(),e.sessionId]),e.gatewayKind&&i.push([Jf(),e.gatewayKind]),t?.runtimeMs!==void 0){let e=Fge(t.runtimeMs);e&&i.push([bi(),e])}if(t?.totalTokens!==void 0&&i.push([rs(),ige(t.totalTokens)]),t?.estimatedCostUsd!==void 0){let e=typeof t.totalTokens==`number`&&t.totalTokens>0;if(t.estimatedCostUsd<=0&&e)i.push([Do(),$ee()]);else{let e=Ige(t.estimatedCostUsd);e&&i.push([Do(),e])}}return(0,B.jsx)(`dl`,{className:`oc-subpanel__adv-list`,children:i.map(([e,t])=>(0,B.jsxs)(`div`,{className:`oc-subpanel__adv-row`,children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]},e))})}function P0({chatId:e,childKey:t,onClose:n,parentAgentLabel:r}){let i=I(L.subAgents.listSubAgents,{chatId:e}),a=I(L.agents.getChatAgent,{chatId:e}),o=I(L.messages.getSessionMeta,{chatId:e})?.perTurnRouting===!0?void 0:a?.agent?.instanceName,s=(i??[]).find(e=>e.childSessionKey===t),c=s?E0([s]).cards[0]:void 0,l=s?.taskName?.trim(),u=Vge(c),d=Hge(t),f=I(L.subAgentReports.myReportedSubAgentIds,{chatId:e}),p=I(L.subAgents.listSubAgentToolParts,{chatId:e,childSessionKey:t}),m=I(L.subAgentInteractions.listSubAgentInteractions,{chatId:e,childSessionKey:t}),h=Fp(L.subAgentInteractions.sendToSubAgent),g=Ns(L.chats.generateUploadUrl),_=Ns(L.uploads.registerUpload),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(!0),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(``),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)([]),[A,ee]=(0,z.useState)(!1),[j,M]=(0,z.useState)(!0),te=(0,z.useRef)(null),N=(0,z.useRef)(null),P=(0,z.useCallback)(async e=>{if(!(!e||e.length===0)){ee(!0);try{for(let t of Array.from(e)){if(O.length>=6)break;let e=await g(),{storageId:n}=await(await fetch(e,{method:`POST`,headers:{"Content-Type":t.type||`application/octet-stream`},body:t})).json();await _({storageId:n}),k(e=>e.length>=6?e:[...e,{storageId:n,filename:t.name,mimeType:t.type||`application/octet-stream`}])}}finally{ee(!1),te.current&&(te.current.value=``)}}},[O.length,g,_]),[ne,re]=(0,z.useState)(null),ie=c?(f??[]).includes(c.id):!1,oe=(0,z.useCallback)(e=>{if(!c)return;let t=p&&p.length>0?p.map(e=>({name:e.name,status:e.status,argsText:e.argsText,resultText:e.resultText})):(c.tools??[]).map(e=>({name:e.name,status:e.status})),n={taskName:l,status:c.status,parentAgentLabel:r,sessionMeta:c.sessionMeta,telemetry:c.telemetry,result:c.resultText,error:c.failure?j0(c.errorMessage,c.errorCode):void 0,tools:t};Xge(xge(l,e),e===`md`?Cge(n):Sge({...n,exportedAt:Date.now()}))},[c,p,l,r]);(0,z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,z.useEffect)(()=>{i!==void 0&&!s&&n()},[i,s,n]);let se=m&&m.length>0?`${m.length}:${m[m.length-1].status}`:``;(0,z.useEffect)(()=>{if(!se)return;let e=N.current;e&&e.scrollTo({top:e.scrollHeight,behavior:`smooth`})},[se]);let ce=async()=>{let n=w.trim();if(!(u||d)&&!(!n&&O.length===0||v||A)){y(!0);try{await h({chatId:e,childSessionKey:t,text:n,...O.length>0?{attachments:O.map(e=>({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType}))}:{}}),T(``),k([])}finally{y(!1)}}};return(0,B.jsxs)(`div`,{className:`oc-subpanel`,children:[(0,B.jsxs)(`header`,{className:`oc-subpanel__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__avatar oc-subpanel__back${c?` oc-subpanel__avatar--${c.tone}`:``}`,disabled:!s?.parentMessageId,title:$r(),"aria-label":Ed(),onClick:()=>s?.parentMessageId&&Yge(s.parentMessageId),children:(0,B.jsx)(ire,{size:16})}),(0,B.jsxs)(`div`,{className:`oc-subpanel__headmain`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__head-top`,children:[(0,B.jsx)(`span`,{className:`oc-subpanel__kind`,children:c?T0(c):dr()}),(0,B.jsxs)(`div`,{className:`oc-subpanel__head-ctrls`,children:[c?(0,B.jsx)(Zge,{card:c}):null,c&&Bge(c.status)?(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn oc-subpanel__report${ie?` is-on`:``}`,title:ie?Cs():pt(),"aria-label":pt(),disabled:ie,onClick:()=>re({subAgentId:c.id,label:c.label}),children:(0,B.jsx)(Dy,{size:15,"aria-hidden":!0})}):null,(0,B.jsx)(Lh,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":Et(),className:`oc-subpanel__close`,children:(0,B.jsx)(Sh,{size:16})})]})]}),l?(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__task${E?` is-expanded`:``}`,title:Ze(),"aria-expanded":E,onClick:()=>D(e=>!e),children:l}):null]})]}),(0,B.jsx)(t_e,{meta:c?.sessionMeta,telemetry:c?.telemetry,childAgentId:c?.childAgentId,instanceName:o,parentAgentLabel:r,onExport:c?oe:void 0}),(0,B.jsx)(`div`,{className:`oc-subpanel__body`,ref:N,children:c?(0,B.jsxs)(B.Fragment,{children:[c.tools&&c.tools.length>0&&j?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Lr()}),(0,B.jsx)(e_e,{summary:c.tools,parts:p,subAgentRunning:c.tone===`running`})]}):null,c.failure?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:wr()}),(0,B.jsx)(`p`,{className:`oc-subpanel__error`,children:j0(c.errorMessage,c.errorCode)})]}):null,c.resultText?(0,B.jsxs)(`section`,{className:`oc-subpanel__section oc-subpanel__result${b?` is-open`:``}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__result-toggle`,"aria-expanded":b,onClick:()=>x(!b),children:[(0,B.jsx)(ly,{size:13,className:`oc-subpanel__result-chevron`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__section-title`,children:cd()})]}),b?(0,B.jsx)(v1,{text:c.resultText}):null]}):c.tone===`running`?(0,B.jsxs)(`p`,{className:`oc-subpanel__muted oc-subpanel__working`,children:[(0,B.jsx)(Hy,{size:14,className:`oc-subagent__spin`,"aria-hidden":!0}),ae()]}):null,m&&m.length>0?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Rt()}),(0,B.jsx)(`div`,{className:`oc-subpanel__thread`,children:m.map(e=>(0,B.jsxs)(`div`,{className:`oc-subpanel__exchange`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--user`,children:[e.userText,e.attachments&&e.attachments.length>0?(0,B.jsx)(`div`,{className:`oc-subpanel__msg-atts`,children:e.attachments.map((t,n)=>(0,B.jsxs)(`span`,{className:`oc-subpanel__attchip oc-subpanel__attchip--sent`,title:t.filename,children:[(0,B.jsx)(ib,{size:11,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:t.filename})]},`${e._id}-att-${n}`))}):null]}),e.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--pending`,children:[(0,B.jsx)(Hy,{size:13,className:`oc-actrow__spin`,"aria-hidden":!0}),fo()]}):e.status===`error`?(0,B.jsx)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--err`,children:e.errorMessage??Ma()}):(0,B.jsx)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--reply`,children:(0,B.jsx)(v1,{text:e.replyText??``})})]},e._id))})]}):null]}):(0,B.jsx)(`p`,{className:`oc-subpanel__muted`,children:di()})}),(0,B.jsx)(`footer`,{className:`oc-subpanel__foot`,children:S?(0,B.jsxs)(`div`,{className:`oc-subpanel__prompt`,children:[O.length>0?(0,B.jsx)(`div`,{className:`oc-subpanel__attstrip`,children:O.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-subpanel__attchip`,title:e.filename,children:[(0,B.jsx)(ib,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:e.filename}),(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__attchip-x`,"aria-label":Li(),onClick:()=>k(e=>e.filter((e,n)=>n!==t)),children:(0,B.jsx)(Sh,{size:11,"aria-hidden":!0})})]},`${e.storageId}-${t}`))}):null,(0,B.jsx)(`textarea`,{className:`oc-subpanel__prompt-input`,rows:2,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ce())},placeholder:hn(),autoFocus:!0}),(0,B.jsxs)(`div`,{className:`oc-subpanel__prompt-bar`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__composer-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__composer-btn`,title:ge(),"aria-label":ge(),disabled:A||O.length>=6,onClick:()=>te.current?.click(),children:A?(0,B.jsx)(Hy,{size:15,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(db,{size:15,"aria-hidden":!0})}),c?.tools&&c.tools.length>0?(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__composer-btn oc-subpanel__composer-btn--label${j?` is-on`:``}`,title:dte(),"aria-pressed":j,onClick:()=>M(e=>!e),children:[(0,B.jsx)(Pb,{size:14,"aria-hidden":!0}),Lr()]}):null]}),c?.tone===`running`?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:en()}):d?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:On()}):u?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:Vo()}):(m??[]).some(e=>e.status===`pending`)?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:Xa()}):null,(0,B.jsxs)(Lh,{variant:`default`,size:`sm`,className:`gap-1.5`,disabled:!w.trim()&&O.length===0||v||A||c?.tone===`running`||u||d||(m??[]).some(e=>e.status===`pending`),onClick:()=>void ce(),children:[v?(0,B.jsx)(Hy,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(gb,{size:14,"aria-hidden":!0}),xt()]})]}),(0,B.jsx)(`input`,{ref:te,type:`file`,multiple:!0,className:`oc-subpanel__fileinput`,onChange:e=>void P(e.target.files)})]}):(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__interact`,onClick:()=>C(!0),children:[(0,B.jsx)(qy,{size:15,"aria-hidden":!0}),or()]})}),(0,B.jsx)(bge,{target:ne,onClose:()=>re(null)})]})}var i_e=[`op`,`jobId`,`name`,`enabled`,`schedule`,`message`,`deliveryMode`,`agentId`,`nextRunAtMs`],F0=null,a_e=1,I0=new Set;function L0(){for(let e of[...I0])e()}function R0(e){return I0.add(e),()=>I0.delete(e)}function z0(){return F0}function o_e(e){return F0={pinId:a_e++,kind:e.kind,ownerUserId:e.ownerUserId,originChatId:e.originChatId,originLabel:e.originLabel,params:e.params,pinned:!1},L0(),F0}function B0(e,t){F0===null||F0.pinId!==e||F0.pinned!==t&&(F0={...F0,pinned:t},L0())}function V0(e){F0!==null&&(e!==void 0&&e!==F0.pinId||(F0=null,L0()))}function H0(e,t){F0===null||F0.pinId!==e||(F0={...F0,params:t},L0())}function s_e(e,t){return e===null||e.ownerUserId!==t.userId?`none`:e.pinned||G0(e,t)?`dock`:`none`}function c_e(e,t){switch(e){case`sources`:return`sources:${String(t.messageId??``)}`;case`subagent`:return`subagent:${String(t.childKey??``)}`;case`cron`:{let e=t.part??{};return`cron:${JSON.stringify([String(t.instanceName??``),String(t.jobId??``),String(t.occurrenceId??``),i_e.map(t=>e[t]??null)])}`}case`document`:{let e=t.doc??{};return`document:${JSON.stringify([e.filename??null,e.storageId??e.url??null])}`}}}function U0(e,t){return e-420>=t}function W0(e,t,n){return Math.max(n,Math.min(e,t-420))}function G0(e,t){return e===null||e.ownerUserId!==t.userId?!1:e.originChatId!==null&&e.originChatId===t.chatId}function l_e(e,t){return e===null||e.ownerUserId!==t.userId?!1:!e.pinned&&!G0(e,t)}function u_e(e,t){return G0(e,t)?`keep`:`close`}function d_e(e,t){return G0(e,t)?e:null}function K0(){let[e,t]=(0,z.useState)(()=>window.innerWidth);return(0,z.useLayoutEffect)(()=>{let e=()=>{let e=document.querySelector(`.oc-workspace`);if(e===null)return;let n=e.querySelector(`.oc-sidebar-col`),r=n===null?0:n.getBoundingClientRect().width,i=e.getBoundingClientRect().width-r;i>0&&t(i)},n=new ResizeObserver(e);n.observe(document.documentElement);let r=new Set,i=()=>{let t=document.querySelector(`.oc-workspace`),i=new Set;if(t!==null){let e=t.querySelector(`.oc-sidebar-col`);e!==null&&i.add(e)}for(let e of r)i.has(e)||n.unobserve(e);for(let e of i)r.has(e)||n.observe(e);r.clear();for(let e of i)r.add(e);e()};i();let a=new MutationObserver(i);return a.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect(),a.disconnect()}},[]),e}var f_e=`oc.sidebar.width`,q0=`oc.sidebar.collapsed`,J0=200,Y0=520,p_e=260,X0=`(max-width: 767px)`;function Z0(){let[e,t]=(0,z.useState)(()=>typeof window<`u`&&window.matchMedia(X0).matches);return(0,z.useEffect)(()=>{let e=window.matchMedia(X0),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var Q0=new Map;function $0(e,t,n){let r=Q0.get(e);if(r!==void 0)for(let e of[...r])e!==n&&e(t)}function e2(e){let{storageKey:t,defaultWidth:n,min:r,max:i,edge:a,maxViewportFraction:o}=e,s=e.fit??(e=>e),c=(0,z.useRef)(s);c.current=s;let l=(0,z.useCallback)(e=>Math.min(i,Math.max(r,e)),[r,i]),[u,d]=(0,z.useState)(()=>l(Number(localStorage.getItem(t))||n)),[f,p]=(0,z.useState)(()=>window.innerWidth);(0,z.useEffect)(()=>{let e=()=>p(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=(0,z.useCallback)(e=>{let t=o===void 0?1/0:Math.round(f*o);return Math.min(Math.max(r,Math.min(i,t)),Math.max(r,e))},[r,i,o,f]),h=(0,z.useRef)(m);h.current=m;let g=(0,z.useRef)(u);g.current=u;let[_,v]=(0,z.useState)(null),y=s(m(_??u)),b=(0,z.useRef)(()=>{});(0,z.useEffect)(()=>{localStorage.setItem(t,String(u)),$0(t,u,b.current)},[t,u]);let x=(0,z.useCallback)(e=>{localStorage.setItem(t,String(e)),$0(t,e,b.current),d(e)},[t]);(0,z.useEffect)(()=>{let e=e=>d(e);b.current=e;let n=Q0.get(t)??new Set;return n.add(e),Q0.set(t,n),()=>{n.delete(e),n.size===0&&Q0.delete(t)}},[t]);let S=(0,z.useRef)(!1),C=(0,z.useRef)(null),w=(0,z.useRef)(null);return(0,z.useEffect)(()=>()=>w.current?.(),[]),{width:y,startResize:(0,z.useCallback)(e=>{if(w.current!==null)return;e.preventDefault(),S.current=!0;let t=e.pointerId,n=e.currentTarget;try{n.setPointerCapture(t)}catch{}let r=e.clientX,i=y,o=!1,s=a===`left`?1:-1,u=i,d=0,f=e=>c.current(h.current(e)),p=()=>{d=0;let e=C.current;if(e){let t=f(u);e.style.width=`${t}px`,e.style.flex=`0 0 ${t}px`}},m=e=>{if(!S.current||e.pointerId!==t)return;let n=l(i+s*(e.clientX-r));f(n)!==f(u)&&(o=!0),u=n,C.current?d===0&&(d=requestAnimationFrame(p)):v(u)},_=e=>{if(e instanceof PointerEvent&&e.pointerId!==t)return;S.current=!1,d!==0&&cancelAnimationFrame(d),v(null),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,_),window.removeEventListener(`pointercancel`,_),window.removeEventListener(`blur`,_),document.removeEventListener(`lostpointercapture`,_);try{n.hasPointerCapture(t)&&n.releasePointerCapture(t)}catch{}w.current=null,document.body.style.cursor=``,document.body.style.userSelect=``;let r=o&&u!==i,a=r?u:g.current,s=C.current;if(s){let e=f(a);s.style.width=`${e}px`,s.style.flex=`0 0 ${e}px`}r&&x(u)};w.current=_,window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,_),window.addEventListener(`pointercancel`,_),window.addEventListener(`blur`,_),document.addEventListener(`lostpointercapture`,_),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[y,a,m,l,x]),setWidth:d,columnRef:C}}function t2(){let{width:e,startResize:t,columnRef:n}=e2({storageKey:f_e,defaultWidth:p_e,min:J0,max:Y0,edge:`left`}),[r,i]=(0,z.useState)(()=>localStorage.getItem(q0)===`1`),a=Z0();return(0,z.useEffect)(()=>{localStorage.setItem(q0,r?`1`:`0`)},[r]),(0,z.useEffect)(()=>{a&&i(!0)},[a]),{width:e,columnRef:n,collapsed:r,toggleCollapsed:(0,z.useCallback)(()=>i(e=>!e),[]),collapse:(0,z.useCallback)(()=>i(!0),[]),startResize:t,isMobile:a,MIN_WIDTH:J0,MAX_WIDTH:Y0}}function m_e(e){let t=e2({storageKey:`oc.sources.width`,fit:e(300),defaultWidth:380,min:300,max:680,edge:`right`}),n=e2({storageKey:`oc.subagent.width`,fit:e(320),defaultWidth:460,min:320,max:720,edge:`right`}),r=e2({storageKey:`oc.docviewer.width`,fit:e(380),defaultWidth:560,min:380,max:1800,maxViewportFraction:.72,edge:`right`}),i={...t,min:300},a={...r,min:380};return{sources:i,subagent:{...n,min:320},cron:i,document:a}}function h_e({viewerUserId:e,currentChatId:t}){let n=(0,z.useSyncExternalStore)(R0,z0,z0),r=Rv(),i=Z0(),a=K0(),o=m_e((0,z.useCallback)(e=>t=>W0(t,a,e),[a])),s={userId:e,chatId:t};(0,z.useEffect)(()=>()=>V0(),[]);let c=l_e(n,s),l=n?.pinId;if((0,z.useEffect)(()=>{c&&l!==void 0&&V0(l)},[c,l]),n===null||s_e(n,s)!==`dock`)return null;let u=n.params,d=()=>V0(n.pinId),{width:f,startResize:p,columnRef:m,min:h}=o[n.kind],g=i||!U0(a,h);if(g&&!n.pinned)return null;let _=W0(f,a,h);return(0,B.jsx)(z1,{children:(0,B.jsxs)(`aside`,{className:`oc-pinpanel`,ref:m,hidden:g,style:g?{display:`none`}:{width:_,flex:`0 0 ${_}px`},"aria-label":vu({origin:n.originLabel}),children:[(0,B.jsx)(`div`,{className:`oc-pinpanel__resizer`,onPointerDown:p,role:`separator`,"aria-orientation":`vertical`,"aria-label":op()}),(0,B.jsxs)(`div`,{className:`oc-pinpanel__head`,children:[(0,B.jsx)(`span`,{className:`oc-pinpanel__origin`,title:n.originLabel,children:n.originLabel}),(0,B.jsxs)(`span`,{className:`oc-pinpanel__ctrls`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn${n.pinned?` is-on`:``}`,"aria-pressed":n.pinned,title:n.pinned?Al():Kc(),"aria-label":n.pinned?Al():Kc(),onClick:()=>{if(!n.pinned){B0(n.pinId,!0);return}u_e(n,s)===`close`?d():B0(n.pinId,!1)},children:n.pinned?(0,B.jsx)(lb,{size:14,"aria-hidden":!0}):(0,B.jsx)(cb,{size:14,"aria-hidden":!0})}),n.originChatId!==null&&!G0(n,s)?(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn`,title:tf(),"aria-label":tf(),onClick:()=>void r({to:`/chat/$chatId`,params:{chatId:n.originChatId}}),children:(0,B.jsx)(Cy,{size:14,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn`,title:Ld(),"aria-label":Ld(),onClick:d,children:(0,B.jsx)(Sh,{size:14,"aria-hidden":!0})})]})]}),(0,B.jsx)(oI,{onClose:d,children:(0,B.jsx)(`div`,{className:`oc-pinpanel__body`,children:n.kind===`cron`?(0,B.jsx)(aI,{instanceName:u.instanceName,part:u.part,onClose:d}):n.kind===`document`?(0,B.jsx)(M1.Provider,{value:{activeDoc:u.doc,openFor:e=>H0(n.pinId,{...u,doc:e}),openNewerVersion:e=>H0(n.pinId,{...u,doc:e}),close:d},children:(0,B.jsx)(P1,{doc:u.doc,chatId:n.originChatId,onClose:d})}):n.kind===`subagent`?(0,B.jsx)(P0,{chatId:n.originChatId,childKey:u.childKey,onClose:d,parentAgentLabel:u.parentAgentLabel??``}):(0,B.jsx)($1,{messageId:u.messageId,onClose:d})})},n.pinId)]})})}var n2;function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var r2=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},i2=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(n2=globalThis).__zod_globalConfig??(n2.__zod_globalConfig={});var a2=globalThis.__zod_globalConfig;function o2(e){return e&&Object.assign(a2,e),a2}function s2(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function c2(e,t){return typeof t==`bigint`?t.toString():t}function l2(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function u2(e){return e==null}function d2(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function g_e(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var f2=Symbol(`evaluating`);function p2(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==f2)return r===void 0&&(r=f2,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function m2(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function h2(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function g2(e){return JSON.stringify(e)}function __e(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var _2=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function v2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var v_e=l2(()=>{if(a2.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function y2(e){if(v2(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(v2(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function b2(e){return y2(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var y_e=new Set([`string`,`number`,`symbol`]);function x2(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function S2(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function C2(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function b_e(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var x_e={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function S_e(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return S2(e,h2(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return m2(this,`shape`,e),e},checks:[]}))}function C_e(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return S2(e,h2(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return m2(this,`shape`,r),r},checks:[]}))}function w_e(e,t){if(!y2(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return S2(e,h2(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return m2(this,`shape`,n),n}}))}function T_e(e,t){if(!y2(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return S2(e,h2(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return m2(this,`shape`,n),n}}))}function E_e(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return S2(e,h2(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return m2(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function D_e(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return S2(t,h2(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return m2(this,`shape`,i),i},checks:[]}))}function O_e(e,t,n){return S2(t,h2(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return m2(this,`shape`,i),i}}))}function w2(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function k_e(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function T2(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function E2(e){return typeof e==`string`?e:e?.message}function D2(e,t,n){let r=e.message?e.message:E2(e.inst?._zod.def?.error?.(e))??E2(t?.error?.(e))??E2(n.customError?.(e))??E2(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function O2(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function k2(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var A2=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,c2,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},j2=$(`$ZodError`,A2),M2=$(`$ZodError`,A2,{Parent:Error});function A_e(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function j_e(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var N2=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new r2;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>D2(e,a,o2())));throw _2(t,i?.callee),t}return o.value},P2=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>D2(e,a,o2())));throw _2(t,i?.callee),t}return o.value},F2=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new r2;return a.issues.length?{success:!1,error:new(e??j2)(a.issues.map(e=>D2(e,i,o2())))}:{success:!0,data:a.value}},M_e=F2(M2),I2=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>D2(e,i,o2())))}:{success:!0,data:a.value}},N_e=I2(M2),P_e=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return N2(e)(t,n,i)},F_e=e=>(t,n,r)=>N2(e)(t,n,r),I_e=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return P2(e)(t,n,i)},L_e=e=>async(t,n,r)=>P2(e)(t,n,r),R_e=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return F2(e)(t,n,i)},z_e=e=>(t,n,r)=>F2(e)(t,n,r),B_e=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return I2(e)(t,n,i)},V_e=e=>async(t,n,r)=>I2(e)(t,n,r),H_e=/^[cC][0-9a-z]{6,}$/,U_e=/^[0-9a-z]+$/,W_e=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,G_e=/^[0-9a-vA-V]{20}$/,K_e=/^[A-Za-z0-9]{27}$/,q_e=/^[a-zA-Z0-9_-]{21}$/,J_e=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Y_e=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,L2=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,X_e=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Z_e=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Q_e(){return new RegExp(Z_e,`u`)}var $_e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,eve=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tve=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,nve=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rve=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,R2=/^[A-Za-z0-9_-]*$/,ive=/^https?$/,ave=/^\+[1-9]\d{6,14}$/,z2=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,ove=RegExp(`^${z2}$`);function B2(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sve(e){return RegExp(`^${B2(e)}$`)}function cve(e){let t=B2({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${z2}T(?:${r})$`)}var lve=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},uve=/^-?\d+$/,dve=/^-?\d+(?:\.\d+)?$/,fve=/^[^A-Z]*$/,pve=/^[^a-z]*$/,V2=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),H2={number:`number`,bigint:`bigint`,object:`date`},U2=$(`$ZodCheckLessThan`,(e,t)=>{V2.init(e,t);let n=H2[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),W2=$(`$ZodCheckGreaterThan`,(e,t)=>{V2.init(e,t);let n=H2[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),mve=$(`$ZodCheckMultipleOf`,(e,t)=>{V2.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):g_e(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),hve=$(`$ZodCheckNumberFormat`,(e,t)=>{V2.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=x_e[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=uve)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),gve=$(`$ZodCheckMaxLength`,(e,t)=>{var n;V2.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=O2(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),_ve=$(`$ZodCheckMinLength`,(e,t)=>{var n;V2.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=O2(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),vve=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;V2.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=O2(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),G2=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;V2.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),yve=$(`$ZodCheckRegex`,(e,t)=>{G2.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),bve=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=fve,G2.init(e,t)}),xve=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=pve,G2.init(e,t)}),Sve=$(`$ZodCheckIncludes`,(e,t)=>{V2.init(e,t);let n=x2(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Cve=$(`$ZodCheckStartsWith`,(e,t)=>{V2.init(e,t);let n=RegExp(`^${x2(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),wve=$(`$ZodCheckEndsWith`,(e,t)=>{V2.init(e,t);let n=RegExp(`.*${x2(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Tve=$(`$ZodCheckOverwrite`,(e,t)=>{V2.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Eve=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
243
243
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
244
244
|
`))}},Dve={major:4,minor:4,patch:3},K2=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Dve;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=w2(e),i;for(let a of t){if(a._zod.def.when){if(k_e(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new r2;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=w2(e,t))});else{if(e.issues.length===t)continue;r||=w2(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(w2(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new r2;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new r2;return o.then(e=>t(e,r,a))}return t(o,r,a)}}p2(e,`~standard`,()=>({validate:t=>{try{let n=M_e(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return N_e(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),q2=$(`$ZodString`,(e,t)=>{K2.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lve(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),J2=$(`$ZodStringFormat`,(e,t)=>{G2.init(e,t),q2.init(e,t)}),Ove=$(`$ZodGUID`,(e,t)=>{t.pattern??=Y_e,J2.init(e,t)}),kve=$(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=L2(e)}else t.pattern??=L2();J2.init(e,t)}),Ave=$(`$ZodEmail`,(e,t)=>{t.pattern??=X_e,J2.init(e,t)}),jve=$(`$ZodURL`,(e,t)=>{J2.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===ive.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Mve=$(`$ZodEmoji`,(e,t)=>{t.pattern??=Q_e(),J2.init(e,t)}),Nve=$(`$ZodNanoID`,(e,t)=>{t.pattern??=q_e,J2.init(e,t)}),Pve=$(`$ZodCUID`,(e,t)=>{t.pattern??=H_e,J2.init(e,t)}),Fve=$(`$ZodCUID2`,(e,t)=>{t.pattern??=U_e,J2.init(e,t)}),Ive=$(`$ZodULID`,(e,t)=>{t.pattern??=W_e,J2.init(e,t)}),Lve=$(`$ZodXID`,(e,t)=>{t.pattern??=G_e,J2.init(e,t)}),Rve=$(`$ZodKSUID`,(e,t)=>{t.pattern??=K_e,J2.init(e,t)}),zve=$(`$ZodISODateTime`,(e,t)=>{t.pattern??=cve(t),J2.init(e,t)}),Bve=$(`$ZodISODate`,(e,t)=>{t.pattern??=ove,J2.init(e,t)}),Vve=$(`$ZodISOTime`,(e,t)=>{t.pattern??=sve(t),J2.init(e,t)}),Hve=$(`$ZodISODuration`,(e,t)=>{t.pattern??=J_e,J2.init(e,t)}),Uve=$(`$ZodIPv4`,(e,t)=>{t.pattern??=$_e,J2.init(e,t),e._zod.bag.format=`ipv4`}),Wve=$(`$ZodIPv6`,(e,t)=>{t.pattern??=eve,J2.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Gve=$(`$ZodCIDRv4`,(e,t)=>{t.pattern??=tve,J2.init(e,t)}),Kve=$(`$ZodCIDRv6`,(e,t)=>{t.pattern??=nve,J2.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Y2(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var qve=$(`$ZodBase64`,(e,t)=>{t.pattern??=rve,J2.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Y2(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Jve(e){if(!R2.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Y2(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Yve=$(`$ZodBase64URL`,(e,t)=>{t.pattern??=R2,J2.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Jve(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Xve=$(`$ZodE164`,(e,t)=>{t.pattern??=ave,J2.init(e,t)});function Zve(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Qve=$(`$ZodJWT`,(e,t)=>{J2.init(e,t),e._zod.check=n=>{Zve(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),X2=$(`$ZodNumber`,(e,t)=>{K2.init(e,t),e._zod.pattern=e._zod.bag.pattern??dve,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),$ve=$(`$ZodNumberFormat`,(e,t)=>{hve.init(e,t),X2.init(e,t)}),eye=$(`$ZodUnknown`,(e,t)=>{K2.init(e,t),e._zod.parse=e=>e}),tye=$(`$ZodNever`,(e,t)=>{K2.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Z2(e,t,n){e.issues.length&&t.issues.push(...T2(n,e.issues)),t.value[n]=e.value}var nye=$(`$ZodArray`,(e,t)=>{K2.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Z2(t,n,e))):Z2(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Q2(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...T2(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function $2(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=b_e(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function e4(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Q2(e,n,i,t,u,d))):Q2(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var rye=$(`$ZodObject`,(e,t)=>{if(K2.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=l2(()=>$2(t));p2(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=v2,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Q2(n,t,e,s,r,i))):Q2(a,t,e,s,r,i)}return i?e4(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),iye=$(`$ZodObjectJIT`,(e,t)=>{rye.init(e,t);let n=e._zod.parse,r=l2(()=>$2(t)),i=e=>{let t=new Eve([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=g2(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=g2(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
@@ -321,4 +321,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
321
321
|
To pick up a draggable item, press the space bar.
|
|
322
322
|
While dragging, use the arrow keys to move the item.
|
|
323
323
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
324
|
-
`},DEe={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function OEe(e){let{announcements:t=DEe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=EEe}=e,{announce:a,announcement:o}=CEe(),s=c5(`DndLiveRegion`),[c,l]=(0,z.useState)(!1);if((0,z.useEffect)(()=>{l(!0)},[]),wEe((0,z.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=z.createElement(z.Fragment,null,z.createElement(xEe,{id:r,value:i.draggable}),z.createElement(SEe,{id:s,announcement:o}));return n?(0,Bv.createPortal)(u,n):u}var _5;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(_5||={});function v5(){}function y5(e,t){return(0,z.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function b5(){var e=[...arguments];return(0,z.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var x5=Object.freeze({x:0,y:0});function S5(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function kEe(e,t){let n=p5(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function C5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function AEe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function w5(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function T5(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function E5(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var jEe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=E5(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=S5(E5(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(C5)},D5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=w5(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=w5(r),o=i.reduce((e,t,r)=>e+S5(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(C5)};function MEe(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var NEe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=MEe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(AEe)};function PEe(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var FEe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&PEe(r,a)){let n=w5(a).reduce((e,t)=>e+S5(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(C5)};function IEe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function O5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:x5}function LEe(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var REe=LEe(1);function k5(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function zEe(e,t,n){let r=k5(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var BEe={ignoreTransform:!1};function A5(e,t){t===void 0&&(t=BEe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=X8(e).getComputedStyle(e);t&&(n=zEe(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function j5(e){return A5(e,{ignoreTransform:!0})}function VEe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function HEe(e,t){return t===void 0&&(t=X8(e).getComputedStyle(e)),t.position===`fixed`}function UEe(e,t){t===void 0&&(t=X8(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function M5(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Z8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Q8(i)||$8(i)||n.includes(i))return n;let a=X8(e).getComputedStyle(i);return i!==e&&UEe(i,a)&&n.push(i),HEe(i,a)?n:r(i.parentNode)}return e?r(e):n}function N5(e){let[t]=M5(e,1);return t??null}function P5(e){return!q8||!e?null:J8(e)?e:Y8(e)?Z8(e)||e===e5(e).scrollingElement?window:Q8(e)?e:null:null}function F5(e){return J8(e)?e.scrollX:e.scrollLeft}function I5(e){return J8(e)?e.scrollY:e.scrollTop}function L5(e){return{x:F5(e),y:I5(e)}}var R5;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(R5||={});function z5(e){return!q8||!e?!1:e===document.scrollingElement}function B5(e){let t={x:0,y:0},n=z5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var WEe={x:.2,y:.2};function GEe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=WEe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=B5(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=R5.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=R5.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=R5.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=R5.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function KEe(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function V5(e){return e.reduce((e,t)=>u5(e,L5(t)),x5)}function qEe(e){return e.reduce((e,t)=>e+F5(t),0)}function JEe(e){return e.reduce((e,t)=>e+I5(t),0)}function H5(e,t){if(t===void 0&&(t=A5),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);N5(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var YEe=[[`x`,[`left`,`right`],qEe],[`y`,[`top`,`bottom`],JEe]],U5=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=M5(t),r=V5(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of YEe)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},W5=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function XEe(e){let{EventTarget:t}=X8(e);return e instanceof t?e:e5(e)}function G5(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var K5;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(K5||={});function q5(e){e.preventDefault()}function ZEe(e){e.stopPropagation()}var J5;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(J5||={});var Y5={start:[J5.Space,J5.Enter],cancel:[J5.Esc],end:[J5.Space,J5.Enter,J5.Tab]},QEe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case J5.Right:return{...n,x:n.x+25};case J5.Left:return{...n,x:n.x-25};case J5.Down:return{...n,y:n.y+25};case J5.Up:return{...n,y:n.y-25}}},X5=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new W5(e5(t)),this.windowListeners=new W5(X8(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(K5.Resize,this.handleCancel),this.windowListeners.add(K5.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(K5.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&H5(n),t(x5)}handleKeyDown(e){if(f5(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Y5,coordinateGetter:a=QEe,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:x5;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=d5(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=B5(n),p=KEe(n),m={x:Math.min(i===J5.Right?p.right-p.width/2:p.right,Math.max(i===J5.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===J5.Down?p.bottom-p.height/2:p.bottom,Math.max(i===J5.Down?p.top:p.top+p.height/2,u.y))},h=i===J5.Right&&!s||i===J5.Left&&!c,g=i===J5.Down&&!l||i===J5.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===J5.Right&&e<=d.x||i===J5.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===J5.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===J5.Down&&e<=d.y||i===J5.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===J5.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,u5(d5(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};X5.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Y5,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Z5(e){return!!(e&&`distance`in e)}function Q5(e){return!!(e&&`delay`in e)}var $5=class{constructor(e,t,n){n===void 0&&(n=XEe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=e5(i),this.documentListeners=new W5(this.document),this.listeners=new W5(n),this.windowListeners=new W5(X8(i)),this.initialCoordinates=p5(r)??x5,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(K5.Resize,this.handleCancel),this.windowListeners.add(K5.DragStart,q5),this.windowListeners.add(K5.VisibilityChange,this.handleCancel),this.windowListeners.add(K5.ContextMenu,q5),this.documentListeners.add(K5.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Q5(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Z5(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(K5.Click,ZEe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(K5.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=p5(e)??x5,s=d5(n,o);if(!t&&a){if(Z5(a)){if(a.tolerance!=null&&G5(s,a.tolerance))return this.handleCancel();if(G5(s,a.distance))return this.handleStart()}if(Q5(a)&&G5(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===J5.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},$Ee={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},e7=class extends $5{constructor(e){let{event:t}=e,n=e5(t.target);super(e,$Ee,n)}};e7.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var eDe={move:{name:`mousemove`},end:{name:`mouseup`}},t7;(function(e){e[e.RightClick=2]=`RightClick`})(t7||={});var n7=class extends $5{constructor(e){super(e,eDe,e5(e.event.target))}};n7.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===t7.RightClick?!1:(r?.({event:n}),!0)}}];var r7={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},i7=class extends $5{constructor(e){super(e,r7)}static setup(){return window.addEventListener(r7.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(r7.move.name,e)};function e(){}}};i7.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var a7;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(a7||={});var o7;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(o7||={});function tDe(e){let{acceleration:t,activator:n=a7.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=o7.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=rDe({delta:d,disabled:!a}),[m,h]=gEe(),g=(0,z.useRef)({x:0,y:0}),_=(0,z.useRef)({x:0,y:0}),v=(0,z.useMemo)(()=>{switch(n){case a7.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case a7.DraggableRect:return i}},[n,i,c]),y=(0,z.useRef)(null),b=(0,z.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,z.useMemo)(()=>s===o7.TreeOrder?[...l].reverse():l,[s,l]);(0,z.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=GEe(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var nDe={x:{[R5.Backward]:!1,[R5.Forward]:!1},y:{[R5.Backward]:!1,[R5.Forward]:!1}};function rDe(e){let{delta:t,disabled:n}=e,r=o5(t);return i5(e=>{if(n||!r||!e)return nDe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[R5.Backward]:e.x[R5.Backward]||i.x===-1,[R5.Forward]:e.x[R5.Forward]||i.x===1},y:{[R5.Backward]:e.y[R5.Backward]||i.y===-1,[R5.Forward]:e.y[R5.Forward]||i.y===1}}},[n,t,r])}function iDe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return i5(e=>t==null?null:r??e??null,[r,t])}function aDe(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var s7;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(s7||={});var c7;(function(e){e.Optimized=`optimized`})(c7||={});var l7=new Map;function oDe(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,z.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,z.useRef)(e),d=g(),f=r5(d),p=(0,z.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,z.useRef)(null),h=i5(t=>{if(d&&!n)return l7;if(!t||t===l7||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new U5(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,z.useEffect)(()=>{u.current=e},[e]),(0,z.useEffect)(()=>{d||p()},[n,d]),(0,z.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,z.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case s7.Always:return!1;case s7.BeforeDragging:return n;default:return!n}}}function u7(e,t){return i5(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function sDe(e,t){return u7(e,t)}function cDe(e){let{callback:t,disabled:n}=e,r=n5(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function d7(e){let{callback:t,disabled:n}=e,r=n5(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function lDe(e){return new U5(A5(e),e)}function f7(e,t,n){t===void 0&&(t=lDe);let[r,i]=(0,z.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=cDe({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=d7({callback:a});return t5(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function uDe(e){return O5(e,u7(e))}var p7=[];function dDe(e){let t=(0,z.useRef)(e),n=i5(n=>e?n&&n!==p7&&e&&t.current&&e.parentNode===t.current.parentNode?n:M5(e):p7,[e]);return(0,z.useEffect)(()=>{t.current=e},[e]),n}function fDe(e){let[t,n]=(0,z.useState)(null),r=(0,z.useRef)(e),i=(0,z.useCallback)(e=>{let t=P5(e.target);t&&n(e=>e?(e.set(t,L5(t)),new Map(e)):null)},[]);return(0,z.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=P5(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,L5(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{P5(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,z.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>u5(e,t),x5):V5(e):x5,[e,t])}function m7(e,t){t===void 0&&(t=[]);let n=(0,z.useRef)(null);return(0,z.useEffect)(()=>{n.current=null},t),(0,z.useEffect)(()=>{let t=e!==x5;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?d5(e,n.current):x5}function pDe(e){(0,z.useEffect)(()=>{if(!q8)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function mDe(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function h7(e){return(0,z.useMemo)(()=>e?VEe(e):null,[e])}var g7=[];function hDe(e,t){t===void 0&&(t=A5);let[n]=e,r=h7(n?X8(n):null),[i,a]=(0,z.useState)(g7);function o(){a(()=>e.length?e.map(e=>z5(e)?r:new U5(t(e),e)):g7)}let s=d7({callback:o});return t5(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function _7(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Q8(t)?t:e}function gDe(e){let{measure:t}=e,[n,r]=(0,z.useState)(null),i=d7({callback:(0,z.useCallback)(e=>{for(let{target:n}of e)if(Q8(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=a5((0,z.useCallback)(e=>{let n=_7(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,z.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var _De=[{sensor:e7,options:{}},{sensor:X5,options:{}}],vDe={current:{}},v7={draggable:{measure:j5},droppable:{measure:j5,strategy:s7.WhileDragging,frequency:c7.Optimized},dragOverlay:{measure:A5}},y7=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},yDe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new y7,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:v5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:v7,measureDroppableContainers:v5,windowRect:null,measuringScheduled:!1},b7={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:v5,draggableNodes:new Map,over:null,measureDroppableContainers:v5},x7=(0,z.createContext)(b7),S7=(0,z.createContext)(yDe);function bDe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new y7}}}function xDe(e,t){switch(t.type){case _5.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case _5.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case _5.DragEnd:case _5.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case _5.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new y7(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case _5.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new y7(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case _5.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new y7(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function SDe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,z.useContext)(x7),a=o5(r),o=o5(n?.id);return(0,z.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!f5(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=yEe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function C7(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function CDe(e){return(0,z.useMemo)(()=>({draggable:{...v7.draggable,...e?.draggable},droppable:{...v7.droppable,...e?.droppable},dragOverlay:{...v7.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function wDe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,z.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;t5(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=O5(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=N5(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var w7=(0,z.createContext)({...x5,scaleX:1,scaleY:1}),T7;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(T7||={});var E7=(0,z.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=_De,collisionDetection:o=NEe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,z.useReducer)(xDe,void 0,bDe),[f,p]=TEe(),[m,h]=(0,z.useState)(T7.Uninitialized),g=m===T7.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,z.useRef)({initial:null,translated:null}),C=(0,z.useMemo)(()=>_==null?null:{id:_,data:x?.data??vDe,rect:S},[_,x]),w=(0,z.useRef)(null),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),k=r5(l,Object.values(l)),A=c5(`DndDescribedBy`,t),ee=(0,z.useMemo)(()=>b.getEnabled(),[b]),j=CDe(s),{droppableRects:M,measureDroppableContainers:te,measuringScheduled:N}=oDe(ee,{dragging:g,dependencies:[y.x,y.y],config:j.droppable}),P=iDe(v,_),ne=(0,z.useMemo)(()=>D?p5(D):null,[D]),re=Pe(),ie=sDe(P,j.draggable.measure);wDe({activeNode:_==null?null:v.get(_),config:re.layoutShiftCompensation,initialRect:ie,measure:j.draggable.measure});let ae=f7(P,j.draggable.measure,ie),oe=f7(P?P.parentElement:null),se=(0,z.useRef)({activatorEvent:null,active:null,activeNode:P,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=b.getNodeFor(se.current.over?.id),le=gDe({measure:j.dragOverlay.measure}),ue=le.nodeRef.current??P,de=g?le.rect??ae:null,fe=!!(le.nodeRef.current&&le.rect),pe=uDe(fe?null:ae),me=h7(ue?X8(ue):null),he=dDe(g?ce??P:null),ge=hDe(he),_e=C7(c,{transform:{x:y.x-pe.x,y:y.y-pe.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:de,over:se.current.over,overlayNodeRect:le.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=ne?u5(ne,y):null,ye=fDe(he),be=m7(ye),xe=m7(ye,[ae]),Se=u5(_e,be),Ce=de?REe(de,_e):null,we=C&&Ce?o({active:C,collisionRect:Ce,droppableRects:M,droppableContainers:ee,pointerCoordinates:ve}):null,Te=T5(we,`id`),[Ee,De]=(0,z.useState)(null),Oe=IEe(fe?_e:u5(_e,xe),Ee?.rect??null,ae),ke=(0,z.useRef)(null),Ae=(0,z.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;ke.current=new n({active:w.current,activeNode:i,event:a,options:r,context:se,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Bv.unstable_batchedUpdates)(()=>{r?.(i),h(T7.Initializing),d({type:_5.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(ke.current),O(a)})},onMove(e){d({type:_5.DragMove,coordinates:e})},onEnd:o(_5.DragEnd),onCancel:o(_5.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=se.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===_5.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=_5.DragCancel)}w.current=null,(0,Bv.unstable_batchedUpdates)(()=>{d({type:e}),h(T7.Uninitialized),De(null),E(null),O(null),ke.current=null;let t=e===_5.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),je=aDe(a,(0,z.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Ae(n,t))},[v,Ae]));pDe(a),t5(()=>{ae&&m===T7.Initializing&&h(T7.Initialized)},[ae,m]),(0,z.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=se.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:Se.x,y:Se.y},over:i};(0,Bv.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[Se.x,Se.y]),(0,z.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=se.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Te),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Bv.unstable_batchedUpdates)(()=>{De(s),a?.(c),f({type:`onDragOver`,event:c})})},[Te]),t5(()=>{se.current={activatorEvent:D,active:C,activeNode:P,collisionRect:Ce,collisions:we,droppableRects:M,draggableNodes:v,draggingNode:ue,draggingNodeRect:de,droppableContainers:b,over:Ee,scrollableAncestors:he,scrollAdjustedTranslate:Se},S.current={initial:de,translated:Ce}},[C,P,we,Ce,v,ue,de,M,b,Ee,he,Se]),tDe({...re,delta:y,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Me=(0,z.useMemo)(()=>({active:C,activeNode:P,activeNodeRect:ae,activatorEvent:D,collisions:we,containerNodeRect:oe,dragOverlay:le,draggableNodes:v,droppableContainers:b,droppableRects:M,over:Ee,measureDroppableContainers:te,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:j,measuringScheduled:N,windowRect:me}),[C,P,ae,D,we,oe,le,v,b,M,Ee,te,he,ge,j,N,me]),Ne=(0,z.useMemo)(()=>({activatorEvent:D,activators:je,active:C,activeNodeRect:ae,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:Ee,measureDroppableContainers:te}),[D,je,C,ae,d,A,v,Ee,te]);return z.createElement(g5.Provider,{value:p},z.createElement(x7.Provider,{value:Ne},z.createElement(S7.Provider,{value:Me},z.createElement(w7.Provider,{value:Oe},i)),z.createElement(SDe,{disabled:n?.restoreFocus===!1})),z.createElement(OEe,{...n,hiddenTextDescribedById:A}));function Pe(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),TDe=(0,z.createContext)(null),D7=`button`,EDe=`Draggable`;function DDe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=c5(EDe),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,z.useContext)(x7),{role:p=D7,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,z.useContext)(g?w7:TDe),[v,y]=a5(),[b,x]=a5(),S=mDe(o,t),C=r5(n);return t5(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,z.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===D7?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function O7(){return(0,z.useContext)(S7)}var ODe=`Droppable`,kDe={timeout:25};function k7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=c5(ODe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,z.useContext)(x7),u=(0,z.useRef)({disabled:n}),d=(0,z.useRef)(!1),f=(0,z.useRef)(null),p=(0,z.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...kDe,...i},_=r5(h??r),v=d7({callback:(0,z.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=a5((0,z.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=r5(t);return(0,z.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,z.useEffect)(()=>(s({type:_5.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:_5.UnregisterDroppable,key:a,id:r})),[r]),(0,z.useEffect)(()=>{n!==u.current.disabled&&(s({type:_5.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function ADe(e){let{animation:t,children:n}=e,[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(null),s=o5(n);return!n&&!r&&s&&i(s),t5(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),z.createElement(z.Fragment,null,n,r?(0,z.cloneElement)(r,{ref:o}):null)}var jDe={x:0,y:0,scaleX:1,scaleY:1};function MDe(e){let{children:t}=e;return z.createElement(x7.Provider,{value:b7},z.createElement(w7.Provider,{value:jDe},t))}var NDe={position:`fixed`,touchAction:`none`},PDe=e=>f5(e)?`transform 250ms ease`:void 0,FDe=(0,z.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=PDe}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...NDe,width:s.width,height:s.height,top:s.top,left:s.left,transform:m5.Transform.toString(d),transformOrigin:i&&r?kEe(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return z.createElement(n,{className:o,style:f,ref:t},a)}),IDe={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:m5.Transform.toString(t)},{transform:m5.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function LDe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return n5((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=_7(a);if(!c)return;let{transform:l}=X8(a).getComputedStyle(a),u=k5(l);if(!u)return;let d=typeof t==`function`?t:RDe(t);return H5(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function RDe(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...IDe,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var A7=0;function zDe(e){return(0,z.useMemo)(()=>{if(e!=null)return A7++,A7},[e])}var j7=z.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=O7(),S=(0,z.useContext)(w7),C=zDe(d?.id),w=C7(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=u7(f),E=LDe({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return z.createElement(MDe,null,z.createElement(ADe,{animation:E},d&&C?z.createElement(FDe,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))}),BDe=e=>{let{transform:t}=e;return{...t,y:0}};function VDe(e,t,n){let r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}var HDe=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:VDe(n,t,i)},UDe=e=>{let{transform:t}=e;return{...t,x:0}};function M7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function WDe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function N7(e){return e!==null&&e>=0}function GDe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function KDe(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var P7={scaleX:1,scaleY:1},qDe=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=JDe(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...P7}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...P7}:a<r&&a>=i?{x:o.width+s,y:0,...P7}:{x:0,y:0,...P7}};function JDe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var F7=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=M7(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},I7={scaleX:1,scaleY:1},L7=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...I7}:null}let s=YDe(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...I7}:r<t&&r>=a?{x:0,y:o.height+s,...I7}:{x:0,y:0,...I7}};function YDe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var R7=`Sortable`,z7=z.createContext({activeIndex:-1,containerId:R7,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:F7,disabled:{draggable:!1,droppable:!1}});function B7(e){let{children:t,id:n,items:r,strategy:i=F7,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=O7(),d=c5(R7,n),f=s.rect!==null,p=(0,z.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,z.useRef)(p),v=!GDe(p,_.current),y=g!==-1&&h===-1||v,b=KDe(a);t5(()=>{v&&m&&u(p)},[v,p,m,u]),(0,z.useEffect)(()=>{_.current=p},[p]);let x=(0,z.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:WDe(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return z.createElement(z7.Provider,{value:x},t)}var XDe=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return M7(n,r,i).indexOf(t)},ZDe=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},QDe={duration:200,easing:`ease`},V7=`transform`,$De=m5.Transition.toString({property:V7,duration:0,easing:`linear`}),eOe={roleDescription:`sortable`};function tOe(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,z.useState)(null),s=(0,z.useRef)(n);return t5(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=A5(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,z.useEffect)(()=>{a&&o(null)},[a]),a}function H7(e){let{animateLayoutChanges:t=ZDe,attributes:n,disabled:r,data:i,getNewIndex:a=XDe,id:o,strategy:s,resizeObserverConfig:c,transition:l=QDe}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,z.useContext)(z7),y=nOe(r,p),b=u.indexOf(o),x=(0,z.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,z.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=k7({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:ee,listeners:j,isDragging:M,over:te,setActivatorNodeRef:N,transform:P}=DDe({id:o,data:x,attributes:{...eOe,...n},disabled:y.draggable}),ne=hEe(E,ee),re=!!D,ie=re&&!m&&N7(f)&&N7(g),ae=!_&&M,oe=ie?(ae&&ie?P:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,se=N7(f)&&N7(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ce=D?.id,le=(0,z.useRef)({activeId:ce,items:u,newIndex:se,containerId:d}),ue=u!==le.current.items,de=t({active:D,containerId:d,isDragging:M,isSorting:re,id:o,index:b,items:u,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),fe=tOe({disabled:!de,index:b,node:w,rect:C});return(0,z.useEffect)(()=>{re&&le.current.newIndex!==se&&(le.current.newIndex=se),d!==le.current.containerId&&(le.current.containerId=d),u!==le.current.items&&(le.current.items=u)},[re,se,d,u]),(0,z.useEffect)(()=>{if(ce===le.current.activeId)return;if(ce!=null&&le.current.activeId==null){le.current.activeId=ce;return}let e=setTimeout(()=>{le.current.activeId=ce},50);return()=>clearTimeout(e)},[ce]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:se,items:u,isOver:T,isSorting:re,isDragging:M,listeners:j,node:w,overIndex:g,over:te,setNodeRef:ne,setActivatorNodeRef:N,setDroppableNodeRef:E,setDraggableNodeRef:ee,transform:fe??oe,transition:pe()};function pe(){if(fe||ue&&le.current.newIndex===b)return $De;if(!(ae&&!f5(O)||!l)&&(re||de))return m5.Transition.toString({...l,property:V7})}}function nOe(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function U7(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var rOe=[J5.Down,J5.Right,J5.Up,J5.Left],W7=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(rOe.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case J5.Down:r.top<a.top&&t.push(n);break;case J5.Up:r.top>a.top&&t.push(n);break;case J5.Left:r.left>a.left&&t.push(n);break;case J5.Right:r.left<a.left&&t.push(n);break}});let c=D5({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=T5(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=M5(c).some((e,t)=>s[t]!==e),i=G7(e,t),a=iOe(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:d5(u,l)}}}};function G7(e,t){return!U7(e)||!U7(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function iOe(e,t){return!U7(e)||!U7(t)||!G7(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function K7({open:e,onOpenChange:t,title:n,description:r,children:i,onSubmit:a,submitLabel:o,submitting:s=!1,canSubmit:c=!0}){let[l,u]=(0,z.useState)(!1),d=s||l;async function f(){if(!(!c||d))try{u(!0),await a()}finally{u(!1)}}return(0,B.jsx)(M6,{open:e,onOpenChange:t,children:(0,B.jsxs)(N6,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,B.jsxs)(P6,{className:`border-b px-6 py-4`,children:[(0,B.jsx)(I6,{children:n}),r?(0,B.jsx)(L6,{children:r}):null]}),(0,B.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,B.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:i}),(0,B.jsxs)(F6,{className:`border-t px-6 py-4`,children:[(0,B.jsxs)(Lh,{type:`submit`,disabled:!c||d,children:[d?(0,B.jsx)(Hy,{className:`size-4 animate-spin`}):null,o??Mi()]}),(0,B.jsx)(Lh,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:nr()})]})]})]})})}var q7=[{value:`red`,hue:`var(--oc-accent-red, oklch(0.63 0.21 25))`},{value:`orange`,hue:`var(--oc-accent-orange, oklch(0.7 0.17 50))`},{value:`amber`,hue:`var(--oc-accent-amber, oklch(0.8 0.15 85))`},{value:`green`,hue:`var(--oc-accent-green, oklch(0.7 0.16 150))`},{value:`teal`,hue:`var(--oc-accent-teal, oklch(0.7 0.12 190))`},{value:`blue`,hue:`var(--oc-accent-blue, oklch(0.62 0.19 250))`},{value:`violet`,hue:`var(--oc-accent-violet, oklch(0.6 0.2 300))`},{value:`pink`,hue:`var(--oc-accent-pink, oklch(0.7 0.2 350))`}],J7=e=>q7.find(t=>t.value===e)?.hue??null;function aOe(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return q7[t%q7.length].hue}var Y7=e=>J7(e.color)??aOe(e._id);function X7({open:e,onOpenChange:t,title:n,movingFolderId:r,currentId:i,onPick:a}){let o=I(L.projects.listProjects,e?{}:`skip`),[s,c]=(0,z.useState)(``),l=(0,z.useMemo)(()=>{let e=o??[],t=nSe(e),n=s.trim().toLowerCase();return(n===``?t:t.filter(e=>e.node.name.toLowerCase().includes(n))).map(t=>({...t,disabled:r!==void 0&&!i3(e,r,t.node._id)}))},[o,s,r]),u=()=>{t(!1),c(``)};return(0,B.jsx)(o0,{open:e,onOpenChange:e=>{e||c(``),t(e)},children:(0,B.jsxs)(s0,{className:`oc-folderpick`,showCloseButton:!1,children:[(0,B.jsx)(c0,{children:(0,B.jsx)(u0,{children:n})}),(0,B.jsx)(yF,{autoFocus:!0,value:s,onChange:e=>c(e.target.value),placeholder:$c()}),(0,B.jsxs)(`div`,{className:`oc-folderpick__list`,role:`listbox`,children:[(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i===null,className:`oc-folderpick__opt`,onClick:()=>{a(null),u()},children:[(0,B.jsx)(vy,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:zl()}),i===null?(0,B.jsx)(oy,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]}),l.length===0?(0,B.jsx)(`p`,{className:`oc-folderpick__empty`,children:Nee()}):l.map(({node:e,depth:t,disabled:n})=>(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e._id===i,disabled:n,className:`oc-folderpick__opt`,style:{"--pick-depth":t-1,"--proj-hue":Y7(e)},onClick:()=>{a(e._id),u()},children:[(0,B.jsx)(My,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:e.name}),e._id===i?(0,B.jsx)(oy,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]},e._id))]})]})})}var Z7=6e4,Q7=60*Z7,$7=24*Q7,e9=7*$7,t9=30*$7,n9=365*$7;function r9(e,t){let n=t-e;if(n<Z7)return`maintenant`;if(n<Q7)return`${Math.floor(n/Z7)}min`;if(n<$7)return`${Math.floor(n/Q7)}h`;if(n<e9)return`${Math.floor(n/$7)}j`;if(n<t9)return`${Math.floor(n/e9)}sem`;if(n<n9)return`${Math.floor(n/t9)}mois`;let r=Math.floor(n/n9);return`${r}an${r>1?`s`:``}`}var i9=`project:none`,oOe=e=>`project:${e}`,a9=`projhead:`,o9=e=>`${a9}${e}`,s9=`oc.noproject.collapsed`;function c9(){return(0,B.jsx)(`div`,{className:`oc-sidebar__skeleton`,"aria-hidden":`true`,children:Array.from({length:7}).map((e,t)=>(0,B.jsx)(`div`,{className:`oc-skel oc-skel--row`},t))})}function sOe({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=I(L.messages.listChats,{}),a=I(L.projects.listProjects,{}),o=I(L.me.getMe,{host:o3})?.ui?.effective?.showChatAge??!0,s=I(L.chatReads.myChatReads,{}),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of s??[])e.set(t.chatId,t.lastSeenAt);return e},[s]),l=I(L.chatReads.myBusyChats,{}),u=(0,z.useMemo)(()=>new Set(l??[]),[l]),d=I(L.chatBookmarks.myBookmarkedChats,{}),f=I(L.chatExport.referenceLabel,{}),p=(0,z.useMemo)(()=>new Set(d??[]),[d]),m=(0,z.useMemo)(()=>{let t=new Set;for(let n of i??[]){if(n._id===e)continue;let r=c.get(n._id);r!==void 0&&n.lastAssistantAt!==null&&n.lastAssistantAt>r&&t.add(n._id)}return t},[i,c,e]),[h,g]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>g(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let _=Ns(L.projects.createProject),v=Ns(L.projects.setProjectCollapsed),y=Ns(L.projects.setProjectSidebar),b=Ns(L.chats.reorderChat),x=Ns(L.projects.reorderProject),S=Ns(L.chats.moveChatToProject),C=V3(),w=Wd(),T=(0,z.useRef)(null),E=(0,z.useRef)(null),D=(0,z.useRef)(null),[O,k]=(0,z.useState)(`full`);(0,z.useLayoutEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=E.current?.offsetWidth??0,r=D.current?.offsetWidth??0,i=n===0||t>=n?`full`:t>=r?`label`:`icon`;k(e=>e===i?e:i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[w,r]);let[A,ee]=(0,z.useState)(null),j=(0,z.useRef)(!1);(0,z.useEffect)(()=>{!j.current&&i&&ee(i)},[i]);let M=A??i??[],te=i===void 0&&A===null,[N,P]=(0,z.useState)(null),[ne,re]=(0,z.useState)(()=>localStorage.getItem(s9)===`1`);function ie(){re(e=>(localStorage.setItem(s9,e?`0`:`1`),!e))}let ae=J3();(0,z.useEffect)(()=>{if(!ae?.expand)return;let e=M.find(e=>e._id===ae.chatId);if(!e)return;let t=e.projectId??null;if(t===null){ne&&(localStorage.setItem(s9,`0`),re(!1));return}let n=(a??[]).find(e=>e._id===t);n&&n.parentId!==null||n?.collapsed&&v({projectId:t,collapsed:!1})},[ae,M,a,ne,v]);let oe=b5(y5(n7,{activationConstraint:{distance:4}}),y5(i7,{activationConstraint:{delay:250,tolerance:8}}),y5(X5,{coordinateGetter:W7})),se=(0,z.useRef)(!1),ce=()=>{se.current=!0,setTimeout(()=>{se.current=!1},0)},le=(0,z.useCallback)(e=>String(e.active.id).startsWith(a9)?D5({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(a9))}):D5(e),[]),ue=M.filter(e=>e.pinned),de=M.filter(e=>!e.pinned),fe=e=>de.filter(t=>(t.projectId??null)===e),pe=Rv(),me=(0,z.useMemo)(()=>Qxe(a??[]),[a]),he=(0,z.useMemo)(()=>me.filter(e=>!e.sidebarHidden),[me]),ge=(0,z.useMemo)(()=>me.filter(e=>e.sidebarHidden),[me]),_e=(0,z.useMemo)(()=>{let e=a??[];return new Map(e.map(t=>[t._id,tSe(e,t._id)]))},[a]),ve=(0,z.useMemo)(()=>new Map((a??[]).map(e=>[e._id,e.name])),[a]),ye=e=>de.filter(t=>t.projectId!==null&&(_e.get(t.projectId)??t.projectId)===e);function be(e){return M.find(t=>t._id===e)}async function xe(e){P(null),ce();let{active:t,over:n}=e;if(!n)return;let r=String(t.id),i=String(n.id);if(r.startsWith(a9)){let e=r.slice(9),t=he,n=null;if(i.startsWith(a9))n=i.slice(9);else if(i.startsWith(`project:`)&&i!==i9)n=i.slice(8);else{let e=be(i);n=e&&!e.pinned?e.projectId??null:null}if(n===null||n===e)return;let a=t.findIndex(t=>t._id===e),o=t.findIndex(e=>e._id===n);if(a<0||o<0)return;let s=[...t],[c]=s.splice(a,1);s.splice(o,0,c);let l=s[o-1]??null,u=s[o+1]??null;await x({projectId:e,prevKey:l?l.sortKey:null,nextKey:u?u.sortKey:null});return}let a=be(r);if(!a)return;if(i.startsWith(a9)){let e=i.slice(9);if((a.projectId??null)===e)return;j.current=!0,ee(t=>(t??M).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await S({chatId:a._id,projectId:e})}finally{j.current=!1}return}if(i.startsWith(`project:`)){let e=i===i9?null:i.slice(8);if((a.projectId??null)===e)return;j.current=!0,ee(t=>(t??M).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await S({chatId:a._id,projectId:e})}finally{j.current=!1}return}let o=be(i);if(!o||t.id===n.id)return;if((o.projectId??null)!==(a.projectId??null)||o.pinned!==a.pinned){if(a.pinned||o.pinned)return;j.current=!0,ee(e=>(e??M).map(e=>e._id===a._id?{...e,projectId:o.projectId??null}:e));try{await S({chatId:a._id,projectId:o.projectId??null})}finally{j.current=!1}return}let s=o.pinned?ue:fe(o.projectId??null),c=s.map(e=>e._id),l=c.indexOf(a._id),u=c.indexOf(o._id);if(l<0||u<0)return;let d=[...s];d.splice(l,1),d.splice(u,0,a);let f=d[u-1]??null,p=d[u+1]??null;j.current=!0,ee(e=>[...(e??M).filter(e=>!s.some(t=>t._id===e._id)),...d]);try{await b({chatId:a._id,prevKey:f?f.sortKey:null,nextKey:p?p.sortKey:null})}finally{j.current=!1}}let Se=K8(),Ce=Se?pEe(Se.state):null,[we,Te]=(0,z.useState)(!1),Ee=N?be(N):null;return(0,B.jsxs)(`aside`,{className:`oc-sidebar`+(we?` oc-sidebar--archivedrop`:``),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),Te(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Te(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes(`Files`))return;e.preventDefault(),Te(!1);let t=e.dataTransfer.files[0];t!==void 0&&Se?.importArchive(t,null)},children:[we?(0,B.jsxs)(`div`,{className:`oc-sidebar__droparchive`,"aria-hidden":!0,children:[(0,B.jsx)(Ab,{className:`size-4`}),(0,B.jsx)(`span`,{children:mc()})]}):null,Ce===null?null:(0,B.jsxs)(`div`,{className:`oc-sidebar__transfer`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-spin`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-label`,children:Ce})]}),(0,B.jsxs)(`div`,{className:`oc-sidebar__top`,ref:T,children:[(0,B.jsxs)(Lh,{className:O===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,title:`${w} (${r})`,"aria-label":w,children:[(0,B.jsx)(db,{}),O===`icon`?null:(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w}),O===`full`?(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,"aria-hidden":!0,children:r}):null]}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:E,children:[(0,B.jsxs)(Lh,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(db,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w}),(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,B.jsx)(Lh,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(Ay,{})})]})}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:D,children:[(0,B.jsxs)(Lh,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(db,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w})]}),(0,B.jsx)(Lh,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(Ay,{})})]})}),(0,B.jsx)(Lh,{className:`oc-newproject`,variant:`outline`,size:`icon`,"aria-label":Fc(),title:Fc(),onClick:async()=>{let e=await C({title:Fc(),label:sm(),placeholder:Xf(),confirmLabel:Qs()});e&&await _({name:e})},children:(0,B.jsx)(Ay,{})})]}),(0,B.jsxs)(E7,{sensors:oe,collisionDetection:le,modifiers:[UDe,HDe],onDragStart:e=>P(String(e.active.id)),onDragCancel:()=>{P(null),ce()},onDragEnd:xe,children:[(0,B.jsx)(`div`,{className:`oc-sidebar__scroll`,children:te?(0,B.jsx)(c9,{}):(0,B.jsxs)(B.Fragment,{children:[ue.length>0?(0,B.jsx)(l9,{label:Yu(),chats:ue,children:ue.map(n=>(0,B.jsx)(u9,{chat:n,active:n._id===e,unread:m.has(n._id),busy:u.has(n._id),bookmarked:p.has(n._id),referenceLabel:f,ageTick:h,suppressClick:se,onSelect:t},n._id))}):null,(0,B.jsx)(B7,{items:he.map(e=>o9(e._id)),strategy:L7,children:he.map(n=>{let r=ye(n._id);return(0,B.jsx)(l9,{label:n.name,dropId:oOe(n._id),sortId:o9(n._id),suppressClick:se,projectId:n._id,project:n,chats:r,collapsible:!0,collapsed:n.collapsed,busy:r.some(e=>u.has(e._id)),unread:r.some(e=>m.has(e._id)),onToggle:()=>void v({projectId:n._id,collapsed:!n.collapsed}),onOpen:()=>void pe({to:`/project/$projectId`,params:{projectId:n._id}}),children:n.collapsed?null:r.length===0?(0,B.jsx)(`div`,{className:`oc-sidebar__empty`,children:em()}):r.map(r=>(0,B.jsx)(u9,{chat:r,active:r._id===e,unread:m.has(r._id),busy:u.has(r._id),bookmarked:p.has(r._id),referenceLabel:f,domainLabel:r.projectId!==null&&r.projectId!==n._id?ve.get(r.projectId)??null:null,ageTick:h,suppressClick:se,onSelect:t},r._id))},n._id)})}),ge.length>0?(0,B.jsxs)(fF,{children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`oc-sidebar__hiddenfolders`,children:[(0,B.jsx)(wy,{className:`size-3.5`,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:Zp({count:ge.length})})]})}),(0,B.jsx)(mF,{align:`start`,className:`w-56`,children:ge.map(e=>(0,B.jsxs)(hF,{onSelect:()=>void y({projectId:e._id,hidden:!1}),children:[(0,B.jsx)(ky,{}),` `,e.name]},e._id))})]}):null,(0,B.jsx)(l9,{label:jf(),dropId:i9,chats:fe(null),collapsible:!0,collapsed:ne,busy:fe(null).some(e=>u.has(e._id)),unread:fe(null).some(e=>m.has(e._id)),onToggle:ie,children:ne?null:fe(null).map(n=>(0,B.jsx)(u9,{chat:n,active:n._id===e,unread:m.has(n._id),busy:u.has(n._id),bookmarked:p.has(n._id),referenceLabel:f,ageTick:h,suppressClick:se,onSelect:t},n._id))})]})}),(0,B.jsxs)(j7,{children:[N?.startsWith(a9)?(()=>{let e=(a??[]).find(e=>o9(e._id)===N);return e?(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head oc-chatitem--overlay`,style:{"--proj-hue":Y7(e)},children:[(0,B.jsx)(sy,{className:`size-3.5 shrink-0 oc-sidebar__group-chev`}),(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e.name})]}):null})():null,Ee?(0,B.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[J7(Ee.color)?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:J7(Ee.color)}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsx)(`span`,{className:`oc-chatitem__label`,children:Ee.title||_m()})]}):null]})]})]})}function l9({label:e,dropId:t,sortId:n,suppressClick:r,projectId:i,project:a,chats:o,collapsible:s,collapsed:c,busy:l,unread:u,onToggle:d,onOpen:f,children:p}){let m=Ns(L.projects.setProjectSidebar),h=K8(),g=Ns(L.projects.deleteProject),_=Ns(L.projects.renameProject),v=Ns(L.projects.setProjectColor),y=Ns(L.projects.moveProject),b=B3(),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(e),[T,E]=(0,z.useState)(!1),D=I(L.projects.projectTreeCount,i?{projectId:i}:`skip`),{setNodeRef:O,isOver:k}=k7({id:t??`static:${e}`}),A=H7({id:n??`static-sort:${e}`,disabled:!n}),{onKeyDown:ee,...j}=A.listeners??{},M=f??d,te=e=>{e.target===e.currentTarget&&s&&M&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),M())},N=a?Y7(a):null;return(0,B.jsxs)(`div`,{ref:e=>{t&&O(e),n&&A.setNodeRef(e)},className:`oc-sidebar__group`+(k?` oc-sidebar__group--over`:``)+(a?` oc-sidebar__group--project`:``),style:{...N?{"--proj-hue":N}:{},...n?{transform:m5.Transform.toString(A.transform),transition:A.transition,opacity:A.isDragging?.35:1}:{}},children:[(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head group/head`+(s?` oc-sidebar__group-head--btn`:``),...s?{role:`button`,tabIndex:0,onClick:()=>{r?.current||M?.()},onKeyDown:te}:{},...n?j:{},children:[s?f?(0,B.jsx)(`button`,{type:`button`,className:`oc-sidebar__group-chevbtn`,"aria-label":c?Tr():ld(),"aria-expanded":!c,onClick:e=>{e.stopPropagation(),!r?.current&&d?.()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:c?(0,B.jsx)(ly,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(sy,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)})}):c?(0,B.jsx)(ly,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(sy,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):null,(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Yf(),onClick:e=>e.stopPropagation(),...A.attributes,onKeyDown:ee,children:(0,B.jsx)(Iy,{className:`size-3.5`})}):null,c&&l?(0,B.jsx)(`span`,{className:`oc-chatitem__busy`,title:yl(),"aria-label":yl()}):null,c&&u?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:Mn(),"aria-label":Mn()}):null,i?(0,B.jsxs)(fF,{children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsx)(Lh,{variant:`ghost`,size:`icon-xs`,"aria-label":wi(),className:`oc-sidebar__group-menu opacity-0 group-hover/head:opacity-100 group-focus-within/head:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(xy,{})})}),(0,B.jsxs)(mF,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[f?(0,B.jsxs)(hF,{onSelect:()=>f(),children:[(0,B.jsx)(ky,{}),` `,on()]}):null,(0,B.jsxs)(hF,{onSelect:()=>{w(e),S(!0)},children:[(0,B.jsx)(ob,{}),` `,Ju()]}),(0,B.jsxs)(hF,{onSelect:()=>E(!0),children:[(0,B.jsx)(Ay,{}),` `,Du()]}),a!==void 0&&a.parentId===null?(0,B.jsxs)(hF,{onSelect:()=>void m({projectId:a._id,hidden:!0}),children:[(0,B.jsx)(wy,{}),` `,eo()]}):null,h&&a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(hF,{disabled:h.state.running,onSelect:()=>h.exportFolder(a._id,e),children:[(0,B.jsx)(by,{}),` `,na()]}),(0,B.jsxs)(hF,{disabled:h.state.running,onSelect:()=>h.pickAndImport(a._id),children:[(0,B.jsx)(Ab,{}),` `,mh()]})]}):null,(0,B.jsx)(gF,{children:gm()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void v({projectId:i,color:null}),"aria-label":vl(),children:`✕`}),q7.map(e=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(a?.color===e.value?` is-selected`:``),style:{background:e.hue},"aria-label":e.value,onClick:()=>void v({projectId:i,color:e.value})},e.value))]}),(0,B.jsx)(_F,{}),(0,B.jsxs)(hF,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let t=D?.folders??0,n=D?.chats??0;await b({title:Ht({name:e}),description:t>0?za({folders:t,chats:n}):n>0?yo({count:n}):Pc(),confirmWord:om(),confirmLabel:Yn(),destructive:!0})&&await g({projectId:i})})},children:[(0,B.jsx)(Ob,{}),` `,om()]})]})]}):null]}),(0,B.jsx)(`div`,{className:a&&!c?`oc-sidebar__group-body`:void 0,children:(0,B.jsx)(B7,{items:o.map(e=>e._id),strategy:L7,children:p})}),i?(0,B.jsx)(K7,{open:x,onOpenChange:S,title:ss(),canSubmit:C.trim().length>0,onSubmit:async()=>{await _({projectId:i,name:C.trim()}),S(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:wo()}),(0,B.jsx)(yF,{value:C,onChange:e=>w(e.target.value),autoFocus:!0})]})})}):null,i&&T?(0,B.jsx)(X7,{open:T,onOpenChange:E,title:hp(),movingFolderId:i,currentId:a?.parentId??null,onPick:e=>void y({projectId:i,parentId:e})}):null]})}var u9=(0,z.memo)(function({chat:e,active:t,unread:n,busy:r,bookmarked:i,referenceLabel:a,domainLabel:o,suppressClick:s,onSelect:c}){let l=K8(),{attributes:u,listeners:d,setNodeRef:f,transform:m,transition:h,isDragging:g}=H7({id:e._id}),{onKeyDown:_,...v}=d??{},y=Ns(L.chats.renameChat),b=VF(),x=()=>{if(a===void 0)return;let t=mEe(a,e._id);navigator.clipboard.writeText(t).then(()=>b.success(Oee({reference:t})),()=>b.error(zd()))},S=Ns(L.chats.deleteChat),w=Ns(L.chats.pinChat),T=Ns(L.chats.setChatColor),E=Ns(L.chats.moveChatToProject),D=Ns(L.chats.setChatSidebar),O=Rv(),[k,A]=(0,z.useState)(!1),ee=I(L.me.getMe,{host:o3})?.ui?.effective?.showChatAge??!0,j=B3(),[M,te]=(0,z.useState)(!1),[N,P]=(0,z.useState)(e.title??``),ne=J3()?.chatId===e._id,re=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!ne)return;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;re.current?.scrollIntoView({block:`nearest`,behavior:t?`auto`:`smooth`});let n=setTimeout(()=>q3(e._id),2600);return()=>clearTimeout(n)},[ne,e._id]);let ie={transform:m5.Transform.toString(m),transition:h,opacity:+!g},ae=J7(e.color);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{ref:e=>{f(e),re.current=e},style:ie,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``)+(ne?` oc-chatitem--flash`:``),onClick:()=>{s.current||c(e._id)},...v,onAnimationEnd:t=>{ne&&t.animationName===`oc-chatitem-flash`&&q3(e._id)},children:[(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Yf(),onClick:e=>e.stopPropagation(),...u,onKeyDown:_,children:(0,B.jsx)(Iy,{className:`size-3.5`})}),ae?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:ae}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsxs)(`button`,{className:`oc-chatitem__label`,onClick:t=>{t.stopPropagation(),!s.current&&c(e._id)},children:[(0,B.jsx)(`span`,{className:`oc-chatitem__title`,children:e.title||_m()}),o?(0,B.jsx)(`span`,{className:`oc-chatitem__domain`,children:o}):null]}),r?(0,B.jsx)(`span`,{className:`oc-chatitem__busy`,title:C(),"aria-label":C()}):null,n?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:Mn(),"aria-label":Mn()}):null,e.readOnly?(0,B.jsx)(`span`,{className:`oc-chatitem__readonly`,title:jp(),children:(0,B.jsx)(Uy,{size:12,"aria-label":jp()})}):null,i?(0,B.jsx)(`span`,{className:`oc-chatitem__bookmark group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:lp(),children:(0,B.jsx)(ny,{size:12,"aria-label":lp()})}):null,ee?(0,B.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:t0(e.updatedAt),children:r9(e.updatedAt,Date.now())}):null,(0,B.jsxs)(fF,{children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsx)(Lh,{variant:`ghost`,size:`icon-xs`,"aria-label":Zs(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(xy,{})})}),(0,B.jsxs)(mF,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(hF,{onSelect:()=>{P(e.title??``),te(!0)},children:[(0,B.jsx)(ob,{}),` `,Ju()]}),l?(0,B.jsxs)(hF,{disabled:l.state.running,onSelect:()=>l.exportChat(e._id,e.title??jf()),children:[(0,B.jsx)(by,{}),` `,Pe()]}):null,(0,B.jsxs)(hF,{onSelect:()=>void w({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,B.jsx)(lb,{}):(0,B.jsx)(cb,{}),e.pinned?$p():Af()]}),(0,B.jsxs)(hF,{onSelect:x,disabled:a===void 0,children:[(0,B.jsx)(By,{}),` `,Jc()]}),(0,B.jsxs)(hF,{onSelect:()=>A(!0),children:[(0,B.jsx)(ky,{}),` `,su()]}),e.projectId===null?null:(0,B.jsxs)(hF,{onSelect:()=>void O({to:`/project/$projectId`,params:{projectId:e.projectId},search:{c:e._id}}),children:[(0,B.jsx)(jy,{}),` `,Dt()]}),e.pinned?null:(0,B.jsxs)(hF,{onSelect:()=>void D({chatId:e._id,hidden:!0}),children:[(0,B.jsx)(nb,{}),` `,eo()]}),(0,B.jsx)(gF,{children:gm()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void T({chatId:e._id,color:null}),"aria-label":vl(),children:`✕`}),q7.map(t=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void T({chatId:e._id,color:t.value})},t.value))]}),(0,B.jsx)(_F,{}),(0,B.jsxs)(hF,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await j({title:p(),description:hi(),confirmLabel:om(),destructive:!0})&&await S({chatId:e._id})})},children:[(0,B.jsx)(Ob,{}),` `,om()]})]})]})]}),(0,B.jsx)(K7,{open:M,onOpenChange:te,title:Qo(),canSubmit:N.trim().length>0,onSubmit:async()=>{await y({chatId:e._id,title:N.trim()}),te(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:wo()}),(0,B.jsx)(yF,{value:N,onChange:e=>P(e.target.value),autoFocus:!0})]})})}),k?(0,B.jsx)(X7,{open:k,onOpenChange:A,title:df(),currentId:e.projectId,onPick:t=>void E({chatId:e._id,projectId:t})}):null]})}),d9=null,f9=0,cOe=400;function lOe(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!d9)try{d9=new e}catch{return null}return d9}function p9(e,t,n,r,i){let a=e.createOscillator(),o=e.createGain();a.type=`sine`,a.frequency.value=t;let s=e.currentTime+n;o.gain.setValueAtTime(1e-4,s),o.gain.linearRampToValueAtTime(i,s+.015),o.gain.exponentialRampToValueAtTime(1e-4,s+r),a.connect(o).connect(e.destination),a.start(s),a.stop(s+r+.02)}function m9(e){let t=Date.now();if(t-f9<cOe)return;let n=lOe();if(!n)return;f9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function uOe(){m9(e=>{p9(e,660,0,.16,.12),p9(e,440,.14,.2,.1)})}function dOe(){m9(e=>{p9(e,880,0,.14,.08)})}function fOe({activeChatId:e}){let t=I(L.messages.listChats,{}),n=Ns(L.chatReads.markChatSeen),r=I(L.me.getMe,{host:o3}),i=r?.ui?.effective?.replySound===!0,a=r?.userId??null,o=(0,z.useRef)(null),s=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(!t)return;s.current!==String(a)&&(s.current=String(a),o.current=null);let r=new Map;for(let e of t)e.lastAssistantAt!==null&&r.set(e._id,e.lastAssistantAt);let c=o.current;if(o.current=r,c===null)return;let l=!1;for(let[t,i]of r){let r=c.get(t);r!==void 0&&i<=r||r===void 0&&Date.now()-i>3e4||(l=!0,t===e&&document.visibilityState===`visible`?n({chatId:t}):t!==e&&K3(t))}l&&i&&dOe()},[t,e,i,n,a]),(0,z.useEffect)(()=>{e&&document.visibilityState===`visible`&&n({chatId:e})},[e,n]),(0,z.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&n({chatId:e})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,n]),null}function h9(e){let t=Ns(L.chats.createChat),n=I(L.agents.listMyAgents),[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(void 0),o=(0,z.useCallback)(async(n,r)=>{e(await t({instanceName:n,agentId:r,projectId:a.current}))},[t,e]);return{startNewChat:(0,z.useCallback)(async e=>{a.current=e?.projectId;let t=n;if(t&&t.length===1&&t[0].state!==`deleted`){await o(t[0].instanceName,t[0].agentId);return}i(!0)},[n,o]),picker:(0,B.jsx)(OSe,{open:r,onOpenChange:i,agents:n,onPick:(e,t)=>{i(!1),o(e,t)}})}}var g9=[`admin`,`user`,`pending`];function _9(){let e=I(L.me.authProviders)?.anonymous===!0,[t,n]=(0,z.useState)(!1),r=I(L.dev.listUsersDev,e?{}:`skip`),i=I(L.me.getImpersonation),a=Ns(L.dev.setMyRole),o=Ns(L.dev.setRole),s=Ns(L.admin.startImpersonation),c=Ns(L.admin.stopImpersonation);if(!e)return null;let l=r?.find(e=>e.isMe),u=l?.role===`admin`,d=i?.impersonating===!0,f=(r??[]).filter(e=>!e.isMe);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:Ie(),children:[(0,B.jsx)(Pb,{size:13}),`DEV`]}),(0,B.jsx)(o0,{open:t,onOpenChange:n,children:(0,B.jsxs)(s0,{children:[(0,B.jsxs)(c0,{children:[(0,B.jsx)(u0,{children:ia()}),(0,B.jsx)(d0,{children:gh()})]}),(0,B.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,B.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[gc({canonical:l?.canonical??`…`}),` `,(0,B.jsx)(UF,{variant:`outline`,children:l?.role??`…`})]}),(0,B.jsx)(`div`,{className:`oc-devsw__roles`,children:g9.map(e=>(0,B.jsx)(Lh,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?tte():e===`user`?Pm():js()},e))})]}),d?(0,B.jsxs)(`div`,{className:`oc-devsw__imp`,children:[cu(),` `,(0,B.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,B.jsx)(Lh,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Ou()})]}):null,(0,B.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,B.jsx)(`p`,{className:`oc-devsw__empty`,children:ff()}):f.map(e=>(0,B.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,B.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,B.jsx)(`select`,{className:`oc-devsw__select`,value:e.role,disabled:!e.canonical,onChange:t=>e.canonical&&void o({canonical:e.canonical,role:t.target.value}),children:g9.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))}),(0,B.jsx)(Lh,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?Bl():el():gp(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:Pee()})]},e.profileId))})]})})]})}function v9({label:e,mode:t,minimal:n=!1}){let{signOut:r}=ng(),i=Ns(L.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(L.me.getMe,{host:o3});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(L.me.getMe,{host:o3},{...n,themeMode:t,resolvedThemeMode:r})}),a=t??`default`;return(0,B.jsxs)(fF,{children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsxs)(Lh,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,B.jsx)(sy,{className:`opacity-60`})]})}),(0,B.jsx)(mF,{align:`end`,className:`w-52`,children:n?(0,B.jsxs)(hF,{onClick:()=>void r(),children:[(0,B.jsx)(Wy,{}),` `,Ut()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(gF,{children:Po()}),(0,B.jsxs)(Kue,{value:a,onValueChange:e=>void i({mode:e==="default"?null:e}),children:[(0,B.jsxs)(vF,{value:`light`,children:[(0,B.jsx)(Tb,{}),` `,Jo()]}),(0,B.jsxs)(vF,{value:`dark`,children:[(0,B.jsx)(eb,{}),` `,Pn()]}),(0,B.jsxs)(vF,{value:`system`,children:[(0,B.jsx)($y,{}),` `,Np()]}),(0,B.jsx)(vF,{value:`default`,children:Zn()})]}),(0,B.jsx)(_F,{}),(0,B.jsxs)(hF,{onClick:()=>void r(),children:[(0,B.jsx)(Wy,{}),` `,Ut()]})]})})]})}var pOe={altered_words:()=>Ri(),incorrect:()=>sr(),incoherence:()=>gn(),formatting:()=>St(),latency:()=>ci(),api_error:()=>Pr(),other:()=>br()},y9=e=>pOe[e]?.()??e,mOe={anomaly_open:kb,anomaly_resolved:fy,feedback_reply:Jy,feedback_resolved:Jy,feedback_new:Jy,curation:Ey,operator_announcement:Ky},hOe={atrium:()=>Td(),assistants:()=>Qr(),platform:()=>Xe()},gOe={investigating:()=>ft(),monitoring:()=>ba(),resolved:()=>Xm()},b9=e=>(e?hOe[e]:void 0)?.()??`?`,_Oe=e=>(e?gOe[e]:void 0)?.()??`?`,x9=e=>{let t=e===void 0?NaN:Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(T()):`?`},vOe={notif_feedback_reply_admin:()=>({title:tn(),body:Za()}),notif_feedback_reply:()=>({title:tn(),body:Za()}),notif_feedback_resolved:()=>({title:mo(),body:Pa()}),notif_feedback_new:e=>({title:_e(),body:fte({reference:e.reference??`?`,category:y9(e.category??`other`)})}),notif_curation_proposed:e=>({title:wp(),body:Un({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:It(),body:lo({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:Aa(),body:Qt({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Ja({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:me({kind:e.kind??`?`}),body:t.body}),notif_operator_maintenance_scheduled:e=>({title:ur(),body:yn({service:b9(e.service),startsAt:x9(e.starts_at),endsAt:x9(e.ends_at)})}),notif_operator_maintenance_completed:e=>({title:Tt(),body:ui({service:b9(e.service),completedAt:x9(e.completed_at)})}),notif_operator_incident_update:e=>({title:Ir(),body:Cr({service:b9(e.service),status:_Oe(e.status),reference:e.reference??`?`})}),notif_operator_subscription_notice:e=>({title:sd(),body:ie({plan:e.plan??`?`,effectiveAt:x9(e.effective_at)})})};function S9(e){let t=e.messageKey?vOe[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:tn(),body:Za()}:e.kind===`feedback_resolved`?{title:mo(),body:Pa()}:{title:e.title,body:e.body}}function yOe(){let e=I(L.notifications.myUnreadCount)??0,t=I(L.notifications.myNotifications),n=I(L.feedback.myFeedback),r=Ns(L.notifications.markRead),i=Ns(L.notifications.markAllRead),a=Ns(L.notifications.clearOne),o=Ns(L.notifications.clearAll),s=Ns(L.feedback.closeMyFeedback),c=Rv(),[l,u]=(0,z.useState)(!1),d=I(L.me.getMe,{host:o3}),f=d?.ui?.effective?.notifSound===!0,p=d?.ui?.effective?.notifSystem===!0,m=d?.userId??null,h=(0,z.useRef)(null),g=(0,z.useRef)(0),_=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!t)return;_.current!==String(m)&&(_.current=String(m),h.current=null,g.current=0);let e=t.reduce((e,t)=>Math.max(e,t.creationTime??0),0);if(h.current===null){h.current=new Set(t.map(e=>String(e._id))),g.current=e;return}let n=h.current,r=t.filter(e=>!n.has(String(e._id))&&(e.creationTime??0)>g.current);for(let e of t)n.add(String(e._id));if(g.current=Math.max(g.current,e),n.size>500){let e=new Set(t.map(e=>String(e._id)));for(let t of n)e.has(t)||n.delete(t)}if(r.length!==0&&(f&&uOe(),p&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=S9(e);try{let r=new Notification(t,{body:n,tag:String(e._id)});r.onclick=()=>window.focus()}catch{}}},[t,f,p,m]);let v=e=>{if(e.unread&&r({notificationId:e._id}),!e.href)return;if(u(!1),e.href.startsWith(`/chat/`)){c({to:`/chat/$chatId`,params:{chatId:e.href.slice(6)}});return}let[t,n]=e.href.split(`?`);c({to:t,search:Object.fromEntries(new URLSearchParams(n??``))})};return(0,B.jsxs)(fF,{open:l,onOpenChange:u,children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?oee({count:e}):Hf(),children:[(0,B.jsx)(ty,{size:18,"aria-hidden":!0}),e>0?(0,B.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,B.jsxs)(mF,{align:`end`,className:`oc-notif`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,B.jsx)(`span`,{children:Us()}),t&&t.length>0?(0,B.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:Bu()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Gp()})]}):null]}),t===void 0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:ls()}):t.length===0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:Cf()}):(0,B.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=mOe[e.kind]??ty,{title:n,body:i}=S9(e);return(0,B.jsxs)(`div`,{className:`oc-notif__item${e.unread?` is-unread`:``}${e.href?` is-link`:``}`,role:e.href?`button`:void 0,tabIndex:e.href?0:void 0,onClick:e.href?()=>v(e):void 0,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,B.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,B.jsx)(`button`,{type:`button`,title:mm(),"aria-label":mm(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,B.jsx)(oy,{size:13})}):null,(0,B.jsx)(`button`,{type:`button`,title:dl(),"aria-label":dl(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,B.jsx)(Sh,{size:13})})]})]}),(0,B.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(T())})]},e._id)})}),n&&n.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:y()}),(0,B.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,B.jsx)(bOe,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function bOe({it:e,onClose:t,onNavigate:n}){let r=VF(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1);async function f(){d(!0);try{await t(c.trim()||void 0)}catch(e){r.error(Kn(),e)}finally{d(!1)}}return(0,B.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(`span`,{className:`oc-notif__title`,children:y9(e.category)}),(0,B.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?Op():e.answered?xi():is()})]}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(T())}),e.thread.length>0?(0,B.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,B.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?Oo():e.authorRole===`agent`?Uo():Ho()}),(0,B.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,e.messageText?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-notif__report-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,B.jsx)(sy,{size:13,"aria-hidden":!0}):(0,B.jsx)(ly,{size:13,"aria-hidden":!0}),Dp()]}),i?(0,B.jsx)(`div`,{className:`oc-notif__report-msg`,children:e.messageText}):null]}):null,(0,B.jsxs)(`div`,{className:`oc-notif__report-actions`,children:[(0,B.jsx)(Wv,{to:`/chat/$chatId`,params:{chatId:e.chatId},search:{m:e.messageId},className:`oc-notif__link`,onClick:n,children:kn()}),o?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:Kn()})]}),o?(0,B.jsxs)(`div`,{className:`oc-notif__close-form`,children:[(0,B.jsx)(`textarea`,{className:`oc-notif__close-input`,rows:2,value:c,onChange:e=>l(e.target.value),placeholder:zt()}),(0,B.jsxs)(`div`,{className:`oc-notif__close-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-confirm`,disabled:u,onClick:()=>void f(),children:po()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:Na()})]})]}):null]})}var C9=2,xOe=180;function SOe(){let e=Rv(),t=(0,z.useRef)(null),n=(0,z.useRef)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(0),d=(0,z.useMemo)(()=>kF(CF,OF()),[]);(0,z.useEffect)(()=>{let e=setTimeout(()=>c(a),xOe);return()=>clearTimeout(e)},[a]);let f=s.trim(),p=I(L.search.searchConversations,f.length>=C9?{query:f}:`skip`),m=p??[],h=f.length>=C9&&p===void 0;(0,z.useEffect)(()=>{let e=e=>{AF(e,CF)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,z.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,z.useEffect)(()=>{u(0)},[p]),(0,z.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let g=(0,z.useCallback)((t,n)=>{i(!1),n&&a.trim()&&j6(n,a.trim()),e({to:`/chat/$chatId`,params:{chatId:t},...n?{search:{m:n}}:{}})},[e,a]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":sc(),children:[(0,B.jsx)(hb,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-search-trigger__label`,children:Jee()}),(0,B.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:d})]}),(0,B.jsx)(o0,{open:r,onOpenChange:i,children:(0,B.jsxs)(s0,{showCloseButton:!1,className:`oc-search-palette top-[12vh] translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,B.jsx)(u0,{className:`sr-only`,children:Vee()}),(0,B.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,B.jsx)(hb,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:t,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,m.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=m[l];t&&g(t.chatId,t.messageId)}},placeholder:ys(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":Xl()})]}),(0,B.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:f.length<C9?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:_u({count:C9})}):h?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:ef()}):m.length===0?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:ap({term:f})}):m.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:Pp(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>g(e.chatId,e.messageId),children:[(0,B.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,B.jsx)(Ly,{size:15}):(0,B.jsx)(Jy,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,B.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||kl()}),e.projectPath&&e.projectPath.length>0?(0,B.jsx)(`span`,{className:`oc-search-result__path`,"aria-label":As(),children:e.projectPath.join(` › `)}):null,e.snippet?(0,B.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,B.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?Gc():Tee()})]},e.chatId))}),(0,B.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↑`}),(0,B.jsx)(`kbd`,{children:`↓`}),` `,Id()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↵`}),` `,Ec()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:aee()}),` `,Vf()]})]})]})})]})}var w9=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`],T9=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`],E9={users:()=>id(),groups:()=>uc(),instances:()=>P(),bridge:()=>Sd(),injections:()=>$o(),serviceAccounts:()=>Yr(),roles:()=>qe(),access:()=>Zee(),traces:()=>lt(),kpi:()=>ga(),anomalies:()=>Km(),files:()=>nte(),scheduled:()=>ln(),agentFiles:()=>es(),preferences:()=>bo(),integrations:()=>Ae(),theme:()=>ca(),chatDefaults:()=>ac(),audit:()=>Qi(),feedbacks:()=>uh(),subagentReports:()=>Dm(),voice:()=>Zl()},D9={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`},COe=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function O9(e){let t=new Set(e);return w9.filter(e=>t.has(D9[e]))}function k9(e){return`/settings/${e}`}function A9(e){let t=e.split(`/`)[2];return w9.includes(t)?t:void 0}var wOe={uiprefs:`preferences`},j9=[{id:`personal`,label:()=>Oa(),tabs:[`preferences`,`theme`,`files`,`scheduled`]},{id:`agents`,label:()=>Xt(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>Ka(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>fe(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],TOe=new Map(j9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function M9(e){let t=TOe.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function EOe(e,t){return e.find(e=>M9(e)===t)}j9.flatMap(e=>[...e.tabs]);function DOe(){let e=I(L.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.gatewaysUnreachable??0,n=e.known?e.available?t>0?`warn`:`ok`:`error`:`idle`,r=e.known?e.available?t>0?ah({count:t}):`${vd()}${e.checkedAt?Gr({time:n0(e.checkedAt)}):``}`:We({reason:e.reason??`?`}):M();return(0,B.jsx)(T6,{delayDuration:150,children:(0,B.jsxs)(E6,{children:[(0,B.jsx)(D6,{asChild:!0,children:(0,B.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,B.jsx)(O6,{children:r})]})})}function N9(e){let t=new Set(w9),n=new Set,r=[];for(let i of e??[])t.has(i)&&!n.has(i)&&(r.push(i),n.add(i));for(let e of w9)n.has(e)||r.push(e);return r}function OOe(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function kOe({tab:e,active:t}){let n=E9[e](),r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,B.jsx)(DOe,{}):null]});return T9.includes(e)?(0,B.jsx)(Wv,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,B.jsx)(Wv,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function AOe({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=H7({id:e});return(0,B.jsxs)(`div`,{ref:i,style:{transform:m5.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":Sp(),...n,...r,children:(0,B.jsx)(Iy,{size:14,"aria-hidden":!0})}),(0,B.jsx)(kOe,{tab:e,active:t})]})}function jOe(){let e=I(L.me.getMe,{host:o3}),t=Ns(L.me.setSettingsTabOrder),n=A9(Qv({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,z.useMemo)(()=>N9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,z.useState)(i);(0,z.useEffect)(()=>o(i),[i]);let s=(0,z.useMemo)(()=>new Set(O9(e?.permissions??[])),[e?.permissions]),c=(0,z.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&M9(e)===r),[a,s,r]),l=b5(y5(e7,{activationConstraint:{distance:5}}),y5(X5,{coordinateGetter:W7}));if(r===void 0||c.length===0)return null;let u=j9.find(e=>e.id===r);function d(e){let{active:n,over:r}=e;if(!r||n.id===r.id)return;let i=c.indexOf(n.id),s=c.indexOf(r.id);if(i<0||s<0)return;let l=OOe(a,M7(c,i,s));o(l),t({order:l})}return(0,B.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,B.jsx)(E7,{sensors:l,collisionDetection:jEe,modifiers:[BDe],onDragEnd:d,children:(0,B.jsx)(B7,{items:c,strategy:qDe,children:c.map(e=>(0,B.jsx)(AOe,{tab:e,active:e===n},e))})})})}function MOe(){let e=I(L.me.getMe,{host:o3}),t=Rv(),n=A9(Qv({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,z.useMemo)(()=>new Set(O9(e?.permissions??[])),[e?.permissions]),a=(0,z.useMemo)(()=>N9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=j9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=EOe(a,e.id);n&&t({to:k9(n)})}return(0,B.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":Vn(),children:[(0,B.jsx)(Wv,{to:`/`,className:`oc-settings-nav__back`,children:Pt()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__title`,children:so()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-nav__group`+(e.id===r?` is-active`:``),"aria-current":e.id===r?`true`:void 0,onClick:()=>s(e),children:e.label()},e.id))})]})}var NOe=[`eq`,`neq`,`contains`,`gt`,`gte`,`lt`,`lte`],P9=[50,100,200,500],F9=`now-30d`,POe=`now-24h`;function FOe(e,t,n=F9,r=`now`){let i=e??n,a=t??r,o=Number(i),s=Number(a);return i!==``&&a!==``&&Number.isFinite(o)&&Number.isFinite(s)?{kind:`absolute`,from:o,to:s}:{kind:`relative`,from:i,to:a}}function IOe(e){return e.kind===`absolute`?{from:String(e.from),to:String(e.to)}:{from:e.from,to:e.to}}function LOe(e){if(e.length!==0)return JSON.stringify(e)}function ROe(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e,r=t.field,i=t.op,a=t.value;typeof r!=`string`||r===``||typeof i!=`string`||!NOe.includes(i)||typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`||n.push({field:r,op:i,value:a})}return n}var I9=F4().optional(),L9=F4().optional(),R9=F4().optional(),z9=F4().optional().catch(void 0),zOe=H4({q:I9,section:G4([`latency`,`events`]).default(`events`).catch(`events`),kind:F4().default(`all`).catch(`all`),correlationId:F4().optional().catch(void 0),limit:Gxe().pipe(U4([K4(P9[0]),K4(P9[1]),K4(P9[2]),K4(P9[3])])).catch(100),statusClass:G4([`2xx`,`4xx`,`5xx`]).optional().catch(void 0),principalType:G4([`user`,`service`,`system`]).optional().catch(void 0),direction:G4([`inbound`,`outbound`,`internal`]).optional().catch(void 0),roleKey:z9,from:L9,to:L9,adv:R9}),BOe=H4({q:I9,action:z9,impersonated:G4([`yes`,`no`]).optional().catch(void 0),resource:z9,from:L9,to:L9,adv:R9}),VOe=H4({q:I9,status:G4([`open`,`acknowledged`,`resolved`,`all`]).default(`open`).catch(`open`),severity:G4([`info`,`warn`,`critical`]).optional().catch(void 0),kind:z9,from:L9,to:L9}),HOe=H4({from:L9,to:L9}),UOe=H4({q:I9,status:G4([`active`,`disabled`]).optional().catch(void 0)}),WOe=H4({q:I9,role:z9});H4({q:I9,mode:G4([`per-user`,`shared`]).optional().catch(void 0)});var GOe=H4({section:G4([`readaloud`,`dictation`,`talk`]).default(`readaloud`).catch(`readaloud`)}),KOe=H4({section:F4().max(32).default(`openclaw`).catch(`openclaw`)}),B9=`oc.theme`;function V9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function H9(e){(0,z.useEffect)(()=>{let t=e??localStorage.getItem(B9)??`system`;if(localStorage.setItem(B9,t),V9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>V9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}var U9=`oc.fontScale`,qOe={sm:`87.5%`,md:``,lg:`112.5%`,xl:`125%`,"2xl":`137.5%`,"3xl":`150%`},W9=[`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`];function JOe(e){return e!==null&&W9.includes(e)}function YOe(e){document.documentElement.style.fontSize=qOe[e]}function G9(e){(0,z.useEffect)(()=>{let t=localStorage.getItem(U9),n=e??(JOe(t)?t:`md`);localStorage.setItem(U9,n),YOe(n)},[e])}function XOe(e){(0,z.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=T()}catch{t=void 0}t!==e&&tl(e)},[e])}var ZOe=(0,z.lazy)(()=>zQ(()=>import(`./RolesTab-2nGoIoBg.js`).then(e=>({default:e.RolesTab})),__vite__mapDeps([2,1,3,4,5]))),QOe=(0,z.lazy)(()=>zQ(()=>import(`./InstancesTab-BTESpzxw.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([6,1,3,7,8,9,10,11,12,13,14,15,5,16,17,18]))),$Oe=(0,z.lazy)(()=>zQ(()=>import(`./PromptInjectionsTab-D-7L-yZy.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([19,1,3,7,8,9,20,5,21]))),eke=(0,z.lazy)(()=>zQ(()=>import(`./GroupsTab-Bz7Mvvwj.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([22,1,3,12,23,18,13,5,16,24,14,15]))),tke=(0,z.lazy)(()=>zQ(()=>import(`./IntegrationsTab-D3y4_fhI.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([25,1,3,5]))),nke=(0,z.lazy)(()=>zQ(()=>import(`./FeedbacksTab-Ba-zMA-p.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([26,1,3,18,13,5,16]))),rke=(0,z.lazy)(()=>zQ(()=>import(`./SubAgentReportsTab-DIzBgBj5.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([27,1,3,18,13,5,16]))),ike=(0,z.lazy)(()=>zQ(()=>import(`./FilesTab-Dht0_RDj.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([28,1,3,5,16]))),ake=(0,z.lazy)(()=>zQ(()=>import(`./ScheduledTab-_v_HWkIY.js`).then(e=>({default:e.ScheduledTab})),__vite__mapDeps([29,1,3,30,31,13,21,14,15,5,16]))),oke=(0,z.lazy)(()=>zQ(()=>import(`./AgentFilesTab-CL0cJrKE.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([32,1,3,11,8,5,21]))),ske=(0,z.lazy)(()=>zQ(()=>import(`./PreferencesTab-CHqxxQ3R.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([33,1,3,31,13,21,20,9,5]))),cke=(0,z.lazy)(()=>zQ(()=>import(`./ChatDefaultsTab-XNB8jInh.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([34,1,3,11,5,21]))),lke=(0,z.lazy)(()=>zQ(()=>import(`./AccessTab-BgWLWjSu.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([35,1,3]))),uke=(0,z.lazy)(()=>zQ(()=>import(`./ThemeShowroom-Gqbq2MWW.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([36,1,3,23,37,15,5,14,20,9,38,16])));function dke(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(kte,{children:(0,B.jsx)(`div`,{className:`oc-boot`,children:wm()})}),(0,B.jsx)(Ote,{children:(0,B.jsx)(pke,{})}),(0,B.jsx)(Dte,{children:(0,B.jsx)(lde,{children:(0,B.jsx)(fEe,{children:(0,B.jsx)(hke,{})})})})]})}function fke(){return(0,B.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,B.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,B.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,B.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function pke(){let{signIn:e}=ng();H9(void 0),G9(void 0);let t=I(L.charts.brandForHost,{host:o3}),n=iSe(o3),r=t??n??null,i=l3(void 0);u3(r?.tokens??null,i),(0,z.useEffect)(()=>{t&&aSe(o3,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?C3(a,i):null,s=a?.label??`Atrium`,c=I(L.me.authProviders),[l,u]=(0,z.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(hs())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.anonymous;return(0,B.jsxs)(`div`,{className:`oc-signin`,children:[(0,B.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,vectorEffect:`non-scaling-stroke`}),(0,B.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,B.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,B.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,B.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,B.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,B.jsx)(`h1`,{className:`oc-signin__title`,children:Kl()}),(0,B.jsx)(`p`,{className:`oc-signin__subtitle`,children:pu()}),(0,B.jsx)(`div`,{className:`oc-signin__providers`,children:c?.google?(0,B.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,B.jsx)(fke,{}),(0,B.jsx)(`span`,{children:Xd()})]}):null}),l?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:tp()}):null,c?.anonymous?(0,B.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:Tl()}):null]})]})}function mke(){let{width:e,collapsed:t,isMobile:n}=t2();return(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`}}),(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`5.5rem`,height:`1.1rem`}})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`100%`,height:`2.25rem`}})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`,borderRadius:`999px`}})})]}),(0,B.jsxs)(`div`,{className:n?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[!t&&!n?(0,B.jsx)(`div`,{className:`oc-sidebar-col`,style:{width:e,flex:`0 0 ${e}px`},children:(0,B.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{height:`2.25rem`,margin:`0.25rem 0.25rem 0`}}),(0,B.jsx)(c9,{})]})}):null,(0,B.jsx)(`main`,{className:`oc-main`})]})]})}function hke(){let e=I(L.me.getMe,{host:o3}),t=Ns(L.me.bootstrap),n=Rv();(0,z.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),H9(e?.resolvedThemeMode),G9(e?.resolvedFontScale);let r=l3(e?.resolvedThemeMode);u3(e?.resolvedChartTokens,r),XOe(e?.resolvedLocale);let i=(0,z.useRef)(null);if((0,z.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,B.jsx)(mke,{});let a=e.name||e.email||Vc();return e.role===`pending`?(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsx)(K9,{}),(0,B.jsx)(_9,{}),(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,B.jsx)(q9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(v9,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,B.jsxs)(`div`,{className:`oc-pending`,children:[(0,B.jsx)(`h1`,{className:`oc-pending__title`,children:Cee()}),(0,B.jsx)(`p`,{className:`oc-pending__body`,children:Md()})]})]}):(0,B.jsx)(_ke,{canOpenSettings:O9(e.permissions??[]).length>0,viewerUserId:e.userId,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function K9(){let e=I(L.me.getImpersonation),t=Ns(L.admin.stopImpersonation);return!e||!e.impersonating?null:(0,B.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,B.jsx)(Ty,{className:`size-4 shrink-0`}),(0,B.jsxs)(`span`,{className:`oc-imp__text`,children:[Sc(),` `,(0,B.jsx)(`strong`,{children:e.targetLabel}),tee(),(0,B.jsx)(`strong`,{children:e.realLabel}),Lf()]}),(0,B.jsx)(Lh,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:Rs()})]})}function q9({brand:e,resolvedThemeMode:t}){let n=l3(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=C3(e,n),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>s(!1),[a]),(0,B.jsxs)(B.Fragment,{children:[a!==null&&!o?(0,B.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,B.jsx)(T3,{className:`oc-brand__logo`}):null,(0,B.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function gke({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(Lh,{variant:`ghost`,size:`icon-sm`,"aria-label":i?Fu():Bp(),onClick:a,children:i?(0,B.jsx)(rb,{}):(0,B.jsx)(nb,{})}),(0,B.jsx)(Wv,{to:`/`,className:`oc-topbar__brand`,children:(0,B.jsx)(q9,{brand:r,resolvedThemeMode:n})})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(SOe,{})}),(0,B.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,B.jsx)(yOe,{}),(0,B.jsx)(v9,{label:e,mode:t})]})]})}function _ke({canOpenSettings:e,viewerUserId:t,userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a}){let{width:o,columnRef:s,collapsed:c,toggleCollapsed:l,collapse:u,startResize:d,isMobile:f}=t2(),p=Qne(),m=Iv({strict:!1}),h=Rv(),g=!!p({to:`/settings`,fuzzy:!0});(0,z.useEffect)(()=>{f&&u()},[Qv({select:e=>e.pathname}),f,u]);let _=(0,z.useCallback)(e=>{h({to:`/chat/$chatId`,params:{chatId:e}})},[h]),{startNewChat:v,picker:y}=h9(_),b=(0,z.useMemo)(()=>kF(wF,OF()),[]);return(0,z.useEffect)(()=>{let e=e=>{AF(e,wF)&&(e.preventDefault(),v())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]),(0,B.jsxs)(`div`,{className:`oc-shell`,children:[y,(0,B.jsx)(fOe,{activeChatId:m.chatId??null}),(0,B.jsx)(K9,{}),(0,B.jsx)(_9,{}),(0,B.jsx)(gke,{userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a,collapsed:c,onToggleSidebar:l}),(0,B.jsxs)(`div`,{className:f?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[f&&!c?(0,B.jsx)(`div`,{className:`oc-sidebar-backdrop`,onClick:u,"aria-hidden":!0}):null,c?null:(0,B.jsxs)(`div`,{className:`oc-sidebar-col`,ref:e=>{s.current=f?null:e},style:f?void 0:{width:o,flex:`0 0 ${o}px`},children:[g?(0,B.jsx)(MOe,{}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(sOe,{activeChatId:m.chatId??null,onSelect:_,onNewChat:()=>void v(),newChatShortcut:b}),(0,B.jsx)(Lh,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(Wv,{to:`/settings/$tab`,params:{tab:`scheduled`},children:[(0,B.jsx)(ay,{"aria-hidden":!0}),Ko()]})}),(0,B.jsx)(Lh,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(Wv,{to:`/settings/$tab`,params:{tab:`files`},children:[(0,B.jsx)(zy,{"aria-hidden":!0}),Mo()]})}),e?(0,B.jsx)(Lh,{variant:`ghost`,className:`mx-2 mb-2 justify-start`,asChild:!0,children:(0,B.jsxs)(Wv,{to:`/settings`,children:[(0,B.jsx)(yb,{"aria-hidden":!0}),vf()]})}):null]}),(0,B.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:d,role:`separator`,"aria-orientation":`vertical`,"aria-label":pee()})]}),(0,B.jsx)(`main`,{className:`oc-main`,children:(0,B.jsx)(Zv,{})}),(0,B.jsx)(h_e,{viewerUserId:t,currentChatId:m.chatId??null})]}),(0,B.jsx)(ude,{})]})}function vke(){let e=I(L.me.getMe,{host:o3}),t=Rv(),n=Qv({select:e=>e.pathname}),r=(0,z.useMemo)(()=>e?O9(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,z.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:wm()});if(i)return null;let a=A9(n),o=a!==void 0&&!r.includes(a);return(0,B.jsxs)(`div`,{className:`oc-admin`,children:[(0,B.jsx)(jOe,{}),(0,B.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,B.jsx)(yke,{}):(0,B.jsx)(Zv,{})})]})}function yke(){return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(kb,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:ol()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:w()})]})}function bke(){let e=I(L.me.getMe,{host:o3}),t=Rv();return(0,z.useEffect)(()=>{if(e===void 0)return;let n=O9(e.permissions??[]);t({to:n.includes(`files`)?k9(`files`):n.length>0?k9(n[0]):`/`,replace:!0})},[e,t]),(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:wm()})}function xke(e){switch(e){case`groups`:return(0,B.jsx)(eke,{});case`integrations`:return(0,B.jsx)(tke,{});case`instances`:return(0,B.jsx)(QOe,{});case`injections`:return(0,B.jsx)($Oe,{});case`theme`:return(0,B.jsx)(uke,{});case`feedbacks`:return(0,B.jsx)(nke,{});case`subagentReports`:return(0,B.jsx)(rke,{});case`files`:return(0,B.jsx)(ike,{});case`scheduled`:return(0,B.jsx)(ake,{});case`agentFiles`:return(0,B.jsx)(oke,{});case`preferences`:return(0,B.jsx)(ske,{});case`chatDefaults`:return(0,B.jsx)(cke,{});case`access`:return(0,B.jsx)(lke,{});default:return(0,B.jsx)(ZOe,{})}}function Ske(){let{tab:e}=Iv({from:`/settings/$tab`});return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:xke(e)})}function Cke(){let{chatId:e}=Iv({from:`/chat/$chatId`}),{m:t}=Lv({from:`/chat/$chatId`});return(0,z.useEffect)(()=>{Kxe(e)},[e]),(0,B.jsx)(m8,{chatId:e,focusMessageId:t??null})}function wke(){let e=Rv(),t=qxe(),n=I(L.messages.listChats,{}),r=t!==null&&n!==void 0&&n.some(e=>e._id===t);return(0,z.useEffect)(()=>{r&&t&&e({to:`/chat/$chatId`,params:{chatId:t},replace:!0})},[r,t,e]),t!==null&&(n===void 0||r)?(0,B.jsx)(`div`,{className:`oc-boot`,children:wm()}):(0,B.jsx)(m8,{chatId:null})}var J9=Wne({component:dke}),Y9=Gv({getParentRoute:()=>J9,path:`/`,component:wke}),Tke=Gv({getParentRoute:()=>J9,path:`chat/$chatId`,component:Cke,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),Eke=Gv({getParentRoute:()=>J9,path:`project/$projectId`,component:Kv(()=>zQ(()=>import(`./ProjectPage-Dom5dB_v.js`),__vite__mapDeps([39,1,3,30,5,40])),`ProjectPage`),validateSearch:e=>({c:typeof e.c==`string`?e.c:void 0})}),X9=Gv({getParentRoute:()=>J9,path:`settings`,component:vke}),Dke=Gv({getParentRoute:()=>X9,path:`/`,component:bke}),Oke=Gv({getParentRoute:()=>X9,path:`traces`,validateSearch:zOe,component:Kv(()=>zQ(()=>import(`./TracesTab-D_Z__oYy.js`),__vite__mapDeps([41,1,3,12,23,18,13,5,16,37,15,14])),`TracesTab`)}),kke=Gv({getParentRoute:()=>X9,path:`bridge`,validateSearch:KOe,component:Kv(()=>zQ(()=>import(`./BridgeTab-QW9px1z5.js`),__vite__mapDeps([10,1,3,11,7,8,9,12,13,14,15,5,16,17])),`BridgeTab`)}),Ake=Gv({getParentRoute:()=>X9,path:`voice`,validateSearch:GOe,component:Kv(()=>zQ(()=>import(`./VoiceTab-DGQk5yGt.js`),__vite__mapDeps([42,1,3,12,5,21])),`VoiceTab`)}),jke=Gv({getParentRoute:()=>X9,path:`audit`,validateSearch:BOe,component:Kv(()=>zQ(()=>import(`./AuditTab-BnDFtbaS.js`),__vite__mapDeps([43,1,3,18,13,5,16,37,23,15,14])),`AuditTab`)}),Mke=Gv({getParentRoute:()=>X9,path:`anomalies`,validateSearch:VOe,component:Kv(()=>zQ(()=>import(`./AnomaliesTab-CKSRbds6.js`),__vite__mapDeps([44,1,3,18,13,5,16,14,15,17])),`AnomaliesTab`)}),Nke=Gv({getParentRoute:()=>X9,path:`kpi`,validateSearch:HOe,component:Kv(()=>zQ(()=>import(`./KpiTab-D9ujtelb.js`),__vite__mapDeps([45,1,3,15,5,38])),`KpiTab`)}),Pke=Gv({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:UOe,component:Kv(()=>zQ(()=>import(`./ServiceAccountsTab-foQObSmk.js`),__vite__mapDeps([46,1,3,18,13,5,16,14,15,4])),`ServiceAccountsTab`)}),Fke=Gv({getParentRoute:()=>X9,path:`users`,validateSearch:WOe,component:Kv(()=>zQ(()=>import(`./UsersTab-1HZ5mAYl.js`),__vite__mapDeps([47,1,3,18,13,5,16,24,14,15])),`UsersTab`)}),Ike=Gv({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw T_({to:`/settings/$tab`,params:{tab:wOe.uiprefs},replace:!0})}}),Lke=Gv({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:G4([...T9]).catch(`roles`).parse(e.tab)}),component:Ske});function Rke({error:e,reset:t}){let n=Rv(),r=Jxe(e),[i]=(0,z.useState)(()=>r&&Zxe(Date.now()));return(0,z.useEffect)(()=>{i&&window.location.reload()},[i]),i?(0,B.jsx)(`div`,{className:`oc-route-error`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:Ti()})}):(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(kb,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:cs()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:No()}),(0,B.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>{r?window.location.reload():t()},children:qo()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:Nn()})]})]})}function zke(){let e=Rv();return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(lre,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:Mp()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:Xn()}),(0,B.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:Nn()})})]})}var Z9=ere({routeTree:J9.addChildren([Y9,Tke,Eke,X9.addChildren([Dke,Oke,Ake,kke,jke,Mke,Nke,Pke,Fke,Ike,Lke])]),defaultPreload:`intent`,defaultErrorComponent:Rke,defaultNotFoundComponent:zke}),Bke=()=>null;function Q9({children:e}){return(0,B.jsx)(`div`,{style:{display:`flex`,minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}var $9=Ate.createRoot(document.getElementById(`root`));$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Q9,{children:ls()})})),MCe().then(e=>{let t=new mf(e);$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Hte,{client:t,children:(0,B.jsxs)(VSe,{children:[(0,B.jsx)(Lwe,{children:(0,B.jsx)(rre,{router:Z9})}),(0,B.jsx)(z.Suspense,{fallback:null,children:(0,B.jsx)(Bke,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsxs)(Q9,{children:[ri(),` `,e instanceof Error?e.message:String(e)]})}))});export{m0 as $,Cx as $t,b5 as A,Ay as An,kF as At,lwe as B,ly as Bn,uF as Bt,j7 as C,Xy as Cn,qF as Ct,FEe as D,Hy as Dn,VF as Dt,D5 as E,Uy as En,UF as Et,k6 as F,by as Fn,gF as Ft,l3 as G,Rv as Gn,zA as Gt,VCe as H,sy as Hn,_M as Ht,E6 as I,gy as In,_F as It,i3 as J,Fk as Jt,c3 as K,Lv as Kn,RA as Kt,O6 as L,my as Ln,pF as Lt,Y6 as M,Ty as Mn,fF as Mt,U6 as N,wy as Nn,mF as Nt,k7 as O,Ny as On,OF as Ot,j6 as P,xy as Pn,hF as Pt,g0 as Q,Mx as Qt,T6 as R,fy as Rn,lF as Rt,E7 as S,nb as Sn,YF as St,i7 as T,qy as Tn,JF as Tt,B3 as U,oy as Un,hM as Ut,d6 as V,cy as Vn,vM as Vt,V3 as W,ey as Wn,gM as Wt,f0 as X,Ax as Xt,r3 as Y,kx as Yt,h0 as Z,jx as Zt,K7 as _,ub as _n,$F as _t,LOe as a,yx as an,c0 as at,H7 as b,ob as bn,ZF as bt,COe as c,Mb as cn,t0 as ct,h9 as d,Ob as dn,qQ as dt,Dx as en,p0 as et,r9 as f,wb as fn,Tme as ft,Y7 as g,db as gn,eI as gt,J7 as h,pb as hn,zQ as ht,FOe as i,xx as in,l0 as it,m5 as j,ky as jn,yF as jt,y5 as k,My as kn,ede as kt,E9 as l,Ab as ln,n0 as lt,q7 as m,hb as mn,h1 as mt,F9 as n,bx as nn,s0 as nt,IOe as o,Fb as on,u0 as ot,X7 as p,vb as pn,f1 as pt,o3 as q,Iv as qn,NA as qt,POe as r,Ox as rn,d0 as rt,ROe as s,Nb as sn,rge as st,W9 as t,_x as tn,o0 as tt,D9 as u,kb as un,B1 as ut,B7 as v,lb as vn,WF as vt,n7 as w,Jy as wn,KF as wt,L7 as x,ab as xn,GF as xt,F7 as y,cb as yn,XF as yt,D6 as z,uy as zn,dF as zt};
|
|
324
|
+
`},DEe={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function OEe(e){let{announcements:t=DEe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=EEe}=e,{announce:a,announcement:o}=CEe(),s=c5(`DndLiveRegion`),[c,l]=(0,z.useState)(!1);if((0,z.useEffect)(()=>{l(!0)},[]),wEe((0,z.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=z.createElement(z.Fragment,null,z.createElement(xEe,{id:r,value:i.draggable}),z.createElement(SEe,{id:s,announcement:o}));return n?(0,Bv.createPortal)(u,n):u}var _5;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(_5||={});function v5(){}function y5(e,t){return(0,z.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function b5(){var e=[...arguments];return(0,z.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var x5=Object.freeze({x:0,y:0});function S5(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function kEe(e,t){let n=p5(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function C5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function AEe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function w5(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function T5(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function E5(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var jEe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=E5(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=S5(E5(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(C5)},D5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=w5(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=w5(r),o=i.reduce((e,t,r)=>e+S5(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(C5)};function MEe(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var NEe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=MEe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(AEe)};function PEe(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var FEe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&PEe(r,a)){let n=w5(a).reduce((e,t)=>e+S5(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(C5)};function IEe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function O5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:x5}function LEe(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var REe=LEe(1);function k5(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function zEe(e,t,n){let r=k5(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var BEe={ignoreTransform:!1};function A5(e,t){t===void 0&&(t=BEe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=X8(e).getComputedStyle(e);t&&(n=zEe(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function j5(e){return A5(e,{ignoreTransform:!0})}function VEe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function HEe(e,t){return t===void 0&&(t=X8(e).getComputedStyle(e)),t.position===`fixed`}function UEe(e,t){t===void 0&&(t=X8(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function M5(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Z8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Q8(i)||$8(i)||n.includes(i))return n;let a=X8(e).getComputedStyle(i);return i!==e&&UEe(i,a)&&n.push(i),HEe(i,a)?n:r(i.parentNode)}return e?r(e):n}function N5(e){let[t]=M5(e,1);return t??null}function P5(e){return!q8||!e?null:J8(e)?e:Y8(e)?Z8(e)||e===e5(e).scrollingElement?window:Q8(e)?e:null:null}function F5(e){return J8(e)?e.scrollX:e.scrollLeft}function I5(e){return J8(e)?e.scrollY:e.scrollTop}function L5(e){return{x:F5(e),y:I5(e)}}var R5;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(R5||={});function z5(e){return!q8||!e?!1:e===document.scrollingElement}function B5(e){let t={x:0,y:0},n=z5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var WEe={x:.2,y:.2};function GEe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=WEe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=B5(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=R5.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=R5.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=R5.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=R5.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function KEe(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function V5(e){return e.reduce((e,t)=>u5(e,L5(t)),x5)}function qEe(e){return e.reduce((e,t)=>e+F5(t),0)}function JEe(e){return e.reduce((e,t)=>e+I5(t),0)}function H5(e,t){if(t===void 0&&(t=A5),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);N5(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var YEe=[[`x`,[`left`,`right`],qEe],[`y`,[`top`,`bottom`],JEe]],U5=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=M5(t),r=V5(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of YEe)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},W5=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function XEe(e){let{EventTarget:t}=X8(e);return e instanceof t?e:e5(e)}function G5(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var K5;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(K5||={});function q5(e){e.preventDefault()}function ZEe(e){e.stopPropagation()}var J5;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(J5||={});var Y5={start:[J5.Space,J5.Enter],cancel:[J5.Esc],end:[J5.Space,J5.Enter,J5.Tab]},QEe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case J5.Right:return{...n,x:n.x+25};case J5.Left:return{...n,x:n.x-25};case J5.Down:return{...n,y:n.y+25};case J5.Up:return{...n,y:n.y-25}}},X5=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new W5(e5(t)),this.windowListeners=new W5(X8(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(K5.Resize,this.handleCancel),this.windowListeners.add(K5.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(K5.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&H5(n),t(x5)}handleKeyDown(e){if(f5(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Y5,coordinateGetter:a=QEe,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:x5;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=d5(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=B5(n),p=KEe(n),m={x:Math.min(i===J5.Right?p.right-p.width/2:p.right,Math.max(i===J5.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===J5.Down?p.bottom-p.height/2:p.bottom,Math.max(i===J5.Down?p.top:p.top+p.height/2,u.y))},h=i===J5.Right&&!s||i===J5.Left&&!c,g=i===J5.Down&&!l||i===J5.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===J5.Right&&e<=d.x||i===J5.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===J5.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===J5.Down&&e<=d.y||i===J5.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===J5.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,u5(d5(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};X5.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Y5,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Z5(e){return!!(e&&`distance`in e)}function Q5(e){return!!(e&&`delay`in e)}var $5=class{constructor(e,t,n){n===void 0&&(n=XEe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=e5(i),this.documentListeners=new W5(this.document),this.listeners=new W5(n),this.windowListeners=new W5(X8(i)),this.initialCoordinates=p5(r)??x5,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(K5.Resize,this.handleCancel),this.windowListeners.add(K5.DragStart,q5),this.windowListeners.add(K5.VisibilityChange,this.handleCancel),this.windowListeners.add(K5.ContextMenu,q5),this.documentListeners.add(K5.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Q5(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Z5(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(K5.Click,ZEe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(K5.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=p5(e)??x5,s=d5(n,o);if(!t&&a){if(Z5(a)){if(a.tolerance!=null&&G5(s,a.tolerance))return this.handleCancel();if(G5(s,a.distance))return this.handleStart()}if(Q5(a)&&G5(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===J5.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},$Ee={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},e7=class extends $5{constructor(e){let{event:t}=e,n=e5(t.target);super(e,$Ee,n)}};e7.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var eDe={move:{name:`mousemove`},end:{name:`mouseup`}},t7;(function(e){e[e.RightClick=2]=`RightClick`})(t7||={});var n7=class extends $5{constructor(e){super(e,eDe,e5(e.event.target))}};n7.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===t7.RightClick?!1:(r?.({event:n}),!0)}}];var r7={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},i7=class extends $5{constructor(e){super(e,r7)}static setup(){return window.addEventListener(r7.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(r7.move.name,e)};function e(){}}};i7.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var a7;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(a7||={});var o7;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(o7||={});function tDe(e){let{acceleration:t,activator:n=a7.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=o7.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=rDe({delta:d,disabled:!a}),[m,h]=gEe(),g=(0,z.useRef)({x:0,y:0}),_=(0,z.useRef)({x:0,y:0}),v=(0,z.useMemo)(()=>{switch(n){case a7.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case a7.DraggableRect:return i}},[n,i,c]),y=(0,z.useRef)(null),b=(0,z.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,z.useMemo)(()=>s===o7.TreeOrder?[...l].reverse():l,[s,l]);(0,z.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=GEe(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var nDe={x:{[R5.Backward]:!1,[R5.Forward]:!1},y:{[R5.Backward]:!1,[R5.Forward]:!1}};function rDe(e){let{delta:t,disabled:n}=e,r=o5(t);return i5(e=>{if(n||!r||!e)return nDe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[R5.Backward]:e.x[R5.Backward]||i.x===-1,[R5.Forward]:e.x[R5.Forward]||i.x===1},y:{[R5.Backward]:e.y[R5.Backward]||i.y===-1,[R5.Forward]:e.y[R5.Forward]||i.y===1}}},[n,t,r])}function iDe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return i5(e=>t==null?null:r??e??null,[r,t])}function aDe(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var s7;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(s7||={});var c7;(function(e){e.Optimized=`optimized`})(c7||={});var l7=new Map;function oDe(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,z.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,z.useRef)(e),d=g(),f=r5(d),p=(0,z.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,z.useRef)(null),h=i5(t=>{if(d&&!n)return l7;if(!t||t===l7||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new U5(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,z.useEffect)(()=>{u.current=e},[e]),(0,z.useEffect)(()=>{d||p()},[n,d]),(0,z.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,z.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case s7.Always:return!1;case s7.BeforeDragging:return n;default:return!n}}}function u7(e,t){return i5(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function sDe(e,t){return u7(e,t)}function cDe(e){let{callback:t,disabled:n}=e,r=n5(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function d7(e){let{callback:t,disabled:n}=e,r=n5(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function lDe(e){return new U5(A5(e),e)}function f7(e,t,n){t===void 0&&(t=lDe);let[r,i]=(0,z.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=cDe({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=d7({callback:a});return t5(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function uDe(e){return O5(e,u7(e))}var p7=[];function dDe(e){let t=(0,z.useRef)(e),n=i5(n=>e?n&&n!==p7&&e&&t.current&&e.parentNode===t.current.parentNode?n:M5(e):p7,[e]);return(0,z.useEffect)(()=>{t.current=e},[e]),n}function fDe(e){let[t,n]=(0,z.useState)(null),r=(0,z.useRef)(e),i=(0,z.useCallback)(e=>{let t=P5(e.target);t&&n(e=>e?(e.set(t,L5(t)),new Map(e)):null)},[]);return(0,z.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=P5(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,L5(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{P5(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,z.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>u5(e,t),x5):V5(e):x5,[e,t])}function m7(e,t){t===void 0&&(t=[]);let n=(0,z.useRef)(null);return(0,z.useEffect)(()=>{n.current=null},t),(0,z.useEffect)(()=>{let t=e!==x5;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?d5(e,n.current):x5}function pDe(e){(0,z.useEffect)(()=>{if(!q8)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function mDe(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function h7(e){return(0,z.useMemo)(()=>e?VEe(e):null,[e])}var g7=[];function hDe(e,t){t===void 0&&(t=A5);let[n]=e,r=h7(n?X8(n):null),[i,a]=(0,z.useState)(g7);function o(){a(()=>e.length?e.map(e=>z5(e)?r:new U5(t(e),e)):g7)}let s=d7({callback:o});return t5(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function _7(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Q8(t)?t:e}function gDe(e){let{measure:t}=e,[n,r]=(0,z.useState)(null),i=d7({callback:(0,z.useCallback)(e=>{for(let{target:n}of e)if(Q8(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=a5((0,z.useCallback)(e=>{let n=_7(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,z.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var _De=[{sensor:e7,options:{}},{sensor:X5,options:{}}],vDe={current:{}},v7={draggable:{measure:j5},droppable:{measure:j5,strategy:s7.WhileDragging,frequency:c7.Optimized},dragOverlay:{measure:A5}},y7=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},yDe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new y7,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:v5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:v7,measureDroppableContainers:v5,windowRect:null,measuringScheduled:!1},b7={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:v5,draggableNodes:new Map,over:null,measureDroppableContainers:v5},x7=(0,z.createContext)(b7),S7=(0,z.createContext)(yDe);function bDe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new y7}}}function xDe(e,t){switch(t.type){case _5.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case _5.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case _5.DragEnd:case _5.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case _5.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new y7(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case _5.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new y7(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case _5.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new y7(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function SDe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,z.useContext)(x7),a=o5(r),o=o5(n?.id);return(0,z.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!f5(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=yEe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function C7(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function CDe(e){return(0,z.useMemo)(()=>({draggable:{...v7.draggable,...e?.draggable},droppable:{...v7.droppable,...e?.droppable},dragOverlay:{...v7.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function wDe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,z.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;t5(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=O5(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=N5(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var w7=(0,z.createContext)({...x5,scaleX:1,scaleY:1}),T7;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(T7||={});var E7=(0,z.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=_De,collisionDetection:o=NEe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,z.useReducer)(xDe,void 0,bDe),[f,p]=TEe(),[m,h]=(0,z.useState)(T7.Uninitialized),g=m===T7.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,z.useRef)({initial:null,translated:null}),C=(0,z.useMemo)(()=>_==null?null:{id:_,data:x?.data??vDe,rect:S},[_,x]),w=(0,z.useRef)(null),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),k=r5(l,Object.values(l)),A=c5(`DndDescribedBy`,t),ee=(0,z.useMemo)(()=>b.getEnabled(),[b]),j=CDe(s),{droppableRects:M,measureDroppableContainers:te,measuringScheduled:N}=oDe(ee,{dragging:g,dependencies:[y.x,y.y],config:j.droppable}),P=iDe(v,_),ne=(0,z.useMemo)(()=>D?p5(D):null,[D]),re=Pe(),ie=sDe(P,j.draggable.measure);wDe({activeNode:_==null?null:v.get(_),config:re.layoutShiftCompensation,initialRect:ie,measure:j.draggable.measure});let ae=f7(P,j.draggable.measure,ie),oe=f7(P?P.parentElement:null),se=(0,z.useRef)({activatorEvent:null,active:null,activeNode:P,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=b.getNodeFor(se.current.over?.id),le=gDe({measure:j.dragOverlay.measure}),ue=le.nodeRef.current??P,de=g?le.rect??ae:null,fe=!!(le.nodeRef.current&&le.rect),pe=uDe(fe?null:ae),me=h7(ue?X8(ue):null),he=dDe(g?ce??P:null),ge=hDe(he),_e=C7(c,{transform:{x:y.x-pe.x,y:y.y-pe.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:de,over:se.current.over,overlayNodeRect:le.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=ne?u5(ne,y):null,ye=fDe(he),be=m7(ye),xe=m7(ye,[ae]),Se=u5(_e,be),Ce=de?REe(de,_e):null,we=C&&Ce?o({active:C,collisionRect:Ce,droppableRects:M,droppableContainers:ee,pointerCoordinates:ve}):null,Te=T5(we,`id`),[Ee,De]=(0,z.useState)(null),Oe=IEe(fe?_e:u5(_e,xe),Ee?.rect??null,ae),ke=(0,z.useRef)(null),Ae=(0,z.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;ke.current=new n({active:w.current,activeNode:i,event:a,options:r,context:se,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Bv.unstable_batchedUpdates)(()=>{r?.(i),h(T7.Initializing),d({type:_5.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(ke.current),O(a)})},onMove(e){d({type:_5.DragMove,coordinates:e})},onEnd:o(_5.DragEnd),onCancel:o(_5.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=se.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===_5.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=_5.DragCancel)}w.current=null,(0,Bv.unstable_batchedUpdates)(()=>{d({type:e}),h(T7.Uninitialized),De(null),E(null),O(null),ke.current=null;let t=e===_5.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),je=aDe(a,(0,z.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Ae(n,t))},[v,Ae]));pDe(a),t5(()=>{ae&&m===T7.Initializing&&h(T7.Initialized)},[ae,m]),(0,z.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=se.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:Se.x,y:Se.y},over:i};(0,Bv.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[Se.x,Se.y]),(0,z.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=se.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Te),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Bv.unstable_batchedUpdates)(()=>{De(s),a?.(c),f({type:`onDragOver`,event:c})})},[Te]),t5(()=>{se.current={activatorEvent:D,active:C,activeNode:P,collisionRect:Ce,collisions:we,droppableRects:M,draggableNodes:v,draggingNode:ue,draggingNodeRect:de,droppableContainers:b,over:Ee,scrollableAncestors:he,scrollAdjustedTranslate:Se},S.current={initial:de,translated:Ce}},[C,P,we,Ce,v,ue,de,M,b,Ee,he,Se]),tDe({...re,delta:y,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Me=(0,z.useMemo)(()=>({active:C,activeNode:P,activeNodeRect:ae,activatorEvent:D,collisions:we,containerNodeRect:oe,dragOverlay:le,draggableNodes:v,droppableContainers:b,droppableRects:M,over:Ee,measureDroppableContainers:te,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:j,measuringScheduled:N,windowRect:me}),[C,P,ae,D,we,oe,le,v,b,M,Ee,te,he,ge,j,N,me]),Ne=(0,z.useMemo)(()=>({activatorEvent:D,activators:je,active:C,activeNodeRect:ae,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:Ee,measureDroppableContainers:te}),[D,je,C,ae,d,A,v,Ee,te]);return z.createElement(g5.Provider,{value:p},z.createElement(x7.Provider,{value:Ne},z.createElement(S7.Provider,{value:Me},z.createElement(w7.Provider,{value:Oe},i)),z.createElement(SDe,{disabled:n?.restoreFocus===!1})),z.createElement(OEe,{...n,hiddenTextDescribedById:A}));function Pe(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),TDe=(0,z.createContext)(null),D7=`button`,EDe=`Draggable`;function DDe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=c5(EDe),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,z.useContext)(x7),{role:p=D7,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,z.useContext)(g?w7:TDe),[v,y]=a5(),[b,x]=a5(),S=mDe(o,t),C=r5(n);return t5(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,z.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===D7?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function O7(){return(0,z.useContext)(S7)}var ODe=`Droppable`,kDe={timeout:25};function k7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=c5(ODe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,z.useContext)(x7),u=(0,z.useRef)({disabled:n}),d=(0,z.useRef)(!1),f=(0,z.useRef)(null),p=(0,z.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...kDe,...i},_=r5(h??r),v=d7({callback:(0,z.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=a5((0,z.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=r5(t);return(0,z.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,z.useEffect)(()=>(s({type:_5.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:_5.UnregisterDroppable,key:a,id:r})),[r]),(0,z.useEffect)(()=>{n!==u.current.disabled&&(s({type:_5.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function ADe(e){let{animation:t,children:n}=e,[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(null),s=o5(n);return!n&&!r&&s&&i(s),t5(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),z.createElement(z.Fragment,null,n,r?(0,z.cloneElement)(r,{ref:o}):null)}var jDe={x:0,y:0,scaleX:1,scaleY:1};function MDe(e){let{children:t}=e;return z.createElement(x7.Provider,{value:b7},z.createElement(w7.Provider,{value:jDe},t))}var NDe={position:`fixed`,touchAction:`none`},PDe=e=>f5(e)?`transform 250ms ease`:void 0,FDe=(0,z.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=PDe}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...NDe,width:s.width,height:s.height,top:s.top,left:s.left,transform:m5.Transform.toString(d),transformOrigin:i&&r?kEe(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return z.createElement(n,{className:o,style:f,ref:t},a)}),IDe={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:m5.Transform.toString(t)},{transform:m5.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function LDe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return n5((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=_7(a);if(!c)return;let{transform:l}=X8(a).getComputedStyle(a),u=k5(l);if(!u)return;let d=typeof t==`function`?t:RDe(t);return H5(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function RDe(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...IDe,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var A7=0;function zDe(e){return(0,z.useMemo)(()=>{if(e!=null)return A7++,A7},[e])}var j7=z.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=O7(),S=(0,z.useContext)(w7),C=zDe(d?.id),w=C7(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=u7(f),E=LDe({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return z.createElement(MDe,null,z.createElement(ADe,{animation:E},d&&C?z.createElement(FDe,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))}),BDe=e=>{let{transform:t}=e;return{...t,y:0}};function VDe(e,t,n){let r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}var HDe=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:VDe(n,t,i)},UDe=e=>{let{transform:t}=e;return{...t,x:0}};function M7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function WDe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function N7(e){return e!==null&&e>=0}function GDe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function KDe(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var P7={scaleX:1,scaleY:1},qDe=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=JDe(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...P7}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...P7}:a<r&&a>=i?{x:o.width+s,y:0,...P7}:{x:0,y:0,...P7}};function JDe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var F7=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=M7(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},I7={scaleX:1,scaleY:1},L7=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...I7}:null}let s=YDe(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...I7}:r<t&&r>=a?{x:0,y:o.height+s,...I7}:{x:0,y:0,...I7}};function YDe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var R7=`Sortable`,z7=z.createContext({activeIndex:-1,containerId:R7,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:F7,disabled:{draggable:!1,droppable:!1}});function B7(e){let{children:t,id:n,items:r,strategy:i=F7,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=O7(),d=c5(R7,n),f=s.rect!==null,p=(0,z.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,z.useRef)(p),v=!GDe(p,_.current),y=g!==-1&&h===-1||v,b=KDe(a);t5(()=>{v&&m&&u(p)},[v,p,m,u]),(0,z.useEffect)(()=>{_.current=p},[p]);let x=(0,z.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:WDe(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return z.createElement(z7.Provider,{value:x},t)}var XDe=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return M7(n,r,i).indexOf(t)},ZDe=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},QDe={duration:200,easing:`ease`},V7=`transform`,$De=m5.Transition.toString({property:V7,duration:0,easing:`linear`}),eOe={roleDescription:`sortable`};function tOe(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,z.useState)(null),s=(0,z.useRef)(n);return t5(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=A5(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,z.useEffect)(()=>{a&&o(null)},[a]),a}function H7(e){let{animateLayoutChanges:t=ZDe,attributes:n,disabled:r,data:i,getNewIndex:a=XDe,id:o,strategy:s,resizeObserverConfig:c,transition:l=QDe}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,z.useContext)(z7),y=nOe(r,p),b=u.indexOf(o),x=(0,z.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,z.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=k7({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:ee,listeners:j,isDragging:M,over:te,setActivatorNodeRef:N,transform:P}=DDe({id:o,data:x,attributes:{...eOe,...n},disabled:y.draggable}),ne=hEe(E,ee),re=!!D,ie=re&&!m&&N7(f)&&N7(g),ae=!_&&M,oe=ie?(ae&&ie?P:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,se=N7(f)&&N7(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ce=D?.id,le=(0,z.useRef)({activeId:ce,items:u,newIndex:se,containerId:d}),ue=u!==le.current.items,de=t({active:D,containerId:d,isDragging:M,isSorting:re,id:o,index:b,items:u,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),fe=tOe({disabled:!de,index:b,node:w,rect:C});return(0,z.useEffect)(()=>{re&&le.current.newIndex!==se&&(le.current.newIndex=se),d!==le.current.containerId&&(le.current.containerId=d),u!==le.current.items&&(le.current.items=u)},[re,se,d,u]),(0,z.useEffect)(()=>{if(ce===le.current.activeId)return;if(ce!=null&&le.current.activeId==null){le.current.activeId=ce;return}let e=setTimeout(()=>{le.current.activeId=ce},50);return()=>clearTimeout(e)},[ce]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:se,items:u,isOver:T,isSorting:re,isDragging:M,listeners:j,node:w,overIndex:g,over:te,setNodeRef:ne,setActivatorNodeRef:N,setDroppableNodeRef:E,setDraggableNodeRef:ee,transform:fe??oe,transition:pe()};function pe(){if(fe||ue&&le.current.newIndex===b)return $De;if(!(ae&&!f5(O)||!l)&&(re||de))return m5.Transition.toString({...l,property:V7})}}function nOe(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function U7(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var rOe=[J5.Down,J5.Right,J5.Up,J5.Left],W7=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(rOe.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case J5.Down:r.top<a.top&&t.push(n);break;case J5.Up:r.top>a.top&&t.push(n);break;case J5.Left:r.left>a.left&&t.push(n);break;case J5.Right:r.left<a.left&&t.push(n);break}});let c=D5({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=T5(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=M5(c).some((e,t)=>s[t]!==e),i=G7(e,t),a=iOe(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:d5(u,l)}}}};function G7(e,t){return!U7(e)||!U7(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function iOe(e,t){return!U7(e)||!U7(t)||!G7(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function K7({open:e,onOpenChange:t,title:n,description:r,children:i,onSubmit:a,submitLabel:o,submitting:s=!1,canSubmit:c=!0}){let[l,u]=(0,z.useState)(!1),d=s||l;async function f(){if(!(!c||d))try{u(!0),await a()}finally{u(!1)}}return(0,B.jsx)(M6,{open:e,onOpenChange:t,children:(0,B.jsxs)(N6,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,B.jsxs)(P6,{className:`border-b px-6 py-4`,children:[(0,B.jsx)(I6,{children:n}),r?(0,B.jsx)(L6,{children:r}):null]}),(0,B.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,B.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:i}),(0,B.jsxs)(F6,{className:`border-t px-6 py-4`,children:[(0,B.jsxs)(Lh,{type:`submit`,disabled:!c||d,children:[d?(0,B.jsx)(Hy,{className:`size-4 animate-spin`}):null,o??Mi()]}),(0,B.jsx)(Lh,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:nr()})]})]})]})})}var q7=[{value:`red`,hue:`var(--oc-accent-red, oklch(0.63 0.21 25))`},{value:`orange`,hue:`var(--oc-accent-orange, oklch(0.7 0.17 50))`},{value:`amber`,hue:`var(--oc-accent-amber, oklch(0.8 0.15 85))`},{value:`green`,hue:`var(--oc-accent-green, oklch(0.7 0.16 150))`},{value:`teal`,hue:`var(--oc-accent-teal, oklch(0.7 0.12 190))`},{value:`blue`,hue:`var(--oc-accent-blue, oklch(0.62 0.19 250))`},{value:`violet`,hue:`var(--oc-accent-violet, oklch(0.6 0.2 300))`},{value:`pink`,hue:`var(--oc-accent-pink, oklch(0.7 0.2 350))`}],J7=e=>q7.find(t=>t.value===e)?.hue??null;function aOe(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return q7[t%q7.length].hue}var Y7=e=>J7(e.color)??aOe(e._id);function X7({open:e,onOpenChange:t,title:n,movingFolderId:r,currentId:i,onPick:a}){let o=I(L.projects.listProjects,e?{}:`skip`),[s,c]=(0,z.useState)(``),l=(0,z.useMemo)(()=>{let e=o??[],t=nSe(e),n=s.trim().toLowerCase();return(n===``?t:t.filter(e=>e.node.name.toLowerCase().includes(n))).map(t=>({...t,disabled:r!==void 0&&!i3(e,r,t.node._id)}))},[o,s,r]),u=()=>{t(!1),c(``)};return(0,B.jsx)(o0,{open:e,onOpenChange:e=>{e||c(``),t(e)},children:(0,B.jsxs)(s0,{className:`oc-folderpick`,showCloseButton:!1,children:[(0,B.jsx)(c0,{children:(0,B.jsx)(u0,{children:n})}),(0,B.jsx)(yF,{autoFocus:!0,value:s,onChange:e=>c(e.target.value),placeholder:$c()}),(0,B.jsxs)(`div`,{className:`oc-folderpick__list`,role:`listbox`,children:[(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i===null,className:`oc-folderpick__opt`,onClick:()=>{a(null),u()},children:[(0,B.jsx)(vy,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:zl()}),i===null?(0,B.jsx)(oy,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]}),l.length===0?(0,B.jsx)(`p`,{className:`oc-folderpick__empty`,children:Nee()}):l.map(({node:e,depth:t,disabled:n})=>(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e._id===i,disabled:n,className:`oc-folderpick__opt`,style:{"--pick-depth":t-1,"--proj-hue":Y7(e)},onClick:()=>{a(e._id),u()},children:[(0,B.jsx)(My,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:e.name}),e._id===i?(0,B.jsx)(oy,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]},e._id))]})]})})}var Z7=6e4,Q7=60*Z7,$7=24*Q7,e9=7*$7,t9=30*$7,n9=365*$7;function r9(e,t){let n=t-e;if(n<Z7)return`maintenant`;if(n<Q7)return`${Math.floor(n/Z7)}min`;if(n<$7)return`${Math.floor(n/Q7)}h`;if(n<e9)return`${Math.floor(n/$7)}j`;if(n<t9)return`${Math.floor(n/e9)}sem`;if(n<n9)return`${Math.floor(n/t9)}mois`;let r=Math.floor(n/n9);return`${r}an${r>1?`s`:``}`}var i9=`project:none`,oOe=e=>`project:${e}`,a9=`projhead:`,o9=e=>`${a9}${e}`,s9=`oc.noproject.collapsed`;function c9(){return(0,B.jsx)(`div`,{className:`oc-sidebar__skeleton`,"aria-hidden":`true`,children:Array.from({length:7}).map((e,t)=>(0,B.jsx)(`div`,{className:`oc-skel oc-skel--row`},t))})}function sOe({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=I(L.messages.listChats,{}),a=I(L.projects.listProjects,{}),o=I(L.me.getMe,{host:o3})?.ui?.effective?.showChatAge??!0,s=I(L.chatReads.myChatReads,{}),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of s??[])e.set(t.chatId,t.lastSeenAt);return e},[s]),l=I(L.chatReads.myBusyChats,{}),u=(0,z.useMemo)(()=>new Set(l??[]),[l]),d=I(L.chatBookmarks.myBookmarkedChats,{}),f=I(L.chatExport.referenceLabel,{}),p=(0,z.useMemo)(()=>new Set(d??[]),[d]),m=(0,z.useMemo)(()=>{let t=new Set;for(let n of i??[]){if(n._id===e)continue;let r=c.get(n._id);r!==void 0&&n.lastAssistantAt!==null&&n.lastAssistantAt>r&&t.add(n._id)}return t},[i,c,e]),[h,g]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>g(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let _=Ns(L.projects.createProject),v=Ns(L.projects.setProjectCollapsed),y=Ns(L.projects.setProjectSidebar),b=Ns(L.chats.reorderChat),x=Ns(L.projects.reorderProject),S=Ns(L.chats.moveChatToProject),C=V3(),w=Wd(),T=(0,z.useRef)(null),E=(0,z.useRef)(null),D=(0,z.useRef)(null),[O,k]=(0,z.useState)(`full`);(0,z.useLayoutEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=E.current?.offsetWidth??0,r=D.current?.offsetWidth??0,i=n===0||t>=n?`full`:t>=r?`label`:`icon`;k(e=>e===i?e:i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[w,r]);let[A,ee]=(0,z.useState)(null),j=(0,z.useRef)(!1);(0,z.useEffect)(()=>{!j.current&&i&&ee(i)},[i]);let M=A??i??[],te=i===void 0&&A===null,[N,P]=(0,z.useState)(null),[ne,re]=(0,z.useState)(()=>localStorage.getItem(s9)===`1`);function ie(){re(e=>(localStorage.setItem(s9,e?`0`:`1`),!e))}let ae=J3();(0,z.useEffect)(()=>{if(!ae?.expand)return;let e=M.find(e=>e._id===ae.chatId);if(!e)return;let t=e.projectId??null;if(t===null){ne&&(localStorage.setItem(s9,`0`),re(!1));return}let n=(a??[]).find(e=>e._id===t);n&&n.parentId!==null||n?.collapsed&&v({projectId:t,collapsed:!1})},[ae,M,a,ne,v]);let oe=b5(y5(n7,{activationConstraint:{distance:4}}),y5(i7,{activationConstraint:{delay:250,tolerance:8}}),y5(X5,{coordinateGetter:W7})),se=(0,z.useRef)(!1),ce=()=>{se.current=!0,setTimeout(()=>{se.current=!1},0)},le=(0,z.useCallback)(e=>String(e.active.id).startsWith(a9)?D5({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(a9))}):D5(e),[]),ue=M.filter(e=>e.pinned),de=M.filter(e=>!e.pinned),fe=e=>de.filter(t=>(t.projectId??null)===e),pe=Rv(),me=(0,z.useMemo)(()=>Qxe(a??[]),[a]),he=(0,z.useMemo)(()=>me.filter(e=>!e.sidebarHidden),[me]),ge=(0,z.useMemo)(()=>me.filter(e=>e.sidebarHidden),[me]),_e=(0,z.useMemo)(()=>{let e=a??[];return new Map(e.map(t=>[t._id,tSe(e,t._id)]))},[a]),ve=(0,z.useMemo)(()=>new Map((a??[]).map(e=>[e._id,e.name])),[a]),ye=e=>de.filter(t=>t.projectId!==null&&(_e.get(t.projectId)??t.projectId)===e);function be(e){return M.find(t=>t._id===e)}async function xe(e){P(null),ce();let{active:t,over:n}=e;if(!n)return;let r=String(t.id),i=String(n.id);if(r.startsWith(a9)){let e=r.slice(9),t=he,n=null;if(i.startsWith(a9))n=i.slice(9);else if(i.startsWith(`project:`)&&i!==i9)n=i.slice(8);else{let e=be(i);n=e&&!e.pinned?e.projectId??null:null}if(n===null||n===e)return;let a=t.findIndex(t=>t._id===e),o=t.findIndex(e=>e._id===n);if(a<0||o<0)return;let s=[...t],[c]=s.splice(a,1);s.splice(o,0,c);let l=s[o-1]??null,u=s[o+1]??null;await x({projectId:e,prevKey:l?l.sortKey:null,nextKey:u?u.sortKey:null});return}let a=be(r);if(!a)return;if(i.startsWith(a9)){let e=i.slice(9);if((a.projectId??null)===e)return;j.current=!0,ee(t=>(t??M).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await S({chatId:a._id,projectId:e})}finally{j.current=!1}return}if(i.startsWith(`project:`)){let e=i===i9?null:i.slice(8);if((a.projectId??null)===e)return;j.current=!0,ee(t=>(t??M).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await S({chatId:a._id,projectId:e})}finally{j.current=!1}return}let o=be(i);if(!o||t.id===n.id)return;if((o.projectId??null)!==(a.projectId??null)||o.pinned!==a.pinned){if(a.pinned||o.pinned)return;j.current=!0,ee(e=>(e??M).map(e=>e._id===a._id?{...e,projectId:o.projectId??null}:e));try{await S({chatId:a._id,projectId:o.projectId??null})}finally{j.current=!1}return}let s=o.pinned?ue:fe(o.projectId??null),c=s.map(e=>e._id),l=c.indexOf(a._id),u=c.indexOf(o._id);if(l<0||u<0)return;let d=[...s];d.splice(l,1),d.splice(u,0,a);let f=d[u-1]??null,p=d[u+1]??null;j.current=!0,ee(e=>[...(e??M).filter(e=>!s.some(t=>t._id===e._id)),...d]);try{await b({chatId:a._id,prevKey:f?f.sortKey:null,nextKey:p?p.sortKey:null})}finally{j.current=!1}}let Se=K8(),Ce=Se?pEe(Se.state):null,[we,Te]=(0,z.useState)(!1),Ee=N?be(N):null;return(0,B.jsxs)(`aside`,{className:`oc-sidebar`+(we?` oc-sidebar--archivedrop`:``),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),Te(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Te(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes(`Files`))return;e.preventDefault(),Te(!1);let t=e.dataTransfer.files[0];t!==void 0&&Se?.importArchive(t,null)},children:[we?(0,B.jsxs)(`div`,{className:`oc-sidebar__droparchive`,"aria-hidden":!0,children:[(0,B.jsx)(Ab,{className:`size-4`}),(0,B.jsx)(`span`,{children:mc()})]}):null,Ce===null?null:(0,B.jsxs)(`div`,{className:`oc-sidebar__transfer`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-spin`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-label`,children:Ce})]}),(0,B.jsxs)(`div`,{className:`oc-sidebar__top`,ref:T,children:[(0,B.jsxs)(Lh,{className:O===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,title:`${w} (${r})`,"aria-label":w,children:[(0,B.jsx)(db,{}),O===`icon`?null:(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w}),O===`full`?(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,"aria-hidden":!0,children:r}):null]}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:E,children:[(0,B.jsxs)(Lh,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(db,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w}),(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,B.jsx)(Lh,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(Ay,{})})]})}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:D,children:[(0,B.jsxs)(Lh,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(db,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w})]}),(0,B.jsx)(Lh,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(Ay,{})})]})}),(0,B.jsx)(Lh,{className:`oc-newproject`,variant:`outline`,size:`icon`,"aria-label":Fc(),title:Fc(),onClick:async()=>{let e=await C({title:Fc(),label:sm(),placeholder:Xf(),confirmLabel:Qs()});e&&await _({name:e})},children:(0,B.jsx)(Ay,{})})]}),(0,B.jsxs)(E7,{sensors:oe,collisionDetection:le,modifiers:[UDe,HDe],onDragStart:e=>P(String(e.active.id)),onDragCancel:()=>{P(null),ce()},onDragEnd:xe,children:[(0,B.jsx)(`div`,{className:`oc-sidebar__scroll`,children:te?(0,B.jsx)(c9,{}):(0,B.jsxs)(B.Fragment,{children:[ue.length>0?(0,B.jsx)(l9,{label:Yu(),chats:ue,children:ue.map(n=>(0,B.jsx)(u9,{chat:n,active:n._id===e,unread:m.has(n._id),busy:u.has(n._id),bookmarked:p.has(n._id),referenceLabel:f,ageTick:h,suppressClick:se,onSelect:t},n._id))}):null,(0,B.jsx)(B7,{items:he.map(e=>o9(e._id)),strategy:L7,children:he.map(n=>{let r=ye(n._id);return(0,B.jsx)(l9,{label:n.name,dropId:oOe(n._id),sortId:o9(n._id),suppressClick:se,projectId:n._id,project:n,chats:r,collapsible:!0,collapsed:n.collapsed,busy:r.some(e=>u.has(e._id)),unread:r.some(e=>m.has(e._id)),onToggle:()=>void v({projectId:n._id,collapsed:!n.collapsed}),onOpen:()=>void pe({to:`/project/$projectId`,params:{projectId:n._id}}),children:n.collapsed?null:r.length===0?(0,B.jsx)(`div`,{className:`oc-sidebar__empty`,children:em()}):r.map(r=>(0,B.jsx)(u9,{chat:r,active:r._id===e,unread:m.has(r._id),busy:u.has(r._id),bookmarked:p.has(r._id),referenceLabel:f,domainLabel:r.projectId!==null&&r.projectId!==n._id?ve.get(r.projectId)??null:null,ageTick:h,suppressClick:se,onSelect:t},r._id))},n._id)})}),ge.length>0?(0,B.jsxs)(fF,{children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`oc-sidebar__hiddenfolders`,children:[(0,B.jsx)(wy,{className:`size-3.5`,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:Zp({count:ge.length})})]})}),(0,B.jsx)(mF,{align:`start`,className:`w-56`,children:ge.map(e=>(0,B.jsxs)(hF,{onSelect:()=>void y({projectId:e._id,hidden:!1}),children:[(0,B.jsx)(ky,{}),` `,e.name]},e._id))})]}):null,(0,B.jsx)(l9,{label:jf(),dropId:i9,chats:fe(null),collapsible:!0,collapsed:ne,busy:fe(null).some(e=>u.has(e._id)),unread:fe(null).some(e=>m.has(e._id)),onToggle:ie,children:ne?null:fe(null).map(n=>(0,B.jsx)(u9,{chat:n,active:n._id===e,unread:m.has(n._id),busy:u.has(n._id),bookmarked:p.has(n._id),referenceLabel:f,ageTick:h,suppressClick:se,onSelect:t},n._id))})]})}),(0,B.jsxs)(j7,{children:[N?.startsWith(a9)?(()=>{let e=(a??[]).find(e=>o9(e._id)===N);return e?(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head oc-chatitem--overlay`,style:{"--proj-hue":Y7(e)},children:[(0,B.jsx)(sy,{className:`size-3.5 shrink-0 oc-sidebar__group-chev`}),(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e.name})]}):null})():null,Ee?(0,B.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[J7(Ee.color)?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:J7(Ee.color)}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsx)(`span`,{className:`oc-chatitem__label`,children:Ee.title||_m()})]}):null]})]})]})}function l9({label:e,dropId:t,sortId:n,suppressClick:r,projectId:i,project:a,chats:o,collapsible:s,collapsed:c,busy:l,unread:u,onToggle:d,onOpen:f,children:p}){let m=Ns(L.projects.setProjectSidebar),h=K8(),g=Ns(L.projects.deleteProject),_=Ns(L.projects.renameProject),v=Ns(L.projects.setProjectColor),y=Ns(L.projects.moveProject),b=B3(),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(e),[T,E]=(0,z.useState)(!1),D=I(L.projects.projectTreeCount,i?{projectId:i}:`skip`),{setNodeRef:O,isOver:k}=k7({id:t??`static:${e}`}),A=H7({id:n??`static-sort:${e}`,disabled:!n}),{onKeyDown:ee,...j}=A.listeners??{},M=f??d,te=e=>{e.target===e.currentTarget&&s&&M&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),M())},N=a?Y7(a):null;return(0,B.jsxs)(`div`,{ref:e=>{t&&O(e),n&&A.setNodeRef(e)},className:`oc-sidebar__group`+(k?` oc-sidebar__group--over`:``)+(a?` oc-sidebar__group--project`:``),style:{...N?{"--proj-hue":N}:{},...n?{transform:m5.Transform.toString(A.transform),transition:A.transition,opacity:A.isDragging?.35:1}:{}},children:[(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head group/head`+(s?` oc-sidebar__group-head--btn`:``),...s?{role:`button`,tabIndex:0,onClick:()=>{r?.current||M?.()},onKeyDown:te}:{},...n?j:{},children:[s?f?(0,B.jsx)(`button`,{type:`button`,className:`oc-sidebar__group-chevbtn`,"aria-label":c?Tr():ld(),"aria-expanded":!c,onClick:e=>{e.stopPropagation(),!r?.current&&d?.()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:c?(0,B.jsx)(ly,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(sy,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)})}):c?(0,B.jsx)(ly,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(sy,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):null,(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Yf(),onClick:e=>e.stopPropagation(),...A.attributes,onKeyDown:ee,children:(0,B.jsx)(Iy,{className:`size-3.5`})}):null,c&&l?(0,B.jsx)(`span`,{className:`oc-chatitem__busy`,title:yl(),"aria-label":yl()}):null,c&&u?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:Mn(),"aria-label":Mn()}):null,i?(0,B.jsxs)(fF,{children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsx)(Lh,{variant:`ghost`,size:`icon-xs`,"aria-label":wi(),className:`oc-sidebar__group-menu opacity-0 group-hover/head:opacity-100 group-focus-within/head:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(xy,{})})}),(0,B.jsxs)(mF,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[f?(0,B.jsxs)(hF,{onSelect:()=>f(),children:[(0,B.jsx)(ky,{}),` `,on()]}):null,(0,B.jsxs)(hF,{onSelect:()=>{w(e),S(!0)},children:[(0,B.jsx)(ob,{}),` `,Ju()]}),(0,B.jsxs)(hF,{onSelect:()=>E(!0),children:[(0,B.jsx)(Ay,{}),` `,Du()]}),a!==void 0&&a.parentId===null?(0,B.jsxs)(hF,{onSelect:()=>void m({projectId:a._id,hidden:!0}),children:[(0,B.jsx)(wy,{}),` `,eo()]}):null,h&&a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(hF,{disabled:h.state.running,onSelect:()=>h.exportFolder(a._id,e),children:[(0,B.jsx)(by,{}),` `,na()]}),(0,B.jsxs)(hF,{disabled:h.state.running,onSelect:()=>h.pickAndImport(a._id),children:[(0,B.jsx)(Ab,{}),` `,mh()]})]}):null,(0,B.jsx)(gF,{children:gm()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void v({projectId:i,color:null}),"aria-label":vl(),children:`✕`}),q7.map(e=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(a?.color===e.value?` is-selected`:``),style:{background:e.hue},"aria-label":e.value,onClick:()=>void v({projectId:i,color:e.value})},e.value))]}),(0,B.jsx)(_F,{}),(0,B.jsxs)(hF,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let t=D?.folders??0,n=D?.chats??0;await b({title:Ht({name:e}),description:t>0?za({folders:t,chats:n}):n>0?yo({count:n}):Pc(),confirmWord:om(),confirmLabel:Yn(),destructive:!0})&&await g({projectId:i})})},children:[(0,B.jsx)(Ob,{}),` `,om()]})]})]}):null]}),(0,B.jsx)(`div`,{className:a&&!c?`oc-sidebar__group-body`:void 0,children:(0,B.jsx)(B7,{items:o.map(e=>e._id),strategy:L7,children:p})}),i?(0,B.jsx)(K7,{open:x,onOpenChange:S,title:ss(),canSubmit:C.trim().length>0,onSubmit:async()=>{await _({projectId:i,name:C.trim()}),S(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:wo()}),(0,B.jsx)(yF,{value:C,onChange:e=>w(e.target.value),autoFocus:!0})]})})}):null,i&&T?(0,B.jsx)(X7,{open:T,onOpenChange:E,title:hp(),movingFolderId:i,currentId:a?.parentId??null,onPick:e=>void y({projectId:i,parentId:e})}):null]})}var u9=(0,z.memo)(function({chat:e,active:t,unread:n,busy:r,bookmarked:i,referenceLabel:a,domainLabel:o,suppressClick:s,onSelect:c}){let l=K8(),{attributes:u,listeners:d,setNodeRef:f,transform:m,transition:h,isDragging:g}=H7({id:e._id}),{onKeyDown:_,...v}=d??{},y=Ns(L.chats.renameChat),b=VF(),x=()=>{if(a===void 0)return;let t=mEe(a,e._id);navigator.clipboard.writeText(t).then(()=>b.success(Oee({reference:t})),()=>b.error(zd()))},S=Ns(L.chats.deleteChat),w=Ns(L.chats.pinChat),T=Ns(L.chats.setChatColor),E=Ns(L.chats.moveChatToProject),D=Ns(L.chats.setChatSidebar),O=Rv(),[k,A]=(0,z.useState)(!1),ee=I(L.me.getMe,{host:o3})?.ui?.effective?.showChatAge??!0,j=B3(),[M,te]=(0,z.useState)(!1),[N,P]=(0,z.useState)(e.title??``),ne=J3()?.chatId===e._id,re=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!ne)return;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;re.current?.scrollIntoView({block:`nearest`,behavior:t?`auto`:`smooth`});let n=setTimeout(()=>q3(e._id),2600);return()=>clearTimeout(n)},[ne,e._id]);let ie={transform:m5.Transform.toString(m),transition:h,opacity:+!g},ae=J7(e.color);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{ref:e=>{f(e),re.current=e},style:ie,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``)+(ne?` oc-chatitem--flash`:``),onClick:()=>{s.current||c(e._id)},...v,onAnimationEnd:t=>{ne&&t.animationName===`oc-chatitem-flash`&&q3(e._id)},children:[(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Yf(),onClick:e=>e.stopPropagation(),...u,onKeyDown:_,children:(0,B.jsx)(Iy,{className:`size-3.5`})}),ae?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:ae}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsxs)(`button`,{className:`oc-chatitem__label`,onClick:t=>{t.stopPropagation(),!s.current&&c(e._id)},children:[(0,B.jsx)(`span`,{className:`oc-chatitem__title`,children:e.title||_m()}),o?(0,B.jsx)(`span`,{className:`oc-chatitem__domain`,children:o}):null]}),r?(0,B.jsx)(`span`,{className:`oc-chatitem__busy`,title:C(),"aria-label":C()}):null,n?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:Mn(),"aria-label":Mn()}):null,e.readOnly?(0,B.jsx)(`span`,{className:`oc-chatitem__readonly`,title:jp(),children:(0,B.jsx)(Uy,{size:12,"aria-label":jp()})}):null,i?(0,B.jsx)(`span`,{className:`oc-chatitem__bookmark group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:lp(),children:(0,B.jsx)(ny,{size:12,"aria-label":lp()})}):null,ee?(0,B.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:t0(e.updatedAt),children:r9(e.updatedAt,Date.now())}):null,(0,B.jsxs)(fF,{children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsx)(Lh,{variant:`ghost`,size:`icon-xs`,"aria-label":Zs(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(xy,{})})}),(0,B.jsxs)(mF,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(hF,{onSelect:()=>{P(e.title??``),te(!0)},children:[(0,B.jsx)(ob,{}),` `,Ju()]}),l?(0,B.jsxs)(hF,{disabled:l.state.running,onSelect:()=>l.exportChat(e._id,e.title??jf()),children:[(0,B.jsx)(by,{}),` `,Pe()]}):null,(0,B.jsxs)(hF,{onSelect:()=>void w({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,B.jsx)(lb,{}):(0,B.jsx)(cb,{}),e.pinned?$p():Af()]}),(0,B.jsxs)(hF,{onSelect:x,disabled:a===void 0,children:[(0,B.jsx)(By,{}),` `,Jc()]}),(0,B.jsxs)(hF,{onSelect:()=>A(!0),children:[(0,B.jsx)(ky,{}),` `,su()]}),e.projectId===null?null:(0,B.jsxs)(hF,{onSelect:()=>void O({to:`/project/$projectId`,params:{projectId:e.projectId},search:{c:e._id}}),children:[(0,B.jsx)(jy,{}),` `,Dt()]}),e.pinned?null:(0,B.jsxs)(hF,{onSelect:()=>void D({chatId:e._id,hidden:!0}),children:[(0,B.jsx)(nb,{}),` `,eo()]}),(0,B.jsx)(gF,{children:gm()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void T({chatId:e._id,color:null}),"aria-label":vl(),children:`✕`}),q7.map(t=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void T({chatId:e._id,color:t.value})},t.value))]}),(0,B.jsx)(_F,{}),(0,B.jsxs)(hF,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await j({title:p(),description:hi(),confirmLabel:om(),destructive:!0})&&await S({chatId:e._id})})},children:[(0,B.jsx)(Ob,{}),` `,om()]})]})]})]}),(0,B.jsx)(K7,{open:M,onOpenChange:te,title:Qo(),canSubmit:N.trim().length>0,onSubmit:async()=>{await y({chatId:e._id,title:N.trim()}),te(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:wo()}),(0,B.jsx)(yF,{value:N,onChange:e=>P(e.target.value),autoFocus:!0})]})})}),k?(0,B.jsx)(X7,{open:k,onOpenChange:A,title:df(),currentId:e.projectId,onPick:t=>void E({chatId:e._id,projectId:t})}):null]})}),d9=null,f9=0,cOe=400;function lOe(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!d9)try{d9=new e}catch{return null}return d9}function p9(e,t,n,r,i){let a=e.createOscillator(),o=e.createGain();a.type=`sine`,a.frequency.value=t;let s=e.currentTime+n;o.gain.setValueAtTime(1e-4,s),o.gain.linearRampToValueAtTime(i,s+.015),o.gain.exponentialRampToValueAtTime(1e-4,s+r),a.connect(o).connect(e.destination),a.start(s),a.stop(s+r+.02)}function m9(e){let t=Date.now();if(t-f9<cOe)return;let n=lOe();if(!n)return;f9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function uOe(){m9(e=>{p9(e,660,0,.16,.12),p9(e,440,.14,.2,.1)})}function dOe(){m9(e=>{p9(e,880,0,.14,.08)})}function fOe({activeChatId:e}){let t=I(L.messages.listChats,{}),n=Ns(L.chatReads.markChatSeen),r=I(L.me.getMe,{host:o3}),i=r?.ui?.effective?.replySound===!0,a=r?.userId??null,o=(0,z.useRef)(null),s=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(!t)return;s.current!==String(a)&&(s.current=String(a),o.current=null);let r=new Map;for(let e of t)e.lastAssistantAt!==null&&r.set(e._id,e.lastAssistantAt);let c=o.current;if(o.current=r,c===null)return;let l=!1;for(let[t,i]of r){let r=c.get(t);r!==void 0&&i<=r||r===void 0&&Date.now()-i>3e4||(l=!0,t===e&&document.visibilityState===`visible`?n({chatId:t}):t!==e&&K3(t))}l&&i&&dOe()},[t,e,i,n,a]),(0,z.useEffect)(()=>{e&&document.visibilityState===`visible`&&n({chatId:e})},[e,n]),(0,z.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&n({chatId:e})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,n]),null}function h9(e){let t=Ns(L.chats.createChat),n=I(L.agents.listMyAgents),[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(void 0),o=(0,z.useCallback)(async(n,r)=>{e(await t({instanceName:n,agentId:r,projectId:a.current}))},[t,e]);return{startNewChat:(0,z.useCallback)(async e=>{a.current=e?.projectId;let t=n;if(t&&t.length===1&&t[0].state!==`deleted`){await o(t[0].instanceName,t[0].agentId);return}i(!0)},[n,o]),picker:(0,B.jsx)(OSe,{open:r,onOpenChange:i,agents:n,onPick:(e,t)=>{i(!1),o(e,t)}})}}var g9=[`admin`,`user`,`pending`];function _9(){let e=I(L.me.authProviders)?.anonymous===!0,[t,n]=(0,z.useState)(!1),r=I(L.dev.listUsersDev,e?{}:`skip`),i=I(L.me.getImpersonation),a=Ns(L.dev.setMyRole),o=Ns(L.dev.setRole),s=Ns(L.admin.startImpersonation),c=Ns(L.admin.stopImpersonation);if(!e)return null;let l=r?.find(e=>e.isMe),u=l?.role===`admin`,d=i?.impersonating===!0,f=(r??[]).filter(e=>!e.isMe);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:Ie(),children:[(0,B.jsx)(Pb,{size:13}),`DEV`]}),(0,B.jsx)(o0,{open:t,onOpenChange:n,children:(0,B.jsxs)(s0,{children:[(0,B.jsxs)(c0,{children:[(0,B.jsx)(u0,{children:ia()}),(0,B.jsx)(d0,{children:gh()})]}),(0,B.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,B.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[gc({canonical:l?.canonical??`…`}),` `,(0,B.jsx)(UF,{variant:`outline`,children:l?.role??`…`})]}),(0,B.jsx)(`div`,{className:`oc-devsw__roles`,children:g9.map(e=>(0,B.jsx)(Lh,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?tte():e===`user`?Pm():js()},e))})]}),d?(0,B.jsxs)(`div`,{className:`oc-devsw__imp`,children:[cu(),` `,(0,B.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,B.jsx)(Lh,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Ou()})]}):null,(0,B.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,B.jsx)(`p`,{className:`oc-devsw__empty`,children:ff()}):f.map(e=>(0,B.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,B.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,B.jsx)(`select`,{className:`oc-devsw__select`,value:e.role,disabled:!e.canonical,onChange:t=>e.canonical&&void o({canonical:e.canonical,role:t.target.value}),children:g9.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))}),(0,B.jsx)(Lh,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?Bl():el():gp(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:Pee()})]},e.profileId))})]})})]})}function v9({label:e,mode:t,minimal:n=!1}){let{signOut:r}=ng(),i=Ns(L.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(L.me.getMe,{host:o3});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(L.me.getMe,{host:o3},{...n,themeMode:t,resolvedThemeMode:r})}),a=t??`default`;return(0,B.jsxs)(fF,{children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsxs)(Lh,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,B.jsx)(sy,{className:`opacity-60`})]})}),(0,B.jsx)(mF,{align:`end`,className:`w-52`,children:n?(0,B.jsxs)(hF,{onClick:()=>void r(),children:[(0,B.jsx)(Wy,{}),` `,Ut()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(gF,{children:Po()}),(0,B.jsxs)(Kue,{value:a,onValueChange:e=>void i({mode:e==="default"?null:e}),children:[(0,B.jsxs)(vF,{value:`light`,children:[(0,B.jsx)(Tb,{}),` `,Jo()]}),(0,B.jsxs)(vF,{value:`dark`,children:[(0,B.jsx)(eb,{}),` `,Pn()]}),(0,B.jsxs)(vF,{value:`system`,children:[(0,B.jsx)($y,{}),` `,Np()]}),(0,B.jsx)(vF,{value:`default`,children:Zn()})]}),(0,B.jsx)(_F,{}),(0,B.jsxs)(hF,{onClick:()=>void r(),children:[(0,B.jsx)(Wy,{}),` `,Ut()]})]})})]})}var pOe={altered_words:()=>Ri(),incorrect:()=>sr(),incoherence:()=>gn(),formatting:()=>St(),latency:()=>ci(),api_error:()=>Pr(),other:()=>br()},y9=e=>pOe[e]?.()??e,mOe={anomaly_open:kb,anomaly_resolved:fy,feedback_reply:Jy,feedback_resolved:Jy,feedback_new:Jy,curation:Ey,operator_announcement:Ky},hOe={atrium:()=>Td(),assistants:()=>Qr(),platform:()=>Xe()},gOe={investigating:()=>ft(),monitoring:()=>ba(),resolved:()=>Xm()},b9=e=>(e?hOe[e]:void 0)?.()??`?`,_Oe=e=>(e?gOe[e]:void 0)?.()??`?`,x9=e=>{let t=e===void 0?NaN:Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(T()):`?`},vOe={notif_feedback_reply_admin:()=>({title:tn(),body:Za()}),notif_feedback_reply:()=>({title:tn(),body:Za()}),notif_feedback_resolved:()=>({title:mo(),body:Pa()}),notif_feedback_new:e=>({title:_e(),body:fte({reference:e.reference??`?`,category:y9(e.category??`other`)})}),notif_curation_proposed:e=>({title:wp(),body:Un({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:It(),body:lo({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:Aa(),body:Qt({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Ja({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:me({kind:e.kind??`?`}),body:t.body}),notif_operator_maintenance_scheduled:e=>({title:ur(),body:yn({service:b9(e.service),startsAt:x9(e.starts_at),endsAt:x9(e.ends_at)})}),notif_operator_maintenance_completed:e=>({title:Tt(),body:ui({service:b9(e.service),completedAt:x9(e.completed_at)})}),notif_operator_incident_update:e=>({title:Ir(),body:Cr({service:b9(e.service),status:_Oe(e.status),reference:e.reference??`?`})}),notif_operator_subscription_notice:e=>({title:sd(),body:ie({plan:e.plan??`?`,effectiveAt:x9(e.effective_at)})})};function S9(e){let t=e.messageKey?vOe[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:tn(),body:Za()}:e.kind===`feedback_resolved`?{title:mo(),body:Pa()}:{title:e.title,body:e.body}}function yOe(){let e=I(L.notifications.myUnreadCount)??0,t=I(L.notifications.myNotifications),n=I(L.feedback.myFeedback),r=Ns(L.notifications.markRead),i=Ns(L.notifications.markAllRead),a=Ns(L.notifications.clearOne),o=Ns(L.notifications.clearAll),s=Ns(L.feedback.closeMyFeedback),c=Rv(),[l,u]=(0,z.useState)(!1),d=I(L.me.getMe,{host:o3}),f=d?.ui?.effective?.notifSound===!0,p=d?.ui?.effective?.notifSystem===!0,m=d?.userId??null,h=(0,z.useRef)(null),g=(0,z.useRef)(0),_=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!t)return;_.current!==String(m)&&(_.current=String(m),h.current=null,g.current=0);let e=t.reduce((e,t)=>Math.max(e,t.creationTime??0),0);if(h.current===null){h.current=new Set(t.map(e=>String(e._id))),g.current=e;return}let n=h.current,r=t.filter(e=>!n.has(String(e._id))&&(e.creationTime??0)>g.current);for(let e of t)n.add(String(e._id));if(g.current=Math.max(g.current,e),n.size>500){let e=new Set(t.map(e=>String(e._id)));for(let t of n)e.has(t)||n.delete(t)}if(r.length!==0&&(f&&uOe(),p&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=S9(e);try{let r=new Notification(t,{body:n,tag:String(e._id)});r.onclick=()=>window.focus()}catch{}}},[t,f,p,m]);let v=e=>{if(e.unread&&r({notificationId:e._id}),!e.href)return;if(u(!1),e.href.startsWith(`/chat/`)){c({to:`/chat/$chatId`,params:{chatId:e.href.slice(6)}});return}let[t,n]=e.href.split(`?`);c({to:t,search:Object.fromEntries(new URLSearchParams(n??``))})};return(0,B.jsxs)(fF,{open:l,onOpenChange:u,children:[(0,B.jsx)(pF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?oee({count:e}):Hf(),children:[(0,B.jsx)(ty,{size:18,"aria-hidden":!0}),e>0?(0,B.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,B.jsxs)(mF,{align:`end`,className:`oc-notif`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,B.jsx)(`span`,{children:Us()}),t&&t.length>0?(0,B.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:Bu()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Gp()})]}):null]}),t===void 0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:ls()}):t.length===0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:Cf()}):(0,B.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=mOe[e.kind]??ty,{title:n,body:i}=S9(e);return(0,B.jsxs)(`div`,{className:`oc-notif__item${e.unread?` is-unread`:``}${e.href?` is-link`:``}`,role:e.href?`button`:void 0,tabIndex:e.href?0:void 0,onClick:e.href?()=>v(e):void 0,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,B.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,B.jsx)(`button`,{type:`button`,title:mm(),"aria-label":mm(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,B.jsx)(oy,{size:13})}):null,(0,B.jsx)(`button`,{type:`button`,title:dl(),"aria-label":dl(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,B.jsx)(Sh,{size:13})})]})]}),(0,B.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(T())})]},e._id)})}),n&&n.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:y()}),(0,B.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,B.jsx)(bOe,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function bOe({it:e,onClose:t,onNavigate:n}){let r=VF(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1);async function f(){d(!0);try{await t(c.trim()||void 0)}catch(e){r.error(Kn(),e)}finally{d(!1)}}return(0,B.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(`span`,{className:`oc-notif__title`,children:y9(e.category)}),(0,B.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?Op():e.answered?xi():is()})]}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(T())}),e.thread.length>0?(0,B.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,B.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?Oo():e.authorRole===`agent`?Uo():Ho()}),(0,B.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,e.messageText?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-notif__report-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,B.jsx)(sy,{size:13,"aria-hidden":!0}):(0,B.jsx)(ly,{size:13,"aria-hidden":!0}),Dp()]}),i?(0,B.jsx)(`div`,{className:`oc-notif__report-msg`,children:e.messageText}):null]}):null,(0,B.jsxs)(`div`,{className:`oc-notif__report-actions`,children:[(0,B.jsx)(Wv,{to:`/chat/$chatId`,params:{chatId:e.chatId},search:{m:e.messageId},className:`oc-notif__link`,onClick:n,children:kn()}),o?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:Kn()})]}),o?(0,B.jsxs)(`div`,{className:`oc-notif__close-form`,children:[(0,B.jsx)(`textarea`,{className:`oc-notif__close-input`,rows:2,value:c,onChange:e=>l(e.target.value),placeholder:zt()}),(0,B.jsxs)(`div`,{className:`oc-notif__close-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-confirm`,disabled:u,onClick:()=>void f(),children:po()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:Na()})]})]}):null]})}var C9=2,xOe=180;function SOe(){let e=Rv(),t=(0,z.useRef)(null),n=(0,z.useRef)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(0),d=(0,z.useMemo)(()=>kF(CF,OF()),[]);(0,z.useEffect)(()=>{let e=setTimeout(()=>c(a),xOe);return()=>clearTimeout(e)},[a]);let f=s.trim(),p=I(L.search.searchConversations,f.length>=C9?{query:f}:`skip`),m=p??[],h=f.length>=C9&&p===void 0;(0,z.useEffect)(()=>{let e=e=>{AF(e,CF)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,z.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,z.useEffect)(()=>{u(0)},[p]),(0,z.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let g=(0,z.useCallback)((t,n)=>{i(!1),n&&a.trim()&&j6(n,a.trim()),e({to:`/chat/$chatId`,params:{chatId:t},...n?{search:{m:n}}:{}})},[e,a]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":sc(),children:[(0,B.jsx)(hb,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-search-trigger__label`,children:Jee()}),(0,B.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:d})]}),(0,B.jsx)(o0,{open:r,onOpenChange:i,children:(0,B.jsxs)(s0,{showCloseButton:!1,className:`oc-search-palette top-[12vh] translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,B.jsx)(u0,{className:`sr-only`,children:Vee()}),(0,B.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,B.jsx)(hb,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:t,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,m.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=m[l];t&&g(t.chatId,t.messageId)}},placeholder:ys(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":Xl()})]}),(0,B.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:f.length<C9?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:_u({count:C9})}):h?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:ef()}):m.length===0?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:ap({term:f})}):m.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:Pp(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>g(e.chatId,e.messageId),children:[(0,B.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,B.jsx)(Ly,{size:15}):(0,B.jsx)(Jy,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,B.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||kl()}),e.projectPath&&e.projectPath.length>0?(0,B.jsx)(`span`,{className:`oc-search-result__path`,"aria-label":As(),children:e.projectPath.join(` › `)}):null,e.snippet?(0,B.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,B.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?Gc():Tee()})]},e.chatId))}),(0,B.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↑`}),(0,B.jsx)(`kbd`,{children:`↓`}),` `,Id()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↵`}),` `,Ec()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:aee()}),` `,Vf()]})]})]})})]})}var w9=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`],T9=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`],E9={users:()=>id(),groups:()=>uc(),instances:()=>P(),bridge:()=>Sd(),injections:()=>$o(),serviceAccounts:()=>Yr(),roles:()=>qe(),access:()=>Zee(),traces:()=>lt(),kpi:()=>ga(),anomalies:()=>Km(),files:()=>nte(),scheduled:()=>ln(),agentFiles:()=>es(),preferences:()=>bo(),integrations:()=>Ae(),theme:()=>ca(),chatDefaults:()=>ac(),audit:()=>Qi(),feedbacks:()=>uh(),subagentReports:()=>Dm(),voice:()=>Zl()},D9={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`},COe=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function O9(e){let t=new Set(e);return w9.filter(e=>t.has(D9[e]))}function k9(e){return`/settings/${e}`}function A9(e){let t=e.split(`/`)[2];return w9.includes(t)?t:void 0}var wOe={uiprefs:`preferences`},j9=[{id:`personal`,label:()=>Oa(),tabs:[`preferences`,`theme`,`files`,`scheduled`]},{id:`agents`,label:()=>Xt(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>Ka(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>fe(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],TOe=new Map(j9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function M9(e){let t=TOe.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function EOe(e,t){return e.find(e=>M9(e)===t)}j9.flatMap(e=>[...e.tabs]);function DOe(){let e=I(L.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.gatewaysUnreachable??0,n=e.known?e.available?t>0?`warn`:`ok`:`error`:`idle`,r=e.known?e.available?t>0?ah({count:t}):`${vd()}${e.checkedAt?Gr({time:n0(e.checkedAt)}):``}`:We({reason:e.reason??`?`}):M();return(0,B.jsx)(T6,{delayDuration:150,children:(0,B.jsxs)(E6,{children:[(0,B.jsx)(D6,{asChild:!0,children:(0,B.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,B.jsx)(O6,{children:r})]})})}function N9(e){let t=new Set(w9),n=new Set,r=[];for(let i of e??[])t.has(i)&&!n.has(i)&&(r.push(i),n.add(i));for(let e of w9)n.has(e)||r.push(e);return r}function OOe(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function kOe({tab:e,active:t}){let n=E9[e](),r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,B.jsx)(DOe,{}):null]});return T9.includes(e)?(0,B.jsx)(Wv,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,B.jsx)(Wv,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function AOe({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=H7({id:e});return(0,B.jsxs)(`div`,{ref:i,style:{transform:m5.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":Sp(),...n,...r,children:(0,B.jsx)(Iy,{size:14,"aria-hidden":!0})}),(0,B.jsx)(kOe,{tab:e,active:t})]})}function jOe(){let e=I(L.me.getMe,{host:o3}),t=Ns(L.me.setSettingsTabOrder),n=A9(Qv({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,z.useMemo)(()=>N9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,z.useState)(i);(0,z.useEffect)(()=>o(i),[i]);let s=(0,z.useMemo)(()=>new Set(O9(e?.permissions??[])),[e?.permissions]),c=(0,z.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&M9(e)===r),[a,s,r]),l=b5(y5(e7,{activationConstraint:{distance:5}}),y5(X5,{coordinateGetter:W7}));if(r===void 0||c.length===0)return null;let u=j9.find(e=>e.id===r);function d(e){let{active:n,over:r}=e;if(!r||n.id===r.id)return;let i=c.indexOf(n.id),s=c.indexOf(r.id);if(i<0||s<0)return;let l=OOe(a,M7(c,i,s));o(l),t({order:l})}return(0,B.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,B.jsx)(E7,{sensors:l,collisionDetection:jEe,modifiers:[BDe],onDragEnd:d,children:(0,B.jsx)(B7,{items:c,strategy:qDe,children:c.map(e=>(0,B.jsx)(AOe,{tab:e,active:e===n},e))})})})}function MOe(){let e=I(L.me.getMe,{host:o3}),t=Rv(),n=A9(Qv({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,z.useMemo)(()=>new Set(O9(e?.permissions??[])),[e?.permissions]),a=(0,z.useMemo)(()=>N9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=j9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=EOe(a,e.id);n&&t({to:k9(n)})}return(0,B.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":Vn(),children:[(0,B.jsx)(Wv,{to:`/`,className:`oc-settings-nav__back`,children:Pt()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__title`,children:so()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-nav__group`+(e.id===r?` is-active`:``),"aria-current":e.id===r?`true`:void 0,onClick:()=>s(e),children:e.label()},e.id))})]})}var NOe=[`eq`,`neq`,`contains`,`gt`,`gte`,`lt`,`lte`],P9=[50,100,200,500],F9=`now-30d`,POe=`now-24h`;function FOe(e,t,n=F9,r=`now`){let i=e??n,a=t??r,o=Number(i),s=Number(a);return i!==``&&a!==``&&Number.isFinite(o)&&Number.isFinite(s)?{kind:`absolute`,from:o,to:s}:{kind:`relative`,from:i,to:a}}function IOe(e){return e.kind===`absolute`?{from:String(e.from),to:String(e.to)}:{from:e.from,to:e.to}}function LOe(e){if(e.length!==0)return JSON.stringify(e)}function ROe(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e,r=t.field,i=t.op,a=t.value;typeof r!=`string`||r===``||typeof i!=`string`||!NOe.includes(i)||typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`||n.push({field:r,op:i,value:a})}return n}var I9=F4().optional(),L9=F4().optional(),R9=F4().optional(),z9=F4().optional().catch(void 0),zOe=H4({q:I9,section:G4([`latency`,`events`]).default(`events`).catch(`events`),kind:F4().default(`all`).catch(`all`),correlationId:F4().optional().catch(void 0),limit:Gxe().pipe(U4([K4(P9[0]),K4(P9[1]),K4(P9[2]),K4(P9[3])])).catch(100),statusClass:G4([`2xx`,`4xx`,`5xx`]).optional().catch(void 0),principalType:G4([`user`,`service`,`system`]).optional().catch(void 0),direction:G4([`inbound`,`outbound`,`internal`]).optional().catch(void 0),roleKey:z9,from:L9,to:L9,adv:R9}),BOe=H4({q:I9,action:z9,impersonated:G4([`yes`,`no`]).optional().catch(void 0),resource:z9,from:L9,to:L9,adv:R9}),VOe=H4({q:I9,status:G4([`open`,`acknowledged`,`resolved`,`all`]).default(`open`).catch(`open`),severity:G4([`info`,`warn`,`critical`]).optional().catch(void 0),kind:z9,from:L9,to:L9}),HOe=H4({from:L9,to:L9}),UOe=H4({q:I9,status:G4([`active`,`disabled`]).optional().catch(void 0)}),WOe=H4({q:I9,role:z9});H4({q:I9,mode:G4([`per-user`,`shared`]).optional().catch(void 0)});var GOe=H4({section:G4([`readaloud`,`dictation`,`talk`]).default(`readaloud`).catch(`readaloud`)}),KOe=H4({section:F4().max(32).default(`openclaw`).catch(`openclaw`)}),B9=`oc.theme`;function V9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function H9(e){(0,z.useEffect)(()=>{let t=e??localStorage.getItem(B9)??`system`;if(localStorage.setItem(B9,t),V9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>V9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}var U9=`oc.fontScale`,qOe={sm:`87.5%`,md:``,lg:`112.5%`,xl:`125%`,"2xl":`137.5%`,"3xl":`150%`},W9=[`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`];function JOe(e){return e!==null&&W9.includes(e)}function YOe(e){document.documentElement.style.fontSize=qOe[e]}function G9(e){(0,z.useEffect)(()=>{let t=localStorage.getItem(U9),n=e??(JOe(t)?t:`md`);localStorage.setItem(U9,n),YOe(n)},[e])}function XOe(e){(0,z.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=T()}catch{t=void 0}t!==e&&tl(e)},[e])}var ZOe=(0,z.lazy)(()=>zQ(()=>import(`./RolesTab-rtjEoRka.js`).then(e=>({default:e.RolesTab})),__vite__mapDeps([2,1,3,4,5]))),QOe=(0,z.lazy)(()=>zQ(()=>import(`./InstancesTab-CvcFYqzZ.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([6,1,3,7,8,9,10,11,12,13,14,15,5,16,17,18]))),$Oe=(0,z.lazy)(()=>zQ(()=>import(`./PromptInjectionsTab-ydfl3LIa.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([19,1,3,7,8,9,20,5,21]))),eke=(0,z.lazy)(()=>zQ(()=>import(`./GroupsTab-02Klvfu1.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([22,1,3,12,23,18,13,5,16,24,14,15]))),tke=(0,z.lazy)(()=>zQ(()=>import(`./IntegrationsTab-C3v_UYdO.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([25,1,3,5]))),nke=(0,z.lazy)(()=>zQ(()=>import(`./FeedbacksTab-BPxuXa49.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([26,1,3,18,13,5,16]))),rke=(0,z.lazy)(()=>zQ(()=>import(`./SubAgentReportsTab-BlttiEor.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([27,1,3,18,13,5,16]))),ike=(0,z.lazy)(()=>zQ(()=>import(`./FilesTab-Da5f-Q53.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([28,1,3,5,16]))),ake=(0,z.lazy)(()=>zQ(()=>import(`./ScheduledTab-1Z--saSr.js`).then(e=>({default:e.ScheduledTab})),__vite__mapDeps([29,1,3,30,31,13,21,14,15,5,16]))),oke=(0,z.lazy)(()=>zQ(()=>import(`./AgentFilesTab-Bzj4n4RS.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([32,1,3,11,8,5,21]))),ske=(0,z.lazy)(()=>zQ(()=>import(`./PreferencesTab-Dtc4NXr7.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([33,1,3,31,13,21,20,9,5]))),cke=(0,z.lazy)(()=>zQ(()=>import(`./ChatDefaultsTab-DE7qape9.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([34,1,3,11,5,21]))),lke=(0,z.lazy)(()=>zQ(()=>import(`./AccessTab-OP6MT853.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([35,1,3]))),uke=(0,z.lazy)(()=>zQ(()=>import(`./ThemeShowroom-D1Av-z7w.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([36,1,3,23,37,15,5,14,20,9,38,16])));function dke(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(kte,{children:(0,B.jsx)(`div`,{className:`oc-boot`,children:wm()})}),(0,B.jsx)(Ote,{children:(0,B.jsx)(pke,{})}),(0,B.jsx)(Dte,{children:(0,B.jsx)(lde,{children:(0,B.jsx)(fEe,{children:(0,B.jsx)(hke,{})})})})]})}function fke(){return(0,B.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,B.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,B.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,B.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function pke(){let{signIn:e}=ng();H9(void 0),G9(void 0);let t=I(L.charts.brandForHost,{host:o3}),n=iSe(o3),r=t??n??null,i=l3(void 0);u3(r?.tokens??null,i),(0,z.useEffect)(()=>{t&&aSe(o3,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?C3(a,i):null,s=a?.label??`Atrium`,c=I(L.me.authProviders),[l,u]=(0,z.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(hs())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.anonymous;return(0,B.jsxs)(`div`,{className:`oc-signin`,children:[(0,B.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,vectorEffect:`non-scaling-stroke`}),(0,B.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,B.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,B.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,B.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,B.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,B.jsx)(`h1`,{className:`oc-signin__title`,children:Kl()}),(0,B.jsx)(`p`,{className:`oc-signin__subtitle`,children:pu()}),(0,B.jsx)(`div`,{className:`oc-signin__providers`,children:c?.google?(0,B.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,B.jsx)(fke,{}),(0,B.jsx)(`span`,{children:Xd()})]}):null}),l?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:tp()}):null,c?.anonymous?(0,B.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:Tl()}):null]})]})}function mke(){let{width:e,collapsed:t,isMobile:n}=t2();return(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`}}),(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`5.5rem`,height:`1.1rem`}})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`100%`,height:`2.25rem`}})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`,borderRadius:`999px`}})})]}),(0,B.jsxs)(`div`,{className:n?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[!t&&!n?(0,B.jsx)(`div`,{className:`oc-sidebar-col`,style:{width:e,flex:`0 0 ${e}px`},children:(0,B.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{height:`2.25rem`,margin:`0.25rem 0.25rem 0`}}),(0,B.jsx)(c9,{})]})}):null,(0,B.jsx)(`main`,{className:`oc-main`})]})]})}function hke(){let e=I(L.me.getMe,{host:o3}),t=Ns(L.me.bootstrap),n=Rv();(0,z.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),H9(e?.resolvedThemeMode),G9(e?.resolvedFontScale);let r=l3(e?.resolvedThemeMode);u3(e?.resolvedChartTokens,r),XOe(e?.resolvedLocale);let i=(0,z.useRef)(null);if((0,z.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,B.jsx)(mke,{});let a=e.name||e.email||Vc();return e.role===`pending`?(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsx)(K9,{}),(0,B.jsx)(_9,{}),(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,B.jsx)(q9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(v9,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,B.jsxs)(`div`,{className:`oc-pending`,children:[(0,B.jsx)(`h1`,{className:`oc-pending__title`,children:Cee()}),(0,B.jsx)(`p`,{className:`oc-pending__body`,children:Md()})]})]}):(0,B.jsx)(_ke,{canOpenSettings:O9(e.permissions??[]).length>0,viewerUserId:e.userId,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function K9(){let e=I(L.me.getImpersonation),t=Ns(L.admin.stopImpersonation);return!e||!e.impersonating?null:(0,B.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,B.jsx)(Ty,{className:`size-4 shrink-0`}),(0,B.jsxs)(`span`,{className:`oc-imp__text`,children:[Sc(),` `,(0,B.jsx)(`strong`,{children:e.targetLabel}),tee(),(0,B.jsx)(`strong`,{children:e.realLabel}),Lf()]}),(0,B.jsx)(Lh,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:Rs()})]})}function q9({brand:e,resolvedThemeMode:t}){let n=l3(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=C3(e,n),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>s(!1),[a]),(0,B.jsxs)(B.Fragment,{children:[a!==null&&!o?(0,B.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,B.jsx)(T3,{className:`oc-brand__logo`}):null,(0,B.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function gke({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(Lh,{variant:`ghost`,size:`icon-sm`,"aria-label":i?Fu():Bp(),onClick:a,children:i?(0,B.jsx)(rb,{}):(0,B.jsx)(nb,{})}),(0,B.jsx)(Wv,{to:`/`,className:`oc-topbar__brand`,children:(0,B.jsx)(q9,{brand:r,resolvedThemeMode:n})})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(SOe,{})}),(0,B.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,B.jsx)(yOe,{}),(0,B.jsx)(v9,{label:e,mode:t})]})]})}function _ke({canOpenSettings:e,viewerUserId:t,userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a}){let{width:o,columnRef:s,collapsed:c,toggleCollapsed:l,collapse:u,startResize:d,isMobile:f}=t2(),p=Qne(),m=Iv({strict:!1}),h=Rv(),g=!!p({to:`/settings`,fuzzy:!0});(0,z.useEffect)(()=>{f&&u()},[Qv({select:e=>e.pathname}),f,u]);let _=(0,z.useCallback)(e=>{h({to:`/chat/$chatId`,params:{chatId:e}})},[h]),{startNewChat:v,picker:y}=h9(_),b=(0,z.useMemo)(()=>kF(wF,OF()),[]);return(0,z.useEffect)(()=>{let e=e=>{AF(e,wF)&&(e.preventDefault(),v())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]),(0,B.jsxs)(`div`,{className:`oc-shell`,children:[y,(0,B.jsx)(fOe,{activeChatId:m.chatId??null}),(0,B.jsx)(K9,{}),(0,B.jsx)(_9,{}),(0,B.jsx)(gke,{userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a,collapsed:c,onToggleSidebar:l}),(0,B.jsxs)(`div`,{className:f?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[f&&!c?(0,B.jsx)(`div`,{className:`oc-sidebar-backdrop`,onClick:u,"aria-hidden":!0}):null,c?null:(0,B.jsxs)(`div`,{className:`oc-sidebar-col`,ref:e=>{s.current=f?null:e},style:f?void 0:{width:o,flex:`0 0 ${o}px`},children:[g?(0,B.jsx)(MOe,{}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(sOe,{activeChatId:m.chatId??null,onSelect:_,onNewChat:()=>void v(),newChatShortcut:b}),(0,B.jsx)(Lh,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(Wv,{to:`/settings/$tab`,params:{tab:`scheduled`},children:[(0,B.jsx)(ay,{"aria-hidden":!0}),Ko()]})}),(0,B.jsx)(Lh,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(Wv,{to:`/settings/$tab`,params:{tab:`files`},children:[(0,B.jsx)(zy,{"aria-hidden":!0}),Mo()]})}),e?(0,B.jsx)(Lh,{variant:`ghost`,className:`mx-2 mb-2 justify-start`,asChild:!0,children:(0,B.jsxs)(Wv,{to:`/settings`,children:[(0,B.jsx)(yb,{"aria-hidden":!0}),vf()]})}):null]}),(0,B.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:d,role:`separator`,"aria-orientation":`vertical`,"aria-label":pee()})]}),(0,B.jsx)(`main`,{className:`oc-main`,children:(0,B.jsx)(Zv,{})}),(0,B.jsx)(h_e,{viewerUserId:t,currentChatId:m.chatId??null})]}),(0,B.jsx)(ude,{})]})}function vke(){let e=I(L.me.getMe,{host:o3}),t=Rv(),n=Qv({select:e=>e.pathname}),r=(0,z.useMemo)(()=>e?O9(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,z.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:wm()});if(i)return null;let a=A9(n),o=a!==void 0&&!r.includes(a);return(0,B.jsxs)(`div`,{className:`oc-admin`,children:[(0,B.jsx)(jOe,{}),(0,B.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,B.jsx)(yke,{}):(0,B.jsx)(Zv,{})})]})}function yke(){return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(kb,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:ol()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:w()})]})}function bke(){let e=I(L.me.getMe,{host:o3}),t=Rv();return(0,z.useEffect)(()=>{if(e===void 0)return;let n=O9(e.permissions??[]);t({to:n.includes(`files`)?k9(`files`):n.length>0?k9(n[0]):`/`,replace:!0})},[e,t]),(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:wm()})}function xke(e){switch(e){case`groups`:return(0,B.jsx)(eke,{});case`integrations`:return(0,B.jsx)(tke,{});case`instances`:return(0,B.jsx)(QOe,{});case`injections`:return(0,B.jsx)($Oe,{});case`theme`:return(0,B.jsx)(uke,{});case`feedbacks`:return(0,B.jsx)(nke,{});case`subagentReports`:return(0,B.jsx)(rke,{});case`files`:return(0,B.jsx)(ike,{});case`scheduled`:return(0,B.jsx)(ake,{});case`agentFiles`:return(0,B.jsx)(oke,{});case`preferences`:return(0,B.jsx)(ske,{});case`chatDefaults`:return(0,B.jsx)(cke,{});case`access`:return(0,B.jsx)(lke,{});default:return(0,B.jsx)(ZOe,{})}}function Ske(){let{tab:e}=Iv({from:`/settings/$tab`});return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:xke(e)})}function Cke(){let{chatId:e}=Iv({from:`/chat/$chatId`}),{m:t}=Lv({from:`/chat/$chatId`});return(0,z.useEffect)(()=>{Kxe(e)},[e]),(0,B.jsx)(m8,{chatId:e,focusMessageId:t??null})}function wke(){let e=Rv(),t=qxe(),n=I(L.messages.listChats,{}),r=t!==null&&n!==void 0&&n.some(e=>e._id===t);return(0,z.useEffect)(()=>{r&&t&&e({to:`/chat/$chatId`,params:{chatId:t},replace:!0})},[r,t,e]),t!==null&&(n===void 0||r)?(0,B.jsx)(`div`,{className:`oc-boot`,children:wm()}):(0,B.jsx)(m8,{chatId:null})}var J9=Wne({component:dke}),Y9=Gv({getParentRoute:()=>J9,path:`/`,component:wke}),Tke=Gv({getParentRoute:()=>J9,path:`chat/$chatId`,component:Cke,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),Eke=Gv({getParentRoute:()=>J9,path:`project/$projectId`,component:Kv(()=>zQ(()=>import(`./ProjectPage-3M9H_seP.js`),__vite__mapDeps([39,1,3,30,5,40])),`ProjectPage`),validateSearch:e=>({c:typeof e.c==`string`?e.c:void 0})}),X9=Gv({getParentRoute:()=>J9,path:`settings`,component:vke}),Dke=Gv({getParentRoute:()=>X9,path:`/`,component:bke}),Oke=Gv({getParentRoute:()=>X9,path:`traces`,validateSearch:zOe,component:Kv(()=>zQ(()=>import(`./TracesTab-DuT8lvo4.js`),__vite__mapDeps([41,1,3,12,23,18,13,5,16,37,15,14])),`TracesTab`)}),kke=Gv({getParentRoute:()=>X9,path:`bridge`,validateSearch:KOe,component:Kv(()=>zQ(()=>import(`./BridgeTab-D7jnblPV.js`),__vite__mapDeps([10,1,3,11,7,8,9,12,13,14,15,5,16,17])),`BridgeTab`)}),Ake=Gv({getParentRoute:()=>X9,path:`voice`,validateSearch:GOe,component:Kv(()=>zQ(()=>import(`./VoiceTab-DFVKbQpO.js`),__vite__mapDeps([42,1,3,12,5,21])),`VoiceTab`)}),jke=Gv({getParentRoute:()=>X9,path:`audit`,validateSearch:BOe,component:Kv(()=>zQ(()=>import(`./AuditTab-B-v9HjgO.js`),__vite__mapDeps([43,1,3,18,13,5,16,37,23,15,14])),`AuditTab`)}),Mke=Gv({getParentRoute:()=>X9,path:`anomalies`,validateSearch:VOe,component:Kv(()=>zQ(()=>import(`./AnomaliesTab-DIOsMkIt.js`),__vite__mapDeps([44,1,3,18,13,5,16,14,15,17])),`AnomaliesTab`)}),Nke=Gv({getParentRoute:()=>X9,path:`kpi`,validateSearch:HOe,component:Kv(()=>zQ(()=>import(`./KpiTab-NBnWW7mn.js`),__vite__mapDeps([45,1,3,15,5,38])),`KpiTab`)}),Pke=Gv({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:UOe,component:Kv(()=>zQ(()=>import(`./ServiceAccountsTab-BDQcZy4S.js`),__vite__mapDeps([46,1,3,18,13,5,16,14,15,4])),`ServiceAccountsTab`)}),Fke=Gv({getParentRoute:()=>X9,path:`users`,validateSearch:WOe,component:Kv(()=>zQ(()=>import(`./UsersTab-6m5HSxal.js`),__vite__mapDeps([47,1,3,18,13,5,16,24,14,15])),`UsersTab`)}),Ike=Gv({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw T_({to:`/settings/$tab`,params:{tab:wOe.uiprefs},replace:!0})}}),Lke=Gv({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:G4([...T9]).catch(`roles`).parse(e.tab)}),component:Ske});function Rke({error:e,reset:t}){let n=Rv(),r=Jxe(e),[i]=(0,z.useState)(()=>r&&Zxe(Date.now()));return(0,z.useEffect)(()=>{i&&window.location.reload()},[i]),i?(0,B.jsx)(`div`,{className:`oc-route-error`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:Ti()})}):(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(kb,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:cs()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:No()}),(0,B.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>{r?window.location.reload():t()},children:qo()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:Nn()})]})]})}function zke(){let e=Rv();return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(lre,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:Mp()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:Xn()}),(0,B.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:Nn()})})]})}var Z9=ere({routeTree:J9.addChildren([Y9,Tke,Eke,X9.addChildren([Dke,Oke,Ake,kke,jke,Mke,Nke,Pke,Fke,Ike,Lke])]),defaultPreload:`intent`,defaultErrorComponent:Rke,defaultNotFoundComponent:zke}),Bke=()=>null;function Q9({children:e}){return(0,B.jsx)(`div`,{style:{display:`flex`,minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}var $9=Ate.createRoot(document.getElementById(`root`));$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Q9,{children:ls()})})),MCe().then(e=>{let t=new mf(e);$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Hte,{client:t,children:(0,B.jsxs)(VSe,{children:[(0,B.jsx)(Lwe,{children:(0,B.jsx)(rre,{router:Z9})}),(0,B.jsx)(z.Suspense,{fallback:null,children:(0,B.jsx)(Bke,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsxs)(Q9,{children:[ri(),` `,e instanceof Error?e.message:String(e)]})}))});export{m0 as $,Cx as $t,b5 as A,Ay as An,kF as At,lwe as B,ly as Bn,uF as Bt,j7 as C,Xy as Cn,qF as Ct,FEe as D,Hy as Dn,VF as Dt,D5 as E,Uy as En,UF as Et,k6 as F,by as Fn,gF as Ft,l3 as G,Rv as Gn,zA as Gt,VCe as H,sy as Hn,_M as Ht,E6 as I,gy as In,_F as It,i3 as J,Fk as Jt,c3 as K,Lv as Kn,RA as Kt,O6 as L,my as Ln,pF as Lt,Y6 as M,Ty as Mn,fF as Mt,U6 as N,wy as Nn,mF as Nt,k7 as O,Ny as On,OF as Ot,j6 as P,xy as Pn,hF as Pt,g0 as Q,Mx as Qt,T6 as R,fy as Rn,lF as Rt,E7 as S,nb as Sn,YF as St,i7 as T,qy as Tn,JF as Tt,B3 as U,oy as Un,hM as Ut,d6 as V,cy as Vn,vM as Vt,V3 as W,ey as Wn,gM as Wt,f0 as X,Ax as Xt,r3 as Y,kx as Yt,h0 as Z,jx as Zt,K7 as _,ub as _n,$F as _t,LOe as a,yx as an,c0 as at,H7 as b,ob as bn,ZF as bt,COe as c,Mb as cn,t0 as ct,h9 as d,Ob as dn,qQ as dt,Dx as en,p0 as et,r9 as f,wb as fn,Tme as ft,Y7 as g,db as gn,eI as gt,J7 as h,pb as hn,zQ as ht,FOe as i,xx as in,l0 as it,m5 as j,ky as jn,yF as jt,y5 as k,My as kn,ede as kt,E9 as l,Ab as ln,n0 as lt,q7 as m,hb as mn,h1 as mt,F9 as n,bx as nn,s0 as nt,IOe as o,Fb as on,u0 as ot,X7 as p,vb as pn,f1 as pt,o3 as q,Iv as qn,NA as qt,POe as r,Ox as rn,d0 as rt,ROe as s,Nb as sn,rge as st,W9 as t,_x as tn,o0 as tt,D9 as u,kb as un,B1 as ut,B7 as v,lb as vn,WF as vt,n7 as w,Jy as wn,KF as wt,L7 as x,ab as xn,GF as xt,F7 as y,cb as yn,XF as yt,D6 as z,uy as zn,dF as zt};
|