wherdr 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{DZGKxROq.js → B2KlcBQ-.js} +1 -1
  3. package/.output/public/_nuxt/B2KlcBQ-.js.br +0 -0
  4. package/.output/public/_nuxt/B2KlcBQ-.js.gz +0 -0
  5. package/.output/public/_nuxt/BF2qZ0lx.js +31 -0
  6. package/.output/public/_nuxt/BF2qZ0lx.js.br +0 -0
  7. package/.output/public/_nuxt/BF2qZ0lx.js.gz +0 -0
  8. package/.output/public/_nuxt/{lBx2yXX9.js → BU6Ihnb9.js} +12 -12
  9. package/.output/public/_nuxt/BU6Ihnb9.js.br +0 -0
  10. package/.output/public/_nuxt/BU6Ihnb9.js.gz +0 -0
  11. package/.output/public/_nuxt/{XlRX1U8d.js → BmF5BXwf.js} +5 -5
  12. package/.output/public/_nuxt/BmF5BXwf.js.br +0 -0
  13. package/.output/public/_nuxt/BmF5BXwf.js.gz +0 -0
  14. package/.output/public/_nuxt/{B8pUlE1v.js → BqaV2jLN.js} +42 -40
  15. package/.output/public/_nuxt/BqaV2jLN.js.br +0 -0
  16. package/.output/public/_nuxt/BqaV2jLN.js.gz +0 -0
  17. package/.output/public/_nuxt/{JL_QI6J1.js → C_pXkozx.js} +1 -1
  18. package/.output/public/_nuxt/C_pXkozx.js.br +0 -0
  19. package/.output/public/_nuxt/C_pXkozx.js.gz +0 -0
  20. package/.output/public/_nuxt/Cq1IlvFx.js +3 -0
  21. package/.output/public/_nuxt/Cq1IlvFx.js.br +0 -0
  22. package/.output/public/_nuxt/Cq1IlvFx.js.gz +0 -0
  23. package/.output/public/_nuxt/{CBJ483HL.js → DN2uhp8-.js} +1 -1
  24. package/.output/public/_nuxt/{xSo3mAHb.js → DNk1pHah.js} +1 -1
  25. package/.output/public/_nuxt/DNk1pHah.js.br +0 -0
  26. package/.output/public/_nuxt/DNk1pHah.js.gz +0 -0
  27. package/.output/public/_nuxt/DcQrp3bD.js +25 -0
  28. package/.output/public/_nuxt/DcQrp3bD.js.br +0 -0
  29. package/.output/public/_nuxt/DcQrp3bD.js.gz +0 -0
  30. package/.output/public/_nuxt/{DOnGrCAZ.js → I_R_EgeO.js} +1 -1
  31. package/.output/public/_nuxt/L_vgVKcG.js +105 -0
  32. package/.output/public/_nuxt/L_vgVKcG.js.br +0 -0
  33. package/.output/public/_nuxt/L_vgVKcG.js.gz +0 -0
  34. package/.output/public/_nuxt/{DNAl4698.js → RI4B_b2M.js} +7 -7
  35. package/.output/public/_nuxt/RI4B_b2M.js.br +0 -0
  36. package/.output/public/_nuxt/RI4B_b2M.js.gz +0 -0
  37. package/.output/public/_nuxt/{board.B8JX7Yhy.css → board.CeTYM1XN.css} +1 -1
  38. package/.output/public/_nuxt/board.CeTYM1XN.css.br +0 -0
  39. package/.output/public/_nuxt/{board.B8JX7Yhy.css.gz → board.CeTYM1XN.css.gz} +0 -0
  40. package/.output/public/_nuxt/builds/latest.json +1 -1
  41. package/.output/public/_nuxt/builds/meta/9240e8b5-8099-4108-9ff2-34b7f376d31a.json +1 -0
  42. package/.output/public/_nuxt/entry._gNxiS8l.css +2 -0
  43. package/.output/public/_nuxt/entry._gNxiS8l.css.br +0 -0
  44. package/.output/public/_nuxt/entry._gNxiS8l.css.gz +0 -0
  45. package/.output/public/sw.js +1 -1
  46. package/.output/server/chunks/_/branding.mjs +1 -1
  47. package/.output/server/chunks/_/package.mjs +1 -1
  48. package/.output/server/chunks/_/selfupdate.mjs +1 -1
  49. package/.output/server/chunks/_/updates.mjs +1 -1
  50. package/.output/server/chunks/_/worktrees.mjs +1 -1
  51. package/.output/server/chunks/_/ws.mjs +1 -1
  52. package/.output/server/chunks/nitro/nitro.mjs +689 -503
  53. package/.output/server/chunks/routes/api/space.post.mjs +1 -177
  54. package/.output/server/chunks/routes/api/tasks/action.post.mjs +1 -1
  55. package/.output/server/chunks/routes/api/tasks/add.post.mjs +1 -1
  56. package/.output/server/chunks/routes/api/tasks/after.post.mjs +1 -1
  57. package/.output/server/chunks/routes/api/tasks/approve.post.mjs +1 -1
  58. package/.output/server/chunks/routes/api/tasks/archive-done.post.mjs +1 -1
  59. package/.output/server/chunks/routes/api/tasks/archived.get.mjs +1 -1
  60. package/.output/server/chunks/routes/api/tasks/autopilot.get.mjs +1 -1
  61. package/.output/server/chunks/routes/api/tasks/autopilot.post.mjs +1 -1
  62. package/.output/server/chunks/routes/api/tasks/board-settings.get.mjs +1 -1
  63. package/.output/server/chunks/routes/api/tasks/board-settings.post.mjs +1 -1
  64. package/.output/server/chunks/routes/api/tasks/coordinator.get.mjs +1 -1
  65. package/.output/server/chunks/routes/api/tasks/coordinator.post.mjs +1 -1
  66. package/.output/server/chunks/routes/api/tasks/describe.post.mjs +1 -1
  67. package/.output/server/chunks/routes/api/tasks/details.get.mjs +1 -1
  68. package/.output/server/chunks/routes/api/tasks/limit.post.mjs +1 -1
  69. package/.output/server/chunks/routes/api/tasks/links.get.mjs +1 -1
  70. package/.output/server/chunks/routes/api/tasks/models.get.mjs +1 -1
  71. package/.output/server/chunks/routes/api/tasks/pick.post.mjs +1 -1
  72. package/.output/server/chunks/routes/api/tasks/project.get.mjs +1 -1
  73. package/.output/server/chunks/routes/api/tasks/project.post.mjs +1 -1
  74. package/.output/server/chunks/routes/api/tasks/question.post.mjs +1 -1
  75. package/.output/server/chunks/routes/api/tasks/scheduled.get.mjs +1 -1
  76. package/.output/server/chunks/routes/api/tasks/settings.get.mjs +1 -1
  77. package/.output/server/chunks/routes/api/tasks/start.get.mjs +1 -1
  78. package/.output/server/chunks/routes/api/tasks/tell.post.mjs +1 -1
  79. package/.output/server/chunks/routes/api/tasks.get.mjs +1 -1
  80. package/.output/server/chunks/routes/api/unqueue.post.mjs +1 -1
  81. package/.output/server/chunks/routes/icons/_name_.get.mjs +1 -1
  82. package/.output/server/chunks/routes/renderer.mjs +2 -2
  83. package/.output/server/chunks/routes/uploads/_...name_.get.mjs +1 -1
  84. package/.output/server/chunks/routes/ws/_..._.mjs +1 -1
  85. package/.output/server/chunks/routes/ws/events.mjs +1 -1
  86. package/.output/server/chunks/routes/ws/term.mjs +1 -1
  87. package/.output/server/chunks/virtual/precomputed.mjs +1 -1
  88. package/.output/server/index.mjs +1 -1
  89. package/.output/server/package.json +1 -1
  90. package/README.md +3 -1
  91. package/docs/README.md +4 -0
  92. package/docs/RELEASING.md +18 -10
  93. package/docs/configuration.md +9 -0
  94. package/docs/release-notes-2.2.0.md +19 -0
  95. package/docs/release-notes-2.3.0.md +23 -0
  96. package/package.json +1 -1
  97. package/.output/public/_nuxt/B8pUlE1v.js.br +0 -0
  98. package/.output/public/_nuxt/B8pUlE1v.js.gz +0 -0
  99. package/.output/public/_nuxt/Bo4dpAxE.js +0 -31
  100. package/.output/public/_nuxt/Bo4dpAxE.js.br +0 -0
  101. package/.output/public/_nuxt/Bo4dpAxE.js.gz +0 -0
  102. package/.output/public/_nuxt/CJF9DrFj.js +0 -25
  103. package/.output/public/_nuxt/CJF9DrFj.js.br +0 -0
  104. package/.output/public/_nuxt/CJF9DrFj.js.gz +0 -0
  105. package/.output/public/_nuxt/DNAl4698.js.br +0 -0
  106. package/.output/public/_nuxt/DNAl4698.js.gz +0 -0
  107. package/.output/public/_nuxt/DR832Br-.js +0 -3
  108. package/.output/public/_nuxt/DR832Br-.js.br +0 -0
  109. package/.output/public/_nuxt/DR832Br-.js.gz +0 -0
  110. package/.output/public/_nuxt/DZGKxROq.js.br +0 -0
  111. package/.output/public/_nuxt/DZGKxROq.js.gz +0 -0
  112. package/.output/public/_nuxt/DclfLrr5.js +0 -105
  113. package/.output/public/_nuxt/DclfLrr5.js.br +0 -0
  114. package/.output/public/_nuxt/DclfLrr5.js.gz +0 -0
  115. package/.output/public/_nuxt/JL_QI6J1.js.br +0 -0
  116. package/.output/public/_nuxt/JL_QI6J1.js.gz +0 -0
  117. package/.output/public/_nuxt/XlRX1U8d.js.br +0 -0
  118. package/.output/public/_nuxt/XlRX1U8d.js.gz +0 -0
  119. package/.output/public/_nuxt/board.B8JX7Yhy.css.br +0 -0
  120. package/.output/public/_nuxt/builds/meta/1d193254-809f-48d8-bf27-3640edb58f54.json +0 -1
  121. package/.output/public/_nuxt/entry.6CUQ3EoD.css +0 -2
  122. package/.output/public/_nuxt/entry.6CUQ3EoD.css.br +0 -0
  123. package/.output/public/_nuxt/entry.6CUQ3EoD.css.gz +0 -0
  124. package/.output/public/_nuxt/lBx2yXX9.js.br +0 -0
  125. package/.output/public/_nuxt/lBx2yXX9.js.gz +0 -0
  126. package/.output/public/_nuxt/xSo3mAHb.js.br +0 -0
  127. package/.output/public/_nuxt/xSo3mAHb.js.gz +0 -0
@@ -1,33 +1,33 @@
1
- import{t as e}from"./hePW80VL.js";import{$ as t,A as n,An as r,At as i,B as a,Bn as o,Dn as s,Dt as c,Et as l,Fn as u,Ft as d,Hn as f,Jt as p,M as m,Mn as h,N as g,Ot as _,P as v,Pt as y,Qt as b,R as x,Rn as S,Rt as C,St as w,U as T,V as E,Yt as D,Zt as O,b as k,ct as A,fr as j,gr as M,hr as N,ht as P,in as F,j as I,ln as L,mr as R,mt as z,nn as B,pt as V,sn as H,vt as U,w as ee,wn as W,z as te,zn as G}from"./C25ROUa9.js";import{_t as ne,dt as K,ht as re,vt as q}from"./CDWjMk9C.js";import{$t as ie,A as ae,C as oe,Cn as se,Dn as ce,Ft as le,Gn as ue,Gt as de,Ht as fe,In as pe,J as me,Jt as he,Kt as ge,M as _e,Mn as ve,Mt as ye,On as be,Ot as xe,Q as Se,Qt as Ce,S as we,Sn as Te,Tn as Ee,Ut as De,Vr as Oe,Wt as ke,Xt as Ae,Y as je,Yt as Me,Zt as Ne,_ as Pe,a as Fe,ai as Ie,an as Le,b as Re,bt as ze,cn as Be,ct as Ve,dr as He,en as Ue,et as We,fi as Ge,ft as Ke,gi as qe,h as Je,hi as Ye,hn as Xe,i as Ze,in as Qe,jt as $e,k as et,kn as tt,ln as nt,lt as rt,mi as it,mn as at,mt as ot,n as st,ni as ct,o as lt,oi as ut,on as dt,p as ft,pi as pt,pn as mt,pt as ht,q as gt,qt as _t,ri as vt,rn as yt,rr as bt,s as xt,si as St,sn as Ct,sr as wt,st as Tt,tn as J,u as Et,ui as Dt,un as Ot,ut as kt,vn as At,w as jt,wn as Mt,wt as Nt,x as Pt,xn as Ft,yt as It,zn as Lt}from"./XlRX1U8d.js";import{f as Rt,m as zt,p as Bt,u as Vt}from"./CXJnLmWv.js";import{$ as Ht,A as Ut,C as Wt,D as Gt,E as Kt,F as qt,I as Jt,M as Yt,N as Xt,P as Zt,Q as Qt,R as $t,St as en,T as tn,X as nn,Y as rn,Z as an,_ as on,_t as sn,a as cn,at as ln,bt as un,c as dn,ct as fn,d as pn,dt as mn,et as hn,f as gn,ft as _n,g as vn,gt as yn,h as bn,ht as xn,i as Sn,it as Cn,j as wn,k as Tn,l as En,lt as Dn,mt as On,n as kn,nt as An,o as jn,ot as Mn,p as Nn,pt as Pn,r as Fn,rt as In,s as Ln,st as Rn,tt as zn,u as Bn,ut as Y,v as Vn,vt as Hn,w as Un,x as Wn,xt as Gn,y as Kn,yt as qn}from"./DNAl4698.js";import{c as Jn}from"./DZGKxROq.js";import{$t as Yn,At as Xn,B as Zn,Br as Qn,Bt as $n,Cr as er,Ct as tr,D as nr,Dt as rr,E as ir,En as ar,Fr as or,Ft as sr,G as cr,Gr as lr,Gt as ur,Hr as X,Ht as dr,Ir as fr,It as pr,J as mr,Jr as hr,K as gr,Kt as _r,Lr as vr,Lt as yr,M as br,Mn as xr,Mt as Sr,Nt as Cr,O as wr,Oi as Tr,Pt as Er,Q as Dr,Qt as Or,R as kr,Rr as Ar,Rt as jr,S as Mr,Sr as Nr,St as Pr,T as Fr,Ur as Ir,Ut as Lr,V as Rr,Vt as zr,Wr as Br,Wt as Vr,X as Hr,Xn as Ur,Xr as Wr,Xt as Gr,Y as Kr,Z as qr,Zr as Jr,Zt as Yr,_i as Xr,at as Zr,b as Qr,bi as $r,bt as ei,cr as ti,di as ni,dr as ri,dt as ii,en as ai,et as oi,f as si,fi as ci,gi as li,gr as ui,hi as di,i as fi,ii as Z,ir as pi,it as mi,jt as hi,kt as gi,l as _i,li as vi,lt as yi,mr as bi,n as xi,nt as Si,oi as Ci,pi as wi,pr as Ti,qr as Ei,ri as Q,rr as Di,st as Oi,tn as ki,ui as Ai,v as ji,vi as Mi,vr as Ni,vt as Pi,wn as Fi,xr as Ii,xt as $,y as Li,yi as Ri,zr as zi,zt as Bi}from"./DclfLrr5.js";import{a as Vi,c as Hi,d as Ui,i as Wi,l as Gi,n as Ki,o as qi,s as Ji,t as Yi,u as Xi}from"./lBx2yXX9.js";import{t as Zi}from"./BDNMzG2s.js";var[Qi,$i]=xe(`CollapsibleRoot`),ea=T({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=ot(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=G(r);return $i({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Se(),(e,t)=>(_(),m(f(gt),{as:e.as,"as-child":r.asChild,"data-state":f(i)?`open`:`closed`,"data-disabled":f(a)?``:void 0},{default:H(()=>[d(e.$slots,`default`,{open:f(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),ta=T({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let r=e,i=t,a=Qi();a.contentId||=je(void 0,`reka-collapsible-content`);let o=h(),{forwardRef:s,currentElement:c}=Se(),l=h(0),u=h(0),p=n(()=>a.open.value),v=h(p.value),y=h();B(()=>[p.value,o.value?.present],async()=>{await P();let e=c.value;if(!e)return;y.value=y.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();u.value=t.height,l.value=t.width,v.value||(e.style.transitionDuration=y.value.transitionDuration,e.style.animationName=y.value.animationName)},{immediate:!0});let b=n(()=>v.value&&a.open.value);return w(()=>{requestAnimationFrame(()=>{v.value=!1})}),Ve(c,`beforematch`,e=>{requestAnimationFrame(()=>{a.onOpenToggle(),i(`contentFound`)})}),(e,t)=>(_(),m(f(me),{ref_key:`presentRef`,ref:o,present:e.forceMount||f(a).open.value,"force-mount":!0},{default:H(({present:t})=>[E(f(gt),z(e.$attrs,{id:f(a).contentId,ref:f(s),"as-child":r.asChild,as:e.as,hidden:t?void 0:f(a).unmountOnHide.value?``:`until-found`,"data-state":b.value?void 0:f(a).open.value?`open`:`closed`,"data-disabled":f(a).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${u.value}px`,"--reka-collapsible-content-width":`${l.value}px`}}),{default:H(()=>[!f(a).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),na=T({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Se();let n=Qi();return(e,r)=>(_(),m(f(gt),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":f(n).contentId,"aria-expanded":f(n).open.value,"data-state":f(n).open.value?`open`:`closed`,"data-disabled":f(n).disabled?.value?``:void 0,disabled:f(n).disabled?.value,onClick:f(n).onOpenToggle},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}}),[ra,ia]=xe(`TabsRoot`),aa=T({__name:`TabsRoot`,props:{defaultValue:{type:null,required:!1},orientation:{type:String,required:!1,default:`horizontal`},dir:{type:String,required:!1},activationMode:{type:String,required:!1,default:`automatic`},modelValue:{type:null,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{orientation:i,unmountOnHide:a,dir:o}=G(n),s=We(o);Se();let c=ot(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),l=h(),p=u(new Set);return ia({modelValue:c,changeModelValue:e=>{c.value=e},orientation:i,dir:s,unmountOnHide:a,activationMode:n.activationMode,baseId:je(void 0,`reka-tabs`),tabsList:l,contentIds:p,registerContent:e=>{p.value=new Set([...p.value,e])},unregisterContent:e=>{let t=new Set(p.value);t.delete(e),p.value=t}}),(e,t)=>(_(),m(f(gt),{dir:f(s),"data-orientation":f(i),"as-child":e.asChild,as:e.as},{default:H(()=>[d(e.$slots,`default`,{modelValue:f(c)})]),_:3},8,[`dir`,`data-orientation`,`as-child`,`as`]))}});function oa(e,t){return`${e}-trigger-${t}`}function sa(e,t){return`${e}-content-${t}`}var ca=T({__name:`TabsContent`,props:{value:{type:[String,Number],required:!0},forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{forwardRef:r}=Se(),i=ra(),a=n(()=>oa(i.baseId,t.value)),o=n(()=>sa(i.baseId,t.value)),s=n(()=>t.value===i.modelValue.value),c=h(s.value);return w(()=>{i.registerContent(t.value),requestAnimationFrame(()=>{c.value=!1})}),U(()=>{i.unregisterContent(t.value)}),(e,t)=>(_(),m(f(me),{present:e.forceMount||s.value,"force-mount":``},{default:H(({present:t})=>[E(f(gt),{id:o.value,ref:f(r),"as-child":e.asChild,as:e.as,role:`tabpanel`,"data-state":s.value?`active`:`inactive`,"data-orientation":f(i).orientation.value,"aria-labelledby":a.value,hidden:!t,tabindex:`0`,style:N({animationDuration:c.value?`0s`:void 0})},{default:H(()=>[!f(i).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1032,[`id`,`as-child`,`as`,`data-state`,`data-orientation`,`aria-labelledby`,`hidden`,`style`])]),_:3},8,[`present`]))}}),la=T({__name:`TabsIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:t}){let r=e,i=ra();t({updateIndicatorStyle:c}),Se();let a=rt(),o=h({size:null,thickness:null,position:null}),s=h([]);B(()=>[i.modelValue.value,i?.dir.value],()=>{c()},{immediate:!0,flush:`post`}),F(()=>{s.value=Array.from(i.tabsList.value?.querySelectorAll(`[role="tab"]`)||[])}),Ke(n(()=>[i.tabsList.value,...s.value]),c);function c(){let e=i.tabsList.value?.querySelector(`[role="tab"][data-state="active"]`);e&&(i.orientation.value===`horizontal`?o.value={size:e.offsetWidth,thickness:e.offsetHeight,position:e.offsetLeft}:o.value={size:e.offsetHeight,thickness:e.offsetWidth,position:e.offsetTop})}return(e,t)=>f(a)&&typeof o.value.size==`number`?(_(),m(f(gt),z({key:0},r,{style:{"--reka-tabs-indicator-size":`${o.value.size}px`,"--reka-tabs-indicator-thickness":`${o.value.thickness}px`,"--reka-tabs-indicator-position":`${o.value.position}px`}}),{default:H(()=>[d(e.$slots,`default`)]),_:3},16,[`style`])):g(`v-if`,!0)}}),ua=T({__name:`TabsList`,props:{loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let{loop:t}=G(e),{forwardRef:n,currentElement:r}=Se(),i=ra();return i.tabsList=r,(e,r)=>(_(),m(f(_e),{"as-child":``,orientation:f(i).orientation.value,dir:f(i).dir.value,loop:f(t)},{default:H(()=>[E(f(gt),{ref:f(n),role:`tablist`,"as-child":e.asChild,as:e.as,"aria-orientation":f(i).orientation.value},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`aria-orientation`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),da=T({__name:`TabsTrigger`,props:{value:{type:[String,Number],required:!0},disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,{forwardRef:r}=Se(),i=ra(),a=n(()=>oa(i.baseId,t.value)),o=n(()=>i.contentIds.value.has(t.value)?sa(i.baseId,t.value):void 0),s=n(()=>t.value===i.modelValue.value);return(e,t)=>(_(),m(f(Ui),{"as-child":``,focusable:!e.disabled,active:s.value},{default:H(()=>[E(f(gt),{id:a.value,ref:f(r),role:`tab`,type:e.as===`button`?`button`:void 0,as:e.as,"as-child":e.asChild,"aria-selected":s.value?`true`:`false`,"aria-controls":o.value,"data-state":s.value?`active`:`inactive`,disabled:e.disabled,"data-disabled":e.disabled?``:void 0,"data-orientation":f(i).orientation.value,onMousedown:t[0]||=q(t=>{!e.disabled&&t.ctrlKey===!1?f(i).changeModelValue(e.value):t.preventDefault()},[`left`]),onKeydown:t[1]||=ne(t=>f(i).changeModelValue(e.value),[`enter`,`space`]),onFocus:t[2]||=()=>{let t=f(i).activationMode!==`manual`;!s.value&&!e.disabled&&t&&f(i).changeModelValue(e.value)}},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`id`,`type`,`as`,`as-child`,`aria-selected`,`aria-controls`,`data-state`,`disabled`,`data-disabled`,`data-orientation`])]),_:3},8,[`focusable`,`active`]))}}),fa=[`aria-label`],pa=[`title`,`data-tab`,`aria-current`,`onPointerdown`,`onClick`],ma={key:1,class:`tab-chip-dot`},ha={class:`tab-chip-label`},ga=[`title`,`aria-label`,`disabled`],_a=Object.assign(T({__name:`SpaceTabs`,props:{workspace:{},current:{}},setup(e){let t=e,r=n(()=>Ge(t.workspace).map(e=>{let t=xr(e.panes);return{...e,label:e.tab.label||String(e.tab.number),tone:t&&t.agent?J(t):``,title:e.panes.map(e=>Ei(e)).join(` · `)}}));B(()=>t.current,e=>{e&&St(e)},{immediate:!0});let i=e=>`${Q(`Tab`)} ${e}`,a=null,o=Gt({onPress:()=>{a&&(X(),Te(ue(a.id),i(a.label)))}});function s(e,t,n){ii.value&&(a={id:t,label:n},o.down(e))}function c(e){o.swallowClick()||e===t.current||it(e)}return(t,n)=>{let i=wn,a=Zt,l=Je;return(`spaceTabControls`in t?t.spaceTabControls:f(Or))(f(r).length).row?(_(),v(`nav`,{key:0,class:`tab-chips space-tabs`,"aria-label":(`t`in t?t.t:f(Q))(`Tabs`)},[(_(!0),v(k,null,y(f(r),r=>(_(),m(a,{key:r.tab.id,disabled:`sheetMenus`in t?t.sheetMenus:f(ii),items:(`sheetMenus`in t?t.sheetMenus:f(ii))?[]:(`toDropdown`in t?t.toDropdown:f(ce))((`tabItems`in t?t.tabItems:f(ue))(r.tab.id)),ui:{content:`hw-dropdown`}},{default:H(()=>[I(`button`,{type:`button`,class:j([`tab-chip`,r.tone]),title:r.title,"data-tab":r.tab.id,"aria-current":r.tab.id===e.current?`page`:void 0,onPointerdown:e=>s(e,r.tab.id,r.label),onPointermove:n[0]||=(...e)=>f(o).move&&f(o).move(...e),onPointerup:n[1]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onPointercancel:n[2]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onContextmenu:n[3]||=e=>(`sheetMenus`in t?t.sheetMenus:f(ii))&&e.preventDefault(),onClick:e=>c(r.tab.id)},[r.panes.length>1?(_(),m(i,{key:0,layout:r.layout,panes:r.panes},null,8,[`layout`,`panes`])):(_(),v(`i`,ma)),I(`span`,ha,M(r.label),1)],42,pa)]),_:2},1032,[`disabled`,`items`]))),128)),I(`button`,{type:`button`,class:`tab-chip tab-add`,title:(`t`in t?t.t:f(Q))(`New tab`),"aria-label":(`t`in t?t.t:f(Q))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(mr),onClick:n[4]||=n=>(`newTab`in t?t.newTab:f(pe))(e.workspace)},[E(l,{name:`i-lucide-plus`})],8,ga)],8,fa)):g(``,!0)}}}),{__name:`SpaceTabs`}),va={slots:{base:`font-medium inline-flex items-center`,label:`truncate`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailingIcon:`shrink-0`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{solid:``,outline:``,soft:``,subtle:``},size:{xs:{base:`text-[8px]/3 px-1 py-0.5 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},sm:{base:`text-[10px]/3 px-1.5 py-1 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},md:{base:`text-xs px-2 py-1 gap-1 rounded-md`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`},lg:{base:`text-sm px-2 py-1 gap-1.5 rounded-md`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`},xl:{base:`text-base px-2.5 py-1 gap-1.5 rounded-md`,leadingIcon:`size-6`,leadingAvatarSize:`2xs`,trailingIcon:`size-6`}},square:{true:``}},compoundVariants:[{color:`primary`,variant:`solid`,class:`bg-primary text-inverted`},{color:`neutral`,variant:`solid`,class:`bg-neutral text-inverted`},{color:`success`,variant:`solid`,class:`bg-success text-inverted`},{color:`warning`,variant:`solid`,class:`bg-warning text-inverted`},{color:`error`,variant:`solid`,class:`bg-error text-inverted`},{color:`info`,variant:`solid`,class:`bg-info text-inverted`},{color:`primary`,variant:`outline`,class:`text-primary ring ring-inset ring-primary/50`},{color:`neutral`,variant:`outline`,class:`text-neutral ring ring-inset ring-neutral/50`},{color:`success`,variant:`outline`,class:`text-success ring ring-inset ring-success/50`},{color:`warning`,variant:`outline`,class:`text-warning ring ring-inset ring-warning/50`},{color:`error`,variant:`outline`,class:`text-error ring ring-inset ring-error/50`},{color:`info`,variant:`outline`,class:`text-info ring ring-inset ring-info/50`},{color:`primary`,variant:`soft`,class:`bg-primary/10 text-primary`},{color:`neutral`,variant:`soft`,class:`bg-neutral/10 text-neutral`},{color:`success`,variant:`soft`,class:`bg-success/10 text-success`},{color:`warning`,variant:`soft`,class:`bg-warning/10 text-warning`},{color:`error`,variant:`soft`,class:`bg-error/10 text-error`},{color:`info`,variant:`soft`,class:`bg-info/10 text-info`},{color:`primary`,variant:`subtle`,class:`bg-primary/10 text-primary ring ring-inset ring-primary/25`},{color:`neutral`,variant:`subtle`,class:`bg-neutral/10 text-neutral ring ring-inset ring-neutral/25`},{color:`success`,variant:`subtle`,class:`bg-success/10 text-success ring ring-inset ring-success/25`},{color:`warning`,variant:`subtle`,class:`bg-warning/10 text-warning ring ring-inset ring-warning/25`},{color:`error`,variant:`subtle`,class:`bg-error/10 text-error ring ring-inset ring-error/25`},{color:`info`,variant:`subtle`,class:`bg-info/10 text-info ring ring-inset ring-info/25`},{color:`neutral`,variant:`solid`,class:`text-inverted bg-inverted`},{color:`neutral`,variant:`outline`,class:`ring ring-inset ring-accented text-default bg-default`},{color:`neutral`,variant:`soft`,class:`text-default bg-elevated`},{color:`neutral`,variant:`subtle`,class:`ring ring-inset ring-accented text-default bg-elevated`},{size:`xs`,square:!0,class:`p-0.5`},{size:`sm`,square:!0,class:`p-1`},{size:`md`,square:!0,class:`p-1`},{size:`lg`,square:!0,class:`p-1`},{size:`xl`,square:!0,class:`p-1`}],defaultVariants:{color:`primary`,variant:`solid`,size:`md`}},ya={__name:`UBadge`,props:{as:{type:null,required:!1,default:`span`},label:{type:[String,Number],required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1}},setup(e){let t=e,r=O(),i=oe(`badge`,t),a=Jn(),{orientation:o,size:s}=Re(t),{isLeading:c,isTrailing:l,leadingIconName:u,trailingIconName:p}=Pt(i),h=n(()=>Pe({extend:va,...a.ui?.badge||{}})({color:i.color,variant:i.variant,size:s.value??i.size,square:i.square||!r.default&&!i.label,fieldGroup:o.value}));return(e,t)=>(_(),m(f(gt),{as:f(i).as,"data-slot":`base`,class:j(h.value.base({class:[f(i).ui?.base,f(i).class]}))},{default:H(()=>[d(e.$slots,`leading`,{ui:h.value},()=>[f(c)&&f(u)?(_(),m(Je,{key:0,name:f(u),"data-slot":`leadingIcon`,class:j(h.value.leadingIcon({class:f(i).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(i).avatar?(_(),m(ft,z({key:1,size:f(i).ui?.leadingAvatarSize||h.value.leadingAvatarSize()},f(i).avatar,{"data-slot":`leadingAvatar`,class:h.value.leadingAvatar({class:f(i).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)]),d(e.$slots,`default`,{ui:h.value},()=>[f(i).label!==void 0&&f(i).label!==null?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(h.value.label({class:f(i).ui?.label}))},M(f(i).label),3)):g(``,!0)]),d(e.$slots,`trailing`,{ui:h.value},()=>[f(l)&&f(p)?(_(),m(Je,{key:0,name:f(p),"data-slot":`trailingIcon`,class:j(h.value.trailingIcon({class:f(i).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)])]),_:3},8,[`as`,`class`]))}},ba={slots:{root:`flex items-center gap-2`,list:`relative flex p-1 group`,indicator:`absolute transition-[translate,width] duration-200 ease-out motion-reduce:transition-none`,trigger:[`group relative inline-flex items-center min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75`,`transition-colors`],leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,label:`truncate`,trailingBadge:`shrink-0`,trailingBadgeSize:`sm`,content:`w-full rounded-md focus-visible:outline-3`},variants:{color:{primary:{content:`outline-primary/25`},neutral:{content:`outline-inverted/25`},success:{content:`outline-success/25`},warning:{content:`outline-warning/25`},error:{content:`outline-error/25`},info:{content:`outline-info/25`}},variant:{pill:{list:`bg-elevated rounded-lg`,trigger:[`grow`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:inset-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:rounded-md in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:shadow-xs in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:-z-10 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:isolate`],indicator:`rounded-md shadow-xs`},link:{list:`border-default`,indicator:`rounded-full`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:rounded-full`}},orientation:{horizontal:{root:`flex-col`,list:`w-full`,indicator:`left-0 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position)`,trigger:`justify-center`},vertical:{list:`flex-col`,indicator:`top-0 h-(--reka-tabs-indicator-size) translate-y-(--reka-tabs-indicator-position)`}},size:{xs:{trigger:`px-2 py-1 text-xs gap-1`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},sm:{trigger:`px-2.5 py-1.5 text-xs gap-1.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},md:{trigger:`px-3 py-1.5 text-sm gap-1.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},lg:{trigger:`px-3 py-2 text-sm gap-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},xl:{trigger:`px-3 py-2 text-base gap-2`,leadingIcon:`size-6`,leadingAvatarSize:`xs`}}},compoundVariants:[{orientation:`horizontal`,variant:`pill`,class:{indicator:`inset-y-1`}},{orientation:`horizontal`,variant:`link`,class:{list:`border-b -mb-px`,indicator:`-bottom-px h-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-x-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-bottom-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:h-px`}},{orientation:`vertical`,variant:`pill`,class:{indicator:`inset-x-1`,list:`items-center`,trigger:`w-full justify-center`}},{orientation:`vertical`,variant:`link`,class:{list:`border-s -ms-px`,indicator:`-start-px w-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-y-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-start-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:w-px`}},{color:`primary`,variant:`pill`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-inverted outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-primary`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-inverted outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-neutral`]}},{color:`success`,variant:`pill`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-inverted outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-success`]}},{color:`warning`,variant:`pill`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-inverted outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-warning`]}},{color:`error`,variant:`pill`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-inverted outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-error`]}},{color:`info`,variant:`pill`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-inverted outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-info`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-inverted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-inverted`]}},{color:`primary`,variant:`link`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-primary outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-primary`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-neutral outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-neutral`]}},{color:`success`,variant:`link`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-success outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-success`]}},{color:`warning`,variant:`link`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-warning outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-warning`]}},{color:`error`,variant:`link`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-error outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-error`]}},{color:`info`,variant:`link`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-info outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-info`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-highlighted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-inverted`]}}],defaultVariants:{color:`primary`,variant:`pill`,size:`md`}},xa={__name:`UTabs`,props:{as:{type:null,required:!1},items:{type:Array,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:`horizontal`},content:{type:Boolean,required:!1,default:!0},valueKey:{type:null,required:!1,default:`value`},labelKey:{type:null,required:!1,default:`label`},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultValue:{type:[String,Number],required:!1,default:`0`},modelValue:{type:[String,Number],required:!1},activationMode:{type:String,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,o=r,s=O(),c=oe(`tabs`,i),l=Jn(),u=we(ze(c,`as`,`unmountOnHide`),o),p=n(()=>Pe({extend:ba,...l.ui?.tabs||{}})({color:c.color,variant:c.variant,size:c.size,orientation:c.orientation})),b=h([]);function x(e,t){b.value[e]=t}return t({triggersRef:b}),(e,t)=>(_(),m(f(aa),z(f(u),{"model-value":f(c).modelValue,"default-value":f(c).defaultValue,orientation:f(c).orientation,"activation-mode":f(c).activationMode,"data-slot":`root`,class:p.value.root({class:[f(c).ui?.root,f(c).class]})}),{default:H(()=>[E(f(ua),{"data-slot":`list`,class:j(p.value.list({class:f(c).ui?.list}))},{default:H(()=>[E(f(la),{"data-slot":`indicator`,class:j(p.value.indicator({class:f(c).ui?.indicator}))},null,8,[`class`]),d(e.$slots,`list-leading`),(_(!0),v(k,null,y(f(c).items,(t,n)=>(_(),m(f(da),{key:f(jt)(t,f(c).valueKey)??n,ref_for:!0,ref:e=>x(n,e),value:f(jt)(t,f(c).valueKey)??String(n),disabled:t.disabled,"data-slot":`trigger`,class:j(p.value.trigger({class:[f(c).ui?.trigger,t.ui?.trigger]}))},{default:H(()=>[d(e.$slots,`leading`,{item:t,index:n,ui:p.value},()=>[t.icon?(_(),m(Je,{key:0,name:t.icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:[f(c).ui?.leadingIcon,t.ui?.leadingIcon]}))},null,8,[`name`,`class`])):t.avatar?(_(),m(ft,z({key:1,size:t.ui?.leadingAvatarSize||f(c).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},{ref_for:!0},t.avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:[f(c).ui?.leadingAvatar,t.ui?.leadingAvatar]})}),null,16,[`size`,`class`])):g(``,!0)]),f(jt)(t,f(c).labelKey)||s.default?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(p.value.label({class:[f(c).ui?.label,t.ui?.label]}))},[d(e.$slots,`default`,{item:t,index:n},()=>[a(M(f(jt)(t,f(c).labelKey)),1)])],2)):g(``,!0),d(e.$slots,`trailing`,{item:t,index:n,ui:p.value},()=>[t.badge||t.badge===0?(_(),m(ya,z({key:0,color:`neutral`,variant:`outline`,size:t.ui?.trailingBadgeSize||f(c).ui?.trailingBadgeSize||p.value.trailingBadgeSize()},{ref_for:!0},typeof t.badge==`string`||typeof t.badge==`number`?{label:t.badge}:t.badge,{"data-slot":`trailingBadge`,class:p.value.trailingBadge({class:[f(c).ui?.trailingBadge,t.ui?.trailingBadge]})}),null,16,[`size`,`class`])):g(``,!0)])]),_:2},1032,[`value`,`disabled`,`class`]))),128)),d(e.$slots,`list-trailing`)]),_:3},8,[`class`]),f(c).content?(_(!0),v(k,{key:0},y(f(c).items,(t,n)=>(_(),m(f(ca),{key:f(jt)(t,f(c).valueKey)??n,value:f(jt)(t,f(c).valueKey)??String(n),"data-slot":`content`,class:j(p.value.content({class:[f(c).ui?.content,t.ui?.content,t.class]}))},{default:H(()=>[d(e.$slots,t.slot||`content`,{item:t,index:n,ui:p.value},()=>[a(M(t.content),1)])]),_:2},1032,[`value`,`class`]))),128)):g(``,!0)]),_:3},16,[`model-value`,`default-value`,`orientation`,`activation-mode`,`class`]))}},Sa=`input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .term, .chat-list, .msg`,Ca=`button, a, [role="tab"], [role="button"]:not(.plan-cell), .cell-grip, ${Sa}`;function wa(e){return!!e?.closest?.(Sa)}function Ta(e){return!!e?.closest?.(Ca)}var Ea=Object.assign(Zi(T({__name:`HeaderMenu`,props:{items:{type:Function},title:{},disabled:{type:Boolean},manualPress:{type:Boolean}},setup(e){let t=e,n=h([]);function r(){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0}))}function i(e){e?(n.value=ce(t.items()),window.addEventListener(`scroll`,r,{capture:!0,passive:!0})):window.removeEventListener(`scroll`,r,{capture:!0})}l(()=>window.removeEventListener(`scroll`,r,{capture:!0}));let a=``;function o(e){wa(e.target)?e.stopPropagation():ii.value&&(e.preventDefault(),a===`mouse`&&!t.disabled&&Te(t.items(),t.title))}let s=Gt({onPress:()=>{X(),Te(t.items(),t.title)}});function c(e){a=e.pointerType,!(!ii.value||t.disabled||t.manualPress||Ta(e.target))&&s.down(e)}return(t,r)=>{let a=Zt;return _(),m(a,{disabled:(`sheetMenus`in t?t.sheetMenus:f(ii))||e.disabled,items:f(n),ui:{content:`hw-dropdown`},"onUpdate:open":i},{default:H(()=>[I(`div`,{class:`header-menu`,onContextmenuCapture:o,onPointerdown:c,onPointermove:r[0]||=(...e)=>f(s).move&&f(s).move(...e),onPointerup:r[1]||=(...e)=>f(s).cancel&&f(s).cancel(...e),onPointercancel:r[2]||=(...e)=>f(s).cancel&&f(s).cancel(...e)},[d(t.$slots,`default`,{},void 0,!0)],32)]),_:3},8,[`disabled`,`items`])}}}),[[`__scopeId`,`data-v-562a5bfa`]]),{__name:`HeaderMenu`}),Da=Object.assign(Zi(T({__name:`GridBackdrop`,setup(e){let t=h(null),n=h(null),r=h(!1),i,a=!1,o=0,s;function c(){let e=n.value;if(!e||o>=3)return;let t=De(e.clientWidth,e.clientHeight),r=document.createElement(`i`);r.className=`pkt ${t.vertical?`v`:`h`}${t.reverse?` rev`:``}${t.alt?` alt`:``}`,r.style.left=`${t.left}px`,r.style.top=`${t.top}px`;let i=t.vertical?`Y`:`X`;e.appendChild(r),o++;let a=r.animate([{transform:`translate${i}(${t.reverse?t.dist:0}px)`,opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.7},{transform:`translate${i}(${t.reverse?0:t.dist}px)`,opacity:0}],{duration:t.duration,easing:`cubic-bezier(.4, 0, .6, 1)`});a.onfinish=()=>{r.remove(),o--}}function l(){clearTimeout(s),!a&&ye.value&&r.value&&!document.hidden&&(s=setTimeout(()=>{c(),l()},fe()))}return B([r,ye],l),w(()=>{a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,document.addEventListener(`visibilitychange`,l),t.value&&(i=new IntersectionObserver(([e])=>{r.value=!!e?.isIntersecting}),i.observe(t.value))}),U(()=>{i?.disconnect(),document.removeEventListener(`visibilitychange`,l),clearTimeout(s)}),(e,r)=>(_(),v(`div`,{ref_key:`root`,ref:t,class:`grid-backdrop`,"aria-hidden":`true`},[r[0]||=I(`div`,{class:`gbd-dots`},null,-1),I(`div`,{ref_key:`packets`,ref:n,class:`gbd-packets`},null,512),r[1]||=I(`div`,{class:`gbd-vignette`},null,-1)],512))}}),[[`__scopeId`,`data-v-a290ab6b`]]),{__name:`GridBackdrop`}),Oa={class:`chat-skel`,"aria-hidden":`true`},ka=Object.assign(T({__name:`ChatSkeleton`,props:{agent:{}},setup(e){return(t,n)=>(_(),v(`div`,Oa,[n[0]||=I(`div`,{class:`skel-user`},[I(`i`,{style:{width:`78%`}}),I(`i`,{style:{width:`52%`}})],-1),I(`div`,{class:j([`skel-who`,e.agent||``])},null,2),n[1]||=te(`<div class="skel-tool"><span></span><i style="width:62%;"></i></div><div class="skel-lines"><i style="width:92%;"></i><i style="width:84%;"></i><i style="width:66%;"></i></div><div class="skel-user"><i style="width:64%;"></i></div>`,3),I(`div`,{class:j([`skel-who`,e.agent||``])},null,2),n[2]||=te(`<div class="skel-lines"><i style="width:90%;"></i><i style="width:86%;"></i><i style="width:80%;"></i><i style="width:42%;"></i></div>`,1)]))}}),{__name:`ChatSkeleton`}),Aa=[`aria-expanded`],ja=Object.assign(T({__name:`FoldText`,props:{lines:{}},setup(e){let t=e,r=n(()=>t.lines||12),i=h(null),a=h(!1),o=h(!1),s=null;function l(){let e=i.value;if(!e)return;let t=(Number.parseFloat(getComputedStyle(e).lineHeight)||22.5)*(r.value+.5);a.value=e.scrollHeight>t}return w(()=>{l(),s=new ResizeObserver(l),i.value&&s.observe(i.value)}),c(l),U(()=>s?.disconnect()),(e,n)=>(_(),v(k,null,[I(`span`,{ref_key:`box`,ref:i,class:j([`msg-fold`,{folded:f(a)&&!f(o)}]),style:N({display:`block`,"--fold-max":t.lines?`calc(${t.lines}lh)`:void 0})},[d(e.$slots,`default`)],6),f(a)?(_(),v(`button`,{key:0,type:`button`,class:`msg-fold-btn`,"aria-expanded":f(o),onClick:n[0]||=e=>o.value=!f(o)},M(f(o)?(`tl`in e?e.tl:f(Z))(`Show less`,`Afficher moins`):(`tl`in e?e.tl:f(Z))(`Show more`,`Afficher plus`)),9,Aa)):g(``,!0)],64))}}),{__name:`FoldText`}),Ma={key:0,class:`offline-image`},Na=[`src`,`onClick`],Pa=[`aria-label`],Fa=[`src`],Ia=[`disabled`,`onClick`],La=Object.assign(T({__name:`MsgThumbs`,props:{srcs:{},offline:{type:Boolean},max:{},dupes:{}},setup(e){let t=e,r=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>!t.dupes?.has(e.src))),i=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>t.dupes?.has(e.src))),a=n(()=>bn(r.value.length,t.max));function o(e){Ft(t.srcs,e)}return(t,n)=>(_(),v(`span`,{class:j([`thumbs`,{one:f(r).length===1}])},[(_(!0),v(k,null,y(f(r).slice(0,f(a).shown),n=>(_(),v(`span`,{key:n.src},[e.offline?(_(),v(`span`,Ma,M((`t`in t?t.t:f(Q))(`Image unavailable offline`)),1)):(_(),v(`img`,{key:1,class:`msg-img`,src:n.src,alt:``,loading:`lazy`,decoding:`async`,onClick:e=>o(n.i)},null,8,Na))]))),128)),f(a).more?(_(),v(`button`,{key:0,type:`button`,class:`thumb-more`,"aria-label":(`tl`in t?t.tl:f(Z))(`Show all ${f(r).length} images`,`Voir les ${f(r).length} images`),onClick:n[0]||=e=>o(f(r)[f(a).shown].i)},[e.offline?g(``,!0):(_(),v(`img`,{key:0,src:f(r)[f(a).shown].src,alt:``,loading:`lazy`,decoding:`async`},null,8,Fa)),I(`span`,null,`+`+M(f(a).more),1)],8,Pa)):g(``,!0),(_(!0),v(k,null,y(f(i),n=>(_(),v(`button`,{key:n.src,type:`button`,class:`thumb-dupe`,disabled:e.offline,onClick:e=>o(n.i)},` ↑ `+M((`tl`in t?t.tl:f(Z))(`Same image as above`,`Image déjà affichée plus haut`)),9,Ia))),128))],2))}}),{__name:`MsgThumbs`}),Ra={class:`file-chip-icon`},za={key:0,class:`spinner`},Ba={class:`file-chip-body`},Va={class:`file-chip-name`},Ha={class:`file-chip-meta`},Ua=[`aria-label`],Wa=Object.assign(T({__name:`FileChip`,props:{name:{},size:{},kind:{},uploading:{type:Boolean},removable:{type:Boolean},clickable:{type:Boolean}},emits:[`remove`,`open`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>Qt(r.name,r.kind)),o=n(()=>Ht(r.name).slice(0,6)||(r.kind===`text`?`txt`:``));function s(e){r.clickable&&i(`open`,e.currentTarget)}return(t,n)=>{let r=Je;return _(),m(C(e.clickable?`button`:`div`),{type:e.clickable?`button`:void 0,class:j([`file-chip`,{up:e.uploading,clickable:e.clickable}]),title:e.name,onClick:s},{default:H(()=>[I(`span`,Ra,[e.uploading?(_(),v(`span`,za)):(_(),m(r,{key:1,name:f(a)},null,8,[`name`]))]),I(`span`,Ba,[I(`span`,Va,M(e.name),1),I(`span`,Ha,M([f(o),e.size?f(hn)(e.size):``].filter(Boolean).join(` · `)),1)]),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`file-chip-x`,"aria-label":(`t`in t?t.t:f(Q))(`Remove`),onClick:n[0]||=q(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,Ua)):g(``,!0)]),_:1},8,[`type`,`class`,`title`])}}}),{__name:`FileChip`}),Ga={key:0,class:`msg-ref-meta`},Ka={class:`msg-ref-text`},qa={key:1,class:`msg-q`},Ja=Object.assign(T({__name:`QuotedText`,props:{text:{}},setup(e){let t=e,r=n(()=>li(t.text).map(e=>e.kind===`ref`?e:{...e,text:e.text.replace(/^\n+|\n+$/g,``)}).filter(e=>e.kind===`ref`||e.text)),i=A(`gotoRef`,null),o=e=>e.kind===`task`?e.label.replace(/\s*:$/,``):[e.time,e.n?`#${e.n}`:``].filter(Boolean).join(` · `);return(e,t)=>(_(!0),v(k,null,y(f(r),(n,r)=>(_(),v(k,{key:r},[n.kind===`ref`?(_(),m(C(f(i)&&n.ref.kind!==`task`?`button`:`span`),{key:0,class:`msg-ref`,"data-kind":n.ref.kind,type:f(i)&&n.ref.kind!==`task`?`button`:void 0,"aria-label":f(i)&&n.ref.kind!==`task`?`${(`t`in e?e.t:f(Q))(`Show original message`)}: ${n.ref.excerpt}`:void 0,onClick:e=>f(i)&&n.ref.kind!==`task`&&f(i)(n.ref,e.currentTarget)},{default:H(()=>[t[0]||=I(`span`,{class:`msg-ref-mark`,"aria-hidden":`true`},`↳`,-1),o(n.ref)?(_(),v(`span`,Ga,M(o(n.ref)),1)):g(``,!0),I(`span`,Ka,M(n.ref.excerpt),1)]),_:2},1032,[`data-kind`,`type`,`aria-label`,`onClick`])):n.kind===`quote`?(_(),v(`span`,qa,M(n.text),1)):(_(),v(k,{key:2},[a(M(n.text),1)],64))],64))),128))}}),{__name:`QuotedText`}),Ya=[`aria-label`],Xa={class:`pasted-head`},Za=[`aria-label`],Qa={class:`pasted-foot`},$a=Object.assign(T({__name:`PastedCard`,props:{text:{},removable:{type:Boolean}},emits:[`remove`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=n(()=>dt(r.text)),c=n(()=>r.text.split(`
2
- `).filter(e=>e.trim()).slice(0,2).map(e=>e.trim())),l=n(()=>Ct(r.text)),u=n(()=>Z(`Pasted text · ${s.value} line${s.value>1?`s`:``}`,`Texte collé · ${s.value} ligne${s.value>1?`s`:``}`));async function d(){try{await navigator.clipboard.writeText(r.text),$(Z(`Text copied`,`Texte copié`))}catch{$(Q(`Copy failed`),!0)}}return(t,n)=>{let r=Je,s=Et,p=Wt;return _(),v(`div`,{class:j([`pasted-card`,{removable:e.removable}])},[I(`button`,{type:`button`,class:`pasted-open`,"aria-label":(`tl`in t?t.tl:f(Z))(`Open pasted text`,`Ouvrir le texte collé`),onClick:n[0]||=e=>o.value=!0},[I(`span`,Xa,[E(r,{name:`i-lucide-clipboard-paste`}),a(M(f(u)),1)]),(_(!0),v(k,null,y(f(c),(e,t)=>(_(),v(`span`,{key:t,class:`pasted-line`},M(e),1))),128))],8,Ya),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`pasted-x`,"aria-label":(`t`in t?t.t:f(Q))(`Remove`),onClick:n[1]||=q(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,Za)):g(``,!0),E(p,{open:f(o),"onUpdate:open":n[2]||=e=>W(o)?o.value=e:null,title:f(u),wide:``,tall:``},{footer:H(()=>[I(`div`,Qa,[E(s,{icon:`i-lucide-copy`,color:`neutral`,variant:`outline`,onClick:d},{default:H(()=>[a(M((`tl`in t?t.tl:f(Z))(`Copy`,`Copier`)),1)]),_:1})])]),default:H(()=>[I(`pre`,{class:j([`pasted-full`,{mono:f(l)}])},M(e.text),3)]),_:1},8,[`open`,`title`])],2)}}}),{__name:`PastedCard`}),eo={key:1,class:`msg-pastes`},to=Object.assign(T({__name:`UserText`,props:{text:{},pasted:{}},setup(e){let t=e,r=n(()=>nt(t.text,t.pasted,Qe.value));return(e,t)=>{let n=Ja,i=ja,a=$a;return _(),v(k,null,[f(r).text?(_(),m(i,{key:0},{default:H(()=>[E(n,{text:f(r).text},null,8,[`text`])]),_:1})):g(``,!0),f(r).pastes.length?(_(),v(`span`,eo,[(_(!0),v(k,null,y(f(r).pastes,(e,t)=>(_(),m(a,{key:t,text:e},null,8,[`text`]))),128))])):g(``,!0)],64)}}}),{__name:`UserText`}),no={slots:{root:`group/message relative w-full`,header:`flex mb-1.5`,container:`relative flex items-start`,body:`min-w-0`,leading:`inline-flex items-center justify-center min-h-6`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,files:`flex items-center gap-1.5`,content:`relative text-pretty wrap-break-word *:first:mt-0 *:last:mb-0`,actions:[`[@media(hover:hover)]:opacity-0 group-hover/message:opacity-100 absolute bottom-0 flex items-center`,`transition-opacity ease-out`]},variants:{variant:{solid:``,outline:``,soft:``,subtle:``,naked:``},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},side:{left:{},right:{container:`justify-end ms-auto max-w-[75%]`,header:`justify-end`,actions:`right-0`}},leading:{true:``},actions:{true:``},compact:{true:{root:`scroll-mt-3`,container:`gap-1.5 pb-3`,content:`space-y-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},false:{root:`scroll-mt-4 sm:scroll-mt-6`,container:`gap-3 pb-8`,content:`space-y-4`,leadingIcon:`size-8`,leadingAvatarSize:`md`}}},compoundVariants:[{compact:!0,actions:!0,class:{container:`pb-8`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!1,class:{content:`px-4 py-3 rounded-lg min-h-12`,leading:`mt-2`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!0,class:{content:`px-2 py-1 rounded-lg min-h-8`,leading:`mt-1`}},{variant:`naked`,side:`left`,class:{body:`w-full`,content:`w-full`}},{color:`primary`,variant:`solid`,class:{content:`bg-primary text-inverted`}},{color:`neutral`,variant:`solid`,class:{content:`bg-neutral text-inverted`}},{color:`success`,variant:`solid`,class:{content:`bg-success text-inverted`}},{color:`warning`,variant:`solid`,class:{content:`bg-warning text-inverted`}},{color:`error`,variant:`solid`,class:{content:`bg-error text-inverted`}},{color:`info`,variant:`solid`,class:{content:`bg-info text-inverted`}},{color:`primary`,variant:`outline`,class:{content:`text-primary ring ring-primary/25`}},{color:`neutral`,variant:`outline`,class:{content:`text-neutral ring ring-neutral/25`}},{color:`success`,variant:`outline`,class:{content:`text-success ring ring-success/25`}},{color:`warning`,variant:`outline`,class:{content:`text-warning ring ring-warning/25`}},{color:`error`,variant:`outline`,class:{content:`text-error ring ring-error/25`}},{color:`info`,variant:`outline`,class:{content:`text-info ring ring-info/25`}},{color:`primary`,variant:`soft`,class:{content:`bg-primary/10 text-primary`}},{color:`neutral`,variant:`soft`,class:{content:`bg-neutral/10 text-neutral`}},{color:`success`,variant:`soft`,class:{content:`bg-success/10 text-success`}},{color:`warning`,variant:`soft`,class:{content:`bg-warning/10 text-warning`}},{color:`error`,variant:`soft`,class:{content:`bg-error/10 text-error`}},{color:`info`,variant:`soft`,class:{content:`bg-info/10 text-info`}},{color:`primary`,variant:`subtle`,class:{content:`bg-primary/10 text-primary ring ring-primary/25`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-neutral/10 text-neutral ring ring-neutral/25`}},{color:`success`,variant:`subtle`,class:{content:`bg-success/10 text-success ring ring-success/25`}},{color:`warning`,variant:`subtle`,class:{content:`bg-warning/10 text-warning ring ring-warning/25`}},{color:`error`,variant:`subtle`,class:{content:`bg-error/10 text-error ring ring-error/25`}},{color:`info`,variant:`subtle`,class:{content:`bg-info/10 text-info ring ring-info/25`}},{color:`primary`,variant:`naked`,class:{content:`text-primary`}},{color:`neutral`,variant:`naked`,class:{content:`text-neutral`}},{color:`success`,variant:`naked`,class:{content:`text-success`}},{color:`warning`,variant:`naked`,class:{content:`text-warning`}},{color:`error`,variant:`naked`,class:{content:`text-error`}},{color:`info`,variant:`naked`,class:{content:`text-info`}},{color:`neutral`,variant:`solid`,class:{content:`bg-inverted text-inverted`}},{color:`neutral`,variant:`outline`,class:{content:`bg-default ring ring-default`}},{color:`neutral`,variant:`soft`,class:{content:`bg-elevated/50`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-elevated/50 ring ring-default`}}],defaultVariants:{side:`left`,variant:`naked`,color:`neutral`}},ro={__name:`UChatMessage`,props:{as:{type:null,required:!1,default:`article`},icon:{type:null,required:!1},avatar:{type:Object,required:!1},variant:{type:null,required:!1},color:{type:null,required:!1},side:{type:null,required:!1},actions:{type:Array,required:!1},compact:{type:Boolean,required:!1},content:{type:String,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},id:{type:String,required:!0},role:{type:String,required:!0},metadata:{type:null,required:!1},parts:{type:Array,required:!0}},setup(e){let r=e,i=O(),o=oe(`chatMessage`,r),s=Jn(),c=n(()=>o.parts?.filter(e=>e.type===`file`)??[]),l=n(()=>o.parts?.filter(e=>e.type===`text`)??[]),u=n(()=>et(o,[`as`,`icon`,`avatar`,`variant`,`color`,`side`,`actions`,`compact`,`class`,`ui`,`content`])),p=n(()=>Pe({extend:no,...s.ui?.chatMessage||{}})({variant:o.variant,color:o.color,side:o.side,leading:!!o.icon||!!o.avatar||!!i.leading,actions:!!o.actions||!!i.actions,compact:o.compact}));return(e,n)=>(_(),m(f(gt),{as:f(o).as,"data-role":f(o).role,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]}))},{default:H(()=>[i.files&&c.value.length||i.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(p.value.header({class:f(o).ui?.header}))},[d(e.$slots,`header`,R(t({...u.value})),()=>[i.files&&c.value.length?(_(),v(`div`,{key:0,"data-slot":`files`,class:j(p.value.files({class:f(o).ui?.files}))},[d(e.$slots,`files`,R(t({...u.value,parts:c.value})))],2)):g(``,!0)])],2)):g(``,!0),I(`div`,{"data-slot":`container`,class:j(p.value.container({class:f(o).ui?.container}))},[f(o).icon||f(o).avatar||i.leading?(_(),v(`div`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[d(e.$slots,`leading`,R(t({...u.value,avatar:f(o).avatar,ui:p.value})),()=>[f(o).icon?(_(),m(Je,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(o).avatar?(_(),m(ft,z({key:1,size:f(o).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},f(o).avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:f(o).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)])],2)):g(``,!0),f(o).content||l.value.length||i.content||f(o).actions||i.actions||i.body?(_(),v(`div`,{key:1,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body}))},[d(e.$slots,`body`,R(t({...u.value})),()=>[f(o).content||l.value.length||i.content?(_(),v(`div`,{key:0,"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},[d(e.$slots,`content`,R(t({...u.value,content:f(o).content})),()=>[f(o).content?(_(),v(k,{key:0},[a(M(f(o).content),1)],64)):(_(!0),v(k,{key:1},y(l.value,(e,t)=>(_(),v(k,{key:`${f(o).id}-${e.type}-${t}`},[a(M(e.text),1)],64))),128))])],2)):g(``,!0),f(o).actions||i.actions?(_(),v(`div`,{key:1,"data-slot":`actions`,class:j(p.value.actions({class:f(o).ui?.actions}))},[d(e.$slots,`actions`,R(t({...u.value,actions:f(o).actions})),()=>[(_(!0),v(k,null,y(f(o).actions,(e,t)=>(_(),m(lt,{key:t,text:e.label},{default:H(()=>[E(Et,z({size:`sm`,color:`neutral`,variant:`ghost`},{ref_for:!0},f(et)(e,[`onClick`]),{label:void 0,onClick:t=>typeof e.onClick==`function`?e.onClick(t,u.value):void 0}),null,16,[`onClick`])]),_:2},1032,[`text`]))),128))])],2)):g(``,!0)])],2)):g(``,!0)],2)]),_:3},8,[`as`,`data-role`,`class`]))}};function io(e,t={}){let{arrivedState:r}=ht(e);return{style:n(()=>{let n=o(e),i=o(t.orientation)??`vertical`,[a,s]=i===`horizontal`?[`left`,`right`]:[`top`,`bottom`],c=!r[a],l=!r[s];if(!c&&!l||!(n&&(i===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight)))return;let u=`${o(t.size)??24}px`,d=i===`horizontal`?`90deg`:`180deg`;return c&&l?{maskImage:`linear-gradient(${d}, transparent, #000 ${u}, #000 calc(100% - ${u}), transparent)`}:c?{maskImage:`linear-gradient(${d}, transparent, #000 ${u})`}:{maskImage:`linear-gradient(${d}, #000, #000 calc(100% - ${u}), transparent)`}}),isOverflowing:n(()=>{r.top,r.bottom,r.left,r.right;let n=o(e);return n?(o(t.orientation)??`vertical`)===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight:!1}),arrivedState:r}}var ao={base:`text-transparent bg-clip-text bg-no-repeat bg-size-[calc(200%+var(--spread)*2+2px)_100%,auto] bg-[image:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--ui-text-highlighted),#0000_calc(50%+var(--spread))),linear-gradient(var(--ui-text-muted),var(--ui-text-muted))] motion-safe:animate-[shimmer_var(--duration)_linear_infinite] motion-safe:rtl:animate-[shimmer-rtl_var(--duration)_linear_infinite] will-change-[background-position] motion-reduce:bg-none motion-reduce:text-muted`},oo={__name:`UChatShimmer`,props:{as:{type:null,required:!1,default:`span`},text:{type:String,required:!0},duration:{type:Number,required:!1,default:2},spread:{type:Number,required:!1,default:2},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){let t=oe(`chatShimmer`,e),r=Jn(),i=n(()=>Pe({extend:ao,...r.ui?.chatShimmer||{}})),o=n(()=>t.text.length*t.spread);return(e,n)=>(_(),m(f(gt),{as:f(t).as,style:N({"--spread":`${o.value}px`,"--duration":`${f(t).duration}s`}),"data-slot":`base`,class:j(i.value({class:[f(t).ui?.base,f(t).class]}))},{default:H(()=>[a(M(f(t).text),1)]),_:1},8,[`as`,`style`,`class`]))}},so={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default rounded-sm outline-primary/25 focus-visible:outline-3 min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden rounded-sm outline-primary/25 has-focus-visible:outline-3`,body:`max-h-[200px] pt-2 overflow-y-auto text-sm text-dimmed whitespace-pre-wrap focus:outline-none`},variants:{chevron:{leading:{leadingIcon:`group-hover:opacity-0`},trailing:``},alone:{false:{leadingIcon:[`absolute inset-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},co={__name:`UChatReasoning`,props:{text:{type:String,required:!1},streaming:{type:Boolean,required:!1,default:!1},duration:{type:Number,required:!1},icon:{type:null,required:!1},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},autoCloseDelay:{type:Number,required:!1,default:500},shimmer:{type:Object,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=oe(`chatReasoning`,r),{t:s,code:c}=$t(),u=Jn(),p=n(()=>Pe({extend:so,...u.ui?.chatReasoning||{}})({chevron:o.chevron})),y=n(()=>o.open!==void 0),x=h(o.defaultOpen??o.streaming),S=h(o.streaming?Date.now():null),C=h(void 0),w=h(null);B(()=>o.streaming,(e,t)=>{e?(w.value&&=(clearTimeout(w.value),null),t||(k(!0),S.value=Date.now())):t&&(S.value!==null&&(C.value=Math.ceil((Date.now()-S.value)/1e3),S.value=null),o.autoCloseDelay>0&&(w.value=setTimeout(()=>{k(!1)},o.autoCloseDelay)))},{immediate:!0});let T=n(()=>o.duration??C.value),D=n(()=>{if(o.streaming||T.value===0)return s(`chatReasoning.thinking`);if(T.value===void 0)return s(`chatReasoning.thought`);let e=T.value,t=e<60?`second`:`minute`,n=e<60?e:Math.floor(e/60),r=new Intl.NumberFormat(c.value,{style:`unit`,unit:t,unitDisplay:`long`}).format(n);return s(`chatReasoning.thoughtFor`,{duration:r})}),O=n(()=>y.value?o.open:x.value);function k(e){w.value&&=(clearTimeout(w.value),null),x.value=e,i(`update:open`,e)}l(()=>{w.value&&clearTimeout(w.value)});let A=n(()=>!!o.text||o.streaming),F=n(()=>o.chevronIcon||u.ui.icons?.chevronDown),L=b(`bodyRef`),{style:R}=io(L);return B(()=>o.text,()=>{if(!o.streaming||!L.value)return;let e=L.value;e.scrollHeight-e.scrollTop-e.clientHeight<50&&P(()=>{e.scrollTop=e.scrollHeight})}),(e,t)=>A.value?(_(),m(f(ea),{key:0,open:O.value,disabled:f(o).disabled,"unmount-on-hide":f(o).unmountOnHide,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]})),"onUpdate:open":k},{default:H(({open:t})=>[E(f(na),{"as-child":``,disabled:!A.value},{default:H(()=>[I(`button`,{type:`button`,"data-slot":`trigger`,class:j(p.value.trigger({class:f(o).ui?.trigger}))},[f(o).icon||A.value&&f(o).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[f(o).icon?(_(),m(Je,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon,alone:!(A.value&&f(o).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),A.value&&f(o).chevron===`leading`?(_(),m(Je,{key:1,name:F.value,"data-slot":`chevronIcon`,class:j(p.value.chevronIcon({class:f(o).ui?.chevronIcon,alone:!f(o).icon}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),f(o).streaming?(_(),m(oo,z({key:1,text:D.value},f(o).shimmer,{"data-slot":`label`,class:p.value.label({class:f(o).ui?.label})}),null,16,[`text`,`class`])):(_(),v(`span`,{key:2,"data-slot":`label`,class:j(p.value.label({class:f(o).ui?.label}))},M(D.value),3)),A.value&&f(o).chevron===`trailing`?(_(),m(Je,{key:3,name:F.value,"data-slot":`trailingIcon`,class:j(p.value.trailingIcon({class:f(o).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(ta),{"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},{default:H(()=>[I(`div`,{ref_key:`bodyRef`,ref:L,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body})),style:N(f(R))},[d(e.$slots,`default`,{open:t},()=>[a(M(f(o).text),1)])],6)]),_:2},1032,[`class`])]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`])):g(``,!0)}},lo=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function uo(e,t=!1){return t?`⠿`:lo[Math.floor(Math.max(0,e)/80)%lo.length]}function fo(e,t){return t?e?1e3:80:null}function po(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60);return r?`${r}h ${i}m`:i?`${i}m ${n%60}s`:`${n}s`}var mo={class:`omp-spinner`,"aria-hidden":`true`},ho={key:0,class:`omp-elapsed`},go=Object.assign(T({__name:`OmpSpinner`,props:{since:{}},setup(e){let t=e,r=h(0),i=h(Date.now()),a=n(()=>uo(i.value-r.value,Si.value)),o=n(()=>t.since?po(t.since,i.value):``),s;function c(){s&&clearInterval(s),s=void 0}function l(){i.value=Date.now()}function u(){c();let e=fo(Si.value,Hr.value);e!==null&&(l(),s=Tr(l,e))}return w(()=>{B(Si,()=>{r.value=i.value=Date.now(),u()},{immediate:!0}),B(Hr,u)}),U(c),(e,t)=>(_(),v(k,null,[I(`span`,mo,M(f(a)),1),d(e.$slots,`default`),f(o)?(_(),v(`span`,ho,M(f(o)),1)):g(``,!0)],64))}}),{__name:`OmpSpinner`}),_o=Object.assign(T({__name:`OmpElapsed`,props:{since:{}},setup(e){let t=e,n=h(Date.now()),r;return w(()=>{r=Tr(()=>{n.value=Date.now()},1e3)}),U(()=>{r&&clearInterval(r)}),(e,r)=>(_(),v(`span`,null,M(f(po)(t.since,f(n))),1))}}),{__name:`OmpElapsed`});function vo(e){if(!(e>=0))return``;if(e<6e4)return`${(e/1e3).toFixed(2)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h${r}m`:`${r}m${t%60}s`}var yo=(e,t,n,r,i)=>`${e} ${e===1?Z(t,r):Z(n,i)}`;function bo(e){let t=[];return typeof e.matches==`number`?t.push(yo(e.matches,`match`,`matches`,`résultat`,`résultats`)+(e.files&&e.files>1&&e.files<e.matches?` ${Z(`in ${e.files} files`,`dans ${e.files} fichiers`)}`:``)):typeof e.files==`number`&&t.push(yo(e.files,`file`,`files`,`fichier`,`fichiers`)),e.scope&&t.push(`${Z(`in`,`dans`)} ${e.scope}`),(typeof e.added==`number`||typeof e.removed==`number`)&&t.push(`+${e.added||0}/-${e.removed||0}`),e.job&&t.push(`${Z(`Backgrounded`,`En arrière-plan`)}: ${e.job}`),e.cancelled&&t.push(Z(`cancelled`,`annulée`)),t}function xo(e){return!e.out||!e.outLines?0:Math.max(0,e.outLines-e.out.split(`
3
- `).length)}function So(e){return e.out?yo(Math.max(e.outLines||0,e.out.split(`
4
- `).length),`line`,`lines`,`ligne`,`lignes`):``}function Co(e){if(e.title===`Bash`||e.title===`Python`)return e.target||e.title.toLowerCase();let t=e.title.toLowerCase().replace(/\s+/g,`_`);return e.target?`${t} ${e.target}`:t}function wo(e,t){let n=xo(e);return{label:e.diff?`Diff`:t?Z(`Error`,`Erreur`):`Output`,earlier:n?`… ${yo(n,`earlier line`,`earlier lines`,`ligne avant`,`lignes avant`)}`:``}}var To=e=>e.reduce((e,t)=>e+(t.omp&&typeof t.omp.ms==`number`?t.omp.ms:0),0),Eo=e=>e.length>0&&e.every(e=>e.omp);function Do(e,t){return t||e.length<=3?{hidden:0,rows:e}:{hidden:e.length-3,rows:e.slice(-3)}}var Oo={class:`omp-tool-line`},ko={class:`omp-tool-glyph`,"aria-hidden":`true`},Ao={class:`omp-tool-cmd`},jo={key:0,class:`omp-tool-wall`},Mo={key:1,class:`omp-tool-wall`},No={class:`omp-tool-sub`},Po={key:1,class:`omp-tool-intent`},Fo={key:2,class:`omp-tool-result`},Io={class:`omp-tool-exit`},Lo={key:0,class:`omp-tool-out`},Ro={class:`omp-tool-out-head`},zo={class:`omp-tool-out-label`},Bo={key:0,class:`omp-tool-out-earlier`},Vo={class:`omp-tool-out-right`},Ho={key:0,class:`omp-tool-exit`},Uo={key:1},Wo=Object.assign(T({__name:`OmpTool`,props:{tool:{},live:{type:Boolean},run:{type:Boolean}},setup(e){let t=e,r=h(!1),i=n(()=>t.tool.omp),o=n(()=>!!t.tool.error),s=n(()=>bo(i.value).concat(t.run?[So(i.value)].filter(Boolean):[]).join(` · `)),c=n(()=>i.value.exit?String(i.value.exit):``),l=n(()=>t.live||i.value.ms===void 0?``:vo(i.value.ms)),u=n(()=>t.live&&t.tool.ts&&Date.parse(t.tool.ts)||null),d=n(()=>i.value.intent||i.value.title),p=n(()=>!!i.value.out),b=n(()=>wo(i.value,o.value)),x=n(()=>(i.value.out||``).split(`
5
- `).map(e=>({text:e,cls:i.value.diff?/^\+\s*\d*\|/.test(e)?`add`:/^-\s*\d*\|/.test(e)?`del`:``:``})));return(t,n)=>{let h=go,S=_o,w=Je,T=oo;return _(),v(`div`,{class:j([`omp-tool`,{err:f(o),live:e.live,open:f(r)}])},[(_(),m(C(f(p)?`button`:`div`),{class:`omp-tool-head`,type:f(p)?`button`:void 0,"aria-expanded":f(p)?f(r):void 0,onClick:n[0]||=e=>f(p)&&(r.value=!f(r))},{default:H(()=>[I(`span`,Oo,[I(`span`,ko,[e.live?(_(),m(h,{key:0})):(_(),v(k,{key:1},[a(M(f(o)?`✗`:`❯`),1)],64))]),I(`code`,Ao,M(f(Co)(f(i))),1),f(u)?(_(),v(`span`,jo,[E(S,{since:f(u)},null,8,[`since`])])):f(l)?(_(),v(`span`,Mo,M(f(l)),1)):g(``,!0),e.run&&f(p)?(_(),m(w,{key:2,name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`,class:`omp-tool-chev`,"aria-hidden":`true`},null,8,[`name`])):g(``,!0)]),I(`span`,No,[e.live?(_(),m(T,{key:0,text:`# ${f(d)}`,duration:2.4,class:`omp-tool-intent`},null,8,[`text`])):f(i).intent?(_(),v(`span`,Po,`# `+M(f(i).intent),1)):g(``,!0),f(s)||f(c)?(_(),v(`span`,Fo,[a(`→ `+M(f(s)),1),f(c)?(_(),v(k,{key:0},[f(s)?(_(),v(k,{key:0},[a(` · `)],64)):g(``,!0),I(`span`,Io,`exit `+M(f(c)),1)],64)):g(``,!0)])):g(``,!0)])]),_:1},8,[`type`,`aria-expanded`])),f(p)&&f(r)?(_(),v(`div`,Lo,[I(`div`,Ro,[I(`span`,zo,M(f(b).label),1),f(b).earlier?(_(),v(`span`,Bo,M(f(b).earlier),1)):g(``,!0),I(`span`,Vo,[f(c)?(_(),v(`span`,Ho,`exit `+M(f(c)),1)):g(``,!0),f(l)?(_(),v(`span`,Uo,M(f(l)),1)):g(``,!0)])]),I(`pre`,null,[(_(!0),v(k,null,y(f(x),(e,t)=>(_(),v(`span`,{key:t,class:j(e.cls)},M(e.text)+`
6
- `,3))),128))])])):g(``,!0)],2)}}}),{__name:`OmpTool`}),Go={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,suffix:`text-dimmed ms-1`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden`,body:`text-sm text-dimmed whitespace-pre-wrap`,actions:`flex items-center justify-end gap-1.5`},variants:{variant:{inline:{trigger:`rounded-sm outline-primary/25 focus-visible:outline-3`,body:`pt-2`,actions:`pt-2`},card:{root:`rounded-md ring ring-default overflow-hidden outline-primary/25 has-focus-visible:outline-3 has-focus-visible:ring-primary`,trigger:`px-2 py-1 focus:outline-none`,trailingIcon:`ms-auto`,body:`border-t border-default p-2 max-h-[200px] overflow-y-auto focus:outline-none`,actions:`border-t border-default p-2`}},chevron:{leading:``,trailing:``},loading:{true:{leadingIcon:`animate-spin`}},alone:{false:{leadingIcon:[`absolute inset-0 group-hover:opacity-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},Ko=[`data-state`],qo={__name:`UChatTool`,props:{text:{type:String,required:!1},suffix:{type:String,required:!1},icon:{type:null,required:!1},loading:{type:Boolean,required:!1,default:!1},loadingIcon:{type:null,required:!1},streaming:{type:Boolean,required:!1,default:!1},variant:{type:null,required:!1,default:`inline`},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},shimmer:{type:Object,required:!1},actions:{type:Array,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=O(),s=oe(`chatTool`,r),c=Jn(),l=n(()=>Pe({extend:Go,...c.ui?.chatTool||{}})({variant:s.variant,chevron:s.chevron,loading:s.loading})),u=n(()=>s.open!==void 0),p=h(s.defaultOpen??!1),b=n(()=>u.value?s.open:p.value);function x(e){p.value=e,i(`update:open`,e)}let S=n(()=>!!o.default);B(()=>!!s.actions?.length,e=>{e&&S.value&&s.open===void 0&&s.defaultOpen===void 0&&(p.value=!0)},{immediate:!0});let C=n(()=>s.loadingIcon||c.ui.icons?.loading),w=n(()=>s.loading?C.value:s.icon),T=n(()=>s.chevronIcon||c.ui.icons?.chevronDown);return(e,t)=>(_(),m(f(ea),{open:b.value,disabled:f(s).disabled,"unmount-on-hide":f(s).unmountOnHide,"data-slot":`root`,class:j(l.value.root({class:[f(s).ui?.root,f(s).class]})),"onUpdate:open":x},{default:H(({open:t})=>[E(f(na),{"as-child":``,disabled:!S.value},{default:H(()=>[I(`button`,{type:`button`,"data-slot":`trigger`,class:j(l.value.trigger({class:f(s).ui?.trigger}))},[w.value||S.value&&f(s).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(l.value.leading({class:f(s).ui?.leading}))},[w.value?(_(),m(Je,{key:0,name:w.value,"data-slot":`leadingIcon`,class:j(l.value.leadingIcon({class:f(s).ui?.leadingIcon,alone:!(S.value&&f(s).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),S.value&&f(s).chevron===`leading`?(_(),m(Je,{key:1,name:T.value,"data-slot":`chevronIcon`,class:j(l.value.chevronIcon({class:f(s).ui?.chevronIcon,alone:!w.value}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),I(`span`,{"data-slot":`label`,class:j(l.value.label({class:f(s).ui?.label}))},[f(s).streaming&&f(s).text?(_(),m(oo,z({key:0,text:f(s).text},f(s).shimmer),null,16,[`text`])):(_(),v(k,{key:1},[a(M(f(s).text),1)],64)),f(s).suffix?(_(),v(`span`,{key:2,"data-slot":`suffix`,class:j(l.value.suffix({class:f(s).ui?.suffix}))},M(f(s).suffix),3)):g(``,!0)],2),S.value&&f(s).chevron===`trailing`?(_(),m(Je,{key:1,name:T.value,"data-slot":`trailingIcon`,class:j(l.value.trailingIcon({class:f(s).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(ta),{"data-slot":`content`,class:j(l.value.content({class:f(s).ui?.content}))},{default:H(()=>[I(`div`,{"data-slot":`body`,class:j(l.value.body({class:f(s).ui?.body}))},[d(e.$slots,`default`,{open:t})],2)]),_:2},1032,[`class`]),f(s).actions?.length||o.actions?(_(),v(`div`,{key:0,"data-slot":`actions`,"data-state":S.value&&t?`open`:`closed`,class:j(l.value.actions({class:f(s).ui?.actions}))},[d(e.$slots,`actions`,{},()=>[(_(!0),v(k,null,y(f(s).actions,(e,t)=>(_(),m(Et,z({key:t,size:`xs`},{ref_for:!0},e),null,16))),128))])],10,Ko)):g(``,!0)]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`]))}},Jo=[`·`,`✢`,`✳`,`✶`,`✻`,`✽`],Yo=[...Jo,...[...Jo].reverse()];function Xo(e,t=!1){return t?`✻`:Yo[Math.floor(Math.max(0,e)/120)%Yo.length]}function Zo(e,t){return e||!t?null:120}var Qo={class:`claude-spinner`,"aria-hidden":`true`},$o=Object.assign(T({__name:`ClaudeSpinner`,setup(e){let t=h(0),r=n(()=>Xo(t.value,Si.value)),i,a=0;function o(){i&&clearInterval(i),i=void 0}function s(){t.value=performance.now()-a}function c(){o();let e=Zo(Si.value,Hr.value);e!==null&&(s(),i=Tr(s,e))}return w(()=>{B(Si,()=>{a=performance.now(),c()},{immediate:!0}),B(Hr,c)}),U(o),(e,t)=>(_(),v(`span`,Qo,M(f(r)),1))}}),{__name:`ClaudeSpinner`}),es={slots:{root:`w-full flex flex-col gap-1 flex-1 px-2.5 [&>article]:last-of-type:min-h-(--last-message-height)`,indicator:`h-6 flex items-center gap-1 py-3 *:size-2 *:rounded-full *:bg-elevated motion-safe:[&>*:nth-child(1)]:animate-[bounce_1s_infinite] motion-safe:[&>*:nth-child(2)]:animate-[bounce_1s_0.15s_infinite] motion-safe:[&>*:nth-child(3)]:animate-[bounce_1s_0.3s_infinite]`,viewport:`absolute inset-x-0 top-[86%] data-[state=open]:animate-[fade-in_200ms_var(--ease-out)] data-[state=closed]:animate-[fade-out_200ms_var(--ease-out)]`,autoScroll:`rounded-full absolute right-1/2 translate-x-1/2 bottom-0`},variants:{compact:{true:``,false:``}}},ts=[`data-status`],ns=[`data-state`],rs={__name:`UChatMessages`,props:{messages:{type:null,required:!1},status:{type:String,required:!1},shouldAutoScroll:{type:Boolean,required:!1,default:!1},shouldScrollToBottom:{type:Boolean,required:!1,default:!0},autoScroll:{type:[Boolean,Object],required:!1,default:!0},autoScrollIcon:{type:null,required:!1},user:{type:Object,required:!1},assistant:{type:Object,required:!1},compact:{type:Boolean,required:!1},spacingOffset:{type:Number,required:!1,default:0},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e,{expose:t}){let r=e,i=O(),a=oe(`chatMessages`,r),o=()=>et(i,[`default`,`indicator`,`viewport`]);function s(){if(a.status===`submitted`)return!0;if(a.status!==`streaming`)return!1;let e=a.messages?.[a.messages.length-1];return e?.role===`assistant`&&!e.parts?.length}let c=Jn(),l=S(()=>zt(a.user,{side:`right`,variant:`soft`})),u=S(()=>zt(a.assistant,{side:`left`,variant:`naked`})),p=n(()=>Pe({extend:es,...c.ui?.chatMessages||{}})({compact:a.compact})),b=h(null),C=h(null),T=h(new Map),D=h(!1),A=h(0),M=h(!1),F=h(0),L=h(!1);function R(e,t){let n=t?.$el;n&&T.value.set(e,n)}function V(e){let t=T.value.get(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}function U(e=!0){C.value&&(e?C.value.scrollTo({top:C.value.scrollHeight,behavior:`smooth`}):C.value.scrollTop=C.value.scrollHeight)}Nt([()=>a.messages,()=>a.status],([e,t])=>{if(!a.messages?.length){D.value=!1,L.value=!1,F.value=0,T.value.clear();return}t===`streaming`&&ee()},{deep:!0,throttle:50,leading:!0}),B(()=>a.status,e=>{if(e!==`submitted`)return;let t=a.messages?.[a.messages.length-1];t&&t.role===`user`&&(L.value=!1,P(()=>{M.value=!0,G(),P(()=>{V(t.id)})}))});function ee(){if(!C.value)return;let e=C.value.scrollTop+C.value.clientHeight,t=C.value.scrollHeight;D.value=t-e>=100,C.value.scrollTop<F.value?L.value=!0:t-e<100&&(L.value=!1),F.value=C.value.scrollTop}function W(){L.value=!1,U()}function te(e){if(!e)return document.documentElement;let t=/auto|scroll/,n=e;for(;n&&n!==document.body&&n!==document.documentElement;){let e=window.getComputedStyle(n);if(t.test(e.overflowY))return n;n=n.parentElement}return document.documentElement}function G(){if(!b.value||!C.value||!a.messages?.length||!M.value)return;let{height:e}=Tt(C.value),t=a.messages.findLast(e=>e.role===`user`);if(!t)return;let n=T.value.get(t.id);if(!n)return;let r=a.spacingOffset||0,i=window.getComputedStyle(b.value),o=window.getComputedStyle(C.value);r+=Number.parseFloat(i.rowGap)||Number.parseFloat(i.gap)||0,r+=Number.parseFloat(o.paddingTop)||0,r+=Number.parseFloat(o.paddingBottom)||0,A.value=Math.max(e.value-n.offsetHeight-r,0)}return w(()=>{C.value=te(b.value),C.value&&(F.value=C.value.scrollTop,a.shouldScrollToBottom?(U(!1),setTimeout(()=>{U(!1)},100)):P(()=>{ee()}),Ve(C,`scroll`,ee),Ve(window,`resize`,()=>P(G)),b.value&&kt(b,()=>{a.shouldAutoScroll&&a.status===`streaming`&&!L.value&&U(!1)},{childList:!0,subtree:!0}))}),t({registerMessageRef:R}),(e,t)=>(_(),v(`div`,{ref_key:`el`,ref:b,"data-status":f(a).status,"data-slot":`root`,class:j(p.value.root({class:[f(a).ui?.root,f(a).class]})),style:N({"--last-message-height":`${A.value}px`})},[d(e.$slots,`default`,{registerMessageRef:R},()=>[(_(!0),v(k,null,y(f(a).messages,t=>(_(),v(k,{key:t.id},[t.parts?.length?(_(),m(ro,z({key:0,ref_for:!0},{...t.role===`user`?l.value:u.value,...t},{ref_for:!0,ref:e=>R(t.id,e),compact:f(a).compact}),x({_:2},[y(o(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,z({ref_for:!0},{...n,message:t}))])}))]),1040,[`compact`])):g(``,!0)],64))),128))]),s()?(_(),m(ro,z({key:0,id:`indicator`,role:`assistant`},{...u.value,actions:void 0,parts:[]},{compact:f(a).compact}),{content:H(()=>[d(e.$slots,`indicator`,{ui:p.value},()=>[I(`div`,{"data-slot":`indicator`,class:j(p.value.indicator({class:f(a).ui?.indicator}))},[...t[0]||=[I(`span`,null,null,-1),I(`span`,null,null,-1),I(`span`,null,null,-1)]],2)])]),_:3},16,[`compact`])):g(``,!0),E(f(me),{present:D.value},{default:H(()=>[I(`div`,{"data-state":D.value?`open`:`closed`,"data-slot":`viewport`,class:j(p.value.viewport({class:f(a).ui?.viewport}))},[d(e.$slots,`viewport`,{ui:p.value,onClick:W},()=>[f(a).autoScroll?(_(),m(Et,z({key:0,icon:f(a).autoScrollIcon||f(c).ui.icons.arrowDown,color:`neutral`,variant:`outline`},typeof f(a).autoScroll==`object`?f(a).autoScroll:{},{"data-slot":`autoScroll`,class:p.value.autoScroll({class:f(a).ui?.autoScroll}),onClick:W}),null,16,[`icon`,`class`])):g(``,!0)])],10,ns)]),_:3},8,[`present`])],14,ts))}},is=new URL(`pdf.min.t82Z80JU.mjs`,import.meta.url).href,as=new URL(`pdf.worker.min.wgc6bjNh.mjs`,import.meta.url).href;function os(e,t,n){return Math.min(Math.max(1,n),Math.sqrt(4194304/(e*t)))}var ss=[`aria-label`,`aria-busy`],cs={key:0,class:`changes-notice`,role:`status`},ls={key:1,class:`changes-notice error`,role:`alert`},us=[`data-page`,`aria-label`],ds=Object.assign(T({__name:`PdfPreview`,props:{src:{},title:{}},setup(e){let t=e,n=h(),r=h(0),i=h(2/3),a=h(!0),o=h(!1),s,c,l,u,d,p=!1,m=0,b=!1,x=0,S=new Set;async function C(){if(!b&&!p&&s&&x){b=!0;try{for(let e of S){if(p)break;if(e.querySelector(`canvas`))continue;let t=m,n=await s.getPage(Number(e.dataset.page));if(p||t!==m||!S.has(e))continue;let r=n.getViewport({scale:1}),i=n.getViewport({scale:x/r.width});e.style.aspectRatio=`${r.width} / ${r.height}`;let a=window.document.createElement(`canvas`),o=os(i.width,i.height,window.devicePixelRatio||1);a.width=Math.ceil(i.width*o),a.height=Math.ceil(i.height*o);let c=a.getContext(`2d`);l=n.render({canvas:a,canvasContext:c,viewport:i,transform:[o,0,0,o,0,0]});try{await l.promise,!p&&t===m&&S.has(e)?(e.replaceChildren(a),e.dataset.rendered=`true`):a.width=a.height=0}catch(e){if(e.name!==`RenderingCancelledException`)throw e}finally{l=void 0,n.cleanup()}}}catch{p||(o.value=!0)}finally{b=!1,!p&&!o.value&&[...S].some(e=>!e.querySelector(`canvas`))&&C()}}}function T(e){let t=e.querySelector(`canvas`);t&&(t.width=t.height=0,t.remove()),delete e.dataset.rendered}return w(async()=>{try{let e=await en(()=>import(is),[],import.meta.url);if(p||(e.GlobalWorkerOptions.workerSrc=as,c=e.getDocument({url:t.src,withCredentials:!0,isEvalSupported:!1}),s=await c.promise,p))return;let o=await s.getPage(1),f=o.getViewport({scale:1});if(i.value=f.height/f.width,o.cleanup(),r.value=s.numPages,a.value=!1,await P(),p||!n.value)return;x=n.value.clientWidth,u=new IntersectionObserver(e=>{for(let t of e){let e=t.target;t.isIntersecting?S.add(e):(S.delete(e),T(e))}C()},{rootMargin:`400px 0px`}),n.value.querySelectorAll(`.pdf-page`).forEach(e=>u.observe(e)),d=new ResizeObserver(()=>{let e=n.value?.clientWidth||0;e&&e!==x&&(x=e,m++,l?.cancel(),S.forEach(T),C())}),d.observe(n.value)}catch{p||(o.value=!0,a.value=!1)}}),U(()=>{p=!0,u?.disconnect(),d?.disconnect(),l?.cancel(),S.forEach(T),S.clear(),c?.destroy()}),(t,s)=>(_(),v(`div`,{ref_key:`root`,ref:n,class:`files-pdf`,role:`region`,"aria-label":e.title,"aria-busy":f(a)},[f(a)?(_(),v(`p`,cs,M((`t`in t?t.t:f(Q))(`Loading PDF…`)),1)):g(``,!0),f(o)?(_(),v(`p`,ls,M((`t`in t?t.t:f(Q))(`Could not preview this PDF. Use Open to view it.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(r),e=>(_(),v(`div`,{key:e,class:`pdf-page`,"data-page":e,style:N({aspectRatio:`1 / ${f(i)}`}),role:`img`,"aria-label":`${(`t`in t?t.t:f(Q))(`Page`)} ${e}`},null,12,us))),128))],8,ss))}}),{__name:`PdfPreview`});function fs(e){if(e<1e3)return`${e} B`;let t=[`kB`,`MB`,`GB`,`TB`],n=e/1e3,r=0;for(;;){let e=n.toFixed(+(n<10));if(Number(e)<1e3||r===t.length-1)return`${e} ${t[r]}`;n/=1e3,r++}}var ps=e=>/\.(?:md|markdown)$/i.test(e),ms=e=>{try{return decodeURIComponent(e)}catch{return e}};function hs(e){let t=[];for(let n of e)if(n&&n!==`.`){if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n)}return t}function gs(e,t,n){let r=t.trim();if(!r)return null;if(r.startsWith(`#`))return{kind:`anchor`,anchor:ms(r.slice(1))};if(/^[a-z][a-z\d+.-]*:/i.test(r)||r.startsWith(`//`))return{kind:`external`};let i=r.indexOf(`#`),a=i<0?``:ms(r.slice(i+1)),o=ms((i<0?r:r.slice(0,i)).split(`?`)[0]).replace(/\\/g,`/`);if(!o)return null;let s=o.endsWith(`/`)?`dir`:`file`;if(n){if(o.startsWith(`~/`)){let e=hs(o.slice(2).split(`/`));return e?{kind:s,path:`~/${e.join(`/`)}`,anchor:a}:{kind:`outside`}}let t=hs([...o.startsWith(`/`)?[]:e.split(`/`).slice(0,-1),...o.split(`/`)]);return t?{kind:s,path:`/${t.join(`/`)}`,anchor:a}:{kind:`outside`}}let c=hs([...o.startsWith(`/`)?[]:e.split(`/`).slice(0,-1),...o.split(`/`)]);return c?{kind:s,path:c.join(`/`),anchor:a}:{kind:`outside`}}function _s(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu,``).replace(/\s/g,`-`)}function vs(e,t){let n=t.toLowerCase(),r=new Map;for(let t of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=_s(t.textContent||``),i=r.get(e)??0;if(r.set(e,i+1),(i?`${e}-${i}`:e)===n)return t}return null}var ys=`wherdr.files.hidden`,bs=e=>e!==`0`,xs=e=>e?`1`:`0`,Ss=`wherdr.files.md`,Cs=e=>e===`source`?`source`:`rendered`,ws={class:`changes-view files-view`},Ts={class:`changes-toolbar`},Es=[`aria-label`],Ds={key:0,class:`files-sep`},Os=[`onClick`],ks={key:0,class:`files-sep`},As={class:`files-crumb current`},js={class:`files-actions`},Ms={class:`files-label`},Ns={key:0,class:`changes-notice error`,role:`alert`},Ps={key:1,class:`changes-notice`},Fs={class:`changes-location`},Is=[`aria-label`],Ls=[`aria-pressed`,`onClick`],Rs={key:1,class:`changes-limit`},zs=[`src`,`alt`],Bs={key:0,class:`changes-notice`,role:`alert`},Vs=[`src`,`aria-label`],Hs={key:5,class:`changes-notice`},Us={key:6,class:`changes-notice`},Ws=[`aria-label`,`innerHTML`],Gs=[`aria-label`],Ks={class:`files-num`,"aria-hidden":`true`},qs={class:`files-text`},Js={class:`changes-toggle`},Ys={key:0,class:`changes-limit`},Xs={key:1,class:`changes-notice`},Zs={class:`files-list`},Qs=[`disabled`,`onClick`],$s={class:`change-path`},ec={key:0,class:`change-status`},tc=40,nc=Object.assign(T({__name:`FilesView`,props:{paneId:{},file:{}},setup(e){let t=e,r=h(null),i=h(null),o=h(!1),s=h(``),c=rr(ys,bs,xs),u=0,d=()=>encodeURIComponent(t.paneId);async function p(e,t){let n=++u;o.value=!0,s.value=``;try{let r=await fi(e);n===u&&t(r)}catch(e){n===u&&(s.value=e.message)}finally{n===u&&(o.value=!1)}}function b(e){let t=e===null?``:`&path=${encodeURIComponent(e)}`;return p(`/api/files?pane=${d()}${t}`,e=>{r.value=e,i.value=null})}let x=e=>`pane=${d()}&path=${encodeURIComponent(e)}${t.file?`&from=chat`:``}`,S=``;function C(e){return S=e,p(`/api/files/read?${x(e)}`,e=>{i.value=e})}let T=null,D=h([]),O=h(0),A=n(()=>i.value?.kind===`pdf`||i.value?.kind===`video`?`/api/files/download?${x(i.value.path)}&inline=1`:``),N=h(!1);B(A,()=>{N.value=!1});let F=h(!1);async function R(){let e=i.value?.path;if(e&&!F.value){F.value=!0;try{await Oi(`/api/files/download?${x(e)}`,e.split(`/`).pop()||e)}catch(e){$(e.message,!0)}finally{F.value=!1}}}let z=e=>r.value?.path?`${r.value.path}/${e}`:e;function V(e){e.kind===`dir`?b(z(e.name)):e.kind===`file`&&C(z(e.name))}function U(){u++,o.value=!1;let e=t.file?D.value.pop():void 0;e?C(e):i.value=null}function ee(){O.value++,se.clear(),N.value=!1,t.file?C(S||t.file):i.value?C(i.value.path):b(r.value?r.value.path:null)}w(()=>t.file?C(t.file):b(null)),l(()=>{u++});let te=n(()=>{let e=r.value;if(!e)return[];let t=e.path?e.path.split(`/`):[];return[{label:e.root.split(`/`).filter(Boolean).pop()||`/`,path:``},...t.map((e,n)=>({label:e,path:t.slice(0,n+1).join(`/`)}))]}),G=n(()=>(r.value?.entries||[]).filter(e=>c.value||!e.name.startsWith(`.`))),ne=n(()=>{let e=i.value?.text??``,t=e.endsWith(`
1
+ import{t as e}from"./hePW80VL.js";import{$ as t,A as n,An as r,At as i,B as a,Bn as o,Dn as s,Dt as c,Et as l,Fn as u,Ft as d,Hn as f,Jt as p,M as m,Mn as h,N as g,Ot as _,P as v,Pt as y,Qt as b,R as x,Rn as S,Rt as C,St as w,U as T,V as E,Yt as D,Zt as O,b as k,ct as A,fr as j,gr as M,hr as N,ht as P,in as F,j as I,ln as L,mr as R,mt as z,nn as B,pt as V,sn as H,vt as U,w as ee,wn as W,z as te,zn as G}from"./C25ROUa9.js";import{_t as ne,dt as K,ht as re,vt as q}from"./CDWjMk9C.js";import{$t as ie,A as ae,C as J,Cn as oe,Dn as se,Ft as ce,Gn as le,Gt as ue,Ht as de,In as fe,J as pe,Jt as me,Kt as he,M as ge,Mn as _e,Mt as ve,On as ye,Ot as be,Q as xe,Qt as Se,S as Ce,Sn as we,Tn as Te,Ut as Ee,Vr as De,Wt as Oe,Xt as ke,Y as Ae,Yt as je,Zt as Me,_ as Ne,a as Pe,ai as Fe,an as Ie,b as Le,bt as Re,cn as ze,ct as Be,dr as Ve,en as He,et as Ue,fi as We,ft as Ge,gi as Ke,h as qe,hi as Je,hn as Ye,i as Xe,in as Ze,jt as Qe,k as $e,kn as et,ln as tt,lt as nt,mi as rt,mn as it,mt as at,n as ot,ni as st,o as ct,oi as lt,on as ut,p as dt,pi as ft,pn as pt,pt as mt,q as ht,qt as gt,ri as _t,rn as vt,rr as yt,s as bt,si as xt,sn as St,sr as Ct,st as wt,tn as Tt,u as Et,ui as Dt,un as Ot,ut as kt,vn as At,w as jt,wn as Mt,wt as Nt,x as Pt,xn as Ft,yt as It,zn as Lt}from"./BmF5BXwf.js";import{f as Rt,m as zt,p as Bt,u as Vt}from"./CXJnLmWv.js";import{A as Ht,B as Ut,C as Wt,Ct as Gt,D as Kt,Dt as qt,E as Jt,Et as Yt,F as Xt,H as Zt,L as Qt,M as $t,N as en,Ot as tn,P as nn,R as rn,St as an,T as on,Tt as sn,V as cn,W as ln,_ as un,_t as dn,a as fn,at as pn,bt as mn,c as hn,ct as gn,d as _n,dt as vn,f as yn,ft as bn,g as xn,gt as Sn,h as Cn,ht as wn,i as Tn,it as En,j as Dn,k as On,l as kn,lt as An,mt as jn,n as Mn,nt as Nn,o as Pn,ot as Fn,p as In,pt as Ln,r as Rn,rt as zn,s as Bn,st as Vn,tt as Hn,u as Un,ut as Wn,v as Gn,vt as Y,w as Kn,wt as qn,x as Jn,xt as Yn,y as Xn,yt as Zn,z as Qn}from"./RI4B_b2M.js";import{c as $n}from"./B2KlcBQ-.js";import{$t as er,At as tr,B as nr,Br as rr,Bt as ir,Cr as ar,Ct as or,D as sr,Dt as cr,E as lr,Ei as ur,En as dr,Fr as fr,Ft as pr,G as mr,Gr as hr,Gt as gr,Hr as X,Ht as _r,Ir as vr,It as yr,J as br,Jr as xr,K as Sr,Kt as Cr,Lr as wr,Lt as Tr,M as Er,Mn as Dr,Mt as Or,Nt as kr,O as Ar,Pt as jr,Q as Mr,Qt as Nr,R as Pr,Rr as Fr,Rt as Ir,S as Lr,Sr as Rr,St as zr,T as Br,Ur as Vr,Ut as Hr,V as Ur,Vt as Wr,Wr as Gr,Wt as Kr,X as qr,Xn as Jr,Xr as Yr,Xt as Xr,Y as Zr,Z as Qr,Zr as $r,Zt as ei,_i as ti,ai as ni,at as ri,b as ii,bt as ai,ci as oi,cr as si,di as ci,dr as li,dt as ui,en as di,et as fi,f as pi,gi as mi,gr as hi,hi as gi,i as _i,ii as Z,ir as vi,it as yi,jt as bi,kt as xi,l as Si,li as Ci,lt as wi,mi as Ti,mr as Ei,n as Di,nt as Oi,pi as ki,pr as Ai,qr as ji,ri as Q,rr as Mi,si as Ni,st as Pi,tn as Fi,ui as Ii,v as Li,vi as Ri,vr as zi,vt as Bi,wn as Vi,xr as Hi,xt as $,y as Ui,zr as Wi,zt as Gi}from"./L_vgVKcG.js";import{c as Ki,d as qi,f as Ji,h as Yi,i as Xi,l as Zi,m as Qi,n as $i,p as ea,t as ta,u as na}from"./BU6Ihnb9.js";import{t as ra}from"./BDNMzG2s.js";var[ia,aa]=be(`CollapsibleRoot`),oa=T({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=at(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=G(r);return aa({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),xe(),(e,t)=>(_(),m(f(ht),{as:e.as,"as-child":r.asChild,"data-state":f(i)?`open`:`closed`,"data-disabled":f(a)?``:void 0},{default:H(()=>[d(e.$slots,`default`,{open:f(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),sa=T({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let r=e,i=t,a=ia();a.contentId||=Ae(void 0,`reka-collapsible-content`);let o=h(),{forwardRef:s,currentElement:c}=xe(),l=h(0),u=h(0),p=n(()=>a.open.value),v=h(p.value),y=h();B(()=>[p.value,o.value?.present],async()=>{await P();let e=c.value;if(!e)return;y.value=y.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();u.value=t.height,l.value=t.width,v.value||(e.style.transitionDuration=y.value.transitionDuration,e.style.animationName=y.value.animationName)},{immediate:!0});let b=n(()=>v.value&&a.open.value);return w(()=>{requestAnimationFrame(()=>{v.value=!1})}),Be(c,`beforematch`,e=>{requestAnimationFrame(()=>{a.onOpenToggle(),i(`contentFound`)})}),(e,t)=>(_(),m(f(pe),{ref_key:`presentRef`,ref:o,present:e.forceMount||f(a).open.value,"force-mount":!0},{default:H(({present:t})=>[E(f(ht),z(e.$attrs,{id:f(a).contentId,ref:f(s),"as-child":r.asChild,as:e.as,hidden:t?void 0:f(a).unmountOnHide.value?``:`until-found`,"data-state":b.value?void 0:f(a).open.value?`open`:`closed`,"data-disabled":f(a).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${u.value}px`,"--reka-collapsible-content-width":`${l.value}px`}}),{default:H(()=>[!f(a).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),ca=T({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;xe();let n=ia();return(e,r)=>(_(),m(f(ht),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":f(n).contentId,"aria-expanded":f(n).open.value,"data-state":f(n).open.value?`open`:`closed`,"data-disabled":f(n).disabled?.value?``:void 0,disabled:f(n).disabled?.value,onClick:f(n).onOpenToggle},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}}),[la,ua]=be(`TabsRoot`),da=T({__name:`TabsRoot`,props:{defaultValue:{type:null,required:!1},orientation:{type:String,required:!1,default:`horizontal`},dir:{type:String,required:!1},activationMode:{type:String,required:!1,default:`automatic`},modelValue:{type:null,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{orientation:i,unmountOnHide:a,dir:o}=G(n),s=Ue(o);xe();let c=at(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),l=h(),p=u(new Set);return ua({modelValue:c,changeModelValue:e=>{c.value=e},orientation:i,dir:s,unmountOnHide:a,activationMode:n.activationMode,baseId:Ae(void 0,`reka-tabs`),tabsList:l,contentIds:p,registerContent:e=>{p.value=new Set([...p.value,e])},unregisterContent:e=>{let t=new Set(p.value);t.delete(e),p.value=t}}),(e,t)=>(_(),m(f(ht),{dir:f(s),"data-orientation":f(i),"as-child":e.asChild,as:e.as},{default:H(()=>[d(e.$slots,`default`,{modelValue:f(c)})]),_:3},8,[`dir`,`data-orientation`,`as-child`,`as`]))}});function fa(e,t){return`${e}-trigger-${t}`}function pa(e,t){return`${e}-content-${t}`}var ma=T({__name:`TabsContent`,props:{value:{type:[String,Number],required:!0},forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{forwardRef:r}=xe(),i=la(),a=n(()=>fa(i.baseId,t.value)),o=n(()=>pa(i.baseId,t.value)),s=n(()=>t.value===i.modelValue.value),c=h(s.value);return w(()=>{i.registerContent(t.value),requestAnimationFrame(()=>{c.value=!1})}),U(()=>{i.unregisterContent(t.value)}),(e,t)=>(_(),m(f(pe),{present:e.forceMount||s.value,"force-mount":``},{default:H(({present:t})=>[E(f(ht),{id:o.value,ref:f(r),"as-child":e.asChild,as:e.as,role:`tabpanel`,"data-state":s.value?`active`:`inactive`,"data-orientation":f(i).orientation.value,"aria-labelledby":a.value,hidden:!t,tabindex:`0`,style:N({animationDuration:c.value?`0s`:void 0})},{default:H(()=>[!f(i).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1032,[`id`,`as-child`,`as`,`data-state`,`data-orientation`,`aria-labelledby`,`hidden`,`style`])]),_:3},8,[`present`]))}}),ha=T({__name:`TabsIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:t}){let r=e,i=la();t({updateIndicatorStyle:c}),xe();let a=nt(),o=h({size:null,thickness:null,position:null}),s=h([]);B(()=>[i.modelValue.value,i?.dir.value],()=>{c()},{immediate:!0,flush:`post`}),F(()=>{s.value=Array.from(i.tabsList.value?.querySelectorAll(`[role="tab"]`)||[])}),Ge(n(()=>[i.tabsList.value,...s.value]),c);function c(){let e=i.tabsList.value?.querySelector(`[role="tab"][data-state="active"]`);e&&(i.orientation.value===`horizontal`?o.value={size:e.offsetWidth,thickness:e.offsetHeight,position:e.offsetLeft}:o.value={size:e.offsetHeight,thickness:e.offsetWidth,position:e.offsetTop})}return(e,t)=>f(a)&&typeof o.value.size==`number`?(_(),m(f(ht),z({key:0},r,{style:{"--reka-tabs-indicator-size":`${o.value.size}px`,"--reka-tabs-indicator-thickness":`${o.value.thickness}px`,"--reka-tabs-indicator-position":`${o.value.position}px`}}),{default:H(()=>[d(e.$slots,`default`)]),_:3},16,[`style`])):g(`v-if`,!0)}}),ga=T({__name:`TabsList`,props:{loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let{loop:t}=G(e),{forwardRef:n,currentElement:r}=xe(),i=la();return i.tabsList=r,(e,r)=>(_(),m(f(ge),{"as-child":``,orientation:f(i).orientation.value,dir:f(i).dir.value,loop:f(t)},{default:H(()=>[E(f(ht),{ref:f(n),role:`tablist`,"as-child":e.asChild,as:e.as,"aria-orientation":f(i).orientation.value},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`aria-orientation`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),_a=T({__name:`TabsTrigger`,props:{value:{type:[String,Number],required:!0},disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,{forwardRef:r}=xe(),i=la(),a=n(()=>fa(i.baseId,t.value)),o=n(()=>i.contentIds.value.has(t.value)?pa(i.baseId,t.value):void 0),s=n(()=>t.value===i.modelValue.value);return(e,t)=>(_(),m(f(Yi),{"as-child":``,focusable:!e.disabled,active:s.value},{default:H(()=>[E(f(ht),{id:a.value,ref:f(r),role:`tab`,type:e.as===`button`?`button`:void 0,as:e.as,"as-child":e.asChild,"aria-selected":s.value?`true`:`false`,"aria-controls":o.value,"data-state":s.value?`active`:`inactive`,disabled:e.disabled,"data-disabled":e.disabled?``:void 0,"data-orientation":f(i).orientation.value,onMousedown:t[0]||=q(t=>{!e.disabled&&t.ctrlKey===!1?f(i).changeModelValue(e.value):t.preventDefault()},[`left`]),onKeydown:t[1]||=ne(t=>f(i).changeModelValue(e.value),[`enter`,`space`]),onFocus:t[2]||=()=>{let t=f(i).activationMode!==`manual`;!s.value&&!e.disabled&&t&&f(i).changeModelValue(e.value)}},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`id`,`type`,`as`,`as-child`,`aria-selected`,`aria-controls`,`data-state`,`disabled`,`data-disabled`,`data-orientation`])]),_:3},8,[`focusable`,`active`]))}}),va=[`aria-label`],ya=[`title`,`data-tab`,`aria-current`,`onPointerdown`,`onClick`],ba={key:1,class:`tab-chip-dot`},xa={class:`tab-chip-label`},Sa=[`title`,`aria-label`,`disabled`],Ca=Object.assign(T({__name:`SpaceTabs`,props:{workspace:{},current:{}},setup(e){let t=e,r=n(()=>We(t.workspace).map(e=>{let t=Dr(e.panes);return{...e,label:e.tab.label||String(e.tab.number),tone:t&&t.agent?Tt(t):``,title:e.panes.map(e=>ji(e)).join(` · `)}}));B(()=>t.current,e=>{e&&xt(e)},{immediate:!0});let i=e=>`${Q(`Tab`)} ${e}`,a=null,o=Kt({onPress:()=>{a&&(X(),we(le(a.id),i(a.label)))}});function s(e,t,n){ui.value&&(a={id:t,label:n},o.down(e))}function c(e){o.swallowClick()||e===t.current||rt(e)}return(t,n)=>{let i=Qt,a=Ut,l=qe;return(`spaceTabControls`in t?t.spaceTabControls:f(Nr))(f(r).length).row?(_(),v(`nav`,{key:0,class:`tab-chips space-tabs`,"aria-label":(`t`in t?t.t:f(Q))(`Tabs`)},[(_(!0),v(k,null,y(f(r),r=>(_(),m(a,{key:r.tab.id,disabled:`sheetMenus`in t?t.sheetMenus:f(ui),items:(`sheetMenus`in t?t.sheetMenus:f(ui))?[]:(`toDropdown`in t?t.toDropdown:f(se))((`tabItems`in t?t.tabItems:f(le))(r.tab.id)),ui:{content:`hw-dropdown`}},{default:H(()=>[I(`button`,{type:`button`,class:j([`tab-chip`,r.tone]),title:r.title,"data-tab":r.tab.id,"aria-current":r.tab.id===e.current?`page`:void 0,onPointerdown:e=>s(e,r.tab.id,r.label),onPointermove:n[0]||=(...e)=>f(o).move&&f(o).move(...e),onPointerup:n[1]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onPointercancel:n[2]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onContextmenu:n[3]||=e=>(`sheetMenus`in t?t.sheetMenus:f(ui))&&e.preventDefault(),onClick:e=>c(r.tab.id)},[r.panes.length>1?(_(),m(i,{key:0,layout:r.layout,panes:r.panes},null,8,[`layout`,`panes`])):(_(),v(`i`,ba)),I(`span`,xa,M(r.label),1)],42,ya)]),_:2},1032,[`disabled`,`items`]))),128)),I(`button`,{type:`button`,class:`tab-chip tab-add`,title:(`t`in t?t.t:f(Q))(`New tab`),"aria-label":(`t`in t?t.t:f(Q))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(br),onClick:n[4]||=n=>(`newTab`in t?t.newTab:f(fe))(e.workspace)},[E(l,{name:`i-lucide-plus`})],8,Sa)],8,va)):g(``,!0)}}}),{__name:`SpaceTabs`}),wa={slots:{base:`font-medium inline-flex items-center`,label:`truncate`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailingIcon:`shrink-0`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{solid:``,outline:``,soft:``,subtle:``},size:{xs:{base:`text-[8px]/3 px-1 py-0.5 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},sm:{base:`text-[10px]/3 px-1.5 py-1 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},md:{base:`text-xs px-2 py-1 gap-1 rounded-md`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`},lg:{base:`text-sm px-2 py-1 gap-1.5 rounded-md`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`},xl:{base:`text-base px-2.5 py-1 gap-1.5 rounded-md`,leadingIcon:`size-6`,leadingAvatarSize:`2xs`,trailingIcon:`size-6`}},square:{true:``}},compoundVariants:[{color:`primary`,variant:`solid`,class:`bg-primary text-inverted`},{color:`neutral`,variant:`solid`,class:`bg-neutral text-inverted`},{color:`success`,variant:`solid`,class:`bg-success text-inverted`},{color:`warning`,variant:`solid`,class:`bg-warning text-inverted`},{color:`error`,variant:`solid`,class:`bg-error text-inverted`},{color:`info`,variant:`solid`,class:`bg-info text-inverted`},{color:`primary`,variant:`outline`,class:`text-primary ring ring-inset ring-primary/50`},{color:`neutral`,variant:`outline`,class:`text-neutral ring ring-inset ring-neutral/50`},{color:`success`,variant:`outline`,class:`text-success ring ring-inset ring-success/50`},{color:`warning`,variant:`outline`,class:`text-warning ring ring-inset ring-warning/50`},{color:`error`,variant:`outline`,class:`text-error ring ring-inset ring-error/50`},{color:`info`,variant:`outline`,class:`text-info ring ring-inset ring-info/50`},{color:`primary`,variant:`soft`,class:`bg-primary/10 text-primary`},{color:`neutral`,variant:`soft`,class:`bg-neutral/10 text-neutral`},{color:`success`,variant:`soft`,class:`bg-success/10 text-success`},{color:`warning`,variant:`soft`,class:`bg-warning/10 text-warning`},{color:`error`,variant:`soft`,class:`bg-error/10 text-error`},{color:`info`,variant:`soft`,class:`bg-info/10 text-info`},{color:`primary`,variant:`subtle`,class:`bg-primary/10 text-primary ring ring-inset ring-primary/25`},{color:`neutral`,variant:`subtle`,class:`bg-neutral/10 text-neutral ring ring-inset ring-neutral/25`},{color:`success`,variant:`subtle`,class:`bg-success/10 text-success ring ring-inset ring-success/25`},{color:`warning`,variant:`subtle`,class:`bg-warning/10 text-warning ring ring-inset ring-warning/25`},{color:`error`,variant:`subtle`,class:`bg-error/10 text-error ring ring-inset ring-error/25`},{color:`info`,variant:`subtle`,class:`bg-info/10 text-info ring ring-inset ring-info/25`},{color:`neutral`,variant:`solid`,class:`text-inverted bg-inverted`},{color:`neutral`,variant:`outline`,class:`ring ring-inset ring-accented text-default bg-default`},{color:`neutral`,variant:`soft`,class:`text-default bg-elevated`},{color:`neutral`,variant:`subtle`,class:`ring ring-inset ring-accented text-default bg-elevated`},{size:`xs`,square:!0,class:`p-0.5`},{size:`sm`,square:!0,class:`p-1`},{size:`md`,square:!0,class:`p-1`},{size:`lg`,square:!0,class:`p-1`},{size:`xl`,square:!0,class:`p-1`}],defaultVariants:{color:`primary`,variant:`solid`,size:`md`}},Ta={__name:`UBadge`,props:{as:{type:null,required:!1,default:`span`},label:{type:[String,Number],required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1}},setup(e){let t=e,r=O(),i=J(`badge`,t),a=$n(),{orientation:o,size:s}=Le(t),{isLeading:c,isTrailing:l,leadingIconName:u,trailingIconName:p}=Pt(i),h=n(()=>Ne({extend:wa,...a.ui?.badge||{}})({color:i.color,variant:i.variant,size:s.value??i.size,square:i.square||!r.default&&!i.label,fieldGroup:o.value}));return(e,t)=>(_(),m(f(ht),{as:f(i).as,"data-slot":`base`,class:j(h.value.base({class:[f(i).ui?.base,f(i).class]}))},{default:H(()=>[d(e.$slots,`leading`,{ui:h.value},()=>[f(c)&&f(u)?(_(),m(qe,{key:0,name:f(u),"data-slot":`leadingIcon`,class:j(h.value.leadingIcon({class:f(i).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(i).avatar?(_(),m(dt,z({key:1,size:f(i).ui?.leadingAvatarSize||h.value.leadingAvatarSize()},f(i).avatar,{"data-slot":`leadingAvatar`,class:h.value.leadingAvatar({class:f(i).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)]),d(e.$slots,`default`,{ui:h.value},()=>[f(i).label!==void 0&&f(i).label!==null?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(h.value.label({class:f(i).ui?.label}))},M(f(i).label),3)):g(``,!0)]),d(e.$slots,`trailing`,{ui:h.value},()=>[f(l)&&f(p)?(_(),m(qe,{key:0,name:f(p),"data-slot":`trailingIcon`,class:j(h.value.trailingIcon({class:f(i).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)])]),_:3},8,[`as`,`class`]))}},Ea={slots:{root:`flex items-center gap-2`,list:`relative flex p-1 group`,indicator:`absolute transition-[translate,width] duration-200 ease-out motion-reduce:transition-none`,trigger:[`group relative inline-flex items-center min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75`,`transition-colors`],leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,label:`truncate`,trailingBadge:`shrink-0`,trailingBadgeSize:`sm`,content:`w-full rounded-md focus-visible:outline-3`},variants:{color:{primary:{content:`outline-primary/25`},neutral:{content:`outline-inverted/25`},success:{content:`outline-success/25`},warning:{content:`outline-warning/25`},error:{content:`outline-error/25`},info:{content:`outline-info/25`}},variant:{pill:{list:`bg-elevated rounded-lg`,trigger:[`grow`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:inset-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:rounded-md in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:shadow-xs in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:-z-10 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:isolate`],indicator:`rounded-md shadow-xs`},link:{list:`border-default`,indicator:`rounded-full`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:rounded-full`}},orientation:{horizontal:{root:`flex-col`,list:`w-full`,indicator:`left-0 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position)`,trigger:`justify-center`},vertical:{list:`flex-col`,indicator:`top-0 h-(--reka-tabs-indicator-size) translate-y-(--reka-tabs-indicator-position)`}},size:{xs:{trigger:`px-2 py-1 text-xs gap-1`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},sm:{trigger:`px-2.5 py-1.5 text-xs gap-1.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},md:{trigger:`px-3 py-1.5 text-sm gap-1.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},lg:{trigger:`px-3 py-2 text-sm gap-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},xl:{trigger:`px-3 py-2 text-base gap-2`,leadingIcon:`size-6`,leadingAvatarSize:`xs`}}},compoundVariants:[{orientation:`horizontal`,variant:`pill`,class:{indicator:`inset-y-1`}},{orientation:`horizontal`,variant:`link`,class:{list:`border-b -mb-px`,indicator:`-bottom-px h-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-x-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-bottom-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:h-px`}},{orientation:`vertical`,variant:`pill`,class:{indicator:`inset-x-1`,list:`items-center`,trigger:`w-full justify-center`}},{orientation:`vertical`,variant:`link`,class:{list:`border-s -ms-px`,indicator:`-start-px w-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-y-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-start-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:w-px`}},{color:`primary`,variant:`pill`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-inverted outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-primary`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-inverted outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-neutral`]}},{color:`success`,variant:`pill`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-inverted outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-success`]}},{color:`warning`,variant:`pill`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-inverted outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-warning`]}},{color:`error`,variant:`pill`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-inverted outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-error`]}},{color:`info`,variant:`pill`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-inverted outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-info`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-inverted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-inverted`]}},{color:`primary`,variant:`link`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-primary outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-primary`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-neutral outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-neutral`]}},{color:`success`,variant:`link`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-success outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-success`]}},{color:`warning`,variant:`link`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-warning outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-warning`]}},{color:`error`,variant:`link`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-error outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-error`]}},{color:`info`,variant:`link`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-info outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-info`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-highlighted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-inverted`]}}],defaultVariants:{color:`primary`,variant:`pill`,size:`md`}},Da={__name:`UTabs`,props:{as:{type:null,required:!1},items:{type:Array,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:`horizontal`},content:{type:Boolean,required:!1,default:!0},valueKey:{type:null,required:!1,default:`value`},labelKey:{type:null,required:!1,default:`label`},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultValue:{type:[String,Number],required:!1,default:`0`},modelValue:{type:[String,Number],required:!1},activationMode:{type:String,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,o=r,s=O(),c=J(`tabs`,i),l=$n(),u=Ce(Re(c,`as`,`unmountOnHide`),o),p=n(()=>Ne({extend:Ea,...l.ui?.tabs||{}})({color:c.color,variant:c.variant,size:c.size,orientation:c.orientation})),b=h([]);function x(e,t){b.value[e]=t}return t({triggersRef:b}),(e,t)=>(_(),m(f(da),z(f(u),{"model-value":f(c).modelValue,"default-value":f(c).defaultValue,orientation:f(c).orientation,"activation-mode":f(c).activationMode,"data-slot":`root`,class:p.value.root({class:[f(c).ui?.root,f(c).class]})}),{default:H(()=>[E(f(ga),{"data-slot":`list`,class:j(p.value.list({class:f(c).ui?.list}))},{default:H(()=>[E(f(ha),{"data-slot":`indicator`,class:j(p.value.indicator({class:f(c).ui?.indicator}))},null,8,[`class`]),d(e.$slots,`list-leading`),(_(!0),v(k,null,y(f(c).items,(t,n)=>(_(),m(f(_a),{key:f(jt)(t,f(c).valueKey)??n,ref_for:!0,ref:e=>x(n,e),value:f(jt)(t,f(c).valueKey)??String(n),disabled:t.disabled,"data-slot":`trigger`,class:j(p.value.trigger({class:[f(c).ui?.trigger,t.ui?.trigger]}))},{default:H(()=>[d(e.$slots,`leading`,{item:t,index:n,ui:p.value},()=>[t.icon?(_(),m(qe,{key:0,name:t.icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:[f(c).ui?.leadingIcon,t.ui?.leadingIcon]}))},null,8,[`name`,`class`])):t.avatar?(_(),m(dt,z({key:1,size:t.ui?.leadingAvatarSize||f(c).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},{ref_for:!0},t.avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:[f(c).ui?.leadingAvatar,t.ui?.leadingAvatar]})}),null,16,[`size`,`class`])):g(``,!0)]),f(jt)(t,f(c).labelKey)||s.default?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(p.value.label({class:[f(c).ui?.label,t.ui?.label]}))},[d(e.$slots,`default`,{item:t,index:n},()=>[a(M(f(jt)(t,f(c).labelKey)),1)])],2)):g(``,!0),d(e.$slots,`trailing`,{item:t,index:n,ui:p.value},()=>[t.badge||t.badge===0?(_(),m(Ta,z({key:0,color:`neutral`,variant:`outline`,size:t.ui?.trailingBadgeSize||f(c).ui?.trailingBadgeSize||p.value.trailingBadgeSize()},{ref_for:!0},typeof t.badge==`string`||typeof t.badge==`number`?{label:t.badge}:t.badge,{"data-slot":`trailingBadge`,class:p.value.trailingBadge({class:[f(c).ui?.trailingBadge,t.ui?.trailingBadge]})}),null,16,[`size`,`class`])):g(``,!0)])]),_:2},1032,[`value`,`disabled`,`class`]))),128)),d(e.$slots,`list-trailing`)]),_:3},8,[`class`]),f(c).content?(_(!0),v(k,{key:0},y(f(c).items,(t,n)=>(_(),m(f(ma),{key:f(jt)(t,f(c).valueKey)??n,value:f(jt)(t,f(c).valueKey)??String(n),"data-slot":`content`,class:j(p.value.content({class:[f(c).ui?.content,t.ui?.content,t.class]}))},{default:H(()=>[d(e.$slots,t.slot||`content`,{item:t,index:n,ui:p.value},()=>[a(M(t.content),1)])]),_:2},1032,[`value`,`class`]))),128)):g(``,!0)]),_:3},16,[`model-value`,`default-value`,`orientation`,`activation-mode`,`class`]))}},Oa=`input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .term, .chat-list, .msg`,ka=`button, a, [role="tab"], [role="button"]:not(.plan-cell), .cell-grip, ${Oa}`;function Aa(e){return!!e?.closest?.(Oa)}function ja(e){return!!e?.closest?.(ka)}var Ma=Object.assign(ra(T({__name:`HeaderMenu`,props:{items:{type:Function},title:{},disabled:{type:Boolean},manualPress:{type:Boolean}},setup(e){let t=e,n=h([]);function r(){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0}))}function i(e){e?(n.value=se(t.items()),window.addEventListener(`scroll`,r,{capture:!0,passive:!0})):window.removeEventListener(`scroll`,r,{capture:!0})}l(()=>window.removeEventListener(`scroll`,r,{capture:!0}));let a=``;function o(e){Aa(e.target)?e.stopPropagation():ui.value&&(e.preventDefault(),a===`mouse`&&!t.disabled&&we(t.items(),t.title))}let s=Kt({onPress:()=>{X(),we(t.items(),t.title)}});function c(e){a=e.pointerType,!(!ui.value||t.disabled||t.manualPress||ja(e.target))&&s.down(e)}return(t,r)=>{let a=Ut;return _(),m(a,{disabled:(`sheetMenus`in t?t.sheetMenus:f(ui))||e.disabled,items:f(n),ui:{content:`hw-dropdown`},"onUpdate:open":i},{default:H(()=>[I(`div`,{class:`header-menu`,onContextmenuCapture:o,onPointerdown:c,onPointermove:r[0]||=(...e)=>f(s).move&&f(s).move(...e),onPointerup:r[1]||=(...e)=>f(s).cancel&&f(s).cancel(...e),onPointercancel:r[2]||=(...e)=>f(s).cancel&&f(s).cancel(...e)},[d(t.$slots,`default`,{},void 0,!0)],32)]),_:3},8,[`disabled`,`items`])}}}),[[`__scopeId`,`data-v-562a5bfa`]]),{__name:`HeaderMenu`}),Na=Object.assign(ra(T({__name:`GridBackdrop`,setup(e){let t=h(null),n=h(null),r=h(!1),i,a=!1,o=0,s;function c(){let e=n.value;if(!e||o>=3)return;let t=Ee(e.clientWidth,e.clientHeight),r=document.createElement(`i`);r.className=`pkt ${t.vertical?`v`:`h`}${t.reverse?` rev`:``}${t.alt?` alt`:``}`,r.style.left=`${t.left}px`,r.style.top=`${t.top}px`;let i=t.vertical?`Y`:`X`;e.appendChild(r),o++;let a=r.animate([{transform:`translate${i}(${t.reverse?t.dist:0}px)`,opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.7},{transform:`translate${i}(${t.reverse?0:t.dist}px)`,opacity:0}],{duration:t.duration,easing:`cubic-bezier(.4, 0, .6, 1)`});a.onfinish=()=>{r.remove(),o--}}function l(){clearTimeout(s),!a&&ve.value&&r.value&&!document.hidden&&(s=setTimeout(()=>{c(),l()},de()))}return B([r,ve],l),w(()=>{a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,document.addEventListener(`visibilitychange`,l),t.value&&(i=new IntersectionObserver(([e])=>{r.value=!!e?.isIntersecting}),i.observe(t.value))}),U(()=>{i?.disconnect(),document.removeEventListener(`visibilitychange`,l),clearTimeout(s)}),(e,r)=>(_(),v(`div`,{ref_key:`root`,ref:t,class:`grid-backdrop`,"aria-hidden":`true`},[r[0]||=I(`div`,{class:`gbd-dots`},null,-1),I(`div`,{ref_key:`packets`,ref:n,class:`gbd-packets`},null,512),r[1]||=I(`div`,{class:`gbd-vignette`},null,-1)],512))}}),[[`__scopeId`,`data-v-a290ab6b`]]),{__name:`GridBackdrop`}),Pa={class:`chat-skel`,"aria-hidden":`true`},Fa=Object.assign(T({__name:`ChatSkeleton`,props:{agent:{}},setup(e){return(t,n)=>(_(),v(`div`,Pa,[n[0]||=I(`div`,{class:`skel-user`},[I(`i`,{style:{width:`78%`}}),I(`i`,{style:{width:`52%`}})],-1),I(`div`,{class:j([`skel-who`,e.agent||``])},null,2),n[1]||=te(`<div class="skel-tool"><span></span><i style="width:62%;"></i></div><div class="skel-lines"><i style="width:92%;"></i><i style="width:84%;"></i><i style="width:66%;"></i></div><div class="skel-user"><i style="width:64%;"></i></div>`,3),I(`div`,{class:j([`skel-who`,e.agent||``])},null,2),n[2]||=te(`<div class="skel-lines"><i style="width:90%;"></i><i style="width:86%;"></i><i style="width:80%;"></i><i style="width:42%;"></i></div>`,1)]))}}),{__name:`ChatSkeleton`}),Ia=[`aria-expanded`],La=Object.assign(T({__name:`FoldText`,props:{lines:{}},setup(e){let t=e,r=n(()=>t.lines||12),i=h(null),a=h(!1),o=h(!1),s=null;function l(){let e=i.value;if(!e)return;let t=(Number.parseFloat(getComputedStyle(e).lineHeight)||22.5)*(r.value+.5);a.value=e.scrollHeight>t}return w(()=>{l(),s=new ResizeObserver(l),i.value&&s.observe(i.value)}),c(l),U(()=>s?.disconnect()),(e,n)=>(_(),v(k,null,[I(`span`,{ref_key:`box`,ref:i,class:j([`msg-fold`,{folded:f(a)&&!f(o)}]),style:N({display:`block`,"--fold-max":t.lines?`calc(${t.lines}lh)`:void 0})},[d(e.$slots,`default`)],6),f(a)?(_(),v(`button`,{key:0,type:`button`,class:`msg-fold-btn`,"aria-expanded":f(o),onClick:n[0]||=e=>o.value=!f(o)},M(f(o)?(`tl`in e?e.tl:f(Z))(`Show less`,`Afficher moins`):(`tl`in e?e.tl:f(Z))(`Show more`,`Afficher plus`)),9,Ia)):g(``,!0)],64))}}),{__name:`FoldText`}),Ra={key:0,class:`offline-image`},za=[`src`,`onClick`],Ba=[`aria-label`],Va=[`src`],Ha=[`disabled`,`onClick`],Ua=Object.assign(T({__name:`MsgThumbs`,props:{srcs:{},offline:{type:Boolean},max:{},dupes:{}},setup(e){let t=e,r=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>!t.dupes?.has(e.src))),i=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>t.dupes?.has(e.src))),a=n(()=>Cn(r.value.length,t.max));function o(e){Ft(t.srcs,e)}return(t,n)=>(_(),v(`span`,{class:j([`thumbs`,{one:f(r).length===1}])},[(_(!0),v(k,null,y(f(r).slice(0,f(a).shown),n=>(_(),v(`span`,{key:n.src},[e.offline?(_(),v(`span`,Ra,M((`t`in t?t.t:f(Q))(`Image unavailable offline`)),1)):(_(),v(`img`,{key:1,class:`msg-img`,src:n.src,alt:``,loading:`lazy`,decoding:`async`,onClick:e=>o(n.i)},null,8,za))]))),128)),f(a).more?(_(),v(`button`,{key:0,type:`button`,class:`thumb-more`,"aria-label":(`tl`in t?t.tl:f(Z))(`Show all ${f(r).length} images`,`Voir les ${f(r).length} images`),onClick:n[0]||=e=>o(f(r)[f(a).shown].i)},[e.offline?g(``,!0):(_(),v(`img`,{key:0,src:f(r)[f(a).shown].src,alt:``,loading:`lazy`,decoding:`async`},null,8,Va)),I(`span`,null,`+`+M(f(a).more),1)],8,Ba)):g(``,!0),(_(!0),v(k,null,y(f(i),n=>(_(),v(`button`,{key:n.src,type:`button`,class:`thumb-dupe`,disabled:e.offline,onClick:e=>o(n.i)},` ↑ `+M((`tl`in t?t.tl:f(Z))(`Same image as above`,`Image déjà affichée plus haut`)),9,Ha))),128))],2))}}),{__name:`MsgThumbs`}),Wa={class:`file-chip-icon`},Ga={key:0,class:`spinner`},Ka={class:`file-chip-body`},qa={class:`file-chip-name`},Ja={class:`file-chip-meta`},Ya=[`aria-label`],Xa=Object.assign(T({__name:`FileChip`,props:{name:{},size:{},kind:{},uploading:{type:Boolean},removable:{type:Boolean},clickable:{type:Boolean}},emits:[`remove`,`open`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>En(r.name,r.kind)),o=n(()=>pn(r.name).slice(0,6)||(r.kind===`text`?`txt`:``));function s(e){r.clickable&&i(`open`,e.currentTarget)}return(t,n)=>{let r=qe;return _(),m(C(e.clickable?`button`:`div`),{type:e.clickable?`button`:void 0,class:j([`file-chip`,{up:e.uploading,clickable:e.clickable}]),title:e.name,onClick:s},{default:H(()=>[I(`span`,Wa,[e.uploading?(_(),v(`span`,Ga)):(_(),m(r,{key:1,name:f(a)},null,8,[`name`]))]),I(`span`,Ka,[I(`span`,qa,M(e.name),1),I(`span`,Ja,M([f(o),e.size?f(Fn)(e.size):``].filter(Boolean).join(` · `)),1)]),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`file-chip-x`,"aria-label":(`t`in t?t.t:f(Q))(`Remove`),onClick:n[0]||=q(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,Ya)):g(``,!0)]),_:1},8,[`type`,`class`,`title`])}}}),{__name:`FileChip`}),Za={key:0,class:`msg-ref-meta`},Qa={class:`msg-ref-text`},$a={key:1,class:`msg-q`},eo=Object.assign(T({__name:`QuotedText`,props:{text:{}},setup(e){let t=e,r=n(()=>Ti(t.text).map(e=>e.kind===`ref`?e:{...e,text:e.text.replace(/^\n+|\n+$/g,``)}).filter(e=>e.kind===`ref`||e.text)),i=A(`gotoRef`,null),o=e=>e.kind===`task`?e.label.replace(/\s*:$/,``):[e.time,e.n?`#${e.n}`:``].filter(Boolean).join(` · `);return(e,t)=>(_(!0),v(k,null,y(f(r),(n,r)=>(_(),v(k,{key:r},[n.kind===`ref`?(_(),m(C(f(i)&&n.ref.kind!==`task`?`button`:`span`),{key:0,class:`msg-ref`,"data-kind":n.ref.kind,type:f(i)&&n.ref.kind!==`task`?`button`:void 0,"aria-label":f(i)&&n.ref.kind!==`task`?`${(`t`in e?e.t:f(Q))(`Show original message`)}: ${n.ref.excerpt}`:void 0,onClick:e=>f(i)&&n.ref.kind!==`task`&&f(i)(n.ref,e.currentTarget)},{default:H(()=>[t[0]||=I(`span`,{class:`msg-ref-mark`,"aria-hidden":`true`},`↳`,-1),o(n.ref)?(_(),v(`span`,Za,M(o(n.ref)),1)):g(``,!0),I(`span`,Qa,M(n.ref.excerpt),1)]),_:2},1032,[`data-kind`,`type`,`aria-label`,`onClick`])):n.kind===`quote`?(_(),v(`span`,$a,M(n.text),1)):(_(),v(k,{key:2},[a(M(n.text),1)],64))],64))),128))}}),{__name:`QuotedText`}),to=[`aria-label`],no={class:`pasted-head`},ro=[`aria-label`],io={class:`pasted-foot`},ao=Object.assign(T({__name:`PastedCard`,props:{text:{},removable:{type:Boolean}},emits:[`remove`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=n(()=>ut(r.text)),c=n(()=>r.text.split(`
2
+ `).filter(e=>e.trim()).slice(0,2).map(e=>e.trim())),l=n(()=>St(r.text)),u=n(()=>Z(`Pasted text · ${s.value} line${s.value>1?`s`:``}`,`Texte collé · ${s.value} ligne${s.value>1?`s`:``}`));async function d(){try{await navigator.clipboard.writeText(r.text),$(Z(`Text copied`,`Texte copié`))}catch{$(Q(`Copy failed`),!0)}}return(t,n)=>{let r=qe,s=Et,p=Wt;return _(),v(`div`,{class:j([`pasted-card`,{removable:e.removable}])},[I(`button`,{type:`button`,class:`pasted-open`,"aria-label":(`tl`in t?t.tl:f(Z))(`Open pasted text`,`Ouvrir le texte collé`),onClick:n[0]||=e=>o.value=!0},[I(`span`,no,[E(r,{name:`i-lucide-clipboard-paste`}),a(M(f(u)),1)]),(_(!0),v(k,null,y(f(c),(e,t)=>(_(),v(`span`,{key:t,class:`pasted-line`},M(e),1))),128))],8,to),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`pasted-x`,"aria-label":(`t`in t?t.t:f(Q))(`Remove`),onClick:n[1]||=q(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,ro)):g(``,!0),E(p,{open:f(o),"onUpdate:open":n[2]||=e=>W(o)?o.value=e:null,title:f(u),wide:``,tall:``},{footer:H(()=>[I(`div`,io,[E(s,{icon:`i-lucide-copy`,color:`neutral`,variant:`outline`,onClick:d},{default:H(()=>[a(M((`tl`in t?t.tl:f(Z))(`Copy`,`Copier`)),1)]),_:1})])]),default:H(()=>[I(`pre`,{class:j([`pasted-full`,{mono:f(l)}])},M(e.text),3)]),_:1},8,[`open`,`title`])],2)}}}),{__name:`PastedCard`}),oo={key:1,class:`msg-pastes`},so=Object.assign(T({__name:`UserText`,props:{text:{},pasted:{}},setup(e){let t=e,r=n(()=>tt(t.text,t.pasted,Ze.value));return(e,t)=>{let n=eo,i=La,a=ao;return _(),v(k,null,[f(r).text?(_(),m(i,{key:0},{default:H(()=>[E(n,{text:f(r).text},null,8,[`text`])]),_:1})):g(``,!0),f(r).pastes.length?(_(),v(`span`,oo,[(_(!0),v(k,null,y(f(r).pastes,(e,t)=>(_(),m(a,{key:t,text:e},null,8,[`text`]))),128))])):g(``,!0)],64)}}}),{__name:`UserText`}),co={slots:{root:`group/message relative w-full`,header:`flex mb-1.5`,container:`relative flex items-start`,body:`min-w-0`,leading:`inline-flex items-center justify-center min-h-6`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,files:`flex items-center gap-1.5`,content:`relative text-pretty wrap-break-word *:first:mt-0 *:last:mb-0`,actions:[`[@media(hover:hover)]:opacity-0 group-hover/message:opacity-100 absolute bottom-0 flex items-center`,`transition-opacity ease-out`]},variants:{variant:{solid:``,outline:``,soft:``,subtle:``,naked:``},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},side:{left:{},right:{container:`justify-end ms-auto max-w-[75%]`,header:`justify-end`,actions:`right-0`}},leading:{true:``},actions:{true:``},compact:{true:{root:`scroll-mt-3`,container:`gap-1.5 pb-3`,content:`space-y-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},false:{root:`scroll-mt-4 sm:scroll-mt-6`,container:`gap-3 pb-8`,content:`space-y-4`,leadingIcon:`size-8`,leadingAvatarSize:`md`}}},compoundVariants:[{compact:!0,actions:!0,class:{container:`pb-8`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!1,class:{content:`px-4 py-3 rounded-lg min-h-12`,leading:`mt-2`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!0,class:{content:`px-2 py-1 rounded-lg min-h-8`,leading:`mt-1`}},{variant:`naked`,side:`left`,class:{body:`w-full`,content:`w-full`}},{color:`primary`,variant:`solid`,class:{content:`bg-primary text-inverted`}},{color:`neutral`,variant:`solid`,class:{content:`bg-neutral text-inverted`}},{color:`success`,variant:`solid`,class:{content:`bg-success text-inverted`}},{color:`warning`,variant:`solid`,class:{content:`bg-warning text-inverted`}},{color:`error`,variant:`solid`,class:{content:`bg-error text-inverted`}},{color:`info`,variant:`solid`,class:{content:`bg-info text-inverted`}},{color:`primary`,variant:`outline`,class:{content:`text-primary ring ring-primary/25`}},{color:`neutral`,variant:`outline`,class:{content:`text-neutral ring ring-neutral/25`}},{color:`success`,variant:`outline`,class:{content:`text-success ring ring-success/25`}},{color:`warning`,variant:`outline`,class:{content:`text-warning ring ring-warning/25`}},{color:`error`,variant:`outline`,class:{content:`text-error ring ring-error/25`}},{color:`info`,variant:`outline`,class:{content:`text-info ring ring-info/25`}},{color:`primary`,variant:`soft`,class:{content:`bg-primary/10 text-primary`}},{color:`neutral`,variant:`soft`,class:{content:`bg-neutral/10 text-neutral`}},{color:`success`,variant:`soft`,class:{content:`bg-success/10 text-success`}},{color:`warning`,variant:`soft`,class:{content:`bg-warning/10 text-warning`}},{color:`error`,variant:`soft`,class:{content:`bg-error/10 text-error`}},{color:`info`,variant:`soft`,class:{content:`bg-info/10 text-info`}},{color:`primary`,variant:`subtle`,class:{content:`bg-primary/10 text-primary ring ring-primary/25`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-neutral/10 text-neutral ring ring-neutral/25`}},{color:`success`,variant:`subtle`,class:{content:`bg-success/10 text-success ring ring-success/25`}},{color:`warning`,variant:`subtle`,class:{content:`bg-warning/10 text-warning ring ring-warning/25`}},{color:`error`,variant:`subtle`,class:{content:`bg-error/10 text-error ring ring-error/25`}},{color:`info`,variant:`subtle`,class:{content:`bg-info/10 text-info ring ring-info/25`}},{color:`primary`,variant:`naked`,class:{content:`text-primary`}},{color:`neutral`,variant:`naked`,class:{content:`text-neutral`}},{color:`success`,variant:`naked`,class:{content:`text-success`}},{color:`warning`,variant:`naked`,class:{content:`text-warning`}},{color:`error`,variant:`naked`,class:{content:`text-error`}},{color:`info`,variant:`naked`,class:{content:`text-info`}},{color:`neutral`,variant:`solid`,class:{content:`bg-inverted text-inverted`}},{color:`neutral`,variant:`outline`,class:{content:`bg-default ring ring-default`}},{color:`neutral`,variant:`soft`,class:{content:`bg-elevated/50`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-elevated/50 ring ring-default`}}],defaultVariants:{side:`left`,variant:`naked`,color:`neutral`}},lo={__name:`UChatMessage`,props:{as:{type:null,required:!1,default:`article`},icon:{type:null,required:!1},avatar:{type:Object,required:!1},variant:{type:null,required:!1},color:{type:null,required:!1},side:{type:null,required:!1},actions:{type:Array,required:!1},compact:{type:Boolean,required:!1},content:{type:String,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},id:{type:String,required:!0},role:{type:String,required:!0},metadata:{type:null,required:!1},parts:{type:Array,required:!0}},setup(e){let r=e,i=O(),o=J(`chatMessage`,r),s=$n(),c=n(()=>o.parts?.filter(e=>e.type===`file`)??[]),l=n(()=>o.parts?.filter(e=>e.type===`text`)??[]),u=n(()=>$e(o,[`as`,`icon`,`avatar`,`variant`,`color`,`side`,`actions`,`compact`,`class`,`ui`,`content`])),p=n(()=>Ne({extend:co,...s.ui?.chatMessage||{}})({variant:o.variant,color:o.color,side:o.side,leading:!!o.icon||!!o.avatar||!!i.leading,actions:!!o.actions||!!i.actions,compact:o.compact}));return(e,n)=>(_(),m(f(ht),{as:f(o).as,"data-role":f(o).role,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]}))},{default:H(()=>[i.files&&c.value.length||i.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(p.value.header({class:f(o).ui?.header}))},[d(e.$slots,`header`,R(t({...u.value})),()=>[i.files&&c.value.length?(_(),v(`div`,{key:0,"data-slot":`files`,class:j(p.value.files({class:f(o).ui?.files}))},[d(e.$slots,`files`,R(t({...u.value,parts:c.value})))],2)):g(``,!0)])],2)):g(``,!0),I(`div`,{"data-slot":`container`,class:j(p.value.container({class:f(o).ui?.container}))},[f(o).icon||f(o).avatar||i.leading?(_(),v(`div`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[d(e.$slots,`leading`,R(t({...u.value,avatar:f(o).avatar,ui:p.value})),()=>[f(o).icon?(_(),m(qe,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(o).avatar?(_(),m(dt,z({key:1,size:f(o).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},f(o).avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:f(o).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)])],2)):g(``,!0),f(o).content||l.value.length||i.content||f(o).actions||i.actions||i.body?(_(),v(`div`,{key:1,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body}))},[d(e.$slots,`body`,R(t({...u.value})),()=>[f(o).content||l.value.length||i.content?(_(),v(`div`,{key:0,"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},[d(e.$slots,`content`,R(t({...u.value,content:f(o).content})),()=>[f(o).content?(_(),v(k,{key:0},[a(M(f(o).content),1)],64)):(_(!0),v(k,{key:1},y(l.value,(e,t)=>(_(),v(k,{key:`${f(o).id}-${e.type}-${t}`},[a(M(e.text),1)],64))),128))])],2)):g(``,!0),f(o).actions||i.actions?(_(),v(`div`,{key:1,"data-slot":`actions`,class:j(p.value.actions({class:f(o).ui?.actions}))},[d(e.$slots,`actions`,R(t({...u.value,actions:f(o).actions})),()=>[(_(!0),v(k,null,y(f(o).actions,(e,t)=>(_(),m(ct,{key:t,text:e.label},{default:H(()=>[E(Et,z({size:`sm`,color:`neutral`,variant:`ghost`},{ref_for:!0},f($e)(e,[`onClick`]),{label:void 0,onClick:t=>typeof e.onClick==`function`?e.onClick(t,u.value):void 0}),null,16,[`onClick`])]),_:2},1032,[`text`]))),128))])],2)):g(``,!0)])],2)):g(``,!0)],2)]),_:3},8,[`as`,`data-role`,`class`]))}};function uo(e,t={}){let{arrivedState:r}=mt(e);return{style:n(()=>{let n=o(e),i=o(t.orientation)??`vertical`,[a,s]=i===`horizontal`?[`left`,`right`]:[`top`,`bottom`],c=!r[a],l=!r[s];if(!c&&!l||!(n&&(i===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight)))return;let u=`${o(t.size)??24}px`,d=i===`horizontal`?`90deg`:`180deg`;return c&&l?{maskImage:`linear-gradient(${d}, transparent, #000 ${u}, #000 calc(100% - ${u}), transparent)`}:c?{maskImage:`linear-gradient(${d}, transparent, #000 ${u})`}:{maskImage:`linear-gradient(${d}, #000, #000 calc(100% - ${u}), transparent)`}}),isOverflowing:n(()=>{r.top,r.bottom,r.left,r.right;let n=o(e);return n?(o(t.orientation)??`vertical`)===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight:!1}),arrivedState:r}}var fo={base:`text-transparent bg-clip-text bg-no-repeat bg-size-[calc(200%+var(--spread)*2+2px)_100%,auto] bg-[image:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--ui-text-highlighted),#0000_calc(50%+var(--spread))),linear-gradient(var(--ui-text-muted),var(--ui-text-muted))] motion-safe:animate-[shimmer_var(--duration)_linear_infinite] motion-safe:rtl:animate-[shimmer-rtl_var(--duration)_linear_infinite] will-change-[background-position] motion-reduce:bg-none motion-reduce:text-muted`},po={__name:`UChatShimmer`,props:{as:{type:null,required:!1,default:`span`},text:{type:String,required:!0},duration:{type:Number,required:!1,default:2},spread:{type:Number,required:!1,default:2},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){let t=J(`chatShimmer`,e),r=$n(),i=n(()=>Ne({extend:fo,...r.ui?.chatShimmer||{}})),o=n(()=>t.text.length*t.spread);return(e,n)=>(_(),m(f(ht),{as:f(t).as,style:N({"--spread":`${o.value}px`,"--duration":`${f(t).duration}s`}),"data-slot":`base`,class:j(i.value({class:[f(t).ui?.base,f(t).class]}))},{default:H(()=>[a(M(f(t).text),1)]),_:1},8,[`as`,`style`,`class`]))}},mo={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default rounded-sm outline-primary/25 focus-visible:outline-3 min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden rounded-sm outline-primary/25 has-focus-visible:outline-3`,body:`max-h-[200px] pt-2 overflow-y-auto text-sm text-dimmed whitespace-pre-wrap focus:outline-none`},variants:{chevron:{leading:{leadingIcon:`group-hover:opacity-0`},trailing:``},alone:{false:{leadingIcon:[`absolute inset-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},ho={__name:`UChatReasoning`,props:{text:{type:String,required:!1},streaming:{type:Boolean,required:!1,default:!1},duration:{type:Number,required:!1},icon:{type:null,required:!1},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},autoCloseDelay:{type:Number,required:!1,default:500},shimmer:{type:Object,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=J(`chatReasoning`,r),{t:s,code:c}=ln(),u=$n(),p=n(()=>Ne({extend:mo,...u.ui?.chatReasoning||{}})({chevron:o.chevron})),y=n(()=>o.open!==void 0),x=h(o.defaultOpen??o.streaming),S=h(o.streaming?Date.now():null),C=h(void 0),w=h(null);B(()=>o.streaming,(e,t)=>{e?(w.value&&=(clearTimeout(w.value),null),t||(k(!0),S.value=Date.now())):t&&(S.value!==null&&(C.value=Math.ceil((Date.now()-S.value)/1e3),S.value=null),o.autoCloseDelay>0&&(w.value=setTimeout(()=>{k(!1)},o.autoCloseDelay)))},{immediate:!0});let T=n(()=>o.duration??C.value),D=n(()=>{if(o.streaming||T.value===0)return s(`chatReasoning.thinking`);if(T.value===void 0)return s(`chatReasoning.thought`);let e=T.value,t=e<60?`second`:`minute`,n=e<60?e:Math.floor(e/60),r=new Intl.NumberFormat(c.value,{style:`unit`,unit:t,unitDisplay:`long`}).format(n);return s(`chatReasoning.thoughtFor`,{duration:r})}),O=n(()=>y.value?o.open:x.value);function k(e){w.value&&=(clearTimeout(w.value),null),x.value=e,i(`update:open`,e)}l(()=>{w.value&&clearTimeout(w.value)});let A=n(()=>!!o.text||o.streaming),F=n(()=>o.chevronIcon||u.ui.icons?.chevronDown),L=b(`bodyRef`),{style:R}=uo(L);return B(()=>o.text,()=>{if(!o.streaming||!L.value)return;let e=L.value;e.scrollHeight-e.scrollTop-e.clientHeight<50&&P(()=>{e.scrollTop=e.scrollHeight})}),(e,t)=>A.value?(_(),m(f(oa),{key:0,open:O.value,disabled:f(o).disabled,"unmount-on-hide":f(o).unmountOnHide,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]})),"onUpdate:open":k},{default:H(({open:t})=>[E(f(ca),{"as-child":``,disabled:!A.value},{default:H(()=>[I(`button`,{type:`button`,"data-slot":`trigger`,class:j(p.value.trigger({class:f(o).ui?.trigger}))},[f(o).icon||A.value&&f(o).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[f(o).icon?(_(),m(qe,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon,alone:!(A.value&&f(o).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),A.value&&f(o).chevron===`leading`?(_(),m(qe,{key:1,name:F.value,"data-slot":`chevronIcon`,class:j(p.value.chevronIcon({class:f(o).ui?.chevronIcon,alone:!f(o).icon}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),f(o).streaming?(_(),m(po,z({key:1,text:D.value},f(o).shimmer,{"data-slot":`label`,class:p.value.label({class:f(o).ui?.label})}),null,16,[`text`,`class`])):(_(),v(`span`,{key:2,"data-slot":`label`,class:j(p.value.label({class:f(o).ui?.label}))},M(D.value),3)),A.value&&f(o).chevron===`trailing`?(_(),m(qe,{key:3,name:F.value,"data-slot":`trailingIcon`,class:j(p.value.trailingIcon({class:f(o).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(sa),{"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},{default:H(()=>[I(`div`,{ref_key:`bodyRef`,ref:L,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body})),style:N(f(R))},[d(e.$slots,`default`,{open:t},()=>[a(M(f(o).text),1)])],6)]),_:2},1032,[`class`])]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`])):g(``,!0)}},go=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function _o(e,t=!1){return t?`⠿`:go[Math.floor(Math.max(0,e)/80)%go.length]}function vo(e,t){return t?e?1e3:80:null}function yo(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60);return r?`${r}h ${i}m`:i?`${i}m ${n%60}s`:`${n}s`}var bo={class:`omp-spinner`,"aria-hidden":`true`},xo={key:0,class:`omp-elapsed`},So=Object.assign(T({__name:`OmpSpinner`,props:{since:{}},setup(e){let t=e,r=h(0),i=h(Date.now()),a=n(()=>_o(i.value-r.value,Oi.value)),o=n(()=>t.since?yo(t.since,i.value):``),s;function c(){s&&clearInterval(s),s=void 0}function l(){i.value=Date.now()}function u(){c();let e=vo(Oi.value,qr.value);e!==null&&(l(),s=ur(l,e))}return w(()=>{B(Oi,()=>{r.value=i.value=Date.now(),u()},{immediate:!0}),B(qr,u)}),U(c),(e,t)=>(_(),v(k,null,[I(`span`,bo,M(f(a)),1),d(e.$slots,`default`),f(o)?(_(),v(`span`,xo,M(f(o)),1)):g(``,!0)],64))}}),{__name:`OmpSpinner`}),Co=Object.assign(T({__name:`OmpElapsed`,props:{since:{}},setup(e){let t=e,n=h(Date.now()),r;return w(()=>{r=ur(()=>{n.value=Date.now()},1e3)}),U(()=>{r&&clearInterval(r)}),(e,r)=>(_(),v(`span`,null,M(f(yo)(t.since,f(n))),1))}}),{__name:`OmpElapsed`});function wo(e){if(!(e>=0))return``;if(e<6e4)return`${(e/1e3).toFixed(2)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h${r}m`:`${r}m${t%60}s`}var To=(e,t,n,r,i)=>`${e} ${e===1?Z(t,r):Z(n,i)}`;function Eo(e){let t=[];return typeof e.matches==`number`?t.push(To(e.matches,`match`,`matches`,`résultat`,`résultats`)+(e.files&&e.files>1&&e.files<e.matches?` ${Z(`in ${e.files} files`,`dans ${e.files} fichiers`)}`:``)):typeof e.files==`number`&&t.push(To(e.files,`file`,`files`,`fichier`,`fichiers`)),e.scope&&t.push(`${Z(`in`,`dans`)} ${e.scope}`),(typeof e.added==`number`||typeof e.removed==`number`)&&t.push(`+${e.added||0}/-${e.removed||0}`),e.job&&t.push(`${Z(`Backgrounded`,`En arrière-plan`)}: ${e.job}`),e.cancelled&&t.push(Z(`cancelled`,`annulée`)),t}function Do(e){return!e.out||!e.outLines?0:Math.max(0,e.outLines-e.out.split(`
3
+ `).length)}function Oo(e){return e.out?To(Math.max(e.outLines||0,e.out.split(`
4
+ `).length),`line`,`lines`,`ligne`,`lignes`):``}function ko(e){if(e.title===`Bash`||e.title===`Python`)return e.target||e.title.toLowerCase();let t=e.title.toLowerCase().replace(/\s+/g,`_`);return e.target?`${t} ${e.target}`:t}function Ao(e,t){let n=Do(e);return{label:e.diff?`Diff`:t?Z(`Error`,`Erreur`):`Output`,earlier:n?`… ${To(n,`earlier line`,`earlier lines`,`ligne avant`,`lignes avant`)}`:``}}var jo=e=>e.reduce((e,t)=>e+(t.omp&&typeof t.omp.ms==`number`?t.omp.ms:0),0),Mo=e=>e.length>0&&e.every(e=>e.omp);function No(e,t){return t||e.length<=3?{hidden:0,rows:e}:{hidden:e.length-3,rows:e.slice(-3)}}var Po={class:`omp-tool-line`},Fo={class:`omp-tool-glyph`,"aria-hidden":`true`},Io={class:`omp-tool-cmd`},Lo={key:0,class:`omp-tool-wall`},Ro={key:1,class:`omp-tool-wall`},zo={class:`omp-tool-sub`},Bo={key:1,class:`omp-tool-intent`},Vo={key:2,class:`omp-tool-result`},Ho={class:`omp-tool-exit`},Uo={key:0,class:`omp-tool-out`},Wo={class:`omp-tool-out-head`},Go={class:`omp-tool-out-label`},Ko={key:0,class:`omp-tool-out-earlier`},qo={class:`omp-tool-out-right`},Jo={key:0,class:`omp-tool-exit`},Yo={key:1},Xo=Object.assign(T({__name:`OmpTool`,props:{tool:{},live:{type:Boolean},run:{type:Boolean}},setup(e){let t=e,r=h(!1),i=n(()=>t.tool.omp),o=n(()=>!!t.tool.error),s=n(()=>Eo(i.value).concat(t.run?[Oo(i.value)].filter(Boolean):[]).join(` · `)),c=n(()=>i.value.exit?String(i.value.exit):``),l=n(()=>t.live||i.value.ms===void 0?``:wo(i.value.ms)),u=n(()=>t.live&&t.tool.ts&&Date.parse(t.tool.ts)||null),d=n(()=>i.value.intent||i.value.title),p=n(()=>!!i.value.out),b=n(()=>Ao(i.value,o.value)),x=n(()=>(i.value.out||``).split(`
5
+ `).map(e=>({text:e,cls:i.value.diff?/^\+\s*\d*\|/.test(e)?`add`:/^-\s*\d*\|/.test(e)?`del`:``:``})));return(t,n)=>{let h=So,S=Co,w=qe,T=po;return _(),v(`div`,{class:j([`omp-tool`,{err:f(o),live:e.live,open:f(r)}])},[(_(),m(C(f(p)?`button`:`div`),{class:`omp-tool-head`,type:f(p)?`button`:void 0,"aria-expanded":f(p)?f(r):void 0,onClick:n[0]||=e=>f(p)&&(r.value=!f(r))},{default:H(()=>[I(`span`,Po,[I(`span`,Fo,[e.live?(_(),m(h,{key:0})):(_(),v(k,{key:1},[a(M(f(o)?`✗`:`❯`),1)],64))]),I(`code`,Io,M(f(ko)(f(i))),1),f(u)?(_(),v(`span`,Lo,[E(S,{since:f(u)},null,8,[`since`])])):f(l)?(_(),v(`span`,Ro,M(f(l)),1)):g(``,!0),e.run&&f(p)?(_(),m(w,{key:2,name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`,class:`omp-tool-chev`,"aria-hidden":`true`},null,8,[`name`])):g(``,!0)]),I(`span`,zo,[e.live?(_(),m(T,{key:0,text:`# ${f(d)}`,duration:2.4,class:`omp-tool-intent`},null,8,[`text`])):f(i).intent?(_(),v(`span`,Bo,`# `+M(f(i).intent),1)):g(``,!0),f(s)||f(c)?(_(),v(`span`,Vo,[a(`→ `+M(f(s)),1),f(c)?(_(),v(k,{key:0},[f(s)?(_(),v(k,{key:0},[a(` · `)],64)):g(``,!0),I(`span`,Ho,`exit `+M(f(c)),1)],64)):g(``,!0)])):g(``,!0)])]),_:1},8,[`type`,`aria-expanded`])),f(p)&&f(r)?(_(),v(`div`,Uo,[I(`div`,Wo,[I(`span`,Go,M(f(b).label),1),f(b).earlier?(_(),v(`span`,Ko,M(f(b).earlier),1)):g(``,!0),I(`span`,qo,[f(c)?(_(),v(`span`,Jo,`exit `+M(f(c)),1)):g(``,!0),f(l)?(_(),v(`span`,Yo,M(f(l)),1)):g(``,!0)])]),I(`pre`,null,[(_(!0),v(k,null,y(f(x),(e,t)=>(_(),v(`span`,{key:t,class:j(e.cls)},M(e.text)+`
6
+ `,3))),128))])])):g(``,!0)],2)}}}),{__name:`OmpTool`}),Zo={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,suffix:`text-dimmed ms-1`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden`,body:`text-sm text-dimmed whitespace-pre-wrap`,actions:`flex items-center justify-end gap-1.5`},variants:{variant:{inline:{trigger:`rounded-sm outline-primary/25 focus-visible:outline-3`,body:`pt-2`,actions:`pt-2`},card:{root:`rounded-md ring ring-default overflow-hidden outline-primary/25 has-focus-visible:outline-3 has-focus-visible:ring-primary`,trigger:`px-2 py-1 focus:outline-none`,trailingIcon:`ms-auto`,body:`border-t border-default p-2 max-h-[200px] overflow-y-auto focus:outline-none`,actions:`border-t border-default p-2`}},chevron:{leading:``,trailing:``},loading:{true:{leadingIcon:`animate-spin`}},alone:{false:{leadingIcon:[`absolute inset-0 group-hover:opacity-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},Qo=[`data-state`],$o={__name:`UChatTool`,props:{text:{type:String,required:!1},suffix:{type:String,required:!1},icon:{type:null,required:!1},loading:{type:Boolean,required:!1,default:!1},loadingIcon:{type:null,required:!1},streaming:{type:Boolean,required:!1,default:!1},variant:{type:null,required:!1,default:`inline`},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},shimmer:{type:Object,required:!1},actions:{type:Array,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=O(),s=J(`chatTool`,r),c=$n(),l=n(()=>Ne({extend:Zo,...c.ui?.chatTool||{}})({variant:s.variant,chevron:s.chevron,loading:s.loading})),u=n(()=>s.open!==void 0),p=h(s.defaultOpen??!1),b=n(()=>u.value?s.open:p.value);function x(e){p.value=e,i(`update:open`,e)}let S=n(()=>!!o.default);B(()=>!!s.actions?.length,e=>{e&&S.value&&s.open===void 0&&s.defaultOpen===void 0&&(p.value=!0)},{immediate:!0});let C=n(()=>s.loadingIcon||c.ui.icons?.loading),w=n(()=>s.loading?C.value:s.icon),T=n(()=>s.chevronIcon||c.ui.icons?.chevronDown);return(e,t)=>(_(),m(f(oa),{open:b.value,disabled:f(s).disabled,"unmount-on-hide":f(s).unmountOnHide,"data-slot":`root`,class:j(l.value.root({class:[f(s).ui?.root,f(s).class]})),"onUpdate:open":x},{default:H(({open:t})=>[E(f(ca),{"as-child":``,disabled:!S.value},{default:H(()=>[I(`button`,{type:`button`,"data-slot":`trigger`,class:j(l.value.trigger({class:f(s).ui?.trigger}))},[w.value||S.value&&f(s).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(l.value.leading({class:f(s).ui?.leading}))},[w.value?(_(),m(qe,{key:0,name:w.value,"data-slot":`leadingIcon`,class:j(l.value.leadingIcon({class:f(s).ui?.leadingIcon,alone:!(S.value&&f(s).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),S.value&&f(s).chevron===`leading`?(_(),m(qe,{key:1,name:T.value,"data-slot":`chevronIcon`,class:j(l.value.chevronIcon({class:f(s).ui?.chevronIcon,alone:!w.value}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),I(`span`,{"data-slot":`label`,class:j(l.value.label({class:f(s).ui?.label}))},[f(s).streaming&&f(s).text?(_(),m(po,z({key:0,text:f(s).text},f(s).shimmer),null,16,[`text`])):(_(),v(k,{key:1},[a(M(f(s).text),1)],64)),f(s).suffix?(_(),v(`span`,{key:2,"data-slot":`suffix`,class:j(l.value.suffix({class:f(s).ui?.suffix}))},M(f(s).suffix),3)):g(``,!0)],2),S.value&&f(s).chevron===`trailing`?(_(),m(qe,{key:1,name:T.value,"data-slot":`trailingIcon`,class:j(l.value.trailingIcon({class:f(s).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(sa),{"data-slot":`content`,class:j(l.value.content({class:f(s).ui?.content}))},{default:H(()=>[I(`div`,{"data-slot":`body`,class:j(l.value.body({class:f(s).ui?.body}))},[d(e.$slots,`default`,{open:t})],2)]),_:2},1032,[`class`]),f(s).actions?.length||o.actions?(_(),v(`div`,{key:0,"data-slot":`actions`,"data-state":S.value&&t?`open`:`closed`,class:j(l.value.actions({class:f(s).ui?.actions}))},[d(e.$slots,`actions`,{},()=>[(_(!0),v(k,null,y(f(s).actions,(e,t)=>(_(),m(Et,z({key:t,size:`xs`},{ref_for:!0},e),null,16))),128))])],10,Qo)):g(``,!0)]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`]))}},es=[`·`,`✢`,`✳`,`✶`,`✻`,`✽`],ts=[...es,...[...es].reverse()];function ns(e,t=!1){return t?`✻`:ts[Math.floor(Math.max(0,e)/120)%ts.length]}function rs(e,t){return e||!t?null:120}var is={class:`claude-spinner`,"aria-hidden":`true`},as=Object.assign(T({__name:`ClaudeSpinner`,setup(e){let t=h(0),r=n(()=>ns(t.value,Oi.value)),i,a=0;function o(){i&&clearInterval(i),i=void 0}function s(){t.value=performance.now()-a}function c(){o();let e=rs(Oi.value,qr.value);e!==null&&(s(),i=ur(s,e))}return w(()=>{B(Oi,()=>{a=performance.now(),c()},{immediate:!0}),B(qr,c)}),U(o),(e,t)=>(_(),v(`span`,is,M(f(r)),1))}}),{__name:`ClaudeSpinner`}),os={slots:{root:`w-full flex flex-col gap-1 flex-1 px-2.5 [&>article]:last-of-type:min-h-(--last-message-height)`,indicator:`h-6 flex items-center gap-1 py-3 *:size-2 *:rounded-full *:bg-elevated motion-safe:[&>*:nth-child(1)]:animate-[bounce_1s_infinite] motion-safe:[&>*:nth-child(2)]:animate-[bounce_1s_0.15s_infinite] motion-safe:[&>*:nth-child(3)]:animate-[bounce_1s_0.3s_infinite]`,viewport:`absolute inset-x-0 top-[86%] data-[state=open]:animate-[fade-in_200ms_var(--ease-out)] data-[state=closed]:animate-[fade-out_200ms_var(--ease-out)]`,autoScroll:`rounded-full absolute right-1/2 translate-x-1/2 bottom-0`},variants:{compact:{true:``,false:``}}},ss=[`data-status`],cs=[`data-state`],ls={__name:`UChatMessages`,props:{messages:{type:null,required:!1},status:{type:String,required:!1},shouldAutoScroll:{type:Boolean,required:!1,default:!1},shouldScrollToBottom:{type:Boolean,required:!1,default:!0},autoScroll:{type:[Boolean,Object],required:!1,default:!0},autoScrollIcon:{type:null,required:!1},user:{type:Object,required:!1},assistant:{type:Object,required:!1},compact:{type:Boolean,required:!1},spacingOffset:{type:Number,required:!1,default:0},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e,{expose:t}){let r=e,i=O(),a=J(`chatMessages`,r),o=()=>$e(i,[`default`,`indicator`,`viewport`]);function s(){if(a.status===`submitted`)return!0;if(a.status!==`streaming`)return!1;let e=a.messages?.[a.messages.length-1];return e?.role===`assistant`&&!e.parts?.length}let c=$n(),l=S(()=>zt(a.user,{side:`right`,variant:`soft`})),u=S(()=>zt(a.assistant,{side:`left`,variant:`naked`})),p=n(()=>Ne({extend:os,...c.ui?.chatMessages||{}})({compact:a.compact})),b=h(null),C=h(null),T=h(new Map),D=h(!1),A=h(0),M=h(!1),F=h(0),L=h(!1);function R(e,t){let n=t?.$el;n&&T.value.set(e,n)}function V(e){let t=T.value.get(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}function U(e=!0){C.value&&(e?C.value.scrollTo({top:C.value.scrollHeight,behavior:`smooth`}):C.value.scrollTop=C.value.scrollHeight)}Nt([()=>a.messages,()=>a.status],([e,t])=>{if(!a.messages?.length){D.value=!1,L.value=!1,F.value=0,T.value.clear();return}t===`streaming`&&ee()},{deep:!0,throttle:50,leading:!0}),B(()=>a.status,e=>{if(e!==`submitted`)return;let t=a.messages?.[a.messages.length-1];t&&t.role===`user`&&(L.value=!1,P(()=>{M.value=!0,G(),P(()=>{V(t.id)})}))});function ee(){if(!C.value)return;let e=C.value.scrollTop+C.value.clientHeight,t=C.value.scrollHeight;D.value=t-e>=100,C.value.scrollTop<F.value?L.value=!0:t-e<100&&(L.value=!1),F.value=C.value.scrollTop}function W(){L.value=!1,U()}function te(e){if(!e)return document.documentElement;let t=/auto|scroll/,n=e;for(;n&&n!==document.body&&n!==document.documentElement;){let e=window.getComputedStyle(n);if(t.test(e.overflowY))return n;n=n.parentElement}return document.documentElement}function G(){if(!b.value||!C.value||!a.messages?.length||!M.value)return;let{height:e}=wt(C.value),t=a.messages.findLast(e=>e.role===`user`);if(!t)return;let n=T.value.get(t.id);if(!n)return;let r=a.spacingOffset||0,i=window.getComputedStyle(b.value),o=window.getComputedStyle(C.value);r+=Number.parseFloat(i.rowGap)||Number.parseFloat(i.gap)||0,r+=Number.parseFloat(o.paddingTop)||0,r+=Number.parseFloat(o.paddingBottom)||0,A.value=Math.max(e.value-n.offsetHeight-r,0)}return w(()=>{C.value=te(b.value),C.value&&(F.value=C.value.scrollTop,a.shouldScrollToBottom?(U(!1),setTimeout(()=>{U(!1)},100)):P(()=>{ee()}),Be(C,`scroll`,ee),Be(window,`resize`,()=>P(G)),b.value&&kt(b,()=>{a.shouldAutoScroll&&a.status===`streaming`&&!L.value&&U(!1)},{childList:!0,subtree:!0}))}),t({registerMessageRef:R}),(e,t)=>(_(),v(`div`,{ref_key:`el`,ref:b,"data-status":f(a).status,"data-slot":`root`,class:j(p.value.root({class:[f(a).ui?.root,f(a).class]})),style:N({"--last-message-height":`${A.value}px`})},[d(e.$slots,`default`,{registerMessageRef:R},()=>[(_(!0),v(k,null,y(f(a).messages,t=>(_(),v(k,{key:t.id},[t.parts?.length?(_(),m(lo,z({key:0,ref_for:!0},{...t.role===`user`?l.value:u.value,...t},{ref_for:!0,ref:e=>R(t.id,e),compact:f(a).compact}),x({_:2},[y(o(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,z({ref_for:!0},{...n,message:t}))])}))]),1040,[`compact`])):g(``,!0)],64))),128))]),s()?(_(),m(lo,z({key:0,id:`indicator`,role:`assistant`},{...u.value,actions:void 0,parts:[]},{compact:f(a).compact}),{content:H(()=>[d(e.$slots,`indicator`,{ui:p.value},()=>[I(`div`,{"data-slot":`indicator`,class:j(p.value.indicator({class:f(a).ui?.indicator}))},[...t[0]||=[I(`span`,null,null,-1),I(`span`,null,null,-1),I(`span`,null,null,-1)]],2)])]),_:3},16,[`compact`])):g(``,!0),E(f(pe),{present:D.value},{default:H(()=>[I(`div`,{"data-state":D.value?`open`:`closed`,"data-slot":`viewport`,class:j(p.value.viewport({class:f(a).ui?.viewport}))},[d(e.$slots,`viewport`,{ui:p.value,onClick:W},()=>[f(a).autoScroll?(_(),m(Et,z({key:0,icon:f(a).autoScrollIcon||f(c).ui.icons.arrowDown,color:`neutral`,variant:`outline`},typeof f(a).autoScroll==`object`?f(a).autoScroll:{},{"data-slot":`autoScroll`,class:p.value.autoScroll({class:f(a).ui?.autoScroll}),onClick:W}),null,16,[`icon`,`class`])):g(``,!0)])],10,cs)]),_:3},8,[`present`])],14,ss))}},us=new URL(`pdf.min.t82Z80JU.mjs`,import.meta.url).href,ds=new URL(`pdf.worker.min.wgc6bjNh.mjs`,import.meta.url).href;function fs(e,t,n){return Math.min(Math.max(1,n),Math.sqrt(4194304/(e*t)))}var ps=[`aria-label`,`aria-busy`],ms={key:0,class:`changes-notice`,role:`status`},hs={key:1,class:`changes-notice error`,role:`alert`},gs=[`data-page`,`aria-label`],_s=Object.assign(T({__name:`PdfPreview`,props:{src:{},title:{}},setup(e){let t=e,n=h(),r=h(0),i=h(2/3),a=h(!0),o=h(!1),s,c,l,u,d,p=!1,m=0,b=!1,x=0,S=new Set;async function C(){if(!b&&!p&&s&&x){b=!0;try{for(let e of S){if(p)break;if(e.querySelector(`canvas`))continue;let t=m,n=await s.getPage(Number(e.dataset.page));if(p||t!==m||!S.has(e))continue;let r=n.getViewport({scale:1}),i=n.getViewport({scale:x/r.width});e.style.aspectRatio=`${r.width} / ${r.height}`;let a=window.document.createElement(`canvas`),o=fs(i.width,i.height,window.devicePixelRatio||1);a.width=Math.ceil(i.width*o),a.height=Math.ceil(i.height*o);let c=a.getContext(`2d`);l=n.render({canvas:a,canvasContext:c,viewport:i,transform:[o,0,0,o,0,0]});try{await l.promise,!p&&t===m&&S.has(e)?(e.replaceChildren(a),e.dataset.rendered=`true`):a.width=a.height=0}catch(e){if(e.name!==`RenderingCancelledException`)throw e}finally{l=void 0,n.cleanup()}}}catch{p||(o.value=!0)}finally{b=!1,!p&&!o.value&&[...S].some(e=>!e.querySelector(`canvas`))&&C()}}}function T(e){let t=e.querySelector(`canvas`);t&&(t.width=t.height=0,t.remove()),delete e.dataset.rendered}return w(async()=>{try{let e=await tn(()=>import(us),[],import.meta.url);if(p||(e.GlobalWorkerOptions.workerSrc=ds,c=e.getDocument({url:t.src,withCredentials:!0,isEvalSupported:!1}),s=await c.promise,p))return;let o=await s.getPage(1),f=o.getViewport({scale:1});if(i.value=f.height/f.width,o.cleanup(),r.value=s.numPages,a.value=!1,await P(),p||!n.value)return;x=n.value.clientWidth,u=new IntersectionObserver(e=>{for(let t of e){let e=t.target;t.isIntersecting?S.add(e):(S.delete(e),T(e))}C()},{rootMargin:`400px 0px`}),n.value.querySelectorAll(`.pdf-page`).forEach(e=>u.observe(e)),d=new ResizeObserver(()=>{let e=n.value?.clientWidth||0;e&&e!==x&&(x=e,m++,l?.cancel(),S.forEach(T),C())}),d.observe(n.value)}catch{p||(o.value=!0,a.value=!1)}}),U(()=>{p=!0,u?.disconnect(),d?.disconnect(),l?.cancel(),S.forEach(T),S.clear(),c?.destroy()}),(t,s)=>(_(),v(`div`,{ref_key:`root`,ref:n,class:`files-pdf`,role:`region`,"aria-label":e.title,"aria-busy":f(a)},[f(a)?(_(),v(`p`,ms,M((`t`in t?t.t:f(Q))(`Loading PDF…`)),1)):g(``,!0),f(o)?(_(),v(`p`,hs,M((`t`in t?t.t:f(Q))(`Could not preview this PDF. Use Open to view it.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(r),e=>(_(),v(`div`,{key:e,class:`pdf-page`,"data-page":e,style:N({aspectRatio:`1 / ${f(i)}`}),role:`img`,"aria-label":`${(`t`in t?t.t:f(Q))(`Page`)} ${e}`},null,12,gs))),128))],8,ps))}}),{__name:`PdfPreview`});function vs(e){if(e<1e3)return`${e} B`;let t=[`kB`,`MB`,`GB`,`TB`],n=e/1e3,r=0;for(;;){let e=n.toFixed(+(n<10));if(Number(e)<1e3||r===t.length-1)return`${e} ${t[r]}`;n/=1e3,r++}}var ys=e=>/\.(?:md|markdown)$/i.test(e),bs=e=>{try{return decodeURIComponent(e)}catch{return e}};function xs(e){let t=[];for(let n of e)if(n&&n!==`.`){if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n)}return t}function Ss(e,t,n){let r=t.trim();if(!r)return null;if(r.startsWith(`#`))return{kind:`anchor`,anchor:bs(r.slice(1))};if(/^[a-z][a-z\d+.-]*:/i.test(r)||r.startsWith(`//`))return{kind:`external`};let i=r.indexOf(`#`),a=i<0?``:bs(r.slice(i+1)),o=bs((i<0?r:r.slice(0,i)).split(`?`)[0]).replace(/\\/g,`/`);if(!o)return null;let s=o.endsWith(`/`)?`dir`:`file`;if(n){if(o.startsWith(`~/`)){let e=xs(o.slice(2).split(`/`));return e?{kind:s,path:`~/${e.join(`/`)}`,anchor:a}:{kind:`outside`}}let t=xs([...o.startsWith(`/`)?[]:e.split(`/`).slice(0,-1),...o.split(`/`)]);return t?{kind:s,path:`/${t.join(`/`)}`,anchor:a}:{kind:`outside`}}let c=xs([...o.startsWith(`/`)?[]:e.split(`/`).slice(0,-1),...o.split(`/`)]);return c?{kind:s,path:c.join(`/`),anchor:a}:{kind:`outside`}}function Cs(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu,``).replace(/\s/g,`-`)}function ws(e,t){let n=t.toLowerCase(),r=new Map;for(let t of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=Cs(t.textContent||``),i=r.get(e)??0;if(r.set(e,i+1),(i?`${e}-${i}`:e)===n)return t}return null}var Ts=`wherdr.files.hidden`,Es=e=>e!==`0`,Ds=e=>e?`1`:`0`,Os=`wherdr.files.md`,ks=e=>e===`source`?`source`:`rendered`,As={class:`changes-view files-view`},js={class:`changes-toolbar`},Ms=[`aria-label`],Ns={key:0,class:`files-sep`},Ps=[`onClick`],Fs={key:0,class:`files-sep`},Is={class:`files-crumb current`},Ls={class:`files-actions`},Rs={class:`files-label`},zs={key:0,class:`changes-notice error`,role:`alert`},Bs={key:1,class:`changes-notice`},Vs={class:`changes-location`},Hs=[`aria-label`],Us=[`aria-pressed`,`onClick`],Ws={key:1,class:`changes-limit`},Gs=[`src`,`alt`],Ks={key:0,class:`changes-notice`,role:`alert`},qs=[`src`,`aria-label`],Js={key:5,class:`changes-notice`},Ys={key:6,class:`changes-notice`},Xs=[`aria-label`,`innerHTML`],Zs=[`aria-label`],Qs={class:`files-num`,"aria-hidden":`true`},$s={class:`files-text`},ec={class:`changes-toggle`},tc={key:0,class:`changes-limit`},nc={key:1,class:`changes-notice`},rc={class:`files-list`},ic=[`disabled`,`onClick`],ac={class:`change-path`},oc={key:0,class:`change-status`},sc=40,cc=Object.assign(T({__name:`FilesView`,props:{paneId:{},file:{}},setup(e){let t=e,r=h(null),i=h(null),o=h(!1),s=h(``),c=cr(Ts,Es,Ds),u=0,d=()=>encodeURIComponent(t.paneId);async function p(e,t){let n=++u;o.value=!0,s.value=``;try{let r=await _i(e);n===u&&t(r)}catch(e){n===u&&(s.value=e.message)}finally{n===u&&(o.value=!1)}}function b(e){let t=e===null?``:`&path=${encodeURIComponent(e)}`;return p(`/api/files?pane=${d()}${t}`,e=>{r.value=e,i.value=null})}let x=e=>`pane=${d()}&path=${encodeURIComponent(e)}${t.file?`&from=chat`:``}`,S=``;function C(e){return S=e,p(`/api/files/read?${x(e)}`,e=>{i.value=e})}let T=null,D=h([]),O=h(0),A=n(()=>i.value?.kind===`pdf`||i.value?.kind===`video`?`/api/files/download?${x(i.value.path)}&inline=1`:``),N=h(!1);B(A,()=>{N.value=!1});let F=h(!1);async function R(){let e=i.value?.path;if(e&&!F.value){F.value=!0;try{await Pi(`/api/files/download?${x(e)}`,e.split(`/`).pop()||e)}catch(e){$(e.message,!0)}finally{F.value=!1}}}let z=e=>r.value?.path?`${r.value.path}/${e}`:e;function V(e){e.kind===`dir`?b(z(e.name)):e.kind===`file`&&C(z(e.name))}function U(){u++,o.value=!1;let e=t.file?D.value.pop():void 0;e?C(e):i.value=null}function ee(){O.value++,oe.clear(),N.value=!1,t.file?C(S||t.file):i.value?C(i.value.path):b(r.value?r.value.path:null)}w(()=>t.file?C(t.file):b(null)),l(()=>{u++});let te=n(()=>{let e=r.value;if(!e)return[];let t=e.path?e.path.split(`/`):[];return[{label:e.root.split(`/`).filter(Boolean).pop()||`/`,path:``},...t.map((e,n)=>({label:e,path:t.slice(0,n+1).join(`/`)}))]}),G=n(()=>(r.value?.entries||[]).filter(e=>c.value||!e.name.startsWith(`.`))),ne=n(()=>{let e=i.value?.text??``,t=e.endsWith(`
7
7
  `)?e.slice(0,-1):e,n=1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===10&&n++;return{text:t,numbers:Array.from({length:n},(e,t)=>t+1).join(`
8
- `)}}),re=rr(Ss,Cs,e=>e),q=n(()=>i.value?.kind===`text`&&ps(i.value.path)),ie=n(()=>q.value&&re.value===`rendered`?Vi(i.value.text??``,{doc:!0}):``),ae=h(null),oe=h(null),se=new Map,ce=``,le=0;async function ue(e,n){let r=++le;ce!==n&&se.clear(),ce=n;let i=!!t.file;for(let t of Array.from(e.querySelectorAll(`img[data-src]`)).slice(0,tc)){let e=gs(n,t.dataset.src||``,i);if(e?.kind!==`file`)continue;let a=se.get(e.path);if(a===void 0){try{let t=await fi(`/api/files/read?${x(e.path)}`);a=t.kind===`image`&&t.dataUrl?t.dataUrl:null}catch{a=null}se.set(e.path,a)}if(r!==le)return;a&&(t.src=a)}}let de=h(0);B(i,()=>{de.value++}),B([ie,oe,de],async([e,t])=>{if(le++,!e||!t||!i.value)return;await P();let n=T;T=null,n&&vs(t,n)?.scrollIntoView({block:`start`}),ue(t,i.value.path)},{flush:`post`});function fe(e){let n=e.target,r=n.closest?.(`.code-copy`);if(r){let e=r.closest(`.code-block`)?.querySelector(`pre`)?.textContent;if(e==null)return;navigator.clipboard.writeText(e).then(()=>{r.textContent=Q(`Copied`),r.classList.add(`done`),setTimeout(()=>{r.textContent=Q(`Copy`),r.classList.remove(`done`)},1400)}).catch(()=>$(Q(`Copy failed`),!0));return}let a=n.closest?.(`a[href]`),o=i.value?.path;if(!a||!o)return;let s=gs(o,a.getAttribute(`href`)||``,!!t.file);s&&s.kind!==`external`&&(e.preventDefault(),s.kind===`anchor`?oe.value&&vs(oe.value,s.anchor)?.scrollIntoView({block:`start`}):s.kind===`outside`?$(Q(`This link leads outside the folder.`),!0):s.kind===`dir`?t.file||b(s.path):pe(o,s.path,s.anchor))}async function pe(e,n,a){let o=n.split(`/`).slice(0,-1).join(`/`),s=t.file||r.value?.path===o?null:fi(`/api/files?pane=${d()}&path=${encodeURIComponent(o)}`).catch(()=>null);t.file&&D.value.push(e),T=a||null,await C(n);let c=await s;c&&i.value?.path===n&&(r.value=c),a||ae.value?.scrollIntoView({block:`start`})}function me(e){return e.kind===`dir`?e.link?`i-lucide-folder-symlink`:`i-lucide-folder`:e.kind===`other`?`i-lucide-file-question`:e.link?`i-lucide-file-symlink`:`i-lucide-file`}return(t,n)=>{let l=Et,u=ds,d=Je;return _(),v(`div`,ws,[I(`div`,{ref_key:`root`,ref:ae,class:`changes-inner`},[I(`div`,Ts,[I(`nav`,{class:`files-crumbs`,"aria-label":(`t`in t?t.t:f(Q))(`Folder`)},[f(i)&&(!e.file||f(D).length)?(_(),m(l,{key:0,icon:`i-lucide-arrow-left`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Back to folder`),onClick:U},null,8,[`aria-label`])):g(``,!0),(_(!0),v(k,null,y(f(te),(e,t)=>(_(),v(k,{key:e.path},[t?(_(),v(`span`,Ds,`/`)):g(``,!0),I(`button`,{type:`button`,class:`files-crumb`,onClick:t=>b(e.path)},M(e.label),9,Os)],64))),128)),f(i)?(_(),v(k,{key:1},[f(te).length?(_(),v(`span`,ks,`/`)):g(``,!0),I(`span`,As,M(f(i).path.split(`/`).pop()),1)],64)):g(``,!0)],8,Es),I(`div`,js,[f(A)?(_(),m(l,{key:0,icon:`i-lucide-external-link`,color:`neutral`,variant:`outline`,size:`sm`,to:f(A),target:`_blank`,external:``,"aria-label":(`t`in t?t.t:f(Q))(`Open`)},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Open`)),1)]),_:1},8,[`to`,`aria-label`])):g(``,!0),f(i)?(_(),m(l,{key:1,icon:`i-lucide-download`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(F),"aria-label":(`t`in t?t.t:f(Q))(`Download`),onClick:R},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Download`)),1)]),_:1},8,[`loading`,`aria-label`])):g(``,!0),E(l,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(o),"aria-label":(`t`in t?t.t:f(Q))(`Refresh`),onClick:ee},{default:H(()=>[I(`span`,Ms,M((`t`in t?t.t:f(Q))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])])]),f(s)?(_(),v(`p`,Ns,M(f(s)),1)):g(``,!0),f(o)&&!f(r)&&!f(i)?(_(),v(`p`,Ps,[n[2]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in t?t.t:f(Q))(`Reading files…`)),1)])):f(i)?(_(),v(k,{key:2},[I(`p`,Fs,M(f(i).path)+` · `+M((`fmtBytes`in t?t.fmtBytes:f(fs))(f(i).size)),1),f(q)?(_(),v(`div`,{key:0,class:`segmented files-md-mode`,role:`group`,"aria-label":(`t`in t?t.t:f(Q))(`Markdown view`),style:{"--segment-count":`2`}},[(_(),v(k,null,y([`rendered`,`source`],e=>I(`button`,{key:e,type:`button`,class:j({on:f(re)===e}),"aria-pressed":f(re)===e,onClick:t=>re.value=e},[I(`span`,null,M(e===`rendered`?(`t`in t?t.t:f(Q))(`Rendered`):(`t`in t?t.t:f(Q))(`Source`)),1)],10,Ls)),64))],8,Is)):g(``,!0),f(i).truncated&&f(i).kind===`text`?(_(),v(`p`,Rs,M((`t`in t?t.t:f(Q))(`File truncated to keep this view responsive.`)),1)):g(``,!0),f(i).kind===`image`?(_(),v(`img`,{key:2,class:`files-image`,src:f(i).dataUrl,alt:f(i).path},null,8,zs)):f(i).kind===`pdf`?(_(),m(u,{key:`${f(A)}:${f(O)}`,src:f(A),title:f(i).path},null,8,[`src`,`title`])):f(i).kind===`video`?(_(),v(k,{key:4},[f(N)?(_(),v(`p`,Bs,M((`t`in t?t.t:f(Q))(`This video cannot be played here. Use Open or Download.`)),1)):(_(),v(`video`,{key:`${f(A)}:${f(O)}`,class:`files-video`,src:f(A),"aria-label":f(i).path,controls:``,playsinline:``,preload:`metadata`,onError:n[0]||=e=>N.value=!0},null,40,Vs))],64)):f(i).kind===`binary`?(_(),v(`p`,Hs,M((`t`in t?t.t:f(Q))(`Binary file`)),1)):f(i).kind===`large`?(_(),v(`p`,Us,M(/\.pdf$/i.test(f(i).path)?(`t`in t?t.t:f(Q))(`PDF too large to preview (50 MB max).`):(`t`in t?t.t:f(Q))(`Image too large to preview.`)),1)):f(ie)?(_(),v(`article`,{key:f(de),ref_key:`doc`,ref:oe,class:`md md-body files-md`,"aria-label":f(i).path,onClick:fe,innerHTML:f(ie)},null,8,Ws)):(_(),v(`div`,{key:8,class:`files-code`,role:`region`,"aria-label":f(i).path},[I(`pre`,Ks,M(f(ne).numbers),1),I(`pre`,qs,M(f(ne).text),1)],8,Gs))],64)):f(r)?(_(),v(k,{key:3},[I(`label`,Js,[L(I(`input`,{"onUpdate:modelValue":n[1]||=e=>W(c)?c.value=e:null,type:`checkbox`},null,512),[[K,f(c)]]),n[3]||=a(),I(`span`,null,M((`t`in t?t.t:f(Q))(`Show hidden files`)),1)]),f(r).truncated?(_(),v(`p`,Ys,M((`t`in t?t.t:f(Q))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(G).length?g(``,!0):(_(),v(`p`,Xs,M((`t`in t?t.t:f(Q))(`Empty folder.`)),1)),I(`ul`,Zs,[(_(!0),v(k,null,y(f(G),e=>(_(),v(`li`,{key:e.name},[I(`button`,{type:`button`,class:`change-file files-entry`,disabled:e.kind===`other`,onClick:t=>V(e)},[E(d,{name:me(e),class:j([`files-icon`,e.kind])},null,8,[`name`,`class`]),I(`span`,$s,M(e.name),1),e.kind===`file`&&e.size!==null?(_(),v(`span`,ec,M((`fmtBytes`in t?t.fmtBytes:f(fs))(e.size)),1)):g(``,!0),e.kind===`dir`?(_(),m(d,{key:1,name:`i-lucide-chevron-right`,class:`files-chevron`})):g(``,!0)],8,Qs)]))),128))])],64)):g(``,!0)],512)])}}}),{__name:`FilesView`});function rc(e,t=300,n=300){let r=h(!1),i=null,a=0,o=()=>{i&&=(clearTimeout(i),null)};return B(e,e=>{if(o(),e&&!r.value)i=setTimeout(()=>{i=null,r.value=!0,a=Date.now()},t);else if(!e&&r.value){let e=n-(Date.now()-a);e<=0?r.value=!1:i=setTimeout(()=>{i=null,r.value=!1},e)}},{immediate:!0}),s(o),r}var ic=e=>!!e&&Fr.value&&!mr.value&&!qr(e)&&Ji(e.agent),ac=(e,t)=>!!t&&e.id===t.id&&(e.machine||``)===(t.machine||``)&&e.agent===t.agent&&e.agentSession===t.agentSession&&e.cwd===t.cwd,oc=e=>wr.value.panes.find(t=>t.id===e);function sc(e){return ic(e)?e.status===`blocked`&&e.prompt?Z(`The agent is waiting for your answer: answer it first.`,`L’agent attend ta réponse : réponds-lui d’abord.`):null:Z(`The agent can no longer run commands (offline, or no agent in the pane): nothing was sent.`,`L’agent ne peut plus lancer de commande (hors ligne, ou plus d’agent dans le pane) : rien n’a été envoyé.`)}function cc(e){let t=lr(e.agent),n=Jr(wr.value,e),r=Ei(e),i=[n,r].filter((e,n,r)=>e&&e.toLowerCase()!==t.toLowerCase()&&r.indexOf(e)===n).join(` › `)||r,a=e.machine?Rr(e.machine):``,o=e.cwd?hr(e.cwd):``;return Z(`Run this command in ${t} “${i}”${a?` on ${a}`:``}? It runs in its shell mode (!), in ${o||`its own folder`}, and shows the output in the conversation.`,`Lancer cette commande dans ${t} « ${i} »${a?` sur ${a}`:``} ? Elle s’exécute dans son mode shell (!), dans ${o||`son propre dossier`}, et la sortie s’affiche dans la conversation.`)}async function lc(e,t){let n=oc(e),r=sc(n);if(r||!n)return r&&$(r,!0),!1;let i=Hi(n.agent,t);if(!i||(X(),!await mt(cc(n),Z(`Run`,`Lancer`),`primary`,t)))return!1;let a=oc(e);if(!ac(n,a))return $(Z(`The agent changed while you were confirming: nothing was sent. Check it and run the command again.`,`L’agent a changé pendant la confirmation : rien n’a été envoyé. Vérifie-le et relance la commande.`),!0),!1;let o=sc(a);if(o)return $(o,!0),!1;try{let e=await Ue(a,a.id,i);return X(),e}catch(e){return $(e.message,!0),!1}}async function uc(e){try{await navigator.clipboard.writeText(e),$(Q(`Copied`))}catch{$(Q(`Copy failed`),!0)}}function dc(e,t){return e.stopped||!e.agent?`stopped`:e.prompt?`question`:e.menu||e.screen||e.menuLeftOpen?`dialog`:e.status===`blocked`?`question`:e.pendingPrompt?`starting`:e.status===`working`?`working`:t.reason===`busy`?`busy`:`sending`}function fc(e,t){return e.agent===`claude`&&[`idle`,`done`].includes(e.status||``)&&!e.leaving&&t.state===`held`&&dc(e,t)===`busy`}var pc=`/.cache/herdr-web/uploads/`,mc=e=>e.includes(pc);function hc(e){return String(e||``).split(`
9
- `).filter(mc).map(e=>e.trim().split(`/`).pop()).filter(Boolean)}var gc=e=>String(e||``).split(`
10
- `).filter(e=>!mc(e)).join(`
11
- `).trim(),_c=e=>hc(e).length>0&&!gc(e),vc=/\[Image #\d+(?:, \d+x\d+)?\]/g,yc=e=>(String(e||``).match(vc)||[]).length,bc=e=>yc(e)>0&&!String(e||``).replace(vc,``).trim();function xc(e,t){return t.role!==`user`||!_c(e)?!1:hc(e).some(e=>t.text.includes(e))||(t.images||0)>0}var Sc=e=>`/uploads/${encodeURIComponent(e)}`,Cc=e=>/^\/[^\s/]*(?:\s|$)/.test(String(e||``).trim()),wc=`/.cache/herdr-web/uploads/`,Tc=e=>String(e||``).replace(/\[Image #\d+\]/g,` `).replace(/\s+/g,` `).trim().toLowerCase(),Ec=e=>Tc(String(e||``).split(`
12
- `).filter(e=>!e.includes(wc)).join(`
13
- `));function Dc(e,t){let n=e.replace(/\s+/g,``).slice(0,80),r=t.replace(/\s+/g,``).slice(0,80);return!n||!r?!1:n===r||Math.min(n.length,r.length)>=24&&(n.startsWith(r)||r.startsWith(n))}var Oc=(e,t)=>!!(e&&t)&&Xr(e,t,Dc),kc=(e,t)=>bc(t)&&yc(t)===hc(e).length,Ac=e=>/^\s*!/.test(e),jc=e=>Tc(String(e||``).replace(/^\s*!!?\s*/,``));function Mc(e,t){if(!t)return`queued`;if(_c(e))return t.queued.some(t=>kc(e,t))||!t.sent||!kc(e,t.sent)?`queued`:`sent`;let n=Ec(e);if(!n||t.queued.some(e=>Oc(n,Tc(e))))return`queued`;let r=t.shell?t.shell.python?/^\s*\$/.test(e)?Tc(e.replace(/^\s*\$\$?\s*/,``)):``:Ac(e)?jc(e):``:``;return t.shell&&Oc(r,Tc(t.shell.command))?`running`:Ac(e)?t.sent&&Ac(t.sent)&&Oc(jc(e),jc(t.sent))?`sent`:`queued`:t.sent&&!Ac(t.sent)&&Oc(n,Tc(t.sent))?`sent`:`queued`}function Nc(e,t){let n=e.map(e=>Mc(e,t)),r=e.map(e=>!!(t&&t.queued.some(t=>_c(e)?kc(e,t):Oc(Ec(e),Tc(t))))),i=n.reduce((e,t,n)=>t===`queued`?e:n,-1);return n.map((e,t)=>t>i?e:r.slice(0,t+1).some(Boolean)?`queued`:e===`queued`?`sent`:e)}var Pc=e=>String(e||``).replace(/\s+/g,` `).trim().toLowerCase(),Fc=(e,t)=>Xr(Pc(e),Pc(t),(e,t)=>e.includes(t.slice(0,60))),Ic=new Map;function Lc(e,t){let n=(Ic.get(e)||[]).filter(e=>!t.some(t=>t.id===e.id));return n.push(...t.filter(e=>hc(e.text).length)),Ic.set(e,n.slice(-30)),Ic.get(e)}function Rc(e){let t=t=>{let n=e=>!t.at||!e.ts||Date.parse(e.ts)>=t.at-1e4;if(_c(t.text))return e.items.some(e=>n(e)&&xc(t.text,e));let r=gc(t.text),i=Pc(t.text.replace(/^\s*(?:!!?|\$\$?)\s*/,``)).slice(0,60);return!!Pc(r)&&e.items.some(e=>n(e)&&(e.role===`user`?Fc(e.text,r):e.role===`bash`&&!!i&&Pc(e.text).includes(i)))},n=[...e.mine].sort((e,t)=>e.at&&t.at?e.at-t.at:0),r=n.filter(e=>!t(e)),i=Nc(r.map(e=>e.text),e.screen),a=r.filter((e,t)=>_c(e.text)&&!e.state&&i[t]===`queued`).length,o=(e.memory||[]).filter(e=>_c(e.text)&&!n.some(t=>t.id===e.id));for(let t of e.idle?[]:e.claude){let i=t.images||0;if(!t.text){if(!i)continue;if(a>0){a--;continue}let e=o.shift(),n=t.sent||e?.text;r.push({id:`cc-${t.ts}`,text:n||``,missing:n?0:i});continue}if(!Pc(t.text)||n.some(e=>Fc(e.text,t.text))||e.items.some(e=>(!t.ts||!e.ts||e.ts>=t.ts)&&(e.role===`user`||e.role===`notice`)&&Fc(e.text,t.text)))continue;let s=i?t.sent||[...e.memory||[]].reverse().find(e=>Fc(gc(e.text),t.text))?.text:null;r.push({id:`cc-${t.ts}`,text:s||t.text,missing:s?0:i})}let s=Nc(r.map(e=>e.text),e.screen);return r.map((e,t)=>({id:e.id,raw:e.text,mine:!e.id.startsWith(`cc-`),phase:e.state?`queued`:s[t],state:e.state||null,...e.local?{local:!0}:{},...e.inputText?{inputText:e.inputText}:{},...e.reason?{reason:e.reason}:{},photos:hc(e.text),missing:e.missing||0,...e.pasted?{pasted:e.pasted}:{}}))}function zc(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.right-n.left>.5&&n.bottom-n.top>.5)return n}return null}function Bc(e,t,n,r){if(e.bottom<n.top||e.top>n.bottom)return null;let i=n.width-t.width-8,a=Math.min(Math.max(8,e.right-t.width),i),o=r?22:6,s=e.bottom+o;if(!r&&e.right+6<=i){let r=Math.round(e.top+(e.bottom-e.top-t.height)/2);return{top:Math.min(Math.max(r,n.top),n.bottom-t.height),left:e.right+6}}if(s+t.height<=n.bottom)return{top:s,left:a};let c=e.top-6-t.height;return!r&&c>=n.top?{top:c,left:a}:{top:Math.max(n.top,n.bottom-t.height-8),left:a}}function Vc(e){let t=!1,n=null,r=()=>{n&&clearTimeout(n),n=null},i=i=>{r(),n=setTimeout(()=>{n=null,t||e.show()},i)};return{down(){t=!0,r(),e.hide()},up(){t&&(t=!1,i(e.touch()?380:180))},change(n=!1){if(!n){if(e.hide(),t){r();return}i(e.touch()?380:350)}},scroll(){e.hide(),t||i(160)},dispose(){r()}}}function Hc(e){for(let t=e.length-1;t>=0;t--){let n=e[t].replace(/\s+$/u,``).length;if(n>0)return{index:t,offset:n}}return null}function Uc(e,t){let n=e.cloneRange();if(!t.contains(n.startContainer)){if(n.comparePoint(t,0)<0)return null;n.setStart(t,0)}t.contains(n.endContainer)||n.setEnd(t,t.childNodes.length);let r=[],i=[],a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let e=a.nextNode();e;e=a.nextNode()){if(!n.intersectsNode(e))continue;let t=e===n.startContainer?n.startOffset:0,a=e===n.endContainer?n.endOffset:e.data.length;r.push(e),i.push(e.data.slice(t,a))}let o=Hc(i);if(!o)return null;let s=r[o.index];return n.setEnd(s,(s===n.startContainer?n.startOffset:0)+o.offset),n}function Wc(e,t){let n=t.items||[];return t.keep===void 0?n:!Number.isInteger(t.keep)||t.keep<0||t.keep>e.length?null:t.keep===e.length&&!n.length?e:e.slice(0,t.keep).concat(n)}function Gc(e,t){return!!(e.file&&t.file!==e.file)||!!(e.file&&t.rewritten)||e.tailStart!==null&&t.start!==void 0&&t.start!==e.tailStart}function Kc(e,t){let n=new URLSearchParams({pane:e,since:t.token});return t.tailStart!==null&&n.set(`from`,String(t.tailStart)),n.set(`n`,String(t.token?t.tail.length:0)),n}function qc(e,t=3){let n=0,r=null;async function i(){if(r===n)return;let i=n;r=i;let a=()=>i===n;try{for(let n=0;n<t&&a()&&await e(a);n++);}finally{r===i&&(r=null)}}return{load:i,invalidate:()=>{n++}}}function Jc(e,t,n){let r=null;for(let i of t)!e.has(i)&&n&&(r=i),e.add(i);return r}var Yc=120,Xc=50,Zc=new Map;function Qc(e,t,n){Zc.delete(e),!(!t||n.scrollHeight-n.scrollTop-n.clientHeight<Yc)&&(Zc.set(e,{file:t,fromBottom:n.scrollHeight-n.scrollTop}),Zc.size>Xc&&Zc.delete(Zc.keys().next().value))}function $c(e,t,n){let r=Zc.get(e);return!r||r.file!==t?null:Math.max(0,n-r.fromBottom)}var el=()=>({misses:0,errors:0});function tl(e,t){if(!t)return{next:el(),clear:!0};let n=e.misses+1;return n>=3?{next:el(),clear:!0}:{next:{...e,misses:n},clear:!1}}var nl=e=>({...e,errors:e.errors+1}),rl=e=>e.misses+e.errors>=2;function il(e){let t=new Set,n=new Set;for(let r of e)r.hashes&&r.hashes.forEach((e,i)=>{r.role!==`user`&&r.ref&&t.has(e)&&n.add(`${r.ref}:${(r.imageAt||0)+i}`),t.add(e)});return n}function al(e){return e.role===`user`&&(e.text.startsWith(`Autopilot:`)||e.text.startsWith(`Autopilot woke:`))}var ol={key:0,class:`search-bar`},sl={class:`search-count`},cl={class:`chat-wrap`},ll={key:2,class:`cached-tag chat-cached`,role:`status`},ul={key:0,class:`chat-empty waiting`},dl={key:0,class:`choices-screen-text`},fl={key:1,class:`chat-empty no-integration`},pl={class:`no-integration-title`},ml={class:`no-integration-text`},hl={class:`no-integration-cmd`},gl={class:`no-integration-actions`},_l={key:2,class:`chat-empty`},vl={key:2,class:`chat-more`},yl={key:3,class:`chat-note`},bl={key:0,class:`day-sep`},xl=[`data-hit-key`],Sl={class:`msg-system`},Cl={class:`msg-autopilot-body`},wl=[`data-hit-key`],Tl=[`aria-label`,`onClick`],El={class:`msg-quote-time`},Dl={class:`msg-quote-text`},Ol={key:0,class:`msg-file-chips`},kl=[`title`],Al={key:0,class:`q-bar`},jl={class:`q-bar-h`},Ml=[`aria-label`,`onClick`,`onMouseenter`,`onMouseleave`,`onFocus`,`onBlur`],Nl=[`aria-pressed`,`aria-label`,`onClick`],Pl=[`aria-pressed`,`onClick`],Fl={key:1,class:`msg-actions`},Il=[`onClick`],Ll=[`disabled`,`aria-expanded`,`onClick`],Rl={class:`omp-job-glyph`},zl={class:`omp-job-label`},Bl={key:0,class:`omp-job-wall`},Vl={key:0,class:`omp-tool-out`},Hl={class:`omp-tool-out-head`},Ul={class:`omp-tool-out-label`},Wl={key:0,class:`omp-tool-out-right`},Gl={class:`msg-shell-cmd`},Kl={class:`msg-shell-sign`,"aria-hidden":`true`},ql={key:0,class:`msg-shell-body`},Jl={key:0,class:`msg-shell-out`},Yl={key:1,class:`msg-shell-out err`},Xl={key:1,class:`msg-shell-empty`},Zl=[`aria-expanded`,`onClick`],Ql={key:8,class:`tools omp-console omp-run`},$l={class:`omp-console-head`},eu={class:`omp-console-title`},tu={key:9,class:`msg-system`},nu={class:`msg-notice-head`},ru=[`aria-expanded`,`onClick`],iu={key:11,class:`turn-end`},au=[`onClick`],ou={class:`omp-console-head`},su={key:0,class:`omp-console-total`},cu=[`aria-expanded`,`onClick`],lu={key:4,class:`chat-empty`},uu={key:5,class:`chat-empty`},du=[`aria-label`],fu={key:0,class:`queued-list`},pu=[`aria-label`,`onClick`],mu={class:`msg-quote-time`},hu={class:`msg-quote-text`},gu=[`title`],_u={key:0,class:`msg-file-chips`},vu={class:`queued-tag sent`},yu={key:0,class:`msg-user-wrap`},bu={class:`msg-shell bash running`},xu={class:`msg-shell-cmd`},Su={class:`msg-shell-sign`,"aria-hidden":`true`},Cu={key:0,class:`msg-shell-body`},wu={key:0,class:`msg-shell-hidden`},Tu={class:`msg-shell-out`},Eu={key:1,class:`msg-shell-empty`},Du={class:`queued-tag running`},Ou=[`aria-label`,`onClick`],ku={class:`msg-quote-time`},Au={class:`msg-quote-text`},ju=[`title`],Mu={key:0,class:`msg-file-chips`},Nu={key:1,class:`queued-tag failed`,role:`alert`},Pu=[`disabled`,`onClick`],Fu=[`disabled`,`onClick`],Iu={key:2,class:`queued-tag`},Lu=[`disabled`,`onClick`],Ru=[`disabled`,`onClick`],zu={key:1,class:`menu-left`,role:`status`},Bu={class:`menu-left-text`},Vu={class:`menu-left-actions`},Hu=[`disabled`],Uu=[`disabled`],Wu={key:0,class:`claude-verb-line`},Gu={key:1,class:`omp-step-line`},Ku={key:1},qu=30,Ju=10,Yu=6,Xu=12,Zu=Object.assign(T({__name:`ChatView`,props:V({pane:{},localQueued:{}},{search:{type:Boolean,default:!1},searchModifiers:{}}),emits:V([`gotoTerm`,`restored`,`quote`,`answered`,`unanswered`,`sent`],[`update:search`]),setup(e,{expose:t,emit:o}){let s=e;qi(Cr);let c=Rt(),d=o,p=D(e,`search`),b=h(null),x=h(null),S=()=>({file:null,token:``,tailStart:null,older:[],olderCursor:0,tail:[],queue:[]}),C=u(S()),T=n(()=>C.value.older.concat(C.value.tail)),O=h(null),A=h(null),F=h(null),L=u(el()),R=h(!1),z=h(!1),V=h(null),W=n(()=>mr.value||qr(s.pane)),te=rc(n(()=>V.value!==null&&!W.value&&!gr.value),600,0),G=rc(n(()=>!R.value&&!O.value&&!F.value)),ne=n(()=>ic(s.pane));async function K(){if(!Di(pi()))return;let e=s.pane.id,t=await ti(e);!t||Oe||R.value||O.value||e!==s.pane.id||(await ae(()=>{C.value={...S(),tail:t.items},V.value=t.at}),Ti(s.pane.id))}let re=e=>{let t=b.value;return!t||t.scrollHeight-t.scrollTop-t.clientHeight<e};function ie(e){let t=b.value;t&&(e||!le&&(se||re(160)))&&(se=!0,le=!1,requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight}))}async function ae(e,t=!1){let n=!le&&(se||re(120)),r=!R.value,i=st.value.length;e(),r?pe.value=qu:pe.value!==1/0&&(pe.value+=Math.max(0,st.value.length-i)),await P(),R.value=!0,me.value&&xe();let a=null;oe&&C.value.file&&b.value&&(oe=!1,me.value&&$c(s.pane.id,C.value.file,b.value.scrollHeight)===0&&await be(),a=$c(s.pane.id,C.value.file,b.value.scrollHeight)),!Vn&&p.value&&Y.q.length>=2?Jn(!1):a!==null&&!Vn&&b.value?(se=!1,b.value.scrollTop=a):!t&&(n||r)&&ie(!0)}let oe=typeof c.query.hit!=`string`,se=!0,le=!1;function ue(){le=!1,Se()}let de=null;w(()=>{de=new ResizeObserver(()=>{let e=b.value;e&&se&&(e.scrollTop=e.scrollHeight)}),b.value&&de.observe(b.value),x.value&&de.observe(x.value)}),U(()=>{b.value&&R.value&&Qc(s.pane.id,C.value.file,b.value)}),l(()=>de?.disconnect());function fe(){let e=b.value;e&&(ge=Date.now(),en.open=!1,le||(se=e.scrollHeight-e.scrollTop-e.clientHeight<120),me.value?e.scrollTop<1500&&ye(20):e.scrollTop<400&&R.value&&ze())}let pe=h(1/0),me=n(()=>Math.max(0,st.value.length-pe.value)),he=n(()=>me.value?st.value.slice(me.value):st.value),ge=0,_e=!1,ve=!1;l(()=>{ve=!0});async function ye(e){if(!me.value)return;let t=b.value,n=t?t.scrollHeight-t.scrollTop:0;pe.value=e===1/0?1/0:st.value.length-me.value+e,await P(),t&&(t.scrollTop=t.scrollHeight-n)}let be=()=>ye(1/0);function xe(){if(_e||ve)return;_e=!0;let e=()=>{if(_e=!1,!ve&&me.value){if(G.value||Date.now()-ge<400||document.hidden)return xe();ye(Ju).then(()=>{me.value&&xe()})}},t=globalThis.requestIdleCallback;t?t(e,{timeout:3e3}):setTimeout(e,250)}function Se(){Ee.value=null}let Ce=new Set,we=new Set,Ee=h(null),De=h(null),Oe=!1,ke=!1;B(Hr,e=>{e||(ke=!0,Se())}),B(mr,e=>{e&&(ke=!0,Se())});function Ae(e){let t=Oe&&!ke&&tr.value&&!p.value&&!W.value,n=Oe&&!ke&&!p.value&&!W.value,r=Jc(we,e.filter(e=>e.role===`thinking`).map(ar),n);r&&(Ee.value={id:r,at:Date.now()}),ke=!1,Oe=!0;let i=Fi(Ce,e.filter(e=>e.role===`assistant`).map(ar),t&&!r);i&&(De.value={id:i,at:Date.now()})}let je=e=>De.value&&De.value.id===e?De.value.at:null;function Me(e){De.value?.id===e&&(De.value=null)}B([tr,p],([e,t])=>{(!e||t)&&(De.value=null),t&&Se()});function Ne(e){return Ee.value?.id===e?Ee.value.at:null}function Pe(e){Ee.value?.id===e&&Se()}async function Fe(){if(A.value){X();try{await navigator.clipboard.writeText(A.value.command),$(Z(`Command copied.`,`Commande copiée.`))}catch{$(Q(`Copy failed`),!0)}}}async function Ie(e){let t=s.pane.id,n=()=>!e()||t!==s.pane.id;try{let e=await fi(`/api/chat?${Kc(t,C.value)}`);if(n())return!1;if(!e.available){let t=tl(L.value,!!C.value.file&&T.value.length>0);return L.value=t.next,t.clear?(C.value=S(),O.value=e.reason||`unsupported`,A.value=e.reason===`no_integration`&&e.integration||null,Oe=!0,!1):!1}if(O.value=null,A.value=null,F.value=null,(L.value.misses||L.value.errors)&&(L.value=el()),e.unchanged)return!1;if(V.value=null,Gc(C.value,e))return C.value=S(),Oe=!1,!0;let r=Wc(C.value.tail,e);if(!r)return C.value={...C.value,token:``},!0;await ae(()=>{let t={...C.value};t.tailStart===null&&(t.tailStart=e.start??0,t.olderCursor=e.start??0),t.file=e.file||null,t.token=e.token||``,t.tail=r,t.queue=e.queue||[],C.value=t,Ae(t.tail)}),ri(t,T.value)}catch(e){if(n())return!1;T.value.length?L.value=nl(L.value):F.value=e.message}return!1}let Le=qc(Ie),Re=Le.load;B(()=>s.pane.id,()=>Le.invalidate());async function ze(){if(z.value||!(C.value.olderCursor>0))return;z.value=!0;let e=s.pane.id,t=C.value.file,n=C.value.olderCursor;try{let r=await fi(`/api/chat?pane=${encodeURIComponent(e)}&before=${n}`);if(e!==s.pane.id||r.file!==t||C.value.olderCursor!==n)return;let i=b.value,a=i?i.scrollHeight-i.scrollTop:0;await ae(()=>{pe.value=1/0,C.value={...C.value,older:(r.items||[]).concat(C.value.older),olderCursor:(r.start??0)<n?r.start??0:0}},!0),ri(e,T.value),i&&(i.scrollTop=i.scrollHeight-a)}catch(e){$(e.message,!0)}finally{z.value=!1}}let Be;w(()=>{Promise.all([Re(),K()]).then(sr),Be=Tr(()=>{!document.hidden&&!mr.value&&Re()},1500)}),l(()=>clearInterval(Be)),B(Hr,e=>{e&&Re()});let Ve=Z(`Command`,`Commande`),He=Z(`Edit`,`Modif`),Ue=Z(`Subagent`,`Sous-agent`),We={Bash:Ve,Read:Z(`Read`,`Lecture`),Write:Z(`Write`,`Écriture`),Edit:He,MultiEdit:He,Grep:Z(`Search`,`Recherche`),Glob:Z(`Files`,`Fichiers`),WebFetch:`Web`,WebSearch:Z(`Web search`,`Recherche web`),Task:Ue,Agent:Ue,TodoWrite:Z(`Tasks`,`Tâches`),exec:Ve,shell:Ve,apply_patch:He},Ge={Bash:`i-lucide-terminal`,exec:`i-lucide-terminal`,shell:`i-lucide-terminal`,Read:`i-lucide-file-text`,Write:`i-lucide-file-plus`,Edit:`i-lucide-file-pen`,MultiEdit:`i-lucide-file-pen`,apply_patch:`i-lucide-file-pen`,NotebookEdit:`i-lucide-file-pen`,Grep:`i-lucide-text-search`,Glob:`i-lucide-folder-search`,WebFetch:`i-lucide-globe`,WebSearch:`i-lucide-search`,Task:`i-lucide-bot`,Agent:`i-lucide-bot`,TodoWrite:`i-lucide-list-todo`,AskUserQuestion:`i-lucide-message-circle-question`},Ke=e=>e.name===`TodoWrite`?Q(e.text||``):e.text,qe=e=>e.name===`exec`&&/^\w+$/.test(e.text||``),Ye=e=>qe(e)?Q(`Tool`):We[e.name||``]||e.name||``,Xe=e=>e.error?`i-lucide-circle-x`:qe(e)?`i-lucide-wrench`:Ge[e.name||``]||`i-lucide-wrench`,Ze=e=>`${Ye(e)} · ${e.text}`,Qe=e=>Do(e.list,ct(e.key)),$e={advisor:[`Advisor`,`i-lucide-lightbulb`],"async-result":[`Background job done`,`i-lucide-circle-check`],"irc:incoming":[`Agent message`,`i-lucide-message-square`],"launch-completion":[`Process`,`i-lucide-cpu`],"lsp-late-diagnostic":[`Diagnostics`,`i-lucide-triangle-alert`],"background-tan-dispatch":[`Background task`,`i-lucide-bot`],scheduled:[`Scheduled task`,`i-lucide-clock`]},et=/\/\.cache\/herdr-web\/uploads\/\S+/g;function tt(e){let t=C.value.file,n=[];if(!e.ref||!e.images||!t)return n;for(let r=0;r<e.images;r++)n.push(`/api/chat/image?pane=${encodeURIComponent(s.pane.id)}&file=${encodeURIComponent(t)}&ref=${e.ref}&i=${(e.imageAt||0)+r}`);return n}let nt=n(()=>{let e=il(T.value),t=new Set;if(!e.size)return t;for(let n of T.value)n.hashes&&n.role!==`user`&&tt(n).forEach((r,i)=>{e.has(`${n.ref}:${(n.imageAt||0)+i}`)&&t.add(r)});return t});function rt(e){let t=Eo(e.list)?Qe(e).rows:e.list.length<=3||ct(e.key)?e.list:[];return e.list.filter(e=>e.images&&!t.includes(e)).map(tt).filter(e=>e.length)}function it(e,t){let n;return Object.defineProperty(e,"html",{get:()=>n??=t(),enumerable:!0})}let at=r(new Set),ot=n(()=>!W.value&&s.pane.status===`working`),st=n(()=>{let e=[],t=T.value,n=[],r=new Map,i=()=>{if(!n.length)return;let t=n[0],i=`t:${t.ts}:${t.text}`,a=r.get(i)||0;r.set(i,a+1),e.push({k:`tools`,key:`${i}#${a}`,list:n,live:!1}),n=[]},a=null,o=``,c=!0,l=null,u=null,d=[],f=()=>{if(a&&a.end&&a.start&&(a.tools||a.replies)){let t=Math.max(0,Math.round((Date.parse(a.end)-Date.parse(a.start))/1e3)),n=a.tools?` · ${a.tools} ${Q(a.tools>1?`actions`:`action`)}`:``;u&&(u.endsTurn=!0),e.push({k:`turn`,key:`e:${e.length}`,text:`✓ ${zi(t)}${n}`,copy:l,reply:u?.key||null})}a=null,l=null,u=null};t.forEach((t,r)=>{if(t.ts){let n=new Date(t.ts).toDateString();n!==o&&(t.role!==`tool`&&(i(),t.role===`user`&&f()),o&&e.push({k:`day`,key:`d:${n}`,label:vr(t.ts)}),o=n)}if(t.role===`user`||t.role===`cmd`||t.role===`bash`||t.role===`notice`&&t.name===`scheduled`?(i(),f(),c=!0,t.role!==`cmd`&&(a={start:t.ts,end:null,tools:0,replies:0})):a&&t.ts&&t.role!==`notice`&&t.role!==`job`&&(a.end=t.ts,t.role===`tool`?a.tools++:t.role===`assistant`&&a.replies++),(t.role===`tool`||t.role===`assistant`||t.role===`thinking`)&&c&&(c=!1,e.push({k:`who`,key:`w:${t.ts}:${r}`})),t.role===`tool`){n.push(t);return}i();let s=`${t.role}:${t.ts}:${r}`;if(al(t))e.push({k:`autopilot`,key:s,text:t.text});else if(t.role===`user`){let n=t.text.match(et)||[],r=t.text.split(`
14
- `).map(An).filter(e=>!!e),i=t.text.replace(/^.*\/\.cache\/herdr-web\/uploads\/\S+\s*$/gm,``).split(`
15
- `).filter(e=>!zn(e)).join(`
16
- `).trim(),a=tt(t);for(let e of n)a.push(`/uploads/${encodeURIComponent(e.split(`/`).pop())}`);let o=$r(i),c=o&&Ri(d,o.reply)?.key||null;e.push({k:`user`,key:s,text:o?o.body:i,pasted:t.pasted,srcs:a,files:r,time:t.ts?Qn(t.ts):null,at:t.ts?Ar(t.ts):null,reply:o?.reply||null,origin:c})}else if(t.role===`assistant`){l=t.text;let n=t.ts?Qn(t.ts):null;u=it({k:`assistant`,key:s,id:ar(t),rid:Ai(t),text:t.text,time:n,endsTurn:!1},()=>_r(Vi(t.text),{reply:Q(`Reply`),quoted:Q(`Quoted`),discuss:Q(`Discuss`),yes:Q(`Yes`),no:Q(`No`),okAll:Q(`OK to all`),decisions:Q(`Decisions`)})),e.push(u),d.push({key:s,time:n,text:t.text,rid:u.rid})}else if(t.role===`thinking`)e.push(it({k:`thinking`,key:s,id:ar(t),text:t.text,ms:t.ms},()=>Vi(t.text)));else if(t.role===`job`&&t.job)e.push({k:`job`,key:s,id:t.job.id,tool:t.job.tool,out:t.job.out,ms:t.ms,error:!!t.error});else if(t.role===`bash`&&t.omp)e.push({k:`ompRun`,key:`s:${t.ts}:${t.text.slice(0,40)}`,tool:{...t,omp:t.omp}});else if(t.role===`bash`){let n=t.out||``,r=t.err||``,i=(n?n.split(`
8
+ `)}}),re=cr(Os,ks,e=>e),q=n(()=>i.value?.kind===`text`&&ys(i.value.path)),ie=n(()=>q.value&&re.value===`rendered`?Zi(i.value.text??``,{doc:!0}):``),ae=h(null),J=h(null),oe=new Map,se=``,ce=0;async function le(e,n){let r=++ce;se!==n&&oe.clear(),se=n;let i=!!t.file;for(let t of Array.from(e.querySelectorAll(`img[data-src]`)).slice(0,sc)){let e=Ss(n,t.dataset.src||``,i);if(e?.kind!==`file`)continue;let a=oe.get(e.path);if(a===void 0){try{let t=await _i(`/api/files/read?${x(e.path)}`);a=t.kind===`image`&&t.dataUrl?t.dataUrl:null}catch{a=null}oe.set(e.path,a)}if(r!==ce)return;a&&(t.src=a)}}let ue=h(0);B(i,()=>{ue.value++}),B([ie,J,ue],async([e,t])=>{if(ce++,!e||!t||!i.value)return;await P();let n=T;T=null,n&&ws(t,n)?.scrollIntoView({block:`start`}),le(t,i.value.path)},{flush:`post`});function de(e){let n=e.target,r=n.closest?.(`.code-copy`);if(r){let e=r.closest(`.code-block`)?.querySelector(`pre`)?.textContent;if(e==null)return;navigator.clipboard.writeText(e).then(()=>{r.textContent=Q(`Copied`),r.classList.add(`done`),setTimeout(()=>{r.textContent=Q(`Copy`),r.classList.remove(`done`)},1400)}).catch(()=>$(Q(`Copy failed`),!0));return}let a=n.closest?.(`a[href]`),o=i.value?.path;if(!a||!o)return;let s=Ss(o,a.getAttribute(`href`)||``,!!t.file);s&&s.kind!==`external`&&(e.preventDefault(),s.kind===`anchor`?J.value&&ws(J.value,s.anchor)?.scrollIntoView({block:`start`}):s.kind===`outside`?$(Q(`This link leads outside the folder.`),!0):s.kind===`dir`?t.file||b(s.path):fe(o,s.path,s.anchor))}async function fe(e,n,a){let o=n.split(`/`).slice(0,-1).join(`/`),s=t.file||r.value?.path===o?null:_i(`/api/files?pane=${d()}&path=${encodeURIComponent(o)}`).catch(()=>null);t.file&&D.value.push(e),T=a||null,await C(n);let c=await s;c&&i.value?.path===n&&(r.value=c),a||ae.value?.scrollIntoView({block:`start`})}function pe(e){return e.kind===`dir`?e.link?`i-lucide-folder-symlink`:`i-lucide-folder`:e.kind===`other`?`i-lucide-file-question`:e.link?`i-lucide-file-symlink`:`i-lucide-file`}return(t,n)=>{let l=Et,u=_s,d=qe;return _(),v(`div`,As,[I(`div`,{ref_key:`root`,ref:ae,class:`changes-inner`},[I(`div`,js,[I(`nav`,{class:`files-crumbs`,"aria-label":(`t`in t?t.t:f(Q))(`Folder`)},[f(i)&&(!e.file||f(D).length)?(_(),m(l,{key:0,icon:`i-lucide-arrow-left`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Back to folder`),onClick:U},null,8,[`aria-label`])):g(``,!0),(_(!0),v(k,null,y(f(te),(e,t)=>(_(),v(k,{key:e.path},[t?(_(),v(`span`,Ns,`/`)):g(``,!0),I(`button`,{type:`button`,class:`files-crumb`,onClick:t=>b(e.path)},M(e.label),9,Ps)],64))),128)),f(i)?(_(),v(k,{key:1},[f(te).length?(_(),v(`span`,Fs,`/`)):g(``,!0),I(`span`,Is,M(f(i).path.split(`/`).pop()),1)],64)):g(``,!0)],8,Ms),I(`div`,Ls,[f(A)?(_(),m(l,{key:0,icon:`i-lucide-external-link`,color:`neutral`,variant:`outline`,size:`sm`,to:f(A),target:`_blank`,external:``,"aria-label":(`t`in t?t.t:f(Q))(`Open`)},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Open`)),1)]),_:1},8,[`to`,`aria-label`])):g(``,!0),f(i)?(_(),m(l,{key:1,icon:`i-lucide-download`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(F),"aria-label":(`t`in t?t.t:f(Q))(`Download`),onClick:R},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Download`)),1)]),_:1},8,[`loading`,`aria-label`])):g(``,!0),E(l,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(o),"aria-label":(`t`in t?t.t:f(Q))(`Refresh`),onClick:ee},{default:H(()=>[I(`span`,Rs,M((`t`in t?t.t:f(Q))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])])]),f(s)?(_(),v(`p`,zs,M(f(s)),1)):g(``,!0),f(o)&&!f(r)&&!f(i)?(_(),v(`p`,Bs,[n[2]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in t?t.t:f(Q))(`Reading files…`)),1)])):f(i)?(_(),v(k,{key:2},[I(`p`,Vs,M(f(i).path)+` · `+M((`fmtBytes`in t?t.fmtBytes:f(vs))(f(i).size)),1),f(q)?(_(),v(`div`,{key:0,class:`segmented files-md-mode`,role:`group`,"aria-label":(`t`in t?t.t:f(Q))(`Markdown view`),style:{"--segment-count":`2`}},[(_(),v(k,null,y([`rendered`,`source`],e=>I(`button`,{key:e,type:`button`,class:j({on:f(re)===e}),"aria-pressed":f(re)===e,onClick:t=>re.value=e},[I(`span`,null,M(e===`rendered`?(`t`in t?t.t:f(Q))(`Rendered`):(`t`in t?t.t:f(Q))(`Source`)),1)],10,Us)),64))],8,Hs)):g(``,!0),f(i).truncated&&f(i).kind===`text`?(_(),v(`p`,Ws,M((`t`in t?t.t:f(Q))(`File truncated to keep this view responsive.`)),1)):g(``,!0),f(i).kind===`image`?(_(),v(`img`,{key:2,class:`files-image`,src:f(i).dataUrl,alt:f(i).path},null,8,Gs)):f(i).kind===`pdf`?(_(),m(u,{key:`${f(A)}:${f(O)}`,src:f(A),title:f(i).path},null,8,[`src`,`title`])):f(i).kind===`video`?(_(),v(k,{key:4},[f(N)?(_(),v(`p`,Ks,M((`t`in t?t.t:f(Q))(`This video cannot be played here. Use Open or Download.`)),1)):(_(),v(`video`,{key:`${f(A)}:${f(O)}`,class:`files-video`,src:f(A),"aria-label":f(i).path,controls:``,playsinline:``,preload:`metadata`,onError:n[0]||=e=>N.value=!0},null,40,qs))],64)):f(i).kind===`binary`?(_(),v(`p`,Js,M((`t`in t?t.t:f(Q))(`Binary file`)),1)):f(i).kind===`large`?(_(),v(`p`,Ys,M(/\.pdf$/i.test(f(i).path)?(`t`in t?t.t:f(Q))(`PDF too large to preview (50 MB max).`):(`t`in t?t.t:f(Q))(`Image too large to preview.`)),1)):f(ie)?(_(),v(`article`,{key:f(ue),ref_key:`doc`,ref:J,class:`md md-body files-md`,"aria-label":f(i).path,onClick:de,innerHTML:f(ie)},null,8,Xs)):(_(),v(`div`,{key:8,class:`files-code`,role:`region`,"aria-label":f(i).path},[I(`pre`,Qs,M(f(ne).numbers),1),I(`pre`,$s,M(f(ne).text),1)],8,Zs))],64)):f(r)?(_(),v(k,{key:3},[I(`label`,ec,[L(I(`input`,{"onUpdate:modelValue":n[1]||=e=>W(c)?c.value=e:null,type:`checkbox`},null,512),[[K,f(c)]]),n[3]||=a(),I(`span`,null,M((`t`in t?t.t:f(Q))(`Show hidden files`)),1)]),f(r).truncated?(_(),v(`p`,tc,M((`t`in t?t.t:f(Q))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(G).length?g(``,!0):(_(),v(`p`,nc,M((`t`in t?t.t:f(Q))(`Empty folder.`)),1)),I(`ul`,rc,[(_(!0),v(k,null,y(f(G),e=>(_(),v(`li`,{key:e.name},[I(`button`,{type:`button`,class:`change-file files-entry`,disabled:e.kind===`other`,onClick:t=>V(e)},[E(d,{name:pe(e),class:j([`files-icon`,e.kind])},null,8,[`name`,`class`]),I(`span`,ac,M(e.name),1),e.kind===`file`&&e.size!==null?(_(),v(`span`,oc,M((`fmtBytes`in t?t.fmtBytes:f(vs))(e.size)),1)):g(``,!0),e.kind===`dir`?(_(),m(d,{key:1,name:`i-lucide-chevron-right`,class:`files-chevron`})):g(``,!0)],8,ic)]))),128))])],64)):g(``,!0)],512)])}}}),{__name:`FilesView`});function lc(e,t=300,n=300){let r=h(!1),i=null,a=0,o=()=>{i&&=(clearTimeout(i),null)};return B(e,e=>{if(o(),e&&!r.value)i=setTimeout(()=>{i=null,r.value=!0,a=Date.now()},t);else if(!e&&r.value){let e=n-(Date.now()-a);e<=0?r.value=!1:i=setTimeout(()=>{i=null,r.value=!1},e)}},{immediate:!0}),s(o),r}var uc=e=>!!e&&Br.value&&!br.value&&!Qr(e)&&qi(e.agent),dc=(e,t)=>!!t&&e.id===t.id&&(e.machine||``)===(t.machine||``)&&e.agent===t.agent&&e.agentSession===t.agentSession&&e.cwd===t.cwd,fc=e=>Ar.value.panes.find(t=>t.id===e);function pc(e){return uc(e)?e.status===`blocked`&&e.prompt?Z(`The agent is waiting for your answer: answer it first.`,`L’agent attend ta réponse : réponds-lui d’abord.`):null:Z(`The agent can no longer run commands (offline, or no agent in the pane): nothing was sent.`,`L’agent ne peut plus lancer de commande (hors ligne, ou plus d’agent dans le pane) : rien n’a été envoyé.`)}function mc(e){let t=hr(e.agent),n=$r(Ar.value,e),r=ji(e),i=[n,r].filter((e,n,r)=>e&&e.toLowerCase()!==t.toLowerCase()&&r.indexOf(e)===n).join(` › `)||r,a=e.machine?Ur(e.machine):``,o=e.cwd?xr(e.cwd):``;return Z(`Run this command in ${t} “${i}”${a?` on ${a}`:``}? It runs in its shell mode (!), in ${o||`its own folder`}, and shows the output in the conversation.`,`Lancer cette commande dans ${t} « ${i} »${a?` sur ${a}`:``} ? Elle s’exécute dans son mode shell (!), dans ${o||`son propre dossier`}, et la sortie s’affiche dans la conversation.`)}async function hc(e,t){let n=fc(e),r=pc(n);if(r||!n)return r&&$(r,!0),!1;let i=Ji(n.agent,t);if(!i||(X(),!await pt(mc(n),Z(`Run`,`Lancer`),`primary`,t)))return!1;let a=fc(e);if(!dc(n,a))return $(Z(`The agent changed while you were confirming: nothing was sent. Check it and run the command again.`,`L’agent a changé pendant la confirmation : rien n’a été envoyé. Vérifie-le et relance la commande.`),!0),!1;let o=pc(a);if(o)return $(o,!0),!1;try{let e=await He(a,a.id,i);return X(),e}catch(e){return $(e.message,!0),!1}}async function gc(e){try{await navigator.clipboard.writeText(e),$(Q(`Copied`))}catch{$(Q(`Copy failed`),!0)}}function _c(e,t){return e.stopped||!e.agent?`stopped`:e.prompt?`question`:e.menu||e.screen||e.menuLeftOpen?`dialog`:e.status===`blocked`?`question`:e.pendingPrompt?`starting`:e.status===`working`?`working`:t.reason===`busy`?`busy`:`sending`}function vc(e,t){return e.agent===`claude`&&[`idle`,`done`].includes(e.status||``)&&!e.leaving&&t.state===`held`&&_c(e,t)===`busy`}var yc=`/.cache/herdr-web/uploads/`,bc=e=>e.includes(yc);function xc(e){return String(e||``).split(`
9
+ `).filter(bc).map(e=>e.trim().split(`/`).pop()).filter(Boolean)}var Sc=e=>String(e||``).split(`
10
+ `).filter(e=>!bc(e)).join(`
11
+ `).trim(),Cc=e=>xc(e).length>0&&!Sc(e),wc=/\[Image #\d+(?:, \d+x\d+)?\]/g,Tc=e=>(String(e||``).match(wc)||[]).length,Ec=e=>Tc(e)>0&&!String(e||``).replace(wc,``).trim();function Dc(e,t){return t.role!==`user`||!Cc(e)?!1:xc(e).some(e=>t.text.includes(e))||(t.images||0)>0}var Oc=e=>`/uploads/${encodeURIComponent(e)}`,kc=e=>/^\/[^\s/]*(?:\s|$)/.test(String(e||``).trim()),Ac=`/.cache/herdr-web/uploads/`,jc=e=>String(e||``).replace(/\[Image #\d+\]/g,` `).replace(/\s+/g,` `).trim().toLowerCase(),Mc=e=>jc(String(e||``).split(`
12
+ `).filter(e=>!e.includes(Ac)).join(`
13
+ `));function Nc(e,t){let n=e.replace(/\s+/g,``).slice(0,80),r=t.replace(/\s+/g,``).slice(0,80);return!n||!r?!1:n===r||Math.min(n.length,r.length)>=24&&(n.startsWith(r)||r.startsWith(n))}var Pc=(e,t)=>!!(e&&t)&&gi(e,t,Nc),Fc=(e,t)=>Ec(t)&&Tc(t)===xc(e).length,Ic=e=>/^\s*!/.test(e),Lc=e=>jc(String(e||``).replace(/^\s*!!?\s*/,``));function Rc(e,t){if(!t)return`queued`;if(Cc(e))return t.queued.some(t=>Fc(e,t))||!t.sent||!Fc(e,t.sent)?`queued`:`sent`;let n=Mc(e);if(!n||t.queued.some(e=>Pc(n,jc(e))))return`queued`;let r=t.shell?t.shell.python?/^\s*\$/.test(e)?jc(e.replace(/^\s*\$\$?\s*/,``)):``:Ic(e)?Lc(e):``:``;return t.shell&&Pc(r,jc(t.shell.command))?`running`:Ic(e)?t.sent&&Ic(t.sent)&&Pc(Lc(e),Lc(t.sent))?`sent`:`queued`:t.sent&&!Ic(t.sent)&&Pc(n,jc(t.sent))?`sent`:`queued`}function zc(e,t){let n=e.map(e=>Rc(e,t)),r=e.map(e=>!!(t&&t.queued.some(t=>Cc(e)?Fc(e,t):Pc(Mc(e),jc(t))))),i=n.reduce((e,t,n)=>t===`queued`?e:n,-1);return n.map((e,t)=>t>i?e:r.slice(0,t+1).some(Boolean)?`queued`:e===`queued`?`sent`:e)}var Bc=e=>String(e||``).replace(/\s+/g,` `).trim().toLowerCase(),Vc=(e,t)=>gi(Bc(e),Bc(t),(e,t)=>e.includes(t.slice(0,60))),Hc=new Map;function Uc(e,t){let n=(Hc.get(e)||[]).filter(e=>!t.some(t=>t.id===e.id));return n.push(...t.filter(e=>xc(e.text).length)),Hc.set(e,n.slice(-30)),Hc.get(e)}function Wc(e){let t=t=>{let n=e=>!t.at||!e.ts||Date.parse(e.ts)>=t.at-1e4;if(Cc(t.text))return e.items.some(e=>n(e)&&Dc(t.text,e));let r=Sc(t.text),i=Bc(t.text.replace(/^\s*(?:!!?|\$\$?)\s*/,``)).slice(0,60);return!!Bc(r)&&e.items.some(e=>n(e)&&(e.role===`user`?Vc(e.text,r):e.role===`bash`&&!!i&&Bc(e.text).includes(i)))},n=[...e.mine].sort((e,t)=>e.at&&t.at?e.at-t.at:0),r=n.filter(e=>!t(e)),i=zc(r.map(e=>e.text),e.screen),a=r.filter((e,t)=>Cc(e.text)&&!e.state&&i[t]===`queued`).length,o=(e.memory||[]).filter(e=>Cc(e.text)&&!n.some(t=>t.id===e.id));for(let t of e.idle?[]:e.claude){let i=t.images||0;if(!t.text){if(!i)continue;if(a>0){a--;continue}let e=o.shift(),n=t.sent||e?.text;r.push({id:`cc-${t.ts}`,text:n||``,missing:n?0:i});continue}if(!Bc(t.text)||n.some(e=>Vc(e.text,t.text))||e.items.some(e=>(!t.ts||!e.ts||e.ts>=t.ts)&&(e.role===`user`||e.role===`notice`)&&Vc(e.text,t.text)))continue;let s=i?t.sent||[...e.memory||[]].reverse().find(e=>Vc(Sc(e.text),t.text))?.text:null;r.push({id:`cc-${t.ts}`,text:s||t.text,missing:s?0:i})}let s=zc(r.map(e=>e.text),e.screen);return r.map((e,t)=>({id:e.id,raw:e.text,mine:!e.id.startsWith(`cc-`),phase:e.state?`queued`:s[t],state:e.state||null,...e.local?{local:!0}:{},...e.inputText?{inputText:e.inputText}:{},...e.reason?{reason:e.reason}:{},photos:xc(e.text),missing:e.missing||0,...e.pasted?{pasted:e.pasted}:{}}))}function Gc(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.right-n.left>.5&&n.bottom-n.top>.5)return n}return null}function Kc(e,t,n,r){if(e.bottom<n.top||e.top>n.bottom)return null;let i=n.width-t.width-8,a=Math.min(Math.max(8,e.right-t.width),i),o=r?22:6,s=e.bottom+o;if(!r&&e.right+6<=i){let r=Math.round(e.top+(e.bottom-e.top-t.height)/2);return{top:Math.min(Math.max(r,n.top),n.bottom-t.height),left:e.right+6}}if(s+t.height<=n.bottom)return{top:s,left:a};let c=e.top-6-t.height;return!r&&c>=n.top?{top:c,left:a}:{top:Math.max(n.top,n.bottom-t.height-8),left:a}}function qc(e){let t=!1,n=null,r=()=>{n&&clearTimeout(n),n=null},i=i=>{r(),n=setTimeout(()=>{n=null,t||e.show()},i)};return{down(){t=!0,r(),e.hide()},up(){t&&(t=!1,i(e.touch()?380:180))},change(n=!1){if(!n){if(e.hide(),t){r();return}i(e.touch()?380:350)}},scroll(){e.hide(),t||i(160)},dispose(){r()}}}function Jc(e){for(let t=e.length-1;t>=0;t--){let n=e[t].replace(/\s+$/u,``).length;if(n>0)return{index:t,offset:n}}return null}function Yc(e,t){let n=e.cloneRange();if(!t.contains(n.startContainer)){if(n.comparePoint(t,0)<0)return null;n.setStart(t,0)}t.contains(n.endContainer)||n.setEnd(t,t.childNodes.length);let r=[],i=[],a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let e=a.nextNode();e;e=a.nextNode()){if(!n.intersectsNode(e))continue;let t=e===n.startContainer?n.startOffset:0,a=e===n.endContainer?n.endOffset:e.data.length;r.push(e),i.push(e.data.slice(t,a))}let o=Jc(i);if(!o)return null;let s=r[o.index];return n.setEnd(s,(s===n.startContainer?n.startOffset:0)+o.offset),n}function Xc(e,t,n){let r=null;for(let i of t)!e.has(i)&&n&&(r=i),e.add(i);return r}var Zc=120,Qc=50,$c=new Map;function el(e,t,n){$c.delete(e),!(!t||n.scrollHeight-n.scrollTop-n.clientHeight<Zc)&&($c.set(e,{file:t,fromBottom:n.scrollHeight-n.scrollTop}),$c.size>Qc&&$c.delete($c.keys().next().value))}function tl(e,t,n){let r=$c.get(e);return!r||r.file!==t?null:Math.max(0,n-r.fromBottom)}var nl=()=>({misses:0,errors:0});function rl(e,t){if(!t)return{next:nl(),clear:!0};let n=e.misses+1;return n>=3?{next:nl(),clear:!0}:{next:{...e,misses:n},clear:!1}}var il=e=>({...e,errors:e.errors+1}),al=e=>e.misses+e.errors>=2;function ol(e){let t=new Set,n=new Set;for(let r of e)r.hashes&&r.hashes.forEach((e,i)=>{r.role!==`user`&&r.ref&&t.has(e)&&n.add(`${r.ref}:${(r.imageAt||0)+i}`),t.add(e)});return n}function sl(e){return e.role===`user`&&(e.text.startsWith(`Autopilot:`)||e.text.startsWith(`Autopilot woke:`))}var cl={key:0,class:`search-bar`},ll={class:`search-count`},ul={class:`chat-wrap`},dl={key:2,class:`cached-tag chat-cached`,role:`status`},fl={key:0,class:`chat-empty waiting`},pl={key:0,class:`choices-screen-text`},ml={key:1,class:`chat-empty no-integration`},hl={class:`no-integration-title`},gl={class:`no-integration-text`},_l={class:`no-integration-cmd`},vl={class:`no-integration-actions`},yl={key:2,class:`chat-empty`},bl={key:2,class:`chat-more`},xl={key:3,class:`chat-note`},Sl={key:0,class:`day-sep`},Cl=[`data-hit-key`],wl={class:`msg-system`},Tl={class:`msg-autopilot-body`},El=[`data-hit-key`],Dl=[`aria-label`,`onClick`],Ol={class:`msg-quote-time`},kl={class:`msg-quote-text`},Al={key:0,class:`msg-file-chips`},jl=[`title`],Ml={key:0,class:`q-bar`},Nl={class:`q-bar-h`},Pl=[`aria-label`,`onClick`,`onMouseenter`,`onMouseleave`,`onFocus`,`onBlur`],Fl=[`aria-pressed`,`aria-label`,`onClick`],Il=[`aria-pressed`,`onClick`],Ll={key:1,class:`msg-actions`},Rl=[`onClick`],zl=[`disabled`,`aria-expanded`,`onClick`],Bl={class:`omp-job-glyph`},Vl={class:`omp-job-label`},Hl={key:0,class:`omp-job-wall`},Ul={key:0,class:`omp-tool-out`},Wl={class:`omp-tool-out-head`},Gl={class:`omp-tool-out-label`},Kl={key:0,class:`omp-tool-out-right`},ql={class:`msg-shell-cmd`},Jl={class:`msg-shell-sign`,"aria-hidden":`true`},Yl={key:0,class:`msg-shell-body`},Xl={key:0,class:`msg-shell-out`},Zl={key:1,class:`msg-shell-out err`},Ql={key:1,class:`msg-shell-empty`},$l=[`aria-expanded`,`onClick`],eu={key:8,class:`tools omp-console omp-run`},tu={class:`omp-console-head`},nu={class:`omp-console-title`},ru={key:9,class:`msg-system`},iu={class:`msg-notice-head`},au=[`aria-expanded`,`onClick`],ou={key:11,class:`turn-end`},su=[`onClick`],cu={class:`omp-console-head`},lu={key:0,class:`omp-console-total`},uu=[`aria-expanded`,`onClick`],du={key:4,class:`chat-empty`},fu={key:5,class:`chat-empty`},pu=[`aria-label`],mu={key:0,class:`queued-list`},hu=[`aria-label`,`onClick`],gu={class:`msg-quote-time`},_u={class:`msg-quote-text`},vu=[`title`],yu={key:0,class:`msg-file-chips`},bu={class:`queued-tag sent`},xu={key:0,class:`msg-user-wrap`},Su={class:`msg-shell bash running`},Cu={class:`msg-shell-cmd`},wu={class:`msg-shell-sign`,"aria-hidden":`true`},Tu={key:0,class:`msg-shell-body`},Eu={key:0,class:`msg-shell-hidden`},Du={class:`msg-shell-out`},Ou={key:1,class:`msg-shell-empty`},ku={class:`queued-tag running`},Au=[`aria-label`,`onClick`],ju={class:`msg-quote-time`},Mu={class:`msg-quote-text`},Nu=[`title`],Pu={key:0,class:`msg-file-chips`},Fu={key:1,class:`queued-tag failed`,role:`alert`},Iu=[`disabled`,`onClick`],Lu=[`disabled`,`onClick`],Ru={key:2,class:`queued-tag`},zu=[`disabled`,`onClick`],Bu=[`disabled`,`onClick`],Vu={key:1,class:`menu-left`,role:`status`},Hu={class:`menu-left-text`},Uu={class:`menu-left-actions`},Wu=[`disabled`],Gu=[`disabled`],Ku={key:0,class:`claude-verb-line`},qu={key:1,class:`omp-step-line`},Ju={key:1},Yu=30,Xu=10,Zu=6,Qu=12,$u=Object.assign(T({__name:`ChatView`,props:V({pane:{},localQueued:{}},{search:{type:Boolean,default:!1},searchModifiers:{}}),emits:V([`gotoTerm`,`restored`,`quote`,`answered`,`unanswered`,`sent`],[`update:search`]),setup(e,{expose:t,emit:o}){let s=e;na(kr);let c=Rt(),d=o,p=D(e,`search`),b=h(null),x=h(null),S=()=>({file:null,token:``,tailStart:null,older:[],olderCursor:0,tail:[],queue:[]}),C=u(S()),T=n(()=>C.value.older.concat(C.value.tail)),O=h(null),A=h(null),F=h(null),L=u(nl()),R=h(!1),z=h(!1),V=h(null),W=n(()=>br.value||Qr(s.pane)),te=lc(n(()=>V.value!==null&&!W.value&&!Sr.value),600,0),G=lc(n(()=>!R.value&&!O.value&&!F.value)),ne=n(()=>uc(s.pane));async function K(){if(!Mi(vi()))return;let e=s.pane.id,t=await si(e);!t||De||R.value||O.value||e!==s.pane.id||(await ae(()=>{C.value={...S(),tail:t.items},V.value=t.at}),Ai(s.pane.id))}let re=e=>{let t=b.value;return!t||t.scrollHeight-t.scrollTop-t.clientHeight<e};function ie(e){let t=b.value;t&&(e||!ce&&(oe||re(160)))&&(oe=!0,ce=!1,requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight}))}async function ae(e,t=!1){let n=!ce&&(oe||re(120)),r=!R.value,i=st.value.length;e(),r?fe.value=Yu:fe.value!==1/0&&(fe.value+=Math.max(0,st.value.length-i)),await P(),R.value=!0,pe.value&&be();let a=null;J&&C.value.file&&b.value&&(J=!1,pe.value&&tl(s.pane.id,C.value.file,b.value.scrollHeight)===0&&await ye(),a=tl(s.pane.id,C.value.file,b.value.scrollHeight)),!Kn&&p.value&&Y.q.length>=2?er(!1):a!==null&&!Kn&&b.value?(oe=!1,b.value.scrollTop=a):!t&&(n||r)&&ie(!0)}let J=typeof c.query.hit!=`string`,oe=!0,ce=!1;function le(){ce=!1,xe()}let ue=null;w(()=>{ue=new ResizeObserver(()=>{let e=b.value;e&&oe&&(e.scrollTop=e.scrollHeight)}),b.value&&ue.observe(b.value),x.value&&ue.observe(x.value)}),U(()=>{b.value&&R.value&&el(s.pane.id,C.value.file,b.value)}),l(()=>ue?.disconnect());function de(){let e=b.value;e&&(he=Date.now(),tn.open=!1,ce||(oe=e.scrollHeight-e.scrollTop-e.clientHeight<120),pe.value?e.scrollTop<1500&&ve(20):e.scrollTop<400&&R.value&&ze())}let fe=h(1/0),pe=n(()=>Math.max(0,st.value.length-fe.value)),me=n(()=>pe.value?st.value.slice(pe.value):st.value),he=0,ge=!1,_e=!1;l(()=>{_e=!0});async function ve(e){if(!pe.value)return;let t=b.value,n=t?t.scrollHeight-t.scrollTop:0;fe.value=e===1/0?1/0:st.value.length-pe.value+e,await P(),t&&(t.scrollTop=t.scrollHeight-n)}let ye=()=>ve(1/0);function be(){if(ge||_e)return;ge=!0;let e=()=>{if(ge=!1,!_e&&pe.value){if(G.value||Date.now()-he<400||document.hidden)return be();ve(Xu).then(()=>{pe.value&&be()})}},t=globalThis.requestIdleCallback;t?t(e,{timeout:3e3}):setTimeout(e,250)}function xe(){Te.value=null}let Se=new Set,Ce=new Set,Te=h(null),Ee=h(null),De=!1,Oe=!1;B(qr,e=>{e||(Oe=!0,xe())}),B(br,e=>{e&&(Oe=!0,xe())});function ke(e){let t=De&&!Oe&&or.value&&!p.value&&!W.value,n=De&&!Oe&&!p.value&&!W.value,r=Xc(Ce,e.filter(e=>e.role===`thinking`).map(dr),n);r&&(Te.value={id:r,at:Date.now()}),Oe=!1,De=!0;let i=Vi(Se,e.filter(e=>e.role===`assistant`).map(dr),t&&!r);i&&(Ee.value={id:i,at:Date.now()})}let Ae=e=>Ee.value&&Ee.value.id===e?Ee.value.at:null;function je(e){Ee.value?.id===e&&(Ee.value=null)}B([or,p],([e,t])=>{(!e||t)&&(Ee.value=null),t&&xe()});function Me(e){return Te.value?.id===e?Te.value.at:null}function Ne(e){Te.value?.id===e&&xe()}async function Pe(){if(A.value){X();try{await navigator.clipboard.writeText(A.value.command),$(Z(`Command copied.`,`Commande copiée.`))}catch{$(Q(`Copy failed`),!0)}}}let Fe=Dn();async function Ie(e){let t=s.pane.id,n=()=>!e()||t!==s.pane.id;try{let e=C.value.tailStart===null?await Fe.take(s.pane):void 0;if(n())return!1;let r=e||await _i(`/api/chat?${Xt(t,C.value)}`);if(n())return!1;if(!r.available){let e=rl(L.value,!!C.value.file&&T.value.length>0);return L.value=e.next,e.clear?(C.value=S(),O.value=r.reason||`unsupported`,A.value=r.reason===`no_integration`&&r.integration||null,De=!0,!1):!1}if(O.value=null,A.value=null,F.value=null,(L.value.misses||L.value.errors)&&(L.value=nl()),r.unchanged)return!1;if(V.value=null,nn(C.value,r))return C.value=S(),De=!1,!0;let i=en(C.value.tail,r);if(!i)return C.value={...C.value,token:``},!0;if(await ae(()=>{let e={...C.value};e.tailStart===null&&(e.tailStart=r.start??0,e.olderCursor=r.start??0),e.file=r.file||null,e.token=r.token||``,e.tail=i,e.queue=r.queue||[],C.value=e,ke(e.tail)}),li(t,T.value),e)return!0}catch(e){if(n())return!1;T.value.length?L.value=il(L.value):F.value=e.message}return!1}let Le=$t(Ie),Re=Le.load;B(()=>s.pane.id,()=>Le.invalidate());async function ze(){if(z.value||!(C.value.olderCursor>0))return;z.value=!0;let e=s.pane.id,t=C.value.file,n=C.value.olderCursor;try{let r=await _i(`/api/chat?pane=${encodeURIComponent(e)}&before=${n}`);if(e!==s.pane.id||r.file!==t||C.value.olderCursor!==n)return;let i=b.value,a=i?i.scrollHeight-i.scrollTop:0;await ae(()=>{fe.value=1/0,C.value={...C.value,older:(r.items||[]).concat(C.value.older),olderCursor:(r.start??0)<n?r.start??0:0}},!0),li(e,T.value),i&&(i.scrollTop=i.scrollHeight-a)}catch(e){$(e.message,!0)}finally{z.value=!1}}let Be;w(()=>{Promise.all([Re(),K()]).then(mr),Be=ur(()=>{!document.hidden&&!br.value&&Re()},1500)}),l(()=>clearInterval(Be)),B(qr,e=>{e&&Re()});let Ve=Z(`Command`,`Commande`),He=Z(`Edit`,`Modif`),Ue=Z(`Subagent`,`Sous-agent`),We={Bash:Ve,Read:Z(`Read`,`Lecture`),Write:Z(`Write`,`Écriture`),Edit:He,MultiEdit:He,Grep:Z(`Search`,`Recherche`),Glob:Z(`Files`,`Fichiers`),WebFetch:`Web`,WebSearch:Z(`Web search`,`Recherche web`),Task:Ue,Agent:Ue,TodoWrite:Z(`Tasks`,`Tâches`),exec:Ve,shell:Ve,apply_patch:He},Ge={Bash:`i-lucide-terminal`,exec:`i-lucide-terminal`,shell:`i-lucide-terminal`,Read:`i-lucide-file-text`,Write:`i-lucide-file-plus`,Edit:`i-lucide-file-pen`,MultiEdit:`i-lucide-file-pen`,apply_patch:`i-lucide-file-pen`,NotebookEdit:`i-lucide-file-pen`,Grep:`i-lucide-text-search`,Glob:`i-lucide-folder-search`,WebFetch:`i-lucide-globe`,WebSearch:`i-lucide-search`,Task:`i-lucide-bot`,Agent:`i-lucide-bot`,TodoWrite:`i-lucide-list-todo`,AskUserQuestion:`i-lucide-message-circle-question`},Ke=e=>e.name===`TodoWrite`?Q(e.text||``):e.text,Je=e=>e.name===`exec`&&/^\w+$/.test(e.text||``),Ye=e=>Je(e)?Q(`Tool`):We[e.name||``]||e.name||``,Xe=e=>e.error?`i-lucide-circle-x`:Je(e)?`i-lucide-wrench`:Ge[e.name||``]||`i-lucide-wrench`,Ze=e=>`${Ye(e)} · ${e.text}`,Qe=e=>No(e.list,lt(e.key)),$e={advisor:[`Advisor`,`i-lucide-lightbulb`],"async-result":[`Background job done`,`i-lucide-circle-check`],"irc:incoming":[`Agent message`,`i-lucide-message-square`],"launch-completion":[`Process`,`i-lucide-cpu`],"lsp-late-diagnostic":[`Diagnostics`,`i-lucide-triangle-alert`],"background-tan-dispatch":[`Background task`,`i-lucide-bot`],scheduled:[`Scheduled task`,`i-lucide-clock`]},et=/\/\.cache\/herdr-web\/uploads\/\S+/g;function tt(e){let t=C.value.file,n=[];if(!e.ref||!e.images||!t)return n;for(let r=0;r<e.images;r++)n.push(`/api/chat/image?pane=${encodeURIComponent(s.pane.id)}&file=${encodeURIComponent(t)}&ref=${e.ref}&i=${(e.imageAt||0)+r}`);return n}let nt=n(()=>{let e=ol(T.value),t=new Set;if(!e.size)return t;for(let n of T.value)n.hashes&&n.role!==`user`&&tt(n).forEach((r,i)=>{e.has(`${n.ref}:${(n.imageAt||0)+i}`)&&t.add(r)});return t});function rt(e){let t=Mo(e.list)?Qe(e).rows:e.list.length<=3||lt(e.key)?e.list:[];return e.list.filter(e=>e.images&&!t.includes(e)).map(tt).filter(e=>e.length)}function it(e,t){let n;return Object.defineProperty(e,"html",{get:()=>n??=t(),enumerable:!0})}let at=r(new Set),ot=n(()=>!W.value&&s.pane.status===`working`),st=n(()=>{let e=[],t=T.value,n=[],r=new Map,i=()=>{if(!n.length)return;let t=n[0],i=`t:${t.ts}:${t.text}`,a=r.get(i)||0;r.set(i,a+1),e.push({k:`tools`,key:`${i}#${a}`,list:n,live:!1}),n=[]},a=null,o=``,c=!0,l=null,u=null,d=[],f=()=>{if(a&&a.end&&a.start&&(a.tools||a.replies)){let t=Math.max(0,Math.round((Date.parse(a.end)-Date.parse(a.start))/1e3)),n=a.tools?` · ${a.tools} ${Q(a.tools>1?`actions`:`action`)}`:``;u&&(u.endsTurn=!0),e.push({k:`turn`,key:`e:${e.length}`,text:`✓ ${Wi(t)}${n}`,copy:l,reply:u?.key||null})}a=null,l=null,u=null};t.forEach((t,r)=>{if(t.ts){let n=new Date(t.ts).toDateString();n!==o&&(t.role!==`tool`&&(i(),t.role===`user`&&f()),o&&e.push({k:`day`,key:`d:${n}`,label:wr(t.ts)}),o=n)}if(t.role===`user`||t.role===`cmd`||t.role===`bash`||t.role===`notice`&&t.name===`scheduled`?(i(),f(),c=!0,t.role!==`cmd`&&(a={start:t.ts,end:null,tools:0,replies:0})):a&&t.ts&&t.role!==`notice`&&t.role!==`job`&&(a.end=t.ts,t.role===`tool`?a.tools++:t.role===`assistant`&&a.replies++),(t.role===`tool`||t.role===`assistant`||t.role===`thinking`)&&c&&(c=!1,e.push({k:`who`,key:`w:${t.ts}:${r}`})),t.role===`tool`){n.push(t);return}i();let s=`${t.role}:${t.ts}:${r}`;if(sl(t))e.push({k:`autopilot`,key:s,text:t.text});else if(t.role===`user`){let n=t.text.match(et)||[],r=t.text.split(`
14
+ `).map(gn).filter(e=>!!e),i=t.text.replace(/^.*\/\.cache\/herdr-web\/uploads\/\S+\s*$/gm,``).split(`
15
+ `).filter(e=>!Vn(e)).join(`
16
+ `).trim(),a=tt(t);for(let e of n)a.push(`/uploads/${encodeURIComponent(e.split(`/`).pop())}`);let o=Ri(i),c=o&&ti(d,o.reply)?.key||null;e.push({k:`user`,key:s,text:o?o.body:i,pasted:t.pasted,srcs:a,files:r,time:t.ts?rr(t.ts):null,at:t.ts?Fr(t.ts):null,reply:o?.reply||null,origin:c})}else if(t.role===`assistant`){l=t.text;let n=t.ts?rr(t.ts):null;u=it({k:`assistant`,key:s,id:dr(t),rid:oi(t),text:t.text,time:n,endsTurn:!1},()=>Cr(Zi(t.text),{reply:Q(`Reply`),quoted:Q(`Quoted`),discuss:Q(`Discuss`),yes:Q(`Yes`),no:Q(`No`),okAll:Q(`OK to all`),decisions:Q(`Decisions`)})),e.push(u),d.push({key:s,time:n,text:t.text,rid:u.rid})}else if(t.role===`thinking`)e.push(it({k:`thinking`,key:s,id:dr(t),text:t.text,ms:t.ms},()=>Zi(t.text)));else if(t.role===`job`&&t.job)e.push({k:`job`,key:s,id:t.job.id,tool:t.job.tool,out:t.job.out,ms:t.ms,error:!!t.error});else if(t.role===`bash`&&t.omp)e.push({k:`ompRun`,key:`s:${t.ts}:${t.text.slice(0,40)}`,tool:{...t,omp:t.omp}});else if(t.role===`bash`){let n=t.out||``,r=t.err||``,i=(n?n.split(`
17
17
  `).length:0)+(r?r.split(`
18
- `).length:0);e.push({k:`shell`,key:`s:${t.ts}:${t.text.slice(0,40)}`,bash:t.role===`bash`,text:t.text,out:n,err:r,lines:i,long:i>Xu||n.length+r.length>1500})}else if(t.role===`notice`){let[n,r]=$e[t.name||``]||[t.name||`Note`,`i-lucide-info`];e.push(it({k:`notice`,key:s,label:Q(n),icon:r,scheduled:t.name===`scheduled`,long:t.name===`scheduled`||t.text.split(`
19
- `).length>Xu||t.text.length>1200},()=>Vi(t.text)))}else{let n=t.role===`system`?t.text.match(/^Effort : (low|medium|high|xhigh|max|ultracode) \(cette session\)$/):null;e.push({k:`system`,key:s,text:n?Z(`Effort: ${n[1]} (this session)`,`Effort : ${n[1]} (cette session)`):t.role===`system`?Q(t.text):t.text})}}),i();let p=!W.value&&s.pane.status===`blocked`;if(!ot.value&&!p&&!s.pane.pendingPrompt)f();else{let t=e[e.length-1];t&&t.k===`tools`&&(ot.value||p)&&(t.live=!0)}return e}),ct=e=>at.has(e);function ut(e,t){t?at.add(e):at.delete(e)}let dt=e=>[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(t=>t.dataset.hitKey===e)||null,ft=e=>{let t=e?.closest(`[data-hit-key]`)?.dataset.hitKey,n=t?st.value.find(e=>e.key===t):null;return n&&n.k===`assistant`?{time:n.time,id:n.rid}:{time:null,id:null}};function pt(e){let{time:t,id:n}=ft(e);if(e.classList.contains(`q-all`))return dr({n:e.dataset.n||``,text:e.dataset.q||``},t,n,zr(e));let r=e.closest(`.q-trow`);return r?Bi(jr(r),t,n):e.dataset.q?wi(e.dataset.q,t,n):null}function mt(e){let t=st.value.find(t=>t.key===e);t&&t.k===`assistant`&&ht(ci(t.text,t.time,t.rid))}function ht(e){let t=Hn(s.pane.id),n=e?Xn(t.text,e):null;jt.value=null,window.getSelection()?.removeAllRanges(),n!==null&&(t.text=n),X(),d(`quote`)}let gt=e=>Q(e===`yes`?`Yes`:`No`),_t=()=>{se=!1,le=!0};function vt(e,t,n){if(!e)return;_t();let r=Hn(s.pane.id),i=gi(r.text,e,gt(t));i!==null&&(r.text=i),X(),n&&d(`answered`,hi(r.text,e))}function yt(e,t){if(!e)return;_t();let n=Hn(s.pane.id);n.text=Vr(n.text,e,Z(`OK to all`,`OK tout`)),X(),t&&d(`answered`,hi(n.text,e))}let bt=(e,t)=>Lr(Sr(Dt.value,e)||``)===t;function xt(){let e=Hn(s.pane.id).text;for(let t of x.value?.querySelectorAll(`.q-ans, .q-tans`)||[]){let n=pt(t);t.setAttribute(`aria-pressed`,String(!!n&&Lr(Sr(e,n)||``)===t.dataset.a))}for(let t of x.value?.querySelectorAll(`.q-all`)||[])t.setAttribute(`aria-pressed`,String(Er(e,pt(t))));for(let t of x.value?.querySelectorAll(`.q-reply, .q-point, .q-tquote`)||[]){let n=pt(t),r=!!n&&Er(e,n);if(t.classList.toggle(`quoted`,r),t.dataset.n&&!t.classList.contains(`q-tquote`))for(let e of St(t))e.classList.toggle(`quoted`,r)}}let St=e=>e.closest(`.md-body`)?.querySelectorAll(`.q-text[data-n="${e.dataset.n}"]`)||[],Ct=e=>e.closest(`.md-body`)?.querySelector(`.q-reply[data-n="${e.dataset.n}"]`)||null,wt=null;function Tt(e){wt?.classList.remove(`q-armed`),wt=e,e?.classList.add(`q-armed`)}let J=h(null),Dt=n(()=>Hn(s.pane.id).text);B(Dt,e=>{e||(le=!1)});function Ot(e,t,n){for(let r of dt(e)?.querySelectorAll(`.q-text[data-n="${t}"]`)||[])r.classList.toggle(`q-hot`,n)}let kt;function At(e,t){let n=t.closest(`.msg-ai .md-body .q-pt`),r=n?.querySelector(`:scope > .q-point`),i=r?.dataset.q;if(clearTimeout(kt),!n||!i||t.closest(`a, button, summary, input`))return Tt(null);if(mi.value===`list`){J.value&&n.closest(`[data-hit-key]`)?.dataset.hitKey===J.value&&(J.value=null,ht(pt(r)));return}if(mi.value!==`text`||window.getSelection()?.isCollapsed===!1)return Tt(null);if(Nt())return Tt(n===wt?null:n);e.detail>1||(kt=setTimeout(()=>{window.getSelection()?.isCollapsed!==!1&&ht(pt(r))},220))}l(()=>clearTimeout(kt)),B([()=>Hn(s.pane.id).text,he],()=>P(xt),{flush:`post`});let jt=h(null),Mt=h(null),Nt=()=>window.matchMedia(`(pointer: coarse)`).matches;function Pt(){let e=window.getSelection(),t=e&&!e.isCollapsed&&e.rangeCount?e.getRangeAt(0):null,n=(t?t.startContainer.nodeType===1?t.startContainer:t.startContainer.parentElement:null)?.closest(`.msg-ai[data-hit-key]`);if(!t||!n||W.value||!x.value?.contains(n))return null;let r=Uc(t,n.querySelector(`.md`)||n),i=r?.toString().trim()||``;if(!r||!i)return null;let a=zc(r.getClientRects())||r.getBoundingClientRect();return{host:n,text:i,end:a,sig:`${i}|${Math.round(a.right)}|${Math.round(a.top)}`}}function It(){let e=Pt();if(!e||!x.value){jt.value=null;return}let t=x.value.getBoundingClientRect(),n=Bc(e.end,{width:Mt.value?.offsetWidth||104,height:Mt.value?.offsetHeight||32},{width:window.innerWidth,top:Math.max(0,t.top),bottom:Math.min(window.innerHeight,t.bottom)},Nt());jt.value=n?{text:e.text,...ft(e.host),sig:e.sig,...n}:null}let Lt=Vc({show:It,hide:()=>{jt.value=null},touch:Nt}),zt=e=>{e.button===0&&!e.target?.closest?.(`.sel-reply`)&&Lt.down()},Bt=()=>Lt.up(),Vt=()=>Lt.change(!!jt.value&&Pt()?.sig===jt.value.sig),Ht=()=>{(jt.value||window.getSelection()?.isCollapsed===!1)&&Lt.scroll()};w(()=>{document.addEventListener(`pointerdown`,zt,!0),document.addEventListener(`pointerup`,Bt,!0),document.addEventListener(`pointercancel`,Bt,!0),document.addEventListener(`selectionchange`,Vt),window.addEventListener(`scroll`,Ht,!0),window.addEventListener(`resize`,Ht)}),l(()=>{Lt.dispose(),document.removeEventListener(`pointerdown`,zt,!0),document.removeEventListener(`pointerup`,Bt,!0),document.removeEventListener(`pointercancel`,Bt,!0),document.removeEventListener(`selectionchange`,Vt),window.removeEventListener(`scroll`,Ht,!0),window.removeEventListener(`resize`,Ht)}),i(`gotoRef`,(e,t)=>{let n=t.closest(`[data-hit-key]`)?.dataset.hitKey,r=n?st.value.findIndex(e=>e.key===n):-1,i=(r<0?st.value:st.value.slice(0,r)).flatMap(e=>e.k===`assistant`?[{key:e.key,time:e.time,text:e.text,rid:e.rid}]:[]);Ut(Ri(i,{time:e.time||``,excerpt:e.excerpt,id:e.id&&ni(e.id)})?.key||null)});async function Ut(e){e&&!dt(e)&&me.value&&await be();let t=e?dt(e):null;if(!t)return $(Q(`Original message not found (further up the conversation?)`),!0);t.scrollIntoView({block:`center`,behavior:`smooth`}),t.classList.remove(`msg-flash`),t.offsetWidth,t.classList.add(`msg-flash`),setTimeout(()=>t.classList.remove(`msg-flash`),1700)}let Gt=uc;function Kt(e){let t=e.target,n=t.closest?.(`.q-ans`),r=e.detail>0;if(n?.dataset.q){e.preventDefault(),Tt(null),J.value=null,vt(pt(n),n.dataset.a===`no`?`no`:`yes`,r);return}let i=t.closest?.(`.q-tans`);if(i?.dataset.n){e.preventDefault(),Tt(null),J.value=null,vt(pt(i),i.dataset.a===`no`?`no`:`yes`,r);return}let a=t.closest?.(`.q-all`);if(a){e.preventDefault(),Tt(null),J.value=null,yt(pt(a),r);return}let o=t.closest?.(`.q-reply, .q-point, .q-tquote`);if(o){e.preventDefault(),Tt(null),J.value=null,ht(pt(o));return}let s=mi.value===`text`&&!W.value?t.closest?.(`.q-text`):null,c=s&&window.getSelection()?.isCollapsed!==!1?Ct(s):null;if(c){e.preventDefault(),Tt(null),ht(pt(c));return}let l=t.closest?.(`.md-body .md-path`);if(l){e.preventDefault(),ln(l);return}let u=t.closest?.(`.md-body .md-cmd`);if(u){e.preventDefault(),$t(u);return}let d=t.closest?.(`.md-body img`);if(d&&d.src){e.preventDefault(),pr(d.src);return}!W.value&&!t.closest?.(`.code-block`)&&At(e,t);let f=(t.closest?.(`.can-run .code-run`))?.closest(`.code-block`)?.dataset.cmd;if(f){Zt(f);return}let p=t.closest?.(`.code-copy`);if(!p)return;let m=p.closest(`.code-block`),h=m?.dataset.cmd??m?.querySelector(`pre`)?.textContent;h!=null&&navigator.clipboard.writeText(h).then(()=>{p.textContent=Q(`Copied`),p.classList.add(`done`),setTimeout(()=>{p.textContent=Q(`Copy`),p.classList.remove(`done`)},1400)}).catch(()=>$(Q(`Copy failed`),!0))}async function Zt(e){let t=await lc(s.pane.id,e);t!==!1&&d(`sent`,t)}function Qt(e,t){let n=[];return t&&n.push({label:Z(`Run…`,`Lancer…`),icon:`i-lucide-play`,run:()=>Zt(e)}),n.push({label:Q(`Copy command`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>Gt(e)}),n}function $t(e){let t=e.dataset.cmd;t&&on(e,Qt(t,ne.value&&!!e.closest(`.can-run`)),Z(`Command`,`Commande`))}let en=r({open:!1,x:0,y:0,w:0,h:0}),tn=h([]);function on(e,t,n){if(ii.value){X(),Te(t,n);return}let r=e.getBoundingClientRect();Object.assign(en,{x:r.left,y:r.top,w:r.width,h:r.height}),tn.value=ce(t),en.open=!0}let sn=e=>e.replace(/\/+$/,``).split(`/`).pop()||e;function cn(e){let t=[];return!mr.value&&!e.endsWith(`/`)&&t.push({label:Q(`Preview`),icon:`i-lucide-eye`,run:()=>dn(e)},{label:Q(`Download`),icon:`i-lucide-download`,run:()=>fn(e)}),_i(s.pane)&&!mr.value&&t.push({label:Q(`Reveal in Finder`),icon:`i-lucide-folder-search`,run:()=>mn(e,`reveal`)},{label:Q(`Open`),icon:`i-lucide-external-link`,run:()=>mn(e,`open`)}),t.push({label:Q(`Copy path`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>Gt(e)}),t}function ln(e,t){let n=t||(e.textContent||``).trim();n&&on(e,cn(n),sn(n))}let un=r({open:!1,path:``});function dn(e){Object.assign(un,{open:!0,path:e})}async function fn(e){try{await Oi(`/api/files/download?pane=${encodeURIComponent(s.pane.id)}&path=${encodeURIComponent(e)}&from=chat`,sn(Gi(e)))}catch(e){$(e.message,!0)}}function pn(e){if(e.key===`Escape`&&(J.value||wt)){J.value=null,Tt(null);return}if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest?.(`.md-body .md-path, .md-body .md-cmd`);t&&(e.preventDefault(),t.classList.contains(`md-cmd`)?$t(t):ln(t))}async function mn(e,t){try{let n=await fi(`/api/reveal`,{pane_id:s.pane.id,path:e,mode:t});$(t===`reveal`?Z(`Shown in Finder on ${n.machine}`,`Affiché dans le Finder sur ${n.machine}`):Z(`Opened in the editor on ${n.machine}`,`Ouvert dans l’éditeur sur ${n.machine}`))}catch(e){$(e.message,!0)}}let hn=n(()=>{if(W.value)return null;let e=s.pane;return e.agent===`omp`?e.ompShell?{shell:e.ompShell,sent:null,queued:[]}:null:e.agent===`claude`&&e.status===`working`&&e.claudeScreen||null}),gn=n(()=>hn.value&&hn.value.shell||null),_n=h(Date.now()),vn;B(gn,e=>{e&&!vn&&(vn=Tr(()=>{_n.value=Date.now()},1e3)),!e&&vn&&(clearInterval(vn),vn=void 0)},{immediate:!0}),l(()=>clearInterval(vn));let yn=n(()=>{let e=gn.value&&gn.value.since;if(!e)return null;let t=Math.max(0,Math.round((_n.value-e)/1e3));return t<60?`${t} s`:`${Math.floor(t/60)} min ${String(t%60).padStart(2,`0`)} s`}),bn=n(()=>{let e=s.pane,t=Dn(W.value?[]:(e.queued||[]).filter(e=>!e.back),s.localQueued),n=Lc(e.id,t),r=st.value.filter(e=>e.k===`assistant`),i=dc(e,{})===`sending`;return Rc({mine:t,claude:C.value.queue||[],items:T.value,screen:hn.value,memory:n,idle:i}).map(e=>{let t=e.raw.split(`
20
- `),n=t.filter(e=>!mc(e)&&!zn(e)).join(`
21
- `).trim(),i=$r(n);return{...e,srcs:e.photos.map(Sc),files:t.map(An).filter(e=>!!e),text:n,body:i?i.body:n,reply:i?.reply||null,origin:i&&Ri(r,i.reply)?.key||null}})}),xn=e=>[...e.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...Array.from({length:e.missing},()=>({type:`file`,mediaType:`image/jpeg`,url:``})),...e.body||e.files.length?[{type:`text`,text:e.body||` `}]:[]],Sn=n(()=>!W.value&&rn(s.pane)),wn=h(null);async function Tn(e){if(!wn.value){if(e.local){an(Hn(s.pane.id),Cn(s.pane.id,e.id)||e.raw),d(`restored`);return}wn.value=e.id,X();try{let t=await fi(`/api/unqueue`,{pane_id:s.pane.id,text:e.raw,id:e.mine?e.id:void 0});an(Hn(s.pane.id),t.text||e.raw,e.pasted),d(`restored`),t.lost?$(Q(`Removed from the queue`),!0,nn(t.lost)):$(Q(`Removed from the queue`)),setTimeout(Re,400)}catch(e){$(e.message,!0)}finally{wn.value=null}}}let En=h(null);async function On(e){if(!En.value){En.value=e.id,X();try{e.local?await Rn(s.pane,s.pane.id,e.id):await fi(`/api/requeue`,{pane_id:s.pane.id,id:e.id})}catch(e){$(e.message,!0)}finally{En.value=null}}}let kn=n(()=>!!s.pane.menuLeftOpen&&bn.value.some(e=>e.phase===`queued`)),jn=h(null);async function Mn(e){if(!jn.value){jn.value=e,X();try{await fi(`/api/menu-left`,{pane_id:s.pane.id,action:e})}catch(e){$(e.message,!0)}finally{jn.value=null}}}function Nn(e){return Q(e===`busy`?`Not sent — the agent’s input contains text`:e===`no_input`?`Not sent — the agent’s input field was not found on its screen`:e===`lost`?`Not sent — it was taken out of the agent’s queue before being read`:e===`unseen`?`Not sent — still not in the conversation after an hour`:`Not sent`)}let Pn=h(null);async function Fn(e){if(!Pn.value){Pn.value=e.id;try{await fi(`/api/clear-queued-input`,{pane_id:s.pane.id,id:e.id,input_text:e.inputText})}catch(e){$(e.message,!0)}finally{Pn.value=null}}}function In(e){if(e.state===`sending`)return Q(`Queued · `)+Q(`sending…`);switch(dc(s.pane,e)){case`busy`:return e.inputText?Z(`Not sent: the agent’s input already contains text (“${e.inputText}”)`,`Pas envoyé : la saisie de l’agent contient déjà du texte (« ${e.inputText} »)`):Q(`Not sent — the agent’s input contains text`);case`stopped`:return Q(`Queued · `)+Q(`agent stopped`);case`question`:return Q(`Queued · `)+Q(`after you answer the question`);case`dialog`:return Q(`Queued · `)+Q(`will be sent when the menu closes`);case`starting`:return Q(`Queued · `)+Q(`agent starting`);case`working`:return Q(`Queued`);default:return Q(`Queued · `)+Q(`sending…`)}}B(()=>bn.value.map(e=>`${e.id}:${e.phase}`).join(`,`),()=>P(()=>ie(!1))),B(()=>gn.value&&gn.value.lines.join(`
22
- `),()=>P(()=>ie(!1)));let Ln=n(()=>{let e=s.pane;if(e.menu||e.interaction===`terminal`||!O.value||O.value===`unsupported`||!e.screen||e.status===`working`||W.value)return null;let t=lr(e.agent);return Ni(e)?{text:Z(`${t} is waiting for your answer, below or in the terminal.`,`${t} attend ta réponse, ci-dessous ou dans le terminal.`),lines:[]}:{text:Z(`${t} is waiting for an action in the terminal.`,`${t} attend une action dans le terminal.`),lines:e.screen.lines}}),Bn=n(()=>{if(W.value)return null;let e=s.pane;if(e.pendingPrompt&&e.status!==`working`)return{typing:!0,text:Z(`Your first message will be sent when ${lr(e.agent)} is ready`,`Ton premier message partira dès que ${lr(e.agent)} sera prêt`)};if(gn.value)return{typing:!0,text:Z(`Command running…`,`Commande en cours…`)};if(e.status===`working`&&e.agent===`claude`&&e.activity)return{typing:!0,verb:!0,text:`${e.activity}…`};if(e.status===`working`&&e.agent===`omp`&&e.ompActivity){let t=e.ompActivity;return{typing:!0,omp:!0,since:t.since,text:t.step||`${lr(e.agent)} ${Z(`is working…`,`travaille…`)}`}}return e.status===`working`?{typing:!0,text:`${lr(e.agent)} ${Z(`is working…`,`travaille…`)}`}:e.status===`blocked`&&!e.menu&&!Ln.value&&!(e.prompt&&e.prompt.options)&&!Ni(e)?{typing:!1,text:Q(`Waiting for your reply — details in the Terminal tab`)}:null});B(()=>s.pane.status,()=>P(()=>ie(!1)));let Y=r({q:``,hits:[],cur:-1,loading:!1}),Vn=!1,Un=h(null),Wn=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase(),Gn=typeof CSS<`u`&&`highlights`in CSS?CSS.highlights:null,Kn=globalThis.Highlight;function qn(){Gn?.delete(`hw-hit`),Gn?.delete(`hw-cur`)}function Jn(e,t){if(qn(),Y.hits=[],!p.value||Y.q.length<2||!x.value)return;let n=Wn(Y.q),r=document.createTreeWalker(x.value,NodeFilter.SHOW_TEXT);for(let e=r.nextNode();e;e=r.nextNode()){let t=Wn(e.nodeValue||``),r=0,i;for(;(i=t.indexOf(n,r))>=0;){let t=document.createRange();t.setStart(e,i),t.setEnd(e,Math.min(i+n.length,(e.nodeValue||``).length)),Y.hits.push(t),r=i+n.length}}if(t){let e=Y.hits.findIndex(e=>t.contains(e.startContainer));Y.cur=e>=0?e:0}else(e||Y.cur>=Y.hits.length)&&(Y.cur=Y.hits.length-1);Yn()}function Yn(){if(Gn&&Kn){Gn.set(`hw-hit`,new Kn(...Y.hits.filter((e,t)=>t!==Y.cur)));let e=Y.hits[Y.cur];e?Gn.set(`hw-cur`,new Kn(e)):Gn.delete(`hw-cur`)}let e=Y.hits[Y.cur],t=b.value;if(e&&t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();t.scrollTo({top:t.scrollTop+n.top-r.top-t.clientHeight/2,behavior:`smooth`})}}let Zn=n(()=>Y.loading?Q(`loading…`):Y.q.length<2?``:Y.hits.length?`${Y.cur+1}/${Y.hits.length}`:Q(`no results`));function er(e){Y.hits.length&&(Y.cur=(Y.cur+e+Y.hits.length)%Y.hits.length,Yn())}async function nr(){for(;C.value.olderCursor>0;){let e=C.value.olderCursor;if(await ze(),C.value.olderCursor===e)break}}let rr;function ir(){clearTimeout(rr),rr=setTimeout(or,250)}async function or(){if(Y.q.trim().length<2){qn(),Y.hits=[],Y.cur=-1;return}C.value.olderCursor>0&&!W.value&&(Y.loading=!0,await nr(),Y.loading=!1),await be(),Jn(!0)}async function sr(){let e=c.query.hit,t=c.query.q;if(typeof e!=`string`||typeof t!=`string`||!/^\d+$/.test(e))return;let n=Number(e);p.value=!0,Y.q=t,Y.loading=!0,Vn=!0;try{for(;C.value.olderCursor>n&&!W.value;){let e=C.value.olderCursor;if(await ze(),C.value.olderCursor>=e)break}await be();let e=String(c.query.role||``),t=String(c.query.ts||``),r=String(c.query.prefix||``),i=T.value.findIndex(n=>n.role===e&&n.ts===t&&n.text.startsWith(r)),a=i<0?``:`${e}:${t}:${i}`,o=[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(e=>e.dataset.hitKey===a);Jn(!1,o),o&&!Y.hits.length&&o.scrollIntoView({block:`center`})}finally{Vn=!1,Y.loading=!1}}B(()=>c.query.hit,()=>{c.params.pane===s.pane.id&&sr()});function cr(){p.value=!1}B(p,e=>{e?P(()=>Un.value?.inputRef?.focus()):(Y.q=``,Y.hits=[],Y.cur=-1,qn())}),l(qn);function fr(e){e.key===`Enter`&&(e.preventDefault(),er(e.shiftKey?1:-1)),e.key===`Escape`&&(e.preventDefault(),cr())}function pr(e){Ft([e])}function hr(){let e=Un.value?.inputRef;e?.focus(),e?.select()}let br=n(()=>{if(W.value||ot.value||s.pane.status===`blocked`||bn.value.length||gn.value)return null;let e=st.value.findLast(e=>e.k===`assistant`||e.k===`user`||e.k===`autopilot`||e.k===`shell`||e.k===`ompRun`);if(!e||e.k!==`assistant`||je(e.id)!==null)return null;let t=yr(e.html);return t.questions.length+t.rows.length?{key:e.key,time:e.time,rid:e.rid,targets:t}:null}),xr=n(()=>{let e=br.value?ur(br.value.targets,Dt.value,br.value.time,br.value.rid):0;return br.value&&e?{key:br.value.key,count:e}:null});B(()=>xr.value?.count||0,e=>d(`unanswered`,e),{immediate:!0}),l(()=>d(`unanswered`,0));function wr(){let e=xr.value?dt(xr.value.key):null,t=Dt.value,n=ft(e),r=[...e?.querySelectorAll(`.q-reply, .q-trow`)||[]].find(e=>e.classList.contains(`q-trow`)?!$n(t,jr(e),n.time,n.id):!Er(t,pt(e)));if(!r)return;let i=r.classList.contains(`q-trow`)?[r]:[...St(r)];(i[0]||r).scrollIntoView({block:`center`,behavior:Si.value?`auto`:`smooth`});for(let e of i)e.classList.remove(`q-flash`),e.offsetWidth,e.classList.add(`q-flash`),setTimeout(()=>e.classList.remove(`q-flash`),1700);X()}return t({scrollToEnd:ie,reload:()=>setTimeout(Re,400),focusSearch:hr,gotoUnanswered:wr}),(t,n)=>{let r=Jt,i=Et,o=Xt,s=Je,c=ka,l=ja,u=La,h=Wa,S=to,w=ro,D=Xi,P=co,B=lt,U=Wo,K=qo,re=$o,ie=oo,ae=go,oe=rs,se=qt,ce=nc,le=Wt;return _(),v(k,null,[p.value?(_(),v(`div`,ol,[E(r,{ref_key:`searchInput`,ref:Un,modelValue:f(Y).q,"onUpdate:modelValue":[n[0]||=e=>f(Y).q=e,ir],type:`search`,enterkeyhint:`search`,autocomplete:`off`,icon:`i-lucide-search`,variant:`none`,placeholder:(`t`in t?t.t:f(Q))(`Search the conversation`),class:`flex-1 min-w-0`,onKeydown:fr},null,8,[`modelValue`,`placeholder`]),I(`span`,sl,M(f(Zn)),1),E(i,{icon:`i-lucide-chevron-up`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Previous`),onClick:n[1]||=e=>er(-1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-chevron-down`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Next`),onClick:n[2]||=e=>er(1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Close`),onClick:cr},null,8,[`aria-label`])])):g(``,!0),I(`div`,cl,[f(W)||(`netDown`in t?t.netDown:f(gr))?(_(),m(o,{key:0,label:f(W)?(`t`in t?t.t:f(Q))(`Offline reading`):void 0,at:f(V)},null,8,[`label`,`at`])):f(rl)(f(L))?(_(),m(o,{key:1,label:(`t`in t?t.t:f(Q))(`Conversation not up to date — reconnecting…`)},null,8,[`label`])):g(``,!0),f(te)&&f(V)?(_(),v(`span`,ll,M((`tl`in t?t.tl:f(Z))(`Read at ${(`fmtTime`in t?t.fmtTime:f(Qn))(f(V))}`,`Lu à ${(`fmtTime`in t?t.fmtTime:f(Qn))(f(V))}`)),1)):g(``,!0),I(`div`,{ref_key:`box`,ref:b,class:`chat`,onScrollPassive:fe,onWheelPassive:ue,onTouchmovePassive:ue},[E(oe,{status:f(ot)?`streaming`:`ready`,"should-auto-scroll":!1,"auto-scroll":{color:`neutral`,variant:`outline`},"auto-scroll-icon":`i-lucide-arrow-down`,ui:{root:`chat-msgs`,viewport:`hw-jump-vp`,autoScroll:`hw-jump`}},{default:H(()=>[I(`div`,{ref_key:`listEl`,ref:x,class:j([`chat-list`,[f(W)?`no-reply`:`rs-${`replyStyle`in t?t.replyStyle:f(mi)}`,{asking:f(br),skeleton:f(G)}]]),onClick:Kt,onKeydown:pn},[f(O)&&f(Ln)?(_(),v(`div`,ul,[E(s,{name:`i-lucide-square-terminal`,class:`chat-empty-icon`}),I(`p`,null,M(f(Ln).text),1),f(Ln).lines.length?(_(),v(`pre`,dl,M(f(Ln).lines.join(`
23
- `)),1)):g(``,!0),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[3]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)]),_:1})])):f(O)===`no_integration`&&f(A)?(_(),v(`div`,fl,[E(s,{name:`i-lucide-plug-zap`,class:`chat-empty-icon`}),I(`p`,pl,M((`tl`in t?t.tl:f(Z))(`Herdr's ${(`kindLabel`in t?t.kindLabel:f(lr))(f(A).agent)} integration is missing`,`L’intégration ${(`kindLabel`in t?t.kindLabel:f(lr))(f(A).agent)} de Herdr manque`)),1),I(`p`,ml,M(f(A).machine?(`tl`in t?t.tl:f(Z))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on ${f(A).machine}, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de ${f(A).machine}, puis relance l’agent :`):(`tl`in t?t.tl:f(Z))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on the agent's machine, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de la machine de l’agent, puis relance l’agent :`)),1),I(`code`,hl,M(f(A).command),1),I(`div`,gl,[E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-copy`,onClick:Fe},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)]),_:1}),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[4]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)]),_:1})])])):f(O)?(_(),v(`div`,_l,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),I(`p`,null,M(f(O)===`not_found`?(`t`in t?t.t:f(Q))(`No conversation for this agent yet.`):(`t`in t?t.t:f(Q))(`Conversation unavailable for this agent.`)),1),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[5]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)]),_:1})])):(_(),v(k,{key:3},[f(G)?(_(),m(c,{key:0,agent:e.pane.agent},null,8,[`agent`])):f(me)?(_(),v(k,{key:1},[],64)):f(C).olderCursor>0?(_(),v(`div`,vl,[E(i,{size:`xs`,color:`neutral`,variant:`outline`,class:`mono-btn`,loading:f(z),icon:`i-lucide-arrow-up`,onClick:ze},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Load earlier messages`)),1)]),_:1},8,[`loading`])])):f(C).older.length?(_(),v(`div`,yl,M((`t`in t?t.t:f(Q))(`Start of conversation`)),1)):g(``,!0),(_(!0),v(k,null,y(f(G)?[]:f(he),r=>(_(),v(k,{key:r.key},[r.k===`day`?(_(),v(`div`,bl,[I(`span`,null,M(r.label),1)])):r.k===`who`?(_(),v(`div`,{key:1,class:j([`msg-who`,e.pane.agent||``])},[E(s,{name:(`agentIcon`in t?t.agentIcon:f(Yt))(e.pane.agent)||`i-lucide-bot`},null,8,[`name`]),I(`span`,null,M((`kindLabel`in t?t.kindLabel:f(lr))(e.pane.agent)),1)],2)):r.k===`autopilot`?(_(),v(`div`,{key:2,class:`msg-autopilot`,"data-hit-key":r.key},[I(`div`,Sl,[I(`span`,null,M((`t`in t?t.t:f(Q))(`Autopilot`)),1)]),I(`div`,Cl,[E(l,null,{default:H(()=>[a(M(r.text),1)]),_:2},1024)]),E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,"aria-label":(`t`in t?t.t:f(Q))(`Copy message`),onClick:e=>f(Gt)(r.text)},null,8,[`aria-label`,`onClick`])],8,xl)):r.k===`user`?(_(),v(`div`,{key:3,class:`msg-user-wrap`,"data-hit-key":r.key},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Q))(`Show original message`),onClick:e=>Ut(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,El,M(r.reply.time),1),I(`span`,Dl,M(r.reply.excerpt),1)],8,Tl)):g(``,!0),E(w,{id:r.key,role:`user`,side:`right`,variant:`soft`,parts:[...r.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...r.text||r.files.length?[{type:`text`,text:r.text||` `}]:[]],ui:{root:r.text.trim()||r.files.length?`msg msg-user`:`msg msg-user msg-no-text`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[E(u,{srcs:r.srcs,offline:f(W)},null,8,[`srcs`,`offline`])]),content:H(()=>[r.files.length?(_(),v(`span`,Ol,[(_(!0),v(k,null,y(r.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>ln(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:r.text,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.time?(_(),v(`div`,{key:1,class:`msg-time`,title:r.at||void 0},M(r.time),9,kl)):g(``,!0)],8,wl)):r.k===`assistant`?(_(),v(k,{key:4},[E(w,{id:r.key,role:`assistant`,side:`left`,variant:`naked`,"data-hit-key":r.key,parts:[{type:`text`,text:r.text}],ui:{root:`msg msg-ai tw-${e.pane.agent||`agent`}${f(ne)?` can-run`:``}${f(J)===r.key?` q-picking`:``}`,container:`msg-c`,content:`md`}},{content:H(()=>[E(D,{html:r.html,typing:je(r.id),onDone:e=>Me(r.id)},null,8,[`html`,`typing`,`onDone`])]),_:2},1032,[`id`,`data-hit-key`,`parts`,`ui`]),(`replyStyle`in t?t.replyStyle:f(mi))===`list`&&!f(W)&&je(r.id)===null&&(f(yr)(r.html).questions.length||f(yr)(r.html).pick)?(_(),v(`div`,Al,[f(yr)(r.html).questions.length?(_(),v(k,{key:0},[I(`p`,jl,M((`tl`in t?t.tl:f(Z))(`Questions · reply to`,`Questions · répondre à`)),1),(_(!0),v(k,null,y(f(yr)(r.html).questions,e=>(_(),v(`div`,{key:e.n,class:`q-line`},[I(`button`,{type:`button`,class:j([`q-row`,{quoted:f(Er)(f(Dt),f(wi)(e.text,r.time,r.rid))}]),"aria-label":`${(`t`in t?t.t:f(Q))(`Reply`)}: ${e.text}`,onClick:t=>ht(f(wi)(e.text,r.time,r.rid)),onMouseenter:t=>Ot(r.key,e.n,!0),onMouseleave:t=>Ot(r.key,e.n,!1),onFocus:t=>Ot(r.key,e.n,!0),onBlur:t=>Ot(r.key,e.n,!1)},[I(`b`,null,M(f(Er)(f(Dt),f(wi)(e.text,r.time,r.rid))?`✓`:e.n),1),I(`span`,null,M(e.text),1),I(`i`,null,[n[14]||=a(`↳`,-1),I(`em`,null,M(f(Er)(f(Dt),f(wi)(e.text,r.time,r.rid))?(`t`in t?t.t:f(Q))(`Quoted`):(`t`in t?t.t:f(Q))(`Reply`)),1)])],42,Ml),e.closed?(_(),v(k,{key:0},y([`yes`,`no`],t=>I(`button`,{key:t,type:`button`,class:`q-row-ans`,"aria-pressed":bt(f(wi)(e.text,r.time,r.rid),t),"aria-label":`${gt(t)}: ${e.text}`,onClick:n=>vt(f(wi)(e.text,r.time,r.rid),t,n.detail>0)},M(gt(t)),9,Nl)),64)):g(``,!0)]))),128))],64)):g(``,!0),f(yr)(r.html).pick?(_(),v(`button`,{key:1,type:`button`,class:`q-pick`,"aria-pressed":f(J)===r.key,onClick:e=>J.value=f(J)===r.key?null:r.key},M(f(J)===r.key?(`tl`in t?t.tl:f(Z))(`Pick the point to quote · Cancel`,`Choisis le point à citer · Annuler`):(`tl`in t?t.tl:f(Z))(`+ Quote a point`,`+ Citer un point`)),9,Pl)):g(``,!0)])):g(``,!0),!r.endsTurn&&!f(W)?(_(),v(`div`,Fl,[I(`button`,{type:`button`,class:`msg-reply`,onClick:e=>mt(r.key)},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`Reply`)),1)],8,Il)])):g(``,!0)],64)):r.k===`thinking`?(_(),m(P,{key:5,class:`omp-thinking`,text:r.text,streaming:Ne(r.id)!==null,duration:r.ms===void 0?void 0:Math.max(1,Math.round(r.ms/1e3)),"auto-close-delay":450,ui:{root:`omp-thinking`,trigger:`omp-thinking-head`,label:`omp-thinking-label`,content:`omp-thinking-content`,body:`omp-thinking-body`}},{default:H(()=>[E(D,{class:`md`,html:r.html,typing:Ne(r.id),speed:(`reducedMotion`in t?t.reducedMotion:f(Si))?`off`:`fast`,cipher:!1,onDone:e=>Pe(r.id)},null,8,[`html`,`typing`,`speed`,`onDone`])]),_:2},1032,[`text`,`streaming`,`duration`])):r.k===`job`?(_(),v(`div`,{key:6,class:j([`omp-job`,{err:r.error,open:ct(r.key)}])},[I(`button`,{type:`button`,class:`omp-job-head`,disabled:!r.out,"aria-expanded":r.out?ct(r.key):void 0,onClick:e=>ut(r.key,!ct(r.key))},[I(`span`,Rl,M(r.error?`✗`:`✓`),1),I(`span`,zl,M((`tl`in t?t.tl:f(Z))(`Background job completed`,`Tâche de fond terminée`)),1),I(`code`,null,`[`+M(r.tool)+`] `+M(r.id),1),r.ms===void 0?g(``,!0):(_(),v(`span`,Bl,M(f(vo)(r.ms)),1)),r.out?(_(),m(s,{key:1,name:ct(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`])):g(``,!0)],8,Ll),r.out&&ct(r.key)?(_(),v(`div`,Vl,[I(`div`,Hl,[I(`span`,Ul,M(r.error?(`tl`in t?t.tl:f(Z))(`Error`,`Erreur`):(`tl`in t?t.tl:f(Z))(`Output`,`Sortie`)),1),r.ms===void 0?g(``,!0):(_(),v(`span`,Wl,`wall `+M(f(vo)(r.ms)),1))]),I(`pre`,null,M(r.out),1)])):g(``,!0)],2)):r.k===`shell`?(_(),v(`div`,{key:7,class:j([`msg-shell`,{bash:r.bash,long:r.long,open:ct(r.key)}])},[I(`div`,Gl,[I(`span`,Kl,M(r.bash?`!`:`❯`),1),I(`code`,null,M(r.text),1),E(B,{text:(`t`in t?t.t:f(Q))(`Copy command`),disabled:!(`desk`in t?t.desk:f(Mr))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`msg-shell-copy`,"aria-label":(`t`in t?t.t:f(Q))(`Copy command`),onClick:e=>f(Gt)(r.bash?`!${r.text}`:r.text)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])]),r.out||r.err?(_(),v(`div`,ql,[r.out?(_(),v(`pre`,Jl,M(r.out),1)):g(``,!0),r.err?(_(),v(`pre`,Yl,M(r.err),1)):g(``,!0)])):r.bash?(_(),v(`div`,Xl,M((`t`in t?t.t:f(Q))(`No output`)),1)):g(``,!0),r.long?(_(),v(`button`,{key:2,type:`button`,class:`msg-shell-more`,"aria-expanded":ct(r.key),onClick:e=>ut(r.key,!ct(r.key))},[E(s,{name:ct(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),I(`span`,null,M(ct(r.key)?(`t`in t?t.t:f(Q))(`Collapse`):(`tl`in t?t.tl:f(Z))(`Show all · ${r.lines} lines`,`Tout afficher · ${r.lines} lignes`)),1)],8,Zl)):g(``,!0)],2)):r.k===`ompRun`?(_(),v(`div`,Ql,[I(`div`,$l,[I(`span`,eu,M(r.tool.omp.title===`Python`?`$`:`!`),1),I(`span`,null,M((`tl`in t?t.tl:f(Z))(`You ran`,`Lancé par toi`)),1)]),E(U,{tool:r.tool,run:``},null,8,[`tool`])])):r.k===`system`?(_(),v(`div`,tu,[I(`span`,null,M(r.text),1)])):r.k===`notice`?(_(),v(`div`,{key:10,class:j([`msg-notice`,{long:r.long,open:ct(r.key),scheduled:r.scheduled}])},[I(`div`,nu,[E(s,{name:r.icon},null,8,[`name`]),I(`span`,null,M(r.label),1)]),E(D,{class:`msg-notice-body md`,html:r.html,typing:null},null,8,[`html`]),r.long?(_(),v(`button`,{key:0,type:`button`,class:`msg-shell-more`,"aria-expanded":ct(r.key),onClick:e=>ut(r.key,!ct(r.key))},[E(s,{name:ct(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),I(`span`,null,M(ct(r.key)?(`t`in t?t.t:f(Q))(`Collapse`):(`t`in t?t.t:f(Q))(`Show all`)),1)],8,ru)):g(``,!0)],2)):r.k===`turn`?(_(),v(`div`,iu,[r.copy?(_(),m(B,{key:0,text:(`t`in t?t.t:f(Q))(`Copy reply`),disabled:!(`desk`in t?t.desk:f(Mr))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`turn-copy`,"aria-label":(`t`in t?t.t:f(Q))(`Copy reply`),onClick:e=>f(Gt)(r.copy)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])):g(``,!0),r.reply&&!f(W)?(_(),v(`button`,{key:1,type:`button`,class:`msg-reply`,onClick:e=>mt(r.reply)},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`Reply`)),1)],8,au)):g(``,!0),I(`span`,null,M(r.text),1)])):r.k===`tools`&&f(Eo)(r.list)?(_(),v(`div`,{key:12,class:j([`tools omp-console`,{live:r.live}])},[n[16]||=I(`span`,{class:`fx-ring omp-ring`,"aria-hidden":`true`},[I(`span`,{class:`fx-spin`})],-1),I(`div`,ou,[n[15]||=I(`span`,{class:`omp-console-title`},`omp`,-1),I(`span`,null,M(r.list.length)+` `+M((`t`in t?t.t:f(Q))(`actions`)),1),f(To)(r.list)?(_(),v(`span`,su,`Σ `+M(f(vo)(f(To)(r.list))),1)):g(``,!0)]),Qe(r).hidden||r.list.length>f(3)&&ct(r.key)?(_(),v(`button`,{key:0,type:`button`,class:`omp-console-more`,"aria-expanded":ct(r.key),onClick:e=>ut(r.key,!ct(r.key))},[Qe(r).hidden?(_(),v(k,{key:0},[a(`⋯ `+M((`tl`in t?t.tl:f(Z))(`${Qe(r).hidden} earlier actions`,`${Qe(r).hidden} actions avant`)),1)],64)):(_(),v(k,{key:1},[a(`⋯ `+M((`t`in t?t.t:f(Q))(`Collapse`)),1)],64))],8,cu)):g(``,!0),(_(!0),v(k,null,y(rt(r),(e,t)=>(_(),m(u,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:Yu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`]))),128)),(_(!0),v(k,null,y(Qe(r).rows,(e,t)=>(_(),v(k,{key:`${r.key}:${r.list.length-Qe(r).rows.length+t}`},[E(U,{tool:{...e,omp:e.omp},live:r.live&&e===r.list[r.list.length-1]},null,8,[`tool`,`live`]),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:tt(e),max:Yu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))],2)):r.k===`tools`?(_(),v(`div`,{key:13,class:j([`tools`,{live:r.live}])},[r.list.length<=3?(_(!0),v(k,{key:0},y(r.list,(e,t)=>(_(),v(k,{key:t},[E(K,{text:Ye(e),suffix:Ke(e),icon:Xe(e),loading:r.live&&t===r.list.length-1,streaming:r.live&&t===r.list.length-1,ui:{root:`tool`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`},class:j({err:e.error})},null,8,[`text`,`suffix`,`icon`,`loading`,`streaming`,`class`]),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:tt(e),max:Yu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128)):(_(),m(K,{key:1,open:ct(r.key),text:`${r.list.length} ${(`t`in t?t.t:f(Q))(`actions`)}`,suffix:Ze(r.list[r.list.length-1]),icon:r.live?void 0:`i-lucide-layers`,loading:r.live,streaming:r.live,chevron:`trailing`,ui:{root:`tool group`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`,body:`tool-body`,trailingIcon:`tool-chev`},"onUpdate:open":e=>ut(r.key,e)},{default:H(()=>[(_(!0),v(k,null,y(r.list,(e,t)=>(_(),v(k,{key:t},[I(`div`,{class:j([`tool-row`,{err:e.error}])},[E(s,{name:Xe(e)},null,8,[`name`]),I(`b`,null,M(Ye(e)),1),I(`span`,null,M(Ke(e)),1)],2),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:tt(e),max:Yu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))]),_:2},1032,[`open`,`text`,`suffix`,`icon`,`loading`,`streaming`,`onUpdate:open`])),(_(!0),v(k,null,y(rt(r),(e,t)=>(_(),m(u,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:Yu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`]))),128))],2)):g(``,!0)],64))),128)),f(R)&&!f(T).length&&!f(F)?(_(),v(`div`,lu,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),I(`p`,null,M((`t`in t?t.t:f(Q))(`No messages yet.`)),1)])):g(``,!0),f(F)?(_(),v(`div`,uu,[I(`p`,null,M(f(F)),1)])):g(``,!0)],64))],34),(_(),m(ee,{to:`body`},[f(jt)?(_(),v(`button`,{key:0,ref_key:`selBtn`,ref:Mt,type:`button`,class:`sel-reply`,style:N({top:`${f(jt).top}px`,left:`${f(jt).left}px`}),"aria-label":(`t`in t?t.t:f(Q))(`Reply to this passage`),onPointerdown:n[6]||=q(()=>{},[`prevent`]),onMousedown:n[7]||=q(()=>{},[`prevent`]),onClick:n[8]||=e=>ht(f(wi)(f(jt).text,f(jt).time,f(jt).id))},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`Reply`)),1)],44,du)):g(``,!0)])),f(bn).length||f(gn)?(_(),v(`div`,fu,[(_(!0),v(k,null,y(f(bn).filter(e=>e.phase===`sent`),e=>(_(),v(`div`,{key:e.id,class:`msg-user-wrap`},[e.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Q))(`Show original message`),onClick:t=>Ut(e.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,mu,M(e.reply.time),1),I(`span`,hu,M(e.reply.excerpt),1)],8,pu)):g(``,!0),E(w,{id:`q:${e.id}`,role:`user`,side:`right`,variant:`soft`,parts:xn(e),ui:{root:`msg msg-user msg-pending sent${e.body||e.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[e.srcs.length?(_(),m(u,{key:0,srcs:e.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(e.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Q))(`Image`)},[E(s,{name:`i-lucide-image`})],8,gu))),128))]),content:H(()=>[e.files.length?(_(),v(`span`,_u,[(_(!0),v(k,null,y(e.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>ln(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:e.body,pasted:e.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),I(`div`,vu,[E(s,{name:`i-lucide-check`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`Sent · read by the agent`)),1)])]))),128)),f(gn)?(_(),v(`div`,yu,[I(`div`,bu,[I(`div`,xu,[I(`span`,Su,M(e.pane.agent===`omp`?f(gn).python?`>>>`:`$`:`!`),1),I(`code`,null,M(f(gn).command),1)]),f(gn).lines.length?(_(),v(`div`,Cu,[f(gn).hidden?(_(),v(`div`,wu,M((`tl`in t?t.tl:f(Z))(`+ ${f(gn).hidden} lines above`,`+ ${f(gn).hidden} lignes au-dessus`)),1)):g(``,!0),I(`pre`,Tu,M(f(gn).lines.join(`
24
- `)),1)])):(_(),v(`div`,Eu,M((`t`in t?t.t:f(Q))(`No output yet`)),1))]),I(`div`,Du,[E(s,{name:`i-lucide-loader-circle`,class:`spin`}),I(`span`,null,[a(M((`t`in t?t.t:f(Q))(`Running`)),1),f(yn)?(_(),v(k,{key:0},[a(` · `+M(f(yn)),1)],64)):g(``,!0)])])])):g(``,!0),(_(!0),v(k,null,y(f(bn).filter(e=>e.phase===`queued`),r=>(_(),v(`div`,{key:r.id,class:`msg-user-wrap`},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Q))(`Show original message`),onClick:e=>Ut(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,ku,M(r.reply.time),1),I(`span`,Au,M(r.reply.excerpt),1)],8,Ou)):g(``,!0),E(w,{id:`q:${r.id}`,role:`user`,side:`right`,variant:`soft`,parts:xn(r),ui:{root:`msg msg-user msg-pending queued${r.body||r.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble queued`,header:`msg-files`}},{files:H(()=>[r.srcs.length?(_(),m(u,{key:0,srcs:r.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(r.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Q))(`Image`)},[E(s,{name:`i-lucide-image`})],8,ju))),128))]),content:H(()=>[r.files.length?(_(),v(`span`,Mu,[(_(!0),v(k,null,y(r.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>ln(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:r.body,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.state===`failed`?(_(),v(`div`,Nu,[E(s,{name:`i-lucide-circle-alert`}),I(`span`,null,M(Nn(r.reason)),1),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(En),onClick:e=>On(r)},[E(s,{name:f(En)===r.id?`i-lucide-loader-circle`:`i-lucide-rotate-cw`,class:j({spin:f(En)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Retry`)),1)],8,Pu),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(wn),onClick:e=>Tn(r)},[E(s,{name:f(wn)===r.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(wn)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Cancel`)),1)],8,Fu)])):(_(),v(`div`,Iu,[E(s,{name:`i-lucide-clock`}),I(`span`,null,M(In(r)),1),f(fc)(e.pane,r)?(_(),v(`button`,{key:0,type:`button`,class:`queued-cancel`,disabled:!!f(Pn),onClick:e=>Fn(r)},M((`t`in t?t.t:f(Q))(`Clear and send`)),9,Lu)):g(``,!0),r.state===`held`&&f(dc)(e.pane,r)!==`working`?(_(),v(`button`,{key:1,type:`button`,class:`queued-cancel`,onClick:n[9]||=e=>d(`gotoTerm`)},M((`t`in t?t.t:f(Q))(`Open terminal`)),1)):g(``,!0),r.state!==`sending`&&(f(Sn)||r.state===`held`)&&r.raw?(_(),v(`button`,{key:2,type:`button`,class:`queued-cancel`,disabled:!!f(wn),onClick:e=>Tn(r)},[E(s,{name:f(wn)===r.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(wn)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Cancel`)),1)],8,Ru)):g(``,!0)]))]))),128)),f(kn)?(_(),v(`div`,zu,[I(`p`,Bu,[E(s,{name:`i-lucide-square-terminal`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`A menu is still open in the agent’s terminal. Your messages wait for it to close.`)),1)]),I(`div`,Vu,[I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(jn),onClick:n[10]||=e=>Mn(`close`)},[E(s,{name:f(jn)===`close`?`i-lucide-loader-circle`:`i-lucide-x`,class:j({spin:f(jn)===`close`})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Close menu`)),1)],8,Hu),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(jn),onClick:n[11]||=e=>Mn(`send`)},[E(s,{name:f(jn)===`send`?`i-lucide-loader-circle`:`i-lucide-send`,class:j({spin:f(jn)===`send`})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Send anyway`)),1)],8,Uu)])])):g(``,!0)])):g(``,!0),f(Bn)?(_(),v(`div`,{key:1,class:j([`chat-status`,{typing:f(Bn).typing,waiting:!f(Bn).typing}])},[`verb`in f(Bn)?(_(),v(`span`,Wu,[E(re),E(ie,{text:f(Bn).text,duration:2.4,class:`claude-verb`},null,8,[`text`])])):`omp`in f(Bn)?(_(),v(`span`,Gu,[E(ae,{since:f(Bn).since},{default:H(()=>[E(ie,{text:f(Bn).text,duration:2.4,class:`omp-step`},null,8,[`text`])]),_:1},8,[`since`])])):(_(),v(k,{key:2},[n[17]||=I(`i`,{class:`status-dot`},null,-1),f(Bn).typing?(_(),m(ie,{key:0,text:f(Bn).text,duration:2.4},null,8,[`text`])):(_(),v(`span`,Ku,M(f(Bn).text),1))],64))],2)):g(``,!0)]),_:1},8,[`status`])],544),(`sheetMenus`in t?t.sheetMenus:f(ii))?g(``,!0):(_(),m(se,{key:3,open:f(en).open,"onUpdate:open":n[12]||=e=>f(en).open=e,items:f(tn),content:{align:`start`,side:`bottom`,sideOffset:4},ui:{content:`hw-dropdown`}},{default:H(()=>[I(`span`,{class:`path-anchor`,style:N({left:`${f(en).x}px`,top:`${f(en).y}px`,width:`${f(en).w}px`,height:`${f(en).h}px`}),"aria-hidden":`true`},null,4)]),_:1},8,[`open`,`items`])),E(le,{open:f(un).open,"onUpdate:open":n[13]||=e=>f(un).open=e,title:sn(f(Gi)(f(un).path)),wide:``,full:``,screen:``},{default:H(()=>[f(un).open?(_(),m(ce,{key:f(un).path,"pane-id":e.pane.id,file:f(un).path},null,8,[`pane-id`,`file`])):g(``,!0)]),_:1},8,[`open`,`title`])])],64)}}}),{__name:`ChatView`});function Qu(e,t,n,r){return t===1?e*n:t===2?e*n*Math.max(1,r):e}function $u(e,t){let n=t>0?t:16,r=Math.trunc(e/n);return{lines:r,rest:e-r*n}}var ed={key:0,class:`term-loading`},td={key:1,class:`terminal-selection-hint`},nd=[`aria-label`],rd=Object.assign(T({__name:`TerminalView`,props:{ctl:{}},setup(e){let t=e,n=h(null),r=null,i=null,o=0,s=0,c=0,u=!1,d=()=>{c=0,s&&=(t.ctl.scroll(s),0)},p=e=>{s+=e,c||=requestAnimationFrame(d)};function m(e){r=e.touches[0].clientY,i=e.touches[0].clientX,o=0,u=!1}function y(e){if(e.preventDefault(),r===null)return;let a=e.touches[0].clientY,s=e.touches[0].clientX,c=i===null?0:s-i,l=a-r;i=s;let d=n.value?.querySelector(`.xterm`);if(d&&d.scrollWidth>d.clientWidth&&Math.abs(c)>Math.abs(l)){d.scrollLeft-=c,r=a,u=!0;return}o+=l,r=a;let{lines:f,rest:m}=$u(o,t.ctl.rowHeight());o=m,f&&(u=!0,p(f))}function b(e){let n=e.changedTouches[0];r=null,i=null,u||(n&&(t.ctl.tapLink(n.clientX,n.clientY)?e.preventDefault():t.ctl.tapMouse(n.clientX,n.clientY)),t.ctl.blur(),document.activeElement?.blur?.())}function x(){t.ctl.focus()}function S(e){e.preventDefault(),e.stopPropagation();let r=n.value?.querySelector(`.xterm`);if(r&&r.scrollWidth>r.clientWidth&&(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))){r.scrollLeft+=e.shiftKey?e.deltaY:e.deltaX;return}let i=t.ctl.rowHeight();o-=Qu(e.deltaY,e.deltaMode,i,t.ctl.pageRows());let{lines:a,rest:s}=$u(o,i);o=s,a&&p(a)}let C;function T(){C||=setTimeout(()=>{C=void 0,t.ctl.fitNow(!0)},50)}B(Sn,T);let E=null;return w(()=>{t.ctl.mount(n.value),P(()=>{t.ctl.fitNow(!1),t.ctl.hasBanner()||t.ctl.connect(!1)}),E=new ResizeObserver(T),E.observe(n.value)}),l(()=>{E?.disconnect(),clearTimeout(C),cancelAnimationFrame(c),t.ctl.dispose()}),(t,r)=>(_(),v(`div`,{id:`termWrap`,onWheelCapture:S},[I(`div`,{id:`term`,ref_key:`host`,ref:n},null,512),I(`div`,{id:`touch`,"aria-hidden":`true`,onTouchstartPassive:m,onTouchmove:y,onTouchend:b,onMousedown:q(x,[`prevent`])},null,32),e.ctl.loading.value?(_(),v(`div`,ed,[...r[1]||=[I(`span`,{class:`spinner`},null,-1)]])):g(``,!0),e.ctl.selectionHint.visible.value?(_(),v(`div`,td,[a(M((`tl`in t?t.tl:f(Z))(`Shift + drag to select`,`Shift + glisser pour sélectionner`))+` `,1),I(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Hide`),onClick:r[0]||=t=>e.ctl.selectionHint.dismiss()},`×`,8,nd)])):g(``,!0)],32))}}),{__name:`TerminalView`}),id=[`aria-label`],ad=[`onClick`],od=[`aria-label`],sd=Object.assign(T({__name:`Keybar`,props:{ctl:{},allDigits:{type:Boolean}},setup(e){let t=e,r=[{key:`esc`,label:`esc`},{key:`enter`,label:`⏎`,cls:`wide`},{key:`up`,label:`↑`},{key:`down`,label:`↓`},{key:`1`,label:`1`},{key:`2`,label:`2`},{key:`3`,label:`3`},{key:`tab`,label:`tab`},{key:`shift+tab`,label:`⇧tab`},{key:`left`,label:`←`},{key:`right`,label:`→`},{key:`ctrl+c`,label:`^C`,cls:`danger`},{key:`backspace`,label:`⌫`},{key:`y`,label:`y`},{key:`n`,label:`n`}],i=n(()=>t.allDigits?[...r.slice(0,7),...[`4`,`5`,`6`,`7`,`8`,`9`,`0`].map(e=>({key:e,label:e})),...r.slice(7)]:r);function a(e){X(),t.ctl.sendKeys([e])}function o(){t.ctl.hasFocus()?t.ctl.blur():t.ctl.focus()}return(t,n)=>{let r=Je;return _(),v(`div`,{class:`keybar`,role:`toolbar`,"aria-label":(`t`in t?t.t:f(Q))(`Keys`)},[(_(!0),v(k,null,y(f(i),e=>(_(),v(`button`,{key:e.key,type:`button`,class:j(e.cls),onPointerdown:n[0]||=q(()=>{},[`prevent`]),onClick:t=>a(e.key)},M(e.label),43,ad))),128)),I(`button`,{type:`button`,class:j([`kbd`,{on:e.ctl.kbdOn.value}]),"aria-label":(`t`in t?t.t:f(Q))(`Type in terminal`),onPointerdown:n[1]||=q(()=>{},[`prevent`]),onClick:o},[E(r,{name:`i-lucide-keyboard`})],42,od)],8,id)}}}),{__name:`Keybar`}),cd=`wherdr.mouse-selection-hint.dismissed`,ld=h(!1),ud=!1;function dd(){if(!ud&&typeof localStorage<`u`){ud=!0;try{ld.value=localStorage.getItem(cd)===`1`}catch{}}let e=h(!1),t=typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches,r=n(()=>t&&e.value&&!ld.value);function i(t,n=!1){e.value=n||t.modes.mouseTrackingMode!==`none`}function a(){ld.value=!0;try{localStorage.setItem(cd,`1`)}catch{}}return{visible:r,refresh:i,dismiss:a}}var fd=e(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
18
+ `).length:0);e.push({k:`shell`,key:`s:${t.ts}:${t.text.slice(0,40)}`,bash:t.role===`bash`,text:t.text,out:n,err:r,lines:i,long:i>Qu||n.length+r.length>1500})}else if(t.role===`notice`){let[n,r]=$e[t.name||``]||[t.name||`Note`,`i-lucide-info`];e.push(it({k:`notice`,key:s,label:Q(n),icon:r,scheduled:t.name===`scheduled`,long:t.name===`scheduled`||t.text.split(`
19
+ `).length>Qu||t.text.length>1200},()=>Zi(t.text)))}else{let n=t.role===`system`?t.text.match(/^Effort : (low|medium|high|xhigh|max|ultracode) \(cette session\)$/):null;e.push({k:`system`,key:s,text:n?Z(`Effort: ${n[1]} (this session)`,`Effort : ${n[1]} (cette session)`):t.role===`system`?Q(t.text):t.text})}}),i();let p=!W.value&&s.pane.status===`blocked`;if(!ot.value&&!p&&!s.pane.pendingPrompt)f();else{let t=e[e.length-1];t&&t.k===`tools`&&(ot.value||p)&&(t.live=!0)}return e}),lt=e=>at.has(e);function ut(e,t){t?at.add(e):at.delete(e)}let dt=e=>[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(t=>t.dataset.hitKey===e)||null,ft=e=>{let t=e?.closest(`[data-hit-key]`)?.dataset.hitKey,n=t?st.value.find(e=>e.key===t):null;return n&&n.k===`assistant`?{time:n.time,id:n.rid}:{time:null,id:null}};function pt(e){let{time:t,id:n}=ft(e);if(e.classList.contains(`q-all`))return _r({n:e.dataset.n||``,text:e.dataset.q||``},t,n,Wr(e));let r=e.closest(`.q-trow`);return r?Gi(Ir(r),t,n):e.dataset.q?ci(e.dataset.q,t,n):null}function mt(e){let t=st.value.find(t=>t.key===e);t&&t.k===`assistant`&&ht(Ii(t.text,t.time,t.rid))}function ht(e){let t=qn(s.pane.id),n=e?tr(t.text,e):null;Mt.value=null,window.getSelection()?.removeAllRanges(),n!==null&&(t.text=n),X(),d(`quote`)}let gt=e=>Q(e===`yes`?`Yes`:`No`),_t=()=>{oe=!1,ce=!0};function vt(e,t,n){if(!e)return;_t();let r=qn(s.pane.id),i=xi(r.text,e,gt(t));i!==null&&(r.text=i),X(),n&&d(`answered`,bi(r.text,e))}function yt(e,t){if(!e)return;_t();let n=qn(s.pane.id);n.text=Kr(n.text,e,Z(`OK to all`,`OK tout`)),X(),t&&d(`answered`,bi(n.text,e))}let bt=(e,t)=>Hr(Or(Ot.value,e)||``)===t;function xt(){let e=qn(s.pane.id).text;for(let t of x.value?.querySelectorAll(`.q-ans, .q-tans`)||[]){let n=pt(t);t.setAttribute(`aria-pressed`,String(!!n&&Hr(Or(e,n)||``)===t.dataset.a))}for(let t of x.value?.querySelectorAll(`.q-all`)||[])t.setAttribute(`aria-pressed`,String(jr(e,pt(t))));for(let t of x.value?.querySelectorAll(`.q-reply, .q-point, .q-tquote`)||[]){let n=pt(t),r=!!n&&jr(e,n);if(t.classList.toggle(`quoted`,r),t.dataset.n&&!t.classList.contains(`q-tquote`))for(let e of St(t))e.classList.toggle(`quoted`,r)}}let St=e=>e.closest(`.md-body`)?.querySelectorAll(`.q-text[data-n="${e.dataset.n}"]`)||[],Ct=e=>e.closest(`.md-body`)?.querySelector(`.q-reply[data-n="${e.dataset.n}"]`)||null,wt=null;function Tt(e){wt?.classList.remove(`q-armed`),wt=e,e?.classList.add(`q-armed`)}let Dt=h(null),Ot=n(()=>qn(s.pane.id).text);B(Ot,e=>{e||(ce=!1)});function kt(e,t,n){for(let r of dt(e)?.querySelectorAll(`.q-text[data-n="${t}"]`)||[])r.classList.toggle(`q-hot`,n)}let At;function jt(e,t){let n=t.closest(`.msg-ai .md-body .q-pt`),r=n?.querySelector(`:scope > .q-point`),i=r?.dataset.q;if(clearTimeout(At),!n||!i||t.closest(`a, button, summary, input`))return Tt(null);if(yi.value===`list`){Dt.value&&n.closest(`[data-hit-key]`)?.dataset.hitKey===Dt.value&&(Dt.value=null,ht(pt(r)));return}if(yi.value!==`text`||window.getSelection()?.isCollapsed===!1)return Tt(null);if(Pt())return Tt(n===wt?null:n);e.detail>1||(At=setTimeout(()=>{window.getSelection()?.isCollapsed!==!1&&ht(pt(r))},220))}l(()=>clearTimeout(At)),B([()=>qn(s.pane.id).text,me],()=>P(xt),{flush:`post`});let Mt=h(null),Nt=h(null),Pt=()=>window.matchMedia(`(pointer: coarse)`).matches;function It(){let e=window.getSelection(),t=e&&!e.isCollapsed&&e.rangeCount?e.getRangeAt(0):null,n=(t?t.startContainer.nodeType===1?t.startContainer:t.startContainer.parentElement:null)?.closest(`.msg-ai[data-hit-key]`);if(!t||!n||W.value||!x.value?.contains(n))return null;let r=Yc(t,n.querySelector(`.md`)||n),i=r?.toString().trim()||``;if(!r||!i)return null;let a=Gc(r.getClientRects())||r.getBoundingClientRect();return{host:n,text:i,end:a,sig:`${i}|${Math.round(a.right)}|${Math.round(a.top)}`}}function Lt(){let e=It();if(!e||!x.value){Mt.value=null;return}let t=x.value.getBoundingClientRect(),n=Kc(e.end,{width:Nt.value?.offsetWidth||104,height:Nt.value?.offsetHeight||32},{width:window.innerWidth,top:Math.max(0,t.top),bottom:Math.min(window.innerHeight,t.bottom)},Pt());Mt.value=n?{text:e.text,...ft(e.host),sig:e.sig,...n}:null}let zt=qc({show:Lt,hide:()=>{Mt.value=null},touch:Pt}),Bt=e=>{e.button===0&&!e.target?.closest?.(`.sel-reply`)&&zt.down()},Vt=()=>zt.up(),Ht=()=>zt.change(!!Mt.value&&It()?.sig===Mt.value.sig),Ut=()=>{(Mt.value||window.getSelection()?.isCollapsed===!1)&&zt.scroll()};w(()=>{document.addEventListener(`pointerdown`,Bt,!0),document.addEventListener(`pointerup`,Vt,!0),document.addEventListener(`pointercancel`,Vt,!0),document.addEventListener(`selectionchange`,Ht),window.addEventListener(`scroll`,Ut,!0),window.addEventListener(`resize`,Ut)}),l(()=>{zt.dispose(),document.removeEventListener(`pointerdown`,Bt,!0),document.removeEventListener(`pointerup`,Vt,!0),document.removeEventListener(`pointercancel`,Vt,!0),document.removeEventListener(`selectionchange`,Ht),window.removeEventListener(`scroll`,Ut,!0),window.removeEventListener(`resize`,Ut)}),i(`gotoRef`,(e,t)=>{let n=t.closest(`[data-hit-key]`)?.dataset.hitKey,r=n?st.value.findIndex(e=>e.key===n):-1,i=(r<0?st.value:st.value.slice(0,r)).flatMap(e=>e.k===`assistant`?[{key:e.key,time:e.time,text:e.text,rid:e.rid}]:[]);Gt(ti(i,{time:e.time||``,excerpt:e.excerpt,id:e.id&&Ci(e.id)})?.key||null)});async function Gt(e){e&&!dt(e)&&pe.value&&await ye();let t=e?dt(e):null;if(!t)return $(Q(`Original message not found (further up the conversation?)`),!0);t.scrollIntoView({block:`center`,behavior:`smooth`}),t.classList.remove(`msg-flash`),t.offsetWidth,t.classList.add(`msg-flash`),setTimeout(()=>t.classList.remove(`msg-flash`),1700)}let Kt=gc;function qt(e){let t=e.target,n=t.closest?.(`.q-ans`),r=e.detail>0;if(n?.dataset.q){e.preventDefault(),Tt(null),Dt.value=null,vt(pt(n),n.dataset.a===`no`?`no`:`yes`,r);return}let i=t.closest?.(`.q-tans`);if(i?.dataset.n){e.preventDefault(),Tt(null),Dt.value=null,vt(pt(i),i.dataset.a===`no`?`no`:`yes`,r);return}let a=t.closest?.(`.q-all`);if(a){e.preventDefault(),Tt(null),Dt.value=null,yt(pt(a),r);return}let o=t.closest?.(`.q-reply, .q-point, .q-tquote`);if(o){e.preventDefault(),Tt(null),Dt.value=null,ht(pt(o));return}let s=yi.value===`text`&&!W.value?t.closest?.(`.q-text`):null,c=s&&window.getSelection()?.isCollapsed!==!1?Ct(s):null;if(c){e.preventDefault(),Tt(null),ht(pt(c));return}let l=t.closest?.(`.md-body .md-path`);if(l){e.preventDefault(),un(l);return}let u=t.closest?.(`.md-body .md-cmd`);if(u){e.preventDefault(),Qt(u);return}let d=t.closest?.(`.md-body img`);if(d&&d.src){e.preventDefault(),xr(d.src);return}!W.value&&!t.closest?.(`.code-block`)&&jt(e,t);let f=(t.closest?.(`.can-run .code-run`))?.closest(`.code-block`)?.dataset.cmd;if(f){Jt(f);return}let p=t.closest?.(`.code-copy`);if(!p)return;let m=p.closest(`.code-block`),h=m?.dataset.cmd??m?.querySelector(`pre`)?.textContent;h!=null&&navigator.clipboard.writeText(h).then(()=>{p.textContent=Q(`Copied`),p.classList.add(`done`),setTimeout(()=>{p.textContent=Q(`Copy`),p.classList.remove(`done`)},1400)}).catch(()=>$(Q(`Copy failed`),!0))}async function Jt(e){let t=await hc(s.pane.id,e);t!==!1&&d(`sent`,t)}function Yt(e,t){let n=[];return t&&n.push({label:Z(`Run…`,`Lancer…`),icon:`i-lucide-play`,run:()=>Jt(e)}),n.push({label:Q(`Copy command`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>Kt(e)}),n}function Qt(e){let t=e.dataset.cmd;t&&on(e,Yt(t,ne.value&&!!e.closest(`.can-run`)),Z(`Command`,`Commande`))}let tn=r({open:!1,x:0,y:0,w:0,h:0}),an=h([]);function on(e,t,n){if(ui.value){X(),we(t,n);return}let r=e.getBoundingClientRect();Object.assign(tn,{x:r.left,y:r.top,w:r.width,h:r.height}),an.value=se(t),tn.open=!0}let sn=e=>e.replace(/\/+$/,``).split(`/`).pop()||e;function ln(e){let t=[];return!br.value&&!e.endsWith(`/`)&&t.push({label:Q(`Preview`),icon:`i-lucide-eye`,run:()=>fn(e)},{label:Q(`Download`),icon:`i-lucide-download`,run:()=>pn(e)}),Si(s.pane)&&!br.value&&t.push({label:Q(`Reveal in Finder`),icon:`i-lucide-folder-search`,run:()=>hn(e,`reveal`)},{label:Q(`Open`),icon:`i-lucide-external-link`,run:()=>hn(e,`open`)}),t.push({label:Q(`Copy path`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>Kt(e)}),t}function un(e,t){let n=t||(e.textContent||``).trim();n&&on(e,ln(n),sn(n))}let dn=r({open:!1,path:``});function fn(e){Object.assign(dn,{open:!0,path:e})}async function pn(e){try{await Pi(`/api/files/download?pane=${encodeURIComponent(s.pane.id)}&path=${encodeURIComponent(e)}&from=chat`,sn(ea(e)))}catch(e){$(e.message,!0)}}function mn(e){if(e.key===`Escape`&&(Dt.value||wt)){Dt.value=null,Tt(null);return}if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest?.(`.md-body .md-path, .md-body .md-cmd`);t&&(e.preventDefault(),t.classList.contains(`md-cmd`)?Qt(t):un(t))}async function hn(e,t){try{let n=await _i(`/api/reveal`,{pane_id:s.pane.id,path:e,mode:t});$(t===`reveal`?Z(`Shown in Finder on ${n.machine}`,`Affiché dans le Finder sur ${n.machine}`):Z(`Opened in the editor on ${n.machine}`,`Ouvert dans l’éditeur sur ${n.machine}`))}catch(e){$(e.message,!0)}}let _n=n(()=>{if(W.value)return null;let e=s.pane;return e.agent===`omp`?e.ompShell?{shell:e.ompShell,sent:null,queued:[]}:null:e.agent===`claude`&&e.status===`working`&&e.claudeScreen||null}),vn=n(()=>_n.value&&_n.value.shell||null),yn=h(Date.now()),bn;B(vn,e=>{e&&!bn&&(bn=ur(()=>{yn.value=Date.now()},1e3)),!e&&bn&&(clearInterval(bn),bn=void 0)},{immediate:!0}),l(()=>clearInterval(bn));let xn=n(()=>{let e=vn.value&&vn.value.since;if(!e)return null;let t=Math.max(0,Math.round((yn.value-e)/1e3));return t<60?`${t} s`:`${Math.floor(t/60)} min ${String(t%60).padStart(2,`0`)} s`}),Sn=n(()=>{let e=s.pane,t=wn(W.value?[]:(e.queued||[]).filter(e=>!e.back),s.localQueued),n=Uc(e.id,t),r=st.value.filter(e=>e.k===`assistant`),i=_c(e,{})===`sending`;return Wc({mine:t,claude:C.value.queue||[],items:T.value,screen:_n.value,memory:n,idle:i}).map(e=>{let t=e.raw.split(`
20
+ `),n=t.filter(e=>!bc(e)&&!Vn(e)).join(`
21
+ `).trim(),i=Ri(n);return{...e,srcs:e.photos.map(Oc),files:t.map(gn).filter(e=>!!e),text:n,body:i?i.body:n,reply:i?.reply||null,origin:i&&ti(r,i.reply)?.key||null}})}),Cn=e=>[...e.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...Array.from({length:e.missing},()=>({type:`file`,mediaType:`image/jpeg`,url:``})),...e.body||e.files.length?[{type:`text`,text:e.body||` `}]:[]],Tn=n(()=>!W.value&&Hn(s.pane)),En=h(null);async function On(e){if(!En.value){if(e.local){zn(qn(s.pane.id),Wn(s.pane.id,e.id)||e.raw),d(`restored`);return}En.value=e.id,X();try{let t=await _i(`/api/unqueue`,{pane_id:s.pane.id,text:e.raw,id:e.mine?e.id:void 0});zn(qn(s.pane.id),t.text||e.raw,e.pasted),d(`restored`),t.lost?$(Q(`Removed from the queue`),!0,Nn(t.lost)):$(Q(`Removed from the queue`)),setTimeout(Re,400)}catch(e){$(e.message,!0)}finally{En.value=null}}}let kn=h(null);async function An(e){if(!kn.value){kn.value=e.id,X();try{e.local?await Ln(s.pane,s.pane.id,e.id):await _i(`/api/requeue`,{pane_id:s.pane.id,id:e.id})}catch(e){$(e.message,!0)}finally{kn.value=null}}}let jn=n(()=>!!s.pane.menuLeftOpen&&Sn.value.some(e=>e.phase===`queued`)),Mn=h(null);async function Pn(e){if(!Mn.value){Mn.value=e,X();try{await _i(`/api/menu-left`,{pane_id:s.pane.id,action:e})}catch(e){$(e.message,!0)}finally{Mn.value=null}}}function Fn(e){return Q(e===`busy`?`Not sent — the agent’s input contains text`:e===`no_input`?`Not sent — the agent’s input field was not found on its screen`:e===`lost`?`Not sent — it was taken out of the agent’s queue before being read`:e===`unseen`?`Not sent — still not in the conversation after an hour`:`Not sent`)}let In=h(null);async function Rn(e){if(!In.value){In.value=e.id;try{await _i(`/api/clear-queued-input`,{pane_id:s.pane.id,id:e.id,input_text:e.inputText})}catch(e){$(e.message,!0)}finally{In.value=null}}}function Bn(e){if(e.state===`sending`)return Q(`Queued · `)+Q(`sending…`);switch(_c(s.pane,e)){case`busy`:return e.inputText?Z(`Not sent: the agent’s input already contains text (“${e.inputText}”)`,`Pas envoyé : la saisie de l’agent contient déjà du texte (« ${e.inputText} »)`):Q(`Not sent — the agent’s input contains text`);case`stopped`:return Q(`Queued · `)+Q(`agent stopped`);case`question`:return Q(`Queued · `)+Q(`after you answer the question`);case`dialog`:return Q(`Queued · `)+Q(`will be sent when the menu closes`);case`starting`:return Q(`Queued · `)+Q(`agent starting`);case`working`:return Q(`Queued`);default:return Q(`Queued · `)+Q(`sending…`)}}B(()=>Sn.value.map(e=>`${e.id}:${e.phase}`).join(`,`),()=>P(()=>ie(!1))),B(()=>vn.value&&vn.value.lines.join(`
22
+ `),()=>P(()=>ie(!1)));let Un=n(()=>{let e=s.pane;if(e.menu||e.interaction===`terminal`||!O.value||O.value===`unsupported`||!e.screen||e.status===`working`||W.value)return null;let t=hr(e.agent);return zi(e)?{text:Z(`${t} is waiting for your answer, below or in the terminal.`,`${t} attend ta réponse, ci-dessous ou dans le terminal.`),lines:[]}:{text:Z(`${t} is waiting for an action in the terminal.`,`${t} attend une action dans le terminal.`),lines:e.screen.lines}}),Gn=n(()=>{if(W.value)return null;let e=s.pane;if(e.pendingPrompt&&e.status!==`working`)return{typing:!0,text:Z(`Your first message will be sent when ${hr(e.agent)} is ready`,`Ton premier message partira dès que ${hr(e.agent)} sera prêt`)};if(vn.value)return{typing:!0,text:Z(`Command running…`,`Commande en cours…`)};if(e.status===`working`&&e.agent===`claude`&&e.activity)return{typing:!0,verb:!0,text:`${e.activity}…`};if(e.status===`working`&&e.agent===`omp`&&e.ompActivity){let t=e.ompActivity;return{typing:!0,omp:!0,since:t.since,text:t.step||`${hr(e.agent)} ${Z(`is working…`,`travaille…`)}`}}return e.status===`working`?{typing:!0,text:`${hr(e.agent)} ${Z(`is working…`,`travaille…`)}`}:e.status===`blocked`&&!e.menu&&!Un.value&&!(e.prompt&&e.prompt.options)&&!zi(e)?{typing:!1,text:Q(`Waiting for your reply — details in the Terminal tab`)}:null});B(()=>s.pane.status,()=>P(()=>ie(!1)));let Y=r({q:``,hits:[],cur:-1,loading:!1}),Kn=!1,Jn=h(null),Yn=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase(),Xn=typeof CSS<`u`&&`highlights`in CSS?CSS.highlights:null,Zn=globalThis.Highlight;function $n(){Xn?.delete(`hw-hit`),Xn?.delete(`hw-cur`)}function er(e,t){if($n(),Y.hits=[],!p.value||Y.q.length<2||!x.value)return;let n=Yn(Y.q),r=document.createTreeWalker(x.value,NodeFilter.SHOW_TEXT);for(let e=r.nextNode();e;e=r.nextNode()){let t=Yn(e.nodeValue||``),r=0,i;for(;(i=t.indexOf(n,r))>=0;){let t=document.createRange();t.setStart(e,i),t.setEnd(e,Math.min(i+n.length,(e.nodeValue||``).length)),Y.hits.push(t),r=i+n.length}}if(t){let e=Y.hits.findIndex(e=>t.contains(e.startContainer));Y.cur=e>=0?e:0}else(e||Y.cur>=Y.hits.length)&&(Y.cur=Y.hits.length-1);nr()}function nr(){if(Xn&&Zn){Xn.set(`hw-hit`,new Zn(...Y.hits.filter((e,t)=>t!==Y.cur)));let e=Y.hits[Y.cur];e?Xn.set(`hw-cur`,new Zn(e)):Xn.delete(`hw-cur`)}let e=Y.hits[Y.cur],t=b.value;if(e&&t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();t.scrollTo({top:t.scrollTop+n.top-r.top-t.clientHeight/2,behavior:`smooth`})}}let ar=n(()=>Y.loading?Q(`loading…`):Y.q.length<2?``:Y.hits.length?`${Y.cur+1}/${Y.hits.length}`:Q(`no results`));function sr(e){Y.hits.length&&(Y.cur=(Y.cur+e+Y.hits.length)%Y.hits.length,nr())}async function cr(){for(;C.value.olderCursor>0;){let e=C.value.olderCursor;if(await ze(),C.value.olderCursor===e)break}}let lr;function fr(){clearTimeout(lr),lr=setTimeout(pr,250)}async function pr(){if(Y.q.trim().length<2){$n(),Y.hits=[],Y.cur=-1;return}C.value.olderCursor>0&&!W.value&&(Y.loading=!0,await cr(),Y.loading=!1),await ye(),er(!0)}async function mr(){let e=c.query.hit,t=c.query.q;if(typeof e!=`string`||typeof t!=`string`||!/^\d+$/.test(e))return;let n=Number(e);p.value=!0,Y.q=t,Y.loading=!0,Kn=!0;try{for(;C.value.olderCursor>n&&!W.value;){let e=C.value.olderCursor;if(await ze(),C.value.olderCursor>=e)break}await ye();let e=String(c.query.role||``),t=String(c.query.ts||``),r=String(c.query.prefix||``),i=T.value.findIndex(n=>n.role===e&&n.ts===t&&n.text.startsWith(r)),a=i<0?``:`${e}:${t}:${i}`,o=[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(e=>e.dataset.hitKey===a);er(!1,o),o&&!Y.hits.length&&o.scrollIntoView({block:`center`})}finally{Kn=!1,Y.loading=!1}}B(()=>c.query.hit,()=>{c.params.pane===s.pane.id&&mr()});function vr(){p.value=!1}B(p,e=>{e?P(()=>Jn.value?.inputRef?.focus()):(Y.q=``,Y.hits=[],Y.cur=-1,$n())}),l($n);function yr(e){e.key===`Enter`&&(e.preventDefault(),sr(e.shiftKey?1:-1)),e.key===`Escape`&&(e.preventDefault(),vr())}function xr(e){Ft([e])}function Er(){let e=Jn.value?.inputRef;e?.focus(),e?.select()}let Dr=n(()=>{if(W.value||ot.value||s.pane.status===`blocked`||Sn.value.length||vn.value)return null;let e=st.value.findLast(e=>e.k===`assistant`||e.k===`user`||e.k===`autopilot`||e.k===`shell`||e.k===`ompRun`);if(!e||e.k!==`assistant`||Ae(e.id)!==null)return null;let t=Tr(e.html);return t.questions.length+t.rows.length?{key:e.key,time:e.time,rid:e.rid,targets:t}:null}),Ar=n(()=>{let e=Dr.value?gr(Dr.value.targets,Ot.value,Dr.value.time,Dr.value.rid):0;return Dr.value&&e?{key:Dr.value.key,count:e}:null});B(()=>Ar.value?.count||0,e=>d(`unanswered`,e),{immediate:!0}),l(()=>d(`unanswered`,0));function Mr(){let e=Ar.value?dt(Ar.value.key):null,t=Ot.value,n=ft(e),r=[...e?.querySelectorAll(`.q-reply, .q-trow`)||[]].find(e=>e.classList.contains(`q-trow`)?!ir(t,Ir(e),n.time,n.id):!jr(t,pt(e)));if(!r)return;let i=r.classList.contains(`q-trow`)?[r]:[...St(r)];(i[0]||r).scrollIntoView({block:`center`,behavior:Oi.value?`auto`:`smooth`});for(let e of i)e.classList.remove(`q-flash`),e.offsetWidth,e.classList.add(`q-flash`),setTimeout(()=>e.classList.remove(`q-flash`),1700);X()}return t({scrollToEnd:ie,reload:()=>setTimeout(Re,400),focusSearch:Er,gotoUnanswered:Mr}),(t,n)=>{let r=Zt,i=Et,o=Qn,s=qe,c=Fa,l=La,u=Ua,h=Xa,S=so,w=lo,D=Qi,P=ho,B=ct,U=Xo,K=$o,re=as,ie=po,ae=So,J=ls,oe=cn,se=cc,ce=Wt;return _(),v(k,null,[p.value?(_(),v(`div`,cl,[E(r,{ref_key:`searchInput`,ref:Jn,modelValue:f(Y).q,"onUpdate:modelValue":[n[0]||=e=>f(Y).q=e,fr],type:`search`,enterkeyhint:`search`,autocomplete:`off`,icon:`i-lucide-search`,variant:`none`,placeholder:(`t`in t?t.t:f(Q))(`Search the conversation`),class:`flex-1 min-w-0`,onKeydown:yr},null,8,[`modelValue`,`placeholder`]),I(`span`,ll,M(f(ar)),1),E(i,{icon:`i-lucide-chevron-up`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Previous`),onClick:n[1]||=e=>sr(-1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-chevron-down`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Next`),onClick:n[2]||=e=>sr(1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Close`),onClick:vr},null,8,[`aria-label`])])):g(``,!0),I(`div`,ul,[f(W)||(`netDown`in t?t.netDown:f(Sr))?(_(),m(o,{key:0,label:f(W)?(`t`in t?t.t:f(Q))(`Offline reading`):void 0,at:f(V)},null,8,[`label`,`at`])):f(al)(f(L))?(_(),m(o,{key:1,label:(`t`in t?t.t:f(Q))(`Conversation not up to date — reconnecting…`)},null,8,[`label`])):g(``,!0),f(te)&&f(V)?(_(),v(`span`,dl,M((`tl`in t?t.tl:f(Z))(`Read at ${(`fmtTime`in t?t.fmtTime:f(rr))(f(V))}`,`Lu à ${(`fmtTime`in t?t.fmtTime:f(rr))(f(V))}`)),1)):g(``,!0),I(`div`,{ref_key:`box`,ref:b,class:`chat`,onScrollPassive:de,onWheelPassive:le,onTouchmovePassive:le},[E(J,{status:f(ot)?`streaming`:`ready`,"should-auto-scroll":!1,"auto-scroll":{color:`neutral`,variant:`outline`},"auto-scroll-icon":`i-lucide-arrow-down`,ui:{root:`chat-msgs`,viewport:`hw-jump-vp`,autoScroll:`hw-jump`}},{default:H(()=>[I(`div`,{ref_key:`listEl`,ref:x,class:j([`chat-list`,[f(W)?`no-reply`:`rs-${`replyStyle`in t?t.replyStyle:f(yi)}`,{asking:f(Dr),skeleton:f(G)}]]),onClick:qt,onKeydown:mn},[f(O)&&f(Un)?(_(),v(`div`,fl,[E(s,{name:`i-lucide-square-terminal`,class:`chat-empty-icon`}),I(`p`,null,M(f(Un).text),1),f(Un).lines.length?(_(),v(`pre`,pl,M(f(Un).lines.join(`
23
+ `)),1)):g(``,!0),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[3]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)]),_:1})])):f(O)===`no_integration`&&f(A)?(_(),v(`div`,ml,[E(s,{name:`i-lucide-plug-zap`,class:`chat-empty-icon`}),I(`p`,hl,M((`tl`in t?t.tl:f(Z))(`Herdr's ${(`kindLabel`in t?t.kindLabel:f(hr))(f(A).agent)} integration is missing`,`L’intégration ${(`kindLabel`in t?t.kindLabel:f(hr))(f(A).agent)} de Herdr manque`)),1),I(`p`,gl,M(f(A).machine?(`tl`in t?t.tl:f(Z))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on ${f(A).machine}, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de ${f(A).machine}, puis relance l’agent :`):(`tl`in t?t.tl:f(Z))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on the agent's machine, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de la machine de l’agent, puis relance l’agent :`)),1),I(`code`,_l,M(f(A).command),1),I(`div`,vl,[E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-copy`,onClick:Pe},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)]),_:1}),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[4]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)]),_:1})])])):f(O)?(_(),v(`div`,yl,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),I(`p`,null,M(f(O)===`not_found`?(`t`in t?t.t:f(Q))(`No conversation for this agent yet.`):(`t`in t?t.t:f(Q))(`Conversation unavailable for this agent.`)),1),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[5]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)]),_:1})])):(_(),v(k,{key:3},[f(G)?(_(),m(c,{key:0,agent:e.pane.agent},null,8,[`agent`])):f(pe)?(_(),v(k,{key:1},[],64)):f(C).olderCursor>0?(_(),v(`div`,bl,[E(i,{size:`xs`,color:`neutral`,variant:`outline`,class:`mono-btn`,loading:f(z),icon:`i-lucide-arrow-up`,onClick:ze},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Load earlier messages`)),1)]),_:1},8,[`loading`])])):f(C).older.length?(_(),v(`div`,xl,M((`t`in t?t.t:f(Q))(`Start of conversation`)),1)):g(``,!0),(_(!0),v(k,null,y(f(G)?[]:f(me),r=>(_(),v(k,{key:r.key},[r.k===`day`?(_(),v(`div`,Sl,[I(`span`,null,M(r.label),1)])):r.k===`who`?(_(),v(`div`,{key:1,class:j([`msg-who`,e.pane.agent||``])},[E(s,{name:(`agentIcon`in t?t.agentIcon:f(rn))(e.pane.agent)||`i-lucide-bot`},null,8,[`name`]),I(`span`,null,M((`kindLabel`in t?t.kindLabel:f(hr))(e.pane.agent)),1)],2)):r.k===`autopilot`?(_(),v(`div`,{key:2,class:`msg-autopilot`,"data-hit-key":r.key},[I(`div`,wl,[I(`span`,null,M((`t`in t?t.t:f(Q))(`Autopilot`)),1)]),I(`div`,Tl,[E(l,null,{default:H(()=>[a(M(r.text),1)]),_:2},1024)]),E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,"aria-label":(`t`in t?t.t:f(Q))(`Copy message`),onClick:e=>f(Kt)(r.text)},null,8,[`aria-label`,`onClick`])],8,Cl)):r.k===`user`?(_(),v(`div`,{key:3,class:`msg-user-wrap`,"data-hit-key":r.key},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Q))(`Show original message`),onClick:e=>Gt(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,Ol,M(r.reply.time),1),I(`span`,kl,M(r.reply.excerpt),1)],8,Dl)):g(``,!0),E(w,{id:r.key,role:`user`,side:`right`,variant:`soft`,parts:[...r.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...r.text||r.files.length?[{type:`text`,text:r.text||` `}]:[]],ui:{root:r.text.trim()||r.files.length?`msg msg-user`:`msg msg-user msg-no-text`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[E(u,{srcs:r.srcs,offline:f(W)},null,8,[`srcs`,`offline`])]),content:H(()=>[r.files.length?(_(),v(`span`,Al,[(_(!0),v(k,null,y(r.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>un(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:r.text,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.time?(_(),v(`div`,{key:1,class:`msg-time`,title:r.at||void 0},M(r.time),9,jl)):g(``,!0)],8,El)):r.k===`assistant`?(_(),v(k,{key:4},[E(w,{id:r.key,role:`assistant`,side:`left`,variant:`naked`,"data-hit-key":r.key,parts:[{type:`text`,text:r.text}],ui:{root:`msg msg-ai tw-${e.pane.agent||`agent`}${f(ne)?` can-run`:``}${f(Dt)===r.key?` q-picking`:``}`,container:`msg-c`,content:`md`}},{content:H(()=>[E(D,{html:r.html,typing:Ae(r.id),onDone:e=>je(r.id)},null,8,[`html`,`typing`,`onDone`])]),_:2},1032,[`id`,`data-hit-key`,`parts`,`ui`]),(`replyStyle`in t?t.replyStyle:f(yi))===`list`&&!f(W)&&Ae(r.id)===null&&(f(Tr)(r.html).questions.length||f(Tr)(r.html).pick)?(_(),v(`div`,Ml,[f(Tr)(r.html).questions.length?(_(),v(k,{key:0},[I(`p`,Nl,M((`tl`in t?t.tl:f(Z))(`Questions · reply to`,`Questions · répondre à`)),1),(_(!0),v(k,null,y(f(Tr)(r.html).questions,e=>(_(),v(`div`,{key:e.n,class:`q-line`},[I(`button`,{type:`button`,class:j([`q-row`,{quoted:f(jr)(f(Ot),f(ci)(e.text,r.time,r.rid))}]),"aria-label":`${(`t`in t?t.t:f(Q))(`Reply`)}: ${e.text}`,onClick:t=>ht(f(ci)(e.text,r.time,r.rid)),onMouseenter:t=>kt(r.key,e.n,!0),onMouseleave:t=>kt(r.key,e.n,!1),onFocus:t=>kt(r.key,e.n,!0),onBlur:t=>kt(r.key,e.n,!1)},[I(`b`,null,M(f(jr)(f(Ot),f(ci)(e.text,r.time,r.rid))?`✓`:e.n),1),I(`span`,null,M(e.text),1),I(`i`,null,[n[14]||=a(`↳`,-1),I(`em`,null,M(f(jr)(f(Ot),f(ci)(e.text,r.time,r.rid))?(`t`in t?t.t:f(Q))(`Quoted`):(`t`in t?t.t:f(Q))(`Reply`)),1)])],42,Pl),e.closed?(_(),v(k,{key:0},y([`yes`,`no`],t=>I(`button`,{key:t,type:`button`,class:`q-row-ans`,"aria-pressed":bt(f(ci)(e.text,r.time,r.rid),t),"aria-label":`${gt(t)}: ${e.text}`,onClick:n=>vt(f(ci)(e.text,r.time,r.rid),t,n.detail>0)},M(gt(t)),9,Fl)),64)):g(``,!0)]))),128))],64)):g(``,!0),f(Tr)(r.html).pick?(_(),v(`button`,{key:1,type:`button`,class:`q-pick`,"aria-pressed":f(Dt)===r.key,onClick:e=>Dt.value=f(Dt)===r.key?null:r.key},M(f(Dt)===r.key?(`tl`in t?t.tl:f(Z))(`Pick the point to quote · Cancel`,`Choisis le point à citer · Annuler`):(`tl`in t?t.tl:f(Z))(`+ Quote a point`,`+ Citer un point`)),9,Il)):g(``,!0)])):g(``,!0),!r.endsTurn&&!f(W)?(_(),v(`div`,Ll,[I(`button`,{type:`button`,class:`msg-reply`,onClick:e=>mt(r.key)},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`Reply`)),1)],8,Rl)])):g(``,!0)],64)):r.k===`thinking`?(_(),m(P,{key:5,class:`omp-thinking`,text:r.text,streaming:Me(r.id)!==null,duration:r.ms===void 0?void 0:Math.max(1,Math.round(r.ms/1e3)),"auto-close-delay":450,ui:{root:`omp-thinking`,trigger:`omp-thinking-head`,label:`omp-thinking-label`,content:`omp-thinking-content`,body:`omp-thinking-body`}},{default:H(()=>[E(D,{class:`md`,html:r.html,typing:Me(r.id),speed:(`reducedMotion`in t?t.reducedMotion:f(Oi))?`off`:`fast`,cipher:!1,onDone:e=>Ne(r.id)},null,8,[`html`,`typing`,`speed`,`onDone`])]),_:2},1032,[`text`,`streaming`,`duration`])):r.k===`job`?(_(),v(`div`,{key:6,class:j([`omp-job`,{err:r.error,open:lt(r.key)}])},[I(`button`,{type:`button`,class:`omp-job-head`,disabled:!r.out,"aria-expanded":r.out?lt(r.key):void 0,onClick:e=>ut(r.key,!lt(r.key))},[I(`span`,Bl,M(r.error?`✗`:`✓`),1),I(`span`,Vl,M((`tl`in t?t.tl:f(Z))(`Background job completed`,`Tâche de fond terminée`)),1),I(`code`,null,`[`+M(r.tool)+`] `+M(r.id),1),r.ms===void 0?g(``,!0):(_(),v(`span`,Hl,M(f(wo)(r.ms)),1)),r.out?(_(),m(s,{key:1,name:lt(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`])):g(``,!0)],8,zl),r.out&&lt(r.key)?(_(),v(`div`,Ul,[I(`div`,Wl,[I(`span`,Gl,M(r.error?(`tl`in t?t.tl:f(Z))(`Error`,`Erreur`):(`tl`in t?t.tl:f(Z))(`Output`,`Sortie`)),1),r.ms===void 0?g(``,!0):(_(),v(`span`,Kl,`wall `+M(f(wo)(r.ms)),1))]),I(`pre`,null,M(r.out),1)])):g(``,!0)],2)):r.k===`shell`?(_(),v(`div`,{key:7,class:j([`msg-shell`,{bash:r.bash,long:r.long,open:lt(r.key)}])},[I(`div`,ql,[I(`span`,Jl,M(r.bash?`!`:`❯`),1),I(`code`,null,M(r.text),1),E(B,{text:(`t`in t?t.t:f(Q))(`Copy command`),disabled:!(`desk`in t?t.desk:f(Lr))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`msg-shell-copy`,"aria-label":(`t`in t?t.t:f(Q))(`Copy command`),onClick:e=>f(Kt)(r.bash?`!${r.text}`:r.text)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])]),r.out||r.err?(_(),v(`div`,Yl,[r.out?(_(),v(`pre`,Xl,M(r.out),1)):g(``,!0),r.err?(_(),v(`pre`,Zl,M(r.err),1)):g(``,!0)])):r.bash?(_(),v(`div`,Ql,M((`t`in t?t.t:f(Q))(`No output`)),1)):g(``,!0),r.long?(_(),v(`button`,{key:2,type:`button`,class:`msg-shell-more`,"aria-expanded":lt(r.key),onClick:e=>ut(r.key,!lt(r.key))},[E(s,{name:lt(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),I(`span`,null,M(lt(r.key)?(`t`in t?t.t:f(Q))(`Collapse`):(`tl`in t?t.tl:f(Z))(`Show all · ${r.lines} lines`,`Tout afficher · ${r.lines} lignes`)),1)],8,$l)):g(``,!0)],2)):r.k===`ompRun`?(_(),v(`div`,eu,[I(`div`,tu,[I(`span`,nu,M(r.tool.omp.title===`Python`?`$`:`!`),1),I(`span`,null,M((`tl`in t?t.tl:f(Z))(`You ran`,`Lancé par toi`)),1)]),E(U,{tool:r.tool,run:``},null,8,[`tool`])])):r.k===`system`?(_(),v(`div`,ru,[I(`span`,null,M(r.text),1)])):r.k===`notice`?(_(),v(`div`,{key:10,class:j([`msg-notice`,{long:r.long,open:lt(r.key),scheduled:r.scheduled}])},[I(`div`,iu,[E(s,{name:r.icon},null,8,[`name`]),I(`span`,null,M(r.label),1)]),E(D,{class:`msg-notice-body md`,html:r.html,typing:null},null,8,[`html`]),r.long?(_(),v(`button`,{key:0,type:`button`,class:`msg-shell-more`,"aria-expanded":lt(r.key),onClick:e=>ut(r.key,!lt(r.key))},[E(s,{name:lt(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),I(`span`,null,M(lt(r.key)?(`t`in t?t.t:f(Q))(`Collapse`):(`t`in t?t.t:f(Q))(`Show all`)),1)],8,au)):g(``,!0)],2)):r.k===`turn`?(_(),v(`div`,ou,[r.copy?(_(),m(B,{key:0,text:(`t`in t?t.t:f(Q))(`Copy reply`),disabled:!(`desk`in t?t.desk:f(Lr))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`turn-copy`,"aria-label":(`t`in t?t.t:f(Q))(`Copy reply`),onClick:e=>f(Kt)(r.copy)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])):g(``,!0),r.reply&&!f(W)?(_(),v(`button`,{key:1,type:`button`,class:`msg-reply`,onClick:e=>mt(r.reply)},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`Reply`)),1)],8,su)):g(``,!0),I(`span`,null,M(r.text),1)])):r.k===`tools`&&f(Mo)(r.list)?(_(),v(`div`,{key:12,class:j([`tools omp-console`,{live:r.live}])},[n[16]||=I(`span`,{class:`fx-ring omp-ring`,"aria-hidden":`true`},[I(`span`,{class:`fx-spin`})],-1),I(`div`,cu,[n[15]||=I(`span`,{class:`omp-console-title`},`omp`,-1),I(`span`,null,M(r.list.length)+` `+M((`t`in t?t.t:f(Q))(`actions`)),1),f(jo)(r.list)?(_(),v(`span`,lu,`Σ `+M(f(wo)(f(jo)(r.list))),1)):g(``,!0)]),Qe(r).hidden||r.list.length>f(3)&&lt(r.key)?(_(),v(`button`,{key:0,type:`button`,class:`omp-console-more`,"aria-expanded":lt(r.key),onClick:e=>ut(r.key,!lt(r.key))},[Qe(r).hidden?(_(),v(k,{key:0},[a(`⋯ `+M((`tl`in t?t.tl:f(Z))(`${Qe(r).hidden} earlier actions`,`${Qe(r).hidden} actions avant`)),1)],64)):(_(),v(k,{key:1},[a(`⋯ `+M((`t`in t?t.t:f(Q))(`Collapse`)),1)],64))],8,uu)):g(``,!0),(_(!0),v(k,null,y(rt(r),(e,t)=>(_(),m(u,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:Zu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`]))),128)),(_(!0),v(k,null,y(Qe(r).rows,(e,t)=>(_(),v(k,{key:`${r.key}:${r.list.length-Qe(r).rows.length+t}`},[E(U,{tool:{...e,omp:e.omp},live:r.live&&e===r.list[r.list.length-1]},null,8,[`tool`,`live`]),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:tt(e),max:Zu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))],2)):r.k===`tools`?(_(),v(`div`,{key:13,class:j([`tools`,{live:r.live}])},[r.list.length<=3?(_(!0),v(k,{key:0},y(r.list,(e,t)=>(_(),v(k,{key:t},[E(K,{text:Ye(e),suffix:Ke(e),icon:Xe(e),loading:r.live&&t===r.list.length-1,streaming:r.live&&t===r.list.length-1,ui:{root:`tool`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`},class:j({err:e.error})},null,8,[`text`,`suffix`,`icon`,`loading`,`streaming`,`class`]),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:tt(e),max:Zu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128)):(_(),m(K,{key:1,open:lt(r.key),text:`${r.list.length} ${(`t`in t?t.t:f(Q))(`actions`)}`,suffix:Ze(r.list[r.list.length-1]),icon:r.live?void 0:`i-lucide-layers`,loading:r.live,streaming:r.live,chevron:`trailing`,ui:{root:`tool group`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`,body:`tool-body`,trailingIcon:`tool-chev`},"onUpdate:open":e=>ut(r.key,e)},{default:H(()=>[(_(!0),v(k,null,y(r.list,(e,t)=>(_(),v(k,{key:t},[I(`div`,{class:j([`tool-row`,{err:e.error}])},[E(s,{name:Xe(e)},null,8,[`name`]),I(`b`,null,M(Ye(e)),1),I(`span`,null,M(Ke(e)),1)],2),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:tt(e),max:Zu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))]),_:2},1032,[`open`,`text`,`suffix`,`icon`,`loading`,`streaming`,`onUpdate:open`])),(_(!0),v(k,null,y(rt(r),(e,t)=>(_(),m(u,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:Zu,offline:f(W),dupes:f(nt)},null,8,[`srcs`,`offline`,`dupes`]))),128))],2)):g(``,!0)],64))),128)),f(R)&&!f(T).length&&!f(F)?(_(),v(`div`,du,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),I(`p`,null,M((`t`in t?t.t:f(Q))(`No messages yet.`)),1)])):g(``,!0),f(F)?(_(),v(`div`,fu,[I(`p`,null,M(f(F)),1)])):g(``,!0)],64))],34),(_(),m(ee,{to:`body`},[f(Mt)?(_(),v(`button`,{key:0,ref_key:`selBtn`,ref:Nt,type:`button`,class:`sel-reply`,style:N({top:`${f(Mt).top}px`,left:`${f(Mt).left}px`}),"aria-label":(`t`in t?t.t:f(Q))(`Reply to this passage`),onPointerdown:n[6]||=q(()=>{},[`prevent`]),onMousedown:n[7]||=q(()=>{},[`prevent`]),onClick:n[8]||=e=>ht(f(ci)(f(Mt).text,f(Mt).time,f(Mt).id))},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`Reply`)),1)],44,pu)):g(``,!0)])),f(Sn).length||f(vn)?(_(),v(`div`,mu,[(_(!0),v(k,null,y(f(Sn).filter(e=>e.phase===`sent`),e=>(_(),v(`div`,{key:e.id,class:`msg-user-wrap`},[e.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Q))(`Show original message`),onClick:t=>Gt(e.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,gu,M(e.reply.time),1),I(`span`,_u,M(e.reply.excerpt),1)],8,hu)):g(``,!0),E(w,{id:`q:${e.id}`,role:`user`,side:`right`,variant:`soft`,parts:Cn(e),ui:{root:`msg msg-user msg-pending sent${e.body||e.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[e.srcs.length?(_(),m(u,{key:0,srcs:e.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(e.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Q))(`Image`)},[E(s,{name:`i-lucide-image`})],8,vu))),128))]),content:H(()=>[e.files.length?(_(),v(`span`,yu,[(_(!0),v(k,null,y(e.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>un(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:e.body,pasted:e.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),I(`div`,bu,[E(s,{name:`i-lucide-check`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`Sent · read by the agent`)),1)])]))),128)),f(vn)?(_(),v(`div`,xu,[I(`div`,Su,[I(`div`,Cu,[I(`span`,wu,M(e.pane.agent===`omp`?f(vn).python?`>>>`:`$`:`!`),1),I(`code`,null,M(f(vn).command),1)]),f(vn).lines.length?(_(),v(`div`,Tu,[f(vn).hidden?(_(),v(`div`,Eu,M((`tl`in t?t.tl:f(Z))(`+ ${f(vn).hidden} lines above`,`+ ${f(vn).hidden} lignes au-dessus`)),1)):g(``,!0),I(`pre`,Du,M(f(vn).lines.join(`
24
+ `)),1)])):(_(),v(`div`,Ou,M((`t`in t?t.t:f(Q))(`No output yet`)),1))]),I(`div`,ku,[E(s,{name:`i-lucide-loader-circle`,class:`spin`}),I(`span`,null,[a(M((`t`in t?t.t:f(Q))(`Running`)),1),f(xn)?(_(),v(k,{key:0},[a(` · `+M(f(xn)),1)],64)):g(``,!0)])])])):g(``,!0),(_(!0),v(k,null,y(f(Sn).filter(e=>e.phase===`queued`),r=>(_(),v(`div`,{key:r.id,class:`msg-user-wrap`},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Q))(`Show original message`),onClick:e=>Gt(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,ju,M(r.reply.time),1),I(`span`,Mu,M(r.reply.excerpt),1)],8,Au)):g(``,!0),E(w,{id:`q:${r.id}`,role:`user`,side:`right`,variant:`soft`,parts:Cn(r),ui:{root:`msg msg-user msg-pending queued${r.body||r.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble queued`,header:`msg-files`}},{files:H(()=>[r.srcs.length?(_(),m(u,{key:0,srcs:r.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(r.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Q))(`Image`)},[E(s,{name:`i-lucide-image`})],8,Nu))),128))]),content:H(()=>[r.files.length?(_(),v(`span`,Pu,[(_(!0),v(k,null,y(r.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>un(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:r.body,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.state===`failed`?(_(),v(`div`,Fu,[E(s,{name:`i-lucide-circle-alert`}),I(`span`,null,M(Fn(r.reason)),1),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(kn),onClick:e=>An(r)},[E(s,{name:f(kn)===r.id?`i-lucide-loader-circle`:`i-lucide-rotate-cw`,class:j({spin:f(kn)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Retry`)),1)],8,Iu),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(En),onClick:e=>On(r)},[E(s,{name:f(En)===r.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(En)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Cancel`)),1)],8,Lu)])):(_(),v(`div`,Ru,[E(s,{name:`i-lucide-clock`}),I(`span`,null,M(Bn(r)),1),f(vc)(e.pane,r)?(_(),v(`button`,{key:0,type:`button`,class:`queued-cancel`,disabled:!!f(In),onClick:e=>Rn(r)},M((`t`in t?t.t:f(Q))(`Clear and send`)),9,zu)):g(``,!0),r.state===`held`&&f(_c)(e.pane,r)!==`working`?(_(),v(`button`,{key:1,type:`button`,class:`queued-cancel`,onClick:n[9]||=e=>d(`gotoTerm`)},M((`t`in t?t.t:f(Q))(`Open terminal`)),1)):g(``,!0),r.state!==`sending`&&(f(Tn)||r.state===`held`)&&r.raw?(_(),v(`button`,{key:2,type:`button`,class:`queued-cancel`,disabled:!!f(En),onClick:e=>On(r)},[E(s,{name:f(En)===r.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(En)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Cancel`)),1)],8,Bu)):g(``,!0)]))]))),128)),f(jn)?(_(),v(`div`,Vu,[I(`p`,Hu,[E(s,{name:`i-lucide-square-terminal`}),I(`span`,null,M((`t`in t?t.t:f(Q))(`A menu is still open in the agent’s terminal. Your messages wait for it to close.`)),1)]),I(`div`,Uu,[I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(Mn),onClick:n[10]||=e=>Pn(`close`)},[E(s,{name:f(Mn)===`close`?`i-lucide-loader-circle`:`i-lucide-x`,class:j({spin:f(Mn)===`close`})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Close menu`)),1)],8,Wu),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(Mn),onClick:n[11]||=e=>Pn(`send`)},[E(s,{name:f(Mn)===`send`?`i-lucide-loader-circle`:`i-lucide-send`,class:j({spin:f(Mn)===`send`})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Send anyway`)),1)],8,Gu)])])):g(``,!0)])):g(``,!0),f(Gn)?(_(),v(`div`,{key:1,class:j([`chat-status`,{typing:f(Gn).typing,waiting:!f(Gn).typing}])},[`verb`in f(Gn)?(_(),v(`span`,Ku,[E(re),E(ie,{text:f(Gn).text,duration:2.4,class:`claude-verb`},null,8,[`text`])])):`omp`in f(Gn)?(_(),v(`span`,qu,[E(ae,{since:f(Gn).since},{default:H(()=>[E(ie,{text:f(Gn).text,duration:2.4,class:`omp-step`},null,8,[`text`])]),_:1},8,[`since`])])):(_(),v(k,{key:2},[n[17]||=I(`i`,{class:`status-dot`},null,-1),f(Gn).typing?(_(),m(ie,{key:0,text:f(Gn).text,duration:2.4},null,8,[`text`])):(_(),v(`span`,Ju,M(f(Gn).text),1))],64))],2)):g(``,!0)]),_:1},8,[`status`])],544),(`sheetMenus`in t?t.sheetMenus:f(ui))?g(``,!0):(_(),m(oe,{key:3,open:f(tn).open,"onUpdate:open":n[12]||=e=>f(tn).open=e,items:f(an),content:{align:`start`,side:`bottom`,sideOffset:4},ui:{content:`hw-dropdown`}},{default:H(()=>[I(`span`,{class:`path-anchor`,style:N({left:`${f(tn).x}px`,top:`${f(tn).y}px`,width:`${f(tn).w}px`,height:`${f(tn).h}px`}),"aria-hidden":`true`},null,4)]),_:1},8,[`open`,`items`])),E(ce,{open:f(dn).open,"onUpdate:open":n[13]||=e=>f(dn).open=e,title:sn(f(ea)(f(dn).path)),wide:``,full:``,screen:``},{default:H(()=>[f(dn).open?(_(),m(se,{key:f(dn).path,"pane-id":e.pane.id,file:f(dn).path},null,8,[`pane-id`,`file`])):g(``,!0)]),_:1},8,[`open`,`title`])])],64)}}}),{__name:`ChatView`});function ed(e,t,n,r){return t===1?e*n:t===2?e*n*Math.max(1,r):e}function td(e,t){let n=t>0?t:16,r=Math.trunc(e/n);return{lines:r,rest:e-r*n}}var nd={key:0,class:`term-loading`},rd={key:1,class:`terminal-selection-hint`},id=[`aria-label`],ad=Object.assign(T({__name:`TerminalView`,props:{ctl:{}},setup(e){let t=e,n=h(null),r=null,i=null,o=0,s=0,c=0,u=!1,d=()=>{c=0,s&&=(t.ctl.scroll(s),0)},p=e=>{s+=e,c||=requestAnimationFrame(d)};function m(e){r=e.touches[0].clientY,i=e.touches[0].clientX,o=0,u=!1}function y(e){if(e.preventDefault(),r===null)return;let a=e.touches[0].clientY,s=e.touches[0].clientX,c=i===null?0:s-i,l=a-r;i=s;let d=n.value?.querySelector(`.xterm`);if(d&&d.scrollWidth>d.clientWidth&&Math.abs(c)>Math.abs(l)){d.scrollLeft-=c,r=a,u=!0;return}o+=l,r=a;let{lines:f,rest:m}=td(o,t.ctl.rowHeight());o=m,f&&(u=!0,p(f))}function b(e){let n=e.changedTouches[0];r=null,i=null,u||(n&&(t.ctl.tapLink(n.clientX,n.clientY)?e.preventDefault():t.ctl.tapMouse(n.clientX,n.clientY)),t.ctl.blur(),document.activeElement?.blur?.())}function x(){t.ctl.focus()}function S(e){e.preventDefault(),e.stopPropagation();let r=n.value?.querySelector(`.xterm`);if(r&&r.scrollWidth>r.clientWidth&&(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))){r.scrollLeft+=e.shiftKey?e.deltaY:e.deltaX;return}let i=t.ctl.rowHeight();o-=ed(e.deltaY,e.deltaMode,i,t.ctl.pageRows());let{lines:a,rest:s}=td(o,i);o=s,a&&p(a)}let C;function T(){C||=setTimeout(()=>{C=void 0,t.ctl.fitNow(!0)},50)}B(Tn,T);let E=null;return w(()=>{t.ctl.mount(n.value),P(()=>{t.ctl.fitNow(!1),t.ctl.hasBanner()||t.ctl.connect(!1)}),E=new ResizeObserver(T),E.observe(n.value)}),l(()=>{E?.disconnect(),clearTimeout(C),cancelAnimationFrame(c),t.ctl.dispose()}),(t,r)=>(_(),v(`div`,{id:`termWrap`,onWheelCapture:S},[I(`div`,{id:`term`,ref_key:`host`,ref:n},null,512),I(`div`,{id:`touch`,"aria-hidden":`true`,onTouchstartPassive:m,onTouchmove:y,onTouchend:b,onMousedown:q(x,[`prevent`])},null,32),e.ctl.loading.value?(_(),v(`div`,nd,[...r[1]||=[I(`span`,{class:`spinner`},null,-1)]])):g(``,!0),e.ctl.selectionHint.visible.value?(_(),v(`div`,rd,[a(M((`tl`in t?t.tl:f(Z))(`Shift + drag to select`,`Shift + glisser pour sélectionner`))+` `,1),I(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Hide`),onClick:r[0]||=t=>e.ctl.selectionHint.dismiss()},`×`,8,id)])):g(``,!0)],32))}}),{__name:`TerminalView`}),od=[`aria-label`],sd=[`onClick`],cd=[`aria-label`],ld=Object.assign(T({__name:`Keybar`,props:{ctl:{},allDigits:{type:Boolean}},setup(e){let t=e,r=[{key:`esc`,label:`esc`},{key:`enter`,label:`⏎`,cls:`wide`},{key:`up`,label:`↑`},{key:`down`,label:`↓`},{key:`1`,label:`1`},{key:`2`,label:`2`},{key:`3`,label:`3`},{key:`tab`,label:`tab`},{key:`shift+tab`,label:`⇧tab`},{key:`left`,label:`←`},{key:`right`,label:`→`},{key:`ctrl+c`,label:`^C`,cls:`danger`},{key:`backspace`,label:`⌫`},{key:`y`,label:`y`},{key:`n`,label:`n`}],i=n(()=>t.allDigits?[...r.slice(0,7),...[`4`,`5`,`6`,`7`,`8`,`9`,`0`].map(e=>({key:e,label:e})),...r.slice(7)]:r);function a(e){X(),t.ctl.sendKeys([e])}function o(){t.ctl.hasFocus()?t.ctl.blur():t.ctl.focus()}return(t,n)=>{let r=qe;return _(),v(`div`,{class:`keybar`,role:`toolbar`,"aria-label":(`t`in t?t.t:f(Q))(`Keys`)},[(_(!0),v(k,null,y(f(i),e=>(_(),v(`button`,{key:e.key,type:`button`,class:j(e.cls),onPointerdown:n[0]||=q(()=>{},[`prevent`]),onClick:t=>a(e.key)},M(e.label),43,sd))),128)),I(`button`,{type:`button`,class:j([`kbd`,{on:e.ctl.kbdOn.value}]),"aria-label":(`t`in t?t.t:f(Q))(`Type in terminal`),onPointerdown:n[1]||=q(()=>{},[`prevent`]),onClick:o},[E(r,{name:`i-lucide-keyboard`})],42,cd)],8,od)}}}),{__name:`Keybar`}),ud=`wherdr.mouse-selection-hint.dismissed`,dd=h(!1),fd=!1;function pd(){if(!fd&&typeof localStorage<`u`){fd=!0;try{dd.value=localStorage.getItem(ud)===`1`}catch{}}let e=h(!1),t=typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches,r=n(()=>t&&e.value&&!dd.value);function i(t,n=!1){e.value=n||t.modes.mouseTrackingMode!==`none`}function a(){dd.value=!0;try{localStorage.setItem(ud,`1`)}catch{}}return{visible:r,refresh:i,dismiss:a}}var md=e(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
25
25
  `)))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
26
26
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(i=!0);if(!i&&r){let e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find((e=>this._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),M=n(5435),N=n(4567),P=n(779);class F extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(D.C0.ESC+`[I`):this.coreService.triggerDataEvent(D.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=F},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0){if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,E=0,D=!1,O=0,k=!1,A=0,j=[],M=m!==-1&&g!==-1;for(let N=0;N<x;N++){e.loadCell(N,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let P=!1,F=N,I=this._workCell;if(v.length>0&&N===v[0][0]){P=!0;let t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),F=t[1]-1,x=I.getWidth()}let L=this._isCellInSelection(N,t),R=n&&N===s,z=M&&N>=m&&N<=g,B=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{B=!0}));let V=I.getChars()||o.WHITESPACE_CELL_CHAR;if(V===` `&&(I.isUnderline()||I.isOverline())&&(V=`\xA0`),A=x*u-f.get(V,I.isBold(),I.isItalic()),b){if(S&&(L&&k||!L&&!k&&I.bg===w)&&(L&&k&&y.selectionForeground||I.fg===T)&&I.extended.ext===E&&z===D&&A===O&&!R&&!P&&!B){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=V,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=I.bg,T=I.fg,E=I.extended.ext,D=z,O=A,k=L,P&&s>=N&&s<=F&&(s=N),!this._coreService.isCursorHidden&&R&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(I.isBold()&&j.push(`xterm-bold`),I.isItalic()&&j.push(`xterm-italic`),I.isDim()&&j.push(`xterm-dim`),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(j.push(`xterm-underline-${I.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!I.isUnderlineColorDefault())){if(I.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(I.getUnderlineColor()).join(`,`)})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}}I.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),I.isStrikethrough()&&j.push(`xterm-strikethrough`),z&&(b.style.textDecoration=`underline`);let H=I.getFgColor(),U=I.getFgColorMode(),ee=I.getBgColor(),W=I.getBgColorMode(),te=!!I.isInverse();if(te){let e=H;H=ee,ee=e;let t=U;U=W,W=t}let G,ne,K,re=!1;switch(this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{e.options.layer!==`top`&&re||(e.backgroundColorRGB&&(W=50331648,ee=e.backgroundColorRGB.rgba>>8&16777215,G=e.backgroundColorRGB),e.foregroundColorRGB&&(U=50331648,H=e.foregroundColorRGB.rgba>>8&16777215,ne=e.foregroundColorRGB),re=e.options.layer===`top`)})),!re&&L&&(G=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,ee=G.rgba>>8&16777215,W=50331648,re=!0,y.selectionForeground&&(U=50331648,H=y.selectionForeground.rgba>>8&16777215,ne=y.selectionForeground)),re&&j.push(`xterm-decoration-top`),W){case 16777216:case 33554432:K=y.ansi[ee],j.push(`xterm-bg-${ee}`);break;case 50331648:K=l.channels.toColor(ee>>16,ee>>8&255,255&ee),this._addStyle(b,`background-color:#${h((ee>>>0).toString(16),`0`,6)}`);break;default:te?(K=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):K=y.background}switch(G||I.isDim()&&(G=l.color.multiplyOpacity(K,.5)),U){case 16777216:case 33554432:I.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(b,K,y.ansi[H],I,G,void 0)||j.push(`xterm-fg-${H}`);break;case 50331648:let e=l.channels.toColor(H>>16&255,H>>8&255,255&H);this._applyMinimumContrast(b,K,e,I,G,ne)||this._addStyle(b,`color:#${h(H.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,K,y.foreground,I,G,ne)||te&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),R||P||B?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),N=F}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,s=0,c=t.getFg(0),l=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map((e=>e.replace(h,` `))).join(d.isWindows?`\r
27
27
  `:`
28
28
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(n&&r&&t)&&this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!n||!r)&&this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(e.button!==2||!this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,n)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((e=>this._handleTrim(e)))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols)}};t.SelectionService=g=r([i(3,m.IBufferService),i(4,m.ICoreService),i(5,c.IMouseService),i(6,m.IOptionsService),i(7,c.IRenderService),i(8,c.ICoreBrowserService)],g)},4725:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;let r=n(8343);t.ICharSizeService=(0,r.createDecorator)(`CharSizeService`),t.ICoreBrowserService=(0,r.createDecorator)(`CoreBrowserService`),t.IMouseService=(0,r.createDecorator)(`MouseService`),t.IRenderService=(0,r.createDecorator)(`RenderService`),t.ISelectionService=(0,r.createDecorator)(`SelectionService`),t.ICharacterJoinerService=(0,r.createDecorator)(`CharacterJoinerService`),t.IThemeService=(0,r.createDecorator)(`ThemeService`),t.ILinkProviderService=(0,r.createDecorator)(`LinkProviderService`)},6731:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;let a=n(7239),o=n(8055),s=n(8460),c=n(844),l=n(2585),u=o.css.toColor(`#ffffff`),d=o.css.toColor(`#000000`),f=o.css.toColor(`#ffffff`),p=o.css.toColor(`#000000`),m={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let e=[o.css.toColor(`#2e3436`),o.css.toColor(`#cc0000`),o.css.toColor(`#4e9a06`),o.css.toColor(`#c4a000`),o.css.toColor(`#3465a4`),o.css.toColor(`#75507b`),o.css.toColor(`#06989a`),o.css.toColor(`#d3d7cf`),o.css.toColor(`#555753`),o.css.toColor(`#ef2929`),o.css.toColor(`#8ae234`),o.css.toColor(`#fce94f`),o.css.toColor(`#729fcf`),o.css.toColor(`#ad7fa8`),o.css.toColor(`#34e2e2`),o.css.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:o.channels.toCss(r,i,a),rgba:o.channels.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+10*t;e.push({css:o.channels.toCss(n,n,n),rgba:o.channels.toRgba(n,n,n)})}return e})());let h=t.ThemeService=class extends c.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:f,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:m,selectionBackgroundOpaque:o.color.blend(d,m),selectionInactiveBackgroundTransparent:m,selectionInactiveBackgroundOpaque:o.color.blend(d,m),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange(`theme`,(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(e={}){let n=this._colors;if(n.foreground=g(e.foreground,u),n.background=g(e.background,d),n.cursor=g(e.cursor,f),n.cursorAccent=g(e.cursorAccent,p),n.selectionBackgroundTransparent=g(e.selectionBackground,m),n.selectionBackgroundOpaque=o.color.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=o.color.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,n.selectionForeground===o.NULL_COLOR&&(n.selectionForeground=void 0),o.color.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=o.color.opacity(n.selectionBackgroundTransparent,.3)),o.color.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=o.color.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.ansi=t.DEFAULT_ANSI_COLORS.slice(),n.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),n.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),n.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),n.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),n.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),n.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),n.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),n.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),n.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),n.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),n.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),n.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),n.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),n.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),n.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),n.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)n.ansi[i+16]=g(e.extendedAnsi[i],t.DEFAULT_ANSI_COLORS[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e!==void 0)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function g(e,t){if(e!==void 0)try{return o.css.toColor(e)}catch{}return t}t.ThemeService=h=r([i(0,l.IOptionsService)],h)},6349:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new r.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new r.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new r.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=a},1439:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,n=5){if(typeof t!=`object`)return t;let r=Array.isArray(t)?[]:{};for(let i in t)r[i]=n<=1?t[i]:t[i]&&e(t[i],n-1);return r}},8055:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},8969:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;let r=n(844),i=n(2585),a=n(4348),o=n(7866),s=n(744),c=n(7302),l=n(6975),u=n(8460),d=n(1753),f=n(1480),p=n(7994),m=n(9282),h=n(5435),g=n(5981),_=n(2660),v=!1;class y extends r.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event((e=>{this._onScrollApi?.fire(e.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new r.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new c.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(f.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(_.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new h.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!v&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,n){this._bufferService.scrollLines(e,t,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},(()=>((0,m.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,r.toDisposable)((()=>{for(let t of e)t.dispose()}))}}}t.CoreTerminal=y},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},5435:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;let a=n(2584),o=n(7116),s=n(2015),c=n(844),l=n(482),u=n(8437),d=n(8460),f=n(643),p=n(511),m=n(3734),h=n(2585),g=n(1480),_=n(6242),v=n(6351),y=n(5941),b={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function S(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var C;(function(e){e[e.GET_WIN_SIZE_PIXELS=0]=`GET_WIN_SIZE_PIXELS`,e[e.GET_CELL_SIZE_PIXELS=1]=`GET_CELL_SIZE_PIXELS`})(C||(t.WindowsOptionsReportType=C={}));let w=0;class T extends c.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,n,r,i,c,f,m,h=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=c,this._coreMouseService=f,this._unicodeService=m,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new E(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._parser.setCsiHandlerFallback(((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})})),this._parser.setEscHandlerFallback((e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})})),this._parser.setExecuteHandlerFallback((e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})})),this._parser.setOscHandlerFallback(((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})})),this._parser.setDcsHandlerFallback(((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})})),this._parser.setPrintHandler(((e,t,n)=>this.print(e,t,n))),this._parser.registerCsiHandler({final:`@`},(e=>this.insertChars(e))),this._parser.registerCsiHandler({intermediates:` `,final:`@`},(e=>this.scrollLeft(e))),this._parser.registerCsiHandler({final:`A`},(e=>this.cursorUp(e))),this._parser.registerCsiHandler({intermediates:` `,final:`A`},(e=>this.scrollRight(e))),this._parser.registerCsiHandler({final:`B`},(e=>this.cursorDown(e))),this._parser.registerCsiHandler({final:`C`},(e=>this.cursorForward(e))),this._parser.registerCsiHandler({final:`D`},(e=>this.cursorBackward(e))),this._parser.registerCsiHandler({final:`E`},(e=>this.cursorNextLine(e))),this._parser.registerCsiHandler({final:`F`},(e=>this.cursorPrecedingLine(e))),this._parser.registerCsiHandler({final:`G`},(e=>this.cursorCharAbsolute(e))),this._parser.registerCsiHandler({final:`H`},(e=>this.cursorPosition(e))),this._parser.registerCsiHandler({final:`I`},(e=>this.cursorForwardTab(e))),this._parser.registerCsiHandler({final:`J`},(e=>this.eraseInDisplay(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`J`},(e=>this.eraseInDisplay(e,!0))),this._parser.registerCsiHandler({final:`K`},(e=>this.eraseInLine(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`K`},(e=>this.eraseInLine(e,!0))),this._parser.registerCsiHandler({final:`L`},(e=>this.insertLines(e))),this._parser.registerCsiHandler({final:`M`},(e=>this.deleteLines(e))),this._parser.registerCsiHandler({final:`P`},(e=>this.deleteChars(e))),this._parser.registerCsiHandler({final:`S`},(e=>this.scrollUp(e))),this._parser.registerCsiHandler({final:`T`},(e=>this.scrollDown(e))),this._parser.registerCsiHandler({final:`X`},(e=>this.eraseChars(e))),this._parser.registerCsiHandler({final:`Z`},(e=>this.cursorBackwardTab(e))),this._parser.registerCsiHandler({final:"`"},(e=>this.charPosAbsolute(e))),this._parser.registerCsiHandler({final:`a`},(e=>this.hPositionRelative(e))),this._parser.registerCsiHandler({final:`b`},(e=>this.repeatPrecedingCharacter(e))),this._parser.registerCsiHandler({final:`c`},(e=>this.sendDeviceAttributesPrimary(e))),this._parser.registerCsiHandler({prefix:`>`,final:`c`},(e=>this.sendDeviceAttributesSecondary(e))),this._parser.registerCsiHandler({final:`d`},(e=>this.linePosAbsolute(e))),this._parser.registerCsiHandler({final:`e`},(e=>this.vPositionRelative(e))),this._parser.registerCsiHandler({final:`f`},(e=>this.hVPosition(e))),this._parser.registerCsiHandler({final:`g`},(e=>this.tabClear(e))),this._parser.registerCsiHandler({final:`h`},(e=>this.setMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`h`},(e=>this.setModePrivate(e))),this._parser.registerCsiHandler({final:`l`},(e=>this.resetMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`l`},(e=>this.resetModePrivate(e))),this._parser.registerCsiHandler({final:`m`},(e=>this.charAttributes(e))),this._parser.registerCsiHandler({final:`n`},(e=>this.deviceStatus(e))),this._parser.registerCsiHandler({prefix:`?`,final:`n`},(e=>this.deviceStatusPrivate(e))),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},(e=>this.softReset(e))),this._parser.registerCsiHandler({intermediates:` `,final:`q`},(e=>this.setCursorStyle(e))),this._parser.registerCsiHandler({final:`r`},(e=>this.setScrollRegion(e))),this._parser.registerCsiHandler({final:`s`},(e=>this.saveCursor(e))),this._parser.registerCsiHandler({final:`t`},(e=>this.windowOptions(e))),this._parser.registerCsiHandler({final:`u`},(e=>this.restoreCursor(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},(e=>this.insertColumns(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},(e=>this.deleteColumns(e))),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},(e=>this.selectProtected(e))),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},(e=>this.requestMode(e,!0))),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},(e=>this.requestMode(e,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new _.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new _.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new _.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new _.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new _.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new _.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new _.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new _.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new _.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new _.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new _.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new _.OscHandler((e=>this.restoreCursorColor(e)))),this._parser.registerEscHandler({final:`7`},(()=>this.saveCursor())),this._parser.registerEscHandler({final:`8`},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:`D`},(()=>this.index())),this._parser.registerEscHandler({final:`E`},(()=>this.nextLine())),this._parser.registerEscHandler({final:`H`},(()=>this.tabSet())),this._parser.registerEscHandler({final:`M`},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:`=`},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:`>`},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:`c`},(()=>this.fullReset())),this._parser.registerEscHandler({final:`n`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`o`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`|`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`}`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`~`},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:`%`,final:`@`},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:`%`,final:`G`},(()=>this.selectDefaultCharset()));for(let e in o.CHARSETS)this._parser.registerEscHandler({intermediates:`(`,final:e},(()=>this.selectCharset(`(`+e))),this._parser.registerEscHandler({intermediates:`)`,final:e},(()=>this.selectCharset(`)`+e))),this._parser.registerEscHandler({intermediates:`*`,final:e},(()=>this.selectCharset(`*`+e))),this._parser.registerEscHandler({intermediates:`+`,final:e},(()=>this.selectCharset(`+`+e))),this._parser.registerEscHandler({intermediates:`-`,final:e},(()=>this.selectCharset(`-`+e))),this._parser.registerEscHandler({intermediates:`.`,final:e},(()=>this.selectCharset(`.`+e))),this._parser.registerEscHandler({intermediates:`/`,final:e},(()=>this.selectCharset(`/`+e)));this._parser.registerEscHandler({intermediates:`#`,final:`8`},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((e=>(this._logService.error(`Parsing error: `,e),e))),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new v.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=h.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t(`#SLOW_TIMEOUT`)),5e3)))]).catch((e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than 5000 ms`)}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>x&&(a=this._parseStack.position+x)}if(this._logService.logLevel<=h.LogLevelEnum.DEBUG&&this._logService.debug(`parsing data`+(typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join(``)}"`),typeof e==`string`?e.split(``).map((e=>e.charCodeAt(0))):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<x&&(this._parseBuffer=new Uint32Array(Math.min(e.length,x))),o||this._dirtyRowTracker.clearRange(),e.length>x)for(let t=a;t<e.length;t+=x){let a=t+x<e.length?t+x:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}this._activeBuffer.x===r&&this._activeBuffer.y===i||this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(c,this._bufferService.rows-1),Math.min(s,this._bufferService.rows-1))}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let h=this._parser.precedingJoinState;for(let _=t;_<n;++_){if(r=e[_],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,h);i=g.UnicodeService.extractWidth(t);let n=g.UnicodeService.extractShouldJoin(t),v=n?g.UnicodeService.extractWidth(h):0;if(h=t,o&&this._onA11yChar.fire((0,l.stringFromCodePoint)(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-v>s){if(c){let e=m,t=this._activeBuffer.x-v;for(this._activeBuffer.x=v,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&m instanceof u.BufferLine&&m.copyCellsFrom(e,t,0,v,!1);t<s;)e.setCellFromCodepoint(t++,0,1,p)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-v;--e>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}else if(d&&(m.insertCells(this._activeBuffer.x,i-v,this._activeBuffer.getNullCell(p)),m.getWidth(s-1)===2&&m.setCellFromCodepoint(s-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,p)),m.setCellFromCodepoint(this._activeBuffer.x++,r,i,p),i>0)for(;--i;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=h,this._activeBuffer.x<s&&n-t>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final!==`t`||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!S(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new _.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),t!==2&&t!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){let n;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(u.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=g.UnicodeService.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(a.C0.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),this._charsetService.setgCharset(1,o.DEFAULT_CHARSET),this._charsetService.setgCharset(2,o.DEFAULT_CHARSET),this._charsetService.setgCharset(3,o.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=e=>e?1:2,p=e.params[0];return m=p,h=t?p===2?4:p===4?f(o.modes.insertMode):p===12?3:p===20?f(d.convertEol):0:p===1?f(n.applicationCursorKeys):p===3?d.windowOptions.setWinLines?c===80?2:+(c===132):0:p===6?f(n.origin):p===7?f(n.wraparound):p===8?3:p===9?f(r===`X10`):p===12?f(d.cursorBlink):p===25?f(!o.isCursorHidden):p===45?f(n.reverseWraparound):p===66?f(n.applicationKeypad):p===67?4:p===1e3?f(r===`VT200`):p===1002?f(r===`DRAG`):p===1003?f(r===`ANY`):p===1004?f(n.sendFocus):p===1005?4:p===1006?f(i===`SGR`):p===1015?4:p===1016?f(i===`SGR_PIXELS`):p===1048?1:p===47||p===1047||p===1049?f(l===u):p===2004?f(n.bracketedPasteMode):0,o.triggerDataEvent(`${a.C0.ESC}[${t?``:`?`}${m};${h}$y`),!0;var m,h}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=m.AttributeData.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|255&n),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777224|n-90):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777224|n-100):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):n===49?(r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle=`block`;break;case 3:case 4:this._optionsService.options.cursorStyle=`underline`;break;case 5:case 6:this._optionsService.options.cursorStyle=`bar`}let n=t%2==1;return this._optionsService.options.cursorBlink=n,!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!S(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:t!==0&&t!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),t!==0&&t!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:t!==0&&t!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),t!==0&&t!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(D(n)){if(r===`?`)t.push({type:0,index:n});else{let e=(0,y.parseColor)(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.split(`;`);return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex((e=>e.startsWith(`id=`)));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=(0,y.parseColor)(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);D(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(b[e[0]],o.CHARSETS[e[1]]||o.DEFAULT_CHARSET),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new p.CellData;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=this._bufferService.buffer,r=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${e}${a.C0.ESC}\\`),!0))(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-+!!r.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=T;let E=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(w=e,e=t,t=w),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function D(e){return 0<=e&&e<256}E=r([i(0,h.IBufferService)],E)},844:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let n=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){this._array.length===0?this._array.push(e):(n=this._search(this._getKey(e)),this._array.splice(n,0,e))}delete(e){if(this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(n=this._search(t),n===-1)||this._getKey(this._array[n])!==t)return!1;do if(this._array[n]===e)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===t);return!1}*getKeyIterator(e){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===e)}forEachByKey(e,t){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do t(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===e)}values(){return[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else{if(!(i<e)){for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}}},7226:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(6114);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;let r=n(643);t.updateWindowsModeWrappedState=function(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&t[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},9092:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let r=n(6349),i=n(7226),a=n(3734),o=n(8437),s=n(4634),c=n(511),l=n(643),u=n(4863),d=n(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=c.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let n=e+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=o.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new o.BufferLine(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(n.length>0){let r=(0,s.reflowLargerCreateNewLayout)(this.lines,n);(0,s.reflowLargerApplyNewLayout)(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(o.DEFAULT_ATTR_DATA),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new o.BufferLine(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=[],i=0;for(let a=this.lines.length-1;a>=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let l=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),l.unshift(c);let u=this.ybase+this.y;if(u>=a&&u<a+l.length)continue;let d=l[l.length-1].getTrimmedLength(),f=(0,s.reflowSmallerGetNewLineLengths)(l,this._cols,e),p=f.length-l.length,m;m=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+p):Math.max(0,this.lines.length-this.lines.maxLength+p);let h=[];for(let e=0;e<p;e++){let e=this.getBlankLine(o.DEFAULT_ATTR_DATA,!0);h.push(e)}h.length>0&&(r.push({start:a+l.length+i,newLines:h}),i+=h.length),l.push(...h);let g=f.length-1,_=f[g];_===0&&(g--,_=f[g]);let v=l.length-p-1,y=d;for(;v>=0;){let e=Math.min(y,_);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[v],y-e,_-e,e,!0),_-=e,_===0&&(g--,_=f[g]),y-=e,y===0){v--;let e=Math.max(v,0);y=(0,s.getWrappedLineTrimmedLength)(l,e,this._cols)}}for(let t=0;t<l.length;t++)f[t]<e&&l[t].setCell(f[t],n);let b=p-m;for(;b-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(r.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,a=n-1,o=0,s=r[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+i-1);l>=0;l--)if(s&&s.start>a+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:a+1,amount:s.newLines.length}),c+=s.newLines.length,s=r[++o]}else this.lines.set(l,t[a--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+i-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new u.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim((e=>{t.line-=e,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((e=>{t.line>=e.index&&(t.line+=e.amount)}))),t.register(this.lines.onDelete((e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let r=n(3734),i=n(511),a=n(643),o=n(482);t.DEFAULT_ATTR_DATA=Object.freeze(new r.AttributeData);let s=0;class c{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||i.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[3*e+0],n=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:n?(0,o.stringFromCodePoint)(n):``,t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[3*e+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):``}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,n,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&r?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&r)+(0,o.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[3*e+0]=r}insertCells(e,t,n){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new i.CellData;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new i.CellData;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let n=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*n)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,4*n*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new c(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[3*t+0],n=2097151&e,s=2097152&e?this._combined[t]:n?(0,o.stringFromCodePoint)(n):a.WHITESPACE_CELL_CHAR;if(i+=s,r)for(let e=0;e<s.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}}t.BufferLine=c},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function n(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(i>=s&&i<c){s+=u.length-1;continue}let d=0,f=n(u,d,t),p=1,m=0;for(;p<u.length;){let e=n(u,p,t),i=e-m,o=r-f,s=Math.min(i,o);u[d].copyCellsFrom(u[p],m,f,s,!1),f+=s,f===r&&(d++,f=0),m+=s,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(r-1)===2&&(u[d].copyCellsFrom(u[d-1],r-1,f++,1,!1),u[d-1].setCell(r-1,a))}u[d].replaceCells(f,r,a);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}},t.reflowLargerApplyNewLayout=function(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,r){let i=[],a=e.map(((r,i)=>n(e,i,t))).reduce(((e,t)=>e+t)),o=0,s=0,c=0;for(;c<a;){if(a-c<r){i.push(a-c);break}o+=r;let l=n(e,s,t);o>l&&(o-=l,s++);let u=e[s].getWidth(o-1)===2;u&&o--;let d=u?r-1:r;i.push(d),c+=d}return i},t.getWrappedLineTrimmedLength=n},5295:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;let r=n(8460),i=n(844),a=n(9092);class o extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,(()=>this.setupTabStops())))}reset(){this._normal=new a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(482),i=n(643),a=n(3734);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;let r=n(8460),i=n(844);class a{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=a,a._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},t.CHARSETS.A={"#":`£`},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},t.CHARSETS.C=t.CHARSETS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},t.CHARSETS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},t.CHARSETS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},t.CHARSETS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},t.CHARSETS.E=t.CHARSETS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},t.CHARSETS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},t.CHARSETS.H=t.CHARSETS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`}},2584:(e,t)=>{var n,r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
29
29
  `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``}(n||(t.C0=n={})),function(e){e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:o.key=e.ctrlKey?`\b`:r.C0.DEL,e.altKey&&(o.key=r.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:o.key=e.ctrlKey?r.C0.ESC+`[5;`+(s+1)+`~`:r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:o.key=e.ctrlKey?r.C0.ESC+`[6;`+(s+1)+`~`:r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey){if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;let r=n(1480),i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<i.length;++e)o.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,a)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},5981:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e=>Date.now()-n>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}}t.TransitionTable=s,t.VT500_TRANSITION_TABLE=function(){let e=new s(4095),t=Array.apply(null,Array(256)).map(((e,t)=>t)),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,a=0,o=0;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}}for(let n=o;n<t;++n){switch(i=e[n],a=this._transitions.table[this.currentState<<8|(i<160?i:160)],a>>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n<t&&(i=e[n])>47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,`END`,e)}this._active=a,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=``,this._hitLimit=!1,e)));return this._data=``,this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,n)=>t(e,n.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===1&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function l(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,(t=>{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e<c&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}))}}t.DecorationService=l;class u extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?r.css.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?r.css.toColor(this.options.foregroundColor):void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n={...t.DEFAULT_OPTIONS};for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options={...n},this._setupOptions(),this.register((0,i.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(e,t){return this.onOptionChange((n=>{n===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((n=>{e.indexOf(n)!==-1&&t()}))}_setupOptions(){let e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(r,n))),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(o,a))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every((e=>e.line!==t))){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(n,e)))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);class a{static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=0,r=e.length;for(let i=0;i<r;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(u.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this.register(new s.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
30
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),pd=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),md=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebglAddon=r():n.WebglAddon=r()})(self,(()=>(()=>{var e={965:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;let r=n(374),i=n(509),a=n(855),o=n(859),s=n(381),c=11*Float32Array.BYTES_PER_ELEMENT,l,u=0,d=0,f=0;class p extends o.Disposable{constructor(e,t,n,a){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=a,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let l=this._gl;i.TextureAtlas.maxAtlasPages===void 0&&(i.TextureAtlas.maxAtlasPages=Math.min(32,(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),i.TextureAtlas.maxTextureSize=(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=(0,r.throwIfFalsy)((0,s.createProgram)(l,`#version 300 es
30
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),hd=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),gd=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebglAddon=r():n.WebglAddon=r()})(self,(()=>(()=>{var e={965:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;let r=n(374),i=n(509),a=n(855),o=n(859),s=n(381),c=11*Float32Array.BYTES_PER_ELEMENT,l,u=0,d=0,f=0;class p extends o.Disposable{constructor(e,t,n,a){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=a,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let l=this._gl;i.TextureAtlas.maxAtlasPages===void 0&&(i.TextureAtlas.maxAtlasPages=Math.min(32,(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),i.TextureAtlas.maxTextureSize=(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=(0,r.throwIfFalsy)((0,s.createProgram)(l,`#version 300 es
31
31
  layout (location = 0) in vec2 a_unitquad;
32
32
  layout (location = 1) in vec2 a_cellpos;
33
33
  layout (location = 2) in vec2 a_offset;
@@ -70,26 +70,28 @@ out vec4 outColor;
70
70
 
71
71
  void main() {
72
72
  outColor = v_color;
73
- }`)),this.register((0,i.toDisposable)((()=>l.deleteProgram(this._program)))),this._projectionLocation=(0,r.throwIfFalsy)(l.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(d)))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,u,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(p)))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p),l.bufferData(l.ELEMENT_ARRAY_BUFFER,f,l.STATIC_DRAW),this._attributesBuffer=(0,r.throwIfFalsy)(l.createBuffer()),this.register((0,i.toDisposable)((()=>l.deleteBuffer(this._attributesBuffer)))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,s,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,s,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,s,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this.register(this._themeService.onChangeColors((e=>{this._updateCachedColors(e),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,o.PROJECTION_MATRIX),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r,i,o,s,c,l,u,d,f,p,m,h=1;for(r=0;r<t.rows;r++){for(o=-1,s=0,c=0,l=!1,i=0;i<t.cols;i++)u=(r*t.cols+i)*a.RENDER_MODEL_INDICIES_PER_CELL,d=e.cells[u+a.RENDER_MODEL_BG_OFFSET],f=e.cells[u+a.RENDER_MODEL_FG_OFFSET],p=!!(67108864&f),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,i,r)),o=i,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,t.cols,r))}n.count=h}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`)return void(t.count=0);let r,i=0;n.style!==`bar`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.style!==`underline`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=8*i++,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,s){if(67108864&n)switch(50331648&n){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&n].rgba;break;case 50331648:l=(16777215&n)<<8;break;default:l=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:l=(16777215&r)<<8;break;default:l=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=(0,o.expandFloat32Array)(e.attributes,this._terminal.rows*this._terminal.cols*8)),u=i*this._dimensions.device.cell.width,d=s*this._dimensions.device.cell.height,f=(l>>24&255)/255,p=(l>>16&255)/255,m=(l>>8&255)/255,h=1,this._addRectangle(e.attributes,t,u,d,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,f,p,m,h)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}}t.RectangleRenderer=g},310:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;let r=n(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=(0,r.createSelectionRenderModel)()}resize(e,n){let r=e*n*t.RENDER_MODEL_INDICIES_PER_CELL;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;let r=n(820),i=n(274),a=n(627),o=n(457),s=n(56),c=n(374),l=n(345),u=n(859),d=n(147),f=n(782),p=n(855),m=n(965),h=n(742),g=n(310),_=n(733);class v extends u.Disposable{constructor(e,t,n,o,d,p,m,h,v){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=o,this._coreService=d,this._decorationService=p,this._optionsService=m,this._themeService=h,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new g.RenderModel,this._workCell=new f.CellData,this._workCell2=new f.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new l.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new l.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new l.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new l.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new i.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new _.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,m,this._themeService)],this.dimensions=(0,c.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(m.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let y={antialias:!1,depth:!1,preserveDrawingBuffer:v};if(this._gl=this._canvas.getContext(`webgl2`,y),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextlost`,(e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)}),3e3)}))),this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextrestored`,(e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,a.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t))),this.register(this._coreBrowserService.onWindowChange((e=>{this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,e,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,u.toDisposable)((()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,a.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new h.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new m.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let e=(0,a.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,l.forwardEvent)(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,l.forwardEvent)(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(e){return-1}deregisterCharacterJoiner(e){return!1}renderRows(e,t){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new o.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r,i,a,o,s,c,l,u,d,f,m,h,_,v,x=this._workCell;e=b(e,n.rows-1,0),t=b(t,n.rows-1,0);let S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let D=!1;for(i=e;i<=t;i++)for(a=i+n.buffer.ydisp,o=n.buffer.lines.get(a),this._model.lineLengths[i]=0,s=this._characterJoinerService.getJoinedCharacters(a),_=0;_<n.cols;_++)if(r=this._cellColorResolver.result.bg,o.loadCell(_,x),_===0&&(r=this._cellColorResolver.result.bg),c=!1,l=_,s.length>0&&_===s[0][0]&&(c=!0,u=s.shift(),x=new y(x,o.translateToString(!0,u[0],u[1]),u[1]-u[0]),l=u[1]-1),d=x.getChars(),f=x.getCode(),h=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(x,_,a,this.dimensions.device.cell.width),E&&a===S&&(_===w&&(this._model.cursor={x:w,y:C,width:x.getWidth(),style:this._coreBrowserService.isFocused?n.options.cursorStyle||`block`:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+x.getWidth()-1),_>=w&&_<=T&&(this._coreBrowserService.isFocused&&(n.options.cursorStyle||`block`)===`block`||!1===this._coreBrowserService.isFocused&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),f!==p.NULL_CELL_CODE&&(this._model.lineLengths[i]=_+1),(this._model.cells[h]!==f||this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(D=!0,d.length>1&&(f|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[h]=f,this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,m=x.getWidth(),this._glyphRenderer.value.updateCell(_,i,f,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,m,r),c))for(x=this._workCell,_++;_<l;_++)v=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(_,i,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[v]=p.NULL_CELL_CODE,this._model.cells[v+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[v+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[v+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;D&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}}t.WebglRenderer=v;class y extends d.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function b(e,t,n=0){return Math.max(Math.min(e,t),n)}t.JoinedCellData=y},381:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;let r=n(374);function i(e,t,n){let i=(0,r.throwIfFalsy)(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(e,t,n){let a=(0,r.throwIfFalsy)(e.createProgram());if(e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.VERTEX_SHADER,t))),e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.FRAGMENT_SHADER,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;console.error(e.getProgramInfoLog(a)),e.deleteProgram(a)},t.createShader=i,t.expandFloat32Array=function(e,t){let n=Math.min(2*e.length,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r},t.GLTexture=class{constructor(e){this.texture=e,this.version=-1}}},592:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;let r=n(627),i=n(237),a=n(374),o=n(859);class s extends o.Disposable{constructor(e,t,n,r,i,a,s,c){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=s,this._themeService=c,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((t=>{this._refreshCharAtlas(e,t),this.reset(e)}))),this.register((0,o.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,a.throwIfFalsy)(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,r.acquireTextureAtlas)(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=i.TEXT_BASELINE,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){return`${n?`italic`:``} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}}t.BaseRenderLayer=s},733:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;let r=n(197),i=n(237),a=n(592);class o extends a.BaseRenderLayer{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this.register(r.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(r.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===i.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&(0,r.is256Color)(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}}t.LinkRenderLayer=o},820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},274:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;let r=n(855),i=n(160),a=n(374),o,s=0,c=0,l=!1,u=!1,d=!1,f=0;t.CellColorResolver=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,p){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,c=0,s=0,u=!1,l=!1,d=!1,o=this._themeService.colors,f=0,e.getCode()!==r.NULL_CELL_CODE&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));f=t*p%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),d=this._selectionRenderModel.isCellSelected(this._terminal,t,n),d){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:c=(16777215&this.result.fg)<<8|255;break;default:c=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:c=(16777215&this.result.bg)<<8|255}c=i.rgba.blend(c,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else c=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,o.selectionForeground&&(s=o.selectionForeground.rgba>>8&16777215,l=!0),(0,a.treatGlyphAsBackgroundColor)(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))s=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:s=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:s=(16777215&this.result.fg)<<8|255;break;default:s=this._themeService.colors.foreground.rgba}s=i.rgba.blend(s,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}l=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),u&&(c=d?e.bg&-150994944|c|50331648:-16777216&e.bg|c|50331648),l&&(s=e.fg&-83886080|s|50331648),67108864&this.result.fg&&(u&&!l&&(s=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&o.background.rgba>>8|50331648,l=!0),!u&&l&&(c=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&o.foreground.rgba>>8|50331648,u=!0)),o=void 0,this.result.bg=u?c:this.result.bg,this.result.fg=l?s:this.result.fg,this.result.ext&=536870911,this.result.ext|=f<<29&3758096384}}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;let r=n(509),i=n(197),a=[];t.acquireTextureAtlas=function(e,t,n,o,s,c,l,u){let d=(0,i.generateConfig)(o,s,c,l,t,n,u);for(let t=0;t<a.length;t++){let n=a[t],r=n.ownedBy.indexOf(e);if(r>=0){if((0,i.configEquals)(n.config,d))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),a.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<a.length;t++){let n=a[t];if((0,i.configEquals)(n.config,d))return n.ownedBy.push(e),n.atlas}let f=e._core,p={atlas:new r.TextureAtlas(document,d,f.unicodeService),config:d,ownedBy:[e]};return a.push(p),p.atlas},t.removeTerminalFromCache=function(e){for(let t=0;t<a.length;t++){let n=a[t].ownedBy.indexOf(e);if(n!==-1){a[t].ownedBy.length===1?(a[t].atlas.dispose(),a.splice(t,1)):a[t].ownedBy.splice(n,1);break}}}},197:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;let r=n(160);t.generateConfig=function(e,t,n,i,a,o,s){let c={foreground:o.foreground,background:o.background,cursor:r.NULL_COLOR,cursorAccent:r.NULL_COLOR,selectionForeground:r.NULL_COLOR,selectionBackgroundTransparent:r.NULL_COLOR,selectionBackgroundOpaque:r.NULL_COLOR,selectionInactiveBackgroundTransparent:r.NULL_COLOR,selectionInactiveBackgroundOpaque:r.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:s,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:c}},t.configEquals=function(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba},t.is256Color=function(e){return(50331648&e)==16777216||(50331648&e)==33554432}},237:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;let r=n(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};let i={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}},t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.tryDrawCustomChar=function(e,n,o,l,u,d,f,p){let m=t.blockElementDefinitions[n];if(m)return function(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}(e,m,o,l,u,d),!0;let h=i[n];if(h)return function(e,t,n,i,o,s){let c=a.get(t);c||(c=new Map,a.set(t,c));let l=e.fillStyle;if(typeof l!=`string`)throw Error(`Unexpected fillStyle type "${l}"`);let u=c.get(l);if(!u){let n=t[0].length,i=t.length,a=e.canvas.ownerDocument.createElement(`canvas`);a.width=n,a.height=i;let o=(0,r.throwIfFalsy)(a.getContext(`2d`)),s=new ImageData(n,i),d,f,p,m;if(l.startsWith(`#`))d=parseInt(l.slice(1,3),16),f=parseInt(l.slice(3,5),16),p=parseInt(l.slice(5,7),16),m=l.length>7&&parseInt(l.slice(7,9),16)||1;else{if(!l.startsWith(`rgba`))throw Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);[d,f,p,m]=l.substring(5,l.length-1).split(`,`).map((e=>parseFloat(e)))}for(let e=0;e<i;e++)for(let r=0;r<n;r++)s.data[4*(e*n+r)]=d,s.data[4*(e*n+r)+1]=f,s.data[4*(e*n+r)+2]=p,s.data[4*(e*n+r)+3]=t[e][r]*(255*m);o.putImageData(s,0,0),u=(0,r.throwIfFalsy)(e.createPattern(a,null)),c.set(l,u)}e.fillStyle=u,e.fillRect(n,i,o,s)}(e,h,o,l,u,d),!0;let g=t.boxDrawingDefinitions[n];if(g)return function(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[l,u]of Object.entries(t)){let t;e.beginPath(),e.lineWidth=o*Number.parseInt(l),t=typeof u==`function`?u(.15,.15/a*i):u;for(let l of t.split(` `)){let t=l[0],u=s[t];if(!u){console.error(`Could not find drawing instructions for "${t}"`);continue}let d=l.substring(1).split(`,`);d[0]&&d[1]&&u(e,c(d,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}(e,g,o,l,u,d,p),!0;let _=t.powerlineDefinitions[n];return!!_&&(function(e,t,n,r,i,a,o,l){let u=new Path2D;u.rect(n,r,i,a),e.clip(u),e.beginPath();let d=o/12;e.lineWidth=l*d;for(let o of t.d.split(` `)){let u=o[0],f=s[u];if(!f){console.error(`Could not find drawing instructions for "${u}"`);continue}let p=o.substring(1).split(`,`);p[0]&&p[1]&&f(e,c(p,i,a,n,r,!1,l,(t.leftPadding??0)*(d/2),(t.rightPadding??0)*(d/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,_,o,l,u,d,f,p),!0)};let a=new Map;function o(e,t,n=0){return Math.max(Math.min(e,t),n)}let s={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function c(e,t,n,r,i,a,s,c=0,l=0){let u=e.map((e=>parseFloat(e)||parseInt(e)));if(u.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<u.length;e+=2)u[e]*=t-c*s-l*s,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,t,0)),u[e]+=r+c*s;for(let e=1;e<u.length;e+=2)u[e]*=n,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,n,0)),u[e]+=i;return u}},56:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;let r=n(859);t.observeDevicePixelDimensions=function(e,t,n){let i=new t.ResizeObserver((t=>{let r=t.find((t=>t.target===e));if(!r)return;if(!(`devicePixelContentBoxSize`in r))return i?.disconnect(),void(i=void 0);let a=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)}));try{i.observe(e,{box:[`device-pixel-content-box`]})}catch{i.disconnect(),i=void 0}return(0,r.toDisposable)((()=>i?.disconnect()))}},374:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},509:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;let r=n(237),i=n(860),a=n(374),o=n(160),s=n(345),c=n(485),l=n(385),u=n(147),d=n(855),f={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},p;class m{get pages(){return this._pages}constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new c.FourKeyMap,this._cacheMapCombined=new c.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new s.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new s.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=_(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,a.throwIfFalsy)(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new l.IdleTaskQueue;for(let t=33;t<126;t++)e.enqueue((()=>{if(!this._cacheMap.get(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT)){let e=this._drawToCache(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT);this._cacheMap.set(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT,e)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(m.maxAtlasPages&&this._pages.length>=Math.max(4,m.maxAtlasPages)){let e=this._pages.filter((e=>2*e.canvas.width<=(m.maxTextureSize||4096))).sort(((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width)),t=-1,n=0;for(let r=0;r<e.length;r++)if(e[r].canvas.width!==n)t=r,n=e[r].canvas.width;else if(r-t==3)break;let r=e.slice(t,t+4),i=r.map((e=>e.glyphs[0].texturePage)).sort(((e,t)=>e>t?1:-1)),a=this.pages.length-r.length,o=this._mergePages(r,a);o.version++;for(let e=i.length-1;e>=0;e--)this._deletePage(i[e]);this.pages.push(o),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(o.canvas)}let e=new h(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let n=2*e[0].canvas.width,r=new h(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i)}getRasterizedGlyph(e,t,n,r,i){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i)}_getFromCacheMap(e,t,n,r,i,a=!1){return p=e.get(t,n,r,i),p||(p=this._drawToCache(t,n,r,i,a),e.set(t,n,r,i,p)),p}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return o.NULL_COLOR;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=u.AttributeData.toColorRGB(t);i=o.channels.toColor(e[0],e[1],e[2]);break;default:i=n?o.color.opaque(this._config.colors.foreground):this._config.colors.background}return i}_getForegroundColor(e,t,n,i,a,s,c,l,d,f){let p=this._getMinimumContrastColor(e,t,n,i,a,s,c,d,l,f);if(p)return p;let m;switch(a){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&s<8&&(s+=8),m=this._getColorFromAnsiIndex(s);break;case 50331648:let e=u.AttributeData.toColorRGB(s);m=o.channels.toColor(e[0],e[1],e[2]);break;default:m=c?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(m=o.color.opaque(m)),l&&(m=o.color.multiplyOpacity(m,r.DIM_OPACITY)),m}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,s,c,l,u){if(this._config.minimumContrastRatio===1||u)return;let d=this._getContrastCache(l),f=d.getColor(e,r);if(f!==void 0)return f||void 0;let p=this._resolveBackgroundRgba(t,n,s),m=this._resolveForegroundRgba(i,a,s,c),h=o.rgba.ensureContrastRatio(p,m,this._config.minimumContrastRatio/(l?2:1));if(!h)return void d.setColor(e,r,null);let g=o.channels.toColor(h>>24&255,h>>16&255,h>>8&255);return d.setColor(e,r,g),g}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,n,o,s=!1){let c=typeof e==`number`?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+4,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let d=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=o,this._workAttributeData.isInvisible())return f;let p=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),C=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(h){let e=S;S=w,w=e;let t=C;C=T,T=t}let E=this._getBackgroundColor(T,w,h,_);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let D=p?this._config.fontWeightBold:this._config.fontWeight,O=v?`italic`:``;this._tmpCtx.font=`${O} ${D} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=r.TEXT_BASELINE;let k=c.length===1&&(0,a.isPowerlineGlyph)(c.charCodeAt(0)),A=c.length===1&&(0,a.isRestrictedPowerlineGlyph)(c.charCodeAt(0)),j=this._getForegroundColor(t,T,w,n,C,S,h,_,p,(0,a.treatGlyphAsBackgroundColor)(c.charCodeAt(0)));this._tmpCtx.fillStyle=j.css;let M=A?0:4,N=!1;!1!==this._config.customGlyphs&&(N=(0,i.tryDrawCustomChar)(this._tmpCtx,c,M,M,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let P,F=!k;if(P=typeof e==`number`?this._unicodeService.wcwidth(e):this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())F=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{F=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=M,r=Math.ceil(M+this._config.deviceCharHeight)-t-(s?2*e:0),i=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let s=0;s<P;s++){this._tmpCtx.save();let c=n+s*this._config.deviceCellWidth,u=n+(s+1)*this._config.deviceCellWidth,d=c+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r),this._tmpCtx.moveTo(c,o),this._tmpCtx.lineTo(u,o);break;case 3:let n=e<=1?o:Math.ceil(M+this._config.deviceCharHeight-e/2)-t,s=e<=1?r:Math.ceil(M+this._config.deviceCharHeight+e/2)-t,f=new Path2D;f.rect(c,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(f),this._tmpCtx.moveTo(c-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(c-this._config.deviceCellWidth/2,s,c,s,c,i),this._tmpCtx.bezierCurveTo(c,n,d,n,d,i),this._tmpCtx.bezierCurveTo(d,s,u,s,u,i),this._tmpCtx.bezierCurveTo(u,n,u+this._config.deviceCellWidth/2,n,u+this._config.deviceCellWidth/2,i);break;case 4:let p=l===0?0:l>=e?2*e-l:e-l;!(l>=e)==0||p===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c+p,r),this._tmpCtx.lineTo(u,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(c+p,r),this._tmpCtx.moveTo(c+p+e,r),this._tmpCtx.lineTo(u,r)),l=(0,a.computeNextVariantOffset)(u-c,e,l);break;case 5:let m=u-c,h=Math.floor(.6*m),g=Math.floor(.3*m),_=m-h-g;this._tmpCtx.setLineDash([h,g,_]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r);break;default:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!N&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*P,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(c,M,M+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+t),this._tmpCtx.stroke()}if(N||this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight),c===`_`&&!this._config.allowTransparency){let e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight-t),e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F),e);t++);}if(b){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let I=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),L;if(L=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(I):g(I,E,j,F),L)return f;let R=this._findGlyphBoundingBox(I,this._workBoundingBox,l,A,N,M),z,B;for(;;){if(this._activePages.length===0){let e=this._createNewPage();z=e,B=e.currentRow,B.height=R.size.y;break}z=this._activePages[this._activePages.length-1],B=z.currentRow;for(let e of this._activePages)R.size.y<=e.currentRow.height&&(z=e,B=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=B.height&&R.size.y<=t.height&&(z=this._activePages[e],B=t);if(B.y+R.size.y>=z.canvas.height||B.height>R.size.y+2){let e=!1;if(z.currentRow.y+z.currentRow.height+R.size.y>=z.canvas.height){let t;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+R.size.y<e.canvas.height){t=e;break}if(t)z=t;else if(m.maxAtlasPages&&this._pages.length>=m.maxAtlasPages&&B.y+R.size.y<=z.canvas.height&&B.height>=R.size.y&&B.x+R.size.x<=z.canvas.width)e=!0;else{let t=this._createNewPage();z=t,B=t.currentRow,B.height=R.size.y,e=!0}}e||(z.currentRow.height>0&&z.fixedRows.push(z.currentRow),B={x:0,y:z.currentRow.y+z.currentRow.height,height:R.size.y},z.fixedRows.push(B),z.currentRow={x:0,y:B.y+B.height,height:0})}if(B.x+R.size.x<=z.canvas.width)break;B===z.currentRow?(B.x=0,B.y+=B.height,B.height=0):z.fixedRows.splice(z.fixedRows.indexOf(B),1)}return R.texturePage=this._pages.indexOf(z),R.texturePosition.x=B.x,R.texturePosition.y=B.y,R.texturePositionClipSpace.x=B.x/z.canvas.width,R.texturePositionClipSpace.y=B.y/z.canvas.height,R.sizeClipSpace.x/=z.canvas.width,R.sizeClipSpace.y/=z.canvas.height,B.height=Math.max(B.height,R.size.y),B.x+=R.size.x,z.ctx.putImageData(I,R.texturePosition.x-this._workBoundingBox.left,R.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,R.size.x,R.size.y),z.addGlyph(R),z.version++,R}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=m;class h{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=_(e,t,t),this.ctx=(0,a.throwIfFalsy)(this.canvas.getContext(`2d`,{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function _(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},399:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},385:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(399);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},782:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(133),i=n(855),a=n(147);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},855:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},776:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(859),o=n(97),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},726:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},97:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(726);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.WebglAddon=void 0;let t=n(345),i=n(859),a=n(399),o=n(666),s=n(776);class c extends i.Disposable{constructor(e){if(a.isSafari&&(0,a.getSafariVersion)()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(e){let n=e._core;if(!e.element)return void this.register(n.onWillOpen((()=>this.activate(e))));this._terminal=e;let r=n.coreService,a=n.optionsService,c=n,l=c._renderService,u=c._characterJoinerService,d=c._charSizeService,f=c._coreBrowserService,p=c._decorationService,m=c._logService,h=c._themeService;(0,s.setTraceLogger)(m),this._renderer=this.register(new o.WebglRenderer(e,u,d,f,r,p,a,h,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register((0,i.toDisposable)((()=>{let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}e.WebglAddon=c})(),r})()))})),hd=fd(),gd=pd(),_d=md();function vd(e,t,n=!0){return n?t===`normal`?Math.min(Math.max(0,e),760):Math.min(t===`wide`?1100:1/0,Math.max(0,e-48)):Math.max(0,e)}var yd=/https?:\/\/[^\s"'<>`─-▟]+/g,bd=/[─-▟|]/,xd={")":`(`,"]":`[`,"}":`{`};function Sd(e){let t;try{t=new URL(e.trim())}catch{return null}return t.protocol===`http:`||t.protocol===`https:`?t.href:null}function Cd(e,t){let n=e[e.length-1],r=t[0];return!!n&&!!r&&n!==` `&&r!==` `&&!bd.test(n)&&!bd.test(r)}function wd(e){for(;;){let t=e[e.length-1];if(`.,;:!?'"`.includes(t))e=e.slice(0,-1);else if(xd[t]&&e.split(xd[t]).length<=e.split(t).length-1)e=e.slice(0,-1);else return e}}function Td(e){let t=[];for(let n of e.matchAll(yd)){let e=wd(n[0]);Sd(e)&&e.length>8&&t.push({start:n.index,end:n.index+e.length,url:e})}return t}function Ed(e,t,n=()=>!1){if(!e[t])return[];let r=t=>n(t+1)||Cd(e[t],e[t+1]??``),i=t;for(;i>0&&r(i-1);)i--;let a=t;for(;a<e.length-1&&r(a);)a++;let o=[],s=``;for(let t=i;t<=a;t++)o.push(s.length),s+=e[t];let c=e=>{let t=o.length-1;for(;t>0&&o[t]>e;)t--;return{row:i+t,col:e-o[t]}};return Td(s).map(e=>({url:e.url,start:c(e.start),end:c(e.end-1)})).filter(e=>e.start.row<=t&&e.end.row>=t).map(e=>({...e,end:{row:e.end.row,col:e.end.col+1}}))}function Dd(e,t){let n=``;for(let r=0;r<t;r++){let t=e?.getCell(r)?.getChars()||` `;n+=t.length===1?t:` `}return n}function Od(e){let t=e.buffer.active,n=[];for(let r=0;r<t.length;r++)n.push(Dd(t.getLine(r),e.cols));return n}var kd=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),Ad=()=>typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches;function jd(e,t,n){return!t||(n?e.metaKey:e.ctrlKey)}function Md(e){let t=Sd(e);return t?(window.open(t,`_blank`,`noopener,noreferrer`),!0):!1}function Nd(e,t){let n=kd(),r=Ad(),i=e=>`${e}\n${t(n?`⌘+click to open`:`Ctrl+click to open`)}`,a=!1,o=(e,t)=>{jd(e,r,n)&&(a=Md(t)||a)},s=()=>e.element?.querySelector(`.xterm-screen`),c=(e,t)=>{let n=s();n&&r&&Sd(t)&&(n.title=i(t))},l=()=>{let e=s();e&&e.removeAttribute(`title`)},u={activate:o,hover:c,leave:l,allowNonHttpProtocols:!1};e.options.linkHandler=u;let d=e.registerLinkProvider({provideLinks(t,n){let r=Od(e),i=e.buffer.active,a=Ed(r,t-1,e=>!!i.getLine(e)?.isWrapped);n(a.length?a.map(e=>({text:e.url,range:{start:{x:e.start.col+1,y:e.start.row+1},end:{x:e.end.col,y:e.end.row+1}},activate:t=>o(t,e.url),hover:t=>c(t,e.url),leave:l})):void 0)}});return{tap:(t,n)=>{let r=s();if(!r)return!1;a=!1;let i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:n,button:0};for(let e of[`mousemove`,`mousedown`,`mouseup`])r.dispatchEvent(new MouseEvent(e,{...i,buttons:+(e===`mousedown`)}));return e.element?.dispatchEvent(new MouseEvent(`mouseleave`,i)),e.clearSelection(),a},dispose(){d.dispose(),l()}}}function Pd(e){return e.key.toLowerCase()===`c`&&!e.altKey&&(e.metaKey||e.ctrlKey&&e.shiftKey)}function Fd(e,t,n){return e.button!==0||!e.shiftKey||e.altKey?null:n?t?{shiftKey:!1,altKey:!0}:null:{shiftKey:!1,altKey:!1}}function Id(e){return e.replace(/[ \t]+$/gm,``)}function Ld(e,t,n=()=>!1){let r=e.split(`
74
- `);return r.length===t.length?r.reduce((e,r,i)=>i===0?r:e+(n(i)||Cd(t[i-1],t[i])?``:`
75
- `)+r,``):e}function Rd(e){let t=e.getSelection(),n=e.getSelectionPosition();if(!n)return Id(t);let r=Math.min(n.start.y,n.end.y),i=Math.max(n.start.y,n.end.y),a=e.buffer.active;return Id(Ld(t,Od(e).slice(r,i+1),e=>!!a.getLine(r+e)?.isWrapped))}function zd(e,t=globalThis.navigator?.clipboard){if(!e||!t?.writeText)return Promise.resolve(!1);try{return t.writeText(e).then(()=>!0,()=>!1)}catch{return Promise.resolve(!1)}}var Bd=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent);function Vd(e,t){let n=e.element;if(!n)return()=>{};let r=Bd(),i=()=>{e.hasSelection()&&zd(Rd(e)).then(e=>e&&t?.())},a=t=>{Pd(t)&&e.hasSelection()&&(t.preventDefault(),t.stopPropagation(),i())},o=()=>i(),s=t=>{t.button===0&&window.addEventListener(`mouseup`,o,{capture:!0,once:!0});let n=Fd(t,r,e.modes.mouseTrackingMode!==`none`);n&&(t.preventDefault(),t.stopImmediatePropagation(),t.target?.dispatchEvent(new MouseEvent(`mousedown`,{bubbles:!0,cancelable:!0,composed:!0,view:window,detail:t.detail,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:t.button,buttons:t.buttons,ctrlKey:t.ctrlKey,metaKey:t.metaKey,...n})))};return n.addEventListener(`keydown`,a,!0),n.addEventListener(`mousedown`,s,!0),()=>{window.removeEventListener(`mouseup`,o,{capture:!0}),n.removeEventListener(`keydown`,a,!0),n.removeEventListener(`mousedown`,s,!0)}}function Hd(e=globalThis.navigator){let t=e?.userAgentData?.platform||e?.platform||``;return/^(mac|iphone|ipad|ipod|ios)/i.test(t)}function Ud(e){let t=e.key.toLowerCase();return t===`v`||e.code===`KeyV`&&!/^[a-z]$/.test(t)}function Wd(e,t){if(e.isComposing)return`xterm`;let n=e.ctrlKey||e.altKey||e.metaKey;return e.key===`Enter`&&e.shiftKey&&!n?`shift+enter`:e.key===`F12`&&!e.shiftKey&&!n||!t&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&Ud(e)?`browser`:`xterm`}function Gd(e,t,n=Hd()){e.attachCustomKeyEventHandler(e=>{let r=Wd(e,n);return r===`xterm`||(r===`shift+enter`&&e.type===`keydown`&&(e.preventDefault(),t(`shift+enter`)),!1)})}function Kd(e){return!e||e.getData(`text/plain`)?[]:[...e.items||[]].filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e)}function qd(e,t){async function n(e){let n=[];for(let r of e)try{n.push(await t.upload(r))}catch(e){t.report(`${Q(`Photo upload failed`)} : ${e.message}`)}n.length&&!t.paste(n.join(` `))&&t.report(Q(`Terminal not connected — image not pasted`))}let r=e=>{let r=Kd(e.clipboardData);!r.length||t.enabled&&!t.enabled()||(e.preventDefault(),e.stopPropagation(),n(r))};return e.addEventListener(`paste`,r,!0),()=>e.removeEventListener(`paste`,r,!0)}var Jd=1e5,Yd=/^[cpqs0-7]*$/,Xd=/^[A-Za-z0-9+/]*={0,2}$/;function Zd(e){let t=e.endsWith(`==`)?2:+!!e.endsWith(`=`);return Math.floor(e.length*3/4)-t}function Qd(e,t=Jd){let n=e.indexOf(`;`);if(n<0||!Yd.test(e.slice(0,n)))return{kind:`invalid`};let r=e.slice(n+1).replace(/\s+/g,``);if(r===`?`)return{kind:`read`};if(!r||r.length%4==1||!Xd.test(r))return{kind:`invalid`};let i=Zd(r);if(i>t)return{kind:`too-large`,bytes:i};let a;try{a=atob(r)}catch{return{kind:`invalid`}}let o=new TextDecoder().decode(Uint8Array.from(a,e=>e.charCodeAt(0)));return o?{kind:`write`,text:o}:{kind:`invalid`}}async function $d(e,t,n){try{if(!t)throw Error(`no clipboard`);return await t.writeText(e),n.copied(),!0}catch{return n.refused(e),!1}}function ef(e,t){let n=e.parser.registerOscHandler(52,e=>{if(!t.enabled())return!0;let n=Qd(e,t.maxBytes);return n.kind===`write`?t.write(n.text):n.kind===`too-large`&&t.tooLarge(n.bytes),!0});return()=>n.dispose()}async function tf(e){let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=n,r.src=t}),n=Math.min(1,2048/Math.max(e.naturalWidth,e.naturalHeight)),r=document.createElement(`canvas`);r.width=Math.round(e.naturalWidth*n),r.height=Math.round(e.naturalHeight*n);let i=r.getContext(`2d`);i.fillStyle=`#fff`,i.fillRect(0,0,r.width,r.height),i.drawImage(e,0,0,r.width,r.height);let a=await new Promise(e=>r.toBlob(e,`image/jpeg`,.86));if(a)return a}catch{}finally{URL.revokeObjectURL(t)}return e}async function nf(e,t){let n=await tf(t),r=await fetch(`/api/upload?pane=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":n.type||`image/jpeg`},body:n}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(Q(i.error||`HTTP ${r.status}`));return{path:i.path,name:i.name}}function rf(e){return e.code===`unreachable`?Z(`${e.machine||`Machine`} unreachable`,`${e.machine||`Machine`} injoignable`):e.code===`unknown_machine`?Z(`unknown machine`,`machine inconnue`):Q(e.reason||``)}function af(e){return e?Z(`Terminal unavailable: ${e}`,`Terminal indisponible : ${e}`):Q(`Terminal unavailable`)}function of(e,t,n,r,i){return n.width<=0||n.height<=0||r<=0||i<=0?null:{column:Math.max(0,Math.min(r-1,Math.floor((e-n.left)*r/n.width))),row:Math.max(0,Math.min(i-1,Math.floor((t-n.top)*i/n.height)))}}function sf(e,t,n){let r=e.element,i=null,a=null,o=null,s=0,c=(t,n)=>{let i=r.querySelector(`.xterm-screen`)?.getBoundingClientRect();return i?of(t,n,i,e.cols,e.rows):null},l=(e,t,n)=>{let r=c(e.clientX,e.clientY);return r&&{type:`terminal.mouse`,action:t,button:n,...r,modifiers:+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)}},u=()=>{cancelAnimationFrame(s),s=0,o&&t()&&n(o),o=null},d=r=>{if(!t()||r.pointerType===`touch`||r.shiftKey||r.ctrlKey||r.metaKey||r.button>2)return;let o=[`left`,`middle`,`right`][r.button],s=l(r,`down`,o);s&&(r.preventDefault(),r.stopPropagation(),i=o,a=r.pointerId,e.clearSelection(),e.focus(),n(s))},f=e=>{!t()||e.pointerType===`touch`||e.shiftKey||e.ctrlKey||e.metaKey||(i?e.pointerId!==a:!r.contains(e.target))||(o=l(e,i?`drag`:`move`,i||`left`),s||=requestAnimationFrame(u))},p=e=>{if(!i||e.pointerId!==a)return;u();let r=l(e,`up`,i);i=null,a=null,r&&t()&&n(r)},m=e=>{t()&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&e.preventDefault()};return r.addEventListener(`contextmenu`,m),r.addEventListener(`pointerdown`,d,!0),window.addEventListener(`pointermove`,f,!0),window.addEventListener(`pointerup`,p,!0),window.addEventListener(`pointercancel`,p,!0),{tap(e,r){let i=t()&&c(e,r);if(i)for(let e of[`down`,`up`])n({type:`terminal.mouse`,action:e,button:`left`,...i,modifiers:0})},dispose(){cancelAnimationFrame(s),r.removeEventListener(`contextmenu`,m),r.removeEventListener(`pointerdown`,d,!0),window.removeEventListener(`pointermove`,f,!0),window.removeEventListener(`pointerup`,p,!0),window.removeEventListener(`pointercancel`,p,!0)}}}var cf=`"Wherdr Symbols", "JetBrains Mono Variable", "JetBrains Mono", "Wherdr Nerd Symbols", ui-monospace, "SF Mono", Menlo, monospace`;function lf(e){let t=typeof document<`u`?document.fonts:void 0;return t?.addEventListener?(t.addEventListener(`loadingdone`,e),()=>t.removeEventListener(`loadingdone`,e)):()=>{}}function uf(e,t){let n=null,r=null,i=null,a=null,o=null,s=0,c,l=!1,u={cols:0,rows:0},d=!1,f=h(!1),p=h(!1),m=dd(),g=null,_=null,v=null,y=null,b=null,x=null,S=!1,C=()=>`${location.protocol===`https:`?`wss`:`ws`}://${location.host}`;function w(i){a=i,d=!1,s=0,n=new hd.Terminal({fontFamily:cf,fontSize:ir.value,lineHeight:1,scrollback:0,cursorBlink:!1,allowProposedApi:!0,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:le.value}),r=new gd.FitAddon,n.loadAddon(r),n.open(i),x=sf(n,()=>S&&t.input?.()!==!1,e=>T(e)),g=Vd(n,()=>$(Q(`Copied`))),b=Nd(n,Q),_=qd(i,{upload:async t=>(await nf(e,t)).path,paste:e=>T({type:`paste`,text:e}),report:e=>$(e,!0)}),v=ef(n,{enabled:()=>xi.value,write:e=>$d(e,navigator.clipboard,{copied:()=>$(Q(`The agent copied text`)),refused:e=>Pr(Q(`The agent copied text — tap to copy`),Q(`Copy`),()=>{$d(e,navigator.clipboard,{copied:()=>$(Q(`Copied`)),refused:()=>$(Q(`Copy failed`),!0)})})}),tooLarge:e=>$(Z(`Agent copy ignored: ${fs(e)} (limit ${fs(Jd)})`,`Copie de l’agent ignorée : ${fs(e)} (limite ${fs(Jd)})`))}),O(ei.value);let o=n;Promise.all([document.fonts?.load(`${ir.value}px "JetBrains Mono Variable"`),document.fonts?.load(`${ir.value}px "Wherdr Symbols"`,`─▀█⎿⏵⏺✻✳`)]).then(()=>{d||n!==o||(o.options.fontFamily=cf,D(!0),o.refresh(0,o.rows-1))}).catch(()=>{}),y=lf(()=>{d||n!==o||(o.clearTextureAtlas(),o.refresh(0,o.rows-1))});let c=n.textarea;c&&(c.setAttribute(`autocorrect`,`off`),c.setAttribute(`autocapitalize`,`off`),c.setAttribute(`spellcheck`,`false`),c.addEventListener(`blur`,()=>{p.value=!1}),c.addEventListener(`focus`,()=>{p.value=!0})),n.attachCustomWheelEventHandler(()=>!1),Gd(n,e=>E([e])),n.onData(e=>{t.input?.()!==!1&&T({type:`terminal.input`,text:e})}),n.onBinary(e=>{if(t.input?.()===!1)return;let n=Uint8Array.from(e,e=>e.charCodeAt(0)&255);T({type:`terminal.input`,bytes:fr(n)})})}function T(e){return o&&o.readyState===1?(o.send(JSON.stringify(e)),!0):!1}async function E(t){if(!T({type:`keys`,keys:t}))try{await fi(`/api/input`,{pane_id:e,keys:t}),X()}catch(e){$(e.message,!0)}}function D(e){if(!n||!r||!a||!a.parentElement)return;let i=matchMedia(bi).matches&&!t.fill?.();a.style.width=i?`${vd(a.parentElement.clientWidth,ji.value)}px`:``;let o=r.proposeDimensions();if(!o||!o.cols||!o.rows)return;let s={cols:o.cols,rows:o.rows};(s.cols!==n.cols||s.rows!==n.rows)&&n.resize(s.cols,s.rows),e&&(s.cols!==u.cols||s.rows!==u.rows)&&T({type:`terminal.resize`,cols:s.cols,rows:s.rows})&&(u={cols:s.cols,rows:s.rows})}B(le,e=>{n&&(n.options.theme=e)}),B(ji,()=>P(()=>D(!0)));function O(e){if(n){if(i){let e=i;i=null,e.dispose()}if(e===`webgl`){let e=null;try{e=new _d.WebglAddon;let t=e;e.onContextLoss(()=>{i===t&&(i=null,t.dispose(),Zr(`html-fallback`),D(!0))}),n.loadAddon(e),i=e,Zr(`webgl`)}catch{try{e?.dispose()}catch{}Zr(`html-fallback`)}}else Zr(`html`);D(!0)}}B(ei,O);function k(e){n&&(n.options.fontSize=e,D(!0))}function A(r){if(d||!n)return;if(clearTimeout(c),o){o.onclose=null;try{o.close(1e3)}catch{}}D(!1);let i=new URLSearchParams({pane:e,cols:String(n.cols),rows:String(n.rows)});r&&i.set(`takeover`,`1`),S=!1,f.value=!0,l=!0;let a=null,p=!1,h=``,g=new WebSocket(`${C()}/ws/term?${i}`);o=g,g.onopen=()=>{n&&(u={cols:n.cols,rows:n.rows}),g.send(JSON.stringify({type:`visibility`,visible:!document.hidden}))},g.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type===`web.capabilities`)S=t.mouse===!0;else if(t.type===`terminal.frame`){if(p||(p=!0,s=0),f.value=!1,!n)return;t.width&&t.height&&(t.width!==n.cols||t.height!==n.rows)&&n.resize(t.width,t.height);let e=n;e.write(or(t.bytes||``),()=>m.refresh(e,S))}else t.type===`terminal.closed`?a=rf(t):t.type===`herdr.stderr`?/^run 'herdr --help'/.test(t.message)||(h=t.message):t.type===`web.error`&&$(t.message,!0)},g.onclose=()=>{if(o===g&&(o=null,S=!1,f.value=!1,l&&!d)){if(a&&/already has an attached client/.test(a))return t.setBanner({text:Q(`This terminal is already open elsewhere.`),btn:Q(`Take control`),fn:()=>{t.setBanner(null),A(!0)}});if(a&&/taken over/.test(a))return t.setBanner({text:Q(`Another client took control.`),btn:Q(`Take back control`),fn:()=>{t.setBanner(null),A(!0)}});if((Qr.value||!wr.value.ok)&&!document.hidden){if(!p&&s>=3){s=0;let e=h||a;return t.setBanner({text:af(e),btn:Q(`Retry`),fn:()=>{t.setBanner(null),A(!1)}})}c=setTimeout(()=>A(!1),Math.min(6e3,400*2**s++))}}}}function j(){if(S=!1,l=!1,clearTimeout(c),o){let e=o;o=null;try{e.close(1e3)}catch{}}}let M=()=>!!(o&&o.readyState<=1);function N(){n?.reset()}function F(){n?.focus(),p.value=!0}function I(){n?.textarea?.blur()}let L=(e,t)=>b?.tap(e,t)??!1,R=()=>!!(n&&document.activeElement===n.textarea),z=()=>n&&n.rows&&a?a.clientHeight/n.rows:16,V=()=>n?.rows||24;function H(e){return T({type:`terminal.scroll`,direction:e>0?`up`:`down`,lines:Math.abs(e)})}function U(e){T({type:`visibility`,visible:e}),e&&P(()=>D(!0))}function ee(){d=!0,j(),g?.(),_?.(),v?.(),v=null,y?.(),y=null,g=null,_=null,x?.dispose(),x=null,b?.dispose(),b=null,i=null,n?.dispose(),n=null}return{mount:w,connect:A,disconnect:j,isConnected:M,sendTerm:T,sendKeys:E,fitNow:D,setFontSize:k,reset:N,scroll:H,focus:F,blur:I,tapLink:L,tapMouse:(e,t)=>x?.tap(e,t),hasFocus:R,rowHeight:z,pageRows:V,setVisible:U,dispose:ee,loading:f,kbdOn:p,hasBanner:t.hasBanner,selectionHint:m}}var df={key:0},ff={class:`interactive-terminal-note`},pf={key:0,class:`term-banner`},mf=Object.assign(T({__name:`InteractiveTerminal`,props:{paneId:{},active:{type:Boolean},title:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=u(null),o=uf(n.paneId,{setBanner:e=>{i.value=e},hasBanner:()=>!!i.value,fill:()=>!0,input:()=>n.active});B(Hr,e=>o.setVisible(e));let s=!1;function c(){if(!s||!Mr.value||o.hasFocus())return;let e=document.activeElement;e instanceof HTMLElement&&e.closest(`.interactive-terminal`)&&e.matches(`button, input, textarea`)||o.focus()}function l(e){e.preventDefault(),s=!0,e.currentTarget?.focus(),setTimeout(c,50)}B(()=>o.loading.value,e=>{e||P(c)});let d={onOpenAutoFocus:l,onEscapeKeyDown:e=>e.preventDefault()},p={overlay:`hw-scrim interactive-terminal-scrim`,content:`interactive-terminal`};return(t,n)=>{let s=Je,c=Et,l=rd,u=sd,h=Un;return _(),m(h,{open:``,title:(`tl`in t?t.tl:f(Z))(`Interactive terminal`,`Terminal interactif`),content:d,ui:p,"onUpdate:open":n[5]||=e=>e||r(`close`)},{content:H(()=>[I(`header`,{class:`interactive-terminal-head`,onKeydown:n[1]||=q(()=>{},[`stop`])},[I(`span`,null,[E(s,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Z))(`Interactive terminal`,`Terminal interactif`)),1),e.title?(_(),v(`small`,df,M(e.title),1)):g(``,!0)]),E(c,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,"aria-label":(`tl`in t?t.tl:f(Z))(`Close terminal window`,`Fermer la fenêtre terminal`),onClick:n[0]||=e=>r(`close`)},null,8,[`aria-label`])],32),I(`p`,ff,M((`tl`in t?t.tl:f(Z))(`Live agent screen · closes when the message field returns`,`Écran réel de l’agent · se ferme au retour du champ libre`)),1),f(i)?(_(),v(`div`,pf,[I(`span`,null,M(f(i).text),1),E(c,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[2]||=e=>f(i).fn()},{default:H(()=>[a(M(f(i).btn),1)]),_:1})])):g(``,!0),E(l,{ctl:f(o),onKeydown:n[3]||=q(()=>{},[`stop`])},null,8,[`ctl`]),E(u,{ctl:f(o),"all-digits":``,onKeydown:n[4]||=q(()=>{},[`stop`])},null,8,[`ctl`])]),_:1},8,[`title`])}}}),{__name:`InteractiveTerminal`}),hf={class:`prompt-detail-head`},gf={class:`prompt-detail-tool`},_f={key:0,class:`prompt-detail-desc`},vf={key:0,class:`prompt-detail-file`},yf={class:`path`},bf={key:0,class:`prompt-detail-stats`},xf={key:0,class:`add`},Sf={key:1,class:`del`},Cf={key:2,class:`prompt-detail-note`},wf=Object.assign(T({__name:`PromptDetailBlock`,props:{detail:{}},setup(e){let t=e,r=h(!1);B(()=>t.detail.command,()=>{r.value=!1});let i=n(()=>(t.detail.command||``).split(`
76
- `)),o=n(()=>i.value.length>8||(t.detail.command||``).length>800),s=n(()=>Tn(t.detail));return(t,n)=>{let c=Je;return _(),v(`div`,{class:j([`prompt-detail`,{file:e.detail.file}])},[I(`p`,hf,[I(`span`,gf,M(e.detail.tool),1),e.detail.description?(_(),v(`span`,_f,M(e.detail.description),1)):g(``,!0)]),e.detail.file?(_(),v(`p`,vf,[E(c,{name:`i-lucide-file-pen`}),I(`span`,yf,M(e.detail.file),1),f(s)?(_(),v(`span`,bf,[e.detail.added?(_(),v(`span`,xf,`+`+M(e.detail.added),1)):g(``,!0),e.detail.removed?(_(),v(`span`,Sf,`−`+M(e.detail.removed),1)):g(``,!0)])):g(``,!0)])):g(``,!0),e.detail.command?(_(),v(`pre`,{key:1,class:j([`prompt-detail-code`,{collapsed:f(o)&&!f(r)}])},[I(`code`,null,[(_(!0),v(k,null,y(f(i),(n,r)=>(_(),v(`span`,{key:r,class:j((`diffKind`in t?t.diffKind:f(Ut))(n,!!e.detail.file))},M(n),3))),128))])],2)):g(``,!0),e.detail.truncated?(_(),v(`p`,Cf,M((`t`in t?t.t:f(Q))(`Too long: only the beginning is shown. The terminal shows the rest.`)),1)):g(``,!0),f(o)?(_(),v(`button`,{key:3,type:`button`,class:`prompt-detail-more`,onClick:n[0]||=e=>r.value=!f(r)},[E(c,{name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),a(` `+M(f(r)?(`t`in t?t.t:f(Q))(`Collapse`):(`tl`in t?t.tl:f(Z))(`Show all (${f(i).length} lines)`,`Tout afficher (${f(i).length} lignes)`)),1)])):g(``,!0)],2)}}}),{__name:`PromptDetailBlock`}),Tf={class:`eyebrow choices-eyebrow`},Ef=[`aria-label`],Df=[`aria-current`,`disabled`,`onClick`],Of={key:2,class:`choices-q`},kf={key:3,class:`choices-note`,role:`status`},Af={key:4,class:`choices-note`},jf=[`aria-pressed`,`aria-expanded`,`disabled`,`onClick`],Mf={key:0,class:`n`},Nf={key:1,class:`n`},Pf={class:`l`},Ff={key:0},If=[`onSubmit`],Lf={class:`choices-free-actions`},Rf=[`disabled`],zf={key:7,class:`choices-keys`},Bf=[`disabled`],Vf=[`disabled`,`onClick`],Hf={key:1,class:`card-kbd`,"aria-hidden":`true`},Uf={key:0},Wf=Object.assign(T({__name:`ChoicesPanel`,props:{paneId:{},prompt:{},screen:{},keys:{type:Boolean}},setup(e){let t=e,r=h(!1),i=h(t.prompt?.cursor),o=0;B(()=>t.prompt,(e,t)=>{o&&e&&t&&e.cursor===t.cursor&&e.identity===t.identity||(i.value=e?.cursor)}),B(()=>[t.prompt,t.screen],()=>{r.value=!1});let s=n(()=>t.screen?t.screen.actions.filter(e=>!(t.prompt&&e.key===`enter`)):[]),c=n(()=>t.screen?er(t.screen.kind):null),l=n(()=>!!(t.screen&&t.screen.lines.some(e=>/\S {3,}\S/.test(e)))),u=n(()=>t.prompt?.kind===`self-update`?Q(t.prompt.question||``):t.screen&&t.screen.title||t.prompt&&t.prompt.question);async function d(e,n){r.value=!0,await ge(t.paneId,e,n,t.prompt?.identity)||(r.value=!1)}async function p(e){r.value=!0,await Ce(t.paneId,e,t.screen?.identity)||(r.value=!1)}let b=n(()=>t.prompt?.kind===`self-update`);async function x(){r.value=!0,await Me(t.paneId)||(r.value=!1)}async function S(){r.value=!0,await Ne(t.paneId,`enter`,t.prompt?.identity)||(r.value=!1)}let C=n(()=>!!(t.prompt&&t.prompt.options.some(e=>e.checked===void 0))),w=n(()=>t.prompt&&t.prompt.tabs&&t.prompt.tab!==void 0&&!t.prompt.typing?t.prompt.tabs:null);async function T(e){let n=t.prompt;n&&n.tabs&&e!==n.tab&&!z.value&&(r.value=!0,await ke(t.paneId,e,n.tabs[e])?O.value=``:r.value=!1)}let D=h(null),O=h(``),A=h(!1),N=n(()=>t.prompt?.typing?t.prompt.options.findIndex(e=>e.free):D.value);B(()=>t.prompt?.question,()=>{D.value=null});let P=n(()=>Mr.value&&!Br&&!Wr);async function F(e,n){let i=O.value.trim();if(!(!i||z.value||A.value)){r.value=!0,A.value=!0;try{await ge(t.paneId,e,n,t.prompt?.identity,{text:i,question:t.prompt?.question??null})?(O.value=``,D.value=null):r.value=!1}finally{A.value=!1}}}function L(){t.prompt?.typing?Ne(t.paneId,`esc`):D.value=null}function R(e,t,n){e.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),L()):e.key===`Enter`&&!e.shiftKey&&P.value&&(e.preventDefault(),F(t,n)))}let z=n(()=>r.value||t.prompt?.unavailable||t.screen?.unavailable||!Fr.value||mr.value),V=n(()=>!!(t.keys&&Mr.value&&t.prompt&&!t.prompt.kind&&t.prompt.options.length&&N.value===null&&!z.value));return Ze(()=>V.value,()=>({digits:Math.min(9,t.prompt?.options.length||0),enter:!0,tabs:!!w.value}),e=>{let n=t.prompt;if(n){if(e.kind===`digit`){let t=n.options[e.n-1];t.free?D.value=e.n-1:d(e.n-1,t.label);return}if(e.kind===`tab`)return Ne(t.paneId,e.dir>0?`right`:`left`);e.kind===`nav`&&((e.key===`up`||e.key===`down`)&&i.value!==null&&i.value!==void 0&&(i.value=Math.max(0,Math.min(n.options.length-1,i.value+(e.key===`down`?1:-1)))),o++,Ne(t.paneId,e.key,n.identity).then(e=>{o--,e||(i.value=t.prompt?.cursor)}))}}),(t,n)=>{let r=wf,o=Je,h=vn,P=Et;return _(),v(`div`,{class:j([`choices`,{"choices-screen":e.screen}])},[I(`p`,Tf,[n[1]||=I(`i`,null,null,-1),a(M((`t`in t?t.t:f(Q))(`Your turn`)),1)]),f(w)?(_(),v(`div`,{key:0,class:`choices-tabs`,role:`group`,"aria-label":(`t`in t?t.t:f(Q))(`Questions`)},[(_(!0),v(k,null,y(f(w),(t,n)=>(_(),v(`button`,{key:n,type:`button`,class:j({on:n===e.prompt.tab}),"aria-current":n===e.prompt.tab?`step`:void 0,disabled:f(z),onClick:e=>T(n)},M(t),11,Df))),128))],8,Ef)):g(``,!0),e.prompt?.detail?(_(),m(r,{key:1,detail:e.prompt.detail},null,8,[`detail`])):g(``,!0),f(u)?(_(),v(`p`,Of,M(f(u)),1)):g(``,!0),e.prompt?.unavailable||e.screen?.unavailable?(_(),v(`p`,kf,M((`tl`in t?t.tl:f(Z))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),f(c)?(_(),v(`p`,Af,M(f(c)),1)):g(``,!0),e.screen&&e.screen.lines.length&&!e.prompt?.detail?(_(),v(`pre`,{key:5,class:j([`choices-screen-text`,{wrap:!f(l)}])},M(e.screen.lines.join(`
77
- `)),3)):g(``,!0),e.prompt?(_(),v(`div`,{key:6,class:j([`choices-list`,{multi:e.prompt.multi}])},[(_(!0),v(k,null,y(e.prompt.options,(r,s)=>(_(),v(k,{key:s},[I(`button`,{type:`button`,class:j({cur:s===f(i),on:r.checked}),"aria-pressed":e.prompt.multi&&!r.free?!!r.checked:void 0,"aria-expanded":r.free?f(N)===s:void 0,disabled:f(z),onClick:t=>r.free?D.value=e.prompt.typing||f(D)===s?null:s:d(s,r.label)},[e.prompt.multi&&r.checked!==void 0?(_(),v(`span`,Mf,[E(o,{name:r.checked?`i-lucide-square-check`:`i-lucide-square`},null,8,[`name`])])):(_(),v(`span`,Nf,M(s+1),1)),I(`span`,Pf,[a(M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Q))(r.label):r.label),1),r.hint?(_(),v(`small`,Ff,M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Q))(r.hint):r.hint),1)):g(``,!0)]),r.free?(_(),m(o,{key:2,name:`i-lucide-pencil-line`,class:`choices-free-icon`})):g(``,!0)],10,jf),r.free&&f(N)===s?(_(),v(`form`,{key:0,class:`choices-free`,onSubmit:q(e=>F(s,r.label),[`prevent`])},[E(h,{modelValue:f(O),"onUpdate:modelValue":n[0]||=e=>W(O)?O.value=e:null,rows:1,maxrows:6,autoresize:``,autofocus:!e.prompt.typing,size:`lg`,class:`w-full`,placeholder:(`t`in t?t.t:f(Q))(`Your answer…`),disabled:f(z)||f(A),onKeydown:e=>R(e,s,r.label)},null,8,[`modelValue`,`autofocus`,`placeholder`,`disabled`,`onKeydown`]),I(`div`,Lf,[E(P,{type:`button`,color:`neutral`,variant:`ghost`,size:`sm`,disabled:f(z)||f(A),onClick:L},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Cancel`)),1)]),_:1},8,[`disabled`]),E(P,{type:`submit`,color:`primary`,variant:`solid`,size:`sm`,loading:f(A),disabled:f(z)||f(A)||!f(O).trim()},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Send`)),1)]),_:1},8,[`loading`,`disabled`])])],40,If)):g(``,!0)],64))),128)),e.prompt.multi&&!f(C)?(_(),v(`button`,{key:0,type:`button`,class:`choices-next`,disabled:f(z),onClick:S},[a(M((`t`in t?t.t:f(Q))(`Continue`)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Nr))(`enter`)),1)],8,Rf)):g(``,!0)],2)):g(``,!0),f(s).length||f(V)||f(b)?(_(),v(`div`,zf,[f(b)?(_(),v(`button`,{key:0,type:`button`,disabled:f(z),onClick:x},M((`t`in t?t.t:f(Q))(`Dismiss`)),9,Bf)):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(z),onClick:t=>p(e)},[a(M((`screenActionText`in t?t.screenActionText:f(Ii))(e)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Nr))(e.key)),1)],8,Vf))),128)),f(V)?(_(),v(`span`,Hf,[f(w)?(_(),v(`kbd`,Uf,`←→`)):g(``,!0),n[2]||=I(`kbd`,null,`↑↓`,-1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Nr))(`enter`)),1),I(`kbd`,null,`1–`+M(Math.min(9,e.prompt.options.length)),1)])):g(``,!0)])):g(``,!0)],2)}}}),{__name:`ChoicesPanel`}),Gf={class:`choices choices-menu`},Kf={class:`eyebrow choices-eyebrow`},qf={class:`menu-kind`},Jf={key:0,class:`choices-note`,role:`status`},Yf={key:1,class:`choices-q`},Xf={key:2,class:`choices-note`},Zf={key:3,class:`choices-note`},Qf=[`placeholder`,`aria-label`,`disabled`],$f={key:0,class:`menu-group`},ep=[`aria-current`,`disabled`,`onClick`],tp={class:`n`,"aria-hidden":`true`},np={class:`l`},rp={key:0},ip={key:0,class:`menu-more`},ap={key:0,class:`choices-screen-text wrap`},op={class:`choices-note`},sp={class:`choices-keys`},cp=[`disabled`,`onClick`],lp={key:0,class:`card-kbd`,"aria-hidden":`true`},up={key:0},dp=Object.assign(T({__name:`MenuPanel`,props:{paneId:{},menu:{},keys:{type:Boolean}},emits:[`terminal`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=h(r.menu.cursor),c=n(()=>s.value===null?r.menu.identity:r.menu.items[s.value]?.identity),l=h(null),u=()=>P(()=>l.value?.querySelector(`.cur`)?.scrollIntoView({block:`nearest`})),d=0;B(()=>r.menu,(e,t)=>{o.value=!1,!(d&&t&&e.cursor===t.cursor&&e.identity===t.identity)&&(s.value=e.cursor,u())}),w(u);let p=n(()=>o.value||r.menu.unavailable||!Fr.value||mr.value),m=n(()=>tt(r.menu)),b=n(()=>r.menu.actions.filter(e=>!(e.key===`enter`&&r.menu.cursor!==null&&!m.value))),x=n(()=>r.menu.items.length>0);async function S(e,t){o.value=!0,await Ae(r.paneId,{op:`select`,index:e,label:t},r.menu.items[e]?.identity)||(o.value=!1)}async function C(e){o.value=!0,await Ae(r.paneId,{op:`key`,key:e.key,label:e.label},c.value)||(o.value=!1)}let T=h(r.menu.search||``),D=h(!1);B(()=>r.menu.search,e=>{D.value||(T.value=e||``)});let O=null;function A(){D.value=!0,O&&clearTimeout(O),O=setTimeout(N,450)}async function N(){O&&=(clearTimeout(O),null);let e=T.value;e!==(r.menu.search||``)&&await Ae(r.paneId,{op:`search`,text:e},r.menu.identity),D.value=!1}U(()=>{O&&clearTimeout(O)});let F=h(null),R=n(()=>r.menu.actions.some(e=>e.key===`esc`)),z=n(()=>r.menu.actions.filter(e=>/^ctrl\+[a-z]$/.test(e.key)).map(e=>e.key)),V=n(()=>!!(r.keys&&Mr.value&&x.value&&!p.value));return Ze(()=>!!(r.keys&&Mr.value&&!p.value&&(x.value||z.value.length)),()=>({digits:0,enter:!m.value,own:F.value,ctrl:z.value,nav:V.value}),e=>{if(e.kind===`ctrl`){let t=r.menu.actions.find(t=>t.key===e.key);t&&C(t);return}if(!(e.kind!==`nav`||e.key===`esc`&&!R.value)){if(e.key===`up`||e.key===`down`){let t=r.menu.items.map((e,t)=>e.header?-1:t).filter(e=>e>=0),n=t.indexOf(s.value??-1);s.value=t[n+(e.key===`down`?1:-1)]??s.value,u()}d++,Ne(r.paneId,e.key,c.value).then(e=>{d--,e||(s.value=r.menu.cursor,u())})}}),(t,n)=>{let r=Je;return _(),v(`div`,Gf,[I(`p`,Kf,[n[2]||=I(`i`,null,null,-1),a(M((`t`in t?t.t:f(Q))(`Your turn`)),1),I(`span`,qf,M((`t`in t?t.t:f(Q))(`Interactive menu`)),1)]),e.menu.unavailable?(_(),v(`p`,Jf,M((`tl`in t?t.tl:f(Z))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),e.menu.title?(_(),v(`p`,Yf,M(e.menu.title),1)):g(``,!0),f(x)&&e.menu.lines.length?(_(),v(`p`,Xf,M(e.menu.lines[0]),1)):g(``,!0),f(x)&&f(m)?(_(),v(`p`,Zf,M((`tl`in t?t.tl:f(Z))(`Tap an entry to move the cursor there, then confirm with a button below.`,`Toucher une entrée y place le curseur ; valide ensuite avec un bouton ci-dessous.`)),1)):g(``,!0),e.menu.search===null?g(``,!0):(_(),v(`form`,{key:4,class:`menu-search`,onSubmit:q(N,[`prevent`])},[E(r,{name:`i-lucide-search`,"aria-hidden":`true`}),L(I(`input`,{ref_key:`searchRef`,ref:F,"onUpdate:modelValue":n[0]||=e=>W(T)?T.value=e:null,type:`search`,placeholder:(`t`in t?t.t:f(Q))(`Search…`),"aria-label":(`t`in t?t.t:f(Q))(`Search the menu`),enterkeyhint:`search`,autocomplete:`off`,autocapitalize:`off`,spellcheck:`false`,disabled:f(p),onInput:A},null,40,Qf),[[re,f(T)]])],32)),f(x)?(_(),v(`div`,{key:5,ref_key:`listRef`,ref:l,class:`choices-list menu-list`},[(_(!0),v(k,null,y(e.menu.items,(e,t)=>(_(),v(k,{key:t},[e.header?(_(),v(`p`,$f,M(e.label),1)):(_(),v(`button`,{key:1,type:`button`,class:j({cur:t===f(s)}),"aria-current":t===f(s)?`true`:void 0,disabled:f(p),onClick:n=>S(t,e.label)},[I(`span`,tp,M(t===f(s)?`❯`:``),1),I(`span`,np,[a(M(e.label),1),e.hint?(_(),v(`small`,rp,M(e.hint),1)):g(``,!0)])],10,ep))],64))),128)),e.menu.more?(_(),v(`p`,ip,M(e.menu.more),1)):g(``,!0)],512)):(_(),v(k,{key:6},[e.menu.lines.length?(_(),v(`pre`,ap,M(e.menu.lines.join(`
78
- `)),1)):g(``,!0),I(`p`,op,M((`tl`in t?t.tl:f(Z))(`Interactive menu open: pick its entries in the terminal.`,`Menu interactif en cours : ses entrées se choisissent dans le terminal.`)),1)],64)),I(`div`,sp,[(_(!0),v(k,null,y(f(b),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(p),onClick:t=>C(e)},[a(M((`screenActionText`in t?t.screenActionText:f(Ii))(e)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Nr))(e.key)),1)],8,cp))),128)),f(V)?(_(),v(`span`,lp,[n[3]||=I(`kbd`,null,`↑↓`,-1),f(m)?g(``,!0):(_(),v(`kbd`,up,M((`screenKeyName`in t?t.screenKeyName:f(Nr))(`enter`)),1))])):g(``,!0),I(`button`,{type:`button`,class:`menu-term`,onClick:n[1]||=e=>i(`terminal`)},[E(r,{name:`i-lucide-square-terminal`,"aria-hidden":`true`}),a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)])])])}}}),{__name:`MenuPanel`}),fp={class:`usage-limit-card composer-notice`,role:`status`},pp={class:`restart-text`},mp={key:1},hp=[`disabled`],gp=[`disabled`],_p={key:2,class:`notice-btn`,href:`https://clau.de/reset`,target:`_blank`,rel:`noopener noreferrer`},vp=Object.assign(Zi(T({__name:`UsageLimitCard`,props:{limit:{},readOnly:{type:Boolean},sendKeys:{type:Function}},emits:[`credits`],setup(e,{emit:t}){let n=e,r=t,i=h(!1);async function o(){if(!(n.readOnly||i.value)){i.value=!0;try{await n.sendKeys([`esc`])}catch(e){$(e.message,!0)}finally{i.value=!1}}}return(t,n)=>(_(),v(`div`,fp,[I(`span`,pp,[a(M(f(Z)(`Provider quota reached`,`Quota fournisseur atteint`)),1),e.limit.resets?(_(),v(k,{key:0},[a(` · `+M(f(Z)(`Resets`,`Réinitialisation`))+` `+M(e.limit.resets),1)],64)):g(``,!0),e.limit.automatic?(_(),v(`small`,mp,M(f(Z)(`Will continue automatically`,`Reprise automatique`)),1)):g(``,!0)]),e.limit.automatic?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:o},M(f(Z)(`Cancel wait`,`Annuler l’attente`)),9,hp)):g(``,!0),e.limit.credits?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:n[0]||=e=>r(`credits`)},`/usage-credits`,8,gp)):g(``,!0),e.limit.resetLink?(_(),v(`a`,_p,M(f(Z)(`Reset quota ↗`,`Réinitialiser le quota ↗`)),1)):g(``,!0)]))}}),[[`__scopeId`,`data-v-8c0c9595`]]),{__name:`UsageLimitCard`}),yp={key:0,class:`composer-notice restart`,role:`status`},bp={class:`restart-text`},xp={key:1,class:`composer-notice failed`,role:`status`},Sp={class:`restart-text`},Cp={key:2,class:`composer-notice`,role:`status`},wp={class:`restart-text`},Tp=[`disabled`,`title`],Ep={key:3,class:`composer-notice codex-update`,role:`status`},Dp=[`title`],Op={key:0,class:`notice-extra`},kp=[`href`,`aria-label`,`title`],Ap={class:`notice-label`},jp=[`disabled`,`title`],Mp={key:2,class:`notice-reason`},Np=[`aria-label`,`title`],Pp=[`title`],Fp=[`disabled`,`title`],Ip=`wherdr.codexUpdate.dismissed`,Lp=Object.assign(T({__name:`CodexNotices`,props:{pane:{},paneId:{},readOnly:{type:Boolean}},setup(e){let t=e,r=h(``);try{r.value=localStorage.getItem(Ip)||``}catch{}let i=n(()=>{let e=t.pane.codexStatus?.update;return!e||e.state===`available`&&!e.job&&e.latest===r.value?null:e}),o=n(()=>t.pane.codexStatus?.weekly||null),s=n(()=>i.value?.job||null),c=n(()=>{let e=Ci(t.pane.id),n=wr.value.machines?.find(t=>t.key===e);return n&&n.label||br.value||Q(`This machine`)}),l=n(()=>{let e=i.value;if(!e)return``;let t=Z(`Codex ${e.latest} available`,`Codex ${e.latest} disponible`);return e.current?`${t} ${Z(`(you have ${e.current})`,`(tu as la ${e.current})`)}`:t}),u=n(()=>{let e=o.value;return e?e.lessThan?Z(`Weekly limit: less than ${e.left}% left`,`Limite hebdo : moins de ${e.left} % restants`):Z(`Weekly limit: ${e.left}% left`,`Limite hebdo : ${e.left} % restants`):``});function d(){let e=i.value?.latest;if(e){r.value=e;try{localStorage.setItem(Ip,e)}catch{}}}async function p(){let e=i.value?.command;if(e){X();try{await navigator.clipboard.writeText(e),$(Z(`Command copied: paste it into a terminal on ${c.value}.`,`Commande copiée : colle-la dans un terminal sur ${c.value}.`))}catch{$(Q(`Copy failed`),!0)}}}let m=n(()=>{if(i.value?.method!==`terminal`)return``;let e=t.pane.status;return e===`working`?Z(`Codex is working: update it once it is done`,`Codex travaille : mets-le à jour quand il a fini`):e===`blocked`?Z(`Codex is waiting for an answer: answer it first`,`Codex attend une réponse : réponds-lui d’abord`):``});async function y(){let e=i.value;if(e&&e.runnable&&e.command&&!m.value&&(e.method===`terminal`?await mt([Z(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Z(`wherdr will exit Codex in this pane, type Codex’s official update command in its terminal:`,`wherdr va quitter Codex dans ce panneau et taper dans son terminal la commande de mise à jour officielle de Codex :`),e.command,Z(`then restart Codex on this conversation (codex resume). If the update fails, the pane stays at its shell.`,`puis relancer Codex sur cette conversation (codex resume). Si la mise à jour échoue, le panneau reste sur son shell.`)].join(`
73
+ }`)),this.register((0,i.toDisposable)((()=>l.deleteProgram(this._program)))),this._projectionLocation=(0,r.throwIfFalsy)(l.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(d)))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,u,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(p)))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p),l.bufferData(l.ELEMENT_ARRAY_BUFFER,f,l.STATIC_DRAW),this._attributesBuffer=(0,r.throwIfFalsy)(l.createBuffer()),this.register((0,i.toDisposable)((()=>l.deleteBuffer(this._attributesBuffer)))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,s,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,s,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,s,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this.register(this._themeService.onChangeColors((e=>{this._updateCachedColors(e),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,o.PROJECTION_MATRIX),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r,i,o,s,c,l,u,d,f,p,m,h=1;for(r=0;r<t.rows;r++){for(o=-1,s=0,c=0,l=!1,i=0;i<t.cols;i++)u=(r*t.cols+i)*a.RENDER_MODEL_INDICIES_PER_CELL,d=e.cells[u+a.RENDER_MODEL_BG_OFFSET],f=e.cells[u+a.RENDER_MODEL_FG_OFFSET],p=!!(67108864&f),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,i,r)),o=i,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,t.cols,r))}n.count=h}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`)return void(t.count=0);let r,i=0;n.style!==`bar`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.style!==`underline`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=8*i++,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,s){if(67108864&n)switch(50331648&n){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&n].rgba;break;case 50331648:l=(16777215&n)<<8;break;default:l=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:l=(16777215&r)<<8;break;default:l=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=(0,o.expandFloat32Array)(e.attributes,this._terminal.rows*this._terminal.cols*8)),u=i*this._dimensions.device.cell.width,d=s*this._dimensions.device.cell.height,f=(l>>24&255)/255,p=(l>>16&255)/255,m=(l>>8&255)/255,h=1,this._addRectangle(e.attributes,t,u,d,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,f,p,m,h)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}}t.RectangleRenderer=g},310:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;let r=n(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=(0,r.createSelectionRenderModel)()}resize(e,n){let r=e*n*t.RENDER_MODEL_INDICIES_PER_CELL;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;let r=n(820),i=n(274),a=n(627),o=n(457),s=n(56),c=n(374),l=n(345),u=n(859),d=n(147),f=n(782),p=n(855),m=n(965),h=n(742),g=n(310),_=n(733);class v extends u.Disposable{constructor(e,t,n,o,d,p,m,h,v){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=o,this._coreService=d,this._decorationService=p,this._optionsService=m,this._themeService=h,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new g.RenderModel,this._workCell=new f.CellData,this._workCell2=new f.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new l.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new l.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new l.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new l.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new i.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new _.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,m,this._themeService)],this.dimensions=(0,c.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(m.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let y={antialias:!1,depth:!1,preserveDrawingBuffer:v};if(this._gl=this._canvas.getContext(`webgl2`,y),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextlost`,(e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)}),3e3)}))),this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextrestored`,(e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,a.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t))),this.register(this._coreBrowserService.onWindowChange((e=>{this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,e,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,u.toDisposable)((()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,a.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new h.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new m.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let e=(0,a.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,l.forwardEvent)(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,l.forwardEvent)(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(e){return-1}deregisterCharacterJoiner(e){return!1}renderRows(e,t){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new o.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r,i,a,o,s,c,l,u,d,f,m,h,_,v,x=this._workCell;e=b(e,n.rows-1,0),t=b(t,n.rows-1,0);let S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let D=!1;for(i=e;i<=t;i++)for(a=i+n.buffer.ydisp,o=n.buffer.lines.get(a),this._model.lineLengths[i]=0,s=this._characterJoinerService.getJoinedCharacters(a),_=0;_<n.cols;_++)if(r=this._cellColorResolver.result.bg,o.loadCell(_,x),_===0&&(r=this._cellColorResolver.result.bg),c=!1,l=_,s.length>0&&_===s[0][0]&&(c=!0,u=s.shift(),x=new y(x,o.translateToString(!0,u[0],u[1]),u[1]-u[0]),l=u[1]-1),d=x.getChars(),f=x.getCode(),h=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(x,_,a,this.dimensions.device.cell.width),E&&a===S&&(_===w&&(this._model.cursor={x:w,y:C,width:x.getWidth(),style:this._coreBrowserService.isFocused?n.options.cursorStyle||`block`:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+x.getWidth()-1),_>=w&&_<=T&&(this._coreBrowserService.isFocused&&(n.options.cursorStyle||`block`)===`block`||!1===this._coreBrowserService.isFocused&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),f!==p.NULL_CELL_CODE&&(this._model.lineLengths[i]=_+1),(this._model.cells[h]!==f||this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(D=!0,d.length>1&&(f|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[h]=f,this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,m=x.getWidth(),this._glyphRenderer.value.updateCell(_,i,f,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,m,r),c))for(x=this._workCell,_++;_<l;_++)v=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(_,i,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[v]=p.NULL_CELL_CODE,this._model.cells[v+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[v+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[v+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;D&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}}t.WebglRenderer=v;class y extends d.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function b(e,t,n=0){return Math.max(Math.min(e,t),n)}t.JoinedCellData=y},381:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;let r=n(374);function i(e,t,n){let i=(0,r.throwIfFalsy)(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(e,t,n){let a=(0,r.throwIfFalsy)(e.createProgram());if(e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.VERTEX_SHADER,t))),e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.FRAGMENT_SHADER,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;console.error(e.getProgramInfoLog(a)),e.deleteProgram(a)},t.createShader=i,t.expandFloat32Array=function(e,t){let n=Math.min(2*e.length,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r},t.GLTexture=class{constructor(e){this.texture=e,this.version=-1}}},592:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;let r=n(627),i=n(237),a=n(374),o=n(859);class s extends o.Disposable{constructor(e,t,n,r,i,a,s,c){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=s,this._themeService=c,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((t=>{this._refreshCharAtlas(e,t),this.reset(e)}))),this.register((0,o.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,a.throwIfFalsy)(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,r.acquireTextureAtlas)(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=i.TEXT_BASELINE,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){return`${n?`italic`:``} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}}t.BaseRenderLayer=s},733:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;let r=n(197),i=n(237),a=n(592);class o extends a.BaseRenderLayer{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this.register(r.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(r.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===i.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&(0,r.is256Color)(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}}t.LinkRenderLayer=o},820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},274:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;let r=n(855),i=n(160),a=n(374),o,s=0,c=0,l=!1,u=!1,d=!1,f=0;t.CellColorResolver=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,p){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,c=0,s=0,u=!1,l=!1,d=!1,o=this._themeService.colors,f=0,e.getCode()!==r.NULL_CELL_CODE&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));f=t*p%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),d=this._selectionRenderModel.isCellSelected(this._terminal,t,n),d){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:c=(16777215&this.result.fg)<<8|255;break;default:c=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:c=(16777215&this.result.bg)<<8|255}c=i.rgba.blend(c,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else c=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,o.selectionForeground&&(s=o.selectionForeground.rgba>>8&16777215,l=!0),(0,a.treatGlyphAsBackgroundColor)(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))s=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:s=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:s=(16777215&this.result.fg)<<8|255;break;default:s=this._themeService.colors.foreground.rgba}s=i.rgba.blend(s,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}l=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),u&&(c=d?e.bg&-150994944|c|50331648:-16777216&e.bg|c|50331648),l&&(s=e.fg&-83886080|s|50331648),67108864&this.result.fg&&(u&&!l&&(s=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&o.background.rgba>>8|50331648,l=!0),!u&&l&&(c=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&o.foreground.rgba>>8|50331648,u=!0)),o=void 0,this.result.bg=u?c:this.result.bg,this.result.fg=l?s:this.result.fg,this.result.ext&=536870911,this.result.ext|=f<<29&3758096384}}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;let r=n(509),i=n(197),a=[];t.acquireTextureAtlas=function(e,t,n,o,s,c,l,u){let d=(0,i.generateConfig)(o,s,c,l,t,n,u);for(let t=0;t<a.length;t++){let n=a[t],r=n.ownedBy.indexOf(e);if(r>=0){if((0,i.configEquals)(n.config,d))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),a.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<a.length;t++){let n=a[t];if((0,i.configEquals)(n.config,d))return n.ownedBy.push(e),n.atlas}let f=e._core,p={atlas:new r.TextureAtlas(document,d,f.unicodeService),config:d,ownedBy:[e]};return a.push(p),p.atlas},t.removeTerminalFromCache=function(e){for(let t=0;t<a.length;t++){let n=a[t].ownedBy.indexOf(e);if(n!==-1){a[t].ownedBy.length===1?(a[t].atlas.dispose(),a.splice(t,1)):a[t].ownedBy.splice(n,1);break}}}},197:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;let r=n(160);t.generateConfig=function(e,t,n,i,a,o,s){let c={foreground:o.foreground,background:o.background,cursor:r.NULL_COLOR,cursorAccent:r.NULL_COLOR,selectionForeground:r.NULL_COLOR,selectionBackgroundTransparent:r.NULL_COLOR,selectionBackgroundOpaque:r.NULL_COLOR,selectionInactiveBackgroundTransparent:r.NULL_COLOR,selectionInactiveBackgroundOpaque:r.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:s,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:c}},t.configEquals=function(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba},t.is256Color=function(e){return(50331648&e)==16777216||(50331648&e)==33554432}},237:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;let r=n(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};let i={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}},t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.tryDrawCustomChar=function(e,n,o,l,u,d,f,p){let m=t.blockElementDefinitions[n];if(m)return function(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}(e,m,o,l,u,d),!0;let h=i[n];if(h)return function(e,t,n,i,o,s){let c=a.get(t);c||(c=new Map,a.set(t,c));let l=e.fillStyle;if(typeof l!=`string`)throw Error(`Unexpected fillStyle type "${l}"`);let u=c.get(l);if(!u){let n=t[0].length,i=t.length,a=e.canvas.ownerDocument.createElement(`canvas`);a.width=n,a.height=i;let o=(0,r.throwIfFalsy)(a.getContext(`2d`)),s=new ImageData(n,i),d,f,p,m;if(l.startsWith(`#`))d=parseInt(l.slice(1,3),16),f=parseInt(l.slice(3,5),16),p=parseInt(l.slice(5,7),16),m=l.length>7&&parseInt(l.slice(7,9),16)||1;else{if(!l.startsWith(`rgba`))throw Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);[d,f,p,m]=l.substring(5,l.length-1).split(`,`).map((e=>parseFloat(e)))}for(let e=0;e<i;e++)for(let r=0;r<n;r++)s.data[4*(e*n+r)]=d,s.data[4*(e*n+r)+1]=f,s.data[4*(e*n+r)+2]=p,s.data[4*(e*n+r)+3]=t[e][r]*(255*m);o.putImageData(s,0,0),u=(0,r.throwIfFalsy)(e.createPattern(a,null)),c.set(l,u)}e.fillStyle=u,e.fillRect(n,i,o,s)}(e,h,o,l,u,d),!0;let g=t.boxDrawingDefinitions[n];if(g)return function(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[l,u]of Object.entries(t)){let t;e.beginPath(),e.lineWidth=o*Number.parseInt(l),t=typeof u==`function`?u(.15,.15/a*i):u;for(let l of t.split(` `)){let t=l[0],u=s[t];if(!u){console.error(`Could not find drawing instructions for "${t}"`);continue}let d=l.substring(1).split(`,`);d[0]&&d[1]&&u(e,c(d,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}(e,g,o,l,u,d,p),!0;let _=t.powerlineDefinitions[n];return!!_&&(function(e,t,n,r,i,a,o,l){let u=new Path2D;u.rect(n,r,i,a),e.clip(u),e.beginPath();let d=o/12;e.lineWidth=l*d;for(let o of t.d.split(` `)){let u=o[0],f=s[u];if(!f){console.error(`Could not find drawing instructions for "${u}"`);continue}let p=o.substring(1).split(`,`);p[0]&&p[1]&&f(e,c(p,i,a,n,r,!1,l,(t.leftPadding??0)*(d/2),(t.rightPadding??0)*(d/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,_,o,l,u,d,f,p),!0)};let a=new Map;function o(e,t,n=0){return Math.max(Math.min(e,t),n)}let s={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function c(e,t,n,r,i,a,s,c=0,l=0){let u=e.map((e=>parseFloat(e)||parseInt(e)));if(u.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<u.length;e+=2)u[e]*=t-c*s-l*s,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,t,0)),u[e]+=r+c*s;for(let e=1;e<u.length;e+=2)u[e]*=n,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,n,0)),u[e]+=i;return u}},56:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;let r=n(859);t.observeDevicePixelDimensions=function(e,t,n){let i=new t.ResizeObserver((t=>{let r=t.find((t=>t.target===e));if(!r)return;if(!(`devicePixelContentBoxSize`in r))return i?.disconnect(),void(i=void 0);let a=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)}));try{i.observe(e,{box:[`device-pixel-content-box`]})}catch{i.disconnect(),i=void 0}return(0,r.toDisposable)((()=>i?.disconnect()))}},374:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},509:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;let r=n(237),i=n(860),a=n(374),o=n(160),s=n(345),c=n(485),l=n(385),u=n(147),d=n(855),f={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},p;class m{get pages(){return this._pages}constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new c.FourKeyMap,this._cacheMapCombined=new c.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new s.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new s.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=_(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,a.throwIfFalsy)(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new l.IdleTaskQueue;for(let t=33;t<126;t++)e.enqueue((()=>{if(!this._cacheMap.get(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT)){let e=this._drawToCache(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT);this._cacheMap.set(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT,e)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(m.maxAtlasPages&&this._pages.length>=Math.max(4,m.maxAtlasPages)){let e=this._pages.filter((e=>2*e.canvas.width<=(m.maxTextureSize||4096))).sort(((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width)),t=-1,n=0;for(let r=0;r<e.length;r++)if(e[r].canvas.width!==n)t=r,n=e[r].canvas.width;else if(r-t==3)break;let r=e.slice(t,t+4),i=r.map((e=>e.glyphs[0].texturePage)).sort(((e,t)=>e>t?1:-1)),a=this.pages.length-r.length,o=this._mergePages(r,a);o.version++;for(let e=i.length-1;e>=0;e--)this._deletePage(i[e]);this.pages.push(o),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(o.canvas)}let e=new h(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let n=2*e[0].canvas.width,r=new h(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i)}getRasterizedGlyph(e,t,n,r,i){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i)}_getFromCacheMap(e,t,n,r,i,a=!1){return p=e.get(t,n,r,i),p||(p=this._drawToCache(t,n,r,i,a),e.set(t,n,r,i,p)),p}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return o.NULL_COLOR;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=u.AttributeData.toColorRGB(t);i=o.channels.toColor(e[0],e[1],e[2]);break;default:i=n?o.color.opaque(this._config.colors.foreground):this._config.colors.background}return i}_getForegroundColor(e,t,n,i,a,s,c,l,d,f){let p=this._getMinimumContrastColor(e,t,n,i,a,s,c,d,l,f);if(p)return p;let m;switch(a){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&s<8&&(s+=8),m=this._getColorFromAnsiIndex(s);break;case 50331648:let e=u.AttributeData.toColorRGB(s);m=o.channels.toColor(e[0],e[1],e[2]);break;default:m=c?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(m=o.color.opaque(m)),l&&(m=o.color.multiplyOpacity(m,r.DIM_OPACITY)),m}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,s,c,l,u){if(this._config.minimumContrastRatio===1||u)return;let d=this._getContrastCache(l),f=d.getColor(e,r);if(f!==void 0)return f||void 0;let p=this._resolveBackgroundRgba(t,n,s),m=this._resolveForegroundRgba(i,a,s,c),h=o.rgba.ensureContrastRatio(p,m,this._config.minimumContrastRatio/(l?2:1));if(!h)return void d.setColor(e,r,null);let g=o.channels.toColor(h>>24&255,h>>16&255,h>>8&255);return d.setColor(e,r,g),g}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,n,o,s=!1){let c=typeof e==`number`?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+4,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let d=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=o,this._workAttributeData.isInvisible())return f;let p=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),C=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(h){let e=S;S=w,w=e;let t=C;C=T,T=t}let E=this._getBackgroundColor(T,w,h,_);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let D=p?this._config.fontWeightBold:this._config.fontWeight,O=v?`italic`:``;this._tmpCtx.font=`${O} ${D} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=r.TEXT_BASELINE;let k=c.length===1&&(0,a.isPowerlineGlyph)(c.charCodeAt(0)),A=c.length===1&&(0,a.isRestrictedPowerlineGlyph)(c.charCodeAt(0)),j=this._getForegroundColor(t,T,w,n,C,S,h,_,p,(0,a.treatGlyphAsBackgroundColor)(c.charCodeAt(0)));this._tmpCtx.fillStyle=j.css;let M=A?0:4,N=!1;!1!==this._config.customGlyphs&&(N=(0,i.tryDrawCustomChar)(this._tmpCtx,c,M,M,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let P,F=!k;if(P=typeof e==`number`?this._unicodeService.wcwidth(e):this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())F=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{F=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=M,r=Math.ceil(M+this._config.deviceCharHeight)-t-(s?2*e:0),i=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let s=0;s<P;s++){this._tmpCtx.save();let c=n+s*this._config.deviceCellWidth,u=n+(s+1)*this._config.deviceCellWidth,d=c+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r),this._tmpCtx.moveTo(c,o),this._tmpCtx.lineTo(u,o);break;case 3:let n=e<=1?o:Math.ceil(M+this._config.deviceCharHeight-e/2)-t,s=e<=1?r:Math.ceil(M+this._config.deviceCharHeight+e/2)-t,f=new Path2D;f.rect(c,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(f),this._tmpCtx.moveTo(c-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(c-this._config.deviceCellWidth/2,s,c,s,c,i),this._tmpCtx.bezierCurveTo(c,n,d,n,d,i),this._tmpCtx.bezierCurveTo(d,s,u,s,u,i),this._tmpCtx.bezierCurveTo(u,n,u+this._config.deviceCellWidth/2,n,u+this._config.deviceCellWidth/2,i);break;case 4:let p=l===0?0:l>=e?2*e-l:e-l;!(l>=e)==0||p===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c+p,r),this._tmpCtx.lineTo(u,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(c+p,r),this._tmpCtx.moveTo(c+p+e,r),this._tmpCtx.lineTo(u,r)),l=(0,a.computeNextVariantOffset)(u-c,e,l);break;case 5:let m=u-c,h=Math.floor(.6*m),g=Math.floor(.3*m),_=m-h-g;this._tmpCtx.setLineDash([h,g,_]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r);break;default:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!N&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*P,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(c,M,M+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+t),this._tmpCtx.stroke()}if(N||this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight),c===`_`&&!this._config.allowTransparency){let e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight-t),e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F),e);t++);}if(b){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let I=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),L;if(L=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(I):g(I,E,j,F),L)return f;let R=this._findGlyphBoundingBox(I,this._workBoundingBox,l,A,N,M),z,B;for(;;){if(this._activePages.length===0){let e=this._createNewPage();z=e,B=e.currentRow,B.height=R.size.y;break}z=this._activePages[this._activePages.length-1],B=z.currentRow;for(let e of this._activePages)R.size.y<=e.currentRow.height&&(z=e,B=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=B.height&&R.size.y<=t.height&&(z=this._activePages[e],B=t);if(B.y+R.size.y>=z.canvas.height||B.height>R.size.y+2){let e=!1;if(z.currentRow.y+z.currentRow.height+R.size.y>=z.canvas.height){let t;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+R.size.y<e.canvas.height){t=e;break}if(t)z=t;else if(m.maxAtlasPages&&this._pages.length>=m.maxAtlasPages&&B.y+R.size.y<=z.canvas.height&&B.height>=R.size.y&&B.x+R.size.x<=z.canvas.width)e=!0;else{let t=this._createNewPage();z=t,B=t.currentRow,B.height=R.size.y,e=!0}}e||(z.currentRow.height>0&&z.fixedRows.push(z.currentRow),B={x:0,y:z.currentRow.y+z.currentRow.height,height:R.size.y},z.fixedRows.push(B),z.currentRow={x:0,y:B.y+B.height,height:0})}if(B.x+R.size.x<=z.canvas.width)break;B===z.currentRow?(B.x=0,B.y+=B.height,B.height=0):z.fixedRows.splice(z.fixedRows.indexOf(B),1)}return R.texturePage=this._pages.indexOf(z),R.texturePosition.x=B.x,R.texturePosition.y=B.y,R.texturePositionClipSpace.x=B.x/z.canvas.width,R.texturePositionClipSpace.y=B.y/z.canvas.height,R.sizeClipSpace.x/=z.canvas.width,R.sizeClipSpace.y/=z.canvas.height,B.height=Math.max(B.height,R.size.y),B.x+=R.size.x,z.ctx.putImageData(I,R.texturePosition.x-this._workBoundingBox.left,R.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,R.size.x,R.size.y),z.addGlyph(R),z.version++,R}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=m;class h{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=_(e,t,t),this.ctx=(0,a.throwIfFalsy)(this.canvas.getContext(`2d`,{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function _(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},399:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},385:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(399);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},782:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(133),i=n(855),a=n(147);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},855:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},776:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(859),o=n(97),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},726:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},97:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(726);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.WebglAddon=void 0;let t=n(345),i=n(859),a=n(399),o=n(666),s=n(776);class c extends i.Disposable{constructor(e){if(a.isSafari&&(0,a.getSafariVersion)()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(e){let n=e._core;if(!e.element)return void this.register(n.onWillOpen((()=>this.activate(e))));this._terminal=e;let r=n.coreService,a=n.optionsService,c=n,l=c._renderService,u=c._characterJoinerService,d=c._charSizeService,f=c._coreBrowserService,p=c._decorationService,m=c._logService,h=c._themeService;(0,s.setTraceLogger)(m),this._renderer=this.register(new o.WebglRenderer(e,u,d,f,r,p,a,h,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register((0,i.toDisposable)((()=>{let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}e.WebglAddon=c})(),r})()))})),_d=md(),vd=hd(),yd=gd();function bd(e,t,n=!0){return n?t===`normal`?Math.min(Math.max(0,e),760):Math.min(t===`wide`?1100:1/0,Math.max(0,e-48)):Math.max(0,e)}var xd=/https?:\/\/[^\s"'<>`─-▟]+/g,Sd=/[─-▟|]/,Cd={")":`(`,"]":`[`,"}":`{`};function wd(e){let t;try{t=new URL(e.trim())}catch{return null}return t.protocol===`http:`||t.protocol===`https:`?t.href:null}function Td(e,t){let n=e[e.length-1],r=t[0];return!!n&&!!r&&n!==` `&&r!==` `&&!Sd.test(n)&&!Sd.test(r)}function Ed(e){for(;;){let t=e[e.length-1];if(`.,;:!?'"`.includes(t))e=e.slice(0,-1);else if(Cd[t]&&e.split(Cd[t]).length<=e.split(t).length-1)e=e.slice(0,-1);else return e}}function Dd(e){let t=[];for(let n of e.matchAll(xd)){let e=Ed(n[0]);wd(e)&&e.length>8&&t.push({start:n.index,end:n.index+e.length,url:e})}return t}function Od(e,t,n=()=>!1){if(!e[t])return[];let r=t=>n(t+1)||Td(e[t],e[t+1]??``),i=t;for(;i>0&&r(i-1);)i--;let a=t;for(;a<e.length-1&&r(a);)a++;let o=[],s=``;for(let t=i;t<=a;t++)o.push(s.length),s+=e[t];let c=e=>{let t=o.length-1;for(;t>0&&o[t]>e;)t--;return{row:i+t,col:e-o[t]}};return Dd(s).map(e=>({url:e.url,start:c(e.start),end:c(e.end-1)})).filter(e=>e.start.row<=t&&e.end.row>=t).map(e=>({...e,end:{row:e.end.row,col:e.end.col+1}}))}function kd(e,t){let n=``;for(let r=0;r<t;r++){let t=e?.getCell(r)?.getChars()||` `;n+=t.length===1?t:` `}return n}function Ad(e){let t=e.buffer.active,n=[];for(let r=0;r<t.length;r++)n.push(kd(t.getLine(r),e.cols));return n}var jd=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),Md=()=>typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches;function Nd(e,t,n){return!t||(n?e.metaKey:e.ctrlKey)}function Pd(e){let t=wd(e);return t?(window.open(t,`_blank`,`noopener,noreferrer`),!0):!1}function Fd(e,t){let n=jd(),r=Md(),i=e=>`${e}\n${t(n?`⌘+click to open`:`Ctrl+click to open`)}`,a=!1,o=(e,t)=>{Nd(e,r,n)&&(a=Pd(t)||a)},s=()=>e.element?.querySelector(`.xterm-screen`),c=(e,t)=>{let n=s();n&&r&&wd(t)&&(n.title=i(t))},l=()=>{let e=s();e&&e.removeAttribute(`title`)},u={activate:o,hover:c,leave:l,allowNonHttpProtocols:!1};e.options.linkHandler=u;let d=e.registerLinkProvider({provideLinks(t,n){let r=Ad(e),i=e.buffer.active,a=Od(r,t-1,e=>!!i.getLine(e)?.isWrapped);n(a.length?a.map(e=>({text:e.url,range:{start:{x:e.start.col+1,y:e.start.row+1},end:{x:e.end.col,y:e.end.row+1}},activate:t=>o(t,e.url),hover:t=>c(t,e.url),leave:l})):void 0)}});return{tap:(t,n)=>{let r=s();if(!r)return!1;a=!1;let i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:n,button:0};for(let e of[`mousemove`,`mousedown`,`mouseup`])r.dispatchEvent(new MouseEvent(e,{...i,buttons:+(e===`mousedown`)}));return e.element?.dispatchEvent(new MouseEvent(`mouseleave`,i)),e.clearSelection(),a},dispose(){d.dispose(),l()}}}function Id(e){return e.key.toLowerCase()===`c`&&!e.altKey&&(e.metaKey||e.ctrlKey&&e.shiftKey)}function Ld(e,t,n){return e.button!==0||!e.shiftKey||e.altKey?null:n?t?{shiftKey:!1,altKey:!0}:null:{shiftKey:!1,altKey:!1}}function Rd(e){return e.replace(/[ \t]+$/gm,``)}function zd(e,t,n=()=>!1){let r=e.split(`
74
+ `);return r.length===t.length?r.reduce((e,r,i)=>i===0?r:e+(n(i)||Td(t[i-1],t[i])?``:`
75
+ `)+r,``):e}function Bd(e){let t=e.getSelection(),n=e.getSelectionPosition();if(!n)return Rd(t);let r=Math.min(n.start.y,n.end.y),i=Math.max(n.start.y,n.end.y),a=e.buffer.active;return Rd(zd(t,Ad(e).slice(r,i+1),e=>!!a.getLine(r+e)?.isWrapped))}function Vd(e,t=globalThis.navigator?.clipboard){if(!e||!t?.writeText)return Promise.resolve(!1);try{return t.writeText(e).then(()=>!0,()=>!1)}catch{return Promise.resolve(!1)}}var Hd=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent);function Ud(e,t){let n=e.element;if(!n)return()=>{};let r=Hd(),i=()=>{e.hasSelection()&&Vd(Bd(e)).then(e=>e&&t?.())},a=t=>{Id(t)&&e.hasSelection()&&(t.preventDefault(),t.stopPropagation(),i())},o=()=>i(),s=t=>{t.button===0&&window.addEventListener(`mouseup`,o,{capture:!0,once:!0});let n=Ld(t,r,e.modes.mouseTrackingMode!==`none`);n&&(t.preventDefault(),t.stopImmediatePropagation(),t.target?.dispatchEvent(new MouseEvent(`mousedown`,{bubbles:!0,cancelable:!0,composed:!0,view:window,detail:t.detail,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:t.button,buttons:t.buttons,ctrlKey:t.ctrlKey,metaKey:t.metaKey,...n})))};return n.addEventListener(`keydown`,a,!0),n.addEventListener(`mousedown`,s,!0),()=>{window.removeEventListener(`mouseup`,o,{capture:!0}),n.removeEventListener(`keydown`,a,!0),n.removeEventListener(`mousedown`,s,!0)}}function Wd(e=globalThis.navigator){let t=e?.userAgentData?.platform||e?.platform||``;return/^(mac|iphone|ipad|ipod|ios)/i.test(t)}function Gd(e){let t=e.key.toLowerCase();return t===`v`||e.code===`KeyV`&&!/^[a-z]$/.test(t)}function Kd(e,t){if(e.isComposing)return`xterm`;let n=e.ctrlKey||e.altKey||e.metaKey;return e.key===`Enter`&&e.shiftKey&&!n?`shift+enter`:e.key===`F12`&&!e.shiftKey&&!n||!t&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&Gd(e)?`browser`:`xterm`}function qd(e,t,n=Wd()){e.attachCustomKeyEventHandler(e=>{let r=Kd(e,n);return r===`xterm`||(r===`shift+enter`&&e.type===`keydown`&&(e.preventDefault(),t(`shift+enter`)),!1)})}function Jd(e){return!e||e.getData(`text/plain`)?[]:[...e.items||[]].filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e)}function Yd(e,t){async function n(e){let n=[];for(let r of e)try{n.push(await t.upload(r))}catch(e){t.report(`${Q(`Photo upload failed`)} : ${e.message}`)}n.length&&!t.paste(n.join(` `))&&t.report(Q(`Terminal not connected — image not pasted`))}let r=e=>{let r=Jd(e.clipboardData);!r.length||t.enabled&&!t.enabled()||(e.preventDefault(),e.stopPropagation(),n(r))};return e.addEventListener(`paste`,r,!0),()=>e.removeEventListener(`paste`,r,!0)}var Xd=1e5,Zd=/^[cpqs0-7]*$/,Qd=/^[A-Za-z0-9+/]*={0,2}$/;function $d(e){let t=e.endsWith(`==`)?2:+!!e.endsWith(`=`);return Math.floor(e.length*3/4)-t}function ef(e,t=Xd){let n=e.indexOf(`;`);if(n<0||!Zd.test(e.slice(0,n)))return{kind:`invalid`};let r=e.slice(n+1).replace(/\s+/g,``);if(r===`?`)return{kind:`read`};if(!r||r.length%4==1||!Qd.test(r))return{kind:`invalid`};let i=$d(r);if(i>t)return{kind:`too-large`,bytes:i};let a;try{a=atob(r)}catch{return{kind:`invalid`}}let o=new TextDecoder().decode(Uint8Array.from(a,e=>e.charCodeAt(0)));return o?{kind:`write`,text:o}:{kind:`invalid`}}async function tf(e,t,n){try{if(!t)throw Error(`no clipboard`);return await t.writeText(e),n.copied(),!0}catch{return n.refused(e),!1}}function nf(e,t){let n=e.parser.registerOscHandler(52,e=>{if(!t.enabled())return!0;let n=ef(e,t.maxBytes);return n.kind===`write`?t.write(n.text):n.kind===`too-large`&&t.tooLarge(n.bytes),!0});return()=>n.dispose()}async function rf(e){let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=n,r.src=t}),n=Math.min(1,2048/Math.max(e.naturalWidth,e.naturalHeight)),r=document.createElement(`canvas`);r.width=Math.round(e.naturalWidth*n),r.height=Math.round(e.naturalHeight*n);let i=r.getContext(`2d`);i.fillStyle=`#fff`,i.fillRect(0,0,r.width,r.height),i.drawImage(e,0,0,r.width,r.height);let a=await new Promise(e=>r.toBlob(e,`image/jpeg`,.86));if(a)return a}catch{}finally{URL.revokeObjectURL(t)}return e}async function af(e,t){let n=await rf(t),r=await fetch(`/api/upload?pane=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":n.type||`image/jpeg`},body:n}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(Q(i.error||`HTTP ${r.status}`));return{path:i.path,name:i.name}}function of(e){return e.code===`unreachable`?Z(`${e.machine||`Machine`} unreachable`,`${e.machine||`Machine`} injoignable`):e.code===`unknown_machine`?Z(`unknown machine`,`machine inconnue`):Q(e.reason||``)}function sf(e){return e?Z(`Terminal unavailable: ${e}`,`Terminal indisponible : ${e}`):Q(`Terminal unavailable`)}function cf(e,t,n,r,i){return n.width<=0||n.height<=0||r<=0||i<=0?null:{column:Math.max(0,Math.min(r-1,Math.floor((e-n.left)*r/n.width))),row:Math.max(0,Math.min(i-1,Math.floor((t-n.top)*i/n.height)))}}function lf(e,t,n){let r=e.element,i=null,a=null,o=null,s=0,c=(t,n)=>{let i=r.querySelector(`.xterm-screen`)?.getBoundingClientRect();return i?cf(t,n,i,e.cols,e.rows):null},l=(e,t,n)=>{let r=c(e.clientX,e.clientY);return r&&{type:`terminal.mouse`,action:t,button:n,...r,modifiers:+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)}},u=()=>{cancelAnimationFrame(s),s=0,o&&t()&&n(o),o=null},d=r=>{if(!t()||r.pointerType===`touch`||r.shiftKey||r.ctrlKey||r.metaKey||r.button>2)return;let o=[`left`,`middle`,`right`][r.button],s=l(r,`down`,o);s&&(r.preventDefault(),r.stopPropagation(),i=o,a=r.pointerId,e.clearSelection(),e.focus(),n(s))},f=e=>{!t()||e.pointerType===`touch`||e.shiftKey||e.ctrlKey||e.metaKey||(i?e.pointerId!==a:!r.contains(e.target))||(o=l(e,i?`drag`:`move`,i||`left`),s||=requestAnimationFrame(u))},p=e=>{if(!i||e.pointerId!==a)return;u();let r=l(e,`up`,i);i=null,a=null,r&&t()&&n(r)},m=e=>{t()&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&e.preventDefault()};return r.addEventListener(`contextmenu`,m),r.addEventListener(`pointerdown`,d,!0),window.addEventListener(`pointermove`,f,!0),window.addEventListener(`pointerup`,p,!0),window.addEventListener(`pointercancel`,p,!0),{tap(e,r){let i=t()&&c(e,r);if(i)for(let e of[`down`,`up`])n({type:`terminal.mouse`,action:e,button:`left`,...i,modifiers:0})},dispose(){cancelAnimationFrame(s),r.removeEventListener(`contextmenu`,m),r.removeEventListener(`pointerdown`,d,!0),window.removeEventListener(`pointermove`,f,!0),window.removeEventListener(`pointerup`,p,!0),window.removeEventListener(`pointercancel`,p,!0)}}}var uf=`"Wherdr Symbols", "JetBrains Mono Variable", "JetBrains Mono", "Wherdr Nerd Symbols", ui-monospace, "SF Mono", Menlo, monospace`;function df(e){let t=typeof document<`u`?document.fonts:void 0;return t?.addEventListener?(t.addEventListener(`loadingdone`,e),()=>t.removeEventListener(`loadingdone`,e)):()=>{}}function ff(e,t){let n=null,r=null,i=null,a=null,o=null,s=0,c,l=!1,u={cols:0,rows:0},d=!1,f=h(!1),p=h(!1),m=pd(),g=null,_=null,v=null,y=null,b=null,x=null,S=!1,C=()=>`${location.protocol===`https:`?`wss`:`ws`}://${location.host}`;function w(i){a=i,d=!1,s=0,n=new _d.Terminal({fontFamily:uf,fontSize:lr.value,lineHeight:1,scrollback:0,cursorBlink:!1,allowProposedApi:!0,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:ce.value}),r=new vd.FitAddon,n.loadAddon(r),n.open(i),x=lf(n,()=>S&&t.input?.()!==!1,e=>T(e)),g=Ud(n,()=>$(Q(`Copied`))),b=Fd(n,Q),_=Yd(i,{upload:async t=>(await af(e,t)).path,paste:e=>T({type:`paste`,text:e}),report:e=>$(e,!0)}),v=nf(n,{enabled:()=>Di.value,write:e=>tf(e,navigator.clipboard,{copied:()=>$(Q(`The agent copied text`)),refused:e=>zr(Q(`The agent copied text — tap to copy`),Q(`Copy`),()=>{tf(e,navigator.clipboard,{copied:()=>$(Q(`Copied`)),refused:()=>$(Q(`Copy failed`),!0)})})}),tooLarge:e=>$(Z(`Agent copy ignored: ${vs(e)} (limit ${vs(Xd)})`,`Copie de l’agent ignorée : ${vs(e)} (limite ${vs(Xd)})`))}),O(ai.value);let o=n;Promise.all([document.fonts?.load(`${lr.value}px "JetBrains Mono Variable"`),document.fonts?.load(`${lr.value}px "Wherdr Symbols"`,`─▀█⎿⏵⏺✻✳`)]).then(()=>{d||n!==o||(o.options.fontFamily=uf,D(!0),o.refresh(0,o.rows-1))}).catch(()=>{}),y=df(()=>{d||n!==o||(o.clearTextureAtlas(),o.refresh(0,o.rows-1))});let c=n.textarea;c&&(c.setAttribute(`autocorrect`,`off`),c.setAttribute(`autocapitalize`,`off`),c.setAttribute(`spellcheck`,`false`),c.addEventListener(`blur`,()=>{p.value=!1}),c.addEventListener(`focus`,()=>{p.value=!0})),n.attachCustomWheelEventHandler(()=>!1),qd(n,e=>E([e])),n.onData(e=>{t.input?.()!==!1&&T({type:`terminal.input`,text:e})}),n.onBinary(e=>{if(t.input?.()===!1)return;let n=Uint8Array.from(e,e=>e.charCodeAt(0)&255);T({type:`terminal.input`,bytes:vr(n)})})}function T(e){return o&&o.readyState===1?(o.send(JSON.stringify(e)),!0):!1}async function E(t){if(!T({type:`keys`,keys:t}))try{await _i(`/api/input`,{pane_id:e,keys:t}),X()}catch(e){$(e.message,!0)}}function D(e){if(!n||!r||!a||!a.parentElement)return;let i=matchMedia(Ei).matches&&!t.fill?.();a.style.width=i?`${bd(a.parentElement.clientWidth,Li.value)}px`:``;let o=r.proposeDimensions();if(!o||!o.cols||!o.rows)return;let s={cols:o.cols,rows:o.rows};(s.cols!==n.cols||s.rows!==n.rows)&&n.resize(s.cols,s.rows),e&&(s.cols!==u.cols||s.rows!==u.rows)&&T({type:`terminal.resize`,cols:s.cols,rows:s.rows})&&(u={cols:s.cols,rows:s.rows})}B(ce,e=>{n&&(n.options.theme=e)}),B(Li,()=>P(()=>D(!0)));function O(e){if(n){if(i){let e=i;i=null,e.dispose()}if(e===`webgl`){let e=null;try{e=new yd.WebglAddon;let t=e;e.onContextLoss(()=>{i===t&&(i=null,t.dispose(),ri(`html-fallback`),D(!0))}),n.loadAddon(e),i=e,ri(`webgl`)}catch{try{e?.dispose()}catch{}ri(`html-fallback`)}}else ri(`html`);D(!0)}}B(ai,O);function k(e){n&&(n.options.fontSize=e,D(!0))}function A(r){if(d||!n)return;if(clearTimeout(c),o){o.onclose=null;try{o.close(1e3)}catch{}}D(!1);let i=new URLSearchParams({pane:e,cols:String(n.cols),rows:String(n.rows)});r&&i.set(`takeover`,`1`),S=!1,f.value=!0,l=!0;let a=null,p=!1,h=``,g=new WebSocket(`${C()}/ws/term?${i}`);o=g,g.onopen=()=>{n&&(u={cols:n.cols,rows:n.rows}),g.send(JSON.stringify({type:`visibility`,visible:!document.hidden}))},g.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type===`web.capabilities`)S=t.mouse===!0;else if(t.type===`terminal.frame`){if(p||(p=!0,s=0),f.value=!1,!n)return;t.width&&t.height&&(t.width!==n.cols||t.height!==n.rows)&&n.resize(t.width,t.height);let e=n;e.write(fr(t.bytes||``),()=>m.refresh(e,S))}else t.type===`terminal.closed`?a=of(t):t.type===`herdr.stderr`?/^run 'herdr --help'/.test(t.message)||(h=t.message):t.type===`web.error`&&$(t.message,!0)},g.onclose=()=>{if(o===g&&(o=null,S=!1,f.value=!1,l&&!d)){if(a&&/already has an attached client/.test(a))return t.setBanner({text:Q(`This terminal is already open elsewhere.`),btn:Q(`Take control`),fn:()=>{t.setBanner(null),A(!0)}});if(a&&/taken over/.test(a))return t.setBanner({text:Q(`Another client took control.`),btn:Q(`Take back control`),fn:()=>{t.setBanner(null),A(!0)}});if((ii.value||!Ar.value.ok)&&!document.hidden){if(!p&&s>=3){s=0;let e=h||a;return t.setBanner({text:sf(e),btn:Q(`Retry`),fn:()=>{t.setBanner(null),A(!1)}})}c=setTimeout(()=>A(!1),Math.min(6e3,400*2**s++))}}}}function j(){if(S=!1,l=!1,clearTimeout(c),o){let e=o;o=null;try{e.close(1e3)}catch{}}}let M=()=>!!(o&&o.readyState<=1);function N(){n?.reset()}function F(){n?.focus(),p.value=!0}function I(){n?.textarea?.blur()}let L=(e,t)=>b?.tap(e,t)??!1,R=()=>!!(n&&document.activeElement===n.textarea),z=()=>n&&n.rows&&a?a.clientHeight/n.rows:16,V=()=>n?.rows||24;function H(e){return T({type:`terminal.scroll`,direction:e>0?`up`:`down`,lines:Math.abs(e)})}function U(e){T({type:`visibility`,visible:e}),e&&P(()=>D(!0))}function ee(){d=!0,j(),g?.(),_?.(),v?.(),v=null,y?.(),y=null,g=null,_=null,x?.dispose(),x=null,b?.dispose(),b=null,i=null,n?.dispose(),n=null}return{mount:w,connect:A,disconnect:j,isConnected:M,sendTerm:T,sendKeys:E,fitNow:D,setFontSize:k,reset:N,scroll:H,focus:F,blur:I,tapLink:L,tapMouse:(e,t)=>x?.tap(e,t),hasFocus:R,rowHeight:z,pageRows:V,setVisible:U,dispose:ee,loading:f,kbdOn:p,hasBanner:t.hasBanner,selectionHint:m}}var pf={key:0},mf={class:`interactive-terminal-note`},hf={key:0,class:`term-banner`},gf=Object.assign(T({__name:`InteractiveTerminal`,props:{paneId:{},active:{type:Boolean},title:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=u(null),o=ff(n.paneId,{setBanner:e=>{i.value=e},hasBanner:()=>!!i.value,fill:()=>!0,input:()=>n.active});B(qr,e=>o.setVisible(e));let s=!1;function c(){if(!s||!Lr.value||o.hasFocus())return;let e=document.activeElement;e instanceof HTMLElement&&e.closest(`.interactive-terminal`)&&e.matches(`button, input, textarea`)||o.focus()}function l(e){e.preventDefault(),s=!0,e.currentTarget?.focus(),setTimeout(c,50)}B(()=>o.loading.value,e=>{e||P(c)});let d={onOpenAutoFocus:l,onEscapeKeyDown:e=>e.preventDefault()},p={overlay:`hw-scrim interactive-terminal-scrim`,content:`interactive-terminal`};return(t,n)=>{let s=qe,c=Et,l=ad,u=ld,h=Kn;return _(),m(h,{open:``,title:(`tl`in t?t.tl:f(Z))(`Interactive terminal`,`Terminal interactif`),content:d,ui:p,"onUpdate:open":n[5]||=e=>e||r(`close`)},{content:H(()=>[I(`header`,{class:`interactive-terminal-head`,onKeydown:n[1]||=q(()=>{},[`stop`])},[I(`span`,null,[E(s,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Z))(`Interactive terminal`,`Terminal interactif`)),1),e.title?(_(),v(`small`,pf,M(e.title),1)):g(``,!0)]),E(c,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,"aria-label":(`tl`in t?t.tl:f(Z))(`Close terminal window`,`Fermer la fenêtre terminal`),onClick:n[0]||=e=>r(`close`)},null,8,[`aria-label`])],32),I(`p`,mf,M((`tl`in t?t.tl:f(Z))(`Live agent screen · closes when the message field returns`,`Écran réel de l’agent · se ferme au retour du champ libre`)),1),f(i)?(_(),v(`div`,hf,[I(`span`,null,M(f(i).text),1),E(c,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[2]||=e=>f(i).fn()},{default:H(()=>[a(M(f(i).btn),1)]),_:1})])):g(``,!0),E(l,{ctl:f(o),onKeydown:n[3]||=q(()=>{},[`stop`])},null,8,[`ctl`]),E(u,{ctl:f(o),"all-digits":``,onKeydown:n[4]||=q(()=>{},[`stop`])},null,8,[`ctl`])]),_:1},8,[`title`])}}}),{__name:`InteractiveTerminal`}),_f={class:`prompt-detail-head`},vf={class:`prompt-detail-tool`},yf={key:0,class:`prompt-detail-desc`},bf={key:0,class:`prompt-detail-file`},xf={class:`path`},Sf={key:0,class:`prompt-detail-stats`},Cf={key:0,class:`add`},wf={key:1,class:`del`},Tf={key:2,class:`prompt-detail-note`},Ef=Object.assign(T({__name:`PromptDetailBlock`,props:{detail:{}},setup(e){let t=e,r=h(!1);B(()=>t.detail.command,()=>{r.value=!1});let i=n(()=>(t.detail.command||``).split(`
76
+ `)),o=n(()=>i.value.length>8||(t.detail.command||``).length>800),s=n(()=>On(t.detail));return(t,n)=>{let c=qe;return _(),v(`div`,{class:j([`prompt-detail`,{file:e.detail.file}])},[I(`p`,_f,[I(`span`,vf,M(e.detail.tool),1),e.detail.description?(_(),v(`span`,yf,M(e.detail.description),1)):g(``,!0)]),e.detail.file?(_(),v(`p`,bf,[E(c,{name:`i-lucide-file-pen`}),I(`span`,xf,M(e.detail.file),1),f(s)?(_(),v(`span`,Sf,[e.detail.added?(_(),v(`span`,Cf,`+`+M(e.detail.added),1)):g(``,!0),e.detail.removed?(_(),v(`span`,wf,`−`+M(e.detail.removed),1)):g(``,!0)])):g(``,!0)])):g(``,!0),e.detail.command?(_(),v(`pre`,{key:1,class:j([`prompt-detail-code`,{collapsed:f(o)&&!f(r)}])},[I(`code`,null,[(_(!0),v(k,null,y(f(i),(n,r)=>(_(),v(`span`,{key:r,class:j((`diffKind`in t?t.diffKind:f(Ht))(n,!!e.detail.file))},M(n),3))),128))])],2)):g(``,!0),e.detail.truncated?(_(),v(`p`,Tf,M((`t`in t?t.t:f(Q))(`Too long: only the beginning is shown. The terminal shows the rest.`)),1)):g(``,!0),f(o)?(_(),v(`button`,{key:3,type:`button`,class:`prompt-detail-more`,onClick:n[0]||=e=>r.value=!f(r)},[E(c,{name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),a(` `+M(f(r)?(`t`in t?t.t:f(Q))(`Collapse`):(`tl`in t?t.tl:f(Z))(`Show all (${f(i).length} lines)`,`Tout afficher (${f(i).length} lignes)`)),1)])):g(``,!0)],2)}}}),{__name:`PromptDetailBlock`}),Df={class:`eyebrow choices-eyebrow`},Of=[`aria-label`],kf=[`aria-current`,`disabled`,`onClick`],Af={key:2,class:`choices-q`},jf={key:3,class:`choices-note`,role:`status`},Mf={key:4,class:`choices-note`},Nf=[`aria-pressed`,`aria-expanded`,`disabled`,`onClick`],Pf={key:0,class:`n`},Ff={key:1,class:`n`},If={class:`l`},Lf={key:0},Rf=[`onSubmit`],zf={class:`choices-free-actions`},Bf=[`disabled`],Vf={key:7,class:`choices-keys`},Hf=[`disabled`],Uf=[`disabled`,`onClick`],Wf={key:1,class:`card-kbd`,"aria-hidden":`true`},Gf={key:0},Kf=Object.assign(T({__name:`ChoicesPanel`,props:{paneId:{},prompt:{},screen:{},keys:{type:Boolean}},setup(e){let t=e,r=h(!1),i=h(t.prompt?.cursor),o=0;B(()=>t.prompt,(e,t)=>{o&&e&&t&&e.cursor===t.cursor&&e.identity===t.identity||(i.value=e?.cursor)}),B(()=>[t.prompt,t.screen],()=>{r.value=!1});let s=n(()=>t.screen?t.screen.actions.filter(e=>!(t.prompt&&e.key===`enter`)):[]),c=n(()=>t.screen?ar(t.screen.kind):null),l=n(()=>!!(t.screen&&t.screen.lines.some(e=>/\S {3,}\S/.test(e)))),u=n(()=>t.prompt?.kind===`self-update`?Q(t.prompt.question||``):t.screen&&t.screen.title||t.prompt&&t.prompt.question);async function d(e,n){r.value=!0,await he(t.paneId,e,n,t.prompt?.identity)||(r.value=!1)}async function p(e){r.value=!0,await Se(t.paneId,e,t.screen?.identity)||(r.value=!1)}let b=n(()=>t.prompt?.kind===`self-update`);async function x(){r.value=!0,await je(t.paneId)||(r.value=!1)}async function S(){r.value=!0,await Me(t.paneId,`enter`,t.prompt?.identity)||(r.value=!1)}let C=n(()=>!!(t.prompt&&t.prompt.options.some(e=>e.checked===void 0))),w=n(()=>t.prompt&&t.prompt.tabs&&t.prompt.tab!==void 0&&!t.prompt.typing?t.prompt.tabs:null);async function T(e){let n=t.prompt;n&&n.tabs&&e!==n.tab&&!z.value&&(r.value=!0,await Oe(t.paneId,e,n.tabs[e])?O.value=``:r.value=!1)}let D=h(null),O=h(``),A=h(!1),N=n(()=>t.prompt?.typing?t.prompt.options.findIndex(e=>e.free):D.value);B(()=>t.prompt?.question,()=>{D.value=null});let P=n(()=>Lr.value&&!Gr&&!Yr);async function F(e,n){let i=O.value.trim();if(!(!i||z.value||A.value)){r.value=!0,A.value=!0;try{await he(t.paneId,e,n,t.prompt?.identity,{text:i,question:t.prompt?.question??null})?(O.value=``,D.value=null):r.value=!1}finally{A.value=!1}}}function L(){t.prompt?.typing?Me(t.paneId,`esc`):D.value=null}function R(e,t,n){e.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),L()):e.key===`Enter`&&!e.shiftKey&&P.value&&(e.preventDefault(),F(t,n)))}let z=n(()=>r.value||t.prompt?.unavailable||t.screen?.unavailable||!Br.value||br.value),V=n(()=>!!(t.keys&&Lr.value&&t.prompt&&!t.prompt.kind&&t.prompt.options.length&&N.value===null&&!z.value));return Xe(()=>V.value,()=>({digits:Math.min(9,t.prompt?.options.length||0),enter:!0,tabs:!!w.value}),e=>{let n=t.prompt;if(n){if(e.kind===`digit`){let t=n.options[e.n-1];t.free?D.value=e.n-1:d(e.n-1,t.label);return}if(e.kind===`tab`)return Me(t.paneId,e.dir>0?`right`:`left`);e.kind===`nav`&&((e.key===`up`||e.key===`down`)&&i.value!==null&&i.value!==void 0&&(i.value=Math.max(0,Math.min(n.options.length-1,i.value+(e.key===`down`?1:-1)))),o++,Me(t.paneId,e.key,n.identity).then(e=>{o--,e||(i.value=t.prompt?.cursor)}))}}),(t,n)=>{let r=Ef,o=qe,h=xn,P=Et;return _(),v(`div`,{class:j([`choices`,{"choices-screen":e.screen}])},[I(`p`,Df,[n[1]||=I(`i`,null,null,-1),a(M((`t`in t?t.t:f(Q))(`Your turn`)),1)]),f(w)?(_(),v(`div`,{key:0,class:`choices-tabs`,role:`group`,"aria-label":(`t`in t?t.t:f(Q))(`Questions`)},[(_(!0),v(k,null,y(f(w),(t,n)=>(_(),v(`button`,{key:n,type:`button`,class:j({on:n===e.prompt.tab}),"aria-current":n===e.prompt.tab?`step`:void 0,disabled:f(z),onClick:e=>T(n)},M(t),11,kf))),128))],8,Of)):g(``,!0),e.prompt?.detail?(_(),m(r,{key:1,detail:e.prompt.detail},null,8,[`detail`])):g(``,!0),f(u)?(_(),v(`p`,Af,M(f(u)),1)):g(``,!0),e.prompt?.unavailable||e.screen?.unavailable?(_(),v(`p`,jf,M((`tl`in t?t.tl:f(Z))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),f(c)?(_(),v(`p`,Mf,M(f(c)),1)):g(``,!0),e.screen&&e.screen.lines.length&&!e.prompt?.detail?(_(),v(`pre`,{key:5,class:j([`choices-screen-text`,{wrap:!f(l)}])},M(e.screen.lines.join(`
77
+ `)),3)):g(``,!0),e.prompt?(_(),v(`div`,{key:6,class:j([`choices-list`,{multi:e.prompt.multi}])},[(_(!0),v(k,null,y(e.prompt.options,(r,s)=>(_(),v(k,{key:s},[I(`button`,{type:`button`,class:j({cur:s===f(i),on:r.checked}),"aria-pressed":e.prompt.multi&&!r.free?!!r.checked:void 0,"aria-expanded":r.free?f(N)===s:void 0,disabled:f(z),onClick:t=>r.free?D.value=e.prompt.typing||f(D)===s?null:s:d(s,r.label)},[e.prompt.multi&&r.checked!==void 0?(_(),v(`span`,Pf,[E(o,{name:r.checked?`i-lucide-square-check`:`i-lucide-square`},null,8,[`name`])])):(_(),v(`span`,Ff,M(s+1),1)),I(`span`,If,[a(M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Q))(r.label):r.label),1),r.hint?(_(),v(`small`,Lf,M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Q))(r.hint):r.hint),1)):g(``,!0)]),r.free?(_(),m(o,{key:2,name:`i-lucide-pencil-line`,class:`choices-free-icon`})):g(``,!0)],10,Nf),r.free&&f(N)===s?(_(),v(`form`,{key:0,class:`choices-free`,onSubmit:q(e=>F(s,r.label),[`prevent`])},[E(h,{modelValue:f(O),"onUpdate:modelValue":n[0]||=e=>W(O)?O.value=e:null,rows:1,maxrows:6,autoresize:``,autofocus:!e.prompt.typing,size:`lg`,class:`w-full`,placeholder:(`t`in t?t.t:f(Q))(`Your answer…`),disabled:f(z)||f(A),onKeydown:e=>R(e,s,r.label)},null,8,[`modelValue`,`autofocus`,`placeholder`,`disabled`,`onKeydown`]),I(`div`,zf,[E(P,{type:`button`,color:`neutral`,variant:`ghost`,size:`sm`,disabled:f(z)||f(A),onClick:L},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Cancel`)),1)]),_:1},8,[`disabled`]),E(P,{type:`submit`,color:`primary`,variant:`solid`,size:`sm`,loading:f(A),disabled:f(z)||f(A)||!f(O).trim()},{default:H(()=>[a(M((`t`in t?t.t:f(Q))(`Send`)),1)]),_:1},8,[`loading`,`disabled`])])],40,Rf)):g(``,!0)],64))),128)),e.prompt.multi&&!f(C)?(_(),v(`button`,{key:0,type:`button`,class:`choices-next`,disabled:f(z),onClick:S},[a(M((`t`in t?t.t:f(Q))(`Continue`)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Rr))(`enter`)),1)],8,Bf)):g(``,!0)],2)):g(``,!0),f(s).length||f(V)||f(b)?(_(),v(`div`,Vf,[f(b)?(_(),v(`button`,{key:0,type:`button`,disabled:f(z),onClick:x},M((`t`in t?t.t:f(Q))(`Dismiss`)),9,Hf)):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(z),onClick:t=>p(e)},[a(M((`screenActionText`in t?t.screenActionText:f(Hi))(e)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Rr))(e.key)),1)],8,Uf))),128)),f(V)?(_(),v(`span`,Wf,[f(w)?(_(),v(`kbd`,Gf,`←→`)):g(``,!0),n[2]||=I(`kbd`,null,`↑↓`,-1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Rr))(`enter`)),1),I(`kbd`,null,`1–`+M(Math.min(9,e.prompt.options.length)),1)])):g(``,!0)])):g(``,!0)],2)}}}),{__name:`ChoicesPanel`}),qf={class:`choices choices-menu`},Jf={class:`eyebrow choices-eyebrow`},Yf={class:`menu-kind`},Xf={key:0,class:`choices-note`,role:`status`},Zf={key:1,class:`choices-q`},Qf={key:2,class:`choices-note`},$f={key:3,class:`choices-note`},ep=[`placeholder`,`aria-label`,`disabled`],tp={key:0,class:`menu-group`},np=[`aria-current`,`disabled`,`onClick`],rp={class:`n`,"aria-hidden":`true`},ip={class:`l`},ap={key:0},op={key:0,class:`menu-more`},sp={key:0,class:`choices-screen-text wrap`},cp={class:`choices-note`},lp={class:`choices-keys`},up=[`disabled`,`onClick`],dp={key:0,class:`card-kbd`,"aria-hidden":`true`},fp={key:0},pp=Object.assign(T({__name:`MenuPanel`,props:{paneId:{},menu:{},keys:{type:Boolean}},emits:[`terminal`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=h(r.menu.cursor),c=n(()=>s.value===null?r.menu.identity:r.menu.items[s.value]?.identity),l=h(null),u=()=>P(()=>l.value?.querySelector(`.cur`)?.scrollIntoView({block:`nearest`})),d=0;B(()=>r.menu,(e,t)=>{o.value=!1,!(d&&t&&e.cursor===t.cursor&&e.identity===t.identity)&&(s.value=e.cursor,u())}),w(u);let p=n(()=>o.value||r.menu.unavailable||!Br.value||br.value),m=n(()=>et(r.menu)),b=n(()=>r.menu.actions.filter(e=>!(e.key===`enter`&&r.menu.cursor!==null&&!m.value))),x=n(()=>r.menu.items.length>0);async function S(e,t){o.value=!0,await ke(r.paneId,{op:`select`,index:e,label:t},r.menu.items[e]?.identity)||(o.value=!1)}async function C(e){o.value=!0,await ke(r.paneId,{op:`key`,key:e.key,label:e.label},c.value)||(o.value=!1)}let T=h(r.menu.search||``),D=h(!1);B(()=>r.menu.search,e=>{D.value||(T.value=e||``)});let O=null;function A(){D.value=!0,O&&clearTimeout(O),O=setTimeout(N,450)}async function N(){O&&=(clearTimeout(O),null);let e=T.value;e!==(r.menu.search||``)&&await ke(r.paneId,{op:`search`,text:e},r.menu.identity),D.value=!1}U(()=>{O&&clearTimeout(O)});let F=h(null),R=n(()=>r.menu.actions.some(e=>e.key===`esc`)),z=n(()=>r.menu.actions.filter(e=>/^ctrl\+[a-z]$/.test(e.key)).map(e=>e.key)),V=n(()=>!!(r.keys&&Lr.value&&x.value&&!p.value));return Xe(()=>!!(r.keys&&Lr.value&&!p.value&&(x.value||z.value.length)),()=>({digits:0,enter:!m.value,own:F.value,ctrl:z.value,nav:V.value}),e=>{if(e.kind===`ctrl`){let t=r.menu.actions.find(t=>t.key===e.key);t&&C(t);return}if(!(e.kind!==`nav`||e.key===`esc`&&!R.value)){if(e.key===`up`||e.key===`down`){let t=r.menu.items.map((e,t)=>e.header?-1:t).filter(e=>e>=0),n=t.indexOf(s.value??-1);s.value=t[n+(e.key===`down`?1:-1)]??s.value,u()}d++,Me(r.paneId,e.key,c.value).then(e=>{d--,e||(s.value=r.menu.cursor,u())})}}),(t,n)=>{let r=qe;return _(),v(`div`,qf,[I(`p`,Jf,[n[2]||=I(`i`,null,null,-1),a(M((`t`in t?t.t:f(Q))(`Your turn`)),1),I(`span`,Yf,M((`t`in t?t.t:f(Q))(`Interactive menu`)),1)]),e.menu.unavailable?(_(),v(`p`,Xf,M((`tl`in t?t.tl:f(Z))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),e.menu.title?(_(),v(`p`,Zf,M(e.menu.title),1)):g(``,!0),f(x)&&e.menu.lines.length?(_(),v(`p`,Qf,M(e.menu.lines[0]),1)):g(``,!0),f(x)&&f(m)?(_(),v(`p`,$f,M((`tl`in t?t.tl:f(Z))(`Tap an entry to move the cursor there, then confirm with a button below.`,`Toucher une entrée y place le curseur ; valide ensuite avec un bouton ci-dessous.`)),1)):g(``,!0),e.menu.search===null?g(``,!0):(_(),v(`form`,{key:4,class:`menu-search`,onSubmit:q(N,[`prevent`])},[E(r,{name:`i-lucide-search`,"aria-hidden":`true`}),L(I(`input`,{ref_key:`searchRef`,ref:F,"onUpdate:modelValue":n[0]||=e=>W(T)?T.value=e:null,type:`search`,placeholder:(`t`in t?t.t:f(Q))(`Search…`),"aria-label":(`t`in t?t.t:f(Q))(`Search the menu`),enterkeyhint:`search`,autocomplete:`off`,autocapitalize:`off`,spellcheck:`false`,disabled:f(p),onInput:A},null,40,ep),[[re,f(T)]])],32)),f(x)?(_(),v(`div`,{key:5,ref_key:`listRef`,ref:l,class:`choices-list menu-list`},[(_(!0),v(k,null,y(e.menu.items,(e,t)=>(_(),v(k,{key:t},[e.header?(_(),v(`p`,tp,M(e.label),1)):(_(),v(`button`,{key:1,type:`button`,class:j({cur:t===f(s)}),"aria-current":t===f(s)?`true`:void 0,disabled:f(p),onClick:n=>S(t,e.label)},[I(`span`,rp,M(t===f(s)?`❯`:``),1),I(`span`,ip,[a(M(e.label),1),e.hint?(_(),v(`small`,ap,M(e.hint),1)):g(``,!0)])],10,np))],64))),128)),e.menu.more?(_(),v(`p`,op,M(e.menu.more),1)):g(``,!0)],512)):(_(),v(k,{key:6},[e.menu.lines.length?(_(),v(`pre`,sp,M(e.menu.lines.join(`
78
+ `)),1)):g(``,!0),I(`p`,cp,M((`tl`in t?t.tl:f(Z))(`Interactive menu open: pick its entries in the terminal.`,`Menu interactif en cours : ses entrées se choisissent dans le terminal.`)),1)],64)),I(`div`,lp,[(_(!0),v(k,null,y(f(b),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(p),onClick:t=>C(e)},[a(M((`screenActionText`in t?t.screenActionText:f(Hi))(e)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Rr))(e.key)),1)],8,up))),128)),f(V)?(_(),v(`span`,dp,[n[3]||=I(`kbd`,null,`↑↓`,-1),f(m)?g(``,!0):(_(),v(`kbd`,fp,M((`screenKeyName`in t?t.screenKeyName:f(Rr))(`enter`)),1))])):g(``,!0),I(`button`,{type:`button`,class:`menu-term`,onClick:n[1]||=e=>i(`terminal`)},[E(r,{name:`i-lucide-square-terminal`,"aria-hidden":`true`}),a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)])])])}}}),{__name:`MenuPanel`}),mp={class:`usage-limit-card composer-notice`,role:`status`},hp={class:`restart-text`},gp={key:1},_p=[`disabled`],vp=[`disabled`],yp={key:2,class:`notice-btn`,href:`https://clau.de/reset`,target:`_blank`,rel:`noopener noreferrer`},bp=Object.assign(ra(T({__name:`UsageLimitCard`,props:{limit:{},readOnly:{type:Boolean},sendKeys:{type:Function}},emits:[`credits`],setup(e,{emit:t}){let n=e,r=t,i=h(!1);async function o(){if(!(n.readOnly||i.value)){i.value=!0;try{await n.sendKeys([`esc`])}catch(e){$(e.message,!0)}finally{i.value=!1}}}return(t,n)=>(_(),v(`div`,mp,[I(`span`,hp,[a(M(f(Z)(`Provider quota reached`,`Quota fournisseur atteint`)),1),e.limit.resets?(_(),v(k,{key:0},[a(` · `+M(f(Z)(`Resets`,`Réinitialisation`))+` `+M(e.limit.resets),1)],64)):g(``,!0),e.limit.automatic?(_(),v(`small`,gp,M(f(Z)(`Will continue automatically`,`Reprise automatique`)),1)):g(``,!0)]),e.limit.automatic?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:o},M(f(Z)(`Cancel wait`,`Annuler l’attente`)),9,_p)):g(``,!0),e.limit.credits?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:n[0]||=e=>r(`credits`)},`/usage-credits`,8,vp)):g(``,!0),e.limit.resetLink?(_(),v(`a`,yp,M(f(Z)(`Reset quota ↗`,`Réinitialiser le quota ↗`)),1)):g(``,!0)]))}}),[[`__scopeId`,`data-v-8c0c9595`]]),{__name:`UsageLimitCard`}),xp={key:0,class:`composer-notice restart`,role:`status`},Sp={class:`restart-text`},Cp={key:1,class:`composer-notice failed`,role:`status`},wp={class:`restart-text`},Tp={key:2,class:`composer-notice`,role:`status`},Ep={class:`restart-text`},Dp=[`disabled`,`title`],Op={key:3,class:`composer-notice codex-update`,role:`status`},kp=[`title`],Ap={key:0,class:`notice-extra`},jp=[`href`,`aria-label`,`title`],Mp={class:`notice-label`},Np=[`disabled`,`title`],Pp={key:2,class:`notice-reason`},Fp=[`aria-label`,`title`],Ip=[`title`],Lp=[`disabled`,`title`],Rp=`wherdr.codexUpdate.dismissed`,zp=Object.assign(T({__name:`CodexNotices`,props:{pane:{},paneId:{},readOnly:{type:Boolean}},setup(e){let t=e,r=h(``);try{r.value=localStorage.getItem(Rp)||``}catch{}let i=n(()=>{let e=t.pane.codexStatus?.update;return!e||e.state===`available`&&!e.job&&e.latest===r.value?null:e}),o=n(()=>t.pane.codexStatus?.weekly||null),s=n(()=>i.value?.job||null),c=n(()=>{let e=ni(t.pane.id),n=Ar.value.machines?.find(t=>t.key===e);return n&&n.label||Er.value||Q(`This machine`)}),l=n(()=>{let e=i.value;if(!e)return``;let t=Z(`Codex ${e.latest} available`,`Codex ${e.latest} disponible`);return e.current?`${t} ${Z(`(you have ${e.current})`,`(tu as la ${e.current})`)}`:t}),u=n(()=>{let e=o.value;return e?e.lessThan?Z(`Weekly limit: less than ${e.left}% left`,`Limite hebdo : moins de ${e.left} % restants`):Z(`Weekly limit: ${e.left}% left`,`Limite hebdo : ${e.left} % restants`):``});function d(){let e=i.value?.latest;if(e){r.value=e;try{localStorage.setItem(Rp,e)}catch{}}}async function p(){let e=i.value?.command;if(e){X();try{await navigator.clipboard.writeText(e),$(Z(`Command copied: paste it into a terminal on ${c.value}.`,`Commande copiée : colle-la dans un terminal sur ${c.value}.`))}catch{$(Q(`Copy failed`),!0)}}}let m=n(()=>{if(i.value?.method!==`terminal`)return``;let e=t.pane.status;return e===`working`?Z(`Codex is working: update it once it is done`,`Codex travaille : mets-le à jour quand il a fini`):e===`blocked`?Z(`Codex is waiting for an answer: answer it first`,`Codex attend une réponse : réponds-lui d’abord`):``});async function y(){let e=i.value;if(e&&e.runnable&&e.command&&!m.value&&(e.method===`terminal`?await pt([Z(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Z(`wherdr will exit Codex in this pane, type Codex’s official update command in its terminal:`,`wherdr va quitter Codex dans ce panneau et taper dans son terminal la commande de mise à jour officielle de Codex :`),e.command,Z(`then restart Codex on this conversation (codex resume). If the update fails, the pane stays at its shell.`,`puis relancer Codex sur cette conversation (codex resume). Si la mise à jour échoue, le panneau reste sur son shell.`)].join(`
79
79
 
80
- `),Q(`Update`),`primary`):await mt([Z(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Z(`wherdr will run Codex’s official update command there:`,`wherdr y lancera la commande de mise à jour officielle de Codex :`),e.command,Z(`Running Codex agents keep their version until they are restarted; you can then restart this one on the same conversation.`,`Les Codex en cours gardent leur version jusqu’à leur redémarrage ; tu pourras ensuite redémarrer celui-ci sur la même conversation.`)].join(`
80
+ `),Q(`Update`),`primary`):await pt([Z(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Z(`wherdr will run Codex’s official update command there:`,`wherdr y lancera la commande de mise à jour officielle de Codex :`),e.command,Z(`Running Codex agents keep their version until they are restarted; you can then restart this one on the same conversation.`,`Les Codex en cours gardent leur version jusqu’à leur redémarrage ; tu pourras ensuite redémarrer celui-ci sur la même conversation.`)].join(`
81
81
 
82
- `),Q(`Update`),`primary`))){X();try{await fi(`/api/codex-update`,{pane_id:t.paneId})}catch(e){$(e.message,!0)}}}async function b(){try{await fi(`/api/codex-update`,{pane_id:t.paneId,dismiss:!0})}catch(e){$(e.message,!0)}}async function x(){try{await fi(`/api/prompt`,{pane_id:t.paneId,text:`/status`}),X()}catch(e){return $(e.message,!0)}Ee(t.paneId,`/status`)}return(t,n)=>{let r=Je;return _(),v(k,null,[f(i)&&f(s)?.phase===`running`?(_(),v(`div`,yp,[n[1]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,bp,M((`tl`in t?t.tl:f(Z))(`Updating Codex on ${f(c)}…`,`Mise à jour de Codex sur ${f(c)}…`)),1)])):f(i)&&f(s)?.phase===`failed`?(_(),v(`div`,xp,[I(`span`,Sp,M((`t`in t?t.t:f(Q))(`Codex update failed`))+M((`tl`in t?t.tl:f(Z))(`: `,` : `))+M((`t`in t?t.t:f(Q))(f(s).error)),1),f(i).command?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)])):g(``,!0),I(`button`,{type:`button`,class:`notice-btn`,onClick:b},M((`t`in t?t.t:f(Q))(`Hide`)),1)])):f(i)&&f(i).state===`installed`?(_(),v(`div`,Cp,[I(`span`,wp,M((`tl`in t?t.tl:f(Z))(`Codex ${f(i).latest} installed`,`Codex ${f(i).latest} installé`))+` ·`,1),I(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly||!(`canRestart`in t?t.canRestart:f(de))(e.pane),title:(`tl`in t?t.tl:f(Z))(`Restarts Codex in this pane on the same conversation (codex resume)`,`Relance Codex dans ce panneau sur la même conversation (codex resume)`),onClick:n[0]||=n=>(`restartAgent`in t?t.restartAgent:f(ie))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Q))(`Restart to update`)),1)],8,Tp)])):f(i)?(_(),v(`div`,Ep,[I(`span`,{class:`restart-text`,title:f(l)},[a(M((`tl`in t?t.tl:f(Z))(`Codex ${f(i).latest} available`,`Codex ${f(i).latest} disponible`)),1),f(i).current?(_(),v(`span`,Op,M(` `)+M((`tl`in t?t.tl:f(Z))(`(you have ${f(i).current})`,`(tu as la ${f(i).current})`)),1)):g(``,!0),n[2]||=a(` ·`,-1)],8,Dp),I(`a`,{class:`notice-btn`,href:f(i).notes,target:`_blank`,rel:`noopener noreferrer`,"aria-label":(`t`in t?t.t:f(Q))(`Release notes`),title:(`t`in t?t.t:f(Q))(`Release notes`)},[E(r,{name:`i-lucide-external-link`}),I(`span`,Ap,M((`t`in t?t.t:f(Q))(`Release notes`)),1)],8,kp),f(i).runnable?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||!!f(m),title:f(m)||(f(i).method===`terminal`?(`tl`in t?t.tl:f(Z))(`Exits Codex, updates it in this pane’s terminal, then resumes this conversation`,`Quitte Codex, le met à jour dans le terminal de ce panneau, puis reprend cette conversation`):void 0),onClick:y},[E(r,{name:`i-lucide-circle-arrow-up`}),a(M((`t`in t?t.t:f(Q))(`Update`)),1)],8,jp)):f(i).command?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)])):g(``,!0),f(m)?(_(),v(`span`,Mp,M(e.pane.status===`blocked`?(`tl`in t?t.tl:f(Z))(`answer first`,`réponds d’abord`):(`tl`in t?t.tl:f(Z))(`after this turn`,`après ce tour`)),1)):g(``,!0),I(`button`,{type:`button`,class:`notice-btn notice-x`,"aria-label":(`t`in t?t.t:f(Q))(`Hide until the next version`),title:(`t`in t?t.t:f(Q))(`Hide until the next version`),onClick:d},[E(r,{name:`i-lucide-x`})],8,Np)])):g(``,!0),f(o)?(_(),v(`div`,{key:4,class:j([`composer-notice codex-weekly`,{low:f(o).left<=10}]),role:`status`},[E(r,{name:`i-lucide-triangle-alert`,class:`notice-icon`}),I(`span`,{class:`restart-text`,title:f(u)},M(f(u)),9,Pp),I(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly,title:(`t`in t?t.t:f(Q))(`Show Codex’s usage breakdown`),onClick:x},`/status`,8,Fp)],2)):g(``,!0)],64)}}}),{__name:`CodexNotices`}),Rp=e=>e.toLowerCase().replace(/\bwith 1m context\b/g,`(1m)`).replace(/\b1m context\b/g,`1m`).replace(/\s*\((?:default|current)\)/g,``).replace(/\s+/g,` `).trim();function zp(e,t){if(!t)return!1;if(t.id&&e.label.includes(`/`))return e.label===t.id;let n=Rp(t.label);if(Rp(e.label)===n)return!0;let r=e.hint?.split(`·`)[0]?.trim()||``;return!!r&&Rp(r)===n}function Bp(e,t){let n=e.findIndex(e=>!/^default\b/i.test(e.label)&&zp(e,t));return n>=0?n:e.findIndex(e=>zp(e,t))}var Vp={key:0,class:`model-pick-none`,role:`status`},Hp={class:`model-pick-wrap`},Up={class:`model-name`},Wp={class:`model-pick-wrap`},Gp=Object.assign(T({__name:`ModelPicker`,props:V({pane:{},launch:{}},{model:{default:null},modelModifiers:{},effort:{default:null},effortModifiers:{}}),emits:[`update:model`,`update:effort`],setup(e){let t=e,r=D(e,`model`),i=D(e,`effort`),o=h(!1),s=h(!1),c=h(!1),l=h(!1),u=h(!1),d=h(null),p=h(null),y=h(null),b=e=>String(e||``).trim().toLowerCase(),x=(e,t)=>!!(e&&t)&&b(e)===b(t),S=n(()=>{if(!t.pane)return null;let e=y.value;if(e&&Date.now()-e.at<2e4&&(!x(t.pane.model?.label,e.info.label)||t.pane.model?.effort!==e.info.effort))return e.info;let n=t.pane.model;return n?{...n,effort:n.effort||p.value?.current||null}:null});B(()=>[t.pane?.model?.label,t.pane?.model?.effort],()=>{t.pane&&y.value&&x(t.pane.model?.label,y.value.info.label)&&t.pane.model?.effort===y.value.info.effort&&(y.value=null)});let w=n(()=>{if(t.launch)return null;if(!Fr.value||mr.value||qr(t.pane))return Q(`Changes unavailable offline`);let e=t.pane.status;return e===`working`?Q(`The agent is working — change the model once it’s done.`):e===`blocked`?Q(`The agent is waiting for an answer — reply first.`):null}),T=n(()=>!!w.value||u.value);async function O(e=!1){if(!c.value){c.value=!0;try{d.value=await fi(`/api/models?pane=${encodeURIComponent(t.pane.id)}${e?`&refresh=1`:``}`)}catch(e){o.value=!1,$(e.message,!0)}finally{c.value=!1}}}async function A(){if(!l.value){l.value=!0;try{p.value=await fi(`/api/efforts?pane=${encodeURIComponent(t.pane.id)}`)}catch(e){s.value=!1,$(e.message,!0)}finally{l.value=!1}}}B(o,e=>{t.launch||e&&(!d.value||d.value.agent!==t.pane.agent)&&O()}),B(s,e=>{e&&!p.value&&!t.launch&&A()}),B(()=>[Fr.value,t.pane?.status,t.pane?.model?.label,t.pane?.model?.effort],()=>{t.pane&&[`claude`,`codex`,`omp`].includes(t.pane.agent||``)&&[`idle`,`done`].includes(t.pane.status||``)&&!t.pane.model?.effort&&t.pane.model&&!p.value&&!w.value&&A()},{immediate:!0}),B(()=>t.pane?.id,()=>{d.value=null,p.value=null,y.value=null});let N=n(()=>Bp(d.value?.options||[],S.value)),P=e=>d.value?.options.indexOf(e)===N.value,F=e=>/^default \(recommended\)$/i.test(e.label)?Q(`Default (recommended)`):e.label;async function L(e){if(!(P(e)||T.value)){u.value=!0,X();try{let n=await fi(`/api/model`,{pane_id:t.pane.id,label:e.label});y.value={info:n.model,at:Date.now()},p.value=null,$(Z(`Model: ${n.model.label} (this session)`,`Modèle : ${n.model.label} (cette session)`))}catch(e){$(e.message,!0)}finally{u.value=!1}w.value||await A()}}async function V(e){if(!(T.value||S.value?.effort===e)){u.value=!0,X();try{let n=await fi(`/api/effort`,{pane_id:t.pane.id,level:e});y.value={info:n.model,at:Date.now()},p.value&&(p.value.current=e),$(Z(`Effort: ${e} (this session)`,`Effort : ${e} (cette session)`))}catch(e){$(e.message,!0)}finally{u.value=!1}t.pane.agent===`omp`&&!w.value&&await A()}}let U=n(()=>{let e=[{type:`label`,label:Q(`For this session only`)}];return c.value||!d.value?[e,[{label:Q(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,d.value.options.map(e=>({type:`checkbox`,label:F(e),description:e.hint||void 0,checked:P(e),onSelect:()=>L(e)})),[{label:Q(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),O(!0)}}]]}),ee=n(()=>{let e=[{type:`label`,label:Q(`For this session only`)}];return l.value||!p.value?[e,[{label:Q(`Reading effort levels…`),icon:`i-lucide-loader-circle`,disabled:!0}]]:[e,p.value.levels.map(e=>({type:`checkbox`,label:e,checked:S.value?.effort===e,description:e===`auto`?S.value?.effort===`auto`&&S.value.effortResolved?Z(`This turn: ${S.value.effortResolved}`,`Ce tour : ${S.value.effortResolved}`):t.pane.agent===`omp`?Q(`Picks the level each turn`):void 0:void 0,onSelect:()=>V(e)}))]}),W=n(()=>{let e=S.value;return e?.effort?e.effort===`auto`&&e.effortResolved?`auto · ${e.effortResolved}`:e.effort:null}),te=n(()=>[`claude`,`codex`,`omp`].includes(t.pane?.agent||``)&&!!(p.value?.levels.length||S.value?.effort&&!p.value)),G=h(null),ne=h(!1),K=0;async function re(e=!1){let n=t.launch;if(!n)return;let r=++K;c.value=!0,ne.value=!1;try{let t=await fi(`/api/tasks/models?machine=${encodeURIComponent(n.machine)}&program=${encodeURIComponent(n.program)}${e?`&refresh=1`:``}`);r===K&&(G.value=t,ne.value=!t.models.length)}catch{r===K&&(G.value=null,ne.value=!0)}finally{r===K&&(c.value=!1)}}B(()=>t.launch&&`${t.launch.machine}|${t.launch.program}`,e=>{G.value=null,r.value=null,i.value=null,e&&re()},{immediate:!0});let q=n(()=>Oe(G.value,r.value));B(q,e=>{i.value&&!e.includes(i.value)&&(i.value=null)});let ie=n(()=>{let e=[{type:`label`,label:Q(`For this start only`)}];return c.value||!G.value?[e,[{label:Q(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,[{type:`checkbox`,label:Q(`Program’s default`),checked:!r.value,onSelect:()=>{r.value=null}},...G.value.models.map(e=>({type:`checkbox`,label:e,checked:r.value===e,onSelect:()=>{r.value=e}}))],[{label:Q(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),re(!0)}}]]}),ae=n(()=>[[{type:`label`,label:Q(`For this start only`)}],[{type:`checkbox`,label:Q(`Model’s default`),checked:!i.value,onSelect:()=>{i.value=null}},...q.value.map(e=>({type:`checkbox`,label:e,checked:i.value===e,onSelect:()=>{i.value=e}}))]]),oe=n(()=>t.launch?ie.value:U.value),se=n(()=>t.launch?ae.value:ee.value),ce=n(()=>t.launch?r.value||Q(`Model`):S.value?S.value.label:Q(`Model`)),le=n(()=>t.launch?i.value:W.value),ue=n(()=>t.launch?!!q.value.length:te.value),de=n(()=>!t.launch||!ne.value),fe=lt,pe=n(()=>t.launch?`span`:fe),me=n(()=>t.launch?{}:{text:w.value||Q(`Change model`),disabled:!Mr.value||!w.value&&o.value,content:{side:`top`}}),he=n(()=>t.launch?{}:{text:w.value||Q(`Change effort`),disabled:!Mr.value||!w.value&&s.value,content:{side:`top`}});function ge(e,t){if(t&&T.value){w.value&&$(w.value,!0);return}e===`model`?(o.value=t,t&&(s.value=!1)):(s.value=t,t&&(o.value=!1))}return B(T,e=>{e&&(o.value=!1,s.value=!1)}),(t,n)=>{let i=Et,c=qt;return _(),v(k,null,[f(de)?g(``,!0):(_(),v(`span`,Vp,M((`t`in t?t.t:f(Q))(`Models could not be read: Start uses the program alone.`)),1)),f(de)?(_(),m(C(f(pe)),R(z({key:1},f(me))),{default:H(()=>[I(`span`,Hp,[E(c,{open:f(o),items:f(oe),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu${e.launch?` z-[30]`:``}`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":n[0]||=e=>ge(`model`,e)},{default:H(()=>[E(i,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick`,{off:f(T)}]),"aria-disabled":f(T),"aria-label":`${(`t`in t?t.t:f(Q))(`Model`)} : ${e.launch?r.value||(`t`in t?t.t:f(Q))(`Program’s default`):f(S)?f(S).label:(`t`in t?t.t:f(Q))(`Unknown model`)}`,"trailing-icon":f(u)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(u)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[I(`span`,Up,M(f(ce)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`,`ui`])])]),_:1},16)):g(``,!0),f(ue)?(_(),m(C(f(pe)),R(z({key:2},f(he))),{default:H(()=>[I(`span`,Wp,[E(c,{open:f(s),items:f(se),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu effort-menu${e.launch?` z-[30]`:``}`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":n[1]||=e=>ge(`effort`,e)},{default:H(()=>[E(i,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick effort-pick`,{off:f(T)}]),"aria-disabled":f(T),"aria-label":`${(`t`in t?t.t:f(Q))(`Effort`)} : ${f(le)||(e.launch?(`t`in t?t.t:f(Q))(`Model’s default`):(`t`in t?t.t:f(Q))(`Unknown effort`))}`,"trailing-icon":f(u)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(u)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[a(M(f(le)||(`t`in t?t.t:f(Q))(`Effort`)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`,`ui`])])]),_:1},16)):g(``,!0)],64)}}}),{__name:`ModelPicker`}),Kp={slots:{base:``}},qp=Object.assign({inheritAttrs:!1},{__name:`UChatPromptSubmit`,props:{status:{type:String,required:!1,default:`ready`},icon:{type:[String,Boolean],required:!1,skipCheck:!0},color:{type:null,required:!1},variant:{type:null,required:!1},streamingIcon:{type:null,required:!1},streamingColor:{type:null,required:!1,default:`neutral`},streamingVariant:{type:null,required:!1,default:`subtle`},submittedIcon:{type:null,required:!1},submittedColor:{type:null,required:!1,default:`neutral`},submittedVariant:{type:null,required:!1,default:`subtle`},errorIcon:{type:null,required:!1},errorColor:{type:null,required:!1,default:`error`},errorVariant:{type:null,required:!1,default:`soft`},ui:{type:Object,required:!1},class:{type:null,required:!1},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},emits:[`stop`,`reload`],setup(e,{emit:r}){let i=e,a=r,o=O(),s=oe(`chatPromptSubmit`,i),{t:c}=$t(),l=Jn(),u=we(It(s,`icon`,`color`,`variant`,`status`,`disabled`,`streamingIcon`,`streamingColor`,`streamingVariant`,`submittedIcon`,`submittedColor`,`submittedVariant`,`errorIcon`,`errorColor`,`errorVariant`,`class`,`ui`)),p=n(()=>s.status===`ready`&&s.disabled),h=n(()=>({ready:{icon:s.icon===!1?void 0:s.icon??l.ui.icons.arrowUp,color:s.color,variant:s.variant,type:`submit`},submitted:{icon:s.submittedIcon||l.ui.icons.stop,color:s.submittedColor,variant:s.submittedVariant,onClick(e){a(`stop`,e)}},streaming:{icon:s.streamingIcon||l.ui.icons.stop,color:s.streamingColor,variant:s.streamingVariant,onClick(e){a(`stop`,e)}},error:{icon:s.errorIcon||l.ui.icons.reload,color:s.errorColor,variant:s.errorVariant,onClick(e){a(`reload`,e)}}})[s.status]),g=n(()=>Pe({extend:Kp,...l.ui?.chatPromptSubmit||{}})());return(e,n)=>(_(),m(Et,z({...f(u),...h.value,disabled:p.value,"aria-label":f(c)(`chatPromptSubmit.label`),...e.$attrs},{class:g.value.base({class:[f(s).ui?.base,f(s).class]}),ui:f(ae)(g.value,f(s).ui)}),x({_:2},[y(o,(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,R(t(n)))])}))]),1040,[`class`,`ui`]))}});function Jp(e){let t=!1;function n(e){return e.isComposing||e.keyCode===229}function r(r){t||n(r)||(r.preventDefault(),e(r))}let i;function a(){clearTimeout(i),t=!0,i=setTimeout(()=>{t=!1},50)}return{onKeydown:r,onCompositionEnd:a}}var Yp={slots:{root:`relative flex flex-col items-stretch gap-2 px-2.5 py-2 w-full rounded-lg backdrop-blur-sm`,header:`flex items-center gap-1.5`,body:`items-start gap-1.5`,footer:`flex items-center justify-between gap-1.5`,base:`px-0`},variants:{color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{outline:{root:`bg-default/75 ring ring-default`},soft:{root:`bg-elevated/50`},subtle:{root:`bg-elevated/50 ring ring-default`},naked:{root:``}}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-primary has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-primary`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-neutral has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-neutral`}},{color:`success`,variant:[`outline`,`subtle`],class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-success has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-success`}},{color:`warning`,variant:[`outline`,`subtle`],class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-warning has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-warning`}},{color:`error`,variant:[`outline`,`subtle`],class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-error has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-error`}},{color:`info`,variant:[`outline`,`subtle`],class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-info has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-info`}},{color:`primary`,variant:`soft`,class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:`soft`,class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`success`,variant:`soft`,class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`warning`,variant:`soft`,class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`error`,variant:`soft`,class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`info`,variant:`soft`,class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-inverted has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-inverted`}},{color:`neutral`,variant:`soft`,class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}}],defaultVariants:{color:`primary`,variant:`outline`}},Xp=Object.assign({inheritAttrs:!1},{__name:`UChatPrompt`,props:V({as:{type:null,required:!1,default:`form`},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},submitOnEnter:{type:Boolean,required:!1,default:!0},error:{type:Error,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},rows:{type:Number,required:!1,default:1},autofocus:{type:Boolean,required:!1,default:!0},autofocusDelay:{type:Number,required:!1},autoresize:{type:Boolean,required:!1,default:!0},autoresizeDelay:{type:Number,required:!1},maxrows:{type:Number,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},disabled:{type:Boolean,required:!1}},{modelValue:{type:String,default:``},modelModifiers:{}}),emits:V([`submit`,`close`],[`update:modelValue`]),setup(e,{expose:r,emit:i}){let a=e,o=i,s=O(),c=oe(`chatPrompt`,a),l=D(e,`modelValue`,{type:String,default:``}),{t:u}=$t(),p=Jn(),h=we(ze(c,`rows`,`autofocus`,`autofocusDelay`,`autoresize`,`autoresizeDelay`,`maxrows`,`icon`,`avatar`,`loading`,`loadingIcon`)),C=()=>et(s,[`header`,`footer`,`body`]),w=n(()=>Pe({extend:Yp,...p.ui?.chatPrompt||{}})({color:c.color,variant:c.variant})),T=b(`textareaRef`);function k(e){l.value.trim()!==``&&o(`submit`,e??new Event(`submit`))}function A(e){T.value?.textareaRef?.blur(),o(`close`,e??new Event(`close`))}let{onKeydown:M,onCompositionEnd:N}=Jp(e=>{k(e)});function P(e){if(c.submitOnEnter){if(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)return}else if(!e.ctrlKey&&!e.metaKey)return;M(e)}function F(e){e.key===`Enter`?P(e):e.key===`Escape`&&A(e)}return r({textareaRef:S(()=>T.value?.textareaRef)}),(e,n)=>(_(),m(f(gt),{as:f(c).as,"data-slot":e.$attrs[`data-slot`]??`root`,class:j(w.value.root({class:[f(c).ui?.root,f(c).class]})),onSubmit:q(k,[`prevent`])},{default:H(()=>[s.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(w.value.header({class:f(c).ui?.header}))},[d(e.$slots,`header`)],2)):g(``,!0),d(e.$slots,`body`,{submit:k,close:A,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,ui:w.value},()=>[E(vn,z({ref_key:`textareaRef`,ref:T,modelValue:l.value,"onUpdate:modelValue":n[0]||=e=>l.value=e,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,variant:`none`,fixed:``},{...f(h),...e.$attrs},{ui:f(ae)(f(et)(w.value,[`root`,`body`,`header`,`footer`]),f(c).ui),"data-slot":`body`,class:w.value.body({class:f(c).ui?.body}),onKeydown:F,onCompositionend:f(N)}),x({_:2},[y(C(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,R(t(n)))])}))]),1040,[`modelValue`,`placeholder`,`disabled`,`ui`,`class`,`onCompositionend`])]),s.footer?(_(),v(`div`,{key:1,"data-slot":`footer`,class:j(w.value.footer({class:f(c).ui?.footer}))},[d(e.$slots,`footer`)],2)):g(``,!0)]),_:3},8,[`as`,`data-slot`,`class`]))}}),Zp=e=>e.split(`
83
- `).filter(e=>!vi(e)).join(`
84
- `).trim();function Qp(e,t){let n=Zp(t);return!n||e.at(-1)===n?e:[...e,n].slice(-100)}function $p(e,t){return e.defaultPrevented||e.isComposing||e.keyCode===229||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||t.start!==t.end?null:e.key===`ArrowUp`&&!t.text.slice(0,t.start).includes(`
82
+ `),Q(`Update`),`primary`))){X();try{await _i(`/api/codex-update`,{pane_id:t.paneId})}catch(e){$(e.message,!0)}}}async function b(){try{await _i(`/api/codex-update`,{pane_id:t.paneId,dismiss:!0})}catch(e){$(e.message,!0)}}async function x(){try{await _i(`/api/prompt`,{pane_id:t.paneId,text:`/status`}),X()}catch(e){return $(e.message,!0)}Te(t.paneId,`/status`)}return(t,n)=>{let r=qe;return _(),v(k,null,[f(i)&&f(s)?.phase===`running`?(_(),v(`div`,xp,[n[1]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,Sp,M((`tl`in t?t.tl:f(Z))(`Updating Codex on ${f(c)}…`,`Mise à jour de Codex sur ${f(c)}…`)),1)])):f(i)&&f(s)?.phase===`failed`?(_(),v(`div`,Cp,[I(`span`,wp,M((`t`in t?t.t:f(Q))(`Codex update failed`))+M((`tl`in t?t.tl:f(Z))(`: `,` : `))+M((`t`in t?t.t:f(Q))(f(s).error)),1),f(i).command?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)])):g(``,!0),I(`button`,{type:`button`,class:`notice-btn`,onClick:b},M((`t`in t?t.t:f(Q))(`Hide`)),1)])):f(i)&&f(i).state===`installed`?(_(),v(`div`,Tp,[I(`span`,Ep,M((`tl`in t?t.tl:f(Z))(`Codex ${f(i).latest} installed`,`Codex ${f(i).latest} installé`))+` ·`,1),I(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly||!(`canRestart`in t?t.canRestart:f(ue))(e.pane),title:(`tl`in t?t.tl:f(Z))(`Restarts Codex in this pane on the same conversation (codex resume)`,`Relance Codex dans ce panneau sur la même conversation (codex resume)`),onClick:n[0]||=n=>(`restartAgent`in t?t.restartAgent:f(ie))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Q))(`Restart to update`)),1)],8,Dp)])):f(i)?(_(),v(`div`,Op,[I(`span`,{class:`restart-text`,title:f(l)},[a(M((`tl`in t?t.tl:f(Z))(`Codex ${f(i).latest} available`,`Codex ${f(i).latest} disponible`)),1),f(i).current?(_(),v(`span`,Ap,M(` `)+M((`tl`in t?t.tl:f(Z))(`(you have ${f(i).current})`,`(tu as la ${f(i).current})`)),1)):g(``,!0),n[2]||=a(` ·`,-1)],8,kp),I(`a`,{class:`notice-btn`,href:f(i).notes,target:`_blank`,rel:`noopener noreferrer`,"aria-label":(`t`in t?t.t:f(Q))(`Release notes`),title:(`t`in t?t.t:f(Q))(`Release notes`)},[E(r,{name:`i-lucide-external-link`}),I(`span`,Mp,M((`t`in t?t.t:f(Q))(`Release notes`)),1)],8,jp),f(i).runnable?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||!!f(m),title:f(m)||(f(i).method===`terminal`?(`tl`in t?t.tl:f(Z))(`Exits Codex, updates it in this pane’s terminal, then resumes this conversation`,`Quitte Codex, le met à jour dans le terminal de ce panneau, puis reprend cette conversation`):void 0),onClick:y},[E(r,{name:`i-lucide-circle-arrow-up`}),a(M((`t`in t?t.t:f(Q))(`Update`)),1)],8,Np)):f(i).command?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)])):g(``,!0),f(m)?(_(),v(`span`,Pp,M(e.pane.status===`blocked`?(`tl`in t?t.tl:f(Z))(`answer first`,`réponds d’abord`):(`tl`in t?t.tl:f(Z))(`after this turn`,`après ce tour`)),1)):g(``,!0),I(`button`,{type:`button`,class:`notice-btn notice-x`,"aria-label":(`t`in t?t.t:f(Q))(`Hide until the next version`),title:(`t`in t?t.t:f(Q))(`Hide until the next version`),onClick:d},[E(r,{name:`i-lucide-x`})],8,Fp)])):g(``,!0),f(o)?(_(),v(`div`,{key:4,class:j([`composer-notice codex-weekly`,{low:f(o).left<=10}]),role:`status`},[E(r,{name:`i-lucide-triangle-alert`,class:`notice-icon`}),I(`span`,{class:`restart-text`,title:f(u)},M(f(u)),9,Ip),I(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly,title:(`t`in t?t.t:f(Q))(`Show Codex’s usage breakdown`),onClick:x},`/status`,8,Lp)],2)):g(``,!0)],64)}}}),{__name:`CodexNotices`}),Bp=e=>e.toLowerCase().replace(/\bwith 1m context\b/g,`(1m)`).replace(/\b1m context\b/g,`1m`).replace(/\s*\((?:default|current)\)/g,``).replace(/\s+/g,` `).trim();function Vp(e,t){if(!t)return!1;if(t.id&&e.label.includes(`/`))return e.label===t.id;let n=Bp(t.label);if(Bp(e.label)===n)return!0;let r=e.hint?.split(`·`)[0]?.trim()||``;return!!r&&Bp(r)===n}function Hp(e,t){let n=e.findIndex(e=>!/^default\b/i.test(e.label)&&Vp(e,t));return n>=0?n:e.findIndex(e=>Vp(e,t))}var Up={key:0,class:`model-pick-none`,role:`status`},Wp={class:`model-pick-wrap`},Gp={class:`model-name`},Kp={class:`model-pick-wrap`},qp=Object.assign(T({__name:`ModelPicker`,props:V({pane:{},launch:{}},{model:{default:null},modelModifiers:{},effort:{default:null},effortModifiers:{}}),emits:[`update:model`,`update:effort`],setup(e){let t=e,r=D(e,`model`),i=D(e,`effort`),o=h(!1),s=h(!1),c=h(!1),l=h(!1),u=h(!1),d=h(null),p=h(null),y=h(null),b=e=>String(e||``).trim().toLowerCase(),x=(e,t)=>!!(e&&t)&&b(e)===b(t),S=n(()=>{if(!t.pane)return null;let e=y.value;if(e&&Date.now()-e.at<2e4&&(!x(t.pane.model?.label,e.info.label)||t.pane.model?.effort!==e.info.effort))return e.info;let n=t.pane.model;return n?{...n,effort:n.effort||p.value?.current||null}:null});B(()=>[t.pane?.model?.label,t.pane?.model?.effort],()=>{t.pane&&y.value&&x(t.pane.model?.label,y.value.info.label)&&t.pane.model?.effort===y.value.info.effort&&(y.value=null)});let w=n(()=>{if(t.launch)return null;if(!Br.value||br.value||Qr(t.pane))return Q(`Changes unavailable offline`);let e=t.pane.status;return e===`working`?Q(`The agent is working — change the model once it’s done.`):e===`blocked`?Q(`The agent is waiting for an answer — reply first.`):null}),T=n(()=>!!w.value||u.value);async function O(e=!1){if(!c.value){c.value=!0;try{d.value=await _i(`/api/models?pane=${encodeURIComponent(t.pane.id)}${e?`&refresh=1`:``}`)}catch(e){o.value=!1,$(e.message,!0)}finally{c.value=!1}}}async function A(){if(!l.value){l.value=!0;try{p.value=await _i(`/api/efforts?pane=${encodeURIComponent(t.pane.id)}`)}catch(e){s.value=!1,$(e.message,!0)}finally{l.value=!1}}}B(o,e=>{t.launch||e&&(!d.value||d.value.agent!==t.pane.agent)&&O()}),B(s,e=>{e&&!p.value&&!t.launch&&A()}),B(()=>[Br.value,t.pane?.status,t.pane?.model?.label,t.pane?.model?.effort],()=>{t.pane&&[`claude`,`codex`,`omp`].includes(t.pane.agent||``)&&[`idle`,`done`].includes(t.pane.status||``)&&!t.pane.model?.effort&&t.pane.model&&!p.value&&!w.value&&A()},{immediate:!0}),B(()=>t.pane?.id,()=>{d.value=null,p.value=null,y.value=null});let N=n(()=>Hp(d.value?.options||[],S.value)),P=e=>d.value?.options.indexOf(e)===N.value,F=e=>/^default \(recommended\)$/i.test(e.label)?Q(`Default (recommended)`):e.label;async function L(e){if(!(P(e)||T.value)){u.value=!0,X();try{let n=await _i(`/api/model`,{pane_id:t.pane.id,label:e.label});y.value={info:n.model,at:Date.now()},p.value=null,$(Z(`Model: ${n.model.label} (this session)`,`Modèle : ${n.model.label} (cette session)`))}catch(e){$(e.message,!0)}finally{u.value=!1}w.value||await A()}}async function V(e){if(!(T.value||S.value?.effort===e)){u.value=!0,X();try{let n=await _i(`/api/effort`,{pane_id:t.pane.id,level:e});y.value={info:n.model,at:Date.now()},p.value&&(p.value.current=e),$(Z(`Effort: ${e} (this session)`,`Effort : ${e} (cette session)`))}catch(e){$(e.message,!0)}finally{u.value=!1}t.pane.agent===`omp`&&!w.value&&await A()}}let U=n(()=>{let e=[{type:`label`,label:Q(`For this session only`)}];return c.value||!d.value?[e,[{label:Q(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,d.value.options.map(e=>({type:`checkbox`,label:F(e),description:e.hint||void 0,checked:P(e),onSelect:()=>L(e)})),[{label:Q(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),O(!0)}}]]}),ee=n(()=>{let e=[{type:`label`,label:Q(`For this session only`)}];return l.value||!p.value?[e,[{label:Q(`Reading effort levels…`),icon:`i-lucide-loader-circle`,disabled:!0}]]:[e,p.value.levels.map(e=>({type:`checkbox`,label:e,checked:S.value?.effort===e,description:e===`auto`?S.value?.effort===`auto`&&S.value.effortResolved?Z(`This turn: ${S.value.effortResolved}`,`Ce tour : ${S.value.effortResolved}`):t.pane.agent===`omp`?Q(`Picks the level each turn`):void 0:void 0,onSelect:()=>V(e)}))]}),W=n(()=>{let e=S.value;return e?.effort?e.effort===`auto`&&e.effortResolved?`auto · ${e.effortResolved}`:e.effort:null}),te=n(()=>[`claude`,`codex`,`omp`].includes(t.pane?.agent||``)&&!!(p.value?.levels.length||S.value?.effort&&!p.value)),G=h(null),ne=h(!1),K=0;async function re(e=!1){let n=t.launch;if(!n)return;let r=++K;c.value=!0,ne.value=!1;try{let t=await _i(`/api/tasks/models?machine=${encodeURIComponent(n.machine)}&program=${encodeURIComponent(n.program)}${e?`&refresh=1`:``}`);r===K&&(G.value=t,ne.value=!t.models.length)}catch{r===K&&(G.value=null,ne.value=!0)}finally{r===K&&(c.value=!1)}}B(()=>t.launch&&`${t.launch.machine}|${t.launch.program}`,e=>{G.value=null,r.value=null,i.value=null,e&&re()},{immediate:!0});let q=n(()=>De(G.value,r.value));B(q,e=>{i.value&&!e.includes(i.value)&&(i.value=null)});let ie=n(()=>{let e=[{type:`label`,label:Q(`For this start only`)}];return c.value||!G.value?[e,[{label:Q(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,[{type:`checkbox`,label:Q(`Program’s default`),checked:!r.value,onSelect:()=>{r.value=null}},...G.value.models.map(e=>({type:`checkbox`,label:e,checked:r.value===e,onSelect:()=>{r.value=e}}))],[{label:Q(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),re(!0)}}]]}),ae=n(()=>[[{type:`label`,label:Q(`For this start only`)}],[{type:`checkbox`,label:Q(`Model’s default`),checked:!i.value,onSelect:()=>{i.value=null}},...q.value.map(e=>({type:`checkbox`,label:e,checked:i.value===e,onSelect:()=>{i.value=e}}))]]),J=n(()=>t.launch?ie.value:U.value),oe=n(()=>t.launch?ae.value:ee.value),se=n(()=>t.launch?r.value||Q(`Model`):S.value?S.value.label:Q(`Model`)),ce=n(()=>t.launch?i.value:W.value),le=n(()=>t.launch?!!q.value.length:te.value),ue=n(()=>!t.launch||!ne.value),de=ct,fe=n(()=>t.launch?`span`:de),pe=n(()=>t.launch?{}:{text:w.value||Q(`Change model`),disabled:!Lr.value||!w.value&&o.value,content:{side:`top`}}),me=n(()=>t.launch?{}:{text:w.value||Q(`Change effort`),disabled:!Lr.value||!w.value&&s.value,content:{side:`top`}});function he(e,t){if(t&&T.value){w.value&&$(w.value,!0);return}e===`model`?(o.value=t,t&&(s.value=!1)):(s.value=t,t&&(o.value=!1))}return B(T,e=>{e&&(o.value=!1,s.value=!1)}),(t,n)=>{let i=Et,c=cn;return _(),v(k,null,[f(ue)?g(``,!0):(_(),v(`span`,Up,M((`t`in t?t.t:f(Q))(`Models could not be read: Start uses the program alone.`)),1)),f(ue)?(_(),m(C(f(fe)),R(z({key:1},f(pe))),{default:H(()=>[I(`span`,Wp,[E(c,{open:f(o),items:f(J),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu${e.launch?` z-[30]`:``}`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":n[0]||=e=>he(`model`,e)},{default:H(()=>[E(i,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick`,{off:f(T)}]),"aria-disabled":f(T),"aria-label":`${(`t`in t?t.t:f(Q))(`Model`)} : ${e.launch?r.value||(`t`in t?t.t:f(Q))(`Program’s default`):f(S)?f(S).label:(`t`in t?t.t:f(Q))(`Unknown model`)}`,"trailing-icon":f(u)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(u)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[I(`span`,Gp,M(f(se)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`,`ui`])])]),_:1},16)):g(``,!0),f(le)?(_(),m(C(f(fe)),R(z({key:2},f(me))),{default:H(()=>[I(`span`,Kp,[E(c,{open:f(s),items:f(oe),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu effort-menu${e.launch?` z-[30]`:``}`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":n[1]||=e=>he(`effort`,e)},{default:H(()=>[E(i,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick effort-pick`,{off:f(T)}]),"aria-disabled":f(T),"aria-label":`${(`t`in t?t.t:f(Q))(`Effort`)} : ${f(ce)||(e.launch?(`t`in t?t.t:f(Q))(`Model’s default`):(`t`in t?t.t:f(Q))(`Unknown effort`))}`,"trailing-icon":f(u)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(u)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[a(M(f(ce)||(`t`in t?t.t:f(Q))(`Effort`)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`,`ui`])])]),_:1},16)):g(``,!0)],64)}}}),{__name:`ModelPicker`}),Jp={slots:{base:``}},Yp=Object.assign({inheritAttrs:!1},{__name:`UChatPromptSubmit`,props:{status:{type:String,required:!1,default:`ready`},icon:{type:[String,Boolean],required:!1,skipCheck:!0},color:{type:null,required:!1},variant:{type:null,required:!1},streamingIcon:{type:null,required:!1},streamingColor:{type:null,required:!1,default:`neutral`},streamingVariant:{type:null,required:!1,default:`subtle`},submittedIcon:{type:null,required:!1},submittedColor:{type:null,required:!1,default:`neutral`},submittedVariant:{type:null,required:!1,default:`subtle`},errorIcon:{type:null,required:!1},errorColor:{type:null,required:!1,default:`error`},errorVariant:{type:null,required:!1,default:`soft`},ui:{type:Object,required:!1},class:{type:null,required:!1},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},emits:[`stop`,`reload`],setup(e,{emit:r}){let i=e,a=r,o=O(),s=J(`chatPromptSubmit`,i),{t:c}=ln(),l=$n(),u=Ce(It(s,`icon`,`color`,`variant`,`status`,`disabled`,`streamingIcon`,`streamingColor`,`streamingVariant`,`submittedIcon`,`submittedColor`,`submittedVariant`,`errorIcon`,`errorColor`,`errorVariant`,`class`,`ui`)),p=n(()=>s.status===`ready`&&s.disabled),h=n(()=>({ready:{icon:s.icon===!1?void 0:s.icon??l.ui.icons.arrowUp,color:s.color,variant:s.variant,type:`submit`},submitted:{icon:s.submittedIcon||l.ui.icons.stop,color:s.submittedColor,variant:s.submittedVariant,onClick(e){a(`stop`,e)}},streaming:{icon:s.streamingIcon||l.ui.icons.stop,color:s.streamingColor,variant:s.streamingVariant,onClick(e){a(`stop`,e)}},error:{icon:s.errorIcon||l.ui.icons.reload,color:s.errorColor,variant:s.errorVariant,onClick(e){a(`reload`,e)}}})[s.status]),g=n(()=>Ne({extend:Jp,...l.ui?.chatPromptSubmit||{}})());return(e,n)=>(_(),m(Et,z({...f(u),...h.value,disabled:p.value,"aria-label":f(c)(`chatPromptSubmit.label`),...e.$attrs},{class:g.value.base({class:[f(s).ui?.base,f(s).class]}),ui:f(ae)(g.value,f(s).ui)}),x({_:2},[y(o,(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,R(t(n)))])}))]),1040,[`class`,`ui`]))}});function Xp(e){let t=!1;function n(e){return e.isComposing||e.keyCode===229}function r(r){t||n(r)||(r.preventDefault(),e(r))}let i;function a(){clearTimeout(i),t=!0,i=setTimeout(()=>{t=!1},50)}return{onKeydown:r,onCompositionEnd:a}}var Zp={slots:{root:`relative flex flex-col items-stretch gap-2 px-2.5 py-2 w-full rounded-lg backdrop-blur-sm`,header:`flex items-center gap-1.5`,body:`items-start gap-1.5`,footer:`flex items-center justify-between gap-1.5`,base:`px-0`},variants:{color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{outline:{root:`bg-default/75 ring ring-default`},soft:{root:`bg-elevated/50`},subtle:{root:`bg-elevated/50 ring ring-default`},naked:{root:``}}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-primary has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-primary`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-neutral has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-neutral`}},{color:`success`,variant:[`outline`,`subtle`],class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-success has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-success`}},{color:`warning`,variant:[`outline`,`subtle`],class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-warning has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-warning`}},{color:`error`,variant:[`outline`,`subtle`],class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-error has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-error`}},{color:`info`,variant:[`outline`,`subtle`],class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-info has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-info`}},{color:`primary`,variant:`soft`,class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:`soft`,class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`success`,variant:`soft`,class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`warning`,variant:`soft`,class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`error`,variant:`soft`,class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`info`,variant:`soft`,class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-inverted has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-inverted`}},{color:`neutral`,variant:`soft`,class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}}],defaultVariants:{color:`primary`,variant:`outline`}},Qp=Object.assign({inheritAttrs:!1},{__name:`UChatPrompt`,props:V({as:{type:null,required:!1,default:`form`},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},submitOnEnter:{type:Boolean,required:!1,default:!0},error:{type:Error,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},rows:{type:Number,required:!1,default:1},autofocus:{type:Boolean,required:!1,default:!0},autofocusDelay:{type:Number,required:!1},autoresize:{type:Boolean,required:!1,default:!0},autoresizeDelay:{type:Number,required:!1},maxrows:{type:Number,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},disabled:{type:Boolean,required:!1}},{modelValue:{type:String,default:``},modelModifiers:{}}),emits:V([`submit`,`close`],[`update:modelValue`]),setup(e,{expose:r,emit:i}){let a=e,o=i,s=O(),c=J(`chatPrompt`,a),l=D(e,`modelValue`,{type:String,default:``}),{t:u}=ln(),p=$n(),h=Ce(Re(c,`rows`,`autofocus`,`autofocusDelay`,`autoresize`,`autoresizeDelay`,`maxrows`,`icon`,`avatar`,`loading`,`loadingIcon`)),C=()=>$e(s,[`header`,`footer`,`body`]),w=n(()=>Ne({extend:Zp,...p.ui?.chatPrompt||{}})({color:c.color,variant:c.variant})),T=b(`textareaRef`);function k(e){l.value.trim()!==``&&o(`submit`,e??new Event(`submit`))}function A(e){T.value?.textareaRef?.blur(),o(`close`,e??new Event(`close`))}let{onKeydown:M,onCompositionEnd:N}=Xp(e=>{k(e)});function P(e){if(c.submitOnEnter){if(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)return}else if(!e.ctrlKey&&!e.metaKey)return;M(e)}function F(e){e.key===`Enter`?P(e):e.key===`Escape`&&A(e)}return r({textareaRef:S(()=>T.value?.textareaRef)}),(e,n)=>(_(),m(f(ht),{as:f(c).as,"data-slot":e.$attrs[`data-slot`]??`root`,class:j(w.value.root({class:[f(c).ui?.root,f(c).class]})),onSubmit:q(k,[`prevent`])},{default:H(()=>[s.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(w.value.header({class:f(c).ui?.header}))},[d(e.$slots,`header`)],2)):g(``,!0),d(e.$slots,`body`,{submit:k,close:A,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,ui:w.value},()=>[E(xn,z({ref_key:`textareaRef`,ref:T,modelValue:l.value,"onUpdate:modelValue":n[0]||=e=>l.value=e,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,variant:`none`,fixed:``},{...f(h),...e.$attrs},{ui:f(ae)(f($e)(w.value,[`root`,`body`,`header`,`footer`]),f(c).ui),"data-slot":`body`,class:w.value.body({class:f(c).ui?.body}),onKeydown:F,onCompositionend:f(N)}),x({_:2},[y(C(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,R(t(n)))])}))]),1040,[`modelValue`,`placeholder`,`disabled`,`ui`,`class`,`onCompositionend`])]),s.footer?(_(),v(`div`,{key:1,"data-slot":`footer`,class:j(w.value.footer({class:f(c).ui?.footer}))},[d(e.$slots,`footer`)],2)):g(``,!0)]),_:3},8,[`as`,`data-slot`,`class`]))}}),$p=e=>e.split(`
83
+ `).filter(e=>!Ni(e)).join(`
84
+ `).trim();function em(e,t){let n=$p(t);return!n||e.at(-1)===n?e:[...e,n].slice(-100)}function tm(e,t){return e.defaultPrevented||e.isComposing||e.keyCode===229||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||t.start!==t.end?null:e.key===`ArrowUp`&&!t.text.slice(0,t.start).includes(`
85
85
  `)?-1:e.key===`ArrowDown`&&!t.text.slice(t.end).includes(`
86
- `)?1:null}var em=class{snapshot=[];index=0;draft=null;reset(){this.draft=null,this.snapshot=[],this.index=0}move(e,t,n){if(!this.draft){if(e===1||!n.length)return null;this.draft={...t},this.snapshot=[...n],this.index=n.length}let r=Math.max(0,this.index+e);if(r===this.index)return null;if(r>=this.snapshot.length){let e=this.draft;return this.reset(),e}this.index=r;let i=this.snapshot[r];return{text:i,start:i.length,end:i.length}}},tm=new Map,nm=e=>`prompt-history:${e}`;function rm(e){let t=tm.get(e);if(!t){t=[];try{let n=JSON.parse(localStorage.getItem(nm(e))||`[]`);Array.isArray(n)&&(t=n.filter(e=>typeof e==`string`&&!!e.trim()).slice(-100))}catch{}tm.set(e,t)}return t}function im(e,t){let n=Qp(rm(e),t);tm.set(e,n);try{localStorage.setItem(nm(e),JSON.stringify(n))}catch{}}function am(e){return e.split(`
87
- `).map(e=>{let t=e.startsWith(`↳`)?di(e):null;return t?{ref:!0,head:t.head,text:t.ref.excerpt,tail:t.tail}:{ref:!1,head:``,text:e,tail:``}})}var om=`fontFamily.fontSize.fontWeight.fontStyle.fontStretch.fontVariant.fontKerning.fontFeatureSettings.fontVariationSettings.fontVariantLigatures.fontOpticalSizing.lineHeight.letterSpacing.wordSpacing.textTransform.textIndent.textRendering.tabSize.whiteSpace.overflowWrap.wordBreak.hyphens.direction.paddingTop.paddingRight.paddingBottom.paddingLeft.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.boxSizing`.split(`.`);function sm(e){let t=e.parentElement,n=document.createElement(`div`);n.className=`qm-mirror`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`div`);n.append(r),t.insertBefore(n,e),t.classList.add(`qm-host`),e.classList.add(`qm-on`);let i=!0;function a(){r.style.transform=`translateY(${-e.scrollTop}px)`}function o(){if(!i)return;let t=getComputedStyle(e);for(let e of om)n.style[e]=t[e];n.style.borderStyle=`solid`,n.style.borderColor=`transparent`;let r=e.offsetWidth-e.clientWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth);n.style.paddingRight=`${parseFloat(t.paddingRight)+Math.max(0,r)}px`,n.style.top=`${e.offsetTop}px`,n.style.left=`${e.offsetLeft}px`,n.style.width=`${e.offsetWidth}px`,n.style.height=`${e.offsetHeight}px`,n.style.setProperty(`--qm-pl`,t.paddingLeft),n.style.setProperty(`--qm-pr`,n.style.paddingRight),a()}function s(){r.textContent=``;for(let t of am(e.value)){let e=document.createElement(`div`);if(t.ref){e.className=`qm-q`;let n=document.createElement(`span`);n.className=`qm-a`,n.textContent=t.head.slice(0,1);let r=document.createElement(`span`);r.className=`qm-h`,r.textContent=t.head.slice(1);let i=document.createElement(`span`);i.className=`qm-h`,i.textContent=t.tail,e.append(n,r,t.text,i)}else e.append(t.text||`​`);r.append(e)}o()}e.addEventListener(`input`,s),e.addEventListener(`scroll`,a,{passive:!0});let c=new ResizeObserver(o);return c.observe(e),document.fonts?.ready.then(o),s(),{render:s,destroy(){i=!1,c.disconnect(),e.removeEventListener(`input`,s),e.removeEventListener(`scroll`,a),e.classList.remove(`qm-on`),t.classList.remove(`qm-host`),n.remove()}}}function cm(e,t,n,r=20){return t>=e.left-r&&t<=e.right+r&&n>=e.top-r&&n<=e.bottom+r}function lm(e){let t=null,n=()=>{t!==null&&e.press?.(!1),t=null};return{start(r){n();let i=r.changedTouches[0];r.touches.length===1&&i&&e.enabled()&&(r.preventDefault(),t=i.identifier,e.press?.(!0))},end(r){if(t===null)return;let i=Array.from(r.changedTouches).find(e=>e.identifier===t);if(!i)return;n(),r.preventDefault();let a=r.currentTarget;a&&cm(a.getBoundingClientRect(),i.clientX,i.clientY,e.slop)&&e.enabled()&&e.run()},cancel:n}}var um=[`data-agent`],dm={class:`restart-text`},fm={class:`restart-text`},pm={class:`restart-text`},mm={class:`restart-text`},hm={class:`restart-text`},gm=[`disabled`],_m={key:5,class:`composer-notice codex-field`,role:`status`},vm=[`title`],ym=[`disabled`,`title`],bm={class:`notice-label`},xm=[`aria-label`],Sm=[`aria-selected`,`onMousemove`,`onClick`],Cm={class:`slash-name`},wm={key:0},Tm={class:`slash-desc`},Em={key:1,class:`slash-denied`,role:`status`},Dm={class:`slash-denied-label`},Om={class:`dir-denied-path`},km={key:7,class:`composer-ask-anchor`},Am=[`aria-label`],jm={class:`composer-quotes-label`},Mm={class:`composer-quote-text`},Nm=[`aria-label`,`onClick`],Pm={class:`attachments`},Fm=[`aria-label`,`onClick`,`onKeydown`],Im=[`src`],Lm={key:0,class:`spinner`},Rm=[`aria-label`,`onClick`],zm=[`aria-label`],Bm={key:2,class:`prompt-hint`},Vm={key:3,class:`prompt-hint`},Hm={key:4,class:`prompt-hint`},Um=[`title`],Wm={class:`composer-status-line`},Gm={key:0,class:`composer-status-meters`},Km=Object.assign(T({__name:`Composer`,props:{pane:{},paneId:{},sendKeys:{type:Function},conversation:{type:Boolean},escStops:{type:Boolean},takeBack:{type:Boolean},unanswered:{},termShown:{type:Boolean}},emits:[`sent`,`showTerminal`,`showUnanswered`],setup(e,{expose:t,emit:i}){let o=e,s=i,c=n(()=>Z(`Text typed in Codex’s terminal, or arrived there by mistake: your next message would be sent after it.`,`Texte tapé dans le terminal de Codex, ou arrivé là par erreur : ton prochain message serait envoyé à sa suite.`)),l=h(!1);async function u(){l.value=!0;try{await o.sendKeys(Array.from({length:10},()=>[`ctrl+u`,`backspace`]).flat())}finally{l.value=!1}}let d=n(()=>/\b(failed|error)\b/i.test(o.pane?.claudeNotice||``)),p=n(()=>!!(o.pane?.claudeNotice&&/Restart to update/i.test(o.pane.claudeNotice)&&de(o.pane))),b=n(()=>{let e=o.pane?.restart;if(!e)return``;let t=lr(e.agent);return e.update&&e.phase===`stopping`?Z(`Exiting ${t}…`,`Fermeture de ${t}…`):e.phase===`updating`?Z(`Updating ${t} in its terminal…`,`Mise à jour de ${t} dans son terminal…`):e.phase===`stopping`?Z(`Stopping ${t}…`,`Arrêt de ${t}…`):Z(`Restarting ${t} on the same conversation…`,`Relance de ${t} sur la même conversation…`)});async function C(){let e=o.pane?.restart?.update;if(e)try{await navigator.clipboard.writeText(e),$(Z(`Command copied: paste it into the terminal of this pane.`,`Commande copiée : colle-la dans le terminal de ce panneau.`))}catch{$(Q(`Copy failed`),!0)}}let T=Hn(o.paneId),D=S(T,`text`),O=h(null),A=n(()=>O.value?.textareaRef||null),F=h(null),L=h(null),R=h(!1),z=n(()=>ui({desk:Mr.value,touch:!!(Br||Wr),tablet:Pi.value,hardwareKeyboard:nr.value,softKeyboard:kn.value})),V=S(T,`atts`),ee=n(()=>sr(D.value)),te=null;B([()=>oi.value===`native`&&ee.value.length>0,A],([e,t])=>{te&&(!e||!t)&&(te.destroy(),te=null),e&&t&&!te&&(te=sm(t))},{immediate:!0,flush:`post`}),B(D,()=>P(()=>te?.render()),{flush:`post`}),U(()=>{te?.destroy(),te=null});let G=n(()=>!!(D.value.trim()||V.value.length)),K=n(()=>!!(o.pane?.stopped||o.pane?.prompt?.unavailable)||!Fr.value||mr.value||qr(o.pane)),re=n(()=>!!(o.pane&&o.pane.agent===`omp`&&o.pane.ompShell&&o.pane.status!==`working`)),ae=n(()=>!(K.value||!o.pane||!o.pane.agent||o.pane.status!==`working`&&!re.value||G.value)),oe=n(()=>!K.value&&!G.value&&o.pane?.claudeSuggestion||null),se=n(()=>!(!oe.value||z.value));function ce(){let e=oe.value;e&&(D.value=e,lt())}let le=h(null),ue=h(0);B(se,()=>P(()=>{ue.value=le.value?le.value.offsetWidth+16:0}),{immediate:!0});function fe(){let e=oe.value;if(!e)return;let t=!!(A.value&&document.activeElement===A.value);D.value=e,t&&lt()}let pe=n(()=>{let e=o.pane;return e?e.status===`blocked`?Q(`Type a reply…`):oe.value?oe.value:e.agent?Z(`Message to ${lr(e.agent)}…`,`Message à ${lr(e.agent)}…`):Q(`Command…`):Q(`Message to agent…`)});function me(e){if(nt.value&&!e.isComposing){let t=tt.value.length;if(e.key===`ArrowDown`){e.preventDefault(),rt=`kb`,Xe.value=(Xe.value+1)%t;return}if(e.key===`ArrowUp`){e.preventDefault(),rt=`kb`,Xe.value=(Xe.value-1+t)%t;return}if(e.key===`Escape`){e.preventDefault(),Ze.value=!0;return}if(e.key===`Tab`||z.value&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),at(tt.value[Xe.value]||tt.value[0]);return}}if(e.key===`Tab`&&!e.shiftKey&&!e.isComposing&&oe.value&&!D.value){e.preventDefault(),ce();return}z.value&&e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&!D.value.trim()&&(e.preventDefault(),Oe())}let _e=new em;function ve(e){let t=A.value;if(!t||e.target!==t||nt.value||R.value)return;let n={text:t.value,start:t.selectionStart,end:t.selectionEnd},r=$p(e,n);if(r===null)return;let i=_e.move(r,n,rm(o.paneId));i&&(e.preventDefault(),D.value=i.text,Ze.value=!0,P(()=>{Ze.value=!0,t.setSelectionRange(i.start,i.end)}))}w(()=>window.addEventListener(`keydown`,ve)),U(()=>{window.removeEventListener(`keydown`,ve),_e.draft&&(D.value=_e.draft.text)});function ye(e){im(o.paneId,e),_e.reset()}function xe(e){e.preventDefault(),Oe()}let Se=n(()=>K.value||!G.value&&!ae.value||R.value||ke.value===`running`),Ce=h(!1),we=lm({enabled:()=>ae.value||!Se.value,run:()=>{ae.value?je():Oe()},press:e=>{Ce.value=e}}),De=n(()=>Mr.value&&!ae.value);async function Oe(){if(K.value)return $(Q(`Sending unavailable offline`),!0);if(ae.value)return je();if(V.value.some(e=>!e.paste&&!e.path))return $(Q(V.value.some(e=>!e.path&&e.file)?`File is uploading…`:`Photo is uploading…`));let e=V.value.flatMap(e=>e.paste?[e.paste]:[]),t=V.value.flatMap(e=>e.paste?[]:[e.ref||e.path]),n=D.value,r=Be(n,e,t);if(!r||R.value)return;let i=o.pane,a=i&&i.status===`blocked`?i.prompt:null,c=a?a.options.findIndex(e=>e.free):-1;if(c<0&&Ot(i)&&!Cc(r)){ye(n),D.value=``,Ne(),yt(e),X(),s(`sent`,null),fn(i,o.paneId,r).then(()=>s(`sent`,null),e=>$(e.message,!0));return}R.value=!0,yt(e);try{let e=null;if(a&&c>=0){if(!await ge(o.paneId,c,a.options[c].label,a.identity,{text:r,question:a.question}))return}else e=await Ue(i,o.paneId,r);ye(n),D.value=``,Ne(),X(),s(`sent`,e);let l=r.split(/\s/)[0],u=Ke.get(o.paneId)?.list||qe.value;c<0&&i&&i.agent&&!t.length&&/^\/\S+$/.test(l)&&!r.includes(`
88
- `)&&!be(l,u)&&Ee(o.paneId,l,u.some(e=>e.source===`builtin`&&`/${e.name}`===l))}catch(e){$(e.message,!0)}finally{R.value=!1}}let ke=h(null),Ae=h(!1);async function je(){if(ke.value!==`running`){X(),ke.value=`running`,Ae.value=re.value;try{let e=await fi(`/api/interrupt`,{pane_id:o.paneId,restore:!!o.takeBack});if(ke.value=e.stopped?null:`failed`,Ae.value=!!e.shell,e.shell){e.stopped&&$(Z(`Command cancelled`,`Commande annulée`));return}if(e.restored!==void 0){an(T,e.restored),lt();let t=Z(`Stopped: your message is back in the field`,`Arrêté : ton message est revenu dans le champ`);e.lost?$(t,!0,nn(e.lost)):$(t)}else e.stopped&&$(e.background?Z(`Agent stopped (${e.background} background task${e.background>1?`s`:``} stopped)`,`Agent arrêté (${e.background} tâche${e.background>1?`s`:``} de fond arrêtée${e.background>1?`s`:``})`):Q(`Agent stopped`))}catch(e){ke.value=null,$(e.message,!0)}}}B(()=>o.pane?.status,e=>{ke.value===`failed`&&!Ae.value&&e!==`working`&&(ke.value=null)}),B(re,e=>{ke.value===`failed`&&Ae.value&&!e&&(ke.value=null)});function Me(){return!o.escStops||!ae.value||R.value||ke.value===`running`?!1:(je(),A.value?.focus(),!0)}function Ne(){for(let e of V.value)e.url&&URL.revokeObjectURL(e.url);V.value=[]}function Pe(e){At.value=e.url}function Fe(e){let[t]=V.value.splice(e,1);t&&t.url&&URL.revokeObjectURL(t.url)}B(()=>V.value.length,()=>P(Fn)),B(D,()=>P(()=>{let e=A.value;!e||e.scrollHeight<=e.clientHeight||document.activeElement!==e||e.selectionEnd>=e.value.length-1&&(e.scrollTop=e.scrollHeight)}));async function Ie(e){for(let t of e){let e=r({url:URL.createObjectURL(t),path:null});V.value.push(e);try{let n=await nf(o.paneId,t);e.path=n.path,e.name=n.name}catch(t){$(`${Q(`Photo upload failed`)} : ${t.message}`,!0),V.value=V.value.filter(t=>t!==e),URL.revokeObjectURL(e.url)}}}async function Re(e){let t=o.pane,{images:n,files:r,refused:i}=await Bn(e,t?.agent);if(i.length){let e=lr(t?.agent),n=i.map(e=>e.file.name).join(`, `),r=[...new Set(i.map(t=>En(t.reason,e,t.kind)))];$(Z(`Not attached: ${n}`,`Non joint : ${n}`),!0,r.join(` · `))}n.length&&Ie(n);for(let e of r)ze(e.file,e.kind);return n.length+r.length}async function ze(e,t){let n=r({url:``,path:null,file:{label:e.name,size:e.size,kind:t}});V.value.push(n);try{let t=await fetch(`/api/attach?pane=${encodeURIComponent(o.paneId)}&name=${encodeURIComponent(e.name)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:e}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(Q(r.error||`HTTP ${t.status}`));n.path=r.path,n.name=r.name,n.ref=r.ref}catch(t){$(`${e.name} : ${Q(`File upload failed`)} — ${t.message}`,!0),V.value=V.value.filter(e=>e!==n)}}function Ve(e){let t=e.target,n=[...t.files||[]];t.value=``,Re(n)}function He(e){let t=[...e.clipboardData&&e.clipboardData.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e);if(!t.length){let t=(e.clipboardData?.getData(`text/plain`)||``).replace(/\r\n?/g,`
89
- `);if(Le(t)){e.preventDefault(),We(t);return}let n=Mi(t);if(n===t)return;e.preventDefault();let r=e.target,i=r.value;if(!(typeof document.execCommand==`function`&&document.execCommand(`insertText`,!1,n))||r.value===i){let e=r.selectionStart??i.length;r.value=i.slice(0,e)+n+i.slice(r.selectionEnd??e),r.setSelectionRange(e+n.length,e+n.length),r.dispatchEvent(new Event(`input`,{bubbles:!0}))}return}e.preventDefault(),Re(t),X()}function We(e){V.value.push({url:``,path:null,paste:e}),X()}async function Ge(){if(!navigator.clipboard||!navigator.clipboard.read)return $(Q(`Clipboard unavailable here — paste into the message field.`),!0);try{let e=[];for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));n&&e.push(new File([await t.getType(n)],`presse-papiers.${n.split(`/`)[1]}`,{type:n}))}if(!e.length)return $(Q(`No image in the clipboard`),!0);Ie(e)}catch(e){let t=e;$(t.name===`NotAllowedError`?Q(`Paste denied`):`${Q(`Paste failed`)} : ${t.message}`,!0)}}let Ke=new Map,qe=h([]),Ye=h(null),Xe=h(0),Ze=h(!1),Qe=h(null),$e=n(()=>{let e=/^\/(\S*)$/.exec(D.value);return o.pane&&o.pane.agent&&e?e[1].toLowerCase():null});async function et(){let e=o.paneId,t=Ke.get(e);if(!(t&&(qe.value=t.list,Ye.value=t.denied,Date.now()-t.at<15e3)))try{let n=await fi(`/api/commands?pane=${encodeURIComponent(e)}`);if(n.partial&&t)return;let r=n.denied?{remote:!!n.remote}:null;n.partial||Ke.set(e,{at:Date.now(),list:n.commands,denied:r}),e===o.paneId&&(qe.value=n.commands,Ye.value=r)}catch{}}B($e,(e,t)=>{if(e===null){Ze.value=!1;return}t??et(),Xe.value=0}),B(()=>o.paneId,()=>{qe.value=[],Ye.value=null});let tt=n(()=>{let e=$e.value;if(e===null)return[];let t=[],n=[],r=[];for(let i of qe.value){let a=i.name.toLowerCase();a.startsWith(e)?t.push(i):a.includes(e)?n.push(i):e.length>1&&i.desc.toLowerCase().includes(e)&&r.push(i)}return[...t,...n,...r]}),nt=n(()=>$e.value!==null&&!Ze.value&&(tt.value.length>0||!!Ye.value)&&(tt.value.length!==1||tt.value[0].name.toLowerCase()!==$e.value)),rt=``;function it(e,t){let n=`${e.screenX},${e.screenY}`,r=rt===`kb`;n!==rt&&(rt=n,!r&&(Xe.value=t))}function at(e){D.value=`/${e.name} `,X(),P(()=>A.value?.focus())}B(Xe,e=>P(()=>{(Qe.value?.children[e])?.scrollIntoView({block:`nearest`})}));let ot={claude:[[`/compact`,`Summarize context`],[`/clear`,`New conversation`],[`/context`,`Context usage`],[`/usage`,`Plan usage`],[`/model`,`Change model`],[`/review`,`Code review`]],codex:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/status`,`Session status`],[`/model`,`Change model`],[`/review`,`Code review`],[`/diff`,`View diff`]],omp:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/plan`,`Plan mode`],[`/model`,`Change model`],[`/fast`,`Priority service tier`]]};function st(){let e=o.pane;if(!e)return;let t=[{label:Q(`Photo or screenshot`),icon:`i-lucide-image`,run:()=>F.value?.click()},{label:e.agent===`claude`?Q(`File (PDF, text, code)`):Q(`File (text, code)`),icon:`i-lucide-paperclip`,run:()=>L.value?.click()},{label:Q(`Paste copied image`),icon:`i-lucide-clipboard-paste`,run:Ge}];if(e.agent){t.push({kind:`separator`}),t.push({kind:`command`,cmd:`esc`,desc:Q(`Interrupt agent`),run:()=>o.sendKeys([`esc`])});for(let[n,r]of ot[e.agent]||[])t.push({kind:`command`,cmd:n,desc:Q(r),run:()=>ct(n)});t.push({kind:`note`,label:Q(`Commands that open a menu (model…) can then be controlled in the Terminal tab.`)})}Te(t)}async function ct(e,t=!0){try{await fi(`/api/prompt`,{pane_id:o.paneId,text:e}),im(o.paneId,e),X()}catch(e){return $(e.message,!0)}t&&Ee(o.paneId,e)}function lt(){ut(null)}function ut(e){A.value?.focus(),P(()=>{let t=A.value;if(!t)return;t.focus();let n=e===null?t.value.length:Math.min(e,t.value.length);t.setSelectionRange(n,n),e===null&&(t.scrollTop=t.scrollHeight)})}function dt(e){z.value&&ut(e)}return t({focus:()=>A.value?.focus(),focusEnd:lt,focusAnswer:dt,blur:()=>A.value?.blur(),addImages:Ie,addFiles:Re,stop:Me}),(t,n)=>{let r=Je,i=vp,o=Lp,h=$a,S=Wa,w=Et,T=Gp,A=xt,P=qp,R=Xp;return _(),v(`div`,{class:`composer`,"data-agent":e.pane?.agent||void 0},[f(ke)?(_(),v(`div`,{key:0,class:j([`composer-notice restart`,{failed:f(ke)===`failed`}]),role:`status`},[f(ke)===`failed`?(_(),v(k,{key:0},[I(`span`,dm,M(f(Ae)?(`tl`in t?t.tl:f(Z))(`The command is still running.`,`La commande tourne encore.`):(`t`in t?t.t:f(Q))(`The agent is still working.`)),1),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[0]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Q))(`View terminal`)),1)),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[1]||=e=>ke.value=null},M((`t`in t?t.t:f(Q))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[14]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,fm,M(f(Ae)?(`tl`in t?t.tl:f(Z))(`Cancelling the command…`,`Annulation de la commande…`):(`t`in t?t.t:f(Q))(`Stopping…`)),1)],64))],2)):e.pane?.restart?(_(),v(`div`,{key:1,class:j([`composer-notice restart`,e.pane.restart.phase]),role:`status`},[e.pane.restart.phase===`failed`?(_(),v(k,{key:0},[I(`span`,pm,M(e.pane.restart.update?(`t`in t?t.t:f(Q))(`Codex update failed`):(`t`in t?t.t:f(Q))(`Restart failed`))+M((`tl`in t?t.tl:f(Z))(`: `,` : `))+M((`t`in t?t.t:f(Q))(e.pane.restart.error||``)),1),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[2]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Q))(`View terminal`)),1)),e.pane.restart.update?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:C},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)])):g(``,!0),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[3]||=n=>(`dismissRestart`in t?t.dismissRestart:f(he))(e.paneId)},M((`t`in t?t.t:f(Q))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[15]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,mm,M(f(b)),1)],64))],2)):e.conversation&&e.pane?.usageLimit?(_(),m(i,{key:2,limit:e.pane.usageLimit,"read-only":f(K),"send-keys":e.sendKeys,onCredits:n[4]||=e=>ct(`/usage-credits`,!1)},null,8,[`limit`,`read-only`,`send-keys`])):e.pane?.claudeNotice?(_(),v(`div`,{key:3,class:j([`composer-notice`,{error:f(d)}]),role:`status`},[f(p)?(_(),v(k,{key:0},[I(`span`,hm,M(e.pane.claudeNotice.replace(/\s*·\s*Restart to update\b.*$/,``))+` ·`,1),I(`button`,{type:`button`,class:`notice-btn`,disabled:f(K),onClick:n[5]||=n=>(`restartAgent`in t?t.restartAgent:f(ie))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Q))(`Restart to update`)),1)],8,gm)],64)):(_(),v(k,{key:1},[a(M(f(d)&&!/^[✗✘]/.test(e.pane.claudeNotice)?`✘ ${e.pane.claudeNotice}`:e.pane.claudeNotice),1)],64))],2)):e.pane?.codexStatus?(_(),m(o,{key:4,pane:e.pane,"pane-id":e.paneId,"read-only":f(K)},null,8,[`pane`,`pane-id`,`read-only`])):g(``,!0),e.pane?.agent===`codex`&&e.pane.codexField&&!f(ke)?(_(),v(`div`,_m,[E(r,{name:`i-lucide-text-cursor-input`,class:`notice-icon`}),I(`span`,{class:`restart-text`,title:f(c)},[a(M((`tl`in t?t.tl:f(Z))(`In Codex’s field:`,`Dans le champ de Codex :`))+` `,1),I(`code`,null,M(e.pane.codexField),1)],8,vm),I(`button`,{type:`button`,class:`notice-btn`,disabled:f(K)||f(l),title:f(c),onClick:u},M((`tl`in t?t.tl:f(Z))(`Clear`,`Vider`)),9,ym),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[6]||=e=>s(`showTerminal`)},[E(r,{name:`i-lucide-terminal`}),I(`span`,bm,M((`t`in t?t.t:f(Q))(`View terminal`)),1)]))])):g(``,!0),f(nt)?(_(),v(`div`,{key:6,class:`slash-menu`,role:`listbox`,"aria-label":(`t`in t?t.t:f(Q))(`Commands`)},[f(tt).length?(_(),v(`div`,{key:0,ref_key:`slashListEl`,ref:Qe,class:`slash-list`},[(_(!0),v(k,null,y(f(tt),(e,t)=>(_(),v(`button`,{key:e.name,type:`button`,role:`option`,class:j([`slash-item`,{on:t===f(Xe)}]),"aria-selected":t===f(Xe),onMousedown:n[7]||=q(()=>{},[`prevent`]),onMousemove:e=>it(e,t),onClick:t=>at(e)},[I(`span`,Cm,[a(`/`+M(e.name),1),e.hint?(_(),v(`small`,wm,M(e.hint),1)):g(``,!0)]),I(`span`,Tm,M(e.desc),1)],42,Sm))),128))],512)):g(``,!0),f(Ye)?(_(),v(`div`,Em,[I(`p`,Dm,[E(r,{name:`i-lucide-shield-alert`}),a(M((`tl`in t?t.tl:f(Z))(`macOS hides this project’s commands`,`macOS masque les commandes de ce projet`)),1)]),I(`p`,null,[a(M((`tl`in t?t.tl:f(Z))(`Typed in full, they still work. To list them, on the Mac:`,`Tapées en entier, elles marchent quand même. Pour les lister, sur le Mac :`))+` `,1),I(`span`,Om,M(f(Ye).remote?(`tl`in t?t.tl:f(Z))(`System Settings › General › Sharing › Remote Login ⓘ › “Allow full disk access for remote users”`,`Réglages Système › Général › Partage › Session à distance ⓘ › « Autoriser l’accès complet au disque pour les utilisateurs distants »`):(`tl`in t?t.tl:f(Z))(`System Settings › Privacy & Security › Full Disk Access`,`Réglages Système › Confidentialité et sécurité › Accès complet au disque`)),1)])])):g(``,!0)],8,xm)):g(``,!0),e.unanswered&&!f(K)?(_(),v(`div`,km,[I(`button`,{type:`button`,class:`composer-ask`,onMousedown:n[8]||=q(()=>{},[`prevent`]),onClick:n[9]||=e=>s(`showUnanswered`)},[E(r,{name:`i-lucide-arrow-up`}),I(`span`,null,M(e.unanswered>1?(`tl`in t?t.tl:f(Z))(`${e.unanswered} questions unanswered`,`${e.unanswered} questions sans réponse`):(`tl`in t?t.tl:f(Z))(`1 question unanswered`,`1 question sans réponse`)),1)],32)])):g(``,!0),f(ee).length?(_(),v(`div`,{key:8,class:`composer-quotes`,role:`list`,"aria-label":(`t`in t?t.t:f(Q))(`Quoted questions`)},[I(`span`,jm,`↳ `+M(f(ee).length),1),(_(!0),v(k,null,y(f(ee),e=>(_(),v(`span`,{key:e.start,class:`composer-quote`,role:`listitem`},[I(`span`,Mm,M(e.excerpt),1),I(`button`,{type:`button`,class:`composer-quote-x`,"aria-label":(`t`in t?t.t:f(Q))(`Remove quote`),onMousedown:n[10]||=q(()=>{},[`prevent`]),onClick:t=>D.value=f(pr)(f(D),e)},[E(r,{name:`i-lucide-x`})],40,Nm)]))),128))],8,Am)):g(``,!0),E(R,{ref_key:`promptRef`,ref:O,modelValue:f(D),"onUpdate:modelValue":n[13]||=e=>W(D)?D.value=e:null,disabled:!!e.pane?.stopped,placeholder:e.pane?.stopped?(`t`in t?t.t:f(Q))(`Restart Codex before sending a message`):f(K)?(`t`in t?t.t:f(Q))(`Draft saved — sending unavailable offline`):f(pe),variant:`outline`,color:`neutral`,rows:1,maxrows:7,autofocus:!1,"submit-on-enter":f(z)&&!f(nt),enterkeyhint:f(z)?`send`:`enter`,autocapitalize:`sentences`,class:j([`prompt`,{suggesting:f(se)}]),style:N(f(ue)?{"--suggest-room":`${f(ue)}px`}:void 0),ui:{header:`prompt-head`,body:`prompt-body`,base:`prompt-input`,footer:`prompt-foot`},onSubmit:Oe,onKeydown:me,onPaste:He},x({footer:H(()=>[n[20]||=I(`span`,{class:`fx-ring`,"aria-hidden":`true`},[I(`span`,{class:`fx-spin`})],-1),n[21]||=I(`span`,{class:`fx-halo`,"aria-hidden":`true`},[I(`span`,{class:`fx-spin`})],-1),f(se)?(_(),v(`button`,{key:0,ref_key:`suggestBtn`,ref:le,type:`button`,class:`prompt-suggest`,"aria-label":(`t`in t?t.t:f(Q))(`Use suggestion`),onMousedown:n[11]||=q(()=>{},[`prevent`]),onClick:fe},[E(r,{name:`i-lucide-corner-down-left`}),I(`span`,null,M((`tl`in t?t.tl:f(Z))(`Use`,`Utiliser`)),1)],40,zm)):g(``,!0),E(w,{icon:`i-lucide-plus`,color:`neutral`,variant:`outline`,size:`sm`,class:`prompt-plus`,disabled:f(K),"aria-label":(`t`in t?t.t:f(Q))(`Photo, file, paste, commands`),onClick:st},null,8,[`disabled`,`aria-label`]),I(`input`,{ref_key:`fileInput`,ref:F,type:`file`,accept:`image/*`,multiple:``,hidden:``,onChange:Ve},null,544),I(`input`,{ref_key:`anyFileInput`,ref:L,type:`file`,multiple:``,hidden:``,"data-testid":`attach-any`,onChange:Ve},null,544),e.pane&&(e.pane.agent===`claude`||e.pane.agent===`codex`||e.pane.agent===`omp`)?(_(),m(T,{key:1,pane:e.pane},null,8,[`pane`])):g(``,!0),f(De)&&f(oe)?(_(),v(`span`,Bm,[E(A,{value:`tab`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`suggestion`))+` `,1),n[16]||=I(`span`,{class:`sep`},`·`,-1),n[17]||=a(),E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`send`)),1)])):f(De)?(_(),v(`span`,Vm,[E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`send`))+` `,1),n[18]||=I(`span`,{class:`sep`},`·`,-1),n[19]||=a(),E(A,{value:`shift`,size:`sm`}),E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`new line`)),1)])):(`desk`in t?t.desk:f(Mr))&&e.escStops&&f(ae)&&f(ke)!==`running`?(_(),v(`span`,Hm,[E(A,{value:`escape`,size:`sm`}),a(` `+M((`tl`in t?t.tl:f(Z))(`stop`,`arrêter`)),1)])):g(``,!0),E(P,{status:f(ae)?`streaming`:`ready`,disabled:f(Se),color:`primary`,variant:`solid`,"streaming-color":`neutral`,"streaming-variant":`solid`,"streaming-icon":`i-herdr-stop`,size:`sm`,class:j([`prompt-send`,{stop:f(ae),pressed:f(Ce)}]),"aria-label":f(ae)&&f(re)?(`tl`in t?t.tl:f(Z))(`Cancel the command`,`Annuler la commande`):(`t`in t?t.t:f(Q))(f(ae)?`Stop the agent`:`Send`),onMousedown:n[12]||=q(()=>{},[`prevent`]),onClick:xe,onStop:je,onTouchstart:f(we).start,onTouchend:f(we).end,onTouchcancel:f(we).cancel},null,8,[`status`,`disabled`,`class`,`aria-label`,`onTouchstart`,`onTouchend`,`onTouchcancel`])]),_:2},[f(V).length?{name:`header`,fn:H(()=>[I(`div`,Pm,[(_(!0),v(k,null,y(f(V),(e,n)=>(_(),v(k,{key:e.url||e.path||e.file?.label||`paste:${n}`},[e.paste?(_(),m(h,{key:0,text:e.paste,removable:``,onRemove:e=>Fe(n)},null,8,[`text`,`onRemove`])):e.file?(_(),m(S,{key:1,name:e.file.label,size:e.file.size,kind:e.file.kind,uploading:!e.path,removable:``,onRemove:e=>Fe(n)},null,8,[`name`,`size`,`kind`,`uploading`,`onRemove`])):(_(),v(`div`,{key:2,class:j([`att`,{up:!e.path}]),role:`button`,tabindex:`0`,"aria-label":(`t`in t?t.t:f(Q))(`View image`),onClick:t=>Pe(e),onKeydown:ne(q(t=>Pe(e),[`self`]),[`enter`])},[I(`img`,{src:e.url,alt:``},null,8,Im),e.path?g(``,!0):(_(),v(`span`,Lm)),I(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Remove`),onClick:q(e=>Fe(n),[`stop`])},[E(r,{name:`i-lucide-x`})],8,Rm)],42,Fm))],64))),128))])]),key:`0`}:void 0]),1032,[`modelValue`,`disabled`,`placeholder`,`submit-on-enter`,`enterkeyhint`,`class`,`style`]),e.pane?.ompStatus?(_(),v(`div`,{key:9,class:`composer-status`,title:[e.pane.ompStatus.line,e.pane.ompStatus.meters].filter(Boolean).join(`
90
- `)},[I(`span`,Wm,M(e.pane.ompStatus.line),1),e.pane.ompStatus.meters?(_(),v(`span`,Gm,M(e.pane.ompStatus.meters),1)):g(``,!0)],8,Um)):g(``,!0)],8,um)}}}),{__name:`Composer`}),qm=[`aria-label`],Jm={class:`review-note-head`},Ym={class:`review-range`},Xm={key:0,class:`review-path`},Zm={key:0,class:`review-warning`,role:`status`},Qm=[`id`,`value`,`placeholder`,`aria-label`],$m={class:`review-note-actions`},eh={class:`review-keys`,"aria-hidden":`true`},th=[`disabled`],nh={class:`review-body`},rh={class:`review-note-actions`},ih=[`aria-label`],ah=[`aria-label`],oh=Object.assign(T({__name:`ReviewNote`,props:{comment:{},label:{},missing:{type:Boolean},changed:{type:Boolean}},emits:[`act`,`hover`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>r.comment.draft!==void 0),o=n(()=>r.comment.draft??``),s=n(()=>o.value.trim()!==r.comment.body.trim()),c=h(``);B(a,()=>{c.value=``});let l=/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``)?`⌘↵`:`Ctrl+↵`;function u(e){c.value=``,i(`act`,`draft`,r.comment.id,e.target.value)}function d(){o.value.trim()&&i(`act`,`save`,r.comment.id)}function p(){if(s.value&&c.value!==`cancel`){c.value=`cancel`;return}i(`act`,`cancel`,r.comment.id)}function m(){if(c.value!==`remove`){c.value=`remove`;return}i(`act`,`remove`,r.comment.id)}function y(e){if(!e.isComposing){if(e.key===`Escape`&&(a.value||c.value))e.preventDefault(),e.stopPropagation(),a.value?p():c.value=``;else if(a.value)e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d());else return}}return(t,n)=>(_(),v(`div`,{class:j([`review-note`,{missing:e.missing,editing:f(a)}]),role:`group`,"aria-label":`${e.label}: ${(`t`in t?t.t:f(Q))(`review comment`)}`,onKeydown:y,onMouseenter:n[3]||=t=>i(`hover`,e.comment.id),onMouseleave:n[4]||=e=>i(`hover`,null),onFocusin:n[5]||=t=>i(`hover`,e.comment.id),onFocusout:n[6]||=e=>i(`hover`,null)},[I(`div`,Jm,[I(`span`,Ym,M(e.label),1),e.missing?(_(),v(`span`,Xm,M(e.comment.path),1)):g(``,!0)]),e.missing?(_(),v(`p`,Zm,M(e.changed?(`t`in t?t.t:f(Q))(`The code of this block changed. Check this comment before sending.`):(`t`in t?t.t:f(Q))(`No longer in the diff. Check this comment before sending.`)),1)):g(``,!0),f(a)?(_(),v(k,{key:1},[I(`textarea`,{id:`review-${e.comment.id}`,value:f(o),placeholder:(`t`in t?t.t:f(Q))(`Write a review comment…`),"aria-label":`${e.label}: ${(`t`in t?t.t:f(Q))(`review comment`)}`,rows:`3`,onInput:u,onFocus:n[0]||=e=>e.target.scrollIntoView({block:`nearest`})},null,40,Qm),I(`div`,$m,[I(`span`,eh,M(f(l))+` `+M((`t`in t?t.t:f(Q))(`to save`))+` · Esc `+M((`t`in t?t.t:f(Q))(`to cancel`)),1),I(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`cancel`}]),onClick:p},M(f(c)===`cancel`?(`t`in t?t.t:f(Q))(`Discard this text?`):(`t`in t?t.t:f(Q))(`Cancel`)),3),I(`button`,{type:`button`,class:`review-btn primary`,disabled:!f(o).trim(),onClick:d},M(e.comment.body?(`t`in t?t.t:f(Q))(`Save`):(`t`in t?t.t:f(Q))(`Comment`)),9,th)])],64)):(_(),v(k,{key:2},[I(`p`,nh,M(e.comment.body),1),I(`div`,rh,[I(`button`,{type:`button`,class:`review-btn`,"aria-label":(`t`in t?t.t:f(Q))(`Edit comment`),onClick:n[1]||=t=>i(`act`,`edit`,e.comment.id)},M((`tl`in t?t.tl:f(Z))(`Edit`,`Modifier`)),9,ih),I(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`remove`}]),"aria-label":f(c)===`remove`?(`t`in t?t.t:f(Q))(`Confirm delete`):(`t`in t?t.t:f(Q))(`Delete comment`),onClick:m,onBlur:n[2]||=e=>c.value=``},M(f(c)===`remove`?(`t`in t?t.t:f(Q))(`Confirm delete`):(`t`in t?t.t:f(Q))(`Delete`)),43,ah)])],64))],42,qm))}}),{__name:`ReviewNote`});function sh(e){let t=null,n=null;return e.map(e=>{let r=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e.text);e.kind===`hunk`&&(t=r?Number(r[1]):null,n=r?Number(r[2]):null);let i=e.kind===`del`?`old`:`new`,a=[`add`,`del`,`context`].includes(e.kind)?i===`old`?t:n:null;return(e.kind===`del`||e.kind===`context`)&&t!==null&&t++,(e.kind===`add`||e.kind===`context`)&&n!==null&&n++,{...e,number:a,side:i}})}function ch(e,t){let n=t,r=t;for(;n>0&&e[n-1].kind!==`hunk`;)n--;for(;r<e.length-1&&e[r+1].kind!==`hunk`;)r++;for(;n<t&&e[n].number===null;)n++;for(;r>t&&e[r].number===null;)r--;return[n,r]}function lh(e,t,n){let[r,i]=ch(e,t),a=Math.min(Math.max(n,r),i);for(;a!==t&&e[a].number===null;)a+=a<t?1:-1;return t<=a?[t,a]:[a,t]}var uh=e=>e.filter(e=>e.number!==null);function dh(e){let t={};for(let n of uh(e)){let e=t[n.side];t[n.side]=e?[Math.min(e[0],n.number),Math.max(e[1],n.number)]:[n.number,n.number]}return t}var fh=100;function ph(e){let t=uh(e).map(e=>e.text.trimEnd()).filter(e=>e.length>1);return(t.length>3?[t[0],`…`,t.at(-1)]:t).map(e=>e.length>fh?`${e.slice(0,99)}…`:e)}function mh(e){let t=2166136261;for(let n of uh(e).map(e=>e.text).join(`
91
- `))t=Math.imul(t^n.codePointAt(0),16777619);return(t>>>0).toString(16)}function hh(e){let t=uh(e),n=t[0],r=t.at(-1);return{number:n.number,side:n.side,text:n.text,end:t.length>1?{number:r.number,side:r.side,text:r.text}:void 0,span:dh(t),excerpt:ph(t),hash:mh(t)}}var gh=(e,t)=>e.number===t.number&&e.side===t.side&&e.text===t.text;function _h(e,t){return gh(e,t)&&!!e.end==!!t.end&&(!e.end||gh(e.end,t.end))}function vh(e,t){for(let n=0;n<t.length;n++)if(gh(e,t[n])){if(!e.end)return[n,n];for(let r=n+1;r<t.length&&t[r].kind!==`hunk`;r++)if(gh(e.end,t[r]))return[n,r]}return null}function yh(e,t){let n=vh(e,t);return n&&(!e.hash||e.hash===mh(t.slice(n[0],n[1]+1)))?n:null}function bh(e,t){let n=t[e.scope]?.files.find(t=>t.path===e.path);return n?sh(n.lines):null}function xh(e,t,n=!1){if(t.git&&e.scope===`committed`&&!t.committed&&!n)return null;let r=bh(e,t);return r&&yh(e,r)?null:r&&vh(e,r)?`changed`:`gone`}function Sh(e,t,n=!1){return e.filter(e=>xh(e,t,n))}function Ch(e,t){return e.map(e=>{let n=bh(e,t),r=n&&yh(e,n);return r?{...e,...hh(n.slice(r[0],r[1]+1)),end:e.end}:e})}function wh(e){return(e.draft?.trim()?e.draft:e.body).trim()}function Th(e){let t=[e.number,e.number];return e.span??(e.side===`old`?{old:t}:{new:t})}var Eh=(e,t)=>e[0]===e[1]?`${e[0]}`:`${e[0]}${t}${e[1]}`,Dh=e=>e[0]!==e[1];function Oh(e,t){let n=e.old&&(Dh(e.old)?t.oldLines:t.oldLine);if(!e.new)return e.old?`${Dh(e.old)?t.lines:t.line} ${Eh(e.old,`–`)} (${n})`:``;let r=`${Dh(e.new)?t.lines:t.line} ${Eh(e.new,`–`)}`;return e.old?`${r} + ${n} ${Eh(e.old,`–`)}`:r}function kh(e,t,n={}){let r=new Map;for(let i of e){let e=wh(i).replace(/\s*\n\s*/g,` `);if(!e)continue;let a=Th(i),o=a.old&&(Dh(a.old)?t.oldLines:t.oldLine),s=[a.old?a.new?`${o} ${Eh(a.old,`-`)}`:o:``,n[i.id]===`changed`?t.changed??t.missing:n[i.id]?t.missing:``].filter(Boolean),c=`${i.path}:${Eh(a.new??a.old,`-`)}${s.length?` (${s.join(`, `)})`:``} — ${e}`,l=(i.excerpt??[i.text.trimEnd()]).filter(Boolean).map(e=>` ${e}`);r.has(i.path)||r.set(i.path,[]),r.get(i.path).push([c,...l].join(`
86
+ `)?1:null}var nm=class{snapshot=[];index=0;draft=null;reset(){this.draft=null,this.snapshot=[],this.index=0}move(e,t,n){if(!this.draft){if(e===1||!n.length)return null;this.draft={...t},this.snapshot=[...n],this.index=n.length}let r=Math.max(0,this.index+e);if(r===this.index)return null;if(r>=this.snapshot.length){let e=this.draft;return this.reset(),e}this.index=r;let i=this.snapshot[r];return{text:i,start:i.length,end:i.length}}},rm=new Map,im=e=>`prompt-history:${e}`;function am(e){let t=rm.get(e);if(!t){t=[];try{let n=JSON.parse(localStorage.getItem(im(e))||`[]`);Array.isArray(n)&&(t=n.filter(e=>typeof e==`string`&&!!e.trim()).slice(-100))}catch{}rm.set(e,t)}return t}function om(e,t){let n=em(am(e),t);rm.set(e,n);try{localStorage.setItem(im(e),JSON.stringify(n))}catch{}}function sm(e){return e.split(`
87
+ `).map(e=>{let t=e.startsWith(`↳`)?ki(e):null;return t?{ref:!0,head:t.head,text:t.ref.excerpt,tail:t.tail}:{ref:!1,head:``,text:e,tail:``}})}var cm=`fontFamily.fontSize.fontWeight.fontStyle.fontStretch.fontVariant.fontKerning.fontFeatureSettings.fontVariationSettings.fontVariantLigatures.fontOpticalSizing.lineHeight.letterSpacing.wordSpacing.textTransform.textIndent.textRendering.tabSize.whiteSpace.overflowWrap.wordBreak.hyphens.direction.paddingTop.paddingRight.paddingBottom.paddingLeft.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.boxSizing`.split(`.`);function lm(e){let t=e.parentElement,n=document.createElement(`div`);n.className=`qm-mirror`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`div`);n.append(r),t.insertBefore(n,e),t.classList.add(`qm-host`),e.classList.add(`qm-on`);let i=!0;function a(){r.style.transform=`translateY(${-e.scrollTop}px)`}function o(){if(!i)return;let t=getComputedStyle(e);for(let e of cm)n.style[e]=t[e];n.style.borderStyle=`solid`,n.style.borderColor=`transparent`;let r=e.offsetWidth-e.clientWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth);n.style.paddingRight=`${parseFloat(t.paddingRight)+Math.max(0,r)}px`,n.style.top=`${e.offsetTop}px`,n.style.left=`${e.offsetLeft}px`,n.style.width=`${e.offsetWidth}px`,n.style.height=`${e.offsetHeight}px`,n.style.setProperty(`--qm-pl`,t.paddingLeft),n.style.setProperty(`--qm-pr`,n.style.paddingRight),a()}function s(){r.textContent=``;for(let t of sm(e.value)){let e=document.createElement(`div`);if(t.ref){e.className=`qm-q`;let n=document.createElement(`span`);n.className=`qm-a`,n.textContent=t.head.slice(0,1);let r=document.createElement(`span`);r.className=`qm-h`,r.textContent=t.head.slice(1);let i=document.createElement(`span`);i.className=`qm-h`,i.textContent=t.tail,e.append(n,r,t.text,i)}else e.append(t.text||`​`);r.append(e)}o()}e.addEventListener(`input`,s),e.addEventListener(`scroll`,a,{passive:!0});let c=new ResizeObserver(o);return c.observe(e),document.fonts?.ready.then(o),s(),{render:s,destroy(){i=!1,c.disconnect(),e.removeEventListener(`input`,s),e.removeEventListener(`scroll`,a),e.classList.remove(`qm-on`),t.classList.remove(`qm-host`),n.remove()}}}function um(e,t,n,r=20){return t>=e.left-r&&t<=e.right+r&&n>=e.top-r&&n<=e.bottom+r}function dm(e){let t=null,n=()=>{t!==null&&e.press?.(!1),t=null};return{start(r){n();let i=r.changedTouches[0];r.touches.length===1&&i&&e.enabled()&&(r.preventDefault(),t=i.identifier,e.press?.(!0))},end(r){if(t===null)return;let i=Array.from(r.changedTouches).find(e=>e.identifier===t);if(!i)return;n(),r.preventDefault();let a=r.currentTarget;a&&um(a.getBoundingClientRect(),i.clientX,i.clientY,e.slop)&&e.enabled()&&e.run()},cancel:n}}function fm(e){let t=new DOMParser().parseFromString(e,`text/html`).body,n=``,r=0,i=e=>{r=Math.max(r,e)};function a(e){if(e){if(n&&r){let e=n.match(/\n*$/)[0].length;n+=`
88
+ `.repeat(Math.max(0,r-e))}r=0,n+=e}}function o(e,t=!1){if(e.nodeType===3){let n=e.textContent||``;if(r&&!n.trim()&&!t)return;a(t?n:n.replace(/[\t\n\r ]+/g,` `));return}if(e.nodeType!==1)return;let n=e;if([`SCRIPT`,`STYLE`,`TEMPLATE`].includes(n.tagName))return;if(n.tagName===`BR`){a(`
89
+ `);return}let s=n.tagName===`P`?2:+!!/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|CAPTION|CENTER|DD|DETAILS|DIALOG|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|HEADER|HR|LI|MAIN|MENU|NAV|OL|PRE|SECTION|SUMMARY|TABLE|TBODY|TD|TFOOT|TH|THEAD|TR|UL|H[1-6])$/.test(n.tagName);s&&i(s);for(let e of n.childNodes)o(e,t||n.tagName===`PRE`);s&&i(s)}for(let e of t.childNodes)o(e);return n}var pm=[`data-agent`],mm={class:`restart-text`},hm={class:`restart-text`},gm={class:`restart-text`},_m={class:`restart-text`},vm={class:`restart-text`},ym=[`disabled`],bm={key:5,class:`composer-notice codex-field`,role:`status`},xm=[`title`],Sm=[`disabled`,`title`],Cm={class:`notice-label`},wm=[`aria-label`],Tm=[`aria-selected`,`onMousemove`,`onClick`],Em={class:`slash-name`},Dm={key:0},Om={class:`slash-desc`},km={key:1,class:`slash-denied`,role:`status`},Am={class:`slash-denied-label`},jm={class:`dir-denied-path`},Mm={key:7,class:`composer-ask-anchor`},Nm=[`aria-label`],Pm={class:`composer-quotes-label`},Fm={class:`composer-quote-text`},Im=[`aria-label`,`onClick`],Lm={class:`attachments`},Rm=[`aria-label`,`onClick`,`onKeydown`],zm=[`src`],Bm={key:0,class:`spinner`},Vm=[`aria-label`,`onClick`],Hm=[`aria-label`],Um={key:2,class:`prompt-hint`},Wm={key:3,class:`prompt-hint`},Gm={key:4,class:`prompt-hint`},Km=[`title`],qm={class:`composer-status-line`},Jm={key:0,class:`composer-status-meters`},Ym=Object.assign(T({__name:`Composer`,props:{pane:{},paneId:{},sendKeys:{type:Function},conversation:{type:Boolean},escStops:{type:Boolean},takeBack:{type:Boolean},unanswered:{},termShown:{type:Boolean}},emits:[`sent`,`showTerminal`,`showUnanswered`],setup(e,{expose:t,emit:i}){let o=e,s=i,c=n(()=>Z(`Text typed in Codex’s terminal, or arrived there by mistake: your next message would be sent after it.`,`Texte tapé dans le terminal de Codex, ou arrivé là par erreur : ton prochain message serait envoyé à sa suite.`)),l=h(!1);async function u(){l.value=!0;try{await o.sendKeys(Array.from({length:10},()=>[`ctrl+u`,`backspace`]).flat())}finally{l.value=!1}}let d=n(()=>/\b(failed|error)\b/i.test(o.pane?.claudeNotice||``)),p=n(()=>!!(o.pane?.claudeNotice&&/Restart to update/i.test(o.pane.claudeNotice)&&ue(o.pane))),b=n(()=>{let e=o.pane?.restart;if(!e)return``;let t=hr(e.agent);return e.update&&e.phase===`stopping`?Z(`Exiting ${t}…`,`Fermeture de ${t}…`):e.phase===`updating`?Z(`Updating ${t} in its terminal…`,`Mise à jour de ${t} dans son terminal…`):e.phase===`stopping`?Z(`Stopping ${t}…`,`Arrêt de ${t}…`):Z(`Restarting ${t} on the same conversation…`,`Relance de ${t} sur la même conversation…`)});async function C(){let e=o.pane?.restart?.update;if(e)try{await navigator.clipboard.writeText(e),$(Z(`Command copied: paste it into the terminal of this pane.`,`Commande copiée : colle-la dans le terminal de ce panneau.`))}catch{$(Q(`Copy failed`),!0)}}let T=qn(o.paneId),D=S(T,`text`),O=h(null),A=n(()=>O.value?.textareaRef||null),F=h(null),L=h(null),R=h(!1),z=n(()=>hi({desk:Lr.value,touch:!!(Gr||Yr),tablet:Bi.value,hardwareKeyboard:sr.value,softKeyboard:Mn.value})),V=S(T,`atts`),ee=n(()=>pr(D.value)),te=null;B([()=>fi.value===`native`&&ee.value.length>0,A],([e,t])=>{te&&(!e||!t)&&(te.destroy(),te=null),e&&t&&!te&&(te=lm(t))},{immediate:!0,flush:`post`}),B(D,()=>P(()=>te?.render()),{flush:`post`}),U(()=>{te?.destroy(),te=null});let G=n(()=>!!(D.value.trim()||V.value.length)),K=n(()=>!!(o.pane?.stopped||o.pane?.prompt?.unavailable)||!Br.value||br.value||Qr(o.pane)),re=n(()=>!!(o.pane&&o.pane.agent===`omp`&&o.pane.ompShell&&o.pane.status!==`working`)),ae=n(()=>!(K.value||!o.pane||!o.pane.agent||o.pane.status!==`working`&&!re.value||G.value)),J=n(()=>!K.value&&!G.value&&o.pane?.claudeSuggestion||null),oe=n(()=>!(!J.value||z.value));function se(){let e=J.value;e&&(D.value=e,ut())}let ce=h(null),le=h(0);B(oe,()=>P(()=>{le.value=ce.value?ce.value.offsetWidth+16:0}),{immediate:!0});function de(){let e=J.value;if(!e)return;let t=!!(A.value&&document.activeElement===A.value);D.value=e,t&&ut()}let fe=n(()=>{let e=o.pane;return e?e.status===`blocked`?Q(`Type a reply…`):J.value?J.value:e.agent?Z(`Message to ${hr(e.agent)}…`,`Message à ${hr(e.agent)}…`):Q(`Command…`):Q(`Message to agent…`)});function pe(e){if(rt.value&&!e.isComposing){let t=nt.value.length;if(e.key===`ArrowDown`){e.preventDefault(),it=`kb`,Ze.value=(Ze.value+1)%t;return}if(e.key===`ArrowUp`){e.preventDefault(),it=`kb`,Ze.value=(Ze.value-1+t)%t;return}if(e.key===`Escape`){e.preventDefault(),Qe.value=!0;return}if(e.key===`Tab`||z.value&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),ot(nt.value[Ze.value]||nt.value[0]);return}}if(e.key===`Tab`&&!e.shiftKey&&!e.isComposing&&J.value&&!D.value){e.preventDefault(),se();return}z.value&&e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&!D.value.trim()&&(e.preventDefault(),De())}let ge=new nm;function _e(e){let t=A.value;if(!t||e.target!==t||rt.value||R.value)return;let n={text:t.value,start:t.selectionStart,end:t.selectionEnd},r=tm(e,n);if(r===null)return;let i=ge.move(r,n,am(o.paneId));i&&(e.preventDefault(),D.value=i.text,Qe.value=!0,P(()=>{Qe.value=!0,t.setSelectionRange(i.start,i.end)}))}w(()=>window.addEventListener(`keydown`,_e)),U(()=>{window.removeEventListener(`keydown`,_e),ge.draft&&(D.value=ge.draft.text)});function ve(e){om(o.paneId,e),ge.reset()}function be(e){e.preventDefault(),De()}let xe=n(()=>K.value||!G.value&&!ae.value||R.value||Oe.value===`running`),Se=h(!1),Ce=dm({enabled:()=>ae.value||!xe.value,run:()=>{ae.value?Ae():De()},press:e=>{Se.value=e}}),Ee=n(()=>Lr.value&&!ae.value);async function De(){if(K.value)return $(Q(`Sending unavailable offline`),!0);if(ae.value)return Ae();if(V.value.some(e=>!e.paste&&!e.path))return $(Q(V.value.some(e=>!e.path&&e.file)?`File is uploading…`:`Photo is uploading…`));let e=V.value.flatMap(e=>e.paste?[e.paste]:[]),t=V.value.flatMap(e=>e.paste?[]:[e.ref||e.path]),n=D.value,r=ze(n,e,t);if(!r||R.value)return;let i=o.pane,a=i&&i.status===`blocked`?i.prompt:null,c=a?a.options.findIndex(e=>e.free):-1;if(c<0&&Ot(i)&&!kc(r)){ve(n),D.value=``,Me(),vt(e),X(),s(`sent`,null),jn(i,o.paneId,r).then(()=>s(`sent`,null),e=>$(e.message,!0));return}R.value=!0,vt(e);try{let e=null;if(a&&c>=0){if(!await he(o.paneId,c,a.options[c].label,a.identity,{text:r,question:a.question}))return}else e=await He(i,o.paneId,r);ve(n),D.value=``,Me(),X(),s(`sent`,e);let l=r.split(/\s/)[0],u=Je.get(o.paneId)?.list||Ye.value;c<0&&i&&i.agent&&!t.length&&/^\/\S+$/.test(l)&&!r.includes(`
90
+ `)&&!ye(l,u)&&Te(o.paneId,l,u.some(e=>e.source===`builtin`&&`/${e.name}`===l))}catch(e){$(e.message,!0)}finally{R.value=!1}}let Oe=h(null),ke=h(!1);async function Ae(){if(Oe.value!==`running`){X(),Oe.value=`running`,ke.value=re.value;try{let e=await _i(`/api/interrupt`,{pane_id:o.paneId,restore:!!o.takeBack});if(Oe.value=e.stopped?null:`failed`,ke.value=!!e.shell,e.shell){e.stopped&&$(Z(`Command cancelled`,`Commande annulée`));return}if(e.restored!==void 0){zn(T,e.restored),ut();let t=Z(`Stopped: your message is back in the field`,`Arrêté : ton message est revenu dans le champ`);e.lost?$(t,!0,Nn(e.lost)):$(t)}else e.stopped&&$(e.background?Z(`Agent stopped (${e.background} background task${e.background>1?`s`:``} stopped)`,`Agent arrêté (${e.background} tâche${e.background>1?`s`:``} de fond arrêtée${e.background>1?`s`:``})`):Q(`Agent stopped`))}catch(e){Oe.value=null,$(e.message,!0)}}}B(()=>o.pane?.status,e=>{Oe.value===`failed`&&!ke.value&&e!==`working`&&(Oe.value=null)}),B(re,e=>{Oe.value===`failed`&&ke.value&&!e&&(Oe.value=null)});function je(){return!o.escStops||!ae.value||R.value||Oe.value===`running`?!1:(Ae(),A.value?.focus(),!0)}function Me(){for(let e of V.value)e.url&&URL.revokeObjectURL(e.url);V.value=[]}function Ne(e){At.value=e.url}function Pe(e){let[t]=V.value.splice(e,1);t&&t.url&&URL.revokeObjectURL(t.url)}B(()=>V.value.length,()=>P(Rn)),B(D,()=>P(()=>{let e=A.value;!e||e.scrollHeight<=e.clientHeight||document.activeElement!==e||e.selectionEnd>=e.value.length-1&&(e.scrollTop=e.scrollHeight)}));async function Fe(e){for(let t of e){let e=r({url:URL.createObjectURL(t),path:null});V.value.push(e);try{let n=await af(o.paneId,t);e.path=n.path,e.name=n.name}catch(t){$(`${Q(`Photo upload failed`)} : ${t.message}`,!0),V.value=V.value.filter(t=>t!==e),URL.revokeObjectURL(e.url)}}}async function Le(e){let t=o.pane,{images:n,files:r,refused:i}=await Un(e,t?.agent);if(i.length){let e=hr(t?.agent),n=i.map(e=>e.file.name).join(`, `),r=[...new Set(i.map(t=>kn(t.reason,e,t.kind)))];$(Z(`Not attached: ${n}`,`Non joint : ${n}`),!0,r.join(` · `))}n.length&&Fe(n);for(let e of r)Re(e.file,e.kind);return n.length+r.length}async function Re(e,t){let n=r({url:``,path:null,file:{label:e.name,size:e.size,kind:t}});V.value.push(n);try{let t=await fetch(`/api/attach?pane=${encodeURIComponent(o.paneId)}&name=${encodeURIComponent(e.name)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:e}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(Q(r.error||`HTTP ${t.status}`));n.path=r.path,n.name=r.name,n.ref=r.ref}catch(t){$(`${e.name} : ${Q(`File upload failed`)} — ${t.message}`,!0),V.value=V.value.filter(e=>e!==n)}}function Be(e){let t=e.target,n=[...t.files||[]];t.value=``,Le(n)}function Ve(e){We(e,e.clipboardData)}function Ue(e){e.inputType===`insertFromPaste`&&We(e,e.dataTransfer,e.data||``)}function We(e,t,n=``){let r=e.target,i=t?.getData(`text/plain`)||n||fm(t?.getData(`text/html`)||``);if(Ki(e,t,i.length,r,()=>V.value.length),!e.cancelable)return;let a=[...t?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e);if(a.length){e.preventDefault(),Le(a),X();return}if(!i)return;e.preventDefault();let o=i.replace(/\r\n?/g,`
91
+ `);if(Ie(o))return Ge(o);let s=mi(o),c=r.value;if(!(document.activeElement===r&&typeof document.execCommand==`function`&&document.execCommand(`insertText`,!1,s))){let e=r.selectionStart??c.length;r.value=c.slice(0,e)+s+c.slice(r.selectionEnd??e),r.setSelectionRange(e+s.length,e+s.length),r.dispatchEvent(new Event(`input`,{bubbles:!0}))}D.value=r.value}function Ge(e){V.value.push({url:``,path:null,paste:e}),X()}async function Ke(){if(!navigator.clipboard||!navigator.clipboard.read)return $(Q(`Clipboard unavailable here — paste into the message field.`),!0);try{let e=[];for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));n&&e.push(new File([await t.getType(n)],`presse-papiers.${n.split(`/`)[1]}`,{type:n}))}if(!e.length)return $(Q(`No image in the clipboard`),!0);Fe(e)}catch(e){let t=e;$(t.name===`NotAllowedError`?Q(`Paste denied`):`${Q(`Paste failed`)} : ${t.message}`,!0)}}let Je=new Map,Ye=h([]),Xe=h(null),Ze=h(0),Qe=h(!1),$e=h(null),et=n(()=>{let e=/^\/(\S*)$/.exec(D.value);return o.pane&&o.pane.agent&&e?e[1].toLowerCase():null});async function tt(){let e=o.paneId,t=Je.get(e);if(!(t&&(Ye.value=t.list,Xe.value=t.denied,Date.now()-t.at<15e3)))try{let n=await _i(`/api/commands?pane=${encodeURIComponent(e)}`);if(n.partial&&t)return;let r=n.denied?{remote:!!n.remote}:null;n.partial||Je.set(e,{at:Date.now(),list:n.commands,denied:r}),e===o.paneId&&(Ye.value=n.commands,Xe.value=r)}catch{}}B(et,(e,t)=>{if(e===null){Qe.value=!1;return}t??tt(),Ze.value=0}),B(()=>o.paneId,()=>{Ye.value=[],Xe.value=null});let nt=n(()=>{let e=et.value;if(e===null)return[];let t=[],n=[],r=[];for(let i of Ye.value){let a=i.name.toLowerCase();a.startsWith(e)?t.push(i):a.includes(e)?n.push(i):e.length>1&&i.desc.toLowerCase().includes(e)&&r.push(i)}return[...t,...n,...r]}),rt=n(()=>et.value!==null&&!Qe.value&&(nt.value.length>0||!!Xe.value)&&(nt.value.length!==1||nt.value[0].name.toLowerCase()!==et.value)),it=``;function at(e,t){let n=`${e.screenX},${e.screenY}`,r=it===`kb`;n!==it&&(it=n,!r&&(Ze.value=t))}function ot(e){D.value=`/${e.name} `,X(),P(()=>A.value?.focus())}B(Ze,e=>P(()=>{($e.value?.children[e])?.scrollIntoView({block:`nearest`})}));let st={claude:[[`/compact`,`Summarize context`],[`/clear`,`New conversation`],[`/context`,`Context usage`],[`/usage`,`Plan usage`],[`/model`,`Change model`],[`/review`,`Code review`]],codex:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/status`,`Session status`],[`/model`,`Change model`],[`/review`,`Code review`],[`/diff`,`View diff`]],omp:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/plan`,`Plan mode`],[`/model`,`Change model`],[`/fast`,`Priority service tier`]]};function ct(){let e=o.pane;if(!e)return;let t=[{label:Q(`Photo or screenshot`),icon:`i-lucide-image`,run:()=>F.value?.click()},{label:e.agent===`claude`?Q(`File (PDF, text, code)`):Q(`File (text, code)`),icon:`i-lucide-paperclip`,run:()=>L.value?.click()},{label:Q(`Paste copied image`),icon:`i-lucide-clipboard-paste`,run:Ke}];if(e.agent){t.push({kind:`separator`}),t.push({kind:`command`,cmd:`esc`,desc:Q(`Interrupt agent`),run:()=>o.sendKeys([`esc`])});for(let[n,r]of st[e.agent]||[])t.push({kind:`command`,cmd:n,desc:Q(r),run:()=>lt(n)});t.push({kind:`note`,label:Q(`Commands that open a menu (model…) can then be controlled in the Terminal tab.`)})}we(t)}async function lt(e,t=!0){try{await _i(`/api/prompt`,{pane_id:o.paneId,text:e}),om(o.paneId,e),X()}catch(e){return $(e.message,!0)}t&&Te(o.paneId,e)}function ut(){dt(null)}function dt(e){A.value?.focus(),P(()=>{let t=A.value;if(!t)return;t.focus();let n=e===null?t.value.length:Math.min(e,t.value.length);t.setSelectionRange(n,n),e===null&&(t.scrollTop=t.scrollHeight)})}function ft(e){z.value&&dt(e)}return t({focus:()=>A.value?.focus(),focusEnd:ut,focusAnswer:ft,blur:()=>A.value?.blur(),addImages:Fe,addFiles:Le,stop:je}),(t,n)=>{let r=qe,i=bp,o=zp,h=ao,S=Xa,w=Et,T=qp,A=bt,P=Yp,R=Qp;return _(),v(`div`,{class:`composer`,"data-agent":e.pane?.agent||void 0},[f(Oe)?(_(),v(`div`,{key:0,class:j([`composer-notice restart`,{failed:f(Oe)===`failed`}]),role:`status`},[f(Oe)===`failed`?(_(),v(k,{key:0},[I(`span`,mm,M(f(ke)?(`tl`in t?t.tl:f(Z))(`The command is still running.`,`La commande tourne encore.`):(`t`in t?t.t:f(Q))(`The agent is still working.`)),1),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[0]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Q))(`View terminal`)),1)),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[1]||=e=>Oe.value=null},M((`t`in t?t.t:f(Q))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[14]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,hm,M(f(ke)?(`tl`in t?t.tl:f(Z))(`Cancelling the command…`,`Annulation de la commande…`):(`t`in t?t.t:f(Q))(`Stopping…`)),1)],64))],2)):e.pane?.restart?(_(),v(`div`,{key:1,class:j([`composer-notice restart`,e.pane.restart.phase]),role:`status`},[e.pane.restart.phase===`failed`?(_(),v(k,{key:0},[I(`span`,gm,M(e.pane.restart.update?(`t`in t?t.t:f(Q))(`Codex update failed`):(`t`in t?t.t:f(Q))(`Restart failed`))+M((`tl`in t?t.tl:f(Z))(`: `,` : `))+M((`t`in t?t.t:f(Q))(e.pane.restart.error||``)),1),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[2]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Q))(`View terminal`)),1)),e.pane.restart.update?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:C},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)])):g(``,!0),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[3]||=n=>(`dismissRestart`in t?t.dismissRestart:f(me))(e.paneId)},M((`t`in t?t.t:f(Q))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[15]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,_m,M(f(b)),1)],64))],2)):e.conversation&&e.pane?.usageLimit?(_(),m(i,{key:2,limit:e.pane.usageLimit,"read-only":f(K),"send-keys":e.sendKeys,onCredits:n[4]||=e=>lt(`/usage-credits`,!1)},null,8,[`limit`,`read-only`,`send-keys`])):e.pane?.claudeNotice?(_(),v(`div`,{key:3,class:j([`composer-notice`,{error:f(d)}]),role:`status`},[f(p)?(_(),v(k,{key:0},[I(`span`,vm,M(e.pane.claudeNotice.replace(/\s*·\s*Restart to update\b.*$/,``))+` ·`,1),I(`button`,{type:`button`,class:`notice-btn`,disabled:f(K),onClick:n[5]||=n=>(`restartAgent`in t?t.restartAgent:f(ie))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Q))(`Restart to update`)),1)],8,ym)],64)):(_(),v(k,{key:1},[a(M(f(d)&&!/^[✗✘]/.test(e.pane.claudeNotice)?`✘ ${e.pane.claudeNotice}`:e.pane.claudeNotice),1)],64))],2)):e.pane?.codexStatus?(_(),m(o,{key:4,pane:e.pane,"pane-id":e.paneId,"read-only":f(K)},null,8,[`pane`,`pane-id`,`read-only`])):g(``,!0),e.pane?.agent===`codex`&&e.pane.codexField&&!f(Oe)?(_(),v(`div`,bm,[E(r,{name:`i-lucide-text-cursor-input`,class:`notice-icon`}),I(`span`,{class:`restart-text`,title:f(c)},[a(M((`tl`in t?t.tl:f(Z))(`In Codex’s field:`,`Dans le champ de Codex :`))+` `,1),I(`code`,null,M(e.pane.codexField),1)],8,xm),I(`button`,{type:`button`,class:`notice-btn`,disabled:f(K)||f(l),title:f(c),onClick:u},M((`tl`in t?t.tl:f(Z))(`Clear`,`Vider`)),9,Sm),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[6]||=e=>s(`showTerminal`)},[E(r,{name:`i-lucide-terminal`}),I(`span`,Cm,M((`t`in t?t.t:f(Q))(`View terminal`)),1)]))])):g(``,!0),f(rt)?(_(),v(`div`,{key:6,class:`slash-menu`,role:`listbox`,"aria-label":(`t`in t?t.t:f(Q))(`Commands`)},[f(nt).length?(_(),v(`div`,{key:0,ref_key:`slashListEl`,ref:$e,class:`slash-list`},[(_(!0),v(k,null,y(f(nt),(e,t)=>(_(),v(`button`,{key:e.name,type:`button`,role:`option`,class:j([`slash-item`,{on:t===f(Ze)}]),"aria-selected":t===f(Ze),onMousedown:n[7]||=q(()=>{},[`prevent`]),onMousemove:e=>at(e,t),onClick:t=>ot(e)},[I(`span`,Em,[a(`/`+M(e.name),1),e.hint?(_(),v(`small`,Dm,M(e.hint),1)):g(``,!0)]),I(`span`,Om,M(e.desc),1)],42,Tm))),128))],512)):g(``,!0),f(Xe)?(_(),v(`div`,km,[I(`p`,Am,[E(r,{name:`i-lucide-shield-alert`}),a(M((`tl`in t?t.tl:f(Z))(`macOS hides this project’s commands`,`macOS masque les commandes de ce projet`)),1)]),I(`p`,null,[a(M((`tl`in t?t.tl:f(Z))(`Typed in full, they still work. To list them, on the Mac:`,`Tapées en entier, elles marchent quand même. Pour les lister, sur le Mac :`))+` `,1),I(`span`,jm,M(f(Xe).remote?(`tl`in t?t.tl:f(Z))(`System Settings › General › Sharing › Remote Login ⓘ › “Allow full disk access for remote users”`,`Réglages Système › Général › Partage › Session à distance ⓘ › « Autoriser l’accès complet au disque pour les utilisateurs distants »`):(`tl`in t?t.tl:f(Z))(`System Settings › Privacy & Security › Full Disk Access`,`Réglages Système › Confidentialité et sécurité › Accès complet au disque`)),1)])])):g(``,!0)],8,wm)):g(``,!0),e.unanswered&&!f(K)?(_(),v(`div`,Mm,[I(`button`,{type:`button`,class:`composer-ask`,onMousedown:n[8]||=q(()=>{},[`prevent`]),onClick:n[9]||=e=>s(`showUnanswered`)},[E(r,{name:`i-lucide-arrow-up`}),I(`span`,null,M(e.unanswered>1?(`tl`in t?t.tl:f(Z))(`${e.unanswered} questions unanswered`,`${e.unanswered} questions sans réponse`):(`tl`in t?t.tl:f(Z))(`1 question unanswered`,`1 question sans réponse`)),1)],32)])):g(``,!0),f(ee).length?(_(),v(`div`,{key:8,class:`composer-quotes`,role:`list`,"aria-label":(`t`in t?t.t:f(Q))(`Quoted questions`)},[I(`span`,Pm,`↳ `+M(f(ee).length),1),(_(!0),v(k,null,y(f(ee),e=>(_(),v(`span`,{key:e.start,class:`composer-quote`,role:`listitem`},[I(`span`,Fm,M(e.excerpt),1),I(`button`,{type:`button`,class:`composer-quote-x`,"aria-label":(`t`in t?t.t:f(Q))(`Remove quote`),onMousedown:n[10]||=q(()=>{},[`prevent`]),onClick:t=>D.value=f(yr)(f(D),e)},[E(r,{name:`i-lucide-x`})],40,Im)]))),128))],8,Nm)):g(``,!0),E(R,{ref_key:`promptRef`,ref:O,modelValue:f(D),"onUpdate:modelValue":n[13]||=e=>W(D)?D.value=e:null,disabled:!!e.pane?.stopped,placeholder:e.pane?.stopped?(`t`in t?t.t:f(Q))(`Restart Codex before sending a message`):f(K)?(`t`in t?t.t:f(Q))(`Draft saved — sending unavailable offline`):f(fe),variant:`outline`,color:`neutral`,rows:1,maxrows:7,autofocus:!1,"submit-on-enter":f(z)&&!f(rt),enterkeyhint:f(z)?`send`:`enter`,autocapitalize:`sentences`,class:j([`prompt`,{suggesting:f(oe)}]),style:N(f(le)?{"--suggest-room":`${f(le)}px`}:void 0),ui:{header:`prompt-head`,body:`prompt-body`,base:`prompt-input`,footer:`prompt-foot`},onSubmit:De,onKeydown:pe,onPaste:Ve,onBeforeinput:Ue},x({footer:H(()=>[n[20]||=I(`span`,{class:`fx-ring`,"aria-hidden":`true`},[I(`span`,{class:`fx-spin`})],-1),n[21]||=I(`span`,{class:`fx-halo`,"aria-hidden":`true`},[I(`span`,{class:`fx-spin`})],-1),f(oe)?(_(),v(`button`,{key:0,ref_key:`suggestBtn`,ref:ce,type:`button`,class:`prompt-suggest`,"aria-label":(`t`in t?t.t:f(Q))(`Use suggestion`),onMousedown:n[11]||=q(()=>{},[`prevent`]),onClick:de},[E(r,{name:`i-lucide-corner-down-left`}),I(`span`,null,M((`tl`in t?t.tl:f(Z))(`Use`,`Utiliser`)),1)],40,Hm)):g(``,!0),E(w,{icon:`i-lucide-plus`,color:`neutral`,variant:`outline`,size:`sm`,class:`prompt-plus`,disabled:f(K),"aria-label":(`t`in t?t.t:f(Q))(`Photo, file, paste, commands`),onClick:ct},null,8,[`disabled`,`aria-label`]),I(`input`,{ref_key:`fileInput`,ref:F,type:`file`,accept:`image/*`,multiple:``,hidden:``,onChange:Be},null,544),I(`input`,{ref_key:`anyFileInput`,ref:L,type:`file`,multiple:``,hidden:``,"data-testid":`attach-any`,onChange:Be},null,544),e.pane&&(e.pane.agent===`claude`||e.pane.agent===`codex`||e.pane.agent===`omp`)?(_(),m(T,{key:1,pane:e.pane},null,8,[`pane`])):g(``,!0),f(Ee)&&f(J)?(_(),v(`span`,Um,[E(A,{value:`tab`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`suggestion`))+` `,1),n[16]||=I(`span`,{class:`sep`},`·`,-1),n[17]||=a(),E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`send`)),1)])):f(Ee)?(_(),v(`span`,Wm,[E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`send`))+` `,1),n[18]||=I(`span`,{class:`sep`},`·`,-1),n[19]||=a(),E(A,{value:`shift`,size:`sm`}),E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`new line`)),1)])):(`desk`in t?t.desk:f(Lr))&&e.escStops&&f(ae)&&f(Oe)!==`running`?(_(),v(`span`,Gm,[E(A,{value:`escape`,size:`sm`}),a(` `+M((`tl`in t?t.tl:f(Z))(`stop`,`arrêter`)),1)])):g(``,!0),E(P,{status:f(ae)?`streaming`:`ready`,disabled:f(xe),color:`primary`,variant:`solid`,"streaming-color":`neutral`,"streaming-variant":`solid`,"streaming-icon":`i-herdr-stop`,size:`sm`,class:j([`prompt-send`,{stop:f(ae),pressed:f(Se)}]),"aria-label":f(ae)&&f(re)?(`tl`in t?t.tl:f(Z))(`Cancel the command`,`Annuler la commande`):(`t`in t?t.t:f(Q))(f(ae)?`Stop the agent`:`Send`),onMousedown:n[12]||=q(()=>{},[`prevent`]),onClick:be,onStop:Ae,onTouchstart:f(Ce).start,onTouchend:f(Ce).end,onTouchcancel:f(Ce).cancel},null,8,[`status`,`disabled`,`class`,`aria-label`,`onTouchstart`,`onTouchend`,`onTouchcancel`])]),_:2},[f(V).length?{name:`header`,fn:H(()=>[I(`div`,Lm,[(_(!0),v(k,null,y(f(V),(e,n)=>(_(),v(k,{key:e.url||e.path||e.file?.label||`paste:${n}`},[e.paste?(_(),m(h,{key:0,text:e.paste,removable:``,onRemove:e=>Pe(n)},null,8,[`text`,`onRemove`])):e.file?(_(),m(S,{key:1,name:e.file.label,size:e.file.size,kind:e.file.kind,uploading:!e.path,removable:``,onRemove:e=>Pe(n)},null,8,[`name`,`size`,`kind`,`uploading`,`onRemove`])):(_(),v(`div`,{key:2,class:j([`att`,{up:!e.path}]),role:`button`,tabindex:`0`,"aria-label":(`t`in t?t.t:f(Q))(`View image`),onClick:t=>Ne(e),onKeydown:ne(q(t=>Ne(e),[`self`]),[`enter`])},[I(`img`,{src:e.url,alt:``},null,8,zm),e.path?g(``,!0):(_(),v(`span`,Bm)),I(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Remove`),onClick:q(e=>Pe(n),[`stop`])},[E(r,{name:`i-lucide-x`})],8,Vm)],42,Rm))],64))),128))])]),key:`0`}:void 0]),1032,[`modelValue`,`disabled`,`placeholder`,`submit-on-enter`,`enterkeyhint`,`class`,`style`]),e.pane?.ompStatus?(_(),v(`div`,{key:9,class:`composer-status`,title:[e.pane.ompStatus.line,e.pane.ompStatus.meters].filter(Boolean).join(`
92
+ `)},[I(`span`,qm,M(e.pane.ompStatus.line),1),e.pane.ompStatus.meters?(_(),v(`span`,Jm,M(e.pane.ompStatus.meters),1)):g(``,!0)],8,Km)):g(``,!0)],8,pm)}}}),{__name:`Composer`}),Xm=[`aria-label`],Zm={class:`review-note-head`},Qm={class:`review-range`},$m={key:0,class:`review-path`},eh={key:0,class:`review-warning`,role:`status`},th=[`id`,`value`,`placeholder`,`aria-label`],nh={class:`review-note-actions`},rh={class:`review-keys`,"aria-hidden":`true`},ih=[`disabled`],ah={class:`review-body`},oh={class:`review-note-actions`},sh=[`aria-label`],ch=[`aria-label`],lh=Object.assign(T({__name:`ReviewNote`,props:{comment:{},label:{},missing:{type:Boolean},changed:{type:Boolean}},emits:[`act`,`hover`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>r.comment.draft!==void 0),o=n(()=>r.comment.draft??``),s=n(()=>o.value.trim()!==r.comment.body.trim()),c=h(``);B(a,()=>{c.value=``});let l=/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``)?`⌘↵`:`Ctrl+↵`;function u(e){c.value=``,i(`act`,`draft`,r.comment.id,e.target.value)}function d(){o.value.trim()&&i(`act`,`save`,r.comment.id)}function p(){if(s.value&&c.value!==`cancel`){c.value=`cancel`;return}i(`act`,`cancel`,r.comment.id)}function m(){if(c.value!==`remove`){c.value=`remove`;return}i(`act`,`remove`,r.comment.id)}function y(e){if(!e.isComposing){if(e.key===`Escape`&&(a.value||c.value))e.preventDefault(),e.stopPropagation(),a.value?p():c.value=``;else if(a.value)e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d());else return}}return(t,n)=>(_(),v(`div`,{class:j([`review-note`,{missing:e.missing,editing:f(a)}]),role:`group`,"aria-label":`${e.label}: ${(`t`in t?t.t:f(Q))(`review comment`)}`,onKeydown:y,onMouseenter:n[3]||=t=>i(`hover`,e.comment.id),onMouseleave:n[4]||=e=>i(`hover`,null),onFocusin:n[5]||=t=>i(`hover`,e.comment.id),onFocusout:n[6]||=e=>i(`hover`,null)},[I(`div`,Zm,[I(`span`,Qm,M(e.label),1),e.missing?(_(),v(`span`,$m,M(e.comment.path),1)):g(``,!0)]),e.missing?(_(),v(`p`,eh,M(e.changed?(`t`in t?t.t:f(Q))(`The code of this block changed. Check this comment before sending.`):(`t`in t?t.t:f(Q))(`No longer in the diff. Check this comment before sending.`)),1)):g(``,!0),f(a)?(_(),v(k,{key:1},[I(`textarea`,{id:`review-${e.comment.id}`,value:f(o),placeholder:(`t`in t?t.t:f(Q))(`Write a review comment…`),"aria-label":`${e.label}: ${(`t`in t?t.t:f(Q))(`review comment`)}`,rows:`3`,onInput:u,onFocus:n[0]||=e=>e.target.scrollIntoView({block:`nearest`})},null,40,th),I(`div`,nh,[I(`span`,rh,M(f(l))+` `+M((`t`in t?t.t:f(Q))(`to save`))+` · Esc `+M((`t`in t?t.t:f(Q))(`to cancel`)),1),I(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`cancel`}]),onClick:p},M(f(c)===`cancel`?(`t`in t?t.t:f(Q))(`Discard this text?`):(`t`in t?t.t:f(Q))(`Cancel`)),3),I(`button`,{type:`button`,class:`review-btn primary`,disabled:!f(o).trim(),onClick:d},M(e.comment.body?(`t`in t?t.t:f(Q))(`Save`):(`t`in t?t.t:f(Q))(`Comment`)),9,ih)])],64)):(_(),v(k,{key:2},[I(`p`,ah,M(e.comment.body),1),I(`div`,oh,[I(`button`,{type:`button`,class:`review-btn`,"aria-label":(`t`in t?t.t:f(Q))(`Edit comment`),onClick:n[1]||=t=>i(`act`,`edit`,e.comment.id)},M((`tl`in t?t.tl:f(Z))(`Edit`,`Modifier`)),9,sh),I(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`remove`}]),"aria-label":f(c)===`remove`?(`t`in t?t.t:f(Q))(`Confirm delete`):(`t`in t?t.t:f(Q))(`Delete comment`),onClick:m,onBlur:n[2]||=e=>c.value=``},M(f(c)===`remove`?(`t`in t?t.t:f(Q))(`Confirm delete`):(`t`in t?t.t:f(Q))(`Delete`)),43,ch)])],64))],42,Xm))}}),{__name:`ReviewNote`});function uh(e){let t=null,n=null;return e.map(e=>{let r=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e.text);e.kind===`hunk`&&(t=r?Number(r[1]):null,n=r?Number(r[2]):null);let i=e.kind===`del`?`old`:`new`,a=[`add`,`del`,`context`].includes(e.kind)?i===`old`?t:n:null;return(e.kind===`del`||e.kind===`context`)&&t!==null&&t++,(e.kind===`add`||e.kind===`context`)&&n!==null&&n++,{...e,number:a,side:i}})}function dh(e,t){let n=t,r=t;for(;n>0&&e[n-1].kind!==`hunk`;)n--;for(;r<e.length-1&&e[r+1].kind!==`hunk`;)r++;for(;n<t&&e[n].number===null;)n++;for(;r>t&&e[r].number===null;)r--;return[n,r]}function fh(e,t,n){let[r,i]=dh(e,t),a=Math.min(Math.max(n,r),i);for(;a!==t&&e[a].number===null;)a+=a<t?1:-1;return t<=a?[t,a]:[a,t]}var ph=e=>e.filter(e=>e.number!==null);function mh(e){let t={};for(let n of ph(e)){let e=t[n.side];t[n.side]=e?[Math.min(e[0],n.number),Math.max(e[1],n.number)]:[n.number,n.number]}return t}var hh=100;function gh(e){let t=ph(e).map(e=>e.text.trimEnd()).filter(e=>e.length>1);return(t.length>3?[t[0],`…`,t.at(-1)]:t).map(e=>e.length>hh?`${e.slice(0,99)}…`:e)}function _h(e){let t=2166136261;for(let n of ph(e).map(e=>e.text).join(`
93
+ `))t=Math.imul(t^n.codePointAt(0),16777619);return(t>>>0).toString(16)}function vh(e){let t=ph(e),n=t[0],r=t.at(-1);return{number:n.number,side:n.side,text:n.text,end:t.length>1?{number:r.number,side:r.side,text:r.text}:void 0,span:mh(t),excerpt:gh(t),hash:_h(t)}}var yh=(e,t)=>e.number===t.number&&e.side===t.side&&e.text===t.text;function bh(e,t){return yh(e,t)&&!!e.end==!!t.end&&(!e.end||yh(e.end,t.end))}function xh(e,t){for(let n=0;n<t.length;n++)if(yh(e,t[n])){if(!e.end)return[n,n];for(let r=n+1;r<t.length&&t[r].kind!==`hunk`;r++)if(yh(e.end,t[r]))return[n,r]}return null}function Sh(e,t){let n=xh(e,t);return n&&(!e.hash||e.hash===_h(t.slice(n[0],n[1]+1)))?n:null}function Ch(e,t){let n=t[e.scope]?.files.find(t=>t.path===e.path);return n?uh(n.lines):null}function wh(e,t,n=!1){if(t.git&&e.scope===`committed`&&!t.committed&&!n)return null;let r=Ch(e,t);return r&&Sh(e,r)?null:r&&xh(e,r)?`changed`:`gone`}function Th(e,t,n=!1){return e.filter(e=>wh(e,t,n))}function Eh(e,t){return e.map(e=>{let n=Ch(e,t),r=n&&Sh(e,n);return r?{...e,...vh(n.slice(r[0],r[1]+1)),end:e.end}:e})}function Dh(e){return(e.draft?.trim()?e.draft:e.body).trim()}function Oh(e){let t=[e.number,e.number];return e.span??(e.side===`old`?{old:t}:{new:t})}var kh=(e,t)=>e[0]===e[1]?`${e[0]}`:`${e[0]}${t}${e[1]}`,Ah=e=>e[0]!==e[1];function jh(e,t){let n=e.old&&(Ah(e.old)?t.oldLines:t.oldLine);if(!e.new)return e.old?`${Ah(e.old)?t.lines:t.line} ${kh(e.old,`–`)} (${n})`:``;let r=`${Ah(e.new)?t.lines:t.line} ${kh(e.new,`–`)}`;return e.old?`${r} + ${n} ${kh(e.old,`–`)}`:r}function Mh(e,t,n={}){let r=new Map;for(let i of e){let e=Dh(i).replace(/\s*\n\s*/g,` `);if(!e)continue;let a=Oh(i),o=a.old&&(Ah(a.old)?t.oldLines:t.oldLine),s=[a.old?a.new?`${o} ${kh(a.old,`-`)}`:o:``,n[i.id]===`changed`?t.changed??t.missing:n[i.id]?t.missing:``].filter(Boolean),c=`${i.path}:${kh(a.new??a.old,`-`)}${s.length?` (${s.join(`, `)})`:``} — ${e}`,l=(i.excerpt??[i.text.trimEnd()]).filter(Boolean).map(e=>` ${e}`);r.has(i.path)||r.set(i.path,[]),r.get(i.path).push([c,...l].join(`
92
94
  `))}return r.size?`${t.intro}\n\n${[...r.values()].map(e=>e.join(`
93
95
  `)).join(`
94
96
 
95
- `)}`:``}var Ah=[`aria-label`,`aria-describedby`],jh=[`id`],Mh=[`data-row`,`onClick`],Nh=[`tabindex`,`aria-label`,`aria-pressed`,`onPointerdown`,`onClick`,`onKeydown`,`onFocus`],Ph={class:`review-number`},Fh={class:`review-source`},Ih=Object.assign(T({__name:`ReviewDiff`,props:{file:{},scope:{},comments:{},selection:{}},emits:[`add`,`select`,`act`],setup(e,{emit:t}){let r=e,i=t,a=h(null),o=p(),s=n(()=>sh(r.file.lines)),c=n(()=>({line:Q(`Line`),lines:Q(`Lines`),oldLine:Q(`old line`),oldLines:Q(`old lines`)})),u=h(null),d=n(()=>r.comments.flatMap(e=>{let t=e.scope===r.scope&&e.path===r.file.path?yh(e,s.value):null;return t?[{c:e,at:t}]:[]})),b=n(()=>{let e=new Map,t=new Set,n=new Set;for(let{c:r,at:i}of d.value){e.set(i[1],[...e.get(i[1])??[],r]);let a=r.draft!==void 0||r.id===u.value?t:n;for(let e=i[0];e<=i[1];e++)a.add(e)}return{notes:e,open:t,noted:n}});function x(e){let t=d.value.find(t=>t.c.id===e.id)?.at;return Oh(t?dh(s.value.slice(t[0],t[1]+1)):Th(e),c.value)}let S=n(()=>r.selection&&r.selection.scope===r.scope&&r.selection.path===r.file.path?r.selection:null),C=n(()=>S.value?[Math.min(S.value.anchor,S.value.head),Math.max(S.value.anchor,S.value.head)]:null),w=n(()=>S.value?ch(s.value,S.value.anchor):null);function T(e,t,n){let a=lh(s.value,e,t);return i(`select`,{scope:r.scope,path:r.file.path,anchor:e,head:a[0]===e?a[1]:a[0],via:n,block:s.value.slice(a[0],a[1]+1)}),a}function E(e,t,n){let a=s.value.slice(e,t+1);a.some(e=>e.number!==null)&&i(`add`,r.scope,r.file.path,a,n),i(`select`,null)}let D=``;function O(e){D=e.pointerType}let A=null;function N(e){let t=a.value?.getBoundingClientRect(),n=t&&document.elementFromPoint(t.left+4,e)?.closest(`[data-row]`);return n&&a.value.contains(n)?Number(n.dataset.row):null}function F(e){let t=N(e.clientY);A&&t!==null&&s.value[t]?.number!=null&&(A.at=T(A.anchor,t,`drag`))}function L(){A=null,window.removeEventListener(`pointermove`,F),window.removeEventListener(`pointerup`,R),window.removeEventListener(`pointercancel`,z),window.removeEventListener(`keydown`,V,!0)}function R(){let e=A;L(),e&&E(e.at[0],e.at[1],e.extend)}function z(){L(),i(`select`,null)}function V(e){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),z())}function H(e,t){if(e.pointerType!==`mouse`||e.button!==0)return;e.preventDefault(),e.currentTarget.focus();let[n,r]=ch(s.value,t),i=e.shiftKey?d.value.findLast(e=>e.c.draft!==void 0&&e.at[0]>=n&&e.at[1]<=r):void 0,a=i?t>=i.at[0]?i.at[0]:i.at[1]:t;A={anchor:a,at:T(a,t,`drag`),extend:i?.c.id},window.addEventListener(`pointermove`,F),window.addEventListener(`pointerup`,R),window.addEventListener(`pointercancel`,z),window.addEventListener(`keydown`,V,!0)}l(L),B(()=>r.file,()=>{A&&z()});function U(e){let t=S.value,n=w.value;!t||!n||t.via===`drag`||e<n[0]||e>n[1]?T(e,e,`touch`):e===t.anchor&&t.head===t.anchor?i(`select`,null):T(t.anchor,e,`touch`)}function ee(e,t){if(!e.detail){let e=S.value?.via===`keys`?C.value:null;return E(e?e[0]:t,e?e[1]:t)}D!==`mouse`&&U(t)}function W(e,t){D===`mouse`||S.value?.via!==`touch`||e.number===null||window.getSelection()?.toString()||U(t)}let te=h(-1),G=n(()=>te.value>=0&&s.value[te.value]?.number!=null?te.value:s.value.findIndex(e=>e.number!==null));function ne(e){a.value?.querySelector(`[data-row="${e}"] .review-gutter`)?.focus()}function K(e,t,[n,r]){for(let i=e+t;i>=n&&i<=r;i+=t)if(s.value[i].number!==null)return i;return e}function re(e,t){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let n=e.key===`ArrowDown`?1:-1;if(e.shiftKey){let e=S.value?.via===`keys`?S.value.anchor:t,r=K(t,n,ch(s.value,e));T(e,r,`keys`),ne(r)}else S.value&&i(`select`,null),ne(K(t,n,[0,s.value.length-1]))}else e.key===`Escape`&&S.value&&(e.preventDefault(),e.stopPropagation(),i(`select`,null))}function ie(e,t,n){let r=d.value.find(e=>e.c.id===t)?.at[1];i(`act`,e,t,n),e!==`draft`&&e!==`edit`&&(u.value=null,r!==void 0&&a.value?.contains(document.activeElement)&&P(()=>ne(r)))}function ae(e){return`${Q(`Comment on line`)} ${e.number}${e.side===`old`?` (${Q(`old line`)})`:``}`}return(t,n)=>{let r=oh;return _(),v(`div`,{ref_key:`root`,ref:a,class:j([`change-code`,{picking:f(S),dragging:f(S)?.via===`drag`}]),role:`region`,"aria-label":e.file.path,"aria-describedby":f(o)},[I(`p`,{id:f(o),class:`sr-only`},M((`t`in t?t.t:f(Q))(`Arrow keys move between lines. Shift+Arrow selects a block of lines. Enter writes a comment.`)),9,jh),(_(!0),v(k,null,y(f(s),(e,t)=>(_(),v(k,{key:t},[I(`div`,{class:j([`change-line review-line`,[e.kind,{picked:f(C)&&t>=f(C)[0]&&t<=f(C)[1],open:f(b).open.has(t),noted:f(b).noted.has(t),out:f(w)&&(t<f(w)[0]-1||t>f(w)[1])}]]),"data-row":t,onPointerdown:O,onClick:n=>W(e,t)},[e.number===null?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`review-gutter`,tabindex:t===f(G)?0:-1,"aria-label":ae(e),"aria-pressed":f(C)?t>=f(C)[0]&&t<=f(C)[1]:void 0,onPointerdown:e=>H(e,t),onClick:q(e=>ee(e,t),[`stop`]),onKeydown:e=>re(e,t),onFocus:e=>te.value=t},[n[1]||=I(`span`,{class:`review-plus`,"aria-hidden":`true`},`+`,-1),I(`span`,Ph,M(e.number),1)],40,Nh)),I(`span`,Fh,M(e.text),1)],42,Mh),(_(!0),v(k,null,y(f(b).notes.get(t),e=>(_(),m(r,{key:e.id,comment:e,label:x(e),onAct:ie,onHover:n[0]||=e=>u.value=e},null,8,[`comment`,`label`]))),128))],64))),128))],10,Ah)}}}),{__name:`ReviewDiff`}),Lh=e=>e===`old`||e===`new`,Rh=e=>Number.isInteger(e)&&e>0,zh=e=>!!e&&Rh(e.number)&&Lh(e.side)&&typeof e.text==`string`,Bh=e=>e===void 0||Array.isArray(e)&&e.length===2&&e.every(Rh);function Vh(e){return e&&typeof e.id==`string`&&[`working`,`committed`].includes(e.scope)&&typeof e.path==`string`&&zh(e)&&typeof e.body==`string`&&(e.end===void 0||zh(e.end))&&(e.span===void 0||typeof e.span==`object`&&e.span!==null&&Bh(e.span.new)&&Bh(e.span.old)&&!!(e.span.new||e.span.old))&&(e.excerpt===void 0||Array.isArray(e.excerpt)&&e.excerpt.every(e=>typeof e==`string`))&&(e.draft===void 0||typeof e.draft==`string`)&&(e.hash===void 0||typeof e.hash==`string`)}function Hh(e){try{let t=JSON.parse(e||`[]`);return Array.isArray(t)?t.filter(e=>Vh(e)&&(e.body.trim()||e.draft?.trim())):[]}catch{return[]}}function Uh(e){let t=`review:${e}`,n=h([]);try{n.value=Hh(localStorage.getItem(t))}catch{}B(n,e=>{try{let n=e.length?JSON.stringify(e):null;if(n===localStorage.getItem(t))return;n?localStorage.setItem(t,n):localStorage.removeItem(t)}catch{}},{deep:!0,flush:`sync`});function r(e){if(e.key!==t&&e.key!==null)return;let r=new Map(n.value.filter(e=>e.draft!==void 0).map(e=>[e.id,e]));n.value=Hh(e.key===null?null:e.newValue).map(e=>r.get(e.id)??e)}return typeof window<`u`&&(window.addEventListener(`storage`,r),s(()=>window.removeEventListener(`storage`,r))),n}var Wh={class:`changes-view`},Gh={class:`changes-inner`},Kh={class:`changes-toolbar`},qh={key:0,class:`changes-location`},Jh={key:0,class:`review-hint`},Yh={class:`by-mouse`},Xh={class:`by-touch`},Zh={key:1,class:`review-toolbar`},Qh={role:`status`},$h={key:2,class:`changes-notice error`,role:`alert`},eg={key:3,class:`changes-notice`},tg={key:4,class:`changes-notice`},ng={class:`changes-section`},rg={key:0,class:`changes-notice`},ig={key:0,class:`changes-limit`},ag={class:`change-path`},og={key:0,class:`change-binary`},sg={key:1,class:`change-totals`},cg={class:`change-status`},lg={key:0,class:`change-note`},ug={key:1,class:`change-note`},dg={class:`changes-section`},fg={class:`changes-toggle`},pg={class:`changes-location`},mg={key:0,class:`changes-limit`},hg={key:1,class:`changes-notice`},gg={class:`change-path`},_g={key:0,class:`change-binary`},vg={key:1,class:`change-totals`},yg={key:0,class:`change-note`},bg={key:1,class:`changes-notice`},xg={class:`sr-only`,role:`status`},Sg={key:6,class:`review-pick`},Cg=Object.assign(T({__name:`ChangesView`,props:{paneId:{}},emits:[`review`],setup(e,{emit:t}){let r=e,i=t,o=Uh(r.paneId),s=n(()=>O.value?Sh(o.value,O.value,N.value):[]),c=n(()=>Object.fromEntries(s.value.map(e=>[e.id,xh(e,O.value,N.value)??void 0]))),u=n(()=>o.value.filter(wh).length),d=n(()=>({line:Q(`Line`),lines:Q(`Lines`),oldLine:Q(`old line`),oldLines:Q(`old lines`)})),p=h(null),b=n(()=>p.value?Oh(dh(p.value.block),d.value):``);function x(e){P(()=>document.getElementById(`review-${e}`)?.focus())}function S(e){o.value=o.value.filter(t=>t.id!==e)}function C(e,t,n){let r=o.value.find(e=>e.id===t);r&&(e===`draft`?r.draft=n??``:e===`edit`?(r.draft=r.body,x(t)):e===`save`&&wh(r)?(r.body=wh(r),delete r.draft):e===`cancel`&&r.body?delete r.draft:S(t))}function T(e,t,n,r){if(!n.some(e=>e.number!==null))return;let i=hh(n),a=o.value.find(n=>r?n.id===r:n.scope===e&&n.path===t&&_h(n,i));a&&r?Object.assign(a,i):a?a.draft??=a.body:(a={id:crypto.randomUUID(),scope:e,path:t,...i,body:``,draft:``},o.value.push(a)),p.value=null,x(a.id)}function D(){let e=kh(O.value?Ch(o.value,O.value):o.value,{intro:Q(`Please review these points:`),oldLine:Q(`old line`),oldLines:Q(`old lines`),missing:Q(`no longer in diff`),changed:Q(`code changed since this comment`)},c.value);e&&(i(`review`,e),o.value=[])}let O=h(null),A=h(!1),j=h(``),N=h(o.value.some(e=>e.scope===`committed`)),F=0;async function R(){let e=++F;A.value=!0,j.value=``;try{let t=await fi(`/api/changes?pane=${encodeURIComponent(r.paneId)}&commits=${N.value?`1`:`0`}`);e===F&&(O.value=t)}catch(t){e===F&&(j.value=t.message)}finally{e===F&&(A.value=!1)}}w(R),B(N,R),B(O,()=>{p.value=null}),l(()=>{F++});function z(e){return e.status===`??`?Q(`Untracked`):e.status===`commit`?Q(`Commit`):e.status.includes(`R`)?Q(`Renamed`):e.status.includes(`D`)?Q(`Deleted`):e.status.includes(`A`)?Q(`Added`):Q(`Modified`)}function V(e,t){return e===null?`${t}—`:`${t}${e}`}return(e,t)=>{let n=Et,r=oh,i=Ih;return _(),v(`div`,Wh,[I(`div`,Gh,[I(`div`,Kh,[I(`div`,null,[f(O)?.git?(_(),v(`p`,qh,M(f(O).branch||`HEAD`)+` · `+M(f(O).root),1)):g(``,!0)]),E(n,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(A),"aria-label":(`t`in e?e.t:f(Q))(`Refresh changes`),onClick:R},{default:H(()=>[a(M((`t`in e?e.t:f(Q))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])]),f(O)?.git&&!f(o).length?(_(),v(`p`,Jh,[I(`span`,Yh,M((`t`in e?e.t:f(Q))(`To comment, hover a line and click +. Drag from the + to comment a block of lines.`)),1),I(`span`,Xh,M((`t`in e?e.t:f(Q))(`To comment, tap a line number, then another line for a block.`)),1)])):g(``,!0),f(o).length?(_(),v(`div`,Zh,[I(`span`,Qh,M(f(u))+` `+M((`t`in e?e.t:f(Q))(f(u)===1?`review comment`:`review comments`)),1),E(n,{color:`neutral`,variant:`outline`,onClick:t[0]||=e=>o.value=[]},{default:H(()=>[a(M((`t`in e?e.t:f(Q))(`Discard`)),1)]),_:1}),E(n,{disabled:!f(u),onClick:D},{default:H(()=>[a(M((`t`in e?e.t:f(Q))(`Send review`)),1)]),_:1},8,[`disabled`]),I(`p`,null,M((`t`in e?e.t:f(Q))(`Adds to your message draft. You send it yourself.`)),1)])):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),m(r,{key:e.id,comment:e,label:f(Oh)(f(Th)(e),f(d)),missing:``,changed:f(c)[e.id]===`changed`,onAct:C},null,8,[`comment`,`label`,`changed`]))),128)),f(j)?(_(),v(`p`,$h,M(f(j)),1)):g(``,!0),f(A)&&!f(O)?(_(),v(`p`,eg,[t[6]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in e?e.t:f(Q))(`Reading changes…`)),1)])):f(O)&&!f(O).git?(_(),v(`p`,tg,M((`t`in e?e.t:f(Q))(`This folder is not a Git repository.`)),1)):f(O)?.git?(_(),v(k,{key:5},[I(`section`,ng,[I(`h3`,null,[a(M((`t`in e?e.t:f(Q))(`Working tree`))+` `,1),I(`span`,null,M(f(O).working?.count||0),1)]),f(O).working?.count?(_(),v(k,{key:1},[f(O).working?.truncated?(_(),v(`p`,ig,M((`t`in e?e.t:f(Q))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(O).working?.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[I(`summary`,null,[I(`span`,ag,M(n.path),1),n.binary?(_(),v(`span`,og,M((`t`in e?e.t:f(Q))(`Binary`)),1)):(_(),v(`span`,sg,[I(`b`,null,M(V(n.added,`+`)),1),I(`i`,null,M(V(n.deleted,`−`)),1)])),I(`span`,cg,M(z(n)),1)]),n.previousPath?(_(),v(`p`,lg,M((`t`in e?e.t:f(Q))(`From`))+` `+M(n.previousPath),1)):g(``,!0),n.summary?(_(),v(`p`,ug,M((`t`in e?e.t:f(Q))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:2,file:n,scope:`working`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[1]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):(_(),v(`p`,rg,M((`t`in e?e.t:f(Q))(`No working tree changes.`)),1))]),I(`section`,dg,[I(`label`,fg,[L(I(`input`,{"onUpdate:modelValue":t[2]||=e=>W(N)?N.value=e:null,type:`checkbox`},null,512),[[K,f(N)]]),t[7]||=a(),I(`span`,null,M((`t`in e?e.t:f(Q))(`Also show unpushed commits`)),1)]),f(N)&&f(O).committed?(_(),v(k,{key:0},[I(`h3`,null,[a(M((`t`in e?e.t:f(Q))(`Commits`))+` `,1),I(`span`,null,M(f(O).commits??0),1)]),I(`p`,pg,M(f(O).comparison)+` → HEAD`,1),f(O).committed.truncated?(_(),v(`p`,mg,M((`t`in e?e.t:f(Q))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(O).committed.count?g(``,!0):(_(),v(`p`,hg,M((`t`in e?e.t:f(Q))(`No committed changes to show.`)),1)),(_(!0),v(k,null,y(f(O).committed.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[I(`summary`,null,[I(`span`,gg,M(n.path),1),n.binary?(_(),v(`span`,_g,M((`t`in e?e.t:f(Q))(`Binary`)),1)):(_(),v(`span`,vg,[I(`b`,null,M(V(n.added,`+`)),1),I(`i`,null,M(V(n.deleted,`−`)),1)]))]),n.summary?(_(),v(`p`,yg,M((`t`in e?e.t:f(Q))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:1,file:n,scope:`committed`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[3]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):f(N)&&!f(A)&&!f(O).comparison?(_(),v(`p`,bg,M((`t`in e?e.t:f(Q))(`No upstream or base branch available for comparison.`)),1)):g(``,!0)])],64)):g(``,!0),I(`p`,xg,M(f(b)&&`${(`t`in e?e.t:f(Q))(`Selection:`)} ${f(b)}`),1),f(p)&&f(p).via!==`drag`?(_(),v(`div`,Sg,[I(`div`,null,[I(`b`,null,M(f(b)),1),I(`p`,null,M(f(p).via===`touch`?(`t`in e?e.t:f(Q))(`Tap another line of this hunk to extend the block.`):(`t`in e?e.t:f(Q))(`Shift+Arrow extends the block within this hunk.`)),1)]),I(`button`,{type:`button`,class:`review-btn`,onClick:t[4]||=e=>p.value=null},M((`t`in e?e.t:f(Q))(`Cancel`)),1),I(`button`,{type:`button`,class:`review-btn primary`,onClick:t[5]||=e=>T(f(p).scope,f(p).path,f(p).block)},M((`t`in e?e.t:f(Q))(`Comment`)),1)])):g(``,!0)])])}}}),{__name:`ChangesView`}),wg=[`id`,`data-pane`],Tg={key:0,class:`file-drop`,"aria-hidden":`true`},Eg={class:`file-drop-label`},Dg={class:`top bar agent-top`},Og=[`aria-label`,`title`],kg={class:`agent-head`},Ag={class:`agent-title`},jg={class:`agent-meta`},Mg={key:0,class:`agent-subtitle`},Ng={key:1,class:`agent-subtitle agent-command`},Pg={key:2,class:`agent-subtitle`},Fg=[`title`],Ig={class:`machine-inline-name`},Lg={key:4,class:`where`},Rg={class:`agent-actions`},zg=[`aria-label`],Bg={class:`agent-body`},Vg={class:`agent-main hw-backdrop-host`},Hg={key:1,class:`term-banner machine-banner`},Ug={key:0},Wg={key:2,class:`term-banner closed-banner`},Gg={key:5,class:`chat-empty offline-terminal`},Kg={key:7,class:`chat`},qg={key:8,class:`terminal-transcript-note`},Jg=null,Yg=Object.assign(T({__name:`AgentView`,props:{paneId:{},cell:{type:Boolean},active:{type:Boolean},grip:{type:Boolean},embedded:{type:Boolean},selectedMode:{}},emits:[`activate`,`update:selectedMode`],setup(e,{emit:t}){let r=e,i=t,o=Rt(),s=Bt(),c=n(()=>!r.cell||!!r.active),d=Symbol(`vue agent`);B(c,e=>{e&&(Li.value=r.paneId,Jg=d)},{immediate:!0}),l(()=>{Jg===d&&(Li.value=null)});let p=n(()=>wr.value.panes.find(e=>e.id===r.paneId)),y=n(()=>wr.value.workspaces.find(e=>e.id===p.value?.workspace)),b=n(()=>!!(r.cell||J.value&&J.value.panes.length>1)),x=n(()=>p.value?b.value?Ei(p.value):mn(p.value,y.value):`—`),S=n(()=>{let e=p.value?Y(p.value,y.value):``;return e&&e!==x.value?e:``}),C=n(()=>p.value?.command&&p.value.command!==x.value&&p.value.command!==S.value?p.value.command:``),T=n(()=>p.value&&wr.value.tabs?.filter(e=>e.workspace===p.value?.workspace).length>1?p.value.tabLabel:``),D=n({get:()=>Dr(r.paneId),set:e=>yi(r.paneId,e)}),O=n(()=>{let e=p.value;return e?r.embedded&&r.selectedMode?r.selectedMode:r.cell?Gr({chat:Ir(e),viewMode:D.value,active:r.active}):Ir(e)?D.value:`term`:null}),k=u(null),A=uf(r.paneId,{setBanner:e=>{k.value=e},hasBanner:()=>!!k.value,fill:()=>!!r.cell,input:()=>c.value}),F=h(null),L=h(0),R=h(null),z=h(typeof o.query.q==`string`&&typeof o.query.hit==`string`),V=h(!!p.value),U=h(!1),ee=setTimeout(()=>{U.value=!0},4e3);l(()=>clearTimeout(ee));let te={text:Q(`This pane has been closed.`),btn:Q(`Back`),fn:()=>Vt(`/`)},G=n(()=>!p.value&&wr.value.ok&&(V.value||U.value)&&!ut(r.paneId));B(p,e=>{e&&(V.value=!0,k.value===te&&(k.value=null,O.value===`term`&&!A.isConnected()&&P(()=>A.connect(!1))))}),B(G,e=>{e&&(k.value=te)},{immediate:!0}),B(O,(e,t)=>{e===`chat`&&t===`term`&&(k.value=G.value?k.value:null)},{immediate:!0});function ne(e){r.embedded&&i(`update:selectedMode`,e),r.cell&&i(`activate`),D.value=e,Mr.value&&e===`term`&&P(()=>A.focus()),X()}function K(e){ne(ai(O.value,e))}function re(){z.value?z.value=!1:(z.value=!0,O.value!==`chat`&&(D.value=`chat`))}st(()=>r.paneId,()=>c.value,{searchChat(){return!p.value||!Ir(p.value)||O.value!==`chat`?!1:(z.value?F.value?.focusSearch():z.value=!0,!0)},toggleTerm(){if(!p.value||!Ir(p.value)||!O.value)return!1;let e=O.value!==`chat`;return ne(e?`chat`:`term`),e&&P(()=>R.value?.focus()),!0},stop:()=>O.value===`chat`&&!!R.value?.stop()});let q=Hn(r.paneId),ae=vt(),oe=u(xn(r.paneId)),le=n(()=>wr.value.ok?wr.value.panes.map(e=>e.id).join(` `):``);B([()=>p.value&&qn(p.value,ae.value).join(` `),le],([e,t])=>{if(!e||!t)return;let n=e.split(` `);oe.value=un(oe.value,n),sn(r.paneId,n),_n(r.paneId,n,new Set(t.split(` `)))&&$(Z(`Draft from the closed pane restored`,`Brouillon du pane fermé récupéré`))},{immediate:!0});let ue=n(()=>G.value?Gn(r.paneId,oe.value,wr.value.panes,ae.value):null);B(ue,e=>{e&&(yn(r.paneId,e.id),!(r.cell||r.embedded)&&($(Z(`The agent restarted in a new pane: opened it`,`L’agent a redémarré dans un nouveau pane : il est ouvert`)),s.replace(Dt(e.id))))},{immediate:!0});let fe;B(()=>G.value&&!ue.value,e=>{if(clearInterval(fe),fe=void 0,!e)return;ct();let t=20;fe=Tr(()=>{--t<=0&&(clearInterval(fe),fe=void 0),Hr.value&&ct()},3e3)},{immediate:!0}),l(()=>clearInterval(fe));let me=n(()=>On(q));async function he(){try{await navigator.clipboard.writeText(Pn(q)),$(Z(`Draft copied`,`Brouillon copié`))}catch{$(Q(`Copy failed`),!0)}}let ge=n(()=>ln(r.paneId));function _e(e){e&&In(r.paneId,e),F.value?.scrollToEnd(!0),F.value?.reload()}B(p,e=>Mn(r.paneId,e?.queued||[]));let ye=n(()=>p.value&&p.value.status===`blocked`&&p.value.prompt&&p.value.prompt.options?p.value.prompt:null),be=n(()=>Ni(p.value)),xe=n(()=>p.value&&p.value.menu&&p.value.status!==`working`&&!ye.value&&!be.value?p.value.menu:null);B(()=>JSON.stringify([ye.value,be.value,xe.value]),()=>P(()=>F.value?.scrollToEnd(!1)));let Se=n(()=>{let e=p.value;return e?hr(e.cwd):``}),Ce=n(()=>cr.value&&p.value?Zn(p.value.machine):void 0),we=n(()=>!!(Ce.value&&Ce.value.status!==`online`));function Ee(e){q.text=q.text?`${q.text}\n\n${e}`:e,De.value=!1,ne(`chat`),P(()=>R.value?.focusEnd())}let De=h(!1),Oe=h(!1),ke=h(null),Ae=n(()=>O.value===`term`),je=Kt(r.paneId),Me=h(je.resume(p.value?.interaction||`unknown`)),Ne=n(()=>O.value===`chat`&&Fr.value&&!mr.value&&!we.value&&!qr(p.value)),Pe=n(()=>p.value?.interaction===`terminal`),Le;function Re(){clearTimeout(Le),Le=void 0;let e=Date.now();Me.value=je.update(p.value?.interaction||`unknown`,e);let t=je.deadline();t!==null&&Hr.value&&(Le=setTimeout(Re,Math.max(0,t-e))),(Pe.value||Me.value||ye.value||xe.value||be.value)&&Xe.open&&Xe.pane===r.paneId&&at(!1)}B([()=>p.value?.interaction,ye,xe,be,()=>Xe.open,()=>Xe.pane,Hr],Re,{immediate:!0});let ze=je.subscribe(Re);l(()=>{clearTimeout(Le),ze()});function Be(){je.dismiss(),Me.value=!1}function Ve(){r.cell&&i(`activate`),je.reopen(),Me.value=!0}let We=n(()=>Me.value&&Ne.value&&c.value&&!kr.value),Ke=n(()=>Yr({desk:Mr.value,live:c.value,mode:O.value,cell:!!r.cell})&&!(xe.value&&O.value!==`term`)&&!(O.value===`chat`&&Me.value)),Ze=n(()=>Yn({desk:Mr.value,live:c.value,mode:O.value,available:!(!p.value||!Fr.value||mr.value||we.value||qr(p.value))}));function Qe(e){let t=e.target,n=[...t.files||[]];t.value=``,et(n)}async function et(e){if(Ze.value&&p.value)for(let t of e)try{let e=t.name.includes(`.`)&&t.name.split(`.`).pop()||``,n=await fetch(`/api/file?pane=${encodeURIComponent(r.paneId)}&ext=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:t}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(Q(i.error||`HTTP ${n.status}`));_e(await Ue(p.value,r.paneId,i.path)),X()}catch(e){$(`${Q(`File upload failed`)} : ${e.message}`,!0)}}let tt=n(()=>Ze.value?`term`:Ke.value&&!mr.value?`chat`:null),nt=h(0);function rt(e){Ln(e.dataTransfer)&&tt.value&&(e.preventDefault(),e.type===`dragover`&&e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),nt.value=dn(nt.value,e.type))}function it(e){if(nt.value=0,!Ln(e.dataTransfer)||!tt.value)return;e.preventDefault();let t=[...e.dataTransfer?.files||[]];if(t.length){if(tt.value===`term`)return et(t);R.value?.addFiles(t).then(e=>{e&&(R.value?.focus(),X())})}}let ot=n(()=>p.value?.agent===`claude`?Q(`Images, PDFs, text and code files`):Q(`Images, text and code files`));He();let dt=n(()=>{let e=p.value,t=e?[bt(e)]:[];if(Ze.value&&t.push({label:Q(`Attach a file…`),icon:`i-lucide-paperclip`,run:()=>ke.value?.click()}),e&&t.push({label:Q(`View changes`),icon:`i-lucide-file-diff`,run:()=>{De.value=!0}}),e&&t.push({label:Q(`Browse files`),icon:`i-lucide-folder-tree`,run:()=>{Oe.value=!0}}),e&&_i(e)&&t.push({label:Q(`Open in editor`),icon:`i-lucide-external-link`,kbds:c.value?Fe(`open-editor`):void 0,run:()=>Kr(e)}),e&&t.push({label:Q(`Rename pane`),icon:`i-lucide-pencil`,run:()=>{se.value=e.id}}),e&&t.push(...Lt(e)),e&&t.push(ve(e)),e&&Vn(e.machine).length&&t.push({label:Q(`Plugin actions`),icon:`i-lucide-puzzle`,run:()=>Wn({pane:e})}),t.push({label:Q(`Take control of this terminal`),icon:`i-lucide-arrow-left-right`,run:()=>{k.value=null,D.value=`term`,P(()=>A.connect(!0))}}),e&&de(e)&&!e.restart&&t.push({label:Q(`Restart agent`),icon:`i-lucide-rotate-cw`,run:()=>ie(e)}),t.push({label:Q(`Reconnect`),icon:`i-lucide-refresh-cw`,run:()=>{k.value=null,D.value=`term`,P(()=>{A.reset(),A.connect(!1)})}}),r.cell||t.push(...Mt()),e){t.push({kind:`separator`}),t.push({label:e.agent?Z(`Close this pane (stops ${lr(e.agent)})`,`Fermer ce pane (arrête ${lr(e.agent)})`):Q(`Close this terminal`),icon:`i-lucide-trash-2`,danger:!0,kbds:c.value?Fe(`close-pane`):void 0,run:()=>_t(e)});let n=wr.value.workspaces.find(t=>t.id===e.workspace);n&&n.worktree&&t.push({label:Q(`Delete this worktree`),icon:`i-lucide-git-branch`,danger:!0,run:()=>ft(e.workspace)})}return t});async function ft(e){await Yi();let t=(Wi.value||[]).find(t=>t.workspace===e);if(!t)return $(Q(`Worktree not found`),!0);await Ki(t)&&Vt(`/`)}let mt=n(()=>ce(dt.value));function ht(){Te(dt.value)}B(()=>p.value&&(p.value.machine||``),e=>{e!==void 0&&Kn(e)},{immediate:!0});let gt=n(()=>[{label:Q(`Conversation`),value:`chat`,icon:`i-lucide-message-square`},{label:Q(`Terminal`),value:`term`,icon:`i-lucide-square-terminal`}]),yt={list:`hw-tabs`,trigger:`hw-tab`,indicator:`hw-tab-ind`,leadingIcon:`hw-tab-icon`,label:`hw-tab-label`},xt=n({get:()=>O.value===`term`?`term`:`chat`,set:e=>ne(e===`term`?`term`:`chat`)}),St=n(()=>O.value===`term`&&(!r.cell||!!(si.value&&r.active))&&Fr.value&&!mr.value&&!we.value),Ct=n(()=>ki({desk:Mr.value,cell:!!r.cell,chat:Ir(p.value),live:c.value})),Tt=n(()=>!r.cell&&p.value&&Or(Ge(p.value.workspace).length).headerAdd);B(ir,e=>A.setFontSize(e)),B(Hr,e=>{A.setVisible(e),e&&O.value===`term`&&!A.isConnected()&&!k.value&&A.connect(!1)});let J=n(()=>p.value?Ye(p.value.tab):null),Ot=n(()=>!!(J.value&&J.value.panes.length>1));function kt(){J.value&&(Mr.value?Vt({path:qe(J.value.tab.id),query:{pane:r.paneId}}):Ie(J.value.tab.id))}function At(){let e=history.state?.back;e===`/board`||J.value&&e===qe(J.value.tab.id)?s.back():Vt(`/`)}let jt=pt.value;pt.value=0;let Nt=h(0),Pt=h(!1),Ft=0,It=0,zt=0,Ht=`off`,Ut=e=>J.value?Ur(J.value.layout,r.paneId,e):null;function Gt(e,t){for(let n=e;n&&n!==t;n=n.parentElement)if(n.scrollWidth>n.clientWidth+1&&/(auto|scroll)/.test(getComputedStyle(n).overflowX))return!0;return!1}function Jt(e){if(Ht=`off`,r.cell||Mr.value||!Ot.value||e.touches.length!==1)return;let t=e.target?.closest?.(`.swipe-area, .choices, #termWrap`);t&&!Gt(e.target,t)&&(Ft=e.touches[0].clientX,It=e.touches[0].clientY,zt=Date.now(),Ht=null)}function Yt(e){if(Ht===`off`||Ht===`y`)return;let t=e.touches[0].clientX-Ft,n=e.touches[0].clientY-It;Ht===null&&(Ht=pn(t,n)),Ht===`x`&&(e.preventDefault(),Pt.value=!0,Nt.value=gn(t,!!Ut(t<0?1:-1)))}function Xt(e){if(Ht===`x`){let t=(e.changedTouches[0]?.clientX??Ft)-Ft,n=Nn(t,Date.now()-zt,window.innerWidth),r=n?Ut(n):null;r&&(X(),pt.value=n,s.replace(Dt(r)))}Ht=`off`,Pt.value=!1,Nt.value=0}let Zt=n(()=>Ot.value&&!Mr.value?{transform:Nt.value?`translateX(${Nt.value}px)`:void 0,transition:Pt.value?`none`:`transform .18s ease`}:{});w(()=>{Mr.value&&c.value&&setTimeout(()=>(O.value===`term`?A:R.value)?.focus(),50)}),B(()=>r.active,(e,t)=>{e&&!t&&r.cell&&setTimeout(()=>{document.activeElement?.closest(`.cell-view.active`)||(O.value===`term`?A:R.value)?.focus()},50)});function Qt(e){let t=e.target;r.cell&&Mr.value&&t?.closest?.(`.agent-top`)&&!t.closest(`button, a, input, [role="tab"], .cell-grip`)&&(document.activeElement&&document.activeElement!==document.body||(O.value===`term`?A:R.value)?.focus())}let $t=n(()=>kn.value?{height:`${cn.value}px`,top:`${jn.value}px`}:{});return(t,n)=>{let r=Je,o=_a,s=Et,l=on,u=tn,d=xa,h=lt,y=wn,b=qt,w=Ea,D=Da,P=Zu,B=rd,V=mf,U=Wf,ee=dp,G=sd,q=Km,ie=Cg,ae=Wt,oe=nc;return _(),v(`section`,{id:e.cell?void 0:`agent`,class:j(e.cell?[`cell-view`,{active:e.active,gripped:e.grip}]:`view`),style:N(e.cell?void 0:f($t)),"data-pane":e.cell?e.paneId:void 0,onTouchstart:Jt,onTouchmove:Yt,onTouchend:Xt,onTouchcancel:Xt,onPointerdownCapture:n[16]||=t=>e.cell&&i(`activate`),onFocusin:n[17]||=t=>e.cell&&i(`activate`),onClick:Qt,onDragenter:rt,onDragover:rt,onDragleave:rt,onDrop:it},[f(nt)&&f(tt)?(_(),v(`div`,Tg,[E(r,{name:f(tt)===`term`?`i-lucide-paperclip`:`i-lucide-file-plus`,class:`file-drop-icon`},null,8,[`name`]),I(`span`,Eg,M((`t`in t?t.t:f(Q))(`Drop to attach`)),1),I(`small`,null,M(f(tt)===`term`?(`t`in t?t.t:f(Q))(`The file path is sent to the terminal`):f(ot)),1)])):g(``,!0),!e.cell&&f(p)?(_(),m(o,{key:1,workspace:f(p).workspace,current:f(p).tab},null,8,[`workspace`,`current`])):g(``,!0),e.embedded?g(``,!0):(_(),m(w,{key:2,items:()=>f(dt),disabled:!f(p)},{default:H(()=>[I(`header`,Dg,[e.cell&&e.grip?(_(),v(`span`,{key:0,class:`cell-grip`,role:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Drag to move the pane`),title:(`t`in t?t.t:f(Q))(`Drag to move the pane`)},[E(r,{name:`i-lucide-grip-vertical`})],8,Og)):g(``,!0),e.cell?g(``,!0):(_(),m(s,{key:1,id:`btnBack`,icon:`i-lucide-chevron-left`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn back`,"aria-label":(`t`in t?t.t:f(Q))(`Back`),onClick:At},null,8,[`aria-label`])),I(`div`,kg,[I(`div`,Ag,[a(M(f(x))+` `,1),f(p)&&(`paneNotificationsMuted`in t?t.paneNotificationsMuted:f(wt))(f(p))?(_(),m(r,{key:0,name:`i-lucide-bell-off`,class:`notification-muted`,title:(`t`in t?t.t:f(Q))(`Muted`)},null,8,[`title`])):g(``,!0)]),I(`div`,jg,[E(l,{pane:f(p),kind:``},null,8,[`pane`]),f(S)?(_(),v(`span`,Mg,M(f(S)),1)):g(``,!0),f(C)?(_(),v(`span`,Ng,M(f(C)),1)):g(``,!0),f(T)?(_(),v(`span`,Pg,M(f(T)),1)):g(``,!0),f(Ce)?(_(),v(`span`,{key:3,class:j([`agent-machine`,f(Ce).status]),title:f(Ce).target?`ssh ${f(Ce).target}`:void 0},[E(r,{name:f(Ce).local?`i-lucide-server`:`i-lucide-laptop`},null,8,[`name`]),I(`span`,Ig,M((`machineName`in t?t.machineName:f(Rr))(f(Ce).key)),1),f(Ce).local?(_(),m(u,{key:0})):g(``,!0)],10,Fg)):g(``,!0),f(Se)?(_(),v(`span`,Lg,M(f(Se)),1)):g(``,!0)])]),f(Ct).selector===`cell`?(_(),m(d,{key:2,modelValue:f(xt),"onUpdate:modelValue":n[0]||=e=>W(xt)?xt.value=e:null,items:f(gt),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:yt},null,8,[`modelValue`,`items`])):g(``,!0),I(`div`,Rg,[f(Ct).selector===`header`?(_(),m(d,{key:0,modelValue:f(xt),"onUpdate:modelValue":n[1]||=e=>W(xt)?xt.value=e:null,items:f(gt),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:yt},null,8,[`modelValue`,`items`])):g(``,!0),f(Tt)&&f(p)?(_(),m(s,{key:1,icon:`i-lucide-plus`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Q))(`New tab`),title:(`t`in t?t.t:f(Q))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(mr),onClick:n[2]||=e=>(`newTab`in t?t.newTab:f(pe))(f(p).workspace)},null,8,[`aria-label`,`title`,`disabled`])):g(``,!0),e.cell?(_(),m(h,{key:2,text:(`t`in t?t.t:f(Q))(`Open alone`)},{default:H(()=>[E(s,{icon:`i-lucide-maximize-2`,color:`neutral`,variant:`ghost`,size:`md`,class:`icon-btn cell-extra`,"aria-label":(`t`in t?t.t:f(Q))(`Open alone`),to:(`panePath`in t?t.panePath:f(Dt))(e.paneId)},null,8,[`aria-label`,`to`])]),_:1},8,[`text`])):f(Ot)&&f(J)?(_(),m(h,{key:3,text:(`t`in t?t.t:f(Q))(`Side by side`),disabled:!(`desk`in t?t.desk:f(Mr))},{default:H(()=>[I(`button`,{type:`button`,class:`map-btn`,"aria-label":(`desk`in t?t.desk:f(Mr))?(`t`in t?t.t:f(Q))(`Side by side`):(`t`in t?t.t:f(Q))(`Tab overview`),onClick:kt},[E(y,{layout:f(J).layout,panes:f(J).panes,current:e.paneId},null,8,[`layout`,`panes`,`current`])],8,zg)]),_:1},8,[`text`,`disabled`])):g(``,!0),f(Ct).term?(_(),m(s,{key:4,icon:`i-lucide-square-terminal`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn mode-btn`,{on:f(O)===`term`}]),"aria-label":(`t`in t?t.t:f(Q))(`Terminal`),"aria-pressed":f(O)===`term`,onClick:n[3]||=e=>K(`term`)},null,8,[`class`,`aria-label`,`aria-pressed`])):g(``,!0),(`hasChat`in t?t.hasChat:f(Ir))(f(p))&&(f(c)||e.cell)?(_(),m(h,{key:5,text:(`t`in t?t.t:f(Q))(`Search`),kbds:f(O)===`chat`?(`shortcutKbds`in t?t.shortcutKbds:f(Fe))(`search-chat`):void 0,disabled:!(`desk`in t?t.desk:f(Mr))},{default:H(()=>[E(s,{icon:`i-lucide-search`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn cell-extra`,{on:f(z)}]),"aria-label":(`t`in t?t.t:f(Q))(`Search`),onClick:re},null,8,[`class`,`aria-label`])]),_:1},8,[`text`,`kbds`,`disabled`])):g(``,!0),(`sheetMenus`in t?t.sheetMenus:f(ii))?(_(),m(s,{key:7,icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Q))(`Options`),onClick:ht},null,8,[`aria-label`])):(_(),m(b,{key:6,items:f(mt),content:{align:`end`,sideOffset:6},ui:{content:`hw-dropdown`}},{default:H(()=>[E(s,{icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Q))(`Options`)},null,8,[`aria-label`])]),_:1},8,[`items`]))])])]),_:1},8,[`items`,`disabled`])),I(`div`,Bg,[I(`div`,Vg,[(`desk`in t?t.desk:f(Mr))&&!e.cell&&(`backdrop`in t?t.backdrop:f($e))===`wherdr`&&f(O)===`chat`?(_(),m(D,{key:0})):g(``,!0),f(we)&&f(Ce)?(_(),v(`div`,Hg,[E(r,{name:`i-lucide-unplug`,class:`term-banner-icon`}),I(`span`,null,[a(M(f(Ce).status===`connecting`?(`tl`in t?t.tl:f(Z))(`${(`machineName`in t?t.machineName:f(Rr))(f(Ce).key)} unreachable — reconnecting…`,`${(`machineName`in t?t.machineName:f(Rr))(f(Ce).key)} injoignable — reconnexion…`):(`tl`in t?t.tl:f(Z))(`${(`machineName`in t?t.machineName:f(Rr))(f(Ce).key)} offline`,`${(`machineName`in t?t.machineName:f(Rr))(f(Ce).key)} hors ligne`)),1),f(Ce).error?(_(),v(`small`,Ug,M((`t`in t?t.t:f(Q))(f(Ce).error)),1)):g(``,!0)])])):g(``,!0),f(k)===te&&f(ue)?(_(),v(`div`,Wg,[E(r,{name:`i-lucide-refresh-cw`,class:`term-banner-icon`}),I(`span`,null,M((`tl`in t?t.tl:f(Z))(`This agent continues in a new pane.`,`Cet agent continue dans un nouveau pane.`)),1),E(s,{size:`xs`,color:`warning`,variant:`outline`,to:(`panePath`in t?t.panePath:f(Dt))(f(ue).id)},{default:H(()=>[a(M((`tl`in t?t.tl:f(Z))(`Open`,`Ouvrir`)),1)]),_:1},8,[`to`])])):f(k)?(_(),v(`div`,{key:3,class:j([`term-banner`,{"closed-banner":f(k)===te}])},[E(r,{name:`i-lucide-triangle-alert`,class:`term-banner-icon`}),I(`span`,null,M(f(k)===te&&f(me)?(`tl`in t?t.tl:f(Z))(`This pane has been closed. Your draft is kept below.`,`Ce pane a été fermé. Ton brouillon est gardé ci-dessous.`):f(k).text),1),f(k)===te&&f(me)?(_(),m(s,{key:0,size:`xs`,color:`warning`,variant:`outline`,icon:`i-lucide-copy`,onClick:he},{default:H(()=>[a(M((`tl`in t?t.tl:f(Z))(`Copy draft`,`Copier le brouillon`)),1)]),_:1})):g(``,!0),E(s,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[4]||=e=>f(k).fn()},{default:H(()=>[a(M(f(k).btn),1)]),_:1})],2)):g(``,!0),f(p)&&f(O)===`chat`?(_(),v(`div`,{key:4,class:j([`swipe-area`,f(jt)?f(jt)>0?`enter-next`:`enter-prev`:void 0]),style:N(f(Zt))},[E(P,{ref_key:`chatRef`,ref:F,search:f(z),"onUpdate:search":n[5]||=e=>W(z)?z.value=e:null,pane:f(p),"local-queued":f(ge),onGotoTerm:n[6]||=e=>ne(`term`),onRestored:n[7]||=e=>f(R)?.focus(),onQuote:n[8]||=e=>f(R)?.focusEnd(),onAnswered:n[9]||=e=>f(R)?.focusAnswer(e),onUnanswered:n[10]||=e=>L.value=e,onSent:_e},null,8,[`search`,`pane`,`local-queued`])],6)):f(O)===`term`&&(!(`eventsOpen`in t?t.eventsOpen:f(Fr))||(`offlineView`in t?t.offlineView:f(mr))||f(we))?(_(),v(`div`,Gg,[E(r,{name:`i-lucide-wifi-off`,class:`chat-empty-icon`}),I(`p`,null,M((`t`in t?t.t:f(Q))(`Terminal unavailable offline`)),1)])):f(O)===`term`?(_(),m(B,{key:6,ctl:f(A),class:j(f(jt)?f(jt)>0?`enter-next`:`enter-prev`:void 0),style:N(f(Zt))},null,8,[`ctl`,`class`,`style`])):(_(),v(`div`,Kg)),f(p)?.agent&&!(`hasChat`in t?t.hasChat:f(Ir))(f(p))&&f(O)===`term`&&!e.cell?(_(),v(`p`,qg,M((`tl`in t?t.tl:f(Z))(`Conversation unavailable for this agent · follow it in the terminal`,`Conversation non disponible pour cet agent · suivi dans le terminal`)),1)):g(``,!0),f(We)?(_(),m(V,{key:9,"pane-id":e.paneId,active:f(c),title:f(x),onClose:Be},null,8,[`pane-id`,`active`,`title`])):(f(Pe)||f(Me))&&f(Ne)?(_(),v(`button`,{key:10,type:`button`,class:`interactive-terminal-reopen`,onClick:Ve},[E(r,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Z))(`Open interactive terminal`,`Ouvrir le terminal interactif`)),1)])):g(``,!0),(f(ye)||f(be))&&!f(Me)&&!f(Pe)&&!f(Ae)&&(`eventsOpen`in t?t.eventsOpen:f(Fr))&&!(`offlineView`in t?t.offlineView:f(mr))&&!f(we)?(_(),m(U,{key:11,"pane-id":e.paneId,prompt:f(ye),screen:f(be),keys:f(c)},null,8,[`pane-id`,`prompt`,`screen`,`keys`])):f(xe)&&!f(Me)&&!f(Pe)&&!f(Ae)&&(`eventsOpen`in t?t.eventsOpen:f(Fr))&&!(`offlineView`in t?t.offlineView:f(mr))&&!f(we)?(_(),m(ee,{key:12,"pane-id":e.paneId,menu:f(xe),keys:f(c),onTerminal:n[11]||=e=>ne(`term`)},null,8,[`pane-id`,`menu`,`keys`])):g(``,!0),f(St)?(_(),m(G,{key:13,ctl:f(A)},null,8,[`ctl`])):g(``,!0),f(Ke)?(_(),m(q,{key:14,ref_key:`composer`,ref:R,pane:f(p),"pane-id":e.paneId,"send-keys":f(A).sendKeys,conversation:f(O)===`chat`,"term-shown":f(Ae),"esc-stops":!f(z),"take-back":f(O)===`chat`,unanswered:f(O)===`chat`?f(L):0,onSent:_e,onShowTerminal:n[12]||=e=>ne(`term`),onShowUnanswered:n[13]||=e=>f(F)?.gotoUnanswered()},null,8,[`pane`,`pane-id`,`send-keys`,`conversation`,`term-shown`,`esc-stops`,`take-back`,`unanswered`])):g(``,!0)])]),E(ae,{open:f(De),"onUpdate:open":n[14]||=e=>W(De)?De.value=e:null,title:(`t`in t?t.t:f(Q))(`Changes`),wide:``,full:``,screen:``},{default:H(()=>[f(De)&&f(p)?(_(),m(ie,{key:0,"pane-id":e.paneId,onReview:Ee},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),E(ae,{open:f(Oe),"onUpdate:open":n[15]||=e=>W(Oe)?Oe.value=e:null,title:(`t`in t?t.t:f(Q))(`Files`),wide:``,full:``,screen:``},{default:H(()=>[f(Oe)&&f(p)?(_(),m(oe,{key:0,"pane-id":e.paneId},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),I(`input`,{ref_key:`attachInput`,ref:ke,type:`file`,multiple:``,hidden:``,onChange:Qe},null,544)],46,wg)}}}),{__name:`AgentView`});export{Ea as a,ka as i,Gp as n,Ta as o,rc as r,_a as s,Yg as t};
97
+ `)}`:``}var Nh=[`aria-label`,`aria-describedby`],Ph=[`id`],Fh=[`data-row`,`onClick`],Ih=[`tabindex`,`aria-label`,`aria-pressed`,`onPointerdown`,`onClick`,`onKeydown`,`onFocus`],Lh={class:`review-number`},Rh={class:`review-source`},zh=Object.assign(T({__name:`ReviewDiff`,props:{file:{},scope:{},comments:{},selection:{}},emits:[`add`,`select`,`act`],setup(e,{emit:t}){let r=e,i=t,a=h(null),o=p(),s=n(()=>uh(r.file.lines)),c=n(()=>({line:Q(`Line`),lines:Q(`Lines`),oldLine:Q(`old line`),oldLines:Q(`old lines`)})),u=h(null),d=n(()=>r.comments.flatMap(e=>{let t=e.scope===r.scope&&e.path===r.file.path?Sh(e,s.value):null;return t?[{c:e,at:t}]:[]})),b=n(()=>{let e=new Map,t=new Set,n=new Set;for(let{c:r,at:i}of d.value){e.set(i[1],[...e.get(i[1])??[],r]);let a=r.draft!==void 0||r.id===u.value?t:n;for(let e=i[0];e<=i[1];e++)a.add(e)}return{notes:e,open:t,noted:n}});function x(e){let t=d.value.find(t=>t.c.id===e.id)?.at;return jh(t?mh(s.value.slice(t[0],t[1]+1)):Oh(e),c.value)}let S=n(()=>r.selection&&r.selection.scope===r.scope&&r.selection.path===r.file.path?r.selection:null),C=n(()=>S.value?[Math.min(S.value.anchor,S.value.head),Math.max(S.value.anchor,S.value.head)]:null),w=n(()=>S.value?dh(s.value,S.value.anchor):null);function T(e,t,n){let a=fh(s.value,e,t);return i(`select`,{scope:r.scope,path:r.file.path,anchor:e,head:a[0]===e?a[1]:a[0],via:n,block:s.value.slice(a[0],a[1]+1)}),a}function E(e,t,n){let a=s.value.slice(e,t+1);a.some(e=>e.number!==null)&&i(`add`,r.scope,r.file.path,a,n),i(`select`,null)}let D=``;function O(e){D=e.pointerType}let A=null;function N(e){let t=a.value?.getBoundingClientRect(),n=t&&document.elementFromPoint(t.left+4,e)?.closest(`[data-row]`);return n&&a.value.contains(n)?Number(n.dataset.row):null}function F(e){let t=N(e.clientY);A&&t!==null&&s.value[t]?.number!=null&&(A.at=T(A.anchor,t,`drag`))}function L(){A=null,window.removeEventListener(`pointermove`,F),window.removeEventListener(`pointerup`,R),window.removeEventListener(`pointercancel`,z),window.removeEventListener(`keydown`,V,!0)}function R(){let e=A;L(),e&&E(e.at[0],e.at[1],e.extend)}function z(){L(),i(`select`,null)}function V(e){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),z())}function H(e,t){if(e.pointerType!==`mouse`||e.button!==0)return;e.preventDefault(),e.currentTarget.focus();let[n,r]=dh(s.value,t),i=e.shiftKey?d.value.findLast(e=>e.c.draft!==void 0&&e.at[0]>=n&&e.at[1]<=r):void 0,a=i?t>=i.at[0]?i.at[0]:i.at[1]:t;A={anchor:a,at:T(a,t,`drag`),extend:i?.c.id},window.addEventListener(`pointermove`,F),window.addEventListener(`pointerup`,R),window.addEventListener(`pointercancel`,z),window.addEventListener(`keydown`,V,!0)}l(L),B(()=>r.file,()=>{A&&z()});function U(e){let t=S.value,n=w.value;!t||!n||t.via===`drag`||e<n[0]||e>n[1]?T(e,e,`touch`):e===t.anchor&&t.head===t.anchor?i(`select`,null):T(t.anchor,e,`touch`)}function ee(e,t){if(!e.detail){let e=S.value?.via===`keys`?C.value:null;return E(e?e[0]:t,e?e[1]:t)}D!==`mouse`&&U(t)}function W(e,t){D===`mouse`||S.value?.via!==`touch`||e.number===null||window.getSelection()?.toString()||U(t)}let te=h(-1),G=n(()=>te.value>=0&&s.value[te.value]?.number!=null?te.value:s.value.findIndex(e=>e.number!==null));function ne(e){a.value?.querySelector(`[data-row="${e}"] .review-gutter`)?.focus()}function K(e,t,[n,r]){for(let i=e+t;i>=n&&i<=r;i+=t)if(s.value[i].number!==null)return i;return e}function re(e,t){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let n=e.key===`ArrowDown`?1:-1;if(e.shiftKey){let e=S.value?.via===`keys`?S.value.anchor:t,r=K(t,n,dh(s.value,e));T(e,r,`keys`),ne(r)}else S.value&&i(`select`,null),ne(K(t,n,[0,s.value.length-1]))}else e.key===`Escape`&&S.value&&(e.preventDefault(),e.stopPropagation(),i(`select`,null))}function ie(e,t,n){let r=d.value.find(e=>e.c.id===t)?.at[1];i(`act`,e,t,n),e!==`draft`&&e!==`edit`&&(u.value=null,r!==void 0&&a.value?.contains(document.activeElement)&&P(()=>ne(r)))}function ae(e){return`${Q(`Comment on line`)} ${e.number}${e.side===`old`?` (${Q(`old line`)})`:``}`}return(t,n)=>{let r=lh;return _(),v(`div`,{ref_key:`root`,ref:a,class:j([`change-code`,{picking:f(S),dragging:f(S)?.via===`drag`}]),role:`region`,"aria-label":e.file.path,"aria-describedby":f(o)},[I(`p`,{id:f(o),class:`sr-only`},M((`t`in t?t.t:f(Q))(`Arrow keys move between lines. Shift+Arrow selects a block of lines. Enter writes a comment.`)),9,Ph),(_(!0),v(k,null,y(f(s),(e,t)=>(_(),v(k,{key:t},[I(`div`,{class:j([`change-line review-line`,[e.kind,{picked:f(C)&&t>=f(C)[0]&&t<=f(C)[1],open:f(b).open.has(t),noted:f(b).noted.has(t),out:f(w)&&(t<f(w)[0]-1||t>f(w)[1])}]]),"data-row":t,onPointerdown:O,onClick:n=>W(e,t)},[e.number===null?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`review-gutter`,tabindex:t===f(G)?0:-1,"aria-label":ae(e),"aria-pressed":f(C)?t>=f(C)[0]&&t<=f(C)[1]:void 0,onPointerdown:e=>H(e,t),onClick:q(e=>ee(e,t),[`stop`]),onKeydown:e=>re(e,t),onFocus:e=>te.value=t},[n[1]||=I(`span`,{class:`review-plus`,"aria-hidden":`true`},`+`,-1),I(`span`,Lh,M(e.number),1)],40,Ih)),I(`span`,Rh,M(e.text),1)],42,Fh),(_(!0),v(k,null,y(f(b).notes.get(t),e=>(_(),m(r,{key:e.id,comment:e,label:x(e),onAct:ie,onHover:n[0]||=e=>u.value=e},null,8,[`comment`,`label`]))),128))],64))),128))],10,Nh)}}}),{__name:`ReviewDiff`}),Bh=e=>e===`old`||e===`new`,Vh=e=>Number.isInteger(e)&&e>0,Hh=e=>!!e&&Vh(e.number)&&Bh(e.side)&&typeof e.text==`string`,Uh=e=>e===void 0||Array.isArray(e)&&e.length===2&&e.every(Vh);function Wh(e){return e&&typeof e.id==`string`&&[`working`,`committed`].includes(e.scope)&&typeof e.path==`string`&&Hh(e)&&typeof e.body==`string`&&(e.end===void 0||Hh(e.end))&&(e.span===void 0||typeof e.span==`object`&&e.span!==null&&Uh(e.span.new)&&Uh(e.span.old)&&!!(e.span.new||e.span.old))&&(e.excerpt===void 0||Array.isArray(e.excerpt)&&e.excerpt.every(e=>typeof e==`string`))&&(e.draft===void 0||typeof e.draft==`string`)&&(e.hash===void 0||typeof e.hash==`string`)}function Gh(e){try{let t=JSON.parse(e||`[]`);return Array.isArray(t)?t.filter(e=>Wh(e)&&(e.body.trim()||e.draft?.trim())):[]}catch{return[]}}function Kh(e){let t=`review:${e}`,n=h([]);try{n.value=Gh(localStorage.getItem(t))}catch{}B(n,e=>{try{let n=e.length?JSON.stringify(e):null;if(n===localStorage.getItem(t))return;n?localStorage.setItem(t,n):localStorage.removeItem(t)}catch{}},{deep:!0,flush:`sync`});function r(e){if(e.key!==t&&e.key!==null)return;let r=new Map(n.value.filter(e=>e.draft!==void 0).map(e=>[e.id,e]));n.value=Gh(e.key===null?null:e.newValue).map(e=>r.get(e.id)??e)}return typeof window<`u`&&(window.addEventListener(`storage`,r),s(()=>window.removeEventListener(`storage`,r))),n}var qh={class:`changes-view`},Jh={class:`changes-inner`},Yh={class:`changes-toolbar`},Xh={key:0,class:`changes-location`},Zh={key:0,class:`review-hint`},Qh={class:`by-mouse`},$h={class:`by-touch`},eg={key:1,class:`review-toolbar`},tg={role:`status`},ng={key:2,class:`changes-notice error`,role:`alert`},rg={key:3,class:`changes-notice`},ig={key:4,class:`changes-notice`},ag={class:`changes-section`},og={key:0,class:`changes-notice`},sg={key:0,class:`changes-limit`},cg={class:`change-path`},lg={key:0,class:`change-binary`},ug={key:1,class:`change-totals`},dg={class:`change-status`},fg={key:0,class:`change-note`},pg={key:1,class:`change-note`},mg={class:`changes-section`},hg={class:`changes-toggle`},gg={class:`changes-location`},_g={key:0,class:`changes-limit`},vg={key:1,class:`changes-notice`},yg={class:`change-path`},bg={key:0,class:`change-binary`},xg={key:1,class:`change-totals`},Sg={key:0,class:`change-note`},Cg={key:1,class:`changes-notice`},wg={class:`sr-only`,role:`status`},Tg={key:6,class:`review-pick`},Eg=Object.assign(T({__name:`ChangesView`,props:{paneId:{}},emits:[`review`],setup(e,{emit:t}){let r=e,i=t,o=Kh(r.paneId),s=n(()=>O.value?Th(o.value,O.value,N.value):[]),c=n(()=>Object.fromEntries(s.value.map(e=>[e.id,wh(e,O.value,N.value)??void 0]))),u=n(()=>o.value.filter(Dh).length),d=n(()=>({line:Q(`Line`),lines:Q(`Lines`),oldLine:Q(`old line`),oldLines:Q(`old lines`)})),p=h(null),b=n(()=>p.value?jh(mh(p.value.block),d.value):``);function x(e){P(()=>document.getElementById(`review-${e}`)?.focus())}function S(e){o.value=o.value.filter(t=>t.id!==e)}function C(e,t,n){let r=o.value.find(e=>e.id===t);r&&(e===`draft`?r.draft=n??``:e===`edit`?(r.draft=r.body,x(t)):e===`save`&&Dh(r)?(r.body=Dh(r),delete r.draft):e===`cancel`&&r.body?delete r.draft:S(t))}function T(e,t,n,r){if(!n.some(e=>e.number!==null))return;let i=vh(n),a=o.value.find(n=>r?n.id===r:n.scope===e&&n.path===t&&bh(n,i));a&&r?Object.assign(a,i):a?a.draft??=a.body:(a={id:crypto.randomUUID(),scope:e,path:t,...i,body:``,draft:``},o.value.push(a)),p.value=null,x(a.id)}function D(){let e=Mh(O.value?Eh(o.value,O.value):o.value,{intro:Q(`Please review these points:`),oldLine:Q(`old line`),oldLines:Q(`old lines`),missing:Q(`no longer in diff`),changed:Q(`code changed since this comment`)},c.value);e&&(i(`review`,e),o.value=[])}let O=h(null),A=h(!1),j=h(``),N=h(o.value.some(e=>e.scope===`committed`)),F=0;async function R(){let e=++F;A.value=!0,j.value=``;try{let t=await _i(`/api/changes?pane=${encodeURIComponent(r.paneId)}&commits=${N.value?`1`:`0`}`);e===F&&(O.value=t)}catch(t){e===F&&(j.value=t.message)}finally{e===F&&(A.value=!1)}}w(R),B(N,R),B(O,()=>{p.value=null}),l(()=>{F++});function z(e){return e.status===`??`?Q(`Untracked`):e.status===`commit`?Q(`Commit`):e.status.includes(`R`)?Q(`Renamed`):e.status.includes(`D`)?Q(`Deleted`):e.status.includes(`A`)?Q(`Added`):Q(`Modified`)}function V(e,t){return e===null?`${t}—`:`${t}${e}`}return(e,t)=>{let n=Et,r=lh,i=zh;return _(),v(`div`,qh,[I(`div`,Jh,[I(`div`,Yh,[I(`div`,null,[f(O)?.git?(_(),v(`p`,Xh,M(f(O).branch||`HEAD`)+` · `+M(f(O).root),1)):g(``,!0)]),E(n,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(A),"aria-label":(`t`in e?e.t:f(Q))(`Refresh changes`),onClick:R},{default:H(()=>[a(M((`t`in e?e.t:f(Q))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])]),f(O)?.git&&!f(o).length?(_(),v(`p`,Zh,[I(`span`,Qh,M((`t`in e?e.t:f(Q))(`To comment, hover a line and click +. Drag from the + to comment a block of lines.`)),1),I(`span`,$h,M((`t`in e?e.t:f(Q))(`To comment, tap a line number, then another line for a block.`)),1)])):g(``,!0),f(o).length?(_(),v(`div`,eg,[I(`span`,tg,M(f(u))+` `+M((`t`in e?e.t:f(Q))(f(u)===1?`review comment`:`review comments`)),1),E(n,{color:`neutral`,variant:`outline`,onClick:t[0]||=e=>o.value=[]},{default:H(()=>[a(M((`t`in e?e.t:f(Q))(`Discard`)),1)]),_:1}),E(n,{disabled:!f(u),onClick:D},{default:H(()=>[a(M((`t`in e?e.t:f(Q))(`Send review`)),1)]),_:1},8,[`disabled`]),I(`p`,null,M((`t`in e?e.t:f(Q))(`Adds to your message draft. You send it yourself.`)),1)])):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),m(r,{key:e.id,comment:e,label:f(jh)(f(Oh)(e),f(d)),missing:``,changed:f(c)[e.id]===`changed`,onAct:C},null,8,[`comment`,`label`,`changed`]))),128)),f(j)?(_(),v(`p`,ng,M(f(j)),1)):g(``,!0),f(A)&&!f(O)?(_(),v(`p`,rg,[t[6]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in e?e.t:f(Q))(`Reading changes…`)),1)])):f(O)&&!f(O).git?(_(),v(`p`,ig,M((`t`in e?e.t:f(Q))(`This folder is not a Git repository.`)),1)):f(O)?.git?(_(),v(k,{key:5},[I(`section`,ag,[I(`h3`,null,[a(M((`t`in e?e.t:f(Q))(`Working tree`))+` `,1),I(`span`,null,M(f(O).working?.count||0),1)]),f(O).working?.count?(_(),v(k,{key:1},[f(O).working?.truncated?(_(),v(`p`,sg,M((`t`in e?e.t:f(Q))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(O).working?.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[I(`summary`,null,[I(`span`,cg,M(n.path),1),n.binary?(_(),v(`span`,lg,M((`t`in e?e.t:f(Q))(`Binary`)),1)):(_(),v(`span`,ug,[I(`b`,null,M(V(n.added,`+`)),1),I(`i`,null,M(V(n.deleted,`−`)),1)])),I(`span`,dg,M(z(n)),1)]),n.previousPath?(_(),v(`p`,fg,M((`t`in e?e.t:f(Q))(`From`))+` `+M(n.previousPath),1)):g(``,!0),n.summary?(_(),v(`p`,pg,M((`t`in e?e.t:f(Q))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:2,file:n,scope:`working`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[1]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):(_(),v(`p`,og,M((`t`in e?e.t:f(Q))(`No working tree changes.`)),1))]),I(`section`,mg,[I(`label`,hg,[L(I(`input`,{"onUpdate:modelValue":t[2]||=e=>W(N)?N.value=e:null,type:`checkbox`},null,512),[[K,f(N)]]),t[7]||=a(),I(`span`,null,M((`t`in e?e.t:f(Q))(`Also show unpushed commits`)),1)]),f(N)&&f(O).committed?(_(),v(k,{key:0},[I(`h3`,null,[a(M((`t`in e?e.t:f(Q))(`Commits`))+` `,1),I(`span`,null,M(f(O).commits??0),1)]),I(`p`,gg,M(f(O).comparison)+` → HEAD`,1),f(O).committed.truncated?(_(),v(`p`,_g,M((`t`in e?e.t:f(Q))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(O).committed.count?g(``,!0):(_(),v(`p`,vg,M((`t`in e?e.t:f(Q))(`No committed changes to show.`)),1)),(_(!0),v(k,null,y(f(O).committed.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[I(`summary`,null,[I(`span`,yg,M(n.path),1),n.binary?(_(),v(`span`,bg,M((`t`in e?e.t:f(Q))(`Binary`)),1)):(_(),v(`span`,xg,[I(`b`,null,M(V(n.added,`+`)),1),I(`i`,null,M(V(n.deleted,`−`)),1)]))]),n.summary?(_(),v(`p`,Sg,M((`t`in e?e.t:f(Q))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:1,file:n,scope:`committed`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[3]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):f(N)&&!f(A)&&!f(O).comparison?(_(),v(`p`,Cg,M((`t`in e?e.t:f(Q))(`No upstream or base branch available for comparison.`)),1)):g(``,!0)])],64)):g(``,!0),I(`p`,wg,M(f(b)&&`${(`t`in e?e.t:f(Q))(`Selection:`)} ${f(b)}`),1),f(p)&&f(p).via!==`drag`?(_(),v(`div`,Tg,[I(`div`,null,[I(`b`,null,M(f(b)),1),I(`p`,null,M(f(p).via===`touch`?(`t`in e?e.t:f(Q))(`Tap another line of this hunk to extend the block.`):(`t`in e?e.t:f(Q))(`Shift+Arrow extends the block within this hunk.`)),1)]),I(`button`,{type:`button`,class:`review-btn`,onClick:t[4]||=e=>p.value=null},M((`t`in e?e.t:f(Q))(`Cancel`)),1),I(`button`,{type:`button`,class:`review-btn primary`,onClick:t[5]||=e=>T(f(p).scope,f(p).path,f(p).block)},M((`t`in e?e.t:f(Q))(`Comment`)),1)])):g(``,!0)])])}}}),{__name:`ChangesView`}),Dg=[`id`,`data-pane`],Og={key:0,class:`file-drop`,"aria-hidden":`true`},kg={class:`file-drop-label`},Ag={class:`top bar agent-top`},jg=[`aria-label`,`title`],Mg={class:`agent-head`},Ng={class:`agent-title`},Pg={class:`agent-meta`},Fg={key:0,class:`agent-subtitle`},Ig={key:1,class:`agent-subtitle agent-command`},Lg={key:2,class:`agent-subtitle`},Rg=[`title`],zg={class:`machine-inline-name`},Bg={key:4,class:`where`},Vg={class:`agent-actions`},Hg=[`aria-label`],Ug={class:`agent-body`},Wg={class:`agent-main hw-backdrop-host`},Gg={key:1,class:`term-banner machine-banner`},Kg={key:0},qg={key:2,class:`term-banner closed-banner`},Jg={key:5,class:`chat-empty offline-terminal`},Yg={key:7,class:`chat`},Xg={key:8,class:`terminal-transcript-note`},Zg=null,Qg=Object.assign(T({__name:`AgentView`,props:{paneId:{},cell:{type:Boolean},active:{type:Boolean},grip:{type:Boolean},embedded:{type:Boolean},selectedMode:{}},emits:[`activate`,`update:selectedMode`],setup(e,{emit:t}){let r=e,i=t,o=Rt(),s=Bt(),c=n(()=>!r.cell||!!r.active),d=Symbol(`vue agent`);B(c,e=>{e&&(Ui.value=r.paneId,Zg=d)},{immediate:!0}),l(()=>{Zg===d&&(Ui.value=null)});let p=n(()=>Ar.value.panes.find(e=>e.id===r.paneId)),y=n(()=>Ar.value.workspaces.find(e=>e.id===p.value?.workspace)),b=n(()=>!!(r.cell||Tt.value&&Tt.value.panes.length>1)),x=n(()=>p.value?b.value?ji(p.value):dn(p.value,y.value):`—`),S=n(()=>{let e=p.value?Sn(p.value,y.value):``;return e&&e!==x.value?e:``}),C=n(()=>p.value?.command&&p.value.command!==x.value&&p.value.command!==S.value?p.value.command:``),T=n(()=>p.value&&Ar.value.tabs?.filter(e=>e.workspace===p.value?.workspace).length>1?p.value.tabLabel:``),D=n({get:()=>Mr(r.paneId),set:e=>wi(r.paneId,e)}),O=n(()=>{let e=p.value;return e?r.embedded&&r.selectedMode?r.selectedMode:r.cell?Xr({chat:Vr(e),viewMode:D.value,active:r.active}):Vr(e)?D.value:`term`:null}),k=u(null),A=ff(r.paneId,{setBanner:e=>{k.value=e},hasBanner:()=>!!k.value,fill:()=>!!r.cell,input:()=>c.value}),F=h(null),L=h(0),R=h(null),z=h(typeof o.query.q==`string`&&typeof o.query.hit==`string`),V=h(!!p.value),U=h(!1),ee=setTimeout(()=>{U.value=!0},4e3);l(()=>clearTimeout(ee));let te={text:Q(`This pane has been closed.`),btn:Q(`Back`),fn:()=>Vt(`/`)},G=n(()=>!p.value&&Ar.value.ok&&(V.value||U.value)&&!lt(r.paneId));B(p,e=>{e&&(V.value=!0,k.value===te&&(k.value=null,O.value===`term`&&!A.isConnected()&&P(()=>A.connect(!1))))}),B(G,e=>{e&&(k.value=te)},{immediate:!0}),B(O,(e,t)=>{e===`chat`&&t===`term`&&(k.value=G.value?k.value:null)},{immediate:!0});function ne(e){r.embedded&&i(`update:selectedMode`,e),r.cell&&i(`activate`),D.value=e,Lr.value&&e===`term`&&P(()=>A.focus()),X()}function K(e){ne(di(O.value,e))}function re(){z.value?z.value=!1:(z.value=!0,O.value!==`chat`&&(D.value=`chat`))}ot(()=>r.paneId,()=>c.value,{searchChat(){return!p.value||!Vr(p.value)||O.value!==`chat`?!1:(z.value?F.value?.focusSearch():z.value=!0,!0)},toggleTerm(){if(!p.value||!Vr(p.value)||!O.value)return!1;let e=O.value!==`chat`;return ne(e?`chat`:`term`),e&&P(()=>R.value?.focus()),!0},stop:()=>O.value===`chat`&&!!R.value?.stop()});let q=qn(r.paneId),ae=_t(),J=u(Yn(r.paneId)),ce=n(()=>Ar.value.ok?Ar.value.panes.map(e=>e.id).join(` `):``);B([()=>p.value&&sn(p.value,ae.value).join(` `),ce],([e,t])=>{if(!e||!t)return;let n=e.split(` `);J.value=Yt(J.value,n),Gt(r.paneId,n),Y(r.paneId,n,new Set(t.split(` `)))&&$(Z(`Draft from the closed pane restored`,`Brouillon du pane fermé récupéré`))},{immediate:!0});let le=n(()=>G.value?qt(r.paneId,J.value,Ar.value.panes,ae.value):null);B(le,e=>{e&&(an(r.paneId,e.id),!(r.cell||r.embedded)&&($(Z(`The agent restarted in a new pane: opened it`,`L’agent a redémarré dans un nouveau pane : il est ouvert`)),s.replace(Dt(e.id))))},{immediate:!0});let de;B(()=>G.value&&!le.value,e=>{if(clearInterval(de),de=void 0,!e)return;st();let t=20;de=ur(()=>{--t<=0&&(clearInterval(de),de=void 0),qr.value&&st()},3e3)},{immediate:!0}),l(()=>clearInterval(de));let pe=n(()=>mn(q));async function me(){try{await navigator.clipboard.writeText(Zn(q)),$(Z(`Draft copied`,`Brouillon copié`))}catch{$(Q(`Copy failed`),!0)}}let he=n(()=>vn(r.paneId));function ge(e){e&&An(r.paneId,e),F.value?.scrollToEnd(!0),F.value?.reload()}B(p,e=>bn(r.paneId,e?.queued||[]));let ve=n(()=>p.value&&p.value.status===`blocked`&&p.value.prompt&&p.value.prompt.options?p.value.prompt:null),ye=n(()=>zi(p.value)),be=n(()=>p.value&&p.value.menu&&p.value.status!==`working`&&!ve.value&&!ye.value?p.value.menu:null);B(()=>JSON.stringify([ve.value,ye.value,be.value]),()=>P(()=>F.value?.scrollToEnd(!1)));let xe=n(()=>{let e=p.value;return e?xr(e.cwd):``}),Se=n(()=>mr.value&&p.value?nr(p.value.machine):void 0),Ce=n(()=>!!(Se.value&&Se.value.status!==`online`));function Te(e){q.text=q.text?`${q.text}\n\n${e}`:e,Ee.value=!1,ne(`chat`),P(()=>R.value?.focusEnd())}let Ee=h(!1),De=h(!1),Oe=h(null),ke=n(()=>O.value===`term`),Ae=Jt(r.paneId),je=h(Ae.resume(p.value?.interaction||`unknown`)),Me=n(()=>O.value===`chat`&&Br.value&&!br.value&&!Ce.value&&!Qr(p.value)),Ne=n(()=>p.value?.interaction===`terminal`),Ie;function Le(){clearTimeout(Ie),Ie=void 0;let e=Date.now();je.value=Ae.update(p.value?.interaction||`unknown`,e);let t=Ae.deadline();t!==null&&qr.value&&(Ie=setTimeout(Le,Math.max(0,t-e))),(Ne.value||je.value||ve.value||be.value||ye.value)&&Ye.open&&Ye.pane===r.paneId&&it(!1)}B([()=>p.value?.interaction,ve,be,ye,()=>Ye.open,()=>Ye.pane,qr],Le,{immediate:!0});let Re=Ae.subscribe(Le);l(()=>{clearTimeout(Ie),Re()});function ze(){Ae.dismiss(),je.value=!1}function Be(){r.cell&&i(`activate`),Ae.reopen(),je.value=!0}let Ue=n(()=>je.value&&Me.value&&c.value&&!Pr.value),Ge=n(()=>ei({desk:Lr.value,live:c.value,mode:O.value,cell:!!r.cell})&&!(be.value&&O.value!==`term`)&&!(O.value===`chat`&&je.value)),Xe=n(()=>er({desk:Lr.value,live:c.value,mode:O.value,available:!(!p.value||!Br.value||br.value||Ce.value||Qr(p.value))}));function Ze(e){let t=e.target,n=[...t.files||[]];t.value=``,$e(n)}async function $e(e){if(Xe.value&&p.value)for(let t of e)try{let e=t.name.includes(`.`)&&t.name.split(`.`).pop()||``,n=await fetch(`/api/file?pane=${encodeURIComponent(r.paneId)}&ext=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:t}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(Q(i.error||`HTTP ${n.status}`));ge(await He(p.value,r.paneId,i.path)),X()}catch(e){$(`${Q(`File upload failed`)} : ${e.message}`,!0)}}let et=n(()=>Xe.value?`term`:Ge.value&&!br.value?`chat`:null),tt=h(0);function nt(e){Bn(e.dataTransfer)&&et.value&&(e.preventDefault(),e.type===`dragover`&&e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),tt.value=hn(tt.value,e.type))}function rt(e){if(tt.value=0,!Bn(e.dataTransfer)||!et.value)return;e.preventDefault();let t=[...e.dataTransfer?.files||[]];if(t.length){if(et.value===`term`)return $e(t);R.value?.addFiles(t).then(e=>{e&&(R.value?.focus(),X())})}}let at=n(()=>p.value?.agent===`claude`?Q(`Images, PDFs, text and code files`):Q(`Images, text and code files`));Ve();let ut=n(()=>{let e=p.value,t=e?[yt(e)]:[];if(Xe.value&&t.push({label:Q(`Attach a file…`),icon:`i-lucide-paperclip`,run:()=>Oe.value?.click()}),e&&t.push({label:Q(`View changes`),icon:`i-lucide-file-diff`,run:()=>{Ee.value=!0}}),e&&t.push({label:Q(`Browse files`),icon:`i-lucide-folder-tree`,run:()=>{De.value=!0}}),e&&Si(e)&&t.push({label:Q(`Open in editor`),icon:`i-lucide-external-link`,kbds:c.value?Pe(`open-editor`):void 0,run:()=>Zr(e)}),e&&t.push({label:Q(`Rename pane`),icon:`i-lucide-pencil`,run:()=>{oe.value=e.id}}),e&&t.push(...Lt(e)),e&&t.push(_e(e)),e&&Gn(e.machine).length&&t.push({label:Q(`Plugin actions`),icon:`i-lucide-puzzle`,run:()=>Jn({pane:e})}),t.push({label:Q(`Take control of this terminal`),icon:`i-lucide-arrow-left-right`,run:()=>{k.value=null,D.value=`term`,P(()=>A.connect(!0))}}),e&&ue(e)&&!e.restart&&t.push({label:Q(`Restart agent`),icon:`i-lucide-rotate-cw`,run:()=>ie(e)}),t.push({label:Q(`Reconnect`),icon:`i-lucide-refresh-cw`,run:()=>{k.value=null,D.value=`term`,P(()=>{A.reset(),A.connect(!1)})}}),r.cell||t.push(...Mt()),e){t.push({kind:`separator`}),t.push({label:e.agent?Z(`Close this pane (stops ${hr(e.agent)})`,`Fermer ce pane (arrête ${hr(e.agent)})`):Q(`Close this terminal`),icon:`i-lucide-trash-2`,danger:!0,kbds:c.value?Pe(`close-pane`):void 0,run:()=>gt(e)});let n=Ar.value.workspaces.find(t=>t.id===e.workspace);n&&n.worktree&&t.push({label:Q(`Delete this worktree`),icon:`i-lucide-git-branch`,danger:!0,run:()=>dt(e.workspace)})}return t});async function dt(e){await ta();let t=(Xi.value||[]).find(t=>t.workspace===e);if(!t)return $(Q(`Worktree not found`),!0);await $i(t)&&Vt(`/`)}let pt=n(()=>se(ut.value));function mt(){we(ut.value)}B(()=>p.value&&(p.value.machine||``),e=>{e!==void 0&&Xn(e)},{immediate:!0});let ht=n(()=>[{label:Q(`Conversation`),value:`chat`,icon:`i-lucide-message-square`},{label:Q(`Terminal`),value:`term`,icon:`i-lucide-square-terminal`}]),vt={list:`hw-tabs`,trigger:`hw-tab`,indicator:`hw-tab-ind`,leadingIcon:`hw-tab-icon`,label:`hw-tab-label`},bt=n({get:()=>O.value===`term`?`term`:`chat`,set:e=>ne(e===`term`?`term`:`chat`)}),xt=n(()=>O.value===`term`&&(!r.cell||!!(pi.value&&r.active))&&Br.value&&!br.value&&!Ce.value),St=n(()=>Fi({desk:Lr.value,cell:!!r.cell,chat:Vr(p.value),live:c.value})),wt=n(()=>!r.cell&&p.value&&Nr(We(p.value.workspace).length).headerAdd);B(lr,e=>A.setFontSize(e)),B(qr,e=>{A.setVisible(e),e&&O.value===`term`&&!A.isConnected()&&!k.value&&A.connect(!1)});let Tt=n(()=>p.value?Je(p.value.tab):null),Ot=n(()=>!!(Tt.value&&Tt.value.panes.length>1));function kt(){Tt.value&&(Lr.value?Vt({path:Ke(Tt.value.tab.id),query:{pane:r.paneId}}):Fe(Tt.value.tab.id))}function At(){let e=history.state?.back;e===`/board`||Tt.value&&e===Ke(Tt.value.tab.id)?s.back():Vt(`/`)}let jt=ft.value;ft.value=0;let Nt=h(0),Pt=h(!1),Ft=0,It=0,zt=0,Ht=`off`,Ut=e=>Tt.value?Jr(Tt.value.layout,r.paneId,e):null;function Kt(e,t){for(let n=e;n&&n!==t;n=n.parentElement)if(n.scrollWidth>n.clientWidth+1&&/(auto|scroll)/.test(getComputedStyle(n).overflowX))return!0;return!1}function Xt(e){if(Ht=`off`,r.cell||Lr.value||!Ot.value||e.touches.length!==1)return;let t=e.target?.closest?.(`.swipe-area, .choices, #termWrap`);t&&!Kt(e.target,t)&&(Ft=e.touches[0].clientX,It=e.touches[0].clientY,zt=Date.now(),Ht=null)}function Zt(e){if(Ht===`off`||Ht===`y`)return;let t=e.touches[0].clientX-Ft,n=e.touches[0].clientY-It;Ht===null&&(Ht=_n(t,n)),Ht===`x`&&(e.preventDefault(),Pt.value=!0,Nt.value=yn(t,!!Ut(t<0?1:-1)))}function $t(e){if(Ht===`x`){let t=(e.changedTouches[0]?.clientX??Ft)-Ft,n=In(t,Date.now()-zt,window.innerWidth),r=n?Ut(n):null;r&&(X(),ft.value=n,s.replace(Dt(r)))}Ht=`off`,Pt.value=!1,Nt.value=0}let en=n(()=>Ot.value&&!Lr.value?{transform:Nt.value?`translateX(${Nt.value}px)`:void 0,transition:Pt.value?`none`:`transform .18s ease`}:{});w(()=>{Lr.value&&c.value&&setTimeout(()=>(O.value===`term`?A:R.value)?.focus(),50)}),B(()=>r.active,(e,t)=>{e&&!t&&r.cell&&setTimeout(()=>{document.activeElement?.closest(`.cell-view.active`)||(O.value===`term`?A:R.value)?.focus()},50)});function tn(e){let t=e.target;r.cell&&Lr.value&&t?.closest?.(`.agent-top`)&&!t.closest(`button, a, input, [role="tab"], .cell-grip`)&&(document.activeElement&&document.activeElement!==document.body||(O.value===`term`?A:R.value)?.focus())}let nn=n(()=>Mn.value?{height:`${fn.value}px`,top:`${Pn.value}px`}:{});return(t,n)=>{let r=qe,o=Ca,s=Et,l=un,u=on,d=Da,h=ct,y=Qt,b=cn,w=Ma,D=Na,P=$u,B=ad,V=gf,U=Kf,ee=pp,G=ld,q=Ym,ie=Eg,ae=Wt,J=cc;return _(),v(`section`,{id:e.cell?void 0:`agent`,class:j(e.cell?[`cell-view`,{active:e.active,gripped:e.grip}]:`view`),style:N(e.cell?void 0:f(nn)),"data-pane":e.cell?e.paneId:void 0,onTouchstart:Xt,onTouchmove:Zt,onTouchend:$t,onTouchcancel:$t,onPointerdownCapture:n[16]||=t=>e.cell&&i(`activate`),onFocusin:n[17]||=t=>e.cell&&i(`activate`),onClick:tn,onDragenter:nt,onDragover:nt,onDragleave:nt,onDrop:rt},[f(tt)&&f(et)?(_(),v(`div`,Og,[E(r,{name:f(et)===`term`?`i-lucide-paperclip`:`i-lucide-file-plus`,class:`file-drop-icon`},null,8,[`name`]),I(`span`,kg,M((`t`in t?t.t:f(Q))(`Drop to attach`)),1),I(`small`,null,M(f(et)===`term`?(`t`in t?t.t:f(Q))(`The file path is sent to the terminal`):f(at)),1)])):g(``,!0),!e.cell&&f(p)?(_(),m(o,{key:1,workspace:f(p).workspace,current:f(p).tab},null,8,[`workspace`,`current`])):g(``,!0),e.embedded?g(``,!0):(_(),m(w,{key:2,items:()=>f(ut),disabled:!f(p)},{default:H(()=>[I(`header`,Ag,[e.cell&&e.grip?(_(),v(`span`,{key:0,class:`cell-grip`,role:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Drag to move the pane`),title:(`t`in t?t.t:f(Q))(`Drag to move the pane`)},[E(r,{name:`i-lucide-grip-vertical`})],8,jg)):g(``,!0),e.cell?g(``,!0):(_(),m(s,{key:1,id:`btnBack`,icon:`i-lucide-chevron-left`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn back`,"aria-label":(`t`in t?t.t:f(Q))(`Back`),onClick:At},null,8,[`aria-label`])),I(`div`,Mg,[I(`div`,Ng,[a(M(f(x))+` `,1),f(p)&&(`paneNotificationsMuted`in t?t.paneNotificationsMuted:f(Ct))(f(p))?(_(),m(r,{key:0,name:`i-lucide-bell-off`,class:`notification-muted`,title:(`t`in t?t.t:f(Q))(`Muted`)},null,8,[`title`])):g(``,!0)]),I(`div`,Pg,[E(l,{pane:f(p),kind:``},null,8,[`pane`]),f(S)?(_(),v(`span`,Fg,M(f(S)),1)):g(``,!0),f(C)?(_(),v(`span`,Ig,M(f(C)),1)):g(``,!0),f(T)?(_(),v(`span`,Lg,M(f(T)),1)):g(``,!0),f(Se)?(_(),v(`span`,{key:3,class:j([`agent-machine`,f(Se).status]),title:f(Se).target?`ssh ${f(Se).target}`:void 0},[E(r,{name:f(Se).local?`i-lucide-server`:`i-lucide-laptop`},null,8,[`name`]),I(`span`,zg,M((`machineName`in t?t.machineName:f(Ur))(f(Se).key)),1),f(Se).local?(_(),m(u,{key:0})):g(``,!0)],10,Rg)):g(``,!0),f(xe)?(_(),v(`span`,Bg,M(f(xe)),1)):g(``,!0)])]),f(St).selector===`cell`?(_(),m(d,{key:2,modelValue:f(bt),"onUpdate:modelValue":n[0]||=e=>W(bt)?bt.value=e:null,items:f(ht),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:vt},null,8,[`modelValue`,`items`])):g(``,!0),I(`div`,Vg,[f(St).selector===`header`?(_(),m(d,{key:0,modelValue:f(bt),"onUpdate:modelValue":n[1]||=e=>W(bt)?bt.value=e:null,items:f(ht),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:vt},null,8,[`modelValue`,`items`])):g(``,!0),f(wt)&&f(p)?(_(),m(s,{key:1,icon:`i-lucide-plus`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Q))(`New tab`),title:(`t`in t?t.t:f(Q))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(br),onClick:n[2]||=e=>(`newTab`in t?t.newTab:f(fe))(f(p).workspace)},null,8,[`aria-label`,`title`,`disabled`])):g(``,!0),e.cell?(_(),m(h,{key:2,text:(`t`in t?t.t:f(Q))(`Open alone`)},{default:H(()=>[E(s,{icon:`i-lucide-maximize-2`,color:`neutral`,variant:`ghost`,size:`md`,class:`icon-btn cell-extra`,"aria-label":(`t`in t?t.t:f(Q))(`Open alone`),to:(`panePath`in t?t.panePath:f(Dt))(e.paneId)},null,8,[`aria-label`,`to`])]),_:1},8,[`text`])):f(Ot)&&f(Tt)?(_(),m(h,{key:3,text:(`t`in t?t.t:f(Q))(`Side by side`),disabled:!(`desk`in t?t.desk:f(Lr))},{default:H(()=>[I(`button`,{type:`button`,class:`map-btn`,"aria-label":(`desk`in t?t.desk:f(Lr))?(`t`in t?t.t:f(Q))(`Side by side`):(`t`in t?t.t:f(Q))(`Tab overview`),onClick:kt},[E(y,{layout:f(Tt).layout,panes:f(Tt).panes,current:e.paneId},null,8,[`layout`,`panes`,`current`])],8,Hg)]),_:1},8,[`text`,`disabled`])):g(``,!0),f(St).term?(_(),m(s,{key:4,icon:`i-lucide-square-terminal`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn mode-btn`,{on:f(O)===`term`}]),"aria-label":(`t`in t?t.t:f(Q))(`Terminal`),"aria-pressed":f(O)===`term`,onClick:n[3]||=e=>K(`term`)},null,8,[`class`,`aria-label`,`aria-pressed`])):g(``,!0),(`hasChat`in t?t.hasChat:f(Vr))(f(p))&&(f(c)||e.cell)?(_(),m(h,{key:5,text:(`t`in t?t.t:f(Q))(`Search`),kbds:f(O)===`chat`?(`shortcutKbds`in t?t.shortcutKbds:f(Pe))(`search-chat`):void 0,disabled:!(`desk`in t?t.desk:f(Lr))},{default:H(()=>[E(s,{icon:`i-lucide-search`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn cell-extra`,{on:f(z)}]),"aria-label":(`t`in t?t.t:f(Q))(`Search`),onClick:re},null,8,[`class`,`aria-label`])]),_:1},8,[`text`,`kbds`,`disabled`])):g(``,!0),(`sheetMenus`in t?t.sheetMenus:f(ui))?(_(),m(s,{key:7,icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Q))(`Options`),onClick:mt},null,8,[`aria-label`])):(_(),m(b,{key:6,items:f(pt),content:{align:`end`,sideOffset:6},ui:{content:`hw-dropdown`}},{default:H(()=>[E(s,{icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Q))(`Options`)},null,8,[`aria-label`])]),_:1},8,[`items`]))])])]),_:1},8,[`items`,`disabled`])),I(`div`,Ug,[I(`div`,Wg,[(`desk`in t?t.desk:f(Lr))&&!e.cell&&(`backdrop`in t?t.backdrop:f(Qe))===`wherdr`&&f(O)===`chat`?(_(),m(D,{key:0})):g(``,!0),f(Ce)&&f(Se)?(_(),v(`div`,Gg,[E(r,{name:`i-lucide-unplug`,class:`term-banner-icon`}),I(`span`,null,[a(M(f(Se).status===`connecting`?(`tl`in t?t.tl:f(Z))(`${(`machineName`in t?t.machineName:f(Ur))(f(Se).key)} unreachable — reconnecting…`,`${(`machineName`in t?t.machineName:f(Ur))(f(Se).key)} injoignable — reconnexion…`):(`tl`in t?t.tl:f(Z))(`${(`machineName`in t?t.machineName:f(Ur))(f(Se).key)} offline`,`${(`machineName`in t?t.machineName:f(Ur))(f(Se).key)} hors ligne`)),1),f(Se).error?(_(),v(`small`,Kg,M((`t`in t?t.t:f(Q))(f(Se).error)),1)):g(``,!0)])])):g(``,!0),f(k)===te&&f(le)?(_(),v(`div`,qg,[E(r,{name:`i-lucide-refresh-cw`,class:`term-banner-icon`}),I(`span`,null,M((`tl`in t?t.tl:f(Z))(`This agent continues in a new pane.`,`Cet agent continue dans un nouveau pane.`)),1),E(s,{size:`xs`,color:`warning`,variant:`outline`,to:(`panePath`in t?t.panePath:f(Dt))(f(le).id)},{default:H(()=>[a(M((`tl`in t?t.tl:f(Z))(`Open`,`Ouvrir`)),1)]),_:1},8,[`to`])])):f(k)?(_(),v(`div`,{key:3,class:j([`term-banner`,{"closed-banner":f(k)===te}])},[E(r,{name:`i-lucide-triangle-alert`,class:`term-banner-icon`}),I(`span`,null,M(f(k)===te&&f(pe)?(`tl`in t?t.tl:f(Z))(`This pane has been closed. Your draft is kept below.`,`Ce pane a été fermé. Ton brouillon est gardé ci-dessous.`):f(k).text),1),f(k)===te&&f(pe)?(_(),m(s,{key:0,size:`xs`,color:`warning`,variant:`outline`,icon:`i-lucide-copy`,onClick:me},{default:H(()=>[a(M((`tl`in t?t.tl:f(Z))(`Copy draft`,`Copier le brouillon`)),1)]),_:1})):g(``,!0),E(s,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[4]||=e=>f(k).fn()},{default:H(()=>[a(M(f(k).btn),1)]),_:1})],2)):g(``,!0),f(p)&&f(O)===`chat`?(_(),v(`div`,{key:4,class:j([`swipe-area`,f(jt)?f(jt)>0?`enter-next`:`enter-prev`:void 0]),style:N(f(en))},[E(P,{ref_key:`chatRef`,ref:F,search:f(z),"onUpdate:search":n[5]||=e=>W(z)?z.value=e:null,pane:f(p),"local-queued":f(he),onGotoTerm:n[6]||=e=>ne(`term`),onRestored:n[7]||=e=>f(R)?.focus(),onQuote:n[8]||=e=>f(R)?.focusEnd(),onAnswered:n[9]||=e=>f(R)?.focusAnswer(e),onUnanswered:n[10]||=e=>L.value=e,onSent:ge},null,8,[`search`,`pane`,`local-queued`])],6)):f(O)===`term`&&(!(`eventsOpen`in t?t.eventsOpen:f(Br))||(`offlineView`in t?t.offlineView:f(br))||f(Ce))?(_(),v(`div`,Jg,[E(r,{name:`i-lucide-wifi-off`,class:`chat-empty-icon`}),I(`p`,null,M((`t`in t?t.t:f(Q))(`Terminal unavailable offline`)),1)])):f(O)===`term`?(_(),m(B,{key:6,ctl:f(A),class:j(f(jt)?f(jt)>0?`enter-next`:`enter-prev`:void 0),style:N(f(en))},null,8,[`ctl`,`class`,`style`])):(_(),v(`div`,Yg)),f(p)?.agent&&!(`hasChat`in t?t.hasChat:f(Vr))(f(p))&&f(O)===`term`&&!e.cell?(_(),v(`p`,Xg,M((`tl`in t?t.tl:f(Z))(`Conversation unavailable for this agent · follow it in the terminal`,`Conversation non disponible pour cet agent · suivi dans le terminal`)),1)):g(``,!0),f(Ue)?(_(),m(V,{key:9,"pane-id":e.paneId,active:f(c),title:f(x),onClose:ze},null,8,[`pane-id`,`active`,`title`])):(f(Ne)||f(je))&&f(Me)?(_(),v(`button`,{key:10,type:`button`,class:`interactive-terminal-reopen`,onClick:Be},[E(r,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Z))(`Open interactive terminal`,`Ouvrir le terminal interactif`)),1)])):g(``,!0),(f(ve)||f(ye))&&!f(je)&&!f(Ne)&&!f(ke)&&(`eventsOpen`in t?t.eventsOpen:f(Br))&&!(`offlineView`in t?t.offlineView:f(br))&&!f(Ce)?(_(),m(U,{key:11,"pane-id":e.paneId,prompt:f(ve),screen:f(ye),keys:f(c)},null,8,[`pane-id`,`prompt`,`screen`,`keys`])):f(be)&&!f(je)&&!f(Ne)&&!f(ke)&&(`eventsOpen`in t?t.eventsOpen:f(Br))&&!(`offlineView`in t?t.offlineView:f(br))&&!f(Ce)?(_(),m(ee,{key:12,"pane-id":e.paneId,menu:f(be),keys:f(c),onTerminal:n[11]||=e=>ne(`term`)},null,8,[`pane-id`,`menu`,`keys`])):g(``,!0),f(xt)?(_(),m(G,{key:13,ctl:f(A)},null,8,[`ctl`])):g(``,!0),f(Ge)?(_(),m(q,{key:14,ref_key:`composer`,ref:R,pane:f(p),"pane-id":e.paneId,"send-keys":f(A).sendKeys,conversation:f(O)===`chat`,"term-shown":f(ke),"esc-stops":!f(z),"take-back":f(O)===`chat`,unanswered:f(O)===`chat`?f(L):0,onSent:ge,onShowTerminal:n[12]||=e=>ne(`term`),onShowUnanswered:n[13]||=e=>f(F)?.gotoUnanswered()},null,8,[`pane`,`pane-id`,`send-keys`,`conversation`,`term-shown`,`esc-stops`,`take-back`,`unanswered`])):g(``,!0)])]),E(ae,{open:f(Ee),"onUpdate:open":n[14]||=e=>W(Ee)?Ee.value=e:null,title:(`t`in t?t.t:f(Q))(`Changes`),wide:``,full:``,screen:``},{default:H(()=>[f(Ee)&&f(p)?(_(),m(ie,{key:0,"pane-id":e.paneId,onReview:Te},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),E(ae,{open:f(De),"onUpdate:open":n[15]||=e=>W(De)?De.value=e:null,title:(`t`in t?t.t:f(Q))(`Files`),wide:``,full:``,screen:``},{default:H(()=>[f(De)&&f(p)?(_(),m(J,{key:0,"pane-id":e.paneId},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),I(`input`,{ref_key:`attachInput`,ref:Oe,type:`file`,multiple:``,hidden:``,onChange:Ze},null,544)],46,Dg)}}}),{__name:`AgentView`});export{Ma as a,Fa as i,qp as n,ja as o,lc as r,Ca as s,Qg as t};