@lacneu/atrium 0.51.0 → 0.52.0

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.
Files changed (37) hide show
  1. package/dist/assets/{AccessTab-BTTUfIwc.js → AccessTab-CTW_nnWZ.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-BQlL-4N9.js → AdvancedFilter-CKwZSjrh.js} +1 -1
  3. package/dist/assets/{AgentFilesTab-By3Jzopm.js → AgentFilesTab-q9XSjz3-.js} +1 -1
  4. package/dist/assets/{AnomaliesTab-Cs6vlfDv.js → AnomaliesTab-DRfDR0J5.js} +1 -1
  5. package/dist/assets/{AuditTab-BOu6pgTB.js → AuditTab-Dy6MHYXk.js} +1 -1
  6. package/dist/assets/{BridgeTab-DFpunFsv.js → BridgeTab-BYuXlyxy.js} +1 -1
  7. package/dist/assets/{ChatDefaultsTab-DkHZTknY.js → ChatDefaultsTab-Dcfzk7xu.js} +1 -1
  8. package/dist/assets/{DataTableShell-KGrtOG5M.js → DataTableShell-DtJr2ebT.js} +1 -1
  9. package/dist/assets/{DetailChips-C2LFFpNg.js → DetailChips-CXG_QPSx.js} +1 -1
  10. package/dist/assets/{FeedbacksTab-D34MEu6C.js → FeedbacksTab-WlCA0v5O.js} +1 -1
  11. package/dist/assets/{FieldLabel-CKVYl95W.js → FieldLabel-DOYQdxs6.js} +1 -1
  12. package/dist/assets/{FilesTab-ByKXXey8.js → FilesTab-DQ9pHjeQ.js} +1 -1
  13. package/dist/assets/{FilterBar-BVVVO1_O.js → FilterBar-Csl1r1c5.js} +1 -1
  14. package/dist/assets/{GroupsTab-CJUI6gQ9.js → GroupsTab-i_p1qxDl.js} +1 -1
  15. package/dist/assets/{InstancesTab-Cb_2msXj.js → InstancesTab-C2vgcYdE.js} +1 -1
  16. package/dist/assets/{IntegrationsTab-B9Nkc7-l.js → IntegrationsTab-U_Dml2lf.js} +1 -1
  17. package/dist/assets/{KpiTab-B6SqslSj.js → KpiTab-D8BAnPiK.js} +1 -1
  18. package/dist/assets/{PreferencesTab-BdvOFp2E.js → PreferencesTab-BktDAi8P.js} +1 -1
  19. package/dist/assets/{PromptInjectionsTab-CgAFhOn5.js → PromptInjectionsTab-Bk59PWzu.js} +1 -1
  20. package/dist/assets/{RolesTab-CtV113pW.js → RolesTab-DVdsW49x.js} +1 -1
  21. package/dist/assets/{ServiceAccountsTab-Bu_j0kUL.js → ServiceAccountsTab-ZsiwQmeJ.js} +1 -1
  22. package/dist/assets/{SubAgentReportsTab-G_s4_aPf.js → SubAgentReportsTab-Ce0Y_sVn.js} +1 -1
  23. package/dist/assets/{ThemeShowroom-CbU-xJra.js → ThemeShowroom-BRl6NHy2.js} +1 -1
  24. package/dist/assets/{TimeRangePicker-NSOkx3C0.js → TimeRangePicker-BeZLlC4Y.js} +1 -1
  25. package/dist/assets/{TracesTab-Wo-rxO1v.js → TracesTab-CBN2vo1w.js} +1 -1
  26. package/dist/assets/{UsersTab-DO7Wa8iJ.js → UsersTab-C_K650wH.js} +1 -1
  27. package/dist/assets/{VoiceTab-ilUT53Ds.js → VoiceTab-b4ZPVB2F.js} +1 -1
  28. package/dist/assets/compatView-CONPJXEW.js +1 -0
  29. package/dist/assets/{highlighted-body-OFNGDK62-BOjjbbd6.js → highlighted-body-OFNGDK62-CJz5HJX2.js} +1 -1
  30. package/dist/assets/{index-DBQ43N4_.js → index-4Peu865E.js} +5 -5
  31. package/dist/assets/mermaid-GHXKKRXX-B47aXknL.js +1 -0
  32. package/dist/assets/{pdf-D7AA0FY6.js → pdf-C1wt9cpf.js} +1 -1
  33. package/dist/assets/{tabs-BJyz65LR.js → tabs-0f19le6d.js} +1 -1
  34. package/dist/index.html +1 -1
  35. package/package.json +1 -1
  36. package/dist/assets/compatView-S4X8HKXY.js +0 -1
  37. package/dist/assets/mermaid-GHXKKRXX-CXCdU_oF.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-BOjjbbd6.js","assets/bundle-mjs-C73ZY4La.js","assets/RolesTab-CtV113pW.js","assets/dist-HBBi9Y25.js","assets/roleDescriptions-onSlZ7A3.js","assets/button-b04wLuGq.js","assets/InstancesTab-Cb_2msXj.js","assets/FieldLabel-CKVYl95W.js","assets/curation-CQksaIbm.js","assets/locales-CPjguROj.js","assets/BridgeTab-DFpunFsv.js","assets/compatView-S4X8HKXY.js","assets/dist-DBet7oNc.js","assets/tabs-BJyz65LR.js","assets/chevrons-up-down-Kyw8BbOf.js","assets/FilterBar-BVVVO1_O.js","assets/TimeRangePicker-NSOkx3C0.js","assets/table-CtNwimV_.js","assets/dispatchErrorInfo-Cs8_1qCQ.js","assets/DataTableShell-KGrtOG5M.js","assets/PromptInjectionsTab-CgAFhOn5.js","assets/localePickerView-C2RmOS86.js","assets/confTabs-C35Io1ep.css","assets/GroupsTab-CJUI6gQ9.js","assets/x-DBKGK4o_.js","assets/DetailChips-C2LFFpNg.js","assets/IntegrationsTab-B9Nkc7-l.js","assets/FeedbacksTab-D34MEu6C.js","assets/SubAgentReportsTab-G_s4_aPf.js","assets/FilesTab-ByKXXey8.js","assets/AgentFilesTab-By3Jzopm.js","assets/PreferencesTab-BdvOFp2E.js","assets/ChatDefaultsTab-DkHZTknY.js","assets/AccessTab-BTTUfIwc.js","assets/ThemeShowroom-CbU-xJra.js","assets/dist-6oi7FQ0i.js","assets/AdvancedFilter-BQlL-4N9.js","assets/card-DdBF2ct9.js","assets/TracesTab-Wo-rxO1v.js","assets/VoiceTab-ilUT53Ds.js","assets/AuditTab-BOu6pgTB.js","assets/AnomaliesTab-Cs6vlfDv.js","assets/KpiTab-B6SqslSj.js","assets/ServiceAccountsTab-Bu_j0kUL.js","assets/UsersTab-DO7Wa8iJ.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-CJz5HJX2.js","assets/bundle-mjs-C73ZY4La.js","assets/RolesTab-DVdsW49x.js","assets/dist-HBBi9Y25.js","assets/roleDescriptions-onSlZ7A3.js","assets/button-b04wLuGq.js","assets/InstancesTab-C2vgcYdE.js","assets/FieldLabel-DOYQdxs6.js","assets/curation-CQksaIbm.js","assets/locales-CPjguROj.js","assets/BridgeTab-BYuXlyxy.js","assets/compatView-CONPJXEW.js","assets/dist-DBet7oNc.js","assets/tabs-0f19le6d.js","assets/chevrons-up-down-Kyw8BbOf.js","assets/FilterBar-Csl1r1c5.js","assets/TimeRangePicker-BeZLlC4Y.js","assets/table-CtNwimV_.js","assets/dispatchErrorInfo-Cs8_1qCQ.js","assets/DataTableShell-DtJr2ebT.js","assets/PromptInjectionsTab-Bk59PWzu.js","assets/localePickerView-C2RmOS86.js","assets/confTabs-C35Io1ep.css","assets/GroupsTab-i_p1qxDl.js","assets/x-DBKGK4o_.js","assets/DetailChips-CXG_QPSx.js","assets/IntegrationsTab-U_Dml2lf.js","assets/FeedbacksTab-WlCA0v5O.js","assets/SubAgentReportsTab-Ce0Y_sVn.js","assets/FilesTab-DQ9pHjeQ.js","assets/AgentFilesTab-q9XSjz3-.js","assets/PreferencesTab-BktDAi8P.js","assets/ChatDefaultsTab-Dcfzk7xu.js","assets/AccessTab-CTW_nnWZ.js","assets/ThemeShowroom-BRl6NHy2.js","assets/dist-6oi7FQ0i.js","assets/AdvancedFilter-CKwZSjrh.js","assets/card-DdBF2ct9.js","assets/TracesTab-CBN2vo1w.js","assets/VoiceTab-b4ZPVB2F.js","assets/AuditTab-Dy6MHYXk.js","assets/AnomaliesTab-DRfDR0J5.js","assets/KpiTab-D8BAnPiK.js","assets/ServiceAccountsTab-ZsiwQmeJ.js","assets/UsersTab-C_K650wH.js"])))=>i.map(i=>d[i]);
2
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{$E as l,$T as u,$c as d,$d as f,$f as p,$i as m,$n as h,$o as g,$p as _,AD as v,AE as y,AM as b,AT as x,A_ as S,Ad as C,Ai as w,Al as T,Am as E,An as D,As as O,Av as k,Aw as A,B as j,BE as M,BT as N,Bd as ee,Bl as P,Bn as F,Bo as te,Bp as ne,Bs as re,Bv as ie,C as ae,CD as oe,CE as se,CM as ce,C_ as le,Cd as ue,Ci as de,Cl as fe,Cm as pe,Cn as me,Co as he,Cp as ge,Cs as _e,Cv as ve,Cw as ye,D as I,DD as be,DE as xe,DM as Se,DT as Ce,D_ as we,Dd as Te,Di as Ee,Dl as De,Dm as Oe,Dn as ke,Ds as Ae,Dv as je,Dw as Me,E as L,ED as Ne,EE as Pe,EM as Fe,ET as Ie,E_ as Le,Ed as Re,Ei as ze,El as Be,Em as Ve,En as He,Es as Ue,Ev as We,Ew as Ge,FD as Ke,FE as qe,FT as Je,Fd as Ye,Fi as Xe,Fl as Ze,Fm as Qe,Fn as $e,Fo as et,Fp as tt,Fs as nt,Fv as rt,GE as it,GT as at,Gd as ot,Gf as st,Gl as ct,Gn as lt,Go as ut,Gp as dt,Gs as ft,HE as pt,HT as mt,Hd as ht,Hl as gt,Hn as _t,Ho as vt,Hp as yt,Hs as bt,Hv as xt,ID as St,IE as Ct,IM as wt,IT as Tt,Id as Et,Ii as Dt,Il as Ot,Im as kt,In as At,Io as jt,Ip as Mt,Is as Nt,It as Pt,Iv as Ft,JE as It,JT as Lt,Jd as Rt,Jf as zt,Ji as Bt,Jn as Vt,Jo as Ht,Jp as Ut,KE as Wt,KT as Gt,Kd as Kt,Kf as qt,Kl as Jt,Kn as Yt,Ko as Xt,Kp as Zt,Ks as Qt,LD as $t,LE as en,LM as tn,LT as nn,Ld as rn,Li as an,Ll as on,Lm as sn,Ln as cn,Lo as ln,Lp as un,Ls as dn,Lt as fn,Lv as pn,MD as mn,ME as hn,MM as gn,MT as _n,Md as vn,Mi as yn,Ml as bn,Mm as xn,Mn as Sn,Mp as Cn,Ms as wn,Mv as Tn,Mw as En,ND as Dn,NE as On,NM as kn,NT as An,Nd as jn,Ni as Mn,Nl as Nn,Nm as Pn,Nn as Fn,No as In,Np as Ln,Ns as Rn,Nv as zn,Nw as Bn,O as Vn,OD as Hn,OE as Un,OM as R,OT as Wn,O_ as Gn,Od as Kn,Oi as qn,Ol as Jn,Om as Yn,On as Xn,Os as Zn,Ov as Qn,Ow as $n,PD as er,PE as tr,PM as nr,PT as rr,Pd as ir,Ph as ar,Pi as or,Pl as sr,Pm as cr,Pn as lr,Po as ur,Pp as dr,Ps as fr,Pv as pr,Pw as mr,QE as hr,QT as gr,Qd as _r,Qf as vr,Qi as yr,Qn as br,Qo as xr,Qp as Sr,R as Cr,RD as wr,RE as Tr,RM as Er,RT as Dr,Rd as Or,Rl as kr,Rn as Ar,Ro as jr,Rp as Mr,Rs as Nr,Rt as Pr,Rv as Fr,S as Ir,SD as Lr,SE as Rr,SM as zr,S_ as Br,Sc as Vr,Sd as Hr,Si as Ur,Sl as Wr,Sm as Gr,So as Kr,Sp as qr,Ss as Jr,Sv as Yr,Sw as Xr,T as Zr,TD as Qr,TE as $r,TM as ei,TT as ti,T_ as ni,Td as ri,Ti as ii,Tl as ai,Tm as oi,Tn as si,Ts as ci,Tv as li,Tw as ui,UE as di,UT as fi,Ud as pi,Ul as mi,Un as hi,Uo as gi,Up as _i,Us as vi,VE as yi,VT as bi,Vd as xi,Vl as Si,Vn as Ci,Vo as wi,Vp as Ti,Vs as Ei,Vv as Di,WE as Oi,WT as ki,Wd as Ai,Wl as ji,Wn as Mi,Wo as Ni,Wp as Pi,Ws as Fi,Wt as Ii,XE as Li,XT as Ri,Xd as zi,Xf as Bi,Xi as Vi,Xn as Hi,Xo as Ui,Xp as Wi,YE as Gi,YT as Ki,Yd as qi,Yf as Ji,Yi,Yn as Xi,Yo as Zi,Yp as Qi,ZE as $i,ZT as ea,Zd as ta,Zf as na,Zi as ra,Zn as ia,Zo as aa,Zp as oa,_ as sa,_D as ca,_E as la,_M as ua,__ as da,_i as fa,_j as pa,_l as ma,_m as ha,_o as ga,_p as _a,_s as va,_v as ya,_w as ba,a as xa,aD as Sa,aE as Ca,a_ as wa,aa as Ta,af as Ea,al as Da,am as Oa,an as ka,ap as Aa,ar as ja,as as Ma,at as Na,b as Pa,bD as Fa,bE as Ia,bM as La,b_ as Ra,bd as za,bi as Ba,bl as Va,bm as Ha,bo as Ua,bp as Wa,bs as Ga,bv as Ka,bw as qa,c as Ja,cD as Ya,cE as Xa,c_ as Za,cl as Qa,cm as $a,cn as eo,co as to,cp as no,cr as ro,cs as io,ct as ao,d as oo,dD as so,dE as co,d_ as lo,di as uo,dl as fo,dm as po,dn as mo,do as ho,dp as go,dr as _o,ds as vo,eD as yo,eE as bo,eM as xo,ea as So,ef as Co,ei as wo,el as To,em as Eo,en as Do,ep as Oo,er as ko,es as Ao,f as jo,fD as Mo,fE as No,fM as Po,f_ as Fo,fi as Io,fl as Lo,fm as Ro,fn as zo,fo as Bo,fp as Vo,fr as Ho,fs as Uo,g as Wo,gD as Go,gE as Ko,gM as qo,g_ as Jo,gi as Yo,gl as Xo,gm as Zo,go as Qo,gp as $o,gs as es,gv as ts,h as ns,hD as rs,hE as is,hM as as,h_ as os,hi as ss,hl as cs,hm as ls,ho as us,hp as ds,hs as fs,i as ps,iD as ms,iE as hs,i_ as gs,ia as _s,if as vs,ii as ys,il as bs,im as xs,in as Ss,ip as Cs,ir as ws,is as Ts,it as Es,jD as Ds,jE as Os,jM as ks,jT as As,jd as js,ji as Ms,jl as Ns,jm as Ps,jn as Fs,jp as Is,js as Ls,jv as Rs,jw as zs,kD as Bs,kE as Vs,kM as Hs,kT as Us,k_ as Ws,kd as Gs,ki as Ks,kl as qs,km as Js,kn as Ys,ks as Xs,kv as Zs,kw as Qs,l as $s,lD as ec,lE as tc,l_ as nc,lg as rc,ll as ic,lm as ac,ln as oc,lo as sc,lp as cc,lr as lc,ls as uc,lt as dc,mD as fc,mE as pc,mM as mc,m_ as hc,mi as gc,ml as _c,mm as vc,mo as yc,mp as bc,ms as xc,n as Sc,nD as Cc,nE as wc,na as Tc,nf as Ec,nl as Dc,nm as Oc,nn as kc,np as Ac,nr as jc,ns as Mc,o as Nc,oD as Pc,oE as Fc,o_ as Ic,oa as Lc,of as Rc,oi as zc,ol as Bc,om as Vc,on as Hc,oo as Uc,op as Wc,or as Gc,os as Kc,ot as qc,p as Jc,pD as Yc,pE as Xc,pM as Zc,p_ as Qc,pi as $c,pl as el,pm as tl,pn as nl,po as rl,pp as il,ps as al,qE as ol,qT as sl,qd as cl,qf as ll,qn as ul,qo as dl,qp as fl,qs as pl,r as ml,rD as hl,rE as gl,ra as _l,rf as vl,rl as yl,rm as bl,rn as xl,rp as Sl,rr as Cl,rs as wl,rt as Tl,s as El,sD as Dl,sE as Ol,s_ as kl,sa as Al,si as jl,sl as Ml,sm as Nl,sn as Pl,so as Fl,sp as Il,sr as Ll,ss as Rl,st as zl,t as Bl,tD as Vl,tE as Hl,ta as Ul,tf as Wl,ti as Gl,tl as Kl,tm as ql,tn as Jl,tp as Yl,tr as Xl,ts as Zl,u as Ql,uD as $l,uE as eu,u_ as tu,ui as nu,ul as ru,um as iu,un as au,uo as ou,up as su,ur as cu,us as lu,v as z,vD as uu,vE as du,vM as fu,v_ as pu,vd as mu,vi as hu,vl as gu,vm as _u,vo as vu,vp as yu,vs as bu,vv as xu,vw as Su,w as Cu,wD as wu,wE as Tu,wM as Eu,w_ as Du,wd as Ou,wi as ku,wl as Au,wm as ju,wn as Mu,ws as Nu,wv as Pu,ww as Fu,x as Iu,xD as Lu,xE as Ru,xM as zu,x_ as Bu,xd as Vu,xi as Hu,xl as Uu,xm as Wu,xo as Gu,xp as Ku,xs as qu,xv as Ju,xw as Yu,y as Xu,yD as Zu,yE as Qu,yM as $u,y_ as ed,yd as td,yi as nd,yl as rd,ym as id,yo as ad,yp as od,ys as sd,yv as cd,yw as ld,z as ud,zE as dd,zM as fd,zT as pd,zd as md,zl as hd,zn as gd,zo as _d,zp as vd,zs as yd,zv as bd}from"./dist-HBBi9Y25.js";import{n as xd,t as Sd}from"./dist-6oi7FQ0i.js";import{i as Cd,n as wd,r as Td,t as Ed}from"./dist-DBet7oNc.js";import{t as Dd}from"./x-DBKGK4o_.js";import{a as Od,c as kd,i as Ad,l as jd,n as Md,o as Nd,r as Pd,s as Fd,t as Id,u as Ld}from"./dist-CtUr3P8h.js";import{n as Rd,t as zd}from"./button-b04wLuGq.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 Bd=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&&j(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&&j(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 j(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,j(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}}}})),Vd=a(((e,t)=>{t.exports=Bd()})),Hd=a((t=>{var r=Vd(),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 j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function N(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?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?N(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return N(e(t))}catch{}}return null}var ee=Array.isArray,P=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ne=[],re=-1;function ie(e){return{current:e}}function ae(e){0>re||(e.current=ne[re],ne[re]=null,re--)}function oe(e,t){re++,ne[re]=e.current,e.current=t}var se=ie(null),ce=ie(null),le=ie(null),ue=ie(null);function de(e,t){switch(oe(le,t),oe(ce,e),oe(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ef(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ef(t),e=tf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ae(se),oe(se,e)}function fe(){ae(se),ae(ce),ae(le)}function pe(e){e.memoizedState!==null&&oe(ue,e);var t=se.current,n=tf(t,e.type);t!==n&&(oe(ce,e),oe(se,n))}function me(e){ce.current===e&&(ae(se),ae(ce)),ue.current===e&&(ae(ue),up._currentValue=te)}var he,ge;function _e(e){if(he===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||``,ge=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+he+e+ge}var ve=!1;function ye(e,t){if(!e||ve)return``;ve=!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(`
@@ -200,14 +200,14 @@ ${e}</tr>
200
200
  `}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>${h4(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=g4(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+h4(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=g4(e);if(i===null)return h4(n);e=i;let a=`<img src="${e}" alt="${h4(n)}"`;return t&&(a+=` title="${h4(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:h4(e.text)}},C4=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}},w4=class e{options;renderer;textRenderer;constructor(e){this.options=e||L2,this.options.renderer=this.options.renderer||new S4,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new C4}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}},T4=class{options;block;constructor(e){this.options=e||L2}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?x4.lex:x4.lexInline}provideParser(e=this.block){return e?w4.parse:w4.parseInline}},E4=new class{defaults=I2();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=w4;Renderer=S4;TextRenderer=C4;Lexer=x4;Tokenizer=b4;Hooks=T4;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 S4(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 b4(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 T4;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];T4.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&T4.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 x4.lex(e,t??this.defaults)}parser(e,t){return w4.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?x4.lex:x4.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?w4.parse:w4.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?x4.lex:x4.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?w4.parse:w4.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+=`
