@deepseekcode/cli 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/cli.js +933 -952
  2. package/package.json +1 -1
  3. package/web/dist/assets/{AgentFlowView-Co1aujcZ.js → AgentFlowView-6USCyrFl.js} +1 -1
  4. package/web/dist/assets/{AgentsView-CHvg1cY0.js → AgentsView-DIQF5p_N.js} +1 -1
  5. package/web/dist/assets/{AskQuestionModal-nAvPzz0y.js → AskQuestionModal-CLWT8DhL.js} +1 -1
  6. package/web/dist/assets/AuditView-DBwRTWzN.js +1 -0
  7. package/web/dist/assets/AutomationView-BozrLP45.js +1 -0
  8. package/web/dist/assets/ChannelConfigView-BTJCJScS.js +8 -0
  9. package/web/dist/assets/{FileTreeView-DA87bArS.js → FileTreeView-DOdE5qBA.js} +3 -3
  10. package/web/dist/assets/{HookApprovalModal-qN4gBTAu.js → HookApprovalModal-CrNa083u.js} +1 -1
  11. package/web/dist/assets/HookConfigView-CNpD8Jv7.js +3 -0
  12. package/web/dist/assets/InboxView-BNhgTvd9.js +1 -0
  13. package/web/dist/assets/ModelsView-B1GqZqjO.js +1 -0
  14. package/web/dist/assets/SessionGrid-DJ5UUFop.js +20 -0
  15. package/web/dist/assets/{SettingsPanel-UUAdnvtB.js → SettingsPanel-Dg-3KdpS.js} +3 -3
  16. package/web/dist/assets/{SkillsView-C1s0EA-r.js → SkillsView-CmyeEMlL.js} +1 -1
  17. package/web/dist/assets/TerminalView-CPah4WvZ.js +3 -0
  18. package/web/dist/assets/Toast-CcbSW0V2.js +1 -0
  19. package/web/dist/assets/{ToolsView-DvbfsrpK.js → ToolsView-BbzWXjzq.js} +1 -1
  20. package/web/dist/assets/{hookRisk-CbXD9F3U.js → hookRisk-C6SdQfEF.js} +1 -1
  21. package/web/dist/assets/{icons-CjYP2PII.js → icons-uody4X-4.js} +89 -64
  22. package/web/dist/assets/index-C8wRfTaF.css +1 -0
  23. package/web/dist/assets/index-iwMdZJIm.js +21 -0
  24. package/web/dist/assets/{markdown-CIsUyqRd.js → markdown-BUScHEtT.js} +1 -1
  25. package/web/dist/assets/panels-C_0RapVg.js +1 -0
  26. package/web/dist/assets/{react-vendor-DuqM3ddv.js → react-vendor-C5NlWs7r.js} +1 -1
  27. package/web/dist/assets/{state-BCeK45RP.js → state-DKyBAq9j.js} +1 -1
  28. package/web/dist/index.html +6 -6
  29. package/web/dist/assets/ChannelConfigView-DPg31Ui7.js +0 -8
  30. package/web/dist/assets/HookConfigView-CBzuNojA.js +0 -3
  31. package/web/dist/assets/ModelsView-D4X70i7U.js +0 -1
  32. package/web/dist/assets/SessionGrid-CG6wC-sh.js +0 -20
  33. package/web/dist/assets/TerminalView-DJitpAf8.js +0 -3
  34. package/web/dist/assets/Toast-DJAVHqFo.js +0 -1
  35. package/web/dist/assets/index-B-DFEdP3.js +0 -21
  36. package/web/dist/assets/index-D2PsJB4J.css +0 -1
  37. package/web/dist/assets/panels-DP49kN7A.js +0 -1
