@lacneu/atrium 0.77.0 → 0.78.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.
- package/dist/assets/{AccessTab-BPl6RGWf.js → AccessTab-YOPTfk-I.js} +1 -1
- package/dist/assets/{AdvancedFilter-QHL1Jz1Z.js → AdvancedFilter-Bm1TIX9k.js} +1 -1
- package/dist/assets/{AgentFilesTab-CjesR_c6.js → AgentFilesTab-DRQkurXm.js} +1 -1
- package/dist/assets/{AnomaliesTab-yzNzDsXN.js → AnomaliesTab-Dq2dqog2.js} +1 -1
- package/dist/assets/{AuditTab-1rUI2z6b.js → AuditTab-Cntt5whu.js} +1 -1
- package/dist/assets/{BridgeTab-COQr-xZD.js → BridgeTab-DzV-2POL.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-CM2Yd28v.js → ChatDefaultsTab-C0sMC9lx.js} +1 -1
- package/dist/assets/{DataTableShell-CW5udl6V.js → DataTableShell-DWXPn72S.js} +1 -1
- package/dist/assets/{DetailChips-Dlt_uEHU.js → DetailChips-D6mdBUOT.js} +1 -1
- package/dist/assets/{FeedbacksTab-Uzv7-Dj0.js → FeedbacksTab-CbdS0wvF.js} +1 -1
- package/dist/assets/{FieldLabel-Bbe-KIdW.js → FieldLabel-Bww3UDFn.js} +1 -1
- package/dist/assets/{FilesTab-fi7x53E6.js → FilesTab-gqJalvPX.js} +1 -1
- package/dist/assets/{FilterBar-BO7_dR0d.js → FilterBar-FHDxb3k3.js} +1 -1
- package/dist/assets/{GroupsTab-C2ErNAiu.js → GroupsTab-BA8yKOnN.js} +1 -1
- package/dist/assets/{InstancesTab-D3PbSRsE.js → InstancesTab-sdopggdY.js} +1 -1
- package/dist/assets/{IntegrationsTab-DsvIgPM9.js → IntegrationsTab-BFpswDLB.js} +1 -1
- package/dist/assets/{KpiTab-boTUKc3M.js → KpiTab-DwKThxZR.js} +1 -1
- package/dist/assets/{PreferencesTab-D1GB1DjD.js → PreferencesTab-C3J_i-eF.js} +1 -1
- package/dist/assets/{ProjectPage-BKOn9--c.js → ProjectPage-Dk_aI-j5.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-CMynIw-2.js → PromptInjectionsTab-B_mdD-DZ.js} +1 -1
- package/dist/assets/{RolesTab-rU1yG45_.js → RolesTab-AEwrbrY4.js} +1 -1
- package/dist/assets/{ScheduledTab-D1E65eqQ.js → ScheduledTab-1EVZpEec.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-DTW2ImlD.js → ServiceAccountsTab-CGQ1lSPD.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-C9t7ObEO.js → SubAgentReportsTab-jYVPpy6r.js} +1 -1
- package/dist/assets/{ThemeShowroom-SQKNzsXc.js → ThemeShowroom-Ce00J53a.js} +1 -1
- package/dist/assets/{TimeRangePicker-Di0xhZgB.js → TimeRangePicker-BlRNLd96.js} +1 -1
- package/dist/assets/{TimezoneCombobox-eEhKbenA.js → TimezoneCombobox-UX7uQX62.js} +1 -1
- package/dist/assets/{TracesTab-C_EHq15B.js → TracesTab-h8arGKis.js} +1 -1
- package/dist/assets/{UsersTab-Dk5CxK1-.js → UsersTab-CuY3xwoe.js} +1 -1
- package/dist/assets/{VoiceTab-CkceCrfE.js → VoiceTab-D-J9M4a1.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-kKNZy35t.js → highlighted-body-OFNGDK62-B8scDgZo.js} +1 -1
- package/dist/assets/{index-c5j0e823.js → index-Bc3aF-kJ.js} +33 -33
- package/dist/assets/mermaid-GHXKKRXX-BcADHOv7.js +1 -0
- package/dist/assets/{pdf-DWeO12dm.js → pdf-DKBRfoBb.js} +1 -1
- package/dist/assets/{tabs-Bmd8xvTL.js → tabs-DHs6yOVA.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BZZjoNSF.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-B8scDgZo.js","assets/bundle-mjs-C73ZY4La.js","assets/RolesTab-AEwrbrY4.js","assets/api-Cpjr7qvl.js","assets/roleDescriptions-CF4LmoIL.js","assets/button-CbwCr9Pi.js","assets/InstancesTab-sdopggdY.js","assets/FieldLabel-Bww3UDFn.js","assets/curation-CQksaIbm.js","assets/locales-CPjguROj.js","assets/BridgeTab-DzV-2POL.js","assets/compatView-BHtlzKRR.js","assets/tabs-DHs6yOVA.js","assets/chevrons-up-down-Chp_XyRp.js","assets/FilterBar-FHDxb3k3.js","assets/TimeRangePicker-BlRNLd96.js","assets/table-CeTqDEfs.js","assets/dispatchErrorInfo-EQWxZ8Ki.js","assets/DataTableShell-DWXPn72S.js","assets/PromptInjectionsTab-B_mdD-DZ.js","assets/localePickerView-C2RmOS86.js","assets/confTabs-CCBW5ofF.css","assets/GroupsTab-BA8yKOnN.js","assets/x-Dqrt5OdW.js","assets/DetailChips-D6mdBUOT.js","assets/IntegrationsTab-BFpswDLB.js","assets/FeedbacksTab-CbdS0wvF.js","assets/SubAgentReportsTab-jYVPpy6r.js","assets/FilesTab-gqJalvPX.js","assets/ScheduledTab-1EVZpEec.js","assets/list-CIbMtiOp.js","assets/TimezoneCombobox-UX7uQX62.js","assets/AgentFilesTab-DRQkurXm.js","assets/PreferencesTab-C3J_i-eF.js","assets/ChatDefaultsTab-C0sMC9lx.js","assets/AccessTab-YOPTfk-I.js","assets/ThemeShowroom-Ce00J53a.js","assets/AdvancedFilter-Bm1TIX9k.js","assets/card-DpbKWI5H.js","assets/ProjectPage-Dk_aI-j5.js","assets/ProjectPage-BXsrYrrF.css","assets/TracesTab-h8arGKis.js","assets/VoiceTab-D-J9M4a1.js","assets/AuditTab-Cntt5whu.js","assets/AnomaliesTab-Dq2dqog2.js","assets/KpiTab-DwKThxZR.js","assets/ServiceAccountsTab-CGQ1lSPD.js","assets/UsersTab-CuY3xwoe.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{$ as l,$A as u,$O as d,$S as f,$d as p,$g as m,$h as h,$i as g,$j as _,$k as v,$l as y,$n as b,$o as x,$p as S,$t as C,$v as w,AA as T,AI as E,AL as D,AT as O,A_ as k,Ad as A,Ag as ee,Ah as j,Aj as M,Al as te,Am as N,As as P,At as ne,Av as re,Ax as ie,Az as ae,B as oe,BA as se,BL as ce,BS as le,B_ as ue,Bc as de,Bd as fe,Bg as pe,Bh as me,Bi as he,Bj as ge,Bl as _e,Bn as ve,Bo as ye,Bt as be,Bv as xe,Bx as Se,Bz as Ce,C as we,CA as Te,CL as Ee,CM as De,C_ as Oe,Ca as ke,Cf as Ae,Cg as je,Ci as Me,Cj as Ne,Cl as Pe,Cm as Fe,Cs as Ie,Ct as Le,Cv as Re,Cx as ze,Cz as Be,D as F,DA as Ve,DL as He,D_ as Ue,Db as We,Dg as Ge,Dj as Ke,Dl as qe,Dm as Je,Do as Ye,Ds as Xe,Dt as Ze,Dv as Qe,Dx as $e,Dz as et,E as tt,EA as nt,EL as rt,E_ as it,Eg as at,Ej as ot,El as st,Em as ct,Es as lt,Et as ut,Ev as dt,Ex as ft,Ez as pt,F as mt,FA as ht,FI as gt,FL as _t,FS as vt,F_ as yt,Fc as bt,Fd as xt,Fg as St,Fh as Ct,Fi as wt,Fj as Tt,Fl as Et,Fm as Dt,Fn as Ot,Fo as kt,Ft as At,Fv as jt,Fx as Mt,Fz as Nt,G as Pt,GA as Ft,GL as It,GO as Lt,GS as Rt,G_ as zt,Ga as Bt,Gc as Vt,Gd as Ht,Gg as Ut,Gh as Wt,Gi as Gt,Gj as Kt,Gl as qt,Gn as Jt,Go as Yt,Gt as Xt,Gv as Zt,Gx as Qt,Gz as $t,H as en,HA as tn,HL as nn,HO as rn,HS as an,H_ as on,Hc as sn,Hd as cn,Hg as ln,Hh as un,Hi as dn,Hj as fn,Hl as pn,Hn as mn,Ho as hn,Ht as gn,Hv as _n,Hx as vn,Hz as yn,I as bn,IA as xn,II as Sn,IL as Cn,IS as wn,I_ as Tn,Ic as En,Id as Dn,Ig as On,Ih as kn,Ii as An,Ij as jn,Il as Mn,Im as Nn,In as Pn,Io as Fn,It as In,Iv as Ln,Ix as Rn,Iz as I,J as zn,JA as Bn,JL as Vn,JO as Hn,JS as Un,J_ as Wn,Ja as Gn,Jc as Kn,Jd as qn,Jg as Jn,Jh as Yn,Ji as Xn,Jj as Zn,Jl as Qn,Jn as $n,Jo as er,Jr as tr,Jt as nr,Jv as rr,Jx as ir,K as ar,KA as or,KL as sr,KO as cr,KS as lr,K_ as ur,Ka as dr,Kc as fr,Kd as pr,Kg as mr,Kh as hr,Ki as gr,Kj as _r,Kl as vr,Kn as yr,Ko as br,Kt as xr,Kv as Sr,Kx as Cr,Kz as wr,L as Tr,LA as Er,LL as Dr,LS as Or,L_ as kr,Lc as Ar,Ld as jr,Lg as Mr,Lh as Nr,Li as Pr,Lj as Fr,Ll as Ir,Lm as Lr,Ln as Rr,Lo as zr,Lt as Br,Lv as Vr,Lx as Hr,Lz as Ur,M as Wr,MA as Gr,MI as Kr,ML as qr,M_ as Jr,Md as Yr,Mg as Xr,Mh as Zr,Mj as Qr,Ml as $r,Mm as ei,Mn as ti,Mo as ni,Ms as ri,Mt as ii,Mv as ai,Mx as oi,Mz as si,NA as ci,NI as li,NL as ui,NS as di,N_ as fi,Nc as pi,Nd as mi,Ng as hi,Nh as gi,Nj as _i,Nl as vi,Nm as yi,Nn as bi,No as xi,Ns as Si,Nt as Ci,Nv as wi,Nx as Ti,Nz as Ei,O as Di,OA as Oi,OI as ki,OL as Ai,O_ as ji,Og as Mi,Oh as Ni,Oj as Pi,Ol as Fi,Om as Ii,Oo as Li,Os as Ri,Ot as zi,Ov as Bi,Ox as Vi,Oz as Hi,PA as Ui,PI as Wi,PL as Gi,PS as Ki,P_ as qi,Pc as Ji,Pd as Yi,Pg as Xi,Ph as Zi,Pj as Qi,Pl as $i,Pm as ea,Pn as ta,Po as na,Ps as ra,Pt as ia,Pv as aa,Px as oa,Pz as sa,Q as ca,QA as la,QL as ua,QO as da,QS as fa,Qd as pa,Qg as ma,Qh as ha,Qi as ga,Qj as _a,Qk as va,Ql as ya,Qn as ba,Qo as xa,Qp as Sa,Qt as Ca,Qu as wa,Qv as Ta,R as Ea,RA as Da,RL as Oa,RS as ka,R_ as Aa,Rc as ja,Rd as Ma,Rg as Na,Rh as Pa,Ri as Fa,Rj as Ia,Rl as La,Rm as Ra,Ro as za,Rt as Ba,Rv as Va,Rx as Ha,Rz as Ua,S as Wa,SA as Ga,SL as Ka,SM as qa,S_ as Ja,Sa as Ya,Sf as Xa,Sg as Za,Si as Qa,Sj as $a,Sl as eo,Sm as to,So as no,Sr as ro,Ss as io,St as ao,Su as oo,Sv as so,Sx as co,Sz as lo,T as uo,TA as fo,TL as po,T_ as mo,Tf as ho,Tg as go,Ti as _o,Tj as vo,Tl as yo,Tm as bo,To as xo,Ts as So,Tt as Co,Tv as wo,Tx as To,Tz as Eo,U as Do,UA as Oo,UL as ko,UO as Ao,US as jo,U_ as Mo,Uc as No,Ud as Po,Ug as Fo,Uh as Io,Ui as Lo,Uj as Ro,Ul as zo,Un as Bo,Uo as Vo,Ut as Ho,Uv as Uo,Ux as Wo,V as Go,VA as Ko,VL as qo,VS as Jo,V_ as Yo,Vc as Xo,Vd as Zo,Vg as Qo,Vh as $o,Vi as es,Vj as ts,Vl as ns,Vn as rs,Vo as is,Vt as as,Vv as os,Vx as ss,Vz as cs,W as ls,WA as us,WL as ds,WO as fs,WS as ps,W_ as ms,Wa as hs,Wc as gs,Wd as _s,Wg as vs,Wh as ys,Wi as bs,Wj as xs,Wl as Ss,Wn as Cs,Wo as ws,Wt as Ts,Wv as Es,Wx as Ds,Wz as Os,X as ks,XA as As,XO as js,XS as Ms,Xc as Ns,Xd as Ps,Xg as Fs,Xh as Is,Xi as Ls,Xj as Rs,Xk as zs,Xl as Bs,Xn as Vs,Xo as Hs,Xr as Us,Xt as Ws,Xv as Gs,Y as Ks,YA as qs,YL as Js,YO as Ys,YR as Xs,YS as Zs,Ya as Qs,Yc as $s,Yd as ec,Yg as tc,Yh as nc,Yi as rc,Yj as ic,Yl as ac,Yn as oc,Yo as sc,Yr as cc,Yt as lc,Yv as uc,Z as dc,ZA as fc,ZL as pc,ZO as mc,ZS as hc,Zd as gc,Zg as _c,Zh as vc,Zi as yc,Zj as bc,Zk as xc,Zl as Sc,Zn as Cc,Zo as wc,Zp as Tc,Zt as Ec,Zv as Dc,Zy as Oc,_ as kc,_A as Ac,_L as jc,_M as Mc,__ as Nc,_a as Pc,_f as Fc,_g as Ic,_i as Lc,_j as Rc,_l as zc,_m as Bc,_r as Vc,_u as Hc,_v as Uc,a as Wc,aA as Gc,aC as Kc,aI as qc,aM as Jc,a_ as Yc,aa as Xc,af as Zc,ag as Qc,aj as $c,ak as el,am as tl,ar as nl,as as rl,at as il,au as al,b as ol,bA as sl,bL as cl,bM as ll,b_ as ul,ba as dl,bf as fl,bg as pl,bi as ml,bj as hl,bl as gl,bm as _l,br as vl,bt as yl,bu as bl,bv as xl,bz as Sl,c as Cl,cA as wl,cI as Tl,cM as El,c_ as Dl,ca as Ol,cf as kl,cj as Al,cl as jl,cm as Ml,cr as Nl,cs as Pl,ct as Fl,cu as Il,cv as Ll,d as Rl,dA as zl,dM as Bl,d_ as Vl,da as Hl,df as Ul,dj as Wl,dl as Gl,dm as Kl,dr as ql,dt as Jl,du as Yl,dv as Xl,eA as Zl,eC as Ql,eM as $l,e_ as eu,ea as tu,ef as nu,eg as ru,ej as iu,ek as au,em as ou,en as su,er as cu,es as lu,et as uu,eu as du,f as fu,fA as pu,fM as mu,fR as hu,f_ as gu,fa as _u,ff as vu,fi as yu,fj as bu,fl as xu,fm as Su,fr as Cu,ft as wu,fu as Tu,g as Eu,gA as Du,gL as Ou,gM as ku,g_ as Au,ga as ju,gf as Mu,gg as Nu,gi as Pu,gj as Fu,gl as Iu,gm as Lu,gr as Ru,gu as zu,hA as Bu,hL as Vu,hM as Hu,h_ as Uu,ha as Wu,hf as Gu,hg as Ku,hi as qu,hj as Ju,hl as Yu,hm as Xu,hn as Zu,hr as Qu,ht as $u,hu as ed,i as td,iA as nd,iC as rd,iM as id,i_ as ad,ia as od,if as sd,ig as cd,ij as ld,ik as ud,im as dd,ir as fd,is as pd,it as md,iu as hd,j as gd,jA as _d,jI as vd,jL as yd,j_ as bd,jd as xd,jg as Sd,jh as Cd,jj as wd,jl as Td,jm as Ed,jo as Dd,js as Od,jt as kd,jv as Ad,jx as jd,jz as Md,k as Nd,kA as Pd,kI as Fd,kL as Id,k_ as Ld,kd as Rd,kg as zd,kh as Bd,kj as Vd,kl as Hd,km as Ud,ks as Wd,kt as Gd,kv as Kd,kx as qd,kz as Jd,l as Yd,lA as Xd,lI as Zd,lM as Qd,l_ as $d,la as ef,lf as tf,lj as nf,ll as rf,lm as af,lr as of,ls as sf,lt as cf,lu as lf,m as uf,mA as df,mL as ff,mM as pf,m_ as mf,ma as hf,mf as gf,mg as _f,mi as vf,mj as yf,ml as bf,mm as xf,mn as Sf,mr as Cf,mt as wf,mu as Tf,n as Ef,nA as Df,nC as Of,nI as kf,nM as Af,n_ as jf,na as Mf,nf as Nf,ng as Pf,ni as Ff,nj as If,nk as Lf,nm as Rf,nn as zf,nr as Bf,ns as Vf,nt as Hf,nu as Uf,o as Wf,oA as Gf,oI as Kf,oM as qf,o_ as Jf,oa as Yf,of as Xf,og as Zf,oj as Qf,ol as $f,om as ep,or as tp,os as np,ot as rp,ou as ip,p as ap,pA as op,pL as sp,pM as cp,p_ as lp,pa as up,pf as dp,pi as fp,pj as pp,pl as mp,pm as hp,pn as gp,pr as _p,pt as vp,pu as yp,q as bp,qA as xp,qL as Sp,qO as Cp,qS as wp,q_ as Tp,qa as Ep,qc as Dp,qd as Op,qg as kp,qh as Ap,qi as jp,qj as Mp,ql as Np,qn as Pp,qo as Fp,qt as Ip,qv as Lp,qx as Rp,qz as zp,r as Bp,rA as Vp,rC as Hp,rI as Up,rM as Wp,r_ as Gp,ra as Kp,rf as qp,rg as Jp,rj as Yp,rk as Xp,rm as Zp,rn as Qp,rr as $p,rs as em,rt as tm,ru as nm,s as rm,sA as eee,sI as tee,sM as nee,s_ as ree,sa as iee,sf as aee,sj as oee,sl as see,sm as cee,sr as im,ss as am,st as om,su as sm,sv as cm,t as L,tA as lm,tC as um,tI as dm,tM as fm,t_ as pm,ta as mm,tf as hm,tg as gm,tj as _m,tk as vm,tm as ym,tn as bm,tr as xm,ts as Sm,tt as Cm,tu as wm,u as Tm,uA as Em,uM as Dm,u_ as Om,ua as km,uf as Am,uj as jm,ul as Mm,um as Nm,ur as Pm,us as Fm,ut as Im,uu as Lm,v as Rm,vA as zm,vL as Bm,vM as Vm,v_ as Hm,va as Um,vf as Wm,vg as Gm,vi as Km,vj as qm,vl as Jm,vm as Ym,vr as Xm,vu as Zm,vv as Qm,w as $m,wA as eh,wL as th,wM as nh,w_ as rh,wa as ih,wf as ah,wg as oh,wi as sh,wj as lee,wl as uee,wm as ch,ws as dee,wt as fee,wv as lh,wx as uh,wz as pee,x as mee,xA as hee,xL as gee,xM as _ee,x_ as vee,xa as yee,xf as bee,xg as xee,xi as See,xj as Cee,xl as wee,xm as Tee,xo as dh,xr as fh,xs as Eee,xt as ph,xu as Dee,xv as Oee,xz as mh,y as R,yA as kee,yL as Aee,yM as jee,y_ as Mee,ya as Nee,yf as Pee,yg as Fee,yi as Iee,yj as Lee,yl as Ree,ym as hh,yr as gh,yu as zee,yv as Bee,z as Vee,zA as _h,zL as Hee,zS as Uee,zc as Wee,zd as Gee,zg as vh,zh as Kee,zi as qee,zj as yh,zl as Jee,zm as Yee,zn as Xee,zo as bh,zt as Zee,zv as Qee,zx as $ee,zz as ete}from"./api-Cpjr7qvl.js";import{t as xh}from"./x-Dqrt5OdW.js";import{a as Sh,c as tte,i as Ch,l as nte,n as wh,o as Th,r as Eh,s as Dh,t as Oh,u as kh}from"./dist-BbeTdjCM.js";import{a as Ah,i as jh,n as Mh,r as Nh,t as Ph}from"./dist-WboiKquG.js";import{n as Fh,t as Ih}from"./button-CbwCr9Pi.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 rte=a((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ite=a(((e,t)=>{t.exports=rte()})),ate=a((t=>{var r=ite(),i=e(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var te=Array.isArray,N=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function ae(e){return{current:e}}function oe(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function se(e,t){ie++,re[ie]=e.current,e.current=t}var ce=ae(null),le=ae(null),ue=ae(null),de=ae(null);function fe(e,t){switch(se(ue,t),se(le,e),se(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rf(t),e=af(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}oe(ce),se(ce,e)}function pe(){oe(ce),oe(le),oe(ue)}function me(e){e.memoizedState!==null&&se(de,e);var t=ce.current,n=af(t,e.type);t!==n&&(se(le,e),se(ce,n))}function he(e){le.current===e&&(oe(ce),oe(le)),de.current===e&&(oe(de),mp._currentValue=ne)}var ge,_e;function ve(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+ge+e+_e}var ye=!1;function be(e,t){if(!e||ye)return``;ye=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -103,29 +103,29 @@ You can add a description to the \`${FO}\` by passing a \`${zO}\` component as a
|
|
|
103
103
|
|
|
104
104
|
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${FO}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
105
105
|
|
|
106
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return z.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},cse=MO,lse=NO,use=PO,dse=IO,fse=VO,pse=UO,mse=RO,hse=BO;function WO(e){let t=z.useRef({value:e,previous:e});return z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var GO=`Checkbox`,[gse,_se]=Eu(GO),[vse,KO]=gse(GO);function yse(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ap({prop:n,defaultProp:i??!1,onChange:c,caller:GO}),[m,h]=z.useState(null),[g,_]=z.useState(null),v=z.useRef(!1),y=m?!!o||!!m.closest(`form`):!0,b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:ek(i)?!1:i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,B.jsx)(vse,{scope:t,...b,children:bse(d)?d(b):r})}var qO=`CheckboxTrigger`,JO=z.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=KO(qO,e),h=tt(i,u),g=z.useRef(c);return z.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,B.jsx)(ol.button,{type:`button`,role:`checkbox`,"aria-checked":ek(c)?`mixed`:c,"aria-required":l,"data-state":tk(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:R(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:R(n,e=>{d(e=>ek(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});JO.displayName=qO;var YO=z.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,B.jsx)(yse,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(JO,{...d,ref:t,__scopeCheckbox:n}),e&&(0,B.jsx)($O,{__scopeCheckbox:n})]})})});YO.displayName=GO;var XO=`CheckboxIndicator`,ZO=z.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=KO(XO,n);return(0,B.jsx)(fu,{present:r||ek(a.checked)||a.checked===!0,children:(0,B.jsx)(ol.span,{"data-state":tk(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});ZO.displayName=XO;var QO=`CheckboxBubbleInput`,$O=z.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=KO(QO,e),m=tt(n,p),h=WO(a),g=td(r);z.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=ek(a),n.call(e,ek(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=z.useRef(ek(a)?!1:a);return(0,B.jsx)(ol.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});$O.displayName=QO;function bse(e){return typeof e==`function`}function ek(e){return e===`indeterminate`}function tk(e){return ek(e)?`indeterminate`:e?`checked`:`unchecked`}var nk=`rovingFocusGroup.onEntryFocus`,xse={bubbles:!1,cancelable:!0},rk=`RovingFocusGroup`,[ik,ak,Sse]=OO(rk),[Cse,ok]=Eu(rk,[Sse]),[wse,Tse]=Cse(rk),sk=z.forwardRef((e,t)=>(0,B.jsx)(ik.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(ik.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Ese,{...e,ref:t})})}));sk.displayName=rk;var Ese=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=z.useRef(null),p=tt(t,f),m=kO(a),[h,g]=ap({prop:o,defaultProp:s??null,onChange:c,caller:rk}),[_,v]=z.useState(!1),y=Rm(l),b=ak(n),x=z.useRef(!1),[S,C]=z.useState(0);return z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(nk,y),()=>e.removeEventListener(nk,y)},[y]),(0,B.jsx)(wse,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:z.useCallback(e=>g(e),[g]),onItemShiftTab:z.useCallback(()=>v(!0),[]),onFocusableItemAdd:z.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:z.useCallback(()=>C(e=>e-1),[]),children:(0,B.jsx)(ol.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:R(e.onMouseDown,()=>{x.current=!0}),onFocus:R(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(nk,xse);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);uk([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:R(e.onBlur,()=>v(!1))})})}),ck=`RovingFocusGroupItem`,lk=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Rl(),l=a||c,u=Tse(ck,n),d=u.currentTabStopId===l,f=ak(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return z.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(ik.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(ol.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:R(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:R(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:R(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=kse(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ase(n,r+1):n.slice(r+1)}setTimeout(()=>uk(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});lk.displayName=ck;var Dse={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ose(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function kse(e,t,n){let r=Ose(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Dse[r]}function uk(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ase(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var dk=sk,fk=lk,pk=[`Enter`,` `],jse=[`ArrowDown`,`PageUp`,`Home`],mk=[`ArrowUp`,`PageDown`,`End`],Mse=[...jse,...mk],Nse={ltr:[...pk,`ArrowRight`],rtl:[...pk,`ArrowLeft`]},Pse={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},hk=`Menu`,[gk,Fse,Ise]=OO(hk),[_k,vk]=Eu(hk,[Ise,Ah,ok]),yk=Ah(),bk=ok(),[xk,Sk]=_k(hk),[Ck,wk]=_k(hk),Tk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=yk(t),[c,l]=z.useState(null),u=z.useRef(!1),d=Rm(a),f=kO(i);return z.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,B.jsx)(jh,{...s,children:(0,B.jsx)(xk,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,B.jsx)(Ck,{scope:t,onClose:z.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Tk.displayName=hk;var Ek=`MenuAnchor`,Dk=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=yk(n);return(0,B.jsx)(Ph,{...i,...r,ref:t})});Dk.displayName=Ek;var Ok=`MenuPortal`,[kk,Ak]=_k(Ok,{forceMount:void 0}),jk=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Sk(Ok,t);return(0,B.jsx)(kk,{scope:t,forceMount:n,children:(0,B.jsx)(fu,{present:n||a.open,children:(0,B.jsx)(Cl,{asChild:!0,container:i,children:r})})})};jk.displayName=Ok;var Mk=`MenuContent`,[Nk,Pk]=_k(Mk),Fk=z.forwardRef((e,t)=>{let n=Ak(Mk,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Sk(Mk,e.__scopeMenu),o=wk(Mk,e.__scopeMenu);return(0,B.jsx)(gk.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(fu,{present:r||a.open,children:(0,B.jsx)(gk.Slot,{scope:e.__scopeMenu,children:o.modal?(0,B.jsx)(Ik,{...i,ref:t}):(0,B.jsx)(Lk,{...i,ref:t})})})})}),Ik=z.forwardRef((e,t)=>{let n=Sk(Mk,e.__scopeMenu),r=z.useRef(null),i=tt(t,r);return z.useEffect(()=>{let e=r.current;if(e)return Wc(e)},[]),(0,B.jsx)(zk,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Lk=z.forwardRef((e,t)=>{let n=Sk(Mk,e.__scopeMenu);return(0,B.jsx)(zk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Rk=we(`MenuContent.ScrollLock`),zk=z.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Sk(Mk,n),_=wk(Mk,n),v=yk(n),y=bk(n),b=Fse(n),[x,S]=z.useState(null),C=z.useRef(null),w=tt(t,C,g.onContentChange),T=z.useRef(0),E=z.useRef(``),D=z.useRef(0),O=z.useRef(null),k=z.useRef(`right`),A=z.useRef(0),ee=m?Wf:z.Fragment,j=m?{as:Rk,allowPinchZoom:!0}:void 0,M=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=CA(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};z.useEffect(()=>()=>window.clearTimeout(T.current),[]),rm();let te=z.useCallback(e=>k.current===O.current?.side&&TA(e,O.current?.area),[]);return(0,B.jsx)(Nk,{scope:n,searchRef:E,onItemEnter:z.useCallback(e=>{te(e)&&e.preventDefault()},[te]),onItemLeave:z.useCallback(e=>{te(e)||(C.current?.focus(),S(null))},[te]),onTriggerLeave:z.useCallback(e=>{te(e)&&e.preventDefault()},[te]),pointerGraceTimerRef:D,onPointerGraceIntentChange:z.useCallback(e=>{O.current=e},[]),children:(0,B.jsx)(ee,{...j,children:(0,B.jsx)(Yd,{asChild:!0,trapped:i,onMountAutoFocus:R(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,B.jsx)(Tm,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,B.jsx)(dk,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:R(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,B.jsx)(Nh,{role:`menu`,"aria-orientation":`vertical`,"data-state":vA(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:R(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&M(e.key));let i=C.current;if(e.target!==i||!Mse.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);mk.includes(e.key)&&a.reverse(),xA(a)}),onBlur:R(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:R(e.onPointerMove,EA(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});Fk.displayName=Mk;var Bk=`MenuGroup`,Vk=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(ol.div,{role:`group`,...r,ref:t})});Vk.displayName=Bk;var Hk=`MenuLabel`,Uk=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(ol.div,{...r,ref:t})});Uk.displayName=Hk;var Wk=`MenuItem`,Gk=`menu.itemSelect`,Kk=z.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=z.useRef(null),o=wk(Wk,e.__scopeMenu),s=Pk(Wk,e.__scopeMenu),c=tt(t,a),l=z.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Gk,{bubbles:!0,cancelable:!0});e.addEventListener(Gk,e=>r?.(e),{once:!0}),mee(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,B.jsx)(qk,{...i,ref:c,disabled:n,onClick:R(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:R(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:R(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||pk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Kk.displayName=Wk;var qk=z.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Pk(Wk,n),s=bk(n),c=z.useRef(null),l=tt(t,c),[u,d]=z.useState(!1),[f,p]=z.useState(``);return z.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,B.jsx)(gk.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,B.jsx)(fk,{asChild:!0,...s,focusable:!r,children:(0,B.jsx)(ol.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:R(e.onPointerMove,EA(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,EA(e=>o.onItemLeave(e))),onFocus:R(e.onFocus,()=>d(!0)),onBlur:R(e.onBlur,()=>d(!1))})})})}),Jk=`MenuCheckboxItem`,Yk=z.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,B.jsx)(rA,{scope:e.__scopeMenu,checked:n,children:(0,B.jsx)(Kk,{role:`menuitemcheckbox`,"aria-checked":yA(n)?`mixed`:n,...i,ref:t,"data-state":bA(n),onSelect:R(i.onSelect,()=>r?.(yA(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Yk.displayName=Jk;var Xk=`MenuRadioGroup`,[Zk,Qk]=_k(Xk,{value:void 0,onValueChange:()=>{}}),$k=z.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Rm(r);return(0,B.jsx)(Zk,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,B.jsx)(Vk,{...i,ref:t})})});$k.displayName=Xk;var eA=`MenuRadioItem`,tA=z.forwardRef((e,t)=>{let{value:n,...r}=e,i=Qk(eA,e.__scopeMenu),a=n===i.value;return(0,B.jsx)(rA,{scope:e.__scopeMenu,checked:a,children:(0,B.jsx)(Kk,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":bA(a),onSelect:R(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});tA.displayName=eA;var nA=`MenuItemIndicator`,[rA,iA]=_k(nA,{checked:!1}),aA=z.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=iA(nA,n);return(0,B.jsx)(fu,{present:r||yA(a.checked)||a.checked===!0,children:(0,B.jsx)(ol.span,{...i,ref:t,"data-state":bA(a.checked)})})});aA.displayName=nA;var oA=`MenuSeparator`,sA=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(ol.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});sA.displayName=oA;var cA=`MenuArrow`,lA=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=yk(n);return(0,B.jsx)(Mh,{...i,...r,ref:t})});lA.displayName=cA;var uA=`MenuSub`,[dA,fA]=_k(uA),pA=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Sk(uA,t),o=yk(t),[s,c]=z.useState(null),[l,u]=z.useState(null),d=Rm(i);return z.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,B.jsx)(jh,{...o,children:(0,B.jsx)(xk,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,B.jsx)(dA,{scope:t,contentId:Rl(),triggerId:Rl(),trigger:s,onTriggerChange:c,children:n})})})};pA.displayName=uA;var mA=`MenuSubTrigger`,hA=z.forwardRef((e,t)=>{let n=Sk(mA,e.__scopeMenu),r=wk(mA,e.__scopeMenu),i=fA(mA,e.__scopeMenu),a=Pk(mA,e.__scopeMenu),o=z.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=z.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return z.useEffect(()=>u,[u]),z.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,B.jsx)(Dk,{asChild:!0,...l,children:(0,B.jsx)(qk,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":vA(n.open),...e,ref:uo(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,EA(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:R(e.onPointerLeave,EA(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Nse[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});hA.displayName=mA;var gA=`MenuSubContent`,_A=z.forwardRef((e,t)=>{let n=Ak(Mk,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=Sk(Mk,e.__scopeMenu),s=wk(Mk,e.__scopeMenu),c=fA(gA,e.__scopeMenu),l=z.useRef(null),u=tt(t,l);return(0,B.jsx)(gk.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(fu,{present:r||o.open,children:(0,B.jsx)(gk.Slot,{scope:e.__scopeMenu,children:(0,B.jsx)(zk,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:R(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Pse[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});_A.displayName=gA;function vA(e){return e?`open`:`closed`}function yA(e){return e===`indeterminate`}function bA(e){return yA(e)?`indeterminate`:e?`checked`:`unchecked`}function xA(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function SA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function CA(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=SA(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function wA(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function TA(e,t){return t?wA({x:e.clientX,y:e.clientY},t):!1}function EA(e){return t=>t.pointerType===`mouse`?e(t):void 0}var DA=Tk,OA=Dk,kA=jk,AA=Fk,jA=Vk,MA=Uk,NA=Kk,PA=Yk,FA=$k,IA=tA,LA=aA,RA=sA,zA=lA,BA=hA,VA=_A,HA=`DropdownMenu`,[UA,WA]=Eu(HA,[vk]),GA=vk(),[KA,qA]=UA(HA),JA=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=GA(t),l=z.useRef(null),[u,d]=ap({prop:i,defaultProp:a??!1,onChange:o,caller:HA});return(0,B.jsx)(KA,{scope:t,triggerId:Rl(),triggerRef:l,contentId:Rl(),open:u,onOpenChange:d,onOpenToggle:z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,B.jsx)(DA,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};JA.displayName=HA;var YA=`DropdownMenuTrigger`,XA=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=qA(YA,n),o=GA(n);return(0,B.jsx)(OA,{asChild:!0,...o,children:(0,B.jsx)(ol.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:uo(t,a.triggerRef),onPointerDown:R(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:R(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});XA.displayName=YA;var ZA=`DropdownMenuPortal`,QA=e=>{let{__scopeDropdownMenu:t,...n}=e,r=GA(t);return(0,B.jsx)(kA,{...r,...n})};QA.displayName=ZA;var $A=`DropdownMenuContent`,ej=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qA($A,n),a=GA(n),o=z.useRef(!1);return(0,B.jsx)(AA,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:R(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});ej.displayName=$A;var tj=`DropdownMenuGroup`,nj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(jA,{...i,...r,ref:t})});nj.displayName=tj;var rj=`DropdownMenuLabel`,ij=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(MA,{...i,...r,ref:t})});ij.displayName=rj;var aj=`DropdownMenuItem`,oj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(NA,{...i,...r,ref:t})});oj.displayName=aj;var sj=`DropdownMenuCheckboxItem`,cj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(PA,{...i,...r,ref:t})});cj.displayName=sj;var lj=`DropdownMenuRadioGroup`,uj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(FA,{...i,...r,ref:t})});uj.displayName=lj;var dj=`DropdownMenuRadioItem`,fj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(IA,{...i,...r,ref:t})});fj.displayName=dj;var pj=`DropdownMenuItemIndicator`,mj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(LA,{...i,...r,ref:t})});mj.displayName=pj;var hj=`DropdownMenuSeparator`,gj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(RA,{...i,...r,ref:t})});gj.displayName=hj;var _j=`DropdownMenuArrow`,vj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(zA,{...i,...r,ref:t})});vj.displayName=_j;var yj=`DropdownMenuSubTrigger`,bj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(BA,{...i,...r,ref:t})});bj.displayName=yj;var xj=`DropdownMenuSubContent`,Sj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(VA,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Sj.displayName=xj;var Cj=JA,wj=XA,Tj=QA,Ej=ej,Dj=ij,Oj=oj,kj=uj,Aj=fj,jj=mj,Mj=gj;function Nj(e,[t,n]){return Math.min(n,Math.max(t,e))}var Pj=`Popover`,[Fj,Lse]=Eu(Pj,[Ah]),Ij=Ah(),[Lj,Rj]=Fj(Pj),zj=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Ij(t),c=z.useRef(null),[l,u]=z.useState(!1),[d,f]=ap({prop:r,defaultProp:i??!1,onChange:a,caller:Pj});return(0,B.jsx)(jh,{...s,children:(0,B.jsx)(Lj,{scope:t,contentId:Rl(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:z.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:z.useCallback(()=>u(!0),[]),onCustomAnchorRemove:z.useCallback(()=>u(!1),[]),modal:o,children:n})})};zj.displayName=Pj;var Bj=`PopoverAnchor`,Vj=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Rj(Bj,n),a=Ij(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return z.useEffect(()=>(o(),()=>s()),[o,s]),(0,B.jsx)(Ph,{...a,...r,ref:t})});Vj.displayName=Bj;var Hj=`PopoverTrigger`,Uj=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Rj(Hj,n),a=Ij(n),o=tt(t,i.triggerRef),s=(0,B.jsx)(ol.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":iM(i.open),...r,ref:o,onClick:R(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,B.jsx)(Ph,{asChild:!0,...a,children:s})});Uj.displayName=Hj;var Wj=`PopoverPortal`,[Gj,Kj]=Fj(Wj,{forceMount:void 0}),qj=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Rj(Wj,t);return(0,B.jsx)(Gj,{scope:t,forceMount:n,children:(0,B.jsx)(fu,{present:n||a.open,children:(0,B.jsx)(Cl,{asChild:!0,container:i,children:r})})})};qj.displayName=Wj;var Jj=`PopoverContent`,Yj=z.forwardRef((e,t)=>{let n=Kj(Jj,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Rj(Jj,e.__scopePopover);return(0,B.jsx)(fu,{present:r||a.open,children:a.modal?(0,B.jsx)(Zj,{...i,ref:t}):(0,B.jsx)(Qj,{...i,ref:t})})});Yj.displayName=Jj;var Xj=we(`PopoverContent.RemoveScroll`),Zj=z.forwardRef((e,t)=>{let n=Rj(Jj,e.__scopePopover),r=z.useRef(null),i=tt(t,r),a=z.useRef(!1);return z.useEffect(()=>{let e=r.current;if(e)return Wc(e)},[]),(0,B.jsx)(Wf,{as:Xj,allowPinchZoom:!0,children:(0,B.jsx)($j,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:R(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Qj=z.forwardRef((e,t)=>{let n=Rj(Jj,e.__scopePopover),r=z.useRef(!1),i=z.useRef(!1);return(0,B.jsx)($j,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),$j=z.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Rj(Jj,n),p=Ij(n);return rm(),(0,B.jsx)(Yd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(Tm,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,B.jsx)(Nh,{"data-state":iM(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),eM=`PopoverClose`,tM=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Rj(eM,n);return(0,B.jsx)(ol.button,{type:`button`,...r,ref:t,onClick:R(e.onClick,()=>i.onOpenChange(!1))})});tM.displayName=eM;var nM=`PopoverArrow`,rM=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ij(n);return(0,B.jsx)(Mh,{...i,...r,ref:t})});rM.displayName=nM;function iM(e){return e?`open`:`closed`}var aM=zj,oM=Uj,sM=qj,cM=Yj,lM=[` `,`Enter`,`ArrowUp`,`ArrowDown`],uM=[` `,`Enter`],dM=`Select`,[fM,pM,mM]=OO(dM),[hM,Rse]=Eu(dM,[mM,Ah]),gM=Ah(),[_M,vM]=hM(dM),[yM,bM]=hM(dM),xM=`SelectProvider`;function SM(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=gM(t),[_,v]=z.useState(null),[y,b]=z.useState(null),[x,S]=z.useState(!1),C=kO(l),[w,T]=ap({prop:r,defaultProp:i??!1,onChange:a,caller:dM}),[E,D]=ap({prop:o,defaultProp:s,onChange:c,caller:dM}),O=z.useRef(null),k=_?!!m||!!_.closest(`form`):!0,[A,ee]=z.useState(new Set),j=Rl(),M=Array.from(A).map(e=>e.props.value).join(`;`),te=z.useCallback(e=>{ee(t=>new Set(t).add(e))},[]),N=z.useCallback(e=>{ee(t=>{let n=new Set(t);return n.delete(e),n})},[]),P={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:j,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:A,nativeSelectKey:M,isFormControl:k};return(0,B.jsx)(jh,{...g,children:(0,B.jsx)(_M,{scope:t,...P,children:(0,B.jsx)(fM.Provider,{scope:t,children:(0,B.jsx)(yM,{scope:t,onNativeOptionAdd:te,onNativeOptionRemove:N,children:Kse(h)?h(P):n})})})})}SM.displayName=xM;var CM=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,B.jsx)(SM,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[n,e?(0,B.jsx)(mN,{__scopeSelect:t}):null]})})};CM.displayName=dM;var wM=`SelectTrigger`,TM=z.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=gM(n),o=vM(wM,n),s=o.disabled||r,c=tt(t,o.onTriggerChange),l=pM(n),u=z.useRef(`touch`),[d,f,p]=gN(e=>{let t=l().filter(e=>!e.disabled),n=_N(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,B.jsx)(Ph,{asChild:!0,...a,children:(0,B.jsx)(ol.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":hN(o.value)?``:void 0,...i,ref:c,onClick:R(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:R(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:R(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&lM.includes(e.key)&&(m(),e.preventDefault())})})})});TM.displayName=wM;var EM=`SelectValue`,DM=z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=vM(EM,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=tt(t,c.onValueNodeChange);uf(()=>{l(u)},[l,u]);let f=hN(c.value);return(0,B.jsx)(ol.span,{...s,asChild:f?!1:s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,B.jsx)(z.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});DM.displayName=EM;var OM=`SelectIcon`,kM=z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(ol.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});kM.displayName=OM;var AM=`SelectPortal`,[jM,MM]=hM(AM,{forceMount:void 0}),NM=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,B.jsx)(jM,{scope:e.__scopeSelect,forceMount:n,children:(0,B.jsx)(Cl,{asChild:!0,...r})})};NM.displayName=AM;var PM=`SelectContent`,FM=z.forwardRef((e,t)=>{let n=MM(PM,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=vM(PM,e.__scopeSelect),[o,s]=z.useState();return uf(()=>{s(new DocumentFragment)},[]),(0,B.jsx)(fu,{present:r||a.open,children:({present:e})=>e?(0,B.jsx)(HM,{...i,ref:t}):(0,B.jsx)(IM,{...i,fragment:o})})});FM.displayName=PM;var IM=z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Fv.createPortal((0,B.jsx)(RM,{scope:n,children:(0,B.jsx)(fM.Slot,{scope:n,children:(0,B.jsx)(`div`,{ref:t,children:r})})}),i):null});IM.displayName=`SelectContentFragment`;var LM=10,[RM,zM]=hM(PM),BM=`SelectContentImpl`,VM=we(`SelectContent.RemoveScroll`),HM=z.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=vM(PM,n),[y,b]=z.useState(null),[x,S]=z.useState(null),C=tt(t,e=>b(e)),[w,T]=z.useState(null),[E,D]=z.useState(null),O=pM(n),[k,A]=z.useState(!1),ee=z.useRef(!1);z.useEffect(()=>{if(y)return Wc(y)},[y]),rm();let j=z.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),M=z.useCallback(()=>j([w,y]),[j,w,y]);z.useEffect(()=>{k&&M()},[k,M]);let{onOpenChange:te,triggerPointerDownPosRef:N}=v;z.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||te(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,te,N]),z.useEffect(()=>{let e=()=>te(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[te]);let[P,ne]=gN(e=>{let t=O().filter(e=>!e.disabled),n=_N(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),re=z.useCallback((e,t,n)=>{let r=!ee.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(ee.current=!0))},[v.value]),ie=z.useCallback(()=>y?.focus(),[y]),ae=z.useCallback((e,t,n)=>{let r=!ee.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),oe=r===`popper`?KM:WM,se=oe===KM?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,B.jsx)(RM,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:re,selectedItem:w,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:M,selectedItemText:E,position:r,isPositioned:k,searchRef:P,children:(0,B.jsx)(Wf,{as:VM,allowPinchZoom:!0,children:(0,B.jsx)(Yd,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:R(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(Tm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,B.jsx)(oe,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:R(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>j(t)),e.preventDefault()}})})})})})})});HM.displayName=BM;var UM=`SelectItemAlignedPosition`,WM=z.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=vM(PM,n),o=zM(PM,n),[s,c]=z.useState(null),[l,u]=z.useState(null),d=tt(t,e=>u(e)),f=pM(n),p=z.useRef(!1),m=z.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=z.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-LM,d=Nj(a,[LM,Math.max(LM,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-LM,d=Nj(a,[LM,Math.max(LM,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-LM*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-LM,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,ee=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ee;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${LM}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);uf(()=>y(),[y]);let[b,x]=z.useState();return uf(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,B.jsx)(qM,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:z.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,B.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,B.jsx)(ol.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});WM.displayName=UM;var GM=`SelectPopperPosition`,KM=z.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=LM,...a}=e,o=gM(n);return(0,B.jsx)(Nh,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});KM.displayName=GM;var[qM,JM]=hM(PM,{}),YM=`SelectViewport`,XM=z.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=zM(YM,n),o=JM(YM,n),s=tt(t,a.onViewportChange),c=z.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,B.jsx)(fM.Slot,{scope:n,children:(0,B.jsx)(ol.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:R(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-LM*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});XM.displayName=YM;var ZM=`SelectGroup`,[QM,zse]=hM(ZM),Bse=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Rl();return(0,B.jsx)(QM,{scope:n,id:i,children:(0,B.jsx)(ol.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Bse.displayName=ZM;var $M=`SelectLabel`,Vse=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=zse($M,n);return(0,B.jsx)(ol.div,{id:i.id,...r,ref:t})});Vse.displayName=$M;var eN=`SelectItem`,[Hse,tN]=hM(eN),nN=z.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=vM(eN,n),c=zM(eN,n),l=s.value===r,[u,d]=z.useState(a??``),[f,p]=z.useState(!1),m=tt(t,e=>c.itemRefCallback?.(e,r,i)),h=Rl(),g=z.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,B.jsx)(Hse,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:z.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(fM.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,B.jsx)(ol.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:R(o.onFocus,()=>p(!0)),onBlur:R(o.onBlur,()=>p(!1)),onClick:R(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:R(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:R(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:R(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:R(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(uM.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});nN.displayName=eN;var rN=`SelectItemText`,iN=z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=vM(rN,n),s=zM(rN,n),c=tN(rN,n),l=bM(rN,n),[u,d]=z.useState(null),f=tt(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=z.useMemo(()=>(0,B.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return uf(()=>(h(m),()=>g(m)),[h,g,m]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ol.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Fv.createPortal(a.children,o.valueNode):null]})});iN.displayName=rN;var aN=`SelectItemIndicator`,oN=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return tN(aN,n).isSelected?(0,B.jsx)(ol.span,{"aria-hidden":!0,...r,ref:t}):null});oN.displayName=aN;var sN=`SelectScrollUpButton`,cN=z.forwardRef((e,t)=>{let n=zM(sN,e.__scopeSelect),r=JM(sN,e.__scopeSelect),[i,a]=z.useState(!1),o=tt(t,r.onScrollButtonChange);return uf(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(dN,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});cN.displayName=sN;var lN=`SelectScrollDownButton`,uN=z.forwardRef((e,t)=>{let n=zM(lN,e.__scopeSelect),r=JM(lN,e.__scopeSelect),[i,a]=z.useState(!1),o=tt(t,r.onScrollButtonChange);return uf(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(dN,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});uN.displayName=lN;var dN=z.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=zM(`SelectScrollButton`,n),o=z.useRef(null),s=pM(n),c=z.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return z.useEffect(()=>()=>c(),[c]),uf(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,B.jsx)(ol.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:R(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:R(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:R(i.onPointerLeave,()=>{c()})})}),Use=`SelectSeparator`,Wse=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(ol.div,{"aria-hidden":!0,...r,ref:t})});Wse.displayName=Use;var fN=`SelectArrow`,Gse=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=gM(n);return zM(fN,n).position===`popper`?(0,B.jsx)(Mh,{...i,...r,ref:t}):null});Gse.displayName=fN;var pN=`SelectBubbleInput`,mN=z.forwardRef(({__scopeSelect:e,...t},n)=>{let r=vM(pN,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=z.useRef(null),m=tt(n,p),h=i??``,g=WO(h);return z.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,B.jsxs)(ol.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...EO,...t.style},ref:m,defaultValue:h,children:[hN(i)?(0,B.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});mN.displayName=pN;function Kse(e){return typeof e==`function`}function hN(e){return e===``||e===void 0}function gN(e){let t=Rm(e),n=z.useRef(``),r=z.useRef(0),i=z.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=z.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return z.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function _N(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=qse(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function qse(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var[vN,Jse]=Eu(`Tooltip`,[Ah]),yN=Ah(),bN=`TooltipProvider`,Yse=700,xN=`tooltip.open`,[Xse,SN]=vN(bN),CN=e=>{let{__scopeTooltip:t,delayDuration:n=Yse,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=z.useRef(!0),s=z.useRef(!1),c=z.useRef(0);return z.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(Xse,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:z.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};CN.displayName=bN;var wN=`Tooltip`,[Zse,TN]=vN(wN),EN=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=SN(wN,e.__scopeTooltip),l=yN(t),[u,d]=z.useState(null),f=Rl(),p=z.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=z.useRef(!1),[_,v]=ap({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(xN))):c.onClose(),a?.(e)},caller:wN}),y=z.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=z.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return z.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(jh,{...l,children:(0,B.jsx)(Zse,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:z.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:z.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};EN.displayName=wN;var DN=`TooltipTrigger`,ON=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=TN(DN,n),a=SN(DN,n),o=yN(n),s=tt(t,z.useRef(null),i.onTriggerChange),c=z.useRef(!1),l=z.useRef(!1),u=z.useCallback(()=>c.current=!1,[]);return z.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(Ph,{asChild:!0,...o,children:(0,B.jsx)(ol.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:R(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:R(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:R(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:R(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:R(e.onBlur,i.onClose),onClick:R(e.onClick,i.onClose)})})});ON.displayName=DN;var kN=`TooltipPortal`,[Qse,$se]=vN(kN,{forceMount:void 0}),AN=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=TN(kN,t);return(0,B.jsx)(Qse,{scope:t,forceMount:n,children:(0,B.jsx)(fu,{present:n||a.open,children:(0,B.jsx)(Cl,{asChild:!0,container:i,children:r})})})};AN.displayName=kN;var jN=`TooltipContent`,MN=z.forwardRef((e,t)=>{let n=$se(jN,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=TN(jN,e.__scopeTooltip);return(0,B.jsx)(fu,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(NN,{side:i,...a,ref:t}):(0,B.jsx)(ece,{side:i,...a,ref:t})})}),ece=z.forwardRef((e,t)=>{let n=TN(jN,e.__scopeTooltip),r=SN(jN,e.__scopeTooltip),i=z.useRef(null),a=tt(t,i),[o,s]=z.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=z.useCallback(()=>{s(null),d(!1)},[d]),p=z.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=ace(r,ice(r,n.getBoundingClientRect())),a=oce(t.getBoundingClientRect());s(cce([...i,...a])),d(!0)},[d]);return z.useEffect(()=>()=>f(),[f]),z.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),z.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!sce(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(NN,{...e,ref:a})}),[tce,nce]=vN(wN,{isInside:!1}),rce=$m(`TooltipContent`),NN=z.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=TN(jN,n),l=yN(n),{onClose:u}=c;return z.useEffect(()=>(document.addEventListener(xN,u),()=>document.removeEventListener(xN,u)),[u]),z.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(Tm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Nh,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(rce,{children:r}),(0,B.jsx)(tce,{scope:n,isInside:!0,children:(0,B.jsx)(Yoe,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});MN.displayName=jN;var PN=`TooltipArrow`,FN=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=yN(n);return nce(PN,n).isInside?null:(0,B.jsx)(Mh,{...i,...r,ref:t})});FN.displayName=PN;function ice(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function ace(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function oce(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function sce(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cce(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),lce(t)}function lce(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var uce=CN,dce=EN,fce=ON,pce=AN,mce=MN,hce=FN,IN=WA(),LN=e=>{let t=V(25),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({__scopeActionBarMore:n,open:i,onOpenChange:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=IN(n),s=joe(),c=BS(null),l=i!==void 0,u;t[5]===s?u=t[6]:(u=e=>{if(e){if(c.current)return;c.current=s?.acquireInteractionLock()??null;return}c.current?.(),c.current=null},t[5]=s,t[6]=u);let d=u,f;t[7]!==l||t[8]!==r||t[9]!==d?(f=e=>{l||d(e),r?.(e)},t[7]=l,t[8]=r,t[9]=d,t[10]=f):f=t[10];let p=f,m,h;t[11]!==l||t[12]!==i||t[13]!==d?(m=()=>{l&&d(!!i)},h=[l,i,d],t[11]=l,t[12]=i,t[13]=d,t[14]=m,t[15]=h):(m=t[14],h=t[15]),US(m,h);let g,_;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>()=>{c.current?.(),c.current=null},_=[],t[16]=g,t[17]=_):(g=t[16],_=t[17]),US(g,_);let v;t[18]===i?v=t[19]:(v=i===void 0?null:{open:i},t[18]=i,t[19]=v);let y;return t[20]!==p||t[21]!==a||t[22]!==o||t[23]!==v?(y=(0,B.jsx)(Cj,{...o,...a,...v,onOpenChange:p}),t[20]=p,t[21]=a,t[22]=o,t[23]=v,t[24]=y):y=t[24],y};LN.displayName=`ActionBarMorePrimitive.Root`;var gce=hO(wj),_ce=hO(Ej),vce=hO(Oj),yce=hO(Mj),RN=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({__scopeActionBarMore:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=IN(r),o;return n[3]!==t||n[4]!==i||n[5]!==a?(o=(0,B.jsx)(gce,{...a,...i,ref:t}),n[3]=t,n[4]=i,n[5]=a,n[6]=o):o=n[6],o});RN.displayName=`ActionBarMorePrimitive.Trigger`;var zN=(0,FS.forwardRef)((e,t)=>{let n=V(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({__scopeActionBarMore:r,portalProps:i,sideOffset:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?4:o,c=IN(r),l;n[5]!==t||n[6]!==a||n[7]!==c||n[8]!==s?(l=(0,B.jsx)(_ce,{...c,...a,ref:t,sideOffset:s}),n[5]=t,n[6]=a,n[7]=c,n[8]=s,n[9]=l):l=n[9];let u;return n[10]!==i||n[11]!==c||n[12]!==l?(u=(0,B.jsx)(Tj,{...c,...i,children:l}),n[10]=i,n[11]=c,n[12]=l,n[13]=u):u=n[13],u});zN.displayName=`ActionBarMorePrimitive.Content`;var BN=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({__scopeActionBarMore:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=IN(r),o;return n[3]!==t||n[4]!==i||n[5]!==a?(o=(0,B.jsx)(vce,{...a,...i,ref:t}),n[3]=t,n[4]=i,n[5]=a,n[6]=o):o=n[6],o});BN.displayName=`ActionBarMorePrimitive.Item`;var VN=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({__scopeActionBarMore:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=IN(r),o;return n[3]!==t||n[4]!==i||n[5]!==a?(o=(0,B.jsx)(yce,{...a,...i,ref:t}),n[3]=t,n[4]=i,n[5]=a,n[6]=o):o=n[6],o});VN.displayName=`ActionBarMorePrimitive.Separator`;var HN=mO({Content:()=>zN,Item:()=>BN,Root:()=>LN,Separator:()=>VN,Trigger:()=>RN}),UN=(0,FS.forwardRef)((e,t)=>{let n=V(3),r;return n[0]!==e||n[1]!==t?(r=(0,B.jsx)(gO.div,{...e,ref:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});UN.displayName=`AttachmentPrimitive.Root`;var WN=(0,FS.forwardRef)((e,t)=>{let n=V(4),r=H(bce),i;return n[0]!==r||n[1]!==e||n[2]!==t?(i=(0,B.jsxs)(gO.div,{...e,ref:t,children:[`.`,r]}),n[0]=r,n[1]=e,n[2]=t,n[3]=i):i=n[3],i});WN.displayName=`AttachmentPrimitive.unstable_Thumb`;function bce(e){let t=e.attachment.name.split(`.`);return t.length>1?t.pop():``}var GN=()=>{let e=V(2),t=H(xce),n;return e[0]===t?n=e[1]:(n=(0,B.jsx)(B.Fragment,{children:t}),e[0]=t,e[1]=n),n};GN.displayName=`AttachmentPrimitive.Name`;function xce(e){return e.attachment.name}var Sce=bO(`AttachmentPrimitive.Remove`,()=>{let e=V(2),t=ZC(),n;return e[0]===t?n=e[1]:(n=()=>{t.attachment().remove()},e[0]=t,e[1]=n),n}),KN=mO({Name:()=>GN,Remove:()=>Sce,Root:()=>UN,unstable_Thumb:()=>WN}),Cce=e=>{let t=V(12),n;return t[0]!==e.assistant||t[1]!==e.copied||t[2]!==e.hasAttachments||t[3]!==e.hasBranches||t[4]!==e.hasContent||t[5]!==e.last||t[6]!==e.lastOrHover||t[7]!==e.speaking||t[8]!==e.submittedFeedback||t[9]!==e.system||t[10]!==e.user?(n=t=>{let{role:n,attachments:r,parts:i,branchCount:a,isLast:o,speech:s,isCopied:c,isHovering:l}=t.message;return!(e.hasBranches===!0&&a<2||e.user&&n!==`user`||e.assistant&&n!==`assistant`||e.system&&n!==`system`||e.lastOrHover===!0&&!l&&!o||e.last!==void 0&&e.last!==o||e.copied===!0&&!c||e.copied===!1&&c||e.speaking===!0&&s==null||e.speaking===!1&&s!=null||e.hasAttachments===!0&&(n!==`user`||!r?.length)||e.hasAttachments===!1&&n===`user`&&r?.length||e.hasContent===!0&&i.length===0||e.hasContent===!1&&i.length>0||e.submittedFeedback!==void 0&&(t.message.metadata.submittedFeedback?.type??null)!==e.submittedFeedback)},t[0]=e.assistant,t[1]=e.copied,t[2]=e.hasAttachments,t[3]=e.hasBranches,t[4]=e.hasContent,t[5]=e.last,t[6]=e.lastOrHover,t[7]=e.speaking,t[8]=e.submittedFeedback,t[9]=e.system,t[10]=e.user,t[11]=n):n=t[11],H(n)},qN=e=>{let t=V(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),Cce(r)?n:null};qN.displayName=`MessagePrimitive.If`;var JN=JS(null),YN=()=>XS(JN),wce=e=>{let t=V(8),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Map,t[0]=r):r=t[0];let i=BS(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[1]=a):a=t[1];let o=BS(a),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=Array.from(i.current.entries());e.sort(Tce),o.current=e.map(Ece)},t[2]=s):s=t[2];let c=s,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(e,t)=>{let n=t?.priority??0;return i.current.set(e,n),c(),()=>{i.current.delete(e),c()}},t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o.current,t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p={register:u,getPlugins:f},t[5]=p):p=t[5];let m=p,h;return t[6]===n?h=t[7]:(h=(0,B.jsx)(JN.Provider,{value:m,children:n}),t[6]=n,t[7]=h),h};function Tce(e,t){return t[1]-e[1]}function Ece(e){let[t]=e;return t}var XN=JS(null),ZN=JS(null),QN=()=>{let e=XS(XN);if(!e)throw Error(`useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot`);return e},$N=()=>XS(XN),Dce=()=>{let e=XS(ZN);if(!e)throw Error(`useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot`);return e},Oce=()=>{let e=QN();return KS(e.subscribe,e.getTriggers,e.getTriggers)},kce=new Map,eP=()=>()=>{},tP=()=>kce,Ace=()=>{let e=$N();return KS(e?e.subscribe:eP,e?e.getTriggers:tP,e?e.getTriggers:tP)},nP=()=>null,jce=()=>{let e=$N();return KS(e?e.subscribeAria:eP,e?e.getActiveAria:nP,e?e.getActiveAria:nP)};function rP(){let e=V(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=new Set,e[0]=t):t=e[0];let n=BS(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{for(let e of n.current)e()},e[1]=r):r=e[1];let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>(n.current.add(e),()=>{n.current.delete(e)}),e[2]=a):a=e[2];let o=a,s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s={notify:i,subscribe:o},e[3]=s):s=e[3],s}var iP=e=>{let t=V(21),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Map,t[0]=r):r=t[0];let i=BS(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=new Set,t[1]=a):a=t[1];let o=BS(a),{notify:s,subscribe:c}=rP(),l;t[2]===s?l=t[3]:(l=e=>{let{char:t}=e;if(i.current.has(t))return Mce;let n=new Map(i.current);n.set(t,e),i.current=n,s();for(let t of o.current)t.added(e);return()=>{let e=new Map(i.current);e.delete(t),i.current=e,s();for(let e of o.current)e.removed(t)}},t[2]=s,t[3]=l);let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>i.current,t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>(o.current.add(e),()=>{o.current.delete(e)}),t[5]=p):p=t[5];let m=p,h=BS(null),g=BS(null),{notify:_,subscribe:v}=rP(),y;t[6]===_?y=t[7]:(y=(e,t)=>{if(t===null){if(g.current!==e)return;h.current=null,g.current=null,_();return}let n=h.current;g.current===e&&n!==null&&n.popoverId===t.popoverId&&n.highlightedItemId===t.highlightedItemId||(h.current=t,g.current=e,_())},t[6]=_,t[7]=y);let b=y,x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>h.current,t[8]=x):x=t[8];let S=x,C;t[9]!==u||t[10]!==c||t[11]!==v?(C={register:u,getTriggers:f,subscribe:c,subscribeLifecycle:m,getActiveAria:S,subscribeAria:v},t[9]=u,t[10]=c,t[11]=v,t[12]=C):C=t[12];let w=C,T;t[13]===b?T=t[14]:(T={setActiveAria:b},t[13]=b,t[14]=T);let E=T,D;t[15]!==E||t[16]!==n?(D=(0,B.jsx)(ZN.Provider,{value:E,children:n}),t[15]=E,t[16]=n,t[17]=D):D=t[17];let O;return t[18]!==D||t[19]!==w?(O=(0,B.jsx)(XN.Provider,{value:w,children:D}),t[18]=D,t[19]=w,t[20]=O):O=t[20],O},aP=e=>{let t=V(4),{children:n}=e;if(YN()){let e;return t[0]===n?e=t[1]:(e=(0,B.jsx)(iP,{children:n}),t[0]=n,t[1]=e),e}let r;return t[2]===n?r=t[3]:(r=(0,B.jsx)(wce,{children:(0,B.jsx)(iP,{children:n})}),t[2]=n,t[3]=r),r};aP.displayName=`ComposerPrimitive.TriggerPopoverRoot`;function Mce(){}var oP=/\s/u;function Nce(e,t,n){let r=e.slice(0,n);for(let e=r.length-1;e>=0;e--){let n=r[e];if(oP.test(n))return null;if(r.startsWith(t,e)){if(e>0&&!oP.test(r[e-1]))continue;return{query:r.slice(e+t.length),offset:e}}}return null}var Pce=eC(e=>{let t=V(7),{text:n,triggerChar:r}=e,[i,a]=RS(n.length),o=Math.min(i,n.length),s;t[0]!==o||t[1]!==n||t[2]!==r?(s=Nce(n,r,o),t[0]=o,t[1]=n,t[2]=r,t[3]=s):s=t[3];let c=s,l=c?.query??``,u;return t[4]!==l||t[5]!==c?(u={trigger:c,query:l,setCursorPosition:a},t[4]=l,t[5]=c,t[6]=u):u=t[6],u});function Fce(e){return`type`in e}var Ice=eC(e=>{let t=V(25),{navigableList:n,isSearchMode:r,activeCategoryId:i,query:a,popoverId:o,open:s,selectItem:c,selectCategory:l,goBack:u,close:d}=e,[f,p]=RS(0),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{p(0)},t[0]=m):m=t[0];let h;t[1]===n?h=t[2]:(h=[n],t[1]=n,t[2]=h),US(m,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{p(0)},t[3]=g):g=t[3];let _;t[4]!==i||t[5]!==r?(_=[r,i],t[4]=i,t[5]=r,t[6]=_):_=t[6],US(g,_);let v;t[7]!==f||t[8]!==n.length?(v=e=>{e<0||e>=n.length||e!==f&&p(e)},t[7]=f,t[8]=n.length,t[9]=v):v=t[9];let y=GS(v),b;t[10]!==i||t[11]!==d||t[12]!==u||t[13]!==f||t[14]!==n||t[15]!==s||t[16]!==a||t[17]!==l||t[18]!==c?(b=e=>{if(!s)return!1;switch(e.key){case`ArrowDown`:return e.preventDefault(),p(e=>{let t=n.length;return t===0?0:e<t-1?e+1:0}),!0;case`ArrowUp`:return e.preventDefault(),p(e=>{let t=n.length;return t===0?0:e>0?e-1:t-1}),!0;case`Enter`:case`Tab`:{if(e.shiftKey)return!1;e.preventDefault();let t=n[f];return t&&(Fce(t)?c(t):l(t.id)),!0}case`Escape`:return e.preventDefault(),d(),!0;case`Backspace`:return i&&a===``?(e.preventDefault(),u(),!0):!1;default:return!1}},t[10]=i,t[11]=d,t[12]=u,t[13]=f,t[14]=n,t[15]=s,t[16]=a,t[17]=l,t[18]=c,t[19]=b):b=t[19];let x=GS(b),S=n[f],C=s&&S?`${o}-option-${S.id}`:void 0,w;return t[20]!==x||t[21]!==y||t[22]!==f||t[23]!==C?(w={highlightedIndex:f,highlightedItemId:C,highlightIndex:y,handleKeyDown:x},t[20]=x,t[21]=y,t[22]=f,t[23]=C,t[24]=w):w=t[24],w});function sP(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}var Lce=eC(e=>{let t=V(38),{adapter:n,query:r,open:i}=e,[a,o]=RS(null),s,c;t[0]===i?(s=t[1],c=t[2]):(s=()=>{i||o(null)},c=[i],t[0]=i,t[1]=s,t[2]=c),US(s,c);let l;bb0:{if(!i||!n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[3]=e):e=t[3],l=e;break bb0}let e;t[4]===n?e=t[5]:(e=n.categories(),t[4]=n,t[5]=e),l=e}let u=l,d=i?a:null,f;bb1:{if(!d||!n){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[6]=e):e=t[6],f=e;break bb1}let e;t[7]!==n||t[8]!==d?(e=n.categoryItems(d),t[7]=n,t[8]=d,t[9]=e):e=t[9],f=e}let p=f,m;bb2:{if(!i||!n||d){m=null;break bb2}if(!r&&u.length>0){m=null;break bb2}if(n.search){let e;t[10]!==n||t[11]!==r?(e=n.search(r),t[10]=n,t[11]=r,t[12]=e):e=t[12],m=e;break bb2}let e;if(t[13]!==n||t[14]!==u||t[15]!==r){e=[];let i=r.toLowerCase();for(let t of u)for(let r of n.categoryItems(t.id))sP(r,i)&&e.push(r);t[13]=n,t[14]=u,t[15]=r,t[16]=e}else e=t[16];m=e}let h=m,g=h!==null,_;bb3:{if(g){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[17]=e):e=t[17],_=e;break bb3}if(!r){_=u;break bb3}let e;if(t[18]!==u||t[19]!==r){let n=r.toLowerCase();e=u.filter(e=>e.label.toLowerCase().includes(n)),t[18]=u,t[19]=r,t[20]=e}else e=t[20];_=e}let v=_,y;bb4:{if(g){let e;t[21]===h?e=t[22]:(e=h??[],t[21]=h,t[22]=e),y=e;break bb4}if(!r){y=p;break bb4}let e;if(t[23]!==p||t[24]!==r){let n=r.toLowerCase();e=p.filter(e=>sP(e,n)),t[23]=p,t[24]=r,t[25]=e}else e=t[25];y=e}let b=y,x;bb5:{if(g){let e;t[26]===h?e=t[27]:(e=h??[],t[26]=h,t[27]=e),x=e;break bb5}if(d){x=b;break bb5}x=v}let S=x,C;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{o(e)},t[28]=C):C=t[28];let w=GS(C),T;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{o(null)},t[29]=T):T=t[29];let E=GS(T),D;return t[30]!==d||t[31]!==v||t[32]!==b||t[33]!==E||t[34]!==g||t[35]!==S||t[36]!==w?(D={categories:v,items:b,isSearchMode:g,activeCategoryId:d,navigableList:S,selectCategory:w,goBack:E},t[30]=d,t[31]=v,t[32]=b,t[33]=E,t[34]=g,t[35]=S,t[36]=w,t[37]=D):D=t[37],D}),Rce=eC(e=>{let t=V(15),{behavior:n,trigger:r,aui:i,triggerChar:a,setCursorPosition:o,onSelected:s}=e,c=BS(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>(c.current=e,()=>{c.current===e&&(c.current=null)}),t[0]=l):l=t[0];let u=GS(l),d;t[1]!==i||t[2]!==n||t[3]!==s||t[4]!==r||t[5]!==a?(d=e=>{if(!r||!n)return;if(c.current?.(e)){s();return}let t=i.composer().getState().text,o=t.slice(0,r.offset),l=t.slice(r.offset+a.length+r.query.length),u=()=>{let t=n.formatter.serialize(e);i.composer().setText(o+t+(l.startsWith(` `)?l:` ${l}`))};n.kind===`directive`?(u(),n.onInserted?.(e)):(n.removeOnExecute?i.composer().setText(o+(l.startsWith(` `)?l.slice(1):l)):u(),n.onExecute(e)),s()},t[1]=i,t[2]=n,t[3]=s,t[4]=r,t[5]=a,t[6]=d):d=t[6];let f=GS(d),p;t[7]!==s||t[8]!==o||t[9]!==r?(p=()=>{s(),r&&o(r.offset)},t[7]=s,t[8]=o,t[9]=r,t[10]=p):p=t[10];let m=GS(p),h;return t[11]!==m||t[12]!==u||t[13]!==f?(h={selectItem:f,close:m,registerSelectItemOverride:u},t[11]=m,t[12]=u,t[13]=f,t[14]=h):h=t[14],h}),zce=eC(e=>{let t=V(46),{adapter:n,text:r,triggerChar:i,behavior:a,aui:o,popoverId:s,isLoading:c}=e,l;t[0]!==r||t[1]!==i?(l=Pce({text:r,triggerChar:i}),t[0]=r,t[1]=i,t[2]=l):l=t[2];let u=gC(l),d=u.trigger!==null&&n!==void 0&&a!==void 0,f;t[3]!==n||t[4]!==u.query||t[5]!==d?(f=Lce({adapter:n,query:u.query,open:d}),t[3]=n,t[4]=u.query,t[5]=d,t[6]=f):f=t[6];let p=gC(f),m;t[7]===p?m=t[8]:(m=()=>{p.goBack()},t[7]=p,t[8]=m);let h=GS(m),g;t[9]!==o||t[10]!==a||t[11]!==u.setCursorPosition||t[12]!==u.trigger||t[13]!==h||t[14]!==i?(g=Rce({behavior:a,trigger:u.trigger,aui:o,triggerChar:i,setCursorPosition:u.setCursorPosition,onSelected:h}),t[9]=o,t[10]=a,t[11]=u.setCursorPosition,t[12]=u.trigger,t[13]=h,t[14]=i,t[15]=g):g=t[15];let _=gC(g),v;t[16]!==u.query||t[17]!==p.activeCategoryId||t[18]!==p.goBack||t[19]!==p.isSearchMode||t[20]!==p.navigableList||t[21]!==p.selectCategory||t[22]!==d||t[23]!==s||t[24]!==_.close||t[25]!==_.selectItem?(v=Ice({navigableList:p.navigableList,isSearchMode:p.isSearchMode,activeCategoryId:p.activeCategoryId,query:u.query,popoverId:s,open:d,selectItem:_.selectItem,selectCategory:p.selectCategory,goBack:p.goBack,close:_.close}),t[16]=u.query,t[17]=p.activeCategoryId,t[18]=p.goBack,t[19]=p.isSearchMode,t[20]=p.navigableList,t[21]=p.selectCategory,t[22]=d,t[23]=s,t[24]=_.close,t[25]=_.selectItem,t[26]=v):v=t[26];let y=gC(v),b;return t[27]!==u.query||t[28]!==u.setCursorPosition||t[29]!==c||t[30]!==y.handleKeyDown||t[31]!==y.highlightIndex||t[32]!==y.highlightedIndex||t[33]!==y.highlightedItemId||t[34]!==p.activeCategoryId||t[35]!==p.categories||t[36]!==p.goBack||t[37]!==p.isSearchMode||t[38]!==p.items||t[39]!==p.selectCategory||t[40]!==d||t[41]!==s||t[42]!==_.close||t[43]!==_.registerSelectItemOverride||t[44]!==_.selectItem?(b={open:d,query:u.query,activeCategoryId:p.activeCategoryId,categories:p.categories,items:p.items,highlightedIndex:y.highlightedIndex,isSearchMode:p.isSearchMode,isLoading:c,popoverId:s,highlightedItemId:y.highlightedItemId,selectCategory:p.selectCategory,goBack:p.goBack,selectItem:_.selectItem,close:_.close,highlightIndex:y.highlightIndex,handleKeyDown:y.handleKeyDown,setCursorPosition:u.setCursorPosition,registerSelectItemOverride:_.registerSelectItemOverride},t[27]=u.query,t[28]=u.setCursorPosition,t[29]=c,t[30]=y.handleKeyDown,t[31]=y.highlightIndex,t[32]=y.highlightedIndex,t[33]=y.highlightedItemId,t[34]=p.activeCategoryId,t[35]=p.categories,t[36]=p.goBack,t[37]=p.isSearchMode,t[38]=p.items,t[39]=p.selectCategory,t[40]=d,t[41]=s,t[42]=_.close,t[43]=_.registerSelectItemOverride,t[44]=_.selectItem,t[45]=b):b=t[45],b}),cP=JS(null),lP=()=>{let e=XS(cP);if(!e)throw Error(`useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover`);return e},Bce=()=>XS(cP),uP=JS(null),dP=()=>{let e=XS(uP);if(!e)throw Error(`TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover`);return e},fP=(0,FS.forwardRef)((e,t)=>{let n=V(61),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({char:a,adapter:r,isLoading:c,"aria-label":i,children:o,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l=c===void 0?!1:c,u=ZC(),d=H(Vce),f=(0,FS.useId)(),p=BS(null),[m,h]=RS(null),g=BS(0),_;n[7]===a?_=n[8]:(_=e=>(g.current+=1,p.current=e,h(e),()=>{g.current=Math.max(0,g.current-1),p.current===e&&(p.current=null,h(null))}),n[7]=a,n[8]=_);let v=_,y;n[9]===v?y=n[10]:(y={register:v},n[9]=v,n[10]=y);let b=y,x=m??void 0,S;n[11]!==r||n[12]!==u||n[13]!==a||n[14]!==l||n[15]!==f||n[16]!==x||n[17]!==d?(S=zce({adapter:r,text:d,triggerChar:a,behavior:x,aui:u,popoverId:f,isLoading:l}),n[11]=r,n[12]=u,n[13]=a,n[14]=l,n[15]=f,n[16]=x,n[17]=d,n[18]=S):S=n[18];let C=gC(S),w;n[19]===C?w=n[20]:(w=()=>C,n[19]=C,n[20]=w);let T=GS(w),E=QN(),D;n[21]!==m||n[22]!==a||n[23]!==T||n[24]!==E?(D=()=>E.register({char:a,...m?{behavior:m}:{},resource:T()}),n[21]=m,n[22]=a,n[23]=T,n[24]=E,n[25]=D):D=n[25];let O;n[26]!==m||n[27]!==a||n[28]!==E?(O=[E,a,m],n[26]=m,n[27]=a,n[28]=E,n[29]=O):O=n[29],US(D,O);let k=YN(),A;n[30]!==T||n[31]!==k?(A=()=>{if(k)return k.register(T())},n[30]=T,n[31]=k,n[32]=A):A=n[32];let ee;n[33]===k?ee=n[34]:(ee=[k],n[33]=k,n[34]=ee),US(A,ee);let j=m!==null&&C.open,M=Dce(),te,N;n[35]!==M||n[36]!==a||n[37]!==j?(te=()=>{if(j)return()=>{M.setActiveAria(a,null)}},N=[M,a,j],n[35]=M,n[36]=a,n[37]=j,n[38]=te,n[39]=N):(te=n[38],N=n[39]),US(te,N);let P,ne;n[40]!==M||n[41]!==a||n[42]!==j||n[43]!==f||n[44]!==C.highlightedItemId?(P=()=>{j&&M.setActiveAria(a,{popoverId:f,highlightedItemId:C.highlightedItemId})},ne=[M,a,f,j,C.highlightedItemId],n[40]=M,n[41]=a,n[42]=j,n[43]=f,n[44]=C.highlightedItemId,n[45]=P,n[46]=ne):(P=n[45],ne=n[46]),US(P,ne);let re;n[47]!==i||n[48]!==o||n[49]!==t||n[50]!==j||n[51]!==f||n[52]!==s||n[53]!==C.highlightedItemId?(re=j?(0,B.jsx)(gO.div,{role:`listbox`,id:f,"aria-label":i??`Suggestions`,"aria-activedescendant":C.highlightedItemId,"data-state":`open`,...s,ref:t,children:o}):o,n[47]=i,n[48]=o,n[49]=t,n[50]=j,n[51]=f,n[52]=s,n[53]=C.highlightedItemId,n[54]=re):re=n[54];let ie;n[55]!==C||n[56]!==re?(ie=(0,B.jsx)(cP.Provider,{value:C,children:re}),n[55]=C,n[56]=re,n[57]=ie):ie=n[57];let ae;return n[58]!==b||n[59]!==ie?(ae=(0,B.jsx)(uP.Provider,{value:b,children:ie}),n[58]=b,n[59]=ie,n[60]=ae):ae=n[60],ae});fP.displayName=`ComposerPrimitive.TriggerPopover`;function Vce(e){return e.composer.text}var pP=()=>{let e=V(2),{disabled:t,send:n}=MD(),r;return e[0]===n?r=e[1]:(r=()=>n(),e[0]=n,e[1]=r),t?null:r},Hce=bO(`ComposerPrimitive.Send`,pP),mP=(0,FS.forwardRef)((e,t)=>{let n=V(12),r,i;n[0]===e?(r=n[1],i=n[2]):({onSubmit:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=pP(),o;n[3]===a?o=n[4]:(o=e=>{e.preventDefault(),a&&a()},n[3]=a,n[4]=o);let s=o,c;n[5]!==s||n[6]!==r?(c=R(r,s),n[5]=s,n[6]=r,n[7]=c):c=n[7];let l;return n[8]!==t||n[9]!==i||n[10]!==c?(l=(0,B.jsx)(gO.form,{...i,ref:t,onSubmit:c}),n[8]=t,n[9]=i,n[10]=c,n[11]=l):l=n[11],l});mP.displayName=`ComposerPrimitive.Root`;var hP=e=>{let t=V(4),n=Rm(e),r=rO(Uce),i,a;t[0]!==n||t[1]!==r?(i=()=>r(n),a=[r,n],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),US(i,a)};function Uce(e){return e.onScrollToBottom}var Wce=()=>!1,Gce=()=>{},Kce=e=>{let t=V(4),n;t[0]===e?n=t[1]:(n=t=>{if(typeof window>`u`||e===null)return Gce;let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},t[0]=e,t[1]=n);let r=n,i;return t[2]===e?i=t[3]:(i=()=>typeof window>`u`||e===null?!1:window.matchMedia(e).matches,t[2]=e,t[3]=i),KS(r,i,Wce)};function gP(){return gP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gP.apply(null,arguments)}function qce(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Jce=z.useLayoutEffect,Yce=function(e){var t=z.useRef(e);return Jce(function(){t.current=e}),t},_P=function(e,t){if(typeof e==`function`){e(t);return}e.current=t},Xce=function(e,t){var n=z.useRef();return z.useCallback(function(r){e.current=r,n.current&&_P(n.current,null),n.current=t,t&&_P(t,r)},[t])},vP={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`},yP=function(e){Object.keys(vP).forEach(function(t){e.style.setProperty(t,vP[t],`important`)})},bP=null,xP=function(e,t){var n=e.scrollHeight;return t.sizingStyle.boxSizing===`border-box`?n+t.borderSize:n-t.paddingSize};function Zce(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),bP||(bP=document.createElement(`textarea`),bP.setAttribute(`tabindex`,`-1`),bP.setAttribute(`aria-hidden`,`true`),yP(bP)),bP.parentNode===null&&document.body.appendChild(bP);var i=e.paddingSize,a=e.borderSize,o=e.sizingStyle,s=o.boxSizing;Object.keys(o).forEach(function(e){var t=e;bP.style[t]=o[t]}),yP(bP),bP.value=t;var c=xP(bP,e);bP.value=t,c=xP(bP,e),bP.value=`x`;var l=bP.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);var d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}var SP=function(){},Qce=function(e,t){return e.reduce(function(e,n){return e[n]=t[n],e},{})},$ce=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],ele=!!document.documentElement.currentStyle,tle=function(e){var t=window.getComputedStyle(e);if(t===null)return null;var n=Qce($ce,t),r=n.boxSizing;return r===``?null:(ele&&r===`border-box`&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+`px`),{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)})};function CP(e,t,n){var r=Yce(n);z.useLayoutEffect(function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var nle=function(e,t){CP(document.body,`reset`,function(n){e.current.form===n.target&&t(n)})},rle=function(e){CP(window,`resize`,e)},ile=function(e){CP(document.fonts,`loadingdone`,e)},ale=[`cacheMeasurements`,`maxRows`,`minRows`,`onChange`,`onHeightChange`],ole=z.forwardRef(function(e,t){var n=e.cacheMeasurements,r=e.maxRows,i=e.minRows,a=e.onChange,o=a===void 0?SP:a,s=e.onHeightChange,c=s===void 0?SP:s,l=qce(e,ale),u=l.value!==void 0,d=z.useRef(null),f=Xce(d,t),p=z.useRef(0),m=z.useRef(),h=function(){var e=d.current,t=n&&m.current?m.current:tle(e);if(t){m.current=t;var a=Zce(t,e.value||e.placeholder||`x`,i,r),o=a[0],s=a[1];p.current!==o&&(p.current=o,e.style.setProperty(`height`,o+`px`,`important`),c(o,{rowHeight:s}))}};return z.useLayoutEffect(h),nle(d,function(){if(!u){var e=d.current.value;requestAnimationFrame(function(){var t=d.current;t&&e!==t.value&&h()})}}),rle(h),ile(h),z.createElement(`textarea`,gP({},l,{onChange:function(e){u||h(),o(e)},ref:f}))}),sle=`(pointer: coarse) and (not (any-pointer: fine))`,wP=(0,FS.forwardRef)(({autoFocus:e=!1,asChild:t,render:n,disabled:r,onChange:i,onKeyDown:a,onPaste:o,onSelect:s,submitOnEnter:c,submitMode:l,cancelOnEscape:u=!0,unstable_focusOnRunStart:d=!0,unstable_focusOnScrollToBottom:f=!0,unstable_focusOnThreadSwitched:p=!0,unstable_insertNewlineOnTouchEnter:m=!1,addAttachmentOnPaste:h=!0,...g},_)=>{let v=ZC(),y=YN(),b=jce(),x=l??(c===!1?`none`:`enter`),S=Kce(m?sle:null),C=m&&S&&x===`enter`?`none`:x,w=H(e=>e.composer.isEditing?e.composer.text:``),T=H(e=>e.thread.isDisabled||e.composer.dictation?.inputDisabled)||r,E=BS(null),D=tt(_,E),O=BS(!1);kc(e=>{if(!E.current?.contains(e.target))return;if(y){for(let t of y.getPlugins())if(t.handleKeyDown(e))return}if(!u)return;let t=v.composer();t.getState().canCancel&&(t.cancel(),e.preventDefault())});let k=e=>{if(!T&&!e.nativeEvent.isComposing){if(y){for(let t of y.getPlugins())if(t.handleKeyDown(e))return}if(e.key===`Enter`){let t=v.thread().getState(),n=t.capabilities.queue;if(e.shiftKey&&(e.ctrlKey||e.metaKey)&&n&&x!==`none`&&v.composer().getState().canSend){e.preventDefault(),v.composer().send({steer:!0});return}if(e.shiftKey||t.isRunning&&!n)return;let r=!1;C===`ctrlEnter`?r=e.ctrlKey||e.metaKey:C===`enter`&&(r=!0),r&&(e.preventDefault(),E.current?.closest(`form`)?.requestSubmit())}}},A=async e=>{if(!h)return;let t=v.thread().getState().capabilities,n=Array.from(e.clipboardData?.files||[]);if(t.attachments&&n.length>0)try{e.preventDefault(),await Promise.all(n.map(e=>v.composer().addAttachment(e)))}catch(e){console.error(`Error adding attachment:`,e)}},ee=e&&!T,j=HS(()=>{let e=E.current;!e||!ee||(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[ee]);US(()=>j(),[j]),hP(()=>{v.composer().getState().type===`thread`&&f&&j()}),US(()=>{if(!(v.composer().getState().type!==`thread`||!d))return v.on(`thread.runStart`,j)},[d,j,v]),US(()=>{if(!(v.composer().getState().type!==`thread`||!p))return v.on(`threadListItem.switchedTo`,j)},[p,j,v]);let M=b?{"aria-controls":b.popoverId,"aria-expanded":!0,"aria-haspopup":`listbox`,"aria-activedescendant":b.highlightedItemId}:{},te={name:`input`,value:w,...g,...M,ref:D,disabled:T,onChange:R(i,e=>{if(!v.composer().getState().isEditing)return;let t=e.nativeEvent.isComposing===!0;O.current&&!t&&(O.current=!1);let n=t||O.current;if(iC(()=>{v.composer().setText(e.target.value)}),n)return;let r=e.target.selectionStart??e.target.value.length;if(y)for(let e of y.getPlugins())e.setCursorPosition(r)}),onKeyDown:R(a,k),onCompositionStart:R(g.onCompositionStart,()=>{O.current=!0}),onCompositionEnd:R(g.onCompositionEnd,e=>{if(O.current=!1,!v.composer().getState().isEditing)return;let t=e.target;iC(()=>{v.composer().setText(t.value)});let n=t.selectionStart??t.value.length;if(y)for(let e of y.getPlugins())e.setCursorPosition(n)}),onSelect:R(s,e=>{if(O.current)return;let t=e.target,n=t.selectionStart??t.value.length;if(y)for(let e of y.getPlugins())e.setCursorPosition(n)}),onPaste:R(o,A)};if(n&&(0,FS.isValidElement)(n)){let e=g.children===void 0?n.props.children:g.children;return(0,B.jsx)(Wa,{...te,children:(0,FS.cloneElement)(n,void 0,e)})}return(0,B.jsx)(t?Wa:ole,{...te})});wP.displayName=`ComposerPrimitive.Input`;var cle=bO(`ComposerPrimitive.Cancel`,()=>{let{disabled:e,cancel:t}=PD();return e?null:t}),lle=bO(`ComposerPrimitive.AddAttachment`,e=>{let t=V(6),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{multiple:r}=n,i=r===void 0?!0:r,{disabled:a,addAttachment:o}=RD(),s=ZC(),c;return t[2]!==o||t[3]!==s||t[4]!==i?(c=()=>{let e=document.createElement(`input`);e.type=`file`,e.multiple=i,e.hidden=!0;let t=s.composer().getState().attachmentAccept;t!==`*`&&(e.accept=t),document.body.appendChild(e),e.onchange=t=>{let n=t.target.files;if(n){for(let e of n)o(e);document.body.removeChild(e)}},e.oncancel=()=>{(!e.files||e.files.length===0)&&document.body.removeChild(e)},e.click()},t[2]=o,t[3]=s,t[4]=i,t[5]=c):c=t[5],a?null:c},[`multiple`]),TP=(0,FS.forwardRef)((e,t)=>{let n=V(30),{disabled:r,asChild:i,render:a,children:o,...s}=e,c=i===void 0?!1:i,[l,u]=RS(!1),d=ZC(),f;n[0]===r?f=n[1]:(f=e=>{r||(e.preventDefault(),u(!0))},n[0]=r,n[1]=f);let p=f,m;n[2]!==r||n[3]!==l?(m=e=>{r||(e.preventDefault(),l||u(!0))},n[2]=r,n[3]=l,n[4]=m):m=n[4];let h=m,g;n[5]===r?g=n[6]:(g=e=>{if(r)return;e.preventDefault();let t=e.relatedTarget;t&&e.currentTarget.contains(t)||u(!1)},n[5]=r,n[6]=g);let _=g,v;n[7]!==d||n[8]!==r?(v=async e=>{if(r)return;e.preventDefault(),u(!1);let t=Array.from(e.dataTransfer.files);await Promise.all(t.map(async e=>{try{await d.composer().addAttachment(e)}catch(e){console.error(`Failed to add attachment:`,e)}}))},n[7]=d,n[8]=r,n[9]=v):v=n[9];let y=v,b;n[10]===l?b=n[11]:(b=l?{"data-dragging":`true`}:null,n[10]=l,n[11]=b);let x=R(s.onDragEnterCapture,p),S=R(s.onDragOverCapture,h),C=R(s.onDragLeaveCapture,_),w=R(s.onDropCapture,y),T;n[12]!==t||n[13]!==s||n[14]!==w||n[15]!==b||n[16]!==x||n[17]!==S||n[18]!==C?(T={...b,...s,onDragEnterCapture:x,onDragOverCapture:S,onDragLeaveCapture:C,onDropCapture:w,ref:t},n[12]=t,n[13]=s,n[14]=w,n[15]=b,n[16]=x,n[17]=S,n[18]=C,n[19]=T):T=n[19];let E=T;if(a&&(0,FS.isValidElement)(a)){let e=o===void 0?a.props.children:o,t;n[20]!==a||n[21]!==e?(t=(0,FS.cloneElement)(a,void 0,e),n[20]=a,n[21]=e,n[22]=t):t=n[22];let r;return n[23]!==E||n[24]!==t?(r=(0,B.jsx)(Wa,{...E,children:t}),n[23]=E,n[24]=t,n[25]=r):r=n[25],r}let D=c?Wa:`div`,O;return n[26]!==D||n[27]!==o||n[28]!==E?(O=(0,B.jsx)(D,{...E,children:o}),n[26]=D,n[27]=o,n[28]=E,n[29]=O):O=n[29],O});TP.displayName=`ComposerPrimitive.AttachmentDropzone`;var ule=bO(`ComposerPrimitive.Dictate`,()=>{let{disabled:e,startDictation:t}=ID();return e?null:t}),dle=bO(`ComposerPrimitive.StopDictation`,()=>{let e=V(2),t=ZC(),n=H(fle),r;return e[0]===t?r=e[1]:(r=()=>{t.composer().stopDictation()},e[0]=t,e[1]=r),n?r:null});function fle(e){return e.composer.dictation!=null}var EP=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({children:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=H(ple);if(!a)return null;let o=r??a,s;return n[3]!==t||n[4]!==i||n[5]!==o?(s=(0,B.jsx)(gO.span,{...i,ref:t,children:o}),n[3]=t,n[4]=i,n[5]=o,n[6]=s):s=n[6],s});EP.displayName=`ComposerPrimitive.DictationTranscript`;function ple(e){return e.composer.dictation?.transcript}var DP=(0,FS.forwardRef)((e,t)=>{let n=V(3);if(!H(mle))return null;let r;return n[0]!==t||n[1]!==e?(r=(0,B.jsx)(gO.div,{...e,ref:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],r});DP.displayName=`ComposerPrimitive.Quote`;var OP=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({children:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=H(hle);if(!a)return null;let o=r??a,s;return n[3]!==t||n[4]!==i||n[5]!==o?(s=(0,B.jsx)(gO.span,{...i,ref:t,children:o}),n[3]=t,n[4]=i,n[5]=o,n[6]=s):s=n[6],s});OP.displayName=`ComposerPrimitive.QuoteText`;var kP=(0,FS.forwardRef)((e,t)=>{let n=V(12),r,i;n[0]===e?(r=n[1],i=n[2]):({onClick:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=ZC(),o;n[3]===a?o=n[4]:(o=()=>{a.composer().setQuote(void 0)},n[3]=a,n[4]=o);let s=o,c;n[5]!==s||n[6]!==r?(c=R(r,s),n[5]=s,n[6]=r,n[7]=c):c=n[7];let l;return n[8]!==t||n[9]!==i||n[10]!==c?(l=(0,B.jsx)(gO.button,{type:`button`,...i,ref:t,onClick:c}),n[8]=t,n[9]=i,n[10]=c,n[11]=l):l=n[11],l});kP.displayName=`ComposerPrimitive.QuoteDismiss`;function mle(e){return e.composer.quote}function hle(e){return e.composer.quote?.text}var AP=(0,FS.forwardRef)((e,t)=>{let n=V(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({children:i,"aria-label":r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{categories:o,activeCategoryId:s,isSearchMode:c,open:l}=lP();if(!l||s||c)return null;let u=r??`Categories`,d;n[4]!==o||n[5]!==i?(d=i(o),n[4]=o,n[5]=i,n[6]=d):d=n[6];let f;return n[7]!==t||n[8]!==a||n[9]!==u||n[10]!==d?(f=(0,B.jsx)(gO.div,{role:`group`,"aria-label":u,...a,ref:t,children:d}),n[7]=t,n[8]=a,n[9]=u,n[10]=d,n[11]=f):f=n[11],f});AP.displayName=`ComposerPrimitive.TriggerPopoverCategories`;var jP=(0,FS.forwardRef)((e,t)=>{let n=V(30),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({categoryId:r,onClick:i,onMouseMove:a,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let{selectCategory:s,highlightIndex:c,categories:l,highlightedIndex:u,activeCategoryId:d,isSearchMode:f,popoverId:p}=lP(),m;n[5]!==r||n[6]!==s?(m=()=>{s(r)},n[5]=r,n[6]=s,n[7]=m):m=n[7];let h=m,g;if(n[8]!==l||n[9]!==r){let e;n[11]===r?e=n[12]:(e=e=>e.id===r,n[11]=r,n[12]=e),g=l.findIndex(e),n[8]=l,n[9]=r,n[10]=g}else g=n[10];let _=g,v=!d&&!f&&_===u,y;n[13]!==_||n[14]!==c?(y=()=>{c(_)},n[13]=_,n[14]=c,n[15]=y):y=n[15];let b=y,x=`${p}-option-${r}`,S=v?``:void 0,C;n[16]!==h||n[17]!==i?(C=R(i,h),n[16]=h,n[17]=i,n[18]=C):C=n[18];let w;n[19]!==b||n[20]!==a?(w=R(a,b),n[19]=b,n[20]=a,n[21]=w):w=n[21];let T;return n[22]!==t||n[23]!==v||n[24]!==o||n[25]!==x||n[26]!==S||n[27]!==C||n[28]!==w?(T=(0,B.jsx)(gO.button,{type:`button`,role:`option`,id:x,"aria-selected":v,"data-highlighted":S,...o,ref:t,onClick:C,onMouseMove:w}),n[22]=t,n[23]=v,n[24]=o,n[25]=x,n[26]=S,n[27]=C,n[28]=w,n[29]=T):T=n[29],T});jP.displayName=`ComposerPrimitive.TriggerPopoverCategoryItem`;var MP=(0,FS.forwardRef)((e,t)=>{let n=V(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({children:i,"aria-label":r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{items:o,activeCategoryId:s,isSearchMode:c,open:l}=lP();if(!l||!s&&!c)return null;let u=r??`Items`,d;n[4]!==i||n[5]!==o?(d=i(o),n[4]=i,n[5]=o,n[6]=d):d=n[6];let f;return n[7]!==t||n[8]!==a||n[9]!==u||n[10]!==d?(f=(0,B.jsx)(gO.div,{role:`group`,"aria-label":u,...a,ref:t,children:d}),n[7]=t,n[8]=a,n[9]=u,n[10]=d,n[11]=f):f=n[11],f});MP.displayName=`ComposerPrimitive.TriggerPopoverItems`;var NP=(0,FS.forwardRef)((e,t)=>{let n=V(30),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({item:i,index:r,onClick:a,onMouseMove:o,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let{selectItem:c,highlightIndex:l,items:u,highlightedIndex:d,activeCategoryId:f,isSearchMode:p,popoverId:m}=lP(),h;n[6]!==i||n[7]!==c?(h=()=>{c(i)},n[6]=i,n[7]=c,n[8]=h):h=n[8];let g=h,_;n[9]!==r||n[10]!==i.id||n[11]!==u?(_=r??u.findIndex(e=>e.id===i.id),n[9]=r,n[10]=i.id,n[11]=u,n[12]=_):_=n[12];let v=_,y=(p||f!==null)&&v===d,b;n[13]!==l||n[14]!==v?(b=()=>{l(v)},n[13]=l,n[14]=v,n[15]=b):b=n[15];let x=b,S=`${m}-option-${i.id}`,C=y?``:void 0,w;n[16]!==g||n[17]!==a?(w=R(a,g),n[16]=g,n[17]=a,n[18]=w):w=n[18];let T;n[19]!==x||n[20]!==o?(T=R(o,x),n[19]=x,n[20]=o,n[21]=T):T=n[21];let E;return n[22]!==t||n[23]!==y||n[24]!==s||n[25]!==S||n[26]!==C||n[27]!==w||n[28]!==T?(E=(0,B.jsx)(gO.button,{type:`button`,role:`option`,id:S,"aria-selected":y,"data-highlighted":C,...s,ref:t,onClick:w,onMouseMove:T}),n[22]=t,n[23]=y,n[24]=s,n[25]=S,n[26]=C,n[27]=w,n[28]=T,n[29]=E):E=n[29],E});NP.displayName=`ComposerPrimitive.TriggerPopoverItem`;var PP=(0,FS.forwardRef)((e,t)=>{let n=V(10),r,i;n[0]===e?(r=n[1],i=n[2]):({onClick:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{activeCategoryId:a,isSearchMode:o,goBack:s,open:c}=lP();if(!c||!a||o)return null;let l;n[3]!==s||n[4]!==r?(l=R(r,s),n[3]=s,n[4]=r,n[5]=l):l=n[5];let u;return n[6]!==t||n[7]!==i||n[8]!==l?(u=(0,B.jsx)(gO.button,{type:`button`,...i,ref:t,onClick:l}),n[6]=t,n[7]=i,n[8]=l,n[9]=u):u=n[9],u});PP.displayName=`ComposerPrimitive.TriggerPopoverBack`;var FP=({formatter:e,onExecute:t,removeOnExecute:n})=>{let{register:r}=dP(),i=BS(t);return i.current=t,US(()=>r({kind:`action`,formatter:e??eO,onExecute:e=>i.current(e),...n===void 0?{}:{removeOnExecute:n}}),[r,e,n]),null};FP.displayName=`ComposerPrimitive.TriggerPopoverAction`;var IP=({formatter:e,onInserted:t})=>{let{register:n}=dP(),r=BS(t);return r.current=t,US(()=>n({kind:`directive`,formatter:e??eO,onInserted:e=>r.current?.(e)}),[n,e]),null};IP.displayName=`ComposerPrimitive.TriggerPopoverDirective`;var gle=Object.assign(fP,{Directive:IP,Action:FP}),LP=mO({AddAttachment:()=>lle,AttachmentByIndex:()=>vD,AttachmentDropzone:()=>TP,Attachments:()=>bD,Cancel:()=>cle,Dictate:()=>ule,DictationTranscript:()=>EP,If:()=>jD,Input:()=>wP,Queue:()=>SD,Quote:()=>DP,QuoteDismiss:()=>kP,QuoteText:()=>OP,Root:()=>mP,Send:()=>Hce,StopDictation:()=>dle,Unstable_TriggerPopover:()=>gle,Unstable_TriggerPopoverBack:()=>PP,Unstable_TriggerPopoverCategories:()=>AP,Unstable_TriggerPopoverCategoryItem:()=>jP,Unstable_TriggerPopoverItem:()=>NP,Unstable_TriggerPopoverItems:()=>MP,Unstable_TriggerPopoverRoot:()=>aP,unstable_useTriggerPopoverRootContext:()=>QN,unstable_useTriggerPopoverRootContextOptional:()=>$N,unstable_useTriggerPopoverScopeContext:()=>lP,unstable_useTriggerPopoverScopeContextOptional:()=>Bce,unstable_useTriggerPopoverTriggers:()=>Oce,unstable_useTriggerPopoverTriggersOptional:()=>Ace}),RP=()=>H(_le);function _le(e){if(e.part.type!==`text`&&e.part.type!==`reasoning`)throw Error(`MessagePartText can only be used inside text or reasoning message parts.`);return e.part}var vle=JS(null);function yle(e){let t=XS(vle);if(!e?.optional&&!t)throw Error(`This component must be used within a SmoothContextProvider.`);return t}var{useSmoothStatus:ble,useSmoothStatusStore:xle}=tO(yle,`useSmoothStatus`),zP=250,BP=5,Sle=class{currentText;setText;animationFrameId=null;lastUpdateTime=Date.now();lastCommitTime=0;targetText=``;drainMs=zP;maxCharIntervalMs=BP;maxCharsPerFrame=1/0;minCommitMs=0;constructor(e,t){this.currentText=e,this.setText=t}start(){this.animationFrameId===null&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,n=this.targetText.length-this.currentText.length,r=Math.min(this.maxCharIntervalMs,this.drainMs/n),i=Math.min(n,this.maxCharsPerFrame),a=0;for(;t>=r&&a<i;)a++,t-=r;a===i&&i===this.maxCharsPerFrame&&(t=0),a===n?this.animationFrameId=null:this.animationFrameId=requestAnimationFrame(this.animate),a!==0&&(this.currentText=this.targetText.slice(0,this.currentText.length+a),this.lastUpdateTime=e-t,(a===n||e-this.lastCommitTime>=this.minCommitMs)&&(this.lastCommitTime=e,this.setText(this.currentText)))}},VP=Object.freeze({type:`running`}),HP=(e,t)=>e!==void 0&&e>0?e:t,UP=(e,t=!1)=>{let{text:n}=e,r=typeof t==`object`&&t?t:void 0,i=t!==!1&&t!==null,a=HP(r?.drainMs,zP),o=HP(r?.maxCharIntervalMs,BP),s=HP(r?.maxCharsPerFrame,1/0),c=HP(r?.minCommitMs,0),[l,u]=RS(e.status.type===`running`?``:n),d=ZC(),f=H(()=>d.part()),[p,m]=RS(f);(f!==p||!n.startsWith(l))&&(m(f),u(e.status.type===`running`?``:n));let h=xle({optional:!0}),g=Rm(t=>{if(u(t),h){let n=l!==t||e.status.type===`running`?VP:e.status;oO(h).setState(n,!0)}});US(()=>{if(h){let t=i&&(l!==n||e.status.type===`running`)?VP:e.status;oO(h).setState(t,!0)}},[h,i,n,l,e.status]);let[_]=RS(new Sle(l,g));US(()=>{_.drainMs=a,_.maxCharIntervalMs=o,_.maxCharsPerFrame=s,_.minCommitMs=c},[_,a,o,s,c]);let v=BS(f);return US(()=>{if(!i){_.stop();return}let t=v.current!==f;if(v.current=f,t||!n.startsWith(_.targetText)){e.status.type===`running`?(_.currentText=``,_.targetText=n,_.lastCommitTime=0,_.start()):(_.currentText=n,_.targetText=n,_.stop());return}_.targetText=n,_.start()},[_,i,n,e.status.type,f]),US(()=>()=>{_.stop()},[_]),VS(()=>i?{...e,text:l,status:n===l?e.status:VP}:e,[i,l,e,n])},Cle=()=>H(wle);function wle(e){if(e.part.type!==`image`)throw Error(`MessagePartImage can only be used inside image message parts.`);return e.part}var WP=(0,FS.forwardRef)((e,t)=>{let n=V(10),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({smooth:i,component:a,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=i===void 0?!0:i,s=a===void 0?`span`:a,{text:c,status:l}=UP(RP(),o),u;return n[4]!==s||n[5]!==t||n[6]!==r||n[7]!==l.type||n[8]!==c?(u=(0,B.jsx)(s,{"data-status":l.type,...r,ref:t,children:c}),n[4]=s,n[5]=t,n[6]=r,n[7]=l.type,n[8]=c,n[9]=u):u=n[9],u});WP.displayName=`MessagePartPrimitive.Text`;var GP=(0,FS.forwardRef)((e,t)=>{let n=V(4),{image:r}=Cle(),i;return n[0]!==t||n[1]!==r||n[2]!==e?(i=(0,B.jsx)(gO.img,{src:r,...e,ref:t}),n[0]=t,n[1]=r,n[2]=e,n[3]=i):i=n[3],i});GP.displayName=`MessagePartPrimitive.Image`;var KP=e=>{let t=V(2),n=BS(void 0),r;return t[0]===e?r=t[1]:(r=t=>{n.current&&=(n.current(),void 0),t&&(n.current=e(t))},t[0]=e,t[1]=r),r},qP=(e,t)=>{let n=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!n)return 1/0;let r=Number(n[1]),i=n[2];return i===`px`?r:i===`em`?r*(parseFloat(getComputedStyle(t).fontSize)||16):i===`rem`?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):1/0},Tle=e=>e.dataset.messageId,Ele=()=>{let e=document.createElement(`div`);return e.dataset.auiTopAnchorReserve=``,e.style.height=`0px`,e.style.flexShrink=`0`,e.style.pointerEvents=`none`,e.setAttribute(`aria-hidden`,`true`),e},JP=(e,t)=>{let n=`${t}px`;return e.style.height===n?!1:(e.style.height=n,!0)},Dle=e=>{let t=window.devicePixelRatio||1;return Math.round(e*t)/t},YP=()=>{let e=V(4),t=ZC(),n;e[0]===t?n=e[1]:(n=()=>t.message(),e[0]=t,e[1]=n);let r=H(n),i;return e[2]===r?i=e[3]:(i=e=>{let t=()=>{r.setIsHovering(!0)},n=()=>{r.setIsHovering(!1)};return e.addEventListener(`mouseenter`,t),e.addEventListener(`mouseleave`,n),e.matches(`:hover`)&&queueMicrotask(()=>r.setIsHovering(!0)),()=>{e.removeEventListener(`mouseenter`,t),e.removeEventListener(`mouseleave`,n),r.setIsHovering(!1)}},e[2]=r,e[3]=i),KP(i)},Ole=()=>{let e=V(2),t=rO(Ple),n;return e[0]===t?n=e[1]:(n=e=>e.message.role===`user`&&e.message.index>0&&e.message.index===e.thread.messages.length-2&&e.thread.messages.at(-1)?.role===`assistant`&&(e.message.id===t||e.thread.isRunning),e[0]=t,e[1]=n),H(n)},kle=()=>{let e=V(2),t=rO(Fle),n;return e[0]===t?n=e[1]:(n=e=>e.message.isLast&&e.message.role===`assistant`&&e.message.index>=1&&e.thread.messages.at(e.message.index-1)?.role===`user`&&(e.message.id===t||e.thread.isRunning),e[0]=t,e[1]=n),H(n)},Ale=(e,t)=>{let n=V(3),r;return n[0]!==e||n[1]!==t?(r=n=>{if(e)return t.getState().registerAnchorElement(n)},n[0]=e,n[1]=t,n[2]=r):r=n[2],KP(r)},jle=e=>{let t=V(3),{active:n,threadViewportStore:r}=e,i;return t[0]!==n||t[1]!==r?(i=e=>{if(!n)return;let t=r.getState(),i=t.topAnchorMessageClamp;return t.registerAnchorTargetElement(e,{tallerThan:qP(i.tallerThan,e),visibleHeight:qP(i.visibleHeight,e)})},t[0]=n,t[1]=r,t[2]=i):i=t[2],KP(i)},Mle=e=>{let t=V(7),n,r;t[0]===e?(n=t[1],r=t[2]):({forwardedRef:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=YP(),a=tt(n,i),o=H(Ile),s;return t[3]!==o||t[4]!==r||t[5]!==a?(s=(0,B.jsx)(gO.div,{...r,ref:a,"data-message-id":o}),t[3]=o,t[4]=r,t[5]=a,t[6]=s):s=t[6],s},Nle=e=>{let t=V(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({forwardedRef:n,threadViewportStore:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=YP(),o=Ole(),s=kle(),c=Ale(o,i),l;t[4]!==s||t[5]!==i?(l={active:s,threadViewportStore:i},t[4]=s,t[5]=i,t[6]=l):l=t[6];let u=jle(l),d=tt(n,a,c,u),f=H(Lle),p=o?``:void 0,m=s?``:void 0,h;return t[7]!==f||t[8]!==r||t[9]!==d||t[10]!==p||t[11]!==m?(h=(0,B.jsx)(gO.div,{...r,ref:d,"data-message-id":f,"data-aui-top-anchor-user":p,"data-aui-top-anchor-target":m}),t[7]=f,t[8]=r,t[9]=d,t[10]=p,t[11]=m,t[12]=h):h=t[12],h},XP=(0,FS.forwardRef)((e,t)=>{let n=V(7),r=iO();if(r.getState().turnAnchor===`top`){let i;return n[0]!==t||n[1]!==e||n[2]!==r?(i=(0,B.jsx)(Nle,{...e,forwardedRef:t,threadViewportStore:r}),n[0]=t,n[1]=e,n[2]=r,n[3]=i):i=n[3],i}let i;return n[4]!==t||n[5]!==e?(i=(0,B.jsx)(Mle,{...e,forwardedRef:t}),n[4]=t,n[5]=e,n[6]=i):i=n[6],i});XP.displayName=`MessagePrimitive.Root`;function Ple(e){return e.topAnchorTurn?.anchorId}function Fle(e){return e.topAnchorTurn?.targetId}function Ile(e){return e.message.id}function Lle(e){return e.message.id}var ZP={...SE,Text:()=>(0,B.jsxs)(`p`,{style:{whiteSpace:`pre-line`},children:[(0,B.jsx)(WP,{}),(0,B.jsx)(CD,{children:(0,B.jsx)(`span`,{style:{fontFamily:`revert`},children:` ●`})})]}),Image:()=>(0,B.jsx)(GP,{})},QP=e=>{let t=V(10);if(`children`in e){let n;return t[0]===e.children?n=t[1]:(n=(0,B.jsx)(RE,{children:e.children}),t[0]=e.children,t[1]=n),n}let n,r;t[2]===e?(n=t[3],r=t[4]):({components:n,...r}=e,t[2]=e,t[3]=n,t[4]=r);let i;t[5]===n?i=t[6]:(i=n?{Text:n.Text??ZP.Text,Image:n.Image??ZP.Image,Reasoning:n.Reasoning??SE.Reasoning,Source:n.Source??SE.Source,File:n.File??SE.File,Unstable_Audio:n.Unstable_Audio??SE.Unstable_Audio,...`ChainOfThought`in n?{ChainOfThought:n.ChainOfThought}:{tools:n.tools,data:n.data,ToolGroup:n.ToolGroup??SE.ToolGroup,ReasoningGroup:n.ReasoningGroup??SE.ReasoningGroup},Empty:n.Empty,Quote:n.Quote,generativeUI:n.generativeUI}:ZP,t[5]=n,t[6]=i);let a=i,o;return t[7]!==r||t[8]!==a?(o=(0,B.jsx)(RE,{components:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o};QP.displayName=`MessagePrimitive.Parts`;var $P=e=>{let{children:t}=e;return moe()===void 0?null:t};$P.displayName=`MessagePrimitive.Error`;var Rle=e=>{let t=new Map;for(let n=0;n<e.length;n++){let r=e[n]?.parentId??`__ungrouped_${n}`,i=t.get(r)??[];i.push(n),t.set(r,i)}let n=[];for(let[e,r]of t){let t=e.startsWith(`__ungrouped_`)?void 0:e;n.push({groupKey:t,indices:r})}return n},zle=e=>{let t=V(4),n=H(qle),r;bb0:{if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],r=e;break bb0}let i;t[1]!==e||t[2]!==n?(i=e(n),t[1]=e,t[2]=n,t[3]=i):i=t[3],r=i}return r},Ble=e=>{let t=V(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.toolName?(i=e=>{let t=e.tools.tools[r.toolName]??n;return Array.isArray(t)?t[0]??n:t},t[3]=n,t[4]=r.toolName,t[5]=i):i=t[5];let a=H(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,B.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},Vle=e=>{let t=V(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.name?(i=e=>{let t=e.dataRenderers.renderers[r.name]??n;return Array.isArray(t)?t[0]??n:t},t[3]=n,t[4]=r.name,t[5]=i):i=t[5];let a=H(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,B.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},eF={Text:()=>(0,B.jsxs)(`p`,{style:{whiteSpace:`pre-line`},children:[(0,B.jsx)(WP,{}),(0,B.jsx)(CD,{children:(0,B.jsx)(`span`,{style:{fontFamily:`revert`},children:` ●`})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>(0,B.jsx)(GP,{}),File:()=>null,Unstable_Audio:()=>null,Group:({children:e})=>e},Hle=e=>{let t=V(43),{components:n}=e,r;t[0]===n?r=t[1]:(r=n===void 0?{}:n,t[0]=n,t[1]=r);let{Text:i,Reasoning:a,Image:o,Source:s,File:c,Unstable_Audio:l,tools:u,data:d}=r,f=i===void 0?eF.Text:i,p=a===void 0?eF.Reasoning:a,m=o===void 0?eF.Image:o,h=s===void 0?eF.Source:s,g=c===void 0?eF.File:c,_=l===void 0?eF.Unstable_Audio:l,v;t[2]===u?v=t[3]:(v=u===void 0?{}:u,t[2]=u,t[3]=v);let y=v,b=ZC(),x=H(Jle),S=x.type;if(S===`tool-call`){let e;t[4]===b?e=t[5]:(e=b.part(),t[4]=b,t[5]=e);let n=e.addToolResult,r;t[6]===b?r=t[7]:(r=b.part(),t[6]=b,t[7]=r);let i=r.resumeToolCall,a;t[8]===b?a=t[9]:(a=b.part(),t[8]=b,t[9]=a);let o=a.respondToToolApproval;if(`Override`in y){let e;return t[10]!==n||t[11]!==x||t[12]!==o||t[13]!==i||t[14]!==y.Override?(e=(0,B.jsx)(y.Override,{...x,addResult:n,resume:i,respondToApproval:o}),t[10]=n,t[11]=x,t[12]=o,t[13]=i,t[14]=y.Override,t[15]=e):e=t[15],e}let s=y.by_name?.[x.toolName]??y.Fallback,c;return t[16]!==s||t[17]!==n||t[18]!==x||t[19]!==o||t[20]!==i?(c=(0,B.jsx)(Ble,{...x,Fallback:s,addResult:n,resume:i,respondToApproval:o}),t[16]=s,t[17]=n,t[18]=x,t[19]=o,t[20]=i,t[21]=c):c=t[21],c}if(x.status?.type===`requires-action`)throw Error(`Encountered unexpected requires-action status`);switch(S){case`text`:{let e;return t[22]!==f||t[23]!==x?(e=(0,B.jsx)(f,{...x}),t[22]=f,t[23]=x,t[24]=e):e=t[24],e}case`reasoning`:{let e;return t[25]!==p||t[26]!==x?(e=(0,B.jsx)(p,{...x}),t[25]=p,t[26]=x,t[27]=e):e=t[27],e}case`source`:{let e;return t[28]!==h||t[29]!==x?(e=(0,B.jsx)(h,{...x}),t[28]=h,t[29]=x,t[30]=e):e=t[30],e}case`image`:{let e;return t[31]!==m||t[32]!==x?(e=(0,B.jsx)(m,{...x}),t[31]=m,t[32]=x,t[33]=e):e=t[33],e}case`file`:{let e;return t[34]!==g||t[35]!==x?(e=(0,B.jsx)(g,{...x}),t[34]=g,t[35]=x,t[36]=e):e=t[36],e}case`audio`:{let e;return t[37]!==_||t[38]!==x?(e=(0,B.jsx)(_,{...x}),t[37]=_,t[38]=x,t[39]=e):e=t[39],e}case`data`:{let e=d?.by_name?.[x.name]??d?.Fallback,n;return t[40]!==e||t[41]!==x?(n=(0,B.jsx)(Vle,{...x,Fallback:e}),t[40]=e,t[41]=x,t[42]=n):n=t[42],n}default:return console.warn(`Unknown message part type: ${S}`),null}},Ule=(0,FS.memo)(e=>{let t=V(5),{partIndex:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,B.jsx)(Hle,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,B.jsx)(Pw,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),Wle=e=>{let t=V(6),{status:n,component:r}=e,i=n.type===`running`,a;t[0]!==r||t[1]!==n?(a=(0,B.jsx)(r,{type:`text`,text:``,status:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,B.jsx)(Iw,{text:``,isRunning:i,children:a}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o},Gle=Object.freeze({type:`complete`}),Kle=(0,FS.memo)(e=>{let t=V(6),{components:n}=e,r=H(Yle);if(n?.Empty){let e;return t[0]!==n.Empty||t[1]!==r?(e=(0,B.jsx)(n.Empty,{status:r}),t[0]=n.Empty,t[1]=r,t[2]=e):e=t[2],e}let i=n?.Text??eF.Text,a;return t[3]!==r||t[4]!==i?(a=(0,B.jsx)(Wle,{status:r,component:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),tF=e=>{let t=V(9),{groupingFunction:n,components:r}=e,i=H(Xle),a=zle(n),o;bb0:{if(i===0){let e;t[0]===r?e=t[1]:(e=(0,B.jsx)(Kle,{components:r}),t[0]=r,t[1]=e),o=e;break bb0}let e;if(t[2]!==r||t[3]!==a){let n;t[5]===r?n=t[6]:(n=(e,t)=>(0,B.jsx)(r?.Group??eF.Group,{groupKey:e.groupKey,indices:e.indices,children:e.indices.map(e=>(0,B.jsx)(Ule,{partIndex:e,components:r},e))},`group-${t}-${e.groupKey??`ungrouped`}`),t[5]=r,t[6]=n),e=a.map(n),t[2]=r,t[3]=a,t[4]=e}else e=t[4];o=e}let s=o,c;return t[7]===s?c=t[8]:(c=(0,B.jsx)(B.Fragment,{children:s}),t[7]=s,t[8]=c),c};tF.displayName=`MessagePrimitive.Unstable_PartsGrouped`;var nF=e=>{let t=V(6),n,r;t[0]===e?(n=t[1],r=t[2]):({components:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,B.jsx)(tF,{...r,components:n,groupingFunction:Rle}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i};nF.displayName=`MessagePrimitive.Unstable_PartsGroupedByParentId`;function qle(e){return e.message.parts}function Jle(e){return e.part}function Yle(e){return e.message.status??Gle}function Xle(e){return e.message.parts.length}var rF=mO({AttachmentByIndex:()=>fD,Attachments:()=>mD,Content:()=>QP,Error:()=>$P,GenerativeUI:()=>lE,GroupedParts:()=>cD,If:()=>qN,PartByIndex:()=>wE,Parts:()=>QP,Quote:()=>lD,Root:()=>XP,Unstable_PartsGrouped:()=>tF,Unstable_PartsGroupedByParentId:()=>nF}),Zle=e=>{let t=V(2),n=Rm(e),r;return t[0]===n?r=t[1]:(r=e=>{let t=new ResizeObserver(()=>{n()}),r=new MutationObserver(e=>{e.some(Qle)&&n()});return t.observe(e),r.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{t.disconnect(),r.disconnect()}},t[0]=n,t[1]=r),KP(r)};function Qle(e){return e.type!==`attributes`||e.attributeName!==`style`}var $le=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{let i=BS(null),a=H(e=>e.thread.messages.length>0),o=BS(!1),s=BS(null),c=iO();e===void 0&&(e=c.getState().turnAnchor!==`top`);let l=BS(0),u=BS(0),d=BS(0),f=BS(0),p=BS(null),m=HS(e=>{let t=i.current;t&&(p.current=e,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),h=HS(e=>{p.current=e,s.current!==null&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{s.current=null,m(e)})},[m]);WS(()=>()=>{s.current!==null&&cancelAnimationFrame(s.current)},[]);let g=HS(()=>{let e=c.getState();return e.turnAnchor===`top`&&e.element.viewport===i.current&&e.element.anchor!==null},[c]),_=()=>{let e=i.current;if(!e)return;let t=c.getState().isAtBottom,n=Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)<=1||e.scrollHeight<=e.clientHeight;!n&&l.current<e.scrollTop||(n?e.scrollHeight>e.clientHeight+1&&(p.current=null):l.current>e.scrollTop&&u.current===e.scrollHeight&&(p.current=null),(n||p.current===null)&&n!==t&&oO(c).setState({isAtBottom:n})),l.current=e.scrollTop,u.current=e.scrollHeight},v=Zle(()=>{let t=i.current;if(!t)return;let{scrollHeight:n,clientHeight:r}=t;if(n===d.current&&r===f.current)return;d.current=n,f.current=r;let a=p.current;a&&g()?p.current=null:a?m(a):e&&c.getState().isAtBottom&&m(`instant`),_()}),y=KP(e=>{let t=()=>{p.current=null};return e.addEventListener(`scroll`,_),e.addEventListener(`pointerdown`,t),()=>{e.removeEventListener(`scroll`,_),e.removeEventListener(`pointerdown`,t)}});return WS(()=>{if(n){if(!a){o.current=!1;return}o.current||(o.current=!0,p.current===null&&h(`instant`))}},[a,h,n]),hP(({behavior:e})=>{m(e)}),ew(`thread.runStart`,()=>{t&&c.getState().turnAnchor!==`top`&&h(`auto`)}),ew(`threadListItem.switchedTo`,()=>{r&&h(`instant`)}),tt(v,y,i)},iF=(0,FS.forwardRef)((e,t)=>{let n=V(3),r;return n[0]!==e||n[1]!==t?(r=(0,B.jsx)(gO.div,{...e,ref:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});iF.displayName=`ThreadPrimitive.Root`;var aF=e=>{let{children:t}=e;return H(eue)?t:null};aF.displayName=`ThreadPrimitive.Empty`;function eue(e){return e.thread.isEmpty}var tue=e=>{let t=V(4),n;return t[0]!==e.disabled||t[1]!==e.empty||t[2]!==e.running?(n=t=>!(e.empty===!0&&!t.thread.isEmpty||e.empty===!1&&t.thread.isEmpty||e.running===!0&&!t.thread.isRunning||e.running===!1&&t.thread.isRunning||e.disabled===!0&&!t.thread.isDisabled||e.disabled===!1&&t.thread.isDisabled),t[0]=e.disabled,t[1]=e.empty,t[2]=e.running,t[3]=n):n=t[3],H(n)},oF=e=>{let t=V(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),tue(r)?n:null};oF.displayName=`ThreadPrimitive.If`;var sF=(e,t)=>{let n=V(3),r;return n[0]!==t||n[1]!==e?(r=n=>{if(!e)return;let r=e(),i=()=>{let e=t?t(n):n.offsetHeight;r.setHeight(e)},a=new ResizeObserver(i);return a.observe(n),i(),()=>{a.disconnect(),r.unregister()}},n[0]=t,n[1]=e,n[2]=r):r=n[2],KP(r)},cF=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},nue=(e,t)=>{let n=0,r=e;for(;r&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return r===t?n:cF(e)-cF(t)},lF=({viewport:e,anchor:t,tallerThan:n,visibleHeight:r})=>{let i=nue(t,e),a=t.offsetHeight;return i+Math.max(0,a-(a<=n?a:r))},rue=({scrollHeight:e,...t})=>{let{viewport:n}=t,r=lF(t)+n.clientHeight;return Math.max(0,r-e)},iue=({viewport:e,reserve:t,...n})=>rue({viewport:e,...n,scrollHeight:e.scrollHeight-t.offsetHeight}),aue=e=>{let t=new ResizeObserver(e),n=new MutationObserver(e),r=null,i=null,a=null,o=()=>{t.disconnect(),n.disconnect(),r=null,i=null,a=null};return{target:(e,s,c)=>{r===e&&i===s&&a===c||(o(),t.observe(e),t.observe(s),t.observe(c),n.observe(c,{childList:!0,subtree:!0,characterData:!0}),r=e,i=s,a=c)},disconnect:o}},oue=e=>{let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},cancel:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}},sue=e=>{let t=null,n;function r(){let r=e.getState(),{viewport:o,anchor:s,target:c}=r.element,l=r.targetConfig;if(r.turnAnchor!==`top`||!o||!s||!c||!l){a.disconnect(),t&&(JP(t,0),t.remove());return}if(t??=Ele(),(t.parentElement!==c.parentElement||t.previousElementSibling!==c)&&c.after(t),a.target(o,s,c),JP(t,iue({viewport:o,anchor:s,reserve:t,...l}))){i.schedule();return}let u=Tle(s);if(u!==void 0&&n===u)return;let d=Dle(lF({viewport:o,anchor:s,...l}));Math.abs(o.scrollTop-d)>1&&o.scrollTo({top:d,behavior:`smooth`}),u!==void 0&&(n=u)}let i=oue(r),a=aue(i.schedule);i.schedule();let o=e.subscribe(i.schedule);return()=>{i.cancel(),o(),a.disconnect(),t?.remove()}},cue=e=>{let t=V(4),n=iO(),r,i;t[0]!==e||t[1]!==n?(r=()=>{if(e)return sue(n)},i=[e,n],t[0]=e,t[1]=n,t[2]=r,t[3]=i):(r=t[2],i=t[3]),WS(r,i)},uF=({isRunning:e,messages:t})=>{if(!e)return null;let n=t.at(-1),r=t.at(-2);return r?.role!==`user`||n?.role!==`assistant`?null:{anchorId:r.id,targetId:n.id}},lue=e=>uF(e)?.anchorId,uue=e=>uF(e)?.targetId,due=()=>sF(rO(mue),hue),fue=()=>KP(rO(gue)),pue=e=>{let t=V(13),n=iO(),r;t[0]===e?r=t[1]:(r=t=>{if(e)return lue(t.thread)},t[0]=e,t[1]=r);let i=H(r),a;t[2]===e?a=t[3]:(a=t=>{if(e)return uue(t.thread)},t[2]=e,t[3]=a);let o=H(a),s;bb0:{if(!i||!o){s=null;break bb0}let e;t[4]!==i||t[5]!==o?(e={anchorId:i,targetId:o},t[4]=i,t[5]=o,t[6]=e):e=t[6],s=e}let c=s,l,u;t[7]!==c||t[8]!==n?(l=()=>{if(!c)return;let e=n.getState(),t=e.topAnchorTurn;t?.anchorId===c.anchorId&&t.targetId===c.targetId||e.setTopAnchorTurn(c)},u=[c,n],t[7]=c,t[8]=n,t[9]=l,t[10]=u):(l=t[9],u=t[10]),WS(l,u);let d;t[11]===n?d=t[12]:(d=()=>{n.getState().setTopAnchorTurn(null)},t[11]=n,t[12]=d);let f=d;ew(`thread.initialize`,f),ew(`threadListItem.switchedTo`,f)},dF=(0,FS.forwardRef)((e,t)=>{let n=V(18),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({autoScroll:r,scrollToBottomOnRunStart:s,scrollToBottomOnInitialize:o,scrollToBottomOnThreadSwitch:c,children:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l;n[7]!==r||n[8]!==o||n[9]!==s||n[10]!==c?(l={autoScroll:r,scrollToBottomOnRunStart:s,scrollToBottomOnInitialize:o,scrollToBottomOnThreadSwitch:c},n[7]=r,n[8]=o,n[9]=s,n[10]=c,n[11]=l):l=n[11];let u=$le(l),d=due(),f=fue(),p=iO(),m;n[12]===p?m=n[13]:(m=p.getState(),n[12]=p,n[13]=m);let h=m.turnAnchor===`top`;pue(h),cue(h);let g=tt(t,u,d,f),_;return n[14]!==i||n[15]!==g||n[16]!==a?(_=(0,B.jsx)(gO.div,{...a,ref:g,children:i}),n[14]=i,n[15]=g,n[16]=a,n[17]=_):_=n[17],_});dF.displayName=`ThreadPrimitive.ViewportScrollable`;var fF=(0,FS.forwardRef)((e,t)=>{let n=V(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({turnAnchor:a,topAnchorMessageClamp:i,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]!==i||n[5]!==a?(o={turnAnchor:a,topAnchorMessageClamp:i},n[4]=i,n[5]=a,n[6]=o):o=n[6];let s;n[7]!==r||n[8]!==t?(s=(0,B.jsx)(dF,{...r,ref:t}),n[7]=r,n[8]=t,n[9]=s):s=n[9];let c;return n[10]!==o||n[11]!==s?(c=(0,B.jsx)(sO,{options:o,children:s}),n[10]=o,n[11]=s,n[12]=c):c=n[12],c});fF.displayName=`ThreadPrimitive.Viewport`;function mue(e){return e.registerViewport}function hue(e){return e.clientHeight}function gue(e){return e.registerViewportElement}var pF=(0,FS.forwardRef)((e,t)=>{let n=V(3),r=tt(t,sF(rO(_ue),vue)),i;return n[0]!==e||n[1]!==r?(i=(0,B.jsx)(gO.div,{...e,ref:r}),n[0]=e,n[1]=r,n[2]=i):i=n[2],i});pF.displayName=`ThreadPrimitive.ViewportFooter`;function _ue(e){return e.registerContentInset}function vue(e){let t=parseFloat(getComputedStyle(e).marginTop)||0;return e.offsetHeight+t}var yue=bO(`ThreadPrimitive.ScrollToBottom`,e=>{let t=V(5),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{behavior:r}=n,i=rO(bue),a=iO(),o;return t[2]!==r||t[3]!==a?(o=()=>{a.getState().scrollToBottom({behavior:r})},t[2]=r,t[3]=a,t[4]=o):o=t[4],i?null:o},[`behavior`]);function bue(e){return e.isAtBottom}var xue=bO(`ThreadPrimitive.Suggestion`,e=>{let t=V(4),{prompt:n,send:r,clearComposer:i,autoSend:a}=e,o=r??a??!1,s;t[0]!==i||t[1]!==n||t[2]!==o?(s={prompt:n,send:o,clearComposer:i},t[0]=i,t[1]=n,t[2]=o,t[3]=s):s=t[3];let{disabled:c,trigger:l}=foe(s);return c?null:l},[`prompt`,`send`,`clearComposer`,`autoSend`,`method`]),mF=mO({Empty:()=>aF,If:()=>oF,MessageByIndex:()=>rE,Messages:()=>Xae,Root:()=>iF,ScrollToBottom:()=>yue,Suggestion:()=>xue,SuggestionByIndex:()=>ED,Suggestions:()=>kD,Viewport:()=>fF,ViewportFooter:()=>pF,ViewportProvider:()=>sO});function hF({...e}){return(0,B.jsx)(aM,{"data-slot":`popover`,...e})}function gF({...e}){return(0,B.jsx)(oM,{"data-slot":`popover-trigger`,...e})}function _F({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,B.jsx)(sM,{children:(0,B.jsx)(cM,{"data-slot":`popover-content`,align:t,sideOffset:n,className:Bp(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden`,e),...r})})}function vF(e){return(0,B.jsx)(Cj,{"data-slot":`dropdown-menu`,...e})}function yF(e){return(0,B.jsx)(wj,{"data-slot":`dropdown-menu-trigger`,...e})}function bF({className:e,sideOffset:t=4,...n}){return(0,B.jsx)(Tj,{children:(0,B.jsx)(Ej,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:Bp(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,e),...n})})}function xF({className:e,inset:t,variant:n=`default`,...r}){return(0,B.jsx)(Oj,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:Bp(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r})}function SF({className:e,inset:t,...n}){return(0,B.jsx)(Dj,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:Bp(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function CF({className:e,...t}){return(0,B.jsx)(Mj,{"data-slot":`dropdown-menu-separator`,className:Bp(`bg-border -mx-1 my-1 h-px`,e),...t})}function Sue(e){return(0,B.jsx)(kj,{"data-slot":`dropdown-menu-radio-group`,...e})}function wF({className:e,children:t,...n}){return(0,B.jsxs)(Aj,{"data-slot":`dropdown-menu-radio-item`,className:Bp(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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`,e),...n,children:[(0,B.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(jj,{children:(0,B.jsx)(Ly,{className:`size-2 fill-current`})})}),t]})}function TF({className:e,type:t,...n}){return(0,B.jsx)(`input`,{type:t,"data-slot":`input`,className:Bp(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function Cue(e,t){let n=[],r=0;for(let i of e)t.has(i.messageId)?n.push(i):r++;return n.sort((e,n)=>{let r=t.get(e.messageId),i=t.get(n.messageId);if(r!==i)return r-i;let a=e.blockIndex??-1,o=n.blockIndex??-1;return a===o?e.createdAt-n.createdAt:a-o}),{ordered:n,unreachableCount:r}}function wue(e,t,n){if(e.length===0)return null;let r=t===null?-1:e.indexOf(t);return r===-1?n===1?e[0]:e[e.length-1]:e[(r+n+e.length)%e.length]}function EF(e){let t=[];for(let n of e.querySelectorAll(`.oc-md`))if(n.closest(`.oc-msg__meta`)===null)for(let e of n.children)e.tagName===`OL`||e.tagName===`UL`?t.push(...e.children):t.push(e);return t}function DF(e,t){return t===null?e:EF(e)[t]??e}function Tue(e,t){let n=null,r=1/0;for(let i of e){let e=Math.abs(i.center-t);e<r&&(r=e,n=i.id)}return n}function OF(e,t=48){let n=e.replace(/\s+/g,` `).trim(),r=Array.from(n);if(r.length<=t)return n;let i=r.slice(0,t).join(``),a=i.lastIndexOf(` `);return(a>t*.6?i.slice(0,a):i)+`…`}var kF={mod:!0,key:`k`},AF={mod:!0,shift:!0,key:`o`},jF={mod:!0,shift:!0,key:`ArrowUp`},MF={mod:!0,shift:!0,key:`ArrowDown`};function Eue(e){return/mac/i.test(e)}function Due(){if(typeof navigator>`u`)return``;let e=navigator;return e.userAgentData?.platform||e.platform||e.userAgent||``}var NF=null;function PF(){return NF===null&&(NF=Eue(Due())),NF}var Oue={arrowup:`↑`,arrowdown:`↓`,arrowleft:`←`,arrowright:`→`};function FF(e,t){let n=Oue[e.key.toLowerCase()]??e.key.toUpperCase();if(t){let t=``;return e.alt&&(t+=`⌥`),e.shift&&(t+=`⇧`),e.mod&&(t+=`⌘`),t+n}let r=[];return e.mod&&r.push(`Ctrl`),e.shift&&r.push(`Shift`),e.alt&&r.push(`Alt`),r.push(n),r.join(`+`)}function IF(e,t){let n=e.metaKey||e.ctrlKey;return!!t.mod!==n||!!t.shift!==e.shiftKey||!!t.alt!==e.altKey?!1:e.key.toLowerCase()===t.key.toLowerCase()?!0:LF(e.code)===t.key.toLowerCase()}function LF(e){if(!e)return null;let t=/^Key([A-Z])$/.exec(e);if(t?.[1])return t[1].toLowerCase();let n=/^Digit([0-9])$/.exec(e);return n?.[1]?n[1]:null}function kue(e){if(!/^[a-z0-9]$/i.test(e.key)||!e.mod&&!e.alt)return!1;let t=t=>!!e.mod==!!t.mod&&!!e.shift==!!t.shift&&!!e.alt==!!t.alt&&e.key.toLowerCase()===t.key.toLowerCase();return!t(kF)&&!t(AF)}function Aue(e){if([`Shift`,`Control`,`Meta`,`Alt`].includes(e.key))return null;let t=/^[a-z0-9]$/i.test(e.key)?e.key.toLowerCase():LF(e.code)??e.key.toLowerCase(),n={...e.metaKey||e.ctrlKey?{mod:!0}:{},...e.shiftKey?{shift:!0}:{},...e.altKey?{alt:!0}:{},key:t};return kue(n)?n:null}var RF=(0,z.createContext)(null);function zF(){return(0,z.useContext)(RF)}function BF(e,t,n,r){let i=!1,a=0,o=0,s=()=>{if(i)return;let c=document.querySelector(`[data-message-id="${CSS.escape(e)}"]`);if(c){let e=DF(c,t),i=c.closest(`.oc-thread__viewport`);if(!(()=>{if(!r?.skipScrollIfVisible||!i)return!1;let t=e.getBoundingClientRect(),n=i.getBoundingClientRect();return t.top>=n.top&&t.top<=n.bottom-48})())if(i){let t=e.getBoundingClientRect().top-i.getBoundingClientRect().top;i.scrollTo({top:i.scrollTop+t-Math.max(24,i.clientHeight*.3),behavior:n})}else e.scrollIntoView({block:`center`,behavior:n});let a=t===null?c:e,o=t===null?`oc-msg--highlight`:`oc-anchor--flash`;a.classList.remove(o),a.offsetWidth,a.classList.add(o),window.setTimeout(()=>a.classList.remove(o),2400);return}a++<40&&(o=window.setTimeout(s,150))};return o=window.setTimeout(s,0),()=>{i=!0,window.clearTimeout(o)}}function jue({chatId:e,focusMessageId:t,children:n}){let r=I(L.chatBookmarks.getBookmarks,{chatId:e}),i=Nt(L.chatBookmarks.toggleBookmark),a=Nt(L.chatBookmarks.removeBookmark),o=Nt(L.chatBookmarks.renameBookmark),s=Nt(L.chatBookmarks.setActiveBookmark),[c,l]=(0,z.useState)(null);(0,z.useEffect)(()=>{l(null)},[e]);let u=r?.activeBookmarkId??null;(0,z.useEffect)(()=>{c!==null&&u===c&&l(null)},[u,c]);let d=(0,z.useMemo)(()=>(r?.bookmarks??[]).map(e=>({id:e._id,messageId:e.messageId,blockIndex:e.blockIndex,label:e.label,createdAt:e.createdAt})),[r?.bookmarks]),f=c??u,p=(0,z.useMemo)(()=>{let e=new Map;for(let t of d){let n=e.get(t.messageId);n?n.push(t):e.set(t.messageId,[t])}return e},[d]),m=(0,z.useCallback)(t=>{l(t.id),BF(t.messageId,t.blockIndex,`smooth`),s({chatId:e,bookmarkId:t.id})},[e,s]),h=(0,z.useCallback)(t=>{l(t),s({chatId:e,bookmarkId:t})},[e,s]),g=(0,z.useMemo)(()=>({rows:d,activeId:f,byMessage:p,toggle:(t,n)=>void i({chatId:e,messageId:t,...n===null?{}:{blockIndex:n}}).then(e=>{e?.placed===!0&&BF(t,n,`smooth`,{skipScrollIfVisible:!0})}),remove:e=>void a({bookmarkId:e}),rename:(e,t)=>void o({bookmarkId:e,label:t}),jumpTo:m,setActiveQuiet:h}),[d,f,p,e,i,a,o,m,h]),_=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(_.current===e||r===void 0||(_.current=e,t!==null)||f===null)return;let n=d.find(e=>e.id===f);if(n!==void 0)return BF(n.messageId,n.blockIndex,`auto`)},[e,r===void 0]),(0,B.jsx)(RF.Provider,{value:g,children:n})}function Mue(e){let t=e.target;return t instanceof HTMLElement?t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable:!1}function Nue(e){if(e.label!==null&&e.label.length>0)return e.label;let t=document.querySelector(`[data-message-id="${CSS.escape(e.messageId)}"]`);if(t){let n=OF(DF(t,e.blockIndex).textContent??``);if(n.length>0)return n}return Ws()}function Pue(){let e=zF(),t=fO(e=>e.messages.length),[n,r]=(0,z.useState)([]),[i,a]=(0,z.useState)(0),o=e?.rows;(0,z.useEffect)(()=>{if(!o||o.length===0){r([]),a(0);return}let e=!1,t=0,n=0,i=()=>{if(e)return;let s=new Map;document.querySelectorAll(`.oc-thread__viewport [data-message-id]`).forEach((e,t)=>s.set(e.dataset.messageId??``,t));let c=Cue(o,s);r(c.ordered),a(c.unreachableCount),c.ordered.length===0&&t++<40&&(n=window.setTimeout(i,150))};return i(),()=>{e=!0,window.clearTimeout(n)}},[o,t]);let[s,c]=(0,z.useState)(null),l=(0,z.useRef)(0),u=(0,z.useRef)(null),d=s!==null&&n.some(e=>e.id===s)?s:e?.activeId??null;(0,z.useEffect)(()=>{if(!e||n.length===0)return;let t=document.querySelector(`.oc-thread__viewport`);if(!t)return;let r=0,i=0,a=()=>{r===0&&(r=window.requestAnimationFrame(()=>{if(r=0,Date.now()-l.current<1200)return;let a=t.getBoundingClientRect(),o=a.top+a.height/2,s=[];for(let e of n){let n=t.querySelector(`[data-message-id="${CSS.escape(e.messageId)}"]`);if(!n)continue;let r=DF(n,e.blockIndex).getBoundingClientRect();s.push({id:e.id,center:(r.top+r.bottom)/2})}let d=Tue(s,o);d!==null&&(c(d),u.current=d===e.activeId?null:d,window.clearTimeout(i),i=window.setTimeout(()=>{let t=u.current;u.current=null,t!==null&&e.setActiveQuiet(t)},800))}))};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{t.removeEventListener(`scroll`,a),r!==0&&window.cancelAnimationFrame(r),window.clearTimeout(i);let n=u.current;u.current=null,n!==null&&e.setActiveQuiet(n)}},[e,n]);let f=(0,z.useCallback)(t=>{e&&(l.current=Date.now(),c(t.id),e.jumpTo(t))},[e]),p=(0,z.useCallback)(e=>{let t=wue(n.map(e=>e.id),d,e),r=n.find(e=>e.id===t);r&&f(r)},[n,d,f]);if((0,z.useEffect)(()=>{if(n.length===0)return;let e=e=>{Mue(e)||(IF(e,jF)?(e.preventDefault(),p(-1)):IF(e,MF)&&(e.preventDefault(),p(1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n.length,p]),!e||e.rows.length===0)return null;let m=n.findIndex(e=>e.id===d),h=`${m===-1?`–`:m+1}/${n.length}`;return(0,B.jsxs)(`div`,{className:`oc-bmk-rail`,role:`navigation`,"aria-label":Ip(),title:i>0?xr({count:String(i)}):void 0,children:[(0,B.jsx)(Ih,{variant:`ghost`,size:`icon`,className:`oc-bmk-rail__btn`,onClick:()=>p(-1),disabled:n.length===0,title:`${lc()} (${FF(jF,PF())})`,"aria-label":lc(),children:(0,B.jsx)(Ny,{size:14})}),(0,B.jsxs)(vF,{children:[(0,B.jsx)(yF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-bmk-rail__count`,title:Ts(),"aria-label":Ts(),children:[(0,B.jsx)(Ty,{size:11,"aria-hidden":!0}),(0,B.jsx)(`span`,{"aria-live":`polite`,children:h})]})}),(0,B.jsxs)(bF,{side:`left`,align:`center`,className:`oc-bmk-menu`,children:[n.map(e=>(0,B.jsxs)(xF,{className:e.id===d?`oc-bmk-menu__item--current`:void 0,onSelect:()=>f(e),children:[(0,B.jsx)(Ty,{size:12,"aria-hidden":!0,className:`oc-bmk-menu__flag`}),(0,B.jsx)(`span`,{className:`oc-bmk-menu__text`,children:Nue(e)})]},e.id)),i>0?(0,B.jsx)(`div`,{className:`oc-bmk-menu__foot`,children:xr({count:String(i)})}):null]})]}),(0,B.jsx)(Ih,{variant:`ghost`,size:`icon`,className:`oc-bmk-rail__btn`,onClick:()=>p(1),disabled:n.length===0,title:`${nr()} (${FF(MF,PF())})`,"aria-label":nr(),children:(0,B.jsx)(Ay,{size:14})})]})}var VF=class extends z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){}render(){return this.state.failed?null:this.props.children}};function HF(e={}){return(0,B.jsx)(VF,{children:(0,B.jsx)(Fue,{...e})})}function Fue({messageLevelMarkers:e=!0,onReplyToBlock:t}={}){let n=zF(),r=U(e=>e.id),i=U(e=>e.status?.type===`running`),a=(0,z.useRef)(null),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(new Map),f=n?.byMessage.get(r),p=(0,z.useMemo)(()=>e?f:f?.filter(e=>e.blockIndex!==null),[f,e]);if((0,z.useEffect)(()=>{let e=a.current?.closest(`.oc-msg`);s(e?.querySelector(`.oc-msg__body`)??e?.querySelector(`.oc-msg__bubble`)??null)},[r]),(0,z.useEffect)(()=>{if(!o||i||!n)return;let e=o.closest(`.oc-msg`)??o,t=0,r=e=>{t===0&&(t=window.requestAnimationFrame(()=>{t=0;let n=EF(o),r=o.getBoundingClientRect().top,i=null,a=1/0;for(let t=0;t<n.length;t++){let o=n[t].getBoundingClientRect();if(e.clientY>=o.top&&e.clientY<=o.bottom){l({top:o.top-r,blockIndex:t});return}let s=e.clientY<o.top?o.top-e.clientY:e.clientY-o.bottom;s<a&&(a=s,i={top:o.top-r,blockIndex:t})}l(a<=16?i:null)}))},a=()=>{t!==0&&(window.cancelAnimationFrame(t),t=0),l(null)};return e.addEventListener(`mousemove`,r),e.addEventListener(`mouseleave`,a),()=>{e.removeEventListener(`mousemove`,r),e.removeEventListener(`mouseleave`,a),t!==0&&window.cancelAnimationFrame(t)}},[o,i,n]),(0,z.useEffect)(()=>{if(!o||!p||p.length===0){d(new Map);return}let e=()=>{let e=o.getBoundingClientRect().top,t=new Map;for(let n of p){let r=DF(o,n.blockIndex);t.set(n.id,r.getBoundingClientRect().top-e)}d(t)};e();let t=new ResizeObserver(e);return t.observe(o),()=>t.disconnect()},[o,p]),!n||!o)return(0,B.jsx)(`span`,{ref:a,hidden:!0});let m=c!==null&&(p??[]).some(e=>e.blockIndex===c.blockIndex);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{ref:a,hidden:!0}),(0,Fv.createPortal)((0,B.jsxs)(B.Fragment,{children:[c!==null&&!i?(0,B.jsxs)(`span`,{className:`oc-bmk-gutterrow`,style:{top:c.top},children:[t?(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-gutter oc-bmk-gutter--reply`,title:Qs(),"aria-label":Qs(),onClick:()=>{let e=OF(DF(o,c.blockIndex).textContent??``,280);e!==``&&t(c.blockIndex,e)},children:(0,B.jsx)(Lb,{size:14})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-gutter${m?` is-set`:``}`,title:m?su():bm(),"aria-label":m?su():bm(),onClick:()=>n.toggle(r,c.blockIndex),children:(0,B.jsx)(Ty,{size:14})})]}):null,(p??[]).map(e=>{let t=u.get(e.id);return t===void 0?null:(0,B.jsx)(Iue,{bookmark:e,top:t},e.id)})]}),o)]})}function UF({bookmark:e,trigger:t}){let n=zF(),[r,i]=(0,z.useState)(e.label??``),[a,o]=(0,z.useState)(!1);return n?(0,B.jsxs)(hF,{open:a,onOpenChange:t=>{o(t),t&&i(e.label??``)},children:[(0,B.jsx)(gF,{asChild:!0,children:t}),(0,B.jsx)(_F,{side:`left`,align:`start`,className:`oc-bmk-pop`,children:(0,B.jsxs)(`form`,{className:`oc-bmk-pop__form`,onSubmit:t=>{t.preventDefault(),n.rename(e.id,r),o(!1)},children:[(0,B.jsx)(TF,{value:r,onChange:e=>i(e.target.value),placeholder:Ec(),maxLength:60,autoFocus:!0}),(0,B.jsxs)(`div`,{className:`oc-bmk-pop__actions`,children:[(0,B.jsx)(Ih,{type:`submit`,size:`sm`,variant:`secondary`,children:C()}),(0,B.jsxs)(Ih,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{n.remove(e.id),o(!1)},children:[(0,B.jsx)($b,{size:14,"aria-hidden":!0}),Ca()]})]})]})})]}):null}function Iue({bookmark:e,top:t}){return(0,B.jsx)(UF,{bookmark:e,trigger:(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-marker`,style:{top:t},title:e.label??Ws(),"aria-label":e.label??Ws(),children:(0,B.jsx)(Ty,{size:14})})})}function WF(e){return(0,B.jsx)(VF,{children:(0,B.jsx)(Lue,{...e})})}function Lue({header:e=!1}){let t=zF(),n=U(e=>e.id),r=t?.byMessage.get(n)?.find(e=>e.blockIndex===null)??null;if(!t)return null;let i=r!==null,a=e?`oc-bmk-headbtn${i?` is-set`:``}`:`oc-iconbtn${i?` oc-iconbtn--bmk-set`:``}`;return e&&r!==null?(0,B.jsx)(UF,{bookmark:r,trigger:(0,B.jsx)(`button`,{type:`button`,className:a,title:r.label??Ws(),"aria-label":r.label??Ws(),children:(0,B.jsx)(Ty,{size:13})})}):(0,B.jsx)(`button`,{type:`button`,className:a,title:i?su():bm(),"aria-label":i?su():bm(),onClick:()=>t.toggle(n,null),children:(0,B.jsx)(Ty,{size:e?13:15})})}var GF=z.createContext(null),Rue=6e3;function KF(e){let t=e?.data;if(typeof t==`string`&&t)return t;if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return String(e)}catch{return Um()}}function zue({children:e}){let[t,n]=z.useState([]),r=z.useRef(0),i=z.useRef(new Map),a=z.useCallback(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t!==void 0&&(window.clearTimeout(t),i.current.delete(e))},[]),o=z.useCallback(e=>{let t=r.current++,o={id:t,variant:e.variant??`info`,title:e.title,description:e.description};n(e=>[...e,o]);let s=window.setTimeout(()=>a(t),Rue);i.current.set(t,s)},[a]);z.useEffect(()=>{let e=i.current;return()=>{for(let t of e.values())window.clearTimeout(t);e.clear()}},[]);let s=z.useMemo(()=>({toast:o,error:(e,t)=>o({variant:`error`,title:e,description:t===void 0?void 0:KF(t)}),success:(e,t)=>o({variant:`success`,title:e,description:t})}),[o]);return(0,B.jsxs)(GF.Provider,{value:s,children:[e,(0,B.jsx)(`div`,{className:`oc-toast__viewport`,role:`region`,"aria-label":Pc(),children:t.map(e=>(0,B.jsxs)(`div`,{className:Bp(`oc-toast`,`oc-toast--${e.variant}`),role:e.variant===`error`?`alert`:`status`,children:[(0,B.jsxs)(`div`,{className:`oc-toast__body`,children:[(0,B.jsx)(`div`,{className:`oc-toast__title`,children:e.title}),e.description?(0,B.jsx)(`div`,{className:`oc-toast__desc`,children:e.description}):null]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-toast__close`,"aria-label":Fc(),onClick:()=>a(e.id),children:(0,B.jsx)(xh,{"aria-hidden":!0})})]},e.id))})]})}function qF(){let e=z.useContext(GF);if(!e)throw Error(`useToast must be used within <ToastProvider>`);return e}function JF(e){let t=(0,z.useRef)(null),n=(0,z.useRef)(e);return n.current=e,(0,z.useEffect)(()=>{let e=e=>{t.current!==null&&(n.current(e.clientX-t.current.x,e.clientY-t.current.y),t.current={x:e.clientX,y:e.clientY})},r=()=>{t.current=null};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,r),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,r)}},[]),e=>{t.current={x:e.clientX,y:e.clientY}}}function Bue(){let e=(0,z.useSyncExternalStore)(px,mx),t=Nv(),n=qF();(0,z.useEffect)(()=>()=>void wx(),[]);let r=(0,z.useCallback)((e,t)=>{let n=mx()?.geom;n!==void 0&&bx({...n,x:n.x+e,y:n.y+t})},[]),i=(0,z.useCallback)((e,t)=>{let n=mx()?.geom;n!==void 0&&bx({...n,w:n.w+e,h:n.h+t})},[]),a=JF(r),o=JF(i);(0,z.useEffect)(()=>{let e=()=>{let e=mx()?.geom;e!==void 0&&bx(e)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let s=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>s.current?.stop(),[]);let c=e?.recording??!1,l=(0,z.useCallback)(()=>{if(mx()?.recording===!0){let e=_x();s.current?.stop(),s.current=null,Ine(),window.setTimeout(()=>Cx(e),1500);return}if(!Mx())return;let e=mx()?.voiceLang||Ex(``,Jd()),t={h:null,gen:0},r=()=>{s.current===t.h&&(s.current=null),Cx(t.gen)},i=Nx({lang:e,onText:(e,n)=>{t.gen===_x()&&vx(e,n.paragraph)},onInterim:e=>{t.gen===_x()&&yx(e)},onEnd:r,onError:e=>{r(),e===`not-allowed`||e===`service-not-allowed`?n.error(ta()):e!==`no-speech`&&e!==`aborted`&&n.error(ti({code:e}))}});if(i===null){n.error(bi());return}t.h=i,s.current=i,gx(()=>i.stop()),t.gen=_x()},[n]),u=qx(e?.targetChatId??null);if(e===null)return null;let d=hx(e.geom,{w:window.innerWidth,h:window.innerHeight});return(0,Fv.createPortal)((0,B.jsxs)(`div`,{className:`oc-detach${c?` oc-detach--live`:``}`,style:{left:`${d.x}px`,top:`${d.y}px`,width:`${d.w}px`,height:`${d.h}px`},role:`dialog`,"aria-label":Nl(),children:[(0,B.jsx)(`div`,{className:`oc-detach__handle`,onPointerDown:a,title:of(),"aria-label":of(),children:(0,B.jsx)(sb,{size:16,"aria-hidden":!0})}),(0,B.jsxs)(`div`,{className:`oc-detach__head`,onPointerDown:a,children:[c?(0,B.jsxs)(`span`,{className:`oc-detach__wave`,"aria-hidden":!0,children:[(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{})]}):null,(0,B.jsx)(`span`,{className:`oc-detach__chip`,title:e.targetLabel,children:e.targetLabel||Nl()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__close`,title:im(),"aria-label":im(),onPointerDown:e=>e.stopPropagation(),onClick:()=>{Hne(e.targetChatId),wx()},children:(0,B.jsx)(xh,{size:14,"aria-hidden":!0})})]}),u.length>0?(0,B.jsx)(`div`,{className:`oc-detach__quotes`,children:u.map(n=>(0,B.jsxs)(`div`,{className:`oc-detach__quote`,role:`group`,"aria-label":Bt(),children:[(0,B.jsx)(Lb,{size:12,"aria-hidden":!0,className:`oc-detach__quote-ico`}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__quote-text`,title:dr(),onClick:()=>{BF(n.messageId,n.blockIndex,`smooth`),t({to:`/chat/$chatId`,params:{chatId:e.targetChatId}})},children:n.excerpt}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__quote-x`,"aria-label":hs(),onClick:()=>Ux(e.targetChatId,Wx(n)),children:(0,B.jsx)(xh,{size:12,"aria-hidden":!0})})]},Wx(n)))}):null,(0,B.jsx)(`textarea`,{className:`oc-detach__input`,value:e.text,placeholder:Nl(),onChange:e=>jne(e.target.value),readOnly:e.sending,autoFocus:!0}),c&&e.interim!==``?(0,B.jsx)(`div`,{className:`oc-detach__interim`,"aria-hidden":!0,children:e.interim}):null,(0,B.jsxs)(`div`,{className:`oc-detach__bar`,children:[e.voiceEnabled&&Mx()?(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__icon${c?` oc-detach__icon--rec`:``}`,title:c?Ot():Pn(),"aria-label":c?Ot():Pn(),"aria-pressed":c,disabled:e.sending,onClick:l,children:c?(0,B.jsx)(bb,{size:16,"aria-hidden":!0}):(0,B.jsx)(xb,{size:16,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__icon`,title:c?nl():tp(),"aria-label":tp(),disabled:e.sending||c,onClick:()=>{Sx(),t({to:`/chat/$chatId`,params:{chatId:e.targetChatId}})},children:(0,B.jsx)(Pb,{size:16,"aria-hidden":!0})}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-detach__send`,disabled:e.text.trim()===``||c||e.sending,title:c?nl():ql(),"aria-label":ql(),onClick:()=>{Mne(e.text),t({to:`/chat/$chatId`,params:{chatId:e.targetChatId}})},children:[(0,B.jsx)(Hb,{size:15,"aria-hidden":!0}),ql()]})]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__resize`,"aria-label":Pm(),onPointerDown:o})]}),document.body)}var Vue=Ef(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function YF({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,B.jsx)(n?Wa:`span`,{"data-slot":`badge`,"data-variant":t,className:Bp(Vue({variant:t}),e),...r})}function XF({...e}){return(0,B.jsx)(cse,{"data-slot":`alert-dialog`,...e})}function Hue({...e}){return(0,B.jsx)(lse,{"data-slot":`alert-dialog-portal`,...e})}function Uue({className:e,...t}){return(0,B.jsx)(use,{"data-slot":`alert-dialog-overlay`,className:Bp(`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 ZF({className:e,...t}){return(0,B.jsxs)(Hue,{children:[(0,B.jsx)(Uue,{}),(0,B.jsx)(dse,{"data-slot":`alert-dialog-content`,className:Bp(`fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover bg-clip-padding p-5 text-sm text-popover-foreground shadow-lg duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})]})}function QF({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:Bp(`flex flex-col gap-1.5`,e),...t})}function $F({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:Bp(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function eI({className:e,...t}){return(0,B.jsx)(mse,{"data-slot":`alert-dialog-title`,className:Bp(`text-base font-medium text-foreground`,e),...t})}function tI({className:e,...t}){return(0,B.jsx)(hse,{"data-slot":`alert-dialog-description`,className:Bp(`text-sm text-muted-foreground`,e),...t})}function nI({className:e,...t}){return(0,B.jsx)(fse,{className:Bp(Fh(),e),...t})}function rI({className:e,...t}){return(0,B.jsx)(pse,{className:Bp(Fh({variant:`outline`}),e),...t})}function iI(e,t,n){if(e===`*`)return{kind:`any`};let r=/^\*\/(\d{1,3})$/.exec(e);if(r!==null){let e=Number(r[1]);return e>=1?{kind:`step`,n:e}:null}let i=[];for(let r of e.split(`,`)){let e=/^(\d{1,3})-(\d{1,3})$/.exec(r);if(e!==null){let r=Number(e[1]),a=Number(e[2]);if(r>a||r<t||a>n)return null;for(let e=r;e<=a;e++)i.push(e);continue}if(!/^\d{1,3}$/.test(r))return null;let a=Number(r);if(a<t||a>n)return null;i.push(a)}return i.length>0&&i.length<=31?{kind:`values`,values:i}:null}function Wue(e,t){let n=new Date(2024,0,1,e,t);return new Intl.DateTimeFormat(Jd(),{hour:`2-digit`,minute:`2-digit`}).format(n)}function Gue(e){let t=new Date(2024,8,1+e%7);return new Intl.DateTimeFormat(Jd(),{weekday:`long`}).format(t)}function Kue(e){let t=new Date(2024,e-1,1);return new Intl.DateTimeFormat(Jd(),{month:`long`}).format(t)}function que(e){try{return new Intl.ListFormat(Jd(),{style:`long`,type:`conjunction`}).format(e)}catch{return e.join(`, `)}}function aI(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=iI(t[0],0,59),r=iI(t[1],0,23),i=iI(t[2],1,31),a=iI(t[3],1,12),o=iI(t[4],0,7);if(!n||!r||!i||!a||!o)return null;if(r.kind===`any`&&i.kind===`any`&&a.kind===`any`&&o.kind===`any`)return n.kind===`any`?gt():n.kind===`step`?60%n.n==0?Wi({n:n.n}):null:n.values.length===1?li({m:String(n.values[0]).padStart(2,`0`)}):null;if(r.kind===`step`&&n.kind===`values`&&n.values.length===1&&i.kind===`any`&&a.kind===`any`&&o.kind===`any`)return 24%r.n==0?Kr({n:r.n}):null;if(n.kind!==`values`||n.values.length!==1||r.kind!==`values`||r.values.length!==1)return null;let s=Wue(r.values[0],n.values[0]);if(o.kind===`values`&&i.kind===`any`&&a.kind===`any`)return E({days:que([...new Set(o.values.map(e=>e%7))].sort((e,t)=>e-t).map(Gue)),time:s});if(o.kind!==`any`)return null;if(i.kind===`any`&&a.kind===`any`)return vd({time:s});if(i.kind===`values`&&i.values.length===1){if(a.kind===`any`)return Fd({dom:i.values[0],time:s});if(a.kind===`values`&&a.values.length===1)return ki({dom:i.values[0],month:Kue(a.values[0]),time:s})}return null}function oI(e){if(e===null)return null;let t=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(|$)/.exec(e.trim());return t===null?null:t[1]}function sI({icon:e,label:t,sublabel:n,trailing:r,tone:i=`default`,active:a,open:o,onClick:s,title:c,ariaLabel:l,ariaExpanded:u,ariaHasPopup:d,inert:f=!1}){return f?(0,B.jsxs)(`div`,{className:`oc-actrow oc-actrow--${i} oc-actrow--inert`,title:c,children:[(0,B.jsxs)(`span`,{className:`oc-actrow__top`,children:[(0,B.jsx)(`span`,{className:`oc-actrow__icon`,"aria-hidden":!0,children:e}),(0,B.jsx)(`span`,{className:`oc-actrow__label`,children:t}),r?(0,B.jsx)(`span`,{className:`oc-actrow__trail`,children:r}):null]}),n?(0,B.jsx)(`span`,{className:`oc-actrow__sub`,children:n}):null]}):(0,B.jsxs)(`button`,{type:`button`,className:`oc-actrow oc-actrow--${i}${a?` is-active`:``}${o?` is-open`:``}`,onClick:s,title:c,"aria-label":l,"aria-expanded":u,"aria-haspopup":d?`dialog`:void 0,children:[(0,B.jsxs)(`span`,{className:`oc-actrow__top`,children:[(0,B.jsx)(`span`,{className:`oc-actrow__icon`,"aria-hidden":!0,children:e}),(0,B.jsx)(`span`,{className:`oc-actrow__label`,children:t}),r?(0,B.jsx)(`span`,{className:`oc-actrow__trail`,children:r}):null,(0,B.jsx)(My,{size:14,className:`oc-actrow__chev`,"aria-hidden":!0})]}),n?(0,B.jsx)(`span`,{className:`oc-actrow__sub`,children:n}):null]})}var cI=(0,z.createContext)(null),Jue=[];function Yue(e){return e===`created`?(0,B.jsx)(Ib,{size:12,"aria-hidden":!0}):e===`removed`?(0,B.jsx)($b,{size:12,"aria-hidden":!0}):(0,B.jsx)(jb,{size:12,"aria-hidden":!0})}function lI(e){return e===`created`?It():e===`removed`?ko():ds()}function Xue(){let e=U(e=>e.metadata?.custom?.cronParts??Jue),t=U(e=>e.metadata?.custom?.routedInstanceName??null),n=U(e=>e.id),r=(0,z.useContext)(cI),[i,a]=(0,z.useState)(!0);return e.length===0?null:(0,B.jsxs)(`div`,{className:`oc-cronact`,children:[(0,B.jsx)(sI,{icon:(0,B.jsx)(Oy,{size:14}),label:Js({count:e.length}),open:i,ariaExpanded:i,title:Vn(),onClick:()=>a(!i)}),i?(0,B.jsx)(`div`,{className:`oc-cronact__list`,children:e.map((e,i)=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-cronact__item${r?.active!==null&&r?.active!==void 0&&r.active.jobId===(e.jobId??null)&&r.active.occurrenceId===`${n}#${i}`?` oc-cronact__item--active`:``}`,onClick:()=>r?.openFor(e,t,`${n}#${i}`),title:Sp(),children:[(0,B.jsxs)(`span`,{className:`oc-cronact__op oc-cronact__op--${e.op}`,children:[Yue(e.op),lI(e.op)]}),(0,B.jsx)(`span`,{className:`oc-cronact__name`,children:e.name??e.jobId??sr()}),e.schedule===void 0?null:(0,B.jsx)(`span`,{className:`oc-cronact__sched`,children:e.schedule})]},`${e.jobId??`job`}-${i}`))}):null]})}function uI(e){return typeof e==`number`?new Intl.DateTimeFormat(Jd(),{dateStyle:`medium`,timeStyle:`short`}).format(e):`—`}function Zue(e){return e===`ok`?(0,B.jsx)(YF,{variant:`secondary`,children:Vu()}):e===`error`?(0,B.jsx)(YF,{variant:`destructive`,children:sp()}):e===`skipped`?(0,B.jsx)(YF,{variant:`outline`,children:Sn()}):(0,B.jsx)(YF,{variant:`outline`,children:e??`—`})}function dI({instanceName:e,part:t,onClose:n,onChanged:r}){let i=Ei(L.scheduled.getCronDetail),a=Ei(L.scheduled.listCronRuns),o=Ei(L.scheduled.updateCron),s=Ei(L.scheduled.removeCron),c=Ei(L.scheduled.runCronNow),l=qF(),u=t.jobId??null,[d,f]=(0,z.useState)(null),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(`loading`),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(!1),C=(0,z.useRef)(0),w=(0,z.useCallback)(async()=>{let n=++C.current;if(f(null),m(null),g(null),u===null||t.op===`removed`){v(t.op===`removed`?`gone`:`error`);return}v(`loading`);try{let t=await i({instanceName:e,jobId:u});if(n!==C.current)return;if(f(t.job),m(t.capabilities),v(`ready`),t.capabilities.canHistory)try{let t=await a({instanceName:e,jobId:u,limit:5});if(n!==C.current)return;g(t)}catch{n===C.current&&g(null)}}catch(e){if(n!==C.current)return;let t=e?.data?.code;v(t===`not_found`?`gone`:`error`)}},[i,a,e,u,t.op]);(0,z.useEffect)(()=>{w()},[w]);let T=(0,z.useRef)(``);(0,z.useEffect)(()=>{T.current=`${e}:${u??``}`,b(null)},[e,u]);let E=async(t,n,i)=>{let a=`${e}:${u??``}`;b(t);try{if(await n(),T.current!==a)return;l.success(i),r?.(),await w()}catch(e){let t=e?.data?.code??`unknown`;l.toast({variant:`error`,title:po({code:t})})}finally{T.current===a&&b(e=>e===t?null:e)}},O=d??{id:u,name:t.name??null,enabled:t.enabled??null,schedule:t.schedule??null,message:t.message??null,deliveryMode:t.deliveryMode??null,agentId:t.agentId??null,nextRunAtMs:t.nextRunAtMs??null,lastRunStatus:null,lastDelivered:null,lastDeliveryError:null,updatedAtMs:null};return(0,B.jsxs)(`div`,{className:`oc-cronpanel`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__head`,children:[(0,B.jsx)(Oy,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cronpanel__title`,title:O.name??void 0,children:O.name??sr()}),(0,B.jsx)(YF,{variant:`outline`,children:lI(t.op)}),(0,B.jsx)(Ih,{variant:`ghost`,size:`icon`,onClick:n,"aria-label":nn(),children:(0,B.jsx)(xh,{"aria-hidden":!0})})]}),_===`loading`?(0,B.jsxs)(`div`,{className:`oc-cronpanel__loading`,children:[(0,B.jsx)(pb,{size:16,className:`oc-actrow__spin`,"aria-hidden":!0}),qo()]}):null,_===`gone`?(0,B.jsx)(`div`,{className:`oc-cronpanel__notice`,children:ce()}):null,_===`error`?(0,B.jsx)(`div`,{className:`oc-cronpanel__notice`,children:Hee()}):null,(0,B.jsxs)(`dl`,{className:`oc-cronpanel__facts`,children:[(0,B.jsx)(`dt`,{children:Oa()}),(0,B.jsx)(`dd`,{children:O.enabled===!0?(0,B.jsx)(YF,{variant:`secondary`,children:pc()}):O.enabled===!1?(0,B.jsx)(YF,{variant:`outline`,children:ua()}):`—`}),(0,B.jsx)(`dt`,{children:Dr()}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`span`,{className:`oc-cronpanel__mono`,children:O.schedule??`—`}),(()=>{let e=oI(O.schedule),t=e===null?null:aI(e);return t===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:t})})()]}),(0,B.jsx)(`dt`,{children:Cn()}),(0,B.jsx)(`dd`,{children:uI(O.nextRunAtMs)}),(0,B.jsx)(`dt`,{children:_t()}),(0,B.jsx)(`dd`,{children:O.agentId??`—`}),O.deliveryMode===null?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:Gi()}),(0,B.jsx)(`dd`,{children:O.deliveryMode})]}),O.lastDelivered===!1?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:ui()}),(0,B.jsxs)(`dd`,{className:`oc-cronpanel__undelivered`,children:[qr(),O.lastDeliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:O.lastDeliveryError})]})]}):null]}),O.message===null?null:(0,B.jsxs)(`div`,{className:`oc-cronpanel__message`,children:[(0,B.jsx)(`div`,{className:`oc-cronpanel__message-label`,children:yd()}),(0,B.jsx)(`div`,{className:`oc-cronpanel__message-body`,children:O.message})]}),_===`ready`&&p!==null&&u!==null?(0,B.jsxs)(`div`,{className:`oc-cronpanel__actions`,children:[p.canRunNow?(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,disabled:y!==null,onClick:()=>E(`run`,async()=>{let t=await c({instanceName:e,jobId:u});if(t.ran!==!0&&t.runId===null)throw{data:{code:t.reason??`run_not_started`}}},th()),children:[y===`run`?(0,B.jsx)(pb,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(ix,{size:14,"aria-hidden":!0}),D()]}):null,p.canToggle&&O.enabled!==null?(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,disabled:y!==null,onClick:()=>E(`toggle`,()=>o({instanceName:e,jobId:u,patch:{enabled:!(O.enabled??!1)}}),O.enabled===!0?Ee():Ka()),children:[O.enabled===!0?(0,B.jsx)(Ab,{size:14,"aria-hidden":!0}):(0,B.jsx)(Fb,{size:14,"aria-hidden":!0}),O.enabled===!0?Id():Ai()]}):null,p.canDelete?(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,disabled:y!==null,onClick:()=>S(!0),children:[(0,B.jsx)($b,{size:14,"aria-hidden":!0}),He()]}):null,(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,B.jsxs)(qv,{to:`/settings/$tab`,params:{tab:`scheduled`},search:u===null?void 0:{job:u},children:[(0,B.jsx)(Jy,{size:14,"aria-hidden":!0}),rt()]})})]}):null,h!==null&&h.length>0?(0,B.jsxs)(`div`,{className:`oc-cronpanel__runs`,children:[(0,B.jsx)(`div`,{className:`oc-cronpanel__runs-label`,children:Ou()}),h.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[Zue(e.status),(0,B.jsx)(`span`,{children:uI(e.runAtMs??e.ts)}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[ff({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))]}):null,(0,B.jsx)(XF,{open:x,onOpenChange:S,children:(0,B.jsxs)(ZF,{children:[(0,B.jsxs)(QF,{children:[(0,B.jsx)(eI,{children:cl()}),(0,B.jsx)(tI,{children:Aee({name:O.name??u??``})})]}),(0,B.jsxs)($F,{children:[(0,B.jsx)(rI,{children:Bm()}),(0,B.jsx)(nI,{onClick:()=>{u!==null&&E(`delete`,()=>s({instanceName:e,jobId:u}),gee())},children:jc()})]})]})})]})}var fI=class extends z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){}render(){return this.state.failed?(0,B.jsxs)(`div`,{className:`oc-panel-failed`,children:[(0,B.jsx)(`p`,{children:se()}),this.props.onClose===void 0?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-panel-failed__close`,onClick:this.props.onClose,children:_h()})]}):this.props.children}},Que=[`github-light`,`github-dark`],$ue=[`code`,`math`,`cjk`];function ede(e,t){let n={};for(let r of $ue){let i=e?.[r];if(i===!1)continue;let a=i||t[r];a&&(n[r]=a)}let r=e?.mermaid;return r&&r!==!1&&(n.mermaid=r),n}function pI(e){return typeof e==`object`&&!!e&&`type`in e&&`key`in e}function tde(e,t){return e===t?!0:!pI(e)||!pI(t)?!1:e.type===t.type&&e.key===t.key}function nde(e,t){let n=Object.keys(e).filter(e=>e!==`children`),r=Object.keys(t).filter(e=>e!==`children`);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return tde(e.children,t.children)}var rde=(0,z.createContext)(null),ide=(0,z.memo)(function({children:e,node:t,...n}){let r=(0,z.isValidElement)(e)?(0,z.cloneElement)(e,{"data-block":`true`}):e;return(0,B.jsx)(rde.Provider,{value:{node:t,...n},children:r})},nde),ade=Object.defineProperty,ode=Object.defineProperties,sde=Object.getOwnPropertyDescriptors,mI=Object.getOwnPropertySymbols,cde=Object.prototype.hasOwnProperty,lde=Object.prototype.propertyIsEnumerable,hI=(e,t,n)=>t in e?ade(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gI=(e,t)=>{for(var n in t||={})cde.call(t,n)&&hI(e,n,t[n]);if(mI)for(var n of mI(t))lde.call(t,n)&&hI(e,n,t[n]);return e},_I=(e,t)=>ode(e,sde(t)),vI=(e,t)=>{let n=!1,r=!1;for(let i=0;i<t;i+=1){if(e[i]===`\\`&&i+1<e.length&&e[i+1]==="`"){i+=1;continue}if(e.substring(i,i+3)==="```"){r=!r,i+=2;continue}!r&&e[i]==="`"&&(n=!n)}return n||r},ude=(e,t)=>{let n=e.substring(t,t+3)==="```",r=t>0&&e.substring(t-1,t+2)==="```",i=t>1&&e.substring(t-2,t+1)==="```";return n||r||i},dde=e=>{let t=0;for(let n=0;n<e.length;n+=1){if(e[n]===`\\`&&n+1<e.length&&e[n+1]==="`"){n+=1;continue}e[n]==="`"&&!ude(e,n)&&(t+=1)}return t},yI=(e,t)=>{let n=!1,r=!1,i=-1;for(let a=0;a<e.length;a+=1){if(e[a]===`\\`&&a+1<e.length&&e[a+1]==="`"){a+=1;continue}if(e.substring(a,a+3)==="```"){r=!r,a+=2;continue}if(!r&&e[a]==="`")if(n){if(i<t&&t<a)return!0;n=!1,i=-1}else n=!0,i=a}return!1},fde=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,pde=e=>!e||typeof e!=`string`||!e.includes(`>`)?e:e.replace(fde,(t,n,r,i)=>vI(e,i)?t:`${n}\\>${r}`),mde=/(\*\*)([^*]*\*?)$/,hde=/(__)([^_]*?)$/,gde=/(\*\*\*)([^*]*?)$/,_de=/(\*)([^*]*?)$/,vde=/(_)([^_]*?)$/,yde=/(`)([^`]*?)$/,bde=/(~~)([^~]*?)$/,bI=/^[\s_~*`]*$/,xI=/^[\s]*[-*+][\s]+$/,xde=/[\p{L}\p{N}_]/u,Sde=/^```[^`\n]*```?$/,Cde=/^\*{4,}$/,wde=/(__)([^_]+)_$/,Tde=/(~~)([^~]+)~$/,SI=/~~/g,CI=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95?!0:xde.test(e)},Ede=(e,t)=>{let n=1;for(let r=t-1;r>=0;--r)if(e[r]===`]`)n+=1;else if(e[r]===`[`&&(--n,n===0))return r;return-1},wI=(e,t)=>{let n=1;for(let r=t+1;r<e.length;r+=1)if(e[r]===`[`)n+=1;else if(e[r]===`]`&&(--n,n===0))return r;return-1},TI=(e,t)=>{let n=!1,r=!1;for(let i=0;i<e.length&&i<t;i+=1){if(e[i]===`\\`&&e[i+1]===`$`){i+=1;continue}e[i]===`$`&&(e[i+1]===`$`?(r=!r,i+=1,n=!1):r||(n=!n))}return n||r},Dde=(e,t)=>{for(let n=t;n<e.length;n+=1){if(e[n]===`)`)return!0;if(e[n]===`
|
|
107
|
-
`)return!1}return!1},
|
|
108
|
-
`)return!1}return!1},
|
|
109
|
-
`)return!1}return!1},
|
|
106
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return z.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},cse=MO,lse=NO,use=PO,dse=IO,fse=VO,pse=UO,mse=RO,hse=BO;function WO(e){let t=z.useRef({value:e,previous:e});return z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var GO=`Checkbox`,[gse,_se]=Eu(GO),[vse,KO]=gse(GO);function yse(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ap({prop:n,defaultProp:i??!1,onChange:c,caller:GO}),[m,h]=z.useState(null),[g,_]=z.useState(null),v=z.useRef(!1),y=m?!!o||!!m.closest(`form`):!0,b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:ek(i)?!1:i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,B.jsx)(vse,{scope:t,...b,children:bse(d)?d(b):r})}var qO=`CheckboxTrigger`,JO=z.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=KO(qO,e),h=tt(i,u),g=z.useRef(c);return z.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,B.jsx)(ol.button,{type:`button`,role:`checkbox`,"aria-checked":ek(c)?`mixed`:c,"aria-required":l,"data-state":tk(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:R(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:R(n,e=>{d(e=>ek(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});JO.displayName=qO;var YO=z.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,B.jsx)(yse,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(JO,{...d,ref:t,__scopeCheckbox:n}),e&&(0,B.jsx)($O,{__scopeCheckbox:n})]})})});YO.displayName=GO;var XO=`CheckboxIndicator`,ZO=z.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=KO(XO,n);return(0,B.jsx)(fu,{present:r||ek(a.checked)||a.checked===!0,children:(0,B.jsx)(ol.span,{"data-state":tk(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});ZO.displayName=XO;var QO=`CheckboxBubbleInput`,$O=z.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=KO(QO,e),m=tt(n,p),h=WO(a),g=td(r);z.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=ek(a),n.call(e,ek(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=z.useRef(ek(a)?!1:a);return(0,B.jsx)(ol.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});$O.displayName=QO;function bse(e){return typeof e==`function`}function ek(e){return e===`indeterminate`}function tk(e){return ek(e)?`indeterminate`:e?`checked`:`unchecked`}var nk=`rovingFocusGroup.onEntryFocus`,xse={bubbles:!1,cancelable:!0},rk=`RovingFocusGroup`,[ik,ak,Sse]=OO(rk),[Cse,ok]=Eu(rk,[Sse]),[wse,Tse]=Cse(rk),sk=z.forwardRef((e,t)=>(0,B.jsx)(ik.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(ik.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Ese,{...e,ref:t})})}));sk.displayName=rk;var Ese=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=z.useRef(null),p=tt(t,f),m=kO(a),[h,g]=ap({prop:o,defaultProp:s??null,onChange:c,caller:rk}),[_,v]=z.useState(!1),y=Rm(l),b=ak(n),x=z.useRef(!1),[S,C]=z.useState(0);return z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(nk,y),()=>e.removeEventListener(nk,y)},[y]),(0,B.jsx)(wse,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:z.useCallback(e=>g(e),[g]),onItemShiftTab:z.useCallback(()=>v(!0),[]),onFocusableItemAdd:z.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:z.useCallback(()=>C(e=>e-1),[]),children:(0,B.jsx)(ol.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:R(e.onMouseDown,()=>{x.current=!0}),onFocus:R(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(nk,xse);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);uk([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:R(e.onBlur,()=>v(!1))})})}),ck=`RovingFocusGroupItem`,lk=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Rl(),l=a||c,u=Tse(ck,n),d=u.currentTabStopId===l,f=ak(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return z.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(ik.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(ol.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:R(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:R(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:R(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=kse(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ase(n,r+1):n.slice(r+1)}setTimeout(()=>uk(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});lk.displayName=ck;var Dse={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ose(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function kse(e,t,n){let r=Ose(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Dse[r]}function uk(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ase(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var dk=sk,fk=lk,pk=[`Enter`,` `],jse=[`ArrowDown`,`PageUp`,`Home`],mk=[`ArrowUp`,`PageDown`,`End`],Mse=[...jse,...mk],Nse={ltr:[...pk,`ArrowRight`],rtl:[...pk,`ArrowLeft`]},Pse={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},hk=`Menu`,[gk,Fse,Ise]=OO(hk),[_k,vk]=Eu(hk,[Ise,Ah,ok]),yk=Ah(),bk=ok(),[xk,Sk]=_k(hk),[Ck,wk]=_k(hk),Tk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=yk(t),[c,l]=z.useState(null),u=z.useRef(!1),d=Rm(a),f=kO(i);return z.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,B.jsx)(jh,{...s,children:(0,B.jsx)(xk,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,B.jsx)(Ck,{scope:t,onClose:z.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Tk.displayName=hk;var Ek=`MenuAnchor`,Dk=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=yk(n);return(0,B.jsx)(Ph,{...i,...r,ref:t})});Dk.displayName=Ek;var Ok=`MenuPortal`,[kk,Ak]=_k(Ok,{forceMount:void 0}),jk=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Sk(Ok,t);return(0,B.jsx)(kk,{scope:t,forceMount:n,children:(0,B.jsx)(fu,{present:n||a.open,children:(0,B.jsx)(Cl,{asChild:!0,container:i,children:r})})})};jk.displayName=Ok;var Mk=`MenuContent`,[Nk,Pk]=_k(Mk),Fk=z.forwardRef((e,t)=>{let n=Ak(Mk,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Sk(Mk,e.__scopeMenu),o=wk(Mk,e.__scopeMenu);return(0,B.jsx)(gk.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(fu,{present:r||a.open,children:(0,B.jsx)(gk.Slot,{scope:e.__scopeMenu,children:o.modal?(0,B.jsx)(Ik,{...i,ref:t}):(0,B.jsx)(Lk,{...i,ref:t})})})})}),Ik=z.forwardRef((e,t)=>{let n=Sk(Mk,e.__scopeMenu),r=z.useRef(null),i=tt(t,r);return z.useEffect(()=>{let e=r.current;if(e)return Wc(e)},[]),(0,B.jsx)(zk,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Lk=z.forwardRef((e,t)=>{let n=Sk(Mk,e.__scopeMenu);return(0,B.jsx)(zk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Rk=we(`MenuContent.ScrollLock`),zk=z.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Sk(Mk,n),_=wk(Mk,n),v=yk(n),y=bk(n),b=Fse(n),[x,S]=z.useState(null),C=z.useRef(null),w=tt(t,C,g.onContentChange),T=z.useRef(0),E=z.useRef(``),D=z.useRef(0),O=z.useRef(null),k=z.useRef(`right`),A=z.useRef(0),ee=m?Wf:z.Fragment,j=m?{as:Rk,allowPinchZoom:!0}:void 0,M=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=CA(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};z.useEffect(()=>()=>window.clearTimeout(T.current),[]),rm();let te=z.useCallback(e=>k.current===O.current?.side&&TA(e,O.current?.area),[]);return(0,B.jsx)(Nk,{scope:n,searchRef:E,onItemEnter:z.useCallback(e=>{te(e)&&e.preventDefault()},[te]),onItemLeave:z.useCallback(e=>{te(e)||(C.current?.focus(),S(null))},[te]),onTriggerLeave:z.useCallback(e=>{te(e)&&e.preventDefault()},[te]),pointerGraceTimerRef:D,onPointerGraceIntentChange:z.useCallback(e=>{O.current=e},[]),children:(0,B.jsx)(ee,{...j,children:(0,B.jsx)(Yd,{asChild:!0,trapped:i,onMountAutoFocus:R(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,B.jsx)(Tm,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,B.jsx)(dk,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:R(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,B.jsx)(Nh,{role:`menu`,"aria-orientation":`vertical`,"data-state":vA(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:R(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&M(e.key));let i=C.current;if(e.target!==i||!Mse.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);mk.includes(e.key)&&a.reverse(),xA(a)}),onBlur:R(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:R(e.onPointerMove,EA(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});Fk.displayName=Mk;var Bk=`MenuGroup`,Vk=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(ol.div,{role:`group`,...r,ref:t})});Vk.displayName=Bk;var Hk=`MenuLabel`,Uk=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(ol.div,{...r,ref:t})});Uk.displayName=Hk;var Wk=`MenuItem`,Gk=`menu.itemSelect`,Kk=z.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=z.useRef(null),o=wk(Wk,e.__scopeMenu),s=Pk(Wk,e.__scopeMenu),c=tt(t,a),l=z.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Gk,{bubbles:!0,cancelable:!0});e.addEventListener(Gk,e=>r?.(e),{once:!0}),mee(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,B.jsx)(qk,{...i,ref:c,disabled:n,onClick:R(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:R(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:R(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||pk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Kk.displayName=Wk;var qk=z.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Pk(Wk,n),s=bk(n),c=z.useRef(null),l=tt(t,c),[u,d]=z.useState(!1),[f,p]=z.useState(``);return z.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,B.jsx)(gk.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,B.jsx)(fk,{asChild:!0,...s,focusable:!r,children:(0,B.jsx)(ol.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:R(e.onPointerMove,EA(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,EA(e=>o.onItemLeave(e))),onFocus:R(e.onFocus,()=>d(!0)),onBlur:R(e.onBlur,()=>d(!1))})})})}),Jk=`MenuCheckboxItem`,Yk=z.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,B.jsx)(rA,{scope:e.__scopeMenu,checked:n,children:(0,B.jsx)(Kk,{role:`menuitemcheckbox`,"aria-checked":yA(n)?`mixed`:n,...i,ref:t,"data-state":bA(n),onSelect:R(i.onSelect,()=>r?.(yA(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Yk.displayName=Jk;var Xk=`MenuRadioGroup`,[Zk,Qk]=_k(Xk,{value:void 0,onValueChange:()=>{}}),$k=z.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Rm(r);return(0,B.jsx)(Zk,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,B.jsx)(Vk,{...i,ref:t})})});$k.displayName=Xk;var eA=`MenuRadioItem`,tA=z.forwardRef((e,t)=>{let{value:n,...r}=e,i=Qk(eA,e.__scopeMenu),a=n===i.value;return(0,B.jsx)(rA,{scope:e.__scopeMenu,checked:a,children:(0,B.jsx)(Kk,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":bA(a),onSelect:R(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});tA.displayName=eA;var nA=`MenuItemIndicator`,[rA,iA]=_k(nA,{checked:!1}),aA=z.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=iA(nA,n);return(0,B.jsx)(fu,{present:r||yA(a.checked)||a.checked===!0,children:(0,B.jsx)(ol.span,{...i,ref:t,"data-state":bA(a.checked)})})});aA.displayName=nA;var oA=`MenuSeparator`,sA=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(ol.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});sA.displayName=oA;var cA=`MenuArrow`,lA=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=yk(n);return(0,B.jsx)(Mh,{...i,...r,ref:t})});lA.displayName=cA;var uA=`MenuSub`,[dA,fA]=_k(uA),pA=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Sk(uA,t),o=yk(t),[s,c]=z.useState(null),[l,u]=z.useState(null),d=Rm(i);return z.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,B.jsx)(jh,{...o,children:(0,B.jsx)(xk,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,B.jsx)(dA,{scope:t,contentId:Rl(),triggerId:Rl(),trigger:s,onTriggerChange:c,children:n})})})};pA.displayName=uA;var mA=`MenuSubTrigger`,hA=z.forwardRef((e,t)=>{let n=Sk(mA,e.__scopeMenu),r=wk(mA,e.__scopeMenu),i=fA(mA,e.__scopeMenu),a=Pk(mA,e.__scopeMenu),o=z.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=z.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return z.useEffect(()=>u,[u]),z.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,B.jsx)(Dk,{asChild:!0,...l,children:(0,B.jsx)(qk,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":vA(n.open),...e,ref:uo(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,EA(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:R(e.onPointerLeave,EA(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Nse[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});hA.displayName=mA;var gA=`MenuSubContent`,_A=z.forwardRef((e,t)=>{let n=Ak(Mk,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=Sk(Mk,e.__scopeMenu),s=wk(Mk,e.__scopeMenu),c=fA(gA,e.__scopeMenu),l=z.useRef(null),u=tt(t,l);return(0,B.jsx)(gk.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(fu,{present:r||o.open,children:(0,B.jsx)(gk.Slot,{scope:e.__scopeMenu,children:(0,B.jsx)(zk,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:R(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Pse[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});_A.displayName=gA;function vA(e){return e?`open`:`closed`}function yA(e){return e===`indeterminate`}function bA(e){return yA(e)?`indeterminate`:e?`checked`:`unchecked`}function xA(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function SA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function CA(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=SA(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function wA(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function TA(e,t){return t?wA({x:e.clientX,y:e.clientY},t):!1}function EA(e){return t=>t.pointerType===`mouse`?e(t):void 0}var DA=Tk,OA=Dk,kA=jk,AA=Fk,jA=Vk,MA=Uk,NA=Kk,PA=Yk,FA=$k,IA=tA,LA=aA,RA=sA,zA=lA,BA=hA,VA=_A,HA=`DropdownMenu`,[UA,WA]=Eu(HA,[vk]),GA=vk(),[KA,qA]=UA(HA),JA=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=GA(t),l=z.useRef(null),[u,d]=ap({prop:i,defaultProp:a??!1,onChange:o,caller:HA});return(0,B.jsx)(KA,{scope:t,triggerId:Rl(),triggerRef:l,contentId:Rl(),open:u,onOpenChange:d,onOpenToggle:z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,B.jsx)(DA,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};JA.displayName=HA;var YA=`DropdownMenuTrigger`,XA=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=qA(YA,n),o=GA(n);return(0,B.jsx)(OA,{asChild:!0,...o,children:(0,B.jsx)(ol.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:uo(t,a.triggerRef),onPointerDown:R(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:R(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});XA.displayName=YA;var ZA=`DropdownMenuPortal`,QA=e=>{let{__scopeDropdownMenu:t,...n}=e,r=GA(t);return(0,B.jsx)(kA,{...r,...n})};QA.displayName=ZA;var $A=`DropdownMenuContent`,ej=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qA($A,n),a=GA(n),o=z.useRef(!1);return(0,B.jsx)(AA,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:R(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});ej.displayName=$A;var tj=`DropdownMenuGroup`,nj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(jA,{...i,...r,ref:t})});nj.displayName=tj;var rj=`DropdownMenuLabel`,ij=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(MA,{...i,...r,ref:t})});ij.displayName=rj;var aj=`DropdownMenuItem`,oj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(NA,{...i,...r,ref:t})});oj.displayName=aj;var sj=`DropdownMenuCheckboxItem`,cj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(PA,{...i,...r,ref:t})});cj.displayName=sj;var lj=`DropdownMenuRadioGroup`,uj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(FA,{...i,...r,ref:t})});uj.displayName=lj;var dj=`DropdownMenuRadioItem`,fj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(IA,{...i,...r,ref:t})});fj.displayName=dj;var pj=`DropdownMenuItemIndicator`,mj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(LA,{...i,...r,ref:t})});mj.displayName=pj;var hj=`DropdownMenuSeparator`,gj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(RA,{...i,...r,ref:t})});gj.displayName=hj;var _j=`DropdownMenuArrow`,vj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(zA,{...i,...r,ref:t})});vj.displayName=_j;var yj=`DropdownMenuSubTrigger`,bj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(BA,{...i,...r,ref:t})});bj.displayName=yj;var xj=`DropdownMenuSubContent`,Sj=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GA(n);return(0,B.jsx)(VA,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Sj.displayName=xj;var Cj=JA,wj=XA,Tj=QA,Ej=ej,Dj=ij,Oj=oj,kj=uj,Aj=fj,jj=mj,Mj=gj;function Nj(e,[t,n]){return Math.min(n,Math.max(t,e))}var Pj=`Popover`,[Fj,Lse]=Eu(Pj,[Ah]),Ij=Ah(),[Lj,Rj]=Fj(Pj),zj=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Ij(t),c=z.useRef(null),[l,u]=z.useState(!1),[d,f]=ap({prop:r,defaultProp:i??!1,onChange:a,caller:Pj});return(0,B.jsx)(jh,{...s,children:(0,B.jsx)(Lj,{scope:t,contentId:Rl(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:z.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:z.useCallback(()=>u(!0),[]),onCustomAnchorRemove:z.useCallback(()=>u(!1),[]),modal:o,children:n})})};zj.displayName=Pj;var Bj=`PopoverAnchor`,Vj=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Rj(Bj,n),a=Ij(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return z.useEffect(()=>(o(),()=>s()),[o,s]),(0,B.jsx)(Ph,{...a,...r,ref:t})});Vj.displayName=Bj;var Hj=`PopoverTrigger`,Uj=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Rj(Hj,n),a=Ij(n),o=tt(t,i.triggerRef),s=(0,B.jsx)(ol.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":iM(i.open),...r,ref:o,onClick:R(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,B.jsx)(Ph,{asChild:!0,...a,children:s})});Uj.displayName=Hj;var Wj=`PopoverPortal`,[Gj,Kj]=Fj(Wj,{forceMount:void 0}),qj=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Rj(Wj,t);return(0,B.jsx)(Gj,{scope:t,forceMount:n,children:(0,B.jsx)(fu,{present:n||a.open,children:(0,B.jsx)(Cl,{asChild:!0,container:i,children:r})})})};qj.displayName=Wj;var Jj=`PopoverContent`,Yj=z.forwardRef((e,t)=>{let n=Kj(Jj,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Rj(Jj,e.__scopePopover);return(0,B.jsx)(fu,{present:r||a.open,children:a.modal?(0,B.jsx)(Zj,{...i,ref:t}):(0,B.jsx)(Qj,{...i,ref:t})})});Yj.displayName=Jj;var Xj=we(`PopoverContent.RemoveScroll`),Zj=z.forwardRef((e,t)=>{let n=Rj(Jj,e.__scopePopover),r=z.useRef(null),i=tt(t,r),a=z.useRef(!1);return z.useEffect(()=>{let e=r.current;if(e)return Wc(e)},[]),(0,B.jsx)(Wf,{as:Xj,allowPinchZoom:!0,children:(0,B.jsx)($j,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:R(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Qj=z.forwardRef((e,t)=>{let n=Rj(Jj,e.__scopePopover),r=z.useRef(!1),i=z.useRef(!1);return(0,B.jsx)($j,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),$j=z.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Rj(Jj,n),p=Ij(n);return rm(),(0,B.jsx)(Yd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(Tm,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,B.jsx)(Nh,{"data-state":iM(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),eM=`PopoverClose`,tM=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Rj(eM,n);return(0,B.jsx)(ol.button,{type:`button`,...r,ref:t,onClick:R(e.onClick,()=>i.onOpenChange(!1))})});tM.displayName=eM;var nM=`PopoverArrow`,rM=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ij(n);return(0,B.jsx)(Mh,{...i,...r,ref:t})});rM.displayName=nM;function iM(e){return e?`open`:`closed`}var aM=zj,oM=Uj,sM=qj,cM=Yj,lM=[` `,`Enter`,`ArrowUp`,`ArrowDown`],uM=[` `,`Enter`],dM=`Select`,[fM,pM,mM]=OO(dM),[hM,Rse]=Eu(dM,[mM,Ah]),gM=Ah(),[_M,vM]=hM(dM),[yM,bM]=hM(dM),xM=`SelectProvider`;function SM(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=gM(t),[_,v]=z.useState(null),[y,b]=z.useState(null),[x,S]=z.useState(!1),C=kO(l),[w,T]=ap({prop:r,defaultProp:i??!1,onChange:a,caller:dM}),[E,D]=ap({prop:o,defaultProp:s,onChange:c,caller:dM}),O=z.useRef(null),k=_?!!m||!!_.closest(`form`):!0,[A,ee]=z.useState(new Set),j=Rl(),M=Array.from(A).map(e=>e.props.value).join(`;`),te=z.useCallback(e=>{ee(t=>new Set(t).add(e))},[]),N=z.useCallback(e=>{ee(t=>{let n=new Set(t);return n.delete(e),n})},[]),P={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:j,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:A,nativeSelectKey:M,isFormControl:k};return(0,B.jsx)(jh,{...g,children:(0,B.jsx)(_M,{scope:t,...P,children:(0,B.jsx)(fM.Provider,{scope:t,children:(0,B.jsx)(yM,{scope:t,onNativeOptionAdd:te,onNativeOptionRemove:N,children:Gse(h)?h(P):n})})})})}SM.displayName=xM;var CM=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,B.jsx)(SM,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[n,e?(0,B.jsx)(hN,{__scopeSelect:t}):null]})})};CM.displayName=dM;var wM=`SelectTrigger`,TM=z.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=gM(n),o=vM(wM,n),s=o.disabled||r,c=tt(t,o.onTriggerChange),l=pM(n),u=z.useRef(`touch`),[d,f,p]=_N(e=>{let t=l().filter(e=>!e.disabled),n=vN(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,B.jsx)(Ph,{asChild:!0,...a,children:(0,B.jsx)(ol.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":gN(o.value)?``:void 0,...i,ref:c,onClick:R(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:R(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:R(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&lM.includes(e.key)&&(m(),e.preventDefault())})})})});TM.displayName=wM;var EM=`SelectValue`,DM=z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=vM(EM,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=tt(t,c.onValueNodeChange);uf(()=>{l(u)},[l,u]);let f=gN(c.value);return(0,B.jsx)(ol.span,{...s,asChild:f?!1:s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,B.jsx)(z.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});DM.displayName=EM;var OM=`SelectIcon`,kM=z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(ol.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});kM.displayName=OM;var AM=`SelectPortal`,[jM,MM]=hM(AM,{forceMount:void 0}),NM=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,B.jsx)(jM,{scope:e.__scopeSelect,forceMount:n,children:(0,B.jsx)(Cl,{asChild:!0,...r})})};NM.displayName=AM;var PM=`SelectContent`,FM=z.forwardRef((e,t)=>{let n=MM(PM,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=vM(PM,e.__scopeSelect),[o,s]=z.useState();return uf(()=>{s(new DocumentFragment)},[]),(0,B.jsx)(fu,{present:r||a.open,children:({present:e})=>e?(0,B.jsx)(HM,{...i,ref:t}):(0,B.jsx)(IM,{...i,fragment:o})})});FM.displayName=PM;var IM=z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Fv.createPortal((0,B.jsx)(RM,{scope:n,children:(0,B.jsx)(fM.Slot,{scope:n,children:(0,B.jsx)(`div`,{ref:t,children:r})})}),i):null});IM.displayName=`SelectContentFragment`;var LM=10,[RM,zM]=hM(PM),BM=`SelectContentImpl`,VM=we(`SelectContent.RemoveScroll`),HM=z.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=vM(PM,n),[y,b]=z.useState(null),[x,S]=z.useState(null),C=tt(t,e=>b(e)),[w,T]=z.useState(null),[E,D]=z.useState(null),O=pM(n),[k,A]=z.useState(!1),ee=z.useRef(!1);z.useEffect(()=>{if(y)return Wc(y)},[y]),rm();let j=z.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),M=z.useCallback(()=>j([w,y]),[j,w,y]);z.useEffect(()=>{k&&M()},[k,M]);let{onOpenChange:te,triggerPointerDownPosRef:N}=v;z.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||te(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,te,N]),z.useEffect(()=>{let e=()=>te(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[te]);let[P,ne]=_N(e=>{let t=O().filter(e=>!e.disabled),n=vN(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),re=z.useCallback((e,t,n)=>{let r=!ee.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(ee.current=!0))},[v.value]),ie=z.useCallback(()=>y?.focus(),[y]),ae=z.useCallback((e,t,n)=>{let r=!ee.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),oe=r===`popper`?KM:WM,se=oe===KM?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,B.jsx)(RM,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:re,selectedItem:w,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:M,selectedItemText:E,position:r,isPositioned:k,searchRef:P,children:(0,B.jsx)(Wf,{as:VM,allowPinchZoom:!0,children:(0,B.jsx)(Yd,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:R(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(Tm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,B.jsx)(oe,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:R(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>j(t)),e.preventDefault()}})})})})})})});HM.displayName=BM;var UM=`SelectItemAlignedPosition`,WM=z.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=vM(PM,n),o=zM(PM,n),[s,c]=z.useState(null),[l,u]=z.useState(null),d=tt(t,e=>u(e)),f=pM(n),p=z.useRef(!1),m=z.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=z.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-LM,d=Nj(a,[LM,Math.max(LM,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-LM,d=Nj(a,[LM,Math.max(LM,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-LM*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-LM,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,ee=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ee;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${LM}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);uf(()=>y(),[y]);let[b,x]=z.useState();return uf(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,B.jsx)(qM,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:z.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,B.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,B.jsx)(ol.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});WM.displayName=UM;var GM=`SelectPopperPosition`,KM=z.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=LM,...a}=e,o=gM(n);return(0,B.jsx)(Nh,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});KM.displayName=GM;var[qM,JM]=hM(PM,{}),YM=`SelectViewport`,XM=z.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=zM(YM,n),o=JM(YM,n),s=tt(t,a.onViewportChange),c=z.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,B.jsx)(fM.Slot,{scope:n,children:(0,B.jsx)(ol.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:R(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-LM*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});XM.displayName=YM;var ZM=`SelectGroup`,[QM,$M]=hM(ZM),zse=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Rl();return(0,B.jsx)(QM,{scope:n,id:i,children:(0,B.jsx)(ol.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});zse.displayName=ZM;var eN=`SelectLabel`,Bse=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$M(eN,n);return(0,B.jsx)(ol.div,{id:i.id,...r,ref:t})});Bse.displayName=eN;var tN=`SelectItem`,[Vse,nN]=hM(tN),rN=z.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=vM(tN,n),c=zM(tN,n),l=s.value===r,[u,d]=z.useState(a??``),[f,p]=z.useState(!1),m=tt(t,e=>c.itemRefCallback?.(e,r,i)),h=Rl(),g=z.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,B.jsx)(Vse,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:z.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(fM.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,B.jsx)(ol.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:R(o.onFocus,()=>p(!0)),onBlur:R(o.onBlur,()=>p(!1)),onClick:R(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:R(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:R(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:R(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:R(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(uM.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});rN.displayName=tN;var iN=`SelectItemText`,aN=z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=vM(iN,n),s=zM(iN,n),c=nN(iN,n),l=bM(iN,n),[u,d]=z.useState(null),f=tt(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=z.useMemo(()=>(0,B.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return uf(()=>(h(m),()=>g(m)),[h,g,m]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ol.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Fv.createPortal(a.children,o.valueNode):null]})});aN.displayName=iN;var oN=`SelectItemIndicator`,sN=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return nN(oN,n).isSelected?(0,B.jsx)(ol.span,{"aria-hidden":!0,...r,ref:t}):null});sN.displayName=oN;var cN=`SelectScrollUpButton`,lN=z.forwardRef((e,t)=>{let n=zM(cN,e.__scopeSelect),r=JM(cN,e.__scopeSelect),[i,a]=z.useState(!1),o=tt(t,r.onScrollButtonChange);return uf(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(fN,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});lN.displayName=cN;var uN=`SelectScrollDownButton`,dN=z.forwardRef((e,t)=>{let n=zM(uN,e.__scopeSelect),r=JM(uN,e.__scopeSelect),[i,a]=z.useState(!1),o=tt(t,r.onScrollButtonChange);return uf(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(fN,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});dN.displayName=uN;var fN=z.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=zM(`SelectScrollButton`,n),o=z.useRef(null),s=pM(n),c=z.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return z.useEffect(()=>()=>c(),[c]),uf(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,B.jsx)(ol.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:R(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:R(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:R(i.onPointerLeave,()=>{c()})})}),Hse=`SelectSeparator`,Use=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(ol.div,{"aria-hidden":!0,...r,ref:t})});Use.displayName=Hse;var pN=`SelectArrow`,Wse=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=gM(n);return zM(pN,n).position===`popper`?(0,B.jsx)(Mh,{...i,...r,ref:t}):null});Wse.displayName=pN;var mN=`SelectBubbleInput`,hN=z.forwardRef(({__scopeSelect:e,...t},n)=>{let r=vM(mN,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=z.useRef(null),m=tt(n,p),h=i??``,g=WO(h);return z.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,B.jsxs)(ol.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...EO,...t.style},ref:m,defaultValue:h,children:[gN(i)?(0,B.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});hN.displayName=mN;function Gse(e){return typeof e==`function`}function gN(e){return e===``||e===void 0}function _N(e){let t=Rm(e),n=z.useRef(``),r=z.useRef(0),i=z.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=z.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return z.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function vN(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Kse(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Kse(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var[yN,qse]=Eu(`Tooltip`,[Ah]),bN=Ah(),xN=`TooltipProvider`,Jse=700,SN=`tooltip.open`,[Yse,CN]=yN(xN),wN=e=>{let{__scopeTooltip:t,delayDuration:n=Jse,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=z.useRef(!0),s=z.useRef(!1),c=z.useRef(0);return z.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(Yse,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:z.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};wN.displayName=xN;var TN=`Tooltip`,[Xse,EN]=yN(TN),DN=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=CN(TN,e.__scopeTooltip),l=bN(t),[u,d]=z.useState(null),f=Rl(),p=z.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=z.useRef(!1),[_,v]=ap({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(SN))):c.onClose(),a?.(e)},caller:TN}),y=z.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=z.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return z.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(jh,{...l,children:(0,B.jsx)(Xse,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:z.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:z.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};DN.displayName=TN;var ON=`TooltipTrigger`,kN=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=EN(ON,n),a=CN(ON,n),o=bN(n),s=tt(t,z.useRef(null),i.onTriggerChange),c=z.useRef(!1),l=z.useRef(!1),u=z.useCallback(()=>c.current=!1,[]);return z.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(Ph,{asChild:!0,...o,children:(0,B.jsx)(ol.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:R(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:R(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:R(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:R(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:R(e.onBlur,i.onClose),onClick:R(e.onClick,i.onClose)})})});kN.displayName=ON;var AN=`TooltipPortal`,[Zse,Qse]=yN(AN,{forceMount:void 0}),jN=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=EN(AN,t);return(0,B.jsx)(Zse,{scope:t,forceMount:n,children:(0,B.jsx)(fu,{present:n||a.open,children:(0,B.jsx)(Cl,{asChild:!0,container:i,children:r})})})};jN.displayName=AN;var MN=`TooltipContent`,NN=z.forwardRef((e,t)=>{let n=Qse(MN,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=EN(MN,e.__scopeTooltip);return(0,B.jsx)(fu,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(PN,{side:i,...a,ref:t}):(0,B.jsx)($se,{side:i,...a,ref:t})})}),$se=z.forwardRef((e,t)=>{let n=EN(MN,e.__scopeTooltip),r=CN(MN,e.__scopeTooltip),i=z.useRef(null),a=tt(t,i),[o,s]=z.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=z.useCallback(()=>{s(null),d(!1)},[d]),p=z.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=ice(r,rce(r,n.getBoundingClientRect())),a=ace(t.getBoundingClientRect());s(sce([...i,...a])),d(!0)},[d]);return z.useEffect(()=>()=>f(),[f]),z.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),z.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!oce(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(PN,{...e,ref:a})}),[ece,tce]=yN(TN,{isInside:!1}),nce=$m(`TooltipContent`),PN=z.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=EN(MN,n),l=bN(n),{onClose:u}=c;return z.useEffect(()=>(document.addEventListener(SN,u),()=>document.removeEventListener(SN,u)),[u]),z.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(Tm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Nh,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(nce,{children:r}),(0,B.jsx)(ece,{scope:n,isInside:!0,children:(0,B.jsx)(Yoe,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});NN.displayName=MN;var FN=`TooltipArrow`,IN=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=bN(n);return tce(FN,n).isInside?null:(0,B.jsx)(Mh,{...i,...r,ref:t})});IN.displayName=FN;function rce(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function ice(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ace(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function oce(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function sce(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),cce(t)}function cce(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var lce=wN,uce=DN,dce=kN,fce=jN,pce=NN,mce=IN,LN=WA(),RN=e=>{let t=V(25),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({__scopeActionBarMore:n,open:i,onOpenChange:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=LN(n),s=joe(),c=BS(null),l=i!==void 0,u;t[5]===s?u=t[6]:(u=e=>{if(e){if(c.current)return;c.current=s?.acquireInteractionLock()??null;return}c.current?.(),c.current=null},t[5]=s,t[6]=u);let d=u,f;t[7]!==l||t[8]!==r||t[9]!==d?(f=e=>{l||d(e),r?.(e)},t[7]=l,t[8]=r,t[9]=d,t[10]=f):f=t[10];let p=f,m,h;t[11]!==l||t[12]!==i||t[13]!==d?(m=()=>{l&&d(!!i)},h=[l,i,d],t[11]=l,t[12]=i,t[13]=d,t[14]=m,t[15]=h):(m=t[14],h=t[15]),US(m,h);let g,_;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>()=>{c.current?.(),c.current=null},_=[],t[16]=g,t[17]=_):(g=t[16],_=t[17]),US(g,_);let v;t[18]===i?v=t[19]:(v=i===void 0?null:{open:i},t[18]=i,t[19]=v);let y;return t[20]!==p||t[21]!==a||t[22]!==o||t[23]!==v?(y=(0,B.jsx)(Cj,{...o,...a,...v,onOpenChange:p}),t[20]=p,t[21]=a,t[22]=o,t[23]=v,t[24]=y):y=t[24],y};RN.displayName=`ActionBarMorePrimitive.Root`;var hce=hO(wj),gce=hO(Ej),_ce=hO(Oj),vce=hO(Mj),zN=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({__scopeActionBarMore:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=LN(r),o;return n[3]!==t||n[4]!==i||n[5]!==a?(o=(0,B.jsx)(hce,{...a,...i,ref:t}),n[3]=t,n[4]=i,n[5]=a,n[6]=o):o=n[6],o});zN.displayName=`ActionBarMorePrimitive.Trigger`;var BN=(0,FS.forwardRef)((e,t)=>{let n=V(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({__scopeActionBarMore:r,portalProps:i,sideOffset:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?4:o,c=LN(r),l;n[5]!==t||n[6]!==a||n[7]!==c||n[8]!==s?(l=(0,B.jsx)(gce,{...c,...a,ref:t,sideOffset:s}),n[5]=t,n[6]=a,n[7]=c,n[8]=s,n[9]=l):l=n[9];let u;return n[10]!==i||n[11]!==c||n[12]!==l?(u=(0,B.jsx)(Tj,{...c,...i,children:l}),n[10]=i,n[11]=c,n[12]=l,n[13]=u):u=n[13],u});BN.displayName=`ActionBarMorePrimitive.Content`;var VN=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({__scopeActionBarMore:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=LN(r),o;return n[3]!==t||n[4]!==i||n[5]!==a?(o=(0,B.jsx)(_ce,{...a,...i,ref:t}),n[3]=t,n[4]=i,n[5]=a,n[6]=o):o=n[6],o});VN.displayName=`ActionBarMorePrimitive.Item`;var HN=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({__scopeActionBarMore:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=LN(r),o;return n[3]!==t||n[4]!==i||n[5]!==a?(o=(0,B.jsx)(vce,{...a,...i,ref:t}),n[3]=t,n[4]=i,n[5]=a,n[6]=o):o=n[6],o});HN.displayName=`ActionBarMorePrimitive.Separator`;var UN=mO({Content:()=>BN,Item:()=>VN,Root:()=>RN,Separator:()=>HN,Trigger:()=>zN}),WN=(0,FS.forwardRef)((e,t)=>{let n=V(3),r;return n[0]!==e||n[1]!==t?(r=(0,B.jsx)(gO.div,{...e,ref:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});WN.displayName=`AttachmentPrimitive.Root`;var GN=(0,FS.forwardRef)((e,t)=>{let n=V(4),r=H(yce),i;return n[0]!==r||n[1]!==e||n[2]!==t?(i=(0,B.jsxs)(gO.div,{...e,ref:t,children:[`.`,r]}),n[0]=r,n[1]=e,n[2]=t,n[3]=i):i=n[3],i});GN.displayName=`AttachmentPrimitive.unstable_Thumb`;function yce(e){let t=e.attachment.name.split(`.`);return t.length>1?t.pop():``}var KN=()=>{let e=V(2),t=H(bce),n;return e[0]===t?n=e[1]:(n=(0,B.jsx)(B.Fragment,{children:t}),e[0]=t,e[1]=n),n};KN.displayName=`AttachmentPrimitive.Name`;function bce(e){return e.attachment.name}var xce=bO(`AttachmentPrimitive.Remove`,()=>{let e=V(2),t=ZC(),n;return e[0]===t?n=e[1]:(n=()=>{t.attachment().remove()},e[0]=t,e[1]=n),n}),qN=mO({Name:()=>KN,Remove:()=>xce,Root:()=>WN,unstable_Thumb:()=>GN}),Sce=e=>{let t=V(12),n;return t[0]!==e.assistant||t[1]!==e.copied||t[2]!==e.hasAttachments||t[3]!==e.hasBranches||t[4]!==e.hasContent||t[5]!==e.last||t[6]!==e.lastOrHover||t[7]!==e.speaking||t[8]!==e.submittedFeedback||t[9]!==e.system||t[10]!==e.user?(n=t=>{let{role:n,attachments:r,parts:i,branchCount:a,isLast:o,speech:s,isCopied:c,isHovering:l}=t.message;return!(e.hasBranches===!0&&a<2||e.user&&n!==`user`||e.assistant&&n!==`assistant`||e.system&&n!==`system`||e.lastOrHover===!0&&!l&&!o||e.last!==void 0&&e.last!==o||e.copied===!0&&!c||e.copied===!1&&c||e.speaking===!0&&s==null||e.speaking===!1&&s!=null||e.hasAttachments===!0&&(n!==`user`||!r?.length)||e.hasAttachments===!1&&n===`user`&&r?.length||e.hasContent===!0&&i.length===0||e.hasContent===!1&&i.length>0||e.submittedFeedback!==void 0&&(t.message.metadata.submittedFeedback?.type??null)!==e.submittedFeedback)},t[0]=e.assistant,t[1]=e.copied,t[2]=e.hasAttachments,t[3]=e.hasBranches,t[4]=e.hasContent,t[5]=e.last,t[6]=e.lastOrHover,t[7]=e.speaking,t[8]=e.submittedFeedback,t[9]=e.system,t[10]=e.user,t[11]=n):n=t[11],H(n)},JN=e=>{let t=V(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),Sce(r)?n:null};JN.displayName=`MessagePrimitive.If`;var YN=JS(null),XN=()=>XS(YN),Cce=e=>{let t=V(8),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Map,t[0]=r):r=t[0];let i=BS(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[1]=a):a=t[1];let o=BS(a),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=Array.from(i.current.entries());e.sort(wce),o.current=e.map(Tce)},t[2]=s):s=t[2];let c=s,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(e,t)=>{let n=t?.priority??0;return i.current.set(e,n),c(),()=>{i.current.delete(e),c()}},t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o.current,t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p={register:u,getPlugins:f},t[5]=p):p=t[5];let m=p,h;return t[6]===n?h=t[7]:(h=(0,B.jsx)(YN.Provider,{value:m,children:n}),t[6]=n,t[7]=h),h};function wce(e,t){return t[1]-e[1]}function Tce(e){let[t]=e;return t}var ZN=JS(null),QN=JS(null),$N=()=>{let e=XS(ZN);if(!e)throw Error(`useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot`);return e},eP=()=>XS(ZN),Ece=()=>{let e=XS(QN);if(!e)throw Error(`useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot`);return e},Dce=()=>{let e=$N();return KS(e.subscribe,e.getTriggers,e.getTriggers)},Oce=new Map,tP=()=>()=>{},nP=()=>Oce,kce=()=>{let e=eP();return KS(e?e.subscribe:tP,e?e.getTriggers:nP,e?e.getTriggers:nP)},rP=()=>null,Ace=()=>{let e=eP();return KS(e?e.subscribeAria:tP,e?e.getActiveAria:rP,e?e.getActiveAria:rP)};function iP(){let e=V(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=new Set,e[0]=t):t=e[0];let n=BS(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{for(let e of n.current)e()},e[1]=r):r=e[1];let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>(n.current.add(e),()=>{n.current.delete(e)}),e[2]=a):a=e[2];let o=a,s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s={notify:i,subscribe:o},e[3]=s):s=e[3],s}var aP=e=>{let t=V(21),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Map,t[0]=r):r=t[0];let i=BS(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=new Set,t[1]=a):a=t[1];let o=BS(a),{notify:s,subscribe:c}=iP(),l;t[2]===s?l=t[3]:(l=e=>{let{char:t}=e;if(i.current.has(t))return jce;let n=new Map(i.current);n.set(t,e),i.current=n,s();for(let t of o.current)t.added(e);return()=>{let e=new Map(i.current);e.delete(t),i.current=e,s();for(let e of o.current)e.removed(t)}},t[2]=s,t[3]=l);let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>i.current,t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>(o.current.add(e),()=>{o.current.delete(e)}),t[5]=p):p=t[5];let m=p,h=BS(null),g=BS(null),{notify:_,subscribe:v}=iP(),y;t[6]===_?y=t[7]:(y=(e,t)=>{if(t===null){if(g.current!==e)return;h.current=null,g.current=null,_();return}let n=h.current;g.current===e&&n!==null&&n.popoverId===t.popoverId&&n.highlightedItemId===t.highlightedItemId||(h.current=t,g.current=e,_())},t[6]=_,t[7]=y);let b=y,x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>h.current,t[8]=x):x=t[8];let S=x,C;t[9]!==u||t[10]!==c||t[11]!==v?(C={register:u,getTriggers:f,subscribe:c,subscribeLifecycle:m,getActiveAria:S,subscribeAria:v},t[9]=u,t[10]=c,t[11]=v,t[12]=C):C=t[12];let w=C,T;t[13]===b?T=t[14]:(T={setActiveAria:b},t[13]=b,t[14]=T);let E=T,D;t[15]!==E||t[16]!==n?(D=(0,B.jsx)(QN.Provider,{value:E,children:n}),t[15]=E,t[16]=n,t[17]=D):D=t[17];let O;return t[18]!==D||t[19]!==w?(O=(0,B.jsx)(ZN.Provider,{value:w,children:D}),t[18]=D,t[19]=w,t[20]=O):O=t[20],O},oP=e=>{let t=V(4),{children:n}=e;if(XN()){let e;return t[0]===n?e=t[1]:(e=(0,B.jsx)(aP,{children:n}),t[0]=n,t[1]=e),e}let r;return t[2]===n?r=t[3]:(r=(0,B.jsx)(Cce,{children:(0,B.jsx)(aP,{children:n})}),t[2]=n,t[3]=r),r};oP.displayName=`ComposerPrimitive.TriggerPopoverRoot`;function jce(){}var sP=/\s/u;function Mce(e,t,n){let r=e.slice(0,n);for(let e=r.length-1;e>=0;e--){let n=r[e];if(sP.test(n))return null;if(r.startsWith(t,e)){if(e>0&&!sP.test(r[e-1]))continue;return{query:r.slice(e+t.length),offset:e}}}return null}var Nce=eC(e=>{let t=V(7),{text:n,triggerChar:r}=e,[i,a]=RS(n.length),o=Math.min(i,n.length),s;t[0]!==o||t[1]!==n||t[2]!==r?(s=Mce(n,r,o),t[0]=o,t[1]=n,t[2]=r,t[3]=s):s=t[3];let c=s,l=c?.query??``,u;return t[4]!==l||t[5]!==c?(u={trigger:c,query:l,setCursorPosition:a},t[4]=l,t[5]=c,t[6]=u):u=t[6],u});function Pce(e){return`type`in e}var Fce=eC(e=>{let t=V(25),{navigableList:n,isSearchMode:r,activeCategoryId:i,query:a,popoverId:o,open:s,selectItem:c,selectCategory:l,goBack:u,close:d}=e,[f,p]=RS(0),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{p(0)},t[0]=m):m=t[0];let h;t[1]===n?h=t[2]:(h=[n],t[1]=n,t[2]=h),US(m,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{p(0)},t[3]=g):g=t[3];let _;t[4]!==i||t[5]!==r?(_=[r,i],t[4]=i,t[5]=r,t[6]=_):_=t[6],US(g,_);let v;t[7]!==f||t[8]!==n.length?(v=e=>{e<0||e>=n.length||e!==f&&p(e)},t[7]=f,t[8]=n.length,t[9]=v):v=t[9];let y=GS(v),b;t[10]!==i||t[11]!==d||t[12]!==u||t[13]!==f||t[14]!==n||t[15]!==s||t[16]!==a||t[17]!==l||t[18]!==c?(b=e=>{if(!s)return!1;switch(e.key){case`ArrowDown`:return e.preventDefault(),p(e=>{let t=n.length;return t===0?0:e<t-1?e+1:0}),!0;case`ArrowUp`:return e.preventDefault(),p(e=>{let t=n.length;return t===0?0:e>0?e-1:t-1}),!0;case`Enter`:case`Tab`:{if(e.shiftKey)return!1;e.preventDefault();let t=n[f];return t&&(Pce(t)?c(t):l(t.id)),!0}case`Escape`:return e.preventDefault(),d(),!0;case`Backspace`:return i&&a===``?(e.preventDefault(),u(),!0):!1;default:return!1}},t[10]=i,t[11]=d,t[12]=u,t[13]=f,t[14]=n,t[15]=s,t[16]=a,t[17]=l,t[18]=c,t[19]=b):b=t[19];let x=GS(b),S=n[f],C=s&&S?`${o}-option-${S.id}`:void 0,w;return t[20]!==x||t[21]!==y||t[22]!==f||t[23]!==C?(w={highlightedIndex:f,highlightedItemId:C,highlightIndex:y,handleKeyDown:x},t[20]=x,t[21]=y,t[22]=f,t[23]=C,t[24]=w):w=t[24],w});function cP(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}var Ice=eC(e=>{let t=V(38),{adapter:n,query:r,open:i}=e,[a,o]=RS(null),s,c;t[0]===i?(s=t[1],c=t[2]):(s=()=>{i||o(null)},c=[i],t[0]=i,t[1]=s,t[2]=c),US(s,c);let l;bb0:{if(!i||!n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[3]=e):e=t[3],l=e;break bb0}let e;t[4]===n?e=t[5]:(e=n.categories(),t[4]=n,t[5]=e),l=e}let u=l,d=i?a:null,f;bb1:{if(!d||!n){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[6]=e):e=t[6],f=e;break bb1}let e;t[7]!==n||t[8]!==d?(e=n.categoryItems(d),t[7]=n,t[8]=d,t[9]=e):e=t[9],f=e}let p=f,m;bb2:{if(!i||!n||d){m=null;break bb2}if(!r&&u.length>0){m=null;break bb2}if(n.search){let e;t[10]!==n||t[11]!==r?(e=n.search(r),t[10]=n,t[11]=r,t[12]=e):e=t[12],m=e;break bb2}let e;if(t[13]!==n||t[14]!==u||t[15]!==r){e=[];let i=r.toLowerCase();for(let t of u)for(let r of n.categoryItems(t.id))cP(r,i)&&e.push(r);t[13]=n,t[14]=u,t[15]=r,t[16]=e}else e=t[16];m=e}let h=m,g=h!==null,_;bb3:{if(g){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[17]=e):e=t[17],_=e;break bb3}if(!r){_=u;break bb3}let e;if(t[18]!==u||t[19]!==r){let n=r.toLowerCase();e=u.filter(e=>e.label.toLowerCase().includes(n)),t[18]=u,t[19]=r,t[20]=e}else e=t[20];_=e}let v=_,y;bb4:{if(g){let e;t[21]===h?e=t[22]:(e=h??[],t[21]=h,t[22]=e),y=e;break bb4}if(!r){y=p;break bb4}let e;if(t[23]!==p||t[24]!==r){let n=r.toLowerCase();e=p.filter(e=>cP(e,n)),t[23]=p,t[24]=r,t[25]=e}else e=t[25];y=e}let b=y,x;bb5:{if(g){let e;t[26]===h?e=t[27]:(e=h??[],t[26]=h,t[27]=e),x=e;break bb5}if(d){x=b;break bb5}x=v}let S=x,C;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{o(e)},t[28]=C):C=t[28];let w=GS(C),T;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{o(null)},t[29]=T):T=t[29];let E=GS(T),D;return t[30]!==d||t[31]!==v||t[32]!==b||t[33]!==E||t[34]!==g||t[35]!==S||t[36]!==w?(D={categories:v,items:b,isSearchMode:g,activeCategoryId:d,navigableList:S,selectCategory:w,goBack:E},t[30]=d,t[31]=v,t[32]=b,t[33]=E,t[34]=g,t[35]=S,t[36]=w,t[37]=D):D=t[37],D}),Lce=eC(e=>{let t=V(15),{behavior:n,trigger:r,aui:i,triggerChar:a,setCursorPosition:o,onSelected:s}=e,c=BS(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>(c.current=e,()=>{c.current===e&&(c.current=null)}),t[0]=l):l=t[0];let u=GS(l),d;t[1]!==i||t[2]!==n||t[3]!==s||t[4]!==r||t[5]!==a?(d=e=>{if(!r||!n)return;if(c.current?.(e)){s();return}let t=i.composer().getState().text,o=t.slice(0,r.offset),l=t.slice(r.offset+a.length+r.query.length),u=()=>{let t=n.formatter.serialize(e);i.composer().setText(o+t+(l.startsWith(` `)?l:` ${l}`))};n.kind===`directive`?(u(),n.onInserted?.(e)):(n.removeOnExecute?i.composer().setText(o+(l.startsWith(` `)?l.slice(1):l)):u(),n.onExecute(e)),s()},t[1]=i,t[2]=n,t[3]=s,t[4]=r,t[5]=a,t[6]=d):d=t[6];let f=GS(d),p;t[7]!==s||t[8]!==o||t[9]!==r?(p=()=>{s(),r&&o(r.offset)},t[7]=s,t[8]=o,t[9]=r,t[10]=p):p=t[10];let m=GS(p),h;return t[11]!==m||t[12]!==u||t[13]!==f?(h={selectItem:f,close:m,registerSelectItemOverride:u},t[11]=m,t[12]=u,t[13]=f,t[14]=h):h=t[14],h}),Rce=eC(e=>{let t=V(46),{adapter:n,text:r,triggerChar:i,behavior:a,aui:o,popoverId:s,isLoading:c}=e,l;t[0]!==r||t[1]!==i?(l=Nce({text:r,triggerChar:i}),t[0]=r,t[1]=i,t[2]=l):l=t[2];let u=gC(l),d=u.trigger!==null&&n!==void 0&&a!==void 0,f;t[3]!==n||t[4]!==u.query||t[5]!==d?(f=Ice({adapter:n,query:u.query,open:d}),t[3]=n,t[4]=u.query,t[5]=d,t[6]=f):f=t[6];let p=gC(f),m;t[7]===p?m=t[8]:(m=()=>{p.goBack()},t[7]=p,t[8]=m);let h=GS(m),g;t[9]!==o||t[10]!==a||t[11]!==u.setCursorPosition||t[12]!==u.trigger||t[13]!==h||t[14]!==i?(g=Lce({behavior:a,trigger:u.trigger,aui:o,triggerChar:i,setCursorPosition:u.setCursorPosition,onSelected:h}),t[9]=o,t[10]=a,t[11]=u.setCursorPosition,t[12]=u.trigger,t[13]=h,t[14]=i,t[15]=g):g=t[15];let _=gC(g),v;t[16]!==u.query||t[17]!==p.activeCategoryId||t[18]!==p.goBack||t[19]!==p.isSearchMode||t[20]!==p.navigableList||t[21]!==p.selectCategory||t[22]!==d||t[23]!==s||t[24]!==_.close||t[25]!==_.selectItem?(v=Fce({navigableList:p.navigableList,isSearchMode:p.isSearchMode,activeCategoryId:p.activeCategoryId,query:u.query,popoverId:s,open:d,selectItem:_.selectItem,selectCategory:p.selectCategory,goBack:p.goBack,close:_.close}),t[16]=u.query,t[17]=p.activeCategoryId,t[18]=p.goBack,t[19]=p.isSearchMode,t[20]=p.navigableList,t[21]=p.selectCategory,t[22]=d,t[23]=s,t[24]=_.close,t[25]=_.selectItem,t[26]=v):v=t[26];let y=gC(v),b;return t[27]!==u.query||t[28]!==u.setCursorPosition||t[29]!==c||t[30]!==y.handleKeyDown||t[31]!==y.highlightIndex||t[32]!==y.highlightedIndex||t[33]!==y.highlightedItemId||t[34]!==p.activeCategoryId||t[35]!==p.categories||t[36]!==p.goBack||t[37]!==p.isSearchMode||t[38]!==p.items||t[39]!==p.selectCategory||t[40]!==d||t[41]!==s||t[42]!==_.close||t[43]!==_.registerSelectItemOverride||t[44]!==_.selectItem?(b={open:d,query:u.query,activeCategoryId:p.activeCategoryId,categories:p.categories,items:p.items,highlightedIndex:y.highlightedIndex,isSearchMode:p.isSearchMode,isLoading:c,popoverId:s,highlightedItemId:y.highlightedItemId,selectCategory:p.selectCategory,goBack:p.goBack,selectItem:_.selectItem,close:_.close,highlightIndex:y.highlightIndex,handleKeyDown:y.handleKeyDown,setCursorPosition:u.setCursorPosition,registerSelectItemOverride:_.registerSelectItemOverride},t[27]=u.query,t[28]=u.setCursorPosition,t[29]=c,t[30]=y.handleKeyDown,t[31]=y.highlightIndex,t[32]=y.highlightedIndex,t[33]=y.highlightedItemId,t[34]=p.activeCategoryId,t[35]=p.categories,t[36]=p.goBack,t[37]=p.isSearchMode,t[38]=p.items,t[39]=p.selectCategory,t[40]=d,t[41]=s,t[42]=_.close,t[43]=_.registerSelectItemOverride,t[44]=_.selectItem,t[45]=b):b=t[45],b}),lP=JS(null),uP=()=>{let e=XS(lP);if(!e)throw Error(`useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover`);return e},zce=()=>XS(lP),dP=JS(null),fP=()=>{let e=XS(dP);if(!e)throw Error(`TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover`);return e},pP=(0,FS.forwardRef)((e,t)=>{let n=V(61),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({char:a,adapter:r,isLoading:c,"aria-label":i,children:o,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l=c===void 0?!1:c,u=ZC(),d=H(Bce),f=(0,FS.useId)(),p=BS(null),[m,h]=RS(null),g=BS(0),_;n[7]===a?_=n[8]:(_=e=>(g.current+=1,p.current=e,h(e),()=>{g.current=Math.max(0,g.current-1),p.current===e&&(p.current=null,h(null))}),n[7]=a,n[8]=_);let v=_,y;n[9]===v?y=n[10]:(y={register:v},n[9]=v,n[10]=y);let b=y,x=m??void 0,S;n[11]!==r||n[12]!==u||n[13]!==a||n[14]!==l||n[15]!==f||n[16]!==x||n[17]!==d?(S=Rce({adapter:r,text:d,triggerChar:a,behavior:x,aui:u,popoverId:f,isLoading:l}),n[11]=r,n[12]=u,n[13]=a,n[14]=l,n[15]=f,n[16]=x,n[17]=d,n[18]=S):S=n[18];let C=gC(S),w;n[19]===C?w=n[20]:(w=()=>C,n[19]=C,n[20]=w);let T=GS(w),E=$N(),D;n[21]!==m||n[22]!==a||n[23]!==T||n[24]!==E?(D=()=>E.register({char:a,...m?{behavior:m}:{},resource:T()}),n[21]=m,n[22]=a,n[23]=T,n[24]=E,n[25]=D):D=n[25];let O;n[26]!==m||n[27]!==a||n[28]!==E?(O=[E,a,m],n[26]=m,n[27]=a,n[28]=E,n[29]=O):O=n[29],US(D,O);let k=XN(),A;n[30]!==T||n[31]!==k?(A=()=>{if(k)return k.register(T())},n[30]=T,n[31]=k,n[32]=A):A=n[32];let ee;n[33]===k?ee=n[34]:(ee=[k],n[33]=k,n[34]=ee),US(A,ee);let j=m!==null&&C.open,M=Ece(),te,N;n[35]!==M||n[36]!==a||n[37]!==j?(te=()=>{if(j)return()=>{M.setActiveAria(a,null)}},N=[M,a,j],n[35]=M,n[36]=a,n[37]=j,n[38]=te,n[39]=N):(te=n[38],N=n[39]),US(te,N);let P,ne;n[40]!==M||n[41]!==a||n[42]!==j||n[43]!==f||n[44]!==C.highlightedItemId?(P=()=>{j&&M.setActiveAria(a,{popoverId:f,highlightedItemId:C.highlightedItemId})},ne=[M,a,f,j,C.highlightedItemId],n[40]=M,n[41]=a,n[42]=j,n[43]=f,n[44]=C.highlightedItemId,n[45]=P,n[46]=ne):(P=n[45],ne=n[46]),US(P,ne);let re;n[47]!==i||n[48]!==o||n[49]!==t||n[50]!==j||n[51]!==f||n[52]!==s||n[53]!==C.highlightedItemId?(re=j?(0,B.jsx)(gO.div,{role:`listbox`,id:f,"aria-label":i??`Suggestions`,"aria-activedescendant":C.highlightedItemId,"data-state":`open`,...s,ref:t,children:o}):o,n[47]=i,n[48]=o,n[49]=t,n[50]=j,n[51]=f,n[52]=s,n[53]=C.highlightedItemId,n[54]=re):re=n[54];let ie;n[55]!==C||n[56]!==re?(ie=(0,B.jsx)(lP.Provider,{value:C,children:re}),n[55]=C,n[56]=re,n[57]=ie):ie=n[57];let ae;return n[58]!==b||n[59]!==ie?(ae=(0,B.jsx)(dP.Provider,{value:b,children:ie}),n[58]=b,n[59]=ie,n[60]=ae):ae=n[60],ae});pP.displayName=`ComposerPrimitive.TriggerPopover`;function Bce(e){return e.composer.text}var mP=()=>{let e=V(2),{disabled:t,send:n}=MD(),r;return e[0]===n?r=e[1]:(r=()=>n(),e[0]=n,e[1]=r),t?null:r},Vce=bO(`ComposerPrimitive.Send`,mP),hP=(0,FS.forwardRef)((e,t)=>{let n=V(12),r,i;n[0]===e?(r=n[1],i=n[2]):({onSubmit:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=mP(),o;n[3]===a?o=n[4]:(o=e=>{e.preventDefault(),a&&a()},n[3]=a,n[4]=o);let s=o,c;n[5]!==s||n[6]!==r?(c=R(r,s),n[5]=s,n[6]=r,n[7]=c):c=n[7];let l;return n[8]!==t||n[9]!==i||n[10]!==c?(l=(0,B.jsx)(gO.form,{...i,ref:t,onSubmit:c}),n[8]=t,n[9]=i,n[10]=c,n[11]=l):l=n[11],l});hP.displayName=`ComposerPrimitive.Root`;var gP=e=>{let t=V(4),n=Rm(e),r=rO(Hce),i,a;t[0]!==n||t[1]!==r?(i=()=>r(n),a=[r,n],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),US(i,a)};function Hce(e){return e.onScrollToBottom}var Uce=()=>!1,Wce=()=>{},Gce=e=>{let t=V(4),n;t[0]===e?n=t[1]:(n=t=>{if(typeof window>`u`||e===null)return Wce;let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},t[0]=e,t[1]=n);let r=n,i;return t[2]===e?i=t[3]:(i=()=>typeof window>`u`||e===null?!1:window.matchMedia(e).matches,t[2]=e,t[3]=i),KS(r,i,Uce)};function _P(){return _P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_P.apply(null,arguments)}function Kce(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var qce=z.useLayoutEffect,Jce=function(e){var t=z.useRef(e);return qce(function(){t.current=e}),t},vP=function(e,t){if(typeof e==`function`){e(t);return}e.current=t},Yce=function(e,t){var n=z.useRef();return z.useCallback(function(r){e.current=r,n.current&&vP(n.current,null),n.current=t,t&&vP(t,r)},[t])},yP={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`},bP=function(e){Object.keys(yP).forEach(function(t){e.style.setProperty(t,yP[t],`important`)})},xP=null,SP=function(e,t){var n=e.scrollHeight;return t.sizingStyle.boxSizing===`border-box`?n+t.borderSize:n-t.paddingSize};function Xce(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),xP||(xP=document.createElement(`textarea`),xP.setAttribute(`tabindex`,`-1`),xP.setAttribute(`aria-hidden`,`true`),bP(xP)),xP.parentNode===null&&document.body.appendChild(xP);var i=e.paddingSize,a=e.borderSize,o=e.sizingStyle,s=o.boxSizing;Object.keys(o).forEach(function(e){var t=e;xP.style[t]=o[t]}),bP(xP),xP.value=t;var c=SP(xP,e);xP.value=t,c=SP(xP,e),xP.value=`x`;var l=xP.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);var d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}var CP=function(){},Zce=function(e,t){return e.reduce(function(e,n){return e[n]=t[n],e},{})},Qce=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],$ce=!!document.documentElement.currentStyle,ele=function(e){var t=window.getComputedStyle(e);if(t===null)return null;var n=Zce(Qce,t),r=n.boxSizing;return r===``?null:($ce&&r===`border-box`&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+`px`),{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)})};function wP(e,t,n){var r=Jce(n);z.useLayoutEffect(function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var tle=function(e,t){wP(document.body,`reset`,function(n){e.current.form===n.target&&t(n)})},nle=function(e){wP(window,`resize`,e)},rle=function(e){wP(document.fonts,`loadingdone`,e)},ile=[`cacheMeasurements`,`maxRows`,`minRows`,`onChange`,`onHeightChange`],ale=z.forwardRef(function(e,t){var n=e.cacheMeasurements,r=e.maxRows,i=e.minRows,a=e.onChange,o=a===void 0?CP:a,s=e.onHeightChange,c=s===void 0?CP:s,l=Kce(e,ile),u=l.value!==void 0,d=z.useRef(null),f=Yce(d,t),p=z.useRef(0),m=z.useRef(),h=function(){var e=d.current,t=n&&m.current?m.current:ele(e);if(t){m.current=t;var a=Xce(t,e.value||e.placeholder||`x`,i,r),o=a[0],s=a[1];p.current!==o&&(p.current=o,e.style.setProperty(`height`,o+`px`,`important`),c(o,{rowHeight:s}))}};return z.useLayoutEffect(h),tle(d,function(){if(!u){var e=d.current.value;requestAnimationFrame(function(){var t=d.current;t&&e!==t.value&&h()})}}),nle(h),rle(h),z.createElement(`textarea`,_P({},l,{onChange:function(e){u||h(),o(e)},ref:f}))}),ole=`(pointer: coarse) and (not (any-pointer: fine))`,TP=(0,FS.forwardRef)(({autoFocus:e=!1,asChild:t,render:n,disabled:r,onChange:i,onKeyDown:a,onPaste:o,onSelect:s,submitOnEnter:c,submitMode:l,cancelOnEscape:u=!0,unstable_focusOnRunStart:d=!0,unstable_focusOnScrollToBottom:f=!0,unstable_focusOnThreadSwitched:p=!0,unstable_insertNewlineOnTouchEnter:m=!1,addAttachmentOnPaste:h=!0,...g},_)=>{let v=ZC(),y=XN(),b=Ace(),x=l??(c===!1?`none`:`enter`),S=Gce(m?ole:null),C=m&&S&&x===`enter`?`none`:x,w=H(e=>e.composer.isEditing?e.composer.text:``),T=H(e=>e.thread.isDisabled||e.composer.dictation?.inputDisabled)||r,E=BS(null),D=tt(_,E),O=BS(!1);kc(e=>{if(!E.current?.contains(e.target))return;if(y){for(let t of y.getPlugins())if(t.handleKeyDown(e))return}if(!u)return;let t=v.composer();t.getState().canCancel&&(t.cancel(),e.preventDefault())});let k=e=>{if(!T&&!e.nativeEvent.isComposing){if(y){for(let t of y.getPlugins())if(t.handleKeyDown(e))return}if(e.key===`Enter`){let t=v.thread().getState(),n=t.capabilities.queue;if(e.shiftKey&&(e.ctrlKey||e.metaKey)&&n&&x!==`none`&&v.composer().getState().canSend){e.preventDefault(),v.composer().send({steer:!0});return}if(e.shiftKey||t.isRunning&&!n)return;let r=!1;C===`ctrlEnter`?r=e.ctrlKey||e.metaKey:C===`enter`&&(r=!0),r&&(e.preventDefault(),E.current?.closest(`form`)?.requestSubmit())}}},A=async e=>{if(!h)return;let t=v.thread().getState().capabilities,n=Array.from(e.clipboardData?.files||[]);if(t.attachments&&n.length>0)try{e.preventDefault(),await Promise.all(n.map(e=>v.composer().addAttachment(e)))}catch(e){console.error(`Error adding attachment:`,e)}},ee=e&&!T,j=HS(()=>{let e=E.current;!e||!ee||(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[ee]);US(()=>j(),[j]),gP(()=>{v.composer().getState().type===`thread`&&f&&j()}),US(()=>{if(!(v.composer().getState().type!==`thread`||!d))return v.on(`thread.runStart`,j)},[d,j,v]),US(()=>{if(!(v.composer().getState().type!==`thread`||!p))return v.on(`threadListItem.switchedTo`,j)},[p,j,v]);let M=b?{"aria-controls":b.popoverId,"aria-expanded":!0,"aria-haspopup":`listbox`,"aria-activedescendant":b.highlightedItemId}:{},te={name:`input`,value:w,...g,...M,ref:D,disabled:T,onChange:R(i,e=>{if(!v.composer().getState().isEditing)return;let t=e.nativeEvent.isComposing===!0;O.current&&!t&&(O.current=!1);let n=t||O.current;if(iC(()=>{v.composer().setText(e.target.value)}),n)return;let r=e.target.selectionStart??e.target.value.length;if(y)for(let e of y.getPlugins())e.setCursorPosition(r)}),onKeyDown:R(a,k),onCompositionStart:R(g.onCompositionStart,()=>{O.current=!0}),onCompositionEnd:R(g.onCompositionEnd,e=>{if(O.current=!1,!v.composer().getState().isEditing)return;let t=e.target;iC(()=>{v.composer().setText(t.value)});let n=t.selectionStart??t.value.length;if(y)for(let e of y.getPlugins())e.setCursorPosition(n)}),onSelect:R(s,e=>{if(O.current)return;let t=e.target,n=t.selectionStart??t.value.length;if(y)for(let e of y.getPlugins())e.setCursorPosition(n)}),onPaste:R(o,A)};if(n&&(0,FS.isValidElement)(n)){let e=g.children===void 0?n.props.children:g.children;return(0,B.jsx)(Wa,{...te,children:(0,FS.cloneElement)(n,void 0,e)})}return(0,B.jsx)(t?Wa:ale,{...te})});TP.displayName=`ComposerPrimitive.Input`;var sle=bO(`ComposerPrimitive.Cancel`,()=>{let{disabled:e,cancel:t}=PD();return e?null:t}),cle=bO(`ComposerPrimitive.AddAttachment`,e=>{let t=V(6),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{multiple:r}=n,i=r===void 0?!0:r,{disabled:a,addAttachment:o}=RD(),s=ZC(),c;return t[2]!==o||t[3]!==s||t[4]!==i?(c=()=>{let e=document.createElement(`input`);e.type=`file`,e.multiple=i,e.hidden=!0;let t=s.composer().getState().attachmentAccept;t!==`*`&&(e.accept=t),document.body.appendChild(e),e.onchange=t=>{let n=t.target.files;if(n){for(let e of n)o(e);document.body.removeChild(e)}},e.oncancel=()=>{(!e.files||e.files.length===0)&&document.body.removeChild(e)},e.click()},t[2]=o,t[3]=s,t[4]=i,t[5]=c):c=t[5],a?null:c},[`multiple`]),EP=(0,FS.forwardRef)((e,t)=>{let n=V(30),{disabled:r,asChild:i,render:a,children:o,...s}=e,c=i===void 0?!1:i,[l,u]=RS(!1),d=ZC(),f;n[0]===r?f=n[1]:(f=e=>{r||(e.preventDefault(),u(!0))},n[0]=r,n[1]=f);let p=f,m;n[2]!==r||n[3]!==l?(m=e=>{r||(e.preventDefault(),l||u(!0))},n[2]=r,n[3]=l,n[4]=m):m=n[4];let h=m,g;n[5]===r?g=n[6]:(g=e=>{if(r)return;e.preventDefault();let t=e.relatedTarget;t&&e.currentTarget.contains(t)||u(!1)},n[5]=r,n[6]=g);let _=g,v;n[7]!==d||n[8]!==r?(v=async e=>{if(r)return;e.preventDefault(),u(!1);let t=Array.from(e.dataTransfer.files);await Promise.all(t.map(async e=>{try{await d.composer().addAttachment(e)}catch(e){console.error(`Failed to add attachment:`,e)}}))},n[7]=d,n[8]=r,n[9]=v):v=n[9];let y=v,b;n[10]===l?b=n[11]:(b=l?{"data-dragging":`true`}:null,n[10]=l,n[11]=b);let x=R(s.onDragEnterCapture,p),S=R(s.onDragOverCapture,h),C=R(s.onDragLeaveCapture,_),w=R(s.onDropCapture,y),T;n[12]!==t||n[13]!==s||n[14]!==w||n[15]!==b||n[16]!==x||n[17]!==S||n[18]!==C?(T={...b,...s,onDragEnterCapture:x,onDragOverCapture:S,onDragLeaveCapture:C,onDropCapture:w,ref:t},n[12]=t,n[13]=s,n[14]=w,n[15]=b,n[16]=x,n[17]=S,n[18]=C,n[19]=T):T=n[19];let E=T;if(a&&(0,FS.isValidElement)(a)){let e=o===void 0?a.props.children:o,t;n[20]!==a||n[21]!==e?(t=(0,FS.cloneElement)(a,void 0,e),n[20]=a,n[21]=e,n[22]=t):t=n[22];let r;return n[23]!==E||n[24]!==t?(r=(0,B.jsx)(Wa,{...E,children:t}),n[23]=E,n[24]=t,n[25]=r):r=n[25],r}let D=c?Wa:`div`,O;return n[26]!==D||n[27]!==o||n[28]!==E?(O=(0,B.jsx)(D,{...E,children:o}),n[26]=D,n[27]=o,n[28]=E,n[29]=O):O=n[29],O});EP.displayName=`ComposerPrimitive.AttachmentDropzone`;var lle=bO(`ComposerPrimitive.Dictate`,()=>{let{disabled:e,startDictation:t}=ID();return e?null:t}),ule=bO(`ComposerPrimitive.StopDictation`,()=>{let e=V(2),t=ZC(),n=H(dle),r;return e[0]===t?r=e[1]:(r=()=>{t.composer().stopDictation()},e[0]=t,e[1]=r),n?r:null});function dle(e){return e.composer.dictation!=null}var DP=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({children:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=H(fle);if(!a)return null;let o=r??a,s;return n[3]!==t||n[4]!==i||n[5]!==o?(s=(0,B.jsx)(gO.span,{...i,ref:t,children:o}),n[3]=t,n[4]=i,n[5]=o,n[6]=s):s=n[6],s});DP.displayName=`ComposerPrimitive.DictationTranscript`;function fle(e){return e.composer.dictation?.transcript}var OP=(0,FS.forwardRef)((e,t)=>{let n=V(3);if(!H(ple))return null;let r;return n[0]!==t||n[1]!==e?(r=(0,B.jsx)(gO.div,{...e,ref:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],r});OP.displayName=`ComposerPrimitive.Quote`;var kP=(0,FS.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({children:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=H(mle);if(!a)return null;let o=r??a,s;return n[3]!==t||n[4]!==i||n[5]!==o?(s=(0,B.jsx)(gO.span,{...i,ref:t,children:o}),n[3]=t,n[4]=i,n[5]=o,n[6]=s):s=n[6],s});kP.displayName=`ComposerPrimitive.QuoteText`;var AP=(0,FS.forwardRef)((e,t)=>{let n=V(12),r,i;n[0]===e?(r=n[1],i=n[2]):({onClick:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=ZC(),o;n[3]===a?o=n[4]:(o=()=>{a.composer().setQuote(void 0)},n[3]=a,n[4]=o);let s=o,c;n[5]!==s||n[6]!==r?(c=R(r,s),n[5]=s,n[6]=r,n[7]=c):c=n[7];let l;return n[8]!==t||n[9]!==i||n[10]!==c?(l=(0,B.jsx)(gO.button,{type:`button`,...i,ref:t,onClick:c}),n[8]=t,n[9]=i,n[10]=c,n[11]=l):l=n[11],l});AP.displayName=`ComposerPrimitive.QuoteDismiss`;function ple(e){return e.composer.quote}function mle(e){return e.composer.quote?.text}var jP=(0,FS.forwardRef)((e,t)=>{let n=V(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({children:i,"aria-label":r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{categories:o,activeCategoryId:s,isSearchMode:c,open:l}=uP();if(!l||s||c)return null;let u=r??`Categories`,d;n[4]!==o||n[5]!==i?(d=i(o),n[4]=o,n[5]=i,n[6]=d):d=n[6];let f;return n[7]!==t||n[8]!==a||n[9]!==u||n[10]!==d?(f=(0,B.jsx)(gO.div,{role:`group`,"aria-label":u,...a,ref:t,children:d}),n[7]=t,n[8]=a,n[9]=u,n[10]=d,n[11]=f):f=n[11],f});jP.displayName=`ComposerPrimitive.TriggerPopoverCategories`;var MP=(0,FS.forwardRef)((e,t)=>{let n=V(30),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({categoryId:r,onClick:i,onMouseMove:a,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let{selectCategory:s,highlightIndex:c,categories:l,highlightedIndex:u,activeCategoryId:d,isSearchMode:f,popoverId:p}=uP(),m;n[5]!==r||n[6]!==s?(m=()=>{s(r)},n[5]=r,n[6]=s,n[7]=m):m=n[7];let h=m,g;if(n[8]!==l||n[9]!==r){let e;n[11]===r?e=n[12]:(e=e=>e.id===r,n[11]=r,n[12]=e),g=l.findIndex(e),n[8]=l,n[9]=r,n[10]=g}else g=n[10];let _=g,v=!d&&!f&&_===u,y;n[13]!==_||n[14]!==c?(y=()=>{c(_)},n[13]=_,n[14]=c,n[15]=y):y=n[15];let b=y,x=`${p}-option-${r}`,S=v?``:void 0,C;n[16]!==h||n[17]!==i?(C=R(i,h),n[16]=h,n[17]=i,n[18]=C):C=n[18];let w;n[19]!==b||n[20]!==a?(w=R(a,b),n[19]=b,n[20]=a,n[21]=w):w=n[21];let T;return n[22]!==t||n[23]!==v||n[24]!==o||n[25]!==x||n[26]!==S||n[27]!==C||n[28]!==w?(T=(0,B.jsx)(gO.button,{type:`button`,role:`option`,id:x,"aria-selected":v,"data-highlighted":S,...o,ref:t,onClick:C,onMouseMove:w}),n[22]=t,n[23]=v,n[24]=o,n[25]=x,n[26]=S,n[27]=C,n[28]=w,n[29]=T):T=n[29],T});MP.displayName=`ComposerPrimitive.TriggerPopoverCategoryItem`;var NP=(0,FS.forwardRef)((e,t)=>{let n=V(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({children:i,"aria-label":r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{items:o,activeCategoryId:s,isSearchMode:c,open:l}=uP();if(!l||!s&&!c)return null;let u=r??`Items`,d;n[4]!==i||n[5]!==o?(d=i(o),n[4]=i,n[5]=o,n[6]=d):d=n[6];let f;return n[7]!==t||n[8]!==a||n[9]!==u||n[10]!==d?(f=(0,B.jsx)(gO.div,{role:`group`,"aria-label":u,...a,ref:t,children:d}),n[7]=t,n[8]=a,n[9]=u,n[10]=d,n[11]=f):f=n[11],f});NP.displayName=`ComposerPrimitive.TriggerPopoverItems`;var PP=(0,FS.forwardRef)((e,t)=>{let n=V(30),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({item:i,index:r,onClick:a,onMouseMove:o,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let{selectItem:c,highlightIndex:l,items:u,highlightedIndex:d,activeCategoryId:f,isSearchMode:p,popoverId:m}=uP(),h;n[6]!==i||n[7]!==c?(h=()=>{c(i)},n[6]=i,n[7]=c,n[8]=h):h=n[8];let g=h,_;n[9]!==r||n[10]!==i.id||n[11]!==u?(_=r??u.findIndex(e=>e.id===i.id),n[9]=r,n[10]=i.id,n[11]=u,n[12]=_):_=n[12];let v=_,y=(p||f!==null)&&v===d,b;n[13]!==l||n[14]!==v?(b=()=>{l(v)},n[13]=l,n[14]=v,n[15]=b):b=n[15];let x=b,S=`${m}-option-${i.id}`,C=y?``:void 0,w;n[16]!==g||n[17]!==a?(w=R(a,g),n[16]=g,n[17]=a,n[18]=w):w=n[18];let T;n[19]!==x||n[20]!==o?(T=R(o,x),n[19]=x,n[20]=o,n[21]=T):T=n[21];let E;return n[22]!==t||n[23]!==y||n[24]!==s||n[25]!==S||n[26]!==C||n[27]!==w||n[28]!==T?(E=(0,B.jsx)(gO.button,{type:`button`,role:`option`,id:S,"aria-selected":y,"data-highlighted":C,...s,ref:t,onClick:w,onMouseMove:T}),n[22]=t,n[23]=y,n[24]=s,n[25]=S,n[26]=C,n[27]=w,n[28]=T,n[29]=E):E=n[29],E});PP.displayName=`ComposerPrimitive.TriggerPopoverItem`;var FP=(0,FS.forwardRef)((e,t)=>{let n=V(10),r,i;n[0]===e?(r=n[1],i=n[2]):({onClick:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{activeCategoryId:a,isSearchMode:o,goBack:s,open:c}=uP();if(!c||!a||o)return null;let l;n[3]!==s||n[4]!==r?(l=R(r,s),n[3]=s,n[4]=r,n[5]=l):l=n[5];let u;return n[6]!==t||n[7]!==i||n[8]!==l?(u=(0,B.jsx)(gO.button,{type:`button`,...i,ref:t,onClick:l}),n[6]=t,n[7]=i,n[8]=l,n[9]=u):u=n[9],u});FP.displayName=`ComposerPrimitive.TriggerPopoverBack`;var IP=({formatter:e,onExecute:t,removeOnExecute:n})=>{let{register:r}=fP(),i=BS(t);return i.current=t,US(()=>r({kind:`action`,formatter:e??eO,onExecute:e=>i.current(e),...n===void 0?{}:{removeOnExecute:n}}),[r,e,n]),null};IP.displayName=`ComposerPrimitive.TriggerPopoverAction`;var LP=({formatter:e,onInserted:t})=>{let{register:n}=fP(),r=BS(t);return r.current=t,US(()=>n({kind:`directive`,formatter:e??eO,onInserted:e=>r.current?.(e)}),[n,e]),null};LP.displayName=`ComposerPrimitive.TriggerPopoverDirective`;var hle=Object.assign(pP,{Directive:LP,Action:IP}),RP=mO({AddAttachment:()=>cle,AttachmentByIndex:()=>vD,AttachmentDropzone:()=>EP,Attachments:()=>bD,Cancel:()=>sle,Dictate:()=>lle,DictationTranscript:()=>DP,If:()=>jD,Input:()=>TP,Queue:()=>SD,Quote:()=>OP,QuoteDismiss:()=>AP,QuoteText:()=>kP,Root:()=>hP,Send:()=>Vce,StopDictation:()=>ule,Unstable_TriggerPopover:()=>hle,Unstable_TriggerPopoverBack:()=>FP,Unstable_TriggerPopoverCategories:()=>jP,Unstable_TriggerPopoverCategoryItem:()=>MP,Unstable_TriggerPopoverItem:()=>PP,Unstable_TriggerPopoverItems:()=>NP,Unstable_TriggerPopoverRoot:()=>oP,unstable_useTriggerPopoverRootContext:()=>$N,unstable_useTriggerPopoverRootContextOptional:()=>eP,unstable_useTriggerPopoverScopeContext:()=>uP,unstable_useTriggerPopoverScopeContextOptional:()=>zce,unstable_useTriggerPopoverTriggers:()=>Dce,unstable_useTriggerPopoverTriggersOptional:()=>kce}),zP=()=>H(gle);function gle(e){if(e.part.type!==`text`&&e.part.type!==`reasoning`)throw Error(`MessagePartText can only be used inside text or reasoning message parts.`);return e.part}var _le=JS(null);function vle(e){let t=XS(_le);if(!e?.optional&&!t)throw Error(`This component must be used within a SmoothContextProvider.`);return t}var{useSmoothStatus:yle,useSmoothStatusStore:ble}=tO(vle,`useSmoothStatus`),BP=250,VP=5,xle=class{currentText;setText;animationFrameId=null;lastUpdateTime=Date.now();lastCommitTime=0;targetText=``;drainMs=BP;maxCharIntervalMs=VP;maxCharsPerFrame=1/0;minCommitMs=0;constructor(e,t){this.currentText=e,this.setText=t}start(){this.animationFrameId===null&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,n=this.targetText.length-this.currentText.length,r=Math.min(this.maxCharIntervalMs,this.drainMs/n),i=Math.min(n,this.maxCharsPerFrame),a=0;for(;t>=r&&a<i;)a++,t-=r;a===i&&i===this.maxCharsPerFrame&&(t=0),a===n?this.animationFrameId=null:this.animationFrameId=requestAnimationFrame(this.animate),a!==0&&(this.currentText=this.targetText.slice(0,this.currentText.length+a),this.lastUpdateTime=e-t,(a===n||e-this.lastCommitTime>=this.minCommitMs)&&(this.lastCommitTime=e,this.setText(this.currentText)))}},HP=Object.freeze({type:`running`}),UP=(e,t)=>e!==void 0&&e>0?e:t,WP=(e,t=!1)=>{let{text:n}=e,r=typeof t==`object`&&t?t:void 0,i=t!==!1&&t!==null,a=UP(r?.drainMs,BP),o=UP(r?.maxCharIntervalMs,VP),s=UP(r?.maxCharsPerFrame,1/0),c=UP(r?.minCommitMs,0),[l,u]=RS(e.status.type===`running`?``:n),d=ZC(),f=H(()=>d.part()),[p,m]=RS(f);(f!==p||!n.startsWith(l))&&(m(f),u(e.status.type===`running`?``:n));let h=ble({optional:!0}),g=Rm(t=>{if(u(t),h){let n=l!==t||e.status.type===`running`?HP:e.status;oO(h).setState(n,!0)}});US(()=>{if(h){let t=i&&(l!==n||e.status.type===`running`)?HP:e.status;oO(h).setState(t,!0)}},[h,i,n,l,e.status]);let[_]=RS(new xle(l,g));US(()=>{_.drainMs=a,_.maxCharIntervalMs=o,_.maxCharsPerFrame=s,_.minCommitMs=c},[_,a,o,s,c]);let v=BS(f);return US(()=>{if(!i){_.stop();return}let t=v.current!==f;if(v.current=f,t||!n.startsWith(_.targetText)){e.status.type===`running`?(_.currentText=``,_.targetText=n,_.lastCommitTime=0,_.start()):(_.currentText=n,_.targetText=n,_.stop());return}_.targetText=n,_.start()},[_,i,n,e.status.type,f]),US(()=>()=>{_.stop()},[_]),VS(()=>i?{...e,text:l,status:n===l?e.status:HP}:e,[i,l,e,n])},Sle=()=>H(Cle);function Cle(e){if(e.part.type!==`image`)throw Error(`MessagePartImage can only be used inside image message parts.`);return e.part}var GP=(0,FS.forwardRef)((e,t)=>{let n=V(10),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({smooth:i,component:a,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=i===void 0?!0:i,s=a===void 0?`span`:a,{text:c,status:l}=WP(zP(),o),u;return n[4]!==s||n[5]!==t||n[6]!==r||n[7]!==l.type||n[8]!==c?(u=(0,B.jsx)(s,{"data-status":l.type,...r,ref:t,children:c}),n[4]=s,n[5]=t,n[6]=r,n[7]=l.type,n[8]=c,n[9]=u):u=n[9],u});GP.displayName=`MessagePartPrimitive.Text`;var KP=(0,FS.forwardRef)((e,t)=>{let n=V(4),{image:r}=Sle(),i;return n[0]!==t||n[1]!==r||n[2]!==e?(i=(0,B.jsx)(gO.img,{src:r,...e,ref:t}),n[0]=t,n[1]=r,n[2]=e,n[3]=i):i=n[3],i});KP.displayName=`MessagePartPrimitive.Image`;var qP=e=>{let t=V(2),n=BS(void 0),r;return t[0]===e?r=t[1]:(r=t=>{n.current&&=(n.current(),void 0),t&&(n.current=e(t))},t[0]=e,t[1]=r),r},JP=(e,t)=>{let n=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!n)return 1/0;let r=Number(n[1]),i=n[2];return i===`px`?r:i===`em`?r*(parseFloat(getComputedStyle(t).fontSize)||16):i===`rem`?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):1/0},wle=e=>e.dataset.messageId,Tle=()=>{let e=document.createElement(`div`);return e.dataset.auiTopAnchorReserve=``,e.style.height=`0px`,e.style.flexShrink=`0`,e.style.pointerEvents=`none`,e.setAttribute(`aria-hidden`,`true`),e},YP=(e,t)=>{let n=`${t}px`;return e.style.height===n?!1:(e.style.height=n,!0)},Ele=e=>{let t=window.devicePixelRatio||1;return Math.round(e*t)/t},XP=()=>{let e=V(4),t=ZC(),n;e[0]===t?n=e[1]:(n=()=>t.message(),e[0]=t,e[1]=n);let r=H(n),i;return e[2]===r?i=e[3]:(i=e=>{let t=()=>{r.setIsHovering(!0)},n=()=>{r.setIsHovering(!1)};return e.addEventListener(`mouseenter`,t),e.addEventListener(`mouseleave`,n),e.matches(`:hover`)&&queueMicrotask(()=>r.setIsHovering(!0)),()=>{e.removeEventListener(`mouseenter`,t),e.removeEventListener(`mouseleave`,n),r.setIsHovering(!1)}},e[2]=r,e[3]=i),qP(i)},Dle=()=>{let e=V(2),t=rO(Nle),n;return e[0]===t?n=e[1]:(n=e=>e.message.role===`user`&&e.message.index>0&&e.message.index===e.thread.messages.length-2&&e.thread.messages.at(-1)?.role===`assistant`&&(e.message.id===t||e.thread.isRunning),e[0]=t,e[1]=n),H(n)},Ole=()=>{let e=V(2),t=rO(Ple),n;return e[0]===t?n=e[1]:(n=e=>e.message.isLast&&e.message.role===`assistant`&&e.message.index>=1&&e.thread.messages.at(e.message.index-1)?.role===`user`&&(e.message.id===t||e.thread.isRunning),e[0]=t,e[1]=n),H(n)},kle=(e,t)=>{let n=V(3),r;return n[0]!==e||n[1]!==t?(r=n=>{if(e)return t.getState().registerAnchorElement(n)},n[0]=e,n[1]=t,n[2]=r):r=n[2],qP(r)},Ale=e=>{let t=V(3),{active:n,threadViewportStore:r}=e,i;return t[0]!==n||t[1]!==r?(i=e=>{if(!n)return;let t=r.getState(),i=t.topAnchorMessageClamp;return t.registerAnchorTargetElement(e,{tallerThan:JP(i.tallerThan,e),visibleHeight:JP(i.visibleHeight,e)})},t[0]=n,t[1]=r,t[2]=i):i=t[2],qP(i)},jle=e=>{let t=V(7),n,r;t[0]===e?(n=t[1],r=t[2]):({forwardedRef:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=XP(),a=tt(n,i),o=H(Fle),s;return t[3]!==o||t[4]!==r||t[5]!==a?(s=(0,B.jsx)(gO.div,{...r,ref:a,"data-message-id":o}),t[3]=o,t[4]=r,t[5]=a,t[6]=s):s=t[6],s},Mle=e=>{let t=V(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({forwardedRef:n,threadViewportStore:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=XP(),o=Dle(),s=Ole(),c=kle(o,i),l;t[4]!==s||t[5]!==i?(l={active:s,threadViewportStore:i},t[4]=s,t[5]=i,t[6]=l):l=t[6];let u=Ale(l),d=tt(n,a,c,u),f=H(Ile),p=o?``:void 0,m=s?``:void 0,h;return t[7]!==f||t[8]!==r||t[9]!==d||t[10]!==p||t[11]!==m?(h=(0,B.jsx)(gO.div,{...r,ref:d,"data-message-id":f,"data-aui-top-anchor-user":p,"data-aui-top-anchor-target":m}),t[7]=f,t[8]=r,t[9]=d,t[10]=p,t[11]=m,t[12]=h):h=t[12],h},ZP=(0,FS.forwardRef)((e,t)=>{let n=V(7),r=iO();if(r.getState().turnAnchor===`top`){let i;return n[0]!==t||n[1]!==e||n[2]!==r?(i=(0,B.jsx)(Mle,{...e,forwardedRef:t,threadViewportStore:r}),n[0]=t,n[1]=e,n[2]=r,n[3]=i):i=n[3],i}let i;return n[4]!==t||n[5]!==e?(i=(0,B.jsx)(jle,{...e,forwardedRef:t}),n[4]=t,n[5]=e,n[6]=i):i=n[6],i});ZP.displayName=`MessagePrimitive.Root`;function Nle(e){return e.topAnchorTurn?.anchorId}function Ple(e){return e.topAnchorTurn?.targetId}function Fle(e){return e.message.id}function Ile(e){return e.message.id}var QP={...SE,Text:()=>(0,B.jsxs)(`p`,{style:{whiteSpace:`pre-line`},children:[(0,B.jsx)(GP,{}),(0,B.jsx)(CD,{children:(0,B.jsx)(`span`,{style:{fontFamily:`revert`},children:` ●`})})]}),Image:()=>(0,B.jsx)(KP,{})},$P=e=>{let t=V(10);if(`children`in e){let n;return t[0]===e.children?n=t[1]:(n=(0,B.jsx)(RE,{children:e.children}),t[0]=e.children,t[1]=n),n}let n,r;t[2]===e?(n=t[3],r=t[4]):({components:n,...r}=e,t[2]=e,t[3]=n,t[4]=r);let i;t[5]===n?i=t[6]:(i=n?{Text:n.Text??QP.Text,Image:n.Image??QP.Image,Reasoning:n.Reasoning??SE.Reasoning,Source:n.Source??SE.Source,File:n.File??SE.File,Unstable_Audio:n.Unstable_Audio??SE.Unstable_Audio,...`ChainOfThought`in n?{ChainOfThought:n.ChainOfThought}:{tools:n.tools,data:n.data,ToolGroup:n.ToolGroup??SE.ToolGroup,ReasoningGroup:n.ReasoningGroup??SE.ReasoningGroup},Empty:n.Empty,Quote:n.Quote,generativeUI:n.generativeUI}:QP,t[5]=n,t[6]=i);let a=i,o;return t[7]!==r||t[8]!==a?(o=(0,B.jsx)(RE,{components:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o};$P.displayName=`MessagePrimitive.Parts`;var eF=e=>{let{children:t}=e;return moe()===void 0?null:t};eF.displayName=`MessagePrimitive.Error`;var Lle=e=>{let t=new Map;for(let n=0;n<e.length;n++){let r=e[n]?.parentId??`__ungrouped_${n}`,i=t.get(r)??[];i.push(n),t.set(r,i)}let n=[];for(let[e,r]of t){let t=e.startsWith(`__ungrouped_`)?void 0:e;n.push({groupKey:t,indices:r})}return n},Rle=e=>{let t=V(4),n=H(Kle),r;bb0:{if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],r=e;break bb0}let i;t[1]!==e||t[2]!==n?(i=e(n),t[1]=e,t[2]=n,t[3]=i):i=t[3],r=i}return r},zle=e=>{let t=V(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.toolName?(i=e=>{let t=e.tools.tools[r.toolName]??n;return Array.isArray(t)?t[0]??n:t},t[3]=n,t[4]=r.toolName,t[5]=i):i=t[5];let a=H(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,B.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},Ble=e=>{let t=V(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.name?(i=e=>{let t=e.dataRenderers.renderers[r.name]??n;return Array.isArray(t)?t[0]??n:t},t[3]=n,t[4]=r.name,t[5]=i):i=t[5];let a=H(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,B.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},tF={Text:()=>(0,B.jsxs)(`p`,{style:{whiteSpace:`pre-line`},children:[(0,B.jsx)(GP,{}),(0,B.jsx)(CD,{children:(0,B.jsx)(`span`,{style:{fontFamily:`revert`},children:` ●`})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>(0,B.jsx)(KP,{}),File:()=>null,Unstable_Audio:()=>null,Group:({children:e})=>e},Vle=e=>{let t=V(43),{components:n}=e,r;t[0]===n?r=t[1]:(r=n===void 0?{}:n,t[0]=n,t[1]=r);let{Text:i,Reasoning:a,Image:o,Source:s,File:c,Unstable_Audio:l,tools:u,data:d}=r,f=i===void 0?tF.Text:i,p=a===void 0?tF.Reasoning:a,m=o===void 0?tF.Image:o,h=s===void 0?tF.Source:s,g=c===void 0?tF.File:c,_=l===void 0?tF.Unstable_Audio:l,v;t[2]===u?v=t[3]:(v=u===void 0?{}:u,t[2]=u,t[3]=v);let y=v,b=ZC(),x=H(qle),S=x.type;if(S===`tool-call`){let e;t[4]===b?e=t[5]:(e=b.part(),t[4]=b,t[5]=e);let n=e.addToolResult,r;t[6]===b?r=t[7]:(r=b.part(),t[6]=b,t[7]=r);let i=r.resumeToolCall,a;t[8]===b?a=t[9]:(a=b.part(),t[8]=b,t[9]=a);let o=a.respondToToolApproval;if(`Override`in y){let e;return t[10]!==n||t[11]!==x||t[12]!==o||t[13]!==i||t[14]!==y.Override?(e=(0,B.jsx)(y.Override,{...x,addResult:n,resume:i,respondToApproval:o}),t[10]=n,t[11]=x,t[12]=o,t[13]=i,t[14]=y.Override,t[15]=e):e=t[15],e}let s=y.by_name?.[x.toolName]??y.Fallback,c;return t[16]!==s||t[17]!==n||t[18]!==x||t[19]!==o||t[20]!==i?(c=(0,B.jsx)(zle,{...x,Fallback:s,addResult:n,resume:i,respondToApproval:o}),t[16]=s,t[17]=n,t[18]=x,t[19]=o,t[20]=i,t[21]=c):c=t[21],c}if(x.status?.type===`requires-action`)throw Error(`Encountered unexpected requires-action status`);switch(S){case`text`:{let e;return t[22]!==f||t[23]!==x?(e=(0,B.jsx)(f,{...x}),t[22]=f,t[23]=x,t[24]=e):e=t[24],e}case`reasoning`:{let e;return t[25]!==p||t[26]!==x?(e=(0,B.jsx)(p,{...x}),t[25]=p,t[26]=x,t[27]=e):e=t[27],e}case`source`:{let e;return t[28]!==h||t[29]!==x?(e=(0,B.jsx)(h,{...x}),t[28]=h,t[29]=x,t[30]=e):e=t[30],e}case`image`:{let e;return t[31]!==m||t[32]!==x?(e=(0,B.jsx)(m,{...x}),t[31]=m,t[32]=x,t[33]=e):e=t[33],e}case`file`:{let e;return t[34]!==g||t[35]!==x?(e=(0,B.jsx)(g,{...x}),t[34]=g,t[35]=x,t[36]=e):e=t[36],e}case`audio`:{let e;return t[37]!==_||t[38]!==x?(e=(0,B.jsx)(_,{...x}),t[37]=_,t[38]=x,t[39]=e):e=t[39],e}case`data`:{let e=d?.by_name?.[x.name]??d?.Fallback,n;return t[40]!==e||t[41]!==x?(n=(0,B.jsx)(Ble,{...x,Fallback:e}),t[40]=e,t[41]=x,t[42]=n):n=t[42],n}default:return console.warn(`Unknown message part type: ${S}`),null}},Hle=(0,FS.memo)(e=>{let t=V(5),{partIndex:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,B.jsx)(Vle,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,B.jsx)(Pw,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),Ule=e=>{let t=V(6),{status:n,component:r}=e,i=n.type===`running`,a;t[0]!==r||t[1]!==n?(a=(0,B.jsx)(r,{type:`text`,text:``,status:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,B.jsx)(Iw,{text:``,isRunning:i,children:a}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o},Wle=Object.freeze({type:`complete`}),Gle=(0,FS.memo)(e=>{let t=V(6),{components:n}=e,r=H(Jle);if(n?.Empty){let e;return t[0]!==n.Empty||t[1]!==r?(e=(0,B.jsx)(n.Empty,{status:r}),t[0]=n.Empty,t[1]=r,t[2]=e):e=t[2],e}let i=n?.Text??tF.Text,a;return t[3]!==r||t[4]!==i?(a=(0,B.jsx)(Ule,{status:r,component:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),nF=e=>{let t=V(9),{groupingFunction:n,components:r}=e,i=H(Yle),a=Rle(n),o;bb0:{if(i===0){let e;t[0]===r?e=t[1]:(e=(0,B.jsx)(Gle,{components:r}),t[0]=r,t[1]=e),o=e;break bb0}let e;if(t[2]!==r||t[3]!==a){let n;t[5]===r?n=t[6]:(n=(e,t)=>(0,B.jsx)(r?.Group??tF.Group,{groupKey:e.groupKey,indices:e.indices,children:e.indices.map(e=>(0,B.jsx)(Hle,{partIndex:e,components:r},e))},`group-${t}-${e.groupKey??`ungrouped`}`),t[5]=r,t[6]=n),e=a.map(n),t[2]=r,t[3]=a,t[4]=e}else e=t[4];o=e}let s=o,c;return t[7]===s?c=t[8]:(c=(0,B.jsx)(B.Fragment,{children:s}),t[7]=s,t[8]=c),c};nF.displayName=`MessagePrimitive.Unstable_PartsGrouped`;var rF=e=>{let t=V(6),n,r;t[0]===e?(n=t[1],r=t[2]):({components:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,B.jsx)(nF,{...r,components:n,groupingFunction:Lle}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i};rF.displayName=`MessagePrimitive.Unstable_PartsGroupedByParentId`;function Kle(e){return e.message.parts}function qle(e){return e.part}function Jle(e){return e.message.status??Wle}function Yle(e){return e.message.parts.length}var iF=mO({AttachmentByIndex:()=>fD,Attachments:()=>mD,Content:()=>$P,Error:()=>eF,GenerativeUI:()=>lE,GroupedParts:()=>cD,If:()=>JN,PartByIndex:()=>wE,Parts:()=>$P,Quote:()=>lD,Root:()=>ZP,Unstable_PartsGrouped:()=>nF,Unstable_PartsGroupedByParentId:()=>rF}),Xle=e=>{let t=V(2),n=Rm(e),r;return t[0]===n?r=t[1]:(r=e=>{let t=new ResizeObserver(()=>{n()}),r=new MutationObserver(e=>{e.some(Zle)&&n()});return t.observe(e),r.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{t.disconnect(),r.disconnect()}},t[0]=n,t[1]=r),qP(r)};function Zle(e){return e.type!==`attributes`||e.attributeName!==`style`}var Qle=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{let i=BS(null),a=H(e=>e.thread.messages.length>0),o=BS(!1),s=BS(null),c=iO();e===void 0&&(e=c.getState().turnAnchor!==`top`);let l=BS(0),u=BS(0),d=BS(0),f=BS(0),p=BS(null),m=HS(e=>{let t=i.current;t&&(p.current=e,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),h=HS(e=>{p.current=e,s.current!==null&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{s.current=null,m(e)})},[m]);WS(()=>()=>{s.current!==null&&cancelAnimationFrame(s.current)},[]);let g=HS(()=>{let e=c.getState();return e.turnAnchor===`top`&&e.element.viewport===i.current&&e.element.anchor!==null},[c]),_=()=>{let e=i.current;if(!e)return;let t=c.getState().isAtBottom,n=Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)<=1||e.scrollHeight<=e.clientHeight;!n&&l.current<e.scrollTop||(n?e.scrollHeight>e.clientHeight+1&&(p.current=null):l.current>e.scrollTop&&u.current===e.scrollHeight&&(p.current=null),(n||p.current===null)&&n!==t&&oO(c).setState({isAtBottom:n})),l.current=e.scrollTop,u.current=e.scrollHeight},v=Xle(()=>{let t=i.current;if(!t)return;let{scrollHeight:n,clientHeight:r}=t;if(n===d.current&&r===f.current)return;d.current=n,f.current=r;let a=p.current;a&&g()?p.current=null:a?m(a):e&&c.getState().isAtBottom&&m(`instant`),_()}),y=qP(e=>{let t=()=>{p.current=null};return e.addEventListener(`scroll`,_),e.addEventListener(`pointerdown`,t),()=>{e.removeEventListener(`scroll`,_),e.removeEventListener(`pointerdown`,t)}});return WS(()=>{if(n){if(!a){o.current=!1;return}o.current||(o.current=!0,p.current===null&&h(`instant`))}},[a,h,n]),gP(({behavior:e})=>{m(e)}),ew(`thread.runStart`,()=>{t&&c.getState().turnAnchor!==`top`&&h(`auto`)}),ew(`threadListItem.switchedTo`,()=>{r&&h(`instant`)}),tt(v,y,i)},aF=(0,FS.forwardRef)((e,t)=>{let n=V(3),r;return n[0]!==e||n[1]!==t?(r=(0,B.jsx)(gO.div,{...e,ref:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});aF.displayName=`ThreadPrimitive.Root`;var oF=e=>{let{children:t}=e;return H($le)?t:null};oF.displayName=`ThreadPrimitive.Empty`;function $le(e){return e.thread.isEmpty}var eue=e=>{let t=V(4),n;return t[0]!==e.disabled||t[1]!==e.empty||t[2]!==e.running?(n=t=>!(e.empty===!0&&!t.thread.isEmpty||e.empty===!1&&t.thread.isEmpty||e.running===!0&&!t.thread.isRunning||e.running===!1&&t.thread.isRunning||e.disabled===!0&&!t.thread.isDisabled||e.disabled===!1&&t.thread.isDisabled),t[0]=e.disabled,t[1]=e.empty,t[2]=e.running,t[3]=n):n=t[3],H(n)},sF=e=>{let t=V(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),eue(r)?n:null};sF.displayName=`ThreadPrimitive.If`;var cF=(e,t)=>{let n=V(3),r;return n[0]!==t||n[1]!==e?(r=n=>{if(!e)return;let r=e(),i=()=>{let e=t?t(n):n.offsetHeight;r.setHeight(e)},a=new ResizeObserver(i);return a.observe(n),i(),()=>{a.disconnect(),r.unregister()}},n[0]=t,n[1]=e,n[2]=r):r=n[2],qP(r)},lF=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},tue=(e,t)=>{let n=0,r=e;for(;r&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return r===t?n:lF(e)-lF(t)},uF=({viewport:e,anchor:t,tallerThan:n,visibleHeight:r})=>{let i=tue(t,e),a=t.offsetHeight;return i+Math.max(0,a-(a<=n?a:r))},nue=({scrollHeight:e,...t})=>{let{viewport:n}=t,r=uF(t)+n.clientHeight;return Math.max(0,r-e)},rue=({viewport:e,reserve:t,...n})=>nue({viewport:e,...n,scrollHeight:e.scrollHeight-t.offsetHeight}),iue=e=>{let t=new ResizeObserver(e),n=new MutationObserver(e),r=null,i=null,a=null,o=()=>{t.disconnect(),n.disconnect(),r=null,i=null,a=null};return{target:(e,s,c)=>{r===e&&i===s&&a===c||(o(),t.observe(e),t.observe(s),t.observe(c),n.observe(c,{childList:!0,subtree:!0,characterData:!0}),r=e,i=s,a=c)},disconnect:o}},aue=e=>{let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},cancel:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}},oue=e=>{let t=null,n;function r(){let r=e.getState(),{viewport:o,anchor:s,target:c}=r.element,l=r.targetConfig;if(r.turnAnchor!==`top`||!o||!s||!c||!l){a.disconnect(),t&&(YP(t,0),t.remove());return}if(t??=Tle(),(t.parentElement!==c.parentElement||t.previousElementSibling!==c)&&c.after(t),a.target(o,s,c),YP(t,rue({viewport:o,anchor:s,reserve:t,...l}))){i.schedule();return}let u=wle(s);if(u!==void 0&&n===u)return;let d=Ele(uF({viewport:o,anchor:s,...l}));Math.abs(o.scrollTop-d)>1&&o.scrollTo({top:d,behavior:`smooth`}),u!==void 0&&(n=u)}let i=aue(r),a=iue(i.schedule);i.schedule();let o=e.subscribe(i.schedule);return()=>{i.cancel(),o(),a.disconnect(),t?.remove()}},sue=e=>{let t=V(4),n=iO(),r,i;t[0]!==e||t[1]!==n?(r=()=>{if(e)return oue(n)},i=[e,n],t[0]=e,t[1]=n,t[2]=r,t[3]=i):(r=t[2],i=t[3]),WS(r,i)},dF=({isRunning:e,messages:t})=>{if(!e)return null;let n=t.at(-1),r=t.at(-2);return r?.role!==`user`||n?.role!==`assistant`?null:{anchorId:r.id,targetId:n.id}},cue=e=>dF(e)?.anchorId,lue=e=>dF(e)?.targetId,uue=()=>cF(rO(pue),mue),due=()=>qP(rO(hue)),fue=e=>{let t=V(13),n=iO(),r;t[0]===e?r=t[1]:(r=t=>{if(e)return cue(t.thread)},t[0]=e,t[1]=r);let i=H(r),a;t[2]===e?a=t[3]:(a=t=>{if(e)return lue(t.thread)},t[2]=e,t[3]=a);let o=H(a),s;bb0:{if(!i||!o){s=null;break bb0}let e;t[4]!==i||t[5]!==o?(e={anchorId:i,targetId:o},t[4]=i,t[5]=o,t[6]=e):e=t[6],s=e}let c=s,l,u;t[7]!==c||t[8]!==n?(l=()=>{if(!c)return;let e=n.getState(),t=e.topAnchorTurn;t?.anchorId===c.anchorId&&t.targetId===c.targetId||e.setTopAnchorTurn(c)},u=[c,n],t[7]=c,t[8]=n,t[9]=l,t[10]=u):(l=t[9],u=t[10]),WS(l,u);let d;t[11]===n?d=t[12]:(d=()=>{n.getState().setTopAnchorTurn(null)},t[11]=n,t[12]=d);let f=d;ew(`thread.initialize`,f),ew(`threadListItem.switchedTo`,f)},fF=(0,FS.forwardRef)((e,t)=>{let n=V(18),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({autoScroll:r,scrollToBottomOnRunStart:s,scrollToBottomOnInitialize:o,scrollToBottomOnThreadSwitch:c,children:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l;n[7]!==r||n[8]!==o||n[9]!==s||n[10]!==c?(l={autoScroll:r,scrollToBottomOnRunStart:s,scrollToBottomOnInitialize:o,scrollToBottomOnThreadSwitch:c},n[7]=r,n[8]=o,n[9]=s,n[10]=c,n[11]=l):l=n[11];let u=Qle(l),d=uue(),f=due(),p=iO(),m;n[12]===p?m=n[13]:(m=p.getState(),n[12]=p,n[13]=m);let h=m.turnAnchor===`top`;fue(h),sue(h);let g=tt(t,u,d,f),_;return n[14]!==i||n[15]!==g||n[16]!==a?(_=(0,B.jsx)(gO.div,{...a,ref:g,children:i}),n[14]=i,n[15]=g,n[16]=a,n[17]=_):_=n[17],_});fF.displayName=`ThreadPrimitive.ViewportScrollable`;var pF=(0,FS.forwardRef)((e,t)=>{let n=V(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({turnAnchor:a,topAnchorMessageClamp:i,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]!==i||n[5]!==a?(o={turnAnchor:a,topAnchorMessageClamp:i},n[4]=i,n[5]=a,n[6]=o):o=n[6];let s;n[7]!==r||n[8]!==t?(s=(0,B.jsx)(fF,{...r,ref:t}),n[7]=r,n[8]=t,n[9]=s):s=n[9];let c;return n[10]!==o||n[11]!==s?(c=(0,B.jsx)(sO,{options:o,children:s}),n[10]=o,n[11]=s,n[12]=c):c=n[12],c});pF.displayName=`ThreadPrimitive.Viewport`;function pue(e){return e.registerViewport}function mue(e){return e.clientHeight}function hue(e){return e.registerViewportElement}var mF=(0,FS.forwardRef)((e,t)=>{let n=V(3),r=tt(t,cF(rO(gue),_ue)),i;return n[0]!==e||n[1]!==r?(i=(0,B.jsx)(gO.div,{...e,ref:r}),n[0]=e,n[1]=r,n[2]=i):i=n[2],i});mF.displayName=`ThreadPrimitive.ViewportFooter`;function gue(e){return e.registerContentInset}function _ue(e){let t=parseFloat(getComputedStyle(e).marginTop)||0;return e.offsetHeight+t}var vue=bO(`ThreadPrimitive.ScrollToBottom`,e=>{let t=V(5),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{behavior:r}=n,i=rO(yue),a=iO(),o;return t[2]!==r||t[3]!==a?(o=()=>{a.getState().scrollToBottom({behavior:r})},t[2]=r,t[3]=a,t[4]=o):o=t[4],i?null:o},[`behavior`]);function yue(e){return e.isAtBottom}var bue=bO(`ThreadPrimitive.Suggestion`,e=>{let t=V(4),{prompt:n,send:r,clearComposer:i,autoSend:a}=e,o=r??a??!1,s;t[0]!==i||t[1]!==n||t[2]!==o?(s={prompt:n,send:o,clearComposer:i},t[0]=i,t[1]=n,t[2]=o,t[3]=s):s=t[3];let{disabled:c,trigger:l}=foe(s);return c?null:l},[`prompt`,`send`,`clearComposer`,`autoSend`,`method`]),hF=mO({Empty:()=>oF,If:()=>sF,MessageByIndex:()=>rE,Messages:()=>Xae,Root:()=>aF,ScrollToBottom:()=>vue,Suggestion:()=>bue,SuggestionByIndex:()=>ED,Suggestions:()=>kD,Viewport:()=>pF,ViewportFooter:()=>mF,ViewportProvider:()=>sO});function gF({...e}){return(0,B.jsx)(aM,{"data-slot":`popover`,...e})}function _F({...e}){return(0,B.jsx)(oM,{"data-slot":`popover-trigger`,...e})}function vF({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,B.jsx)(sM,{children:(0,B.jsx)(cM,{"data-slot":`popover-content`,align:t,sideOffset:n,className:Bp(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden`,e),...r})})}function yF(e){return(0,B.jsx)(Cj,{"data-slot":`dropdown-menu`,...e})}function bF(e){return(0,B.jsx)(wj,{"data-slot":`dropdown-menu-trigger`,...e})}function xF({className:e,sideOffset:t=4,...n}){return(0,B.jsx)(Tj,{children:(0,B.jsx)(Ej,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:Bp(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,e),...n})})}function SF({className:e,inset:t,variant:n=`default`,...r}){return(0,B.jsx)(Oj,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:Bp(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r})}function CF({className:e,inset:t,...n}){return(0,B.jsx)(Dj,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:Bp(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function wF({className:e,...t}){return(0,B.jsx)(Mj,{"data-slot":`dropdown-menu-separator`,className:Bp(`bg-border -mx-1 my-1 h-px`,e),...t})}function xue(e){return(0,B.jsx)(kj,{"data-slot":`dropdown-menu-radio-group`,...e})}function TF({className:e,children:t,...n}){return(0,B.jsxs)(Aj,{"data-slot":`dropdown-menu-radio-item`,className:Bp(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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`,e),...n,children:[(0,B.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(jj,{children:(0,B.jsx)(Ly,{className:`size-2 fill-current`})})}),t]})}function EF({className:e,type:t,...n}){return(0,B.jsx)(`input`,{type:t,"data-slot":`input`,className:Bp(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function Sue(e,t){let n=[],r=0;for(let i of e)t.has(i.messageId)?n.push(i):r++;return n.sort((e,n)=>{let r=t.get(e.messageId),i=t.get(n.messageId);if(r!==i)return r-i;let a=e.blockIndex??-1,o=n.blockIndex??-1;return a===o?e.createdAt-n.createdAt:a-o}),{ordered:n,unreachableCount:r}}function Cue(e,t,n){if(e.length===0)return null;let r=t===null?-1:e.indexOf(t);return r===-1?n===1?e[0]:e[e.length-1]:e[(r+n+e.length)%e.length]}function DF(e){let t=[];for(let n of e.querySelectorAll(`.oc-md`))if(n.closest(`.oc-msg__meta`)===null)for(let e of n.children)e.tagName===`OL`||e.tagName===`UL`?t.push(...e.children):t.push(e);return t}function OF(e,t){return t===null?e:DF(e)[t]??e}function wue(e,t){let n=null,r=1/0;for(let i of e){let e=Math.abs(i.center-t);e<r&&(r=e,n=i.id)}return n}function kF(e,t=48){let n=e.replace(/\s+/g,` `).trim(),r=Array.from(n);if(r.length<=t)return n;let i=r.slice(0,t).join(``),a=i.lastIndexOf(` `);return(a>t*.6?i.slice(0,a):i)+`…`}var AF={mod:!0,key:`k`},jF={mod:!0,shift:!0,key:`o`},MF={mod:!0,shift:!0,key:`ArrowUp`},NF={mod:!0,shift:!0,key:`ArrowDown`};function Tue(e){return/mac/i.test(e)}function Eue(){if(typeof navigator>`u`)return``;let e=navigator;return e.userAgentData?.platform||e.platform||e.userAgent||``}var PF=null;function FF(){return PF===null&&(PF=Tue(Eue())),PF}var Due={arrowup:`↑`,arrowdown:`↓`,arrowleft:`←`,arrowright:`→`};function IF(e,t){let n=Due[e.key.toLowerCase()]??e.key.toUpperCase();if(t){let t=``;return e.alt&&(t+=`⌥`),e.shift&&(t+=`⇧`),e.mod&&(t+=`⌘`),t+n}let r=[];return e.mod&&r.push(`Ctrl`),e.shift&&r.push(`Shift`),e.alt&&r.push(`Alt`),r.push(n),r.join(`+`)}function LF(e,t){let n=e.metaKey||e.ctrlKey;return!!t.mod!==n||!!t.shift!==e.shiftKey||!!t.alt!==e.altKey?!1:e.key.toLowerCase()===t.key.toLowerCase()?!0:RF(e.code)===t.key.toLowerCase()}function RF(e){if(!e)return null;let t=/^Key([A-Z])$/.exec(e);if(t?.[1])return t[1].toLowerCase();let n=/^Digit([0-9])$/.exec(e);return n?.[1]?n[1]:null}function Oue(e){if(!/^[a-z0-9]$/i.test(e.key)||!e.mod&&!e.alt)return!1;let t=t=>!!e.mod==!!t.mod&&!!e.shift==!!t.shift&&!!e.alt==!!t.alt&&e.key.toLowerCase()===t.key.toLowerCase();return!t(AF)&&!t(jF)}function kue(e){if([`Shift`,`Control`,`Meta`,`Alt`].includes(e.key))return null;let t=/^[a-z0-9]$/i.test(e.key)?e.key.toLowerCase():RF(e.code)??e.key.toLowerCase(),n={...e.metaKey||e.ctrlKey?{mod:!0}:{},...e.shiftKey?{shift:!0}:{},...e.altKey?{alt:!0}:{},key:t};return Oue(n)?n:null}var zF=(0,z.createContext)(null);function BF(){return(0,z.useContext)(zF)}function VF(e,t,n,r){let i=!1,a=0,o=0,s=()=>{if(i)return;let c=document.querySelector(`[data-message-id="${CSS.escape(e)}"]`);if(c){let e=OF(c,t),i=c.closest(`.oc-thread__viewport`);if(!(()=>{if(!r?.skipScrollIfVisible||!i)return!1;let t=e.getBoundingClientRect(),n=i.getBoundingClientRect();return t.top>=n.top&&t.top<=n.bottom-48})())if(i){let t=e.getBoundingClientRect().top-i.getBoundingClientRect().top;i.scrollTo({top:i.scrollTop+t-Math.max(24,i.clientHeight*.3),behavior:n})}else e.scrollIntoView({block:`center`,behavior:n});let a=t===null?c:e,o=t===null?`oc-msg--highlight`:`oc-anchor--flash`;a.classList.remove(o),a.offsetWidth,a.classList.add(o),window.setTimeout(()=>a.classList.remove(o),2400);return}a++<40&&(o=window.setTimeout(s,150))};return o=window.setTimeout(s,0),()=>{i=!0,window.clearTimeout(o)}}function Aue({chatId:e,focusMessageId:t,children:n}){let r=I(L.chatBookmarks.getBookmarks,{chatId:e}),i=Nt(L.chatBookmarks.toggleBookmark),a=Nt(L.chatBookmarks.removeBookmark),o=Nt(L.chatBookmarks.renameBookmark),s=Nt(L.chatBookmarks.setActiveBookmark),[c,l]=(0,z.useState)(null);(0,z.useEffect)(()=>{l(null)},[e]);let u=r?.activeBookmarkId??null;(0,z.useEffect)(()=>{c!==null&&u===c&&l(null)},[u,c]);let d=(0,z.useMemo)(()=>(r?.bookmarks??[]).map(e=>({id:e._id,messageId:e.messageId,blockIndex:e.blockIndex,label:e.label,createdAt:e.createdAt})),[r?.bookmarks]),f=c??u,p=(0,z.useMemo)(()=>{let e=new Map;for(let t of d){let n=e.get(t.messageId);n?n.push(t):e.set(t.messageId,[t])}return e},[d]),m=(0,z.useCallback)(t=>{l(t.id),VF(t.messageId,t.blockIndex,`smooth`),s({chatId:e,bookmarkId:t.id})},[e,s]),h=(0,z.useCallback)(t=>{l(t),s({chatId:e,bookmarkId:t})},[e,s]),g=(0,z.useMemo)(()=>({rows:d,activeId:f,byMessage:p,toggle:(t,n)=>void i({chatId:e,messageId:t,...n===null?{}:{blockIndex:n}}).then(e=>{e?.placed===!0&&VF(t,n,`smooth`,{skipScrollIfVisible:!0})}),remove:e=>void a({bookmarkId:e}),rename:(e,t)=>void o({bookmarkId:e,label:t}),jumpTo:m,setActiveQuiet:h}),[d,f,p,e,i,a,o,m,h]),_=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(_.current===e||r===void 0||(_.current=e,t!==null)||f===null)return;let n=d.find(e=>e.id===f);if(n!==void 0)return VF(n.messageId,n.blockIndex,`auto`)},[e,r===void 0]),(0,B.jsx)(zF.Provider,{value:g,children:n})}function jue(e){let t=e.target;return t instanceof HTMLElement?t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable:!1}function Mue(e){if(e.label!==null&&e.label.length>0)return e.label;let t=document.querySelector(`[data-message-id="${CSS.escape(e.messageId)}"]`);if(t){let n=kF(OF(t,e.blockIndex).textContent??``);if(n.length>0)return n}return Ws()}function Nue(){let e=BF(),t=fO(e=>e.messages.length),[n,r]=(0,z.useState)([]),[i,a]=(0,z.useState)(0),o=e?.rows;(0,z.useEffect)(()=>{if(!o||o.length===0){r([]),a(0);return}let e=!1,t=0,n=0,i=()=>{if(e)return;let s=new Map;document.querySelectorAll(`.oc-thread__viewport [data-message-id]`).forEach((e,t)=>s.set(e.dataset.messageId??``,t));let c=Sue(o,s);r(c.ordered),a(c.unreachableCount),c.ordered.length===0&&t++<40&&(n=window.setTimeout(i,150))};return i(),()=>{e=!0,window.clearTimeout(n)}},[o,t]);let[s,c]=(0,z.useState)(null),l=(0,z.useRef)(0),u=(0,z.useRef)(null),d=s!==null&&n.some(e=>e.id===s)?s:e?.activeId??null;(0,z.useEffect)(()=>{if(!e||n.length===0)return;let t=document.querySelector(`.oc-thread__viewport`);if(!t)return;let r=0,i=0,a=()=>{r===0&&(r=window.requestAnimationFrame(()=>{if(r=0,Date.now()-l.current<1200)return;let a=t.getBoundingClientRect(),o=a.top+a.height/2,s=[];for(let e of n){let n=t.querySelector(`[data-message-id="${CSS.escape(e.messageId)}"]`);if(!n)continue;let r=OF(n,e.blockIndex).getBoundingClientRect();s.push({id:e.id,center:(r.top+r.bottom)/2})}let d=wue(s,o);d!==null&&(c(d),u.current=d===e.activeId?null:d,window.clearTimeout(i),i=window.setTimeout(()=>{let t=u.current;u.current=null,t!==null&&e.setActiveQuiet(t)},800))}))};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{t.removeEventListener(`scroll`,a),r!==0&&window.cancelAnimationFrame(r),window.clearTimeout(i);let n=u.current;u.current=null,n!==null&&e.setActiveQuiet(n)}},[e,n]);let f=(0,z.useCallback)(t=>{e&&(l.current=Date.now(),c(t.id),e.jumpTo(t))},[e]),p=(0,z.useCallback)(e=>{let t=Cue(n.map(e=>e.id),d,e),r=n.find(e=>e.id===t);r&&f(r)},[n,d,f]);if((0,z.useEffect)(()=>{if(n.length===0)return;let e=e=>{jue(e)||(LF(e,MF)?(e.preventDefault(),p(-1)):LF(e,NF)&&(e.preventDefault(),p(1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n.length,p]),!e||e.rows.length===0)return null;let m=n.findIndex(e=>e.id===d),h=`${m===-1?`–`:m+1}/${n.length}`;return(0,B.jsxs)(`div`,{className:`oc-bmk-rail`,role:`navigation`,"aria-label":Ip(),title:i>0?xr({count:String(i)}):void 0,children:[(0,B.jsx)(Ih,{variant:`ghost`,size:`icon`,className:`oc-bmk-rail__btn`,onClick:()=>p(-1),disabled:n.length===0,title:`${lc()} (${IF(MF,FF())})`,"aria-label":lc(),children:(0,B.jsx)(Ny,{size:14})}),(0,B.jsxs)(yF,{children:[(0,B.jsx)(bF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-bmk-rail__count`,title:Ts(),"aria-label":Ts(),children:[(0,B.jsx)(Ty,{size:11,"aria-hidden":!0}),(0,B.jsx)(`span`,{"aria-live":`polite`,children:h})]})}),(0,B.jsxs)(xF,{side:`left`,align:`center`,className:`oc-bmk-menu`,children:[n.map(e=>(0,B.jsxs)(SF,{className:e.id===d?`oc-bmk-menu__item--current`:void 0,onSelect:()=>f(e),children:[(0,B.jsx)(Ty,{size:12,"aria-hidden":!0,className:`oc-bmk-menu__flag`}),(0,B.jsx)(`span`,{className:`oc-bmk-menu__text`,children:Mue(e)})]},e.id)),i>0?(0,B.jsx)(`div`,{className:`oc-bmk-menu__foot`,children:xr({count:String(i)})}):null]})]}),(0,B.jsx)(Ih,{variant:`ghost`,size:`icon`,className:`oc-bmk-rail__btn`,onClick:()=>p(1),disabled:n.length===0,title:`${nr()} (${IF(NF,FF())})`,"aria-label":nr(),children:(0,B.jsx)(Ay,{size:14})})]})}var HF=class extends z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){}render(){return this.state.failed?null:this.props.children}};function UF(e={}){return(0,B.jsx)(HF,{children:(0,B.jsx)(Pue,{...e})})}function Pue({messageLevelMarkers:e=!0,onReplyToBlock:t}={}){let n=BF(),r=U(e=>e.id),i=U(e=>e.status?.type===`running`),a=(0,z.useRef)(null),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(new Map),f=n?.byMessage.get(r),p=(0,z.useMemo)(()=>e?f:f?.filter(e=>e.blockIndex!==null),[f,e]);if((0,z.useEffect)(()=>{let e=a.current?.closest(`.oc-msg`);s(e?.querySelector(`.oc-msg__body`)??e?.querySelector(`.oc-msg__bubble`)??null)},[r]),(0,z.useEffect)(()=>{if(!o||i||!n)return;let e=o.closest(`.oc-msg`)??o,t=0,r=e=>{t===0&&(t=window.requestAnimationFrame(()=>{t=0;let n=DF(o),r=o.getBoundingClientRect().top,i=null,a=1/0;for(let t=0;t<n.length;t++){let o=n[t].getBoundingClientRect();if(e.clientY>=o.top&&e.clientY<=o.bottom){l({top:o.top-r,blockIndex:t});return}let s=e.clientY<o.top?o.top-e.clientY:e.clientY-o.bottom;s<a&&(a=s,i={top:o.top-r,blockIndex:t})}l(a<=16?i:null)}))},a=()=>{t!==0&&(window.cancelAnimationFrame(t),t=0),l(null)};return e.addEventListener(`mousemove`,r),e.addEventListener(`mouseleave`,a),()=>{e.removeEventListener(`mousemove`,r),e.removeEventListener(`mouseleave`,a),t!==0&&window.cancelAnimationFrame(t)}},[o,i,n]),(0,z.useEffect)(()=>{if(!o||!p||p.length===0){d(new Map);return}let e=()=>{let e=o.getBoundingClientRect().top,t=new Map;for(let n of p){let r=OF(o,n.blockIndex);t.set(n.id,r.getBoundingClientRect().top-e)}d(t)};e();let t=new ResizeObserver(e);return t.observe(o),()=>t.disconnect()},[o,p]),!n||!o)return(0,B.jsx)(`span`,{ref:a,hidden:!0});let m=c!==null&&(p??[]).some(e=>e.blockIndex===c.blockIndex);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{ref:a,hidden:!0}),(0,Fv.createPortal)((0,B.jsxs)(B.Fragment,{children:[c!==null&&!i?(0,B.jsxs)(`span`,{className:`oc-bmk-gutterrow`,style:{top:c.top},children:[t?(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-gutter oc-bmk-gutter--reply`,title:Qs(),"aria-label":Qs(),onClick:()=>{let e=kF(OF(o,c.blockIndex).textContent??``,280);e!==``&&t(c.blockIndex,e)},children:(0,B.jsx)(Lb,{size:14})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-gutter${m?` is-set`:``}`,title:m?su():bm(),"aria-label":m?su():bm(),onClick:()=>n.toggle(r,c.blockIndex),children:(0,B.jsx)(Ty,{size:14})})]}):null,(p??[]).map(e=>{let t=u.get(e.id);return t===void 0?null:(0,B.jsx)(Fue,{bookmark:e,top:t},e.id)})]}),o)]})}function WF({bookmark:e,trigger:t}){let n=BF(),[r,i]=(0,z.useState)(e.label??``),[a,o]=(0,z.useState)(!1);return n?(0,B.jsxs)(gF,{open:a,onOpenChange:t=>{o(t),t&&i(e.label??``)},children:[(0,B.jsx)(_F,{asChild:!0,children:t}),(0,B.jsx)(vF,{side:`left`,align:`start`,className:`oc-bmk-pop`,children:(0,B.jsxs)(`form`,{className:`oc-bmk-pop__form`,onSubmit:t=>{t.preventDefault(),n.rename(e.id,r),o(!1)},children:[(0,B.jsx)(EF,{value:r,onChange:e=>i(e.target.value),placeholder:Ec(),maxLength:60,autoFocus:!0}),(0,B.jsxs)(`div`,{className:`oc-bmk-pop__actions`,children:[(0,B.jsx)(Ih,{type:`submit`,size:`sm`,variant:`secondary`,children:C()}),(0,B.jsxs)(Ih,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{n.remove(e.id),o(!1)},children:[(0,B.jsx)($b,{size:14,"aria-hidden":!0}),Ca()]})]})]})})]}):null}function Fue({bookmark:e,top:t}){return(0,B.jsx)(WF,{bookmark:e,trigger:(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-marker`,style:{top:t},title:e.label??Ws(),"aria-label":e.label??Ws(),children:(0,B.jsx)(Ty,{size:14})})})}function GF(e){return(0,B.jsx)(HF,{children:(0,B.jsx)(Iue,{...e})})}function Iue({header:e=!1}){let t=BF(),n=U(e=>e.id),r=t?.byMessage.get(n)?.find(e=>e.blockIndex===null)??null;if(!t)return null;let i=r!==null,a=e?`oc-bmk-headbtn${i?` is-set`:``}`:`oc-iconbtn${i?` oc-iconbtn--bmk-set`:``}`;return e&&r!==null?(0,B.jsx)(WF,{bookmark:r,trigger:(0,B.jsx)(`button`,{type:`button`,className:a,title:r.label??Ws(),"aria-label":r.label??Ws(),children:(0,B.jsx)(Ty,{size:13})})}):(0,B.jsx)(`button`,{type:`button`,className:a,title:i?su():bm(),"aria-label":i?su():bm(),onClick:()=>t.toggle(n,null),children:(0,B.jsx)(Ty,{size:e?13:15})})}var KF=z.createContext(null),Lue=6e3;function qF(e){let t=e?.data;if(typeof t==`string`&&t)return t;if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return String(e)}catch{return Um()}}function Rue({children:e}){let[t,n]=z.useState([]),r=z.useRef(0),i=z.useRef(new Map),a=z.useCallback(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t!==void 0&&(window.clearTimeout(t),i.current.delete(e))},[]),o=z.useCallback(e=>{let t=r.current++,o={id:t,variant:e.variant??`info`,title:e.title,description:e.description};n(e=>[...e,o]);let s=window.setTimeout(()=>a(t),Lue);i.current.set(t,s)},[a]);z.useEffect(()=>{let e=i.current;return()=>{for(let t of e.values())window.clearTimeout(t);e.clear()}},[]);let s=z.useMemo(()=>({toast:o,error:(e,t)=>o({variant:`error`,title:e,description:t===void 0?void 0:qF(t)}),success:(e,t)=>o({variant:`success`,title:e,description:t})}),[o]);return(0,B.jsxs)(KF.Provider,{value:s,children:[e,(0,B.jsx)(`div`,{className:`oc-toast__viewport`,role:`region`,"aria-label":Pc(),children:t.map(e=>(0,B.jsxs)(`div`,{className:Bp(`oc-toast`,`oc-toast--${e.variant}`),role:e.variant===`error`?`alert`:`status`,children:[(0,B.jsxs)(`div`,{className:`oc-toast__body`,children:[(0,B.jsx)(`div`,{className:`oc-toast__title`,children:e.title}),e.description?(0,B.jsx)(`div`,{className:`oc-toast__desc`,children:e.description}):null]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-toast__close`,"aria-label":Fc(),onClick:()=>a(e.id),children:(0,B.jsx)(xh,{"aria-hidden":!0})})]},e.id))})]})}function JF(){let e=z.useContext(KF);if(!e)throw Error(`useToast must be used within <ToastProvider>`);return e}function YF(e){let t=(0,z.useRef)(null),n=(0,z.useRef)(e);return n.current=e,(0,z.useEffect)(()=>{let e=e=>{t.current!==null&&(n.current(e.clientX-t.current.x,e.clientY-t.current.y),t.current={x:e.clientX,y:e.clientY})},r=()=>{t.current=null};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,r),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,r)}},[]),e=>{t.current={x:e.clientX,y:e.clientY}}}function zue(){let e=(0,z.useSyncExternalStore)(px,mx),t=Nv(),n=JF();(0,z.useEffect)(()=>()=>void wx(),[]);let r=(0,z.useCallback)((e,t)=>{let n=mx()?.geom;n!==void 0&&bx({...n,x:n.x+e,y:n.y+t})},[]),i=(0,z.useCallback)((e,t)=>{let n=mx()?.geom;n!==void 0&&bx({...n,w:n.w+e,h:n.h+t})},[]),a=YF(r),o=YF(i);(0,z.useEffect)(()=>{let e=()=>{let e=mx()?.geom;e!==void 0&&bx(e)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let s=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>s.current?.stop(),[]);let c=e?.recording??!1,l=(0,z.useCallback)(()=>{if(mx()?.recording===!0){let e=_x();s.current?.stop(),s.current=null,Ine(),window.setTimeout(()=>Cx(e),1500);return}if(!Mx())return;let e=mx()?.voiceLang||Ex(``,Jd()),t={h:null,gen:0},r=()=>{s.current===t.h&&(s.current=null),Cx(t.gen)},i=Nx({lang:e,onText:(e,n)=>{t.gen===_x()&&vx(e,n.paragraph)},onInterim:e=>{t.gen===_x()&&yx(e)},onEnd:r,onError:e=>{r(),e===`not-allowed`||e===`service-not-allowed`?n.error(ta()):e!==`no-speech`&&e!==`aborted`&&n.error(ti({code:e}))}});if(i===null){n.error(bi());return}t.h=i,s.current=i,gx(()=>i.stop()),t.gen=_x()},[n]),u=qx(e?.targetChatId??null);if(e===null)return null;let d=hx(e.geom,{w:window.innerWidth,h:window.innerHeight});return(0,Fv.createPortal)((0,B.jsxs)(`div`,{className:`oc-detach${c?` oc-detach--live`:``}`,style:{left:`${d.x}px`,top:`${d.y}px`,width:`${d.w}px`,height:`${d.h}px`},role:`dialog`,"aria-label":Nl(),children:[(0,B.jsx)(`div`,{className:`oc-detach__handle`,onPointerDown:a,title:of(),"aria-label":of(),children:(0,B.jsx)(sb,{size:16,"aria-hidden":!0})}),(0,B.jsxs)(`div`,{className:`oc-detach__head`,onPointerDown:a,children:[c?(0,B.jsxs)(`span`,{className:`oc-detach__wave`,"aria-hidden":!0,children:[(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{})]}):null,(0,B.jsx)(`span`,{className:`oc-detach__chip`,title:e.targetLabel,children:e.targetLabel||Nl()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__close`,title:im(),"aria-label":im(),onPointerDown:e=>e.stopPropagation(),onClick:()=>{Hne(e.targetChatId),wx()},children:(0,B.jsx)(xh,{size:14,"aria-hidden":!0})})]}),u.length>0?(0,B.jsx)(`div`,{className:`oc-detach__quotes`,children:u.map(n=>(0,B.jsxs)(`div`,{className:`oc-detach__quote`,role:`group`,"aria-label":Bt(),children:[(0,B.jsx)(Lb,{size:12,"aria-hidden":!0,className:`oc-detach__quote-ico`}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__quote-text`,title:dr(),onClick:()=>{VF(n.messageId,n.blockIndex,`smooth`),t({to:`/chat/$chatId`,params:{chatId:e.targetChatId}})},children:n.excerpt}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__quote-x`,"aria-label":hs(),onClick:()=>Ux(e.targetChatId,Wx(n)),children:(0,B.jsx)(xh,{size:12,"aria-hidden":!0})})]},Wx(n)))}):null,(0,B.jsx)(`textarea`,{className:`oc-detach__input`,value:e.text,placeholder:Nl(),onChange:e=>jne(e.target.value),readOnly:e.sending,autoFocus:!0}),c&&e.interim!==``?(0,B.jsx)(`div`,{className:`oc-detach__interim`,"aria-hidden":!0,children:e.interim}):null,(0,B.jsxs)(`div`,{className:`oc-detach__bar`,children:[e.voiceEnabled&&Mx()?(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__icon${c?` oc-detach__icon--rec`:``}`,title:c?Ot():Pn(),"aria-label":c?Ot():Pn(),"aria-pressed":c,disabled:e.sending,onClick:l,children:c?(0,B.jsx)(bb,{size:16,"aria-hidden":!0}):(0,B.jsx)(xb,{size:16,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__icon`,title:c?nl():tp(),"aria-label":tp(),disabled:e.sending||c,onClick:()=>{Sx(),t({to:`/chat/$chatId`,params:{chatId:e.targetChatId}})},children:(0,B.jsx)(Pb,{size:16,"aria-hidden":!0})}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-detach__send`,disabled:e.text.trim()===``||c||e.sending,title:c?nl():ql(),"aria-label":ql(),onClick:()=>{Mne(e.text),t({to:`/chat/$chatId`,params:{chatId:e.targetChatId}})},children:[(0,B.jsx)(Hb,{size:15,"aria-hidden":!0}),ql()]})]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__resize`,"aria-label":Pm(),onPointerDown:o})]}),document.body)}var Bue=Ef(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function XF({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,B.jsx)(n?Wa:`span`,{"data-slot":`badge`,"data-variant":t,className:Bp(Bue({variant:t}),e),...r})}function ZF({...e}){return(0,B.jsx)(cse,{"data-slot":`alert-dialog`,...e})}function Vue({...e}){return(0,B.jsx)(lse,{"data-slot":`alert-dialog-portal`,...e})}function Hue({className:e,...t}){return(0,B.jsx)(use,{"data-slot":`alert-dialog-overlay`,className:Bp(`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 QF({className:e,...t}){return(0,B.jsxs)(Vue,{children:[(0,B.jsx)(Hue,{}),(0,B.jsx)(dse,{"data-slot":`alert-dialog-content`,className:Bp(`fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover bg-clip-padding p-5 text-sm text-popover-foreground shadow-lg duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})]})}function $F({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:Bp(`flex flex-col gap-1.5`,e),...t})}function eI({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:Bp(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function tI({className:e,...t}){return(0,B.jsx)(mse,{"data-slot":`alert-dialog-title`,className:Bp(`text-base font-medium text-foreground`,e),...t})}function nI({className:e,...t}){return(0,B.jsx)(hse,{"data-slot":`alert-dialog-description`,className:Bp(`text-sm text-muted-foreground`,e),...t})}function rI({className:e,...t}){return(0,B.jsx)(fse,{className:Bp(Fh(),e),...t})}function iI({className:e,...t}){return(0,B.jsx)(pse,{className:Bp(Fh({variant:`outline`}),e),...t})}function aI(e,t,n){if(e===`*`)return{kind:`any`};let r=/^\*\/(\d{1,3})$/.exec(e);if(r!==null){let e=Number(r[1]);return e>=1?{kind:`step`,n:e}:null}let i=[];for(let r of e.split(`,`)){let e=/^(\d{1,3})-(\d{1,3})$/.exec(r);if(e!==null){let r=Number(e[1]),a=Number(e[2]);if(r>a||r<t||a>n)return null;for(let e=r;e<=a;e++)i.push(e);continue}if(!/^\d{1,3}$/.test(r))return null;let a=Number(r);if(a<t||a>n)return null;i.push(a)}return i.length>0&&i.length<=31?{kind:`values`,values:i}:null}function Uue(e,t){let n=new Date(2024,0,1,e,t);return new Intl.DateTimeFormat(Jd(),{hour:`2-digit`,minute:`2-digit`}).format(n)}function Wue(e){let t=new Date(2024,8,1+e%7);return new Intl.DateTimeFormat(Jd(),{weekday:`long`}).format(t)}function Gue(e){let t=new Date(2024,e-1,1);return new Intl.DateTimeFormat(Jd(),{month:`long`}).format(t)}function Kue(e){try{return new Intl.ListFormat(Jd(),{style:`long`,type:`conjunction`}).format(e)}catch{return e.join(`, `)}}function oI(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=aI(t[0],0,59),r=aI(t[1],0,23),i=aI(t[2],1,31),a=aI(t[3],1,12),o=aI(t[4],0,7);if(!n||!r||!i||!a||!o)return null;if(r.kind===`any`&&i.kind===`any`&&a.kind===`any`&&o.kind===`any`)return n.kind===`any`?gt():n.kind===`step`?60%n.n==0?Wi({n:n.n}):null:n.values.length===1?li({m:String(n.values[0]).padStart(2,`0`)}):null;if(r.kind===`step`&&n.kind===`values`&&n.values.length===1&&i.kind===`any`&&a.kind===`any`&&o.kind===`any`)return 24%r.n==0?Kr({n:r.n}):null;if(n.kind!==`values`||n.values.length!==1||r.kind!==`values`||r.values.length!==1)return null;let s=Uue(r.values[0],n.values[0]);if(o.kind===`values`&&i.kind===`any`&&a.kind===`any`)return E({days:Kue([...new Set(o.values.map(e=>e%7))].sort((e,t)=>e-t).map(Wue)),time:s});if(o.kind!==`any`)return null;if(i.kind===`any`&&a.kind===`any`)return vd({time:s});if(i.kind===`values`&&i.values.length===1){if(a.kind===`any`)return Fd({dom:i.values[0],time:s});if(a.kind===`values`&&a.values.length===1)return ki({dom:i.values[0],month:Gue(a.values[0]),time:s})}return null}function sI(e){if(e===null)return null;let t=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(|$)/.exec(e.trim());return t===null?null:t[1]}function cI({icon:e,label:t,sublabel:n,trailing:r,tone:i=`default`,active:a,open:o,onClick:s,title:c,ariaLabel:l,ariaExpanded:u,ariaHasPopup:d,inert:f=!1}){return f?(0,B.jsxs)(`div`,{className:`oc-actrow oc-actrow--${i} oc-actrow--inert`,title:c,children:[(0,B.jsxs)(`span`,{className:`oc-actrow__top`,children:[(0,B.jsx)(`span`,{className:`oc-actrow__icon`,"aria-hidden":!0,children:e}),(0,B.jsx)(`span`,{className:`oc-actrow__label`,children:t}),r?(0,B.jsx)(`span`,{className:`oc-actrow__trail`,children:r}):null]}),n?(0,B.jsx)(`span`,{className:`oc-actrow__sub`,children:n}):null]}):(0,B.jsxs)(`button`,{type:`button`,className:`oc-actrow oc-actrow--${i}${a?` is-active`:``}${o?` is-open`:``}`,onClick:s,title:c,"aria-label":l,"aria-expanded":u,"aria-haspopup":d?`dialog`:void 0,children:[(0,B.jsxs)(`span`,{className:`oc-actrow__top`,children:[(0,B.jsx)(`span`,{className:`oc-actrow__icon`,"aria-hidden":!0,children:e}),(0,B.jsx)(`span`,{className:`oc-actrow__label`,children:t}),r?(0,B.jsx)(`span`,{className:`oc-actrow__trail`,children:r}):null,(0,B.jsx)(My,{size:14,className:`oc-actrow__chev`,"aria-hidden":!0})]}),n?(0,B.jsx)(`span`,{className:`oc-actrow__sub`,children:n}):null]})}var lI=(0,z.createContext)(null),que=[];function Jue(e){return e===`created`?(0,B.jsx)(Ib,{size:12,"aria-hidden":!0}):e===`removed`?(0,B.jsx)($b,{size:12,"aria-hidden":!0}):(0,B.jsx)(jb,{size:12,"aria-hidden":!0})}function uI(e){return e===`created`?It():e===`removed`?ko():ds()}function Yue(){let e=U(e=>e.metadata?.custom?.cronParts??que),t=U(e=>e.metadata?.custom?.routedInstanceName??null),n=U(e=>e.id),r=(0,z.useContext)(lI),[i,a]=(0,z.useState)(!0);return e.length===0?null:(0,B.jsxs)(`div`,{className:`oc-cronact`,children:[(0,B.jsx)(cI,{icon:(0,B.jsx)(Oy,{size:14}),label:Js({count:e.length}),open:i,ariaExpanded:i,title:Vn(),onClick:()=>a(!i)}),i?(0,B.jsx)(`div`,{className:`oc-cronact__list`,children:e.map((e,i)=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-cronact__item${r?.active!==null&&r?.active!==void 0&&r.active.jobId===(e.jobId??null)&&r.active.occurrenceId===`${n}#${i}`?` oc-cronact__item--active`:``}`,onClick:()=>r?.openFor(e,t,`${n}#${i}`),title:Sp(),children:[(0,B.jsxs)(`span`,{className:`oc-cronact__op oc-cronact__op--${e.op}`,children:[Jue(e.op),uI(e.op)]}),(0,B.jsx)(`span`,{className:`oc-cronact__name`,children:e.name??e.jobId??sr()}),e.schedule===void 0?null:(0,B.jsx)(`span`,{className:`oc-cronact__sched`,children:e.schedule})]},`${e.jobId??`job`}-${i}`))}):null]})}function dI(e){return typeof e==`number`?new Intl.DateTimeFormat(Jd(),{dateStyle:`medium`,timeStyle:`short`}).format(e):`—`}function Xue(e){return e===`ok`?(0,B.jsx)(XF,{variant:`secondary`,children:Vu()}):e===`error`?(0,B.jsx)(XF,{variant:`destructive`,children:sp()}):e===`skipped`?(0,B.jsx)(XF,{variant:`outline`,children:Sn()}):(0,B.jsx)(XF,{variant:`outline`,children:e??`—`})}function fI({instanceName:e,part:t,onClose:n,onChanged:r}){let i=Ei(L.scheduled.getCronDetail),a=Ei(L.scheduled.listCronRuns),o=Ei(L.scheduled.updateCron),s=Ei(L.scheduled.removeCron),c=Ei(L.scheduled.runCronNow),l=JF(),u=t.jobId??null,[d,f]=(0,z.useState)(null),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(`loading`),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(!1),C=(0,z.useRef)(0),w=(0,z.useCallback)(async()=>{let n=++C.current;if(f(null),m(null),g(null),u===null||t.op===`removed`){v(t.op===`removed`?`gone`:`error`);return}v(`loading`);try{let t=await i({instanceName:e,jobId:u});if(n!==C.current)return;if(f(t.job),m(t.capabilities),v(`ready`),t.capabilities.canHistory)try{let t=await a({instanceName:e,jobId:u,limit:5});if(n!==C.current)return;g(t)}catch{n===C.current&&g(null)}}catch(e){if(n!==C.current)return;let t=e?.data?.code;v(t===`not_found`?`gone`:`error`)}},[i,a,e,u,t.op]);(0,z.useEffect)(()=>{w()},[w]);let T=(0,z.useRef)(``);(0,z.useEffect)(()=>{T.current=`${e}:${u??``}`,b(null)},[e,u]);let E=async(t,n,i)=>{let a=`${e}:${u??``}`;b(t);try{if(await n(),T.current!==a)return;l.success(i),r?.(),await w()}catch(e){let t=e?.data?.code??`unknown`;l.toast({variant:`error`,title:po({code:t})})}finally{T.current===a&&b(e=>e===t?null:e)}},O=d??{id:u,name:t.name??null,enabled:t.enabled??null,schedule:t.schedule??null,message:t.message??null,deliveryMode:t.deliveryMode??null,agentId:t.agentId??null,nextRunAtMs:t.nextRunAtMs??null,lastRunStatus:null,lastDelivered:null,lastDeliveryError:null,updatedAtMs:null};return(0,B.jsxs)(`div`,{className:`oc-cronpanel`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__head`,children:[(0,B.jsx)(Oy,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cronpanel__title`,title:O.name??void 0,children:O.name??sr()}),(0,B.jsx)(XF,{variant:`outline`,children:uI(t.op)}),(0,B.jsx)(Ih,{variant:`ghost`,size:`icon`,onClick:n,"aria-label":nn(),children:(0,B.jsx)(xh,{"aria-hidden":!0})})]}),_===`loading`?(0,B.jsxs)(`div`,{className:`oc-cronpanel__loading`,children:[(0,B.jsx)(pb,{size:16,className:`oc-actrow__spin`,"aria-hidden":!0}),qo()]}):null,_===`gone`?(0,B.jsx)(`div`,{className:`oc-cronpanel__notice`,children:ce()}):null,_===`error`?(0,B.jsx)(`div`,{className:`oc-cronpanel__notice`,children:Hee()}):null,(0,B.jsxs)(`dl`,{className:`oc-cronpanel__facts`,children:[(0,B.jsx)(`dt`,{children:Oa()}),(0,B.jsx)(`dd`,{children:O.enabled===!0?(0,B.jsx)(XF,{variant:`secondary`,children:pc()}):O.enabled===!1?(0,B.jsx)(XF,{variant:`outline`,children:ua()}):`—`}),(0,B.jsx)(`dt`,{children:Dr()}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`span`,{className:`oc-cronpanel__mono`,children:O.schedule??`—`}),(()=>{let e=sI(O.schedule),t=e===null?null:oI(e);return t===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:t})})()]}),(0,B.jsx)(`dt`,{children:Cn()}),(0,B.jsx)(`dd`,{children:dI(O.nextRunAtMs)}),(0,B.jsx)(`dt`,{children:_t()}),(0,B.jsx)(`dd`,{children:O.agentId??`—`}),O.deliveryMode===null?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:Gi()}),(0,B.jsx)(`dd`,{children:O.deliveryMode})]}),O.lastDelivered===!1?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:ui()}),(0,B.jsxs)(`dd`,{className:`oc-cronpanel__undelivered`,children:[qr(),O.lastDeliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:O.lastDeliveryError})]})]}):null]}),O.message===null?null:(0,B.jsxs)(`div`,{className:`oc-cronpanel__message`,children:[(0,B.jsx)(`div`,{className:`oc-cronpanel__message-label`,children:yd()}),(0,B.jsx)(`div`,{className:`oc-cronpanel__message-body`,children:O.message})]}),_===`ready`&&p!==null&&u!==null?(0,B.jsxs)(`div`,{className:`oc-cronpanel__actions`,children:[p.canRunNow?(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,disabled:y!==null,onClick:()=>E(`run`,async()=>{let t=await c({instanceName:e,jobId:u});if(t.ran!==!0&&t.runId===null)throw{data:{code:t.reason??`run_not_started`}}},th()),children:[y===`run`?(0,B.jsx)(pb,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(ix,{size:14,"aria-hidden":!0}),D()]}):null,p.canToggle&&O.enabled!==null?(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,disabled:y!==null,onClick:()=>E(`toggle`,()=>o({instanceName:e,jobId:u,patch:{enabled:!(O.enabled??!1)}}),O.enabled===!0?Ee():Ka()),children:[O.enabled===!0?(0,B.jsx)(Ab,{size:14,"aria-hidden":!0}):(0,B.jsx)(Fb,{size:14,"aria-hidden":!0}),O.enabled===!0?Id():Ai()]}):null,p.canDelete?(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,disabled:y!==null,onClick:()=>S(!0),children:[(0,B.jsx)($b,{size:14,"aria-hidden":!0}),He()]}):null,(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,B.jsxs)(qv,{to:`/settings/$tab`,params:{tab:`scheduled`},search:u===null?void 0:{job:u},children:[(0,B.jsx)(Jy,{size:14,"aria-hidden":!0}),rt()]})})]}):null,h!==null&&h.length>0?(0,B.jsxs)(`div`,{className:`oc-cronpanel__runs`,children:[(0,B.jsx)(`div`,{className:`oc-cronpanel__runs-label`,children:Ou()}),h.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[Xue(e.status),(0,B.jsx)(`span`,{children:dI(e.runAtMs??e.ts)}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[ff({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))]}):null,(0,B.jsx)(ZF,{open:x,onOpenChange:S,children:(0,B.jsxs)(QF,{children:[(0,B.jsxs)($F,{children:[(0,B.jsx)(tI,{children:cl()}),(0,B.jsx)(nI,{children:Aee({name:O.name??u??``})})]}),(0,B.jsxs)(eI,{children:[(0,B.jsx)(iI,{children:Bm()}),(0,B.jsx)(rI,{onClick:()=>{u!==null&&E(`delete`,()=>s({instanceName:e,jobId:u}),gee())},children:jc()})]})]})})]})}var pI=class extends z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){}render(){return this.state.failed?(0,B.jsxs)(`div`,{className:`oc-panel-failed`,children:[(0,B.jsx)(`p`,{children:se()}),this.props.onClose===void 0?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-panel-failed__close`,onClick:this.props.onClose,children:_h()})]}):this.props.children}},Zue=[`github-light`,`github-dark`],Que=[`code`,`math`,`cjk`];function $ue(e,t){let n={};for(let r of Que){let i=e?.[r];if(i===!1)continue;let a=i||t[r];a&&(n[r]=a)}let r=e?.mermaid;return r&&r!==!1&&(n.mermaid=r),n}function mI(e){return typeof e==`object`&&!!e&&`type`in e&&`key`in e}function ede(e,t){return e===t?!0:!mI(e)||!mI(t)?!1:e.type===t.type&&e.key===t.key}function tde(e,t){let n=Object.keys(e).filter(e=>e!==`children`),r=Object.keys(t).filter(e=>e!==`children`);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return ede(e.children,t.children)}var nde=(0,z.createContext)(null),rde=(0,z.memo)(function({children:e,node:t,...n}){let r=(0,z.isValidElement)(e)?(0,z.cloneElement)(e,{"data-block":`true`}):e;return(0,B.jsx)(nde.Provider,{value:{node:t,...n},children:r})},tde),ide=Object.defineProperty,ade=Object.defineProperties,ode=Object.getOwnPropertyDescriptors,hI=Object.getOwnPropertySymbols,sde=Object.prototype.hasOwnProperty,cde=Object.prototype.propertyIsEnumerable,gI=(e,t,n)=>t in e?ide(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_I=(e,t)=>{for(var n in t||={})sde.call(t,n)&&gI(e,n,t[n]);if(hI)for(var n of hI(t))cde.call(t,n)&&gI(e,n,t[n]);return e},vI=(e,t)=>ade(e,ode(t)),yI=(e,t)=>{let n=!1,r=!1;for(let i=0;i<t;i+=1){if(e[i]===`\\`&&i+1<e.length&&e[i+1]==="`"){i+=1;continue}if(e.substring(i,i+3)==="```"){r=!r,i+=2;continue}!r&&e[i]==="`"&&(n=!n)}return n||r},lde=(e,t)=>{let n=e.substring(t,t+3)==="```",r=t>0&&e.substring(t-1,t+2)==="```",i=t>1&&e.substring(t-2,t+1)==="```";return n||r||i},ude=e=>{let t=0;for(let n=0;n<e.length;n+=1){if(e[n]===`\\`&&n+1<e.length&&e[n+1]==="`"){n+=1;continue}e[n]==="`"&&!lde(e,n)&&(t+=1)}return t},bI=(e,t)=>{let n=!1,r=!1,i=-1;for(let a=0;a<e.length;a+=1){if(e[a]===`\\`&&a+1<e.length&&e[a+1]==="`"){a+=1;continue}if(e.substring(a,a+3)==="```"){r=!r,a+=2;continue}if(!r&&e[a]==="`")if(n){if(i<t&&t<a)return!0;n=!1,i=-1}else n=!0,i=a}return!1},dde=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,fde=e=>!e||typeof e!=`string`||!e.includes(`>`)?e:e.replace(dde,(t,n,r,i)=>yI(e,i)?t:`${n}\\>${r}`),pde=/(\*\*)([^*]*\*?)$/,mde=/(__)([^_]*?)$/,hde=/(\*\*\*)([^*]*?)$/,gde=/(\*)([^*]*?)$/,_de=/(_)([^_]*?)$/,vde=/(`)([^`]*?)$/,yde=/(~~)([^~]*?)$/,xI=/^[\s_~*`]*$/,SI=/^[\s]*[-*+][\s]+$/,bde=/[\p{L}\p{N}_]/u,xde=/^```[^`\n]*```?$/,Sde=/^\*{4,}$/,Cde=/(__)([^_]+)_$/,wde=/(~~)([^~]+)~$/,CI=/~~/g,wI=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95?!0:bde.test(e)},Tde=(e,t)=>{let n=1;for(let r=t-1;r>=0;--r)if(e[r]===`]`)n+=1;else if(e[r]===`[`&&(--n,n===0))return r;return-1},TI=(e,t)=>{let n=1;for(let r=t+1;r<e.length;r+=1)if(e[r]===`[`)n+=1;else if(e[r]===`]`&&(--n,n===0))return r;return-1},EI=(e,t)=>{let n=!1,r=!1;for(let i=0;i<e.length&&i<t;i+=1){if(e[i]===`\\`&&e[i+1]===`$`){i+=1;continue}e[i]===`$`&&(e[i+1]===`$`?(r=!r,i+=1,n=!1):r||(n=!n))}return n||r},Ede=(e,t)=>{for(let n=t;n<e.length;n+=1){if(e[n]===`)`)return!0;if(e[n]===`
|
|
107
|
+
`)return!1}return!1},DI=(e,t)=>{for(let n=t-1;n>=0;--n){if(e[n]===`)`)return!1;if(e[n]===`(`)return n>0&&e[n-1]===`]`?Ede(e,t):!1;if(e[n]===`
|
|
108
|
+
`)return!1}return!1},Dde=(e,t)=>{for(let n=t-1;n>=0;--n){if(e[n]===`>`)return!1;if(e[n]===`<`){let t=n+1<e.length?e[n+1]:``;return t>=`a`&&t<=`z`||t>=`A`&&t<=`Z`||t===`/`}if(e[n]===`
|
|
109
|
+
`)return!1}return!1},OI=(e,t,n)=>{let r=0;for(let n=t-1;n>=0;--n)if(e[n]===`
|
|
110
110
|
`){r=n+1;break}let i=e.length;for(let n=t;n<e.length;n+=1)if(e[n]===`
|
|
111
|
-
`){i=n;break}let a=e.substring(r,i),o=0,s=!1;for(let e of a)if(e===n)o+=1;else if(e!==` `&&e!==` `){s=!0;break}return o>=3&&!s},
|
|
111
|
+
`){i=n;break}let a=e.substring(r,i),o=0,s=!1;for(let e of a)if(e===n)o+=1;else if(e!==` `&&e!==` `){s=!0;break}return o>=3&&!s},Ode=(e,t,n,r)=>n===`\\`||e.includes(`$`)&&EI(e,t)?!0:n!==`*`&&r===`*`?(t<e.length-2?e[t+2]:``)!==`*`:!!(n===`*`||n&&r&&wI(n)&&wI(r)||(!n||n===` `||n===` `||n===`
|
|
112
112
|
`)&&(!r||r===` `||r===` `||r===`
|
|
113
|
-
`)),
|
|
114
|
-
`),i=r===-1?0:r+1,a=e.substring(i,n);return
|
|
115
|
-
`)?!0:
|
|
116
|
-
`),i=r===-1?0:r+1,a=e.substring(i,n);return
|
|
117
|
-
`)?!0:
|
|
113
|
+
`)),kI=e=>{let t=0,n=!1,r=e.length;for(let i=0;i<r;i+=1){if(e[i]==="`"&&i+2<r&&e[i+1]==="`"&&e[i+2]==="`"){n=!n,i+=2;continue}if(n||e[i]!==`*`)continue;let a=i>0?e[i-1]:``,o=i<r-1?e[i+1]:``;Ode(e,i,a,o)||(t+=1)}return t},kde=(e,t,n,r)=>!!(n===`\\`||e.includes(`$`)&&EI(e,t)||DI(e,t)||Dde(e,t)||n===`_`||r===`_`||n&&r&&wI(n)&&wI(r)),Ade=e=>{let t=0,n=!1,r=e.length;for(let i=0;i<r;i+=1){if(e[i]==="`"&&i+2<r&&e[i+1]==="`"&&e[i+2]==="`"){n=!n,i+=2;continue}if(n||e[i]!==`_`)continue;let a=i>0?e[i-1]:``,o=i<r-1?e[i+1]:``;kde(e,i,a,o)||(t+=1)}return t},jde=e=>{let t=0,n=0,r=!1;for(let i=0;i<e.length;i+=1){if(e[i]==="`"&&i+2<e.length&&e[i+1]==="`"&&e[i+2]==="`"){n>=3&&(t+=Math.floor(n/3)),n=0,r=!r,i+=2;continue}r||(e[i]===`*`?n+=1:(n>=3&&(t+=Math.floor(n/3)),n=0))}return n>=3&&(t+=Math.floor(n/3)),t},AI=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]===`*`&&r+1<e.length&&e[r+1]===`*`&&(t+=1,r+=1)}return t},jI=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]===`_`&&r+1<e.length&&e[r+1]===`_`&&(t+=1,r+=1)}return t},Mde=(e,t,n)=>{if(!t||xI.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
|
|
114
|
+
`),i=r===-1?0:r+1,a=e.substring(i,n);return SI.test(a)&&t.includes(`
|
|
115
|
+
`)?!0:OI(e,n,`*`)},Nde=e=>{let t=e.match(pde);if(!t)return e;let n=t[2],r=e.lastIndexOf(t[1]);return yI(e,r)||bI(e,r)||Mde(e,n,r)?e:AI(e)%2==1?n.endsWith(`*`)?`${e}*`:`${e}**`:e},Pde=(e,t,n)=>{if(!t||xI.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
|
|
116
|
+
`),i=r===-1?0:r+1,a=e.substring(i,n);return SI.test(a)&&t.includes(`
|
|
117
|
+
`)?!0:OI(e,n,`_`)},Fde=e=>{let t=e.match(mde);if(!t){let t=e.match(Cde);if(t){let n=e.lastIndexOf(t[1]);if(!(yI(e,n)||bI(e,n))&&jI(e)%2==1)return`${e}_`}return e}let n=t[2],r=e.lastIndexOf(t[1]);return yI(e,r)||bI(e,r)||Pde(e,n,r)?e:jI(e)%2==1?`${e}__`:e},Ide=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]===`*`&&e[n-1]!==`*`&&e[n+1]!==`*`&&e[n-1]!==`\\`&&!EI(e,n)){let t=n>0?e[n-1]:``,r=n<e.length-1?e[n+1]:``;if((!t||t===` `||t===` `||t===`
|
|
118
118
|
`)&&(!r||r===` `||r===` `||r===`
|
|
119
|
-
`)||t&&r&&
|
|
120
|
-
`;)--t;return t<e.length?`${e.slice(0,t)}_${e.slice(t)}`:`${e}_`},
|
|
121
|
-
`)?null:e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e,
|
|
119
|
+
`)||t&&r&&wI(t)&&wI(r))continue;return n}}return-1},Lde=e=>{if(!e.match(gde))return e;let t=Ide(e);if(t===-1||yI(e,t)||bI(e,t))return e;let n=e.substring(t+1);return!n||xI.test(n)?e:kI(e)%2==1?`${e}*`:e},MI=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]===`_`&&e[n-1]!==`_`&&e[n+1]!==`_`&&e[n-1]!==`\\`&&!EI(e,n)&&!DI(e,n)){let t=n>0?e[n-1]:``,r=n<e.length-1?e[n+1]:``;if(t&&r&&wI(t)&&wI(r))continue;return n}}return-1},Rde=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
120
|
+
`;)--t;return t<e.length?`${e.slice(0,t)}_${e.slice(t)}`:`${e}_`},zde=e=>{if(!e.endsWith(`**`))return null;let t=e.slice(0,-2);if(AI(t)%2!=1)return null;let n=t.indexOf(`**`),r=MI(t);return n!==-1&&r!==-1&&n<r?`${t}_**`:null},Bde=e=>{if(!e.match(_de))return e;let t=MI(e);if(t===-1)return e;let n=e.substring(t+1);if(!n||xI.test(n)||yI(e,t)||bI(e,t))return e;if(Ade(e)%2==1){let t=zde(e);return t===null?Rde(e):t}return e},Vde=e=>{let t=AI(e),n=kI(e);return t%2==0&&n%2==0},Hde=(e,t,n)=>!t||xI.test(t)||yI(e,n)||bI(e,n)?!0:OI(e,n,`*`),Ude=e=>{if(Sde.test(e))return e;let t=e.match(hde);if(!t)return e;let n=t[2];return Hde(e,n,e.lastIndexOf(t[1]))?e:jde(e)%2==1?Vde(e)?e:`${e}***`:e},Wde=/<[a-zA-Z/][^>]*$/,Gde=e=>{let t=e.match(Wde);return!t||t.index===void 0||yI(e,t.index)?e:e.substring(0,t.index).trimEnd()},Kde=e=>!e.match(xde)||e.includes(`
|
|
121
|
+
`)?null:e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e,qde=e=>(e.match(/```/g)||[]).length%2==1,Jde=e=>{let t=Kde(e);if(t!==null)return t;let n=e.match(vde);if(n&&!qde(e)){let t=n[2];if(!t||xI.test(t))return e;if(ude(e)%2==1)return`${e}\``}return e},NI=(e,t)=>t>=2&&e.substring(t-2,t+1)==="```"||t>=1&&e.substring(t-1,t+2)==="```"||t<=e.length-3&&e.substring(t,t+3)==="```",Yde=e=>{let t=0,n=!1;for(let r=0;r<e.length-1;r+=1)e[r]==="`"&&!NI(e,r)&&(n=!n),!n&&e[r]===`$`&&e[r+1]===`$`&&(t+=1,r+=1);return t},Xde=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]===`\\`){r+=1;continue}if(e[r]==="`"&&!NI(e,r)){n=!n;continue}!n&&e[r]===`$`&&(r+1<e.length&&e[r+1]===`$`?r+=1:t+=1)}return t},Zde=e=>{if(e.endsWith(`$`)&&!e.endsWith(`$$`))return`${e}$`;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
|
|
122
122
|
`,t)!==-1&&!e.endsWith(`
|
|
123
123
|
`)?`${e}
|
|
124
|
-
$$`:`${e}$$`}
|
|
125
|
-
`);if(t===-1)return e;let n=e.substring(t+1),r=e.substring(0,t),i=n.trim();if(
|
|
126
|
-
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}if(
|
|
127
|
-
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}return e},
|
|
128
|
-
`,c);l===-1&&(l=t);let u=c;for(;u<l&&RI(e.charCodeAt(u));)u+=1;let d=u<l?e.charCodeAt(u):-1,f=!1;if((d===mfe||d===hfe)&&u-c<=3){let t=u;for(;t<l&&e.charCodeAt(t)===d;)t+=1;t-u>=3&&(f=!0,n?d===r&&t-u>=i&&bfe(e,t,l)&&(n=!1):(n=!0,r=d,i=t-u))}if(!n&&!f)for(let t=e.indexOf(`$$`,c);t!==-1&&t<l-1;t=e.indexOf(`$$`,t+2))(t===0||e.charCodeAt(t-1)!==yfe)&&(a=!a);d===-1&&!n&&!a?s=l+1:s!==-1&&(o=s,s=-1),c=l+1}return o}function Sfe(e,t){let n=xfe(e);return n<=0?LI(e,t):e.slice(0,n)+LI(e.slice(n),t)}var zI=/language-([^\s]+)/;function BI(e){if(typeof e==`string`)return e;if(!(0,z.isValidElement)(e))return``;let t=e.props;return t&&typeof t.children==`string`?t.children:``}function VI({node:e,...t}){return(0,B.jsx)(`pre`,{...t})}function HI({node:e,...t}){return(0,B.jsx)(`code`,{...t})}function UI(e){let{SyntaxHighlighter:t,CodeHeader:n,componentsByLanguage:r={}}=e;function i({node:e,className:i,children:a,"data-block":o,...s}){if(!o)return(0,B.jsx)(`code`,{className:`aui-streamdown-inline-code ${i??``}`.trim(),...s,children:a});let c=i?.match(zI)?.[1]??``,l=BI(a),u=r[c]?.SyntaxHighlighter??t,d=r[c]?.CodeHeader??n,f=d?(0,B.jsx)(d,{node:e,language:c,code:l}):null;return u?(0,B.jsxs)(B.Fragment,{children:[f,(0,B.jsx)(u,{node:e,components:{Pre:VI,Code:HI},language:c,code:l})]}):(0,B.jsxs)(B.Fragment,{children:[f,(0,B.jsx)(VI,{node:e,children:(0,B.jsx)(`code`,{className:i,...s,children:a})})]})}let a=(0,z.memo)(i,(e,t)=>e.className===t.className&&e[`data-block`]===t[`data-block`]&&e.children===t.children&&e.node?.position?.start.line===t.node?.position?.start.line&&e.node?.position?.end.line===t.node?.position?.end.line);return a.displayName=`AdaptedCode`,a}function WI(e){return!!(e.SyntaxHighlighter||e.CodeHeader||e.componentsByLanguage&&Object.keys(e.componentsByLanguage).length>0)}function GI({components:e,componentsByLanguage:t}){return(0,z.useMemo)(()=>{let{SyntaxHighlighter:n,CodeHeader:r,...i}=e??{},a={SyntaxHighlighter:n,CodeHeader:r,componentsByLanguage:t},o={pre:ide};if(!WI(a))return{...i,...o};let s=UI(a);return{...i,...o,code:s}},[e,t])}var KI=(function(e){if(e==null)return ZI;if(typeof e==`function`)return XI(e);if(typeof e==`object`)return Array.isArray(e)?qI(e):JI(e);if(typeof e==`string`)return YI(e);throw Error(`Expected function, string, or object as test`)});function qI(e){let t=[],n=-1;for(;++n<e.length;)t[n]=KI(e[n]);return XI(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function JI(e){let t=e;return XI(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function YI(e){return XI(t);function t(t){return t&&t.type===e}}function XI(e){return t;function t(t,n,r){return!!(QI(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function ZI(){return!0}function QI(e){return typeof e==`object`&&!!e&&`type`in e}function $I(e){return e}var eL=[],tL=`skip`;function nL(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=KI(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+$I(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=eL,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=rL(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function rL(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?eL:[e]}function iL(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),nL(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var aL={indicator:`indicator`,textOnly:`text-only`,remove:`remove`};function oL({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:a=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:o=`text-gray-500`,linkBlockPolicy:s=aL.indicator,imageBlockPolicy:c=aL.indicator}){let l=t.length&&!t.every(e=>e===`*`),u=n.length&&!n.every(e=>e===`*`);if(!e&&(l||u))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return l=>{let u=gL(e,t,n,r,i,a,o,s,c);fL(l),iL(l,u)}}function sL(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))try{return new URL(e,`http://example.com`)}catch{return null}return null}}function cL(e){return typeof e==`string`?e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`):!1}var lL=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`,`blob:`]),uL=new Set([`javascript:`,`data:`,`file:`,`vbscript:`]);function dL(e,t,n,r=!1,i=!1,a=[]){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;if(typeof e==`string`&&e.startsWith(`blob:`)){try{if(new URL(e).protocol===`blob:`&&e.length>5){let t=e.substring(5);if(t&&t.length>0&&t!==`invalid`)return e}}catch{return null}return null}let o=sL(e,n);if(!o||uL.has(o.protocol)||!(lL.has(o.protocol)||a.includes(o.protocol)||a.includes(`*`)))return null;if(o.protocol===`mailto:`||!o.protocol.match(/^https?:$/))return o.href;let s=cL(e);return o&&t.some(e=>{let t=sL(e,n);return!t||t.origin!==o.origin?!1:o.href.startsWith(t.href)})?s?o.pathname+o.search+o.hash:o.href:t.includes(`*`)?o.protocol!==`https:`&&o.protocol!==`http:`?null:s?o.pathname+o.search+o.hash:o.href:null}function fL(e){if(`children`in e&&Array.isArray(e.children)){e.children=e.children.filter(e=>e!=null);for(let t of e.children)fL(t)}}var pL=Symbol(`node-seen`);function mL(e,t,n){return t===aL.remove?{type:`remove`}:t===aL.textOnly?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[...e.children]}}:{type:`replace`,element:{type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(e.properties.href),class:n},children:[...e.children,{type:`text`,value:` [blocked]`}]}}}function hL(e,t,n){if(t===aL.remove)return{type:`remove`};if(t===aL.textOnly){let t=String(e.properties.alt||``);return t?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[{type:`text`,value:t}]}}:{type:`remove`}}return{type:`replace`,element:{type:`element`,tagName:`span`,properties:{class:n},children:[{type:`text`,value:`[Image blocked: `+String(e.properties.alt||`No description`)+`]`}]}}}var gL=(e,t,n,r,i,a,o,s,c)=>{let l=(u,d,f)=>{if(u.type!==`element`||u[pL])return!0;if(u.tagName===`a`){let n=dL(u.properties.href,t,e,!1,!1,i);if(n===null){if(u[pL]=!0,iL(u,l),f&&typeof d==`number`){let e=mL(u,s,o);if(e.type===`remove`)return f.children.splice(d,1),[tL,d];f.children[d]=e.element}return tL}else return u.properties.href=n,u.properties.target=`_blank`,u.properties.rel=`noopener noreferrer`,!0}if(u.tagName===`img`){let t=dL(u.properties.src,n,e,r,!0,i);if(t===null){if(u[pL]=!0,iL(u,l),f&&typeof d==`number`){let e=hL(u,c,a);if(e.type===`remove`)return f.children.splice(d,1),[tL,d];f.children[d]=e.element}return tL}else return u.properties.src=t,!0}return!0};return l},_L=typeof self==`object`?self:globalThis,vL=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new _L[e](t)},yL=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(vL(e,t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(vL(a,o),i)};return r},bL=e=>yL(new Map,e)(0),xL=``,{toString:SL}={},{keys:CL}=Object,wL=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=SL.call(e).slice(8,-1);switch(n){case`Array`:return[1,xL];case`Object`:return[2,xL];case`Date`:return[3,xL];case`RegExp`:return[4,xL];case`Map`:return[5,xL];case`Set`:return[6,xL];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},TL=([e,t])=>e===0&&(t===`function`||t===`symbol`),EL=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=wL(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of CL(r))(e||!TL(wL(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(TL(wL(n))||TL(wL(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!TL(wL(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},DL=(e,{json:t,lossy:n}={})=>{let r=[];return EL(!(t||n),!!t,new Map,r)(e),r},OL=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?bL(DL(e,t)):structuredClone(e):(e,t)=>bL(DL(e,t)),kL=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};kL.prototype.normal={},kL.prototype.property={},kL.prototype.space=void 0;function AL(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new kL(n,r,t)}function jL(e){return e.toLowerCase()}var ML=class{constructor(e,t){this.attribute=t,this.property=e}};ML.prototype.attribute=``,ML.prototype.booleanish=!1,ML.prototype.boolean=!1,ML.prototype.commaOrSpaceSeparated=!1,ML.prototype.commaSeparated=!1,ML.prototype.defined=!1,ML.prototype.mustUseProperty=!1,ML.prototype.number=!1,ML.prototype.overloadedBoolean=!1,ML.prototype.property=``,ML.prototype.spaceSeparated=!1,ML.prototype.space=void 0;var NL=s({boolean:()=>FL,booleanish:()=>IL,commaOrSpaceSeparated:()=>BL,commaSeparated:()=>zL,number:()=>W,overloadedBoolean:()=>LL,spaceSeparated:()=>RL}),PL=0,FL=VL(),IL=VL(),LL=VL(),W=VL(),RL=VL(),zL=VL(),BL=VL();function VL(){return 2**++PL}var HL=Object.keys(NL),UL=class extends ML{constructor(e,t,n,r){let i=-1;if(super(e,t),WL(this,`space`,r),typeof n==`number`)for(;++i<HL.length;){let e=HL[i];WL(this,HL[i],(n&NL[e])===NL[e])}}};UL.prototype.defined=!0;function WL(e,t,n){n&&(e[t]=n)}function GL(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new UL(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[jL(r)]=r,n[jL(a.attribute)]=r}return new kL(t,n,e.space)}var KL=GL({properties:{ariaActiveDescendant:null,ariaAtomic:IL,ariaAutoComplete:null,ariaBusy:IL,ariaChecked:IL,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:RL,ariaCurrent:null,ariaDescribedBy:RL,ariaDetails:null,ariaDisabled:IL,ariaDropEffect:RL,ariaErrorMessage:null,ariaExpanded:IL,ariaFlowTo:RL,ariaGrabbed:IL,ariaHasPopup:null,ariaHidden:IL,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:RL,ariaLevel:W,ariaLive:null,ariaModal:IL,ariaMultiLine:IL,ariaMultiSelectable:IL,ariaOrientation:null,ariaOwns:RL,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:IL,ariaReadOnly:IL,ariaRelevant:null,ariaRequired:IL,ariaRoleDescription:RL,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:IL,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function qL(e,t){return t in e?e[t]:t}function JL(e,t){return qL(e,t.toLowerCase())}var YL=GL({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:zL,acceptCharset:RL,accessKey:RL,action:null,allow:null,allowFullScreen:FL,allowPaymentRequest:FL,allowUserMedia:FL,alpha:FL,alt:null,as:null,async:FL,autoCapitalize:null,autoComplete:RL,autoFocus:FL,autoPlay:FL,blocking:RL,capture:null,charSet:null,checked:FL,cite:null,className:RL,closedBy:null,colorSpace:null,cols:W,colSpan:W,command:null,commandFor:null,content:null,contentEditable:IL,controls:FL,controlsList:RL,coords:W|zL,crossOrigin:null,data:null,dateTime:null,decoding:null,default:FL,defer:FL,dir:null,dirName:null,disabled:FL,download:LL,draggable:IL,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:FL,formTarget:null,headers:RL,height:W,hidden:LL,high:W,href:null,hrefLang:null,htmlFor:RL,httpEquiv:RL,id:null,imageSizes:null,imageSrcSet:null,inert:FL,inputMode:null,integrity:null,is:null,isMap:FL,itemId:null,itemProp:RL,itemRef:RL,itemScope:FL,itemType:RL,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:FL,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:FL,muted:FL,name:null,nonce:null,noModule:FL,noValidate:FL,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:FL,optimum:W,pattern:null,ping:RL,placeholder:null,playsInline:FL,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:FL,referrerPolicy:null,rel:RL,required:FL,reversed:FL,rows:W,rowSpan:W,sandbox:RL,scope:null,scoped:FL,seamless:FL,selected:FL,shadowRootClonable:FL,shadowRootCustomElementRegistry:FL,shadowRootDelegatesFocus:FL,shadowRootMode:null,shadowRootSerializable:FL,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:IL,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:FL,useMap:null,value:IL,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:RL,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:FL,declare:FL,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:FL,noHref:FL,noShade:FL,noWrap:FL,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:IL,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:FL,disablePictureInPicture:FL,disableRemotePlayback:FL,exportParts:zL,part:RL,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:JL}),XL=GL({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:BL,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:RL,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:FL,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:zL,g2:zL,glyphName:zL,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:BL,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:RL,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:BL,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:BL,rev:BL,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:BL,requiredFeatures:BL,requiredFonts:BL,requiredFormats:BL,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:BL,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:BL,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:BL,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:qL}),ZL=GL({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),QL=GL({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:JL}),$L=GL({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),eR={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},tR=/[A-Z]/g,nR=/-[a-z]/g,rR=/^data[-\w.:]+$/i;function iR(e,t){let n=jL(t),r=t,i=ML;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&rR.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(nR,oR);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!nR.test(e)){let n=e.replace(tR,aR);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=UL}return new i(r,t)}function aR(e){return`-`+e.toLowerCase()}function oR(e){return e.charAt(1).toUpperCase()}var sR=AL([KL,YL,ZL,QL,$L],`html`),cR=AL([KL,XL,ZL,QL,$L],`svg`);function lR(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function uR(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var dR=/[#.]/g;function fR(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){dR.lastIndex=i;let e=dR.exec(n),t=n.slice(i,e?e.index:n.length);t&&(a?a===`#`?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:o=t,i+=t.length),e&&(a=e[0],i++)}return{type:`element`,tagName:o||t||`div`,properties:r,children:[]}}function pR(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function mR(e){return e.join(` `).trim()}function hR(e,t,n){let r=n?xR(n):void 0;function i(n,i,...a){let o;if(n==null){o={type:`root`,children:[]};let e=i;a.unshift(e)}else{o=fR(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,gR(i))a.unshift(i);else for(let[t,n]of Object.entries(i))_R(e,o.properties,t,n)}for(let e of a)vR(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function gR(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,n=Object.keys(e);for(let e of n){let n=t[e];if(n&&typeof n==`object`){if(!Array.isArray(n))return!0;let e=n;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function _R(e,t,n,r){let i=iR(e,n),a;if(r!=null){if(typeof r==`number`){if(Number.isNaN(r))return;a=r}else a=typeof r==`boolean`?r:typeof r==`string`?i.spaceSeparated?pR(r):i.commaSeparated?lR(r):i.commaOrSpaceSeparated?pR(lR(r).join(` `)):yR(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?bR(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(yR(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function vR(e,t){if(t!=null)if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let n of t)vR(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?vR(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}function yR(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||jL(n)===jL(t)))return!0}return n}function bR(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function xR(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var SR=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),CR=hR(sR,`div`),wR=hR(cR,`g`,SR);function TR(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=ER(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=ER(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function ER(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
124
|
+
$$`:`${e}$$`},Qde=e=>Yde(e)%2==0?e:Zde(e),$de=e=>Xde(e)%2==1?`${e}$`:e,efe=(e,t,n)=>{if(e.substring(t+2).includes(`)`))return null;let r=Tde(e,t);if(r===-1||yI(e,r))return null;let i=r>0&&e[r-1]===`!`,a=i?r-1:r,o=e.substring(0,a);if(i)return o;let s=e.substring(r+1,t);return n===`text-only`?`${o}${s}`:`${o}[${s}](streamdown:incomplete-link)`},PI=(e,t)=>{for(let n=0;n<t;n++)if(e[n]===`[`&&!yI(e,n)){if(n>0&&e[n-1]===`!`)continue;let t=TI(e,n);if(t===-1)return n;if(t+1<e.length&&e[t+1]===`(`){let r=e.indexOf(`)`,t+2);r!==-1&&(n=r)}}return t},tfe=(e,t,n)=>{let r=t>0&&e[t-1]===`!`,i=r?t-1:t;if(!e.substring(t+1).includes(`]`)){let a=e.substring(0,i);if(r)return a;if(n===`text-only`){let n=PI(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}if(TI(e,t)===-1){let a=e.substring(0,i);if(r)return a;if(n===`text-only`){let n=PI(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}return null},FI=(e,t=`protocol`)=>{let n=e.lastIndexOf(`](`);if(n!==-1&&!yI(e,n)){let r=efe(e,n,t);if(r!==null)return r}for(let n=e.length-1;n>=0;--n)if(e[n]===`[`&&!yI(e,n)){let r=tfe(e,n,t);if(r!==null)return r}return e},nfe=/^-{1,2}$/,rfe=/^[\s]*-{1,2}[\s]+$/,ife=/^={1,2}$/,afe=/^[\s]*={1,2}[\s]+$/,ofe=e=>{if(!e||typeof e!=`string`)return e;let t=e.lastIndexOf(`
|
|
125
|
+
`);if(t===-1)return e;let n=e.substring(t+1),r=e.substring(0,t),i=n.trim();if(nfe.test(i)&&!n.match(rfe)){let t=r.split(`
|
|
126
|
+
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}if(ife.test(i)&&!n.match(afe)){let t=r.split(`
|
|
127
|
+
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}return e},sfe=RegExp(`(?<=[\\p{L}\\p{N}_])~(?!~)(?=[\\p{L}\\p{N}_])`,`gu`),cfe=e=>!e||typeof e!=`string`||!e.includes(`~`)?e:e.replace(sfe,(t,n)=>yI(e,n)?t:`\\~`),lfe=e=>{let t=e.match(yde);if(t){let n=t[2];if(!n||xI.test(n))return e;let r=e.lastIndexOf(t[1]);if(yI(e,r)||bI(e,r))return e;if(e.match(CI)?.length%2==1)return`${e}~~`}else{let t=e.match(wde);if(t){let n=e.lastIndexOf(t[0].slice(0,2));if(yI(e,n)||bI(e,n))return e;if(e.match(CI)?.length%2==1)return`${e}~`}}return e},II=e=>e!==!1,ufe=e=>e===!0,LI={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100},dfe=[{handler:{name:`singleTilde`,handle:cfe,priority:LI.SINGLE_TILDE},optionKey:`singleTilde`},{handler:{name:`comparisonOperators`,handle:fde,priority:LI.COMPARISON_OPERATORS},optionKey:`comparisonOperators`},{handler:{name:`htmlTags`,handle:Gde,priority:LI.HTML_TAGS},optionKey:`htmlTags`},{handler:{name:`setextHeadings`,handle:ofe,priority:LI.SETEXT_HEADINGS},optionKey:`setextHeadings`},{handler:{name:`links`,handle:FI,priority:LI.LINKS},optionKey:`links`,earlyReturn:e=>e.endsWith(`](streamdown:incomplete-link)`)},{handler:{name:`boldItalic`,handle:Ude,priority:LI.BOLD_ITALIC},optionKey:`boldItalic`},{handler:{name:`bold`,handle:Nde,priority:LI.BOLD},optionKey:`bold`},{handler:{name:`italicDoubleUnderscore`,handle:Fde,priority:LI.ITALIC_DOUBLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`italicSingleAsterisk`,handle:Lde,priority:LI.ITALIC_SINGLE_ASTERISK},optionKey:`italic`},{handler:{name:`italicSingleUnderscore`,handle:Bde,priority:LI.ITALIC_SINGLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`inlineCode`,handle:Jde,priority:LI.INLINE_CODE},optionKey:`inlineCode`},{handler:{name:`strikethrough`,handle:lfe,priority:LI.STRIKETHROUGH},optionKey:`strikethrough`},{handler:{name:`katex`,handle:Qde,priority:LI.KATEX},optionKey:`katex`},{handler:{name:`inlineKatex`,handle:$de,priority:LI.INLINE_KATEX},optionKey:`inlineKatex`}],ffe=e=>{let t=e?.linkMode??`protocol`;return dfe.filter(({handler:t,optionKey:n})=>t.name===`links`?II(e?.links)||II(e?.images):t.name===`inlineKatex`?ufe(e?.inlineKatex):II(e?.[n])).map(({handler:e,earlyReturn:n})=>e.name===`links`?{handler:vI(_I({},e),{handle:e=>FI(e,t)}),earlyReturn:t===`protocol`?n:void 0}:{handler:e,earlyReturn:n})},RI=(e,t)=>{if(!e||typeof e!=`string`)return e;let n=e.endsWith(` `)&&!e.endsWith(` `)?e.slice(0,-1):e,r=ffe(t),i=(t?.handlers??[]).map(e=>({handler:vI(_I({},e),{priority:e.priority??LI.DEFAULT}),earlyReturn:void 0})),a=[...r,...i].sort((e,t)=>(e.handler.priority??0)-(t.handler.priority??0));for(let{handler:e,earlyReturn:t}of a)if(n=e.handle(n),t!=null&&t(n))return n;return n},pfe=96,mfe=126,hfe=32,gfe=9,_fe=13,vfe=92,zI=e=>e===hfe||e===gfe||e===_fe;function yfe(e,t,n){for(let r=t;r<n;r+=1)if(!zI(e.charCodeAt(r)))return!1;return!0}function bfe(e){let t=e.length,n=!1,r=0,i=0,a=!1,o=0,s=-1;for(let c=0;c<=t;){let l=e.indexOf(`
|
|
128
|
+
`,c);l===-1&&(l=t);let u=c;for(;u<l&&zI(e.charCodeAt(u));)u+=1;let d=u<l?e.charCodeAt(u):-1,f=!1;if((d===pfe||d===mfe)&&u-c<=3){let t=u;for(;t<l&&e.charCodeAt(t)===d;)t+=1;t-u>=3&&(f=!0,n?d===r&&t-u>=i&&yfe(e,t,l)&&(n=!1):(n=!0,r=d,i=t-u))}if(!n&&!f)for(let t=e.indexOf(`$$`,c);t!==-1&&t<l-1;t=e.indexOf(`$$`,t+2))(t===0||e.charCodeAt(t-1)!==vfe)&&(a=!a);d===-1&&!n&&!a?s=l+1:s!==-1&&(o=s,s=-1),c=l+1}return o}function xfe(e,t){let n=bfe(e);return n<=0?RI(e,t):e.slice(0,n)+RI(e.slice(n),t)}var Sfe=/language-([^\s]+)/;function BI(e){if(typeof e==`string`)return e;if(!(0,z.isValidElement)(e))return``;let t=e.props;return t&&typeof t.children==`string`?t.children:``}function VI({node:e,...t}){return(0,B.jsx)(`pre`,{...t})}function HI({node:e,...t}){return(0,B.jsx)(`code`,{...t})}function UI(e){let{SyntaxHighlighter:t,CodeHeader:n,componentsByLanguage:r={}}=e;function i({node:e,className:i,children:a,"data-block":o,...s}){if(!o)return(0,B.jsx)(`code`,{className:`aui-streamdown-inline-code ${i??``}`.trim(),...s,children:a});let c=i?.match(Sfe)?.[1]??``,l=BI(a),u=r[c]?.SyntaxHighlighter??t,d=r[c]?.CodeHeader??n,f=d?(0,B.jsx)(d,{node:e,language:c,code:l}):null;return u?(0,B.jsxs)(B.Fragment,{children:[f,(0,B.jsx)(u,{node:e,components:{Pre:VI,Code:HI},language:c,code:l})]}):(0,B.jsxs)(B.Fragment,{children:[f,(0,B.jsx)(VI,{node:e,children:(0,B.jsx)(`code`,{className:i,...s,children:a})})]})}let a=(0,z.memo)(i,(e,t)=>e.className===t.className&&e[`data-block`]===t[`data-block`]&&e.children===t.children&&e.node?.position?.start.line===t.node?.position?.start.line&&e.node?.position?.end.line===t.node?.position?.end.line);return a.displayName=`AdaptedCode`,a}function WI(e){return!!(e.SyntaxHighlighter||e.CodeHeader||e.componentsByLanguage&&Object.keys(e.componentsByLanguage).length>0)}function GI({components:e,componentsByLanguage:t}){return(0,z.useMemo)(()=>{let{SyntaxHighlighter:n,CodeHeader:r,...i}=e??{},a={SyntaxHighlighter:n,CodeHeader:r,componentsByLanguage:t},o={pre:rde};if(!WI(a))return{...i,...o};let s=UI(a);return{...i,...o,code:s}},[e,t])}var KI=(function(e){if(e==null)return ZI;if(typeof e==`function`)return XI(e);if(typeof e==`object`)return Array.isArray(e)?qI(e):JI(e);if(typeof e==`string`)return YI(e);throw Error(`Expected function, string, or object as test`)});function qI(e){let t=[],n=-1;for(;++n<e.length;)t[n]=KI(e[n]);return XI(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function JI(e){let t=e;return XI(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function YI(e){return XI(t);function t(t){return t&&t.type===e}}function XI(e){return t;function t(t,n,r){return!!(QI(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function ZI(){return!0}function QI(e){return typeof e==`object`&&!!e&&`type`in e}function $I(e){return e}var eL=[],tL=`skip`;function nL(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=KI(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+$I(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=eL,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=rL(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function rL(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?eL:[e]}function iL(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),nL(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var aL={indicator:`indicator`,textOnly:`text-only`,remove:`remove`};function oL({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:a=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:o=`text-gray-500`,linkBlockPolicy:s=aL.indicator,imageBlockPolicy:c=aL.indicator}){let l=t.length&&!t.every(e=>e===`*`),u=n.length&&!n.every(e=>e===`*`);if(!e&&(l||u))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return l=>{let u=gL(e,t,n,r,i,a,o,s,c);fL(l),iL(l,u)}}function sL(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))try{return new URL(e,`http://example.com`)}catch{return null}return null}}function cL(e){return typeof e==`string`?e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`):!1}var lL=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`,`blob:`]),uL=new Set([`javascript:`,`data:`,`file:`,`vbscript:`]);function dL(e,t,n,r=!1,i=!1,a=[]){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;if(typeof e==`string`&&e.startsWith(`blob:`)){try{if(new URL(e).protocol===`blob:`&&e.length>5){let t=e.substring(5);if(t&&t.length>0&&t!==`invalid`)return e}}catch{return null}return null}let o=sL(e,n);if(!o||uL.has(o.protocol)||!(lL.has(o.protocol)||a.includes(o.protocol)||a.includes(`*`)))return null;if(o.protocol===`mailto:`||!o.protocol.match(/^https?:$/))return o.href;let s=cL(e);return o&&t.some(e=>{let t=sL(e,n);return!t||t.origin!==o.origin?!1:o.href.startsWith(t.href)})?s?o.pathname+o.search+o.hash:o.href:t.includes(`*`)?o.protocol!==`https:`&&o.protocol!==`http:`?null:s?o.pathname+o.search+o.hash:o.href:null}function fL(e){if(`children`in e&&Array.isArray(e.children)){e.children=e.children.filter(e=>e!=null);for(let t of e.children)fL(t)}}var pL=Symbol(`node-seen`);function mL(e,t,n){return t===aL.remove?{type:`remove`}:t===aL.textOnly?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[...e.children]}}:{type:`replace`,element:{type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(e.properties.href),class:n},children:[...e.children,{type:`text`,value:` [blocked]`}]}}}function hL(e,t,n){if(t===aL.remove)return{type:`remove`};if(t===aL.textOnly){let t=String(e.properties.alt||``);return t?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[{type:`text`,value:t}]}}:{type:`remove`}}return{type:`replace`,element:{type:`element`,tagName:`span`,properties:{class:n},children:[{type:`text`,value:`[Image blocked: `+String(e.properties.alt||`No description`)+`]`}]}}}var gL=(e,t,n,r,i,a,o,s,c)=>{let l=(u,d,f)=>{if(u.type!==`element`||u[pL])return!0;if(u.tagName===`a`){let n=dL(u.properties.href,t,e,!1,!1,i);if(n===null){if(u[pL]=!0,iL(u,l),f&&typeof d==`number`){let e=mL(u,s,o);if(e.type===`remove`)return f.children.splice(d,1),[tL,d];f.children[d]=e.element}return tL}else return u.properties.href=n,u.properties.target=`_blank`,u.properties.rel=`noopener noreferrer`,!0}if(u.tagName===`img`){let t=dL(u.properties.src,n,e,r,!0,i);if(t===null){if(u[pL]=!0,iL(u,l),f&&typeof d==`number`){let e=hL(u,c,a);if(e.type===`remove`)return f.children.splice(d,1),[tL,d];f.children[d]=e.element}return tL}else return u.properties.src=t,!0}return!0};return l},_L=typeof self==`object`?self:globalThis,vL=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new _L[e](t)},yL=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(vL(e,t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(vL(a,o),i)};return r},bL=e=>yL(new Map,e)(0),xL=``,{toString:SL}={},{keys:CL}=Object,wL=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=SL.call(e).slice(8,-1);switch(n){case`Array`:return[1,xL];case`Object`:return[2,xL];case`Date`:return[3,xL];case`RegExp`:return[4,xL];case`Map`:return[5,xL];case`Set`:return[6,xL];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},TL=([e,t])=>e===0&&(t===`function`||t===`symbol`),EL=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=wL(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of CL(r))(e||!TL(wL(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(TL(wL(n))||TL(wL(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!TL(wL(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},DL=(e,{json:t,lossy:n}={})=>{let r=[];return EL(!(t||n),!!t,new Map,r)(e),r},OL=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?bL(DL(e,t)):structuredClone(e):(e,t)=>bL(DL(e,t)),kL=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};kL.prototype.normal={},kL.prototype.property={},kL.prototype.space=void 0;function AL(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new kL(n,r,t)}function jL(e){return e.toLowerCase()}var ML=class{constructor(e,t){this.attribute=t,this.property=e}};ML.prototype.attribute=``,ML.prototype.booleanish=!1,ML.prototype.boolean=!1,ML.prototype.commaOrSpaceSeparated=!1,ML.prototype.commaSeparated=!1,ML.prototype.defined=!1,ML.prototype.mustUseProperty=!1,ML.prototype.number=!1,ML.prototype.overloadedBoolean=!1,ML.prototype.property=``,ML.prototype.spaceSeparated=!1,ML.prototype.space=void 0;var NL=s({boolean:()=>FL,booleanish:()=>IL,commaOrSpaceSeparated:()=>BL,commaSeparated:()=>zL,number:()=>W,overloadedBoolean:()=>LL,spaceSeparated:()=>RL}),PL=0,FL=VL(),IL=VL(),LL=VL(),W=VL(),RL=VL(),zL=VL(),BL=VL();function VL(){return 2**++PL}var HL=Object.keys(NL),UL=class extends ML{constructor(e,t,n,r){let i=-1;if(super(e,t),WL(this,`space`,r),typeof n==`number`)for(;++i<HL.length;){let e=HL[i];WL(this,HL[i],(n&NL[e])===NL[e])}}};UL.prototype.defined=!0;function WL(e,t,n){n&&(e[t]=n)}function GL(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new UL(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[jL(r)]=r,n[jL(a.attribute)]=r}return new kL(t,n,e.space)}var KL=GL({properties:{ariaActiveDescendant:null,ariaAtomic:IL,ariaAutoComplete:null,ariaBusy:IL,ariaChecked:IL,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:RL,ariaCurrent:null,ariaDescribedBy:RL,ariaDetails:null,ariaDisabled:IL,ariaDropEffect:RL,ariaErrorMessage:null,ariaExpanded:IL,ariaFlowTo:RL,ariaGrabbed:IL,ariaHasPopup:null,ariaHidden:IL,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:RL,ariaLevel:W,ariaLive:null,ariaModal:IL,ariaMultiLine:IL,ariaMultiSelectable:IL,ariaOrientation:null,ariaOwns:RL,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:IL,ariaReadOnly:IL,ariaRelevant:null,ariaRequired:IL,ariaRoleDescription:RL,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:IL,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function qL(e,t){return t in e?e[t]:t}function JL(e,t){return qL(e,t.toLowerCase())}var YL=GL({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:zL,acceptCharset:RL,accessKey:RL,action:null,allow:null,allowFullScreen:FL,allowPaymentRequest:FL,allowUserMedia:FL,alpha:FL,alt:null,as:null,async:FL,autoCapitalize:null,autoComplete:RL,autoFocus:FL,autoPlay:FL,blocking:RL,capture:null,charSet:null,checked:FL,cite:null,className:RL,closedBy:null,colorSpace:null,cols:W,colSpan:W,command:null,commandFor:null,content:null,contentEditable:IL,controls:FL,controlsList:RL,coords:W|zL,crossOrigin:null,data:null,dateTime:null,decoding:null,default:FL,defer:FL,dir:null,dirName:null,disabled:FL,download:LL,draggable:IL,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:FL,formTarget:null,headers:RL,height:W,hidden:LL,high:W,href:null,hrefLang:null,htmlFor:RL,httpEquiv:RL,id:null,imageSizes:null,imageSrcSet:null,inert:FL,inputMode:null,integrity:null,is:null,isMap:FL,itemId:null,itemProp:RL,itemRef:RL,itemScope:FL,itemType:RL,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:FL,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:FL,muted:FL,name:null,nonce:null,noModule:FL,noValidate:FL,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:FL,optimum:W,pattern:null,ping:RL,placeholder:null,playsInline:FL,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:FL,referrerPolicy:null,rel:RL,required:FL,reversed:FL,rows:W,rowSpan:W,sandbox:RL,scope:null,scoped:FL,seamless:FL,selected:FL,shadowRootClonable:FL,shadowRootCustomElementRegistry:FL,shadowRootDelegatesFocus:FL,shadowRootMode:null,shadowRootSerializable:FL,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:IL,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:FL,useMap:null,value:IL,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:RL,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:FL,declare:FL,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:FL,noHref:FL,noShade:FL,noWrap:FL,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:IL,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:FL,disablePictureInPicture:FL,disableRemotePlayback:FL,exportParts:zL,part:RL,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:JL}),XL=GL({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:BL,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:RL,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:FL,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:zL,g2:zL,glyphName:zL,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:BL,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:RL,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:BL,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:BL,rev:BL,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:BL,requiredFeatures:BL,requiredFonts:BL,requiredFormats:BL,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:BL,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:BL,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:BL,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:qL}),ZL=GL({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),QL=GL({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:JL}),$L=GL({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),eR={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},tR=/[A-Z]/g,nR=/-[a-z]/g,rR=/^data[-\w.:]+$/i;function iR(e,t){let n=jL(t),r=t,i=ML;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&rR.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(nR,oR);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!nR.test(e)){let n=e.replace(tR,aR);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=UL}return new i(r,t)}function aR(e){return`-`+e.toLowerCase()}function oR(e){return e.charAt(1).toUpperCase()}var sR=AL([KL,YL,ZL,QL,$L],`html`),cR=AL([KL,XL,ZL,QL,$L],`svg`);function lR(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function uR(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var dR=/[#.]/g;function fR(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){dR.lastIndex=i;let e=dR.exec(n),t=n.slice(i,e?e.index:n.length);t&&(a?a===`#`?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:o=t,i+=t.length),e&&(a=e[0],i++)}return{type:`element`,tagName:o||t||`div`,properties:r,children:[]}}function pR(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function mR(e){return e.join(` `).trim()}function hR(e,t,n){let r=n?xR(n):void 0;function i(n,i,...a){let o;if(n==null){o={type:`root`,children:[]};let e=i;a.unshift(e)}else{o=fR(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,gR(i))a.unshift(i);else for(let[t,n]of Object.entries(i))_R(e,o.properties,t,n)}for(let e of a)vR(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function gR(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,n=Object.keys(e);for(let e of n){let n=t[e];if(n&&typeof n==`object`){if(!Array.isArray(n))return!0;let e=n;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function _R(e,t,n,r){let i=iR(e,n),a;if(r!=null){if(typeof r==`number`){if(Number.isNaN(r))return;a=r}else a=typeof r==`boolean`?r:typeof r==`string`?i.spaceSeparated?pR(r):i.commaSeparated?lR(r):i.commaOrSpaceSeparated?pR(lR(r).join(` `)):yR(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?bR(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(yR(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function vR(e,t){if(t!=null)if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let n of t)vR(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?vR(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}function yR(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||jL(n)===jL(t)))return!0}return n}function bR(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function xR(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var SR=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),CR=hR(sR,`div`),wR=hR(cR,`g`,SR);function TR(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=ER(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=ER(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function ER(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
129
129
|
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var DR={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},OR={}.hasOwnProperty,kR=Object.prototype;function AR(e,t){let n=t||{};return jR({file:n.file||void 0,location:!1,schema:n.space===`svg`?cR:sR,verbose:n.verbose||!1},e)}function jR(e,t){let n;switch(t.nodeName){case`#comment`:{let r=t;return n={type:`comment`,value:r.data},PR(e,r,n),n}case`#document`:case`#document-fragment`:{let r=t,i=`mode`in r?r.mode===`quirks`||r.mode===`limited-quirks`:!1;if(n={type:`root`,children:MR(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){let t=String(e.file),r=TR(t),i=r.toPoint(0),a=r.toPoint(t.length);n.position={start:i,end:a}}return n}case`#documentType`:{let r=t;return n={type:`doctype`},PR(e,r,n),n}case`#text`:{let r=t;return n={type:`text`,value:r.value},PR(e,r,n),n}default:return n=NR(e,t),n}}function MR(e,t){let n=-1,r=[];for(;++n<t.length;){let i=jR(e,t[n]);r.push(i)}return r}function NR(e,t){let n=e.schema;e.schema=t.namespaceURI===DR.svg?cR:sR;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+`:`:``)+e.name;OR.call(kR,n)||(i[n]=e.value)}let a=(e.schema.space===`svg`?wR:CR)(t.tagName,i,MR(e,t.childNodes));if(PR(e,t,a),a.tagName===`template`){let n=t,r=n.sourceCodeLocation,i=r&&r.startTag&&IR(r.startTag),o=r&&r.endTag&&IR(r.endTag),s=jR(e,n.content);i&&o&&e.file&&(s.position={start:i.end,end:o.start}),a.content=s}return e.schema=n,a}function PR(e,t,n){if(`sourceCodeLocation`in t&&t.sourceCodeLocation&&e.file){let r=FR(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function FR(e,t,n){let r=IR(n);if(t.type===`element`){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r={},i;if(n.attrs)for(i in n.attrs)OR.call(n.attrs,i)&&(r[iR(e.schema,i).property]=IR(n.attrs[i]));n.startTag;let a=IR(n.startTag),o=n.endTag?IR(n.endTag):void 0,s={opening:a};o&&(s.closing=o),s.properties=r,t.data={position:s}}}return r}function IR(e){let t=LR({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=LR({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function LR(e){return e.line&&e.column?e:void 0}var RR={}.hasOwnProperty;function zR(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&RR.call(t,e)){let n=String(t[e]);i=RR.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var BR={},VR={}.hasOwnProperty,HR=zR(`type`,{handlers:{root:WR,element:YR,text:qR,comment:JR,doctype:KR}});function UR(e,t){let n=(t||BR).space;return HR(e,n===`svg`?cR:sR)}function WR(e,t){let n={nodeName:`#document`,mode:(e.data||{}).quirksMode?`quirks`:`no-quirks`,childNodes:[]};return n.childNodes=ZR(e.children,n,t),QR(e,n),n}function GR(e,t){let n={nodeName:`#document-fragment`,childNodes:[]};return n.childNodes=ZR(e.children,n,t),QR(e,n),n}function KR(e){let t={nodeName:`#documentType`,name:`html`,publicId:``,systemId:``,parentNode:null};return QR(e,t),t}function qR(e){let t={nodeName:`#text`,value:e.value,parentNode:null};return QR(e,t),t}function JR(e){let t={nodeName:`#comment`,data:e.value,parentNode:null};return QR(e,t),t}function YR(e,t){let n=t,r=n;e.type===`element`&&e.tagName.toLowerCase()===`svg`&&n.space===`html`&&(r=cR);let i=[],a;if(e.properties){for(a in e.properties)if(a!==`children`&&VR.call(e.properties,a)){let t=XR(r,a,e.properties[a]);t&&i.push(t)}}let o=r.space,s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:DR[o],childNodes:[],parentNode:null};return s.childNodes=ZR(e.children,s,r),QR(e,s),e.tagName===`template`&&e.content&&(s.content=GR(e.content,r)),s}function XR(e,t,n){let r=iR(e,t);if(n===!1||n==null||typeof n==`number`&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?uR(n):mR(n));let i={name:r.attribute,value:n===!0?``:String(n)};if(r.space&&r.space!==`html`&&r.space!==`svg`){let e=i.name.indexOf(`:`);e<0?i.prefix=``:(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=DR[r.space]}return i}function ZR(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let a=HR(e[r],n);a.parentNode=t,i.push(a)}return i}function QR(e,t){let n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}var $R=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],ez=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),G;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(G||={});var tz={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function nz(e){return e>=55296&&e<=57343}function rz(e){return e>=56320&&e<=57343}function iz(e,t){return(e-55296)*1024+9216+t}function az(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function oz(e){return e>=64976&&e<=65007||ez.has(e)}var K;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(K||={});var sz=65536,cz=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=sz,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(rz(t))return this.pos++,this._addGap(),iz(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,G.EOF;return this._err(K.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let n=this.html.charCodeAt(t);return n===G.CARRIAGE_RETURN?G.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let e=this.html.charCodeAt(this.pos);return e===G.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,G.LINE_FEED):e===G.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,nz(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===G.LINE_FEED||e===G.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){az(e)?this._err(K.controlCharacterInInputStream):oz(e)&&this._err(K.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},lz;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(lz||={});function uz(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var dz=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),fz=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function pz(e){return e>=55296&&e<=57343||e>1114111?65533:fz.get(e)??e}var mz;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(mz||={});var hz=32,gz;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(gz||={});function _z(e){return e>=mz.ZERO&&e<=mz.NINE}function vz(e){return e>=mz.UPPER_A&&e<=mz.UPPER_F||e>=mz.LOWER_A&&e<=mz.LOWER_F}function yz(e){return e>=mz.UPPER_A&&e<=mz.UPPER_Z||e>=mz.LOWER_A&&e<=mz.LOWER_Z||_z(e)}function bz(e){return e===mz.EQUALS||yz(e)}var xz;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(xz||={});var Sz;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Sz||={});var Cz=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=xz.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Sz.Strict}startEntity(e){this.decodeMode=e,this.state=xz.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case xz.EntityStart:return e.charCodeAt(t)===mz.NUM?(this.state=xz.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=xz.NamedEntity,this.stateNamedEntity(e,t));case xz.NumericStart:return this.stateNumericStart(e,t);case xz.NumericDecimal:return this.stateNumericDecimal(e,t);case xz.NumericHex:return this.stateNumericHex(e,t);case xz.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|hz)===mz.LOWER_X?(this.state=xz.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=xz.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(_z(r)||vz(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(_z(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===mz.SEMI)this.consumed+=1;else if(this.decodeMode===Sz.Strict)return 0;return this.emitCodePoint(pz(this.result),this.consumed),this.errors&&(e!==mz.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&gz.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=wz(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===Sz.Attribute&&(i===0||bz(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&gz.VALUE_LENGTH)>>14,i!==0){if(a===mz.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Sz.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&gz.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~gz.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case xz.NamedEntity:return this.result!==0&&(this.decodeMode!==Sz.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case xz.NumericDecimal:return this.emitNumericEntity(0,2);case xz.NumericHex:return this.emitNumericEntity(0,3);case xz.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case xz.EntityStart:return 0}}};function wz(e,t,n,r){let i=(t&gz.BRANCH_LENGTH)>>7,a=t&gz.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var q;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(q||={});var Tz;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(Tz||={});var Ez;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(Ez||={});var J;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(J||={});var Y;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(Y||={});var Dz=new Map([[J.A,Y.A],[J.ADDRESS,Y.ADDRESS],[J.ANNOTATION_XML,Y.ANNOTATION_XML],[J.APPLET,Y.APPLET],[J.AREA,Y.AREA],[J.ARTICLE,Y.ARTICLE],[J.ASIDE,Y.ASIDE],[J.B,Y.B],[J.BASE,Y.BASE],[J.BASEFONT,Y.BASEFONT],[J.BGSOUND,Y.BGSOUND],[J.BIG,Y.BIG],[J.BLOCKQUOTE,Y.BLOCKQUOTE],[J.BODY,Y.BODY],[J.BR,Y.BR],[J.BUTTON,Y.BUTTON],[J.CAPTION,Y.CAPTION],[J.CENTER,Y.CENTER],[J.CODE,Y.CODE],[J.COL,Y.COL],[J.COLGROUP,Y.COLGROUP],[J.DD,Y.DD],[J.DESC,Y.DESC],[J.DETAILS,Y.DETAILS],[J.DIALOG,Y.DIALOG],[J.DIR,Y.DIR],[J.DIV,Y.DIV],[J.DL,Y.DL],[J.DT,Y.DT],[J.EM,Y.EM],[J.EMBED,Y.EMBED],[J.FIELDSET,Y.FIELDSET],[J.FIGCAPTION,Y.FIGCAPTION],[J.FIGURE,Y.FIGURE],[J.FONT,Y.FONT],[J.FOOTER,Y.FOOTER],[J.FOREIGN_OBJECT,Y.FOREIGN_OBJECT],[J.FORM,Y.FORM],[J.FRAME,Y.FRAME],[J.FRAMESET,Y.FRAMESET],[J.H1,Y.H1],[J.H2,Y.H2],[J.H3,Y.H3],[J.H4,Y.H4],[J.H5,Y.H5],[J.H6,Y.H6],[J.HEAD,Y.HEAD],[J.HEADER,Y.HEADER],[J.HGROUP,Y.HGROUP],[J.HR,Y.HR],[J.HTML,Y.HTML],[J.I,Y.I],[J.IMG,Y.IMG],[J.IMAGE,Y.IMAGE],[J.INPUT,Y.INPUT],[J.IFRAME,Y.IFRAME],[J.KEYGEN,Y.KEYGEN],[J.LABEL,Y.LABEL],[J.LI,Y.LI],[J.LINK,Y.LINK],[J.LISTING,Y.LISTING],[J.MAIN,Y.MAIN],[J.MALIGNMARK,Y.MALIGNMARK],[J.MARQUEE,Y.MARQUEE],[J.MATH,Y.MATH],[J.MENU,Y.MENU],[J.META,Y.META],[J.MGLYPH,Y.MGLYPH],[J.MI,Y.MI],[J.MO,Y.MO],[J.MN,Y.MN],[J.MS,Y.MS],[J.MTEXT,Y.MTEXT],[J.NAV,Y.NAV],[J.NOBR,Y.NOBR],[J.NOFRAMES,Y.NOFRAMES],[J.NOEMBED,Y.NOEMBED],[J.NOSCRIPT,Y.NOSCRIPT],[J.OBJECT,Y.OBJECT],[J.OL,Y.OL],[J.OPTGROUP,Y.OPTGROUP],[J.OPTION,Y.OPTION],[J.P,Y.P],[J.PARAM,Y.PARAM],[J.PLAINTEXT,Y.PLAINTEXT],[J.PRE,Y.PRE],[J.RB,Y.RB],[J.RP,Y.RP],[J.RT,Y.RT],[J.RTC,Y.RTC],[J.RUBY,Y.RUBY],[J.S,Y.S],[J.SCRIPT,Y.SCRIPT],[J.SEARCH,Y.SEARCH],[J.SECTION,Y.SECTION],[J.SELECT,Y.SELECT],[J.SOURCE,Y.SOURCE],[J.SMALL,Y.SMALL],[J.SPAN,Y.SPAN],[J.STRIKE,Y.STRIKE],[J.STRONG,Y.STRONG],[J.STYLE,Y.STYLE],[J.SUB,Y.SUB],[J.SUMMARY,Y.SUMMARY],[J.SUP,Y.SUP],[J.TABLE,Y.TABLE],[J.TBODY,Y.TBODY],[J.TEMPLATE,Y.TEMPLATE],[J.TEXTAREA,Y.TEXTAREA],[J.TFOOT,Y.TFOOT],[J.TD,Y.TD],[J.TH,Y.TH],[J.THEAD,Y.THEAD],[J.TITLE,Y.TITLE],[J.TR,Y.TR],[J.TRACK,Y.TRACK],[J.TT,Y.TT],[J.U,Y.U],[J.UL,Y.UL],[J.SVG,Y.SVG],[J.VAR,Y.VAR],[J.WBR,Y.WBR],[J.XMP,Y.XMP]]);function Oz(e){return Dz.get(e)??Y.UNKNOWN}var X=Y,kz={[q.HTML]:new Set([X.ADDRESS,X.APPLET,X.AREA,X.ARTICLE,X.ASIDE,X.BASE,X.BASEFONT,X.BGSOUND,X.BLOCKQUOTE,X.BODY,X.BR,X.BUTTON,X.CAPTION,X.CENTER,X.COL,X.COLGROUP,X.DD,X.DETAILS,X.DIR,X.DIV,X.DL,X.DT,X.EMBED,X.FIELDSET,X.FIGCAPTION,X.FIGURE,X.FOOTER,X.FORM,X.FRAME,X.FRAMESET,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HEADER,X.HGROUP,X.HR,X.HTML,X.IFRAME,X.IMG,X.INPUT,X.LI,X.LINK,X.LISTING,X.MAIN,X.MARQUEE,X.MENU,X.META,X.NAV,X.NOEMBED,X.NOFRAMES,X.NOSCRIPT,X.OBJECT,X.OL,X.P,X.PARAM,X.PLAINTEXT,X.PRE,X.SCRIPT,X.SECTION,X.SELECT,X.SOURCE,X.STYLE,X.SUMMARY,X.TABLE,X.TBODY,X.TD,X.TEMPLATE,X.TEXTAREA,X.TFOOT,X.TH,X.THEAD,X.TITLE,X.TR,X.TRACK,X.UL,X.WBR,X.XMP]),[q.MATHML]:new Set([X.MI,X.MO,X.MN,X.MS,X.MTEXT,X.ANNOTATION_XML]),[q.SVG]:new Set([X.TITLE,X.FOREIGN_OBJECT,X.DESC]),[q.XLINK]:new Set,[q.XML]:new Set,[q.XMLNS]:new Set},Az=new Set([X.H1,X.H2,X.H3,X.H4,X.H5,X.H6]);new Set([J.STYLE,J.SCRIPT,J.XMP,J.IFRAME,J.NOEMBED,J.NOFRAMES,J.PLAINTEXT]);var Z;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Z||={});var jz={DATA:Z.DATA,RCDATA:Z.RCDATA,RAWTEXT:Z.RAWTEXT,SCRIPT_DATA:Z.SCRIPT_DATA,PLAINTEXT:Z.PLAINTEXT,CDATA_SECTION:Z.CDATA_SECTION};function Mz(e){return e>=G.DIGIT_0&&e<=G.DIGIT_9}function Nz(e){return e>=G.LATIN_CAPITAL_A&&e<=G.LATIN_CAPITAL_Z}function Pz(e){return e>=G.LATIN_SMALL_A&&e<=G.LATIN_SMALL_Z}function Fz(e){return Pz(e)||Nz(e)}function Iz(e){return Fz(e)||Mz(e)}function Lz(e){return e+32}function Rz(e){return e===G.SPACE||e===G.LINE_FEED||e===G.TABULATION||e===G.FORM_FEED}function zz(e){return Rz(e)||e===G.SOLIDUS||e===G.GREATER_THAN_SIGN}function Bz(e){return e===G.NULL?K.nullCharacterReference:e>1114111?K.characterReferenceOutsideUnicodeRange:nz(e)?K.surrogateCharacterReference:oz(e)?K.noncharacterCharacterReference:az(e)||e===G.CARRIAGE_RETURN?K.controlCharacterReference:null}var Vz=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=Z.DATA,this.returnState=Z.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new cz(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Cz(dz,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(K.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(K.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=Bz(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:lz.START_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:lz.END_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:lz.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:lz.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e;let t=this.currentToken;if(uz(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(K.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=Oz(e.tagName),e.type===lz.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(K.endTagWithAttributes),e.selfClosing&&this._err(K.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case lz.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case lz.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case lz.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:lz.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){let t=Rz(e)?lz.WHITESPACE_CHARACTER:e===G.NULL?lz.NULL_CHARACTER:lz.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(lz.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Z.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Sz.Attribute:Sz.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Z.DATA:this._stateData(e);break;case Z.RCDATA:this._stateRcdata(e);break;case Z.RAWTEXT:this._stateRawtext(e);break;case Z.SCRIPT_DATA:this._stateScriptData(e);break;case Z.PLAINTEXT:this._statePlaintext(e);break;case Z.TAG_OPEN:this._stateTagOpen(e);break;case Z.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Z.TAG_NAME:this._stateTagName(e);break;case Z.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Z.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Z.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Z.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Z.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Z.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Z.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Z.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Z.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Z.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Z.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Z.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Z.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Z.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Z.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Z.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Z.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Z.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Z.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Z.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Z.BOGUS_COMMENT:this._stateBogusComment(e);break;case Z.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Z.COMMENT_START:this._stateCommentStart(e);break;case Z.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Z.COMMENT:this._stateComment(e);break;case Z.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Z.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Z.COMMENT_END:this._stateCommentEnd(e);break;case Z.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Z.DOCTYPE:this._stateDoctype(e);break;case Z.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Z.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Z.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Z.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Z.CDATA_SECTION:this._stateCdataSection(e);break;case Z.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Z.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Z.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Z.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.TAG_OPEN;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitCodePoint(e);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case G.AMPERSAND:this._startCharacterReference();break;case G.LESS_THAN_SIGN:this.state=Z.RCDATA_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.RAWTEXT_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Fz(e))this._createStartTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case G.EXCLAMATION_MARK:this.state=Z.MARKUP_DECLARATION_OPEN;break;case G.SOLIDUS:this.state=Z.END_TAG_OPEN;break;case G.QUESTION_MARK:this._err(K.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e);break;case G.EOF:this._err(K.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(K.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Z.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Fz(e))this._createEndTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case G.GREATER_THAN_SIGN:this._err(K.missingEndTagName),this.state=Z.DATA;break;case G.EOF:this._err(K.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(K.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),t.tagName+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(Nz(e)?Lz(e):e)}}_stateRcdataLessThanSign(e){e===G.SOLIDUS?this.state=Z.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Fz(e)?(this.state=Z.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=Z.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=Z.BEFORE_ATTRIBUTE_NAME,!1;case G.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Z.SELF_CLOSING_START_TAG,!1;case G.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Z.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===G.SOLIDUS?this.state=Z.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Fz(e)?(this.state=Z.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case G.SOLIDUS:this.state=Z.SCRIPT_DATA_END_TAG_OPEN;break;case G.EXCLAMATION_MARK:this.state=Z.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Fz(e)?(this.state=Z.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===G.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===G.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case G.HYPHEN_MINUS:this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===G.SOLIDUS?this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Fz(e)?(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Fz(e)?(this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(tz.SCRIPT,!1)&&zz(this.preprocessor.peek(tz.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<tz.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case G.HYPHEN_MINUS:this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===G.SOLIDUS?(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(tz.SCRIPT,!1)&&zz(this.preprocessor.peek(tz.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<tz.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.SOLIDUS:case G.GREATER_THAN_SIGN:case G.EOF:this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case G.EQUALS_SIGN:this._err(K.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Z.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:case G.SOLIDUS:case G.GREATER_THAN_SIGN:case G.EOF:this._leaveAttrName(),this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case G.EQUALS_SIGN:this._leaveAttrName(),this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case G.QUOTATION_MARK:case G.APOSTROPHE:case G.LESS_THAN_SIGN:this._err(K.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(Nz(e)?Lz(e):e)}}_stateAfterAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case G.EQUALS_SIGN:this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:this.state=Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case G.APOSTROPHE:this.state=Z.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingAttributeValue),this.state=Z.DATA,this.emitCurrentTagToken();break;default:this.state=Z.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case G.APOSTROPHE:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.AMPERSAND:this._startCharacterReference();break;case G.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.QUOTATION_MARK:case G.APOSTROPHE:case G.LESS_THAN_SIGN:case G.EQUALS_SIGN:case G.GRAVE_ACCENT:this._err(K.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.SOLIDUS:this._leaveAttrValue(),this.state=Z.SELF_CLOSING_START_TAG;break;case G.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._err(K.missingWhitespaceBetweenAttributes),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case G.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Z.DATA,this.emitCurrentTagToken();break}case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._err(K.unexpectedSolidusInTag),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(tz.DASH_DASH,!0)?(this._createCommentToken(tz.DASH_DASH.length+1),this.state=Z.COMMENT_START):this._consumeSequenceIfMatch(tz.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(tz.DOCTYPE.length+1),this.state=Z.DOCTYPE):this._consumeSequenceIfMatch(tz.CDATA_START,!0)?this.inForeignNode?this.state=Z.CDATA_SECTION:(this._err(K.cdataInHtmlContent),this._createCommentToken(tz.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Z.BOGUS_COMMENT):this._ensureHibernation()||(this._err(K.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_START_DASH;break;case G.GREATER_THAN_SIGN:{this._err(K.abruptClosingOfEmptyComment),this.state=Z.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case G.GREATER_THAN_SIGN:this._err(K.abruptClosingOfEmptyComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END_DASH;break;case G.LESS_THAN_SIGN:t.data+=`<`,this.state=Z.COMMENT_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.data+=`�`;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case G.EXCLAMATION_MARK:t.data+=`!`,this.state=Z.COMMENT_LESS_THAN_SIGN_BANG;break;case G.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===G.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Z.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===G.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Z.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==G.GREATER_THAN_SIGN&&e!==G.EOF&&this._err(K.nestedComment),this.state=Z.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EXCLAMATION_MARK:this.state=Z.COMMENT_END_BANG;break;case G.HYPHEN_MINUS:t.data+=`-`;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:t.data+=`--!`,this.state=Z.COMMENT_END_DASH;break;case G.GREATER_THAN_SIGN:this._err(K.incorrectlyClosedComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Z.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case G.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(K.missingWhitespaceBeforeDoctypeName),this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Nz(e))this._createDoctypeToken(String.fromCharCode(Lz(e))),this.state=Z.DOCTYPE_NAME;else switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.NULL:this._err(K.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Z.DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:{this._err(K.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Z.DATA;break}case G.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=Z.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.AFTER_DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.NULL:this._err(K.unexpectedNullCharacter),t.name+=`�`;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(Nz(e)?Lz(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(tz.PUBLIC,!1)?this.state=Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(tz.SYSTEM,!1)?this.state=Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(K.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.publicId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case G.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.publicId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.systemId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case G.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.systemId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.NULL:this._err(K.unexpectedNullCharacter);break;case G.EOF:this.emitCurrentDoctype(t),this._emitEOFToken();break;default:}}_stateCdataSection(e){switch(e){case G.RIGHT_SQUARE_BRACKET:this.state=Z.CDATA_SECTION_BRACKET;break;case G.EOF:this._err(K.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===G.RIGHT_SQUARE_BRACKET?this.state=Z.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA;break;case G.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(G.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Iz(this.preprocessor.peek(1))?Z.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Iz(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===G.SEMICOLON&&this._err(K.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},Hz=new Set([Y.DD,Y.DT,Y.LI,Y.OPTGROUP,Y.OPTION,Y.P,Y.RB,Y.RP,Y.RT,Y.RTC]),Uz=new Set([...Hz,Y.CAPTION,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]),Wz=new Set([Y.APPLET,Y.CAPTION,Y.HTML,Y.MARQUEE,Y.OBJECT,Y.TABLE,Y.TD,Y.TEMPLATE,Y.TH]),Gz=new Set([...Wz,Y.OL,Y.UL]),Kz=new Set([...Wz,Y.BUTTON]),qz=new Set([Y.ANNOTATION_XML,Y.MI,Y.MN,Y.MO,Y.MS,Y.MTEXT]),Jz=new Set([Y.DESC,Y.FOREIGN_OBJECT,Y.TITLE]),Yz=new Set([Y.TR,Y.TEMPLATE,Y.HTML]),Xz=new Set([Y.TBODY,Y.TFOOT,Y.THEAD,Y.TEMPLATE,Y.HTML]),Zz=new Set([Y.TABLE,Y.TEMPLATE,Y.HTML]),Qz=new Set([Y.TD,Y.TH]),$z=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=Y.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===Y.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===q.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==q.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Az,q.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Qz,q.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(Zz,q.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Xz,q.HTML)}clearBackToTableRowContext(){this.clearBackTo(Yz,q.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===Y.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===Y.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case q.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case q.SVG:if(Jz.has(r))return!1;break;case q.MATHML:if(qz.has(r))return!1;break}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Wz)}hasInListItemScope(e){return this.hasInDynamicScope(e,Gz)}hasInButtonScope(e){return this.hasInDynamicScope(e,Kz)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case q.HTML:if(Az.has(t))return!0;if(Wz.has(t))return!1;break;case q.SVG:if(Jz.has(t))return!1;break;case q.MATHML:if(qz.has(t))return!1;break}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===q.HTML)switch(this.tagIDs[e]){case Y.TBODY:case Y.THEAD:case Y.TFOOT:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.OPTION:case Y.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Hz.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Uz.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Uz.has(this.currentTagId);)this.pop()}},eB=3,tB;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(tB||={});var nB={type:tB.Marker},rB=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===tB.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<eB)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<eB)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=eB&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(nB)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:tB.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:tB.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(nB);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===tB.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===tB.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===tB.Element&&t.element===e)}},iB={createDocument(){return{nodeName:`#document`,mode:Ez.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};iB.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(iB.isTextNode(n)){n.value+=t;return}}iB.appendChild(e,iB.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&iB.isTextNode(r)?r.value+=t:iB.insertBefore(e,iB.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},aB=`html`,oB=`about:legacy-compat`,sB=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,cB=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),lB=[...cB,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],uB=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),dB=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],fB=[...dB,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function pB(e,t){return t.some(t=>e.startsWith(t))}function mB(e){return e.name===aB&&e.publicId===null&&(e.systemId===null||e.systemId===oB)}function hB(e){if(e.name!==aB)return Ez.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===sB)return Ez.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),uB.has(n))return Ez.QUIRKS;let e=t===null?lB:cB;if(pB(n,e))return Ez.QUIRKS;if(e=t===null?dB:fB,pB(n,e))return Ez.LIMITED_QUIRKS}return Ez.NO_QUIRKS}var gB={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},_B=`definitionurl`,vB=`definitionURL`,yB=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),bB=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:q.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:q.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:q.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:q.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:q.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:q.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:q.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:q.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:q.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:q.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:q.XMLNS}]]),xB=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),SB=new Set([Y.B,Y.BIG,Y.BLOCKQUOTE,Y.BODY,Y.BR,Y.CENTER,Y.CODE,Y.DD,Y.DIV,Y.DL,Y.DT,Y.EM,Y.EMBED,Y.H1,Y.H2,Y.H3,Y.H4,Y.H5,Y.H6,Y.HEAD,Y.HR,Y.I,Y.IMG,Y.LI,Y.LISTING,Y.MENU,Y.META,Y.NOBR,Y.OL,Y.P,Y.PRE,Y.RUBY,Y.S,Y.SMALL,Y.SPAN,Y.STRONG,Y.STRIKE,Y.SUB,Y.SUP,Y.TABLE,Y.TT,Y.U,Y.UL,Y.VAR]);function CB(e){let t=e.tagID;return t===Y.FONT&&e.attrs.some(({name:e})=>e===Tz.COLOR||e===Tz.SIZE||e===Tz.FACE)||SB.has(t)}function wB(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===_B){e.attrs[t].name=vB;break}}function TB(e){for(let t=0;t<e.attrs.length;t++){let n=yB.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function EB(e){for(let t=0;t<e.attrs.length;t++){let n=bB.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function DB(e){let t=xB.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Oz(e.tagName))}function OB(e,t){return t===q.MATHML&&(e===Y.MI||e===Y.MO||e===Y.MN||e===Y.MS||e===Y.MTEXT)}function kB(e,t,n){if(t===q.MATHML&&e===Y.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===Tz.ENCODING){let t=n[e].value.toLowerCase();return t===gB.TEXT_HTML||t===gB.APPLICATION_XML}}return t===q.SVG&&(e===Y.FOREIGN_OBJECT||e===Y.DESC||e===Y.TITLE)}function AB(e,t,n,r){return(!r||r===q.HTML)&&kB(e,t,n)||(!r||r===q.MATHML)&&OB(e,t)}var jB=`hidden`,MB=8,NB=3,Q;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(Q||={});var PB={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},FB=new Set([Y.TABLE,Y.TBODY,Y.TFOOT,Y.THEAD,Y.TR]),IB={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:iB,onParseError:null},LB=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=Q.INITIAL,this.originalInsertionMode=Q.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...IB,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new Vz(this.options,this),this.activeFormattingElements=new rB(this.treeAdapter),this.fragmentContextID=n?Oz(this.treeAdapter.getTagName(n)):Y.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new $z(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...IB,...t};e??=n.treeAdapter.createElement(J.TEMPLATE,q.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,q.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===Y.TEMPLATE&&i.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??PB,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===q.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,q.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Q.TEXT}switchToPlaintextParsing(){this.insertionMode=Q.TEXT,this.originalInsertionMode=Q.IN_BODY,this.tokenizer.state=jz.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===J.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==q.HTML))switch(this.fragmentContextID){case Y.TITLE:case Y.TEXTAREA:this.tokenizer.state=jz.RCDATA;break;case Y.STYLE:case Y.XMP:case Y.IFRAME:case Y.NOEMBED:case Y.NOFRAMES:case Y.NOSCRIPT:this.tokenizer.state=jz.RAWTEXT;break;case Y.SCRIPT:this.tokenizer.state=jz.SCRIPT_DATA;break;case Y.PLAINTEXT:this.tokenizer.state=jz.PLAINTEXT;break;default:}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,q.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,q.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(J.HTML,q.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,Y.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===lz.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===Y.SVG&&this.treeAdapter.getTagName(t)===J.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===q.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===Y.MGLYPH||e.tagID===Y.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,q.HTML)}_processToken(e){switch(e.type){case lz.CHARACTER:this.onCharacter(e);break;case lz.NULL_CHARACTER:this.onNullCharacter(e);break;case lz.COMMENT:this.onComment(e);break;case lz.DOCTYPE:this.onDoctype(e);break;case lz.START_TAG:this._processStartTag(e);break;case lz.END_TAG:this.onEndTag(e);break;case lz.EOF:this.onEof(e);break;case lz.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e);break}}_isIntegrationPoint(e,t,n){return AB(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===tB.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Q.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(Y.P),this.openElements.popUntilTagNamePopped(Y.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case Y.TR:this.insertionMode=Q.IN_ROW;return;case Y.TBODY:case Y.THEAD:case Y.TFOOT:this.insertionMode=Q.IN_TABLE_BODY;return;case Y.CAPTION:this.insertionMode=Q.IN_CAPTION;return;case Y.COLGROUP:this.insertionMode=Q.IN_COLUMN_GROUP;return;case Y.TABLE:this.insertionMode=Q.IN_TABLE;return;case Y.BODY:this.insertionMode=Q.IN_BODY;return;case Y.FRAMESET:this.insertionMode=Q.IN_FRAMESET;return;case Y.SELECT:this._resetInsertionModeForSelect(e);return;case Y.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case Y.HTML:this.insertionMode=this.headElement?Q.AFTER_HEAD:Q.BEFORE_HEAD;return;case Y.TD:case Y.TH:if(e>0){this.insertionMode=Q.IN_CELL;return}break;case Y.HEAD:if(e>0){this.insertionMode=Q.IN_HEAD;return}break}this.insertionMode=Q.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===Y.TEMPLATE)break;if(e===Y.TABLE){this.insertionMode=Q.IN_SELECT_IN_TABLE;return}}this.insertionMode=Q.IN_SELECT}_isElementCausesFosterParenting(e){return FB.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case Y.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===q.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case Y.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return kz[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){tU(this,e);return}switch(this.insertionMode){case Q.INITIAL:XB(this,e);break;case Q.BEFORE_HTML:$B(this,e);break;case Q.BEFORE_HEAD:nV(this,e);break;case Q.IN_HEAD:oV(this,e);break;case Q.IN_HEAD_NO_SCRIPT:lV(this,e);break;case Q.AFTER_HEAD:fV(this,e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:hV(this,e);break;case Q.TEXT:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:uH(this,e);break;case Q.IN_TABLE_TEXT:CH(this,e);break;case Q.IN_COLUMN_GROUP:AH(this,e);break;case Q.AFTER_BODY:KH(this,e);break;case Q.AFTER_AFTER_BODY:QH(this,e);break;default:}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){eU(this,e);return}switch(this.insertionMode){case Q.INITIAL:XB(this,e);break;case Q.BEFORE_HTML:$B(this,e);break;case Q.BEFORE_HEAD:nV(this,e);break;case Q.IN_HEAD:oV(this,e);break;case Q.IN_HEAD_NO_SCRIPT:lV(this,e);break;case Q.AFTER_HEAD:fV(this,e);break;case Q.TEXT:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:uH(this,e);break;case Q.IN_COLUMN_GROUP:AH(this,e);break;case Q.AFTER_BODY:KH(this,e);break;case Q.AFTER_AFTER_BODY:QH(this,e);break;default:}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){GB(this,e);return}switch(this.insertionMode){case Q.INITIAL:case Q.BEFORE_HTML:case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_TEMPLATE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:GB(this,e);break;case Q.IN_TABLE_TEXT:wH(this,e);break;case Q.AFTER_BODY:KB(this,e);break;case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:qB(this,e);break;default:}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Q.INITIAL:YB(this,e);break;case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:this._err(e,K.misplacedDoctype);break;case Q.IN_TABLE_TEXT:wH(this,e);break;default:}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,K.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?rU(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:XB(this,e);break;case Q.BEFORE_HTML:ZB(this,e);break;case Q.BEFORE_HEAD:eV(this,e);break;case Q.IN_HEAD:rV(this,e);break;case Q.IN_HEAD_NO_SCRIPT:sV(this,e);break;case Q.AFTER_HEAD:uV(this,e);break;case Q.IN_BODY:JV(this,e);break;case Q.IN_TABLE:yH(this,e);break;case Q.IN_TABLE_TEXT:wH(this,e);break;case Q.IN_CAPTION:EH(this,e);break;case Q.IN_COLUMN_GROUP:OH(this,e);break;case Q.IN_TABLE_BODY:jH(this,e);break;case Q.IN_ROW:NH(this,e);break;case Q.IN_CELL:FH(this,e);break;case Q.IN_SELECT:LH(this,e);break;case Q.IN_SELECT_IN_TABLE:zH(this,e);break;case Q.IN_TEMPLATE:VH(this,e);break;case Q.AFTER_BODY:WH(this,e);break;case Q.IN_FRAMESET:qH(this,e);break;case Q.AFTER_FRAMESET:YH(this,e);break;case Q.AFTER_AFTER_BODY:ZH(this,e);break;case Q.AFTER_AFTER_FRAMESET:$H(this,e);break;default:}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?iU(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:XB(this,e);break;case Q.BEFORE_HTML:QB(this,e);break;case Q.BEFORE_HEAD:tV(this,e);break;case Q.IN_HEAD:iV(this,e);break;case Q.IN_HEAD_NO_SCRIPT:cV(this,e);break;case Q.AFTER_HEAD:dV(this,e);break;case Q.IN_BODY:oH(this,e);break;case Q.TEXT:cH(this,e);break;case Q.IN_TABLE:bH(this,e);break;case Q.IN_TABLE_TEXT:wH(this,e);break;case Q.IN_CAPTION:DH(this,e);break;case Q.IN_COLUMN_GROUP:kH(this,e);break;case Q.IN_TABLE_BODY:MH(this,e);break;case Q.IN_ROW:PH(this,e);break;case Q.IN_CELL:IH(this,e);break;case Q.IN_SELECT:RH(this,e);break;case Q.IN_SELECT_IN_TABLE:BH(this,e);break;case Q.IN_TEMPLATE:HH(this,e);break;case Q.AFTER_BODY:GH(this,e);break;case Q.IN_FRAMESET:JH(this,e);break;case Q.AFTER_FRAMESET:XH(this,e);break;case Q.AFTER_AFTER_BODY:QH(this,e);break;default:}}onEof(e){switch(this.insertionMode){case Q.INITIAL:XB(this,e);break;case Q.BEFORE_HTML:$B(this,e);break;case Q.BEFORE_HEAD:nV(this,e);break;case Q.IN_HEAD:oV(this,e);break;case Q.IN_HEAD_NO_SCRIPT:lV(this,e);break;case Q.AFTER_HEAD:fV(this,e);break;case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:sH(this,e);break;case Q.TEXT:lH(this,e);break;case Q.IN_TABLE_TEXT:wH(this,e);break;case Q.IN_TEMPLATE:UH(this,e);break;case Q.AFTER_BODY:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:JB(this,e);break;default:}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===G.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.TEXT:case Q.IN_COLUMN_GROUP:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:this._insertCharacters(e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:case Q.AFTER_BODY:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:mV(this,e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:uH(this,e);break;case Q.IN_TABLE_TEXT:SH(this,e);break;default:}}};function RB(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):aH(e,t),n}function zB(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function BB(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=NB;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=VB(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function VB(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function HB(e,t,n){let r=Oz(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===Y.TEMPLATE&&i===q.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function UB(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function WB(e,t){for(let n=0;n<MB;n++){let n=RB(e,t);if(!n)break;let r=zB(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=BB(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&HB(e,a,i),UB(e,r,n)}}function GB(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function KB(e,t){e._appendCommentNode(t,e.openElements.items[0])}function qB(e,t){e._appendCommentNode(t,e.document)}function JB(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function YB(e,t){e._setDocumentType(t);let n=t.forceQuirks?Ez.QUIRKS:hB(t);mB(t)||e._err(t,K.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Q.BEFORE_HTML}function XB(e,t){e._err(t,K.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Ez.QUIRKS),e.insertionMode=Q.BEFORE_HTML,e._processToken(t)}function ZB(e,t){t.tagID===Y.HTML?(e._insertElement(t,q.HTML),e.insertionMode=Q.BEFORE_HEAD):$B(e,t)}function QB(e,t){let n=t.tagID;(n===Y.HTML||n===Y.HEAD||n===Y.BODY||n===Y.BR)&&$B(e,t)}function $B(e,t){e._insertFakeRootElement(),e.insertionMode=Q.BEFORE_HEAD,e._processToken(t)}function eV(e,t){switch(t.tagID){case Y.HTML:JV(e,t);break;case Y.HEAD:e._insertElement(t,q.HTML),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD;break;default:nV(e,t)}}function tV(e,t){let n=t.tagID;n===Y.HEAD||n===Y.BODY||n===Y.HTML||n===Y.BR?nV(e,t):e._err(t,K.endTagWithoutMatchingOpenElement)}function nV(e,t){e._insertFakeElement(J.HEAD,Y.HEAD),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD,e._processToken(t)}function rV(e,t){switch(t.tagID){case Y.HTML:JV(e,t);break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TITLE:e._switchToTextParsing(t,jz.RCDATA);break;case Y.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,jz.RAWTEXT):(e._insertElement(t,q.HTML),e.insertionMode=Q.IN_HEAD_NO_SCRIPT);break;case Y.NOFRAMES:case Y.STYLE:e._switchToTextParsing(t,jz.RAWTEXT);break;case Y.SCRIPT:e._switchToTextParsing(t,jz.SCRIPT_DATA);break;case Y.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Q.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE);break;case Y.HEAD:e._err(t,K.misplacedStartTagForHeadElement);break;default:oV(e,t)}}function iV(e,t){switch(t.tagID){case Y.HEAD:e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD;break;case Y.BODY:case Y.BR:case Y.HTML:oV(e,t);break;case Y.TEMPLATE:aV(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function aV(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==Y.TEMPLATE&&e._err(t,K.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,K.endTagWithoutMatchingOpenElement)}function oV(e,t){e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD,e._processToken(t)}function sV(e,t){switch(t.tagID){case Y.HTML:JV(e,t);break;case Y.BASEFONT:case Y.BGSOUND:case Y.HEAD:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.STYLE:rV(e,t);break;case Y.NOSCRIPT:e._err(t,K.nestedNoscriptInHead);break;default:lV(e,t)}}function cV(e,t){switch(t.tagID){case Y.NOSCRIPT:e.openElements.pop(),e.insertionMode=Q.IN_HEAD;break;case Y.BR:lV(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function lV(e,t){let n=t.type===lz.EOF?K.openElementsLeftAfterEof:K.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Q.IN_HEAD,e._processToken(t)}function uV(e,t){switch(t.tagID){case Y.HTML:JV(e,t);break;case Y.BODY:e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_BODY;break;case Y.FRAMESET:e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET;break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:e._err(t,K.abandonedHeadElementChild),e.openElements.push(e.headElement,Y.HEAD),rV(e,t),e.openElements.remove(e.headElement);break;case Y.HEAD:e._err(t,K.misplacedStartTagForHeadElement);break;default:fV(e,t)}}function dV(e,t){switch(t.tagID){case Y.BODY:case Y.HTML:case Y.BR:fV(e,t);break;case Y.TEMPLATE:aV(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function fV(e,t){e._insertFakeElement(J.BODY,Y.BODY),e.insertionMode=Q.IN_BODY,pV(e,t)}function pV(e,t){switch(t.type){case lz.CHARACTER:hV(e,t);break;case lz.WHITESPACE_CHARACTER:mV(e,t);break;case lz.COMMENT:GB(e,t);break;case lz.START_TAG:JV(e,t);break;case lz.END_TAG:oH(e,t);break;case lz.EOF:sH(e,t);break;default:}}function mV(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function hV(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function gV(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function _V(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function vV(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET)}function yV(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function bV(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Az.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,q.HTML)}function xV(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function SV(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),n||(e.formElement=e.openElements.current))}function CV(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===Y.LI&&r===Y.LI||(n===Y.DD||n===Y.DT)&&(r===Y.DD||r===Y.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==Y.ADDRESS&&r!==Y.DIV&&r!==Y.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function wV(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.tokenizer.state=jz.PLAINTEXT}function TV(e,t){e.openElements.hasInScope(Y.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1}function EV(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(J.A);n&&(WB(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function DV(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function OV(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(Y.NOBR)&&(WB(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function kV(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function AV(e,t){e.treeAdapter.getDocumentMode(e.document)!==Ez.QUIRKS&&e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_TABLE}function jV(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function MV(e){let t=uz(e,Tz.TYPE);return t!=null&&t.toLowerCase()===jB}function NV(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),MV(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function PV(e,t){e._appendElement(t,q.HTML),t.ackSelfClosing=!0}function FV(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function IV(e,t){t.tagName=J.IMG,t.tagID=Y.IMG,jV(e,t)}function LV(e,t){e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.tokenizer.state=jz.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Q.TEXT}function RV(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,jz.RAWTEXT)}function zV(e,t){e.framesetOk=!1,e._switchToTextParsing(t,jz.RAWTEXT)}function BV(e,t){e._switchToTextParsing(t,jz.RAWTEXT)}function VV(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Q.IN_TABLE||e.insertionMode===Q.IN_CAPTION||e.insertionMode===Q.IN_TABLE_BODY||e.insertionMode===Q.IN_ROW||e.insertionMode===Q.IN_CELL?Q.IN_SELECT_IN_TABLE:Q.IN_SELECT}function HV(e,t){e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function UV(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,q.HTML)}function WV(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(Y.RTC),e._insertElement(t,q.HTML)}function GV(e,t){e._reconstructActiveFormattingElements(),wB(t),EB(t),t.selfClosing?e._appendElement(t,q.MATHML):e._insertElement(t,q.MATHML),t.ackSelfClosing=!0}function KV(e,t){e._reconstructActiveFormattingElements(),TB(t),EB(t),t.selfClosing?e._appendElement(t,q.SVG):e._insertElement(t,q.SVG),t.ackSelfClosing=!0}function qV(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function JV(e,t){switch(t.tagID){case Y.I:case Y.S:case Y.B:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.SMALL:case Y.STRIKE:case Y.STRONG:DV(e,t);break;case Y.A:EV(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:bV(e,t);break;case Y.P:case Y.DL:case Y.OL:case Y.UL:case Y.DIV:case Y.DIR:case Y.NAV:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.DETAILS:case Y.ADDRESS:case Y.ARTICLE:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:yV(e,t);break;case Y.LI:case Y.DD:case Y.DT:CV(e,t);break;case Y.BR:case Y.IMG:case Y.WBR:case Y.AREA:case Y.EMBED:case Y.KEYGEN:jV(e,t);break;case Y.HR:FV(e,t);break;case Y.RB:case Y.RTC:UV(e,t);break;case Y.RT:case Y.RP:WV(e,t);break;case Y.PRE:case Y.LISTING:xV(e,t);break;case Y.XMP:RV(e,t);break;case Y.SVG:KV(e,t);break;case Y.HTML:gV(e,t);break;case Y.BASE:case Y.LINK:case Y.META:case Y.STYLE:case Y.TITLE:case Y.SCRIPT:case Y.BGSOUND:case Y.BASEFONT:case Y.TEMPLATE:rV(e,t);break;case Y.BODY:_V(e,t);break;case Y.FORM:SV(e,t);break;case Y.NOBR:OV(e,t);break;case Y.MATH:GV(e,t);break;case Y.TABLE:AV(e,t);break;case Y.INPUT:NV(e,t);break;case Y.PARAM:case Y.TRACK:case Y.SOURCE:PV(e,t);break;case Y.IMAGE:IV(e,t);break;case Y.BUTTON:TV(e,t);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:kV(e,t);break;case Y.IFRAME:zV(e,t);break;case Y.SELECT:VV(e,t);break;case Y.OPTION:case Y.OPTGROUP:HV(e,t);break;case Y.NOEMBED:case Y.NOFRAMES:BV(e,t);break;case Y.FRAMESET:vV(e,t);break;case Y.TEXTAREA:LV(e,t);break;case Y.NOSCRIPT:e.options.scriptingEnabled?BV(e,t):qV(e,t);break;case Y.PLAINTEXT:wV(e,t);break;case Y.COL:case Y.TH:case Y.TD:case Y.TR:case Y.HEAD:case Y.FRAME:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.CAPTION:case Y.COLGROUP:break;default:qV(e,t)}}function YV(e,t){if(e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function XV(e,t){e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,GH(e,t))}function ZV(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function QV(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(Y.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(Y.FORM):n&&e.openElements.remove(n))}function $V(e){e.openElements.hasInButtonScope(Y.P)||e._insertFakeElement(J.P,Y.P),e._closePElement()}function eH(e){e.openElements.hasInListItemScope(Y.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(Y.LI),e.openElements.popUntilTagNamePopped(Y.LI))}function tH(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function nH(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function rH(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function iH(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(J.BR,Y.BR),e.openElements.pop(),e.framesetOk=!1}function aH(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==Y.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function oH(e,t){switch(t.tagID){case Y.A:case Y.B:case Y.I:case Y.S:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.NOBR:case Y.SMALL:case Y.STRIKE:case Y.STRONG:WB(e,t);break;case Y.P:$V(e);break;case Y.DL:case Y.UL:case Y.OL:case Y.DIR:case Y.DIV:case Y.NAV:case Y.PRE:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.BUTTON:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.ADDRESS:case Y.ARTICLE:case Y.DETAILS:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.LISTING:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:ZV(e,t);break;case Y.LI:eH(e);break;case Y.DD:case Y.DT:tH(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:nH(e);break;case Y.BR:iH(e);break;case Y.BODY:YV(e,t);break;case Y.HTML:XV(e,t);break;case Y.FORM:QV(e);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:rH(e,t);break;case Y.TEMPLATE:aV(e,t);break;default:aH(e,t)}}function sH(e,t){e.tmplInsertionModeStack.length>0?UH(e,t):JB(e,t)}function cH(e,t){var n;t.tagID===Y.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function lH(e,t){e._err(t,K.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function uH(e,t){if(e.openElements.currentTagId!==void 0&&FB.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Q.IN_TABLE_TEXT,t.type){case lz.CHARACTER:CH(e,t);break;case lz.WHITESPACE_CHARACTER:SH(e,t);break}else xH(e,t)}function dH(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CAPTION}function fH(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_COLUMN_GROUP}function pH(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.COLGROUP,Y.COLGROUP),e.insertionMode=Q.IN_COLUMN_GROUP,OH(e,t)}function mH(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_TABLE_BODY}function hH(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.TBODY,Y.TBODY),e.insertionMode=Q.IN_TABLE_BODY,jH(e,t)}function gH(e,t){e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function _H(e,t){MV(t)?e._appendElement(t,q.HTML):xH(e,t),t.ackSelfClosing=!0}function vH(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,q.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function yH(e,t){switch(t.tagID){case Y.TD:case Y.TH:case Y.TR:hH(e,t);break;case Y.STYLE:case Y.SCRIPT:case Y.TEMPLATE:rV(e,t);break;case Y.COL:pH(e,t);break;case Y.FORM:vH(e,t);break;case Y.TABLE:gH(e,t);break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:mH(e,t);break;case Y.INPUT:_H(e,t);break;case Y.CAPTION:dH(e,t);break;case Y.COLGROUP:fH(e,t);break;default:xH(e,t)}}function bH(e,t){switch(t.tagID){case Y.TABLE:e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode());break;case Y.TEMPLATE:aV(e,t);break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:xH(e,t)}}function xH(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,pV(e,t),e.fosterParentingEnabled=n}function SH(e,t){e.pendingCharacterTokens.push(t)}function CH(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function wH(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)xH(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var TH=new Set([Y.CAPTION,Y.COL,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]);function EH(e,t){let n=t.tagID;TH.has(n)?e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,yH(e,t)):JV(e,t)}function DH(e,t){let n=t.tagID;switch(n){case Y.CAPTION:case Y.TABLE:e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,n===Y.TABLE&&bH(e,t));break;case Y.BODY:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:oH(e,t)}}function OH(e,t){switch(t.tagID){case Y.HTML:JV(e,t);break;case Y.COL:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TEMPLATE:rV(e,t);break;default:AH(e,t)}}function kH(e,t){switch(t.tagID){case Y.COLGROUP:e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TEMPLATE:aV(e,t);break;case Y.COL:break;default:AH(e,t)}}function AH(e,t){e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE,e._processToken(t))}function jH(e,t){switch(t.tagID){case Y.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_ROW;break;case Y.TH:case Y.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(J.TR,Y.TR),e.insertionMode=Q.IN_ROW,NH(e,t);break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,yH(e,t));break;default:yH(e,t)}}function MH(e,t){let n=t.tagID;switch(t.tagID){case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,bH(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:case Y.TR:break;default:bH(e,t)}}function NH(e,t){switch(t.tagID){case Y.TH:case Y.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CELL,e.activeFormattingElements.insertMarker();break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,jH(e,t));break;default:yH(e,t)}}function PH(e,t){switch(t.tagID){case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY);break;case Y.TABLE:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,MH(e,t));break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(Y.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,MH(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:break;default:bH(e,t)}}function FH(e,t){let n=t.tagID;TH.has(n)?(e.openElements.hasInTableScope(Y.TD)||e.openElements.hasInTableScope(Y.TH))&&(e._closeTableCell(),NH(e,t)):JV(e,t)}function IH(e,t){let n=t.tagID;switch(n){case Y.TD:case Y.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_ROW);break;case Y.TABLE:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),PH(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:break;default:oH(e,t)}}function LH(e,t){switch(t.tagID){case Y.HTML:JV(e,t);break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.OPTGROUP:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.HR:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.INPUT:case Y.KEYGEN:case Y.TEXTAREA:case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),t.tagID!==Y.SELECT&&e._processStartTag(t));break;case Y.SCRIPT:case Y.TEMPLATE:rV(e,t);break;default:}}function RH(e,t){switch(t.tagID){case Y.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===Y.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===Y.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop();break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop();break;case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode());break;case Y.TEMPLATE:aV(e,t);break;default:}}function zH(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e._processStartTag(t)):LH(e,t)}function BH(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e.onEndTag(t)):RH(e,t)}function VH(e,t){switch(t.tagID){case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:rV(e,t);break;case Y.CAPTION:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.tmplInsertionModeStack[0]=Q.IN_TABLE,e.insertionMode=Q.IN_TABLE,yH(e,t);break;case Y.COL:e.tmplInsertionModeStack[0]=Q.IN_COLUMN_GROUP,e.insertionMode=Q.IN_COLUMN_GROUP,OH(e,t);break;case Y.TR:e.tmplInsertionModeStack[0]=Q.IN_TABLE_BODY,e.insertionMode=Q.IN_TABLE_BODY,jH(e,t);break;case Y.TD:case Y.TH:e.tmplInsertionModeStack[0]=Q.IN_ROW,e.insertionMode=Q.IN_ROW,NH(e,t);break;default:e.tmplInsertionModeStack[0]=Q.IN_BODY,e.insertionMode=Q.IN_BODY,JV(e,t)}}function HH(e,t){t.tagID===Y.TEMPLATE&&aV(e,t)}function UH(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):JB(e,t)}function WH(e,t){t.tagID===Y.HTML?JV(e,t):KH(e,t)}function GH(e,t){if(t.tagID===Y.HTML){if(e.fragmentContext||(e.insertionMode=Q.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===Y.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else KH(e,t)}function KH(e,t){e.insertionMode=Q.IN_BODY,pV(e,t)}function qH(e,t){switch(t.tagID){case Y.HTML:JV(e,t);break;case Y.FRAMESET:e._insertElement(t,q.HTML);break;case Y.FRAME:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.NOFRAMES:rV(e,t);break;default:}}function JH(e,t){t.tagID===Y.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==Y.FRAMESET&&(e.insertionMode=Q.AFTER_FRAMESET))}function YH(e,t){switch(t.tagID){case Y.HTML:JV(e,t);break;case Y.NOFRAMES:rV(e,t);break;default:}}function XH(e,t){t.tagID===Y.HTML&&(e.insertionMode=Q.AFTER_AFTER_FRAMESET)}function ZH(e,t){t.tagID===Y.HTML?JV(e,t):QH(e,t)}function QH(e,t){e.insertionMode=Q.IN_BODY,pV(e,t)}function $H(e,t){switch(t.tagID){case Y.HTML:JV(e,t);break;case Y.NOFRAMES:rV(e,t);break;default:}}function eU(e,t){t.chars=`�`,e._insertCharacters(t)}function tU(e,t){e._insertCharacters(t),e.framesetOk=!1}function nU(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==q.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function rU(e,t){if(CB(t))nU(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===q.MATHML?wB(t):r===q.SVG&&(DB(t),TB(t)),EB(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function iU(e,t){if(t.tagID===Y.P||t.tagID===Y.BR){nU(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===q.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}new Set([J.AREA,J.BASE,J.BASEFONT,J.BGSOUND,J.BR,J.COL,J.EMBED,J.FRAME,J.HR,J.IMG,J.INPUT,J.KEYGEN,J.LINK,J.META,J.PARAM,J.SOURCE,J.TRACK,J.WBR]);var aU=sU(`end`),oU=sU(`start`);function sU(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function cU(e){let t=oU(e),n=aU(e);if(t&&n)return{start:t,end:n}}var lU=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,uU=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),dU={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function fU(e,t){let n=EU(e),r=zR(`type`,{handlers:{root:mU,element:hU,text:gU,comment:yU,doctype:_U,raw:bU},unknown:xU}),i={parser:n?new LB(dU):LB.getFragmentParser(void 0,dU),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),SU(i,oU());let a=AR(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&iL(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function pU(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function mU(e,t){pU(e.children,t)}function hU(e,t){wU(e,t),pU(e.children,t),TU(e,t)}function gU(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:lz.CHARACTER,chars:e.value,location:DU(e)};SU(t,oU(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function _U(e,t){let n={type:lz.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:DU(e)};SU(t,oU(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function vU(e,t){t.stitches=!0;let n=OU(e);`children`in e&&`children`in n&&(n.children=fU({type:`root`,children:e.children},t.options).children),yU({type:`comment`,value:{stitch:n}},t)}function yU(e,t){let n=e.value,r={type:lz.COMMENT,data:n,location:DU(e)};SU(t,oU(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function bU(e,t){if(t.parser.tokenizer.preprocessor.html=``,t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,CU(t,oU(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(lU,`<$1$2`):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function xU(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))vU(n,t);else{let e=``;throw uU.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function SU(e,t){CU(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=jz.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:``,value:``}}function CU(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function wU(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===jz.PLAINTEXT)return;SU(t,oU(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:DR.html;i===DR.html&&n===`svg`&&(i=DR.svg);let a=UR({...e,children:[]},{space:i===DR.svg?`svg`:`html`}),o={type:lz.START_TAG,tagName:n,tagID:Oz(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:DU(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function TU(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&$R.includes(n)||t.parser.tokenizer.state===jz.PLAINTEXT)return;SU(t,aU(e));let r={type:lz.END_TAG,tagName:n,tagID:Oz(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:DU(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===jz.RCDATA||t.parser.tokenizer.state===jz.RAWTEXT||t.parser.tokenizer.state===jz.SCRIPT_DATA)&&(t.parser.tokenizer.state=jz.DATA)}function EU(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function DU(e){let t=oU(e)||{line:void 0,column:void 0,offset:void 0},n=aU(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function OU(e){return`children`in e?OL({...e,children:[]}):OL(e)}function kU(e){return function(t,n){return fU(t,{...e,file:n})}}var AU=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],jU={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...AU,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...AU],h2:[[`className`,`sr-only`]],img:[...AU,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...AU,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...AU],table:[...AU],ul:[...AU,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},MU={}.hasOwnProperty;function NU(e,t){let n={type:`root`,children:[]},r=PU({schema:t?{...jU,...t}:jU,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function PU(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return FU(e,n);case`doctype`:return IU(e,n);case`element`:return LU(e,n);case`root`:return RU(e,n);case`text`:return zU(e,n);default:}}}function FU(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return KU(r,t),r}}function IU(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return KU(e,t),e}}function LU(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=BU(e,t.children),i=VU(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&MU.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:`element`,tagName:n,properties:i,children:r};return KU(o,t),o}function RU(e,t){let n={type:`root`,children:BU(e,t.children)};return KU(n,t),n}function zU(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return KU(n,t),n}function BU(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=PU(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function VU(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&MU.call(r,n)?r[n]:void 0,o=r&&MU.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(MU.call(s,l)){let t=s[l],n=HU(e,qU(a,l),l,t);n??=HU(e,qU(o,l),l,t),n!=null&&(c[l]=n)}if(i&&MU.call(i,n)){let e=i[n];for(l in e)MU.call(e,l)&&!MU.call(c,l)&&(c[l]=e[l])}return c}function HU(e,t,n,r){return t?Array.isArray(r)?UU(e,t,n,r):WU(e,t,n,r):void 0}function UU(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=WU(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function WU(e,t,n,r){if(!(typeof r!=`boolean`&&typeof r!=`number`&&typeof r!=`string`)&&GU(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function GU(e,t,n){let r=e.schema.protocols&&MU.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),a=i.indexOf(`:`),o=i.indexOf(`?`),s=i.indexOf(`#`),c=i.indexOf(`/`);if(a<0||c>-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l<r.length;){let e=r[l];if(a===e.length&&i.slice(0,e.length)===e)return!0}return!1}function KU(e,t){let n=cU(t);t.data&&(e.data=OL(t.data)),n&&(e.position=n)}function qU(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}function JU(e){return function(t){return NU(t,e)}}function YU(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var XU=cW(/[A-Za-z]/),ZU=cW(/[\dA-Za-z]/),QU=cW(/[#-'*+\--9=?A-Z^-~]/);function $U(e){return e!==null&&(e<32||e===127)}var eW=cW(/\d/),tW=cW(/[\dA-Fa-f]/),nW=cW(/[!-/:-@[-`{-~]/);function rW(e){return e!==null&&e<-2}function iW(e){return e!==null&&(e<0||e===32)}function aW(e){return e===-2||e===-1||e===32}var oW=cW(/\p{P}|\p{S}/u),sW=cW(/\s/);function cW(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function lW(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function uW(e,t,n){let r=KI((n||{}).ignore||[]),i=dW(t),a=-1;for(;++a<i.length;)nL(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function dW(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([fW(e[0]),pW(e[1])])}return t}function fW(e){return typeof e==`string`?new RegExp(lW(e),`g`):e}function pW(e){return typeof e==`function`?e:function(){return e}}var mW=`phrasing`,hW=[`autolink`,`link`,`image`,`label`];function gW(){return{transforms:[wW],enter:{literalAutolink:vW,literalAutolinkEmail:yW,literalAutolinkHttp:yW,literalAutolinkWww:yW},exit:{literalAutolink:CW,literalAutolinkEmail:SW,literalAutolinkHttp:bW,literalAutolinkWww:xW}}}function _W(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:mW,notInConstruct:hW},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:mW,notInConstruct:hW},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:mW,notInConstruct:hW}]}}function vW(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function yW(e){this.config.enter.autolinkProtocol.call(this,e)}function bW(e){this.config.exit.autolinkProtocol.call(this,e)}function xW(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function SW(e){this.config.exit.autolinkEmail.call(this,e)}function CW(e){this.exit(e)}function wW(e){uW(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,TW],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,EW]],{ignore:[`link`,`linkReference`]})}function TW(e,t,n,r,i){let a=``;if(!kW(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!DW(n)))return!1;let o=OW(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function EW(e,t,n,r){return!kW(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function DW(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function OW(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=YU(e,`(`),a=YU(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function kW(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||sW(n)||oW(n))&&(!t||n!==47)}function AW(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}BW.peek=zW;function jW(){this.buffer()}function MW(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function NW(){this.buffer()}function PW(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function FW(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=AW(this.sliceSerialize(e)).toLowerCase(),n.label=t}function IW(e){this.exit(e)}function LW(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=AW(this.sliceSerialize(e)).toLowerCase(),n.label=t}function RW(e){this.exit(e)}function zW(){return`[`}function BW(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function VW(){return{enter:{gfmFootnoteCallString:jW,gfmFootnoteCall:MW,gfmFootnoteDefinitionLabelString:NW,gfmFootnoteDefinition:PW},exit:{gfmFootnoteCallString:FW,gfmFootnoteCall:IW,gfmFootnoteDefinitionLabelString:LW,gfmFootnoteDefinition:RW}}}function HW(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:BW},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
130
130
|
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?WW:UW))),s(),o}}function UW(e,t,n){return t===0?e:WW(e,t,n)}function WW(e,t,n){return(n?``:` `)+e}var GW=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];XW.peek=ZW;function KW(){return{canContainEols:[`delete`],enter:{strikethrough:JW},exit:{strikethrough:YW}}}function qW(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:GW}],handlers:{delete:XW}}}function JW(e){this.enter({type:`delete`,children:[]},e)}function YW(e){this.exit(e)}function XW(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function ZW(){return`~`}function QW(e){return e.length}function $W(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||QW,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=eG(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=tG(r[d]);else{let e=tG(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
131
131
|
`)}function eG(e){return e==null?``:String(e)}function tG(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function nG(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),rG);return i(),o}function rG(e,t,n){return`>`+(n?``:` `)+e}function iG(e,t){return aG(e,t.inConstruct,!0)&&!aG(e,t.notInConstruct,!1)}function aG(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function oG(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
@@ -214,14 +214,14 @@ ${e}</tr>
|
|
|
214
214
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${AQ(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=jQ(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+AQ(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=jQ(e);if(i===null)return AQ(n);e=i;let a=`<img src="${e}" alt="${AQ(n)}"`;return t&&(a+=` title="${AQ(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:AQ(e.text)}},RQ=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}},zQ=class e{options;renderer;textRenderer;constructor(e){this.options=e||ZZ,this.options.renderer=this.options.renderer||new LQ,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new RQ}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}},BQ=class{options;block;constructor(e){this.options=e||ZZ}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?IQ.lex:IQ.lexInline}provideParser(e=this.block){return e?zQ.parse:zQ.parseInline}},VQ=new class{defaults=XZ();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=zQ;Renderer=LQ;TextRenderer=RQ;Lexer=IQ;Tokenizer=FQ;Hooks=BQ;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 LQ(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 FQ(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 BQ;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];BQ.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&BQ.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 IQ.lex(e,t??this.defaults)}parser(e,t){return zQ.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?IQ.lex:IQ.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?zQ.parse:zQ.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?IQ.lex:IQ.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?zQ.parse:zQ.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
215
215
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+AQ(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function HQ(e,t){return VQ.parse(e,t)}HQ.options=HQ.setOptions=function(e){return VQ.setOptions(e),HQ.defaults=VQ.defaults,QZ(HQ.defaults),HQ},HQ.getDefaults=XZ,HQ.defaults=ZZ,HQ.use=function(...e){return VQ.use(...e),HQ.defaults=VQ.defaults,QZ(HQ.defaults),HQ},HQ.walkTokens=function(e,t){return VQ.walkTokens(e,t)},HQ.parseInline=VQ.parseInline,HQ.Parser=zQ,HQ.parser=zQ.parse,HQ.Renderer=LQ,HQ.TextRenderer=RQ,HQ.Lexer=IQ,HQ.lexer=IQ.lex,HQ.Tokenizer=FQ,HQ.Hooks=BQ,HQ.parse=HQ,HQ.options,HQ.setOptions,HQ.use,HQ.walkTokens,HQ.parseInline,zQ.parse,IQ.lex;var Epe=`modulepreload`,Dpe=function(e){return`/`+e},UQ={},WQ=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=Dpe(t,n),t in UQ)return;UQ[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`:Epe,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)})},Ope=300,kpe=`300px`,Ape=500;function jpe(e={}){let{immediate:t=!1,debounceDelay:n=Ope,rootMargin:r=kpe,idleTimeout:i=Ape}=e,[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,z.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,z.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,z.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?p(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var GQ=/\s/,Mpe=/^\s+$/,Npe=new Set([`code`,`pre`,`svg`,`math`,`annotation`]),Ppe=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,Fpe=e=>e.some(e=>Ppe(e)&&Npe.has(e.tagName)),Ipe=e=>{let t=[],n=``,r=!1;for(let i of e){let e=GQ.test(i);e!==r&&n&&(t.push(n),n=``),n+=i,r=e}return n&&t.push(n),t},Lpe=e=>{let t=[],n=``;for(let r of e)GQ.test(r)?n+=r:(n&&=(t.push(n),``),t.push(r));return n&&t.push(n),t},Rpe=(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}]}},zpe=(e,t,n,r,i)=>{let a=t.at(-1);if(!(a&&`children`in a))return;if(Fpe(t))return tL;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`?Lpe(c):Ipe(c),u=r.prevContentLength,d=l.map(e=>{let t=i.count;if(i.count+=e.length,Mpe.test(e))return{type:`text`,value:e};let r=u>0&&t<u,a=r?0:i.newIndex++*n.stagger;return Rpe(e,n.animation,n.duration,n.easing,r,a)});return o.children.splice(s,1,...d),s+d.length},Bpe=0;function KQ(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=Bpe++,i=()=>e=>{let r={count:0,newIndex:0};nL(e,`text`,(e,i)=>zpe(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}}}KQ();var qQ=(0,z.createContext)(!1),Vpe=()=>(0,z.useContext)(qQ),JQ=(...e)=>c(i(e)),Hpe=(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(` `)},Upe=e=>e?(...t)=>Hpe(e,c(i(t))):JQ,YQ=(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)},XQ=(0,z.createContext)(JQ),ZQ=()=>(0,z.useContext)(XQ),Wpe=JQ(`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`),Gpe=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},QQ=(0,z.memo)(({children:e,result:t,language:n,className:r,startLine:i,lineNumbers:a=!0,...o})=>{let s=ZQ(),c=(0,z.useMemo)(()=>s(Wpe),[s]),l=(0,z.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,Gpe(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,B.jsx)(`div`,{className:s(r,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,...o,children:(0,B.jsx)(`pre`,{className:s(r,`bg-[var(--sdm-bg,inherit]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]`),style:l,children:(0,B.jsx)(`code`,{className:a?s(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:a&&i&&i>1?{counterReset:`line ${i-1}`}:void 0,children:t.tokens.map((e,t)=>(0,B.jsx)(`span`,{className:a?c:void 0,children:e.length===0||e.length===1&&e[0].content===``?`
|
|
216
216
|
`:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,B.jsx)(`span`,{className:s(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),Kpe=({className:e,language:t,style:n,isIncomplete:r,...i})=>(0,B.jsx)(`div`,{className:ZQ()(`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}),$Q=(0,z.createContext)({code:``}),e$=()=>(0,z.useContext)($Q),qpe=({language:e})=>{let t=ZQ();return(0,B.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,B.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},Jpe=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
217
|
-
`;)t--;return e.slice(0,t)},Ype=(0,z.lazy)(()=>WQ(()=>import(`./highlighted-body-OFNGDK62-
|
|
217
|
+
`;)t--;return e.slice(0,t)},Ype=(0,z.lazy)(()=>WQ(()=>import(`./highlighted-body-OFNGDK62-B8scDgZo.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),Xpe=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=ZQ(),l=(0,z.useMemo)(()=>Jpe(e),[e]),u=(0,z.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
|
|
218
218
|
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[l]);return(0,B.jsx)($Q.Provider,{value:{code:e},children:(0,B.jsxs)(Kpe,{isIncomplete:i,language:t,children:[(0,B.jsx)(qpe,{language:t}),r?(0,B.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,B.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(QQ,{className:n,language:t,lineNumbers:o,result:u,startLine:a,...s}),children:(0,B.jsx)(Ype,{className:n,code:l,language:t,lineNumbers:o,raw:u,startLine:a,...s})})]})})},t$={CheckIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,B.jsxs)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,B.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},n$=(0,z.createContext)(t$),Zpe=(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},r$=({icons:e,children:t})=>{let n=(0,z.useRef)(e),r=(0,z.useRef)(e?{...t$,...e}:t$);Zpe(n.current,e)||(n.current=e,r.current=e?{...t$,...e}:t$);let i=r.current;return(0,B.jsx)(n$.Provider,{value:i,children:t})},i$=()=>(0,z.useContext)(n$),a$={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`},o$=(0,z.createContext)(a$),s$=()=>(0,z.useContext)(o$),c$=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=ZQ(),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(0),{code:d}=e$(),{isAnimating:f}=(0,z.useContext)(_1),p=s$(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,z.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=i$(),_=c?g.CheckIcon:g.CopyIcon;return(0,B.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,B.jsx)(_,{size:14})})},l$={"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`},Qpe=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=ZQ(),{code:c}=e$(),{isAnimating:l}=(0,z.useContext)(_1),u=s$(),d=i$(),f=a??c,p=`file.${n&&n in l$?l$[n]:`txt`}`;return(0,B.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{YQ(p,f,`text/plain`),e?.()}catch(e){t?.(e)}},title:u.downloadFile,type:`button`,...o,children:r??(0,B.jsx)(d.DownloadIcon,{size:14})})},u$=()=>{let{Loader2Icon:e}=i$(),t=ZQ();return(0,B.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,B.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,B.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,B.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},$pe=/\.[^/.]+$/,eme=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,...o})=>{let{DownloadIcon:s}=i$(),c=ZQ(),l=(0,z.useRef)(null),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1),m=s$(),h=o.width!=null||o.height!=null,g=(u||h)&&!f,_=f&&!h;(0,z.useEffect)(()=>{let e=l.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;d(t),p(!t)}},[]);let v=(0,z.useCallback)(e=>{d(!0),p(!1),i?.(e)},[i]),y=(0,z.useCallback)(e=>{d(!1),p(!0),a?.(e)},[a]),b=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace($pe,``)}.${i}`}YQ(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,B.jsxs)(`div`,{className:c(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,B.jsx)(`img`,{alt:r,className:c(`max-w-full rounded-lg`,_&&`hidden`,t),"data-streamdown":`image`,onError:y,onLoad:v,ref:l,src:n,...o}),_&&(0,B.jsx)(`span`,{className:c(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:m.imageNotAvailable}),(0,B.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`)}),g&&(0,B.jsx)(`button`,{className:c(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:b,title:m.downloadImage,type:`button`,children:(0,B.jsx)(s,{size:14})})]}):null},d$=0,f$=()=>{d$+=1,d$===1&&(document.body.style.overflow=`hidden`)},p$=()=>{d$=Math.max(0,d$-1),d$===0&&(document.body.style.overflow=``)},tme=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=i$(),c=ZQ(),[l,u]=(0,z.useState)(!1),d=s$(),f=(0,z.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,z.useCallback)(()=>{r(),n()},[r,n]);return(0,z.useEffect)(()=>{if(t){f$();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),p$()}}},[t,n]),t?(0,B.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,B.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,B.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,B.jsx)(s,{size:16})}),(0,B.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,B.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,B.jsx)(o,{size:20}),(0,B.jsx)(`span`,{children:d.openExternalLink})]}),(0,B.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,B.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,B.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,B.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:f,type:`button`,children:l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i,{size:14}),(0,B.jsx)(`span`,{children:d.copied})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(a,{size:14}),(0,B.jsx)(`span`,{children:d.copyLink})]})}),(0,B.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:p,type:`button`,children:[(0,B.jsx)(o,{size:14}),(0,B.jsx)(`span`,{children:d.openLink})]})]})]})}):null},m$=(0,z.createContext)(null),h$=()=>(0,z.useContext)(m$),nme=()=>h$()?.code??null,g$=()=>h$()?.mermaid??null,rme=e=>{var t;let n=h$();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},ime=(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}),ame=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=ZQ(),[s,c]=(0,z.useState)(!1),l=(0,z.useRef)(null),{isAnimating:u}=(0,z.useContext)(_1),d=i$(),f=g$(),p=s$(),m=async t=>{try{if(t===`mmd`){YQ(`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`){YQ(`diagram.svg`,l,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){YQ(`diagram.png`,await ime(l),`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,B.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,B.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:p.downloadDiagram,type:`button`,children:t??(0,B.jsx)(d.DownloadIcon,{size:14})}),s?(0,B.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`svg`),title:p.downloadDiagramAsSvg,type:`button`,children:p.mermaidFormatSvg}),(0,B.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`png`),title:p.downloadDiagramAsPng,type:`button`,children:p.mermaidFormatPng}),(0,B.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`mmd`),title:p.downloadDiagramAsMmd,type:`button`,children:p.mermaidFormatMmd})]}):null]})},ome=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=i$(),c=ZQ(),[l,u]=(0,z.useState)(!1),{isAnimating:d,controls:f}=(0,z.useContext)(_1),p=s$(),m=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0?!0:e.panZoom!==!1})(),h=()=>{u(!l)};return(0,z.useEffect)(()=>{if(l){f$();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),p$()}}},[l]),(0,z.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:h,title:p.viewFullscreen,type:`button`,...a,children:(0,B.jsx)(o,{size:14})}),l?(0,Fv.createPortal)((0,B.jsxs)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),onClick:h,onKeyDown:e=>{e.key===`Escape`&&h()},role:`button`,tabIndex:0,children:[(0,B.jsx)(`button`,{className:c(`absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:h,title:p.exitFullscreen,type:`button`,children:(0,B.jsx)(s,{size:20})}),(0,B.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,B.jsx)(b1,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})},_$=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}},v$=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1,n=!1;for(let r of e){if(r===`"`){t=!0,n=!0;break}(r===`,`||r===`
|
|
219
219
|
`)&&(t=!0)}return t?n?`"${e.replace(/"/g,`""`)}"`:`"${e}"`:e},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(`,`),o+=1);for(let e of n)a[o]=e.map(r).join(`,`),o+=1;return a.join(`
|
|
220
220
|
`)},sme=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
|
|
221
221
|
`||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
|
|
222
222
|
`?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
|
|
223
223
|
`)},y$=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(``)},b$=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=>y$(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?y$(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else r[i]=`| ${e.map(e=>y$(e)).join(` | `)} |`,i+=1;return r.join(`
|
|
224
|
-
`)},x$=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=ZQ(),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=(0,z.useRef)(0),{isAnimating:f}=(0,z.useContext)(_1),p=s$(),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=_$(t),o=({csv:v$,tsv:sme,md:b$}[e]||b$)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let h=i$(),g=c?h.CheckIcon:h.CopyIcon;return(0,B.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,B.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:p.copyTable,type:`button`,children:e??(0,B.jsx)(g,{height:14,width:14})}),o?(0,B.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`md`),title:p.copyTableAsMarkdown,type:`button`,children:p.tableFormatMarkdown}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`csv`),title:p.copyTableAsCsv,type:`button`,children:p.tableFormatCsv}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`tsv`),title:p.copyTableAsTsv,type:`button`,children:p.tableFormatTsv})]}):null]})},S$=({children:e,className:t,onDownload:n,onError:r})=>{let i=ZQ(),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),{isAnimating:c}=(0,z.useContext)(_1),l=s$(),u=i$(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=_$(t),a=e===`csv`?v$(i):b$(i);YQ(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,B.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,B.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,B.jsx)(u.DownloadIcon,{size:14})}),a?(0,B.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},cme=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=i$(),o=ZQ(),[s,c]=(0,z.useState)(!1),{isAnimating:l}=(0,z.useContext)(_1),u=s$(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,z.useEffect)(()=>{if(s){f$();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),p$()}}},[s]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,B.jsx)(i,{size:14})}),s?(0,Fv.createPortal)((0,B.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,B.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,B.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,B.jsx)(x$,{}):null,r?(0,B.jsx)(S$,{}):null,(0,B.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,B.jsx)(a,{size:20})})]}),(0,B.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,B.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},lme=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=ZQ(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,B.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,B.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,B.jsx)(x$,{}):null,l?(0,B.jsx)(S$,{}):null,u?(0,B.jsx)(cme,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,B.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,B.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},ume=/startLine=(\d+)/,dme=/\bnoLineNumbers\b/,fme=(0,z.lazy)(()=>WQ(()=>import(`./mermaid-GHXKKRXX-BZZjoNSF.js`).then(e=>({default:e.Mermaid})),[])),pme=/language-([^\s]+)/;function C$(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 w$(e,t){return e.className===t.className&&C$(e.node,t.node)}var T$=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,E$=(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},D$=(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},O$=(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},k$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ol`,{className:ZQ()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>w$(e,t));k$.displayName=`MarkdownOl`;var A$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`li`,{className:ZQ()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&C$(e.node,t.node));A$.displayName=`MarkdownLi`;var j$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ul`,{className:ZQ()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>w$(e,t));j$.displayName=`MarkdownUl`;var M$=(0,z.memo)(({className:e,node:t,...n})=>(0,B.jsx)(`hr`,{className:ZQ()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>w$(e,t));M$.displayName=`MarkdownHr`;var N$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`span`,{className:ZQ()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>w$(e,t));N$.displayName=`MarkdownStrong`;var P$=(0,z.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=ZQ(),{linkSafety:o}=(0,z.useContext)(_1),[s,c]=(0,z.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,z.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,z.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,z.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,B.jsx)(tme,{...p})]}):(0,B.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>w$(e,t)&&e.href===t.href);P$.displayName=`MarkdownA`;var F$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h1`,{className:ZQ()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>w$(e,t));F$.displayName=`MarkdownH1`;var I$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h2`,{className:ZQ()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>w$(e,t));I$.displayName=`MarkdownH2`;var L$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h3`,{className:ZQ()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>w$(e,t));L$.displayName=`MarkdownH3`;var R$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h4`,{className:ZQ()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>w$(e,t));R$.displayName=`MarkdownH4`;var z$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h5`,{className:ZQ()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>w$(e,t));z$.displayName=`MarkdownH5`;var B$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h6`,{className:ZQ()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>w$(e,t));B$.displayName=`MarkdownH6`;var V$=(0,z.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,z.useContext)(_1);return(0,B.jsx)(lme,{className:t,showControls:T$(i,`table`),showCopy:E$(i,`copy`),showDownload:E$(i,`download`),showFullscreen:E$(i,`fullscreen`),...r,children:e})},(e,t)=>w$(e,t));V$.displayName=`MarkdownTable`;var H$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`thead`,{className:ZQ()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>w$(e,t));H$.displayName=`MarkdownThead`;var U$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tbody`,{className:ZQ()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>w$(e,t));U$.displayName=`MarkdownTbody`;var W$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tr`,{className:ZQ()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>w$(e,t));W$.displayName=`MarkdownTr`;var G$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`th`,{className:ZQ()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>w$(e,t));G$.displayName=`MarkdownTh`;var K$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`td`,{className:ZQ()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>w$(e,t));K$.displayName=`MarkdownTd`;var q$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`blockquote`,{className:ZQ()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>w$(e,t));q$.displayName=`MarkdownBlockquote`;var J$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sup`,{className:ZQ()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>w$(e,t));J$.displayName=`MarkdownSup`;var Y$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sub`,{className:ZQ()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>w$(e,t));Y$.displayName=`MarkdownSub`;var X$=(0,z.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,z.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,z.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,z.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,z.isValidElement)(e))return e;if(e.type===k$){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,B.jsx)(`section`,{className:t,...r,children:i}):null}return(0,B.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>w$(e,t));X$.displayName=`MarkdownSection`;var Z$=(0,z.memo)(({node:e,className:t,children:n,...r})=>{let i=ZQ(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,z.useContext)(_1),l=g$(),u=Vpe(),d=(t?.match(pme))?.at(1)??``,f=rme(d);if(a)return(0,B.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(ume),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&dme.test(p))&&c!==!1,v=``;if((0,z.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(u$,{}),children:(0,B.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=T$(s,`mermaid`),n=O$(s,`download`),r=O$(s,`copy`),a=O$(s,`fullscreen`),c=O$(s,`panZoom`),l=e&&(n||r||a);return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(u$,{}),children:(0,B.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,B.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,B.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,B.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,B.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,B.jsx)(ame,{chart:v,config:o?.config}):null,r?(0,B.jsx)(c$,{code:v}):null,a?(0,B.jsx)(ome,{chart:v,config:o?.config}):null]})}):null,(0,B.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,B.jsx)(fme,{chart:v,config:o?.config,showControls:c})})]})})}let y=T$(s,`code`),b=D$(s,`download`),x=D$(s,`copy`);return(0,B.jsx)(Xpe,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,B.jsxs)(B.Fragment,{children:[b?(0,B.jsx)(Qpe,{code:v,language:d}):null,x?(0,B.jsx)(c$,{}):null]}):null})},(e,t)=>e.className===t.className&&C$(e.node,t.node));Z$.displayName=`MarkdownCode`;var Q$=(0,z.memo)(eme,(e,t)=>e.className===t.className&&C$(e.node,t.node));Q$.displayName=`MarkdownImg`;var $$=(0,z.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,z.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,B.jsx)(B.Fragment,{children:e})}return(0,B.jsx)(`p`,{...n,children:e})},(e,t)=>w$(e,t));$$.displayName=`MarkdownParagraph`;var mme={ol:k$,li:A$,ul:j$,hr:M$,strong:N$,a:P$,h1:F$,h2:I$,h3:L$,h4:R$,h5:z$,h6:B$,table:V$,thead:H$,tbody:U$,tr:W$,th:G$,td:K$,blockquote:q$,code:Z$,img:Q$,pre:({children:e})=>(0,z.isValidElement)(e)?(0,z.cloneElement)(e,{"data-block":`true`}):e,sup:J$,sub:Y$,p:$$,section:X$},hme=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,gme=/\p{L}/u;function e1(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(hme.test(e))return`rtl`;if(gme.test(e))return`ltr`}return`ltr`}var _me=/^[ \t]{0,3}(`{3,}|~{3,})/,vme=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,t1=e=>{let t=e.split(`
|
|
224
|
+
`)},x$=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=ZQ(),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=(0,z.useRef)(0),{isAnimating:f}=(0,z.useContext)(_1),p=s$(),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=_$(t),o=({csv:v$,tsv:sme,md:b$}[e]||b$)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let h=i$(),g=c?h.CheckIcon:h.CopyIcon;return(0,B.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,B.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:p.copyTable,type:`button`,children:e??(0,B.jsx)(g,{height:14,width:14})}),o?(0,B.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`md`),title:p.copyTableAsMarkdown,type:`button`,children:p.tableFormatMarkdown}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`csv`),title:p.copyTableAsCsv,type:`button`,children:p.tableFormatCsv}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`tsv`),title:p.copyTableAsTsv,type:`button`,children:p.tableFormatTsv})]}):null]})},S$=({children:e,className:t,onDownload:n,onError:r})=>{let i=ZQ(),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),{isAnimating:c}=(0,z.useContext)(_1),l=s$(),u=i$(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=_$(t),a=e===`csv`?v$(i):b$(i);YQ(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,B.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,B.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,B.jsx)(u.DownloadIcon,{size:14})}),a?(0,B.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},cme=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=i$(),o=ZQ(),[s,c]=(0,z.useState)(!1),{isAnimating:l}=(0,z.useContext)(_1),u=s$(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,z.useEffect)(()=>{if(s){f$();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),p$()}}},[s]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,B.jsx)(i,{size:14})}),s?(0,Fv.createPortal)((0,B.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,B.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,B.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,B.jsx)(x$,{}):null,r?(0,B.jsx)(S$,{}):null,(0,B.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,B.jsx)(a,{size:20})})]}),(0,B.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,B.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},lme=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=ZQ(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,B.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,B.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,B.jsx)(x$,{}):null,l?(0,B.jsx)(S$,{}):null,u?(0,B.jsx)(cme,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,B.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,B.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},ume=/startLine=(\d+)/,dme=/\bnoLineNumbers\b/,fme=(0,z.lazy)(()=>WQ(()=>import(`./mermaid-GHXKKRXX-BcADHOv7.js`).then(e=>({default:e.Mermaid})),[])),pme=/language-([^\s]+)/;function C$(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 w$(e,t){return e.className===t.className&&C$(e.node,t.node)}var T$=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,E$=(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},D$=(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},O$=(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},k$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ol`,{className:ZQ()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>w$(e,t));k$.displayName=`MarkdownOl`;var A$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`li`,{className:ZQ()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&C$(e.node,t.node));A$.displayName=`MarkdownLi`;var j$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ul`,{className:ZQ()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>w$(e,t));j$.displayName=`MarkdownUl`;var M$=(0,z.memo)(({className:e,node:t,...n})=>(0,B.jsx)(`hr`,{className:ZQ()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>w$(e,t));M$.displayName=`MarkdownHr`;var N$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`span`,{className:ZQ()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>w$(e,t));N$.displayName=`MarkdownStrong`;var P$=(0,z.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=ZQ(),{linkSafety:o}=(0,z.useContext)(_1),[s,c]=(0,z.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,z.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,z.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,z.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,B.jsx)(tme,{...p})]}):(0,B.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>w$(e,t)&&e.href===t.href);P$.displayName=`MarkdownA`;var F$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h1`,{className:ZQ()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>w$(e,t));F$.displayName=`MarkdownH1`;var I$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h2`,{className:ZQ()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>w$(e,t));I$.displayName=`MarkdownH2`;var L$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h3`,{className:ZQ()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>w$(e,t));L$.displayName=`MarkdownH3`;var R$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h4`,{className:ZQ()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>w$(e,t));R$.displayName=`MarkdownH4`;var z$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h5`,{className:ZQ()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>w$(e,t));z$.displayName=`MarkdownH5`;var B$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h6`,{className:ZQ()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>w$(e,t));B$.displayName=`MarkdownH6`;var V$=(0,z.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,z.useContext)(_1);return(0,B.jsx)(lme,{className:t,showControls:T$(i,`table`),showCopy:E$(i,`copy`),showDownload:E$(i,`download`),showFullscreen:E$(i,`fullscreen`),...r,children:e})},(e,t)=>w$(e,t));V$.displayName=`MarkdownTable`;var H$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`thead`,{className:ZQ()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>w$(e,t));H$.displayName=`MarkdownThead`;var U$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tbody`,{className:ZQ()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>w$(e,t));U$.displayName=`MarkdownTbody`;var W$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tr`,{className:ZQ()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>w$(e,t));W$.displayName=`MarkdownTr`;var G$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`th`,{className:ZQ()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>w$(e,t));G$.displayName=`MarkdownTh`;var K$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`td`,{className:ZQ()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>w$(e,t));K$.displayName=`MarkdownTd`;var q$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`blockquote`,{className:ZQ()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>w$(e,t));q$.displayName=`MarkdownBlockquote`;var J$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sup`,{className:ZQ()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>w$(e,t));J$.displayName=`MarkdownSup`;var Y$=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sub`,{className:ZQ()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>w$(e,t));Y$.displayName=`MarkdownSub`;var X$=(0,z.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,z.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,z.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,z.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,z.isValidElement)(e))return e;if(e.type===k$){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,B.jsx)(`section`,{className:t,...r,children:i}):null}return(0,B.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>w$(e,t));X$.displayName=`MarkdownSection`;var Z$=(0,z.memo)(({node:e,className:t,children:n,...r})=>{let i=ZQ(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,z.useContext)(_1),l=g$(),u=Vpe(),d=(t?.match(pme))?.at(1)??``,f=rme(d);if(a)return(0,B.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(ume),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&dme.test(p))&&c!==!1,v=``;if((0,z.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(u$,{}),children:(0,B.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=T$(s,`mermaid`),n=O$(s,`download`),r=O$(s,`copy`),a=O$(s,`fullscreen`),c=O$(s,`panZoom`),l=e&&(n||r||a);return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(u$,{}),children:(0,B.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,B.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,B.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,B.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,B.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,B.jsx)(ame,{chart:v,config:o?.config}):null,r?(0,B.jsx)(c$,{code:v}):null,a?(0,B.jsx)(ome,{chart:v,config:o?.config}):null]})}):null,(0,B.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,B.jsx)(fme,{chart:v,config:o?.config,showControls:c})})]})})}let y=T$(s,`code`),b=D$(s,`download`),x=D$(s,`copy`);return(0,B.jsx)(Xpe,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,B.jsxs)(B.Fragment,{children:[b?(0,B.jsx)(Qpe,{code:v,language:d}):null,x?(0,B.jsx)(c$,{}):null]}):null})},(e,t)=>e.className===t.className&&C$(e.node,t.node));Z$.displayName=`MarkdownCode`;var Q$=(0,z.memo)(eme,(e,t)=>e.className===t.className&&C$(e.node,t.node));Q$.displayName=`MarkdownImg`;var $$=(0,z.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,z.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,B.jsx)(B.Fragment,{children:e})}return(0,B.jsx)(`p`,{...n,children:e})},(e,t)=>w$(e,t));$$.displayName=`MarkdownParagraph`;var mme={ol:k$,li:A$,ul:j$,hr:M$,strong:N$,a:P$,h1:F$,h2:I$,h3:L$,h4:R$,h5:z$,h6:B$,table:V$,thead:H$,tbody:U$,tr:W$,th:G$,td:K$,blockquote:q$,code:Z$,img:Q$,pre:({children:e})=>(0,z.isValidElement)(e)?(0,z.cloneElement)(e,{"data-block":`true`}):e,sup:J$,sub:Y$,p:$$,section:X$},hme=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,gme=/\p{L}/u;function e1(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(hme.test(e))return`rtl`;if(gme.test(e))return`ltr`}return`ltr`}var _me=/^[ \t]{0,3}(`{3,}|~{3,})/,vme=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,t1=e=>{let t=e.split(`
|
|
225
225
|
`),n=null,r=0;for(let e of t){let t=_me.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},yme=e=>{let t=e.split(`
|
|
226
226
|
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&vme.test(t))return!0}return!1},bme=()=>e=>{iL(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},n1=[],r1={allowDangerousHtml:!0},i1=new WeakMap,a1=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=i1.get(e);n||(n=e.name,i1.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=i1.get(r);e||(e=r.name,i1.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()}},o1=e=>{let t=xme(e),n=e.children||``;return Ome(t.runSync(t.parse(n),n),e)},xme=e=>{let t=a1.get(e);if(t)return t;let n=Cme(e);return a1.set(e,n),n},Sme=e=>e.some(e=>Array.isArray(e)?e[0]===kU:e===kU),Cme=e=>{let t=e.rehypePlugins||n1,n=e.remarkPlugins||n1,r=Sme(t)?n:[...n,bme],i=e.remarkRehypeOptions?{...r1,...e.remarkRehypeOptions}:r1;return zfe().use(VX).use(r).use(MZ,i).use(t)},wme=e=>e,Tme=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},Eme=(e,t)=>{for(let n in nX)if(Object.hasOwn(nX,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=nX[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},Dme=(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},Ome=(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||wme;iL(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return Tme(c,s,a,e.value),s;if(e.type===`element`&&(Eme(e,t),Dme(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 PY(e,{Fragment:B.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:B.jsx,jsxs:B.jsxs,passKeys:!0,passNode:!0})},kme=/\[\^[\w-]{1,200}\](?!:)/,Ame=/\[\^[\w-]{1,200}\]:/,jme=/<(\w+)[\s>]/,Mme=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),s1=new Map,c1=new Map,Nme=e=>{let t=e.toLowerCase(),n=s1.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return s1.set(t,r),r},Pme=e=>{let t=e.toLowerCase(),n=c1.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return c1.set(t,r),r},l1=(e,t)=>{if(Mme.has(t.toLowerCase()))return 0;let n=e.match(Nme(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},u1=(e,t)=>{let n=e.match(Pme(t));return n?n.length:0},Fme=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},Ime=e=>{let t=kme.test(e),n=Ame.test(e);if(t||n)return[e];let r=IQ.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=l1(t,e),o=u1(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(jme);if(e){let n=e[1];l1(t,n)>u1(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(Fme(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},Lme=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>{if(!n.includes(`
|
|
227
227
|
|
|
@@ -233,13 +233,13 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
233
233
|
`)?``:`
|
|
234
234
|
`)}${r}
|
|
235
235
|
|
|
236
|
-
`})}return n},Rme=/([\\`*_~[\]|])/g,zme=e=>e.replace(Rme,`\\$1`),Bme=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+zme(n).replace(/\n\n/g,` `)+r)}return n},d1=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(d1).join(``):``,Vme=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));iL(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=d1(e);e.children=t?[{type:`text`,value:t}]:[]}})},Hme=()=>e=>{iL(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},Ume=/^[ \t]*<[\w!/?-]/,Wme=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,Gme=e=>typeof e!=`string`||e.length===0||!Ume.test(e)?e:e.replace(Wme,`$1`),f1={...jU,protocols:{...jU.protocols,href:[...jU.protocols?.href??[],`tel`]},attributes:{...jU.attributes,code:[...jU.attributes?.code??[],`metastring`]}},p1={raw:kU,sanitize:[JU,f1],harden:[oL,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},Kme={gfm:[dY,{}],codeMeta:Hme},m1=Object.values(p1),qme=Object.values(Kme),Jme={block:` ▋`,circle:` ●`},h1=[`github-light`,`github-dark`],g1={enabled:!0},_1=(0,z.createContext)({shikiTheme:h1,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:g1}),v1=(0,z.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{if(o){let e=o.getLastRenderCharCount();o.setPrevContentLength(e)}let c=typeof e==`string`&&n?Gme(e):e,l=(0,B.jsx)(o1,{...s,children:c});return(0,B.jsx)(qQ.Provider,{value:i,children:a?(0,B.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});v1.displayName=`Block`;var y1=(0,z.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=m1,remarkPlugins:s=qme,className:c,shikiTheme:l=h1,mermaid:u,controls:d=!0,isAnimating:f=!1,animated:p,BlockComponent:m=v1,parseMarkdownIntoBlocksFn:h=Ime,caret:g,plugins:_,remend:v,linkSafety:y=g1,lineNumbers:b=!0,allowedTags:x,literalTagContent:S,translations:C,icons:w,prefix:T,onAnimationStart:E,onAnimationEnd:D,...O})=>{let k=(0,z.useId)(),[A,ee]=(0,z.useTransition)(),j=(0,z.useMemo)(()=>Upe(T),[T]),M=(0,z.useRef)(null),te=(0,z.useRef)(E),N=(0,z.useRef)(D);te.current=E,N.current=D,(0,z.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=M.current;if(M.current=f,i===null){f&&((e=te.current)==null||e.call(te));return}f&&!i?(n=te.current)==null||n.call(te):!f&&i&&((r=N.current)==null||r.call(N))},[f,t]);let P=(0,z.useMemo)(()=>x?Object.keys(x):[],[x]),ne=(0,z.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?LI(e,v):e;return S&&S.length>0&&(n=Bme(n,S)),P.length>0&&(n=Lme(n,P)),n},[e,t,r,v,P,S]),re=(0,z.useMemo)(()=>h(ne),[ne,h]),[ie,ae]=(0,z.useState)(re);(0,z.useEffect)(()=>{t===`streaming`&&!ue?ee(()=>{ae(re)}):ae(re)},[re,t]);let oe=t===`streaming`?ie:re,se=(0,z.useMemo)(()=>n===`auto`?oe.map(e1):void 0,[oe,n]),ce=(0,z.useMemo)(()=>oe.map((e,t)=>`${k}-${t}`),[oe.length,k]),le=(0,z.useMemo)(()=>p===!0?`true`:p?JSON.stringify(p):``,[p]),ue=(0,z.useMemo)(()=>le?le===`true`?KQ():KQ(p):null,[le]),de=(0,z.useMemo)(()=>({shikiTheme:(_?.code)?.getThemes()??l,controls:d,isAnimating:f,lineNumbers:b,mode:t,mermaid:u,linkSafety:y}),[l,d,f,b,t,u,y,_?.code]),fe=(0,z.useMemo)(()=>({...a$,...C}),[(0,z.useMemo)(()=>C?JSON.stringify(C):``,[C])]),pe=(0,z.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...mme,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,z.createElement)(t,n):null:(0,z.createElement)(e,n)}return n},[a]),me=(0,z.useMemo)(()=>{let e=[];return _!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsBefore]),e=[...e,...s],_!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsAfter]),_!=null&&_.math&&(e=[...e,_.math.remarkPlugin]),e},[s,_?.math,_?.cjk]),he=(0,z.useMemo)(()=>{let e=o;if(x&&Object.keys(x).length>0&&o===m1){let t={...f1,tagNames:[...f1.tagNames??[],...Object.keys(x)],attributes:{...f1.attributes,...x}};e=[p1.raw,[JU,t],p1.harden]}return S&&S.length>0&&(e=[...e,[Vme,S]]),_!=null&&_.math&&(e=[...e,_.math.rehypePlugin]),ue&&f&&(e=[...e,ue.rehypePlugin]),e},[o,_?.math,ue,f,x,S]),ge=(0,z.useMemo)(()=>{if(!f||oe.length===0)return!1;let e=oe.at(-1);return t1(e)||yme(e)},[f,oe]),_e=(0,z.useMemo)(()=>g&&f&&!ge?{"--streamdown-caret":`"${Jme[g]}"`}:void 0,[g,f,ge]);return t===`static`?(0,B.jsx)(o$.Provider,{value:fe,children:(0,B.jsx)(m$.Provider,{value:_??null,children:(0,B.jsx)(_1.Provider,{value:de,children:(0,B.jsx)(r$,{icons:w,children:(0,B.jsx)(XQ.Provider,{value:j,children:(0,B.jsx)(`div`,{className:j(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,c),dir:n===`auto`?e1(ne):n,children:(0,B.jsx)(o1,{components:pe,rehypePlugins:he,remarkPlugins:me,...O,children:ne})})})})})})}):(0,B.jsx)(o$.Provider,{value:fe,children:(0,B.jsx)(m$.Provider,{value:_??null,children:(0,B.jsx)(_1.Provider,{value:de,children:(0,B.jsx)(r$,{icons:w,children:(0,B.jsx)(XQ.Provider,{value:j,children:(0,B.jsxs)(`div`,{className:j(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,g&&!ge?`[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]`:null,c),style:_e,children:[oe.length===0&&g&&f&&(0,B.jsx)(`span`,{}),oe.map((e,t)=>{let a=t===oe.length-1,o=f&&a&&t1(e);return(0,B.jsx)(m,{animatePlugin:ue,components:pe,content:e,dir:se?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:he,remarkPlugins:me,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...O},ce[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);y1.displayName=`Streamdown`;var Yme=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:a=!0,initialZoom:o=1,fullscreen:s=!1})=>{let{RotateCcwIcon:c,ZoomInIcon:l,ZoomOutIcon:u}=i$(),d=ZQ(),f=(0,z.useRef)(null),p=(0,z.useRef)(null),[m,h]=(0,z.useState)(o),[g,_]=(0,z.useState)({x:0,y:0}),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)({x:0,y:0}),[S,C]=(0,z.useState)({x:0,y:0}),w=(0,z.useCallback)(e=>{h(t=>Math.max(n,Math.min(r,t+e)))},[n,r]),T=(0,z.useCallback)(()=>{w(i)},[w,i]),E=(0,z.useCallback)(()=>{w(-i)},[w,i]),D=(0,z.useCallback)(()=>{h(o),_({x:0,y:0})},[o]),O=(0,z.useCallback)(e=>{e.preventDefault(),w(e.deltaY>0?-i:i)},[w,i]),k=(0,z.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;y(!0),x({x:e.clientX,y:e.clientY}),C(g);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[g]),A=(0,z.useCallback)(e=>{if(!v)return;e.preventDefault();let t=e.clientX-b.x,n=e.clientY-b.y;_({x:S.x+t,y:S.y+n})},[v,b,S]),ee=(0,z.useCallback)(e=>{y(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);return(0,z.useEffect)(()=>{let e=f.current;if(e)return e.addEventListener(`wheel`,O,{passive:!1}),()=>{e.removeEventListener(`wheel`,O)}},[O]),(0,z.useEffect)(()=>{let e=p.current;if(e&&v)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,A,{passive:!1}),e.addEventListener(`pointerup`,ee),e.addEventListener(`pointercancel`,ee),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,A),e.removeEventListener(`pointerup`,ee),e.removeEventListener(`pointercancel`,ee)}},[v,A,ee]),(0,B.jsxs)(`div`,{className:d(`relative flex flex-col`,s?`h-full w-full`:`min-h-28 w-full`,t),ref:f,style:{cursor:v?`grabbing`:`grab`},children:[a?(0,B.jsxs)(`div`,{className:d(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,s?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m>=r,onClick:T,title:`Zoom in`,type:`button`,children:(0,B.jsx)(l,{size:16})}),(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m<=n,onClick:E,title:`Zoom out`,type:`button`,children:(0,B.jsx)(u,{size:16})}),(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:D,title:`Reset zoom and pan`,type:`button`,children:(0,B.jsx)(c,{size:16})})]}):null,(0,B.jsx)(`div`,{className:d(`flex-1 origin-center transition-transform duration-150 ease-out`,s?`flex h-full w-full items-center justify-center`:`flex w-full items-center justify-center`),onPointerDown:k,ref:p,role:`application`,style:{transform:`translate(${g.x}px, ${g.y}px) scale(${m})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},b1=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=ZQ(),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(``),[m,h]=(0,z.useState)(0),{mermaid:g}=(0,z.useContext)(_1),_=g$(),v=g?.errorComponent,{shouldRender:y,containerRef:b}=jpe({immediate:r});if((0,z.useEffect)(()=>{if(y){if(!_){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}(async()=>{try{s(null),l(!0);let t=_.getMermaid(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),i=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:a}=await t.render(i,e);d(a),p(a)}catch(e){f||u||s(e instanceof Error?e.message:`Failed to render Mermaid chart`)}finally{l(!1)}})()}},[e,n,m,y,_]),!(y||u||f))return(0,B.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:b});if(c&&!u&&!f)return(0,B.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:b,children:(0,B.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,B.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,B.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!f)return v?(0,B.jsx)(`div`,{ref:b,children:(0,B.jsx)(v,{chart:e,error:o,retry:()=>h(e=>e+1)})}):(0,B.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:b,children:[(0,B.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,B.jsxs)(`details`,{className:a(`mt-2`),children:[(0,B.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,B.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let x=u||f;return(0,B.jsx)(`div`,{className:a(`size-full`,t),"data-streamdown":`mermaid`,ref:b,children:(0,B.jsx)(Yme,{className:a(r?`size-full overflow-hidden`:`overflow-hidden`,t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,B.jsx)(`div`,{"aria-label":`Mermaid chart`,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:x},role:`img`})})})};function Xme(e){return[kU,[JU,{}],[oL,{allowedImagePrefixes:e.allowedImagePrefixes??[`*`],allowedLinkPrefixes:e.allowedLinkPrefixes??[`*`],allowedProtocols:e.allowedProtocols??[`*`],allowDataImages:e.allowDataImages??!0,defaultOrigin:e.defaultOrigin,blockedLinkClass:e.blockedLinkClass,blockedImageClass:e.blockedImageClass}]]}var x1=(0,z.forwardRef)(({components:e,componentsByLanguage:t,preprocess:n,defer:r=!1,smooth:i=!1,plugins:a,containerProps:o,containerClassName:s,caret:c,controls:l,linkSafety:u,remend:d,mermaid:f,parseIncompleteMarkdown:p,allowedTags:m,remarkRehypeOptions:h,security:g,BlockComponent:_,parseMarkdownIntoBlocksFn:v,mode:y=`streaming`,className:b,shikiTheme:x,...S},C)=>{let w=RP(),{text:T,status:E}=UP((0,z.useMemo)(()=>n?{...w,text:n(w.text)}:w,[w,n]),i),D=(0,z.useDeferredValue)(T),O=r?D:T,k=y===`streaming`&&p!==!1&&!v,A=(0,z.useMemo)(()=>k?Sfe(O,d):O,[k,O,d]),ee=k?!1:p,j=(0,z.useMemo)(()=>{let e=ede(a,{});return Object.keys(e).length>0?e:void 0},[a]),M=(0,z.useMemo)(()=>x??(j?.code?Que:void 0),[x,j?.code]),te=GI({components:e,componentsByLanguage:t}),N=(0,z.useMemo)(()=>{let{SyntaxHighlighter:t,CodeHeader:n,...r}=e??{};return{...r,...te}},[e,te]),P=(0,z.useMemo)(()=>[s,o?.className].filter(Boolean).join(` `)||void 0,[s,o?.className]),ne=(0,z.useMemo)(()=>g?Xme(g):void 0,[g]),re={...b&&{className:b},...c&&{caret:c},...l!==void 0&&{controls:l},...u&&{linkSafety:u},...d&&{remend:d},...f&&{mermaid:f},...ee!==void 0&&{parseIncompleteMarkdown:ee},...m&&{allowedTags:m},...j&&{plugins:j},...M&&{shikiTheme:M},...h&&{remarkRehypeOptions:h},...ne&&{rehypePlugins:ne},..._&&{BlockComponent:_},...v&&{parseMarkdownIntoBlocksFn:v}};return(0,B.jsx)(`div`,{ref:C,"data-status":E.type,...o,className:P,children:(0,B.jsx)(y1,{mode:y,isAnimating:E.type===`running`,components:N,...re,...S,children:A})})});x1.displayName=`StreamdownTextPrimitive`;function Zme(e){return typeof e==`string`&&/^(https?:|mailto:)/i.test(e.trim())}function S1({href:e,children:t,node:n,...r}){return Zme(e)?(0,B.jsx)(`a`,{...r,href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}):(0,B.jsx)(`span`,{...r,children:t})}var Qme={a:S1},$me={a:S1};function C1({text:e}){return(0,B.jsx)(y1,{className:`oc-md`,components:$me,children:e})}var ehe=(0,z.memo)(function(){return(0,B.jsx)(x1,{className:`oc-md`,smooth:!U(e=>e.metadata?.custom?.hasMergedRuns===!0),components:Qme})}),the=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(`.`)),nhe=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`avif`,`bmp`]),rhe=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`]),ihe=new Set([`pptx`,`ppt`,`docx`,`doc`,`xlsx`,`xls`,`odt`,`odp`,`ods`,`rtf`]);function w1(e,t){let n=(e??``).toLowerCase();if(rhe.has(n))return!0;let r=T1(t);return r!==null&&ihe.has(r)}function T1(e){if(!e)return null;let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?null:e.slice(t+1).toLowerCase()}function E1(e,t){let n=(e??``).split(`;`)[0].trim().toLowerCase(),r=T1(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&&nhe.has(r)?`image`:r!==null&&the.has(r)?`text`:`none`}var ahe=[`fit`,.5,.75,1,1.5,2];function D1(e,t){return Number.isFinite(e)?Math.min(Math.max(1,Math.floor(e)),Math.max(1,Math.floor(t))):1}var O1=512*1024,ohe=1e3,she=5e3;function che(e,t){if((e??``).split(`;`)[0].trim().toLowerCase()===`text/tab-separated-values`||T1(t)===`tsv`)return` `}function lhe(e){let t=`,`,n=0;for(let r of[`,`,`;`,` `]){let i=k1(e,r).length;i>n&&(t=r,n=i)}return t}function k1(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 uhe(e,t=ohe,n){let r=[],i=``,a=!1,o=e.replace(/\r\n/g,`
|
|
236
|
+
`})}return n},Rme=/([\\`*_~[\]|])/g,zme=e=>e.replace(Rme,`\\$1`),Bme=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+zme(n).replace(/\n\n/g,` `)+r)}return n},d1=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(d1).join(``):``,Vme=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));iL(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=d1(e);e.children=t?[{type:`text`,value:t}]:[]}})},Hme=()=>e=>{iL(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},Ume=/^[ \t]*<[\w!/?-]/,Wme=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,Gme=e=>typeof e!=`string`||e.length===0||!Ume.test(e)?e:e.replace(Wme,`$1`),f1={...jU,protocols:{...jU.protocols,href:[...jU.protocols?.href??[],`tel`]},attributes:{...jU.attributes,code:[...jU.attributes?.code??[],`metastring`]}},p1={raw:kU,sanitize:[JU,f1],harden:[oL,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},Kme={gfm:[dY,{}],codeMeta:Hme},m1=Object.values(p1),qme=Object.values(Kme),Jme={block:` ▋`,circle:` ●`},h1=[`github-light`,`github-dark`],g1={enabled:!0},_1=(0,z.createContext)({shikiTheme:h1,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:g1}),v1=(0,z.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{if(o){let e=o.getLastRenderCharCount();o.setPrevContentLength(e)}let c=typeof e==`string`&&n?Gme(e):e,l=(0,B.jsx)(o1,{...s,children:c});return(0,B.jsx)(qQ.Provider,{value:i,children:a?(0,B.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});v1.displayName=`Block`;var y1=(0,z.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=m1,remarkPlugins:s=qme,className:c,shikiTheme:l=h1,mermaid:u,controls:d=!0,isAnimating:f=!1,animated:p,BlockComponent:m=v1,parseMarkdownIntoBlocksFn:h=Ime,caret:g,plugins:_,remend:v,linkSafety:y=g1,lineNumbers:b=!0,allowedTags:x,literalTagContent:S,translations:C,icons:w,prefix:T,onAnimationStart:E,onAnimationEnd:D,...O})=>{let k=(0,z.useId)(),[A,ee]=(0,z.useTransition)(),j=(0,z.useMemo)(()=>Upe(T),[T]),M=(0,z.useRef)(null),te=(0,z.useRef)(E),N=(0,z.useRef)(D);te.current=E,N.current=D,(0,z.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=M.current;if(M.current=f,i===null){f&&((e=te.current)==null||e.call(te));return}f&&!i?(n=te.current)==null||n.call(te):!f&&i&&((r=N.current)==null||r.call(N))},[f,t]);let P=(0,z.useMemo)(()=>x?Object.keys(x):[],[x]),ne=(0,z.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?RI(e,v):e;return S&&S.length>0&&(n=Bme(n,S)),P.length>0&&(n=Lme(n,P)),n},[e,t,r,v,P,S]),re=(0,z.useMemo)(()=>h(ne),[ne,h]),[ie,ae]=(0,z.useState)(re);(0,z.useEffect)(()=>{t===`streaming`&&!ue?ee(()=>{ae(re)}):ae(re)},[re,t]);let oe=t===`streaming`?ie:re,se=(0,z.useMemo)(()=>n===`auto`?oe.map(e1):void 0,[oe,n]),ce=(0,z.useMemo)(()=>oe.map((e,t)=>`${k}-${t}`),[oe.length,k]),le=(0,z.useMemo)(()=>p===!0?`true`:p?JSON.stringify(p):``,[p]),ue=(0,z.useMemo)(()=>le?le===`true`?KQ():KQ(p):null,[le]),de=(0,z.useMemo)(()=>({shikiTheme:(_?.code)?.getThemes()??l,controls:d,isAnimating:f,lineNumbers:b,mode:t,mermaid:u,linkSafety:y}),[l,d,f,b,t,u,y,_?.code]),fe=(0,z.useMemo)(()=>({...a$,...C}),[(0,z.useMemo)(()=>C?JSON.stringify(C):``,[C])]),pe=(0,z.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...mme,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,z.createElement)(t,n):null:(0,z.createElement)(e,n)}return n},[a]),me=(0,z.useMemo)(()=>{let e=[];return _!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsBefore]),e=[...e,...s],_!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsAfter]),_!=null&&_.math&&(e=[...e,_.math.remarkPlugin]),e},[s,_?.math,_?.cjk]),he=(0,z.useMemo)(()=>{let e=o;if(x&&Object.keys(x).length>0&&o===m1){let t={...f1,tagNames:[...f1.tagNames??[],...Object.keys(x)],attributes:{...f1.attributes,...x}};e=[p1.raw,[JU,t],p1.harden]}return S&&S.length>0&&(e=[...e,[Vme,S]]),_!=null&&_.math&&(e=[...e,_.math.rehypePlugin]),ue&&f&&(e=[...e,ue.rehypePlugin]),e},[o,_?.math,ue,f,x,S]),ge=(0,z.useMemo)(()=>{if(!f||oe.length===0)return!1;let e=oe.at(-1);return t1(e)||yme(e)},[f,oe]),_e=(0,z.useMemo)(()=>g&&f&&!ge?{"--streamdown-caret":`"${Jme[g]}"`}:void 0,[g,f,ge]);return t===`static`?(0,B.jsx)(o$.Provider,{value:fe,children:(0,B.jsx)(m$.Provider,{value:_??null,children:(0,B.jsx)(_1.Provider,{value:de,children:(0,B.jsx)(r$,{icons:w,children:(0,B.jsx)(XQ.Provider,{value:j,children:(0,B.jsx)(`div`,{className:j(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,c),dir:n===`auto`?e1(ne):n,children:(0,B.jsx)(o1,{components:pe,rehypePlugins:he,remarkPlugins:me,...O,children:ne})})})})})})}):(0,B.jsx)(o$.Provider,{value:fe,children:(0,B.jsx)(m$.Provider,{value:_??null,children:(0,B.jsx)(_1.Provider,{value:de,children:(0,B.jsx)(r$,{icons:w,children:(0,B.jsx)(XQ.Provider,{value:j,children:(0,B.jsxs)(`div`,{className:j(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,g&&!ge?`[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]`:null,c),style:_e,children:[oe.length===0&&g&&f&&(0,B.jsx)(`span`,{}),oe.map((e,t)=>{let a=t===oe.length-1,o=f&&a&&t1(e);return(0,B.jsx)(m,{animatePlugin:ue,components:pe,content:e,dir:se?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:he,remarkPlugins:me,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...O},ce[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);y1.displayName=`Streamdown`;var Yme=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:a=!0,initialZoom:o=1,fullscreen:s=!1})=>{let{RotateCcwIcon:c,ZoomInIcon:l,ZoomOutIcon:u}=i$(),d=ZQ(),f=(0,z.useRef)(null),p=(0,z.useRef)(null),[m,h]=(0,z.useState)(o),[g,_]=(0,z.useState)({x:0,y:0}),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)({x:0,y:0}),[S,C]=(0,z.useState)({x:0,y:0}),w=(0,z.useCallback)(e=>{h(t=>Math.max(n,Math.min(r,t+e)))},[n,r]),T=(0,z.useCallback)(()=>{w(i)},[w,i]),E=(0,z.useCallback)(()=>{w(-i)},[w,i]),D=(0,z.useCallback)(()=>{h(o),_({x:0,y:0})},[o]),O=(0,z.useCallback)(e=>{e.preventDefault(),w(e.deltaY>0?-i:i)},[w,i]),k=(0,z.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;y(!0),x({x:e.clientX,y:e.clientY}),C(g);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[g]),A=(0,z.useCallback)(e=>{if(!v)return;e.preventDefault();let t=e.clientX-b.x,n=e.clientY-b.y;_({x:S.x+t,y:S.y+n})},[v,b,S]),ee=(0,z.useCallback)(e=>{y(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);return(0,z.useEffect)(()=>{let e=f.current;if(e)return e.addEventListener(`wheel`,O,{passive:!1}),()=>{e.removeEventListener(`wheel`,O)}},[O]),(0,z.useEffect)(()=>{let e=p.current;if(e&&v)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,A,{passive:!1}),e.addEventListener(`pointerup`,ee),e.addEventListener(`pointercancel`,ee),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,A),e.removeEventListener(`pointerup`,ee),e.removeEventListener(`pointercancel`,ee)}},[v,A,ee]),(0,B.jsxs)(`div`,{className:d(`relative flex flex-col`,s?`h-full w-full`:`min-h-28 w-full`,t),ref:f,style:{cursor:v?`grabbing`:`grab`},children:[a?(0,B.jsxs)(`div`,{className:d(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,s?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m>=r,onClick:T,title:`Zoom in`,type:`button`,children:(0,B.jsx)(l,{size:16})}),(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m<=n,onClick:E,title:`Zoom out`,type:`button`,children:(0,B.jsx)(u,{size:16})}),(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:D,title:`Reset zoom and pan`,type:`button`,children:(0,B.jsx)(c,{size:16})})]}):null,(0,B.jsx)(`div`,{className:d(`flex-1 origin-center transition-transform duration-150 ease-out`,s?`flex h-full w-full items-center justify-center`:`flex w-full items-center justify-center`),onPointerDown:k,ref:p,role:`application`,style:{transform:`translate(${g.x}px, ${g.y}px) scale(${m})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},b1=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=ZQ(),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(``),[m,h]=(0,z.useState)(0),{mermaid:g}=(0,z.useContext)(_1),_=g$(),v=g?.errorComponent,{shouldRender:y,containerRef:b}=jpe({immediate:r});if((0,z.useEffect)(()=>{if(y){if(!_){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}(async()=>{try{s(null),l(!0);let t=_.getMermaid(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),i=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:a}=await t.render(i,e);d(a),p(a)}catch(e){f||u||s(e instanceof Error?e.message:`Failed to render Mermaid chart`)}finally{l(!1)}})()}},[e,n,m,y,_]),!(y||u||f))return(0,B.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:b});if(c&&!u&&!f)return(0,B.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:b,children:(0,B.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,B.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,B.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!f)return v?(0,B.jsx)(`div`,{ref:b,children:(0,B.jsx)(v,{chart:e,error:o,retry:()=>h(e=>e+1)})}):(0,B.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:b,children:[(0,B.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,B.jsxs)(`details`,{className:a(`mt-2`),children:[(0,B.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,B.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let x=u||f;return(0,B.jsx)(`div`,{className:a(`size-full`,t),"data-streamdown":`mermaid`,ref:b,children:(0,B.jsx)(Yme,{className:a(r?`size-full overflow-hidden`:`overflow-hidden`,t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,B.jsx)(`div`,{"aria-label":`Mermaid chart`,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:x},role:`img`})})})};function Xme(e){return[kU,[JU,{}],[oL,{allowedImagePrefixes:e.allowedImagePrefixes??[`*`],allowedLinkPrefixes:e.allowedLinkPrefixes??[`*`],allowedProtocols:e.allowedProtocols??[`*`],allowDataImages:e.allowDataImages??!0,defaultOrigin:e.defaultOrigin,blockedLinkClass:e.blockedLinkClass,blockedImageClass:e.blockedImageClass}]]}var x1=(0,z.forwardRef)(({components:e,componentsByLanguage:t,preprocess:n,defer:r=!1,smooth:i=!1,plugins:a,containerProps:o,containerClassName:s,caret:c,controls:l,linkSafety:u,remend:d,mermaid:f,parseIncompleteMarkdown:p,allowedTags:m,remarkRehypeOptions:h,security:g,BlockComponent:_,parseMarkdownIntoBlocksFn:v,mode:y=`streaming`,className:b,shikiTheme:x,...S},C)=>{let w=zP(),{text:T,status:E}=WP((0,z.useMemo)(()=>n?{...w,text:n(w.text)}:w,[w,n]),i),D=(0,z.useDeferredValue)(T),O=r?D:T,k=y===`streaming`&&p!==!1&&!v,A=(0,z.useMemo)(()=>k?xfe(O,d):O,[k,O,d]),ee=k?!1:p,j=(0,z.useMemo)(()=>{let e=$ue(a,{});return Object.keys(e).length>0?e:void 0},[a]),M=(0,z.useMemo)(()=>x??(j?.code?Zue:void 0),[x,j?.code]),te=GI({components:e,componentsByLanguage:t}),N=(0,z.useMemo)(()=>{let{SyntaxHighlighter:t,CodeHeader:n,...r}=e??{};return{...r,...te}},[e,te]),P=(0,z.useMemo)(()=>[s,o?.className].filter(Boolean).join(` `)||void 0,[s,o?.className]),ne=(0,z.useMemo)(()=>g?Xme(g):void 0,[g]),re={...b&&{className:b},...c&&{caret:c},...l!==void 0&&{controls:l},...u&&{linkSafety:u},...d&&{remend:d},...f&&{mermaid:f},...ee!==void 0&&{parseIncompleteMarkdown:ee},...m&&{allowedTags:m},...j&&{plugins:j},...M&&{shikiTheme:M},...h&&{remarkRehypeOptions:h},...ne&&{rehypePlugins:ne},..._&&{BlockComponent:_},...v&&{parseMarkdownIntoBlocksFn:v}};return(0,B.jsx)(`div`,{ref:C,"data-status":E.type,...o,className:P,children:(0,B.jsx)(y1,{mode:y,isAnimating:E.type===`running`,components:N,...re,...S,children:A})})});x1.displayName=`StreamdownTextPrimitive`;function Zme(e){return typeof e==`string`&&/^(https?:|mailto:)/i.test(e.trim())}function S1({href:e,children:t,node:n,...r}){return Zme(e)?(0,B.jsx)(`a`,{...r,href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}):(0,B.jsx)(`span`,{...r,children:t})}var Qme={a:S1},$me={a:S1};function C1({text:e}){return(0,B.jsx)(y1,{className:`oc-md`,components:$me,children:e})}var ehe=(0,z.memo)(function(){return(0,B.jsx)(x1,{className:`oc-md`,smooth:!U(e=>e.metadata?.custom?.hasMergedRuns===!0),components:Qme})}),the=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(`.`)),nhe=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`avif`,`bmp`]),rhe=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`]),ihe=new Set([`pptx`,`ppt`,`docx`,`doc`,`xlsx`,`xls`,`odt`,`odp`,`ods`,`rtf`]);function w1(e,t){let n=(e??``).toLowerCase();if(rhe.has(n))return!0;let r=T1(t);return r!==null&&ihe.has(r)}function T1(e){if(!e)return null;let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?null:e.slice(t+1).toLowerCase()}function E1(e,t){let n=(e??``).split(`;`)[0].trim().toLowerCase(),r=T1(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&&nhe.has(r)?`image`:r!==null&&the.has(r)?`text`:`none`}var ahe=[`fit`,.5,.75,1,1.5,2];function D1(e,t){return Number.isFinite(e)?Math.min(Math.max(1,Math.floor(e)),Math.max(1,Math.floor(t))):1}var O1=512*1024,ohe=1e3,she=5e3;function che(e,t){if((e??``).split(`;`)[0].trim().toLowerCase()===`text/tab-separated-values`||T1(t)===`tsv`)return` `}function lhe(e){let t=`,`,n=0;for(let r of[`,`,`;`,` `]){let i=k1(e,r).length;i>n&&(t=r,n=i)}return t}function k1(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 uhe(e,t=ohe,n){let r=[],i=``,a=!1,o=e.replace(/\r\n/g,`
|
|
237
237
|
`).replace(/\r/g,`
|
|
238
238
|
`);for(let e of o)e===`"`&&(a=!a),e===`
|
|
239
|
-
`&&!a?(r.push(i),i=``):i+=e;i!==``&&r.push(i);let s=r.findIndex(e=>e.trim()!==``);if(s===-1)return{header:[],rows:[],totalRows:0,truncatedRows:!1,delimiter:`,`};let c=n??lhe(r[s]),l=k1(r[s],c),u=r.slice(s+1);return{header:l,rows:u.slice(0,t).map(e=>k1(e,c)),totalRows:u.length,truncatedRows:u.length>t,delimiter:c}}function dhe(e,t){let n=e.trim(),r=t.trim();if(/^-?\d+$/.test(n)&&/^-?\d+$/.test(r)){let e=BigInt(n),t=BigInt(r);return e<t?-1:+(e>t)}let i=Number(e),a=Number(t);return n!==``&&r!==``&&!Number.isNaN(i)&&!Number.isNaN(a)?i-a:e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function fhe(e){return/\b(error|err|fatal|critical|panic)\b/i.test(e)?`error`:/\b(warn|warning)\b/i.test(e)?`warn`:/\b(info|notice)\b/i.test(e)?`info`:/\b(debug|trace|verbose)\b/i.test(e)?`debug`:`plain`}var A1=60;function j1({url:e,filename:t}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(1),[c,l]=(0,z.useState)(`fit`);if((0,z.useEffect)(()=>{let t=!1,n=null;return r(null),a(!1),s(1),(async()=>{try{let i=await WQ(()=>import(`./pdf-DWeO12dm.js`),[]);i.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CHFwMXne.mjs`,``+import.meta.url).toString();let a=i.getDocument({url:e}),o=await a.promise;if(t){a.destroy().catch(()=>{});return}n=a,r(o)}catch(e){console.error(`[docviewer] pdf load failed:`,e?.message??e),t||a(!0)}})(),()=>{t=!0,n&&n.destroy().catch(()=>{})}},[e]),i)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Lo()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:jp()})]});if(n===null)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:bs()});let u=n.numPages,d=D1(o,u);return(0,B.jsxs)(`div`,{className:`oc-docviewer__pdf`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__toolbar`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>D1(e-1,u)),disabled:d<=1,"aria-label":Pr(),children:(0,B.jsx)(jy,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-docviewer__pageinfo`,children:[d,` / `,u]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>D1(e+1,u)),disabled:d>=u,"aria-label":An(),children:(0,B.jsx)(My,{size:15})}),(0,B.jsx)(`select`,{className:`oc-docviewer__zoom`,value:String(c),onChange:e=>{let t=e.target.value;l(t===`fit`?`fit`:Number(t))},"aria-label":Gt(),children:ahe.map(e=>(0,B.jsx)(`option`,{value:String(e),children:e===`fit`?gr():`${Math.round(e*100)}%`},String(e)))})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__pdfbody`,children:[u>1?(0,B.jsxs)(`div`,{className:`oc-docviewer__rail`,"aria-label":Fa(),children:[Array.from({length:Math.min(u,A1)},(e,t)=>(0,B.jsx)(mhe,{doc:n,page:t+1,active:t+1===d,onClick:()=>s(t+1)},t+1)),u>A1?(0,B.jsxs)(`span`,{className:`oc-docviewer__railmore`,children:[`+`,u-A1]}):null]}):null,(0,B.jsx)(phe,{doc:n,page:d,zoom:c,filename:t})]})]})}function phe({doc:e,page:t,zoom:n,filename:r}){let i=(0,z.useRef)(null),a=(0,z.useRef)(null),[o,s]=(0,z.useState)(0);return(0,z.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;s(e=>Math.abs(e-t)>1?t:e)});return t.observe(e),()=>t.disconnect()},[]),(0,z.useEffect)(()=>{let r=!1,i=null;return(async()=>{try{let s=await e.getPage(t),c=a.current;if(r||!c)return;let l=s.getViewport({scale:1}),u=n===`fit`?Math.max(.1,(o-16)/l.width):n,d=window.devicePixelRatio||1,f=s.getViewport({scale:u*d});c.width=Math.floor(f.width),c.height=Math.floor(f.height),c.style.width=`${Math.floor(f.width/d)}px`,c.style.height=`${Math.floor(f.height/d)}px`;let p=s.render({canvas:c,viewport:f});i=p,await p.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] page render failed:`,e?.message??e)}})(),()=>{r=!0,i?.cancel()}},[e,t,n,o]),(0,B.jsx)(`div`,{ref:i,className:`oc-docviewer__main`,children:(0,B.jsx)(`canvas`,{ref:a,className:`oc-docviewer__canvas`,"aria-label":r})})}function mhe({doc:e,page:t,active:n,onClick:r}){let i=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let n=!1,r=null;return(async()=>{try{let a=await e.getPage(t),o=i.current;if(n||!o)return;let s=104/a.getViewport({scale:1}).width,c=a.getViewport({scale:s});o.width=Math.floor(c.width),o.height=Math.floor(c.height);let l=a.render({canvas:o,viewport:c});r=l,await l.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] thumbnail render failed:`,e?.message??e)}})(),()=>{n=!0,r?.cancel()}},[e,t]),(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__thumb${n?` is-active`:``}`,onClick:r,"aria-label":wt({page:t}),"aria-current":n?`true`:void 0,children:[(0,B.jsx)(`canvas`,{ref:i,className:`oc-docviewer__thumbcanvas`}),(0,B.jsx)(`span`,{className:`oc-docviewer__thumbnum`,children:t})]})}var M1={current:null},N1=(0,z.createContext)(M1);function hhe(e){let t=0,n=e.match(/`+/g);if(n!==null)for(let e of n)t=Math.max(t,e.length);return"`".repeat(Math.max(3,t+1))}function ghe(e,t,n){let r=hhe(t);return`\n${e} ${n}\n${r}\n${t}\n${r}\n`}function _he(e,t){let n=e.length,r=1;for(let t=0;t<e.length;t++)e.charCodeAt(t)===10&&r++;return n<=8e3&&r<=150?{kind:`inline`,lines:r,chars:n}:{kind:`file`,filename:`texte-colle-${t}.txt`,lines:r,chars:n}}var P1=new WeakSet;function F1(e){P1.add(e)}function I1(e){return P1.has(e)}var L1=(0,z.createContext)({activeDoc:null,openFor:()=>{},openNewerVersion:()=>{},close:()=>{}});function R1(){return(0,z.useContext)(L1)}function z1({doc:e,chatId:t,onClose:n}){let r=E1(e.mimeType,e.filename),i=r===`none`&&e.sourceStorageId!==void 0,a=R1(),o=I(L.documentDrafts.latestDeliveredFile,t===null?`skip`:{chatId:t,filename:e.filename,...e.storageId===void 0?{}:{currentStorageId:e.storageId}}),s=o!=null&&(e.storageId===void 0?o.url!==e.url:o.storageId!==e.storageId)?o:null;return(0,B.jsxs)(`div`,{className:`oc-docviewer`,children:[(0,B.jsxs)(`header`,{className:`oc-docviewer__header`,children:[(0,B.jsx)(Zy,{size:15,"aria-hidden":!0,className:`oc-docviewer__icon`}),(0,B.jsx)(`span`,{className:`oc-docviewer__name`,title:e.filename,children:e.filename}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,title:jp(),"aria-label":jp(),children:(0,B.jsx)(Jy,{size:14})}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,download:e.filename,title:Ol(),"aria-label":Ol(),children:(0,B.jsx)(Gy,{size:14})}),(0,B.jsx)(Ih,{type:`button`,size:`icon-sm`,variant:`ghost`,onClick:n,"aria-label":ef(),children:(0,B.jsx)(xh,{size:15})})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__body`,children:[s===null?null:(0,B.jsxs)(`div`,{className:`oc-docviewer__newversion`,role:`status`,children:[(0,B.jsx)(`span`,{children:ut()}),(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>a.openNewerVersion({url:s.url,filename:e.filename,mimeType:s.mimeType||null,storageId:s.storageId,sourceStorageId:w1(s.mimeType,e.filename)?s.storageId:void 0}),children:Co()})]}),r===`pdf`?(0,B.jsx)(j1,{url:e.url,filename:e.filename}):r===`image`?(0,B.jsx)(`div`,{className:`oc-docviewer__imagewrap`,children:(0,B.jsx)(`img`,{src:e.url,alt:e.filename,className:`oc-docviewer__image`})}):r===`video`?(0,B.jsx)(`video`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__video`}):r===`audio`?(0,B.jsx)(`div`,{className:`oc-docviewer__audiowrap`,children:(0,B.jsx)(`audio`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__audio`})}):r===`text`?(0,B.jsx)(V1,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null},e.url):r===`markdown`||r===`csv`||r===`log`||r===`json`?(0,B.jsx)(V1,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null,rich:r,csvDelimiter:r===`csv`?che(e.mimeType,e.filename):void 0},e.url):i?(0,B.jsx)(vhe,{sourceStorageId:e.sourceStorageId,downloadUrl:e.url,filename:e.filename}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:dn()}),(0,B.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:Ol()})]})]})]})}function vhe({sourceStorageId:e,downloadUrl:t,filename:n}){let r=I(L.fileRenditions.getRendition,{sourceStorageId:e}),i=Nt(L.fileRenditions.requestRendition),a=(0,z.useRef)(null);return(0,z.useEffect)(()=>{a.current=null},[e]),(0,z.useEffect)(()=>{r?.status===`pending`&&a.current!==e&&(a.current=e,i({sourceStorageId:e}).catch(e=>{console.error(`[docviewer] rendition request failed:`,e)}))},[r?.status,e,i]),r===void 0?(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:bs()}):r.status===`ready`?(0,B.jsx)(j1,{url:r.pdfUrl,filename:r.filename}):r.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-docviewer__preparing`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__spinner`,"aria-hidden":!0}),(0,B.jsx)(`p`,{children:es()}),(0,B.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:Ol()})]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:r.status===`unconfigured`?dn():he()}),(0,B.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:Ol()})]})}function yhe(e){switch(e){case`markdown`:return Xc();case`csv`:return od();case`log`:return Kp();case`json`:return Mf()}}var B1=e=>`oc.docviewer.raw.${e}`;function V1({url:e,chatId:t,filename:n,mimeType:r,storageId:i,rich:a,csvDelimiter:o}){let[s,c]=(0,z.useState)({phase:`loading`}),[l,u]=(0,z.useState)(()=>a?localStorage.getItem(B1(a))===`1`:!1),d=e=>{u(e),a&&localStorage.setItem(B1(a),e?`1`:`0`)},[f,p]=(0,z.useState)(!1),m=I(L.documentDrafts.getDraft,t===null?`skip`:{chatId:t,filename:n}),h=t!==null&&s.phase===`ready`&&!s.truncated&&m!==void 0;if((0,z.useEffect)(()=>{let t=!1;return c({phase:`loading`}),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.blob(),i=r.size>O1,a=await(i?r.slice(0,O1):r).text();t||c({phase:`ready`,text:a,truncated:i})}catch(e){console.error(`[docviewer] text fetch failed:`,e?.message??e),t||c({phase:`error`})}})(),()=>{t=!0}},[e]),s.phase===`loading`)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:bs()});if(s.phase===`error`)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Lo()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:jp()})]});let g=a!==void 0&&!l,_=s.truncated?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:qee()}):null,v=m?.text??s.text,y=m==null?null:(0,B.jsx)(bhe,{chatId:t,filename:n,diverged:m.sourceStorageId!==null&&i!==null&&m.sourceStorageId!==i}),b=f?(0,B.jsx)(xhe,{chatId:t,filename:n,mimeType:r,sourceStorageId:i,initialText:v,hasDraft:m!=null,onExit:()=>p(!1)}):g&&a===`markdown`?(0,B.jsx)(`div`,{className:`oc-docviewer__mdwrap`,children:(0,B.jsx)(C1,{text:v})}):g&&a===`csv`?(0,B.jsx)(She,{text:v,textTruncated:s.truncated,delimiter:o}):g&&a===`log`?(0,B.jsx)(Che,{text:v,textTruncated:s.truncated}):g&&a===`json`?(0,B.jsx)(whe,{text:v}):(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:v});return a===void 0&&!h?(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap`,children:[_,y,b]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap oc-docviewer__textwrap--bar`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__mdbar`,role:`group`,"aria-label":iee(),children:[a===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:g&&!f?`secondary`:`ghost`,"aria-pressed":g&&!f,onClick:()=>{p(!1),d(!1)},children:yhe(a)}),(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:l&&!f?`secondary`:`ghost`,"aria-pressed":l&&!f,onClick:()=>{p(!1),d(!0)},children:Yf()})]}),h?(0,B.jsxs)(Ih,{type:`button`,size:`sm`,variant:f?`secondary`:`ghost`,"aria-pressed":f,onClick:()=>p(e=>!e),className:`oc-docviewer__editbtn`,children:[(0,B.jsx)(jb,{size:13,"aria-hidden":!0}),Ba(),m==null?null:(0,B.jsx)(`span`,{className:`oc-docviewer__draftdot`,"aria-hidden":!0})]}):null]}),f?b:(0,B.jsx)(`div`,{className:`oc-docviewer__textscroll`,children:(0,B.jsxs)(`div`,{className:`oc-docviewer__scrollpad`,children:[_,y,b]})})]})}function bhe({chatId:e,filename:t,diverged:n}){let r=Nt(L.documentDrafts.deleteDraft),i=qF();return(0,B.jsxs)(`p`,{className:`oc-docviewer__draftnote`,children:[n?Ze():zi(),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__draftnote-discard`,onClick:()=>void r({chatId:e,filename:t}).then(e=>{e.applied===!1&&i.error(ph())}).catch(()=>i.error(ao())),children:ia()})]})}function xhe({chatId:e,filename:t,mimeType:n,sourceStorageId:r,initialText:i,hasDraft:a,onExit:o}){let s=Nt(L.documentDrafts.saveDraft),c=Nt(L.documentDrafts.deleteDraft),l=(0,z.useContext)(N1),u=qF(),d=`oc.docdraft.fallback.${e}.${t}`,[f,p]=(0,z.useState)(()=>{try{let e=localStorage.getItem(d);if(e!==null)return e}catch{}return i}),[m,h]=(0,z.useState)(`idle`),g=(0,z.useRef)(0),_=(0,z.useRef)(f);_.current=f;let v=(0,z.useRef)(!1),y=(0,z.useRef)(!1),b=(0,z.useCallback)(n=>{h(`saving`),s({chatId:e,filename:t,text:n,...r!==null&&(y.current||!a)?{sourceStorageId:r}:{}}).then(e=>{if(e.applied===!1){u.error(ph()),h(`idle`);return}h(`saved`)}).catch(e=>{console.error(`[docviewer] draft save failed:`,e),u.error(At()),h(`idle`)})},[s,e,t,r,a,u]),x=e=>{y.current=!0,p(e),window.clearTimeout(g.current),g.current=window.setTimeout(()=>b(e),800)};return(0,z.useEffect)(()=>{try{localStorage.getItem(d)!==null&&(y.current=!0,s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>localStorage.removeItem(d)))}catch{}let n=()=>{if(!(!y.current||v.current))try{localStorage.setItem(d,_.current)}catch{}};return window.addEventListener(`pagehide`,n),()=>{if(window.removeEventListener(`pagehide`,n),window.clearTimeout(g.current),!v.current&&y.current){try{localStorage.setItem(d,_.current)}catch{}s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>{try{localStorage.removeItem(d)}catch{}}).catch(()=>{})}}},[]),(0,B.jsxs)(`div`,{className:`oc-docviewer__editor`,children:[(0,B.jsx)(`textarea`,{className:`oc-docviewer__editarea`,value:f,onChange:e=>x(e.target.value),spellCheck:!1,"aria-label":Ba()}),(0,B.jsxs)(`div`,{className:`oc-docviewer__editbar`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__savestate`,role:`status`,children:m===`saving`?Br():m===`saved`?In():`\xA0`}),(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{v.current=!0,window.clearTimeout(g.current);try{localStorage.removeItem(d)}catch{}c({chatId:e,filename:t}).then(e=>{if(e.applied===!1){v.current=!1,u.error(ph());return}o()}).catch(e=>{console.error(`[docviewer] draft discard failed:`,e),v.current=!1,u.error(ao())})},children:ia()}),(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{let e=l?.current??null;if(e===null){u.error(Gd());return}if(window.clearTimeout(g.current),b(f),e.canAttach){let r=(n??`text/plain`).split(`;`)[0].trim(),i=new File([f],t,{type:`${r}; charset=utf-8`});e.attachFile(i).catch(e=>{console.error(`[docviewer] attach failed:`,e),u.error(ne())})}else{if(f.length>8e3){u.error(Le());return}e.insertText(ghe(t,f,fee()))}},children:Ci()})]})]})}function She({text:e,textTruncated:t,delimiter:n}){let r=(0,z.useMemo)(()=>uhe(e,void 0,n),[e,n]),[i,a]=(0,z.useState)(null),o=(0,z.useMemo)(()=>i?[...r.rows].sort((e,t)=>dhe(e[i.col]??``,t[i.col]??``)*i.dir):r.rows,[r.rows,i]);if(r.header.length===0)return(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e});let s=r.header.slice(0,100),c=r.header.length>s.length;return(0,B.jsxs)(`div`,{className:`oc-docviewer__csvwrap`,children:[r.truncatedRows?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?tu({shown:r.rows.length}):mm({shown:r.rows.length,total:r.totalRows})}):null,c?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:g({shown:s.length,total:r.header.length})}):null,(0,B.jsxs)(`table`,{className:`oc-docviewer__csv`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsx)(`tr`,{children:s.map((e,t)=>(0,B.jsx)(`th`,{children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__csvsort`,onClick:()=>a(e=>e?.col===t?e.dir===1?{col:t,dir:-1}:null:{col:t,dir:1}),"aria-label":ga({column:e}),children:[e,i?.col===t?i.dir===1?` ▲`:` ▼`:``]})},t))})}),(0,B.jsx)(`tbody`,{children:o.map((e,t)=>(0,B.jsx)(`tr`,{children:s.map((t,n)=>(0,B.jsx)(`td`,{children:e[n]??``},n))},t))})]})]})}function Che({text:e,textTruncated:t}){let n=(0,z.useMemo)(()=>{let t=e.split(`
|
|
239
|
+
`&&!a?(r.push(i),i=``):i+=e;i!==``&&r.push(i);let s=r.findIndex(e=>e.trim()!==``);if(s===-1)return{header:[],rows:[],totalRows:0,truncatedRows:!1,delimiter:`,`};let c=n??lhe(r[s]),l=k1(r[s],c),u=r.slice(s+1);return{header:l,rows:u.slice(0,t).map(e=>k1(e,c)),totalRows:u.length,truncatedRows:u.length>t,delimiter:c}}function dhe(e,t){let n=e.trim(),r=t.trim();if(/^-?\d+$/.test(n)&&/^-?\d+$/.test(r)){let e=BigInt(n),t=BigInt(r);return e<t?-1:+(e>t)}let i=Number(e),a=Number(t);return n!==``&&r!==``&&!Number.isNaN(i)&&!Number.isNaN(a)?i-a:e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function fhe(e){return/\b(error|err|fatal|critical|panic)\b/i.test(e)?`error`:/\b(warn|warning)\b/i.test(e)?`warn`:/\b(info|notice)\b/i.test(e)?`info`:/\b(debug|trace|verbose)\b/i.test(e)?`debug`:`plain`}var A1=60;function j1({url:e,filename:t}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(1),[c,l]=(0,z.useState)(`fit`);if((0,z.useEffect)(()=>{let t=!1,n=null;return r(null),a(!1),s(1),(async()=>{try{let i=await WQ(()=>import(`./pdf-DKBRfoBb.js`),[]);i.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CHFwMXne.mjs`,``+import.meta.url).toString();let a=i.getDocument({url:e}),o=await a.promise;if(t){a.destroy().catch(()=>{});return}n=a,r(o)}catch(e){console.error(`[docviewer] pdf load failed:`,e?.message??e),t||a(!0)}})(),()=>{t=!0,n&&n.destroy().catch(()=>{})}},[e]),i)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Lo()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:jp()})]});if(n===null)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:bs()});let u=n.numPages,d=D1(o,u);return(0,B.jsxs)(`div`,{className:`oc-docviewer__pdf`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__toolbar`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>D1(e-1,u)),disabled:d<=1,"aria-label":Pr(),children:(0,B.jsx)(jy,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-docviewer__pageinfo`,children:[d,` / `,u]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>D1(e+1,u)),disabled:d>=u,"aria-label":An(),children:(0,B.jsx)(My,{size:15})}),(0,B.jsx)(`select`,{className:`oc-docviewer__zoom`,value:String(c),onChange:e=>{let t=e.target.value;l(t===`fit`?`fit`:Number(t))},"aria-label":Gt(),children:ahe.map(e=>(0,B.jsx)(`option`,{value:String(e),children:e===`fit`?gr():`${Math.round(e*100)}%`},String(e)))})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__pdfbody`,children:[u>1?(0,B.jsxs)(`div`,{className:`oc-docviewer__rail`,"aria-label":Fa(),children:[Array.from({length:Math.min(u,A1)},(e,t)=>(0,B.jsx)(mhe,{doc:n,page:t+1,active:t+1===d,onClick:()=>s(t+1)},t+1)),u>A1?(0,B.jsxs)(`span`,{className:`oc-docviewer__railmore`,children:[`+`,u-A1]}):null]}):null,(0,B.jsx)(phe,{doc:n,page:d,zoom:c,filename:t})]})]})}function phe({doc:e,page:t,zoom:n,filename:r}){let i=(0,z.useRef)(null),a=(0,z.useRef)(null),[o,s]=(0,z.useState)(0);return(0,z.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;s(e=>Math.abs(e-t)>1?t:e)});return t.observe(e),()=>t.disconnect()},[]),(0,z.useEffect)(()=>{let r=!1,i=null;return(async()=>{try{let s=await e.getPage(t),c=a.current;if(r||!c)return;let l=s.getViewport({scale:1}),u=n===`fit`?Math.max(.1,(o-16)/l.width):n,d=window.devicePixelRatio||1,f=s.getViewport({scale:u*d});c.width=Math.floor(f.width),c.height=Math.floor(f.height),c.style.width=`${Math.floor(f.width/d)}px`,c.style.height=`${Math.floor(f.height/d)}px`;let p=s.render({canvas:c,viewport:f});i=p,await p.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] page render failed:`,e?.message??e)}})(),()=>{r=!0,i?.cancel()}},[e,t,n,o]),(0,B.jsx)(`div`,{ref:i,className:`oc-docviewer__main`,children:(0,B.jsx)(`canvas`,{ref:a,className:`oc-docviewer__canvas`,"aria-label":r})})}function mhe({doc:e,page:t,active:n,onClick:r}){let i=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let n=!1,r=null;return(async()=>{try{let a=await e.getPage(t),o=i.current;if(n||!o)return;let s=104/a.getViewport({scale:1}).width,c=a.getViewport({scale:s});o.width=Math.floor(c.width),o.height=Math.floor(c.height);let l=a.render({canvas:o,viewport:c});r=l,await l.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] thumbnail render failed:`,e?.message??e)}})(),()=>{n=!0,r?.cancel()}},[e,t]),(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__thumb${n?` is-active`:``}`,onClick:r,"aria-label":wt({page:t}),"aria-current":n?`true`:void 0,children:[(0,B.jsx)(`canvas`,{ref:i,className:`oc-docviewer__thumbcanvas`}),(0,B.jsx)(`span`,{className:`oc-docviewer__thumbnum`,children:t})]})}var M1={current:null},N1=(0,z.createContext)(M1);function hhe(e){let t=0,n=e.match(/`+/g);if(n!==null)for(let e of n)t=Math.max(t,e.length);return"`".repeat(Math.max(3,t+1))}function ghe(e,t,n){let r=hhe(t);return`\n${e} ${n}\n${r}\n${t}\n${r}\n`}function _he(e,t){let n=e.length,r=1;for(let t=0;t<e.length;t++)e.charCodeAt(t)===10&&r++;return n<=8e3&&r<=150?{kind:`inline`,lines:r,chars:n}:{kind:`file`,filename:`texte-colle-${t}.txt`,lines:r,chars:n}}var P1=new WeakSet;function F1(e){P1.add(e)}function I1(e){return P1.has(e)}var L1=(0,z.createContext)({activeDoc:null,openFor:()=>{},openNewerVersion:()=>{},close:()=>{}});function R1(){return(0,z.useContext)(L1)}function z1({doc:e,chatId:t,onClose:n}){let r=E1(e.mimeType,e.filename),i=r===`none`&&e.sourceStorageId!==void 0,a=R1(),o=I(L.documentDrafts.latestDeliveredFile,t===null?`skip`:{chatId:t,filename:e.filename,...e.storageId===void 0?{}:{currentStorageId:e.storageId}}),s=o!=null&&(e.storageId===void 0?o.url!==e.url:o.storageId!==e.storageId)?o:null;return(0,B.jsxs)(`div`,{className:`oc-docviewer`,children:[(0,B.jsxs)(`header`,{className:`oc-docviewer__header`,children:[(0,B.jsx)(Zy,{size:15,"aria-hidden":!0,className:`oc-docviewer__icon`}),(0,B.jsx)(`span`,{className:`oc-docviewer__name`,title:e.filename,children:e.filename}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,title:jp(),"aria-label":jp(),children:(0,B.jsx)(Jy,{size:14})}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,download:e.filename,title:Ol(),"aria-label":Ol(),children:(0,B.jsx)(Gy,{size:14})}),(0,B.jsx)(Ih,{type:`button`,size:`icon-sm`,variant:`ghost`,onClick:n,"aria-label":ef(),children:(0,B.jsx)(xh,{size:15})})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__body`,children:[s===null?null:(0,B.jsxs)(`div`,{className:`oc-docviewer__newversion`,role:`status`,children:[(0,B.jsx)(`span`,{children:ut()}),(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>a.openNewerVersion({url:s.url,filename:e.filename,mimeType:s.mimeType||null,storageId:s.storageId,sourceStorageId:w1(s.mimeType,e.filename)?s.storageId:void 0}),children:Co()})]}),r===`pdf`?(0,B.jsx)(j1,{url:e.url,filename:e.filename}):r===`image`?(0,B.jsx)(`div`,{className:`oc-docviewer__imagewrap`,children:(0,B.jsx)(`img`,{src:e.url,alt:e.filename,className:`oc-docviewer__image`})}):r===`video`?(0,B.jsx)(`video`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__video`}):r===`audio`?(0,B.jsx)(`div`,{className:`oc-docviewer__audiowrap`,children:(0,B.jsx)(`audio`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__audio`})}):r===`text`?(0,B.jsx)(V1,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null},e.url):r===`markdown`||r===`csv`||r===`log`||r===`json`?(0,B.jsx)(V1,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null,rich:r,csvDelimiter:r===`csv`?che(e.mimeType,e.filename):void 0},e.url):i?(0,B.jsx)(vhe,{sourceStorageId:e.sourceStorageId,downloadUrl:e.url,filename:e.filename}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:dn()}),(0,B.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:Ol()})]})]})]})}function vhe({sourceStorageId:e,downloadUrl:t,filename:n}){let r=I(L.fileRenditions.getRendition,{sourceStorageId:e}),i=Nt(L.fileRenditions.requestRendition),a=(0,z.useRef)(null);return(0,z.useEffect)(()=>{a.current=null},[e]),(0,z.useEffect)(()=>{r?.status===`pending`&&a.current!==e&&(a.current=e,i({sourceStorageId:e}).catch(e=>{console.error(`[docviewer] rendition request failed:`,e)}))},[r?.status,e,i]),r===void 0?(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:bs()}):r.status===`ready`?(0,B.jsx)(j1,{url:r.pdfUrl,filename:r.filename}):r.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-docviewer__preparing`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__spinner`,"aria-hidden":!0}),(0,B.jsx)(`p`,{children:es()}),(0,B.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:Ol()})]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:r.status===`unconfigured`?dn():he()}),(0,B.jsx)(`a`,{href:t,download:n,className:`oc-docviewer__fallbacklink`,children:Ol()})]})}function yhe(e){switch(e){case`markdown`:return Xc();case`csv`:return od();case`log`:return Kp();case`json`:return Mf()}}var B1=e=>`oc.docviewer.raw.${e}`;function V1({url:e,chatId:t,filename:n,mimeType:r,storageId:i,rich:a,csvDelimiter:o}){let[s,c]=(0,z.useState)({phase:`loading`}),[l,u]=(0,z.useState)(()=>a?localStorage.getItem(B1(a))===`1`:!1),d=e=>{u(e),a&&localStorage.setItem(B1(a),e?`1`:`0`)},[f,p]=(0,z.useState)(!1),m=I(L.documentDrafts.getDraft,t===null?`skip`:{chatId:t,filename:n}),h=t!==null&&s.phase===`ready`&&!s.truncated&&m!==void 0;if((0,z.useEffect)(()=>{let t=!1;return c({phase:`loading`}),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.blob(),i=r.size>O1,a=await(i?r.slice(0,O1):r).text();t||c({phase:`ready`,text:a,truncated:i})}catch(e){console.error(`[docviewer] text fetch failed:`,e?.message??e),t||c({phase:`error`})}})(),()=>{t=!0}},[e]),s.phase===`loading`)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:bs()});if(s.phase===`error`)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:Lo()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:jp()})]});let g=a!==void 0&&!l,_=s.truncated?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:qee()}):null,v=m?.text??s.text,y=m==null?null:(0,B.jsx)(bhe,{chatId:t,filename:n,diverged:m.sourceStorageId!==null&&i!==null&&m.sourceStorageId!==i}),b=f?(0,B.jsx)(xhe,{chatId:t,filename:n,mimeType:r,sourceStorageId:i,initialText:v,hasDraft:m!=null,onExit:()=>p(!1)}):g&&a===`markdown`?(0,B.jsx)(`div`,{className:`oc-docviewer__mdwrap`,children:(0,B.jsx)(C1,{text:v})}):g&&a===`csv`?(0,B.jsx)(She,{text:v,textTruncated:s.truncated,delimiter:o}):g&&a===`log`?(0,B.jsx)(Che,{text:v,textTruncated:s.truncated}):g&&a===`json`?(0,B.jsx)(whe,{text:v}):(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:v});return a===void 0&&!h?(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap`,children:[_,y,b]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap oc-docviewer__textwrap--bar`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__mdbar`,role:`group`,"aria-label":iee(),children:[a===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:g&&!f?`secondary`:`ghost`,"aria-pressed":g&&!f,onClick:()=>{p(!1),d(!1)},children:yhe(a)}),(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:l&&!f?`secondary`:`ghost`,"aria-pressed":l&&!f,onClick:()=>{p(!1),d(!0)},children:Yf()})]}),h?(0,B.jsxs)(Ih,{type:`button`,size:`sm`,variant:f?`secondary`:`ghost`,"aria-pressed":f,onClick:()=>p(e=>!e),className:`oc-docviewer__editbtn`,children:[(0,B.jsx)(jb,{size:13,"aria-hidden":!0}),Ba(),m==null?null:(0,B.jsx)(`span`,{className:`oc-docviewer__draftdot`,"aria-hidden":!0})]}):null]}),f?b:(0,B.jsx)(`div`,{className:`oc-docviewer__textscroll`,children:(0,B.jsxs)(`div`,{className:`oc-docviewer__scrollpad`,children:[_,y,b]})})]})}function bhe({chatId:e,filename:t,diverged:n}){let r=Nt(L.documentDrafts.deleteDraft),i=JF();return(0,B.jsxs)(`p`,{className:`oc-docviewer__draftnote`,children:[n?Ze():zi(),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__draftnote-discard`,onClick:()=>void r({chatId:e,filename:t}).then(e=>{e.applied===!1&&i.error(ph())}).catch(()=>i.error(ao())),children:ia()})]})}function xhe({chatId:e,filename:t,mimeType:n,sourceStorageId:r,initialText:i,hasDraft:a,onExit:o}){let s=Nt(L.documentDrafts.saveDraft),c=Nt(L.documentDrafts.deleteDraft),l=(0,z.useContext)(N1),u=JF(),d=`oc.docdraft.fallback.${e}.${t}`,[f,p]=(0,z.useState)(()=>{try{let e=localStorage.getItem(d);if(e!==null)return e}catch{}return i}),[m,h]=(0,z.useState)(`idle`),g=(0,z.useRef)(0),_=(0,z.useRef)(f);_.current=f;let v=(0,z.useRef)(!1),y=(0,z.useRef)(!1),b=(0,z.useCallback)(n=>{h(`saving`),s({chatId:e,filename:t,text:n,...r!==null&&(y.current||!a)?{sourceStorageId:r}:{}}).then(e=>{if(e.applied===!1){u.error(ph()),h(`idle`);return}h(`saved`)}).catch(e=>{console.error(`[docviewer] draft save failed:`,e),u.error(At()),h(`idle`)})},[s,e,t,r,a,u]),x=e=>{y.current=!0,p(e),window.clearTimeout(g.current),g.current=window.setTimeout(()=>b(e),800)};return(0,z.useEffect)(()=>{try{localStorage.getItem(d)!==null&&(y.current=!0,s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>localStorage.removeItem(d)))}catch{}let n=()=>{if(!(!y.current||v.current))try{localStorage.setItem(d,_.current)}catch{}};return window.addEventListener(`pagehide`,n),()=>{if(window.removeEventListener(`pagehide`,n),window.clearTimeout(g.current),!v.current&&y.current){try{localStorage.setItem(d,_.current)}catch{}s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>{try{localStorage.removeItem(d)}catch{}}).catch(()=>{})}}},[]),(0,B.jsxs)(`div`,{className:`oc-docviewer__editor`,children:[(0,B.jsx)(`textarea`,{className:`oc-docviewer__editarea`,value:f,onChange:e=>x(e.target.value),spellCheck:!1,"aria-label":Ba()}),(0,B.jsxs)(`div`,{className:`oc-docviewer__editbar`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__savestate`,role:`status`,children:m===`saving`?Br():m===`saved`?In():`\xA0`}),(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{v.current=!0,window.clearTimeout(g.current);try{localStorage.removeItem(d)}catch{}c({chatId:e,filename:t}).then(e=>{if(e.applied===!1){v.current=!1,u.error(ph());return}o()}).catch(e=>{console.error(`[docviewer] draft discard failed:`,e),v.current=!1,u.error(ao())})},children:ia()}),(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{let e=l?.current??null;if(e===null){u.error(Gd());return}if(window.clearTimeout(g.current),b(f),e.canAttach){let r=(n??`text/plain`).split(`;`)[0].trim(),i=new File([f],t,{type:`${r}; charset=utf-8`});e.attachFile(i).catch(e=>{console.error(`[docviewer] attach failed:`,e),u.error(ne())})}else{if(f.length>8e3){u.error(Le());return}e.insertText(ghe(t,f,fee()))}},children:Ci()})]})]})}function She({text:e,textTruncated:t,delimiter:n}){let r=(0,z.useMemo)(()=>uhe(e,void 0,n),[e,n]),[i,a]=(0,z.useState)(null),o=(0,z.useMemo)(()=>i?[...r.rows].sort((e,t)=>dhe(e[i.col]??``,t[i.col]??``)*i.dir):r.rows,[r.rows,i]);if(r.header.length===0)return(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e});let s=r.header.slice(0,100),c=r.header.length>s.length;return(0,B.jsxs)(`div`,{className:`oc-docviewer__csvwrap`,children:[r.truncatedRows?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?tu({shown:r.rows.length}):mm({shown:r.rows.length,total:r.totalRows})}):null,c?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:g({shown:s.length,total:r.header.length})}):null,(0,B.jsxs)(`table`,{className:`oc-docviewer__csv`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsx)(`tr`,{children:s.map((e,t)=>(0,B.jsx)(`th`,{children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__csvsort`,onClick:()=>a(e=>e?.col===t?e.dir===1?{col:t,dir:-1}:null:{col:t,dir:1}),"aria-label":ga({column:e}),children:[e,i?.col===t?i.dir===1?` ▲`:` ▼`:``]})},t))})}),(0,B.jsx)(`tbody`,{children:o.map((e,t)=>(0,B.jsx)(`tr`,{children:s.map((t,n)=>(0,B.jsx)(`td`,{children:e[n]??``},n))},t))})]})]})}function Che({text:e,textTruncated:t}){let n=(0,z.useMemo)(()=>{let t=e.split(`
|
|
240
240
|
`);return t.length>1&&t[t.length-1]===``&&t.pop(),t},[e]),r=(0,z.useMemo)(()=>n.slice(0,she),[n]);return(0,B.jsxs)(B.Fragment,{children:[n.length>r.length?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?Ls({shown:r.length}):yc({shown:r.length,total:n.length})}):null,(0,B.jsx)(`pre`,{className:`oc-docviewer__text oc-docviewer__logview`,children:r.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-logline oc-logline--${fhe(e)}`,children:[e,`
|
|
241
|
-
`]},t))})]})}function whe({text:e}){let t=(0,z.useMemo)(()=>{try{return{ok:!0,value:JSON.parse(e,(e,t,n)=>{if(typeof t==`number`&&Number.isInteger(t)&&!Number.isSafeInteger(t)&&typeof n?.source==`string`&&/^-?\d+$/.test(n.source))try{return BigInt(n.source)}catch{return t}return t})}}catch{return{ok:!1}}},[e]);return t.ok?(0,B.jsx)(`div`,{className:`oc-docviewer__jsonwrap`,children:(0,B.jsx)(H1,{value:t.value,depth:0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:rc()}),(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e})]})}function The(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 Ehe(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 H1({value:e,depth:t,name:n}){let r=typeof e==`object`&&!!e,i=r?The(e):0,[a,o]=(0,z.useState)(t<2&&i<=100),s=n===void 0?null:(0,B.jsxs)(`span`,{className:`oc-json__key`,children:[n,`: `]});if(!r)return(0,B.jsxs)(`div`,{className:`oc-json__leaf`,children:[s,(0,B.jsx)(`span`,{className:`oc-json__val oc-json__val--${e===null?`null`:typeof e==`bigint`?`number`:typeof e}`,children:typeof e==`bigint`?e.toString():JSON.stringify(e)})]});let c=a?Ehe(e,500):[];return(0,B.jsxs)(`details`,{className:`oc-json__node`,open:a,onToggle:e=>o(e.target.open),children:[(0,B.jsxs)(`summary`,{children:[s,(0,B.jsx)(`span`,{className:`oc-json__summary`,children:Array.isArray(e)?`[${i}]`:`{${i}}`})]}),a?(0,B.jsxs)(`div`,{className:`oc-json__children`,children:[c.map(([e,n])=>(0,B.jsx)(H1,{name:e,value:n,depth:t+1},e)),i>c.length?(0,B.jsx)(`div`,{className:`oc-json__more`,children:Xn({count:i-c.length})}):null]}):null]})}var U1=(0,z.createContext)(null);function Dhe(){return(0,z.useContext)(U1)??{open:()=>{}}}function W1({children:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useCallback)(e=>{n(e),i(!1)},[]),l=(0,z.useCallback)(()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),n(null),o(!1)},[]);(0,z.useEffect)(()=>{if(t===null)return;let e=e=>{e.key===`Escape`&&l()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,l]),(0,z.useEffect)(()=>{let e=()=>o(document.fullscreenElement!==null);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let u=(0,z.useCallback)(()=>{let e=s.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]);return(0,B.jsxs)(U1.Provider,{value:{open:c},children:[e,t===null?null:(0,Fv.createPortal)((0,B.jsxs)(`div`,{ref:s,className:`oc-lightbox`,role:`dialog`,"aria-modal":`true`,"aria-label":t.name,onClick:e=>{e.target===e.currentTarget&&l()},children:[(0,B.jsxs)(`div`,{className:`oc-lightbox__bar`,children:[(0,B.jsx)(`span`,{className:`oc-lightbox__name`,title:t.name,children:t.name}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:()=>i(e=>!e),"aria-label":r?is():ye(),title:r?is():ye(),children:r?(0,B.jsx)(wne,{size:18}):(0,B.jsx)(Cne,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:u,"aria-label":a?za():bh(),title:a?za():bh(),children:a?(0,B.jsx)(Sb,{size:18}):(0,B.jsx)(gb,{size:18})}),(0,B.jsx)(`a`,{className:`oc-lightbox__btn`,href:t.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":zr(),title:zr(),children:(0,B.jsx)(Jy,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:l,"aria-label":Fn(),title:Fn(),children:(0,B.jsx)(xh,{size:18})})]}),(0,B.jsx)(`div`,{className:`oc-lightbox__stage${r?` oc-lightbox__stage--scroll`:``}`,onClick:e=>{e.target===e.currentTarget&&l()},children:(0,B.jsx)(`img`,{src:t.url,alt:t.name,className:r?`oc-lightbox__img--actual`:`oc-lightbox__img--fit`,decoding:`async`})})]}),document.body)]})}function G1({className:e,...t}){return(0,B.jsx)(YO,{"data-slot":`checkbox`,className:Bp(`peer size-4 shrink-0 rounded-[4px] border border-input bg-background ring-offset-background transition-shadow outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground`,e),...t,children:(0,B.jsx)(ZO,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,B.jsx)(Cb,{className:`size-3.5`}):(0,B.jsx)(ky,{className:`size-3.5`})})})}function K1(e,t){return t===`memory`?`memory`:e.context===!0||!e.file_name?`context`:`document`}function q1(e){let t={memory:0,documents:0,context:0};for(let n of e)for(let e of n.items){let r=K1(e,n.group);r===`memory`?t.memory+=1:r===`document`?t.documents+=1:t.context+=1}return t}function Ohe(e){return e.memory+e.documents+e.context>0}function J1(e){let t=[];return e.memory>0&&t.push(e.memory===1?Ne():$a({count:e.memory})),e.documents>0&&t.push(e.documents===1?Cee():hl({count:e.documents})),e.context>0&&t.push(e.context===1?Fu():Ju({count:e.context})),t.join(` · `)}function Y1(e){return e.title??e.file_name??e.id??e.type??bu()}function X1(e){return e.title&&e.file_name?e.file_name:void 0}function khe(e){return e.file_name??Y1(e)}function Z1(e){let t=[];return e.type&&Y1(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(pp({score:e.score.toFixed(2)})),t}function Q1(e,t){let n=[];return e.forEach((e,r)=>{e.group===t&&e.items.forEach((t,i)=>{n.push({key:`${e.pluginId}|${e.group}|${t.id??t.file_name??`?`}|${r}.${i}`,group:e.group,pluginId:e.pluginId,source:e.source,item:t})})}),n.sort((e,t)=>(t.item.score??0)-(e.item.score??0))}function $1(e,t){let n=t.trim().toLowerCase();return n===``?!0:[n0(e),e.item.file_name??``,e.item.text??``,...Z1(e.item)].join(` `).toLowerCase().includes(n)}function e0(e){return K1(e.item,e.group)===`document`}function t0(e){return K1(e.item,e.group)===`context`}function n0(e){return t0(e)?yf():Y1(e.item)}var r0=(0,z.createContext)(null),Ahe=[];function jhe(){let e=U(e=>e.metadata?.custom?.provenanceParts??Ahe),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.attachedDocCount??0),r=(0,z.useContext)(r0),i=q1(e);if(e.length===0||!Ohe(i))return null;let a=r?.activeMessageId===t&&t!==void 0,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-actrow__counts`,children:J1(i)}),n>0?(0,B.jsxs)(`span`,{className:`oc-actrow__badge`,title:Yp({count:n}),children:[(0,B.jsx)(Gy,{size:12,"aria-hidden":!0}),n]}):null]});return(0,B.jsx)(sI,{icon:(0,B.jsx)(Zy,{size:14}),label:lee(),trailing:o,active:a,ariaExpanded:a,ariaHasPopup:!0,ariaLabel:jm(),onClick:()=>t&&r?.openFor(t)})}function i0({messageId:e,onClose:t}){let n=I(L.messages.getProvenanceParts,{messageId:e}),r=(0,z.useMemo)(()=>n??[],[n]),i=I(L.agents.documentaryAvailable,{}),a=I(L.documentAttachments.getDocumentAttachments,{sourceMessageId:e}),o=Nt(L.documentAttachments.attachDocuments),s=qF(),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of a??[])e.set(t.entryKey,t);return e},[a]),l=(a??[]).some(e=>e.status===`pending`),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(new Set);(0,z.useEffect)(()=>{f(``),m(!1),g(!1),v(!1),b(new Set)},[e]);let x=(0,z.useMemo)(()=>Q1(r,`documents`).filter(e=>e0(e)&&$1(e,d)),[r,d]),S=(0,z.useMemo)(()=>Q1(r,`documents`).filter(e=>t0(e)&&$1(e,d)),[r,d]),C=(0,z.useMemo)(()=>Q1(r,`memory`).filter(e=>$1(e,d)),[r,d]),w=q1(r),T=e=>b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),E=(e,t)=>b(n=>{let r=new Set(n);for(let n of e)t?r.add(n):r.delete(n);return r}),D=(0,z.useMemo)(()=>Q1(r,`documents`).filter(e=>e0(e)&&y.has(e.key)),[r,y]),O=i!=null&&D.length>0&&!l;async function k(){if(O)try{await o({sourceMessageId:e,items:D.map(e=>({entryKey:e.key,reference:khe(e.item)}))}),s.success(u())}catch(e){let t=KF(e);t.includes(`fetch_in_flight`)?s.error(iu()):t.includes(`no_documentary_agent`)?s.error(_m()):s.error(la(),e)}}let A=n===void 0;return(0,B.jsxs)(`div`,{className:`oc-sources-panel`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__head`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__heading`,children:[(0,B.jsx)(`h2`,{className:`oc-sources-panel__title`,children:Wl()}),(0,B.jsx)(`p`,{className:`oc-sources-panel__sub`,children:J1(w)})]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,onClick:t,"aria-label":or(),title:or(),children:(0,B.jsx)(xh,{size:16,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-sources-panel__search`,children:[(0,B.jsx)(Bb,{size:15,"aria-hidden":!0}),(0,B.jsx)(TF,{value:d,onChange:e=>f(e.target.value),placeholder:nf(),"aria-label":nf()})]}),(0,B.jsx)(`div`,{className:`oc-sources-panel__body`,children:A?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:(0,B.jsx)(pb,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(a0,{icon:(0,B.jsx)(Zy,{size:14,"aria-hidden":!0}),label:qm(),count:x.length,expanded:p,onToggle:()=>m(e=>!e),entries:x,selectable:!0,selected:y,onToggle1:T,onToggleAll:e=>E(x.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(a0,{icon:(0,B.jsx)(Eb,{size:14,"aria-hidden":!0}),label:Rc(),count:S.length,expanded:h,onToggle:()=>g(e=>!e),entries:S,selectable:!1,selected:y,onToggle1:T,onToggleAll:e=>E(S.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(a0,{icon:(0,B.jsx)(Dy,{size:14,"aria-hidden":!0}),label:Lee(),count:C.length,expanded:_,onToggle:()=>v(e=>!e),entries:C,selectable:!1,selected:y,onToggle1:T,onToggleAll:e=>E(C.map(e=>e.key),e),attachmentByKey:c}),x.length===0&&S.length===0&&C.length===0?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:Al()}):null]})}),D.length>0?(0,B.jsxs)(`div`,{className:`oc-sources-panel__actions`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__actrow`,children:[(0,B.jsx)(`span`,{className:`oc-sources-panel__selcount`,children:Qf({count:D.length})}),(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,disabled:!O,onClick:()=>void k(),children:[l?(0,B.jsx)(pb,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,B.jsx)(Kb,{size:14,"aria-hidden":!0}),$c()]})]}),(0,B.jsx)(`p`,{className:`oc-sources-panel__acthint`,children:i==null?_m():l?iu():ld()})]}):null]})}function a0({icon:e,label:t,count:n,expanded:r,onToggle:i,entries:a,selectable:o,selected:s,onToggle1:c,onToggleAll:l,attachmentByKey:u}){if(n===0)return null;let d=a.every(e=>s.has(e.key));return(0,B.jsxs)(`section`,{className:`oc-srcsec${r?` is-open`:``}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-srcsec__head`,"aria-expanded":r,onClick:i,children:[r?(0,B.jsx)(Ay,{size:14,"aria-hidden":!0}):(0,B.jsx)(My,{size:14,"aria-hidden":!0}),e,(0,B.jsx)(`span`,{className:`oc-srcsec__label`,children:t}),(0,B.jsx)(`span`,{className:`oc-srcsec__count`,children:n})]}),r?(0,B.jsxs)(`div`,{className:`oc-srcsec__body`,children:[o?(0,B.jsxs)(`label`,{className:`oc-srcsec__all`,children:[(0,B.jsx)(G1,{checked:d,onCheckedChange:e=>l(e===!0)}),(0,B.jsx)(`span`,{children:oee()})]}):null,a.map(e=>(0,B.jsx)(Mhe,{entry:e,selectable:o,selected:s.has(e.key),onToggle:()=>c(e.key),attachment:u.get(e.key)},e.key))]}):null]})}function Mhe({entry:e,selectable:t,selected:n,onToggle:r,attachment:i}){let[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(!1),{item:u}=e;(0,z.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight+1);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[u.text]);let d=Z1(u),f=typeof u.score==`number`?Math.max(0,Math.min(1,u.score)):null,p=e0(e);return(0,B.jsxs)(`div`,{className:`oc-srccard${t&&n?` is-selected`:``}`,children:[t?(0,B.jsx)(`label`,{className:`oc-srccard__pick`,children:(0,B.jsx)(G1,{checked:n,onCheckedChange:r})}):null,(0,B.jsxs)(`div`,{className:`oc-srccard__body`,children:[(0,B.jsx)(`div`,{className:`oc-srccard__title`,children:n0(e)}),p&&X1(e.item)?(0,B.jsx)(`div`,{className:`oc-srccard__subid`,title:X1(e.item),children:X1(e.item)}):null,d.length>0||f!==null?(0,B.jsxs)(`div`,{className:`oc-srccard__meta`,children:[d.map(e=>(0,B.jsx)(`span`,{className:`oc-srccard__chip`,children:e},e)),f===null?null:(0,B.jsx)(`span`,{className:`oc-srccard__relev`,title:pp({score:f.toFixed(2)}),children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-track`,"aria-hidden":!0,children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-fill`,style:{width:`${Math.round(f*100)}%`}})})})]}):null,u.text?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`blockquote`,{ref:s,className:`oc-srccard__excerpt${a?` is-full`:``}`,children:u.text}),c||a?(0,B.jsx)(`button`,{type:`button`,className:`oc-srccard__more`,onClick:()=>o(e=>!e),children:a?xp():Bn()}):null]}):null,p?(0,B.jsx)(Nhe,{attachment:i}):null]})]})}function Nhe({attachment:e}){if(e?.status===`ready`&&e.url){let t=e.filename??As();return(0,B.jsxs)(`a`,{className:`oc-srccard__origin oc-srccard__origin--ready`,href:e.url,download:e.filename??void 0,target:`_blank`,rel:`noreferrer`,title:As(),children:[(0,B.jsx)(Gy,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-srccard__origin-name`,children:t})]})}return e?.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--pending`,children:[(0,B.jsx)(pb,{size:13,"aria-hidden":!0}),fc()]}):e?.status===`not_found`||e?.status===`failed`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--missing`,"aria-disabled":!0,children:[(0,B.jsx)(xh,{size:13,"aria-hidden":!0}),qs()]}):(0,B.jsxs)(`div`,{className:`oc-srccard__origin`,"aria-disabled":!0,children:[(0,B.jsx)(Gy,{size:13,"aria-hidden":!0}),If()]})}function o0(e,t){return new Date(e).toLocaleString(Jd(),t)}function Phe(e){return new Date(e).toLocaleDateString(Jd())}function s0(e){return new Date(e).toLocaleTimeString(Jd())}function Fhe(e){return e.toLocaleString(Jd())}function c0(e){if(!Number.isFinite(e)||e<0)return null;if(e<1e3)return`< 1 s`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r===0?`${n} min`:`${n} min ${String(r).padStart(2,`0`)} s`;let i=Math.floor(n/60),a=n%60;return a===0?`${i} h`:`${i} h ${String(a).padStart(2,`0`)} min`}var Ihe=new Set([`status`,`exitCode`,`durationMs`]);function Lhe(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Rhe(e){if(typeof e==`string`)return{kind:`text`,text:e};if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e,n=Object.keys(t);if(typeof t.exitCode==`number`&&n.every(e=>Ihe.has(e)))return{kind:`outcome`,status:typeof t.status==`string`?t.status:null,exitCode:t.exitCode,durationMs:typeof t.durationMs==`number`?t.durationMs:null}}return{kind:`json`,text:Lhe(e)}}function zhe(e){let t=[(e.exitCode===null?e.status===`completed`:e.exitCode===0)?lm():Zl()];return e.exitCode!==null&&t.push(v({code:e.exitCode})),e.durationMs!==null&&t.push(va({ms:e.durationMs})),t.join(` · `)}var Bhe=new Set([`complete`,`error`,`aborted`]),Vhe=new Set([`completed`,`error`]);function Hhe(e,t){if(e.length===0)return!1;if(t===`streaming`)return!0;if(t!==void 0&&Bhe.has(t))return!1;let n=e[e.length-1];return n.phase!==void 0&&Vhe.has(n.phase)?!1:n.result===void 0||n.result===null}var Uhe=[`command`,`query`,`url`,`path`,`pattern`,`file`,`cmd`,`prompt`];function Whe(e,t){let n=``;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of Uhe){let r=t[e];if(typeof r==`string`&&r.trim()){n=r;break}}}return n||=t??(typeof e==`string`?e:``),n.replace(/\s+/g,` `).trim()}function Ghe(e,t){let n=e.length,r=n===1?Vp({count:n}):Df({count:n});return{count:n,running:Hhe(e,t),label:r}}function l0({text:e}){let[t,n]=(0,z.useState)(!1);return(0,B.jsx)(`button`,{type:`button`,className:`oc-copybtn`,title:hf(),"aria-label":up(),onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{n(!0),window.setTimeout(()=>n(!1),1200)})},children:t?(0,B.jsx)(ky,{size:13,"aria-hidden":!0}):(0,B.jsx)(Vy,{size:13,"aria-hidden":!0})})}function Khe(e,t,n){let r=typeof e==`string`?e:void 0;return r===`error`?`error`:t||r===`completed`||n?`completed`:`running`}function qhe(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function u0({toolName:e,args:t,argsText:n,result:r,status:i,turnSettled:a}){let o=r!=null,s=Khe(i?.type,o,a),c=n??qhe(t),l=Whe(t,n),u=o?Rhe(r):null,d=s===`running`?pb:s===`error`?Py:Iy;return(0,B.jsxs)(`details`,{className:`oc-tool oc-tool--${s}`,children:[(0,B.jsxs)(`summary`,{className:`oc-tool__header`,children:[(0,B.jsx)(d,{className:`oc-tool__status${s===`running`?` oc-tool__status--spin`:``}`,size:14,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-tool__name`,children:e}),l?(0,B.jsx)(`span`,{className:`oc-tool__preview`,title:l,children:l}):null,(0,B.jsx)(`span`,{className:`oc-tool__phase`,children:s}),(0,B.jsx)(My,{size:15,className:`oc-tool__chevron`,"aria-hidden":!0})]}),(0,B.jsxs)(`div`,{className:`oc-tool__body`,children:[c?(0,B.jsxs)(`details`,{className:`oc-tool__io`,children:[(0,B.jsx)(`summary`,{children:`input`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:c}),(0,B.jsx)(l0,{text:c})]})]}):null,u&&u.kind===`outcome`?(0,B.jsxs)(`div`,{className:`oc-tool__outcome`,children:[(0,B.jsx)(`span`,{className:`oc-tool__outcome-label`,children:zhe(u)}),(0,B.jsx)(`span`,{className:`oc-tool__outcome-note`,children:xc()})]}):u?(0,B.jsxs)(`details`,{className:`oc-tool__io`,open:!0,children:[(0,B.jsx)(`summary`,{children:`output`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:u.text}),(0,B.jsx)(l0,{text:u.text})]})]}):null]})]})}function d0({...e}){return(0,B.jsx)(Th,{"data-slot":`dialog`,...e})}function Jhe({...e}){return(0,B.jsx)(Sh,{"data-slot":`dialog-portal`,...e})}function Yhe({className:e,...t}){return(0,B.jsx)(Ch,{"data-slot":`dialog-overlay`,className:Bp(`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 f0({className:e,children:t,showCloseButton:n=!0,...r}){return(0,B.jsxs)(Jhe,{children:[(0,B.jsx)(Yhe,{}),(0,B.jsxs)(wh,{"data-slot":`dialog-content`,className:Bp(`fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover bg-clip-padding p-5 text-sm text-popover-foreground shadow-lg duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,B.jsx)(Oh,{"data-slot":`dialog-close`,asChild:!0,children:(0,B.jsxs)(Ih,{variant:`ghost`,size:`icon-sm`,className:`absolute top-3 right-3`,children:[(0,B.jsx)(xh,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:Fc()})]})})]})]})}function p0({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:Bp(`flex flex-col gap-1.5 pr-6`,e),...t})}function m0({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-footer`,className:Bp(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function h0({className:e,...t}){return(0,B.jsx)(Dh,{"data-slot":`dialog-title`,className:Bp(`text-base font-medium text-foreground`,e),...t})}function g0({className:e,...t}){return(0,B.jsx)(Eh,{"data-slot":`dialog-description`,className:Bp(`text-sm text-muted-foreground`,e),...t})}function _0(e){return(0,B.jsx)(CM,{"data-slot":`select`,...e})}function v0(e){return(0,B.jsx)(DM,{"data-slot":`select-value`,...e})}function y0({className:e,size:t=`default`,children:n,...r}){return(0,B.jsxs)(TM,{"data-slot":`select-trigger`,"data-size":t,className:Bp(`flex w-fit items-center justify-between gap-2 rounded-lg border border-input bg-background px-2.5 py-1 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,B.jsx)(kM,{asChild:!0,children:(0,B.jsx)(Ay,{className:`size-4 opacity-50`})})]})}function b0({className:e,children:t,position:n=`popper`,...r}){return(0,B.jsx)(NM,{children:(0,B.jsxs)(FM,{"data-slot":`select-content`,className:Bp(`relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,B.jsx)(cN,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(Ny,{className:`size-4`})}),(0,B.jsx)(XM,{className:Bp(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,B.jsx)(uN,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(Ay,{className:`size-4`})})]})})}function x0({className:e,children:t,...n}){return(0,B.jsxs)(nN,{"data-slot":`select-item`,className:Bp(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(oN,{children:(0,B.jsx)(ky,{className:`size-4`})})}),(0,B.jsx)(iN,{children:t})]})}var S0=1e3;function Xhe(){return[{id:`hung`,label:sn()},{id:`wrong_result`,label:Xo()},{id:`error`,label:de()},{id:`other`,label:Wee()}]}function Zhe({target:e,onClose:t}){let n=Nt(L.subAgentReports.createSubAgentReport),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1);(0,z.useEffect)(()=>{e&&(i(``),o(``),c(!1),u(!1))},[e]);function d(e){e||t()}async function f(){if(!(!e||s)){c(!0);try{await n({subAgentId:e.subAgentId,category:r||void 0,comment:a.trim()||void 0}),u(!0)}catch{c(!1)}}}return(0,B.jsx)(d0,{open:e!==null,onOpenChange:d,children:e?(0,B.jsxs)(f0,{className:`sm:max-w-md`,children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:Kn()}),(0,B.jsx)(g0,{children:l?fr():Dp({label:e.label})})]}),l?(0,B.jsx)(`div`,{className:`oc-feedback__result`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-ok`,children:Vt()})}):(0,B.jsxs)(`div`,{className:`oc-feedback__form`,children:[(0,B.jsx)(`label`,{className:`oc-feedback__label`,children:gs()}),(0,B.jsxs)(_0,{value:r,onValueChange:i,children:[(0,B.jsx)(y0,{children:(0,B.jsx)(v0,{placeholder:No()})}),(0,B.jsx)(b0,{children:Xhe().map(e=>(0,B.jsx)(x0,{value:e.id,children:e.label},e.id))})]}),(0,B.jsx)(`label`,{className:`oc-feedback__label`,htmlFor:`oc-subagentreport-comment`,children:ja()}),(0,B.jsx)(`textarea`,{id:`oc-subagentreport-comment`,className:`oc-feedback__textarea`,placeholder:Ar(),value:a,maxLength:S0,onChange:e=>o(e.target.value.slice(0,S0)),rows:4}),(0,B.jsxs)(`div`,{className:`oc-feedback__count`,children:[a.length,`/`,S0]})]}),(0,B.jsx)(m0,{children:l?(0,B.jsx)(Ih,{onClick:()=>d(!1),children:pi()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ih,{variant:`outline`,onClick:()=>d(!1),children:En()}),(0,B.jsx)(Ih,{onClick:()=>void f(),disabled:s,children:s?Ji():bt()})]})})]}):null})}function Qhe(e,t=`md`){let n=(e??``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40);return`sous-agent${n?`-${n}`:``}.${t}`}function $he(e){return JSON.stringify({kind:`sub-agent`,taskName:e.taskName??null,status:e.status,exportedAt:new Date(e.exportedAt).toISOString(),parentAgent:e.parentAgentLabel??null,config:e.sessionMeta??null,telemetry:e.telemetry??null,tools:e.tools.map(e=>({name:e.name,status:e.status,input:e.argsText??null,output:e.resultText??null})),result:e.result??null,error:e.error??null},null,2)}function ege(e){let t=[],n=e.taskName?.trim()||ed();t.push(`# ${ed()} — ${n}`,``);let r=[];e.parentAgentLabel&&r.push(`- ${vr()} : ${e.parentAgentLabel}`);let i=e.sessionMeta;if(i?.model&&r.push(`- ${wm()} : ${i.model}${i.modelProvider?` (${i.modelProvider})`:``}`),i?.thinkingLevel&&r.push(`- ${y()} : ${i.thinkingLevel}`),i?.fastMode!==void 0&&r.push(`- ${ya()} : ${i.fastMode?Sc():Bs()}`),i?.controlScope&&r.push(`- ${ac()} : ${i.controlScope}`),i?.subagentRole&&r.push(`- ${Qn()} : ${i.subagentRole}`),i?.spawnDepth!==void 0&&r.push(`- ${Np()} : ${i.spawnDepth}`),r.length&&t.push(...r,``),e.tools.length>0){t.push(`## ${Yl()} (${e.tools.length})`,``);for(let n of e.tools)t.push(`### ${n.name} — ${n.status}`,``),n.argsText&&t.push(`**Input**`,``,"```",n.argsText,"```",``),n.resultText&&t.push(`**Output**`,``,"```",n.resultText,"```",``)}return e.error&&t.push(`## ${Lm()}`,``,e.error,``),e.result&&t.push(`## ${lf()}`,``,e.result,``),`${t.join(`
|
|
242
|
-
`).trim()}\n`}function tge(e,t,n=!1){if(e===void 0)return`thinking`;switch(e){case`streaming`:return t?`generating`:`thinking`;case`error`:return`error`;case`aborted`:return`aborted`;default:return n?`aborted`:null}}function nge(e){return e?e.some(e=>e?.type===`text`&&typeof e.text==`string`&&e.text.trim().length>0):!1}var rge={thinking:rh,generating:Nc,error:Fo,aborted:_f},C0={processing_history:Oe,compacting:Ja,querying_gateway:vee,awaiting_subagents:ul,post_processing:Mee,awaiting_approval:Hm},ige=[[`read`,/^(read|read_file|cat|open|view|notebook_read)$/i],[`exec`,/^(exec|bash|shell|run|command|terminal)$/i],[`search`,/^(web_search|search|grep|find|glob|rg)$/i],[`fetch`,/^(web_fetch|fetch|browser|http_get)$/i],[`write`,/^(write|write_file|apply_patch|edit|str_replace|notebook_edit)$/i]];function w0(e){for(let[t,n]of ige)if(n.test(e))return t;return`other`}var age={read:()=>Au(),exec:()=>Uu(),search:()=>mf(),fetch:()=>lp(),write:()=>gu(),other:e=>Vl({tool:e})};function T0(e){if(!e||e.length===0)return null;let t=e=>e.toolCallId??e.toolName,n=new Set;for(let r=e.length-1;r>=0;r--){let i=e[r],a=i.phase??`completed`;if(a===`completed`||a===`error`){n.add(t(i));continue}if((a===`start`||a===`started`||a===`running`)&&!n.has(t(i)))return{name:i.toolName,family:w0(i.toolName)}}return null}function oge(e,t,n,r,i){let a=tge(e,t,i??!1);if(a===null)return null;if(a===`thinking`||a===`generating`){if(r)return{kind:a,label:age[r.family](r.name),phased:!0};if(n&&C0[n])return{kind:a,label:C0[n](),phased:!0}}return{kind:a,label:rge[a]()}}function sge(e,t){return!t||e!==`thinking`&&e!==`generating`?null:mo()}var cge=new Set([`context_length`,`context_length_compacted`,`context_length_presend`]),E0={context_length:Mr,context_length_compacted:On,context_length_presend:St,rate_limit:Ic,timeout:Nu,refusal:Ku,stream_orphaned:ln,connection_lost:Qo,gateway_restarting:pe,connection_saturated:vh,GATEWAY_RESTARTING:pe,CONNECTION_SATURATED:vh,response_timeout:Na,compaction_timeout:Ge,empty_response:at,msgtool_args_unreadable:go,awaiting_approval:oh,empty_response_silent:je,provider_internal:Za,session_init_conflict:Fee,session_write_conflict:Gm,not_configured:Lc,no_agent:Pu,agent_restricted:qu,send_failed:vf,DISPATCH_STALLED:yl,ATTACHMENT_TOO_LARGE:fp,ATTACHMENT_REJECTED:yu},lge=/context overflow|prompt too large|maximum context length|context[- ]length exceeded|request_too_large|request too large|input (?:token count )?exceeds the maximum number of (?:input )?tokens|input is too long for the model|too many tokens/i,D0=new Set([`stream_orphaned`,`connection_lost`,`gateway_restarting`,`connection_saturated`,`response_timeout`,`not_configured`,`no_agent`,`agent_restricted`,`send_failed`,`ATTACHMENT_TOO_LARGE`,`ATTACHMENT_REJECTED`]);function O0(e,t){let n=(e??``).trim(),r=t&&E0[t]?t:D0.has(n)?n:lge.test(n)?`context_length`:t??null,i=r===null?null:E0[r]?.()??null,a=(e??``).trim();return{headline:i,detail:a&&a!==r&&!D0.has(a)?a:null,code:r}}var k0=nge;function uge(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 dge(e){return/^agent:(.+?):subagent:/.exec(e.trim())?.[1]?.trim()||void 0}function fge(e){if(!Number.isFinite(e)||e<0)return``;if(e<1e3)return`< 1 s`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r>0?`${n} min ${r} s`:`${n} min`;let i=Math.floor(n/60),a=n%60;return a>0?`${i} h ${String(a).padStart(2,`0`)} min`:`${i} h`}function pge(e){if(!Number.isFinite(e)||e<0)return``;let t=e>0&&e<.01?4:2;return`${e.toFixed(t).replace(`.`,`,`)} $`}function A0(e){return e.moaRole===`moa_aggregator`?cc():e.moaRole===`moa_reference`?Us():ed()}function mge(e){return e.kind===`task`?qc({tool:e.taskName?.trim()||`task`}):e.taskName?.trim()||uge(e.childSessionKey)||zu()}function hge(e){return e.some(e=>e.status===`running`&&e.kind!==`task`)}function gge(e){return e===`running`?`running`:e===`done`?`done`:e===`aborted`?`aborted`:`failed`}function _ge(e){return e!==`running`}function vge(e){return e!==void 0&&e.tone!==`running`&&e.sessionMeta?.cleanup===`delete`}function yge(e){return e.startsWith(`fork:`)}function bge(e){let t=gge(e.status),n=e.sessionMeta?.subagentRole;return{id:e._id,childSessionKey:e.childSessionKey,...e.kind===`task`?{isTask:!0}:{},...n===`moa_reference`||n===`moa_aggregator`?{moaRole:n}:{},taskName:e.taskName?.trim()||void 0,label:mge(e),status:e.status,tone:t,failure:t===`failed`,phase:e.status===`running`?e.phase:void 0,errorMessage:e.errorMessage,errorCode:e.errorCode,resultText:e.resultText,tools:e.tools?.map(e=>({name:e.name,status:e.status,toolCallId:e.toolCallId})),sessionMeta:e.sessionMeta,telemetry:e.telemetry,childAgentId:dge(e.childSessionKey)}}function j0(e){let t=[...e].sort((e,t)=>t.createdAt-e.createdAt).map(bge).sort((e,t)=>{let n=e=>e.moaRole===`moa_aggregator`?0:e.moaRole===`moa_reference`?1:2,r=e=>e.moaRole?e.childSessionKey.replace(/:(ref\d+|aggregate)$/,``):``,i=r(e).localeCompare(r(t));if(e.moaRole&&t.moaRole&&i!==0)return i;let a=n(e),o=n(t);if(a!==o)return a-o;if(a===1){let n=e=>{let t=/ref(\d+)$/.exec(e.childSessionKey);return t?.[1]?Number.parseInt(t[1],10):0};return n(e)-n(t)}return 0});return{cards:t,total:t.length,done:t.filter(e=>e.tone===`done`).length,running:t.filter(e=>e.tone===`running`).length,failed:t.filter(e=>e.tone===`failed`).length,aborted:t.filter(e=>e.tone===`aborted`).length}}function xge(e){if(e.total<=1)return[];let t={done:e.done,running:e.running,failed:e.failed,aborted:e.aborted};return[`done`,`running`,`failed`,`aborted`].filter(e=>t[e]>0).map(e=>({tone:e,count:t[e]}))}function M0(e,t,n){let r=new Set(t);return e.filter(e=>n!==void 0&&e.parentMessageId===n||r.has(e.childSessionKey))}function Sge(e){return e===1?oo({count:e}):Dee({count:e})}var N0=120,Cge=/EXTERNAL_UNTRUSTED_CONTENT|SECURITY\s*NOTICE|UNTRUSTED\s*CONTENT/i,wge=/DO NOT/;function P0(e){return Cge.test(e)||wge.test(e)}function F0(e){return e.length<=N0?e:`${e.slice(0,N0-1)}…`}function Tge(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)&&!P0(e))return e}return null}function I0(e,t){let n=Hc();if(t){let e=E0[t]?.();if(e)return e}if(e==null)return n;let r=e.trim();if(r===``)return n;let i=/([A-Za-z][\w.-]*)\s+failed\s*\(([^)]{1,40})\)/i.exec(r);if(i)return F0(`${i[1]} (${i[2].trim()})`);let a=Tge(r);return a&&!P0(a)?F0(a):n}function Ege(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 Dge(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 L0=(0,z.createContext)(null);function Oge({card:e}){let t=e.tone===`running`?bl():e.tone===`failed`?Zm():zee();return(0,B.jsxs)(`span`,{className:`oc-subpanel__status oc-subpanel__status--${e.tone}`,children:[t,e.tone===`running`?(0,B.jsx)(pb,{size:13,className:`oc-subagent__spin`,"aria-hidden":!0}):e.tone===`failed`?(0,B.jsx)(Py,{size:13,"aria-hidden":!0}):(0,B.jsx)(ky,{size:13,"aria-hidden":!0})]})}function kge(e){if(e)try{return JSON.parse(e)}catch{return}}function Age(e){return{type:e===`error`?`error`:e===`done`?`completed`:`running`}}function R0(e){return e.toolCallId??`name:${e.name}`}function jge({summary:e,parts:t,subAgentRunning:n}){let[r,i]=(0,z.useState)(!1),a=n,o=e.length===1?Vp({count:e.length}):Df({count:e.length}),s=a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(pb,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}),el()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ky,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sr-only`,children:ud()})]}),c=new Map;for(let e of t??[])c.set(e.toolCallId,e);return(0,B.jsxs)(`div`,{className:`oc-toolact`,children:[(0,B.jsx)(sI,{icon:(0,B.jsx)(rx,{size:14}),label:o,trailing:s,open:r,ariaExpanded:r,title:r?Lf():Xp(),onClick:()=>i(!r)}),r?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:e.map((e,t)=>{let r=c.get(R0(e));return(0,B.jsx)(u0,{toolName:e.name,args:r?kge(r.argsText):void 0,argsText:r?.argsText,result:r?.resultText,status:Age(r?.status??e.status),turnSettled:!n},`${R0(e)}-${t}`)})}):null]})}function Mge({meta:e,telemetry:t,childAgentId:n,instanceName:r,parentAgentLabel:i,onExport:a}){let[o,s]=(0,z.useState)(!1),c=!!e&&Object.values(e).some(e=>e!==void 0)||!!t&&Object.values(t).some(e=>e!==void 0)||n!==void 0;if(!c&&!i&&!a)return(0,B.jsx)(`div`,{className:`oc-subpanel__barslot`,"aria-hidden":!0});let l=e?.fastMode===void 0?null:e.fastMode?Sc():Bs();return(0,B.jsxs)(`div`,{className:`oc-subpanel__bar`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__bar-chips`,children:[e?.model?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:e.modelProvider?fm({provider:e.modelProvider}):wm(),children:[(0,B.jsx)(Wy,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.model})]}):null,e?.thinkingLevel?(0,B.jsxs)(`span`,{className:`oc-chip`,title:y(),children:[(0,B.jsx)(Dy,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.thinkingLevel})]}):null,l?(0,B.jsxs)(`span`,{className:`oc-chip`,title:ya(),children:[(0,B.jsx)(ib,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:l})]}):null,e?.context?(0,B.jsxs)(`span`,{className:`oc-chip`,title:e.context===`fork`?zo():Ss(),children:[(0,B.jsx)(qb,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.context})]}):null,i?(0,B.jsxs)(`span`,{className:`oc-chip`,title:vr(),children:[(0,B.jsx)(Ey,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:i})]}):null,a?(0,B.jsxs)(vF,{children:[(0,B.jsx)(yF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-chip oc-chip--btn oc-subpanel__bar-export`,title:Uf(),children:[(0,B.jsx)(Gy,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:nm()}),(0,B.jsx)(Ay,{size:12,className:`oc-chip__chev`,"aria-hidden":!0})]})}),(0,B.jsxs)(bF,{align:`end`,className:`w-44`,children:[(0,B.jsx)(SF,{children:nm()}),(0,B.jsx)(xF,{onClick:()=>a(`md`),children:yh()}),(0,B.jsx)(xF,{onClick:()=>a(`json`),children:Ia()})]})]}):null]}),c?(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__adv-toggle${o?` is-open`:``}`,"aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,B.jsx)(Gb,{size:13,"aria-hidden":!0}),qt(),(0,B.jsx)(My,{size:13,className:`oc-subpanel__adv-chevron`,"aria-hidden":!0})]}):null,o&&c?(0,B.jsx)(Pge,{meta:e??{},telemetry:t,childAgentId:n,instanceName:r}):null]})}function Nge(e){return e===`leaf`?yo():e===`orchestrator`?uee():null}function Pge({meta:e,telemetry:t,childAgentId:n,instanceName:r}){let i=[];e.model&&i.push([wm(),e.model]),e.modelProvider&&i.push([du(),e.modelProvider]);let a=e.agentId??n;a&&i.push([Mn(),a]),r&&i.push([hm(),r]),e.label&&i.push([Et(),e.label]),e.thinkingLevel&&i.push([y(),e.thinkingLevel]),e.fastMode!==void 0&&i.push([ya(),e.fastMode?Sc():Bs()]),e.context&&i.push([Ss(),e.context]),e.lightContext!==void 0&&i.push([$i(),e.lightContext?vi():$r()]),e.runtime&&i.push([pn(),e.runtime]),e.mode&&i.push([ns(),e.mode]),e.cleanup&&i.push([_e(),e.cleanup]),e.sandbox&&i.push([Jee(),e.sandbox]),e.controlScope&&i.push([ac(),e.controlScope]),e.subagentRole&&i.push([Qn(),e.subagentRole]),e.spawnDepth!==void 0&&i.push([Np(),String(e.spawnDepth)]);let o=Nge(e.subagentRole);if(o&&i.push([Ir(),o]),e.sessionId&&i.push([Td(),e.sessionId]),e.gatewayKind&&i.push([La(),e.gatewayKind]),t?.runtimeMs!==void 0){let e=fge(t.runtimeMs);e&&i.push([te(),e])}if(t?.totalTokens!==void 0&&i.push([Hd(),Fhe(t.totalTokens)]),t?.estimatedCostUsd!==void 0){let e=typeof t.totalTokens==`number`&&t.totalTokens>0;if(t.estimatedCostUsd<=0&&e)i.push([Fi(),wc()]);else{let e=pge(t.estimatedCostUsd);e&&i.push([Fi(),e])}}return(0,B.jsx)(`dl`,{className:`oc-subpanel__adv-list`,children:i.map(([e,t])=>(0,B.jsxs)(`div`,{className:`oc-subpanel__adv-row`,children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]},e))})}function z0({chatId:e,childKey:t,onClose:n,parentAgentLabel:r}){let i=I(L.subAgents.listSubAgents,{chatId:e}),a=I(L.agents.getChatAgent,{chatId:e}),o=I(L.messages.getSessionMeta,{chatId:e})?.perTurnRouting===!0?void 0:a?.agent?.instanceName,s=(i??[]).find(e=>e.childSessionKey===t),c=s?j0([s]).cards[0]:void 0,l=s?.taskName?.trim(),u=vge(c),d=yge(t),f=I(L.subAgentReports.myReportedSubAgentIds,{chatId:e}),p=I(L.subAgents.listSubAgentToolParts,{chatId:e,childSessionKey:t}),m=I(L.subAgentInteractions.listSubAgentInteractions,{chatId:e,childSessionKey:t}),h=Ei(L.subAgentInteractions.sendToSubAgent),g=Nt(L.chats.generateUploadUrl),_=Nt(L.uploads.registerUpload),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(!0),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(``),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)([]),[A,ee]=(0,z.useState)(!1),[j,M]=(0,z.useState)(!0),te=(0,z.useRef)(null),N=(0,z.useRef)(null),P=(0,z.useCallback)(async e=>{if(!(!e||e.length===0)){ee(!0);try{for(let t of Array.from(e)){if(O.length>=6)break;let e=await g(),{storageId:n}=await(await fetch(e,{method:`POST`,headers:{"Content-Type":t.type||`application/octet-stream`},body:t})).json();await _({storageId:n}),k(e=>e.length>=6?e:[...e,{storageId:n,filename:t.name,mimeType:t.type||`application/octet-stream`}])}}finally{ee(!1),te.current&&(te.current.value=``)}}},[O.length,g,_]),[ne,re]=(0,z.useState)(null),ie=c?(f??[]).includes(c.id):!1,ae=(0,z.useCallback)(e=>{if(!c)return;let t=p&&p.length>0?p.map(e=>({name:e.name,status:e.status,argsText:e.argsText,resultText:e.resultText})):(c.tools??[]).map(e=>({name:e.name,status:e.status})),n={taskName:l,status:c.status,parentAgentLabel:r,sessionMeta:c.sessionMeta,telemetry:c.telemetry,result:c.resultText,error:c.failure?I0(c.errorMessage,c.errorCode):void 0,tools:t};Dge(Qhe(l,e),e===`md`?ege(n):$he({...n,exportedAt:Date.now()}))},[c,p,l,r]);(0,z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,z.useEffect)(()=>{i!==void 0&&!s&&n()},[i,s,n]);let oe=m&&m.length>0?`${m.length}:${m[m.length-1].status}`:``;(0,z.useEffect)(()=>{if(!oe)return;let e=N.current;e&&e.scrollTo({top:e.scrollHeight,behavior:`smooth`})},[oe]);let se=async()=>{let n=w.trim();if(!(u||d)&&!(!n&&O.length===0||v||A)){y(!0);try{await h({chatId:e,childSessionKey:t,text:n,...O.length>0?{attachments:O.map(e=>({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType}))}:{}}),T(``),k([])}finally{y(!1)}}};return(0,B.jsxs)(`div`,{className:`oc-subpanel`,children:[(0,B.jsxs)(`header`,{className:`oc-subpanel__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__avatar oc-subpanel__back${c?` oc-subpanel__avatar--${c.tone}`:``}`,disabled:!s?.parentMessageId,title:ip(),"aria-label":sm(),onClick:()=>s?.parentMessageId&&Ege(s.parentMessageId),children:(0,B.jsx)(yy,{size:16})}),(0,B.jsxs)(`div`,{className:`oc-subpanel__headmain`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__head-top`,children:[(0,B.jsx)(`span`,{className:`oc-subpanel__kind`,children:c?A0(c):ed()}),(0,B.jsxs)(`div`,{className:`oc-subpanel__head-ctrls`,children:[c?(0,B.jsx)(Oge,{card:c}):null,c&&_ge(c.status)?(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn oc-subpanel__report${ie?` is-on`:``}`,title:ie?$s():hd(),"aria-label":hd(),disabled:ie,onClick:()=>re({subAgentId:c.id,label:c.label}),children:(0,B.jsx)(Qy,{size:15,"aria-hidden":!0})}):null,(0,B.jsx)(Ih,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":yp(),className:`oc-subpanel__close`,children:(0,B.jsx)(xh,{size:16})})]})]}),l?(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__task${E?` is-expanded`:``}`,title:al(),"aria-expanded":E,onClick:()=>D(e=>!e),children:l}):null]})]}),(0,B.jsx)(Mge,{meta:c?.sessionMeta,telemetry:c?.telemetry,childAgentId:c?.childAgentId,instanceName:o,parentAgentLabel:r,onExport:c?ae:void 0}),(0,B.jsx)(`div`,{className:`oc-subpanel__body`,ref:N,children:c?(0,B.jsxs)(B.Fragment,{children:[c.tools&&c.tools.length>0&&j?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Yl()}),(0,B.jsx)(jge,{summary:c.tools,parts:p,subAgentRunning:c.tone===`running`})]}):null,c.failure?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Lm()}),(0,B.jsx)(`p`,{className:`oc-subpanel__error`,children:I0(c.errorMessage,c.errorCode)})]}):null,c.resultText?(0,B.jsxs)(`section`,{className:`oc-subpanel__section oc-subpanel__result${b?` is-open`:``}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__result-toggle`,"aria-expanded":b,onClick:()=>x(!b),children:[(0,B.jsx)(My,{size:13,className:`oc-subpanel__result-chevron`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__section-title`,children:lf()})]}),b?(0,B.jsx)(C1,{text:c.resultText}):null]}):c.tone===`running`?(0,B.jsxs)(`p`,{className:`oc-subpanel__muted oc-subpanel__working`,children:[(0,B.jsx)(pb,{size:14,className:`oc-subagent__spin`,"aria-hidden":!0}),Il()]}):null,m&&m.length>0?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Pe()}),(0,B.jsx)(`div`,{className:`oc-subpanel__thread`,children:m.map(e=>(0,B.jsxs)(`div`,{className:`oc-subpanel__exchange`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--user`,children:[e.userText,e.attachments&&e.attachments.length>0?(0,B.jsx)(`div`,{className:`oc-subpanel__msg-atts`,children:e.attachments.map((t,n)=>(0,B.jsxs)(`span`,{className:`oc-subpanel__attchip oc-subpanel__attchip--sent`,title:t.filename,children:[(0,B.jsx)(kb,{size:11,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:t.filename})]},`${e._id}-att-${n}`))}):null]}),e.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--pending`,children:[(0,B.jsx)(pb,{size:13,className:`oc-actrow__spin`,"aria-hidden":!0}),eo()]}):e.status===`error`?(0,B.jsx)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--err`,children:e.errorMessage??wee()}):(0,B.jsx)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--reply`,children:(0,B.jsx)(C1,{text:e.replyText??``})})]},e._id))})]}):null]}):(0,B.jsx)(`p`,{className:`oc-subpanel__muted`,children:Tu()})}),(0,B.jsx)(`footer`,{className:`oc-subpanel__foot`,children:S?(0,B.jsxs)(`div`,{className:`oc-subpanel__prompt`,children:[O.length>0?(0,B.jsx)(`div`,{className:`oc-subpanel__attstrip`,children:O.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-subpanel__attchip`,title:e.filename,children:[(0,B.jsx)(kb,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:e.filename}),(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__attchip-x`,"aria-label":Iu(),onClick:()=>k(e=>e.filter((e,n)=>n!==t)),children:(0,B.jsx)(xh,{size:11,"aria-hidden":!0})})]},`${e.storageId}-${t}`))}):null,(0,B.jsx)(`textarea`,{className:`oc-subpanel__prompt-input`,rows:2,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),se())},placeholder:bf(),autoFocus:!0}),(0,B.jsxs)(`div`,{className:`oc-subpanel__prompt-bar`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__composer-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__composer-btn`,title:Jm(),"aria-label":Jm(),disabled:A||O.length>=6,onClick:()=>te.current?.click(),children:A?(0,B.jsx)(pb,{size:15,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(Ib,{size:15,"aria-hidden":!0})}),c?.tools&&c.tools.length>0?(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__composer-btn oc-subpanel__composer-btn--label${j?` is-on`:``}`,title:zc(),"aria-pressed":j,onClick:()=>M(e=>!e),children:[(0,B.jsx)(rx,{size:14,"aria-hidden":!0}),Yl()]}):null]}),c?.tone===`running`?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:gl()}):d?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:st()}):u?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:qe()}):(m??[]).some(e=>e.status===`pending`)?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:Ree()}):null,(0,B.jsxs)(Ih,{variant:`default`,size:`sm`,className:`gap-1.5`,disabled:!w.trim()&&O.length===0||v||A||c?.tone===`running`||u||d||(m??[]).some(e=>e.status===`pending`),onClick:()=>void se(),children:[v?(0,B.jsx)(pb,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(Vb,{size:14,"aria-hidden":!0}),mp()]})]}),(0,B.jsx)(`input`,{ref:te,type:`file`,multiple:!0,className:`oc-subpanel__fileinput`,onChange:e=>void P(e.target.files)})]}):(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__interact`,onClick:()=>C(!0),children:[(0,B.jsx)(vb,{size:15,"aria-hidden":!0}),Yu()]})}),(0,B.jsx)(Zhe,{target:ne,onClose:()=>re(null)})]})}var Fge=[`op`,`jobId`,`name`,`enabled`,`schedule`,`message`,`deliveryMode`,`agentId`,`nextRunAtMs`],B0=null,Ige=1,V0=new Set;function H0(){for(let e of[...V0])e()}function U0(e){return V0.add(e),()=>V0.delete(e)}function W0(){return B0}function Lge(e){return B0={pinId:Ige++,kind:e.kind,ownerUserId:e.ownerUserId,originChatId:e.originChatId,originLabel:e.originLabel,params:e.params,pinned:!1},H0(),B0}function G0(e,t){B0===null||B0.pinId!==e||B0.pinned!==t&&(B0={...B0,pinned:t},H0())}function K0(e){B0!==null&&(e!==void 0&&e!==B0.pinId||(B0=null,H0()))}function q0(e,t){B0===null||B0.pinId!==e||(B0={...B0,params:t},H0())}function Rge(e,t){return e===null||e.ownerUserId!==t.userId?`none`:e.pinned||X0(e,t)?`dock`:`none`}function zge(e,t){switch(e){case`sources`:return`sources:${String(t.messageId??``)}`;case`subagent`:return`subagent:${String(t.childKey??``)}`;case`cron`:{let e=t.part??{};return`cron:${JSON.stringify([String(t.instanceName??``),String(t.jobId??``),String(t.occurrenceId??``),Fge.map(t=>e[t]??null)])}`}case`document`:{let e=t.doc??{};return`document:${JSON.stringify([e.filename??null,e.storageId??e.url??null])}`}}}function J0(e,t){return e-420>=t}function Y0(e,t,n){return Math.max(n,Math.min(e,t-420))}function X0(e,t){return e===null||e.ownerUserId!==t.userId?!1:e.originChatId!==null&&e.originChatId===t.chatId}function Bge(e,t){return e===null||e.ownerUserId!==t.userId?!1:!e.pinned&&!X0(e,t)}function Vge(e,t){return X0(e,t)?`keep`:`close`}function Hge(e,t){return X0(e,t)?e:null}function Z0(){let[e,t]=(0,z.useState)(()=>window.innerWidth);return(0,z.useLayoutEffect)(()=>{let e=()=>{let e=document.querySelector(`.oc-workspace`);if(e===null)return;let n=e.querySelector(`.oc-sidebar-col`),r=n===null?0:n.getBoundingClientRect().width,i=e.getBoundingClientRect().width-r;i>0&&t(i)},n=new ResizeObserver(e);n.observe(document.documentElement);let r=new Set,i=()=>{let t=document.querySelector(`.oc-workspace`),i=new Set;if(t!==null){let e=t.querySelector(`.oc-sidebar-col`);e!==null&&i.add(e)}for(let e of r)i.has(e)||n.unobserve(e);for(let e of i)r.has(e)||n.observe(e);r.clear();for(let e of i)r.add(e);e()};i();let a=new MutationObserver(i);return a.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect(),a.disconnect()}},[]),e}var Uge=`oc.sidebar.width`,Q0=`oc.sidebar.collapsed`,$0=200,e2=520,Wge=260,t2=`(max-width: 767px)`;function n2(){let[e,t]=(0,z.useState)(()=>typeof window<`u`&&window.matchMedia(t2).matches);return(0,z.useEffect)(()=>{let e=window.matchMedia(t2),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var r2=new Map;function i2(e,t,n){let r=r2.get(e);if(r!==void 0)for(let e of[...r])e!==n&&e(t)}function a2(e){let{storageKey:t,defaultWidth:n,min:r,max:i,edge:a,maxViewportFraction:o}=e,s=e.fit??(e=>e),c=(0,z.useRef)(s);c.current=s;let l=(0,z.useCallback)(e=>Math.min(i,Math.max(r,e)),[r,i]),[u,d]=(0,z.useState)(()=>l(Number(localStorage.getItem(t))||n)),[f,p]=(0,z.useState)(()=>window.innerWidth);(0,z.useEffect)(()=>{let e=()=>p(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=(0,z.useCallback)(e=>{let t=o===void 0?1/0:Math.round(f*o);return Math.min(Math.max(r,Math.min(i,t)),Math.max(r,e))},[r,i,o,f]),h=(0,z.useRef)(m);h.current=m;let g=(0,z.useRef)(u);g.current=u;let[_,v]=(0,z.useState)(null),y=s(m(_??u)),b=(0,z.useRef)(()=>{});(0,z.useEffect)(()=>{localStorage.setItem(t,String(u)),i2(t,u,b.current)},[t,u]);let x=(0,z.useCallback)(e=>{localStorage.setItem(t,String(e)),i2(t,e,b.current),d(e)},[t]);(0,z.useEffect)(()=>{let e=e=>d(e);b.current=e;let n=r2.get(t)??new Set;return n.add(e),r2.set(t,n),()=>{n.delete(e),n.size===0&&r2.delete(t)}},[t]);let S=(0,z.useRef)(!1),C=(0,z.useRef)(null),w=(0,z.useRef)(null);return(0,z.useEffect)(()=>()=>w.current?.(),[]),{width:y,startResize:(0,z.useCallback)(e=>{if(w.current!==null)return;e.preventDefault(),S.current=!0;let t=e.pointerId,n=e.currentTarget;try{n.setPointerCapture(t)}catch{}let r=e.clientX,i=y,o=!1,s=a===`left`?1:-1,u=i,d=0,f=e=>c.current(h.current(e)),p=()=>{d=0;let e=C.current;if(e){let t=f(u);e.style.width=`${t}px`,e.style.flex=`0 0 ${t}px`}},m=e=>{if(!S.current||e.pointerId!==t)return;let n=l(i+s*(e.clientX-r));f(n)!==f(u)&&(o=!0),u=n,C.current?d===0&&(d=requestAnimationFrame(p)):v(u)},_=e=>{if(e instanceof PointerEvent&&e.pointerId!==t)return;S.current=!1,d!==0&&cancelAnimationFrame(d),v(null),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,_),window.removeEventListener(`pointercancel`,_),window.removeEventListener(`blur`,_),document.removeEventListener(`lostpointercapture`,_);try{n.hasPointerCapture(t)&&n.releasePointerCapture(t)}catch{}w.current=null,document.body.style.cursor=``,document.body.style.userSelect=``;let r=o&&u!==i,a=r?u:g.current,s=C.current;if(s){let e=f(a);s.style.width=`${e}px`,s.style.flex=`0 0 ${e}px`}r&&x(u)};w.current=_,window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,_),window.addEventListener(`pointercancel`,_),window.addEventListener(`blur`,_),document.addEventListener(`lostpointercapture`,_),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[y,a,m,l,x]),setWidth:d,columnRef:C}}function o2(){let{width:e,startResize:t,columnRef:n}=a2({storageKey:Uge,defaultWidth:Wge,min:$0,max:e2,edge:`left`}),[r,i]=(0,z.useState)(()=>localStorage.getItem(Q0)===`1`),a=n2();return(0,z.useEffect)(()=>{localStorage.setItem(Q0,r?`1`:`0`)},[r]),(0,z.useEffect)(()=>{a&&i(!0)},[a]),{width:e,columnRef:n,collapsed:r,toggleCollapsed:(0,z.useCallback)(()=>i(e=>!e),[]),collapse:(0,z.useCallback)(()=>i(!0),[]),startResize:t,isMobile:a,MIN_WIDTH:$0,MAX_WIDTH:e2}}function Gge(e){let t=a2({storageKey:`oc.sources.width`,fit:e(300),defaultWidth:380,min:300,max:680,edge:`right`}),n=a2({storageKey:`oc.subagent.width`,fit:e(320),defaultWidth:460,min:320,max:720,edge:`right`}),r=a2({storageKey:`oc.docviewer.width`,fit:e(380),defaultWidth:560,min:380,max:1800,maxViewportFraction:.72,edge:`right`}),i={...t,min:300},a={...r,min:380};return{sources:i,subagent:{...n,min:320},cron:i,document:a}}function Kge({viewerUserId:e,currentChatId:t}){let n=(0,z.useSyncExternalStore)(U0,W0,W0),r=Nv(),i=n2(),a=Z0(),o=Gge((0,z.useCallback)(e=>t=>Y0(t,a,e),[a])),s={userId:e,chatId:t};(0,z.useEffect)(()=>()=>K0(),[]);let c=Bge(n,s),l=n?.pinId;if((0,z.useEffect)(()=>{c&&l!==void 0&&K0(l)},[c,l]),n===null||Rge(n,s)!==`dock`)return null;let u=n.params,d=()=>K0(n.pinId),{width:f,startResize:p,columnRef:m,min:h}=o[n.kind],g=i||!J0(a,h);if(g&&!n.pinned)return null;let _=Y0(f,a,h);return(0,B.jsx)(W1,{children:(0,B.jsxs)(`aside`,{className:`oc-pinpanel`,ref:m,hidden:g,style:g?{display:`none`}:{width:_,flex:`0 0 ${_}px`},"aria-label":Ft({origin:n.originLabel}),children:[(0,B.jsx)(`div`,{className:`oc-pinpanel__resizer`,onPointerDown:p,role:`separator`,"aria-orientation":`vertical`,"aria-label":Oo()}),(0,B.jsxs)(`div`,{className:`oc-pinpanel__head`,children:[(0,B.jsx)(`span`,{className:`oc-pinpanel__origin`,title:n.originLabel,children:n.originLabel}),(0,B.jsxs)(`span`,{className:`oc-pinpanel__ctrls`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn${n.pinned?` is-on`:``}`,"aria-pressed":n.pinned,title:n.pinned?tn():Ko(),"aria-label":n.pinned?tn():Ko(),onClick:()=>{if(!n.pinned){G0(n.pinId,!0);return}Vge(n,s)===`close`?d():G0(n.pinId,!1)},children:n.pinned?(0,B.jsx)(Pb,{size:14,"aria-hidden":!0}):(0,B.jsx)(Nb,{size:14,"aria-hidden":!0})}),n.originChatId!==null&&!X0(n,s)?(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn`,title:us(),"aria-label":us(),onClick:()=>void r({to:`/chat/$chatId`,params:{chatId:n.originChatId}}),children:(0,B.jsx)(Jy,{size:14,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn`,title:_h(),"aria-label":_h(),onClick:d,children:(0,B.jsx)(xh,{size:14,"aria-hidden":!0})})]})]}),(0,B.jsx)(fI,{onClose:d,children:(0,B.jsx)(`div`,{className:`oc-pinpanel__body`,children:n.kind===`cron`?(0,B.jsx)(dI,{instanceName:u.instanceName,part:u.part,onClose:d}):n.kind===`document`?(0,B.jsx)(L1.Provider,{value:{activeDoc:u.doc,openFor:e=>q0(n.pinId,{...u,doc:e}),openNewerVersion:e=>q0(n.pinId,{...u,doc:e}),close:d},children:(0,B.jsx)(z1,{doc:u.doc,chatId:n.originChatId,onClose:d})}):n.kind===`subagent`?(0,B.jsx)(z0,{chatId:n.originChatId,childKey:u.childKey,onClose:d,parentAgentLabel:u.parentAgentLabel??``}):(0,B.jsx)(i0,{messageId:u.messageId,onClose:d})})},n.pinId)]})})}var s2;function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var c2=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},l2=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(s2=globalThis).__zod_globalConfig??(s2.__zod_globalConfig={});var u2=globalThis.__zod_globalConfig;function d2(e){return e&&Object.assign(u2,e),u2}function f2(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function p2(e,t){return typeof t==`bigint`?t.toString():t}function m2(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function h2(e){return e==null}function g2(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function qge(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var _2=Symbol(`evaluating`);function v2(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==_2)return r===void 0&&(r=_2,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function y2(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function b2(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function x2(e){return JSON.stringify(e)}function Jge(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var S2=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function C2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Yge=m2(()=>{if(u2.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function w2(e){if(C2(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(C2(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function T2(e){return w2(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Xge=new Set([`string`,`number`,`symbol`]);function E2(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function D2(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function O2(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Zge(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Qge={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function $ge(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return D2(e,b2(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return y2(this,`shape`,e),e},checks:[]}))}function e_e(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return D2(e,b2(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return y2(this,`shape`,r),r},checks:[]}))}function t_e(e,t){if(!w2(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return D2(e,b2(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y2(this,`shape`,n),n}}))}function n_e(e,t){if(!w2(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return D2(e,b2(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y2(this,`shape`,n),n}}))}function r_e(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return D2(e,b2(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return y2(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function i_e(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return D2(t,b2(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return y2(this,`shape`,i),i},checks:[]}))}function a_e(e,t,n){return D2(t,b2(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return y2(this,`shape`,i),i}}))}function k2(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function o_e(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function A2(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function j2(e){return typeof e==`string`?e:e?.message}function M2(e,t,n){let r=e.message?e.message:j2(e.inst?._zod.def?.error?.(e))??j2(t?.error?.(e))??j2(n.customError?.(e))??j2(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function N2(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function P2(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var F2=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,p2,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},I2=$(`$ZodError`,F2),L2=$(`$ZodError`,F2,{Parent:Error});function s_e(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function c_e(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var R2=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new c2;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>M2(e,a,d2())));throw S2(t,i?.callee),t}return o.value},z2=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>M2(e,a,d2())));throw S2(t,i?.callee),t}return o.value},B2=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new c2;return a.issues.length?{success:!1,error:new(e??I2)(a.issues.map(e=>M2(e,i,d2())))}:{success:!0,data:a.value}},l_e=B2(L2),V2=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>M2(e,i,d2())))}:{success:!0,data:a.value}},u_e=V2(L2),d_e=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return R2(e)(t,n,i)},f_e=e=>(t,n,r)=>R2(e)(t,n,r),p_e=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return z2(e)(t,n,i)},m_e=e=>async(t,n,r)=>z2(e)(t,n,r),h_e=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return B2(e)(t,n,i)},g_e=e=>(t,n,r)=>B2(e)(t,n,r),__e=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return V2(e)(t,n,i)},v_e=e=>async(t,n,r)=>V2(e)(t,n,r),y_e=/^[cC][0-9a-z]{6,}$/,b_e=/^[0-9a-z]+$/,x_e=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,S_e=/^[0-9a-vA-V]{20}$/,C_e=/^[A-Za-z0-9]{27}$/,w_e=/^[a-zA-Z0-9_-]{21}$/,T_e=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,E_e=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,H2=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,D_e=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,O_e=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function k_e(){return new RegExp(O_e,`u`)}var A_e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,j_e=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,M_e=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,N_e=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,P_e=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,U2=/^[A-Za-z0-9_-]*$/,F_e=/^https?$/,I_e=/^\+[1-9]\d{6,14}$/,W2=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,L_e=RegExp(`^${W2}$`);function G2(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function R_e(e){return RegExp(`^${G2(e)}$`)}function z_e(e){let t=G2({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${W2}T(?:${r})$`)}var B_e=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},V_e=/^-?\d+$/,H_e=/^-?\d+(?:\.\d+)?$/,U_e=/^[^A-Z]*$/,W_e=/^[^a-z]*$/,K2=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),q2={number:`number`,bigint:`bigint`,object:`date`},J2=$(`$ZodCheckLessThan`,(e,t)=>{K2.init(e,t);let n=q2[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Y2=$(`$ZodCheckGreaterThan`,(e,t)=>{K2.init(e,t);let n=q2[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),G_e=$(`$ZodCheckMultipleOf`,(e,t)=>{K2.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):qge(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),K_e=$(`$ZodCheckNumberFormat`,(e,t)=>{K2.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Qge[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=V_e)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),q_e=$(`$ZodCheckMaxLength`,(e,t)=>{var n;K2.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!h2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=N2(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),J_e=$(`$ZodCheckMinLength`,(e,t)=>{var n;K2.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!h2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=N2(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Y_e=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;K2.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!h2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=N2(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),X2=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;K2.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),X_e=$(`$ZodCheckRegex`,(e,t)=>{X2.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Z_e=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=U_e,X2.init(e,t)}),Q_e=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=W_e,X2.init(e,t)}),$_e=$(`$ZodCheckIncludes`,(e,t)=>{K2.init(e,t);let n=E2(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),eve=$(`$ZodCheckStartsWith`,(e,t)=>{K2.init(e,t);let n=RegExp(`^${E2(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),tve=$(`$ZodCheckEndsWith`,(e,t)=>{K2.init(e,t);let n=RegExp(`.*${E2(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),nve=$(`$ZodCheckOverwrite`,(e,t)=>{K2.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),rve=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
241
|
+
`]},t))})]})}function whe({text:e}){let t=(0,z.useMemo)(()=>{try{return{ok:!0,value:JSON.parse(e,(e,t,n)=>{if(typeof t==`number`&&Number.isInteger(t)&&!Number.isSafeInteger(t)&&typeof n?.source==`string`&&/^-?\d+$/.test(n.source))try{return BigInt(n.source)}catch{return t}return t})}}catch{return{ok:!1}}},[e]);return t.ok?(0,B.jsx)(`div`,{className:`oc-docviewer__jsonwrap`,children:(0,B.jsx)(H1,{value:t.value,depth:0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:rc()}),(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e})]})}function The(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 Ehe(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 H1({value:e,depth:t,name:n}){let r=typeof e==`object`&&!!e,i=r?The(e):0,[a,o]=(0,z.useState)(t<2&&i<=100),s=n===void 0?null:(0,B.jsxs)(`span`,{className:`oc-json__key`,children:[n,`: `]});if(!r)return(0,B.jsxs)(`div`,{className:`oc-json__leaf`,children:[s,(0,B.jsx)(`span`,{className:`oc-json__val oc-json__val--${e===null?`null`:typeof e==`bigint`?`number`:typeof e}`,children:typeof e==`bigint`?e.toString():JSON.stringify(e)})]});let c=a?Ehe(e,500):[];return(0,B.jsxs)(`details`,{className:`oc-json__node`,open:a,onToggle:e=>o(e.target.open),children:[(0,B.jsxs)(`summary`,{children:[s,(0,B.jsx)(`span`,{className:`oc-json__summary`,children:Array.isArray(e)?`[${i}]`:`{${i}}`})]}),a?(0,B.jsxs)(`div`,{className:`oc-json__children`,children:[c.map(([e,n])=>(0,B.jsx)(H1,{name:e,value:n,depth:t+1},e)),i>c.length?(0,B.jsx)(`div`,{className:`oc-json__more`,children:Xn({count:i-c.length})}):null]}):null]})}var U1=(0,z.createContext)(null);function Dhe(){return(0,z.useContext)(U1)??{open:()=>{}}}function W1({children:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useCallback)(e=>{n(e),i(!1)},[]),l=(0,z.useCallback)(()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),n(null),o(!1)},[]);(0,z.useEffect)(()=>{if(t===null)return;let e=e=>{e.key===`Escape`&&l()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,l]),(0,z.useEffect)(()=>{let e=()=>o(document.fullscreenElement!==null);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let u=(0,z.useCallback)(()=>{let e=s.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]);return(0,B.jsxs)(U1.Provider,{value:{open:c},children:[e,t===null?null:(0,Fv.createPortal)((0,B.jsxs)(`div`,{ref:s,className:`oc-lightbox`,role:`dialog`,"aria-modal":`true`,"aria-label":t.name,onClick:e=>{e.target===e.currentTarget&&l()},children:[(0,B.jsxs)(`div`,{className:`oc-lightbox__bar`,children:[(0,B.jsx)(`span`,{className:`oc-lightbox__name`,title:t.name,children:t.name}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:()=>i(e=>!e),"aria-label":r?is():ye(),title:r?is():ye(),children:r?(0,B.jsx)(wne,{size:18}):(0,B.jsx)(Cne,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:u,"aria-label":a?za():bh(),title:a?za():bh(),children:a?(0,B.jsx)(Sb,{size:18}):(0,B.jsx)(gb,{size:18})}),(0,B.jsx)(`a`,{className:`oc-lightbox__btn`,href:t.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":zr(),title:zr(),children:(0,B.jsx)(Jy,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:l,"aria-label":Fn(),title:Fn(),children:(0,B.jsx)(xh,{size:18})})]}),(0,B.jsx)(`div`,{className:`oc-lightbox__stage${r?` oc-lightbox__stage--scroll`:``}`,onClick:e=>{e.target===e.currentTarget&&l()},children:(0,B.jsx)(`img`,{src:t.url,alt:t.name,className:r?`oc-lightbox__img--actual`:`oc-lightbox__img--fit`,decoding:`async`})})]}),document.body)]})}function G1({className:e,...t}){return(0,B.jsx)(YO,{"data-slot":`checkbox`,className:Bp(`peer size-4 shrink-0 rounded-[4px] border border-input bg-background ring-offset-background transition-shadow outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground`,e),...t,children:(0,B.jsx)(ZO,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,B.jsx)(Cb,{className:`size-3.5`}):(0,B.jsx)(ky,{className:`size-3.5`})})})}function K1(e,t){return t===`memory`?`memory`:e.context===!0||!e.file_name?`context`:`document`}function q1(e){let t={memory:0,documents:0,context:0};for(let n of e)for(let e of n.items){let r=K1(e,n.group);r===`memory`?t.memory+=1:r===`document`?t.documents+=1:t.context+=1}return t}function Ohe(e){return e.memory+e.documents+e.context>0}function J1(e){let t=[];return e.memory>0&&t.push(e.memory===1?Ne():$a({count:e.memory})),e.documents>0&&t.push(e.documents===1?Cee():hl({count:e.documents})),e.context>0&&t.push(e.context===1?Fu():Ju({count:e.context})),t.join(` · `)}function Y1(e){return e.title??e.file_name??e.id??e.type??bu()}function X1(e){return e.title&&e.file_name?e.file_name:void 0}function khe(e){return e.file_name??Y1(e)}function Z1(e){let t=[];return e.type&&Y1(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(pp({score:e.score.toFixed(2)})),t}function Q1(e,t){let n=[];return e.forEach((e,r)=>{e.group===t&&e.items.forEach((t,i)=>{n.push({key:`${e.pluginId}|${e.group}|${t.id??t.file_name??`?`}|${r}.${i}`,group:e.group,pluginId:e.pluginId,source:e.source,item:t})})}),n.sort((e,t)=>(t.item.score??0)-(e.item.score??0))}function $1(e,t){let n=t.trim().toLowerCase();return n===``?!0:[n0(e),e.item.file_name??``,e.item.text??``,...Z1(e.item)].join(` `).toLowerCase().includes(n)}function e0(e){return K1(e.item,e.group)===`document`}function t0(e){return K1(e.item,e.group)===`context`}function n0(e){return t0(e)?yf():Y1(e.item)}var r0=(0,z.createContext)(null),Ahe=[];function jhe(){let e=U(e=>e.metadata?.custom?.provenanceParts??Ahe),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.attachedDocCount??0),r=(0,z.useContext)(r0),i=q1(e);if(e.length===0||!Ohe(i))return null;let a=r?.activeMessageId===t&&t!==void 0,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-actrow__counts`,children:J1(i)}),n>0?(0,B.jsxs)(`span`,{className:`oc-actrow__badge`,title:Yp({count:n}),children:[(0,B.jsx)(Gy,{size:12,"aria-hidden":!0}),n]}):null]});return(0,B.jsx)(cI,{icon:(0,B.jsx)(Zy,{size:14}),label:lee(),trailing:o,active:a,ariaExpanded:a,ariaHasPopup:!0,ariaLabel:jm(),onClick:()=>t&&r?.openFor(t)})}function i0({messageId:e,onClose:t}){let n=I(L.messages.getProvenanceParts,{messageId:e}),r=(0,z.useMemo)(()=>n??[],[n]),i=I(L.agents.documentaryAvailable,{}),a=I(L.documentAttachments.getDocumentAttachments,{sourceMessageId:e}),o=Nt(L.documentAttachments.attachDocuments),s=JF(),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of a??[])e.set(t.entryKey,t);return e},[a]),l=(a??[]).some(e=>e.status===`pending`),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(new Set);(0,z.useEffect)(()=>{f(``),m(!1),g(!1),v(!1),b(new Set)},[e]);let x=(0,z.useMemo)(()=>Q1(r,`documents`).filter(e=>e0(e)&&$1(e,d)),[r,d]),S=(0,z.useMemo)(()=>Q1(r,`documents`).filter(e=>t0(e)&&$1(e,d)),[r,d]),C=(0,z.useMemo)(()=>Q1(r,`memory`).filter(e=>$1(e,d)),[r,d]),w=q1(r),T=e=>b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),E=(e,t)=>b(n=>{let r=new Set(n);for(let n of e)t?r.add(n):r.delete(n);return r}),D=(0,z.useMemo)(()=>Q1(r,`documents`).filter(e=>e0(e)&&y.has(e.key)),[r,y]),O=i!=null&&D.length>0&&!l;async function k(){if(O)try{await o({sourceMessageId:e,items:D.map(e=>({entryKey:e.key,reference:khe(e.item)}))}),s.success(u())}catch(e){let t=qF(e);t.includes(`fetch_in_flight`)?s.error(iu()):t.includes(`no_documentary_agent`)?s.error(_m()):s.error(la(),e)}}let A=n===void 0;return(0,B.jsxs)(`div`,{className:`oc-sources-panel`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__head`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__heading`,children:[(0,B.jsx)(`h2`,{className:`oc-sources-panel__title`,children:Wl()}),(0,B.jsx)(`p`,{className:`oc-sources-panel__sub`,children:J1(w)})]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,onClick:t,"aria-label":or(),title:or(),children:(0,B.jsx)(xh,{size:16,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-sources-panel__search`,children:[(0,B.jsx)(Bb,{size:15,"aria-hidden":!0}),(0,B.jsx)(EF,{value:d,onChange:e=>f(e.target.value),placeholder:nf(),"aria-label":nf()})]}),(0,B.jsx)(`div`,{className:`oc-sources-panel__body`,children:A?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:(0,B.jsx)(pb,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(a0,{icon:(0,B.jsx)(Zy,{size:14,"aria-hidden":!0}),label:qm(),count:x.length,expanded:p,onToggle:()=>m(e=>!e),entries:x,selectable:!0,selected:y,onToggle1:T,onToggleAll:e=>E(x.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(a0,{icon:(0,B.jsx)(Eb,{size:14,"aria-hidden":!0}),label:Rc(),count:S.length,expanded:h,onToggle:()=>g(e=>!e),entries:S,selectable:!1,selected:y,onToggle1:T,onToggleAll:e=>E(S.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(a0,{icon:(0,B.jsx)(Dy,{size:14,"aria-hidden":!0}),label:Lee(),count:C.length,expanded:_,onToggle:()=>v(e=>!e),entries:C,selectable:!1,selected:y,onToggle1:T,onToggleAll:e=>E(C.map(e=>e.key),e),attachmentByKey:c}),x.length===0&&S.length===0&&C.length===0?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:Al()}):null]})}),D.length>0?(0,B.jsxs)(`div`,{className:`oc-sources-panel__actions`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__actrow`,children:[(0,B.jsx)(`span`,{className:`oc-sources-panel__selcount`,children:Qf({count:D.length})}),(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,disabled:!O,onClick:()=>void k(),children:[l?(0,B.jsx)(pb,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,B.jsx)(Kb,{size:14,"aria-hidden":!0}),$c()]})]}),(0,B.jsx)(`p`,{className:`oc-sources-panel__acthint`,children:i==null?_m():l?iu():ld()})]}):null]})}function a0({icon:e,label:t,count:n,expanded:r,onToggle:i,entries:a,selectable:o,selected:s,onToggle1:c,onToggleAll:l,attachmentByKey:u}){if(n===0)return null;let d=a.every(e=>s.has(e.key));return(0,B.jsxs)(`section`,{className:`oc-srcsec${r?` is-open`:``}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-srcsec__head`,"aria-expanded":r,onClick:i,children:[r?(0,B.jsx)(Ay,{size:14,"aria-hidden":!0}):(0,B.jsx)(My,{size:14,"aria-hidden":!0}),e,(0,B.jsx)(`span`,{className:`oc-srcsec__label`,children:t}),(0,B.jsx)(`span`,{className:`oc-srcsec__count`,children:n})]}),r?(0,B.jsxs)(`div`,{className:`oc-srcsec__body`,children:[o?(0,B.jsxs)(`label`,{className:`oc-srcsec__all`,children:[(0,B.jsx)(G1,{checked:d,onCheckedChange:e=>l(e===!0)}),(0,B.jsx)(`span`,{children:oee()})]}):null,a.map(e=>(0,B.jsx)(Mhe,{entry:e,selectable:o,selected:s.has(e.key),onToggle:()=>c(e.key),attachment:u.get(e.key)},e.key))]}):null]})}function Mhe({entry:e,selectable:t,selected:n,onToggle:r,attachment:i}){let[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(!1),{item:u}=e;(0,z.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight+1);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[u.text]);let d=Z1(u),f=typeof u.score==`number`?Math.max(0,Math.min(1,u.score)):null,p=e0(e);return(0,B.jsxs)(`div`,{className:`oc-srccard${t&&n?` is-selected`:``}`,children:[t?(0,B.jsx)(`label`,{className:`oc-srccard__pick`,children:(0,B.jsx)(G1,{checked:n,onCheckedChange:r})}):null,(0,B.jsxs)(`div`,{className:`oc-srccard__body`,children:[(0,B.jsx)(`div`,{className:`oc-srccard__title`,children:n0(e)}),p&&X1(e.item)?(0,B.jsx)(`div`,{className:`oc-srccard__subid`,title:X1(e.item),children:X1(e.item)}):null,d.length>0||f!==null?(0,B.jsxs)(`div`,{className:`oc-srccard__meta`,children:[d.map(e=>(0,B.jsx)(`span`,{className:`oc-srccard__chip`,children:e},e)),f===null?null:(0,B.jsx)(`span`,{className:`oc-srccard__relev`,title:pp({score:f.toFixed(2)}),children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-track`,"aria-hidden":!0,children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-fill`,style:{width:`${Math.round(f*100)}%`}})})})]}):null,u.text?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`blockquote`,{ref:s,className:`oc-srccard__excerpt${a?` is-full`:``}`,children:u.text}),c||a?(0,B.jsx)(`button`,{type:`button`,className:`oc-srccard__more`,onClick:()=>o(e=>!e),children:a?xp():Bn()}):null]}):null,p?(0,B.jsx)(Nhe,{attachment:i}):null]})]})}function Nhe({attachment:e}){if(e?.status===`ready`&&e.url){let t=e.filename??As();return(0,B.jsxs)(`a`,{className:`oc-srccard__origin oc-srccard__origin--ready`,href:e.url,download:e.filename??void 0,target:`_blank`,rel:`noreferrer`,title:As(),children:[(0,B.jsx)(Gy,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-srccard__origin-name`,children:t})]})}return e?.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--pending`,children:[(0,B.jsx)(pb,{size:13,"aria-hidden":!0}),fc()]}):e?.status===`not_found`||e?.status===`failed`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--missing`,"aria-disabled":!0,children:[(0,B.jsx)(xh,{size:13,"aria-hidden":!0}),qs()]}):(0,B.jsxs)(`div`,{className:`oc-srccard__origin`,"aria-disabled":!0,children:[(0,B.jsx)(Gy,{size:13,"aria-hidden":!0}),If()]})}function o0(e,t){return new Date(e).toLocaleString(Jd(),t)}function Phe(e){return new Date(e).toLocaleDateString(Jd())}function s0(e){return new Date(e).toLocaleTimeString(Jd())}function Fhe(e){return e.toLocaleString(Jd())}function c0(e){if(!Number.isFinite(e)||e<0)return null;if(e<1e3)return`< 1 s`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r===0?`${n} min`:`${n} min ${String(r).padStart(2,`0`)} s`;let i=Math.floor(n/60),a=n%60;return a===0?`${i} h`:`${i} h ${String(a).padStart(2,`0`)} min`}var Ihe=new Set([`status`,`exitCode`,`durationMs`]);function Lhe(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Rhe(e){if(typeof e==`string`)return{kind:`text`,text:e};if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e,n=Object.keys(t);if(typeof t.exitCode==`number`&&n.every(e=>Ihe.has(e)))return{kind:`outcome`,status:typeof t.status==`string`?t.status:null,exitCode:t.exitCode,durationMs:typeof t.durationMs==`number`?t.durationMs:null}}return{kind:`json`,text:Lhe(e)}}function zhe(e){let t=[(e.exitCode===null?e.status===`completed`:e.exitCode===0)?lm():Zl()];return e.exitCode!==null&&t.push(v({code:e.exitCode})),e.durationMs!==null&&t.push(va({ms:e.durationMs})),t.join(` · `)}var Bhe=new Set([`complete`,`error`,`aborted`]),Vhe=new Set([`completed`,`error`]);function Hhe(e,t){if(e.length===0)return!1;if(t===`streaming`)return!0;if(t!==void 0&&Bhe.has(t))return!1;let n=e[e.length-1];return n.phase!==void 0&&Vhe.has(n.phase)?!1:n.result===void 0||n.result===null}var Uhe=[`command`,`query`,`url`,`path`,`pattern`,`file`,`cmd`,`prompt`];function Whe(e,t){let n=``;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of Uhe){let r=t[e];if(typeof r==`string`&&r.trim()){n=r;break}}}return n||=t??(typeof e==`string`?e:``),n.replace(/\s+/g,` `).trim()}function Ghe(e,t){let n=e.length,r=n===1?Vp({count:n}):Df({count:n});return{count:n,running:Hhe(e,t),label:r}}function l0({text:e}){let[t,n]=(0,z.useState)(!1);return(0,B.jsx)(`button`,{type:`button`,className:`oc-copybtn`,title:hf(),"aria-label":up(),onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{n(!0),window.setTimeout(()=>n(!1),1200)})},children:t?(0,B.jsx)(ky,{size:13,"aria-hidden":!0}):(0,B.jsx)(Vy,{size:13,"aria-hidden":!0})})}function Khe(e,t,n){let r=typeof e==`string`?e:void 0;return r===`error`?`error`:t||r===`completed`||n?`completed`:`running`}function qhe(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function u0({toolName:e,args:t,argsText:n,result:r,status:i,turnSettled:a}){let o=r!=null,s=Khe(i?.type,o,a),c=n??qhe(t),l=Whe(t,n),u=o?Rhe(r):null,d=s===`running`?pb:s===`error`?Py:Iy;return(0,B.jsxs)(`details`,{className:`oc-tool oc-tool--${s}`,children:[(0,B.jsxs)(`summary`,{className:`oc-tool__header`,children:[(0,B.jsx)(d,{className:`oc-tool__status${s===`running`?` oc-tool__status--spin`:``}`,size:14,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-tool__name`,children:e}),l?(0,B.jsx)(`span`,{className:`oc-tool__preview`,title:l,children:l}):null,(0,B.jsx)(`span`,{className:`oc-tool__phase`,children:s}),(0,B.jsx)(My,{size:15,className:`oc-tool__chevron`,"aria-hidden":!0})]}),(0,B.jsxs)(`div`,{className:`oc-tool__body`,children:[c?(0,B.jsxs)(`details`,{className:`oc-tool__io`,children:[(0,B.jsx)(`summary`,{children:`input`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:c}),(0,B.jsx)(l0,{text:c})]})]}):null,u&&u.kind===`outcome`?(0,B.jsxs)(`div`,{className:`oc-tool__outcome`,children:[(0,B.jsx)(`span`,{className:`oc-tool__outcome-label`,children:zhe(u)}),(0,B.jsx)(`span`,{className:`oc-tool__outcome-note`,children:xc()})]}):u?(0,B.jsxs)(`details`,{className:`oc-tool__io`,open:!0,children:[(0,B.jsx)(`summary`,{children:`output`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:u.text}),(0,B.jsx)(l0,{text:u.text})]})]}):null]})]})}function d0({...e}){return(0,B.jsx)(Th,{"data-slot":`dialog`,...e})}function Jhe({...e}){return(0,B.jsx)(Sh,{"data-slot":`dialog-portal`,...e})}function Yhe({className:e,...t}){return(0,B.jsx)(Ch,{"data-slot":`dialog-overlay`,className:Bp(`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 f0({className:e,children:t,showCloseButton:n=!0,...r}){return(0,B.jsxs)(Jhe,{children:[(0,B.jsx)(Yhe,{}),(0,B.jsxs)(wh,{"data-slot":`dialog-content`,className:Bp(`fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover bg-clip-padding p-5 text-sm text-popover-foreground shadow-lg duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,B.jsx)(Oh,{"data-slot":`dialog-close`,asChild:!0,children:(0,B.jsxs)(Ih,{variant:`ghost`,size:`icon-sm`,className:`absolute top-3 right-3`,children:[(0,B.jsx)(xh,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:Fc()})]})})]})]})}function p0({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:Bp(`flex flex-col gap-1.5 pr-6`,e),...t})}function m0({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-footer`,className:Bp(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function h0({className:e,...t}){return(0,B.jsx)(Dh,{"data-slot":`dialog-title`,className:Bp(`text-base font-medium text-foreground`,e),...t})}function g0({className:e,...t}){return(0,B.jsx)(Eh,{"data-slot":`dialog-description`,className:Bp(`text-sm text-muted-foreground`,e),...t})}function _0(e){return(0,B.jsx)(CM,{"data-slot":`select`,...e})}function v0(e){return(0,B.jsx)(DM,{"data-slot":`select-value`,...e})}function y0({className:e,size:t=`default`,children:n,...r}){return(0,B.jsxs)(TM,{"data-slot":`select-trigger`,"data-size":t,className:Bp(`flex w-fit items-center justify-between gap-2 rounded-lg border border-input bg-background px-2.5 py-1 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,B.jsx)(kM,{asChild:!0,children:(0,B.jsx)(Ay,{className:`size-4 opacity-50`})})]})}function b0({className:e,children:t,position:n=`popper`,...r}){return(0,B.jsx)(NM,{children:(0,B.jsxs)(FM,{"data-slot":`select-content`,className:Bp(`relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,B.jsx)(lN,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(Ny,{className:`size-4`})}),(0,B.jsx)(XM,{className:Bp(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,B.jsx)(dN,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(Ay,{className:`size-4`})})]})})}function x0({className:e,children:t,...n}){return(0,B.jsxs)(rN,{"data-slot":`select-item`,className:Bp(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(sN,{children:(0,B.jsx)(ky,{className:`size-4`})})}),(0,B.jsx)(aN,{children:t})]})}var S0=1e3;function Xhe(){return[{id:`hung`,label:sn()},{id:`wrong_result`,label:Xo()},{id:`error`,label:de()},{id:`other`,label:Wee()}]}function Zhe({target:e,onClose:t}){let n=Nt(L.subAgentReports.createSubAgentReport),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1);(0,z.useEffect)(()=>{e&&(i(``),o(``),c(!1),u(!1))},[e]);function d(e){e||t()}async function f(){if(!(!e||s)){c(!0);try{await n({subAgentId:e.subAgentId,category:r||void 0,comment:a.trim()||void 0}),u(!0)}catch{c(!1)}}}return(0,B.jsx)(d0,{open:e!==null,onOpenChange:d,children:e?(0,B.jsxs)(f0,{className:`sm:max-w-md`,children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:Kn()}),(0,B.jsx)(g0,{children:l?fr():Dp({label:e.label})})]}),l?(0,B.jsx)(`div`,{className:`oc-feedback__result`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-ok`,children:Vt()})}):(0,B.jsxs)(`div`,{className:`oc-feedback__form`,children:[(0,B.jsx)(`label`,{className:`oc-feedback__label`,children:gs()}),(0,B.jsxs)(_0,{value:r,onValueChange:i,children:[(0,B.jsx)(y0,{children:(0,B.jsx)(v0,{placeholder:No()})}),(0,B.jsx)(b0,{children:Xhe().map(e=>(0,B.jsx)(x0,{value:e.id,children:e.label},e.id))})]}),(0,B.jsx)(`label`,{className:`oc-feedback__label`,htmlFor:`oc-subagentreport-comment`,children:ja()}),(0,B.jsx)(`textarea`,{id:`oc-subagentreport-comment`,className:`oc-feedback__textarea`,placeholder:Ar(),value:a,maxLength:S0,onChange:e=>o(e.target.value.slice(0,S0)),rows:4}),(0,B.jsxs)(`div`,{className:`oc-feedback__count`,children:[a.length,`/`,S0]})]}),(0,B.jsx)(m0,{children:l?(0,B.jsx)(Ih,{onClick:()=>d(!1),children:pi()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ih,{variant:`outline`,onClick:()=>d(!1),children:En()}),(0,B.jsx)(Ih,{onClick:()=>void f(),disabled:s,children:s?Ji():bt()})]})})]}):null})}function Qhe(e,t=`md`){let n=(e??``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40);return`sous-agent${n?`-${n}`:``}.${t}`}function $he(e){return JSON.stringify({kind:`sub-agent`,taskName:e.taskName??null,status:e.status,exportedAt:new Date(e.exportedAt).toISOString(),parentAgent:e.parentAgentLabel??null,config:e.sessionMeta??null,telemetry:e.telemetry??null,tools:e.tools.map(e=>({name:e.name,status:e.status,input:e.argsText??null,output:e.resultText??null})),result:e.result??null,error:e.error??null},null,2)}function ege(e){let t=[],n=e.taskName?.trim()||ed();t.push(`# ${ed()} — ${n}`,``);let r=[];e.parentAgentLabel&&r.push(`- ${vr()} : ${e.parentAgentLabel}`);let i=e.sessionMeta;if(i?.model&&r.push(`- ${wm()} : ${i.model}${i.modelProvider?` (${i.modelProvider})`:``}`),i?.thinkingLevel&&r.push(`- ${y()} : ${i.thinkingLevel}`),i?.fastMode!==void 0&&r.push(`- ${ya()} : ${i.fastMode?Sc():Bs()}`),i?.controlScope&&r.push(`- ${ac()} : ${i.controlScope}`),i?.subagentRole&&r.push(`- ${Qn()} : ${i.subagentRole}`),i?.spawnDepth!==void 0&&r.push(`- ${Np()} : ${i.spawnDepth}`),r.length&&t.push(...r,``),e.tools.length>0){t.push(`## ${Yl()} (${e.tools.length})`,``);for(let n of e.tools)t.push(`### ${n.name} — ${n.status}`,``),n.argsText&&t.push(`**Input**`,``,"```",n.argsText,"```",``),n.resultText&&t.push(`**Output**`,``,"```",n.resultText,"```",``)}return e.error&&t.push(`## ${Lm()}`,``,e.error,``),e.result&&t.push(`## ${lf()}`,``,e.result,``),`${t.join(`
|
|
242
|
+
`).trim()}\n`}function tge(e,t,n=!1){if(e===void 0)return`thinking`;switch(e){case`streaming`:return t?`generating`:`thinking`;case`error`:return`error`;case`aborted`:return`aborted`;default:return n?`aborted`:null}}function nge(e){return e?e.some(e=>e?.type===`text`&&typeof e.text==`string`&&e.text.trim().length>0):!1}var rge={thinking:rh,generating:Nc,error:Fo,aborted:_f},C0={processing_history:Oe,compacting:Ja,querying_gateway:vee,awaiting_subagents:ul,post_processing:Mee,awaiting_approval:Hm},ige=[[`read`,/^(read|read_file|cat|open|view|notebook_read)$/i],[`exec`,/^(exec|bash|shell|run|command|terminal)$/i],[`search`,/^(web_search|search|grep|find|glob|rg)$/i],[`fetch`,/^(web_fetch|fetch|browser|http_get)$/i],[`write`,/^(write|write_file|apply_patch|edit|str_replace|notebook_edit)$/i]];function w0(e){for(let[t,n]of ige)if(n.test(e))return t;return`other`}var age={read:()=>Au(),exec:()=>Uu(),search:()=>mf(),fetch:()=>lp(),write:()=>gu(),other:e=>Vl({tool:e})};function T0(e){if(!e||e.length===0)return null;let t=e=>e.toolCallId??e.toolName,n=new Set;for(let r=e.length-1;r>=0;r--){let i=e[r],a=i.phase??`completed`;if(a===`completed`||a===`error`){n.add(t(i));continue}if((a===`start`||a===`started`||a===`running`)&&!n.has(t(i)))return{name:i.toolName,family:w0(i.toolName)}}return null}function oge(e,t,n,r,i){let a=tge(e,t,i??!1);if(a===null)return null;if(a===`thinking`||a===`generating`){if(r)return{kind:a,label:age[r.family](r.name),phased:!0};if(n&&C0[n])return{kind:a,label:C0[n](),phased:!0}}return{kind:a,label:rge[a]()}}function sge(e,t){return!t||e!==`thinking`&&e!==`generating`?null:mo()}var cge=new Set([`context_length`,`context_length_compacted`,`context_length_presend`]),E0={context_length:Mr,context_length_compacted:On,context_length_presend:St,rate_limit:Ic,timeout:Nu,refusal:Ku,stream_orphaned:ln,connection_lost:Qo,gateway_restarting:pe,connection_saturated:vh,GATEWAY_RESTARTING:pe,CONNECTION_SATURATED:vh,response_timeout:Na,compaction_timeout:Ge,empty_response:at,msgtool_args_unreadable:go,awaiting_approval:oh,empty_response_silent:je,provider_internal:Za,session_init_conflict:Fee,session_write_conflict:Gm,not_configured:Lc,no_agent:Pu,agent_restricted:qu,send_failed:vf,DISPATCH_STALLED:yl,ATTACHMENT_TOO_LARGE:fp,ATTACHMENT_REJECTED:yu},lge=/context overflow|prompt too large|maximum context length|context[- ]length exceeded|request_too_large|request too large|input (?:token count )?exceeds the maximum number of (?:input )?tokens|input is too long for the model|too many tokens/i,D0=new Set([`stream_orphaned`,`connection_lost`,`gateway_restarting`,`connection_saturated`,`response_timeout`,`not_configured`,`no_agent`,`agent_restricted`,`send_failed`,`ATTACHMENT_TOO_LARGE`,`ATTACHMENT_REJECTED`]);function O0(e,t){let n=(e??``).trim(),r=t&&E0[t]?t:D0.has(n)?n:lge.test(n)?`context_length`:t??null,i=r===null?null:E0[r]?.()??null,a=(e??``).trim();return{headline:i,detail:a&&a!==r&&!D0.has(a)?a:null,code:r}}var k0=nge;function uge(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 dge(e){return/^agent:(.+?):subagent:/.exec(e.trim())?.[1]?.trim()||void 0}function fge(e){if(!Number.isFinite(e)||e<0)return``;if(e<1e3)return`< 1 s`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r>0?`${n} min ${r} s`:`${n} min`;let i=Math.floor(n/60),a=n%60;return a>0?`${i} h ${String(a).padStart(2,`0`)} min`:`${i} h`}function pge(e){if(!Number.isFinite(e)||e<0)return``;let t=e>0&&e<.01?4:2;return`${e.toFixed(t).replace(`.`,`,`)} $`}function A0(e){return e.moaRole===`moa_aggregator`?cc():e.moaRole===`moa_reference`?Us():ed()}function mge(e){return e.kind===`task`?qc({tool:e.taskName?.trim()||`task`}):e.taskName?.trim()||uge(e.childSessionKey)||zu()}function hge(e){return e.some(e=>e.status===`running`&&e.kind!==`task`)}function gge(e){return e===`running`?`running`:e===`done`?`done`:e===`aborted`?`aborted`:`failed`}function _ge(e){return e!==`running`}function vge(e){return e!==void 0&&e.tone!==`running`&&e.sessionMeta?.cleanup===`delete`}function yge(e){return e.startsWith(`fork:`)}function bge(e){let t=gge(e.status),n=e.sessionMeta?.subagentRole;return{id:e._id,childSessionKey:e.childSessionKey,...e.kind===`task`?{isTask:!0}:{},...n===`moa_reference`||n===`moa_aggregator`?{moaRole:n}:{},taskName:e.taskName?.trim()||void 0,label:mge(e),status:e.status,tone:t,failure:t===`failed`,phase:e.status===`running`?e.phase:void 0,errorMessage:e.errorMessage,errorCode:e.errorCode,resultText:e.resultText,tools:e.tools?.map(e=>({name:e.name,status:e.status,toolCallId:e.toolCallId})),sessionMeta:e.sessionMeta,telemetry:e.telemetry,childAgentId:dge(e.childSessionKey)}}function j0(e){let t=[...e].sort((e,t)=>t.createdAt-e.createdAt).map(bge).sort((e,t)=>{let n=e=>e.moaRole===`moa_aggregator`?0:e.moaRole===`moa_reference`?1:2,r=e=>e.moaRole?e.childSessionKey.replace(/:(ref\d+|aggregate)$/,``):``,i=r(e).localeCompare(r(t));if(e.moaRole&&t.moaRole&&i!==0)return i;let a=n(e),o=n(t);if(a!==o)return a-o;if(a===1){let n=e=>{let t=/ref(\d+)$/.exec(e.childSessionKey);return t?.[1]?Number.parseInt(t[1],10):0};return n(e)-n(t)}return 0});return{cards:t,total:t.length,done:t.filter(e=>e.tone===`done`).length,running:t.filter(e=>e.tone===`running`).length,failed:t.filter(e=>e.tone===`failed`).length,aborted:t.filter(e=>e.tone===`aborted`).length}}function xge(e){if(e.total<=1)return[];let t={done:e.done,running:e.running,failed:e.failed,aborted:e.aborted};return[`done`,`running`,`failed`,`aborted`].filter(e=>t[e]>0).map(e=>({tone:e,count:t[e]}))}function M0(e,t,n){let r=new Set(t);return e.filter(e=>n!==void 0&&e.parentMessageId===n||r.has(e.childSessionKey))}function Sge(e){return e===1?oo({count:e}):Dee({count:e})}var N0=120,Cge=/EXTERNAL_UNTRUSTED_CONTENT|SECURITY\s*NOTICE|UNTRUSTED\s*CONTENT/i,wge=/DO NOT/;function P0(e){return Cge.test(e)||wge.test(e)}function F0(e){return e.length<=N0?e:`${e.slice(0,N0-1)}…`}function Tge(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)&&!P0(e))return e}return null}function I0(e,t){let n=Hc();if(t){let e=E0[t]?.();if(e)return e}if(e==null)return n;let r=e.trim();if(r===``)return n;let i=/([A-Za-z][\w.-]*)\s+failed\s*\(([^)]{1,40})\)/i.exec(r);if(i)return F0(`${i[1]} (${i[2].trim()})`);let a=Tge(r);return a&&!P0(a)?F0(a):n}function Ege(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 Dge(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 L0=(0,z.createContext)(null);function Oge({card:e}){let t=e.tone===`running`?bl():e.tone===`failed`?Zm():zee();return(0,B.jsxs)(`span`,{className:`oc-subpanel__status oc-subpanel__status--${e.tone}`,children:[t,e.tone===`running`?(0,B.jsx)(pb,{size:13,className:`oc-subagent__spin`,"aria-hidden":!0}):e.tone===`failed`?(0,B.jsx)(Py,{size:13,"aria-hidden":!0}):(0,B.jsx)(ky,{size:13,"aria-hidden":!0})]})}function kge(e){if(e)try{return JSON.parse(e)}catch{return}}function Age(e){return{type:e===`error`?`error`:e===`done`?`completed`:`running`}}function R0(e){return e.toolCallId??`name:${e.name}`}function jge({summary:e,parts:t,subAgentRunning:n}){let[r,i]=(0,z.useState)(!1),a=n,o=e.length===1?Vp({count:e.length}):Df({count:e.length}),s=a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(pb,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}),el()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ky,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sr-only`,children:ud()})]}),c=new Map;for(let e of t??[])c.set(e.toolCallId,e);return(0,B.jsxs)(`div`,{className:`oc-toolact`,children:[(0,B.jsx)(cI,{icon:(0,B.jsx)(rx,{size:14}),label:o,trailing:s,open:r,ariaExpanded:r,title:r?Lf():Xp(),onClick:()=>i(!r)}),r?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:e.map((e,t)=>{let r=c.get(R0(e));return(0,B.jsx)(u0,{toolName:e.name,args:r?kge(r.argsText):void 0,argsText:r?.argsText,result:r?.resultText,status:Age(r?.status??e.status),turnSettled:!n},`${R0(e)}-${t}`)})}):null]})}function Mge({meta:e,telemetry:t,childAgentId:n,instanceName:r,parentAgentLabel:i,onExport:a}){let[o,s]=(0,z.useState)(!1),c=!!e&&Object.values(e).some(e=>e!==void 0)||!!t&&Object.values(t).some(e=>e!==void 0)||n!==void 0;if(!c&&!i&&!a)return(0,B.jsx)(`div`,{className:`oc-subpanel__barslot`,"aria-hidden":!0});let l=e?.fastMode===void 0?null:e.fastMode?Sc():Bs();return(0,B.jsxs)(`div`,{className:`oc-subpanel__bar`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__bar-chips`,children:[e?.model?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:e.modelProvider?fm({provider:e.modelProvider}):wm(),children:[(0,B.jsx)(Wy,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.model})]}):null,e?.thinkingLevel?(0,B.jsxs)(`span`,{className:`oc-chip`,title:y(),children:[(0,B.jsx)(Dy,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.thinkingLevel})]}):null,l?(0,B.jsxs)(`span`,{className:`oc-chip`,title:ya(),children:[(0,B.jsx)(ib,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:l})]}):null,e?.context?(0,B.jsxs)(`span`,{className:`oc-chip`,title:e.context===`fork`?zo():Ss(),children:[(0,B.jsx)(qb,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.context})]}):null,i?(0,B.jsxs)(`span`,{className:`oc-chip`,title:vr(),children:[(0,B.jsx)(Ey,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:i})]}):null,a?(0,B.jsxs)(yF,{children:[(0,B.jsx)(bF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-chip oc-chip--btn oc-subpanel__bar-export`,title:Uf(),children:[(0,B.jsx)(Gy,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:nm()}),(0,B.jsx)(Ay,{size:12,className:`oc-chip__chev`,"aria-hidden":!0})]})}),(0,B.jsxs)(xF,{align:`end`,className:`w-44`,children:[(0,B.jsx)(CF,{children:nm()}),(0,B.jsx)(SF,{onClick:()=>a(`md`),children:yh()}),(0,B.jsx)(SF,{onClick:()=>a(`json`),children:Ia()})]})]}):null]}),c?(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__adv-toggle${o?` is-open`:``}`,"aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,B.jsx)(Gb,{size:13,"aria-hidden":!0}),qt(),(0,B.jsx)(My,{size:13,className:`oc-subpanel__adv-chevron`,"aria-hidden":!0})]}):null,o&&c?(0,B.jsx)(Pge,{meta:e??{},telemetry:t,childAgentId:n,instanceName:r}):null]})}function Nge(e){return e===`leaf`?yo():e===`orchestrator`?uee():null}function Pge({meta:e,telemetry:t,childAgentId:n,instanceName:r}){let i=[];e.model&&i.push([wm(),e.model]),e.modelProvider&&i.push([du(),e.modelProvider]);let a=e.agentId??n;a&&i.push([Mn(),a]),r&&i.push([hm(),r]),e.label&&i.push([Et(),e.label]),e.thinkingLevel&&i.push([y(),e.thinkingLevel]),e.fastMode!==void 0&&i.push([ya(),e.fastMode?Sc():Bs()]),e.context&&i.push([Ss(),e.context]),e.lightContext!==void 0&&i.push([$i(),e.lightContext?vi():$r()]),e.runtime&&i.push([pn(),e.runtime]),e.mode&&i.push([ns(),e.mode]),e.cleanup&&i.push([_e(),e.cleanup]),e.sandbox&&i.push([Jee(),e.sandbox]),e.controlScope&&i.push([ac(),e.controlScope]),e.subagentRole&&i.push([Qn(),e.subagentRole]),e.spawnDepth!==void 0&&i.push([Np(),String(e.spawnDepth)]);let o=Nge(e.subagentRole);if(o&&i.push([Ir(),o]),e.sessionId&&i.push([Td(),e.sessionId]),e.gatewayKind&&i.push([La(),e.gatewayKind]),t?.runtimeMs!==void 0){let e=fge(t.runtimeMs);e&&i.push([te(),e])}if(t?.totalTokens!==void 0&&i.push([Hd(),Fhe(t.totalTokens)]),t?.estimatedCostUsd!==void 0){let e=typeof t.totalTokens==`number`&&t.totalTokens>0;if(t.estimatedCostUsd<=0&&e)i.push([Fi(),wc()]);else{let e=pge(t.estimatedCostUsd);e&&i.push([Fi(),e])}}return(0,B.jsx)(`dl`,{className:`oc-subpanel__adv-list`,children:i.map(([e,t])=>(0,B.jsxs)(`div`,{className:`oc-subpanel__adv-row`,children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]},e))})}function z0({chatId:e,childKey:t,onClose:n,parentAgentLabel:r}){let i=I(L.subAgents.listSubAgents,{chatId:e}),a=I(L.agents.getChatAgent,{chatId:e}),o=I(L.messages.getSessionMeta,{chatId:e})?.perTurnRouting===!0?void 0:a?.agent?.instanceName,s=(i??[]).find(e=>e.childSessionKey===t),c=s?j0([s]).cards[0]:void 0,l=s?.taskName?.trim(),u=vge(c),d=yge(t),f=I(L.subAgentReports.myReportedSubAgentIds,{chatId:e}),p=I(L.subAgents.listSubAgentToolParts,{chatId:e,childSessionKey:t}),m=I(L.subAgentInteractions.listSubAgentInteractions,{chatId:e,childSessionKey:t}),h=Ei(L.subAgentInteractions.sendToSubAgent),g=Nt(L.chats.generateUploadUrl),_=Nt(L.uploads.registerUpload),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(!0),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(``),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)([]),[A,ee]=(0,z.useState)(!1),[j,M]=(0,z.useState)(!0),te=(0,z.useRef)(null),N=(0,z.useRef)(null),P=(0,z.useCallback)(async e=>{if(!(!e||e.length===0)){ee(!0);try{for(let t of Array.from(e)){if(O.length>=6)break;let e=await g(),{storageId:n}=await(await fetch(e,{method:`POST`,headers:{"Content-Type":t.type||`application/octet-stream`},body:t})).json();await _({storageId:n}),k(e=>e.length>=6?e:[...e,{storageId:n,filename:t.name,mimeType:t.type||`application/octet-stream`}])}}finally{ee(!1),te.current&&(te.current.value=``)}}},[O.length,g,_]),[ne,re]=(0,z.useState)(null),ie=c?(f??[]).includes(c.id):!1,ae=(0,z.useCallback)(e=>{if(!c)return;let t=p&&p.length>0?p.map(e=>({name:e.name,status:e.status,argsText:e.argsText,resultText:e.resultText})):(c.tools??[]).map(e=>({name:e.name,status:e.status})),n={taskName:l,status:c.status,parentAgentLabel:r,sessionMeta:c.sessionMeta,telemetry:c.telemetry,result:c.resultText,error:c.failure?I0(c.errorMessage,c.errorCode):void 0,tools:t};Dge(Qhe(l,e),e===`md`?ege(n):$he({...n,exportedAt:Date.now()}))},[c,p,l,r]);(0,z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,z.useEffect)(()=>{i!==void 0&&!s&&n()},[i,s,n]);let oe=m&&m.length>0?`${m.length}:${m[m.length-1].status}`:``;(0,z.useEffect)(()=>{if(!oe)return;let e=N.current;e&&e.scrollTo({top:e.scrollHeight,behavior:`smooth`})},[oe]);let se=async()=>{let n=w.trim();if(!(u||d)&&!(!n&&O.length===0||v||A)){y(!0);try{await h({chatId:e,childSessionKey:t,text:n,...O.length>0?{attachments:O.map(e=>({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType}))}:{}}),T(``),k([])}finally{y(!1)}}};return(0,B.jsxs)(`div`,{className:`oc-subpanel`,children:[(0,B.jsxs)(`header`,{className:`oc-subpanel__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__avatar oc-subpanel__back${c?` oc-subpanel__avatar--${c.tone}`:``}`,disabled:!s?.parentMessageId,title:ip(),"aria-label":sm(),onClick:()=>s?.parentMessageId&&Ege(s.parentMessageId),children:(0,B.jsx)(yy,{size:16})}),(0,B.jsxs)(`div`,{className:`oc-subpanel__headmain`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__head-top`,children:[(0,B.jsx)(`span`,{className:`oc-subpanel__kind`,children:c?A0(c):ed()}),(0,B.jsxs)(`div`,{className:`oc-subpanel__head-ctrls`,children:[c?(0,B.jsx)(Oge,{card:c}):null,c&&_ge(c.status)?(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn oc-subpanel__report${ie?` is-on`:``}`,title:ie?$s():hd(),"aria-label":hd(),disabled:ie,onClick:()=>re({subAgentId:c.id,label:c.label}),children:(0,B.jsx)(Qy,{size:15,"aria-hidden":!0})}):null,(0,B.jsx)(Ih,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":yp(),className:`oc-subpanel__close`,children:(0,B.jsx)(xh,{size:16})})]})]}),l?(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__task${E?` is-expanded`:``}`,title:al(),"aria-expanded":E,onClick:()=>D(e=>!e),children:l}):null]})]}),(0,B.jsx)(Mge,{meta:c?.sessionMeta,telemetry:c?.telemetry,childAgentId:c?.childAgentId,instanceName:o,parentAgentLabel:r,onExport:c?ae:void 0}),(0,B.jsx)(`div`,{className:`oc-subpanel__body`,ref:N,children:c?(0,B.jsxs)(B.Fragment,{children:[c.tools&&c.tools.length>0&&j?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Yl()}),(0,B.jsx)(jge,{summary:c.tools,parts:p,subAgentRunning:c.tone===`running`})]}):null,c.failure?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Lm()}),(0,B.jsx)(`p`,{className:`oc-subpanel__error`,children:I0(c.errorMessage,c.errorCode)})]}):null,c.resultText?(0,B.jsxs)(`section`,{className:`oc-subpanel__section oc-subpanel__result${b?` is-open`:``}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__result-toggle`,"aria-expanded":b,onClick:()=>x(!b),children:[(0,B.jsx)(My,{size:13,className:`oc-subpanel__result-chevron`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__section-title`,children:lf()})]}),b?(0,B.jsx)(C1,{text:c.resultText}):null]}):c.tone===`running`?(0,B.jsxs)(`p`,{className:`oc-subpanel__muted oc-subpanel__working`,children:[(0,B.jsx)(pb,{size:14,className:`oc-subagent__spin`,"aria-hidden":!0}),Il()]}):null,m&&m.length>0?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Pe()}),(0,B.jsx)(`div`,{className:`oc-subpanel__thread`,children:m.map(e=>(0,B.jsxs)(`div`,{className:`oc-subpanel__exchange`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--user`,children:[e.userText,e.attachments&&e.attachments.length>0?(0,B.jsx)(`div`,{className:`oc-subpanel__msg-atts`,children:e.attachments.map((t,n)=>(0,B.jsxs)(`span`,{className:`oc-subpanel__attchip oc-subpanel__attchip--sent`,title:t.filename,children:[(0,B.jsx)(kb,{size:11,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:t.filename})]},`${e._id}-att-${n}`))}):null]}),e.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--pending`,children:[(0,B.jsx)(pb,{size:13,className:`oc-actrow__spin`,"aria-hidden":!0}),eo()]}):e.status===`error`?(0,B.jsx)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--err`,children:e.errorMessage??wee()}):(0,B.jsx)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--reply`,children:(0,B.jsx)(C1,{text:e.replyText??``})})]},e._id))})]}):null]}):(0,B.jsx)(`p`,{className:`oc-subpanel__muted`,children:Tu()})}),(0,B.jsx)(`footer`,{className:`oc-subpanel__foot`,children:S?(0,B.jsxs)(`div`,{className:`oc-subpanel__prompt`,children:[O.length>0?(0,B.jsx)(`div`,{className:`oc-subpanel__attstrip`,children:O.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-subpanel__attchip`,title:e.filename,children:[(0,B.jsx)(kb,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:e.filename}),(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__attchip-x`,"aria-label":Iu(),onClick:()=>k(e=>e.filter((e,n)=>n!==t)),children:(0,B.jsx)(xh,{size:11,"aria-hidden":!0})})]},`${e.storageId}-${t}`))}):null,(0,B.jsx)(`textarea`,{className:`oc-subpanel__prompt-input`,rows:2,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),se())},placeholder:bf(),autoFocus:!0}),(0,B.jsxs)(`div`,{className:`oc-subpanel__prompt-bar`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__composer-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__composer-btn`,title:Jm(),"aria-label":Jm(),disabled:A||O.length>=6,onClick:()=>te.current?.click(),children:A?(0,B.jsx)(pb,{size:15,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(Ib,{size:15,"aria-hidden":!0})}),c?.tools&&c.tools.length>0?(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__composer-btn oc-subpanel__composer-btn--label${j?` is-on`:``}`,title:zc(),"aria-pressed":j,onClick:()=>M(e=>!e),children:[(0,B.jsx)(rx,{size:14,"aria-hidden":!0}),Yl()]}):null]}),c?.tone===`running`?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:gl()}):d?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:st()}):u?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:qe()}):(m??[]).some(e=>e.status===`pending`)?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:Ree()}):null,(0,B.jsxs)(Ih,{variant:`default`,size:`sm`,className:`gap-1.5`,disabled:!w.trim()&&O.length===0||v||A||c?.tone===`running`||u||d||(m??[]).some(e=>e.status===`pending`),onClick:()=>void se(),children:[v?(0,B.jsx)(pb,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(Vb,{size:14,"aria-hidden":!0}),mp()]})]}),(0,B.jsx)(`input`,{ref:te,type:`file`,multiple:!0,className:`oc-subpanel__fileinput`,onChange:e=>void P(e.target.files)})]}):(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__interact`,onClick:()=>C(!0),children:[(0,B.jsx)(vb,{size:15,"aria-hidden":!0}),Yu()]})}),(0,B.jsx)(Zhe,{target:ne,onClose:()=>re(null)})]})}var Fge=[`op`,`jobId`,`name`,`enabled`,`schedule`,`message`,`deliveryMode`,`agentId`,`nextRunAtMs`],B0=null,Ige=1,V0=new Set;function H0(){for(let e of[...V0])e()}function U0(e){return V0.add(e),()=>V0.delete(e)}function W0(){return B0}function Lge(e){return B0={pinId:Ige++,kind:e.kind,ownerUserId:e.ownerUserId,originChatId:e.originChatId,originLabel:e.originLabel,params:e.params,pinned:!1},H0(),B0}function G0(e,t){B0===null||B0.pinId!==e||B0.pinned!==t&&(B0={...B0,pinned:t},H0())}function K0(e){B0!==null&&(e!==void 0&&e!==B0.pinId||(B0=null,H0()))}function q0(e,t){B0===null||B0.pinId!==e||(B0={...B0,params:t},H0())}function Rge(e,t){return e===null||e.ownerUserId!==t.userId?`none`:e.pinned||X0(e,t)?`dock`:`none`}function zge(e,t){switch(e){case`sources`:return`sources:${String(t.messageId??``)}`;case`subagent`:return`subagent:${String(t.childKey??``)}`;case`cron`:{let e=t.part??{};return`cron:${JSON.stringify([String(t.instanceName??``),String(t.jobId??``),String(t.occurrenceId??``),Fge.map(t=>e[t]??null)])}`}case`document`:{let e=t.doc??{};return`document:${JSON.stringify([e.filename??null,e.storageId??e.url??null])}`}}}function J0(e,t){return e-420>=t}function Y0(e,t,n){return Math.max(n,Math.min(e,t-420))}function X0(e,t){return e===null||e.ownerUserId!==t.userId?!1:e.originChatId!==null&&e.originChatId===t.chatId}function Bge(e,t){return e===null||e.ownerUserId!==t.userId?!1:!e.pinned&&!X0(e,t)}function Vge(e,t){return X0(e,t)?`keep`:`close`}function Hge(e,t){return X0(e,t)?e:null}function Z0(){let[e,t]=(0,z.useState)(()=>window.innerWidth);return(0,z.useLayoutEffect)(()=>{let e=()=>{let e=document.querySelector(`.oc-workspace`);if(e===null)return;let n=e.querySelector(`.oc-sidebar-col`),r=n===null?0:n.getBoundingClientRect().width,i=e.getBoundingClientRect().width-r;i>0&&t(i)},n=new ResizeObserver(e);n.observe(document.documentElement);let r=new Set,i=()=>{let t=document.querySelector(`.oc-workspace`),i=new Set;if(t!==null){let e=t.querySelector(`.oc-sidebar-col`);e!==null&&i.add(e)}for(let e of r)i.has(e)||n.unobserve(e);for(let e of i)r.has(e)||n.observe(e);r.clear();for(let e of i)r.add(e);e()};i();let a=new MutationObserver(i);return a.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect(),a.disconnect()}},[]),e}var Uge=`oc.sidebar.width`,Q0=`oc.sidebar.collapsed`,$0=200,e2=520,Wge=260,t2=`(max-width: 767px)`;function n2(){let[e,t]=(0,z.useState)(()=>typeof window<`u`&&window.matchMedia(t2).matches);return(0,z.useEffect)(()=>{let e=window.matchMedia(t2),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var r2=new Map;function i2(e,t,n){let r=r2.get(e);if(r!==void 0)for(let e of[...r])e!==n&&e(t)}function a2(e){let{storageKey:t,defaultWidth:n,min:r,max:i,edge:a,maxViewportFraction:o}=e,s=e.fit??(e=>e),c=(0,z.useRef)(s);c.current=s;let l=(0,z.useCallback)(e=>Math.min(i,Math.max(r,e)),[r,i]),[u,d]=(0,z.useState)(()=>l(Number(localStorage.getItem(t))||n)),[f,p]=(0,z.useState)(()=>window.innerWidth);(0,z.useEffect)(()=>{let e=()=>p(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=(0,z.useCallback)(e=>{let t=o===void 0?1/0:Math.round(f*o);return Math.min(Math.max(r,Math.min(i,t)),Math.max(r,e))},[r,i,o,f]),h=(0,z.useRef)(m);h.current=m;let g=(0,z.useRef)(u);g.current=u;let[_,v]=(0,z.useState)(null),y=s(m(_??u)),b=(0,z.useRef)(()=>{});(0,z.useEffect)(()=>{localStorage.setItem(t,String(u)),i2(t,u,b.current)},[t,u]);let x=(0,z.useCallback)(e=>{localStorage.setItem(t,String(e)),i2(t,e,b.current),d(e)},[t]);(0,z.useEffect)(()=>{let e=e=>d(e);b.current=e;let n=r2.get(t)??new Set;return n.add(e),r2.set(t,n),()=>{n.delete(e),n.size===0&&r2.delete(t)}},[t]);let S=(0,z.useRef)(!1),C=(0,z.useRef)(null),w=(0,z.useRef)(null);return(0,z.useEffect)(()=>()=>w.current?.(),[]),{width:y,startResize:(0,z.useCallback)(e=>{if(w.current!==null)return;e.preventDefault(),S.current=!0;let t=e.pointerId,n=e.currentTarget;try{n.setPointerCapture(t)}catch{}let r=e.clientX,i=y,o=!1,s=a===`left`?1:-1,u=i,d=0,f=e=>c.current(h.current(e)),p=()=>{d=0;let e=C.current;if(e){let t=f(u);e.style.width=`${t}px`,e.style.flex=`0 0 ${t}px`}},m=e=>{if(!S.current||e.pointerId!==t)return;let n=l(i+s*(e.clientX-r));f(n)!==f(u)&&(o=!0),u=n,C.current?d===0&&(d=requestAnimationFrame(p)):v(u)},_=e=>{if(e instanceof PointerEvent&&e.pointerId!==t)return;S.current=!1,d!==0&&cancelAnimationFrame(d),v(null),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,_),window.removeEventListener(`pointercancel`,_),window.removeEventListener(`blur`,_),document.removeEventListener(`lostpointercapture`,_);try{n.hasPointerCapture(t)&&n.releasePointerCapture(t)}catch{}w.current=null,document.body.style.cursor=``,document.body.style.userSelect=``;let r=o&&u!==i,a=r?u:g.current,s=C.current;if(s){let e=f(a);s.style.width=`${e}px`,s.style.flex=`0 0 ${e}px`}r&&x(u)};w.current=_,window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,_),window.addEventListener(`pointercancel`,_),window.addEventListener(`blur`,_),document.addEventListener(`lostpointercapture`,_),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[y,a,m,l,x]),setWidth:d,columnRef:C}}function o2(){let{width:e,startResize:t,columnRef:n}=a2({storageKey:Uge,defaultWidth:Wge,min:$0,max:e2,edge:`left`}),[r,i]=(0,z.useState)(()=>localStorage.getItem(Q0)===`1`),a=n2();return(0,z.useEffect)(()=>{localStorage.setItem(Q0,r?`1`:`0`)},[r]),(0,z.useEffect)(()=>{a&&i(!0)},[a]),{width:e,columnRef:n,collapsed:r,toggleCollapsed:(0,z.useCallback)(()=>i(e=>!e),[]),collapse:(0,z.useCallback)(()=>i(!0),[]),startResize:t,isMobile:a,MIN_WIDTH:$0,MAX_WIDTH:e2}}function Gge(e){let t=a2({storageKey:`oc.sources.width`,fit:e(300),defaultWidth:380,min:300,max:680,edge:`right`}),n=a2({storageKey:`oc.subagent.width`,fit:e(320),defaultWidth:460,min:320,max:720,edge:`right`}),r=a2({storageKey:`oc.docviewer.width`,fit:e(380),defaultWidth:560,min:380,max:1800,maxViewportFraction:.72,edge:`right`}),i={...t,min:300},a={...r,min:380};return{sources:i,subagent:{...n,min:320},cron:i,document:a}}function Kge({viewerUserId:e,currentChatId:t}){let n=(0,z.useSyncExternalStore)(U0,W0,W0),r=Nv(),i=n2(),a=Z0(),o=Gge((0,z.useCallback)(e=>t=>Y0(t,a,e),[a])),s={userId:e,chatId:t};(0,z.useEffect)(()=>()=>K0(),[]);let c=Bge(n,s),l=n?.pinId;if((0,z.useEffect)(()=>{c&&l!==void 0&&K0(l)},[c,l]),n===null||Rge(n,s)!==`dock`)return null;let u=n.params,d=()=>K0(n.pinId),{width:f,startResize:p,columnRef:m,min:h}=o[n.kind],g=i||!J0(a,h);if(g&&!n.pinned)return null;let _=Y0(f,a,h);return(0,B.jsx)(W1,{children:(0,B.jsxs)(`aside`,{className:`oc-pinpanel`,ref:m,hidden:g,style:g?{display:`none`}:{width:_,flex:`0 0 ${_}px`},"aria-label":Ft({origin:n.originLabel}),children:[(0,B.jsx)(`div`,{className:`oc-pinpanel__resizer`,onPointerDown:p,role:`separator`,"aria-orientation":`vertical`,"aria-label":Oo()}),(0,B.jsxs)(`div`,{className:`oc-pinpanel__head`,children:[(0,B.jsx)(`span`,{className:`oc-pinpanel__origin`,title:n.originLabel,children:n.originLabel}),(0,B.jsxs)(`span`,{className:`oc-pinpanel__ctrls`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn${n.pinned?` is-on`:``}`,"aria-pressed":n.pinned,title:n.pinned?tn():Ko(),"aria-label":n.pinned?tn():Ko(),onClick:()=>{if(!n.pinned){G0(n.pinId,!0);return}Vge(n,s)===`close`?d():G0(n.pinId,!1)},children:n.pinned?(0,B.jsx)(Pb,{size:14,"aria-hidden":!0}):(0,B.jsx)(Nb,{size:14,"aria-hidden":!0})}),n.originChatId!==null&&!X0(n,s)?(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn`,title:us(),"aria-label":us(),onClick:()=>void r({to:`/chat/$chatId`,params:{chatId:n.originChatId}}),children:(0,B.jsx)(Jy,{size:14,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn`,title:_h(),"aria-label":_h(),onClick:d,children:(0,B.jsx)(xh,{size:14,"aria-hidden":!0})})]})]}),(0,B.jsx)(pI,{onClose:d,children:(0,B.jsx)(`div`,{className:`oc-pinpanel__body`,children:n.kind===`cron`?(0,B.jsx)(fI,{instanceName:u.instanceName,part:u.part,onClose:d}):n.kind===`document`?(0,B.jsx)(L1.Provider,{value:{activeDoc:u.doc,openFor:e=>q0(n.pinId,{...u,doc:e}),openNewerVersion:e=>q0(n.pinId,{...u,doc:e}),close:d},children:(0,B.jsx)(z1,{doc:u.doc,chatId:n.originChatId,onClose:d})}):n.kind===`subagent`?(0,B.jsx)(z0,{chatId:n.originChatId,childKey:u.childKey,onClose:d,parentAgentLabel:u.parentAgentLabel??``}):(0,B.jsx)(i0,{messageId:u.messageId,onClose:d})})},n.pinId)]})})}var s2;function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var c2=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},l2=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(s2=globalThis).__zod_globalConfig??(s2.__zod_globalConfig={});var u2=globalThis.__zod_globalConfig;function d2(e){return e&&Object.assign(u2,e),u2}function f2(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function p2(e,t){return typeof t==`bigint`?t.toString():t}function m2(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function h2(e){return e==null}function g2(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function qge(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var _2=Symbol(`evaluating`);function v2(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==_2)return r===void 0&&(r=_2,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function y2(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function b2(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function x2(e){return JSON.stringify(e)}function Jge(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var S2=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function C2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Yge=m2(()=>{if(u2.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function w2(e){if(C2(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(C2(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function T2(e){return w2(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Xge=new Set([`string`,`number`,`symbol`]);function E2(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function D2(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function O2(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Zge(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Qge={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function $ge(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return D2(e,b2(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return y2(this,`shape`,e),e},checks:[]}))}function e_e(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return D2(e,b2(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return y2(this,`shape`,r),r},checks:[]}))}function t_e(e,t){if(!w2(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return D2(e,b2(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y2(this,`shape`,n),n}}))}function n_e(e,t){if(!w2(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return D2(e,b2(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y2(this,`shape`,n),n}}))}function r_e(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return D2(e,b2(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return y2(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function i_e(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return D2(t,b2(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return y2(this,`shape`,i),i},checks:[]}))}function a_e(e,t,n){return D2(t,b2(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return y2(this,`shape`,i),i}}))}function k2(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function o_e(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function A2(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function j2(e){return typeof e==`string`?e:e?.message}function M2(e,t,n){let r=e.message?e.message:j2(e.inst?._zod.def?.error?.(e))??j2(t?.error?.(e))??j2(n.customError?.(e))??j2(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function N2(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function P2(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var F2=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,p2,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},I2=$(`$ZodError`,F2),L2=$(`$ZodError`,F2,{Parent:Error});function s_e(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function c_e(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var R2=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new c2;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>M2(e,a,d2())));throw S2(t,i?.callee),t}return o.value},z2=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>M2(e,a,d2())));throw S2(t,i?.callee),t}return o.value},B2=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new c2;return a.issues.length?{success:!1,error:new(e??I2)(a.issues.map(e=>M2(e,i,d2())))}:{success:!0,data:a.value}},l_e=B2(L2),V2=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>M2(e,i,d2())))}:{success:!0,data:a.value}},u_e=V2(L2),d_e=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return R2(e)(t,n,i)},f_e=e=>(t,n,r)=>R2(e)(t,n,r),p_e=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return z2(e)(t,n,i)},m_e=e=>async(t,n,r)=>z2(e)(t,n,r),h_e=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return B2(e)(t,n,i)},g_e=e=>(t,n,r)=>B2(e)(t,n,r),__e=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return V2(e)(t,n,i)},v_e=e=>async(t,n,r)=>V2(e)(t,n,r),y_e=/^[cC][0-9a-z]{6,}$/,b_e=/^[0-9a-z]+$/,x_e=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,S_e=/^[0-9a-vA-V]{20}$/,C_e=/^[A-Za-z0-9]{27}$/,w_e=/^[a-zA-Z0-9_-]{21}$/,T_e=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,E_e=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,H2=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,D_e=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,O_e=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function k_e(){return new RegExp(O_e,`u`)}var A_e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,j_e=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,M_e=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,N_e=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,P_e=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,U2=/^[A-Za-z0-9_-]*$/,F_e=/^https?$/,I_e=/^\+[1-9]\d{6,14}$/,W2=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,L_e=RegExp(`^${W2}$`);function G2(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function R_e(e){return RegExp(`^${G2(e)}$`)}function z_e(e){let t=G2({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${W2}T(?:${r})$`)}var B_e=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},V_e=/^-?\d+$/,H_e=/^-?\d+(?:\.\d+)?$/,U_e=/^[^A-Z]*$/,W_e=/^[^a-z]*$/,K2=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),q2={number:`number`,bigint:`bigint`,object:`date`},J2=$(`$ZodCheckLessThan`,(e,t)=>{K2.init(e,t);let n=q2[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Y2=$(`$ZodCheckGreaterThan`,(e,t)=>{K2.init(e,t);let n=q2[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),G_e=$(`$ZodCheckMultipleOf`,(e,t)=>{K2.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):qge(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),K_e=$(`$ZodCheckNumberFormat`,(e,t)=>{K2.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Qge[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=V_e)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),q_e=$(`$ZodCheckMaxLength`,(e,t)=>{var n;K2.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!h2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=N2(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),J_e=$(`$ZodCheckMinLength`,(e,t)=>{var n;K2.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!h2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=N2(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Y_e=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;K2.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!h2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=N2(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),X2=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;K2.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),X_e=$(`$ZodCheckRegex`,(e,t)=>{X2.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Z_e=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=U_e,X2.init(e,t)}),Q_e=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=W_e,X2.init(e,t)}),$_e=$(`$ZodCheckIncludes`,(e,t)=>{K2.init(e,t);let n=E2(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),eve=$(`$ZodCheckStartsWith`,(e,t)=>{K2.init(e,t);let n=RegExp(`^${E2(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),tve=$(`$ZodCheckEndsWith`,(e,t)=>{K2.init(e,t);let n=RegExp(`.*${E2(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),nve=$(`$ZodCheckOverwrite`,(e,t)=>{K2.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),rve=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
243
243
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
244
244
|
`))}},ive={major:4,minor:4,patch:3},Z2=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ive;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=k2(e),i;for(let a of t){if(a._zod.def.when){if(o_e(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new c2;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=k2(e,t))});else{if(e.issues.length===t)continue;r||=k2(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(k2(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new c2;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new c2;return o.then(e=>t(e,r,a))}return t(o,r,a)}}v2(e,`~standard`,()=>({validate:t=>{try{let n=l_e(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return u_e(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Q2=$(`$ZodString`,(e,t)=>{Z2.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??B_e(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),$2=$(`$ZodStringFormat`,(e,t)=>{X2.init(e,t),Q2.init(e,t)}),ave=$(`$ZodGUID`,(e,t)=>{t.pattern??=E_e,$2.init(e,t)}),ove=$(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=H2(e)}else t.pattern??=H2();$2.init(e,t)}),sve=$(`$ZodEmail`,(e,t)=>{t.pattern??=D_e,$2.init(e,t)}),cve=$(`$ZodURL`,(e,t)=>{$2.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===F_e.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),lve=$(`$ZodEmoji`,(e,t)=>{t.pattern??=k_e(),$2.init(e,t)}),uve=$(`$ZodNanoID`,(e,t)=>{t.pattern??=w_e,$2.init(e,t)}),dve=$(`$ZodCUID`,(e,t)=>{t.pattern??=y_e,$2.init(e,t)}),fve=$(`$ZodCUID2`,(e,t)=>{t.pattern??=b_e,$2.init(e,t)}),pve=$(`$ZodULID`,(e,t)=>{t.pattern??=x_e,$2.init(e,t)}),mve=$(`$ZodXID`,(e,t)=>{t.pattern??=S_e,$2.init(e,t)}),hve=$(`$ZodKSUID`,(e,t)=>{t.pattern??=C_e,$2.init(e,t)}),gve=$(`$ZodISODateTime`,(e,t)=>{t.pattern??=z_e(t),$2.init(e,t)}),_ve=$(`$ZodISODate`,(e,t)=>{t.pattern??=L_e,$2.init(e,t)}),vve=$(`$ZodISOTime`,(e,t)=>{t.pattern??=R_e(t),$2.init(e,t)}),yve=$(`$ZodISODuration`,(e,t)=>{t.pattern??=T_e,$2.init(e,t)}),bve=$(`$ZodIPv4`,(e,t)=>{t.pattern??=A_e,$2.init(e,t),e._zod.bag.format=`ipv4`}),xve=$(`$ZodIPv6`,(e,t)=>{t.pattern??=j_e,$2.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Sve=$(`$ZodCIDRv4`,(e,t)=>{t.pattern??=M_e,$2.init(e,t)}),Cve=$(`$ZodCIDRv6`,(e,t)=>{t.pattern??=N_e,$2.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function e4(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var wve=$(`$ZodBase64`,(e,t)=>{t.pattern??=P_e,$2.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{e4(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Tve(e){if(!U2.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return e4(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Eve=$(`$ZodBase64URL`,(e,t)=>{t.pattern??=U2,$2.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Tve(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Dve=$(`$ZodE164`,(e,t)=>{t.pattern??=I_e,$2.init(e,t)});function Ove(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var kve=$(`$ZodJWT`,(e,t)=>{$2.init(e,t),e._zod.check=n=>{Ove(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),t4=$(`$ZodNumber`,(e,t)=>{Z2.init(e,t),e._zod.pattern=e._zod.bag.pattern??H_e,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ave=$(`$ZodNumberFormat`,(e,t)=>{K_e.init(e,t),t4.init(e,t)}),jve=$(`$ZodUnknown`,(e,t)=>{Z2.init(e,t),e._zod.parse=e=>e}),Mve=$(`$ZodNever`,(e,t)=>{Z2.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function n4(e,t,n){e.issues.length&&t.issues.push(...A2(n,e.issues)),t.value[n]=e.value}var Nve=$(`$ZodArray`,(e,t)=>{Z2.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>n4(t,n,e))):n4(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function r4(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...A2(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function i4(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Zge(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function a4(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>r4(e,n,i,t,u,d))):r4(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Pve=$(`$ZodObject`,(e,t)=>{if(Z2.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=m2(()=>i4(t));v2(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=C2,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>r4(n,t,e,s,r,i))):r4(a,t,e,s,r,i)}return i?a4(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Fve=$(`$ZodObjectJIT`,(e,t)=>{Pve.init(e,t);let n=e._zod.parse,r=m2(()=>i4(t)),i=e=>{let t=new rve([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=x2(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=x2(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
245
245
|
if (${n}.issues.length) {
|
|
@@ -302,23 +302,23 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
302
302
|
|
|
303
303
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=C2,s=!u2.jitless,c=s&&Yge.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?a4([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function o4(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!k2(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>M2(e,r,d2())))}),t)}var Ive=$(`$ZodUnion`,(e,t)=>{Z2.init(e,t),v2(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),v2(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),v2(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),v2(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>g2(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>o4(t,r,e,i)):o4(o,r,e,i)}}),Lve=$(`$ZodIntersection`,(e,t)=>{Z2.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>c4(e,t,n)):c4(e,i,a)}});function s4(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(w2(e)&&w2(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=s4(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=s4(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function c4(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),k2(e))return e;let o=s4(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Rve=$(`$ZodEnum`,(e,t)=>{Z2.init(e,t);let n=f2(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Xge.has(typeof e)).map(e=>typeof e==`string`?E2(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),zve=$(`$ZodLiteral`,(e,t)=>{if(Z2.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?E2(e):e?E2(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Bve=$(`$ZodTransform`,(e,t)=>{Z2.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l2(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new c2;return n.value=i,n.fallback=!0,n}});function l4(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var u4=$(`$ZodOptional`,(e,t)=>{Z2.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,v2(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),v2(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${g2(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>l4(e,r)):l4(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Vve=$(`$ZodExactOptional`,(e,t)=>{u4.init(e,t),v2(e._zod,`values`,()=>t.innerType._zod.values),v2(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Hve=$(`$ZodNullable`,(e,t)=>{Z2.init(e,t),v2(e._zod,`optin`,()=>t.innerType._zod.optin),v2(e._zod,`optout`,()=>t.innerType._zod.optout),v2(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${g2(e.source)}|null)$`):void 0}),v2(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Uve=$(`$ZodDefault`,(e,t)=>{Z2.init(e,t),e._zod.optin=`optional`,v2(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>d4(e,t)):d4(r,t)}});function d4(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Wve=$(`$ZodPrefault`,(e,t)=>{Z2.init(e,t),e._zod.optin=`optional`,v2(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Gve=$(`$ZodNonOptional`,(e,t)=>{Z2.init(e,t),v2(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>f4(t,e)):f4(i,e)}});function f4(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Kve=$(`$ZodCatch`,(e,t)=>{Z2.init(e,t),e._zod.optin=`optional`,v2(e._zod,`optout`,()=>t.innerType._zod.optout),v2(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>M2(e,n,d2()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>M2(e,n,d2()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),qve=$(`$ZodPipe`,(e,t)=>{Z2.init(e,t),v2(e._zod,`values`,()=>t.in._zod.values),v2(e._zod,`optin`,()=>t.in._zod.optin),v2(e._zod,`optout`,()=>t.out._zod.optout),v2(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>p4(e,t.in,n)):p4(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>p4(e,t.out,n)):p4(r,t.out,n)}});function p4(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Jve=$(`$ZodReadonly`,(e,t)=>{Z2.init(e,t),v2(e._zod,`propValues`,()=>t.innerType._zod.propValues),v2(e._zod,`values`,()=>t.innerType._zod.values),v2(e._zod,`optin`,()=>t.innerType?._zod?.optin),v2(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(m4):m4(r)}});function m4(e){return e.value=Object.freeze(e.value),e}var Yve=$(`$ZodCustom`,(e,t)=>{K2.init(e,t),Z2.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>h4(t,n,r,e));h4(i,n,r,e)}});function h4(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(P2(e))}}var g4,Xve=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Zve(){return new Xve}(g4=globalThis).__zod_globalRegistry??(g4.__zod_globalRegistry=Zve());var _4=globalThis.__zod_globalRegistry;function Qve(e,t){return new e({type:`string`,...O2(t)})}function $ve(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...O2(t)})}function v4(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...O2(t)})}function eye(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...O2(t)})}function tye(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...O2(t)})}function nye(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...O2(t)})}function rye(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...O2(t)})}function iye(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...O2(t)})}function aye(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...O2(t)})}function oye(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...O2(t)})}function sye(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...O2(t)})}function cye(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...O2(t)})}function lye(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...O2(t)})}function uye(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...O2(t)})}function dye(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...O2(t)})}function fye(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...O2(t)})}function pye(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...O2(t)})}function mye(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...O2(t)})}function hye(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...O2(t)})}function gye(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...O2(t)})}function _ye(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...O2(t)})}function vye(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...O2(t)})}function yye(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...O2(t)})}function bye(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...O2(t)})}function xye(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...O2(t)})}function Sye(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...O2(t)})}function Cye(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...O2(t)})}function wye(e,t){return new e({type:`number`,coerce:!0,checks:[],...O2(t)})}function Tye(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...O2(t)})}function Eye(e){return new e({type:`unknown`})}function Dye(e,t){return new e({type:`never`,...O2(t)})}function y4(e,t){return new J2({check:`less_than`,...O2(t),value:e,inclusive:!1})}function b4(e,t){return new J2({check:`less_than`,...O2(t),value:e,inclusive:!0})}function x4(e,t){return new Y2({check:`greater_than`,...O2(t),value:e,inclusive:!1})}function S4(e,t){return new Y2({check:`greater_than`,...O2(t),value:e,inclusive:!0})}function C4(e,t){return new G_e({check:`multiple_of`,...O2(t),value:e})}function w4(e,t){return new q_e({check:`max_length`,...O2(t),maximum:e})}function T4(e,t){return new J_e({check:`min_length`,...O2(t),minimum:e})}function E4(e,t){return new Y_e({check:`length_equals`,...O2(t),length:e})}function Oye(e,t){return new X_e({check:`string_format`,format:`regex`,...O2(t),pattern:e})}function kye(e){return new Z_e({check:`string_format`,format:`lowercase`,...O2(e)})}function Aye(e){return new Q_e({check:`string_format`,format:`uppercase`,...O2(e)})}function jye(e,t){return new $_e({check:`string_format`,format:`includes`,...O2(t),includes:e})}function Mye(e,t){return new eve({check:`string_format`,format:`starts_with`,...O2(t),prefix:e})}function Nye(e,t){return new tve({check:`string_format`,format:`ends_with`,...O2(t),suffix:e})}function D4(e){return new nve({check:`overwrite`,tx:e})}function Pye(e){return D4(t=>t.normalize(e))}function Fye(){return D4(e=>e.trim())}function Iye(){return D4(e=>e.toLowerCase())}function Lye(){return D4(e=>e.toUpperCase())}function Rye(){return D4(e=>Jge(e))}function zye(e,t,n){return new e({type:`array`,element:t,...O2(n)})}function Bye(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...O2(n)})}function Vye(e,t){let n=Hye(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(P2(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(P2(r))}},e(t.value,t)),t);return n}function Hye(e,t){let n=new K2({check:`custom`,...O2(t)});return n._zod.check=e,n}function O4(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??_4,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function k4(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,k4(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&M4(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function A4(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
304
304
|
|
|
305
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function j4(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:N4(t,`input`,e.processors),output:N4(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function M4(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return M4(r.element,n);if(r.type===`set`)return M4(r.valueType,n);if(r.type===`lazy`)return M4(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return M4(r.innerType,n);if(r.type===`intersection`)return M4(r.left,n)||M4(r.right,n);if(r.type===`record`||r.type===`map`)return M4(r.keyType,n)||M4(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:M4(r.in,n)||M4(r.out,n);if(r.type===`object`){for(let e in r.shape)if(M4(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(M4(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(M4(e,n))return!0;return!!(r.rest&&M4(r.rest,n))}return!1}var Uye=(e,t={})=>n=>{let r=O4({...n,processors:t});return k4(e,r),A4(r,e),j4(r,e)},N4=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=O4({...i??{},target:a,io:t,processors:n});return k4(e,o),A4(o,e),j4(o,e)},Wye={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Gye=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Wye[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Kye=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},qye=(e,t,n,r)=>{n.not={}},Jye=(e,t,n,r)=>{let i=e._zod.def,a=f2(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Yye=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Xye=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Zye=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Qye=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=k4(a.element,t,{...r,path:[...r.path,`items`]})},$ye=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=k4(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=k4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ebe=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>k4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},tbe=(e,t,n,r)=>{let i=e._zod.def,a=k4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=k4(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},nbe=(e,t,n,r)=>{let i=e._zod.def,a=k4(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},rbe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ibe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},abe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},obe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},sbe=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;k4(o,t,r);let s=t.seen.get(e);s.ref=o},cbe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},P4=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lbe=$(`ZodISODateTime`,(e,t)=>{gve.init(e,t),V4.init(e,t)});function ube(e){return bye(lbe,e)}var dbe=$(`ZodISODate`,(e,t)=>{_ve.init(e,t),V4.init(e,t)});function fbe(e){return xye(dbe,e)}var pbe=$(`ZodISOTime`,(e,t)=>{vve.init(e,t),V4.init(e,t)});function mbe(e){return Sye(pbe,e)}var hbe=$(`ZodISODuration`,(e,t)=>{yve.init(e,t),V4.init(e,t)});function gbe(e){return Cye(hbe,e)}var F4=$(`ZodError`,(e,t)=>{I2.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>c_e(e,t)},flatten:{value:t=>s_e(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,p2,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,p2,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),_be=R2(F4),vbe=z2(F4),ybe=B2(F4),bbe=V2(F4),xbe=d_e(F4),Sbe=f_e(F4),Cbe=p_e(F4),wbe=m_e(F4),Tbe=h_e(F4),Ebe=g_e(F4),Dbe=__e(F4),Obe=v_e(F4),I4=new WeakMap;function L4(e,t,n){let r=Object.getPrototypeOf(e),i=I4.get(r);if(i||(i=new Set,I4.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var R4=$(`ZodType`,(e,t)=>(Z2.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:N4(e,`input`),output:N4(e,`output`)}}),e.toJSONSchema=Uye(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>_be(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ybe(e,t,n),e.parseAsync=async(t,n)=>vbe(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>bbe(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>xbe(e,t,n),e.decode=(t,n)=>Sbe(e,t,n),e.encodeAsync=async(t,n)=>Cbe(e,t,n),e.decodeAsync=async(t,n)=>wbe(e,t,n),e.safeEncode=(t,n)=>Tbe(e,t,n),e.safeDecode=(t,n)=>Ebe(e,t,n),e.safeEncodeAsync=async(t,n)=>Dbe(e,t,n),e.safeDecodeAsync=async(t,n)=>Obe(e,t,n),L4(e,`ZodType`,{check(...e){let t=this.def;return this.clone(b2(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return D2(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(bxe(e,t))},superRefine(e,t){return this.check(xxe(e,t))},overwrite(e){return this.check(D4(e))},optional(){return $4(this)},exactOptional(){return sxe(this)},nullable(){return e3(this)},nullish(){return $4(e3(this))},nonoptional(e){return pxe(this,e)},array(){return Qbe(this)},or(e){return J4([this,e])},and(e){return nxe(this,e)},transform(e){return n3(this,axe(e))},default(e){return uxe(this,e)},prefault(e){return fxe(this,e)},catch(e){return hxe(this,e)},pipe(e){return n3(this,e)},readonly(){return vxe(this)},describe(e){let t=this.clone();return _4.add(t,{description:e}),t},meta(...e){if(e.length===0)return _4.get(this);let t=this.clone();return _4.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return _4.get(e)?.description},configurable:!0}),e)),z4=$(`_ZodString`,(e,t)=>{Q2.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gye(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,L4(e,`_ZodString`,{regex(...e){return this.check(Oye(...e))},includes(...e){return this.check(jye(...e))},startsWith(...e){return this.check(Mye(...e))},endsWith(...e){return this.check(Nye(...e))},min(...e){return this.check(T4(...e))},max(...e){return this.check(w4(...e))},length(...e){return this.check(E4(...e))},nonempty(...e){return this.check(T4(1,...e))},lowercase(e){return this.check(kye(e))},uppercase(e){return this.check(Aye(e))},trim(){return this.check(Fye())},normalize(...e){return this.check(Pye(...e))},toLowerCase(){return this.check(Iye())},toUpperCase(){return this.check(Lye())},slugify(){return this.check(Rye())}})}),kbe=$(`ZodString`,(e,t)=>{Q2.init(e,t),z4.init(e,t),e.email=t=>e.check($ve(Abe,t)),e.url=t=>e.check(iye(jbe,t)),e.jwt=t=>e.check(yye(Kbe,t)),e.emoji=t=>e.check(aye(Mbe,t)),e.guid=t=>e.check(v4(H4,t)),e.uuid=t=>e.check(eye(U4,t)),e.uuidv4=t=>e.check(tye(U4,t)),e.uuidv6=t=>e.check(nye(U4,t)),e.uuidv7=t=>e.check(rye(U4,t)),e.nanoid=t=>e.check(oye(Nbe,t)),e.guid=t=>e.check(v4(H4,t)),e.cuid=t=>e.check(sye(Pbe,t)),e.cuid2=t=>e.check(cye(Fbe,t)),e.ulid=t=>e.check(lye(Ibe,t)),e.base64=t=>e.check(gye(Ube,t)),e.base64url=t=>e.check(_ye(Wbe,t)),e.xid=t=>e.check(uye(Lbe,t)),e.ksuid=t=>e.check(dye(Rbe,t)),e.ipv4=t=>e.check(fye(zbe,t)),e.ipv6=t=>e.check(pye(Bbe,t)),e.cidrv4=t=>e.check(mye(Vbe,t)),e.cidrv6=t=>e.check(hye(Hbe,t)),e.e164=t=>e.check(vye(Gbe,t)),e.datetime=t=>e.check(ube(t)),e.date=t=>e.check(fbe(t)),e.time=t=>e.check(mbe(t)),e.duration=t=>e.check(gbe(t))});function B4(e){return Qve(kbe,e)}var V4=$(`ZodStringFormat`,(e,t)=>{$2.init(e,t),z4.init(e,t)}),Abe=$(`ZodEmail`,(e,t)=>{sve.init(e,t),V4.init(e,t)}),H4=$(`ZodGUID`,(e,t)=>{ave.init(e,t),V4.init(e,t)}),U4=$(`ZodUUID`,(e,t)=>{ove.init(e,t),V4.init(e,t)}),jbe=$(`ZodURL`,(e,t)=>{cve.init(e,t),V4.init(e,t)}),Mbe=$(`ZodEmoji`,(e,t)=>{lve.init(e,t),V4.init(e,t)}),Nbe=$(`ZodNanoID`,(e,t)=>{uve.init(e,t),V4.init(e,t)}),Pbe=$(`ZodCUID`,(e,t)=>{dve.init(e,t),V4.init(e,t)}),Fbe=$(`ZodCUID2`,(e,t)=>{fve.init(e,t),V4.init(e,t)}),Ibe=$(`ZodULID`,(e,t)=>{pve.init(e,t),V4.init(e,t)}),Lbe=$(`ZodXID`,(e,t)=>{mve.init(e,t),V4.init(e,t)}),Rbe=$(`ZodKSUID`,(e,t)=>{hve.init(e,t),V4.init(e,t)}),zbe=$(`ZodIPv4`,(e,t)=>{bve.init(e,t),V4.init(e,t)}),Bbe=$(`ZodIPv6`,(e,t)=>{xve.init(e,t),V4.init(e,t)}),Vbe=$(`ZodCIDRv4`,(e,t)=>{Sve.init(e,t),V4.init(e,t)}),Hbe=$(`ZodCIDRv6`,(e,t)=>{Cve.init(e,t),V4.init(e,t)}),Ube=$(`ZodBase64`,(e,t)=>{wve.init(e,t),V4.init(e,t)}),Wbe=$(`ZodBase64URL`,(e,t)=>{Eve.init(e,t),V4.init(e,t)}),Gbe=$(`ZodE164`,(e,t)=>{Dve.init(e,t),V4.init(e,t)}),Kbe=$(`ZodJWT`,(e,t)=>{kve.init(e,t),V4.init(e,t)}),W4=$(`ZodNumber`,(e,t)=>{t4.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kye(e,t,n,r),L4(e,`ZodNumber`,{gt(e,t){return this.check(x4(e,t))},gte(e,t){return this.check(S4(e,t))},min(e,t){return this.check(S4(e,t))},lt(e,t){return this.check(y4(e,t))},lte(e,t){return this.check(b4(e,t))},max(e,t){return this.check(b4(e,t))},int(e){return this.check(G4(e))},safe(e){return this.check(G4(e))},positive(e){return this.check(x4(0,e))},nonnegative(e){return this.check(S4(0,e))},negative(e){return this.check(y4(0,e))},nonpositive(e){return this.check(b4(0,e))},multipleOf(e,t){return this.check(C4(e,t))},step(e,t){return this.check(C4(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}),qbe=$(`ZodNumberFormat`,(e,t)=>{Ave.init(e,t),W4.init(e,t)});function G4(e){return Tye(qbe,e)}var Jbe=$(`ZodUnknown`,(e,t)=>{jve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function K4(){return Eye(Jbe)}var Ybe=$(`ZodNever`,(e,t)=>{Mve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qye(e,t,n,r)});function Xbe(e){return Dye(Ybe,e)}var Zbe=$(`ZodArray`,(e,t)=>{Nve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qye(e,t,n,r),e.element=t.element,L4(e,`ZodArray`,{min(e,t){return this.check(T4(e,t))},nonempty(e){return this.check(T4(1,e))},max(e,t){return this.check(w4(e,t))},length(e,t){return this.check(E4(e,t))},unwrap(){return this.element}})});function Qbe(e,t){return zye(Zbe,e,t)}var $be=$(`ZodObject`,(e,t)=>{Fve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$ye(e,t,n,r),v2(e,`shape`,()=>t.shape),L4(e,`ZodObject`,{keyof(){return X4(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:K4()})},loose(){return this.clone({...this._zod.def,catchall:K4()})},strict(){return this.clone({...this._zod.def,catchall:Xbe()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return t_e(this,e)},safeExtend(e){return n_e(this,e)},merge(e){return r_e(this,e)},pick(e){return $ge(this,e)},omit(e){return e_e(this,e)},partial(...e){return i_e(Q4,this,e[0])},required(...e){return a_e(t3,this,e[0])}})});function q4(e,t){return new $be({type:`object`,shape:e??{},...O2(t)})}var exe=$(`ZodUnion`,(e,t)=>{Ive.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ebe(e,t,n,r),e.options=t.options});function J4(e,t){return new exe({type:`union`,options:e,...O2(t)})}var txe=$(`ZodIntersection`,(e,t)=>{Lve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tbe(e,t,n,r)});function nxe(e,t){return new txe({type:`intersection`,left:e,right:t})}var Y4=$(`ZodEnum`,(e,t)=>{Rve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jye(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Y4({...t,checks:[],...O2(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Y4({...t,checks:[],...O2(r),entries:i})}});function X4(e,t){return new Y4({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O2(t)})}var rxe=$(`ZodLiteral`,(e,t)=>{zve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yye(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Z4(e,t){return new rxe({type:`literal`,values:Array.isArray(e)?e:[e],...O2(t)})}var ixe=$(`ZodTransform`,(e,t)=>{Bve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zye(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l2(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(P2(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(P2(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function axe(e){return new ixe({type:`transform`,transform:e})}var Q4=$(`ZodOptional`,(e,t)=>{u4.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>P4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $4(e){return new Q4({type:`optional`,innerType:e})}var oxe=$(`ZodExactOptional`,(e,t)=>{Vve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>P4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sxe(e){return new oxe({type:`optional`,innerType:e})}var cxe=$(`ZodNullable`,(e,t)=>{Hve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nbe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function e3(e){return new cxe({type:`nullable`,innerType:e})}var lxe=$(`ZodDefault`,(e,t)=>{Uve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ibe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function uxe(e,t){return new lxe({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():T2(t)}})}var dxe=$(`ZodPrefault`,(e,t)=>{Wve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>abe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fxe(e,t){return new dxe({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():T2(t)}})}var t3=$(`ZodNonOptional`,(e,t)=>{Gve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rbe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pxe(e,t){return new t3({type:`nonoptional`,innerType:e,...O2(t)})}var mxe=$(`ZodCatch`,(e,t)=>{Kve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>obe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hxe(e,t){return new mxe({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var gxe=$(`ZodPipe`,(e,t)=>{qve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sbe(e,t,n,r),e.in=t.in,e.out=t.out});function n3(e,t){return new gxe({type:`pipe`,in:e,out:t})}var _xe=$(`ZodReadonly`,(e,t)=>{Jve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cbe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vxe(e){return new _xe({type:`readonly`,innerType:e})}var yxe=$(`ZodCustom`,(e,t)=>{Yve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xye(e,t,n,r)});function bxe(e,t={}){return Bye(yxe,e,t)}function xxe(e,t){return Vye(e,t)}function Sxe(e){return wye(W4,e)}var r3=`atrium:lastChatId`;function Cxe(e){try{localStorage.setItem(r3,e)}catch{}}function wxe(){try{return localStorage.getItem(r3)}catch{return null}}function Txe(e){let t=e instanceof Error?`${e.name}: ${e.message}`:String(e??``);return t.includes(`Failed to fetch dynamically imported module`)||t.includes(`Importing a module script failed`)||t.includes(`error loading dynamically imported module`)||t.includes(`Unable to preload CSS`)}var i3=`atrium:chunkReloadAt`,Exe=6e4;function Dxe(){try{return typeof sessionStorage>`u`?null:sessionStorage}catch{return null}}function Oxe(e,t=Dxe()){if(t===null)return!1;try{let n=Number(t.getItem(i3)??0);return Number.isFinite(n)&&e-n<Exe?!1:(t.setItem(i3,String(e)),!0)}catch{return!1}}function a3(e){return new Map(e.map(e=>[e._id,e]))}function o3(e,t){let n=t.parentId??null;return n===null?null:e.has(n)?n:null}function s3(e){return[...e].sort((e,t)=>(e.sortKey??0)-(t.sortKey??0))}function kxe(e){let t=a3(e);return s3(e.filter(e=>o3(t,e)===null))}function c3(e,t){let n=a3(e);return s3(e.filter(e=>o3(n,e)===t))}function Axe(e,t){let n=a3(e);if(!n.has(t))return[];let r=new Map;for(let t of e){let e=o3(n,t);if(e===null)continue;let i=r.get(e);i===void 0?r.set(e,[t._id]):i.push(t._id)}let i=[],a=new Set,o=[t];for(;o.length>0;){let e=o.shift();if(!a.has(e)){a.add(e),i.push(e);for(let t of r.get(e)??[])o.push(t)}}return i}function jxe(e,t,n){return n===null?!1:n===t?!0:Axe(e,t).includes(n)}function l3(e,t,n){return!(jxe(e,t,n)||!e.some(e=>e._id===t)||n!==null&&!e.some(e=>e._id===n))}function u3(e,t){let n=a3(e),r=n.get(t);if(r===void 0)return[];let i=new Set([t]),a=[r];for(;;){let e=o3(n,r);if(e===null||i.has(e))return a.reverse();i.add(e),r=n.get(e),a.push(r)}}function Mxe(e,t){let n=u3(e,t);return n.length>0?n[0]._id:t}function Nxe(e){let t=[],n=(r,i)=>{for(let a of c3(e,r))t.push({node:a,depth:i}),n(a._id,i+1)};return n(null,1),t}var d3=typeof window<`u`&&window.location?window.location.hostname:``,f3=e=>`oc.brand.${e}`;function Pxe(e){if(typeof e!=`object`||!e||Array.isArray(e)||!(`tokens`in e))return!1;let t=e.tokens;if(t===null)return!0;if(typeof t!=`object`)return!1;let n=t.colors;return typeof n==`object`&&!!n&&`light`in n&&`dark`in n}function Fxe(e){try{let t=localStorage.getItem(f3(e));if(!t)return null;let n=JSON.parse(t);return Pxe(n)?n:null}catch{return null}}function Ixe(e,t){try{localStorage.setItem(f3(e),JSON.stringify(t))}catch{}}var Lxe=`background.foreground.card.card-foreground.popover.popover-foreground.primary.primary-foreground.secondary.secondary-foreground.muted.muted-foreground.accent.accent-foreground.destructive.destructive-foreground.border.input.ring.chart-1.chart-2.chart-3.chart-4.chart-5.sidebar.sidebar-foreground.sidebar-primary.sidebar-primary-foreground.sidebar-accent.sidebar-accent-foreground.sidebar-border.sidebar-ring.highlight.bookmark.voice`.split(`.`),p3=[{key:`ocean`,name:`Ocean`,tokens:{colors:{light:{background:`oklch(0.985 0.012 230)`,foreground:`oklch(0.22 0.04 245)`,card:`oklch(0.995 0.008 230)`,"card-foreground":`oklch(0.22 0.04 245)`,popover:`oklch(0.995 0.008 230)`,"popover-foreground":`oklch(0.22 0.04 245)`,primary:`oklch(0.55 0.13 235)`,"primary-foreground":`oklch(0.99 0.01 230)`,secondary:`oklch(0.93 0.03 220)`,"secondary-foreground":`oklch(0.28 0.05 240)`,muted:`oklch(0.94 0.02 225)`,"muted-foreground":`oklch(0.5 0.04 235)`,accent:`oklch(0.9 0.05 200)`,"accent-foreground":`oklch(0.28 0.06 230)`,border:`oklch(0.88 0.03 225)`,input:`oklch(0.88 0.03 225)`,ring:`oklch(0.55 0.13 235)`,"chart-1":`oklch(0.6 0.13 235)`,"chart-2":`oklch(0.65 0.12 200)`,"chart-3":`oklch(0.55 0.1 260)`,"chart-4":`oklch(0.7 0.11 180)`,"chart-5":`oklch(0.5 0.12 215)`,sidebar:`oklch(0.96 0.02 228)`,"sidebar-foreground":`oklch(0.24 0.04 245)`,"sidebar-primary":`oklch(0.55 0.13 235)`,"sidebar-primary-foreground":`oklch(0.99 0.01 230)`,"sidebar-accent":`oklch(0.9 0.05 200)`,"sidebar-accent-foreground":`oklch(0.28 0.06 230)`,"sidebar-border":`oklch(0.87 0.03 225)`,"sidebar-ring":`oklch(0.55 0.13 235)`},dark:{background:`oklch(0.2 0.03 245)`,foreground:`oklch(0.95 0.02 225)`,card:`oklch(0.25 0.04 245)`,"card-foreground":`oklch(0.95 0.02 225)`,popover:`oklch(0.25 0.04 245)`,"popover-foreground":`oklch(0.95 0.02 225)`,primary:`oklch(0.7 0.12 230)`,"primary-foreground":`oklch(0.18 0.04 245)`,secondary:`oklch(0.3 0.04 240)`,"secondary-foreground":`oklch(0.95 0.02 225)`,muted:`oklch(0.3 0.03 242)`,"muted-foreground":`oklch(0.72 0.04 228)`,accent:`oklch(0.4 0.07 210)`,"accent-foreground":`oklch(0.96 0.02 220)`,border:`oklch(0.35 0.03 242)`,input:`oklch(0.35 0.03 242)`,ring:`oklch(0.7 0.12 230)`,"chart-1":`oklch(0.7 0.13 230)`,"chart-2":`oklch(0.72 0.12 195)`,"chart-3":`oklch(0.65 0.11 260)`,"chart-4":`oklch(0.76 0.1 180)`,"chart-5":`oklch(0.62 0.12 215)`,sidebar:`oklch(0.23 0.04 246)`,"sidebar-foreground":`oklch(0.95 0.02 225)`,"sidebar-primary":`oklch(0.7 0.12 230)`,"sidebar-primary-foreground":`oklch(0.18 0.04 245)`,"sidebar-accent":`oklch(0.4 0.07 210)`,"sidebar-accent-foreground":`oklch(0.96 0.02 220)`,"sidebar-border":`oklch(0.34 0.03 242)`,"sidebar-ring":`oklch(0.7 0.12 230)`}},radius:`0.75rem`,fontSans:`ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif`}},{key:`forest`,name:`Forest`,tokens:{colors:{light:{background:`oklch(0.985 0.012 130)`,foreground:`oklch(0.24 0.04 145)`,card:`oklch(0.995 0.008 130)`,"card-foreground":`oklch(0.24 0.04 145)`,popover:`oklch(0.995 0.008 130)`,"popover-foreground":`oklch(0.24 0.04 145)`,primary:`oklch(0.52 0.12 150)`,"primary-foreground":`oklch(0.99 0.01 130)`,secondary:`oklch(0.93 0.04 130)`,"secondary-foreground":`oklch(0.3 0.05 150)`,muted:`oklch(0.94 0.03 135)`,"muted-foreground":`oklch(0.5 0.04 145)`,accent:`oklch(0.9 0.06 115)`,"accent-foreground":`oklch(0.3 0.06 150)`,border:`oklch(0.88 0.03 135)`,input:`oklch(0.88 0.03 135)`,ring:`oklch(0.52 0.12 150)`,"chart-1":`oklch(0.58 0.13 150)`,"chart-2":`oklch(0.68 0.12 120)`,"chart-3":`oklch(0.6 0.11 95)`,"chart-4":`oklch(0.55 0.1 175)`,"chart-5":`oklch(0.5 0.12 140)`,sidebar:`oklch(0.96 0.02 132)`,"sidebar-foreground":`oklch(0.26 0.04 145)`,"sidebar-primary":`oklch(0.52 0.12 150)`,"sidebar-primary-foreground":`oklch(0.99 0.01 130)`,"sidebar-accent":`oklch(0.9 0.06 115)`,"sidebar-accent-foreground":`oklch(0.3 0.06 150)`,"sidebar-border":`oklch(0.87 0.03 135)`,"sidebar-ring":`oklch(0.52 0.12 150)`},dark:{background:`oklch(0.2 0.03 150)`,foreground:`oklch(0.95 0.02 130)`,card:`oklch(0.25 0.04 150)`,"card-foreground":`oklch(0.95 0.02 130)`,popover:`oklch(0.25 0.04 150)`,"popover-foreground":`oklch(0.95 0.02 130)`,primary:`oklch(0.68 0.13 145)`,"primary-foreground":`oklch(0.18 0.04 150)`,secondary:`oklch(0.3 0.04 148)`,"secondary-foreground":`oklch(0.95 0.02 130)`,muted:`oklch(0.3 0.03 150)`,"muted-foreground":`oklch(0.72 0.04 135)`,accent:`oklch(0.4 0.07 120)`,"accent-foreground":`oklch(0.96 0.02 125)`,border:`oklch(0.35 0.03 148)`,input:`oklch(0.35 0.03 148)`,ring:`oklch(0.68 0.13 145)`,"chart-1":`oklch(0.68 0.14 148)`,"chart-2":`oklch(0.74 0.12 120)`,"chart-3":`oklch(0.68 0.11 95)`,"chart-4":`oklch(0.62 0.1 175)`,"chart-5":`oklch(0.6 0.12 140)`,sidebar:`oklch(0.23 0.04 150)`,"sidebar-foreground":`oklch(0.95 0.02 130)`,"sidebar-primary":`oklch(0.68 0.13 145)`,"sidebar-primary-foreground":`oklch(0.18 0.04 150)`,"sidebar-accent":`oklch(0.4 0.07 120)`,"sidebar-accent-foreground":`oklch(0.96 0.02 125)`,"sidebar-border":`oklch(0.34 0.03 148)`,"sidebar-ring":`oklch(0.68 0.13 145)`}},radius:`0.375rem`,fontSans:`Georgia, Cambria, 'Times New Roman', Times, serif`}},{key:`dusk`,name:`Dusk`,tokens:{colors:{light:{background:`oklch(0.985 0.012 300)`,foreground:`oklch(0.24 0.05 300)`,card:`oklch(0.995 0.008 300)`,"card-foreground":`oklch(0.24 0.05 300)`,popover:`oklch(0.995 0.008 300)`,"popover-foreground":`oklch(0.24 0.05 300)`,primary:`oklch(0.55 0.16 300)`,"primary-foreground":`oklch(0.99 0.01 300)`,secondary:`oklch(0.93 0.04 310)`,"secondary-foreground":`oklch(0.3 0.06 300)`,muted:`oklch(0.94 0.03 305)`,"muted-foreground":`oklch(0.5 0.05 300)`,accent:`oklch(0.9 0.07 70)`,"accent-foreground":`oklch(0.32 0.08 60)`,border:`oklch(0.88 0.03 305)`,input:`oklch(0.88 0.03 305)`,ring:`oklch(0.55 0.16 300)`,"chart-1":`oklch(0.58 0.17 300)`,"chart-2":`oklch(0.7 0.15 70)`,"chart-3":`oklch(0.55 0.15 330)`,"chart-4":`oklch(0.65 0.14 35)`,"chart-5":`oklch(0.5 0.16 280)`,sidebar:`oklch(0.96 0.02 303)`,"sidebar-foreground":`oklch(0.26 0.05 300)`,"sidebar-primary":`oklch(0.55 0.16 300)`,"sidebar-primary-foreground":`oklch(0.99 0.01 300)`,"sidebar-accent":`oklch(0.9 0.07 70)`,"sidebar-accent-foreground":`oklch(0.32 0.08 60)`,"sidebar-border":`oklch(0.87 0.03 305)`,"sidebar-ring":`oklch(0.55 0.16 300)`},dark:{background:`oklch(0.2 0.04 300)`,foreground:`oklch(0.95 0.02 305)`,card:`oklch(0.25 0.05 300)`,"card-foreground":`oklch(0.95 0.02 305)`,popover:`oklch(0.25 0.05 300)`,"popover-foreground":`oklch(0.95 0.02 305)`,primary:`oklch(0.72 0.15 300)`,"primary-foreground":`oklch(0.18 0.04 300)`,secondary:`oklch(0.3 0.05 305)`,"secondary-foreground":`oklch(0.95 0.02 305)`,muted:`oklch(0.3 0.04 303)`,"muted-foreground":`oklch(0.72 0.05 305)`,accent:`oklch(0.45 0.1 65)`,"accent-foreground":`oklch(0.96 0.02 70)`,border:`oklch(0.35 0.04 303)`,input:`oklch(0.35 0.04 303)`,ring:`oklch(0.72 0.15 300)`,"chart-1":`oklch(0.72 0.16 300)`,"chart-2":`oklch(0.78 0.14 70)`,"chart-3":`oklch(0.68 0.15 330)`,"chart-4":`oklch(0.72 0.13 35)`,"chart-5":`oklch(0.64 0.16 280)`,sidebar:`oklch(0.23 0.05 300)`,"sidebar-foreground":`oklch(0.95 0.02 305)`,"sidebar-primary":`oklch(0.72 0.15 300)`,"sidebar-primary-foreground":`oklch(0.18 0.04 300)`,"sidebar-accent":`oklch(0.45 0.1 65)`,"sidebar-accent-foreground":`oklch(0.96 0.02 70)`,"sidebar-border":`oklch(0.34 0.04 303)`,"sidebar-ring":`oklch(0.72 0.15 300)`}},radius:`1rem`,fontSans:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`}}];new Set(p3.map(e=>e.key));function m3(e){let t=e??localStorage.getItem(`oc.theme`)??`system`,n=()=>t===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:t,[r,i]=(0,z.useState)(n);return(0,z.useEffect)(()=>{if(i(n()),t!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>i(e.matches?`dark`:`light`);return e.addEventListener(`change`,r),()=>e.removeEventListener(`change`,r)},[t]),r}function Rxe(e,t){let n=document.documentElement.style,r=e?.colors?.[t];for(let e of Lxe){let t=r?.[e];t===void 0?n.removeProperty(`--`+e):n.setProperty(`--`+e,t)}e?.radius===void 0?n.removeProperty(`--radius`):n.setProperty(`--radius`,e.radius),e?.fontSans===void 0?n.removeProperty(`--ui-font-sans`):n.setProperty(`--ui-font-sans`,e.fontSans),e?.fontMono===void 0?n.removeProperty(`--ui-font-mono`):n.setProperty(`--ui-font-mono`,e.fontMono);let i=e?.bpm;i!==void 0&&i>0?n.setProperty(`--heart-period`,`${(60/Math.min(90,i)).toFixed(3)}s`):i===0?n.setProperty(`--heart-period`,`0s`):n.removeProperty(`--heart-period`)}function h3(e,t){(0,z.useEffect)(()=>{Rxe(e??null,t)},[e,t])}var g3=new Map,_3={active:!1,percent:0,count:0},v3=new Set;function y3(){let e=0,t=0;for(let n of g3.values())e+=n.loaded,t+=n.total;let n=g3.size;_3={active:n>0,percent:t>0?Math.min(100,Math.round(e/t*100)):0,count:n};for(let e of v3)e()}var b3={subscribe(e){return v3.add(e),()=>v3.delete(e)},getSnapshot(){return _3},report(e,t,n){g3.set(e,{loaded:t,total:n}),y3()},clear(e){g3.delete(e)&&y3()}},x3=0;function zxe(){x3+=1}function Bxe(){x3=Math.max(0,x3-1)}function Vxe(){return x3>0}var Hxe={phase:`idle`,model:null,voice:null,muted:!1,errorCode:null};function Uxe(e,t){switch(t){case`start`:return e===`idle`?`minting`:null;case`minted`:return e===`minting`?`connecting`:null;case`connected`:return e===`connecting`?`live`:null;case`hangup`:return e===`minting`||e===`connecting`||e===`live`?`ending`:null;case`failed`:return e===`minting`||e===`connecting`||e===`live`?`ending`:null;case`ended`:return e===`ending`?`idle`:null}}function Wxe(e,t){return t===null||t===``?e:`${e}${e.includes(`?`)?`&`:`?`}model=${encodeURIComponent(t)}`}async function Gxe(e,t,n=fetch){try{let r=await n(Wxe(e.offerUrl,e.model??null),{method:`POST`,headers:{Authorization:`Bearer ${e.clientSecret}`,"Content-Type":`application/sdp`},body:t});if(!r.ok)return{ok:!1,code:r.status===401?`talk_secret_expired`:`sdp_${r.status}`};let i=await r.text();return i.trim()===``?{ok:!1,code:`sdp_empty`}:{ok:!0,answerSdp:i}}catch{return{ok:!1,code:`sdp_unreachable`}}}var S3=[`marin`,`cedar`,`alloy`,`ash`,`ballad`,`coral`,`echo`,`sage`,`shimmer`,`verse`],C3=`oc.talk.voice`,w3=`oc.talk.vad`,T3=[{id:`low`,threshold:.8},{id:`medium`,threshold:.5},{id:`high`,threshold:.3}];function E3(e){return T3.some(t=>t.id===e)?e:``}function Kxe(e){let t=T3.find(t=>t.id===e);return t?t.threshold:null}function qxe(){try{return E3(localStorage.getItem(w3))}catch{return``}}function Jxe(e){try{E3(e)===``?localStorage.removeItem(w3):localStorage.setItem(w3,e)}catch{}}function D3(e){return S3.includes(e??``)?e:``}function Yxe(){try{return D3(localStorage.getItem(C3))}catch{return``}}function Xxe(e){try{D3(e)===``?localStorage.removeItem(C3):localStorage.setItem(C3,e)}catch{}}function Zxe(e){let t;try{let n=JSON.parse(e);if(typeof n!=`object`||!n)return null;t=n}catch{return null}let n,r,i;if(t.type===`response.output_item.done`){let e=t.item;if(!e||e.type!==`function_call`)return null;n=e.call_id,r=e.name,i=e.arguments}else if(t.type===`response.function_call_arguments.done`)n=t.call_id,r=t.name,i=t.arguments;else return null;if(typeof n!=`string`||n===``||typeof r!=`string`||r===``)return null;let a={};if(typeof i==`string`&&i!==``)try{let e=JSON.parse(i);typeof e==`object`&&e&&(a=e)}catch{}return{callId:n,name:r,args:a}}function Qxe(e){switch(e){case`talk_disabled`:return`talk_error_disabled`;case`talk_unsupported`:case`provider_unsupported`:return`talk_error_unsupported`;case`mic_denied`:return`talk_error_mic_denied`;case`talk_secret_expired`:return`talk_error_secret_expired`;default:return`talk_error_generic`}}function $xe(e){switch(Qxe(e)){case`talk_error_disabled`:return Vs();case`talk_error_unsupported`:return oc();case`talk_error_mic_denied`:return ta();case`talk_error_secret_expired`:return $n();case`talk_error_generic`:return`${Pp()} (${e})`}}function eSe({chatId:e}){let[t,n]=(0,z.useState)(Hxe),[r,i]=(0,z.useState)(()=>Yxe()),[a,o]=(0,z.useState)(()=>qxe()),s=I(L.talk.talkAvailable,{chatId:e}),c=Ei(L.talk.mintTalkSession),l=Ei(L.talk.relayTalkToolCall),u=qF(),d=(0,z.useRef)(0),f=(0,z.useRef)(`idle`),p=(0,z.useRef)({pc:null,mic:null}),m=(0,z.useRef)(null),h=(0,z.useCallback)(e=>{let t=Uxe(f.current,e);return t===null?null:(f.current=t,n(e=>({...e,phase:t})),t)},[]),g=(0,z.useCallback)(()=>{let e=p.current;try{e.mic?.getTracks().forEach(e=>e.stop())}catch{}try{e.pc?.close()}catch{}e.mic=null,e.pc=null,m.current&&(m.current.srcObject=null)},[]),_=(0,z.useCallback)(()=>{h(`hangup`)!==null&&(d.current++,g(),h(`ended`),n(e=>({...e,muted:!1})))},[h,g]);(0,z.useEffect)(()=>()=>{d.current++,g()},[g]);let v=(0,z.useCallback)(async()=>{if(h(`start`)===null)return;let t=++d.current;n(e=>({...e,errorCode:null,muted:!1}));let i=e=>{d.current===t&&(h(`failed`),g(),h(`ended`),n(t=>({...t,errorCode:e})),u.error($xe(e)))},o=Kxe(a),s=await c({chatId:e,...r===``?{}:{voice:r},...o===null?{}:{vadThreshold:o}});if(d.current!==t)return;if(!s.ok){i(s.code);return}let f;try{f=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{i(`mic_denied`);return}if(d.current!==t){f.getTracks().forEach(e=>e.stop());return}p.current.mic=f,n(e=>({...e,model:s.session.model,voice:s.session.voice})),h(`minted`);let _=new RTCPeerConnection;p.current.pc=_;for(let e of f.getTracks())_.addTrack(e,f);_.ontrack=e=>{d.current!==t||m.current===null||(m.current.srcObject=e.streams[0]??null)};let v=_.createDataChannel(`oai-events`),y=e=>{try{v.send(JSON.stringify(e))}catch{}},b=async n=>{if(n.name!==`openclaw_agent_consult`){y({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:n.callId,output:`Task-control is not available in this interface yet; tell the user so.`}}),y({type:`response.create`});return}y({type:`response.create`,response:{instructions:`Briefly tell the user, in their language, that you are checking with the agent. Do not invent the result.`}});let r=await l({chatId:e,callId:n.callId,args:{question:typeof n.args.question==`string`?n.args.question:``,...typeof n.args.context==`string`?{context:n.args.context}:{},...typeof n.args.responseStyle==`string`?{responseStyle:n.args.responseStyle}:{}}}).catch(()=>({ok:!1,code:`relay_failed`}));if(d.current!==t)return;let i=r.ok?r.pending?`The agent is still working on it. Tell the user the task continues and its result will arrive in the conversation.`:typeof r.errorText==`string`?`The agent run failed: ${r.errorText}`:r.resultText??``:`The agent could not be reached (${r.code}). Tell the user and suggest typing the request in the conversation instead.`;y({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:n.callId,output:i===``?`(the agent returned an empty result)`:i}}),y({type:`response.create`})},x=new Set;v.onmessage=e=>{if(d.current!==t)return;let n=Zxe(typeof e.data==`string`?e.data:``);n===null||x.has(n.callId)||(x.add(n.callId),b(n))},_.onconnectionstatechange=()=>{d.current===t&&_.connectionState===`failed`&&i(`rtc_lost`)};try{let e=await _.createOffer();if(await _.setLocalDescription(e),d.current!==t)return;let n=await Gxe(s.session,e.sdp??``);if(d.current!==t)return;if(!n.ok){i(n.code);return}await _.setRemoteDescription({type:`answer`,sdp:n.answerSdp})}catch{i(`rtc_setup`);return}d.current===t&&h(`connected`)},[h,e,c,g,r,a]),y=(0,z.useCallback)(()=>{let e=p.current.mic;if(e===null)return;let r=!t.muted;for(let t of e.getAudioTracks())t.enabled=!r;n(e=>({...e,muted:r}))},[t.muted]),x=t.phase;return x===`idle`&&s!==!0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`audio`,{ref:m,autoPlay:!0,className:`oc-talk__audio`}),x===`idle`?(0,B.jsxs)(`span`,{className:`oc-talk__pill`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__pillmain`,title:Bf(),"aria-label":Bf(),onClick:()=>void v(),children:(0,B.jsx)(Sy,{size:16,"aria-hidden":!0})}),(0,B.jsxs)(hF,{children:[(0,B.jsx)(gF,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__pillchev`,title:Cs(),"aria-label":Cs(),children:(0,B.jsx)(Ay,{size:13,"aria-hidden":!0})})}),(0,B.jsxs)(_F,{align:`end`,className:`oc-talk__settings`,children:[(0,B.jsxs)(`label`,{className:`oc-talk__setting`,children:[(0,B.jsx)(`span`,{className:`oc-talk__settinglabel`,children:yr()}),(0,B.jsxs)(_0,{value:r===``?`__default__`:r,onValueChange:e=>{let t=e===`__default__`?``:e;i(t),Xxe(t)},children:[(0,B.jsx)(y0,{size:`sm`,"aria-label":yr(),children:(0,B.jsx)(v0,{})}),(0,B.jsxs)(b0,{children:[(0,B.jsx)(x0,{value:`__default__`,children:Jt()}),S3.map(e=>(0,B.jsx)(x0,{value:e,children:e},e))]})]})]}),(0,B.jsxs)(`label`,{className:`oc-talk__setting`,children:[(0,B.jsx)(`span`,{className:`oc-talk__settinglabel`,children:Bo()}),(0,B.jsxs)(_0,{value:a===``?`__default__`:a,onValueChange:e=>{let t=e===`__default__`?``:e;o(t),Jxe(t)},children:[(0,B.jsx)(y0,{size:`sm`,"aria-label":Bo(),children:(0,B.jsx)(v0,{})}),(0,B.jsxs)(b0,{children:[(0,B.jsx)(x0,{value:`__default__`,children:mn()}),T3.map(e=>(0,B.jsx)(x0,{value:e.id,children:e.id===`low`?rs():e.id===`medium`?ve():Xee()},e.id))]})]})]})]})]})]}):(0,B.jsxs)(`span`,{className:`oc-talk${x===`live`?` oc-talk--live`:``}`,role:`status`,children:[(0,B.jsx)(`i`,{className:`oc-talk__dot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-talk__label`,children:x===`live`?t.voice||b():cu()}),x===`live`?(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__btn`,title:t.muted?Cc():ba(),"aria-label":t.muted?Cc():ba(),"aria-pressed":t.muted,onClick:y,children:t.muted?(0,B.jsx)(bb,{size:14,"aria-hidden":!0}):(0,B.jsx)(xb,{size:14,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__btn oc-talk__btn--end`,title:xm(),"aria-label":xm(),onClick:_,children:(0,B.jsx)(Mb,{size:14,"aria-hidden":!0})})]})]})}function tSe(e,t){if(!e)return null;let n=e.logoLightHasAlpha&&e.logoLightUrl||e.logoDarkHasAlpha&&e.logoDarkUrl||null;if(n)return{url:n,masked:!0};let r=O3(e,t);return r?{url:r,masked:!1}:null}function O3(e,t){return(t===`dark`?e?.logoDarkUrl:e?.logoLightUrl)??(t===`dark`?e?.logoLightUrl:e?.logoDarkUrl)??null}function k3(e){if(!e)return null;let t=/oklch\(\s*([0-9]*\.?[0-9]+)(%?)/i.exec(e);if(!t)return null;let n=parseFloat(t[1]);return Number.isFinite(n)?t[2]===`%`?n/100:n:null}function nSe(e,t,n){let r=k3(e),i=k3(t);return r===null||i===null?n:i>r?`dark`:`light`}function rSe(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function A3({className:e}){return(0,B.jsxs)(`svg`,{className:e,viewBox:`0 0 64 64`,fill:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M25 15H15V49H25`,stroke:`currentColor`,strokeWidth:`6.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,B.jsx)(`path`,{d:`M39 15H49V49H39`,stroke:`currentColor`,strokeWidth:`6.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,B.jsx)(`polyline`,{points:`20 33 26 33 29 25 33 41 37 29 41 33 44 33`,stroke:`currentColor`,strokeWidth:`3.4`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}var j3=(0,z.createContext)({label:`Atrium`,logoUrl:null,logoMasked:!1,isDefault:!0,initials:`A`,agentName:null,agentEmoji:null});function M3(){return(0,z.useContext)(j3)}function N3(e){return e.agentName??e.label}function iSe(e){return e.agentName?nt({name:e.agentName}):Ve({name:e.label})}function P3(e){let t=new Map;for(let n of e){let e=t.get(n.instanceName);e||(e={instanceName:n.instanceName,kind:n.kind,agents:[]},t.set(n.instanceName,e)),e.agents.push(n)}let n=e=>(e.displayName??e.agentId).toLowerCase();for(let e of t.values())e.agents.sort((e,t)=>e.isDefault===t.isDefault?n(e).localeCompare(n(t)):e.isDefault?-1:1);let r=[...t.values()],i=e=>e.agents.some(e=>e.isDefault);return r.sort((e,t)=>i(e)===i(t)?e.instanceName.localeCompare(t.instanceName):i(e)?-1:1),r}function F3(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.displayName,e.agentId,e.instanceName,e.model,e.description].filter(Boolean).some(e=>e.toLowerCase().includes(n))):e}function aSe({open:e,onOpenChange:t,agents:n,onPick:r}){let[i,a]=(0,z.useState)(``),o=(0,z.useMemo)(()=>P3(F3(n??[],i)),[n,i]);return(0,B.jsx)(d0,{open:e,onOpenChange:t,children:(0,B.jsxs)(f0,{className:`oc-agentpicker`,children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:Ct()}),(0,B.jsx)(g0,{children:Zi()})]}),n===void 0?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:gi()}):n.length===0?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Zr()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(TF,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:Cd(),className:`oc-agentpicker__search`,"aria-label":j()}),(0,B.jsx)(`div`,{className:`oc-agentpicker__list`,role:`listbox`,children:o.map(e=>(0,B.jsxs)(`div`,{className:`oc-agentpicker__group`,children:[(0,B.jsxs)(`div`,{className:`oc-agentpicker__instance`,children:[(0,B.jsx)(Ub,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e.instanceName}),(0,B.jsx)(YF,{variant:`outline`,className:`oc-agentpicker__kind`,children:e.kind})]}),e.agents.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":!1,className:`oc-agentpicker__item`,onClick:()=>r(e.instanceName,e.agentId),disabled:e.state===`deleted`,title:e.state===`deleted`?Bd():void 0,children:[(0,B.jsx)(Ey,{size:15,"aria-hidden":!0,className:`oc-agentpicker__icon`}),(0,B.jsxs)(`span`,{className:`oc-agentpicker__main`,children:[(0,B.jsxs)(`span`,{className:`oc-agentpicker__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.description?(0,B.jsx)(`span`,{className:`oc-agentpicker__desc`,children:e.description}):null]}),e.model?(0,B.jsx)(`span`,{className:`oc-agentpicker__model`,children:e.model}):null,e.isDefault?(0,B.jsx)(Yb,{size:13,"aria-label":Ni(),className:`oc-agentpicker__default`}):null]},`${e.instanceName}/${e.agentId}`))]},e.instanceName))})]})]})})}function I3(e,t){return e===null||t===null?e===t:e.instanceName===t.instanceName&&e.agentId===t.agentId}function L3(e){return e.routedInstanceName&&e.routedAgentId?{instanceName:e.routedInstanceName,agentId:e.routedAgentId}:null}function oSe(e){let t=new Map,n=null;for(let r of e){let e=L3(r);r.role===`user`?(n=e,t.set(r._id,e)):r.role===`assistant`?t.set(r._id,e??n):t.set(r._id,e)}return t}function sSe(e){for(let t=e.length-1;t>=0;t--){let n=L3(e[t]);if(n)return n}return null}function cSe(e){return e===void 0?!1:!e.some(e=>e.role===`user`)}function R3(e,t){if(!t)return!1;let n=e.find(e=>I3(e,t));return n!==void 0&&n.state!==`deleted`}function lSe(e){let{lastRouted:t,primary:n,pool:r}=e,i=e=>({instanceName:e.instanceName,agentId:e.agentId});if(R3(r,t))return i(t);if(R3(r,n))return i(n);let a=r.filter(e=>e.state!==`deleted`);return a.length===0?null:i(a.find(e=>e.isDefault)??a[0])}function z3(e){let{selected:t,lastRouted:n,primary:r,pool:i,poolLoading:a,messagesLoading:o,canRoute:s}=e;if(!s)return null;let c=t??n;return a||o?c??r:lSe({lastRouted:c,primary:r,pool:i})}function uSe(e){let{hasUserTurn:t,emptyThread:n,readOnly:r,multiAgent:i,poolSize:a}=e,o=n?{disabled:!1,mode:`rebind`}:t&&!r?{disabled:!1,mode:`route`}:{disabled:!0,mode:`route`},s=o.mode===`rebind`&&!o.disabled;return{hidden:a===0||!i&&!s,...o}}function B3(e,t){if(!t)return null;let n=e.find(e=>I3(e,t));return n?{displayName:n.displayName,emoji:n.emoji}:null}function dSe(e){let{selected:t,primary:n,perTurnRouting:r,isFirstTurn:i,canRoute:a}=e;if(a&&t&&!i&&(r||!I3(t,n)))return t}function fSe(e){let t=new Map,n=null;for(let r of e){if(r.role===`user`){n=r.importedAgentLabel??null,t.set(r._id,n??r.chatImportedAgentLabel??null);continue}t.set(r._id,r.importedAgentLabel??n??r.chatImportedAgentLabel??null)}return t}var pSe={user:Pf(),assistant:`OpenClaw`,system:gm()},mSe=ru();function V3(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)+` UTC`}function H3(e){return e?e.filter(e=>e.kind===`file`||e.kind===`media`).map(e=>e.filename).filter(e=>typeof e==`string`&&e.length>0):[]}function hSe(e,t={}){let n=[];n.push(`# ${t.title?.trim()||h()}`),t.exportedAt!=null&&(n.push(``),n.push(`_${ha({date:V3(t.exportedAt)})}_`)),t.truncated&&(n.push(``),n.push(mSe));for(let t of e){n.push(``),n.push(`## ${pSe[t.role]} · ${V3(t.createdAt)}`);for(let e of t.quotedExcerpts??[])e!==``&&(n.push(``),n.push(`> ${dr()} : ${e}`));let e=t.text.trim();e.length>0&&(n.push(``),n.push(e));for(let e of H3(t.parts))n.push(``),n.push(vc({name:e}))}return n.join(`
|
|
305
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function j4(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:N4(t,`input`,e.processors),output:N4(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function M4(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return M4(r.element,n);if(r.type===`set`)return M4(r.valueType,n);if(r.type===`lazy`)return M4(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return M4(r.innerType,n);if(r.type===`intersection`)return M4(r.left,n)||M4(r.right,n);if(r.type===`record`||r.type===`map`)return M4(r.keyType,n)||M4(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:M4(r.in,n)||M4(r.out,n);if(r.type===`object`){for(let e in r.shape)if(M4(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(M4(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(M4(e,n))return!0;return!!(r.rest&&M4(r.rest,n))}return!1}var Uye=(e,t={})=>n=>{let r=O4({...n,processors:t});return k4(e,r),A4(r,e),j4(r,e)},N4=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=O4({...i??{},target:a,io:t,processors:n});return k4(e,o),A4(o,e),j4(o,e)},Wye={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Gye=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Wye[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Kye=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},qye=(e,t,n,r)=>{n.not={}},Jye=(e,t,n,r)=>{let i=e._zod.def,a=f2(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Yye=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Xye=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Zye=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Qye=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=k4(a.element,t,{...r,path:[...r.path,`items`]})},$ye=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=k4(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=k4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ebe=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>k4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},tbe=(e,t,n,r)=>{let i=e._zod.def,a=k4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=k4(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},nbe=(e,t,n,r)=>{let i=e._zod.def,a=k4(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},rbe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ibe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},abe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},obe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},sbe=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;k4(o,t,r);let s=t.seen.get(e);s.ref=o},cbe=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},P4=(e,t,n,r)=>{let i=e._zod.def;k4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lbe=$(`ZodISODateTime`,(e,t)=>{gve.init(e,t),V4.init(e,t)});function ube(e){return bye(lbe,e)}var dbe=$(`ZodISODate`,(e,t)=>{_ve.init(e,t),V4.init(e,t)});function fbe(e){return xye(dbe,e)}var pbe=$(`ZodISOTime`,(e,t)=>{vve.init(e,t),V4.init(e,t)});function mbe(e){return Sye(pbe,e)}var hbe=$(`ZodISODuration`,(e,t)=>{yve.init(e,t),V4.init(e,t)});function gbe(e){return Cye(hbe,e)}var F4=$(`ZodError`,(e,t)=>{I2.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>c_e(e,t)},flatten:{value:t=>s_e(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,p2,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,p2,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),_be=R2(F4),vbe=z2(F4),ybe=B2(F4),bbe=V2(F4),xbe=d_e(F4),Sbe=f_e(F4),Cbe=p_e(F4),wbe=m_e(F4),Tbe=h_e(F4),Ebe=g_e(F4),Dbe=__e(F4),Obe=v_e(F4),I4=new WeakMap;function L4(e,t,n){let r=Object.getPrototypeOf(e),i=I4.get(r);if(i||(i=new Set,I4.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var R4=$(`ZodType`,(e,t)=>(Z2.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:N4(e,`input`),output:N4(e,`output`)}}),e.toJSONSchema=Uye(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>_be(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ybe(e,t,n),e.parseAsync=async(t,n)=>vbe(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>bbe(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>xbe(e,t,n),e.decode=(t,n)=>Sbe(e,t,n),e.encodeAsync=async(t,n)=>Cbe(e,t,n),e.decodeAsync=async(t,n)=>wbe(e,t,n),e.safeEncode=(t,n)=>Tbe(e,t,n),e.safeDecode=(t,n)=>Ebe(e,t,n),e.safeEncodeAsync=async(t,n)=>Dbe(e,t,n),e.safeDecodeAsync=async(t,n)=>Obe(e,t,n),L4(e,`ZodType`,{check(...e){let t=this.def;return this.clone(b2(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return D2(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(bxe(e,t))},superRefine(e,t){return this.check(xxe(e,t))},overwrite(e){return this.check(D4(e))},optional(){return $4(this)},exactOptional(){return sxe(this)},nullable(){return e3(this)},nullish(){return $4(e3(this))},nonoptional(e){return pxe(this,e)},array(){return Qbe(this)},or(e){return J4([this,e])},and(e){return nxe(this,e)},transform(e){return n3(this,axe(e))},default(e){return uxe(this,e)},prefault(e){return fxe(this,e)},catch(e){return hxe(this,e)},pipe(e){return n3(this,e)},readonly(){return vxe(this)},describe(e){let t=this.clone();return _4.add(t,{description:e}),t},meta(...e){if(e.length===0)return _4.get(this);let t=this.clone();return _4.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return _4.get(e)?.description},configurable:!0}),e)),z4=$(`_ZodString`,(e,t)=>{Q2.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gye(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,L4(e,`_ZodString`,{regex(...e){return this.check(Oye(...e))},includes(...e){return this.check(jye(...e))},startsWith(...e){return this.check(Mye(...e))},endsWith(...e){return this.check(Nye(...e))},min(...e){return this.check(T4(...e))},max(...e){return this.check(w4(...e))},length(...e){return this.check(E4(...e))},nonempty(...e){return this.check(T4(1,...e))},lowercase(e){return this.check(kye(e))},uppercase(e){return this.check(Aye(e))},trim(){return this.check(Fye())},normalize(...e){return this.check(Pye(...e))},toLowerCase(){return this.check(Iye())},toUpperCase(){return this.check(Lye())},slugify(){return this.check(Rye())}})}),kbe=$(`ZodString`,(e,t)=>{Q2.init(e,t),z4.init(e,t),e.email=t=>e.check($ve(Abe,t)),e.url=t=>e.check(iye(jbe,t)),e.jwt=t=>e.check(yye(Kbe,t)),e.emoji=t=>e.check(aye(Mbe,t)),e.guid=t=>e.check(v4(H4,t)),e.uuid=t=>e.check(eye(U4,t)),e.uuidv4=t=>e.check(tye(U4,t)),e.uuidv6=t=>e.check(nye(U4,t)),e.uuidv7=t=>e.check(rye(U4,t)),e.nanoid=t=>e.check(oye(Nbe,t)),e.guid=t=>e.check(v4(H4,t)),e.cuid=t=>e.check(sye(Pbe,t)),e.cuid2=t=>e.check(cye(Fbe,t)),e.ulid=t=>e.check(lye(Ibe,t)),e.base64=t=>e.check(gye(Ube,t)),e.base64url=t=>e.check(_ye(Wbe,t)),e.xid=t=>e.check(uye(Lbe,t)),e.ksuid=t=>e.check(dye(Rbe,t)),e.ipv4=t=>e.check(fye(zbe,t)),e.ipv6=t=>e.check(pye(Bbe,t)),e.cidrv4=t=>e.check(mye(Vbe,t)),e.cidrv6=t=>e.check(hye(Hbe,t)),e.e164=t=>e.check(vye(Gbe,t)),e.datetime=t=>e.check(ube(t)),e.date=t=>e.check(fbe(t)),e.time=t=>e.check(mbe(t)),e.duration=t=>e.check(gbe(t))});function B4(e){return Qve(kbe,e)}var V4=$(`ZodStringFormat`,(e,t)=>{$2.init(e,t),z4.init(e,t)}),Abe=$(`ZodEmail`,(e,t)=>{sve.init(e,t),V4.init(e,t)}),H4=$(`ZodGUID`,(e,t)=>{ave.init(e,t),V4.init(e,t)}),U4=$(`ZodUUID`,(e,t)=>{ove.init(e,t),V4.init(e,t)}),jbe=$(`ZodURL`,(e,t)=>{cve.init(e,t),V4.init(e,t)}),Mbe=$(`ZodEmoji`,(e,t)=>{lve.init(e,t),V4.init(e,t)}),Nbe=$(`ZodNanoID`,(e,t)=>{uve.init(e,t),V4.init(e,t)}),Pbe=$(`ZodCUID`,(e,t)=>{dve.init(e,t),V4.init(e,t)}),Fbe=$(`ZodCUID2`,(e,t)=>{fve.init(e,t),V4.init(e,t)}),Ibe=$(`ZodULID`,(e,t)=>{pve.init(e,t),V4.init(e,t)}),Lbe=$(`ZodXID`,(e,t)=>{mve.init(e,t),V4.init(e,t)}),Rbe=$(`ZodKSUID`,(e,t)=>{hve.init(e,t),V4.init(e,t)}),zbe=$(`ZodIPv4`,(e,t)=>{bve.init(e,t),V4.init(e,t)}),Bbe=$(`ZodIPv6`,(e,t)=>{xve.init(e,t),V4.init(e,t)}),Vbe=$(`ZodCIDRv4`,(e,t)=>{Sve.init(e,t),V4.init(e,t)}),Hbe=$(`ZodCIDRv6`,(e,t)=>{Cve.init(e,t),V4.init(e,t)}),Ube=$(`ZodBase64`,(e,t)=>{wve.init(e,t),V4.init(e,t)}),Wbe=$(`ZodBase64URL`,(e,t)=>{Eve.init(e,t),V4.init(e,t)}),Gbe=$(`ZodE164`,(e,t)=>{Dve.init(e,t),V4.init(e,t)}),Kbe=$(`ZodJWT`,(e,t)=>{kve.init(e,t),V4.init(e,t)}),W4=$(`ZodNumber`,(e,t)=>{t4.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kye(e,t,n,r),L4(e,`ZodNumber`,{gt(e,t){return this.check(x4(e,t))},gte(e,t){return this.check(S4(e,t))},min(e,t){return this.check(S4(e,t))},lt(e,t){return this.check(y4(e,t))},lte(e,t){return this.check(b4(e,t))},max(e,t){return this.check(b4(e,t))},int(e){return this.check(G4(e))},safe(e){return this.check(G4(e))},positive(e){return this.check(x4(0,e))},nonnegative(e){return this.check(S4(0,e))},negative(e){return this.check(y4(0,e))},nonpositive(e){return this.check(b4(0,e))},multipleOf(e,t){return this.check(C4(e,t))},step(e,t){return this.check(C4(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}),qbe=$(`ZodNumberFormat`,(e,t)=>{Ave.init(e,t),W4.init(e,t)});function G4(e){return Tye(qbe,e)}var Jbe=$(`ZodUnknown`,(e,t)=>{jve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function K4(){return Eye(Jbe)}var Ybe=$(`ZodNever`,(e,t)=>{Mve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qye(e,t,n,r)});function Xbe(e){return Dye(Ybe,e)}var Zbe=$(`ZodArray`,(e,t)=>{Nve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qye(e,t,n,r),e.element=t.element,L4(e,`ZodArray`,{min(e,t){return this.check(T4(e,t))},nonempty(e){return this.check(T4(1,e))},max(e,t){return this.check(w4(e,t))},length(e,t){return this.check(E4(e,t))},unwrap(){return this.element}})});function Qbe(e,t){return zye(Zbe,e,t)}var $be=$(`ZodObject`,(e,t)=>{Fve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$ye(e,t,n,r),v2(e,`shape`,()=>t.shape),L4(e,`ZodObject`,{keyof(){return X4(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:K4()})},loose(){return this.clone({...this._zod.def,catchall:K4()})},strict(){return this.clone({...this._zod.def,catchall:Xbe()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return t_e(this,e)},safeExtend(e){return n_e(this,e)},merge(e){return r_e(this,e)},pick(e){return $ge(this,e)},omit(e){return e_e(this,e)},partial(...e){return i_e(Q4,this,e[0])},required(...e){return a_e(t3,this,e[0])}})});function q4(e,t){return new $be({type:`object`,shape:e??{},...O2(t)})}var exe=$(`ZodUnion`,(e,t)=>{Ive.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ebe(e,t,n,r),e.options=t.options});function J4(e,t){return new exe({type:`union`,options:e,...O2(t)})}var txe=$(`ZodIntersection`,(e,t)=>{Lve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tbe(e,t,n,r)});function nxe(e,t){return new txe({type:`intersection`,left:e,right:t})}var Y4=$(`ZodEnum`,(e,t)=>{Rve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jye(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Y4({...t,checks:[],...O2(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Y4({...t,checks:[],...O2(r),entries:i})}});function X4(e,t){return new Y4({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O2(t)})}var rxe=$(`ZodLiteral`,(e,t)=>{zve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yye(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Z4(e,t){return new rxe({type:`literal`,values:Array.isArray(e)?e:[e],...O2(t)})}var ixe=$(`ZodTransform`,(e,t)=>{Bve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zye(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l2(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(P2(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(P2(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function axe(e){return new ixe({type:`transform`,transform:e})}var Q4=$(`ZodOptional`,(e,t)=>{u4.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>P4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $4(e){return new Q4({type:`optional`,innerType:e})}var oxe=$(`ZodExactOptional`,(e,t)=>{Vve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>P4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sxe(e){return new oxe({type:`optional`,innerType:e})}var cxe=$(`ZodNullable`,(e,t)=>{Hve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nbe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function e3(e){return new cxe({type:`nullable`,innerType:e})}var lxe=$(`ZodDefault`,(e,t)=>{Uve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ibe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function uxe(e,t){return new lxe({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():T2(t)}})}var dxe=$(`ZodPrefault`,(e,t)=>{Wve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>abe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fxe(e,t){return new dxe({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():T2(t)}})}var t3=$(`ZodNonOptional`,(e,t)=>{Gve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rbe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pxe(e,t){return new t3({type:`nonoptional`,innerType:e,...O2(t)})}var mxe=$(`ZodCatch`,(e,t)=>{Kve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>obe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hxe(e,t){return new mxe({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var gxe=$(`ZodPipe`,(e,t)=>{qve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sbe(e,t,n,r),e.in=t.in,e.out=t.out});function n3(e,t){return new gxe({type:`pipe`,in:e,out:t})}var _xe=$(`ZodReadonly`,(e,t)=>{Jve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cbe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vxe(e){return new _xe({type:`readonly`,innerType:e})}var yxe=$(`ZodCustom`,(e,t)=>{Yve.init(e,t),R4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xye(e,t,n,r)});function bxe(e,t={}){return Bye(yxe,e,t)}function xxe(e,t){return Vye(e,t)}function Sxe(e){return wye(W4,e)}var r3=`atrium:lastChatId`;function Cxe(e){try{localStorage.setItem(r3,e)}catch{}}function wxe(){try{return localStorage.getItem(r3)}catch{return null}}function Txe(e){let t=e instanceof Error?`${e.name}: ${e.message}`:String(e??``);return t.includes(`Failed to fetch dynamically imported module`)||t.includes(`Importing a module script failed`)||t.includes(`error loading dynamically imported module`)||t.includes(`Unable to preload CSS`)}var i3=`atrium:chunkReloadAt`,Exe=6e4;function Dxe(){try{return typeof sessionStorage>`u`?null:sessionStorage}catch{return null}}function Oxe(e,t=Dxe()){if(t===null)return!1;try{let n=Number(t.getItem(i3)??0);return Number.isFinite(n)&&e-n<Exe?!1:(t.setItem(i3,String(e)),!0)}catch{return!1}}function a3(e){return new Map(e.map(e=>[e._id,e]))}function o3(e,t){let n=t.parentId??null;return n===null?null:e.has(n)?n:null}function s3(e){return[...e].sort((e,t)=>(e.sortKey??0)-(t.sortKey??0))}function kxe(e){let t=a3(e);return s3(e.filter(e=>o3(t,e)===null))}function c3(e,t){let n=a3(e);return s3(e.filter(e=>o3(n,e)===t))}function Axe(e,t){let n=a3(e);if(!n.has(t))return[];let r=new Map;for(let t of e){let e=o3(n,t);if(e===null)continue;let i=r.get(e);i===void 0?r.set(e,[t._id]):i.push(t._id)}let i=[],a=new Set,o=[t];for(;o.length>0;){let e=o.shift();if(!a.has(e)){a.add(e),i.push(e);for(let t of r.get(e)??[])o.push(t)}}return i}function jxe(e,t,n){return n===null?!1:n===t?!0:Axe(e,t).includes(n)}function l3(e,t,n){return!(jxe(e,t,n)||!e.some(e=>e._id===t)||n!==null&&!e.some(e=>e._id===n))}function u3(e,t){let n=a3(e),r=n.get(t);if(r===void 0)return[];let i=new Set([t]),a=[r];for(;;){let e=o3(n,r);if(e===null||i.has(e))return a.reverse();i.add(e),r=n.get(e),a.push(r)}}function Mxe(e,t){let n=u3(e,t);return n.length>0?n[0]._id:t}function Nxe(e){let t=[],n=(r,i)=>{for(let a of c3(e,r))t.push({node:a,depth:i}),n(a._id,i+1)};return n(null,1),t}var d3=typeof window<`u`&&window.location?window.location.hostname:``,f3=e=>`oc.brand.${e}`;function Pxe(e){if(typeof e!=`object`||!e||Array.isArray(e)||!(`tokens`in e))return!1;let t=e.tokens;if(t===null)return!0;if(typeof t!=`object`)return!1;let n=t.colors;return typeof n==`object`&&!!n&&`light`in n&&`dark`in n}function Fxe(e){try{let t=localStorage.getItem(f3(e));if(!t)return null;let n=JSON.parse(t);return Pxe(n)?n:null}catch{return null}}function Ixe(e,t){try{localStorage.setItem(f3(e),JSON.stringify(t))}catch{}}var Lxe=`background.foreground.card.card-foreground.popover.popover-foreground.primary.primary-foreground.secondary.secondary-foreground.muted.muted-foreground.accent.accent-foreground.destructive.destructive-foreground.border.input.ring.chart-1.chart-2.chart-3.chart-4.chart-5.sidebar.sidebar-foreground.sidebar-primary.sidebar-primary-foreground.sidebar-accent.sidebar-accent-foreground.sidebar-border.sidebar-ring.highlight.bookmark.voice`.split(`.`),p3=[{key:`ocean`,name:`Ocean`,tokens:{colors:{light:{background:`oklch(0.985 0.012 230)`,foreground:`oklch(0.22 0.04 245)`,card:`oklch(0.995 0.008 230)`,"card-foreground":`oklch(0.22 0.04 245)`,popover:`oklch(0.995 0.008 230)`,"popover-foreground":`oklch(0.22 0.04 245)`,primary:`oklch(0.55 0.13 235)`,"primary-foreground":`oklch(0.99 0.01 230)`,secondary:`oklch(0.93 0.03 220)`,"secondary-foreground":`oklch(0.28 0.05 240)`,muted:`oklch(0.94 0.02 225)`,"muted-foreground":`oklch(0.5 0.04 235)`,accent:`oklch(0.9 0.05 200)`,"accent-foreground":`oklch(0.28 0.06 230)`,border:`oklch(0.88 0.03 225)`,input:`oklch(0.88 0.03 225)`,ring:`oklch(0.55 0.13 235)`,"chart-1":`oklch(0.6 0.13 235)`,"chart-2":`oklch(0.65 0.12 200)`,"chart-3":`oklch(0.55 0.1 260)`,"chart-4":`oklch(0.7 0.11 180)`,"chart-5":`oklch(0.5 0.12 215)`,sidebar:`oklch(0.96 0.02 228)`,"sidebar-foreground":`oklch(0.24 0.04 245)`,"sidebar-primary":`oklch(0.55 0.13 235)`,"sidebar-primary-foreground":`oklch(0.99 0.01 230)`,"sidebar-accent":`oklch(0.9 0.05 200)`,"sidebar-accent-foreground":`oklch(0.28 0.06 230)`,"sidebar-border":`oklch(0.87 0.03 225)`,"sidebar-ring":`oklch(0.55 0.13 235)`},dark:{background:`oklch(0.2 0.03 245)`,foreground:`oklch(0.95 0.02 225)`,card:`oklch(0.25 0.04 245)`,"card-foreground":`oklch(0.95 0.02 225)`,popover:`oklch(0.25 0.04 245)`,"popover-foreground":`oklch(0.95 0.02 225)`,primary:`oklch(0.7 0.12 230)`,"primary-foreground":`oklch(0.18 0.04 245)`,secondary:`oklch(0.3 0.04 240)`,"secondary-foreground":`oklch(0.95 0.02 225)`,muted:`oklch(0.3 0.03 242)`,"muted-foreground":`oklch(0.72 0.04 228)`,accent:`oklch(0.4 0.07 210)`,"accent-foreground":`oklch(0.96 0.02 220)`,border:`oklch(0.35 0.03 242)`,input:`oklch(0.35 0.03 242)`,ring:`oklch(0.7 0.12 230)`,"chart-1":`oklch(0.7 0.13 230)`,"chart-2":`oklch(0.72 0.12 195)`,"chart-3":`oklch(0.65 0.11 260)`,"chart-4":`oklch(0.76 0.1 180)`,"chart-5":`oklch(0.62 0.12 215)`,sidebar:`oklch(0.23 0.04 246)`,"sidebar-foreground":`oklch(0.95 0.02 225)`,"sidebar-primary":`oklch(0.7 0.12 230)`,"sidebar-primary-foreground":`oklch(0.18 0.04 245)`,"sidebar-accent":`oklch(0.4 0.07 210)`,"sidebar-accent-foreground":`oklch(0.96 0.02 220)`,"sidebar-border":`oklch(0.34 0.03 242)`,"sidebar-ring":`oklch(0.7 0.12 230)`}},radius:`0.75rem`,fontSans:`ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif`}},{key:`forest`,name:`Forest`,tokens:{colors:{light:{background:`oklch(0.985 0.012 130)`,foreground:`oklch(0.24 0.04 145)`,card:`oklch(0.995 0.008 130)`,"card-foreground":`oklch(0.24 0.04 145)`,popover:`oklch(0.995 0.008 130)`,"popover-foreground":`oklch(0.24 0.04 145)`,primary:`oklch(0.52 0.12 150)`,"primary-foreground":`oklch(0.99 0.01 130)`,secondary:`oklch(0.93 0.04 130)`,"secondary-foreground":`oklch(0.3 0.05 150)`,muted:`oklch(0.94 0.03 135)`,"muted-foreground":`oklch(0.5 0.04 145)`,accent:`oklch(0.9 0.06 115)`,"accent-foreground":`oklch(0.3 0.06 150)`,border:`oklch(0.88 0.03 135)`,input:`oklch(0.88 0.03 135)`,ring:`oklch(0.52 0.12 150)`,"chart-1":`oklch(0.58 0.13 150)`,"chart-2":`oklch(0.68 0.12 120)`,"chart-3":`oklch(0.6 0.11 95)`,"chart-4":`oklch(0.55 0.1 175)`,"chart-5":`oklch(0.5 0.12 140)`,sidebar:`oklch(0.96 0.02 132)`,"sidebar-foreground":`oklch(0.26 0.04 145)`,"sidebar-primary":`oklch(0.52 0.12 150)`,"sidebar-primary-foreground":`oklch(0.99 0.01 130)`,"sidebar-accent":`oklch(0.9 0.06 115)`,"sidebar-accent-foreground":`oklch(0.3 0.06 150)`,"sidebar-border":`oklch(0.87 0.03 135)`,"sidebar-ring":`oklch(0.52 0.12 150)`},dark:{background:`oklch(0.2 0.03 150)`,foreground:`oklch(0.95 0.02 130)`,card:`oklch(0.25 0.04 150)`,"card-foreground":`oklch(0.95 0.02 130)`,popover:`oklch(0.25 0.04 150)`,"popover-foreground":`oklch(0.95 0.02 130)`,primary:`oklch(0.68 0.13 145)`,"primary-foreground":`oklch(0.18 0.04 150)`,secondary:`oklch(0.3 0.04 148)`,"secondary-foreground":`oklch(0.95 0.02 130)`,muted:`oklch(0.3 0.03 150)`,"muted-foreground":`oklch(0.72 0.04 135)`,accent:`oklch(0.4 0.07 120)`,"accent-foreground":`oklch(0.96 0.02 125)`,border:`oklch(0.35 0.03 148)`,input:`oklch(0.35 0.03 148)`,ring:`oklch(0.68 0.13 145)`,"chart-1":`oklch(0.68 0.14 148)`,"chart-2":`oklch(0.74 0.12 120)`,"chart-3":`oklch(0.68 0.11 95)`,"chart-4":`oklch(0.62 0.1 175)`,"chart-5":`oklch(0.6 0.12 140)`,sidebar:`oklch(0.23 0.04 150)`,"sidebar-foreground":`oklch(0.95 0.02 130)`,"sidebar-primary":`oklch(0.68 0.13 145)`,"sidebar-primary-foreground":`oklch(0.18 0.04 150)`,"sidebar-accent":`oklch(0.4 0.07 120)`,"sidebar-accent-foreground":`oklch(0.96 0.02 125)`,"sidebar-border":`oklch(0.34 0.03 148)`,"sidebar-ring":`oklch(0.68 0.13 145)`}},radius:`0.375rem`,fontSans:`Georgia, Cambria, 'Times New Roman', Times, serif`}},{key:`dusk`,name:`Dusk`,tokens:{colors:{light:{background:`oklch(0.985 0.012 300)`,foreground:`oklch(0.24 0.05 300)`,card:`oklch(0.995 0.008 300)`,"card-foreground":`oklch(0.24 0.05 300)`,popover:`oklch(0.995 0.008 300)`,"popover-foreground":`oklch(0.24 0.05 300)`,primary:`oklch(0.55 0.16 300)`,"primary-foreground":`oklch(0.99 0.01 300)`,secondary:`oklch(0.93 0.04 310)`,"secondary-foreground":`oklch(0.3 0.06 300)`,muted:`oklch(0.94 0.03 305)`,"muted-foreground":`oklch(0.5 0.05 300)`,accent:`oklch(0.9 0.07 70)`,"accent-foreground":`oklch(0.32 0.08 60)`,border:`oklch(0.88 0.03 305)`,input:`oklch(0.88 0.03 305)`,ring:`oklch(0.55 0.16 300)`,"chart-1":`oklch(0.58 0.17 300)`,"chart-2":`oklch(0.7 0.15 70)`,"chart-3":`oklch(0.55 0.15 330)`,"chart-4":`oklch(0.65 0.14 35)`,"chart-5":`oklch(0.5 0.16 280)`,sidebar:`oklch(0.96 0.02 303)`,"sidebar-foreground":`oklch(0.26 0.05 300)`,"sidebar-primary":`oklch(0.55 0.16 300)`,"sidebar-primary-foreground":`oklch(0.99 0.01 300)`,"sidebar-accent":`oklch(0.9 0.07 70)`,"sidebar-accent-foreground":`oklch(0.32 0.08 60)`,"sidebar-border":`oklch(0.87 0.03 305)`,"sidebar-ring":`oklch(0.55 0.16 300)`},dark:{background:`oklch(0.2 0.04 300)`,foreground:`oklch(0.95 0.02 305)`,card:`oklch(0.25 0.05 300)`,"card-foreground":`oklch(0.95 0.02 305)`,popover:`oklch(0.25 0.05 300)`,"popover-foreground":`oklch(0.95 0.02 305)`,primary:`oklch(0.72 0.15 300)`,"primary-foreground":`oklch(0.18 0.04 300)`,secondary:`oklch(0.3 0.05 305)`,"secondary-foreground":`oklch(0.95 0.02 305)`,muted:`oklch(0.3 0.04 303)`,"muted-foreground":`oklch(0.72 0.05 305)`,accent:`oklch(0.45 0.1 65)`,"accent-foreground":`oklch(0.96 0.02 70)`,border:`oklch(0.35 0.04 303)`,input:`oklch(0.35 0.04 303)`,ring:`oklch(0.72 0.15 300)`,"chart-1":`oklch(0.72 0.16 300)`,"chart-2":`oklch(0.78 0.14 70)`,"chart-3":`oklch(0.68 0.15 330)`,"chart-4":`oklch(0.72 0.13 35)`,"chart-5":`oklch(0.64 0.16 280)`,sidebar:`oklch(0.23 0.05 300)`,"sidebar-foreground":`oklch(0.95 0.02 305)`,"sidebar-primary":`oklch(0.72 0.15 300)`,"sidebar-primary-foreground":`oklch(0.18 0.04 300)`,"sidebar-accent":`oklch(0.45 0.1 65)`,"sidebar-accent-foreground":`oklch(0.96 0.02 70)`,"sidebar-border":`oklch(0.34 0.04 303)`,"sidebar-ring":`oklch(0.72 0.15 300)`}},radius:`1rem`,fontSans:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`}}];new Set(p3.map(e=>e.key));function m3(e){let t=e??localStorage.getItem(`oc.theme`)??`system`,n=()=>t===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:t,[r,i]=(0,z.useState)(n);return(0,z.useEffect)(()=>{if(i(n()),t!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>i(e.matches?`dark`:`light`);return e.addEventListener(`change`,r),()=>e.removeEventListener(`change`,r)},[t]),r}function Rxe(e,t){let n=document.documentElement.style,r=e?.colors?.[t];for(let e of Lxe){let t=r?.[e];t===void 0?n.removeProperty(`--`+e):n.setProperty(`--`+e,t)}e?.radius===void 0?n.removeProperty(`--radius`):n.setProperty(`--radius`,e.radius),e?.fontSans===void 0?n.removeProperty(`--ui-font-sans`):n.setProperty(`--ui-font-sans`,e.fontSans),e?.fontMono===void 0?n.removeProperty(`--ui-font-mono`):n.setProperty(`--ui-font-mono`,e.fontMono);let i=e?.bpm;i!==void 0&&i>0?n.setProperty(`--heart-period`,`${(60/Math.min(90,i)).toFixed(3)}s`):i===0?n.setProperty(`--heart-period`,`0s`):n.removeProperty(`--heart-period`)}function h3(e,t){(0,z.useEffect)(()=>{Rxe(e??null,t)},[e,t])}var g3=new Map,_3={active:!1,percent:0,count:0},v3=new Set;function y3(){let e=0,t=0;for(let n of g3.values())e+=n.loaded,t+=n.total;let n=g3.size;_3={active:n>0,percent:t>0?Math.min(100,Math.round(e/t*100)):0,count:n};for(let e of v3)e()}var b3={subscribe(e){return v3.add(e),()=>v3.delete(e)},getSnapshot(){return _3},report(e,t,n){g3.set(e,{loaded:t,total:n}),y3()},clear(e){g3.delete(e)&&y3()}},x3=0;function zxe(){x3+=1}function Bxe(){x3=Math.max(0,x3-1)}function Vxe(){return x3>0}var Hxe={phase:`idle`,model:null,voice:null,muted:!1,errorCode:null};function Uxe(e,t){switch(t){case`start`:return e===`idle`?`minting`:null;case`minted`:return e===`minting`?`connecting`:null;case`connected`:return e===`connecting`?`live`:null;case`hangup`:return e===`minting`||e===`connecting`||e===`live`?`ending`:null;case`failed`:return e===`minting`||e===`connecting`||e===`live`?`ending`:null;case`ended`:return e===`ending`?`idle`:null}}function Wxe(e,t){return t===null||t===``?e:`${e}${e.includes(`?`)?`&`:`?`}model=${encodeURIComponent(t)}`}async function Gxe(e,t,n=fetch){try{let r=await n(Wxe(e.offerUrl,e.model??null),{method:`POST`,headers:{Authorization:`Bearer ${e.clientSecret}`,"Content-Type":`application/sdp`},body:t});if(!r.ok)return{ok:!1,code:r.status===401?`talk_secret_expired`:`sdp_${r.status}`};let i=await r.text();return i.trim()===``?{ok:!1,code:`sdp_empty`}:{ok:!0,answerSdp:i}}catch{return{ok:!1,code:`sdp_unreachable`}}}var S3=[`marin`,`cedar`,`alloy`,`ash`,`ballad`,`coral`,`echo`,`sage`,`shimmer`,`verse`],C3=`oc.talk.voice`,w3=`oc.talk.vad`,T3=[{id:`low`,threshold:.8},{id:`medium`,threshold:.5},{id:`high`,threshold:.3}];function E3(e){return T3.some(t=>t.id===e)?e:``}function Kxe(e){let t=T3.find(t=>t.id===e);return t?t.threshold:null}function qxe(){try{return E3(localStorage.getItem(w3))}catch{return``}}function Jxe(e){try{E3(e)===``?localStorage.removeItem(w3):localStorage.setItem(w3,e)}catch{}}function D3(e){return S3.includes(e??``)?e:``}function Yxe(){try{return D3(localStorage.getItem(C3))}catch{return``}}function Xxe(e){try{D3(e)===``?localStorage.removeItem(C3):localStorage.setItem(C3,e)}catch{}}function Zxe(e){let t;try{let n=JSON.parse(e);if(typeof n!=`object`||!n)return null;t=n}catch{return null}let n,r,i;if(t.type===`response.output_item.done`){let e=t.item;if(!e||e.type!==`function_call`)return null;n=e.call_id,r=e.name,i=e.arguments}else if(t.type===`response.function_call_arguments.done`)n=t.call_id,r=t.name,i=t.arguments;else return null;if(typeof n!=`string`||n===``||typeof r!=`string`||r===``)return null;let a={};if(typeof i==`string`&&i!==``)try{let e=JSON.parse(i);typeof e==`object`&&e&&(a=e)}catch{}return{callId:n,name:r,args:a}}function Qxe(e){switch(e){case`talk_disabled`:return`talk_error_disabled`;case`talk_unsupported`:case`provider_unsupported`:return`talk_error_unsupported`;case`mic_denied`:return`talk_error_mic_denied`;case`talk_secret_expired`:return`talk_error_secret_expired`;default:return`talk_error_generic`}}function $xe(e){switch(Qxe(e)){case`talk_error_disabled`:return Vs();case`talk_error_unsupported`:return oc();case`talk_error_mic_denied`:return ta();case`talk_error_secret_expired`:return $n();case`talk_error_generic`:return`${Pp()} (${e})`}}function eSe({chatId:e}){let[t,n]=(0,z.useState)(Hxe),[r,i]=(0,z.useState)(()=>Yxe()),[a,o]=(0,z.useState)(()=>qxe()),s=I(L.talk.talkAvailable,{chatId:e}),c=Ei(L.talk.mintTalkSession),l=Ei(L.talk.relayTalkToolCall),u=JF(),d=(0,z.useRef)(0),f=(0,z.useRef)(`idle`),p=(0,z.useRef)({pc:null,mic:null}),m=(0,z.useRef)(null),h=(0,z.useCallback)(e=>{let t=Uxe(f.current,e);return t===null?null:(f.current=t,n(e=>({...e,phase:t})),t)},[]),g=(0,z.useCallback)(()=>{let e=p.current;try{e.mic?.getTracks().forEach(e=>e.stop())}catch{}try{e.pc?.close()}catch{}e.mic=null,e.pc=null,m.current&&(m.current.srcObject=null)},[]),_=(0,z.useCallback)(()=>{h(`hangup`)!==null&&(d.current++,g(),h(`ended`),n(e=>({...e,muted:!1})))},[h,g]);(0,z.useEffect)(()=>()=>{d.current++,g()},[g]);let v=(0,z.useCallback)(async()=>{if(h(`start`)===null)return;let t=++d.current;n(e=>({...e,errorCode:null,muted:!1}));let i=e=>{d.current===t&&(h(`failed`),g(),h(`ended`),n(t=>({...t,errorCode:e})),u.error($xe(e)))},o=Kxe(a),s=await c({chatId:e,...r===``?{}:{voice:r},...o===null?{}:{vadThreshold:o}});if(d.current!==t)return;if(!s.ok){i(s.code);return}let f;try{f=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{i(`mic_denied`);return}if(d.current!==t){f.getTracks().forEach(e=>e.stop());return}p.current.mic=f,n(e=>({...e,model:s.session.model,voice:s.session.voice})),h(`minted`);let _=new RTCPeerConnection;p.current.pc=_;for(let e of f.getTracks())_.addTrack(e,f);_.ontrack=e=>{d.current!==t||m.current===null||(m.current.srcObject=e.streams[0]??null)};let v=_.createDataChannel(`oai-events`),y=e=>{try{v.send(JSON.stringify(e))}catch{}},b=async n=>{if(n.name!==`openclaw_agent_consult`){y({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:n.callId,output:`Task-control is not available in this interface yet; tell the user so.`}}),y({type:`response.create`});return}y({type:`response.create`,response:{instructions:`Briefly tell the user, in their language, that you are checking with the agent. Do not invent the result.`}});let r=await l({chatId:e,callId:n.callId,args:{question:typeof n.args.question==`string`?n.args.question:``,...typeof n.args.context==`string`?{context:n.args.context}:{},...typeof n.args.responseStyle==`string`?{responseStyle:n.args.responseStyle}:{}}}).catch(()=>({ok:!1,code:`relay_failed`}));if(d.current!==t)return;let i=r.ok?r.pending?`The agent is still working on it. Tell the user the task continues and its result will arrive in the conversation.`:typeof r.errorText==`string`?`The agent run failed: ${r.errorText}`:r.resultText??``:`The agent could not be reached (${r.code}). Tell the user and suggest typing the request in the conversation instead.`;y({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:n.callId,output:i===``?`(the agent returned an empty result)`:i}}),y({type:`response.create`})},x=new Set;v.onmessage=e=>{if(d.current!==t)return;let n=Zxe(typeof e.data==`string`?e.data:``);n===null||x.has(n.callId)||(x.add(n.callId),b(n))},_.onconnectionstatechange=()=>{d.current===t&&_.connectionState===`failed`&&i(`rtc_lost`)};try{let e=await _.createOffer();if(await _.setLocalDescription(e),d.current!==t)return;let n=await Gxe(s.session,e.sdp??``);if(d.current!==t)return;if(!n.ok){i(n.code);return}await _.setRemoteDescription({type:`answer`,sdp:n.answerSdp})}catch{i(`rtc_setup`);return}d.current===t&&h(`connected`)},[h,e,c,g,r,a]),y=(0,z.useCallback)(()=>{let e=p.current.mic;if(e===null)return;let r=!t.muted;for(let t of e.getAudioTracks())t.enabled=!r;n(e=>({...e,muted:r}))},[t.muted]),x=t.phase;return x===`idle`&&s!==!0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`audio`,{ref:m,autoPlay:!0,className:`oc-talk__audio`}),x===`idle`?(0,B.jsxs)(`span`,{className:`oc-talk__pill`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__pillmain`,title:Bf(),"aria-label":Bf(),onClick:()=>void v(),children:(0,B.jsx)(Sy,{size:16,"aria-hidden":!0})}),(0,B.jsxs)(gF,{children:[(0,B.jsx)(_F,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__pillchev`,title:Cs(),"aria-label":Cs(),children:(0,B.jsx)(Ay,{size:13,"aria-hidden":!0})})}),(0,B.jsxs)(vF,{align:`end`,className:`oc-talk__settings`,children:[(0,B.jsxs)(`label`,{className:`oc-talk__setting`,children:[(0,B.jsx)(`span`,{className:`oc-talk__settinglabel`,children:yr()}),(0,B.jsxs)(_0,{value:r===``?`__default__`:r,onValueChange:e=>{let t=e===`__default__`?``:e;i(t),Xxe(t)},children:[(0,B.jsx)(y0,{size:`sm`,"aria-label":yr(),children:(0,B.jsx)(v0,{})}),(0,B.jsxs)(b0,{children:[(0,B.jsx)(x0,{value:`__default__`,children:Jt()}),S3.map(e=>(0,B.jsx)(x0,{value:e,children:e},e))]})]})]}),(0,B.jsxs)(`label`,{className:`oc-talk__setting`,children:[(0,B.jsx)(`span`,{className:`oc-talk__settinglabel`,children:Bo()}),(0,B.jsxs)(_0,{value:a===``?`__default__`:a,onValueChange:e=>{let t=e===`__default__`?``:e;o(t),Jxe(t)},children:[(0,B.jsx)(y0,{size:`sm`,"aria-label":Bo(),children:(0,B.jsx)(v0,{})}),(0,B.jsxs)(b0,{children:[(0,B.jsx)(x0,{value:`__default__`,children:mn()}),T3.map(e=>(0,B.jsx)(x0,{value:e.id,children:e.id===`low`?rs():e.id===`medium`?ve():Xee()},e.id))]})]})]})]})]})]}):(0,B.jsxs)(`span`,{className:`oc-talk${x===`live`?` oc-talk--live`:``}`,role:`status`,children:[(0,B.jsx)(`i`,{className:`oc-talk__dot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-talk__label`,children:x===`live`?t.voice||b():cu()}),x===`live`?(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__btn`,title:t.muted?Cc():ba(),"aria-label":t.muted?Cc():ba(),"aria-pressed":t.muted,onClick:y,children:t.muted?(0,B.jsx)(bb,{size:14,"aria-hidden":!0}):(0,B.jsx)(xb,{size:14,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__btn oc-talk__btn--end`,title:xm(),"aria-label":xm(),onClick:_,children:(0,B.jsx)(Mb,{size:14,"aria-hidden":!0})})]})]})}function tSe(e,t){if(!e)return null;let n=e.logoLightHasAlpha&&e.logoLightUrl||e.logoDarkHasAlpha&&e.logoDarkUrl||null;if(n)return{url:n,masked:!0};let r=O3(e,t);return r?{url:r,masked:!1}:null}function O3(e,t){return(t===`dark`?e?.logoDarkUrl:e?.logoLightUrl)??(t===`dark`?e?.logoLightUrl:e?.logoDarkUrl)??null}function k3(e){if(!e)return null;let t=/oklch\(\s*([0-9]*\.?[0-9]+)(%?)/i.exec(e);if(!t)return null;let n=parseFloat(t[1]);return Number.isFinite(n)?t[2]===`%`?n/100:n:null}function nSe(e,t,n){let r=k3(e),i=k3(t);return r===null||i===null?n:i>r?`dark`:`light`}function rSe(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function A3({className:e}){return(0,B.jsxs)(`svg`,{className:e,viewBox:`0 0 64 64`,fill:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M25 15H15V49H25`,stroke:`currentColor`,strokeWidth:`6.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,B.jsx)(`path`,{d:`M39 15H49V49H39`,stroke:`currentColor`,strokeWidth:`6.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,B.jsx)(`polyline`,{points:`20 33 26 33 29 25 33 41 37 29 41 33 44 33`,stroke:`currentColor`,strokeWidth:`3.4`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}var j3=(0,z.createContext)({label:`Atrium`,logoUrl:null,logoMasked:!1,isDefault:!0,initials:`A`,agentName:null,agentEmoji:null});function M3(){return(0,z.useContext)(j3)}function N3(e){return e.agentName??e.label}function iSe(e){return e.agentName?nt({name:e.agentName}):Ve({name:e.label})}function P3(e){let t=new Map;for(let n of e){let e=t.get(n.instanceName);e||(e={instanceName:n.instanceName,kind:n.kind,agents:[]},t.set(n.instanceName,e)),e.agents.push(n)}let n=e=>(e.displayName??e.agentId).toLowerCase();for(let e of t.values())e.agents.sort((e,t)=>e.isDefault===t.isDefault?n(e).localeCompare(n(t)):e.isDefault?-1:1);let r=[...t.values()],i=e=>e.agents.some(e=>e.isDefault);return r.sort((e,t)=>i(e)===i(t)?e.instanceName.localeCompare(t.instanceName):i(e)?-1:1),r}function F3(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.displayName,e.agentId,e.instanceName,e.model,e.description].filter(Boolean).some(e=>e.toLowerCase().includes(n))):e}function aSe({open:e,onOpenChange:t,agents:n,onPick:r}){let[i,a]=(0,z.useState)(``),o=(0,z.useMemo)(()=>P3(F3(n??[],i)),[n,i]);return(0,B.jsx)(d0,{open:e,onOpenChange:t,children:(0,B.jsxs)(f0,{className:`oc-agentpicker`,children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:Ct()}),(0,B.jsx)(g0,{children:Zi()})]}),n===void 0?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:gi()}):n.length===0?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Zr()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(EF,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:Cd(),className:`oc-agentpicker__search`,"aria-label":j()}),(0,B.jsx)(`div`,{className:`oc-agentpicker__list`,role:`listbox`,children:o.map(e=>(0,B.jsxs)(`div`,{className:`oc-agentpicker__group`,children:[(0,B.jsxs)(`div`,{className:`oc-agentpicker__instance`,children:[(0,B.jsx)(Ub,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e.instanceName}),(0,B.jsx)(XF,{variant:`outline`,className:`oc-agentpicker__kind`,children:e.kind})]}),e.agents.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":!1,className:`oc-agentpicker__item`,onClick:()=>r(e.instanceName,e.agentId),disabled:e.state===`deleted`,title:e.state===`deleted`?Bd():void 0,children:[(0,B.jsx)(Ey,{size:15,"aria-hidden":!0,className:`oc-agentpicker__icon`}),(0,B.jsxs)(`span`,{className:`oc-agentpicker__main`,children:[(0,B.jsxs)(`span`,{className:`oc-agentpicker__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.description?(0,B.jsx)(`span`,{className:`oc-agentpicker__desc`,children:e.description}):null]}),e.model?(0,B.jsx)(`span`,{className:`oc-agentpicker__model`,children:e.model}):null,e.isDefault?(0,B.jsx)(Yb,{size:13,"aria-label":Ni(),className:`oc-agentpicker__default`}):null]},`${e.instanceName}/${e.agentId}`))]},e.instanceName))})]})]})})}function I3(e,t){return e===null||t===null?e===t:e.instanceName===t.instanceName&&e.agentId===t.agentId}function L3(e){return e.routedInstanceName&&e.routedAgentId?{instanceName:e.routedInstanceName,agentId:e.routedAgentId}:null}function oSe(e){let t=new Map,n=null;for(let r of e){let e=L3(r);r.role===`user`?(n=e,t.set(r._id,e)):r.role===`assistant`?t.set(r._id,e??n):t.set(r._id,e)}return t}function sSe(e){for(let t=e.length-1;t>=0;t--){let n=L3(e[t]);if(n)return n}return null}function cSe(e){return e===void 0?!1:!e.some(e=>e.role===`user`)}function R3(e,t){if(!t)return!1;let n=e.find(e=>I3(e,t));return n!==void 0&&n.state!==`deleted`}function lSe(e){let{lastRouted:t,primary:n,pool:r}=e,i=e=>({instanceName:e.instanceName,agentId:e.agentId});if(R3(r,t))return i(t);if(R3(r,n))return i(n);let a=r.filter(e=>e.state!==`deleted`);return a.length===0?null:i(a.find(e=>e.isDefault)??a[0])}function z3(e){let{selected:t,lastRouted:n,primary:r,pool:i,poolLoading:a,messagesLoading:o,canRoute:s}=e;if(!s)return null;let c=t??n;return a||o?c??r:lSe({lastRouted:c,primary:r,pool:i})}function uSe(e){let{hasUserTurn:t,emptyThread:n,readOnly:r,multiAgent:i,poolSize:a}=e,o=n?{disabled:!1,mode:`rebind`}:t&&!r?{disabled:!1,mode:`route`}:{disabled:!0,mode:`route`},s=o.mode===`rebind`&&!o.disabled;return{hidden:a===0||!i&&!s,...o}}function B3(e,t){if(!t)return null;let n=e.find(e=>I3(e,t));return n?{displayName:n.displayName,emoji:n.emoji}:null}function dSe(e){let{selected:t,primary:n,perTurnRouting:r,isFirstTurn:i,canRoute:a}=e;if(a&&t&&!i&&(r||!I3(t,n)))return t}function fSe(e){let t=new Map,n=null;for(let r of e){if(r.role===`user`){n=r.importedAgentLabel??null,t.set(r._id,n??r.chatImportedAgentLabel??null);continue}t.set(r._id,r.importedAgentLabel??n??r.chatImportedAgentLabel??null)}return t}var pSe={user:Pf(),assistant:`OpenClaw`,system:gm()},mSe=ru();function V3(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)+` UTC`}function H3(e){return e?e.filter(e=>e.kind===`file`||e.kind===`media`).map(e=>e.filename).filter(e=>typeof e==`string`&&e.length>0):[]}function hSe(e,t={}){let n=[];n.push(`# ${t.title?.trim()||h()}`),t.exportedAt!=null&&(n.push(``),n.push(`_${ha({date:V3(t.exportedAt)})}_`)),t.truncated&&(n.push(``),n.push(mSe));for(let t of e){n.push(``),n.push(`## ${pSe[t.role]} · ${V3(t.createdAt)}`);for(let e of t.quotedExcerpts??[])e!==``&&(n.push(``),n.push(`> ${dr()} : ${e}`));let e=t.text.trim();e.length>0&&(n.push(``),n.push(e));for(let e of H3(t.parts))n.push(``),n.push(vc({name:e}))}return n.join(`
|
|
306
306
|
`)+`
|
|
307
307
|
`}function gSe(e,t={}){let n={title:t.title?.trim()||h(),exportedAt:t.exportedAt??null,truncated:!!t.truncated,messageCount:e.length,messages:e.map(e=>({role:e.role,createdAt:e.createdAt,text:e.text,...e.quotedExcerpts!==void 0&&e.quotedExcerpts.length>0?{quotedExcerpts:e.quotedExcerpts.filter(e=>e!==``)}:{},attachments:H3(e.parts)}))};return JSON.stringify(n,null,2)+`
|
|
308
|
-
`}function _Se(e){return((e??``).trim()||`conversation`).toLowerCase().normalize(`NFD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}var U3=z.createContext(null);function vSe({children:e}){let[t,n]=z.useState(null),r=z.useRef(null),i=z.useRef(null),[a,o]=z.useState(``),s=z.useCallback(e=>{let t=r.current;r.current=null,n(null),t&&t(e)},[]),c=z.useMemo(()=>({confirm:e=>new Promise(t=>{r.current=t,o(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{r.current=t,o(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),l=t?.kind===`confirm`,u=t?.kind===`prompt`,d=t?.kind===`confirm`?t.opts.confirmWord:void 0,f=!d||a.trim().toLowerCase()===d.trim().toLowerCase(),p=a.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,m=e=>{e.preventDefault(),requestAnimationFrame(()=>i.current?.focus())};return(0,B.jsxs)(U3.Provider,{value:c,children:[e,(0,B.jsx)(XF,{open:l,onOpenChange:e=>{e||s(!1)},children:l?(0,B.jsxs)(ZF,{onOpenAutoFocus:d?m:void 0,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,B.jsxs)(QF,{children:[(0,B.jsx)(eI,{children:t.opts.title}),t.opts.description?(0,B.jsx)(tI,{children:t.opts.description}):null]}),d?(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[yee(),` `,(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:Nee({word:d})}),` `,dl()]}),(0,B.jsx)(TF,{ref:i,value:a,placeholder:d,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),s(!0))}})]}):null,(0,B.jsxs)($F,{children:[(0,B.jsx)(rI,{onClick:()=>s(!1),children:t.opts.cancelLabel??ih()}),(0,B.jsx)(Ih,{variant:t.opts.destructive?`destructive`:`default`,disabled:!f,onClick:()=>s(!0),children:t.opts.confirmLabel??ke()})]})]}):null}),(0,B.jsx)(d0,{open:u,onOpenChange:e=>{e||s(null)},children:u?(0,B.jsxs)(f0,{onOpenAutoFocus:m,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:t.opts.title}),t.opts.description?(0,B.jsx)(g0,{children:t.opts.description}):null]}),(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,B.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,B.jsx)(TF,{ref:i,value:a,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),s(a.trim()))}})]}),(0,B.jsxs)(m0,{children:[(0,B.jsx)(Ih,{variant:`outline`,onClick:()=>s(null),children:t.opts.cancelLabel??ih()}),(0,B.jsx)(Ih,{disabled:!p,onClick:()=>s(a.trim()),children:t.opts.confirmLabel??Ya()})]})]}):null})]})}function W3(){let e=z.useContext(U3);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function G3(){return W3().confirm}function K3(){return W3().prompt}var q3=null,J3=new Set,Y3=null,ySe=4e3;function X3(){for(let e of J3)e()}function Z3(e,t){q3={chatId:e,expand:t?.expand===!0},Y3!==null&&clearTimeout(Y3),Y3=setTimeout(()=>{Y3=null,q3=null,X3()},ySe),X3()}function Q3(e){q3?.chatId===e&&(Y3!==null&&(clearTimeout(Y3),Y3=null),q3=null,X3())}function $3(){return(0,z.useSyncExternalStore)(e=>(J3.add(e),()=>{J3.delete(e)}),()=>q3)}function bSe(e){let t=-1,n=-1/0,r=-1/0;for(let i=0;i<e.length;i++){let a=e[i]?.stamp,o=a??r;o>=n&&(t=i,n=o),a!==void 0&&a>r&&(r=a)}return t}function xSe(e){let t=e[bSe(e)];return t===void 0||t.steps.length===0?null:t}var SSe=[];function CSe({status:e,settled:t}){return e===`completed`?(0,B.jsx)(ky,{size:13,className:`oc-planact__icon oc-planact__icon--done`,"aria-hidden":!0}):e===`in_progress`&&!t?(0,B.jsx)(pb,{size:13,className:`oc-planact__icon oc-planact__icon--current oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(Ly,{size:13,className:`oc-planact__icon`,"aria-hidden":!0})}function wSe(){let e=U(e=>e.metadata?.custom?.planParts??SSe),t=U(e=>e.metadata?.custom?.status!==`streaming`),[n,r]=(0,z.useState)(null),i=xSe(e);if(i===null)return null;let a=i.steps.length,o=i.steps.filter(e=>e.status===`completed`).length,s=n??o!==a,c=i.steps.find(e=>e.status===`in_progress`);return(0,B.jsxs)(`div`,{className:`oc-planact`,children:[(0,B.jsx)(sI,{icon:(0,B.jsx)(fb,{size:14}),label:i.estimated?`${Zd({done:o,total:a})} \u00b7 ${Tl()}`:Zd({done:o,total:a}),sublabel:!s&&c!==void 0?c.step:void 0,trailing:(0,B.jsx)(`span`,{className:`oc-planact__bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":a,"aria-valuenow":o,children:(0,B.jsx)(`span`,{className:`oc-planact__bar-fill`,style:{width:`${a>0?o/a*100:0}%`}})}),open:s,ariaExpanded:s,title:s?Kf():tee(),onClick:()=>r(!s)}),s?(0,B.jsx)(`ol`,{className:`oc-planact__steps`,children:i.steps.map((e,n)=>(0,B.jsxs)(`li`,{className:`oc-planact__step oc-planact__step--${e.status}`,children:[(0,B.jsx)(CSe,{status:e.status,settled:t}),(0,B.jsx)(`span`,{className:`oc-planact__step-text`,children:e.step})]},n))}):null,s&&i.explanation!==void 0?(0,B.jsx)(`div`,{className:`oc-planact__note`,children:i.explanation}):null]})}function TSe(e){return e.kind===`tool`}function ESe(e){return e.kind===`media`}function DSe(e){return e.kind===`file`}function OSe(e){return e.kind===`reasoning`}function kSe(e){return e.kind===`plan`}function ASe(e){return e.kind===`cron`}function jSe(e){return e.kind===`compaction`}function MSe(e){let t=[],n=/^ {0,3}(`{3,}|~{3,})(.*)$/gm,r=-1,i=``,a=0;for(let o=n.exec(e);o!==null;o=n.exec(e)){let e=o[1][0];r===-1?(r=o.index,i=e,a=o[1].length):e===i&&o[1].length>=a&&/^[ \t]*$/.test(o[2])&&(t.push([r,o.index+o[1].length]),r=-1)}return r!==-1&&t.push([r,e.length]),t}function NSe(e,t){let n=Math.max(0,t);if(n===0)return 0;if(n>=e.length)return n;for(let[t,r]of MSe(e))if(n>t&&n<r)return t;return n}function PSe(e,t,n){if((n?.settled??!0)||(t=t.filter(t=>t.offset<=e.length)),t.length===0)return e.length>0?[{kind:`text`,text:e}]:[];let r=[],i=0;for(let n of t){let t=Math.max(i,NSe(e,n.offset));i=t;let a=r[r.length-1];a!==void 0&&a.cut===t?a.parts.push(n.activity):r.push({cut:t,parts:[n.activity]})}let a=[];for(let t of r){let n=a[a.length-1];n!==void 0&&e.slice(Math.min(n.cut,e.length),Math.min(t.cut,e.length)).trim()===``?n.parts.push(...t.parts):a.push(t)}let o=[],s=0;for(let t of a){let n=Math.min(t.cut,e.length),r=e.slice(s,n);r.trim()!==``&&o.push({kind:`text`,text:r}),o.push({kind:`activity`,parts:t.parts,cut:t.cut}),s=Math.max(s,n)}let c=e.slice(s);return c.trim()!==``&&o.push({kind:`text`,text:c}),o}var e6=[`read`,`exec`,`search`,`fetch`,`write`,`other`],t6={read:{one:()=>Jf(),many:e=>Yc({count:String(e)})},exec:{one:()=>ad(),many:e=>Gp({count:String(e)})},search:{one:()=>jf(),many:e=>pm({count:String(e)})},fetch:{one:()=>eu(),many:e=>m({count:String(e)})},write:{one:()=>ma(),many:e=>_c({count:String(e)})},other:{one:e=>Fs({tool:e}),many:e=>tc({count:String(e)})}};function n6(e){return e===`started`||e===`running`||e===`start`}function FSe(e){let t=new Map;for(let n of e){let e=w0(n.toolName);t.set(e,(t.get(e)??0)+1)}let n=`other`,r=-1;for(let e of e6){let i=t.get(e)??0;i>r&&(n=e,r=i)}return n}function ISe(e,t){let n=t?.live===!1?void 0:[...e].reverse().find(e=>n6(e.phase));if(n!==void 0)switch(w0(n.toolName)){case`read`:return Au();case`exec`:return Uu();case`search`:return mf();case`fetch`:return lp();case`write`:return gu();default:return Vl({tool:n.toolName})}let r=new Map;for(let t of e){let e=w0(t.toolName),n=r.get(e)??[];n.push(t),r.set(e,n)}let i=[];for(let e of e6){let t=r.get(e);t!==void 0&&i.push(t.length===1?t6[e].one(t[0].toolName):t6[e].many(t.length))}let a=i.length===1?i[0]:i.slice(0,-1).join(Dl())+ree()+i[i.length-1],o=$d()+a;return o.charAt(0).toUpperCase()+o.slice(1)}var LSe=/---[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?=\.[^.]+$|$)/i;function RSe(e){return e.replace(LSe,``)}function r6(e){return zs({size:String(Math.round((e??0)/1024))})}function zSe(e,t){let n=e.runId??`norun`;return`${e._id}:${n}:${t}`}function BSe(e,t,n){return{toolCallId:n.toolCallId??zSe(e,t),toolName:n.name,args:n.input??{},result:n.outputOmitted?r6(n.outputBytes):n.output,argsText:n.inputOmitted?r6(n.inputBytes):n.input===void 0?void 0:USe(n.input),phase:typeof n.phase==`string`?n.phase:void 0}}function VSe(e){return e&&RSe(e)}function HSe(e){return e.url?{type:`file`,mimeType:e.mimeType,data:e.url,filename:VSe(e.filename),storageId:e.storageId}:null}function USe(e){try{return typeof e==`string`?e:JSON.stringify(e,null,2)}catch{return String(e)}}function WSe(e,t,n){let r=[],i=[],a=[],o=[],s=[],c=[],l=[],u=null;e.parts.forEach((t,n)=>{if(OSe(t))r.push({type:`reasoning`,text:t.textOmitted?r6(t.textBytes):t.text??``});else if(TSe(t)){let r=BSe(e,n,t);o.push(r),t.textOffset===void 0?i.push(r):a.push({offset:t.textOffset,activity:r})}else t.kind===`provenance`?s.push(t):ASe(t)?c.push(t):kSe(t)?l.push(t):jSe(t)&&u===null&&(u={phase:t.phase,at:t.at,...typeof t.reason==`string`&&t.reason?{reason:t.reason}:{}})}),a.length>0?PSe(e.text??``,a,{settled:e.status!==`streaming`}).forEach(t=>{t.kind===`text`?r.push({type:`text`,text:t.text}):r.push({type:`tool-call`,toolCallId:`flow:${e._id}:${t.cut}`,toolName:`__turn_flow__`,args:{parts:t.parts}})}):e.text&&e.text.length>0&&r.push({type:`text`,text:e.text}),e.parts.forEach(e=>{if(ESe(e)||DSe(e)){let t=HSe(e);t&&r.push(t)}}),r.length===0&&r.push({type:`text`,text:``});let d=e.role===`assistant`?e.status===`streaming`?{type:`running`}:e.status===`complete`?{type:`complete`,reason:`stop`}:e.status===`error`?{type:`incomplete`,reason:`error`,error:e.error??e.errorCode??`error`}:e.status===`aborted`?{type:`incomplete`,reason:`cancelled`}:void 0:void 0;return{id:e._id,role:e.role,createdAt:new Date(e.updatedAt??e._creationTime),...d===void 0?{}:{status:d},content:r,metadata:{custom:{messageId:e._id,importedAgentLabel:n??null,sentAt:e.orderTime??e._creationTime,generationMs:e.role===`assistant`&&(e.status===`complete`||e.status===`aborted`)&&e.orderTime===void 0&&typeof e.finalizedAt==`number`?Math.max(0,e.finalizedAt-e._creationTime):null,chatId:e.chatId,status:e.status,runId:e.runId??null,hasMergedRuns:e.hasMergedRuns??!1,error:e.error??null,errorCode:e.errorCode??null,autoRetry:e.autoRetry??null,interruptedAt:e.interruptedAt??null,phase:e.phase??null,toolParts:i,allToolParts:o,activeToolName:T0(o)?.name??null,provenanceParts:s,cronParts:c,planParts:l,routedInstanceName:t?.instanceName??e.routedInstanceName??null,compaction:u,attachedDocCount:e.attachedDocCount??0,queued:e.role===`user`&&e.outbox?.status===`queued`,rawText:e.text,quotedRefs:e.quotedRefs??null}}}}function GSe(e){return typeof e==`string`&&e.toLowerCase().startsWith(`image/`)}var KSe=128*1024;function qSe(e){let t=e-KSe;return t<=0?0:Math.floor(t/4)*3}function JSe(e){let t=e.split(`;`)[0]?.trim().toLowerCase()??``;return!(t.startsWith(`text/`)||t===`application/json`||t===`application/xml`||t===`image/svg+xml`)||e.toLowerCase().includes(`charset`)?e:`${e}; charset=utf-8`}function YSe(){return`att_${Math.random().toString(36).slice(2)}_${Date.now()}`}function XSe(e){if(!e)return[];let t=[];for(let n of e){let e=n.convex;e?.storageId&&t.push({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType,...e.origin?{origin:e.origin}:{}})}return t}function ZSe(e,t,n,r){return{accept:`*`,async add({file:i}){zxe();try{let a=null;try{let t=r?.()??null;a=(await e.query(L.bridgeHealth.getBridgeAvailability,n?{chatId:n,...t?{routedAgent:t}:{}}:{}))?.maxInboundBytes??null}catch{}let o=a??qSe(26214400);if(n&&!GSe(i.type))try{let t=await e.query(L.bridge.getChatInboundPolicy,{chatId:n});t?.inboundMediaMode===`shared-fs`&&(o=t.sharedFsMaxBytes)}catch{}if(i.size>o){let e=e=>Math.floor(e/1024/1024),n=Hi({size:e(i.size),max:e(o)});throw t?.(n),Error(n)}return{id:YSe(),type:QSe(i.type),name:i.name,contentType:i.type||`application/octet-stream`,file:i,status:{type:`running`,reason:`uploading`,progress:0}}}finally{Bxe()}},async send(t){let n=t.file;b3.report(t.id,0,n.size||1);try{let r;try{r=await e.mutation(L.chats.generateUploadUrl,{})}catch(e){throw console.error(`[attach] generateUploadUrl failed:`,e),e}let i=await new Promise((e,i)=>{let a=new XMLHttpRequest;a.open(`POST`,r),a.setRequestHeader(`Content-Type`,JSe(n.type||`application/octet-stream`)),a.upload.onprogress=e=>{e.lengthComputable&&b3.report(t.id,e.loaded,e.total)},a.onload=()=>{if(a.status>=200&&a.status<300)try{e(JSON.parse(a.responseText).storageId)}catch(e){i(e)}else i(Error(`Upload failed (${a.status})`))},a.onerror=()=>{console.error(`[attach] upload POST failed (network/CORS/CSP)`),i(Error(`Upload failed (network)`))},a.send(n)});return await e.mutation(L.uploads.registerUpload,{storageId:i}),{id:t.id,type:t.type,name:t.name,contentType:t.contentType,status:{type:`complete`},content:[{type:`text`,text:n.name}],convex:{storageId:i,filename:n.name,mimeType:n.type||`application/octet-stream`,...I1(n)?{origin:`pasted`}:{}}}}finally{b3.clear(t.id)}},async remove(){}}}function QSe(e){return e.startsWith(`image/`)?`image`:`document`}var i6=null,a6=null;async function $Se(){try{let e=await fetch(`/config.json`,{cache:`no-store`});if(e.ok){let t=await e.json(),n=t?.convexSiteUrl;typeof n==`string`&&n.trim()&&(a6=n.trim());let r=t?.convexUrl;if(typeof r==`string`&&r.trim())return i6=r.trim(),i6}}catch{}throw Error(`No Convex URL configured: serve /config.json {"convexUrl":"…"} (production) or set VITE_CONVEX_URL (local dev).`)}function eCe(e){try{let t=new URL(e);return t.hostname.endsWith(`.convex.cloud`)?(t.hostname=t.hostname.replace(/\.convex\.cloud$/,`.convex.site`),t.origin):t.port?(t.port=String(Number(t.port)+1),t.origin):e}catch{return e}}function tCe(){return a6||(i6?eCe(i6):null)}function nCe(e){let t=[],n=e.replace(/\r\n/g,`
|
|
308
|
+
`}function _Se(e){return((e??``).trim()||`conversation`).toLowerCase().normalize(`NFD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}var U3=z.createContext(null);function vSe({children:e}){let[t,n]=z.useState(null),r=z.useRef(null),i=z.useRef(null),[a,o]=z.useState(``),s=z.useCallback(e=>{let t=r.current;r.current=null,n(null),t&&t(e)},[]),c=z.useMemo(()=>({confirm:e=>new Promise(t=>{r.current=t,o(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{r.current=t,o(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),l=t?.kind===`confirm`,u=t?.kind===`prompt`,d=t?.kind===`confirm`?t.opts.confirmWord:void 0,f=!d||a.trim().toLowerCase()===d.trim().toLowerCase(),p=a.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,m=e=>{e.preventDefault(),requestAnimationFrame(()=>i.current?.focus())};return(0,B.jsxs)(U3.Provider,{value:c,children:[e,(0,B.jsx)(ZF,{open:l,onOpenChange:e=>{e||s(!1)},children:l?(0,B.jsxs)(QF,{onOpenAutoFocus:d?m:void 0,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,B.jsxs)($F,{children:[(0,B.jsx)(tI,{children:t.opts.title}),t.opts.description?(0,B.jsx)(nI,{children:t.opts.description}):null]}),d?(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[yee(),` `,(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:Nee({word:d})}),` `,dl()]}),(0,B.jsx)(EF,{ref:i,value:a,placeholder:d,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),s(!0))}})]}):null,(0,B.jsxs)(eI,{children:[(0,B.jsx)(iI,{onClick:()=>s(!1),children:t.opts.cancelLabel??ih()}),(0,B.jsx)(Ih,{variant:t.opts.destructive?`destructive`:`default`,disabled:!f,onClick:()=>s(!0),children:t.opts.confirmLabel??ke()})]})]}):null}),(0,B.jsx)(d0,{open:u,onOpenChange:e=>{e||s(null)},children:u?(0,B.jsxs)(f0,{onOpenAutoFocus:m,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:t.opts.title}),t.opts.description?(0,B.jsx)(g0,{children:t.opts.description}):null]}),(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,B.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,B.jsx)(EF,{ref:i,value:a,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),s(a.trim()))}})]}),(0,B.jsxs)(m0,{children:[(0,B.jsx)(Ih,{variant:`outline`,onClick:()=>s(null),children:t.opts.cancelLabel??ih()}),(0,B.jsx)(Ih,{disabled:!p,onClick:()=>s(a.trim()),children:t.opts.confirmLabel??Ya()})]})]}):null})]})}function W3(){let e=z.useContext(U3);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function G3(){return W3().confirm}function K3(){return W3().prompt}var q3=null,J3=new Set,Y3=null,ySe=4e3;function X3(){for(let e of J3)e()}function Z3(e,t){q3={chatId:e,expand:t?.expand===!0},Y3!==null&&clearTimeout(Y3),Y3=setTimeout(()=>{Y3=null,q3=null,X3()},ySe),X3()}function Q3(e){q3?.chatId===e&&(Y3!==null&&(clearTimeout(Y3),Y3=null),q3=null,X3())}function $3(){return(0,z.useSyncExternalStore)(e=>(J3.add(e),()=>{J3.delete(e)}),()=>q3)}function bSe(e){let t=-1,n=-1/0,r=-1/0;for(let i=0;i<e.length;i++){let a=e[i]?.stamp,o=a??r;o>=n&&(t=i,n=o),a!==void 0&&a>r&&(r=a)}return t}function xSe(e){let t=e[bSe(e)];return t===void 0||t.steps.length===0?null:t}var SSe=[];function CSe({status:e,settled:t}){return e===`completed`?(0,B.jsx)(ky,{size:13,className:`oc-planact__icon oc-planact__icon--done`,"aria-hidden":!0}):e===`in_progress`&&!t?(0,B.jsx)(pb,{size:13,className:`oc-planact__icon oc-planact__icon--current oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(Ly,{size:13,className:`oc-planact__icon`,"aria-hidden":!0})}function wSe(){let e=U(e=>e.metadata?.custom?.planParts??SSe),t=U(e=>e.metadata?.custom?.status!==`streaming`),[n,r]=(0,z.useState)(null),i=xSe(e);if(i===null)return null;let a=i.steps.length,o=i.steps.filter(e=>e.status===`completed`).length,s=n??o!==a,c=i.steps.find(e=>e.status===`in_progress`);return(0,B.jsxs)(`div`,{className:`oc-planact`,children:[(0,B.jsx)(cI,{icon:(0,B.jsx)(fb,{size:14}),label:i.estimated?`${Zd({done:o,total:a})} \u00b7 ${Tl()}`:Zd({done:o,total:a}),sublabel:!s&&c!==void 0?c.step:void 0,trailing:(0,B.jsx)(`span`,{className:`oc-planact__bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":a,"aria-valuenow":o,children:(0,B.jsx)(`span`,{className:`oc-planact__bar-fill`,style:{width:`${a>0?o/a*100:0}%`}})}),open:s,ariaExpanded:s,title:s?Kf():tee(),onClick:()=>r(!s)}),s?(0,B.jsx)(`ol`,{className:`oc-planact__steps`,children:i.steps.map((e,n)=>(0,B.jsxs)(`li`,{className:`oc-planact__step oc-planact__step--${e.status}`,children:[(0,B.jsx)(CSe,{status:e.status,settled:t}),(0,B.jsx)(`span`,{className:`oc-planact__step-text`,children:e.step})]},n))}):null,s&&i.explanation!==void 0?(0,B.jsx)(`div`,{className:`oc-planact__note`,children:i.explanation}):null]})}function TSe(e){return e.kind===`tool`}function ESe(e){return e.kind===`media`}function DSe(e){return e.kind===`file`}function OSe(e){return e.kind===`reasoning`}function kSe(e){return e.kind===`plan`}function ASe(e){return e.kind===`cron`}function jSe(e){return e.kind===`compaction`}function MSe(e){let t=[],n=/^ {0,3}(`{3,}|~{3,})(.*)$/gm,r=-1,i=``,a=0;for(let o=n.exec(e);o!==null;o=n.exec(e)){let e=o[1][0];r===-1?(r=o.index,i=e,a=o[1].length):e===i&&o[1].length>=a&&/^[ \t]*$/.test(o[2])&&(t.push([r,o.index+o[1].length]),r=-1)}return r!==-1&&t.push([r,e.length]),t}function NSe(e,t){let n=Math.max(0,t);if(n===0)return 0;if(n>=e.length)return n;for(let[t,r]of MSe(e))if(n>t&&n<r)return t;return n}function PSe(e,t,n){if((n?.settled??!0)||(t=t.filter(t=>t.offset<=e.length)),t.length===0)return e.length>0?[{kind:`text`,text:e}]:[];let r=[],i=0;for(let n of t){let t=Math.max(i,NSe(e,n.offset));i=t;let a=r[r.length-1];a!==void 0&&a.cut===t?a.parts.push(n.activity):r.push({cut:t,parts:[n.activity]})}let a=[];for(let t of r){let n=a[a.length-1];n!==void 0&&e.slice(Math.min(n.cut,e.length),Math.min(t.cut,e.length)).trim()===``?n.parts.push(...t.parts):a.push(t)}let o=[],s=0;for(let t of a){let n=Math.min(t.cut,e.length),r=e.slice(s,n);r.trim()!==``&&o.push({kind:`text`,text:r}),o.push({kind:`activity`,parts:t.parts,cut:t.cut}),s=Math.max(s,n)}let c=e.slice(s);return c.trim()!==``&&o.push({kind:`text`,text:c}),o}var e6=[`read`,`exec`,`search`,`fetch`,`write`,`other`],t6={read:{one:()=>Jf(),many:e=>Yc({count:String(e)})},exec:{one:()=>ad(),many:e=>Gp({count:String(e)})},search:{one:()=>jf(),many:e=>pm({count:String(e)})},fetch:{one:()=>eu(),many:e=>m({count:String(e)})},write:{one:()=>ma(),many:e=>_c({count:String(e)})},other:{one:e=>Fs({tool:e}),many:e=>tc({count:String(e)})}};function n6(e){return e===`started`||e===`running`||e===`start`}function FSe(e){let t=new Map;for(let n of e){let e=w0(n.toolName);t.set(e,(t.get(e)??0)+1)}let n=`other`,r=-1;for(let e of e6){let i=t.get(e)??0;i>r&&(n=e,r=i)}return n}function ISe(e,t){let n=t?.live===!1?void 0:[...e].reverse().find(e=>n6(e.phase));if(n!==void 0)switch(w0(n.toolName)){case`read`:return Au();case`exec`:return Uu();case`search`:return mf();case`fetch`:return lp();case`write`:return gu();default:return Vl({tool:n.toolName})}let r=new Map;for(let t of e){let e=w0(t.toolName),n=r.get(e)??[];n.push(t),r.set(e,n)}let i=[];for(let e of e6){let t=r.get(e);t!==void 0&&i.push(t.length===1?t6[e].one(t[0].toolName):t6[e].many(t.length))}let a=i.length===1?i[0]:i.slice(0,-1).join(Dl())+ree()+i[i.length-1],o=$d()+a;return o.charAt(0).toUpperCase()+o.slice(1)}var LSe=/---[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?=\.[^.]+$|$)/i;function RSe(e){return e.replace(LSe,``)}function r6(e){return zs({size:String(Math.round((e??0)/1024))})}function zSe(e,t){let n=e.runId??`norun`;return`${e._id}:${n}:${t}`}function BSe(e,t,n){return{toolCallId:n.toolCallId??zSe(e,t),toolName:n.name,args:n.input??{},result:n.outputOmitted?r6(n.outputBytes):n.output,argsText:n.inputOmitted?r6(n.inputBytes):n.input===void 0?void 0:USe(n.input),phase:typeof n.phase==`string`?n.phase:void 0}}function VSe(e){return e&&RSe(e)}function HSe(e){return e.url?{type:`file`,mimeType:e.mimeType,data:e.url,filename:VSe(e.filename),storageId:e.storageId}:null}function USe(e){try{return typeof e==`string`?e:JSON.stringify(e,null,2)}catch{return String(e)}}function WSe(e,t,n){let r=[],i=[],a=[],o=[],s=[],c=[],l=[],u=null;e.parts.forEach((t,n)=>{if(OSe(t))r.push({type:`reasoning`,text:t.textOmitted?r6(t.textBytes):t.text??``});else if(TSe(t)){let r=BSe(e,n,t);o.push(r),t.textOffset===void 0?i.push(r):a.push({offset:t.textOffset,activity:r})}else t.kind===`provenance`?s.push(t):ASe(t)?c.push(t):kSe(t)?l.push(t):jSe(t)&&u===null&&(u={phase:t.phase,at:t.at,...typeof t.reason==`string`&&t.reason?{reason:t.reason}:{}})}),a.length>0?PSe(e.text??``,a,{settled:e.status!==`streaming`}).forEach(t=>{t.kind===`text`?r.push({type:`text`,text:t.text}):r.push({type:`tool-call`,toolCallId:`flow:${e._id}:${t.cut}`,toolName:`__turn_flow__`,args:{parts:t.parts}})}):e.text&&e.text.length>0&&r.push({type:`text`,text:e.text}),e.parts.forEach(e=>{if(ESe(e)||DSe(e)){let t=HSe(e);t&&r.push(t)}}),r.length===0&&r.push({type:`text`,text:``});let d=e.role===`assistant`?e.status===`streaming`?{type:`running`}:e.status===`complete`?{type:`complete`,reason:`stop`}:e.status===`error`?{type:`incomplete`,reason:`error`,error:e.error??e.errorCode??`error`}:e.status===`aborted`?{type:`incomplete`,reason:`cancelled`}:void 0:void 0;return{id:e._id,role:e.role,createdAt:new Date(e.updatedAt??e._creationTime),...d===void 0?{}:{status:d},content:r,metadata:{custom:{messageId:e._id,importedAgentLabel:n??null,sentAt:e.orderTime??e._creationTime,generationMs:e.role===`assistant`&&(e.status===`complete`||e.status===`aborted`)&&e.orderTime===void 0&&typeof e.finalizedAt==`number`?Math.max(0,e.finalizedAt-e._creationTime):null,chatId:e.chatId,status:e.status,runId:e.runId??null,hasMergedRuns:e.hasMergedRuns??!1,error:e.error??null,errorCode:e.errorCode??null,autoRetry:e.autoRetry??null,interruptedAt:e.interruptedAt??null,phase:e.phase??null,toolParts:i,allToolParts:o,activeToolName:T0(o)?.name??null,provenanceParts:s,cronParts:c,planParts:l,routedInstanceName:t?.instanceName??e.routedInstanceName??null,compaction:u,attachedDocCount:e.attachedDocCount??0,queued:e.role===`user`&&e.outbox?.status===`queued`,rawText:e.text,quotedRefs:e.quotedRefs??null}}}}function GSe(e){return typeof e==`string`&&e.toLowerCase().startsWith(`image/`)}var KSe=128*1024;function qSe(e){let t=e-KSe;return t<=0?0:Math.floor(t/4)*3}function JSe(e){let t=e.split(`;`)[0]?.trim().toLowerCase()??``;return!(t.startsWith(`text/`)||t===`application/json`||t===`application/xml`||t===`image/svg+xml`)||e.toLowerCase().includes(`charset`)?e:`${e}; charset=utf-8`}function YSe(){return`att_${Math.random().toString(36).slice(2)}_${Date.now()}`}function XSe(e){if(!e)return[];let t=[];for(let n of e){let e=n.convex;e?.storageId&&t.push({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType,...e.origin?{origin:e.origin}:{}})}return t}function ZSe(e,t,n,r){return{accept:`*`,async add({file:i}){zxe();try{let a=null;try{let t=r?.()??null;a=(await e.query(L.bridgeHealth.getBridgeAvailability,n?{chatId:n,...t?{routedAgent:t}:{}}:{}))?.maxInboundBytes??null}catch{}let o=a??qSe(26214400);if(n&&!GSe(i.type))try{let t=await e.query(L.bridge.getChatInboundPolicy,{chatId:n});t?.inboundMediaMode===`shared-fs`&&(o=t.sharedFsMaxBytes)}catch{}if(i.size>o){let e=e=>Math.floor(e/1024/1024),n=Hi({size:e(i.size),max:e(o)});throw t?.(n),Error(n)}return{id:YSe(),type:QSe(i.type),name:i.name,contentType:i.type||`application/octet-stream`,file:i,status:{type:`running`,reason:`uploading`,progress:0}}}finally{Bxe()}},async send(t){let n=t.file;b3.report(t.id,0,n.size||1);try{let r;try{r=await e.mutation(L.chats.generateUploadUrl,{})}catch(e){throw console.error(`[attach] generateUploadUrl failed:`,e),e}let i=await new Promise((e,i)=>{let a=new XMLHttpRequest;a.open(`POST`,r),a.setRequestHeader(`Content-Type`,JSe(n.type||`application/octet-stream`)),a.upload.onprogress=e=>{e.lengthComputable&&b3.report(t.id,e.loaded,e.total)},a.onload=()=>{if(a.status>=200&&a.status<300)try{e(JSON.parse(a.responseText).storageId)}catch(e){i(e)}else i(Error(`Upload failed (${a.status})`))},a.onerror=()=>{console.error(`[attach] upload POST failed (network/CORS/CSP)`),i(Error(`Upload failed (network)`))},a.send(n)});return await e.mutation(L.uploads.registerUpload,{storageId:i}),{id:t.id,type:t.type,name:t.name,contentType:t.contentType,status:{type:`complete`},content:[{type:`text`,text:n.name}],convex:{storageId:i,filename:n.name,mimeType:n.type||`application/octet-stream`,...I1(n)?{origin:`pasted`}:{}}}}finally{b3.clear(t.id)}},async remove(){}}}function QSe(e){return e.startsWith(`image/`)?`image`:`document`}var i6=null,a6=null;async function $Se(){try{let e=await fetch(`/config.json`,{cache:`no-store`});if(e.ok){let t=await e.json(),n=t?.convexSiteUrl;typeof n==`string`&&n.trim()&&(a6=n.trim());let r=t?.convexUrl;if(typeof r==`string`&&r.trim())return i6=r.trim(),i6}}catch{}throw Error(`No Convex URL configured: serve /config.json {"convexUrl":"…"} (production) or set VITE_CONVEX_URL (local dev).`)}function eCe(e){try{let t=new URL(e);return t.hostname.endsWith(`.convex.cloud`)?(t.hostname=t.hostname.replace(/\.convex\.cloud$/,`.convex.site`),t.origin):t.port?(t.port=String(Number(t.port)+1),t.origin):e}catch{return e}}function tCe(){return a6||(i6?eCe(i6):null)}function nCe(e){let t=[],n=e.replace(/\r\n/g,`
|
|
309
309
|
`).split(`
|
|
310
310
|
|
|
311
311
|
`),r=n.pop()??``;for(let e of n){if(e.trim()===``)continue;let n={data:``},r=[];for(let t of e.split(`
|
|
312
312
|
`))if(t.startsWith(`id:`)){let e=Number.parseInt(t.slice(3).trim(),10);Number.isFinite(e)&&(n.id=e)}else t.startsWith(`event:`)?n.event=t.slice(6).trim():t.startsWith(`data:`)&&r.push(t.slice(5).trim());n.data=r.join(`
|
|
313
313
|
`),t.push(n)}return{events:t,rest:r}}var rCe={text:``,lastSeq:0,done:!1};function iCe(e){if(e.event===`done`||e.event===`final`||e.data===``)return null;try{let t=JSON.parse(e.data);return typeof t.recTimingId==`string`?t.recTimingId:null}catch{return null}}function aCe(e,t){if(t.event===`done`)return{...e,done:!0};if(t.event===`final`){try{let n=JSON.parse(t.data);if(typeof n.text==`string`)return{...e,text:n.text}}catch{}return e}if(t.data===``)return e;try{let n=JSON.parse(t.data);if(typeof n.text!=`string`)return e;let r=n.kind===`replace`?n.text:e.text+n.text;return{...e,text:r,lastSeq:t.id??e.lastSeq}}catch{return e}}function oCe(){return!1}function sCe(e,t,n,r){let i=Dte(),a=(0,z.useRef)(r);a.current=r;let[o,s]=(0,z.useState)(null);return(0,z.useEffect)(()=>{let r=tCe();if(!n||!e||!i||!r){s(null);return}let o=!1,c=new AbortController,l=rCe;return s(null),(async()=>{for(;!o&&!l.done;){try{let n=await fetch(`${r}/api/v1/message-stream?messageId=${encodeURIComponent(e)}`,{headers:{Authorization:`Bearer ${i}`,...l.lastSeq>0?{"Last-Event-ID":String(l.lastSeq)}:{}},signal:c.signal});if(!n.ok||!n.body){s(null);return}let u=n.body.getReader(),d=new TextDecoder,f=``;for(;!o;){let{value:n,done:r}=await u.read();if(r)break;f+=d.decode(n,{stream:!0});let i=nCe(f);f=i.rest;for(let e of i.events){l=aCe(l,e);let t=iCe(e);t!==null&&a.current?.(t,e.id??0)}if(o||s({text:l.text,lastSeq:l.lastSeq,messageId:e,generationKey:t}),l.done)break}}catch{if(o)return;s(null)}if(l.done||o)break;await new Promise(e=>setTimeout(e,500))}})(),()=>{o=!0,c.abort()}},[n,e,i,t]),o}function cCe(e){let t=e=>e===null?`—`:String(Math.round(e)),n=`delivery latency — session ${e.sessionId??`?`} (${e.count}${e.truncated?`+`:``} deltas)`;if(e.segments===null)return`${n}\n(no samples)`;let r=e.segments,i=(e,n)=>`${e}: p50=${t(n.p50)} p95=${t(n.p95)} max=${t(n.max)} ms (n=${n.count})`,a=[n,i(`bridge internal`,r.bridge),i(`A bridge->Convex`,r.A),i(`C Convex->frontend`,r.C),`B Convex exec: from Convex telemetry (not measurable in-app)`];return e.truncated&&a.push(`(report capped at ${e.count} rows — later deltas not included)`),a.join(`
|
|
314
|
-
`)}function lCe(e,t,n){return t-(e+(n-e)/2)}function o6(e,t,n){return e.length===0||t===void 0?null:e.slice(0,n).map(e=>({...e,clientSkew:e.clientSkew??t}))}function uCe(e,t){let n=[];for(let r of e)r.recTimingId!==void 0&&n.push({timingId:r.recTimingId,t4:t});return n}function s6(e,t,n){for(let r of t){if(n.has(r.timingId))continue;let t=e.get(r.timingId);(t===void 0||r.t4<t)&&e.set(r.timingId,r.t4)}}var dCe=1e3,c6=2e3,l6=500;function fCe(e,t){let n=I(L.messages.getStreamingText,e?{chatId:e}:`skip`),r=Nt(L.deliveryTiming.recordFrontendTiming),i=Nt(L.deliveryTiming.calibrateClock),a=(0,z.useRef)(new Map),o=(0,z.useRef)(new Set),s=(0,z.useRef)([]),c=(0,z.useRef)(void 0),l=(0,z.useRef)(!1),u=(0,z.useCallback)(()=>{if(c.current!==void 0||l.current)return;l.current=!0;let e=Date.now();i({clientSentAt:e}).then(t=>{c.current=lCe(e,t.serverNow,Date.now())}).catch(()=>{l.current=!1})},[i]);(0,z.useEffect)(()=>{n&&(s6(a.current,uCe(n,Date.now()),o.current),a.current.size>0&&u(),o.current.size>0&&!n.some(e=>e.recTimingId!==void 0)&&o.current.clear())},[n,u]),(0,z.useEffect)(()=>{let e=()=>{s6(a.current,t.current??[],o.current),t.current&&(t.current.length=0),a.current.size>0&&u();for(let[e,t]of a.current)s.current.push({timingId:e,t4:t,clientSkew:c.current}),o.current.add(e);a.current.clear(),s.current.length>c6&&s.current.splice(0,s.current.length-c6);let e=o6(s.current,c.current,l6);e!==null&&(s.current.splice(0,e.length),r({samples:e}).catch(()=>{}))},n=window.setInterval(e,dCe);return()=>{for(window.clearInterval(n),e();o6(s.current,c.current,l6)!==null;)e()}},[r,t,u])}function u6(e){let t=e instanceof Error?e.message:``;return new Set([...t.matchAll(/Invalid: quote target gone \[([^\]]+)\]/g)].map(e=>e[1]))}function d6(e){let t=e instanceof Error?e.message:``;return u6(e).size>0?!1:/Invalid:.*quote/i.test(t)}function pCe({chatId:e}){let t=sa(),n=qF(),r=Nt(L.send.sendMessage).withOptimisticUpdate((e,t)=>{let n={chatId:t.chatId},r=e.getQuery(L.messages.listByChat,n)??[],i=`optimistic-${t.clientMessageId}`;if(r.some(e=>e._id===i))return;let a=Date.now(),o={_id:i,chatId:t.chatId,_creationTime:a,orderTime:void 0,role:`user`,status:`complete`,runId:void 0,error:void 0,errorCode:void 0,attachedDocCount:void 0,finalizedAt:void 0,text:t.text,updatedAt:a,routedInstanceName:t.routedAgent?.instanceName,routedAgentId:t.routedAgent?.agentId,quotedRefs:t.quotes,hasMergedRuns:!1,hasAnnouncePrefix:!1,mergedIntoTurn:void 0,autoRetry:void 0,interruptedAt:void 0,parts:[],outbox:null,importedAgentLabel:void 0,chatImportedAgentLabel:void 0};e.setQuery(L.messages.listByChat,n,[...r,o])}),i=I(L.messages.listByChat,e?{chatId:e}:`skip`),a=I(L.messages.getStreamingText,e?{chatId:e}:`skip`),o=a&&a.length>0?a[0].messageId:null,s=I(L.messages.getChatStreamTransport,e?{chatId:e}:`skip`)===`sse`||oCe(),c=(0,z.useRef)([]),l=(0,z.useRef)(0),u=(0,z.useCallback)((e,t)=>{t<l.current||c.current.push({timingId:e,t4:Date.now()})},[]),d=a&&a.length>0?a[0].streamRowId??null:null,f=sCe(o,d,s,u);l.current=(a?.[0]?.chunkSeq??1)-1,fCe(e,c);let p=I(L.agents.getChatAgent,e?{chatId:e}:`skip`),m=I(L.messages.getSessionMeta,e?{chatId:e}:`skip`),h=I(L.agents.listMyAgents,e?{}:`skip`),g=h===void 0,_=(0,z.useMemo)(()=>h??[],[h]),v=p?.multiAgent===!0,y=m?.perTurnRouting===!0,b=v||y,x=(0,z.useMemo)(()=>p?.agent?{instanceName:p.agent.instanceName,agentId:p.agent.agentId}:null,[p?.agent?`${p.agent.instanceName}\0${p.agent.agentId}`:``]),S=(0,z.useMemo)(()=>m?.lastRoutedInstanceName&&m?.lastRoutedAgentId?{instanceName:m.lastRoutedInstanceName,agentId:m.lastRoutedAgentId}:null,[m?.lastRoutedInstanceName&&m?.lastRoutedAgentId?`${m.lastRoutedInstanceName}\0${m.lastRoutedAgentId}`:``]),[C,w]=(0,z.useState)(null);(0,z.useEffect)(()=>{w(null)},[e]);let T=i===void 0,E=(0,z.useMemo)(()=>oSe(i??[]),[i]),D=(0,z.useMemo)(()=>(i?sSe(i):null)??S,[i,S]),O=(0,z.useMemo)(()=>z3({selected:null,lastRouted:D,primary:x,pool:_,poolLoading:g,messagesLoading:T,canRoute:b}),[D,x,_,g,T,b]),k=(0,z.useMemo)(()=>z3({selected:C,lastRouted:D,primary:x,pool:_,poolLoading:g,messagesLoading:T,canRoute:b}),[C,D,x,_,g,T,b]),A=cSe(i),ee=(0,z.useMemo)(()=>(i??[]).some(e=>e.role===`user`),[i]),j=i!==void 0&&i.length===0,M=(0,z.useRef)({selected:null,primary:null,perTurnRouting:!1,isFirstTurn:!1,canRoute:!1});M.current={selected:k,primary:x,perTurnRouting:y,isFirstTurn:A,canRoute:b};let te=(0,z.useCallback)(()=>{let e=M.current;return dSe({selected:e.selected,primary:e.primary,perTurnRouting:e.perTurnRouting,isFirstTurn:e.isFirstTurn,canRoute:e.canRoute})},[]),N=(0,z.useMemo)(()=>ZSe(t,e=>n.error(e),e,()=>te()??null),[t,n,e,te]),P=(0,z.useMemo)(()=>{let e=i??[];if(!a||a.length===0)return e;let t=new Map(a.map(e=>[e.messageId,{text:e.text,chunkSeq:e.chunkSeq,phase:e.phase}]));return e.map(e=>{if(e.status!==`streaming`)return e;let n=e._id,r=t.get(n);if(typeof e.runId==`string`&&e.runId.startsWith(`announce:v1:`)){let t=r?.phase;return t===void 0?e:{...e,phase:t}}if(f!==null&&f.messageId===o&&f.generationKey===d&&n===o){let t=(r?.chunkSeq??1)-1,n=f.lastSeq>=t;return{...e,text:n?f.text:r?.text??f.text,...r?.phase===void 0?{}:{phase:r.phase}}}return r===void 0?e:{...e,text:r.text,...r.phase===void 0?{}:{phase:r.phase}}})},[i,a,f,o]),ne=(0,z.useRef)(new Set),re=e=>e.role===`user`&&(e.outbox?.status===`queued`||ne.current.has(String(e._id))),ie=P.filter(re).map(e=>({messageId:String(e._id),text:e.text,pending:String(e._id).startsWith(`optimistic-`)})),ae=(0,z.useMemo)(()=>P.filter(e=>!re(e)),[P]),oe=ae.length>0?ae[ae.length-1].role:null,se=ae.some(e=>e.status===`streaming`),[ce,le]=(0,z.useState)(null);(0,z.useEffect)(()=>{le(null)},[e]),(0,z.useEffect)(()=>{oe===`assistant`&&le(null)},[oe,P]),(0,z.useEffect)(()=>{if(ce===null)return;let e=window.setTimeout(()=>le(null),12e4);return()=>window.clearTimeout(e)},[ce]);let ue=ce!==null||se,de=ie.length>0&&!se,fe=(0,z.useMemo)(()=>fSe(i??[]),[i]),pe=(0,z.useCallback)(e=>WSe(e,E.get(e._id)??null,fe.get(e._id)??null),[E,fe]),me=(0,z.useMemo)(()=>({messages:ae,isRunning:ue,convertMessage:pe,onNew:async t=>{if(!e)throw Error(`No chat selected`);let i=t.content.filter(e=>e.type===`text`).map(e=>e.text).join(``),a=XSe(t.attachments).map(e=>({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType,...e.origin?{origin:e.origin}:{}})),o=te(),s=Gx(e);le(Date.now());try{await r({chatId:e,text:i,clientMessageId:crypto.randomUUID(),attachments:a,...o?{routedAgent:o}:{},...s.length>0?{quotes:s.map(e=>({messageId:e.messageId,blockIndex:e.blockIndex,excerpt:e.excerpt}))}:{}})}catch(t){if(!d6(t)){let r=Kx(e,s,u6(t));r.gone>0&&n.error(Nd({count:r.gone})),r.dropped>0&&n.error(Di({count:r.dropped}))}throw le(null),t}},adapters:{attachments:N}}),[P,ue,e,r,N,te]),he=(0,z.useMemo)(()=>({begin:()=>le(Date.now()),cancel:()=>le(null)}),[]),ge=Nt(L.messages.abortTurn),_e=Nt(L.send.cancelQueuedMessage),ve=(0,z.useCallback)(async e=>{try{return await _e({messageId:e}),!0}catch{return n.error(vs()),!1}},[_e,n]),ye=(0,z.useCallback)(async t=>{let i=t.trim();if(!e||i===``)return!1;let a=te(),o=Gx(e),s=crypto.randomUUID();ne.current.add(`optimistic-${s}`);try{return await r({chatId:e,text:t,clientMessageId:s,...a?{routedAgent:a}:{},...o.length>0?{quotes:o.map(e=>({messageId:e.messageId,blockIndex:e.blockIndex,excerpt:e.excerpt}))}:{}}),!0}catch(t){if(!d6(t)){let r=Kx(e,o,u6(t));r.gone>0&&n.error(Nd({count:r.gone})),r.dropped>0&&n.error(Di({count:r.dropped}))}return n.error(t?.message?.includes(`QUEUE_FULL`)?Ao():rn()),!1}},[e,r,n,te]),be=(0,z.useMemo)(()=>({pool:_,multiAgent:v,perTurnRouting:y,hasUserTurn:ee,emptyThread:j,primary:x,selected:k,setSelected:w,messageAgents:E,fallbackAgent:O}),[_,v,y,ee,j,x,k,E,O]),xe=(0,z.useCallback)(async()=>{if(e)try{if((await ge({chatId:e})).ok){le(null);return}n.error(js())}catch(e){n.error(mc(),e)}},[e,ge,n]);return{runtime:qae(me),turnGate:he,queueSend:ye,abortTurn:xe,routing:be,lastUserTurnQueued:de,queuedTurns:ie,cancelQueued:ve,initialLoading:T}}function f6(e,{key:t,value:n}){let r=e.getQuery(L.me.getMe,{host:d3});if(!r?.ui)return;let i={...r.ui.effective},a={...r.ui.userOverrides},o=t,s=t;n===null?delete a[s]:(i[o]=n,a[s]=n),e.setQuery(L.me.getMe,{host:d3},{...r,ui:{...r.ui,effective:i,userOverrides:a}})}function mCe(e,{messageId:t}){for(let{args:n,value:r}of e.getAllQueries(L.messages.listByChat)){if(r===void 0)continue;let i=r.find(e=>e._id===t);if(i===void 0)continue;let a=i._creationTime;e.setQuery(L.messages.listByChat,n,r.filter(e=>e._creationTime<a))}}function hCe(e){let t=e instanceof Error?e.message:typeof e?.data==`string`?String(e.data):String(e??``);return/compact_refused|already_active|already_in_flight|deferred_compaction_not_scheduled|below_threshold|already_compacted_recently|unsupported_harness_compaction|no transcript|no sessionId/i.test(t)}function gCe(e){let t=Ei(L.agentFiles.compactSession),n=Nt(L.chatFork.forkChat),[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(null),l=async()=>{i(`compact`),o(null);try{await t({chatId:e.chatId}),c(`compact`),o(Xr())}catch(e){o(hCe(e)?Mi():zd())}finally{i(null)}},u=async()=>{if(e.messageId!==null){i(`branch`),o(null);try{let{chatId:t}=await n({branchMessageId:e.messageId});Z3(t,{expand:!0}),c(`branch`),o(Sd())}catch{o(zd())}finally{i(null)}}};return(0,B.jsxs)(`div`,{className:`oc-error-card__actions`,children:[(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`outline`,disabled:r!==null||s!==null,onClick:()=>void l(),children:r===`compact`?ee():Xi()}),e.messageId===null?null:(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`outline`,disabled:r!==null||s===`branch`,onClick:()=>void u(),children:r===`branch`?ee():hi()}),a===null?null:(0,B.jsx)(`p`,{className:`oc-error-card__notice`,role:`status`,children:a})]})}var p6=(0,z.createContext)(!1);function _Ce({retry:e}){let[,t]=(0,z.useState)(0);(0,z.useEffect)(()=>{let e=window.setInterval(()=>t(e=>e+1),1e3);return()=>window.clearInterval(e)},[]);let n=Math.max(0,Math.ceil((e.firesAt-Date.now())/1e3));return(0,B.jsxs)(`span`,{className:`oc-error-card__retry`,role:`status`,children:[(0,B.jsx)(zb,{size:13,className:`oc-error-card__retry-spin`,"aria-hidden":!0}),n>0?xee({attempt:String(e.attempt),max:String(e.maxAttempts),seconds:String(n)}):pl({attempt:String(e.attempt),max:String(e.maxAttempts)})]})}function vCe(){let e=M3(),t=U(e=>e.metadata?.custom?.status),n=U(e=>e.metadata?.custom?.runId),r=U(e=>e.metadata?.custom?.error),i=U(e=>e.metadata?.custom?.errorCode),a=U(e=>e.metadata?.custom?.autoRetry??null),o=U(e=>e.metadata?.custom?.chatId),s=U(e=>e.metadata?.custom?.messageId??e.id),c=U(e=>k0(e.content)),l=U(e=>e.metadata?.custom?.phase),u=U(e=>{let t=e.metadata?.custom;return t?.activeToolName??T0(t?.toolParts)?.name??null}),d=u===null?null:{name:u,family:w0(u)},f=(0,z.useContext)(p6),p=oge(t,c,l,d,U(e=>e.metadata?.custom?.interruptedAt!=null)),m=p?.kind===`thinking`,[h,g]=(0,z.useState)(!1);if((0,z.useEffect)(()=>{if(!m){g(!1);return}let e=window.setTimeout(()=>g(!0),6e3);return()=>window.clearTimeout(e)},[m]),!p)return null;if(p.kind===`error`){let{headline:e,detail:t,code:c}=O0(r,i);return(0,B.jsxs)(`div`,{className:`oc-error-card`,role:`alert`,title:n?`run ${n}`:void 0,children:[(0,B.jsx)(Py,{size:18,className:`oc-error-card__icon`,"aria-hidden":!0}),(0,B.jsxs)(`div`,{className:`oc-error-card__body`,children:[(0,B.jsx)(`span`,{className:`oc-error-card__title`,children:p.label}),e?(0,B.jsx)(`span`,{className:`oc-error-card__msg`,children:e}):null,t?(0,B.jsx)(`span`,{className:e?`oc-error-card__msg oc-error-card__msg--detail`:`oc-error-card__msg`,children:t}):null,a?(0,B.jsx)(_Ce,{retry:a}):null,c&&cge.has(c)&&o?(0,B.jsx)(gCe,{chatId:o,messageId:s??null}):null]})]})}return(0,B.jsxs)(`div`,{className:`oc-run-status oc-run-status--${p.kind}`,role:`status`,title:n?`run ${n}`:void 0,children:[p.kind===`thinking`?(0,B.jsxs)(`span`,{className:`oc-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{})]}):p.kind===`generating`?(0,B.jsx)(`span`,{className:`oc-run-status__pulse`,"aria-hidden":!0}):(0,B.jsx)(Jb,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:p.phased&&!f?`oc-run-status__label oc-shimmer-text`:`oc-run-status__label`,children:sge(p.kind,f)??(p.kind===`thinking`&&h&&!p.phased?iSe(e):p.label)})]})}function m6(e,t){return Math.max(0,t-e)}function h6(e,t,n){return e+Math.max(0,n-t)}function yCe(e,t,n){return e?!0:n!==void 0&&t===n}function g6(e){return c0(e)}var _6=(0,z.createContext)(null);function bCe(e){return e!==void 0&&e.some(e=>e.status===`streaming`)}function xCe(e,t,n,r){return t===null||n===null||n<=0?!1:!(r?.chatId===e&&r.key===t)}function SCe(){let e=U(e=>e.metadata?.custom?.status),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.sentAt),r=yCe(e===`streaming`,(0,z.useContext)(_6)?.messageId??null,t),i=(0,z.useRef)(null);if(r&&t!==void 0&&n!==void 0&&i.current?.id!==t){let e=Date.now();i.current={id:t,baselineMs:m6(n,e),firstLocalMs:e}}let[,a]=(0,z.useState)(0);if((0,z.useEffect)(()=>{if(!r)return;let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[r]),!r||i.current===null||i.current.id!==t)return null;let o=g6(h6(i.current.baselineMs,i.current.firstLocalMs,Date.now()));return o===null?null:(0,B.jsx)(`div`,{className:`oc-turn-clock`,role:`timer`,children:(0,B.jsx)(`span`,{className:`oc-turn-clock__label`,children:Om({duration:o})})})}var CCe={read:wy,exec:Zb,search:Bb,fetch:ob,write:jb,other:rx};function wCe(e){let t=U(e=>e.metadata?.custom?.status),[n,r]=(0,z.useState)(!1),{showTools:i}=o8(),a=e.args?.parts??[];if(!i||a.length===0)return null;let o=t===`streaming`&&a.some(e=>n6(e.phase)),s=CCe[FSe(a)],c=o?(0,B.jsx)(pb,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(B.Fragment,{children:[a.length>1?(0,B.jsx)(`span`,{className:`oc-flowact__count`,children:a.length}):null,(0,B.jsx)(ky,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0})]});return(0,B.jsxs)(`div`,{className:`oc-msg__meta oc-flowact`,role:`group`,"aria-label":Jn(),children:[(0,B.jsx)(sI,{icon:(0,B.jsx)(s,{size:14}),label:ISe(a,{live:o}),trailing:c,open:n,ariaExpanded:n,title:n?Lf():Xp(),onClick:()=>r(!n)}),n?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:a.map(e=>(0,B.jsx)(u0,{toolName:e.toolName,args:e.args,argsText:e.argsText,result:e.result,status:e.phase?{type:e.phase}:void 0,turnSettled:t!==void 0&&t!==`streaming`},e.toolCallId))}):null]})}function TCe(){let e=(0,z.useContext)(l8),t=dO(),n=(0,z.useRef)(null),r=e?.queuedTurns.length??0;if((0,z.useLayoutEffect)(()=>{let e=n.current,t=document.querySelector(`.oc-thread__viewport`);if(!t)return;if(!e||r===0){t.style.removeProperty(`--oc-dock-pad`);return}let i=()=>t.style.setProperty(`--oc-dock-pad`,`${e.offsetHeight}px`);i();let a=new ResizeObserver(i);return a.observe(e),()=>{a.disconnect(),t.style.removeProperty(`--oc-dock-pad`)}},[r]),e===null||r===0)return null;let{queuedTurns:i,cancelQueued:a}=e;return(0,B.jsx)(`div`,{ref:n,className:`oc-queue-dock`,role:`status`,"aria-label":kp(),children:i.map(e=>(0,B.jsxs)(`div`,{className:`oc-queue-card`,children:[(0,B.jsx)(Hy,{size:16,"aria-hidden":!0,className:`oc-queue-card__icon`}),(0,B.jsx)(`span`,{className:`oc-queue-card__text`,title:e.text,children:e.text}),(0,B.jsx)(`button`,{type:`button`,className:`oc-queue-card__btn`,title:mr(),"aria-label":mr(),disabled:e.pending,onClick:()=>{a(e.messageId).then(n=>{n&&t.composer.setText(e.text)})},children:(0,B.jsx)(jb,{size:15})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-queue-card__btn oc-queue-card__btn--danger`,title:Ut(),"aria-label":Ut(),disabled:e.pending,onClick:()=>void a(e.messageId),children:(0,B.jsx)($b,{size:15})})]},e.messageId))})}var v6=(0,z.createContext)(!1);function ECe(){let e=U(e=>e.metadata?.custom?.toolParts),t=U(e=>e.metadata?.custom?.status),[n,r]=(0,z.useState)(!1);if(!e||e.length===0)return null;let i=n,a=Ghe(e,t),o=a.running?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(pb,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}),el()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ky,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sr-only`,children:ud()})]});return(0,B.jsxs)(`div`,{className:`oc-toolact`,children:[(0,B.jsx)(sI,{icon:(0,B.jsx)(rx,{size:14}),label:a.label,trailing:o,open:i,ariaExpanded:i,title:i?Lf():Xp(),onClick:()=>r(!i)}),i?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:e.map(e=>(0,B.jsx)(u0,{toolName:e.toolName,args:e.args,argsText:e.argsText,result:e.result,status:e.phase?{type:e.phase}:void 0,turnSettled:t!==void 0&&t!==`streaming`},e.toolCallId))}):null]})}var DCe=new Set([`knobThinkingLevel`,`knobModel`,`knobFastMode`,`knobUnset`,`agentFiles`,`sessionCompact`,`configDefaults`,`subagents`,`inboundAttachments`,`talk`,`cronList`,`cronManage`]),OCe=new Set([`knobThinkingLevel`,`knobModel`]);function y6(e,t){return DCe.has(t)?e==null?OCe.has(t):e[t]===!0:!1}function kCe(e,t){return{model:e(`knobModel`)&&t.hasModels,thinking:e(`knobThinkingLevel`)&&t.hasLevels,speed:e(`knobFastMode`),reset:e(`knobUnset`)}}function ACe(e,t){return e===void 0?`loading`:e===null?{blocked:!y6(null,t),gatewayVersion:null,provider:null}:{blocked:!y6(e.capabilities,t),gatewayVersion:e.gatewayVersion,provider:e.provider}}function b6(e,t){let n=I(L.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,z.useCallback)(e=>y6(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,beyondValidated:n?.versionBeyondValidated===!0}}var jCe=18e4;function x6(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S6(e){let t=[];for(let n of e){if(n.toolName!==`sessions_spawn`)continue;let e=n.result;if(!x6(e))continue;let r=e.contentItems;if(Array.isArray(r))for(let e of r){let n=x6(e)?e.text:void 0;if(typeof n==`string`)try{let e=JSON.parse(n),r=x6(e)?e.childSessionKey:void 0;typeof r==`string`&&r!==``&&t.push(r)}catch{}}}return t}var MCe=new Set([`sessions_spawn`,`delegate_task`,`mixture_of_agents`]);function NCe(e){return e.some(e=>MCe.has(e.toolName))}function PCe(e){return e.some(e=>{let t=e.result;if(typeof t!=`object`||!t)return!1;let n=t.details;if(typeof n!=`object`||!n)return!1;let r=n;return r.async===!0&&typeof r.taskId==`string`})}function C6(e){return e?.trim()||void 0}function w6(e,t,n,r,i=Date.now()){if(e.hasText||e.hasMedia||e.status!==`complete`)return{kind:`none`};let a=new Set(S6(t)),o=n.filter(e=>r!==void 0&&e.parentMessageId===r||a.has(e.childSessionKey)),s=o.find(e=>e.status===`running`);if(s)return{kind:`waiting`,taskName:C6(s.taskName)};let c=o.filter(e=>e.kind!==`task`),l=c.find(e=>e.status===`error`||e.status===`aborted`);if(l)return{kind:`failed`,taskName:C6(l.taskName),reason:I0(l.errorMessage,l.errorCode)};let u=c.find(e=>e.status===`done`);if(u){let e=u.updatedAt+jCe;return i<e?{kind:`composing`,taskName:C6(u.taskName),recheckAt:e}:{kind:`done`,taskName:C6(u.taskName),resultText:u.resultText}}return{kind:`generic`}}function T6(e,t){return e===`done`?lu({count:t}):e===`running`?x({count:t}):xa({count:t})}function FCe({card:e}){let t=e.tone===`running`?pb:e.tone===`failed`?Py:ky,n=(0,z.useContext)(L0),r=e.tools?.length??0,i=n?.activeChildKey===e.childSessionKey,a=(0,B.jsxs)(B.Fragment,{children:[r>0?(0,B.jsx)(`span`,{className:`oc-actrow__toolcount`,children:r===1?Vp({count:r}):Df({count:r})}):null,(0,B.jsx)(t,{size:13,className:`oc-actrow__status-icon${e.tone===`running`?` oc-actrow__spin`:``}`,"aria-hidden":!0})]});return(0,B.jsxs)(`div`,{className:`oc-subagent oc-subagent--${e.tone}${e.moaRole===`moa_reference`?` oc-subagent--nested`:``}`,children:[(0,B.jsx)(sI,{tone:e.tone,icon:e.isTask?(0,B.jsx)(ix,{size:15}):(0,B.jsx)(Ey,{size:15}),label:e.isTask?e.label:A0(e),sublabel:e.isTask?void 0:e.taskName,trailing:a,active:i,ariaExpanded:e.isTask?void 0:i,ariaHasPopup:!e.isTask,title:e.isTask?void 0:Tf(),ariaLabel:e.isTask?void 0:Tf(),inert:e.isTask,onClick:()=>{e.isTask||n?.openFor(e.childSessionKey)}}),e.failure?(0,B.jsx)(`p`,{className:`oc-subagent__error`,role:`status`,children:I0(e.errorMessage,e.errorCode)}):null]})}var ICe=[];function LCe(){let e=U(e=>e.metadata?.custom?.chatId),t=U(e=>{let t=e.metadata?.custom;return t?.allToolParts??t?.toolParts??ICe}),n=(0,z.useMemo)(()=>S6(t),[t]),r=(0,z.useMemo)(()=>NCe(t)||PCe(t),[t]),i=U(e=>e.metadata?.custom?.messageId),a=r&&e?e:null,{can:o}=b6(a),s=I(L.subAgents.listSubAgents,a?{chatId:a}:`skip`),[c,l]=(0,z.useState)(!1);if(!r||!o(`subagents`))return null;let u=j0(M0(s??[],n,i)),d=[...u.cards];if(d.length===0)return null;let f=xge(u);return(0,B.jsxs)(`div`,{className:`oc-msg-subagents`,children:[f.length>0?(0,B.jsx)(sI,{icon:(0,B.jsx)(Ey,{size:15}),label:Sge(u.total),trailing:f.map(e=>(0,B.jsxs)(`span`,{className:`oc-subagent-badge oc-subagent-badge--${e.tone}`,title:T6(e.tone,e.count),"aria-label":T6(e.tone,e.count),children:[e.tone===`done`?(0,B.jsx)(ky,{size:12,"aria-hidden":!0}):e.tone===`running`?(0,B.jsx)(pb,{size:12,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(Py,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subagent-badge__count`,children:e.count})]},e.tone)),open:c,ariaExpanded:c,title:c?Lf():Xp(),onClick:()=>l(!c)}):null,(f.length===0||c)&&d.map(e=>(0,B.jsx)(`div`,{className:`oc-msg-subagents__anchor`,"data-subagent-id":e.id,"data-subagent-failed":e.failure?``:void 0,children:(0,B.jsx)(FCe,{card:e})},e.id))]})}function E6({delayDuration:e=0,...t}){return(0,B.jsx)(uce,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function D6({...e}){return(0,B.jsx)(dce,{"data-slot":`tooltip`,...e})}function O6({...e}){return(0,B.jsx)(fce,{"data-slot":`tooltip-trigger`,...e})}function k6({className:e,sideOffset:t=0,children:n,...r}){return(0,B.jsx)(pce,{children:(0,B.jsxs)(mce,{"data-slot":`tooltip-content`,sideOffset:t,className:Bp(`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,B.jsx)(hce,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function RCe(){return U(e=>e.metadata?.custom?.compaction??null)}function zCe(e){switch(e){case`overflow`:return Yt();case`manual`:return Vo();case`heap_threshold`:case`rss_threshold`:case`pre_compaction`:case`non_manual_trigger`:return ws();case`already_active`:case`already_in_flight`:case`deferred_compaction_not_scheduled`:case`unsupported_harness_compaction`:return hn();default:return``}}function BCe(){let e=RCe();if(!e)return null;let t=e.phase===`failed`,n=`${t?br():e.phase===`midturn`?er():sc()}${zCe(e.reason)}`;return(0,B.jsx)(E6,{delayDuration:150,children:(0,B.jsxs)(D6,{children:[(0,B.jsx)(O6,{asChild:!0,children:(0,B.jsxs)(`div`,{className:`oc-compaction${t?` oc-compaction--failed`:``}`,role:`note`,"aria-label":n,children:[(0,B.jsx)(`span`,{className:`oc-compaction__rule`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`oc-compaction__label`,children:[(0,B.jsx)($y,{size:12,"aria-hidden":!0}),t?Fp():Hs()]}),(0,B.jsx)(`span`,{className:`oc-compaction__rule`,"aria-hidden":!0})]})}),(0,B.jsx)(k6,{className:`oc-compaction__tip`,children:n})]})})}function VCe(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)}${Ro()} ${r%24}h`}function A6(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:VCe(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 HCe=/^(?:[a-z0-9][a-z0-9_.]{0,15}-)?[a-z0-9]{25,40}$/;function UCe(e){let t=e.trim();return HCe.test(t)?t:null}var j6=null;function M6(e,t){j6={messageId:e,terms:t}}function WCe(e){if(j6===null||j6.messageId!==e)return null;let t=j6.terms;return j6=null,t}function GCe(e){return e.readOnly?`read_only`:e.unavailable?`unavailable`:e.degraded?`degraded`:e.beyondValidated?`beyond_validated`:null}function KCe(e){return e.turnRunning?{mode:`queue`,reason:`turn`}:e.hasRunningSubAgent?{mode:`queue`,reason:`subagent`}:{mode:`send`,reason:null}}function N6({...e}){return(0,B.jsx)(Th,{"data-slot":`sheet`,...e})}function qCe({...e}){return(0,B.jsx)(Sh,{"data-slot":`sheet-portal`,...e})}function JCe({className:e,...t}){return(0,B.jsx)(Ch,{"data-slot":`sheet-overlay`,className:Bp(`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 P6({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,B.jsxs)(qCe,{children:[(0,B.jsx)(JCe,{}),(0,B.jsxs)(wh,{"data-slot":`sheet-content`,"data-side":n,className:Bp(`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,B.jsx)(Oh,{"data-slot":`sheet-close`,asChild:!0,children:(0,B.jsxs)(Ih,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,B.jsx)(xh,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:Fc()})]})})]})]})}function F6({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`sheet-header`,className:Bp(`flex flex-col gap-0.5 p-4`,e),...t})}function I6({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`sheet-footer`,className:Bp(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function L6({className:e,...t}){return(0,B.jsx)(Dh,{"data-slot":`sheet-title`,className:Bp(`font-heading text-base font-medium text-foreground`,e),...t})}function R6({className:e,...t}){return(0,B.jsx)(Eh,{"data-slot":`sheet-description`,className:Bp(`text-sm text-muted-foreground`,e),...t})}function YCe({mimeType:e,data:t,filename:n,storageId:r}){let i=e??``,a=t??``,o=n??`attachment`;return a?i.startsWith(`audio/`)?(0,B.jsxs)(`div`,{className:`oc-media oc-media--audio`,children:[(0,B.jsx)(`audio`,{controls:!0,preload:`metadata`,src:a,className:`oc-media__audio`,children:(0,B.jsx)(`a`,{href:a,download:o,children:Hl()})}),(0,B.jsx)(`span`,{className:`oc-media__name`,children:o})]}):i.startsWith(`image/`)?(0,B.jsx)(ZCe,{url:a,name:o}):i.startsWith(`video/`)?(0,B.jsxs)(`div`,{className:`oc-media oc-media--video`,children:[(0,B.jsx)(`video`,{controls:!0,preload:`metadata`,src:a,className:`oc-media__video`}),(0,B.jsx)(`span`,{className:`oc-media__name`,children:o})]}):(0,B.jsx)(XCe,{url:a,name:o,mime:i,storageId:r}):null}function XCe({url:e,name:t,mime:n,storageId:r}){let i=R1(),a=E1(n,t)!==`none`,o=!!r&&w1(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,B.jsxs)(`span`,{className:`oc-media oc-media--file oc-filechip`,title:t,children:[(0,B.jsxs)(`a`,{className:`oc-filechip__main`,href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:c,"aria-label":zm({name:t}),children:[(0,B.jsx)(`span`,{className:`oc-media__icon`,"aria-hidden":!0,children:`📄`}),(0,B.jsx)(`span`,{className:`oc-media__name`,children:t})]}),(0,B.jsx)(`a`,{className:`oc-filechip__btn`,href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:c,title:zm({name:t}),"aria-label":zm({name:t}),children:(0,B.jsx)(Gy,{size:14,"aria-hidden":!0})}),s?(0,B.jsx)(`button`,{type:`button`,className:`oc-filechip__btn`,onClick:()=>i.openFor({url:e,filename:t,mimeType:n||null,storageId:r,sourceStorageId:o?r:void 0}),title:km({name:t}),"aria-label":km({name:t}),children:(0,B.jsx)(by,{size:14,"aria-hidden":!0})}):null]})}function ZCe({url:e,name:t}){let{open:n}=Dhe();return(0,B.jsx)(`button`,{type:`button`,className:`oc-media oc-media--thumb`,onClick:()=>n({url:e,name:t}),title:t,"aria-label":t,children:(0,B.jsx)(`img`,{src:e,alt:t,className:`oc-media__thumbimg`,loading:`lazy`,decoding:`async`})})}var z6=1e3;function QCe(){return[{id:`incorrect`,label:Kc()},{id:`incoherence`,label:rd()},{id:`altered_words`,label:Hp()},{id:`formatting`,label:Of()},{id:`latency`,label:um()},{id:`api_error`,label:Ql()},{id:`other`,label:f()}]}function $Ce(){return[{id:`altered_words`,label:fa()},{id:`formatting`,label:hc()},{id:`other`,label:f()}]}function ewe(e){return e===`user`?$Ce():QCe()}var twe=[{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 nwe(){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 twe)try{document.querySelector(n)&&t.push(e)}catch{}return{plugins:e,extensionsDetected:t}}var B6=z.createContext(null);function rwe(){let e=z.useContext(B6);if(!e)throw Error(`useFeedback must be used within <FeedbackProvider>`);return e}function iwe({children:e}){let t=Nt(L.feedback.submitFeedback),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(null),[m,h]=(0,z.useState)(!1),g=z.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`,...nwe()}});d(e.displayedMatchesStored),p(String(e.reference??e.feedbackId))}catch{l(!1)}}}let y=u!==null,b=n?.role===`user`;return(0,B.jsxs)(B6.Provider,{value:g,children:[e,(0,B.jsx)(d0,{open:n!==null,onOpenChange:_,children:n?(0,B.jsxs)(f0,{className:`sm:max-w-md`,children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:Ms()}),(0,B.jsx)(g0,{children:y?Zs():b?Un():wp()})]}),y?(0,B.jsxs)(`div`,{className:`oc-feedback__result`,role:`status`,children:[n.sourceWasOpen?u===!0?(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-ok`,children:lr()}):(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-warn`,children:Rt()}):(0,B.jsx)(`p`,{className:`oc-feedback__fidelity`,children:ps()}),f?(0,B.jsxs)(`div`,{className:`oc-feedback__ref`,children:[(0,B.jsx)(`span`,{className:`oc-feedback__ref-label`,children:kt()}),(0,B.jsx)(`code`,{className:`oc-feedback__ref-id`,title:f,children:f}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:na(),"aria-label":na(),onClick:()=>{navigator.clipboard.writeText(f).then(()=>{h(!0),window.setTimeout(()=>h(!1),1500)})},children:m?(0,B.jsx)(ky,{size:14}):(0,B.jsx)(Vy,{size:14})})]}):null]}):(0,B.jsxs)(`div`,{className:`oc-feedback__form`,children:[(0,B.jsx)(`label`,{className:`oc-feedback__label`,children:jo()}),(0,B.jsxs)(_0,{value:i,onValueChange:a,children:[(0,B.jsx)(y0,{children:(0,B.jsx)(v0,{placeholder:an()})}),(0,B.jsx)(b0,{children:ewe(n.role).map(e=>(0,B.jsx)(x0,{value:e.id,children:e.label},e.id))})]}),(0,B.jsx)(`label`,{className:`oc-feedback__label`,htmlFor:`oc-feedback-comment`,children:Jo()}),(0,B.jsx)(`textarea`,{id:`oc-feedback-comment`,className:`oc-feedback__textarea`,placeholder:le(),value:o,maxLength:z6,onChange:e=>s(e.target.value.slice(0,z6)),rows:4}),(0,B.jsxs)(`div`,{className:`oc-feedback__count`,children:[o.length,`/`,z6]})]}),(0,B.jsx)(m0,{children:y?(0,B.jsx)(Ih,{onClick:()=>_(!1),children:Uee()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ih,{variant:`outline`,onClick:()=>_(!1),children:ka()}),(0,B.jsx)(Ih,{onClick:()=>void v(),disabled:!i||c,children:c?Or():wn()})]})})]}):null})]})}function awe(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 V6(){let e=rwe(),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.chatId),r=U(e=>e.role),i=U(e=>e.metadata?.custom?.rawText??``),a=I(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,...awe(a.currentTarget,i)})}return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn${o?` is-on`:``}`,title:o?vt():Ki(),"aria-label":di(),onClick:s,children:(0,B.jsx)(Qy,{size:15,"aria-hidden":!0})})}function H6(e,t){return e!=null&&e[t]!==void 0}var owe=[`inherit`,`fast`,`standard`];function swe(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function cwe(e){return e===`inherit`?tf():e===`fast`?kl():aee()}function lwe(e){return e===`inherit`?null:e===`fast`}function U6(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function W6(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var uwe={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function dwe(e,t){return uwe[e]??t}function G6(e){return K6(e).used}function K6(e){if(!e)return{used:null,source:`unknown`};let t=e.contextTokens,n=e=>e==null||t&&e>t?null:e;if(e.estimatedPromptTokens!=null)return{used:e.estimatedPromptTokens,source:`budget_estimate`};let r=n(e.activeTokens);if(r!=null)return{used:r,source:`last_call_usage`};if(e.totalTokensFresh===!1)return{used:null,source:`unknown`};let i=n(e.totalTokens);return i==null?{used:null,source:`unknown`}:{used:i,source:`last_call_usage`}}function q6(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function fwe(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=G6(e),n=q6(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function pwe(e){return K6(e).source}function J6(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function mwe(e,t){let n=J6(e,t);return n===null?null:qn({pct:n,used:U6(e),total:U6(t)})}function hwe(e){return pr({level:e??`full`})}function gwe(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?Po({cost:e.toFixed(2),tokens:U6(t)}):n?cn({cost:e.toFixed(2)}):r?Zo({tokens:U6(t)}):null}function _we(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function vwe(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=G6(e),i=q6(e);if(r===null||i===null)return null;let a=J6(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}function ywe(e){let t=Nt(L.chats.setSessionKnob),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null);return{apply:(0,z.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 Y6({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0}){return(0,B.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,B.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,B.jsx)(pb,{size:13,className:`oc-spanel__spin`,"aria-label":gf()}):t?c?(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:Gu(),"aria-label":Gu(),onClick:n,children:(0,B.jsx)(Rb,{size:12,"aria-hidden":!0})}):null:(0,B.jsx)(`span`,{className:`oc-spanel__badge`,children:Mu()})]}),(0,B.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,B.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,B.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[dp(),(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:vu()})]}):null]})}function X6({options:e,value:t,onChange:n,disabled:r}){return(0,B.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,children:e.map(e=>(0,B.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 bwe({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,B.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,B.jsx)(`option`,{value:``,disabled:!0,hidden:!0}):null,a?null:(0,B.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function Z6({chatId:e,sm:t,settings:n}){let{apply:r,pending:i,error:a}=ywe(e),{can:o}=b6(e),s=i!==null,c=(0,z.useCallback)(()=>{a&&r(a.field,a.value)},[r,a]),l=t.thinkingLevels??[],u=t.availableModels??[],d=swe(n),f=kCe(o,{hasModels:u.length>0,hasLevels:l.length>0});return(0,B.jsxs)(B.Fragment,{children:[f.model?(0,B.jsx)(Y6,{label:Af(),overridden:H6(n,`model`),onReset:()=>void r(`model`,null),pending:i===`model`,error:a?.field===`model`,onRetry:c,resettable:f.reset,children:u.length<=4?(0,B.jsx)(X6,{options:u,value:t.model??null,onChange:e=>void r(`model`,e),disabled:s}):(0,B.jsx)(bwe,{options:u,value:t.model??null,onChange:e=>void r(`model`,e),disabled:s,ariaLabel:Af()})}):null,f.thinking?(0,B.jsx)(Y6,{label:Ul(),overridden:H6(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:i===`thinkingLevel`,error:a?.field===`thinkingLevel`,onRetry:c,resettable:f.reset,children:(0,B.jsx)(X6,{options:l.map(e=>({id:e.id,label:dwe(e.id,W6(e.label)),title:W6(e.label)})),value:t.thinkingLevel??null,onChange:e=>void r(`thinkingLevel`,e),disabled:s})}):null,f.speed?(0,B.jsx)(Y6,{label:Am(),overridden:H6(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:i===`fastMode`,error:a?.field===`fastMode`,onRetry:c,resettable:f.reset,children:(0,B.jsx)(X6,{options:owe.map(e=>({id:e,label:cwe(e)})),value:d,onChange:e=>void r(`fastMode`,lwe(e)),disabled:s})}):null]})}function Q6(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function $6({label:e,state:t,destructive:n,disabled:r,disabledHint:i,onClick:a,onRetry:o}){return(0,B.jsxs)(`div`,{className:`oc-spanel__action`,children:[(0,B.jsxs)(Ih,{variant:n?`destructive`:`outline`,size:`sm`,disabled:t===`pending`||r===!0,onClick:a,children:[t===`pending`?(0,B.jsx)(pb,{className:`oc-spanel__spin`,"aria-hidden":!0}):null,e]}),t===`done`?(0,B.jsx)(`p`,{className:`oc-spanel__action-note`,role:`status`,children:xd()}):null,t===`error`?(0,B.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[A(),(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:o,children:vu()})]}):null,r===!0&&i?(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:i}):null]})}function xwe({chatId:e,open:t,onOpenChange:n}){let r=I(L.messages.getSessionMeta,t?{chatId:e}:`skip`),i=I(L.chatSummaries.getChatSummary,t?{chatId:e}:`skip`),a=I(L.agents.getChatAgent,t?{chatId:e}:`skip`),o=(I(L.messages.getStreamingText,t?{chatId:e}:`skip`)?.length??0)>0,s=r?.sessionMeta??null,c=r?.sessionSettings??null,{can:l}=b6(t?e:null),u=G3(),d=Ei(L.agentFiles.compactSession),f=Nt(L.chats.resetSession),m=Nt(L.chatSummaries.requestSummarize),[h,g]=(0,z.useState)(`idle`),[_,v]=(0,z.useState)(`idle`),[b,x]=(0,z.useState)(`idle`),[S,C]=(0,z.useState)(null),[w,T]=(0,z.useState)(null),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)(!1),[A,ee]=(0,z.useState)(null),[j,M]=(0,z.useState)(`idle`),te=Nt(L.chatSummaries.updateSummary);(0,z.useEffect)(()=>{ee(null),M(`idle`),k(!1),D(!1),C(null),x(`idle`),T(null),v(`idle`)},[e]);async function N(){if(i?.summary)try{await navigator.clipboard.writeText(i.summary),D(!0),window.setTimeout(()=>D(!1),2e3)}catch{}}async function ne(){if(!(A===null||A.trim().length===0)){M(`saving`);try{await te({chatId:e,summary:A}),ee(null),M(`idle`)}catch{M(`error`)}}}let[re,ie]=(0,z.useState)(()=>Date.now()),ae=i?.jobInFlight===!0;(0,z.useEffect)(()=>{if(!ae)return;let e=window.setInterval(()=>ie(Date.now()),1e3);return()=>window.clearInterval(e)},[ae]);async function oe(){g(`pending`);try{await d({chatId:e}),g(`done`)}catch{g(`error`)}}async function se(){x(`pending`),C(null);try{let{outcome:t}=await m({chatId:e});C(({dispatched:Wd,in_flight:Ri,nothing_to_do:Xe,scanning:Fm,bridge_outdated:Sm,engine_off:lt,no_agent:So,backoff:Xe}[t]??Xe)()),x(t===`dispatched`||t===`scanning`?`done`:`idle`)}catch{x(`error`)}}async function ce(){v(`pending`),T(null);try{let t=await f({chatId:e});if(t!==void 0&&t.ok===!1){v(`idle`),T(Yr());return}v(`done`)}catch{v(`error`)}}async function le(){await u({title:Gee(),description:Ma(),confirmLabel:jr(),cancelLabel:Qr()})&&await oe()}async function ue(){await u({title:xt(),description:Yi(),confirmLabel:mi(),cancelLabel:Qr(),destructive:!0})&&await ce()}let de=G6(s),pe=q6(s),me=J6(de??void 0,pe??void 0),he=me==null?``:me>=90?`is-critical`:me>=75?`is-warn`:`is-ok`,ge=mwe(de??void 0,pe??void 0),_e=fwe(s),ve=gwe(s?.estimatedCostUsd,s?.totalTokens),ye=a?.agent??null,be=_we([ye?ye.displayName??ye.agentId:null,s?.agentRuntime,s?.model]);return(0,B.jsx)(N6,{open:t,onOpenChange:n,children:(0,B.jsxs)(P6,{side:`right`,className:`oc-spanel`,children:[(0,B.jsxs)(F6,{children:[(0,B.jsx)(L6,{children:Zc()}),(0,B.jsx)(R6,{children:sd()})]}),(0,B.jsx)(`div`,{className:`oc-spanel__body`,children:r===void 0?(0,B.jsx)(`p`,{className:`oc-spanel__loading`,children:et()}):(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:qp()}),(0,B.jsx)(Z6,{chatId:e,sm:s,settings:c})]}):null,(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:Nf()}),ge!==null&&me!==null?(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:gc()}),(0,B.jsxs)(`span`,{className:`oc-meter oc-spanel__meter ${he}`,children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(me,100)}%`}})}),(0,B.jsx)(`span`,{className:`oc-meter__label`,children:ge})]})]}):null,_e===null?null:(0,B.jsx)(`p`,{className:`oc-spanel__help oc-spanel__help--warn`,children:_e===`compaction_failed`?ec():Ps()}),(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:Op()}),(0,B.jsx)(`span`,{className:`oc-spanel__value`,children:hwe(s?.verboseLevel)}),(0,B.jsx)(`p`,{className:`oc-spanel__help`,children:Ht()})]}),ve===null?null:(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:_s()}),(0,B.jsx)(`span`,{className:`oc-spanel__value`,children:ve})]})]}),be!==null||s?(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:p()}),(0,B.jsxs)(`dl`,{className:`oc-spanel__kv`,children:[ye?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:Mn()}),(0,B.jsxs)(`dd`,{children:[ye.emoji?`${ye.emoji} `:``,ye.displayName??ye.agentId]})]}):null,ye?.instanceName?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:hm()}),(0,B.jsx)(`dd`,{children:ye.instanceName})]}):null,s?.model?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:wm()}),(0,B.jsx)(`dd`,{children:s.model})]}):null,s?.modelProvider?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:du()}),(0,B.jsx)(`dd`,{children:s.modelProvider})]}):null,s?.agentRuntime?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:La()}),(0,B.jsx)(`dd`,{children:s.agentRuntime})]}):null,s?.thinkingLevel?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:y()}),(0,B.jsx)(`dd`,{children:s.thinkingLevel})]}):null,s?.thinkingDefault?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:nu()}),(0,B.jsx)(`dd`,{children:s.thinkingDefault})]}):null]})]}):null,(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:ra()}),i?(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:Ie()}),(0,B.jsxs)(`span`,{className:`oc-meter oc-spanel__meter is-ok`,children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(i.pendingChars/Math.max(i.thresholdChars,1)*100,100)}%`}})}),(0,B.jsx)(`span`,{className:`oc-meter__label`,children:io({pending:`${Q6(i.pendingChars)}${i.pendingApprox?`+`:``}`,threshold:Q6(i.thresholdChars)})})]})]}):null,i&&!i.jobInFlight&&i.pendingChars>=i.thresholdChars?(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:Eee()}):null,i?.jobInFlight?(0,B.jsxs)(`p`,{className:`oc-spanel__hint oc-spanel__job`,role:`status`,children:[(0,B.jsx)(pb,{size:13,className:`oc-spanel__job-spin`,"aria-hidden":!0}),i.jobStreaming?Pl():sf(),i.jobStartedAt?` · ${Math.max(0,Math.round((re-i.jobStartedAt)/1e3))} s`:``]}):null,i&&i.summary.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{className:`oc-spanel__hint`,children:[Si({count:String(i.coveredCount),date:o0(i.updatedAt,{dateStyle:`short`,timeStyle:`short`})}),i.lastAgentId?` ${dee({agent:i.lastInstanceName?`${i.lastAgentId} (${i.lastInstanceName})`:i.lastAgentId})}`:``]}),i.failureCount>0?(0,B.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:ri({count:String(i.failureCount)})}):null,(0,B.jsxs)(`div`,{className:`oc-spanel__summary-tools`,children:[(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>void N(),title:am(),"aria-label":am(),children:E?(0,B.jsx)(ky,{size:14,"aria-hidden":!0}):(0,B.jsx)(Vy,{size:14,"aria-hidden":!0})}),(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>k(!0),title:np(),"aria-label":np(),children:(0,B.jsx)(gb,{size:14,"aria-hidden":!0})}),i.jobInFlight?null:(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>{ee(i.summary),k(!0)},title:rl(),"aria-label":rl(),children:(0,B.jsx)(jb,{size:14,"aria-hidden":!0})})]}),(0,B.jsx)(`div`,{className:`oc-spanel__summary`,children:i.summary})]}):i&&i.failureCount>0?(0,B.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:ri({count:String(i.failureCount)})}):i?.jobInFlight?null:(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:Od()})]})]})}),(0,B.jsx)(d0,{open:O,onOpenChange:e=>{k(e),e||(ee(null),M(`idle`))},children:(0,B.jsxs)(f0,{className:`oc-summary-dialog`,children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:ra()}),(0,B.jsx)(g0,{children:A===null?i&&i.summary.length>0?Si({count:String(i.coveredCount),date:o0(i.updatedAt,{dateStyle:`short`,timeStyle:`short`})}):``:Vf()})]}),A===null?(0,B.jsx)(`div`,{className:`oc-summary-dialog__body`,children:i?.summary??``}):(0,B.jsx)(`textarea`,{className:`oc-summary-dialog__body oc-summary-dialog__edit`,value:A,onChange:e=>ee(e.target.value)}),j===`error`?(0,B.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:em()}):null,(0,B.jsx)(`div`,{className:`oc-summary-dialog__actions`,children:A===null?(0,B.jsxs)(B.Fragment,{children:[i&&i.summary.length>0&&!i.jobInFlight?(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,onClick:()=>ee(i.summary),children:[(0,B.jsx)(jb,{size:14,"aria-hidden":!0}),rl()]}):null,(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,onClick:()=>void N(),children:[E?(0,B.jsx)(ky,{size:14,"aria-hidden":!0}):(0,B.jsx)(Vy,{size:14,"aria-hidden":!0}),am()]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,onClick:()=>{ee(null),M(`idle`)},children:Qr()}),(0,B.jsx)(Ih,{size:`sm`,disabled:A.trim().length===0||j===`saving`,onClick:()=>void ne(),children:j===`saving`?gf():pd()})]})})]})}),(0,B.jsxs)(I6,{className:`oc-spanel__actions`,children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:pa()}),l(`sessionCompact`)?(0,B.jsx)($6,{label:fe(),state:h,onClick:()=>void le(),onRetry:()=>void oe()}):null,(0,B.jsx)($6,{label:P(),state:ae?`pending`:b,onClick:()=>void se(),onRetry:()=>void se()}),S===null?null:(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:S}),(0,B.jsx)($6,{label:Dn(),state:_,destructive:!0,disabled:o,disabledHint:Yr(),onClick:()=>void ue(),onRetry:()=>void ce()}),!o&&w!==null?(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:w}):null]})]})})}function Swe(e){let t=null;for(let n of e)(t===null||n.createdAt>=t.createdAt)&&(t=n);return t===null?{kind:`bottom`}:{kind:`bookmark`,messageId:t.messageId,blockIndex:t.blockIndex}}var Cwe=class{last=-1;stable=0;observe(e){return e===this.last?(this.stable+=1,this.stable>=3):(this.last=e,this.stable=0,!1)}};function wwe(e){if(e.kind===`bottom`)return Math.max(0,e.scrollHeight-e.clientHeight);if(e.anchorDelta===void 0)return null;let t=Math.max(24,e.clientHeight*.3);return Math.max(0,e.scrollTop+e.anchorDelta-t)}function Twe(e,t,n=()=>performance.now()){let r=n(),i=new Cwe,a=0,o=!1,s=()=>{o||(o=!0,a&&cancelAnimationFrame(a),a=0,e.removeAttribute(`data-oc-landing`))},c=()=>{if(t.kind!==`bookmark`)return;let n=e.querySelector(`[data-message-id="${CSS.escape(t.messageId)}"]`);if(n)return(t.blockIndex===null?n:n.querySelector(`[data-block-index="${t.blockIndex}"]`)??n).getBoundingClientRect().top-e.getBoundingClientRect().top},l=()=>{if(o)return;let u=wwe({kind:t.kind,scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,anchorDelta:c()});if(u!==null&&(e.scrollTop=u),u!==null&&i.observe(e.scrollHeight)||n()-r>=1200){s();return}a=requestAnimationFrame(l)};return a=requestAnimationFrame(l),s}function Ewe(e){let t=zF()?.rows;(0,z.useEffect)(()=>{if(!e.ready||e.focusMessageId)return;let n=document.querySelector(`.oc-thread__viewport`);if(!n)return;n.setAttribute(`data-oc-landing`,``);let r=Twe(n,Swe(t??[]));return()=>{r()}},[e.chatId,e.ready,e.focusMessageId])}var e8={showSource:!0,showReport:!0,copyAssistant:!0,copyUser:!0,showDelete:!0,showTools:!1,voiceInput:!1,showUsage:!0,autoReadAloud:!0},t8=(0,z.createContext)({enabled:!1,lang:`auto`,rate:1,autoRead:!1,engine:`browser`,loaded:!1}),n8=(0,z.createContext)({active:null,setActive:()=>{},clearIf:()=>{}}),r8=0;function i8(){r8++,Ax(),Ix()}var a8=(0,z.createContext)(e8);function o8(){return(0,z.useContext)(a8)}var s8=(0,z.createContext)(null),c8=(0,z.createContext)(null),l8=(0,z.createContext)(null),u8=(0,z.createContext)(null),d8=(0,z.createContext)(null),f8=(0,z.createContext)(null);function p8(){return(0,z.useContext)(f8)}function m8({className:e}){let t=M3();return(0,B.jsx)(`div`,{className:e,"aria-hidden":!0,children:t.logoUrl?t.logoMasked?(0,B.jsx)(`span`,{className:`oc-avatar__img oc-avatar__img--mask`,style:{"--oc-logo-url":`url("${t.logoUrl}")`}}):(0,B.jsx)(`img`,{className:`oc-avatar__img`,src:t.logoUrl,alt:``}):t.isDefault?(0,B.jsx)(A3,{className:`oc-avatar__mark`}):t.initials})}function h8({chatId:e,focusMessageId:t}){let{runtime:n,turnGate:r,queueSend:i,abortTurn:a,routing:o,lastUserTurnQueued:s,queuedTurns:c,cancelQueued:l,initialLoading:u}=pCe({chatId:e}),d=I(L.me.getMe,{host:d3}),f=d?.ui?.effective??e8,p=f.showTools,m=m3(d?.resolvedThemeMode),h=d?.resolvedChartBrand,g=d?.resolvedChartTokens,_=I(L.agents.getChatAgent,e?{chatId:e}:`skip`),v=_?.multiAgent?_.agent:null,y=(0,z.useMemo)(()=>{let e=h?.label??`Atrium`,t=g?.colors?.[m],n=tSe(h,nSe(t?.primary,t?.[`primary-foreground`],m));return{label:e,logoUrl:n?.url??null,logoMasked:n?.masked??!1,isDefault:h?.isDefault??!0,initials:rSe(e),agentName:v?.displayName??v?.agentId??null,agentEmoji:v?.emoji??null}},[h,m,g,v]),b=Nt(L.me.setUiPref).withOptimisticUpdate(f6),x=I(L.messages.getSessionMeta,e?{chatId:e}:`skip`),S=e!==null&&x===null,C=d?.userId??``,w=e??null,T=n2(),E=Z0(),D=Hge((0,z.useSyncExternalStore)(U0,W0,W0),{userId:C,chatId:w}),O=_?.agent?.instanceName??null,k=(0,z.useCallback)((e,t)=>{Lge({kind:e,ownerUserId:C,originChatId:w,originLabel:x?.title||mu(),params:t})},[C,w,x?.title]),A=(0,z.useCallback)(()=>{D!==null&&K0(D.pinId)},[D]),ee=D?.kind===`sources`?D.params.messageId:null,j=D?.kind===`subagent`?D.params.childKey:null,M=D?.kind===`document`?D.params.doc:null,te=D?.kind===`cron`?D.params:null,N=(0,z.useMemo)(()=>({activeMessageId:ee,openFor:e=>k(`sources`,{messageId:e}),close:A}),[ee,k,A]),P=N3(y),ne=(0,z.useMemo)(()=>({activeChildKey:j,openFor:e=>k(`subagent`,{childKey:e,parentAgentLabel:P}),close:A}),[j,P,k,A]),re=M1;(0,z.useEffect)(()=>()=>{re.current=null},[re]);let ie=(0,z.useMemo)(()=>({activeDoc:M,openFor:e=>k(`document`,{doc:e}),openNewerVersion:e=>{D===null?k(`document`,{doc:e}):q0(D.pinId,{doc:e})},close:A}),[M,D,k,A]),ae=(0,z.useMemo)(()=>({active:te,openFor:(e,t,n)=>{let r=t??O;r!==null&&k(`cron`,{instanceName:r,jobId:e.jobId??null,part:e,occurrenceId:n})},close:A}),[te,O,k,A]),oe=ee!==null,se=j!==null,ce=M!==null,le=te!==null,ue=D?.kind??null,de=D?.params??null,fe=ue===null?null:zge(ue,de??{}),pe=le||ce||se||oe,me=ue===null||J0(E,ce?380:se?320:300),he=pe&&(T||!me)&&D?.pinned!==!0,ge=I(L.voice.voiceConfigForChat,e?{chatId:e}:`skip`),[_e,ve]=(0,z.useState)(null),ye=(0,z.useMemo)(()=>({active:_e,setActive:ve,clearIf:e=>ve(t=>t?.messageId===e?null:t)}),[_e]);(0,z.useEffect)(()=>{i8(),ve(null)},[e]);let be=(0,z.useMemo)(()=>ge?{...ge,loaded:!0}:{enabled:!1,lang:`auto`,rate:1,autoRead:!1,engine:`browser`,loaded:!1},[ge]);return(0,B.jsx)(xoe,{runtime:n,children:(0,B.jsx)(t8.Provider,{value:be,children:(0,B.jsx)(n8.Provider,{value:ye,children:(0,B.jsx)(s8.Provider,{value:r,children:(0,B.jsx)(c8.Provider,{value:i,children:(0,B.jsx)(l8.Provider,{value:{queuedTurns:c,cancelQueued:l},children:(0,B.jsx)(d8.Provider,{value:e,children:(0,B.jsx)(u8.Provider,{value:a,children:(0,B.jsx)(v6.Provider,{value:s,children:(0,B.jsx)(f8.Provider,{value:o,children:(0,B.jsx)(a8.Provider,{value:f,children:(0,B.jsx)(j3.Provider,{value:y,children:(0,B.jsx)(r0.Provider,{value:N,children:(0,B.jsx)(L0.Provider,{value:ne,children:(0,B.jsx)(cI.Provider,{value:ae,children:(0,B.jsx)(N1.Provider,{value:re,children:(0,B.jsx)(L1.Provider,{value:ie,children:(0,B.jsxs)(W1,{children:[(0,B.jsx)(`div`,{className:`oc-chat`,children:(0,B.jsx)(`div`,{className:`oc-chat__convo`,children:e?S?(0,B.jsx)(Dwe,{}):(0,B.jsx)(Mwe,{chatId:e,showTools:p,onToggleTools:()=>void b({key:`showTools`,value:!p}),focusMessageId:t??null,initialLoading:u}):(0,B.jsx)(`div`,{className:`oc-empty`,children:nh()})})}),oe&&he?(0,B.jsx)(N6,{open:!0,onOpenChange:e=>{e||N.close()},children:(0,B.jsx)(P6,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,B.jsx)(fI,{onClose:A,children:(0,B.jsx)(i0,{messageId:ee,onClose:N.close})},fe??`none`)})}):null,se&&he?(0,B.jsx)(N6,{open:!0,onOpenChange:e=>{e||ne.close()},children:(0,B.jsx)(P6,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,B.jsx)(fI,{onClose:A,children:(0,B.jsx)(z0,{chatId:e,childKey:j,onClose:ne.close,parentAgentLabel:N3(y)})},fe??`none`)})}):null,le&&he?(0,B.jsx)(N6,{open:!0,onOpenChange:e=>{e||ae.close()},children:(0,B.jsx)(P6,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,B.jsx)(fI,{onClose:A,children:(0,B.jsx)(dI,{instanceName:te.instanceName,part:te.part,onClose:ae.close})},fe??`none`)})}):null,ce&&he?(0,B.jsx)(N6,{open:!0,onOpenChange:e=>{e||ie.close()},children:(0,B.jsx)(P6,{side:`right`,className:`oc-sources-panel-sheet oc-docviewer-sheet`,children:(0,B.jsx)(fI,{onClose:A,children:(0,B.jsx)(z1,{doc:M,chatId:e,onClose:ie.close})},fe??`none`)})}):null]})})})})})})})})})})})})})})})})})})}function Dwe(){let e=Nv();return(0,B.jsxs)(`div`,{className:`oc-notfound`,role:`status`,children:[(0,B.jsx)(`div`,{className:`oc-notfound__icon`,"aria-hidden":!0,children:(0,B.jsx)(Bb,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-notfound__title`,children:De()}),(0,B.jsx)(`p`,{className:`oc-notfound__body`,children:qa()}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-notfound__cta`,onClick:()=>void e({to:`/`}),children:[(0,B.jsx)(Ib,{size:16,"aria-hidden":!0}),_ee()]})]})}function Owe(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 kwe(e,t){(0,z.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=WCe(t);e&&(i=Owe(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 Awe(){return(0,B.jsx)(`div`,{className:`oc-thread-skeleton`,role:`status`,"aria-label":wl(),children:[72,38,84,56,64].map((e,t)=>(0,B.jsx)(`div`,{className:`oc-thread-skeleton__row${t%2?` oc-thread-skeleton__row--user`:``}`,children:(0,B.jsx)(`span`,{className:`oc-thread-skeleton__bubble`,style:{width:`${e}%`}})},t))})}function jwe(e){return Ewe({chatId:e.chatId,ready:e.ready,focusMessageId:e.focusMessageId}),null}function Mwe({chatId:e,showTools:t,onToggleTools:n,focusMessageId:r,initialLoading:i}){let a=I(L.bridgeHealth.getBridgeAvailability,{chatId:e}),o=p8(),s=o?.selected??null,c=I(L.bridgeHealth.getBridgeAvailability,{chatId:e,...s?{routedAgent:{instanceName:s.instanceName,agentId:s.agentId}}:{}}),l=c&&!c.available?c:null,{beyondValidated:u,gatewayVersion:d}=b6(e,s?{instanceName:s.instanceName,agentId:s.agentId}:null),f=a?.available===!0&&a.degraded===!0,p=c?.available===!0&&c.degraded===!0,m=I(L.agents.getChatAgent,{chatId:e})?.readOnly===!0,h=uSe({hasUserTurn:o?.hasUserTurn===!0,emptyThread:o?.emptyThread===!0,unavailable:l!==null,readOnly:m,multiAgent:o?.multiAgent===!0,poolSize:(o?.pool??[]).filter(e=>e.state!==`deleted`).length}),g=!h.hidden&&!h.disabled,_=GCe({readOnly:m,unavailable:l!==null,degraded:p,beyondValidated:u}),v=I(L.messages.getSessionMeta,{chatId:e})?.title??``,y=I(L.subAgents.listSubAgents,{chatId:e}),b=hge(y??[]),x=Ei(L.subAgents.reconcileTaskEngagements),S=(y??[]).some(e=>e.kind===`task`&&e.status===`running`),C=4*6e4,w=(y??[]).reduce((e,t)=>t.kind===`task`&&t.updatedAt>e?t.updatedAt:e,0),T=(0,z.useRef)({chatId:null,seenStamp:0,armedAtLocal:0});if(T.current.chatId!==(e??null)&&(T.current={chatId:e??null,seenStamp:0,armedAtLocal:0}),w>0&&T.current.seenStamp!==w){let t=T.current.seenStamp===0,n=Date.now()-w<10*6e4;T.current={chatId:e??null,seenStamp:w,armedAtLocal:t&&!n?0:Date.now()}}let E=T.current.armedAtLocal>0&&Date.now()-T.current.armedAtLocal<C;(0,z.useEffect)(()=>{if(!S&&!E||!e)return;let t=!1,n=!1,r,i=()=>{if(t||n)return;let r=T.current.armedAtLocal+C;!S&&Date.now()>r||(n=!0,x({chatId:e}).catch(()=>{}).finally(()=>{n=!1}))};return i(),r=window.setInterval(i,3e4),()=>{t=!0,window.clearInterval(r)}},[S,E,e,x]);let D=I(L.subAgents.turnActivity,{chatId:e}),O=bCe(I(L.messages.listByChat,{chatId:e})),k=D?.deliveringSince??null,A=D?.deliveringTtlRemainingMs??null,[ee,j]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(k===null||A===null||A<=0)return;let t=window.setTimeout(()=>j({chatId:e,key:k}),A);return()=>window.clearTimeout(t)},[k,A,e]);let M=xCe(e,k,A,ee),te=D?.runningTtlRemainingMs??null,[N,P]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(P(!1),D?.running!==!0||te===null)return;let e=window.setTimeout(()=>P(!0),te);return()=>window.clearTimeout(e)},[D?.running,te,e]);let ne=D?.running===!0&&!N,re=!O&&(ne||M),ie=D?.anchorMessageId??null,[ae,oe]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!re||ie===null){oe(!1);return}let e=()=>oe(document.querySelector(`[data-message-id="${CSS.escape(ie)}"]`)!==null);e();let t=window.setInterval(e,2e3);return()=>window.clearInterval(t)},[re,ie]);let se=D?.detachedTask===!0?null:D?.workingSince??null,ce=re&&ie!==null&&ae?{messageId:ie,running:ne,workingSince:se,progressSummary:D?.progressSummary??null}:null;return kwe(e,r),(0,B.jsx)(p6.Provider,{value:f,children:(0,B.jsx)(_6.Provider,{value:ce,children:(0,B.jsx)(jue,{chatId:e,focusMessageId:r,children:(0,B.jsxs)(mF.Root,{className:`oc-thread`,children:[(0,B.jsx)(zwe,{chatId:e}),(0,B.jsx)(Lwe,{chatId:e}),i?(0,B.jsx)(Awe,{}):null,(0,B.jsx)(jwe,{chatId:e,ready:!i,focusMessageId:r}),(0,B.jsxs)(mF.Viewport,{className:`oc-thread__viewport`,style:i?{display:`none`}:void 0,children:[(0,B.jsx)(mF.Empty,{children:(0,B.jsx)(Rwe,{})}),(0,B.jsx)(mF.Messages,{components:{UserMessage:rTe,AssistantMessage:oTe,SystemMessage:sTe}}),re&&ce===null?(0,B.jsx)(g8,{running:ne,since:se,progress:D?.progressSummary??null}):null]}),(0,B.jsx)(Pue,{}),(0,B.jsx)(`div`,{className:`oc-scrolldown-anchor`,children:(0,B.jsx)(mF.If,{empty:!1,children:(0,B.jsxs)(mF.ScrollToBottom,{className:`oc-scrolldown`,children:[(0,B.jsx)(Wwe,{}),(0,B.jsx)(`span`,{children:ll()})]})})}),_===`read_only`?(0,B.jsx)(Iwe,{}):_===`unavailable`?(0,B.jsx)(Fwe,{reason:l?.reason??null,canSwitchAgent:g}):_===`degraded`?(0,B.jsx)(Pwe,{}):_===`beyond_validated`?(0,B.jsx)(Nwe,{version:d}):null,(0,B.jsx)(TCe,{}),(0,B.jsx)(gTe,{chatId:e,chatTitle:v,showTools:t,onToggleTools:n,unavailable:l!==null||m,agentGate:h,subAgentBusy:b})]})})})})}function g8({running:e,since:t=null,anchored:n=!1,progress:r=null}){let i=(0,z.useRef)(null);if(t!==null&&i.current?.key!==t){let e=Date.now();i.current={key:t,baselineMs:m6(t,e),firstLocalMs:e}}let[,a]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(t===null)return;let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[t]);let o=!n&&t!==null&&i.current!==null&&i.current.key===t?g6(h6(i.current.baselineMs,i.current.firstLocalMs,Date.now())):null;return(0,B.jsxs)(`div`,{className:`oc-turn-activity${n?` oc-turn-activity--anchored`:``}`,children:[(0,B.jsxs)(`span`,{className:`oc-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{})]}),(0,B.jsx)(`span`,{role:`status`,className:r===null?void 0:`oc-sr-only`,children:e?Up():kf()}),r===null?null:(0,B.jsx)(`span`,{className:`oc-turn-activity__progress`,title:r,children:r}),o===null?null:(0,B.jsx)(`span`,{className:`oc-turn-activity__clock`,role:`timer`,children:o})]})}function Nwe({version:e}){return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--warn`,role:`status`,children:[(0,B.jsx)(Py,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e===null?Vm():jee({version:e})})]})}function Pwe(){return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--warn`,role:`status`,children:[(0,B.jsx)(Py,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:Mc()})]})}function Fwe({reason:e,canSwitchAgent:t}){let n=e===`instance_unreachable`?t?zf():Qp():ku();return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--error`,role:`status`,children:[(0,B.jsx)(Py,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:n})]})}function Iwe(){return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--error`,role:`status`,children:[(0,B.jsx)(mb,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:Hu()})]})}function Lwe({chatId:e}){let t=I(L.messages.listByChat,{chatId:e}),[n,r]=(0,z.useState)(``),i=(0,z.useRef)(null);return(0,z.useEffect)(()=>{i.current=null,r(``)},[e]),(0,z.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===pf()?`${pf()} `:pf()))}},[t]),(0,B.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`oc-sr-only`,children:n})}function Rwe(){return(0,B.jsxs)(`div`,{className:`oc-emptystate`,children:[(0,B.jsx)(m8,{className:`oc-emptystate__avatar`}),(0,B.jsx)(`h2`,{className:`oc-emptystate__title`,children:cp()})]})}function _8({chatId:e}){let t=p8()?.selected??null,n=A6(I(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,B.jsxs)(`span`,{className:`oc-meter ${n.level}`,title:xs({detail:r}),children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${n.percentLeft}%`}})}),(0,B.jsx)(`span`,{className:`oc-meter__label`,children:Kt({pct:n.percentLeft})})]})}function v8({sm:e,detail:t=!0}){let n=G6(e),r=pwe(e),i=q6(e),a=n!=null&&i?Math.round(n/i*100):null;if(a==null||n==null)return i?(0,B.jsx)(`span`,{className:`oc-meter is-unknown`,title:_r(),role:`status`,children:(0,B.jsx)(`span`,{className:`oc-meter__label`,children:`—`})}):null;let o=a>=90?`is-critical`:a>=75?`is-warn`:`is-ok`,s=vwe(e);return(0,B.jsxs)(`span`,{className:`oc-meter ${o}`,title:`${Rs({pct:a,used:U6(n),total:U6(i)})}\n${r===`budget_estimate`?ic():Zn()}${s?`\n${Mp({gateway:s.gateway,delta:s.delta})}`:``}`,children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(a,100)}%`}})}),(0,B.jsxs)(`span`,{className:`oc-meter__label`,children:[a,`%`,t?(0,B.jsxs)(`span`,{className:`oc-meter__detail`,children:[` · `,U6(n),`/`,U6(i)]}):null]})]})}function zwe({chatId:e}){let t=I(L.messages.getSessionMeta,{chatId:e}),n=Nv(),r=I(L.projects.listProjects,{}),i=(0,z.useMemo)(()=>{let e=t?.projectId??null;return e===null||r===void 0?[]:u3(r,e)},[t?.projectId,r]),a=t?.sessionMeta??null,o=t?.sessionSettings??null,s=o8(),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=(0,z.useRef)(null),f=(0,z.useRef)(null),[p,m]=(0,z.useState)(!1),h=!H6(o,`thinkingLevel`),g=(n,r)=>(0,B.jsxs)(B.Fragment,{children:[s.showTools&&!n&&a?.model?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:a.modelProvider?fm({provider:a.modelProvider}):Af(),children:[(0,B.jsx)(Hwe,{}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:a.model})]}):null,s.showTools&&!n&&a?.thinkingLevel?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:h?$l():_(),children:[(0,B.jsx)(Uwe,{}),(0,B.jsxs)(`span`,{className:`oc-chip__label`,children:[_a(),`\xA0: `,W6(a.thinkingLevel)]}),h?(0,B.jsx)(`span`,{className:`oc-chip__hint`,children:bc()}):null]}):null,s.showTools&&a?(0,B.jsx)(v8,{sm:a,detail:!n}):null,s.showUsage&&!a?(0,B.jsx)(_8,{chatId:e}):null,(0,B.jsx)(Bwe,{chatId:e,title:t?.title??null,compact:n,ghost:r}),a?(0,B.jsx)(Vwe,{chatId:e,sm:a,settings:o,onOpenPanel:()=>l(!0),compact:n,ghost:r,showUsage:s.showUsage}):null]});return(0,z.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=f.current?.offsetWidth??0;if(t===0)return;let n=Math.min(d.current?.scrollWidth??0,360),r=e.clientWidth-n-16<t;m(e=>e===r?e:r)};t();let n=new ResizeObserver(t);return n.observe(e),f.current&&n.observe(f.current),()=>n.disconnect()},[[ge(),jn(),a?.model??``,a?.thinkingLevel??``,t?.title??``,i.map(e=>e.name).join(`/`),s.showTools?`1`:`0`].join(`|`)]),(0,B.jsxs)(`header`,{className:`oc-chathead`,ref:u,children:[(0,B.jsxs)(`div`,{className:`oc-chathead__titlebox`,ref:d,children:[i.length>0?(0,B.jsx)(`nav`,{className:`oc-chathead__crumbs`,"aria-label":Wn(),children:i.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-chathead__crumb`,children:[t>0?(0,B.jsx)(`span`,{className:`oc-chathead__crumbsep`,"aria-hidden":!0,children:`›`}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-chathead__crumblink`,onClick:()=>void n({to:`/project/$projectId`,params:{projectId:e._id}}),children:e.name})]},e._id))}):null,(0,B.jsx)(`div`,{className:`oc-chathead__title`,title:t?.title??void 0,children:t?.title||mu()})]}),(0,B.jsx)(`div`,{className:`oc-chathead__meta`,children:g(p,!1)}),(0,B.jsx)(`div`,{className:`oc-chathead-ghost`,"aria-hidden":!0,ref:f,children:g(!1,!0)}),(0,B.jsx)(xwe,{chatId:e,open:c,onOpenChange:l})]})}function y8(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 Bwe({chatId:e,title:t,compact:n=!1,ghost:r=!1}){let i=sa();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,...e.quotedRefs!==void 0&&e.quotedRefs.length>0?{quotedExcerpts:e.quotedRefs.map(e=>e.excerpt)}:{},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=_Se(t);n===`md`?y8(hSe(s,l),`${u}.md`,`text/markdown`):y8(gSe(s,l),`${u}.json`,`application/json`)}let o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Gy,{size:13,"aria-hidden":!0}),n?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-chip__label`,children:ge()}),(0,B.jsx)(Ay,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})]});return r?(0,B.jsx)(`span`,{className:`oc-chip oc-chip--btn`,children:o}):(0,B.jsxs)(vF,{children:[(0,B.jsx)(yF,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-chip oc-chip--btn`,title:ts(),children:o})}),(0,B.jsxs)(bF,{align:`end`,className:`w-44`,children:[(0,B.jsx)(SF,{children:ge()}),(0,B.jsx)(xF,{onClick:()=>void a(`md`),children:yh()}),(0,B.jsx)(xF,{onClick:()=>void a(`json`),children:Ia()})]})]})}function Vwe({chatId:e,sm:t,settings:n,onOpenPanel:r,compact:i=!1,ghost:a=!1,showUsage:o=!1}){let[s,c]=(0,z.useState)(!1),l=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Gb,{size:13,"aria-hidden":!0}),i?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-chip__label`,children:jn()}),(0,B.jsx)(Ay,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})]});return a?(0,B.jsx)(`span`,{className:`oc-chip oc-chip--btn`,children:l}):(0,B.jsxs)(hF,{open:s,onOpenChange:c,children:[(0,B.jsx)(gF,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-chip oc-chip--btn`,title:Fr(),children:l})}),(0,B.jsxs)(_F,{align:`end`,className:`oc-spanel-pop w-80 p-2`,children:[q6(t)?(0,B.jsxs)(`div`,{className:`oc-spanel-pop__usage`,children:[(0,B.jsx)(`span`,{className:`oc-spanel-pop__usage-label`,children:fn()}),(0,B.jsx)(v8,{sm:t})]}):null,o?(0,B.jsxs)(`div`,{className:`oc-spanel-pop__usage`,children:[(0,B.jsx)(`span`,{className:`oc-spanel-pop__usage-label`,children:Ff()}),(0,B.jsx)(_8,{chatId:e})]}):null,(0,B.jsx)(Z6,{chatId:e,sm:t,settings:n}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-spanel-pop__all`,onClick:()=>{c(!1),r()},children:[(0,B.jsx)(Gb,{size:13,"aria-hidden":!0}),Xf(),(0,B.jsx)(My,{size:13,"aria-hidden":!0})]})]})]})}function Hwe(){return(0,B.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,B.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),(0,B.jsx)(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),(0,B.jsx)(`path`,{d:`M9 1v3M15 1v3M9 20v3M15 20v3M20 9h3M20 14h3M1 9h3M1 14h3`})]})}function Uwe(){return(0,B.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,B.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,B.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 b8({children:e}){return(0,B.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 Wwe(){return(0,B.jsx)(b8,{children:(0,B.jsx)(`path`,{d:`M12 5v14M19 12l-7 7-7-7`})})}var Gwe=`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 oc-overlay-layer min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,x8=`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 Kwe({sourceShown:e,sourceActive:t,onToggleSource:n}){let r=U(e=>e.metadata?.custom?.messageId),i=U(e=>e.metadata?.custom?.sentAt),a=U(e=>e.metadata?.custom?.generationMs??null),o=U(e=>e.metadata?.custom?.status===`streaming`),s=Nt(L.chatFork.forkChat),c=K3(),l=qF(),[u,d]=(0,z.useState)(!1);if(!r)return null;let f=async()=>{let e=await c({title:eh(),description:hee(),label:it(),placeholder:sl(),confirmLabel:Te(),allowEmpty:!0});if(e!==null){d(!0);try{let{chatId:t}=await s({branchMessageId:r,...e.trim()?{title:e.trim()}:{}});Z3(t,{expand:!0}),l.success(Ga())}catch(e){l.error(kee(),e)}finally{d(!1)}}};return(0,B.jsxs)(HN.Root,{children:[(0,B.jsx)(HN.Trigger,{className:`oc-iconbtn`,title:Ac(),"aria-label":Ac(),disabled:u,children:(0,B.jsx)(qy,{size:15})}),(0,B.jsxs)(HN.Content,{align:`end`,sideOffset:4,className:Gwe,children:[i===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`oc-msgmenu__when px-2 py-1.5 text-sm`,children:[o0(i,{dateStyle:`medium`,timeStyle:`short`}),(()=>{let e=a===null?null:c0(a);return e===null?null:(0,B.jsxs)(`span`,{className:`oc-msgmenu__duration`,children:[(0,B.jsx)(Qb,{size:12,"aria-hidden":!0}),O({duration:e})]})})()]}),(0,B.jsx)(HN.Separator,{className:`bg-border -mx-1 my-1 h-px`})]}),e?(0,B.jsxs)(HN.Item,{className:x8,onSelect:n,children:[(0,B.jsx)(zy,{size:14,"aria-hidden":!0}),t?ci():Gr()]}):null,(0,B.jsxs)(HN.Item,{className:x8,disabled:u||o,onSelect:()=>void f(),children:[(0,B.jsx)(ab,{size:14,"aria-hidden":!0}),eh()]}),(0,B.jsx)(qwe,{})]})]})}function qwe(){let e=zF(),t=U(e=>e.id);if(!e)return null;let n=e.byMessage.get(t)?.some(e=>e.blockIndex===null)??!1;return(0,B.jsxs)(HN.Item,{className:x8,onSelect:()=>e.toggle(t,null),children:[(0,B.jsx)(Ty,{size:14,"aria-hidden":!0}),n?su():bm()]})}function Jwe(){let[e,t]=(0,z.useState)(!1),n=U(e=>e.content.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
314
|
+
`)}function lCe(e,t,n){return t-(e+(n-e)/2)}function o6(e,t,n){return e.length===0||t===void 0?null:e.slice(0,n).map(e=>({...e,clientSkew:e.clientSkew??t}))}function uCe(e,t){let n=[];for(let r of e)r.recTimingId!==void 0&&n.push({timingId:r.recTimingId,t4:t});return n}function s6(e,t,n){for(let r of t){if(n.has(r.timingId))continue;let t=e.get(r.timingId);(t===void 0||r.t4<t)&&e.set(r.timingId,r.t4)}}var dCe=1e3,c6=2e3,l6=500;function fCe(e,t){let n=I(L.messages.getStreamingText,e?{chatId:e}:`skip`),r=Nt(L.deliveryTiming.recordFrontendTiming),i=Nt(L.deliveryTiming.calibrateClock),a=(0,z.useRef)(new Map),o=(0,z.useRef)(new Set),s=(0,z.useRef)([]),c=(0,z.useRef)(void 0),l=(0,z.useRef)(!1),u=(0,z.useCallback)(()=>{if(c.current!==void 0||l.current)return;l.current=!0;let e=Date.now();i({clientSentAt:e}).then(t=>{c.current=lCe(e,t.serverNow,Date.now())}).catch(()=>{l.current=!1})},[i]);(0,z.useEffect)(()=>{n&&(s6(a.current,uCe(n,Date.now()),o.current),a.current.size>0&&u(),o.current.size>0&&!n.some(e=>e.recTimingId!==void 0)&&o.current.clear())},[n,u]),(0,z.useEffect)(()=>{let e=()=>{s6(a.current,t.current??[],o.current),t.current&&(t.current.length=0),a.current.size>0&&u();for(let[e,t]of a.current)s.current.push({timingId:e,t4:t,clientSkew:c.current}),o.current.add(e);a.current.clear(),s.current.length>c6&&s.current.splice(0,s.current.length-c6);let e=o6(s.current,c.current,l6);e!==null&&(s.current.splice(0,e.length),r({samples:e}).catch(()=>{}))},n=window.setInterval(e,dCe);return()=>{for(window.clearInterval(n),e();o6(s.current,c.current,l6)!==null;)e()}},[r,t,u])}function u6(e){let t=e instanceof Error?e.message:``;return new Set([...t.matchAll(/Invalid: quote target gone \[([^\]]+)\]/g)].map(e=>e[1]))}function d6(e){let t=e instanceof Error?e.message:``;return u6(e).size>0?!1:/Invalid:.*quote/i.test(t)}function pCe({chatId:e}){let t=sa(),n=JF(),r=Nt(L.send.sendMessage).withOptimisticUpdate((e,t)=>{let n={chatId:t.chatId},r=e.getQuery(L.messages.listByChat,n)??[],i=`optimistic-${t.clientMessageId}`;if(r.some(e=>e._id===i))return;let a=Date.now(),o={_id:i,chatId:t.chatId,_creationTime:a,orderTime:void 0,role:`user`,status:`complete`,runId:void 0,error:void 0,errorCode:void 0,attachedDocCount:void 0,finalizedAt:void 0,text:t.text,updatedAt:a,routedInstanceName:t.routedAgent?.instanceName,routedAgentId:t.routedAgent?.agentId,quotedRefs:t.quotes,hasMergedRuns:!1,hasAnnouncePrefix:!1,mergedIntoTurn:void 0,autoRetry:void 0,interruptedAt:void 0,parts:[],outbox:null,importedAgentLabel:void 0,chatImportedAgentLabel:void 0};e.setQuery(L.messages.listByChat,n,[...r,o])}),i=I(L.messages.listByChat,e?{chatId:e}:`skip`),a=I(L.messages.getStreamingText,e?{chatId:e}:`skip`),o=a&&a.length>0?a[0].messageId:null,s=I(L.messages.getChatStreamTransport,e?{chatId:e}:`skip`)===`sse`||oCe(),c=(0,z.useRef)([]),l=(0,z.useRef)(0),u=(0,z.useCallback)((e,t)=>{t<l.current||c.current.push({timingId:e,t4:Date.now()})},[]),d=a&&a.length>0?a[0].streamRowId??null:null,f=sCe(o,d,s,u);l.current=(a?.[0]?.chunkSeq??1)-1,fCe(e,c);let p=I(L.agents.getChatAgent,e?{chatId:e}:`skip`),m=I(L.messages.getSessionMeta,e?{chatId:e}:`skip`),h=I(L.agents.listMyAgents,e?{}:`skip`),g=h===void 0,_=(0,z.useMemo)(()=>h??[],[h]),v=p?.multiAgent===!0,y=m?.perTurnRouting===!0,b=v||y,x=(0,z.useMemo)(()=>p?.agent?{instanceName:p.agent.instanceName,agentId:p.agent.agentId}:null,[p?.agent?`${p.agent.instanceName}\0${p.agent.agentId}`:``]),S=(0,z.useMemo)(()=>m?.lastRoutedInstanceName&&m?.lastRoutedAgentId?{instanceName:m.lastRoutedInstanceName,agentId:m.lastRoutedAgentId}:null,[m?.lastRoutedInstanceName&&m?.lastRoutedAgentId?`${m.lastRoutedInstanceName}\0${m.lastRoutedAgentId}`:``]),[C,w]=(0,z.useState)(null);(0,z.useEffect)(()=>{w(null)},[e]);let T=i===void 0,E=(0,z.useMemo)(()=>oSe(i??[]),[i]),D=(0,z.useMemo)(()=>(i?sSe(i):null)??S,[i,S]),O=(0,z.useMemo)(()=>z3({selected:null,lastRouted:D,primary:x,pool:_,poolLoading:g,messagesLoading:T,canRoute:b}),[D,x,_,g,T,b]),k=(0,z.useMemo)(()=>z3({selected:C,lastRouted:D,primary:x,pool:_,poolLoading:g,messagesLoading:T,canRoute:b}),[C,D,x,_,g,T,b]),A=cSe(i),ee=(0,z.useMemo)(()=>(i??[]).some(e=>e.role===`user`),[i]),j=i!==void 0&&i.length===0,M=(0,z.useRef)({selected:null,primary:null,perTurnRouting:!1,isFirstTurn:!1,canRoute:!1});M.current={selected:k,primary:x,perTurnRouting:y,isFirstTurn:A,canRoute:b};let te=(0,z.useCallback)(()=>{let e=M.current;return dSe({selected:e.selected,primary:e.primary,perTurnRouting:e.perTurnRouting,isFirstTurn:e.isFirstTurn,canRoute:e.canRoute})},[]),N=(0,z.useMemo)(()=>ZSe(t,e=>n.error(e),e,()=>te()??null),[t,n,e,te]),P=(0,z.useMemo)(()=>{let e=i??[];if(!a||a.length===0)return e;let t=new Map(a.map(e=>[e.messageId,{text:e.text,chunkSeq:e.chunkSeq,phase:e.phase}]));return e.map(e=>{if(e.status!==`streaming`)return e;let n=e._id,r=t.get(n);if(typeof e.runId==`string`&&e.runId.startsWith(`announce:v1:`)){let t=r?.phase;return t===void 0?e:{...e,phase:t}}if(f!==null&&f.messageId===o&&f.generationKey===d&&n===o){let t=(r?.chunkSeq??1)-1,n=f.lastSeq>=t;return{...e,text:n?f.text:r?.text??f.text,...r?.phase===void 0?{}:{phase:r.phase}}}return r===void 0?e:{...e,text:r.text,...r.phase===void 0?{}:{phase:r.phase}}})},[i,a,f,o]),ne=(0,z.useRef)(new Set),re=e=>e.role===`user`&&(e.outbox?.status===`queued`||ne.current.has(String(e._id))),ie=P.filter(re).map(e=>({messageId:String(e._id),text:e.text,pending:String(e._id).startsWith(`optimistic-`)})),ae=(0,z.useMemo)(()=>P.filter(e=>!re(e)),[P]),oe=ae.length>0?ae[ae.length-1].role:null,se=ae.some(e=>e.status===`streaming`),[ce,le]=(0,z.useState)(null);(0,z.useEffect)(()=>{le(null)},[e]),(0,z.useEffect)(()=>{oe===`assistant`&&le(null)},[oe,P]),(0,z.useEffect)(()=>{if(ce===null)return;let e=window.setTimeout(()=>le(null),12e4);return()=>window.clearTimeout(e)},[ce]);let ue=ce!==null||se,de=ie.length>0&&!se,fe=(0,z.useMemo)(()=>fSe(i??[]),[i]),pe=(0,z.useCallback)(e=>WSe(e,E.get(e._id)??null,fe.get(e._id)??null),[E,fe]),me=(0,z.useMemo)(()=>({messages:ae,isRunning:ue,convertMessage:pe,onNew:async t=>{if(!e)throw Error(`No chat selected`);let i=t.content.filter(e=>e.type===`text`).map(e=>e.text).join(``),a=XSe(t.attachments).map(e=>({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType,...e.origin?{origin:e.origin}:{}})),o=te(),s=Gx(e);le(Date.now());try{await r({chatId:e,text:i,clientMessageId:crypto.randomUUID(),attachments:a,...o?{routedAgent:o}:{},...s.length>0?{quotes:s.map(e=>({messageId:e.messageId,blockIndex:e.blockIndex,excerpt:e.excerpt}))}:{}})}catch(t){if(!d6(t)){let r=Kx(e,s,u6(t));r.gone>0&&n.error(Nd({count:r.gone})),r.dropped>0&&n.error(Di({count:r.dropped}))}throw le(null),t}},adapters:{attachments:N}}),[P,ue,e,r,N,te]),he=(0,z.useMemo)(()=>({begin:()=>le(Date.now()),cancel:()=>le(null)}),[]),ge=Nt(L.messages.abortTurn),_e=Nt(L.send.cancelQueuedMessage),ve=(0,z.useCallback)(async e=>{try{return await _e({messageId:e}),!0}catch{return n.error(vs()),!1}},[_e,n]),ye=(0,z.useCallback)(async t=>{let i=t.trim();if(!e||i===``)return!1;let a=te(),o=Gx(e),s=crypto.randomUUID();ne.current.add(`optimistic-${s}`);try{return await r({chatId:e,text:t,clientMessageId:s,...a?{routedAgent:a}:{},...o.length>0?{quotes:o.map(e=>({messageId:e.messageId,blockIndex:e.blockIndex,excerpt:e.excerpt}))}:{}}),!0}catch(t){if(!d6(t)){let r=Kx(e,o,u6(t));r.gone>0&&n.error(Nd({count:r.gone})),r.dropped>0&&n.error(Di({count:r.dropped}))}return n.error(t?.message?.includes(`QUEUE_FULL`)?Ao():rn()),!1}},[e,r,n,te]),be=(0,z.useMemo)(()=>({pool:_,multiAgent:v,perTurnRouting:y,hasUserTurn:ee,emptyThread:j,primary:x,selected:k,setSelected:w,messageAgents:E,fallbackAgent:O}),[_,v,y,ee,j,x,k,E,O]),xe=(0,z.useCallback)(async()=>{if(e)try{if((await ge({chatId:e})).ok){le(null);return}n.error(js())}catch(e){n.error(mc(),e)}},[e,ge,n]);return{runtime:qae(me),turnGate:he,queueSend:ye,abortTurn:xe,routing:be,lastUserTurnQueued:de,queuedTurns:ie,cancelQueued:ve,initialLoading:T}}function f6(e,{key:t,value:n}){let r=e.getQuery(L.me.getMe,{host:d3});if(!r?.ui)return;let i={...r.ui.effective},a={...r.ui.userOverrides},o=t,s=t;n===null?delete a[s]:(i[o]=n,a[s]=n),e.setQuery(L.me.getMe,{host:d3},{...r,ui:{...r.ui,effective:i,userOverrides:a}})}function mCe(e,{messageId:t}){for(let{args:n,value:r}of e.getAllQueries(L.messages.listByChat)){if(r===void 0)continue;let i=r.find(e=>e._id===t);if(i===void 0)continue;let a=i._creationTime;e.setQuery(L.messages.listByChat,n,r.filter(e=>e._creationTime<a))}}function hCe(e){let t=e instanceof Error?e.message:typeof e?.data==`string`?String(e.data):String(e??``);return/compact_refused|already_active|already_in_flight|deferred_compaction_not_scheduled|below_threshold|already_compacted_recently|unsupported_harness_compaction|no transcript|no sessionId/i.test(t)}function gCe(e){let t=Ei(L.agentFiles.compactSession),n=Nt(L.chatFork.forkChat),[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(null),l=async()=>{i(`compact`),o(null);try{await t({chatId:e.chatId}),c(`compact`),o(Xr())}catch(e){o(hCe(e)?Mi():zd())}finally{i(null)}},u=async()=>{if(e.messageId!==null){i(`branch`),o(null);try{let{chatId:t}=await n({branchMessageId:e.messageId});Z3(t,{expand:!0}),c(`branch`),o(Sd())}catch{o(zd())}finally{i(null)}}};return(0,B.jsxs)(`div`,{className:`oc-error-card__actions`,children:[(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`outline`,disabled:r!==null||s!==null,onClick:()=>void l(),children:r===`compact`?ee():Xi()}),e.messageId===null?null:(0,B.jsx)(Ih,{type:`button`,size:`sm`,variant:`outline`,disabled:r!==null||s===`branch`,onClick:()=>void u(),children:r===`branch`?ee():hi()}),a===null?null:(0,B.jsx)(`p`,{className:`oc-error-card__notice`,role:`status`,children:a})]})}var p6=(0,z.createContext)(!1);function _Ce({retry:e}){let[,t]=(0,z.useState)(0);(0,z.useEffect)(()=>{let e=window.setInterval(()=>t(e=>e+1),1e3);return()=>window.clearInterval(e)},[]);let n=Math.max(0,Math.ceil((e.firesAt-Date.now())/1e3));return(0,B.jsxs)(`span`,{className:`oc-error-card__retry`,role:`status`,children:[(0,B.jsx)(zb,{size:13,className:`oc-error-card__retry-spin`,"aria-hidden":!0}),n>0?xee({attempt:String(e.attempt),max:String(e.maxAttempts),seconds:String(n)}):pl({attempt:String(e.attempt),max:String(e.maxAttempts)})]})}function vCe(){let e=M3(),t=U(e=>e.metadata?.custom?.status),n=U(e=>e.metadata?.custom?.runId),r=U(e=>e.metadata?.custom?.error),i=U(e=>e.metadata?.custom?.errorCode),a=U(e=>e.metadata?.custom?.autoRetry??null),o=U(e=>e.metadata?.custom?.chatId),s=U(e=>e.metadata?.custom?.messageId??e.id),c=U(e=>k0(e.content)),l=U(e=>e.metadata?.custom?.phase),u=U(e=>{let t=e.metadata?.custom;return t?.activeToolName??T0(t?.toolParts)?.name??null}),d=u===null?null:{name:u,family:w0(u)},f=(0,z.useContext)(p6),p=oge(t,c,l,d,U(e=>e.metadata?.custom?.interruptedAt!=null)),m=p?.kind===`thinking`,[h,g]=(0,z.useState)(!1);if((0,z.useEffect)(()=>{if(!m){g(!1);return}let e=window.setTimeout(()=>g(!0),6e3);return()=>window.clearTimeout(e)},[m]),!p)return null;if(p.kind===`error`){let{headline:e,detail:t,code:c}=O0(r,i);return(0,B.jsxs)(`div`,{className:`oc-error-card`,role:`alert`,title:n?`run ${n}`:void 0,children:[(0,B.jsx)(Py,{size:18,className:`oc-error-card__icon`,"aria-hidden":!0}),(0,B.jsxs)(`div`,{className:`oc-error-card__body`,children:[(0,B.jsx)(`span`,{className:`oc-error-card__title`,children:p.label}),e?(0,B.jsx)(`span`,{className:`oc-error-card__msg`,children:e}):null,t?(0,B.jsx)(`span`,{className:e?`oc-error-card__msg oc-error-card__msg--detail`:`oc-error-card__msg`,children:t}):null,a?(0,B.jsx)(_Ce,{retry:a}):null,c&&cge.has(c)&&o?(0,B.jsx)(gCe,{chatId:o,messageId:s??null}):null]})]})}return(0,B.jsxs)(`div`,{className:`oc-run-status oc-run-status--${p.kind}`,role:`status`,title:n?`run ${n}`:void 0,children:[p.kind===`thinking`?(0,B.jsxs)(`span`,{className:`oc-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{})]}):p.kind===`generating`?(0,B.jsx)(`span`,{className:`oc-run-status__pulse`,"aria-hidden":!0}):(0,B.jsx)(Jb,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:p.phased&&!f?`oc-run-status__label oc-shimmer-text`:`oc-run-status__label`,children:sge(p.kind,f)??(p.kind===`thinking`&&h&&!p.phased?iSe(e):p.label)})]})}function m6(e,t){return Math.max(0,t-e)}function h6(e,t,n){return e+Math.max(0,n-t)}function yCe(e,t,n){return e?!0:n!==void 0&&t===n}function g6(e){return c0(e)}var _6=(0,z.createContext)(null);function bCe(e){return e!==void 0&&e.some(e=>e.status===`streaming`)}function xCe(e,t,n,r){return t===null||n===null||n<=0?!1:!(r?.chatId===e&&r.key===t)}function SCe(){let e=U(e=>e.metadata?.custom?.status),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.sentAt),r=yCe(e===`streaming`,(0,z.useContext)(_6)?.messageId??null,t),i=(0,z.useRef)(null);if(r&&t!==void 0&&n!==void 0&&i.current?.id!==t){let e=Date.now();i.current={id:t,baselineMs:m6(n,e),firstLocalMs:e}}let[,a]=(0,z.useState)(0);if((0,z.useEffect)(()=>{if(!r)return;let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[r]),!r||i.current===null||i.current.id!==t)return null;let o=g6(h6(i.current.baselineMs,i.current.firstLocalMs,Date.now()));return o===null?null:(0,B.jsx)(`div`,{className:`oc-turn-clock`,role:`timer`,children:(0,B.jsx)(`span`,{className:`oc-turn-clock__label`,children:Om({duration:o})})})}var CCe={read:wy,exec:Zb,search:Bb,fetch:ob,write:jb,other:rx};function wCe(e){let t=U(e=>e.metadata?.custom?.status),[n,r]=(0,z.useState)(!1),{showTools:i}=o8(),a=e.args?.parts??[];if(!i||a.length===0)return null;let o=t===`streaming`&&a.some(e=>n6(e.phase)),s=CCe[FSe(a)],c=o?(0,B.jsx)(pb,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(B.Fragment,{children:[a.length>1?(0,B.jsx)(`span`,{className:`oc-flowact__count`,children:a.length}):null,(0,B.jsx)(ky,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0})]});return(0,B.jsxs)(`div`,{className:`oc-msg__meta oc-flowact`,role:`group`,"aria-label":Jn(),children:[(0,B.jsx)(cI,{icon:(0,B.jsx)(s,{size:14}),label:ISe(a,{live:o}),trailing:c,open:n,ariaExpanded:n,title:n?Lf():Xp(),onClick:()=>r(!n)}),n?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:a.map(e=>(0,B.jsx)(u0,{toolName:e.toolName,args:e.args,argsText:e.argsText,result:e.result,status:e.phase?{type:e.phase}:void 0,turnSettled:t!==void 0&&t!==`streaming`},e.toolCallId))}):null]})}function TCe(){let e=(0,z.useContext)(l8),t=dO(),n=(0,z.useRef)(null),r=e?.queuedTurns.length??0;if((0,z.useLayoutEffect)(()=>{let e=n.current,t=document.querySelector(`.oc-thread__viewport`);if(!t)return;if(!e||r===0){t.style.removeProperty(`--oc-dock-pad`);return}let i=()=>t.style.setProperty(`--oc-dock-pad`,`${e.offsetHeight}px`);i();let a=new ResizeObserver(i);return a.observe(e),()=>{a.disconnect(),t.style.removeProperty(`--oc-dock-pad`)}},[r]),e===null||r===0)return null;let{queuedTurns:i,cancelQueued:a}=e;return(0,B.jsx)(`div`,{ref:n,className:`oc-queue-dock`,role:`status`,"aria-label":kp(),children:i.map(e=>(0,B.jsxs)(`div`,{className:`oc-queue-card`,children:[(0,B.jsx)(Hy,{size:16,"aria-hidden":!0,className:`oc-queue-card__icon`}),(0,B.jsx)(`span`,{className:`oc-queue-card__text`,title:e.text,children:e.text}),(0,B.jsx)(`button`,{type:`button`,className:`oc-queue-card__btn`,title:mr(),"aria-label":mr(),disabled:e.pending,onClick:()=>{a(e.messageId).then(n=>{n&&t.composer.setText(e.text)})},children:(0,B.jsx)(jb,{size:15})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-queue-card__btn oc-queue-card__btn--danger`,title:Ut(),"aria-label":Ut(),disabled:e.pending,onClick:()=>void a(e.messageId),children:(0,B.jsx)($b,{size:15})})]},e.messageId))})}var v6=(0,z.createContext)(!1);function ECe(){let e=U(e=>e.metadata?.custom?.toolParts),t=U(e=>e.metadata?.custom?.status),[n,r]=(0,z.useState)(!1);if(!e||e.length===0)return null;let i=n,a=Ghe(e,t),o=a.running?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(pb,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}),el()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ky,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sr-only`,children:ud()})]});return(0,B.jsxs)(`div`,{className:`oc-toolact`,children:[(0,B.jsx)(cI,{icon:(0,B.jsx)(rx,{size:14}),label:a.label,trailing:o,open:i,ariaExpanded:i,title:i?Lf():Xp(),onClick:()=>r(!i)}),i?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:e.map(e=>(0,B.jsx)(u0,{toolName:e.toolName,args:e.args,argsText:e.argsText,result:e.result,status:e.phase?{type:e.phase}:void 0,turnSettled:t!==void 0&&t!==`streaming`},e.toolCallId))}):null]})}var DCe=new Set([`knobThinkingLevel`,`knobModel`,`knobFastMode`,`knobUnset`,`agentFiles`,`sessionCompact`,`configDefaults`,`subagents`,`inboundAttachments`,`talk`,`cronList`,`cronManage`]),OCe=new Set([`knobThinkingLevel`,`knobModel`]);function y6(e,t){return DCe.has(t)?e==null?OCe.has(t):e[t]===!0:!1}function kCe(e,t){return{model:e(`knobModel`)&&t.hasModels,thinking:e(`knobThinkingLevel`)&&t.hasLevels,speed:e(`knobFastMode`),reset:e(`knobUnset`)}}function ACe(e,t){return e===void 0?`loading`:e===null?{blocked:!y6(null,t),gatewayVersion:null,provider:null}:{blocked:!y6(e.capabilities,t),gatewayVersion:e.gatewayVersion,provider:e.provider}}function b6(e,t){let n=I(L.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,z.useCallback)(e=>y6(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,beyondValidated:n?.versionBeyondValidated===!0}}var jCe=18e4;function x6(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S6(e){let t=[];for(let n of e){if(n.toolName!==`sessions_spawn`)continue;let e=n.result;if(!x6(e))continue;let r=e.contentItems;if(Array.isArray(r))for(let e of r){let n=x6(e)?e.text:void 0;if(typeof n==`string`)try{let e=JSON.parse(n),r=x6(e)?e.childSessionKey:void 0;typeof r==`string`&&r!==``&&t.push(r)}catch{}}}return t}var MCe=new Set([`sessions_spawn`,`delegate_task`,`mixture_of_agents`]);function NCe(e){return e.some(e=>MCe.has(e.toolName))}function PCe(e){return e.some(e=>{let t=e.result;if(typeof t!=`object`||!t)return!1;let n=t.details;if(typeof n!=`object`||!n)return!1;let r=n;return r.async===!0&&typeof r.taskId==`string`})}function C6(e){return e?.trim()||void 0}function w6(e,t,n,r,i=Date.now()){if(e.hasText||e.hasMedia||e.status!==`complete`)return{kind:`none`};let a=new Set(S6(t)),o=n.filter(e=>r!==void 0&&e.parentMessageId===r||a.has(e.childSessionKey)),s=o.find(e=>e.status===`running`);if(s)return{kind:`waiting`,taskName:C6(s.taskName)};let c=o.filter(e=>e.kind!==`task`),l=c.find(e=>e.status===`error`||e.status===`aborted`);if(l)return{kind:`failed`,taskName:C6(l.taskName),reason:I0(l.errorMessage,l.errorCode)};let u=c.find(e=>e.status===`done`);if(u){let e=u.updatedAt+jCe;return i<e?{kind:`composing`,taskName:C6(u.taskName),recheckAt:e}:{kind:`done`,taskName:C6(u.taskName),resultText:u.resultText}}return{kind:`generic`}}function T6(e,t){return e===`done`?lu({count:t}):e===`running`?x({count:t}):xa({count:t})}function FCe({card:e}){let t=e.tone===`running`?pb:e.tone===`failed`?Py:ky,n=(0,z.useContext)(L0),r=e.tools?.length??0,i=n?.activeChildKey===e.childSessionKey,a=(0,B.jsxs)(B.Fragment,{children:[r>0?(0,B.jsx)(`span`,{className:`oc-actrow__toolcount`,children:r===1?Vp({count:r}):Df({count:r})}):null,(0,B.jsx)(t,{size:13,className:`oc-actrow__status-icon${e.tone===`running`?` oc-actrow__spin`:``}`,"aria-hidden":!0})]});return(0,B.jsxs)(`div`,{className:`oc-subagent oc-subagent--${e.tone}${e.moaRole===`moa_reference`?` oc-subagent--nested`:``}`,children:[(0,B.jsx)(cI,{tone:e.tone,icon:e.isTask?(0,B.jsx)(ix,{size:15}):(0,B.jsx)(Ey,{size:15}),label:e.isTask?e.label:A0(e),sublabel:e.isTask?void 0:e.taskName,trailing:a,active:i,ariaExpanded:e.isTask?void 0:i,ariaHasPopup:!e.isTask,title:e.isTask?void 0:Tf(),ariaLabel:e.isTask?void 0:Tf(),inert:e.isTask,onClick:()=>{e.isTask||n?.openFor(e.childSessionKey)}}),e.failure?(0,B.jsx)(`p`,{className:`oc-subagent__error`,role:`status`,children:I0(e.errorMessage,e.errorCode)}):null]})}var ICe=[];function LCe(){let e=U(e=>e.metadata?.custom?.chatId),t=U(e=>{let t=e.metadata?.custom;return t?.allToolParts??t?.toolParts??ICe}),n=(0,z.useMemo)(()=>S6(t),[t]),r=(0,z.useMemo)(()=>NCe(t)||PCe(t),[t]),i=U(e=>e.metadata?.custom?.messageId),a=r&&e?e:null,{can:o}=b6(a),s=I(L.subAgents.listSubAgents,a?{chatId:a}:`skip`),[c,l]=(0,z.useState)(!1);if(!r||!o(`subagents`))return null;let u=j0(M0(s??[],n,i)),d=[...u.cards];if(d.length===0)return null;let f=xge(u);return(0,B.jsxs)(`div`,{className:`oc-msg-subagents`,children:[f.length>0?(0,B.jsx)(cI,{icon:(0,B.jsx)(Ey,{size:15}),label:Sge(u.total),trailing:f.map(e=>(0,B.jsxs)(`span`,{className:`oc-subagent-badge oc-subagent-badge--${e.tone}`,title:T6(e.tone,e.count),"aria-label":T6(e.tone,e.count),children:[e.tone===`done`?(0,B.jsx)(ky,{size:12,"aria-hidden":!0}):e.tone===`running`?(0,B.jsx)(pb,{size:12,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(Py,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subagent-badge__count`,children:e.count})]},e.tone)),open:c,ariaExpanded:c,title:c?Lf():Xp(),onClick:()=>l(!c)}):null,(f.length===0||c)&&d.map(e=>(0,B.jsx)(`div`,{className:`oc-msg-subagents__anchor`,"data-subagent-id":e.id,"data-subagent-failed":e.failure?``:void 0,children:(0,B.jsx)(FCe,{card:e})},e.id))]})}function E6({delayDuration:e=0,...t}){return(0,B.jsx)(lce,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function D6({...e}){return(0,B.jsx)(uce,{"data-slot":`tooltip`,...e})}function O6({...e}){return(0,B.jsx)(dce,{"data-slot":`tooltip-trigger`,...e})}function k6({className:e,sideOffset:t=0,children:n,...r}){return(0,B.jsx)(fce,{children:(0,B.jsxs)(pce,{"data-slot":`tooltip-content`,sideOffset:t,className:Bp(`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,B.jsx)(mce,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function RCe(){return U(e=>e.metadata?.custom?.compaction??null)}function zCe(e){switch(e){case`overflow`:return Yt();case`manual`:return Vo();case`heap_threshold`:case`rss_threshold`:case`pre_compaction`:case`non_manual_trigger`:return ws();case`already_active`:case`already_in_flight`:case`deferred_compaction_not_scheduled`:case`unsupported_harness_compaction`:return hn();default:return``}}function BCe(){let e=RCe();if(!e)return null;let t=e.phase===`failed`,n=`${t?br():e.phase===`midturn`?er():sc()}${zCe(e.reason)}`;return(0,B.jsx)(E6,{delayDuration:150,children:(0,B.jsxs)(D6,{children:[(0,B.jsx)(O6,{asChild:!0,children:(0,B.jsxs)(`div`,{className:`oc-compaction${t?` oc-compaction--failed`:``}`,role:`note`,"aria-label":n,children:[(0,B.jsx)(`span`,{className:`oc-compaction__rule`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`oc-compaction__label`,children:[(0,B.jsx)($y,{size:12,"aria-hidden":!0}),t?Fp():Hs()]}),(0,B.jsx)(`span`,{className:`oc-compaction__rule`,"aria-hidden":!0})]})}),(0,B.jsx)(k6,{className:`oc-compaction__tip`,children:n})]})})}function VCe(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)}${Ro()} ${r%24}h`}function A6(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:VCe(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 HCe=/^(?:[a-z0-9][a-z0-9_.]{0,15}-)?[a-z0-9]{25,40}$/;function UCe(e){let t=e.trim();return HCe.test(t)?t:null}var j6=null;function M6(e,t){j6={messageId:e,terms:t}}function WCe(e){if(j6===null||j6.messageId!==e)return null;let t=j6.terms;return j6=null,t}function GCe(e){return e.readOnly?`read_only`:e.unavailable?`unavailable`:e.degraded?`degraded`:e.beyondValidated?`beyond_validated`:null}function KCe(e){return e.turnRunning?{mode:`queue`,reason:`turn`}:e.hasRunningSubAgent?{mode:`queue`,reason:`subagent`}:{mode:`send`,reason:null}}function N6({...e}){return(0,B.jsx)(Th,{"data-slot":`sheet`,...e})}function qCe({...e}){return(0,B.jsx)(Sh,{"data-slot":`sheet-portal`,...e})}function JCe({className:e,...t}){return(0,B.jsx)(Ch,{"data-slot":`sheet-overlay`,className:Bp(`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 P6({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,B.jsxs)(qCe,{children:[(0,B.jsx)(JCe,{}),(0,B.jsxs)(wh,{"data-slot":`sheet-content`,"data-side":n,className:Bp(`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,B.jsx)(Oh,{"data-slot":`sheet-close`,asChild:!0,children:(0,B.jsxs)(Ih,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,B.jsx)(xh,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:Fc()})]})})]})]})}function F6({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`sheet-header`,className:Bp(`flex flex-col gap-0.5 p-4`,e),...t})}function I6({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`sheet-footer`,className:Bp(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function L6({className:e,...t}){return(0,B.jsx)(Dh,{"data-slot":`sheet-title`,className:Bp(`font-heading text-base font-medium text-foreground`,e),...t})}function R6({className:e,...t}){return(0,B.jsx)(Eh,{"data-slot":`sheet-description`,className:Bp(`text-sm text-muted-foreground`,e),...t})}function YCe({mimeType:e,data:t,filename:n,storageId:r}){let i=e??``,a=t??``,o=n??`attachment`;return a?i.startsWith(`audio/`)?(0,B.jsxs)(`div`,{className:`oc-media oc-media--audio`,children:[(0,B.jsx)(`audio`,{controls:!0,preload:`metadata`,src:a,className:`oc-media__audio`,children:(0,B.jsx)(`a`,{href:a,download:o,children:Hl()})}),(0,B.jsx)(`span`,{className:`oc-media__name`,children:o})]}):i.startsWith(`image/`)?(0,B.jsx)(ZCe,{url:a,name:o}):i.startsWith(`video/`)?(0,B.jsxs)(`div`,{className:`oc-media oc-media--video`,children:[(0,B.jsx)(`video`,{controls:!0,preload:`metadata`,src:a,className:`oc-media__video`}),(0,B.jsx)(`span`,{className:`oc-media__name`,children:o})]}):(0,B.jsx)(XCe,{url:a,name:o,mime:i,storageId:r}):null}function XCe({url:e,name:t,mime:n,storageId:r}){let i=R1(),a=E1(n,t)!==`none`,o=!!r&&w1(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,B.jsxs)(`span`,{className:`oc-media oc-media--file oc-filechip`,title:t,children:[(0,B.jsxs)(`a`,{className:`oc-filechip__main`,href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:c,"aria-label":zm({name:t}),children:[(0,B.jsx)(`span`,{className:`oc-media__icon`,"aria-hidden":!0,children:`📄`}),(0,B.jsx)(`span`,{className:`oc-media__name`,children:t})]}),(0,B.jsx)(`a`,{className:`oc-filechip__btn`,href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:c,title:zm({name:t}),"aria-label":zm({name:t}),children:(0,B.jsx)(Gy,{size:14,"aria-hidden":!0})}),s?(0,B.jsx)(`button`,{type:`button`,className:`oc-filechip__btn`,onClick:()=>i.openFor({url:e,filename:t,mimeType:n||null,storageId:r,sourceStorageId:o?r:void 0}),title:km({name:t}),"aria-label":km({name:t}),children:(0,B.jsx)(by,{size:14,"aria-hidden":!0})}):null]})}function ZCe({url:e,name:t}){let{open:n}=Dhe();return(0,B.jsx)(`button`,{type:`button`,className:`oc-media oc-media--thumb`,onClick:()=>n({url:e,name:t}),title:t,"aria-label":t,children:(0,B.jsx)(`img`,{src:e,alt:t,className:`oc-media__thumbimg`,loading:`lazy`,decoding:`async`})})}var z6=1e3;function QCe(){return[{id:`incorrect`,label:Kc()},{id:`incoherence`,label:rd()},{id:`altered_words`,label:Hp()},{id:`formatting`,label:Of()},{id:`latency`,label:um()},{id:`api_error`,label:Ql()},{id:`other`,label:f()}]}function $Ce(){return[{id:`altered_words`,label:fa()},{id:`formatting`,label:hc()},{id:`other`,label:f()}]}function ewe(e){return e===`user`?$Ce():QCe()}var twe=[{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 nwe(){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 twe)try{document.querySelector(n)&&t.push(e)}catch{}return{plugins:e,extensionsDetected:t}}var B6=z.createContext(null);function rwe(){let e=z.useContext(B6);if(!e)throw Error(`useFeedback must be used within <FeedbackProvider>`);return e}function iwe({children:e}){let t=Nt(L.feedback.submitFeedback),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(null),[m,h]=(0,z.useState)(!1),g=z.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`,...nwe()}});d(e.displayedMatchesStored),p(String(e.reference??e.feedbackId))}catch{l(!1)}}}let y=u!==null,b=n?.role===`user`;return(0,B.jsxs)(B6.Provider,{value:g,children:[e,(0,B.jsx)(d0,{open:n!==null,onOpenChange:_,children:n?(0,B.jsxs)(f0,{className:`sm:max-w-md`,children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:Ms()}),(0,B.jsx)(g0,{children:y?Zs():b?Un():wp()})]}),y?(0,B.jsxs)(`div`,{className:`oc-feedback__result`,role:`status`,children:[n.sourceWasOpen?u===!0?(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-ok`,children:lr()}):(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-warn`,children:Rt()}):(0,B.jsx)(`p`,{className:`oc-feedback__fidelity`,children:ps()}),f?(0,B.jsxs)(`div`,{className:`oc-feedback__ref`,children:[(0,B.jsx)(`span`,{className:`oc-feedback__ref-label`,children:kt()}),(0,B.jsx)(`code`,{className:`oc-feedback__ref-id`,title:f,children:f}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:na(),"aria-label":na(),onClick:()=>{navigator.clipboard.writeText(f).then(()=>{h(!0),window.setTimeout(()=>h(!1),1500)})},children:m?(0,B.jsx)(ky,{size:14}):(0,B.jsx)(Vy,{size:14})})]}):null]}):(0,B.jsxs)(`div`,{className:`oc-feedback__form`,children:[(0,B.jsx)(`label`,{className:`oc-feedback__label`,children:jo()}),(0,B.jsxs)(_0,{value:i,onValueChange:a,children:[(0,B.jsx)(y0,{children:(0,B.jsx)(v0,{placeholder:an()})}),(0,B.jsx)(b0,{children:ewe(n.role).map(e=>(0,B.jsx)(x0,{value:e.id,children:e.label},e.id))})]}),(0,B.jsx)(`label`,{className:`oc-feedback__label`,htmlFor:`oc-feedback-comment`,children:Jo()}),(0,B.jsx)(`textarea`,{id:`oc-feedback-comment`,className:`oc-feedback__textarea`,placeholder:le(),value:o,maxLength:z6,onChange:e=>s(e.target.value.slice(0,z6)),rows:4}),(0,B.jsxs)(`div`,{className:`oc-feedback__count`,children:[o.length,`/`,z6]})]}),(0,B.jsx)(m0,{children:y?(0,B.jsx)(Ih,{onClick:()=>_(!1),children:Uee()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ih,{variant:`outline`,onClick:()=>_(!1),children:ka()}),(0,B.jsx)(Ih,{onClick:()=>void v(),disabled:!i||c,children:c?Or():wn()})]})})]}):null})]})}function awe(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 V6(){let e=rwe(),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.chatId),r=U(e=>e.role),i=U(e=>e.metadata?.custom?.rawText??``),a=I(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,...awe(a.currentTarget,i)})}return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn${o?` is-on`:``}`,title:o?vt():Ki(),"aria-label":di(),onClick:s,children:(0,B.jsx)(Qy,{size:15,"aria-hidden":!0})})}var owe={thinkingLevel:`segmented`,model:`list`,fastMode:`segmented`};function swe(e,t){return owe[e]===`segmented`&&t<=5?`segmented`:`list`}function H6(e,t){return e!=null&&e[t]!==void 0}var cwe=[`inherit`,`fast`,`standard`];function lwe(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function uwe(e){return e===`inherit`?tf():e===`fast`?kl():aee()}function dwe(e){return e===`inherit`?null:e===`fast`}function U6(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function W6(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var fwe={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function pwe(e,t){return fwe[e]??t}function G6(e){return K6(e).used}function K6(e){if(!e)return{used:null,source:`unknown`};let t=e.contextTokens,n=e=>e==null||t&&e>t?null:e;if(e.estimatedPromptTokens!=null)return{used:e.estimatedPromptTokens,source:`budget_estimate`};let r=n(e.activeTokens);if(r!=null)return{used:r,source:`last_call_usage`};if(e.totalTokensFresh===!1)return{used:null,source:`unknown`};let i=n(e.totalTokens);return i==null?{used:null,source:`unknown`}:{used:i,source:`last_call_usage`}}function q6(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function mwe(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=G6(e),n=q6(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function hwe(e){return K6(e).source}function J6(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function gwe(e,t){let n=J6(e,t);return n===null?null:qn({pct:n,used:U6(e),total:U6(t)})}function _we(e){return pr({level:e??`full`})}function vwe(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?Po({cost:e.toFixed(2),tokens:U6(t)}):n?cn({cost:e.toFixed(2)}):r?Zo({tokens:U6(t)}):null}function ywe(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function bwe(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=G6(e),i=q6(e);if(r===null||i===null)return null;let a=J6(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}function xwe(e){let t=Nt(L.chats.setSessionKnob),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null);return{apply:(0,z.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 Y6({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0}){return(0,B.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,B.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,B.jsx)(pb,{size:13,className:`oc-spanel__spin`,"aria-label":gf()}):t?c?(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:Gu(),"aria-label":Gu(),onClick:n,children:(0,B.jsx)(Rb,{size:12,"aria-hidden":!0})}):null:(0,B.jsx)(`span`,{className:`oc-spanel__badge`,children:Mu()})]}),(0,B.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,B.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,B.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[dp(),(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:vu()})]}):null]})}function Swe({options:e,value:t,onChange:n,ariaLabel:r,disabled:i}){return(0,B.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,"aria-label":r,children:e.map(e=>(0,B.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:i,onClick:()=>{e.id!==t&&n(e.id)},children:e.label},e.id))})}function Cwe({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,B.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,B.jsx)(`option`,{value:``,disabled:!0,children:`—`}):null,a?null:(0,B.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function X6({field:e,options:t,value:n,onChange:r,disabled:i,ariaLabel:a}){return swe(e,t.length)===`list`?(0,B.jsx)(Cwe,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a}):(0,B.jsx)(Swe,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a})}function Z6({chatId:e,sm:t,settings:n}){let{apply:r,pending:i,error:a}=xwe(e),{can:o}=b6(e),s=i!==null,c=(0,z.useCallback)(()=>{a&&r(a.field,a.value)},[r,a]),l=t.thinkingLevels??[],u=t.availableModels??[],d=lwe(n),f=kCe(o,{hasModels:u.length>0,hasLevels:l.length>0});return(0,B.jsxs)(B.Fragment,{children:[f.model?(0,B.jsx)(Y6,{label:Af(),overridden:H6(n,`model`),onReset:()=>void r(`model`,null),pending:i===`model`,error:a?.field===`model`,onRetry:c,resettable:f.reset,children:(0,B.jsx)(X6,{field:`model`,options:u,value:t.model??null,onChange:e=>void r(`model`,e),disabled:s,ariaLabel:Af()})}):null,f.thinking?(0,B.jsx)(Y6,{label:Ul(),overridden:H6(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:i===`thinkingLevel`,error:a?.field===`thinkingLevel`,onRetry:c,resettable:f.reset,children:(0,B.jsx)(X6,{field:`thinkingLevel`,ariaLabel:Ul(),options:l.map(e=>({id:e.id,label:pwe(e.id,W6(e.label)),title:W6(e.label)})),value:t.thinkingLevel??null,onChange:e=>void r(`thinkingLevel`,e),disabled:s})}):null,f.speed?(0,B.jsx)(Y6,{label:Am(),overridden:H6(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:i===`fastMode`,error:a?.field===`fastMode`,onRetry:c,resettable:f.reset,children:(0,B.jsx)(X6,{field:`fastMode`,ariaLabel:Am(),options:cwe.map(e=>({id:e,label:uwe(e)})),value:d,onChange:e=>void r(`fastMode`,dwe(e)),disabled:s})}):null]})}function Q6(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function $6({label:e,state:t,destructive:n,disabled:r,disabledHint:i,onClick:a,onRetry:o}){return(0,B.jsxs)(`div`,{className:`oc-spanel__action`,children:[(0,B.jsxs)(Ih,{variant:n?`destructive`:`outline`,size:`sm`,disabled:t===`pending`||r===!0,onClick:a,children:[t===`pending`?(0,B.jsx)(pb,{className:`oc-spanel__spin`,"aria-hidden":!0}):null,e]}),t===`done`?(0,B.jsx)(`p`,{className:`oc-spanel__action-note`,role:`status`,children:xd()}):null,t===`error`?(0,B.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[A(),(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:o,children:vu()})]}):null,r===!0&&i?(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:i}):null]})}function wwe({chatId:e,open:t,onOpenChange:n}){let r=I(L.messages.getSessionMeta,t?{chatId:e}:`skip`),i=I(L.chatSummaries.getChatSummary,t?{chatId:e}:`skip`),a=I(L.agents.getChatAgent,t?{chatId:e}:`skip`),o=(I(L.messages.getStreamingText,t?{chatId:e}:`skip`)?.length??0)>0,s=r?.sessionMeta??null,c=r?.sessionSettings??null,{can:l}=b6(t?e:null),u=G3(),d=Ei(L.agentFiles.compactSession),f=Nt(L.chats.resetSession),m=Nt(L.chatSummaries.requestSummarize),[h,g]=(0,z.useState)(`idle`),[_,v]=(0,z.useState)(`idle`),[b,x]=(0,z.useState)(`idle`),[S,C]=(0,z.useState)(null),[w,T]=(0,z.useState)(null),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)(!1),[A,ee]=(0,z.useState)(null),[j,M]=(0,z.useState)(`idle`),te=Nt(L.chatSummaries.updateSummary);(0,z.useEffect)(()=>{ee(null),M(`idle`),k(!1),D(!1),C(null),x(`idle`),T(null),v(`idle`)},[e]);async function N(){if(i?.summary)try{await navigator.clipboard.writeText(i.summary),D(!0),window.setTimeout(()=>D(!1),2e3)}catch{}}async function ne(){if(!(A===null||A.trim().length===0)){M(`saving`);try{await te({chatId:e,summary:A}),ee(null),M(`idle`)}catch{M(`error`)}}}let[re,ie]=(0,z.useState)(()=>Date.now()),ae=i?.jobInFlight===!0;(0,z.useEffect)(()=>{if(!ae)return;let e=window.setInterval(()=>ie(Date.now()),1e3);return()=>window.clearInterval(e)},[ae]);async function oe(){g(`pending`);try{await d({chatId:e}),g(`done`)}catch{g(`error`)}}async function se(){x(`pending`),C(null);try{let{outcome:t}=await m({chatId:e});C(({dispatched:Wd,in_flight:Ri,nothing_to_do:Xe,scanning:Fm,bridge_outdated:Sm,engine_off:lt,no_agent:So,backoff:Xe}[t]??Xe)()),x(t===`dispatched`||t===`scanning`?`done`:`idle`)}catch{x(`error`)}}async function ce(){v(`pending`),T(null);try{let t=await f({chatId:e});if(t!==void 0&&t.ok===!1){v(`idle`),T(Yr());return}v(`done`)}catch{v(`error`)}}async function le(){await u({title:Gee(),description:Ma(),confirmLabel:jr(),cancelLabel:Qr()})&&await oe()}async function ue(){await u({title:xt(),description:Yi(),confirmLabel:mi(),cancelLabel:Qr(),destructive:!0})&&await ce()}let de=G6(s),pe=q6(s),me=J6(de??void 0,pe??void 0),he=me==null?``:me>=90?`is-critical`:me>=75?`is-warn`:`is-ok`,ge=gwe(de??void 0,pe??void 0),_e=mwe(s),ve=vwe(s?.estimatedCostUsd,s?.totalTokens),ye=a?.agent??null,be=ywe([ye?ye.displayName??ye.agentId:null,s?.agentRuntime,s?.model]);return(0,B.jsx)(N6,{open:t,onOpenChange:n,children:(0,B.jsxs)(P6,{side:`right`,className:`oc-spanel`,children:[(0,B.jsxs)(F6,{children:[(0,B.jsx)(L6,{children:Zc()}),(0,B.jsx)(R6,{children:sd()})]}),(0,B.jsx)(`div`,{className:`oc-spanel__body`,children:r===void 0?(0,B.jsx)(`p`,{className:`oc-spanel__loading`,children:et()}):(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:qp()}),(0,B.jsx)(Z6,{chatId:e,sm:s,settings:c})]}):null,(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:Nf()}),ge!==null&&me!==null?(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:gc()}),(0,B.jsxs)(`span`,{className:`oc-meter oc-spanel__meter ${he}`,children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(me,100)}%`}})}),(0,B.jsx)(`span`,{className:`oc-meter__label`,children:ge})]})]}):null,_e===null?null:(0,B.jsx)(`p`,{className:`oc-spanel__help oc-spanel__help--warn`,children:_e===`compaction_failed`?ec():Ps()}),(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:Op()}),(0,B.jsx)(`span`,{className:`oc-spanel__value`,children:_we(s?.verboseLevel)}),(0,B.jsx)(`p`,{className:`oc-spanel__help`,children:Ht()})]}),ve===null?null:(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:_s()}),(0,B.jsx)(`span`,{className:`oc-spanel__value`,children:ve})]})]}),be!==null||s?(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:p()}),(0,B.jsxs)(`dl`,{className:`oc-spanel__kv`,children:[ye?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:Mn()}),(0,B.jsxs)(`dd`,{children:[ye.emoji?`${ye.emoji} `:``,ye.displayName??ye.agentId]})]}):null,ye?.instanceName?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:hm()}),(0,B.jsx)(`dd`,{children:ye.instanceName})]}):null,s?.model?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:wm()}),(0,B.jsx)(`dd`,{children:s.model})]}):null,s?.modelProvider?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:du()}),(0,B.jsx)(`dd`,{children:s.modelProvider})]}):null,s?.agentRuntime?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:La()}),(0,B.jsx)(`dd`,{children:s.agentRuntime})]}):null,s?.thinkingLevel?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:y()}),(0,B.jsx)(`dd`,{children:s.thinkingLevel})]}):null,s?.thinkingDefault?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:nu()}),(0,B.jsx)(`dd`,{children:s.thinkingDefault})]}):null]})]}):null,(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:ra()}),i?(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:Ie()}),(0,B.jsxs)(`span`,{className:`oc-meter oc-spanel__meter is-ok`,children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(i.pendingChars/Math.max(i.thresholdChars,1)*100,100)}%`}})}),(0,B.jsx)(`span`,{className:`oc-meter__label`,children:io({pending:`${Q6(i.pendingChars)}${i.pendingApprox?`+`:``}`,threshold:Q6(i.thresholdChars)})})]})]}):null,i&&!i.jobInFlight&&i.pendingChars>=i.thresholdChars?(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:Eee()}):null,i?.jobInFlight?(0,B.jsxs)(`p`,{className:`oc-spanel__hint oc-spanel__job`,role:`status`,children:[(0,B.jsx)(pb,{size:13,className:`oc-spanel__job-spin`,"aria-hidden":!0}),i.jobStreaming?Pl():sf(),i.jobStartedAt?` · ${Math.max(0,Math.round((re-i.jobStartedAt)/1e3))} s`:``]}):null,i&&i.summary.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{className:`oc-spanel__hint`,children:[Si({count:String(i.coveredCount),date:o0(i.updatedAt,{dateStyle:`short`,timeStyle:`short`})}),i.lastAgentId?` ${dee({agent:i.lastInstanceName?`${i.lastAgentId} (${i.lastInstanceName})`:i.lastAgentId})}`:``]}),i.failureCount>0?(0,B.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:ri({count:String(i.failureCount)})}):null,(0,B.jsxs)(`div`,{className:`oc-spanel__summary-tools`,children:[(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>void N(),title:am(),"aria-label":am(),children:E?(0,B.jsx)(ky,{size:14,"aria-hidden":!0}):(0,B.jsx)(Vy,{size:14,"aria-hidden":!0})}),(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>k(!0),title:np(),"aria-label":np(),children:(0,B.jsx)(gb,{size:14,"aria-hidden":!0})}),i.jobInFlight?null:(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>{ee(i.summary),k(!0)},title:rl(),"aria-label":rl(),children:(0,B.jsx)(jb,{size:14,"aria-hidden":!0})})]}),(0,B.jsx)(`div`,{className:`oc-spanel__summary`,children:i.summary})]}):i&&i.failureCount>0?(0,B.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:ri({count:String(i.failureCount)})}):i?.jobInFlight?null:(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:Od()})]})]})}),(0,B.jsx)(d0,{open:O,onOpenChange:e=>{k(e),e||(ee(null),M(`idle`))},children:(0,B.jsxs)(f0,{className:`oc-summary-dialog`,children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:ra()}),(0,B.jsx)(g0,{children:A===null?i&&i.summary.length>0?Si({count:String(i.coveredCount),date:o0(i.updatedAt,{dateStyle:`short`,timeStyle:`short`})}):``:Vf()})]}),A===null?(0,B.jsx)(`div`,{className:`oc-summary-dialog__body`,children:i?.summary??``}):(0,B.jsx)(`textarea`,{className:`oc-summary-dialog__body oc-summary-dialog__edit`,value:A,onChange:e=>ee(e.target.value)}),j===`error`?(0,B.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:em()}):null,(0,B.jsx)(`div`,{className:`oc-summary-dialog__actions`,children:A===null?(0,B.jsxs)(B.Fragment,{children:[i&&i.summary.length>0&&!i.jobInFlight?(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,onClick:()=>ee(i.summary),children:[(0,B.jsx)(jb,{size:14,"aria-hidden":!0}),rl()]}):null,(0,B.jsxs)(Ih,{variant:`outline`,size:`sm`,onClick:()=>void N(),children:[E?(0,B.jsx)(ky,{size:14,"aria-hidden":!0}):(0,B.jsx)(Vy,{size:14,"aria-hidden":!0}),am()]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ih,{variant:`ghost`,size:`sm`,onClick:()=>{ee(null),M(`idle`)},children:Qr()}),(0,B.jsx)(Ih,{size:`sm`,disabled:A.trim().length===0||j===`saving`,onClick:()=>void ne(),children:j===`saving`?gf():pd()})]})})]})}),(0,B.jsxs)(I6,{className:`oc-spanel__actions`,children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:pa()}),l(`sessionCompact`)?(0,B.jsx)($6,{label:fe(),state:h,onClick:()=>void le(),onRetry:()=>void oe()}):null,(0,B.jsx)($6,{label:P(),state:ae?`pending`:b,onClick:()=>void se(),onRetry:()=>void se()}),S===null?null:(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:S}),(0,B.jsx)($6,{label:Dn(),state:_,destructive:!0,disabled:o,disabledHint:Yr(),onClick:()=>void ue(),onRetry:()=>void ce()}),!o&&w!==null?(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:w}):null]})]})})}function Twe(e){let t=null;for(let n of e)(t===null||n.createdAt>=t.createdAt)&&(t=n);return t===null?{kind:`bottom`}:{kind:`bookmark`,messageId:t.messageId,blockIndex:t.blockIndex}}var Ewe=class{last=-1;stable=0;observe(e){return e===this.last?(this.stable+=1,this.stable>=3):(this.last=e,this.stable=0,!1)}};function Dwe(e){if(e.kind===`bottom`)return Math.max(0,e.scrollHeight-e.clientHeight);if(e.anchorDelta===void 0)return null;let t=Math.max(24,e.clientHeight*.3);return Math.max(0,e.scrollTop+e.anchorDelta-t)}function Owe(e,t,n=()=>performance.now()){let r=n(),i=new Ewe,a=0,o=!1,s=()=>{o||(o=!0,a&&cancelAnimationFrame(a),a=0,e.removeAttribute(`data-oc-landing`))},c=()=>{if(t.kind!==`bookmark`)return;let n=e.querySelector(`[data-message-id="${CSS.escape(t.messageId)}"]`);if(n)return(t.blockIndex===null?n:n.querySelector(`[data-block-index="${t.blockIndex}"]`)??n).getBoundingClientRect().top-e.getBoundingClientRect().top},l=()=>{if(o)return;let u=Dwe({kind:t.kind,scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,anchorDelta:c()});if(u!==null&&(e.scrollTop=u),u!==null&&i.observe(e.scrollHeight)||n()-r>=1200){s();return}a=requestAnimationFrame(l)};return a=requestAnimationFrame(l),s}function kwe(e){let t=BF()?.rows;(0,z.useEffect)(()=>{if(!e.ready||e.focusMessageId)return;let n=document.querySelector(`.oc-thread__viewport`);if(!n)return;n.setAttribute(`data-oc-landing`,``);let r=Owe(n,Twe(t??[]));return()=>{r()}},[e.chatId,e.ready,e.focusMessageId])}var e8={showSource:!0,showReport:!0,copyAssistant:!0,copyUser:!0,showDelete:!0,showTools:!1,voiceInput:!1,showUsage:!0,autoReadAloud:!0},t8=(0,z.createContext)({enabled:!1,lang:`auto`,rate:1,autoRead:!1,engine:`browser`,loaded:!1}),n8=(0,z.createContext)({active:null,setActive:()=>{},clearIf:()=>{}}),r8=0;function i8(){r8++,Ax(),Ix()}var a8=(0,z.createContext)(e8);function o8(){return(0,z.useContext)(a8)}var s8=(0,z.createContext)(null),c8=(0,z.createContext)(null),l8=(0,z.createContext)(null),u8=(0,z.createContext)(null),d8=(0,z.createContext)(null),f8=(0,z.createContext)(null);function p8(){return(0,z.useContext)(f8)}function m8({className:e}){let t=M3();return(0,B.jsx)(`div`,{className:e,"aria-hidden":!0,children:t.logoUrl?t.logoMasked?(0,B.jsx)(`span`,{className:`oc-avatar__img oc-avatar__img--mask`,style:{"--oc-logo-url":`url("${t.logoUrl}")`}}):(0,B.jsx)(`img`,{className:`oc-avatar__img`,src:t.logoUrl,alt:``}):t.isDefault?(0,B.jsx)(A3,{className:`oc-avatar__mark`}):t.initials})}function h8({chatId:e,focusMessageId:t}){let{runtime:n,turnGate:r,queueSend:i,abortTurn:a,routing:o,lastUserTurnQueued:s,queuedTurns:c,cancelQueued:l,initialLoading:u}=pCe({chatId:e}),d=I(L.me.getMe,{host:d3}),f=d?.ui?.effective??e8,p=f.showTools,m=m3(d?.resolvedThemeMode),h=d?.resolvedChartBrand,g=d?.resolvedChartTokens,_=I(L.agents.getChatAgent,e?{chatId:e}:`skip`),v=_?.multiAgent?_.agent:null,y=(0,z.useMemo)(()=>{let e=h?.label??`Atrium`,t=g?.colors?.[m],n=tSe(h,nSe(t?.primary,t?.[`primary-foreground`],m));return{label:e,logoUrl:n?.url??null,logoMasked:n?.masked??!1,isDefault:h?.isDefault??!0,initials:rSe(e),agentName:v?.displayName??v?.agentId??null,agentEmoji:v?.emoji??null}},[h,m,g,v]),b=Nt(L.me.setUiPref).withOptimisticUpdate(f6),x=I(L.messages.getSessionMeta,e?{chatId:e}:`skip`),S=e!==null&&x===null,C=d?.userId??``,w=e??null,T=n2(),E=Z0(),D=Hge((0,z.useSyncExternalStore)(U0,W0,W0),{userId:C,chatId:w}),O=_?.agent?.instanceName??null,k=(0,z.useCallback)((e,t)=>{Lge({kind:e,ownerUserId:C,originChatId:w,originLabel:x?.title||mu(),params:t})},[C,w,x?.title]),A=(0,z.useCallback)(()=>{D!==null&&K0(D.pinId)},[D]),ee=D?.kind===`sources`?D.params.messageId:null,j=D?.kind===`subagent`?D.params.childKey:null,M=D?.kind===`document`?D.params.doc:null,te=D?.kind===`cron`?D.params:null,N=(0,z.useMemo)(()=>({activeMessageId:ee,openFor:e=>k(`sources`,{messageId:e}),close:A}),[ee,k,A]),P=N3(y),ne=(0,z.useMemo)(()=>({activeChildKey:j,openFor:e=>k(`subagent`,{childKey:e,parentAgentLabel:P}),close:A}),[j,P,k,A]),re=M1;(0,z.useEffect)(()=>()=>{re.current=null},[re]);let ie=(0,z.useMemo)(()=>({activeDoc:M,openFor:e=>k(`document`,{doc:e}),openNewerVersion:e=>{D===null?k(`document`,{doc:e}):q0(D.pinId,{doc:e})},close:A}),[M,D,k,A]),ae=(0,z.useMemo)(()=>({active:te,openFor:(e,t,n)=>{let r=t??O;r!==null&&k(`cron`,{instanceName:r,jobId:e.jobId??null,part:e,occurrenceId:n})},close:A}),[te,O,k,A]),oe=ee!==null,se=j!==null,ce=M!==null,le=te!==null,ue=D?.kind??null,de=D?.params??null,fe=ue===null?null:zge(ue,de??{}),pe=le||ce||se||oe,me=ue===null||J0(E,ce?380:se?320:300),he=pe&&(T||!me)&&D?.pinned!==!0,ge=I(L.voice.voiceConfigForChat,e?{chatId:e}:`skip`),[_e,ve]=(0,z.useState)(null),ye=(0,z.useMemo)(()=>({active:_e,setActive:ve,clearIf:e=>ve(t=>t?.messageId===e?null:t)}),[_e]);(0,z.useEffect)(()=>{i8(),ve(null)},[e]);let be=(0,z.useMemo)(()=>ge?{...ge,loaded:!0}:{enabled:!1,lang:`auto`,rate:1,autoRead:!1,engine:`browser`,loaded:!1},[ge]);return(0,B.jsx)(xoe,{runtime:n,children:(0,B.jsx)(t8.Provider,{value:be,children:(0,B.jsx)(n8.Provider,{value:ye,children:(0,B.jsx)(s8.Provider,{value:r,children:(0,B.jsx)(c8.Provider,{value:i,children:(0,B.jsx)(l8.Provider,{value:{queuedTurns:c,cancelQueued:l},children:(0,B.jsx)(d8.Provider,{value:e,children:(0,B.jsx)(u8.Provider,{value:a,children:(0,B.jsx)(v6.Provider,{value:s,children:(0,B.jsx)(f8.Provider,{value:o,children:(0,B.jsx)(a8.Provider,{value:f,children:(0,B.jsx)(j3.Provider,{value:y,children:(0,B.jsx)(r0.Provider,{value:N,children:(0,B.jsx)(L0.Provider,{value:ne,children:(0,B.jsx)(lI.Provider,{value:ae,children:(0,B.jsx)(N1.Provider,{value:re,children:(0,B.jsx)(L1.Provider,{value:ie,children:(0,B.jsxs)(W1,{children:[(0,B.jsx)(`div`,{className:`oc-chat`,children:(0,B.jsx)(`div`,{className:`oc-chat__convo`,children:e?S?(0,B.jsx)(Awe,{}):(0,B.jsx)(Fwe,{chatId:e,showTools:p,onToggleTools:()=>void b({key:`showTools`,value:!p}),focusMessageId:t??null,initialLoading:u}):(0,B.jsx)(`div`,{className:`oc-empty`,children:nh()})})}),oe&&he?(0,B.jsx)(N6,{open:!0,onOpenChange:e=>{e||N.close()},children:(0,B.jsx)(P6,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,B.jsx)(pI,{onClose:A,children:(0,B.jsx)(i0,{messageId:ee,onClose:N.close})},fe??`none`)})}):null,se&&he?(0,B.jsx)(N6,{open:!0,onOpenChange:e=>{e||ne.close()},children:(0,B.jsx)(P6,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,B.jsx)(pI,{onClose:A,children:(0,B.jsx)(z0,{chatId:e,childKey:j,onClose:ne.close,parentAgentLabel:N3(y)})},fe??`none`)})}):null,le&&he?(0,B.jsx)(N6,{open:!0,onOpenChange:e=>{e||ae.close()},children:(0,B.jsx)(P6,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,B.jsx)(pI,{onClose:A,children:(0,B.jsx)(fI,{instanceName:te.instanceName,part:te.part,onClose:ae.close})},fe??`none`)})}):null,ce&&he?(0,B.jsx)(N6,{open:!0,onOpenChange:e=>{e||ie.close()},children:(0,B.jsx)(P6,{side:`right`,className:`oc-sources-panel-sheet oc-docviewer-sheet`,children:(0,B.jsx)(pI,{onClose:A,children:(0,B.jsx)(z1,{doc:M,chatId:e,onClose:ie.close})},fe??`none`)})}):null]})})})})})})})})})})})})})})})})})})}function Awe(){let e=Nv();return(0,B.jsxs)(`div`,{className:`oc-notfound`,role:`status`,children:[(0,B.jsx)(`div`,{className:`oc-notfound__icon`,"aria-hidden":!0,children:(0,B.jsx)(Bb,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-notfound__title`,children:De()}),(0,B.jsx)(`p`,{className:`oc-notfound__body`,children:qa()}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-notfound__cta`,onClick:()=>void e({to:`/`}),children:[(0,B.jsx)(Ib,{size:16,"aria-hidden":!0}),_ee()]})]})}function jwe(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 Mwe(e,t){(0,z.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=WCe(t);e&&(i=jwe(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 Nwe(){return(0,B.jsx)(`div`,{className:`oc-thread-skeleton`,role:`status`,"aria-label":wl(),children:[72,38,84,56,64].map((e,t)=>(0,B.jsx)(`div`,{className:`oc-thread-skeleton__row${t%2?` oc-thread-skeleton__row--user`:``}`,children:(0,B.jsx)(`span`,{className:`oc-thread-skeleton__bubble`,style:{width:`${e}%`}})},t))})}function Pwe(e){return kwe({chatId:e.chatId,ready:e.ready,focusMessageId:e.focusMessageId}),null}function Fwe({chatId:e,showTools:t,onToggleTools:n,focusMessageId:r,initialLoading:i}){let a=I(L.bridgeHealth.getBridgeAvailability,{chatId:e}),o=p8(),s=o?.selected??null,c=I(L.bridgeHealth.getBridgeAvailability,{chatId:e,...s?{routedAgent:{instanceName:s.instanceName,agentId:s.agentId}}:{}}),l=c&&!c.available?c:null,{beyondValidated:u,gatewayVersion:d}=b6(e,s?{instanceName:s.instanceName,agentId:s.agentId}:null),f=a?.available===!0&&a.degraded===!0,p=c?.available===!0&&c.degraded===!0,m=I(L.agents.getChatAgent,{chatId:e})?.readOnly===!0,h=uSe({hasUserTurn:o?.hasUserTurn===!0,emptyThread:o?.emptyThread===!0,unavailable:l!==null,readOnly:m,multiAgent:o?.multiAgent===!0,poolSize:(o?.pool??[]).filter(e=>e.state!==`deleted`).length}),g=!h.hidden&&!h.disabled,_=GCe({readOnly:m,unavailable:l!==null,degraded:p,beyondValidated:u}),v=I(L.messages.getSessionMeta,{chatId:e})?.title??``,y=I(L.subAgents.listSubAgents,{chatId:e}),b=hge(y??[]),x=Ei(L.subAgents.reconcileTaskEngagements),S=(y??[]).some(e=>e.kind===`task`&&e.status===`running`),C=4*6e4,w=(y??[]).reduce((e,t)=>t.kind===`task`&&t.updatedAt>e?t.updatedAt:e,0),T=(0,z.useRef)({chatId:null,seenStamp:0,armedAtLocal:0});if(T.current.chatId!==(e??null)&&(T.current={chatId:e??null,seenStamp:0,armedAtLocal:0}),w>0&&T.current.seenStamp!==w){let t=T.current.seenStamp===0,n=Date.now()-w<10*6e4;T.current={chatId:e??null,seenStamp:w,armedAtLocal:t&&!n?0:Date.now()}}let E=T.current.armedAtLocal>0&&Date.now()-T.current.armedAtLocal<C;(0,z.useEffect)(()=>{if(!S&&!E||!e)return;let t=!1,n=!1,r,i=()=>{if(t||n)return;let r=T.current.armedAtLocal+C;!S&&Date.now()>r||(n=!0,x({chatId:e}).catch(()=>{}).finally(()=>{n=!1}))};return i(),r=window.setInterval(i,3e4),()=>{t=!0,window.clearInterval(r)}},[S,E,e,x]);let D=I(L.subAgents.turnActivity,{chatId:e}),O=bCe(I(L.messages.listByChat,{chatId:e})),k=D?.deliveringSince??null,A=D?.deliveringTtlRemainingMs??null,[ee,j]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(k===null||A===null||A<=0)return;let t=window.setTimeout(()=>j({chatId:e,key:k}),A);return()=>window.clearTimeout(t)},[k,A,e]);let M=xCe(e,k,A,ee),te=D?.runningTtlRemainingMs??null,[N,P]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(P(!1),D?.running!==!0||te===null)return;let e=window.setTimeout(()=>P(!0),te);return()=>window.clearTimeout(e)},[D?.running,te,e]);let ne=D?.running===!0&&!N,re=!O&&(ne||M),ie=D?.anchorMessageId??null,[ae,oe]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!re||ie===null){oe(!1);return}let e=()=>oe(document.querySelector(`[data-message-id="${CSS.escape(ie)}"]`)!==null);e();let t=window.setInterval(e,2e3);return()=>window.clearInterval(t)},[re,ie]);let se=D?.detachedTask===!0?null:D?.workingSince??null,ce=re&&ie!==null&&ae?{messageId:ie,running:ne,workingSince:se,progressSummary:D?.progressSummary??null}:null;return Mwe(e,r),(0,B.jsx)(p6.Provider,{value:f,children:(0,B.jsx)(_6.Provider,{value:ce,children:(0,B.jsx)(Aue,{chatId:e,focusMessageId:r,children:(0,B.jsxs)(hF.Root,{className:`oc-thread`,children:[(0,B.jsx)(Hwe,{chatId:e}),(0,B.jsx)(Bwe,{chatId:e}),i?(0,B.jsx)(Nwe,{}):null,(0,B.jsx)(Pwe,{chatId:e,ready:!i,focusMessageId:r}),(0,B.jsxs)(hF.Viewport,{className:`oc-thread__viewport`,style:i?{display:`none`}:void 0,children:[(0,B.jsx)(hF.Empty,{children:(0,B.jsx)(Vwe,{})}),(0,B.jsx)(hF.Messages,{components:{UserMessage:oTe,AssistantMessage:lTe,SystemMessage:uTe}}),re&&ce===null?(0,B.jsx)(g8,{running:ne,since:se,progress:D?.progressSummary??null}):null]}),(0,B.jsx)(Nue,{}),(0,B.jsx)(`div`,{className:`oc-scrolldown-anchor`,children:(0,B.jsx)(hF.If,{empty:!1,children:(0,B.jsxs)(hF.ScrollToBottom,{className:`oc-scrolldown`,children:[(0,B.jsx)(qwe,{}),(0,B.jsx)(`span`,{children:ll()})]})})}),_===`read_only`?(0,B.jsx)(zwe,{}):_===`unavailable`?(0,B.jsx)(Rwe,{reason:l?.reason??null,canSwitchAgent:g}):_===`degraded`?(0,B.jsx)(Lwe,{}):_===`beyond_validated`?(0,B.jsx)(Iwe,{version:d}):null,(0,B.jsx)(TCe,{}),(0,B.jsx)(yTe,{chatId:e,chatTitle:v,showTools:t,onToggleTools:n,unavailable:l!==null||m,agentGate:h,subAgentBusy:b})]})})})})}function g8({running:e,since:t=null,anchored:n=!1,progress:r=null}){let i=(0,z.useRef)(null);if(t!==null&&i.current?.key!==t){let e=Date.now();i.current={key:t,baselineMs:m6(t,e),firstLocalMs:e}}let[,a]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(t===null)return;let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[t]);let o=!n&&t!==null&&i.current!==null&&i.current.key===t?g6(h6(i.current.baselineMs,i.current.firstLocalMs,Date.now())):null;return(0,B.jsxs)(`div`,{className:`oc-turn-activity${n?` oc-turn-activity--anchored`:``}`,children:[(0,B.jsxs)(`span`,{className:`oc-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{})]}),(0,B.jsx)(`span`,{role:`status`,className:r===null?void 0:`oc-sr-only`,children:e?Up():kf()}),r===null?null:(0,B.jsx)(`span`,{className:`oc-turn-activity__progress`,title:r,children:r}),o===null?null:(0,B.jsx)(`span`,{className:`oc-turn-activity__clock`,role:`timer`,children:o})]})}function Iwe({version:e}){return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--warn`,role:`status`,children:[(0,B.jsx)(Py,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e===null?Vm():jee({version:e})})]})}function Lwe(){return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--warn`,role:`status`,children:[(0,B.jsx)(Py,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:Mc()})]})}function Rwe({reason:e,canSwitchAgent:t}){let n=e===`instance_unreachable`?t?zf():Qp():ku();return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--error`,role:`status`,children:[(0,B.jsx)(Py,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:n})]})}function zwe(){return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--error`,role:`status`,children:[(0,B.jsx)(mb,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:Hu()})]})}function Bwe({chatId:e}){let t=I(L.messages.listByChat,{chatId:e}),[n,r]=(0,z.useState)(``),i=(0,z.useRef)(null);return(0,z.useEffect)(()=>{i.current=null,r(``)},[e]),(0,z.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===pf()?`${pf()} `:pf()))}},[t]),(0,B.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`oc-sr-only`,children:n})}function Vwe(){return(0,B.jsxs)(`div`,{className:`oc-emptystate`,children:[(0,B.jsx)(m8,{className:`oc-emptystate__avatar`}),(0,B.jsx)(`h2`,{className:`oc-emptystate__title`,children:cp()})]})}function _8({chatId:e}){let t=p8()?.selected??null,n=A6(I(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,B.jsxs)(`span`,{className:`oc-meter ${n.level}`,title:xs({detail:r}),children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${n.percentLeft}%`}})}),(0,B.jsx)(`span`,{className:`oc-meter__label`,children:Kt({pct:n.percentLeft})})]})}function v8({sm:e,detail:t=!0}){let n=G6(e),r=hwe(e),i=q6(e),a=n!=null&&i?Math.round(n/i*100):null;if(a==null||n==null)return i?(0,B.jsx)(`span`,{className:`oc-meter is-unknown`,title:_r(),role:`status`,children:(0,B.jsx)(`span`,{className:`oc-meter__label`,children:`—`})}):null;let o=a>=90?`is-critical`:a>=75?`is-warn`:`is-ok`,s=bwe(e);return(0,B.jsxs)(`span`,{className:`oc-meter ${o}`,title:`${Rs({pct:a,used:U6(n),total:U6(i)})}\n${r===`budget_estimate`?ic():Zn()}${s?`\n${Mp({gateway:s.gateway,delta:s.delta})}`:``}`,children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(a,100)}%`}})}),(0,B.jsxs)(`span`,{className:`oc-meter__label`,children:[a,`%`,t?(0,B.jsxs)(`span`,{className:`oc-meter__detail`,children:[` · `,U6(n),`/`,U6(i)]}):null]})]})}function Hwe({chatId:e}){let t=I(L.messages.getSessionMeta,{chatId:e}),n=Nv(),r=I(L.projects.listProjects,{}),i=(0,z.useMemo)(()=>{let e=t?.projectId??null;return e===null||r===void 0?[]:u3(r,e)},[t?.projectId,r]),a=t?.sessionMeta??null,o=t?.sessionSettings??null,s=o8(),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=(0,z.useRef)(null),f=(0,z.useRef)(null),[p,m]=(0,z.useState)(!1),h=!H6(o,`thinkingLevel`),g=(n,r)=>(0,B.jsxs)(B.Fragment,{children:[s.showTools&&!n&&a?.model?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:a.modelProvider?fm({provider:a.modelProvider}):Af(),children:[(0,B.jsx)(Gwe,{}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:a.model})]}):null,s.showTools&&!n&&a?.thinkingLevel?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:h?$l():_(),children:[(0,B.jsx)(Kwe,{}),(0,B.jsxs)(`span`,{className:`oc-chip__label`,children:[_a(),`\xA0: `,W6(a.thinkingLevel)]}),h?(0,B.jsx)(`span`,{className:`oc-chip__hint`,children:bc()}):null]}):null,s.showTools&&a?(0,B.jsx)(v8,{sm:a,detail:!n}):null,s.showUsage&&!a?(0,B.jsx)(_8,{chatId:e}):null,(0,B.jsx)(Uwe,{chatId:e,title:t?.title??null,compact:n,ghost:r}),a?(0,B.jsx)(Wwe,{chatId:e,sm:a,settings:o,onOpenPanel:()=>l(!0),compact:n,ghost:r,showUsage:s.showUsage}):null]});return(0,z.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=f.current?.offsetWidth??0;if(t===0)return;let n=Math.min(d.current?.scrollWidth??0,360),r=e.clientWidth-n-16<t;m(e=>e===r?e:r)};t();let n=new ResizeObserver(t);return n.observe(e),f.current&&n.observe(f.current),()=>n.disconnect()},[[ge(),jn(),a?.model??``,a?.thinkingLevel??``,t?.title??``,i.map(e=>e.name).join(`/`),s.showTools?`1`:`0`].join(`|`)]),(0,B.jsxs)(`header`,{className:`oc-chathead`,ref:u,children:[(0,B.jsxs)(`div`,{className:`oc-chathead__titlebox`,ref:d,children:[i.length>0?(0,B.jsx)(`nav`,{className:`oc-chathead__crumbs`,"aria-label":Wn(),children:i.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-chathead__crumb`,children:[t>0?(0,B.jsx)(`span`,{className:`oc-chathead__crumbsep`,"aria-hidden":!0,children:`›`}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-chathead__crumblink`,onClick:()=>void n({to:`/project/$projectId`,params:{projectId:e._id}}),children:e.name})]},e._id))}):null,(0,B.jsx)(`div`,{className:`oc-chathead__title`,title:t?.title??void 0,children:t?.title||mu()})]}),(0,B.jsx)(`div`,{className:`oc-chathead__meta`,children:g(p,!1)}),(0,B.jsx)(`div`,{className:`oc-chathead-ghost`,"aria-hidden":!0,ref:f,children:g(!1,!0)}),(0,B.jsx)(wwe,{chatId:e,open:c,onOpenChange:l})]})}function y8(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 Uwe({chatId:e,title:t,compact:n=!1,ghost:r=!1}){let i=sa();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,...e.quotedRefs!==void 0&&e.quotedRefs.length>0?{quotedExcerpts:e.quotedRefs.map(e=>e.excerpt)}:{},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=_Se(t);n===`md`?y8(hSe(s,l),`${u}.md`,`text/markdown`):y8(gSe(s,l),`${u}.json`,`application/json`)}let o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Gy,{size:13,"aria-hidden":!0}),n?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-chip__label`,children:ge()}),(0,B.jsx)(Ay,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})]});return r?(0,B.jsx)(`span`,{className:`oc-chip oc-chip--btn`,children:o}):(0,B.jsxs)(yF,{children:[(0,B.jsx)(bF,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-chip oc-chip--btn`,title:ts(),children:o})}),(0,B.jsxs)(xF,{align:`end`,className:`w-44`,children:[(0,B.jsx)(CF,{children:ge()}),(0,B.jsx)(SF,{onClick:()=>void a(`md`),children:yh()}),(0,B.jsx)(SF,{onClick:()=>void a(`json`),children:Ia()})]})]})}function Wwe({chatId:e,sm:t,settings:n,onOpenPanel:r,compact:i=!1,ghost:a=!1,showUsage:o=!1}){let[s,c]=(0,z.useState)(!1),l=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Gb,{size:13,"aria-hidden":!0}),i?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-chip__label`,children:jn()}),(0,B.jsx)(Ay,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})]});return a?(0,B.jsx)(`span`,{className:`oc-chip oc-chip--btn`,children:l}):(0,B.jsxs)(gF,{open:s,onOpenChange:c,children:[(0,B.jsx)(_F,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-chip oc-chip--btn`,title:Fr(),children:l})}),(0,B.jsxs)(vF,{align:`end`,className:`oc-spanel-pop w-80 p-2`,children:[q6(t)?(0,B.jsxs)(`div`,{className:`oc-spanel-pop__usage`,children:[(0,B.jsx)(`span`,{className:`oc-spanel-pop__usage-label`,children:fn()}),(0,B.jsx)(v8,{sm:t})]}):null,o?(0,B.jsxs)(`div`,{className:`oc-spanel-pop__usage`,children:[(0,B.jsx)(`span`,{className:`oc-spanel-pop__usage-label`,children:Ff()}),(0,B.jsx)(_8,{chatId:e})]}):null,(0,B.jsx)(Z6,{chatId:e,sm:t,settings:n}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-spanel-pop__all`,onClick:()=>{c(!1),r()},children:[(0,B.jsx)(Gb,{size:13,"aria-hidden":!0}),Xf(),(0,B.jsx)(My,{size:13,"aria-hidden":!0})]})]})]})}function Gwe(){return(0,B.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,B.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),(0,B.jsx)(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),(0,B.jsx)(`path`,{d:`M9 1v3M15 1v3M9 20v3M15 20v3M20 9h3M20 14h3M1 9h3M1 14h3`})]})}function Kwe(){return(0,B.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,B.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,B.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 b8({children:e}){return(0,B.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 qwe(){return(0,B.jsx)(b8,{children:(0,B.jsx)(`path`,{d:`M12 5v14M19 12l-7 7-7-7`})})}var Jwe=`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 oc-overlay-layer min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,x8=`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 Ywe({sourceShown:e,sourceActive:t,onToggleSource:n}){let r=U(e=>e.metadata?.custom?.messageId),i=U(e=>e.metadata?.custom?.sentAt),a=U(e=>e.metadata?.custom?.generationMs??null),o=U(e=>e.metadata?.custom?.status===`streaming`),s=Nt(L.chatFork.forkChat),c=K3(),l=JF(),[u,d]=(0,z.useState)(!1);if(!r)return null;let f=async()=>{let e=await c({title:eh(),description:hee(),label:it(),placeholder:sl(),confirmLabel:Te(),allowEmpty:!0});if(e!==null){d(!0);try{let{chatId:t}=await s({branchMessageId:r,...e.trim()?{title:e.trim()}:{}});Z3(t,{expand:!0}),l.success(Ga())}catch(e){l.error(kee(),e)}finally{d(!1)}}};return(0,B.jsxs)(UN.Root,{children:[(0,B.jsx)(UN.Trigger,{className:`oc-iconbtn`,title:Ac(),"aria-label":Ac(),disabled:u,children:(0,B.jsx)(qy,{size:15})}),(0,B.jsxs)(UN.Content,{align:`end`,sideOffset:4,className:Jwe,children:[i===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`oc-msgmenu__when px-2 py-1.5 text-sm`,children:[o0(i,{dateStyle:`medium`,timeStyle:`short`}),(()=>{let e=a===null?null:c0(a);return e===null?null:(0,B.jsxs)(`span`,{className:`oc-msgmenu__duration`,children:[(0,B.jsx)(Qb,{size:12,"aria-hidden":!0}),O({duration:e})]})})()]}),(0,B.jsx)(UN.Separator,{className:`bg-border -mx-1 my-1 h-px`})]}),e?(0,B.jsxs)(UN.Item,{className:x8,onSelect:n,children:[(0,B.jsx)(zy,{size:14,"aria-hidden":!0}),t?ci():Gr()]}):null,(0,B.jsxs)(UN.Item,{className:x8,disabled:u||o,onSelect:()=>void f(),children:[(0,B.jsx)(ab,{size:14,"aria-hidden":!0}),eh()]}),(0,B.jsx)(Xwe,{})]})]})}function Xwe(){let e=BF(),t=U(e=>e.id);if(!e)return null;let n=e.byMessage.get(t)?.some(e=>e.blockIndex===null)??!1;return(0,B.jsxs)(UN.Item,{className:x8,onSelect:()=>e.toggle(t,null),children:[(0,B.jsx)(Ty,{size:14,"aria-hidden":!0}),n?su():bm()]})}function Zwe(){let[e,t]=(0,z.useState)(!1),n=U(e=>e.content.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
315
315
|
`)),r=O0(U(e=>e.metadata?.custom?.error??null),U(e=>e.metadata?.custom?.errorCode??null)),i=n.trim()||[r.headline,r.detail].filter(Boolean).join(`
|
|
316
|
-
`),a=i.length===0;return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:fo(),"aria-label":fo(),disabled:a,onClick:()=>{navigator.clipboard.writeText(i).then(()=>{t(!0),window.setTimeout(()=>t(!1),1500)})},children:e?(0,B.jsx)(C8,{}):(0,B.jsx)(S8,{})})}function
|
|
317
|
-
`)),s=e.engine!==`gateway`;if(!e.enabled||!o.trim()||s&&!Ox())return null;let c=Ex(e.lang,Jd()),l=t.active?.messageId===i,u=l&&t.active?.phase===`loading`,d=l&&t.active?.phase===`playing`,f=()=>{i8();let l=Dx(o);if(s){let n=kx(l,{lang:c,rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(n?{messageId:i,phase:`playing`}:null);return}if(!a)return;let u=r8;t.setActive({messageId:i,phase:`loading`}),n({chatId:a,text:l.slice(0,1500)}).then(({mime:n,audioBase64:r})=>{if(u!==r8)return;let a=Fx(r,n,{rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(a?{messageId:i,phase:`playing`}:null)}).catch(e=>{u===r8&&(r.error(Zu(),e),t.setActive(null))})};return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn${l?` oc-iconbtn--reading`:``}`,title:l?fh():ro(),"aria-label":l?fh():ro(),"aria-pressed":l,"aria-busy":u,onClick:()=>{if(l){i8(),t.setActive(null);return}f()},children:u?(0,B.jsx)(pb,{size:16,className:`oc-actrow__spin`,"aria-hidden":!0}):d?(0,B.jsx)(
|
|
318
|
-
`)));let S=p8(),C=S&&S.perTurnRouting?S.messageAgents.has(i)?S.messageAgents.get(i)??S.primary:S.fallbackAgent:null,w=S?.pool,T=U(e=>e.metadata?.custom?.importedAgentLabel??null),E=(0,z.useMemo)(()=>{if(T!==null)return{...r,agentName:T,agentEmoji:null};if(!C)return r;let e=B3(w??[],C);return{...r,agentName:e?.displayName??C.agentId,agentEmoji:e?.emoji??null}},[T,C,r,w]);return b===void 0&&x?null:(0,B.jsxs)(
|
|
316
|
+
`),a=i.length===0;return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:fo(),"aria-label":fo(),disabled:a,onClick:()=>{navigator.clipboard.writeText(i).then(()=>{t(!0),window.setTimeout(()=>t(!1),1500)})},children:e?(0,B.jsx)(C8,{}):(0,B.jsx)(S8,{})})}function Qwe(e){let t=(0,z.useContext)(t8),n=(0,z.useContext)(n8),r=U(e=>e.metadata?.custom?.messageId??e.id),i=o8().autoReadAloud,a=U(e=>e.metadata?.custom?.status??``),o=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!t.loaded)return;let s=o.current;o.current=a,!(!t.enabled||!t.autoRead||t.engine===`gateway`||!i||!Ox())&&(a!==`complete`||s===null||s===`complete`||e.trim()&&kx(Dx(e),{lang:Ex(t.lang,Jd()),rate:t.rate,onEnd:()=>n.clearIf(r)})&&n.setActive({messageId:r,phase:`playing`}))},[a,e,t,n,r,i])}function $we(){let e=(0,z.useContext)(t8),t=(0,z.useContext)(n8),n=Ei(L.voice.gatewayTts),r=JF(),i=U(e=>e.metadata?.custom?.messageId??e.id),a=U(e=>e.metadata?.custom?.chatId??null),o=U(e=>e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
317
|
+
`)),s=e.engine!==`gateway`;if(!e.enabled||!o.trim()||s&&!Ox())return null;let c=Ex(e.lang,Jd()),l=t.active?.messageId===i,u=l&&t.active?.phase===`loading`,d=l&&t.active?.phase===`playing`,f=()=>{i8();let l=Dx(o);if(s){let n=kx(l,{lang:c,rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(n?{messageId:i,phase:`playing`}:null);return}if(!a)return;let u=r8;t.setActive({messageId:i,phase:`loading`}),n({chatId:a,text:l.slice(0,1500)}).then(({mime:n,audioBase64:r})=>{if(u!==r8)return;let a=Fx(r,n,{rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(a?{messageId:i,phase:`playing`}:null)}).catch(e=>{u===r8&&(r.error(Zu(),e),t.setActive(null))})};return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn${l?` oc-iconbtn--reading`:``}`,title:l?fh():ro(),"aria-label":l?fh():ro(),"aria-pressed":l,"aria-busy":u,onClick:()=>{if(l){i8(),t.setActive(null);return}f()},children:u?(0,B.jsx)(pb,{size:16,className:`oc-actrow__spin`,"aria-hidden":!0}):d?(0,B.jsx)(nTe,{}):(0,B.jsx)(tTe,{})})}function eTe(){let e=(0,z.useContext)(n8);if(!e.active)return null;let t=e.active.phase===`loading`;return(0,B.jsxs)(`div`,{className:`oc-reading-banner`,role:`status`,children:[t?(0,B.jsx)(pb,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(nx,{size:14,className:`oc-reading-banner__pulse`,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:t?Sf():gp()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-reading-banner__stop`,onClick:()=>{i8(),e.setActive(null)},children:fh()})]})}function tTe(){return(0,B.jsxs)(b8,{children:[(0,B.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4V5z`}),(0,B.jsx)(`path`,{d:`M15.5 8.5a5 5 0 0 1 0 7`})]})}function nTe(){return(0,B.jsxs)(b8,{children:[(0,B.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4V5z`}),(0,B.jsx)(`line`,{x1:`22`,y1:`9`,x2:`16`,y2:`15`}),(0,B.jsx)(`line`,{x1:`16`,y1:`9`,x2:`22`,y2:`15`})]})}function S8(){return(0,B.jsxs)(b8,{children:[(0,B.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,B.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]})}function C8(){return(0,B.jsx)(b8,{children:(0,B.jsx)(`path`,{d:`M20 6 9 17l-5-5`})})}function rTe({text:e}){let t=(e??``).trim();return t?(0,B.jsx)(`div`,{className:`oc-msg__segment`,role:`note`,children:t}):null}var w8={File:YCe},iTe={...w8,Text:ehe,Reasoning:rTe,tools:{by_name:{__turn_flow__:wCe}}};function T8({kind:e}){let t=U(e=>e.metadata?.custom?.messageId),n=Nt(L.messages.deleteMessage).withOptimisticUpdate(mCe),r=G3(),i=JF(),a=(0,z.useContext)(s8),[o,s]=(0,z.useState)(!1),c=fO(e=>e.isRunning);if(!t)return null;async function l(){if(await r(e===`assistant`?{title:Tt(),description:Qi(),confirmLabel:_i(),cancelLabel:Qr(),destructive:!0}:{title:wd(),description:M(),confirmLabel:Vd(),cancelLabel:Qr(),destructive:!0})){s(!0),e===`assistant`&&a?.begin();try{await n({messageId:t})}catch(t){e===`assistant`&&a?.cancel(),i.error(vo(),t)}finally{s(!1)}}}return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn oc-iconbtn--danger`,title:c?Li():e===`assistant`?Pi():Ke(),"aria-label":ot(),"aria-busy":o,disabled:o||c,onClick:()=>void l(),children:o?(0,B.jsx)(pb,{size:15,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,B.jsx)($b,{size:15,"aria-hidden":!0})})}function E8(){let e=U(e=>e.metadata?.custom?.rawText??``),t=U(e=>e.metadata?.custom?.chatId),n=U(e=>e.metadata?.custom?.messageId),r=U(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??D8),i=I(L.subAgents.listSubAgents,e===``&&t?{chatId:t}:`skip`),a=e===``?M0(i??[],S6(r),n).find(e=>e.status===`done`&&e.resultText)?.resultText??``:``,o=e===``&&a!==``,s=e===``?a:e,[c,l]=(0,z.useState)(!1),u=[...s].length;return(0,B.jsxs)(`div`,{className:`oc-msg__source`,children:[(0,B.jsxs)(`div`,{className:`oc-msg__source-head`,children:[(0,B.jsx)(`span`,{className:`oc-msg__source-label`,children:o?xn({count:u}):u>1?Er({count:u}):Da({count:u})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:ht(),"aria-label":ht(),onClick:()=>{navigator.clipboard?.writeText(s).then(()=>{l(!0),window.setTimeout(()=>l(!1),1200)})},children:c?(0,B.jsx)(C8,{}):(0,B.jsx)(S8,{})})]}),(0,B.jsx)(`pre`,{className:`oc-msg__source-pre`,children:s.length>0?s:Ui()})]})}function aTe({active:e,onToggle:t}){return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn${e?` is-on`:``}`,onClick:t,"aria-pressed":e,title:e?ci():Gr(),"aria-label":_d(),children:(0,B.jsx)(zy,{size:15,"aria-hidden":!0})})}function oTe(){let[e,t]=(0,z.useState)(!1),n=o8(),r=U(e=>e.id.startsWith(`optimistic-`)),i=U(e=>e.metadata?.custom?.queued===!0),a=U(e=>e.id),o=U(e=>e.metadata?.custom?.quotedRefs??null),s=JF();return(0,B.jsx)(iF.Root,{className:`oc-msg oc-msg--user${r?` is-sending`:``}${i?` is-queued`:``}`,"data-message-id":a,children:(0,B.jsxs)(`div`,{className:`oc-msg__col oc-msg__col--user`,children:[(0,B.jsx)(UF,{}),o?.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-msg__quote`,title:dr(),onClick:e.messageId?()=>k8(e.messageId,e.blockIndex,s):void 0,children:[(0,B.jsx)(Lb,{size:12,"aria-hidden":!0,className:`oc-msg__quote-ico`}),(0,B.jsx)(`span`,{className:`oc-msg__quote-text`,children:e.excerpt})]},`${e.messageId??`orphan`}:${e.blockIndex??`all`}:${t}`))??null,(0,B.jsx)(`div`,{className:`oc-msg__bubble`,children:e?(0,B.jsx)(E8,{}):(0,B.jsx)(iF.Parts,{components:w8})}),r?(0,B.jsxs)(`span`,{className:`oc-msg__sending`,role:`status`,children:[(0,B.jsx)(`span`,{className:`oc-msg__sending-spin`,"aria-hidden":!0}),Pd()]}):i?(0,B.jsxs)(`span`,{className:`oc-msg__queued`,role:`status`,children:[(0,B.jsx)(Ry,{size:12,"aria-hidden":!0}),Oi()]}):(0,B.jsxs)(TO.Root,{className:`oc-msg__actions oc-msg__actions--user`,autohide:`not-last`,children:[(0,B.jsx)(GF,{}),n.copyUser?(0,B.jsxs)(TO.Copy,{className:`oc-iconbtn`,title:T(),children:[(0,B.jsx)(iF.If,{copied:!0,children:(0,B.jsx)(C8,{})}),(0,B.jsx)(iF.If,{copied:!1,children:(0,B.jsx)(S8,{})})]}):null,n.showSource?(0,B.jsx)(aTe,{active:e,onToggle:()=>t(e=>!e)}):null,n.showReport?(0,B.jsx)(V6,{}):null,n.showDelete?(0,B.jsx)(T8,{kind:`user`}):null]})]})})}function sTe({pool:e,agent:t}){let n=B3(e,t),r=n?.displayName??t.agentId;return(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--agent oc-msg__agent`,title:Dm({name:r}),children:[n?.emoji?(0,B.jsx)(`span`,{className:`oc-chip__emoji`,"aria-hidden":!0,children:n.emoji}):(0,B.jsx)(Ey,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:r})]})}var D8=[];function O8(){let e=(0,z.useRef)(null),[t,n]=(0,z.useState)(null);return(0,z.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>{let e=0;try{e=t.getTotalLength()}catch{e=0}if(!e){let n=t.getBoundingClientRect();e=2*(n.width+n.height)}e>0&&n(Math.round(e))};r();let i=new ResizeObserver(r);return i.observe(t.ownerSVGElement??t),()=>i.disconnect()},[]),(0,B.jsxs)(`svg`,{className:`oc-empty-answer__ants`,"aria-hidden":!0,children:[(0,B.jsx)(`rect`,{ref:e}),t===null?null:(0,B.jsx)(`rect`,{className:`oc-ants-accent`,style:{strokeDasharray:`3 3 3 3 3 ${Math.max(t-15,6)}`,animationDuration:`${Math.max(t*4,800)}ms`,animationTimingFunction:`steps(${Math.max(Math.round(t/6),8)}, end)`,"--oc-ants-p":`${t}px`}})]})}function cTe({show:e}){let t=U(e=>e.metadata?.custom?.status),n=U(e=>e.metadata?.custom?.chatId),r=U(e=>k0(e.content)),i=U(e=>e.content.some(e=>e?.type===`file`)),a=U(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??D8),o=I(L.subAgents.listSubAgents,n?{chatId:n}:`skip`),s=U(e=>e.metadata?.custom?.messageId),[,c]=(0,z.useState)(0),l=w6({status:t,hasText:r,hasMedia:i},a,o??[],s),u=l.kind===`composing`?l.recheckAt:null;return(0,z.useEffect)(()=>{if(u===null)return;let e=window.setTimeout(()=>c(e=>e+1),Math.max(u-Date.now(),0)+250);return()=>window.clearTimeout(e)},[u]),l.kind===`none`?null:l.kind===`composing`?(0,B.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--waiting`,role:`status`,children:[(0,B.jsx)(O8,{}),(0,B.jsx)(pb,{size:15,className:`oc-empty-answer__spin`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-empty-answer__text`,children:l.taskName?rf({task:l.taskName}):Mm()})]}):l.kind===`failed`?e?null:(0,B.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--failed`,role:`status`,children:[(0,B.jsx)(Ey,{size:15,className:`oc-empty-answer__icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-empty-answer__text`,children:l.taskName?see({task:l.taskName,reason:l.reason}):jl({reason:l.reason})})]}):l.kind===`waiting`?e?null:(0,B.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--waiting`,role:`status`,children:[(0,B.jsx)(O8,{}),(0,B.jsx)(pb,{size:15,className:`oc-empty-answer__spin`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-empty-answer__text`,children:l.taskName?Gl({task:l.taskName}):xu()})]}):l.kind===`done`?l.resultText?(0,B.jsx)(C1,{text:l.resultText}):null:(0,B.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--generic`,role:`status`,children:[(0,B.jsx)(Ey,{size:15,className:`oc-empty-answer__icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-empty-answer__text`,children:$f()})]})}function lTe(){let[e,t]=(0,z.useState)(!1),n=o8(),r=M3(),i=U(e=>e.id),a=(0,z.useContext)(d8),o=JF(),s=(0,z.useCallback)((e,t)=>{let n=Vne(e,t);n===`too-many`?o.error(Wr({count:10})):n===`too-long`&&o.error(gd())},[o]),c=U(e=>e.metadata?.custom?.rawText??``),l=U(e=>e.status?.type===`running`),u=U(e=>e.metadata?.custom?.chatId),d=U(e=>e.metadata?.custom?.messageId),f=U(e=>e.metadata?.custom?.status),p=U(e=>e.content.some(e=>e?.type===`file`)),m=U(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??D8),h=I(L.subAgents.listSubAgents,c===``&&u?{chatId:u}:`skip`),g=c===``?w6({status:f,hasText:!1,hasMedia:p},m,h??[],d):null,_=c===``?g?.kind===`done`?g.resultText??``:``:c,v=(0,z.useContext)(_6),y=v!==null&&v.messageId===i?v:null,b=U(e=>e.metadata?.custom?.status),x=(0,z.useContext)(v6);Qwe(U(e=>e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
318
|
+
`)));let S=p8(),C=S&&S.perTurnRouting?S.messageAgents.has(i)?S.messageAgents.get(i)??S.primary:S.fallbackAgent:null,w=S?.pool,T=U(e=>e.metadata?.custom?.importedAgentLabel??null),E=(0,z.useMemo)(()=>{if(T!==null)return{...r,agentName:T,agentEmoji:null};if(!C)return r;let e=B3(w??[],C);return{...r,agentName:e?.displayName??C.agentId,agentEmoji:e?.emoji??null}},[T,C,r,w]);return b===void 0&&x?null:(0,B.jsxs)(iF.Root,{className:`oc-msg oc-msg--assistant`,"data-message-id":i,children:[(0,B.jsx)(m8,{className:`oc-msg__avatar`}),(0,B.jsxs)(`div`,{className:`oc-msg__col`,children:[(0,B.jsxs)(`div`,{className:`oc-msg__name`,children:[C?(0,B.jsx)(sTe,{pool:S.pool,agent:C}):(0,B.jsxs)(B.Fragment,{children:[r.agentEmoji?(0,B.jsx)(`span`,{className:`oc-msg__name-emoji`,"aria-hidden":!0,children:r.agentEmoji}):null,N3(r)]}),(0,B.jsx)(GF,{header:!0}),a!==null&&!i.startsWith(`optimistic-`)&&!l&&_!==``?(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-headbtn`,title:Gn(),"aria-label":Gn(),onClick:()=>{let e=kF(_,280);e!==``&&s(a,{messageId:i,blockIndex:null,excerpt:e})},children:(0,B.jsx)(Lb,{size:13})}):null]}),(0,B.jsxs)(`div`,{className:`oc-msg__body`,children:[(0,B.jsx)(SCe,{}),(0,B.jsx)(`div`,{className:`oc-msg__meta oc-msg__meta--cron`,children:(0,B.jsx)(Yue,{})}),n.showTools?(0,B.jsxs)(`div`,{className:`oc-msg__meta`,children:[(0,B.jsx)(wSe,{}),(0,B.jsx)(LCe,{}),(0,B.jsx)(ECe,{}),(0,B.jsx)(jhe,{})]}):null,(0,B.jsx)(BCe,{}),e?(0,B.jsx)(E8,{}):(0,B.jsx)(iF.Parts,{components:iTe}),e?null:(0,B.jsx)(cTe,{show:n.showTools}),(0,B.jsx)(j3.Provider,{value:E,children:(0,B.jsx)(vCe,{})}),y===null?null:(0,B.jsx)(g8,{running:y.running,since:y.workingSince,progress:y.progressSummary??null,anchored:!0})]}),(0,B.jsx)(UF,{messageLevelMarkers:!1,onReplyToBlock:a!==null&&!i.startsWith(`optimistic-`)?(e,t)=>s(a,{messageId:i,blockIndex:e,excerpt:t}):void 0}),(0,B.jsxs)(TO.Root,{className:`oc-msg__actions`,autohide:`not-last`,children:[n.copyAssistant?(0,B.jsx)(Zwe,{}):null,(0,B.jsx)($we,{}),n.showReport?(0,B.jsx)(V6,{}):null,n.showDelete?(0,B.jsx)(T8,{kind:`assistant`}):null,(0,B.jsx)(Ywe,{sourceShown:n.showSource,sourceActive:e,onToggleSource:()=>t(e=>!e)})]})]})]})}function uTe(){let e=U(e=>e.id);return(0,B.jsx)(iF.Root,{className:`oc-msg oc-msg--system`,"data-message-id":e,children:(0,B.jsx)(`div`,{className:`oc-msg__body`,children:(0,B.jsx)(iF.Parts,{components:w8})})})}function k8(e,t,n){if(document.querySelector(`[data-message-id="${CSS.escape(e)}"]`)===null&&document.querySelector(`[data-message-id]`)!==null){n.error(Ep());return}VF(e,t,`smooth`)}function dTe({chatId:e}){let t=qx(e),n=JF();return t.length===0?null:(0,B.jsx)(`div`,{className:`oc-composer__quotes`,role:`group`,"aria-label":Bt(),children:t.map(t=>(0,B.jsxs)(`div`,{className:`oc-composer__quote`,children:[(0,B.jsx)(Lb,{size:13,"aria-hidden":!0,className:`oc-composer__quote-ico`}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__quote-text`,title:dr(),onClick:()=>k8(t.messageId,t.blockIndex,n),children:t.excerpt}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__quote-x`,"aria-label":hs(),onClick:()=>Ux(e,Wx(t)),children:(0,B.jsx)(xh,{size:13,"aria-hidden":!0})})]},Wx(t)))})}function fTe(){let e=lO(e=>e.status?.type),t=lO(e=>e.type),n=lO(e=>e.file??null),[r,i]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(t!==`image`||!n){i(null);return}let e=URL.createObjectURL(n);return i(e),()=>URL.revokeObjectURL(e)},[t,n]);let a=e===`incomplete`,o=n!==null&&I1(n),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),d=(0,z.useRef)(null);d.current=n;let f=n!==null&&(n.type.startsWith(`text/`)||/\.(txt|md|json|csv|log|xml|yaml|yml)$/i.test(n.name));return(0,B.jsxs)(qN.Root,{className:`oc-attach${a?` oc-attach--error`:``}${r&&!a?` oc-attach--image`:``}${o?` oc-attach--flash`:``}`,"data-status":e,children:[r&&!a?(0,B.jsx)(`img`,{src:r,alt:``,className:`oc-attach__thumb`}):(0,B.jsx)(`span`,{className:`oc-attach__icon`,"aria-hidden":!0,children:a?(0,B.jsx)(Py,{size:14}):t===`image`?(0,B.jsx)(lb,{size:14}):(0,B.jsx)(kb,{size:14})}),r&&!a?null:(0,B.jsx)(`span`,{className:`oc-attach__name`,children:(0,B.jsx)(qN.Name,{})}),a?(0,B.jsx)(`span`,{className:`oc-attach__state`,children:op()}):null,!a&&(f||r)?(0,B.jsx)(`button`,{type:`button`,className:`oc-attach__view`,"aria-label":Xd(),title:Xd(),onClick:()=>{if(c(!0),u(null),f&&n){let e=n,t=2e5;e.slice(0,t).text().then(n=>{d.current===e&&u(e.size>t?n+`
|
|
319
319
|
|
|
320
|
-
`+eee():n)}).catch(()=>{d.current===e&&u(null)})}},children:(0,B.jsx)(Xy,{size:13,"aria-hidden":!0})}):null,(0,B.jsx)(KN.Remove,{className:`oc-attach__remove`,"aria-label":Em(),children:(0,B.jsx)(xh,{size:13,"aria-hidden":!0})}),(0,B.jsx)(d0,{open:s,onOpenChange:c,children:(0,B.jsxs)(f0,{className:`oc-attach__dialog`,children:[(0,B.jsx)(p0,{children:(0,B.jsx)(h0,{className:`oc-attach__dialog-title`,children:n?.name??Xd()})}),r?(0,B.jsx)(`img`,{src:r,alt:``,className:`oc-attach__dialog-img`}):l===null?(0,B.jsx)(`p`,{className:`oc-attach__dialog-text`,children:`…`}):(0,B.jsx)(`pre`,{className:`oc-attach__dialog-text`,children:l})]})})]})}function uTe(){let e=(0,z.useSyncExternalStore)(b3.subscribe,b3.getSnapshot);return e.active?(0,B.jsxs)(`div`,{className:`oc-upload`,role:`status`,"aria-live":`polite`,children:[(0,B.jsxs)(`div`,{className:`oc-upload__head`,children:[(0,B.jsx)(pb,{className:`oc-upload__spin`,size:14,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e.count>1?zl({count:e.count,percent:e.percent}):pu({percent:e.percent})})]}),(0,B.jsx)(`div`,{className:`oc-upload__track`,"aria-hidden":!0,children:(0,B.jsx)(`div`,{className:`oc-upload__bar`,style:{width:`${e.percent}%`}})})]}):null}function dTe({reason:e}){let t=(0,z.useContext)(c8),n=uO(),r=Eoe(e=>e.text).trim().length>0,i=e===`subagent`;return(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!r||t===null,"aria-label":i?Lt():Hn(),title:r?i?fs():Cp():i?cr():Ys(),onClick:()=>{if(t===null)return;let e=n.getState().text;e.trim()!==``&&t(e).then(e=>{e&&n.setText(``)})},children:(0,B.jsx)(xy,{size:18,"aria-hidden":!0})})}function fTe(){let e=(0,z.useContext)(u8);return e===null?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__send oc-composer__stop`,"aria-label":d(),title:da(),onClick:()=>void e(),children:(0,B.jsx)(Jb,{size:14,"aria-hidden":!0})})}function pTe({chatId:e,gate:t,rebinding:n=!1,onRebindingChange:r}){let i=p8(),a=Nt(L.chats.rebindChatAgent),o=qF(),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(``),d=i?.pool??[],f=(0,z.useMemo)(()=>P3(F3(d,l)),[d,l]),p=(0,z.useMemo)(()=>new Set(d.map(e=>e.instanceName)).size>1,[d]);if(!i||t.hidden)return null;let{selected:m,setSelected:h}=i,g=t.disabled||n,{mode:_}=t,v=t=>{if(_===`rebind`){r?.(!0),a({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).catch(()=>o.error(Jc())).finally(()=>r?.(!1));return}h({instanceName:t.instanceName,agentId:t.agentId})},y=m??(_===`rebind`?i.primary:null),b=B3(d,y),x=b?.displayName??y?.agentId??Qd();return(0,B.jsxs)(hF,{open:s,onOpenChange:e=>{g||c(e)},children:[(0,B.jsx)(gF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__agent`,disabled:g,title:g?qf():_===`rebind`?Wp():El(),"aria-label":_===`rebind`?id():nee(),children:[b?.emoji?(0,B.jsx)(`span`,{className:`oc-composer__agent-emoji`,"aria-hidden":!0,children:b.emoji}):(0,B.jsx)(Ey,{size:15,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-composer__agent-name`,children:x}),p&&y?(0,B.jsxs)(`span`,{className:`oc-composer__agent-instance`,title:Bl({instance:y.instanceName}),children:[(0,B.jsx)(Ub,{size:11,"aria-hidden":!0}),y.instanceName]}):null,(0,B.jsx)(Ay,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})}),(0,B.jsxs)(_F,{align:`start`,className:`oc-composer__agent-pop p-0`,children:[(0,B.jsx)(TF,{autoFocus:!0,value:l,onChange:e=>u(e.target.value),placeholder:Cd(),"aria-label":j(),className:`oc-agentpicker__search`}),(0,B.jsx)(`div`,{className:`oc-agentpicker__list`,role:`listbox`,children:f.map(e=>(0,B.jsxs)(`div`,{className:`oc-agentpicker__group`,children:[(0,B.jsxs)(`div`,{className:`oc-agentpicker__instance`,children:[(0,B.jsx)(Ub,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e.instanceName}),(0,B.jsx)(YF,{variant:`outline`,className:`oc-agentpicker__kind`,children:e.kind})]}),e.agents.map(e=>{let t=I3(m,{instanceName:e.instanceName,agentId:e.agentId});return(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,className:`oc-agentpicker__item${t?` is-selected`:``}`,disabled:e.state===`deleted`,title:e.state===`deleted`?Bd():void 0,onClick:()=>{v(e),c(!1),u(``)},children:[(0,B.jsx)(Ey,{size:15,"aria-hidden":!0,className:`oc-agentpicker__icon`}),(0,B.jsxs)(`span`,{className:`oc-agentpicker__main`,children:[(0,B.jsxs)(`span`,{className:`oc-agentpicker__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.description?(0,B.jsx)(`span`,{className:`oc-agentpicker__desc`,children:e.description}):null]}),e.model?(0,B.jsx)(`span`,{className:`oc-agentpicker__model`,children:e.model}):null,t?(0,B.jsx)(ky,{size:14,"aria-hidden":!0,className:`oc-agentpicker__default`}):null]},`${e.instanceName}/${e.agentId}`)})]},e.instanceName))})]})]})}function mTe(e){let t=(0,z.useContext)(t8),n=uO(),r=qF(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(``),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useRef)(e);u.current=e;let d=(0,z.useSyncExternalStore)(px,mx),f=d!==null&&d.targetChatId===e.chatId;(0,z.useEffect)(()=>()=>{c.current?.stop(),c.current=null,a(!1),s(``)},[e.chatId]);let p=(0,z.useCallback)(()=>{requestAnimationFrame(()=>{let t=e.rootRef.current?.querySelector(`.oc-composer__input`);t&&(t.scrollTop=t.scrollHeight)})},[]),m=Ex(t.lang,Jd()),h=(0,z.useRef)(m);h.current=m;let g=(0,z.useRef)(e.voiceInput);g.current=e.voiceInput;let _=(0,z.useCallback)(()=>{let e=mx();e!==null&&e.targetChatId===u.current.chatId&&wx(),c.current?.stop(),c.current=null,a(!1),s(``)},[]),v=(0,z.useCallback)(()=>{if(!Mx()){r.error(bi());return}let e=mx();if(e!==null&&e.targetChatId!==u.current.chatId&&e.recording){r.error($p());return}let t=u.current.chatId,i={h:null,boundToHold:!1};l.current=i;let o=Nx({lang:m,onText:(e,r)=>{if(i.holdGen!==void 0&&i.holdGen!==_x())return;let a=mx();if(a!==null&&a.targetChatId===t){if(vx(e,r.paragraph),u.current.chatId===t){let e=mx();e!==null&&(n.setText(e.text),p())}return}if(u.current.chatId!==t)return;let o=n.getState().text;n.setText(Tx(o,e,r.paragraph)),p()},onInterim:e=>{if(i.holdGen!==void 0&&i.holdGen!==_x())return;let n=mx();n!==null&&n.targetChatId===t&&yx(e),s(e)},onEnd:()=>{i.boundToHold&&Cx(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``))},onError:e=>{i.boundToHold&&Cx(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``),e===`not-allowed`||e===`service-not-allowed`?r.error(ta()):e!==`no-speech`&&e!==`aborted`&&r.error(ti({code:e})))}});if(o===null){r.error(bi());return}i.h=o;let d=mx();if(d!==null&&d.targetChatId===t){i.boundToHold=!0,gx(()=>o.stop()),i.holdGen=_x(),a(!0);return}c.current=o,a(!0)},[m,r]),y=(0,z.useCallback)(()=>{if(n.getState().attachments.length>0||Vxe()){r.error(fd());return}let e=c.current;Ane({targetChatId:u.current.chatId,targetLabel:u.current.chatTitle,text:n.getState().text,voiceEnabled:g.current,voiceLang:h.current,recording:e!==null,...e===null?{}:{stop:()=>e.stop()}})&&(e!==null&&l.current?.h===e&&(l.current.boundToHold=!0,l.current.holdGen=_x()),c.current=null,a(!1),s(``),n.setText(``))},[r]);return{recording:i||f&&d!==null&&d.recording,interim:f&&d!==null?d.interim:o,held:f,canPin:d===null,pinned:d!==null,pinnedHere:f,pinnedLabel:d?.targetLabel??``,pinnedTargetChatId:d?.targetChatId??null,pendingSend:f?d?.pendingSend??null:null,pendingSendId:f?d?.pendingSendId??0:0,pendingRestore:f?d?.pendingRestore??null:null,start:v,stop:_,hold:y}}function hTe({recording:e,onStart:t,onStop:n}){let r=I(L.me.getMe,{host:d3})?.dictationShortcut??null,i=(0,z.useRef)(()=>{});(0,z.useEffect)(()=>{if(!r)return;let e=e=>{e.repeat||IF(e,r)&&(e.preventDefault(),i.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=r?` (${FF(r,PF())})`:``;return(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon${e?` oc-composer__icon--rec`:``}`,title:(e?Ot():Pn())+a,"aria-label":e?Ot():Pn(),"aria-pressed":e,ref:e=>{i.current=()=>e?.click()},onClick:()=>e?n():t(),children:(0,B.jsx)(xb,{size:18,"aria-hidden":!0})})}function gTe({chatId:e,chatTitle:t=``,showTools:n,onToggleTools:r,unavailable:i=!1,agentGate:a,subAgentBusy:o=!1}){let{can:s,loading:c,resolved:l}=b6(e),u=c||!l||s(`inboundAttachments`),d=o8().voiceInput,f=M3(),p=p8(),m=p?.selected??null,h=m?B3(p?.pool??[],m)?.displayName??m.agentId:N3(f),g=KCe({turnRunning:fO(e=>e.isRunning),hasRunningSubAgent:o}),_=g.mode===`queue`,v=(0,z.useContext)(c8),y=uO(),b=sa(),x=(0,z.useRef)(null),S=Nv(),C=mTe({chatId:e,chatTitle:t===``?h:t,voiceInput:d,rootRef:x}),[w,T]=(0,z.useState)(!1),E=C.pendingSendId,D=qF(),O=(0,z.useRef)(0);(0,z.useEffect)(()=>{if(E===0||O.current===E)return;O.current=E;let e=mx(),t=e?.pendingSend??``,n=e?.holdId??-1;if(Nne(),i){xx(n),D.error(Du());return}if(t.trim()===``){Pne(n);return}_&&v!==null?v(t).then(e=>{e?mx()?.holdId===n&&(wx(),y.setText(``)):xx(n)}):mx()?.holdId===n&&(wx(),y.setText(t),y.send())},[E]);let k=C.pendingRestore;(0,z.useEffect)(()=>{k!==null&&(y.setText(k),Fne(),wx())},[k]),(0,z.useEffect)(()=>{if(!w)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),T(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[w]);let A=(0,z.useContext)(N1);(0,z.useEffect)(()=>{if(A!==null)return A.current={canAttach:u&&!_&&!C.pinned,attachFile:e=>C.pinned?Promise.resolve():(te(e=>e+1),y.addAttachment(e).then(()=>{P(``),requestAnimationFrame(()=>P(ii()))}).finally(()=>te(e=>Math.max(0,e-1)))),insertText:e=>{let t=y.getState();y.setText(t.text+e),P(``),requestAnimationFrame(()=>P(kd()))}},()=>{A.current=null}},[A,u,_,y,C.pinned]);let ee=(0,z.useRef)(1),j=qF(),[M,te]=(0,z.useState)(0),[N,P]=(0,z.useState)(``),ne=M>0,[re,ie]=(0,z.useState)(!1),ae=(0,B.jsxs)(B.Fragment,{children:[w?(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__backdrop`,"aria-label":_p(),onClick:()=>T(!1)}):null,(0,B.jsxs)(LP.Root,{ref:x,className:`oc-composer${i?` oc-composer--disabled`:``}${C.recording?` oc-composer--dictation`:``}${w?` oc-composer--expanded`:``}`,children:[w?(0,B.jsxs)(`div`,{className:`oc-composer__exphead`,children:[(0,B.jsx)(`span`,{className:`oc-composer__exptitle`,children:vl()}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__expclose`,title:_p(),onClick:()=>T(!1),children:[(0,B.jsx)(Sb,{size:15,"aria-hidden":!0}),_p()]})]}):null,(0,B.jsx)(cTe,{chatId:e}),(0,B.jsx)(`div`,{className:`oc-attachrow`,children:(0,B.jsx)(LP.Attachments,{components:{Attachment:lTe}})}),(0,B.jsx)(`span`,{className:`oc-sr-only`,role:`status`,"aria-live":`polite`,children:N}),(0,B.jsx)(uTe,{}),(0,B.jsx)(LP.Input,{className:`oc-composer__input`,placeholder:i?Du():Bu({name:h}),autoFocus:!0,rows:1,disabled:i,onKeyDownCapture:e=>{if((ne||re)&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation();return}if(!_||v===null||e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing)return;e.preventDefault(),e.stopPropagation();let t=y.getState().text;t.trim()!==``&&v(t).then(e=>{e&&y.setText(``)})},onPaste:e=>{if((e.clipboardData?.files?.length??0)>0)return;let t=e.clipboardData?.getData(`text/plain`)??``;if(!t)return;let n=UCe(t);if(n!==null&&u&&!_){e.preventDefault();let r=e.currentTarget,i=r.selectionStart??null,a=r.selectionEnd??null,o=y.getState().text,s=()=>{let e=y.getState();e.text===o&&i!==null&&a!==null?y.setText(o.slice(0,i)+t+o.slice(a)):y.setText(e.text+t)};te(e=>e+1),b.query(L.chatExport.exportByReference,{reference:n}).then(e=>{let t=e;if(t===null){s();return}let n=new File([t.markdown],t.filename,{type:`text/markdown; charset=utf-8`});return F1(n),y.addAttachment(n).then(()=>{P(``),requestAnimationFrame(()=>P(be()))})}).catch(()=>{s(),j.error(Zee())}).finally(()=>te(e=>Math.max(0,e-1)));return}let r=_he(t,ee.current);if(r.kind!==`file`||!u)return;if(e.preventDefault(),_){j.error(xi());return}ee.current+=1;let i=new File([t],r.filename??`texte-colle.txt`,{type:`text/plain; charset=utf-8`});F1(i),te(e=>e+1),y.addAttachment(i).then(()=>{P(``),requestAnimationFrame(()=>P(Dd({lines:String(r.lines)})))}).catch(e=>{console.error(`[paste] attachment routing failed:`,e),j.error(ni())}).finally(()=>te(e=>Math.max(0,e-1)))},autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`}),C.recording&&C.interim!==``?(0,B.jsxs)(`div`,{className:`oc-composer__interim`,"aria-hidden":!0,children:[(0,B.jsx)(`span`,{className:`oc-composer__interim-dot`}),C.interim]}):null,(0,B.jsxs)(`div`,{className:`oc-composer__bar`,children:[(0,B.jsxs)(`div`,{className:`oc-composer__group`,children:[u?(0,B.jsx)(LP.AddAttachment,{className:`oc-composer__icon`,"aria-label":df(),disabled:_||i,children:(0,B.jsx)(Ib,{size:18,"aria-hidden":!0})}):null,w?null:(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__tools${n?` is-on`:``}`,onClick:r,"aria-pressed":n,title:n?Gf():Gc(),children:[(0,B.jsx)(Gb,{size:15,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-composer__tools-label`,children:nd()})]}),(0,B.jsx)(pTe,{chatId:e,gate:a,rebinding:re,onRebindingChange:ie})]}),(0,B.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,B.jsx)(`span`,{className:`oc-composer__voiceslot${C.canPin||C.held?` is-shown`:``}`,"aria-hidden":!C.canPin&&!C.held,children:C.held?(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__heldchip`,title:Rr(),"aria-label":Rr(),onClick:()=>wx(),children:[(0,B.jsx)(Nb,{size:12,"aria-hidden":!0}),Cu(),(0,B.jsx)(xh,{size:11,"aria-hidden":!0})]}):(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon oc-composer__hold`,title:gh(),"aria-label":gh(),onClick:C.hold,disabled:!C.canPin||ne||re,tabIndex:!C.canPin||ne||re?-1:0,children:(0,B.jsx)(Nb,{size:16,"aria-hidden":!0})})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon${w?` is-on`:``}`,title:w?_p():Cf(),"aria-label":w?_p():Cf(),"aria-pressed":w,onClick:()=>T(e=>!e),children:w?(0,B.jsx)(Sb,{size:16,"aria-hidden":!0}):(0,B.jsx)(gb,{size:16,"aria-hidden":!0})}),d?(0,B.jsx)(hTe,{recording:C.recording,onStart:C.start,onStop:C.stop}):null,!c&&l&&s(`talk`)?(0,B.jsx)(eSe,{chatId:e}):null,i?(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!0,"aria-label":vm(),children:(0,B.jsx)(xy,{size:18,"aria-hidden":!0})}):g.mode===`queue`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(fTe,{}),(0,B.jsx)(dTe,{reason:g.reason})]}):(0,B.jsx)(LP.Send,{className:`oc-composer__send`,"aria-label":au(),disabled:ne||re,children:(0,B.jsx)(xy,{size:18,"aria-hidden":!0})})]})]})]})]});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Zwe,{}),C.pinned?(0,B.jsxs)(`div`,{className:`oc-composer__pinnednote`,role:`note`,children:[(0,B.jsx)(Nb,{size:14,"aria-hidden":!0}),C.pinnedHere?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:Xm()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>Sx(),children:Vc()})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:Ru({chat:C.pinnedLabel||Nl()})}),C.pinnedTargetChatId?(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>{S({to:`/chat/$chatId`,params:{chatId:C.pinnedTargetChatId}})},children:Qu()}):null]})]}):w?(0,Fv.createPortal)(ae,document.body):ae]})}var A8=67324752,j8=33639248,M8=101010256,N8=0,P8=2048,F8=class extends Error{reason;constructor(e,t){super(t===void 0?e:`${e}: ${t}`),this.reason=e,this.name=`ZipError`}},_Te=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function I8(e){let t=4294967295;for(let n of e)t=_Te[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function vTe(e){if(e.length>65535)throw new F8(`too_many_entries`,String(e.length));let t=new TextEncoder,n=[],r=[],i=0;for(let a of e){let e=t.encode(a.name),o=I8(a.bytes),s=new Uint8Array(30+e.length),c=new DataView(s.buffer);c.setUint32(0,A8,!0),c.setUint16(4,20,!0),c.setUint16(6,P8,!0),c.setUint16(8,N8,!0),c.setUint16(10,0,!0),c.setUint16(12,33,!0),c.setUint32(14,o,!0),c.setUint32(18,a.bytes.length,!0),c.setUint32(22,a.bytes.length,!0),c.setUint16(26,e.length,!0),c.setUint16(28,0,!0),s.set(e,30);let l=new Uint8Array(46+e.length),u=new DataView(l.buffer);u.setUint32(0,j8,!0),u.setUint16(4,20,!0),u.setUint16(6,20,!0),u.setUint16(8,P8,!0),u.setUint16(10,N8,!0),u.setUint16(12,0,!0),u.setUint16(14,33,!0),u.setUint32(16,o,!0),u.setUint32(20,a.bytes.length,!0),u.setUint32(24,a.bytes.length,!0),u.setUint16(28,e.length,!0),u.setUint32(42,i,!0),l.set(e,46),n.push(s,a.bytes),r.push(l),i+=s.length+a.bytes.length}let a=r.reduce((e,t)=>e+t.length,0),o=new Uint8Array(22),s=new DataView(o.buffer);s.setUint32(0,M8,!0),s.setUint16(8,e.length,!0),s.setUint16(10,e.length,!0),s.setUint32(12,a,!0),s.setUint32(16,i,!0);let c=n.reduce((e,t)=>e+t.length,0)+a+22,l=new Uint8Array(c),u=0;for(let e of[...n,...r,o])l.set(e,u),u+=e.length;return l}function yTe(e){let t=new DataView(e.buffer,e.byteOffset,e.length),n=new TextDecoder,r=-1;for(let n=e.length-22;n>=0;--n)if(t.getUint32(n,!0)===M8){r=n;break}if(r===-1)throw new F8(`not_a_zip`);let i=t.getUint16(r+10,!0),a=t.getUint32(r+16,!0),o=[];for(let r=0;r<i;r+=1){if(a+46>e.length||t.getUint32(a,!0)!==j8)throw new F8(`corrupt`,`central directory`);let r=t.getUint16(a+8,!0),i=t.getUint16(a+10,!0),s=t.getUint32(a+16,!0),c=t.getUint32(a+24,!0),l=t.getUint16(a+28,!0),u=t.getUint16(a+30,!0),d=t.getUint16(a+32,!0),f=t.getUint32(a+42,!0),p=n.decode(e.subarray(a+46,a+46+l));if(i!==N8)throw new F8(`unsupported_method`,p);if((r&P8)===0)throw new F8(`unsupported_encoding`,p);if(f+30>e.length||t.getUint32(f,!0)!==A8)throw new F8(`corrupt`,p);let m=t.getUint16(f+26,!0),h=t.getUint16(f+28,!0),g=f+30+m+h;if(g+c>e.length)throw new F8(`corrupt`,p);let _=e.slice(g,g+c);if(I8(_)!==s)throw new F8(`checksum_mismatch`,p);o.push({name:p,bytes:_}),a+=46+l+u+d}return o}var L8=`manifest.json`,R8=`chats/`,bTe=`sections/`,z8=`blobs/`,xTe=512*1024*1024,STe=1e4,CTe=76,wTe=600*1e3;function TTe(e,t){return e.filter(e=>t-e.updatedAt>wTe)}var ETe=class extends Error{bytes;constructor(e){super(`archive exceeds ${xTe} bytes`),this.bytes=e,this.name=`ArchiveTooLarge`}};async function B8(e,t,n){let r=new TextEncoder,i=await e.manifest(),a=[],o=0,s=0,c=0,l=new Set,u=(e,t)=>{if(o+=t.length+CTe+2*e.length,o>536870912)throw new ETe(o);a.push({name:e,bytes:t})},d=[];for(let a of t){let t=await e.chat(a);u(`${R8}${a}.json`,r.encode(JSON.stringify(t)));for(let t of i.sections){let i=null,o=0;do{let f=await e.section(a,t,i);f.rows.length>0&&u(`${bTe}${a}/${t}/${o}.json`,r.encode(JSON.stringify(f.rows)));for(let t of f.blobs){if(t.url===null){d.push(t.key);continue}l.has(t.key)||(l.add(t.key),u(`${z8}${t.key}`,await e.blob(t.url)),s+=1,n?.({phase:`blobs`,done:s,total:null}))}i=f.cursor,o+=1,c+=1,n?.({phase:`sections`,done:c,total:null})}while(i!==null&&o<1e4);if(i!==null)throw Error(`export of ${t} did not finish within ${STe} pages`)}}return n?.({phase:`packing`,done:a.length,total:a.length}),a.unshift({name:L8,bytes:r.encode(JSON.stringify({...i,missingBlobs:d}))}),{archive:vTe(a),manifest:i,blobCount:s,missingBlobs:d}}async function DTe(e,t,n,r){let i=new TextDecoder,a=yTe(t);r?.({phase:`reading`,done:a.length,total:a.length});let o=new Map(a.map(e=>[e.name,e.bytes])).get(L8);if(o===void 0)throw Error(`archive has no manifest`);let s=JSON.parse(i.decode(o)),c=await e.begin({formatVersion:s.formatVersion,origin:s.origin??null},n),l=0,u=!1,d=new Map,f=new Set;try{let t=a.filter(e=>e.name.startsWith(z8)).length;for(let n of a){if(!n.name.startsWith(`blobs/`))continue;let i=n.name.slice(6);if(d.has(i))throw Error(`archive names the same blob twice: ${i}`);let a=await e.upload(n.bytes,i);await e.registerBlob(c,a),d.set(i,a),r?.({phase:`uploading`,done:d.size,total:t})}let n=a.filter(e=>e.name.startsWith(R8));for(let t of n){let n=JSON.parse(i.decode(t.bytes)),r=await e.batch(c,`chats`,[n],V8([n],d));l+=r.written,H8([n],r.writtenIds,f)}for(let t of s.sections){let n=a.filter(e=>e.name.startsWith(`sections/`)&&e.name.includes(`/${t}/`)).sort((e,t)=>U8(e.name)-U8(t.name));for(let a of n){let n=JSON.parse(i.decode(a.bytes)),o=await e.batch(c,t,n,V8(n,d));l+=o.written,r?.({phase:`writing`,done:l,total:null}),H8(n,o.writtenIds,f)}}for(let[t,n]of d)f.has(t)||await e.discardUpload(c,n);let o=Math.ceil(l/100)+100;for(let t=0;t<o&&!u;t+=1)u=(await e.finish(c)).done}catch(t){try{let t=!1;for(let n=0;n<1e4&&!t;n+=1)t=(await e.abandon(c)).done;for(let t of d.values())await e.discardUpload(c,t)}catch{}throw t}return{importId:c,written:l,purged:u}}function V8(e,t){let n=new Set;for(let t of e){let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let r=t.archiveBlobKeys;if(Array.isArray(r))for(let e of r)typeof e==`string`&&n.add(e)}let r=[];for(let e of n){let n=t.get(e);n!==void 0&&r.push({key:e,storageId:n})}return r}function H8(e,t,n){let r=new Set(t);for(let t of e){if(typeof t._id!=`string`||!r.has(t._id))continue;let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let i=t.archiveBlobKeys;if(Array.isArray(i))for(let e of i)typeof e==`string`&&n.add(e)}}function U8(e){let t=/\/(\d+)\.json$/.exec(e);return t===null?0:Number(t[1])}function W8(e){return`atrium-${e.normalize(`NFKD`).replace(/[^\p{Letter}\p{Number}]+/gu,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}.zip`}function G8(e,t){let n=URL.createObjectURL(new Blob([e],{type:`application/zip`})),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),6e4)}function OTe(){let e=sa(),[t,n]=(0,z.useState)({running:!1,progress:null}),r=(0,z.useRef)(!1),i=(0,z.useCallback)(()=>({manifest:()=>e.action(L.archiveExport.exportManifest,{}),chat:t=>e.query(L.archiveExport.exportChat,{chatId:t}),section:(t,n,r)=>e.query(L.archiveExport.exportChatSection,{chatId:t,section:n,cursor:r}),blob:async e=>{let t=await fetch(e);if(!t.ok)throw Error(`attachment could not be read (${t.status})`);return new Uint8Array(await t.arrayBuffer())}}),[e]),a=(0,z.useCallback)(()=>({begin:(t,n)=>e.mutation(L.archiveImport.beginImport,{manifest:t,targetProjectId:n??null}),batch:(t,n,r,i)=>e.mutation(L.archiveImport.importBatch,{importId:t,section:n,rows:r,blobs:i.map(e=>({key:e.key,storageId:e.storageId}))}),finish:t=>e.mutation(L.archiveImport.finishImport,{importId:t}),abandon:t=>e.mutation(L.archiveImport.abandonImport,{importId:t}),upload:async t=>{let n=await e.mutation(L.chats.generateUploadUrl,{}),{storageId:r}=await(await fetch(n,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:new Blob([t])})).json();return await e.mutation(L.uploads.registerUpload,{storageId:r}),r},registerBlob:async(t,n)=>{await e.mutation(L.archiveImport.registerImportBlob,{importId:t,storageId:n})},discardUpload:async(t,n)=>{await e.mutation(L.archiveImport.discardUpload,{importId:t,storageId:n})}}),[e]),o=(0,z.useCallback)(async e=>{if(r.current)throw Error(`a transfer is already running`);r.current=!0,n({running:!0,progress:null});try{return await e(e=>n({running:!0,progress:e}))}finally{r.current=!1,n({running:!1,progress:null})}},[]),s=(0,z.useCallback)((e,t)=>o(async n=>{let{archive:r,missingBlobs:a}=await B8(i(),e,n);return G8(r,W8(t)),{missingBlobs:a}}),[o,i]),c=(0,z.useCallback)((t,n)=>o(async r=>{let a=await e.query(L.archiveExport.exportFolderTree,{projectId:t});if(!a.complete)throw Error(`folder_too_large`);let o=[];for(let t of a.folders){let n=null;do{let r=await e.query(L.archiveExport.exportFolderChats,{projectId:t._id,cursor:n});o.push(...r.chatIds),n=r.cursor}while(n!==null)}let{archive:s,missingBlobs:c}=await B8(i(),o,r);return G8(s,W8(n)),{missingBlobs:c,chatCount:o.length}}),[e,o,i]),l=(0,z.useCallback)((e,t)=>o(async n=>{if(e.size>536870912)throw Error(`archive_too_large`);return DTe(a(),new Uint8Array(await e.arrayBuffer()),t,n)}),[o,a]);return(0,z.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await e.query(L.archiveImport.listOpenImports,{});for(let r of TTe(n,Date.now())){let n=!1;for(let i=0;i<1e3&&!n&&!t;i+=1)n=(await e.mutation(L.archiveImport.abandonImport,{importId:r.importId})).done}}catch{}})(),()=>{t=!0}},[e]),{state:t,exportChats:s,exportFolder:c,importArchive:l}}var K8=(0,z.createContext)(null);function kTe({children:e}){let t=OTe(),n=qF(),r=(e,t)=>{let r=e instanceof Error?e.message:String(e);if(r.includes(`folder_too_large`)){n.error(Go());return}if(r.includes(`already running`)){n.error(oe());return}if(r.includes(`archive_too_large`)){n.error(bn());return}if(r.includes(`not_a_zip`)||r.includes(`no manifest`)){n.error(Tr());return}n.error(t,e)},i={state:t.state,exportChat:(e,i)=>{t.exportChats([e],i).then(({missingBlobs:e})=>{e.length>0?n.error(ls({count:e.length})):n.success(Pt())}).catch(e=>r(e,Ea()))},exportFolder:(e,i)=>{t.exportFolder(e,i).then(({missingBlobs:e})=>{e.length>0?n.error(ls({count:e.length})):n.success(Pt())}).catch(e=>r(e,Ea()))},importArchive:(e,i)=>{t.importArchive(e,i).then(({written:e,purged:t})=>{n.success(Do({count:e}),t?void 0:en())}).catch(e=>r(e,Vee()))}},a={...i,pickAndImport:e=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`.zip,application/zip`,t.addEventListener(`change`,()=>{let n=t.files?.[0];n!==void 0&&i.importArchive(n,e)}),t.click()}};return(0,B.jsx)(K8.Provider,{value:a,children:e})}function q8(){return(0,z.useContext)(K8)}function ATe(e){if(!e.running)return null;let t=e.progress;if(t===null)return Ks();switch(t.phase){case`sections`:return dc({count:t.done});case`blobs`:return ks({count:t.done});case`packing`:return Ks();case`reading`:return zn({count:t.done});case`uploading`:return bp({done:t.done,total:t.total??t.done});case`writing`:return ar({count:t.done})}}function jTe(e,t){return e===null?t:`${e}-${t}`}function MTe(){var e=[...arguments];return(0,z.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var J8=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Y8(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function X8(e){return`nodeType`in e}function Z8(e){return e?Y8(e)?e:X8(e)?e.ownerDocument?.defaultView??window:window:window}function Q8(e){let{Document:t}=Z8(e);return e instanceof t}function $8(e){return Y8(e)?!1:e instanceof Z8(e).HTMLElement}function e5(e){return e instanceof Z8(e).SVGElement}function t5(e){return e?Y8(e)?e.document:X8(e)?Q8(e)?e:$8(e)||e5(e)?e.ownerDocument:document:document:document}var n5=J8?z.useLayoutEffect:z.useEffect;function r5(e){let t=(0,z.useRef)(e);return n5(()=>{t.current=e}),(0,z.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function NTe(){let e=(0,z.useRef)(null);return[(0,z.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,z.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function i5(e,t){t===void 0&&(t=[e]);let n=(0,z.useRef)(e);return n5(()=>{n.current!==e&&(n.current=e)},t),n}function a5(e,t){let n=(0,z.useRef)();return(0,z.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function o5(e){let t=r5(e),n=(0,z.useRef)(null);return[n,(0,z.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function s5(e){let t=(0,z.useRef)();return(0,z.useEffect)(()=>{t.current=e},[e]),t.current}var c5={};function l5(e,t){return(0,z.useMemo)(()=>{if(t)return t;let n=c5[e]==null?0:c5[e]+1;return c5[e]=n,e+`-`+n},[e,t])}function u5(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var d5=u5(1),f5=u5(-1);function PTe(e){return`clientX`in e&&`clientY`in e}function p5(e){if(!e)return!1;let{KeyboardEvent:t}=Z8(e.target);return t&&e instanceof t}function FTe(e){if(!e)return!1;let{TouchEvent:t}=Z8(e.target);return t&&e instanceof t}function m5(e){if(FTe(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return PTe(e)?{x:e.clientX,y:e.clientY}:null}var h5=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[h5.Translate.toString(e),h5.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),g5=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function ITe(e){return e.matches(g5)?e:e.querySelector(g5)}var LTe={display:`none`};function RTe(e){let{id:t,value:n}=e;return z.createElement(`div`,{id:t,style:LTe},n)}function zTe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return z.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function BTe(){let[e,t]=(0,z.useState)(``);return{announce:(0,z.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var _5=(0,z.createContext)(null);function VTe(e){let t=(0,z.useContext)(_5);(0,z.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function HTe(){let[e]=(0,z.useState)(()=>new Set),t=(0,z.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,z.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var UTe={draggable:`
|
|
320
|
+
`+eee():n)}).catch(()=>{d.current===e&&u(null)})}},children:(0,B.jsx)(Xy,{size:13,"aria-hidden":!0})}):null,(0,B.jsx)(qN.Remove,{className:`oc-attach__remove`,"aria-label":Em(),children:(0,B.jsx)(xh,{size:13,"aria-hidden":!0})}),(0,B.jsx)(d0,{open:s,onOpenChange:c,children:(0,B.jsxs)(f0,{className:`oc-attach__dialog`,children:[(0,B.jsx)(p0,{children:(0,B.jsx)(h0,{className:`oc-attach__dialog-title`,children:n?.name??Xd()})}),r?(0,B.jsx)(`img`,{src:r,alt:``,className:`oc-attach__dialog-img`}):l===null?(0,B.jsx)(`p`,{className:`oc-attach__dialog-text`,children:`…`}):(0,B.jsx)(`pre`,{className:`oc-attach__dialog-text`,children:l})]})})]})}function pTe(){let e=(0,z.useSyncExternalStore)(b3.subscribe,b3.getSnapshot);return e.active?(0,B.jsxs)(`div`,{className:`oc-upload`,role:`status`,"aria-live":`polite`,children:[(0,B.jsxs)(`div`,{className:`oc-upload__head`,children:[(0,B.jsx)(pb,{className:`oc-upload__spin`,size:14,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e.count>1?zl({count:e.count,percent:e.percent}):pu({percent:e.percent})})]}),(0,B.jsx)(`div`,{className:`oc-upload__track`,"aria-hidden":!0,children:(0,B.jsx)(`div`,{className:`oc-upload__bar`,style:{width:`${e.percent}%`}})})]}):null}function mTe({reason:e}){let t=(0,z.useContext)(c8),n=uO(),r=Eoe(e=>e.text).trim().length>0,i=e===`subagent`;return(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!r||t===null,"aria-label":i?Lt():Hn(),title:r?i?fs():Cp():i?cr():Ys(),onClick:()=>{if(t===null)return;let e=n.getState().text;e.trim()!==``&&t(e).then(e=>{e&&n.setText(``)})},children:(0,B.jsx)(xy,{size:18,"aria-hidden":!0})})}function hTe(){let e=(0,z.useContext)(u8);return e===null?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__send oc-composer__stop`,"aria-label":d(),title:da(),onClick:()=>void e(),children:(0,B.jsx)(Jb,{size:14,"aria-hidden":!0})})}function gTe({chatId:e,gate:t,rebinding:n=!1,onRebindingChange:r}){let i=p8(),a=Nt(L.chats.rebindChatAgent),o=JF(),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(``),d=i?.pool??[],f=(0,z.useMemo)(()=>P3(F3(d,l)),[d,l]),p=(0,z.useMemo)(()=>new Set(d.map(e=>e.instanceName)).size>1,[d]);if(!i||t.hidden)return null;let{selected:m,setSelected:h}=i,g=t.disabled||n,{mode:_}=t,v=t=>{if(_===`rebind`){r?.(!0),a({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).catch(()=>o.error(Jc())).finally(()=>r?.(!1));return}h({instanceName:t.instanceName,agentId:t.agentId})},y=m??(_===`rebind`?i.primary:null),b=B3(d,y),x=b?.displayName??y?.agentId??Qd();return(0,B.jsxs)(gF,{open:s,onOpenChange:e=>{g||c(e)},children:[(0,B.jsx)(_F,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__agent`,disabled:g,title:g?qf():_===`rebind`?Wp():El(),"aria-label":_===`rebind`?id():nee(),children:[b?.emoji?(0,B.jsx)(`span`,{className:`oc-composer__agent-emoji`,"aria-hidden":!0,children:b.emoji}):(0,B.jsx)(Ey,{size:15,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-composer__agent-name`,children:x}),p&&y?(0,B.jsxs)(`span`,{className:`oc-composer__agent-instance`,title:Bl({instance:y.instanceName}),children:[(0,B.jsx)(Ub,{size:11,"aria-hidden":!0}),y.instanceName]}):null,(0,B.jsx)(Ay,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})}),(0,B.jsxs)(vF,{align:`start`,className:`oc-composer__agent-pop p-0`,children:[(0,B.jsx)(EF,{autoFocus:!0,value:l,onChange:e=>u(e.target.value),placeholder:Cd(),"aria-label":j(),className:`oc-agentpicker__search`}),(0,B.jsx)(`div`,{className:`oc-agentpicker__list`,role:`listbox`,children:f.map(e=>(0,B.jsxs)(`div`,{className:`oc-agentpicker__group`,children:[(0,B.jsxs)(`div`,{className:`oc-agentpicker__instance`,children:[(0,B.jsx)(Ub,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e.instanceName}),(0,B.jsx)(XF,{variant:`outline`,className:`oc-agentpicker__kind`,children:e.kind})]}),e.agents.map(e=>{let t=I3(m,{instanceName:e.instanceName,agentId:e.agentId});return(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,className:`oc-agentpicker__item${t?` is-selected`:``}`,disabled:e.state===`deleted`,title:e.state===`deleted`?Bd():void 0,onClick:()=>{v(e),c(!1),u(``)},children:[(0,B.jsx)(Ey,{size:15,"aria-hidden":!0,className:`oc-agentpicker__icon`}),(0,B.jsxs)(`span`,{className:`oc-agentpicker__main`,children:[(0,B.jsxs)(`span`,{className:`oc-agentpicker__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.description?(0,B.jsx)(`span`,{className:`oc-agentpicker__desc`,children:e.description}):null]}),e.model?(0,B.jsx)(`span`,{className:`oc-agentpicker__model`,children:e.model}):null,t?(0,B.jsx)(ky,{size:14,"aria-hidden":!0,className:`oc-agentpicker__default`}):null]},`${e.instanceName}/${e.agentId}`)})]},e.instanceName))})]})]})}function _Te(e){let t=(0,z.useContext)(t8),n=uO(),r=JF(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(``),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useRef)(e);u.current=e;let d=(0,z.useSyncExternalStore)(px,mx),f=d!==null&&d.targetChatId===e.chatId;(0,z.useEffect)(()=>()=>{c.current?.stop(),c.current=null,a(!1),s(``)},[e.chatId]);let p=(0,z.useCallback)(()=>{requestAnimationFrame(()=>{let t=e.rootRef.current?.querySelector(`.oc-composer__input`);t&&(t.scrollTop=t.scrollHeight)})},[]),m=Ex(t.lang,Jd()),h=(0,z.useRef)(m);h.current=m;let g=(0,z.useRef)(e.voiceInput);g.current=e.voiceInput;let _=(0,z.useCallback)(()=>{let e=mx();e!==null&&e.targetChatId===u.current.chatId&&wx(),c.current?.stop(),c.current=null,a(!1),s(``)},[]),v=(0,z.useCallback)(()=>{if(!Mx()){r.error(bi());return}let e=mx();if(e!==null&&e.targetChatId!==u.current.chatId&&e.recording){r.error($p());return}let t=u.current.chatId,i={h:null,boundToHold:!1};l.current=i;let o=Nx({lang:m,onText:(e,r)=>{if(i.holdGen!==void 0&&i.holdGen!==_x())return;let a=mx();if(a!==null&&a.targetChatId===t){if(vx(e,r.paragraph),u.current.chatId===t){let e=mx();e!==null&&(n.setText(e.text),p())}return}if(u.current.chatId!==t)return;let o=n.getState().text;n.setText(Tx(o,e,r.paragraph)),p()},onInterim:e=>{if(i.holdGen!==void 0&&i.holdGen!==_x())return;let n=mx();n!==null&&n.targetChatId===t&&yx(e),s(e)},onEnd:()=>{i.boundToHold&&Cx(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``))},onError:e=>{i.boundToHold&&Cx(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``),e===`not-allowed`||e===`service-not-allowed`?r.error(ta()):e!==`no-speech`&&e!==`aborted`&&r.error(ti({code:e})))}});if(o===null){r.error(bi());return}i.h=o;let d=mx();if(d!==null&&d.targetChatId===t){i.boundToHold=!0,gx(()=>o.stop()),i.holdGen=_x(),a(!0);return}c.current=o,a(!0)},[m,r]),y=(0,z.useCallback)(()=>{if(n.getState().attachments.length>0||Vxe()){r.error(fd());return}let e=c.current;Ane({targetChatId:u.current.chatId,targetLabel:u.current.chatTitle,text:n.getState().text,voiceEnabled:g.current,voiceLang:h.current,recording:e!==null,...e===null?{}:{stop:()=>e.stop()}})&&(e!==null&&l.current?.h===e&&(l.current.boundToHold=!0,l.current.holdGen=_x()),c.current=null,a(!1),s(``),n.setText(``))},[r]);return{recording:i||f&&d!==null&&d.recording,interim:f&&d!==null?d.interim:o,held:f,canPin:d===null,pinned:d!==null,pinnedHere:f,pinnedLabel:d?.targetLabel??``,pinnedTargetChatId:d?.targetChatId??null,pendingSend:f?d?.pendingSend??null:null,pendingSendId:f?d?.pendingSendId??0:0,pendingRestore:f?d?.pendingRestore??null:null,start:v,stop:_,hold:y}}function vTe({recording:e,onStart:t,onStop:n}){let r=I(L.me.getMe,{host:d3})?.dictationShortcut??null,i=(0,z.useRef)(()=>{});(0,z.useEffect)(()=>{if(!r)return;let e=e=>{e.repeat||LF(e,r)&&(e.preventDefault(),i.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=r?` (${IF(r,FF())})`:``;return(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon${e?` oc-composer__icon--rec`:``}`,title:(e?Ot():Pn())+a,"aria-label":e?Ot():Pn(),"aria-pressed":e,ref:e=>{i.current=()=>e?.click()},onClick:()=>e?n():t(),children:(0,B.jsx)(xb,{size:18,"aria-hidden":!0})})}function yTe({chatId:e,chatTitle:t=``,showTools:n,onToggleTools:r,unavailable:i=!1,agentGate:a,subAgentBusy:o=!1}){let{can:s,loading:c,resolved:l}=b6(e),u=c||!l||s(`inboundAttachments`),d=o8().voiceInput,f=M3(),p=p8(),m=p?.selected??null,h=m?B3(p?.pool??[],m)?.displayName??m.agentId:N3(f),g=KCe({turnRunning:fO(e=>e.isRunning),hasRunningSubAgent:o}),_=g.mode===`queue`,v=(0,z.useContext)(c8),y=uO(),b=sa(),x=(0,z.useRef)(null),S=Nv(),C=_Te({chatId:e,chatTitle:t===``?h:t,voiceInput:d,rootRef:x}),[w,T]=(0,z.useState)(!1),E=C.pendingSendId,D=JF(),O=(0,z.useRef)(0);(0,z.useEffect)(()=>{if(E===0||O.current===E)return;O.current=E;let e=mx(),t=e?.pendingSend??``,n=e?.holdId??-1;if(Nne(),i){xx(n),D.error(Du());return}if(t.trim()===``){Pne(n);return}_&&v!==null?v(t).then(e=>{e?mx()?.holdId===n&&(wx(),y.setText(``)):xx(n)}):mx()?.holdId===n&&(wx(),y.setText(t),y.send())},[E]);let k=C.pendingRestore;(0,z.useEffect)(()=>{k!==null&&(y.setText(k),Fne(),wx())},[k]),(0,z.useEffect)(()=>{if(!w)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),T(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[w]);let A=(0,z.useContext)(N1);(0,z.useEffect)(()=>{if(A!==null)return A.current={canAttach:u&&!_&&!C.pinned,attachFile:e=>C.pinned?Promise.resolve():(te(e=>e+1),y.addAttachment(e).then(()=>{P(``),requestAnimationFrame(()=>P(ii()))}).finally(()=>te(e=>Math.max(0,e-1)))),insertText:e=>{let t=y.getState();y.setText(t.text+e),P(``),requestAnimationFrame(()=>P(kd()))}},()=>{A.current=null}},[A,u,_,y,C.pinned]);let ee=(0,z.useRef)(1),j=JF(),[M,te]=(0,z.useState)(0),[N,P]=(0,z.useState)(``),ne=M>0,[re,ie]=(0,z.useState)(!1),ae=(0,B.jsxs)(B.Fragment,{children:[w?(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__backdrop`,"aria-label":_p(),onClick:()=>T(!1)}):null,(0,B.jsxs)(RP.Root,{ref:x,className:`oc-composer${i?` oc-composer--disabled`:``}${C.recording?` oc-composer--dictation`:``}${w?` oc-composer--expanded`:``}`,children:[w?(0,B.jsxs)(`div`,{className:`oc-composer__exphead`,children:[(0,B.jsx)(`span`,{className:`oc-composer__exptitle`,children:vl()}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__expclose`,title:_p(),onClick:()=>T(!1),children:[(0,B.jsx)(Sb,{size:15,"aria-hidden":!0}),_p()]})]}):null,(0,B.jsx)(dTe,{chatId:e}),(0,B.jsx)(`div`,{className:`oc-attachrow`,children:(0,B.jsx)(RP.Attachments,{components:{Attachment:fTe}})}),(0,B.jsx)(`span`,{className:`oc-sr-only`,role:`status`,"aria-live":`polite`,children:N}),(0,B.jsx)(pTe,{}),(0,B.jsx)(RP.Input,{className:`oc-composer__input`,placeholder:i?Du():Bu({name:h}),autoFocus:!0,rows:1,disabled:i,onKeyDownCapture:e=>{if((ne||re)&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation();return}if(!_||v===null||e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing)return;e.preventDefault(),e.stopPropagation();let t=y.getState().text;t.trim()!==``&&v(t).then(e=>{e&&y.setText(``)})},onPaste:e=>{if((e.clipboardData?.files?.length??0)>0)return;let t=e.clipboardData?.getData(`text/plain`)??``;if(!t)return;let n=UCe(t);if(n!==null&&u&&!_){e.preventDefault();let r=e.currentTarget,i=r.selectionStart??null,a=r.selectionEnd??null,o=y.getState().text,s=()=>{let e=y.getState();e.text===o&&i!==null&&a!==null?y.setText(o.slice(0,i)+t+o.slice(a)):y.setText(e.text+t)};te(e=>e+1),b.query(L.chatExport.exportByReference,{reference:n}).then(e=>{let t=e;if(t===null){s();return}let n=new File([t.markdown],t.filename,{type:`text/markdown; charset=utf-8`});return F1(n),y.addAttachment(n).then(()=>{P(``),requestAnimationFrame(()=>P(be()))})}).catch(()=>{s(),j.error(Zee())}).finally(()=>te(e=>Math.max(0,e-1)));return}let r=_he(t,ee.current);if(r.kind!==`file`||!u)return;if(e.preventDefault(),_){j.error(xi());return}ee.current+=1;let i=new File([t],r.filename??`texte-colle.txt`,{type:`text/plain; charset=utf-8`});F1(i),te(e=>e+1),y.addAttachment(i).then(()=>{P(``),requestAnimationFrame(()=>P(Dd({lines:String(r.lines)})))}).catch(e=>{console.error(`[paste] attachment routing failed:`,e),j.error(ni())}).finally(()=>te(e=>Math.max(0,e-1)))},autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`}),C.recording&&C.interim!==``?(0,B.jsxs)(`div`,{className:`oc-composer__interim`,"aria-hidden":!0,children:[(0,B.jsx)(`span`,{className:`oc-composer__interim-dot`}),C.interim]}):null,(0,B.jsxs)(`div`,{className:`oc-composer__bar`,children:[(0,B.jsxs)(`div`,{className:`oc-composer__group`,children:[u?(0,B.jsx)(RP.AddAttachment,{className:`oc-composer__icon`,"aria-label":df(),disabled:_||i,children:(0,B.jsx)(Ib,{size:18,"aria-hidden":!0})}):null,w?null:(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__tools${n?` is-on`:``}`,onClick:r,"aria-pressed":n,title:n?Gf():Gc(),children:[(0,B.jsx)(Gb,{size:15,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-composer__tools-label`,children:nd()})]}),(0,B.jsx)(gTe,{chatId:e,gate:a,rebinding:re,onRebindingChange:ie})]}),(0,B.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,B.jsx)(`span`,{className:`oc-composer__voiceslot${C.canPin||C.held?` is-shown`:``}`,"aria-hidden":!C.canPin&&!C.held,children:C.held?(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__heldchip`,title:Rr(),"aria-label":Rr(),onClick:()=>wx(),children:[(0,B.jsx)(Nb,{size:12,"aria-hidden":!0}),Cu(),(0,B.jsx)(xh,{size:11,"aria-hidden":!0})]}):(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon oc-composer__hold`,title:gh(),"aria-label":gh(),onClick:C.hold,disabled:!C.canPin||ne||re,tabIndex:!C.canPin||ne||re?-1:0,children:(0,B.jsx)(Nb,{size:16,"aria-hidden":!0})})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon${w?` is-on`:``}`,title:w?_p():Cf(),"aria-label":w?_p():Cf(),"aria-pressed":w,onClick:()=>T(e=>!e),children:w?(0,B.jsx)(Sb,{size:16,"aria-hidden":!0}):(0,B.jsx)(gb,{size:16,"aria-hidden":!0})}),d?(0,B.jsx)(vTe,{recording:C.recording,onStart:C.start,onStop:C.stop}):null,!c&&l&&s(`talk`)?(0,B.jsx)(eSe,{chatId:e}):null,i?(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!0,"aria-label":vm(),children:(0,B.jsx)(xy,{size:18,"aria-hidden":!0})}):g.mode===`queue`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(hTe,{}),(0,B.jsx)(mTe,{reason:g.reason})]}):(0,B.jsx)(RP.Send,{className:`oc-composer__send`,"aria-label":au(),disabled:ne||re,children:(0,B.jsx)(xy,{size:18,"aria-hidden":!0})})]})]})]})]});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(eTe,{}),C.pinned?(0,B.jsxs)(`div`,{className:`oc-composer__pinnednote`,role:`note`,children:[(0,B.jsx)(Nb,{size:14,"aria-hidden":!0}),C.pinnedHere?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:Xm()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>Sx(),children:Vc()})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:Ru({chat:C.pinnedLabel||Nl()})}),C.pinnedTargetChatId?(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>{S({to:`/chat/$chatId`,params:{chatId:C.pinnedTargetChatId}})},children:Qu()}):null]})]}):w?(0,Fv.createPortal)(ae,document.body):ae]})}var A8=67324752,j8=33639248,M8=101010256,N8=0,P8=2048,F8=class extends Error{reason;constructor(e,t){super(t===void 0?e:`${e}: ${t}`),this.reason=e,this.name=`ZipError`}},bTe=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function I8(e){let t=4294967295;for(let n of e)t=bTe[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function xTe(e){if(e.length>65535)throw new F8(`too_many_entries`,String(e.length));let t=new TextEncoder,n=[],r=[],i=0;for(let a of e){let e=t.encode(a.name),o=I8(a.bytes),s=new Uint8Array(30+e.length),c=new DataView(s.buffer);c.setUint32(0,A8,!0),c.setUint16(4,20,!0),c.setUint16(6,P8,!0),c.setUint16(8,N8,!0),c.setUint16(10,0,!0),c.setUint16(12,33,!0),c.setUint32(14,o,!0),c.setUint32(18,a.bytes.length,!0),c.setUint32(22,a.bytes.length,!0),c.setUint16(26,e.length,!0),c.setUint16(28,0,!0),s.set(e,30);let l=new Uint8Array(46+e.length),u=new DataView(l.buffer);u.setUint32(0,j8,!0),u.setUint16(4,20,!0),u.setUint16(6,20,!0),u.setUint16(8,P8,!0),u.setUint16(10,N8,!0),u.setUint16(12,0,!0),u.setUint16(14,33,!0),u.setUint32(16,o,!0),u.setUint32(20,a.bytes.length,!0),u.setUint32(24,a.bytes.length,!0),u.setUint16(28,e.length,!0),u.setUint32(42,i,!0),l.set(e,46),n.push(s,a.bytes),r.push(l),i+=s.length+a.bytes.length}let a=r.reduce((e,t)=>e+t.length,0),o=new Uint8Array(22),s=new DataView(o.buffer);s.setUint32(0,M8,!0),s.setUint16(8,e.length,!0),s.setUint16(10,e.length,!0),s.setUint32(12,a,!0),s.setUint32(16,i,!0);let c=n.reduce((e,t)=>e+t.length,0)+a+22,l=new Uint8Array(c),u=0;for(let e of[...n,...r,o])l.set(e,u),u+=e.length;return l}function STe(e){let t=new DataView(e.buffer,e.byteOffset,e.length),n=new TextDecoder,r=-1;for(let n=e.length-22;n>=0;--n)if(t.getUint32(n,!0)===M8){r=n;break}if(r===-1)throw new F8(`not_a_zip`);let i=t.getUint16(r+10,!0),a=t.getUint32(r+16,!0),o=[];for(let r=0;r<i;r+=1){if(a+46>e.length||t.getUint32(a,!0)!==j8)throw new F8(`corrupt`,`central directory`);let r=t.getUint16(a+8,!0),i=t.getUint16(a+10,!0),s=t.getUint32(a+16,!0),c=t.getUint32(a+24,!0),l=t.getUint16(a+28,!0),u=t.getUint16(a+30,!0),d=t.getUint16(a+32,!0),f=t.getUint32(a+42,!0),p=n.decode(e.subarray(a+46,a+46+l));if(i!==N8)throw new F8(`unsupported_method`,p);if((r&P8)===0)throw new F8(`unsupported_encoding`,p);if(f+30>e.length||t.getUint32(f,!0)!==A8)throw new F8(`corrupt`,p);let m=t.getUint16(f+26,!0),h=t.getUint16(f+28,!0),g=f+30+m+h;if(g+c>e.length)throw new F8(`corrupt`,p);let _=e.slice(g,g+c);if(I8(_)!==s)throw new F8(`checksum_mismatch`,p);o.push({name:p,bytes:_}),a+=46+l+u+d}return o}var L8=`manifest.json`,R8=`chats/`,CTe=`sections/`,z8=`blobs/`,wTe=512*1024*1024,TTe=1e4,ETe=76,DTe=600*1e3;function OTe(e,t){return e.filter(e=>t-e.updatedAt>DTe)}var kTe=class extends Error{bytes;constructor(e){super(`archive exceeds ${wTe} bytes`),this.bytes=e,this.name=`ArchiveTooLarge`}};async function B8(e,t,n){let r=new TextEncoder,i=await e.manifest(),a=[],o=0,s=0,c=0,l=new Set,u=(e,t)=>{if(o+=t.length+ETe+2*e.length,o>536870912)throw new kTe(o);a.push({name:e,bytes:t})},d=[];for(let a of t){let t=await e.chat(a);u(`${R8}${a}.json`,r.encode(JSON.stringify(t)));for(let t of i.sections){let i=null,o=0;do{let f=await e.section(a,t,i);f.rows.length>0&&u(`${CTe}${a}/${t}/${o}.json`,r.encode(JSON.stringify(f.rows)));for(let t of f.blobs){if(t.url===null){d.push(t.key);continue}l.has(t.key)||(l.add(t.key),u(`${z8}${t.key}`,await e.blob(t.url)),s+=1,n?.({phase:`blobs`,done:s,total:null}))}i=f.cursor,o+=1,c+=1,n?.({phase:`sections`,done:c,total:null})}while(i!==null&&o<1e4);if(i!==null)throw Error(`export of ${t} did not finish within ${TTe} pages`)}}return n?.({phase:`packing`,done:a.length,total:a.length}),a.unshift({name:L8,bytes:r.encode(JSON.stringify({...i,missingBlobs:d}))}),{archive:xTe(a),manifest:i,blobCount:s,missingBlobs:d}}async function ATe(e,t,n,r){let i=new TextDecoder,a=STe(t);r?.({phase:`reading`,done:a.length,total:a.length});let o=new Map(a.map(e=>[e.name,e.bytes])).get(L8);if(o===void 0)throw Error(`archive has no manifest`);let s=JSON.parse(i.decode(o)),c=await e.begin({formatVersion:s.formatVersion,origin:s.origin??null},n),l=0,u=!1,d=new Map,f=new Set;try{let t=a.filter(e=>e.name.startsWith(z8)).length;for(let n of a){if(!n.name.startsWith(`blobs/`))continue;let i=n.name.slice(6);if(d.has(i))throw Error(`archive names the same blob twice: ${i}`);let a=await e.upload(n.bytes,i);await e.registerBlob(c,a),d.set(i,a),r?.({phase:`uploading`,done:d.size,total:t})}let n=a.filter(e=>e.name.startsWith(R8));for(let t of n){let n=JSON.parse(i.decode(t.bytes)),r=await e.batch(c,`chats`,[n],V8([n],d));l+=r.written,H8([n],r.writtenIds,f)}for(let t of s.sections){let n=a.filter(e=>e.name.startsWith(`sections/`)&&e.name.includes(`/${t}/`)).sort((e,t)=>U8(e.name)-U8(t.name));for(let a of n){let n=JSON.parse(i.decode(a.bytes)),o=await e.batch(c,t,n,V8(n,d));l+=o.written,r?.({phase:`writing`,done:l,total:null}),H8(n,o.writtenIds,f)}}for(let[t,n]of d)f.has(t)||await e.discardUpload(c,n);let o=Math.ceil(l/100)+100;for(let t=0;t<o&&!u;t+=1)u=(await e.finish(c)).done}catch(t){try{let t=!1;for(let n=0;n<1e4&&!t;n+=1)t=(await e.abandon(c)).done;for(let t of d.values())await e.discardUpload(c,t)}catch{}throw t}return{importId:c,written:l,purged:u}}function V8(e,t){let n=new Set;for(let t of e){let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let r=t.archiveBlobKeys;if(Array.isArray(r))for(let e of r)typeof e==`string`&&n.add(e)}let r=[];for(let e of n){let n=t.get(e);n!==void 0&&r.push({key:e,storageId:n})}return r}function H8(e,t,n){let r=new Set(t);for(let t of e){if(typeof t._id!=`string`||!r.has(t._id))continue;let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let i=t.archiveBlobKeys;if(Array.isArray(i))for(let e of i)typeof e==`string`&&n.add(e)}}function U8(e){let t=/\/(\d+)\.json$/.exec(e);return t===null?0:Number(t[1])}function W8(e){return`atrium-${e.normalize(`NFKD`).replace(/[^\p{Letter}\p{Number}]+/gu,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}.zip`}function G8(e,t){let n=URL.createObjectURL(new Blob([e],{type:`application/zip`})),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),6e4)}function jTe(){let e=sa(),[t,n]=(0,z.useState)({running:!1,progress:null}),r=(0,z.useRef)(!1),i=(0,z.useCallback)(()=>({manifest:()=>e.action(L.archiveExport.exportManifest,{}),chat:t=>e.query(L.archiveExport.exportChat,{chatId:t}),section:(t,n,r)=>e.query(L.archiveExport.exportChatSection,{chatId:t,section:n,cursor:r}),blob:async e=>{let t=await fetch(e);if(!t.ok)throw Error(`attachment could not be read (${t.status})`);return new Uint8Array(await t.arrayBuffer())}}),[e]),a=(0,z.useCallback)(()=>({begin:(t,n)=>e.mutation(L.archiveImport.beginImport,{manifest:t,targetProjectId:n??null}),batch:(t,n,r,i)=>e.mutation(L.archiveImport.importBatch,{importId:t,section:n,rows:r,blobs:i.map(e=>({key:e.key,storageId:e.storageId}))}),finish:t=>e.mutation(L.archiveImport.finishImport,{importId:t}),abandon:t=>e.mutation(L.archiveImport.abandonImport,{importId:t}),upload:async t=>{let n=await e.mutation(L.chats.generateUploadUrl,{}),{storageId:r}=await(await fetch(n,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:new Blob([t])})).json();return await e.mutation(L.uploads.registerUpload,{storageId:r}),r},registerBlob:async(t,n)=>{await e.mutation(L.archiveImport.registerImportBlob,{importId:t,storageId:n})},discardUpload:async(t,n)=>{await e.mutation(L.archiveImport.discardUpload,{importId:t,storageId:n})}}),[e]),o=(0,z.useCallback)(async e=>{if(r.current)throw Error(`a transfer is already running`);r.current=!0,n({running:!0,progress:null});try{return await e(e=>n({running:!0,progress:e}))}finally{r.current=!1,n({running:!1,progress:null})}},[]),s=(0,z.useCallback)((e,t)=>o(async n=>{let{archive:r,missingBlobs:a}=await B8(i(),e,n);return G8(r,W8(t)),{missingBlobs:a}}),[o,i]),c=(0,z.useCallback)((t,n)=>o(async r=>{let a=await e.query(L.archiveExport.exportFolderTree,{projectId:t});if(!a.complete)throw Error(`folder_too_large`);let o=[];for(let t of a.folders){let n=null;do{let r=await e.query(L.archiveExport.exportFolderChats,{projectId:t._id,cursor:n});o.push(...r.chatIds),n=r.cursor}while(n!==null)}let{archive:s,missingBlobs:c}=await B8(i(),o,r);return G8(s,W8(n)),{missingBlobs:c,chatCount:o.length}}),[e,o,i]),l=(0,z.useCallback)((e,t)=>o(async n=>{if(e.size>536870912)throw Error(`archive_too_large`);return ATe(a(),new Uint8Array(await e.arrayBuffer()),t,n)}),[o,a]);return(0,z.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await e.query(L.archiveImport.listOpenImports,{});for(let r of OTe(n,Date.now())){let n=!1;for(let i=0;i<1e3&&!n&&!t;i+=1)n=(await e.mutation(L.archiveImport.abandonImport,{importId:r.importId})).done}}catch{}})(),()=>{t=!0}},[e]),{state:t,exportChats:s,exportFolder:c,importArchive:l}}var K8=(0,z.createContext)(null);function MTe({children:e}){let t=jTe(),n=JF(),r=(e,t)=>{let r=e instanceof Error?e.message:String(e);if(r.includes(`folder_too_large`)){n.error(Go());return}if(r.includes(`already running`)){n.error(oe());return}if(r.includes(`archive_too_large`)){n.error(bn());return}if(r.includes(`not_a_zip`)||r.includes(`no manifest`)){n.error(Tr());return}n.error(t,e)},i={state:t.state,exportChat:(e,i)=>{t.exportChats([e],i).then(({missingBlobs:e})=>{e.length>0?n.error(ls({count:e.length})):n.success(Pt())}).catch(e=>r(e,Ea()))},exportFolder:(e,i)=>{t.exportFolder(e,i).then(({missingBlobs:e})=>{e.length>0?n.error(ls({count:e.length})):n.success(Pt())}).catch(e=>r(e,Ea()))},importArchive:(e,i)=>{t.importArchive(e,i).then(({written:e,purged:t})=>{n.success(Do({count:e}),t?void 0:en())}).catch(e=>r(e,Vee()))}},a={...i,pickAndImport:e=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`.zip,application/zip`,t.addEventListener(`change`,()=>{let n=t.files?.[0];n!==void 0&&i.importArchive(n,e)}),t.click()}};return(0,B.jsx)(K8.Provider,{value:a,children:e})}function q8(){return(0,z.useContext)(K8)}function NTe(e){if(!e.running)return null;let t=e.progress;if(t===null)return Ks();switch(t.phase){case`sections`:return dc({count:t.done});case`blobs`:return ks({count:t.done});case`packing`:return Ks();case`reading`:return zn({count:t.done});case`uploading`:return bp({done:t.done,total:t.total??t.done});case`writing`:return ar({count:t.done})}}function PTe(e,t){return e===null?t:`${e}-${t}`}function FTe(){var e=[...arguments];return(0,z.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var J8=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Y8(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function X8(e){return`nodeType`in e}function Z8(e){return e?Y8(e)?e:X8(e)?e.ownerDocument?.defaultView??window:window:window}function Q8(e){let{Document:t}=Z8(e);return e instanceof t}function $8(e){return Y8(e)?!1:e instanceof Z8(e).HTMLElement}function e5(e){return e instanceof Z8(e).SVGElement}function t5(e){return e?Y8(e)?e.document:X8(e)?Q8(e)?e:$8(e)||e5(e)?e.ownerDocument:document:document:document}var n5=J8?z.useLayoutEffect:z.useEffect;function r5(e){let t=(0,z.useRef)(e);return n5(()=>{t.current=e}),(0,z.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function ITe(){let e=(0,z.useRef)(null);return[(0,z.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,z.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function i5(e,t){t===void 0&&(t=[e]);let n=(0,z.useRef)(e);return n5(()=>{n.current!==e&&(n.current=e)},t),n}function a5(e,t){let n=(0,z.useRef)();return(0,z.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function o5(e){let t=r5(e),n=(0,z.useRef)(null);return[n,(0,z.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function s5(e){let t=(0,z.useRef)();return(0,z.useEffect)(()=>{t.current=e},[e]),t.current}var c5={};function l5(e,t){return(0,z.useMemo)(()=>{if(t)return t;let n=c5[e]==null?0:c5[e]+1;return c5[e]=n,e+`-`+n},[e,t])}function u5(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var d5=u5(1),f5=u5(-1);function LTe(e){return`clientX`in e&&`clientY`in e}function p5(e){if(!e)return!1;let{KeyboardEvent:t}=Z8(e.target);return t&&e instanceof t}function RTe(e){if(!e)return!1;let{TouchEvent:t}=Z8(e.target);return t&&e instanceof t}function m5(e){if(RTe(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return LTe(e)?{x:e.clientX,y:e.clientY}:null}var h5=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[h5.Translate.toString(e),h5.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),g5=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function zTe(e){return e.matches(g5)?e:e.querySelector(g5)}var BTe={display:`none`};function VTe(e){let{id:t,value:n}=e;return z.createElement(`div`,{id:t,style:BTe},n)}function HTe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return z.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function UTe(){let[e,t]=(0,z.useState)(``);return{announce:(0,z.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var _5=(0,z.createContext)(null);function WTe(e){let t=(0,z.useContext)(_5);(0,z.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function GTe(){let[e]=(0,z.useState)(()=>new Set),t=(0,z.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,z.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var KTe={draggable:`
|
|
321
321
|
To pick up a draggable item, press the space bar.
|
|
322
322
|
While dragging, use the arrow keys to move the item.
|
|
323
323
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
324
|
-
`},WTe={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 GTe(e){let{announcements:t=WTe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=UTe}=e,{announce:a,announcement:o}=BTe(),s=l5(`DndLiveRegion`),[c,l]=(0,z.useState)(!1);if((0,z.useEffect)(()=>{l(!0)},[]),VTe((0,z.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=z.createElement(z.Fragment,null,z.createElement(RTe,{id:r,value:i.draggable}),z.createElement(zTe,{id:s,announcement:o}));return n?(0,Fv.createPortal)(u,n):u}var v5;(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`})(v5||={});function y5(){}function b5(e,t){return(0,z.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function x5(){var e=[...arguments];return(0,z.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var S5=Object.freeze({x:0,y:0});function C5(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function KTe(e,t){let n=m5(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 w5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function qTe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function T5(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 E5(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function D5(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 JTe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=D5(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=C5(D5(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(w5)},O5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=T5(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=T5(r),o=i.reduce((e,t,r)=>e+C5(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(w5)};function YTe(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 XTe=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=YTe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(qTe)};function ZTe(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var QTe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&ZTe(r,a)){let n=T5(a).reduce((e,t)=>e+C5(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(w5)};function $Te(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function k5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:S5}function eEe(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 tEe=eEe(1);function A5(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 nEe(e,t,n){let r=A5(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 rEe={ignoreTransform:!1};function j5(e,t){t===void 0&&(t=rEe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Z8(e).getComputedStyle(e);t&&(n=nEe(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 M5(e){return j5(e,{ignoreTransform:!0})}function iEe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function aEe(e,t){return t===void 0&&(t=Z8(e).getComputedStyle(e)),t.position===`fixed`}function oEe(e,t){t===void 0&&(t=Z8(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 N5(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Q8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!$8(i)||e5(i)||n.includes(i))return n;let a=Z8(e).getComputedStyle(i);return i!==e&&oEe(i,a)&&n.push(i),aEe(i,a)?n:r(i.parentNode)}return e?r(e):n}function P5(e){let[t]=N5(e,1);return t??null}function F5(e){return!J8||!e?null:Y8(e)?e:X8(e)?Q8(e)||e===t5(e).scrollingElement?window:$8(e)?e:null:null}function I5(e){return Y8(e)?e.scrollX:e.scrollLeft}function L5(e){return Y8(e)?e.scrollY:e.scrollTop}function R5(e){return{x:I5(e),y:L5(e)}}var z5;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(z5||={});function B5(e){return!J8||!e?!1:e===document.scrollingElement}function V5(e){let t={x:0,y:0},n=B5(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 sEe={x:.2,y:.2};function cEe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=sEe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=V5(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=z5.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=z5.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=z5.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=z5.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function lEe(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 H5(e){return e.reduce((e,t)=>d5(e,R5(t)),S5)}function uEe(e){return e.reduce((e,t)=>e+I5(t),0)}function dEe(e){return e.reduce((e,t)=>e+L5(t),0)}function U5(e,t){if(t===void 0&&(t=j5),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);P5(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var fEe=[[`x`,[`left`,`right`],uEe],[`y`,[`top`,`bottom`],dEe]],W5=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=N5(t),r=H5(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of fEe)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})}},G5=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 pEe(e){let{EventTarget:t}=Z8(e);return e instanceof t?e:t5(e)}function K5(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 q5;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(q5||={});function J5(e){e.preventDefault()}function mEe(e){e.stopPropagation()}var Y5;(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`})(Y5||={});var X5={start:[Y5.Space,Y5.Enter],cancel:[Y5.Esc],end:[Y5.Space,Y5.Enter,Y5.Tab]},hEe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Y5.Right:return{...n,x:n.x+25};case Y5.Left:return{...n,x:n.x-25};case Y5.Down:return{...n,y:n.y+25};case Y5.Up:return{...n,y:n.y-25}}},Z5=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 G5(t5(t)),this.windowListeners=new G5(Z8(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(q5.Resize,this.handleCancel),this.windowListeners.add(q5.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(q5.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&U5(n),t(S5)}handleKeyDown(e){if(p5(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=X5,coordinateGetter:a=hEe,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}:S5;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=f5(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}=V5(n),p=lEe(n),m={x:Math.min(i===Y5.Right?p.right-p.width/2:p.right,Math.max(i===Y5.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Y5.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Y5.Down?p.top:p.top+p.height/2,u.y))},h=i===Y5.Right&&!s||i===Y5.Left&&!c,g=i===Y5.Down&&!l||i===Y5.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Y5.Right&&e<=d.x||i===Y5.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Y5.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===Y5.Down&&e<=d.y||i===Y5.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Y5.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,d5(f5(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()}};Z5.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=X5,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 Q5(e){return!!(e&&`distance`in e)}function $5(e){return!!(e&&`delay`in e)}var e7=class{constructor(e,t,n){n===void 0&&(n=pEe(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=t5(i),this.documentListeners=new G5(this.document),this.listeners=new G5(n),this.windowListeners=new G5(Z8(i)),this.initialCoordinates=m5(r)??S5,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(q5.Resize,this.handleCancel),this.windowListeners.add(q5.DragStart,J5),this.windowListeners.add(q5.VisibilityChange,this.handleCancel),this.windowListeners.add(q5.ContextMenu,J5),this.documentListeners.add(q5.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($5(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Q5(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(q5.Click,mEe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(q5.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=m5(e)??S5,s=f5(n,o);if(!t&&a){if(Q5(a)){if(a.tolerance!=null&&K5(s,a.tolerance))return this.handleCancel();if(K5(s,a.distance))return this.handleStart()}if($5(a)&&K5(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===Y5.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},gEe={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},t7=class extends e7{constructor(e){let{event:t}=e,n=t5(t.target);super(e,gEe,n)}};t7.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 _Ee={move:{name:`mousemove`},end:{name:`mouseup`}},n7;(function(e){e[e.RightClick=2]=`RightClick`})(n7||={});var r7=class extends e7{constructor(e){super(e,_Ee,t5(e.event.target))}};r7.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===n7.RightClick?!1:(r?.({event:n}),!0)}}];var i7={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},a7=class extends e7{constructor(e){super(e,i7)}static setup(){return window.addEventListener(i7.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(i7.move.name,e)};function e(){}}};a7.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 o7;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(o7||={});var s7;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(s7||={});function vEe(e){let{acceleration:t,activator:n=o7.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=s7.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=bEe({delta:d,disabled:!a}),[m,h]=NTe(),g=(0,z.useRef)({x:0,y:0}),_=(0,z.useRef)({x:0,y:0}),v=(0,z.useMemo)(()=>{switch(n){case o7.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case o7.DraggableRect:return i}},[n,i,c]),y=(0,z.useRef)(null),b=(0,z.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,z.useMemo)(()=>s===s7.TreeOrder?[...l].reverse():l,[s,l]);(0,z.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=cEe(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 yEe={x:{[z5.Backward]:!1,[z5.Forward]:!1},y:{[z5.Backward]:!1,[z5.Forward]:!1}};function bEe(e){let{delta:t,disabled:n}=e,r=s5(t);return a5(e=>{if(n||!r||!e)return yEe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[z5.Backward]:e.x[z5.Backward]||i.x===-1,[z5.Forward]:e.x[z5.Forward]||i.x===1},y:{[z5.Backward]:e.y[z5.Backward]||i.y===-1,[z5.Forward]:e.y[z5.Forward]||i.y===1}}},[n,t,r])}function xEe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return a5(e=>t==null?null:r??e??null,[r,t])}function SEe(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var c7;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(c7||={});var l7;(function(e){e.Optimized=`optimized`})(l7||={});var u7=new Map;function CEe(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,z.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,z.useRef)(e),d=g(),f=i5(d),p=(0,z.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,z.useRef)(null),h=a5(t=>{if(d&&!n)return u7;if(!t||t===u7||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 W5(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,z.useEffect)(()=>{u.current=e},[e]),(0,z.useEffect)(()=>{d||p()},[n,d]),(0,z.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,z.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case c7.Always:return!1;case c7.BeforeDragging:return n;default:return!n}}}function d7(e,t){return a5(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function wEe(e,t){return d7(e,t)}function TEe(e){let{callback:t,disabled:n}=e,r=r5(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function f7(e){let{callback:t,disabled:n}=e,r=r5(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function EEe(e){return new W5(j5(e),e)}function p7(e,t,n){t===void 0&&(t=EEe);let[r,i]=(0,z.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=TEe({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=f7({callback:a});return n5(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function DEe(e){return k5(e,d7(e))}var m7=[];function OEe(e){let t=(0,z.useRef)(e),n=a5(n=>e?n&&n!==m7&&e&&t.current&&e.parentNode===t.current.parentNode?n:N5(e):m7,[e]);return(0,z.useEffect)(()=>{t.current=e},[e]),n}function kEe(e){let[t,n]=(0,z.useState)(null),r=(0,z.useRef)(e),i=(0,z.useCallback)(e=>{let t=F5(e.target);t&&n(e=>e?(e.set(t,R5(t)),new Map(e)):null)},[]);return(0,z.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=F5(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,R5(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=>{F5(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,z.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>d5(e,t),S5):H5(e):S5,[e,t])}function h7(e,t){t===void 0&&(t=[]);let n=(0,z.useRef)(null);return(0,z.useEffect)(()=>{n.current=null},t),(0,z.useEffect)(()=>{let t=e!==S5;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?f5(e,n.current):S5}function AEe(e){(0,z.useEffect)(()=>{if(!J8)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 jEe(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function g7(e){return(0,z.useMemo)(()=>e?iEe(e):null,[e])}var _7=[];function MEe(e,t){t===void 0&&(t=j5);let[n]=e,r=g7(n?Z8(n):null),[i,a]=(0,z.useState)(_7);function o(){a(()=>e.length?e.map(e=>B5(e)?r:new W5(t(e),e)):_7)}let s=f7({callback:o});return n5(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function v7(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return $8(t)?t:e}function NEe(e){let{measure:t}=e,[n,r]=(0,z.useState)(null),i=f7({callback:(0,z.useCallback)(e=>{for(let{target:n}of e)if($8(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=o5((0,z.useCallback)(e=>{let n=v7(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,z.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var PEe=[{sensor:t7,options:{}},{sensor:Z5,options:{}}],FEe={current:{}},y7={draggable:{measure:M5},droppable:{measure:M5,strategy:c7.WhileDragging,frequency:l7.Optimized},dragOverlay:{measure:j5}},b7=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}},IEe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new b7,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:y5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:y7,measureDroppableContainers:y5,windowRect:null,measuringScheduled:!1},x7={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:y5,draggableNodes:new Map,over:null,measureDroppableContainers:y5},S7=(0,z.createContext)(x7),C7=(0,z.createContext)(IEe);function LEe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new b7}}}function REe(e,t){switch(t.type){case v5.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case v5.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 v5.DragEnd:case v5.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case v5.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new b7(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case v5.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 b7(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case v5.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new b7(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function zEe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,z.useContext)(S7),a=s5(r),o=s5(n?.id);return(0,z.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!p5(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=ITe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function w7(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function BEe(e){return(0,z.useMemo)(()=>({draggable:{...y7.draggable,...e?.draggable},droppable:{...y7.droppable,...e?.droppable},dragOverlay:{...y7.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function VEe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,z.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;n5(()=>{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=k5(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=P5(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var T7=(0,z.createContext)({...S5,scaleX:1,scaleY:1}),E7;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(E7||={});var D7=(0,z.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=PEe,collisionDetection:o=XTe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,z.useReducer)(REe,void 0,LEe),[f,p]=HTe(),[m,h]=(0,z.useState)(E7.Uninitialized),g=m===E7.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,z.useRef)({initial:null,translated:null}),C=(0,z.useMemo)(()=>_==null?null:{id:_,data:x?.data??FEe,rect:S},[_,x]),w=(0,z.useRef)(null),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),k=i5(l,Object.values(l)),A=l5(`DndDescribedBy`,t),ee=(0,z.useMemo)(()=>b.getEnabled(),[b]),j=BEe(s),{droppableRects:M,measureDroppableContainers:te,measuringScheduled:N}=CEe(ee,{dragging:g,dependencies:[y.x,y.y],config:j.droppable}),P=xEe(v,_),ne=(0,z.useMemo)(()=>D?m5(D):null,[D]),re=Pe(),ie=wEe(P,j.draggable.measure);VEe({activeNode:_==null?null:v.get(_),config:re.layoutShiftCompensation,initialRect:ie,measure:j.draggable.measure});let ae=p7(P,j.draggable.measure,ie),oe=p7(P?P.parentElement:null),se=(0,z.useRef)({activatorEvent:null,active:null,activeNode:P,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=b.getNodeFor(se.current.over?.id),le=NEe({measure:j.dragOverlay.measure}),ue=le.nodeRef.current??P,de=g?le.rect??ae:null,fe=!!(le.nodeRef.current&&le.rect),pe=DEe(fe?null:ae),me=g7(ue?Z8(ue):null),he=OEe(g?ce??P:null),ge=MEe(he),_e=w7(c,{transform:{x:y.x-pe.x,y:y.y-pe.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:de,over:se.current.over,overlayNodeRect:le.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=ne?d5(ne,y):null,ye=kEe(he),be=h7(ye),xe=h7(ye,[ae]),Se=d5(_e,be),Ce=de?tEe(de,_e):null,we=C&&Ce?o({active:C,collisionRect:Ce,droppableRects:M,droppableContainers:ee,pointerCoordinates:ve}):null,Te=E5(we,`id`),[Ee,De]=(0,z.useState)(null),Oe=$Te(fe?_e:d5(_e,xe),Ee?.rect??null,ae),ke=(0,z.useRef)(null),Ae=(0,z.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;ke.current=new n({active:w.current,activeNode:i,event:a,options:r,context:se,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Fv.unstable_batchedUpdates)(()=>{r?.(i),h(E7.Initializing),d({type:v5.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(ke.current),O(a)})},onMove(e){d({type:v5.DragMove,coordinates:e})},onEnd:o(v5.DragEnd),onCancel:o(v5.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=se.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===v5.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=v5.DragCancel)}w.current=null,(0,Fv.unstable_batchedUpdates)(()=>{d({type:e}),h(E7.Uninitialized),De(null),E(null),O(null),ke.current=null;let t=e===v5.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),je=SEe(a,(0,z.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Ae(n,t))},[v,Ae]));AEe(a),n5(()=>{ae&&m===E7.Initializing&&h(E7.Initialized)},[ae,m]),(0,z.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=se.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:Se.x,y:Se.y},over:i};(0,Fv.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[Se.x,Se.y]),(0,z.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=se.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Te),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Fv.unstable_batchedUpdates)(()=>{De(s),a?.(c),f({type:`onDragOver`,event:c})})},[Te]),n5(()=>{se.current={activatorEvent:D,active:C,activeNode:P,collisionRect:Ce,collisions:we,droppableRects:M,draggableNodes:v,draggingNode:ue,draggingNodeRect:de,droppableContainers:b,over:Ee,scrollableAncestors:he,scrollAdjustedTranslate:Se},S.current={initial:de,translated:Ce}},[C,P,we,Ce,v,ue,de,M,b,Ee,he,Se]),vEe({...re,delta:y,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Me=(0,z.useMemo)(()=>({active:C,activeNode:P,activeNodeRect:ae,activatorEvent:D,collisions:we,containerNodeRect:oe,dragOverlay:le,draggableNodes:v,droppableContainers:b,droppableRects:M,over:Ee,measureDroppableContainers:te,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:j,measuringScheduled:N,windowRect:me}),[C,P,ae,D,we,oe,le,v,b,M,Ee,te,he,ge,j,N,me]),Ne=(0,z.useMemo)(()=>({activatorEvent:D,activators:je,active:C,activeNodeRect:ae,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:Ee,measureDroppableContainers:te}),[D,je,C,ae,d,A,v,Ee,te]);return z.createElement(_5.Provider,{value:p},z.createElement(S7.Provider,{value:Ne},z.createElement(C7.Provider,{value:Me},z.createElement(T7.Provider,{value:Oe},i)),z.createElement(zEe,{disabled:n?.restoreFocus===!1})),z.createElement(GTe,{...n,hiddenTextDescribedById:A}));function Pe(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),HEe=(0,z.createContext)(null),O7=`button`,UEe=`Draggable`;function WEe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=l5(UEe),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,z.useContext)(S7),{role:p=O7,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,z.useContext)(g?T7:HEe),[v,y]=o5(),[b,x]=o5(),S=jEe(o,t),C=i5(n);return n5(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,z.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===O7?!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 k7(){return(0,z.useContext)(C7)}var GEe=`Droppable`,KEe={timeout:25};function A7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=l5(GEe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,z.useContext)(S7),u=(0,z.useRef)({disabled:n}),d=(0,z.useRef)(!1),f=(0,z.useRef)(null),p=(0,z.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...KEe,...i},_=i5(h??r),v=f7({callback:(0,z.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=o5((0,z.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=i5(t);return(0,z.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,z.useEffect)(()=>(s({type:v5.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:v5.UnregisterDroppable,key:a,id:r})),[r]),(0,z.useEffect)(()=>{n!==u.current.disabled&&(s({type:v5.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 qEe(e){let{animation:t,children:n}=e,[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(null),s=s5(n);return!n&&!r&&s&&i(s),n5(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),z.createElement(z.Fragment,null,n,r?(0,z.cloneElement)(r,{ref:o}):null)}var JEe={x:0,y:0,scaleX:1,scaleY:1};function YEe(e){let{children:t}=e;return z.createElement(S7.Provider,{value:x7},z.createElement(T7.Provider,{value:JEe},t))}var XEe={position:`fixed`,touchAction:`none`},ZEe=e=>p5(e)?`transform 250ms ease`:void 0,QEe=(0,z.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=ZEe}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...XEe,width:s.width,height:s.height,top:s.top,left:s.left,transform:h5.Transform.toString(d),transformOrigin:i&&r?KTe(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return z.createElement(n,{className:o,style:f,ref:t},a)}),$Ee={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:h5.Transform.toString(t)},{transform:h5.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 eDe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return r5((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=v7(a);if(!c)return;let{transform:l}=Z8(a).getComputedStyle(a),u=A5(l);if(!u)return;let d=typeof t==`function`?t:tDe(t);return U5(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 tDe(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...$Ee,...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 j7=0;function nDe(e){return(0,z.useMemo)(()=>{if(e!=null)return j7++,j7},[e])}var M7=z.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=k7(),S=(0,z.useContext)(T7),C=nDe(d?.id),w=w7(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=d7(f),E=eDe({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return z.createElement(YEe,null,z.createElement(qEe,{animation:E},d&&C?z.createElement(QEe,{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))}),rDe=e=>{let{transform:t}=e;return{...t,y:0}};function iDe(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 aDe=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:iDe(n,t,i)},oDe=e=>{let{transform:t}=e;return{...t,x:0}};function N7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function sDe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function P7(e){return e!==null&&e>=0}function cDe(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 lDe(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var F7={scaleX:1,scaleY:1},uDe=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=dDe(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,...F7}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...F7}:a<r&&a>=i?{x:o.width+s,y:0,...F7}:{x:0,y:0,...F7}};function dDe(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 I7=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=N7(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}},L7={scaleX:1,scaleY:1},R7=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,...L7}:null}let s=fDe(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...L7}:r<t&&r>=a?{x:0,y:o.height+s,...L7}:{x:0,y:0,...L7}};function fDe(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 z7=`Sortable`,B7=z.createContext({activeIndex:-1,containerId:z7,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:I7,disabled:{draggable:!1,droppable:!1}});function V7(e){let{children:t,id:n,items:r,strategy:i=I7,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=k7(),d=l5(z7,n),f=s.rect!==null,p=(0,z.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,z.useRef)(p),v=!cDe(p,_.current),y=g!==-1&&h===-1||v,b=lDe(a);n5(()=>{v&&m&&u(p)},[v,p,m,u]),(0,z.useEffect)(()=>{_.current=p},[p]);let x=(0,z.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:sDe(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return z.createElement(B7.Provider,{value:x},t)}var pDe=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return N7(n,r,i).indexOf(t)},mDe=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},hDe={duration:200,easing:`ease`},H7=`transform`,gDe=h5.Transition.toString({property:H7,duration:0,easing:`linear`}),_De={roleDescription:`sortable`};function vDe(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,z.useState)(null),s=(0,z.useRef)(n);return n5(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=j5(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,z.useEffect)(()=>{a&&o(null)},[a]),a}function U7(e){let{animateLayoutChanges:t=mDe,attributes:n,disabled:r,data:i,getNewIndex:a=pDe,id:o,strategy:s,resizeObserverConfig:c,transition:l=hDe}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,z.useContext)(B7),y=yDe(r,p),b=u.indexOf(o),x=(0,z.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,z.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=A7({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:ee,listeners:j,isDragging:M,over:te,setActivatorNodeRef:N,transform:P}=WEe({id:o,data:x,attributes:{..._De,...n},disabled:y.draggable}),ne=MTe(E,ee),re=!!D,ie=re&&!m&&P7(f)&&P7(g),ae=!_&&M,oe=ie?(ae&&ie?P:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,se=P7(f)&&P7(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ce=D?.id,le=(0,z.useRef)({activeId:ce,items:u,newIndex:se,containerId:d}),ue=u!==le.current.items,de=t({active:D,containerId:d,isDragging:M,isSorting:re,id:o,index:b,items:u,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),fe=vDe({disabled:!de,index:b,node:w,rect:C});return(0,z.useEffect)(()=>{re&&le.current.newIndex!==se&&(le.current.newIndex=se),d!==le.current.containerId&&(le.current.containerId=d),u!==le.current.items&&(le.current.items=u)},[re,se,d,u]),(0,z.useEffect)(()=>{if(ce===le.current.activeId)return;if(ce!=null&&le.current.activeId==null){le.current.activeId=ce;return}let e=setTimeout(()=>{le.current.activeId=ce},50);return()=>clearTimeout(e)},[ce]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:se,items:u,isOver:T,isSorting:re,isDragging:M,listeners:j,node:w,overIndex:g,over:te,setNodeRef:ne,setActivatorNodeRef:N,setDroppableNodeRef:E,setDraggableNodeRef:ee,transform:fe??oe,transition:pe()};function pe(){if(fe||ue&&le.current.newIndex===b)return gDe;if(!(ae&&!p5(O)||!l)&&(re||de))return h5.Transition.toString({...l,property:H7})}}function yDe(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function W7(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 bDe=[Y5.Down,Y5.Right,Y5.Up,Y5.Left],G7=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(bDe.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 Y5.Down:r.top<a.top&&t.push(n);break;case Y5.Up:r.top>a.top&&t.push(n);break;case Y5.Left:r.left>a.left&&t.push(n);break;case Y5.Right:r.left<a.left&&t.push(n);break}});let c=O5({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=E5(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=N5(c).some((e,t)=>s[t]!==e),i=K7(e,t),a=xDe(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:f5(u,l)}}}};function K7(e,t){return!W7(e)||!W7(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function xDe(e,t){return!W7(e)||!W7(t)||!K7(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function q7({open:e,onOpenChange:t,title:n,description:r,children:i,onSubmit:a,submitLabel:o,submitting:s=!1,canSubmit:c=!0}){let[l,u]=(0,z.useState)(!1),d=s||l;async function f(){if(!(!c||d))try{u(!0),await a()}finally{u(!1)}}return(0,B.jsx)(N6,{open:e,onOpenChange:t,children:(0,B.jsxs)(P6,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,B.jsxs)(F6,{className:`border-b px-6 py-4`,children:[(0,B.jsx)(L6,{children:n}),r?(0,B.jsx)(R6,{children:r}):null]}),(0,B.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,B.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:i}),(0,B.jsxs)(I6,{className:`border-t px-6 py-4`,children:[(0,B.jsxs)(Ih,{type:`submit`,disabled:!c||d,children:[d?(0,B.jsx)(pb,{className:`size-4 animate-spin`}):null,o??ju()]}),(0,B.jsx)(Ih,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:Wu()})]})]})]})})}var J7=[{value:`red`,hue:`var(--oc-accent-red, oklch(0.63 0.21 25))`},{value:`orange`,hue:`var(--oc-accent-orange, oklch(0.7 0.17 50))`},{value:`amber`,hue:`var(--oc-accent-amber, oklch(0.8 0.15 85))`},{value:`green`,hue:`var(--oc-accent-green, oklch(0.7 0.16 150))`},{value:`teal`,hue:`var(--oc-accent-teal, oklch(0.7 0.12 190))`},{value:`blue`,hue:`var(--oc-accent-blue, oklch(0.62 0.19 250))`},{value:`violet`,hue:`var(--oc-accent-violet, oklch(0.6 0.2 300))`},{value:`pink`,hue:`var(--oc-accent-pink, oklch(0.7 0.2 350))`}],Y7=e=>J7.find(t=>t.value===e)?.hue??null;function SDe(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return J7[t%J7.length].hue}var X7=e=>Y7(e.color)??SDe(e._id);function Z7({open:e,onOpenChange:t,title:n,movingFolderId:r,currentId:i,onPick:a}){let o=I(L.projects.listProjects,e?{}:`skip`),[s,c]=(0,z.useState)(``),l=(0,z.useMemo)(()=>{let e=o??[],t=Nxe(e),n=s.trim().toLowerCase();return(n===``?t:t.filter(e=>e.node.name.toLowerCase().includes(n))).map(t=>({...t,disabled:r!==void 0&&!l3(e,r,t.node._id)}))},[o,s,r]),u=()=>{t(!1),c(``)};return(0,B.jsx)(d0,{open:e,onOpenChange:e=>{e||c(``),t(e)},children:(0,B.jsxs)(f0,{className:`oc-folderpick`,showCloseButton:!1,children:[(0,B.jsx)(p0,{children:(0,B.jsx)(h0,{children:n})}),(0,B.jsx)(TF,{autoFocus:!0,value:s,onChange:e=>c(e.target.value),placeholder:Yo()}),(0,B.jsxs)(`div`,{className:`oc-folderpick__list`,role:`listbox`,children:[(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i===null,className:`oc-folderpick__opt`,onClick:()=>{a(null),u()},children:[(0,B.jsx)(Uy,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:on()}),i===null?(0,B.jsx)(ky,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]}),l.length===0?(0,B.jsx)(`p`,{className:`oc-folderpick__empty`,children:ue()}):l.map(({node:e,depth:t,disabled:n})=>(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e._id===i,disabled:n,className:`oc-folderpick__opt`,style:{"--pick-depth":t-1,"--proj-hue":X7(e)},onClick:()=>{a(e._id),u()},children:[(0,B.jsx)(rb,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:e.name}),e._id===i?(0,B.jsx)(ky,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]},e._id))]})]})})}var Q7=6e4,$7=60*Q7,e9=24*$7,t9=7*e9,n9=30*e9,r9=365*e9;function i9(e,t){let n=t-e;if(n<Q7)return`maintenant`;if(n<$7)return`${Math.floor(n/Q7)}min`;if(n<e9)return`${Math.floor(n/$7)}h`;if(n<t9)return`${Math.floor(n/e9)}j`;if(n<n9)return`${Math.floor(n/t9)}sem`;if(n<r9)return`${Math.floor(n/n9)}mois`;let r=Math.floor(n/r9);return`${r}an${r>1?`s`:``}`}var a9=`project:none`,CDe=e=>`project:${e}`,o9=`projhead:`,s9=e=>`${o9}${e}`,c9=`oc.noproject.collapsed`;function l9(){return(0,B.jsx)(`div`,{className:`oc-sidebar__skeleton`,"aria-hidden":`true`,children:Array.from({length:7}).map((e,t)=>(0,B.jsx)(`div`,{className:`oc-skel oc-skel--row`},t))})}function wDe({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=I(L.messages.listChats,{}),a=I(L.projects.listProjects,{}),o=I(L.me.getMe,{host:d3})?.ui?.effective?.showChatAge??!0,s=I(L.chatReads.myChatReads,{}),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of s??[])e.set(t.chatId,t.lastSeenAt);return e},[s]),l=I(L.chatReads.myBusyChats,{}),u=(0,z.useMemo)(()=>new Set(l??[]),[l]),d=I(L.chatBookmarks.myBookmarkedChats,{}),f=I(L.chatExport.referenceLabel,{}),p=(0,z.useMemo)(()=>new Set(d??[]),[d]),m=(0,z.useMemo)(()=>{let t=new Set;for(let n of i??[]){if(n._id===e)continue;let r=c.get(n._id);r!==void 0&&n.lastAssistantAt!==null&&n.lastAssistantAt>r&&t.add(n._id)}return t},[i,c,e]),[h,g]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>g(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let _=Nt(L.projects.createProject),v=Nt(L.projects.setProjectCollapsed),y=Nt(L.projects.setProjectSidebar),b=Nt(L.chats.reorderChat),x=Nt(L.projects.reorderProject),S=Nt(L.chats.moveChatToProject),C=K3(),w=Qee(),T=(0,z.useRef)(null),E=(0,z.useRef)(null),D=(0,z.useRef)(null),[O,k]=(0,z.useState)(`full`);(0,z.useLayoutEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=E.current?.offsetWidth??0,r=D.current?.offsetWidth??0,i=n===0||t>=n?`full`:t>=r?`label`:`icon`;k(e=>e===i?e:i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[w,r]);let[A,ee]=(0,z.useState)(null),j=(0,z.useRef)(!1);(0,z.useEffect)(()=>{!j.current&&i&&ee(i)},[i]);let M=A??i??[],te=i===void 0&&A===null,[N,P]=(0,z.useState)(null),[ne,re]=(0,z.useState)(()=>localStorage.getItem(c9)===`1`);function ie(){re(e=>(localStorage.setItem(c9,e?`0`:`1`),!e))}let ae=$3();(0,z.useEffect)(()=>{if(!ae?.expand)return;let e=M.find(e=>e._id===ae.chatId);if(!e)return;let t=e.projectId??null;if(t===null){ne&&(localStorage.setItem(c9,`0`),re(!1));return}let n=(a??[]).find(e=>e._id===t);n&&n.parentId!==null||n?.collapsed&&v({projectId:t,collapsed:!1})},[ae,M,a,ne,v]);let oe=x5(b5(r7,{activationConstraint:{distance:4}}),b5(a7,{activationConstraint:{delay:250,tolerance:8}}),b5(Z5,{coordinateGetter:G7})),se=(0,z.useRef)(!1),ce=()=>{se.current=!0,setTimeout(()=>{se.current=!1},0)},le=(0,z.useCallback)(e=>String(e.active.id).startsWith(o9)?O5({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(o9))}):O5(e),[]),ue=M.filter(e=>e.pinned),de=M.filter(e=>!e.pinned),fe=e=>de.filter(t=>(t.projectId??null)===e),pe=Nv(),me=(0,z.useMemo)(()=>kxe(a??[]),[a]),he=(0,z.useMemo)(()=>me.filter(e=>!e.sidebarHidden),[me]),ge=(0,z.useMemo)(()=>me.filter(e=>e.sidebarHidden),[me]),_e=(0,z.useMemo)(()=>{let e=a??[];return new Map(e.map(t=>[t._id,Mxe(e,t._id)]))},[a]),ve=(0,z.useMemo)(()=>new Map((a??[]).map(e=>[e._id,e.name])),[a]),ye=e=>de.filter(t=>t.projectId!==null&&(_e.get(t.projectId)??t.projectId)===e);function be(e){return M.find(t=>t._id===e)}async function xe(e){P(null),ce();let{active:t,over:n}=e;if(!n)return;let r=String(t.id),i=String(n.id);if(r.startsWith(o9)){let e=r.slice(9),t=he,n=null;if(i.startsWith(o9))n=i.slice(9);else if(i.startsWith(`project:`)&&i!==a9)n=i.slice(8);else{let e=be(i);n=e&&!e.pinned?e.projectId??null:null}if(n===null||n===e)return;let a=t.findIndex(t=>t._id===e),o=t.findIndex(e=>e._id===n);if(a<0||o<0)return;let s=[...t],[c]=s.splice(a,1);s.splice(o,0,c);let l=s[o-1]??null,u=s[o+1]??null;await x({projectId:e,prevKey:l?l.sortKey:null,nextKey:u?u.sortKey:null});return}let a=be(r);if(!a)return;if(i.startsWith(o9)){let e=i.slice(9);if((a.projectId??null)===e)return;j.current=!0,ee(t=>(t??M).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await S({chatId:a._id,projectId:e})}finally{j.current=!1}return}if(i.startsWith(`project:`)){let e=i===a9?null:i.slice(8);if((a.projectId??null)===e)return;j.current=!0,ee(t=>(t??M).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await S({chatId:a._id,projectId:e})}finally{j.current=!1}return}let o=be(i);if(!o||t.id===n.id)return;if((o.projectId??null)!==(a.projectId??null)||o.pinned!==a.pinned){if(a.pinned||o.pinned)return;j.current=!0,ee(e=>(e??M).map(e=>e._id===a._id?{...e,projectId:o.projectId??null}:e));try{await S({chatId:a._id,projectId:o.projectId??null})}finally{j.current=!1}return}let s=o.pinned?ue:fe(o.projectId??null),c=s.map(e=>e._id),l=c.indexOf(a._id),u=c.indexOf(o._id);if(l<0||u<0)return;let d=[...s];d.splice(l,1),d.splice(u,0,a);let f=d[u-1]??null,p=d[u+1]??null;j.current=!0,ee(e=>[...(e??M).filter(e=>!s.some(t=>t._id===e._id)),...d]);try{await b({chatId:a._id,prevKey:f?f.sortKey:null,nextKey:p?p.sortKey:null})}finally{j.current=!1}}let Se=q8(),Ce=Se?ATe(Se.state):null,[we,Te]=(0,z.useState)(!1),Ee=N?be(N):null;return(0,B.jsxs)(`aside`,{className:`oc-sidebar`+(we?` oc-sidebar--archivedrop`:``),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),Te(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Te(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes(`Files`))return;e.preventDefault(),Te(!1);let t=e.dataTransfer.files[0];t!==void 0&&Se?.importArchive(t,null)},children:[we?(0,B.jsxs)(`div`,{className:`oc-sidebar__droparchive`,"aria-hidden":!0,children:[(0,B.jsx)(tx,{className:`size-4`}),(0,B.jsx)(`span`,{children:ca()})]}):null,Ce===null?null:(0,B.jsxs)(`div`,{className:`oc-sidebar__transfer`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-spin`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-label`,children:Ce})]}),(0,B.jsxs)(`div`,{className:`oc-sidebar__top`,ref:T,children:[(0,B.jsxs)(Ih,{className:O===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,title:`${w} (${r})`,"aria-label":w,children:[(0,B.jsx)(Ib,{}),O===`icon`?null:(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w}),O===`full`?(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,"aria-hidden":!0,children:r}):null]}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:E,children:[(0,B.jsxs)(Ih,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(Ib,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w}),(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,B.jsx)(Ih,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(tb,{})})]})}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:D,children:[(0,B.jsxs)(Ih,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(Ib,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w})]}),(0,B.jsx)(Ih,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(tb,{})})]})}),(0,B.jsx)(Ih,{className:`oc-newproject`,variant:`outline`,size:`icon`,"aria-label":Va(),title:Va(),onClick:async()=>{let e=await C({title:Va(),label:Vr(),placeholder:Ln(),confirmLabel:jt()});e&&await _({name:e})},children:(0,B.jsx)(tb,{})})]}),(0,B.jsxs)(D7,{sensors:oe,collisionDetection:le,modifiers:[oDe,aDe],onDragStart:e=>P(String(e.active.id)),onDragCancel:()=>{P(null),ce()},onDragEnd:xe,children:[(0,B.jsx)(`div`,{className:`oc-sidebar__scroll`,children:te?(0,B.jsx)(l9,{}):(0,B.jsxs)(B.Fragment,{children:[ue.length>0?(0,B.jsx)(u9,{label:aa(),chats:ue,children:ue.map(n=>(0,B.jsx)(d9,{chat:n,active:n._id===e,unread:m.has(n._id),busy:u.has(n._id),bookmarked:p.has(n._id),referenceLabel:f,ageTick:h,suppressClick:se,onSelect:t},n._id))}):null,(0,B.jsx)(V7,{items:he.map(e=>s9(e._id)),strategy:R7,children:he.map(n=>{let r=ye(n._id);return(0,B.jsx)(u9,{label:n.name,dropId:CDe(n._id),sortId:s9(n._id),suppressClick:se,projectId:n._id,project:n,chats:r,collapsible:!0,collapsed:n.collapsed,busy:r.some(e=>u.has(e._id)),unread:r.some(e=>m.has(e._id)),onToggle:()=>void v({projectId:n._id,collapsed:!n.collapsed}),onOpen:()=>void pe({to:`/project/$projectId`,params:{projectId:n._id}}),children:n.collapsed?null:r.length===0?(0,B.jsx)(`div`,{className:`oc-sidebar__empty`,children:wi()}):r.map(r=>(0,B.jsx)(d9,{chat:r,active:r._id===e,unread:m.has(r._id),busy:u.has(r._id),bookmarked:p.has(r._id),referenceLabel:f,domainLabel:r.projectId!==null&&r.projectId!==n._id?ve.get(r.projectId)??null:null,ageTick:h,suppressClick:se,onSelect:t},r._id))},n._id)})}),ge.length>0?(0,B.jsxs)(vF,{children:[(0,B.jsx)(yF,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`oc-sidebar__hiddenfolders`,children:[(0,B.jsx)(Yy,{className:`size-3.5`,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:mt({count:ge.length})})]})}),(0,B.jsx)(bF,{align:`start`,className:`w-56`,children:ge.map(e=>(0,B.jsxs)(xF,{onSelect:()=>void y({projectId:e._id,hidden:!1}),children:[(0,B.jsx)(eb,{}),` `,e.name]},e._id))})]}):null,(0,B.jsx)(u9,{label:ai(),dropId:a9,chats:fe(null),collapsible:!0,collapsed:ne,busy:fe(null).some(e=>u.has(e._id)),unread:fe(null).some(e=>m.has(e._id)),onToggle:ie,children:ne?null:fe(null).map(n=>(0,B.jsx)(d9,{chat:n,active:n._id===e,unread:m.has(n._id),busy:u.has(n._id),bookmarked:p.has(n._id),referenceLabel:f,ageTick:h,suppressClick:se,onSelect:t},n._id))})]})}),(0,B.jsxs)(M7,{children:[N?.startsWith(o9)?(()=>{let e=(a??[]).find(e=>s9(e._id)===N);return e?(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head oc-chatitem--overlay`,style:{"--proj-hue":X7(e)},children:[(0,B.jsx)(Ay,{className:`size-3.5 shrink-0 oc-sidebar__group-chev`}),(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e.name})]}):null})():null,Ee?(0,B.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[Y7(Ee.color)?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:Y7(Ee.color)}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsx)(`span`,{className:`oc-chatitem__label`,children:Ee.title||Ad()})]}):null]})]})]})}function u9({label:e,dropId:t,sortId:n,suppressClick:r,projectId:i,project:a,chats:o,collapsible:s,collapsed:c,busy:u,unread:d,onToggle:f,onOpen:p,children:m}){let h=Nt(L.projects.setProjectSidebar),g=q8(),_=Nt(L.projects.deleteProject),v=Nt(L.projects.renameProject),y=Nt(L.projects.setProjectColor),b=Nt(L.projects.moveProject),x=G3(),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(e),[E,D]=(0,z.useState)(!1),O=I(L.projects.projectTreeCount,i?{projectId:i}:`skip`),{setNodeRef:A,isOver:ee}=A7({id:t??`static:${e}`}),j=U7({id:n??`static-sort:${e}`,disabled:!n}),{onKeyDown:M,...te}=j.listeners??{},N=p??f,P=e=>{e.target===e.currentTarget&&s&&N&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N())},ne=a?X7(a):null;return(0,B.jsxs)(`div`,{ref:e=>{t&&A(e),n&&j.setNodeRef(e)},className:`oc-sidebar__group`+(ee?` oc-sidebar__group--over`:``)+(a?` oc-sidebar__group--project`:``),style:{...ne?{"--proj-hue":ne}:{},...n?{transform:h5.Transform.toString(j.transform),transition:j.transition,opacity:j.isDragging?.35:1}:{}},children:[(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head group/head`+(s?` oc-sidebar__group-head--btn`:``),...s?{role:`button`,tabIndex:0,onClick:()=>{r?.current||N?.()},onKeyDown:P}:{},...n?te:{},children:[s?p?(0,B.jsx)(`button`,{type:`button`,className:`oc-sidebar__group-chevbtn`,"aria-label":c?Ll():cm(),"aria-expanded":!c,onClick:e=>{e.stopPropagation(),!r?.current&&f?.()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:c?(0,B.jsx)(My,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(Ay,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)})}):c?(0,B.jsx)(My,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(Ay,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):null,(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Tn(),onClick:e=>e.stopPropagation(),...j.attributes,onKeyDown:M,children:(0,B.jsx)(sb,{className:`size-3.5`})}):null,c&&u?(0,B.jsx)(`span`,{className:`oc-chatitem__busy`,title:re(),"aria-label":re()}):null,c&&d?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:lh(),"aria-label":lh()}):null,i?(0,B.jsxs)(vF,{children:[(0,B.jsx)(yF,{asChild:!0,children:(0,B.jsx)(Ih,{variant:`ghost`,size:`icon-xs`,"aria-label":Bi(),className:`oc-sidebar__group-menu opacity-0 group-hover/head:opacity-100 group-focus-within/head:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(Ky,{})})}),(0,B.jsxs)(bF,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[p?(0,B.jsxs)(xF,{onSelect:()=>p(),children:[(0,B.jsx)(eb,{}),` `,Qm()]}):null,(0,B.jsxs)(xF,{onSelect:()=>{T(e),C(!0)},children:[(0,B.jsx)(jb,{}),` `,qi()]}),(0,B.jsxs)(xF,{onSelect:()=>D(!0),children:[(0,B.jsx)(tb,{}),` `,zt()]}),a!==void 0&&a.parentId===null?(0,B.jsxs)(xF,{onSelect:()=>void h({projectId:a._id,hidden:!0}),children:[(0,B.jsx)(Yy,{}),` `,Uc()]}):null,g&&a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(xF,{disabled:g.state.running,onSelect:()=>g.exportFolder(a._id,e),children:[(0,B.jsx)(Gy,{}),` `,uu()]}),(0,B.jsxs)(xF,{disabled:g.state.running,onSelect:()=>g.pickAndImport(a._id),children:[(0,B.jsx)(tx,{}),` `,l()]})]}):null,(0,B.jsx)(SF,{children:bd()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void y({projectId:i,color:null}),"aria-label":k(),children:`✕`}),J7.map(e=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(a?.color===e.value?` is-selected`:``),style:{background:e.hue},"aria-label":e.value,onClick:()=>void y({projectId:i,color:e.value})},e.value))]}),(0,B.jsx)(CF,{}),(0,B.jsxs)(xF,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let t=O?.folders??0,n=O?.chats??0;await x({title:Oee({name:e}),description:t>0?Bee({folders:t,chats:n}):n>0?xl({count:n}):Aa(),confirmWord:kr(),confirmLabel:so(),destructive:!0})&&await _({projectId:i})})},children:[(0,B.jsx)($b,{}),` `,kr()]})]})]}):null]}),(0,B.jsx)(`div`,{className:a&&!c?`oc-sidebar__group-body`:void 0,children:(0,B.jsx)(V7,{items:o.map(e=>e._id),strategy:R7,children:m})}),i?(0,B.jsx)(q7,{open:S,onOpenChange:C,title:Qe(),canSubmit:w.trim().length>0,onSubmit:async()=>{await v({projectId:i,name:w.trim()}),C(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:it()}),(0,B.jsx)(TF,{value:w,onChange:e=>T(e.target.value),autoFocus:!0})]})})}):null,i&&E?(0,B.jsx)(Z7,{open:E,onOpenChange:D,title:Mo(),movingFolderId:i,currentId:a?.parentId??null,onPick:e=>void b({projectId:i,parentId:e})}):null]})}var d9=(0,z.memo)(function({chat:e,active:t,unread:n,busy:r,bookmarked:i,referenceLabel:a,domainLabel:o,suppressClick:s,onSelect:c}){let l=q8(),{attributes:u,listeners:d,setNodeRef:f,transform:p,transition:m,isDragging:h}=U7({id:e._id}),{onKeyDown:g,..._}=d??{},v=Nt(L.chats.renameChat),y=qF(),b=()=>{if(a===void 0)return;let t=jTe(a,e._id);navigator.clipboard.writeText(t).then(()=>y.success(gn({reference:t})),()=>y.error(as()))},x=Nt(L.chats.deleteChat),S=Nt(L.chats.pinChat),C=Nt(L.chats.setChatColor),w=Nt(L.chats.moveChatToProject),T=Nt(L.chats.setChatSidebar),E=Nv(),[D,O]=(0,z.useState)(!1),A=I(L.me.getMe,{host:d3})?.ui?.effective?.showChatAge??!0,ee=G3(),[j,M]=(0,z.useState)(!1),[te,N]=(0,z.useState)(e.title??``),P=$3()?.chatId===e._id,ne=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!P)return;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;ne.current?.scrollIntoView({block:`nearest`,behavior:t?`auto`:`smooth`});let n=setTimeout(()=>Q3(e._id),2600);return()=>clearTimeout(n)},[P,e._id]);let re={transform:h5.Transform.toString(p),transition:m,opacity:+!h},ie=Y7(e.color);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{ref:e=>{f(e),ne.current=e},style:re,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``)+(P?` oc-chatitem--flash`:``),onClick:()=>{s.current||c(e._id)},..._,onAnimationEnd:t=>{P&&t.animationName===`oc-chatitem-flash`&&Q3(e._id)},children:[(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Tn(),onClick:e=>e.stopPropagation(),...u,onKeyDown:g,children:(0,B.jsx)(sb,{className:`size-3.5`})}),ie?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:ie}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsxs)(`button`,{className:`oc-chatitem__label`,onClick:t=>{t.stopPropagation(),!s.current&&c(e._id)},children:[(0,B.jsx)(`span`,{className:`oc-chatitem__title`,children:e.title||Ad()}),o?(0,B.jsx)(`span`,{className:`oc-chatitem__domain`,children:o}):null]}),r?(0,B.jsx)(`span`,{className:`oc-chatitem__busy`,title:Kd(),"aria-label":Kd()}):null,n?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:lh(),"aria-label":lh()}):null,e.readOnly?(0,B.jsx)(`span`,{className:`oc-chatitem__readonly`,title:Re(),children:(0,B.jsx)(mb,{size:12,"aria-label":Re()})}):null,i?(0,B.jsx)(`span`,{className:`oc-chatitem__bookmark group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Xt(),children:(0,B.jsx)(Ty,{size:12,"aria-label":Xt()})}):null,A?(0,B.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:o0(e.updatedAt),children:i9(e.updatedAt,Date.now())}):null,(0,B.jsxs)(vF,{children:[(0,B.jsx)(yF,{asChild:!0,children:(0,B.jsx)(Ih,{variant:`ghost`,size:`icon-xs`,"aria-label":yt(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(Ky,{})})}),(0,B.jsxs)(bF,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(xF,{onSelect:()=>{N(e.title??``),M(!0)},children:[(0,B.jsx)(jb,{}),` `,qi()]}),l?(0,B.jsxs)(xF,{disabled:l.state.running,onSelect:()=>l.exportChat(e._id,e.title??ai()),children:[(0,B.jsx)(Gy,{}),` `,Cm()]}):null,(0,B.jsxs)(xF,{onSelect:()=>void S({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,B.jsx)(Pb,{}):(0,B.jsx)(Nb,{}),e.pinned?fi():Jr()]}),(0,B.jsxs)(xF,{onSelect:b,disabled:a===void 0,children:[(0,B.jsx)(db,{}),` `,Ho()]}),(0,B.jsxs)(xF,{onSelect:()=>O(!0),children:[(0,B.jsx)(eb,{}),` `,ur()]}),e.projectId===null?null:(0,B.jsxs)(xF,{onSelect:()=>void E({to:`/project/$projectId`,params:{projectId:e.projectId},search:{c:e._id}}),children:[(0,B.jsx)(nb,{}),` `,Xl()]}),e.pinned?null:(0,B.jsxs)(xF,{onSelect:()=>void T({chatId:e._id,hidden:!0}),children:[(0,B.jsx)(Db,{}),` `,Uc()]}),(0,B.jsx)(SF,{children:bd()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void C({chatId:e._id,color:null}),"aria-label":k(),children:`✕`}),J7.map(t=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void C({chatId:e._id,color:t.value})},t.value))]}),(0,B.jsx)(CF,{}),(0,B.jsxs)(xF,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await ee({title:Ld(),description:ji(),confirmLabel:kr(),destructive:!0})&&await x({chatId:e._id})})},children:[(0,B.jsx)($b,{}),` `,kr()]})]})]})]}),(0,B.jsx)(q7,{open:j,onOpenChange:M,title:Ue(),canSubmit:te.trim().length>0,onSubmit:async()=>{await v({chatId:e._id,title:te.trim()}),M(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:it()}),(0,B.jsx)(TF,{value:te,onChange:e=>N(e.target.value),autoFocus:!0})]})})}),D?(0,B.jsx)(Z7,{open:D,onOpenChange:O,title:ms(),currentId:e.projectId,onPick:t=>void w({chatId:e._id,projectId:t})}):null]})}),f9=null,p9=0,TDe=400;function EDe(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!f9)try{f9=new e}catch{return null}return f9}function m9(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 h9(e){let t=Date.now();if(t-p9<TDe)return;let n=EDe();if(!n)return;p9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function DDe(){h9(e=>{m9(e,660,0,.16,.12),m9(e,440,.14,.2,.1)})}function ODe(){h9(e=>{m9(e,880,0,.14,.08)})}function kDe({activeChatId:e}){let t=I(L.messages.listChats,{}),n=Nt(L.chatReads.markChatSeen),r=I(L.me.getMe,{host:d3}),i=r?.ui?.effective?.replySound===!0,a=r?.userId??null,o=(0,z.useRef)(null),s=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(!t)return;s.current!==String(a)&&(s.current=String(a),o.current=null);let r=new Map;for(let e of t)e.lastAssistantAt!==null&&r.set(e._id,e.lastAssistantAt);let c=o.current;if(o.current=r,c===null)return;let l=!1;for(let[t,i]of r){let r=c.get(t);r!==void 0&&i<=r||r===void 0&&Date.now()-i>3e4||(l=!0,t===e&&document.visibilityState===`visible`?n({chatId:t}):t!==e&&Z3(t))}l&&i&&ODe()},[t,e,i,n,a]),(0,z.useEffect)(()=>{e&&document.visibilityState===`visible`&&n({chatId:e})},[e,n]),(0,z.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&n({chatId:e})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,n]),null}function g9(e){let t=Nt(L.chats.createChat),n=I(L.agents.listMyAgents),[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(void 0),o=(0,z.useCallback)(async(n,r)=>{e(await t({instanceName:n,agentId:r,projectId:a.current}))},[t,e]);return{startNewChat:(0,z.useCallback)(async e=>{a.current=e?.projectId;let t=n;if(t&&t.length===1&&t[0].state!==`deleted`){await o(t[0].instanceName,t[0].agentId);return}i(!0)},[n,o]),picker:(0,B.jsx)(aSe,{open:r,onOpenChange:i,agents:n,onPick:(e,t)=>{i(!1),o(e,t)}})}}var _9=[`admin`,`user`,`pending`];function v9(){let e=I(L.me.authProviders)?.anonymous===!0,[t,n]=(0,z.useState)(!1),r=I(L.dev.listUsersDev,e?{}:`skip`),i=I(L.me.getImpersonation),a=Nt(L.dev.setMyRole),o=Nt(L.dev.setRole),s=Nt(L.admin.startImpersonation),c=Nt(L.admin.stopImpersonation);if(!e)return null;let l=r?.find(e=>e.isMe),u=l?.role===`admin`,d=i?.impersonating===!0,f=(r??[]).filter(e=>!e.isMe);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:w(),children:[(0,B.jsx)(rx,{size:13}),`DEV`]}),(0,B.jsx)(d0,{open:t,onOpenChange:n,children:(0,B.jsxs)(f0,{children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:Ta()}),(0,B.jsx)(g0,{children:Dc()})]}),(0,B.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,B.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[Gs({canonical:l?.canonical??`…`}),` `,(0,B.jsx)(YF,{variant:`outline`,children:l?.role??`…`})]}),(0,B.jsx)(`div`,{className:`oc-devsw__roles`,children:_9.map(e=>(0,B.jsx)(Ih,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?uc():e===`user`?rr():Lp()},e))})]}),d?(0,B.jsxs)(`div`,{className:`oc-devsw__imp`,children:[Sr(),` `,(0,B.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,B.jsx)(Ih,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Zt()})]}):null,(0,B.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,B.jsx)(`p`,{className:`oc-devsw__empty`,children:Es()}):f.map(e=>(0,B.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,B.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,B.jsx)(`select`,{className:`oc-devsw__select`,value:e.role,disabled:!e.canonical,onChange:t=>e.canonical&&void o({canonical:e.canonical,role:t.target.value}),children:_9.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))}),(0,B.jsx)(Ih,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?_n():os():Uo(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:xe()})]},e.profileId))})]})})]})}function y9({label:e,mode:t,minimal:n=!1}){let{signOut:r}=rg(),i=Nt(L.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(L.me.getMe,{host:d3});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(L.me.getMe,{host:d3},{...n,themeMode:t,resolvedThemeMode:r})}),a=t??`default`;return(0,B.jsxs)(vF,{children:[(0,B.jsx)(yF,{asChild:!0,children:(0,B.jsxs)(Ih,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,B.jsx)(Ay,{className:`opacity-60`})]})}),(0,B.jsx)(bF,{align:`end`,className:`w-52`,children:n?(0,B.jsxs)(xF,{onClick:()=>void r(),children:[(0,B.jsx)(hb,{}),` `,mh()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(SF,{children:pt()}),(0,B.jsxs)(Sue,{value:a,onValueChange:e=>void i({mode:e==="default"?null:e}),children:[(0,B.jsxs)(wF,{value:`light`,children:[(0,B.jsx)(Xb,{}),` `,Eo()]}),(0,B.jsxs)(wF,{value:`dark`,children:[(0,B.jsx)(Tb,{}),` `,pee()]}),(0,B.jsxs)(wF,{value:`system`,children:[(0,B.jsx)(wb,{}),` `,Be()]}),(0,B.jsx)(wF,{value:`default`,children:lo()})]}),(0,B.jsx)(CF,{}),(0,B.jsxs)(xF,{onClick:()=>void r(),children:[(0,B.jsx)(hb,{}),` `,mh()]})]})})]})}var ADe={altered_words:()=>Lu(),incorrect:()=>Xu(),incoherence:()=>xf(),formatting:()=>hp(),latency:()=>Su(),api_error:()=>Kl(),other:()=>Nm()},b9=e=>ADe[e]?.()??e,jDe={anomaly_open:ex,anomaly_resolved:Fy,feedback_reply:yb,feedback_resolved:yb,feedback_new:yb,curation:Zy,operator_announcement:_b},MDe={atrium:()=>om(),assistants:()=>rp(),platform:()=>il()},NDe={investigating:()=>md(),monitoring:()=>tm(),resolved:()=>Hf()},x9=e=>(e?MDe[e]:void 0)?.()??`?`,PDe=e=>(e?NDe[e]:void 0)?.()??`?`,S9=e=>{let t=e===void 0?NaN:Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(Jd()):`?`},FDe={notif_feedback_reply_admin:()=>({title:_l(),body:hh()}),notif_feedback_reply:()=>({title:_l(),body:hh()}),notif_feedback_resolved:()=>({title:no(),body:dh()}),notif_feedback_new:e=>({title:Ym(),body:Bc({reference:e.reference??`?`,category:b9(e.category??`other`)})}),notif_curation_proposed:e=>({title:_o(),body:sh({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:Me(),body:Qa({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:See(),body:ml({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Iee({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:Km({kind:e.kind??`?`}),body:t.body}),notif_operator_maintenance_scheduled:e=>({title:$u(),body:wf({service:x9(e.service),startsAt:S9(e.starts_at),endsAt:S9(e.ends_at)})}),notif_operator_maintenance_completed:e=>({title:vp(),body:wu({service:x9(e.service),completedAt:S9(e.completed_at)})}),notif_operator_incident_update:e=>({title:Jl(),body:Im({service:x9(e.service),status:PDe(e.status),reference:e.reference??`?`})}),notif_operator_subscription_notice:e=>({title:cf(),body:Fl({plan:e.plan??`?`,effectiveAt:S9(e.effective_at)})})};function C9(e){let t=e.messageKey?FDe[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:_l(),body:hh()}:e.kind===`feedback_resolved`?{title:no(),body:dh()}:{title:e.title,body:e.body}}function IDe(){let e=I(L.notifications.myUnreadCount)??0,t=I(L.notifications.myNotifications),n=I(L.feedback.myFeedback),r=Nt(L.notifications.markRead),i=Nt(L.notifications.markAllRead),a=Nt(L.notifications.clearOne),o=Nt(L.notifications.clearAll),s=Nt(L.feedback.closeMyFeedback),c=Nv(),[l,u]=(0,z.useState)(!1),d=I(L.me.getMe,{host:d3}),f=d?.ui?.effective?.notifSound===!0,p=d?.ui?.effective?.notifSystem===!0,m=d?.userId??null,h=(0,z.useRef)(null),g=(0,z.useRef)(0),_=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!t)return;_.current!==String(m)&&(_.current=String(m),h.current=null,g.current=0);let e=t.reduce((e,t)=>Math.max(e,t.creationTime??0),0);if(h.current===null){h.current=new Set(t.map(e=>String(e._id))),g.current=e;return}let n=h.current,r=t.filter(e=>!n.has(String(e._id))&&(e.creationTime??0)>g.current);for(let e of t)n.add(String(e._id));if(g.current=Math.max(g.current,e),n.size>500){let e=new Set(t.map(e=>String(e._id)));for(let t of n)e.has(t)||n.delete(t)}if(r.length!==0&&(f&&DDe(),p&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=C9(e);try{let r=new Notification(t,{body:n,tag:String(e._id)});r.onclick=()=>window.focus()}catch{}}},[t,f,p,m]);let v=e=>{if(e.unread&&r({notificationId:e._id}),!e.href)return;if(u(!1),e.href.startsWith(`/chat/`)){c({to:`/chat/$chatId`,params:{chatId:e.href.slice(6)}});return}let[t,n]=e.href.split(`?`);c({to:t,search:Object.fromEntries(new URLSearchParams(n??``))})};return(0,B.jsxs)(vF,{open:l,onOpenChange:u,children:[(0,B.jsx)(yF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?Yee({count:e}):Ra(),children:[(0,B.jsx)(Cy,{size:18,"aria-hidden":!0}),e>0?(0,B.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,B.jsxs)(bF,{align:`end`,className:`oc-notif`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,B.jsx)(`span`,{children:Lr()}),t&&t.length>0?(0,B.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:Nn()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Dt()})]}):null]}),t===void 0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:et()}):t.length===0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:ea()}):(0,B.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=jDe[e.kind]??Cy,{title:n,body:i}=C9(e);return(0,B.jsxs)(`div`,{className:`oc-notif__item${e.unread?` is-unread`:``}${e.href?` is-link`:``}`,role:e.href?`button`:void 0,tabIndex:e.href?0:void 0,onClick:e.href?()=>v(e):void 0,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,B.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,B.jsx)(`button`,{type:`button`,title:yi(),"aria-label":yi(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,B.jsx)(ky,{size:13})}):null,(0,B.jsx)(`button`,{type:`button`,title:ei(),"aria-label":ei(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,B.jsx)(xh,{size:13})})]})]}),(0,B.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(Jd())})]},e._id)})}),n&&n.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:Ed()}),(0,B.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,B.jsx)(LDe,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function LDe({it:e,onClose:t,onNavigate:n}){let r=qF(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1);async function f(){d(!0);try{await t(c.trim()||void 0)}catch(e){r.error(ch(),e)}finally{d(!1)}}return(0,B.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(`span`,{className:`oc-notif__title`,children:b9(e.category)}),(0,B.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?xo():e.answered?N():Ud()})]}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(Jd())}),e.thread.length>0?(0,B.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,B.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?Ii():e.authorRole===`agent`?Ye():Je()}),(0,B.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,e.messageText?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-notif__report-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,B.jsx)(Ay,{size:13,"aria-hidden":!0}):(0,B.jsx)(My,{size:13,"aria-hidden":!0}),bo()]}),i?(0,B.jsx)(`div`,{className:`oc-notif__report-msg`,children:e.messageText}):null]}):null,(0,B.jsxs)(`div`,{className:`oc-notif__report-actions`,children:[(0,B.jsx)(qv,{to:`/chat/$chatId`,params:{chatId:e.chatId},search:{m:e.messageId},className:`oc-notif__link`,onClick:n,children:ct()}),o?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:ch()})]}),o?(0,B.jsxs)(`div`,{className:`oc-notif__close-form`,children:[(0,B.jsx)(`textarea`,{className:`oc-notif__close-input`,rows:2,value:c,onChange:e=>l(e.target.value),placeholder:Fe()}),(0,B.jsxs)(`div`,{className:`oc-notif__close-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-confirm`,disabled:u,onClick:()=>void f(),children:to()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:Tee()})]})]}):null]})}var w9=2,RDe=180;function zDe(){let e=Nv(),t=(0,z.useRef)(null),n=(0,z.useRef)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(0),d=(0,z.useMemo)(()=>FF(kF,PF()),[]);(0,z.useEffect)(()=>{let e=setTimeout(()=>c(a),RDe);return()=>clearTimeout(e)},[a]);let f=s.trim(),p=I(L.search.searchConversations,f.length>=w9?{query:f}:`skip`),m=p??[],h=f.length>=w9&&p===void 0;(0,z.useEffect)(()=>{let e=e=>{IF(e,kF)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,z.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,z.useEffect)(()=>{u(0)},[p]),(0,z.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let g=(0,z.useCallback)((t,n)=>{i(!1),n&&a.trim()&&M6(n,a.trim()),e({to:`/chat/$chatId`,params:{chatId:t},...n?{search:{m:n}}:{}})},[e,a]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":Is(),children:[(0,B.jsx)(Bb,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-search-trigger__label`,children:nc()}),(0,B.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:d})]}),(0,B.jsx)(d0,{open:r,onOpenChange:i,children:(0,B.jsxs)(f0,{showCloseButton:!1,className:`oc-search-palette top-[12vh] translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,B.jsx)(h0,{className:`sr-only`,children:Yn()}),(0,B.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,B.jsx)(Bb,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:t,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,m.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=m[l];t&&g(t.chatId,t.messageId)}},placeholder:Ap(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":hr()})]}),(0,B.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:f.length<w9?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:Wt({count:w9})}):h?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:ys()}):m.length===0?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:Io({term:f})}):m.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:Bp(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>g(e.chatId,e.messageId),children:[(0,B.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,B.jsx)(cb,{size:15}):(0,B.jsx)(yb,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,B.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||un()}),e.projectPath&&e.projectPath.length>0?(0,B.jsx)(`span`,{className:`oc-search-result__path`,"aria-label":Tp(),children:e.projectPath.join(` › `)}):null,e.snippet?(0,B.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,B.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?$o():me()})]},e.chatId))}),(0,B.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↑`}),(0,B.jsx)(`kbd`,{children:`↓`}),` `,Kee()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↵`}),` `,Pa()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:Nr()}),` `,kn()]})]})]})})]})}var T9=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`],E9=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`],D9={users:()=>af(),groups:()=>Sa(),instances:()=>Ml(),bridge:()=>cee(),injections:()=>We(),serviceAccounts:()=>ep(),roles:()=>tl(),access:()=>Tc(),traces:()=>dd(),kpi:()=>Zp(),anomalies:()=>Rf(),files:()=>Xs(),scheduled:()=>hu(),agentFiles:()=>Rd(),preferences:()=>Sl(),integrations:()=>ym(),theme:()=>dm(),chatDefaults:()=>wa(),audit:()=>ou(),feedbacks:()=>S(),subagentReports:()=>Ns(),voice:()=>tr()},O9={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`},BDe=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function k9(e){let t=new Set(e);return T9.filter(e=>t.has(O9[e]))}function A9(e){return`/settings/${e}`}function j9(e){let t=e.split(`/`)[2];return T9.includes(t)?t:void 0}var VDe={uiprefs:`preferences`},M9=[{id:`personal`,label:()=>bee(),tabs:[`preferences`,`theme`,`files`,`scheduled`]},{id:`agents`,label:()=>fl(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>Pee(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>Wm(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],HDe=new Map(M9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function N9(e){let t=HDe.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function UDe(e,t){return e.find(e=>N9(e)===t)}M9.flatMap(e=>[...e.tabs]);function WDe(){let e=I(L.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.gatewaysUnreachable??0,n=e.known?e.available?t>0?`warn`:`ok`:`error`:`idle`,r=e.known?e.available?t>0?Oc({count:t}):`${Qc()}${e.checkedAt?cd({time:s0(e.checkedAt)}):``}`:Jp({reason:e.reason??`?`}):Zf();return(0,B.jsx)(E6,{delayDuration:150,children:(0,B.jsxs)(D6,{children:[(0,B.jsx)(O6,{asChild:!0,children:(0,B.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,B.jsx)(k6,{children:r})]})})}function P9(e){let t=new Set(T9),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 T9)n.has(e)||r.push(e);return r}function GDe(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function KDe({tab:e,active:t}){let n=D9[e](),r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,B.jsx)(WDe,{}):null]});return E9.includes(e)?(0,B.jsx)(qv,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,B.jsx)(qv,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function qDe({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=U7({id:e});return(0,B.jsxs)(`div`,{ref:i,style:{transform:h5.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":ho(),...n,...r,children:(0,B.jsx)(sb,{size:14,"aria-hidden":!0})}),(0,B.jsx)(KDe,{tab:e,active:t})]})}function JDe(){let e=I(L.me.getMe,{host:d3}),t=Nt(L.me.setSettingsTabOrder),n=j9(vy({select:e=>e.pathname})),r=n===void 0?void 0:N9(n),i=(0,z.useMemo)(()=>P9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,z.useState)(i);(0,z.useEffect)(()=>o(i),[i]);let s=(0,z.useMemo)(()=>new Set(k9(e?.permissions??[])),[e?.permissions]),c=(0,z.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&N9(e)===r),[a,s,r]),l=x5(b5(t7,{activationConstraint:{distance:5}}),b5(Z5,{coordinateGetter:G7}));if(r===void 0||c.length===0)return null;let u=M9.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=GDe(a,N7(c,i,s));o(l),t({order:l})}return(0,B.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,B.jsx)(D7,{sensors:l,collisionDetection:JTe,modifiers:[rDe],onDragEnd:d,children:(0,B.jsx)(V7,{items:c,strategy:uDe,children:c.map(e=>(0,B.jsx)(qDe,{tab:e,active:e===n},e))})})})}function YDe(){let e=I(L.me.getMe,{host:d3}),t=Nv(),n=j9(vy({select:e=>e.pathname})),r=n===void 0?void 0:N9(n),i=(0,z.useMemo)(()=>new Set(k9(e?.permissions??[])),[e?.permissions]),a=(0,z.useMemo)(()=>P9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=M9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=UDe(a,e.id);n&&t({to:A9(n)})}return(0,B.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":ah(),children:[(0,B.jsx)(qv,{to:`/`,className:`oc-settings-nav__back`,children:Ae()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__title`,children:Xa()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-nav__group`+(e.id===r?` is-active`:``),"aria-current":e.id===r?`true`:void 0,onClick:()=>s(e),children:e.label()},e.id))})]})}var XDe=[`eq`,`neq`,`contains`,`gt`,`gte`,`lt`,`lte`],F9=[50,100,200,500],I9=`now-30d`,ZDe=`now-24h`;function QDe(e,t,n=I9,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 $De(e){return e.kind===`absolute`?{from:String(e.from),to:String(e.to)}:{from:e.from,to:e.to}}function eOe(e){if(e.length!==0)return JSON.stringify(e)}function tOe(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`||!XDe.includes(i)||typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`||n.push({field:r,op:i,value:a})}return n}var L9=B4().optional(),R9=B4().optional(),z9=B4().optional(),B9=B4().optional().catch(void 0),nOe=q4({q:L9,section:X4([`latency`,`events`]).default(`events`).catch(`events`),kind:B4().default(`all`).catch(`all`),correlationId:B4().optional().catch(void 0),limit:Sxe().pipe(J4([Z4(F9[0]),Z4(F9[1]),Z4(F9[2]),Z4(F9[3])])).catch(100),statusClass:X4([`2xx`,`4xx`,`5xx`]).optional().catch(void 0),principalType:X4([`user`,`service`,`system`]).optional().catch(void 0),direction:X4([`inbound`,`outbound`,`internal`]).optional().catch(void 0),roleKey:B9,from:R9,to:R9,adv:z9}),rOe=q4({q:L9,action:B9,impersonated:X4([`yes`,`no`]).optional().catch(void 0),resource:B9,from:R9,to:R9,adv:z9}),iOe=q4({q:L9,status:X4([`open`,`acknowledged`,`resolved`,`all`]).default(`open`).catch(`open`),severity:X4([`info`,`warn`,`critical`]).optional().catch(void 0),kind:B9,from:R9,to:R9}),aOe=q4({from:R9,to:R9}),oOe=q4({q:L9,status:X4([`active`,`disabled`]).optional().catch(void 0)}),sOe=q4({q:L9,role:B9});q4({q:L9,mode:X4([`per-user`,`shared`]).optional().catch(void 0)});var cOe=q4({section:X4([`readaloud`,`dictation`,`talk`]).default(`readaloud`).catch(`readaloud`)}),lOe=q4({section:B4().max(32).default(`openclaw`).catch(`openclaw`)}),V9=`oc.theme`;function H9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function U9(e){(0,z.useEffect)(()=>{let t=e??localStorage.getItem(V9)??`system`;if(localStorage.setItem(V9,t),H9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>H9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}var W9=`oc.fontScale`,uOe={sm:`87.5%`,md:``,lg:`112.5%`,xl:`125%`,"2xl":`137.5%`,"3xl":`150%`},G9=[`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`];function dOe(e){return e!==null&&G9.includes(e)}function fOe(e){document.documentElement.style.fontSize=uOe[e]}function K9(e){(0,z.useEffect)(()=>{let t=localStorage.getItem(W9),n=e??(dOe(t)?t:`md`);localStorage.setItem(W9,n),fOe(n)},[e])}function pOe(e){(0,z.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=Jd()}catch{t=void 0}t!==e&&ae(e)},[e])}var mOe=(0,z.lazy)(()=>WQ(()=>import(`./RolesTab-rU1yG45_.js`).then(e=>({default:e.RolesTab})),__vite__mapDeps([2,1,3,4,5]))),hOe=(0,z.lazy)(()=>WQ(()=>import(`./InstancesTab-D3PbSRsE.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([6,1,3,7,8,9,10,11,12,13,14,15,5,16,17,18]))),gOe=(0,z.lazy)(()=>WQ(()=>import(`./PromptInjectionsTab-CMynIw-2.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([19,1,3,7,8,9,20,5,21]))),_Oe=(0,z.lazy)(()=>WQ(()=>import(`./GroupsTab-C2ErNAiu.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([22,1,3,12,23,18,13,5,16,24,14,15]))),vOe=(0,z.lazy)(()=>WQ(()=>import(`./IntegrationsTab-DsvIgPM9.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([25,1,3,5]))),yOe=(0,z.lazy)(()=>WQ(()=>import(`./FeedbacksTab-Uzv7-Dj0.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([26,1,3,18,13,5,16]))),bOe=(0,z.lazy)(()=>WQ(()=>import(`./SubAgentReportsTab-C9t7ObEO.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([27,1,3,18,13,5,16]))),xOe=(0,z.lazy)(()=>WQ(()=>import(`./FilesTab-fi7x53E6.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([28,1,3,5,16]))),SOe=(0,z.lazy)(()=>WQ(()=>import(`./ScheduledTab-D1E65eqQ.js`).then(e=>({default:e.ScheduledTab})),__vite__mapDeps([29,1,3,30,31,13,21,14,15,5,16]))),COe=(0,z.lazy)(()=>WQ(()=>import(`./AgentFilesTab-CjesR_c6.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([32,1,3,11,8,5,21]))),wOe=(0,z.lazy)(()=>WQ(()=>import(`./PreferencesTab-D1GB1DjD.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([33,1,3,31,13,21,20,9,5]))),TOe=(0,z.lazy)(()=>WQ(()=>import(`./ChatDefaultsTab-CM2Yd28v.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([34,1,3,11,5,21]))),EOe=(0,z.lazy)(()=>WQ(()=>import(`./AccessTab-BPl6RGWf.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([35,1,3]))),DOe=(0,z.lazy)(()=>WQ(()=>import(`./ThemeShowroom-SQKNzsXc.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([36,1,3,23,37,15,5,14,20,9,38,16])));function OOe(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(hte,{children:(0,B.jsx)(`div`,{className:`oc-boot`,children:ir()})}),(0,B.jsx)(mte,{children:(0,B.jsx)(AOe,{})}),(0,B.jsx)(pte,{children:(0,B.jsx)(zue,{children:(0,B.jsx)(kTe,{children:(0,B.jsx)(MOe,{})})})})]})}function kOe(){return(0,B.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,B.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,B.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,B.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function AOe(){let{signIn:e}=rg();U9(void 0),K9(void 0);let t=I(L.charts.brandForHost,{host:d3}),n=Fxe(d3),r=t??n??null,i=m3(void 0);h3(r?.tokens??null,i),(0,z.useEffect)(()=>{t&&Ixe(d3,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?O3(a,i):null,s=a?.label??`Atrium`,c=I(L.me.authProviders),[l,u]=(0,z.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(Rp())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.anonymous;return(0,B.jsxs)(`div`,{className:`oc-signin`,children:[(0,B.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,vectorEffect:`non-scaling-stroke`}),(0,B.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,B.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,B.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,B.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,B.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,B.jsx)(`h1`,{className:`oc-signin__title`,children:Cr()}),(0,B.jsx)(`p`,{className:`oc-signin__subtitle`,children:Qt()}),(0,B.jsx)(`div`,{className:`oc-signin__providers`,children:c?.google?(0,B.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,B.jsx)(kOe,{}),(0,B.jsx)(`span`,{children:Ds()})]}):null}),l?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:Wo()}):null,c?.anonymous?(0,B.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:vn()}):null]})]})}function jOe(){let{width:e,collapsed:t,isMobile:n}=o2();return(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`}}),(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`5.5rem`,height:`1.1rem`}})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`100%`,height:`2.25rem`}})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`,borderRadius:`999px`}})})]}),(0,B.jsxs)(`div`,{className:n?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[!t&&!n?(0,B.jsx)(`div`,{className:`oc-sidebar-col`,style:{width:e,flex:`0 0 ${e}px`},children:(0,B.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{height:`2.25rem`,margin:`0.25rem 0.25rem 0`}}),(0,B.jsx)(l9,{})]})}):null,(0,B.jsx)(`main`,{className:`oc-main`})]})]})}function MOe(){let e=I(L.me.getMe,{host:d3}),t=Nt(L.me.bootstrap),n=Nv();(0,z.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),U9(e?.resolvedThemeMode),K9(e?.resolvedFontScale);let r=m3(e?.resolvedThemeMode);h3(e?.resolvedChartTokens,r),pOe(e?.resolvedLocale);let i=(0,z.useRef)(null);if((0,z.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,B.jsx)(jOe,{});let a=e.name||e.email||ss();return e.role===`pending`?(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsx)(q9,{}),(0,B.jsx)(v9,{}),(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,B.jsx)(J9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(y9,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,B.jsxs)(`div`,{className:`oc-pending`,children:[(0,B.jsx)(`h1`,{className:`oc-pending__title`,children:Se()}),(0,B.jsx)(`p`,{className:`oc-pending__body`,children:$ee()})]})]}):(0,B.jsx)(POe,{canOpenSettings:k9(e.permissions??[]).length>0,viewerUserId:e.userId,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function q9(){let e=I(L.me.getImpersonation),t=Nt(L.admin.stopImpersonation);return!e||!e.impersonating?null:(0,B.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,B.jsx)(Xy,{className:`size-4 shrink-0`}),(0,B.jsxs)(`span`,{className:`oc-imp__text`,children:[Ha(),` `,(0,B.jsx)(`strong`,{children:e.targetLabel}),Hr(),(0,B.jsx)(`strong`,{children:e.realLabel}),Rn()]}),(0,B.jsx)(Ih,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:Mt()})]})}function J9({brand:e,resolvedThemeMode:t}){let n=m3(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=O3(e,n),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>s(!1),[a]),(0,B.jsxs)(B.Fragment,{children:[a!==null&&!o?(0,B.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,B.jsx)(A3,{className:`oc-brand__logo`}):null,(0,B.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function NOe({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(Ih,{variant:`ghost`,size:`icon-sm`,"aria-label":i?oa():Ti(),onClick:a,children:i?(0,B.jsx)(Ob,{}):(0,B.jsx)(Db,{})}),(0,B.jsx)(qv,{to:`/`,className:`oc-topbar__brand`,children:(0,B.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(zDe,{})}),(0,B.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,B.jsx)(IDe,{}),(0,B.jsx)(y9,{label:e,mode:t})]})]})}function POe({canOpenSettings:e,viewerUserId:t,userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a}){let{width:o,columnRef:s,collapsed:c,toggleCollapsed:l,collapse:u,startResize:d,isMobile:f}=o2(),p=fy(),m=jv({strict:!1}),h=Nv(),g=!!p({to:`/settings`,fuzzy:!0});(0,z.useEffect)(()=>{f&&u()},[vy({select:e=>e.pathname}),f,u]);let _=(0,z.useCallback)(e=>{h({to:`/chat/$chatId`,params:{chatId:e}})},[h]),{startNewChat:v,picker:y}=g9(_),b=(0,z.useMemo)(()=>FF(AF,PF()),[]);return(0,z.useEffect)(()=>{let e=e=>{IF(e,AF)&&(e.preventDefault(),v())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]),(0,B.jsxs)(`div`,{className:`oc-shell`,children:[y,(0,B.jsx)(kDe,{activeChatId:m.chatId??null}),(0,B.jsx)(q9,{}),(0,B.jsx)(v9,{}),(0,B.jsx)(NOe,{userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a,collapsed:c,onToggleSidebar:l}),(0,B.jsxs)(`div`,{className:f?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[f&&!c?(0,B.jsx)(`div`,{className:`oc-sidebar-backdrop`,onClick:u,"aria-hidden":!0}):null,c?null:(0,B.jsxs)(`div`,{className:`oc-sidebar-col`,ref:e=>{s.current=f?null:e},style:f?void 0:{width:o,flex:`0 0 ${o}px`},children:[g?(0,B.jsx)(YDe,{}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(wDe,{activeChatId:m.chatId??null,onSelect:_,onNewChat:()=>void v(),newChatShortcut:b}),(0,B.jsx)(Ih,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(qv,{to:`/settings/$tab`,params:{tab:`scheduled`},children:[(0,B.jsx)(Oy,{"aria-hidden":!0}),wo()]})}),(0,B.jsx)(Ih,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(qv,{to:`/settings/$tab`,params:{tab:`files`},children:[(0,B.jsx)(ub,{"aria-hidden":!0}),dt()]})}),e?(0,B.jsx)(Ih,{variant:`ghost`,className:`mx-2 mb-2 justify-start`,asChild:!0,children:(0,B.jsxs)(qv,{to:`/settings`,children:[(0,B.jsx)(Wb,{"aria-hidden":!0}),oi()]})}):null]}),(0,B.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:d,role:`separator`,"aria-orientation":`vertical`,"aria-label":jd()})]}),(0,B.jsx)(`main`,{className:`oc-main`,children:(0,B.jsx)(cy,{})}),(0,B.jsx)(Kge,{viewerUserId:t,currentChatId:m.chatId??null})]}),(0,B.jsx)(Bue,{})]})}function FOe(){let e=I(L.me.getMe,{host:d3}),t=Nv(),n=vy({select:e=>e.pathname}),r=(0,z.useMemo)(()=>e?k9(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,z.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:ir()});if(i)return null;let a=j9(n),o=a!==void 0&&!r.includes(a);return(0,B.jsxs)(`div`,{className:`oc-admin`,children:[(0,B.jsx)(JDe,{}),(0,B.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,B.jsx)(IOe,{}):(0,B.jsx)(cy,{})})]})}function IOe(){return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(ex,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:ie()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:qd()})]})}function LOe(){let e=I(L.me.getMe,{host:d3}),t=Nv();return(0,z.useEffect)(()=>{if(e===void 0)return;let n=k9(e.permissions??[]);t({to:n.includes(`files`)?A9(`files`):n.length>0?A9(n[0]):`/`,replace:!0})},[e,t]),(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:ir()})}function ROe(e){switch(e){case`groups`:return(0,B.jsx)(_Oe,{});case`integrations`:return(0,B.jsx)(vOe,{});case`instances`:return(0,B.jsx)(hOe,{});case`injections`:return(0,B.jsx)(gOe,{});case`theme`:return(0,B.jsx)(DOe,{});case`feedbacks`:return(0,B.jsx)(yOe,{});case`subagentReports`:return(0,B.jsx)(bOe,{});case`files`:return(0,B.jsx)(xOe,{});case`scheduled`:return(0,B.jsx)(SOe,{});case`agentFiles`:return(0,B.jsx)(COe,{});case`preferences`:return(0,B.jsx)(wOe,{});case`chatDefaults`:return(0,B.jsx)(TOe,{});case`access`:return(0,B.jsx)(EOe,{});default:return(0,B.jsx)(mOe,{})}}function zOe(){let{tab:e}=jv({from:`/settings/$tab`});return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:ROe(e)})}function BOe(){let{chatId:e}=jv({from:`/chat/$chatId`}),{m:t}=Mv({from:`/chat/$chatId`});return(0,z.useEffect)(()=>{Cxe(e)},[e]),(0,B.jsx)(h8,{chatId:e,focusMessageId:t??null})}function VOe(){let e=Nv(),t=wxe(),n=I(L.messages.listChats,{}),r=t!==null&&n!==void 0&&n.some(e=>e._id===t);return(0,z.useEffect)(()=>{r&&t&&e({to:`/chat/$chatId`,params:{chatId:t},replace:!0})},[r,t,e]),t!==null&&(n===void 0||r)?(0,B.jsx)(`div`,{className:`oc-boot`,children:ir()}):(0,B.jsx)(h8,{chatId:null})}var Y9=Qv({component:OOe}),HOe=Xv({getParentRoute:()=>Y9,path:`/`,component:VOe}),UOe=Xv({getParentRoute:()=>Y9,path:`chat/$chatId`,component:BOe,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),WOe=Xv({getParentRoute:()=>Y9,path:`project/$projectId`,component:$v(()=>WQ(()=>import(`./ProjectPage-BKOn9--c.js`),__vite__mapDeps([39,1,3,30,5,40])),`ProjectPage`),validateSearch:e=>({c:typeof e.c==`string`?e.c:void 0})}),X9=Xv({getParentRoute:()=>Y9,path:`settings`,component:FOe}),GOe=Xv({getParentRoute:()=>X9,path:`/`,component:LOe}),KOe=Xv({getParentRoute:()=>X9,path:`traces`,validateSearch:nOe,component:$v(()=>WQ(()=>import(`./TracesTab-C_EHq15B.js`),__vite__mapDeps([41,1,3,12,23,18,13,5,16,37,15,14])),`TracesTab`)}),qOe=Xv({getParentRoute:()=>X9,path:`bridge`,validateSearch:lOe,component:$v(()=>WQ(()=>import(`./BridgeTab-COQr-xZD.js`),__vite__mapDeps([10,1,3,11,7,8,9,12,13,14,15,5,16,17])),`BridgeTab`)}),JOe=Xv({getParentRoute:()=>X9,path:`voice`,validateSearch:cOe,component:$v(()=>WQ(()=>import(`./VoiceTab-CkceCrfE.js`),__vite__mapDeps([42,1,3,12,5,21])),`VoiceTab`)}),YOe=Xv({getParentRoute:()=>X9,path:`audit`,validateSearch:rOe,component:$v(()=>WQ(()=>import(`./AuditTab-1rUI2z6b.js`),__vite__mapDeps([43,1,3,18,13,5,16,37,23,15,14])),`AuditTab`)}),XOe=Xv({getParentRoute:()=>X9,path:`anomalies`,validateSearch:iOe,component:$v(()=>WQ(()=>import(`./AnomaliesTab-yzNzDsXN.js`),__vite__mapDeps([44,1,3,18,13,5,16,14,15,17])),`AnomaliesTab`)}),ZOe=Xv({getParentRoute:()=>X9,path:`kpi`,validateSearch:aOe,component:$v(()=>WQ(()=>import(`./KpiTab-boTUKc3M.js`),__vite__mapDeps([45,1,3,15,5,38])),`KpiTab`)}),QOe=Xv({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:oOe,component:$v(()=>WQ(()=>import(`./ServiceAccountsTab-DTW2ImlD.js`),__vite__mapDeps([46,1,3,18,13,5,16,14,15,4])),`ServiceAccountsTab`)}),$Oe=Xv({getParentRoute:()=>X9,path:`users`,validateSearch:sOe,component:$v(()=>WQ(()=>import(`./UsersTab-Dk5CxK1-.js`),__vite__mapDeps([47,1,3,18,13,5,16,24,14,15])),`UsersTab`)}),eke=Xv({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw f_({to:`/settings/$tab`,params:{tab:VDe.uiprefs},replace:!0})}}),tke=Xv({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:X4([...E9]).catch(`roles`).parse(e.tab)}),component:zOe});function nke({error:e,reset:t}){let n=Nv(),r=Txe(e),[i]=(0,z.useState)(()=>r&&Oxe(Date.now()));return(0,z.useEffect)(()=>{i&&window.location.reload()},[i]),i?(0,B.jsx)(`div`,{className:`oc-route-error`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:Vi()})}):(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(ex,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:$e()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:ft()}),(0,B.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>{r?window.location.reload():t()},children:To()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:uh()})]})]})}function rke(){let e=Nv();return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(By,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:ze()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:co()}),(0,B.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:uh()})})]})}var Z9=my({routeTree:Y9.addChildren([HOe,UOe,WOe,X9.addChildren([GOe,KOe,JOe,qOe,YOe,XOe,ZOe,QOe,$Oe,eke,tke])]),defaultPreload:`intent`,defaultErrorComponent:nke,defaultNotFoundComponent:rke}),ike=()=>null;function Q9({children:e}){return(0,B.jsx)(`div`,{style:{display:`flex`,minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}var $9=gte.createRoot(document.getElementById(`root`));$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Q9,{children:et()})})),$Se().then(e=>{let t=new si(e);$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Ete,{client:t,children:(0,B.jsxs)(vSe,{children:[(0,B.jsx)(iwe,{children:(0,B.jsx)(_y,{router:Z9})}),(0,B.jsx)(z.Suspense,{fallback:null,children:(0,B.jsx)(ike,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsxs)(Q9,{children:[_u(),` `,e instanceof Error?e.message:String(e)]})}))});export{y0 as $,Mx as $t,x5 as A,eb as An,FF as At,ACe as B,jy as Bn,gF as Bt,M7 as C,yb as Cn,$F as Ct,QTe as D,ib as Dn,qF as Dt,O5 as E,pb as En,YF as Et,A6 as F,Vy as Fn,SF as Ft,m3 as G,Mv as Gn,fk as Gt,cCe as H,ky as Hn,sM as Ht,D6 as I,Ry as In,CF as It,l3 as J,kO as Jt,p3 as K,jv as Kn,dk as Kt,k6 as L,Fy as Ln,yF as Lt,X6 as M,Yy as Mn,vF as Mt,W6 as N,Ky as Nn,bF as Nt,A7 as O,rb as On,PF as Ot,M6 as P,Gy as Pn,xF as Pt,x0 as Q,Bne as Qt,E6 as R,Ny as Rn,hF as Rt,D7 as S,xb as Sn,tI as St,a7 as T,mb as Tn,eI as Tt,G3 as U,Sy as Un,aM as Ut,f6 as V,Ay as Vn,cM as Vt,K3 as W,Nv as Wn,oM as Wt,_0 as X,Rne as Xt,c3 as Y,Lx as Yt,b0 as Z,zne as Zt,q7 as _,Pb as _n,aI as _t,eOe as a,Ox as an,p0 as at,U7 as b,Ab as bn,rI as bt,BDe as c,tx as cn,o0 as ct,g9 as d,Yb as dn,QQ as dt,Fx as en,v0 as et,i9 as f,Ub as fn,nme as ft,X7 as g,Fb as gn,oI as gt,Y7 as h,Ib as hn,WQ as ht,QDe as i,Ax as in,m0 as it,h5 as j,Xy as jn,TF as jt,b5 as k,tb as kn,Aue as kt,D9 as l,ex as ln,s0 as lt,J7 as m,Rb as mn,b1 as mt,I9 as n,kx as nn,f0 as nt,$De as o,ix as on,h0 as ot,Z7 as p,Bb as pn,_1 as pt,d3 as q,ok as qt,ZDe as r,Ix as rn,g0 as rt,tOe as s,nx as sn,Phe as st,G9 as t,Ex as tn,d0 as tt,O9 as u,$b as un,G1 as ut,V7 as v,Nb as vn,XF as vt,r7 as w,vb as wn,QF as wt,R7 as x,Db as xn,ZF as xt,I7 as y,jb as yn,nI as yt,O6 as z,My as zn,_F as zt};
|
|
324
|
+
`},qTe={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 JTe(e){let{announcements:t=qTe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=KTe}=e,{announce:a,announcement:o}=UTe(),s=l5(`DndLiveRegion`),[c,l]=(0,z.useState)(!1);if((0,z.useEffect)(()=>{l(!0)},[]),WTe((0,z.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=z.createElement(z.Fragment,null,z.createElement(VTe,{id:r,value:i.draggable}),z.createElement(HTe,{id:s,announcement:o}));return n?(0,Fv.createPortal)(u,n):u}var v5;(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`})(v5||={});function y5(){}function b5(e,t){return(0,z.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function x5(){var e=[...arguments];return(0,z.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var S5=Object.freeze({x:0,y:0});function C5(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function YTe(e,t){let n=m5(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 w5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function XTe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function T5(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 E5(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function D5(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 ZTe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=D5(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=C5(D5(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(w5)},O5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=T5(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=T5(r),o=i.reduce((e,t,r)=>e+C5(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(w5)};function QTe(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 $Te=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=QTe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(XTe)};function eEe(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var tEe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&eEe(r,a)){let n=T5(a).reduce((e,t)=>e+C5(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(w5)};function nEe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function k5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:S5}function rEe(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 iEe=rEe(1);function A5(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 aEe(e,t,n){let r=A5(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 oEe={ignoreTransform:!1};function j5(e,t){t===void 0&&(t=oEe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Z8(e).getComputedStyle(e);t&&(n=aEe(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 M5(e){return j5(e,{ignoreTransform:!0})}function sEe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function cEe(e,t){return t===void 0&&(t=Z8(e).getComputedStyle(e)),t.position===`fixed`}function lEe(e,t){t===void 0&&(t=Z8(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 N5(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Q8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!$8(i)||e5(i)||n.includes(i))return n;let a=Z8(e).getComputedStyle(i);return i!==e&&lEe(i,a)&&n.push(i),cEe(i,a)?n:r(i.parentNode)}return e?r(e):n}function P5(e){let[t]=N5(e,1);return t??null}function F5(e){return!J8||!e?null:Y8(e)?e:X8(e)?Q8(e)||e===t5(e).scrollingElement?window:$8(e)?e:null:null}function I5(e){return Y8(e)?e.scrollX:e.scrollLeft}function L5(e){return Y8(e)?e.scrollY:e.scrollTop}function R5(e){return{x:I5(e),y:L5(e)}}var z5;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(z5||={});function B5(e){return!J8||!e?!1:e===document.scrollingElement}function V5(e){let t={x:0,y:0},n=B5(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 uEe={x:.2,y:.2};function dEe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=uEe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=V5(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=z5.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=z5.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=z5.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=z5.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function fEe(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 H5(e){return e.reduce((e,t)=>d5(e,R5(t)),S5)}function pEe(e){return e.reduce((e,t)=>e+I5(t),0)}function mEe(e){return e.reduce((e,t)=>e+L5(t),0)}function U5(e,t){if(t===void 0&&(t=j5),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);P5(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var hEe=[[`x`,[`left`,`right`],pEe],[`y`,[`top`,`bottom`],mEe]],W5=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=N5(t),r=H5(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of hEe)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})}},G5=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 gEe(e){let{EventTarget:t}=Z8(e);return e instanceof t?e:t5(e)}function K5(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 q5;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(q5||={});function J5(e){e.preventDefault()}function _Ee(e){e.stopPropagation()}var Y5;(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`})(Y5||={});var X5={start:[Y5.Space,Y5.Enter],cancel:[Y5.Esc],end:[Y5.Space,Y5.Enter,Y5.Tab]},vEe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Y5.Right:return{...n,x:n.x+25};case Y5.Left:return{...n,x:n.x-25};case Y5.Down:return{...n,y:n.y+25};case Y5.Up:return{...n,y:n.y-25}}},Z5=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 G5(t5(t)),this.windowListeners=new G5(Z8(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(q5.Resize,this.handleCancel),this.windowListeners.add(q5.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(q5.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&U5(n),t(S5)}handleKeyDown(e){if(p5(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=X5,coordinateGetter:a=vEe,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}:S5;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=f5(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}=V5(n),p=fEe(n),m={x:Math.min(i===Y5.Right?p.right-p.width/2:p.right,Math.max(i===Y5.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Y5.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Y5.Down?p.top:p.top+p.height/2,u.y))},h=i===Y5.Right&&!s||i===Y5.Left&&!c,g=i===Y5.Down&&!l||i===Y5.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Y5.Right&&e<=d.x||i===Y5.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Y5.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===Y5.Down&&e<=d.y||i===Y5.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Y5.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,d5(f5(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()}};Z5.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=X5,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 Q5(e){return!!(e&&`distance`in e)}function $5(e){return!!(e&&`delay`in e)}var e7=class{constructor(e,t,n){n===void 0&&(n=gEe(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=t5(i),this.documentListeners=new G5(this.document),this.listeners=new G5(n),this.windowListeners=new G5(Z8(i)),this.initialCoordinates=m5(r)??S5,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(q5.Resize,this.handleCancel),this.windowListeners.add(q5.DragStart,J5),this.windowListeners.add(q5.VisibilityChange,this.handleCancel),this.windowListeners.add(q5.ContextMenu,J5),this.documentListeners.add(q5.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($5(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Q5(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(q5.Click,_Ee,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(q5.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=m5(e)??S5,s=f5(n,o);if(!t&&a){if(Q5(a)){if(a.tolerance!=null&&K5(s,a.tolerance))return this.handleCancel();if(K5(s,a.distance))return this.handleStart()}if($5(a)&&K5(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===Y5.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},yEe={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},t7=class extends e7{constructor(e){let{event:t}=e,n=t5(t.target);super(e,yEe,n)}};t7.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 bEe={move:{name:`mousemove`},end:{name:`mouseup`}},n7;(function(e){e[e.RightClick=2]=`RightClick`})(n7||={});var r7=class extends e7{constructor(e){super(e,bEe,t5(e.event.target))}};r7.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===n7.RightClick?!1:(r?.({event:n}),!0)}}];var i7={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},a7=class extends e7{constructor(e){super(e,i7)}static setup(){return window.addEventListener(i7.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(i7.move.name,e)};function e(){}}};a7.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 o7;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(o7||={});var s7;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(s7||={});function xEe(e){let{acceleration:t,activator:n=o7.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=s7.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=CEe({delta:d,disabled:!a}),[m,h]=ITe(),g=(0,z.useRef)({x:0,y:0}),_=(0,z.useRef)({x:0,y:0}),v=(0,z.useMemo)(()=>{switch(n){case o7.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case o7.DraggableRect:return i}},[n,i,c]),y=(0,z.useRef)(null),b=(0,z.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,z.useMemo)(()=>s===s7.TreeOrder?[...l].reverse():l,[s,l]);(0,z.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=dEe(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 SEe={x:{[z5.Backward]:!1,[z5.Forward]:!1},y:{[z5.Backward]:!1,[z5.Forward]:!1}};function CEe(e){let{delta:t,disabled:n}=e,r=s5(t);return a5(e=>{if(n||!r||!e)return SEe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[z5.Backward]:e.x[z5.Backward]||i.x===-1,[z5.Forward]:e.x[z5.Forward]||i.x===1},y:{[z5.Backward]:e.y[z5.Backward]||i.y===-1,[z5.Forward]:e.y[z5.Forward]||i.y===1}}},[n,t,r])}function wEe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return a5(e=>t==null?null:r??e??null,[r,t])}function TEe(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var c7;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(c7||={});var l7;(function(e){e.Optimized=`optimized`})(l7||={});var u7=new Map;function EEe(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,z.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,z.useRef)(e),d=g(),f=i5(d),p=(0,z.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,z.useRef)(null),h=a5(t=>{if(d&&!n)return u7;if(!t||t===u7||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 W5(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,z.useEffect)(()=>{u.current=e},[e]),(0,z.useEffect)(()=>{d||p()},[n,d]),(0,z.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,z.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case c7.Always:return!1;case c7.BeforeDragging:return n;default:return!n}}}function d7(e,t){return a5(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function DEe(e,t){return d7(e,t)}function OEe(e){let{callback:t,disabled:n}=e,r=r5(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function f7(e){let{callback:t,disabled:n}=e,r=r5(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function kEe(e){return new W5(j5(e),e)}function p7(e,t,n){t===void 0&&(t=kEe);let[r,i]=(0,z.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=OEe({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=f7({callback:a});return n5(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function AEe(e){return k5(e,d7(e))}var m7=[];function jEe(e){let t=(0,z.useRef)(e),n=a5(n=>e?n&&n!==m7&&e&&t.current&&e.parentNode===t.current.parentNode?n:N5(e):m7,[e]);return(0,z.useEffect)(()=>{t.current=e},[e]),n}function MEe(e){let[t,n]=(0,z.useState)(null),r=(0,z.useRef)(e),i=(0,z.useCallback)(e=>{let t=F5(e.target);t&&n(e=>e?(e.set(t,R5(t)),new Map(e)):null)},[]);return(0,z.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=F5(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,R5(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=>{F5(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,z.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>d5(e,t),S5):H5(e):S5,[e,t])}function h7(e,t){t===void 0&&(t=[]);let n=(0,z.useRef)(null);return(0,z.useEffect)(()=>{n.current=null},t),(0,z.useEffect)(()=>{let t=e!==S5;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?f5(e,n.current):S5}function NEe(e){(0,z.useEffect)(()=>{if(!J8)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 PEe(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function g7(e){return(0,z.useMemo)(()=>e?sEe(e):null,[e])}var _7=[];function FEe(e,t){t===void 0&&(t=j5);let[n]=e,r=g7(n?Z8(n):null),[i,a]=(0,z.useState)(_7);function o(){a(()=>e.length?e.map(e=>B5(e)?r:new W5(t(e),e)):_7)}let s=f7({callback:o});return n5(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function v7(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return $8(t)?t:e}function IEe(e){let{measure:t}=e,[n,r]=(0,z.useState)(null),i=f7({callback:(0,z.useCallback)(e=>{for(let{target:n}of e)if($8(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=o5((0,z.useCallback)(e=>{let n=v7(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,z.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var LEe=[{sensor:t7,options:{}},{sensor:Z5,options:{}}],REe={current:{}},y7={draggable:{measure:M5},droppable:{measure:M5,strategy:c7.WhileDragging,frequency:l7.Optimized},dragOverlay:{measure:j5}},b7=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}},zEe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new b7,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:y5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:y7,measureDroppableContainers:y5,windowRect:null,measuringScheduled:!1},x7={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:y5,draggableNodes:new Map,over:null,measureDroppableContainers:y5},S7=(0,z.createContext)(x7),C7=(0,z.createContext)(zEe);function BEe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new b7}}}function VEe(e,t){switch(t.type){case v5.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case v5.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 v5.DragEnd:case v5.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case v5.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new b7(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case v5.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 b7(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case v5.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new b7(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function HEe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,z.useContext)(S7),a=s5(r),o=s5(n?.id);return(0,z.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!p5(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=zTe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function w7(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function UEe(e){return(0,z.useMemo)(()=>({draggable:{...y7.draggable,...e?.draggable},droppable:{...y7.droppable,...e?.droppable},dragOverlay:{...y7.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function WEe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,z.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;n5(()=>{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=k5(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=P5(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var T7=(0,z.createContext)({...S5,scaleX:1,scaleY:1}),E7;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(E7||={});var D7=(0,z.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=LEe,collisionDetection:o=$Te,measuring:s,modifiers:c,...l}=e,[u,d]=(0,z.useReducer)(VEe,void 0,BEe),[f,p]=GTe(),[m,h]=(0,z.useState)(E7.Uninitialized),g=m===E7.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,z.useRef)({initial:null,translated:null}),C=(0,z.useMemo)(()=>_==null?null:{id:_,data:x?.data??REe,rect:S},[_,x]),w=(0,z.useRef)(null),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),k=i5(l,Object.values(l)),A=l5(`DndDescribedBy`,t),ee=(0,z.useMemo)(()=>b.getEnabled(),[b]),j=UEe(s),{droppableRects:M,measureDroppableContainers:te,measuringScheduled:N}=EEe(ee,{dragging:g,dependencies:[y.x,y.y],config:j.droppable}),P=wEe(v,_),ne=(0,z.useMemo)(()=>D?m5(D):null,[D]),re=Pe(),ie=DEe(P,j.draggable.measure);WEe({activeNode:_==null?null:v.get(_),config:re.layoutShiftCompensation,initialRect:ie,measure:j.draggable.measure});let ae=p7(P,j.draggable.measure,ie),oe=p7(P?P.parentElement:null),se=(0,z.useRef)({activatorEvent:null,active:null,activeNode:P,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=b.getNodeFor(se.current.over?.id),le=IEe({measure:j.dragOverlay.measure}),ue=le.nodeRef.current??P,de=g?le.rect??ae:null,fe=!!(le.nodeRef.current&&le.rect),pe=AEe(fe?null:ae),me=g7(ue?Z8(ue):null),he=jEe(g?ce??P:null),ge=FEe(he),_e=w7(c,{transform:{x:y.x-pe.x,y:y.y-pe.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:de,over:se.current.over,overlayNodeRect:le.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=ne?d5(ne,y):null,ye=MEe(he),be=h7(ye),xe=h7(ye,[ae]),Se=d5(_e,be),Ce=de?iEe(de,_e):null,we=C&&Ce?o({active:C,collisionRect:Ce,droppableRects:M,droppableContainers:ee,pointerCoordinates:ve}):null,Te=E5(we,`id`),[Ee,De]=(0,z.useState)(null),Oe=nEe(fe?_e:d5(_e,xe),Ee?.rect??null,ae),ke=(0,z.useRef)(null),Ae=(0,z.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;ke.current=new n({active:w.current,activeNode:i,event:a,options:r,context:se,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Fv.unstable_batchedUpdates)(()=>{r?.(i),h(E7.Initializing),d({type:v5.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(ke.current),O(a)})},onMove(e){d({type:v5.DragMove,coordinates:e})},onEnd:o(v5.DragEnd),onCancel:o(v5.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=se.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===v5.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=v5.DragCancel)}w.current=null,(0,Fv.unstable_batchedUpdates)(()=>{d({type:e}),h(E7.Uninitialized),De(null),E(null),O(null),ke.current=null;let t=e===v5.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),je=TEe(a,(0,z.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Ae(n,t))},[v,Ae]));NEe(a),n5(()=>{ae&&m===E7.Initializing&&h(E7.Initialized)},[ae,m]),(0,z.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=se.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:Se.x,y:Se.y},over:i};(0,Fv.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[Se.x,Se.y]),(0,z.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=se.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Te),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Fv.unstable_batchedUpdates)(()=>{De(s),a?.(c),f({type:`onDragOver`,event:c})})},[Te]),n5(()=>{se.current={activatorEvent:D,active:C,activeNode:P,collisionRect:Ce,collisions:we,droppableRects:M,draggableNodes:v,draggingNode:ue,draggingNodeRect:de,droppableContainers:b,over:Ee,scrollableAncestors:he,scrollAdjustedTranslate:Se},S.current={initial:de,translated:Ce}},[C,P,we,Ce,v,ue,de,M,b,Ee,he,Se]),xEe({...re,delta:y,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Me=(0,z.useMemo)(()=>({active:C,activeNode:P,activeNodeRect:ae,activatorEvent:D,collisions:we,containerNodeRect:oe,dragOverlay:le,draggableNodes:v,droppableContainers:b,droppableRects:M,over:Ee,measureDroppableContainers:te,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:j,measuringScheduled:N,windowRect:me}),[C,P,ae,D,we,oe,le,v,b,M,Ee,te,he,ge,j,N,me]),Ne=(0,z.useMemo)(()=>({activatorEvent:D,activators:je,active:C,activeNodeRect:ae,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:Ee,measureDroppableContainers:te}),[D,je,C,ae,d,A,v,Ee,te]);return z.createElement(_5.Provider,{value:p},z.createElement(S7.Provider,{value:Ne},z.createElement(C7.Provider,{value:Me},z.createElement(T7.Provider,{value:Oe},i)),z.createElement(HEe,{disabled:n?.restoreFocus===!1})),z.createElement(JTe,{...n,hiddenTextDescribedById:A}));function Pe(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),GEe=(0,z.createContext)(null),O7=`button`,KEe=`Draggable`;function qEe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=l5(KEe),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,z.useContext)(S7),{role:p=O7,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,z.useContext)(g?T7:GEe),[v,y]=o5(),[b,x]=o5(),S=PEe(o,t),C=i5(n);return n5(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,z.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===O7?!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 k7(){return(0,z.useContext)(C7)}var JEe=`Droppable`,YEe={timeout:25};function A7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=l5(JEe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,z.useContext)(S7),u=(0,z.useRef)({disabled:n}),d=(0,z.useRef)(!1),f=(0,z.useRef)(null),p=(0,z.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...YEe,...i},_=i5(h??r),v=f7({callback:(0,z.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=o5((0,z.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=i5(t);return(0,z.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,z.useEffect)(()=>(s({type:v5.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:v5.UnregisterDroppable,key:a,id:r})),[r]),(0,z.useEffect)(()=>{n!==u.current.disabled&&(s({type:v5.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 XEe(e){let{animation:t,children:n}=e,[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(null),s=s5(n);return!n&&!r&&s&&i(s),n5(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),z.createElement(z.Fragment,null,n,r?(0,z.cloneElement)(r,{ref:o}):null)}var ZEe={x:0,y:0,scaleX:1,scaleY:1};function QEe(e){let{children:t}=e;return z.createElement(S7.Provider,{value:x7},z.createElement(T7.Provider,{value:ZEe},t))}var $Ee={position:`fixed`,touchAction:`none`},eDe=e=>p5(e)?`transform 250ms ease`:void 0,tDe=(0,z.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=eDe}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...$Ee,width:s.width,height:s.height,top:s.top,left:s.left,transform:h5.Transform.toString(d),transformOrigin:i&&r?YTe(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return z.createElement(n,{className:o,style:f,ref:t},a)}),nDe={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:h5.Transform.toString(t)},{transform:h5.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 rDe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return r5((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=v7(a);if(!c)return;let{transform:l}=Z8(a).getComputedStyle(a),u=A5(l);if(!u)return;let d=typeof t==`function`?t:iDe(t);return U5(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 iDe(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...nDe,...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 j7=0;function aDe(e){return(0,z.useMemo)(()=>{if(e!=null)return j7++,j7},[e])}var M7=z.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=k7(),S=(0,z.useContext)(T7),C=aDe(d?.id),w=w7(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=d7(f),E=rDe({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return z.createElement(QEe,null,z.createElement(XEe,{animation:E},d&&C?z.createElement(tDe,{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))}),oDe=e=>{let{transform:t}=e;return{...t,y:0}};function sDe(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 cDe=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:sDe(n,t,i)},lDe=e=>{let{transform:t}=e;return{...t,x:0}};function N7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function uDe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function P7(e){return e!==null&&e>=0}function dDe(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 fDe(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var F7={scaleX:1,scaleY:1},pDe=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=mDe(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,...F7}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...F7}:a<r&&a>=i?{x:o.width+s,y:0,...F7}:{x:0,y:0,...F7}};function mDe(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 I7=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=N7(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}},L7={scaleX:1,scaleY:1},R7=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,...L7}:null}let s=hDe(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...L7}:r<t&&r>=a?{x:0,y:o.height+s,...L7}:{x:0,y:0,...L7}};function hDe(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 z7=`Sortable`,B7=z.createContext({activeIndex:-1,containerId:z7,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:I7,disabled:{draggable:!1,droppable:!1}});function V7(e){let{children:t,id:n,items:r,strategy:i=I7,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=k7(),d=l5(z7,n),f=s.rect!==null,p=(0,z.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,z.useRef)(p),v=!dDe(p,_.current),y=g!==-1&&h===-1||v,b=fDe(a);n5(()=>{v&&m&&u(p)},[v,p,m,u]),(0,z.useEffect)(()=>{_.current=p},[p]);let x=(0,z.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:uDe(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return z.createElement(B7.Provider,{value:x},t)}var gDe=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return N7(n,r,i).indexOf(t)},_De=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},vDe={duration:200,easing:`ease`},H7=`transform`,yDe=h5.Transition.toString({property:H7,duration:0,easing:`linear`}),bDe={roleDescription:`sortable`};function xDe(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,z.useState)(null),s=(0,z.useRef)(n);return n5(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=j5(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,z.useEffect)(()=>{a&&o(null)},[a]),a}function U7(e){let{animateLayoutChanges:t=_De,attributes:n,disabled:r,data:i,getNewIndex:a=gDe,id:o,strategy:s,resizeObserverConfig:c,transition:l=vDe}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,z.useContext)(B7),y=SDe(r,p),b=u.indexOf(o),x=(0,z.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,z.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=A7({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:ee,listeners:j,isDragging:M,over:te,setActivatorNodeRef:N,transform:P}=qEe({id:o,data:x,attributes:{...bDe,...n},disabled:y.draggable}),ne=FTe(E,ee),re=!!D,ie=re&&!m&&P7(f)&&P7(g),ae=!_&&M,oe=ie?(ae&&ie?P:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,se=P7(f)&&P7(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ce=D?.id,le=(0,z.useRef)({activeId:ce,items:u,newIndex:se,containerId:d}),ue=u!==le.current.items,de=t({active:D,containerId:d,isDragging:M,isSorting:re,id:o,index:b,items:u,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),fe=xDe({disabled:!de,index:b,node:w,rect:C});return(0,z.useEffect)(()=>{re&&le.current.newIndex!==se&&(le.current.newIndex=se),d!==le.current.containerId&&(le.current.containerId=d),u!==le.current.items&&(le.current.items=u)},[re,se,d,u]),(0,z.useEffect)(()=>{if(ce===le.current.activeId)return;if(ce!=null&&le.current.activeId==null){le.current.activeId=ce;return}let e=setTimeout(()=>{le.current.activeId=ce},50);return()=>clearTimeout(e)},[ce]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:se,items:u,isOver:T,isSorting:re,isDragging:M,listeners:j,node:w,overIndex:g,over:te,setNodeRef:ne,setActivatorNodeRef:N,setDroppableNodeRef:E,setDraggableNodeRef:ee,transform:fe??oe,transition:pe()};function pe(){if(fe||ue&&le.current.newIndex===b)return yDe;if(!(ae&&!p5(O)||!l)&&(re||de))return h5.Transition.toString({...l,property:H7})}}function SDe(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function W7(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 CDe=[Y5.Down,Y5.Right,Y5.Up,Y5.Left],G7=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(CDe.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 Y5.Down:r.top<a.top&&t.push(n);break;case Y5.Up:r.top>a.top&&t.push(n);break;case Y5.Left:r.left>a.left&&t.push(n);break;case Y5.Right:r.left<a.left&&t.push(n);break}});let c=O5({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=E5(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=N5(c).some((e,t)=>s[t]!==e),i=K7(e,t),a=wDe(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:f5(u,l)}}}};function K7(e,t){return!W7(e)||!W7(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function wDe(e,t){return!W7(e)||!W7(t)||!K7(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function q7({open:e,onOpenChange:t,title:n,description:r,children:i,onSubmit:a,submitLabel:o,submitting:s=!1,canSubmit:c=!0}){let[l,u]=(0,z.useState)(!1),d=s||l;async function f(){if(!(!c||d))try{u(!0),await a()}finally{u(!1)}}return(0,B.jsx)(N6,{open:e,onOpenChange:t,children:(0,B.jsxs)(P6,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,B.jsxs)(F6,{className:`border-b px-6 py-4`,children:[(0,B.jsx)(L6,{children:n}),r?(0,B.jsx)(R6,{children:r}):null]}),(0,B.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,B.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:i}),(0,B.jsxs)(I6,{className:`border-t px-6 py-4`,children:[(0,B.jsxs)(Ih,{type:`submit`,disabled:!c||d,children:[d?(0,B.jsx)(pb,{className:`size-4 animate-spin`}):null,o??ju()]}),(0,B.jsx)(Ih,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:Wu()})]})]})]})})}var J7=[{value:`red`,hue:`var(--oc-accent-red, oklch(0.63 0.21 25))`},{value:`orange`,hue:`var(--oc-accent-orange, oklch(0.7 0.17 50))`},{value:`amber`,hue:`var(--oc-accent-amber, oklch(0.8 0.15 85))`},{value:`green`,hue:`var(--oc-accent-green, oklch(0.7 0.16 150))`},{value:`teal`,hue:`var(--oc-accent-teal, oklch(0.7 0.12 190))`},{value:`blue`,hue:`var(--oc-accent-blue, oklch(0.62 0.19 250))`},{value:`violet`,hue:`var(--oc-accent-violet, oklch(0.6 0.2 300))`},{value:`pink`,hue:`var(--oc-accent-pink, oklch(0.7 0.2 350))`}],Y7=e=>J7.find(t=>t.value===e)?.hue??null;function TDe(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return J7[t%J7.length].hue}var X7=e=>Y7(e.color)??TDe(e._id);function Z7({open:e,onOpenChange:t,title:n,movingFolderId:r,currentId:i,onPick:a}){let o=I(L.projects.listProjects,e?{}:`skip`),[s,c]=(0,z.useState)(``),l=(0,z.useMemo)(()=>{let e=o??[],t=Nxe(e),n=s.trim().toLowerCase();return(n===``?t:t.filter(e=>e.node.name.toLowerCase().includes(n))).map(t=>({...t,disabled:r!==void 0&&!l3(e,r,t.node._id)}))},[o,s,r]),u=()=>{t(!1),c(``)};return(0,B.jsx)(d0,{open:e,onOpenChange:e=>{e||c(``),t(e)},children:(0,B.jsxs)(f0,{className:`oc-folderpick`,showCloseButton:!1,children:[(0,B.jsx)(p0,{children:(0,B.jsx)(h0,{children:n})}),(0,B.jsx)(EF,{autoFocus:!0,value:s,onChange:e=>c(e.target.value),placeholder:Yo()}),(0,B.jsxs)(`div`,{className:`oc-folderpick__list`,role:`listbox`,children:[(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i===null,className:`oc-folderpick__opt`,onClick:()=>{a(null),u()},children:[(0,B.jsx)(Uy,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:on()}),i===null?(0,B.jsx)(ky,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]}),l.length===0?(0,B.jsx)(`p`,{className:`oc-folderpick__empty`,children:ue()}):l.map(({node:e,depth:t,disabled:n})=>(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e._id===i,disabled:n,className:`oc-folderpick__opt`,style:{"--pick-depth":t-1,"--proj-hue":X7(e)},onClick:()=>{a(e._id),u()},children:[(0,B.jsx)(rb,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:e.name}),e._id===i?(0,B.jsx)(ky,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]},e._id))]})]})})}var Q7=6e4,$7=60*Q7,e9=24*$7,t9=7*e9,n9=30*e9,r9=365*e9;function i9(e,t){let n=t-e;if(n<Q7)return`maintenant`;if(n<$7)return`${Math.floor(n/Q7)}min`;if(n<e9)return`${Math.floor(n/$7)}h`;if(n<t9)return`${Math.floor(n/e9)}j`;if(n<n9)return`${Math.floor(n/t9)}sem`;if(n<r9)return`${Math.floor(n/n9)}mois`;let r=Math.floor(n/r9);return`${r}an${r>1?`s`:``}`}var a9=`project:none`,EDe=e=>`project:${e}`,o9=`projhead:`,s9=e=>`${o9}${e}`,c9=`oc.noproject.collapsed`;function l9(){return(0,B.jsx)(`div`,{className:`oc-sidebar__skeleton`,"aria-hidden":`true`,children:Array.from({length:7}).map((e,t)=>(0,B.jsx)(`div`,{className:`oc-skel oc-skel--row`},t))})}function DDe({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=I(L.messages.listChats,{}),a=I(L.projects.listProjects,{}),o=I(L.me.getMe,{host:d3})?.ui?.effective?.showChatAge??!0,s=I(L.chatReads.myChatReads,{}),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of s??[])e.set(t.chatId,t.lastSeenAt);return e},[s]),l=I(L.chatReads.myBusyChats,{}),u=(0,z.useMemo)(()=>new Set(l??[]),[l]),d=I(L.chatBookmarks.myBookmarkedChats,{}),f=I(L.chatExport.referenceLabel,{}),p=(0,z.useMemo)(()=>new Set(d??[]),[d]),m=(0,z.useMemo)(()=>{let t=new Set;for(let n of i??[]){if(n._id===e)continue;let r=c.get(n._id);r!==void 0&&n.lastAssistantAt!==null&&n.lastAssistantAt>r&&t.add(n._id)}return t},[i,c,e]),[h,g]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>g(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let _=Nt(L.projects.createProject),v=Nt(L.projects.setProjectCollapsed),y=Nt(L.projects.setProjectSidebar),b=Nt(L.chats.reorderChat),x=Nt(L.projects.reorderProject),S=Nt(L.chats.moveChatToProject),C=K3(),w=Qee(),T=(0,z.useRef)(null),E=(0,z.useRef)(null),D=(0,z.useRef)(null),[O,k]=(0,z.useState)(`full`);(0,z.useLayoutEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=E.current?.offsetWidth??0,r=D.current?.offsetWidth??0,i=n===0||t>=n?`full`:t>=r?`label`:`icon`;k(e=>e===i?e:i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[w,r]);let[A,ee]=(0,z.useState)(null),j=(0,z.useRef)(!1);(0,z.useEffect)(()=>{!j.current&&i&&ee(i)},[i]);let M=A??i??[],te=i===void 0&&A===null,[N,P]=(0,z.useState)(null),[ne,re]=(0,z.useState)(()=>localStorage.getItem(c9)===`1`);function ie(){re(e=>(localStorage.setItem(c9,e?`0`:`1`),!e))}let ae=$3();(0,z.useEffect)(()=>{if(!ae?.expand)return;let e=M.find(e=>e._id===ae.chatId);if(!e)return;let t=e.projectId??null;if(t===null){ne&&(localStorage.setItem(c9,`0`),re(!1));return}let n=(a??[]).find(e=>e._id===t);n&&n.parentId!==null||n?.collapsed&&v({projectId:t,collapsed:!1})},[ae,M,a,ne,v]);let oe=x5(b5(r7,{activationConstraint:{distance:4}}),b5(a7,{activationConstraint:{delay:250,tolerance:8}}),b5(Z5,{coordinateGetter:G7})),se=(0,z.useRef)(!1),ce=()=>{se.current=!0,setTimeout(()=>{se.current=!1},0)},le=(0,z.useCallback)(e=>String(e.active.id).startsWith(o9)?O5({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(o9))}):O5(e),[]),ue=M.filter(e=>e.pinned),de=M.filter(e=>!e.pinned),fe=e=>de.filter(t=>(t.projectId??null)===e),pe=Nv(),me=(0,z.useMemo)(()=>kxe(a??[]),[a]),he=(0,z.useMemo)(()=>me.filter(e=>!e.sidebarHidden),[me]),ge=(0,z.useMemo)(()=>me.filter(e=>e.sidebarHidden),[me]),_e=(0,z.useMemo)(()=>{let e=a??[];return new Map(e.map(t=>[t._id,Mxe(e,t._id)]))},[a]),ve=(0,z.useMemo)(()=>new Map((a??[]).map(e=>[e._id,e.name])),[a]),ye=e=>de.filter(t=>t.projectId!==null&&(_e.get(t.projectId)??t.projectId)===e);function be(e){return M.find(t=>t._id===e)}async function xe(e){P(null),ce();let{active:t,over:n}=e;if(!n)return;let r=String(t.id),i=String(n.id);if(r.startsWith(o9)){let e=r.slice(9),t=he,n=null;if(i.startsWith(o9))n=i.slice(9);else if(i.startsWith(`project:`)&&i!==a9)n=i.slice(8);else{let e=be(i);n=e&&!e.pinned?e.projectId??null:null}if(n===null||n===e)return;let a=t.findIndex(t=>t._id===e),o=t.findIndex(e=>e._id===n);if(a<0||o<0)return;let s=[...t],[c]=s.splice(a,1);s.splice(o,0,c);let l=s[o-1]??null,u=s[o+1]??null;await x({projectId:e,prevKey:l?l.sortKey:null,nextKey:u?u.sortKey:null});return}let a=be(r);if(!a)return;if(i.startsWith(o9)){let e=i.slice(9);if((a.projectId??null)===e)return;j.current=!0,ee(t=>(t??M).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await S({chatId:a._id,projectId:e})}finally{j.current=!1}return}if(i.startsWith(`project:`)){let e=i===a9?null:i.slice(8);if((a.projectId??null)===e)return;j.current=!0,ee(t=>(t??M).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await S({chatId:a._id,projectId:e})}finally{j.current=!1}return}let o=be(i);if(!o||t.id===n.id)return;if((o.projectId??null)!==(a.projectId??null)||o.pinned!==a.pinned){if(a.pinned||o.pinned)return;j.current=!0,ee(e=>(e??M).map(e=>e._id===a._id?{...e,projectId:o.projectId??null}:e));try{await S({chatId:a._id,projectId:o.projectId??null})}finally{j.current=!1}return}let s=o.pinned?ue:fe(o.projectId??null),c=s.map(e=>e._id),l=c.indexOf(a._id),u=c.indexOf(o._id);if(l<0||u<0)return;let d=[...s];d.splice(l,1),d.splice(u,0,a);let f=d[u-1]??null,p=d[u+1]??null;j.current=!0,ee(e=>[...(e??M).filter(e=>!s.some(t=>t._id===e._id)),...d]);try{await b({chatId:a._id,prevKey:f?f.sortKey:null,nextKey:p?p.sortKey:null})}finally{j.current=!1}}let Se=q8(),Ce=Se?NTe(Se.state):null,[we,Te]=(0,z.useState)(!1),Ee=N?be(N):null;return(0,B.jsxs)(`aside`,{className:`oc-sidebar`+(we?` oc-sidebar--archivedrop`:``),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),Te(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Te(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes(`Files`))return;e.preventDefault(),Te(!1);let t=e.dataTransfer.files[0];t!==void 0&&Se?.importArchive(t,null)},children:[we?(0,B.jsxs)(`div`,{className:`oc-sidebar__droparchive`,"aria-hidden":!0,children:[(0,B.jsx)(tx,{className:`size-4`}),(0,B.jsx)(`span`,{children:ca()})]}):null,Ce===null?null:(0,B.jsxs)(`div`,{className:`oc-sidebar__transfer`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-spin`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-label`,children:Ce})]}),(0,B.jsxs)(`div`,{className:`oc-sidebar__top`,ref:T,children:[(0,B.jsxs)(Ih,{className:O===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,title:`${w} (${r})`,"aria-label":w,children:[(0,B.jsx)(Ib,{}),O===`icon`?null:(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w}),O===`full`?(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,"aria-hidden":!0,children:r}):null]}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:E,children:[(0,B.jsxs)(Ih,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(Ib,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w}),(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,B.jsx)(Ih,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(tb,{})})]})}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:D,children:[(0,B.jsxs)(Ih,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(Ib,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:w})]}),(0,B.jsx)(Ih,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(tb,{})})]})}),(0,B.jsx)(Ih,{className:`oc-newproject`,variant:`outline`,size:`icon`,"aria-label":Va(),title:Va(),onClick:async()=>{let e=await C({title:Va(),label:Vr(),placeholder:Ln(),confirmLabel:jt()});e&&await _({name:e})},children:(0,B.jsx)(tb,{})})]}),(0,B.jsxs)(D7,{sensors:oe,collisionDetection:le,modifiers:[lDe,cDe],onDragStart:e=>P(String(e.active.id)),onDragCancel:()=>{P(null),ce()},onDragEnd:xe,children:[(0,B.jsx)(`div`,{className:`oc-sidebar__scroll`,children:te?(0,B.jsx)(l9,{}):(0,B.jsxs)(B.Fragment,{children:[ue.length>0?(0,B.jsx)(u9,{label:aa(),chats:ue,children:ue.map(n=>(0,B.jsx)(d9,{chat:n,active:n._id===e,unread:m.has(n._id),busy:u.has(n._id),bookmarked:p.has(n._id),referenceLabel:f,ageTick:h,suppressClick:se,onSelect:t},n._id))}):null,(0,B.jsx)(V7,{items:he.map(e=>s9(e._id)),strategy:R7,children:he.map(n=>{let r=ye(n._id);return(0,B.jsx)(u9,{label:n.name,dropId:EDe(n._id),sortId:s9(n._id),suppressClick:se,projectId:n._id,project:n,chats:r,collapsible:!0,collapsed:n.collapsed,busy:r.some(e=>u.has(e._id)),unread:r.some(e=>m.has(e._id)),onToggle:()=>void v({projectId:n._id,collapsed:!n.collapsed}),onOpen:()=>void pe({to:`/project/$projectId`,params:{projectId:n._id}}),children:n.collapsed?null:r.length===0?(0,B.jsx)(`div`,{className:`oc-sidebar__empty`,children:wi()}):r.map(r=>(0,B.jsx)(d9,{chat:r,active:r._id===e,unread:m.has(r._id),busy:u.has(r._id),bookmarked:p.has(r._id),referenceLabel:f,domainLabel:r.projectId!==null&&r.projectId!==n._id?ve.get(r.projectId)??null:null,ageTick:h,suppressClick:se,onSelect:t},r._id))},n._id)})}),ge.length>0?(0,B.jsxs)(yF,{children:[(0,B.jsx)(bF,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`oc-sidebar__hiddenfolders`,children:[(0,B.jsx)(Yy,{className:`size-3.5`,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:mt({count:ge.length})})]})}),(0,B.jsx)(xF,{align:`start`,className:`w-56`,children:ge.map(e=>(0,B.jsxs)(SF,{onSelect:()=>void y({projectId:e._id,hidden:!1}),children:[(0,B.jsx)(eb,{}),` `,e.name]},e._id))})]}):null,(0,B.jsx)(u9,{label:ai(),dropId:a9,chats:fe(null),collapsible:!0,collapsed:ne,busy:fe(null).some(e=>u.has(e._id)),unread:fe(null).some(e=>m.has(e._id)),onToggle:ie,children:ne?null:fe(null).map(n=>(0,B.jsx)(d9,{chat:n,active:n._id===e,unread:m.has(n._id),busy:u.has(n._id),bookmarked:p.has(n._id),referenceLabel:f,ageTick:h,suppressClick:se,onSelect:t},n._id))})]})}),(0,B.jsxs)(M7,{children:[N?.startsWith(o9)?(()=>{let e=(a??[]).find(e=>s9(e._id)===N);return e?(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head oc-chatitem--overlay`,style:{"--proj-hue":X7(e)},children:[(0,B.jsx)(Ay,{className:`size-3.5 shrink-0 oc-sidebar__group-chev`}),(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e.name})]}):null})():null,Ee?(0,B.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[Y7(Ee.color)?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:Y7(Ee.color)}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsx)(`span`,{className:`oc-chatitem__label`,children:Ee.title||Ad()})]}):null]})]})]})}function u9({label:e,dropId:t,sortId:n,suppressClick:r,projectId:i,project:a,chats:o,collapsible:s,collapsed:c,busy:u,unread:d,onToggle:f,onOpen:p,children:m}){let h=Nt(L.projects.setProjectSidebar),g=q8(),_=Nt(L.projects.deleteProject),v=Nt(L.projects.renameProject),y=Nt(L.projects.setProjectColor),b=Nt(L.projects.moveProject),x=G3(),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(e),[E,D]=(0,z.useState)(!1),O=I(L.projects.projectTreeCount,i?{projectId:i}:`skip`),{setNodeRef:A,isOver:ee}=A7({id:t??`static:${e}`}),j=U7({id:n??`static-sort:${e}`,disabled:!n}),{onKeyDown:M,...te}=j.listeners??{},N=p??f,P=e=>{e.target===e.currentTarget&&s&&N&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N())},ne=a?X7(a):null;return(0,B.jsxs)(`div`,{ref:e=>{t&&A(e),n&&j.setNodeRef(e)},className:`oc-sidebar__group`+(ee?` oc-sidebar__group--over`:``)+(a?` oc-sidebar__group--project`:``),style:{...ne?{"--proj-hue":ne}:{},...n?{transform:h5.Transform.toString(j.transform),transition:j.transition,opacity:j.isDragging?.35:1}:{}},children:[(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head group/head`+(s?` oc-sidebar__group-head--btn`:``),...s?{role:`button`,tabIndex:0,onClick:()=>{r?.current||N?.()},onKeyDown:P}:{},...n?te:{},children:[s?p?(0,B.jsx)(`button`,{type:`button`,className:`oc-sidebar__group-chevbtn`,"aria-label":c?Ll():cm(),"aria-expanded":!c,onClick:e=>{e.stopPropagation(),!r?.current&&f?.()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:c?(0,B.jsx)(My,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(Ay,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)})}):c?(0,B.jsx)(My,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(Ay,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):null,(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Tn(),onClick:e=>e.stopPropagation(),...j.attributes,onKeyDown:M,children:(0,B.jsx)(sb,{className:`size-3.5`})}):null,c&&u?(0,B.jsx)(`span`,{className:`oc-chatitem__busy`,title:re(),"aria-label":re()}):null,c&&d?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:lh(),"aria-label":lh()}):null,i?(0,B.jsxs)(yF,{children:[(0,B.jsx)(bF,{asChild:!0,children:(0,B.jsx)(Ih,{variant:`ghost`,size:`icon-xs`,"aria-label":Bi(),className:`oc-sidebar__group-menu opacity-0 group-hover/head:opacity-100 group-focus-within/head:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(Ky,{})})}),(0,B.jsxs)(xF,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[p?(0,B.jsxs)(SF,{onSelect:()=>p(),children:[(0,B.jsx)(eb,{}),` `,Qm()]}):null,(0,B.jsxs)(SF,{onSelect:()=>{T(e),C(!0)},children:[(0,B.jsx)(jb,{}),` `,qi()]}),(0,B.jsxs)(SF,{onSelect:()=>D(!0),children:[(0,B.jsx)(tb,{}),` `,zt()]}),a!==void 0&&a.parentId===null?(0,B.jsxs)(SF,{onSelect:()=>void h({projectId:a._id,hidden:!0}),children:[(0,B.jsx)(Yy,{}),` `,Uc()]}):null,g&&a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(SF,{disabled:g.state.running,onSelect:()=>g.exportFolder(a._id,e),children:[(0,B.jsx)(Gy,{}),` `,uu()]}),(0,B.jsxs)(SF,{disabled:g.state.running,onSelect:()=>g.pickAndImport(a._id),children:[(0,B.jsx)(tx,{}),` `,l()]})]}):null,(0,B.jsx)(CF,{children:bd()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void y({projectId:i,color:null}),"aria-label":k(),children:`✕`}),J7.map(e=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(a?.color===e.value?` is-selected`:``),style:{background:e.hue},"aria-label":e.value,onClick:()=>void y({projectId:i,color:e.value})},e.value))]}),(0,B.jsx)(wF,{}),(0,B.jsxs)(SF,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let t=O?.folders??0,n=O?.chats??0;await x({title:Oee({name:e}),description:t>0?Bee({folders:t,chats:n}):n>0?xl({count:n}):Aa(),confirmWord:kr(),confirmLabel:so(),destructive:!0})&&await _({projectId:i})})},children:[(0,B.jsx)($b,{}),` `,kr()]})]})]}):null]}),(0,B.jsx)(`div`,{className:a&&!c?`oc-sidebar__group-body`:void 0,children:(0,B.jsx)(V7,{items:o.map(e=>e._id),strategy:R7,children:m})}),i?(0,B.jsx)(q7,{open:S,onOpenChange:C,title:Qe(),canSubmit:w.trim().length>0,onSubmit:async()=>{await v({projectId:i,name:w.trim()}),C(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:it()}),(0,B.jsx)(EF,{value:w,onChange:e=>T(e.target.value),autoFocus:!0})]})})}):null,i&&E?(0,B.jsx)(Z7,{open:E,onOpenChange:D,title:Mo(),movingFolderId:i,currentId:a?.parentId??null,onPick:e=>void b({projectId:i,parentId:e})}):null]})}var d9=(0,z.memo)(function({chat:e,active:t,unread:n,busy:r,bookmarked:i,referenceLabel:a,domainLabel:o,suppressClick:s,onSelect:c}){let l=q8(),{attributes:u,listeners:d,setNodeRef:f,transform:p,transition:m,isDragging:h}=U7({id:e._id}),{onKeyDown:g,..._}=d??{},v=Nt(L.chats.renameChat),y=JF(),b=()=>{if(a===void 0)return;let t=PTe(a,e._id);navigator.clipboard.writeText(t).then(()=>y.success(gn({reference:t})),()=>y.error(as()))},x=Nt(L.chats.deleteChat),S=Nt(L.chats.pinChat),C=Nt(L.chats.setChatColor),w=Nt(L.chats.moveChatToProject),T=Nt(L.chats.setChatSidebar),E=Nv(),[D,O]=(0,z.useState)(!1),A=I(L.me.getMe,{host:d3})?.ui?.effective?.showChatAge??!0,ee=G3(),[j,M]=(0,z.useState)(!1),[te,N]=(0,z.useState)(e.title??``),P=$3()?.chatId===e._id,ne=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!P)return;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;ne.current?.scrollIntoView({block:`nearest`,behavior:t?`auto`:`smooth`});let n=setTimeout(()=>Q3(e._id),2600);return()=>clearTimeout(n)},[P,e._id]);let re={transform:h5.Transform.toString(p),transition:m,opacity:+!h},ie=Y7(e.color);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{ref:e=>{f(e),ne.current=e},style:re,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``)+(P?` oc-chatitem--flash`:``),onClick:()=>{s.current||c(e._id)},..._,onAnimationEnd:t=>{P&&t.animationName===`oc-chatitem-flash`&&Q3(e._id)},children:[(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Tn(),onClick:e=>e.stopPropagation(),...u,onKeyDown:g,children:(0,B.jsx)(sb,{className:`size-3.5`})}),ie?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:ie}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsxs)(`button`,{className:`oc-chatitem__label`,onClick:t=>{t.stopPropagation(),!s.current&&c(e._id)},children:[(0,B.jsx)(`span`,{className:`oc-chatitem__title`,children:e.title||Ad()}),o?(0,B.jsx)(`span`,{className:`oc-chatitem__domain`,children:o}):null]}),r?(0,B.jsx)(`span`,{className:`oc-chatitem__busy`,title:Kd(),"aria-label":Kd()}):null,n?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:lh(),"aria-label":lh()}):null,e.readOnly?(0,B.jsx)(`span`,{className:`oc-chatitem__readonly`,title:Re(),children:(0,B.jsx)(mb,{size:12,"aria-label":Re()})}):null,i?(0,B.jsx)(`span`,{className:`oc-chatitem__bookmark group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Xt(),children:(0,B.jsx)(Ty,{size:12,"aria-label":Xt()})}):null,A?(0,B.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:o0(e.updatedAt),children:i9(e.updatedAt,Date.now())}):null,(0,B.jsxs)(yF,{children:[(0,B.jsx)(bF,{asChild:!0,children:(0,B.jsx)(Ih,{variant:`ghost`,size:`icon-xs`,"aria-label":yt(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(Ky,{})})}),(0,B.jsxs)(xF,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(SF,{onSelect:()=>{N(e.title??``),M(!0)},children:[(0,B.jsx)(jb,{}),` `,qi()]}),l?(0,B.jsxs)(SF,{disabled:l.state.running,onSelect:()=>l.exportChat(e._id,e.title??ai()),children:[(0,B.jsx)(Gy,{}),` `,Cm()]}):null,(0,B.jsxs)(SF,{onSelect:()=>void S({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,B.jsx)(Pb,{}):(0,B.jsx)(Nb,{}),e.pinned?fi():Jr()]}),(0,B.jsxs)(SF,{onSelect:b,disabled:a===void 0,children:[(0,B.jsx)(db,{}),` `,Ho()]}),(0,B.jsxs)(SF,{onSelect:()=>O(!0),children:[(0,B.jsx)(eb,{}),` `,ur()]}),e.projectId===null?null:(0,B.jsxs)(SF,{onSelect:()=>void E({to:`/project/$projectId`,params:{projectId:e.projectId},search:{c:e._id}}),children:[(0,B.jsx)(nb,{}),` `,Xl()]}),e.pinned?null:(0,B.jsxs)(SF,{onSelect:()=>void T({chatId:e._id,hidden:!0}),children:[(0,B.jsx)(Db,{}),` `,Uc()]}),(0,B.jsx)(CF,{children:bd()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void C({chatId:e._id,color:null}),"aria-label":k(),children:`✕`}),J7.map(t=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void C({chatId:e._id,color:t.value})},t.value))]}),(0,B.jsx)(wF,{}),(0,B.jsxs)(SF,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await ee({title:Ld(),description:ji(),confirmLabel:kr(),destructive:!0})&&await x({chatId:e._id})})},children:[(0,B.jsx)($b,{}),` `,kr()]})]})]})]}),(0,B.jsx)(q7,{open:j,onOpenChange:M,title:Ue(),canSubmit:te.trim().length>0,onSubmit:async()=>{await v({chatId:e._id,title:te.trim()}),M(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:it()}),(0,B.jsx)(EF,{value:te,onChange:e=>N(e.target.value),autoFocus:!0})]})})}),D?(0,B.jsx)(Z7,{open:D,onOpenChange:O,title:ms(),currentId:e.projectId,onPick:t=>void w({chatId:e._id,projectId:t})}):null]})}),f9=null,p9=0,ODe=400;function kDe(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!f9)try{f9=new e}catch{return null}return f9}function m9(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 h9(e){let t=Date.now();if(t-p9<ODe)return;let n=kDe();if(!n)return;p9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function ADe(){h9(e=>{m9(e,660,0,.16,.12),m9(e,440,.14,.2,.1)})}function jDe(){h9(e=>{m9(e,880,0,.14,.08)})}function MDe({activeChatId:e}){let t=I(L.messages.listChats,{}),n=Nt(L.chatReads.markChatSeen),r=I(L.me.getMe,{host:d3}),i=r?.ui?.effective?.replySound===!0,a=r?.userId??null,o=(0,z.useRef)(null),s=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(!t)return;s.current!==String(a)&&(s.current=String(a),o.current=null);let r=new Map;for(let e of t)e.lastAssistantAt!==null&&r.set(e._id,e.lastAssistantAt);let c=o.current;if(o.current=r,c===null)return;let l=!1;for(let[t,i]of r){let r=c.get(t);r!==void 0&&i<=r||r===void 0&&Date.now()-i>3e4||(l=!0,t===e&&document.visibilityState===`visible`?n({chatId:t}):t!==e&&Z3(t))}l&&i&&jDe()},[t,e,i,n,a]),(0,z.useEffect)(()=>{e&&document.visibilityState===`visible`&&n({chatId:e})},[e,n]),(0,z.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&n({chatId:e})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,n]),null}function g9(e){let t=Nt(L.chats.createChat),n=I(L.agents.listMyAgents),[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(void 0),o=(0,z.useCallback)(async(n,r)=>{e(await t({instanceName:n,agentId:r,projectId:a.current}))},[t,e]);return{startNewChat:(0,z.useCallback)(async e=>{a.current=e?.projectId;let t=n;if(t&&t.length===1&&t[0].state!==`deleted`){await o(t[0].instanceName,t[0].agentId);return}i(!0)},[n,o]),picker:(0,B.jsx)(aSe,{open:r,onOpenChange:i,agents:n,onPick:(e,t)=>{i(!1),o(e,t)}})}}var _9=[`admin`,`user`,`pending`];function v9(){let e=I(L.me.authProviders)?.anonymous===!0,[t,n]=(0,z.useState)(!1),r=I(L.dev.listUsersDev,e?{}:`skip`),i=I(L.me.getImpersonation),a=Nt(L.dev.setMyRole),o=Nt(L.dev.setRole),s=Nt(L.admin.startImpersonation),c=Nt(L.admin.stopImpersonation);if(!e)return null;let l=r?.find(e=>e.isMe),u=l?.role===`admin`,d=i?.impersonating===!0,f=(r??[]).filter(e=>!e.isMe);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:w(),children:[(0,B.jsx)(rx,{size:13}),`DEV`]}),(0,B.jsx)(d0,{open:t,onOpenChange:n,children:(0,B.jsxs)(f0,{children:[(0,B.jsxs)(p0,{children:[(0,B.jsx)(h0,{children:Ta()}),(0,B.jsx)(g0,{children:Dc()})]}),(0,B.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,B.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[Gs({canonical:l?.canonical??`…`}),` `,(0,B.jsx)(XF,{variant:`outline`,children:l?.role??`…`})]}),(0,B.jsx)(`div`,{className:`oc-devsw__roles`,children:_9.map(e=>(0,B.jsx)(Ih,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?uc():e===`user`?rr():Lp()},e))})]}),d?(0,B.jsxs)(`div`,{className:`oc-devsw__imp`,children:[Sr(),` `,(0,B.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,B.jsx)(Ih,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Zt()})]}):null,(0,B.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,B.jsx)(`p`,{className:`oc-devsw__empty`,children:Es()}):f.map(e=>(0,B.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,B.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,B.jsx)(`select`,{className:`oc-devsw__select`,value:e.role,disabled:!e.canonical,onChange:t=>e.canonical&&void o({canonical:e.canonical,role:t.target.value}),children:_9.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))}),(0,B.jsx)(Ih,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?_n():os():Uo(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:xe()})]},e.profileId))})]})})]})}function y9({label:e,mode:t,minimal:n=!1}){let{signOut:r}=rg(),i=Nt(L.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(L.me.getMe,{host:d3});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(L.me.getMe,{host:d3},{...n,themeMode:t,resolvedThemeMode:r})}),a=t??`default`;return(0,B.jsxs)(yF,{children:[(0,B.jsx)(bF,{asChild:!0,children:(0,B.jsxs)(Ih,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,B.jsx)(Ay,{className:`opacity-60`})]})}),(0,B.jsx)(xF,{align:`end`,className:`w-52`,children:n?(0,B.jsxs)(SF,{onClick:()=>void r(),children:[(0,B.jsx)(hb,{}),` `,mh()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(CF,{children:pt()}),(0,B.jsxs)(xue,{value:a,onValueChange:e=>void i({mode:e==="default"?null:e}),children:[(0,B.jsxs)(TF,{value:`light`,children:[(0,B.jsx)(Xb,{}),` `,Eo()]}),(0,B.jsxs)(TF,{value:`dark`,children:[(0,B.jsx)(Tb,{}),` `,pee()]}),(0,B.jsxs)(TF,{value:`system`,children:[(0,B.jsx)(wb,{}),` `,Be()]}),(0,B.jsx)(TF,{value:`default`,children:lo()})]}),(0,B.jsx)(wF,{}),(0,B.jsxs)(SF,{onClick:()=>void r(),children:[(0,B.jsx)(hb,{}),` `,mh()]})]})})]})}var NDe={altered_words:()=>Lu(),incorrect:()=>Xu(),incoherence:()=>xf(),formatting:()=>hp(),latency:()=>Su(),api_error:()=>Kl(),other:()=>Nm()},b9=e=>NDe[e]?.()??e,PDe={anomaly_open:ex,anomaly_resolved:Fy,feedback_reply:yb,feedback_resolved:yb,feedback_new:yb,curation:Zy,operator_announcement:_b},FDe={atrium:()=>om(),assistants:()=>rp(),platform:()=>il()},IDe={investigating:()=>md(),monitoring:()=>tm(),resolved:()=>Hf()},x9=e=>(e?FDe[e]:void 0)?.()??`?`,LDe=e=>(e?IDe[e]:void 0)?.()??`?`,S9=e=>{let t=e===void 0?NaN:Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(Jd()):`?`},RDe={notif_feedback_reply_admin:()=>({title:_l(),body:hh()}),notif_feedback_reply:()=>({title:_l(),body:hh()}),notif_feedback_resolved:()=>({title:no(),body:dh()}),notif_feedback_new:e=>({title:Ym(),body:Bc({reference:e.reference??`?`,category:b9(e.category??`other`)})}),notif_curation_proposed:e=>({title:_o(),body:sh({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:Me(),body:Qa({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:See(),body:ml({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Iee({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:Km({kind:e.kind??`?`}),body:t.body}),notif_operator_maintenance_scheduled:e=>({title:$u(),body:wf({service:x9(e.service),startsAt:S9(e.starts_at),endsAt:S9(e.ends_at)})}),notif_operator_maintenance_completed:e=>({title:vp(),body:wu({service:x9(e.service),completedAt:S9(e.completed_at)})}),notif_operator_incident_update:e=>({title:Jl(),body:Im({service:x9(e.service),status:LDe(e.status),reference:e.reference??`?`})}),notif_operator_subscription_notice:e=>({title:cf(),body:Fl({plan:e.plan??`?`,effectiveAt:S9(e.effective_at)})})};function C9(e){let t=e.messageKey?RDe[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:_l(),body:hh()}:e.kind===`feedback_resolved`?{title:no(),body:dh()}:{title:e.title,body:e.body}}function zDe(){let e=I(L.notifications.myUnreadCount)??0,t=I(L.notifications.myNotifications),n=I(L.feedback.myFeedback),r=Nt(L.notifications.markRead),i=Nt(L.notifications.markAllRead),a=Nt(L.notifications.clearOne),o=Nt(L.notifications.clearAll),s=Nt(L.feedback.closeMyFeedback),c=Nv(),[l,u]=(0,z.useState)(!1),d=I(L.me.getMe,{host:d3}),f=d?.ui?.effective?.notifSound===!0,p=d?.ui?.effective?.notifSystem===!0,m=d?.userId??null,h=(0,z.useRef)(null),g=(0,z.useRef)(0),_=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!t)return;_.current!==String(m)&&(_.current=String(m),h.current=null,g.current=0);let e=t.reduce((e,t)=>Math.max(e,t.creationTime??0),0);if(h.current===null){h.current=new Set(t.map(e=>String(e._id))),g.current=e;return}let n=h.current,r=t.filter(e=>!n.has(String(e._id))&&(e.creationTime??0)>g.current);for(let e of t)n.add(String(e._id));if(g.current=Math.max(g.current,e),n.size>500){let e=new Set(t.map(e=>String(e._id)));for(let t of n)e.has(t)||n.delete(t)}if(r.length!==0&&(f&&ADe(),p&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=C9(e);try{let r=new Notification(t,{body:n,tag:String(e._id)});r.onclick=()=>window.focus()}catch{}}},[t,f,p,m]);let v=e=>{if(e.unread&&r({notificationId:e._id}),!e.href)return;if(u(!1),e.href.startsWith(`/chat/`)){c({to:`/chat/$chatId`,params:{chatId:e.href.slice(6)}});return}let[t,n]=e.href.split(`?`);c({to:t,search:Object.fromEntries(new URLSearchParams(n??``))})};return(0,B.jsxs)(yF,{open:l,onOpenChange:u,children:[(0,B.jsx)(bF,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?Yee({count:e}):Ra(),children:[(0,B.jsx)(Cy,{size:18,"aria-hidden":!0}),e>0?(0,B.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,B.jsxs)(xF,{align:`end`,className:`oc-notif`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,B.jsx)(`span`,{children:Lr()}),t&&t.length>0?(0,B.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:Nn()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Dt()})]}):null]}),t===void 0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:et()}):t.length===0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:ea()}):(0,B.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=PDe[e.kind]??Cy,{title:n,body:i}=C9(e);return(0,B.jsxs)(`div`,{className:`oc-notif__item${e.unread?` is-unread`:``}${e.href?` is-link`:``}`,role:e.href?`button`:void 0,tabIndex:e.href?0:void 0,onClick:e.href?()=>v(e):void 0,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,B.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,B.jsx)(`button`,{type:`button`,title:yi(),"aria-label":yi(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,B.jsx)(ky,{size:13})}):null,(0,B.jsx)(`button`,{type:`button`,title:ei(),"aria-label":ei(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,B.jsx)(xh,{size:13})})]})]}),(0,B.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(Jd())})]},e._id)})}),n&&n.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:Ed()}),(0,B.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,B.jsx)(BDe,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function BDe({it:e,onClose:t,onNavigate:n}){let r=JF(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1);async function f(){d(!0);try{await t(c.trim()||void 0)}catch(e){r.error(ch(),e)}finally{d(!1)}}return(0,B.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(`span`,{className:`oc-notif__title`,children:b9(e.category)}),(0,B.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?xo():e.answered?N():Ud()})]}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(Jd())}),e.thread.length>0?(0,B.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,B.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?Ii():e.authorRole===`agent`?Ye():Je()}),(0,B.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,e.messageText?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-notif__report-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,B.jsx)(Ay,{size:13,"aria-hidden":!0}):(0,B.jsx)(My,{size:13,"aria-hidden":!0}),bo()]}),i?(0,B.jsx)(`div`,{className:`oc-notif__report-msg`,children:e.messageText}):null]}):null,(0,B.jsxs)(`div`,{className:`oc-notif__report-actions`,children:[(0,B.jsx)(qv,{to:`/chat/$chatId`,params:{chatId:e.chatId},search:{m:e.messageId},className:`oc-notif__link`,onClick:n,children:ct()}),o?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:ch()})]}),o?(0,B.jsxs)(`div`,{className:`oc-notif__close-form`,children:[(0,B.jsx)(`textarea`,{className:`oc-notif__close-input`,rows:2,value:c,onChange:e=>l(e.target.value),placeholder:Fe()}),(0,B.jsxs)(`div`,{className:`oc-notif__close-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-confirm`,disabled:u,onClick:()=>void f(),children:to()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:Tee()})]})]}):null]})}var w9=2,VDe=180;function HDe(){let e=Nv(),t=(0,z.useRef)(null),n=(0,z.useRef)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(0),d=(0,z.useMemo)(()=>IF(AF,FF()),[]);(0,z.useEffect)(()=>{let e=setTimeout(()=>c(a),VDe);return()=>clearTimeout(e)},[a]);let f=s.trim(),p=I(L.search.searchConversations,f.length>=w9?{query:f}:`skip`),m=p??[],h=f.length>=w9&&p===void 0;(0,z.useEffect)(()=>{let e=e=>{LF(e,AF)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,z.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,z.useEffect)(()=>{u(0)},[p]),(0,z.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let g=(0,z.useCallback)((t,n)=>{i(!1),n&&a.trim()&&M6(n,a.trim()),e({to:`/chat/$chatId`,params:{chatId:t},...n?{search:{m:n}}:{}})},[e,a]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":Is(),children:[(0,B.jsx)(Bb,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-search-trigger__label`,children:nc()}),(0,B.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:d})]}),(0,B.jsx)(d0,{open:r,onOpenChange:i,children:(0,B.jsxs)(f0,{showCloseButton:!1,className:`oc-search-palette top-[12vh] translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,B.jsx)(h0,{className:`sr-only`,children:Yn()}),(0,B.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,B.jsx)(Bb,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:t,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,m.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=m[l];t&&g(t.chatId,t.messageId)}},placeholder:Ap(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":hr()})]}),(0,B.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:f.length<w9?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:Wt({count:w9})}):h?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:ys()}):m.length===0?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:Io({term:f})}):m.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:Bp(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>g(e.chatId,e.messageId),children:[(0,B.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,B.jsx)(cb,{size:15}):(0,B.jsx)(yb,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,B.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||un()}),e.projectPath&&e.projectPath.length>0?(0,B.jsx)(`span`,{className:`oc-search-result__path`,"aria-label":Tp(),children:e.projectPath.join(` › `)}):null,e.snippet?(0,B.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,B.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?$o():me()})]},e.chatId))}),(0,B.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↑`}),(0,B.jsx)(`kbd`,{children:`↓`}),` `,Kee()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↵`}),` `,Pa()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:Nr()}),` `,kn()]})]})]})})]})}var T9=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`],E9=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`],D9={users:()=>af(),groups:()=>Sa(),instances:()=>Ml(),bridge:()=>cee(),injections:()=>We(),serviceAccounts:()=>ep(),roles:()=>tl(),access:()=>Tc(),traces:()=>dd(),kpi:()=>Zp(),anomalies:()=>Rf(),files:()=>Xs(),scheduled:()=>hu(),agentFiles:()=>Rd(),preferences:()=>Sl(),integrations:()=>ym(),theme:()=>dm(),chatDefaults:()=>wa(),audit:()=>ou(),feedbacks:()=>S(),subagentReports:()=>Ns(),voice:()=>tr()},O9={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`},UDe=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function k9(e){let t=new Set(e);return T9.filter(e=>t.has(O9[e]))}function A9(e){return`/settings/${e}`}function j9(e){let t=e.split(`/`)[2];return T9.includes(t)?t:void 0}var WDe={uiprefs:`preferences`},M9=[{id:`personal`,label:()=>bee(),tabs:[`preferences`,`theme`,`files`,`scheduled`]},{id:`agents`,label:()=>fl(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>Pee(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`]},{id:`observability`,label:()=>Wm(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],GDe=new Map(M9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function N9(e){let t=GDe.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function KDe(e,t){return e.find(e=>N9(e)===t)}M9.flatMap(e=>[...e.tabs]);function qDe(){let e=I(L.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.gatewaysUnreachable??0,n=e.known?e.available?t>0?`warn`:`ok`:`error`:`idle`,r=e.known?e.available?t>0?Oc({count:t}):`${Qc()}${e.checkedAt?cd({time:s0(e.checkedAt)}):``}`:Jp({reason:e.reason??`?`}):Zf();return(0,B.jsx)(E6,{delayDuration:150,children:(0,B.jsxs)(D6,{children:[(0,B.jsx)(O6,{asChild:!0,children:(0,B.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,B.jsx)(k6,{children:r})]})})}function P9(e){let t=new Set(T9),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 T9)n.has(e)||r.push(e);return r}function JDe(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function YDe({tab:e,active:t}){let n=D9[e](),r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,B.jsx)(qDe,{}):null]});return E9.includes(e)?(0,B.jsx)(qv,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,B.jsx)(qv,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function XDe({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=U7({id:e});return(0,B.jsxs)(`div`,{ref:i,style:{transform:h5.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":ho(),...n,...r,children:(0,B.jsx)(sb,{size:14,"aria-hidden":!0})}),(0,B.jsx)(YDe,{tab:e,active:t})]})}function ZDe(){let e=I(L.me.getMe,{host:d3}),t=Nt(L.me.setSettingsTabOrder),n=j9(vy({select:e=>e.pathname})),r=n===void 0?void 0:N9(n),i=(0,z.useMemo)(()=>P9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,z.useState)(i);(0,z.useEffect)(()=>o(i),[i]);let s=(0,z.useMemo)(()=>new Set(k9(e?.permissions??[])),[e?.permissions]),c=(0,z.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&N9(e)===r),[a,s,r]),l=x5(b5(t7,{activationConstraint:{distance:5}}),b5(Z5,{coordinateGetter:G7}));if(r===void 0||c.length===0)return null;let u=M9.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=JDe(a,N7(c,i,s));o(l),t({order:l})}return(0,B.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,B.jsx)(D7,{sensors:l,collisionDetection:ZTe,modifiers:[oDe],onDragEnd:d,children:(0,B.jsx)(V7,{items:c,strategy:pDe,children:c.map(e=>(0,B.jsx)(XDe,{tab:e,active:e===n},e))})})})}function QDe(){let e=I(L.me.getMe,{host:d3}),t=Nv(),n=j9(vy({select:e=>e.pathname})),r=n===void 0?void 0:N9(n),i=(0,z.useMemo)(()=>new Set(k9(e?.permissions??[])),[e?.permissions]),a=(0,z.useMemo)(()=>P9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=M9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=KDe(a,e.id);n&&t({to:A9(n)})}return(0,B.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":ah(),children:[(0,B.jsx)(qv,{to:`/`,className:`oc-settings-nav__back`,children:Ae()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__title`,children:Xa()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-nav__group`+(e.id===r?` is-active`:``),"aria-current":e.id===r?`true`:void 0,onClick:()=>s(e),children:e.label()},e.id))})]})}var $De=[`eq`,`neq`,`contains`,`gt`,`gte`,`lt`,`lte`],F9=[50,100,200,500],I9=`now-30d`,eOe=`now-24h`;function tOe(e,t,n=I9,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 nOe(e){return e.kind===`absolute`?{from:String(e.from),to:String(e.to)}:{from:e.from,to:e.to}}function rOe(e){if(e.length!==0)return JSON.stringify(e)}function iOe(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`||!$De.includes(i)||typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`||n.push({field:r,op:i,value:a})}return n}var L9=B4().optional(),R9=B4().optional(),z9=B4().optional(),B9=B4().optional().catch(void 0),aOe=q4({q:L9,section:X4([`latency`,`events`]).default(`events`).catch(`events`),kind:B4().default(`all`).catch(`all`),correlationId:B4().optional().catch(void 0),limit:Sxe().pipe(J4([Z4(F9[0]),Z4(F9[1]),Z4(F9[2]),Z4(F9[3])])).catch(100),statusClass:X4([`2xx`,`4xx`,`5xx`]).optional().catch(void 0),principalType:X4([`user`,`service`,`system`]).optional().catch(void 0),direction:X4([`inbound`,`outbound`,`internal`]).optional().catch(void 0),roleKey:B9,from:R9,to:R9,adv:z9}),oOe=q4({q:L9,action:B9,impersonated:X4([`yes`,`no`]).optional().catch(void 0),resource:B9,from:R9,to:R9,adv:z9}),sOe=q4({q:L9,status:X4([`open`,`acknowledged`,`resolved`,`all`]).default(`open`).catch(`open`),severity:X4([`info`,`warn`,`critical`]).optional().catch(void 0),kind:B9,from:R9,to:R9}),cOe=q4({from:R9,to:R9}),lOe=q4({q:L9,status:X4([`active`,`disabled`]).optional().catch(void 0)}),uOe=q4({q:L9,role:B9});q4({q:L9,mode:X4([`per-user`,`shared`]).optional().catch(void 0)});var dOe=q4({section:X4([`readaloud`,`dictation`,`talk`]).default(`readaloud`).catch(`readaloud`)}),fOe=q4({section:B4().max(32).default(`openclaw`).catch(`openclaw`)}),V9=`oc.theme`;function H9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function U9(e){(0,z.useEffect)(()=>{let t=e??localStorage.getItem(V9)??`system`;if(localStorage.setItem(V9,t),H9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>H9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}var W9=`oc.fontScale`,pOe={sm:`87.5%`,md:``,lg:`112.5%`,xl:`125%`,"2xl":`137.5%`,"3xl":`150%`},G9=[`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`];function mOe(e){return e!==null&&G9.includes(e)}function hOe(e){document.documentElement.style.fontSize=pOe[e]}function K9(e){(0,z.useEffect)(()=>{let t=localStorage.getItem(W9),n=e??(mOe(t)?t:`md`);localStorage.setItem(W9,n),hOe(n)},[e])}function gOe(e){(0,z.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=Jd()}catch{t=void 0}t!==e&&ae(e)},[e])}var _Oe=(0,z.lazy)(()=>WQ(()=>import(`./RolesTab-AEwrbrY4.js`).then(e=>({default:e.RolesTab})),__vite__mapDeps([2,1,3,4,5]))),vOe=(0,z.lazy)(()=>WQ(()=>import(`./InstancesTab-sdopggdY.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([6,1,3,7,8,9,10,11,12,13,14,15,5,16,17,18]))),yOe=(0,z.lazy)(()=>WQ(()=>import(`./PromptInjectionsTab-B_mdD-DZ.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([19,1,3,7,8,9,20,5,21]))),bOe=(0,z.lazy)(()=>WQ(()=>import(`./GroupsTab-BA8yKOnN.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([22,1,3,12,23,18,13,5,16,24,14,15]))),xOe=(0,z.lazy)(()=>WQ(()=>import(`./IntegrationsTab-BFpswDLB.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([25,1,3,5]))),SOe=(0,z.lazy)(()=>WQ(()=>import(`./FeedbacksTab-CbdS0wvF.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([26,1,3,18,13,5,16]))),COe=(0,z.lazy)(()=>WQ(()=>import(`./SubAgentReportsTab-jYVPpy6r.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([27,1,3,18,13,5,16]))),wOe=(0,z.lazy)(()=>WQ(()=>import(`./FilesTab-gqJalvPX.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([28,1,3,5,16]))),TOe=(0,z.lazy)(()=>WQ(()=>import(`./ScheduledTab-1EVZpEec.js`).then(e=>({default:e.ScheduledTab})),__vite__mapDeps([29,1,3,30,31,13,21,14,15,5,16]))),EOe=(0,z.lazy)(()=>WQ(()=>import(`./AgentFilesTab-DRQkurXm.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([32,1,3,11,8,5,21]))),DOe=(0,z.lazy)(()=>WQ(()=>import(`./PreferencesTab-C3J_i-eF.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([33,1,3,31,13,21,20,9,5]))),OOe=(0,z.lazy)(()=>WQ(()=>import(`./ChatDefaultsTab-C0sMC9lx.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([34,1,3,11,5,21]))),kOe=(0,z.lazy)(()=>WQ(()=>import(`./AccessTab-YOPTfk-I.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([35,1,3]))),AOe=(0,z.lazy)(()=>WQ(()=>import(`./ThemeShowroom-Ce00J53a.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([36,1,3,23,37,15,5,14,20,9,38,16])));function jOe(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(hte,{children:(0,B.jsx)(`div`,{className:`oc-boot`,children:ir()})}),(0,B.jsx)(mte,{children:(0,B.jsx)(NOe,{})}),(0,B.jsx)(pte,{children:(0,B.jsx)(Rue,{children:(0,B.jsx)(MTe,{children:(0,B.jsx)(FOe,{})})})})]})}function MOe(){return(0,B.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,B.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,B.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,B.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function NOe(){let{signIn:e}=rg();U9(void 0),K9(void 0);let t=I(L.charts.brandForHost,{host:d3}),n=Fxe(d3),r=t??n??null,i=m3(void 0);h3(r?.tokens??null,i),(0,z.useEffect)(()=>{t&&Ixe(d3,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?O3(a,i):null,s=a?.label??`Atrium`,c=I(L.me.authProviders),[l,u]=(0,z.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(Rp())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.anonymous;return(0,B.jsxs)(`div`,{className:`oc-signin`,children:[(0,B.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,vectorEffect:`non-scaling-stroke`}),(0,B.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,B.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,B.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,B.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,B.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,B.jsx)(`h1`,{className:`oc-signin__title`,children:Cr()}),(0,B.jsx)(`p`,{className:`oc-signin__subtitle`,children:Qt()}),(0,B.jsx)(`div`,{className:`oc-signin__providers`,children:c?.google?(0,B.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,B.jsx)(MOe,{}),(0,B.jsx)(`span`,{children:Ds()})]}):null}),l?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:Wo()}):null,c?.anonymous?(0,B.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:vn()}):null]})]})}function POe(){let{width:e,collapsed:t,isMobile:n}=o2();return(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`}}),(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`5.5rem`,height:`1.1rem`}})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`100%`,height:`2.25rem`}})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`,borderRadius:`999px`}})})]}),(0,B.jsxs)(`div`,{className:n?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[!t&&!n?(0,B.jsx)(`div`,{className:`oc-sidebar-col`,style:{width:e,flex:`0 0 ${e}px`},children:(0,B.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{height:`2.25rem`,margin:`0.25rem 0.25rem 0`}}),(0,B.jsx)(l9,{})]})}):null,(0,B.jsx)(`main`,{className:`oc-main`})]})]})}function FOe(){let e=I(L.me.getMe,{host:d3}),t=Nt(L.me.bootstrap),n=Nv();(0,z.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),U9(e?.resolvedThemeMode),K9(e?.resolvedFontScale);let r=m3(e?.resolvedThemeMode);h3(e?.resolvedChartTokens,r),gOe(e?.resolvedLocale);let i=(0,z.useRef)(null);if((0,z.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,B.jsx)(POe,{});let a=e.name||e.email||ss();return e.role===`pending`?(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsx)(q9,{}),(0,B.jsx)(v9,{}),(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,B.jsx)(J9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(y9,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,B.jsxs)(`div`,{className:`oc-pending`,children:[(0,B.jsx)(`h1`,{className:`oc-pending__title`,children:Se()}),(0,B.jsx)(`p`,{className:`oc-pending__body`,children:$ee()})]})]}):(0,B.jsx)(LOe,{canOpenSettings:k9(e.permissions??[]).length>0,viewerUserId:e.userId,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function q9(){let e=I(L.me.getImpersonation),t=Nt(L.admin.stopImpersonation);return!e||!e.impersonating?null:(0,B.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,B.jsx)(Xy,{className:`size-4 shrink-0`}),(0,B.jsxs)(`span`,{className:`oc-imp__text`,children:[Ha(),` `,(0,B.jsx)(`strong`,{children:e.targetLabel}),Hr(),(0,B.jsx)(`strong`,{children:e.realLabel}),Rn()]}),(0,B.jsx)(Ih,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:Mt()})]})}function J9({brand:e,resolvedThemeMode:t}){let n=m3(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=O3(e,n),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>s(!1),[a]),(0,B.jsxs)(B.Fragment,{children:[a!==null&&!o?(0,B.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,B.jsx)(A3,{className:`oc-brand__logo`}):null,(0,B.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function IOe({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(Ih,{variant:`ghost`,size:`icon-sm`,"aria-label":i?oa():Ti(),onClick:a,children:i?(0,B.jsx)(Ob,{}):(0,B.jsx)(Db,{})}),(0,B.jsx)(qv,{to:`/`,className:`oc-topbar__brand`,children:(0,B.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(HDe,{})}),(0,B.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,B.jsx)(zDe,{}),(0,B.jsx)(y9,{label:e,mode:t})]})]})}function LOe({canOpenSettings:e,viewerUserId:t,userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a}){let{width:o,columnRef:s,collapsed:c,toggleCollapsed:l,collapse:u,startResize:d,isMobile:f}=o2(),p=fy(),m=jv({strict:!1}),h=Nv(),g=!!p({to:`/settings`,fuzzy:!0});(0,z.useEffect)(()=>{f&&u()},[vy({select:e=>e.pathname}),f,u]);let _=(0,z.useCallback)(e=>{h({to:`/chat/$chatId`,params:{chatId:e}})},[h]),{startNewChat:v,picker:y}=g9(_),b=(0,z.useMemo)(()=>IF(jF,FF()),[]);return(0,z.useEffect)(()=>{let e=e=>{LF(e,jF)&&(e.preventDefault(),v())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]),(0,B.jsxs)(`div`,{className:`oc-shell`,children:[y,(0,B.jsx)(MDe,{activeChatId:m.chatId??null}),(0,B.jsx)(q9,{}),(0,B.jsx)(v9,{}),(0,B.jsx)(IOe,{userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a,collapsed:c,onToggleSidebar:l}),(0,B.jsxs)(`div`,{className:f?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[f&&!c?(0,B.jsx)(`div`,{className:`oc-sidebar-backdrop`,onClick:u,"aria-hidden":!0}):null,c?null:(0,B.jsxs)(`div`,{className:`oc-sidebar-col`,ref:e=>{s.current=f?null:e},style:f?void 0:{width:o,flex:`0 0 ${o}px`},children:[g?(0,B.jsx)(QDe,{}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(DDe,{activeChatId:m.chatId??null,onSelect:_,onNewChat:()=>void v(),newChatShortcut:b}),(0,B.jsx)(Ih,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(qv,{to:`/settings/$tab`,params:{tab:`scheduled`},children:[(0,B.jsx)(Oy,{"aria-hidden":!0}),wo()]})}),(0,B.jsx)(Ih,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(qv,{to:`/settings/$tab`,params:{tab:`files`},children:[(0,B.jsx)(ub,{"aria-hidden":!0}),dt()]})}),e?(0,B.jsx)(Ih,{variant:`ghost`,className:`mx-2 mb-2 justify-start`,asChild:!0,children:(0,B.jsxs)(qv,{to:`/settings`,children:[(0,B.jsx)(Wb,{"aria-hidden":!0}),oi()]})}):null]}),(0,B.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:d,role:`separator`,"aria-orientation":`vertical`,"aria-label":jd()})]}),(0,B.jsx)(`main`,{className:`oc-main`,children:(0,B.jsx)(cy,{})}),(0,B.jsx)(Kge,{viewerUserId:t,currentChatId:m.chatId??null})]}),(0,B.jsx)(zue,{})]})}function ROe(){let e=I(L.me.getMe,{host:d3}),t=Nv(),n=vy({select:e=>e.pathname}),r=(0,z.useMemo)(()=>e?k9(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,z.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:ir()});if(i)return null;let a=j9(n),o=a!==void 0&&!r.includes(a);return(0,B.jsxs)(`div`,{className:`oc-admin`,children:[(0,B.jsx)(ZDe,{}),(0,B.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,B.jsx)(zOe,{}):(0,B.jsx)(cy,{})})]})}function zOe(){return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(ex,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:ie()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:qd()})]})}function BOe(){let e=I(L.me.getMe,{host:d3}),t=Nv();return(0,z.useEffect)(()=>{if(e===void 0)return;let n=k9(e.permissions??[]);t({to:n.includes(`files`)?A9(`files`):n.length>0?A9(n[0]):`/`,replace:!0})},[e,t]),(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:ir()})}function VOe(e){switch(e){case`groups`:return(0,B.jsx)(bOe,{});case`integrations`:return(0,B.jsx)(xOe,{});case`instances`:return(0,B.jsx)(vOe,{});case`injections`:return(0,B.jsx)(yOe,{});case`theme`:return(0,B.jsx)(AOe,{});case`feedbacks`:return(0,B.jsx)(SOe,{});case`subagentReports`:return(0,B.jsx)(COe,{});case`files`:return(0,B.jsx)(wOe,{});case`scheduled`:return(0,B.jsx)(TOe,{});case`agentFiles`:return(0,B.jsx)(EOe,{});case`preferences`:return(0,B.jsx)(DOe,{});case`chatDefaults`:return(0,B.jsx)(OOe,{});case`access`:return(0,B.jsx)(kOe,{});default:return(0,B.jsx)(_Oe,{})}}function HOe(){let{tab:e}=jv({from:`/settings/$tab`});return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:VOe(e)})}function UOe(){let{chatId:e}=jv({from:`/chat/$chatId`}),{m:t}=Mv({from:`/chat/$chatId`});return(0,z.useEffect)(()=>{Cxe(e)},[e]),(0,B.jsx)(h8,{chatId:e,focusMessageId:t??null})}function WOe(){let e=Nv(),t=wxe(),n=I(L.messages.listChats,{}),r=t!==null&&n!==void 0&&n.some(e=>e._id===t);return(0,z.useEffect)(()=>{r&&t&&e({to:`/chat/$chatId`,params:{chatId:t},replace:!0})},[r,t,e]),t!==null&&(n===void 0||r)?(0,B.jsx)(`div`,{className:`oc-boot`,children:ir()}):(0,B.jsx)(h8,{chatId:null})}var Y9=Qv({component:jOe}),GOe=Xv({getParentRoute:()=>Y9,path:`/`,component:WOe}),KOe=Xv({getParentRoute:()=>Y9,path:`chat/$chatId`,component:UOe,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),qOe=Xv({getParentRoute:()=>Y9,path:`project/$projectId`,component:$v(()=>WQ(()=>import(`./ProjectPage-Dk_aI-j5.js`),__vite__mapDeps([39,1,3,30,5,40])),`ProjectPage`),validateSearch:e=>({c:typeof e.c==`string`?e.c:void 0})}),X9=Xv({getParentRoute:()=>Y9,path:`settings`,component:ROe}),JOe=Xv({getParentRoute:()=>X9,path:`/`,component:BOe}),YOe=Xv({getParentRoute:()=>X9,path:`traces`,validateSearch:aOe,component:$v(()=>WQ(()=>import(`./TracesTab-h8arGKis.js`),__vite__mapDeps([41,1,3,12,23,18,13,5,16,37,15,14])),`TracesTab`)}),XOe=Xv({getParentRoute:()=>X9,path:`bridge`,validateSearch:fOe,component:$v(()=>WQ(()=>import(`./BridgeTab-DzV-2POL.js`),__vite__mapDeps([10,1,3,11,7,8,9,12,13,14,15,5,16,17])),`BridgeTab`)}),ZOe=Xv({getParentRoute:()=>X9,path:`voice`,validateSearch:dOe,component:$v(()=>WQ(()=>import(`./VoiceTab-D-J9M4a1.js`),__vite__mapDeps([42,1,3,12,5,21])),`VoiceTab`)}),QOe=Xv({getParentRoute:()=>X9,path:`audit`,validateSearch:oOe,component:$v(()=>WQ(()=>import(`./AuditTab-Cntt5whu.js`),__vite__mapDeps([43,1,3,18,13,5,16,37,23,15,14])),`AuditTab`)}),$Oe=Xv({getParentRoute:()=>X9,path:`anomalies`,validateSearch:sOe,component:$v(()=>WQ(()=>import(`./AnomaliesTab-Dq2dqog2.js`),__vite__mapDeps([44,1,3,18,13,5,16,14,15,17])),`AnomaliesTab`)}),eke=Xv({getParentRoute:()=>X9,path:`kpi`,validateSearch:cOe,component:$v(()=>WQ(()=>import(`./KpiTab-DwKThxZR.js`),__vite__mapDeps([45,1,3,15,5,38])),`KpiTab`)}),tke=Xv({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:lOe,component:$v(()=>WQ(()=>import(`./ServiceAccountsTab-CGQ1lSPD.js`),__vite__mapDeps([46,1,3,18,13,5,16,14,15,4])),`ServiceAccountsTab`)}),nke=Xv({getParentRoute:()=>X9,path:`users`,validateSearch:uOe,component:$v(()=>WQ(()=>import(`./UsersTab-CuY3xwoe.js`),__vite__mapDeps([47,1,3,18,13,5,16,24,14,15])),`UsersTab`)}),rke=Xv({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw f_({to:`/settings/$tab`,params:{tab:WDe.uiprefs},replace:!0})}}),ike=Xv({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:X4([...E9]).catch(`roles`).parse(e.tab)}),component:HOe});function ake({error:e,reset:t}){let n=Nv(),r=Txe(e),[i]=(0,z.useState)(()=>r&&Oxe(Date.now()));return(0,z.useEffect)(()=>{i&&window.location.reload()},[i]),i?(0,B.jsx)(`div`,{className:`oc-route-error`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:Vi()})}):(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(ex,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:$e()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:ft()}),(0,B.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>{r?window.location.reload():t()},children:To()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:uh()})]})]})}function oke(){let e=Nv();return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(By,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:ze()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:co()}),(0,B.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:uh()})})]})}var Z9=my({routeTree:Y9.addChildren([GOe,KOe,qOe,X9.addChildren([JOe,YOe,ZOe,XOe,QOe,$Oe,eke,tke,nke,rke,ike])]),defaultPreload:`intent`,defaultErrorComponent:ake,defaultNotFoundComponent:oke}),ske=()=>null;function Q9({children:e}){return(0,B.jsx)(`div`,{style:{display:`flex`,minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}var $9=gte.createRoot(document.getElementById(`root`));$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Q9,{children:et()})})),$Se().then(e=>{let t=new si(e);$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Ete,{client:t,children:(0,B.jsxs)(vSe,{children:[(0,B.jsx)(iwe,{children:(0,B.jsx)(_y,{router:Z9})}),(0,B.jsx)(z.Suspense,{fallback:null,children:(0,B.jsx)(ske,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsxs)(Q9,{children:[_u(),` `,e instanceof Error?e.message:String(e)]})}))});export{y0 as $,Mx as $t,x5 as A,eb as An,IF as At,ACe as B,jy as Bn,_F as Bt,M7 as C,yb as Cn,eI as Ct,tEe as D,ib as Dn,JF as Dt,O5 as E,pb as En,XF as Et,A6 as F,Vy as Fn,CF as Ft,m3 as G,Mv as Gn,fk as Gt,cCe as H,ky as Hn,sM as Ht,D6 as I,Ry as In,wF as It,l3 as J,kO as Jt,p3 as K,jv as Kn,dk as Kt,k6 as L,Fy as Ln,bF as Lt,X6 as M,Yy as Mn,yF as Mt,W6 as N,Ky as Nn,xF as Nt,A7 as O,rb as On,FF as Ot,M6 as P,Gy as Pn,SF as Pt,x0 as Q,Bne as Qt,E6 as R,Ny as Rn,gF as Rt,D7 as S,xb as Sn,nI as St,a7 as T,mb as Tn,tI as Tt,G3 as U,Sy as Un,aM as Ut,f6 as V,Ay as Vn,cM as Vt,K3 as W,Nv as Wn,oM as Wt,_0 as X,Rne as Xt,c3 as Y,Lx as Yt,b0 as Z,zne as Zt,q7 as _,Pb as _n,oI as _t,rOe as a,Ox as an,p0 as at,U7 as b,Ab as bn,iI as bt,UDe as c,tx as cn,o0 as ct,g9 as d,Yb as dn,QQ as dt,Fx as en,v0 as et,i9 as f,Ub as fn,nme as ft,X7 as g,Fb as gn,sI as gt,Y7 as h,Ib as hn,WQ as ht,tOe as i,Ax as in,m0 as it,h5 as j,Xy as jn,EF as jt,b5 as k,tb as kn,kue as kt,D9 as l,ex as ln,s0 as lt,J7 as m,Rb as mn,b1 as mt,I9 as n,kx as nn,f0 as nt,nOe as o,ix as on,h0 as ot,Z7 as p,Bb as pn,_1 as pt,d3 as q,ok as qt,eOe as r,Ix as rn,g0 as rt,iOe as s,nx as sn,Phe as st,G9 as t,Ex as tn,d0 as tt,O9 as u,$b as un,G1 as ut,V7 as v,Nb as vn,ZF as vt,r7 as w,vb as wn,$F as wt,R7 as x,Db as xn,QF as xt,I7 as y,jb as yn,rI as yt,O6 as z,My as zn,vF as zt};
|