201
201
  Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+h4(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function D4(e,t){return E4.parse(e,t)}D4.options=D4.setOptions=function(e){return E4.setOptions(e),D4.defaults=E4.defaults,R2(D4.defaults),D4},D4.getDefaults=I2,D4.defaults=L2,D4.use=function(...e){return E4.use(...e),D4.defaults=E4.defaults,R2(D4.defaults),D4},D4.walkTokens=function(e,t){return E4.walkTokens(e,t)},D4.parseInline=E4.parseInline,D4.Parser=w4,D4.parser=w4.parse,D4.Renderer=S4,D4.TextRenderer=C4,D4.Lexer=x4,D4.lexer=x4.lex,D4.Tokenizer=b4,D4.Hooks=T4,D4.parse=D4,D4.options,D4.setOptions,D4.use,D4.walkTokens,D4.parseInline,w4.parse,x4.lex;var bpe=`modulepreload`,xpe=function(e){return`/`+e},O4={},k4=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 O4)return;O4[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`:bpe,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)})},Spe=300,Cpe=`300px`,wpe=500;function Tpe(e={}){let{immediate:t=!1,debounceDelay:n=Spe,rootMargin:r=Cpe,idleTimeout:i=wpe}=e,[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null),u=(0,B.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,B.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,B.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,B.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 A4=/\s/,Epe=/^\s+$/,Dpe=new Set([`code`,`pre`,`svg`,`math`,`annotation`]),Ope=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,kpe=e=>e.some(e=>Ope(e)&&Dpe.has(e.tagName)),Ape=e=>{let t=[],n=``,r=!1;for(let i of e){let e=A4.test(i);e!==r&&n&&(t.push(n),n=``),n+=i,r=e}return n&&t.push(n),t},jpe=e=>{let t=[],n=``;for(let r of e)A4.test(r)?n+=r:(n&&=(t.push(n),``),t.push(r));return n&&t.push(n),t},Mpe=(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}]}},Npe=(e,t,n,r,i)=>{let a=t.at(-1);if(!(a&&`children`in a))return;if(kpe(t))return hG;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`?jpe(c):Ape(c),u=r.prevContentLength,d=l.map(e=>{let t=i.count;if(i.count+=e.length,Epe.test(e))return{type:`text`,value:e};let r=u>0&&t<u,a=r?0:i.newIndex++*n.stagger;return Mpe(e,n.animation,n.duration,n.easing,r,a)});return o.children.splice(s,1,...d),s+d.length},Ppe=0;function j4(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=Ppe++,i=()=>e=>{let r={count:0,newIndex:0};gG(e,`text`,(e,i)=>Npe(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}}}j4();var M4=(0,B.createContext)(!1),Fpe=()=>(0,B.useContext)(M4),N4=(...e)=>c(i(e)),Ipe=(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(` `)},Lpe=e=>e?(...t)=>Ipe(e,c(i(t))):N4,P4=(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)},F4=(0,B.createContext)(N4),I4=()=>(0,B.useContext)(F4),Rpe=N4(`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`),zpe=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},L4=(0,B.memo)(({children:e,result:t,language:n,className:r,startLine:i,lineNumbers:a=!0,...o})=>{let s=I4(),c=(0,B.useMemo)(()=>s(Rpe),[s]),l=(0,B.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,zpe(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,V.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,V.jsx)(`pre`,{className:s(r,`bg-[var(--sdm-bg,inherit]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]`),style:l,children:(0,V.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,V.jsx)(`span`,{className:a?c:void 0,children:e.length===0||e.length===1&&e[0].content===``?`
202
202
  `: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,V.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),Bpe=({className:e,language:t,style:n,isIncomplete:r,...i})=>(0,V.jsx)(`div`,{className:I4()(`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}),R4=(0,B.createContext)({code:``}),z4=()=>(0,B.useContext)(R4),Vpe=({language:e})=>{let t=I4();return(0,V.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,V.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},Hpe=e=>{let t=e.length;for(;t>0&&e[t-1]===`
203
- `;)t--;return e.slice(0,t)},Upe=(0,B.lazy)(()=>k4(()=>import(`./highlighted-body-OFNGDK62-BOjjbbd6.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),Wpe=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=I4(),l=(0,B.useMemo)(()=>Hpe(e),[e]),u=(0,B.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
203
+ `;)t--;return e.slice(0,t)},Upe=(0,B.lazy)(()=>k4(()=>import(`./highlighted-body-OFNGDK62-CJz5HJX2.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),Wpe=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=I4(),l=(0,B.useMemo)(()=>Hpe(e),[e]),u=(0,B.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
204
204
  `).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[l]);return(0,V.jsx)(R4.Provider,{value:{code:e},children:(0,V.jsxs)(Bpe,{isIncomplete:i,language:t,children:[(0,V.jsx)(Vpe,{language:t}),r?(0,V.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,V.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,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(L4,{className:n,language:t,lineNumbers:o,result:u,startLine:a,...s}),children:(0,V.jsx)(Upe,{className:n,code:l,language:t,lineNumbers:o,raw:u,startLine:a,...s})})]})})},B4={CheckIcon:e=>(0,V.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,V.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,V.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,V.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,V.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,V.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,V.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,V.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,V.jsxs)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,V.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,V.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,V.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,V.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,V.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,V.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,V.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,V.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,V.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,V.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,V.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,V.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,V.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,V.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,V.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,V.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,V.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,V.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,V.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,V.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`})})},V4=(0,B.createContext)(B4),Gpe=(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},H4=({icons:e,children:t})=>{let n=(0,B.useRef)(e),r=(0,B.useRef)(e?{...B4,...e}:B4);Gpe(n.current,e)||(n.current=e,r.current=e?{...B4,...e}:B4);let i=r.current;return(0,V.jsx)(V4.Provider,{value:i,children:t})},U4=()=>(0,B.useContext)(V4),W4={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`},G4=(0,B.createContext)(W4),K4=()=>(0,B.useContext)(G4),q4=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=I4(),[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(0),{code:d}=z4(),{isAnimating:f}=(0,B.useContext)(n6),p=K4(),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,B.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=U4(),_=c?g.CheckIcon:g.CopyIcon;return(0,V.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,V.jsx)(_,{size:14})})},J4={"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`},Kpe=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=I4(),{code:c}=z4(),{isAnimating:l}=(0,B.useContext)(n6),u=K4(),d=U4(),f=a??c,p=`file.${n&&n in J4?J4[n]:`txt`}`;return(0,V.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{P4(p,f,`text/plain`),e?.()}catch(e){t?.(e)}},title:u.downloadFile,type:`button`,...o,children:r??(0,V.jsx)(d.DownloadIcon,{size:14})})},Y4=()=>{let{Loader2Icon:e}=U4(),t=I4();return(0,V.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,V.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,V.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,V.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},qpe=/\.[^/.]+$/,Jpe=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,...o})=>{let{DownloadIcon:s}=U4(),c=I4(),l=(0,B.useRef)(null),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),m=K4(),h=o.width!=null||o.height!=null,g=(u||h)&&!f,_=f&&!h;(0,B.useEffect)(()=>{let e=l.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;d(t),p(!t)}},[]);let v=(0,B.useCallback)(e=>{d(!0),p(!1),i?.(e)},[i]),y=(0,B.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(qpe,``)}.${i}`}P4(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,V.jsxs)(`div`,{className:c(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,V.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,V.jsx)(`span`,{className:c(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:m.imageNotAvailable}),(0,V.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`)}),g&&(0,V.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,V.jsx)(s,{size:14})})]}):null},X4=0,Z4=()=>{X4+=1,X4===1&&(document.body.style.overflow=`hidden`)},Q4=()=>{X4=Math.max(0,X4-1),X4===0&&(document.body.style.overflow=``)},Ype=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=U4(),c=I4(),[l,u]=(0,B.useState)(!1),d=K4(),f=(0,B.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,B.useCallback)(()=>{r(),n()},[r,n]);return(0,B.useEffect)(()=>{if(t){Z4();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Q4()}}},[t,n]),t?(0,V.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,V.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,V.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,V.jsx)(s,{size:16})}),(0,V.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,V.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,V.jsx)(o,{size:20}),(0,V.jsx)(`span`,{children:d.openExternalLink})]}),(0,V.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,V.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,V.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,V.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,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(i,{size:14}),(0,V.jsx)(`span`,{children:d.copied})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(a,{size:14}),(0,V.jsx)(`span`,{children:d.copyLink})]})}),(0,V.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,V.jsx)(o,{size:14}),(0,V.jsx)(`span`,{children:d.openLink})]})]})]})}):null},$4=(0,B.createContext)(null),e3=()=>(0,B.useContext)($4),Xpe=()=>e3()?.code??null,t3=()=>e3()?.mermaid??null,Zpe=e=>{var t;let n=e3();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},Qpe=(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}),$pe=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=I4(),[s,c]=(0,B.useState)(!1),l=(0,B.useRef)(null),{isAnimating:u}=(0,B.useContext)(n6),d=U4(),f=t3(),p=K4(),m=async t=>{try{if(t===`mmd`){P4(`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`){P4(`diagram.svg`,l,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){P4(`diagram.png`,await Qpe(l),`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,B.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,V.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,V.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,V.jsx)(d.DownloadIcon,{size:14})}),s?(0,V.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,V.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,V.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,V.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]})},eme=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=U4(),c=I4(),[l,u]=(0,B.useState)(!1),{isAnimating:d,controls:f}=(0,B.useContext)(n6),p=K4(),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,B.useEffect)(()=>{if(l){Z4();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Q4()}}},[l]),(0,B.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.jsx)(o,{size:14})}),l?(0,gh.createPortal)((0,V.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,V.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,V.jsx)(s,{size:20})}),(0,V.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,V.jsx)(a6,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})},n3=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}},r3=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===`
205
205
  `)&&(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(`
206
206
  `)},tme=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
207
207
  `||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
208
208
  `?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(`
209
209
  `)},i3=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(``)},a3=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=>i3(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?i3(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else r[i]=`| ${e.map(e=>i3(e)).join(` | `)} |`,i+=1;return r.join(`
210
- `)},o3=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=I4(),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(null),d=(0,B.useRef)(0),{isAnimating:f}=(0,B.useContext)(n6),p=K4(),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=n3(t),o=({csv:r3,tsv:tme,md:a3}[e]||a3)(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,B.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=U4(),g=c?h.CheckIcon:h.CopyIcon;return(0,V.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,V.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,V.jsx)(g,{height:14,width:14})}),o?(0,V.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,V.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,V.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,V.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]})},s3=({children:e,className:t,onDownload:n,onError:r})=>{let i=I4(),[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(null),{isAnimating:c}=(0,B.useContext)(n6),l=K4(),u=U4(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=n3(t),a=e===`csv`?r3(i):a3(i);P4(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,B.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,V.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,V.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,V.jsx)(u.DownloadIcon,{size:14})}),a?(0,V.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,V.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,V.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]})},nme=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=U4(),o=I4(),[s,c]=(0,B.useState)(!1),{isAnimating:l}=(0,B.useContext)(n6),u=K4(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,B.useEffect)(()=>{if(s){Z4();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Q4()}}},[s]),(0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.jsx)(i,{size:14})}),s?(0,gh.createPortal)((0,V.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,V.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,V.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,V.jsx)(o3,{}):null,r?(0,V.jsx)(s3,{}):null,(0,V.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,V.jsx)(a,{size:20})})]}),(0,V.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,V.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},rme=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=I4(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,V.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,V.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,V.jsx)(o3,{}):null,l?(0,V.jsx)(s3,{}):null,u?(0,V.jsx)(nme,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,V.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,V.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},ime=/startLine=(\d+)/,ame=/\bnoLineNumbers\b/,ome=(0,B.lazy)(()=>k4(()=>import(`./mermaid-GHXKKRXX-CXCdU_oF.js`).then(e=>({default:e.Mermaid})),[])),sme=/language-([^\s]+)/;function c3(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 l3(e,t){return e.className===t.className&&c3(e.node,t.node)}var u3=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,d3=(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},f3=(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},p3=(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},m3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`ol`,{className:I4()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>l3(e,t));m3.displayName=`MarkdownOl`;var h3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`li`,{className:I4()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&c3(e.node,t.node));h3.displayName=`MarkdownLi`;var g3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`ul`,{className:I4()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>l3(e,t));g3.displayName=`MarkdownUl`;var _3=(0,B.memo)(({className:e,node:t,...n})=>(0,V.jsx)(`hr`,{className:I4()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>l3(e,t));_3.displayName=`MarkdownHr`;var v3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`span`,{className:I4()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>l3(e,t));v3.displayName=`MarkdownStrong`;var y3=(0,B.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=I4(),{linkSafety:o}=(0,B.useContext)(n6),[s,c]=(0,B.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,B.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,B.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,B.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.jsx)(Ype,{...p})]}):(0,V.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)=>l3(e,t)&&e.href===t.href);y3.displayName=`MarkdownA`;var b3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h1`,{className:I4()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>l3(e,t));b3.displayName=`MarkdownH1`;var x3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h2`,{className:I4()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>l3(e,t));x3.displayName=`MarkdownH2`;var S3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h3`,{className:I4()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>l3(e,t));S3.displayName=`MarkdownH3`;var C3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h4`,{className:I4()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>l3(e,t));C3.displayName=`MarkdownH4`;var w3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h5`,{className:I4()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>l3(e,t));w3.displayName=`MarkdownH5`;var T3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h6`,{className:I4()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>l3(e,t));T3.displayName=`MarkdownH6`;var E3=(0,B.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,B.useContext)(n6);return(0,V.jsx)(rme,{className:t,showControls:u3(i,`table`),showCopy:d3(i,`copy`),showDownload:d3(i,`download`),showFullscreen:d3(i,`fullscreen`),...r,children:e})},(e,t)=>l3(e,t));E3.displayName=`MarkdownTable`;var D3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`thead`,{className:I4()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>l3(e,t));D3.displayName=`MarkdownThead`;var O3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`tbody`,{className:I4()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>l3(e,t));O3.displayName=`MarkdownTbody`;var k3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`tr`,{className:I4()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>l3(e,t));k3.displayName=`MarkdownTr`;var A3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`th`,{className:I4()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>l3(e,t));A3.displayName=`MarkdownTh`;var j3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`td`,{className:I4()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>l3(e,t));j3.displayName=`MarkdownTd`;var M3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`blockquote`,{className:I4()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>l3(e,t));M3.displayName=`MarkdownBlockquote`;var N3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`sup`,{className:I4()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>l3(e,t));N3.displayName=`MarkdownSup`;var P3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`sub`,{className:I4()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>l3(e,t));P3.displayName=`MarkdownSub`;var F3=(0,B.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,B.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,B.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,B.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,B.isValidElement)(e))return e;if(e.type===m3){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,V.jsx)(`section`,{className:t,...r,children:i}):null}return(0,V.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>l3(e,t));F3.displayName=`MarkdownSection`;var I3=(0,B.memo)(({node:e,className:t,children:n,...r})=>{let i=I4(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,B.useContext)(n6),l=t3(),u=Fpe(),d=(t?.match(sme))?.at(1)??``,f=Zpe(d);if(a)return(0,V.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(ime),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&ame.test(p))&&c!==!1,v=``;if((0,B.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,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(Y4,{}),children:(0,V.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=u3(s,`mermaid`),n=p3(s,`download`),r=p3(s,`copy`),a=p3(s,`fullscreen`),c=p3(s,`panZoom`),l=e&&(n||r||a);return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(Y4,{}),children:(0,V.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,V.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,V.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,V.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,V.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,V.jsx)($pe,{chart:v,config:o?.config}):null,r?(0,V.jsx)(q4,{code:v}):null,a?(0,V.jsx)(eme,{chart:v,config:o?.config}):null]})}):null,(0,V.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,V.jsx)(ome,{chart:v,config:o?.config,showControls:c})})]})})}let y=u3(s,`code`),b=f3(s,`download`),x=f3(s,`copy`);return(0,V.jsx)(Wpe,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,V.jsxs)(V.Fragment,{children:[b?(0,V.jsx)(Kpe,{code:v,language:d}):null,x?(0,V.jsx)(q4,{}):null]}):null})},(e,t)=>e.className===t.className&&c3(e.node,t.node));I3.displayName=`MarkdownCode`;var L3=(0,B.memo)(Jpe,(e,t)=>e.className===t.className&&c3(e.node,t.node));L3.displayName=`MarkdownImg`;var R3=(0,B.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,B.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,V.jsx)(V.Fragment,{children:e})}return(0,V.jsx)(`p`,{...n,children:e})},(e,t)=>l3(e,t));R3.displayName=`MarkdownParagraph`;var cme={ol:m3,li:h3,ul:g3,hr:_3,strong:v3,a:y3,h1:b3,h2:x3,h3:S3,h4:C3,h5:w3,h6:T3,table:E3,thead:D3,tbody:O3,tr:k3,th:A3,td:j3,blockquote:M3,code:I3,img:L3,pre:({children:e})=>(0,B.isValidElement)(e)?(0,B.cloneElement)(e,{"data-block":`true`}):e,sup:N3,sub:P3,p:R3,section:F3},lme=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,ume=/\p{L}/u;function z3(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(lme.test(e))return`rtl`;if(ume.test(e))return`ltr`}return`ltr`}var dme=/^[ \t]{0,3}(`{3,}|~{3,})/,fme=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,B3=e=>{let t=e.split(`
210
+ `)},o3=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=I4(),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(null),d=(0,B.useRef)(0),{isAnimating:f}=(0,B.useContext)(n6),p=K4(),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=n3(t),o=({csv:r3,tsv:tme,md:a3}[e]||a3)(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,B.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=U4(),g=c?h.CheckIcon:h.CopyIcon;return(0,V.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,V.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,V.jsx)(g,{height:14,width:14})}),o?(0,V.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,V.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,V.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,V.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]})},s3=({children:e,className:t,onDownload:n,onError:r})=>{let i=I4(),[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(null),{isAnimating:c}=(0,B.useContext)(n6),l=K4(),u=U4(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=n3(t),a=e===`csv`?r3(i):a3(i);P4(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,B.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,V.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,V.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,V.jsx)(u.DownloadIcon,{size:14})}),a?(0,V.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,V.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,V.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]})},nme=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=U4(),o=I4(),[s,c]=(0,B.useState)(!1),{isAnimating:l}=(0,B.useContext)(n6),u=K4(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,B.useEffect)(()=>{if(s){Z4();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Q4()}}},[s]),(0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.jsx)(i,{size:14})}),s?(0,gh.createPortal)((0,V.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,V.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,V.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,V.jsx)(o3,{}):null,r?(0,V.jsx)(s3,{}):null,(0,V.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,V.jsx)(a,{size:20})})]}),(0,V.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,V.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},rme=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=I4(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,V.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,V.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,V.jsx)(o3,{}):null,l?(0,V.jsx)(s3,{}):null,u?(0,V.jsx)(nme,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,V.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,V.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},ime=/startLine=(\d+)/,ame=/\bnoLineNumbers\b/,ome=(0,B.lazy)(()=>k4(()=>import(`./mermaid-GHXKKRXX-B47aXknL.js`).then(e=>({default:e.Mermaid})),[])),sme=/language-([^\s]+)/;function c3(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 l3(e,t){return e.className===t.className&&c3(e.node,t.node)}var u3=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,d3=(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},f3=(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},p3=(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},m3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`ol`,{className:I4()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>l3(e,t));m3.displayName=`MarkdownOl`;var h3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`li`,{className:I4()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&c3(e.node,t.node));h3.displayName=`MarkdownLi`;var g3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`ul`,{className:I4()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>l3(e,t));g3.displayName=`MarkdownUl`;var _3=(0,B.memo)(({className:e,node:t,...n})=>(0,V.jsx)(`hr`,{className:I4()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>l3(e,t));_3.displayName=`MarkdownHr`;var v3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`span`,{className:I4()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>l3(e,t));v3.displayName=`MarkdownStrong`;var y3=(0,B.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=I4(),{linkSafety:o}=(0,B.useContext)(n6),[s,c]=(0,B.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,B.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,B.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,B.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,V.jsxs)(V.Fragment,{children:[(0,V.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,V.jsx)(Ype,{...p})]}):(0,V.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)=>l3(e,t)&&e.href===t.href);y3.displayName=`MarkdownA`;var b3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h1`,{className:I4()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>l3(e,t));b3.displayName=`MarkdownH1`;var x3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h2`,{className:I4()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>l3(e,t));x3.displayName=`MarkdownH2`;var S3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h3`,{className:I4()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>l3(e,t));S3.displayName=`MarkdownH3`;var C3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h4`,{className:I4()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>l3(e,t));C3.displayName=`MarkdownH4`;var w3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h5`,{className:I4()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>l3(e,t));w3.displayName=`MarkdownH5`;var T3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`h6`,{className:I4()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>l3(e,t));T3.displayName=`MarkdownH6`;var E3=(0,B.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,B.useContext)(n6);return(0,V.jsx)(rme,{className:t,showControls:u3(i,`table`),showCopy:d3(i,`copy`),showDownload:d3(i,`download`),showFullscreen:d3(i,`fullscreen`),...r,children:e})},(e,t)=>l3(e,t));E3.displayName=`MarkdownTable`;var D3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`thead`,{className:I4()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>l3(e,t));D3.displayName=`MarkdownThead`;var O3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`tbody`,{className:I4()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>l3(e,t));O3.displayName=`MarkdownTbody`;var k3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`tr`,{className:I4()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>l3(e,t));k3.displayName=`MarkdownTr`;var A3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`th`,{className:I4()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>l3(e,t));A3.displayName=`MarkdownTh`;var j3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`td`,{className:I4()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>l3(e,t));j3.displayName=`MarkdownTd`;var M3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`blockquote`,{className:I4()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>l3(e,t));M3.displayName=`MarkdownBlockquote`;var N3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`sup`,{className:I4()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>l3(e,t));N3.displayName=`MarkdownSup`;var P3=(0,B.memo)(({children:e,className:t,node:n,...r})=>(0,V.jsx)(`sub`,{className:I4()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>l3(e,t));P3.displayName=`MarkdownSub`;var F3=(0,B.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,B.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,B.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,B.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,B.isValidElement)(e))return e;if(e.type===m3){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,V.jsx)(`section`,{className:t,...r,children:i}):null}return(0,V.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>l3(e,t));F3.displayName=`MarkdownSection`;var I3=(0,B.memo)(({node:e,className:t,children:n,...r})=>{let i=I4(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,B.useContext)(n6),l=t3(),u=Fpe(),d=(t?.match(sme))?.at(1)??``,f=Zpe(d);if(a)return(0,V.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(ime),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&ame.test(p))&&c!==!1,v=``;if((0,B.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,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(Y4,{}),children:(0,V.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=u3(s,`mermaid`),n=p3(s,`download`),r=p3(s,`copy`),a=p3(s,`fullscreen`),c=p3(s,`panZoom`),l=e&&(n||r||a);return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(Y4,{}),children:(0,V.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,V.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,V.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,V.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,V.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,V.jsx)($pe,{chart:v,config:o?.config}):null,r?(0,V.jsx)(q4,{code:v}):null,a?(0,V.jsx)(eme,{chart:v,config:o?.config}):null]})}):null,(0,V.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,V.jsx)(ome,{chart:v,config:o?.config,showControls:c})})]})})}let y=u3(s,`code`),b=f3(s,`download`),x=f3(s,`copy`);return(0,V.jsx)(Wpe,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,V.jsxs)(V.Fragment,{children:[b?(0,V.jsx)(Kpe,{code:v,language:d}):null,x?(0,V.jsx)(q4,{}):null]}):null})},(e,t)=>e.className===t.className&&c3(e.node,t.node));I3.displayName=`MarkdownCode`;var L3=(0,B.memo)(Jpe,(e,t)=>e.className===t.className&&c3(e.node,t.node));L3.displayName=`MarkdownImg`;var R3=(0,B.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,B.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,V.jsx)(V.Fragment,{children:e})}return(0,V.jsx)(`p`,{...n,children:e})},(e,t)=>l3(e,t));R3.displayName=`MarkdownParagraph`;var cme={ol:m3,li:h3,ul:g3,hr:_3,strong:v3,a:y3,h1:b3,h2:x3,h3:S3,h4:C3,h5:w3,h6:T3,table:E3,thead:D3,tbody:O3,tr:k3,th:A3,td:j3,blockquote:M3,code:I3,img:L3,pre:({children:e})=>(0,B.isValidElement)(e)?(0,B.cloneElement)(e,{"data-block":`true`}):e,sup:N3,sub:P3,p:R3,section:F3},lme=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,ume=/\p{L}/u;function z3(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(lme.test(e))return`rtl`;if(ume.test(e))return`ltr`}return`ltr`}var dme=/^[ \t]{0,3}(`{3,}|~{3,})/,fme=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,B3=e=>{let t=e.split(`
211
211
  `),n=null,r=0;for(let e of t){let t=dme.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},pme=e=>{let t=e.split(`
212
212
  `);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&fme.test(t))return!0}return!1},mme=()=>e=>{vG(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},V3=[],H3={allowDangerousHtml:!0},U3=new WeakMap,W3=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=U3.get(e);n||(n=e.name,U3.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=U3.get(r);e||(e=r.name,U3.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()}},G3=e=>{let t=hme(e),n=e.children||``;return Sme(t.runSync(t.parse(n),n),e)},hme=e=>{let t=W3.get(e);if(t)return t;let n=_me(e);return W3.set(e,n),n},gme=e=>e.some(e=>Array.isArray(e)?e[0]===UZ:e===UZ),_me=e=>{let t=e.rehypePlugins||V3,n=e.remarkPlugins||V3,r=gme(t)?n:[...n,mme],i=e.remarkRehypeOptions?{...H3,...e.remarkRehypeOptions}:H3;return Mfe().use(Mde).use(r).use(mfe,i).use(t)},vme=e=>e,yme=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},bme=(e,t)=>{for(let n in n2)if(Object.hasOwn(n2,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=n2[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},Sme=(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||vme;vG(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return yme(c,s,a,e.value),s;if(e.type===`element`&&(bme(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 Bue(e,{Fragment:V.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:V.jsx,jsxs:V.jsxs,passKeys:!0,passNode:!0})},Cme=/\[\^[\w-]{1,200}\](?!:)/,wme=/\[\^[\w-]{1,200}\]:/,Tme=/<(\w+)[\s>]/,Eme=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),K3=new Map,q3=new Map,Dme=e=>{let t=e.toLowerCase(),n=K3.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return K3.set(t,r),r},Ome=e=>{let t=e.toLowerCase(),n=q3.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return q3.set(t,r),r},J3=(e,t)=>{if(Eme.has(t.toLowerCase()))return 0;let n=e.match(Dme(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},Y3=(e,t)=>{let n=e.match(Ome(t));return n?n.length:0},kme=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},Ame=e=>{let t=Cme.test(e),n=wme.test(e);if(t||n)return[e];let r=x4.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=J3(t,e),o=Y3(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(Tme);if(e){let n=e[1];J3(t,n)>Y3(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(kme(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},jme=(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(`
213
213
 
@@ -223,7 +223,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
223
223
  `).trim()}\n`}function ehe(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 the(e){return/^agent:(.+?):subagent:/.exec(e.trim())?.[1]?.trim()||void 0}function nhe(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 rhe(e){if(!Number.isFinite(e)||e<0)return``;let t=e>0&&e<.01?4:2;return`${e.toFixed(t).replace(`.`,`,`)} $`}function h6(e){return e.moaRole===`moa_aggregator`?fn():e.moaRole===`moa_reference`?Pr():re()}function ihe(e){return e.taskName?.trim()||ehe(e.childSessionKey)||Ei()}function ahe(e){return e.some(e=>e.status===`running`)}function ohe(e){return e===`running`?`running`:e===`done`?`done`:`failed`}function she(e){return e!==`running`}function che(e){return e!==void 0&&e.tone!==`running`&&e.sessionMeta?.cleanup===`delete`}function lhe(e){return e.startsWith(`fork:`)}function uhe(e){let t=ohe(e.status),n=e.sessionMeta?.subagentRole;return{id:e._id,childSessionKey:e.childSessionKey,...n===`moa_reference`||n===`moa_aggregator`?{moaRole:n}:{},taskName:e.taskName?.trim()||void 0,label:ihe(e),status:e.status,tone:t,failure:t===`failed`,phase:e.status===`running`?e.phase:void 0,errorMessage:e.errorMessage,resultText:e.resultText,tools:e.tools?.map(e=>({name:e.name,status:e.status,toolCallId:e.toolCallId})),sessionMeta:e.sessionMeta,telemetry:e.telemetry,childAgentId:the(e.childSessionKey)}}function g6(e){let t=[...e].sort((e,t)=>t.createdAt-e.createdAt).map(uhe).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}}function dhe(e){if(e.total<=1)return[];let t={done:e.done,running:e.running,failed:e.failed};return[`done`,`running`,`failed`].filter(e=>t[e]>0).map(e=>({tone:e,count:t[e]}))}function _6(e,t,n){let r=new Set(t);return e.filter(e=>n!==void 0&&e.parentMessageId===n||r.has(e.childSessionKey))}function fhe(e){return e===1?pl({count:e}):Qt({count:e})}var v6=120,phe=/EXTERNAL_UNTRUSTED_CONTENT|SECURITY\s*NOTICE|UNTRUSTED\s*CONTENT/i,mhe=/DO NOT/;function y6(e){return phe.test(e)||mhe.test(e)}function b6(e){return e.length<=v6?e:`${e.slice(0,v6-1)}…`}function hhe(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)&&!y6(e))return e}return null}function x6(e){let t=bt();if(e==null)return t;let n=e.trim();if(n===``)return t;let r=/([A-Za-z][\w.-]*)\s+failed\s*\(([^)]{1,40})\)/i.exec(n);if(r)return b6(`${r[1]} (${r[2].trim()})`);let i=hhe(n);return i&&!y6(i)?b6(i):t}function ghe(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 _he(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 S6=(0,B.createContext)(null);function vhe({card:e}){let t=e.tone===`running`?ft():e.tone===`failed`?vi():Fi();return(0,V.jsxs)(`span`,{className:`oc-subpanel__status oc-subpanel__status--${e.tone}`,children:[t,e.tone===`running`?(0,V.jsx)(jx,{size:13,className:`oc-subagent__spin`,"aria-hidden":!0}):e.tone===`failed`?(0,V.jsx)(_x,{size:13,"aria-hidden":!0}):(0,V.jsx)(xd,{size:13,"aria-hidden":!0})]})}function yhe(e){if(e)try{return JSON.parse(e)}catch{return}}function bhe(e){return{type:e===`error`?`error`:e===`done`?`completed`:`running`}}function C6(e){return e.toolCallId??`name:${e.name}`}function xhe({summary:e,parts:t,subAgentRunning:n}){let[r,i]=(0,B.useState)(!1),a=n,o=e.length===1?_n({count:e.length}):As({count:e.length}),s=a?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(jx,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}),mr()]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(xd,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-sr-only`,children:Bn()})]}),c=new Map;for(let e of t??[])c.set(e.toolCallId,e);return(0,V.jsxs)(`div`,{className:`oc-toolact`,children:[(0,V.jsx)(BH,{icon:(0,V.jsx)(Yx,{size:14}),label:o,trailing:s,open:r,ariaExpanded:r,title:r?zs():En(),onClick:()=>i(!r)}),r?(0,V.jsx)(`div`,{className:`oc-toolact__detail`,children:e.map((e,t)=>{let r=c.get(C6(e));return(0,V.jsx)(eU,{toolName:e.name,args:r?yhe(r.argsText):void 0,argsText:r?.argsText,result:r?.resultText,status:bhe(r?.status??e.status),turnSettled:!n},`${C6(e)}-${t}`)})}):null]})}function She({meta:e,telemetry:t,childAgentId:n,instanceName:r,parentAgentLabel:i,onExport:a}){let[o,s]=(0,B.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,V.jsx)(`div`,{className:`oc-subpanel__barslot`,"aria-hidden":!0});let l=e?.fastMode===void 0?null:e.fastMode?Jr():qu();return(0,V.jsxs)(`div`,{className:`oc-subpanel__bar`,children:[(0,V.jsxs)(`div`,{className:`oc-subpanel__bar-chips`,children:[e?.model?(0,V.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:e.modelProvider?Fa({provider:e.modelProvider}):Ue(),children:[(0,V.jsx)(rne,{size:12,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-chip__label`,children:e.model})]}):null,e?.thinkingLevel?(0,V.jsxs)(`span`,{className:`oc-chip`,title:Nu(),children:[(0,V.jsx)(mx,{size:12,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-chip__label`,children:e.thinkingLevel})]}):null,l?(0,V.jsxs)(`span`,{className:`oc-chip`,title:_e(),children:[(0,V.jsx)(kx,{size:12,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-chip__label`,children:l})]}):null,e?.context?(0,V.jsxs)(`span`,{className:`oc-chip`,title:e.context===`fork`?xc():fs(),children:[(0,V.jsx)(xne,{size:12,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-chip__label`,children:e.context})]}):null,i?(0,V.jsxs)(`span`,{className:`oc-chip`,title:va(),children:[(0,V.jsx)(px,{size:12,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-chip__label`,children:i})]}):null,a?(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,className:`oc-chip oc-chip--btn oc-subpanel__bar-export`,title:Ae(),children:[(0,V.jsx)(Sx,{size:12,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-chip__label`,children:Zn()}),(0,V.jsx)(Cd,{size:12,className:`oc-chip__chev`,"aria-hidden":!0})]})}),(0,V.jsxs)(FB,{align:`end`,className:`w-44`,children:[(0,V.jsx)(LB,{children:Zn()}),(0,V.jsx)(IB,{onClick:()=>a(`md`),children:Ya()}),(0,V.jsx)(IB,{onClick:()=>a(`json`),children:Dl()})]})]}):null]}),c?(0,V.jsxs)(`button`,{type:`button`,className:`oc-subpanel__adv-toggle${o?` is-open`:``}`,"aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,V.jsx)(Ux,{size:13,"aria-hidden":!0}),es(),(0,V.jsx)(gx,{size:13,className:`oc-subpanel__adv-chevron`,"aria-hidden":!0})]}):null,o&&c?(0,V.jsx)(whe,{meta:e??{},telemetry:t,childAgentId:n,instanceName:r}):null]})}function Che(e){return e===`leaf`?Ui():e===`orchestrator`?Zi():null}function whe({meta:e,telemetry:t,childAgentId:n,instanceName:r}){let i=[];e.model&&i.push([Ue(),e.model]),e.modelProvider&&i.push([ci(),e.modelProvider]);let a=e.agentId??n;a&&i.push([Rl(),a]),r&&i.push([Wr(),r]),e.label&&i.push([Kc(),e.label]),e.thinkingLevel&&i.push([Nu(),e.thinkingLevel]),e.fastMode!==void 0&&i.push([_e(),e.fastMode?Jr():qu()]),e.context&&i.push([fs(),e.context]),e.lightContext!==void 0&&i.push([Ma(),e.lightContext?Ts():wl()]),e.runtime&&i.push([al(),e.runtime]),e.mode&&i.push([Uo(),e.mode]),e.cleanup&&i.push([vo(),e.cleanup]),e.sandbox&&i.push([lu(),e.sandbox]),e.controlScope&&i.push([Ga(),e.controlScope]),e.subagentRole&&i.push([sd(),e.subagentRole]),e.spawnDepth!==void 0&&i.push([bu(),String(e.spawnDepth)]);let o=Che(e.subagentRole);if(o&&i.push([io(),o]),e.sessionId&&i.push([Mc(),e.sessionId]),e.gatewayKind&&i.push([uc(),e.gatewayKind]),t?.runtimeMs!==void 0){let e=nhe(t.runtimeMs);e&&i.push([Zl(),e])}if(t?.totalTokens!==void 0&&i.push([Ao(),WB(t.totalTokens)]),t?.estimatedCostUsd!==void 0){let e=typeof t.totalTokens==`number`&&t.totalTokens>0;if(t.estimatedCostUsd<=0&&e)i.push([g(),ku()]);else{let e=rhe(t.estimatedCostUsd);e&&i.push([g(),e])}}return(0,V.jsx)(`dl`,{className:`oc-subpanel__adv-list`,children:i.map(([e,t])=>(0,V.jsxs)(`div`,{className:`oc-subpanel__adv-row`,children:[(0,V.jsx)(`dt`,{children:e}),(0,V.jsx)(`dd`,{children:t})]},e))})}function w6({chatId:e,childKey:t,onClose:n,parentAgentLabel:r}){let i=R(L.subAgents.listSubAgents,{chatId:e}),a=R(L.agents.getChatAgent,{chatId:e}),o=R(L.messages.getSessionMeta,{chatId:e})?.perTurnRouting===!0?void 0:a?.agent?.instanceName,s=(i??[]).find(e=>e.childSessionKey===t),c=s?g6([s]).cards[0]:void 0,l=s?.taskName?.trim(),u=che(c),d=lhe(t),f=R(L.subAgentReports.myReportedSubAgentIds,{chatId:e}),p=R(L.subAgents.listSubAgentToolParts,{chatId:e,childSessionKey:t}),m=R(L.subAgentInteractions.listSubAgentInteractions,{chatId:e,childSessionKey:t}),h=ei(L.subAgentInteractions.sendToSubAgent),g=Se(L.chats.generateUploadUrl),_=Se(L.uploads.registerUpload),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)(!0),[S,C]=(0,B.useState)(!1),[w,T]=(0,B.useState)(``),[E,D]=(0,B.useState)(!1),[k,A]=(0,B.useState)([]),[j,M]=(0,B.useState)(!1),[N,ee]=(0,B.useState)(!0),P=(0,B.useRef)(null),F=(0,B.useRef)(null),ne=(0,B.useCallback)(async e=>{if(!(!e||e.length===0)){M(!0);try{for(let t of Array.from(e)){if(k.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}),A(e=>e.length>=6?e:[...e,{storageId:n,filename:t.name,mimeType:t.type||`application/octet-stream`}])}}finally{M(!1),P.current&&(P.current.value=``)}}},[k.length,g,_]),[ie,ae]=(0,B.useState)(null),oe=c?(f??[]).includes(c.id):!1,se=(0,B.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?x6(c.errorMessage):void 0,tools:t};_he(Zme(l,e),e===`md`?$me(n):Qme({...n,exportedAt:Date.now()}))},[c,p,l,r]);(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,B.useEffect)(()=>{i!==void 0&&!s&&n()},[i,s,n]);let ce=m&&m.length>0?`${m.length}:${m[m.length-1].status}`:``;(0,B.useEffect)(()=>{if(!ce)return;let e=F.current;e&&e.scrollTo({top:e.scrollHeight,behavior:`smooth`})},[ce]);let le=async()=>{let n=w.trim();if(!(u||d)&&!(!n&&k.length===0||v||j)){y(!0);try{await h({chatId:e,childSessionKey:t,text:n,...k.length>0?{attachments:k.map(e=>({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType}))}:{}}),T(``),A([])}finally{y(!1)}}};return(0,V.jsxs)(`div`,{className:`oc-subpanel`,children:[(0,V.jsxs)(`header`,{className:`oc-subpanel__head`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-subpanel__avatar oc-subpanel__back${c?` oc-subpanel__avatar--${c.tone}`:``}`,disabled:!s?.parentMessageId,title:Ls(),"aria-label":wn(),onClick:()=>s?.parentMessageId&&ghe(s.parentMessageId),children:(0,V.jsx)(Qte,{size:16})}),(0,V.jsxs)(`div`,{className:`oc-subpanel__headmain`,children:[(0,V.jsxs)(`div`,{className:`oc-subpanel__head-top`,children:[(0,V.jsx)(`span`,{className:`oc-subpanel__kind`,children:c?h6(c):re()}),(0,V.jsxs)(`div`,{className:`oc-subpanel__head-ctrls`,children:[c?(0,V.jsx)(vhe,{card:c}):null,c&&she(c.status)?(0,V.jsx)(`button`,{type:`button`,className:`oc-iconbtn oc-subpanel__report${oe?` is-on`:``}`,title:oe?Kr():Xs(),"aria-label":Xs(),disabled:oe,onClick:()=>ae({subAgentId:c.id,label:c.label}),children:(0,V.jsx)(Dx,{size:15,"aria-hidden":!0})}):null,(0,V.jsx)(zd,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":Nr(),className:`oc-subpanel__close`,children:(0,V.jsx)(Dd,{size:16})})]})]}),l?(0,V.jsx)(`button`,{type:`button`,className:`oc-subpanel__task${E?` is-expanded`:``}`,title:O(),"aria-expanded":E,onClick:()=>D(e=>!e),children:l}):null]})]}),(0,V.jsx)(She,{meta:c?.sessionMeta,telemetry:c?.telemetry,childAgentId:c?.childAgentId,instanceName:o,parentAgentLabel:r,onExport:c?se:void 0}),(0,V.jsx)(`div`,{className:`oc-subpanel__body`,ref:F,children:c?(0,V.jsxs)(V.Fragment,{children:[c.tools&&c.tools.length>0&&N?(0,V.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,V.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Nt()}),(0,V.jsx)(xhe,{summary:c.tools,parts:p,subAgentRunning:c.tone===`running`})]}):null,c.failure?(0,V.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,V.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:nt()}),(0,V.jsx)(`p`,{className:`oc-subpanel__error`,children:x6(c.errorMessage)})]}):null,c.resultText?(0,V.jsxs)(`section`,{className:`oc-subpanel__section oc-subpanel__result${b?` is-open`:``}`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`oc-subpanel__result-toggle`,"aria-expanded":b,onClick:()=>x(!b),children:[(0,V.jsx)(gx,{size:13,className:`oc-subpanel__result-chevron`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-subpanel__section-title`,children:fr()})]}),b?(0,V.jsx)(c6,{text:c.resultText}):null]}):c.tone===`running`?(0,V.jsxs)(`p`,{className:`oc-subpanel__muted oc-subpanel__working`,children:[(0,V.jsx)(jx,{size:14,className:`oc-subagent__spin`,"aria-hidden":!0}),Rn()]}):null,m&&m.length>0?(0,V.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,V.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Ht()}),(0,V.jsx)(`div`,{className:`oc-subpanel__thread`,children:m.map(e=>(0,V.jsxs)(`div`,{className:`oc-subpanel__exchange`,children:[(0,V.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--user`,children:[e.userText,e.attachments&&e.attachments.length>0?(0,V.jsx)(`div`,{className:`oc-subpanel__msg-atts`,children:e.attachments.map((t,n)=>(0,V.jsxs)(`span`,{className:`oc-subpanel__attchip oc-subpanel__attchip--sent`,title:t.filename,children:[(0,V.jsx)(Lx,{size:11,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:t.filename})]},`${e._id}-att-${n}`))}):null]}),e.status===`pending`?(0,V.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--pending`,children:[(0,V.jsx)(jx,{size:13,className:`oc-actrow__spin`,"aria-hidden":!0}),dl()]}):e.status===`error`?(0,V.jsx)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--err`,children:e.errorMessage??Xt()}):(0,V.jsx)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--reply`,children:(0,V.jsx)(c6,{text:e.replyText??``})})]},e._id))})]}):null]}):(0,V.jsx)(`p`,{className:`oc-subpanel__muted`,children:dn()})}),(0,V.jsx)(`footer`,{className:`oc-subpanel__foot`,children:S?(0,V.jsxs)(`div`,{className:`oc-subpanel__prompt`,children:[k.length>0?(0,V.jsx)(`div`,{className:`oc-subpanel__attstrip`,children:k.map((e,t)=>(0,V.jsxs)(`span`,{className:`oc-subpanel__attchip`,title:e.filename,children:[(0,V.jsx)(Lx,{size:12,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:e.filename}),(0,V.jsx)(`button`,{type:`button`,className:`oc-subpanel__attchip-x`,"aria-label":wi(),onClick:()=>A(e=>e.filter((e,n)=>n!==t)),children:(0,V.jsx)(Dd,{size:11,"aria-hidden":!0})})]},`${e.storageId}-${t}`))}):null,(0,V.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(),le())},placeholder:_d(),autoFocus:!0}),(0,V.jsxs)(`div`,{className:`oc-subpanel__prompt-bar`,children:[(0,V.jsxs)(`div`,{className:`oc-subpanel__composer-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-subpanel__composer-btn`,title:gi(),"aria-label":gi(),disabled:j||k.length>=6,onClick:()=>P.current?.click(),children:j?(0,V.jsx)(jx,{size:15,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,V.jsx)(zx,{size:15,"aria-hidden":!0})}),c?.tools&&c.tools.length>0?(0,V.jsxs)(`button`,{type:`button`,className:`oc-subpanel__composer-btn oc-subpanel__composer-btn--label${N?` is-on`:``}`,title:vt(),"aria-pressed":N,onClick:()=>ee(e=>!e),children:[(0,V.jsx)(Yx,{size:14,"aria-hidden":!0}),Nt()]}):null]}),c?.tone===`running`?(0,V.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:ut()}):d?(0,V.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:aa()}):u?(0,V.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:xr()}):(m??[]).some(e=>e.status===`pending`)?(0,V.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:Ni()}):null,(0,V.jsxs)(zd,{variant:`default`,size:`sm`,className:`gap-1.5`,disabled:!w.trim()&&k.length===0||v||j||c?.tone===`running`||u||d||(m??[]).some(e=>e.status===`pending`),onClick:()=>void le(),children:[v?(0,V.jsx)(jx,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,V.jsx)(yne,{size:14,"aria-hidden":!0}),jr()]})]}),(0,V.jsx)(`input`,{ref:P,type:`file`,multiple:!0,className:`oc-subpanel__fileinput`,onChange:e=>void ne(e.target.files)})]}):(0,V.jsxs)(`button`,{type:`button`,className:`oc-subpanel__interact`,onClick:()=>C(!0),children:[(0,V.jsx)(lne,{size:15,"aria-hidden":!0}),te()]})}),(0,V.jsx)(Xme,{target:ie,onClose:()=>ae(null)})]})}var The=new Set([`knobThinkingLevel`,`knobModel`,`knobFastMode`,`knobUnset`,`agentFiles`,`sessionCompact`,`configDefaults`,`subagents`,`inboundAttachments`]),Ehe=new Set([`knobThinkingLevel`,`knobModel`]);function T6(e,t){return The.has(t)?e==null?Ehe.has(t):e[t]===!0:!1}function Dhe(e,t){return{model:e(`knobModel`)&&t.hasModels,thinking:e(`knobThinkingLevel`)&&t.hasLevels,speed:e(`knobFastMode`),reset:e(`knobUnset`)}}function Ohe(e,t){return e===void 0?`loading`:e===null?{blocked:!T6(null,t),gatewayVersion:null,provider:null}:{blocked:!T6(e.capabilities,t),gatewayVersion:e.gatewayVersion,provider:e.provider}}function E6(e){let t=R(L.compat.forChat,e===null?`skip`:{chatId:e}),n=t==null?null:t.capabilities;return{can:(0,B.useCallback)(e=>T6(n,e),[n]),resolved:n!==null,loading:t===void 0,gatewayVersion:t?.gatewayVersion??null}}function D6(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function O6(e){let t=[];for(let n of e){if(n.toolName!==`sessions_spawn`)continue;let e=n.result;if(!D6(e))continue;let r=e.contentItems;if(Array.isArray(r))for(let e of r){let n=D6(e)?e.text:void 0;if(typeof n==`string`)try{let e=JSON.parse(n),r=D6(e)?e.childSessionKey:void 0;typeof r==`string`&&r!==``&&t.push(r)}catch{}}}return t}var khe=new Set([`sessions_spawn`,`delegate_task`,`mixture_of_agents`]);function Ahe(e){return e.some(e=>khe.has(e.toolName))}function k6(e){return e?.trim()||void 0}function jhe(e,t,n,r){if(e.hasText||e.hasMedia||e.status!==`complete`)return{kind:`none`};let i=new Set(O6(t)),a=n.filter(e=>r!==void 0&&e.parentMessageId===r||i.has(e.childSessionKey)),o=a.find(e=>e.status===`running`);if(o)return{kind:`waiting`,taskName:k6(o.taskName)};let s=a.find(e=>e.status===`error`||e.status===`aborted`);if(s)return{kind:`failed`,taskName:k6(s.taskName),reason:x6(s.errorMessage)};let c=a.find(e=>e.status===`done`);return c?{kind:`done`,taskName:k6(c.taskName),resultText:c.resultText}:{kind:`generic`}}function A6(e,t){return e===`done`?Ee({count:t}):e===`running`?ze({count:t}):ii({count:t})}function Mhe({card:e}){let t=e.tone===`running`?jx:e.tone===`failed`?_x:xd,n=(0,B.useContext)(S6),r=e.tools?.length??0,i=n?.activeChildKey===e.childSessionKey,a=(0,V.jsxs)(V.Fragment,{children:[r>0?(0,V.jsx)(`span`,{className:`oc-actrow__toolcount`,children:r===1?_n({count:r}):As({count:r})}):null,(0,V.jsx)(t,{size:13,className:`oc-actrow__status-icon${e.tone===`running`?` oc-actrow__spin`:``}`,"aria-hidden":!0})]});return(0,V.jsxs)(`div`,{className:`oc-subagent oc-subagent--${e.tone}${e.moaRole===`moa_reference`?` oc-subagent--nested`:``}`,children:[(0,V.jsx)(BH,{tone:e.tone,icon:(0,V.jsx)(px,{size:15}),label:h6(e),sublabel:e.taskName,trailing:a,active:i,ariaExpanded:i,ariaHasPopup:!0,title:yd(),ariaLabel:yd(),onClick:()=>n?.openFor(e.childSessionKey)}),e.failure?(0,V.jsx)(`p`,{className:`oc-subagent__error`,role:`status`,children:x6(e.errorMessage)}):null]})}var Nhe=[];function Phe(){let e=zO(e=>e.metadata?.custom?.chatId),t=zO(e=>e.metadata?.custom?.toolParts??Nhe),n=(0,B.useMemo)(()=>O6(t),[t]),r=(0,B.useMemo)(()=>Ahe(t),[t]),i=zO(e=>e.metadata?.custom?.messageId),a=r&&e?e:null,{can:o}=E6(a),s=R(L.subAgents.listSubAgents,a?{chatId:a}:`skip`),[c,l]=(0,B.useState)(!1);if(!r||!o(`subagents`))return null;let u=g6(_6(s??[],n,i)),d=[...u.cards];if(d.length===0)return null;let f=dhe(u);return(0,V.jsxs)(`div`,{className:`oc-msg-subagents`,children:[f.length>0?(0,V.jsx)(BH,{icon:(0,V.jsx)(px,{size:15}),label:fhe(u.total),trailing:f.map(e=>(0,V.jsxs)(`span`,{className:`oc-subagent-badge oc-subagent-badge--${e.tone}`,title:A6(e.tone,e.count),"aria-label":A6(e.tone,e.count),children:[e.tone===`done`?(0,V.jsx)(xd,{size:12,"aria-hidden":!0}):e.tone===`running`?(0,V.jsx)(jx,{size:12,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,V.jsx)(_x,{size:12,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-subagent-badge__count`,children:e.count})]},e.tone)),open:c,ariaExpanded:c,title:c?zs():En(),onClick:()=>l(!c)}):null,(f.length===0||c)&&d.map(e=>(0,V.jsx)(`div`,{className:`oc-msg-subagents__anchor`,"data-subagent-id":e.id,"data-subagent-failed":e.failure?``:void 0,children:(0,V.jsx)(Mhe,{card:e})},e.id))]})}function j6({delayDuration:e=0,...t}){return(0,V.jsx)(hce,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function M6({...e}){return(0,V.jsx)(gce,{"data-slot":`tooltip`,...e})}function N6({...e}){return(0,V.jsx)(_ce,{"data-slot":`tooltip-trigger`,...e})}function P6({className:e,sideOffset:t=0,children:n,...r}){return(0,V.jsx)(vce,{children:(0,V.jsxs)(yce,{"data-slot":`tooltip-content`,sideOffset:t,className:Sc(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,V.jsx)(bce,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function Fhe(){return zO(e=>e.metadata?.custom?.compaction??null)}function Ihe(){let e=Fhe();if(!e)return null;let t=e.phase===`midturn`?Hu():Ur();return(0,V.jsx)(j6,{delayDuration:150,children:(0,V.jsxs)(M6,{children:[(0,V.jsx)(N6,{asChild:!0,children:(0,V.jsxs)(`div`,{className:`oc-compaction`,role:`note`,"aria-label":t,children:[(0,V.jsx)(`span`,{className:`oc-compaction__rule`,"aria-hidden":!0}),(0,V.jsxs)(`span`,{className:`oc-compaction__label`,children:[(0,V.jsx)(ane,{size:12,"aria-hidden":!0}),de()]}),(0,V.jsx)(`span`,{className:`oc-compaction__rule`,"aria-hidden":!0})]})}),(0,V.jsx)(P6,{className:`oc-compaction__tip`,children:t})]})})}function Lhe(e,t){if(e===null||e<=t)return null;let n=Math.floor((e-t)/6e4);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24){let e=n%60;return e>0?`${r}h ${e}m`:`${r}h`}return`${Math.floor(r/24)}${Mo()} ${r%24}h`}function F6(e,t){if(!e||e.length===0)return null;let n=[];for(let r of e)for(let e of r.windows)n.push({provider:r.provider,label:e.label,percentLeft:Math.round(Math.min(100,Math.max(0,100-e.usedPercent))),resetText:Lhe(e.resetAt,t)});if(n.length===0)return null;let r=n.reduce((e,t)=>t.percentLeft<e.percentLeft?t:e),i=r.percentLeft<=10?`is-critical`:r.percentLeft<=25?`is-warn`:`is-ok`;return{percentLeft:r.percentLeft,label:r.label,resetText:r.resetText,level:i,windows:n}}var I6=(0,B.createContext)(null);function Rhe(){return(0,B.useContext)(I6)??{open:()=>{}}}function zhe({children:e}){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(null),c=(0,B.useCallback)(e=>{n(e),i(!1)},[]),l=(0,B.useCallback)(()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),n(null),o(!1)},[]);(0,B.useEffect)(()=>{if(t===null)return;let e=e=>{e.key===`Escape`&&l()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,l]),(0,B.useEffect)(()=>{let e=()=>o(document.fullscreenElement!==null);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let u=(0,B.useCallback)(()=>{let e=s.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]);return(0,V.jsxs)(I6.Provider,{value:{open:c},children:[e,t===null?null:(0,gh.createPortal)((0,V.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,V.jsxs)(`div`,{className:`oc-lightbox__bar`,children:[(0,V.jsx)(`span`,{className:`oc-lightbox__name`,title:t.name,children:t.name}),(0,V.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:()=>i(e=>!e),"aria-label":r?Ba():nd(),title:r?Ba():nd(),children:r?(0,V.jsx)(wne,{size:18}):(0,V.jsx)(Cne,{size:18})}),(0,V.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:u,"aria-label":a?fa():hu(),title:a?fa():hu(),children:a?(0,V.jsx)(une,{size:18}):(0,V.jsx)(Px,{size:18})}),(0,V.jsx)(`a`,{className:`oc-lightbox__btn`,href:t.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":Yo(),title:Yo(),children:(0,V.jsx)(wx,{size:18})}),(0,V.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:l,"aria-label":ss(),title:ss(),children:(0,V.jsx)(Dd,{size:18})})]}),(0,V.jsx)(`div`,{className:`oc-lightbox__stage${r?` oc-lightbox__stage--scroll`:``}`,onClick:e=>{e.target===e.currentTarget&&l()},children:(0,V.jsx)(`img`,{src:t.url,alt:t.name,className:r?`oc-lightbox__img--actual`:`oc-lightbox__img--fit`,decoding:`async`})})]}),document.body)]})}var L6=null;function Bhe(e,t){L6={messageId:e,terms:t}}function Vhe(e){if(L6===null||L6.messageId!==e)return null;let t=L6.terms;return L6=null,t}function Hhe(e){return e.turnRunning?{mode:`queue`,reason:`turn`}:e.hasRunningSubAgent?{mode:`queue`,reason:`subagent`}:{mode:`send`,reason:null}}function R6({className:e,...t}){return(0,V.jsx)(uA,{"data-slot":`checkbox`,className:Sc(`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,V.jsx)(fA,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,V.jsx)(dne,{className:`size-3.5`}):(0,V.jsx)(xd,{className:`size-3.5`})})})}function z6(e,t){return t===`memory`?`memory`:e.context===!0||!e.file_name?`context`:`document`}function B6(e){let t={memory:0,documents:0,context:0};for(let n of e)for(let e of n.items){let r=z6(e,n.group);r===`memory`?t.memory+=1:r===`document`?t.documents+=1:t.context+=1}return t}function Uhe(e){return e.memory+e.documents+e.context>0}function V6(e){let t=[];return e.memory>0&&t.push(e.memory===1?Wt():it({count:e.memory})),e.documents>0&&t.push(e.documents===1?Oi():di({count:e.documents})),e.context>0&&t.push(e.context===1?dd():Tr({count:e.context})),t.join(` · `)}function H6(e){return e.title??e.file_name??e.id??e.type??qe()}function U6(e){return e.title&&e.file_name?e.file_name:void 0}function Whe(e){return e.file_name??H6(e)}function W6(e){let t=[];return e.type&&H6(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(Ct({score:e.score.toFixed(2)})),t}function G6(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 K6(e,t){let n=t.trim().toLowerCase();return n===``?!0:[Y6(e),e.item.file_name??``,e.item.text??``,...W6(e.item)].join(` `).toLowerCase().includes(n)}function q6(e){return z6(e.item,e.group)===`document`}function J6(e){return z6(e.item,e.group)===`context`}function Y6(e){return J6(e)?en():H6(e.item)}var X6=(0,B.createContext)(null),Ghe=[];function Khe(){let e=zO(e=>e.metadata?.custom?.provenanceParts??Ghe),t=zO(e=>e.metadata?.custom?.messageId),n=zO(e=>e.metadata?.custom?.attachedDocCount??0),r=(0,B.useContext)(X6),i=B6(e);if(e.length===0||!Uhe(i))return null;let a=r?.activeMessageId===t&&t!==void 0,o=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`oc-actrow__counts`,children:V6(i)}),n>0?(0,V.jsxs)(`span`,{className:`oc-actrow__badge`,title:Pe({count:n}),children:[(0,V.jsx)(Sx,{size:12,"aria-hidden":!0}),n]}):null]});return(0,V.jsx)(BH,{icon:(0,V.jsx)(Ex,{size:14}),label:ol(),trailing:o,active:a,ariaExpanded:a,ariaHasPopup:!0,ariaLabel:On(),onClick:()=>t&&r?.openFor(t)})}function Z6({messageId:e,onClose:t}){let n=R(L.messages.getProvenanceParts,{messageId:e}),r=(0,B.useMemo)(()=>n??[],[n]),i=R(L.agents.documentaryAvailable,{}),a=R(L.documentAttachments.getDocumentAttachments,{sourceMessageId:e}),o=Se(L.documentAttachments.attachDocuments),s=yV(),c=(0,B.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,B.useState)(``),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(new Set);(0,B.useEffect)(()=>{d(``),p(!1),h(!1),_(!1),y(new Set)},[e]);let b=(0,B.useMemo)(()=>G6(r,`documents`).filter(e=>q6(e)&&K6(e,u)),[r,u]),x=(0,B.useMemo)(()=>G6(r,`documents`).filter(e=>J6(e)&&K6(e,u)),[r,u]),S=(0,B.useMemo)(()=>G6(r,`memory`).filter(e=>K6(e,u)),[r,u]),C=B6(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,B.useMemo)(()=>G6(r,`documents`).filter(e=>q6(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:Whe(e.item)}))}),s.success(Rr())}catch(e){let t=_V(e);t.includes(`fetch_in_flight`)?s.error(se()):t.includes(`no_documentary_agent`)?s.error(Tu()):s.error(Ru(),e)}}let k=n===void 0;return(0,V.jsxs)(`div`,{className:`oc-sources-panel`,children:[(0,V.jsxs)(`div`,{className:`oc-sources-panel__head`,children:[(0,V.jsxs)(`div`,{className:`oc-sources-panel__heading`,children:[(0,V.jsx)(`h2`,{className:`oc-sources-panel__title`,children:tr()}),(0,V.jsx)(`p`,{className:`oc-sources-panel__sub`,children:V6(C)})]}),(0,V.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,onClick:t,"aria-label":is(),title:is(),children:(0,V.jsx)(Dd,{size:16,"aria-hidden":!0})})]}),(0,V.jsxs)(`div`,{className:`oc-sources-panel__search`,children:[(0,V.jsx)(Vx,{size:15,"aria-hidden":!0}),(0,V.jsx)(uB,{value:u,onChange:e=>d(e.target.value),placeholder:hn(),"aria-label":hn()})]}),(0,V.jsx)(`div`,{className:`oc-sources-panel__body`,children:k?(0,V.jsx)(`p`,{className:`oc-sources-panel__empty`,children:(0,V.jsx)(jx,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Q6,{icon:(0,V.jsx)(Ex,{size:14,"aria-hidden":!0}),label:yi(),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,V.jsx)(Q6,{icon:(0,V.jsx)(mne,{size:14,"aria-hidden":!0}),label:M(),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,V.jsx)(Q6,{icon:(0,V.jsx)(mx,{size:14,"aria-hidden":!0}),label:pt(),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,V.jsx)(`p`,{className:`oc-sources-panel__empty`,children:Os()}):null]})}),E.length>0?(0,V.jsxs)(`div`,{className:`oc-sources-panel__actions`,children:[(0,V.jsxs)(`div`,{className:`oc-sources-panel__actrow`,children:[(0,V.jsx)(`span`,{className:`oc-sources-panel__selcount`,children:Vs({count:E.length})}),(0,V.jsxs)(zd,{variant:`outline`,size:`sm`,disabled:!D,onClick:()=>void O(),children:[l?(0,V.jsx)(jx,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,V.jsx)(bne,{size:14,"aria-hidden":!0}),Un()]})]}),(0,V.jsx)(`p`,{className:`oc-sources-panel__acthint`,children:i==null?Tu():l?se():xe()})]}):null]})}function Q6({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,V.jsxs)(`section`,{className:`oc-srcsec${r?` is-open`:``}`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`oc-srcsec__head`,"aria-expanded":r,onClick:i,children:[r?(0,V.jsx)(Cd,{size:14,"aria-hidden":!0}):(0,V.jsx)(gx,{size:14,"aria-hidden":!0}),e,(0,V.jsx)(`span`,{className:`oc-srcsec__label`,children:t}),(0,V.jsx)(`span`,{className:`oc-srcsec__count`,children:n})]}),r?(0,V.jsxs)(`div`,{className:`oc-srcsec__body`,children:[o?(0,V.jsxs)(`label`,{className:`oc-srcsec__all`,children:[(0,V.jsx)(R6,{checked:d,onCheckedChange:e=>l(e===!0)}),(0,V.jsx)(`span`,{children:y()})]}):null,a.map(e=>(0,V.jsx)(qhe,{entry:e,selectable:o,selected:s.has(e.key),onToggle:()=>c(e.key),attachment:u.get(e.key)},e.key))]}):null]})}function qhe({entry:e,selectable:t,selected:n,onToggle:r,attachment:i}){let[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(null),[c,l]=(0,B.useState)(!1),{item:u}=e;(0,B.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=W6(u),f=typeof u.score==`number`?Math.max(0,Math.min(1,u.score)):null,p=q6(e);return(0,V.jsxs)(`div`,{className:`oc-srccard${t&&n?` is-selected`:``}`,children:[t?(0,V.jsx)(`label`,{className:`oc-srccard__pick`,children:(0,V.jsx)(R6,{checked:n,onCheckedChange:r})}):null,(0,V.jsxs)(`div`,{className:`oc-srccard__body`,children:[(0,V.jsx)(`div`,{className:`oc-srccard__title`,children:Y6(e)}),p&&U6(e.item)?(0,V.jsx)(`div`,{className:`oc-srccard__subid`,title:U6(e.item),children:U6(e.item)}):null,d.length>0||f!==null?(0,V.jsxs)(`div`,{className:`oc-srccard__meta`,children:[d.map(e=>(0,V.jsx)(`span`,{className:`oc-srccard__chip`,children:e},e)),f===null?null:(0,V.jsx)(`span`,{className:`oc-srccard__relev`,title:Ct({score:f.toFixed(2)}),children:(0,V.jsx)(`span`,{className:`oc-srccard__relev-track`,"aria-hidden":!0,children:(0,V.jsx)(`span`,{className:`oc-srccard__relev-fill`,style:{width:`${Math.round(f*100)}%`}})})})]}):null,u.text?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`blockquote`,{ref:s,className:`oc-srccard__excerpt${a?` is-full`:``}`,children:u.text}),c||a?(0,V.jsx)(`button`,{type:`button`,className:`oc-srccard__more`,onClick:()=>o(e=>!e),children:a?Ko():la()}):null]}):null,p?(0,V.jsx)(Jhe,{attachment:i}):null]})]})}function Jhe({attachment:e}){if(e?.status===`ready`&&e.url){let t=e.filename??Qu();return(0,V.jsxs)(`a`,{className:`oc-srccard__origin oc-srccard__origin--ready`,href:e.url,download:e.filename??void 0,target:`_blank`,rel:`noreferrer`,title:Qu(),children:[(0,V.jsx)(Sx,{size:13,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-srccard__origin-name`,children:t})]})}return e?.status===`pending`?(0,V.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--pending`,children:[(0,V.jsx)(jx,{size:13,"aria-hidden":!0}),Ia()]}):e?.status===`not_found`||e?.status===`failed`?(0,V.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--missing`,"aria-disabled":!0,children:[(0,V.jsx)(Dd,{size:13,"aria-hidden":!0}),du()]}):(0,V.jsxs)(`div`,{className:`oc-srccard__origin`,"aria-disabled":!0,children:[(0,V.jsx)(Sx,{size:13,"aria-hidden":!0}),$r()]})}var Yhe=`oc.sidebar.width`,$6=`oc.sidebar.collapsed`,e8=200,t8=520,Xhe=260,n8=`(max-width: 767px)`;function r8(){let[e,t]=(0,B.useState)(()=>typeof window<`u`&&window.matchMedia(n8).matches);return(0,B.useEffect)(()=>{let e=window.matchMedia(n8),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function i8(e){let{storageKey:t,defaultWidth:n,min:r,max:i,edge:a,maxViewportFraction:o}=e,s=(0,B.useCallback)(e=>{let t=o===void 0?1/0:Math.round(window.innerWidth*o);return Math.min(Math.max(r,Math.min(i,t)),Math.max(r,e))},[r,i,o]),[c,l]=(0,B.useState)(()=>s(Number(localStorage.getItem(t))||n));(0,B.useEffect)(()=>{localStorage.setItem(t,String(c))},[t,c]),(0,B.useEffect)(()=>{if(o===void 0)return;let e=()=>l(e=>s(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o,s]);let u=(0,B.useRef)(!1);return{width:c,startResize:(0,B.useCallback)(e=>{e.preventDefault(),u.current=!0;let t=e.clientX,n=c,r=a===`left`?1:-1,i=e=>{u.current&&l(s(n+r*(e.clientX-t)))},o=()=>{u.current=!1,window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,o),document.body.style.cursor=``,document.body.style.userSelect=``};window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,o),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[c,a,s]),setWidth:l}}function a8(){let{width:e,startResize:t}=i8({storageKey:Yhe,defaultWidth:Xhe,min:e8,max:t8,edge:`left`}),[n,r]=(0,B.useState)(()=>localStorage.getItem($6)===`1`),i=r8();return(0,B.useEffect)(()=>{localStorage.setItem($6,n?`1`:`0`)},[n]),(0,B.useEffect)(()=>{i&&r(!0)},[i]),{width:e,collapsed:n,toggleCollapsed:(0,B.useCallback)(()=>r(e=>!e),[]),collapse:(0,B.useCallback)(()=>r(!0),[]),startResize:t,isMobile:i,MIN_WIDTH:e8,MAX_WIDTH:t8}}function o8({...e}){return(0,V.jsx)(Nd,{"data-slot":`sheet`,...e})}function Zhe({...e}){return(0,V.jsx)(Od,{"data-slot":`sheet-portal`,...e})}function Qhe({className:e,...t}){return(0,V.jsx)(Ad,{"data-slot":`sheet-overlay`,className:Sc(`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 s8({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,V.jsxs)(Zhe,{children:[(0,V.jsx)(Qhe,{}),(0,V.jsxs)(Md,{"data-slot":`sheet-content`,"data-side":n,className:Sc(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,V.jsx)(Id,{"data-slot":`sheet-close`,asChild:!0,children:(0,V.jsxs)(zd,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,V.jsx)(Dd,{}),(0,V.jsx)(`span`,{className:`sr-only`,children:kr()})]})})]})]})}function c8({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`sheet-header`,className:Sc(`flex flex-col gap-0.5 p-4`,e),...t})}function l8({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`sheet-footer`,className:Sc(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function u8({className:e,...t}){return(0,V.jsx)(Fd,{"data-slot":`sheet-title`,className:Sc(`font-heading text-base font-medium text-foreground`,e),...t})}function d8({className:e,...t}){return(0,V.jsx)(Pd,{"data-slot":`sheet-description`,className:Sc(`text-sm text-muted-foreground`,e),...t})}var $he=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(`.`)),ege=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`avif`,`bmp`]),tge=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`]),nge=new Set([`pptx`,`ppt`,`docx`,`doc`,`xlsx`,`xls`,`odt`,`odp`,`ods`,`rtf`]);function rge(e,t){let n=(e??``).toLowerCase();if(tge.has(n))return!0;let r=f8(t);return r!==null&&nge.has(r)}function f8(e){if(!e)return null;let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?null:e.slice(t+1).toLowerCase()}function p8(e,t){let n=(e??``).split(`;`)[0].trim().toLowerCase(),r=f8(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&&ege.has(r)?`image`:r!==null&&$he.has(r)?`text`:`none`}var ige=[`fit`,.5,.75,1,1.5,2];function m8(e,t){return Number.isFinite(e)?Math.min(Math.max(1,Math.floor(e)),Math.max(1,Math.floor(t))):1}var h8=512*1024,age=1e3,oge=5e3;function sge(e,t){if((e??``).split(`;`)[0].trim().toLowerCase()===`text/tab-separated-values`||f8(t)===`tsv`)return` `}function cge(e){let t=`,`,n=0;for(let r of[`,`,`;`,` `]){let i=g8(e,r).length;i>n&&(t=r,n=i)}return t}function g8(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 lge(e,t=age,n){let r=[],i=``,a=!1,o=e.replace(/\r\n/g,`
224
224
  `).replace(/\r/g,`
225
225
  `);for(let e of o)e===`"`&&(a=!a),e===`
226
- `&&!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??cge(r[s]),l=g8(r[s],c),u=r.slice(s+1);return{header:l,rows:u.slice(0,t).map(e=>g8(e,c)),totalRows:u.length,truncatedRows:u.length>t,delimiter:c}}function uge(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 dge(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 _8=60;function v8({url:e,filename:t}){let[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(1),[c,l]=(0,B.useState)(`fit`);if((0,B.useEffect)(()=>{let t=!1,n=null;return r(null),a(!1),s(1),(async()=>{try{let i=await k4(()=>import(`./pdf-D7AA0FY6.js`),[]);i.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-DEtVeC4l.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,V.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,V.jsx)(`p`,{children:Fs()}),(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:$e()})]});if(n===null)return(0,V.jsx)(`div`,{className:`oc-docviewer__loading`,children:Sn()});let u=n.numPages,d=m8(o,u);return(0,V.jsxs)(`div`,{className:`oc-docviewer__pdf`,children:[(0,V.jsxs)(`div`,{className:`oc-docviewer__toolbar`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>m8(e-1,u)),disabled:d<=1,"aria-label":si(),children:(0,V.jsx)(hx,{size:15})}),(0,V.jsxs)(`span`,{className:`oc-docviewer__pageinfo`,children:[d,` / `,u]}),(0,V.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>m8(e+1,u)),disabled:d>=u,"aria-label":Mu(),children:(0,V.jsx)(gx,{size:15})}),(0,V.jsx)(`select`,{className:`oc-docviewer__zoom`,value:String(c),onChange:e=>{let t=e.target.value;l(t===`fit`?`fit`:Number(t))},"aria-label":Fn(),children:ige.map(e=>(0,V.jsx)(`option`,{value:String(e),children:e===`fit`?lr():`${Math.round(e*100)}%`},String(e)))})]}),(0,V.jsxs)(`div`,{className:`oc-docviewer__pdfbody`,children:[u>1?(0,V.jsxs)(`div`,{className:`oc-docviewer__rail`,"aria-label":He(),children:[Array.from({length:Math.min(u,_8)},(e,t)=>(0,V.jsx)(pge,{doc:n,page:t+1,active:t+1===d,onClick:()=>s(t+1)},t+1)),u>_8?(0,V.jsxs)(`span`,{className:`oc-docviewer__railmore`,children:[`+`,u-_8]}):null]}):null,(0,V.jsx)(fge,{doc:n,page:d,zoom:c,filename:t})]})]})}function fge({doc:e,page:t,zoom:n,filename:r}){let i=(0,B.useRef)(null),a=(0,B.useRef)(null),[o,s]=(0,B.useState)(0);return(0,B.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,B.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,V.jsx)(`div`,{ref:i,className:`oc-docviewer__main`,children:(0,V.jsx)(`canvas`,{ref:a,className:`oc-docviewer__canvas`,"aria-label":r})})}function pge({doc:e,page:t,active:n,onClick:r}){let i=(0,B.useRef)(null);return(0,B.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,V.jsxs)(`button`,{type:`button`,className:`oc-docviewer__thumb${n?` is-active`:``}`,onClick:r,"aria-label":me({page:t}),"aria-current":n?`true`:void 0,children:[(0,V.jsx)(`canvas`,{ref:i,className:`oc-docviewer__thumbcanvas`}),(0,V.jsx)(`span`,{className:`oc-docviewer__thumbnum`,children:t})]})}var y8=(0,B.createContext)({activeDoc:null,openFor:()=>{},close:()=>{}});function mge(){return(0,B.useContext)(y8)}function b8({doc:e,onClose:t}){let n=p8(e.mimeType,e.filename),r=n===`none`&&e.sourceStorageId!==void 0;return(0,V.jsxs)(`div`,{className:`oc-docviewer`,children:[(0,V.jsxs)(`header`,{className:`oc-docviewer__header`,children:[(0,V.jsx)(Ex,{size:15,"aria-hidden":!0,className:`oc-docviewer__icon`}),(0,V.jsx)(`span`,{className:`oc-docviewer__name`,title:e.filename,children:e.filename}),(0,V.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,title:$e(),"aria-label":$e(),children:(0,V.jsx)(wx,{size:14})}),(0,V.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,download:e.filename,title:Hi(),"aria-label":Hi(),children:(0,V.jsx)(Sx,{size:14})}),(0,V.jsx)(zd,{type:`button`,size:`icon-sm`,variant:`ghost`,onClick:t,"aria-label":ia(),children:(0,V.jsx)(Dd,{size:15})})]}),(0,V.jsx)(`div`,{className:`oc-docviewer__body`,children:n===`pdf`?(0,V.jsx)(v8,{url:e.url,filename:e.filename}):n===`image`?(0,V.jsx)(`div`,{className:`oc-docviewer__imagewrap`,children:(0,V.jsx)(`img`,{src:e.url,alt:e.filename,className:`oc-docviewer__image`})}):n===`video`?(0,V.jsx)(`video`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__video`}):n===`audio`?(0,V.jsx)(`div`,{className:`oc-docviewer__audiowrap`,children:(0,V.jsx)(`audio`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__audio`})}):n===`text`?(0,V.jsx)(S8,{url:e.url},e.url):n===`markdown`||n===`csv`||n===`log`||n===`json`?(0,V.jsx)(S8,{url:e.url,rich:n,csvDelimiter:n===`csv`?sge(e.mimeType,e.filename):void 0},e.url):r?(0,V.jsx)(hge,{sourceStorageId:e.sourceStorageId,downloadUrl:e.url,filename:e.filename}):(0,V.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,V.jsx)(`p`,{children:D()}),(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:Hi()})]})})]})}function hge({sourceStorageId:e,downloadUrl:t,filename:n}){let r=R(L.fileRenditions.getRendition,{sourceStorageId:e}),i=Se(L.fileRenditions.requestRendition),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{a.current=null},[e]),(0,B.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,V.jsx)(`div`,{className:`oc-docviewer__loading`,children:Sn()}):r.status===`ready`?(0,V.jsx)(v8,{url:r.pdfUrl,filename:r.filename}):r.status===`pending`?(0,V.jsxs)(`div`,{className:`oc-docviewer__preparing`,children:[(0,V.jsx)(`span`,{className:`oc-docviewer__spinner`,"aria-hidden":!0}),(0,V.jsx)(`p`,{children:Ys()}),(0,V.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:Hi()})]}):(0,V.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,V.jsx)(`p`,{children:r.status===`unconfigured`?D():Xn()}),(0,V.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:Hi()})]})}function gge(e){switch(e){case`markdown`:return ul();case`csv`:return Yt();case`log`:return lt();case`json`:return Mi()}}var x8=e=>`oc.docviewer.raw.${e}`;function S8({url:e,rich:t,csvDelimiter:n}){let[r,i]=(0,B.useState)({phase:`loading`}),[a,o]=(0,B.useState)(()=>t?localStorage.getItem(x8(t))===`1`:!1),s=e=>{o(e),t&&localStorage.setItem(x8(t),e?`1`:`0`)};if((0,B.useEffect)(()=>{let t=!1;return i({phase:`loading`}),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.blob(),a=r.size>h8,o=await(a?r.slice(0,h8):r).text();t||i({phase:`ready`,text:o,truncated:a})}catch(e){console.error(`[docviewer] text fetch failed:`,e?.message??e),t||i({phase:`error`})}})(),()=>{t=!0}},[e]),r.phase===`loading`)return(0,V.jsx)(`div`,{className:`oc-docviewer__loading`,children:Sn()});if(r.phase===`error`)return(0,V.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,V.jsx)(`p`,{children:Fs()}),(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:$e()})]});let c=t!==void 0&&!a,l=r.truncated?(0,V.jsx)(`p`,{className:`oc-docviewer__truncated`,children:ke()}):null,u=c&&t===`markdown`?(0,V.jsx)(`div`,{className:`oc-docviewer__mdwrap`,children:(0,V.jsx)(c6,{text:r.text})}):c&&t===`csv`?(0,V.jsx)(_ge,{text:r.text,textTruncated:r.truncated,delimiter:n}):c&&t===`log`?(0,V.jsx)(vge,{text:r.text,textTruncated:r.truncated}):c&&t===`json`?(0,V.jsx)(yge,{text:r.text}):(0,V.jsx)(`pre`,{className:`oc-docviewer__text`,children:r.text});return t===void 0?(0,V.jsxs)(`div`,{className:`oc-docviewer__textwrap`,children:[l,u]}):(0,V.jsxs)(`div`,{className:`oc-docviewer__textwrap oc-docviewer__textwrap--bar`,children:[(0,V.jsxs)(`div`,{className:`oc-docviewer__mdbar`,role:`group`,"aria-label":Xi(),children:[(0,V.jsx)(zd,{type:`button`,size:`sm`,variant:c?`secondary`:`ghost`,"aria-pressed":c,onClick:()=>s(!1),children:gge(t)}),(0,V.jsx)(zd,{type:`button`,size:`sm`,variant:a?`secondary`:`ghost`,"aria-pressed":a,onClick:()=>s(!0),children:Vt()})]}),(0,V.jsx)(`div`,{className:`oc-docviewer__textscroll`,children:(0,V.jsxs)(`div`,{className:`oc-docviewer__scrollpad`,children:[l,u]})})]})}function _ge({text:e,textTruncated:t,delimiter:n}){let r=(0,B.useMemo)(()=>lge(e,void 0,n),[e,n]),[i,a]=(0,B.useState)(null),o=(0,B.useMemo)(()=>i?[...r.rows].sort((e,t)=>uge(e[i.col]??``,t[i.col]??``)*i.dir):r.rows,[r.rows,i]);if(r.header.length===0)return(0,V.jsx)(`pre`,{className:`oc-docviewer__text`,children:e});let s=r.header.slice(0,100),c=r.header.length>s.length;return(0,V.jsxs)(`div`,{className:`oc-docviewer__csvwrap`,children:[r.truncatedRows?(0,V.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?_t({shown:r.rows.length}):hi({shown:r.rows.length,total:r.totalRows})}):null,c?(0,V.jsx)(`p`,{className:`oc-docviewer__truncated`,children:Ci({shown:s.length,total:r.header.length})}):null,(0,V.jsxs)(`table`,{className:`oc-docviewer__csv`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:s.map((e,t)=>(0,V.jsx)(`th`,{children:(0,V.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":F({column:e}),children:[e,i?.col===t?i.dir===1?` ▲`:` ▼`:``]})},t))})}),(0,V.jsx)(`tbody`,{children:o.map((e,t)=>(0,V.jsx)(`tr`,{children:s.map((t,n)=>(0,V.jsx)(`td`,{children:e[n]??``},n))},t))})]})]})}function vge({text:e,textTruncated:t}){let n=(0,B.useMemo)(()=>{let t=e.split(`
226
+ `&&!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??cge(r[s]),l=g8(r[s],c),u=r.slice(s+1);return{header:l,rows:u.slice(0,t).map(e=>g8(e,c)),totalRows:u.length,truncatedRows:u.length>t,delimiter:c}}function uge(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 dge(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 _8=60;function v8({url:e,filename:t}){let[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(1),[c,l]=(0,B.useState)(`fit`);if((0,B.useEffect)(()=>{let t=!1,n=null;return r(null),a(!1),s(1),(async()=>{try{let i=await k4(()=>import(`./pdf-C1wt9cpf.js`),[]);i.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-DEtVeC4l.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,V.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,V.jsx)(`p`,{children:Fs()}),(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:$e()})]});if(n===null)return(0,V.jsx)(`div`,{className:`oc-docviewer__loading`,children:Sn()});let u=n.numPages,d=m8(o,u);return(0,V.jsxs)(`div`,{className:`oc-docviewer__pdf`,children:[(0,V.jsxs)(`div`,{className:`oc-docviewer__toolbar`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>m8(e-1,u)),disabled:d<=1,"aria-label":si(),children:(0,V.jsx)(hx,{size:15})}),(0,V.jsxs)(`span`,{className:`oc-docviewer__pageinfo`,children:[d,` / `,u]}),(0,V.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>m8(e+1,u)),disabled:d>=u,"aria-label":Mu(),children:(0,V.jsx)(gx,{size:15})}),(0,V.jsx)(`select`,{className:`oc-docviewer__zoom`,value:String(c),onChange:e=>{let t=e.target.value;l(t===`fit`?`fit`:Number(t))},"aria-label":Fn(),children:ige.map(e=>(0,V.jsx)(`option`,{value:String(e),children:e===`fit`?lr():`${Math.round(e*100)}%`},String(e)))})]}),(0,V.jsxs)(`div`,{className:`oc-docviewer__pdfbody`,children:[u>1?(0,V.jsxs)(`div`,{className:`oc-docviewer__rail`,"aria-label":He(),children:[Array.from({length:Math.min(u,_8)},(e,t)=>(0,V.jsx)(pge,{doc:n,page:t+1,active:t+1===d,onClick:()=>s(t+1)},t+1)),u>_8?(0,V.jsxs)(`span`,{className:`oc-docviewer__railmore`,children:[`+`,u-_8]}):null]}):null,(0,V.jsx)(fge,{doc:n,page:d,zoom:c,filename:t})]})]})}function fge({doc:e,page:t,zoom:n,filename:r}){let i=(0,B.useRef)(null),a=(0,B.useRef)(null),[o,s]=(0,B.useState)(0);return(0,B.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,B.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,V.jsx)(`div`,{ref:i,className:`oc-docviewer__main`,children:(0,V.jsx)(`canvas`,{ref:a,className:`oc-docviewer__canvas`,"aria-label":r})})}function pge({doc:e,page:t,active:n,onClick:r}){let i=(0,B.useRef)(null);return(0,B.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,V.jsxs)(`button`,{type:`button`,className:`oc-docviewer__thumb${n?` is-active`:``}`,onClick:r,"aria-label":me({page:t}),"aria-current":n?`true`:void 0,children:[(0,V.jsx)(`canvas`,{ref:i,className:`oc-docviewer__thumbcanvas`}),(0,V.jsx)(`span`,{className:`oc-docviewer__thumbnum`,children:t})]})}var y8=(0,B.createContext)({activeDoc:null,openFor:()=>{},close:()=>{}});function mge(){return(0,B.useContext)(y8)}function b8({doc:e,onClose:t}){let n=p8(e.mimeType,e.filename),r=n===`none`&&e.sourceStorageId!==void 0;return(0,V.jsxs)(`div`,{className:`oc-docviewer`,children:[(0,V.jsxs)(`header`,{className:`oc-docviewer__header`,children:[(0,V.jsx)(Ex,{size:15,"aria-hidden":!0,className:`oc-docviewer__icon`}),(0,V.jsx)(`span`,{className:`oc-docviewer__name`,title:e.filename,children:e.filename}),(0,V.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,title:$e(),"aria-label":$e(),children:(0,V.jsx)(wx,{size:14})}),(0,V.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,download:e.filename,title:Hi(),"aria-label":Hi(),children:(0,V.jsx)(Sx,{size:14})}),(0,V.jsx)(zd,{type:`button`,size:`icon-sm`,variant:`ghost`,onClick:t,"aria-label":ia(),children:(0,V.jsx)(Dd,{size:15})})]}),(0,V.jsx)(`div`,{className:`oc-docviewer__body`,children:n===`pdf`?(0,V.jsx)(v8,{url:e.url,filename:e.filename}):n===`image`?(0,V.jsx)(`div`,{className:`oc-docviewer__imagewrap`,children:(0,V.jsx)(`img`,{src:e.url,alt:e.filename,className:`oc-docviewer__image`})}):n===`video`?(0,V.jsx)(`video`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__video`}):n===`audio`?(0,V.jsx)(`div`,{className:`oc-docviewer__audiowrap`,children:(0,V.jsx)(`audio`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__audio`})}):n===`text`?(0,V.jsx)(S8,{url:e.url},e.url):n===`markdown`||n===`csv`||n===`log`||n===`json`?(0,V.jsx)(S8,{url:e.url,rich:n,csvDelimiter:n===`csv`?sge(e.mimeType,e.filename):void 0},e.url):r?(0,V.jsx)(hge,{sourceStorageId:e.sourceStorageId,downloadUrl:e.url,filename:e.filename}):(0,V.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,V.jsx)(`p`,{children:D()}),(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:Hi()})]})})]})}function hge({sourceStorageId:e,downloadUrl:t,filename:n}){let r=R(L.fileRenditions.getRendition,{sourceStorageId:e}),i=Se(L.fileRenditions.requestRendition),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{a.current=null},[e]),(0,B.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,V.jsx)(`div`,{className:`oc-docviewer__loading`,children:Sn()}):r.status===`ready`?(0,V.jsx)(v8,{url:r.pdfUrl,filename:r.filename}):r.status===`pending`?(0,V.jsxs)(`div`,{className:`oc-docviewer__preparing`,children:[(0,V.jsx)(`span`,{className:`oc-docviewer__spinner`,"aria-hidden":!0}),(0,V.jsx)(`p`,{children:Ys()}),(0,V.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:Hi()})]}):(0,V.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,V.jsx)(`p`,{children:r.status===`unconfigured`?D():Xn()}),(0,V.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:Hi()})]})}function gge(e){switch(e){case`markdown`:return ul();case`csv`:return Yt();case`log`:return lt();case`json`:return Mi()}}var x8=e=>`oc.docviewer.raw.${e}`;function S8({url:e,rich:t,csvDelimiter:n}){let[r,i]=(0,B.useState)({phase:`loading`}),[a,o]=(0,B.useState)(()=>t?localStorage.getItem(x8(t))===`1`:!1),s=e=>{o(e),t&&localStorage.setItem(x8(t),e?`1`:`0`)};if((0,B.useEffect)(()=>{let t=!1;return i({phase:`loading`}),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.blob(),a=r.size>h8,o=await(a?r.slice(0,h8):r).text();t||i({phase:`ready`,text:o,truncated:a})}catch(e){console.error(`[docviewer] text fetch failed:`,e?.message??e),t||i({phase:`error`})}})(),()=>{t=!0}},[e]),r.phase===`loading`)return(0,V.jsx)(`div`,{className:`oc-docviewer__loading`,children:Sn()});if(r.phase===`error`)return(0,V.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,V.jsx)(`p`,{children:Fs()}),(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:$e()})]});let c=t!==void 0&&!a,l=r.truncated?(0,V.jsx)(`p`,{className:`oc-docviewer__truncated`,children:ke()}):null,u=c&&t===`markdown`?(0,V.jsx)(`div`,{className:`oc-docviewer__mdwrap`,children:(0,V.jsx)(c6,{text:r.text})}):c&&t===`csv`?(0,V.jsx)(_ge,{text:r.text,textTruncated:r.truncated,delimiter:n}):c&&t===`log`?(0,V.jsx)(vge,{text:r.text,textTruncated:r.truncated}):c&&t===`json`?(0,V.jsx)(yge,{text:r.text}):(0,V.jsx)(`pre`,{className:`oc-docviewer__text`,children:r.text});return t===void 0?(0,V.jsxs)(`div`,{className:`oc-docviewer__textwrap`,children:[l,u]}):(0,V.jsxs)(`div`,{className:`oc-docviewer__textwrap oc-docviewer__textwrap--bar`,children:[(0,V.jsxs)(`div`,{className:`oc-docviewer__mdbar`,role:`group`,"aria-label":Xi(),children:[(0,V.jsx)(zd,{type:`button`,size:`sm`,variant:c?`secondary`:`ghost`,"aria-pressed":c,onClick:()=>s(!1),children:gge(t)}),(0,V.jsx)(zd,{type:`button`,size:`sm`,variant:a?`secondary`:`ghost`,"aria-pressed":a,onClick:()=>s(!0),children:Vt()})]}),(0,V.jsx)(`div`,{className:`oc-docviewer__textscroll`,children:(0,V.jsxs)(`div`,{className:`oc-docviewer__scrollpad`,children:[l,u]})})]})}function _ge({text:e,textTruncated:t,delimiter:n}){let r=(0,B.useMemo)(()=>lge(e,void 0,n),[e,n]),[i,a]=(0,B.useState)(null),o=(0,B.useMemo)(()=>i?[...r.rows].sort((e,t)=>uge(e[i.col]??``,t[i.col]??``)*i.dir):r.rows,[r.rows,i]);if(r.header.length===0)return(0,V.jsx)(`pre`,{className:`oc-docviewer__text`,children:e});let s=r.header.slice(0,100),c=r.header.length>s.length;return(0,V.jsxs)(`div`,{className:`oc-docviewer__csvwrap`,children:[r.truncatedRows?(0,V.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?_t({shown:r.rows.length}):hi({shown:r.rows.length,total:r.totalRows})}):null,c?(0,V.jsx)(`p`,{className:`oc-docviewer__truncated`,children:Ci({shown:s.length,total:r.header.length})}):null,(0,V.jsxs)(`table`,{className:`oc-docviewer__csv`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:s.map((e,t)=>(0,V.jsx)(`th`,{children:(0,V.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":F({column:e}),children:[e,i?.col===t?i.dir===1?` ▲`:` ▼`:``]})},t))})}),(0,V.jsx)(`tbody`,{children:o.map((e,t)=>(0,V.jsx)(`tr`,{children:s.map((t,n)=>(0,V.jsx)(`td`,{children:e[n]??``},n))},t))})]})]})}function vge({text:e,textTruncated:t}){let n=(0,B.useMemo)(()=>{let t=e.split(`
227
227
  `);return t.length>1&&t[t.length-1]===``&&t.pop(),t},[e]),r=(0,B.useMemo)(()=>n.slice(0,oge),[n]);return(0,V.jsxs)(V.Fragment,{children:[n.length>r.length?(0,V.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?Ar({shown:r.length}):gd({shown:r.length,total:n.length})}):null,(0,V.jsx)(`pre`,{className:`oc-docviewer__text oc-docviewer__logview`,children:r.map((e,t)=>(0,V.jsxs)(`span`,{className:`oc-logline oc-logline--${dge(e)}`,children:[e,`
228
228
  `]},t))})]})}function yge({text:e}){let t=(0,B.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,V.jsx)(`div`,{className:`oc-docviewer__jsonwrap`,children:(0,V.jsx)(C8,{value:t.value,depth:0})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`oc-docviewer__truncated`,children:cn()}),(0,V.jsx)(`pre`,{className:`oc-docviewer__text`,children:e})]})}function bge(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 xge(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 C8({value:e,depth:t,name:n}){let r=typeof e==`object`&&!!e,i=r?bge(e):0,[a,o]=(0,B.useState)(t<2&&i<=100),s=n===void 0?null:(0,V.jsxs)(`span`,{className:`oc-json__key`,children:[n,`: `]});if(!r)return(0,V.jsxs)(`div`,{className:`oc-json__leaf`,children:[s,(0,V.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?xge(e,500):[];return(0,V.jsxs)(`details`,{className:`oc-json__node`,open:a,onToggle:e=>o(e.target.open),children:[(0,V.jsxs)(`summary`,{children:[s,(0,V.jsx)(`span`,{className:`oc-json__summary`,children:Array.isArray(e)?`[${i}]`:`{${i}}`})]}),a?(0,V.jsxs)(`div`,{className:`oc-json__children`,children:[c.map(([e,n])=>(0,V.jsx)(C8,{name:e,value:n,depth:t+1},e)),i>c.length?(0,V.jsx)(`div`,{className:`oc-json__more`,children:At({count:i-c.length})}):null]}):null]})}function Sge({mimeType:e,data:t,filename:n,storageId:r}){let i=e??``,a=t??``,o=n??`attachment`;return a?i.startsWith(`audio/`)?(0,V.jsxs)(`div`,{className:`oc-media oc-media--audio`,children:[(0,V.jsx)(`audio`,{controls:!0,preload:`metadata`,src:a,className:`oc-media__audio`,children:(0,V.jsx)(`a`,{href:a,download:o,children:h()})}),(0,V.jsx)(`span`,{className:`oc-media__name`,children:o})]}):i.startsWith(`image/`)?(0,V.jsx)(wge,{url:a,name:o}):i.startsWith(`video/`)?(0,V.jsxs)(`div`,{className:`oc-media oc-media--video`,children:[(0,V.jsx)(`video`,{controls:!0,preload:`metadata`,src:a,className:`oc-media__video`}),(0,V.jsx)(`span`,{className:`oc-media__name`,children:o})]}):(0,V.jsx)(Cge,{url:a,name:o,mime:i,storageId:r}):null}function Cge({url:e,name:t,mime:n,storageId:r}){let i=mge(),a=p8(n,t)!==`none`,o=!!r&&rge(n,t),s=a||o,c=n=>{n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.button!==0||(n.preventDefault(),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=URL.createObjectURL(await n.blob()),i=document.createElement(`a`);i.href=r,i.download=t,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}catch{let t=window.open(``,`_blank`);t?(t.opener=null,t.location.href=e):window.location.href=e}})())};return(0,V.jsxs)(`span`,{className:`oc-media oc-media--file oc-filechip`,title:t,children:[(0,V.jsxs)(`a`,{className:`oc-filechip__main`,href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:c,"aria-label":sl({name:t}),children:[(0,V.jsx)(`span`,{className:`oc-media__icon`,"aria-hidden":!0,children:`📄`}),(0,V.jsx)(`span`,{className:`oc-media__name`,children:t})]}),(0,V.jsx)(`a`,{className:`oc-filechip__btn`,href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:c,title:sl({name:t}),"aria-label":sl({name:t}),children:(0,V.jsx)(Sx,{size:14,"aria-hidden":!0})}),s?(0,V.jsx)(`button`,{type:`button`,className:`oc-filechip__btn`,onClick:()=>i.openFor({url:e,filename:t,mimeType:n||null,sourceStorageId:o?r:void 0}),title:br({name:t}),"aria-label":br({name:t}),children:(0,V.jsx)($te,{size:14,"aria-hidden":!0})}):null]})}function wge({url:e,name:t}){let{open:n}=Rhe();return(0,V.jsx)(`button`,{type:`button`,className:`oc-media oc-media--thumb`,onClick:()=>n({url:e,name:t}),title:t,"aria-label":t,children:(0,V.jsx)(`img`,{src:e,alt:t,className:`oc-media__thumbimg`,loading:`lazy`,decoding:`async`})})}var w8=1e3;function Tge(){return[{id:`incorrect`,label:xt()},{id:`incoherence`,label:Di()},{id:`altered_words`,label:ie()},{id:`formatting`,label:bd()},{id:`latency`,label:Fr()},{id:`api_error`,label:pn()},{id:`other`,label:Ft()}]}function Ege(){return[{id:`altered_words`,label:rt()},{id:`formatting`,label:pr()},{id:`other`,label:Ft()}]}function Dge(e){return e===`user`?Ege():Tge()}var Oge=[{name:`Grammarly`,selector:`grammarly-desktop-integration, grammarly-extension, [data-grammarly-shadow-root]`},{name:`LanguageTool`,selector:`[data-lt-installed], .lt-toolbar`},{name:`DeepL`,selector:`deepl-inline-translate, .deepl-translator`},{name:`ProWritingAad`,selector:`pwa-shadow-host, .pwa-tag`}];function kge(){let e=[];try{e=Array.from(navigator.plugins??[]).map(e=>e.name).slice(0,40)}catch{e=[]}let t=[];for(let{name:e,selector:n}of Oge)try{document.querySelector(n)&&t.push(e)}catch{}return{plugins:e,extensionsDetected:t}}var T8=B.createContext(null);function Age(){let e=B.useContext(T8);if(!e)throw Error(`useFeedback must be used within <FeedbackProvider>`);return e}function jge({children:e}){let t=Se(L.feedback.submitFeedback),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)(!1),g=B.useCallback(e=>{a(``),s(``),l(!1),d(null),p(null),h(!1),r(e)},[]);function _(e){e||r(null)}async function v(){if(!(!n||!i||c)){l(!0);try{let e=await t({chatId:n.chatId,messageId:n.messageId,category:i,comment:o.trim()||void 0,client:{displayedText:n.displayedText,sourceWasOpen:n.sourceWasOpen,userAgent:navigator.userAgent,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,theme:document.documentElement.classList.contains(`dark`)?`dark`:`light`,...kge()}});d(e.displayedMatchesStored),p(String(e.reference??e.feedbackId))}catch{l(!1)}}}let y=u!==null,b=n?.role===`user`;return(0,V.jsxs)(T8.Provider,{value:g,children:[e,(0,V.jsx)(nB,{open:n!==null,onOpenChange:_,children:n?(0,V.jsxs)(aB,{className:`sm:max-w-md`,children:[(0,V.jsxs)(oB,{children:[(0,V.jsx)(cB,{children:zn()}),(0,V.jsx)(lB,{children:y?Tn():b?Rs():k()})]}),y?(0,V.jsxs)(`div`,{className:`oc-feedback__result`,role:`status`,children:[n.sourceWasOpen?u===!0?(0,V.jsx)(`p`,{className:`oc-feedback__fidelity is-ok`,children:Zs()}):(0,V.jsx)(`p`,{className:`oc-feedback__fidelity is-warn`,children:Qn()}):(0,V.jsx)(`p`,{className:`oc-feedback__fidelity`,children:je()}),f?(0,V.jsxs)(`div`,{className:`oc-feedback__ref`,children:[(0,V.jsx)(`span`,{className:`oc-feedback__ref-label`,children:gc()}),(0,V.jsx)(`code`,{className:`oc-feedback__ref-id`,title:f,children:f}),(0,V.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:$c(),"aria-label":$c(),onClick:()=>{navigator.clipboard.writeText(f).then(()=>{h(!0),window.setTimeout(()=>h(!1),1500)})},children:m?(0,V.jsx)(xd,{size:14}):(0,V.jsx)(xx,{size:14})})]}):null]}):(0,V.jsxs)(`div`,{className:`oc-feedback__form`,children:[(0,V.jsx)(`label`,{className:`oc-feedback__label`,children:We()}),(0,V.jsxs)(l6,{value:i,onValueChange:a,children:[(0,V.jsx)(d6,{children:(0,V.jsx)(u6,{placeholder:li()})}),(0,V.jsx)(f6,{children:Dge(n.role).map(e=>(0,V.jsx)(p6,{value:e.id,children:e.label},e.id))})]}),(0,V.jsx)(`label`,{className:`oc-feedback__label`,htmlFor:`oc-feedback-comment`,children:Pu()}),(0,V.jsx)(`textarea`,{id:`oc-feedback-comment`,className:`oc-feedback__textarea`,placeholder:ve(),value:o,maxLength:w8,onChange:e=>s(e.target.value.slice(0,w8)),rows:4}),(0,V.jsxs)(`div`,{className:`oc-feedback__count`,children:[o.length,`/`,w8]})]}),(0,V.jsx)(sB,{children:y?(0,V.jsx)(zd,{onClick:()=>_(!1),children:Yr()}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(zd,{variant:`outline`,onClick:()=>_(!1),children:Ju()}),(0,V.jsx)(zd,{onClick:()=>void v(),disabled:!i||c,children:c?Ka():cd()})]})})]}):null})]})}function Mge(e,t){let n=e.closest(`.oc-msg`)?.querySelector(`.oc-msg__source-pre`),r=n?.textContent;return n&&r!=null&&r!==`(aucun texte)`?{displayedText:r,sourceWasOpen:!0}:{displayedText:t,sourceWasOpen:!1}}function E8(){let e=Age(),t=zO(e=>e.metadata?.custom?.messageId),n=zO(e=>e.metadata?.custom?.chatId),r=zO(e=>e.role),i=zO(e=>e.metadata?.custom?.rawText??``),a=R(L.feedback.myReportedMessageIds,n?{chatId:n}:`skip`);if(!t||!n)return null;let o=(a??[]).includes(t);function s(a){e({chatId:n,messageId:t,role:r,...Mge(a.currentTarget,i)})}return(0,V.jsx)(`button`,{type:`button`,className:`oc-iconbtn${o?` is-on`:``}`,title:o?xu():ya(),"aria-label":ts(),onClick:s,children:(0,V.jsx)(Dx,{size:15,"aria-hidden":!0})})}function D8(e,t){return e!=null&&e[t]!==void 0}var Nge=[`inherit`,`fast`,`standard`];function Pge(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function Fge(e){return e===`inherit`?T():e===`fast`?qs():Jn()}function Ige(e){return e===`inherit`?null:e===`fast`}function O8(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function k8(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var Lge={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function Rge(e,t){return Lge[e]??t}function A8(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function zge(e,t){let n=A8(e,t);return n===null?null:ma({pct:n,used:O8(e),total:O8(t)})}function Bge(e){return cs({level:e??`full`})}function Vge(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?Lo({cost:e.toFixed(2),tokens:O8(t)}):n?fo({cost:e.toFixed(2)}):r?ru({tokens:O8(t)}):null}function Hge(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function Uge(e){let t=Se(L.chats.setSessionKnob),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(null);return{apply:(0,B.useCallback)(async(n,i)=>{r(n),a(null);let o={chatId:e};n===`fastMode`?o.fastMode=i:o[n]=i;try{await t(o)}catch{a({field:n,value:i})}finally{r(null)}},[e,t]),pending:n,error:i}}function j8({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0}){return(0,V.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,V.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,V.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,V.jsx)(jx,{size:13,className:`oc-spanel__spin`,"aria-label":Ze()}):t?c?(0,V.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:Ot(),"aria-label":Ot(),onClick:n,children:(0,V.jsx)(Bx,{size:12,"aria-hidden":!0})}):null:(0,V.jsx)(`span`,{className:`oc-spanel__badge`,children:on()})]}),(0,V.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,V.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,V.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[sr(),(0,V.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:Nn()})]}):null]})}function M8({options:e,value:t,onChange:n,disabled:r}){return(0,V.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,children:e.map(e=>(0,V.jsx)(`button`,{type:`button`,className:`oc-spanel__seg-btn${t===e.id?` is-active`:``}`,"aria-pressed":t===e.id,title:e.title??e.label,"aria-label":e.title??e.label,disabled:r,onClick:()=>{e.id!==t&&n(e.id)},children:e.label},e.id))})}function Wge({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,V.jsxs)(`select`,{className:`oc-spanel__select`,value:t??``,disabled:r,"aria-label":i,onChange:e=>{e.target.value&&e.target.value!==t&&n(e.target.value)},children:[t===null?(0,V.jsx)(`option`,{value:``,disabled:!0,hidden:!0}):null,a?null:(0,V.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function N8({chatId:e,sm:t,settings:n}){let{apply:r,pending:i,error:a}=Uge(e),{can:o}=E6(e),s=i!==null,c=(0,B.useCallback)(()=>{a&&r(a.field,a.value)},[r,a]),l=t.thinkingLevels??[],u=t.availableModels??[],d=Pge(n),f=Dhe(o,{hasModels:u.length>0,hasLevels:l.length>0});return(0,V.jsxs)(V.Fragment,{children:[f.model?(0,V.jsx)(j8,{label:Lu(),overridden:D8(n,`model`),onReset:()=>void r(`model`,null),pending:i===`model`,error:a?.field===`model`,onRetry:c,resettable:f.reset,children:u.length<=4?(0,V.jsx)(M8,{options:u,value:t.model??null,onChange:e=>void r(`model`,e),disabled:s}):(0,V.jsx)(Wge,{options:u,value:t.model??null,onChange:e=>void r(`model`,e),disabled:s,ariaLabel:Lu()})}):null,f.thinking?(0,V.jsx)(j8,{label:bn(),overridden:D8(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:i===`thinkingLevel`,error:a?.field===`thinkingLevel`,onRetry:c,resettable:f.reset,children:(0,V.jsx)(M8,{options:l.map(e=>({id:e.id,label:Rge(e.id,k8(e.label)),title:k8(e.label)})),value:t.thinkingLevel??null,onChange:e=>void r(`thinkingLevel`,e),disabled:s})}):null,f.speed?(0,V.jsx)(j8,{label:Ns(),overridden:D8(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:i===`fastMode`,error:a?.field===`fastMode`,onRetry:c,resettable:f.reset,children:(0,V.jsx)(M8,{options:Nge.map(e=>({id:e,label:Fge(e)})),value:d,onChange:e=>void r(`fastMode`,Ige(e)),disabled:s})}):null]})}function P8(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function F8({label:e,state:t,destructive:n,onClick:r,onRetry:i}){return(0,V.jsxs)(`div`,{className:`oc-spanel__action`,children:[(0,V.jsxs)(zd,{variant:n?`destructive`:`outline`,size:`sm`,disabled:t===`pending`,onClick:r,children:[t===`pending`?(0,V.jsx)(jx,{className:`oc-spanel__spin`,"aria-hidden":!0}):null,e]}),t===`done`?(0,V.jsx)(`p`,{className:`oc-spanel__action-note`,role:`status`,children:Kl()}):null,t===`error`?(0,V.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[To(),(0,V.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:i,children:Nn()})]}):null]})}function Gge({chatId:e,open:t,onOpenChange:n}){let r=R(L.messages.getSessionMeta,t?{chatId:e}:`skip`),i=R(L.chatSummaries.getChatSummary,t?{chatId:e}:`skip`),a=R(L.agents.getChatAgent,t?{chatId:e}:`skip`),o=r?.sessionMeta??null,s=r?.sessionSettings??null,{can:c}=E6(t?e:null),l=sV(),u=ei(L.agentFiles.compactSession),d=Se(L.chats.resetSession),f=Se(L.chatSummaries.requestSummarize),[p,h]=(0,B.useState)(`idle`),[g,_]=(0,B.useState)(`idle`),[v,y]=(0,B.useState)(`idle`),[b,x]=(0,B.useState)(null),[S,C]=(0,B.useState)(!1),[T,E]=(0,B.useState)(!1),[D,O]=(0,B.useState)(null),[k,A]=(0,B.useState)(`idle`),j=Se(L.chatSummaries.updateSummary);(0,B.useEffect)(()=>{O(null),A(`idle`),E(!1),C(!1),x(null),y(`idle`)},[e]);async function M(){if(i?.summary)try{await navigator.clipboard.writeText(i.summary),C(!0),window.setTimeout(()=>C(!1),2e3)}catch{}}async function N(){if(!(D===null||D.trim().length===0)){A(`saving`);try{await j({chatId:e,summary:D}),O(null),A(`idle`)}catch{A(`error`)}}}let[ee,P]=(0,B.useState)(()=>Date.now()),F=i?.jobInFlight===!0;(0,B.useEffect)(()=>{if(!F)return;let e=window.setInterval(()=>P(Date.now()),1e3);return()=>window.clearInterval(e)},[F]);async function te(){h(`pending`);try{await u({chatId:e}),h(`done`)}catch{h(`error`)}}async function ne(){y(`pending`),x(null);try{let{outcome:t}=await f({chatId:e});x(({dispatched:Tc,in_flight:Ul,nothing_to_do:So,scanning:an,bridge_outdated:qn,engine_off:m,no_agent:yr,backoff:So}[t]??So)()),y(t===`dispatched`||t===`scanning`?`done`:`idle`)}catch{y(`error`)}}async function re(){_(`pending`);try{await d({chatId:e}),_(`done`)}catch{_(`error`)}}async function ie(){await l({title:Qa(),description:Ml(),confirmLabel:Bc(),cancelLabel:Vl()})&&await te()}async function ae(){await l({title:bs(),description:yl(),confirmLabel:Dc(),cancelLabel:Vl(),destructive:!0})&&await re()}let oe=A8(o?.totalTokens,o?.contextTokens),se=oe==null?``:oe>=90?`is-critical`:oe>=75?`is-warn`:`is-ok`,ce=zge(o?.totalTokens,o?.contextTokens),le=Vge(o?.estimatedCostUsd,o?.totalTokens),ue=a?.agent??null,de=Hge([ue?ue.displayName??ue.agentId:null,o?.agentRuntime,o?.model]);return(0,V.jsx)(o8,{open:t,onOpenChange:n,children:(0,V.jsxs)(s8,{side:`right`,className:`oc-spanel`,children:[(0,V.jsxs)(c8,{children:[(0,V.jsx)(u8,{children:Be()}),(0,V.jsx)(d8,{children:ai()})]}),(0,V.jsx)(`div`,{className:`oc-spanel__body`,children:r===void 0?(0,V.jsx)(`p`,{className:`oc-spanel__loading`,children:$u()}):(0,V.jsxs)(V.Fragment,{children:[o?(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`oc-spanel__cat`,children:Au()}),(0,V.jsx)(N8,{chatId:e,sm:o,settings:s})]}):null,(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`oc-spanel__cat`,children:fe()}),ce!==null&&oe!==null?(0,V.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,V.jsx)(`span`,{className:`oc-spanel__label`,children:gu()}),(0,V.jsxs)(`span`,{className:`oc-meter oc-spanel__meter ${se}`,children:[(0,V.jsx)(`span`,{className:`oc-meter__track`,children:(0,V.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(oe,100)}%`}})}),(0,V.jsx)(`span`,{className:`oc-meter__label`,children:ce})]})]}):null,(0,V.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,V.jsx)(`span`,{className:`oc-spanel__label`,children:Xo()}),(0,V.jsx)(`span`,{className:`oc-spanel__value`,children:Bge(o?.verboseLevel)}),(0,V.jsx)(`p`,{className:`oc-spanel__help`,children:_c()})]}),le===null?null:(0,V.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,V.jsx)(`span`,{className:`oc-spanel__label`,children:el()}),(0,V.jsx)(`span`,{className:`oc-spanel__value`,children:le})]})]}),de!==null||o?(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`oc-spanel__cat`,children:Va()}),(0,V.jsxs)(`dl`,{className:`oc-spanel__kv`,children:[ue?(0,V.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,V.jsx)(`dt`,{children:Rl()}),(0,V.jsxs)(`dd`,{children:[ue.emoji?`${ue.emoji} `:``,ue.displayName??ue.agentId]})]}):null,ue?.instanceName?(0,V.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,V.jsx)(`dt`,{children:Wr()}),(0,V.jsx)(`dd`,{children:ue.instanceName})]}):null,o?.model?(0,V.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,V.jsx)(`dt`,{children:Ue()}),(0,V.jsx)(`dd`,{children:o.model})]}):null,o?.modelProvider?(0,V.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,V.jsx)(`dt`,{children:ci()}),(0,V.jsx)(`dd`,{children:o.modelProvider})]}):null,o?.agentRuntime?(0,V.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,V.jsx)(`dt`,{children:uc()}),(0,V.jsx)(`dd`,{children:o.agentRuntime})]}):null,o?.thinkingLevel?(0,V.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,V.jsx)(`dt`,{children:Nu()}),(0,V.jsx)(`dd`,{children:o.thinkingLevel})]}):null,o?.thinkingDefault?(0,V.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,V.jsx)(`dt`,{children:Uu()}),(0,V.jsx)(`dd`,{children:o.thinkingDefault})]}):null]})]}):null,(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`oc-spanel__cat`,children:Al()}),i?(0,V.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,V.jsx)(`span`,{className:`oc-spanel__label`,children:Vi()}),(0,V.jsxs)(`span`,{className:`oc-meter oc-spanel__meter is-ok`,children:[(0,V.jsx)(`span`,{className:`oc-meter__track`,children:(0,V.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(i.pendingChars/Math.max(i.thresholdChars,1)*100,100)}%`}})}),(0,V.jsx)(`span`,{className:`oc-meter__label`,children:Yi({pending:`${P8(i.pendingChars)}${i.pendingApprox?`+`:``}`,threshold:P8(i.thresholdChars)})})]})]}):null,i&&!i.jobInFlight&&i.pendingChars>=i.thresholdChars?(0,V.jsx)(`p`,{className:`oc-spanel__hint`,children:Bt()}):null,i?.jobInFlight?(0,V.jsxs)(`p`,{className:`oc-spanel__hint oc-spanel__job`,role:`status`,children:[(0,V.jsx)(jx,{size:13,className:`oc-spanel__job-spin`,"aria-hidden":!0}),i.jobStreaming?Xe():Dt(),i.jobStartedAt?` · ${Math.max(0,Math.round((ee-i.jobStartedAt)/1e3))} s`:``]}):null,i&&i.summary.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`oc-spanel__hint`,children:[Lc({count:String(i.coveredCount),date:VB(i.updatedAt,{dateStyle:`short`,timeStyle:`short`})}),i.lastAgentId?` ${ra({agent:i.lastInstanceName?`${i.lastAgentId} (${i.lastInstanceName})`:i.lastAgentId})}`:``]}),i.failureCount>0?(0,V.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:Ta({count:String(i.failureCount)})}):null,(0,V.jsxs)(`div`,{className:`oc-spanel__summary-tools`,children:[(0,V.jsx)(zd,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>void M(),title:or(),"aria-label":or(),children:S?(0,V.jsx)(xd,{size:14,"aria-hidden":!0}):(0,V.jsx)(xx,{size:14,"aria-hidden":!0})}),(0,V.jsx)(zd,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>E(!0),title:Mn(),"aria-label":Mn(),children:(0,V.jsx)(Px,{size:14,"aria-hidden":!0})}),i.jobInFlight?null:(0,V.jsx)(zd,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>{O(i.summary),E(!0)},title:yn(),"aria-label":yn(),children:(0,V.jsx)(Rx,{size:14,"aria-hidden":!0})})]}),(0,V.jsx)(`div`,{className:`oc-spanel__summary`,children:i.summary})]}):i&&i.failureCount>0?(0,V.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:Ta({count:String(i.failureCount)})}):i?.jobInFlight?null:(0,V.jsx)(`p`,{className:`oc-spanel__hint`,children:_s()})]})]})}),(0,V.jsx)(nB,{open:T,onOpenChange:e=>{E(e),e||(O(null),A(`idle`))},children:(0,V.jsxs)(aB,{className:`oc-summary-dialog`,children:[(0,V.jsxs)(oB,{children:[(0,V.jsx)(cB,{children:Al()}),(0,V.jsx)(lB,{children:D===null?i&&i.summary.length>0?Lc({count:String(i.coveredCount),date:VB(i.updatedAt,{dateStyle:`short`,timeStyle:`short`})}):``:Ks()})]}),D===null?(0,V.jsx)(`div`,{className:`oc-summary-dialog__body`,children:i?.summary??``}):(0,V.jsx)(`textarea`,{className:`oc-summary-dialog__body oc-summary-dialog__edit`,value:D,onChange:e=>O(e.target.value)}),k===`error`?(0,V.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:w()}):null,(0,V.jsx)(`div`,{className:`oc-summary-dialog__actions`,children:D===null?(0,V.jsxs)(V.Fragment,{children:[i&&i.summary.length>0&&!i.jobInFlight?(0,V.jsxs)(zd,{variant:`outline`,size:`sm`,onClick:()=>O(i.summary),children:[(0,V.jsx)(Rx,{size:14,"aria-hidden":!0}),yn()]}):null,(0,V.jsxs)(zd,{variant:`outline`,size:`sm`,onClick:()=>void M(),children:[S?(0,V.jsx)(xd,{size:14,"aria-hidden":!0}):(0,V.jsx)(xx,{size:14,"aria-hidden":!0}),or()]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(zd,{variant:`ghost`,size:`sm`,onClick:()=>{O(null),A(`idle`)},children:Vl()}),(0,V.jsx)(zd,{size:`sm`,disabled:D.trim().length===0||k===`saving`,onClick:()=>void N(),children:k===`saving`?Ze():Ms()})]})})]})}),(0,V.jsxs)(l8,{className:`oc-spanel__actions`,children:[(0,V.jsx)(`h3`,{className:`oc-spanel__cat`,children:rd()}),c(`sessionCompact`)?(0,V.jsx)(F8,{label:ic(),state:p,onClick:()=>void ie(),onRetry:()=>void te()}):null,(0,V.jsx)(F8,{label:_l(),state:F?`pending`:v,onClick:()=>void ne(),onRetry:()=>void ne()}),b===null?null:(0,V.jsx)(`p`,{className:`oc-spanel__hint`,children:b}),(0,V.jsx)(F8,{label:Da(),state:g,destructive:!0,onClick:()=>void ae(),onRetry:()=>void re()})]})]})})}var I8={showSource:!0,showReport:!0,copyAssistant:!0,copyUser:!0,showDelete:!0,showTools:!1,voiceInput:!1,showUsage:!0,autoReadAloud:!0},L8=(0,B.createContext)({enabled:!1,lang:`auto`,rate:1,autoRead:!1,engine:`browser`,loaded:!1}),R8=(0,B.createContext)({active:null,setActive:()=>{},clearIf:()=>{}}),z8=0;function B8(){z8++,wV(),AV()}var V8=(0,B.createContext)(I8);function H8(){return(0,B.useContext)(V8)}var U8=(0,B.createContext)(null),W8=(0,B.createContext)(null),G8=(0,B.createContext)(null),K8=(0,B.createContext)(null);function q8(){return(0,B.useContext)(K8)}function J8({className:e}){let t=$z();return(0,V.jsx)(`div`,{className:e,"aria-hidden":!0,children:t.logoUrl?t.logoMasked?(0,V.jsx)(`span`,{className:`oc-avatar__img oc-avatar__img--mask`,style:{"--oc-logo-url":`url("${t.logoUrl}")`}}):(0,V.jsx)(`img`,{className:`oc-avatar__img`,src:t.logoUrl,alt:``}):t.isDefault?(0,V.jsx)(Zz,{className:`oc-avatar__mark`}):t.initials})}function Y8({chatId:e,focusMessageId:t}){let{runtime:n,turnGate:r,queueSend:i,abortTurn:a,routing:o,lastUserTurnQueued:s,initialLoading:c}=CH({chatId:e}),l=R(L.me.getMe,{host:bz}),u=l?.ui?.effective??I8,d=u.showTools,f=Rz(l?.resolvedThemeMode),p=l?.resolvedChartBrand,m=l?.resolvedChartTokens,h=R(L.agents.getChatAgent,e?{chatId:e}:`skip`),g=h?.multiAgent?h.agent:null,_=(0,B.useMemo)(()=>{let e=p?.label??`Atrium`,t=m?.colors?.[f],n=Kz(p,Yz(t?.primary,t?.[`primary-foreground`],f));return{label:e,logoUrl:n?.url??null,logoMasked:n?.masked??!1,isDefault:p?.isDefault??!0,initials:Xz(e),agentName:g?.displayName??g?.agentId??null,agentEmoji:g?.emoji??null}},[p,f,m,g]),v=Se(L.me.setUiPref).withOptimisticUpdate(wH),y=R(L.messages.getSessionMeta,e?{chatId:e}:`skip`),b=e!==null&&y===null,x=r8(),{width:S,startResize:C}=i8({storageKey:`oc.sources.width`,defaultWidth:380,min:300,max:680,edge:`right`}),[w,T]=(0,B.useState)(null);(0,B.useEffect)(()=>{T(null)},[e]);let{width:E,startResize:D}=i8({storageKey:`oc.subagent.width`,defaultWidth:460,min:320,max:720,edge:`right`}),[O,k]=(0,B.useState)(null);(0,B.useEffect)(()=>{k(null)},[e]);let{width:A,startResize:j}=i8({storageKey:`oc.docviewer.width`,defaultWidth:560,min:380,max:1800,maxViewportFraction:.72,edge:`right`}),[M,N]=(0,B.useState)(null);(0,B.useEffect)(()=>{N(null)},[e]);let ee=(0,B.useMemo)(()=>({activeMessageId:w,openFor:e=>{T(e),k(null),N(null)},close:()=>T(null)}),[w]),P=(0,B.useMemo)(()=>({activeChildKey:O,openFor:e=>{k(e),T(null),N(null)},close:()=>k(null)}),[O]),F=(0,B.useMemo)(()=>({activeDoc:M,openFor:e=>{N(e),T(null),k(null)},close:()=>N(null)}),[M]),te=w!==null,ne=O!==null,re=M!==null,ie=R(L.voice.voiceConfigForChat,e?{chatId:e}:`skip`),[ae,oe]=(0,B.useState)(null),se=(0,B.useMemo)(()=>({active:ae,setActive:oe,clearIf:e=>oe(t=>t?.messageId===e?null:t)}),[ae]);(0,B.useEffect)(()=>{B8(),oe(null)},[e]);let ce=(0,B.useMemo)(()=>ie?{...ie,loaded:!0}:{enabled:!1,lang:`auto`,rate:1,autoRead:!1,engine:`browser`,loaded:!1},[ie]);return(0,V.jsx)(kO,{runtime:n,children:(0,V.jsx)(L8.Provider,{value:ce,children:(0,V.jsx)(R8.Provider,{value:se,children:(0,V.jsx)(U8.Provider,{value:r,children:(0,V.jsx)(W8.Provider,{value:i,children:(0,V.jsx)(G8.Provider,{value:a,children:(0,V.jsx)(zH.Provider,{value:s,children:(0,V.jsx)(K8.Provider,{value:o,children:(0,V.jsx)(V8.Provider,{value:u,children:(0,V.jsx)(Qz.Provider,{value:_,children:(0,V.jsx)(X6.Provider,{value:ee,children:(0,V.jsx)(S6.Provider,{value:P,children:(0,V.jsx)(y8.Provider,{value:F,children:(0,V.jsxs)(zhe,{children:[(0,V.jsxs)(`div`,{className:`oc-chat`,children:[(0,V.jsx)(`div`,{className:`oc-chat__convo`,children:e?b?(0,V.jsx)(Kge,{}):(0,V.jsx)(Xge,{chatId:e,showTools:d,onToggleTools:()=>void v({key:`showTools`,value:!d}),focusMessageId:t??null,initialLoading:c}):(0,V.jsx)(`div`,{className:`oc-empty`,children:wr()})}),(te||ne||re)&&!x?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`oc-sources-resizer`,onPointerDown:re?j:ne?D:C,role:`separator`,"aria-orientation":`vertical`,"aria-label":pc()}),(0,V.jsx)(`aside`,{className:`oc-sources-col`,style:{width:re?A:ne?E:S,flex:`0 0 ${re?A:ne?E:S}px`},children:re?(0,V.jsx)(b8,{doc:M,onClose:F.close}):ne?(0,V.jsx)(w6,{chatId:e,childKey:O,onClose:P.close,parentAgentLabel:eB(_)}):(0,V.jsx)(Z6,{messageId:w,onClose:ee.close})})]}):null]}),te&&x?(0,V.jsx)(o8,{open:!0,onOpenChange:e=>{e||ee.close()},children:(0,V.jsx)(s8,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,V.jsx)(Z6,{messageId:w,onClose:ee.close})})}):null,ne&&x?(0,V.jsx)(o8,{open:!0,onOpenChange:e=>{e||P.close()},children:(0,V.jsx)(s8,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,V.jsx)(w6,{chatId:e,childKey:O,onClose:P.close,parentAgentLabel:eB(_)})})}):null,re&&x?(0,V.jsx)(o8,{open:!0,onOpenChange:e=>{e||F.close()},children:(0,V.jsx)(s8,{side:`right`,className:`oc-sources-panel-sheet oc-docviewer-sheet`,children:(0,V.jsx)(b8,{doc:M,onClose:F.close})})}):null]})})})})})})})})})})})})})})}function Kge(){let e=mh();return(0,V.jsxs)(`div`,{className:`oc-notfound`,role:`status`,children:[(0,V.jsx)(`div`,{className:`oc-notfound__icon`,"aria-hidden":!0,children:(0,V.jsx)(Vx,{size:28})}),(0,V.jsx)(`h2`,{className:`oc-notfound__title`,children:$t()}),(0,V.jsx)(`p`,{className:`oc-notfound__body`,children:St()}),(0,V.jsxs)(`button`,{type:`button`,className:`oc-notfound__cta`,onClick:()=>void e({to:`/`}),children:[(0,V.jsx)(zx,{size:16,"aria-hidden":!0}),Ke()]})]})}function qge(e,t){let n=CSS.highlights,r=window.Highlight;if(!n||!r)return null;let i=t.map(e=>e.toLowerCase()).filter(e=>e.length>=2);if(i.length===0)return null;let a=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=o.nextNode();e;e=o.nextNode()){let t=(e.textContent??``).toLowerCase();for(let n of i){let r=t.indexOf(n);for(;r!==-1;){let i=document.createRange();if(i.setStart(e,r),i.setEnd(e,r+n.length),a.push(i),a.length>=200)break;r=t.indexOf(n,r+n.length)}if(a.length>=200)break}if(a.length>=200)break}return a.length===0?null:(n.set(`oc-search-terms`,new r(...a)),()=>n.delete(`oc-search-terms`))}function Jge(e,t){(0,B.useEffect)(()=>{if(!t)return;let e=!1,n=0,r=0,i=null,a=()=>{if(e)return;let o=document.querySelector(`[data-message-id="${CSS.escape(t)}"]`);if(o){o.scrollIntoView({block:`center`,behavior:`smooth`}),o.classList.remove(`oc-msg--highlight`),o.offsetWidth,o.classList.add(`oc-msg--highlight`),window.setTimeout(()=>o.classList.remove(`oc-msg--highlight`),2400);let e=Vhe(t);e&&(i=qge(o,e.split(/\s+/).filter(Boolean)));return}n++<40&&(r=window.setTimeout(a,150))};return r=window.setTimeout(a,0),()=>{e=!0,window.clearTimeout(r),i?.()}},[e,t])}function Yge(){return(0,V.jsx)(`div`,{className:`oc-thread-skeleton`,role:`status`,"aria-label":nn(),children:[72,38,84,56,64].map((e,t)=>(0,V.jsx)(`div`,{className:`oc-thread-skeleton__row${t%2?` oc-thread-skeleton__row--user`:``}`,children:(0,V.jsx)(`span`,{className:`oc-thread-skeleton__bubble`,style:{width:`${e}%`}})},t))})}function Xge({chatId:e,showTools:t,onToggleTools:n,focusMessageId:r,initialLoading:i}){let a=R(L.bridgeHealth.getBridgeAvailability,{chatId:e}),o=q8()?.selected??null,s=R(L.bridgeHealth.getBridgeAvailability,{chatId:e,...o?{routedAgent:{instanceName:o.instanceName,agentId:o.agentId}}:{}}),c=s&&!s.available?s:null,l=a?.available===!0&&a.degraded===!0,u=s?.available===!0&&s.degraded===!0,d=R(L.agents.getChatAgent,{chatId:e})?.readOnly===!0,f=ahe(R(L.subAgents.listSubAgents,{chatId:e})??[]);return Jge(e,r),(0,V.jsx)(LH.Provider,{value:l,children:(0,V.jsxs)(yz.Root,{className:`oc-thread`,children:[(0,V.jsx)(n_e,{chatId:e}),(0,V.jsx)(e_e,{chatId:e}),i?(0,V.jsx)(Yge,{}):null,(0,V.jsxs)(yz.Viewport,{className:`oc-thread__viewport`,style:i?{display:`none`}:void 0,children:[(0,V.jsx)(yz.Empty,{children:(0,V.jsx)(t_e,{})}),(0,V.jsx)(yz.Messages,{components:{UserMessage:v_e,AssistantMessage:x_e,SystemMessage:S_e}})]}),(0,V.jsx)(yz.If,{empty:!1,children:(0,V.jsxs)(yz.ScrollToBottom,{className:`oc-scrolldown`,children:[(0,V.jsx)(s_e,{}),(0,V.jsx)(`span`,{children:er()})]})}),d?(0,V.jsx)($ge,{}):c?(0,V.jsx)(Qge,{reason:c.reason}):u?(0,V.jsx)(Zge,{}):null,(0,V.jsx)(k_e,{chatId:e,showTools:t,onToggleTools:n,unavailable:c!==null||d,subAgentBusy:f})]})})}function Zge(){return(0,V.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--warn`,role:`status`,children:[(0,V.jsx)(_x,{size:16,"aria-hidden":!0}),(0,V.jsx)(`span`,{children:Dn()})]})}function Qge({reason:e}){let t=e===`instance_unreachable`?Vn():mn();return(0,V.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--error`,role:`status`,children:[(0,V.jsx)(_x,{size:16,"aria-hidden":!0}),(0,V.jsx)(`span`,{children:t})]})}function $ge(){return(0,V.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--error`,role:`status`,children:[(0,V.jsx)(Mx,{size:16,"aria-hidden":!0}),(0,V.jsx)(`span`,{children:Ds()})]})}function e_e({chatId:e}){let t=R(L.messages.listByChat,{chatId:e}),[n,r]=(0,B.useState)(``),i=(0,B.useRef)(null);return(0,B.useEffect)(()=>{i.current=null,r(``)},[e]),(0,B.useEffect)(()=>{if(!t)return;let e;for(let n of t)n.role===`assistant`&&(e=n);if(!(!e||e.status!==`complete`)){if(i.current===null){i.current=e._id;return}i.current!==e._id&&(i.current=e._id,r(e=>e===v()?`${v()} `:v()))}},[t]),(0,V.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`oc-sr-only`,children:n})}function t_e(){return(0,V.jsxs)(`div`,{className:`oc-emptystate`,children:[(0,V.jsx)(J8,{className:`oc-emptystate__avatar`}),(0,V.jsx)(`h2`,{className:`oc-emptystate__title`,children:Bs()})]})}function X8({chatId:e}){let t=q8()?.selected??null,n=F6(R(L.agents.usageForChat,{chatId:e,...t?{routedAgent:{instanceName:t.instanceName,agentId:t.agentId}}:{}})?.usage??null,Date.now());if(!n)return null;let r=n.windows.map(e=>`${e.provider} ${e.label}: ${e.percentLeft}%`+(e.resetText?` ⏱${e.resetText}`:``)).join(` · `);return(0,V.jsxs)(`span`,{className:`oc-meter ${n.level}`,title:Yc({detail:r}),children:[(0,V.jsx)(`span`,{className:`oc-meter__track`,children:(0,V.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${100-n.percentLeft}%`}})}),(0,V.jsx)(`span`,{className:`oc-meter__label`,children:fc({pct:n.percentLeft})})]})}function Z8({sm:e,detail:t=!0}){let n=e.totalTokens!=null&&e.contextTokens&&e.contextTokens>0?Math.round(e.totalTokens/e.contextTokens*100):null;return n==null?null:(0,V.jsxs)(`span`,{className:`oc-meter ${n>=90?`is-critical`:n>=75?`is-warn`:`is-ok`}`,title:rs({pct:n,used:O8(e.totalTokens),total:O8(e.contextTokens)}),children:[(0,V.jsx)(`span`,{className:`oc-meter__track`,children:(0,V.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,V.jsxs)(`span`,{className:`oc-meter__label`,children:[n,`%`,t?(0,V.jsxs)(`span`,{className:`oc-meter__detail`,children:[` · `,O8(e.totalTokens),`/`,O8(e.contextTokens)]}):null]})]})}function n_e({chatId:e}){let t=R(L.messages.getSessionMeta,{chatId:e}),n=t?.sessionMeta??null,r=t?.sessionSettings??null,i=H8(),[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null),[u,d]=(0,B.useState)(!1),f=!D8(r,`thinkingLevel`),p=(a,s)=>(0,V.jsxs)(V.Fragment,{children:[i.showTools&&!a&&n?.model?(0,V.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:n.modelProvider?Fa({provider:n.modelProvider}):Lu(),children:[(0,V.jsx)(a_e,{}),(0,V.jsx)(`span`,{className:`oc-chip__label`,children:n.model})]}):null,i.showTools&&!a&&n?.thinkingLevel?(0,V.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:f?Zu():uu(),children:[(0,V.jsx)(o_e,{}),(0,V.jsxs)(`span`,{className:`oc-chip__label`,children:[ca(),`\xA0: `,k8(n.thinkingLevel)]}),f?(0,V.jsx)(`span`,{className:`oc-chip__hint`,children:Go()}):null]}):null,i.showTools&&n?(0,V.jsx)(Z8,{sm:n,detail:!a}):null,i.showUsage&&!n?(0,V.jsx)(X8,{chatId:e}):null,(0,V.jsx)(r_e,{chatId:e,title:t?.title??null,compact:a,ghost:s}),n?(0,V.jsx)(i_e,{chatId:e,sm:n,settings:r,onOpenPanel:()=>o(!0),compact:a,ghost:s,showUsage:i.showUsage}):null]});return(0,B.useLayoutEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{let t=l.current?.offsetWidth??0;if(t===0)return;let n=Math.min(c.current?.scrollWidth??0,360),r=e.clientWidth-n-16<t;d(e=>e===r?e:r)};t();let n=new ResizeObserver(t);return n.observe(e),l.current&&n.observe(l.current),()=>n.disconnect()},[[ec(),Sa(),n?.model??``,n?.thinkingLevel??``,t?.title??``,i.showTools?`1`:`0`].join(`|`)]),(0,V.jsxs)(`header`,{className:`oc-chathead`,ref:s,children:[(0,V.jsx)(`div`,{className:`oc-chathead__title`,title:t?.title??void 0,ref:c,children:t?.title||Hn()}),(0,V.jsx)(`div`,{className:`oc-chathead__meta`,children:p(u,!1)}),(0,V.jsx)(`div`,{className:`oc-chathead-ghost`,"aria-hidden":!0,ref:l,children:p(!1,!0)}),(0,V.jsx)(Gge,{chatId:e,open:a,onOpenChange:o})]})}function Q8(e,t,n){let r=new Blob([e],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}function r_e({chatId:e,title:t,compact:n=!1,ghost:r=!1}){let i=Fe();async function a(n){let[r,a]=await Promise.all([i.query(L.messages.listByChat,{chatId:e}),i.query(L.messages.getStreamingText,{chatId:e})]),o=new Map(a.map(e=>[e.messageId,e.text])),s=r.map(e=>({role:e.role,text:e.status===`streaming`?o.get(e._id)??e.text:e.text,createdAt:e.updatedAt??e._creationTime,parts:e.parts.map(e=>({kind:e.kind,filename:`filename`in e?e.filename:void 0,name:`name`in e?e.name:void 0}))})),c=r.length>=200,l={title:t??void 0,truncated:c,exportedAt:Date.now()},u=MB(t);n===`md`?Q8(AB(s,l),`${u}.md`,`text/markdown`):Q8(jB(s,l),`${u}.json`,`application/json`)}let o=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Sx,{size:13,"aria-hidden":!0}),n?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`oc-chip__label`,children:ec()}),(0,V.jsx)(Cd,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})]});return r?(0,V.jsx)(`span`,{className:`oc-chip oc-chip--btn`,children:o}):(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`oc-chip oc-chip--btn`,title:$l(),children:o})}),(0,V.jsxs)(FB,{align:`end`,className:`w-44`,children:[(0,V.jsx)(LB,{children:ec()}),(0,V.jsx)(IB,{onClick:()=>void a(`md`),children:Ya()}),(0,V.jsx)(IB,{onClick:()=>void a(`json`),children:Dl()})]})]})}function i_e({chatId:e,sm:t,settings:n,onOpenPanel:r,compact:i=!1,ghost:a=!1,showUsage:o=!1}){let[s,c]=(0,B.useState)(!1),l=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ux,{size:13,"aria-hidden":!0}),i?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`oc-chip__label`,children:Sa()}),(0,V.jsx)(Cd,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})]});return a?(0,V.jsx)(`span`,{className:`oc-chip oc-chip--btn`,children:l}):(0,V.jsxs)(GB,{open:s,onOpenChange:c,children:[(0,V.jsx)(KB,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`oc-chip oc-chip--btn`,title:Pc(),children:l})}),(0,V.jsxs)(qB,{align:`end`,className:`oc-spanel-pop w-80 p-2`,children:[t.totalTokens!=null&&t.contextTokens?(0,V.jsxs)(`div`,{className:`oc-spanel-pop__usage`,children:[(0,V.jsx)(`span`,{className:`oc-spanel-pop__usage-label`,children:so()}),(0,V.jsx)(Z8,{sm:t})]}):null,o?(0,V.jsxs)(`div`,{className:`oc-spanel-pop__usage`,children:[(0,V.jsx)(`span`,{className:`oc-spanel-pop__usage-label`,children:Ii()}),(0,V.jsx)(X8,{chatId:e})]}):null,(0,V.jsx)(N8,{chatId:e,sm:t,settings:n}),(0,V.jsxs)(`button`,{type:`button`,className:`oc-spanel-pop__all`,onClick:()=>{c(!1),r()},children:[(0,V.jsx)(Ux,{size:13,"aria-hidden":!0}),De(),(0,V.jsx)(gx,{size:13,"aria-hidden":!0})]})]})]})}function a_e(){return(0,V.jsxs)(`svg`,{className:`oc-chip__icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,V.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),(0,V.jsx)(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),(0,V.jsx)(`path`,{d:`M9 1v3M15 1v3M9 20v3M15 20v3M20 9h3M20 14h3M1 9h3M1 14h3`})]})}function o_e(){return(0,V.jsxs)(`svg`,{className:`oc-chip__icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,V.jsx)(`path`,{d:`M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`}),(0,V.jsx)(`path`,{d:`M12 5a3 3 0 1 1 5.997.142 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`})]})}function $8({children:e}){return(0,V.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:e})}function s_e(){return(0,V.jsx)($8,{children:(0,V.jsx)(`path`,{d:`M12 5v14M19 12l-7 7-7-7`})})}var c_e=`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,e5=`focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`;function l_e({sourceShown:e,sourceActive:t,onToggleSource:n}){let r=zO(e=>e.metadata?.custom?.messageId),i=zO(e=>e.metadata?.custom?.sentAt),a=zO(e=>e.metadata?.custom?.status===`streaming`),o=Se(L.chatFork.forkChat),s=cV(),c=yV(),[l,d]=(0,B.useState)(!1);if(!r)return null;let f=async()=>{let e=await s({title:u(),description:Ri(),label:Wi(),placeholder:Ki(),confirmLabel:gr(),allowEmpty:!0});if(e!==null){d(!0);try{let{chatId:t}=await o({branchMessageId:r,...e.trim()?{title:e.trim()}:{}});fV(t),c.success(ea())}catch(e){c.error(Lt(),e)}finally{d(!1)}}};return(0,V.jsxs)(cI.Root,{children:[(0,V.jsx)(cI.Trigger,{className:`oc-iconbtn`,title:Gt(),"aria-label":Gt(),disabled:l,children:(0,V.jsx)(ine,{size:15})}),(0,V.jsxs)(cI.Content,{align:`end`,sideOffset:4,className:c_e,children:[i===void 0?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`oc-msgmenu__when px-2 py-1.5 text-sm`,children:VB(i,{dateStyle:`medium`,timeStyle:`short`})}),(0,V.jsx)(cI.Separator,{className:`bg-border -mx-1 my-1 h-px`})]}),e?(0,V.jsxs)(cI.Item,{className:e5,onSelect:n,children:[(0,V.jsx)(bx,{size:14,"aria-hidden":!0}),t?Xa():Ol()]}):null,(0,V.jsxs)(cI.Item,{className:e5,disabled:l||a,onSelect:()=>void f(),children:[(0,V.jsx)(one,{size:14,"aria-hidden":!0}),u()]})]})]})}function u_e(){let[e,t]=(0,B.useState)(!1),n=zO(e=>e.content.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
229
229
  `)),r=FH(zO(e=>e.metadata?.custom?.error??null),zO(e=>e.metadata?.custom?.errorCode??null)),i=n.trim()||[r.headline,r.detail].filter(Boolean).join(`
@@ -235,4 +235,4 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
235
235
  To pick up a draggable item, press the space bar.
236
236
  While dragging, use the arrow keys to move the item.
237
237
  Press space again to drop the item in its new position, or press escape to cancel.
238
- `},H_e={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 U_e(e){let{announcements:t=H_e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=V_e}=e,{announce:a,announcement:o}=R_e(),s=S5(`DndLiveRegion`),[c,l]=(0,B.useState)(!1);if((0,B.useEffect)(()=>{l(!0)},[]),z_e((0,B.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=B.createElement(B.Fragment,null,B.createElement(I_e,{id:r,value:i.draggable}),B.createElement(L_e,{id:s,announcement:o}));return n?(0,gh.createPortal)(u,n):u}var j5;(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`})(j5||={});function M5(){}function N5(e,t){return(0,B.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function P5(){var e=[...arguments];return(0,B.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var F5=Object.freeze({x:0,y:0});function I5(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function W_e(e,t){let n=D5(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 L5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function G_e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function R5(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 z5(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function B5(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 K_e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=B5(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=I5(B5(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(L5)},V5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=R5(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=R5(r),o=i.reduce((e,t,r)=>e+I5(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(L5)};function q_e(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 J_e=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=q_e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(G_e)};function Y_e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function H5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:F5}function X_e(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 Z_e=X_e(1);function U5(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 Q_e(e,t,n){let r=U5(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 $_e={ignoreTransform:!1};function W5(e,t){t===void 0&&(t=$_e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=u5(e).getComputedStyle(e);t&&(n=Q_e(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 G5(e){return W5(e,{ignoreTransform:!0})}function eve(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function tve(e,t){return t===void 0&&(t=u5(e).getComputedStyle(e)),t.position===`fixed`}function nve(e,t){t===void 0&&(t=u5(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 K5(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(d5(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!f5(i)||p5(i)||n.includes(i))return n;let a=u5(e).getComputedStyle(i);return i!==e&&nve(i,a)&&n.push(i),tve(i,a)?n:r(i.parentNode)}return e?r(e):n}function q5(e){let[t]=K5(e,1);return t??null}function J5(e){return!s5||!e?null:c5(e)?e:l5(e)?d5(e)||e===m5(e).scrollingElement?window:f5(e)?e:null:null}function Y5(e){return c5(e)?e.scrollX:e.scrollLeft}function X5(e){return c5(e)?e.scrollY:e.scrollTop}function Z5(e){return{x:Y5(e),y:X5(e)}}var Q5;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Q5||={});function $5(e){return!s5||!e?!1:e===document.scrollingElement}function e7(e){let t={x:0,y:0},n=$5(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 rve={x:.2,y:.2};function ive(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=rve);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=e7(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=Q5.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Q5.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Q5.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Q5.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function ave(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 t7(e){return e.reduce((e,t)=>w5(e,Z5(t)),F5)}function ove(e){return e.reduce((e,t)=>e+Y5(t),0)}function sve(e){return e.reduce((e,t)=>e+X5(t),0)}function n7(e,t){if(t===void 0&&(t=W5),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);q5(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var cve=[[`x`,[`left`,`right`],ove],[`y`,[`top`,`bottom`],sve]],r7=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=K5(t),r=t7(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of cve)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})}},i7=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 lve(e){let{EventTarget:t}=u5(e);return e instanceof t?e:m5(e)}function a7(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 o7;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(o7||={});function s7(e){e.preventDefault()}function uve(e){e.stopPropagation()}var c7;(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`})(c7||={});var l7={start:[c7.Space,c7.Enter],cancel:[c7.Esc],end:[c7.Space,c7.Enter,c7.Tab]},dve=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case c7.Right:return{...n,x:n.x+25};case c7.Left:return{...n,x:n.x-25};case c7.Down:return{...n,y:n.y+25};case c7.Up:return{...n,y:n.y-25}}},u7=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 i7(m5(t)),this.windowListeners=new i7(u5(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(o7.Resize,this.handleCancel),this.windowListeners.add(o7.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(o7.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&n7(n),t(F5)}handleKeyDown(e){if(E5(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=l7,coordinateGetter:a=dve,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}:F5;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=T5(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}=e7(n),p=ave(n),m={x:Math.min(i===c7.Right?p.right-p.width/2:p.right,Math.max(i===c7.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===c7.Down?p.bottom-p.height/2:p.bottom,Math.max(i===c7.Down?p.top:p.top+p.height/2,u.y))},h=i===c7.Right&&!s||i===c7.Left&&!c,g=i===c7.Down&&!l||i===c7.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===c7.Right&&e<=d.x||i===c7.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===c7.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===c7.Down&&e<=d.y||i===c7.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===c7.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,w5(T5(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()}};u7.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=l7,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 d7(e){return!!(e&&`distance`in e)}function f7(e){return!!(e&&`delay`in e)}var p7=class{constructor(e,t,n){n===void 0&&(n=lve(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=m5(i),this.documentListeners=new i7(this.document),this.listeners=new i7(n),this.windowListeners=new i7(u5(i)),this.initialCoordinates=D5(r)??F5,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(o7.Resize,this.handleCancel),this.windowListeners.add(o7.DragStart,s7),this.windowListeners.add(o7.VisibilityChange,this.handleCancel),this.windowListeners.add(o7.ContextMenu,s7),this.documentListeners.add(o7.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(f7(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(d7(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(o7.Click,uve,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(o7.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=D5(e)??F5,s=T5(n,o);if(!t&&a){if(d7(a)){if(a.tolerance!=null&&a7(s,a.tolerance))return this.handleCancel();if(a7(s,a.distance))return this.handleStart()}if(f7(a)&&a7(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===c7.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},fve={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},m7=class extends p7{constructor(e){let{event:t}=e,n=m5(t.target);super(e,fve,n)}};m7.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 pve={move:{name:`mousemove`},end:{name:`mouseup`}},h7;(function(e){e[e.RightClick=2]=`RightClick`})(h7||={});var mve=class extends p7{constructor(e){super(e,pve,m5(e.event.target))}};mve.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===h7.RightClick?!1:(r?.({event:n}),!0)}}];var g7={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},hve=class extends p7{constructor(e){super(e,g7)}static setup(){return window.addEventListener(g7.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(g7.move.name,e)};function e(){}}};hve.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 _7;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(_7||={});var v7;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(v7||={});function gve(e){let{acceleration:t,activator:n=_7.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=v7.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=vve({delta:d,disabled:!a}),[m,h]=j_e(),g=(0,B.useRef)({x:0,y:0}),_=(0,B.useRef)({x:0,y:0}),v=(0,B.useMemo)(()=>{switch(n){case _7.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case _7.DraggableRect:return i}},[n,i,c]),y=(0,B.useRef)(null),b=(0,B.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,B.useMemo)(()=>s===v7.TreeOrder?[...l].reverse():l,[s,l]);(0,B.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}=ive(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 _ve={x:{[Q5.Backward]:!1,[Q5.Forward]:!1},y:{[Q5.Backward]:!1,[Q5.Forward]:!1}};function vve(e){let{delta:t,disabled:n}=e,r=b5(t);return v5(e=>{if(n||!r||!e)return _ve;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q5.Backward]:e.x[Q5.Backward]||i.x===-1,[Q5.Forward]:e.x[Q5.Forward]||i.x===1},y:{[Q5.Backward]:e.y[Q5.Backward]||i.y===-1,[Q5.Forward]:e.y[Q5.Forward]||i.y===1}}},[n,t,r])}function yve(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return v5(e=>t==null?null:r??e??null,[r,t])}function bve(e,t){return(0,B.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 y7;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(y7||={});var b7;(function(e){e.Optimized=`optimized`})(b7||={});var x7=new Map;function xve(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,B.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,B.useRef)(e),d=g(),f=_5(d),p=(0,B.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,B.useRef)(null),h=v5(t=>{if(d&&!n)return x7;if(!t||t===x7||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 r7(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,B.useEffect)(()=>{u.current=e},[e]),(0,B.useEffect)(()=>{d||p()},[n,d]),(0,B.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,B.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 y7.Always:return!1;case y7.BeforeDragging:return n;default:return!n}}}function S7(e,t){return v5(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Sve(e,t){return S7(e,t)}function Cve(e){let{callback:t,disabled:n}=e,r=g5(t),i=(0,B.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,B.useEffect)(()=>()=>i?.disconnect(),[i]),i}function C7(e){let{callback:t,disabled:n}=e,r=g5(t),i=(0,B.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,B.useEffect)(()=>()=>i?.disconnect(),[i]),i}function wve(e){return new r7(W5(e),e)}function w7(e,t,n){t===void 0&&(t=wve);let[r,i]=(0,B.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=Cve({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=C7({callback:a});return h5(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Tve(e){return H5(e,S7(e))}var T7=[];function Eve(e){let t=(0,B.useRef)(e),n=v5(n=>e?n&&n!==T7&&e&&t.current&&e.parentNode===t.current.parentNode?n:K5(e):T7,[e]);return(0,B.useEffect)(()=>{t.current=e},[e]),n}function Dve(e){let[t,n]=(0,B.useState)(null),r=(0,B.useRef)(e),i=(0,B.useCallback)(e=>{let t=J5(e.target);t&&n(e=>e?(e.set(t,Z5(t)),new Map(e)):null)},[]);return(0,B.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=J5(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Z5(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=>{J5(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,B.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>w5(e,t),F5):t7(e):F5,[e,t])}function E7(e,t){t===void 0&&(t=[]);let n=(0,B.useRef)(null);return(0,B.useEffect)(()=>{n.current=null},t),(0,B.useEffect)(()=>{let t=e!==F5;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?T5(e,n.current):F5}function Ove(e){(0,B.useEffect)(()=>{if(!s5)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 kve(e,t){return(0,B.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function D7(e){return(0,B.useMemo)(()=>e?eve(e):null,[e])}var O7=[];function Ave(e,t){t===void 0&&(t=W5);let[n]=e,r=D7(n?u5(n):null),[i,a]=(0,B.useState)(O7);function o(){a(()=>e.length?e.map(e=>$5(e)?r:new r7(t(e),e)):O7)}let s=C7({callback:o});return h5(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function k7(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return f5(t)?t:e}function jve(e){let{measure:t}=e,[n,r]=(0,B.useState)(null),i=C7({callback:(0,B.useCallback)(e=>{for(let{target:n}of e)if(f5(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=y5((0,B.useCallback)(e=>{let n=k7(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,B.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Mve=[{sensor:m7,options:{}},{sensor:u7,options:{}}],Nve={current:{}},A7={draggable:{measure:G5},droppable:{measure:G5,strategy:y7.WhileDragging,frequency:b7.Optimized},dragOverlay:{measure:W5}},j7=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}},Pve={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new j7,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:M5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:A7,measureDroppableContainers:M5,windowRect:null,measuringScheduled:!1},M7={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:M5,draggableNodes:new Map,over:null,measureDroppableContainers:M5},N7=(0,B.createContext)(M7),P7=(0,B.createContext)(Pve);function Fve(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new j7}}}function Ive(e,t){switch(t.type){case j5.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case j5.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 j5.DragEnd:case j5.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case j5.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new j7(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case j5.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 j7(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case j5.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new j7(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Lve(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,B.useContext)(N7),a=b5(r),o=b5(n?.id);return(0,B.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!E5(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=P_e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function F7(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Rve(e){return(0,B.useMemo)(()=>({draggable:{...A7.draggable,...e?.draggable},droppable:{...A7.droppable,...e?.droppable},dragOverlay:{...A7.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function zve(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,B.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;h5(()=>{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=H5(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=q5(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var I7=(0,B.createContext)({...F5,scaleX:1,scaleY:1}),L7;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(L7||={});var R7=(0,B.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Mve,collisionDetection:o=J_e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,B.useReducer)(Ive,void 0,Fve),[f,p]=B_e(),[m,h]=(0,B.useState)(L7.Uninitialized),g=m===L7.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,B.useRef)({initial:null,translated:null}),C=(0,B.useMemo)(()=>_==null?null:{id:_,data:x?.data??Nve,rect:S},[_,x]),w=(0,B.useRef)(null),[T,E]=(0,B.useState)(null),[D,O]=(0,B.useState)(null),k=_5(l,Object.values(l)),A=S5(`DndDescribedBy`,t),j=(0,B.useMemo)(()=>b.getEnabled(),[b]),M=Rve(s),{droppableRects:N,measureDroppableContainers:ee,measuringScheduled:P}=xve(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),F=yve(v,_),te=(0,B.useMemo)(()=>D?D5(D):null,[D]),ne=Me(),re=Sve(F,M.draggable.measure);zve({activeNode:_==null?null:v.get(_),config:ne.layoutShiftCompensation,initialRect:re,measure:M.draggable.measure});let ie=w7(F,M.draggable.measure,re),ae=w7(F?F.parentElement:null),oe=(0,B.useRef)({activatorEvent:null,active:null,activeNode:F,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),se=b.getNodeFor(oe.current.over?.id),ce=jve({measure:M.dragOverlay.measure}),le=ce.nodeRef.current??F,ue=g?ce.rect??ie:null,de=!!(ce.nodeRef.current&&ce.rect),fe=Tve(de?null:ie),pe=D7(le?u5(le):null),me=Eve(g?se??F:null),he=Ave(me),ge=F7(c,{transform:{x:y.x-fe.x,y:y.y-fe.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:ie,containerNodeRect:ae,draggingNodeRect:ue,over:oe.current.over,overlayNodeRect:ce.rect,scrollableAncestors:me,scrollableAncestorRects:he,windowRect:pe}),_e=te?w5(te,y):null,ve=Dve(me),ye=E7(ve),I=E7(ve,[ie]),be=w5(ge,ye),xe=ue?Z_e(ue,ge):null,Se=C&&xe?o({active:C,collisionRect:xe,droppableRects:N,droppableContainers:j,pointerCoordinates:_e}):null,Ce=z5(Se,`id`),[we,Te]=(0,B.useState)(null),Ee=Y_e(de?ge:w5(ge,I),we?.rect??null,ie),De=(0,B.useRef)(null),Oe=(0,B.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;De.current=new n({active:w.current,activeNode:i,event:a,options:r,context:oe,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,gh.unstable_batchedUpdates)(()=>{r?.(i),h(L7.Initializing),d({type:j5.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(De.current),O(a)})},onMove(e){d({type:j5.DragMove,coordinates:e})},onEnd:o(j5.DragEnd),onCancel:o(j5.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=oe.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===j5.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=j5.DragCancel)}w.current=null,(0,gh.unstable_batchedUpdates)(()=>{d({type:e}),h(L7.Uninitialized),Te(null),E(null),O(null),De.current=null;let t=e===j5.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),ke=bve(a,(0,B.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,Oe(n,t))},[v,Oe]));Ove(a),h5(()=>{ie&&m===L7.Initializing&&h(L7.Initialized)},[ie,m]),(0,B.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=oe.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:be.x,y:be.y},over:i};(0,gh.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[be.x,be.y]),(0,B.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=oe.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Ce),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,gh.unstable_batchedUpdates)(()=>{Te(s),a?.(c),f({type:`onDragOver`,event:c})})},[Ce]),h5(()=>{oe.current={activatorEvent:D,active:C,activeNode:F,collisionRect:xe,collisions:Se,droppableRects:N,draggableNodes:v,draggingNode:le,draggingNodeRect:ue,droppableContainers:b,over:we,scrollableAncestors:me,scrollAdjustedTranslate:be},S.current={initial:ue,translated:xe}},[C,F,Se,xe,v,le,ue,N,b,we,me,be]),gve({...ne,delta:y,draggingRect:xe,pointerCoordinates:_e,scrollableAncestors:me,scrollableAncestorRects:he});let Ae=(0,B.useMemo)(()=>({active:C,activeNode:F,activeNodeRect:ie,activatorEvent:D,collisions:Se,containerNodeRect:ae,dragOverlay:ce,draggableNodes:v,droppableContainers:b,droppableRects:N,over:we,measureDroppableContainers:ee,scrollableAncestors:me,scrollableAncestorRects:he,measuringConfiguration:M,measuringScheduled:P,windowRect:pe}),[C,F,ie,D,Se,ae,ce,v,b,N,we,ee,me,he,M,P,pe]),je=(0,B.useMemo)(()=>({activatorEvent:D,activators:ke,active:C,activeNodeRect:ie,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:we,measureDroppableContainers:ee}),[D,ke,C,ie,d,A,v,we,ee]);return B.createElement(A5.Provider,{value:p},B.createElement(N7.Provider,{value:je},B.createElement(P7.Provider,{value:Ae},B.createElement(I7.Provider,{value:Ee},i)),B.createElement(Lve,{disabled:n?.restoreFocus===!1})),B.createElement(U_e,{...n,hiddenTextDescribedById:A}));function Me(){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}}}),Bve=(0,B.createContext)(null),z7=`button`,Vve=`Draggable`;function Hve(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=S5(Vve),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,B.useContext)(N7),{role:p=z7,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,B.useContext)(g?I7:Bve),[v,y]=y5(),[b,x]=y5(),S=kve(o,t),C=_5(n);return h5(()=>(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,B.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===z7?!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 B7(){return(0,B.useContext)(P7)}var Uve=`Droppable`,Wve={timeout:25};function V7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=S5(Uve),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,B.useContext)(N7),u=(0,B.useRef)({disabled:n}),d=(0,B.useRef)(!1),f=(0,B.useRef)(null),p=(0,B.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Wve,...i},_=_5(h??r),v=C7({callback:(0,B.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]=y5((0,B.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=_5(t);return(0,B.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,B.useEffect)(()=>(s({type:j5.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:j5.UnregisterDroppable,key:a,id:r})),[r]),(0,B.useEffect)(()=>{n!==u.current.disabled&&(s({type:j5.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 Gve(e){let{animation:t,children:n}=e,[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null),s=b5(n);return!n&&!r&&s&&i(s),h5(()=>{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]),B.createElement(B.Fragment,null,n,r?(0,B.cloneElement)(r,{ref:o}):null)}var Kve={x:0,y:0,scaleX:1,scaleY:1};function qve(e){let{children:t}=e;return B.createElement(N7.Provider,{value:M7},B.createElement(I7.Provider,{value:Kve},t))}var Jve={position:`fixed`,touchAction:`none`},Yve=e=>E5(e)?`transform 250ms ease`:void 0,Xve=(0,B.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Yve}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Jve,width:s.width,height:s.height,top:s.top,left:s.left,transform:O5.Transform.toString(d),transformOrigin:i&&r?W_e(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return B.createElement(n,{className:o,style:f,ref:t},a)}),Zve={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:O5.Transform.toString(t)},{transform:O5.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 Qve(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return g5((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=k7(a);if(!c)return;let{transform:l}=u5(a).getComputedStyle(a),u=U5(l);if(!u)return;let d=typeof t==`function`?t:$ve(t);return n7(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 $ve(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Zve,...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 H7=0;function eye(e){return(0,B.useMemo)(()=>{if(e!=null)return H7++,H7},[e])}var tye=B.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}=B7(),S=(0,B.useContext)(I7),C=eye(d?.id),w=F7(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=S7(f),E=Qve({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return B.createElement(qve,null,B.createElement(Gve,{animation:E},d&&C?B.createElement(Xve,{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))}),nye=e=>{let{transform:t}=e;return{...t,y:0}};function rye(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 iye=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:rye(n,t,i)},aye=e=>{let{transform:t}=e;return{...t,x:0}};function U7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function W7(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function G7(e){return e!==null&&e>=0}function oye(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 sye(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var K7={scaleX:1,scaleY:1},cye=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=lye(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,...K7}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...K7}:a<r&&a>=i?{x:o.width+s,y:0,...K7}:{x:0,y:0,...K7}};function lye(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 q7=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=U7(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}},J7={scaleX:1,scaleY:1},uye=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,...J7}:null}let s=dye(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...J7}:r<t&&r>=a?{x:0,y:o.height+s,...J7}:{x:0,y:0,...J7}};function dye(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 Y7=`Sortable`,X7=B.createContext({activeIndex:-1,containerId:Y7,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:q7,disabled:{draggable:!1,droppable:!1}});function Z7(e){let{children:t,id:n,items:r,strategy:i=q7,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=B7(),d=S5(Y7,n),f=s.rect!==null,p=(0,B.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,B.useRef)(p),v=!oye(p,_.current),y=g!==-1&&h===-1||v,b=sye(a);h5(()=>{v&&m&&u(p)},[v,p,m,u]),(0,B.useEffect)(()=>{_.current=p},[p]);let x=(0,B.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:W7(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return B.createElement(X7.Provider,{value:x},t)}var fye=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return U7(n,r,i).indexOf(t)},pye=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},mye={duration:200,easing:`ease`},Q7=`transform`,hye=O5.Transition.toString({property:Q7,duration:0,easing:`linear`}),gye={roleDescription:`sortable`};function _ye(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,B.useState)(null),s=(0,B.useRef)(n);return h5(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=W5(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,B.useEffect)(()=>{a&&o(null)},[a]),a}function $7(e){let{animateLayoutChanges:t=pye,attributes:n,disabled:r,data:i,getNewIndex:a=fye,id:o,strategy:s,resizeObserverConfig:c,transition:l=mye}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,B.useContext)(X7),y=vye(r,p),b=u.indexOf(o),x=(0,B.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,B.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=V7({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:ee,setActivatorNodeRef:P,transform:F}=Hve({id:o,data:x,attributes:{...gye,...n},disabled:y.draggable}),te=A_e(E,j),ne=!!D,re=ne&&!m&&G7(f)&&G7(g),ie=!_&&N,ae=re?(ie&&re?F:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,oe=G7(f)&&G7(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,se=D?.id,ce=(0,B.useRef)({activeId:se,items:u,newIndex:oe,containerId:d}),le=u!==ce.current.items,ue=t({active:D,containerId:d,isDragging:N,isSorting:ne,id:o,index:b,items:u,newIndex:ce.current.newIndex,previousItems:ce.current.items,previousContainerId:ce.current.containerId,transition:l,wasDragging:ce.current.activeId!=null}),de=_ye({disabled:!ue,index:b,node:w,rect:C});return(0,B.useEffect)(()=>{ne&&ce.current.newIndex!==oe&&(ce.current.newIndex=oe),d!==ce.current.containerId&&(ce.current.containerId=d),u!==ce.current.items&&(ce.current.items=u)},[ne,oe,d,u]),(0,B.useEffect)(()=>{if(se===ce.current.activeId)return;if(se!=null&&ce.current.activeId==null){ce.current.activeId=se;return}let e=setTimeout(()=>{ce.current.activeId=se},50);return()=>clearTimeout(e)},[se]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:oe,items:u,isOver:T,isSorting:ne,isDragging:N,listeners:M,node:w,overIndex:g,over:ee,setNodeRef:te,setActivatorNodeRef:P,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:de??ae,transition:fe()};function fe(){if(de||le&&ce.current.newIndex===b)return hye;if(!(ie&&!E5(O)||!l)&&(ne||ue))return O5.Transition.toString({...l,property:Q7})}}function vye(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function e9(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 yye=[c7.Down,c7.Right,c7.Up,c7.Left],t9=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(yye.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 c7.Down:r.top<a.top&&t.push(n);break;case c7.Up:r.top>a.top&&t.push(n);break;case c7.Left:r.left>a.left&&t.push(n);break;case c7.Right:r.left<a.left&&t.push(n);break}});let c=V5({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=z5(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=K5(c).some((e,t)=>s[t]!==e),i=n9(e,t),a=bye(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:T5(u,l)}}}};function n9(e,t){return!e9(e)||!e9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function bye(e,t){return!e9(e)||!e9(t)||!n9(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function r9({open:e,onOpenChange:t,title:n,description:r,children:i,onSubmit:a,submitLabel:o,submitting:s=!1,canSubmit:c=!0}){let[l,u]=(0,B.useState)(!1),d=s||l;async function f(){if(!(!c||d))try{u(!0),await a()}finally{u(!1)}}return(0,V.jsx)(o8,{open:e,onOpenChange:t,children:(0,V.jsxs)(s8,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,V.jsxs)(c8,{className:`border-b px-6 py-4`,children:[(0,V.jsx)(u8,{children:n}),r?(0,V.jsx)(d8,{children:r}):null]}),(0,V.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,V.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:i}),(0,V.jsxs)(l8,{className:`border-t px-6 py-4`,children:[(0,V.jsxs)(zd,{type:`submit`,disabled:!c||d,children:[d?(0,V.jsx)(jx,{className:`size-4 animate-spin`}):null,o??ws()]}),(0,V.jsx)(zd,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:Cl()})]})]})]})})}var i9=6e4,a9=60*i9,o9=24*a9,s9=7*o9,c9=30*o9,l9=365*o9;function xye(e,t){let n=t-e;if(n<i9)return`maintenant`;if(n<a9)return`${Math.floor(n/i9)}min`;if(n<o9)return`${Math.floor(n/a9)}h`;if(n<s9)return`${Math.floor(n/o9)}j`;if(n<c9)return`${Math.floor(n/s9)}sem`;if(n<l9)return`${Math.floor(n/c9)}mois`;let r=Math.floor(n/l9);return`${r}an${r>1?`s`:``}`}var u9=[{value:`red`,hue:`oklch(0.63 0.21 25)`},{value:`orange`,hue:`oklch(0.7 0.17 50)`},{value:`amber`,hue:`oklch(0.8 0.15 85)`},{value:`green`,hue:`oklch(0.7 0.16 150)`},{value:`teal`,hue:`oklch(0.7 0.12 190)`},{value:`blue`,hue:`oklch(0.62 0.19 250)`},{value:`violet`,hue:`oklch(0.6 0.2 300)`},{value:`pink`,hue:`oklch(0.7 0.2 350)`}],d9=e=>u9.find(t=>t.value===e)?.hue??null,f9=`project:none`,Sye=e=>`project:${e}`,p9=`oc.noproject.collapsed`;function m9(){return(0,V.jsx)(`div`,{className:`oc-sidebar__skeleton`,"aria-hidden":`true`,children:Array.from({length:7}).map((e,t)=>(0,V.jsx)(`div`,{className:`oc-skel oc-skel--row`},t))})}function Cye({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=R(L.messages.listChats,{}),a=R(L.projects.listProjects,{}),o=R(L.me.getMe,{host:bz})?.ui?.effective,s=o?.showChatProvider??!0,c=o?.showChatAge??!0,l=new Set((i??[]).map(e=>e.providerKind).filter(e=>e!=null)),u=s&&l.size>1,d=R(L.chatReads.myChatReads,{}),f=(0,B.useMemo)(()=>{let e=new Map;for(let t of d??[])e.set(t.chatId,t.lastSeenAt);return e},[d]),p=(0,B.useMemo)(()=>{let t=new Set;for(let n of i??[]){if(n._id===e)continue;let r=f.get(n._id);r!==void 0&&n.lastAssistantAt!==null&&n.lastAssistantAt>r&&t.add(n._id)}return t},[i,f,e]),[,m]=(0,B.useState)(0);(0,B.useEffect)(()=>{if(!c)return;let e=window.setInterval(()=>m(e=>e+1),6e4);return()=>window.clearInterval(e)},[c]);let h=Se(L.projects.createProject),g=Se(L.projects.setProjectCollapsed),_=Se(L.chats.reorderChat),v=Se(L.chats.moveChatToProject),y=cV(),b=pe(),x=(0,B.useRef)(null),S=(0,B.useRef)(null),C=(0,B.useRef)(null),[w,T]=(0,B.useState)(`full`);(0,B.useLayoutEffect)(()=>{let e=x.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=S.current?.offsetWidth??0,r=C.current?.offsetWidth??0,i=n===0||t>=n?`full`:t>=r?`label`:`icon`;T(e=>e===i?e:i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[b,r]);let[E,D]=(0,B.useState)(null),O=(0,B.useRef)(!1);(0,B.useEffect)(()=>{!O.current&&i&&D(i)},[i]);let k=E??i??[],A=i===void 0&&E===null,[j,M]=(0,B.useState)(null),[N,ee]=(0,B.useState)(()=>localStorage.getItem(p9)===`1`);function P(){ee(e=>(localStorage.setItem(p9,e?`0`:`1`),!e))}let F=mV();(0,B.useEffect)(()=>{if(!F)return;let e=k.find(e=>e._id===F);if(!e)return;let t=e.projectId??null;if(t===null){N&&(localStorage.setItem(p9,`0`),ee(!1));return}(a??[]).find(e=>e._id===t)?.collapsed&&g({projectId:t,collapsed:!1})},[F,k,a,N,g]);let te=P5(N5(m7,{activationConstraint:{distance:4}}),N5(u7,{coordinateGetter:t9})),ne=k.filter(e=>e.pinned),re=k.filter(e=>!e.pinned),ie=e=>re.filter(t=>(t.projectId??null)===e);function ae(e){return k.find(t=>t._id===e)}async function oe(e){M(null);let{active:t,over:n}=e;if(!n)return;let r=ae(String(t.id));if(!r)return;let i=String(n.id);if(i.startsWith(`project:`)){let e=i===f9?null:i.slice(8);if((r.projectId??null)===e)return;O.current=!0,D(t=>(t??k).map(t=>t._id===r._id?{...t,projectId:e}:t));try{await v({chatId:r._id,projectId:e})}finally{O.current=!1}return}let a=ae(i);if(!a||t.id===n.id)return;if((a.projectId??null)!==(r.projectId??null)||a.pinned!==r.pinned){if(r.pinned||a.pinned)return;O.current=!0,D(e=>(e??k).map(e=>e._id===r._id?{...e,projectId:a.projectId??null}:e));try{await v({chatId:r._id,projectId:a.projectId??null})}finally{O.current=!1}return}let o=a.pinned?ne:ie(a.projectId??null),s=o.map(e=>e._id),c=s.indexOf(r._id),l=s.indexOf(a._id);if(c<0||l<0)return;let u=[...o];u.splice(c,1),u.splice(l,0,r);let d=u[l-1]??null,f=u[l+1]??null;O.current=!0,D(e=>[...(e??k).filter(e=>!o.some(t=>t._id===e._id)),...u]);try{await _({chatId:r._id,prevKey:d?d.sortKey:null,nextKey:f?f.sortKey:null})}finally{O.current=!1}}let se=j?ae(j):null;return(0,V.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,V.jsxs)(`div`,{className:`oc-sidebar__top`,ref:x,children:[(0,V.jsxs)(zd,{className:w===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,title:`${b} (${r})`,"aria-label":b,children:[(0,V.jsx)(zx,{}),w===`icon`?null:(0,V.jsx)(`span`,{className:`oc-newchat__label`,children:b}),w===`full`?(0,V.jsx)(`kbd`,{className:`oc-newchat__kbd`,"aria-hidden":!0,children:r}):null]}),(0,V.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,V.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:S,children:[(0,V.jsxs)(zd,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,V.jsx)(zx,{}),(0,V.jsx)(`span`,{className:`oc-newchat__label`,children:b}),(0,V.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,V.jsx)(zd,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,V.jsx)(Ox,{})})]})}),(0,V.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,V.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:C,children:[(0,V.jsxs)(zd,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,V.jsx)(zx,{}),(0,V.jsx)(`span`,{className:`oc-newchat__label`,children:b})]}),(0,V.jsx)(zd,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,V.jsx)(Ox,{})})]})}),(0,V.jsx)(zd,{className:`oc-newproject`,variant:`outline`,size:`icon`,"aria-label":Gr(),title:Gr(),onClick:async()=>{let e=await y({title:Gr(),label:Wu(),placeholder:Ha(),confirmLabel:id()});e&&await h({name:e})},children:(0,V.jsx)(Ox,{})})]}),(0,V.jsxs)(R7,{sensors:te,collisionDetection:V5,modifiers:[aye,iye],onDragStart:e=>M(e.active.id),onDragCancel:()=>M(null),onDragEnd:oe,children:[(0,V.jsx)(`div`,{className:`oc-sidebar__scroll`,children:A?(0,V.jsx)(m9,{}):(0,V.jsxs)(V.Fragment,{children:[ne.length>0?(0,V.jsx)(h9,{label:_u(),chats:ne,children:ne.map(n=>(0,V.jsx)(_9,{chat:n,active:n._id===e,unread:p.has(n._id),projects:a??[],onSelect:t,showProviderBadge:u},n._id))}):null,(a??[]).map(n=>{let r=ie(n._id);return(0,V.jsx)(h9,{label:n.name,dropId:Sye(n._id),projectId:n._id,chats:r,collapsible:!0,collapsed:n.collapsed,onToggle:()=>void g({projectId:n._id,collapsed:!n.collapsed}),children:n.collapsed?null:r.length===0?(0,V.jsx)(`div`,{className:`oc-sidebar__empty`,children:ha()}):r.map(n=>(0,V.jsx)(_9,{chat:n,active:n._id===e,unread:p.has(n._id),projects:a??[],onSelect:t,showProviderBadge:u},n._id))},n._id)}),(0,V.jsx)(h9,{label:Zo(),dropId:f9,chats:ie(null),collapsible:!0,collapsed:N,onToggle:P,children:N?null:ie(null).map(n=>(0,V.jsx)(_9,{chat:n,active:n._id===e,unread:p.has(n._id),projects:a??[],onSelect:t,showProviderBadge:u},n._id))})]})}),(0,V.jsx)(tye,{children:se?(0,V.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[(0,V.jsx)(Ax,{className:`size-3.5 opacity-60`}),d9(se.color)?(0,V.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:d9(se.color)}}):(0,V.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,V.jsx)(`span`,{className:`oc-chatitem__label`,children:se.title||ls()})]}):null})]})]})}function h9({label:e,dropId:t,projectId:n,chats:r,collapsible:i,collapsed:a,onToggle:o,children:s}){let c=Se(L.projects.deleteProject),l=sV(),u=R(L.projects.projectChatCount,n?{projectId:n}:`skip`),{setNodeRef:d,isOver:f}=V7({id:t??`static:${e}`});return(0,V.jsxs)(`div`,{ref:t?d:void 0,className:`oc-sidebar__group`+(f?` oc-sidebar__group--over`:``),children:[(0,V.jsxs)(`div`,{className:`oc-sidebar__group-head`+(i?` oc-sidebar__group-head--btn`:``),...i?{role:`button`,tabIndex:0,onClick:o,onKeyDown:e=>{i&&o&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())}}:{},children:[i?a?(0,V.jsx)(gx,{className:`size-3.5`}):(0,V.jsx)(Cd,{className:`size-3.5`}):null,(0,V.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,V.jsx)(`button`,{className:`oc-sidebar__group-del`,"aria-label":Ro(),onClick:async t=>{t.stopPropagation();let r=u??0;await l({title:po({name:e}),description:r>0?iu({count:r}):ac(),confirmWord:$a(),confirmLabel:Ro(),destructive:!0})&&await c({projectId:n})},children:(0,V.jsx)(Kx,{className:`size-3.5`})}):null]}),(0,V.jsx)(Z7,{items:r.map(e=>e._id),strategy:uye,children:s})]})}var g9={openclaw:`OpenClaw`,hermes:`Hermes`};function _9({chat:e,active:t,unread:n,projects:r,onSelect:i,showProviderBadge:a}){let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=$7({id:e._id}),f=Se(L.chats.renameChat),p=Se(L.chats.deleteChat),m=Se(L.chats.pinChat),h=Se(L.chats.setChatColor),g=R(L.me.getMe,{host:bz})?.ui?.effective?.showChatAge??!0,v=sV(),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(e.title??``),C=mV()===e._id,w=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!C)return;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;w.current?.scrollIntoView({block:`nearest`,behavior:t?`auto`:`smooth`});let n=setTimeout(()=>pV(e._id),2600);return()=>clearTimeout(n)},[C,e._id]);let T={transform:O5.Transform.toString(l),transition:u,opacity:+!d},E=d9(e.color);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{ref:e=>{c(e),w.current=e},style:T,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``)+(C?` oc-chatitem--flash`:``),onAnimationEnd:t=>{C&&t.animationName===`oc-chatitem-flash`&&pV(e._id)},children:[(0,V.jsx)(`button`,{className:`oc-chatitem__grip`,"aria-label":Nl(),...o,...s,children:(0,V.jsx)(Ax,{className:`size-3.5`})}),E?(0,V.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:E}}):(0,V.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,V.jsx)(`button`,{className:`oc-chatitem__label`,onClick:()=>i(e._id),children:e.title||ls()}),n?(0,V.jsx)(`span`,{className:`oc-chatitem__unread`,title:vc(),"aria-label":vc()}):null,e.readOnly?(0,V.jsx)(`span`,{className:`oc-chatitem__readonly`,title:tl(),children:(0,V.jsx)(Mx,{size:12,"aria-label":tl()})}):null,a&&e.providerKind?(0,V.jsx)(`span`,{className:`oc-chatitem__bridge oc-chatitem__bridge--${e.providerKind} group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Sr({provider:g9[e.providerKind]}),children:g9[e.providerKind]}):null,g?(0,V.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:VB(e.updatedAt),children:xye(e.updatedAt,Date.now())}):null,(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{asChild:!0,children:(0,V.jsx)(zd,{variant:`ghost`,size:`icon-xs`,"aria-label":Vc(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,V.jsx)(Cx,{})})}),(0,V.jsxs)(FB,{align:`end`,className:`w-48`,children:[(0,V.jsxs)(IB,{onSelect:()=>{S(e.title??``),b(!0)},children:[(0,V.jsx)(Rx,{}),` `,Oa()]}),(0,V.jsxs)(IB,{onSelect:()=>void m({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,V.jsx)(vne,{}):(0,V.jsx)(_ne,{}),e.pinned?xs():bl()]}),(0,V.jsx)(LB,{children:Oc()}),(0,V.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void h({chatId:e._id,color:null}),"aria-label":ql(),children:`✕`}),u9.map(t=>(0,V.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void h({chatId:e._id,color:t.value})},t.value))]}),(0,V.jsx)(RB,{}),(0,V.jsxs)(IB,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await v({title:Eo(),description:_(),confirmLabel:$a(),destructive:!0})&&await p({chatId:e._id})})},children:[(0,V.jsx)(Kx,{}),` `,$a()]})]})]})]}),(0,V.jsx)(r9,{open:y,onOpenChange:b,title:oa(),canSubmit:x.trim().length>0,onSubmit:async()=>{await f({chatId:e._id,title:x.trim()}),b(!1)},children:(0,V.jsx)(`div`,{className:`oc-form`,children:(0,V.jsxs)(`label`,{className:`oc-field`,children:[(0,V.jsx)(`span`,{className:`oc-field__label`,children:Wi()}),(0,V.jsx)(uB,{value:x,onChange:e=>S(e.target.value),autoFocus:!0})]})})})]})}var v9=null,y9=0,wye=400;function Tye(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!v9)try{v9=new e}catch{return null}return v9}function b9(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 x9(e){let t=Date.now();if(t-y9<wye)return;let n=Tye();if(!n)return;y9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function Eye(){x9(e=>{b9(e,660,0,.16,.12),b9(e,440,.14,.2,.1)})}function Dye(){x9(e=>{b9(e,880,0,.14,.08)})}function Oye({activeChatId:e}){let t=R(L.messages.listChats,{}),n=Se(L.chatReads.markChatSeen),r=R(L.me.getMe,{host:bz}),i=r?.ui?.effective?.replySound===!0,a=r?.userId??null,o=(0,B.useRef)(null),s=(0,B.useRef)(null);return(0,B.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&&fV(t))}l&&i&&Dye()},[t,e,i,n,a]),(0,B.useEffect)(()=>{e&&document.visibilityState===`visible`&&n({chatId:e})},[e,n]),(0,B.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&n({chatId:e})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,n]),null}function kye(e){let t=Se(L.chats.createChat),n=R(L.agents.listMyAgents),[r,i]=(0,B.useState)(!1),a=(0,B.useCallback)(async(n,r)=>{e(await t({instanceName:n,agentId:r}))},[t,e]);return{startNewChat:(0,B.useCallback)(async()=>{let e=n;if(e&&e.length===1&&e[0].state!==`deleted`){await a(e[0].instanceName,e[0].agentId);return}i(!0)},[n,a]),picker:(0,V.jsx)(hB,{open:r,onOpenChange:i,agents:n,onPick:(e,t)=>{i(!1),a(e,t)}})}}var S9=[`admin`,`user`,`pending`];function C9(){let e=R(L.me.authProviders)?.anonymous===!0,[t,n]=(0,B.useState)(!1),r=R(L.dev.listUsersDev,e?{}:`skip`),i=R(L.me.getImpersonation),a=Se(L.dev.setMyRole),o=Se(L.dev.setRole),s=Se(L.admin.startImpersonation),c=Se(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,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:sn(),children:[(0,V.jsx)(Yx,{size:13}),`DEV`]}),(0,V.jsx)(nB,{open:t,onOpenChange:n,children:(0,V.jsxs)(aB,{children:[(0,V.jsxs)(oB,{children:[(0,V.jsx)(cB,{children:kt()}),(0,V.jsx)(lB,{children:Qe()})]}),(0,V.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,V.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[cr({canonical:l?.canonical??`…`}),` `,(0,V.jsx)(fB,{variant:`outline`,children:l?.role??`…`})]}),(0,V.jsx)(`div`,{className:`oc-devsw__roles`,children:S9.map(e=>(0,V.jsx)(zd,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?Pn():e===`user`?xn():Ps()},e))})]}),d?(0,V.jsxs)(`div`,{className:`oc-devsw__imp`,children:[E(),` `,(0,V.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,V.jsx)(zd,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Js()})]}):null,(0,V.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,V.jsx)(`p`,{className:`oc-devsw__empty`,children:Yn()}):f.map(e=>(0,V.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,V.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,V.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:S9.map(e=>(0,V.jsx)(`option`,{value:e,children:e},e))}),(0,V.jsx)(zd,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?Ve():oi():Oe(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:ju()})]},e.profileId))})]})})]})}function w9({label:e,mode:t,minimal:n=!1}){let{signOut:r}=wf(),i=Se(L.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(L.me.getMe,{host:bz});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(L.me.getMe,{host:bz},{...n,themeMode:t,resolvedThemeMode:r})}),a=t??`default`;return(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{asChild:!0,children:(0,V.jsxs)(zd,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,V.jsx)(Cd,{className:`opacity-60`})]})}),(0,V.jsx)(FB,{align:`end`,className:`w-52`,children:n?(0,V.jsxs)(IB,{onClick:()=>void r(),children:[(0,V.jsx)(Nx,{}),` `,Zc()]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(LB,{children:fu()}),(0,V.jsxs)(zB,{value:a,onValueChange:e=>void i({mode:e==="default"?null:e}),children:[(0,V.jsxs)(BB,{value:`light`,children:[(0,V.jsx)(Sne,{}),` `,ua()]}),(0,V.jsxs)(BB,{value:`dark`,children:[(0,V.jsx)(pne,{}),` `,qo()]}),(0,V.jsxs)(BB,{value:`system`,children:[(0,V.jsx)(fne,{}),` `,as()]}),(0,V.jsx)(BB,{value:`default`,children:mc()})]}),(0,V.jsx)(RB,{}),(0,V.jsxs)(IB,{onClick:()=>void r(),children:[(0,V.jsx)(Nx,{}),` `,Zc()]})]})})]})}var Aye={altered_words:()=>rn(),incorrect:()=>Et(),incoherence:()=>Ye(),formatting:()=>ir(),latency:()=>jn(),api_error:()=>vn(),other:()=>js()},T9=e=>Aye[e]?.()??e,jye={anomaly_open:qx,anomaly_resolved:vx,feedback_reply:Fx,feedback_resolved:Fx,feedback_new:Fx,curation:Ex},Mye={notif_feedback_reply_admin:()=>({title:xi(),body:ee()}),notif_feedback_reply:()=>({title:xi(),body:ee()}),notif_feedback_resolved:()=>({title:Gl(),body:wo()}),notif_feedback_new:e=>({title:md(),body:Or({reference:e.reference??`?`,category:T9(e.category??`other`)})}),notif_curation_proposed:e=>({title:nl(),body:zo({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:mo(),body:au({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:oc(),body:eo({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Pl({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:Hc({kind:e.kind??`?`}),body:t.body})};function E9(e){let t=e.messageKey?Mye[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:xi(),body:ee()}:e.kind===`feedback_resolved`?{title:Gl(),body:wo()}:{title:e.title,body:e.body}}function Nye(){let e=R(L.notifications.myUnreadCount)??0,t=R(L.notifications.myNotifications),n=R(L.feedback.myFeedback),r=Se(L.notifications.markRead),i=Se(L.notifications.markAllRead),a=Se(L.notifications.clearOne),o=Se(L.notifications.clearAll),s=Se(L.feedback.closeMyFeedback),c=mh(),[l,u]=(0,B.useState)(!1),d=R(L.me.getMe,{host:bz}),p=d?.ui?.effective?.notifSound===!0,m=d?.ui?.effective?.notifSystem===!0,h=d?.userId??null,g=(0,B.useRef)(null),_=(0,B.useRef)(0),v=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!t)return;v.current!==String(h)&&(v.current=String(h),g.current=null,_.current=0);let e=t.reduce((e,t)=>Math.max(e,t.creationTime??0),0);if(g.current===null){g.current=new Set(t.map(e=>String(e._id))),_.current=e;return}let n=g.current,r=t.filter(e=>!n.has(String(e._id))&&(e.creationTime??0)>_.current);for(let e of t)n.add(String(e._id));if(_.current=Math.max(_.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&&(p&&Eye(),m&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=E9(e);try{let r=new Notification(t,{body:n,tag:String(e._id)});r.onclick=()=>window.focus()}catch{}}},[t,p,m,h]);let y=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,V.jsxs)(NB,{open:l,onOpenChange:u,children:[(0,V.jsx)(PB,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?Rc({count:e}):Ea(),children:[(0,V.jsx)(fx,{size:18,"aria-hidden":!0}),e>0?(0,V.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,V.jsxs)(FB,{align:`end`,className:`oc-notif`,children:[(0,V.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,V.jsx)(`span`,{children:vs()}),t&&t.length>0?(0,V.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:vl()}),(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Ec()})]}):null]}),t===void 0?(0,V.jsx)(`div`,{className:`oc-notif__empty`,children:$u()}):t.length===0?(0,V.jsx)(`div`,{className:`oc-notif__empty`,children:Wl()}):(0,V.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=jye[e.kind]??fx,{title:n,body:i}=E9(e);return(0,V.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?()=>y(e):void 0,children:[(0,V.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,V.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,V.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,V.jsx)(`button`,{type:`button`,title:Co(),"aria-label":Co(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,V.jsx)(xd,{size:13})}):null,(0,V.jsx)(`button`,{type:`button`,title:f(),"aria-label":f(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,V.jsx)(Dd,{size:13})})]})]}),(0,V.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,V.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(zu())})]},e._id)})}),n&&n.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:_r()}),(0,V.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,V.jsx)(Pye,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function Pye({it:e,onClose:t,onNavigate:n}){let r=yV(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1);async function f(){d(!0);try{await t(c.trim()||void 0)}catch(e){r.error(ot(),e)}finally{d(!1)}}return(0,V.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,V.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,V.jsx)(`span`,{className:`oc-notif__title`,children:T9(e.category)}),(0,V.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?ys():e.answered?ta():zi()})]}),(0,V.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(zu())}),e.thread.length>0?(0,V.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,V.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,V.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?qi():e.authorRole===`agent`?zc():Rt()}),(0,V.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,e.messageText?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`oc-notif__report-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,V.jsx)(Cd,{size:13,"aria-hidden":!0}):(0,V.jsx)(gx,{size:13,"aria-hidden":!0}),Kt()]}),i?(0,V.jsx)(`div`,{className:`oc-notif__report-msg`,children:e.messageText}):null]}):null,(0,V.jsxs)(`div`,{className:`oc-notif__report-actions`,children:[(0,V.jsx)(Ch,{to:`/chat/$chatId`,params:{chatId:e.chatId},search:{m:e.messageId},className:`oc-notif__link`,onClick:n,children:cl()}),o?null:(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:ot()})]}),o?(0,V.jsxs)(`div`,{className:`oc-notif__close-form`,children:[(0,V.jsx)(`textarea`,{className:`oc-notif__close-input`,rows:2,value:c,onChange:e=>l(e.target.value),placeholder:Ai()}),(0,V.jsxs)(`div`,{className:`oc-notif__close-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__close-confirm`,disabled:u,onClick:()=>void f(),children:pi()}),(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:ht()})]})]}):null]})}var D9=2,Fye=180;function Iye(){let e=mh(),t=(0,B.useRef)(null),n=(0,B.useRef)(null),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(0),d=(0,B.useMemo)(()=>jz(Tz,Az()),[]);(0,B.useEffect)(()=>{let e=setTimeout(()=>c(a),Fye);return()=>clearTimeout(e)},[a]);let f=s.trim(),m=R(L.search.searchConversations,f.length>=D9?{query:f}:`skip`),h=m??[],g=f.length>=D9&&m===void 0;(0,B.useEffect)(()=>{let e=e=>{Mz(e,Tz)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,B.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,B.useEffect)(()=>{u(0)},[m]),(0,B.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let _=(0,B.useCallback)((t,n)=>{i(!1),n&&a.trim()&&Bhe(n,a.trim()),e({to:`/chat/$chatId`,params:{chatId:t},...n?{search:{m:n}}:{}})},[e,a]);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":il(),children:[(0,V.jsx)(Vx,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-search-trigger__label`,children:Vo()}),(0,V.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:d})]}),(0,V.jsx)(nB,{open:r,onOpenChange:i,children:(0,V.jsxs)(aB,{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,V.jsx)(cB,{className:`sr-only`,children:go()}),(0,V.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,V.jsx)(Vx,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,V.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,h.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=h[l];t&&_(t.chatId,t.messageId)}},placeholder:su(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":cc()})]}),(0,V.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:f.length<D9?(0,V.jsx)(`div`,{className:`oc-search-palette__hint`,children:no({count:D9})}):g?(0,V.jsx)(`div`,{className:`oc-search-palette__hint`,children:Il()}):h.length===0?(0,V.jsx)(`div`,{className:`oc-search-palette__hint`,children:Wc({term:f})}):h.map((e,t)=>(0,V.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:Sc(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>_(e.chatId,e.messageId),children:[(0,V.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,V.jsx)(sne,{size:15}):(0,V.jsx)(Fx,{size:15})}),(0,V.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,V.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||Aa()}),e.snippet?(0,V.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,V.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?Cs():Sl()})]},e.chatId))}),(0,V.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`kbd`,{children:`↑`}),(0,V.jsx)(`kbd`,{children:`↓`}),` `,Ac()]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`kbd`,{children:`↵`}),` `,Yl()]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`kbd`,{children:Oo()}),` `,p()]})]})]})})]})}var O9=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`],k9=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`agentFiles`,`preferences`,`chatDefaults`],A9={users:()=>C(),groups:()=>td(),instances:()=>Gs(),bridge:()=>Kn(),injections:()=>rc(),serviceAccounts:()=>Te(),roles:()=>Re(),access:()=>mu(),traces:()=>ri(),kpi:()=>Ou(),anomalies:()=>ue(),files:()=>xo(),agentFiles:()=>d(),preferences:()=>Po(),integrations:()=>Hr(),theme:()=>pa(),chatDefaults:()=>Vr(),audit:()=>Vu(),feedbacks:()=>za(),subagentReports:()=>he(),voice:()=>Pt()},j9={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`,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`},Lye=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function M9(e){let t=new Set(e);return O9.filter(e=>t.has(j9[e]))}function N9(e){return`/settings/${e}`}function P9(e){let t=e.split(`/`)[2];return O9.includes(t)?t:void 0}var Rye={uiprefs:`preferences`},F9=[{id:`personal`,label:()=>gt(),tabs:[`preferences`,`theme`,`files`]},{id:`agents`,label:()=>Si(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>P(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>hd(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],zye=new Map(F9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function I9(e){let t=zye.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function Bye(e,t){return e.find(e=>I9(e)===t)}F9.flatMap(e=>[...e.tabs]);function Vye(){let e=R(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?ar({count:t}):`${qr()}${e.checkedAt?Ku({time:UB(e.checkedAt)}):``}`:Wa({reason:e.reason??`?`}):ge();return(0,V.jsx)(j6,{delayDuration:150,children:(0,V.jsxs)(M6,{children:[(0,V.jsx)(N6,{asChild:!0,children:(0,V.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,V.jsx)(P6,{children:r})]})})}function L9(e){let t=new Set(O9),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 O9)n.has(e)||r.push(e);return r}function Hye(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function Uye({tab:e,active:t}){let n=A9[e](),r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,V.jsx)(Vye,{}):null]});return k9.includes(e)?(0,V.jsx)(Ch,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,V.jsx)(Ch,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function Wye({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=$7({id:e});return(0,V.jsxs)(`div`,{ref:i,style:{transform:O5.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":Jt(),...n,...r,children:(0,V.jsx)(Ax,{size:14,"aria-hidden":!0})}),(0,V.jsx)(Uye,{tab:e,active:t})]})}function Gye(){let e=R(L.me.getMe,{host:bz}),t=Se(L.me.setSettingsTabOrder),n=P9(Uh({select:e=>e.pathname})),r=n===void 0?void 0:I9(n),i=(0,B.useMemo)(()=>L9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,B.useState)(i);(0,B.useEffect)(()=>o(i),[i]);let s=(0,B.useMemo)(()=>new Set(M9(e?.permissions??[])),[e?.permissions]),c=(0,B.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&I9(e)===r),[a,s,r]),l=P5(N5(m7,{activationConstraint:{distance:5}}),N5(u7,{coordinateGetter:t9}));if(r===void 0||c.length===0)return null;let u=F9.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=Hye(a,U7(c,i,s));o(l),t({order:l})}return(0,V.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,V.jsx)(R7,{sensors:l,collisionDetection:K_e,modifiers:[nye],onDragEnd:d,children:(0,V.jsx)(Z7,{items:c,strategy:cye,children:c.map(e=>(0,V.jsx)(Wye,{tab:e,active:e===n},e))})})})}function Kye(){let e=R(L.me.getMe,{host:bz}),t=mh(),n=P9(Uh({select:e=>e.pathname})),r=n===void 0?void 0:I9(n),i=(0,B.useMemo)(()=>new Set(M9(e?.permissions??[])),[e?.permissions]),a=(0,B.useMemo)(()=>L9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=F9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=Bye(a,e.id);n&&t({to:N9(n)})}return(0,V.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":ct(),children:[(0,V.jsx)(Ch,{to:`/`,className:`oc-settings-nav__back`,children:ji()}),(0,V.jsx)(`div`,{className:`oc-settings-nav__title`,children:mi()}),(0,V.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,V.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 qye=[`eq`,`neq`,`contains`,`gt`,`gte`,`lt`,`lte`],R9=[50,100,200,500],z9=`now-30d`,Jye=`now-24h`;function Yye(e,t,n=z9,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 Xye(e){return e.kind===`absolute`?{from:String(e.from),to:String(e.to)}:{from:e.from,to:e.to}}function Zye(e){if(e.length!==0)return JSON.stringify(e)}function Qye(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`||!qye.includes(i)||typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`||n.push({field:r,op:i,value:a})}return n}var B9=rb().optional(),V9=rb().optional(),H9=rb().optional(),U9=rb().optional().catch(void 0),$ye=Pb({q:B9,section:Bb([`latency`,`events`]).default(`events`).catch(`events`),kind:rb().default(`all`).catch(`all`),limit:Zte().pipe(Ib([Hb(R9[0]),Hb(R9[1]),Hb(R9[2]),Hb(R9[3])])).catch(100),statusClass:Bb([`2xx`,`4xx`,`5xx`]).optional().catch(void 0),principalType:Bb([`user`,`service`,`system`]).optional().catch(void 0),direction:Bb([`inbound`,`outbound`,`internal`]).optional().catch(void 0),roleKey:U9,from:V9,to:V9,adv:H9}),ebe=Pb({q:B9,action:U9,impersonated:Bb([`yes`,`no`]).optional().catch(void 0),resource:U9,from:V9,to:V9,adv:H9}),tbe=Pb({q:B9,status:Bb([`open`,`acknowledged`,`resolved`,`all`]).default(`open`).catch(`open`),severity:Bb([`info`,`warn`,`critical`]).optional().catch(void 0),kind:U9,from:V9,to:V9}),nbe=Pb({from:V9,to:V9}),rbe=Pb({q:B9,status:Bb([`active`,`disabled`]).optional().catch(void 0)}),ibe=Pb({q:B9,role:U9});Pb({q:B9,mode:Bb([`per-user`,`shared`]).optional().catch(void 0)});var abe=Pb({section:Bb([`readaloud`,`dictation`,`talk`]).default(`readaloud`).catch(`readaloud`)}),obe=Pb({section:rb().max(32).default(`openclaw`).catch(`openclaw`)}),W9=`oc.theme`;function G9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function K9(e){(0,B.useEffect)(()=>{let t=e??localStorage.getItem(W9)??`system`;if(localStorage.setItem(W9,t),G9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>G9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function sbe(e){(0,B.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=zu()}catch{t=void 0}t!==e&&zr(e)},[e])}var cbe=(0,B.lazy)(()=>k4(()=>import(`./RolesTab-CtV113pW.js`).then(e=>({default:e.RolesTab})),__vite__mapDeps([2,1,3,4,5]))),lbe=(0,B.lazy)(()=>k4(()=>import(`./InstancesTab-Cb_2msXj.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([6,1,3,7,8,9,10,11,12,13,14,15,16,5,17,18,19]))),ube=(0,B.lazy)(()=>k4(()=>import(`./PromptInjectionsTab-CgAFhOn5.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([20,1,3,7,8,9,21,5,22]))),dbe=(0,B.lazy)(()=>k4(()=>import(`./GroupsTab-CJUI6gQ9.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([23,1,3,13,12,24,19,14,5,17,25,15,16]))),fbe=(0,B.lazy)(()=>k4(()=>import(`./IntegrationsTab-B9Nkc7-l.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([26,1,3,5]))),pbe=(0,B.lazy)(()=>k4(()=>import(`./FeedbacksTab-D34MEu6C.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([27,1,3,19,12,14,5,17]))),mbe=(0,B.lazy)(()=>k4(()=>import(`./SubAgentReportsTab-G_s4_aPf.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([28,1,3,19,12,14,5,17]))),hbe=(0,B.lazy)(()=>k4(()=>import(`./FilesTab-ByKXXey8.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([29,1,3,5,17]))),gbe=(0,B.lazy)(()=>k4(()=>import(`./AgentFilesTab-By3Jzopm.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([30,1,3,11,8,5,22]))),_be=(0,B.lazy)(()=>k4(()=>import(`./PreferencesTab-BdvOFp2E.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([31,1,3,21,9,5]))),vbe=(0,B.lazy)(()=>k4(()=>import(`./ChatDefaultsTab-DkHZTknY.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([32,1,3,11,5,22]))),ybe=(0,B.lazy)(()=>k4(()=>import(`./AccessTab-BTTUfIwc.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([33,1,3]))),bbe=(0,B.lazy)(()=>k4(()=>import(`./ThemeShowroom-CbU-xJra.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([34,1,3,35,24,36,12,16,5,15,21,9,37,17])));function xbe(){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(rf,{children:(0,V.jsx)(`div`,{className:`oc-boot`,children:S()})}),(0,V.jsx)(nf,{children:(0,V.jsx)(Cbe,{})}),(0,V.jsx)(tf,{children:(0,V.jsx)(vV,{children:(0,V.jsx)(Tbe,{})})})]})}function Sbe(){return(0,V.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,V.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,V.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,V.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,V.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 Cbe(){let{signIn:e}=wf();K9(void 0);let t=R(L.charts.brandForHost,{host:bz}),n=Cz(bz),r=t??n??null,i=Rz(void 0);Bz(r?.tokens??null,i),(0,B.useEffect)(()=>{t&&wz(bz,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?qz(a,i):null,s=a?.label??`Atrium`,c=R(L.me.authProviders),[l,u]=(0,B.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(Ws())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.anonymous;return(0,V.jsxs)(`div`,{className:`oc-signin`,children:[(0,V.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,V.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,V.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,V.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,V.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,V.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,V.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,V.jsx)(`h1`,{className:`oc-signin__title`,children:Gn()}),(0,V.jsx)(`p`,{className:`oc-signin__subtitle`,children:we()}),(0,V.jsx)(`div`,{className:`oc-signin__providers`,children:c?.google?(0,V.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,V.jsx)(Sbe,{}),(0,V.jsx)(`span`,{children:Le()})]}):null}),l?(0,V.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,V.jsx)(`p`,{className:`oc-signin__error`,children:ni()}):null,c?.anonymous?(0,V.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:Du()}):null]})]})}function wbe(){let{width:e,collapsed:t,isMobile:n}=a8();return(0,V.jsxs)(`div`,{className:`oc-shell`,children:[(0,V.jsxs)(`header`,{className:`oc-topbar`,children:[(0,V.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,V.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`}}),(0,V.jsx)(`div`,{className:`oc-skel`,style:{width:`5.5rem`,height:`1.1rem`}})]}),(0,V.jsx)(`div`,{className:`oc-topbar__search`,children:(0,V.jsx)(`div`,{className:`oc-skel`,style:{width:`100%`,height:`2.25rem`}})}),(0,V.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,V.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`,borderRadius:`999px`}})})]}),(0,V.jsxs)(`div`,{className:n?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[!t&&!n?(0,V.jsx)(`div`,{className:`oc-sidebar-col`,style:{width:e,flex:`0 0 ${e}px`},children:(0,V.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,V.jsx)(`div`,{className:`oc-skel`,style:{height:`2.25rem`,margin:`0.25rem 0.25rem 0`}}),(0,V.jsx)(m9,{})]})}):null,(0,V.jsx)(`main`,{className:`oc-main`})]})]})}function Tbe(){let e=R(L.me.getMe,{host:bz}),t=Se(L.me.bootstrap),n=mh();(0,B.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),K9(e?.resolvedThemeMode);let r=Rz(e?.resolvedThemeMode);Bz(e?.resolvedChartTokens,r),sbe(e?.resolvedLocale);let i=(0,B.useRef)(null);if((0,B.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,V.jsx)(wbe,{});let a=e.name||e.email||le();return e.role===`pending`?(0,V.jsxs)(`div`,{className:`oc-shell`,children:[(0,V.jsx)(q9,{}),(0,V.jsx)(C9,{}),(0,V.jsxs)(`header`,{className:`oc-topbar`,children:[(0,V.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,V.jsx)(J9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,V.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,V.jsx)(w9,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,V.jsxs)(`div`,{className:`oc-pending`,children:[(0,V.jsx)(`h1`,{className:`oc-pending__title`,children:Br()}),(0,V.jsx)(`p`,{className:`oc-pending__body`,children:Bu()})]})]}):(0,V.jsx)(Dbe,{canOpenSettings:M9(e.permissions??[]).length>0,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function q9(){let e=R(L.me.getImpersonation),t=Se(L.admin.stopImpersonation);return!e||!e.impersonating?null:(0,V.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,V.jsx)(Tx,{className:`size-4 shrink-0`}),(0,V.jsxs)(`span`,{className:`oc-imp__text`,children:[Ra(),` `,(0,V.jsx)(`strong`,{children:e.targetLabel}),ed(),(0,V.jsx)(`strong`,{children:e.realLabel}),pu()]}),(0,V.jsx)(zd,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:da()})]})}function J9({brand:e,resolvedThemeMode:t}){let n=Rz(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=qz(e,n),[o,s]=(0,B.useState)(!1);return(0,B.useEffect)(()=>s(!1),[a]),(0,V.jsxs)(V.Fragment,{children:[a!==null&&!o?(0,V.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,V.jsx)(Zz,{className:`oc-brand__logo`}):null,(0,V.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function Ebe({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,V.jsxs)(`header`,{className:`oc-topbar`,children:[(0,V.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,V.jsx)(zd,{variant:`ghost`,size:`icon-sm`,"aria-label":i?Jo():os(),onClick:a,children:i?(0,V.jsx)(gne,{}):(0,V.jsx)(hne,{})}),(0,V.jsx)(Ch,{to:`/`,className:`oc-topbar__brand`,children:(0,V.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,V.jsx)(`div`,{className:`oc-topbar__search`,children:(0,V.jsx)(Iye,{})}),(0,V.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,V.jsx)(Nye,{}),(0,V.jsx)(w9,{label:e,mode:t})]})]})}function Dbe({canOpenSettings:e,userLabel:t,themeMode:n,resolvedThemeMode:r,brand:i}){let{width:a,collapsed:o,toggleCollapsed:s,collapse:c,startResize:l,isMobile:u}=a8(),d=Hh(),f=fh({strict:!1}),p=mh(),m=!!d({to:`/settings`,fuzzy:!0});(0,B.useEffect)(()=>{u&&c()},[Uh({select:e=>e.pathname}),u,c]);let h=(0,B.useCallback)(e=>{p({to:`/chat/$chatId`,params:{chatId:e}})},[p]),{startNewChat:g,picker:_}=kye(h),v=(0,B.useMemo)(()=>jz(Ez,Az()),[]);return(0,B.useEffect)(()=>{let e=e=>{Mz(e,Ez)&&(e.preventDefault(),g())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[g]),(0,V.jsxs)(`div`,{className:`oc-shell`,children:[_,(0,V.jsx)(Oye,{activeChatId:f.chatId??null}),(0,V.jsx)(q9,{}),(0,V.jsx)(C9,{}),(0,V.jsx)(Ebe,{userLabel:t,themeMode:n,resolvedThemeMode:r,brand:i,collapsed:o,onToggleSidebar:s}),(0,V.jsxs)(`div`,{className:u?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[u&&!o?(0,V.jsx)(`div`,{className:`oc-sidebar-backdrop`,onClick:c,"aria-hidden":!0}):null,o?null:(0,V.jsxs)(`div`,{className:`oc-sidebar-col`,style:u?void 0:{width:a,flex:`0 0 ${a}px`},children:[m?(0,V.jsx)(Kye,{}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Cye,{activeChatId:f.chatId??null,onSelect:h,onNewChat:()=>void g(),newChatShortcut:v}),e?(0,V.jsx)(zd,{variant:`ghost`,className:`m-2 justify-start`,asChild:!0,children:(0,V.jsx)(Ch,{to:`/settings`,children:hc()})}):null]}),(0,V.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:l,role:`separator`,"aria-orientation":`vertical`,"aria-label":Qc()})]}),(0,V.jsx)(`main`,{className:`oc-main`,children:(0,V.jsx)(Rh,{})})]})]})}function Obe(){let e=R(L.me.getMe,{host:bz}),t=mh(),n=Uh({select:e=>e.pathname}),r=(0,B.useMemo)(()=>e?M9(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,B.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,V.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:S()});if(i)return null;let a=P9(n),o=a!==void 0&&!r.includes(a);return(0,V.jsxs)(`div`,{className:`oc-admin`,children:[(0,V.jsx)(Gye,{}),(0,V.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,V.jsx)(kbe,{}):(0,V.jsx)(Rh,{})})]})}function kbe(){return(0,V.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,V.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,V.jsx)(qx,{size:28})}),(0,V.jsx)(`h2`,{className:`oc-route-error__title`,children:Fo()}),(0,V.jsx)(`p`,{className:`oc-route-error__body`,children:lo()})]})}function Abe(){let e=R(L.me.getMe,{host:bz}),t=mh();return(0,B.useEffect)(()=>{if(e===void 0)return;let n=M9(e.permissions??[]);t({to:n.includes(`files`)?N9(`files`):n.length>0?N9(n[0]):`/`,replace:!0})},[e,t]),(0,V.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:S()})}function jbe(e){switch(e){case`groups`:return(0,V.jsx)(dbe,{});case`integrations`:return(0,V.jsx)(fbe,{});case`instances`:return(0,V.jsx)(lbe,{});case`injections`:return(0,V.jsx)(ube,{});case`theme`:return(0,V.jsx)(bbe,{});case`feedbacks`:return(0,V.jsx)(pbe,{});case`subagentReports`:return(0,V.jsx)(mbe,{});case`files`:return(0,V.jsx)(hbe,{});case`agentFiles`:return(0,V.jsx)(gbe,{});case`preferences`:return(0,V.jsx)(_be,{});case`chatDefaults`:return(0,V.jsx)(vbe,{});case`access`:return(0,V.jsx)(ybe,{});default:return(0,V.jsx)(cbe,{})}}function Mbe(){let{tab:e}=fh({from:`/settings/$tab`});return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:jbe(e)})}function Nbe(){let{chatId:e}=fh({from:`/chat/$chatId`}),{m:t}=ph({from:`/chat/$chatId`});return(0,B.useEffect)(()=>{Tne(e)},[e]),(0,V.jsx)(Y8,{chatId:e,focusMessageId:t??null})}function Pbe(){let e=mh(),t=Ene(),n=R(L.messages.listChats,{}),r=t!==null&&n!==void 0&&n.some(e=>e._id===t);return(0,B.useEffect)(()=>{r&&t&&e({to:`/chat/$chatId`,params:{chatId:t},replace:!0})},[r,t,e]),t!==null&&(n===void 0||r)?(0,V.jsx)(`div`,{className:`oc-boot`,children:S()}):(0,V.jsx)(Y8,{chatId:null})}var Y9=Oh({component:xbe}),Fbe=Eh({getParentRoute:()=>Y9,path:`/`,component:Pbe}),Ibe=Eh({getParentRoute:()=>Y9,path:`chat/$chatId`,component:Nbe,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),X9=Eh({getParentRoute:()=>Y9,path:`settings`,component:Obe}),Lbe=Eh({getParentRoute:()=>X9,path:`/`,component:Abe}),Rbe=Eh({getParentRoute:()=>X9,path:`traces`,validateSearch:$ye,component:kh(()=>k4(()=>import(`./TracesTab-Wo-rxO1v.js`),__vite__mapDeps([38,1,3,13,12,35,24,19,14,5,17,36,16,15])),`TracesTab`)}),zbe=Eh({getParentRoute:()=>X9,path:`bridge`,validateSearch:obe,component:kh(()=>k4(()=>import(`./BridgeTab-DFpunFsv.js`),__vite__mapDeps([10,1,3,11,7,8,9,12,13,14,15,16,5,17,18])),`BridgeTab`)}),Bbe=Eh({getParentRoute:()=>X9,path:`voice`,validateSearch:abe,component:kh(()=>k4(()=>import(`./VoiceTab-ilUT53Ds.js`),__vite__mapDeps([39,1,3,13,12,5,22])),`VoiceTab`)}),Vbe=Eh({getParentRoute:()=>X9,path:`audit`,validateSearch:ebe,component:kh(()=>k4(()=>import(`./AuditTab-BOu6pgTB.js`),__vite__mapDeps([40,1,3,19,12,14,5,17,36,24,16,15])),`AuditTab`)}),Hbe=Eh({getParentRoute:()=>X9,path:`anomalies`,validateSearch:tbe,component:kh(()=>k4(()=>import(`./AnomaliesTab-Cs6vlfDv.js`),__vite__mapDeps([41,1,3,19,12,14,5,17,15,16,18])),`AnomaliesTab`)}),Ube=Eh({getParentRoute:()=>X9,path:`kpi`,validateSearch:nbe,component:kh(()=>k4(()=>import(`./KpiTab-B6SqslSj.js`),__vite__mapDeps([42,1,3,16,5,37])),`KpiTab`)}),Wbe=Eh({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:rbe,component:kh(()=>k4(()=>import(`./ServiceAccountsTab-Bu_j0kUL.js`),__vite__mapDeps([43,1,3,12,35,19,14,5,17,15,16,4])),`ServiceAccountsTab`)}),Gbe=Eh({getParentRoute:()=>X9,path:`users`,validateSearch:ibe,component:kh(()=>k4(()=>import(`./UsersTab-DO7Wa8iJ.js`),__vite__mapDeps([44,1,3,19,12,14,5,17,25,15,16])),`UsersTab`)}),Kbe=Eh({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw Yp({to:`/settings/$tab`,params:{tab:Rye.uiprefs},replace:!0})}}),qbe=Eh({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:Bb([...k9]).catch(`roles`).parse(e.tab)}),component:Mbe});function Jbe({error:e,reset:t}){let n=mh(),r=Dne(e),[i]=(0,B.useState)(()=>r&&Ane(Date.now()));return(0,B.useEffect)(()=>{i&&window.location.reload()},[i]),i?(0,V.jsx)(`div`,{className:`oc-route-error`,role:`status`,children:(0,V.jsx)(`p`,{className:`oc-route-error__body`,children:tu()})}):(0,V.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,V.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,V.jsx)(qx,{size:28})}),(0,V.jsx)(`h2`,{className:`oc-route-error__title`,children:nc()}),(0,V.jsx)(`p`,{className:`oc-route-error__body`,children:Za()}),(0,V.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>{r?window.location.reload():t()},children:kl()}),(0,V.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:Ic()})]})]})}function Ybe(){let e=mh();return(0,V.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,V.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,V.jsx)(nne,{size:28})}),(0,V.jsx)(`h2`,{className:`oc-route-error__title`,children:wa()}),(0,V.jsx)(`p`,{className:`oc-route-error__body`,children:gs()}),(0,V.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,V.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:Ic()})})]})}var Z9=Uee({routeTree:Y9.addChildren([Fbe,Ibe,X9.addChildren([Lbe,Rbe,Bbe,zbe,Vbe,Hbe,Ube,Wbe,Gbe,Kbe,qbe])]),defaultPreload:`intent`,defaultErrorComponent:Jbe,defaultNotFoundComponent:Ybe}),Xbe=()=>null;function Q9({children:e}){return(0,V.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=af.createRoot(document.getElementById(`root`));$9.render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(Q9,{children:$u()})})),aH().then(e=>{let t=new Eu(e);$9.render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(Tf,{client:t,children:(0,V.jsxs)(aV,{children:[(0,V.jsx)(jge,{children:(0,V.jsx)(Kee,{router:Z9})}),(0,V.jsx)(B.Suspense,{fallback:null,children:(0,V.jsx)(Xbe,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,V.jsx)(B.StrictMode,{children:(0,V.jsxs)(Q9,{children:[ko(),` `,e instanceof Error?e.message:String(e)]})}))});export{HB as $,wH as A,qx as At,sV as B,kx as Bt,d6 as C,UP as Ct,n6 as D,uN as Dt,Xpe as E,dN as Et,CV as F,Bx as Ft,ZB as G,yx as Gt,JB as H,Cx as Ht,AV as I,zx as It,QB as J,hx as Jt,tV as K,vx as Kt,wV as L,Ix as Lt,EV as M,Gx as Mt,kV as N,Hx as Nt,a6 as O,aN as Ot,bV as P,Vx as Pt,KB as Q,SV as R,Mx as Rt,p6 as S,WP as St,L4 as T,HP as Tt,nV as U,Sx as Ut,cV as V,Tx as Vt,rV as W,xx as Wt,GB as X,ph as Xt,eV as Y,mh as Yt,qB as Z,j6 as _,Lz as _t,Xye as a,LB as at,l6 as b,jz as bt,A9 as c,fB as ct,M8 as d,aB as dt,VB as et,k8 as f,lB as ft,P6 as g,Rz as gt,M6 as h,cB as ht,Zye as i,IB as it,mH as j,Kx as jt,k4 as k,Jx as kt,j9 as l,uB as lt,F6 as m,oB as mt,Jye as n,NB as nt,Qye as o,RB as ot,R6 as p,sB as pt,$B as q,gx as qt,Yye as r,FB as rt,Lye as s,PB as st,z9 as t,UB as tt,r9 as u,nB as ut,N6 as v,Az as vt,u6 as w,VP as wt,f6 as x,bz as xt,Ohe as y,Fz as yt,yV as z,jx as zt};
238
+ `},H_e={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 U_e(e){let{announcements:t=H_e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=V_e}=e,{announce:a,announcement:o}=R_e(),s=S5(`DndLiveRegion`),[c,l]=(0,B.useState)(!1);if((0,B.useEffect)(()=>{l(!0)},[]),z_e((0,B.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=B.createElement(B.Fragment,null,B.createElement(I_e,{id:r,value:i.draggable}),B.createElement(L_e,{id:s,announcement:o}));return n?(0,gh.createPortal)(u,n):u}var j5;(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`})(j5||={});function M5(){}function N5(e,t){return(0,B.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function P5(){var e=[...arguments];return(0,B.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var F5=Object.freeze({x:0,y:0});function I5(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function W_e(e,t){let n=D5(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 L5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function G_e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function R5(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 z5(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function B5(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 K_e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=B5(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=I5(B5(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(L5)},V5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=R5(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=R5(r),o=i.reduce((e,t,r)=>e+I5(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(L5)};function q_e(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 J_e=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=q_e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(G_e)};function Y_e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function H5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:F5}function X_e(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 Z_e=X_e(1);function U5(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 Q_e(e,t,n){let r=U5(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 $_e={ignoreTransform:!1};function W5(e,t){t===void 0&&(t=$_e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=u5(e).getComputedStyle(e);t&&(n=Q_e(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 G5(e){return W5(e,{ignoreTransform:!0})}function eve(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function tve(e,t){return t===void 0&&(t=u5(e).getComputedStyle(e)),t.position===`fixed`}function nve(e,t){t===void 0&&(t=u5(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 K5(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(d5(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!f5(i)||p5(i)||n.includes(i))return n;let a=u5(e).getComputedStyle(i);return i!==e&&nve(i,a)&&n.push(i),tve(i,a)?n:r(i.parentNode)}return e?r(e):n}function q5(e){let[t]=K5(e,1);return t??null}function J5(e){return!s5||!e?null:c5(e)?e:l5(e)?d5(e)||e===m5(e).scrollingElement?window:f5(e)?e:null:null}function Y5(e){return c5(e)?e.scrollX:e.scrollLeft}function X5(e){return c5(e)?e.scrollY:e.scrollTop}function Z5(e){return{x:Y5(e),y:X5(e)}}var Q5;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Q5||={});function $5(e){return!s5||!e?!1:e===document.scrollingElement}function e7(e){let t={x:0,y:0},n=$5(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 rve={x:.2,y:.2};function ive(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=rve);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=e7(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=Q5.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Q5.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Q5.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Q5.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function ave(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 t7(e){return e.reduce((e,t)=>w5(e,Z5(t)),F5)}function ove(e){return e.reduce((e,t)=>e+Y5(t),0)}function sve(e){return e.reduce((e,t)=>e+X5(t),0)}function n7(e,t){if(t===void 0&&(t=W5),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);q5(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var cve=[[`x`,[`left`,`right`],ove],[`y`,[`top`,`bottom`],sve]],r7=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=K5(t),r=t7(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of cve)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})}},i7=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 lve(e){let{EventTarget:t}=u5(e);return e instanceof t?e:m5(e)}function a7(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 o7;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(o7||={});function s7(e){e.preventDefault()}function uve(e){e.stopPropagation()}var c7;(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`})(c7||={});var l7={start:[c7.Space,c7.Enter],cancel:[c7.Esc],end:[c7.Space,c7.Enter,c7.Tab]},dve=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case c7.Right:return{...n,x:n.x+25};case c7.Left:return{...n,x:n.x-25};case c7.Down:return{...n,y:n.y+25};case c7.Up:return{...n,y:n.y-25}}},u7=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 i7(m5(t)),this.windowListeners=new i7(u5(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(o7.Resize,this.handleCancel),this.windowListeners.add(o7.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(o7.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&n7(n),t(F5)}handleKeyDown(e){if(E5(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=l7,coordinateGetter:a=dve,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}:F5;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=T5(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}=e7(n),p=ave(n),m={x:Math.min(i===c7.Right?p.right-p.width/2:p.right,Math.max(i===c7.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===c7.Down?p.bottom-p.height/2:p.bottom,Math.max(i===c7.Down?p.top:p.top+p.height/2,u.y))},h=i===c7.Right&&!s||i===c7.Left&&!c,g=i===c7.Down&&!l||i===c7.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===c7.Right&&e<=d.x||i===c7.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===c7.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===c7.Down&&e<=d.y||i===c7.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===c7.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,w5(T5(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()}};u7.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=l7,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 d7(e){return!!(e&&`distance`in e)}function f7(e){return!!(e&&`delay`in e)}var p7=class{constructor(e,t,n){n===void 0&&(n=lve(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=m5(i),this.documentListeners=new i7(this.document),this.listeners=new i7(n),this.windowListeners=new i7(u5(i)),this.initialCoordinates=D5(r)??F5,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(o7.Resize,this.handleCancel),this.windowListeners.add(o7.DragStart,s7),this.windowListeners.add(o7.VisibilityChange,this.handleCancel),this.windowListeners.add(o7.ContextMenu,s7),this.documentListeners.add(o7.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(f7(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(d7(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(o7.Click,uve,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(o7.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=D5(e)??F5,s=T5(n,o);if(!t&&a){if(d7(a)){if(a.tolerance!=null&&a7(s,a.tolerance))return this.handleCancel();if(a7(s,a.distance))return this.handleStart()}if(f7(a)&&a7(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===c7.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},fve={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},m7=class extends p7{constructor(e){let{event:t}=e,n=m5(t.target);super(e,fve,n)}};m7.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 pve={move:{name:`mousemove`},end:{name:`mouseup`}},h7;(function(e){e[e.RightClick=2]=`RightClick`})(h7||={});var mve=class extends p7{constructor(e){super(e,pve,m5(e.event.target))}};mve.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===h7.RightClick?!1:(r?.({event:n}),!0)}}];var g7={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},hve=class extends p7{constructor(e){super(e,g7)}static setup(){return window.addEventListener(g7.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(g7.move.name,e)};function e(){}}};hve.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 _7;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(_7||={});var v7;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(v7||={});function gve(e){let{acceleration:t,activator:n=_7.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=v7.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=vve({delta:d,disabled:!a}),[m,h]=j_e(),g=(0,B.useRef)({x:0,y:0}),_=(0,B.useRef)({x:0,y:0}),v=(0,B.useMemo)(()=>{switch(n){case _7.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case _7.DraggableRect:return i}},[n,i,c]),y=(0,B.useRef)(null),b=(0,B.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,B.useMemo)(()=>s===v7.TreeOrder?[...l].reverse():l,[s,l]);(0,B.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}=ive(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 _ve={x:{[Q5.Backward]:!1,[Q5.Forward]:!1},y:{[Q5.Backward]:!1,[Q5.Forward]:!1}};function vve(e){let{delta:t,disabled:n}=e,r=b5(t);return v5(e=>{if(n||!r||!e)return _ve;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q5.Backward]:e.x[Q5.Backward]||i.x===-1,[Q5.Forward]:e.x[Q5.Forward]||i.x===1},y:{[Q5.Backward]:e.y[Q5.Backward]||i.y===-1,[Q5.Forward]:e.y[Q5.Forward]||i.y===1}}},[n,t,r])}function yve(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return v5(e=>t==null?null:r??e??null,[r,t])}function bve(e,t){return(0,B.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 y7;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(y7||={});var b7;(function(e){e.Optimized=`optimized`})(b7||={});var x7=new Map;function xve(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,B.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,B.useRef)(e),d=g(),f=_5(d),p=(0,B.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,B.useRef)(null),h=v5(t=>{if(d&&!n)return x7;if(!t||t===x7||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 r7(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,B.useEffect)(()=>{u.current=e},[e]),(0,B.useEffect)(()=>{d||p()},[n,d]),(0,B.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,B.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 y7.Always:return!1;case y7.BeforeDragging:return n;default:return!n}}}function S7(e,t){return v5(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Sve(e,t){return S7(e,t)}function Cve(e){let{callback:t,disabled:n}=e,r=g5(t),i=(0,B.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,B.useEffect)(()=>()=>i?.disconnect(),[i]),i}function C7(e){let{callback:t,disabled:n}=e,r=g5(t),i=(0,B.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,B.useEffect)(()=>()=>i?.disconnect(),[i]),i}function wve(e){return new r7(W5(e),e)}function w7(e,t,n){t===void 0&&(t=wve);let[r,i]=(0,B.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=Cve({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=C7({callback:a});return h5(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Tve(e){return H5(e,S7(e))}var T7=[];function Eve(e){let t=(0,B.useRef)(e),n=v5(n=>e?n&&n!==T7&&e&&t.current&&e.parentNode===t.current.parentNode?n:K5(e):T7,[e]);return(0,B.useEffect)(()=>{t.current=e},[e]),n}function Dve(e){let[t,n]=(0,B.useState)(null),r=(0,B.useRef)(e),i=(0,B.useCallback)(e=>{let t=J5(e.target);t&&n(e=>e?(e.set(t,Z5(t)),new Map(e)):null)},[]);return(0,B.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=J5(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Z5(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=>{J5(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,B.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>w5(e,t),F5):t7(e):F5,[e,t])}function E7(e,t){t===void 0&&(t=[]);let n=(0,B.useRef)(null);return(0,B.useEffect)(()=>{n.current=null},t),(0,B.useEffect)(()=>{let t=e!==F5;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?T5(e,n.current):F5}function Ove(e){(0,B.useEffect)(()=>{if(!s5)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 kve(e,t){return(0,B.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function D7(e){return(0,B.useMemo)(()=>e?eve(e):null,[e])}var O7=[];function Ave(e,t){t===void 0&&(t=W5);let[n]=e,r=D7(n?u5(n):null),[i,a]=(0,B.useState)(O7);function o(){a(()=>e.length?e.map(e=>$5(e)?r:new r7(t(e),e)):O7)}let s=C7({callback:o});return h5(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function k7(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return f5(t)?t:e}function jve(e){let{measure:t}=e,[n,r]=(0,B.useState)(null),i=C7({callback:(0,B.useCallback)(e=>{for(let{target:n}of e)if(f5(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=y5((0,B.useCallback)(e=>{let n=k7(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,B.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Mve=[{sensor:m7,options:{}},{sensor:u7,options:{}}],Nve={current:{}},A7={draggable:{measure:G5},droppable:{measure:G5,strategy:y7.WhileDragging,frequency:b7.Optimized},dragOverlay:{measure:W5}},j7=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}},Pve={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new j7,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:M5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:A7,measureDroppableContainers:M5,windowRect:null,measuringScheduled:!1},M7={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:M5,draggableNodes:new Map,over:null,measureDroppableContainers:M5},N7=(0,B.createContext)(M7),P7=(0,B.createContext)(Pve);function Fve(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new j7}}}function Ive(e,t){switch(t.type){case j5.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case j5.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 j5.DragEnd:case j5.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case j5.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new j7(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case j5.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 j7(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case j5.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new j7(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Lve(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,B.useContext)(N7),a=b5(r),o=b5(n?.id);return(0,B.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!E5(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=P_e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function F7(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Rve(e){return(0,B.useMemo)(()=>({draggable:{...A7.draggable,...e?.draggable},droppable:{...A7.droppable,...e?.droppable},dragOverlay:{...A7.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function zve(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,B.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;h5(()=>{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=H5(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=q5(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var I7=(0,B.createContext)({...F5,scaleX:1,scaleY:1}),L7;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(L7||={});var R7=(0,B.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Mve,collisionDetection:o=J_e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,B.useReducer)(Ive,void 0,Fve),[f,p]=B_e(),[m,h]=(0,B.useState)(L7.Uninitialized),g=m===L7.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,B.useRef)({initial:null,translated:null}),C=(0,B.useMemo)(()=>_==null?null:{id:_,data:x?.data??Nve,rect:S},[_,x]),w=(0,B.useRef)(null),[T,E]=(0,B.useState)(null),[D,O]=(0,B.useState)(null),k=_5(l,Object.values(l)),A=S5(`DndDescribedBy`,t),j=(0,B.useMemo)(()=>b.getEnabled(),[b]),M=Rve(s),{droppableRects:N,measureDroppableContainers:ee,measuringScheduled:P}=xve(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),F=yve(v,_),te=(0,B.useMemo)(()=>D?D5(D):null,[D]),ne=Me(),re=Sve(F,M.draggable.measure);zve({activeNode:_==null?null:v.get(_),config:ne.layoutShiftCompensation,initialRect:re,measure:M.draggable.measure});let ie=w7(F,M.draggable.measure,re),ae=w7(F?F.parentElement:null),oe=(0,B.useRef)({activatorEvent:null,active:null,activeNode:F,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),se=b.getNodeFor(oe.current.over?.id),ce=jve({measure:M.dragOverlay.measure}),le=ce.nodeRef.current??F,ue=g?ce.rect??ie:null,de=!!(ce.nodeRef.current&&ce.rect),fe=Tve(de?null:ie),pe=D7(le?u5(le):null),me=Eve(g?se??F:null),he=Ave(me),ge=F7(c,{transform:{x:y.x-fe.x,y:y.y-fe.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:ie,containerNodeRect:ae,draggingNodeRect:ue,over:oe.current.over,overlayNodeRect:ce.rect,scrollableAncestors:me,scrollableAncestorRects:he,windowRect:pe}),_e=te?w5(te,y):null,ve=Dve(me),ye=E7(ve),I=E7(ve,[ie]),be=w5(ge,ye),xe=ue?Z_e(ue,ge):null,Se=C&&xe?o({active:C,collisionRect:xe,droppableRects:N,droppableContainers:j,pointerCoordinates:_e}):null,Ce=z5(Se,`id`),[we,Te]=(0,B.useState)(null),Ee=Y_e(de?ge:w5(ge,I),we?.rect??null,ie),De=(0,B.useRef)(null),Oe=(0,B.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;De.current=new n({active:w.current,activeNode:i,event:a,options:r,context:oe,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,gh.unstable_batchedUpdates)(()=>{r?.(i),h(L7.Initializing),d({type:j5.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(De.current),O(a)})},onMove(e){d({type:j5.DragMove,coordinates:e})},onEnd:o(j5.DragEnd),onCancel:o(j5.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=oe.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===j5.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=j5.DragCancel)}w.current=null,(0,gh.unstable_batchedUpdates)(()=>{d({type:e}),h(L7.Uninitialized),Te(null),E(null),O(null),De.current=null;let t=e===j5.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),ke=bve(a,(0,B.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,Oe(n,t))},[v,Oe]));Ove(a),h5(()=>{ie&&m===L7.Initializing&&h(L7.Initialized)},[ie,m]),(0,B.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=oe.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:be.x,y:be.y},over:i};(0,gh.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[be.x,be.y]),(0,B.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=oe.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Ce),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,gh.unstable_batchedUpdates)(()=>{Te(s),a?.(c),f({type:`onDragOver`,event:c})})},[Ce]),h5(()=>{oe.current={activatorEvent:D,active:C,activeNode:F,collisionRect:xe,collisions:Se,droppableRects:N,draggableNodes:v,draggingNode:le,draggingNodeRect:ue,droppableContainers:b,over:we,scrollableAncestors:me,scrollAdjustedTranslate:be},S.current={initial:ue,translated:xe}},[C,F,Se,xe,v,le,ue,N,b,we,me,be]),gve({...ne,delta:y,draggingRect:xe,pointerCoordinates:_e,scrollableAncestors:me,scrollableAncestorRects:he});let Ae=(0,B.useMemo)(()=>({active:C,activeNode:F,activeNodeRect:ie,activatorEvent:D,collisions:Se,containerNodeRect:ae,dragOverlay:ce,draggableNodes:v,droppableContainers:b,droppableRects:N,over:we,measureDroppableContainers:ee,scrollableAncestors:me,scrollableAncestorRects:he,measuringConfiguration:M,measuringScheduled:P,windowRect:pe}),[C,F,ie,D,Se,ae,ce,v,b,N,we,ee,me,he,M,P,pe]),je=(0,B.useMemo)(()=>({activatorEvent:D,activators:ke,active:C,activeNodeRect:ie,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:we,measureDroppableContainers:ee}),[D,ke,C,ie,d,A,v,we,ee]);return B.createElement(A5.Provider,{value:p},B.createElement(N7.Provider,{value:je},B.createElement(P7.Provider,{value:Ae},B.createElement(I7.Provider,{value:Ee},i)),B.createElement(Lve,{disabled:n?.restoreFocus===!1})),B.createElement(U_e,{...n,hiddenTextDescribedById:A}));function Me(){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}}}),Bve=(0,B.createContext)(null),z7=`button`,Vve=`Draggable`;function Hve(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=S5(Vve),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,B.useContext)(N7),{role:p=z7,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,B.useContext)(g?I7:Bve),[v,y]=y5(),[b,x]=y5(),S=kve(o,t),C=_5(n);return h5(()=>(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,B.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===z7?!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 B7(){return(0,B.useContext)(P7)}var Uve=`Droppable`,Wve={timeout:25};function V7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=S5(Uve),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,B.useContext)(N7),u=(0,B.useRef)({disabled:n}),d=(0,B.useRef)(!1),f=(0,B.useRef)(null),p=(0,B.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Wve,...i},_=_5(h??r),v=C7({callback:(0,B.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]=y5((0,B.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=_5(t);return(0,B.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,B.useEffect)(()=>(s({type:j5.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:j5.UnregisterDroppable,key:a,id:r})),[r]),(0,B.useEffect)(()=>{n!==u.current.disabled&&(s({type:j5.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 Gve(e){let{animation:t,children:n}=e,[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null),s=b5(n);return!n&&!r&&s&&i(s),h5(()=>{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]),B.createElement(B.Fragment,null,n,r?(0,B.cloneElement)(r,{ref:o}):null)}var Kve={x:0,y:0,scaleX:1,scaleY:1};function qve(e){let{children:t}=e;return B.createElement(N7.Provider,{value:M7},B.createElement(I7.Provider,{value:Kve},t))}var Jve={position:`fixed`,touchAction:`none`},Yve=e=>E5(e)?`transform 250ms ease`:void 0,Xve=(0,B.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Yve}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Jve,width:s.width,height:s.height,top:s.top,left:s.left,transform:O5.Transform.toString(d),transformOrigin:i&&r?W_e(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return B.createElement(n,{className:o,style:f,ref:t},a)}),Zve={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:O5.Transform.toString(t)},{transform:O5.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 Qve(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return g5((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=k7(a);if(!c)return;let{transform:l}=u5(a).getComputedStyle(a),u=U5(l);if(!u)return;let d=typeof t==`function`?t:$ve(t);return n7(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 $ve(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Zve,...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 H7=0;function eye(e){return(0,B.useMemo)(()=>{if(e!=null)return H7++,H7},[e])}var tye=B.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}=B7(),S=(0,B.useContext)(I7),C=eye(d?.id),w=F7(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=S7(f),E=Qve({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return B.createElement(qve,null,B.createElement(Gve,{animation:E},d&&C?B.createElement(Xve,{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))}),nye=e=>{let{transform:t}=e;return{...t,y:0}};function rye(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 iye=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:rye(n,t,i)},aye=e=>{let{transform:t}=e;return{...t,x:0}};function U7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function W7(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function G7(e){return e!==null&&e>=0}function oye(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 sye(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var K7={scaleX:1,scaleY:1},cye=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=lye(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,...K7}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...K7}:a<r&&a>=i?{x:o.width+s,y:0,...K7}:{x:0,y:0,...K7}};function lye(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 q7=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=U7(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}},J7={scaleX:1,scaleY:1},uye=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,...J7}:null}let s=dye(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...J7}:r<t&&r>=a?{x:0,y:o.height+s,...J7}:{x:0,y:0,...J7}};function dye(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 Y7=`Sortable`,X7=B.createContext({activeIndex:-1,containerId:Y7,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:q7,disabled:{draggable:!1,droppable:!1}});function Z7(e){let{children:t,id:n,items:r,strategy:i=q7,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=B7(),d=S5(Y7,n),f=s.rect!==null,p=(0,B.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,B.useRef)(p),v=!oye(p,_.current),y=g!==-1&&h===-1||v,b=sye(a);h5(()=>{v&&m&&u(p)},[v,p,m,u]),(0,B.useEffect)(()=>{_.current=p},[p]);let x=(0,B.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:W7(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return B.createElement(X7.Provider,{value:x},t)}var fye=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return U7(n,r,i).indexOf(t)},pye=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},mye={duration:200,easing:`ease`},Q7=`transform`,hye=O5.Transition.toString({property:Q7,duration:0,easing:`linear`}),gye={roleDescription:`sortable`};function _ye(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,B.useState)(null),s=(0,B.useRef)(n);return h5(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=W5(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,B.useEffect)(()=>{a&&o(null)},[a]),a}function $7(e){let{animateLayoutChanges:t=pye,attributes:n,disabled:r,data:i,getNewIndex:a=fye,id:o,strategy:s,resizeObserverConfig:c,transition:l=mye}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,B.useContext)(X7),y=vye(r,p),b=u.indexOf(o),x=(0,B.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,B.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=V7({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:ee,setActivatorNodeRef:P,transform:F}=Hve({id:o,data:x,attributes:{...gye,...n},disabled:y.draggable}),te=A_e(E,j),ne=!!D,re=ne&&!m&&G7(f)&&G7(g),ie=!_&&N,ae=re?(ie&&re?F:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,oe=G7(f)&&G7(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,se=D?.id,ce=(0,B.useRef)({activeId:se,items:u,newIndex:oe,containerId:d}),le=u!==ce.current.items,ue=t({active:D,containerId:d,isDragging:N,isSorting:ne,id:o,index:b,items:u,newIndex:ce.current.newIndex,previousItems:ce.current.items,previousContainerId:ce.current.containerId,transition:l,wasDragging:ce.current.activeId!=null}),de=_ye({disabled:!ue,index:b,node:w,rect:C});return(0,B.useEffect)(()=>{ne&&ce.current.newIndex!==oe&&(ce.current.newIndex=oe),d!==ce.current.containerId&&(ce.current.containerId=d),u!==ce.current.items&&(ce.current.items=u)},[ne,oe,d,u]),(0,B.useEffect)(()=>{if(se===ce.current.activeId)return;if(se!=null&&ce.current.activeId==null){ce.current.activeId=se;return}let e=setTimeout(()=>{ce.current.activeId=se},50);return()=>clearTimeout(e)},[se]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:oe,items:u,isOver:T,isSorting:ne,isDragging:N,listeners:M,node:w,overIndex:g,over:ee,setNodeRef:te,setActivatorNodeRef:P,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:de??ae,transition:fe()};function fe(){if(de||le&&ce.current.newIndex===b)return hye;if(!(ie&&!E5(O)||!l)&&(ne||ue))return O5.Transition.toString({...l,property:Q7})}}function vye(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function e9(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 yye=[c7.Down,c7.Right,c7.Up,c7.Left],t9=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(yye.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 c7.Down:r.top<a.top&&t.push(n);break;case c7.Up:r.top>a.top&&t.push(n);break;case c7.Left:r.left>a.left&&t.push(n);break;case c7.Right:r.left<a.left&&t.push(n);break}});let c=V5({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=z5(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=K5(c).some((e,t)=>s[t]!==e),i=n9(e,t),a=bye(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:T5(u,l)}}}};function n9(e,t){return!e9(e)||!e9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function bye(e,t){return!e9(e)||!e9(t)||!n9(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function r9({open:e,onOpenChange:t,title:n,description:r,children:i,onSubmit:a,submitLabel:o,submitting:s=!1,canSubmit:c=!0}){let[l,u]=(0,B.useState)(!1),d=s||l;async function f(){if(!(!c||d))try{u(!0),await a()}finally{u(!1)}}return(0,V.jsx)(o8,{open:e,onOpenChange:t,children:(0,V.jsxs)(s8,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,V.jsxs)(c8,{className:`border-b px-6 py-4`,children:[(0,V.jsx)(u8,{children:n}),r?(0,V.jsx)(d8,{children:r}):null]}),(0,V.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,V.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:i}),(0,V.jsxs)(l8,{className:`border-t px-6 py-4`,children:[(0,V.jsxs)(zd,{type:`submit`,disabled:!c||d,children:[d?(0,V.jsx)(jx,{className:`size-4 animate-spin`}):null,o??ws()]}),(0,V.jsx)(zd,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:Cl()})]})]})]})})}var i9=6e4,a9=60*i9,o9=24*a9,s9=7*o9,c9=30*o9,l9=365*o9;function xye(e,t){let n=t-e;if(n<i9)return`maintenant`;if(n<a9)return`${Math.floor(n/i9)}min`;if(n<o9)return`${Math.floor(n/a9)}h`;if(n<s9)return`${Math.floor(n/o9)}j`;if(n<c9)return`${Math.floor(n/s9)}sem`;if(n<l9)return`${Math.floor(n/c9)}mois`;let r=Math.floor(n/l9);return`${r}an${r>1?`s`:``}`}var u9=[{value:`red`,hue:`oklch(0.63 0.21 25)`},{value:`orange`,hue:`oklch(0.7 0.17 50)`},{value:`amber`,hue:`oklch(0.8 0.15 85)`},{value:`green`,hue:`oklch(0.7 0.16 150)`},{value:`teal`,hue:`oklch(0.7 0.12 190)`},{value:`blue`,hue:`oklch(0.62 0.19 250)`},{value:`violet`,hue:`oklch(0.6 0.2 300)`},{value:`pink`,hue:`oklch(0.7 0.2 350)`}],d9=e=>u9.find(t=>t.value===e)?.hue??null,f9=`project:none`,Sye=e=>`project:${e}`,p9=`oc.noproject.collapsed`;function m9(){return(0,V.jsx)(`div`,{className:`oc-sidebar__skeleton`,"aria-hidden":`true`,children:Array.from({length:7}).map((e,t)=>(0,V.jsx)(`div`,{className:`oc-skel oc-skel--row`},t))})}function Cye({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=R(L.messages.listChats,{}),a=R(L.projects.listProjects,{}),o=R(L.me.getMe,{host:bz})?.ui?.effective,s=o?.showChatProvider??!0,c=o?.showChatAge??!0,l=new Set((i??[]).map(e=>e.providerKind).filter(e=>e!=null)),u=s&&l.size>1,d=R(L.chatReads.myChatReads,{}),f=(0,B.useMemo)(()=>{let e=new Map;for(let t of d??[])e.set(t.chatId,t.lastSeenAt);return e},[d]),p=(0,B.useMemo)(()=>{let t=new Set;for(let n of i??[]){if(n._id===e)continue;let r=f.get(n._id);r!==void 0&&n.lastAssistantAt!==null&&n.lastAssistantAt>r&&t.add(n._id)}return t},[i,f,e]),[,m]=(0,B.useState)(0);(0,B.useEffect)(()=>{if(!c)return;let e=window.setInterval(()=>m(e=>e+1),6e4);return()=>window.clearInterval(e)},[c]);let h=Se(L.projects.createProject),g=Se(L.projects.setProjectCollapsed),_=Se(L.chats.reorderChat),v=Se(L.chats.moveChatToProject),y=cV(),b=pe(),x=(0,B.useRef)(null),S=(0,B.useRef)(null),C=(0,B.useRef)(null),[w,T]=(0,B.useState)(`full`);(0,B.useLayoutEffect)(()=>{let e=x.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=S.current?.offsetWidth??0,r=C.current?.offsetWidth??0,i=n===0||t>=n?`full`:t>=r?`label`:`icon`;T(e=>e===i?e:i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[b,r]);let[E,D]=(0,B.useState)(null),O=(0,B.useRef)(!1);(0,B.useEffect)(()=>{!O.current&&i&&D(i)},[i]);let k=E??i??[],A=i===void 0&&E===null,[j,M]=(0,B.useState)(null),[N,ee]=(0,B.useState)(()=>localStorage.getItem(p9)===`1`);function P(){ee(e=>(localStorage.setItem(p9,e?`0`:`1`),!e))}let F=mV();(0,B.useEffect)(()=>{if(!F)return;let e=k.find(e=>e._id===F);if(!e)return;let t=e.projectId??null;if(t===null){N&&(localStorage.setItem(p9,`0`),ee(!1));return}(a??[]).find(e=>e._id===t)?.collapsed&&g({projectId:t,collapsed:!1})},[F,k,a,N,g]);let te=P5(N5(m7,{activationConstraint:{distance:4}}),N5(u7,{coordinateGetter:t9})),ne=k.filter(e=>e.pinned),re=k.filter(e=>!e.pinned),ie=e=>re.filter(t=>(t.projectId??null)===e);function ae(e){return k.find(t=>t._id===e)}async function oe(e){M(null);let{active:t,over:n}=e;if(!n)return;let r=ae(String(t.id));if(!r)return;let i=String(n.id);if(i.startsWith(`project:`)){let e=i===f9?null:i.slice(8);if((r.projectId??null)===e)return;O.current=!0,D(t=>(t??k).map(t=>t._id===r._id?{...t,projectId:e}:t));try{await v({chatId:r._id,projectId:e})}finally{O.current=!1}return}let a=ae(i);if(!a||t.id===n.id)return;if((a.projectId??null)!==(r.projectId??null)||a.pinned!==r.pinned){if(r.pinned||a.pinned)return;O.current=!0,D(e=>(e??k).map(e=>e._id===r._id?{...e,projectId:a.projectId??null}:e));try{await v({chatId:r._id,projectId:a.projectId??null})}finally{O.current=!1}return}let o=a.pinned?ne:ie(a.projectId??null),s=o.map(e=>e._id),c=s.indexOf(r._id),l=s.indexOf(a._id);if(c<0||l<0)return;let u=[...o];u.splice(c,1),u.splice(l,0,r);let d=u[l-1]??null,f=u[l+1]??null;O.current=!0,D(e=>[...(e??k).filter(e=>!o.some(t=>t._id===e._id)),...u]);try{await _({chatId:r._id,prevKey:d?d.sortKey:null,nextKey:f?f.sortKey:null})}finally{O.current=!1}}let se=j?ae(j):null;return(0,V.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,V.jsxs)(`div`,{className:`oc-sidebar__top`,ref:x,children:[(0,V.jsxs)(zd,{className:w===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,title:`${b} (${r})`,"aria-label":b,children:[(0,V.jsx)(zx,{}),w===`icon`?null:(0,V.jsx)(`span`,{className:`oc-newchat__label`,children:b}),w===`full`?(0,V.jsx)(`kbd`,{className:`oc-newchat__kbd`,"aria-hidden":!0,children:r}):null]}),(0,V.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,V.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:S,children:[(0,V.jsxs)(zd,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,V.jsx)(zx,{}),(0,V.jsx)(`span`,{className:`oc-newchat__label`,children:b}),(0,V.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,V.jsx)(zd,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,V.jsx)(Ox,{})})]})}),(0,V.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,V.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:C,children:[(0,V.jsxs)(zd,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,V.jsx)(zx,{}),(0,V.jsx)(`span`,{className:`oc-newchat__label`,children:b})]}),(0,V.jsx)(zd,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,V.jsx)(Ox,{})})]})}),(0,V.jsx)(zd,{className:`oc-newproject`,variant:`outline`,size:`icon`,"aria-label":Gr(),title:Gr(),onClick:async()=>{let e=await y({title:Gr(),label:Wu(),placeholder:Ha(),confirmLabel:id()});e&&await h({name:e})},children:(0,V.jsx)(Ox,{})})]}),(0,V.jsxs)(R7,{sensors:te,collisionDetection:V5,modifiers:[aye,iye],onDragStart:e=>M(e.active.id),onDragCancel:()=>M(null),onDragEnd:oe,children:[(0,V.jsx)(`div`,{className:`oc-sidebar__scroll`,children:A?(0,V.jsx)(m9,{}):(0,V.jsxs)(V.Fragment,{children:[ne.length>0?(0,V.jsx)(h9,{label:_u(),chats:ne,children:ne.map(n=>(0,V.jsx)(_9,{chat:n,active:n._id===e,unread:p.has(n._id),projects:a??[],onSelect:t,showProviderBadge:u},n._id))}):null,(a??[]).map(n=>{let r=ie(n._id);return(0,V.jsx)(h9,{label:n.name,dropId:Sye(n._id),projectId:n._id,chats:r,collapsible:!0,collapsed:n.collapsed,onToggle:()=>void g({projectId:n._id,collapsed:!n.collapsed}),children:n.collapsed?null:r.length===0?(0,V.jsx)(`div`,{className:`oc-sidebar__empty`,children:ha()}):r.map(n=>(0,V.jsx)(_9,{chat:n,active:n._id===e,unread:p.has(n._id),projects:a??[],onSelect:t,showProviderBadge:u},n._id))},n._id)}),(0,V.jsx)(h9,{label:Zo(),dropId:f9,chats:ie(null),collapsible:!0,collapsed:N,onToggle:P,children:N?null:ie(null).map(n=>(0,V.jsx)(_9,{chat:n,active:n._id===e,unread:p.has(n._id),projects:a??[],onSelect:t,showProviderBadge:u},n._id))})]})}),(0,V.jsx)(tye,{children:se?(0,V.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[(0,V.jsx)(Ax,{className:`size-3.5 opacity-60`}),d9(se.color)?(0,V.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:d9(se.color)}}):(0,V.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,V.jsx)(`span`,{className:`oc-chatitem__label`,children:se.title||ls()})]}):null})]})]})}function h9({label:e,dropId:t,projectId:n,chats:r,collapsible:i,collapsed:a,onToggle:o,children:s}){let c=Se(L.projects.deleteProject),l=sV(),u=R(L.projects.projectChatCount,n?{projectId:n}:`skip`),{setNodeRef:d,isOver:f}=V7({id:t??`static:${e}`});return(0,V.jsxs)(`div`,{ref:t?d:void 0,className:`oc-sidebar__group`+(f?` oc-sidebar__group--over`:``),children:[(0,V.jsxs)(`div`,{className:`oc-sidebar__group-head`+(i?` oc-sidebar__group-head--btn`:``),...i?{role:`button`,tabIndex:0,onClick:o,onKeyDown:e=>{i&&o&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())}}:{},children:[i?a?(0,V.jsx)(gx,{className:`size-3.5`}):(0,V.jsx)(Cd,{className:`size-3.5`}):null,(0,V.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,V.jsx)(`button`,{className:`oc-sidebar__group-del`,"aria-label":Ro(),onClick:async t=>{t.stopPropagation();let r=u??0;await l({title:po({name:e}),description:r>0?iu({count:r}):ac(),confirmWord:$a(),confirmLabel:Ro(),destructive:!0})&&await c({projectId:n})},children:(0,V.jsx)(Kx,{className:`size-3.5`})}):null]}),(0,V.jsx)(Z7,{items:r.map(e=>e._id),strategy:uye,children:s})]})}var g9={openclaw:`OpenClaw`,hermes:`Hermes`};function _9({chat:e,active:t,unread:n,projects:r,onSelect:i,showProviderBadge:a}){let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=$7({id:e._id}),f=Se(L.chats.renameChat),p=Se(L.chats.deleteChat),m=Se(L.chats.pinChat),h=Se(L.chats.setChatColor),g=R(L.me.getMe,{host:bz})?.ui?.effective?.showChatAge??!0,v=sV(),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(e.title??``),C=mV()===e._id,w=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!C)return;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;w.current?.scrollIntoView({block:`nearest`,behavior:t?`auto`:`smooth`});let n=setTimeout(()=>pV(e._id),2600);return()=>clearTimeout(n)},[C,e._id]);let T={transform:O5.Transform.toString(l),transition:u,opacity:+!d},E=d9(e.color);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{ref:e=>{c(e),w.current=e},style:T,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``)+(C?` oc-chatitem--flash`:``),onAnimationEnd:t=>{C&&t.animationName===`oc-chatitem-flash`&&pV(e._id)},children:[(0,V.jsx)(`button`,{className:`oc-chatitem__grip`,"aria-label":Nl(),...o,...s,children:(0,V.jsx)(Ax,{className:`size-3.5`})}),E?(0,V.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:E}}):(0,V.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,V.jsx)(`button`,{className:`oc-chatitem__label`,onClick:()=>i(e._id),children:e.title||ls()}),n?(0,V.jsx)(`span`,{className:`oc-chatitem__unread`,title:vc(),"aria-label":vc()}):null,e.readOnly?(0,V.jsx)(`span`,{className:`oc-chatitem__readonly`,title:tl(),children:(0,V.jsx)(Mx,{size:12,"aria-label":tl()})}):null,a&&e.providerKind?(0,V.jsx)(`span`,{className:`oc-chatitem__bridge oc-chatitem__bridge--${e.providerKind} group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Sr({provider:g9[e.providerKind]}),children:g9[e.providerKind]}):null,g?(0,V.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:VB(e.updatedAt),children:xye(e.updatedAt,Date.now())}):null,(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{asChild:!0,children:(0,V.jsx)(zd,{variant:`ghost`,size:`icon-xs`,"aria-label":Vc(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,V.jsx)(Cx,{})})}),(0,V.jsxs)(FB,{align:`end`,className:`w-48`,children:[(0,V.jsxs)(IB,{onSelect:()=>{S(e.title??``),b(!0)},children:[(0,V.jsx)(Rx,{}),` `,Oa()]}),(0,V.jsxs)(IB,{onSelect:()=>void m({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,V.jsx)(vne,{}):(0,V.jsx)(_ne,{}),e.pinned?xs():bl()]}),(0,V.jsx)(LB,{children:Oc()}),(0,V.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void h({chatId:e._id,color:null}),"aria-label":ql(),children:`✕`}),u9.map(t=>(0,V.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void h({chatId:e._id,color:t.value})},t.value))]}),(0,V.jsx)(RB,{}),(0,V.jsxs)(IB,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await v({title:Eo(),description:_(),confirmLabel:$a(),destructive:!0})&&await p({chatId:e._id})})},children:[(0,V.jsx)(Kx,{}),` `,$a()]})]})]})]}),(0,V.jsx)(r9,{open:y,onOpenChange:b,title:oa(),canSubmit:x.trim().length>0,onSubmit:async()=>{await f({chatId:e._id,title:x.trim()}),b(!1)},children:(0,V.jsx)(`div`,{className:`oc-form`,children:(0,V.jsxs)(`label`,{className:`oc-field`,children:[(0,V.jsx)(`span`,{className:`oc-field__label`,children:Wi()}),(0,V.jsx)(uB,{value:x,onChange:e=>S(e.target.value),autoFocus:!0})]})})})]})}var v9=null,y9=0,wye=400;function Tye(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!v9)try{v9=new e}catch{return null}return v9}function b9(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 x9(e){let t=Date.now();if(t-y9<wye)return;let n=Tye();if(!n)return;y9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function Eye(){x9(e=>{b9(e,660,0,.16,.12),b9(e,440,.14,.2,.1)})}function Dye(){x9(e=>{b9(e,880,0,.14,.08)})}function Oye({activeChatId:e}){let t=R(L.messages.listChats,{}),n=Se(L.chatReads.markChatSeen),r=R(L.me.getMe,{host:bz}),i=r?.ui?.effective?.replySound===!0,a=r?.userId??null,o=(0,B.useRef)(null),s=(0,B.useRef)(null);return(0,B.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&&fV(t))}l&&i&&Dye()},[t,e,i,n,a]),(0,B.useEffect)(()=>{e&&document.visibilityState===`visible`&&n({chatId:e})},[e,n]),(0,B.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&n({chatId:e})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,n]),null}function kye(e){let t=Se(L.chats.createChat),n=R(L.agents.listMyAgents),[r,i]=(0,B.useState)(!1),a=(0,B.useCallback)(async(n,r)=>{e(await t({instanceName:n,agentId:r}))},[t,e]);return{startNewChat:(0,B.useCallback)(async()=>{let e=n;if(e&&e.length===1&&e[0].state!==`deleted`){await a(e[0].instanceName,e[0].agentId);return}i(!0)},[n,a]),picker:(0,V.jsx)(hB,{open:r,onOpenChange:i,agents:n,onPick:(e,t)=>{i(!1),a(e,t)}})}}var S9=[`admin`,`user`,`pending`];function C9(){let e=R(L.me.authProviders)?.anonymous===!0,[t,n]=(0,B.useState)(!1),r=R(L.dev.listUsersDev,e?{}:`skip`),i=R(L.me.getImpersonation),a=Se(L.dev.setMyRole),o=Se(L.dev.setRole),s=Se(L.admin.startImpersonation),c=Se(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,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:sn(),children:[(0,V.jsx)(Yx,{size:13}),`DEV`]}),(0,V.jsx)(nB,{open:t,onOpenChange:n,children:(0,V.jsxs)(aB,{children:[(0,V.jsxs)(oB,{children:[(0,V.jsx)(cB,{children:kt()}),(0,V.jsx)(lB,{children:Qe()})]}),(0,V.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,V.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[cr({canonical:l?.canonical??`…`}),` `,(0,V.jsx)(fB,{variant:`outline`,children:l?.role??`…`})]}),(0,V.jsx)(`div`,{className:`oc-devsw__roles`,children:S9.map(e=>(0,V.jsx)(zd,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?Pn():e===`user`?xn():Ps()},e))})]}),d?(0,V.jsxs)(`div`,{className:`oc-devsw__imp`,children:[E(),` `,(0,V.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,V.jsx)(zd,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Js()})]}):null,(0,V.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,V.jsx)(`p`,{className:`oc-devsw__empty`,children:Yn()}):f.map(e=>(0,V.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,V.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,V.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:S9.map(e=>(0,V.jsx)(`option`,{value:e,children:e},e))}),(0,V.jsx)(zd,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?Ve():oi():Oe(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:ju()})]},e.profileId))})]})})]})}function w9({label:e,mode:t,minimal:n=!1}){let{signOut:r}=wf(),i=Se(L.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(L.me.getMe,{host:bz});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(L.me.getMe,{host:bz},{...n,themeMode:t,resolvedThemeMode:r})}),a=t??`default`;return(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{asChild:!0,children:(0,V.jsxs)(zd,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,V.jsx)(Cd,{className:`opacity-60`})]})}),(0,V.jsx)(FB,{align:`end`,className:`w-52`,children:n?(0,V.jsxs)(IB,{onClick:()=>void r(),children:[(0,V.jsx)(Nx,{}),` `,Zc()]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(LB,{children:fu()}),(0,V.jsxs)(zB,{value:a,onValueChange:e=>void i({mode:e==="default"?null:e}),children:[(0,V.jsxs)(BB,{value:`light`,children:[(0,V.jsx)(Sne,{}),` `,ua()]}),(0,V.jsxs)(BB,{value:`dark`,children:[(0,V.jsx)(pne,{}),` `,qo()]}),(0,V.jsxs)(BB,{value:`system`,children:[(0,V.jsx)(fne,{}),` `,as()]}),(0,V.jsx)(BB,{value:`default`,children:mc()})]}),(0,V.jsx)(RB,{}),(0,V.jsxs)(IB,{onClick:()=>void r(),children:[(0,V.jsx)(Nx,{}),` `,Zc()]})]})})]})}var Aye={altered_words:()=>rn(),incorrect:()=>Et(),incoherence:()=>Ye(),formatting:()=>ir(),latency:()=>jn(),api_error:()=>vn(),other:()=>js()},T9=e=>Aye[e]?.()??e,jye={anomaly_open:qx,anomaly_resolved:vx,feedback_reply:Fx,feedback_resolved:Fx,feedback_new:Fx,curation:Ex},Mye={notif_feedback_reply_admin:()=>({title:xi(),body:ee()}),notif_feedback_reply:()=>({title:xi(),body:ee()}),notif_feedback_resolved:()=>({title:Gl(),body:wo()}),notif_feedback_new:e=>({title:md(),body:Or({reference:e.reference??`?`,category:T9(e.category??`other`)})}),notif_curation_proposed:e=>({title:nl(),body:zo({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:mo(),body:au({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:oc(),body:eo({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Pl({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:Hc({kind:e.kind??`?`}),body:t.body})};function E9(e){let t=e.messageKey?Mye[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:xi(),body:ee()}:e.kind===`feedback_resolved`?{title:Gl(),body:wo()}:{title:e.title,body:e.body}}function Nye(){let e=R(L.notifications.myUnreadCount)??0,t=R(L.notifications.myNotifications),n=R(L.feedback.myFeedback),r=Se(L.notifications.markRead),i=Se(L.notifications.markAllRead),a=Se(L.notifications.clearOne),o=Se(L.notifications.clearAll),s=Se(L.feedback.closeMyFeedback),c=mh(),[l,u]=(0,B.useState)(!1),d=R(L.me.getMe,{host:bz}),p=d?.ui?.effective?.notifSound===!0,m=d?.ui?.effective?.notifSystem===!0,h=d?.userId??null,g=(0,B.useRef)(null),_=(0,B.useRef)(0),v=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!t)return;v.current!==String(h)&&(v.current=String(h),g.current=null,_.current=0);let e=t.reduce((e,t)=>Math.max(e,t.creationTime??0),0);if(g.current===null){g.current=new Set(t.map(e=>String(e._id))),_.current=e;return}let n=g.current,r=t.filter(e=>!n.has(String(e._id))&&(e.creationTime??0)>_.current);for(let e of t)n.add(String(e._id));if(_.current=Math.max(_.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&&(p&&Eye(),m&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=E9(e);try{let r=new Notification(t,{body:n,tag:String(e._id)});r.onclick=()=>window.focus()}catch{}}},[t,p,m,h]);let y=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,V.jsxs)(NB,{open:l,onOpenChange:u,children:[(0,V.jsx)(PB,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?Rc({count:e}):Ea(),children:[(0,V.jsx)(fx,{size:18,"aria-hidden":!0}),e>0?(0,V.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,V.jsxs)(FB,{align:`end`,className:`oc-notif`,children:[(0,V.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,V.jsx)(`span`,{children:vs()}),t&&t.length>0?(0,V.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:vl()}),(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Ec()})]}):null]}),t===void 0?(0,V.jsx)(`div`,{className:`oc-notif__empty`,children:$u()}):t.length===0?(0,V.jsx)(`div`,{className:`oc-notif__empty`,children:Wl()}):(0,V.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=jye[e.kind]??fx,{title:n,body:i}=E9(e);return(0,V.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?()=>y(e):void 0,children:[(0,V.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,V.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,V.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,V.jsx)(`button`,{type:`button`,title:Co(),"aria-label":Co(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,V.jsx)(xd,{size:13})}):null,(0,V.jsx)(`button`,{type:`button`,title:f(),"aria-label":f(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,V.jsx)(Dd,{size:13})})]})]}),(0,V.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,V.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(zu())})]},e._id)})}),n&&n.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:_r()}),(0,V.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,V.jsx)(Pye,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function Pye({it:e,onClose:t,onNavigate:n}){let r=yV(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1);async function f(){d(!0);try{await t(c.trim()||void 0)}catch(e){r.error(ot(),e)}finally{d(!1)}}return(0,V.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,V.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,V.jsx)(`span`,{className:`oc-notif__title`,children:T9(e.category)}),(0,V.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?ys():e.answered?ta():zi()})]}),(0,V.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(zu())}),e.thread.length>0?(0,V.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,V.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,V.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?qi():e.authorRole===`agent`?zc():Rt()}),(0,V.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,e.messageText?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`oc-notif__report-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,V.jsx)(Cd,{size:13,"aria-hidden":!0}):(0,V.jsx)(gx,{size:13,"aria-hidden":!0}),Kt()]}),i?(0,V.jsx)(`div`,{className:`oc-notif__report-msg`,children:e.messageText}):null]}):null,(0,V.jsxs)(`div`,{className:`oc-notif__report-actions`,children:[(0,V.jsx)(Ch,{to:`/chat/$chatId`,params:{chatId:e.chatId},search:{m:e.messageId},className:`oc-notif__link`,onClick:n,children:cl()}),o?null:(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:ot()})]}),o?(0,V.jsxs)(`div`,{className:`oc-notif__close-form`,children:[(0,V.jsx)(`textarea`,{className:`oc-notif__close-input`,rows:2,value:c,onChange:e=>l(e.target.value),placeholder:Ai()}),(0,V.jsxs)(`div`,{className:`oc-notif__close-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__close-confirm`,disabled:u,onClick:()=>void f(),children:pi()}),(0,V.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:ht()})]})]}):null]})}var D9=2,Fye=180;function Iye(){let e=mh(),t=(0,B.useRef)(null),n=(0,B.useRef)(null),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(0),d=(0,B.useMemo)(()=>jz(Tz,Az()),[]);(0,B.useEffect)(()=>{let e=setTimeout(()=>c(a),Fye);return()=>clearTimeout(e)},[a]);let f=s.trim(),m=R(L.search.searchConversations,f.length>=D9?{query:f}:`skip`),h=m??[],g=f.length>=D9&&m===void 0;(0,B.useEffect)(()=>{let e=e=>{Mz(e,Tz)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,B.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,B.useEffect)(()=>{u(0)},[m]),(0,B.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let _=(0,B.useCallback)((t,n)=>{i(!1),n&&a.trim()&&Bhe(n,a.trim()),e({to:`/chat/$chatId`,params:{chatId:t},...n?{search:{m:n}}:{}})},[e,a]);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":il(),children:[(0,V.jsx)(Vx,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-search-trigger__label`,children:Vo()}),(0,V.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:d})]}),(0,V.jsx)(nB,{open:r,onOpenChange:i,children:(0,V.jsxs)(aB,{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,V.jsx)(cB,{className:`sr-only`,children:go()}),(0,V.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,V.jsx)(Vx,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,V.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,h.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=h[l];t&&_(t.chatId,t.messageId)}},placeholder:su(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":cc()})]}),(0,V.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:f.length<D9?(0,V.jsx)(`div`,{className:`oc-search-palette__hint`,children:no({count:D9})}):g?(0,V.jsx)(`div`,{className:`oc-search-palette__hint`,children:Il()}):h.length===0?(0,V.jsx)(`div`,{className:`oc-search-palette__hint`,children:Wc({term:f})}):h.map((e,t)=>(0,V.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:Sc(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>_(e.chatId,e.messageId),children:[(0,V.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,V.jsx)(sne,{size:15}):(0,V.jsx)(Fx,{size:15})}),(0,V.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,V.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||Aa()}),e.snippet?(0,V.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,V.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?Cs():Sl()})]},e.chatId))}),(0,V.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`kbd`,{children:`↑`}),(0,V.jsx)(`kbd`,{children:`↓`}),` `,Ac()]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`kbd`,{children:`↵`}),` `,Yl()]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`kbd`,{children:Oo()}),` `,p()]})]})]})})]})}var O9=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`],k9=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`agentFiles`,`preferences`,`chatDefaults`],A9={users:()=>C(),groups:()=>td(),instances:()=>Gs(),bridge:()=>Kn(),injections:()=>rc(),serviceAccounts:()=>Te(),roles:()=>Re(),access:()=>mu(),traces:()=>ri(),kpi:()=>Ou(),anomalies:()=>ue(),files:()=>xo(),agentFiles:()=>d(),preferences:()=>Po(),integrations:()=>Hr(),theme:()=>pa(),chatDefaults:()=>Vr(),audit:()=>Vu(),feedbacks:()=>za(),subagentReports:()=>he(),voice:()=>Pt()},j9={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`,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`},Lye=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function M9(e){let t=new Set(e);return O9.filter(e=>t.has(j9[e]))}function N9(e){return`/settings/${e}`}function P9(e){let t=e.split(`/`)[2];return O9.includes(t)?t:void 0}var Rye={uiprefs:`preferences`},F9=[{id:`personal`,label:()=>gt(),tabs:[`preferences`,`theme`,`files`]},{id:`agents`,label:()=>Si(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>P(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>hd(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],zye=new Map(F9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function I9(e){let t=zye.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function Bye(e,t){return e.find(e=>I9(e)===t)}F9.flatMap(e=>[...e.tabs]);function Vye(){let e=R(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?ar({count:t}):`${qr()}${e.checkedAt?Ku({time:UB(e.checkedAt)}):``}`:Wa({reason:e.reason??`?`}):ge();return(0,V.jsx)(j6,{delayDuration:150,children:(0,V.jsxs)(M6,{children:[(0,V.jsx)(N6,{asChild:!0,children:(0,V.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,V.jsx)(P6,{children:r})]})})}function L9(e){let t=new Set(O9),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 O9)n.has(e)||r.push(e);return r}function Hye(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function Uye({tab:e,active:t}){let n=A9[e](),r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,V.jsx)(Vye,{}):null]});return k9.includes(e)?(0,V.jsx)(Ch,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,V.jsx)(Ch,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function Wye({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=$7({id:e});return(0,V.jsxs)(`div`,{ref:i,style:{transform:O5.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":Jt(),...n,...r,children:(0,V.jsx)(Ax,{size:14,"aria-hidden":!0})}),(0,V.jsx)(Uye,{tab:e,active:t})]})}function Gye(){let e=R(L.me.getMe,{host:bz}),t=Se(L.me.setSettingsTabOrder),n=P9(Uh({select:e=>e.pathname})),r=n===void 0?void 0:I9(n),i=(0,B.useMemo)(()=>L9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,B.useState)(i);(0,B.useEffect)(()=>o(i),[i]);let s=(0,B.useMemo)(()=>new Set(M9(e?.permissions??[])),[e?.permissions]),c=(0,B.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&I9(e)===r),[a,s,r]),l=P5(N5(m7,{activationConstraint:{distance:5}}),N5(u7,{coordinateGetter:t9}));if(r===void 0||c.length===0)return null;let u=F9.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=Hye(a,U7(c,i,s));o(l),t({order:l})}return(0,V.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,V.jsx)(R7,{sensors:l,collisionDetection:K_e,modifiers:[nye],onDragEnd:d,children:(0,V.jsx)(Z7,{items:c,strategy:cye,children:c.map(e=>(0,V.jsx)(Wye,{tab:e,active:e===n},e))})})})}function Kye(){let e=R(L.me.getMe,{host:bz}),t=mh(),n=P9(Uh({select:e=>e.pathname})),r=n===void 0?void 0:I9(n),i=(0,B.useMemo)(()=>new Set(M9(e?.permissions??[])),[e?.permissions]),a=(0,B.useMemo)(()=>L9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=F9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=Bye(a,e.id);n&&t({to:N9(n)})}return(0,V.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":ct(),children:[(0,V.jsx)(Ch,{to:`/`,className:`oc-settings-nav__back`,children:ji()}),(0,V.jsx)(`div`,{className:`oc-settings-nav__title`,children:mi()}),(0,V.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,V.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 qye=[`eq`,`neq`,`contains`,`gt`,`gte`,`lt`,`lte`],R9=[50,100,200,500],z9=`now-30d`,Jye=`now-24h`;function Yye(e,t,n=z9,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 Xye(e){return e.kind===`absolute`?{from:String(e.from),to:String(e.to)}:{from:e.from,to:e.to}}function Zye(e){if(e.length!==0)return JSON.stringify(e)}function Qye(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`||!qye.includes(i)||typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`||n.push({field:r,op:i,value:a})}return n}var B9=rb().optional(),V9=rb().optional(),H9=rb().optional(),U9=rb().optional().catch(void 0),$ye=Pb({q:B9,section:Bb([`latency`,`events`]).default(`events`).catch(`events`),kind:rb().default(`all`).catch(`all`),limit:Zte().pipe(Ib([Hb(R9[0]),Hb(R9[1]),Hb(R9[2]),Hb(R9[3])])).catch(100),statusClass:Bb([`2xx`,`4xx`,`5xx`]).optional().catch(void 0),principalType:Bb([`user`,`service`,`system`]).optional().catch(void 0),direction:Bb([`inbound`,`outbound`,`internal`]).optional().catch(void 0),roleKey:U9,from:V9,to:V9,adv:H9}),ebe=Pb({q:B9,action:U9,impersonated:Bb([`yes`,`no`]).optional().catch(void 0),resource:U9,from:V9,to:V9,adv:H9}),tbe=Pb({q:B9,status:Bb([`open`,`acknowledged`,`resolved`,`all`]).default(`open`).catch(`open`),severity:Bb([`info`,`warn`,`critical`]).optional().catch(void 0),kind:U9,from:V9,to:V9}),nbe=Pb({from:V9,to:V9}),rbe=Pb({q:B9,status:Bb([`active`,`disabled`]).optional().catch(void 0)}),ibe=Pb({q:B9,role:U9});Pb({q:B9,mode:Bb([`per-user`,`shared`]).optional().catch(void 0)});var abe=Pb({section:Bb([`readaloud`,`dictation`,`talk`]).default(`readaloud`).catch(`readaloud`)}),obe=Pb({section:rb().max(32).default(`openclaw`).catch(`openclaw`)}),W9=`oc.theme`;function G9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function K9(e){(0,B.useEffect)(()=>{let t=e??localStorage.getItem(W9)??`system`;if(localStorage.setItem(W9,t),G9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>G9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function sbe(e){(0,B.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=zu()}catch{t=void 0}t!==e&&zr(e)},[e])}var cbe=(0,B.lazy)(()=>k4(()=>import(`./RolesTab-DVdsW49x.js`).then(e=>({default:e.RolesTab})),__vite__mapDeps([2,1,3,4,5]))),lbe=(0,B.lazy)(()=>k4(()=>import(`./InstancesTab-C2vgcYdE.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([6,1,3,7,8,9,10,11,12,13,14,15,16,5,17,18,19]))),ube=(0,B.lazy)(()=>k4(()=>import(`./PromptInjectionsTab-Bk59PWzu.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([20,1,3,7,8,9,21,5,22]))),dbe=(0,B.lazy)(()=>k4(()=>import(`./GroupsTab-i_p1qxDl.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([23,1,3,13,12,24,19,14,5,17,25,15,16]))),fbe=(0,B.lazy)(()=>k4(()=>import(`./IntegrationsTab-U_Dml2lf.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([26,1,3,5]))),pbe=(0,B.lazy)(()=>k4(()=>import(`./FeedbacksTab-WlCA0v5O.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([27,1,3,19,12,14,5,17]))),mbe=(0,B.lazy)(()=>k4(()=>import(`./SubAgentReportsTab-Ce0Y_sVn.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([28,1,3,19,12,14,5,17]))),hbe=(0,B.lazy)(()=>k4(()=>import(`./FilesTab-DQ9pHjeQ.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([29,1,3,5,17]))),gbe=(0,B.lazy)(()=>k4(()=>import(`./AgentFilesTab-q9XSjz3-.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([30,1,3,11,8,5,22]))),_be=(0,B.lazy)(()=>k4(()=>import(`./PreferencesTab-BktDAi8P.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([31,1,3,21,9,5]))),vbe=(0,B.lazy)(()=>k4(()=>import(`./ChatDefaultsTab-Dcfzk7xu.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([32,1,3,11,5,22]))),ybe=(0,B.lazy)(()=>k4(()=>import(`./AccessTab-CTW_nnWZ.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([33,1,3]))),bbe=(0,B.lazy)(()=>k4(()=>import(`./ThemeShowroom-BRl6NHy2.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([34,1,3,35,24,36,12,16,5,15,21,9,37,17])));function xbe(){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(rf,{children:(0,V.jsx)(`div`,{className:`oc-boot`,children:S()})}),(0,V.jsx)(nf,{children:(0,V.jsx)(Cbe,{})}),(0,V.jsx)(tf,{children:(0,V.jsx)(vV,{children:(0,V.jsx)(Tbe,{})})})]})}function Sbe(){return(0,V.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,V.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,V.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,V.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,V.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 Cbe(){let{signIn:e}=wf();K9(void 0);let t=R(L.charts.brandForHost,{host:bz}),n=Cz(bz),r=t??n??null,i=Rz(void 0);Bz(r?.tokens??null,i),(0,B.useEffect)(()=>{t&&wz(bz,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?qz(a,i):null,s=a?.label??`Atrium`,c=R(L.me.authProviders),[l,u]=(0,B.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(Ws())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.anonymous;return(0,V.jsxs)(`div`,{className:`oc-signin`,children:[(0,V.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,V.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,V.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,V.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,V.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,V.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,V.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,V.jsx)(`h1`,{className:`oc-signin__title`,children:Gn()}),(0,V.jsx)(`p`,{className:`oc-signin__subtitle`,children:we()}),(0,V.jsx)(`div`,{className:`oc-signin__providers`,children:c?.google?(0,V.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,V.jsx)(Sbe,{}),(0,V.jsx)(`span`,{children:Le()})]}):null}),l?(0,V.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,V.jsx)(`p`,{className:`oc-signin__error`,children:ni()}):null,c?.anonymous?(0,V.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:Du()}):null]})]})}function wbe(){let{width:e,collapsed:t,isMobile:n}=a8();return(0,V.jsxs)(`div`,{className:`oc-shell`,children:[(0,V.jsxs)(`header`,{className:`oc-topbar`,children:[(0,V.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,V.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`}}),(0,V.jsx)(`div`,{className:`oc-skel`,style:{width:`5.5rem`,height:`1.1rem`}})]}),(0,V.jsx)(`div`,{className:`oc-topbar__search`,children:(0,V.jsx)(`div`,{className:`oc-skel`,style:{width:`100%`,height:`2.25rem`}})}),(0,V.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,V.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`,borderRadius:`999px`}})})]}),(0,V.jsxs)(`div`,{className:n?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[!t&&!n?(0,V.jsx)(`div`,{className:`oc-sidebar-col`,style:{width:e,flex:`0 0 ${e}px`},children:(0,V.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,V.jsx)(`div`,{className:`oc-skel`,style:{height:`2.25rem`,margin:`0.25rem 0.25rem 0`}}),(0,V.jsx)(m9,{})]})}):null,(0,V.jsx)(`main`,{className:`oc-main`})]})]})}function Tbe(){let e=R(L.me.getMe,{host:bz}),t=Se(L.me.bootstrap),n=mh();(0,B.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),K9(e?.resolvedThemeMode);let r=Rz(e?.resolvedThemeMode);Bz(e?.resolvedChartTokens,r),sbe(e?.resolvedLocale);let i=(0,B.useRef)(null);if((0,B.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,V.jsx)(wbe,{});let a=e.name||e.email||le();return e.role===`pending`?(0,V.jsxs)(`div`,{className:`oc-shell`,children:[(0,V.jsx)(q9,{}),(0,V.jsx)(C9,{}),(0,V.jsxs)(`header`,{className:`oc-topbar`,children:[(0,V.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,V.jsx)(J9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,V.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,V.jsx)(w9,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,V.jsxs)(`div`,{className:`oc-pending`,children:[(0,V.jsx)(`h1`,{className:`oc-pending__title`,children:Br()}),(0,V.jsx)(`p`,{className:`oc-pending__body`,children:Bu()})]})]}):(0,V.jsx)(Dbe,{canOpenSettings:M9(e.permissions??[]).length>0,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function q9(){let e=R(L.me.getImpersonation),t=Se(L.admin.stopImpersonation);return!e||!e.impersonating?null:(0,V.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,V.jsx)(Tx,{className:`size-4 shrink-0`}),(0,V.jsxs)(`span`,{className:`oc-imp__text`,children:[Ra(),` `,(0,V.jsx)(`strong`,{children:e.targetLabel}),ed(),(0,V.jsx)(`strong`,{children:e.realLabel}),pu()]}),(0,V.jsx)(zd,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:da()})]})}function J9({brand:e,resolvedThemeMode:t}){let n=Rz(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=qz(e,n),[o,s]=(0,B.useState)(!1);return(0,B.useEffect)(()=>s(!1),[a]),(0,V.jsxs)(V.Fragment,{children:[a!==null&&!o?(0,V.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,V.jsx)(Zz,{className:`oc-brand__logo`}):null,(0,V.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function Ebe({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,V.jsxs)(`header`,{className:`oc-topbar`,children:[(0,V.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,V.jsx)(zd,{variant:`ghost`,size:`icon-sm`,"aria-label":i?Jo():os(),onClick:a,children:i?(0,V.jsx)(gne,{}):(0,V.jsx)(hne,{})}),(0,V.jsx)(Ch,{to:`/`,className:`oc-topbar__brand`,children:(0,V.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,V.jsx)(`div`,{className:`oc-topbar__search`,children:(0,V.jsx)(Iye,{})}),(0,V.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,V.jsx)(Nye,{}),(0,V.jsx)(w9,{label:e,mode:t})]})]})}function Dbe({canOpenSettings:e,userLabel:t,themeMode:n,resolvedThemeMode:r,brand:i}){let{width:a,collapsed:o,toggleCollapsed:s,collapse:c,startResize:l,isMobile:u}=a8(),d=Hh(),f=fh({strict:!1}),p=mh(),m=!!d({to:`/settings`,fuzzy:!0});(0,B.useEffect)(()=>{u&&c()},[Uh({select:e=>e.pathname}),u,c]);let h=(0,B.useCallback)(e=>{p({to:`/chat/$chatId`,params:{chatId:e}})},[p]),{startNewChat:g,picker:_}=kye(h),v=(0,B.useMemo)(()=>jz(Ez,Az()),[]);return(0,B.useEffect)(()=>{let e=e=>{Mz(e,Ez)&&(e.preventDefault(),g())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[g]),(0,V.jsxs)(`div`,{className:`oc-shell`,children:[_,(0,V.jsx)(Oye,{activeChatId:f.chatId??null}),(0,V.jsx)(q9,{}),(0,V.jsx)(C9,{}),(0,V.jsx)(Ebe,{userLabel:t,themeMode:n,resolvedThemeMode:r,brand:i,collapsed:o,onToggleSidebar:s}),(0,V.jsxs)(`div`,{className:u?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[u&&!o?(0,V.jsx)(`div`,{className:`oc-sidebar-backdrop`,onClick:c,"aria-hidden":!0}):null,o?null:(0,V.jsxs)(`div`,{className:`oc-sidebar-col`,style:u?void 0:{width:a,flex:`0 0 ${a}px`},children:[m?(0,V.jsx)(Kye,{}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Cye,{activeChatId:f.chatId??null,onSelect:h,onNewChat:()=>void g(),newChatShortcut:v}),e?(0,V.jsx)(zd,{variant:`ghost`,className:`m-2 justify-start`,asChild:!0,children:(0,V.jsx)(Ch,{to:`/settings`,children:hc()})}):null]}),(0,V.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:l,role:`separator`,"aria-orientation":`vertical`,"aria-label":Qc()})]}),(0,V.jsx)(`main`,{className:`oc-main`,children:(0,V.jsx)(Rh,{})})]})]})}function Obe(){let e=R(L.me.getMe,{host:bz}),t=mh(),n=Uh({select:e=>e.pathname}),r=(0,B.useMemo)(()=>e?M9(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,B.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,V.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:S()});if(i)return null;let a=P9(n),o=a!==void 0&&!r.includes(a);return(0,V.jsxs)(`div`,{className:`oc-admin`,children:[(0,V.jsx)(Gye,{}),(0,V.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,V.jsx)(kbe,{}):(0,V.jsx)(Rh,{})})]})}function kbe(){return(0,V.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,V.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,V.jsx)(qx,{size:28})}),(0,V.jsx)(`h2`,{className:`oc-route-error__title`,children:Fo()}),(0,V.jsx)(`p`,{className:`oc-route-error__body`,children:lo()})]})}function Abe(){let e=R(L.me.getMe,{host:bz}),t=mh();return(0,B.useEffect)(()=>{if(e===void 0)return;let n=M9(e.permissions??[]);t({to:n.includes(`files`)?N9(`files`):n.length>0?N9(n[0]):`/`,replace:!0})},[e,t]),(0,V.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:S()})}function jbe(e){switch(e){case`groups`:return(0,V.jsx)(dbe,{});case`integrations`:return(0,V.jsx)(fbe,{});case`instances`:return(0,V.jsx)(lbe,{});case`injections`:return(0,V.jsx)(ube,{});case`theme`:return(0,V.jsx)(bbe,{});case`feedbacks`:return(0,V.jsx)(pbe,{});case`subagentReports`:return(0,V.jsx)(mbe,{});case`files`:return(0,V.jsx)(hbe,{});case`agentFiles`:return(0,V.jsx)(gbe,{});case`preferences`:return(0,V.jsx)(_be,{});case`chatDefaults`:return(0,V.jsx)(vbe,{});case`access`:return(0,V.jsx)(ybe,{});default:return(0,V.jsx)(cbe,{})}}function Mbe(){let{tab:e}=fh({from:`/settings/$tab`});return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:jbe(e)})}function Nbe(){let{chatId:e}=fh({from:`/chat/$chatId`}),{m:t}=ph({from:`/chat/$chatId`});return(0,B.useEffect)(()=>{Tne(e)},[e]),(0,V.jsx)(Y8,{chatId:e,focusMessageId:t??null})}function Pbe(){let e=mh(),t=Ene(),n=R(L.messages.listChats,{}),r=t!==null&&n!==void 0&&n.some(e=>e._id===t);return(0,B.useEffect)(()=>{r&&t&&e({to:`/chat/$chatId`,params:{chatId:t},replace:!0})},[r,t,e]),t!==null&&(n===void 0||r)?(0,V.jsx)(`div`,{className:`oc-boot`,children:S()}):(0,V.jsx)(Y8,{chatId:null})}var Y9=Oh({component:xbe}),Fbe=Eh({getParentRoute:()=>Y9,path:`/`,component:Pbe}),Ibe=Eh({getParentRoute:()=>Y9,path:`chat/$chatId`,component:Nbe,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),X9=Eh({getParentRoute:()=>Y9,path:`settings`,component:Obe}),Lbe=Eh({getParentRoute:()=>X9,path:`/`,component:Abe}),Rbe=Eh({getParentRoute:()=>X9,path:`traces`,validateSearch:$ye,component:kh(()=>k4(()=>import(`./TracesTab-CBN2vo1w.js`),__vite__mapDeps([38,1,3,13,12,35,24,19,14,5,17,36,16,15])),`TracesTab`)}),zbe=Eh({getParentRoute:()=>X9,path:`bridge`,validateSearch:obe,component:kh(()=>k4(()=>import(`./BridgeTab-BYuXlyxy.js`),__vite__mapDeps([10,1,3,11,7,8,9,12,13,14,15,16,5,17,18])),`BridgeTab`)}),Bbe=Eh({getParentRoute:()=>X9,path:`voice`,validateSearch:abe,component:kh(()=>k4(()=>import(`./VoiceTab-b4ZPVB2F.js`),__vite__mapDeps([39,1,3,13,12,5,22])),`VoiceTab`)}),Vbe=Eh({getParentRoute:()=>X9,path:`audit`,validateSearch:ebe,component:kh(()=>k4(()=>import(`./AuditTab-Dy6MHYXk.js`),__vite__mapDeps([40,1,3,19,12,14,5,17,36,24,16,15])),`AuditTab`)}),Hbe=Eh({getParentRoute:()=>X9,path:`anomalies`,validateSearch:tbe,component:kh(()=>k4(()=>import(`./AnomaliesTab-DRfDR0J5.js`),__vite__mapDeps([41,1,3,19,12,14,5,17,15,16,18])),`AnomaliesTab`)}),Ube=Eh({getParentRoute:()=>X9,path:`kpi`,validateSearch:nbe,component:kh(()=>k4(()=>import(`./KpiTab-D8BAnPiK.js`),__vite__mapDeps([42,1,3,16,5,37])),`KpiTab`)}),Wbe=Eh({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:rbe,component:kh(()=>k4(()=>import(`./ServiceAccountsTab-ZsiwQmeJ.js`),__vite__mapDeps([43,1,3,12,35,19,14,5,17,15,16,4])),`ServiceAccountsTab`)}),Gbe=Eh({getParentRoute:()=>X9,path:`users`,validateSearch:ibe,component:kh(()=>k4(()=>import(`./UsersTab-C_K650wH.js`),__vite__mapDeps([44,1,3,19,12,14,5,17,25,15,16])),`UsersTab`)}),Kbe=Eh({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw Yp({to:`/settings/$tab`,params:{tab:Rye.uiprefs},replace:!0})}}),qbe=Eh({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:Bb([...k9]).catch(`roles`).parse(e.tab)}),component:Mbe});function Jbe({error:e,reset:t}){let n=mh(),r=Dne(e),[i]=(0,B.useState)(()=>r&&Ane(Date.now()));return(0,B.useEffect)(()=>{i&&window.location.reload()},[i]),i?(0,V.jsx)(`div`,{className:`oc-route-error`,role:`status`,children:(0,V.jsx)(`p`,{className:`oc-route-error__body`,children:tu()})}):(0,V.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,V.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,V.jsx)(qx,{size:28})}),(0,V.jsx)(`h2`,{className:`oc-route-error__title`,children:nc()}),(0,V.jsx)(`p`,{className:`oc-route-error__body`,children:Za()}),(0,V.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>{r?window.location.reload():t()},children:kl()}),(0,V.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:Ic()})]})]})}function Ybe(){let e=mh();return(0,V.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,V.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,V.jsx)(nne,{size:28})}),(0,V.jsx)(`h2`,{className:`oc-route-error__title`,children:wa()}),(0,V.jsx)(`p`,{className:`oc-route-error__body`,children:gs()}),(0,V.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,V.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:Ic()})})]})}var Z9=Uee({routeTree:Y9.addChildren([Fbe,Ibe,X9.addChildren([Lbe,Rbe,Bbe,zbe,Vbe,Hbe,Ube,Wbe,Gbe,Kbe,qbe])]),defaultPreload:`intent`,defaultErrorComponent:Jbe,defaultNotFoundComponent:Ybe}),Xbe=()=>null;function Q9({children:e}){return(0,V.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=af.createRoot(document.getElementById(`root`));$9.render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(Q9,{children:$u()})})),aH().then(e=>{let t=new Eu(e);$9.render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(Tf,{client:t,children:(0,V.jsxs)(aV,{children:[(0,V.jsx)(jge,{children:(0,V.jsx)(Kee,{router:Z9})}),(0,V.jsx)(B.Suspense,{fallback:null,children:(0,V.jsx)(Xbe,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,V.jsx)(B.StrictMode,{children:(0,V.jsxs)(Q9,{children:[ko(),` `,e instanceof Error?e.message:String(e)]})}))});export{HB as $,wH as A,qx as At,sV as B,kx as Bt,d6 as C,UP as Ct,n6 as D,uN as Dt,Xpe as E,dN as Et,CV as F,Bx as Ft,ZB as G,yx as Gt,JB as H,Cx as Ht,AV as I,zx as It,QB as J,hx as Jt,tV as K,vx as Kt,wV as L,Ix as Lt,EV as M,Gx as Mt,kV as N,Hx as Nt,a6 as O,aN as Ot,bV as P,Vx as Pt,KB as Q,SV as R,Mx as Rt,p6 as S,WP as St,L4 as T,HP as Tt,nV as U,Sx as Ut,cV as V,Tx as Vt,rV as W,xx as Wt,GB as X,ph as Xt,eV as Y,mh as Yt,qB as Z,j6 as _,Lz as _t,Xye as a,LB as at,l6 as b,jz as bt,A9 as c,fB as ct,M8 as d,aB as dt,VB as et,k8 as f,lB as ft,P6 as g,Rz as gt,M6 as h,cB as ht,Zye as i,IB as it,mH as j,Kx as jt,k4 as k,Jx as kt,j9 as l,uB as lt,F6 as m,oB as mt,Jye as n,NB as nt,Qye as o,RB as ot,R6 as p,sB as pt,$B as q,gx as qt,Yye as r,FB as rt,Lye as s,PB as st,z9 as t,UB as tt,r9 as u,nB as ut,N6 as v,Az as vt,u6 as w,VP as wt,f6 as x,bz as xt,Ohe as y,Fz as yt,yV as z,jx as zt};