@@ -1,20 +0,0 @@
1
- import{j as r,M as Yr,P as Jr}from"./markdown-CIsUyqRd.js";import{R as D,r as S,w as Zr,ap as rr,k as it,a as lt,i as nn,as as sr,X as rn,at as Qr,o as ct,d as Tn,b as or,al as ar,F as Gt,au as Wt,av as qr,D as es,v as ts,K as ns,a5 as rs,aw as En,ax as ss,p as Rt,B as os,$ as as,ay as is,y as ls,az as cs,aA as ds,ai as us,aB as ps,ag as ms,u as hs,aC as fs,L as xs}from"./icons-CjYP2PII.js";import{x as gs}from"./react-vendor-DuqM3ddv.js";import{i as Me,e as Re,w as He,j as yn,u as st,a as Vt,t as Pe,k as Oe,W as bs,l as vs,m as Kt,b as Ss,n as Nn,d as ws,S as ks}from"./index-B-DFEdP3.js";import{c as Is,e as Ts,R as Es}from"./hookRisk-CbXD9F3U.js";import"./state-BCeK45RP.js";function Cn({value:t,max:e=100,size:n="md",variant:s="default",showLabel:o=!1,className:i}){const a=Math.min(Math.max(t/e*100,0),100),c={sm:"h-1",md:"h-2",lg:"h-3"},l={default:"bg-accent-blue",success:"bg-accent-green",warning:"bg-accent-yellow",error:"bg-accent-red"};return r.jsxs("div",{className:Me("w-full",i),children:[r.jsx("div",{className:Me("w-full bg-dark-border rounded-full overflow-hidden",c[n]),children:r.jsx("div",{className:Me("h-full rounded-full transition-all duration-300",l[s]),style:{width:`${a}%`}})}),o&&r.jsxs("span",{className:"text-xs text-dark-muted mt-1",children:[Math.round(a),"%"]})]})}const At=0,Ue=1,tt=2,ir=4;function jn(t){return()=>t}function ys(t){t()}function lr(t,e){return n=>t(e(n))}function Rn(t,e){return()=>t(e)}function Ns(t,e){return n=>t(e,n)}function sn(t){return t!==void 0}function Cs(...t){return()=>{t.map(ys)}}function nt(){}function Ot(t,e){return e(t),t}function js(t,e){return e(t)}function ae(...t){return t}function te(t,e){return t(Ue,e)}function G(t,e){t(At,e)}function on(t){t(tt)}function ce(t){return t(ir)}function z(t,e){return te(t,Ns(e,At))}function Le(t,e){const n=t(Ue,s=>{n(),e(s)});return n}function An(t){let e,n;return s=>o=>{e=o,n&&clearTimeout(n),n=setTimeout(()=>{s(e)},t)}}function cr(t,e){return t===e}function oe(t=cr){let e;return n=>s=>{t(e,s)||(e=s,n(s))}}function P(t){return e=>n=>{t(n)&&e(n)}}function A(t){return e=>lr(e,t)}function De(t){return e=>()=>{e(t)}}function E(t,...e){const n=Rs(...e);return(s,o)=>{switch(s){case tt:on(t);return;case Ue:return te(t,n(o))}}}function ze(t,e){return n=>s=>{n(e=t(e,s))}}function Ye(t){return e=>n=>{t>0?t--:e(n)}}function _e(t){let e=null,n;return s=>o=>{e=o,!n&&(n=setTimeout(()=>{n=void 0,s(e)},t))}}function W(...t){const e=Array.from({length:t.length});let n=0,s=null;const o=2**t.length-1;return t.forEach((i,a)=>{const c=2**a;te(i,l=>{const d=n;n|=c,e[a]=l,d!==o&&n===o&&s&&(s(),s=null)})}),i=>a=>{const c=()=>{i([a].concat(e))};n===o?c():s=c}}function Rs(...t){return e=>t.reduceRight(js,e)}function As(t){let e,n;const s=()=>e==null?void 0:e();return function(o,i){switch(o){case Ue:return i?n===i?void 0:(s(),n=i,e=te(t,i),e):(s(),nt);case tt:s(),n=null;return}}}function N(t){let e=t;const n=Y();return(s,o)=>{switch(s){case At:e=o;break;case Ue:{o(e);break}case ir:return e}return n(s,o)}}function ke(t,e){return Ot(N(e),n=>z(t,n))}function Y(){const t=[];return(e,n)=>{switch(e){case At:t.slice().forEach(s=>{s(n)});return;case tt:t.splice(0);return;case Ue:return t.push(n),()=>{const s=t.indexOf(n);s>-1&&t.splice(s,1)}}}}function Ne(t){return Ot(Y(),e=>z(t,e))}const Os={singleton:!0};function q(t,e=[],n=Os){const{singleton:s}=n;return{constructor:t,dependencies:e,id:Ls(),singleton:s}}const Ls=()=>Symbol("id");function Fs(t){const e=new Map,n=({constructor:s,dependencies:o,id:i,singleton:a})=>{if(a&&e.has(i))return e.get(i);const c=s(o.map(l=>n(l)));return a&&e.set(i,c),c};return n(t)}function he(...t){const e=Y(),n=Array.from({length:t.length});let s=0;const o=2**t.length-1;return t.forEach((i,a)=>{const c=2**a;te(i,l=>{n[a]=l,s|=c,s===o&&G(e,n)})}),function(i,a){switch(i){case tt:{on(e);return}case Ue:return s===o&&a(n),te(e,a)}}}function _(t,e=cr){return E(t,oe(e))}function Xt(...t){return function(e,n){switch(e){case tt:return;case Ue:return Cs(...t.map(s=>te(s,n)))}}}const ge={DEBUG:0,INFO:1,WARN:2,ERROR:3},Hs={[ge.DEBUG]:"debug",[ge.ERROR]:"error",[ge.INFO]:"log",[ge.WARN]:"warn"},Ds=()=>typeof globalThis>"u"?window:globalThis,Ge=q(()=>{const t=N(ge.ERROR);return{log:N((e,n,s=ge.INFO)=>{const o=Ds().VIRTUOSO_LOG_LEVEL??ce(t);s>=o&&console[Hs[s]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",e,n)}),logLevel:t}},[],{singleton:!0}),Yt=new WeakMap;function dr(t){return"self"in t?t.document.documentElement:t}function zs(t){const e=dr(t),n=Yt.get(e);if(n!==void 0)return n;const s=e.ownerDocument.defaultView.getComputedStyle(e).direction==="rtl";return Yt.set(e,s),s}function On(t){Yt.delete(dr(t))}function ur(t,e){return zs(t)?-e:e}const Ke=ur;function Ln(t,e){return ur(t,e)}function Je(t,e,n){return an(t,e,n).callbackRef}function an(t,e,n){const s=D.useRef(null);let o=a=>{};const i=D.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(a=>{const c=()=>{const l=a[0].target;l.offsetParent!==null&&t(l)};n?c():requestAnimationFrame(c)}):null,[t,n]);return o=a=>{a&&e?(i==null||i.observe(a),s.current=a):(s.current&&(i==null||i.unobserve(s.current)),s.current=null)},{callbackRef:o,ref:s}}function Ms(t,e,n,s,o,i,a,c,l){const d=D.useCallback(u=>{var g;const f=Bs(u.children,e,c?"offsetWidth":"offsetHeight",o);let x=u.parentElement;for(;x.dataset.virtuosoScroller===void 0;)x=x.parentElement;const p=((g=x.lastElementChild)==null?void 0:g.dataset.viewportType)==="window";let v;p&&(v=x.ownerDocument.defaultView);const T=a?c?a.scrollWidth:a.scrollHeight:p?c?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight:c?x.scrollWidth:x.scrollHeight,b=a?c?a.offsetWidth:a.offsetHeight:p?c?v.innerWidth:v.innerHeight:c?x.offsetWidth:x.offsetHeight,h=a?c?Ke(a,a.scrollLeft):a.scrollTop:p?c?Ke(v,v.scrollX||v.document.documentElement.scrollLeft):v.scrollY||v.document.documentElement.scrollTop:c?Ke(x,x.scrollLeft):x.scrollTop;s({scrollHeight:T,scrollTop:Math.max(h,0),viewportHeight:b}),i==null||i(c?Fn("column-gap",getComputedStyle(u).columnGap,o):Fn("row-gap",getComputedStyle(u).rowGap,o)),f!==null&&t(f)},[t,e,o,i,a,s,c]);return an(d,n,l)}function Bs(t,e,n,s){const o=t.length;if(o===0)return null;const i=[];for(let a=0;a<o;a++){const c=t.item(a);if(c.dataset.index===void 0)continue;const l=parseInt(c.dataset.index,10),d=parseFloat(c.dataset.knownSize),u=e(c,n);if(u===0&&s("Zero-sized element, this should not happen",{child:c},ge.ERROR),u===d)continue;const f=i[i.length-1];i.length===0||f.size!==u||f.endIndex!==l-1?i.push({endIndex:l,size:u,startIndex:l}):i[i.length-1].endIndex++}return i}function Fn(t,e,n){return e!=="normal"&&(e==null?void 0:e.endsWith("px"))!==!0&&n(`${t} was not resolved to pixel value correctly`,e,ge.WARN),e==="normal"?0:parseInt(e??"0",10)}function pr(t,e,n){const s=D.useRef(null),o=D.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const d=l.getBoundingClientRect(),u=d.width;let f,x;if(e){const p=e.getBoundingClientRect(),v=d.top-p.top;x=p.height-Math.max(0,v),f=v+e.scrollTop}else{const p=a.current.ownerDocument.defaultView;x=p.innerHeight-Math.max(0,d.top),f=d.top+p.scrollY}s.current={listHeight:d.height,offsetTop:f,visibleHeight:x,visibleWidth:u},t(s.current)},[t,e]),{callbackRef:i,ref:a}=an(o,!0,n),c=D.useCallback(()=>{o(a.current)},[o,a]);return D.useEffect(()=>{var d;if(e){e.addEventListener("scroll",c);const u=new ResizeObserver(()=>{requestAnimationFrame(c)});return u.observe(e),()=>{e.removeEventListener("scroll",c),u.unobserve(e)}}const l=(d=a.current)==null?void 0:d.ownerDocument.defaultView;return l==null||l.addEventListener("scroll",c),l==null||l.addEventListener("resize",c),()=>{l==null||l.removeEventListener("scroll",c),l==null||l.removeEventListener("resize",c)}},[c,e,a]),i}const Te=q(()=>{const t=Y(),e=Y(),n=N(0),s=Y(),o=N(0),i=Y(),a=Y(),c=N(0),l=N(0),d=N(0),u=N(0),f=Y(),x=Y(),p=N(!1),v=N(!1),T=N(!1);return z(E(t,A(({scrollTop:b})=>b)),e),z(E(t,A(({scrollHeight:b})=>b)),a),z(e,o),{deviation:n,fixedFooterHeight:d,fixedHeaderHeight:l,footerHeight:u,headerHeight:c,horizontalDirection:v,scrollBy:x,scrollContainerState:t,scrollHeight:a,scrollingInProgress:p,scrollTo:f,scrollTop:e,skipAnimationFrameInResizeObserver:T,smoothScrollTargetReached:s,statefulScrollTop:o,viewportHeight:i}},[],{singleton:!0}),dt={lvl:0};function mr(t,e){const n=t.length;if(n===0)return[];let{index:s,value:o}=e(t[0]);const i=[];for(let a=1;a<n;a++){const{index:c,value:l}=e(t[a]);i.push({end:c-1,start:s,value:o}),s=c,o=l}return i.push({end:1/0,start:s,value:o}),i}function ne(t){return t===dt}function ut(t,e){if(!ne(t))return e===t.k?t.v:e<t.k?ut(t.l,e):ut(t.r,e)}function Fe(t,e,n="k"){if(ne(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const s=Fe(t.r,e,n);return s[0]===-1/0?[t.k,t.v]:s}return Fe(t.l,e,n)}function ye(t,e,n){return ne(t)?xr(e,n,1):e===t.k?xe(t,{k:e,v:n}):e<t.k?Hn(xe(t,{l:ye(t.l,e,n)})):Hn(xe(t,{r:ye(t.r,e,n)}))}function qe(){return dt}function et(t,e,n){if(ne(t))return[];const s=Fe(t,e)[0];return _s(Zt(t,s,n))}function Jt(t,e){if(ne(t))return dt;const{k:n,l:s,r:o}=t;if(e===n){if(ne(s))return o;if(ne(o))return s;const[i,a]=fr(s);return yt(xe(t,{k:i,l:hr(s),v:a}))}return e<n?yt(xe(t,{l:Jt(s,e)})):yt(xe(t,{r:Jt(o,e)}))}function Xe(t){return ne(t)?[]:[...Xe(t.l),{k:t.k,v:t.v},...Xe(t.r)]}function Zt(t,e,n){if(ne(t))return[];const{k:s,l:o,r:i,v:a}=t;let c=[];return s>e&&(c=c.concat(Zt(o,e,n))),s>=e&&s<=n&&c.push({k:s,v:a}),s<=n&&(c=c.concat(Zt(i,e,n))),c}function yt(t){const{l:e,lvl:n,r:s}=t;if(s.lvl>=n-1&&e.lvl>=n-1)return t;if(n>s.lvl+1){if(Ht(e))return gr(xe(t,{lvl:n-1}));if(!ne(e)&&!ne(e.r))return xe(e.r,{l:xe(e,{r:e.r.l}),lvl:n,r:xe(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Ht(t))return Qt(xe(t,{lvl:n-1}));if(!ne(s)&&!ne(s.l)){const o=s.l,i=Ht(o)?s.lvl-1:s.lvl;return xe(o,{l:xe(t,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:Qt(xe(s,{l:o.r,lvl:i}))})}throw new Error("Unexpected empty nodes")}function xe(t,e){return xr(e.k===void 0?t.k:e.k,e.v===void 0?t.v:e.v,e.lvl===void 0?t.lvl:e.lvl,e.l===void 0?t.l:e.l,e.r===void 0?t.r:e.r)}function hr(t){return ne(t.r)?t.l:yt(xe(t,{r:hr(t.r)}))}function Ht(t){return ne(t)||t.lvl>t.r.lvl}function fr(t){return ne(t.r)?[t.k,t.v]:fr(t.r)}function xr(t,e,n,s=dt,o=dt){return{k:t,l:s,lvl:n,r:o,v:e}}function Hn(t){return Qt(gr(t))}function gr(t){const{l:e}=t;return!ne(e)&&e.lvl===t.lvl?xe(e,{r:xe(t,{l:e.r})}):t}function Qt(t){const{lvl:e,r:n}=t;return!ne(n)&&!ne(n.r)&&n.lvl===e&&n.r.lvl===e?xe(n,{l:xe(t,{r:n.l}),lvl:e+1}):t}function _s(t){return mr(t,({k:e,v:n})=>({index:e,value:n}))}function br(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function pt(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const ln=q(()=>({recalcInProgress:N(!1)}),[],{singleton:!0});function vr(t,e,n){return t[Ct(t,e,n)]}function Ct(t,e,n,s=0){let o=t.length-1;for(;s<=o;){const i=Math.floor((s+o)/2),a=t[i],c=n(a,e);if(c===0)return i;if(c===-1){if(o-s<2)return i-1;o=i-1}else{if(o===s)return i;s=i+1}}throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${e}`)}function Ps(t,e,n,s){const o=Ct(t,e,s),i=Ct(t,n,s,o);return t.slice(o,i+1)}function $e(t,e){return Math.round(t.getBoundingClientRect()[e])}function Lt(t){return!ne(t.groupOffsetTree)}function cn({index:t},e){return e===t?0:e<t?-1:1}function $s(){return{groupIndices:[],groupOffsetTree:qe(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:qe()}}function Us(t,e){let n=ne(t)?0:1/0;for(const s of e){const{endIndex:o,size:i,startIndex:a}=s;if(n=Math.min(n,a),ne(t)){t=ye(t,0,i);continue}const c=et(t,a-1,o+1);if(c.some(Js(s)))continue;let l=!1,d=!1;for(const{end:u,start:f,value:x}of c)l?(o>=f||i===x)&&(t=Jt(t,f)):(d=x!==i,l=!0),u>o&&o>=f&&x!==i&&(t=ye(t,o+1,x));d&&(t=ye(t,a,i))}return[t,n]}function Gs(t){return t.groupIndex!==void 0}function Ws({offset:t},e){return e===t?0:e<t?-1:1}function mt(t,e,n){if(e.length===0)return 0;const{index:s,offset:o,size:i}=vr(e,t,cn),a=t-s,c=i*a+(a-1)*n+o;return c>0?c+n:c}function Sr(t,e){if(!Lt(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function wr(t,e,n){if(Gs(t))return e.groupIndices[t.groupIndex]+1;const s=t.index==="LAST"?n:t.index;let o=Sr(s,e);return o=Math.max(0,Math.min(n,o)),o}function Vs(t,e,n,s=0){return s>0&&(e=Math.max(e,vr(t,s,cn).offset)),mr(Ps(t,e,n,Ws),Ys)}function Ks(t,[e,n,s,o]){e.length>0&&s("received item sizes",e,ge.DEBUG);const i=t.sizeTree;let a=i,c=0;if(n.length>0&&ne(i)&&e.length===2){const x=e[0].size,p=e[1].size;a=n.reduce((v,T)=>ye(ye(v,T,x),T+1,p),a)}else[a,c]=Us(a,e);if(a===i)return t;const{lastIndex:l,lastOffset:d,lastSize:u,offsetTree:f}=qt(t.offsetTree,c,a,o);return{groupIndices:n,groupOffsetTree:n.reduce((x,p)=>ye(x,p,mt(p,f,o)),qe()),lastIndex:l,lastOffset:d,lastSize:u,offsetTree:f,sizeTree:a}}function Xs(t){return Xe(t).map(({k:e,v:n},s,o)=>{const i=o[s+1];return{endIndex:i===void 0?1/0:i.k-1,size:n,startIndex:e}})}function Dn(t,e){let n=0,s=0;for(;n<t;)n+=e[s+1]-e[s]-1,s++;return s-(n===t?0:1)}function qt(t,e,n,s){let o=t,i=0,a=0,c=0,l=0;if(e===0)o=[];else{l=Ct(o,e-1,cn),c=o[l].offset;const d=Fe(n,e-1);i=d[0],a=d[1],o.length&&o[l].size===Fe(n,e)[1]&&(l-=1),o=o.slice(0,l+1)}for(const{start:d,value:u}of et(n,e,1/0)){const f=d-i,x=f*a+c+f*s;o.push({index:d,offset:x,size:u}),i=d,c=x,a=u}return{lastIndex:i,lastOffset:c,lastSize:a,offsetTree:o}}function Ys(t){return{index:t.index,value:t}}function Js(t){const{endIndex:e,size:n,startIndex:s}=t;return o=>o.start===s&&(o.end===e||o.end===1/0)&&o.value===n}const Zs={offsetHeight:"height",offsetWidth:"width"},Be=q(([{log:t},{recalcInProgress:e}])=>{const n=Y(),s=Y(),o=ke(s,0),i=Y(),a=Y(),c=N(0),l=N([]),d=N(void 0),u=N(void 0),f=N(void 0),x=N(void 0),p=N((m,k)=>$e(m,Zs[k])),v=N(void 0),T=N(0),b=$s(),h=ke(E(n,W(l,t,T),ze(Ks,b),oe()),b),g=ke(E(l,oe(),ze((m,k)=>({current:k,prev:m.current}),{current:[],prev:[]}),A(({prev:m})=>m)),[]);z(E(l,P(m=>m.length>0),W(h,T),A(([m,k,j])=>{const F=m.reduce((O,U,H)=>ye(O,U,mt(U,k.offsetTree,j)||H),qe());return{...k,groupIndices:m,groupOffsetTree:F}})),h),z(E(s,W(h),P(([m,{lastIndex:k}])=>m<k),A(([m,{lastIndex:k,lastSize:j}])=>[{endIndex:k,size:j,startIndex:m}])),n),z(d,u);const w=ke(E(d,A(m=>m===void 0)),!0);z(E(u,P(m=>m!==void 0&&ne(ce(h).sizeTree)),A(m=>{const k=ce(f),j=ce(l).length>0;return k!==void 0&&k!==0?j?[{endIndex:0,size:k,startIndex:0},{endIndex:1,size:m,startIndex:1}]:[]:[{endIndex:0,size:m,startIndex:0}]})),n),z(E(x,P(m=>m!==void 0&&m.length>0&&ne(ce(h).sizeTree)),A(m=>{const k=[];let j=m[0],F=0;for(let O=1;O<m.length;O++){const U=m[O];U!==j&&(k.push({endIndex:O-1,size:j,startIndex:F}),j=U,F=O)}return k.push({endIndex:m.length-1,size:j,startIndex:F}),k})),n),z(E(l,W(f,u),P(([,m,k])=>m!==void 0&&k!==void 0),A(([m,k,j])=>{const F=[];for(let O=0;O<m.length;O++){const U=m[O],H=m[O+1];F.push({startIndex:U,endIndex:U,size:k}),H!==void 0&&F.push({startIndex:U+1,endIndex:H-1,size:j})}return F})),n);const C=Ne(E(n,W(h),ze(({sizes:m},[k,j])=>({changed:j!==m,sizes:j}),{changed:!1,sizes:b}),A(m=>m.changed)));te(E(c,ze((m,k)=>({diff:m.prev-k,prev:k}),{diff:0,prev:0}),A(m=>m.diff)),m=>{const{groupIndices:k}=ce(h);if(m>0)G(e,!0),G(i,m+Dn(m,k));else if(m<0){const j=ce(g);j.length>0&&(m-=Dn(-m,j)),G(a,m)}}),te(E(c,W(t)),([m,k])=>{m<0&&k("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},ge.ERROR)});const I=Ne(i);z(E(i,W(h),A(([m,k])=>{const j=k.groupIndices.length>0,F=[],O=k.lastSize;if(j){const U=ut(k.sizeTree,0);let H=0,M=0;for(;H<m;){const Q=k.groupIndices[M],J=k.groupIndices.length===M+1?1/0:k.groupIndices[M+1]-Q-1;F.push({endIndex:Q,size:U,startIndex:Q}),F.push({endIndex:Q+1+J-1,size:O,startIndex:Q+1}),M++,H+=J+1}const X=Xe(k.sizeTree);return H!==m&&X.shift(),X.reduce((Q,{k:J,v:ie})=>{let Ee=Q.ranges;return Q.prevSize!==0&&(Ee=[...Q.ranges,{endIndex:J+m-1,size:Q.prevSize,startIndex:Q.prevIndex}]),{prevIndex:J+m,prevSize:ie,ranges:Ee}},{prevIndex:m,prevSize:0,ranges:F}).ranges}return Xe(k.sizeTree).reduce((U,{k:H,v:M})=>({prevIndex:H+m,prevSize:M,ranges:[...U.ranges,{endIndex:H+m-1,size:U.prevSize,startIndex:U.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const L=Ne(E(a,W(h,T),A(([m,{offsetTree:k},j])=>{const F=-m;return mt(F,k,j)})));return z(E(a,W(h,T),A(([m,k,j])=>{if(k.groupIndices.length>0){if(ne(k.sizeTree))return k;let O=qe();const U=ce(g);let H=0,M=0,X=0;for(;H<-m;){X=U[M];const Q=U[M+1]-X-1;M++,H+=Q+1}if(O=Xe(k.sizeTree).reduce((Q,{k:J,v:ie})=>ye(Q,Math.max(0,J+m),ie),O),H!==-m){const Q=ut(k.sizeTree,X);O=ye(O,0,Q);const J=Fe(k.sizeTree,-m+1)[1];O=ye(O,1,J)}return{...k,sizeTree:O,...qt(k.offsetTree,0,O,j)}}const F=Xe(k.sizeTree).reduce((O,{k:U,v:H})=>ye(O,Math.max(0,U+m),H),qe());return{...k,sizeTree:F,...qt(k.offsetTree,0,F,j)}})),h),{beforeUnshiftWith:I,data:v,defaultItemSize:u,firstItemIndex:c,fixedItemSize:d,fixedGroupSize:f,gap:T,groupIndices:l,heightEstimates:x,itemSize:p,listRefresh:C,shiftWith:a,shiftWithOffset:L,sizeRanges:n,sizes:h,statefulTotalCount:o,totalCount:s,trackItemSizes:w,unshiftWith:i}},ae(Ge,ln),{singleton:!0});function Qs(t){return t.reduce((e,n)=>(e.groupIndices.push(e.totalCount),e.totalCount+=n+1,e),{groupIndices:[],totalCount:0})}const kr=q(([{groupIndices:t,sizes:e,totalCount:n},{headerHeight:s,scrollTop:o}])=>{const i=Y(),a=Y(),c=Ne(E(i,A(Qs)));return z(E(c,A(l=>l.totalCount)),n),z(E(c,A(l=>l.groupIndices)),t),z(E(he(o,e,s),P(([l,d])=>Lt(d)),A(([l,d,u])=>Fe(d.groupOffsetTree,Math.max(l-u,0),"v")[0]),oe(),A(l=>[l])),a),{groupCounts:i,topItemsIndexes:a}},ae(Be,Te)),We=q(([{log:t}])=>{const e=N(!1),n=Ne(E(e,P(s=>s),oe()));return te(e,s=>{s&&ce(t)("props updated",{},ge.DEBUG)}),{didMount:n,propsReady:e}},ae(Ge),{singleton:!0}),qs=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Ir(t){const e=typeof t=="number"?{index:t}:{...t};return e.align||(e.align="start"),(!e.behavior||!qs)&&(e.behavior="auto"),e.offset===void 0&&(e.offset=0),e}const gt=q(([{gap:t,listRefresh:e,sizes:n,totalCount:s},{fixedFooterHeight:o,fixedHeaderHeight:i,footerHeight:a,headerHeight:c,scrollingInProgress:l,scrollTo:d,smoothScrollTargetReached:u,viewportHeight:f},{log:x}])=>{const p=Y(),v=Y(),T=N(0);let b=null,h=null,g=null;function w(){b!==null&&(b(),b=null),g!==null&&(g(),g=null),h&&(clearTimeout(h),h=null),G(l,!1)}return z(E(p,W(n,f,s,T,c,a,x),W(t,i,o),A(([[C,I,L,m,k,j,F,O],U,H,M])=>{const X=Ir(C),{align:Q,behavior:J,offset:ie}=X,Ee=m-1,be=wr(X,I,Ee);let Se=mt(be,I.offsetTree,U)+j;Q==="end"?(Se+=H+Fe(I.sizeTree,be)[1]-L+M,be===Ee&&(Se+=F)):Q==="center"?Se+=(H+Fe(I.sizeTree,be)[1]-L+M)/2:Se-=k,ie!==void 0&&ie!==0&&(Se+=ie);const Ae=ve=>{w(),ve?(O("retrying to scroll to",{location:C},ge.DEBUG),G(p,C)):(G(v,!0),O("list did not change, scroll successful",{},ge.DEBUG))};if(w(),J==="smooth"){let ve=!1;g=te(e,R=>{ve=ve||R}),b=Le(u,()=>{Ae(ve)})}else b=Le(E(e,eo(150)),Ae);return h=setTimeout(()=>{w()},1200),G(l,!0),O("scrolling from index to",{behavior:J,index:be,top:Se},ge.DEBUG),{behavior:J,top:Se}})),d),{scrollTargetReached:v,scrollToIndex:p,topListHeight:T}},ae(Be,Te,Ge),{singleton:!0});function eo(t){return e=>{const n=setTimeout(()=>{e(!1)},t);return s=>{s&&(e(!0),clearTimeout(n))}}}function dn(t,e){t===0?e():requestAnimationFrame(()=>{dn(t-1,e)})}function un(t,e){if(t===void 0)return 0;const n=e-1,s=typeof t=="number"?t:t.index==="LAST"?n:t.index;return Math.max(0,Math.min(s,n))}function en(t){return t===void 0?!0:typeof t=="number"?t===0:t.index===0&&(t.align===void 0||t.align==="start")&&(t.offset===void 0||t.offset===0)}const bt=q(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:s},{scrollTargetReached:o,scrollToIndex:i},{didMount:a}])=>{const c=N(!0),l=N(0),d=N(!0);return z(E(a,W(l),P(([u,f])=>!en(f)),De(!1)),c),z(E(a,W(l),P(([u,f])=>!en(f)),De(!1)),d),te(E(he(e,a),W(c,n,t,d),P(([[,u],f,{sizeTree:x},p,v])=>u&&(!ne(x)||sn(p))&&!f&&!v),W(l)),([,u])=>{if(u===void 0){G(c,!0),G(d,!0);return}Le(o,()=>{G(d,!0)}),dn(4,()=>{Le(s,()=>{G(c,!0)}),G(i,u)})}),{initialItemFinalLocationReached:d,initialTopMostItemIndex:l,scrolledToInitialItem:c}},ae(Be,Te,gt,We),{singleton:!0});function Tr(t,e){return Math.abs(t-e)<1.01}const ht="up",ot="down",to="none",no={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},ro=0,vt=q(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:s,scrollTop:o,viewportHeight:i}])=>{const a=N(!1),c=N(!0),l=Y(),d=Y(),u=N(4),f=N(ro),x=ke(E(Xt(E(_(o),Ye(1),De(!0)),E(_(o),Ye(1),De(!1),An(100))),oe()),!1),p=ke(E(Xt(E(n,De(!0)),E(n,De(!1),An(200))),oe()),!1);z(E(he(_(o),_(f)),A(([g,w])=>g<=w),oe()),c),z(E(c,_e(50)),d);const v=Ne(E(he(s,_(i),_(e),_(t),_(u)),ze((g,[{scrollHeight:w,scrollTop:C},I,L,m,k])=>{const j=C+I-w>-k,F={scrollHeight:w,scrollTop:C,viewportHeight:I};if(j){let U,H;return C>g.state.scrollTop?(U="SCROLLED_DOWN",H=g.state.scrollTop-C):(U="SIZE_DECREASED",H=g.state.scrollTop-C||g.scrollTopDelta),{atBottom:!0,atBottomBecause:U,scrollTopDelta:H,state:F}}let O;return F.scrollHeight>g.state.scrollHeight?O="SIZE_INCREASED":I<g.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":C<g.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:F}},no),oe((g,w)=>g!==void 0&&g.atBottom===w.atBottom))),T=ke(E(s,ze((g,{scrollHeight:w,scrollTop:C,viewportHeight:I})=>{if(!Tr(g.scrollHeight,w)){const L=w-(C+I)<1;return g.scrollTop!==C&&L?{changed:!0,jump:g.scrollTop-C,scrollHeight:w,scrollTop:C}:{changed:!0,jump:0,scrollHeight:w,scrollTop:C}}return{changed:!1,jump:0,scrollHeight:w,scrollTop:C}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),P(g=>g.changed),A(g=>g.jump)),0);z(E(v,A(g=>g.atBottom)),a),z(E(a,_e(50)),l);const b=N(ot);z(E(s,A(({scrollTop:g})=>g),oe(),ze((g,w)=>ce(p)?{direction:g.direction,prevScrollTop:w}:{direction:w<g.prevScrollTop?ht:ot,prevScrollTop:w},{direction:ot,prevScrollTop:0}),A(g=>g.direction)),b),z(E(s,_e(50),De(to)),b);const h=N(0);return z(E(x,P(g=>!g),De(0)),h),z(E(o,_e(100),W(x),P(([g,w])=>w),ze(([g,w],[C])=>[w,C],[0,0]),A(([g,w])=>w-g)),h),{atBottomState:v,atBottomStateChange:l,atBottomThreshold:u,atTopStateChange:d,atTopThreshold:f,isAtBottom:a,isAtTop:c,isScrolling:x,lastJumpDueToItemResize:T,scrollDirection:b,scrollVelocity:h}},ae(Te)),ft="top",xt="bottom",zn="none";function Mn(t,e,n){return typeof t=="number"?n===ht&&e===ft||n===ot&&e===xt?t:0:n===ht?e===ft?t.main:t.reverse:e===xt?t.main:t.reverse}function Bn(t,e){return typeof t=="number"?t:t[e]??0}const pn=q(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:s,viewportHeight:o}])=>{const i=Y(),a=N(0),c=N(0),l=N(0),d=ke(E(he(_(s),_(o),_(n),_(i,pt),_(l),_(a),_(e),_(t),_(c)),A(([u,f,x,[p,v],T,b,h,g,w])=>{const C=u-g,I=b+h,L=Math.max(x-C,0);let m=zn;const k=Bn(w,ft),j=Bn(w,xt);return p-=g,p+=x+h,v+=x+h,v-=g,p>u+I-k&&(m=ht),v<u-L+f+j&&(m=ot),m!==zn?[Math.max(C-x-Mn(T,ft,m)-k,0),C-L-h+f+Mn(T,xt,m)+j]:null}),P(u=>u!==null),oe(pt)),[0,0]);return{increaseViewportBy:c,listBoundary:i,overscan:l,topListHeight:a,visibleRange:d}},ae(Te),{singleton:!0});function so(t,e,n){if(Lt(e)){const s=Sr(t,e);return[{index:Fe(e.groupOffsetTree,s)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:s,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:t,offset:0,size:0}]}const Dt={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Nt(t,e,n,s,o,i){const{lastIndex:a,lastOffset:c,lastSize:l}=o;let d=0,u=0;if(t.length>0){d=t[0].offset;const T=t[t.length-1];u=T.offset+T.size}const f=n-a,x=c+f*l+(f-1)*s,p=d,v=x-u;return{bottom:u,firstItemIndex:i,items:_n(t,o,i),offsetBottom:v,offsetTop:d,top:p,topItems:_n(e,o,i),topListHeight:e.reduce((T,b)=>b.size+T,0),totalCount:n}}function Er(t,e,n,s,o,i){let a=0;if(n.groupIndices.length>0)for(const u of n.groupIndices){if(u-a>=t)break;a++}const c=t+a,l=un(e,c),d=Array.from({length:c}).map((u,f)=>({data:i[f+l],index:f+l,offset:0,size:0}));return Nt(d,[],c,o,n,s)}function _n(t,e,n){if(t.length===0)return[];if(!Lt(e))return t.map(d=>({...d,index:d.index+n,originalIndex:d.index}));const s=t[0].index,o=t[t.length-1].index,i=[],a=et(e.groupOffsetTree,s,o);let c,l=0;for(const d of t){(!c||c.end<d.index)&&(c=a.shift(),l=e.groupIndices.indexOf(c.start));let u;d.index===c.start?u={index:l,type:"group"}:u={groupIndex:l,index:d.index-(l+1)+n},i.push({...u,data:d.data,offset:d.offset,originalIndex:d.index,size:d.size})}return i}function Pn(t,e){return t===void 0?0:typeof t=="number"?t:t[e]??0}const Ze=q(([{data:t,firstItemIndex:e,gap:n,sizes:s,totalCount:o},i,{listBoundary:a,topListHeight:c,visibleRange:l},{initialTopMostItemIndex:d,scrolledToInitialItem:u},{topListHeight:f},x,{didMount:p},{recalcInProgress:v}])=>{const T=N([]),b=N(0),h=Y(),g=N(0);z(i.topItemsIndexes,T);const w=ke(E(he(p,v,_(l,pt),_(o),_(s),_(d),u,_(T),_(e),_(n),_(g),t),P(([m,k,,j,,,,,,,,F])=>{const O=F!==void 0&&F.length!==j;return m&&!k&&!O}),A(([,,[m,k],j,F,O,U,H,M,X,Q,J])=>{var B,Z;const ie=F,{offsetTree:Ee,sizeTree:be}=ie,Se=ce(b);if(j===0)return{...Dt,totalCount:j};if(m===0&&k===0)return Se===0?{...Dt,totalCount:j}:Er(Se,O,F,M,X,J||[]);if(ne(be))return Se>0?null:Nt(so(un(O,j),ie,J),[],j,X,ie,M);const Ae=[];if(H.length>0){const ee=H[0],le=H[H.length-1];let fe=0;for(const pe of et(be,ee,le)){const re=pe.value,de=Math.max(pe.start,ee),Ie=Math.min(pe.end,le);for(let me=de;me<=Ie;me++)Ae.push({data:J==null?void 0:J[me],index:me,offset:fe,size:re}),fe+=re}}if(!U)return Nt([],Ae,j,X,ie,M);const ve=H.length>0?H[H.length-1]+1:0,R=Vs(Ee,m,k,ve);if(R.length===0)return null;const V=j-1,K=Ot([],ee=>{for(const le of R){const fe=le.value;let pe=fe.offset,re=le.start;const de=fe.size;if(fe.offset<m){re+=Math.floor((m-fe.offset+X)/(de+X));const me=re-le.start;pe+=me*de+me*X}re<ve&&(pe+=(ve-re)*de,re=ve);const Ie=Math.min(le.end,V);for(let me=re;me<=Ie&&!(pe>=k);me++)ee.push({data:J==null?void 0:J[me],index:me,offset:pe,size:de}),pe+=de+X}}),ue=Pn(Q,ft),y=Pn(Q,xt);if(K.length>0&&(ue>0||y>0)){const ee=K[0],le=K[K.length-1];if(ue>0&&ee.index>ve){const fe=Math.min(ue,ee.index-ve),pe=[];let re=ee.offset;for(let de=ee.index-1;de>=ee.index-fe;de--){const Ie=((B=et(be,de,de)[0])==null?void 0:B.value)??ee.size;re-=Ie+X,pe.unshift({data:J==null?void 0:J[de],index:de,offset:re,size:Ie})}K.unshift(...pe)}if(y>0&&le.index<V){const fe=Math.min(y,V-le.index);let pe=le.offset+le.size+X;for(let re=le.index+1;re<=le.index+fe;re++){const de=((Z=et(be,re,re)[0])==null?void 0:Z.value)??le.size;K.push({data:J==null?void 0:J[re],index:re,offset:pe,size:de}),pe+=de+X}}}return Nt(K,Ae,j,X,ie,M)}),P(m=>m!==null),oe()),Dt);z(E(t,P(sn),A(m=>m==null?void 0:m.length)),o),z(E(w,A(m=>m.topListHeight)),f),z(f,c),z(E(w,A(m=>[m.top,m.bottom])),a),z(E(w,A(m=>m.items)),h);const C=Ne(E(w,P(({items:m})=>m.length>0),W(o,t),P(([{items:m},k])=>m[m.length-1].originalIndex===k-1),A(([,m,k])=>[m-1,k]),oe(pt),A(([m])=>m))),I=Ne(E(w,_e(200),P(({items:m,topItems:k})=>m.length>0&&m[0].originalIndex===k.length),A(({items:m})=>m[0].index),oe())),L=Ne(E(w,P(({items:m})=>m.length>0),A(({items:m})=>{let k=0,j=m.length-1;for(;m[k].type==="group"&&k<j;)k++;for(;m[j].type==="group"&&j>k;)j--;return{endIndex:m[j].index,startIndex:m[k].index}}),oe(br)));return{endReached:C,initialItemCount:b,itemsRendered:h,listState:w,minOverscanItemCount:g,rangeChanged:L,startReached:I,topItemsIndexes:T,...x}},ae(Be,kr,pn,bt,gt,vt,We,ln),{singleton:!0}),yr=q(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:s},{listState:o}])=>{const i=Y(),a=ke(E(he(n,t,s,e,o),A(([c,l,d,u,f])=>c+l+d+u+f.offsetBottom+f.bottom)),0);return z(_(a),i),{totalListHeight:a,totalListHeightChanged:i}},ae(Te,Ze),{singleton:!0}),oo=q(([{viewportHeight:t},{totalListHeight:e}])=>{const n=N(!1),s=ke(E(he(n,t,e),P(([o])=>o),A(([,o,i])=>Math.max(0,o-i)),_e(0),oe()),0);return{alignToBottom:n,paddingTopAddition:s}},ae(Te,yr),{singleton:!0}),Nr=q(()=>({context:N(null)})),ao=({itemBottom:t,itemTop:e,locationParams:{align:n,behavior:s,...o},viewportBottom:i,viewportTop:a})=>e<a?{...o,align:n??"start",...s===void 0?{}:{behavior:s}}:t>i?{...o,align:n??"end",...s===void 0?{}:{behavior:s}}:null,Cr=q(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:s,fixedHeaderHeight:o,headerHeight:i,scrollingInProgress:a,scrollTop:c,viewportHeight:l},{scrollToIndex:d}])=>{const u=Y();return z(E(u,W(e,l,n,i,o,s,c),W(t),A(([[f,x,p,v,T,b,h,g],w])=>{const{calculateViewLocation:C=ao,done:I,...L}=f,m=wr(f,x,v-1),k=mt(m,x.offsetTree,w)+T+b,j=k+Fe(x.sizeTree,m)[1],F=g+b,O=g+p-h,U=C({itemBottom:j,itemTop:k,locationParams:L,viewportBottom:O,viewportTop:F});return U===null?I==null||I():I&&Le(E(a,P(H=>!H),Ye(ce(a)?1:2)),I),U}),P(f=>f!==null)),d),{scrollIntoView:u}},ae(Be,Te,gt,Ze,Ge),{singleton:!0});function $n(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const io=(t,e)=>typeof t=="function"?$n(t(e)):e&&$n(t),lo=q(([{listRefresh:t,totalCount:e,fixedItemSize:n,data:s},{atBottomState:o,isAtBottom:i},{scrollToIndex:a},{scrolledToInitialItem:c},{didMount:l,propsReady:d},{log:u},{scrollingInProgress:f},{context:x},{scrollIntoView:p}])=>{const v=N(!1),T=Y();let b=null;function h(I){G(a,{align:"end",behavior:I,index:"LAST"})}te(E(he(E(_(e),Ye(1)),l),W(_(v),i,c,f),A(([[I,L],m,k,j,F])=>{let O=L&&j,U="auto";return O&&(U=io(m,k||F),O=O&&U!==!1),{followOutputBehavior:U,shouldFollow:O,totalCount:I}}),P(({shouldFollow:I})=>I)),({followOutputBehavior:I,totalCount:L})=>{b!==null&&(b(),b=null),ce(n)===void 0?b=Le(t,()=>{ce(u)("following output to ",{totalCount:L},ge.DEBUG),h(I),b=null}):requestAnimationFrame(()=>{ce(u)("following output to ",{totalCount:L},ge.DEBUG),h(I)})});function g(I){const L=Le(o,m=>{I&&!m.atBottom&&m.notAtBottomBecause==="SIZE_INCREASED"&&b===null&&(ce(u)("scrolling to bottom due to increased size",{},ge.DEBUG),h("auto"))});setTimeout(L,100)}te(E(he(_(v),e,d),P(([I,,L])=>I!==!1&&L),ze(({value:I},[,L])=>({refreshed:I===L,value:L}),{refreshed:!1,value:0}),P(({refreshed:I})=>I),W(v,e)),([,I])=>{ce(c)&&g(I!==!1)}),te(T,()=>{g(ce(v)!==!1)}),te(he(_(v),o),([I,L])=>{I!==!1&&!L.atBottom&&L.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&h("auto")});const w=N(null),C=Y();return z(Xt(E(_(s),A(I=>(I==null?void 0:I.length)??0)),E(_(e))),C),te(E(he(E(C,Ye(1)),l),W(_(w),c,f,x),A(([[I,L],m,k,j,F])=>L&&k&&(m==null?void 0:m({context:F,totalCount:I,scrollingInProgress:j}))),P(I=>!!I),_e(0)),I=>{b!==null&&(b(),b=null),ce(n)===void 0?b=Le(t,()=>{ce(u)("scrolling into view",{}),G(p,I),b=null}):requestAnimationFrame(()=>{ce(u)("scrolling into view",{}),G(p,I)})}),{autoscrollToBottom:T,followOutput:v,scrollIntoViewOnChange:w}},ae(Be,vt,gt,bt,We,Ge,Te,Nr,Cr)),co=q(([{data:t,firstItemIndex:e,gap:n,sizes:s},{initialTopMostItemIndex:o},{initialItemCount:i,listState:a},{didMount:c}])=>(z(E(c,W(i),P(([,l])=>l!==0),W(o,s,e,n,t),A(([[,l],d,u,f,x,p=[]])=>Er(l,d,u,f,x,p))),a),{}),ae(Be,bt,Ze,We),{singleton:!0}),uo=q(([{didMount:t},{scrollTo:e},{listState:n}])=>{const s=N(0);return te(E(t,W(s),P(([,o])=>o!==0),A(([,o])=>({top:o}))),o=>{Le(E(n,Ye(1),P(i=>i.items.length>1)),()=>{requestAnimationFrame(()=>{G(e,o)})})}),{initialScrollTop:s}},ae(We,Te,Ze),{singleton:!0}),jr=q(([{scrollVelocity:t}])=>{const e=N(!1),n=Y(),s=N(!1);return z(E(t,W(s,e,n),P(([o,i])=>i!==!1&&i!==void 0),A(([o,i,a,c])=>{const{enter:l,exit:d}=i;if(a){if(d(o,c))return!1}else if(l(o,c))return!0;return a}),oe()),e),te(E(he(e,t,n),W(s)),([[o,i,a],c])=>{o&&c!==!1&&c!==void 0&&c.change&&c.change(i,a)}),{isSeeking:e,scrollSeekConfiguration:s,scrollSeekRangeChanged:n,scrollVelocity:t}},ae(vt),{singleton:!0}),mn=q(([{scrollContainerState:t,scrollTo:e}])=>{const n=Y(),s=Y(),o=Y(),i=N(!1),a=N(void 0);return z(E(he(n,s),A(([{scrollTop:c,viewportHeight:l},{offsetTop:d,listHeight:u}])=>({scrollHeight:u,scrollTop:Math.max(0,c-d),viewportHeight:l}))),t),z(E(e,W(s),A(([c,{offsetTop:l}])=>({...c,top:c.top+l}))),o),{customScrollParent:a,useWindowScroll:i,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:s}},ae(Te)),po=q(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:s},{initialTopMostItemIndex:o},{didMount:i},{useWindowScroll:a,windowScrollContainerState:c,windowViewportRect:l}])=>{const d=Y(),u=N(void 0),f=N(null),x=N(null);return z(c,f),z(l,x),te(E(d,W(e,s,a,f,x,n)),([p,v,T,b,h,g,w])=>{const C=Xs(v.sizeTree);b&&h!==null&&g!==null&&(T=h.scrollTop-g.offsetTop),T-=w,p({ranges:C,scrollTop:T})}),z(E(u,P(sn),A(mo)),o),z(E(i,W(u),P(([,p])=>p!==void 0),oe(),A(([,p])=>p.ranges)),t),{getState:d,restoreStateFrom:u}},ae(Be,Te,bt,We,mn));function mo(t){return{align:"start",index:0,offset:t.scrollTop}}const ho=q(([{topItemsIndexes:t}])=>{const e=N(0);return z(E(e,P(n=>n>=0),A(n=>Array.from({length:n}).map((s,o)=>o))),t),{topItemCount:e}},ae(Ze));function Rr(t){let e=!1,n;return()=>(e||(e=!0,n=t()),n)}const fo=Rr(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),xo=q(([{deviation:t,scrollBy:e,scrollingInProgress:n,scrollTop:s},{isAtBottom:o,isScrolling:i,lastJumpDueToItemResize:a,scrollDirection:c},{listState:l},{beforeUnshiftWith:d,gap:u,shiftWithOffset:f,sizes:x},{log:p},{recalcInProgress:v}])=>{const T=Ne(E(l,W(a),ze(([,h,g,w],[{bottom:C,items:I,offsetBottom:L,totalCount:m},k])=>{const j=C+L;let F=0;return g===m&&h.length>0&&I.length>0&&(I[0].originalIndex===0&&h[0].originalIndex===0||(F=j-w,F!==0&&(F+=k))),[F,I,m,j]},[0,[],0,0]),P(([h])=>h!==0),W(s,c,n,o,p,v),P(([,h,g,w,,,C])=>!C&&!w&&h!==0&&g===ht),A(([[h],,,,,g])=>(g("Upward scrolling compensation",{amount:h},ge.DEBUG),h))));function b(h){h>0?(G(e,{behavior:"auto",top:-h}),G(t,0)):(G(t,0),G(e,{behavior:"auto",top:-h}))}return te(E(T,W(t,i)),([h,g,w])=>{w&&fo()?G(t,g-h):b(-h)}),te(E(he(ke(i,!1),t,v),P(([h,g,w])=>!h&&!w&&g!==0),A(([h,g])=>g),_e(1)),b),z(E(f,A(h=>({top:-h}))),e),te(E(d,W(x,u),A(([h,{groupIndices:g,lastSize:w,sizeTree:C},I])=>{function L(O){return O*(w+I)}if(g.length===0)return L(h);let m=0;const k=ut(C,0);let j=0,F=0;for(;j<h;){j++,m+=k;let O=g.length===F+1?1/0:g[F+1]-g[F]-1;j+O>h&&(m-=k,O=h-j+1),j+=O,m+=L(O),F++}return m})),h=>{G(t,h),requestAnimationFrame(()=>{G(e,{top:h}),requestAnimationFrame(()=>{G(t,0),G(v,!1)})})}),{deviation:t}},ae(Te,vt,Ze,Be,Ge,ln)),go=q(([t,e,n,s,o,i,a,c,l,d,u])=>({...t,...e,...n,...s,...o,...i,...a,...c,...l,...d,...u}),ae(pn,co,We,jr,yr,uo,oo,mn,Cr,Ge,Nr)),Ar=q(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:s,fixedGroupSize:o,gap:i,groupIndices:a,heightEstimates:c,itemSize:l,sizeRanges:d,sizes:u,statefulTotalCount:f,totalCount:x,trackItemSizes:p},{initialItemFinalLocationReached:v,initialTopMostItemIndex:T,scrolledToInitialItem:b},h,g,w,C,{scrollToIndex:I},L,{topItemCount:m},{groupCounts:k},j])=>{const{listState:F,minOverscanItemCount:O,topItemsIndexes:U,rangeChanged:H,...M}=C;return z(H,j.scrollSeekRangeChanged),z(E(j.windowViewportRect,A(X=>X.visibleHeight)),h.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:s,fixedGroupHeight:o,gap:i,groupCounts:k,heightEstimates:c,initialItemFinalLocationReached:v,initialTopMostItemIndex:T,scrolledToInitialItem:b,sizeRanges:d,topItemCount:m,topItemsIndexes:U,totalCount:x,...w,groupIndices:a,itemSize:l,listState:F,minOverscanItemCount:O,scrollToIndex:I,statefulTotalCount:f,trackItemSizes:p,rangeChanged:H,...M,...j,...h,sizes:u,...g}},ae(Be,bt,Te,po,lo,Ze,gt,xo,ho,kr,go));function bo(t,e){const n={},s={};let o=0;const i=t.length;for(;o<i;)s[t[o]]=1,o+=1;for(const a in e)Object.hasOwn(s,a)||(n[a]=e[a]);return n}const kt=typeof document>"u"?D.useEffect:D.useLayoutEffect;function Or(t,e,n){const s=Object.keys(e.required||{}),o=Object.keys(e.optional||{}),i=Object.keys(e.methods||{}),a=Object.keys(e.events||{}),c=D.createContext({});function l(b,h){b.propsReady!==void 0&&G(b.propsReady,!1);for(const g of s){const w=b[e.required[g]];G(w,h[g])}for(const g of o)if(g in h){const w=b[e.optional[g]];G(w,h[g])}b.propsReady!==void 0&&G(b.propsReady,!0)}function d(b){return i.reduce((h,g)=>(h[g]=w=>{const C=b[e.methods[g]];G(C,w)},h),{})}function u(b){return a.reduce((h,g)=>(h[g]=As(b[e.events[g]]),h),{})}const f=D.forwardRef(function(b,h){const{children:g,...w}=b,[C]=D.useState(()=>Ot(Fs(t),m=>{l(m,w)})),[I]=D.useState(Rn(u,C));kt(()=>{for(const m of a)m in w&&te(I[m],w[m]);return()=>{Object.values(I).map(on)}},[w,I,C]),kt(()=>{l(C,w)}),D.useImperativeHandle(h,jn(d(C)));const L=n;return r.jsx(c.Provider,{value:C,children:n===void 0?g:r.jsx(L,{...bo([...s,...o,...a],w),children:g})})}),x=b=>{const h=D.useContext(c);return D.useCallback(g=>{G(h[b],g)},[h,b])},p=b=>{const h=D.useContext(c)[b],g=D.useCallback(w=>te(h,w),[h]);return D.useSyncExternalStore(g,()=>ce(h),()=>ce(h))},v=b=>{const h=D.useContext(c)[b],[g,w]=D.useState(Rn(ce,h));return kt(()=>te(h,C=>{C!==g&&w(jn(C))}),[h,g]),g},T=parseInt(D.version,10)>=18?p:v;return{Component:f,useEmitter:(b,h)=>{const g=D.useContext(c)[b];kt(()=>te(g,h),[h,g])},useEmitterValue:T,usePublisher:x}}const Lr=D.createContext(void 0),Fr=D.createContext(void 0),zt="-webkit-sticky",Un="sticky",hn=Rr(()=>{if(typeof document>"u")return Un;const t=document.createElement("div");return t.style.position=zt,t.style.position===zt?zt:Un}),Hr=typeof document>"u"?D.useEffect:D.useLayoutEffect;function Mt(t){return"self"in t}function vo(t){return"body"in t}function Dr(t,e,n,s=nt,o,i){const a=D.useRef(null),c=D.useRef(null),l=D.useRef(null),d=D.useCallback(x=>{let p,v,T;const b=x.target;if(vo(b)||Mt(b)){const g=Mt(b)?b:b.defaultView;T=i===!0?Ke(g,g.scrollX):g.scrollY,p=i===!0?g.document.documentElement.scrollWidth:g.document.documentElement.scrollHeight,v=i===!0?g.innerWidth:g.innerHeight}else T=i===!0?Ke(b,b.scrollLeft):b.scrollTop,p=i===!0?b.scrollWidth:b.scrollHeight,v=i===!0?b.offsetWidth:b.offsetHeight;const h=()=>{t({scrollHeight:p,scrollTop:Math.max(T,0),viewportHeight:v})};x.suppressFlushSync===!0?h():gs.flushSync(h),c.current!==null&&(T===c.current||T<=0||T===p-v)&&(c.current=null,e(!0),l.current&&(clearTimeout(l.current),l.current=null))},[t,e,i]);D.useEffect(()=>{const x=o??a.current;return On(x),s(o??a.current),d({suppressFlushSync:!0,target:x}),x.addEventListener("scroll",d,{passive:!0}),()=>{On(x),s(null),x.removeEventListener("scroll",d)}},[a,d,n,s,o]);function u(x){const p=a.current;if(!p||(i===!0?"offsetWidth"in p&&p.offsetWidth===0:"offsetHeight"in p&&p.offsetHeight===0))return;const v=x.behavior==="smooth";let T,b,h;Mt(p)?(b=Math.max($e(p.document.documentElement,i===!0?"width":"height"),i===!0?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight),T=i===!0?p.innerWidth:p.innerHeight,h=i===!0?Ke(p,p.scrollX):p.scrollY):(b=p[i===!0?"scrollWidth":"scrollHeight"],T=$e(p,i===!0?"width":"height"),h=i===!0?Ke(p,p.scrollLeft):p.scrollTop);const g=b-T;if(x.top===void 0){p.scrollTo(x);return}const w=Math.ceil(Math.max(Math.min(g,x.top),0));if(x.top=w,Tr(T,b)||w===h){t({scrollHeight:b,scrollTop:h,viewportHeight:T}),v&&e(!0);return}v?(c.current=w,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,c.current=null,e(!0)},1e3)):c.current=null,i===!0&&(x={...x.behavior===void 0?{}:{behavior:x.behavior},left:Ln(p,w)}),p.scrollTo(x)}function f(x){i===!0&&(x={...x.behavior===void 0?{}:{behavior:x.behavior},...x.top===void 0?{}:{left:Ln(a.current,x.top)}}),a.current.scrollBy(x)}return{scrollByCallback:f,scrollerRef:a,scrollToCallback:u}}function fn(t){return t}const So=q(()=>{const t=N(c=>`Item ${c}`),e=N(c=>`Group ${c}`),n=N({}),s=N(fn),o=N("div"),i=N(nt),a=(c,l=null)=>ke(E(n,A(d=>d[c]),oe()),l);return{components:n,computeItemKey:s,EmptyPlaceholder:a("EmptyPlaceholder"),FooterComponent:a("Footer"),GroupComponent:a("Group","div"),groupContent:e,HeaderComponent:a("Header"),HeaderFooterTag:o,ItemComponent:a("Item","div"),itemContent:t,ListComponent:a("List","div"),ScrollerComponent:a("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TopItemListComponent:a("TopItemList")}}),wo=q(([t,e])=>({...t,...e}),ae(Ar,So)),ko=({height:t})=>r.jsx("div",{style:{height:t}}),Io={overflowAnchor:"none",position:hn(),zIndex:1},zr={overflowAnchor:"none"},To={...zr,display:"inline-block",height:"100%"},Gn=D.memo(function({showTopList:t=!1}){const e=$("listState"),n=Ce("sizeRanges"),s=$("useWindowScroll"),o=$("customScrollParent"),i=Ce("windowScrollContainerState"),a=Ce("scrollContainerState"),c=o||s?i:a,l=$("itemContent"),d=$("context"),u=$("groupContent"),f=$("trackItemSizes"),x=$("itemSize"),p=$("log"),v=Ce("gap"),T=$("horizontalDirection"),{callbackRef:b}=Ms(n,x,f,t?nt:c,p,v,o,T,$("skipAnimationFrameInResizeObserver")),[h,g]=D.useState(0);gn("deviation",M=>{h!==M&&g(M)});const w=$("EmptyPlaceholder"),C=$("ScrollSeekPlaceholder")??ko,I=$("ListComponent"),L=$("ItemComponent"),m=$("GroupComponent"),k=$("computeItemKey"),j=$("isSeeking"),F=$("groupIndices").length>0,O=$("alignToBottom"),U=$("initialItemFinalLocationReached"),H=t?{}:{boxSizing:"border-box",...T?{display:"inline-block",height:"100%",marginInlineStart:h===0?O?"auto":0:h,paddingInlineEnd:e.offsetBottom,paddingInlineStart:e.offsetTop,whiteSpace:"nowrap"}:{marginTop:h===0?O?"auto":0:h,paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},...U?{}:{visibility:"hidden"}};return!t&&e.totalCount===0&&w!==null&&w!==void 0?r.jsx(w,{...we(w,d)}):r.jsx(I,{...we(I,d),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:b,style:H,children:(t?e.topItems:e.items).map(M=>{const X=M.originalIndex,Q=k(X+e.firstItemIndex,M.data,d);return j?S.createElement(C,{...we(C,d),height:M.size,index:M.index,key:Q,type:M.type||"item",...M.type==="group"?{}:{groupIndex:M.groupIndex}}):M.type==="group"?S.createElement(m,{...we(m,d),"data-index":X,"data-item-index":M.index,"data-known-size":M.size,key:Q,style:Io},u(M.index,d)):S.createElement(L,{...we(L,d),...Co(L,M.data),"data-index":X,"data-item-group-index":M.groupIndex,"data-item-index":M.index,"data-known-size":M.size,key:Q,style:T?To:zr},F?l(M.index,M.groupIndex,M.data,d):l(M.index,M.data,d))})})}),Eo={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},yo={outline:"none",overflowX:"auto",position:"relative"},xn=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),Mr=(t,e,n=0)=>({...xn(t),position:e?"relative":"absolute",top:e?-n:0}),No={position:hn(),top:0,width:"100%",zIndex:1};function we(t,e){if(typeof t!="string")return{context:e}}function Co(t,e){return{item:typeof t=="string"?void 0:e}}const jo=D.memo(function(){const t=$("HeaderComponent"),e=Ce("headerHeight"),n=$("HeaderFooterTag"),s=Je(D.useMemo(()=>i=>{e($e(i,"height"))},[e]),!0,$("skipAnimationFrameInResizeObserver")),o=$("context");return t!=null?r.jsx(n,{ref:s,children:r.jsx(t,{...we(t,o)})}):null}),Ro=D.memo(function(){const t=$("FooterComponent"),e=Ce("footerHeight"),n=$("HeaderFooterTag"),s=Je(D.useMemo(()=>i=>{e($e(i,"height"))},[e]),!0,$("skipAnimationFrameInResizeObserver")),o=$("context");return t!=null?r.jsx(n,{ref:s,children:r.jsx(t,{...we(t,o)})}):null});function Br({useEmitter:t,useEmitterValue:e,usePublisher:n}){return D.memo(function({children:s,style:o,context:i,...a}){const c=n("scrollContainerState"),l=e("ScrollerComponent"),d=n("smoothScrollTargetReached"),u=e("scrollerRef"),f=e("horizontalDirection")||!1,{scrollByCallback:x,scrollerRef:p,scrollToCallback:v}=Dr(c,d,l,u,void 0,f);return t("scrollTo",v),t("scrollBy",x),r.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:p,style:{...f?yo:Eo,...o},tabIndex:0,...a,...we(l,i),children:s})})}function _r({useEmitter:t,useEmitterValue:e,usePublisher:n}){return D.memo(function({children:s,style:o,context:i,...a}){const c=n("windowScrollContainerState"),l=e("ScrollerComponent"),d=n("smoothScrollTargetReached"),u=e("totalListHeight"),f=e("deviation"),x=e("customScrollParent"),p=D.useRef(null),v=e("scrollerRef"),{scrollByCallback:T,scrollerRef:b,scrollToCallback:h}=Dr(c,d,l,v,x);return Hr(()=>{var g;return b.current=x??((g=p.current)==null?void 0:g.ownerDocument.defaultView),()=>{b.current=null}},[b,x]),t("windowScrollTo",h),t("scrollBy",T),r.jsx(l,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...u===0?void 0:{height:u+f}},...a,...we(l,i),children:s})})}const Ao=({children:t})=>{const e=D.useContext(Lr),n=Ce("viewportHeight"),s=Ce("fixedItemHeight"),o=$("alignToBottom"),i=$("horizontalDirection"),a=D.useMemo(()=>lr(n,l=>$e(l,i?"width":"height")),[n,i]),c=Je(a,!0,$("skipAnimationFrameInResizeObserver"));return D.useEffect(()=>{e&&(n(e.viewportHeight),s(e.itemHeight))},[e,n,s]),r.jsx("div",{"data-viewport-type":"element",ref:c,style:xn(o),children:t})},Oo=({children:t})=>{const e=D.useContext(Lr),n=Ce("windowViewportRect"),s=Ce("fixedItemHeight"),o=$("customScrollParent"),i=$("useWindowScroll"),a=$("topListHeight"),c=pr(n,o,$("skipAnimationFrameInResizeObserver")),l=$("alignToBottom");return D.useEffect(()=>{e&&(s(e.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,s]),r.jsx("div",{"data-viewport-type":"window",ref:c,style:Mr(l,i,a),children:t})},Lo=({children:t})=>{const e=$("TopItemListComponent")??"div",n=$("headerHeight"),s={...No,marginTop:`${n}px`},o=$("context");return r.jsx(e,{style:s,...we(e,o),children:t})},Fo=D.memo(function(t){const e=$("useWindowScroll"),n=$("topItemsIndexes").length>0,s=$("customScrollParent"),o=$("context");return r.jsxs(s||e?zo:Do,{...t,context:o,children:[n&&r.jsx(Lo,{children:r.jsx(Gn,{showTopList:!0})}),r.jsxs(s||e?Oo:Ao,{children:[r.jsx(jo,{}),r.jsx(Gn,{}),r.jsx(Ro,{})]})]})}),{Component:Ho,useEmitter:gn,useEmitterValue:$,usePublisher:Ce}=Or(wo,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Fo),Do=Br({useEmitter:gn,useEmitterValue:$,usePublisher:Ce}),zo=_r({useEmitter:gn,useEmitterValue:$,usePublisher:Ce}),Mo=Ho,Bo=q(()=>{const t=N(d=>r.jsxs("td",{children:["Item $",d]})),e=N(null),n=N(d=>r.jsxs("td",{colSpan:1e3,children:["Group ",d]})),s=N(null),o=N(null),i=N({}),a=N(fn),c=N(nt),l=(d,u=null)=>ke(E(i,A(f=>f[d]),oe()),u);return{components:i,computeItemKey:a,context:e,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:s,itemContent:t,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});ae(Ar,Bo);hn();const Wn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},_o={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Vn,floor:jt,max:at,min:Bt,round:Kn}=Math;function Xn(t,e,n){return Array.from({length:e-t+1}).map((s,o)=>({data:n===null?null:n[o+t],index:o+t}))}function Po(t){return{..._o,items:t}}function It(t,e){return t!==void 0&&t.width===e.width&&t.height===e.height}function $o(t,e){return t!==void 0&&t.column===e.column&&t.row===e.row}const Uo=q(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:s},{footerHeight:o,headerHeight:i,scrollBy:a,scrollContainerState:c,scrollTo:l,scrollTop:d,smoothScrollTargetReached:u,viewportHeight:f},x,p,{didMount:v,propsReady:T},{customScrollParent:b,useWindowScroll:h,windowScrollContainerState:g,windowScrollTo:w,windowViewportRect:C},I])=>{const L=N(0),m=N(0),k=N(Wn),j=N({height:0,width:0}),F=N({height:0,width:0}),O=Y(),U=Y(),H=N(0),M=N(null),X=N({column:0,row:0}),Q=Y(),J=Y(),ie=N(!1),Ee=N(0),be=N(!0),Se=N(!1),Ae=N(!1);te(E(v,W(Ee),P(([y,B])=>!en(B))),()=>{G(be,!1)}),te(E(he(v,be,F,j,Ee,Se),P(([y,B,Z,ee,,le])=>y&&!B&&Z.height!==0&&ee.height!==0&&!le)),([,,,,y])=>{if(y===void 0){G(be,!0);return}G(Se,!0),dn(1,()=>{G(O,y)}),Le(E(d),()=>{G(e,[0,0]),G(be,!0)})}),z(E(J,P(y=>y!=null&&y.scrollTop>0),De(0)),m),te(E(v,W(J),P(([,y])=>y!=null)),([,y])=>{y&&(G(j,y.viewport),G(F,y.item),G(X,y.gap),y.scrollTop>0&&(G(ie,!0),Le(E(d,Ye(1)),B=>{G(ie,!1)}),G(l,{top:y.scrollTop})))}),z(E(j,A(({height:y})=>y)),f),z(E(he(_(j,It),_(F,It),_(X,(y,B)=>y!==void 0&&y.column===B.column&&y.row===B.row),_(d)),A(([y,B,Z,ee])=>({gap:Z,item:B,scrollTop:ee,viewport:y}))),Q),z(E(he(_(L),s,_(X,$o),_(F,It),_(j,It),_(M),_(m),_(ie),_(be),_(Ee)),P(([,,,,,,,y])=>!y),A(([y,[B,Z],ee,le,fe,pe,re,,de,Ie])=>{const{column:me,row:rt}=ee,{height:St,width:Ft}=le,{width:bn}=fe;if(re===0&&(y===0||bn===0))return Wn;if(Ft===0){const In=un(Ie,y),Xr=In+Math.max(re-1,0);return Po(Xn(In,Xr,pe))}const wt=Pr(bn,Ft,me);let Qe,Ve;de?B===0&&Z===0&&re>0?(Qe=0,Ve=re-1):(Qe=wt*jt((B+rt)/(St+rt)),Ve=wt*Vn((Z+rt)/(St+rt))-1,Ve=Bt(y-1,at(Ve,wt-1)),Qe=Bt(Ve,at(0,Qe))):(Qe=0,Ve=-1);const vn=Xn(Qe,Ve,pe),{bottom:Sn,top:wn}=Yn(fe,ee,le,vn),kn=Vn(y/wt),Kr=kn*St+(kn-1)*rt-Sn;return{bottom:Sn,itemHeight:St,items:vn,itemWidth:Ft,offsetBottom:Kr,offsetTop:wn,top:wn}})),k),z(E(M,P(y=>y!==null),A(y=>y.length)),L),z(E(he(j,F,k,X),P(([y,B,{items:Z}])=>Z.length>0&&B.height!==0&&y.height!==0),A(([y,B,{items:Z},ee])=>{const{bottom:le,top:fe}=Yn(y,ee,B,Z);return[fe,le]}),oe(pt)),e);const ve=N(!1);z(E(d,W(ve),A(([y,B])=>B||y!==0)),ve);const R=Ne(E(he(k,L),P(([{items:y}])=>y.length>0),W(ve),P(([[y,B],Z])=>{const ee=y.items[y.items.length-1].index===B-1;return(Z||y.bottom>0&&y.itemHeight>0&&y.offsetBottom===0&&y.items.length===B)&&ee}),A(([[,y]])=>y-1),oe())),V=Ne(E(_(k),P(({items:y})=>y.length>0&&y[0].index===0),De(0),oe())),K=Ne(E(_(k),W(ie),P(([{items:y},B])=>y.length>0&&!B),A(([{items:y}])=>({endIndex:y[y.length-1].index,startIndex:y[0].index})),oe(br),_e(0)));z(K,p.scrollSeekRangeChanged),z(E(O,W(j,F,L,X),A(([y,B,Z,ee,le])=>{const fe=Ir(y),{align:pe,behavior:re,offset:de}=fe;let Ie=fe.index;Ie==="LAST"&&(Ie=ee-1),Ie=at(0,Ie,Bt(ee-1,Ie));let me=tn(B,le,Z,Ie);return pe==="end"?me=Kn(me-B.height+Z.height):pe==="center"&&(me=Kn(me-B.height/2+Z.height/2)),de!==void 0&&de!==0&&(me+=de),{behavior:re,top:me}})),l);const ue=ke(E(k,A(y=>y.offsetBottom+y.bottom)),0);return z(E(C,A(y=>({height:y.visibleHeight,width:y.visibleWidth}))),j),{customScrollParent:b,data:M,deviation:H,footerHeight:o,gap:X,headerHeight:i,increaseViewportBy:t,initialItemCount:m,itemDimensions:F,overscan:n,restoreStateFrom:J,scrollBy:a,scrollContainerState:c,scrollHeight:U,scrollTo:l,scrollToIndex:O,scrollTop:d,smoothScrollTargetReached:u,totalCount:L,useWindowScroll:h,viewportDimensions:j,windowScrollContainerState:g,windowScrollTo:w,windowViewportRect:C,...p,gridState:k,horizontalDirection:Ae,initialTopMostItemIndex:Ee,totalListHeight:ue,...x,endReached:R,propsReady:T,rangeChanged:K,startReached:V,stateChanged:Q,stateRestoreInProgress:ie,...I}},ae(pn,Te,vt,jr,We,mn,Ge));function Pr(t,e,n){return at(1,jt((t+n)/(jt(e)+n)))}function Yn(t,e,n,s){const{height:o}=n;if(o===void 0||s.length===0)return{bottom:0,top:0};const i=tn(t,e,n,s[0].index);return{bottom:tn(t,e,n,s[s.length-1].index)+o,top:i}}function tn(t,e,n,s){const o=Pr(t.width,n.width,e.column),i=jt(s/o),a=i*n.height+at(0,i-1)*e.row;return a>0?a+e.row:a}const Go=q(()=>{const t=N(f=>`Item ${f}`),e=N({}),n=N(null),s=N("virtuoso-grid-item"),o=N("virtuoso-grid-list"),i=N(fn),a=N("div"),c=N(nt),l=(f,x=null)=>ke(E(e,A(p=>p[f]),oe()),x),d=N(!1),u=N(!1);return z(_(u),d),{components:e,computeItemKey:i,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:a,itemClassName:s,ItemComponent:l("Item","div"),itemContent:t,listClassName:o,ListComponent:l("List","div"),readyStateChanged:d,reportReadyState:u,ScrollerComponent:l("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),Wo=q(([t,e])=>({...t,...e}),ae(Uo,Go)),Vo=D.memo(function(){const t=se("gridState"),e=se("listClassName"),n=se("itemClassName"),s=se("itemContent"),o=se("computeItemKey"),i=se("isSeeking"),a=je("scrollHeight"),c=se("ItemComponent"),l=se("ListComponent"),d=se("ScrollSeekPlaceholder"),u=se("context"),f=je("itemDimensions"),x=je("gap"),p=se("log"),v=se("stateRestoreInProgress"),T=je("reportReadyState"),b=Je(D.useMemo(()=>h=>{const g=h.parentElement.parentElement.scrollHeight;a(g);const w=h.firstChild;if(w!==null){const{height:C,width:I}=w.getBoundingClientRect();f({height:C,width:I})}x({column:Jn("column-gap",getComputedStyle(h).columnGap,p),row:Jn("row-gap",getComputedStyle(h).rowGap,p)})},[a,f,x,p]),!0,!1);return Hr(()=>{t.itemHeight>0&&t.itemWidth>0&&T(!0)},[t]),v?null:r.jsx(l,{className:e,ref:b,...we(l,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(h=>{const g=o(h.index,h.data,u);return i?r.jsx(d,{...we(d,u),height:t.itemHeight,index:h.index,width:t.itemWidth},g):S.createElement(c,{...we(c,u),className:n,"data-index":h.index,key:g},s(h.index,h.data,u))})})}),Ko=D.memo(function(){const t=se("HeaderComponent"),e=je("headerHeight"),n=se("headerFooterTag"),s=Je(D.useMemo(()=>i=>{e($e(i,"height"))},[e]),!0,!1),o=se("context");return t!=null?r.jsx(n,{ref:s,children:r.jsx(t,{...we(t,o)})}):null}),Xo=D.memo(function(){const t=se("FooterComponent"),e=je("footerHeight"),n=se("headerFooterTag"),s=Je(D.useMemo(()=>i=>{e($e(i,"height"))},[e]),!0,!1),o=se("context");return t!=null?r.jsx(n,{ref:s,children:r.jsx(t,{...we(t,o)})}):null}),Yo=({children:t})=>{const e=D.useContext(Fr),n=je("itemDimensions"),s=je("viewportDimensions"),o=Je(D.useMemo(()=>i=>{s(i.getBoundingClientRect())},[s]),!0,!1);return D.useEffect(()=>{e&&(s({height:e.viewportHeight,width:e.viewportWidth}),n({height:e.itemHeight,width:e.itemWidth}))},[e,s,n]),r.jsx("div",{ref:o,style:xn(!1),children:t})},Jo=({children:t})=>{const e=D.useContext(Fr),n=je("windowViewportRect"),s=je("itemDimensions"),o=se("customScrollParent"),i=se("useWindowScroll"),a=pr(n,o,!1);return D.useEffect(()=>{e&&(s({height:e.itemHeight,width:e.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:e.viewportWidth}))},[e,n,s]),r.jsx("div",{ref:a,style:Mr(!1,i),children:t})},Zo=D.memo(function({...t}){const e=se("useWindowScroll"),n=se("customScrollParent"),s=n||e?qo:Qo,o=n||e?Jo:Yo,i=se("context");return r.jsx(s,{...t,...we(s,i),children:r.jsxs(o,{children:[r.jsx(Ko,{}),r.jsx(Vo,{}),r.jsx(Xo,{})]})})}),{useEmitter:$r,useEmitterValue:se,usePublisher:je}=Or(Wo,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Zo),Qo=Br({useEmitter:$r,useEmitterValue:se,usePublisher:je}),qo=_r({useEmitter:$r,useEmitterValue:se,usePublisher:je});function Jn(t,e,n){return e!=="normal"&&(e==null?void 0:e.endsWith("px"))!==!0&&n(`${t} was not resolved to pixel value correctly`,e,ge.WARN),e==="normal"?0:parseInt(e??"0",10)}Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript})(Prism);(function(t){var e=t.util.clone(t.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,s=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function i(l,d){return l=l.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return s}).replace(/<SPREAD>/g,function(){return o}),RegExp(l,d)}o=i(o).source,t.languages.jsx=t.languages.extend("markup",e),t.languages.jsx.tag.pattern=i(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=e.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:i(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:i(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var a=function(l){return l?typeof l=="string"?l:typeof l.content=="string"?l.content:l.content.map(a).join(""):""},c=function(l){for(var d=[],u=0;u<l.length;u++){var f=l[u],x=!1;if(typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?d.length>0&&d[d.length-1].tagName===a(f.content[0].content[1])&&d.pop():f.content[f.content.length-1].content==="/>"||d.push({tagName:a(f.content[0].content[1]),openedBraces:0}):d.length>0&&f.type==="punctuation"&&f.content==="{"?d[d.length-1].openedBraces++:d.length>0&&d[d.length-1].openedBraces>0&&f.type==="punctuation"&&f.content==="}"?d[d.length-1].openedBraces--:x=!0),(x||typeof f=="string")&&d.length>0&&d[d.length-1].openedBraces===0){var p=a(f);u<l.length-1&&(typeof l[u+1]=="string"||l[u+1].type==="plain-text")&&(p+=a(l[u+1]),l.splice(u+1,1)),u>0&&(typeof l[u-1]=="string"||l[u-1].type==="plain-text")&&(p=a(l[u-1])+p,l.splice(u-1,1),u--),l[u]=new t.Token("plain-text",p,null,p)}f.content&&typeof f.content!="string"&&c(f.content)}};t.hooks.add("after-tokenize",function(l){l.language!=="jsx"&&l.language!=="tsx"||c(l.tokens)})})(Prism);(function(t){var e=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",e),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var n=t.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0})(Prism);(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(t){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},s={bash:n,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:s},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:s},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:s.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:s.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=t.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=s.variable[1].inside,a=0;a<o.length;a++)i[o[a]]=t.languages.bash[o[a]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;(function(t){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(u){return u=u.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var s=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return s}),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+i+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+i+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(s),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(s),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(f){u!==f&&(t.languages.markdown[u].inside.content.inside[f]=t.languages.markdown[f])})}),t.hooks.add("after-tokenize",function(u){if(u.language!=="markdown"&&u.language!=="md")return;function f(x){if(!(!x||typeof x=="string"))for(var p=0,v=x.length;p<v;p++){var T=x[p];if(T.type!=="code"){f(T.content);continue}var b=T.content[1],h=T.content[3];if(b&&h&&b.type==="code-language"&&h.type==="code-block"&&typeof b.content=="string"){var g=b.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");g=(/[a-z][\w-]*/i.exec(g)||[""])[0].toLowerCase();var w="language-"+g;h.alias?typeof h.alias=="string"?h.alias=[h.alias,w]:h.alias.push(w):h.alias=[w]}}}f(u.tokens)}),t.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var f="",x=0,p=u.classes.length;x<p;x++){var v=u.classes[x],T=/language-(.+)/.exec(v);if(T){f=T[1];break}}var b=t.languages[f];if(b)u.content=t.highlight(d(u.content),b,f);else if(f&&f!=="none"&&t.plugins.autoloader){var h="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);u.attributes.id=h,t.plugins.autoloader.loadLanguages(f,function(){var g=document.getElementById(h);g&&(g.innerHTML=t.highlight(g.textContent,t.languages[f],f))})}}});var a=RegExp(t.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;function d(u){var f=u.replace(a,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(x,p){if(p=p.toLowerCase(),p[0]==="#"){var v;return p[1]==="x"?v=parseInt(p.slice(2),16):v=Number(p.slice(1)),l(v)}else{var T=c[p];return T||x}}),f}t.languages.md=t.languages.markdown})(Prism);(function(t){var e=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,s="(?:"+n.source+"(?:[ ]+"+e.source+")?|"+e.source+"(?:[ ]+"+n.source+")?)",o=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),i=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function a(c,l){l=(l||"").replace(/m/g,"")+"m";var d=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return s}).replace(/<<value>>/g,function(){return c});return RegExp(d,l)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return s})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return s}).replace(/<<key>>/g,function(){return"(?:"+o+"|"+i+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:a(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:a(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:a(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:a(i),lookbehind:!0,greedy:!0},number:{pattern:a(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:e,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(Prism);Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};const ea={js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",python:"Python",bash:"Bash",shell:"Shell",css:"CSS",json:"JSON",yaml:"YAML",yml:"YAML",sql:"SQL",md:"Markdown",markdown:"Markdown",xml:"XML",html:"HTML"};function ta({language:t,code:e}){const[n,s]=S.useState(!1),o=S.useRef(null);S.useEffect(()=>{o.current&&Jr.highlightElement(o.current)},[e,t]);const i=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3)}catch(c){console.error("Failed to copy:",c)}},a=ea[t]||t.toUpperCase();return r.jsxs("div",{className:"relative group rounded-lg overflow-hidden border border-dark-border my-2",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[r.jsx("span",{className:"text-xs text-dark-muted font-mono",children:a}),r.jsx("button",{onClick:i,className:"flex items-center gap-1 text-xs px-2 py-1 rounded hover:bg-dark-hover transition-colors",children:n?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{size:12,className:"text-accent-green"}),r.jsx("span",{className:"text-accent-green",children:"已复制"})]}):r.jsxs(r.Fragment,{children:[r.jsx(rr,{size:12}),r.jsx("span",{children:"复制"})]})})]}),r.jsx("pre",{className:"bg-dark-bg p-3 overflow-x-auto custom-scrollbar text-sm",children:r.jsx("code",{ref:o,className:`language-${t}`,children:e})})]})}function na({content:t,className:e=""}){const[n,s]=S.useState(t),o=S.useRef(0),i=S.useRef(null),a=S.useRef(t);a.current=t,S.useEffect(()=>{if(t===n)return;const l=Date.now(),d=l-o.current;d>=200?(s(t),o.current=l):i.current||(i.current=setTimeout(()=>{i.current=null,s(a.current),o.current=Date.now()},200-d))},[t]),S.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const c=(n||"").replace(/\\n/g,`
2
- `).replace(/\n{3,}/g,`
3
-
4
- `);return r.jsx("div",{className:`markdown-content ${e}`,style:{wordBreak:"break-word"},children:r.jsx(Yr,{components:{code({className:l,children:d,...u}){const f=/language-(\w+)/.exec(l||""),x=String(d).replace(/\n$/,"");return f&&f[1]?r.jsx(ta,{language:f[1],code:x}):r.jsx("code",{className:"bg-dark-hover px-1.5 py-0.5 rounded text-sm font-mono text-accent-blue",...u,children:d})},a({href:l,children:d}){return r.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-accent-blue hover:underline",children:d})},table({children:l}){return r.jsx("div",{className:"overflow-x-auto custom-scrollbar my-2",children:r.jsx("table",{className:"w-full border-collapse border border-dark-border",children:l})})},th({children:l}){return r.jsx("th",{className:"border border-dark-border px-3 py-2 text-left bg-dark-hover font-medium",children:l})},td({children:l}){return r.jsx("td",{className:"border border-dark-border px-3 py-2",children:l})},p({children:l}){return r.jsx("p",{className:"mb-0.5 leading-snug last:mb-0",children:l})},blockquote({children:l}){return r.jsx("blockquote",{className:"border-l-4 border-accent-blue pl-3 my-1 text-dark-muted italic",children:l})},h1({children:l}){return r.jsx("h1",{className:"text-2xl font-bold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:l})},h2({children:l}){return r.jsx("h2",{className:"text-xl font-semibold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:l})},h3({children:l}){return r.jsx("h3",{className:"text-lg font-semibold mt-2 mb-1 text-dark-text",children:l})}},children:c})})}const ra=S.memo(function({filePath:e,content:n,language:s}){if(!n&&!e)return null;const[o,i]=S.useState("unified"),[a,c]=S.useState(!1),l=sa(e,s),d=(n==null?void 0:n.includes("@@"))||(n==null?void 0:n.includes("+++"))||(n==null?void 0:n.includes("---")),u=d?oa(n||""):null;return r.jsxs("div",{className:"mt-2 border border-dark-border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[r.jsx("span",{className:"text-accent-purple text-xs",children:"📝"}),r.jsx("span",{className:"text-xs font-mono text-dark-fg truncate",children:e||"file"}),u&&r.jsxs("span",{className:"text-xs ml-2 flex gap-2",children:[r.jsxs("span",{className:"text-green-400",children:["+",u.additions]}),r.jsxs("span",{className:"text-red-400",children:["-",u.deletions]})]}),r.jsx("span",{className:"text-xs text-dark-muted ml-auto",children:l}),d&&r.jsxs("div",{className:"flex gap-0.5 ml-2",children:[r.jsx("button",{onClick:()=>i("unified"),className:`text-xs px-1.5 py-0.5 rounded ${o==="unified"?"bg-accent-blue/20 text-accent-blue":"text-dark-muted hover:text-dark-fg"}`,title:"Unified view",children:"Unified"}),r.jsx("button",{onClick:()=>i("side-by-side"),className:`text-xs px-1.5 py-0.5 rounded ${o==="side-by-side"?"bg-accent-blue/20 text-accent-blue":"text-dark-muted hover:text-dark-fg"}`,title:"Side-by-side view",children:"Side"})]}),r.jsx("button",{onClick:()=>c(!a),className:"text-xs text-dark-muted hover:text-dark-fg ml-1",children:a?"▶":"▼"})]}),!a&&r.jsxs("div",{className:"bg-dark-bg overflow-x-auto max-h-96 overflow-y-auto custom-scrollbar",children:[d?o==="unified"?aa(n||""):ia(n||""):r.jsx("pre",{className:"text-xs font-mono p-2 text-dark-fg whitespace-pre-wrap",children:n||"(no content)"}),u&&r.jsxs("div",{className:"sticky bottom-0 bg-dark-surface border-t border-dark-border px-3 py-1 flex gap-4 text-xs text-dark-muted",children:[r.jsxs("span",{className:"text-green-400",children:["+",u.additions," additions"]}),r.jsxs("span",{className:"text-red-400",children:["-",u.deletions," deletions"]}),r.jsxs("span",{children:[u.hunks," hunks"]})]})]})]})});function sa(t,e){var o;if(e)return e;if(!t)return"plaintext";const n=(o=t.split(".").pop())==null?void 0:o.toLowerCase();return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",go:"go",rs:"rust",cpp:"cpp",c:"c",h:"c",css:"css",html:"html",json:"json",xml:"xml",yml:"yaml",yaml:"yaml",md:"markdown",sql:"sql",sh:"bash",ps1:"powershell",properties:"properties",toml:"toml",gradle:"groovy",kt:"kotlin",swift:"swift"}[n||""]||"plaintext"}function oa(t){const e=t.split(`
5
- `);let n=0,s=0,o=0;for(const i of e)i.startsWith("@@")?o++:i.startsWith("+")&&!i.startsWith("+++")?n++:i.startsWith("-")&&!i.startsWith("---")&&s++;return{additions:n,deletions:s,hunks:o,filesChanged:1}}function aa(t){return t.split(`
6
- `).map((n,s)=>{let o="text-dark-fg",i=" ";return(n.startsWith("+++")||n.startsWith("---"))&&s<3?o="text-dark-muted font-bold text-xs":n.startsWith("+")?(o="text-green-400 bg-green-900/20",i="+"):n.startsWith("-")?(o="text-red-400 bg-red-900/20",i="-"):n.startsWith("@@")&&(o="text-accent-blue font-bold bg-accent-blue/5"),r.jsxs("div",{className:`text-xs font-mono leading-snug px-2 ${o}`,style:{minHeight:"1.25rem"},children:[r.jsx("span",{className:"select-none inline-block w-4 text-dark-muted text-right mr-1",children:o.includes("text-accent-blue")?"@":i}),n||" "]},`${s}-${n.substring(0,20)}`)})}function ia(t){const e=t.split(`
7
- `),n=[];let s=null;for(const o of e)o.startsWith("@@")?(s&&_t(n,s),s={leftLines:[],rightLines:[]},n.push({left:o,right:o,type:"header"})):o.startsWith("---")||o.startsWith("+++")?n.push({left:"",right:o,type:"header"}):o.startsWith("-")&&s?s.leftLines.push(o.substring(1)):o.startsWith("+")&&s?s.rightLines.push(o.substring(1)):s?(_t(n,s),n.push({left:o,right:o,type:"context"})):n.push({left:o,right:o,type:"context"});return s&&_t(n,s),r.jsxs("div",{children:[r.jsxs("div",{className:"flex border-b border-dark-border text-xs font-bold text-dark-muted",children:[r.jsx("div",{className:"flex-1 px-2 py-0.5 border-r border-dark-border",children:"Old"}),r.jsx("div",{className:"flex-1 px-2 py-0.5",children:"New"})]}),n.map((o,i)=>r.jsxs("div",{className:"flex",style:{minHeight:"1.25rem"},children:[r.jsx("div",{className:`flex-1 px-2 border-r border-dark-border/30 font-mono text-xs leading-snug ${o.type==="delete"?"bg-red-900/20 text-red-400":o.type==="header"?"bg-accent-blue/5 text-accent-blue":"text-dark-fg"}`,children:o.left||" "}),r.jsx("div",{className:`flex-1 px-2 font-mono text-xs leading-snug ${o.type==="add"?"bg-green-900/20 text-green-400":o.type==="header"?"bg-accent-blue/5 text-accent-blue":"text-dark-fg"}`,children:o.right||" "})]},i))]})}function _t(t,e){const n=Math.max(e.leftLines.length,e.rightLines.length);for(let s=0;s<n;s++){const o=s<e.leftLines.length?e.leftLines[s]:"",i=s<e.rightLines.length?e.rightLines[s]:"";t.push({left:s<e.leftLines.length?"- "+o:"",right:s<e.rightLines.length?"+ "+i:"",type:s<e.leftLines.length&&s<e.rightLines.length?"context":s<e.leftLines.length?"delete":"add"})}e.leftLines=[],e.rightLines=[]}function Ur(t){const e=S.useRef(null),n=S.useRef(0);return S.useEffect(()=>{if(!t){n.current=0;return}n.current=Date.now();const s=e.current;if(!s)return;const o=()=>{const a=Math.floor((Date.now()-n.current)/1e3),c=a>=60?`${Math.floor(a/60)}m ${a%60}s`:`${a}s`;s.textContent=c};o();const i=setInterval(o,1e3);return()=>clearInterval(i)},[t]),e}const la=["FileEditTool","FileWriteTool","EditTool","NotebookEditTool","Write","Edit","WriteTool","FileCreateTool"],ca=/\b(write|edit|save|create|update|modify|patch)\b/i,da=/\b(read|open|cat|view|list|ls|dir|find|grep|glob|search)\b/i;function ua(t){return la.includes(t)?!0:ca.test(t)&&!da.test(t)}function pa(t){return typeof t=="string"?t:t&&typeof t=="object"?JSON.stringify(t,null,2):String(t??"")}function ma(t){if(typeof t!="string"&&t)return t.filePath||t.path||t.file||t.file_path}const Gr=S.memo(function({toolCall:e,defaultCollapsed:n=!0}){const[s,o]=S.useState(n),i=e.status==="running",a=Ur(i),c=e.result!==void 0&&e.result!==null,l=e.status==="error",d=ua(e.name),u=c?pa(e.result):"",f=typeof e.args=="object"&&e.args?ma(e.args):void 0,x=e.duration??0,p=x>0?x>=60?`${Math.floor(x/60)}m ${x%60}s`:`${x}s`:"",v=i?"bg-accent-blue":l?"bg-accent-red":"bg-accent-green";return r.jsxs("div",{className:"rounded-lg transition-colors hover:bg-dark-surface/40","data-testid":"toolcall-row",children:[r.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>o(!s),children:[i?r.jsx("span",{className:"inline-block w-3 h-3 shrink-0 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):r.jsx("span",{className:`w-2 h-2 shrink-0 rounded-full ${v}`}),r.jsx("span",{className:"text-xs text-dark-muted shrink-0",children:"🔧"}),r.jsx("span",{className:"font-medium text-[13px] text-dark-text truncate",children:e.name}),i&&r.jsxs("span",{className:"text-[11px] text-accent-blue shrink-0 flex items-center gap-1 tabular-nums",children:[r.jsx(it,{size:10}),r.jsx("span",{ref:a,children:"0s"})]}),!i&&p&&r.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0 flex items-center gap-1 tabular-nums",children:[r.jsx(it,{size:10}),r.jsx("span",{children:p})]}),r.jsx("span",{className:`ml-auto shrink-0 text-dark-muted/60 transition-transform ${s?"":"rotate-180"}`,children:r.jsx(lt,{size:13})})]}),!s&&r.jsxs("div",{className:"ml-4 pb-1 pl-3 border-l-2 border-dark-border/30 space-y-1",children:[r.jsxs("div",{className:"py-0.5 px-2",children:[r.jsx("div",{className:"text-[10px] text-dark-muted mb-0.5",children:"参数"}),r.jsx("pre",{className:"text-[11px] font-mono bg-dark-bg border border-dark-border p-2 rounded overflow-x-auto max-h-24 overflow-y-auto custom-scrollbar",children:typeof e.args=="string"?e.args:JSON.stringify(e.args,null,2)})]}),c&&r.jsxs("div",{className:"py-0.5 px-2",children:[r.jsx("div",{className:`text-[10px] mb-0.5 ${l?"text-accent-red":"text-accent-green"}`,children:l?"错误":"结果"}),d&&u?r.jsx(ra,{filePath:f,content:u}):r.jsx("pre",{className:`text-[11px] font-mono bg-dark-bg border border-dark-border p-2 rounded overflow-x-auto max-h-48 overflow-y-auto custom-scrollbar whitespace-pre-wrap break-all ${l?"text-accent-red":"text-accent-green"}`,children:u})]})]})]})}),ha=S.memo(function({text:e,maxLength:n=300,preformatted:s=!1}){const[o,i]=S.useState(!1);return e.length>n?r.jsxs("div",{children:[s?r.jsx("pre",{className:"text-xs font-mono bg-dark-bg p-1.5 rounded overflow-x-auto custom-scrollbar mt-1 text-accent-green",children:o?e:e.slice(0,n)+"..."}):r.jsx("div",{className:"text-dark-text leading-snug",children:o?e:e.slice(0,n)+"..."}),r.jsx("button",{onClick:c=>{c.stopPropagation(),i(!o)},className:"mt-1 text-[10px] px-2 py-0.5 rounded bg-dark-hover text-accent-blue hover:bg-dark-border transition-colors",children:o?"收起":"展开"})]}):s?r.jsx("pre",{className:"text-xs font-mono bg-dark-bg p-1.5 rounded overflow-x-auto custom-scrollbar mt-1 text-accent-green",children:e}):r.jsx("div",{className:"text-dark-text leading-snug",children:e})}),fa=S.memo(function({step:e,defaultCollapsed:n=!0}){const[s,o]=S.useState(n),[i,a]=S.useState(!0),c=e.status==="running",l=Ur(c),d=e.description||e.thought||e.result||e.action||e.toolCalls&&e.toolCalls.length>0,u=e.duration??0,f=u>0?u>=60?`${Math.floor(u/60)}m ${u%60}s`:`${u}s`:"",x={pending:"bg-dark-muted/40",running:"bg-accent-blue",success:"bg-accent-green",error:"bg-accent-red",warning:"bg-accent-yellow"}[e.status]||"bg-dark-muted/40";return r.jsxs("div",{className:"rounded-lg transition-colors hover:bg-dark-surface/40","data-testid":"step-row",children:[r.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>d&&o(!s),children:[c?r.jsx("span",{className:"inline-block w-3 h-3 shrink-0 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):r.jsx("span",{className:`w-2 h-2 shrink-0 rounded-full ${x} ${e.status==="pending"?"opacity-60":""}`}),r.jsx("span",{className:"text-[13px] text-dark-text truncate",children:e.title}),c&&r.jsxs("span",{className:"text-[11px] text-accent-blue shrink-0 flex items-center gap-1 tabular-nums",children:[r.jsx(it,{size:10}),r.jsx("span",{ref:l,children:"0s"})]}),!c&&f&&r.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0 flex items-center gap-1 tabular-nums",children:[r.jsx(it,{size:10}),r.jsx("span",{children:f})]}),d&&r.jsx("span",{className:`ml-auto shrink-0 text-dark-muted/60 transition-transform ${s?"":"rotate-180"}`,children:r.jsx(lt,{size:13})})]}),!s&&d&&r.jsxs("div",{className:"ml-4 pb-1 pl-3 border-l-2 border-dark-border/30 space-y-1",children:[e.description&&r.jsx("div",{className:"text-dark-muted py-0.5 px-2 text-xs",children:e.description}),e.thought&&r.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-blue/40 bg-accent-blue/5 rounded-r",children:[r.jsxs("div",{className:"flex items-center gap-1 text-accent-blue cursor-pointer hover:opacity-80 select-none",onClick:()=>a(!i),children:[i?r.jsx(nn,{size:12}):r.jsx(lt,{size:12}),r.jsx("span",{children:"🧠 思考"}),i&&r.jsxs("span",{className:"text-[10px] text-dark-muted truncate max-w-[200px]",children:[e.thought.slice(0,80).replace(/\n/g," "),"..."]})]}),!i&&r.jsx("div",{className:"text-dark-muted italic whitespace-pre-wrap leading-snug mt-1",children:e.thought.replace(/\n\s*\n+/g,`
8
- `)})]}),e.action&&r.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-yellow/40 bg-accent-yellow/5 rounded-r",children:[r.jsx("div",{className:"flex items-center gap-1 text-accent-yellow mb-0.5",children:"⚡ 执行"}),r.jsx("div",{className:"text-dark-text leading-snug font-mono text-[11px]",children:e.action})]}),e.toolCalls&&e.toolCalls.length>0&&e.toolCalls.map(p=>r.jsx("div",{className:"px-1 py-0.5",children:r.jsx(Gr,{toolCall:p})},p.id)),e.result&&r.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-green/40 bg-accent-green/5 rounded-r",children:[r.jsx("div",{className:"flex items-center gap-1 text-accent-green mb-0.5",children:"✓ 结果"}),r.jsx(ha,{text:e.result,maxLength:500})]})]})]})}),xa=S.memo(function({steps:e,isGenerating:n}){const{t:s}=Re(),[o,i]=S.useState(n),a=S.useRef(n);S.useEffect(()=>{a.current&&!n&&i(!1),a.current=n},[n]);const c=e.length,l=n||e.some(p=>p.status==="running"),d=[...e].reverse().find(p=>p.status==="running"),u=e[e.length-1],f=(d==null?void 0:d.title)||(u==null?void 0:u.title)||"",x=`${c} ${s(c===1?"chat.stepCount":"chat.stepCountPlural")}`;return r.jsxs("div",{className:"mb-1 rounded-lg border border-dark-border/50 transition-colors","data-testid":"turn-group",children:[r.jsxs("button",{className:"flex w-full items-center gap-2 px-2 py-1 text-left cursor-pointer select-none hover:bg-dark-surface/40",onClick:()=>i(!o),"data-testid":"turn-group-toggle",children:[r.jsx("span",{className:"shrink-0 text-dark-muted/60 transition-transform",children:o?r.jsx(lt,{size:13}):r.jsx(nn,{size:13})}),l?r.jsx("span",{className:"inline-block w-3 h-3 shrink-0 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):r.jsx("span",{className:"w-2 h-2 shrink-0 rounded-full bg-accent-green"}),r.jsx("span",{className:"text-xs text-dark-muted",children:l?`${s("chat.runningSteps")} ${x}…`:x}),l&&f&&r.jsxs("span",{className:"min-w-0 flex-1 truncate pl-1 text-xs text-dark-muted/70",children:["· ",f]})]}),o&&r.jsx("div",{className:"ml-3 pb-1 pl-3 border-l-2 border-dark-border/30 space-y-0.5",children:e.map(p=>r.jsx(fa,{step:p},p.id))})]})}),Pt=15,ga=S.memo(function({approval:e,onResolved:n}){const{t:s}=Re("hook"),[o,i]=S.useState(!1),[a,c]=S.useState(Pt),l=S.useRef(null),d=e.status==="pending",{level:u,reasonKey:f}=Is(e.toolName,e.askPayload),x=Es[u];S.useEffect(()=>{if(d)return c(Pt),l.current=setInterval(()=>{c(I=>I<=1?(l.current&&clearInterval(l.current),0):I-1)},1e3),()=>{l.current&&clearInterval(l.current)}},[d,e.approvalId]),S.useEffect(()=>{a===0&&d&&!o&&v()},[a]);const p=Ts(e.toolName,e.askPayload),v=S.useCallback(()=>{!d||o||(i(!0),l.current&&clearInterval(l.current),He.send({type:"hook_allow",data:JSON.stringify({approvalId:e.approvalId})}),n==null||n(e.approvalId,"approved"))},[d,o,e.approvalId,n]),T=S.useCallback(()=>{!d||o||(i(!0),l.current&&clearInterval(l.current),He.send({type:"hook_deny",data:JSON.stringify({approvalId:e.approvalId})}),n==null||n(e.approvalId,"denied"))},[d,o,e.approvalId,n]),b=S.useCallback(()=>{if(!d||o)return;i(!0),l.current&&clearInterval(l.current),yn.getState().addToSessionAllowList(e.toolName),He.send({type:"hook_allow",data:JSON.stringify({approvalId:e.approvalId})}),n==null||n(e.approvalId,"approved")},[d,o,e.approvalId,e.toolName,n]),h=S.useCallback(()=>{!d||o||(i(!0),l.current&&clearInterval(l.current),yn.getState().setAutoMode(!0),st.getState().setAuto(!0),He.send({type:"hook_allow",data:JSON.stringify({approvalId:e.approvalId})}),n==null||n(e.approvalId,"approved"))},[d,o,e.approvalId,n]);if(!d){const I=e.status==="approved";return r.jsx("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs ${I?"bg-accent-green/10 border border-accent-green/30 text-accent-green":"bg-accent-red/10 border border-accent-red/30 text-accent-red"}`,children:I?r.jsxs(r.Fragment,{children:[r.jsx(sr,{size:14}),r.jsxs("span",{children:[s("alreadyAllowed"),e.toolName]})]}):r.jsxs(r.Fragment,{children:[r.jsx(rn,{size:14}),r.jsxs("span",{children:[s("alreadyDenied"),e.toolName]})]})})}const g=a/Pt*100,w=a<=5,C=[{id:"allow",index:1,label:s("optionAllow"),hint:s("optionAllowHint"),action:v},{id:"deny",index:2,label:s("optionDeny"),hint:s("optionDenyHint"),action:T},{id:"allow_session",index:3,label:s("optionAllowAlways"),hint:s("optionAllowAlwaysHint",{tool:e.toolName}),action:b},{id:"auto_mode",index:4,label:s("optionAutoMode"),hint:s("optionAutoModeHint"),action:h}];return r.jsxs("div",{className:`bg-dark-bg border rounded-lg overflow-hidden ${x.border}`,children:[r.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 ${x.bg} border-b ${x.border}`,children:[r.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold border ${x.badge}`,children:[x.icon," ",u]}),r.jsx(Qr,{size:14,className:x.text}),r.jsx("span",{className:"text-xs font-medium text-dark-text",children:s("permissionRequest")}),r.jsx("span",{className:"text-[10px] text-dark-muted ml-auto",children:s(f)}),r.jsxs("div",{className:"flex items-center gap-1.5 ml-2",children:[r.jsx(it,{size:11,className:w?"text-accent-red":"text-dark-muted"}),r.jsxs("span",{className:`text-[11px] font-mono ${w?"text-accent-red animate-pulse":"text-dark-muted"}`,children:[a,"s"]}),r.jsx("div",{className:"w-10 h-1 bg-dark-border rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full transition-all duration-1000 ${w?"bg-accent-red":a<=8?"bg-accent-yellow":"bg-accent-green"}`,style:{width:`${g}%`}})})]})]}),r.jsxs("div",{className:"px-3 py-2.5 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsx("span",{className:"text-dark-muted shrink-0",children:s("tool")}),r.jsx("code",{className:"text-accent-blue font-mono text-xs bg-dark-surface px-1.5 py-0.5 rounded",children:e.toolName})]}),p&&r.jsx("div",{className:"bg-dark-surface rounded border border-dark-border p-2 max-h-24 overflow-y-auto custom-scrollbar",children:r.jsx("pre",{className:"text-[11px] font-mono text-dark-text whitespace-pre-wrap break-all leading-relaxed",children:p})}),(u==="CRITICAL"||u==="HIGH")&&r.jsxs("div",{className:`flex items-center gap-1.5 text-[11px] px-2 py-1 rounded ${x.bg} ${x.text}`,children:[r.jsx(ct,{size:12}),r.jsx("span",{children:s(u==="CRITICAL"?"highRiskWarning":"mediumRiskConfirm")})]}),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"space-y-0.5 pt-1",children:C.map(I=>r.jsxs("button",{onClick:I.action,disabled:o,className:"w-full text-left px-2 py-1.5 rounded hover:bg-dark-hover transition-colors disabled:opacity-50 group",children:[r.jsxs("div",{className:"flex items-baseline gap-1.5",children:[r.jsxs("span",{className:"text-xs text-dark-muted font-mono shrink-0",children:[I.index,"."]}),r.jsx("span",{className:"text-xs text-dark-text group-hover:text-white transition-colors",children:I.label})]}),r.jsx("div",{className:"text-[10px] text-dark-muted/60 ml-5 mt-0.5",children:I.hint})]},I.id))}),r.jsx("div",{className:"text-[10px] text-dark-muted/50 pt-0.5 border-t border-dark-border/50",children:s("clickToSelect")})]})]})]})}),Tt={xlsx:{icon:Wt,label:"Excel"},xls:{icon:Wt,label:"Excel"},csv:{icon:Gt,label:"CSV"},docx:{icon:Gt,label:"Word"},text:{icon:ar,label:"文本"}};function Zn(t){return!t&&t!==0?"—":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(2)} MB`}const ba=S.memo(function({job:e}){var f,x;const{t:n}=Re(),{stage:s}=e,o=S.useCallback(p=>{Vt.files.download(p).then(v=>{v.success||Pe.error(v.error||n("fileJob.downloadFailed"))})},[n]),i=S.useMemo(()=>e.attachments||[],[e.attachments]),a=S.useMemo(()=>e.parsedFiles||[],[e.parsedFiles]),c=S.useMemo(()=>e.mapping||[],[e.mapping]),l=S.useMemo(()=>e.result||[],[e.result]),d=e.renderProgress??(s==="rendering"?0:100),u=e.parseProgress??(s==="parsing"?0:100);return r.jsxs("div",{className:"mt-2 rounded-xl border border-dark-border bg-dark-surface/60 overflow-hidden max-w-2xl",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 border-b border-dark-border/60 bg-dark-surface",children:[s==="complete"?r.jsx(Tn,{size:15,className:"text-accent-green shrink-0"}):s==="error"?r.jsx(ct,{size:15,className:"text-accent-red shrink-0"}):r.jsx(or,{size:15,className:"text-accent-blue animate-spin shrink-0"}),r.jsx("span",{className:"text-[13px] font-medium text-dark-text",children:va(s,n)}),r.jsx("div",{className:"flex-1"}),r.jsx("span",{className:"text-[10px] font-mono text-dark-muted/60",children:e.jobId})]}),r.jsxs("div",{className:"px-3.5 py-3 space-y-3",children:[i.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2",children:i.map((p,v)=>{const T=Tt[p.kind]||Tt.text,b=T.icon;return r.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dark-border bg-dark-bg px-2.5 py-1.5",children:[r.jsx(b,{size:14,className:"text-accent-blue shrink-0"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-xs text-dark-text truncate max-w-[160px]",children:p.fileName}),r.jsxs("div",{className:"text-[10px] text-dark-muted",children:[Zn(p.size)," · ",T.label,p.role&&p.role!=="unknown"&&r.jsxs("span",{className:Me("ml-1",p.role==="data"?"text-accent-green":"text-accent-purple"),children:["· ",p.role==="data"?n("fileJob.roleData"):n("fileJob.roleTemplate")]})]})]})]},`${p.fileName}-${v}`)})}),s==="parsing"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs text-dark-muted",children:n("fileJob.parsing",{file:((f=i[0])==null?void 0:f.fileName)||((x=a[0])==null?void 0:x.fileName)||""})}),r.jsx(Cn,{value:u,size:"sm",showLabel:!0})]}),a.length>0&&s!=="error"&&r.jsxs("div",{className:"space-y-1.5",children:[a.map(p=>r.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted",children:[r.jsx(Tn,{size:13,className:"text-accent-green shrink-0"}),r.jsx("span",{className:"truncate",children:p.fileName}),r.jsx("span",{className:"text-[10px] text-dark-muted/70",children:n("fileJob.parsedSummary",{rows:p.rowCount,fields:p.fields.length})})]},p.fileName)),a[0]&&r.jsxs("div",{className:"flex flex-wrap gap-1 pt-1",children:[a[0].fields.slice(0,12).map(p=>r.jsx("span",{className:"rounded bg-dark-bg border border-dark-border/60 px-1.5 py-0.5 text-[10px] font-mono text-dark-muted",children:p},p)),a[0].fields.length>12&&r.jsxs("span",{className:"text-[10px] text-dark-muted/60",children:["+",a[0].fields.length-12]})]})]}),c.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[11px] text-dark-muted",children:n("fileJob.mappingTitle")}),r.jsx("div",{className:"overflow-hidden rounded-lg border border-dark-border",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-dark-bg text-dark-muted",children:[r.jsx("th",{className:"text-left px-2.5 py-1.5 font-medium",children:n("fileJob.templatePlaceholder")}),r.jsx("th",{className:"px-2 py-1.5"}),r.jsx("th",{className:"text-left px-2.5 py-1.5 font-medium",children:n("fileJob.dataField")})]})}),r.jsx("tbody",{children:c.slice(0,8).map(p=>r.jsxs("tr",{className:"border-t border-dark-border/50",children:[r.jsx("td",{className:"px-2.5 py-1.5 font-mono text-accent-purple",children:"{{"+p.placeholder+"}}"}),r.jsx("td",{className:"px-2 py-1.5 text-dark-muted",children:r.jsx(qr,{size:11})}),r.jsx("td",{className:"px-2.5 py-1.5 font-mono text-accent-blue",children:p.field})]},p.placeholder))})]})}),c.length>8&&r.jsx("div",{className:"text-[10px] text-dark-muted/60",children:n("fileJob.mappingMore",{n:c.length-8})})]}),s==="rendering"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs text-dark-muted",children:n("fileJob.rendering",{current:e.currentRow||0,total:e.totalRows||0})}),r.jsx(Cn,{value:d,size:"sm",variant:"warning",showLabel:!0})]}),l.length>0&&s==="complete"&&r.jsx("div",{className:"space-y-1.5",children:l.map(p=>{const T=(Tt[p.format]||Tt.text).icon,b=p.failedRows.length>0;return r.jsxs("div",{className:"rounded-lg border border-dark-border bg-dark-bg px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(T,{size:15,className:"text-accent-green shrink-0"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-xs text-dark-text truncate",children:p.fileName}),r.jsxs("div",{className:"text-[10px] text-dark-muted",children:[Zn(p.size)," · ",p.successCount,"/",p.rowCount," 行",b&&r.jsxs("span",{className:"text-accent-red",children:[" · ",p.failedRows.length," 行失败"]})]})]}),r.jsxs("button",{onClick:()=>o(p.path),className:"flex items-center gap-1 rounded-md bg-accent-blue/10 text-accent-blue px-2 py-1 text-[11px] hover:bg-accent-blue/20 transition-colors",title:n("fileJob.download"),children:[r.jsx(es,{size:12}),n("fileJob.download")]})]}),b&&r.jsxs("div",{className:"mt-1.5 space-y-0.5 border-t border-dark-border/50 pt-1.5",children:[p.failedRows.slice(0,3).map(h=>r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-red",children:[r.jsx(ts,{size:10,className:"shrink-0"}),r.jsxs("span",{children:["#",h.index+1]}),r.jsx("span",{className:"truncate",children:h.error})]},h.index)),p.failedRows.length>3&&r.jsxs("div",{className:"text-[10px] text-dark-muted/70",children:["+",p.failedRows.length-3," 行"]})]})]},p.path)})}),s==="error"&&r.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-accent-red/30 bg-accent-red/5 px-3 py-2.5",children:[r.jsx(ct,{size:15,className:"text-accent-red shrink-0 mt-0.5"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-xs font-medium text-accent-red",children:e.error||n("fileJob.error")}),e.errorDetail&&r.jsx("div",{className:"mt-0.5 text-[11px] text-dark-muted break-words",children:e.errorDetail})]})]})]})]})});function va(t,e){switch(t){case"uploaded":return e("fileJob.stageUploaded");case"parsing":return e("fileJob.stageParsing");case"mapping":return e("fileJob.stageMapping");case"rendering":return e("fileJob.stageRendering");case"complete":return e("fileJob.stageComplete");case"error":return e("fileJob.stageError");default:return e("fileJob.stageUploaded")}}const Qn={auth:{icon:ss,color:"text-accent-red"},rate_limit:{icon:En,color:"text-accent-yellow"},timeout:{icon:En,color:"text-accent-yellow"},network:{icon:rs,color:"text-accent-yellow"},model:{icon:ns,color:"text-accent-red"},tool:{icon:ct,color:"text-accent-yellow"},unknown:{icon:ct,color:"text-accent-red"}},Sa=S.memo(function({error:e,onRetry:n}){const{t:s}=Re(),[o,i]=S.useState(!1),a=Qn[e.category]||Qn.unknown,c=a.icon,l=()=>{window.dispatchEvent(new CustomEvent("switch-tab",{detail:"models"}))};return r.jsxs("div",{className:"mt-2 max-w-2xl overflow-hidden rounded-xl border border-accent-red/30 bg-dark-surface",children:[r.jsxs("div",{className:"flex items-start gap-3 px-3.5 py-3",children:[r.jsx(c,{size:18,className:Me("shrink-0 mt-0.5",a.color)}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-[13px] font-medium text-dark-text",children:e.summary}),e.detail&&e.detail!==e.summary&&r.jsx("div",{className:"mt-0.5 text-[11px] text-dark-muted/80 break-words",children:e.detail.slice(0,160)}),r.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[e.retryable&&n&&r.jsxs("button",{onClick:n,className:"flex items-center gap-1 rounded-md bg-accent-blue/10 text-accent-blue px-2 py-1 text-[11px] hover:bg-accent-blue/20 transition-colors",children:[r.jsx(Rt,{size:11}),s("errorCard.retry")]}),e.category==="auth"&&r.jsxs("button",{onClick:l,className:"flex items-center gap-1 rounded-md bg-dark-hover text-dark-text px-2 py-1 text-[11px] hover:bg-dark-border transition-colors",children:[r.jsx(os,{size:11}),s("errorCard.modelSettings")]}),e.detail&&r.jsxs("button",{onClick:()=>i(d=>!d),className:"flex items-center gap-0.5 text-[11px] text-dark-muted hover:text-dark-text transition-colors",children:[r.jsx(lt,{size:11,className:Me("transition-transform",o&&"rotate-180")}),s("errorCard.details")]})]})]})]}),o&&e.detail&&r.jsx("div",{className:"border-t border-dark-border/60 bg-dark-bg px-3.5 py-2.5 text-[11px] font-mono text-dark-muted break-words max-h-40 overflow-y-auto custom-scrollbar",children:e.detail})]})});function $t({onClick:t,title:e,children:n,danger:s=!1}){return r.jsx("button",{onClick:t,title:e,"aria-label":e,className:`inline-flex items-center justify-center rounded p-1 transition-colors ${s?"text-dark-muted hover:text-accent-red hover:bg-accent-red/10":"text-dark-muted hover:text-dark-text hover:bg-dark-hover"}`,children:n})}function qn({message:t,sessionId:e,onRegenerate:n,onDeleteMessage:s}){const{t:o}=Re(),[i,a]=S.useState(!1),c=S.useRef(null);S.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const l=S.useCallback(async()=>{try{await navigator.clipboard.writeText(t.content||t.thinking||""),a(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>a(!1),2e3)}catch(d){console.error("Failed to copy message:",d)}},[t.content,t.thinking]);return e?r.jsxs(r.Fragment,{children:[r.jsx($t,{onClick:l,title:o("chat.copyMessage"),children:i?r.jsx(sr,{size:12,className:"text-accent-green"}):r.jsx(rr,{size:12})}),t.type==="assistant"&&n&&r.jsx($t,{onClick:()=>n(t.id),title:o("chat.regenerate"),children:r.jsx(Rt,{size:12})}),s&&r.jsx($t,{onClick:()=>s(t.id),title:o("chat.deleteMessage"),danger:!0,children:r.jsx(as,{size:12})})]}):null}function er({ts:t,align:e,children:n}){const{i18n:s}=Re(),o=s.language==="en"?"en-US":"zh-CN";return r.jsx("div",{className:"relative h-0 select-none",children:r.jsxs("div",{className:`absolute top-1 flex items-center gap-0.5 text-[10.5px] leading-none whitespace-nowrap opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity duration-150 ${e==="right"?"right-0":"left-0"}`,children:[n,r.jsx("span",{className:"pl-1 text-[10px] text-dark-muted/50",children:new Date(t).toLocaleTimeString(o,{hour:"2-digit",minute:"2-digit"})})]})})}const wa=S.memo(function({message:e,sessionId:n,onRegenerate:s,onDeleteMessage:o}){var p,v,T;const{t:i}=Re(),a=Oe(b=>{var g;if(!n||!b.generatingSessions.includes(n))return!1;const h=b.messagesBySession[n];return h?((g=h[h.length-1])==null?void 0:g.id)===e.id:!1}),[c,l]=S.useState(!0),d=S.useRef(a);S.useEffect(()=>{d.current&&!a&&l(!0),d.current=a},[a]);const u=e.type==="user",f=e.type==="system",x=S.useCallback((b,h)=>{if(!n)return;const w=Oe.getState().getMessages(n),C=w.findIndex(k=>k.id===e.id);if(C===-1)return;const I=w[C];if(!I)return;const L={...I,hookApproval:I.hookApproval?{...I.hookApproval,status:h}:void 0},m=[...w];m[C]=L,Oe.setState({messagesBySession:{...Oe.getState().messagesBySession,[n]:m}})},[n,e.id]);return e.deleted?null:u?r.jsx("div",{className:"group flex justify-end animate-fade-in-up px-1",children:r.jsxs("div",{className:"max-w-[92%] md:max-w-[78%]",children:[r.jsx("div",{className:"rounded-2xl rounded-br-md border border-dark-border/70 bg-dark-surface px-4 py-2.5 shadow-sm",children:r.jsx("div",{className:"text-dark-text whitespace-pre-wrap break-words leading-relaxed text-sm",children:(p=e.content)==null?void 0:p.replace(/\n{3,}/g,`
9
-
10
- `)})}),r.jsx(er,{ts:e.timestamp,align:"right",children:r.jsx(qn,{message:e,sessionId:n,onRegenerate:s,onDeleteMessage:o})})]})}):f?r.jsx("div",{className:"flex justify-center animate-fade-in-up px-1 py-1",children:r.jsx("div",{className:"text-[11px] text-dark-muted bg-dark-surface border border-dark-border/60 rounded-full px-3.5 py-1 max-w-[90%] text-center",children:e.content})}):r.jsx("div",{className:"group flex animate-fade-in-up px-1",children:r.jsxs("div",{className:"w-full max-w-full",children:[r.jsx(er,{ts:e.timestamp,align:"left",children:r.jsx(qn,{message:e,sessionId:n,onRegenerate:s,onDeleteMessage:o})}),e.steps&&e.steps.length>0&&!e.hookApproval?r.jsx(xa,{steps:e.steps,isGenerating:a}):r.jsxs(r.Fragment,{children:[e.thinking&&!e.hookApproval&&r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{className:"flex items-center gap-1.5 cursor-pointer select-none py-0.5 text-xs",onClick:()=>l(!c),"data-testid":"thinking-toggle",children:[r.jsx(nn,{size:12,className:`text-dark-muted transition-transform ${c?"":"rotate-90"}`}),r.jsx("span",{className:a?"text-accent-blue/90 animate-pulse":"text-dark-muted",children:a?`${i("chat.thinking")}…`:i("chat.thoughtProcess")})]}),!c&&r.jsx("div",{className:"mt-1 text-xs text-dark-muted whitespace-pre-wrap break-words border-l-2 border-dark-border/40 pl-3 max-h-64 overflow-y-auto custom-scrollbar",children:e.thinking.replace(/\n{3,}/g,`
11
-
12
- `)})]}),e.toolCalls&&e.toolCalls.length>0&&!e.hookApproval&&r.jsx("div",{className:"mb-1 space-y-0.5",children:e.toolCalls.map(b=>r.jsx(Gr,{toolCall:b},b.id))})]}),e.content?r.jsx("div",{className:"leading-relaxed",children:r.jsx(na,{content:e.content.replace(/\n{3,}/g,`
13
-
14
- `)})}):!e.thinking&&!e.hookApproval&&((v=e.steps)!=null&&v.length)?null:!e.thinking&&!e.hookApproval&&!((T=e.steps)!=null&&T.length)&&a?r.jsxs("div",{className:"flex items-center gap-3 py-1 text-xs text-dark-muted",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink"}),r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.2s"}}),r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.4s"}})]}),i("chat.thinking"),"..."]}):null,e.fileJob&&r.jsx("div",{className:"mt-3",children:r.jsx(ba,{job:e.fileJob})}),e.errorCard&&r.jsx("div",{className:"mt-3",children:r.jsx(Sa,{error:e.errorCard,onRetry:n&&s?()=>s(e.id):void 0})}),e.hookApproval&&r.jsx("div",{className:"mt-3 border-l-2 border-accent-yellow/50 pl-3",children:r.jsx(ga,{approval:e.hookApproval,onResolved:x})})]})})}),ka=S.memo(function({messages:e,isGenerating:n,sessionId:s,onSendSuggestion:o,onRegenerate:i,onDeleteMessage:a}){const{t:c}=Re(),l=S.useRef(null),d=S.useRef(n);d.current=n;const[u,f]=S.useState(!0),x=S.useCallback(C=>{const I=C.currentTarget,L=I.scrollHeight-I.scrollTop-I.clientHeight;f(L<50)},[]),p=S.useMemo(()=>D.forwardRef((C,I)=>r.jsx("div",{...C,ref:I,onScroll:x})),[x]);S.useEffect(()=>{n&&(f(!0),requestAnimationFrame(()=>{var C;(C=l.current)==null||C.scrollToIndex({index:"LAST",behavior:"smooth"})}))},[n]);const v=S.useMemo(()=>e.filter(C=>!C.deleted),[e]),T=S.useMemo(()=>(C,I)=>r.jsx("div",{className:"px-4 py-2",children:r.jsx(wa,{message:I,sessionId:s,onRegenerate:i,onDeleteMessage:a})}),[s,i,a]),b=S.useMemo(()=>()=>n?r.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted py-3 px-5",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink"}),r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.2s"}}),r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.4s"}})]}),r.jsx("span",{children:c("chat.thinkingEllipsis")})]}):null,[n,c]),h=S.useMemo(()=>[{icon:is,label:c("chat.suggestionCode"),prompt:c("chat.suggestionCodePrompt")},{icon:ls,label:c("chat.suggestionAnalyze"),prompt:c("chat.suggestionAnalyzePrompt")},{icon:cs,label:c("chat.suggestionAutomate"),prompt:c("chat.suggestionAutomatePrompt")}],[c]),g=S.useMemo(()=>()=>r.jsx("div",{className:"flex min-h-[55vh] items-center justify-center p-6",children:r.jsxs("div",{className:"w-full max-w-xl px-4 text-center",children:[r.jsx("img",{src:"/logo.svg",alt:"deepseekcode",className:"w-14 h-14 mx-auto mb-5 rounded-2xl shadow-md"}),r.jsx("h2",{className:"text-xl font-semibold tracking-tight mb-2",children:c("chat.welcome")}),r.jsx("p",{className:"text-dark-muted text-sm mb-8",children:c("chat.welcomeDesc")}),o&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2.5 text-left",children:h.map(C=>r.jsxs("button",{onClick:()=>o(C.prompt),className:"group w-full rounded-xl border border-dark-border bg-dark-surface px-3.5 py-3 text-left transition-all duration-150 hover:border-accent-blue/40 hover:shadow-md hover:-translate-y-px",children:[r.jsx(C.icon,{size:16,"aria-hidden":"true",className:"text-accent-blue mb-2"}),r.jsx("div",{className:"text-[13px] font-medium text-dark-text",children:C.label}),r.jsx("div",{className:"mt-0.5 text-[11px] leading-snug text-dark-muted line-clamp-2",children:C.prompt})]},C.label))})]})}),[c,h,o]),w=S.useMemo(()=>v.length===0?{Scroller:p,Footer:b,Header:g}:{Scroller:p,Footer:b},[p,b,g,v.length]);return r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:r.jsx(Mo,{ref:l,data:v,itemContent:T,followOutput:u?"smooth":void 0,components:w,style:{height:"100%"}})})}),Ia={plan:"border-accent-blue/30 text-accent-blue bg-accent-blue/10","auto-plan":"border-accent-cyan/30 text-accent-cyan bg-accent-cyan/10",act:"border-accent-green/30 text-accent-green bg-accent-green/10","auto-act":"border-accent-yellow/30 text-accent-yellow bg-accent-yellow/10",goal:"border-accent-purple/30 text-accent-purple bg-accent-purple/10","auto-goal":"border-accent-red/30 text-accent-red bg-accent-red/10",normal:"border-accent-green/30 text-accent-green"},Ta=S.memo(function(){const{t:e}=Re(),n=st(l=>l.mode),s=st(l=>l.setBaseMode),o=st(l=>l.toggleAuto),i=n==="normal"?"act":n,a=Ss(i),c=Kt(i);return r.jsxs("div",{className:"flex items-center gap-1",children:[bs.map(l=>{const d=a===l,u=vs[l],f=n!=="normal"&&d?Ia[n]??"border-dark-border text-dark-muted":"border-dark-border text-dark-muted hover:bg-dark-hover";return r.jsx("button",{type:"button",onClick:()=>s(l),className:Me("px-2 py-0.5 rounded-full border text-xs whitespace-nowrap transition-colors cursor-pointer",f),title:e("chat.clickToSwitchMode"),"aria-pressed":d,children:u.label},l)}),r.jsxs("button",{type:"button",role:"switch","aria-checked":c,onClick:()=>o(),className:Me("flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs whitespace-nowrap transition-colors cursor-pointer",c?"border-accent-yellow/40 text-accent-yellow bg-accent-yellow/10":"border-dark-border text-dark-muted hover:bg-dark-hover"),title:e("plan.autoApprove"),children:[r.jsx(Rt,{size:11,className:Me(c?"text-accent-yellow":"text-dark-muted")}),r.jsx("span",{children:e("plan.autoApprove")})]})]})}),Ea=800,tr=/\[Pasted text #(\d+)(?:\s*\+\d+ lines?)?\]/g;let ya=0;const Wr=new Map;function Na(t){const e=++ya;return Wr.set(e,t),e}function Ca(t){return t.length>Ea||Vr(t)>0}function Vr(t){return(t.match(/\r\n|\r|\n/g)||[]).length}function ja(t){const e=Na(t),n=Vr(t);return n===0?{id:e,label:`[Pasted text #${e}]`}:{id:e,label:`[Pasted text #${e} +${n} lines]`}}function Ra(t){return tr.lastIndex=0,t.replace(tr,(e,n)=>{const s=parseInt(n,10),o=Wr.get(s);return o!==void 0?o:e})}function Aa(){return typeof window<"u"&&!!window.__TAURI__}async function Oa(){const t=window.__TAURI__;if(!t)return null;try{const e=await t.core.invoke("pick_files");return Array.isArray(e)?e.map(n=>String(n)).filter(Boolean):null}catch(e){return console.warn("[native] pick_files failed, falling back to browser picker:",e),null}}const nr=/\.(xlsx|xls|csv|docx|txt|md)$/i,La=".deepseekcode/attachments",Fa=50*1024*1024,Et=10,Ha=t=>/\.xlsx?$/i.test(t)?Wt:/\.(csv|docx|txt|md)$/i.test(t)?Gt:ar,Da=S.memo(function({sessionId:e,onSend:n,onStop:s,onPause:o,onResume:i}){const{t:a}=Re(),c=Oe(R=>{var V;return((V=R.sessionInputs)==null?void 0:V[e])??""}),l=Oe(R=>R.setSessionInput),d=Oe(R=>{var V;return((V=R.generatingSessions)==null?void 0:V.includes(e))??!1}),u=Oe(R=>{var V;return((V=R.pausedSessions)==null?void 0:V.includes(e))??!1}),f=S.useRef(null),x=S.useRef(null),p=S.useRef(!1),[v,T]=S.useState([]),[b,h]=S.useState(!1),g=S.useDeferredValue(c),w=Nn(R=>R.estimateTokens),C=S.useMemo(()=>w(g),[g,w]),I=Nn(R=>R.model),L=S.useCallback(R=>{l(e,R)},[e,l]),m=S.useCallback(()=>{const R=f.current;R&&(R.style.height="auto",R.style.height=Math.min(R.scrollHeight,200)+"px")},[]);S.useEffect(()=>{m()},[c,v.length,m]);const k=S.useCallback(R=>{const V=R.target.value;L(V)},[L]),j=S.useCallback(R=>{const V=Array.from(R);T(K=>{const ue=Et-K.length,y=K.slice();for(const B of V.slice(0,ue)){if(!nr.test(B.name)){Pe.warning(a("fileJob.unsupportedType",{name:B.name}));continue}if(B.size>Fa){Pe.error(a("fileJob.fileTooLarge",{name:B.name}));continue}if(y.some(Z=>Z.name===B.name)){Pe.warning(a("fileJob.duplicateFile",{name:B.name}));continue}y.push({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,file:B,name:B.name,size:B.size,uploading:!1})}return y.length>=Et&&Pe.warning(a("fileJob.maxAttachments",{n:Et})),y})},[a]),F=S.useCallback(R=>{R.target.files&&R.target.files.length>0&&(j(R.target.files),R.target.value="")},[j]),O=S.useCallback(async()=>{var R;if(Aa()){const V=await Oa();if(!V||V.length===0)return;const K=await Vt.fileJob.importPaths(V);if(K.success&&Array.isArray(K.data)){const ue=K.data.filter(y=>nr.test(y.name)).map(y=>({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,name:y.name,size:y.size,uploading:!1,path:y.path.replace(/\\/g,"/")}));T(y=>{const B=Et-y.length;return[...y,...ue.slice(0,B)]})}else Pe.error(K.error||a("fileJob.importFailed"))}else(R=x.current)==null||R.click()},[a]),U=S.useCallback(R=>{T(V=>V.filter(K=>K.id!==R))},[]),H=S.useCallback(R=>{R.preventDefault(),h(!0)},[]),M=S.useCallback(R=>{R.preventDefault(),h(!1)},[]),X=S.useCallback(R=>{R.preventDefault(),h(!1),R.dataTransfer.files&&R.dataTransfer.files.length>0&&j(R.dataTransfer.files)},[j]),Q=S.useCallback(async()=>{var V;if(v.length===0)return"";const R=[];for(const K of v){if(K.path){R.push(`<attachment path="${K.path}" />`);continue}if(!K.file)continue;T(B=>B.map(Z=>Z.id===K.id?{...Z,uploading:!0,error:void 0}:Z));const ue=`${La}/${K.name}`,y=await Vt.files.upload(K.file,ue);if(y.success&&((V=y.data)!=null&&V.path)){const B=y.data.path.replace(/\\/g,"/");T(Z=>Z.map(ee=>ee.id===K.id?{...ee,uploading:!1,path:B}:ee)),R.push(`<attachment path="${B}" />`)}else T(B=>B.map(Z=>Z.id===K.id?{...Z,uploading:!1,error:y.error||a("fileJob.uploadFailed")}:Z)),Pe.error(`${K.name}: ${y.error||a("fileJob.uploadFailed")}`)}return R.length>0?`${R.join(`
15
- `)}
16
-
17
- `:""},[v,a]),J=S.useCallback(R=>{const V=R.clipboardData.getData("text/plain");if(R.clipboardData.files&&R.clipboardData.files.length>0){R.preventDefault(),j(R.clipboardData.files);return}if(!V||!Ca(V))return;R.preventDefault();const{label:K}=ja(V),ue=f.current;if(!ue)return;const y=ue.selectionStart,B=ue.selectionEnd,Z=ue.value,ee=Z.slice(0,y)+K+Z.slice(B);L(ee),requestAnimationFrame(()=>{ue.selectionStart=ue.selectionEnd=y+K.length})},[L,j]),ie=S.useCallback(async()=>{const R=c.trim(),V=v.length>0;if(!R&&!V)return;let K="";if(V){if(v.some(y=>y.uploading)){Pe.warning(a("fileJob.stillUploading"));return}K=await Q()}const ue=(K+Ra(c)).trim();!ue&&!V||(n(ue||K.trim()),L(""),T([]))},[c,v,n,L,Q,a]),Ee=S.useCallback(R=>{if(!R.nativeEvent.isComposing){if(R.key==="Escape"&&d){R.preventDefault(),u?i():o();return}if(R.key==="Enter"&&(R.ctrlKey||R.metaKey)){R.preventDefault(),ie();return}R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),ie())}},[d,u,ie,o,i]),be=S.useCallback(()=>{p.current=!0},[]),Se=S.useCallback(()=>{p.current=!1},[]),Ae=C>8e3,ve=c.trim().length>0||v.length>0;return r.jsxs("div",{className:"shrink-0 px-3 sm:px-4 pb-3 pt-2 bg-dark-bg",onDragOver:H,onDragLeave:M,onDrop:X,children:[v.length>0&&r.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:v.map(R=>{const V=Ha(R.name);return r.jsxs("div",{className:Me("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-xs transition-colors",R.error?"border-accent-red/40 bg-accent-red/5 text-accent-red":R.uploading?"border-accent-blue/40 bg-accent-blue/5 text-accent-blue":"border-dark-border bg-dark-surface text-dark-text"),children:[R.uploading?r.jsx(or,{size:13,className:"animate-spin"}):r.jsx(V,{size:13}),r.jsx("span",{className:"max-w-[140px] truncate",children:R.name}),r.jsx("span",{className:"text-[10px] text-dark-muted",children:R.size>1024*1024?`${(R.size/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(R.size/1024))} KB`}),!R.uploading&&r.jsx("button",{onClick:()=>U(R.id),className:"rounded p-0.5 text-dark-muted hover:text-accent-red hover:bg-accent-red/10 transition-colors","aria-label":a("a11y.close"),children:r.jsx(rn,{size:11})})]},R.id)})}),b&&r.jsx("div",{className:"mb-2 rounded-2xl border-2 border-dashed border-accent-blue/50 bg-accent-blue/5 py-3 text-center text-xs text-accent-blue",children:a("fileJob.dropHint")}),r.jsxs("div",{className:"rounded-2xl border border-dark-border bg-dark-surface shadow-sm transition-all duration-150 focus-within:border-accent-blue/50 focus-within:ring-4 focus-within:ring-accent-blue/10",children:[r.jsx("textarea",{ref:f,value:c,onChange:k,onKeyDown:Ee,onPaste:J,onCompositionStart:be,onCompositionEnd:Se,placeholder:a(d?"chat.generatingPlaceholder":"chat.inputPlaceholder"),rows:1,disabled:d&&!u,"aria-label":"Message input",className:`w-full bg-transparent px-4 pt-3.5 pb-2 text-sm text-dark-text placeholder-dark-muted/60
18
- resize-none focus:outline-none min-h-[44px] max-h-[40vh] leading-relaxed
19
- disabled:opacity-50 disabled:cursor-not-allowed`}),r.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-2.5",children:[r.jsx(Ta,{}),r.jsx("span",{className:"text-[11px] text-dark-muted/80 font-mono truncate max-w-[10rem] hidden sm:block",children:I||""}),r.jsx("div",{className:"flex-1"}),C>0&&c.length>0&&r.jsxs("span",{className:`text-[10px] tabular-nums ${Ae?"text-accent-red font-medium":"text-dark-muted/60"}`,children:["~",C," tokens",Ae?` · ${a("chat.nearLimit")}`:""]}),!d&&r.jsx("button",{onClick:()=>void O(),className:"flex h-8 w-8 items-center justify-center rounded-full text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:a("fileJob.attach"),"aria-label":a("fileJob.attach"),children:r.jsx(ds,{size:15,"aria-hidden":"true"})}),r.jsx("input",{ref:x,type:"file",multiple:!0,accept:".xlsx,.xls,.csv,.docx,.txt,.md",className:"hidden",onChange:F}),d?r.jsxs("div",{className:"flex items-center gap-1.5",children:[u?r.jsx("button",{onClick:i,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-green text-white transition-all hover:opacity-85 active:scale-95",title:a("chat.resumeGen"),"aria-label":a("chat.resumeGen"),children:r.jsx(us,{size:14,"aria-hidden":"true"})}):r.jsx("button",{onClick:o,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-yellow text-white transition-all hover:opacity-85 active:scale-95",title:a("chat.pauseGen"),"aria-label":a("chat.pauseGen"),children:r.jsx(ps,{size:14,"aria-hidden":"true"})}),r.jsx("button",{onClick:s,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-red text-white transition-all hover:opacity-85 active:scale-95",title:a("chat.stopGen"),"aria-label":a("chat.stopGen"),children:r.jsx(ms,{size:13,"aria-hidden":"true"})})]}):r.jsx("button",{onClick:()=>void ie(),disabled:!ve,className:`flex h-8 w-8 items-center justify-center rounded-full bg-dark-text text-dark-bg transition-all
20
- hover:opacity-80 active:scale-95 disabled:opacity-25 disabled:cursor-not-allowed`,title:a("chat.sendBtn"),"aria-label":a("chat.sendBtn"),children:r.jsx(hs,{size:15,"aria-hidden":"true"})})]})]}),r.jsxs("div",{className:"mt-1.5 hidden sm:flex items-center justify-center gap-3 text-[10px] text-dark-muted/50 select-none",children:[r.jsx("span",{children:a("chat.shiftEnter")}),r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsx("span",{children:a("chat.escHint")})]})]})}),za=S.memo(function(){const{t:e}=Re(),[n,s]=S.useState(0),[o,i]=S.useState(0),a=S.useCallback(()=>{const c=He.getReconnectState();s(c.reconnecting?c.attempts:0),i(c.maxAttempts)},[]);return S.useEffect(()=>{const c=He.onReconnectAttempt((x,p)=>{s(x),i(p)}),l=He.onReconnectSuccess(()=>{s(0),i(0)}),d=He.onReconnectGiveUp(()=>s(0)),u=He.onClose(a),f=He.onOpen(a);return a(),()=>{c(),l(),d(),u(),f()}},[a]),n<=0?null:r.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 py-2 text-xs text-accent-yellow bg-accent-yellow/10 border-b border-accent-yellow/20 select-none",role:"status","aria-live":"polite",children:[r.jsx(Rt,{size:13,className:"animate-spin shrink-0"}),r.jsx("span",{children:e("reconnect.reconnecting",{attempt:n,max:o})}),r.jsx("span",{className:"hidden sm:inline text-[10px] text-accent-yellow/70",children:e("reconnect.hint")})]})}),Ut="dsc-auto-access-banner-dismissed",Ma=S.memo(function(){const{t:e}=Re(),n=st(c=>c.mode),[s,o]=S.useState(()=>localStorage.getItem(Ut)==="1");S.useEffect(()=>{Kt(n==="normal"?"act":n)||localStorage.getItem(Ut)==="1"&&o(!1)},[n]);const i=S.useCallback(c=>{c&&localStorage.setItem(Ut,"1"),o(!0)},[]);return!(n!=="normal"&&Kt(n))||s?null:r.jsxs("div",{className:"flex items-start gap-2 px-4 py-2 text-[11px] leading-snug text-accent-yellow bg-accent-yellow/10 border-b border-accent-yellow/20 select-none",role:"note",children:[r.jsx(fs,{size:14,className:"shrink-0 mt-0.5 text-accent-yellow"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"font-medium",children:e("autoAccess.title")}),r.jsxs("span",{className:"text-accent-yellow/80",children:[" ",e("autoAccess.desc")]})]}),r.jsx("button",{onClick:()=>i(!1),className:"shrink-0 rounded p-0.5 text-accent-yellow/70 hover:text-accent-yellow hover:bg-accent-yellow/10 transition-colors",title:e("autoAccess.dismiss"),"aria-label":e("autoAccess.dismiss"),children:r.jsx(rn,{size:12})}),r.jsx("button",{onClick:()=>i(!0),className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] text-accent-yellow/70 hover:text-accent-yellow hover:bg-accent-yellow/10 transition-colors whitespace-nowrap",children:e("autoAccess.neverShow")})]})}),Wa=S.memo(function({tabs:e,activeSessionId:n,onSend:s,onStop:o,onPause:i,onResume:a,activeTab:c,setActiveTab:l,createNewSession:d,clearMessages:u,setTheme:f,toggleTerminal:x,setLogs:p,setUnreadLogs:v,showTaskBoard:T=!0,onToggleTaskBoard:b,onRegenerate:h,onDeleteMessage:g}){const w=Oe(H=>n?H.messagesBySession[n]||[]:[]),C=Oe(H=>n?H.generatingSessions.includes(n):!1),I=Oe(H=>n?H.pausedSessions.includes(n):!1),L=ws(H=>n?H.getTasksForSession(n):[]),m=e.find(H=>H.id===n)||null,k=L.length>0,j=S.useCallback((H,M)=>{n&&s(n,H,M)},[s,n]),F=S.useCallback(H=>{n&&s(n,H)},[s,n]),O=S.useCallback(H=>{n&&h&&h(n,H)},[h,n]),U=S.useCallback(H=>{n&&g&&g(n,H)},[g,n]);return r.jsxs("div",{className:"flex-1 flex min-h-0",children:[r.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[r.jsx(za,{}),r.jsx(Ma,{}),m&&r.jsxs(r.Fragment,{children:[r.jsx(ka,{messages:w,isGenerating:C,isPaused:I,sessionId:m.id,onSendSuggestion:F,onRegenerate:h?O:void 0,onDeleteMessage:g?U:void 0}),r.jsx(Da,{sessionId:m.id,onSend:j,onStop:()=>o(m.id),onPause:()=>i(m.id),onResume:()=>a(m.id)})]})]}),n&&T&&k&&r.jsx("div",{className:"w-80 shrink-0 border-l border-dark-border overflow-hidden flex flex-col min-h-0 max-lg:hidden",children:r.jsx(ks,{sessionId:n,defaultExpanded:!0,onClose:b})}),n&&!T&&k&&r.jsxs("button",{onClick:b,className:"fixed bottom-6 right-6 z-40 bg-accent-blue text-white rounded-full px-3 py-2 shadow-lg hover:opacity-90 transition-opacity flex items-center gap-1.5 text-xs",children:[r.jsx(xs,{size:14}),"Task Board"]})]})});export{Wa as SessionGrid};
@@ -1,3 +0,0 @@
1
- import{j as r}from"./markdown-CIsUyqRd.js";import{r as s,an as $,ao as J,p as V,ap as _,D as K,$ as Q,aq as X,ar as Z}from"./icons-CjYP2PII.js";import{x as ee,a as te}from"./terminal-Ck_l6svU.js";import{f as U,g as re,h as C,t as se}from"./index-B-DFEdP3.js";import"./react-vendor-DuqM3ddv.js";import"./state-BCeK45RP.js";const ne={background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",cursorAccent:"#1e1e1e",black:"#1e1e1e",red:"#f44747",green:"#608b4e",yellow:"#dcdcaa",blue:"#569cd6",magenta:"#c586c0",cyan:"#4ec9b0",white:"#d4d4d4",brightBlack:"#808080",brightRed:"#f44747",brightGreen:"#608b4e",brightYellow:"#dcdcaa",brightBlue:"#569cd6",brightMagenta:"#c586c0",brightCyan:"#4ec9b0",brightWhite:"#ffffff"};function de(){const f=s.useRef(null),a=s.useRef(null),w=s.useRef(null),o=s.useRef(null),[j,M]=s.useState(!1),[g,v]=s.useState(null),[B,R]=s.useState(!0),d=s.useRef(!1),S=s.useRef({isAtBottom:!0}),I=s.useCallback(t=>{const e=a.current;if(!e)return;const n=e.buffer.active;S.current.isAtBottom=n.baseY+e.rows>=n.length,e.write(t,()=>{S.current.isAtBottom&&!d.current&&e.scrollToBottom();const l=e.buffer.active;l.baseY+e.rows>=l.length&&(d.current=!1)})},[]),[k,y]=s.useState(""),p=s.useCallback(()=>{const t=a.current,e=o.current;!t||!e||e.readyState!==WebSocket.OPEN||e.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},[]),{status:T,errorMessage:N,port:z}=U(),{setStarting:E,setRunning:A,setStopping:D,setIdle:L,setError:m}=U(),{workspaceDir:x}=re(),b=s.useCallback(()=>{o.current&&(o.current.onclose=null,o.current.onmessage=null,o.current.onerror=null,o.current.onopen=null,o.current.close(),o.current=null)},[]),h=s.useCallback(async t=>{E(),t.writeln("\x1B[90mStarting local terminal...\x1B[0m");try{const e=await C.post("/api/terminal/start",{workspaceDir:x});if(!e.success||!e.data){const c=e.error||"Failed to start terminal";m(c),t.writeln(`\x1B[31m${c}\x1B[0m`);return}const n=e.data.port??e.data.ttydPort,l=e.data.wsUrl;if(!n||!l){const c="Invalid terminal start response";m(c),t.writeln(`\x1B[31m${c}\x1B[0m`);return}A(n,l),y(e.data.workspaceDir||x);const u=new WebSocket(l);o.current=u,u.onopen=()=>{t.clear(),t.focus(),t.writeln("\x1B[32mConnected to local shell\x1B[0m"),setTimeout(()=>{var c,i;(c=w.current)==null||c.fit(),p(),d.current||(i=a.current)==null||i.scrollToBottom()},50)},u.onmessage=c=>{typeof c.data=="string"&&I(c.data)},u.onerror=()=>{m("Terminal connection error")},u.onclose=()=>{o.current===u&&(o.current=null,m("Terminal disconnected"),t.writeln("\x1B[33mTerminal disconnected\x1B[0m"))}}catch(e){const n=e instanceof Error?e.message:"Unknown error";m(n),t.writeln(`\x1B[31m${n}\x1B[0m`)}},[x,E,A,m,p]),F=s.useCallback(async()=>{b(),D();try{await C.post("/api/terminal/stop")}catch{}L()},[b,D,L]);s.useEffect(()=>{f.current&&C.get("/api/terminal/status").then(t=>{const e=t.success&&t.data?t.data:null;v((e==null?void 0:e.terminalAvailable)!==!1),e!=null&&e.workspaceDir&&y(e.workspaceDir)}).catch(()=>v(!1))},[]),s.useEffect(()=>{if(g!==!0||!f.current)return;const t=new ee.Terminal({theme:ne,fontFamily:'"Cascadia Code", "Fira Code", Consolas, "Courier New", monospace',fontSize:14,lineHeight:1.2,cursorBlink:!0,cursorStyle:"block",scrollback:1e4,convertEol:!0}),e=new te.FitAddon;t.loadAddon(e),t.open(f.current),t.focus(),e.fit(),a.current=t,w.current=e,t.writeln("\x1B[36mDeepSeekCode Local Terminal\x1B[0m"),t.writeln("\x1B[90mRun commands directly on this machine.\x1B[0m");const n=t.onData(i=>{var W;((W=o.current)==null?void 0:W.readyState)===WebSocket.OPEN&&o.current.send(i)}),l=t.onScroll(()=>{const i=t.buffer.active;i.baseY+t.rows<i.length&&(d.current=!0,R(!1))}),u=()=>{var i;(i=w.current)==null||i.fit(),p(),d.current||t.scrollToBottom()};window.addEventListener("resize",u);const c=window.setTimeout(()=>h(t),50);return()=>{clearTimeout(c),window.removeEventListener("resize",u),n.dispose(),l.dispose(),F(),t.dispose(),a.current=null}},[g,h,F,p]);const O=s.useCallback(()=>{var e;const t=(e=a.current)==null?void 0:e.getSelection();t&&(navigator.clipboard.writeText(t),se.success("Copied selection"))},[]),P=s.useCallback(()=>{var t,e;(t=a.current)==null||t.clear(),d.current||(e=a.current)==null||e.scrollToBottom()},[]),Y=s.useCallback(()=>{b(),a.current&&(a.current.clear(),h(a.current))},[b,h]),H=s.useCallback(()=>{R(t=>{var n;const e=!t;return d.current=!e,e&&((n=a.current)==null||n.scrollToBottom()),e})},[]),q=s.useCallback(()=>{const t=`Workspace: ${k||x}
2
- Terminal session: ${z??""}
3
- `,e=new Blob([t],{type:"text/plain"}),n=URL.createObjectURL(e),l=document.createElement("a");l.href=n,l.download=`terminal-${Date.now()}.log`,l.click(),URL.revokeObjectURL(n)},[x,k,z]),G=s.useMemo(()=>({idle:"Idle",starting:"Connecting",running:"Connected",stopping:"Stopping",error:"Error"})[T],[T]);return g===!1?r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-[#1e1e1e] gap-3 p-8",children:[r.jsx($,{size:44,className:"text-dark-muted opacity-40"}),r.jsx("div",{className:"text-sm text-dark-muted",children:"Local terminal unavailable"})]}):r.jsxs("div",{className:`flex flex-col bg-[#1e1e1e] border-t border-dark-border ${j?"fixed inset-0 z-50":"flex-1 min-h-0"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2 bg-[#252526] border-b border-[#3c3c3c]",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx($,{size:14,className:"text-dark-muted shrink-0"}),r.jsx("span",{className:"text-xs text-dark-muted shrink-0",children:"Terminal"}),r.jsx("span",{className:"text-xs text-dark-muted truncate",children:k||x}),r.jsxs("span",{className:"text-xs text-dark-muted",children:["[",G,"]"]}),N&&r.jsx("span",{className:"text-xs text-accent-red truncate max-w-[240px]",children:N})]}),r.jsxs("div",{className:"flex items-center gap-1 flex-wrap justify-end",children:[r.jsx("button",{onClick:H,className:`p-1 rounded hover:bg-[#3c3c3c] ${B?"text-accent-blue":"text-dark-muted"} hover:text-dark-text`,title:B?"璺熼殢杈撳嚭锛氬紑":"璺熼殢杈撳嚭锛氬叧",children:r.jsx(J,{size:12})}),r.jsx("button",{onClick:Y,className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Restart",children:r.jsx(V,{size:12})}),r.jsx("button",{onClick:O,className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Copy",children:r.jsx(_,{size:12})}),r.jsx("button",{onClick:q,className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Download log",children:r.jsx(K,{size:12})}),r.jsx("button",{onClick:P,className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Clear",children:r.jsx(Q,{size:12})}),r.jsx("button",{onClick:()=>M(t=>!t),className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Fullscreen",children:j?r.jsx(X,{size:12}):r.jsx(Z,{size:12})})]})]}),r.jsx("div",{ref:f,className:"flex-1 overflow-hidden"})]})}export{de as TerminalView,de as default};
@@ -1 +0,0 @@
1
- import"./markdown-CIsUyqRd.js";import{r}from"./icons-CjYP2PII.js";r.createContext(null);