agent-tower 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/git/git-cli.js +2 -2
- package/dist/git/git-cli.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-CB48v8IV.js → AgentDemoPage-B4p6JOaa.js} +1 -1
- package/dist/web/assets/{DemoPage-_dT9rdpV.js → DemoPage-a61F8WUp.js} +1 -1
- package/dist/web/assets/{GeneralSettingsPage-DtD_oirE.js → GeneralSettingsPage-CQmEjFi8.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-DQqz8xJs.js → NotificationSettingsPage-BRw2fFTj.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-BaFNyfse.js → ProfileSettingsPage-D-zyXwz1.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-DNCKy0g4.js → ProjectKanbanPage-DSO5OEi0.js} +22 -22
- package/dist/web/assets/{ProjectSettingsPage-Cv6VpL1g.js → ProjectSettingsPage-CKb-5dhB.js} +1 -1
- package/dist/web/assets/{ProviderSettingsPage-BqmSJV2I.js → ProviderSettingsPage-dGoaMV8Q.js} +1 -1
- package/dist/web/assets/{button-Cg3N0RX4.js → button-yc8E-9mL.js} +1 -1
- package/dist/web/assets/{chevron-down-BZ2n6wh3.js → chevron-down-CgN79gJE.js} +1 -1
- package/dist/web/assets/{chevron-right-BrrhT2ph.js → chevron-right-DlWP8lVM.js} +1 -1
- package/dist/web/assets/{circle-alert-a6g1jQyL.js → circle-alert-CgMmay1J.js} +1 -1
- package/dist/web/assets/{circle-check-CQEg-cq1.js → circle-check-CSmMKb6_.js} +1 -1
- package/dist/web/assets/{code-block-OCS4YCEC-C72vBOSD.js → code-block-OCS4YCEC-DiXG3CzW.js} +1 -1
- package/dist/web/assets/{confirm-dialog-DmuQeQ0J.js → confirm-dialog-Q8BsN1Up.js} +1 -1
- package/dist/web/assets/{folder-picker-Dl5GZRtL.js → folder-picker-C45cXliN.js} +1 -1
- package/dist/web/assets/{index-D3_Vq2xm.js → index-DK-vt3Cl.js} +2 -2
- package/dist/web/assets/{loader-circle-DRKF9OZx.js → loader-circle-DYUWI5Dr.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-DyQsSSRd.js → mermaid-NOHMQCX5-C5mvGqWa.js} +3 -3
- package/dist/web/assets/{modal-wSbeXj_V.js → modal-BgEFLccc.js} +1 -1
- package/dist/web/assets/{pencil-CT2HBX6f.js → pencil-CjaX70qm.js} +1 -1
- package/dist/web/assets/{rotate-ccw-DkZPjdAj.js → rotate-ccw-CDDSxb2s.js} +1 -1
- package/dist/web/assets/{select-BRJQTh28.js → select-DKQPvWiV.js} +1 -1
- package/dist/web/assets/{use-profiles-zSSuAJaA.js → use-profiles-Brdh89vT.js} +1 -1
- package/dist/web/assets/{use-providers-BfLpM8PB.js → use-providers-Es21U-kq.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-
|
|
2
|
-
import{Q as jr,o as ti,p as ra,v as ia,w as na,x as _r,y as oa,z as aa,e as We,A as la,B as ca,r as k,D as ha,E as ua,G as da,H as fa,I as si,J as ri,K as ma,M as pa,N as va,h as _e,R as ee,O as Nt,u as ce,j as a,s as wt,S as Qe,C as Pt,g as fe,f as Ze,q as ae,d as ht,n as Et,P as ga,T as ii,U as _a,i as ba,V as xa,t as ni,L as oi,_ as cn}from"./index-D3_Vq2xm.js";import{h as Tr,b as Lr,d as Mr,c as Nr,i as Pr,G as Is,u as hn,a as un,Q as dn,e as fn,T as mn,P as ws,f as pn,S as ai}from"./mermaid-NOHMQCX5-DyQsSSRd.js";import{C as xt,a as ss}from"./chevron-down-BZ2n6wh3.js";import{C as Ft}from"./chevron-right-BrrhT2ph.js";import{P as br,X as Fs,M as Or,T as vn}from"./modal-wSbeXj_V.js";import{T as gn,a as Sa,A as _t,S as Le,C as xr,b as gt}from"./confirm-dialog-DmuQeQ0J.js";import"./log-adapter-50wgehrc.js";import{B as dt}from"./button-Cg3N0RX4.js";import{c as ye,t as li}from"./utils-CkSf8FUe.js";import{F as ya,a as Ca,R as wa}from"./rotate-ccw-DkZPjdAj.js";import{L as ze}from"./loader-circle-DRKF9OZx.js";import{u as Hs}from"./use-providers-BfLpM8PB.js";import{S as vs}from"./select-BRJQTh28.js";var Ea=class extends jr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:ti()})}getOptimisticResult(e){return e.behavior=ti(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,l=super.createResult(e,t),{isFetching:m,isRefetching:v,isError:C,isRefetchError:r}=l,i=s.fetchMeta?.fetchMore?.direction,c=C&&i==="forward",f=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:ia(t,s.data),hasPreviousPage:ra(t,s.data),isFetchNextPageError:c,isFetchingNextPage:f,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!c&&!o,isRefetching:v&&!f&&!p}}};function ci(e,t){const s=new Set(t);return e.filter(l=>!s.has(l))}function ka(e,t,s){const l=e.slice(0);return l[t]=s,l}var Ra=class extends na{#r;#e;#i;#n;#t;#s;#o;#a;#l;#c=[];constructor(e,t,s){super(),this.#r=e,this.#n=s,this.#i=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#i=e,this.#n=t,_r.batch(()=>{const s=this.#t,l=this.#d(this.#i);l.forEach(f=>f.observer.setOptions(f.defaultedQueryOptions));const m=l.map(f=>f.observer),v=m.map(f=>f.getCurrentResult()),C=s.length!==m.length,r=m.some((f,o)=>f!==s[o]),i=C||r,c=i?!0:v.some((f,o)=>{const p=this.#e[o];return!p||!oa(f,p)});!i&&!c||(i&&(this.#c=l,this.#t=m),this.#e=v,this.hasListeners()&&(i&&(ci(s,m).forEach(f=>{f.destroy()}),ci(m,s).forEach(f=>{f.subscribe(o=>{this.#f(f,o)})})),this.#m()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const s=this.#d(e),l=s.map(v=>v.observer.getOptimisticResult(v.defaultedQueryOptions)),m=s.map(v=>v.defaultedQueryOptions.queryHash);return[l,v=>this.#u(v??l,t,m),()=>this.#h(l,s)]}#h(e,t){return t.map((s,l)=>{const m=e[l];return s.defaultedQueryOptions.notifyOnChangeProps?m:s.observer.trackResult(m,v=>{t.forEach(C=>{C.observer.trackProp(v)})})})}#u(e,t,s){if(t){const l=this.#l,m=s!==void 0&&l!==void 0&&(l.length!==s.length||s.some((v,C)=>v!==l[C]));return(!this.#s||this.#e!==this.#a||m||t!==this.#o)&&(this.#o=t,this.#a=this.#e,s!==void 0&&(this.#l=s),this.#s=aa(this.#s,t(e))),this.#s}return e}#d(e){const t=new Map;this.#t.forEach(l=>{const m=l.options.queryHash;if(!m)return;const v=t.get(m);v?v.push(l):t.set(m,[l])});const s=[];return e.forEach(l=>{const m=this.#r.defaultQueryOptions(l),C=t.get(m.queryHash)?.shift()??new jr(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=ka(this.#e,s,t),this.#m())}#m(){if(this.hasListeners()){const e=this.#s,t=this.#h(this.#e,this.#c),s=this.#u(t,this.#n?.combine);e!==s&&_r.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function Da({queries:e,...t},s){const l=We(),m=la(),v=ca(),C=k.useMemo(()=>e.map(g=>{const n=l.defaultQueryOptions(g);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,l,m]);C.forEach(g=>{ha(g);const n=l.getQueryCache().get(g.queryHash);ua(g,v,n)}),da(v);const[r]=k.useState(()=>new Ra(l,C,t)),[i,c,f]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(g=>o?r.subscribe(_r.batchCalls(g)):fa,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),k.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const x=i.some((g,n)=>si(C[n],g))?i.flatMap((g,n)=>{const d=C[n];if(d){const h=new jr(l,d);if(si(d,g))return ri(d,h,v);ma(g,m)&&ri(d,h,v)}return[]}):[];if(x.length>0)throw Promise.all(x);const S=i.find((g,n)=>{const d=C[n];return d&&pa({result:g,errorResetBoundary:v,throwOnError:d.throwOnError,query:l.getQueryCache().get(d.queryHash),suspense:d.suspense})});if(S?.error)throw S.error;return c(f())}function _n(e,t){return va(e,Ea)}const Aa=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],bn=_e("arrow-down",Aa);const ja=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],xn=_e("arrow-right",ja);const Ta=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Sn=_e("arrow-up",Ta);const La=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],hi=_e("circle-check-big",La);const Ma=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],zs=_e("code-xml",Ma);const Na=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ui=_e("copy",Na);const Pa=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],yn=_e("ellipsis-vertical",Pa);const Oa=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],Ba=_e("file-braces-corner",Oa);const Ia=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],rs=_e("file-code-corner",Ia);const Fa=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ha=_e("file-exclamation-point",Fa);const za=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Cn=_e("file-text",za);const Wa=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],wn=_e("folder-open",Wa);const $a=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Ua=_e("gauge",$a);const qa=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Ka=_e("git-branch",qa);const Xa=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],Ya=_e("git-fork",Xa);const Va=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],is=_e("git-graph",Va);const Ga=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],En=_e("git-merge",Ga);const Qa=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],qt=_e("history",Qa);const Za=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Br=_e("image",Za);const Ja=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],di=_e("layers",Ja);const el=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],tl=_e("maximize",el);const sl=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],rl=_e("message-square",sl);const il=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],nl=_e("panel-left-close",il);const ol=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],al=_e("panel-left-open",ol);const ll=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],cl=_e("panel-right-close",ll);const hl=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],ul=_e("panel-right-open",hl);const dl=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ot=_e("play",dl);const fl=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ml=_e("refresh-cw",fl);const pl=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],vl=_e("shield",pl);const gl=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Es=_e("terminal",gl);const _l=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],bl=_e("zap",_l);const xl=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Sl=_e("zoom-in",xl);const yl=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Cl=_e("zoom-out",yl),Ws=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Kt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ir(e){return"nodeType"in e}function Je(e){var t,s;return e?Kt(e)?e:Ir(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function Fr(e){const{Document:t}=Je(e);return e instanceof t}function cs(e){return Kt(e)?!1:e instanceof Je(e).HTMLElement}function kn(e){return e instanceof Je(e).SVGElement}function Xt(e){return e?Kt(e)?e.document:Ir(e)?Fr(e)?e:cs(e)||kn(e)?e.ownerDocument:document:document:document}const bt=Ws?k.useLayoutEffect:k.useEffect;function $s(e){const t=k.useRef(e);return bt(()=>{t.current=e}),k.useCallback(function(){for(var s=arguments.length,l=new Array(s),m=0;m<s;m++)l[m]=arguments[m];return t.current==null?void 0:t.current(...l)},[])}function wl(){const e=k.useRef(null),t=k.useCallback((l,m)=>{e.current=setInterval(l,m)},[]),s=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function ns(e,t){t===void 0&&(t=[e]);const s=k.useRef(e);return bt(()=>{s.current!==e&&(s.current=e)},t),s}function hs(e,t){const s=k.useRef();return k.useMemo(()=>{const l=e(s.current);return s.current=l,l},[...t])}function ks(e){const t=$s(e),s=k.useRef(null),l=k.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,l]}function Rs(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let sr={};function Us(e,t){return k.useMemo(()=>{if(t)return t;const s=sr[e]==null?0:sr[e]+1;return sr[e]=s,e+"-"+s},[e,t])}function Rn(e){return function(t){for(var s=arguments.length,l=new Array(s>1?s-1:0),m=1;m<s;m++)l[m-1]=arguments[m];return l.reduce((v,C)=>{const r=Object.entries(C);for(const[i,c]of r){const f=v[i];f!=null&&(v[i]=f+e*c)}return v},{...t})}}const Ut=Rn(1),Ds=Rn(-1);function El(e){return"clientX"in e&&"clientY"in e}function Hr(e){if(!e)return!1;const{KeyboardEvent:t}=Je(e.target);return t&&e instanceof t}function kl(e){if(!e)return!1;const{TouchEvent:t}=Je(e.target);return t&&e instanceof t}function As(e){if(kl(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return El(e)?{x:e.clientX,y:e.clientY}:null}const os=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[os.Translate.toString(e),os.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:l}=e;return t+" "+s+"ms "+l}}}),fi="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Rl(e){return e.matches(fi)?e:e.querySelector(fi)}const Dl={display:"none"};function Al(e){let{id:t,value:s}=e;return ee.createElement("div",{id:t,style:Dl},s)}function jl(e){let{id:t,announcement:s,ariaLiveType:l="assertive"}=e;const m={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ee.createElement("div",{id:t,style:m,role:"status","aria-live":l,"aria-atomic":!0},s)}function Tl(){const[e,t]=k.useState("");return{announce:k.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const Dn=k.createContext(null);function Ll(e){const t=k.useContext(Dn);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ml(){const[e]=k.useState(()=>new Set),t=k.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[k.useCallback(l=>{let{type:m,event:v}=l;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,v)})},[e]),t]}const Nl={draggable:`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-BgEFLccc.js","assets/index-DK-vt3Cl.js","assets/index-BGvfX18x.css","assets/utils-CkSf8FUe.js","assets/folder-picker-C45cXliN.js","assets/chevron-right-DlWP8lVM.js","assets/loader-circle-DYUWI5Dr.js","assets/circle-alert-CgMmay1J.js","assets/rotate-ccw-CDDSxb2s.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{Q as Tr,o as si,p as ra,v as ia,w as na,x as br,y as oa,z as aa,e as We,A as la,B as ca,r as k,D as ha,E as ua,G as da,H as fa,I as ri,J as ii,K as ma,M as pa,N as va,h as _e,R as ee,O as Nt,u as ce,j as a,s as wt,S as Qe,C as Pt,g as fe,f as Ze,q as ae,d as ht,n as Et,P as ga,T as ni,U as _a,i as ba,V as xa,t as sr,L as oi,_ as cn}from"./index-DK-vt3Cl.js";import{h as Lr,b as Mr,d as Nr,c as Pr,i as Or,G as Is,u as hn,a as un,Q as dn,e as fn,T as mn,P as ws,f as pn,S as ai}from"./mermaid-NOHMQCX5-C5mvGqWa.js";import{C as xt,a as ss}from"./chevron-down-CgN79gJE.js";import{C as Ft}from"./chevron-right-DlWP8lVM.js";import{P as xr,X as Fs,M as Br,T as vn}from"./modal-BgEFLccc.js";import{T as gn,a as Sa,A as _t,S as Le,C as Sr,b as gt}from"./confirm-dialog-Q8BsN1Up.js";import"./log-adapter-50wgehrc.js";import{B as dt}from"./button-yc8E-9mL.js";import{c as ye,t as li}from"./utils-CkSf8FUe.js";import{F as ya,a as Ca,R as wa}from"./rotate-ccw-CDDSxb2s.js";import{L as ze}from"./loader-circle-DYUWI5Dr.js";import{u as Hs}from"./use-providers-Es21U-kq.js";import{S as vs}from"./select-DKQPvWiV.js";var Ea=class extends Tr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:si()})}getOptimisticResult(e){return e.behavior=si(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,l=super.createResult(e,t),{isFetching:m,isRefetching:v,isError:C,isRefetchError:r}=l,i=s.fetchMeta?.fetchMore?.direction,c=C&&i==="forward",f=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:ia(t,s.data),hasPreviousPage:ra(t,s.data),isFetchNextPageError:c,isFetchingNextPage:f,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!c&&!o,isRefetching:v&&!f&&!p}}};function ci(e,t){const s=new Set(t);return e.filter(l=>!s.has(l))}function ka(e,t,s){const l=e.slice(0);return l[t]=s,l}var Ra=class extends na{#r;#e;#i;#n;#t;#s;#o;#a;#l;#c=[];constructor(e,t,s){super(),this.#r=e,this.#n=s,this.#i=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#i=e,this.#n=t,br.batch(()=>{const s=this.#t,l=this.#d(this.#i);l.forEach(f=>f.observer.setOptions(f.defaultedQueryOptions));const m=l.map(f=>f.observer),v=m.map(f=>f.getCurrentResult()),C=s.length!==m.length,r=m.some((f,o)=>f!==s[o]),i=C||r,c=i?!0:v.some((f,o)=>{const p=this.#e[o];return!p||!oa(f,p)});!i&&!c||(i&&(this.#c=l,this.#t=m),this.#e=v,this.hasListeners()&&(i&&(ci(s,m).forEach(f=>{f.destroy()}),ci(m,s).forEach(f=>{f.subscribe(o=>{this.#f(f,o)})})),this.#m()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const s=this.#d(e),l=s.map(v=>v.observer.getOptimisticResult(v.defaultedQueryOptions)),m=s.map(v=>v.defaultedQueryOptions.queryHash);return[l,v=>this.#u(v??l,t,m),()=>this.#h(l,s)]}#h(e,t){return t.map((s,l)=>{const m=e[l];return s.defaultedQueryOptions.notifyOnChangeProps?m:s.observer.trackResult(m,v=>{t.forEach(C=>{C.observer.trackProp(v)})})})}#u(e,t,s){if(t){const l=this.#l,m=s!==void 0&&l!==void 0&&(l.length!==s.length||s.some((v,C)=>v!==l[C]));return(!this.#s||this.#e!==this.#a||m||t!==this.#o)&&(this.#o=t,this.#a=this.#e,s!==void 0&&(this.#l=s),this.#s=aa(this.#s,t(e))),this.#s}return e}#d(e){const t=new Map;this.#t.forEach(l=>{const m=l.options.queryHash;if(!m)return;const v=t.get(m);v?v.push(l):t.set(m,[l])});const s=[];return e.forEach(l=>{const m=this.#r.defaultQueryOptions(l),C=t.get(m.queryHash)?.shift()??new Tr(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=ka(this.#e,s,t),this.#m())}#m(){if(this.hasListeners()){const e=this.#s,t=this.#h(this.#e,this.#c),s=this.#u(t,this.#n?.combine);e!==s&&br.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function Da({queries:e,...t},s){const l=We(),m=la(),v=ca(),C=k.useMemo(()=>e.map(g=>{const n=l.defaultQueryOptions(g);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,l,m]);C.forEach(g=>{ha(g);const n=l.getQueryCache().get(g.queryHash);ua(g,v,n)}),da(v);const[r]=k.useState(()=>new Ra(l,C,t)),[i,c,f]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(g=>o?r.subscribe(br.batchCalls(g)):fa,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),k.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const x=i.some((g,n)=>ri(C[n],g))?i.flatMap((g,n)=>{const d=C[n];if(d){const h=new Tr(l,d);if(ri(d,g))return ii(d,h,v);ma(g,m)&&ii(d,h,v)}return[]}):[];if(x.length>0)throw Promise.all(x);const S=i.find((g,n)=>{const d=C[n];return d&&pa({result:g,errorResetBoundary:v,throwOnError:d.throwOnError,query:l.getQueryCache().get(d.queryHash),suspense:d.suspense})});if(S?.error)throw S.error;return c(f())}function _n(e,t){return va(e,Ea)}const Aa=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],bn=_e("arrow-down",Aa);const ja=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],xn=_e("arrow-right",ja);const Ta=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Sn=_e("arrow-up",Ta);const La=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],hi=_e("circle-check-big",La);const Ma=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],zs=_e("code-xml",Ma);const Na=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ui=_e("copy",Na);const Pa=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],yn=_e("ellipsis-vertical",Pa);const Oa=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],Ba=_e("file-braces-corner",Oa);const Ia=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],rs=_e("file-code-corner",Ia);const Fa=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ha=_e("file-exclamation-point",Fa);const za=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Cn=_e("file-text",za);const Wa=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],wn=_e("folder-open",Wa);const $a=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Ua=_e("gauge",$a);const qa=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Ka=_e("git-branch",qa);const Xa=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],Ya=_e("git-fork",Xa);const Va=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],is=_e("git-graph",Va);const Ga=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],En=_e("git-merge",Ga);const Qa=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],qt=_e("history",Qa);const Za=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ir=_e("image",Za);const Ja=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],di=_e("layers",Ja);const el=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],tl=_e("maximize",el);const sl=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],rl=_e("message-square",sl);const il=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],nl=_e("panel-left-close",il);const ol=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],al=_e("panel-left-open",ol);const ll=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],cl=_e("panel-right-close",ll);const hl=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],ul=_e("panel-right-open",hl);const dl=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ot=_e("play",dl);const fl=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ml=_e("refresh-cw",fl);const pl=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],vl=_e("shield",pl);const gl=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Es=_e("terminal",gl);const _l=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],bl=_e("zap",_l);const xl=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Sl=_e("zoom-in",xl);const yl=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Cl=_e("zoom-out",yl),Ws=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Kt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Fr(e){return"nodeType"in e}function Je(e){var t,s;return e?Kt(e)?e:Fr(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function Hr(e){const{Document:t}=Je(e);return e instanceof t}function cs(e){return Kt(e)?!1:e instanceof Je(e).HTMLElement}function kn(e){return e instanceof Je(e).SVGElement}function Xt(e){return e?Kt(e)?e.document:Fr(e)?Hr(e)?e:cs(e)||kn(e)?e.ownerDocument:document:document:document}const bt=Ws?k.useLayoutEffect:k.useEffect;function $s(e){const t=k.useRef(e);return bt(()=>{t.current=e}),k.useCallback(function(){for(var s=arguments.length,l=new Array(s),m=0;m<s;m++)l[m]=arguments[m];return t.current==null?void 0:t.current(...l)},[])}function wl(){const e=k.useRef(null),t=k.useCallback((l,m)=>{e.current=setInterval(l,m)},[]),s=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function ns(e,t){t===void 0&&(t=[e]);const s=k.useRef(e);return bt(()=>{s.current!==e&&(s.current=e)},t),s}function hs(e,t){const s=k.useRef();return k.useMemo(()=>{const l=e(s.current);return s.current=l,l},[...t])}function ks(e){const t=$s(e),s=k.useRef(null),l=k.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,l]}function Rs(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let rr={};function Us(e,t){return k.useMemo(()=>{if(t)return t;const s=rr[e]==null?0:rr[e]+1;return rr[e]=s,e+"-"+s},[e,t])}function Rn(e){return function(t){for(var s=arguments.length,l=new Array(s>1?s-1:0),m=1;m<s;m++)l[m-1]=arguments[m];return l.reduce((v,C)=>{const r=Object.entries(C);for(const[i,c]of r){const f=v[i];f!=null&&(v[i]=f+e*c)}return v},{...t})}}const Ut=Rn(1),Ds=Rn(-1);function El(e){return"clientX"in e&&"clientY"in e}function zr(e){if(!e)return!1;const{KeyboardEvent:t}=Je(e.target);return t&&e instanceof t}function kl(e){if(!e)return!1;const{TouchEvent:t}=Je(e.target);return t&&e instanceof t}function As(e){if(kl(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return El(e)?{x:e.clientX,y:e.clientY}:null}const os=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[os.Translate.toString(e),os.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:l}=e;return t+" "+s+"ms "+l}}}),fi="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Rl(e){return e.matches(fi)?e:e.querySelector(fi)}const Dl={display:"none"};function Al(e){let{id:t,value:s}=e;return ee.createElement("div",{id:t,style:Dl},s)}function jl(e){let{id:t,announcement:s,ariaLiveType:l="assertive"}=e;const m={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ee.createElement("div",{id:t,style:m,role:"status","aria-live":l,"aria-atomic":!0},s)}function Tl(){const[e,t]=k.useState("");return{announce:k.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const Dn=k.createContext(null);function Ll(e){const t=k.useContext(Dn);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ml(){const[e]=k.useState(()=>new Set),t=k.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[k.useCallback(l=>{let{type:m,event:v}=l;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,v)})},[e]),t]}const Nl={draggable:`
|
|
3
3
|
To pick up a draggable item, press the space bar.
|
|
4
4
|
While dragging, use the arrow keys to move the item.
|
|
5
5
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
6
|
-
`},Pl={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was moved over droppable area "+s.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was dropped over droppable area "+s.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Ol(e){let{announcements:t=Pl,container:s,hiddenTextDescribedById:l,screenReaderInstructions:m=Nl}=e;const{announce:v,announcement:C}=Tl(),r=Us("DndLiveRegion"),[i,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),Ll(k.useMemo(()=>({onDragStart(o){let{active:p}=o;v(t.onDragStart({active:p}))},onDragMove(o){let{active:p,over:x}=o;t.onDragMove&&v(t.onDragMove({active:p,over:x}))},onDragOver(o){let{active:p,over:x}=o;v(t.onDragOver({active:p,over:x}))},onDragEnd(o){let{active:p,over:x}=o;v(t.onDragEnd({active:p,over:x}))},onDragCancel(o){let{active:p,over:x}=o;v(t.onDragCancel({active:p,over:x}))}}),[v,t])),!i)return null;const f=ee.createElement(ee.Fragment,null,ee.createElement(Al,{id:l,value:m.draggable}),ee.createElement(jl,{id:r,announcement:C}));return s?Nt.createPortal(f,s):f}var Ue;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ue||(Ue={}));function js(){}function Bl(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Il(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return k.useMemo(()=>[...t].filter(l=>l!=null),[...t])}const ft=Object.freeze({x:0,y:0});function Fl(e,t){const s=As(e);if(!s)return"0 0";const l={x:(s.x-t.left)/t.width*100,y:(s.y-t.top)/t.height*100};return l.x+"% "+l.y+"%"}function Hl(e,t){let{data:{value:s}}=e,{data:{value:l}}=t;return l-s}function zl(e,t){if(!e||e.length===0)return null;const[s]=e;return s[t]}function Wl(e,t){const s=Math.max(t.top,e.top),l=Math.max(t.left,e.left),m=Math.min(t.left+t.width,e.left+e.width),v=Math.min(t.top+t.height,e.top+e.height),C=m-l,r=v-s;if(l<m&&s<v){const i=t.width*t.height,c=e.width*e.height,f=C*r,o=f/(i+c-f);return Number(o.toFixed(4))}return 0}const $l=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:l}=e;const m=[];for(const v of l){const{id:C}=v,r=s.get(C);if(r){const i=Wl(r,t);i>0&&m.push({id:C,data:{droppableContainer:v,value:i}})}}return m.sort(Hl)};function Ul(e,t,s){return{...e,scaleX:t&&s?t.width/s.width:1,scaleY:t&&s?t.height/s.height:1}}function An(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ft}function ql(e){return function(s){for(var l=arguments.length,m=new Array(l>1?l-1:0),v=1;v<l;v++)m[v-1]=arguments[v];return m.reduce((C,r)=>({...C,top:C.top+e*r.y,bottom:C.bottom+e*r.y,left:C.left+e*r.x,right:C.right+e*r.x}),{...s})}}const Kl=ql(1);function jn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Xl(e,t,s){const l=jn(t);if(!l)return e;const{scaleX:m,scaleY:v,x:C,y:r}=l,i=e.left-C-(1-m)*parseFloat(s),c=e.top-r-(1-v)*parseFloat(s.slice(s.indexOf(" ")+1)),f=m?e.width/m:e.width,o=v?e.height/v:e.height;return{width:f,height:o,top:c,right:i+f,bottom:c+o,left:i}}const Yl={ignoreTransform:!1};function us(e,t){t===void 0&&(t=Yl);let s=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:f}=Je(e).getComputedStyle(e);c&&(s=Xl(s,c,f))}const{top:l,left:m,width:v,height:C,bottom:r,right:i}=s;return{top:l,left:m,width:v,height:C,bottom:r,right:i}}function mi(e){return us(e,{ignoreTransform:!0})}function Vl(e){const t=e.innerWidth,s=e.innerHeight;return{top:0,left:0,right:t,bottom:s,width:t,height:s}}function Gl(e,t){return t===void 0&&(t=Je(e).getComputedStyle(e)),t.position==="fixed"}function Ql(e,t){t===void 0&&(t=Je(e).getComputedStyle(e));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(m=>{const v=t[m];return typeof v=="string"?s.test(v):!1})}function zr(e,t){const s=[];function l(m){if(t!=null&&s.length>=t||!m)return s;if(Fr(m)&&m.scrollingElement!=null&&!s.includes(m.scrollingElement))return s.push(m.scrollingElement),s;if(!cs(m)||kn(m)||s.includes(m))return s;const v=Je(e).getComputedStyle(m);return m!==e&&Ql(m,v)&&s.push(m),Gl(m,v)?s:l(m.parentNode)}return e?l(e):s}function Tn(e){const[t]=zr(e,1);return t??null}function rr(e){return!Ws||!e?null:Kt(e)?e:Ir(e)?Fr(e)||e===Xt(e).scrollingElement?window:cs(e)?e:null:null}function Ln(e){return Kt(e)?e.scrollX:e.scrollLeft}function Mn(e){return Kt(e)?e.scrollY:e.scrollTop}function Sr(e){return{x:Ln(e),y:Mn(e)}}var Ye;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ye||(Ye={}));function Nn(e){return!Ws||!e?!1:e===document.scrollingElement}function Pn(e){const t={x:0,y:0},s=Nn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},l={x:e.scrollWidth-s.width,y:e.scrollHeight-s.height},m=e.scrollTop<=t.y,v=e.scrollLeft<=t.x,C=e.scrollTop>=l.y,r=e.scrollLeft>=l.x;return{isTop:m,isLeft:v,isBottom:C,isRight:r,maxScroll:l,minScroll:t}}const Zl={x:.2,y:.2};function Jl(e,t,s,l,m){let{top:v,left:C,right:r,bottom:i}=s;l===void 0&&(l=10),m===void 0&&(m=Zl);const{isTop:c,isBottom:f,isLeft:o,isRight:p}=Pn(e),x={x:0,y:0},S={x:0,y:0},g={height:t.height*m.y,width:t.width*m.x};return!c&&v<=t.top+g.height?(x.y=Ye.Backward,S.y=l*Math.abs((t.top+g.height-v)/g.height)):!f&&i>=t.bottom-g.height&&(x.y=Ye.Forward,S.y=l*Math.abs((t.bottom-g.height-i)/g.height)),!p&&r>=t.right-g.width?(x.x=Ye.Forward,S.x=l*Math.abs((t.right-g.width-r)/g.width)):!o&&C<=t.left+g.width&&(x.x=Ye.Backward,S.x=l*Math.abs((t.left+g.width-C)/g.width)),{direction:x,speed:S}}function ec(e){if(e===document.scrollingElement){const{innerWidth:v,innerHeight:C}=window;return{top:0,left:0,right:v,bottom:C,width:v,height:C}}const{top:t,left:s,right:l,bottom:m}=e.getBoundingClientRect();return{top:t,left:s,right:l,bottom:m,width:e.clientWidth,height:e.clientHeight}}function On(e){return e.reduce((t,s)=>Ut(t,Sr(s)),ft)}function tc(e){return e.reduce((t,s)=>t+Ln(s),0)}function sc(e){return e.reduce((t,s)=>t+Mn(s),0)}function Bn(e,t){if(t===void 0&&(t=us),!e)return;const{top:s,left:l,bottom:m,right:v}=t(e);Tn(e)&&(m<=0||v<=0||s>=window.innerHeight||l>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rc=[["x",["left","right"],tc],["y",["top","bottom"],sc]];class Wr{constructor(t,s){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const l=zr(s),m=On(l);this.rect={...t},this.width=t.width,this.height=t.height;for(const[v,C,r]of rc)for(const i of C)Object.defineProperty(this,i,{get:()=>{const c=r(l),f=m[v]-c;return this.rect[i]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Zt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var l;return(l=this.target)==null?void 0:l.removeEventListener(...s)})},this.target=t}add(t,s,l){var m;(m=this.target)==null||m.addEventListener(t,s,l),this.listeners.push([t,s,l])}}function ic(e){const{EventTarget:t}=Je(e);return e instanceof t?e:Xt(e)}function ir(e,t){const s=Math.abs(e.x),l=Math.abs(e.y);return typeof t=="number"?Math.sqrt(s**2+l**2)>t:"x"in t&&"y"in t?s>t.x&&l>t.y:"x"in t?s>t.x:"y"in t?l>t.y:!1}var lt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(lt||(lt={}));function pi(e){e.preventDefault()}function nc(e){e.stopPropagation()}var we;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(we||(we={}));const In={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},oc=(e,t)=>{let{currentCoordinates:s}=t;switch(e.code){case we.Right:return{...s,x:s.x+25};case we.Left:return{...s,x:s.x-25};case we.Down:return{...s,y:s.y+25};case we.Up:return{...s,y:s.y-25}}};class Fn{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:s}}=t;this.props=t,this.listeners=new Zt(Xt(s)),this.windowListeners=new Zt(Je(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(lt.Resize,this.handleCancel),this.windowListeners.add(lt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(lt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:s}=this.props,l=t.node.current;l&&Bn(l),s(ft)}handleKeyDown(t){if(Hr(t)){const{active:s,context:l,options:m}=this.props,{keyboardCodes:v=In,coordinateGetter:C=oc,scrollBehavior:r="smooth"}=m,{code:i}=t;if(v.end.includes(i)){this.handleEnd(t);return}if(v.cancel.includes(i)){this.handleCancel(t);return}const{collisionRect:c}=l.current,f=c?{x:c.left,y:c.top}:ft;this.referenceCoordinates||(this.referenceCoordinates=f);const o=C(t,{active:s,context:l.current,currentCoordinates:f});if(o){const p=Ds(o,f),x={x:0,y:0},{scrollableAncestors:S}=l.current;for(const g of S){const n=t.code,{isTop:d,isRight:h,isLeft:u,isBottom:_,maxScroll:y,minScroll:w}=Pn(g),E=ec(g),b={x:Math.min(n===we.Right?E.right-E.width/2:E.right,Math.max(n===we.Right?E.left:E.left+E.width/2,o.x)),y:Math.min(n===we.Down?E.bottom-E.height/2:E.bottom,Math.max(n===we.Down?E.top:E.top+E.height/2,o.y))},R=n===we.Right&&!h||n===we.Left&&!u,j=n===we.Down&&!_||n===we.Up&&!d;if(R&&b.x!==o.x){const M=g.scrollLeft+p.x,L=n===we.Right&&M<=y.x||n===we.Left&&M>=w.x;if(L&&!p.y){g.scrollTo({left:M,behavior:r});return}L?x.x=g.scrollLeft-M:x.x=n===we.Right?g.scrollLeft-y.x:g.scrollLeft-w.x,x.x&&g.scrollBy({left:-x.x,behavior:r});break}else if(j&&b.y!==o.y){const M=g.scrollTop+p.y,L=n===we.Down&&M<=y.y||n===we.Up&&M>=w.y;if(L&&!p.x){g.scrollTo({top:M,behavior:r});return}L?x.y=g.scrollTop-M:x.y=n===we.Down?g.scrollTop-y.y:g.scrollTop-w.y,x.y&&g.scrollBy({top:-x.y,behavior:r});break}}this.handleMove(t,Ut(Ds(o,this.referenceCoordinates),x))}}}handleMove(t,s){const{onMove:l}=this.props;t.preventDefault(),l(s)}handleEnd(t){const{onEnd:s}=this.props;t.preventDefault(),this.detach(),s()}handleCancel(t){const{onCancel:s}=this.props;t.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Fn.activators=[{eventName:"onKeyDown",handler:(e,t,s)=>{let{keyboardCodes:l=In,onActivation:m}=t,{active:v}=s;const{code:C}=e.nativeEvent;if(l.start.includes(C)){const r=v.activatorNode.current;return r&&e.target!==r?!1:(e.preventDefault(),m?.({event:e.nativeEvent}),!0)}return!1}}];function vi(e){return!!(e&&"distance"in e)}function gi(e){return!!(e&&"delay"in e)}class $r{constructor(t,s,l){var m;l===void 0&&(l=ic(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=s;const{event:v}=t,{target:C}=v;this.props=t,this.events=s,this.document=Xt(C),this.documentListeners=new Zt(this.document),this.listeners=new Zt(l),this.windowListeners=new Zt(Je(C)),this.initialCoordinates=(m=As(v))!=null?m:ft,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:s,bypassActivationConstraint:l}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(lt.Resize,this.handleCancel),this.windowListeners.add(lt.DragStart,pi),this.windowListeners.add(lt.VisibilityChange,this.handleCancel),this.windowListeners.add(lt.ContextMenu,pi),this.documentListeners.add(lt.Keydown,this.handleKeydown),s){if(l!=null&&l({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gi(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(vi(s)){this.handlePending(s);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,s){const{active:l,onPending:m}=this.props;m(l,t,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:t}=this,{onStart:s}=this.props;t&&(this.activated=!0,this.documentListeners.add(lt.Click,nc,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(lt.SelectionChange,this.removeTextSelection),s(t))}handleMove(t){var s;const{activated:l,initialCoordinates:m,props:v}=this,{onMove:C,options:{activationConstraint:r}}=v;if(!m)return;const i=(s=As(t))!=null?s:ft,c=Ds(m,i);if(!l&&r){if(vi(r)){if(r.tolerance!=null&&ir(c,r.tolerance))return this.handleCancel();if(ir(c,r.distance))return this.handleStart()}if(gi(r)&&ir(c,r.tolerance))return this.handleCancel();this.handlePending(r,c);return}t.cancelable&&t.preventDefault(),C(i)}handleEnd(){const{onAbort:t,onEnd:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleCancel(){const{onAbort:t,onCancel:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleKeydown(t){t.code===we.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ac={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ur extends $r{constructor(t){const{event:s}=t,l=Xt(s.target);super(t,ac,l)}}Ur.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:l}=t;return!s.isPrimary||s.button!==0?!1:(l?.({event:s}),!0)}}];const lc={move:{name:"mousemove"},end:{name:"mouseup"}};var yr;(function(e){e[e.RightClick=2]="RightClick"})(yr||(yr={}));class cc extends $r{constructor(t){super(t,lc,Xt(t.event.target))}}cc.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:l}=t;return s.button===yr.RightClick?!1:(l?.({event:s}),!0)}}];const nr={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hc extends $r{constructor(t){super(t,nr)}static setup(){return window.addEventListener(nr.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(nr.move.name,t)};function t(){}}}hc.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:l}=t;const{touches:m}=s;return m.length>1?!1:(l?.({event:s}),!0)}}];var Jt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Jt||(Jt={}));var Ts;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ts||(Ts={}));function uc(e){let{acceleration:t,activator:s=Jt.Pointer,canScroll:l,draggingRect:m,enabled:v,interval:C=5,order:r=Ts.TreeOrder,pointerCoordinates:i,scrollableAncestors:c,scrollableAncestorRects:f,delta:o,threshold:p}=e;const x=fc({delta:o,disabled:!v}),[S,g]=wl(),n=k.useRef({x:0,y:0}),d=k.useRef({x:0,y:0}),h=k.useMemo(()=>{switch(s){case Jt.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case Jt.DraggableRect:return m}},[s,m,i]),u=k.useRef(null),_=k.useCallback(()=>{const w=u.current;if(!w)return;const E=n.current.x*d.current.x,b=n.current.y*d.current.y;w.scrollBy(E,b)},[]),y=k.useMemo(()=>r===Ts.TreeOrder?[...c].reverse():c,[r,c]);k.useEffect(()=>{if(!v||!c.length||!h){g();return}for(const w of y){if(l?.(w)===!1)continue;const E=c.indexOf(w),b=f[E];if(!b)continue;const{direction:R,speed:j}=Jl(w,b,h,t,p);for(const M of["x","y"])x[M][R[M]]||(j[M]=0,R[M]=0);if(j.x>0||j.y>0){g(),u.current=w,S(_,C),n.current=j,d.current=R;return}}n.current={x:0,y:0},d.current={x:0,y:0},g()},[t,_,l,g,v,C,JSON.stringify(h),JSON.stringify(x),S,c,y,f,JSON.stringify(p)])}const dc={x:{[Ye.Backward]:!1,[Ye.Forward]:!1},y:{[Ye.Backward]:!1,[Ye.Forward]:!1}};function fc(e){let{delta:t,disabled:s}=e;const l=Rs(t);return hs(m=>{if(s||!l||!m)return dc;const v={x:Math.sign(t.x-l.x),y:Math.sign(t.y-l.y)};return{x:{[Ye.Backward]:m.x[Ye.Backward]||v.x===-1,[Ye.Forward]:m.x[Ye.Forward]||v.x===1},y:{[Ye.Backward]:m.y[Ye.Backward]||v.y===-1,[Ye.Forward]:m.y[Ye.Forward]||v.y===1}}},[s,t,l])}function mc(e,t){const s=t!=null?e.get(t):void 0,l=s?s.node.current:null;return hs(m=>{var v;return t==null?null:(v=l??m)!=null?v:null},[l,t])}function pc(e,t){return k.useMemo(()=>e.reduce((s,l)=>{const{sensor:m}=l,v=m.activators.map(C=>({eventName:C.eventName,handler:t(C.handler,l)}));return[...s,...v]},[]),[e,t])}var as;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(as||(as={}));var Cr;(function(e){e.Optimized="optimized"})(Cr||(Cr={}));const _i=new Map;function vc(e,t){let{dragging:s,dependencies:l,config:m}=t;const[v,C]=k.useState(null),{frequency:r,measure:i,strategy:c}=m,f=k.useRef(e),o=n(),p=ns(o),x=k.useCallback(function(d){d===void 0&&(d=[]),!p.current&&C(h=>h===null?d:h.concat(d.filter(u=>!h.includes(u))))},[p]),S=k.useRef(null),g=hs(d=>{if(o&&!s)return _i;if(!d||d===_i||f.current!==e||v!=null){const h=new Map;for(let u of e){if(!u)continue;if(v&&v.length>0&&!v.includes(u.id)&&u.rect.current){h.set(u.id,u.rect.current);continue}const _=u.node.current,y=_?new Wr(i(_),_):null;u.rect.current=y,y&&h.set(u.id,y)}return h}return d},[e,v,s,o,i]);return k.useEffect(()=>{f.current=e},[e]),k.useEffect(()=>{o||x()},[s,o]),k.useEffect(()=>{v&&v.length>0&&C(null)},[JSON.stringify(v)]),k.useEffect(()=>{o||typeof r!="number"||S.current!==null||(S.current=setTimeout(()=>{x(),S.current=null},r))},[r,o,x,...l]),{droppableRects:g,measureDroppableContainers:x,measuringScheduled:v!=null};function n(){switch(c){case as.Always:return!1;case as.BeforeDragging:return s;default:return!s}}}function qr(e,t){return hs(s=>e?s||(typeof t=="function"?t(e):e):null,[t,e])}function gc(e,t){return qr(e,t)}function _c(e){let{callback:t,disabled:s}=e;const l=$s(t),m=k.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:v}=window;return new v(l)},[l,s]);return k.useEffect(()=>()=>m?.disconnect(),[m]),m}function qs(e){let{callback:t,disabled:s}=e;const l=$s(t),m=k.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:v}=window;return new v(l)},[s]);return k.useEffect(()=>()=>m?.disconnect(),[m]),m}function bc(e){return new Wr(us(e),e)}function bi(e,t,s){t===void 0&&(t=bc);const[l,m]=k.useState(null);function v(){m(i=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=i??s)!=null?c:null}const f=t(e);return JSON.stringify(i)===JSON.stringify(f)?i:f})}const C=_c({callback(i){if(e)for(const c of i){const{type:f,target:o}=c;if(f==="childList"&&o instanceof HTMLElement&&o.contains(e)){v();break}}}}),r=qs({callback:v});return bt(()=>{v(),e?(r?.observe(e),C?.observe(document.body,{childList:!0,subtree:!0})):(r?.disconnect(),C?.disconnect())},[e]),l}function xc(e){const t=qr(e);return An(e,t)}const xi=[];function Sc(e){const t=k.useRef(e),s=hs(l=>e?l&&l!==xi&&e&&t.current&&e.parentNode===t.current.parentNode?l:zr(e):xi,[e]);return k.useEffect(()=>{t.current=e},[e]),s}function yc(e){const[t,s]=k.useState(null),l=k.useRef(e),m=k.useCallback(v=>{const C=rr(v.target);C&&s(r=>r?(r.set(C,Sr(C)),new Map(r)):null)},[]);return k.useEffect(()=>{const v=l.current;if(e!==v){C(v);const r=e.map(i=>{const c=rr(i);return c?(c.addEventListener("scroll",m,{passive:!0}),[c,Sr(c)]):null}).filter(i=>i!=null);s(r.length?new Map(r):null),l.current=e}return()=>{C(e),C(v)};function C(r){r.forEach(i=>{const c=rr(i);c?.removeEventListener("scroll",m)})}},[m,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((v,C)=>Ut(v,C),ft):On(e):ft,[e,t])}function Si(e,t){t===void 0&&(t=[]);const s=k.useRef(null);return k.useEffect(()=>{s.current=null},t),k.useEffect(()=>{const l=e!==ft;l&&!s.current&&(s.current=e),!l&&s.current&&(s.current=null)},[e]),s.current?Ds(e,s.current):ft}function Cc(e){k.useEffect(()=>{if(!Ws)return;const t=e.map(s=>{let{sensor:l}=s;return l.setup==null?void 0:l.setup()});return()=>{for(const s of t)s?.()}},e.map(t=>{let{sensor:s}=t;return s}))}function wc(e,t){return k.useMemo(()=>e.reduce((s,l)=>{let{eventName:m,handler:v}=l;return s[m]=C=>{v(C,t)},s},{}),[e,t])}function Hn(e){return k.useMemo(()=>e?Vl(e):null,[e])}const yi=[];function Ec(e,t){t===void 0&&(t=us);const[s]=e,l=Hn(s?Je(s):null),[m,v]=k.useState(yi);function C(){v(()=>e.length?e.map(i=>Nn(i)?l:new Wr(t(i),i)):yi)}const r=qs({callback:C});return bt(()=>{r?.disconnect(),C(),e.forEach(i=>r?.observe(i))},[e]),m}function zn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return cs(t)?t:e}function kc(e){let{measure:t}=e;const[s,l]=k.useState(null),m=k.useCallback(c=>{for(const{target:f}of c)if(cs(f)){l(o=>{const p=t(f);return o?{...o,width:p.width,height:p.height}:p});break}},[t]),v=qs({callback:m}),C=k.useCallback(c=>{const f=zn(c);v?.disconnect(),f&&v?.observe(f),l(f?t(f):null)},[t,v]),[r,i]=ks(C);return k.useMemo(()=>({nodeRef:r,rect:s,setRef:i}),[s,r,i])}const Rc=[{sensor:Ur,options:{}},{sensor:Fn,options:{}}],Dc={current:{}},Cs={draggable:{measure:mi},droppable:{measure:mi,strategy:as.WhileDragging,frequency:Cr.Optimized},dragOverlay:{measure:us}};class es extends Map{get(t){var s;return t!=null&&(s=super.get(t))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:s}=t;return!s})}getNodeFor(t){var s,l;return(s=(l=this.get(t))==null?void 0:l.node.current)!=null?s:void 0}}const Ac={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new es,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:js},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Cs,measureDroppableContainers:js,windowRect:null,measuringScheduled:!1},Wn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:js,draggableNodes:new Map,over:null,measureDroppableContainers:js},ds=k.createContext(Wn),$n=k.createContext(Ac);function jc(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new es}}}function Tc(e,t){switch(t.type){case Ue.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ue.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ue.DragEnd:case Ue.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ue.RegisterDroppable:{const{element:s}=t,{id:l}=s,m=new es(e.droppable.containers);return m.set(l,s),{...e,droppable:{...e.droppable,containers:m}}}case Ue.SetDroppableDisabled:{const{id:s,key:l,disabled:m}=t,v=e.droppable.containers.get(s);if(!v||l!==v.key)return e;const C=new es(e.droppable.containers);return C.set(s,{...v,disabled:m}),{...e,droppable:{...e.droppable,containers:C}}}case Ue.UnregisterDroppable:{const{id:s,key:l}=t,m=e.droppable.containers.get(s);if(!m||l!==m.key)return e;const v=new es(e.droppable.containers);return v.delete(s),{...e,droppable:{...e.droppable,containers:v}}}default:return e}}function Lc(e){let{disabled:t}=e;const{active:s,activatorEvent:l,draggableNodes:m}=k.useContext(ds),v=Rs(l),C=Rs(s?.id);return k.useEffect(()=>{if(!t&&!l&&v&&C!=null){if(!Hr(v)||document.activeElement===v.target)return;const r=m.get(C);if(!r)return;const{activatorNode:i,node:c}=r;if(!i.current&&!c.current)return;requestAnimationFrame(()=>{for(const f of[i.current,c.current]){if(!f)continue;const o=Rl(f);if(o){o.focus();break}}})}},[l,t,m,C,v]),null}function Un(e,t){let{transform:s,...l}=t;return e!=null&&e.length?e.reduce((m,v)=>v({transform:m,...l}),s):s}function Mc(e){return k.useMemo(()=>({draggable:{...Cs.draggable,...e?.draggable},droppable:{...Cs.droppable,...e?.droppable},dragOverlay:{...Cs.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Nc(e){let{activeNode:t,measure:s,initialRect:l,config:m=!0}=e;const v=k.useRef(!1),{x:C,y:r}=typeof m=="boolean"?{x:m,y:m}:m;bt(()=>{if(!C&&!r||!t){v.current=!1;return}if(v.current||!l)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const f=s(c),o=An(f,l);if(C||(o.x=0),r||(o.y=0),v.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const p=Tn(c);p&&p.scrollBy({top:o.y,left:o.x})}},[t,C,r,l,s])}const Ks=k.createContext({...ft,scaleX:1,scaleY:1});var Ct;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ct||(Ct={}));const Pc=k.memo(function(t){var s,l,m,v;let{id:C,accessibility:r,autoScroll:i=!0,children:c,sensors:f=Rc,collisionDetection:o=$l,measuring:p,modifiers:x,...S}=t;const g=k.useReducer(Tc,void 0,jc),[n,d]=g,[h,u]=Ml(),[_,y]=k.useState(Ct.Uninitialized),w=_===Ct.Initialized,{draggable:{active:E,nodes:b,translate:R},droppable:{containers:j}}=n,M=E!=null?b.get(E):null,L=k.useRef({initial:null,translated:null}),T=k.useMemo(()=>{var je;return E!=null?{id:E,data:(je=M?.data)!=null?je:Dc,rect:L}:null},[E,M]),B=k.useRef(null),[I,H]=k.useState(null),[W,A]=k.useState(null),N=ns(S,Object.values(S)),P=Us("DndDescribedBy",C),O=k.useMemo(()=>j.getEnabled(),[j]),$=Mc(p),{droppableRects:X,measureDroppableContainers:K,measuringScheduled:Q}=vc(O,{dragging:w,dependencies:[R.x,R.y],config:$.droppable}),se=mc(b,E),D=k.useMemo(()=>W?As(W):null,[W]),F=Ht(),U=gc(se,$.draggable.measure);Nc({activeNode:E!=null?b.get(E):null,config:F.layoutShiftCompensation,initialRect:U,measure:$.draggable.measure});const z=bi(se,$.draggable.measure,U),te=bi(se?se.parentElement:null),Y=k.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=j.getNodeFor((s=Y.current.over)==null?void 0:s.id),ge=kc({measure:$.dragOverlay.measure}),me=(l=ge.nodeRef.current)!=null?l:se,Me=w?(m=ge.rect)!=null?m:z:null,re=!!(ge.nodeRef.current&&ge.rect),Be=xc(re?null:z),Ce=Hn(me?Je(me):null),oe=Sc(w?ie??se:null),Ne=Ec(oe),qe=Un(x,{transform:{x:R.x-Be.x,y:R.y-Be.y,scaleX:1,scaleY:1},activatorEvent:W,active:T,activeNodeRect:z,containerNodeRect:te,draggingNodeRect:Me,over:Y.current.over,overlayNodeRect:ge.rect,scrollableAncestors:oe,scrollableAncestorRects:Ne,windowRect:Ce}),Re=D?Ut(D,R):null,Ve=yc(oe),be=Si(Ve),st=Si(Ve,[z]),Ke=Ut(qe,be),Pe=Me?Kl(Me,qe):null,Oe=T&&Pe?o({active:T,collisionRect:Pe,droppableRects:X,droppableContainers:O,pointerCoordinates:Re}):null,De=zl(Oe,"id"),[V,Z]=k.useState(null),xe=re?qe:Ut(qe,st),Se=Ul(xe,(v=V?.rect)!=null?v:null,z),He=k.useRef(null),Xe=k.useCallback((je,q)=>{let{sensor:J,options:he}=q;if(B.current==null)return;const ue=b.get(B.current);if(!ue)return;const ve=je.nativeEvent,Ae=new J({active:B.current,activeNode:ue,event:ve,options:he,context:Y,onAbort(Fe){if(!b.get(Fe))return;const{onDragAbort:tt}=N.current,at={id:Fe};tt?.(at),h({type:"onDragAbort",event:at})},onPending(Fe,ot,tt,at){if(!b.get(Fe))return;const{onDragPending:Tt}=N.current,pt={id:Fe,constraint:ot,initialCoordinates:tt,offset:at};Tt?.(pt),h({type:"onDragPending",event:pt})},onStart(Fe){const ot=B.current;if(ot==null)return;const tt=b.get(ot);if(!tt)return;const{onDragStart:at}=N.current,jt={activatorEvent:ve,active:{id:ot,data:tt.data,rect:L}};Nt.unstable_batchedUpdates(()=>{at?.(jt),y(Ct.Initializing),d({type:Ue.DragStart,initialCoordinates:Fe,active:ot}),h({type:"onDragStart",event:jt}),H(He.current),A(ve)})},onMove(Fe){d({type:Ue.DragMove,coordinates:Fe})},onEnd:mt(Ue.DragEnd),onCancel:mt(Ue.DragCancel)});He.current=Ae;function mt(Fe){return async function(){const{active:tt,collisions:at,over:jt,scrollAdjustedTranslate:Tt}=Y.current;let pt=null;if(tt&&Tt){const{cancelDrop:St}=N.current;pt={activatorEvent:ve,active:tt,collisions:at,delta:Tt,over:jt},Fe===Ue.DragEnd&&typeof St=="function"&&await Promise.resolve(St(pt))&&(Fe=Ue.DragCancel)}B.current=null,Nt.unstable_batchedUpdates(()=>{d({type:Fe}),y(Ct.Uninitialized),Z(null),H(null),A(null),He.current=null;const St=Fe===Ue.DragEnd?"onDragEnd":"onDragCancel";if(pt){const Lt=N.current[St];Lt?.(pt),h({type:St,event:pt})}})}}},[b]),pe=k.useCallback((je,q)=>(J,he)=>{const ue=J.nativeEvent,ve=b.get(he);if(B.current!==null||!ve||ue.dndKit||ue.defaultPrevented)return;const Ae={active:ve};je(J,q.options,Ae)===!0&&(ue.dndKit={capturedBy:q.sensor},B.current=he,Xe(J,q))},[b,Xe]),et=pc(f,pe);Cc(f),bt(()=>{z&&_===Ct.Initializing&&y(Ct.Initialized)},[z,_]),k.useEffect(()=>{const{onDragMove:je}=N.current,{active:q,activatorEvent:J,collisions:he,over:ue}=Y.current;if(!q||!J)return;const ve={active:q,activatorEvent:J,collisions:he,delta:{x:Ke.x,y:Ke.y},over:ue};Nt.unstable_batchedUpdates(()=>{je?.(ve),h({type:"onDragMove",event:ve})})},[Ke.x,Ke.y]),k.useEffect(()=>{const{active:je,activatorEvent:q,collisions:J,droppableContainers:he,scrollAdjustedTranslate:ue}=Y.current;if(!je||B.current==null||!q||!ue)return;const{onDragOver:ve}=N.current,Ae=he.get(De),mt=Ae&&Ae.rect.current?{id:Ae.id,rect:Ae.rect.current,data:Ae.data,disabled:Ae.disabled}:null,Fe={active:je,activatorEvent:q,collisions:J,delta:{x:ue.x,y:ue.y},over:mt};Nt.unstable_batchedUpdates(()=>{Z(mt),ve?.(Fe),h({type:"onDragOver",event:Fe})})},[De]),bt(()=>{Y.current={activatorEvent:W,active:T,activeNode:se,collisionRect:Pe,collisions:Oe,droppableRects:X,draggableNodes:b,draggingNode:me,draggingNodeRect:Me,droppableContainers:j,over:V,scrollableAncestors:oe,scrollAdjustedTranslate:Ke},L.current={initial:Me,translated:Pe}},[T,se,Oe,Pe,b,me,Me,X,j,V,oe,Ke]),uc({...F,delta:R,draggingRect:Pe,pointerCoordinates:Re,scrollableAncestors:oe,scrollableAncestorRects:Ne});const Ge=k.useMemo(()=>({active:T,activeNode:se,activeNodeRect:z,activatorEvent:W,collisions:Oe,containerNodeRect:te,dragOverlay:ge,draggableNodes:b,droppableContainers:j,droppableRects:X,over:V,measureDroppableContainers:K,scrollableAncestors:oe,scrollableAncestorRects:Ne,measuringConfiguration:$,measuringScheduled:Q,windowRect:Ce}),[T,se,z,W,Oe,te,ge,b,j,X,V,K,oe,Ne,$,Q,Ce]),nt=k.useMemo(()=>({activatorEvent:W,activators:et,active:T,activeNodeRect:z,ariaDescribedById:{draggable:P},dispatch:d,draggableNodes:b,over:V,measureDroppableContainers:K}),[W,et,T,z,d,P,b,V,K]);return ee.createElement(Dn.Provider,{value:u},ee.createElement(ds.Provider,{value:nt},ee.createElement($n.Provider,{value:Ge},ee.createElement(Ks.Provider,{value:Se},c)),ee.createElement(Lc,{disabled:r?.restoreFocus===!1})),ee.createElement(Ol,{...r,hiddenTextDescribedById:P}));function Ht(){const je=I?.autoScrollEnabled===!1,q=typeof i=="object"?i.enabled===!1:i===!1,J=w&&!je&&!q;return typeof i=="object"?{...i,enabled:J}:{enabled:J}}}),Oc=k.createContext(null),Ci="button",Bc="Draggable";function Ic(e){let{id:t,data:s,disabled:l=!1,attributes:m}=e;const v=Us(Bc),{activators:C,activatorEvent:r,active:i,activeNodeRect:c,ariaDescribedById:f,draggableNodes:o,over:p}=k.useContext(ds),{role:x=Ci,roleDescription:S="draggable",tabIndex:g=0}=m??{},n=i?.id===t,d=k.useContext(n?Ks:Oc),[h,u]=ks(),[_,y]=ks(),w=wc(C,t),E=ns(s);bt(()=>(o.set(t,{id:t,key:v,node:h,activatorNode:_,data:E}),()=>{const R=o.get(t);R&&R.key===v&&o.delete(t)}),[o,t]);const b=k.useMemo(()=>({role:x,tabIndex:g,"aria-disabled":l,"aria-pressed":n&&x===Ci?!0:void 0,"aria-roledescription":S,"aria-describedby":f.draggable}),[l,x,g,n,S,f.draggable]);return{active:i,activatorEvent:r,activeNodeRect:c,attributes:b,isDragging:n,listeners:l?void 0:w,node:h,over:p,setNodeRef:u,setActivatorNodeRef:y,transform:d}}function Fc(){return k.useContext($n)}const Hc="Droppable",zc={timeout:25};function Wc(e){let{data:t,disabled:s=!1,id:l,resizeObserverConfig:m}=e;const v=Us(Hc),{active:C,dispatch:r,over:i,measureDroppableContainers:c}=k.useContext(ds),f=k.useRef({disabled:s}),o=k.useRef(!1),p=k.useRef(null),x=k.useRef(null),{disabled:S,updateMeasurementsFor:g,timeout:n}={...zc,...m},d=ns(g??l),h=k.useCallback(()=>{if(!o.current){o.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{c(Array.isArray(d.current)?d.current:[d.current]),x.current=null},n)},[n]),u=qs({callback:h,disabled:S||!C}),_=k.useCallback((b,R)=>{u&&(R&&(u.unobserve(R),o.current=!1),b&&u.observe(b))},[u]),[y,w]=ks(_),E=ns(t);return k.useEffect(()=>{!u||!y.current||(u.disconnect(),o.current=!1,u.observe(y.current))},[y,u]),k.useEffect(()=>(r({type:Ue.RegisterDroppable,element:{id:l,key:v,disabled:s,node:y,rect:p,data:E}}),()=>r({type:Ue.UnregisterDroppable,key:v,id:l})),[l]),k.useEffect(()=>{s!==f.current.disabled&&(r({type:Ue.SetDroppableDisabled,id:l,key:v,disabled:s}),f.current.disabled=s)},[l,v,s,r]),{active:C,rect:p,isOver:i?.id===l,node:y,over:i,setNodeRef:w}}function $c(e){let{animation:t,children:s}=e;const[l,m]=k.useState(null),[v,C]=k.useState(null),r=Rs(s);return!s&&!l&&r&&m(r),bt(()=>{if(!v)return;const i=l?.key,c=l?.props.id;if(i==null||c==null){m(null);return}Promise.resolve(t(c,v)).then(()=>{m(null)})},[t,l,v]),ee.createElement(ee.Fragment,null,s,l?k.cloneElement(l,{ref:C}):null)}const Uc={x:0,y:0,scaleX:1,scaleY:1};function qc(e){let{children:t}=e;return ee.createElement(ds.Provider,{value:Wn},ee.createElement(Ks.Provider,{value:Uc},t))}const Kc={position:"fixed",touchAction:"none"},Xc=e=>Hr(e)?"transform 250ms ease":void 0,Yc=k.forwardRef((e,t)=>{let{as:s,activatorEvent:l,adjustScale:m,children:v,className:C,rect:r,style:i,transform:c,transition:f=Xc}=e;if(!r)return null;const o=m?c:{...c,scaleX:1,scaleY:1},p={...Kc,width:r.width,height:r.height,top:r.top,left:r.left,transform:os.Transform.toString(o),transformOrigin:m&&l?Fl(l,r):void 0,transition:typeof f=="function"?f(l):f,...i};return ee.createElement(s,{className:C,style:p,ref:t},v)}),Vc=e=>t=>{let{active:s,dragOverlay:l}=t;const m={},{styles:v,className:C}=e;if(v!=null&&v.active)for(const[r,i]of Object.entries(v.active))i!==void 0&&(m[r]=s.node.style.getPropertyValue(r),s.node.style.setProperty(r,i));if(v!=null&&v.dragOverlay)for(const[r,i]of Object.entries(v.dragOverlay))i!==void 0&&l.node.style.setProperty(r,i);return C!=null&&C.active&&s.node.classList.add(C.active),C!=null&&C.dragOverlay&&l.node.classList.add(C.dragOverlay),function(){for(const[i,c]of Object.entries(m))s.node.style.setProperty(i,c);C!=null&&C.active&&s.node.classList.remove(C.active)}},Gc=e=>{let{transform:{initial:t,final:s}}=e;return[{transform:os.Transform.toString(t)},{transform:os.Transform.toString(s)}]},Qc={duration:250,easing:"ease",keyframes:Gc,sideEffects:Vc({styles:{active:{opacity:"0"}}})};function Zc(e){let{config:t,draggableNodes:s,droppableContainers:l,measuringConfiguration:m}=e;return $s((v,C)=>{if(t===null)return;const r=s.get(v);if(!r)return;const i=r.node.current;if(!i)return;const c=zn(C);if(!c)return;const{transform:f}=Je(C).getComputedStyle(C),o=jn(f);if(!o)return;const p=typeof t=="function"?t:Jc(t);return Bn(i,m.draggable.measure),p({active:{id:v,data:r.data,node:i,rect:m.draggable.measure(i)},draggableNodes:s,dragOverlay:{node:C,rect:m.dragOverlay.measure(c)},droppableContainers:l,measuringConfiguration:m,transform:o})})}function Jc(e){const{duration:t,easing:s,sideEffects:l,keyframes:m}={...Qc,...e};return v=>{let{active:C,dragOverlay:r,transform:i,...c}=v;if(!t)return;const f={x:r.rect.left-C.rect.left,y:r.rect.top-C.rect.top},o={scaleX:i.scaleX!==1?C.rect.width*i.scaleX/r.rect.width:1,scaleY:i.scaleY!==1?C.rect.height*i.scaleY/r.rect.height:1},p={x:i.x-f.x,y:i.y-f.y,...o},x=m({...c,active:C,dragOverlay:r,transform:{initial:i,final:p}}),[S]=x,g=x[x.length-1];if(JSON.stringify(S)===JSON.stringify(g))return;const n=l?.({active:C,dragOverlay:r,...c}),d=r.node.animate(x,{duration:t,easing:s,fill:"forwards"});return new Promise(h=>{d.onfinish=()=>{n?.(),h()}})}}let wi=0;function eh(e){return k.useMemo(()=>{if(e!=null)return wi++,wi},[e])}const th=ee.memo(e=>{let{adjustScale:t=!1,children:s,dropAnimation:l,style:m,transition:v,modifiers:C,wrapperElement:r="div",className:i,zIndex:c=999}=e;const{activatorEvent:f,active:o,activeNodeRect:p,containerNodeRect:x,draggableNodes:S,droppableContainers:g,dragOverlay:n,over:d,measuringConfiguration:h,scrollableAncestors:u,scrollableAncestorRects:_,windowRect:y}=Fc(),w=k.useContext(Ks),E=eh(o?.id),b=Un(C,{activatorEvent:f,active:o,activeNodeRect:p,containerNodeRect:x,draggingNodeRect:n.rect,over:d,overlayNodeRect:n.rect,scrollableAncestors:u,scrollableAncestorRects:_,transform:w,windowRect:y}),R=qr(p),j=Zc({config:l,draggableNodes:S,droppableContainers:g,measuringConfiguration:h}),M=R?n.setRef:void 0;return ee.createElement(qc,null,ee.createElement($c,{animation:j},o&&E?ee.createElement(Yc,{key:E,id:o.id,ref:M,as:r,activatorEvent:f,adjustScale:t,className:i,transition:v,rect:R,style:{zIndex:c,...m},transform:b},s):null))}),le={Review:"Review",Running:"Running",Pending:"Pending",Done:"Done",Cancelled:"Cancelled"},sh=[{status:le.Review,label:"Review",icon:Tr,color:"text-amber-600"},{status:le.Running,label:"Running",icon:Lr,color:"text-blue-600"},{status:le.Pending,label:"Pending",icon:Mr,color:"text-neutral-600"},{status:le.Done,label:"Done",icon:Nr,color:"text-emerald-600"},{status:le.Cancelled,label:"Cancelled",icon:Pr,color:"text-neutral-500"}];function rh({task:e,status:t,isSelected:s,isAgentActive:l,project:m,onSelectTask:v,onTaskStatusChange:C,onDeleteTask:r}){const{t:i}=ce(),c=!!e.projectArchivedAt,{attributes:f,listeners:o,setNodeRef:p,isDragging:x}=Ic({id:e.id,data:{task:e,fromStatus:t},disabled:c}),[S,g]=k.useState(null),n=k.useRef(null),d=k.useCallback(h=>{c||!C&&!r||(h.preventDefault(),g({x:h.clientX,y:h.clientY}))},[c,C,r]);return k.useEffect(()=>{if(!S)return;const h=u=>{n.current&&!n.current.contains(u.target)&&g(null)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[S]),a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:p,onClick:()=>v(e.id),onContextMenu:d,className:`flex items-start pl-8 pr-4 py-2 text-sm w-full text-left transition-all border-l-2 group
|
|
6
|
+
`},Pl={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was moved over droppable area "+s.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was dropped over droppable area "+s.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Ol(e){let{announcements:t=Pl,container:s,hiddenTextDescribedById:l,screenReaderInstructions:m=Nl}=e;const{announce:v,announcement:C}=Tl(),r=Us("DndLiveRegion"),[i,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),Ll(k.useMemo(()=>({onDragStart(o){let{active:p}=o;v(t.onDragStart({active:p}))},onDragMove(o){let{active:p,over:x}=o;t.onDragMove&&v(t.onDragMove({active:p,over:x}))},onDragOver(o){let{active:p,over:x}=o;v(t.onDragOver({active:p,over:x}))},onDragEnd(o){let{active:p,over:x}=o;v(t.onDragEnd({active:p,over:x}))},onDragCancel(o){let{active:p,over:x}=o;v(t.onDragCancel({active:p,over:x}))}}),[v,t])),!i)return null;const f=ee.createElement(ee.Fragment,null,ee.createElement(Al,{id:l,value:m.draggable}),ee.createElement(jl,{id:r,announcement:C}));return s?Nt.createPortal(f,s):f}var Ue;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ue||(Ue={}));function js(){}function Bl(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Il(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return k.useMemo(()=>[...t].filter(l=>l!=null),[...t])}const ft=Object.freeze({x:0,y:0});function Fl(e,t){const s=As(e);if(!s)return"0 0";const l={x:(s.x-t.left)/t.width*100,y:(s.y-t.top)/t.height*100};return l.x+"% "+l.y+"%"}function Hl(e,t){let{data:{value:s}}=e,{data:{value:l}}=t;return l-s}function zl(e,t){if(!e||e.length===0)return null;const[s]=e;return s[t]}function Wl(e,t){const s=Math.max(t.top,e.top),l=Math.max(t.left,e.left),m=Math.min(t.left+t.width,e.left+e.width),v=Math.min(t.top+t.height,e.top+e.height),C=m-l,r=v-s;if(l<m&&s<v){const i=t.width*t.height,c=e.width*e.height,f=C*r,o=f/(i+c-f);return Number(o.toFixed(4))}return 0}const $l=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:l}=e;const m=[];for(const v of l){const{id:C}=v,r=s.get(C);if(r){const i=Wl(r,t);i>0&&m.push({id:C,data:{droppableContainer:v,value:i}})}}return m.sort(Hl)};function Ul(e,t,s){return{...e,scaleX:t&&s?t.width/s.width:1,scaleY:t&&s?t.height/s.height:1}}function An(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ft}function ql(e){return function(s){for(var l=arguments.length,m=new Array(l>1?l-1:0),v=1;v<l;v++)m[v-1]=arguments[v];return m.reduce((C,r)=>({...C,top:C.top+e*r.y,bottom:C.bottom+e*r.y,left:C.left+e*r.x,right:C.right+e*r.x}),{...s})}}const Kl=ql(1);function jn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Xl(e,t,s){const l=jn(t);if(!l)return e;const{scaleX:m,scaleY:v,x:C,y:r}=l,i=e.left-C-(1-m)*parseFloat(s),c=e.top-r-(1-v)*parseFloat(s.slice(s.indexOf(" ")+1)),f=m?e.width/m:e.width,o=v?e.height/v:e.height;return{width:f,height:o,top:c,right:i+f,bottom:c+o,left:i}}const Yl={ignoreTransform:!1};function us(e,t){t===void 0&&(t=Yl);let s=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:f}=Je(e).getComputedStyle(e);c&&(s=Xl(s,c,f))}const{top:l,left:m,width:v,height:C,bottom:r,right:i}=s;return{top:l,left:m,width:v,height:C,bottom:r,right:i}}function mi(e){return us(e,{ignoreTransform:!0})}function Vl(e){const t=e.innerWidth,s=e.innerHeight;return{top:0,left:0,right:t,bottom:s,width:t,height:s}}function Gl(e,t){return t===void 0&&(t=Je(e).getComputedStyle(e)),t.position==="fixed"}function Ql(e,t){t===void 0&&(t=Je(e).getComputedStyle(e));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(m=>{const v=t[m];return typeof v=="string"?s.test(v):!1})}function Wr(e,t){const s=[];function l(m){if(t!=null&&s.length>=t||!m)return s;if(Hr(m)&&m.scrollingElement!=null&&!s.includes(m.scrollingElement))return s.push(m.scrollingElement),s;if(!cs(m)||kn(m)||s.includes(m))return s;const v=Je(e).getComputedStyle(m);return m!==e&&Ql(m,v)&&s.push(m),Gl(m,v)?s:l(m.parentNode)}return e?l(e):s}function Tn(e){const[t]=Wr(e,1);return t??null}function ir(e){return!Ws||!e?null:Kt(e)?e:Fr(e)?Hr(e)||e===Xt(e).scrollingElement?window:cs(e)?e:null:null}function Ln(e){return Kt(e)?e.scrollX:e.scrollLeft}function Mn(e){return Kt(e)?e.scrollY:e.scrollTop}function yr(e){return{x:Ln(e),y:Mn(e)}}var Ye;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ye||(Ye={}));function Nn(e){return!Ws||!e?!1:e===document.scrollingElement}function Pn(e){const t={x:0,y:0},s=Nn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},l={x:e.scrollWidth-s.width,y:e.scrollHeight-s.height},m=e.scrollTop<=t.y,v=e.scrollLeft<=t.x,C=e.scrollTop>=l.y,r=e.scrollLeft>=l.x;return{isTop:m,isLeft:v,isBottom:C,isRight:r,maxScroll:l,minScroll:t}}const Zl={x:.2,y:.2};function Jl(e,t,s,l,m){let{top:v,left:C,right:r,bottom:i}=s;l===void 0&&(l=10),m===void 0&&(m=Zl);const{isTop:c,isBottom:f,isLeft:o,isRight:p}=Pn(e),x={x:0,y:0},S={x:0,y:0},g={height:t.height*m.y,width:t.width*m.x};return!c&&v<=t.top+g.height?(x.y=Ye.Backward,S.y=l*Math.abs((t.top+g.height-v)/g.height)):!f&&i>=t.bottom-g.height&&(x.y=Ye.Forward,S.y=l*Math.abs((t.bottom-g.height-i)/g.height)),!p&&r>=t.right-g.width?(x.x=Ye.Forward,S.x=l*Math.abs((t.right-g.width-r)/g.width)):!o&&C<=t.left+g.width&&(x.x=Ye.Backward,S.x=l*Math.abs((t.left+g.width-C)/g.width)),{direction:x,speed:S}}function ec(e){if(e===document.scrollingElement){const{innerWidth:v,innerHeight:C}=window;return{top:0,left:0,right:v,bottom:C,width:v,height:C}}const{top:t,left:s,right:l,bottom:m}=e.getBoundingClientRect();return{top:t,left:s,right:l,bottom:m,width:e.clientWidth,height:e.clientHeight}}function On(e){return e.reduce((t,s)=>Ut(t,yr(s)),ft)}function tc(e){return e.reduce((t,s)=>t+Ln(s),0)}function sc(e){return e.reduce((t,s)=>t+Mn(s),0)}function Bn(e,t){if(t===void 0&&(t=us),!e)return;const{top:s,left:l,bottom:m,right:v}=t(e);Tn(e)&&(m<=0||v<=0||s>=window.innerHeight||l>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rc=[["x",["left","right"],tc],["y",["top","bottom"],sc]];class $r{constructor(t,s){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const l=Wr(s),m=On(l);this.rect={...t},this.width=t.width,this.height=t.height;for(const[v,C,r]of rc)for(const i of C)Object.defineProperty(this,i,{get:()=>{const c=r(l),f=m[v]-c;return this.rect[i]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Zt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var l;return(l=this.target)==null?void 0:l.removeEventListener(...s)})},this.target=t}add(t,s,l){var m;(m=this.target)==null||m.addEventListener(t,s,l),this.listeners.push([t,s,l])}}function ic(e){const{EventTarget:t}=Je(e);return e instanceof t?e:Xt(e)}function nr(e,t){const s=Math.abs(e.x),l=Math.abs(e.y);return typeof t=="number"?Math.sqrt(s**2+l**2)>t:"x"in t&&"y"in t?s>t.x&&l>t.y:"x"in t?s>t.x:"y"in t?l>t.y:!1}var lt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(lt||(lt={}));function pi(e){e.preventDefault()}function nc(e){e.stopPropagation()}var we;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(we||(we={}));const In={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},oc=(e,t)=>{let{currentCoordinates:s}=t;switch(e.code){case we.Right:return{...s,x:s.x+25};case we.Left:return{...s,x:s.x-25};case we.Down:return{...s,y:s.y+25};case we.Up:return{...s,y:s.y-25}}};class Fn{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:s}}=t;this.props=t,this.listeners=new Zt(Xt(s)),this.windowListeners=new Zt(Je(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(lt.Resize,this.handleCancel),this.windowListeners.add(lt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(lt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:s}=this.props,l=t.node.current;l&&Bn(l),s(ft)}handleKeyDown(t){if(zr(t)){const{active:s,context:l,options:m}=this.props,{keyboardCodes:v=In,coordinateGetter:C=oc,scrollBehavior:r="smooth"}=m,{code:i}=t;if(v.end.includes(i)){this.handleEnd(t);return}if(v.cancel.includes(i)){this.handleCancel(t);return}const{collisionRect:c}=l.current,f=c?{x:c.left,y:c.top}:ft;this.referenceCoordinates||(this.referenceCoordinates=f);const o=C(t,{active:s,context:l.current,currentCoordinates:f});if(o){const p=Ds(o,f),x={x:0,y:0},{scrollableAncestors:S}=l.current;for(const g of S){const n=t.code,{isTop:d,isRight:h,isLeft:u,isBottom:_,maxScroll:y,minScroll:w}=Pn(g),E=ec(g),b={x:Math.min(n===we.Right?E.right-E.width/2:E.right,Math.max(n===we.Right?E.left:E.left+E.width/2,o.x)),y:Math.min(n===we.Down?E.bottom-E.height/2:E.bottom,Math.max(n===we.Down?E.top:E.top+E.height/2,o.y))},R=n===we.Right&&!h||n===we.Left&&!u,j=n===we.Down&&!_||n===we.Up&&!d;if(R&&b.x!==o.x){const M=g.scrollLeft+p.x,L=n===we.Right&&M<=y.x||n===we.Left&&M>=w.x;if(L&&!p.y){g.scrollTo({left:M,behavior:r});return}L?x.x=g.scrollLeft-M:x.x=n===we.Right?g.scrollLeft-y.x:g.scrollLeft-w.x,x.x&&g.scrollBy({left:-x.x,behavior:r});break}else if(j&&b.y!==o.y){const M=g.scrollTop+p.y,L=n===we.Down&&M<=y.y||n===we.Up&&M>=w.y;if(L&&!p.x){g.scrollTo({top:M,behavior:r});return}L?x.y=g.scrollTop-M:x.y=n===we.Down?g.scrollTop-y.y:g.scrollTop-w.y,x.y&&g.scrollBy({top:-x.y,behavior:r});break}}this.handleMove(t,Ut(Ds(o,this.referenceCoordinates),x))}}}handleMove(t,s){const{onMove:l}=this.props;t.preventDefault(),l(s)}handleEnd(t){const{onEnd:s}=this.props;t.preventDefault(),this.detach(),s()}handleCancel(t){const{onCancel:s}=this.props;t.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Fn.activators=[{eventName:"onKeyDown",handler:(e,t,s)=>{let{keyboardCodes:l=In,onActivation:m}=t,{active:v}=s;const{code:C}=e.nativeEvent;if(l.start.includes(C)){const r=v.activatorNode.current;return r&&e.target!==r?!1:(e.preventDefault(),m?.({event:e.nativeEvent}),!0)}return!1}}];function vi(e){return!!(e&&"distance"in e)}function gi(e){return!!(e&&"delay"in e)}class Ur{constructor(t,s,l){var m;l===void 0&&(l=ic(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=s;const{event:v}=t,{target:C}=v;this.props=t,this.events=s,this.document=Xt(C),this.documentListeners=new Zt(this.document),this.listeners=new Zt(l),this.windowListeners=new Zt(Je(C)),this.initialCoordinates=(m=As(v))!=null?m:ft,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:s,bypassActivationConstraint:l}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(lt.Resize,this.handleCancel),this.windowListeners.add(lt.DragStart,pi),this.windowListeners.add(lt.VisibilityChange,this.handleCancel),this.windowListeners.add(lt.ContextMenu,pi),this.documentListeners.add(lt.Keydown,this.handleKeydown),s){if(l!=null&&l({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gi(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(vi(s)){this.handlePending(s);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,s){const{active:l,onPending:m}=this.props;m(l,t,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:t}=this,{onStart:s}=this.props;t&&(this.activated=!0,this.documentListeners.add(lt.Click,nc,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(lt.SelectionChange,this.removeTextSelection),s(t))}handleMove(t){var s;const{activated:l,initialCoordinates:m,props:v}=this,{onMove:C,options:{activationConstraint:r}}=v;if(!m)return;const i=(s=As(t))!=null?s:ft,c=Ds(m,i);if(!l&&r){if(vi(r)){if(r.tolerance!=null&&nr(c,r.tolerance))return this.handleCancel();if(nr(c,r.distance))return this.handleStart()}if(gi(r)&&nr(c,r.tolerance))return this.handleCancel();this.handlePending(r,c);return}t.cancelable&&t.preventDefault(),C(i)}handleEnd(){const{onAbort:t,onEnd:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleCancel(){const{onAbort:t,onCancel:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleKeydown(t){t.code===we.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ac={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class qr extends Ur{constructor(t){const{event:s}=t,l=Xt(s.target);super(t,ac,l)}}qr.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:l}=t;return!s.isPrimary||s.button!==0?!1:(l?.({event:s}),!0)}}];const lc={move:{name:"mousemove"},end:{name:"mouseup"}};var Cr;(function(e){e[e.RightClick=2]="RightClick"})(Cr||(Cr={}));class cc extends Ur{constructor(t){super(t,lc,Xt(t.event.target))}}cc.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:l}=t;return s.button===Cr.RightClick?!1:(l?.({event:s}),!0)}}];const or={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hc extends Ur{constructor(t){super(t,or)}static setup(){return window.addEventListener(or.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(or.move.name,t)};function t(){}}}hc.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:l}=t;const{touches:m}=s;return m.length>1?!1:(l?.({event:s}),!0)}}];var Jt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Jt||(Jt={}));var Ts;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ts||(Ts={}));function uc(e){let{acceleration:t,activator:s=Jt.Pointer,canScroll:l,draggingRect:m,enabled:v,interval:C=5,order:r=Ts.TreeOrder,pointerCoordinates:i,scrollableAncestors:c,scrollableAncestorRects:f,delta:o,threshold:p}=e;const x=fc({delta:o,disabled:!v}),[S,g]=wl(),n=k.useRef({x:0,y:0}),d=k.useRef({x:0,y:0}),h=k.useMemo(()=>{switch(s){case Jt.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case Jt.DraggableRect:return m}},[s,m,i]),u=k.useRef(null),_=k.useCallback(()=>{const w=u.current;if(!w)return;const E=n.current.x*d.current.x,b=n.current.y*d.current.y;w.scrollBy(E,b)},[]),y=k.useMemo(()=>r===Ts.TreeOrder?[...c].reverse():c,[r,c]);k.useEffect(()=>{if(!v||!c.length||!h){g();return}for(const w of y){if(l?.(w)===!1)continue;const E=c.indexOf(w),b=f[E];if(!b)continue;const{direction:R,speed:j}=Jl(w,b,h,t,p);for(const M of["x","y"])x[M][R[M]]||(j[M]=0,R[M]=0);if(j.x>0||j.y>0){g(),u.current=w,S(_,C),n.current=j,d.current=R;return}}n.current={x:0,y:0},d.current={x:0,y:0},g()},[t,_,l,g,v,C,JSON.stringify(h),JSON.stringify(x),S,c,y,f,JSON.stringify(p)])}const dc={x:{[Ye.Backward]:!1,[Ye.Forward]:!1},y:{[Ye.Backward]:!1,[Ye.Forward]:!1}};function fc(e){let{delta:t,disabled:s}=e;const l=Rs(t);return hs(m=>{if(s||!l||!m)return dc;const v={x:Math.sign(t.x-l.x),y:Math.sign(t.y-l.y)};return{x:{[Ye.Backward]:m.x[Ye.Backward]||v.x===-1,[Ye.Forward]:m.x[Ye.Forward]||v.x===1},y:{[Ye.Backward]:m.y[Ye.Backward]||v.y===-1,[Ye.Forward]:m.y[Ye.Forward]||v.y===1}}},[s,t,l])}function mc(e,t){const s=t!=null?e.get(t):void 0,l=s?s.node.current:null;return hs(m=>{var v;return t==null?null:(v=l??m)!=null?v:null},[l,t])}function pc(e,t){return k.useMemo(()=>e.reduce((s,l)=>{const{sensor:m}=l,v=m.activators.map(C=>({eventName:C.eventName,handler:t(C.handler,l)}));return[...s,...v]},[]),[e,t])}var as;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(as||(as={}));var wr;(function(e){e.Optimized="optimized"})(wr||(wr={}));const _i=new Map;function vc(e,t){let{dragging:s,dependencies:l,config:m}=t;const[v,C]=k.useState(null),{frequency:r,measure:i,strategy:c}=m,f=k.useRef(e),o=n(),p=ns(o),x=k.useCallback(function(d){d===void 0&&(d=[]),!p.current&&C(h=>h===null?d:h.concat(d.filter(u=>!h.includes(u))))},[p]),S=k.useRef(null),g=hs(d=>{if(o&&!s)return _i;if(!d||d===_i||f.current!==e||v!=null){const h=new Map;for(let u of e){if(!u)continue;if(v&&v.length>0&&!v.includes(u.id)&&u.rect.current){h.set(u.id,u.rect.current);continue}const _=u.node.current,y=_?new $r(i(_),_):null;u.rect.current=y,y&&h.set(u.id,y)}return h}return d},[e,v,s,o,i]);return k.useEffect(()=>{f.current=e},[e]),k.useEffect(()=>{o||x()},[s,o]),k.useEffect(()=>{v&&v.length>0&&C(null)},[JSON.stringify(v)]),k.useEffect(()=>{o||typeof r!="number"||S.current!==null||(S.current=setTimeout(()=>{x(),S.current=null},r))},[r,o,x,...l]),{droppableRects:g,measureDroppableContainers:x,measuringScheduled:v!=null};function n(){switch(c){case as.Always:return!1;case as.BeforeDragging:return s;default:return!s}}}function Kr(e,t){return hs(s=>e?s||(typeof t=="function"?t(e):e):null,[t,e])}function gc(e,t){return Kr(e,t)}function _c(e){let{callback:t,disabled:s}=e;const l=$s(t),m=k.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:v}=window;return new v(l)},[l,s]);return k.useEffect(()=>()=>m?.disconnect(),[m]),m}function qs(e){let{callback:t,disabled:s}=e;const l=$s(t),m=k.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:v}=window;return new v(l)},[s]);return k.useEffect(()=>()=>m?.disconnect(),[m]),m}function bc(e){return new $r(us(e),e)}function bi(e,t,s){t===void 0&&(t=bc);const[l,m]=k.useState(null);function v(){m(i=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=i??s)!=null?c:null}const f=t(e);return JSON.stringify(i)===JSON.stringify(f)?i:f})}const C=_c({callback(i){if(e)for(const c of i){const{type:f,target:o}=c;if(f==="childList"&&o instanceof HTMLElement&&o.contains(e)){v();break}}}}),r=qs({callback:v});return bt(()=>{v(),e?(r?.observe(e),C?.observe(document.body,{childList:!0,subtree:!0})):(r?.disconnect(),C?.disconnect())},[e]),l}function xc(e){const t=Kr(e);return An(e,t)}const xi=[];function Sc(e){const t=k.useRef(e),s=hs(l=>e?l&&l!==xi&&e&&t.current&&e.parentNode===t.current.parentNode?l:Wr(e):xi,[e]);return k.useEffect(()=>{t.current=e},[e]),s}function yc(e){const[t,s]=k.useState(null),l=k.useRef(e),m=k.useCallback(v=>{const C=ir(v.target);C&&s(r=>r?(r.set(C,yr(C)),new Map(r)):null)},[]);return k.useEffect(()=>{const v=l.current;if(e!==v){C(v);const r=e.map(i=>{const c=ir(i);return c?(c.addEventListener("scroll",m,{passive:!0}),[c,yr(c)]):null}).filter(i=>i!=null);s(r.length?new Map(r):null),l.current=e}return()=>{C(e),C(v)};function C(r){r.forEach(i=>{const c=ir(i);c?.removeEventListener("scroll",m)})}},[m,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((v,C)=>Ut(v,C),ft):On(e):ft,[e,t])}function Si(e,t){t===void 0&&(t=[]);const s=k.useRef(null);return k.useEffect(()=>{s.current=null},t),k.useEffect(()=>{const l=e!==ft;l&&!s.current&&(s.current=e),!l&&s.current&&(s.current=null)},[e]),s.current?Ds(e,s.current):ft}function Cc(e){k.useEffect(()=>{if(!Ws)return;const t=e.map(s=>{let{sensor:l}=s;return l.setup==null?void 0:l.setup()});return()=>{for(const s of t)s?.()}},e.map(t=>{let{sensor:s}=t;return s}))}function wc(e,t){return k.useMemo(()=>e.reduce((s,l)=>{let{eventName:m,handler:v}=l;return s[m]=C=>{v(C,t)},s},{}),[e,t])}function Hn(e){return k.useMemo(()=>e?Vl(e):null,[e])}const yi=[];function Ec(e,t){t===void 0&&(t=us);const[s]=e,l=Hn(s?Je(s):null),[m,v]=k.useState(yi);function C(){v(()=>e.length?e.map(i=>Nn(i)?l:new $r(t(i),i)):yi)}const r=qs({callback:C});return bt(()=>{r?.disconnect(),C(),e.forEach(i=>r?.observe(i))},[e]),m}function zn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return cs(t)?t:e}function kc(e){let{measure:t}=e;const[s,l]=k.useState(null),m=k.useCallback(c=>{for(const{target:f}of c)if(cs(f)){l(o=>{const p=t(f);return o?{...o,width:p.width,height:p.height}:p});break}},[t]),v=qs({callback:m}),C=k.useCallback(c=>{const f=zn(c);v?.disconnect(),f&&v?.observe(f),l(f?t(f):null)},[t,v]),[r,i]=ks(C);return k.useMemo(()=>({nodeRef:r,rect:s,setRef:i}),[s,r,i])}const Rc=[{sensor:qr,options:{}},{sensor:Fn,options:{}}],Dc={current:{}},Cs={draggable:{measure:mi},droppable:{measure:mi,strategy:as.WhileDragging,frequency:wr.Optimized},dragOverlay:{measure:us}};class es extends Map{get(t){var s;return t!=null&&(s=super.get(t))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:s}=t;return!s})}getNodeFor(t){var s,l;return(s=(l=this.get(t))==null?void 0:l.node.current)!=null?s:void 0}}const Ac={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new es,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:js},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Cs,measureDroppableContainers:js,windowRect:null,measuringScheduled:!1},Wn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:js,draggableNodes:new Map,over:null,measureDroppableContainers:js},ds=k.createContext(Wn),$n=k.createContext(Ac);function jc(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new es}}}function Tc(e,t){switch(t.type){case Ue.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ue.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ue.DragEnd:case Ue.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ue.RegisterDroppable:{const{element:s}=t,{id:l}=s,m=new es(e.droppable.containers);return m.set(l,s),{...e,droppable:{...e.droppable,containers:m}}}case Ue.SetDroppableDisabled:{const{id:s,key:l,disabled:m}=t,v=e.droppable.containers.get(s);if(!v||l!==v.key)return e;const C=new es(e.droppable.containers);return C.set(s,{...v,disabled:m}),{...e,droppable:{...e.droppable,containers:C}}}case Ue.UnregisterDroppable:{const{id:s,key:l}=t,m=e.droppable.containers.get(s);if(!m||l!==m.key)return e;const v=new es(e.droppable.containers);return v.delete(s),{...e,droppable:{...e.droppable,containers:v}}}default:return e}}function Lc(e){let{disabled:t}=e;const{active:s,activatorEvent:l,draggableNodes:m}=k.useContext(ds),v=Rs(l),C=Rs(s?.id);return k.useEffect(()=>{if(!t&&!l&&v&&C!=null){if(!zr(v)||document.activeElement===v.target)return;const r=m.get(C);if(!r)return;const{activatorNode:i,node:c}=r;if(!i.current&&!c.current)return;requestAnimationFrame(()=>{for(const f of[i.current,c.current]){if(!f)continue;const o=Rl(f);if(o){o.focus();break}}})}},[l,t,m,C,v]),null}function Un(e,t){let{transform:s,...l}=t;return e!=null&&e.length?e.reduce((m,v)=>v({transform:m,...l}),s):s}function Mc(e){return k.useMemo(()=>({draggable:{...Cs.draggable,...e?.draggable},droppable:{...Cs.droppable,...e?.droppable},dragOverlay:{...Cs.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Nc(e){let{activeNode:t,measure:s,initialRect:l,config:m=!0}=e;const v=k.useRef(!1),{x:C,y:r}=typeof m=="boolean"?{x:m,y:m}:m;bt(()=>{if(!C&&!r||!t){v.current=!1;return}if(v.current||!l)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const f=s(c),o=An(f,l);if(C||(o.x=0),r||(o.y=0),v.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const p=Tn(c);p&&p.scrollBy({top:o.y,left:o.x})}},[t,C,r,l,s])}const Ks=k.createContext({...ft,scaleX:1,scaleY:1});var Ct;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ct||(Ct={}));const Pc=k.memo(function(t){var s,l,m,v;let{id:C,accessibility:r,autoScroll:i=!0,children:c,sensors:f=Rc,collisionDetection:o=$l,measuring:p,modifiers:x,...S}=t;const g=k.useReducer(Tc,void 0,jc),[n,d]=g,[h,u]=Ml(),[_,y]=k.useState(Ct.Uninitialized),w=_===Ct.Initialized,{draggable:{active:E,nodes:b,translate:R},droppable:{containers:j}}=n,M=E!=null?b.get(E):null,L=k.useRef({initial:null,translated:null}),T=k.useMemo(()=>{var je;return E!=null?{id:E,data:(je=M?.data)!=null?je:Dc,rect:L}:null},[E,M]),B=k.useRef(null),[I,H]=k.useState(null),[W,A]=k.useState(null),N=ns(S,Object.values(S)),P=Us("DndDescribedBy",C),O=k.useMemo(()=>j.getEnabled(),[j]),$=Mc(p),{droppableRects:X,measureDroppableContainers:K,measuringScheduled:Q}=vc(O,{dragging:w,dependencies:[R.x,R.y],config:$.droppable}),se=mc(b,E),D=k.useMemo(()=>W?As(W):null,[W]),F=Ht(),q=gc(se,$.draggable.measure);Nc({activeNode:E!=null?b.get(E):null,config:F.layoutShiftCompensation,initialRect:q,measure:$.draggable.measure});const z=bi(se,$.draggable.measure,q),te=bi(se?se.parentElement:null),Y=k.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=j.getNodeFor((s=Y.current.over)==null?void 0:s.id),ge=kc({measure:$.dragOverlay.measure}),me=(l=ge.nodeRef.current)!=null?l:se,Me=w?(m=ge.rect)!=null?m:z:null,re=!!(ge.nodeRef.current&&ge.rect),Be=xc(re?null:z),Ce=Hn(me?Je(me):null),oe=Sc(w?ie??se:null),Ne=Ec(oe),qe=Un(x,{transform:{x:R.x-Be.x,y:R.y-Be.y,scaleX:1,scaleY:1},activatorEvent:W,active:T,activeNodeRect:z,containerNodeRect:te,draggingNodeRect:Me,over:Y.current.over,overlayNodeRect:ge.rect,scrollableAncestors:oe,scrollableAncestorRects:Ne,windowRect:Ce}),Re=D?Ut(D,R):null,Ve=yc(oe),be=Si(Ve),st=Si(Ve,[z]),Ke=Ut(qe,be),Pe=Me?Kl(Me,qe):null,Oe=T&&Pe?o({active:T,collisionRect:Pe,droppableRects:X,droppableContainers:O,pointerCoordinates:Re}):null,De=zl(Oe,"id"),[V,Z]=k.useState(null),xe=re?qe:Ut(qe,st),Se=Ul(xe,(v=V?.rect)!=null?v:null,z),He=k.useRef(null),Xe=k.useCallback((je,U)=>{let{sensor:J,options:he}=U;if(B.current==null)return;const ue=b.get(B.current);if(!ue)return;const ve=je.nativeEvent,Ae=new J({active:B.current,activeNode:ue,event:ve,options:he,context:Y,onAbort(Fe){if(!b.get(Fe))return;const{onDragAbort:tt}=N.current,at={id:Fe};tt?.(at),h({type:"onDragAbort",event:at})},onPending(Fe,ot,tt,at){if(!b.get(Fe))return;const{onDragPending:Tt}=N.current,pt={id:Fe,constraint:ot,initialCoordinates:tt,offset:at};Tt?.(pt),h({type:"onDragPending",event:pt})},onStart(Fe){const ot=B.current;if(ot==null)return;const tt=b.get(ot);if(!tt)return;const{onDragStart:at}=N.current,jt={activatorEvent:ve,active:{id:ot,data:tt.data,rect:L}};Nt.unstable_batchedUpdates(()=>{at?.(jt),y(Ct.Initializing),d({type:Ue.DragStart,initialCoordinates:Fe,active:ot}),h({type:"onDragStart",event:jt}),H(He.current),A(ve)})},onMove(Fe){d({type:Ue.DragMove,coordinates:Fe})},onEnd:mt(Ue.DragEnd),onCancel:mt(Ue.DragCancel)});He.current=Ae;function mt(Fe){return async function(){const{active:tt,collisions:at,over:jt,scrollAdjustedTranslate:Tt}=Y.current;let pt=null;if(tt&&Tt){const{cancelDrop:St}=N.current;pt={activatorEvent:ve,active:tt,collisions:at,delta:Tt,over:jt},Fe===Ue.DragEnd&&typeof St=="function"&&await Promise.resolve(St(pt))&&(Fe=Ue.DragCancel)}B.current=null,Nt.unstable_batchedUpdates(()=>{d({type:Fe}),y(Ct.Uninitialized),Z(null),H(null),A(null),He.current=null;const St=Fe===Ue.DragEnd?"onDragEnd":"onDragCancel";if(pt){const Lt=N.current[St];Lt?.(pt),h({type:St,event:pt})}})}}},[b]),pe=k.useCallback((je,U)=>(J,he)=>{const ue=J.nativeEvent,ve=b.get(he);if(B.current!==null||!ve||ue.dndKit||ue.defaultPrevented)return;const Ae={active:ve};je(J,U.options,Ae)===!0&&(ue.dndKit={capturedBy:U.sensor},B.current=he,Xe(J,U))},[b,Xe]),et=pc(f,pe);Cc(f),bt(()=>{z&&_===Ct.Initializing&&y(Ct.Initialized)},[z,_]),k.useEffect(()=>{const{onDragMove:je}=N.current,{active:U,activatorEvent:J,collisions:he,over:ue}=Y.current;if(!U||!J)return;const ve={active:U,activatorEvent:J,collisions:he,delta:{x:Ke.x,y:Ke.y},over:ue};Nt.unstable_batchedUpdates(()=>{je?.(ve),h({type:"onDragMove",event:ve})})},[Ke.x,Ke.y]),k.useEffect(()=>{const{active:je,activatorEvent:U,collisions:J,droppableContainers:he,scrollAdjustedTranslate:ue}=Y.current;if(!je||B.current==null||!U||!ue)return;const{onDragOver:ve}=N.current,Ae=he.get(De),mt=Ae&&Ae.rect.current?{id:Ae.id,rect:Ae.rect.current,data:Ae.data,disabled:Ae.disabled}:null,Fe={active:je,activatorEvent:U,collisions:J,delta:{x:ue.x,y:ue.y},over:mt};Nt.unstable_batchedUpdates(()=>{Z(mt),ve?.(Fe),h({type:"onDragOver",event:Fe})})},[De]),bt(()=>{Y.current={activatorEvent:W,active:T,activeNode:se,collisionRect:Pe,collisions:Oe,droppableRects:X,draggableNodes:b,draggingNode:me,draggingNodeRect:Me,droppableContainers:j,over:V,scrollableAncestors:oe,scrollAdjustedTranslate:Ke},L.current={initial:Me,translated:Pe}},[T,se,Oe,Pe,b,me,Me,X,j,V,oe,Ke]),uc({...F,delta:R,draggingRect:Pe,pointerCoordinates:Re,scrollableAncestors:oe,scrollableAncestorRects:Ne});const Ge=k.useMemo(()=>({active:T,activeNode:se,activeNodeRect:z,activatorEvent:W,collisions:Oe,containerNodeRect:te,dragOverlay:ge,draggableNodes:b,droppableContainers:j,droppableRects:X,over:V,measureDroppableContainers:K,scrollableAncestors:oe,scrollableAncestorRects:Ne,measuringConfiguration:$,measuringScheduled:Q,windowRect:Ce}),[T,se,z,W,Oe,te,ge,b,j,X,V,K,oe,Ne,$,Q,Ce]),nt=k.useMemo(()=>({activatorEvent:W,activators:et,active:T,activeNodeRect:z,ariaDescribedById:{draggable:P},dispatch:d,draggableNodes:b,over:V,measureDroppableContainers:K}),[W,et,T,z,d,P,b,V,K]);return ee.createElement(Dn.Provider,{value:u},ee.createElement(ds.Provider,{value:nt},ee.createElement($n.Provider,{value:Ge},ee.createElement(Ks.Provider,{value:Se},c)),ee.createElement(Lc,{disabled:r?.restoreFocus===!1})),ee.createElement(Ol,{...r,hiddenTextDescribedById:P}));function Ht(){const je=I?.autoScrollEnabled===!1,U=typeof i=="object"?i.enabled===!1:i===!1,J=w&&!je&&!U;return typeof i=="object"?{...i,enabled:J}:{enabled:J}}}),Oc=k.createContext(null),Ci="button",Bc="Draggable";function Ic(e){let{id:t,data:s,disabled:l=!1,attributes:m}=e;const v=Us(Bc),{activators:C,activatorEvent:r,active:i,activeNodeRect:c,ariaDescribedById:f,draggableNodes:o,over:p}=k.useContext(ds),{role:x=Ci,roleDescription:S="draggable",tabIndex:g=0}=m??{},n=i?.id===t,d=k.useContext(n?Ks:Oc),[h,u]=ks(),[_,y]=ks(),w=wc(C,t),E=ns(s);bt(()=>(o.set(t,{id:t,key:v,node:h,activatorNode:_,data:E}),()=>{const R=o.get(t);R&&R.key===v&&o.delete(t)}),[o,t]);const b=k.useMemo(()=>({role:x,tabIndex:g,"aria-disabled":l,"aria-pressed":n&&x===Ci?!0:void 0,"aria-roledescription":S,"aria-describedby":f.draggable}),[l,x,g,n,S,f.draggable]);return{active:i,activatorEvent:r,activeNodeRect:c,attributes:b,isDragging:n,listeners:l?void 0:w,node:h,over:p,setNodeRef:u,setActivatorNodeRef:y,transform:d}}function Fc(){return k.useContext($n)}const Hc="Droppable",zc={timeout:25};function Wc(e){let{data:t,disabled:s=!1,id:l,resizeObserverConfig:m}=e;const v=Us(Hc),{active:C,dispatch:r,over:i,measureDroppableContainers:c}=k.useContext(ds),f=k.useRef({disabled:s}),o=k.useRef(!1),p=k.useRef(null),x=k.useRef(null),{disabled:S,updateMeasurementsFor:g,timeout:n}={...zc,...m},d=ns(g??l),h=k.useCallback(()=>{if(!o.current){o.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{c(Array.isArray(d.current)?d.current:[d.current]),x.current=null},n)},[n]),u=qs({callback:h,disabled:S||!C}),_=k.useCallback((b,R)=>{u&&(R&&(u.unobserve(R),o.current=!1),b&&u.observe(b))},[u]),[y,w]=ks(_),E=ns(t);return k.useEffect(()=>{!u||!y.current||(u.disconnect(),o.current=!1,u.observe(y.current))},[y,u]),k.useEffect(()=>(r({type:Ue.RegisterDroppable,element:{id:l,key:v,disabled:s,node:y,rect:p,data:E}}),()=>r({type:Ue.UnregisterDroppable,key:v,id:l})),[l]),k.useEffect(()=>{s!==f.current.disabled&&(r({type:Ue.SetDroppableDisabled,id:l,key:v,disabled:s}),f.current.disabled=s)},[l,v,s,r]),{active:C,rect:p,isOver:i?.id===l,node:y,over:i,setNodeRef:w}}function $c(e){let{animation:t,children:s}=e;const[l,m]=k.useState(null),[v,C]=k.useState(null),r=Rs(s);return!s&&!l&&r&&m(r),bt(()=>{if(!v)return;const i=l?.key,c=l?.props.id;if(i==null||c==null){m(null);return}Promise.resolve(t(c,v)).then(()=>{m(null)})},[t,l,v]),ee.createElement(ee.Fragment,null,s,l?k.cloneElement(l,{ref:C}):null)}const Uc={x:0,y:0,scaleX:1,scaleY:1};function qc(e){let{children:t}=e;return ee.createElement(ds.Provider,{value:Wn},ee.createElement(Ks.Provider,{value:Uc},t))}const Kc={position:"fixed",touchAction:"none"},Xc=e=>zr(e)?"transform 250ms ease":void 0,Yc=k.forwardRef((e,t)=>{let{as:s,activatorEvent:l,adjustScale:m,children:v,className:C,rect:r,style:i,transform:c,transition:f=Xc}=e;if(!r)return null;const o=m?c:{...c,scaleX:1,scaleY:1},p={...Kc,width:r.width,height:r.height,top:r.top,left:r.left,transform:os.Transform.toString(o),transformOrigin:m&&l?Fl(l,r):void 0,transition:typeof f=="function"?f(l):f,...i};return ee.createElement(s,{className:C,style:p,ref:t},v)}),Vc=e=>t=>{let{active:s,dragOverlay:l}=t;const m={},{styles:v,className:C}=e;if(v!=null&&v.active)for(const[r,i]of Object.entries(v.active))i!==void 0&&(m[r]=s.node.style.getPropertyValue(r),s.node.style.setProperty(r,i));if(v!=null&&v.dragOverlay)for(const[r,i]of Object.entries(v.dragOverlay))i!==void 0&&l.node.style.setProperty(r,i);return C!=null&&C.active&&s.node.classList.add(C.active),C!=null&&C.dragOverlay&&l.node.classList.add(C.dragOverlay),function(){for(const[i,c]of Object.entries(m))s.node.style.setProperty(i,c);C!=null&&C.active&&s.node.classList.remove(C.active)}},Gc=e=>{let{transform:{initial:t,final:s}}=e;return[{transform:os.Transform.toString(t)},{transform:os.Transform.toString(s)}]},Qc={duration:250,easing:"ease",keyframes:Gc,sideEffects:Vc({styles:{active:{opacity:"0"}}})};function Zc(e){let{config:t,draggableNodes:s,droppableContainers:l,measuringConfiguration:m}=e;return $s((v,C)=>{if(t===null)return;const r=s.get(v);if(!r)return;const i=r.node.current;if(!i)return;const c=zn(C);if(!c)return;const{transform:f}=Je(C).getComputedStyle(C),o=jn(f);if(!o)return;const p=typeof t=="function"?t:Jc(t);return Bn(i,m.draggable.measure),p({active:{id:v,data:r.data,node:i,rect:m.draggable.measure(i)},draggableNodes:s,dragOverlay:{node:C,rect:m.dragOverlay.measure(c)},droppableContainers:l,measuringConfiguration:m,transform:o})})}function Jc(e){const{duration:t,easing:s,sideEffects:l,keyframes:m}={...Qc,...e};return v=>{let{active:C,dragOverlay:r,transform:i,...c}=v;if(!t)return;const f={x:r.rect.left-C.rect.left,y:r.rect.top-C.rect.top},o={scaleX:i.scaleX!==1?C.rect.width*i.scaleX/r.rect.width:1,scaleY:i.scaleY!==1?C.rect.height*i.scaleY/r.rect.height:1},p={x:i.x-f.x,y:i.y-f.y,...o},x=m({...c,active:C,dragOverlay:r,transform:{initial:i,final:p}}),[S]=x,g=x[x.length-1];if(JSON.stringify(S)===JSON.stringify(g))return;const n=l?.({active:C,dragOverlay:r,...c}),d=r.node.animate(x,{duration:t,easing:s,fill:"forwards"});return new Promise(h=>{d.onfinish=()=>{n?.(),h()}})}}let wi=0;function eh(e){return k.useMemo(()=>{if(e!=null)return wi++,wi},[e])}const th=ee.memo(e=>{let{adjustScale:t=!1,children:s,dropAnimation:l,style:m,transition:v,modifiers:C,wrapperElement:r="div",className:i,zIndex:c=999}=e;const{activatorEvent:f,active:o,activeNodeRect:p,containerNodeRect:x,draggableNodes:S,droppableContainers:g,dragOverlay:n,over:d,measuringConfiguration:h,scrollableAncestors:u,scrollableAncestorRects:_,windowRect:y}=Fc(),w=k.useContext(Ks),E=eh(o?.id),b=Un(C,{activatorEvent:f,active:o,activeNodeRect:p,containerNodeRect:x,draggingNodeRect:n.rect,over:d,overlayNodeRect:n.rect,scrollableAncestors:u,scrollableAncestorRects:_,transform:w,windowRect:y}),R=Kr(p),j=Zc({config:l,draggableNodes:S,droppableContainers:g,measuringConfiguration:h}),M=R?n.setRef:void 0;return ee.createElement(qc,null,ee.createElement($c,{animation:j},o&&E?ee.createElement(Yc,{key:E,id:o.id,ref:M,as:r,activatorEvent:f,adjustScale:t,className:i,transition:v,rect:R,style:{zIndex:c,...m},transform:b},s):null))}),le={Review:"Review",Running:"Running",Pending:"Pending",Done:"Done",Cancelled:"Cancelled"},sh=[{status:le.Review,label:"Review",icon:Lr,color:"text-amber-600"},{status:le.Running,label:"Running",icon:Mr,color:"text-blue-600"},{status:le.Pending,label:"Pending",icon:Nr,color:"text-neutral-600"},{status:le.Done,label:"Done",icon:Pr,color:"text-emerald-600"},{status:le.Cancelled,label:"Cancelled",icon:Or,color:"text-neutral-500"}];function rh({task:e,status:t,isSelected:s,isAgentActive:l,project:m,onSelectTask:v,onTaskStatusChange:C,onDeleteTask:r}){const{t:i}=ce(),c=!!e.projectArchivedAt,{attributes:f,listeners:o,setNodeRef:p,isDragging:x}=Ic({id:e.id,data:{task:e,fromStatus:t},disabled:c}),[S,g]=k.useState(null),n=k.useRef(null),d=k.useCallback(h=>{c||!C&&!r||(h.preventDefault(),g({x:h.clientX,y:h.clientY}))},[c,C,r]);return k.useEffect(()=>{if(!S)return;const h=u=>{n.current&&!n.current.contains(u.target)&&g(null)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[S]),a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:p,onClick:()=>v(e.id),onContextMenu:d,className:`flex items-start pl-8 pr-4 py-2 text-sm w-full text-left transition-all border-l-2 group
|
|
7
7
|
${x?"opacity-30":""}
|
|
8
|
-
${s?"bg-neutral-100 border-neutral-800":"border-transparent hover:bg-neutral-50 hover:border-neutral-200"}`,...c?{}:o,...c?{}:f,children:[a.jsxs("div",{className:`mt-0.5 mr-3 flex-shrink-0 ${t===le.Running?"text-blue-600":"text-neutral-500"}`,children:[t===le.Review&&a.jsx(
|
|
8
|
+
${s?"bg-neutral-100 border-neutral-800":"border-transparent hover:bg-neutral-50 hover:border-neutral-200"}`,...c?{}:o,...c?{}:f,children:[a.jsxs("div",{className:`mt-0.5 mr-3 flex-shrink-0 ${t===le.Running?"text-blue-600":"text-neutral-500"}`,children:[t===le.Review&&a.jsx(Lr,{className:s?"text-amber-600":"text-neutral-500"}),t===le.Running&&a.jsx(Mr,{className:"animate-pulse"}),t===le.Pending&&a.jsx(Nr,{}),t===le.Done&&a.jsx(Pr,{className:"text-neutral-400"}),t===le.Cancelled&&a.jsx(Or,{className:"text-neutral-400"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"mb-0.5",children:[a.jsx("span",{className:`font-medium mr-1 ${m?.color||"text-neutral-500"}`,children:m?.name}),a.jsx("span",{className:"text-neutral-400",children:"/"}),a.jsx("span",{className:`ml-1 ${s?"text-neutral-900":"text-neutral-700"}`,children:e.title}),e.projectArchivedAt&&a.jsx("span",{className:"ml-1.5 inline-flex items-center rounded-full bg-neutral-100 px-1.5 py-0.5 text-[10px] font-medium text-neutral-500",children:e.projectRepoDeletedAt?i("源码已删除"):i("已删除")}),l&&a.jsxs("span",{className:"relative inline-flex h-2 w-2 ml-1.5 align-middle",children:[a.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),a.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]})]}),a.jsx("p",{className:`text-xs line-clamp-2 leading-relaxed ${s?"text-neutral-500":"text-neutral-400 group-hover:text-neutral-500"}`,children:e.description})]})]}),S&&a.jsxs("div",{ref:n,className:"fixed z-[100] w-44 bg-white rounded-lg border border-neutral-200 shadow-xl py-1 animate-in fade-in zoom-in-95 duration-100",style:{left:S.x,top:S.y},children:[C&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-neutral-400 uppercase tracking-wider",children:i("Move to")}),sh.filter(h=>h.status!==t).map(h=>{const u=h.icon;return a.jsxs("button",{onClick:()=>{C(e.id,h.status),g(null)},className:"w-full flex items-center gap-2 px-3 py-2 text-xs hover:bg-neutral-50 transition-colors",children:[a.jsx(u,{className:`w-3.5 h-3.5 ${h.color}`}),a.jsx("span",{className:"text-neutral-700",children:i(h.label)})]},h.status)})]}),r&&a.jsxs(a.Fragment,{children:[C&&a.jsx("div",{className:"my-1 border-t border-neutral-100"}),a.jsxs("button",{onClick:()=>{r(e.id),g(null)},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-red-600 hover:bg-red-50 transition-colors",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M3 6h18"}),a.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),a.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),a.jsx("span",{children:i("Delete Task")})]})]})]})]})}const ih=k.memo(function({title:t,tasks:s,status:l,defaultOpen:m,selectedTaskId:v,onSelectTask:C,projects:r,activeTaskIds:i,isDragging:c,dragFromStatus:f,onTaskStatusChange:o,onDeleteTask:p}){const{t:x}=ce(),[S,g]=k.useState(m),n=s.length===0,d=c&&f===l,h=c&&f!==l,{setNodeRef:u,isOver:_}=Wc({id:`group-${l}`,data:{status:l}}),y=l===le.Review,w=x(t),E=c?d&&(S||!0):S;return a.jsxs("div",{className:"mb-2",children:[a.jsxs("button",{onClick:()=>!c&&g(b=>!b),className:"flex items-center w-full px-4 py-2 text-sm font-medium text-neutral-600 hover:text-neutral-900 hover:bg-neutral-50 transition-colors",children:[a.jsx("span",{className:"mr-2 text-neutral-400",children:E?a.jsx(xt,{size:14}):a.jsx(Ft,{size:14})}),a.jsx("span",{className:"flex-1 text-left",children:w}),y&&!n?a.jsx("span",{className:"px-2 py-0.5 bg-amber-100 text-amber-700 text-xs font-bold rounded-full animate-hop",children:s.length}):a.jsxs("span",{className:"text-xs text-neutral-400 font-normal",children:["(",s.length,")"]})]}),h&&a.jsx("div",{ref:u,className:`mx-3 my-1 flex items-center justify-center rounded-lg border-2 border-dashed transition-all duration-150 h-10
|
|
9
9
|
${_?"border-blue-400 bg-blue-50 text-blue-600":"border-neutral-300 bg-neutral-50/50 text-neutral-400"}`,children:a.jsx("span",{className:"text-xs font-medium",children:_?x("Drop into {title}",{title:w}):x("Drop here")})}),E&&!h&&a.jsx("div",{ref:d?void 0:u,className:`flex flex-col mt-1 min-h-[40px] rounded-md mx-2 transition-colors
|
|
10
10
|
${_&&!d?"bg-blue-50 ring-1 ring-blue-200":""}
|
|
11
|
-
${n&&c?"border border-dashed border-neutral-300":""}`,children:n?a.jsx("span",{className:"text-xs text-neutral-300 py-2 pl-8",children:x("No tasks")}):s.map(b=>{const R=r.find(L=>L.id===b.projectId),j=v===b.id,M=i?.has(b.id)??!1;return a.jsx(rh,{task:b,status:l,isSelected:j,isAgentActive:M,project:R,onSelectTask:C,onTaskStatusChange:b.projectArchivedAt?void 0:o,onDeleteTask:b.projectArchivedAt?void 0:p},b.id)})})]})});function nh(e){const t={[le.Review]:[],[le.Running]:[],[le.Pending]:[],[le.Done]:[],[le.Cancelled]:[]};for(const s of e)t[s.status].push(s);return t}const oh=[{status:le.Review,title:"Review",defaultOpen:!0},{status:le.Running,title:"Running",defaultOpen:!0},{status:le.Pending,title:"Pending",defaultOpen:!1},{status:le.Done,title:"Done",defaultOpen:!1},{status:le.Cancelled,title:"Cancelled",defaultOpen:!1}];function Ei({tasks:e=[],projects:t=[],selectedTaskId:s,onSelectTask:l,filterProjectId:m,setFilterProjectId:v,width:C=320,onCreateProject:r,onCreateTask:i,activeTaskIds:c,onTaskStatusChange:f,onDeleteTask:o}){const{t:p}=ce(),[x,S]=k.useState(!1),[g,n]=k.useState(null),[d,h]=k.useState(null),u=Il(Bl(Ur,{activationConstraint:{distance:8}})),_=k.useCallback(T=>{const B=T.active.data.current?.task,I=T.active.data.current?.fromStatus;B&&n(B),I&&h(I)},[]),y=k.useCallback(T=>{n(null),h(null);const{active:B,over:I}=T;if(!I)return;const H=B.data.current?.task,W=B.data.current?.fromStatus,A=I.data.current?.status;!H||!W||!A||H.projectArchivedAt||W!==A&&f?.(H.id,A)},[f]),w=m?e.filter(T=>T.projectId===m):e,E=m?t.find(T=>T.id===m)??null:null,b=t.filter(T=>!T.archivedAt),j=!!!E?.archivedAt,M=nh(w),L=C==="100%";return a.jsxs("div",{className:`h-full flex flex-col bg-white flex-shrink-0 ${L?"":"border-r border-neutral-200"}`,style:{width:C},children:[a.jsxs("div",{className:"h-14 flex items-center justify-between px-3 border-b border-neutral-100 flex-shrink-0 relative z-20",children:[a.jsxs("div",{className:"relative flex-1 mr-2",children:[a.jsxs("button",{onClick:()=>S(T=>!T),className:"flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-semibold text-neutral-900 hover:bg-neutral-100 transition-colors w-full text-left group",children:[m&&E?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${E.color.replace("text-","bg-")}`}),a.jsx("span",{className:"truncate",children:E.name})]}):a.jsxs(a.Fragment,{children:[a.jsx(di,{size:16,className:"text-neutral-500 group-hover:text-neutral-800"}),a.jsx("span",{children:p("All Projects")})]}),a.jsx(xt,{size:14,className:`text-neutral-400 ml-auto transition-transform duration-200 ${x?"rotate-180":""}`})]}),x?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>S(!1)}),a.jsxs("div",{className:"absolute left-0 top-full mt-1 w-56 bg-white border border-neutral-200 rounded-lg shadow-xl shadow-neutral-200/50 z-40 py-1 animate-in fade-in zoom-in-95 duration-100 origin-top-left",children:[a.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-neutral-400 uppercase tracking-wider",children:p("Select View")}),a.jsxs("button",{onClick:()=>{v(null),S(!1)},className:"w-full text-left px-3 py-2 text-xs flex items-center justify-between hover:bg-neutral-50 transition-colors group",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-5 h-5 flex items-center justify-center rounded border border-neutral-200 bg-neutral-50 text-neutral-500 group-hover:border-neutral-300",children:a.jsx(di,{size:12})}),a.jsx("span",{className:m===null?"text-neutral-900 font-medium":"text-neutral-600",children:p("All Projects")})]}),m===null?a.jsx(ss,{size:14,className:"text-neutral-900"}):null]}),a.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),b.map(T=>{const B=m===T.id,I=T.color.replace("text-","bg-");return a.jsxs("button",{onClick:()=>{v(T.id),S(!1)},className:"w-full text-left px-3 py-2 text-xs flex items-center justify-between hover:bg-neutral-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-2 h-2 rounded-full ml-1.5 mr-1.5 ${I}`}),a.jsx("span",{className:B?"text-neutral-900 font-medium":"text-neutral-600",children:T.name})]}),B?a.jsx(ss,{size:14,className:"text-neutral-900"}):null]},T.id)}),a.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),a.jsxs("button",{onClick:()=>{S(!1),r?.()},className:"w-full text-left px-3 py-2 text-xs flex items-center gap-2 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-50 transition-colors",children:[a.jsx(br,{size:14}),a.jsx("span",{children:p("Create New Project...")})]})]})]}):null]}),a.jsx("button",{onClick:i,disabled:!j,className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors flex-shrink-0 disabled:opacity-30 disabled:cursor-not-allowed",title:p(j?"New Task":"Deleted projects are read-only"),children:a.jsx(br,{size:18})})]}),a.jsxs(Pc,{sensors:u,onDragStart:_,onDragEnd:y,children:[a.jsx("div",{className:"flex-1 overflow-y-auto py-4 relative",children:oh.map(({status:T,title:B,defaultOpen:I})=>a.jsx(ih,{title:B,tasks:M[T],status:T,defaultOpen:I,selectedTaskId:s,onSelectTask:l,projects:t,activeTaskIds:c,isDragging:g!==null,dragFromStatus:d,onTaskStatusChange:f,onDeleteTask:o},T))}),a.jsx(th,{dropAnimation:null,children:g?a.jsx("div",{className:"bg-white shadow-lg rounded-md border border-neutral-200 px-4 py-2 text-sm max-w-[280px] opacity-90",children:a.jsx("span",{className:"text-neutral-700 font-medium",children:g.title})}):null})]}),w.length>0?a.jsxs("div",{className:"p-4 border-t border-neutral-100 text-xs text-neutral-400 flex items-center justify-between",children:[a.jsx("span",{children:p("{count} tasks",{count:w.length})}),m?a.jsx("button",{onClick:()=>v(null),className:"hover:text-neutral-800 underline decoration-neutral-300 underline-offset-2",children:p("Clear filter")}):null]}):a.jsx("div",{className:"p-4 border-t border-neutral-100 text-xs text-neutral-400 flex items-center justify-between",children:a.jsx("span",{children:p("{count} tasks",{count:0})})})]})}const ah={damping:.7,stiffness:.05,mass:1.25},lh=70,ch=1e3/60,hh=350;let Xs=!1;globalThis.document?.addEventListener("mousedown",()=>{Xs=!0});globalThis.document?.addEventListener("mouseup",()=>{Xs=!1});globalThis.document?.addEventListener("click",()=>{Xs=!1});const qn=(e={})=>{const[t,s]=k.useState(!1),[l,m]=k.useState(e.initial!==!1),[v,C]=k.useState(!1),r=k.useRef(null);r.current=e;const i=k.useCallback(()=>{if(!Xs)return!1;const h=window.getSelection();if(!h||!h.rangeCount)return!1;const u=h.getRangeAt(0);return u.commonAncestorContainer.contains(n.current)||n.current?.contains(u.commonAncestorContainer)},[]),c=k.useCallback(h=>{o.isAtBottom=h,m(h)},[]),f=k.useCallback(h=>{o.escapedFromLock=h,s(h)},[]),o=k.useMemo(()=>{let h;return{escapedFromLock:t,isAtBottom:l,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return n.current?.scrollTop??0},set scrollTop(u){n.current&&(n.current.scrollTop=u,o.ignoreScrollToTop=n.current.scrollTop)},get targetScrollTop(){return!n.current||!d.current?0:n.current.scrollHeight-1-n.current.clientHeight},get calculatedTargetScrollTop(){if(!n.current||!d.current)return 0;const{targetScrollTop:u}=this;if(!e.targetScrollTop)return u;if(h?.targetScrollTop===u)return h.calculatedScrollTop;const _=Math.max(Math.min(e.targetScrollTop(u,{scrollElement:n.current,contentElement:d.current}),u),0);return h={targetScrollTop:u,calculatedScrollTop:_},requestAnimationFrame(()=>{h=void 0}),_},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=lh}}},[]),p=k.useCallback((h={})=>{typeof h=="string"&&(h={animation:h}),h.preserveScrollPosition||c(!0);const u=Date.now()+(Number(h.wait)||0),_=ar(r.current,h.animation),{ignoreEscapes:y=!1}=h;let w,E=o.calculatedTargetScrollTop;h.duration instanceof Promise?h.duration.finally(()=>{w=Date.now()}):w=u+(h.duration??0);const b=async()=>{const R=new Promise(requestAnimationFrame).then(()=>{if(!o.isAtBottom)return o.animation=void 0,!1;const{scrollTop:j}=o,M=performance.now(),L=(M-(o.lastTick??M))/ch;if(o.animation||(o.animation={behavior:_,promise:R,ignoreEscapes:y}),o.animation.behavior===_&&(o.lastTick=M),i()||u>Date.now())return b();if(j<Math.min(E,o.calculatedTargetScrollTop)){if(o.animation?.behavior===_){if(_==="instant")return o.scrollTop=o.calculatedTargetScrollTop,b();o.velocity=(_.damping*o.velocity+_.stiffness*o.scrollDifference)/_.mass,o.accumulated+=o.velocity*L,o.scrollTop+=o.accumulated,o.scrollTop!==j&&(o.accumulated=0)}return b()}return w>Date.now()?(E=o.calculatedTargetScrollTop,b()):(o.animation=void 0,o.scrollTop<o.calculatedTargetScrollTop?p({animation:ar(r.current,r.current.resize),ignoreEscapes:y,duration:Math.max(0,w-Date.now())||void 0}):o.isAtBottom)});return R.then(j=>(requestAnimationFrame(()=>{o.animation||(o.lastTick=void 0,o.velocity=0)}),j))};return h.wait!==!0&&(o.animation=void 0),o.animation?.behavior===_?o.animation.promise:b()},[c,i,o]),x=k.useCallback(()=>{f(!0),c(!1)},[f,c]),S=k.useCallback(({target:h})=>{if(h!==n.current)return;const{scrollTop:u,ignoreScrollToTop:_}=o;let{lastScrollTop:y=u}=o;o.lastScrollTop=u,o.ignoreScrollToTop=void 0,_&&_>u&&(y=_),C(o.isNearBottom),setTimeout(()=>{if(o.resizeDifference||u===_)return;if(i()){f(!0),c(!1);return}const w=u>y,E=u<y;if(o.animation?.ignoreEscapes){o.scrollTop=y;return}E&&(f(!0),c(!1)),w&&f(!1),!o.escapedFromLock&&o.isNearBottom&&c(!0)},1)},[f,c,i,o]),g=k.useCallback(({target:h,deltaY:u})=>{let _=h;for(;!["scroll","auto"].includes(getComputedStyle(_).overflow);){if(!_.parentElement)return;_=_.parentElement}_===n.current&&u<0&&n.current.scrollHeight>n.current.clientHeight&&!o.animation?.ignoreEscapes&&(f(!0),c(!1))},[f,c,o]),n=ki(h=>{n.current?.removeEventListener("scroll",S),n.current?.removeEventListener("wheel",g),h?.addEventListener("scroll",S,{passive:!0}),h?.addEventListener("wheel",g,{passive:!0})},[]),d=ki(h=>{if(o.resizeObserver?.disconnect(),!h)return;let u;o.resizeObserver=new ResizeObserver(([_])=>{const{height:y}=_.contentRect,w=y-(u??y);if(o.resizeDifference=w,o.scrollTop>o.targetScrollTop&&(o.scrollTop=o.targetScrollTop),C(o.isNearBottom),w>=0){const E=ar(r.current,u?r.current.resize:r.current.initial);p({animation:E,wait:!0,preserveScrollPosition:!0,duration:E==="instant"?void 0:hh})}else o.isNearBottom&&(f(!1),c(!0));u=y,requestAnimationFrame(()=>{setTimeout(()=>{o.resizeDifference===w&&(o.resizeDifference=0)},1)})}),o.resizeObserver?.observe(h)},[]);return{contentRef:d,scrollRef:n,scrollToBottom:p,stopScroll:x,isAtBottom:l||v,isNearBottom:v,escapedFromLock:t,state:o}};function ki(e,t){const s=k.useCallback(l=>(s.current=l,e(l)),t);return s}const or=new Map;function ar(...e){const t={...ah};let s=!1;for(const m of e){if(m==="instant"){s=!0;continue}typeof m=="object"&&(s=!1,t.damping=m.damping??t.damping,t.stiffness=m.stiffness??t.stiffness,t.mass=m.mass??t.mass)}const l=JSON.stringify(t);return or.has(l)||or.set(l,Object.freeze(t)),s?"instant":or.get(l)}function uh({content:e,children:t,className:s=""}){return a.jsxs("div",{className:`group/tooltip relative ${s}`,children:[t,a.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-2 bg-neutral-900 text-white text-xs rounded-lg opacity-0 group-hover/tooltip:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-50 shadow-lg",children:[e,a.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-neutral-900"})]})]})}function gs(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function dh(e){return e>=.9?"text-red-500":e>=.7?"text-amber-500":"text-neutral-400"}function Kn({usage:e}){const{t}=ce();if(!e)return null;const s=e.modelContextWindow,l=s?e.totalTokens/s:0,m=s?Math.min(Math.round(l*100),100):null,v=s?dh(l):"text-neutral-400",C=s?a.jsx("span",{children:t("上下文: {used} / {max} tokens",{used:gs(e.totalTokens),max:gs(s)})}):a.jsx("span",{children:t("已使用: {used} tokens",{used:gs(e.totalTokens)})});return a.jsx(uh,{content:C,children:a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 text-xs rounded-lg hover:bg-neutral-100 transition-colors cursor-default select-none",children:[a.jsx(Ua,{size:14,className:v}),a.jsxs("span",{className:`tabular-nums ${v}`,children:[gs(e.totalTokens),m!==null&&a.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",m,"%"]})]})]})})}var lr={exports:{}},Ri;function fh(){return Ri||(Ri=1,(function(e,t){(function(s,l){e.exports=l()})(self,(()=>(()=>{var s={4567:function(C,r,i){var c=this&&this.__decorate||function(u,_,y,w){var E,b=arguments.length,R=b<3?_:w===null?w=Object.getOwnPropertyDescriptor(_,y):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(u,_,y,w);else for(var j=u.length-1;j>=0;j--)(E=u[j])&&(R=(b<3?E(R):b>3?E(_,y,R):E(_,y))||R);return b>3&&R&&Object.defineProperty(_,y,R),R},f=this&&this.__param||function(u,_){return function(y,w){_(y,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const o=i(9042),p=i(6114),x=i(9924),S=i(844),g=i(5596),n=i(4725),d=i(3656);let h=r.AccessibilityManager=class extends S.Disposable{constructor(u,_){super(),this._terminal=u,this._renderService=_,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let y=0;y<this._terminal.rows;y++)this._rowElements[y]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[y]);if(this._topBoundaryFocusListener=y=>this._handleBoundaryFocus(y,0),this._bottomBoundaryFocusListener=y=>this._handleBoundaryFocus(y,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=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new x.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((y=>this._handleResize(y.rows)))),this.register(this._terminal.onRender((y=>this._refreshRows(y.start,y.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((y=>this._handleChar(y)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
11
|
+
${n&&c?"border border-dashed border-neutral-300":""}`,children:n?a.jsx("span",{className:"text-xs text-neutral-300 py-2 pl-8",children:x("No tasks")}):s.map(b=>{const R=r.find(L=>L.id===b.projectId),j=v===b.id,M=i?.has(b.id)??!1;return a.jsx(rh,{task:b,status:l,isSelected:j,isAgentActive:M,project:R,onSelectTask:C,onTaskStatusChange:b.projectArchivedAt?void 0:o,onDeleteTask:b.projectArchivedAt?void 0:p},b.id)})})]})});function nh(e){const t={[le.Review]:[],[le.Running]:[],[le.Pending]:[],[le.Done]:[],[le.Cancelled]:[]};for(const s of e)t[s.status].push(s);return t}const oh=[{status:le.Review,title:"Review",defaultOpen:!0},{status:le.Running,title:"Running",defaultOpen:!0},{status:le.Pending,title:"Pending",defaultOpen:!1},{status:le.Done,title:"Done",defaultOpen:!1},{status:le.Cancelled,title:"Cancelled",defaultOpen:!1}];function Ei({tasks:e=[],projects:t=[],selectedTaskId:s,onSelectTask:l,filterProjectId:m,setFilterProjectId:v,width:C=320,onCreateProject:r,onCreateTask:i,activeTaskIds:c,onTaskStatusChange:f,onDeleteTask:o}){const{t:p}=ce(),[x,S]=k.useState(!1),[g,n]=k.useState(null),[d,h]=k.useState(null),u=Il(Bl(qr,{activationConstraint:{distance:8}})),_=k.useCallback(T=>{const B=T.active.data.current?.task,I=T.active.data.current?.fromStatus;B&&n(B),I&&h(I)},[]),y=k.useCallback(T=>{n(null),h(null);const{active:B,over:I}=T;if(!I)return;const H=B.data.current?.task,W=B.data.current?.fromStatus,A=I.data.current?.status;!H||!W||!A||H.projectArchivedAt||W!==A&&f?.(H.id,A)},[f]),w=m?e.filter(T=>T.projectId===m):e,E=m?t.find(T=>T.id===m)??null:null,b=t.filter(T=>!T.archivedAt),j=!!!E?.archivedAt,M=nh(w),L=C==="100%";return a.jsxs("div",{className:`h-full flex flex-col bg-white flex-shrink-0 ${L?"":"border-r border-neutral-200"}`,style:{width:C},children:[a.jsxs("div",{className:"h-14 flex items-center justify-between px-3 border-b border-neutral-100 flex-shrink-0 relative z-20",children:[a.jsxs("div",{className:"relative flex-1 mr-2",children:[a.jsxs("button",{onClick:()=>S(T=>!T),className:"flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-semibold text-neutral-900 hover:bg-neutral-100 transition-colors w-full text-left group",children:[m&&E?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${E.color.replace("text-","bg-")}`}),a.jsx("span",{className:"truncate",children:E.name})]}):a.jsxs(a.Fragment,{children:[a.jsx(di,{size:16,className:"text-neutral-500 group-hover:text-neutral-800"}),a.jsx("span",{children:p("All Projects")})]}),a.jsx(xt,{size:14,className:`text-neutral-400 ml-auto transition-transform duration-200 ${x?"rotate-180":""}`})]}),x?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>S(!1)}),a.jsxs("div",{className:"absolute left-0 top-full mt-1 w-56 bg-white border border-neutral-200 rounded-lg shadow-xl shadow-neutral-200/50 z-40 py-1 animate-in fade-in zoom-in-95 duration-100 origin-top-left",children:[a.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-neutral-400 uppercase tracking-wider",children:p("Select View")}),a.jsxs("button",{onClick:()=>{v(null),S(!1)},className:"w-full text-left px-3 py-2 text-xs flex items-center justify-between hover:bg-neutral-50 transition-colors group",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-5 h-5 flex items-center justify-center rounded border border-neutral-200 bg-neutral-50 text-neutral-500 group-hover:border-neutral-300",children:a.jsx(di,{size:12})}),a.jsx("span",{className:m===null?"text-neutral-900 font-medium":"text-neutral-600",children:p("All Projects")})]}),m===null?a.jsx(ss,{size:14,className:"text-neutral-900"}):null]}),a.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),b.map(T=>{const B=m===T.id,I=T.color.replace("text-","bg-");return a.jsxs("button",{onClick:()=>{v(T.id),S(!1)},className:"w-full text-left px-3 py-2 text-xs flex items-center justify-between hover:bg-neutral-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-2 h-2 rounded-full ml-1.5 mr-1.5 ${I}`}),a.jsx("span",{className:B?"text-neutral-900 font-medium":"text-neutral-600",children:T.name})]}),B?a.jsx(ss,{size:14,className:"text-neutral-900"}):null]},T.id)}),a.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),a.jsxs("button",{onClick:()=>{S(!1),r?.()},className:"w-full text-left px-3 py-2 text-xs flex items-center gap-2 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-50 transition-colors",children:[a.jsx(xr,{size:14}),a.jsx("span",{children:p("Create New Project...")})]})]})]}):null]}),a.jsx("button",{onClick:i,disabled:!j,className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors flex-shrink-0 disabled:opacity-30 disabled:cursor-not-allowed",title:p(j?"New Task":"Deleted projects are read-only"),children:a.jsx(xr,{size:18})})]}),a.jsxs(Pc,{sensors:u,onDragStart:_,onDragEnd:y,children:[a.jsx("div",{className:"flex-1 overflow-y-auto py-4 relative",children:oh.map(({status:T,title:B,defaultOpen:I})=>a.jsx(ih,{title:B,tasks:M[T],status:T,defaultOpen:I,selectedTaskId:s,onSelectTask:l,projects:t,activeTaskIds:c,isDragging:g!==null,dragFromStatus:d,onTaskStatusChange:f,onDeleteTask:o},T))}),a.jsx(th,{dropAnimation:null,children:g?a.jsx("div",{className:"bg-white shadow-lg rounded-md border border-neutral-200 px-4 py-2 text-sm max-w-[280px] opacity-90",children:a.jsx("span",{className:"text-neutral-700 font-medium",children:g.title})}):null})]}),w.length>0?a.jsxs("div",{className:"p-4 border-t border-neutral-100 text-xs text-neutral-400 flex items-center justify-between",children:[a.jsx("span",{children:p("{count} tasks",{count:w.length})}),m?a.jsx("button",{onClick:()=>v(null),className:"hover:text-neutral-800 underline decoration-neutral-300 underline-offset-2",children:p("Clear filter")}):null]}):a.jsx("div",{className:"p-4 border-t border-neutral-100 text-xs text-neutral-400 flex items-center justify-between",children:a.jsx("span",{children:p("{count} tasks",{count:0})})})]})}const ah={damping:.7,stiffness:.05,mass:1.25},lh=70,ch=1e3/60,hh=350;let Xs=!1;globalThis.document?.addEventListener("mousedown",()=>{Xs=!0});globalThis.document?.addEventListener("mouseup",()=>{Xs=!1});globalThis.document?.addEventListener("click",()=>{Xs=!1});const qn=(e={})=>{const[t,s]=k.useState(!1),[l,m]=k.useState(e.initial!==!1),[v,C]=k.useState(!1),r=k.useRef(null);r.current=e;const i=k.useCallback(()=>{if(!Xs)return!1;const h=window.getSelection();if(!h||!h.rangeCount)return!1;const u=h.getRangeAt(0);return u.commonAncestorContainer.contains(n.current)||n.current?.contains(u.commonAncestorContainer)},[]),c=k.useCallback(h=>{o.isAtBottom=h,m(h)},[]),f=k.useCallback(h=>{o.escapedFromLock=h,s(h)},[]),o=k.useMemo(()=>{let h;return{escapedFromLock:t,isAtBottom:l,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return n.current?.scrollTop??0},set scrollTop(u){n.current&&(n.current.scrollTop=u,o.ignoreScrollToTop=n.current.scrollTop)},get targetScrollTop(){return!n.current||!d.current?0:n.current.scrollHeight-1-n.current.clientHeight},get calculatedTargetScrollTop(){if(!n.current||!d.current)return 0;const{targetScrollTop:u}=this;if(!e.targetScrollTop)return u;if(h?.targetScrollTop===u)return h.calculatedScrollTop;const _=Math.max(Math.min(e.targetScrollTop(u,{scrollElement:n.current,contentElement:d.current}),u),0);return h={targetScrollTop:u,calculatedScrollTop:_},requestAnimationFrame(()=>{h=void 0}),_},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=lh}}},[]),p=k.useCallback((h={})=>{typeof h=="string"&&(h={animation:h}),h.preserveScrollPosition||c(!0);const u=Date.now()+(Number(h.wait)||0),_=lr(r.current,h.animation),{ignoreEscapes:y=!1}=h;let w,E=o.calculatedTargetScrollTop;h.duration instanceof Promise?h.duration.finally(()=>{w=Date.now()}):w=u+(h.duration??0);const b=async()=>{const R=new Promise(requestAnimationFrame).then(()=>{if(!o.isAtBottom)return o.animation=void 0,!1;const{scrollTop:j}=o,M=performance.now(),L=(M-(o.lastTick??M))/ch;if(o.animation||(o.animation={behavior:_,promise:R,ignoreEscapes:y}),o.animation.behavior===_&&(o.lastTick=M),i()||u>Date.now())return b();if(j<Math.min(E,o.calculatedTargetScrollTop)){if(o.animation?.behavior===_){if(_==="instant")return o.scrollTop=o.calculatedTargetScrollTop,b();o.velocity=(_.damping*o.velocity+_.stiffness*o.scrollDifference)/_.mass,o.accumulated+=o.velocity*L,o.scrollTop+=o.accumulated,o.scrollTop!==j&&(o.accumulated=0)}return b()}return w>Date.now()?(E=o.calculatedTargetScrollTop,b()):(o.animation=void 0,o.scrollTop<o.calculatedTargetScrollTop?p({animation:lr(r.current,r.current.resize),ignoreEscapes:y,duration:Math.max(0,w-Date.now())||void 0}):o.isAtBottom)});return R.then(j=>(requestAnimationFrame(()=>{o.animation||(o.lastTick=void 0,o.velocity=0)}),j))};return h.wait!==!0&&(o.animation=void 0),o.animation?.behavior===_?o.animation.promise:b()},[c,i,o]),x=k.useCallback(()=>{f(!0),c(!1)},[f,c]),S=k.useCallback(({target:h})=>{if(h!==n.current)return;const{scrollTop:u,ignoreScrollToTop:_}=o;let{lastScrollTop:y=u}=o;o.lastScrollTop=u,o.ignoreScrollToTop=void 0,_&&_>u&&(y=_),C(o.isNearBottom),setTimeout(()=>{if(o.resizeDifference||u===_)return;if(i()){f(!0),c(!1);return}const w=u>y,E=u<y;if(o.animation?.ignoreEscapes){o.scrollTop=y;return}E&&(f(!0),c(!1)),w&&f(!1),!o.escapedFromLock&&o.isNearBottom&&c(!0)},1)},[f,c,i,o]),g=k.useCallback(({target:h,deltaY:u})=>{let _=h;for(;!["scroll","auto"].includes(getComputedStyle(_).overflow);){if(!_.parentElement)return;_=_.parentElement}_===n.current&&u<0&&n.current.scrollHeight>n.current.clientHeight&&!o.animation?.ignoreEscapes&&(f(!0),c(!1))},[f,c,o]),n=ki(h=>{n.current?.removeEventListener("scroll",S),n.current?.removeEventListener("wheel",g),h?.addEventListener("scroll",S,{passive:!0}),h?.addEventListener("wheel",g,{passive:!0})},[]),d=ki(h=>{if(o.resizeObserver?.disconnect(),!h)return;let u;o.resizeObserver=new ResizeObserver(([_])=>{const{height:y}=_.contentRect,w=y-(u??y);if(o.resizeDifference=w,o.scrollTop>o.targetScrollTop&&(o.scrollTop=o.targetScrollTop),C(o.isNearBottom),w>=0){const E=lr(r.current,u?r.current.resize:r.current.initial);p({animation:E,wait:!0,preserveScrollPosition:!0,duration:E==="instant"?void 0:hh})}else o.isNearBottom&&(f(!1),c(!0));u=y,requestAnimationFrame(()=>{setTimeout(()=>{o.resizeDifference===w&&(o.resizeDifference=0)},1)})}),o.resizeObserver?.observe(h)},[]);return{contentRef:d,scrollRef:n,scrollToBottom:p,stopScroll:x,isAtBottom:l||v,isNearBottom:v,escapedFromLock:t,state:o}};function ki(e,t){const s=k.useCallback(l=>(s.current=l,e(l)),t);return s}const ar=new Map;function lr(...e){const t={...ah};let s=!1;for(const m of e){if(m==="instant"){s=!0;continue}typeof m=="object"&&(s=!1,t.damping=m.damping??t.damping,t.stiffness=m.stiffness??t.stiffness,t.mass=m.mass??t.mass)}const l=JSON.stringify(t);return ar.has(l)||ar.set(l,Object.freeze(t)),s?"instant":ar.get(l)}function uh({content:e,children:t,className:s=""}){return a.jsxs("div",{className:`group/tooltip relative ${s}`,children:[t,a.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-2 bg-neutral-900 text-white text-xs rounded-lg opacity-0 group-hover/tooltip:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-50 shadow-lg",children:[e,a.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-neutral-900"})]})]})}function gs(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function dh(e){return e>=.9?"text-red-500":e>=.7?"text-amber-500":"text-neutral-400"}function Kn({usage:e}){const{t}=ce();if(!e)return null;const s=e.modelContextWindow,l=s?e.totalTokens/s:0,m=s?Math.min(Math.round(l*100),100):null,v=s?dh(l):"text-neutral-400",C=s?a.jsx("span",{children:t("上下文: {used} / {max} tokens",{used:gs(e.totalTokens),max:gs(s)})}):a.jsx("span",{children:t("已使用: {used} tokens",{used:gs(e.totalTokens)})});return a.jsx(uh,{content:C,children:a.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 text-xs rounded-lg hover:bg-neutral-100 transition-colors cursor-default select-none",children:[a.jsx(Ua,{size:14,className:v}),a.jsxs("span",{className:`tabular-nums ${v}`,children:[gs(e.totalTokens),m!==null&&a.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",m,"%"]})]})]})})}var cr={exports:{}},Ri;function fh(){return Ri||(Ri=1,(function(e,t){(function(s,l){e.exports=l()})(self,(()=>(()=>{var s={4567:function(C,r,i){var c=this&&this.__decorate||function(u,_,y,w){var E,b=arguments.length,R=b<3?_:w===null?w=Object.getOwnPropertyDescriptor(_,y):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(u,_,y,w);else for(var j=u.length-1;j>=0;j--)(E=u[j])&&(R=(b<3?E(R):b>3?E(_,y,R):E(_,y))||R);return b>3&&R&&Object.defineProperty(_,y,R),R},f=this&&this.__param||function(u,_){return function(y,w){_(y,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const o=i(9042),p=i(6114),x=i(9924),S=i(844),g=i(5596),n=i(4725),d=i(3656);let h=r.AccessibilityManager=class extends S.Disposable{constructor(u,_){super(),this._terminal=u,this._renderService=_,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let y=0;y<this._terminal.rows;y++)this._rowElements[y]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[y]);if(this._topBoundaryFocusListener=y=>this._handleBoundaryFocus(y,0),this._bottomBoundaryFocusListener=y=>this._handleBoundaryFocus(y,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=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new x.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((y=>this._handleResize(y.rows)))),this.register(this._terminal.onRender((y=>this._refreshRows(y.start,y.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((y=>this._handleChar(y)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
12
12
|
`)))),this.register(this._terminal.onA11yTab((y=>this._handleTab(y)))),this.register(this._terminal.onKey((y=>this._handleKey(y.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new g.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,d.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,S.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(u){for(let _=0;_<u;_++)this._handleChar(" ")}_handleChar(u){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==u&&(this._charsToAnnounce+=u):this._charsToAnnounce+=u,u===`
|
|
13
13
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)),p.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,p.isMac&&this._liveRegion.remove()}_handleKey(u){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(u)||this._charsToConsume.push(u)}_refreshRows(u,_){this._liveRegionDebouncer.refresh(u,_,this._terminal.rows)}_renderRows(u,_){const y=this._terminal.buffer,w=y.lines.length.toString();for(let E=u;E<=_;E++){const b=y.translateBufferLineToString(y.ydisp+E,!0),R=(y.ydisp+E+1).toString(),j=this._rowElements[E];j&&(b.length===0?j.innerText=" ":j.textContent=b,j.setAttribute("aria-posinset",R),j.setAttribute("aria-setsize",w))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(u,_){const y=u.target,w=this._rowElements[_===0?1:this._rowElements.length-2];if(y.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||u.relatedTarget!==w)return;let E,b;if(_===0?(E=y,b=this._rowElements.pop(),this._rowContainer.removeChild(b)):(E=this._rowElements.shift(),b=y,this._rowContainer.removeChild(E)),E.removeEventListener("focus",this._topBoundaryFocusListener),b.removeEventListener("focus",this._bottomBoundaryFocusListener),_===0){const R=this._createAccessibilityTreeNode();this._rowElements.unshift(R),this._rowContainer.insertAdjacentElement("afterbegin",R)}else{const R=this._createAccessibilityTreeNode();this._rowElements.push(R),this._rowContainer.appendChild(R)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(_===0?-1:1),this._rowElements[_===0?1:this._rowElements.length-2].focus(),u.preventDefault(),u.stopImmediatePropagation()}_handleResize(u){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let _=this._rowContainer.children.length;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);for(;this._rowElements.length>u;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const u=document.createElement("div");return u.setAttribute("role","listitem"),u.tabIndex=-1,this._refreshRowDimensions(u),u}_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 u=0;u<this._terminal.rows;u++)this._refreshRowDimensions(this._rowElements[u])}}_refreshRowDimensions(u){u.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=h=c([f(1,n.IRenderService)],h)},3614:(C,r)=>{function i(p){return p.replace(/\r?\n/g,"\r")}function c(p,x){return x?"\x1B[200~"+p+"\x1B[201~":p}function f(p,x,S,g){p=c(p=i(p),S.decPrivateModes.bracketedPasteMode&&g.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(p,!0),x.value=""}function o(p,x,S){const g=S.getBoundingClientRect(),n=p.clientX-g.left-10,d=p.clientY-g.top-10;x.style.width="20px",x.style.height="20px",x.style.left=`${n}px`,x.style.top=`${d}px`,x.style.zIndex="1000",x.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=i,r.bracketTextForPaste=c,r.copyHandler=function(p,x){p.clipboardData&&p.clipboardData.setData("text/plain",x.selectionText),p.preventDefault()},r.handlePasteEvent=function(p,x,S,g){p.stopPropagation(),p.clipboardData&&f(p.clipboardData.getData("text/plain"),x,S,g)},r.paste=f,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(p,x,S,g,n){o(p,x,S),n&&g.rightClickSelect(p),x.value=g.selectionText,x.select()}},7239:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const c=i(1505);r.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(f,o,p){this._css.set(f,o,p)}getCss(f,o){return this._css.get(f,o)}setColor(f,o,p){this._color.set(f,o,p)}getColor(f,o){return this._color.get(f,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(i,c,f,o){i.addEventListener(c,f,o);let p=!1;return{dispose:()=>{p||(p=!0,i.removeEventListener(c,f,o))}}}},6465:function(C,r,i){var c=this&&this.__decorate||function(n,d,h,u){var _,y=arguments.length,w=y<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,h,u);else for(var E=n.length-1;E>=0;E--)(_=n[E])&&(w=(y<3?_(w):y>3?_(d,h,w):_(d,h))||w);return y>3&&w&&Object.defineProperty(d,h,w),w},f=this&&this.__param||function(n,d){return function(h,u){d(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const o=i(3656),p=i(8460),x=i(844),S=i(2585);let g=r.Linkifier2=class extends x.Disposable{get currentLink(){return this._currentLink}constructor(n){super(),this._bufferService=n,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,x.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,x.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(n){return this._linkProviders.push(n),{dispose:()=>{const d=this._linkProviders.indexOf(n);d!==-1&&this._linkProviders.splice(d,1)}}}attachToDom(n,d,h){this._element=n,this._mouseService=d,this._renderService=h,this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){if(this._lastMouseEvent=n,!this._element||!this._mouseService)return;const d=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!d)return;this._isMouseOut=!1;const h=n.composedPath();for(let u=0;u<h.length;u++){const _=h[u];if(_.classList.contains("xterm"))break;if(_.classList.contains("xterm-hover"))return}this._lastBufferCell&&d.x===this._lastBufferCell.x&&d.y===this._lastBufferCell.y||(this._handleHover(d),this._lastBufferCell=d)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,d){var h,u;this._activeProviderReplies&&d||((h=this._activeProviderReplies)===null||h===void 0||h.forEach((y=>{y?.forEach((w=>{w.link.dispose&&w.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=n.y);let _=!1;for(const[y,w]of this._linkProviders.entries())d?!((u=this._activeProviderReplies)===null||u===void 0)&&u.get(y)&&(_=this._checkLinkProviderResult(y,n,_)):w.provideLinks(n.y,(E=>{var b,R;if(this._isMouseOut)return;const j=E?.map((M=>({link:M})));(b=this._activeProviderReplies)===null||b===void 0||b.set(y,j),_=this._checkLinkProviderResult(y,n,_),((R=this._activeProviderReplies)===null||R===void 0?void 0:R.size)===this._linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)}))}_removeIntersectingLinks(n,d){const h=new Set;for(let u=0;u<d.size;u++){const _=d.get(u);if(_)for(let y=0;y<_.length;y++){const w=_[y],E=w.link.range.start.y<n?0:w.link.range.start.x,b=w.link.range.end.y>n?this._bufferService.cols:w.link.range.end.x;for(let R=E;R<=b;R++){if(h.has(R)){_.splice(y--,1);break}h.add(R)}}}}_checkLinkProviderResult(n,d,h){var u;if(!this._activeProviderReplies)return h;const _=this._activeProviderReplies.get(n);let y=!1;for(let w=0;w<n;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(y=!0);if(!y&&_){const w=_.find((E=>this._linkAtPosition(E.link,d)));w&&(h=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviders.length&&!h)for(let w=0;w<this._activeProviderReplies.size;w++){const E=(u=this._activeProviderReplies.get(w))===null||u===void 0?void 0:u.find((b=>this._linkAtPosition(b.link,d)));if(E){h=!0,this._handleNewLink(E);break}}return h}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._element||!this._mouseService||!this._currentLink)return;const d=this._positionFromMouseEvent(n,this._element,this._mouseService);d&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,d)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,d){this._element&&this._currentLink&&this._lastMouseEvent&&(!n||!d||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=d)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,x.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(n.link,d)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var h,u;return(u=(h=this._currentLink)===null||h===void 0?void 0:h.state)===null||u===void 0?void 0:u.decorations.pointerCursor},set:h=>{var u,_;!((u=this._currentLink)===null||u===void 0)&&u.state&&this._currentLink.state.decorations.pointerCursor!==h&&(this._currentLink.state.decorations.pointerCursor=h,this._currentLink.state.isHovered&&((_=this._element)===null||_===void 0||_.classList.toggle("xterm-cursor-pointer",h)))}},underline:{get:()=>{var h,u;return(u=(h=this._currentLink)===null||h===void 0?void 0:h.state)===null||u===void 0?void 0:u.decorations.underline},set:h=>{var u,_,y;!((u=this._currentLink)===null||u===void 0)&&u.state&&((y=(_=this._currentLink)===null||_===void 0?void 0:_.state)===null||y===void 0?void 0:y.decorations.underline)!==h&&(this._currentLink.state.decorations.underline=h,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,h))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((h=>{if(!this._currentLink)return;const u=h.start===0?0:h.start+1+this._bufferService.buffer.ydisp,_=this._bufferService.buffer.ydisp+1+h.end;if(this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=_&&(this._clearCurrentLink(u,_),this._lastMouseEvent&&this._element)){const y=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);y&&this._askForLink(y,!1)}}))))}_linkHover(n,d,h){var u;!((u=this._currentLink)===null||u===void 0)&&u.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),d.hover&&d.hover(h,d.text)}_fireUnderlineEvent(n,d){const h=n.range,u=this._bufferService.buffer.ydisp,_=this._createLinkUnderlineEvent(h.start.x-1,h.start.y-u-1,h.end.x,h.end.y-u-1,void 0);(d?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(_)}_linkLeave(n,d,h){var u;!((u=this._currentLink)===null||u===void 0)&&u.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),d.leave&&d.leave(h,d.text)}_linkAtPosition(n,d){const h=n.range.start.y*this._bufferService.cols+n.range.start.x,u=n.range.end.y*this._bufferService.cols+n.range.end.x,_=d.y*this._bufferService.cols+d.x;return h<=_&&_<=u}_positionFromMouseEvent(n,d,h){const u=h.getCoords(n,d,this._bufferService.cols,this._bufferService.rows);if(u)return{x:u[0],y:u[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,d,h,u,_){return{x1:n,y1:d,x2:h,y2:u,cols:this._bufferService.cols,fg:_}}};r.Linkifier2=g=c([f(0,S.IBufferService)],g)},9042:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(C,r,i){var c=this&&this.__decorate||function(g,n,d,h){var u,_=arguments.length,y=_<3?n:h===null?h=Object.getOwnPropertyDescriptor(n,d):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(g,n,d,h);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(y=(_<3?u(y):_>3?u(n,d,y):u(n,d))||y);return _>3&&y&&Object.defineProperty(n,d,y),y},f=this&&this.__param||function(g,n){return function(d,h){n(d,h,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const o=i(511),p=i(2585);let x=r.OscLinkProvider=class{constructor(g,n,d){this._bufferService=g,this._optionsService=n,this._oscLinkService=d}provideLinks(g,n){var d;const h=this._bufferService.buffer.lines.get(g-1);if(!h)return void n(void 0);const u=[],_=this._optionsService.rawOptions.linkHandler,y=new o.CellData,w=h.getTrimmedLength();let E=-1,b=-1,R=!1;for(let j=0;j<w;j++)if(b!==-1||h.hasContent(j)){if(h.loadCell(j,y),y.hasExtendedAttrs()&&y.extended.urlId){if(b===-1){b=j,E=y.extended.urlId;continue}R=y.extended.urlId!==E}else b!==-1&&(R=!0);if(R||b!==-1&&j===w-1){const M=(d=this._oscLinkService.getLinkData(E))===null||d===void 0?void 0:d.uri;if(M){const L={start:{x:b+1,y:g},end:{x:j+(R||j!==w-1?0:1),y:g}};let T=!1;if(!_?.allowNonHttpProtocols)try{const B=new URL(M);["http:","https:"].includes(B.protocol)||(T=!0)}catch{T=!0}T||u.push({text:M,range:L,activate:(B,I)=>_?_.activate(B,I,L):S(0,I),hover:(B,I)=>{var H;return(H=_?.hover)===null||H===void 0?void 0:H.call(_,B,I,L)},leave:(B,I)=>{var H;return(H=_?.leave)===null||H===void 0?void 0:H.call(_,B,I,L)}})}R=!1,y.hasExtendedAttrs()&&y.extended.urlId?(b=j,E=y.extended.urlId):(b=-1,E=-1)}}n(u)}};function S(g,n){if(confirm(`Do you want to navigate to ${n}?
|
|
14
14
|
|
|
15
|
-
WARNING: This link could potentially be dangerous`)){const d=window.open();if(d){try{d.opener=null}catch{}d.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=x=c([f(0,p.IBufferService),f(1,p.IOptionsService),f(2,p.IOscLinkService)],x)},6193:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(i,c){this._parentWindow=i,this._renderCallback=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(i){return this._refreshCallbacks.push(i),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(i,c,f){this._rowCount=f,i=i!==void 0?i:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,i):i,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,this._animationFrame||(this._animationFrame=this._parentWindow.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();const i=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const i of this._refreshCallbacks)i(0);this._refreshCallbacks=[]}}},5596:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;const c=i(844);class f extends c.Disposable{constructor(p){super(),this._parentWindow=p,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,c.toDisposable)((()=>{this.clearListener()})))}setListener(p){this._listener&&this.clearListener(),this._listener=p,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var p;this._outerListener&&((p=this._resolutionMediaMatchList)===null||p===void 0||p.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._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}r.ScreenDprMonitor=f},3236:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const c=i(3614),f=i(3656),o=i(6465),p=i(9042),x=i(3730),S=i(1680),g=i(3107),n=i(5744),d=i(2950),h=i(1296),u=i(428),_=i(4269),y=i(5114),w=i(8934),E=i(3230),b=i(9312),R=i(4725),j=i(6731),M=i(8055),L=i(8969),T=i(8460),B=i(844),I=i(6114),H=i(8437),W=i(2584),A=i(7399),N=i(5941),P=i(9074),O=i(2585),$=i(5435),X=i(4567),K=typeof window<"u"?window.document:null;class Q extends L.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(D={}){super(D),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new B.MutableDisposable),this._onCursorMove=this.register(new T.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new T.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new T.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new T.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new T.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new T.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new T.EventEmitter),this._onBlur=this.register(new T.EventEmitter),this._onA11yCharEmitter=this.register(new T.EventEmitter),this._onA11yTabEmitter=this.register(new T.EventEmitter),this._onWillOpen=this.register(new T.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(o.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(x.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((F,U)=>this.refresh(F,U)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((F=>this._reportWindowsOptions(F)))),this.register(this._inputHandler.onColor((F=>this._handleColorEvent(F)))),this.register((0,T.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,T.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,T.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,T.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((F=>this._afterResize(F.cols,F.rows)))),this.register((0,B.toDisposable)((()=>{var F,U;this._customKeyEventHandler=void 0,(U=(F=this.element)===null||F===void 0?void 0:F.parentNode)===null||U===void 0||U.removeChild(this.element)})))}_handleColorEvent(D){if(this._themeService)for(const F of D){let U,z="";switch(F.index){case 256:U="foreground",z="10";break;case 257:U="background",z="11";break;case 258:U="cursor",z="12";break;default:U="ansi",z="4;"+F.index}switch(F.type){case 0:const te=M.color.toColorRGB(U==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[U]);this.coreService.triggerDataEvent(`${W.C0.ESC}]${z};${(0,N.toRgbString)(te)}${W.C1_ESCAPED.ST}`);break;case 1:if(U==="ansi")this._themeService.modifyColors((Y=>Y.ansi[F.index]=M.rgba.toColor(...F.color)));else{const Y=U;this._themeService.modifyColors((ie=>ie[Y]=M.rgba.toColor(...F.color)))}break;case 2:this._themeService.restoreColor(F.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(D){D?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(X.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(D){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[I"),this.updateCursorStyle(D),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var D;return(D=this.textarea)===null||D===void 0?void 0:D.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const D=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(D);if(!F)return;const U=Math.min(this.buffer.x,this.cols-1),z=this._renderService.dimensions.css.cell.height,te=F.getWidth(U),Y=this._renderService.dimensions.css.cell.width*te,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,ge=U*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ge+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=Y+"px",this.textarea.style.height=z+"px",this.textarea.style.lineHeight=z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(F=>{this.hasSelection()&&(0,c.copyHandler)(F,this._selectionService)})));const D=F=>(0,c.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",D)),this.register((0,f.addDisposableDomListener)(this.element,"paste",D)),I.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(F=>{F.button===2&&(0,c.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(F=>{(0,c.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),I.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(F=>{F.button===1&&(0,c.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(D=>this._keyUp(D)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(D=>this._keyDown(D)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(D=>this._keyPress(D)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(D=>this._compositionHelper.compositionupdate(D)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(D=>this._inputEvent(D)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(D){var F;if(!D)throw new Error("Terminal requires a parent element.");D.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=D.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),D.appendChild(this.element);const U=K.createDocumentFragment();this._viewportElement=K.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),U.appendChild(this._viewportElement),this._viewportScrollArea=K.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=K.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=K.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),U.appendChild(this.screenElement),this.textarea=K.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),I.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._instantiationService.createInstance(y.CoreBrowserService,this.textarea,(F=this._document.defaultView)!==null&&F!==void 0?F:window),this._instantiationService.setService(R.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(z=>this._handleTextAreaFocus(z)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(R.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(j.ThemeService),this._instantiationService.setService(R.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(_.CharacterJoinerService),this._instantiationService.setService(R.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(E.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(R.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((z=>this._onRender.fire(z)))),this.onResize((z=>this._renderService.resize(z.cols,z.rows))),this._compositionView=K.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.element.appendChild(U);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(R.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((z=>this.scrollLines(z.amount,z.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(b.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(R.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((z=>this.scrollLines(z.amount,z.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((z=>this._renderService.handleSelectionChanged(z.start,z.end,z.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((z=>{this.textarea.value=z,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(g.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(z=>this._selectionService.handleMouseDown(z)))),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(X.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(z=>this._handleScreenReaderModeOptionChange(z)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(n.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(z=>{!this._overviewRulerRenderer&&z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(n.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(h.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const D=this,F=this.element;function U(Y){const ie=D._mouseService.getMouseReportCoords(Y,D.screenElement);if(!ie)return!1;let ge,me;switch(Y.overrideType||Y.type){case"mousemove":me=32,Y.buttons===void 0?(ge=3,Y.button!==void 0&&(ge=Y.button<3?Y.button:3)):ge=1&Y.buttons?0:4&Y.buttons?1:2&Y.buttons?2:3;break;case"mouseup":me=0,ge=Y.button<3?Y.button:3;break;case"mousedown":me=1,ge=Y.button<3?Y.button:3;break;case"wheel":if(D.viewport.getLinesScrolled(Y)===0)return!1;me=Y.deltaY<0?0:1,ge=4;break;default:return!1}return!(me===void 0||ge===void 0||ge>4)&&D.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:ge,action:me,ctrl:Y.ctrlKey,alt:Y.altKey,shift:Y.shiftKey})}const z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},te={mouseup:Y=>(U(Y),Y.buttons||(this._document.removeEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.removeEventListener("mousemove",z.mousedrag)),this.cancel(Y)),wheel:Y=>(U(Y),this.cancel(Y,!0)),mousedrag:Y=>{Y.buttons&&U(Y)},mousemove:Y=>{Y.buttons||U(Y)}};this.register(this.coreMouseService.onProtocolChange((Y=>{Y?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Y)),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&Y?z.mousemove||(F.addEventListener("mousemove",te.mousemove),z.mousemove=te.mousemove):(F.removeEventListener("mousemove",z.mousemove),z.mousemove=null),16&Y?z.wheel||(F.addEventListener("wheel",te.wheel,{passive:!1}),z.wheel=te.wheel):(F.removeEventListener("wheel",z.wheel),z.wheel=null),2&Y?z.mouseup||(F.addEventListener("mouseup",te.mouseup),z.mouseup=te.mouseup):(this._document.removeEventListener("mouseup",z.mouseup),F.removeEventListener("mouseup",z.mouseup),z.mouseup=null),4&Y?z.mousedrag||(z.mousedrag=te.mousedrag):(this._document.removeEventListener("mousemove",z.mousedrag),z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(F,"mousedown",(Y=>{if(Y.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Y))return U(Y),z.mouseup&&this._document.addEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.addEventListener("mousemove",z.mousedrag),this.cancel(Y)}))),this.register((0,f.addDisposableDomListener)(F,"wheel",(Y=>{if(!z.wheel){if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(Y);if(ie===0)return;const ge=W.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Y.deltaY<0?"A":"B");let me="";for(let Me=0;Me<Math.abs(ie);Me++)me+=ge;return this.coreService.triggerDataEvent(me,!0),this.cancel(Y,!0)}return this.viewport.handleWheel(Y)?this.cancel(Y):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(F,"touchstart",(Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Y),this.cancel(Y)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(F,"touchmove",(Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Y)?void 0:this.cancel(Y)}),{passive:!1}))}refresh(D,F){var U;(U=this._renderService)===null||U===void 0||U.refreshRows(D,F)}updateCursorStyle(D){var F;!((F=this._selectionService)===null||F===void 0)&&F.shouldColumnSelect(D)?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(D,F,U=0){var z;U===1?(super.scrollLines(D,F,U),this.refresh(0,this.rows-1)):(z=this.viewport)===null||z===void 0||z.scrollLines(D)}paste(D){(0,c.paste)(D,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(D){this._customKeyEventHandler=D}registerLinkProvider(D){return this.linkifier2.registerLinkProvider(D)}registerCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(D);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(D)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(D){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+D)}registerDecoration(D){return this._decorationService.registerDecoration(D)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(D,F,U){this._selectionService.setSelection(D,F,U)}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(){var D;(D=this._selectionService)===null||D===void 0||D.clearSelection()}selectAll(){var D;(D=this._selectionService)===null||D===void 0||D.selectAll()}selectLines(D,F){var U;(U=this._selectionService)===null||U===void 0||U.selectLines(D,F)}_keyDown(D){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&D.altKey;if(!F&&!this._compositionHelper.keydown(D))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||D.key!=="Dead"&&D.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const U=(0,A.evaluateKeyboardEvent)(D,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(D),U.type===3||U.type===2){const z=this.rows-1;return this.scrollLines(U.type===2?-z:z),this.cancel(D,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,D)||(U.cancel&&this.cancel(D,!0),!U.key||!!(D.key&&!D.ctrlKey&&!D.altKey&&!D.metaKey&&D.key.length===1&&D.key.charCodeAt(0)>=65&&D.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(U.key!==W.C0.ETX&&U.key!==W.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(U.key,!0),!this.optionsService.rawOptions.screenReaderMode||D.altKey||D.ctrlKey?this.cancel(D,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(D,F){const U=D.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||D.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||D.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?U:U&&(!F.keyCode||F.keyCode>47)}_keyUp(D){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1||((function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18})(D)||this.focus(),this.updateCursorStyle(D),this._keyPressHandled=!1)}_keyPress(D){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;if(this.cancel(D),D.charCode)F=D.charCode;else if(D.which===null||D.which===void 0)F=D.keyCode;else{if(D.which===0||D.charCode===0)return!1;F=D.which}return!(!F||(D.altKey||D.ctrlKey||D.metaKey)&&!this._isThirdLevelShift(this.browser,D)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(D){if(D.data&&D.inputType==="insertText"&&(!D.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=D.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(D),!0}return!1}resize(D,F){D!==this.cols||F!==this.rows?super.resize(D,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(D,F){var U,z;(U=this._charSizeService)===null||U===void 0||U.measure(),(z=this.viewport)===null||z===void 0||z.syncScrollArea(!0)}clear(){var D;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 F=1;F<this.rows;F++)this.buffer.lines.push(this.buffer.getBlankLine(H.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(D=this.viewport)===null||D===void 0||D.reset(),this.refresh(0,this.rows-1)}}reset(){var D,F;this.options.rows=this.rows,this.options.cols=this.cols;const U=this._customKeyEventHandler;this._setup(),super.reset(),(D=this._selectionService)===null||D===void 0||D.reset(),this._decorationService.reset(),(F=this.viewport)===null||F===void 0||F.reset(),this._customKeyEventHandler=U,this.refresh(0,this.rows-1)}clearTextureAtlas(){var D;(D=this._renderService)===null||D===void 0||D.clearTextureAtlas()}_reportFocus(){var D;!((D=this.element)===null||D===void 0)&&D.classList.contains("focus")?this.coreService.triggerDataEvent(W.C0.ESC+"[I"):this.coreService.triggerDataEvent(W.C0.ESC+"[O")}_reportWindowsOptions(D){if(this._renderService)switch(D){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),U=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[4;${U};${F}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const z=this._renderService.dimensions.css.cell.width.toFixed(0),te=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[6;${te};${z}t`)}}cancel(D,F){if(this.options.cancelEvents||F)return D.preventDefault(),D.stopPropagation(),!1}}r.Terminal=Q},9924:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(i,c=1e3){this._renderCallback=i,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(i,c,f){this._rowCount=f,i=i!==void 0?i:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,i):i,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=o-this._lastRefreshMs,x=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),x)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const i=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,c)}}},1680:function(C,r,i){var c=this&&this.__decorate||function(d,h,u,_){var y,w=arguments.length,E=w<3?h:_===null?_=Object.getOwnPropertyDescriptor(h,u):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(d,h,u,_);else for(var b=d.length-1;b>=0;b--)(y=d[b])&&(E=(w<3?y(E):w>3?y(h,u,E):y(h,u))||E);return w>3&&E&&Object.defineProperty(h,u,E),E},f=this&&this.__param||function(d,h){return function(u,_){h(u,_,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const o=i(3656),p=i(4725),x=i(8460),S=i(844),g=i(2585);let n=r.Viewport=class extends S.Disposable{constructor(d,h,u,_,y,w,E,b){super(),this._viewportElement=d,this._scrollArea=h,this._bufferService=u,this._optionsService=_,this._charSizeService=y,this._renderService=w,this._coreBrowserService=E,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 x.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((R=>this._activeBuffer=R.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((R=>this._renderDimensions=R))),this._handleThemeChange(b.colors),this.register(b.onChangeColors((R=>this._handleThemeChange(R)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(d){this._viewportElement.style.backgroundColor=d.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(d){if(d)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._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const h=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==h&&(this._lastRecordedBufferHeight=h,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const d=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==d&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=d),this._refreshAnimationFrame=null}syncScrollArea(d=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(d);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(d)}_handleScroll(d){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});const h=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:h,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const d=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(d*(this._smoothScrollState.target-this._smoothScrollState.origin)),d<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(d,h){const u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){const h=this._getPixelsScrolled(d);return h!==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+h:this._smoothScrollState.target+=h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=h,this._bubbleScroll(d,h))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const h=d*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!1})}_getPixelsScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let h=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(d,h){var u;let _,y="";const w=[],E=h??this._bufferService.buffer.lines.length,b=this._bufferService.buffer.lines;for(let R=d;R<E;R++){const j=b.get(R);if(!j)continue;const M=(u=b.get(R+1))===null||u===void 0?void 0:u.isWrapped;if(y+=j.translateToString(!M),!M||R===b.length-1){const L=document.createElement("div");L.textContent=y,w.push(L),y.length>0&&(_=L),y=""}}return{bufferElements:w,cursorElement:_}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let h=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(h/=this._currentRowHeight+0,this._wheelPartialScroll+=h,h=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(d,h){const u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&h.altKey||u==="ctrl"&&h.ctrlKey||u==="shift"&&h.shiftKey?d*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:d*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(d){this._lastTouchY=d.touches[0].pageY}handleTouchMove(d){const h=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(d,h))}};r.Viewport=n=c([f(2,g.IBufferService),f(3,g.IOptionsService),f(4,p.ICharSizeService),f(5,p.IRenderService),f(6,p.ICoreBrowserService),f(7,p.IThemeService)],n)},3107:function(C,r,i){var c=this&&this.__decorate||function(n,d,h,u){var _,y=arguments.length,w=y<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,h,u);else for(var E=n.length-1;E>=0;E--)(_=n[E])&&(w=(y<3?_(w):y>3?_(d,h,w):_(d,h))||w);return y>3&&w&&Object.defineProperty(d,h,w),w},f=this&&this.__param||function(n,d){return function(h,u){d(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const o=i(3656),p=i(4725),x=i(844),S=i(2585);let g=r.BufferDecorationRenderer=class extends x.Disposable{constructor(n,d,h,u){super(),this._screenElement=n,this._bufferService=d,this._decorationService=h,this._renderService=u,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((0,o.addDisposableDomListener)(window,"resize",(()=>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((_=>this._removeDecoration(_)))),this.register((0,x.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(const n of this._decorationService.decorations)this._renderDecoration(n);this._dimensionsChanged=!1}_renderDecoration(n){this._refreshStyle(n),this._dimensionsChanged&&this._refreshXPosition(n)}_createElement(n){var d,h;const u=document.createElement("div");u.classList.add("xterm-decoration"),u.classList.toggle("xterm-decoration-top-layer",((d=n?.options)===null||d===void 0?void 0:d.layer)==="top"),u.style.width=`${Math.round((n.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,u.style.height=(n.options.height||1)*this._renderService.dimensions.css.cell.height+"px",u.style.top=(n.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",u.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=(h=n.options.x)!==null&&h!==void 0?h:0;return _&&_>this._bufferService.cols&&(u.style.display="none"),this._refreshXPosition(n,u),u}_refreshStyle(n){const d=n.marker.line-this._bufferService.buffers.active.ydisp;if(d<0||d>=this._bufferService.rows)n.element&&(n.element.style.display="none",n.onRenderEmitter.fire(n.element));else{let h=this._decorationElements.get(n);h||(h=this._createElement(n),n.element=h,this._decorationElements.set(n,h),this._container.appendChild(h),n.onDispose((()=>{this._decorationElements.delete(n),h.remove()}))),h.style.top=d*this._renderService.dimensions.css.cell.height+"px",h.style.display=this._altBufferIsActive?"none":"block",n.onRenderEmitter.fire(h)}}_refreshXPosition(n,d=n.element){var h;if(!d)return;const u=(h=n.options.x)!==null&&h!==void 0?h:0;(n.options.anchor||"left")==="right"?d.style.right=u?u*this._renderService.dimensions.css.cell.width+"px":"":d.style.left=u?u*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(n){var d;(d=this._decorationElements.get(n))===null||d===void 0||d.remove(),this._decorationElements.delete(n),n.dispose()}};r.BufferDecorationRenderer=g=c([f(1,S.IBufferService),f(2,S.IDecorationService),f(3,p.IRenderService)],g)},5871:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.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(i){if(i.options.overviewRulerOptions){for(const c of this._zones)if(c.color===i.options.overviewRulerOptions.color&&c.position===i.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,i.marker.line))return;if(this._lineAdjacentToZone(c,i.marker.line,i.options.overviewRulerOptions.position))return void this._addLineToZone(c,i.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=i.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=i.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=i.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=i.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:i.options.overviewRulerOptions.color,position:i.options.overviewRulerOptions.position,startBufferLine:i.marker.line,endBufferLine:i.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(i){this._linePadding=i}_lineIntersectsZone(i,c){return c>=i.startBufferLine&&c<=i.endBufferLine}_lineAdjacentToZone(i,c,f){return c>=i.startBufferLine-this._linePadding[f||"full"]&&c<=i.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(i,c){i.startBufferLine=Math.min(i.startBufferLine,c),i.endBufferLine=Math.max(i.endBufferLine,c)}}},5744:function(C,r,i){var c=this&&this.__decorate||function(_,y,w,E){var b,R=arguments.length,j=R<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(_,y,w,E);else for(var M=_.length-1;M>=0;M--)(b=_[M])&&(j=(R<3?b(j):R>3?b(y,w,j):b(y,w))||j);return R>3&&j&&Object.defineProperty(y,w,j),j},f=this&&this.__param||function(_,y){return function(w,E){y(w,E,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const o=i(5871),p=i(3656),x=i(4725),S=i(844),g=i(2585),n={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0};let u=r.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(_,y,w,E,b,R,j){var M;super(),this._viewportElement=_,this._screenElement=y,this._bufferService=w,this._decorationService=E,this._renderService=b,this._optionsService=R,this._coreBrowseService=j,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(M=this._viewportElement.parentElement)===null||M===void 0||M.insertBefore(this._canvas,this._viewportElement);const L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,S.toDisposable)((()=>{var T;(T=this._canvas)===null||T===void 0||T.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((0,p.addDisposableDomListener)(this._coreBrowseService.window,"resize",(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const _=Math.floor(this._canvas.width/3),y=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=_,d.center=y,d.right=_,this._refreshDrawHeightConstants(),h.full=0,h.left=0,h.center=d.left,h.right=d.left+d.center}_refreshDrawHeightConstants(){n.full=Math.round(2*this._coreBrowseService.dpr);const _=this._canvas.height/this._bufferService.buffer.lines.length,y=Math.round(Math.max(Math.min(_,12),6)*this._coreBrowseService.dpr);n.left=y,n.center=y,n.right=y}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.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(const y of this._decorationService.decorations)this._colorZoneStore.addDecoration(y);this._ctx.lineWidth=1;const _=this._colorZoneStore.zones;for(const y of _)y.position!=="full"&&this._renderColorZone(y);for(const y of _)y.position==="full"&&this._renderColorZone(y);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(_){this._ctx.fillStyle=_.color,this._ctx.fillRect(h[_.position||"full"],Math.round((this._canvas.height-1)*(_.startBufferLine/this._bufferService.buffers.active.lines.length)-n[_.position||"full"]/2),d[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+n[_.position||"full"]))}_queueRefresh(_,y){this._shouldUpdateDimensions=_||this._shouldUpdateDimensions,this._shouldUpdateAnchor=y||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=u=c([f(2,g.IBufferService),f(3,g.IDecorationService),f(4,x.IRenderService),f(5,g.IOptionsService),f(6,x.ICoreBrowserService)],u)},2950:function(C,r,i){var c=this&&this.__decorate||function(g,n,d,h){var u,_=arguments.length,y=_<3?n:h===null?h=Object.getOwnPropertyDescriptor(n,d):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(g,n,d,h);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(y=(_<3?u(y):_>3?u(n,d,y):u(n,d))||y);return _>3&&y&&Object.defineProperty(n,d,y),y},f=this&&this.__param||function(g,n){return function(d,h){n(d,h,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const o=i(4725),p=i(2585),x=i(2584);let S=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,n,d,h,u,_){this._textarea=g,this._compositionView=n,this._bufferService=d,this._optionsService=h,this._coreService=u,this._renderService=_,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(g){this._compositionView.textContent=g.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(g){if(this._isComposing||this._isSendingComposition){if(g.keyCode===229||g.keyCode===16||g.keyCode===17||g.keyCode===18)return!1;this._finalizeComposition(!1)}return g.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(g){if(this._compositionView.classList.remove("active"),this._isComposing=!1,g){const n={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,n.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(n.start,n.end):this._textarea.value.substring(n.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;const n=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(n,!0)}}_handleAnyTextareaChanges(){const g=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const n=this._textarea.value,d=n.replace(g,"");this._dataAlreadySent=d,n.length>g.length?this._coreService.triggerDataEvent(d,!0):n.length<g.length?this._coreService.triggerDataEvent(`${x.C0.DEL}`,!0):n.length===g.length&&n!==g&&this._coreService.triggerDataEvent(n,!0)}}),0)}updateCompositionElements(g){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const n=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,h=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=n*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=h+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const _=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=h+"px",this._textarea.style.width=Math.max(_.width,1)+"px",this._textarea.style.height=Math.max(_.height,1)+"px",this._textarea.style.lineHeight=_.height+"px"}g||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=S=c([f(2,p.IBufferService),f(3,p.IOptionsService),f(4,p.ICoreService),f(5,o.IRenderService)],S)},9806:(C,r)=>{function i(c,f,o){const p=o.getBoundingClientRect(),x=c.getComputedStyle(o),S=parseInt(x.getPropertyValue("padding-left")),g=parseInt(x.getPropertyValue("padding-top"));return[f.clientX-p.left-S,f.clientY-p.top-g]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=i,r.getCoords=function(c,f,o,p,x,S,g,n,d){if(!S)return;const h=i(c,f,o);return h?(h[0]=Math.ceil((h[0]+(d?g/2:0))/g),h[1]=Math.ceil(h[1]/n),h[0]=Math.min(Math.max(h[0],1),p+(d?1:0)),h[1]=Math.min(Math.max(h[1],1),x),h):void 0}},9504:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const c=i(2584);function f(n,d,h,u){const _=n-o(n,h),y=d-o(d,h),w=Math.abs(_-y)-(function(E,b,R){let j=0;const M=E-o(E,R),L=b-o(b,R);for(let T=0;T<Math.abs(M-L);T++){const B=p(E,b)==="A"?-1:1,I=R.buffer.lines.get(M+B*T);I?.isWrapped&&j++}return j})(n,d,h);return g(w,S(p(n,d),u))}function o(n,d){let h=0,u=d.buffer.lines.get(n),_=u?.isWrapped;for(;_&&n>=0&&n<d.rows;)h++,u=d.buffer.lines.get(--n),_=u?.isWrapped;return h}function p(n,d){return n>d?"A":"B"}function x(n,d,h,u,_,y){let w=n,E=d,b="";for(;w!==h||E!==u;)w+=_?1:-1,_&&w>y.cols-1?(b+=y.buffer.translateBufferLineToString(E,!1,n,w),w=0,n=0,E++):!_&&w<0&&(b+=y.buffer.translateBufferLineToString(E,!1,0,n+1),w=y.cols-1,n=w,E--);return b+y.buffer.translateBufferLineToString(E,!1,n,w)}function S(n,d){const h=d?"O":"[";return c.C0.ESC+h+n}function g(n,d){n=Math.floor(n);let h="";for(let u=0;u<n;u++)h+=d;return h}r.moveToCellSequence=function(n,d,h,u){const _=h.buffer.x,y=h.buffer.y;if(!h.buffer.hasScrollback)return(function(b,R,j,M,L,T){return f(R,M,L,T).length===0?"":g(x(b,R,b,R-o(R,L),!1,L).length,S("D",T))})(_,y,0,d,h,u)+f(y,d,h,u)+(function(b,R,j,M,L,T){let B;B=f(R,M,L,T).length>0?M-o(M,L):R;const I=M,H=(function(W,A,N,P,O,$){let X;return X=f(N,P,O,$).length>0?P-o(P,O):A,W<N&&X<=P||W>=N&&X<P?"C":"D"})(b,R,j,M,L,T);return g(x(b,B,j,I,H==="C",L).length,S(H,T))})(_,y,n,d,h,u);let w;if(y===d)return w=_>n?"D":"C",g(Math.abs(_-n),S(w,u));w=y>d?"D":"C";const E=Math.abs(y-d);return g((function(b,R){return R.cols-b})(y>d?n:_,h)+(E-1)*h.cols+1+((y>d?_:n)-1),S(w,u))}},1296:function(C,r,i){var c=this&&this.__decorate||function(L,T,B,I){var H,W=arguments.length,A=W<3?T:I===null?I=Object.getOwnPropertyDescriptor(T,B):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(L,T,B,I);else for(var N=L.length-1;N>=0;N--)(H=L[N])&&(A=(W<3?H(A):W>3?H(T,B,A):H(T,B))||A);return W>3&&A&&Object.defineProperty(T,B,A),A},f=this&&this.__param||function(L,T){return function(B,I){T(B,I,L)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const o=i(3787),p=i(2550),x=i(2223),S=i(6171),g=i(4725),n=i(8055),d=i(8460),h=i(844),u=i(2585),_="xterm-dom-renderer-owner-",y="xterm-rows",w="xterm-fg-",E="xterm-bg-",b="xterm-focus",R="xterm-selection";let j=1,M=r.DomRenderer=class extends h.Disposable{constructor(L,T,B,I,H,W,A,N,P,O){super(),this._element=L,this._screenElement=T,this._viewportElement=B,this._linkifier2=I,this._charSizeService=W,this._optionsService=A,this._bufferService=N,this._coreBrowserService=P,this._themeService=O,this._terminalClass=j++,this._rowElements=[],this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(y),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(R),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors(($=>this._injectCss($)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(($=>this._handleLinkHover($)))),this.register(this._linkifier2.onHideLinkUnderline(($=>this._handleLinkLeave($)))),this.register((0,h.toDisposable)((()=>{this._element.classList.remove(_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new p.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const L=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*L,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*L),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/L),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/L),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(const B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const T=`${this._terminalSelector} .${y} 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(L){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let T=`${this._terminalSelector} .${y} { color: ${L.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;T+=`${this._terminalSelector} .${y} .xterm-dim { color: ${n.color.multiplyOpacity(L.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;}`,T+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",T+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css}; } 50% { background-color: inherit; color: ${L.cursor.css}; }}`,T+=`${this._terminalSelector} .${y}.${b} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${y}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${y} .xterm-cursor.xterm-cursor-block { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css};}${this._terminalSelector} .${y} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${L.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${y} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${L.cursor.css} inset;}${this._terminalSelector} .${y} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${L.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,T+=`${this._terminalSelector} .${R} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${R} div { position: absolute; background-color: ${L.selectionBackgroundOpaque.css};}${this._terminalSelector} .${R} div { position: absolute; background-color: ${L.selectionInactiveBackgroundOpaque.css};}`;for(const[B,I]of L.ansi.entries())T+=`${this._terminalSelector} .${w}${B} { color: ${I.css}; }${this._terminalSelector} .${w}${B}.xterm-dim { color: ${n.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${E}${B} { background-color: ${I.css}; }`;T+=`${this._terminalSelector} .${w}${x.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(L.background).css}; }${this._terminalSelector} .${w}${x.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(L.background),.5).css}; }${this._terminalSelector} .${E}${x.INVERTED_DEFAULT_COLOR} { background-color: ${L.foreground.css}; }`,this._themeStyleElement.textContent=T}_setDefaultSpacing(){const L=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${L}px`,this._rowFactory.defaultSpacing=L}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(L,T){for(let B=this._rowElements.length;B<=T;B++){const I=document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>T;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(L,T){this._refreshRowElements(L,T),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(b)}handleFocus(){this._rowContainer.classList.add(b),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(L,T,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(L,T,B),this.renderRows(0,this._bufferService.rows-1),!L||!T)return;const I=L[1]-this._bufferService.buffer.ydisp,H=T[1]-this._bufferService.buffer.ydisp,W=Math.max(I,0),A=Math.min(H,this._bufferService.rows-1);if(W>=this._bufferService.rows||A<0)return;const N=document.createDocumentFragment();if(B){const P=L[0]>T[0];N.appendChild(this._createSelectionElement(W,P?T[0]:L[0],P?L[0]:T[0],A-W+1))}else{const P=I===W?L[0]:0,O=W===H?T[0]:this._bufferService.cols;N.appendChild(this._createSelectionElement(W,P,O));const $=A-W-1;if(N.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,$)),W!==A){const X=H===A?T[0]:this._bufferService.cols;N.appendChild(this._createSelectionElement(A,0,X))}}this._selectionContainer.appendChild(N)}_createSelectionElement(L,T,B,I=1){const H=document.createElement("div");return H.style.height=I*this.dimensions.css.cell.height+"px",H.style.top=L*this.dimensions.css.cell.height+"px",H.style.left=T*this.dimensions.css.cell.width+"px",H.style.width=this.dimensions.css.cell.width*(B-T)+"px",H}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(const L of this._rowElements)L.replaceChildren()}renderRows(L,T){const B=this._bufferService.buffer,I=B.ybase+B.y,H=Math.min(B.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,A=this._optionsService.rawOptions.cursorStyle,N=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=L;P<=T;P++){const O=P+B.ydisp,$=this._rowElements[P],X=B.lines.get(O);if(!$||!X)break;$.replaceChildren(...this._rowFactory.createRow(X,O,O===I,A,N,H,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_}${this._terminalClass}`}_handleLinkHover(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!0)}_handleLinkLeave(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!1)}_setCellUnderline(L,T,B,I,H,W){B<0&&(L=0),I<0&&(T=0);const A=this._bufferService.rows-1;B=Math.max(Math.min(B,A),0),I=Math.max(Math.min(I,A),0),H=Math.min(H,this._bufferService.cols);const N=this._bufferService.buffer,P=N.ybase+N.y,O=Math.min(N.x,H-1),$=this._optionsService.rawOptions.cursorBlink,X=this._optionsService.rawOptions.cursorStyle,K=this._optionsService.rawOptions.cursorInactiveStyle;for(let Q=B;Q<=I;++Q){const se=Q+N.ydisp,D=this._rowElements[Q],F=N.lines.get(se);if(!D||!F)break;D.replaceChildren(...this._rowFactory.createRow(F,se,se===P,X,K,O,$,this.dimensions.css.cell.width,this._widthCache,W?Q===B?L:0:-1,W?(Q===I?T:H)-1:-1))}}};r.DomRenderer=M=c([f(4,u.IInstantiationService),f(5,g.ICharSizeService),f(6,u.IOptionsService),f(7,u.IBufferService),f(8,g.ICoreBrowserService),f(9,g.IThemeService)],M)},3787:function(C,r,i){var c=this&&this.__decorate||function(w,E,b,R){var j,M=arguments.length,L=M<3?E:R===null?R=Object.getOwnPropertyDescriptor(E,b):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,E,b,R);else for(var T=w.length-1;T>=0;T--)(j=w[T])&&(L=(M<3?j(L):M>3?j(E,b,L):j(E,b))||L);return M>3&&L&&Object.defineProperty(E,b,L),L},f=this&&this.__param||function(w,E){return function(b,R){E(b,R,w)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const o=i(2223),p=i(643),x=i(511),S=i(2585),g=i(8055),n=i(4725),d=i(4269),h=i(6171),u=i(3734);let _=r.DomRendererRowFactory=class{constructor(w,E,b,R,j,M,L){this._document=w,this._characterJoinerService=E,this._optionsService=b,this._coreBrowserService=R,this._coreService=j,this._decorationService=M,this._themeService=L,this._workCell=new x.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,E,b){this._selectionStart=w,this._selectionEnd=E,this._columnSelectMode=b}createRow(w,E,b,R,j,M,L,T,B,I,H){const W=[],A=this._characterJoinerService.getJoinedCharacters(E),N=this._themeService.colors;let P,O=w.getNoBgTrimmedLength();b&&O<M+1&&(O=M+1);let $=0,X="",K=0,Q=0,se=0,D=!1,F=0,U=!1,z=0;const te=[],Y=I!==-1&&H!==-1;for(let ie=0;ie<O;ie++){w.loadCell(ie,this._workCell);let ge=this._workCell.getWidth();if(ge===0)continue;let me=!1,Me=ie,re=this._workCell;if(A.length>0&&ie===A[0][0]){me=!0;const Z=A.shift();re=new d.JoinedCellData(this._workCell,w.translateToString(!0,Z[0],Z[1]),Z[1]-Z[0]),Me=Z[1]-1,ge=re.getWidth()}const Be=this._isCellInSelection(ie,E),Ce=b&&ie===M,oe=Y&&ie>=I&&ie<=H;let Ne=!1;this._decorationService.forEachDecorationAtCell(ie,E,void 0,(Z=>{Ne=!0}));let qe=re.getChars()||p.WHITESPACE_CELL_CHAR;if(qe===" "&&(re.isUnderline()||re.isOverline())&&(qe=" "),z=ge*T-B.get(qe,re.isBold(),re.isItalic()),P){if($&&(Be&&U||!Be&&!U&&re.bg===K)&&(Be&&U&&N.selectionForeground||re.fg===Q)&&re.extended.ext===se&&oe===D&&z===F&&!Ce&&!me&&!Ne){X+=qe,$++;continue}$&&(P.textContent=X),P=this._document.createElement("span"),$=0,X=""}else P=this._document.createElement("span");if(K=re.bg,Q=re.fg,se=re.extended.ext,D=oe,F=z,U=Be,me&&M>=ie&&M<=Me&&(M=ie),!this._coreService.isCursorHidden&&Ce){if(te.push("xterm-cursor"),this._coreBrowserService.isFocused)L&&te.push("xterm-cursor-blink"),te.push(R==="bar"?"xterm-cursor-bar":R==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(j)switch(j){case"outline":te.push("xterm-cursor-outline");break;case"block":te.push("xterm-cursor-block");break;case"bar":te.push("xterm-cursor-bar");break;case"underline":te.push("xterm-cursor-underline")}}if(re.isBold()&&te.push("xterm-bold"),re.isItalic()&&te.push("xterm-italic"),re.isDim()&&te.push("xterm-dim"),X=re.isInvisible()?p.WHITESPACE_CELL_CHAR:re.getChars()||p.WHITESPACE_CELL_CHAR,re.isUnderline()&&(te.push(`xterm-underline-${re.extended.underlineStyle}`),X===" "&&(X=" "),!re.isUnderlineColorDefault()))if(re.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(re.getUnderlineColor()).join(",")})`;else{let Z=re.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&re.isBold()&&Z<8&&(Z+=8),P.style.textDecorationColor=N.ansi[Z].css}re.isOverline()&&(te.push("xterm-overline"),X===" "&&(X=" ")),re.isStrikethrough()&&te.push("xterm-strikethrough"),oe&&(P.style.textDecoration="underline");let Re=re.getFgColor(),Ve=re.getFgColorMode(),be=re.getBgColor(),st=re.getBgColorMode();const Ke=!!re.isInverse();if(Ke){const Z=Re;Re=be,be=Z;const xe=Ve;Ve=st,st=xe}let Pe,Oe,De,V=!1;switch(this._decorationService.forEachDecorationAtCell(ie,E,void 0,(Z=>{Z.options.layer!=="top"&&V||(Z.backgroundColorRGB&&(st=50331648,be=Z.backgroundColorRGB.rgba>>8&16777215,Pe=Z.backgroundColorRGB),Z.foregroundColorRGB&&(Ve=50331648,Re=Z.foregroundColorRGB.rgba>>8&16777215,Oe=Z.foregroundColorRGB),V=Z.options.layer==="top")})),!V&&Be&&(Pe=this._coreBrowserService.isFocused?N.selectionBackgroundOpaque:N.selectionInactiveBackgroundOpaque,be=Pe.rgba>>8&16777215,st=50331648,V=!0,N.selectionForeground&&(Ve=50331648,Re=N.selectionForeground.rgba>>8&16777215,Oe=N.selectionForeground)),V&&te.push("xterm-decoration-top"),st){case 16777216:case 33554432:De=N.ansi[be],te.push(`xterm-bg-${be}`);break;case 50331648:De=g.rgba.toColor(be>>16,be>>8&255,255&be),this._addStyle(P,`background-color:#${y((be>>>0).toString(16),"0",6)}`);break;default:Ke?(De=N.foreground,te.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):De=N.background}switch(Pe||re.isDim()&&(Pe=g.color.multiplyOpacity(De,.5)),Ve){case 16777216:case 33554432:re.isBold()&&Re<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Re+=8),this._applyMinimumContrast(P,De,N.ansi[Re],re,Pe,void 0)||te.push(`xterm-fg-${Re}`);break;case 50331648:const Z=g.rgba.toColor(Re>>16&255,Re>>8&255,255&Re);this._applyMinimumContrast(P,De,Z,re,Pe,Oe)||this._addStyle(P,`color:#${y(Re.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,De,N.foreground,re,Pe,void 0)||Ke&&te.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}te.length&&(P.className=te.join(" "),te.length=0),Ce||me||Ne?P.textContent=X:$++,z!==this.defaultSpacing&&(P.style.letterSpacing=`${z}px`),W.push(P),ie=Me}return P&&$&&(P.textContent=X),W}_applyMinimumContrast(w,E,b,R,j,M){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.excludeFromContrastRatioDemands)(R.getCode()))return!1;const L=this._getContrastCache(R);let T;if(j||M||(T=L.getColor(E.rgba,b.rgba)),T===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(R.isDim()?2:1);T=g.color.ensureContrastRatio(j||E,M||b,B),L.setColor((j||E).rgba,(M||b).rgba,T??null)}return!!T&&(this._addStyle(w,`color:${T.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,E){w.setAttribute("style",`${w.getAttribute("style")||""}${E};`)}_isCellInSelection(w,E){const b=this._selectionStart,R=this._selectionEnd;return!(!b||!R)&&(this._columnSelectMode?b[0]<=R[0]?w>=b[0]&&E>=b[1]&&w<R[0]&&E<=R[1]:w<b[0]&&E>=b[1]&&w>=R[0]&&E<=R[1]:E>b[1]&&E<R[1]||b[1]===R[1]&&E===b[1]&&w>=b[0]&&w<R[0]||b[1]<R[1]&&E===R[1]&&w<R[0]||b[1]<R[1]&&E===b[1]&&w>=b[0])}};function y(w,E,b){for(;w.length<b;)w=E+w;return w}r.DomRendererRowFactory=_=c([f(1,n.ICharacterJoinerService),f(2,S.IOptionsService),f(3,n.ICoreBrowserService),f(4,S.ICoreService),f(5,S.IDecorationService),f(6,n.IThemeService)],_)},2550:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=i.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const c=i.createElement("span"),f=i.createElement("span");f.style.fontWeight="bold";const o=i.createElement("span");o.style.fontStyle="italic";const p=i.createElement("span");p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[c,f,o,p],this._container.appendChild(c),this._container.appendChild(f),this._container.appendChild(o),this._container.appendChild(p),i.body.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(i,c,f,o){i===this._font&&c===this._fontSize&&f===this._weight&&o===this._weightBold||(this._font=i,this._fontSize=c,this._weight=f,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(i,c,f){let o=0;if(!c&&!f&&i.length===1&&(o=i.charCodeAt(0))<256)return this._flat[o]!==-9999?this._flat[o]:this._flat[o]=this._measure(i,0);let p=i;c&&(p+="B"),f&&(p+="I");let x=this._holey.get(p);if(x===void 0){let S=0;c&&(S|=1),f&&(S|=2),x=this._measure(i,S),this._holey.set(p,x)}return x}_measure(i,c){const f=this._measureElements[c];return f.textContent=i.repeat(32),f.offsetWidth/32}}},2223:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const c=i(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(C,r)=>{function i(c){return 57508<=c&&c<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.createRenderDimensions=r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(c){if(!c)throw new Error("value must not be falsy");return c},r.isPowerlineGlyph=i,r.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},r.excludeFromContrastRatioDemands=function(c){return i(c)||(function(f){return 9472<=f&&f<=9631})(c)},r.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}}}}},456:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(i){this._bufferService=i,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()){const i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?i%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)-1]:[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[i,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[Math.max(i,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const i=this.selectionStart,c=this.selectionEnd;return!(!i||!c)&&(i[1]>c[1]||i[1]===c[1]&&i[0]>c[0])}handleTrim(i){return this.selectionStart&&(this.selectionStart[1]-=i),this.selectionEnd&&(this.selectionEnd[1]-=i),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(C,r,i){var c=this&&this.__decorate||function(n,d,h,u){var _,y=arguments.length,w=y<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,h,u);else for(var E=n.length-1;E>=0;E--)(_=n[E])&&(w=(y<3?_(w):y>3?_(d,h,w):_(d,h))||w);return y>3&&w&&Object.defineProperty(d,h,w),w},f=this&&this.__param||function(n,d){return function(h,u){d(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const o=i(2585),p=i(8460),x=i(844);let S=r.CharSizeService=class extends x.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(n,d,h){super(),this._optionsService=h,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new g(n,d,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const n=this._measureStrategy.measure();n.width===this.width&&n.height===this.height||(this.width=n.width,this.height=n.height,this._onCharSizeChange.fire())}};r.CharSizeService=S=c([f(2,o.IOptionsService)],S);class g{constructor(d,h,u){this._document=d,this._parentElement=h,this._optionsService=u,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const d={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return d.width!==0&&d.height!==0&&(this._result.width=d.width/32,this._result.height=Math.ceil(d.height)),this._result}}},4269:function(C,r,i){var c=this&&this.__decorate||function(d,h,u,_){var y,w=arguments.length,E=w<3?h:_===null?_=Object.getOwnPropertyDescriptor(h,u):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(d,h,u,_);else for(var b=d.length-1;b>=0;b--)(y=d[b])&&(E=(w<3?y(E):w>3?y(h,u,E):y(h,u))||E);return w>3&&E&&Object.defineProperty(h,u,E),E},f=this&&this.__param||function(d,h){return function(u,_){h(u,_,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const o=i(3734),p=i(643),x=i(511),S=i(2585);class g extends o.AttributeData{constructor(h,u,_){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=u,this._width=_}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(h){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=g;let n=r.CharacterJoinerService=class Xn{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new x.CellData}register(h){const u={id:this._nextCharacterJoinerId++,handler:h};return this._characterJoiners.push(u),u.id}deregister(h){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===h)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(h){if(this._characterJoiners.length===0)return[];const u=this._bufferService.buffer.lines.get(h);if(!u||u.length===0)return[];const _=[],y=u.translateToString(!0);let w=0,E=0,b=0,R=u.getFg(0),j=u.getBg(0);for(let M=0;M<u.getTrimmedLength();M++)if(u.loadCell(M,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==R||this._workCell.bg!==j){if(M-w>1){const L=this._getJoinedRanges(y,b,E,u,w);for(let T=0;T<L.length;T++)_.push(L[T])}w=M,b=E,R=this._workCell.fg,j=this._workCell.bg}E+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){const M=this._getJoinedRanges(y,b,E,u,w);for(let L=0;L<M.length;L++)_.push(M[L])}return _}_getJoinedRanges(h,u,_,y,w){const E=h.substring(u,_);let b=[];try{b=this._characterJoiners[0].handler(E)}catch(R){console.error(R)}for(let R=1;R<this._characterJoiners.length;R++)try{const j=this._characterJoiners[R].handler(E);for(let M=0;M<j.length;M++)Xn._mergeRanges(b,j[M])}catch(j){console.error(j)}return this._stringRangesToCellRanges(b,y,w),b}_stringRangesToCellRanges(h,u,_){let y=0,w=!1,E=0,b=h[y];if(b){for(let R=_;R<this._bufferService.cols;R++){const j=u.getWidth(R),M=u.getString(R).length||p.WHITESPACE_CELL_CHAR.length;if(j!==0){if(!w&&b[0]<=E&&(b[0]=R,w=!0),b[1]<=E){if(b[1]=R,b=h[++y],!b)break;b[0]<=E?(b[0]=R,w=!0):w=!1}E+=M}}b&&(b[1]=this._bufferService.cols)}}static _mergeRanges(h,u){let _=!1;for(let y=0;y<h.length;y++){const w=h[y];if(_){if(u[1]<=w[0])return h[y-1][1]=u[1],h;if(u[1]<=w[1])return h[y-1][1]=Math.max(u[1],w[1]),h.splice(y,1),h;h.splice(y,1),y--}else{if(u[1]<=w[0])return h.splice(y,0,u),h;if(u[1]<=w[1])return w[0]=Math.min(u[0],w[0]),h;u[0]<w[1]&&(w[0]=Math.min(u[0],w[0]),_=!0)}}return _?h[h.length-1][1]=u[1]:h.push(u),h}};r.CharacterJoinerService=n=c([f(0,S.IBufferService)],n)},5114:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(i,c){this._textarea=i,this.window=c,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}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}}},8934:function(C,r,i){var c=this&&this.__decorate||function(S,g,n,d){var h,u=arguments.length,_=u<3?g:d===null?d=Object.getOwnPropertyDescriptor(g,n):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(S,g,n,d);else for(var y=S.length-1;y>=0;y--)(h=S[y])&&(_=(u<3?h(_):u>3?h(g,n,_):h(g,n))||_);return u>3&&_&&Object.defineProperty(g,n,_),_},f=this&&this.__param||function(S,g){return function(n,d){g(n,d,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const o=i(4725),p=i(9806);let x=r.MouseService=class{constructor(S,g){this._renderService=S,this._charSizeService=g}getCoords(S,g,n,d,h){return(0,p.getCoords)(window,S,g,n,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,h)}getMouseReportCoords(S,g){const n=(0,p.getCoordsRelativeToElement)(window,S,g);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])}}};r.MouseService=x=c([f(0,o.IRenderService),f(1,o.ICharSizeService)],x)},3230:function(C,r,i){var c=this&&this.__decorate||function(_,y,w,E){var b,R=arguments.length,j=R<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(_,y,w,E);else for(var M=_.length-1;M>=0;M--)(b=_[M])&&(j=(R<3?b(j):R>3?b(y,w,j):b(y,w))||j);return R>3&&j&&Object.defineProperty(y,w,j),j},f=this&&this.__param||function(_,y){return function(w,E){y(w,E,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const o=i(3656),p=i(6193),x=i(5596),S=i(4725),g=i(8460),n=i(844),d=i(7226),h=i(2585);let u=r.RenderService=class extends n.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(_,y,w,E,b,R,j,M){if(super(),this._rowCount=_,this._charSizeService=E,this._renderer=this.register(new n.MutableDisposable),this._pausedResizeTask=new d.DebouncedIdleTask,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 g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new p.RenderDebouncer(j.window,((L,T)=>this._renderRows(L,T))),this.register(this._renderDebouncer),this._screenDprMonitor=new x.ScreenDprMonitor(j.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var L;return(L=this._renderer.value)===null||L===void 0?void 0:L.clear()}))),this.register(w.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(b.onDecorationRegistered((()=>this._fullRefresh()))),this.register(b.onDecorationRemoved((()=>this._fullRefresh()))),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register((0,o.addDisposableDomListener)(j.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(M.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in j.window){const L=new j.window.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});L.observe(y),this.register({dispose:()=>L.disconnect()})}}_handleIntersectionChange(_){this._isPaused=_.isIntersecting===void 0?_.intersectionRatio===0:!_.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(_,y,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(_,y,this._rowCount))}_renderRows(_,y){this._renderer.value&&(_=Math.min(_,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(_,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:_,end:y}),this._onRender.fire({start:_,end:y}),this._isNextRenderRedrawOnly=!0)}resize(_,y){this._rowCount=y,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(_){this._renderer.value=_,this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(_){return this._renderDebouncer.addRefreshCallback(_)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var _,y;this._renderer.value&&((y=(_=this._renderer.value).clearTextureAtlas)===null||y===void 0||y.call(_),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(_,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(_,y))):this._renderer.value.handleResize(_,y),this._fullRefresh())}handleCharSizeChanged(){var _;(_=this._renderer.value)===null||_===void 0||_.handleCharSizeChanged()}handleBlur(){var _;(_=this._renderer.value)===null||_===void 0||_.handleBlur()}handleFocus(){var _;(_=this._renderer.value)===null||_===void 0||_.handleFocus()}handleSelectionChanged(_,y,w){var E;this._selectionState.start=_,this._selectionState.end=y,this._selectionState.columnSelectMode=w,(E=this._renderer.value)===null||E===void 0||E.handleSelectionChanged(_,y,w)}handleCursorMove(){var _;(_=this._renderer.value)===null||_===void 0||_.handleCursorMove()}clear(){var _;(_=this._renderer.value)===null||_===void 0||_.clear()}};r.RenderService=u=c([f(2,h.IOptionsService),f(3,S.ICharSizeService),f(4,h.IDecorationService),f(5,h.IBufferService),f(6,S.ICoreBrowserService),f(7,S.IThemeService)],u)},9312:function(C,r,i){var c=this&&this.__decorate||function(b,R,j,M){var L,T=arguments.length,B=T<3?R:M===null?M=Object.getOwnPropertyDescriptor(R,j):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(b,R,j,M);else for(var I=b.length-1;I>=0;I--)(L=b[I])&&(B=(T<3?L(B):T>3?L(R,j,B):L(R,j))||B);return T>3&&B&&Object.defineProperty(R,j,B),B},f=this&&this.__param||function(b,R){return function(j,M){R(j,M,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const o=i(9806),p=i(9504),x=i(456),S=i(4725),g=i(8460),n=i(844),d=i(6114),h=i(4841),u=i(511),_=i(2585),y=" ",w=new RegExp(y,"g");let E=r.SelectionService=class extends n.Disposable{constructor(b,R,j,M,L,T,B,I,H){super(),this._element=b,this._screenElement=R,this._linkifier=j,this._bufferService=M,this._coreService=L,this._mouseService=T,this._optionsService=B,this._renderService=I,this._coreBrowserService=H,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new g.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new g.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=W=>this._handleMouseMove(W),this._mouseUpListener=W=>this._handleMouseUp(W),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((W=>this._handleTrim(W))),this.register(this._bufferService.buffers.onBufferActivate((W=>this._handleBufferActivate(W)))),this.enable(),this._model=new x.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,n.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(){const b=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;return!(!b||!R||b[0]===R[0]&&b[1]===R[1])}get selectionText(){const b=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;if(!b||!R)return"";const j=this._bufferService.buffer,M=[];if(this._activeSelectionMode===3){if(b[0]===R[0])return"";const L=b[0]<R[0]?b[0]:R[0],T=b[0]<R[0]?R[0]:b[0];for(let B=b[1];B<=R[1];B++){const I=j.translateBufferLineToString(B,!0,L,T);M.push(I)}}else{const L=b[1]===R[1]?R[0]:void 0;M.push(j.translateBufferLineToString(b[1],!0,b[0],L));for(let T=b[1]+1;T<=R[1]-1;T++){const B=j.lines.get(T),I=j.translateBufferLineToString(T,!0);B?.isWrapped?M[M.length-1]+=I:M.push(I)}if(b[1]!==R[1]){const T=j.lines.get(R[1]),B=j.translateBufferLineToString(R[1],!0,0,R[0]);T&&T.isWrapped?M[M.length-1]+=B:M.push(B)}}return M.map((L=>L.replace(w," "))).join(d.isWindows?`\r
|
|
15
|
+
WARNING: This link could potentially be dangerous`)){const d=window.open();if(d){try{d.opener=null}catch{}d.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=x=c([f(0,p.IBufferService),f(1,p.IOptionsService),f(2,p.IOscLinkService)],x)},6193:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(i,c){this._parentWindow=i,this._renderCallback=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(i){return this._refreshCallbacks.push(i),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(i,c,f){this._rowCount=f,i=i!==void 0?i:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,i):i,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,this._animationFrame||(this._animationFrame=this._parentWindow.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();const i=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const i of this._refreshCallbacks)i(0);this._refreshCallbacks=[]}}},5596:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;const c=i(844);class f extends c.Disposable{constructor(p){super(),this._parentWindow=p,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,c.toDisposable)((()=>{this.clearListener()})))}setListener(p){this._listener&&this.clearListener(),this._listener=p,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var p;this._outerListener&&((p=this._resolutionMediaMatchList)===null||p===void 0||p.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._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}r.ScreenDprMonitor=f},3236:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const c=i(3614),f=i(3656),o=i(6465),p=i(9042),x=i(3730),S=i(1680),g=i(3107),n=i(5744),d=i(2950),h=i(1296),u=i(428),_=i(4269),y=i(5114),w=i(8934),E=i(3230),b=i(9312),R=i(4725),j=i(6731),M=i(8055),L=i(8969),T=i(8460),B=i(844),I=i(6114),H=i(8437),W=i(2584),A=i(7399),N=i(5941),P=i(9074),O=i(2585),$=i(5435),X=i(4567),K=typeof window<"u"?window.document:null;class Q extends L.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(D={}){super(D),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new B.MutableDisposable),this._onCursorMove=this.register(new T.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new T.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new T.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new T.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new T.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new T.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new T.EventEmitter),this._onBlur=this.register(new T.EventEmitter),this._onA11yCharEmitter=this.register(new T.EventEmitter),this._onA11yTabEmitter=this.register(new T.EventEmitter),this._onWillOpen=this.register(new T.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(o.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(x.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((F,q)=>this.refresh(F,q)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((F=>this._reportWindowsOptions(F)))),this.register(this._inputHandler.onColor((F=>this._handleColorEvent(F)))),this.register((0,T.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,T.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,T.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,T.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((F=>this._afterResize(F.cols,F.rows)))),this.register((0,B.toDisposable)((()=>{var F,q;this._customKeyEventHandler=void 0,(q=(F=this.element)===null||F===void 0?void 0:F.parentNode)===null||q===void 0||q.removeChild(this.element)})))}_handleColorEvent(D){if(this._themeService)for(const F of D){let q,z="";switch(F.index){case 256:q="foreground",z="10";break;case 257:q="background",z="11";break;case 258:q="cursor",z="12";break;default:q="ansi",z="4;"+F.index}switch(F.type){case 0:const te=M.color.toColorRGB(q==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[q]);this.coreService.triggerDataEvent(`${W.C0.ESC}]${z};${(0,N.toRgbString)(te)}${W.C1_ESCAPED.ST}`);break;case 1:if(q==="ansi")this._themeService.modifyColors((Y=>Y.ansi[F.index]=M.rgba.toColor(...F.color)));else{const Y=q;this._themeService.modifyColors((ie=>ie[Y]=M.rgba.toColor(...F.color)))}break;case 2:this._themeService.restoreColor(F.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(D){D?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(X.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(D){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[I"),this.updateCursorStyle(D),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var D;return(D=this.textarea)===null||D===void 0?void 0:D.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const D=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(D);if(!F)return;const q=Math.min(this.buffer.x,this.cols-1),z=this._renderService.dimensions.css.cell.height,te=F.getWidth(q),Y=this._renderService.dimensions.css.cell.width*te,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,ge=q*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ge+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=Y+"px",this.textarea.style.height=z+"px",this.textarea.style.lineHeight=z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(F=>{this.hasSelection()&&(0,c.copyHandler)(F,this._selectionService)})));const D=F=>(0,c.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",D)),this.register((0,f.addDisposableDomListener)(this.element,"paste",D)),I.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(F=>{F.button===2&&(0,c.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(F=>{(0,c.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),I.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(F=>{F.button===1&&(0,c.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(D=>this._keyUp(D)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(D=>this._keyDown(D)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(D=>this._keyPress(D)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(D=>this._compositionHelper.compositionupdate(D)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(D=>this._inputEvent(D)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(D){var F;if(!D)throw new Error("Terminal requires a parent element.");D.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=D.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),D.appendChild(this.element);const q=K.createDocumentFragment();this._viewportElement=K.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),q.appendChild(this._viewportElement),this._viewportScrollArea=K.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=K.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=K.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),q.appendChild(this.screenElement),this.textarea=K.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),I.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._instantiationService.createInstance(y.CoreBrowserService,this.textarea,(F=this._document.defaultView)!==null&&F!==void 0?F:window),this._instantiationService.setService(R.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(z=>this._handleTextAreaFocus(z)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(R.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(j.ThemeService),this._instantiationService.setService(R.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(_.CharacterJoinerService),this._instantiationService.setService(R.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(E.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(R.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((z=>this._onRender.fire(z)))),this.onResize((z=>this._renderService.resize(z.cols,z.rows))),this._compositionView=K.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.element.appendChild(q);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(R.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((z=>this.scrollLines(z.amount,z.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(b.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(R.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((z=>this.scrollLines(z.amount,z.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((z=>this._renderService.handleSelectionChanged(z.start,z.end,z.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((z=>{this.textarea.value=z,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(g.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(z=>this._selectionService.handleMouseDown(z)))),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(X.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(z=>this._handleScreenReaderModeOptionChange(z)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(n.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(z=>{!this._overviewRulerRenderer&&z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(n.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(h.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const D=this,F=this.element;function q(Y){const ie=D._mouseService.getMouseReportCoords(Y,D.screenElement);if(!ie)return!1;let ge,me;switch(Y.overrideType||Y.type){case"mousemove":me=32,Y.buttons===void 0?(ge=3,Y.button!==void 0&&(ge=Y.button<3?Y.button:3)):ge=1&Y.buttons?0:4&Y.buttons?1:2&Y.buttons?2:3;break;case"mouseup":me=0,ge=Y.button<3?Y.button:3;break;case"mousedown":me=1,ge=Y.button<3?Y.button:3;break;case"wheel":if(D.viewport.getLinesScrolled(Y)===0)return!1;me=Y.deltaY<0?0:1,ge=4;break;default:return!1}return!(me===void 0||ge===void 0||ge>4)&&D.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:ge,action:me,ctrl:Y.ctrlKey,alt:Y.altKey,shift:Y.shiftKey})}const z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},te={mouseup:Y=>(q(Y),Y.buttons||(this._document.removeEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.removeEventListener("mousemove",z.mousedrag)),this.cancel(Y)),wheel:Y=>(q(Y),this.cancel(Y,!0)),mousedrag:Y=>{Y.buttons&&q(Y)},mousemove:Y=>{Y.buttons||q(Y)}};this.register(this.coreMouseService.onProtocolChange((Y=>{Y?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Y)),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&Y?z.mousemove||(F.addEventListener("mousemove",te.mousemove),z.mousemove=te.mousemove):(F.removeEventListener("mousemove",z.mousemove),z.mousemove=null),16&Y?z.wheel||(F.addEventListener("wheel",te.wheel,{passive:!1}),z.wheel=te.wheel):(F.removeEventListener("wheel",z.wheel),z.wheel=null),2&Y?z.mouseup||(F.addEventListener("mouseup",te.mouseup),z.mouseup=te.mouseup):(this._document.removeEventListener("mouseup",z.mouseup),F.removeEventListener("mouseup",z.mouseup),z.mouseup=null),4&Y?z.mousedrag||(z.mousedrag=te.mousedrag):(this._document.removeEventListener("mousemove",z.mousedrag),z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(F,"mousedown",(Y=>{if(Y.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Y))return q(Y),z.mouseup&&this._document.addEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.addEventListener("mousemove",z.mousedrag),this.cancel(Y)}))),this.register((0,f.addDisposableDomListener)(F,"wheel",(Y=>{if(!z.wheel){if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(Y);if(ie===0)return;const ge=W.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Y.deltaY<0?"A":"B");let me="";for(let Me=0;Me<Math.abs(ie);Me++)me+=ge;return this.coreService.triggerDataEvent(me,!0),this.cancel(Y,!0)}return this.viewport.handleWheel(Y)?this.cancel(Y):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(F,"touchstart",(Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Y),this.cancel(Y)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(F,"touchmove",(Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Y)?void 0:this.cancel(Y)}),{passive:!1}))}refresh(D,F){var q;(q=this._renderService)===null||q===void 0||q.refreshRows(D,F)}updateCursorStyle(D){var F;!((F=this._selectionService)===null||F===void 0)&&F.shouldColumnSelect(D)?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(D,F,q=0){var z;q===1?(super.scrollLines(D,F,q),this.refresh(0,this.rows-1)):(z=this.viewport)===null||z===void 0||z.scrollLines(D)}paste(D){(0,c.paste)(D,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(D){this._customKeyEventHandler=D}registerLinkProvider(D){return this.linkifier2.registerLinkProvider(D)}registerCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(D);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(D)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(D){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+D)}registerDecoration(D){return this._decorationService.registerDecoration(D)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(D,F,q){this._selectionService.setSelection(D,F,q)}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(){var D;(D=this._selectionService)===null||D===void 0||D.clearSelection()}selectAll(){var D;(D=this._selectionService)===null||D===void 0||D.selectAll()}selectLines(D,F){var q;(q=this._selectionService)===null||q===void 0||q.selectLines(D,F)}_keyDown(D){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&D.altKey;if(!F&&!this._compositionHelper.keydown(D))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||D.key!=="Dead"&&D.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const q=(0,A.evaluateKeyboardEvent)(D,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(D),q.type===3||q.type===2){const z=this.rows-1;return this.scrollLines(q.type===2?-z:z),this.cancel(D,!0)}return q.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,D)||(q.cancel&&this.cancel(D,!0),!q.key||!!(D.key&&!D.ctrlKey&&!D.altKey&&!D.metaKey&&D.key.length===1&&D.key.charCodeAt(0)>=65&&D.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(q.key!==W.C0.ETX&&q.key!==W.C0.CR||(this.textarea.value=""),this._onKey.fire({key:q.key,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(q.key,!0),!this.optionsService.rawOptions.screenReaderMode||D.altKey||D.ctrlKey?this.cancel(D,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(D,F){const q=D.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||D.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||D.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?q:q&&(!F.keyCode||F.keyCode>47)}_keyUp(D){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1||((function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18})(D)||this.focus(),this.updateCursorStyle(D),this._keyPressHandled=!1)}_keyPress(D){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;if(this.cancel(D),D.charCode)F=D.charCode;else if(D.which===null||D.which===void 0)F=D.keyCode;else{if(D.which===0||D.charCode===0)return!1;F=D.which}return!(!F||(D.altKey||D.ctrlKey||D.metaKey)&&!this._isThirdLevelShift(this.browser,D)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(D){if(D.data&&D.inputType==="insertText"&&(!D.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=D.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(D),!0}return!1}resize(D,F){D!==this.cols||F!==this.rows?super.resize(D,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(D,F){var q,z;(q=this._charSizeService)===null||q===void 0||q.measure(),(z=this.viewport)===null||z===void 0||z.syncScrollArea(!0)}clear(){var D;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 F=1;F<this.rows;F++)this.buffer.lines.push(this.buffer.getBlankLine(H.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(D=this.viewport)===null||D===void 0||D.reset(),this.refresh(0,this.rows-1)}}reset(){var D,F;this.options.rows=this.rows,this.options.cols=this.cols;const q=this._customKeyEventHandler;this._setup(),super.reset(),(D=this._selectionService)===null||D===void 0||D.reset(),this._decorationService.reset(),(F=this.viewport)===null||F===void 0||F.reset(),this._customKeyEventHandler=q,this.refresh(0,this.rows-1)}clearTextureAtlas(){var D;(D=this._renderService)===null||D===void 0||D.clearTextureAtlas()}_reportFocus(){var D;!((D=this.element)===null||D===void 0)&&D.classList.contains("focus")?this.coreService.triggerDataEvent(W.C0.ESC+"[I"):this.coreService.triggerDataEvent(W.C0.ESC+"[O")}_reportWindowsOptions(D){if(this._renderService)switch(D){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),q=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[4;${q};${F}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const z=this._renderService.dimensions.css.cell.width.toFixed(0),te=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[6;${te};${z}t`)}}cancel(D,F){if(this.options.cancelEvents||F)return D.preventDefault(),D.stopPropagation(),!1}}r.Terminal=Q},9924:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(i,c=1e3){this._renderCallback=i,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(i,c,f){this._rowCount=f,i=i!==void 0?i:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,i):i,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=o-this._lastRefreshMs,x=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),x)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const i=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,c)}}},1680:function(C,r,i){var c=this&&this.__decorate||function(d,h,u,_){var y,w=arguments.length,E=w<3?h:_===null?_=Object.getOwnPropertyDescriptor(h,u):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(d,h,u,_);else for(var b=d.length-1;b>=0;b--)(y=d[b])&&(E=(w<3?y(E):w>3?y(h,u,E):y(h,u))||E);return w>3&&E&&Object.defineProperty(h,u,E),E},f=this&&this.__param||function(d,h){return function(u,_){h(u,_,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const o=i(3656),p=i(4725),x=i(8460),S=i(844),g=i(2585);let n=r.Viewport=class extends S.Disposable{constructor(d,h,u,_,y,w,E,b){super(),this._viewportElement=d,this._scrollArea=h,this._bufferService=u,this._optionsService=_,this._charSizeService=y,this._renderService=w,this._coreBrowserService=E,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 x.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((R=>this._activeBuffer=R.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((R=>this._renderDimensions=R))),this._handleThemeChange(b.colors),this.register(b.onChangeColors((R=>this._handleThemeChange(R)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(d){this._viewportElement.style.backgroundColor=d.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(d){if(d)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._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const h=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==h&&(this._lastRecordedBufferHeight=h,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const d=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==d&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=d),this._refreshAnimationFrame=null}syncScrollArea(d=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(d);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(d)}_handleScroll(d){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});const h=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:h,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const d=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(d*(this._smoothScrollState.target-this._smoothScrollState.origin)),d<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(d,h){const u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){const h=this._getPixelsScrolled(d);return h!==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+h:this._smoothScrollState.target+=h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=h,this._bubbleScroll(d,h))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const h=d*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!1})}_getPixelsScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let h=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(d,h){var u;let _,y="";const w=[],E=h??this._bufferService.buffer.lines.length,b=this._bufferService.buffer.lines;for(let R=d;R<E;R++){const j=b.get(R);if(!j)continue;const M=(u=b.get(R+1))===null||u===void 0?void 0:u.isWrapped;if(y+=j.translateToString(!M),!M||R===b.length-1){const L=document.createElement("div");L.textContent=y,w.push(L),y.length>0&&(_=L),y=""}}return{bufferElements:w,cursorElement:_}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let h=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(h/=this._currentRowHeight+0,this._wheelPartialScroll+=h,h=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(d,h){const u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&h.altKey||u==="ctrl"&&h.ctrlKey||u==="shift"&&h.shiftKey?d*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:d*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(d){this._lastTouchY=d.touches[0].pageY}handleTouchMove(d){const h=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(d,h))}};r.Viewport=n=c([f(2,g.IBufferService),f(3,g.IOptionsService),f(4,p.ICharSizeService),f(5,p.IRenderService),f(6,p.ICoreBrowserService),f(7,p.IThemeService)],n)},3107:function(C,r,i){var c=this&&this.__decorate||function(n,d,h,u){var _,y=arguments.length,w=y<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,h,u);else for(var E=n.length-1;E>=0;E--)(_=n[E])&&(w=(y<3?_(w):y>3?_(d,h,w):_(d,h))||w);return y>3&&w&&Object.defineProperty(d,h,w),w},f=this&&this.__param||function(n,d){return function(h,u){d(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const o=i(3656),p=i(4725),x=i(844),S=i(2585);let g=r.BufferDecorationRenderer=class extends x.Disposable{constructor(n,d,h,u){super(),this._screenElement=n,this._bufferService=d,this._decorationService=h,this._renderService=u,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((0,o.addDisposableDomListener)(window,"resize",(()=>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((_=>this._removeDecoration(_)))),this.register((0,x.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(const n of this._decorationService.decorations)this._renderDecoration(n);this._dimensionsChanged=!1}_renderDecoration(n){this._refreshStyle(n),this._dimensionsChanged&&this._refreshXPosition(n)}_createElement(n){var d,h;const u=document.createElement("div");u.classList.add("xterm-decoration"),u.classList.toggle("xterm-decoration-top-layer",((d=n?.options)===null||d===void 0?void 0:d.layer)==="top"),u.style.width=`${Math.round((n.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,u.style.height=(n.options.height||1)*this._renderService.dimensions.css.cell.height+"px",u.style.top=(n.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",u.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=(h=n.options.x)!==null&&h!==void 0?h:0;return _&&_>this._bufferService.cols&&(u.style.display="none"),this._refreshXPosition(n,u),u}_refreshStyle(n){const d=n.marker.line-this._bufferService.buffers.active.ydisp;if(d<0||d>=this._bufferService.rows)n.element&&(n.element.style.display="none",n.onRenderEmitter.fire(n.element));else{let h=this._decorationElements.get(n);h||(h=this._createElement(n),n.element=h,this._decorationElements.set(n,h),this._container.appendChild(h),n.onDispose((()=>{this._decorationElements.delete(n),h.remove()}))),h.style.top=d*this._renderService.dimensions.css.cell.height+"px",h.style.display=this._altBufferIsActive?"none":"block",n.onRenderEmitter.fire(h)}}_refreshXPosition(n,d=n.element){var h;if(!d)return;const u=(h=n.options.x)!==null&&h!==void 0?h:0;(n.options.anchor||"left")==="right"?d.style.right=u?u*this._renderService.dimensions.css.cell.width+"px":"":d.style.left=u?u*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(n){var d;(d=this._decorationElements.get(n))===null||d===void 0||d.remove(),this._decorationElements.delete(n),n.dispose()}};r.BufferDecorationRenderer=g=c([f(1,S.IBufferService),f(2,S.IDecorationService),f(3,p.IRenderService)],g)},5871:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.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(i){if(i.options.overviewRulerOptions){for(const c of this._zones)if(c.color===i.options.overviewRulerOptions.color&&c.position===i.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,i.marker.line))return;if(this._lineAdjacentToZone(c,i.marker.line,i.options.overviewRulerOptions.position))return void this._addLineToZone(c,i.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=i.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=i.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=i.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=i.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:i.options.overviewRulerOptions.color,position:i.options.overviewRulerOptions.position,startBufferLine:i.marker.line,endBufferLine:i.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(i){this._linePadding=i}_lineIntersectsZone(i,c){return c>=i.startBufferLine&&c<=i.endBufferLine}_lineAdjacentToZone(i,c,f){return c>=i.startBufferLine-this._linePadding[f||"full"]&&c<=i.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(i,c){i.startBufferLine=Math.min(i.startBufferLine,c),i.endBufferLine=Math.max(i.endBufferLine,c)}}},5744:function(C,r,i){var c=this&&this.__decorate||function(_,y,w,E){var b,R=arguments.length,j=R<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(_,y,w,E);else for(var M=_.length-1;M>=0;M--)(b=_[M])&&(j=(R<3?b(j):R>3?b(y,w,j):b(y,w))||j);return R>3&&j&&Object.defineProperty(y,w,j),j},f=this&&this.__param||function(_,y){return function(w,E){y(w,E,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const o=i(5871),p=i(3656),x=i(4725),S=i(844),g=i(2585),n={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0};let u=r.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(_,y,w,E,b,R,j){var M;super(),this._viewportElement=_,this._screenElement=y,this._bufferService=w,this._decorationService=E,this._renderService=b,this._optionsService=R,this._coreBrowseService=j,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(M=this._viewportElement.parentElement)===null||M===void 0||M.insertBefore(this._canvas,this._viewportElement);const L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,S.toDisposable)((()=>{var T;(T=this._canvas)===null||T===void 0||T.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((0,p.addDisposableDomListener)(this._coreBrowseService.window,"resize",(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const _=Math.floor(this._canvas.width/3),y=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=_,d.center=y,d.right=_,this._refreshDrawHeightConstants(),h.full=0,h.left=0,h.center=d.left,h.right=d.left+d.center}_refreshDrawHeightConstants(){n.full=Math.round(2*this._coreBrowseService.dpr);const _=this._canvas.height/this._bufferService.buffer.lines.length,y=Math.round(Math.max(Math.min(_,12),6)*this._coreBrowseService.dpr);n.left=y,n.center=y,n.right=y}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.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(const y of this._decorationService.decorations)this._colorZoneStore.addDecoration(y);this._ctx.lineWidth=1;const _=this._colorZoneStore.zones;for(const y of _)y.position!=="full"&&this._renderColorZone(y);for(const y of _)y.position==="full"&&this._renderColorZone(y);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(_){this._ctx.fillStyle=_.color,this._ctx.fillRect(h[_.position||"full"],Math.round((this._canvas.height-1)*(_.startBufferLine/this._bufferService.buffers.active.lines.length)-n[_.position||"full"]/2),d[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+n[_.position||"full"]))}_queueRefresh(_,y){this._shouldUpdateDimensions=_||this._shouldUpdateDimensions,this._shouldUpdateAnchor=y||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=u=c([f(2,g.IBufferService),f(3,g.IDecorationService),f(4,x.IRenderService),f(5,g.IOptionsService),f(6,x.ICoreBrowserService)],u)},2950:function(C,r,i){var c=this&&this.__decorate||function(g,n,d,h){var u,_=arguments.length,y=_<3?n:h===null?h=Object.getOwnPropertyDescriptor(n,d):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(g,n,d,h);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(y=(_<3?u(y):_>3?u(n,d,y):u(n,d))||y);return _>3&&y&&Object.defineProperty(n,d,y),y},f=this&&this.__param||function(g,n){return function(d,h){n(d,h,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const o=i(4725),p=i(2585),x=i(2584);let S=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,n,d,h,u,_){this._textarea=g,this._compositionView=n,this._bufferService=d,this._optionsService=h,this._coreService=u,this._renderService=_,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(g){this._compositionView.textContent=g.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(g){if(this._isComposing||this._isSendingComposition){if(g.keyCode===229||g.keyCode===16||g.keyCode===17||g.keyCode===18)return!1;this._finalizeComposition(!1)}return g.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(g){if(this._compositionView.classList.remove("active"),this._isComposing=!1,g){const n={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,n.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(n.start,n.end):this._textarea.value.substring(n.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;const n=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(n,!0)}}_handleAnyTextareaChanges(){const g=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const n=this._textarea.value,d=n.replace(g,"");this._dataAlreadySent=d,n.length>g.length?this._coreService.triggerDataEvent(d,!0):n.length<g.length?this._coreService.triggerDataEvent(`${x.C0.DEL}`,!0):n.length===g.length&&n!==g&&this._coreService.triggerDataEvent(n,!0)}}),0)}updateCompositionElements(g){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const n=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,h=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=n*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=h+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const _=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=h+"px",this._textarea.style.width=Math.max(_.width,1)+"px",this._textarea.style.height=Math.max(_.height,1)+"px",this._textarea.style.lineHeight=_.height+"px"}g||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=S=c([f(2,p.IBufferService),f(3,p.IOptionsService),f(4,p.ICoreService),f(5,o.IRenderService)],S)},9806:(C,r)=>{function i(c,f,o){const p=o.getBoundingClientRect(),x=c.getComputedStyle(o),S=parseInt(x.getPropertyValue("padding-left")),g=parseInt(x.getPropertyValue("padding-top"));return[f.clientX-p.left-S,f.clientY-p.top-g]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=i,r.getCoords=function(c,f,o,p,x,S,g,n,d){if(!S)return;const h=i(c,f,o);return h?(h[0]=Math.ceil((h[0]+(d?g/2:0))/g),h[1]=Math.ceil(h[1]/n),h[0]=Math.min(Math.max(h[0],1),p+(d?1:0)),h[1]=Math.min(Math.max(h[1],1),x),h):void 0}},9504:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const c=i(2584);function f(n,d,h,u){const _=n-o(n,h),y=d-o(d,h),w=Math.abs(_-y)-(function(E,b,R){let j=0;const M=E-o(E,R),L=b-o(b,R);for(let T=0;T<Math.abs(M-L);T++){const B=p(E,b)==="A"?-1:1,I=R.buffer.lines.get(M+B*T);I?.isWrapped&&j++}return j})(n,d,h);return g(w,S(p(n,d),u))}function o(n,d){let h=0,u=d.buffer.lines.get(n),_=u?.isWrapped;for(;_&&n>=0&&n<d.rows;)h++,u=d.buffer.lines.get(--n),_=u?.isWrapped;return h}function p(n,d){return n>d?"A":"B"}function x(n,d,h,u,_,y){let w=n,E=d,b="";for(;w!==h||E!==u;)w+=_?1:-1,_&&w>y.cols-1?(b+=y.buffer.translateBufferLineToString(E,!1,n,w),w=0,n=0,E++):!_&&w<0&&(b+=y.buffer.translateBufferLineToString(E,!1,0,n+1),w=y.cols-1,n=w,E--);return b+y.buffer.translateBufferLineToString(E,!1,n,w)}function S(n,d){const h=d?"O":"[";return c.C0.ESC+h+n}function g(n,d){n=Math.floor(n);let h="";for(let u=0;u<n;u++)h+=d;return h}r.moveToCellSequence=function(n,d,h,u){const _=h.buffer.x,y=h.buffer.y;if(!h.buffer.hasScrollback)return(function(b,R,j,M,L,T){return f(R,M,L,T).length===0?"":g(x(b,R,b,R-o(R,L),!1,L).length,S("D",T))})(_,y,0,d,h,u)+f(y,d,h,u)+(function(b,R,j,M,L,T){let B;B=f(R,M,L,T).length>0?M-o(M,L):R;const I=M,H=(function(W,A,N,P,O,$){let X;return X=f(N,P,O,$).length>0?P-o(P,O):A,W<N&&X<=P||W>=N&&X<P?"C":"D"})(b,R,j,M,L,T);return g(x(b,B,j,I,H==="C",L).length,S(H,T))})(_,y,n,d,h,u);let w;if(y===d)return w=_>n?"D":"C",g(Math.abs(_-n),S(w,u));w=y>d?"D":"C";const E=Math.abs(y-d);return g((function(b,R){return R.cols-b})(y>d?n:_,h)+(E-1)*h.cols+1+((y>d?_:n)-1),S(w,u))}},1296:function(C,r,i){var c=this&&this.__decorate||function(L,T,B,I){var H,W=arguments.length,A=W<3?T:I===null?I=Object.getOwnPropertyDescriptor(T,B):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(L,T,B,I);else for(var N=L.length-1;N>=0;N--)(H=L[N])&&(A=(W<3?H(A):W>3?H(T,B,A):H(T,B))||A);return W>3&&A&&Object.defineProperty(T,B,A),A},f=this&&this.__param||function(L,T){return function(B,I){T(B,I,L)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const o=i(3787),p=i(2550),x=i(2223),S=i(6171),g=i(4725),n=i(8055),d=i(8460),h=i(844),u=i(2585),_="xterm-dom-renderer-owner-",y="xterm-rows",w="xterm-fg-",E="xterm-bg-",b="xterm-focus",R="xterm-selection";let j=1,M=r.DomRenderer=class extends h.Disposable{constructor(L,T,B,I,H,W,A,N,P,O){super(),this._element=L,this._screenElement=T,this._viewportElement=B,this._linkifier2=I,this._charSizeService=W,this._optionsService=A,this._bufferService=N,this._coreBrowserService=P,this._themeService=O,this._terminalClass=j++,this._rowElements=[],this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(y),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(R),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors(($=>this._injectCss($)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(($=>this._handleLinkHover($)))),this.register(this._linkifier2.onHideLinkUnderline(($=>this._handleLinkLeave($)))),this.register((0,h.toDisposable)((()=>{this._element.classList.remove(_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new p.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const L=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*L,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*L),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/L),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/L),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(const B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const T=`${this._terminalSelector} .${y} 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(L){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let T=`${this._terminalSelector} .${y} { color: ${L.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;T+=`${this._terminalSelector} .${y} .xterm-dim { color: ${n.color.multiplyOpacity(L.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;}`,T+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",T+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css}; } 50% { background-color: inherit; color: ${L.cursor.css}; }}`,T+=`${this._terminalSelector} .${y}.${b} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${y}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${y} .xterm-cursor.xterm-cursor-block { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css};}${this._terminalSelector} .${y} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${L.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${y} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${L.cursor.css} inset;}${this._terminalSelector} .${y} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${L.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,T+=`${this._terminalSelector} .${R} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${R} div { position: absolute; background-color: ${L.selectionBackgroundOpaque.css};}${this._terminalSelector} .${R} div { position: absolute; background-color: ${L.selectionInactiveBackgroundOpaque.css};}`;for(const[B,I]of L.ansi.entries())T+=`${this._terminalSelector} .${w}${B} { color: ${I.css}; }${this._terminalSelector} .${w}${B}.xterm-dim { color: ${n.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${E}${B} { background-color: ${I.css}; }`;T+=`${this._terminalSelector} .${w}${x.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(L.background).css}; }${this._terminalSelector} .${w}${x.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(L.background),.5).css}; }${this._terminalSelector} .${E}${x.INVERTED_DEFAULT_COLOR} { background-color: ${L.foreground.css}; }`,this._themeStyleElement.textContent=T}_setDefaultSpacing(){const L=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${L}px`,this._rowFactory.defaultSpacing=L}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(L,T){for(let B=this._rowElements.length;B<=T;B++){const I=document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>T;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(L,T){this._refreshRowElements(L,T),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(b)}handleFocus(){this._rowContainer.classList.add(b),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(L,T,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(L,T,B),this.renderRows(0,this._bufferService.rows-1),!L||!T)return;const I=L[1]-this._bufferService.buffer.ydisp,H=T[1]-this._bufferService.buffer.ydisp,W=Math.max(I,0),A=Math.min(H,this._bufferService.rows-1);if(W>=this._bufferService.rows||A<0)return;const N=document.createDocumentFragment();if(B){const P=L[0]>T[0];N.appendChild(this._createSelectionElement(W,P?T[0]:L[0],P?L[0]:T[0],A-W+1))}else{const P=I===W?L[0]:0,O=W===H?T[0]:this._bufferService.cols;N.appendChild(this._createSelectionElement(W,P,O));const $=A-W-1;if(N.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,$)),W!==A){const X=H===A?T[0]:this._bufferService.cols;N.appendChild(this._createSelectionElement(A,0,X))}}this._selectionContainer.appendChild(N)}_createSelectionElement(L,T,B,I=1){const H=document.createElement("div");return H.style.height=I*this.dimensions.css.cell.height+"px",H.style.top=L*this.dimensions.css.cell.height+"px",H.style.left=T*this.dimensions.css.cell.width+"px",H.style.width=this.dimensions.css.cell.width*(B-T)+"px",H}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(const L of this._rowElements)L.replaceChildren()}renderRows(L,T){const B=this._bufferService.buffer,I=B.ybase+B.y,H=Math.min(B.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,A=this._optionsService.rawOptions.cursorStyle,N=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=L;P<=T;P++){const O=P+B.ydisp,$=this._rowElements[P],X=B.lines.get(O);if(!$||!X)break;$.replaceChildren(...this._rowFactory.createRow(X,O,O===I,A,N,H,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_}${this._terminalClass}`}_handleLinkHover(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!0)}_handleLinkLeave(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!1)}_setCellUnderline(L,T,B,I,H,W){B<0&&(L=0),I<0&&(T=0);const A=this._bufferService.rows-1;B=Math.max(Math.min(B,A),0),I=Math.max(Math.min(I,A),0),H=Math.min(H,this._bufferService.cols);const N=this._bufferService.buffer,P=N.ybase+N.y,O=Math.min(N.x,H-1),$=this._optionsService.rawOptions.cursorBlink,X=this._optionsService.rawOptions.cursorStyle,K=this._optionsService.rawOptions.cursorInactiveStyle;for(let Q=B;Q<=I;++Q){const se=Q+N.ydisp,D=this._rowElements[Q],F=N.lines.get(se);if(!D||!F)break;D.replaceChildren(...this._rowFactory.createRow(F,se,se===P,X,K,O,$,this.dimensions.css.cell.width,this._widthCache,W?Q===B?L:0:-1,W?(Q===I?T:H)-1:-1))}}};r.DomRenderer=M=c([f(4,u.IInstantiationService),f(5,g.ICharSizeService),f(6,u.IOptionsService),f(7,u.IBufferService),f(8,g.ICoreBrowserService),f(9,g.IThemeService)],M)},3787:function(C,r,i){var c=this&&this.__decorate||function(w,E,b,R){var j,M=arguments.length,L=M<3?E:R===null?R=Object.getOwnPropertyDescriptor(E,b):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,E,b,R);else for(var T=w.length-1;T>=0;T--)(j=w[T])&&(L=(M<3?j(L):M>3?j(E,b,L):j(E,b))||L);return M>3&&L&&Object.defineProperty(E,b,L),L},f=this&&this.__param||function(w,E){return function(b,R){E(b,R,w)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const o=i(2223),p=i(643),x=i(511),S=i(2585),g=i(8055),n=i(4725),d=i(4269),h=i(6171),u=i(3734);let _=r.DomRendererRowFactory=class{constructor(w,E,b,R,j,M,L){this._document=w,this._characterJoinerService=E,this._optionsService=b,this._coreBrowserService=R,this._coreService=j,this._decorationService=M,this._themeService=L,this._workCell=new x.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,E,b){this._selectionStart=w,this._selectionEnd=E,this._columnSelectMode=b}createRow(w,E,b,R,j,M,L,T,B,I,H){const W=[],A=this._characterJoinerService.getJoinedCharacters(E),N=this._themeService.colors;let P,O=w.getNoBgTrimmedLength();b&&O<M+1&&(O=M+1);let $=0,X="",K=0,Q=0,se=0,D=!1,F=0,q=!1,z=0;const te=[],Y=I!==-1&&H!==-1;for(let ie=0;ie<O;ie++){w.loadCell(ie,this._workCell);let ge=this._workCell.getWidth();if(ge===0)continue;let me=!1,Me=ie,re=this._workCell;if(A.length>0&&ie===A[0][0]){me=!0;const Z=A.shift();re=new d.JoinedCellData(this._workCell,w.translateToString(!0,Z[0],Z[1]),Z[1]-Z[0]),Me=Z[1]-1,ge=re.getWidth()}const Be=this._isCellInSelection(ie,E),Ce=b&&ie===M,oe=Y&&ie>=I&&ie<=H;let Ne=!1;this._decorationService.forEachDecorationAtCell(ie,E,void 0,(Z=>{Ne=!0}));let qe=re.getChars()||p.WHITESPACE_CELL_CHAR;if(qe===" "&&(re.isUnderline()||re.isOverline())&&(qe=" "),z=ge*T-B.get(qe,re.isBold(),re.isItalic()),P){if($&&(Be&&q||!Be&&!q&&re.bg===K)&&(Be&&q&&N.selectionForeground||re.fg===Q)&&re.extended.ext===se&&oe===D&&z===F&&!Ce&&!me&&!Ne){X+=qe,$++;continue}$&&(P.textContent=X),P=this._document.createElement("span"),$=0,X=""}else P=this._document.createElement("span");if(K=re.bg,Q=re.fg,se=re.extended.ext,D=oe,F=z,q=Be,me&&M>=ie&&M<=Me&&(M=ie),!this._coreService.isCursorHidden&&Ce){if(te.push("xterm-cursor"),this._coreBrowserService.isFocused)L&&te.push("xterm-cursor-blink"),te.push(R==="bar"?"xterm-cursor-bar":R==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(j)switch(j){case"outline":te.push("xterm-cursor-outline");break;case"block":te.push("xterm-cursor-block");break;case"bar":te.push("xterm-cursor-bar");break;case"underline":te.push("xterm-cursor-underline")}}if(re.isBold()&&te.push("xterm-bold"),re.isItalic()&&te.push("xterm-italic"),re.isDim()&&te.push("xterm-dim"),X=re.isInvisible()?p.WHITESPACE_CELL_CHAR:re.getChars()||p.WHITESPACE_CELL_CHAR,re.isUnderline()&&(te.push(`xterm-underline-${re.extended.underlineStyle}`),X===" "&&(X=" "),!re.isUnderlineColorDefault()))if(re.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(re.getUnderlineColor()).join(",")})`;else{let Z=re.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&re.isBold()&&Z<8&&(Z+=8),P.style.textDecorationColor=N.ansi[Z].css}re.isOverline()&&(te.push("xterm-overline"),X===" "&&(X=" ")),re.isStrikethrough()&&te.push("xterm-strikethrough"),oe&&(P.style.textDecoration="underline");let Re=re.getFgColor(),Ve=re.getFgColorMode(),be=re.getBgColor(),st=re.getBgColorMode();const Ke=!!re.isInverse();if(Ke){const Z=Re;Re=be,be=Z;const xe=Ve;Ve=st,st=xe}let Pe,Oe,De,V=!1;switch(this._decorationService.forEachDecorationAtCell(ie,E,void 0,(Z=>{Z.options.layer!=="top"&&V||(Z.backgroundColorRGB&&(st=50331648,be=Z.backgroundColorRGB.rgba>>8&16777215,Pe=Z.backgroundColorRGB),Z.foregroundColorRGB&&(Ve=50331648,Re=Z.foregroundColorRGB.rgba>>8&16777215,Oe=Z.foregroundColorRGB),V=Z.options.layer==="top")})),!V&&Be&&(Pe=this._coreBrowserService.isFocused?N.selectionBackgroundOpaque:N.selectionInactiveBackgroundOpaque,be=Pe.rgba>>8&16777215,st=50331648,V=!0,N.selectionForeground&&(Ve=50331648,Re=N.selectionForeground.rgba>>8&16777215,Oe=N.selectionForeground)),V&&te.push("xterm-decoration-top"),st){case 16777216:case 33554432:De=N.ansi[be],te.push(`xterm-bg-${be}`);break;case 50331648:De=g.rgba.toColor(be>>16,be>>8&255,255&be),this._addStyle(P,`background-color:#${y((be>>>0).toString(16),"0",6)}`);break;default:Ke?(De=N.foreground,te.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):De=N.background}switch(Pe||re.isDim()&&(Pe=g.color.multiplyOpacity(De,.5)),Ve){case 16777216:case 33554432:re.isBold()&&Re<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Re+=8),this._applyMinimumContrast(P,De,N.ansi[Re],re,Pe,void 0)||te.push(`xterm-fg-${Re}`);break;case 50331648:const Z=g.rgba.toColor(Re>>16&255,Re>>8&255,255&Re);this._applyMinimumContrast(P,De,Z,re,Pe,Oe)||this._addStyle(P,`color:#${y(Re.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,De,N.foreground,re,Pe,void 0)||Ke&&te.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}te.length&&(P.className=te.join(" "),te.length=0),Ce||me||Ne?P.textContent=X:$++,z!==this.defaultSpacing&&(P.style.letterSpacing=`${z}px`),W.push(P),ie=Me}return P&&$&&(P.textContent=X),W}_applyMinimumContrast(w,E,b,R,j,M){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.excludeFromContrastRatioDemands)(R.getCode()))return!1;const L=this._getContrastCache(R);let T;if(j||M||(T=L.getColor(E.rgba,b.rgba)),T===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(R.isDim()?2:1);T=g.color.ensureContrastRatio(j||E,M||b,B),L.setColor((j||E).rgba,(M||b).rgba,T??null)}return!!T&&(this._addStyle(w,`color:${T.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,E){w.setAttribute("style",`${w.getAttribute("style")||""}${E};`)}_isCellInSelection(w,E){const b=this._selectionStart,R=this._selectionEnd;return!(!b||!R)&&(this._columnSelectMode?b[0]<=R[0]?w>=b[0]&&E>=b[1]&&w<R[0]&&E<=R[1]:w<b[0]&&E>=b[1]&&w>=R[0]&&E<=R[1]:E>b[1]&&E<R[1]||b[1]===R[1]&&E===b[1]&&w>=b[0]&&w<R[0]||b[1]<R[1]&&E===R[1]&&w<R[0]||b[1]<R[1]&&E===b[1]&&w>=b[0])}};function y(w,E,b){for(;w.length<b;)w=E+w;return w}r.DomRendererRowFactory=_=c([f(1,n.ICharacterJoinerService),f(2,S.IOptionsService),f(3,n.ICoreBrowserService),f(4,S.ICoreService),f(5,S.IDecorationService),f(6,n.IThemeService)],_)},2550:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=i.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const c=i.createElement("span"),f=i.createElement("span");f.style.fontWeight="bold";const o=i.createElement("span");o.style.fontStyle="italic";const p=i.createElement("span");p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[c,f,o,p],this._container.appendChild(c),this._container.appendChild(f),this._container.appendChild(o),this._container.appendChild(p),i.body.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(i,c,f,o){i===this._font&&c===this._fontSize&&f===this._weight&&o===this._weightBold||(this._font=i,this._fontSize=c,this._weight=f,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(i,c,f){let o=0;if(!c&&!f&&i.length===1&&(o=i.charCodeAt(0))<256)return this._flat[o]!==-9999?this._flat[o]:this._flat[o]=this._measure(i,0);let p=i;c&&(p+="B"),f&&(p+="I");let x=this._holey.get(p);if(x===void 0){let S=0;c&&(S|=1),f&&(S|=2),x=this._measure(i,S),this._holey.set(p,x)}return x}_measure(i,c){const f=this._measureElements[c];return f.textContent=i.repeat(32),f.offsetWidth/32}}},2223:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const c=i(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(C,r)=>{function i(c){return 57508<=c&&c<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.createRenderDimensions=r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(c){if(!c)throw new Error("value must not be falsy");return c},r.isPowerlineGlyph=i,r.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},r.excludeFromContrastRatioDemands=function(c){return i(c)||(function(f){return 9472<=f&&f<=9631})(c)},r.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}}}}},456:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(i){this._bufferService=i,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()){const i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?i%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)-1]:[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[i,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[Math.max(i,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const i=this.selectionStart,c=this.selectionEnd;return!(!i||!c)&&(i[1]>c[1]||i[1]===c[1]&&i[0]>c[0])}handleTrim(i){return this.selectionStart&&(this.selectionStart[1]-=i),this.selectionEnd&&(this.selectionEnd[1]-=i),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(C,r,i){var c=this&&this.__decorate||function(n,d,h,u){var _,y=arguments.length,w=y<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,h,u);else for(var E=n.length-1;E>=0;E--)(_=n[E])&&(w=(y<3?_(w):y>3?_(d,h,w):_(d,h))||w);return y>3&&w&&Object.defineProperty(d,h,w),w},f=this&&this.__param||function(n,d){return function(h,u){d(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const o=i(2585),p=i(8460),x=i(844);let S=r.CharSizeService=class extends x.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(n,d,h){super(),this._optionsService=h,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new g(n,d,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const n=this._measureStrategy.measure();n.width===this.width&&n.height===this.height||(this.width=n.width,this.height=n.height,this._onCharSizeChange.fire())}};r.CharSizeService=S=c([f(2,o.IOptionsService)],S);class g{constructor(d,h,u){this._document=d,this._parentElement=h,this._optionsService=u,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const d={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return d.width!==0&&d.height!==0&&(this._result.width=d.width/32,this._result.height=Math.ceil(d.height)),this._result}}},4269:function(C,r,i){var c=this&&this.__decorate||function(d,h,u,_){var y,w=arguments.length,E=w<3?h:_===null?_=Object.getOwnPropertyDescriptor(h,u):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(d,h,u,_);else for(var b=d.length-1;b>=0;b--)(y=d[b])&&(E=(w<3?y(E):w>3?y(h,u,E):y(h,u))||E);return w>3&&E&&Object.defineProperty(h,u,E),E},f=this&&this.__param||function(d,h){return function(u,_){h(u,_,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const o=i(3734),p=i(643),x=i(511),S=i(2585);class g extends o.AttributeData{constructor(h,u,_){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=u,this._width=_}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(h){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=g;let n=r.CharacterJoinerService=class Xn{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new x.CellData}register(h){const u={id:this._nextCharacterJoinerId++,handler:h};return this._characterJoiners.push(u),u.id}deregister(h){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===h)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(h){if(this._characterJoiners.length===0)return[];const u=this._bufferService.buffer.lines.get(h);if(!u||u.length===0)return[];const _=[],y=u.translateToString(!0);let w=0,E=0,b=0,R=u.getFg(0),j=u.getBg(0);for(let M=0;M<u.getTrimmedLength();M++)if(u.loadCell(M,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==R||this._workCell.bg!==j){if(M-w>1){const L=this._getJoinedRanges(y,b,E,u,w);for(let T=0;T<L.length;T++)_.push(L[T])}w=M,b=E,R=this._workCell.fg,j=this._workCell.bg}E+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){const M=this._getJoinedRanges(y,b,E,u,w);for(let L=0;L<M.length;L++)_.push(M[L])}return _}_getJoinedRanges(h,u,_,y,w){const E=h.substring(u,_);let b=[];try{b=this._characterJoiners[0].handler(E)}catch(R){console.error(R)}for(let R=1;R<this._characterJoiners.length;R++)try{const j=this._characterJoiners[R].handler(E);for(let M=0;M<j.length;M++)Xn._mergeRanges(b,j[M])}catch(j){console.error(j)}return this._stringRangesToCellRanges(b,y,w),b}_stringRangesToCellRanges(h,u,_){let y=0,w=!1,E=0,b=h[y];if(b){for(let R=_;R<this._bufferService.cols;R++){const j=u.getWidth(R),M=u.getString(R).length||p.WHITESPACE_CELL_CHAR.length;if(j!==0){if(!w&&b[0]<=E&&(b[0]=R,w=!0),b[1]<=E){if(b[1]=R,b=h[++y],!b)break;b[0]<=E?(b[0]=R,w=!0):w=!1}E+=M}}b&&(b[1]=this._bufferService.cols)}}static _mergeRanges(h,u){let _=!1;for(let y=0;y<h.length;y++){const w=h[y];if(_){if(u[1]<=w[0])return h[y-1][1]=u[1],h;if(u[1]<=w[1])return h[y-1][1]=Math.max(u[1],w[1]),h.splice(y,1),h;h.splice(y,1),y--}else{if(u[1]<=w[0])return h.splice(y,0,u),h;if(u[1]<=w[1])return w[0]=Math.min(u[0],w[0]),h;u[0]<w[1]&&(w[0]=Math.min(u[0],w[0]),_=!0)}}return _?h[h.length-1][1]=u[1]:h.push(u),h}};r.CharacterJoinerService=n=c([f(0,S.IBufferService)],n)},5114:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(i,c){this._textarea=i,this.window=c,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}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}}},8934:function(C,r,i){var c=this&&this.__decorate||function(S,g,n,d){var h,u=arguments.length,_=u<3?g:d===null?d=Object.getOwnPropertyDescriptor(g,n):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(S,g,n,d);else for(var y=S.length-1;y>=0;y--)(h=S[y])&&(_=(u<3?h(_):u>3?h(g,n,_):h(g,n))||_);return u>3&&_&&Object.defineProperty(g,n,_),_},f=this&&this.__param||function(S,g){return function(n,d){g(n,d,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const o=i(4725),p=i(9806);let x=r.MouseService=class{constructor(S,g){this._renderService=S,this._charSizeService=g}getCoords(S,g,n,d,h){return(0,p.getCoords)(window,S,g,n,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,h)}getMouseReportCoords(S,g){const n=(0,p.getCoordsRelativeToElement)(window,S,g);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])}}};r.MouseService=x=c([f(0,o.IRenderService),f(1,o.ICharSizeService)],x)},3230:function(C,r,i){var c=this&&this.__decorate||function(_,y,w,E){var b,R=arguments.length,j=R<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(_,y,w,E);else for(var M=_.length-1;M>=0;M--)(b=_[M])&&(j=(R<3?b(j):R>3?b(y,w,j):b(y,w))||j);return R>3&&j&&Object.defineProperty(y,w,j),j},f=this&&this.__param||function(_,y){return function(w,E){y(w,E,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const o=i(3656),p=i(6193),x=i(5596),S=i(4725),g=i(8460),n=i(844),d=i(7226),h=i(2585);let u=r.RenderService=class extends n.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(_,y,w,E,b,R,j,M){if(super(),this._rowCount=_,this._charSizeService=E,this._renderer=this.register(new n.MutableDisposable),this._pausedResizeTask=new d.DebouncedIdleTask,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 g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new p.RenderDebouncer(j.window,((L,T)=>this._renderRows(L,T))),this.register(this._renderDebouncer),this._screenDprMonitor=new x.ScreenDprMonitor(j.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var L;return(L=this._renderer.value)===null||L===void 0?void 0:L.clear()}))),this.register(w.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(b.onDecorationRegistered((()=>this._fullRefresh()))),this.register(b.onDecorationRemoved((()=>this._fullRefresh()))),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register((0,o.addDisposableDomListener)(j.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(M.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in j.window){const L=new j.window.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});L.observe(y),this.register({dispose:()=>L.disconnect()})}}_handleIntersectionChange(_){this._isPaused=_.isIntersecting===void 0?_.intersectionRatio===0:!_.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(_,y,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(_,y,this._rowCount))}_renderRows(_,y){this._renderer.value&&(_=Math.min(_,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(_,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:_,end:y}),this._onRender.fire({start:_,end:y}),this._isNextRenderRedrawOnly=!0)}resize(_,y){this._rowCount=y,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(_){this._renderer.value=_,this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(_){return this._renderDebouncer.addRefreshCallback(_)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var _,y;this._renderer.value&&((y=(_=this._renderer.value).clearTextureAtlas)===null||y===void 0||y.call(_),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(_,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(_,y))):this._renderer.value.handleResize(_,y),this._fullRefresh())}handleCharSizeChanged(){var _;(_=this._renderer.value)===null||_===void 0||_.handleCharSizeChanged()}handleBlur(){var _;(_=this._renderer.value)===null||_===void 0||_.handleBlur()}handleFocus(){var _;(_=this._renderer.value)===null||_===void 0||_.handleFocus()}handleSelectionChanged(_,y,w){var E;this._selectionState.start=_,this._selectionState.end=y,this._selectionState.columnSelectMode=w,(E=this._renderer.value)===null||E===void 0||E.handleSelectionChanged(_,y,w)}handleCursorMove(){var _;(_=this._renderer.value)===null||_===void 0||_.handleCursorMove()}clear(){var _;(_=this._renderer.value)===null||_===void 0||_.clear()}};r.RenderService=u=c([f(2,h.IOptionsService),f(3,S.ICharSizeService),f(4,h.IDecorationService),f(5,h.IBufferService),f(6,S.ICoreBrowserService),f(7,S.IThemeService)],u)},9312:function(C,r,i){var c=this&&this.__decorate||function(b,R,j,M){var L,T=arguments.length,B=T<3?R:M===null?M=Object.getOwnPropertyDescriptor(R,j):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(b,R,j,M);else for(var I=b.length-1;I>=0;I--)(L=b[I])&&(B=(T<3?L(B):T>3?L(R,j,B):L(R,j))||B);return T>3&&B&&Object.defineProperty(R,j,B),B},f=this&&this.__param||function(b,R){return function(j,M){R(j,M,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const o=i(9806),p=i(9504),x=i(456),S=i(4725),g=i(8460),n=i(844),d=i(6114),h=i(4841),u=i(511),_=i(2585),y=" ",w=new RegExp(y,"g");let E=r.SelectionService=class extends n.Disposable{constructor(b,R,j,M,L,T,B,I,H){super(),this._element=b,this._screenElement=R,this._linkifier=j,this._bufferService=M,this._coreService=L,this._mouseService=T,this._optionsService=B,this._renderService=I,this._coreBrowserService=H,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new g.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new g.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=W=>this._handleMouseMove(W),this._mouseUpListener=W=>this._handleMouseUp(W),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((W=>this._handleTrim(W))),this.register(this._bufferService.buffers.onBufferActivate((W=>this._handleBufferActivate(W)))),this.enable(),this._model=new x.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,n.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(){const b=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;return!(!b||!R||b[0]===R[0]&&b[1]===R[1])}get selectionText(){const b=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;if(!b||!R)return"";const j=this._bufferService.buffer,M=[];if(this._activeSelectionMode===3){if(b[0]===R[0])return"";const L=b[0]<R[0]?b[0]:R[0],T=b[0]<R[0]?R[0]:b[0];for(let B=b[1];B<=R[1];B++){const I=j.translateBufferLineToString(B,!0,L,T);M.push(I)}}else{const L=b[1]===R[1]?R[0]:void 0;M.push(j.translateBufferLineToString(b[1],!0,b[0],L));for(let T=b[1]+1;T<=R[1]-1;T++){const B=j.lines.get(T),I=j.translateBufferLineToString(T,!0);B?.isWrapped?M[M.length-1]+=I:M.push(I)}if(b[1]!==R[1]){const T=j.lines.get(R[1]),B=j.translateBufferLineToString(R[1],!0,0,R[0]);T&&T.isWrapped?M[M.length-1]+=B:M.push(B)}}return M.map((L=>L.replace(w," "))).join(d.isWindows?`\r
|
|
16
16
|
`:`
|
|
17
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(b){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.isLinux&&b&&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(b){const R=this._getMouseBufferCoords(b),j=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!!(j&&M&&R)&&this._areCoordsInSelection(R,j,M)}isCellInSelection(b,R){const j=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!j||!M)&&this._areCoordsInSelection([b,R],j,M)}_areCoordsInSelection(b,R,j){return b[1]>R[1]&&b[1]<j[1]||R[1]===j[1]&&b[1]===R[1]&&b[0]>=R[0]&&b[0]<j[0]||R[1]<j[1]&&b[1]===j[1]&&b[0]<j[0]||R[1]<j[1]&&b[1]===R[1]&&b[0]>=R[0]}_selectWordAtCursor(b,R){var j,M;const L=(M=(j=this._linkifier.currentLink)===null||j===void 0?void 0:j.link)===null||M===void 0?void 0:M.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,h.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const T=this._getMouseBufferCoords(b);return!!T&&(this._selectWordAt(T,R),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(b,R){this._model.clearSelection(),b=Math.max(b,0),R=Math.min(R,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,b],this._model.selectionEnd=[this._bufferService.cols,R],this.refresh(),this._onSelectionChange.fire()}_handleTrim(b){this._model.handleTrim(b)&&this.refresh()}_getMouseBufferCoords(b){const R=this._mouseService.getCoords(b,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(R)return R[0]--,R[1]--,R[1]+=this._bufferService.buffer.ydisp,R}_getMouseEventScrollAmount(b){let R=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,b,this._screenElement)[1];const j=this._renderService.dimensions.css.canvas.height;return R>=0&&R<=j?0:(R>j&&(R-=j),R=Math.min(Math.max(R,-50),50),R/=50,R/Math.abs(R)+Math.round(14*R))}shouldForceSelection(b){return d.isMac?b.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:b.shiftKey}handleMouseDown(b){if(this._mouseDownTimeStamp=b.timeStamp,(b.button!==2||!this.hasSelection)&&b.button===0){if(!this._enabled){if(!this.shouldForceSelection(b))return;b.stopPropagation()}b.preventDefault(),this._dragScrollAmount=0,this._enabled&&b.shiftKey?this._handleIncrementalClick(b):b.detail===1?this._handleSingleClick(b):b.detail===2?this._handleDoubleClick(b):b.detail===3&&this._handleTripleClick(b),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(b){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(b))}_handleSingleClick(b){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(b)?3:0,this._model.selectionStart=this._getMouseBufferCoords(b),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const R=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);R&&R.length!==this._model.selectionStart[0]&&R.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(b){this._selectWordAtCursor(b,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(b){const R=this._getMouseBufferCoords(b);R&&(this._activeSelectionMode=2,this._selectLineAt(R[1]))}shouldColumnSelect(b){return b.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(b){if(b.stopImmediatePropagation(),!this._model.selectionStart)return;const R=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(b),!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(b),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const j=this._bufferService.buffer;if(this._model.selectionEnd[1]<j.lines.length){const M=j.lines.get(this._model.selectionEnd[1]);M&&M.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}R&&R[0]===this._model.selectionEnd[0]&&R[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});const b=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(b.ydisp+this._bufferService.rows,b.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=b.ydisp),this.refresh()}}_handleMouseUp(b){const R=b.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&R<500&&b.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const j=this._mouseService.getCoords(b,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(j&&j[0]!==void 0&&j[1]!==void 0){const M=(0,p.moveToCellSequence)(j[0]-1,j[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(M,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const b=this._model.finalSelectionStart,R=this._model.finalSelectionEnd,j=!(!b||!R||b[0]===R[0]&&b[1]===R[1]);j?b&&R&&(this._oldSelectionStart&&this._oldSelectionEnd&&b[0]===this._oldSelectionStart[0]&&b[1]===this._oldSelectionStart[1]&&R[0]===this._oldSelectionEnd[0]&&R[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(b,R,j)):this._oldHasSelection&&this._fireOnSelectionChange(b,R,j)}_fireOnSelectionChange(b,R,j){this._oldSelectionStart=b,this._oldSelectionEnd=R,this._oldHasSelection=j,this._onSelectionChange.fire()}_handleBufferActivate(b){this.clearSelection(),this._trimListener.dispose(),this._trimListener=b.activeBuffer.lines.onTrim((R=>this._handleTrim(R)))}_convertViewportColToCharacterIndex(b,R){let j=R;for(let M=0;R>=M;M++){const L=b.loadCell(M,this._workCell).getChars().length;this._workCell.getWidth()===0?j--:L>1&&R!==M&&(j+=L-1)}return j}setSelection(b,R,j){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[b,R],this._model.selectionStartLength=j,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(b){this._isClickInSelection(b)||(this._selectWordAtCursor(b,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(b,R,j=!0,M=!0){if(b[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,T=L.lines.get(b[1]);if(!T)return;const B=L.translateBufferLineToString(b[1],!1);let I=this._convertViewportColToCharacterIndex(T,b[0]),H=I;const W=b[0]-I;let A=0,N=0,P=0,O=0;if(B.charAt(I)===" "){for(;I>0&&B.charAt(I-1)===" ";)I--;for(;H<B.length&&B.charAt(H+1)===" ";)H++}else{let K=b[0],Q=b[0];T.getWidth(K)===0&&(A++,K--),T.getWidth(Q)===2&&(N++,Q++);const se=T.getString(Q).length;for(se>1&&(O+=se-1,H+=se-1);K>0&&I>0&&!this._isCharWordSeparator(T.loadCell(K-1,this._workCell));){T.loadCell(K-1,this._workCell);const D=this._workCell.getChars().length;this._workCell.getWidth()===0?(A++,K--):D>1&&(P+=D-1,I-=D-1),I--,K--}for(;Q<T.length&&H+1<B.length&&!this._isCharWordSeparator(T.loadCell(Q+1,this._workCell));){T.loadCell(Q+1,this._workCell);const D=this._workCell.getChars().length;this._workCell.getWidth()===2?(N++,Q++):D>1&&(O+=D-1,H+=D-1),H++,Q++}}H++;let $=I+W-A+P,X=Math.min(this._bufferService.cols,H-I+A+N-P-O);if(R||B.slice(I,H).trim()!==""){if(j&&$===0&&T.getCodePoint(0)!==32){const K=L.lines.get(b[1]-1);if(K&&T.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){const Q=this._getWordAt([this._bufferService.cols-1,b[1]-1],!1,!0,!1);if(Q){const se=this._bufferService.cols-Q.start;$-=se,X+=se}}}if(M&&$+X===this._bufferService.cols&&T.getCodePoint(this._bufferService.cols-1)!==32){const K=L.lines.get(b[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){const Q=this._getWordAt([0,b[1]+1],!1,!1,!0);Q&&(X+=Q.length)}}return{start:$,length:X}}}_selectWordAt(b,R){const j=this._getWordAt(b,R);if(j){for(;j.start<0;)j.start+=this._bufferService.cols,b[1]--;this._model.selectionStart=[j.start,b[1]],this._model.selectionStartLength=j.length}}_selectToWordAt(b){const R=this._getWordAt(b,!0);if(R){let j=b[1];for(;R.start<0;)R.start+=this._bufferService.cols,j--;if(!this._model.areSelectionValuesReversed())for(;R.start+R.length>this._bufferService.cols;)R.length-=this._bufferService.cols,j++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?R.start:R.start+R.length,j]}}_isCharWordSeparator(b){return b.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(b.getChars())>=0}_selectLineAt(b){const R=this._bufferService.buffer.getWrappedRangeForLine(b),j={start:{x:0,y:R.first},end:{x:this._bufferService.cols-1,y:R.last}};this._model.selectionStart=[0,R.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(j,this._bufferService.cols)}};r.SelectionService=E=c([f(3,_.IBufferService),f(4,_.ICoreService),f(5,S.IMouseService),f(6,_.IOptionsService),f(7,S.IRenderService),f(8,S.ICoreBrowserService)],E)},4725:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const c=i(8343);r.ICharSizeService=(0,c.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),r.IMouseService=(0,c.createDecorator)("MouseService"),r.IRenderService=(0,c.createDecorator)("RenderService"),r.ISelectionService=(0,c.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,c.createDecorator)("ThemeService")},6731:function(C,r,i){var c=this&&this.__decorate||function(E,b,R,j){var M,L=arguments.length,T=L<3?b:j===null?j=Object.getOwnPropertyDescriptor(b,R):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(E,b,R,j);else for(var B=E.length-1;B>=0;B--)(M=E[B])&&(T=(L<3?M(T):L>3?M(b,R,T):M(b,R))||T);return L>3&&T&&Object.defineProperty(b,R,T),T},f=this&&this.__param||function(E,b){return function(R,j){b(R,j,E)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const o=i(7239),p=i(8055),x=i(8460),S=i(844),g=i(2585),n=p.css.toColor("#ffffff"),d=p.css.toColor("#000000"),h=p.css.toColor("#ffffff"),u=p.css.toColor("#000000"),_={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const E=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],b=[0,95,135,175,215,255];for(let R=0;R<216;R++){const j=b[R/36%6|0],M=b[R/6%6|0],L=b[R%6];E.push({css:p.channels.toCss(j,M,L),rgba:p.channels.toRgba(j,M,L)})}for(let R=0;R<24;R++){const j=8+10*R;E.push({css:p.channels.toCss(j,j,j),rgba:p.channels.toRgba(j,j,j)})}return E})());let y=r.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(E){super(),this._optionsService=E,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new x.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:n,background:d,cursor:h,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:_,selectionBackgroundOpaque:p.color.blend(d,_),selectionInactiveBackgroundTransparent:_,selectionInactiveBackgroundOpaque:p.color.blend(d,_),ansi:r.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={}){const b=this._colors;if(b.foreground=w(E.foreground,n),b.background=w(E.background,d),b.cursor=w(E.cursor,h),b.cursorAccent=w(E.cursorAccent,u),b.selectionBackgroundTransparent=w(E.selectionBackground,_),b.selectionBackgroundOpaque=p.color.blend(b.background,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundTransparent=w(E.selectionInactiveBackground,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundOpaque=p.color.blend(b.background,b.selectionInactiveBackgroundTransparent),b.selectionForeground=E.selectionForeground?w(E.selectionForeground,p.NULL_COLOR):void 0,b.selectionForeground===p.NULL_COLOR&&(b.selectionForeground=void 0),p.color.isOpaque(b.selectionBackgroundTransparent)&&(b.selectionBackgroundTransparent=p.color.opacity(b.selectionBackgroundTransparent,.3)),p.color.isOpaque(b.selectionInactiveBackgroundTransparent)&&(b.selectionInactiveBackgroundTransparent=p.color.opacity(b.selectionInactiveBackgroundTransparent,.3)),b.ansi=r.DEFAULT_ANSI_COLORS.slice(),b.ansi[0]=w(E.black,r.DEFAULT_ANSI_COLORS[0]),b.ansi[1]=w(E.red,r.DEFAULT_ANSI_COLORS[1]),b.ansi[2]=w(E.green,r.DEFAULT_ANSI_COLORS[2]),b.ansi[3]=w(E.yellow,r.DEFAULT_ANSI_COLORS[3]),b.ansi[4]=w(E.blue,r.DEFAULT_ANSI_COLORS[4]),b.ansi[5]=w(E.magenta,r.DEFAULT_ANSI_COLORS[5]),b.ansi[6]=w(E.cyan,r.DEFAULT_ANSI_COLORS[6]),b.ansi[7]=w(E.white,r.DEFAULT_ANSI_COLORS[7]),b.ansi[8]=w(E.brightBlack,r.DEFAULT_ANSI_COLORS[8]),b.ansi[9]=w(E.brightRed,r.DEFAULT_ANSI_COLORS[9]),b.ansi[10]=w(E.brightGreen,r.DEFAULT_ANSI_COLORS[10]),b.ansi[11]=w(E.brightYellow,r.DEFAULT_ANSI_COLORS[11]),b.ansi[12]=w(E.brightBlue,r.DEFAULT_ANSI_COLORS[12]),b.ansi[13]=w(E.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),b.ansi[14]=w(E.brightCyan,r.DEFAULT_ANSI_COLORS[14]),b.ansi[15]=w(E.brightWhite,r.DEFAULT_ANSI_COLORS[15]),E.extendedAnsi){const R=Math.min(b.ansi.length-16,E.extendedAnsi.length);for(let j=0;j<R;j++)b.ansi[j+16]=w(E.extendedAnsi[j],r.DEFAULT_ANSI_COLORS[j+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 b=0;b<this._restoreColors.ansi.length;++b)this._colors.ansi[b]=this._restoreColors.ansi[b]}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 w(E,b){if(E!==void 0)try{return p.css.toColor(E)}catch{}return b}r.ThemeService=y=c([f(0,g.IOptionsService)],y)},6349:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const c=i(8460),f=i(844);class o extends f.Disposable{constructor(x){super(),this._maxLength=x,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(x){if(this._maxLength===x)return;const S=new Array(x);for(let g=0;g<Math.min(x,this.length);g++)S[g]=this._array[this._getCyclicIndex(g)];this._array=S,this._maxLength=x,this._startIndex=0}get length(){return this._length}set length(x){if(x>this._length)for(let S=this._length;S<x;S++)this._array[S]=void 0;this._length=x}get(x){return this._array[this._getCyclicIndex(x)]}set(x,S){this._array[this._getCyclicIndex(x)]=S}push(x){this._array[this._getCyclicIndex(this._length)]=x,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new 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(x,S,...g){if(S){for(let n=x;n<this._length-S;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+S)];this._length-=S,this.onDeleteEmitter.fire({index:x,amount:S})}for(let n=this._length-1;n>=x;n--)this._array[this._getCyclicIndex(n+g.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<g.length;n++)this._array[this._getCyclicIndex(x+n)]=g[n];if(g.length&&this.onInsertEmitter.fire({index:x,amount:g.length}),this._length+g.length>this._maxLength){const n=this._length+g.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=g.length}trimStart(x){x>this._length&&(x=this._length),this._startIndex+=x,this._length-=x,this.onTrimEmitter.fire(x)}shiftElements(x,S,g){if(!(S<=0)){if(x<0||x>=this._length)throw new Error("start argument out of range");if(x+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let d=S-1;d>=0;d--)this.set(x+d+g,this.get(x+d));const n=x+S+g-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<S;n++)this.set(x+n+g,this.get(x+n))}}_getCyclicIndex(x){return(this._startIndex+x)%this._maxLength}}r.CircularList=o},1439:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function i(c,f=5){if(typeof c!="object")return c;const o=Array.isArray(c)?[]:{};for(const p in c)o[p]=f<=1?c[p]:c[p]&&i(c[p],f-1);return o}},8055:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;const c=i(6114);let f=0,o=0,p=0,x=0;var S,g,n,d,h;function u(y){const w=y.toString(16);return w.length<2?"0"+w:w}function _(y,w){return y<w?(w+.05)/(y+.05):(y+.05)/(w+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(y){y.toCss=function(w,E,b,R){return R!==void 0?`#${u(w)}${u(E)}${u(b)}${u(R)}`:`#${u(w)}${u(E)}${u(b)}`},y.toRgba=function(w,E,b,R=255){return(w<<24|E<<16|b<<8|R)>>>0}})(S||(r.channels=S={})),(function(y){function w(E,b){return x=Math.round(255*b),[f,o,p]=h.toChannels(E.rgba),{css:S.toCss(f,o,p,x),rgba:S.toRgba(f,o,p,x)}}y.blend=function(E,b){if(x=(255&b.rgba)/255,x===1)return{css:b.css,rgba:b.rgba};const R=b.rgba>>24&255,j=b.rgba>>16&255,M=b.rgba>>8&255,L=E.rgba>>24&255,T=E.rgba>>16&255,B=E.rgba>>8&255;return f=L+Math.round((R-L)*x),o=T+Math.round((j-T)*x),p=B+Math.round((M-B)*x),{css:S.toCss(f,o,p),rgba:S.toRgba(f,o,p)}},y.isOpaque=function(E){return(255&E.rgba)==255},y.ensureContrastRatio=function(E,b,R){const j=h.ensureContrastRatio(E.rgba,b.rgba,R);if(j)return h.toColor(j>>24&255,j>>16&255,j>>8&255)},y.opaque=function(E){const b=(255|E.rgba)>>>0;return[f,o,p]=h.toChannels(b),{css:S.toCss(f,o,p),rgba:b}},y.opacity=w,y.multiplyOpacity=function(E,b){return x=255&E.rgba,w(E,x*b/255)},y.toColorRGB=function(E){return[E.rgba>>24&255,E.rgba>>16&255,E.rgba>>8&255]}})(g||(r.color=g={})),(function(y){let w,E;if(!c.isNode){const b=document.createElement("canvas");b.width=1,b.height=1;const R=b.getContext("2d",{willReadFrequently:!0});R&&(w=R,w.globalCompositeOperation="copy",E=w.createLinearGradient(0,0,1,1))}y.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return f=parseInt(b.slice(1,2).repeat(2),16),o=parseInt(b.slice(2,3).repeat(2),16),p=parseInt(b.slice(3,4).repeat(2),16),h.toColor(f,o,p);case 5:return f=parseInt(b.slice(1,2).repeat(2),16),o=parseInt(b.slice(2,3).repeat(2),16),p=parseInt(b.slice(3,4).repeat(2),16),x=parseInt(b.slice(4,5).repeat(2),16),h.toColor(f,o,p,x);case 7:return{css:b,rgba:(parseInt(b.slice(1),16)<<8|255)>>>0};case 9:return{css:b,rgba:parseInt(b.slice(1),16)>>>0}}const R=b.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return f=parseInt(R[1]),o=parseInt(R[2]),p=parseInt(R[3]),x=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),h.toColor(f,o,p,x);if(!w||!E)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=E,w.fillStyle=b,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[f,o,p,x]=w.getImageData(0,0,1,1).data,x!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(f,o,p,x),css:b}}})(n||(r.css=n={})),(function(y){function w(E,b,R){const j=E/255,M=b/255,L=R/255;return .2126*(j<=.03928?j/12.92:Math.pow((j+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}y.relativeLuminance=function(E){return w(E>>16&255,E>>8&255,255&E)},y.relativeLuminance2=w})(d||(r.rgb=d={})),(function(y){function w(b,R,j){const M=b>>24&255,L=b>>16&255,T=b>>8&255;let B=R>>24&255,I=R>>16&255,H=R>>8&255,W=_(d.relativeLuminance2(B,I,H),d.relativeLuminance2(M,L,T));for(;W<j&&(B>0||I>0||H>0);)B-=Math.max(0,Math.ceil(.1*B)),I-=Math.max(0,Math.ceil(.1*I)),H-=Math.max(0,Math.ceil(.1*H)),W=_(d.relativeLuminance2(B,I,H),d.relativeLuminance2(M,L,T));return(B<<24|I<<16|H<<8|255)>>>0}function E(b,R,j){const M=b>>24&255,L=b>>16&255,T=b>>8&255;let B=R>>24&255,I=R>>16&255,H=R>>8&255,W=_(d.relativeLuminance2(B,I,H),d.relativeLuminance2(M,L,T));for(;W<j&&(B<255||I<255||H<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),I=Math.min(255,I+Math.ceil(.1*(255-I))),H=Math.min(255,H+Math.ceil(.1*(255-H))),W=_(d.relativeLuminance2(B,I,H),d.relativeLuminance2(M,L,T));return(B<<24|I<<16|H<<8|255)>>>0}y.ensureContrastRatio=function(b,R,j){const M=d.relativeLuminance(b>>8),L=d.relativeLuminance(R>>8);if(_(M,L)<j){if(L<M){const I=w(b,R,j),H=_(M,d.relativeLuminance(I>>8));if(H<j){const W=E(b,R,j);return H>_(M,d.relativeLuminance(W>>8))?I:W}return I}const T=E(b,R,j),B=_(M,d.relativeLuminance(T>>8));if(B<j){const I=w(b,R,j);return B>_(M,d.relativeLuminance(I>>8))?T:I}return T}},y.reduceLuminance=w,y.increaseLuminance=E,y.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]},y.toColor=function(b,R,j,M){return{css:S.toCss(b,R,j,M),rgba:S.toRgba(b,R,j,M)}}})(h||(r.rgba=h={})),r.toPaddedHex=u,r.contrastRatio=_},8969:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const c=i(844),f=i(2585),o=i(4348),p=i(7866),x=i(744),S=i(7302),g=i(6975),n=i(8460),d=i(1753),h=i(1480),u=i(7994),_=i(9282),y=i(5435),w=i(5981),E=i(2660);let b=!1;class R extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new n.EventEmitter),this._onScroll.event((M=>{var L;(L=this._onScrollApi)===null||L===void 0||L.fire(M.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(M){for(const L in M)this.optionsService.options[L]=M[L]}constructor(M){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new n.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new n.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new n.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new n.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new S.OptionsService(M)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(x.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(g.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(E.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new y.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,n.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,n.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,n.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,n.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((L=>{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((L=>{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 w.WriteBuffer(((L,T)=>this._inputHandler.parse(L,T)))),this.register((0,n.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(M,L){this._writeBuffer.write(M,L)}writeSync(M,L){this._logService.logLevel<=f.LogLevelEnum.WARN&&!b&&(this._logService.warn("writeSync is unreliable and will be removed soon."),b=!0),this._writeBuffer.writeSync(M,L)}resize(M,L){isNaN(M)||isNaN(L)||(M=Math.max(M,x.MINIMUM_COLS),L=Math.max(L,x.MINIMUM_ROWS),this._bufferService.resize(M,L))}scroll(M,L=!1){this._bufferService.scroll(M,L)}scrollLines(M,L,T){this._bufferService.scrollLines(M,L,T)}scrollPages(M){this.scrollLines(M*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(M){const L=M-this._bufferService.buffer.ydisp;L!==0&&this.scrollLines(L)}registerEscHandler(M,L){return this._inputHandler.registerEscHandler(M,L)}registerDcsHandler(M,L){return this._inputHandler.registerDcsHandler(M,L)}registerCsiHandler(M,L){return this._inputHandler.registerCsiHandler(M,L)}registerOscHandler(M,L){return this._inputHandler.registerOscHandler(M,L)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let M=!1;const L=this.optionsService.rawOptions.windowsPty;L&&L.buildNumber!==void 0&&L.buildNumber!==void 0?M=L.backend==="conpty"&&L.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(M=!0),M?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const M=[];M.push(this.onLineFeed(_.updateWindowsModeWrappedState.bind(null,this._bufferService))),M.push(this.registerCsiHandler({final:"H"},(()=>((0,_.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const L of M)L.dispose()}))}}}r.CoreTerminal=R},8460:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=i=>(this._listeners.push(i),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===i)return void this._listeners.splice(c,1)}}})),this._event}fire(i,c){const f=[];for(let o=0;o<this._listeners.length;o++)f.push(this._listeners[o]);for(let o=0;o<f.length;o++)f[o].call(void 0,i,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(i,c){return i((f=>c.fire(f)))}},5435:function(C,r,i){var c=this&&this.__decorate||function(W,A,N,P){var O,$=arguments.length,X=$<3?A:P===null?P=Object.getOwnPropertyDescriptor(A,N):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(W,A,N,P);else for(var K=W.length-1;K>=0;K--)(O=W[K])&&(X=($<3?O(X):$>3?O(A,N,X):O(A,N))||X);return $>3&&X&&Object.defineProperty(A,N,X),X},f=this&&this.__param||function(W,A){return function(N,P){A(N,P,W)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const o=i(2584),p=i(7116),x=i(2015),S=i(844),g=i(482),n=i(8437),d=i(8460),h=i(643),u=i(511),_=i(3734),y=i(2585),w=i(6242),E=i(6351),b=i(5941),R={"(":0,")":1,"*":2,"+":3,"-":1,".":2},j=131072;function M(W,A){if(W>24)return A.setWinLines||!1;switch(W){case 1:return!!A.restoreWin;case 2:return!!A.minimizeWin;case 3:return!!A.setWinPosition;case 4:return!!A.setWinSizePixels;case 5:return!!A.raiseWin;case 6:return!!A.lowerWin;case 7:return!!A.refreshWin;case 8:return!!A.setWinSizeChars;case 9:return!!A.maximizeWin;case 10:return!!A.fullscreenWin;case 11:return!!A.getWinState;case 13:return!!A.getWinPosition;case 14:return!!A.getWinSizePixels;case 15:return!!A.getScreenSizePixels;case 16:return!!A.getCellSizePixels;case 18:return!!A.getWinSizeChars;case 19:return!!A.getScreenSizeChars;case 20:return!!A.getIconTitle;case 21:return!!A.getWinTitle;case 22:return!!A.pushTitle;case 23:return!!A.popTitle;case 24:return!!A.setWinLines}return!1}var L;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(L||(r.WindowsOptionsReportType=L={}));let T=0;class B extends S.Disposable{getAttrData(){return this._curAttrData}constructor(A,N,P,O,$,X,K,Q,se=new x.EscapeSequenceParser){super(),this._bufferService=A,this._charsetService=N,this._coreService=P,this._logService=O,this._optionsService=$,this._oscLinkService=X,this._coreMouseService=K,this._unicodeService=Q,this._parser=se,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new g.StringToUtf32,this._utf8Decoder=new g.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=n.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=n.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 I(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((D=>this._activeBuffer=D.activeBuffer))),this._parser.setCsiHandlerFallback(((D,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:F.toArray()})})),this._parser.setEscHandlerFallback((D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})})),this._parser.setExecuteHandlerFallback((D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})})),this._parser.setOscHandlerFallback(((D,F,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:F,data:U})})),this._parser.setDcsHandlerFallback(((D,F,U)=>{F==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:F,payload:U})})),this._parser.setPrintHandler(((D,F,U)=>this.print(D,F,U))),this._parser.registerCsiHandler({final:"@"},(D=>this.insertChars(D))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(D=>this.scrollLeft(D))),this._parser.registerCsiHandler({final:"A"},(D=>this.cursorUp(D))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(D=>this.scrollRight(D))),this._parser.registerCsiHandler({final:"B"},(D=>this.cursorDown(D))),this._parser.registerCsiHandler({final:"C"},(D=>this.cursorForward(D))),this._parser.registerCsiHandler({final:"D"},(D=>this.cursorBackward(D))),this._parser.registerCsiHandler({final:"E"},(D=>this.cursorNextLine(D))),this._parser.registerCsiHandler({final:"F"},(D=>this.cursorPrecedingLine(D))),this._parser.registerCsiHandler({final:"G"},(D=>this.cursorCharAbsolute(D))),this._parser.registerCsiHandler({final:"H"},(D=>this.cursorPosition(D))),this._parser.registerCsiHandler({final:"I"},(D=>this.cursorForwardTab(D))),this._parser.registerCsiHandler({final:"J"},(D=>this.eraseInDisplay(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(D=>this.eraseInDisplay(D,!0))),this._parser.registerCsiHandler({final:"K"},(D=>this.eraseInLine(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(D=>this.eraseInLine(D,!0))),this._parser.registerCsiHandler({final:"L"},(D=>this.insertLines(D))),this._parser.registerCsiHandler({final:"M"},(D=>this.deleteLines(D))),this._parser.registerCsiHandler({final:"P"},(D=>this.deleteChars(D))),this._parser.registerCsiHandler({final:"S"},(D=>this.scrollUp(D))),this._parser.registerCsiHandler({final:"T"},(D=>this.scrollDown(D))),this._parser.registerCsiHandler({final:"X"},(D=>this.eraseChars(D))),this._parser.registerCsiHandler({final:"Z"},(D=>this.cursorBackwardTab(D))),this._parser.registerCsiHandler({final:"`"},(D=>this.charPosAbsolute(D))),this._parser.registerCsiHandler({final:"a"},(D=>this.hPositionRelative(D))),this._parser.registerCsiHandler({final:"b"},(D=>this.repeatPrecedingCharacter(D))),this._parser.registerCsiHandler({final:"c"},(D=>this.sendDeviceAttributesPrimary(D))),this._parser.registerCsiHandler({prefix:">",final:"c"},(D=>this.sendDeviceAttributesSecondary(D))),this._parser.registerCsiHandler({final:"d"},(D=>this.linePosAbsolute(D))),this._parser.registerCsiHandler({final:"e"},(D=>this.vPositionRelative(D))),this._parser.registerCsiHandler({final:"f"},(D=>this.hVPosition(D))),this._parser.registerCsiHandler({final:"g"},(D=>this.tabClear(D))),this._parser.registerCsiHandler({final:"h"},(D=>this.setMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(D=>this.setModePrivate(D))),this._parser.registerCsiHandler({final:"l"},(D=>this.resetMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(D=>this.resetModePrivate(D))),this._parser.registerCsiHandler({final:"m"},(D=>this.charAttributes(D))),this._parser.registerCsiHandler({final:"n"},(D=>this.deviceStatus(D))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(D=>this.deviceStatusPrivate(D))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(D=>this.softReset(D))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(D=>this.setCursorStyle(D))),this._parser.registerCsiHandler({final:"r"},(D=>this.setScrollRegion(D))),this._parser.registerCsiHandler({final:"s"},(D=>this.saveCursor(D))),this._parser.registerCsiHandler({final:"t"},(D=>this.windowOptions(D))),this._parser.registerCsiHandler({final:"u"},(D=>this.restoreCursor(D))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(D=>this.insertColumns(D))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(D=>this.deleteColumns(D))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(D=>this.selectProtected(D))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(D=>this.requestMode(D,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(D=>this.requestMode(D,!1))),this._parser.setExecuteHandler(o.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(o.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(o.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(o.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(o.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(o.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(o.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(o.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(o.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new w.OscHandler((D=>(this.setTitle(D),this.setIconName(D),!0)))),this._parser.registerOscHandler(1,new w.OscHandler((D=>this.setIconName(D)))),this._parser.registerOscHandler(2,new w.OscHandler((D=>this.setTitle(D)))),this._parser.registerOscHandler(4,new w.OscHandler((D=>this.setOrReportIndexedColor(D)))),this._parser.registerOscHandler(8,new w.OscHandler((D=>this.setHyperlink(D)))),this._parser.registerOscHandler(10,new w.OscHandler((D=>this.setOrReportFgColor(D)))),this._parser.registerOscHandler(11,new w.OscHandler((D=>this.setOrReportBgColor(D)))),this._parser.registerOscHandler(12,new w.OscHandler((D=>this.setOrReportCursorColor(D)))),this._parser.registerOscHandler(104,new w.OscHandler((D=>this.restoreIndexedColor(D)))),this._parser.registerOscHandler(110,new w.OscHandler((D=>this.restoreFgColor(D)))),this._parser.registerOscHandler(111,new w.OscHandler((D=>this.restoreBgColor(D)))),this._parser.registerOscHandler(112,new w.OscHandler((D=>this.restoreCursorColor(D)))),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(const D in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},(()=>this.selectCharset("("+D))),this._parser.registerEscHandler({intermediates:")",final:D},(()=>this.selectCharset(")"+D))),this._parser.registerEscHandler({intermediates:"*",final:D},(()=>this.selectCharset("*"+D))),this._parser.registerEscHandler({intermediates:"+",final:D},(()=>this.selectCharset("+"+D))),this._parser.registerEscHandler({intermediates:"-",final:D},(()=>this.selectCharset("-"+D))),this._parser.registerEscHandler({intermediates:".",final:D},(()=>this.selectCharset("."+D))),this._parser.registerEscHandler({intermediates:"/",final:D},(()=>this.selectCharset("/"+D)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((D=>(this._logService.error("Parsing error: ",D),D))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new E.DcsHandler(((D,F)=>this.requestStatusString(D,F))))}_preserveStack(A,N,P,O){this._parseStack.paused=!0,this._parseStack.cursorStartX=A,this._parseStack.cursorStartY=N,this._parseStack.decodedLength=P,this._parseStack.position=O}_logSlowResolvingAsync(A){this._logService.logLevel<=y.LogLevelEnum.WARN&&Promise.race([A,new Promise(((N,P)=>setTimeout((()=>P("#SLOW_TIMEOUT")),5e3)))]).catch((N=>{if(N!=="#SLOW_TIMEOUT")throw N;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(A,N){let P,O=this._activeBuffer.x,$=this._activeBuffer.y,X=0;const K=this._parseStack.paused;if(K){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,N))return this._logSlowResolvingAsync(P),P;O=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,A.length>j&&(X=this._parseStack.position+j)}if(this._logService.logLevel<=y.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof A=="string"?` "${A}"`:` "${Array.prototype.map.call(A,(Q=>String.fromCharCode(Q))).join("")}"`),typeof A=="string"?A.split("").map((Q=>Q.charCodeAt(0))):A),this._parseBuffer.length<A.length&&this._parseBuffer.length<j&&(this._parseBuffer=new Uint32Array(Math.min(A.length,j))),K||this._dirtyRowTracker.clearRange(),A.length>j)for(let Q=X;Q<A.length;Q+=j){const se=Q+j<A.length?Q+j:A.length,D=typeof A=="string"?this._stringDecoder.decode(A.substring(Q,se),this._parseBuffer):this._utf8Decoder.decode(A.subarray(Q,se),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,D))return this._preserveStack(O,$,D,Q),this._logSlowResolvingAsync(P),P}else if(!K){const Q=typeof A=="string"?this._stringDecoder.decode(A,this._parseBuffer):this._utf8Decoder.decode(A,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,Q))return this._preserveStack(O,$,Q,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===O&&this._activeBuffer.y===$||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(A,N,P){let O,$;const X=this._charsetService.charset,K=this._optionsService.rawOptions.screenReaderMode,Q=this._bufferService.cols,se=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,F=this._curAttrData;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-N>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodePoint(this._activeBuffer.x-1,0,1,F.fg,F.bg,F.extended);for(let z=N;z<P;++z){if(O=A[z],$=this._unicodeService.wcwidth(O),O<127&&X){const te=X[String.fromCharCode(O)];te&&(O=te.charCodeAt(0))}if(K&&this._onA11yChar.fire((0,g.stringFromCodePoint)(O)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),$||!this._activeBuffer.x){if(this._activeBuffer.x+$-1>=Q){if(se){for(;this._activeBuffer.x<Q;)U.setCellFromCodePoint(this._activeBuffer.x++,0,1,F.fg,F.bg,F.extended);this._activeBuffer.x=0,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),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=Q-1,$===2)continue}if(D&&(U.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(F),F),U.getWidth(Q-1)===2&&U.setCellFromCodePoint(Q-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,F.fg,F.bg,F.extended)),U.setCellFromCodePoint(this._activeBuffer.x++,O,$,F.fg,F.bg,F.extended),$>0)for(;--$;)U.setCellFromCodePoint(this._activeBuffer.x++,0,0,F.fg,F.bg,F.extended)}else U.getWidth(this._activeBuffer.x-1)?U.addCodepointToCell(this._activeBuffer.x-1,O):U.addCodepointToCell(this._activeBuffer.x-2,O)}P-N>0&&(U.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<Q&&P-N>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodePoint(this._activeBuffer.x,0,1,F.fg,F.bg,F.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(A,N){return A.final!=="t"||A.prefix||A.intermediates?this._parser.registerCsiHandler(A,N):this._parser.registerCsiHandler(A,(P=>!M(P.params[0],this._optionsService.rawOptions.windowOptions)||N(P)))}registerDcsHandler(A,N){return this._parser.registerDcsHandler(A,new E.DcsHandler(N))}registerEscHandler(A,N){return this._parser.registerEscHandler(A,N)}registerOscHandler(A,N){return this._parser.registerOscHandler(A,new w.OscHandler(N))}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(){var A;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&&(!((A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||A===void 0)&&A.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);N.hasWidth(this._activeBuffer.x)&&!N.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const A=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-A),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(A=this._bufferService.cols-1){this._activeBuffer.x=Math.min(A,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(A,N){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=A,this._activeBuffer.y=this._activeBuffer.scrollTop+N):(this._activeBuffer.x=A,this._activeBuffer.y=N),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(A,N){this._restrictCursor(),this._setCursor(this._activeBuffer.x+A,this._activeBuffer.y+N)}cursorUp(A){const N=this._activeBuffer.y-this._activeBuffer.scrollTop;return N>=0?this._moveCursor(0,-Math.min(N,A.params[0]||1)):this._moveCursor(0,-(A.params[0]||1)),!0}cursorDown(A){const N=this._activeBuffer.scrollBottom-this._activeBuffer.y;return N>=0?this._moveCursor(0,Math.min(N,A.params[0]||1)):this._moveCursor(0,A.params[0]||1),!0}cursorForward(A){return this._moveCursor(A.params[0]||1,0),!0}cursorBackward(A){return this._moveCursor(-(A.params[0]||1),0),!0}cursorNextLine(A){return this.cursorDown(A),this._activeBuffer.x=0,!0}cursorPrecedingLine(A){return this.cursorUp(A),this._activeBuffer.x=0,!0}cursorCharAbsolute(A){return this._setCursor((A.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(A){return this._setCursor(A.length>=2?(A.params[1]||1)-1:0,(A.params[0]||1)-1),!0}charPosAbsolute(A){return this._setCursor((A.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(A){return this._moveCursor(A.params[0]||1,0),!0}linePosAbsolute(A){return this._setCursor(this._activeBuffer.x,(A.params[0]||1)-1),!0}vPositionRelative(A){return this._moveCursor(0,A.params[0]||1),!0}hVPosition(A){return this.cursorPosition(A),!0}tabClear(A){const N=A.params[0];return N===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:N===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(A){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let N=A.params[0]||1;for(;N--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(A){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let N=A.params[0]||1;for(;N--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(A){const N=A.params[0];return N===1&&(this._curAttrData.bg|=536870912),N!==2&&N!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(A,N,P,O=!1,$=!1){const X=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);X.replaceCells(N,P,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),$),O&&(X.isWrapped=!1)}_resetBufferLine(A,N=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),N),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+A),P.isWrapped=!1)}eraseInDisplay(A,N=!1){let P;switch(this._restrictCursor(this._bufferService.cols),A.params[0]){case 0:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,N);P<this._bufferService.rows;P++)this._resetBufferLine(P,N);this._dirtyRowTracker.markDirty(P);break;case 1:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P,0,this._activeBuffer.x+1,!0,N),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,N);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,N);this._dirtyRowTracker.markDirty(0);break;case 3:const O=this._activeBuffer.lines.length-this._bufferService.rows;O>0&&(this._activeBuffer.lines.trimStart(O),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-O,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-O,0),this._onScroll.fire(0))}return!0}eraseInLine(A,N=!1){switch(this._restrictCursor(this._bufferService.cols),A.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,N);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,N);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,N)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(A){this._restrictCursor();let N=A.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y,O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-O+1;for(;N--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(A){this._restrictCursor();let N=A.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y;let O;for(O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,O=this._bufferService.rows-1+this._activeBuffer.ybase-O;N--;)this._activeBuffer.lines.splice(P,1),this._activeBuffer.lines.splice(O,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(A){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.insertCells(this._activeBuffer.x,A.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(A){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.deleteCells(this._activeBuffer.x,A.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(A){let N=A.params[0]||1;for(;N--;)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(A){let N=A.params[0]||1;for(;N--;)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(n.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=A.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);O.deleteCells(0,N,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=A.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);O.insertCells(0,N,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=A.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);O.insertCells(this._activeBuffer.x,N,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=A.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);O.deleteCells(this._activeBuffer.x,N,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(A){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(A.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(A){if(!this._parser.precedingCodepoint)return!0;const N=A.params[0]||1,P=new Uint32Array(N);for(let O=0;O<N;++O)P[O]=this._parser.precedingCodepoint;return this.print(P,0,P.length),!0}sendDeviceAttributesPrimary(A){return A.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(A){return A.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(A.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(A){return(this._optionsService.rawOptions.termName+"").indexOf(A)===0}setMode(A){for(let N=0;N<A.length;N++)switch(A.params[N]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(A){for(let N=0;N<A.length;N++)switch(A.params[N]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.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(A){for(let N=0;N<A.length;N++)switch(A.params[N]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(A){for(let N=0;N<A.length;N++)switch(A.params[N]){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(),A.params[N]===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(A,N){const P=this._coreService.decPrivateModes,{activeProtocol:O,activeEncoding:$}=this._coreMouseService,X=this._coreService,{buffers:K,cols:Q}=this._bufferService,{active:se,alt:D}=K,F=this._optionsService.rawOptions,U=ie=>ie?1:2,z=A.params[0];return te=z,Y=N?z===2?4:z===4?U(X.modes.insertMode):z===12?3:z===20?U(F.convertEol):0:z===1?U(P.applicationCursorKeys):z===3?F.windowOptions.setWinLines?Q===80?2:Q===132?1:0:0:z===6?U(P.origin):z===7?U(P.wraparound):z===8?3:z===9?U(O==="X10"):z===12?U(F.cursorBlink):z===25?U(!X.isCursorHidden):z===45?U(P.reverseWraparound):z===66?U(P.applicationKeypad):z===67?4:z===1e3?U(O==="VT200"):z===1002?U(O==="DRAG"):z===1003?U(O==="ANY"):z===1004?U(P.sendFocus):z===1005?4:z===1006?U($==="SGR"):z===1015?4:z===1016?U($==="SGR_PIXELS"):z===1048?1:z===47||z===1047||z===1049?U(se===D):z===2004?U(P.bracketedPasteMode):0,X.triggerDataEvent(`${o.C0.ESC}[${N?"":"?"}${te};${Y}$y`),!0;var te,Y}_updateAttrColor(A,N,P,O,$){return N===2?(A|=50331648,A&=-16777216,A|=_.AttributeData.fromColorRGB([P,O,$])):N===5&&(A&=-50331904,A|=33554432|255&P),A}_extractColor(A,N,P){const O=[0,0,-1,0,0,0];let $=0,X=0;do{if(O[X+$]=A.params[N+X],A.hasSubParams(N+X)){const K=A.getSubParams(N+X);let Q=0;do O[1]===5&&($=1),O[X+Q+1+$]=K[Q];while(++Q<K.length&&Q+X+1+$<O.length);break}if(O[1]===5&&X+$>=2||O[1]===2&&X+$>=5)break;O[1]&&($=1)}while(++X+N<A.length&&X+$<O.length);for(let K=2;K<O.length;++K)O[K]===-1&&(O[K]=0);switch(O[0]){case 38:P.fg=this._updateAttrColor(P.fg,O[1],O[3],O[4],O[5]);break;case 48:P.bg=this._updateAttrColor(P.bg,O[1],O[3],O[4],O[5]);break;case 58:P.extended=P.extended.clone(),P.extended.underlineColor=this._updateAttrColor(P.extended.underlineColor,O[1],O[3],O[4],O[5])}return X}_processUnderline(A,N){N.extended=N.extended.clone(),(!~A||A>5)&&(A=1),N.extended.underlineStyle=A,N.fg|=268435456,A===0&&(N.fg&=-268435457),N.updateExtended()}_processSGR0(A){A.fg=n.DEFAULT_ATTR_DATA.fg,A.bg=n.DEFAULT_ATTR_DATA.bg,A.extended=A.extended.clone(),A.extended.underlineStyle=0,A.extended.underlineColor&=-67108864,A.updateExtended()}charAttributes(A){if(A.length===1&&A.params[0]===0)return this._processSGR0(this._curAttrData),!0;const N=A.length;let P;const O=this._curAttrData;for(let $=0;$<N;$++)P=A.params[$],P>=30&&P<=37?(O.fg&=-50331904,O.fg|=16777216|P-30):P>=40&&P<=47?(O.bg&=-50331904,O.bg|=16777216|P-40):P>=90&&P<=97?(O.fg&=-50331904,O.fg|=16777224|P-90):P>=100&&P<=107?(O.bg&=-50331904,O.bg|=16777224|P-100):P===0?this._processSGR0(O):P===1?O.fg|=134217728:P===3?O.bg|=67108864:P===4?(O.fg|=268435456,this._processUnderline(A.hasSubParams($)?A.getSubParams($)[0]:1,O)):P===5?O.fg|=536870912:P===7?O.fg|=67108864:P===8?O.fg|=1073741824:P===9?O.fg|=2147483648:P===2?O.bg|=134217728:P===21?this._processUnderline(2,O):P===22?(O.fg&=-134217729,O.bg&=-134217729):P===23?O.bg&=-67108865:P===24?(O.fg&=-268435457,this._processUnderline(0,O)):P===25?O.fg&=-536870913:P===27?O.fg&=-67108865:P===28?O.fg&=-1073741825:P===29?O.fg&=2147483647:P===39?(O.fg&=-67108864,O.fg|=16777215&n.DEFAULT_ATTR_DATA.fg):P===49?(O.bg&=-67108864,O.bg|=16777215&n.DEFAULT_ATTR_DATA.bg):P===38||P===48||P===58?$+=this._extractColor(A,$,O):P===53?O.bg|=1073741824:P===55?O.bg&=-1073741825:P===59?(O.extended=O.extended.clone(),O.extended.underlineColor=-1,O.updateExtended()):P===100?(O.fg&=-67108864,O.fg|=16777215&n.DEFAULT_ATTR_DATA.fg,O.bg&=-67108864,O.bg|=16777215&n.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",P);return!0}deviceStatus(A){switch(A.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:const N=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${N};${P}R`)}return!0}deviceStatusPrivate(A){if(A.params[0]===6){const N=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${N};${P}R`)}return!0}softReset(A){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=n.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(A){const N=A.params[0]||1;switch(N){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"}const P=N%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(A){const N=A.params[0]||1;let P;return(A.length<2||(P=A.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>N&&(this._activeBuffer.scrollTop=N-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(A){if(!M(A.params[0],this._optionsService.rawOptions.windowOptions))return!0;const N=A.length>1?A.params[1]:0;switch(A.params[0]){case 14:N!==2&&this._onRequestWindowsOptionsReport.fire(L.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(L.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:N!==0&&N!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),N!==0&&N!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:N!==0&&N!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),N!==0&&N!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(A){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(A){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(A){return this._windowTitle=A,this._onTitleChange.fire(A),!0}setIconName(A){return this._iconName=A,!0}setOrReportIndexedColor(A){const N=[],P=A.split(";");for(;P.length>1;){const O=P.shift(),$=P.shift();if(/^\d+$/.exec(O)){const X=parseInt(O);if(H(X))if($==="?")N.push({type:0,index:X});else{const K=(0,b.parseColor)($);K&&N.push({type:1,index:X,color:K})}}}return N.length&&this._onColor.fire(N),!0}setHyperlink(A){const N=A.split(";");return!(N.length<2)&&(N[1]?this._createHyperlink(N[0],N[1]):!N[0]&&this._finishHyperlink())}_createHyperlink(A,N){this._getCurrentLinkId()&&this._finishHyperlink();const P=A.split(":");let O;const $=P.findIndex((X=>X.startsWith("id=")));return $!==-1&&(O=P[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:O,uri:N}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(A,N){const P=A.split(";");for(let O=0;O<P.length&&!(N>=this._specialColors.length);++O,++N)if(P[O]==="?")this._onColor.fire([{type:0,index:this._specialColors[N]}]);else{const $=(0,b.parseColor)(P[O]);$&&this._onColor.fire([{type:1,index:this._specialColors[N],color:$}])}return!0}setOrReportFgColor(A){return this._setOrReportSpecialColor(A,0)}setOrReportBgColor(A){return this._setOrReportSpecialColor(A,1)}setOrReportCursorColor(A){return this._setOrReportSpecialColor(A,2)}restoreIndexedColor(A){if(!A)return this._onColor.fire([{type:2}]),!0;const N=[],P=A.split(";");for(let O=0;O<P.length;++O)if(/^\d+$/.exec(P[O])){const $=parseInt(P[O]);H($)&&N.push({type:2,index:$})}return N.length&&this._onColor.fire(N),!0}restoreFgColor(A){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(A){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(A){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,p.DEFAULT_CHARSET),!0}selectCharset(A){return A.length!==2?(this.selectDefaultCharset(),!0):(A[0]==="/"||this._charsetService.setgCharset(R[A[0]],p.CHARSETS[A[1]]||p.DEFAULT_CHARSET),!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){const A=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,A,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=n.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=n.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(A){return this._charsetService.setgLevel(A),!0}screenAlignmentPattern(){const A=new u.CellData;A.content=4194373,A.fg=this._curAttrData.fg,A.bg=this._curAttrData.bg,this._setCursor(0,0);for(let N=0;N<this._bufferService.rows;++N){const P=this._activeBuffer.ybase+this._activeBuffer.y+N,O=this._activeBuffer.lines.get(P);O&&(O.fill(A),O.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(A,N){const P=this._bufferService.buffer,O=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${$}${o.C0.ESC}\\`),!0))(A==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:A==='"p'?'P1$r61;1"p':A==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:A==="m"?"P1$r0m":A===" q"?`P1$r${{block:2,underline:4,bar:6}[O.cursorStyle]-(O.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(A,N){this._dirtyRowTracker.markRangeDirty(A,N)}}r.InputHandler=B;let I=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,A){W>A&&(T=W,W=A,A=T),W<this.start&&(this.start=W),A>this.end&&(this.end=A)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(W){return 0<=W&&W<256}I=c([f(0,y.IBufferService)],I)},844:(C,r)=>{function i(c){for(const f of c)f.dispose();c.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const f=this._disposables.indexOf(c);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var f;this._isDisposed||c===this._value||((f=this._value)===null||f===void 0||f.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)===null||c===void 0||c.dispose(),this._value=void 0}},r.toDisposable=function(c){return{dispose:c}},r.disposeArray=i,r.getDisposeArrayDisposable=function(c){return{dispose:()=>i(c)}}},1505:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class i{constructor(){this._data={}}set(f,o,p){this._data[f]||(this._data[f]={}),this._data[f][o]=p}get(f,o){return this._data[f]?this._data[f][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=i,r.FourKeyMap=class{constructor(){this._data=new i}set(c,f,o,p,x){this._data.get(c,f)||this._data.set(c,f,new i),this._data.get(c,f).set(o,p,x)}get(c,f,o,p){var x;return(x=this._data.get(c,f))===null||x===void 0?void 0:x.get(o,p)}clear(){this._data.clear()}}},6114:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof navigator>"u";const i=r.isNode?"node":navigator.userAgent,c=r.isNode?"node":navigator.platform;r.isFirefox=i.includes("Firefox"),r.isLegacyEdge=i.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(i),r.getSafariVersion=function(){if(!r.isSafari)return 0;const f=i.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),r.isIpad=c==="iPad",r.isIphone=c==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),r.isLinux=c.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(i)},6106:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let i=0;r.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(i=this._search(this._getKey(c)),this._array.splice(i,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const f=this._getKey(c);if(f===void 0||(i=this._search(f),i===-1)||this._getKey(this._array[i])!==f)return!1;do if(this._array[i]===c)return this._array.splice(i,1),!0;while(++i<this._array.length&&this._getKey(this._array[i])===f);return!1}*getKeyIterator(c){if(this._array.length!==0&&(i=this._search(c),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===c))do yield this._array[i];while(++i<this._array.length&&this._getKey(this._array[i])===c)}forEachByKey(c,f){if(this._array.length!==0&&(i=this._search(c),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===c))do f(this._array[i]);while(++i<this._array.length&&this._getKey(this._array[i])===c)}values(){return[...this._array].values()}_search(c){let f=0,o=this._array.length-1;for(;o>=f;){let p=f+o>>1;const x=this._getKey(this._array[p]);if(x>c)o=p-1;else{if(!(x<c)){for(;p>0&&this._getKey(this._array[p-1])===c;)p--;return p}f=p+1}}return f}}},7226:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const c=i(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(x){this._tasks.push(x),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(x){this._idleCallback=void 0;let S=0,g=0,n=x.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),g=Math.max(S,g),d=x.timeRemaining(),1.5*g>d)return n-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-S))}ms`),void this._start();n=d}this.clear()}}class o extends f{_requestCallback(x){return setTimeout((()=>x(this._createDeadline(16))))}_cancelCallback(x){clearTimeout(x)}_createDeadline(x){const S=Date.now()+x;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const c=i(643);r.updateWindowsModeWrappedState=function(f){const o=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),p=o?.get(f.cols-1),x=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);x&&p&&(x.isWrapped=p[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&p[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class i{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){const o=new i;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}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)==0}isBgDefault(){return(50331648&this.bg)==0}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)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}r.AttributeData=i;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}constructor(o=0,p=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=p}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=c},9092:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const c=i(6349),f=i(7226),o=i(3734),p=i(8437),x=i(4634),S=i(511),g=i(643),n=i(4863),d=i(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(h,u,_){this._hasScrollback=h,this._optionsService=u,this._bufferService=_,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(h){return h?(this._nullCell.fg=h.fg,this._nullCell.bg=h.bg,this._nullCell.extended=h.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(h){return h?(this._whitespaceCell.fg=h.fg,this._whitespaceCell.bg=h.bg,this._whitespaceCell.extended=h.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(h,u){return new p.BufferLine(this._bufferService.cols,this.getNullCell(h),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const h=this.ybase+this.y-this.ydisp;return h>=0&&h<this._rows}_getCorrectBufferLength(h){if(!this._hasScrollback)return h;const u=h+this._optionsService.rawOptions.scrollback;return u>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:u}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=p.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(h))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(h,u){const _=this.getNullCell(p.DEFAULT_ATTR_DATA);let y=0;const w=this._getCorrectBufferLength(u);if(w>this.lines.maxLength&&(this.lines.maxLength=w),this.lines.length>0){if(this._cols<h)for(let b=0;b<this.lines.length;b++)y+=+this.lines.get(b).resize(h,_);let E=0;if(this._rows<u)for(let b=this._rows;b<u;b++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(h,_)):this.ybase>0&&this.lines.length<=this.ybase+this.y+E+1?(this.ybase--,E++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(h,_)));else for(let b=this._rows;b>u;b--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(w<this.lines.maxLength){const b=this.lines.length-w;b>0&&(this.lines.trimStart(b),this.ybase=Math.max(this.ybase-b,0),this.ydisp=Math.max(this.ydisp-b,0),this.savedY=Math.max(this.savedY-b,0)),this.lines.maxLength=w}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,u-1),E&&(this.y+=E),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(h,u),this._cols>h))for(let E=0;E<this.lines.length;E++)y+=+this.lines.get(E).resize(h,_);this._cols=h,this._rows=u,this._memoryCleanupQueue.clear(),y>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let h=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,h=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return h}get _isReflowEnabled(){const h=this._optionsService.rawOptions.windowsPty;return h&&h.buildNumber?this._hasScrollback&&h.backend==="conpty"&&h.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(h,u){this._cols!==h&&(h>this._cols?this._reflowLarger(h,u):this._reflowSmaller(h,u))}_reflowLarger(h,u){const _=(0,x.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(_.length>0){const y=(0,x.reflowLargerCreateNewLayout)(this.lines,_);(0,x.reflowLargerApplyNewLayout)(this.lines,y.layout),this._reflowLargerAdjustViewport(h,u,y.countRemoved)}}_reflowLargerAdjustViewport(h,u,_){const y=this.getNullCell(p.DEFAULT_ATTR_DATA);let w=_;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new p.BufferLine(h,y))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-_,0)}_reflowSmaller(h,u){const _=this.getNullCell(p.DEFAULT_ATTR_DATA),y=[];let w=0;for(let E=this.lines.length-1;E>=0;E--){let b=this.lines.get(E);if(!b||!b.isWrapped&&b.getTrimmedLength()<=h)continue;const R=[b];for(;b.isWrapped&&E>0;)b=this.lines.get(--E),R.unshift(b);const j=this.ybase+this.y;if(j>=E&&j<E+R.length)continue;const M=R[R.length-1].getTrimmedLength(),L=(0,x.reflowSmallerGetNewLineLengths)(R,this._cols,h),T=L.length-R.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+T):Math.max(0,this.lines.length-this.lines.maxLength+T);const I=[];for(let O=0;O<T;O++){const $=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);I.push($)}I.length>0&&(y.push({start:E+R.length+w,newLines:I}),w+=I.length),R.push(...I);let H=L.length-1,W=L[H];W===0&&(H--,W=L[H]);let A=R.length-T-1,N=M;for(;A>=0;){const O=Math.min(N,W);if(R[H]===void 0)break;if(R[H].copyCellsFrom(R[A],N-O,W-O,O,!0),W-=O,W===0&&(H--,W=L[H]),N-=O,N===0){A--;const $=Math.max(A,0);N=(0,x.getWrappedLineTrimmedLength)(R,$,this._cols)}}for(let O=0;O<R.length;O++)L[O]<h&&R[O].setCell(L[O],_);let P=T-B;for(;P-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+w)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+T,this.ybase+u-1)}if(y.length>0){const E=[],b=[];for(let H=0;H<this.lines.length;H++)b.push(this.lines.get(H));const R=this.lines.length;let j=R-1,M=0,L=y[M];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let T=0;for(let H=Math.min(this.lines.maxLength-1,R+w-1);H>=0;H--)if(L&&L.start>j+T){for(let W=L.newLines.length-1;W>=0;W--)this.lines.set(H--,L.newLines[W]);H++,E.push({index:j+1,amount:L.newLines.length}),T+=L.newLines.length,L=y[++M]}else this.lines.set(H,b[j--]);let B=0;for(let H=E.length-1;H>=0;H--)E[H].index+=B,this.lines.onInsertEmitter.fire(E[H]),B+=E[H].amount;const I=Math.max(0,R+w-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(h,u,_=0,y){const w=this.lines.get(h);return w?w.translateToString(u,_,y):""}getWrappedRangeForLine(h){let u=h,_=h;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;_+1<this.lines.length&&this.lines.get(_+1).isWrapped;)_++;return{first:u,last:_}}setupTabStops(h){for(h!=null?this.tabs[h]||(h=this.prevStop(h)):(this.tabs={},h=0);h<this._cols;h+=this._optionsService.rawOptions.tabStopWidth)this.tabs[h]=!0}prevStop(h){for(h==null&&(h=this.x);!this.tabs[--h]&&h>0;);return h>=this._cols?this._cols-1:h<0?0:h}nextStop(h){for(h==null&&(h=this.x);!this.tabs[++h]&&h<this._cols;);return h>=this._cols?this._cols-1:h<0?0:h}clearMarkers(h){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===h&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].dispose(),this.markers.splice(h--,1);this._isClearing=!1}addMarker(h){const u=new n.Marker(h);return this.markers.push(u),u.register(this.lines.onTrim((_=>{u.line-=_,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((_=>{u.line>=_.index&&(u.line+=_.amount)}))),u.register(this.lines.onDelete((_=>{u.line>=_.index&&u.line<_.index+_.amount&&u.dispose(),u.line>_.index&&(u.line-=_.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},8437:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const c=i(3734),f=i(511),o=i(643),p=i(482);r.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let x=0;class S{constructor(n,d,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*n);const u=d||f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let _=0;_<n;++_)this.setCell(_,u);this.length=n}get(n){const d=this._data[3*n+0],h=2097151&d;return[this._data[3*n+1],2097152&d?this._combined[n]:h?(0,p.stringFromCodePoint)(h):"",d>>22,2097152&d?this._combined[n].charCodeAt(this._combined[n].length-1):h]}set(n,d){this._data[3*n+1]=d[o.CHAR_DATA_ATTR_INDEX],d[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[n]=d[1],this._data[3*n+0]=2097152|n|d[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*n+0]=d[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(n){return this._data[3*n+0]>>22}hasWidth(n){return 12582912&this._data[3*n+0]}getFg(n){return this._data[3*n+1]}getBg(n){return this._data[3*n+2]}hasContent(n){return 4194303&this._data[3*n+0]}getCodePoint(n){const d=this._data[3*n+0];return 2097152&d?this._combined[n].charCodeAt(this._combined[n].length-1):2097151&d}isCombined(n){return 2097152&this._data[3*n+0]}getString(n){const d=this._data[3*n+0];return 2097152&d?this._combined[n]:2097151&d?(0,p.stringFromCodePoint)(2097151&d):""}isProtected(n){return 536870912&this._data[3*n+2]}loadCell(n,d){return x=3*n,d.content=this._data[x+0],d.fg=this._data[x+1],d.bg=this._data[x+2],2097152&d.content&&(d.combinedData=this._combined[n]),268435456&d.bg&&(d.extended=this._extendedAttrs[n]),d}setCell(n,d){2097152&d.content&&(this._combined[n]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[n]=d.extended),this._data[3*n+0]=d.content,this._data[3*n+1]=d.fg,this._data[3*n+2]=d.bg}setCellFromCodePoint(n,d,h,u,_,y){268435456&_&&(this._extendedAttrs[n]=y),this._data[3*n+0]=d|h<<22,this._data[3*n+1]=u,this._data[3*n+2]=_}addCodepointToCell(n,d){let h=this._data[3*n+0];2097152&h?this._combined[n]+=(0,p.stringFromCodePoint)(d):(2097151&h?(this._combined[n]=(0,p.stringFromCodePoint)(2097151&h)+(0,p.stringFromCodePoint)(d),h&=-2097152,h|=2097152):h=d|4194304,this._data[3*n+0]=h)}insertCells(n,d,h,u){if((n%=this.length)&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs),d<this.length-n){const _=new f.CellData;for(let y=this.length-n-d-1;y>=0;--y)this.setCell(n+d+y,this.loadCell(n+y,_));for(let y=0;y<d;++y)this.setCell(n+y,h)}else for(let _=n;_<this.length;++_)this.setCell(_,h);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs)}deleteCells(n,d,h,u){if(n%=this.length,d<this.length-n){const _=new f.CellData;for(let y=0;y<this.length-n-d;++y)this.setCell(n+y,this.loadCell(n+d+y,_));for(let y=this.length-d;y<this.length;++y)this.setCell(y,h)}else for(let _=n;_<this.length;++_)this.setCell(_,h);n&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs),this.getWidth(n)!==0||this.hasContent(n)||this.setCellFromCodePoint(n,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs)}replaceCells(n,d,h,u,_=!1){if(_)for(n&&this.getWidth(n-1)===2&&!this.isProtected(n-1)&&this.setCellFromCodePoint(n-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodePoint(d,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs);n<d&&n<this.length;)this.isProtected(n)||this.setCell(n,h),n++;else for(n&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodePoint(d,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs);n<d&&n<this.length;)this.setCell(n++,h)}resize(n,d){if(n===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const h=3*n;if(n>this.length){if(this._data.buffer.byteLength>=4*h)this._data=new Uint32Array(this._data.buffer,0,h);else{const u=new Uint32Array(h);u.set(this._data),this._data=u}for(let u=this.length;u<n;++u)this.setCell(u,d)}else{this._data=this._data.subarray(0,h);const u=Object.keys(this._combined);for(let y=0;y<u.length;y++){const w=parseInt(u[y],10);w>=n&&delete this._combined[w]}const _=Object.keys(this._extendedAttrs);for(let y=0;y<_.length;y++){const w=parseInt(_[y],10);w>=n&&delete this._extendedAttrs[w]}}return this.length=n,4*h*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const n=new Uint32Array(this._data.length);return n.set(this._data),this._data=n,1}return 0}fill(n,d=!1){if(d)for(let h=0;h<this.length;++h)this.isProtected(h)||this.setCell(h,n);else{this._combined={},this._extendedAttrs={};for(let h=0;h<this.length;++h)this.setCell(h,n)}}copyFrom(n){this.length!==n.length?this._data=new Uint32Array(n._data):this._data.set(n._data),this.length=n.length,this._combined={};for(const d in n._combined)this._combined[d]=n._combined[d];this._extendedAttrs={};for(const d in n._extendedAttrs)this._extendedAttrs[d]=n._extendedAttrs[d];this.isWrapped=n.isWrapped}clone(){const n=new S(0);n._data=new Uint32Array(this._data),n.length=this.length;for(const d in this._combined)n._combined[d]=this._combined[d];for(const d in this._extendedAttrs)n._extendedAttrs[d]=this._extendedAttrs[d];return n.isWrapped=this.isWrapped,n}getTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0])return n+(this._data[3*n+0]>>22);return 0}getNoBgTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0]||50331648&this._data[3*n+2])return n+(this._data[3*n+0]>>22);return 0}copyCellsFrom(n,d,h,u,_){const y=n._data;if(_)for(let E=u-1;E>=0;E--){for(let b=0;b<3;b++)this._data[3*(h+E)+b]=y[3*(d+E)+b];268435456&y[3*(d+E)+2]&&(this._extendedAttrs[h+E]=n._extendedAttrs[d+E])}else for(let E=0;E<u;E++){for(let b=0;b<3;b++)this._data[3*(h+E)+b]=y[3*(d+E)+b];268435456&y[3*(d+E)+2]&&(this._extendedAttrs[h+E]=n._extendedAttrs[d+E])}const w=Object.keys(n._combined);for(let E=0;E<w.length;E++){const b=parseInt(w[E],10);b>=d&&(this._combined[b-d+h]=n._combined[b])}}translateToString(n=!1,d=0,h=this.length){n&&(h=Math.min(h,this.getTrimmedLength()));let u="";for(;d<h;){const _=this._data[3*d+0],y=2097151&_;u+=2097152&_?this._combined[d]:y?(0,p.stringFromCodePoint)(y):o.WHITESPACE_CELL_CHAR,d+=_>>22||1}return u}}r.BufferLine=S},4841:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(i,c){if(i.start.y>i.end.y)throw new Error(`Buffer range end (${i.end.x}, ${i.end.y}) cannot be before start (${i.start.x}, ${i.start.y})`);return c*(i.end.y-i.start.y)+(i.end.x-i.start.x+1)}},4634:(C,r)=>{function i(c,f,o){if(f===c.length-1)return c[f].getTrimmedLength();const p=!c[f].hasContent(o-1)&&c[f].getWidth(o-1)===1,x=c[f+1].getWidth(0)===2;return p&&x?o-1:o}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(c,f,o,p,x){const S=[];for(let g=0;g<c.length-1;g++){let n=g,d=c.get(++n);if(!d.isWrapped)continue;const h=[c.get(g)];for(;n<c.length&&d.isWrapped;)h.push(d),d=c.get(++n);if(p>=g&&p<n){g+=h.length-1;continue}let u=0,_=i(h,u,f),y=1,w=0;for(;y<h.length;){const b=i(h,y,f),R=b-w,j=o-_,M=Math.min(R,j);h[u].copyCellsFrom(h[y],w,_,M,!1),_+=M,_===o&&(u++,_=0),w+=M,w===b&&(y++,w=0),_===0&&u!==0&&h[u-1].getWidth(o-1)===2&&(h[u].copyCellsFrom(h[u-1],o-1,_++,1,!1),h[u-1].setCell(o-1,x))}h[u].replaceCells(_,o,x);let E=0;for(let b=h.length-1;b>0&&(b>u||h[b].getTrimmedLength()===0);b--)E++;E>0&&(S.push(g+h.length-E),S.push(E)),g+=h.length-1}return S},r.reflowLargerCreateNewLayout=function(c,f){const o=[];let p=0,x=f[p],S=0;for(let g=0;g<c.length;g++)if(x===g){const n=f[++p];c.onDeleteEmitter.fire({index:g-S,amount:n}),g+=n-1,S+=n,x=f[++p]}else o.push(g);return{layout:o,countRemoved:S}},r.reflowLargerApplyNewLayout=function(c,f){const o=[];for(let p=0;p<f.length;p++)o.push(c.get(f[p]));for(let p=0;p<o.length;p++)c.set(p,o[p]);c.length=f.length},r.reflowSmallerGetNewLineLengths=function(c,f,o){const p=[],x=c.map(((d,h)=>i(c,h,f))).reduce(((d,h)=>d+h));let S=0,g=0,n=0;for(;n<x;){if(x-n<o){p.push(x-n);break}S+=o;const d=i(c,g,f);S>d&&(S-=d,g++);const h=c[g].getWidth(S-1)===2;h&&S--;const u=h?o-1:o;p.push(u),n+=u}return p},r.getWrappedLineTrimmedLength=i},5295:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const c=i(8460),f=i(844),o=i(9092);class p extends f.Disposable{constructor(S,g){super(),this._optionsService=S,this._bufferService=g,this._onBufferActivate=this.register(new c.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 o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,g){this._normal.resize(S,g),this._alt.resize(S,g),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}r.BufferSet=p},511:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const c=i(482),f=i(643),o=i(3734);class p extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(S){const g=new p;return g.setFromCharData(S),g}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(S){this.fg=S[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(S[f.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(S[f.CHAR_DATA_CHAR_INDEX].length===2){const n=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){const d=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(n-55296)+d-56320+65536|S[f.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[f.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=S[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=p},643:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const c=i(8460),f=i(844);class o{get id(){return this._id}constructor(x){this.line=x,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(x){return this._disposables.push(x),x}}r.Marker=o,o._nextId=1},7116:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.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:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(C,r)=>{var i,c,f;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=`
|
|
17
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(b){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.isLinux&&b&&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(b){const R=this._getMouseBufferCoords(b),j=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!!(j&&M&&R)&&this._areCoordsInSelection(R,j,M)}isCellInSelection(b,R){const j=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!j||!M)&&this._areCoordsInSelection([b,R],j,M)}_areCoordsInSelection(b,R,j){return b[1]>R[1]&&b[1]<j[1]||R[1]===j[1]&&b[1]===R[1]&&b[0]>=R[0]&&b[0]<j[0]||R[1]<j[1]&&b[1]===j[1]&&b[0]<j[0]||R[1]<j[1]&&b[1]===R[1]&&b[0]>=R[0]}_selectWordAtCursor(b,R){var j,M;const L=(M=(j=this._linkifier.currentLink)===null||j===void 0?void 0:j.link)===null||M===void 0?void 0:M.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,h.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const T=this._getMouseBufferCoords(b);return!!T&&(this._selectWordAt(T,R),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(b,R){this._model.clearSelection(),b=Math.max(b,0),R=Math.min(R,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,b],this._model.selectionEnd=[this._bufferService.cols,R],this.refresh(),this._onSelectionChange.fire()}_handleTrim(b){this._model.handleTrim(b)&&this.refresh()}_getMouseBufferCoords(b){const R=this._mouseService.getCoords(b,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(R)return R[0]--,R[1]--,R[1]+=this._bufferService.buffer.ydisp,R}_getMouseEventScrollAmount(b){let R=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,b,this._screenElement)[1];const j=this._renderService.dimensions.css.canvas.height;return R>=0&&R<=j?0:(R>j&&(R-=j),R=Math.min(Math.max(R,-50),50),R/=50,R/Math.abs(R)+Math.round(14*R))}shouldForceSelection(b){return d.isMac?b.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:b.shiftKey}handleMouseDown(b){if(this._mouseDownTimeStamp=b.timeStamp,(b.button!==2||!this.hasSelection)&&b.button===0){if(!this._enabled){if(!this.shouldForceSelection(b))return;b.stopPropagation()}b.preventDefault(),this._dragScrollAmount=0,this._enabled&&b.shiftKey?this._handleIncrementalClick(b):b.detail===1?this._handleSingleClick(b):b.detail===2?this._handleDoubleClick(b):b.detail===3&&this._handleTripleClick(b),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(b){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(b))}_handleSingleClick(b){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(b)?3:0,this._model.selectionStart=this._getMouseBufferCoords(b),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const R=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);R&&R.length!==this._model.selectionStart[0]&&R.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(b){this._selectWordAtCursor(b,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(b){const R=this._getMouseBufferCoords(b);R&&(this._activeSelectionMode=2,this._selectLineAt(R[1]))}shouldColumnSelect(b){return b.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(b){if(b.stopImmediatePropagation(),!this._model.selectionStart)return;const R=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(b),!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(b),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const j=this._bufferService.buffer;if(this._model.selectionEnd[1]<j.lines.length){const M=j.lines.get(this._model.selectionEnd[1]);M&&M.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}R&&R[0]===this._model.selectionEnd[0]&&R[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});const b=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(b.ydisp+this._bufferService.rows,b.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=b.ydisp),this.refresh()}}_handleMouseUp(b){const R=b.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&R<500&&b.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const j=this._mouseService.getCoords(b,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(j&&j[0]!==void 0&&j[1]!==void 0){const M=(0,p.moveToCellSequence)(j[0]-1,j[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(M,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const b=this._model.finalSelectionStart,R=this._model.finalSelectionEnd,j=!(!b||!R||b[0]===R[0]&&b[1]===R[1]);j?b&&R&&(this._oldSelectionStart&&this._oldSelectionEnd&&b[0]===this._oldSelectionStart[0]&&b[1]===this._oldSelectionStart[1]&&R[0]===this._oldSelectionEnd[0]&&R[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(b,R,j)):this._oldHasSelection&&this._fireOnSelectionChange(b,R,j)}_fireOnSelectionChange(b,R,j){this._oldSelectionStart=b,this._oldSelectionEnd=R,this._oldHasSelection=j,this._onSelectionChange.fire()}_handleBufferActivate(b){this.clearSelection(),this._trimListener.dispose(),this._trimListener=b.activeBuffer.lines.onTrim((R=>this._handleTrim(R)))}_convertViewportColToCharacterIndex(b,R){let j=R;for(let M=0;R>=M;M++){const L=b.loadCell(M,this._workCell).getChars().length;this._workCell.getWidth()===0?j--:L>1&&R!==M&&(j+=L-1)}return j}setSelection(b,R,j){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[b,R],this._model.selectionStartLength=j,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(b){this._isClickInSelection(b)||(this._selectWordAtCursor(b,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(b,R,j=!0,M=!0){if(b[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,T=L.lines.get(b[1]);if(!T)return;const B=L.translateBufferLineToString(b[1],!1);let I=this._convertViewportColToCharacterIndex(T,b[0]),H=I;const W=b[0]-I;let A=0,N=0,P=0,O=0;if(B.charAt(I)===" "){for(;I>0&&B.charAt(I-1)===" ";)I--;for(;H<B.length&&B.charAt(H+1)===" ";)H++}else{let K=b[0],Q=b[0];T.getWidth(K)===0&&(A++,K--),T.getWidth(Q)===2&&(N++,Q++);const se=T.getString(Q).length;for(se>1&&(O+=se-1,H+=se-1);K>0&&I>0&&!this._isCharWordSeparator(T.loadCell(K-1,this._workCell));){T.loadCell(K-1,this._workCell);const D=this._workCell.getChars().length;this._workCell.getWidth()===0?(A++,K--):D>1&&(P+=D-1,I-=D-1),I--,K--}for(;Q<T.length&&H+1<B.length&&!this._isCharWordSeparator(T.loadCell(Q+1,this._workCell));){T.loadCell(Q+1,this._workCell);const D=this._workCell.getChars().length;this._workCell.getWidth()===2?(N++,Q++):D>1&&(O+=D-1,H+=D-1),H++,Q++}}H++;let $=I+W-A+P,X=Math.min(this._bufferService.cols,H-I+A+N-P-O);if(R||B.slice(I,H).trim()!==""){if(j&&$===0&&T.getCodePoint(0)!==32){const K=L.lines.get(b[1]-1);if(K&&T.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){const Q=this._getWordAt([this._bufferService.cols-1,b[1]-1],!1,!0,!1);if(Q){const se=this._bufferService.cols-Q.start;$-=se,X+=se}}}if(M&&$+X===this._bufferService.cols&&T.getCodePoint(this._bufferService.cols-1)!==32){const K=L.lines.get(b[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){const Q=this._getWordAt([0,b[1]+1],!1,!1,!0);Q&&(X+=Q.length)}}return{start:$,length:X}}}_selectWordAt(b,R){const j=this._getWordAt(b,R);if(j){for(;j.start<0;)j.start+=this._bufferService.cols,b[1]--;this._model.selectionStart=[j.start,b[1]],this._model.selectionStartLength=j.length}}_selectToWordAt(b){const R=this._getWordAt(b,!0);if(R){let j=b[1];for(;R.start<0;)R.start+=this._bufferService.cols,j--;if(!this._model.areSelectionValuesReversed())for(;R.start+R.length>this._bufferService.cols;)R.length-=this._bufferService.cols,j++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?R.start:R.start+R.length,j]}}_isCharWordSeparator(b){return b.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(b.getChars())>=0}_selectLineAt(b){const R=this._bufferService.buffer.getWrappedRangeForLine(b),j={start:{x:0,y:R.first},end:{x:this._bufferService.cols-1,y:R.last}};this._model.selectionStart=[0,R.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(j,this._bufferService.cols)}};r.SelectionService=E=c([f(3,_.IBufferService),f(4,_.ICoreService),f(5,S.IMouseService),f(6,_.IOptionsService),f(7,S.IRenderService),f(8,S.ICoreBrowserService)],E)},4725:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const c=i(8343);r.ICharSizeService=(0,c.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),r.IMouseService=(0,c.createDecorator)("MouseService"),r.IRenderService=(0,c.createDecorator)("RenderService"),r.ISelectionService=(0,c.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,c.createDecorator)("ThemeService")},6731:function(C,r,i){var c=this&&this.__decorate||function(E,b,R,j){var M,L=arguments.length,T=L<3?b:j===null?j=Object.getOwnPropertyDescriptor(b,R):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(E,b,R,j);else for(var B=E.length-1;B>=0;B--)(M=E[B])&&(T=(L<3?M(T):L>3?M(b,R,T):M(b,R))||T);return L>3&&T&&Object.defineProperty(b,R,T),T},f=this&&this.__param||function(E,b){return function(R,j){b(R,j,E)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const o=i(7239),p=i(8055),x=i(8460),S=i(844),g=i(2585),n=p.css.toColor("#ffffff"),d=p.css.toColor("#000000"),h=p.css.toColor("#ffffff"),u=p.css.toColor("#000000"),_={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const E=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],b=[0,95,135,175,215,255];for(let R=0;R<216;R++){const j=b[R/36%6|0],M=b[R/6%6|0],L=b[R%6];E.push({css:p.channels.toCss(j,M,L),rgba:p.channels.toRgba(j,M,L)})}for(let R=0;R<24;R++){const j=8+10*R;E.push({css:p.channels.toCss(j,j,j),rgba:p.channels.toRgba(j,j,j)})}return E})());let y=r.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(E){super(),this._optionsService=E,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new x.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:n,background:d,cursor:h,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:_,selectionBackgroundOpaque:p.color.blend(d,_),selectionInactiveBackgroundTransparent:_,selectionInactiveBackgroundOpaque:p.color.blend(d,_),ansi:r.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={}){const b=this._colors;if(b.foreground=w(E.foreground,n),b.background=w(E.background,d),b.cursor=w(E.cursor,h),b.cursorAccent=w(E.cursorAccent,u),b.selectionBackgroundTransparent=w(E.selectionBackground,_),b.selectionBackgroundOpaque=p.color.blend(b.background,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundTransparent=w(E.selectionInactiveBackground,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundOpaque=p.color.blend(b.background,b.selectionInactiveBackgroundTransparent),b.selectionForeground=E.selectionForeground?w(E.selectionForeground,p.NULL_COLOR):void 0,b.selectionForeground===p.NULL_COLOR&&(b.selectionForeground=void 0),p.color.isOpaque(b.selectionBackgroundTransparent)&&(b.selectionBackgroundTransparent=p.color.opacity(b.selectionBackgroundTransparent,.3)),p.color.isOpaque(b.selectionInactiveBackgroundTransparent)&&(b.selectionInactiveBackgroundTransparent=p.color.opacity(b.selectionInactiveBackgroundTransparent,.3)),b.ansi=r.DEFAULT_ANSI_COLORS.slice(),b.ansi[0]=w(E.black,r.DEFAULT_ANSI_COLORS[0]),b.ansi[1]=w(E.red,r.DEFAULT_ANSI_COLORS[1]),b.ansi[2]=w(E.green,r.DEFAULT_ANSI_COLORS[2]),b.ansi[3]=w(E.yellow,r.DEFAULT_ANSI_COLORS[3]),b.ansi[4]=w(E.blue,r.DEFAULT_ANSI_COLORS[4]),b.ansi[5]=w(E.magenta,r.DEFAULT_ANSI_COLORS[5]),b.ansi[6]=w(E.cyan,r.DEFAULT_ANSI_COLORS[6]),b.ansi[7]=w(E.white,r.DEFAULT_ANSI_COLORS[7]),b.ansi[8]=w(E.brightBlack,r.DEFAULT_ANSI_COLORS[8]),b.ansi[9]=w(E.brightRed,r.DEFAULT_ANSI_COLORS[9]),b.ansi[10]=w(E.brightGreen,r.DEFAULT_ANSI_COLORS[10]),b.ansi[11]=w(E.brightYellow,r.DEFAULT_ANSI_COLORS[11]),b.ansi[12]=w(E.brightBlue,r.DEFAULT_ANSI_COLORS[12]),b.ansi[13]=w(E.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),b.ansi[14]=w(E.brightCyan,r.DEFAULT_ANSI_COLORS[14]),b.ansi[15]=w(E.brightWhite,r.DEFAULT_ANSI_COLORS[15]),E.extendedAnsi){const R=Math.min(b.ansi.length-16,E.extendedAnsi.length);for(let j=0;j<R;j++)b.ansi[j+16]=w(E.extendedAnsi[j],r.DEFAULT_ANSI_COLORS[j+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 b=0;b<this._restoreColors.ansi.length;++b)this._colors.ansi[b]=this._restoreColors.ansi[b]}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 w(E,b){if(E!==void 0)try{return p.css.toColor(E)}catch{}return b}r.ThemeService=y=c([f(0,g.IOptionsService)],y)},6349:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const c=i(8460),f=i(844);class o extends f.Disposable{constructor(x){super(),this._maxLength=x,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(x){if(this._maxLength===x)return;const S=new Array(x);for(let g=0;g<Math.min(x,this.length);g++)S[g]=this._array[this._getCyclicIndex(g)];this._array=S,this._maxLength=x,this._startIndex=0}get length(){return this._length}set length(x){if(x>this._length)for(let S=this._length;S<x;S++)this._array[S]=void 0;this._length=x}get(x){return this._array[this._getCyclicIndex(x)]}set(x,S){this._array[this._getCyclicIndex(x)]=S}push(x){this._array[this._getCyclicIndex(this._length)]=x,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new 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(x,S,...g){if(S){for(let n=x;n<this._length-S;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+S)];this._length-=S,this.onDeleteEmitter.fire({index:x,amount:S})}for(let n=this._length-1;n>=x;n--)this._array[this._getCyclicIndex(n+g.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<g.length;n++)this._array[this._getCyclicIndex(x+n)]=g[n];if(g.length&&this.onInsertEmitter.fire({index:x,amount:g.length}),this._length+g.length>this._maxLength){const n=this._length+g.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=g.length}trimStart(x){x>this._length&&(x=this._length),this._startIndex+=x,this._length-=x,this.onTrimEmitter.fire(x)}shiftElements(x,S,g){if(!(S<=0)){if(x<0||x>=this._length)throw new Error("start argument out of range");if(x+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let d=S-1;d>=0;d--)this.set(x+d+g,this.get(x+d));const n=x+S+g-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<S;n++)this.set(x+n+g,this.get(x+n))}}_getCyclicIndex(x){return(this._startIndex+x)%this._maxLength}}r.CircularList=o},1439:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function i(c,f=5){if(typeof c!="object")return c;const o=Array.isArray(c)?[]:{};for(const p in c)o[p]=f<=1?c[p]:c[p]&&i(c[p],f-1);return o}},8055:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;const c=i(6114);let f=0,o=0,p=0,x=0;var S,g,n,d,h;function u(y){const w=y.toString(16);return w.length<2?"0"+w:w}function _(y,w){return y<w?(w+.05)/(y+.05):(y+.05)/(w+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(y){y.toCss=function(w,E,b,R){return R!==void 0?`#${u(w)}${u(E)}${u(b)}${u(R)}`:`#${u(w)}${u(E)}${u(b)}`},y.toRgba=function(w,E,b,R=255){return(w<<24|E<<16|b<<8|R)>>>0}})(S||(r.channels=S={})),(function(y){function w(E,b){return x=Math.round(255*b),[f,o,p]=h.toChannels(E.rgba),{css:S.toCss(f,o,p,x),rgba:S.toRgba(f,o,p,x)}}y.blend=function(E,b){if(x=(255&b.rgba)/255,x===1)return{css:b.css,rgba:b.rgba};const R=b.rgba>>24&255,j=b.rgba>>16&255,M=b.rgba>>8&255,L=E.rgba>>24&255,T=E.rgba>>16&255,B=E.rgba>>8&255;return f=L+Math.round((R-L)*x),o=T+Math.round((j-T)*x),p=B+Math.round((M-B)*x),{css:S.toCss(f,o,p),rgba:S.toRgba(f,o,p)}},y.isOpaque=function(E){return(255&E.rgba)==255},y.ensureContrastRatio=function(E,b,R){const j=h.ensureContrastRatio(E.rgba,b.rgba,R);if(j)return h.toColor(j>>24&255,j>>16&255,j>>8&255)},y.opaque=function(E){const b=(255|E.rgba)>>>0;return[f,o,p]=h.toChannels(b),{css:S.toCss(f,o,p),rgba:b}},y.opacity=w,y.multiplyOpacity=function(E,b){return x=255&E.rgba,w(E,x*b/255)},y.toColorRGB=function(E){return[E.rgba>>24&255,E.rgba>>16&255,E.rgba>>8&255]}})(g||(r.color=g={})),(function(y){let w,E;if(!c.isNode){const b=document.createElement("canvas");b.width=1,b.height=1;const R=b.getContext("2d",{willReadFrequently:!0});R&&(w=R,w.globalCompositeOperation="copy",E=w.createLinearGradient(0,0,1,1))}y.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return f=parseInt(b.slice(1,2).repeat(2),16),o=parseInt(b.slice(2,3).repeat(2),16),p=parseInt(b.slice(3,4).repeat(2),16),h.toColor(f,o,p);case 5:return f=parseInt(b.slice(1,2).repeat(2),16),o=parseInt(b.slice(2,3).repeat(2),16),p=parseInt(b.slice(3,4).repeat(2),16),x=parseInt(b.slice(4,5).repeat(2),16),h.toColor(f,o,p,x);case 7:return{css:b,rgba:(parseInt(b.slice(1),16)<<8|255)>>>0};case 9:return{css:b,rgba:parseInt(b.slice(1),16)>>>0}}const R=b.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return f=parseInt(R[1]),o=parseInt(R[2]),p=parseInt(R[3]),x=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),h.toColor(f,o,p,x);if(!w||!E)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=E,w.fillStyle=b,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[f,o,p,x]=w.getImageData(0,0,1,1).data,x!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(f,o,p,x),css:b}}})(n||(r.css=n={})),(function(y){function w(E,b,R){const j=E/255,M=b/255,L=R/255;return .2126*(j<=.03928?j/12.92:Math.pow((j+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}y.relativeLuminance=function(E){return w(E>>16&255,E>>8&255,255&E)},y.relativeLuminance2=w})(d||(r.rgb=d={})),(function(y){function w(b,R,j){const M=b>>24&255,L=b>>16&255,T=b>>8&255;let B=R>>24&255,I=R>>16&255,H=R>>8&255,W=_(d.relativeLuminance2(B,I,H),d.relativeLuminance2(M,L,T));for(;W<j&&(B>0||I>0||H>0);)B-=Math.max(0,Math.ceil(.1*B)),I-=Math.max(0,Math.ceil(.1*I)),H-=Math.max(0,Math.ceil(.1*H)),W=_(d.relativeLuminance2(B,I,H),d.relativeLuminance2(M,L,T));return(B<<24|I<<16|H<<8|255)>>>0}function E(b,R,j){const M=b>>24&255,L=b>>16&255,T=b>>8&255;let B=R>>24&255,I=R>>16&255,H=R>>8&255,W=_(d.relativeLuminance2(B,I,H),d.relativeLuminance2(M,L,T));for(;W<j&&(B<255||I<255||H<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),I=Math.min(255,I+Math.ceil(.1*(255-I))),H=Math.min(255,H+Math.ceil(.1*(255-H))),W=_(d.relativeLuminance2(B,I,H),d.relativeLuminance2(M,L,T));return(B<<24|I<<16|H<<8|255)>>>0}y.ensureContrastRatio=function(b,R,j){const M=d.relativeLuminance(b>>8),L=d.relativeLuminance(R>>8);if(_(M,L)<j){if(L<M){const I=w(b,R,j),H=_(M,d.relativeLuminance(I>>8));if(H<j){const W=E(b,R,j);return H>_(M,d.relativeLuminance(W>>8))?I:W}return I}const T=E(b,R,j),B=_(M,d.relativeLuminance(T>>8));if(B<j){const I=w(b,R,j);return B>_(M,d.relativeLuminance(I>>8))?T:I}return T}},y.reduceLuminance=w,y.increaseLuminance=E,y.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]},y.toColor=function(b,R,j,M){return{css:S.toCss(b,R,j,M),rgba:S.toRgba(b,R,j,M)}}})(h||(r.rgba=h={})),r.toPaddedHex=u,r.contrastRatio=_},8969:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const c=i(844),f=i(2585),o=i(4348),p=i(7866),x=i(744),S=i(7302),g=i(6975),n=i(8460),d=i(1753),h=i(1480),u=i(7994),_=i(9282),y=i(5435),w=i(5981),E=i(2660);let b=!1;class R extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new n.EventEmitter),this._onScroll.event((M=>{var L;(L=this._onScrollApi)===null||L===void 0||L.fire(M.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(M){for(const L in M)this.optionsService.options[L]=M[L]}constructor(M){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new n.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new n.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new n.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new n.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new S.OptionsService(M)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(x.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(g.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(E.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new y.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,n.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,n.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,n.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,n.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((L=>{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((L=>{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 w.WriteBuffer(((L,T)=>this._inputHandler.parse(L,T)))),this.register((0,n.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(M,L){this._writeBuffer.write(M,L)}writeSync(M,L){this._logService.logLevel<=f.LogLevelEnum.WARN&&!b&&(this._logService.warn("writeSync is unreliable and will be removed soon."),b=!0),this._writeBuffer.writeSync(M,L)}resize(M,L){isNaN(M)||isNaN(L)||(M=Math.max(M,x.MINIMUM_COLS),L=Math.max(L,x.MINIMUM_ROWS),this._bufferService.resize(M,L))}scroll(M,L=!1){this._bufferService.scroll(M,L)}scrollLines(M,L,T){this._bufferService.scrollLines(M,L,T)}scrollPages(M){this.scrollLines(M*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(M){const L=M-this._bufferService.buffer.ydisp;L!==0&&this.scrollLines(L)}registerEscHandler(M,L){return this._inputHandler.registerEscHandler(M,L)}registerDcsHandler(M,L){return this._inputHandler.registerDcsHandler(M,L)}registerCsiHandler(M,L){return this._inputHandler.registerCsiHandler(M,L)}registerOscHandler(M,L){return this._inputHandler.registerOscHandler(M,L)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let M=!1;const L=this.optionsService.rawOptions.windowsPty;L&&L.buildNumber!==void 0&&L.buildNumber!==void 0?M=L.backend==="conpty"&&L.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(M=!0),M?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const M=[];M.push(this.onLineFeed(_.updateWindowsModeWrappedState.bind(null,this._bufferService))),M.push(this.registerCsiHandler({final:"H"},(()=>((0,_.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const L of M)L.dispose()}))}}}r.CoreTerminal=R},8460:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=i=>(this._listeners.push(i),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===i)return void this._listeners.splice(c,1)}}})),this._event}fire(i,c){const f=[];for(let o=0;o<this._listeners.length;o++)f.push(this._listeners[o]);for(let o=0;o<f.length;o++)f[o].call(void 0,i,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(i,c){return i((f=>c.fire(f)))}},5435:function(C,r,i){var c=this&&this.__decorate||function(W,A,N,P){var O,$=arguments.length,X=$<3?A:P===null?P=Object.getOwnPropertyDescriptor(A,N):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(W,A,N,P);else for(var K=W.length-1;K>=0;K--)(O=W[K])&&(X=($<3?O(X):$>3?O(A,N,X):O(A,N))||X);return $>3&&X&&Object.defineProperty(A,N,X),X},f=this&&this.__param||function(W,A){return function(N,P){A(N,P,W)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const o=i(2584),p=i(7116),x=i(2015),S=i(844),g=i(482),n=i(8437),d=i(8460),h=i(643),u=i(511),_=i(3734),y=i(2585),w=i(6242),E=i(6351),b=i(5941),R={"(":0,")":1,"*":2,"+":3,"-":1,".":2},j=131072;function M(W,A){if(W>24)return A.setWinLines||!1;switch(W){case 1:return!!A.restoreWin;case 2:return!!A.minimizeWin;case 3:return!!A.setWinPosition;case 4:return!!A.setWinSizePixels;case 5:return!!A.raiseWin;case 6:return!!A.lowerWin;case 7:return!!A.refreshWin;case 8:return!!A.setWinSizeChars;case 9:return!!A.maximizeWin;case 10:return!!A.fullscreenWin;case 11:return!!A.getWinState;case 13:return!!A.getWinPosition;case 14:return!!A.getWinSizePixels;case 15:return!!A.getScreenSizePixels;case 16:return!!A.getCellSizePixels;case 18:return!!A.getWinSizeChars;case 19:return!!A.getScreenSizeChars;case 20:return!!A.getIconTitle;case 21:return!!A.getWinTitle;case 22:return!!A.pushTitle;case 23:return!!A.popTitle;case 24:return!!A.setWinLines}return!1}var L;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(L||(r.WindowsOptionsReportType=L={}));let T=0;class B extends S.Disposable{getAttrData(){return this._curAttrData}constructor(A,N,P,O,$,X,K,Q,se=new x.EscapeSequenceParser){super(),this._bufferService=A,this._charsetService=N,this._coreService=P,this._logService=O,this._optionsService=$,this._oscLinkService=X,this._coreMouseService=K,this._unicodeService=Q,this._parser=se,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new g.StringToUtf32,this._utf8Decoder=new g.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=n.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=n.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 I(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((D=>this._activeBuffer=D.activeBuffer))),this._parser.setCsiHandlerFallback(((D,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:F.toArray()})})),this._parser.setEscHandlerFallback((D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})})),this._parser.setExecuteHandlerFallback((D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})})),this._parser.setOscHandlerFallback(((D,F,q)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:F,data:q})})),this._parser.setDcsHandlerFallback(((D,F,q)=>{F==="HOOK"&&(q=q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:F,payload:q})})),this._parser.setPrintHandler(((D,F,q)=>this.print(D,F,q))),this._parser.registerCsiHandler({final:"@"},(D=>this.insertChars(D))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(D=>this.scrollLeft(D))),this._parser.registerCsiHandler({final:"A"},(D=>this.cursorUp(D))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(D=>this.scrollRight(D))),this._parser.registerCsiHandler({final:"B"},(D=>this.cursorDown(D))),this._parser.registerCsiHandler({final:"C"},(D=>this.cursorForward(D))),this._parser.registerCsiHandler({final:"D"},(D=>this.cursorBackward(D))),this._parser.registerCsiHandler({final:"E"},(D=>this.cursorNextLine(D))),this._parser.registerCsiHandler({final:"F"},(D=>this.cursorPrecedingLine(D))),this._parser.registerCsiHandler({final:"G"},(D=>this.cursorCharAbsolute(D))),this._parser.registerCsiHandler({final:"H"},(D=>this.cursorPosition(D))),this._parser.registerCsiHandler({final:"I"},(D=>this.cursorForwardTab(D))),this._parser.registerCsiHandler({final:"J"},(D=>this.eraseInDisplay(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(D=>this.eraseInDisplay(D,!0))),this._parser.registerCsiHandler({final:"K"},(D=>this.eraseInLine(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(D=>this.eraseInLine(D,!0))),this._parser.registerCsiHandler({final:"L"},(D=>this.insertLines(D))),this._parser.registerCsiHandler({final:"M"},(D=>this.deleteLines(D))),this._parser.registerCsiHandler({final:"P"},(D=>this.deleteChars(D))),this._parser.registerCsiHandler({final:"S"},(D=>this.scrollUp(D))),this._parser.registerCsiHandler({final:"T"},(D=>this.scrollDown(D))),this._parser.registerCsiHandler({final:"X"},(D=>this.eraseChars(D))),this._parser.registerCsiHandler({final:"Z"},(D=>this.cursorBackwardTab(D))),this._parser.registerCsiHandler({final:"`"},(D=>this.charPosAbsolute(D))),this._parser.registerCsiHandler({final:"a"},(D=>this.hPositionRelative(D))),this._parser.registerCsiHandler({final:"b"},(D=>this.repeatPrecedingCharacter(D))),this._parser.registerCsiHandler({final:"c"},(D=>this.sendDeviceAttributesPrimary(D))),this._parser.registerCsiHandler({prefix:">",final:"c"},(D=>this.sendDeviceAttributesSecondary(D))),this._parser.registerCsiHandler({final:"d"},(D=>this.linePosAbsolute(D))),this._parser.registerCsiHandler({final:"e"},(D=>this.vPositionRelative(D))),this._parser.registerCsiHandler({final:"f"},(D=>this.hVPosition(D))),this._parser.registerCsiHandler({final:"g"},(D=>this.tabClear(D))),this._parser.registerCsiHandler({final:"h"},(D=>this.setMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(D=>this.setModePrivate(D))),this._parser.registerCsiHandler({final:"l"},(D=>this.resetMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(D=>this.resetModePrivate(D))),this._parser.registerCsiHandler({final:"m"},(D=>this.charAttributes(D))),this._parser.registerCsiHandler({final:"n"},(D=>this.deviceStatus(D))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(D=>this.deviceStatusPrivate(D))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(D=>this.softReset(D))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(D=>this.setCursorStyle(D))),this._parser.registerCsiHandler({final:"r"},(D=>this.setScrollRegion(D))),this._parser.registerCsiHandler({final:"s"},(D=>this.saveCursor(D))),this._parser.registerCsiHandler({final:"t"},(D=>this.windowOptions(D))),this._parser.registerCsiHandler({final:"u"},(D=>this.restoreCursor(D))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(D=>this.insertColumns(D))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(D=>this.deleteColumns(D))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(D=>this.selectProtected(D))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(D=>this.requestMode(D,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(D=>this.requestMode(D,!1))),this._parser.setExecuteHandler(o.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(o.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(o.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(o.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(o.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(o.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(o.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(o.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(o.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new w.OscHandler((D=>(this.setTitle(D),this.setIconName(D),!0)))),this._parser.registerOscHandler(1,new w.OscHandler((D=>this.setIconName(D)))),this._parser.registerOscHandler(2,new w.OscHandler((D=>this.setTitle(D)))),this._parser.registerOscHandler(4,new w.OscHandler((D=>this.setOrReportIndexedColor(D)))),this._parser.registerOscHandler(8,new w.OscHandler((D=>this.setHyperlink(D)))),this._parser.registerOscHandler(10,new w.OscHandler((D=>this.setOrReportFgColor(D)))),this._parser.registerOscHandler(11,new w.OscHandler((D=>this.setOrReportBgColor(D)))),this._parser.registerOscHandler(12,new w.OscHandler((D=>this.setOrReportCursorColor(D)))),this._parser.registerOscHandler(104,new w.OscHandler((D=>this.restoreIndexedColor(D)))),this._parser.registerOscHandler(110,new w.OscHandler((D=>this.restoreFgColor(D)))),this._parser.registerOscHandler(111,new w.OscHandler((D=>this.restoreBgColor(D)))),this._parser.registerOscHandler(112,new w.OscHandler((D=>this.restoreCursorColor(D)))),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(const D in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},(()=>this.selectCharset("("+D))),this._parser.registerEscHandler({intermediates:")",final:D},(()=>this.selectCharset(")"+D))),this._parser.registerEscHandler({intermediates:"*",final:D},(()=>this.selectCharset("*"+D))),this._parser.registerEscHandler({intermediates:"+",final:D},(()=>this.selectCharset("+"+D))),this._parser.registerEscHandler({intermediates:"-",final:D},(()=>this.selectCharset("-"+D))),this._parser.registerEscHandler({intermediates:".",final:D},(()=>this.selectCharset("."+D))),this._parser.registerEscHandler({intermediates:"/",final:D},(()=>this.selectCharset("/"+D)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((D=>(this._logService.error("Parsing error: ",D),D))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new E.DcsHandler(((D,F)=>this.requestStatusString(D,F))))}_preserveStack(A,N,P,O){this._parseStack.paused=!0,this._parseStack.cursorStartX=A,this._parseStack.cursorStartY=N,this._parseStack.decodedLength=P,this._parseStack.position=O}_logSlowResolvingAsync(A){this._logService.logLevel<=y.LogLevelEnum.WARN&&Promise.race([A,new Promise(((N,P)=>setTimeout((()=>P("#SLOW_TIMEOUT")),5e3)))]).catch((N=>{if(N!=="#SLOW_TIMEOUT")throw N;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(A,N){let P,O=this._activeBuffer.x,$=this._activeBuffer.y,X=0;const K=this._parseStack.paused;if(K){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,N))return this._logSlowResolvingAsync(P),P;O=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,A.length>j&&(X=this._parseStack.position+j)}if(this._logService.logLevel<=y.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof A=="string"?` "${A}"`:` "${Array.prototype.map.call(A,(Q=>String.fromCharCode(Q))).join("")}"`),typeof A=="string"?A.split("").map((Q=>Q.charCodeAt(0))):A),this._parseBuffer.length<A.length&&this._parseBuffer.length<j&&(this._parseBuffer=new Uint32Array(Math.min(A.length,j))),K||this._dirtyRowTracker.clearRange(),A.length>j)for(let Q=X;Q<A.length;Q+=j){const se=Q+j<A.length?Q+j:A.length,D=typeof A=="string"?this._stringDecoder.decode(A.substring(Q,se),this._parseBuffer):this._utf8Decoder.decode(A.subarray(Q,se),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,D))return this._preserveStack(O,$,D,Q),this._logSlowResolvingAsync(P),P}else if(!K){const Q=typeof A=="string"?this._stringDecoder.decode(A,this._parseBuffer):this._utf8Decoder.decode(A,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,Q))return this._preserveStack(O,$,Q,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===O&&this._activeBuffer.y===$||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(A,N,P){let O,$;const X=this._charsetService.charset,K=this._optionsService.rawOptions.screenReaderMode,Q=this._bufferService.cols,se=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,F=this._curAttrData;let q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-N>0&&q.getWidth(this._activeBuffer.x-1)===2&&q.setCellFromCodePoint(this._activeBuffer.x-1,0,1,F.fg,F.bg,F.extended);for(let z=N;z<P;++z){if(O=A[z],$=this._unicodeService.wcwidth(O),O<127&&X){const te=X[String.fromCharCode(O)];te&&(O=te.charCodeAt(0))}if(K&&this._onA11yChar.fire((0,g.stringFromCodePoint)(O)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),$||!this._activeBuffer.x){if(this._activeBuffer.x+$-1>=Q){if(se){for(;this._activeBuffer.x<Q;)q.setCellFromCodePoint(this._activeBuffer.x++,0,1,F.fg,F.bg,F.extended);this._activeBuffer.x=0,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),q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=Q-1,$===2)continue}if(D&&(q.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(F),F),q.getWidth(Q-1)===2&&q.setCellFromCodePoint(Q-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,F.fg,F.bg,F.extended)),q.setCellFromCodePoint(this._activeBuffer.x++,O,$,F.fg,F.bg,F.extended),$>0)for(;--$;)q.setCellFromCodePoint(this._activeBuffer.x++,0,0,F.fg,F.bg,F.extended)}else q.getWidth(this._activeBuffer.x-1)?q.addCodepointToCell(this._activeBuffer.x-1,O):q.addCodepointToCell(this._activeBuffer.x-2,O)}P-N>0&&(q.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<Q&&P-N>0&&q.getWidth(this._activeBuffer.x)===0&&!q.hasContent(this._activeBuffer.x)&&q.setCellFromCodePoint(this._activeBuffer.x,0,1,F.fg,F.bg,F.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(A,N){return A.final!=="t"||A.prefix||A.intermediates?this._parser.registerCsiHandler(A,N):this._parser.registerCsiHandler(A,(P=>!M(P.params[0],this._optionsService.rawOptions.windowOptions)||N(P)))}registerDcsHandler(A,N){return this._parser.registerDcsHandler(A,new E.DcsHandler(N))}registerEscHandler(A,N){return this._parser.registerEscHandler(A,N)}registerOscHandler(A,N){return this._parser.registerOscHandler(A,new w.OscHandler(N))}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(){var A;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&&(!((A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||A===void 0)&&A.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);N.hasWidth(this._activeBuffer.x)&&!N.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const A=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-A),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(A=this._bufferService.cols-1){this._activeBuffer.x=Math.min(A,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(A,N){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=A,this._activeBuffer.y=this._activeBuffer.scrollTop+N):(this._activeBuffer.x=A,this._activeBuffer.y=N),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(A,N){this._restrictCursor(),this._setCursor(this._activeBuffer.x+A,this._activeBuffer.y+N)}cursorUp(A){const N=this._activeBuffer.y-this._activeBuffer.scrollTop;return N>=0?this._moveCursor(0,-Math.min(N,A.params[0]||1)):this._moveCursor(0,-(A.params[0]||1)),!0}cursorDown(A){const N=this._activeBuffer.scrollBottom-this._activeBuffer.y;return N>=0?this._moveCursor(0,Math.min(N,A.params[0]||1)):this._moveCursor(0,A.params[0]||1),!0}cursorForward(A){return this._moveCursor(A.params[0]||1,0),!0}cursorBackward(A){return this._moveCursor(-(A.params[0]||1),0),!0}cursorNextLine(A){return this.cursorDown(A),this._activeBuffer.x=0,!0}cursorPrecedingLine(A){return this.cursorUp(A),this._activeBuffer.x=0,!0}cursorCharAbsolute(A){return this._setCursor((A.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(A){return this._setCursor(A.length>=2?(A.params[1]||1)-1:0,(A.params[0]||1)-1),!0}charPosAbsolute(A){return this._setCursor((A.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(A){return this._moveCursor(A.params[0]||1,0),!0}linePosAbsolute(A){return this._setCursor(this._activeBuffer.x,(A.params[0]||1)-1),!0}vPositionRelative(A){return this._moveCursor(0,A.params[0]||1),!0}hVPosition(A){return this.cursorPosition(A),!0}tabClear(A){const N=A.params[0];return N===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:N===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(A){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let N=A.params[0]||1;for(;N--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(A){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let N=A.params[0]||1;for(;N--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(A){const N=A.params[0];return N===1&&(this._curAttrData.bg|=536870912),N!==2&&N!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(A,N,P,O=!1,$=!1){const X=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);X.replaceCells(N,P,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),$),O&&(X.isWrapped=!1)}_resetBufferLine(A,N=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),N),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+A),P.isWrapped=!1)}eraseInDisplay(A,N=!1){let P;switch(this._restrictCursor(this._bufferService.cols),A.params[0]){case 0:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,N);P<this._bufferService.rows;P++)this._resetBufferLine(P,N);this._dirtyRowTracker.markDirty(P);break;case 1:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P,0,this._activeBuffer.x+1,!0,N),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,N);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,N);this._dirtyRowTracker.markDirty(0);break;case 3:const O=this._activeBuffer.lines.length-this._bufferService.rows;O>0&&(this._activeBuffer.lines.trimStart(O),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-O,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-O,0),this._onScroll.fire(0))}return!0}eraseInLine(A,N=!1){switch(this._restrictCursor(this._bufferService.cols),A.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,N);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,N);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,N)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(A){this._restrictCursor();let N=A.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y,O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-O+1;for(;N--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(A){this._restrictCursor();let N=A.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y;let O;for(O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,O=this._bufferService.rows-1+this._activeBuffer.ybase-O;N--;)this._activeBuffer.lines.splice(P,1),this._activeBuffer.lines.splice(O,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(A){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.insertCells(this._activeBuffer.x,A.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(A){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.deleteCells(this._activeBuffer.x,A.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(A){let N=A.params[0]||1;for(;N--;)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(A){let N=A.params[0]||1;for(;N--;)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(n.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=A.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);O.deleteCells(0,N,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=A.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);O.insertCells(0,N,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=A.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);O.insertCells(this._activeBuffer.x,N,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=A.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);O.deleteCells(this._activeBuffer.x,N,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(A){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(A.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(A){if(!this._parser.precedingCodepoint)return!0;const N=A.params[0]||1,P=new Uint32Array(N);for(let O=0;O<N;++O)P[O]=this._parser.precedingCodepoint;return this.print(P,0,P.length),!0}sendDeviceAttributesPrimary(A){return A.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(A){return A.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(A.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(A){return(this._optionsService.rawOptions.termName+"").indexOf(A)===0}setMode(A){for(let N=0;N<A.length;N++)switch(A.params[N]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(A){for(let N=0;N<A.length;N++)switch(A.params[N]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.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(A){for(let N=0;N<A.length;N++)switch(A.params[N]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(A){for(let N=0;N<A.length;N++)switch(A.params[N]){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(),A.params[N]===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(A,N){const P=this._coreService.decPrivateModes,{activeProtocol:O,activeEncoding:$}=this._coreMouseService,X=this._coreService,{buffers:K,cols:Q}=this._bufferService,{active:se,alt:D}=K,F=this._optionsService.rawOptions,q=ie=>ie?1:2,z=A.params[0];return te=z,Y=N?z===2?4:z===4?q(X.modes.insertMode):z===12?3:z===20?q(F.convertEol):0:z===1?q(P.applicationCursorKeys):z===3?F.windowOptions.setWinLines?Q===80?2:Q===132?1:0:0:z===6?q(P.origin):z===7?q(P.wraparound):z===8?3:z===9?q(O==="X10"):z===12?q(F.cursorBlink):z===25?q(!X.isCursorHidden):z===45?q(P.reverseWraparound):z===66?q(P.applicationKeypad):z===67?4:z===1e3?q(O==="VT200"):z===1002?q(O==="DRAG"):z===1003?q(O==="ANY"):z===1004?q(P.sendFocus):z===1005?4:z===1006?q($==="SGR"):z===1015?4:z===1016?q($==="SGR_PIXELS"):z===1048?1:z===47||z===1047||z===1049?q(se===D):z===2004?q(P.bracketedPasteMode):0,X.triggerDataEvent(`${o.C0.ESC}[${N?"":"?"}${te};${Y}$y`),!0;var te,Y}_updateAttrColor(A,N,P,O,$){return N===2?(A|=50331648,A&=-16777216,A|=_.AttributeData.fromColorRGB([P,O,$])):N===5&&(A&=-50331904,A|=33554432|255&P),A}_extractColor(A,N,P){const O=[0,0,-1,0,0,0];let $=0,X=0;do{if(O[X+$]=A.params[N+X],A.hasSubParams(N+X)){const K=A.getSubParams(N+X);let Q=0;do O[1]===5&&($=1),O[X+Q+1+$]=K[Q];while(++Q<K.length&&Q+X+1+$<O.length);break}if(O[1]===5&&X+$>=2||O[1]===2&&X+$>=5)break;O[1]&&($=1)}while(++X+N<A.length&&X+$<O.length);for(let K=2;K<O.length;++K)O[K]===-1&&(O[K]=0);switch(O[0]){case 38:P.fg=this._updateAttrColor(P.fg,O[1],O[3],O[4],O[5]);break;case 48:P.bg=this._updateAttrColor(P.bg,O[1],O[3],O[4],O[5]);break;case 58:P.extended=P.extended.clone(),P.extended.underlineColor=this._updateAttrColor(P.extended.underlineColor,O[1],O[3],O[4],O[5])}return X}_processUnderline(A,N){N.extended=N.extended.clone(),(!~A||A>5)&&(A=1),N.extended.underlineStyle=A,N.fg|=268435456,A===0&&(N.fg&=-268435457),N.updateExtended()}_processSGR0(A){A.fg=n.DEFAULT_ATTR_DATA.fg,A.bg=n.DEFAULT_ATTR_DATA.bg,A.extended=A.extended.clone(),A.extended.underlineStyle=0,A.extended.underlineColor&=-67108864,A.updateExtended()}charAttributes(A){if(A.length===1&&A.params[0]===0)return this._processSGR0(this._curAttrData),!0;const N=A.length;let P;const O=this._curAttrData;for(let $=0;$<N;$++)P=A.params[$],P>=30&&P<=37?(O.fg&=-50331904,O.fg|=16777216|P-30):P>=40&&P<=47?(O.bg&=-50331904,O.bg|=16777216|P-40):P>=90&&P<=97?(O.fg&=-50331904,O.fg|=16777224|P-90):P>=100&&P<=107?(O.bg&=-50331904,O.bg|=16777224|P-100):P===0?this._processSGR0(O):P===1?O.fg|=134217728:P===3?O.bg|=67108864:P===4?(O.fg|=268435456,this._processUnderline(A.hasSubParams($)?A.getSubParams($)[0]:1,O)):P===5?O.fg|=536870912:P===7?O.fg|=67108864:P===8?O.fg|=1073741824:P===9?O.fg|=2147483648:P===2?O.bg|=134217728:P===21?this._processUnderline(2,O):P===22?(O.fg&=-134217729,O.bg&=-134217729):P===23?O.bg&=-67108865:P===24?(O.fg&=-268435457,this._processUnderline(0,O)):P===25?O.fg&=-536870913:P===27?O.fg&=-67108865:P===28?O.fg&=-1073741825:P===29?O.fg&=2147483647:P===39?(O.fg&=-67108864,O.fg|=16777215&n.DEFAULT_ATTR_DATA.fg):P===49?(O.bg&=-67108864,O.bg|=16777215&n.DEFAULT_ATTR_DATA.bg):P===38||P===48||P===58?$+=this._extractColor(A,$,O):P===53?O.bg|=1073741824:P===55?O.bg&=-1073741825:P===59?(O.extended=O.extended.clone(),O.extended.underlineColor=-1,O.updateExtended()):P===100?(O.fg&=-67108864,O.fg|=16777215&n.DEFAULT_ATTR_DATA.fg,O.bg&=-67108864,O.bg|=16777215&n.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",P);return!0}deviceStatus(A){switch(A.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:const N=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${N};${P}R`)}return!0}deviceStatusPrivate(A){if(A.params[0]===6){const N=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${N};${P}R`)}return!0}softReset(A){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=n.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(A){const N=A.params[0]||1;switch(N){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"}const P=N%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(A){const N=A.params[0]||1;let P;return(A.length<2||(P=A.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>N&&(this._activeBuffer.scrollTop=N-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(A){if(!M(A.params[0],this._optionsService.rawOptions.windowOptions))return!0;const N=A.length>1?A.params[1]:0;switch(A.params[0]){case 14:N!==2&&this._onRequestWindowsOptionsReport.fire(L.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(L.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:N!==0&&N!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),N!==0&&N!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:N!==0&&N!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),N!==0&&N!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(A){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(A){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(A){return this._windowTitle=A,this._onTitleChange.fire(A),!0}setIconName(A){return this._iconName=A,!0}setOrReportIndexedColor(A){const N=[],P=A.split(";");for(;P.length>1;){const O=P.shift(),$=P.shift();if(/^\d+$/.exec(O)){const X=parseInt(O);if(H(X))if($==="?")N.push({type:0,index:X});else{const K=(0,b.parseColor)($);K&&N.push({type:1,index:X,color:K})}}}return N.length&&this._onColor.fire(N),!0}setHyperlink(A){const N=A.split(";");return!(N.length<2)&&(N[1]?this._createHyperlink(N[0],N[1]):!N[0]&&this._finishHyperlink())}_createHyperlink(A,N){this._getCurrentLinkId()&&this._finishHyperlink();const P=A.split(":");let O;const $=P.findIndex((X=>X.startsWith("id=")));return $!==-1&&(O=P[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:O,uri:N}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(A,N){const P=A.split(";");for(let O=0;O<P.length&&!(N>=this._specialColors.length);++O,++N)if(P[O]==="?")this._onColor.fire([{type:0,index:this._specialColors[N]}]);else{const $=(0,b.parseColor)(P[O]);$&&this._onColor.fire([{type:1,index:this._specialColors[N],color:$}])}return!0}setOrReportFgColor(A){return this._setOrReportSpecialColor(A,0)}setOrReportBgColor(A){return this._setOrReportSpecialColor(A,1)}setOrReportCursorColor(A){return this._setOrReportSpecialColor(A,2)}restoreIndexedColor(A){if(!A)return this._onColor.fire([{type:2}]),!0;const N=[],P=A.split(";");for(let O=0;O<P.length;++O)if(/^\d+$/.exec(P[O])){const $=parseInt(P[O]);H($)&&N.push({type:2,index:$})}return N.length&&this._onColor.fire(N),!0}restoreFgColor(A){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(A){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(A){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,p.DEFAULT_CHARSET),!0}selectCharset(A){return A.length!==2?(this.selectDefaultCharset(),!0):(A[0]==="/"||this._charsetService.setgCharset(R[A[0]],p.CHARSETS[A[1]]||p.DEFAULT_CHARSET),!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){const A=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,A,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=n.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=n.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(A){return this._charsetService.setgLevel(A),!0}screenAlignmentPattern(){const A=new u.CellData;A.content=4194373,A.fg=this._curAttrData.fg,A.bg=this._curAttrData.bg,this._setCursor(0,0);for(let N=0;N<this._bufferService.rows;++N){const P=this._activeBuffer.ybase+this._activeBuffer.y+N,O=this._activeBuffer.lines.get(P);O&&(O.fill(A),O.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(A,N){const P=this._bufferService.buffer,O=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${$}${o.C0.ESC}\\`),!0))(A==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:A==='"p'?'P1$r61;1"p':A==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:A==="m"?"P1$r0m":A===" q"?`P1$r${{block:2,underline:4,bar:6}[O.cursorStyle]-(O.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(A,N){this._dirtyRowTracker.markRangeDirty(A,N)}}r.InputHandler=B;let I=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,A){W>A&&(T=W,W=A,A=T),W<this.start&&(this.start=W),A>this.end&&(this.end=A)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(W){return 0<=W&&W<256}I=c([f(0,y.IBufferService)],I)},844:(C,r)=>{function i(c){for(const f of c)f.dispose();c.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const f=this._disposables.indexOf(c);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var f;this._isDisposed||c===this._value||((f=this._value)===null||f===void 0||f.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)===null||c===void 0||c.dispose(),this._value=void 0}},r.toDisposable=function(c){return{dispose:c}},r.disposeArray=i,r.getDisposeArrayDisposable=function(c){return{dispose:()=>i(c)}}},1505:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class i{constructor(){this._data={}}set(f,o,p){this._data[f]||(this._data[f]={}),this._data[f][o]=p}get(f,o){return this._data[f]?this._data[f][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=i,r.FourKeyMap=class{constructor(){this._data=new i}set(c,f,o,p,x){this._data.get(c,f)||this._data.set(c,f,new i),this._data.get(c,f).set(o,p,x)}get(c,f,o,p){var x;return(x=this._data.get(c,f))===null||x===void 0?void 0:x.get(o,p)}clear(){this._data.clear()}}},6114:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof navigator>"u";const i=r.isNode?"node":navigator.userAgent,c=r.isNode?"node":navigator.platform;r.isFirefox=i.includes("Firefox"),r.isLegacyEdge=i.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(i),r.getSafariVersion=function(){if(!r.isSafari)return 0;const f=i.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),r.isIpad=c==="iPad",r.isIphone=c==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),r.isLinux=c.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(i)},6106:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let i=0;r.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(i=this._search(this._getKey(c)),this._array.splice(i,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const f=this._getKey(c);if(f===void 0||(i=this._search(f),i===-1)||this._getKey(this._array[i])!==f)return!1;do if(this._array[i]===c)return this._array.splice(i,1),!0;while(++i<this._array.length&&this._getKey(this._array[i])===f);return!1}*getKeyIterator(c){if(this._array.length!==0&&(i=this._search(c),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===c))do yield this._array[i];while(++i<this._array.length&&this._getKey(this._array[i])===c)}forEachByKey(c,f){if(this._array.length!==0&&(i=this._search(c),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===c))do f(this._array[i]);while(++i<this._array.length&&this._getKey(this._array[i])===c)}values(){return[...this._array].values()}_search(c){let f=0,o=this._array.length-1;for(;o>=f;){let p=f+o>>1;const x=this._getKey(this._array[p]);if(x>c)o=p-1;else{if(!(x<c)){for(;p>0&&this._getKey(this._array[p-1])===c;)p--;return p}f=p+1}}return f}}},7226:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const c=i(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(x){this._tasks.push(x),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(x){this._idleCallback=void 0;let S=0,g=0,n=x.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),g=Math.max(S,g),d=x.timeRemaining(),1.5*g>d)return n-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-S))}ms`),void this._start();n=d}this.clear()}}class o extends f{_requestCallback(x){return setTimeout((()=>x(this._createDeadline(16))))}_cancelCallback(x){clearTimeout(x)}_createDeadline(x){const S=Date.now()+x;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const c=i(643);r.updateWindowsModeWrappedState=function(f){const o=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),p=o?.get(f.cols-1),x=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);x&&p&&(x.isWrapped=p[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&p[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class i{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){const o=new i;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}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)==0}isBgDefault(){return(50331648&this.bg)==0}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)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}r.AttributeData=i;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}constructor(o=0,p=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=p}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=c},9092:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const c=i(6349),f=i(7226),o=i(3734),p=i(8437),x=i(4634),S=i(511),g=i(643),n=i(4863),d=i(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(h,u,_){this._hasScrollback=h,this._optionsService=u,this._bufferService=_,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(h){return h?(this._nullCell.fg=h.fg,this._nullCell.bg=h.bg,this._nullCell.extended=h.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(h){return h?(this._whitespaceCell.fg=h.fg,this._whitespaceCell.bg=h.bg,this._whitespaceCell.extended=h.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(h,u){return new p.BufferLine(this._bufferService.cols,this.getNullCell(h),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const h=this.ybase+this.y-this.ydisp;return h>=0&&h<this._rows}_getCorrectBufferLength(h){if(!this._hasScrollback)return h;const u=h+this._optionsService.rawOptions.scrollback;return u>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:u}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=p.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(h))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(h,u){const _=this.getNullCell(p.DEFAULT_ATTR_DATA);let y=0;const w=this._getCorrectBufferLength(u);if(w>this.lines.maxLength&&(this.lines.maxLength=w),this.lines.length>0){if(this._cols<h)for(let b=0;b<this.lines.length;b++)y+=+this.lines.get(b).resize(h,_);let E=0;if(this._rows<u)for(let b=this._rows;b<u;b++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(h,_)):this.ybase>0&&this.lines.length<=this.ybase+this.y+E+1?(this.ybase--,E++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(h,_)));else for(let b=this._rows;b>u;b--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(w<this.lines.maxLength){const b=this.lines.length-w;b>0&&(this.lines.trimStart(b),this.ybase=Math.max(this.ybase-b,0),this.ydisp=Math.max(this.ydisp-b,0),this.savedY=Math.max(this.savedY-b,0)),this.lines.maxLength=w}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,u-1),E&&(this.y+=E),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(h,u),this._cols>h))for(let E=0;E<this.lines.length;E++)y+=+this.lines.get(E).resize(h,_);this._cols=h,this._rows=u,this._memoryCleanupQueue.clear(),y>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let h=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,h=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return h}get _isReflowEnabled(){const h=this._optionsService.rawOptions.windowsPty;return h&&h.buildNumber?this._hasScrollback&&h.backend==="conpty"&&h.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(h,u){this._cols!==h&&(h>this._cols?this._reflowLarger(h,u):this._reflowSmaller(h,u))}_reflowLarger(h,u){const _=(0,x.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(_.length>0){const y=(0,x.reflowLargerCreateNewLayout)(this.lines,_);(0,x.reflowLargerApplyNewLayout)(this.lines,y.layout),this._reflowLargerAdjustViewport(h,u,y.countRemoved)}}_reflowLargerAdjustViewport(h,u,_){const y=this.getNullCell(p.DEFAULT_ATTR_DATA);let w=_;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new p.BufferLine(h,y))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-_,0)}_reflowSmaller(h,u){const _=this.getNullCell(p.DEFAULT_ATTR_DATA),y=[];let w=0;for(let E=this.lines.length-1;E>=0;E--){let b=this.lines.get(E);if(!b||!b.isWrapped&&b.getTrimmedLength()<=h)continue;const R=[b];for(;b.isWrapped&&E>0;)b=this.lines.get(--E),R.unshift(b);const j=this.ybase+this.y;if(j>=E&&j<E+R.length)continue;const M=R[R.length-1].getTrimmedLength(),L=(0,x.reflowSmallerGetNewLineLengths)(R,this._cols,h),T=L.length-R.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+T):Math.max(0,this.lines.length-this.lines.maxLength+T);const I=[];for(let O=0;O<T;O++){const $=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);I.push($)}I.length>0&&(y.push({start:E+R.length+w,newLines:I}),w+=I.length),R.push(...I);let H=L.length-1,W=L[H];W===0&&(H--,W=L[H]);let A=R.length-T-1,N=M;for(;A>=0;){const O=Math.min(N,W);if(R[H]===void 0)break;if(R[H].copyCellsFrom(R[A],N-O,W-O,O,!0),W-=O,W===0&&(H--,W=L[H]),N-=O,N===0){A--;const $=Math.max(A,0);N=(0,x.getWrappedLineTrimmedLength)(R,$,this._cols)}}for(let O=0;O<R.length;O++)L[O]<h&&R[O].setCell(L[O],_);let P=T-B;for(;P-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+w)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+T,this.ybase+u-1)}if(y.length>0){const E=[],b=[];for(let H=0;H<this.lines.length;H++)b.push(this.lines.get(H));const R=this.lines.length;let j=R-1,M=0,L=y[M];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let T=0;for(let H=Math.min(this.lines.maxLength-1,R+w-1);H>=0;H--)if(L&&L.start>j+T){for(let W=L.newLines.length-1;W>=0;W--)this.lines.set(H--,L.newLines[W]);H++,E.push({index:j+1,amount:L.newLines.length}),T+=L.newLines.length,L=y[++M]}else this.lines.set(H,b[j--]);let B=0;for(let H=E.length-1;H>=0;H--)E[H].index+=B,this.lines.onInsertEmitter.fire(E[H]),B+=E[H].amount;const I=Math.max(0,R+w-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(h,u,_=0,y){const w=this.lines.get(h);return w?w.translateToString(u,_,y):""}getWrappedRangeForLine(h){let u=h,_=h;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;_+1<this.lines.length&&this.lines.get(_+1).isWrapped;)_++;return{first:u,last:_}}setupTabStops(h){for(h!=null?this.tabs[h]||(h=this.prevStop(h)):(this.tabs={},h=0);h<this._cols;h+=this._optionsService.rawOptions.tabStopWidth)this.tabs[h]=!0}prevStop(h){for(h==null&&(h=this.x);!this.tabs[--h]&&h>0;);return h>=this._cols?this._cols-1:h<0?0:h}nextStop(h){for(h==null&&(h=this.x);!this.tabs[++h]&&h<this._cols;);return h>=this._cols?this._cols-1:h<0?0:h}clearMarkers(h){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===h&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].dispose(),this.markers.splice(h--,1);this._isClearing=!1}addMarker(h){const u=new n.Marker(h);return this.markers.push(u),u.register(this.lines.onTrim((_=>{u.line-=_,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((_=>{u.line>=_.index&&(u.line+=_.amount)}))),u.register(this.lines.onDelete((_=>{u.line>=_.index&&u.line<_.index+_.amount&&u.dispose(),u.line>_.index&&(u.line-=_.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},8437:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const c=i(3734),f=i(511),o=i(643),p=i(482);r.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let x=0;class S{constructor(n,d,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*n);const u=d||f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let _=0;_<n;++_)this.setCell(_,u);this.length=n}get(n){const d=this._data[3*n+0],h=2097151&d;return[this._data[3*n+1],2097152&d?this._combined[n]:h?(0,p.stringFromCodePoint)(h):"",d>>22,2097152&d?this._combined[n].charCodeAt(this._combined[n].length-1):h]}set(n,d){this._data[3*n+1]=d[o.CHAR_DATA_ATTR_INDEX],d[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[n]=d[1],this._data[3*n+0]=2097152|n|d[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*n+0]=d[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(n){return this._data[3*n+0]>>22}hasWidth(n){return 12582912&this._data[3*n+0]}getFg(n){return this._data[3*n+1]}getBg(n){return this._data[3*n+2]}hasContent(n){return 4194303&this._data[3*n+0]}getCodePoint(n){const d=this._data[3*n+0];return 2097152&d?this._combined[n].charCodeAt(this._combined[n].length-1):2097151&d}isCombined(n){return 2097152&this._data[3*n+0]}getString(n){const d=this._data[3*n+0];return 2097152&d?this._combined[n]:2097151&d?(0,p.stringFromCodePoint)(2097151&d):""}isProtected(n){return 536870912&this._data[3*n+2]}loadCell(n,d){return x=3*n,d.content=this._data[x+0],d.fg=this._data[x+1],d.bg=this._data[x+2],2097152&d.content&&(d.combinedData=this._combined[n]),268435456&d.bg&&(d.extended=this._extendedAttrs[n]),d}setCell(n,d){2097152&d.content&&(this._combined[n]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[n]=d.extended),this._data[3*n+0]=d.content,this._data[3*n+1]=d.fg,this._data[3*n+2]=d.bg}setCellFromCodePoint(n,d,h,u,_,y){268435456&_&&(this._extendedAttrs[n]=y),this._data[3*n+0]=d|h<<22,this._data[3*n+1]=u,this._data[3*n+2]=_}addCodepointToCell(n,d){let h=this._data[3*n+0];2097152&h?this._combined[n]+=(0,p.stringFromCodePoint)(d):(2097151&h?(this._combined[n]=(0,p.stringFromCodePoint)(2097151&h)+(0,p.stringFromCodePoint)(d),h&=-2097152,h|=2097152):h=d|4194304,this._data[3*n+0]=h)}insertCells(n,d,h,u){if((n%=this.length)&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs),d<this.length-n){const _=new f.CellData;for(let y=this.length-n-d-1;y>=0;--y)this.setCell(n+d+y,this.loadCell(n+y,_));for(let y=0;y<d;++y)this.setCell(n+y,h)}else for(let _=n;_<this.length;++_)this.setCell(_,h);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs)}deleteCells(n,d,h,u){if(n%=this.length,d<this.length-n){const _=new f.CellData;for(let y=0;y<this.length-n-d;++y)this.setCell(n+y,this.loadCell(n+d+y,_));for(let y=this.length-d;y<this.length;++y)this.setCell(y,h)}else for(let _=n;_<this.length;++_)this.setCell(_,h);n&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs),this.getWidth(n)!==0||this.hasContent(n)||this.setCellFromCodePoint(n,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs)}replaceCells(n,d,h,u,_=!1){if(_)for(n&&this.getWidth(n-1)===2&&!this.isProtected(n-1)&&this.setCellFromCodePoint(n-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodePoint(d,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs);n<d&&n<this.length;)this.isProtected(n)||this.setCell(n,h),n++;else for(n&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodePoint(d,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs);n<d&&n<this.length;)this.setCell(n++,h)}resize(n,d){if(n===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const h=3*n;if(n>this.length){if(this._data.buffer.byteLength>=4*h)this._data=new Uint32Array(this._data.buffer,0,h);else{const u=new Uint32Array(h);u.set(this._data),this._data=u}for(let u=this.length;u<n;++u)this.setCell(u,d)}else{this._data=this._data.subarray(0,h);const u=Object.keys(this._combined);for(let y=0;y<u.length;y++){const w=parseInt(u[y],10);w>=n&&delete this._combined[w]}const _=Object.keys(this._extendedAttrs);for(let y=0;y<_.length;y++){const w=parseInt(_[y],10);w>=n&&delete this._extendedAttrs[w]}}return this.length=n,4*h*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const n=new Uint32Array(this._data.length);return n.set(this._data),this._data=n,1}return 0}fill(n,d=!1){if(d)for(let h=0;h<this.length;++h)this.isProtected(h)||this.setCell(h,n);else{this._combined={},this._extendedAttrs={};for(let h=0;h<this.length;++h)this.setCell(h,n)}}copyFrom(n){this.length!==n.length?this._data=new Uint32Array(n._data):this._data.set(n._data),this.length=n.length,this._combined={};for(const d in n._combined)this._combined[d]=n._combined[d];this._extendedAttrs={};for(const d in n._extendedAttrs)this._extendedAttrs[d]=n._extendedAttrs[d];this.isWrapped=n.isWrapped}clone(){const n=new S(0);n._data=new Uint32Array(this._data),n.length=this.length;for(const d in this._combined)n._combined[d]=this._combined[d];for(const d in this._extendedAttrs)n._extendedAttrs[d]=this._extendedAttrs[d];return n.isWrapped=this.isWrapped,n}getTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0])return n+(this._data[3*n+0]>>22);return 0}getNoBgTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0]||50331648&this._data[3*n+2])return n+(this._data[3*n+0]>>22);return 0}copyCellsFrom(n,d,h,u,_){const y=n._data;if(_)for(let E=u-1;E>=0;E--){for(let b=0;b<3;b++)this._data[3*(h+E)+b]=y[3*(d+E)+b];268435456&y[3*(d+E)+2]&&(this._extendedAttrs[h+E]=n._extendedAttrs[d+E])}else for(let E=0;E<u;E++){for(let b=0;b<3;b++)this._data[3*(h+E)+b]=y[3*(d+E)+b];268435456&y[3*(d+E)+2]&&(this._extendedAttrs[h+E]=n._extendedAttrs[d+E])}const w=Object.keys(n._combined);for(let E=0;E<w.length;E++){const b=parseInt(w[E],10);b>=d&&(this._combined[b-d+h]=n._combined[b])}}translateToString(n=!1,d=0,h=this.length){n&&(h=Math.min(h,this.getTrimmedLength()));let u="";for(;d<h;){const _=this._data[3*d+0],y=2097151&_;u+=2097152&_?this._combined[d]:y?(0,p.stringFromCodePoint)(y):o.WHITESPACE_CELL_CHAR,d+=_>>22||1}return u}}r.BufferLine=S},4841:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(i,c){if(i.start.y>i.end.y)throw new Error(`Buffer range end (${i.end.x}, ${i.end.y}) cannot be before start (${i.start.x}, ${i.start.y})`);return c*(i.end.y-i.start.y)+(i.end.x-i.start.x+1)}},4634:(C,r)=>{function i(c,f,o){if(f===c.length-1)return c[f].getTrimmedLength();const p=!c[f].hasContent(o-1)&&c[f].getWidth(o-1)===1,x=c[f+1].getWidth(0)===2;return p&&x?o-1:o}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(c,f,o,p,x){const S=[];for(let g=0;g<c.length-1;g++){let n=g,d=c.get(++n);if(!d.isWrapped)continue;const h=[c.get(g)];for(;n<c.length&&d.isWrapped;)h.push(d),d=c.get(++n);if(p>=g&&p<n){g+=h.length-1;continue}let u=0,_=i(h,u,f),y=1,w=0;for(;y<h.length;){const b=i(h,y,f),R=b-w,j=o-_,M=Math.min(R,j);h[u].copyCellsFrom(h[y],w,_,M,!1),_+=M,_===o&&(u++,_=0),w+=M,w===b&&(y++,w=0),_===0&&u!==0&&h[u-1].getWidth(o-1)===2&&(h[u].copyCellsFrom(h[u-1],o-1,_++,1,!1),h[u-1].setCell(o-1,x))}h[u].replaceCells(_,o,x);let E=0;for(let b=h.length-1;b>0&&(b>u||h[b].getTrimmedLength()===0);b--)E++;E>0&&(S.push(g+h.length-E),S.push(E)),g+=h.length-1}return S},r.reflowLargerCreateNewLayout=function(c,f){const o=[];let p=0,x=f[p],S=0;for(let g=0;g<c.length;g++)if(x===g){const n=f[++p];c.onDeleteEmitter.fire({index:g-S,amount:n}),g+=n-1,S+=n,x=f[++p]}else o.push(g);return{layout:o,countRemoved:S}},r.reflowLargerApplyNewLayout=function(c,f){const o=[];for(let p=0;p<f.length;p++)o.push(c.get(f[p]));for(let p=0;p<o.length;p++)c.set(p,o[p]);c.length=f.length},r.reflowSmallerGetNewLineLengths=function(c,f,o){const p=[],x=c.map(((d,h)=>i(c,h,f))).reduce(((d,h)=>d+h));let S=0,g=0,n=0;for(;n<x;){if(x-n<o){p.push(x-n);break}S+=o;const d=i(c,g,f);S>d&&(S-=d,g++);const h=c[g].getWidth(S-1)===2;h&&S--;const u=h?o-1:o;p.push(u),n+=u}return p},r.getWrappedLineTrimmedLength=i},5295:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const c=i(8460),f=i(844),o=i(9092);class p extends f.Disposable{constructor(S,g){super(),this._optionsService=S,this._bufferService=g,this._onBufferActivate=this.register(new c.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 o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,g){this._normal.resize(S,g),this._alt.resize(S,g),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}r.BufferSet=p},511:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const c=i(482),f=i(643),o=i(3734);class p extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(S){const g=new p;return g.setFromCharData(S),g}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(S){this.fg=S[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(S[f.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(S[f.CHAR_DATA_CHAR_INDEX].length===2){const n=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){const d=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(n-55296)+d-56320+65536|S[f.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[f.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=S[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=p},643:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const c=i(8460),f=i(844);class o{get id(){return this._id}constructor(x){this.line=x,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(x){return this._disposables.push(x),x}}r.Marker=o,o._nextId=1},7116:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.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:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(C,r)=>{var i,c,f;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=`
|
|
18
18
|
`,o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="\x1B",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL=""})(i||(r.C0=i={})),(function(o){o.PAD="",o.HOP="",o.BPH="",o.NBH="",o.IND="",o.NEL="
",o.SSA="",o.ESA="",o.HTS="",o.HTJ="",o.VTS="",o.PLD="",o.PLU="",o.RI="",o.SS2="",o.SS3="",o.DCS="",o.PU1="",o.PU2="",o.STS="",o.CCH="",o.MW="",o.SPA="",o.EPA="",o.SOS="",o.SGCI="",o.SCI="",o.CSI="",o.ST="",o.OSC="",o.PM="",o.APC=""})(c||(r.C1=c={})),(function(o){o.ST=`${i.ESC}\\`})(f||(r.C1_ESCAPED=f={}))},7399:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const c=i(2584),f={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:["'",'"']};r.evaluateKeyboardEvent=function(o,p,x,S){const g={type:0,cancel:!1,key:void 0},n=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?g.key=p?c.C0.ESC+"OA":c.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?g.key=p?c.C0.ESC+"OD":c.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?g.key=p?c.C0.ESC+"OC":c.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(g.key=p?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:if(o.altKey){g.key=c.C0.ESC+c.C0.DEL;break}g.key=c.C0.DEL;break;case 9:if(o.shiftKey){g.key=c.C0.ESC+"[Z";break}g.key=c.C0.HT,g.cancel=!0;break;case 13:g.key=o.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,g.cancel=!0;break;case 27:g.key=c.C0.ESC,o.altKey&&(g.key=c.C0.ESC+c.C0.ESC),g.cancel=!0;break;case 37:if(o.metaKey)break;n?(g.key=c.C0.ESC+"[1;"+(n+1)+"D",g.key===c.C0.ESC+"[1;3D"&&(g.key=c.C0.ESC+(x?"b":"[1;5D"))):g.key=p?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(o.metaKey)break;n?(g.key=c.C0.ESC+"[1;"+(n+1)+"C",g.key===c.C0.ESC+"[1;3C"&&(g.key=c.C0.ESC+(x?"f":"[1;5C"))):g.key=p?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(o.metaKey)break;n?(g.key=c.C0.ESC+"[1;"+(n+1)+"A",x||g.key!==c.C0.ESC+"[1;3A"||(g.key=c.C0.ESC+"[1;5A")):g.key=p?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(o.metaKey)break;n?(g.key=c.C0.ESC+"[1;"+(n+1)+"B",x||g.key!==c.C0.ESC+"[1;3B"||(g.key=c.C0.ESC+"[1;5B")):g.key=p?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(g.key=c.C0.ESC+"[2~");break;case 46:g.key=n?c.C0.ESC+"[3;"+(n+1)+"~":c.C0.ESC+"[3~";break;case 36:g.key=n?c.C0.ESC+"[1;"+(n+1)+"H":p?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:g.key=n?c.C0.ESC+"[1;"+(n+1)+"F":p?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:o.shiftKey?g.type=2:o.ctrlKey?g.key=c.C0.ESC+"[5;"+(n+1)+"~":g.key=c.C0.ESC+"[5~";break;case 34:o.shiftKey?g.type=3:o.ctrlKey?g.key=c.C0.ESC+"[6;"+(n+1)+"~":g.key=c.C0.ESC+"[6~";break;case 112:g.key=n?c.C0.ESC+"[1;"+(n+1)+"P":c.C0.ESC+"OP";break;case 113:g.key=n?c.C0.ESC+"[1;"+(n+1)+"Q":c.C0.ESC+"OQ";break;case 114:g.key=n?c.C0.ESC+"[1;"+(n+1)+"R":c.C0.ESC+"OR";break;case 115:g.key=n?c.C0.ESC+"[1;"+(n+1)+"S":c.C0.ESC+"OS";break;case 116:g.key=n?c.C0.ESC+"[15;"+(n+1)+"~":c.C0.ESC+"[15~";break;case 117:g.key=n?c.C0.ESC+"[17;"+(n+1)+"~":c.C0.ESC+"[17~";break;case 118:g.key=n?c.C0.ESC+"[18;"+(n+1)+"~":c.C0.ESC+"[18~";break;case 119:g.key=n?c.C0.ESC+"[19;"+(n+1)+"~":c.C0.ESC+"[19~";break;case 120:g.key=n?c.C0.ESC+"[20;"+(n+1)+"~":c.C0.ESC+"[20~";break;case 121:g.key=n?c.C0.ESC+"[21;"+(n+1)+"~":c.C0.ESC+"[21~";break;case 122:g.key=n?c.C0.ESC+"[23;"+(n+1)+"~":c.C0.ESC+"[23~";break;case 123:g.key=n?c.C0.ESC+"[24;"+(n+1)+"~":c.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(x&&!S||!o.altKey||o.metaKey)!x||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?g.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(g.key=c.C0.US),o.key==="@"&&(g.key=c.C0.NUL)):o.keyCode===65&&(g.type=1);else{const d=f[o.keyCode],h=d?.[o.shiftKey?1:0];if(h)g.key=c.C0.ESC+h;else if(o.keyCode>=65&&o.keyCode<=90){const u=o.ctrlKey?o.keyCode-64:o.keyCode+32;let _=String.fromCharCode(u);o.shiftKey&&(_=_.toUpperCase()),g.key=c.C0.ESC+_}else if(o.keyCode===32)g.key=c.C0.ESC+(o.ctrlKey?c.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let u=o.code.slice(3,4);o.shiftKey||(u=u.toLowerCase()),g.key=c.C0.ESC+u,g.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?g.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?g.key=c.C0.NUL:o.keyCode>=51&&o.keyCode<=55?g.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?g.key=c.C0.DEL:o.keyCode===219?g.key=c.C0.ESC:o.keyCode===220?g.key=c.C0.FS:o.keyCode===221&&(g.key=c.C0.GS)}return g}},482:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(i){return i>65535?(i-=65536,String.fromCharCode(55296+(i>>10))+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)},r.utf32ToString=function(i,c=0,f=i.length){let o="";for(let p=c;p<f;++p){let x=i[p];x>65535?(x-=65536,o+=String.fromCharCode(55296+(x>>10))+String.fromCharCode(x%1024+56320)):o+=String.fromCharCode(x)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(i,c){const f=i.length;if(!f)return 0;let o=0,p=0;if(this._interim){const x=i.charCodeAt(p++);56320<=x&&x<=57343?c[o++]=1024*(this._interim-55296)+x-56320+65536:(c[o++]=this._interim,c[o++]=x),this._interim=0}for(let x=p;x<f;++x){const S=i.charCodeAt(x);if(55296<=S&&S<=56319){if(++x>=f)return this._interim=S,o;const g=i.charCodeAt(x);56320<=g&&g<=57343?c[o++]=1024*(S-55296)+g-56320+65536:(c[o++]=S,c[o++]=g)}else S!==65279&&(c[o++]=S)}return o}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(i,c){const f=i.length;if(!f)return 0;let o,p,x,S,g=0,n=0,d=0;if(this.interim[0]){let _=!1,y=this.interim[0];y&=(224&y)==192?31:(240&y)==224?15:7;let w,E=0;for(;(w=63&this.interim[++E])&&E<4;)y<<=6,y|=w;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=b-E;for(;d<R;){if(d>=f)return 0;if(w=i[d++],(192&w)!=128){d--,_=!0;break}this.interim[E++]=w,y<<=6,y|=63&w}_||(b===2?y<128?d--:c[g++]=y:b===3?y<2048||y>=55296&&y<=57343||y===65279||(c[g++]=y):y<65536||y>1114111||(c[g++]=y)),this.interim.fill(0)}const h=f-4;let u=d;for(;u<f;){for(;!(!(u<h)||128&(o=i[u])||128&(p=i[u+1])||128&(x=i[u+2])||128&(S=i[u+3]));)c[g++]=o,c[g++]=p,c[g++]=x,c[g++]=S,u+=4;if(o=i[u++],o<128)c[g++]=o;else if((224&o)==192){if(u>=f)return this.interim[0]=o,g;if(p=i[u++],(192&p)!=128){u--;continue}if(n=(31&o)<<6|63&p,n<128){u--;continue}c[g++]=n}else if((240&o)==224){if(u>=f)return this.interim[0]=o,g;if(p=i[u++],(192&p)!=128){u--;continue}if(u>=f)return this.interim[0]=o,this.interim[1]=p,g;if(x=i[u++],(192&x)!=128){u--;continue}if(n=(15&o)<<12|(63&p)<<6|63&x,n<2048||n>=55296&&n<=57343||n===65279)continue;c[g++]=n}else if((248&o)==240){if(u>=f)return this.interim[0]=o,g;if(p=i[u++],(192&p)!=128){u--;continue}if(u>=f)return this.interim[0]=o,this.interim[1]=p,g;if(x=i[u++],(192&x)!=128){u--;continue}if(u>=f)return this.interim[0]=o,this.interim[1]=p,this.interim[2]=x,g;if(S=i[u++],(192&S)!=128){u--;continue}if(n=(7&o)<<18|(63&p)<<12|(63&x)<<6|63&S,n<65536||n>1114111)continue;c[g++]=n}}return g}}},225:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const 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]],c=[[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]];let f;r.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let o=0;o<i.length;++o)f.fill(0,i[o][0],i[o][1]+1)}}wcwidth(o){return o<32?0:o<127?1:o<65536?f[o]:(function(p,x){let S,g=0,n=x.length-1;if(p<x[0][0]||p>x[n][1])return!1;for(;n>=g;)if(S=g+n>>1,p>x[S][1])g=S+1;else{if(!(p<x[S][0]))return!0;n=S-1}return!1})(o,c)?0:o>=131072&&o<=196605||o>=196608&&o<=262141?2:1}}},5981:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const c=i(8460),f=i(844);class o extends f.Disposable{constructor(x){super(),this._action=x,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(x,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=x.length,this._writeBuffer.push(x),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let g;for(this._isSyncWriting=!0;g=this._writeBuffer.shift();){this._action(g);const n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(x,S){if(this._pendingData>5e7)throw new 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+=x.length,this._writeBuffer.push(x),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=x.length,this._writeBuffer.push(x),this._callbacks.push(S)}_innerWrite(x=0,S=!0){const g=x||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const n=this._writeBuffer[this._bufferOffset],d=this._action(n,S);if(d){const u=_=>Date.now()-g>=12?setTimeout((()=>this._innerWrite(0,_))):this._innerWrite(g,_);return void d.catch((_=>(queueMicrotask((()=>{throw _})),Promise.resolve(!1)))).then(u)}const h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=n.length,Date.now()-g>=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()}}r.WriteBuffer=o},5941:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const i=/^([\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})$/,c=/^[\da-f]+$/;function f(o,p){const x=o.toString(16),S=x.length<2?"0"+x:x;switch(p){case 4:return x[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}r.parseColor=function(o){if(!o)return;let p=o.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const x=i.exec(p);if(x){const S=x[1]?15:x[4]?255:x[7]?4095:65535;return[Math.round(parseInt(x[1]||x[4]||x[7]||x[10],16)/S*255),Math.round(parseInt(x[2]||x[5]||x[8]||x[11],16)/S*255),Math.round(parseInt(x[3]||x[6]||x[9]||x[12],16)/S*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),c.exec(p)&&[3,6,9,12].includes(p.length))){const x=p.length/3,S=[0,0,0];for(let g=0;g<3;++g){const n=parseInt(p.slice(x*g,x*g+x),16);S[g]=x===1?n<<4:x===2?n:x===3?n>>4:n>>8}return S}},r.toRgbString=function(o,p=16){const[x,S,g]=o;return`rgb:${f(x,p)}/${f(S,p)}/${f(g,p)}`}},5770:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const c=i(482),f=i(8742),o=i(5770),p=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(S,g){this._handlers[S]===void 0&&(this._handlers[S]=[]);const n=this._handlers[S];return n.push(g),{dispose:()=>{const d=n.indexOf(g);d!==-1&&n.splice(d,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(S,g){if(this.reset(),this._ident=S,this._active=this._handlers[S]||p,this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(g);else this._handlerFb(this._ident,"HOOK",g)}put(S,g,n){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(S,g,n);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(S,g,n))}unhook(S,g=!0){if(this._active.length){let n=!1,d=this._active.length-1,h=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,n=g,h=this._stack.fallThrough,this._stack.paused=!1),!h&&n===!1){for(;d>=0&&(n=this._active[d].unhook(S),n!==!0);d--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,n;d--}for(;d>=0;d--)if(n=this._active[d].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,"UNHOOK",S);this._active=p,this._ident=0}};const x=new f.Params;x.addParam(0),r.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=x,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():x,this._data="",this._hitLimit=!1}put(S,g,n){this._hitLimit||(this._data+=(0,c.utf32ToString)(S,g,n),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let g=!1;if(this._hitLimit)g=!1;else if(S&&(g=this._handler(this._data,this._params),g instanceof Promise))return g.then((n=>(this._params=x,this._data="",this._hitLimit=!1,n)));return this._params=x,this._data="",this._hitLimit=!1,g}}},2015:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const c=i(844),f=i(8742),o=i(6242),p=i(6351);class x{constructor(d){this.table=new Uint8Array(d)}setDefault(d,h){this.table.fill(d<<4|h)}add(d,h,u,_){this.table[h<<8|d]=u<<4|_}addMany(d,h,u,_){for(let y=0;y<d.length;y++)this.table[h<<8|d[y]]=u<<4|_}}r.TransitionTable=x;const S=160;r.VT500_TRANSITION_TABLE=(function(){const n=new x(4095),d=Array.apply(null,Array(256)).map(((E,b)=>b)),h=(E,b)=>d.slice(E,b),u=h(32,127),_=h(0,24);_.push(25),_.push.apply(_,h(28,32));const y=h(0,14);let w;for(w in n.setDefault(1,0),n.addMany(u,0,2,0),y)n.addMany([24,26,153,154],w,3,0),n.addMany(h(128,144),w,3,0),n.addMany(h(144,152),w,3,0),n.add(156,w,0,0),n.add(27,w,11,1),n.add(157,w,4,8),n.addMany([152,158,159],w,0,7),n.add(155,w,11,3),n.add(144,w,11,9);return n.addMany(_,0,3,0),n.addMany(_,1,3,1),n.add(127,1,0,1),n.addMany(_,8,0,8),n.addMany(_,3,3,3),n.add(127,3,0,3),n.addMany(_,4,3,4),n.add(127,4,0,4),n.addMany(_,6,3,6),n.addMany(_,5,3,5),n.add(127,5,0,5),n.addMany(_,2,3,2),n.add(127,2,0,2),n.add(93,1,4,8),n.addMany(u,8,5,8),n.add(127,8,5,8),n.addMany([156,27,24,26,7],8,6,0),n.addMany(h(28,32),8,0,8),n.addMany([88,94,95],1,0,7),n.addMany(u,7,0,7),n.addMany(_,7,0,7),n.add(156,7,0,0),n.add(127,7,0,7),n.add(91,1,11,3),n.addMany(h(64,127),3,7,0),n.addMany(h(48,60),3,8,4),n.addMany([60,61,62,63],3,9,4),n.addMany(h(48,60),4,8,4),n.addMany(h(64,127),4,7,0),n.addMany([60,61,62,63],4,0,6),n.addMany(h(32,64),6,0,6),n.add(127,6,0,6),n.addMany(h(64,127),6,0,0),n.addMany(h(32,48),3,9,5),n.addMany(h(32,48),5,9,5),n.addMany(h(48,64),5,0,6),n.addMany(h(64,127),5,7,0),n.addMany(h(32,48),4,9,5),n.addMany(h(32,48),1,9,2),n.addMany(h(32,48),2,9,2),n.addMany(h(48,127),2,10,0),n.addMany(h(48,80),1,10,0),n.addMany(h(81,88),1,10,0),n.addMany([89,90,92],1,10,0),n.addMany(h(96,127),1,10,0),n.add(80,1,11,9),n.addMany(_,9,0,9),n.add(127,9,0,9),n.addMany(h(28,32),9,0,9),n.addMany(h(32,48),9,9,12),n.addMany(h(48,60),9,8,10),n.addMany([60,61,62,63],9,9,10),n.addMany(_,11,0,11),n.addMany(h(32,128),11,0,11),n.addMany(h(28,32),11,0,11),n.addMany(_,10,0,10),n.add(127,10,0,10),n.addMany(h(28,32),10,0,10),n.addMany(h(48,60),10,8,10),n.addMany([60,61,62,63],10,0,11),n.addMany(h(32,48),10,9,12),n.addMany(_,12,0,12),n.add(127,12,0,12),n.addMany(h(28,32),12,0,12),n.addMany(h(32,48),12,9,12),n.addMany(h(48,64),12,0,11),n.addMany(h(64,127),12,12,13),n.addMany(h(64,127),10,12,13),n.addMany(h(64,127),9,12,13),n.addMany(_,13,13,13),n.addMany(u,13,13,13),n.add(127,13,0,13),n.addMany([27,156,24,26],13,14,0),n.add(S,0,2,0),n.add(S,8,5,8),n.add(S,6,0,6),n.add(S,11,0,11),n.add(S,13,13,13),n})();class g extends c.Disposable{constructor(d=r.VT500_TRANSITION_TABLE){super(),this._transitions=d,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(h,u,_)=>{},this._executeHandlerFb=h=>{},this._csiHandlerFb=(h,u)=>{},this._escHandlerFb=h=>{},this._errorHandlerFb=h=>h,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(d,h=[64,126]){let u=0;if(d.prefix){if(d.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=d.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(d.intermediates){if(d.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let y=0;y<d.intermediates.length;++y){const w=d.intermediates.charCodeAt(y);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=w}}if(d.final.length!==1)throw new Error("final must be a single byte");const _=d.final.charCodeAt(0);if(h[0]>_||_>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return u<<=8,u|=_,u}identToString(d){const h=[];for(;d;)h.push(String.fromCharCode(255&d)),d>>=8;return h.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,h){const u=this._identifier(d,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);const _=this._escHandlers[u];return _.push(h),{dispose:()=>{const y=_.indexOf(h);y!==-1&&_.splice(y,1)}}}clearEscHandler(d){this._escHandlers[this._identifier(d,[48,126])]&&delete this._escHandlers[this._identifier(d,[48,126])]}setEscHandlerFallback(d){this._escHandlerFb=d}setExecuteHandler(d,h){this._executeHandlers[d.charCodeAt(0)]=h}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,h){const u=this._identifier(d);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);const _=this._csiHandlers[u];return _.push(h),{dispose:()=>{const y=_.indexOf(h);y!==-1&&_.splice(y,1)}}}clearCsiHandler(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,h){return this._dcsParser.registerHandler(this._identifier(d),h)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,h){return this._oscParser.registerHandler(d,h)}clearOscHandler(d){this._oscParser.clearHandler(d)}setOscHandlerFallback(d){this._oscParser.setHandlerFallback(d)}setErrorHandler(d){this._errorHandler=d}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.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(d,h,u,_,y){this._parseStack.state=d,this._parseStack.handlers=h,this._parseStack.handlerPos=u,this._parseStack.transition=_,this._parseStack.chunkPos=y}parse(d,h,u){let _,y=0,w=0,E=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,E=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const b=this._parseStack.handlers;let R=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&R>-1){for(;R>=0&&(_=b[R](this._params),_!==!0);R--)if(_ instanceof Promise)return this._parseStack.handlerPos=R,_}this._parseStack.handlers=[];break;case 4:if(u===!1&&R>-1){for(;R>=0&&(_=b[R](),_!==!0);R--)if(_ instanceof Promise)return this._parseStack.handlerPos=R,_}this._parseStack.handlers=[];break;case 6:if(y=d[this._parseStack.chunkPos],_=this._dcsParser.unhook(y!==24&&y!==26,u),_)return _;y===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(y=d[this._parseStack.chunkPos],_=this._oscParser.end(y!==24&&y!==26,u),_)return _;y===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,E=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let b=E;b<h;++b){switch(y=d[b],w=this._transitions.table[this.currentState<<8|(y<160?y:S)],w>>4){case 2:for(let T=b+1;;++T){if(T>=h||(y=d[T])<32||y>126&&y<S){this._printHandler(d,b,T),b=T-1;break}if(++T>=h||(y=d[T])<32||y>126&&y<S){this._printHandler(d,b,T),b=T-1;break}if(++T>=h||(y=d[T])<32||y>126&&y<S){this._printHandler(d,b,T),b=T-1;break}if(++T>=h||(y=d[T])<32||y>126&&y<S){this._printHandler(d,b,T),b=T-1;break}}break;case 3:this._executeHandlers[y]?this._executeHandlers[y]():this._executeHandlerFb(y),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:b,code:y,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const R=this._csiHandlers[this._collect<<8|y];let j=R?R.length-1:-1;for(;j>=0&&(_=R[j](this._params),_!==!0);j--)if(_ instanceof Promise)return this._preserveStack(3,R,j,w,b),_;j<0&&this._csiHandlerFb(this._collect<<8|y,this._params),this.precedingCodepoint=0;break;case 8:do switch(y){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(y-48)}while(++b<h&&(y=d[b])>47&&y<60);b--;break;case 9:this._collect<<=8,this._collect|=y;break;case 10:const M=this._escHandlers[this._collect<<8|y];let L=M?M.length-1:-1;for(;L>=0&&(_=M[L](),_!==!0);L--)if(_ instanceof Promise)return this._preserveStack(4,M,L,w,b),_;L<0&&this._escHandlerFb(this._collect<<8|y),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|y,this._params);break;case 13:for(let T=b+1;;++T)if(T>=h||(y=d[T])===24||y===26||y===27||y>127&&y<S){this._dcsParser.put(d,b,T),b=T-1;break}break;case 14:if(_=this._dcsParser.unhook(y!==24&&y!==26),_)return this._preserveStack(6,[],0,w,b),_;y===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let T=b+1;;T++)if(T>=h||(y=d[T])<32||y>127&&y<S){this._oscParser.put(d,b,T),b=T-1;break}break;case 6:if(_=this._oscParser.end(y!==24&&y!==26),_)return this._preserveStack(5,[],0,w,b),_;y===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&w}}}r.EscapeSequenceParser=g},6242:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const c=i(5770),f=i(482),o=[];r.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,x){this._handlers[p]===void 0&&(this._handlers[p]=[]);const S=this._handlers[p];return S.push(x),{dispose:()=>{const g=S.indexOf(x);g!==-1&&S.splice(g,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,x,S){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(p,x,S);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(p,x,S))}start(){this.reset(),this._state=1}put(p,x,S){if(this._state!==3){if(this._state===1)for(;x<S;){const g=p[x++];if(g===59){this._state=2,this._start();break}if(g<48||57<g)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+g-48}this._state===2&&S-x>0&&this._put(p,x,S)}}end(p,x=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,g=this._active.length-1,n=!1;if(this._stack.paused&&(g=this._stack.loopPosition-1,S=x,n=this._stack.fallThrough,this._stack.paused=!1),!n&&S===!1){for(;g>=0&&(S=this._active[g].end(p),S!==!0);g--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!1,S;g--}for(;g>=0;g--)if(S=this._active[g].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",p);this._active=o,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,x,S){this._hitLimit||(this._data+=(0,f.utf32ToString)(p,x,S),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let x=!1;if(this._hitLimit)x=!1;else if(p&&(x=this._handler(this._data),x instanceof Promise))return x.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,x}}},8742:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const i=2147483647;class c{static fromArray(o){const p=new c;if(!o.length)return p;for(let x=Array.isArray(o[0])?1:0;x<o.length;++x){const S=o[x];if(Array.isArray(S))for(let g=0;g<S.length;++g)p.addSubParam(S[g]);else p.addParam(S)}return p}constructor(o=32,p=32){if(this.maxLength=o,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const o=new c(this.maxLength,this.maxSubParamsLength);return o.params.set(this.params),o.length=this.length,o._subParams.set(this._subParams),o._subParamsLength=this._subParamsLength,o._subParamsIdx.set(this._subParamsIdx),o._rejectDigits=this._rejectDigits,o._rejectSubDigits=this._rejectSubDigits,o._digitIsSub=this._digitIsSub,o}toArray(){const o=[];for(let p=0;p<this.length;++p){o.push(this.params[p]);const x=this._subParamsIdx[p]>>8,S=255&this._subParamsIdx[p];S-x>0&&o.push(Array.prototype.slice.call(this._subParams,x,S))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>i?i:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>i?i:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){const p=this._subParamsIdx[o]>>8,x=255&this._subParamsIdx[o];return x-p>0?this._subParams.subarray(p,x):null}getSubParamsAll(){const o={};for(let p=0;p<this.length;++p){const x=this._subParamsIdx[p]>>8,S=255&this._subParamsIdx[p];S-x>0&&(o[p]=this._subParams.slice(x,S))}return o}addDigit(o){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const x=this._digitIsSub?this._subParams:this.params,S=x[p-1];x[p-1]=~S?Math.min(10*S+o,i):o}}r.Params=c},5741:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let i=this._addons.length-1;i>=0;i--)this._addons[i].instance.dispose()}loadAddon(i,c){const f={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(f),c.dispose=()=>this._wrappedAddonDispose(f),c.activate(i)}_wrappedAddonDispose(i){if(i.isDisposed)return;let c=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===i){c=f;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");i.isDisposed=!0,i.dispose.apply(i.instance),this._addons.splice(c,1)}}},8771:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const c=i(3785),f=i(511);r.BufferApiView=class{constructor(o,p){this._buffer=o,this.type=p}init(o){return this._buffer=o,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(o){const p=this._buffer.lines.get(o);if(p)return new c.BufferLineApiView(p)}getNullCell(){return new f.CellData}}},3785:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const c=i(511);r.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,o){if(!(f<0||f>=this._line.length))return o?(this._line.loadCell(f,o),o):this._line.loadCell(f,new c.CellData)}translateToString(f,o,p){return this._line.translateToString(f,o,p)}}},8285:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const c=i(8771),f=i(8460),o=i(844);class p extends o.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.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 new 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)}}r.BufferNamespaceApi=p},7975:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(i){this._core=i}registerCsiHandler(i,c){return this._core.registerCsiHandler(i,(f=>c(f.toArray())))}addCsiHandler(i,c){return this.registerCsiHandler(i,c)}registerDcsHandler(i,c){return this._core.registerDcsHandler(i,((f,o)=>c(f,o.toArray())))}addDcsHandler(i,c){return this.registerDcsHandler(i,c)}registerEscHandler(i,c){return this._core.registerEscHandler(i,c)}addEscHandler(i,c){return this.registerEscHandler(i,c)}registerOscHandler(i,c){return this._core.registerOscHandler(i,c)}addOscHandler(i,c){return this.registerOscHandler(i,c)}}},7090:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(i){this._core=i}register(i){this._core.unicodeService.register(i)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(i){this._core.unicodeService.activeVersion=i}}},744:function(C,r,i){var c=this&&this.__decorate||function(n,d,h,u){var _,y=arguments.length,w=y<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,h,u);else for(var E=n.length-1;E>=0;E--)(_=n[E])&&(w=(y<3?_(w):y>3?_(d,h,w):_(d,h))||w);return y>3&&w&&Object.defineProperty(d,h,w),w},f=this&&this.__param||function(n,d){return function(h,u){d(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const o=i(8460),p=i(844),x=i(5295),S=i(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let g=r.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(n){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(n.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(n.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new x.BufferSet(n,this))}resize(n,d){this.cols=n,this.rows=d,this.buffers.resize(n,d),this._onResize.fire({cols:n,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(n,d=!1){const h=this.buffer;let u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===n.fg&&u.getBg(0)===n.bg||(u=h.getBlankLine(n,d),this._cachedBlankLine=u),u.isWrapped=d;const _=h.ybase+h.scrollTop,y=h.ybase+h.scrollBottom;if(h.scrollTop===0){const w=h.lines.isFull;y===h.lines.length-1?w?h.lines.recycle().copyFrom(u):h.lines.push(u.clone()):h.lines.splice(y+1,0,u.clone()),w?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{const w=y-_+1;h.lines.shiftElements(_+1,w-1,-1),h.lines.set(y,u.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(n,d,h){const u=this.buffer;if(n<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else n+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);const _=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+n,u.ybase),0),_!==u.ydisp&&(d||this._onScroll.fire(u.ydisp))}};r.BufferService=g=c([f(0,S.IOptionsService)],g)},7994:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(i){this.glevel=i,this.charset=this._charsets[i]}setgCharset(i,c){this._charsets[i]=c,this.glevel===i&&(this.charset=c)}}},1753:function(C,r,i){var c=this&&this.__decorate||function(u,_,y,w){var E,b=arguments.length,R=b<3?_:w===null?w=Object.getOwnPropertyDescriptor(_,y):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(u,_,y,w);else for(var j=u.length-1;j>=0;j--)(E=u[j])&&(R=(b<3?E(R):b>3?E(_,y,R):E(_,y))||R);return b>3&&R&&Object.defineProperty(_,y,R),R},f=this&&this.__param||function(u,_){return function(y,w){_(y,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const o=i(2585),p=i(8460),x=i(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function g(u,_){let y=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(y|=64,y|=u.action):(y|=3&u.button,4&u.button&&(y|=64),8&u.button&&(y|=128),u.action===32?y|=32:u.action!==0||_||(y|=3)),y}const n=String.fromCharCode,d={DEFAULT:u=>{const _=[g(u,!1)+32,u.col+32,u.row+32];return _[0]>255||_[1]>255||_[2]>255?"":`\x1B[M${n(_[0])}${n(_[1])}${n(_[2])}`},SGR:u=>{const _=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${g(u,!0)};${u.col};${u.row}${_}`},SGR_PIXELS:u=>{const _=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${g(u,!0)};${u.x};${u.y}${_}`}};let h=r.CoreMouseService=class extends x.Disposable{constructor(u,_){super(),this._bufferService=u,this._coreService=_,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const y of Object.keys(S))this.addProtocol(y,S[y]);for(const y of Object.keys(d))this.addEncoding(y,d[y]);this.reset()}addProtocol(u,_){this._protocols[u]=_}addEncoding(u,_){this._encodings[u]=_}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(u){if(!this._protocols[u])throw new Error(`unknown protocol "${u}"`);this._activeProtocol=u,this._onProtocolChange.fire(this._protocols[u].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(u){if(!this._encodings[u])throw new Error(`unknown encoding "${u}"`);this._activeEncoding=u}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(u){if(u.col<0||u.col>=this._bufferService.cols||u.row<0||u.row>=this._bufferService.rows||u.button===4&&u.action===32||u.button===3&&u.action!==32||u.button!==4&&(u.action===2||u.action===3)||(u.col++,u.row++,u.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,u,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(u))return!1;const _=this._encodings[this._activeEncoding](u);return _&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(_):this._coreService.triggerDataEvent(_,!0)),this._lastEvent=u,!0}explainEvents(u){return{down:!!(1&u),up:!!(2&u),drag:!!(4&u),move:!!(8&u),wheel:!!(16&u)}}_equalEvents(u,_,y){if(y){if(u.x!==_.x||u.y!==_.y)return!1}else if(u.col!==_.col||u.row!==_.row)return!1;return u.button===_.button&&u.action===_.action&&u.ctrl===_.ctrl&&u.alt===_.alt&&u.shift===_.shift}};r.CoreMouseService=h=c([f(0,o.IBufferService),f(1,o.ICoreService)],h)},6975:function(C,r,i){var c=this&&this.__decorate||function(h,u,_,y){var w,E=arguments.length,b=E<3?u:y===null?y=Object.getOwnPropertyDescriptor(u,_):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(h,u,_,y);else for(var R=h.length-1;R>=0;R--)(w=h[R])&&(b=(E<3?w(b):E>3?w(u,_,b):w(u,_))||b);return E>3&&b&&Object.defineProperty(u,_,b),b},f=this&&this.__param||function(h,u){return function(_,y){u(_,y,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const o=i(1439),p=i(8460),x=i(844),S=i(2585),g=Object.freeze({insertMode:!1}),n=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=r.CoreService=class extends x.Disposable{constructor(h,u,_){super(),this._bufferService=h,this._logService=u,this._optionsService=_,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(g),this.decPrivateModes=(0,o.clone)(n)}reset(){this.modes=(0,o.clone)(g),this.decPrivateModes=(0,o.clone)(n)}triggerDataEvent(h,u=!1){if(this._optionsService.rawOptions.disableStdin)return;const _=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&_.ybase!==_.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${h}"`,(()=>h.split("").map((y=>y.charCodeAt(0))))),this._onData.fire(h)}triggerBinaryEvent(h){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${h}"`,(()=>h.split("").map((u=>u.charCodeAt(0))))),this._onBinary.fire(h))}};r.CoreService=d=c([f(0,S.IBufferService),f(1,S.ILogService),f(2,S.IOptionsService)],d)},9074:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const c=i(8055),f=i(8460),o=i(844),p=i(6106);let x=0,S=0;class g extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList((h=>h?.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)((()=>this.reset())))}registerDecoration(h){if(h.marker.isDisposed)return;const u=new n(h);if(u){const _=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),_.dispose())})),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(const h of this._decorations.values())h.dispose();this._decorations.clear()}*getDecorationsAtCell(h,u,_){var y,w,E;let b=0,R=0;for(const j of this._decorations.getKeyIterator(u))b=(y=j.options.x)!==null&&y!==void 0?y:0,R=b+((w=j.options.width)!==null&&w!==void 0?w:1),h>=b&&h<R&&(!_||((E=j.options.layer)!==null&&E!==void 0?E:"bottom")===_)&&(yield j)}forEachDecorationAtCell(h,u,_,y){this._decorations.forEachByKey(u,(w=>{var E,b,R;x=(E=w.options.x)!==null&&E!==void 0?E:0,S=x+((b=w.options.width)!==null&&b!==void 0?b:1),h>=x&&h<S&&(!_||((R=w.options.layer)!==null&&R!==void 0?R:"bottom")===_)&&y(w)}))}}r.DecorationService=g;class n extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(h){super(),this.options=h,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=h.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const c=i(2585),f=i(8343);class o{constructor(...x){this._entries=new Map;for(const[S,g]of x)this.set(S,g)}set(x,S){const g=this._entries.get(x);return this._entries.set(x,S),g}forEach(x){for(const[S,g]of this._entries.entries())x(S,g)}has(x){return this._entries.has(x)}get(x){return this._entries.get(x)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(c.IInstantiationService,this)}setService(p,x){this._services.set(p,x)}getService(p){return this._services.get(p)}createInstance(p,...x){const S=(0,f.getServiceDependencies)(p).sort(((d,h)=>d.index-h.index)),g=[];for(const d of S){const h=this._services.get(d.id);if(!h)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${d.id}.`);g.push(h)}const n=S.length>0?S[0].index:x.length;if(x.length!==n)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${n+1} conflicts with ${x.length} static arguments`);return new p(...x,...g)}}},7866:function(C,r,i){var c=this&&this.__decorate||function(n,d,h,u){var _,y=arguments.length,w=y<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,h,u);else for(var E=n.length-1;E>=0;E--)(_=n[E])&&(w=(y<3?_(w):y>3?_(d,h,w):_(d,h))||w);return y>3&&w&&Object.defineProperty(d,h,w),w},f=this&&this.__param||function(n,d){return function(h,u){d(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const o=i(844),p=i(2585),x={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let S,g=r.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(n){super(),this._optionsService=n,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),S=this}_updateLogLevel(){this._logLevel=x[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(n){for(let d=0;d<n.length;d++)typeof n[d]=="function"&&(n[d]=n[d]())}_log(n,d,h){this._evalLazyOptionalParams(h),n.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...h)}trace(n,...d){var h,u;this._logLevel<=p.LogLevelEnum.TRACE&&this._log((u=(h=this._optionsService.options.logger)===null||h===void 0?void 0:h.trace.bind(this._optionsService.options.logger))!==null&&u!==void 0?u:console.log,n,d)}debug(n,...d){var h,u;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log((u=(h=this._optionsService.options.logger)===null||h===void 0?void 0:h.debug.bind(this._optionsService.options.logger))!==null&&u!==void 0?u:console.log,n,d)}info(n,...d){var h,u;this._logLevel<=p.LogLevelEnum.INFO&&this._log((u=(h=this._optionsService.options.logger)===null||h===void 0?void 0:h.info.bind(this._optionsService.options.logger))!==null&&u!==void 0?u:console.info,n,d)}warn(n,...d){var h,u;this._logLevel<=p.LogLevelEnum.WARN&&this._log((u=(h=this._optionsService.options.logger)===null||h===void 0?void 0:h.warn.bind(this._optionsService.options.logger))!==null&&u!==void 0?u:console.warn,n,d)}error(n,...d){var h,u;this._logLevel<=p.LogLevelEnum.ERROR&&this._log((u=(h=this._optionsService.options.logger)===null||h===void 0?void 0:h.error.bind(this._optionsService.options.logger))!==null&&u!==void 0?u:console.error,n,d)}};r.LogService=g=c([f(0,p.IOptionsService)],g),r.setTraceLogger=function(n){S=n},r.traceCall=function(n,d,h){if(typeof h.value!="function")throw new Error("not supported");const u=h.value;h.value=function(..._){if(S.logLevel!==p.LogLevelEnum.TRACE)return u.apply(this,_);S.trace(`GlyphRenderer#${u.name}(${_.map((w=>JSON.stringify(w))).join(", ")})`);const y=u.apply(this,_);return S.trace(`GlyphRenderer#${u.name} return`,y),y}}},7302:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const c=i(8460),f=i(844),o=i(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,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:{},rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class x extends f.Disposable{constructor(g){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const n=Object.assign({},r.DEFAULT_OPTIONS);for(const d in g)if(d in n)try{const h=g[d];n[d]=this._sanitizeAndValidateOption(d,h)}catch(h){console.error(h)}this.rawOptions=n,this.options=Object.assign({},n),this._setupOptions()}onSpecificOptionChange(g,n){return this.onOptionChange((d=>{d===g&&n(this.rawOptions[g])}))}onMultipleOptionChange(g,n){return this.onOptionChange((d=>{g.indexOf(d)!==-1&&n()}))}_setupOptions(){const g=d=>{if(!(d in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},n=(d,h)=>{if(!(d in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);h=this._sanitizeAndValidateOption(d,h),this.rawOptions[d]!==h&&(this.rawOptions[d]=h,this._onOptionChange.fire(d))};for(const d in this.rawOptions){const h={get:g.bind(this,d),set:n.bind(this,d)};Object.defineProperty(this.options,d,h)}}_sanitizeAndValidateOption(g,n){switch(g){case"cursorStyle":if(n||(n=r.DEFAULT_OPTIONS[g]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(n))throw new Error(`"${n}" is not a valid value for ${g}`);break;case"wordSeparator":n||(n=r.DEFAULT_OPTIONS[g]);break;case"fontWeight":case"fontWeightBold":if(typeof n=="number"&&1<=n&&n<=1e3)break;n=p.includes(n)?n:r.DEFAULT_OPTIONS[g];break;case"cursorWidth":n=Math.floor(n);case"lineHeight":case"tabStopWidth":if(n<1)throw new Error(`${g} 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 new Error(`${g} cannot be less than 0, value: ${n}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(n<=0)throw new Error(`${g} cannot be less than or equal to 0, value: ${n}`);break;case"rows":case"cols":if(!n&&n!==0)throw new Error(`${g} must be numeric, value: ${n}`);break;case"windowsPty":n=n??{}}return n}}r.OptionsService=x},2660:function(C,r,i){var c=this&&this.__decorate||function(x,S,g,n){var d,h=arguments.length,u=h<3?S:n===null?n=Object.getOwnPropertyDescriptor(S,g):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(x,S,g,n);else for(var _=x.length-1;_>=0;_--)(d=x[_])&&(u=(h<3?d(u):h>3?d(S,g,u):d(S,g))||u);return h>3&&u&&Object.defineProperty(S,g,u),u},f=this&&this.__param||function(x,S){return function(g,n){S(g,n,x)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const o=i(2585);let p=r.OscLinkService=class{constructor(x){this._bufferService=x,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(x){const S=this._bufferService.buffer;if(x.id===void 0){const _=S.addMarker(S.ybase+S.y),y={data:x,id:this._nextId++,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(y,_))),this._dataByLinkId.set(y.id,y),y.id}const g=x,n=this._getEntryIdKey(g),d=this._entriesWithId.get(n);if(d)return this.addLineToLink(d.id,S.ybase+S.y),d.id;const h=S.addMarker(S.ybase+S.y),u={id:this._nextId++,key:this._getEntryIdKey(g),data:g,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(u,h))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(x,S){const g=this._dataByLinkId.get(x);if(g&&g.lines.every((n=>n.line!==S))){const n=this._bufferService.buffer.addMarker(S);g.lines.push(n),n.onDispose((()=>this._removeMarkerFromLink(g,n)))}}getLinkData(x){var S;return(S=this._dataByLinkId.get(x))===null||S===void 0?void 0:S.data}_getEntryIdKey(x){return`${x.id};;${x.uri}`}_removeMarkerFromLink(x,S){const g=x.lines.indexOf(S);g!==-1&&(x.lines.splice(g,1),x.lines.length===0&&(x.data.id!==void 0&&this._entriesWithId.delete(x.key),this._dataByLinkId.delete(x.id)))}};r.OscLinkService=p=c([f(0,o.IBufferService)],p)},8343:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const i="di$target",c="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(f){return f[c]||[]},r.createDecorator=function(f){if(r.serviceRegistry.has(f))return r.serviceRegistry.get(f);const o=function(p,x,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,n,d){n[i]===n?n[c].push({id:g,index:d}):(n[c]=[{id:g,index:d}],n[i]=n)})(o,p,S)};return o.toString=()=>f,r.serviceRegistry.set(f,o),o}},2585:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const c=i(8343);var f;r.IBufferService=(0,c.createDecorator)("BufferService"),r.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),r.ICoreService=(0,c.createDecorator)("CoreService"),r.ICharsetService=(0,c.createDecorator)("CharsetService"),r.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(o){o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF"})(f||(r.LogLevelEnum=f={})),r.ILogService=(0,c.createDecorator)("LogService"),r.IOptionsService=(0,c.createDecorator)("OptionsService"),r.IOscLinkService=(0,c.createDecorator)("OscLinkService"),r.IUnicodeService=(0,c.createDecorator)("UnicodeService"),r.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const c=i(8460),f=i(225);r.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;const o=new f.UnicodeV6;this.register(o),this._active=o.version,this._activeProvider=o}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(o){if(!this._providers[o])throw new Error(`unknown Unicode version "${o}"`);this._active=o,this._activeProvider=this._providers[o],this._onChange.fire(o)}register(o){this._providers[o.version]=o}wcwidth(o){return this._activeProvider.wcwidth(o)}getStringCellWidth(o){let p=0;const x=o.length;for(let S=0;S<x;++S){let g=o.charCodeAt(S);if(55296<=g&&g<=56319){if(++S>=x)return p+this.wcwidth(g);const n=o.charCodeAt(S);56320<=n&&n<=57343?g=1024*(g-55296)+n-56320+65536:p+=this.wcwidth(n)}p+=this.wcwidth(g)}return p}}}},l={};function m(C){var r=l[C];if(r!==void 0)return r.exports;var i=l[C]={exports:{}};return s[C].call(i.exports,i,i.exports,m),i.exports}var v={};return(()=>{var C=v;Object.defineProperty(C,"__esModule",{value:!0}),C.Terminal=void 0;const r=m(9042),i=m(3236),c=m(844),f=m(5741),o=m(8285),p=m(7975),x=m(7090),S=["cols","rows"];class g extends c.Disposable{constructor(d){super(),this._core=this.register(new i.Terminal(d)),this._addonManager=this.register(new f.AddonManager),this._publicOptions=Object.assign({},this._core.options);const h=_=>this._core.options[_],u=(_,y)=>{this._checkReadonlyOptions(_),this._core.options[_]=y};for(const _ in this._core.options){const y={get:h.bind(this,_),set:u.bind(this,_)};Object.defineProperty(this._publicOptions,_,y)}}_checkReadonlyOptions(d){if(S.includes(d))throw new Error(`Option "${d}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new 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||(this._parser=new p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new x.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._buffer=this.register(new o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const d=this._core.coreService.decPrivateModes;let h="none";switch(this._core.coreMouseService.activeProtocol){case"X10":h="x10";break;case"VT200":h="vt200";break;case"DRAG":h="drag";break;case"ANY":h="any"}return{applicationCursorKeysMode:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(const h in d)this._publicOptions[h]=d[h]}blur(){this._core.blur()}focus(){this._core.focus()}resize(d,h){this._verifyIntegers(d,h),this._core.resize(d,h)}open(d){this._core.open(d)}attachCustomKeyEventHandler(d){this._core.attachCustomKeyEventHandler(d)}registerLinkProvider(d){return this._core.registerLinkProvider(d)}registerCharacterJoiner(d){return this._checkProposedApi(),this._core.registerCharacterJoiner(d)}deregisterCharacterJoiner(d){this._checkProposedApi(),this._core.deregisterCharacterJoiner(d)}registerMarker(d=0){return this._verifyIntegers(d),this._core.registerMarker(d)}registerDecoration(d){var h,u,_;return this._checkProposedApi(),this._verifyPositiveIntegers((h=d.x)!==null&&h!==void 0?h:0,(u=d.width)!==null&&u!==void 0?u:0,(_=d.height)!==null&&_!==void 0?_:0),this._core.registerDecoration(d)}hasSelection(){return this._core.hasSelection()}select(d,h,u){this._verifyIntegers(d,h,u),this._core.select(d,h,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,h){this._verifyIntegers(d,h),this._core.selectLines(d,h)}dispose(){super.dispose()}scrollLines(d){this._verifyIntegers(d),this._core.scrollLines(d)}scrollPages(d){this._verifyIntegers(d),this._core.scrollPages(d)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(d){this._verifyIntegers(d),this._core.scrollToLine(d)}clear(){this._core.clear()}write(d,h){this._core.write(d,h)}writeln(d,h){this._core.write(d),this._core.write(`\r
|
|
19
|
-
`,h)}paste(d){this._core.paste(d)}refresh(d,h){this._verifyIntegers(d,h),this._core.refresh(d,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return r}_verifyIntegers(...d){for(const h of d)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...d){for(const h of d)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}C.Terminal=g})(),v})()))})(
|
|
19
|
+
`,h)}paste(d){this._core.paste(d)}refresh(d,h){this._verifyIntegers(d,h),this._core.refresh(d,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return r}_verifyIntegers(...d){for(const h of d)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...d){for(const h of d)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}C.Terminal=g})(),v})()))})(cr)),cr.exports}var mh=fh();var ph=2,vh=1,gh=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._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(s.getPropertyValue("height")),m=Math.max(0,parseInt(s.getPropertyValue("width"))),v=window.getComputedStyle(this._terminal.element),C={top:parseInt(v.getPropertyValue("padding-top")),bottom:parseInt(v.getPropertyValue("padding-bottom")),right:parseInt(v.getPropertyValue("padding-right")),left:parseInt(v.getPropertyValue("padding-left"))},r=C.top+C.bottom,i=C.right+C.left,c=l-r,f=m-i-t;return{cols:Math.max(ph,Math.floor(f/e.css.cell.width)),rows:Math.max(vh,Math.floor(c/e.css.cell.height))}}};function _h(e={}){const{cwd:t,cols:s,rows:l,onOutput:m,onExit:v}=e,[C,r]=k.useState(null),[i,c]=k.useState(()=>wt.isConnected()),[f,o]=k.useState(!1),[p,x]=k.useState(!1),[S,g]=k.useState(!1),n=k.useRef({onOutput:m,onExit:v});n.current={onOutput:m,onExit:v};const d=k.useRef(null);d.current=C,k.useEffect(()=>{if(!C)return;const w=wt.getSocket(),E=()=>{c(!0),o(!1),r(null),g(!0)},b=()=>{c(!1),o(!1)},R=T=>{T.terminalId===C&&n.current.onOutput?.(T.data)},j=T=>{T.terminalId===C&&(o(!1),n.current.onExit?.(T.exitCode),r(null))},M=T=>{T.terminalId===C&&o(!0)},L=T=>{T.terminalId===C&&o(!1)};return w.on("connect",E),w.on("disconnect",b),w.on(Qe.TERMINAL_STDOUT,R),w.on(Qe.TERMINAL_EXIT,j),w.on(Qe.TERMINAL_SUBSCRIBED,M),w.on(Qe.TERMINAL_UNSUBSCRIBED,L),c(w.connected),w.connected&&w.emit(Pt.SUBSCRIBE,{topic:"terminal",id:C},T=>{T.success&&o(!0)}),()=>{w.off("connect",E),w.off("disconnect",b),w.off(Qe.TERMINAL_STDOUT,R),w.off(Qe.TERMINAL_EXIT,j),w.off(Qe.TERMINAL_SUBSCRIBED,M),w.off(Qe.TERMINAL_UNSUBSCRIBED,L),w.emit(Pt.UNSUBSCRIBE,{topic:"terminal",id:C})}},[C]);const h=k.useCallback(async()=>{const w=wt.getSocket();if(!w.connected)return null;x(!0);try{const E=await fe.post("/terminals",{socketId:w.id,cwd:t,cols:s,rows:l});return r(E.terminalId),g(!1),E.terminalId}catch(E){return console.error("[useStandaloneTerminal] Failed to create terminal:",E),null}finally{x(!1)}},[t,s,l]),u=k.useCallback(async()=>{const w=d.current;if(w){try{await fe.delete(`/terminals/${w}`)}catch(E){console.error("[useStandaloneTerminal] Failed to destroy terminal:",E)}r(null),o(!1)}},[]),_=k.useCallback(w=>{const E=d.current;if(!E)return;wt.getSocket().emit(Pt.TERMINAL_INPUT,{terminalId:E,data:w})},[]),y=k.useCallback((w,E)=>{const b=d.current;if(!b)return;wt.getSocket().emit(Pt.TERMINAL_RESIZE,{terminalId:b,cols:w,rows:E})},[]);return k.useEffect(()=>()=>{const w=d.current;w&&fe.delete(`/terminals/${w}`).catch(()=>{})},[]),{terminalId:C,isConnected:i,isAttached:f,isCreating:p,needsRecreate:S,create:h,destroy:u,sendInput:_,resize:y}}const bh={background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78",black:"#1e1e1e",red:"#f44747",green:"#6a9955",yellow:"#d7ba7d",blue:"#569cd6",magenta:"#c586c0",cyan:"#4ec9b0",white:"#d4d4d4",brightBlack:"#808080",brightRed:"#f44747",brightGreen:"#6a9955",brightYellow:"#d7ba7d",brightBlue:"#569cd6",brightMagenta:"#c586c0",brightCyan:"#4ec9b0",brightWhite:"#ffffff"},xh=ee.memo(function({cwd:t,onExit:s,onReady:l}){const m=k.useRef(null),v=k.useRef(null),C=k.useRef(null),r=k.useRef(!1),{terminalId:i,isAttached:c,needsRecreate:f,create:o,sendInput:p,resize:x}=_h({cwd:t,onOutput:k.useCallback(S=>{v.current?.write(S)},[]),onExit:k.useCallback(S=>{v.current?.writeln(`\r
|
|
20
20
|
\x1B[90m[Process exited with code ${S}]\x1B[0m`),s?.(S)},[s])});return k.useEffect(()=>{if(!f)return;const S=v.current;S&&S.writeln(`\r
|
|
21
|
-
\x1B[33m[Terminal disconnected — reconnecting...]\x1B[0m`),o()},[f,o]),k.useLayoutEffect(()=>{if(!m.current)return;const S=new mh.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, 'Courier New', monospace",lineHeight:1.4,theme:bh,scrollback:5e3,convertEol:!0}),g=new gh;S.loadAddon(g),S.open(m.current);const n=(d=0)=>{if(!(d>=5))try{const u=m.current;if(!u||u.clientWidth===0||u.clientHeight===0){setTimeout(()=>n(d+1),50);return}g.fit(),x(S.cols,S.rows)}catch{setTimeout(()=>n(d+1),50)}};return n(0),setTimeout(()=>n(1),100),v.current=S,C.current=g,()=>{S.dispose(),v.current=null,C.current=null}},[x]),k.useEffect(()=>{r.current||(r.current=!0,o())},[o]),k.useEffect(()=>{const S=v.current;if(!S||!c)return;const g=S.onData(n=>{p(n)});return()=>g.dispose()},[p,c]),k.useEffect(()=>{c&&l?.({sendInput:p})},[c,p,l]),k.useEffect(()=>{if(!m.current)return;const S=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{const g=C.current,n=v.current,d=m.current;g&&n&&d&&d.clientWidth>0&&d.clientHeight>0&&(g.fit(),x(n.cols,n.rows))}catch{}})});return S.observe(m.current),()=>S.disconnect()},[x]),a.jsxs("div",{className:"relative flex h-full flex-col bg-[#1e1e1e]",children:[!i&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral-500 text-xs z-10 bg-[#1e1e1e]",children:"Starting terminal..."}),a.jsx("div",{ref:m,className:"flex-1 overflow-hidden px-1 pt-1"})]})}),Sh=ee.memo(function({commands:t,onSelect:s}){const{t:l}=ce(),[m,v]=k.useState(!1),C=k.useRef(null),r=k.useRef(null);return k.useEffect(()=>{if(!m)return;const i=c=>{C.current&&!C.current.contains(c.target)&&r.current&&!r.current.contains(c.target)&&v(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[m]),t.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#444] mx-1 shrink-0"}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{ref:r,onClick:()=>v(!m),className:`flex items-center gap-1.5 px-2.5 py-1 mx-1 rounded text-[11px] font-medium transition-colors shrink-0 ${m?"bg-amber-500/20 text-amber-300":"bg-amber-500/10 text-amber-400/80 hover:bg-amber-500/20 hover:text-amber-300"}`,children:[a.jsx(bl,{size:12}),a.jsx("span",{children:l("快捷命令")}),a.jsx(xt,{size:10,className:`transition-transform ${m?"rotate-180":""}`})]}),m&&a.jsx("div",{ref:C,className:"absolute right-0 top-full mt-1 w-72 bg-[#2d2d2d] border border-[#444] rounded-lg shadow-xl z-[100] overflow-hidden",children:a.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:t.map((i,c)=>a.jsxs("button",{onClick:()=>{s(i.command),v(!1)},className:"w-full flex items-start gap-2.5 px-3 py-2 hover:bg-[#383838] transition-colors text-left group",children:[a.jsx(Ot,{size:12,className:"text-green-500 mt-0.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-[12px] font-medium text-neutral-200",children:i.name}),a.jsx("div",{className:"text-[11px] font-mono text-neutral-500 truncate",children:i.command})]})]},c))})})]})]})});let
|
|
21
|
+
\x1B[33m[Terminal disconnected — reconnecting...]\x1B[0m`),o()},[f,o]),k.useLayoutEffect(()=>{if(!m.current)return;const S=new mh.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, 'Courier New', monospace",lineHeight:1.4,theme:bh,scrollback:5e3,convertEol:!0}),g=new gh;S.loadAddon(g),S.open(m.current);const n=(d=0)=>{if(!(d>=5))try{const u=m.current;if(!u||u.clientWidth===0||u.clientHeight===0){setTimeout(()=>n(d+1),50);return}g.fit(),x(S.cols,S.rows)}catch{setTimeout(()=>n(d+1),50)}};return n(0),setTimeout(()=>n(1),100),v.current=S,C.current=g,()=>{S.dispose(),v.current=null,C.current=null}},[x]),k.useEffect(()=>{r.current||(r.current=!0,o())},[o]),k.useEffect(()=>{const S=v.current;if(!S||!c)return;const g=S.onData(n=>{p(n)});return()=>g.dispose()},[p,c]),k.useEffect(()=>{c&&l?.({sendInput:p})},[c,p,l]),k.useEffect(()=>{if(!m.current)return;const S=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{const g=C.current,n=v.current,d=m.current;g&&n&&d&&d.clientWidth>0&&d.clientHeight>0&&(g.fit(),x(n.cols,n.rows))}catch{}})});return S.observe(m.current),()=>S.disconnect()},[x]),a.jsxs("div",{className:"relative flex h-full flex-col bg-[#1e1e1e]",children:[!i&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral-500 text-xs z-10 bg-[#1e1e1e]",children:"Starting terminal..."}),a.jsx("div",{ref:m,className:"flex-1 overflow-hidden px-1 pt-1"})]})}),Sh=ee.memo(function({commands:t,onSelect:s}){const{t:l}=ce(),[m,v]=k.useState(!1),C=k.useRef(null),r=k.useRef(null);return k.useEffect(()=>{if(!m)return;const i=c=>{C.current&&!C.current.contains(c.target)&&r.current&&!r.current.contains(c.target)&&v(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[m]),t.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-4 bg-[#444] mx-1 shrink-0"}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{ref:r,onClick:()=>v(!m),className:`flex items-center gap-1.5 px-2.5 py-1 mx-1 rounded text-[11px] font-medium transition-colors shrink-0 ${m?"bg-amber-500/20 text-amber-300":"bg-amber-500/10 text-amber-400/80 hover:bg-amber-500/20 hover:text-amber-300"}`,children:[a.jsx(bl,{size:12}),a.jsx("span",{children:l("快捷命令")}),a.jsx(xt,{size:10,className:`transition-transform ${m?"rotate-180":""}`})]}),m&&a.jsx("div",{ref:C,className:"absolute right-0 top-full mt-1 w-72 bg-[#2d2d2d] border border-[#444] rounded-lg shadow-xl z-[100] overflow-hidden",children:a.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:t.map((i,c)=>a.jsxs("button",{onClick:()=>{s(i.command),v(!1)},className:"w-full flex items-start gap-2.5 px-3 py-2 hover:bg-[#383838] transition-colors text-left group",children:[a.jsx(Ot,{size:12,className:"text-green-500 mt-0.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-[12px] font-medium text-neutral-200",children:i.name}),a.jsx("div",{className:"text-[11px] font-mono text-neutral-500 truncate",children:i.command})]})]},c))})})]})]})});let hr=0;function Di(){return hr+=1,{id:`shell-${hr}`,order:hr}}const yh=ee.memo(function({cwd:t,quickCommands:s=[]}){const{t:l}=ce(),[m,v]=k.useState(()=>[Di()]),[C,r]=k.useState(()=>m[0].id),i=k.useRef(new Map),c=k.useCallback(()=>{const S=Di();v(g=>[...g,S]),r(S.id)},[]),f=k.useCallback((S,g)=>{g.stopPropagation(),i.current.delete(S),v(n=>{const d=n.filter(h=>h.id!==S);return S===C&&d.length>0&&r(d[d.length-1].id),d})},[C]),o=k.useCallback(S=>{i.current.delete(S),v(g=>{const n=g.filter(d=>d.id!==S);return S===C&&n.length>0&&r(n[n.length-1].id),n})},[C]),p=k.useCallback((S,g)=>{i.current.set(S,g.sendInput)},[]),x=k.useCallback(S=>{const g=i.current.get(C);g&&g(S+"\r")},[C]);return a.jsxs("div",{className:"flex h-full flex-col bg-[#1e1e1e]",children:[a.jsxs("div",{className:"flex items-center bg-[#252526] border-b border-[#333] shrink-0 select-none",children:[a.jsx("div",{className:"flex items-center overflow-x-auto flex-1 min-w-0",children:m.map(S=>a.jsxs("button",{onClick:()=>r(S.id),className:ye("flex items-center gap-1.5 px-3 py-1.5 text-[11px] border-r border-[#333] whitespace-nowrap group transition-colors",S.id===C?"bg-[#1e1e1e] text-neutral-200":"bg-[#2d2d2d] text-neutral-500 hover:text-neutral-300"),children:[a.jsx(Es,{size:11,className:"shrink-0"}),a.jsx("span",{children:l("Shell {count}",{count:S.order})}),m.length>1&&a.jsx("span",{onClick:g=>f(S.id,g),className:"ml-1 p-0.5 rounded hover:bg-[#444] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:a.jsx(Fs,{size:10})})]},S.id))}),a.jsx("button",{onClick:c,className:"flex items-center justify-center px-2 py-1.5 text-neutral-500 hover:text-neutral-300 hover:bg-[#333] transition-colors shrink-0",title:l("New Terminal"),children:a.jsx(xr,{size:14})}),s.length>0&&a.jsx(Sh,{commands:s,onSelect:x})]}),a.jsx("div",{className:"flex-1 overflow-hidden relative",children:m.length===0?a.jsx("div",{className:"flex-1 flex items-center justify-center h-full text-neutral-500",children:a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx(Es,{size:28}),a.jsx("span",{className:"text-xs",children:l("No terminals open")}),a.jsx("button",{onClick:c,className:"mt-1 px-3 py-1 text-xs bg-[#333] hover:bg-[#444] rounded transition-colors text-neutral-300",children:l("New Terminal")})]})}):m.map(S=>a.jsx("div",{className:"absolute inset-0",style:{display:S.id===C?"block":"none"},children:a.jsx(xh,{cwd:t,onExit:()=>o(S.id),onReady:g=>p(S.id,g)})},S.id))})]})});function Ai(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,l=Array(t);s<t;s++)l[s]=e[s];return l}function Ch(e){if(Array.isArray(e))return e}function wh(e,t,s){return(t=Th(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Eh(e,t){var s=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(s!=null){var l,m,v,C,r=[],i=!0,c=!1;try{if(v=(s=s.call(e)).next,t!==0)for(;!(i=(l=v.call(s)).done)&&(r.push(l.value),r.length!==t);i=!0);}catch(f){c=!0,m=f}finally{try{if(!i&&s.return!=null&&(C=s.return(),Object(C)!==C))return}finally{if(c)throw m}}return r}}function kh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
22
22
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ji(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(m){return Object.getOwnPropertyDescriptor(e,m).enumerable})),s.push.apply(s,l)}return s}function Ti(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?ji(Object(s),!0).forEach(function(l){wh(e,l,s[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):ji(Object(s)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(s,l))})}return e}function Rh(e,t){if(e==null)return{};var s,l,m=Dh(e,t);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(e);for(l=0;l<v.length;l++)s=v[l],t.indexOf(s)===-1&&{}.propertyIsEnumerable.call(e,s)&&(m[s]=e[s])}return m}function Dh(e,t){if(e==null)return{};var s={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(t.indexOf(l)!==-1)continue;s[l]=e[l]}return s}function Ah(e,t){return Ch(e)||Eh(e,t)||Lh(e,t)||kh()}function jh(e,t){if(typeof e!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var l=s.call(e,t);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Th(e){var t=jh(e,"string");return typeof t=="symbol"?t:t+""}function Lh(e,t){if(e){if(typeof e=="string")return Ai(e,t);var s={}.toString.call(e).slice(8,-1);return s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set"?Array.from(e):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Ai(e,t):void 0}}function Mh(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Li(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(m){return Object.getOwnPropertyDescriptor(e,m).enumerable})),s.push.apply(s,l)}return s}function Mi(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Li(Object(s),!0).forEach(function(l){Mh(e,l,s[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Li(Object(s)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(s,l))})}return e}function Nh(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return function(l){return t.reduceRight(function(m,v){return v(m)},l)}}function Qt(e){return function t(){for(var s=this,l=arguments.length,m=new Array(l),v=0;v<l;v++)m[v]=arguments[v];return m.length>=e.length?e.apply(this,m):function(){for(var C=arguments.length,r=new Array(C),i=0;i<C;i++)r[i]=arguments[i];return t.apply(s,[].concat(m,r))}}}function Ls(e){return{}.toString.call(e).includes("Object")}function Ph(e){return!Object.keys(e).length}function ls(e){return typeof e=="function"}function Oh(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Bh(e,t){return Ls(t)||kt("changeType"),Object.keys(t).some(function(s){return!Oh(e,s)})&&kt("changeField"),t}function Ih(e){ls(e)||kt("selectorType")}function Fh(e){ls(e)||Ls(e)||kt("handlerType"),Ls(e)&&Object.values(e).some(function(t){return!ls(t)})&&kt("handlersType")}function Hh(e){e||kt("initialIsRequired"),Ls(e)||kt("initialType"),Ph(e)&&kt("initialContent")}function zh(e,t){throw new Error(e[t]||e.default)}var Wh={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},kt=Qt(zh)(Wh),_s={changes:Bh,selector:Ih,handler:Fh,initial:Hh};function $h(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};_s.initial(e),_s.handler(t);var s={current:e},l=Qt(Kh)(s,t),m=Qt(qh)(s),v=Qt(_s.changes)(e),C=Qt(Uh)(s);function r(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(f){return f};return _s.selector(c),c(s.current)}function i(c){Nh(l,m,v,C)(c)}return[r,i]}function Uh(e,t){return ls(t)?t(e.current):t}function qh(e,t){return e.current=Mi(Mi({},e.current),t),t}function Kh(e,t,s){return ls(t)?t(e.current):Object.keys(s).forEach(function(l){var m;return(m=t[l])===null||m===void 0?void 0:m.call(t,e.current[l])}),s}var Xh={create:$h},Yh={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Vh(e){return function t(){for(var s=this,l=arguments.length,m=new Array(l),v=0;v<l;v++)m[v]=arguments[v];return m.length>=e.length?e.apply(this,m):function(){for(var C=arguments.length,r=new Array(C),i=0;i<C;i++)r[i]=arguments[i];return t.apply(s,[].concat(m,r))}}}function Gh(e){return{}.toString.call(e).includes("Object")}function Qh(e){return e||Ni("configIsRequired"),Gh(e)||Ni("configType"),e.urls?(Zh(),{paths:{vs:e.urls.monacoBase}}):e}function Zh(){console.warn(Yn.deprecation)}function Jh(e,t){throw new Error(e[t]||e.default)}var Yn={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
23
23
|
You are using deprecated way of configuration.
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
28
28
|
monaco.config({ paths: { vs: '...' } })
|
|
29
29
|
|
|
30
30
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
31
|
-
`},Ni=Vh(Jh)(Yn),eu={config:Qh},tu=function(){for(var t=arguments.length,s=new Array(t),l=0;l<t;l++)s[l]=arguments[l];return function(m){return s.reduceRight(function(v,C){return C(v)},m)}};function Vn(e,t){return Object.keys(t).forEach(function(s){t[s]instanceof Object&&e[s]&&Object.assign(t[s],Vn(e[s],t[s]))}),Ti(Ti({},e),t)}var su={type:"cancelation",msg:"operation is manually canceled"};function hr(e){var t=!1,s=new Promise(function(l,m){e.then(function(v){return t?m(su):l(v)}),e.catch(m)});return s.cancel=function(){return t=!0},s}var ru=["monaco"],iu=Xh.create({config:Yh,isInitialized:!1,resolve:null,reject:null,monaco:null}),Gn=Ah(iu,2),fs=Gn[0],Ys=Gn[1];function nu(e){var t=eu.config(e),s=t.monaco,l=Rh(t,ru);Ys(function(m){return{config:Vn(m.config,l),monaco:s}})}function ou(){var e=fs(function(t){var s=t.monaco,l=t.isInitialized,m=t.resolve;return{monaco:s,isInitialized:l,resolve:m}});if(!e.isInitialized){if(Ys({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),hr(ur);if(window.monaco&&window.monaco.editor)return Qn(window.monaco),e.resolve(window.monaco),hr(ur);tu(au,cu)(hu)}return hr(ur)}function au(e){return document.body.appendChild(e)}function lu(e){var t=document.createElement("script");return e&&(t.src=e),t}function cu(e){var t=fs(function(l){var m=l.config,v=l.reject;return{config:m,reject:v}}),s=lu("".concat(t.config.paths.vs,"/loader.js"));return s.onload=function(){return e()},s.onerror=t.reject,s}function hu(){var e=fs(function(s){var l=s.config,m=s.resolve,v=s.reject;return{config:l,resolve:m,reject:v}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(s){var l=s.m||s;Qn(l),e.resolve(l)},function(s){e.reject(s)})}function Qn(e){fs().monaco||Ys({monaco:e})}function uu(){return fs(function(e){var t=e.monaco;return t})}var ur=new Promise(function(e,t){return Ys({resolve:e,reject:t})}),Zn={config:nu,init:ou,__getMonacoInstance:uu},du={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},dr=du,fu={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},mu=fu;function pu({children:e}){return ee.createElement("div",{style:mu.container},e)}var vu=pu,gu=vu;function _u({width:e,height:t,isEditorReady:s,loading:l,_ref:m,className:v,wrapperProps:C}){return ee.createElement("section",{style:{...dr.wrapper,width:e,height:t},...C},!s&&ee.createElement(gu,null,l),ee.createElement("div",{ref:m,style:{...dr.fullWidth,...!s&&dr.hide},className:v}))}var bu=_u,Jn=k.memo(bu);function xu(e){k.useEffect(e,[])}var eo=xu;function Su(e,t,s=!0){let l=k.useRef(!0);k.useEffect(l.current||!s?()=>{l.current=!1}:e,t)}var it=Su;function ts(){}function Wt(e,t,s,l){return yu(e,l)||Cu(e,t,s,l)}function yu(e,t){return e.editor.getModel(to(e,t))}function Cu(e,t,s,l){return e.editor.createModel(t,s,l?to(e,l):void 0)}function to(e,t){return e.Uri.parse(t)}function wu({original:e,modified:t,language:s,originalLanguage:l,modifiedLanguage:m,originalModelPath:v,modifiedModelPath:C,keepCurrentOriginalModel:r=!1,keepCurrentModifiedModel:i=!1,theme:c="light",loading:f="Loading...",options:o={},height:p="100%",width:x="100%",className:S,wrapperProps:g={},beforeMount:n=ts,onMount:d=ts}){let[h,u]=k.useState(!1),[_,y]=k.useState(!0),w=k.useRef(null),E=k.useRef(null),b=k.useRef(null),R=k.useRef(d),j=k.useRef(n),M=k.useRef(!1);eo(()=>{let I=Zn.init();return I.then(H=>(E.current=H)&&y(!1)).catch(H=>H?.type!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>w.current?B():I.cancel()}),it(()=>{if(w.current&&E.current){let I=w.current.getOriginalEditor(),H=Wt(E.current,e||"",l||s||"text",v||"");H!==I.getModel()&&I.setModel(H)}},[v],h),it(()=>{if(w.current&&E.current){let I=w.current.getModifiedEditor(),H=Wt(E.current,t||"",m||s||"text",C||"");H!==I.getModel()&&I.setModel(H)}},[C],h),it(()=>{let I=w.current.getModifiedEditor();I.getOption(E.current.editor.EditorOption.readOnly)?I.setValue(t||""):t!==I.getValue()&&(I.executeEdits("",[{range:I.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),I.pushUndoStop())},[t],h),it(()=>{w.current?.getModel()?.original.setValue(e||"")},[e],h),it(()=>{let{original:I,modified:H}=w.current.getModel();E.current.editor.setModelLanguage(I,l||s||"text"),E.current.editor.setModelLanguage(H,m||s||"text")},[s,l,m],h),it(()=>{E.current?.editor.setTheme(c)},[c],h),it(()=>{w.current?.updateOptions(o)},[o],h);let L=k.useCallback(()=>{if(!E.current)return;j.current(E.current);let I=Wt(E.current,e||"",l||s||"text",v||""),H=Wt(E.current,t||"",m||s||"text",C||"");w.current?.setModel({original:I,modified:H})},[s,t,m,e,l,v,C]),T=k.useCallback(()=>{!M.current&&b.current&&(w.current=E.current.editor.createDiffEditor(b.current,{automaticLayout:!0,...o}),L(),E.current?.editor.setTheme(c),u(!0),M.current=!0)},[o,c,L]);k.useEffect(()=>{h&&R.current(w.current,E.current)},[h]),k.useEffect(()=>{!_&&!h&&T()},[_,h,T]);function B(){let I=w.current?.getModel();r||I?.original?.dispose(),i||I?.modified?.dispose(),w.current?.dispose()}return ee.createElement(Jn,{width:x,height:p,isEditorReady:h,loading:f,_ref:b,className:S,wrapperProps:g})}var Eu=wu;k.memo(Eu);function ku(e){let t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}var Ru=ku,bs=new Map;function Du({defaultValue:e,defaultLanguage:t,defaultPath:s,value:l,language:m,path:v,theme:C="light",line:r,loading:i="Loading...",options:c={},overrideServices:f={},saveViewState:o=!0,keepCurrentModel:p=!1,width:x="100%",height:S="100%",className:g,wrapperProps:n={},beforeMount:d=ts,onMount:h=ts,onChange:u,onValidate:_=ts}){let[y,w]=k.useState(!1),[E,b]=k.useState(!0),R=k.useRef(null),j=k.useRef(null),M=k.useRef(null),L=k.useRef(h),T=k.useRef(d),B=k.useRef(),I=k.useRef(l),H=Ru(v),W=k.useRef(!1),A=k.useRef(!1);eo(()=>{let O=Zn.init();return O.then($=>(R.current=$)&&b(!1)).catch($=>$?.type!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>j.current?P():O.cancel()}),it(()=>{let O=Wt(R.current,e||l||"",t||m||"",v||s||"");O!==j.current?.getModel()&&(o&&bs.set(H,j.current?.saveViewState()),j.current?.setModel(O),o&&j.current?.restoreViewState(bs.get(v)))},[v],y),it(()=>{j.current?.updateOptions(c)},[c],y),it(()=>{!j.current||l===void 0||(j.current.getOption(R.current.editor.EditorOption.readOnly)?j.current.setValue(l):l!==j.current.getValue()&&(A.current=!0,j.current.executeEdits("",[{range:j.current.getModel().getFullModelRange(),text:l,forceMoveMarkers:!0}]),j.current.pushUndoStop(),A.current=!1))},[l],y),it(()=>{let O=j.current?.getModel();O&&m&&R.current?.editor.setModelLanguage(O,m)},[m],y),it(()=>{r!==void 0&&j.current?.revealLine(r)},[r],y),it(()=>{R.current?.editor.setTheme(C)},[C],y);let N=k.useCallback(()=>{if(!(!M.current||!R.current)&&!W.current){T.current(R.current);let O=v||s,$=Wt(R.current,l||e||"",t||m||"",O||"");j.current=R.current?.editor.create(M.current,{model:$,automaticLayout:!0,...c},f),o&&j.current.restoreViewState(bs.get(O)),R.current.editor.setTheme(C),r!==void 0&&j.current.revealLine(r),w(!0),W.current=!0}},[e,t,s,l,m,v,c,f,o,C,r]);k.useEffect(()=>{y&&L.current(j.current,R.current)},[y]),k.useEffect(()=>{!E&&!y&&N()},[E,y,N]),I.current=l,k.useEffect(()=>{y&&u&&(B.current?.dispose(),B.current=j.current?.onDidChangeModelContent(O=>{A.current||u(j.current.getValue(),O)}))},[y,u]),k.useEffect(()=>{if(y){let O=R.current.editor.onDidChangeMarkers($=>{let X=j.current.getModel()?.uri;if(X&&$.find(K=>K.path===X.path)){let K=R.current.editor.getModelMarkers({resource:X});_?.(K)}});return()=>{O?.dispose()}}return()=>{}},[y,_]);function P(){B.current?.dispose(),p?o&&bs.set(v,j.current.saveViewState()):j.current.getModel()?.dispose(),j.current.dispose()}return ee.createElement(Jn,{width:x,height:S,isEditorReady:y,loading:i,_ref:M,className:g,wrapperProps:n})}var Au=Du,ju=k.memo(Au),Tu=ju,ct=function(e,t){return Number(e.toFixed(t))},Lu=function(e,t){return typeof e=="number"?e:t},Te=function(e,t,s){s&&typeof s=="function"&&s(e,t)},Mu=function(e){return-Math.cos(e*Math.PI)/2+.5},Nu=function(e){return e},Pu=function(e){return e*e},Ou=function(e){return e*(2-e)},Bu=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},Iu=function(e){return e*e*e},Fu=function(e){return--e*e*e+1},Hu=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},zu=function(e){return e*e*e*e},Wu=function(e){return 1- --e*e*e*e},$u=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},Uu=function(e){return e*e*e*e*e},qu=function(e){return 1+--e*e*e*e*e},Ku=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},so={easeOut:Mu,linear:Nu,easeInQuad:Pu,easeOutQuad:Ou,easeInOutQuad:Bu,easeInCubic:Iu,easeOutCubic:Fu,easeInOutCubic:Hu,easeInQuart:zu,easeOutQuart:Wu,easeInOutQuart:$u,easeInQuint:Uu,easeOutQuint:qu,easeInOutQuint:Ku},ro=function(e){typeof e=="number"&&cancelAnimationFrame(e)},ut=function(e){e.mounted&&(ro(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function io(e,t,s,l){if(e.mounted){var m=new Date().getTime(),v=1;ut(e),e.animation=function(){if(!e.mounted)return ro(e.animation);var C=new Date().getTime()-m,r=C/s,i=so[t],c=i(r);C>=s?(l(v),e.animation=null):e.animation&&(l(c),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function Xu(e){var t=e.scale,s=e.positionX,l=e.positionY;return!(Number.isNaN(t)||Number.isNaN(s)||Number.isNaN(l))}function At(e,t,s,l){var m=Xu(t);if(!(!e.mounted||!m)){var v=e.setTransformState,C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY,f=t.scale-r,o=t.positionX-i,p=t.positionY-c;s===0?v(t.scale,t.positionX,t.positionY):io(e,l,s,function(x){var S=r+f*x,g=i+o*x,n=c+p*x;v(S,g,n)})}}function Yu(e,t,s){var l=e.offsetWidth,m=e.offsetHeight,v=t.offsetWidth,C=t.offsetHeight,r=v*s,i=C*s,c=l-r,f=m-i;return{wrapperWidth:l,wrapperHeight:m,newContentWidth:r,newDiffWidth:c,newContentHeight:i,newDiffHeight:f}}var Vu=function(e,t,s,l,m,v,C){var r=e>t?s*(C?1:.5):0,i=l>m?v*(C?1:.5):0,c=e-t-r,f=r,o=l-m-i,p=i;return{minPositionX:c,maxPositionX:f,minPositionY:o,maxPositionY:p}},Kr=function(e,t){var s=e.wrapperComponent,l=e.contentComponent,m=e.setup.centerZoomedOut;if(!s||!l)throw new Error("Components are not mounted");var v=Yu(s,l,t),C=v.wrapperWidth,r=v.wrapperHeight,i=v.newContentWidth,c=v.newDiffWidth,f=v.newContentHeight,o=v.newDiffHeight,p=Vu(C,i,c,r,f,o,!!m);return p},wr=function(e,t,s,l){return l?e<t?ct(t,2):e>s?ct(s,2):ct(e,2):ct(e,2)},Bt=function(e,t){var s=Kr(e,t);return e.bounds=s,s};function ms(e,t,s,l,m,v,C){var r=s.minPositionX,i=s.minPositionY,c=s.maxPositionX,f=s.maxPositionY,o=0,p=0;C&&(o=m,p=v);var x=wr(e,r-o,c+o,l),S=wr(t,i-p,f+p,l);return{x,y:S}}function Vs(e,t,s,l,m,v){var C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY,f=l-r;if(typeof t!="number"||typeof s!="number")return console.error("Mouse X and Y position were not provided!"),{x:i,y:c};var o=i-t*f,p=c-s*f,x=ms(o,p,m,v,0,0,null);return x}function ps(e,t,s,l,m){var v=m?l:0,C=t-v;return!Number.isNaN(s)&&e>=s?s:!Number.isNaN(t)&&e<=C?C:e}var Pi=function(e,t){var s=e.setup.panning.excluded,l=e.isInitialized,m=e.wrapperComponent,v=t.target,C="shadowRoot"in v&&"composedPath"in t,r=C?t.composedPath().some(function(f){return f instanceof Element?m?.contains(f):!1}):m?.contains(v),i=l&&v&&r;if(!i)return!1;var c=Gs(v,s);return!c},Oi=function(e){var t=e.isInitialized,s=e.isPanning,l=e.setup,m=l.panning.disabled,v=t&&s&&!m;return!!v},Gu=function(e,t){var s=e.transformState,l=s.positionX,m=s.positionY;e.isPanning=!0;var v=t.clientX,C=t.clientY;e.startCoords={x:v-l,y:C-m}},Qu=function(e,t){var s=t.touches,l=e.transformState,m=l.positionX,v=l.positionY;e.isPanning=!0;var C=s.length===1;if(C){var r=s[0].clientX,i=s[0].clientY;e.startCoords={x:r-m,y:i-v}}};function Zu(e){var t=e.transformState,s=t.positionX,l=t.positionY,m=t.scale,v=e.setup,C=v.disabled,r=v.limitToBounds,i=v.centerZoomedOut,c=e.wrapperComponent;if(!(C||!c||!e.bounds)){var f=e.bounds,o=f.maxPositionX,p=f.minPositionX,x=f.maxPositionY,S=f.minPositionY,g=s>o||s<p,n=l>x||l<S,d=s>o?c.offsetWidth:e.setup.minPositionX||0,h=l>x?c.offsetHeight:e.setup.minPositionY||0,u=Vs(e,d,h,m,e.bounds,r||i),_=u.x,y=u.y;return{scale:m,positionX:g?_:s,positionY:n?y:l}}}function no(e,t,s,l,m){var v=e.setup.limitToBounds,C=e.wrapperComponent,r=e.bounds,i=e.transformState,c=i.scale,f=i.positionX,o=i.positionY;if(!(C===null||r===null||t===f&&s===o)){var p=ms(t,s,r,v,l,m,C),x=p.x,S=p.y;e.setTransformState(c,x,S)}}var Ju=function(e,t,s){var l=e.startCoords,m=e.transformState,v=e.setup.panning,C=v.lockAxisX,r=v.lockAxisY,i=m.positionX,c=m.positionY;if(!l)return{x:i,y:c};var f=t-l.x,o=s-l.y,p=C?i:f,x=r?c:o;return{x:p,y:x}},Dt=function(e,t){var s=e.setup,l=e.transformState,m=l.scale,v=s.minScale,C=s.disablePadding;return t>0&&m>=v&&!C?t:0},ed=function(e){var t=e.mounted,s=e.setup,l=s.disabled,m=s.velocityAnimation,v=e.transformState.scale,C=m.disabled,r=!C||v>1||!l||t;return!!r},td=function(e){var t=e.mounted,s=e.velocity,l=e.bounds,m=e.setup,v=m.disabled,C=m.velocityAnimation,r=e.transformState.scale,i=C.disabled,c=!i||r>1||!v||t;return!(!c||!s||!l)};function sd(e,t){var s=e.setup.velocityAnimation,l=s.equalToMove,m=s.animationTime,v=s.sensitivity;return l?m*t*v:m}function Bi(e,t,s,l,m,v,C,r,i,c){if(m){if(t>C&&s>C){var f=C+(e-C)*c;return f>i?i:f<C?C:f}if(t<v&&s<v){var f=v+(e-v)*c;return f<r?r:f>v?v:f}}return l?t:wr(e,v,C,m)}function rd(e,t){var s=1;return t?Math.min(s,e.offsetWidth/window.innerWidth):s}function id(e,t){var s=ed(e);if(s){var l=e.lastMousePosition,m=e.velocityTime,v=e.setup,C=e.wrapperComponent,r=v.velocityAnimation.equalToMove,i=Date.now();if(l&&m&&C){var c=rd(C,r),f=t.x-l.x,o=t.y-l.y,p=f/c,x=o/c,S=i-m,g=f*f+o*o,n=Math.sqrt(g)/S;e.velocity={velocityX:p,velocityY:x,total:n}}e.lastMousePosition=t,e.velocityTime=i}}function nd(e){var t=e.velocity,s=e.bounds,l=e.setup,m=e.wrapperComponent,v=td(e);if(!(!v||!t||!s||!m)){var C=t.velocityX,r=t.velocityY,i=t.total,c=s.maxPositionX,f=s.minPositionX,o=s.maxPositionY,p=s.minPositionY,x=l.limitToBounds,S=l.alignmentAnimation,g=l.zoomAnimation,n=l.panning,d=n.lockAxisY,h=n.lockAxisX,u=g.animationType,_=S.sizeX,y=S.sizeY,w=S.velocityAlignmentTime,E=w,b=sd(e,i),R=Math.max(b,E),j=Dt(e,_),M=Dt(e,y),L=j*m.offsetWidth/100,T=M*m.offsetHeight/100,B=c+L,I=f-L,H=o+T,W=p-T,A=e.transformState,N=new Date().getTime();io(e,u,R,function(P){var O=e.transformState,$=O.scale,X=O.positionX,K=O.positionY,Q=new Date().getTime()-N,se=Q/E,D=so[S.animationType],F=1-D(Math.min(1,se)),U=1-P,z=X+C*U,te=K+r*U,Y=Bi(z,A.positionX,X,h,x,f,c,I,B,F),ie=Bi(te,A.positionY,K,d,x,p,o,W,H,F);(X!==z||K!==te)&&e.setTransformState($,Y,ie)})}}function Ii(e,t){var s=e.transformState.scale;ut(e),Bt(e,s),window.TouchEvent!==void 0&&t instanceof TouchEvent?Qu(e,t):Gu(e,t)}function Xr(e,t){var s=e.transformState.scale,l=e.setup,m=l.minScale,v=l.alignmentAnimation,C=v.disabled,r=v.sizeX,i=v.sizeY,c=v.animationTime,f=v.animationType,o=C||s<m||!r&&!i;if(!o){var p=Zu(e);p&&At(e,p,t??c,f)}}function Fi(e,t,s){var l=e.startCoords,m=e.setup,v=m.alignmentAnimation,C=v.sizeX,r=v.sizeY;if(l){var i=Ju(e,t,s),c=i.x,f=i.y,o=Dt(e,C),p=Dt(e,r);id(e,{x:c,y:f}),no(e,c,f,o,p)}}function od(e){if(e.isPanning){var t=e.setup.panning.velocityDisabled,s=e.velocity,l=e.wrapperComponent,m=e.contentComponent;e.isPanning=!1,e.animate=!1,e.animation=null;var v=l?.getBoundingClientRect(),C=m?.getBoundingClientRect(),r=v?.width||0,i=v?.height||0,c=C?.width||0,f=C?.height||0,o=r<c||i<f,p=!t&&s&&s?.total>.1&&o;p?nd(e):Xr(e)}}function Yr(e,t,s,l){var m=e.setup,v=m.minScale,C=m.maxScale,r=m.limitToBounds,i=ps(ct(t,2),v,C,0,!1),c=Bt(e,i),f=Vs(e,s,l,i,c,r),o=f.x,p=f.y;return{scale:i,positionX:o,positionY:p}}function oo(e,t,s){var l=e.transformState.scale,m=e.wrapperComponent,v=e.setup,C=v.minScale,r=v.limitToBounds,i=v.zoomAnimation,c=i.disabled,f=i.animationTime,o=i.animationType,p=c||l>=C;if((l>=1||r)&&Xr(e),!(p||!m||!e.mounted)){var x=t||m.offsetWidth/2,S=s||m.offsetHeight/2,g=Yr(e,C,x,S);g&&At(e,g,f,o)}}var Rt=function(){return Rt=Object.assign||function(t){for(var s,l=1,m=arguments.length;l<m;l++){s=arguments[l];for(var v in s)Object.prototype.hasOwnProperty.call(s,v)&&(t[v]=s[v])}return t},Rt.apply(this,arguments)};function Hi(e,t,s){for(var l=0,m=t.length,v;l<m;l++)(v||!(l in t))&&(v||(v=Array.prototype.slice.call(t,0,l)),v[l]=t[l]);return e.concat(v||Array.prototype.slice.call(t))}var xs={scale:1,positionX:0,positionY:0},Vt={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,disablePadding:!1,smooth:!0,wheel:{step:.2,disabled:!1,smoothStep:.001,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,wheelPanning:!1,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},alignmentAnimation:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivity:1,animationTime:400,animationType:"easeOut",equalToMove:!0}},Er={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},ao=function(e){var t,s,l,m;return{previousScale:(t=e.initialScale)!==null&&t!==void 0?t:xs.scale,scale:(s=e.initialScale)!==null&&s!==void 0?s:xs.scale,positionX:(l=e.initialPositionX)!==null&&l!==void 0?l:xs.positionX,positionY:(m=e.initialPositionY)!==null&&m!==void 0?m:xs.positionY}},zi=function(e){var t=Rt({},Vt);return Object.keys(e).forEach(function(s){var l=typeof e[s]<"u",m=typeof Vt[s]<"u";if(m&&l){var v=Object.prototype.toString.call(Vt[s]),C=v==="[object Object]",r=v==="[object Array]";C?t[s]=Rt(Rt({},Vt[s]),e[s]):r?t[s]=Hi(Hi([],Vt[s],!0),e[s]):t[s]=e[s]}}),t},lo=function(e,t,s){var l=e.transformState.scale,m=e.wrapperComponent,v=e.setup,C=v.maxScale,r=v.minScale,i=v.zoomAnimation,c=v.smooth,f=i.size;if(!m)throw new Error("Wrapper is not mounted");var o=c?l*Math.exp(t*s):l+t*s,p=ps(ct(o,3),r,C,f,!1);return p};function co(e,t,s,l,m){var v=e.wrapperComponent,C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY;if(!v)return console.error("No WrapperComponent found");var f=v.offsetWidth,o=v.offsetHeight,p=(f/2-i)/r,x=(o/2-c)/r,S=lo(e,t,s),g=Yr(e,S,p,x);if(!g)return console.error("Error during zoom event. New transformation state was not calculated.");At(e,g,l,m)}function ho(e,t,s,l){var m=e.setup,v=e.wrapperComponent,C=m.limitToBounds,r=ao(e.props),i=e.transformState,c=i.scale,f=i.positionX,o=i.positionY;if(v){var p=Kr(e,r.scale),x=ms(r.positionX,r.positionY,p,C,0,0,v),S={scale:r.scale,positionX:x.x,positionY:x.y};c===r.scale&&f===r.positionX&&o===r.positionY||(l?.(),At(e,S,t,s))}}function ad(e,t,s,l){var m=e.getBoundingClientRect(),v=t.getBoundingClientRect(),C=s.getBoundingClientRect(),r=v.x*l.scale,i=v.y*l.scale;return{x:(m.x-C.x+r)/l.scale,y:(m.y-C.y+i)/l.scale}}function ld(e,t,s){var l=e.wrapperComponent,m=e.contentComponent,v=e.transformState,C=e.setup,r=C.limitToBounds,i=C.minScale,c=C.maxScale;if(!l||!m)return v;var f=l.getBoundingClientRect(),o=t.getBoundingClientRect(),p=ad(t,l,m,v),x=p.x,S=p.y,g=o.width/v.scale,n=o.height/v.scale,d=l.offsetWidth/g,h=l.offsetHeight/n,u=ps(s||Math.min(d,h),i,c,0,!1),_=(f.width-g*u)/2,y=(f.height-n*u)/2,w=(f.left-x)*u+_,E=(f.top-S)*u+y,b=Kr(e,u),R=ms(w,E,b,r,0,0,l),j=R.x,M=R.y;return{positionX:j,positionY:M,scale:u}}var cd=function(e){return function(t,s,l){t===void 0&&(t=.5),s===void 0&&(s=300),l===void 0&&(l="easeOut"),co(e,1,t,s,l)}},hd=function(e){return function(t,s,l){t===void 0&&(t=.5),s===void 0&&(s=300),l===void 0&&(l="easeOut"),co(e,-1,t,s,l)}},ud=function(e){return function(t,s,l,m,v){m===void 0&&(m=300),v===void 0&&(v="easeOut");var C=e.transformState,r=C.positionX,i=C.positionY,c=C.scale,f=e.wrapperComponent,o=e.contentComponent,p=e.setup.disabled;if(!(p||!f||!o)){var x={positionX:Number.isNaN(t)?r:t,positionY:Number.isNaN(s)?i:s,scale:Number.isNaN(l)?c:l};At(e,x,m,v)}}},dd=function(e){return function(t,s){t===void 0&&(t=200),s===void 0&&(s="easeOut"),ho(e,t,s)}},fd=function(e){return function(t,s,l){s===void 0&&(s=200),l===void 0&&(l="easeOut");var m=e.transformState,v=e.wrapperComponent,C=e.contentComponent;if(v&&C){var r=uo(t||m.scale,v,C);At(e,r,s,l)}}},md=function(e){return function(t,s,l,m){l===void 0&&(l=600),m===void 0&&(m="easeOut"),ut(e);var v=e.wrapperComponent,C=typeof t=="string"?document.getElementById(t):t;if(v&&C&&v.contains(C)){var r=ld(e,C,s);At(e,r,l,m)}}},Ms=function(e){return{instance:e,zoomIn:cd(e),zoomOut:hd(e),setTransform:ud(e),resetTransform:dd(e),centerView:fd(e),zoomToElement:md(e)}},kr=function(e){return{instance:e,state:e.transformState}},ke=function(e){var t={};return Object.assign(t,kr(e)),Object.assign(t,Ms(e)),t},fr=!1;function mr(){try{var e={get passive(){return fr=!0,!1}};return e}catch{return fr=!1,fr}}var Ss=".".concat(Er.wrapperClass),Gs=function(e,t){return t.some(function(s){return e.matches("".concat(Ss," ").concat(s,", ").concat(Ss," .").concat(s,", ").concat(Ss," ").concat(s," *, ").concat(Ss," .").concat(s," *"))})},Rr=function(e){e&&clearTimeout(e)},pd=function(e,t,s){return"translate(".concat(e,"px, ").concat(t,"px) scale(").concat(s,")")},uo=function(e,t,s){var l=s.offsetWidth*e,m=s.offsetHeight*e,v=(t.offsetWidth-l)/2,C=(t.offsetHeight-m)/2;return{scale:e,positionX:v,positionY:C}};function vd(e){return function(t){e.forEach(function(s){typeof s=="function"?s(t):s!=null&&(s.current=t)})}}var gd=function(e,t){var s=e.setup.wheel,l=s.disabled,m=s.wheelDisabled,v=s.touchPadDisabled,C=s.excluded,r=e.isInitialized,i=e.isPanning,c=t.target,f=r&&!i&&!l&&c;if(!f||m&&!t.ctrlKey||v&&t.ctrlKey)return!1;var o=Gs(c,C);return!o},_d=function(e){return e?e.deltaY<0?1:-1:0};function bd(e,t){var s=_d(e),l=Lu(t,s);return l}function fo(e,t,s){var l=t.getBoundingClientRect(),m=0,v=0;if("clientX"in e)m=(e.clientX-l.left)/s,v=(e.clientY-l.top)/s;else{var C=e.touches[0];m=(C.clientX-l.left)/s,v=(C.clientY-l.top)/s}return(Number.isNaN(m)||Number.isNaN(v))&&console.error("No mouse or touch offset found"),{x:m,y:v}}var xd=function(e,t,s,l,m){var v=e.transformState.scale,C=e.wrapperComponent,r=e.setup,i=r.maxScale,c=r.minScale,f=r.zoomAnimation,o=r.disablePadding,p=f.size,x=f.disabled;if(!C)throw new Error("Wrapper is not mounted");var S=v+t*s,g=l?!1:!x,n=ps(ct(S,3),c,i,p,g&&!o);return n},Sd=function(e,t){var s=e.previousWheelEvent,l=e.transformState.scale,m=e.setup,v=m.maxScale,C=m.minScale;return s?l<v||l>C||Math.sign(s.deltaY)!==Math.sign(t.deltaY)||s.deltaY>0&&s.deltaY<t.deltaY||s.deltaY<0&&s.deltaY>t.deltaY||Math.sign(s.deltaY)!==Math.sign(t.deltaY):!1},yd=function(e,t){var s=e.setup.pinch,l=s.disabled,m=s.excluded,v=e.isInitialized,C=t.target,r=v&&!l&&C;if(!r)return!1;var i=Gs(C,m);return!i},Cd=function(e){var t=e.setup.pinch.disabled,s=e.isInitialized,l=e.pinchStartDistance,m=s&&!t&&l;return!!m},wd=function(e,t,s){var l=s.getBoundingClientRect(),m=e.touches,v=ct(m[0].clientX-l.left,5),C=ct(m[0].clientY-l.top,5),r=ct(m[1].clientX-l.left,5),i=ct(m[1].clientY-l.top,5);return{x:(v+r)/2/t,y:(C+i)/2/t}},mo=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},Ed=function(e,t){var s=e.pinchStartScale,l=e.pinchStartDistance,m=e.setup,v=m.maxScale,C=m.minScale,r=m.zoomAnimation,i=m.disablePadding,c=r.size,f=r.disabled;if(!s||l===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var o=t/l,p=o*s;return ps(ct(p,2),C,v,c,!f&&!i)},kd=160,Rd=100,Dd=function(e,t){var s=e.props,l=s.onWheelStart,m=s.onZoomStart;e.wheelStopEventTimer||(ut(e),Te(ke(e),t,l),Te(ke(e),t,m))},Ad=function(e,t){var s=e.props,l=s.onWheel,m=s.onZoom,v=e.contentComponent,C=e.setup,r=e.transformState,i=r.scale,c=C.limitToBounds,f=C.centerZoomedOut,o=C.zoomAnimation,p=C.wheel,x=C.disablePadding,S=C.smooth,g=o.size,n=o.disabled,d=p.step,h=p.smoothStep;if(!v)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var u=bd(t,null),_=S?h*Math.abs(t.deltaY):d,y=xd(e,u,_,!t.ctrlKey);if(i!==y){var w=Bt(e,y),E=fo(t,v,i),b=n||g===0||f||x,R=c&&b,j=Vs(e,E.x,E.y,y,w,R),M=j.x,L=j.y;e.previousWheelEvent=t,e.setTransformState(y,M,L),Te(ke(e),t,l),Te(ke(e),t,m)}},jd=function(e,t){var s=e.props,l=s.onWheelStop,m=s.onZoomStop;Rr(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(oo(e,t.x,t.y),e.wheelAnimationTimer=null)},Rd);var v=Sd(e,t);v&&(Rr(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Te(ke(e),t,l),Te(ke(e),t,m))},kd))},po=function(e){for(var t=0,s=0,l=0;l<2;l+=1)t+=e.touches[l].clientX,s+=e.touches[l].clientY;var m=t/2,v=s/2;return{x:m,y:v}},Td=function(e,t){var s=mo(t);e.pinchStartDistance=s,e.lastDistance=s,e.pinchStartScale=e.transformState.scale,e.isPanning=!1;var l=po(t);e.pinchLastCenterX=l.x,e.pinchLastCenterY=l.y,ut(e)},Ld=function(e,t){var s=e.contentComponent,l=e.pinchStartDistance,m=e.wrapperComponent,v=e.transformState.scale,C=e.setup,r=C.limitToBounds,i=C.centerZoomedOut,c=C.zoomAnimation,f=C.alignmentAnimation,o=c.disabled,p=c.size;if(!(l===null||!s)){var x=wd(t,v,s);if(!(!Number.isFinite(x.x)||!Number.isFinite(x.y))){var S=mo(t),g=Ed(e,S),n=po(t),d=n.x-(e.pinchLastCenterX||0),h=n.y-(e.pinchLastCenterY||0);if(!(g===v&&d===0&&h===0)){e.pinchLastCenterX=n.x,e.pinchLastCenterY=n.y;var u=Bt(e,g),_=o||p===0||i,y=r&&_,w=Vs(e,x.x,x.y,g,u,y),E=w.x,b=w.y;e.pinchMidpoint=x,e.lastDistance=S;var R=f.sizeX,j=f.sizeY,M=Dt(e,R),L=Dt(e,j),T=E+d,B=b+h,I=ms(T,B,u,r,M,L,m),H=I.x,W=I.y;e.setTransformState(g,H,W)}}}},Md=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,oo(e,t?.x,t?.y)},vo=function(e,t){var s=e.props.onZoomStop,l=e.setup.doubleClick.animationTime;Rr(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Te(ke(e),t,s)},l)},Nd=function(e,t){var s=e.props,l=s.onZoomStart,m=s.onZoom,v=e.setup.doubleClick,C=v.animationTime,r=v.animationType;Te(ke(e),t,l),ho(e,C,r,function(){return Te(ke(e),t,m)}),vo(e,t)};function Pd(e,t){return e==="toggle"?t===1?1:-1:e==="zoomOut"?-1:1}function Od(e,t){var s=e.setup,l=e.doubleClickStopEventTimer,m=e.transformState,v=e.contentComponent,C=m.scale,r=e.props,i=r.onZoomStart,c=r.onZoom,f=s.doubleClick,o=f.disabled,p=f.mode,x=f.step,S=f.animationTime,g=f.animationType;if(!o&&!l){if(p==="reset")return Nd(e,t);if(!v)return console.error("No ContentComponent found");var n=Pd(p,e.transformState.scale),d=lo(e,n,x);if(C!==d){Te(ke(e),t,i);var h=fo(t,v,C),u=Yr(e,d,h.x,h.y);if(!u)return console.error("Error during zoom event. New transformation state was not calculated.");Te(ke(e),t,c),At(e,u,S,g),vo(e,t)}}}var Bd=function(e,t){var s=e.isInitialized,l=e.setup,m=e.wrapperComponent,v=l.doubleClick,C=v.disabled,r=v.excluded,i=t.target,c=m?.contains(i),f=s&&i&&c&&!C;if(!f)return!1;var o=Gs(i,r);return!o},Id=(function(){function e(t){var s=this;this.mounted=!0,this.pinchLastCenterX=null,this.pinchLastCenterY=null,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){s.initializeWindowEvents()},this.unmount=function(){s.cleanupWindowEvents()},this.update=function(l){s.props=l,Bt(s,s.transformState.scale),s.setup=zi(l)},this.initializeWindowEvents=function(){var l,m,v=mr(),C=(l=s.wrapperComponent)===null||l===void 0?void 0:l.ownerDocument,r=C?.defaultView;(m=s.wrapperComponent)===null||m===void 0||m.addEventListener("wheel",s.onWheelPanning,v),r?.addEventListener("mousedown",s.onPanningStart,v),r?.addEventListener("mousemove",s.onPanning,v),r?.addEventListener("mouseup",s.onPanningStop,v),C?.addEventListener("mouseleave",s.clearPanning,v),r?.addEventListener("keyup",s.setKeyUnPressed,v),r?.addEventListener("keydown",s.setKeyPressed,v)},this.cleanupWindowEvents=function(){var l,m,v=mr(),C=(l=s.wrapperComponent)===null||l===void 0?void 0:l.ownerDocument,r=C?.defaultView;r?.removeEventListener("mousedown",s.onPanningStart,v),r?.removeEventListener("mousemove",s.onPanning,v),r?.removeEventListener("mouseup",s.onPanningStop,v),C?.removeEventListener("mouseleave",s.clearPanning,v),r?.removeEventListener("keyup",s.setKeyUnPressed,v),r?.removeEventListener("keydown",s.setKeyPressed,v),document.removeEventListener("mouseleave",s.clearPanning,v),ut(s),(m=s.observer)===null||m===void 0||m.disconnect()},this.handleInitializeWrapperEvents=function(l){var m=mr();l.addEventListener("wheel",s.onWheelZoom,m),l.addEventListener("dblclick",s.onDoubleClick,m),l.addEventListener("touchstart",s.onTouchPanningStart,m),l.addEventListener("touchmove",s.onTouchPanning,m),l.addEventListener("touchend",s.onTouchPanningStop,m)},this.handleInitialize=function(l,m){var v=!1,C=s.setup.centerOnInit,r=function(i,c){for(var f=0,o=i;f<o.length;f++){var p=o[f];if(p.target===c)return!0}return!1};s.applyTransformation(),s.onInitCallbacks.forEach(function(i){i(ke(s))}),s.observer=new ResizeObserver(function(i){if(r(i,l)||r(i,m))if(C&&!v){var c=m.offsetWidth,f=m.offsetHeight;(c>0||f>0)&&(v=!0,s.setCenter())}else ut(s),Bt(s,s.transformState.scale),Xr(s,0)}),s.observer.observe(l),s.observer.observe(m)},this.onWheelZoom=function(l){var m=s.setup.disabled;if(!m){var v=gd(s,l);if(v){var C=s.isPressingKeys(s.setup.wheel.activationKeys);C&&(Dd(s,l),Ad(s,l),jd(s,l))}}},this.onWheelPanning=function(l){var m=s.setup,v=m.disabled,C=m.wheel,r=m.panning;if(!(!s.wrapperComponent||!s.contentComponent||v||!C.wheelDisabled||r.disabled||!r.wheelPanning||l.ctrlKey)){l.preventDefault(),l.stopPropagation();var i=s.transformState,c=i.positionX,f=i.positionY,o=c-l.deltaX,p=f-l.deltaY,x=r.lockAxisX?c:o,S=r.lockAxisY?f:p,g=s.setup.alignmentAnimation,n=g.sizeX,d=g.sizeY,h=Dt(s,n),u=Dt(s,d);x===c&&S===f||no(s,x,S,h,u)}},this.onPanningStart=function(l){var m=s.setup.disabled,v=s.props.onPanningStart;if(!m){var C=Pi(s,l);if(C){var r=s.isPressingKeys(s.setup.panning.activationKeys);r&&(l.button===0&&!s.setup.panning.allowLeftClickPan||l.button===1&&!s.setup.panning.allowMiddleClickPan||l.button===2&&!s.setup.panning.allowRightClickPan||(l.preventDefault(),l.stopPropagation(),ut(s),Ii(s,l),Te(ke(s),l,v)))}}},this.onPanning=function(l){var m=s.setup.disabled,v=s.props.onPanning;if(!m){var C=Oi(s);if(C){var r=s.isPressingKeys(s.setup.panning.activationKeys);r&&(l.preventDefault(),l.stopPropagation(),Fi(s,l.clientX,l.clientY),Te(ke(s),l,v))}}},this.onPanningStop=function(l){var m=s.props.onPanningStop;s.isPanning&&(od(s),Te(ke(s),l,m))},this.onPinchStart=function(l){var m=s.setup.disabled,v=s.props,C=v.onPinchingStart,r=v.onZoomStart;if(!m){var i=yd(s,l);i&&(Td(s,l),ut(s),Te(ke(s),l,C),Te(ke(s),l,r))}},this.onPinch=function(l){var m=s.setup.disabled,v=s.props,C=v.onPinching,r=v.onZoom;if(!m){var i=Cd(s);i&&(l.preventDefault(),l.stopPropagation(),Ld(s,l),Te(ke(s),l,C),Te(ke(s),l,r))}},this.onPinchStop=function(l){var m=s.props,v=m.onPinchingStop,C=m.onZoomStop;s.pinchStartScale&&(Md(s),Te(ke(s),l,v),Te(ke(s),l,C))},this.onTouchPanningStart=function(l){var m=s.setup.disabled,v=s.props.onPanningStart;if(!m){var C=Pi(s,l);if(C){var r=s.lastTouch&&+new Date-s.lastTouch<200&&l.touches.length===1;if(!r){s.lastTouch=+new Date,ut(s);var i=l.touches,c=i.length===1,f=i.length===2;c&&(ut(s),Ii(s,l),Te(ke(s),l,v)),f&&s.onPinchStart(l)}}}},this.onTouchPanning=function(l){var m=s.setup.disabled,v=s.props.onPanning;if(s.isPanning&&l.touches.length===1){if(m)return;var C=Oi(s);if(!C)return;l.preventDefault(),l.stopPropagation();var r=l.touches[0];Fi(s,r.clientX,r.clientY),Te(ke(s),l,v)}else l.touches.length>1&&s.onPinch(l)},this.onTouchPanningStop=function(l){s.onPanningStop(l),s.onPinchStop(l)},this.onDoubleClick=function(l){var m=s.setup.disabled;if(!m){var v=Bd(s,l);v&&Od(s,l)}},this.clearPanning=function(l){s.isPanning&&s.onPanningStop(l)},this.setKeyPressed=function(l){s.pressedKeys[l.key]=!0},this.setKeyUnPressed=function(l){s.pressedKeys[l.key]=!1},this.isPressingKeys=function(l){return l.length?!!l.find(function(m){return s.pressedKeys[m]}):!0},this.setTransformState=function(l,m,v){var C=s.props.onTransformed;if(!Number.isNaN(l)&&!Number.isNaN(m)&&!Number.isNaN(v)){l!==s.transformState.scale&&(s.transformState.previousScale=s.transformState.scale,s.transformState.scale=l),s.transformState.positionX=m,s.transformState.positionY=v,s.applyTransformation();var r=ke(s);s.onChangeCallbacks.forEach(function(i){return i(r)}),Te(r,{scale:l,positionX:m,positionY:v},C)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(s.wrapperComponent&&s.contentComponent){var l=uo(s.transformState.scale,s.wrapperComponent,s.contentComponent);s.setTransformState(l.scale,l.positionX,l.positionY)}},this.handleTransformStyles=function(l,m,v){return s.props.customTransform?s.props.customTransform(l,m,v):pd(l,m,v)},this.applyTransformation=function(){if(!(!s.mounted||!s.contentComponent)){var l=s.transformState,m=l.scale,v=l.positionX,C=l.positionY,r=s.handleTransformStyles(v,C,m);s.contentComponent.style.transform=r}},this.getContext=function(){return ke(s)},this.onChange=function(l){return s.onChangeCallbacks.has(l)||s.onChangeCallbacks.add(l),function(){s.onChangeCallbacks.delete(l)}},this.onInit=function(l){return s.onInitCallbacks.has(l)||s.onInitCallbacks.add(l),function(){s.onInitCallbacks.delete(l)}},this.init=function(l,m){s.cleanupWindowEvents(),s.wrapperComponent=l,s.contentComponent=m,Bt(s,s.transformState.scale),s.handleInitializeWrapperEvents(l),s.handleInitialize(l,m),s.initializeWindowEvents(),s.isInitialized=!0;var v=ke(s);Te(v,void 0,s.props.onInit)},this.props=t,this.setup=zi(this.props),this.transformState=ao(this.props)}return e})(),Qs=ee.createContext(null),Fd=function(e,t){return typeof e=="function"?e(t):e},Hd=ee.forwardRef(function(e,t){var s=k.useRef(new Id(e)).current,l=Fd(e.children,Ms(s));return k.useImperativeHandle(t,function(){return Ms(s)},[s]),k.useEffect(function(){s.update(e)},[s,e]),ee.createElement(Qs.Provider,{value:s},l)});ee.forwardRef(function(e,t){var s=k.useRef(null),l=k.useContext(Qs);return k.useEffect(function(){return l.onChange(function(m){if(s.current){var v=0,C=0;s.current.style.transform=l.handleTransformStyles(v,C,1/m.instance.transformState.scale)}})},[l]),ee.createElement("div",Rt({},e,{ref:vd([s,t])}))});function zd(e,t){t===void 0&&(t={});var s=t.insertAt;if(!(typeof document>"u")){var l=document.head||document.getElementsByTagName("head")[0],m=document.createElement("style");m.type="text/css",s==="top"&&l.firstChild?l.insertBefore(m,l.firstChild):l.appendChild(m),m.styleSheet?m.styleSheet.cssText=e:m.appendChild(document.createTextNode(e))}}var Wd=`.transform-component-module_wrapper__SPB86 {
|
|
31
|
+
`},Ni=Vh(Jh)(Yn),eu={config:Qh},tu=function(){for(var t=arguments.length,s=new Array(t),l=0;l<t;l++)s[l]=arguments[l];return function(m){return s.reduceRight(function(v,C){return C(v)},m)}};function Vn(e,t){return Object.keys(t).forEach(function(s){t[s]instanceof Object&&e[s]&&Object.assign(t[s],Vn(e[s],t[s]))}),Ti(Ti({},e),t)}var su={type:"cancelation",msg:"operation is manually canceled"};function ur(e){var t=!1,s=new Promise(function(l,m){e.then(function(v){return t?m(su):l(v)}),e.catch(m)});return s.cancel=function(){return t=!0},s}var ru=["monaco"],iu=Xh.create({config:Yh,isInitialized:!1,resolve:null,reject:null,monaco:null}),Gn=Ah(iu,2),fs=Gn[0],Ys=Gn[1];function nu(e){var t=eu.config(e),s=t.monaco,l=Rh(t,ru);Ys(function(m){return{config:Vn(m.config,l),monaco:s}})}function ou(){var e=fs(function(t){var s=t.monaco,l=t.isInitialized,m=t.resolve;return{monaco:s,isInitialized:l,resolve:m}});if(!e.isInitialized){if(Ys({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),ur(dr);if(window.monaco&&window.monaco.editor)return Qn(window.monaco),e.resolve(window.monaco),ur(dr);tu(au,cu)(hu)}return ur(dr)}function au(e){return document.body.appendChild(e)}function lu(e){var t=document.createElement("script");return e&&(t.src=e),t}function cu(e){var t=fs(function(l){var m=l.config,v=l.reject;return{config:m,reject:v}}),s=lu("".concat(t.config.paths.vs,"/loader.js"));return s.onload=function(){return e()},s.onerror=t.reject,s}function hu(){var e=fs(function(s){var l=s.config,m=s.resolve,v=s.reject;return{config:l,resolve:m,reject:v}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(s){var l=s.m||s;Qn(l),e.resolve(l)},function(s){e.reject(s)})}function Qn(e){fs().monaco||Ys({monaco:e})}function uu(){return fs(function(e){var t=e.monaco;return t})}var dr=new Promise(function(e,t){return Ys({resolve:e,reject:t})}),Zn={config:nu,init:ou,__getMonacoInstance:uu},du={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},fr=du,fu={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},mu=fu;function pu({children:e}){return ee.createElement("div",{style:mu.container},e)}var vu=pu,gu=vu;function _u({width:e,height:t,isEditorReady:s,loading:l,_ref:m,className:v,wrapperProps:C}){return ee.createElement("section",{style:{...fr.wrapper,width:e,height:t},...C},!s&&ee.createElement(gu,null,l),ee.createElement("div",{ref:m,style:{...fr.fullWidth,...!s&&fr.hide},className:v}))}var bu=_u,Jn=k.memo(bu);function xu(e){k.useEffect(e,[])}var eo=xu;function Su(e,t,s=!0){let l=k.useRef(!0);k.useEffect(l.current||!s?()=>{l.current=!1}:e,t)}var it=Su;function ts(){}function Wt(e,t,s,l){return yu(e,l)||Cu(e,t,s,l)}function yu(e,t){return e.editor.getModel(to(e,t))}function Cu(e,t,s,l){return e.editor.createModel(t,s,l?to(e,l):void 0)}function to(e,t){return e.Uri.parse(t)}function wu({original:e,modified:t,language:s,originalLanguage:l,modifiedLanguage:m,originalModelPath:v,modifiedModelPath:C,keepCurrentOriginalModel:r=!1,keepCurrentModifiedModel:i=!1,theme:c="light",loading:f="Loading...",options:o={},height:p="100%",width:x="100%",className:S,wrapperProps:g={},beforeMount:n=ts,onMount:d=ts}){let[h,u]=k.useState(!1),[_,y]=k.useState(!0),w=k.useRef(null),E=k.useRef(null),b=k.useRef(null),R=k.useRef(d),j=k.useRef(n),M=k.useRef(!1);eo(()=>{let I=Zn.init();return I.then(H=>(E.current=H)&&y(!1)).catch(H=>H?.type!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>w.current?B():I.cancel()}),it(()=>{if(w.current&&E.current){let I=w.current.getOriginalEditor(),H=Wt(E.current,e||"",l||s||"text",v||"");H!==I.getModel()&&I.setModel(H)}},[v],h),it(()=>{if(w.current&&E.current){let I=w.current.getModifiedEditor(),H=Wt(E.current,t||"",m||s||"text",C||"");H!==I.getModel()&&I.setModel(H)}},[C],h),it(()=>{let I=w.current.getModifiedEditor();I.getOption(E.current.editor.EditorOption.readOnly)?I.setValue(t||""):t!==I.getValue()&&(I.executeEdits("",[{range:I.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),I.pushUndoStop())},[t],h),it(()=>{w.current?.getModel()?.original.setValue(e||"")},[e],h),it(()=>{let{original:I,modified:H}=w.current.getModel();E.current.editor.setModelLanguage(I,l||s||"text"),E.current.editor.setModelLanguage(H,m||s||"text")},[s,l,m],h),it(()=>{E.current?.editor.setTheme(c)},[c],h),it(()=>{w.current?.updateOptions(o)},[o],h);let L=k.useCallback(()=>{if(!E.current)return;j.current(E.current);let I=Wt(E.current,e||"",l||s||"text",v||""),H=Wt(E.current,t||"",m||s||"text",C||"");w.current?.setModel({original:I,modified:H})},[s,t,m,e,l,v,C]),T=k.useCallback(()=>{!M.current&&b.current&&(w.current=E.current.editor.createDiffEditor(b.current,{automaticLayout:!0,...o}),L(),E.current?.editor.setTheme(c),u(!0),M.current=!0)},[o,c,L]);k.useEffect(()=>{h&&R.current(w.current,E.current)},[h]),k.useEffect(()=>{!_&&!h&&T()},[_,h,T]);function B(){let I=w.current?.getModel();r||I?.original?.dispose(),i||I?.modified?.dispose(),w.current?.dispose()}return ee.createElement(Jn,{width:x,height:p,isEditorReady:h,loading:f,_ref:b,className:S,wrapperProps:g})}var Eu=wu;k.memo(Eu);function ku(e){let t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}var Ru=ku,bs=new Map;function Du({defaultValue:e,defaultLanguage:t,defaultPath:s,value:l,language:m,path:v,theme:C="light",line:r,loading:i="Loading...",options:c={},overrideServices:f={},saveViewState:o=!0,keepCurrentModel:p=!1,width:x="100%",height:S="100%",className:g,wrapperProps:n={},beforeMount:d=ts,onMount:h=ts,onChange:u,onValidate:_=ts}){let[y,w]=k.useState(!1),[E,b]=k.useState(!0),R=k.useRef(null),j=k.useRef(null),M=k.useRef(null),L=k.useRef(h),T=k.useRef(d),B=k.useRef(),I=k.useRef(l),H=Ru(v),W=k.useRef(!1),A=k.useRef(!1);eo(()=>{let O=Zn.init();return O.then($=>(R.current=$)&&b(!1)).catch($=>$?.type!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>j.current?P():O.cancel()}),it(()=>{let O=Wt(R.current,e||l||"",t||m||"",v||s||"");O!==j.current?.getModel()&&(o&&bs.set(H,j.current?.saveViewState()),j.current?.setModel(O),o&&j.current?.restoreViewState(bs.get(v)))},[v],y),it(()=>{j.current?.updateOptions(c)},[c],y),it(()=>{!j.current||l===void 0||(j.current.getOption(R.current.editor.EditorOption.readOnly)?j.current.setValue(l):l!==j.current.getValue()&&(A.current=!0,j.current.executeEdits("",[{range:j.current.getModel().getFullModelRange(),text:l,forceMoveMarkers:!0}]),j.current.pushUndoStop(),A.current=!1))},[l],y),it(()=>{let O=j.current?.getModel();O&&m&&R.current?.editor.setModelLanguage(O,m)},[m],y),it(()=>{r!==void 0&&j.current?.revealLine(r)},[r],y),it(()=>{R.current?.editor.setTheme(C)},[C],y);let N=k.useCallback(()=>{if(!(!M.current||!R.current)&&!W.current){T.current(R.current);let O=v||s,$=Wt(R.current,l||e||"",t||m||"",O||"");j.current=R.current?.editor.create(M.current,{model:$,automaticLayout:!0,...c},f),o&&j.current.restoreViewState(bs.get(O)),R.current.editor.setTheme(C),r!==void 0&&j.current.revealLine(r),w(!0),W.current=!0}},[e,t,s,l,m,v,c,f,o,C,r]);k.useEffect(()=>{y&&L.current(j.current,R.current)},[y]),k.useEffect(()=>{!E&&!y&&N()},[E,y,N]),I.current=l,k.useEffect(()=>{y&&u&&(B.current?.dispose(),B.current=j.current?.onDidChangeModelContent(O=>{A.current||u(j.current.getValue(),O)}))},[y,u]),k.useEffect(()=>{if(y){let O=R.current.editor.onDidChangeMarkers($=>{let X=j.current.getModel()?.uri;if(X&&$.find(K=>K.path===X.path)){let K=R.current.editor.getModelMarkers({resource:X});_?.(K)}});return()=>{O?.dispose()}}return()=>{}},[y,_]);function P(){B.current?.dispose(),p?o&&bs.set(v,j.current.saveViewState()):j.current.getModel()?.dispose(),j.current.dispose()}return ee.createElement(Jn,{width:x,height:S,isEditorReady:y,loading:i,_ref:M,className:g,wrapperProps:n})}var Au=Du,ju=k.memo(Au),Tu=ju,ct=function(e,t){return Number(e.toFixed(t))},Lu=function(e,t){return typeof e=="number"?e:t},Te=function(e,t,s){s&&typeof s=="function"&&s(e,t)},Mu=function(e){return-Math.cos(e*Math.PI)/2+.5},Nu=function(e){return e},Pu=function(e){return e*e},Ou=function(e){return e*(2-e)},Bu=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},Iu=function(e){return e*e*e},Fu=function(e){return--e*e*e+1},Hu=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},zu=function(e){return e*e*e*e},Wu=function(e){return 1- --e*e*e*e},$u=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},Uu=function(e){return e*e*e*e*e},qu=function(e){return 1+--e*e*e*e*e},Ku=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},so={easeOut:Mu,linear:Nu,easeInQuad:Pu,easeOutQuad:Ou,easeInOutQuad:Bu,easeInCubic:Iu,easeOutCubic:Fu,easeInOutCubic:Hu,easeInQuart:zu,easeOutQuart:Wu,easeInOutQuart:$u,easeInQuint:Uu,easeOutQuint:qu,easeInOutQuint:Ku},ro=function(e){typeof e=="number"&&cancelAnimationFrame(e)},ut=function(e){e.mounted&&(ro(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function io(e,t,s,l){if(e.mounted){var m=new Date().getTime(),v=1;ut(e),e.animation=function(){if(!e.mounted)return ro(e.animation);var C=new Date().getTime()-m,r=C/s,i=so[t],c=i(r);C>=s?(l(v),e.animation=null):e.animation&&(l(c),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function Xu(e){var t=e.scale,s=e.positionX,l=e.positionY;return!(Number.isNaN(t)||Number.isNaN(s)||Number.isNaN(l))}function At(e,t,s,l){var m=Xu(t);if(!(!e.mounted||!m)){var v=e.setTransformState,C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY,f=t.scale-r,o=t.positionX-i,p=t.positionY-c;s===0?v(t.scale,t.positionX,t.positionY):io(e,l,s,function(x){var S=r+f*x,g=i+o*x,n=c+p*x;v(S,g,n)})}}function Yu(e,t,s){var l=e.offsetWidth,m=e.offsetHeight,v=t.offsetWidth,C=t.offsetHeight,r=v*s,i=C*s,c=l-r,f=m-i;return{wrapperWidth:l,wrapperHeight:m,newContentWidth:r,newDiffWidth:c,newContentHeight:i,newDiffHeight:f}}var Vu=function(e,t,s,l,m,v,C){var r=e>t?s*(C?1:.5):0,i=l>m?v*(C?1:.5):0,c=e-t-r,f=r,o=l-m-i,p=i;return{minPositionX:c,maxPositionX:f,minPositionY:o,maxPositionY:p}},Xr=function(e,t){var s=e.wrapperComponent,l=e.contentComponent,m=e.setup.centerZoomedOut;if(!s||!l)throw new Error("Components are not mounted");var v=Yu(s,l,t),C=v.wrapperWidth,r=v.wrapperHeight,i=v.newContentWidth,c=v.newDiffWidth,f=v.newContentHeight,o=v.newDiffHeight,p=Vu(C,i,c,r,f,o,!!m);return p},Er=function(e,t,s,l){return l?e<t?ct(t,2):e>s?ct(s,2):ct(e,2):ct(e,2)},Bt=function(e,t){var s=Xr(e,t);return e.bounds=s,s};function ms(e,t,s,l,m,v,C){var r=s.minPositionX,i=s.minPositionY,c=s.maxPositionX,f=s.maxPositionY,o=0,p=0;C&&(o=m,p=v);var x=Er(e,r-o,c+o,l),S=Er(t,i-p,f+p,l);return{x,y:S}}function Vs(e,t,s,l,m,v){var C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY,f=l-r;if(typeof t!="number"||typeof s!="number")return console.error("Mouse X and Y position were not provided!"),{x:i,y:c};var o=i-t*f,p=c-s*f,x=ms(o,p,m,v,0,0,null);return x}function ps(e,t,s,l,m){var v=m?l:0,C=t-v;return!Number.isNaN(s)&&e>=s?s:!Number.isNaN(t)&&e<=C?C:e}var Pi=function(e,t){var s=e.setup.panning.excluded,l=e.isInitialized,m=e.wrapperComponent,v=t.target,C="shadowRoot"in v&&"composedPath"in t,r=C?t.composedPath().some(function(f){return f instanceof Element?m?.contains(f):!1}):m?.contains(v),i=l&&v&&r;if(!i)return!1;var c=Gs(v,s);return!c},Oi=function(e){var t=e.isInitialized,s=e.isPanning,l=e.setup,m=l.panning.disabled,v=t&&s&&!m;return!!v},Gu=function(e,t){var s=e.transformState,l=s.positionX,m=s.positionY;e.isPanning=!0;var v=t.clientX,C=t.clientY;e.startCoords={x:v-l,y:C-m}},Qu=function(e,t){var s=t.touches,l=e.transformState,m=l.positionX,v=l.positionY;e.isPanning=!0;var C=s.length===1;if(C){var r=s[0].clientX,i=s[0].clientY;e.startCoords={x:r-m,y:i-v}}};function Zu(e){var t=e.transformState,s=t.positionX,l=t.positionY,m=t.scale,v=e.setup,C=v.disabled,r=v.limitToBounds,i=v.centerZoomedOut,c=e.wrapperComponent;if(!(C||!c||!e.bounds)){var f=e.bounds,o=f.maxPositionX,p=f.minPositionX,x=f.maxPositionY,S=f.minPositionY,g=s>o||s<p,n=l>x||l<S,d=s>o?c.offsetWidth:e.setup.minPositionX||0,h=l>x?c.offsetHeight:e.setup.minPositionY||0,u=Vs(e,d,h,m,e.bounds,r||i),_=u.x,y=u.y;return{scale:m,positionX:g?_:s,positionY:n?y:l}}}function no(e,t,s,l,m){var v=e.setup.limitToBounds,C=e.wrapperComponent,r=e.bounds,i=e.transformState,c=i.scale,f=i.positionX,o=i.positionY;if(!(C===null||r===null||t===f&&s===o)){var p=ms(t,s,r,v,l,m,C),x=p.x,S=p.y;e.setTransformState(c,x,S)}}var Ju=function(e,t,s){var l=e.startCoords,m=e.transformState,v=e.setup.panning,C=v.lockAxisX,r=v.lockAxisY,i=m.positionX,c=m.positionY;if(!l)return{x:i,y:c};var f=t-l.x,o=s-l.y,p=C?i:f,x=r?c:o;return{x:p,y:x}},Dt=function(e,t){var s=e.setup,l=e.transformState,m=l.scale,v=s.minScale,C=s.disablePadding;return t>0&&m>=v&&!C?t:0},ed=function(e){var t=e.mounted,s=e.setup,l=s.disabled,m=s.velocityAnimation,v=e.transformState.scale,C=m.disabled,r=!C||v>1||!l||t;return!!r},td=function(e){var t=e.mounted,s=e.velocity,l=e.bounds,m=e.setup,v=m.disabled,C=m.velocityAnimation,r=e.transformState.scale,i=C.disabled,c=!i||r>1||!v||t;return!(!c||!s||!l)};function sd(e,t){var s=e.setup.velocityAnimation,l=s.equalToMove,m=s.animationTime,v=s.sensitivity;return l?m*t*v:m}function Bi(e,t,s,l,m,v,C,r,i,c){if(m){if(t>C&&s>C){var f=C+(e-C)*c;return f>i?i:f<C?C:f}if(t<v&&s<v){var f=v+(e-v)*c;return f<r?r:f>v?v:f}}return l?t:Er(e,v,C,m)}function rd(e,t){var s=1;return t?Math.min(s,e.offsetWidth/window.innerWidth):s}function id(e,t){var s=ed(e);if(s){var l=e.lastMousePosition,m=e.velocityTime,v=e.setup,C=e.wrapperComponent,r=v.velocityAnimation.equalToMove,i=Date.now();if(l&&m&&C){var c=rd(C,r),f=t.x-l.x,o=t.y-l.y,p=f/c,x=o/c,S=i-m,g=f*f+o*o,n=Math.sqrt(g)/S;e.velocity={velocityX:p,velocityY:x,total:n}}e.lastMousePosition=t,e.velocityTime=i}}function nd(e){var t=e.velocity,s=e.bounds,l=e.setup,m=e.wrapperComponent,v=td(e);if(!(!v||!t||!s||!m)){var C=t.velocityX,r=t.velocityY,i=t.total,c=s.maxPositionX,f=s.minPositionX,o=s.maxPositionY,p=s.minPositionY,x=l.limitToBounds,S=l.alignmentAnimation,g=l.zoomAnimation,n=l.panning,d=n.lockAxisY,h=n.lockAxisX,u=g.animationType,_=S.sizeX,y=S.sizeY,w=S.velocityAlignmentTime,E=w,b=sd(e,i),R=Math.max(b,E),j=Dt(e,_),M=Dt(e,y),L=j*m.offsetWidth/100,T=M*m.offsetHeight/100,B=c+L,I=f-L,H=o+T,W=p-T,A=e.transformState,N=new Date().getTime();io(e,u,R,function(P){var O=e.transformState,$=O.scale,X=O.positionX,K=O.positionY,Q=new Date().getTime()-N,se=Q/E,D=so[S.animationType],F=1-D(Math.min(1,se)),q=1-P,z=X+C*q,te=K+r*q,Y=Bi(z,A.positionX,X,h,x,f,c,I,B,F),ie=Bi(te,A.positionY,K,d,x,p,o,W,H,F);(X!==z||K!==te)&&e.setTransformState($,Y,ie)})}}function Ii(e,t){var s=e.transformState.scale;ut(e),Bt(e,s),window.TouchEvent!==void 0&&t instanceof TouchEvent?Qu(e,t):Gu(e,t)}function Yr(e,t){var s=e.transformState.scale,l=e.setup,m=l.minScale,v=l.alignmentAnimation,C=v.disabled,r=v.sizeX,i=v.sizeY,c=v.animationTime,f=v.animationType,o=C||s<m||!r&&!i;if(!o){var p=Zu(e);p&&At(e,p,t??c,f)}}function Fi(e,t,s){var l=e.startCoords,m=e.setup,v=m.alignmentAnimation,C=v.sizeX,r=v.sizeY;if(l){var i=Ju(e,t,s),c=i.x,f=i.y,o=Dt(e,C),p=Dt(e,r);id(e,{x:c,y:f}),no(e,c,f,o,p)}}function od(e){if(e.isPanning){var t=e.setup.panning.velocityDisabled,s=e.velocity,l=e.wrapperComponent,m=e.contentComponent;e.isPanning=!1,e.animate=!1,e.animation=null;var v=l?.getBoundingClientRect(),C=m?.getBoundingClientRect(),r=v?.width||0,i=v?.height||0,c=C?.width||0,f=C?.height||0,o=r<c||i<f,p=!t&&s&&s?.total>.1&&o;p?nd(e):Yr(e)}}function Vr(e,t,s,l){var m=e.setup,v=m.minScale,C=m.maxScale,r=m.limitToBounds,i=ps(ct(t,2),v,C,0,!1),c=Bt(e,i),f=Vs(e,s,l,i,c,r),o=f.x,p=f.y;return{scale:i,positionX:o,positionY:p}}function oo(e,t,s){var l=e.transformState.scale,m=e.wrapperComponent,v=e.setup,C=v.minScale,r=v.limitToBounds,i=v.zoomAnimation,c=i.disabled,f=i.animationTime,o=i.animationType,p=c||l>=C;if((l>=1||r)&&Yr(e),!(p||!m||!e.mounted)){var x=t||m.offsetWidth/2,S=s||m.offsetHeight/2,g=Vr(e,C,x,S);g&&At(e,g,f,o)}}var Rt=function(){return Rt=Object.assign||function(t){for(var s,l=1,m=arguments.length;l<m;l++){s=arguments[l];for(var v in s)Object.prototype.hasOwnProperty.call(s,v)&&(t[v]=s[v])}return t},Rt.apply(this,arguments)};function Hi(e,t,s){for(var l=0,m=t.length,v;l<m;l++)(v||!(l in t))&&(v||(v=Array.prototype.slice.call(t,0,l)),v[l]=t[l]);return e.concat(v||Array.prototype.slice.call(t))}var xs={scale:1,positionX:0,positionY:0},Vt={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,disablePadding:!1,smooth:!0,wheel:{step:.2,disabled:!1,smoothStep:.001,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,wheelPanning:!1,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},alignmentAnimation:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivity:1,animationTime:400,animationType:"easeOut",equalToMove:!0}},kr={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},ao=function(e){var t,s,l,m;return{previousScale:(t=e.initialScale)!==null&&t!==void 0?t:xs.scale,scale:(s=e.initialScale)!==null&&s!==void 0?s:xs.scale,positionX:(l=e.initialPositionX)!==null&&l!==void 0?l:xs.positionX,positionY:(m=e.initialPositionY)!==null&&m!==void 0?m:xs.positionY}},zi=function(e){var t=Rt({},Vt);return Object.keys(e).forEach(function(s){var l=typeof e[s]<"u",m=typeof Vt[s]<"u";if(m&&l){var v=Object.prototype.toString.call(Vt[s]),C=v==="[object Object]",r=v==="[object Array]";C?t[s]=Rt(Rt({},Vt[s]),e[s]):r?t[s]=Hi(Hi([],Vt[s],!0),e[s]):t[s]=e[s]}}),t},lo=function(e,t,s){var l=e.transformState.scale,m=e.wrapperComponent,v=e.setup,C=v.maxScale,r=v.minScale,i=v.zoomAnimation,c=v.smooth,f=i.size;if(!m)throw new Error("Wrapper is not mounted");var o=c?l*Math.exp(t*s):l+t*s,p=ps(ct(o,3),r,C,f,!1);return p};function co(e,t,s,l,m){var v=e.wrapperComponent,C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY;if(!v)return console.error("No WrapperComponent found");var f=v.offsetWidth,o=v.offsetHeight,p=(f/2-i)/r,x=(o/2-c)/r,S=lo(e,t,s),g=Vr(e,S,p,x);if(!g)return console.error("Error during zoom event. New transformation state was not calculated.");At(e,g,l,m)}function ho(e,t,s,l){var m=e.setup,v=e.wrapperComponent,C=m.limitToBounds,r=ao(e.props),i=e.transformState,c=i.scale,f=i.positionX,o=i.positionY;if(v){var p=Xr(e,r.scale),x=ms(r.positionX,r.positionY,p,C,0,0,v),S={scale:r.scale,positionX:x.x,positionY:x.y};c===r.scale&&f===r.positionX&&o===r.positionY||(l?.(),At(e,S,t,s))}}function ad(e,t,s,l){var m=e.getBoundingClientRect(),v=t.getBoundingClientRect(),C=s.getBoundingClientRect(),r=v.x*l.scale,i=v.y*l.scale;return{x:(m.x-C.x+r)/l.scale,y:(m.y-C.y+i)/l.scale}}function ld(e,t,s){var l=e.wrapperComponent,m=e.contentComponent,v=e.transformState,C=e.setup,r=C.limitToBounds,i=C.minScale,c=C.maxScale;if(!l||!m)return v;var f=l.getBoundingClientRect(),o=t.getBoundingClientRect(),p=ad(t,l,m,v),x=p.x,S=p.y,g=o.width/v.scale,n=o.height/v.scale,d=l.offsetWidth/g,h=l.offsetHeight/n,u=ps(s||Math.min(d,h),i,c,0,!1),_=(f.width-g*u)/2,y=(f.height-n*u)/2,w=(f.left-x)*u+_,E=(f.top-S)*u+y,b=Xr(e,u),R=ms(w,E,b,r,0,0,l),j=R.x,M=R.y;return{positionX:j,positionY:M,scale:u}}var cd=function(e){return function(t,s,l){t===void 0&&(t=.5),s===void 0&&(s=300),l===void 0&&(l="easeOut"),co(e,1,t,s,l)}},hd=function(e){return function(t,s,l){t===void 0&&(t=.5),s===void 0&&(s=300),l===void 0&&(l="easeOut"),co(e,-1,t,s,l)}},ud=function(e){return function(t,s,l,m,v){m===void 0&&(m=300),v===void 0&&(v="easeOut");var C=e.transformState,r=C.positionX,i=C.positionY,c=C.scale,f=e.wrapperComponent,o=e.contentComponent,p=e.setup.disabled;if(!(p||!f||!o)){var x={positionX:Number.isNaN(t)?r:t,positionY:Number.isNaN(s)?i:s,scale:Number.isNaN(l)?c:l};At(e,x,m,v)}}},dd=function(e){return function(t,s){t===void 0&&(t=200),s===void 0&&(s="easeOut"),ho(e,t,s)}},fd=function(e){return function(t,s,l){s===void 0&&(s=200),l===void 0&&(l="easeOut");var m=e.transformState,v=e.wrapperComponent,C=e.contentComponent;if(v&&C){var r=uo(t||m.scale,v,C);At(e,r,s,l)}}},md=function(e){return function(t,s,l,m){l===void 0&&(l=600),m===void 0&&(m="easeOut"),ut(e);var v=e.wrapperComponent,C=typeof t=="string"?document.getElementById(t):t;if(v&&C&&v.contains(C)){var r=ld(e,C,s);At(e,r,l,m)}}},Ms=function(e){return{instance:e,zoomIn:cd(e),zoomOut:hd(e),setTransform:ud(e),resetTransform:dd(e),centerView:fd(e),zoomToElement:md(e)}},Rr=function(e){return{instance:e,state:e.transformState}},ke=function(e){var t={};return Object.assign(t,Rr(e)),Object.assign(t,Ms(e)),t},mr=!1;function pr(){try{var e={get passive(){return mr=!0,!1}};return e}catch{return mr=!1,mr}}var Ss=".".concat(kr.wrapperClass),Gs=function(e,t){return t.some(function(s){return e.matches("".concat(Ss," ").concat(s,", ").concat(Ss," .").concat(s,", ").concat(Ss," ").concat(s," *, ").concat(Ss," .").concat(s," *"))})},Dr=function(e){e&&clearTimeout(e)},pd=function(e,t,s){return"translate(".concat(e,"px, ").concat(t,"px) scale(").concat(s,")")},uo=function(e,t,s){var l=s.offsetWidth*e,m=s.offsetHeight*e,v=(t.offsetWidth-l)/2,C=(t.offsetHeight-m)/2;return{scale:e,positionX:v,positionY:C}};function vd(e){return function(t){e.forEach(function(s){typeof s=="function"?s(t):s!=null&&(s.current=t)})}}var gd=function(e,t){var s=e.setup.wheel,l=s.disabled,m=s.wheelDisabled,v=s.touchPadDisabled,C=s.excluded,r=e.isInitialized,i=e.isPanning,c=t.target,f=r&&!i&&!l&&c;if(!f||m&&!t.ctrlKey||v&&t.ctrlKey)return!1;var o=Gs(c,C);return!o},_d=function(e){return e?e.deltaY<0?1:-1:0};function bd(e,t){var s=_d(e),l=Lu(t,s);return l}function fo(e,t,s){var l=t.getBoundingClientRect(),m=0,v=0;if("clientX"in e)m=(e.clientX-l.left)/s,v=(e.clientY-l.top)/s;else{var C=e.touches[0];m=(C.clientX-l.left)/s,v=(C.clientY-l.top)/s}return(Number.isNaN(m)||Number.isNaN(v))&&console.error("No mouse or touch offset found"),{x:m,y:v}}var xd=function(e,t,s,l,m){var v=e.transformState.scale,C=e.wrapperComponent,r=e.setup,i=r.maxScale,c=r.minScale,f=r.zoomAnimation,o=r.disablePadding,p=f.size,x=f.disabled;if(!C)throw new Error("Wrapper is not mounted");var S=v+t*s,g=l?!1:!x,n=ps(ct(S,3),c,i,p,g&&!o);return n},Sd=function(e,t){var s=e.previousWheelEvent,l=e.transformState.scale,m=e.setup,v=m.maxScale,C=m.minScale;return s?l<v||l>C||Math.sign(s.deltaY)!==Math.sign(t.deltaY)||s.deltaY>0&&s.deltaY<t.deltaY||s.deltaY<0&&s.deltaY>t.deltaY||Math.sign(s.deltaY)!==Math.sign(t.deltaY):!1},yd=function(e,t){var s=e.setup.pinch,l=s.disabled,m=s.excluded,v=e.isInitialized,C=t.target,r=v&&!l&&C;if(!r)return!1;var i=Gs(C,m);return!i},Cd=function(e){var t=e.setup.pinch.disabled,s=e.isInitialized,l=e.pinchStartDistance,m=s&&!t&&l;return!!m},wd=function(e,t,s){var l=s.getBoundingClientRect(),m=e.touches,v=ct(m[0].clientX-l.left,5),C=ct(m[0].clientY-l.top,5),r=ct(m[1].clientX-l.left,5),i=ct(m[1].clientY-l.top,5);return{x:(v+r)/2/t,y:(C+i)/2/t}},mo=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},Ed=function(e,t){var s=e.pinchStartScale,l=e.pinchStartDistance,m=e.setup,v=m.maxScale,C=m.minScale,r=m.zoomAnimation,i=m.disablePadding,c=r.size,f=r.disabled;if(!s||l===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var o=t/l,p=o*s;return ps(ct(p,2),C,v,c,!f&&!i)},kd=160,Rd=100,Dd=function(e,t){var s=e.props,l=s.onWheelStart,m=s.onZoomStart;e.wheelStopEventTimer||(ut(e),Te(ke(e),t,l),Te(ke(e),t,m))},Ad=function(e,t){var s=e.props,l=s.onWheel,m=s.onZoom,v=e.contentComponent,C=e.setup,r=e.transformState,i=r.scale,c=C.limitToBounds,f=C.centerZoomedOut,o=C.zoomAnimation,p=C.wheel,x=C.disablePadding,S=C.smooth,g=o.size,n=o.disabled,d=p.step,h=p.smoothStep;if(!v)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var u=bd(t,null),_=S?h*Math.abs(t.deltaY):d,y=xd(e,u,_,!t.ctrlKey);if(i!==y){var w=Bt(e,y),E=fo(t,v,i),b=n||g===0||f||x,R=c&&b,j=Vs(e,E.x,E.y,y,w,R),M=j.x,L=j.y;e.previousWheelEvent=t,e.setTransformState(y,M,L),Te(ke(e),t,l),Te(ke(e),t,m)}},jd=function(e,t){var s=e.props,l=s.onWheelStop,m=s.onZoomStop;Dr(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(oo(e,t.x,t.y),e.wheelAnimationTimer=null)},Rd);var v=Sd(e,t);v&&(Dr(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Te(ke(e),t,l),Te(ke(e),t,m))},kd))},po=function(e){for(var t=0,s=0,l=0;l<2;l+=1)t+=e.touches[l].clientX,s+=e.touches[l].clientY;var m=t/2,v=s/2;return{x:m,y:v}},Td=function(e,t){var s=mo(t);e.pinchStartDistance=s,e.lastDistance=s,e.pinchStartScale=e.transformState.scale,e.isPanning=!1;var l=po(t);e.pinchLastCenterX=l.x,e.pinchLastCenterY=l.y,ut(e)},Ld=function(e,t){var s=e.contentComponent,l=e.pinchStartDistance,m=e.wrapperComponent,v=e.transformState.scale,C=e.setup,r=C.limitToBounds,i=C.centerZoomedOut,c=C.zoomAnimation,f=C.alignmentAnimation,o=c.disabled,p=c.size;if(!(l===null||!s)){var x=wd(t,v,s);if(!(!Number.isFinite(x.x)||!Number.isFinite(x.y))){var S=mo(t),g=Ed(e,S),n=po(t),d=n.x-(e.pinchLastCenterX||0),h=n.y-(e.pinchLastCenterY||0);if(!(g===v&&d===0&&h===0)){e.pinchLastCenterX=n.x,e.pinchLastCenterY=n.y;var u=Bt(e,g),_=o||p===0||i,y=r&&_,w=Vs(e,x.x,x.y,g,u,y),E=w.x,b=w.y;e.pinchMidpoint=x,e.lastDistance=S;var R=f.sizeX,j=f.sizeY,M=Dt(e,R),L=Dt(e,j),T=E+d,B=b+h,I=ms(T,B,u,r,M,L,m),H=I.x,W=I.y;e.setTransformState(g,H,W)}}}},Md=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,oo(e,t?.x,t?.y)},vo=function(e,t){var s=e.props.onZoomStop,l=e.setup.doubleClick.animationTime;Dr(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Te(ke(e),t,s)},l)},Nd=function(e,t){var s=e.props,l=s.onZoomStart,m=s.onZoom,v=e.setup.doubleClick,C=v.animationTime,r=v.animationType;Te(ke(e),t,l),ho(e,C,r,function(){return Te(ke(e),t,m)}),vo(e,t)};function Pd(e,t){return e==="toggle"?t===1?1:-1:e==="zoomOut"?-1:1}function Od(e,t){var s=e.setup,l=e.doubleClickStopEventTimer,m=e.transformState,v=e.contentComponent,C=m.scale,r=e.props,i=r.onZoomStart,c=r.onZoom,f=s.doubleClick,o=f.disabled,p=f.mode,x=f.step,S=f.animationTime,g=f.animationType;if(!o&&!l){if(p==="reset")return Nd(e,t);if(!v)return console.error("No ContentComponent found");var n=Pd(p,e.transformState.scale),d=lo(e,n,x);if(C!==d){Te(ke(e),t,i);var h=fo(t,v,C),u=Vr(e,d,h.x,h.y);if(!u)return console.error("Error during zoom event. New transformation state was not calculated.");Te(ke(e),t,c),At(e,u,S,g),vo(e,t)}}}var Bd=function(e,t){var s=e.isInitialized,l=e.setup,m=e.wrapperComponent,v=l.doubleClick,C=v.disabled,r=v.excluded,i=t.target,c=m?.contains(i),f=s&&i&&c&&!C;if(!f)return!1;var o=Gs(i,r);return!o},Id=(function(){function e(t){var s=this;this.mounted=!0,this.pinchLastCenterX=null,this.pinchLastCenterY=null,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){s.initializeWindowEvents()},this.unmount=function(){s.cleanupWindowEvents()},this.update=function(l){s.props=l,Bt(s,s.transformState.scale),s.setup=zi(l)},this.initializeWindowEvents=function(){var l,m,v=pr(),C=(l=s.wrapperComponent)===null||l===void 0?void 0:l.ownerDocument,r=C?.defaultView;(m=s.wrapperComponent)===null||m===void 0||m.addEventListener("wheel",s.onWheelPanning,v),r?.addEventListener("mousedown",s.onPanningStart,v),r?.addEventListener("mousemove",s.onPanning,v),r?.addEventListener("mouseup",s.onPanningStop,v),C?.addEventListener("mouseleave",s.clearPanning,v),r?.addEventListener("keyup",s.setKeyUnPressed,v),r?.addEventListener("keydown",s.setKeyPressed,v)},this.cleanupWindowEvents=function(){var l,m,v=pr(),C=(l=s.wrapperComponent)===null||l===void 0?void 0:l.ownerDocument,r=C?.defaultView;r?.removeEventListener("mousedown",s.onPanningStart,v),r?.removeEventListener("mousemove",s.onPanning,v),r?.removeEventListener("mouseup",s.onPanningStop,v),C?.removeEventListener("mouseleave",s.clearPanning,v),r?.removeEventListener("keyup",s.setKeyUnPressed,v),r?.removeEventListener("keydown",s.setKeyPressed,v),document.removeEventListener("mouseleave",s.clearPanning,v),ut(s),(m=s.observer)===null||m===void 0||m.disconnect()},this.handleInitializeWrapperEvents=function(l){var m=pr();l.addEventListener("wheel",s.onWheelZoom,m),l.addEventListener("dblclick",s.onDoubleClick,m),l.addEventListener("touchstart",s.onTouchPanningStart,m),l.addEventListener("touchmove",s.onTouchPanning,m),l.addEventListener("touchend",s.onTouchPanningStop,m)},this.handleInitialize=function(l,m){var v=!1,C=s.setup.centerOnInit,r=function(i,c){for(var f=0,o=i;f<o.length;f++){var p=o[f];if(p.target===c)return!0}return!1};s.applyTransformation(),s.onInitCallbacks.forEach(function(i){i(ke(s))}),s.observer=new ResizeObserver(function(i){if(r(i,l)||r(i,m))if(C&&!v){var c=m.offsetWidth,f=m.offsetHeight;(c>0||f>0)&&(v=!0,s.setCenter())}else ut(s),Bt(s,s.transformState.scale),Yr(s,0)}),s.observer.observe(l),s.observer.observe(m)},this.onWheelZoom=function(l){var m=s.setup.disabled;if(!m){var v=gd(s,l);if(v){var C=s.isPressingKeys(s.setup.wheel.activationKeys);C&&(Dd(s,l),Ad(s,l),jd(s,l))}}},this.onWheelPanning=function(l){var m=s.setup,v=m.disabled,C=m.wheel,r=m.panning;if(!(!s.wrapperComponent||!s.contentComponent||v||!C.wheelDisabled||r.disabled||!r.wheelPanning||l.ctrlKey)){l.preventDefault(),l.stopPropagation();var i=s.transformState,c=i.positionX,f=i.positionY,o=c-l.deltaX,p=f-l.deltaY,x=r.lockAxisX?c:o,S=r.lockAxisY?f:p,g=s.setup.alignmentAnimation,n=g.sizeX,d=g.sizeY,h=Dt(s,n),u=Dt(s,d);x===c&&S===f||no(s,x,S,h,u)}},this.onPanningStart=function(l){var m=s.setup.disabled,v=s.props.onPanningStart;if(!m){var C=Pi(s,l);if(C){var r=s.isPressingKeys(s.setup.panning.activationKeys);r&&(l.button===0&&!s.setup.panning.allowLeftClickPan||l.button===1&&!s.setup.panning.allowMiddleClickPan||l.button===2&&!s.setup.panning.allowRightClickPan||(l.preventDefault(),l.stopPropagation(),ut(s),Ii(s,l),Te(ke(s),l,v)))}}},this.onPanning=function(l){var m=s.setup.disabled,v=s.props.onPanning;if(!m){var C=Oi(s);if(C){var r=s.isPressingKeys(s.setup.panning.activationKeys);r&&(l.preventDefault(),l.stopPropagation(),Fi(s,l.clientX,l.clientY),Te(ke(s),l,v))}}},this.onPanningStop=function(l){var m=s.props.onPanningStop;s.isPanning&&(od(s),Te(ke(s),l,m))},this.onPinchStart=function(l){var m=s.setup.disabled,v=s.props,C=v.onPinchingStart,r=v.onZoomStart;if(!m){var i=yd(s,l);i&&(Td(s,l),ut(s),Te(ke(s),l,C),Te(ke(s),l,r))}},this.onPinch=function(l){var m=s.setup.disabled,v=s.props,C=v.onPinching,r=v.onZoom;if(!m){var i=Cd(s);i&&(l.preventDefault(),l.stopPropagation(),Ld(s,l),Te(ke(s),l,C),Te(ke(s),l,r))}},this.onPinchStop=function(l){var m=s.props,v=m.onPinchingStop,C=m.onZoomStop;s.pinchStartScale&&(Md(s),Te(ke(s),l,v),Te(ke(s),l,C))},this.onTouchPanningStart=function(l){var m=s.setup.disabled,v=s.props.onPanningStart;if(!m){var C=Pi(s,l);if(C){var r=s.lastTouch&&+new Date-s.lastTouch<200&&l.touches.length===1;if(!r){s.lastTouch=+new Date,ut(s);var i=l.touches,c=i.length===1,f=i.length===2;c&&(ut(s),Ii(s,l),Te(ke(s),l,v)),f&&s.onPinchStart(l)}}}},this.onTouchPanning=function(l){var m=s.setup.disabled,v=s.props.onPanning;if(s.isPanning&&l.touches.length===1){if(m)return;var C=Oi(s);if(!C)return;l.preventDefault(),l.stopPropagation();var r=l.touches[0];Fi(s,r.clientX,r.clientY),Te(ke(s),l,v)}else l.touches.length>1&&s.onPinch(l)},this.onTouchPanningStop=function(l){s.onPanningStop(l),s.onPinchStop(l)},this.onDoubleClick=function(l){var m=s.setup.disabled;if(!m){var v=Bd(s,l);v&&Od(s,l)}},this.clearPanning=function(l){s.isPanning&&s.onPanningStop(l)},this.setKeyPressed=function(l){s.pressedKeys[l.key]=!0},this.setKeyUnPressed=function(l){s.pressedKeys[l.key]=!1},this.isPressingKeys=function(l){return l.length?!!l.find(function(m){return s.pressedKeys[m]}):!0},this.setTransformState=function(l,m,v){var C=s.props.onTransformed;if(!Number.isNaN(l)&&!Number.isNaN(m)&&!Number.isNaN(v)){l!==s.transformState.scale&&(s.transformState.previousScale=s.transformState.scale,s.transformState.scale=l),s.transformState.positionX=m,s.transformState.positionY=v,s.applyTransformation();var r=ke(s);s.onChangeCallbacks.forEach(function(i){return i(r)}),Te(r,{scale:l,positionX:m,positionY:v},C)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(s.wrapperComponent&&s.contentComponent){var l=uo(s.transformState.scale,s.wrapperComponent,s.contentComponent);s.setTransformState(l.scale,l.positionX,l.positionY)}},this.handleTransformStyles=function(l,m,v){return s.props.customTransform?s.props.customTransform(l,m,v):pd(l,m,v)},this.applyTransformation=function(){if(!(!s.mounted||!s.contentComponent)){var l=s.transformState,m=l.scale,v=l.positionX,C=l.positionY,r=s.handleTransformStyles(v,C,m);s.contentComponent.style.transform=r}},this.getContext=function(){return ke(s)},this.onChange=function(l){return s.onChangeCallbacks.has(l)||s.onChangeCallbacks.add(l),function(){s.onChangeCallbacks.delete(l)}},this.onInit=function(l){return s.onInitCallbacks.has(l)||s.onInitCallbacks.add(l),function(){s.onInitCallbacks.delete(l)}},this.init=function(l,m){s.cleanupWindowEvents(),s.wrapperComponent=l,s.contentComponent=m,Bt(s,s.transformState.scale),s.handleInitializeWrapperEvents(l),s.handleInitialize(l,m),s.initializeWindowEvents(),s.isInitialized=!0;var v=ke(s);Te(v,void 0,s.props.onInit)},this.props=t,this.setup=zi(this.props),this.transformState=ao(this.props)}return e})(),Qs=ee.createContext(null),Fd=function(e,t){return typeof e=="function"?e(t):e},Hd=ee.forwardRef(function(e,t){var s=k.useRef(new Id(e)).current,l=Fd(e.children,Ms(s));return k.useImperativeHandle(t,function(){return Ms(s)},[s]),k.useEffect(function(){s.update(e)},[s,e]),ee.createElement(Qs.Provider,{value:s},l)});ee.forwardRef(function(e,t){var s=k.useRef(null),l=k.useContext(Qs);return k.useEffect(function(){return l.onChange(function(m){if(s.current){var v=0,C=0;s.current.style.transform=l.handleTransformStyles(v,C,1/m.instance.transformState.scale)}})},[l]),ee.createElement("div",Rt({},e,{ref:vd([s,t])}))});function zd(e,t){t===void 0&&(t={});var s=t.insertAt;if(!(typeof document>"u")){var l=document.head||document.getElementsByTagName("head")[0],m=document.createElement("style");m.type="text/css",s==="top"&&l.firstChild?l.insertBefore(m,l.firstChild):l.appendChild(m),m.styleSheet?m.styleSheet.cssText=e:m.appendChild(document.createTextNode(e))}}var Wd=`.transform-component-module_wrapper__SPB86 {
|
|
32
32
|
position: relative;
|
|
33
33
|
width: -moz-fit-content;
|
|
34
34
|
width: fit-content;
|
|
@@ -59,29 +59,29 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
59
59
|
.transform-component-module_content__FBWxo img {
|
|
60
60
|
pointer-events: none;
|
|
61
61
|
}
|
|
62
|
-
`,Wi={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};zd(Wd);var $d=function(e){var t=e.children,s=e.wrapperClass,l=s===void 0?"":s,m=e.contentClass,v=m===void 0?"":m,C=e.wrapperStyle,r=e.contentStyle,i=e.wrapperProps,c=i===void 0?{}:i,f=e.contentProps,o=f===void 0?{}:f,p=k.useContext(Qs),x=p.init,S=p.cleanupWindowEvents,g=k.useRef(null),n=k.useRef(null);return k.useEffect(function(){var d=g.current,h=n.current;return d!==null&&h!==null&&x&&x?.(d,h),function(){S?.()}},[]),ee.createElement("div",Rt({},c,{ref:g,className:"".concat(Er.wrapperClass," ").concat(Wi.wrapper," ").concat(l),style:C}),ee.createElement("div",Rt({},o,{ref:n,className:"".concat(Er.contentClass," ").concat(Wi.content," ").concat(v),style:r}),t))},go=function(){var e=k.useContext(Qs);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},Ud=function(){var e=go();return Ms(e)};function qd(e){var t=go(),s=k.useState(e(kr(t))),l=s[0],m=s[1];return k.useEffect(function(){var v=!0,C=t.onChange(function(r){v&&m(e(kr(r.instance)))});return function(){C(),v=!1}},[e,t]),l}function Kd(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}function Xd(e,t){return ht({queryKey:ae.files.tree(e||"",t),queryFn:()=>fe.get("/files/tree",{params:{workingDir:e||"",path:t}}),enabled:!!e})}function Yd(e,t){return ht({queryKey:ae.files.content(e||"",t||""),queryFn:()=>fe.get("/files/read",{params:{workingDir:e||"",path:t||""}}),enabled:!!e&&!!t})}function Vd(e){const t=We();return k.useCallback(()=>{e&&t.invalidateQueries({queryKey:["files","tree",e]})},[t,e])}function Gd(){const e=We();return Ze({mutationFn:t=>fe.post("/files/write",t),onSuccess:(t,s)=>{const l=ae.files.content(s.workingDir,s.path),m=e.getQueryData(l);e.setQueryData(l,{content:s.content,language:m?.language||Kd(s.path)})}})}function Qd(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function Zd(e,t){return e==="/"?t:`${e.slice(1)}/${t}`}const Jd=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function ef(e){if(e.type==="directory")return null;const t=e.name.split(".").pop()?.toLowerCase();return t&&Jd.has(t)?Br:t==="ts"||t==="tsx"||t==="js"||t==="jsx"?rs:t==="json"?Ba:t==="md"||t==="mdx"||t==="txt"?Cn:Ca}const $i=({depth:e,active:t,onClick:s,leftIcon:l,rightIcon:m,label:v})=>a.jsxs("button",{type:"button",onClick:s,className:ye("w-full flex items-center gap-2 rounded px-2 py-1 text-left text-xs hover:bg-neutral-100",t&&"bg-neutral-100 text-neutral-900"),style:{paddingLeft:8+e*14},children:[a.jsx("span",{className:"shrink-0",children:m}),a.jsx("span",{className:"shrink-0 text-neutral-500",children:l}),a.jsx("span",{className:"truncate text-neutral-700",children:v})]}),_o=({workingDir:e,path:t,depth:s,expanded:l,toggleDir:m,onFileSelect:v,selectedFilePath:C})=>{const{t:r}=ce(),{data:i,isLoading:c,isError:f}=Xd(e,t),o=k.useMemo(()=>i?.items??[],[i?.items]);return c?a.jsx("div",{className:"text-xs text-neutral-400 px-2 py-1",style:{paddingLeft:8+s*14},children:r("Loading...")}):f?a.jsx("div",{className:"text-xs text-red-600 px-2 py-1",style:{paddingLeft:8+s*14},children:r("Failed to load")}):a.jsx("div",{className:"space-y-0.5",children:o.map(p=>{if(p.type==="directory"){const d=Qd(t,p.name),h=l.has(d);return a.jsxs("div",{children:[a.jsx($i,{depth:s,onClick:()=>m(d),rightIcon:h?a.jsx(xt,{size:14,className:"text-neutral-400"}):a.jsx(Ft,{size:14,className:"text-neutral-400"}),leftIcon:h?a.jsx(wn,{size:14,className:"text-amber-500"}):a.jsx(ya,{size:14,className:"text-amber-500"}),label:p.name}),h&&a.jsx(_o,{workingDir:e,path:d,depth:s+1,expanded:l,toggleDir:m,onFileSelect:v,selectedFilePath:C})]},d)}const x=Zd(t,p.name),S=ef(p),g=C===x,n=S===Br;return a.jsx($i,{depth:s,active:g,onClick:()=>v(x),rightIcon:a.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:S?a.jsx(S,{size:14,className:n?"text-emerald-600":"text-sky-600"}):null,label:p.name},x)})})},tf=({workingDir:e,className:t,onFileSelect:s,selectedFilePath:l,onCollapse:m})=>{const{t:v}=ce(),[C,r]=k.useState(()=>new Set),i=Vd(e),c=k.useCallback(f=>{r(o=>{const p=new Set(o);return p.has(f)?p.delete(f):p.add(f),p})},[]);return a.jsxs("div",{className:ye("h-full flex flex-col",t),children:[a.jsxs("div",{className:"px-3 py-2 border-b border-neutral-200 bg-neutral-50/80 flex items-center justify-between",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[11px] font-semibold text-neutral-600 uppercase tracking-wider",children:v("Files")}),a.jsx("div",{className:"text-[11px] text-neutral-400 truncate",children:e||v("No working directory")})]}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&a.jsx("button",{type:"button",onClick:i,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:v("Refresh file tree"),children:a.jsx(ml,{size:13})}),m&&a.jsx("button",{type:"button",onClick:m,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:v("Collapse file tree"),children:a.jsx(nl,{size:13})})]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-2",children:e?a.jsx(_o,{workingDir:e,path:"/",depth:0,expanded:C,toggleDir:c,onFileSelect:s,selectedFilePath:l}):a.jsx("div",{className:"text-xs text-neutral-500 px-2 py-2",children:v("No workspace selected.")})})]})},sf=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function rf(e){const t=e.split(".").pop()?.toLowerCase();return t?sf.has(t):!1}function nf(e,t){const s="/api",l=new URLSearchParams({workingDir:e,path:t});return`${s}/files/image?${l.toString()}`}const of=({filePath:e})=>{const{t}=ce(),{zoomIn:s,zoomOut:l,centerView:m}=Ud(),v=qd(r=>r.state.scale),C=Math.round(v*100);return a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-neutral-200 bg-neutral-50/80 shrink-0",children:[a.jsx("button",{type:"button",onClick:()=>l(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:t("Zoom out"),children:a.jsx(Cl,{size:14})}),a.jsxs("button",{type:"button",onClick:()=>m(1),className:"px-1.5 py-0.5 rounded hover:bg-neutral-200 text-[11px] text-neutral-600 tabular-nums min-w-[40px] text-center transition-colors",title:t("Reset zoom"),children:[C,"%"]}),a.jsx("button",{type:"button",onClick:()=>s(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:t("Zoom in"),children:a.jsx(Sl,{size:14})}),a.jsx("button",{type:"button",onClick:()=>m(1),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors ml-1",title:t("Fit to view"),children:a.jsx(tl,{size:13})}),a.jsx("span",{className:"ml-2 text-[11px] text-neutral-400 truncate",children:e})]})},af=({workingDir:e,filePath:t})=>{const{t:s}=ce(),[l,m]=k.useState(!1),v=nf(e,t);return l?a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:s("Failed to load image.")}):a.jsx(Hd,{initialScale:1,minScale:.1,maxScale:10,centerOnInit:!0,doubleClick:{mode:"toggle"},children:a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsx(of,{filePath:t}),a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-[repeating-conic-gradient(#f3f3f3_0%_25%,#fff_0%_50%)] bg-[length:16px_16px]",children:a.jsx($d,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx("img",{src:v,alt:t,className:"max-w-full max-h-full object-contain rounded shadow-sm",draggable:!1,onError:()=>m(!0)})})})]})})};function lf(e){const t=e.split("/");return t[t.length-1]||e}function cf(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}const hf=({active:e,name:t,isDirty:s,onClick:l,onClose:m})=>{const{t:v}=ce();return a.jsxs("button",{type:"button",onClick:l,className:ye("group flex items-center gap-2 px-3 py-2 rounded-t-md border-t border-x -mb-px min-w-[120px] max-w-[240px]",e?"bg-white border-neutral-200 text-neutral-900":"bg-neutral-100/60 border-transparent text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100"),children:[a.jsx("span",{className:ye("w-2 h-2 rounded-full",s?"bg-amber-500":"bg-transparent")}),a.jsx("span",{className:"truncate flex-1 text-left text-xs",children:t}),a.jsx("span",{onClick:m,className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-neutral-200 rounded transition-all shrink-0","aria-label":v("Close tab"),title:v("Close"),children:a.jsx(Fs,{size:12})})]})},uf=({workingDir:e,className:t,readOnly:s=!1})=>{const{t:l}=ce(),[m,v]=k.useState([]),[C,r]=k.useState(null),i=Gd(),[c,f]=k.useState(280),[o,p]=k.useState(!1),[x,S]=k.useState(!1),g=k.useRef(280),n=k.useCallback(()=>{p(T=>(T?f(g.current):g.current=c,!T))},[c]),d=k.useCallback(T=>{T.preventDefault(),S(!0);const B=T.clientX,I=c,H=A=>{const N=A.clientX-B,P=Math.min(480,Math.max(160,I+N));f(P)},W=()=>{S(!1),document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",W)};document.addEventListener("mousemove",H),document.addEventListener("mouseup",W)},[c]);k.useEffect(()=>{v([]),r(null)},[e]);const h=k.useMemo(()=>m.find(T=>T.path===C)||null,[m,C]),{data:u,isFetching:_,isError:y,error:w}=Yd(e,h?.isImage?null:C);k.useEffect(()=>{!C||!u||v(T=>T.map(B=>B.path!==C||B.isDirty||B.loaded?B:{...B,language:u.language||B.language,content:u.content,savedContent:u.content,isDirty:!1,loaded:!0}))},[C,u]);const E=k.useCallback(T=>{v(B=>{if(B.find(W=>W.path===T))return B;const H=rf(T);return[...B,{path:T,name:lf(T),language:cf(T),content:"",savedContent:"",isDirty:!1,loaded:H,isImage:H}]}),r(T)},[]),b=k.useCallback(T=>{v(B=>{const I=B.filter(H=>H.path!==T);return r(H=>H!==T?H:I.length?I[I.length-1].path:null),I})},[]),R=k.useCallback(T=>{v(B=>B.map(I=>{if(I.path!==C)return I;const H=T!==I.savedContent;return{...I,content:T,isDirty:H}}))},[C]),j=k.useCallback(async()=>{s||!e||!h||(await i.mutateAsync({workingDir:e,path:h.path,content:h.content}),v(T=>T.map(B=>B.path===h.path?{...B,savedContent:B.content,isDirty:!1,loaded:!0}:B)))},[h,s,i,e]),M=k.useRef(()=>{});k.useEffect(()=>{M.current=()=>{j().catch(()=>{})}},[j]),k.useEffect(()=>{const T=B=>{s||(B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="s"&&(B.preventDefault(),M.current())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[s]);const L=k.useCallback((T,B)=>{T.addCommand(B.KeyMod.CtrlCmd|B.KeyCode.KeyS,()=>{M.current()})},[]);return a.jsxs("div",{className:ye("flex h-full overflow-hidden bg-white",t),style:x?{userSelect:"none",cursor:"col-resize"}:void 0,children:[a.jsx("div",{className:"border-r border-neutral-200 bg-white shrink-0 overflow-hidden relative",style:{width:o?36:c,transition:x?"none":"width 0.15s ease"},children:o?a.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:a.jsx("button",{type:"button",onClick:n,className:"p-1.5 rounded hover:bg-neutral-100 text-neutral-500 hover:text-neutral-700 transition-colors",title:l("Expand file tree"),children:a.jsx(al,{size:16})})}):a.jsx(a.Fragment,{children:a.jsx(tf,{workingDir:e,onFileSelect:E,selectedFilePath:h?.path||null,onCollapse:n},e||"no-working-dir")})}),!o&&a.jsx("div",{onMouseDown:d,className:ye("w-1 shrink-0 cursor-col-resize transition-colors",x?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1 px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 overflow-x-auto shrink-0",children:[m.length===0?a.jsx("div",{className:"px-2 pb-2 text-xs text-neutral-500",children:l("No open files")}):m.map(T=>a.jsx(hf,{active:T.path===C,name:T.name,isDirty:T.isDirty,onClick:()=>r(T.path),onClose:B=>{B.stopPropagation(),b(T.path)}},T.path)),a.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[s&&a.jsx("span",{className:"text-[11px] text-neutral-400",children:l("Read-only")}),i.isPending&&a.jsxs("span",{className:"flex items-center gap-2 text-xs text-neutral-500",children:[a.jsx(ze,{size:14,className:"animate-spin"}),l("Saving")]}),h?.isDirty&&!i.isPending&&a.jsx("span",{className:"text-[11px] text-amber-600",children:l("Unsaved")})]})]}),a.jsx("div",{className:"flex-1 min-h-0 relative",children:e?h?h.isImage?a.jsx(af,{workingDir:e,filePath:h.path}):a.jsxs(a.Fragment,{children:[a.jsx(Tu,{path:h.path,value:h.content,language:h.language,theme:"vs-light",height:"100%",onChange:s?void 0:T=>R(T??""),onMount:L,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0,readOnly:s}}),_&&!h.loaded&&a.jsx("div",{className:"absolute inset-0 bg-white/60 flex items-center justify-center",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-600",children:[a.jsx(ze,{size:14,className:"animate-spin"}),l("Loading file...")]})}),y&&a.jsxs("div",{className:"absolute bottom-2 left-2 right-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1",children:[l("Failed to load file"),w instanceof Error?`: ${w.message}`:""]})]}):a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:l("Select a file from the tree to open.")}):a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:l("No workspace selected.")})})]})]})};function bo(e){return ht({queryKey:ae.git.changes(e||""),queryFn:()=>fe.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e})}function xo(e,t,s){return ht({queryKey:ae.git.diff(e||"",t||"",s),queryFn:()=>fe.get("/git/diff",{params:{workingDir:e||"",path:t||"",type:s}}),enabled:!!e&&!!t})}function So(e,t){return ht({queryKey:ae.git.commitFiles(e||"",t||""),queryFn:()=>fe.get("/git/commit-files",{params:{workingDir:e||"",hash:t||""}}),enabled:!!e&&!!t})}function yo(e,t,s){return ht({queryKey:ae.git.commitDiff(e||"",t||"",s||""),queryFn:()=>fe.get("/git/commit-diff",{params:{workingDir:e||"",hash:t||"",path:s||""}}),enabled:!!e&&!!t&&!!s})}const Ui={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"},df={M:"Modified",A:"Added",D:"Deleted",R:"Renamed"};function ff(e){const t=e.split("/");return t[t.length-1]||e}function mf(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}const pf=({entry:e,selected:t,onClick:s})=>{const{t:l}=ce(),m=Ui[e.status]||Ui.M,v=df[e.status]||e.status,C=mf(e.path);return a.jsxs("button",{type:"button",onClick:s,className:ye("flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer group w-full text-left",t?"bg-blue-50":"hover:bg-neutral-50"),children:[a.jsx("span",{className:ye("w-4 h-4 flex items-center justify-center text-[10px] font-bold border rounded-sm shrink-0",m),title:l(v),children:e.status}),a.jsx("span",{className:"text-xs text-neutral-900 truncate",children:ff(e.path)}),C&&a.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:C})]})},qi=({title:e,entries:t,type:s,selectedKey:l,onSelect:m})=>{const{t:v}=ce();return t.length===0?null:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[a.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:v(e)}),a.jsx("span",{className:"text-[10px] text-neutral-400",children:t.length})]}),a.jsx("div",{className:"space-y-0.5",children:t.map(C=>{const r=`${s}:${C.path}`;return a.jsx(pf,{entry:C,selected:l===r,onClick:()=>m(C.path,s)},r)})})]})},vf=({line:e,lineNum:t})=>{let s="",l="text-neutral-700";return e.startsWith("+")&&!e.startsWith("+++")?(s="bg-emerald-50",l="text-emerald-800"):e.startsWith("-")&&!e.startsWith("---")?(s="bg-red-50",l="text-red-800"):e.startsWith("@@")?(s="bg-blue-50",l="text-blue-700"):(e.startsWith("diff ")||e.startsWith("index "))&&(l="text-neutral-400"),a.jsxs("div",{className:ye("flex",s),children:[a.jsx("span",{className:"w-10 shrink-0 text-right pr-2 text-neutral-400 select-none border-r border-neutral-100",children:t}),a.jsx("span",{className:ye("pl-2 whitespace-pre",l),children:e})]})},gf=({workingDir:e,filePath:t,type:s})=>{const{t:l}=ce(),{data:m,isLoading:v,isError:C}=xo(e,t,s);if(v)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-xs",children:l("Loading diff...")})]});if(C)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-xs",children:l("Failed to load diff.")});const r=m?.diff||"";if(!r.trim())return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-xs",children:l("No diff content available.")});const i=r.split(`
|
|
63
|
-
`);return a.jsx("div",{className:"flex-1 overflow-auto font-mono text-xs leading-5",children:i.map((c,f)=>a.jsx(vf,{line:c,lineNum:f+1},f))})},_f=({workingDir:e})=>{const{t}=ce(),{data:s,isLoading:l,isError:m}=bo(e),[v,C]=k.useState(null),[r,i]=k.useState(260),[c,f]=k.useState(!1),o=k.useCallback(d=>{d.preventDefault(),f(!0);const h=d.clientX,u=r,_=w=>{const E=w.clientX-h,b=Math.min(480,Math.max(160,u+E));i(b)},y=()=>{f(!1),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",y)};document.addEventListener("mousemove",_),document.addEventListener("mouseup",y)},[r]),p=v?`${v.type}:${v.path}`:null,x=(d,h)=>{C({path:d,type:h})};if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-500 text-sm bg-white h-full",children:t("No workspace selected.")});if(l)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500 bg-white h-full",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:t("Loading changes...")})]});if(m)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm bg-white h-full",children:t("Failed to load changes.")});const S=s?.uncommitted||[],g=s?.committed||[],n=S.length+g.length;return a.jsxs("div",{className:"flex h-full bg-white",style:c?{userSelect:"none",cursor:"col-resize"}:void 0,children:[a.jsxs("div",{className:"border-r border-neutral-200 flex flex-col shrink-0",style:{width:r},children:[a.jsx("div",{className:"px-3 py-2.5 border-b border-neutral-100 shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(is,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-semibold text-neutral-900",children:t("Changes")}),n>0&&a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:n})]})}),a.jsx("div",{className:"flex-1 overflow-auto p-1.5",children:n===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-neutral-400",children:[a.jsx(is,{size:28,className:"mb-2"}),a.jsx("span",{className:"text-xs",children:t("No pending changes")})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx(qi,{title:"Uncommitted",entries:S,type:"uncommitted",selectedKey:p,onSelect:x}),a.jsx(qi,{title:"Committed",entries:g,type:"committed",selectedKey:p,onSelect:x})]})})]}),a.jsx("div",{onMouseDown:o,className:ye("w-1 shrink-0 cursor-col-resize transition-colors",c?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:v?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-3 py-2 border-b border-neutral-100 flex items-center gap-2 shrink-0",children:[a.jsx(rs,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-medium text-neutral-700 truncate",children:v.path}),a.jsxs("span",{className:"text-[10px] text-neutral-400",children:["(",t(v.type==="uncommitted"?"Uncommitted":"Committed"),")"]})]}),a.jsx(gf,{workingDir:e,filePath:v.path,type:v.type})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx(rs,{size:28}),a.jsx("span",{className:"text-xs",children:t("Select a file to view diff")})]})})})]})},
|
|
62
|
+
`,Wi={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};zd(Wd);var $d=function(e){var t=e.children,s=e.wrapperClass,l=s===void 0?"":s,m=e.contentClass,v=m===void 0?"":m,C=e.wrapperStyle,r=e.contentStyle,i=e.wrapperProps,c=i===void 0?{}:i,f=e.contentProps,o=f===void 0?{}:f,p=k.useContext(Qs),x=p.init,S=p.cleanupWindowEvents,g=k.useRef(null),n=k.useRef(null);return k.useEffect(function(){var d=g.current,h=n.current;return d!==null&&h!==null&&x&&x?.(d,h),function(){S?.()}},[]),ee.createElement("div",Rt({},c,{ref:g,className:"".concat(kr.wrapperClass," ").concat(Wi.wrapper," ").concat(l),style:C}),ee.createElement("div",Rt({},o,{ref:n,className:"".concat(kr.contentClass," ").concat(Wi.content," ").concat(v),style:r}),t))},go=function(){var e=k.useContext(Qs);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},Ud=function(){var e=go();return Ms(e)};function qd(e){var t=go(),s=k.useState(e(Rr(t))),l=s[0],m=s[1];return k.useEffect(function(){var v=!0,C=t.onChange(function(r){v&&m(e(Rr(r.instance)))});return function(){C(),v=!1}},[e,t]),l}function Kd(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}function Xd(e,t){return ht({queryKey:ae.files.tree(e||"",t),queryFn:()=>fe.get("/files/tree",{params:{workingDir:e||"",path:t}}),enabled:!!e})}function Yd(e,t){return ht({queryKey:ae.files.content(e||"",t||""),queryFn:()=>fe.get("/files/read",{params:{workingDir:e||"",path:t||""}}),enabled:!!e&&!!t})}function Vd(e){const t=We();return k.useCallback(()=>{e&&t.invalidateQueries({queryKey:["files","tree",e]})},[t,e])}function Gd(){const e=We();return Ze({mutationFn:t=>fe.post("/files/write",t),onSuccess:(t,s)=>{const l=ae.files.content(s.workingDir,s.path),m=e.getQueryData(l);e.setQueryData(l,{content:s.content,language:m?.language||Kd(s.path)})}})}function Qd(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function Zd(e,t){return e==="/"?t:`${e.slice(1)}/${t}`}const Jd=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function ef(e){if(e.type==="directory")return null;const t=e.name.split(".").pop()?.toLowerCase();return t&&Jd.has(t)?Ir:t==="ts"||t==="tsx"||t==="js"||t==="jsx"?rs:t==="json"?Ba:t==="md"||t==="mdx"||t==="txt"?Cn:Ca}const $i=({depth:e,active:t,onClick:s,leftIcon:l,rightIcon:m,label:v})=>a.jsxs("button",{type:"button",onClick:s,className:ye("w-full flex items-center gap-2 rounded px-2 py-1 text-left text-xs hover:bg-neutral-100",t&&"bg-neutral-100 text-neutral-900"),style:{paddingLeft:8+e*14},children:[a.jsx("span",{className:"shrink-0",children:m}),a.jsx("span",{className:"shrink-0 text-neutral-500",children:l}),a.jsx("span",{className:"truncate text-neutral-700",children:v})]}),_o=({workingDir:e,path:t,depth:s,expanded:l,toggleDir:m,onFileSelect:v,selectedFilePath:C})=>{const{t:r}=ce(),{data:i,isLoading:c,isError:f}=Xd(e,t),o=k.useMemo(()=>i?.items??[],[i?.items]);return c?a.jsx("div",{className:"text-xs text-neutral-400 px-2 py-1",style:{paddingLeft:8+s*14},children:r("Loading...")}):f?a.jsx("div",{className:"text-xs text-red-600 px-2 py-1",style:{paddingLeft:8+s*14},children:r("Failed to load")}):a.jsx("div",{className:"space-y-0.5",children:o.map(p=>{if(p.type==="directory"){const d=Qd(t,p.name),h=l.has(d);return a.jsxs("div",{children:[a.jsx($i,{depth:s,onClick:()=>m(d),rightIcon:h?a.jsx(xt,{size:14,className:"text-neutral-400"}):a.jsx(Ft,{size:14,className:"text-neutral-400"}),leftIcon:h?a.jsx(wn,{size:14,className:"text-amber-500"}):a.jsx(ya,{size:14,className:"text-amber-500"}),label:p.name}),h&&a.jsx(_o,{workingDir:e,path:d,depth:s+1,expanded:l,toggleDir:m,onFileSelect:v,selectedFilePath:C})]},d)}const x=Zd(t,p.name),S=ef(p),g=C===x,n=S===Ir;return a.jsx($i,{depth:s,active:g,onClick:()=>v(x),rightIcon:a.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:S?a.jsx(S,{size:14,className:n?"text-emerald-600":"text-sky-600"}):null,label:p.name},x)})})},tf=({workingDir:e,className:t,onFileSelect:s,selectedFilePath:l,onCollapse:m})=>{const{t:v}=ce(),[C,r]=k.useState(()=>new Set),i=Vd(e),c=k.useCallback(f=>{r(o=>{const p=new Set(o);return p.has(f)?p.delete(f):p.add(f),p})},[]);return a.jsxs("div",{className:ye("h-full flex flex-col",t),children:[a.jsxs("div",{className:"px-3 py-2 border-b border-neutral-200 bg-neutral-50/80 flex items-center justify-between",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[11px] font-semibold text-neutral-600 uppercase tracking-wider",children:v("Files")}),a.jsx("div",{className:"text-[11px] text-neutral-400 truncate",children:e||v("No working directory")})]}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&a.jsx("button",{type:"button",onClick:i,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:v("Refresh file tree"),children:a.jsx(ml,{size:13})}),m&&a.jsx("button",{type:"button",onClick:m,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:v("Collapse file tree"),children:a.jsx(nl,{size:13})})]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-2",children:e?a.jsx(_o,{workingDir:e,path:"/",depth:0,expanded:C,toggleDir:c,onFileSelect:s,selectedFilePath:l}):a.jsx("div",{className:"text-xs text-neutral-500 px-2 py-2",children:v("No workspace selected.")})})]})},sf=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function rf(e){const t=e.split(".").pop()?.toLowerCase();return t?sf.has(t):!1}function nf(e,t){const s="/api",l=new URLSearchParams({workingDir:e,path:t});return`${s}/files/image?${l.toString()}`}const of=({filePath:e})=>{const{t}=ce(),{zoomIn:s,zoomOut:l,centerView:m}=Ud(),v=qd(r=>r.state.scale),C=Math.round(v*100);return a.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-neutral-200 bg-neutral-50/80 shrink-0",children:[a.jsx("button",{type:"button",onClick:()=>l(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:t("Zoom out"),children:a.jsx(Cl,{size:14})}),a.jsxs("button",{type:"button",onClick:()=>m(1),className:"px-1.5 py-0.5 rounded hover:bg-neutral-200 text-[11px] text-neutral-600 tabular-nums min-w-[40px] text-center transition-colors",title:t("Reset zoom"),children:[C,"%"]}),a.jsx("button",{type:"button",onClick:()=>s(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:t("Zoom in"),children:a.jsx(Sl,{size:14})}),a.jsx("button",{type:"button",onClick:()=>m(1),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors ml-1",title:t("Fit to view"),children:a.jsx(tl,{size:13})}),a.jsx("span",{className:"ml-2 text-[11px] text-neutral-400 truncate",children:e})]})},af=({workingDir:e,filePath:t})=>{const{t:s}=ce(),[l,m]=k.useState(!1),v=nf(e,t);return l?a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:s("Failed to load image.")}):a.jsx(Hd,{initialScale:1,minScale:.1,maxScale:10,centerOnInit:!0,doubleClick:{mode:"toggle"},children:a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsx(of,{filePath:t}),a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-[repeating-conic-gradient(#f3f3f3_0%_25%,#fff_0%_50%)] bg-[length:16px_16px]",children:a.jsx($d,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx("img",{src:v,alt:t,className:"max-w-full max-h-full object-contain rounded shadow-sm",draggable:!1,onError:()=>m(!0)})})})]})})};function lf(e){const t=e.split("/");return t[t.length-1]||e}function cf(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}const hf=({active:e,name:t,isDirty:s,onClick:l,onClose:m})=>{const{t:v}=ce();return a.jsxs("button",{type:"button",onClick:l,className:ye("group flex items-center gap-2 px-3 py-2 rounded-t-md border-t border-x -mb-px min-w-[120px] max-w-[240px]",e?"bg-white border-neutral-200 text-neutral-900":"bg-neutral-100/60 border-transparent text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100"),children:[a.jsx("span",{className:ye("w-2 h-2 rounded-full",s?"bg-amber-500":"bg-transparent")}),a.jsx("span",{className:"truncate flex-1 text-left text-xs",children:t}),a.jsx("span",{onClick:m,className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-neutral-200 rounded transition-all shrink-0","aria-label":v("Close tab"),title:v("Close"),children:a.jsx(Fs,{size:12})})]})},uf=({workingDir:e,className:t,readOnly:s=!1})=>{const{t:l}=ce(),[m,v]=k.useState([]),[C,r]=k.useState(null),i=Gd(),[c,f]=k.useState(280),[o,p]=k.useState(!1),[x,S]=k.useState(!1),g=k.useRef(280),n=k.useCallback(()=>{p(T=>(T?f(g.current):g.current=c,!T))},[c]),d=k.useCallback(T=>{T.preventDefault(),S(!0);const B=T.clientX,I=c,H=A=>{const N=A.clientX-B,P=Math.min(480,Math.max(160,I+N));f(P)},W=()=>{S(!1),document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",W)};document.addEventListener("mousemove",H),document.addEventListener("mouseup",W)},[c]);k.useEffect(()=>{v([]),r(null)},[e]);const h=k.useMemo(()=>m.find(T=>T.path===C)||null,[m,C]),{data:u,isFetching:_,isError:y,error:w}=Yd(e,h?.isImage?null:C);k.useEffect(()=>{!C||!u||v(T=>T.map(B=>B.path!==C||B.isDirty||B.loaded?B:{...B,language:u.language||B.language,content:u.content,savedContent:u.content,isDirty:!1,loaded:!0}))},[C,u]);const E=k.useCallback(T=>{v(B=>{if(B.find(W=>W.path===T))return B;const H=rf(T);return[...B,{path:T,name:lf(T),language:cf(T),content:"",savedContent:"",isDirty:!1,loaded:H,isImage:H}]}),r(T)},[]),b=k.useCallback(T=>{v(B=>{const I=B.filter(H=>H.path!==T);return r(H=>H!==T?H:I.length?I[I.length-1].path:null),I})},[]),R=k.useCallback(T=>{v(B=>B.map(I=>{if(I.path!==C)return I;const H=T!==I.savedContent;return{...I,content:T,isDirty:H}}))},[C]),j=k.useCallback(async()=>{s||!e||!h||(await i.mutateAsync({workingDir:e,path:h.path,content:h.content}),v(T=>T.map(B=>B.path===h.path?{...B,savedContent:B.content,isDirty:!1,loaded:!0}:B)))},[h,s,i,e]),M=k.useRef(()=>{});k.useEffect(()=>{M.current=()=>{j().catch(()=>{})}},[j]),k.useEffect(()=>{const T=B=>{s||(B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="s"&&(B.preventDefault(),M.current())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[s]);const L=k.useCallback((T,B)=>{T.addCommand(B.KeyMod.CtrlCmd|B.KeyCode.KeyS,()=>{M.current()})},[]);return a.jsxs("div",{className:ye("flex h-full overflow-hidden bg-white",t),style:x?{userSelect:"none",cursor:"col-resize"}:void 0,children:[a.jsx("div",{className:"border-r border-neutral-200 bg-white shrink-0 overflow-hidden relative",style:{width:o?36:c,transition:x?"none":"width 0.15s ease"},children:o?a.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:a.jsx("button",{type:"button",onClick:n,className:"p-1.5 rounded hover:bg-neutral-100 text-neutral-500 hover:text-neutral-700 transition-colors",title:l("Expand file tree"),children:a.jsx(al,{size:16})})}):a.jsx(a.Fragment,{children:a.jsx(tf,{workingDir:e,onFileSelect:E,selectedFilePath:h?.path||null,onCollapse:n},e||"no-working-dir")})}),!o&&a.jsx("div",{onMouseDown:d,className:ye("w-1 shrink-0 cursor-col-resize transition-colors",x?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1 px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 overflow-x-auto shrink-0",children:[m.length===0?a.jsx("div",{className:"px-2 pb-2 text-xs text-neutral-500",children:l("No open files")}):m.map(T=>a.jsx(hf,{active:T.path===C,name:T.name,isDirty:T.isDirty,onClick:()=>r(T.path),onClose:B=>{B.stopPropagation(),b(T.path)}},T.path)),a.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[s&&a.jsx("span",{className:"text-[11px] text-neutral-400",children:l("Read-only")}),i.isPending&&a.jsxs("span",{className:"flex items-center gap-2 text-xs text-neutral-500",children:[a.jsx(ze,{size:14,className:"animate-spin"}),l("Saving")]}),h?.isDirty&&!i.isPending&&a.jsx("span",{className:"text-[11px] text-amber-600",children:l("Unsaved")})]})]}),a.jsx("div",{className:"flex-1 min-h-0 relative",children:e?h?h.isImage?a.jsx(af,{workingDir:e,filePath:h.path}):a.jsxs(a.Fragment,{children:[a.jsx(Tu,{path:h.path,value:h.content,language:h.language,theme:"vs-light",height:"100%",onChange:s?void 0:T=>R(T??""),onMount:L,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0,readOnly:s}}),_&&!h.loaded&&a.jsx("div",{className:"absolute inset-0 bg-white/60 flex items-center justify-center",children:a.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-600",children:[a.jsx(ze,{size:14,className:"animate-spin"}),l("Loading file...")]})}),y&&a.jsxs("div",{className:"absolute bottom-2 left-2 right-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1",children:[l("Failed to load file"),w instanceof Error?`: ${w.message}`:""]})]}):a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:l("Select a file from the tree to open.")}):a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:l("No workspace selected.")})})]})]})};function bo(e){return ht({queryKey:ae.git.changes(e||""),queryFn:()=>fe.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e})}function xo(e,t,s){return ht({queryKey:ae.git.diff(e||"",t||"",s),queryFn:()=>fe.get("/git/diff",{params:{workingDir:e||"",path:t||"",type:s}}),enabled:!!e&&!!t})}function So(e,t){return ht({queryKey:ae.git.commitFiles(e||"",t||""),queryFn:()=>fe.get("/git/commit-files",{params:{workingDir:e||"",hash:t||""}}),enabled:!!e&&!!t})}function yo(e,t,s){return ht({queryKey:ae.git.commitDiff(e||"",t||"",s||""),queryFn:()=>fe.get("/git/commit-diff",{params:{workingDir:e||"",hash:t||"",path:s||""}}),enabled:!!e&&!!t&&!!s})}const Ui={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"},df={M:"Modified",A:"Added",D:"Deleted",R:"Renamed"};function ff(e){const t=e.split("/");return t[t.length-1]||e}function mf(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}const pf=({entry:e,selected:t,onClick:s})=>{const{t:l}=ce(),m=Ui[e.status]||Ui.M,v=df[e.status]||e.status,C=mf(e.path);return a.jsxs("button",{type:"button",onClick:s,className:ye("flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer group w-full text-left",t?"bg-blue-50":"hover:bg-neutral-50"),children:[a.jsx("span",{className:ye("w-4 h-4 flex items-center justify-center text-[10px] font-bold border rounded-sm shrink-0",m),title:l(v),children:e.status}),a.jsx("span",{className:"text-xs text-neutral-900 truncate",children:ff(e.path)}),C&&a.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:C})]})},qi=({title:e,entries:t,type:s,selectedKey:l,onSelect:m})=>{const{t:v}=ce();return t.length===0?null:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[a.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:v(e)}),a.jsx("span",{className:"text-[10px] text-neutral-400",children:t.length})]}),a.jsx("div",{className:"space-y-0.5",children:t.map(C=>{const r=`${s}:${C.path}`;return a.jsx(pf,{entry:C,selected:l===r,onClick:()=>m(C.path,s)},r)})})]})},vf=({line:e,lineNum:t})=>{let s="",l="text-neutral-700";return e.startsWith("+")&&!e.startsWith("+++")?(s="bg-emerald-50",l="text-emerald-800"):e.startsWith("-")&&!e.startsWith("---")?(s="bg-red-50",l="text-red-800"):e.startsWith("@@")?(s="bg-blue-50",l="text-blue-700"):(e.startsWith("diff ")||e.startsWith("index "))&&(l="text-neutral-400"),a.jsxs("div",{className:ye("flex",s),children:[a.jsx("span",{className:"w-10 shrink-0 text-right pr-2 text-neutral-400 select-none border-r border-neutral-100",children:t}),a.jsx("span",{className:ye("pl-2 whitespace-pre",l),children:e})]})},gf=({workingDir:e,filePath:t,type:s})=>{const{t:l}=ce(),{data:m,isLoading:v,isError:C}=xo(e,t,s);if(v)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-xs",children:l("Loading diff...")})]});if(C)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-xs",children:l("Failed to load diff.")});const r=m?.diff||"";if(!r.trim())return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-xs",children:l("No diff content available.")});const i=r.split(`
|
|
63
|
+
`);return a.jsx("div",{className:"flex-1 overflow-auto font-mono text-xs leading-5",children:i.map((c,f)=>a.jsx(vf,{line:c,lineNum:f+1},f))})},_f=({workingDir:e})=>{const{t}=ce(),{data:s,isLoading:l,isError:m}=bo(e),[v,C]=k.useState(null),[r,i]=k.useState(260),[c,f]=k.useState(!1),o=k.useCallback(d=>{d.preventDefault(),f(!0);const h=d.clientX,u=r,_=w=>{const E=w.clientX-h,b=Math.min(480,Math.max(160,u+E));i(b)},y=()=>{f(!1),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",y)};document.addEventListener("mousemove",_),document.addEventListener("mouseup",y)},[r]),p=v?`${v.type}:${v.path}`:null,x=(d,h)=>{C({path:d,type:h})};if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-500 text-sm bg-white h-full",children:t("No workspace selected.")});if(l)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500 bg-white h-full",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:t("Loading changes...")})]});if(m)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm bg-white h-full",children:t("Failed to load changes.")});const S=s?.uncommitted||[],g=s?.committed||[],n=S.length+g.length;return a.jsxs("div",{className:"flex h-full bg-white",style:c?{userSelect:"none",cursor:"col-resize"}:void 0,children:[a.jsxs("div",{className:"border-r border-neutral-200 flex flex-col shrink-0",style:{width:r},children:[a.jsx("div",{className:"px-3 py-2.5 border-b border-neutral-100 shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(is,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-semibold text-neutral-900",children:t("Changes")}),n>0&&a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:n})]})}),a.jsx("div",{className:"flex-1 overflow-auto p-1.5",children:n===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-neutral-400",children:[a.jsx(is,{size:28,className:"mb-2"}),a.jsx("span",{className:"text-xs",children:t("No pending changes")})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx(qi,{title:"Uncommitted",entries:S,type:"uncommitted",selectedKey:p,onSelect:x}),a.jsx(qi,{title:"Committed",entries:g,type:"committed",selectedKey:p,onSelect:x})]})})]}),a.jsx("div",{onMouseDown:o,className:ye("w-1 shrink-0 cursor-col-resize transition-colors",c?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:v?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-3 py-2 border-b border-neutral-100 flex items-center gap-2 shrink-0",children:[a.jsx(rs,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-medium text-neutral-700 truncate",children:v.path}),a.jsxs("span",{className:"text-[10px] text-neutral-400",children:["(",t(v.type==="uncommitted"?"Uncommitted":"Committed"),")"]})]}),a.jsx(gf,{workingDir:e,filePath:v.path,type:v.type})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx(rs,{size:28}),a.jsx("span",{className:"text-xs",children:t("Select a file to view diff")})]})})})]})},vr=50,Ki={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function bf(e){const s=Math.floor(Date.now()/1e3)-e;return s<60?Et("{count}s ago",{count:s}):s<3600?Et("{count}m ago",{count:Math.floor(s/60)}):s<86400?Et("{count}h ago",{count:Math.floor(s/3600)}):s<604800?Et("{count}d ago",{count:Math.floor(s/86400)}):new Date(e*1e3).toLocaleDateString()}function xf(e){const t=e.split("/");return t[t.length-1]||e}function Sf(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}const yf=`
|
|
64
64
|
.history-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
|
|
65
65
|
.history-scroll::-webkit-scrollbar-track { background: transparent; }
|
|
66
66
|
.history-scroll::-webkit-scrollbar-thumb { background: #d4d4d4; border-radius: 2px; }
|
|
67
67
|
.history-scroll::-webkit-scrollbar-thumb:hover { background: #a3a3a3; }
|
|
68
68
|
`,Cf=({line:e,lineNum:t})=>{let s="",l="text-neutral-700";return e.startsWith("+")&&!e.startsWith("+++")?(s="bg-emerald-50",l="text-emerald-800"):e.startsWith("-")&&!e.startsWith("---")?(s="bg-red-50",l="text-red-800"):e.startsWith("@@")?(s="bg-blue-50",l="text-blue-700"):(e.startsWith("diff ")||e.startsWith("index "))&&(l="text-neutral-400"),a.jsxs("div",{className:ye("flex",s),children:[a.jsx("span",{className:"w-10 shrink-0 text-right pr-2 text-neutral-400 select-none border-r border-neutral-100",children:t}),a.jsx("span",{className:ye("pl-2 whitespace-pre",l),children:e})]})},wf=({workingDir:e,hash:t,filePath:s})=>{const{t:l}=ce(),{data:m,isLoading:v,isError:C}=yo(e,t,s);if(v)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-xs",children:l("Loading diff...")})]});if(C)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-xs",children:l("Failed to load diff.")});const r=m?.diff||"";if(!r.trim())return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-xs",children:l("No diff content available.")});const i=r.split(`
|
|
69
|
-
`);return a.jsx("div",{className:"flex-1 overflow-auto history-scroll font-mono text-xs leading-5",children:i.map((c,f)=>a.jsx(Cf,{line:c,lineNum:f+1},f))})},Ef=({workingDir:e,hash:t,selectedPath:s,onSelectFile:l})=>{const{t:m}=ce(),{data:v,isLoading:C}=So(e,t);if(C)return a.jsxs("div",{className:"pl-7 py-1 text-xs text-neutral-400 flex items-center gap-1",children:[a.jsx(ze,{size:12,className:"animate-spin"}),a.jsx("span",{children:m("Loading...")})]});const r=v?.files||[];return r.length===0?a.jsx("div",{className:"pl-7 py-1 text-xs text-neutral-400",children:m("No files changed")}):a.jsx("div",{className:"pl-7 pb-1 space-y-0.5",children:r.map(i=>{const c=Ki[i.status]||Ki.M,f=Sf(i.path);return a.jsxs("button",{type:"button",onClick:o=>{o.stopPropagation(),l(i.path)},className:ye("flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer w-full text-left",s===i.path?"bg-blue-50":"hover:bg-neutral-50"),children:[a.jsx("span",{className:ye("w-3.5 h-3.5 flex items-center justify-center text-[9px] font-bold border rounded-sm shrink-0",c),children:i.status}),a.jsx("span",{className:"text-[11px] text-neutral-900 truncate",children:xf(i.path)}),f&&a.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:f})]},i.path)})})},kf=({workingDir:e})=>{const{t}=ce(),{data:s,isLoading:l,isError:m,fetchNextPage:v,hasNextPage:C,isFetchingNextPage:r}=_n({queryKey:ae.git.log(e||""),queryFn:({pageParam:y=0})=>fe.get("/git/log",{params:{workingDir:e||"",limit:String(pr),skip:String(y)}}),initialPageParam:0,getNextPageParam:(y,w)=>y.commits.length<pr?void 0:w.length*pr,enabled:!!e}),i=s?.pages.flatMap(y=>y.commits)||[],[c,f]=k.useState(null),[o,p]=k.useState(null),[x,S]=k.useState(280),[g,n]=k.useState(!1),d=k.useCallback(y=>{y.preventDefault(),n(!0);const w=y.clientX,E=x,b=j=>{const M=Math.min(480,Math.max(180,E+(j.clientX-w)));S(M)},R=()=>{n(!1),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",R)};document.addEventListener("mousemove",b),document.addEventListener("mouseup",R)},[x]),h=y=>{c===y?(f(null),p(null)):(f(y),p(null))},u=k.useRef(null);if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-500 text-sm bg-white h-full",children:t("No workspace selected.")});if(l)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500 bg-white h-full",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:t("Loading history...")})]});if(m)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm bg-white h-full",children:t("Failed to load history.")});if(i.length===0)return a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-neutral-400 bg-white h-full",children:[a.jsx(qt,{size:28,className:"mb-2"}),a.jsx("span",{className:"text-xs",children:t("No commit history")})]});const _=i.find(y=>y.hash===c);return a.jsxs("div",{className:"flex h-full bg-white",style:g?{userSelect:"none",cursor:"col-resize"}:void 0,children:[a.jsx("style",{children:yf}),a.jsxs("div",{className:"border-r border-neutral-200 flex flex-col shrink-0",style:{width:x},children:[a.jsx("div",{className:"px-3 py-2.5 border-b border-neutral-100 shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(qt,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-semibold text-neutral-900",children:t("History")}),a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:i.length})]})}),a.jsxs("div",{ref:u,className:"flex-1 overflow-auto history-scroll p-1.5",children:[i.map(y=>{const w=c===y.hash;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>h(y.hash),className:ye("flex items-start gap-2 px-2 py-1.5 rounded cursor-pointer w-full text-left group",w?"bg-blue-50":"hover:bg-neutral-50"),children:[a.jsx("div",{className:"flex flex-col items-center shrink-0 pt-1",children:a.jsx("div",{className:ye("w-2 h-2 rounded-full shrink-0 transition-colors",w?"bg-blue-500":"bg-neutral-300 group-hover:bg-neutral-500")})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px] font-mono text-blue-600 shrink-0",children:y.shortHash}),a.jsx("span",{className:"text-xs text-neutral-900 truncate flex-1",children:y.message}),a.jsx(Ft,{size:12,className:ye("shrink-0 text-neutral-400 transition-transform",w&&"rotate-90")})]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[a.jsx("span",{className:"text-[10px] text-neutral-500 truncate",children:y.author}),a.jsx("span",{className:"text-[10px] text-neutral-400",children:bf(y.timestamp)})]})]})]}),w&&a.jsxs(a.Fragment,{children:[y.body&&a.jsx("div",{className:"pl-7 pr-2 py-1.5 text-[11px] text-neutral-600 whitespace-pre-wrap leading-4 border-l-2 border-blue-100 ml-3",children:y.body}),a.jsx(Ef,{workingDir:e,hash:y.hash,selectedPath:o,onSelectFile:p})]})]},y.hash)}),C&&a.jsx("button",{type:"button",onClick:()=>v(),disabled:r,className:"w-full py-2 text-xs text-neutral-500 hover:text-neutral-700 hover:bg-neutral-50 rounded transition-colors flex items-center justify-center gap-1.5",children:r?a.jsxs(a.Fragment,{children:[a.jsx(ze,{size:12,className:"animate-spin"})," ",t("Loading...")]}):t("Load more")})]})]}),a.jsx("div",{onMouseDown:d,className:ye("w-1 shrink-0 cursor-col-resize transition-colors",g?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:o&&c?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-3 py-2 border-b border-neutral-100 flex items-center gap-2 shrink-0",children:[a.jsx(rs,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-medium text-neutral-700 truncate",children:o}),a.jsxs("span",{className:"text-[10px] text-neutral-400",children:["(",_?.shortHash,")"]})]}),a.jsx(wf,{workingDir:e,hash:c,filePath:o})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx(rs,{size:28}),a.jsx("span",{className:"text-xs",children:t(c?"Select a file to view diff":"Select a commit to view changes")})]})})})]})},Rf=[{key:"changes",label:"Changes",icon:a.jsx(is,{size:14})},{key:"history",label:"History",icon:a.jsx(qt,{size:14})},{key:"editor",label:"Editor",icon:a.jsx(zs,{size:14})},{key:"terminal",label:"Terminal",icon:a.jsx(Es,{size:14})},{key:"preview",label:"Preview",icon:a.jsx(Is,{size:14})}],Df=[{key:"history",label:"History",icon:a.jsx(qt,{size:14})},{key:"editor",label:"Editor",icon:a.jsx(zs,{size:14})},{key:"terminal",label:"Terminal",icon:a.jsx(Es,{size:14})},{key:"preview",label:"Preview",icon:a.jsx(Is,{size:14})}],Af=({active:e,onClick:t,icon:s,label:l})=>a.jsxs("button",{onClick:t,className:ye("flex items-center gap-2 px-4 py-2 text-xs font-medium transition-all rounded-t-md border-t border-x -mb-px",e?"bg-white border-neutral-200 text-neutral-900 shadow-[0_-2px_6px_rgba(0,0,0,0.02)] z-10":"bg-transparent border-transparent text-neutral-500 hover:text-neutral-700 hover:bg-neutral-200/50"),children:[s,a.jsx("span",{children:l})]}),jf=({icon:e,title:t})=>{const{t:s}=ce();return a.jsx("div",{className:"flex-1 flex items-center justify-center bg-white",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 text-neutral-400",children:[e,a.jsx("span",{className:"text-sm font-medium text-neutral-500",children:s(t)}),a.jsx("span",{className:"text-xs",children:s("Coming soon...")})]})})},Co=ee.memo(function({className:t,sessionId:s,workingDir:l,projectId:m,hideChanges:v,readOnly:C,repoDeleted:r}){const{t:i}=ce(),c=k.useMemo(()=>{const d=v?Df:Rf;return C?d.filter(h=>h.key!=="terminal"):d},[v,C]),[f,o]=k.useState(v?"history":"changes"),{data:p}=ga(m??""),x=k.useMemo(()=>{if(!p?.quickCommands)return[];try{return JSON.parse(p.quickCommands)}catch{return[]}},[p?.quickCommands]),[S,g]=k.useState([]),n=k.useRef(void 0);return k.useEffect(()=>{l&&l!==n.current&&(n.current=l,g(d=>d.includes(l)?d:[...d,l]))},[l]),k.useEffect(()=>{C&&f==="terminal"&&o(v?"history":"changes")},[f,v,C]),a.jsxs("div",{className:ye("flex flex-col h-full bg-white",t),children:[C&&a.jsx("div",{className:"mx-2 mt-2 rounded-lg border border-neutral-200 bg-neutral-50 px-3 py-2 text-xs text-neutral-500",children:i(r?"项目已删除且本地仓库文件已清理。这里只保留历史视图。":"项目已删除。Workspace 以只读模式展示历史内容。")}),a.jsx("div",{className:"flex items-center px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 shrink-0 gap-1 select-none",children:c.map(d=>a.jsx(Af,{active:f===d.key,onClick:()=>o(d.key),icon:d.icon,label:i(d.label)},d.key))}),a.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[f==="editor"&&a.jsx(uf,{workingDir:l,readOnly:C}),S.map(d=>a.jsx("div",{className:"h-full absolute inset-0",style:{display:f==="terminal"&&l===d?"block":"none"},children:a.jsx(yh,{cwd:d,quickCommands:x})},d)),f==="preview"&&a.jsx(jf,{icon:a.jsx(Is,{size:32}),title:"Preview"}),f==="changes"&&a.jsx(_f,{workingDir:l}),f==="history"&&a.jsx(kf,{workingDir:l})]})]})});function wo(e){return ht({queryKey:ae.workspaces.list(e),queryFn:()=>fe.get(`/tasks/${e}/workspaces`),enabled:!!e})}function Eo(e){const t=We();return Ze({mutationFn:s=>fe.post(`/tasks/${e}/workspaces`,s),onSuccess:()=>{t.invalidateQueries({queryKey:ae.workspaces.list(e)}),t.invalidateQueries({queryKey:ae.tasks.all})}})}function Tf(){const e=We();return Ze({mutationFn:({id:t,commitMessage:s})=>fe.post(`/workspaces/${t}/merge`,{commitMessage:s}),onSuccess:()=>{e.invalidateQueries({queryKey:ae.workspaces.all}),e.invalidateQueries({queryKey:ae.tasks.all})}})}function Vr(){return Ze({mutationFn:({workspaceId:e,editorType:t})=>fe.post(`/workspaces/${e}/open-editor`,{editorType:t})})}function ko(e){return ht({queryKey:ae.workspaces.gitStatus(e),queryFn:()=>fe.get(`/workspaces/${e}/git-status`),enabled:!!e})}function Lf(){const e=We();return Ze({mutationFn:t=>fe.post(`/workspaces/${t}/rebase`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ae.workspaces.gitStatus(s)})},onError:(t,s)=>{e.invalidateQueries({queryKey:ae.workspaces.gitStatus(s)})}})}function Mf(){const e=We();return Ze({mutationFn:t=>fe.post(`/workspaces/${t}/abort-operation`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ae.workspaces.gitStatus(s)})}})}const Xi=1500,Nf=3e3;function Pf(e){const[t,s]=k.useState(null),l=k.useRef(0),m=k.useRef(null),v=k.useRef(null);return k.useEffect(()=>{if(!e)return;const C=()=>{v.current&&(clearTimeout(v.current),v.current=null)},r=wt.connect();r.emit(Pt.SUBSCRIBE,{topic:"task",id:e},f=>{});const i=f=>{s(f),v.current=setTimeout(()=>s(null),Nf)},c=f=>{if(f.taskId!==e)return;const o={status:f.status,currentCommand:f.currentCommand,currentIndex:f.currentIndex,totalCommands:f.totalCommands,error:f.error};if(f.status==="running"){C(),m.current=null,l.current===0&&(l.current=Date.now()),s(o);return}const p=l.current>0?Date.now()-l.current:0,x=Xi-p;l.current===0?(l.current=Date.now(),s({status:"running",totalCommands:f.totalCommands,currentIndex:f.totalCommands}),m.current=o,v.current=setTimeout(()=>i(o),Xi)):x>0?(m.current=o,C(),v.current=setTimeout(()=>i(o),x)):i(o)};return r.on(Qe.WORKSPACE_SETUP_PROGRESS,c),()=>{r.off(Qe.WORKSPACE_SETUP_PROGRESS,c),C(),l.current=0,m.current=null}},[e]),t}function Gr(){const e=We();return Ze({mutationFn:t=>fe.post(`/sessions/${t}/start`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ae.sessions.detail(s)}),e.invalidateQueries({queryKey:ae.tasks.all})}})}function Ro(){const e=We();return Ze({mutationFn:t=>fe.post(`/sessions/${t}/stop`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ae.sessions.detail(s)})}})}function Qr(){const e=We();return Ze({mutationFn:({id:t,message:s,providerId:l})=>fe.post(`/sessions/${t}/message`,{message:s,providerId:l}),onSuccess:()=>{e.invalidateQueries({queryKey:ae.workspaces.all}),e.invalidateQueries({queryKey:ae.tasks.all})}})}function Of(e,t){const s={};return ht({queryKey:ae.tasks.list(e,t),queryFn:()=>fe.get(`/projects/${e}/tasks`,{params:s}),enabled:!!e})}function Bf(e){const t=We();return Ze({mutationFn:s=>fe.post(`/projects/${e}/tasks`,s),onSuccess:()=>{t.invalidateQueries({queryKey:ae.tasks.list(e)}),t.invalidateQueries({queryKey:ae.tasks.stats(e)})}})}function If(){const e=We();return Ze({mutationFn:({id:t,status:s})=>fe.patch(`/tasks/${t}/status`,{status:s}),onSuccess:t=>{e.invalidateQueries({queryKey:ae.tasks.all}),e.invalidateQueries({queryKey:ae.tasks.detail(t.id)})}})}function Ff(){const e=We();return Ze({mutationFn:t=>fe.delete(`/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:ae.tasks.all})}})}function Hf(){const e=We();return Ze({mutationFn:t=>fe.post(`/tasks/${t}/retry`,{}),onSuccess:t=>{e.invalidateQueries({queryKey:ae.tasks.all}),e.invalidateQueries({queryKey:ae.workspaces.all}),e.invalidateQueries({queryKey:ae.tasks.detail(t.id)})}})}function Do(e,t){return k.useMemo(()=>{for(let s=e.length-1;s>=0;s--){const l=e[s];if(l.tokenUsage&&typeof l.tokenUsage.totalTokens=="number"&&l.tokenUsage.totalTokens>0)return{totalTokens:l.tokenUsage.totalTokens,modelContextWindow:l.tokenUsage.modelContextWindow}}return t??null},[e,t])}const zf="/api";async function Wf(e){const t=new FormData;t.append("file",e);const s=await fetch(`${zf}/attachments/upload`,{method:"POST",body:t});if(!s.ok){const l=await s.json().catch(()=>({}));throw new Error(l.error||`Upload failed (${s.status})`)}return s.json()}let $f=0;function Zr(){const[e,t]=k.useState([]),s=k.useRef(e);s.current=e;const l=k.useCallback(async c=>{const f=c.map(o=>({tempId:`tmp-${++$f}`,file:o,progress:0,status:"uploading"}));t(o=>[...o,...f]),await Promise.allSettled(f.map(async o=>{try{const p=await Wf(o.file);t(x=>x.map(S=>S.tempId===o.tempId?{...S,status:"done",progress:100,attachment:p}:S))}catch(p){t(x=>x.map(S=>S.tempId===o.tempId?{...S,status:"error",error:p instanceof Error?p.message:"Upload failed"}:S))}}))},[]),m=k.useCallback(c=>{t(f=>f.filter(o=>o.tempId!==c))},[]),v=k.useCallback(()=>{t([])},[]),C=k.useCallback(()=>{const c=s.current.filter(f=>f.status==="done"&&f.attachment);return c.length===0?"":c.map(f=>{const o=f.attachment;return`${o.mimeType.startsWith("image/")?"!":""}[${o.originalName}](${o.storagePath})`}).join(`
|
|
70
|
-
`)},[]),r=e.length>0,i=e.some(c=>c.status==="uploading");return{files:e,addFiles:l,removeFile:m,clear:v,buildMarkdownLinks:C,hasFiles:r,isUploading:i}}const Uf="/api";function qf(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Ns({files:e,onRemove:t}){return e.length===0?null:a.jsx("div",{className:"flex flex-wrap gap-2 px-4 pt-3 pb-1",children:e.map(s=>a.jsx(Kf,{item:s,onRemove:t},s.tempId))})}function Kf({item:e,onRemove:t}){const s=e.file.type.startsWith("image/"),l=e.status==="error",m=e.status==="uploading";return a.jsxs("div",{className:`relative group flex items-center gap-2 px-3 py-2 rounded-lg border text-xs max-w-[200px] ${l?"border-red-200 bg-red-50 text-red-600":"border-neutral-200 bg-neutral-50 text-neutral-700"}`,children:[s&&e.status==="done"&&e.attachment?a.jsx("img",{src:`${Uf}${e.attachment.url}`,alt:e.file.name,className:"w-8 h-8 rounded object-cover flex-shrink-0"}):a.jsx("span",{className:"flex-shrink-0",children:m?a.jsx(ze,{size:16,className:"animate-spin text-neutral-400"}):s?a.jsx(
|
|
69
|
+
`);return a.jsx("div",{className:"flex-1 overflow-auto history-scroll font-mono text-xs leading-5",children:i.map((c,f)=>a.jsx(Cf,{line:c,lineNum:f+1},f))})},Ef=({workingDir:e,hash:t,selectedPath:s,onSelectFile:l})=>{const{t:m}=ce(),{data:v,isLoading:C}=So(e,t);if(C)return a.jsxs("div",{className:"pl-7 py-1 text-xs text-neutral-400 flex items-center gap-1",children:[a.jsx(ze,{size:12,className:"animate-spin"}),a.jsx("span",{children:m("Loading...")})]});const r=v?.files||[];return r.length===0?a.jsx("div",{className:"pl-7 py-1 text-xs text-neutral-400",children:m("No files changed")}):a.jsx("div",{className:"pl-7 pb-1 space-y-0.5",children:r.map(i=>{const c=Ki[i.status]||Ki.M,f=Sf(i.path);return a.jsxs("button",{type:"button",onClick:o=>{o.stopPropagation(),l(i.path)},className:ye("flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer w-full text-left",s===i.path?"bg-blue-50":"hover:bg-neutral-50"),children:[a.jsx("span",{className:ye("w-3.5 h-3.5 flex items-center justify-center text-[9px] font-bold border rounded-sm shrink-0",c),children:i.status}),a.jsx("span",{className:"text-[11px] text-neutral-900 truncate",children:xf(i.path)}),f&&a.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:f})]},i.path)})})},kf=({workingDir:e})=>{const{t}=ce(),{data:s,isLoading:l,isError:m,fetchNextPage:v,hasNextPage:C,isFetchingNextPage:r}=_n({queryKey:ae.git.log(e||""),queryFn:({pageParam:y=0})=>fe.get("/git/log",{params:{workingDir:e||"",limit:String(vr),skip:String(y)}}),initialPageParam:0,getNextPageParam:(y,w)=>y.commits.length<vr?void 0:w.length*vr,enabled:!!e}),i=s?.pages.flatMap(y=>y.commits)||[],[c,f]=k.useState(null),[o,p]=k.useState(null),[x,S]=k.useState(280),[g,n]=k.useState(!1),d=k.useCallback(y=>{y.preventDefault(),n(!0);const w=y.clientX,E=x,b=j=>{const M=Math.min(480,Math.max(180,E+(j.clientX-w)));S(M)},R=()=>{n(!1),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",R)};document.addEventListener("mousemove",b),document.addEventListener("mouseup",R)},[x]),h=y=>{c===y?(f(null),p(null)):(f(y),p(null))},u=k.useRef(null);if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-500 text-sm bg-white h-full",children:t("No workspace selected.")});if(l)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500 bg-white h-full",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:t("Loading history...")})]});if(m)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm bg-white h-full",children:t("Failed to load history.")});if(i.length===0)return a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-neutral-400 bg-white h-full",children:[a.jsx(qt,{size:28,className:"mb-2"}),a.jsx("span",{className:"text-xs",children:t("No commit history")})]});const _=i.find(y=>y.hash===c);return a.jsxs("div",{className:"flex h-full bg-white",style:g?{userSelect:"none",cursor:"col-resize"}:void 0,children:[a.jsx("style",{children:yf}),a.jsxs("div",{className:"border-r border-neutral-200 flex flex-col shrink-0",style:{width:x},children:[a.jsx("div",{className:"px-3 py-2.5 border-b border-neutral-100 shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(qt,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-semibold text-neutral-900",children:t("History")}),a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:i.length})]})}),a.jsxs("div",{ref:u,className:"flex-1 overflow-auto history-scroll p-1.5",children:[i.map(y=>{const w=c===y.hash;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>h(y.hash),className:ye("flex items-start gap-2 px-2 py-1.5 rounded cursor-pointer w-full text-left group",w?"bg-blue-50":"hover:bg-neutral-50"),children:[a.jsx("div",{className:"flex flex-col items-center shrink-0 pt-1",children:a.jsx("div",{className:ye("w-2 h-2 rounded-full shrink-0 transition-colors",w?"bg-blue-500":"bg-neutral-300 group-hover:bg-neutral-500")})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px] font-mono text-blue-600 shrink-0",children:y.shortHash}),a.jsx("span",{className:"text-xs text-neutral-900 truncate flex-1",children:y.message}),a.jsx(Ft,{size:12,className:ye("shrink-0 text-neutral-400 transition-transform",w&&"rotate-90")})]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[a.jsx("span",{className:"text-[10px] text-neutral-500 truncate",children:y.author}),a.jsx("span",{className:"text-[10px] text-neutral-400",children:bf(y.timestamp)})]})]})]}),w&&a.jsxs(a.Fragment,{children:[y.body&&a.jsx("div",{className:"pl-7 pr-2 py-1.5 text-[11px] text-neutral-600 whitespace-pre-wrap leading-4 border-l-2 border-blue-100 ml-3",children:y.body}),a.jsx(Ef,{workingDir:e,hash:y.hash,selectedPath:o,onSelectFile:p})]})]},y.hash)}),C&&a.jsx("button",{type:"button",onClick:()=>v(),disabled:r,className:"w-full py-2 text-xs text-neutral-500 hover:text-neutral-700 hover:bg-neutral-50 rounded transition-colors flex items-center justify-center gap-1.5",children:r?a.jsxs(a.Fragment,{children:[a.jsx(ze,{size:12,className:"animate-spin"})," ",t("Loading...")]}):t("Load more")})]})]}),a.jsx("div",{onMouseDown:d,className:ye("w-1 shrink-0 cursor-col-resize transition-colors",g?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:o&&c?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-3 py-2 border-b border-neutral-100 flex items-center gap-2 shrink-0",children:[a.jsx(rs,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-medium text-neutral-700 truncate",children:o}),a.jsxs("span",{className:"text-[10px] text-neutral-400",children:["(",_?.shortHash,")"]})]}),a.jsx(wf,{workingDir:e,hash:c,filePath:o})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx(rs,{size:28}),a.jsx("span",{className:"text-xs",children:t(c?"Select a file to view diff":"Select a commit to view changes")})]})})})]})},Rf=[{key:"changes",label:"Changes",icon:a.jsx(is,{size:14})},{key:"history",label:"History",icon:a.jsx(qt,{size:14})},{key:"editor",label:"Editor",icon:a.jsx(zs,{size:14})},{key:"terminal",label:"Terminal",icon:a.jsx(Es,{size:14})},{key:"preview",label:"Preview",icon:a.jsx(Is,{size:14})}],Df=[{key:"history",label:"History",icon:a.jsx(qt,{size:14})},{key:"editor",label:"Editor",icon:a.jsx(zs,{size:14})},{key:"terminal",label:"Terminal",icon:a.jsx(Es,{size:14})},{key:"preview",label:"Preview",icon:a.jsx(Is,{size:14})}],Af=({active:e,onClick:t,icon:s,label:l})=>a.jsxs("button",{onClick:t,className:ye("flex items-center gap-2 px-4 py-2 text-xs font-medium transition-all rounded-t-md border-t border-x -mb-px",e?"bg-white border-neutral-200 text-neutral-900 shadow-[0_-2px_6px_rgba(0,0,0,0.02)] z-10":"bg-transparent border-transparent text-neutral-500 hover:text-neutral-700 hover:bg-neutral-200/50"),children:[s,a.jsx("span",{children:l})]}),jf=({icon:e,title:t})=>{const{t:s}=ce();return a.jsx("div",{className:"flex-1 flex items-center justify-center bg-white",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 text-neutral-400",children:[e,a.jsx("span",{className:"text-sm font-medium text-neutral-500",children:s(t)}),a.jsx("span",{className:"text-xs",children:s("Coming soon...")})]})})},Co=ee.memo(function({className:t,sessionId:s,workingDir:l,projectId:m,hideChanges:v,readOnly:C,repoDeleted:r}){const{t:i}=ce(),c=k.useMemo(()=>{const d=v?Df:Rf;return C?d.filter(h=>h.key!=="terminal"):d},[v,C]),[f,o]=k.useState(v?"history":"changes"),{data:p}=ga(m??""),x=k.useMemo(()=>{if(!p?.quickCommands)return[];try{return JSON.parse(p.quickCommands)}catch{return[]}},[p?.quickCommands]),[S,g]=k.useState([]),n=k.useRef(void 0);return k.useEffect(()=>{l&&l!==n.current&&(n.current=l,g(d=>d.includes(l)?d:[...d,l]))},[l]),k.useEffect(()=>{C&&f==="terminal"&&o(v?"history":"changes")},[f,v,C]),a.jsxs("div",{className:ye("flex flex-col h-full bg-white",t),children:[C&&a.jsx("div",{className:"mx-2 mt-2 rounded-lg border border-neutral-200 bg-neutral-50 px-3 py-2 text-xs text-neutral-500",children:i(r?"项目已删除且本地仓库文件已清理。这里只保留历史视图。":"项目已删除。Workspace 以只读模式展示历史内容。")}),a.jsx("div",{className:"flex items-center px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 shrink-0 gap-1 select-none",children:c.map(d=>a.jsx(Af,{active:f===d.key,onClick:()=>o(d.key),icon:d.icon,label:i(d.label)},d.key))}),a.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[f==="editor"&&a.jsx(uf,{workingDir:l,readOnly:C}),S.map(d=>a.jsx("div",{className:"h-full absolute inset-0",style:{display:f==="terminal"&&l===d?"block":"none"},children:a.jsx(yh,{cwd:d,quickCommands:x})},d)),f==="preview"&&a.jsx(jf,{icon:a.jsx(Is,{size:32}),title:"Preview"}),f==="changes"&&a.jsx(_f,{workingDir:l}),f==="history"&&a.jsx(kf,{workingDir:l})]})]})});function wo(e){return ht({queryKey:ae.workspaces.list(e),queryFn:()=>fe.get(`/tasks/${e}/workspaces`),enabled:!!e})}function Eo(e){const t=We();return Ze({mutationFn:s=>fe.post(`/tasks/${e}/workspaces`,s),onSuccess:()=>{t.invalidateQueries({queryKey:ae.workspaces.list(e)}),t.invalidateQueries({queryKey:ae.tasks.all})}})}function Tf(){const e=We();return Ze({mutationFn:({id:t,commitMessage:s})=>fe.post(`/workspaces/${t}/merge`,{commitMessage:s}),onSuccess:()=>{e.invalidateQueries({queryKey:ae.workspaces.all}),e.invalidateQueries({queryKey:ae.tasks.all})}})}function Gr(){return Ze({mutationFn:({workspaceId:e,editorType:t})=>fe.post(`/workspaces/${e}/open-editor`,{editorType:t})})}function ko(e){return ht({queryKey:ae.workspaces.gitStatus(e),queryFn:()=>fe.get(`/workspaces/${e}/git-status`),enabled:!!e})}function Lf(){const e=We();return Ze({mutationFn:t=>fe.post(`/workspaces/${t}/rebase`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ae.workspaces.gitStatus(s)})},onError:(t,s)=>{e.invalidateQueries({queryKey:ae.workspaces.gitStatus(s)})}})}function Mf(){const e=We();return Ze({mutationFn:t=>fe.post(`/workspaces/${t}/abort-operation`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ae.workspaces.gitStatus(s)})}})}const Xi=1500,Nf=3e3;function Pf(e){const[t,s]=k.useState(null),l=k.useRef(0),m=k.useRef(null),v=k.useRef(null);return k.useEffect(()=>{if(!e)return;const C=()=>{v.current&&(clearTimeout(v.current),v.current=null)},r=wt.connect();r.emit(Pt.SUBSCRIBE,{topic:"task",id:e},f=>{});const i=f=>{s(f),v.current=setTimeout(()=>s(null),Nf)},c=f=>{if(f.taskId!==e)return;const o={status:f.status,currentCommand:f.currentCommand,currentIndex:f.currentIndex,totalCommands:f.totalCommands,error:f.error};if(f.status==="running"){C(),m.current=null,l.current===0&&(l.current=Date.now()),s(o);return}const p=l.current>0?Date.now()-l.current:0,x=Xi-p;l.current===0?(l.current=Date.now(),s({status:"running",totalCommands:f.totalCommands,currentIndex:f.totalCommands}),m.current=o,v.current=setTimeout(()=>i(o),Xi)):x>0?(m.current=o,C(),v.current=setTimeout(()=>i(o),x)):i(o)};return r.on(Qe.WORKSPACE_SETUP_PROGRESS,c),()=>{r.off(Qe.WORKSPACE_SETUP_PROGRESS,c),C(),l.current=0,m.current=null}},[e]),t}function Qr(){const e=We();return Ze({mutationFn:t=>fe.post(`/sessions/${t}/start`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ae.sessions.detail(s)}),e.invalidateQueries({queryKey:ae.tasks.all})}})}function Ro(){const e=We();return Ze({mutationFn:t=>fe.post(`/sessions/${t}/stop`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ae.sessions.detail(s)})}})}function Zr(){const e=We();return Ze({mutationFn:({id:t,message:s,providerId:l})=>fe.post(`/sessions/${t}/message`,{message:s,providerId:l}),onSuccess:()=>{e.invalidateQueries({queryKey:ae.workspaces.all}),e.invalidateQueries({queryKey:ae.tasks.all})}})}function Of(e,t){const s={};return ht({queryKey:ae.tasks.list(e,t),queryFn:()=>fe.get(`/projects/${e}/tasks`,{params:s}),enabled:!!e})}function Bf(e){const t=We();return Ze({mutationFn:s=>fe.post(`/projects/${e}/tasks`,s),onSuccess:()=>{t.invalidateQueries({queryKey:ae.tasks.list(e)}),t.invalidateQueries({queryKey:ae.tasks.stats(e)})}})}function If(){const e=We();return Ze({mutationFn:({id:t,status:s})=>fe.patch(`/tasks/${t}/status`,{status:s}),onSuccess:t=>{e.invalidateQueries({queryKey:ae.tasks.all}),e.invalidateQueries({queryKey:ae.tasks.detail(t.id)})}})}function Ff(){const e=We();return Ze({mutationFn:t=>fe.delete(`/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:ae.tasks.all})}})}function Hf(){const e=We();return Ze({mutationFn:t=>fe.post(`/tasks/${t}/retry`,{}),onSuccess:t=>{e.invalidateQueries({queryKey:ae.tasks.all}),e.invalidateQueries({queryKey:ae.workspaces.all}),e.invalidateQueries({queryKey:ae.tasks.detail(t.id)})}})}function Do(e,t){return k.useMemo(()=>{for(let s=e.length-1;s>=0;s--){const l=e[s];if(l.tokenUsage&&typeof l.tokenUsage.totalTokens=="number"&&l.tokenUsage.totalTokens>0)return{totalTokens:l.tokenUsage.totalTokens,modelContextWindow:l.tokenUsage.modelContextWindow}}return t??null},[e,t])}const zf="/api";async function Wf(e){const t=new FormData;t.append("file",e);const s=await fetch(`${zf}/attachments/upload`,{method:"POST",body:t});if(!s.ok){const l=await s.json().catch(()=>({}));throw new Error(l.error||`Upload failed (${s.status})`)}return s.json()}let $f=0;function Jr(){const[e,t]=k.useState([]),s=k.useRef(e);s.current=e;const l=k.useCallback(async c=>{const f=c.map(o=>({tempId:`tmp-${++$f}`,file:o,progress:0,status:"uploading"}));t(o=>[...o,...f]),await Promise.allSettled(f.map(async o=>{try{const p=await Wf(o.file);t(x=>x.map(S=>S.tempId===o.tempId?{...S,status:"done",progress:100,attachment:p}:S))}catch(p){t(x=>x.map(S=>S.tempId===o.tempId?{...S,status:"error",error:p instanceof Error?p.message:"Upload failed"}:S))}}))},[]),m=k.useCallback(c=>{t(f=>f.filter(o=>o.tempId!==c))},[]),v=k.useCallback(()=>{t([])},[]),C=k.useCallback(()=>{const c=s.current.filter(f=>f.status==="done"&&f.attachment);return c.length===0?"":c.map(f=>{const o=f.attachment;return`${o.mimeType.startsWith("image/")?"!":""}[${o.originalName}](${o.storagePath})`}).join(`
|
|
70
|
+
`)},[]),r=e.length>0,i=e.some(c=>c.status==="uploading");return{files:e,addFiles:l,removeFile:m,clear:v,buildMarkdownLinks:C,hasFiles:r,isUploading:i}}const Uf="/api";function qf(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Ns({files:e,onRemove:t}){return e.length===0?null:a.jsx("div",{className:"flex flex-wrap gap-2 px-4 pt-3 pb-1",children:e.map(s=>a.jsx(Kf,{item:s,onRemove:t},s.tempId))})}function Kf({item:e,onRemove:t}){const s=e.file.type.startsWith("image/"),l=e.status==="error",m=e.status==="uploading";return a.jsxs("div",{className:`relative group flex items-center gap-2 px-3 py-2 rounded-lg border text-xs max-w-[200px] ${l?"border-red-200 bg-red-50 text-red-600":"border-neutral-200 bg-neutral-50 text-neutral-700"}`,children:[s&&e.status==="done"&&e.attachment?a.jsx("img",{src:`${Uf}${e.attachment.url}`,alt:e.file.name,className:"w-8 h-8 rounded object-cover flex-shrink-0"}):a.jsx("span",{className:"flex-shrink-0",children:m?a.jsx(ze,{size:16,className:"animate-spin text-neutral-400"}):s?a.jsx(Ir,{size:16,className:"text-neutral-400"}):a.jsx(Cn,{size:16,className:"text-neutral-400"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"truncate font-medium",children:e.file.name}),l?a.jsx("div",{className:"truncate text-red-500",children:e.error}):a.jsx("div",{className:"text-neutral-400",children:qf(e.file.size)})]}),a.jsx("button",{onClick:()=>t(e.tempId),className:"absolute -top-1.5 -right-1.5 hidden group-hover:flex items-center justify-center w-5 h-5 rounded-full bg-neutral-700 text-white hover:bg-neutral-900 transition-colors",children:a.jsx(Fs,{size:10})})]})}function Ao({isOpen:e,onClose:t,taskId:s,taskTitle:l,taskDescription:m}){const{t:v}=ce(),[C,r]=k.useState(""),[i,c]=k.useState(""),[f,o]=k.useState("idle"),[p,x]=k.useState(null),S=We(),g=Eo(s),n=Qr(),{data:d,isLoading:h}=Hs();k.useEffect(()=>{if(!e||!d)return;const w=d.find(E=>E.availability.type!=="NOT_FOUND");w&&r(w.provider.id)},[e,d]),k.useEffect(()=>{if(e){const w=[l];m&&w.push(m),c(w.join(`
|
|
71
71
|
|
|
72
|
-
`)),o("idle"),x(null)}},[e,l,m]);const u=f!=="idle",_=async()=>{if(!(!C||!i.trim())){x(null);try{o("creating-workspace");const w=await g.mutateAsync({});o("creating-session");const E=await fe.post(`/workspaces/${w.id}/sessions`,{providerId:C,prompt:i.trim()});o("starting-session"),await n.mutateAsync(E.id),await S.invalidateQueries({queryKey:ae.workspaces.list(s)}),o("idle"),t()}catch(w){o("idle"),x(w instanceof Error?w.message:v("启动失败,请重试"))}}},y={idle:v("启动"),"creating-workspace":v("创建工作空间..."),"creating-session":v("创建会话..."),"starting-session":v("启动 Agent...")};return a.jsx(
|
|
72
|
+
`)),o("idle"),x(null)}},[e,l,m]);const u=f!=="idle",_=async()=>{if(!(!C||!i.trim())){x(null);try{o("creating-workspace");const w=await g.mutateAsync({});o("creating-session");const E=await fe.post(`/workspaces/${w.id}/sessions`,{providerId:C,prompt:i.trim()});o("starting-session"),await n.mutateAsync(E.id),await S.invalidateQueries({queryKey:ae.workspaces.list(s)}),o("idle"),t()}catch(w){o("idle"),x(w instanceof Error?w.message:v("启动失败,请重试"))}}},y={idle:v("启动"),"creating-workspace":v("创建工作空间..."),"creating-session":v("创建会话..."),"starting-session":v("启动 Agent...")};return a.jsx(Br,{isOpen:e,onClose:u?()=>{}:t,title:v("启动 Agent"),action:a.jsxs(a.Fragment,{children:[a.jsx(dt,{variant:"outline",onClick:t,disabled:u,children:v("取消")}),a.jsx(dt,{onClick:_,disabled:u||!C||!i.trim(),children:y[f]})]}),children:a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-2",children:v("选择 Provider")}),a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[h&&a.jsx("span",{className:"text-sm text-neutral-400",children:v("加载中...")}),d?.map(({provider:w,availability:E})=>{const b=E.type!=="NOT_FOUND";return a.jsxs(dt,{variant:C===w.id?"default":"outline",size:"sm",disabled:!b||u,onClick:()=>r(w.id),children:[w.name,!b&&v(" (不可用)")]},w.id)})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-2",children:v("任务描述")}),a.jsx("textarea",{value:i,onChange:w=>c(w.target.value),rows:5,disabled:u,placeholder:v("描述你想让 Agent 完成的任务..."),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm text-neutral-900 placeholder-neutral-400 focus:outline-none focus:ring-1 focus:ring-neutral-300 focus:border-neutral-300 resize-none disabled:opacity-50 disabled:bg-neutral-50"})]}),p&&a.jsx("div",{className:"text-sm text-red-600 bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:p})]})})}function jo({providers:e,currentProviderId:t,agentType:s,onSelect:l}){const{t:m}=ce(),[v,C]=k.useState(!1),r=k.useRef(null),i=e.filter(f=>String(f.provider.agentType)===s),c=e.find(f=>f.provider.id===t);return k.useEffect(()=>{function f(o){r.current&&!r.current.contains(o.target)&&C(!1)}if(v)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[v]),i.length<=1?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral-400 px-2 py-1.5 select-none cursor-default",children:[a.jsx(ni,{size:14,className:"shrink-0"}),a.jsx("span",{children:c?.provider.name?li(c.provider.name,12):s})]}):a.jsxs("div",{className:"relative",ref:r,children:[a.jsxs("button",{onClick:()=>C(!v),className:"flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg transition-colors cursor-pointer hover:bg-neutral-100 text-neutral-400 hover:text-neutral-600",title:`Provider: ${c?.provider.name??s} (click to change)`,children:[a.jsx(ni,{size:14,className:"shrink-0"}),a.jsx("span",{children:c?.provider.name?li(c.provider.name,12):s}),a.jsx(xt,{size:12,className:`shrink-0 transition-transform ${v?"rotate-180":""}`})]}),v&&a.jsxs("div",{className:"absolute bottom-full right-0 mb-1 bg-white rounded-lg border border-neutral-200 shadow-lg py-1 min-w-[160px] z-50",children:[a.jsx("div",{className:"px-2 py-1 text-xs text-neutral-400 border-b border-neutral-100",children:m("切换渠道")}),i.map(f=>a.jsxs("button",{onClick:()=>{l(f.provider.id),C(!1)},className:`w-full flex items-center justify-between px-3 py-2 text-sm text-left hover:bg-neutral-50 transition-colors ${f.provider.id===t?"bg-blue-50 text-blue-600":"text-neutral-700"}`,children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"truncate max-w-[120px]",children:f.provider.name}),f.provider.isDefault&&a.jsx("span",{className:"text-xs text-neutral-400",children:m("(默认)")})]}),f.provider.id===t&&a.jsx(ss,{size:14,className:"shrink-0"})]},f.provider.id))]})]})}function Xf({commands:e,selectedIndex:t,query:s,hasCatalog:l,title:m="Slash Commands",queryPrefix:v="/",emptyCatalogMessage:C="No slash commands catalog for this agent yet.",emptyQueryMessage:r,insertionHint:i="Enter / Tab to insert",compact:c=!1,onSelect:f}){const o=c?"px-1.5 pb-1.5":"px-2 pb-2",p=c?"px-2 py-1.5":"px-2.5 py-2",x=c?"max-h-36":"max-h-48";return a.jsxs("div",{className:c?"pt-1.5":"pt-2",children:[a.jsxs("div",{className:`mb-1 flex items-center justify-between ${c?"px-2 pt-0.5":"px-3 pt-1"}`,children:[a.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-neutral-400",children:m}),a.jsx("span",{className:"text-[10px] text-neutral-400",children:i})]}),e.length===0?a.jsx("div",{className:`${c?"px-2 pb-2 pt-1.5 text-[11px]":"px-3 pb-3 pt-2 text-xs"} text-neutral-400`,children:l?r??`No matches for ${v}${s}`:C}):a.jsx("div",{className:`${o} ${x} overflow-y-auto`,children:e.map((S,g)=>a.jsxs("button",{type:"button",onMouseDown:n=>n.preventDefault(),onClick:()=>f(S),className:`w-full rounded-lg border text-left transition-colors ${g===t?"border-neutral-300 bg-neutral-50":"border-transparent hover:border-neutral-200 hover:bg-neutral-50/80"} ${p}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"font-mono text-[13px] text-neutral-900",children:S.command}),S.kind&&S.kind!=="builtin"?a.jsx("span",{className:"rounded-full border border-neutral-200 px-1.5 py-0.5 text-[9px] uppercase tracking-[0.12em] text-neutral-500",children:S.scope?`${S.scope} ${S.kind}`:S.kind}):null]}),a.jsx("div",{className:`${c?"mt-0.5 text-[11px]":"mt-1 text-xs"} text-neutral-500`,children:S.description})]},S.command))})]})}const yt=12,ys=8;function Ps({open:e,anchorRef:t,commands:s,selectedIndex:l,query:m,hasCatalog:v,title:C,queryPrefix:r,emptyCatalogMessage:i,emptyQueryMessage:c,insertionHint:f,compact:o=!1,onSelect:p}){const x=k.useRef(null),[S,g]=k.useState(null);return k.useLayoutEffect(()=>{if(!e){g(null);return}const n=t.current;if(!n)return;let d=0;const h=()=>{const y=t.current;if(!y)return;const w=y.getBoundingClientRect(),E=window.innerWidth,b=window.innerHeight,R=o?260:320,j=o?E-yt*2:560,M=Math.min(Math.max(w.width,R),Math.max(R,j)),L=Math.min(Math.max(yt,w.left),Math.max(yt,E-yt-M)),T=b-w.bottom-ys-yt,B=w.top-ys-yt,I=x.current?.offsetHeight??(o?220:280),H=o?240:320,W=T<180&&B>T,N=Math.max(120,Math.min(H,W?B:T)),P=W?Math.max(yt,w.top-ys-Math.min(I,N)):Math.min(b-yt-Math.min(I,N),w.bottom+ys);g({top:P,left:L,width:M,maxHeight:N})},u=()=>{cancelAnimationFrame(d),d=requestAnimationFrame(h)};u();const _=new ResizeObserver(u);return _.observe(n),x.current&&_.observe(x.current),window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),window.visualViewport?.addEventListener("resize",u),window.visualViewport?.addEventListener("scroll",u),()=>{cancelAnimationFrame(d),_.disconnect(),window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0),window.visualViewport?.removeEventListener("resize",u),window.visualViewport?.removeEventListener("scroll",u)}},[t,s.length,o,e,m,l]),!e||!S||typeof document>"u"?null:Nt.createPortal(a.jsx("div",{className:"pointer-events-none fixed inset-0 z-[120]",children:a.jsx("div",{ref:x,className:"pointer-events-auto fixed overflow-hidden rounded-xl border border-neutral-200 bg-white shadow-lg shadow-neutral-200/70",style:{top:S.top,left:S.left,width:S.width,maxHeight:S.maxHeight},children:a.jsx(Xf,{commands:s,selectedIndex:l,query:m,hasCatalog:v,title:C,queryPrefix:r,emptyCatalogMessage:i,emptyQueryMessage:c,insertionHint:f,compact:o,onSelect:p})})}),document.body)}function Yf({workspaceId:e,gitStatus:t,onResolve:s}){const{t:l}=ce(),m=Mf();if(t.operation==="idle"||t.conflictedFiles.length===0)return null;const v=t.operation==="rebase"?"Rebase":"Merge";return a.jsxs("div",{className:"mx-6 mt-3 px-4 py-3 rounded-lg border border-amber-200 bg-amber-50 flex items-center gap-3",children:[a.jsx(gn,{size:18,className:"text-amber-600 shrink-0"}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("p",{className:"text-sm font-medium text-amber-900",children:l("{opLabel} 冲突 — {count} 个文件",{opLabel:v,count:t.conflictedFiles.length})})}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsx(dt,{variant:"outline",size:"sm",onClick:()=>m.mutate(e),disabled:m.isPending,children:l("中止操作")}),a.jsx(dt,{size:"sm",onClick:s,children:l("解决冲突")})]})]})}function Vf(e,t,s,l){const m=s.map(v=>`- ${v}`).join(`
|
|
73
73
|
`);return l===Sa.REBASE?["## Rebase 冲突解决","",`在将分支 \`${e}\` rebase 到 \`${t}\` 时发生了冲突。`,"","### 冲突文件",m,"","### 解决步骤","1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git rebase --continue` 继续 rebase 流程"].join(`
|
|
74
74
|
`):["## Merge 冲突解决","",`在将分支 \`${e}\` 合并到 \`${t}\` 时发生了冲突。`,"","### 冲突文件",m,"","### 解决步骤","1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git commit` 完成合并"].join(`
|
|
75
|
-
`)}function Gf({open:e,onOpenChange:t,workspaceId:s,conflictOp:l,conflictedFiles:m,sourceBranch:v,targetBranch:C,sessions:r}){const{t:i}=ce(),[c,f]=k.useState(""),o=Qr(),p=Vr(),x=()=>{if(!c)return;const n=Vf(v,C,m,l);o.mutate({id:c,message:n},{onSuccess:()=>t(!1)})},S=()=>{p.mutate({workspaceId:s},{onSuccess:()=>t(!1)})},g=l==="REBASE"?"Rebase":"Merge";return a.jsx(Or,{isOpen:e,onClose:()=>t(!1),title:i("解决 {opLabel} 冲突",{opLabel:g}),action:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(dt,{variant:"outline",onClick:S,children:i("在 IDE 中打开")}),a.jsx(dt,{onClick:x,disabled:!c||o.isPending,children:o.isPending?i("发送中..."):i("AI 辅助解决")})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:i("冲突文件({count})",{count:m.length})}),a.jsx("div",{className:"max-h-40 overflow-y-auto rounded-md border border-neutral-200 bg-neutral-50",children:m.map(n=>a.jsx("div",{className:"px-3 py-1.5 text-xs font-mono text-neutral-700 border-b border-neutral-100 last:border-b-0",children:n},n))})]}),r.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:i("选择 Session(AI 辅助解决)")}),a.jsxs("select",{value:c,onChange:n=>f(n.target.value),className:"w-full px-3 py-2 text-sm border border-neutral-200 rounded-md bg-white focus:outline-none focus:ring-2 focus:ring-neutral-300",children:[a.jsx("option",{value:"",children:i("选择一个 Session...")}),r.map(n=>a.jsxs("option",{value:n.id,children:[n.agentType," — ",n.status]},n.id))]})]}),r.length===0&&a.jsx("p",{className:"text-sm text-neutral-500",children:i("没有可用的 Session,请在 IDE 中手动解决冲突。")})]})})}function Mt({children:e,variant:t}){const s={success:"bg-emerald-50 text-emerald-700 border-emerald-200",warning:"bg-amber-50 text-amber-700 border-amber-200",info:"bg-blue-50 text-blue-700 border-blue-200",neutral:"bg-neutral-50 text-neutral-600 border-neutral-200",danger:"bg-red-50 text-red-700 border-red-200"};return a.jsx("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${s[t]}`,children:e})}function Qf({gitStatus:e,branchName:t,targetBranch:s}){const{t:l}=ce();return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:t}),a.jsx(xn,{size:14,className:"text-neutral-400"}),a.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:s})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.hasUncommittedChanges&&a.jsxs(Mt,{variant:"danger",children:[a.jsx(Ha,{size:12}),l("{count} 个未提交变更",{count:e.uncommittedCount})]}),e.conflictedFiles.length>0&&a.jsxs(Mt,{variant:"warning",children:[a.jsx(gn,{size:12}),l("{count} 个冲突文件",{count:e.conflictedFiles.length})]}),e.operation==="rebase"&&e.conflictedFiles.length===0&&a.jsxs(Mt,{variant:"warning",children:[a.jsx(ze,{size:12,className:"animate-spin"}),l("变基进行中")]}),e.operation==="merge"&&e.conflictedFiles.length===0&&a.jsxs(Mt,{variant:"warning",children:[a.jsx(ze,{size:12,className:"animate-spin"}),l("合并进行中")]}),e.ahead>0&&a.jsxs(Mt,{variant:"success",children:[a.jsx(hi,{size:12}),l("领先 {count} 个提交",{count:e.ahead})]}),e.behind>0&&a.jsx(Mt,{variant:"warning",children:l("落后 {count} 个提交",{count:e.behind})}),e.operation==="idle"&&e.ahead===0&&e.behind===0&&!e.hasUncommittedChanges&&a.jsxs(Mt,{variant:"neutral",children:[a.jsx(hi,{size:12}),l("已是最新")]})]}),e.hasUncommittedChanges&&a.jsx("div",{className:"px-3 py-2 rounded-md bg-amber-50 border border-amber-200 text-xs text-amber-800",children:l("工作区有未提交的变更,请先让 Agent 提交或手动处理后再执行 Rebase / Merge 操作。")})]})}function Zf({open:e,onOpenChange:t,workspaceId:s,branchName:l,targetBranch:m,commitMessage:v,onRefreshCommitMessage:C,onConflict:r}){const{t:i}=ce(),{data:c,isLoading:f}=ko(s),o=Lf(),p=Tf(),[x,S]=k.useState(null),[g,n]=k.useState("select"),[d,h]=k.useState(""),[u,_]=k.useState(!1),y=c?c.conflictedFiles.length>0:!1,w=c?c.operation!=="idle":!1,E=c?.hasUncommittedChanges??!1;k.useEffect(()=>{e&&(n("select"),S(null),_(!1),C?.())},[e,C]),k.useEffect(()=>{!e||u||h(v??"")},[e,v,u]);const b=T=>{_(!0),h(B=>typeof T=="function"?T(B):T)},R=()=>{S(null),o.mutate(s,{onSuccess:()=>t(!1),onError:T=>{const B=T;B.status===409?(t(!1),r()):S(B.message??i("变基失败"))}})},j=()=>{S(null),n("confirm")},M=()=>{S(null);const T=d.trim()||void 0;p.mutate({id:s,commitMessage:T},{onSuccess:()=>t(!1),onError:B=>{const I=B;I.status===409?(t(!1),r()):S(I.message??i("合并失败"))}})},L=i(g==="confirm"?"确认合并":"Git 操作");return a.jsx(Or,{isOpen:e,onClose:()=>t(!1),title:L,children:f||!c?a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-neutral-400",children:[a.jsx(ze,{size:18,className:"animate-spin"}),a.jsx("span",{className:"text-sm",children:i("加载分支状态...")})]}):g==="confirm"?a.jsx(em,{editableMessage:d,setEditableMessage:b,error:x,isPending:p.isPending,onConfirm:M,onBack:()=>n("select"),branchName:l,targetBranch:m}):a.jsx(Jf,{gitStatus:c,branchName:l,targetBranch:m,error:x,isDirty:E,hasConflicts:y,isOperationInProgress:w,rebasePending:o.isPending,mergePending:p.isPending,onRebase:R,onMerge:j})})}function Jf({gitStatus:e,branchName:t,targetBranch:s,error:l,isDirty:m,hasConflicts:v,isOperationInProgress:C,rebasePending:r,mergePending:i,onRebase:c,onMerge:f}){const{t:o}=ce();return a.jsxs("div",{className:"space-y-5",children:[a.jsx(Qf,{gitStatus:e,branchName:t,targetBranch:s}),l&&a.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:l}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("button",{onClick:c,disabled:r||v||C||m,className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-neutral-200 hover:border-neutral-300 hover:bg-neutral-50 transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-50 flex items-center justify-center shrink-0",children:a.jsx(Ka,{size:16,className:"text-blue-600"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm font-medium text-neutral-900",children:o(r?"变基中...":"变基 (Rebase)")}),a.jsx("div",{className:"text-xs text-neutral-500",children:o("将当前分支变基到最新的 {targetBranch}",{targetBranch:s})})]})]}),a.jsxs("button",{onClick:f,disabled:i||v||C||m||e.ahead===0,className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-neutral-200 hover:border-neutral-300 hover:bg-neutral-50 transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx("div",{className:"w-8 h-8 rounded-md bg-emerald-50 flex items-center justify-center shrink-0",children:a.jsx(En,{size:16,className:"text-emerald-600"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm font-medium text-neutral-900",children:o(i?"合并中...":"合并 (Merge)")}),a.jsx("div",{className:"text-xs text-neutral-500",children:o("Squash merge 到 {targetBranch}",{targetBranch:s})})]})]})]})]})}function em({editableMessage:e,setEditableMessage:t,error:s,isPending:l,onConfirm:m,onBack:v,branchName:C,targetBranch:r}){const{t:i}=ce();return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:C}),a.jsx(xn,{size:14,className:"text-neutral-400"}),a.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:r})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-neutral-600 mb-1.5",children:i("提交消息")}),a.jsx("textarea",{value:e,onChange:c=>t(c.target.value),placeholder:i("输入提交消息..."),rows:4,className:"w-full px-3 py-2 rounded-md border border-neutral-200 text-sm font-mono text-neutral-800 placeholder:text-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-300 resize-none"}),!e.trim()&&a.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:i("留空将使用默认消息")})]}),s&&a.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:s}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx("button",{onClick:v,disabled:l,className:"px-4 py-2 rounded-md text-sm text-neutral-600 hover:bg-neutral-100 transition-colors disabled:opacity-50",children:i("返回")}),a.jsx("button",{onClick:m,disabled:l,className:"flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium text-white bg-emerald-600 hover:bg-emerald-700 transition-colors disabled:opacity-50",children:l?a.jsxs(a.Fragment,{children:[a.jsx(ze,{size:14,className:"animate-spin"}),i("合并中...")]}):a.jsxs(a.Fragment,{children:[a.jsx(En,{size:14}),i("确认合并")]})})]})]})}function tm({agentType:e,workingDir:t}){return ht({queryKey:ae.system.slashCommandCatalog(e,t),queryFn:async()=>(await fe.get("/system/slash-command-catalog",{params:{agentType:String(e),...t?{workingDir:t}:{}}})).commands,enabled:!!e,staleTime:3e4})}function sm(e,t){const s=new Set,l=[];for(const m of[...e,...t]){const v=m.command.trim().toLowerCase();!v||s.has(v)||(s.add(v),l.push(m.kind?m:{...m,kind:"builtin"}))}return l}function Zs(e){return e.trim().toLowerCase().replace(/^[/$]/,"")}function rm(e){return Zs(e.command)}function im(e,t){if(!t)return 1e3;const s=rm(e),l=e.aliases?.map(Zs)??[],m=[s,...l];let v=0;for(const r of m)r===t?v=Math.max(v,500):r.startsWith(t)?v=Math.max(v,400-(r.length-t.length)):r.includes(t)&&(v=Math.max(v,250-r.indexOf(t)));return v>0?v:`${s} ${l.join(" ")} ${e.description}`.toLowerCase().includes(t)?100:0}function Yi(e){const t=/(^|[\s])\$([^\s]*)$/.exec(e);if(!t||t.index===void 0)return null;const s=t.index+t[1].length;return{query:Zs(t[2]),replaceStart:s}}function To(e,t){const s=Zs(t);return s?e.map((l,m)=>({command:l,index:m,score:im(l,s)})).filter(l=>l.score>0).sort((l,m)=>m.score-l.score||l.index-m.index||l.command.command.localeCompare(m.command.command)).map(l=>l.command):e.slice()}const nm=[{command:"/permissions",description:"Manage what Codex can do without approval"},{command:"/sandbox-add-read-dir",description:"Grant read access to another directory"},{command:"/agent",description:"Switch between built-in agent personas"},{command:"/apps",description:"Manage connected apps"},{command:"/clear",description:"Start a fresh conversation"},{command:"/compact",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last assistant message to your clipboard"},{command:"/diff",description:"Show the current git diff"},{command:"/experimental",description:"Toggle experimental features"},{command:"/feedback",description:"Share feedback on Codex CLI"},{command:"/init",description:"Create or update AGENTS.md for the repo"},{command:"/logout",description:"Sign out of Codex"},{command:"/mcp",description:"Manage MCP servers"},{command:"/mention",description:"Add files or directories to the conversation context"},{command:"/model",description:"Change the active model"},{command:"/fast",description:"Toggle low reasoning mode"},{command:"/plan",description:"Toggle plan mode for code changes"},{command:"/personality",description:"Select how Codex communicates"},{command:"/ps",description:"List running background tasks"},{command:"/fork",description:"Fork the current conversation state"},{command:"/resume",description:"Resume a previous conversation"},{command:"/new",description:"Open a conversation picker to start or resume"},{command:"/quit",description:"Exit Codex CLI",aliases:["exit"]},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show session and configuration status"},{command:"/debug-config",description:"Inspect the effective configuration"},{command:"/statusline",description:"Configure the custom status line"},{command:"/skills",description:"Browse available skills and insert a $skill mention"}],om=[{command:"/clear",description:"Clear the conversation history"},{command:"/compact",description:"Compact the conversation context",aliases:["compact focus"]},{command:"/config",description:"Open the configuration panel"},{command:"/cost",description:"Show token usage and cost"},{command:"/doctor",description:"Check Claude Code installation health"},{command:"/help",description:"Show help and available commands"},{command:"/init",description:"Initialize project instructions"},{command:"/login",description:"Sign in to Claude Code"},{command:"/logout",description:"Sign out of Claude Code"},{command:"/mcp",description:"Manage MCP servers"},{command:"/memory",description:"Edit project memory files"},{command:"/model",description:"Change the active model"},{command:"/permissions",description:"Review or update tool permissions"},{command:"/pr_comments",description:"Read pull request review comments"},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show account and system status"},{command:"/terminal-setup",description:"Configure terminal newline shortcuts"},{command:"/vim",description:"Toggle vim mode"}],am=[{command:"/bug",description:"File an issue about Gemini CLI"},{command:"/chat",description:"Manage chat checkpoints and exports"},{command:"/clear",description:"Clear the terminal display"},{command:"/compress",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last Gemini CLI output"},{command:"/directory",description:"Manage additional workspace directories",aliases:["dir"]},{command:"/editor",description:"Choose the preferred editor"},{command:"/extensions",description:"List active Gemini CLI extensions"},{command:"/help",description:"Show help and command usage",aliases:["?"]},{command:"/mcp",description:"Show MCP servers and tools"},{command:"/memory",description:"Manage loaded GEMINI.md memory"},{command:"/restore",description:"Restore files from a tool checkpoint"},{command:"/settings",description:"Open the Gemini CLI settings editor"},{command:"/stats",description:"Show session statistics and token usage"},{command:"/theme",description:"Change the Gemini CLI theme"},{command:"/auth",description:"Change the authentication method"},{command:"/about",description:"Show version information"},{command:"/tools",description:"List currently available tools"},{command:"/privacy",description:"Review privacy and data collection settings"},{command:"/quit",description:"Exit Gemini CLI",aliases:["exit"]},{command:"/vim",description:"Toggle vim mode"},{command:"/init",description:"Generate a tailored GEMINI.md file"}],lm=[{command:"/model",description:"Change the active model"},{command:"/plan",description:"Create or reopen a plan"},{command:"/ask",description:"Toggle ask mode (read-only Q&A)"},{command:"/debug",description:"Toggle debug mode"},{command:"/clear",description:"Start a new chat session",aliases:["new","new-chat","newchat"]},{command:"/compress",description:"Summarize the conversation to reduce context"},{command:"/vim",description:"Toggle vim mode"},{command:"/shell",description:"Enter shell mode"},{command:"/about",description:"Show CLI, system, and account information"},{command:"/setup-terminal",description:"Configure terminal newline shortcuts"},{command:"/feedback",description:"Share feedback with the Cursor team"},{command:"/open",description:"Open the repository git root in Cursor"},{command:"/cursor",description:"Alias for /open",aliases:["open"]},{command:"/resume-chat",description:"Resume a previous chat by folder name",aliases:["resume"]},{command:"/copy-request-id",description:"Copy the last request ID"},{command:"/copy-conversation-id",description:"Copy the current conversation ID"},{command:"/logout",description:"Sign out from Cursor"},{command:"/quit",description:"Exit Cursor Agent",aliases:["exit"]},{command:"/mcp",description:"Manage MCP servers"}],cm={[_t.CODEX]:nm,[_t.CLAUDE_CODE]:om,[_t.GEMINI_CLI]:am,[_t.CURSOR_AGENT]:lm};function Lo(e){return e.trim().toLowerCase().replace(/^\//,"")}function hm(e){return e?(cm[e]??[]).map(t=>({...t,kind:t.kind??"builtin"})):[]}function um(e){const t=e.match(/^\s*\/([^\s]*)$/);return t?Lo(t[1]):null}function dm(e,t){return To(e,Lo(t))}function fm(e){const t=e.key==="Enter"&&!e.shiftKey&&!e.repeat&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229,s=e.key==="Tab"&&!e.shiftKey;return t||s}function Mo({agentType:e,workingDir:t,input:s,setInput:l,textareaRef:m,minHeight:v,maxHeight:C}){const[r,i]=k.useState(0),{data:c=[]}=tm({agentType:e,workingDir:t}),f=k.useMemo(()=>sm(hm(e),c),[e,c]),o=k.useMemo(()=>um(s),[s]),p=k.useMemo(()=>o===null?[]:dm(f,o),[f,o]),x=k.useCallback(()=>{const n=m.current;n&&(n.style.height="auto",n.style.height=`${Math.max(v,Math.min(n.scrollHeight,C))}px`)},[C,v,m]);k.useEffect(()=>{i(0)},[e,o]),k.useEffect(()=>{r<p.length||i(0)},[p.length,r]);const S=k.useCallback(n=>{const h=`${s.match(/^(\s*)\/[^\s]*$/)?.[1]??""}${n.command} `;l(h),requestAnimationFrame(()=>{const u=m.current;u&&(x(),u.focus(),u.setSelectionRange(h.length,h.length))})},[s,x,l,m]),g=k.useCallback(n=>o===null||p.length===0?!1:n.key==="ArrowDown"?(n.preventDefault(),i(d=>(d+1)%p.length),!0):n.key==="ArrowUp"?(n.preventDefault(),i(d=>(d-1+p.length)%p.length),!0):fm(n)?(n.preventDefault(),S(p[r]??p[0]),!0):!1,[S,p,o,r]);return{allCommands:f,query:o,filteredCommands:p,selectedIndex:r,setSelectedIndex:i,applyCommand:S,handleKeyDown:g}}function mm({agentType:e,workingDir:t}){return ht({queryKey:ae.system.skillCatalog(e,t),queryFn:async()=>(await fe.get("/system/skill-catalog",{params:{agentType:String(e),...t?{workingDir:t}:{}}})).commands,enabled:e===_t.CODEX,staleTime:3e4})}function pm(e){const t=e.key==="Enter"&&!e.shiftKey&&!e.repeat&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229,s=e.key==="Tab"&&!e.shiftKey;return t||s}function No({agentType:e,workingDir:t,input:s,setInput:l,textareaRef:m,minHeight:v,maxHeight:C}){const[r,i]=k.useState(0),{data:c=[]}=mm({agentType:e,workingDir:t}),o=k.useMemo(()=>e===_t.CODEX?Yi(s):null,[e,s])?.query??null,p=k.useMemo(()=>o===null?[]:To(c,o),[o,c]),x=k.useCallback(()=>{const n=m.current;n&&(n.style.height="auto",n.style.height=`${Math.max(v,Math.min(n.scrollHeight,C))}px`)},[C,v,m]);k.useEffect(()=>{i(0)},[e,o]),k.useEffect(()=>{r<p.length||i(0)},[p.length,r]);const S=k.useCallback(n=>{const d=Yi(s);if(!d)return;const h=`${s.slice(0,d.replaceStart)}${n.command} `;l(h),requestAnimationFrame(()=>{const u=m.current;u&&(x(),u.focus(),u.setSelectionRange(h.length,h.length))})},[s,x,l,m]),g=k.useCallback(n=>o===null||p.length===0?!1:n.key==="ArrowDown"?(n.preventDefault(),i(d=>(d+1)%p.length),!0):n.key==="ArrowUp"?(n.preventDefault(),i(d=>(d-1+p.length)%p.length),!0):pm(n)?(n.preventDefault(),S(p[r]??p[0]),!0):!1,[S,p,o,r]);return{allSkills:c,query:o,filteredSkills:p,selectedIndex:r,setSelectedIndex:i,applySkill:S,handleKeyDown:g}}const vm="/api",gm=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?`${vm}/attachments/by-path?path=${encodeURIComponent(e)}`:e,_m=({src:e,alt:t,...s})=>a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:a.jsx("img",{src:e,alt:t,...s,className:"max-w-[300px] max-h-[200px] object-contain rounded-lg border border-neutral-200 cursor-pointer hover:opacity-90 transition-opacity"})}),bm={img:_m},xm=675,Vi=320,Gi=1200;function Sm(){const{t:e}=ce();return a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-white text-neutral-400 select-none",children:[a.jsx("div",{className:"w-16 h-16 bg-neutral-50 rounded-2xl border border-neutral-100 flex items-center justify-center mb-6",children:a.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-300",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),a.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),a.jsx("h3",{className:"text-neutral-900 font-medium mb-2 text-lg",children:"Agent Tower"}),a.jsx("p",{className:"text-sm max-w-sm text-center text-neutral-500 leading-relaxed",children:e("Select a task from the sidebar to view logs, monitor execution, or interact with an agent.")})]})}const Qi=[{status:le.Review,className:"bg-amber-50 text-amber-700 border-amber-100",hoverClass:"hover:bg-amber-100",icon:a.jsx(Tr,{className:"w-3 h-3"})},{status:le.Running,className:"bg-blue-50 text-blue-700 border-blue-100",hoverClass:"hover:bg-blue-100",icon:a.jsx(Lr,{className:"w-3 h-3"})},{status:le.Pending,className:"bg-neutral-50 text-neutral-600 border-neutral-100",hoverClass:"hover:bg-neutral-100",icon:a.jsx(Mr,{className:"w-3 h-3"})},{status:le.Done,className:"bg-emerald-50 text-emerald-700 border-emerald-100",hoverClass:"hover:bg-emerald-100",icon:a.jsx(Nr,{className:"w-3 h-3"})},{status:le.Cancelled,className:"bg-neutral-50 text-neutral-500 border-neutral-200",hoverClass:"hover:bg-neutral-200",icon:a.jsx(Pr,{className:"w-3 h-3"})}];function ym({status:e,onChangeStatus:t}){const{t:s}=ce(),[l,m]=k.useState(!1),v=k.useRef(null);k.useEffect(()=>{if(!l)return;const r=i=>{v.current&&!v.current.contains(i.target)&&m(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[l]);const C=Qi.find(r=>r.status===e);return a.jsxs("div",{className:"relative",ref:v,children:[a.jsxs("button",{onClick:()=>t&&m(r=>!r),className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border transition-colors ${C.className} ${t?"cursor-pointer hover:opacity-80":""}`,children:[C.icon,a.jsx("span",{children:s(e)}),t&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-0.5 transition-transform ${l?"rotate-180":""}`,children:a.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})]}),l&&a.jsx("div",{className:"absolute right-0 top-full mt-2 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1 animate-in fade-in zoom-in-95 duration-100",children:Qi.filter(r=>r.status!==e).map(r=>a.jsxs("button",{onClick:()=>{t?.(r.status),m(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-xs font-medium transition-colors ${r.hoverClass}`,children:[a.jsx("span",{className:r.className.split(" ").find(i=>i.startsWith("text-")),children:r.icon}),a.jsx("span",{className:"text-neutral-700",children:s(r.status)})]},r.status))})]})}function Cm({task:e,onDeleteTask:t,isDeleting:s,onTaskStatusChange:l}){const{t:m}=ce(),[v,C]=k.useState(""),[r,i]=k.useState(!1),[c,f]=k.useState(!1),[o,p]=k.useState(!1),[x,S]=k.useState(!1),[g,n]=k.useState(!1),[d,h]=k.useState(!1),[u,_]=k.useState(!1),[y,w]=k.useState(!1),E=k.useRef(null),b=k.useRef(null),R=k.useRef(null),j=k.useRef(null),{scrollRef:M,contentRef:L,isAtBottom:T,scrollToBottom:B}=qn({resize:"smooth",initial:"instant"}),[I,H]=k.useState(xm),[W,A]=k.useState(!0),[N,P]=k.useState(!1),O=k.useRef(0),$=k.useRef(0),X=k.useRef(null),{data:K,isLoading:Q}=wo(e?.id??""),se=Pf(e?.id);k.useEffect(()=>{w(!1)},[e?.id]),k.useEffect(()=>{if(!y||!K)return;K.some(ne=>ne.status==="ACTIVE"&&ne.sessions&&ne.sessions.length>0)&&w(!1)},[K,y]);const D=k.useMemo(()=>{if(y||!K)return null;const G=$e=>{const tr=$e.createdAt,Yt=$e.endedAt??$e.startedAt??tr;if(!Yt)return 0;const zt=Date.parse(Yt);return Number.isNaN(zt)?0:zt},ne=($e,tr)=>{const Yt=$e.filter(zt=>tr.includes(zt.status));return Yt.length===0?null:Yt.sort((zt,sa)=>G(sa)-G(zt))[0]??null},Ee=K.filter($e=>$e.status==="ACTIVE"&&Array.isArray($e.sessions)).flatMap($e=>$e.sessions??[]),rt=ne(Ee,[Le.RUNNING])??ne(Ee,[Le.PENDING])??ne(Ee,[Le.COMPLETED,Le.FAILED,Le.CANCELLED]);if(rt)return rt;const vt=K.filter($e=>($e.status==="MERGED"||$e.status==="ABANDONED")&&Array.isArray($e.sessions)).flatMap($e=>$e.sessions??[]);return ne(vt,[Le.COMPLETED,Le.FAILED,Le.CANCELLED])},[K,y]),F=D?.id??"",U=D?.status===Le.RUNNING||D?.status===Le.PENDING,z=!!e?.projectArchivedAt,te=!!e?.projectRepoDeletedAt,Y=m(te?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。"),{data:ie}=Hs(),[ge,me]=k.useState(null);k.useEffect(()=>{me(D?.providerId??null)},[D?.providerId]);const Me=k.useMemo(()=>!D||!K?!1:!K.some(ne=>ne.status==="ACTIVE"&&ne.sessions?.some(Ee=>Ee.id===D.id)),[D,K]),re=k.useMemo(()=>{if(!(!K||y)){for(const G of K)if(G.status==="ACTIVE"&&G.worktreePath)return G.worktreePath;return K[0]?.worktreePath}},[K,y]),Be=Mo({agentType:D?.agentType,workingDir:re,input:v,setInput:C,textareaRef:R,minHeight:60,maxHeight:300}),Ce=No({agentType:D?.agentType,workingDir:re,input:v,setInput:C,textareaRef:R,minHeight:60,maxHeight:300}),oe=k.useMemo(()=>K?K.find(ne=>ne.status==="ACTIVE")?.id:void 0,[K]),{data:Ne}=ko(oe??""),qe=k.useMemo(()=>K?K.find(ne=>ne.status==="ACTIVE")?.sessions??[]:[],[K]),Re=k.useMemo(()=>K?K.find(ne=>ne.status==="ACTIVE")?.branchName??"":"",[K]),Ve=k.useMemo(()=>K?K.find(ne=>ne.status==="ACTIVE")?.commitMessage:void 0,[K]),be=We(),st=k.useCallback(()=>e?.id?be.invalidateQueries({queryKey:ae.workspaces.list(e.id)}):Promise.resolve(),[e?.id,be]);k.useEffect(()=>{if(!u)return;const G=ne=>{b.current&&!b.current.contains(ne.target)&&_(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[u]);const Ke=Qr(),Pe=Vr(),Oe=Hf(),De=Eo(e?.id??""),V=Gr(),Z=k.useCallback(async()=>{if(!e?.id)return;const G=D?.providerId??ie?.find(Ee=>Ee.availability.type!=="NOT_FOUND")?.provider.id;if(!G)return;const ne=[e.title,e.description].filter(Boolean).join(`
|
|
75
|
+
`)}function Gf({open:e,onOpenChange:t,workspaceId:s,conflictOp:l,conflictedFiles:m,sourceBranch:v,targetBranch:C,sessions:r}){const{t:i}=ce(),[c,f]=k.useState(""),o=Zr(),p=Gr(),x=()=>{if(!c)return;const n=Vf(v,C,m,l);o.mutate({id:c,message:n},{onSuccess:()=>t(!1)})},S=()=>{p.mutate({workspaceId:s},{onSuccess:()=>t(!1)})},g=l==="REBASE"?"Rebase":"Merge";return a.jsx(Br,{isOpen:e,onClose:()=>t(!1),title:i("解决 {opLabel} 冲突",{opLabel:g}),action:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(dt,{variant:"outline",onClick:S,children:i("在 IDE 中打开")}),a.jsx(dt,{onClick:x,disabled:!c||o.isPending,children:o.isPending?i("发送中..."):i("AI 辅助解决")})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:i("冲突文件({count})",{count:m.length})}),a.jsx("div",{className:"max-h-40 overflow-y-auto rounded-md border border-neutral-200 bg-neutral-50",children:m.map(n=>a.jsx("div",{className:"px-3 py-1.5 text-xs font-mono text-neutral-700 border-b border-neutral-100 last:border-b-0",children:n},n))})]}),r.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:i("选择 Session(AI 辅助解决)")}),a.jsxs("select",{value:c,onChange:n=>f(n.target.value),className:"w-full px-3 py-2 text-sm border border-neutral-200 rounded-md bg-white focus:outline-none focus:ring-2 focus:ring-neutral-300",children:[a.jsx("option",{value:"",children:i("选择一个 Session...")}),r.map(n=>a.jsxs("option",{value:n.id,children:[n.agentType," — ",n.status]},n.id))]})]}),r.length===0&&a.jsx("p",{className:"text-sm text-neutral-500",children:i("没有可用的 Session,请在 IDE 中手动解决冲突。")})]})})}function Mt({children:e,variant:t}){const s={success:"bg-emerald-50 text-emerald-700 border-emerald-200",warning:"bg-amber-50 text-amber-700 border-amber-200",info:"bg-blue-50 text-blue-700 border-blue-200",neutral:"bg-neutral-50 text-neutral-600 border-neutral-200",danger:"bg-red-50 text-red-700 border-red-200"};return a.jsx("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${s[t]}`,children:e})}function Qf({gitStatus:e,branchName:t,targetBranch:s}){const{t:l}=ce();return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:t}),a.jsx(xn,{size:14,className:"text-neutral-400"}),a.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:s})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.hasUncommittedChanges&&a.jsxs(Mt,{variant:"danger",children:[a.jsx(Ha,{size:12}),l("{count} 个未提交变更",{count:e.uncommittedCount})]}),e.conflictedFiles.length>0&&a.jsxs(Mt,{variant:"warning",children:[a.jsx(gn,{size:12}),l("{count} 个冲突文件",{count:e.conflictedFiles.length})]}),e.operation==="rebase"&&e.conflictedFiles.length===0&&a.jsxs(Mt,{variant:"warning",children:[a.jsx(ze,{size:12,className:"animate-spin"}),l("变基进行中")]}),e.operation==="merge"&&e.conflictedFiles.length===0&&a.jsxs(Mt,{variant:"warning",children:[a.jsx(ze,{size:12,className:"animate-spin"}),l("合并进行中")]}),e.ahead>0&&a.jsxs(Mt,{variant:"success",children:[a.jsx(hi,{size:12}),l("领先 {count} 个提交",{count:e.ahead})]}),e.behind>0&&a.jsx(Mt,{variant:"warning",children:l("落后 {count} 个提交",{count:e.behind})}),e.operation==="idle"&&e.ahead===0&&e.behind===0&&!e.hasUncommittedChanges&&a.jsxs(Mt,{variant:"neutral",children:[a.jsx(hi,{size:12}),l("已是最新")]})]}),e.hasUncommittedChanges&&a.jsx("div",{className:"px-3 py-2 rounded-md bg-amber-50 border border-amber-200 text-xs text-amber-800",children:l("工作区有未提交的变更,请先让 Agent 提交或手动处理后再执行 Rebase / Merge 操作。")})]})}function Zf({open:e,onOpenChange:t,workspaceId:s,branchName:l,targetBranch:m,commitMessage:v,onRefreshCommitMessage:C,onConflict:r}){const{t:i}=ce(),{data:c,isLoading:f}=ko(s),o=Lf(),p=Tf(),[x,S]=k.useState(null),[g,n]=k.useState("select"),[d,h]=k.useState(""),[u,_]=k.useState(!1),y=c?c.conflictedFiles.length>0:!1,w=c?c.operation!=="idle":!1,E=c?.hasUncommittedChanges??!1;k.useEffect(()=>{e&&(n("select"),S(null),_(!1),C?.())},[e,C]),k.useEffect(()=>{!e||u||h(v??"")},[e,v,u]);const b=T=>{_(!0),h(B=>typeof T=="function"?T(B):T)},R=()=>{S(null),o.mutate(s,{onSuccess:()=>t(!1),onError:T=>{const B=T;B.status===409?(t(!1),r()):S(B.message??i("变基失败"))}})},j=()=>{S(null),n("confirm")},M=()=>{S(null);const T=d.trim()||void 0;p.mutate({id:s,commitMessage:T},{onSuccess:()=>t(!1),onError:B=>{const I=B;I.status===409?(t(!1),r()):S(I.message??i("合并失败"))}})},L=i(g==="confirm"?"确认合并":"Git 操作");return a.jsx(Br,{isOpen:e,onClose:()=>t(!1),title:L,children:f||!c?a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-neutral-400",children:[a.jsx(ze,{size:18,className:"animate-spin"}),a.jsx("span",{className:"text-sm",children:i("加载分支状态...")})]}):g==="confirm"?a.jsx(em,{editableMessage:d,setEditableMessage:b,error:x,isPending:p.isPending,onConfirm:M,onBack:()=>n("select"),branchName:l,targetBranch:m}):a.jsx(Jf,{gitStatus:c,branchName:l,targetBranch:m,error:x,isDirty:E,hasConflicts:y,isOperationInProgress:w,rebasePending:o.isPending,mergePending:p.isPending,onRebase:R,onMerge:j})})}function Jf({gitStatus:e,branchName:t,targetBranch:s,error:l,isDirty:m,hasConflicts:v,isOperationInProgress:C,rebasePending:r,mergePending:i,onRebase:c,onMerge:f}){const{t:o}=ce();return a.jsxs("div",{className:"space-y-5",children:[a.jsx(Qf,{gitStatus:e,branchName:t,targetBranch:s}),l&&a.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:l}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("button",{onClick:c,disabled:r||v||C||m,className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-neutral-200 hover:border-neutral-300 hover:bg-neutral-50 transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-50 flex items-center justify-center shrink-0",children:a.jsx(Ka,{size:16,className:"text-blue-600"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm font-medium text-neutral-900",children:o(r?"变基中...":"变基 (Rebase)")}),a.jsx("div",{className:"text-xs text-neutral-500",children:o("将当前分支变基到最新的 {targetBranch}",{targetBranch:s})})]})]}),a.jsxs("button",{onClick:f,disabled:i||v||C||m||e.ahead===0,className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-neutral-200 hover:border-neutral-300 hover:bg-neutral-50 transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx("div",{className:"w-8 h-8 rounded-md bg-emerald-50 flex items-center justify-center shrink-0",children:a.jsx(En,{size:16,className:"text-emerald-600"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm font-medium text-neutral-900",children:o(i?"合并中...":"合并 (Merge)")}),a.jsx("div",{className:"text-xs text-neutral-500",children:o("Squash merge 到 {targetBranch}",{targetBranch:s})})]})]})]})]})}function em({editableMessage:e,setEditableMessage:t,error:s,isPending:l,onConfirm:m,onBack:v,branchName:C,targetBranch:r}){const{t:i}=ce();return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:C}),a.jsx(xn,{size:14,className:"text-neutral-400"}),a.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:r})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-neutral-600 mb-1.5",children:i("提交消息")}),a.jsx("textarea",{value:e,onChange:c=>t(c.target.value),placeholder:i("输入提交消息..."),rows:4,className:"w-full px-3 py-2 rounded-md border border-neutral-200 text-sm font-mono text-neutral-800 placeholder:text-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-300 resize-none"}),!e.trim()&&a.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:i("留空将使用默认消息")})]}),s&&a.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:s}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx("button",{onClick:v,disabled:l,className:"px-4 py-2 rounded-md text-sm text-neutral-600 hover:bg-neutral-100 transition-colors disabled:opacity-50",children:i("返回")}),a.jsx("button",{onClick:m,disabled:l,className:"flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium text-white bg-emerald-600 hover:bg-emerald-700 transition-colors disabled:opacity-50",children:l?a.jsxs(a.Fragment,{children:[a.jsx(ze,{size:14,className:"animate-spin"}),i("合并中...")]}):a.jsxs(a.Fragment,{children:[a.jsx(En,{size:14}),i("确认合并")]})})]})]})}function tm({agentType:e,workingDir:t}){return ht({queryKey:ae.system.slashCommandCatalog(e,t),queryFn:async()=>(await fe.get("/system/slash-command-catalog",{params:{agentType:String(e),...t?{workingDir:t}:{}}})).commands,enabled:!!e,staleTime:3e4})}function sm(e,t){const s=new Set,l=[];for(const m of[...e,...t]){const v=m.command.trim().toLowerCase();!v||s.has(v)||(s.add(v),l.push(m.kind?m:{...m,kind:"builtin"}))}return l}function Zs(e){return e.trim().toLowerCase().replace(/^[/$]/,"")}function rm(e){return Zs(e.command)}function im(e,t){if(!t)return 1e3;const s=rm(e),l=e.aliases?.map(Zs)??[],m=[s,...l];let v=0;for(const r of m)r===t?v=Math.max(v,500):r.startsWith(t)?v=Math.max(v,400-(r.length-t.length)):r.includes(t)&&(v=Math.max(v,250-r.indexOf(t)));return v>0?v:`${s} ${l.join(" ")} ${e.description}`.toLowerCase().includes(t)?100:0}function Yi(e){const t=/(^|[\s])\$([^\s]*)$/.exec(e);if(!t||t.index===void 0)return null;const s=t.index+t[1].length;return{query:Zs(t[2]),replaceStart:s}}function To(e,t){const s=Zs(t);return s?e.map((l,m)=>({command:l,index:m,score:im(l,s)})).filter(l=>l.score>0).sort((l,m)=>m.score-l.score||l.index-m.index||l.command.command.localeCompare(m.command.command)).map(l=>l.command):e.slice()}const nm=[{command:"/permissions",description:"Manage what Codex can do without approval"},{command:"/sandbox-add-read-dir",description:"Grant read access to another directory"},{command:"/agent",description:"Switch between built-in agent personas"},{command:"/apps",description:"Manage connected apps"},{command:"/clear",description:"Start a fresh conversation"},{command:"/compact",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last assistant message to your clipboard"},{command:"/diff",description:"Show the current git diff"},{command:"/experimental",description:"Toggle experimental features"},{command:"/feedback",description:"Share feedback on Codex CLI"},{command:"/init",description:"Create or update AGENTS.md for the repo"},{command:"/logout",description:"Sign out of Codex"},{command:"/mcp",description:"Manage MCP servers"},{command:"/mention",description:"Add files or directories to the conversation context"},{command:"/model",description:"Change the active model"},{command:"/fast",description:"Toggle low reasoning mode"},{command:"/plan",description:"Toggle plan mode for code changes"},{command:"/personality",description:"Select how Codex communicates"},{command:"/ps",description:"List running background tasks"},{command:"/fork",description:"Fork the current conversation state"},{command:"/resume",description:"Resume a previous conversation"},{command:"/new",description:"Open a conversation picker to start or resume"},{command:"/quit",description:"Exit Codex CLI",aliases:["exit"]},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show session and configuration status"},{command:"/debug-config",description:"Inspect the effective configuration"},{command:"/statusline",description:"Configure the custom status line"},{command:"/skills",description:"Browse available skills and insert a $skill mention"}],om=[{command:"/clear",description:"Clear the conversation history"},{command:"/compact",description:"Compact the conversation context",aliases:["compact focus"]},{command:"/config",description:"Open the configuration panel"},{command:"/cost",description:"Show token usage and cost"},{command:"/doctor",description:"Check Claude Code installation health"},{command:"/help",description:"Show help and available commands"},{command:"/init",description:"Initialize project instructions"},{command:"/login",description:"Sign in to Claude Code"},{command:"/logout",description:"Sign out of Claude Code"},{command:"/mcp",description:"Manage MCP servers"},{command:"/memory",description:"Edit project memory files"},{command:"/model",description:"Change the active model"},{command:"/permissions",description:"Review or update tool permissions"},{command:"/pr_comments",description:"Read pull request review comments"},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show account and system status"},{command:"/terminal-setup",description:"Configure terminal newline shortcuts"},{command:"/vim",description:"Toggle vim mode"}],am=[{command:"/bug",description:"File an issue about Gemini CLI"},{command:"/chat",description:"Manage chat checkpoints and exports"},{command:"/clear",description:"Clear the terminal display"},{command:"/compress",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last Gemini CLI output"},{command:"/directory",description:"Manage additional workspace directories",aliases:["dir"]},{command:"/editor",description:"Choose the preferred editor"},{command:"/extensions",description:"List active Gemini CLI extensions"},{command:"/help",description:"Show help and command usage",aliases:["?"]},{command:"/mcp",description:"Show MCP servers and tools"},{command:"/memory",description:"Manage loaded GEMINI.md memory"},{command:"/restore",description:"Restore files from a tool checkpoint"},{command:"/settings",description:"Open the Gemini CLI settings editor"},{command:"/stats",description:"Show session statistics and token usage"},{command:"/theme",description:"Change the Gemini CLI theme"},{command:"/auth",description:"Change the authentication method"},{command:"/about",description:"Show version information"},{command:"/tools",description:"List currently available tools"},{command:"/privacy",description:"Review privacy and data collection settings"},{command:"/quit",description:"Exit Gemini CLI",aliases:["exit"]},{command:"/vim",description:"Toggle vim mode"},{command:"/init",description:"Generate a tailored GEMINI.md file"}],lm=[{command:"/model",description:"Change the active model"},{command:"/plan",description:"Create or reopen a plan"},{command:"/ask",description:"Toggle ask mode (read-only Q&A)"},{command:"/debug",description:"Toggle debug mode"},{command:"/clear",description:"Start a new chat session",aliases:["new","new-chat","newchat"]},{command:"/compress",description:"Summarize the conversation to reduce context"},{command:"/vim",description:"Toggle vim mode"},{command:"/shell",description:"Enter shell mode"},{command:"/about",description:"Show CLI, system, and account information"},{command:"/setup-terminal",description:"Configure terminal newline shortcuts"},{command:"/feedback",description:"Share feedback with the Cursor team"},{command:"/open",description:"Open the repository git root in Cursor"},{command:"/cursor",description:"Alias for /open",aliases:["open"]},{command:"/resume-chat",description:"Resume a previous chat by folder name",aliases:["resume"]},{command:"/copy-request-id",description:"Copy the last request ID"},{command:"/copy-conversation-id",description:"Copy the current conversation ID"},{command:"/logout",description:"Sign out from Cursor"},{command:"/quit",description:"Exit Cursor Agent",aliases:["exit"]},{command:"/mcp",description:"Manage MCP servers"}],cm={[_t.CODEX]:nm,[_t.CLAUDE_CODE]:om,[_t.GEMINI_CLI]:am,[_t.CURSOR_AGENT]:lm};function Lo(e){return e.trim().toLowerCase().replace(/^\//,"")}function hm(e){return e?(cm[e]??[]).map(t=>({...t,kind:t.kind??"builtin"})):[]}function um(e){const t=e.match(/^\s*\/([^\s]*)$/);return t?Lo(t[1]):null}function dm(e,t){return To(e,Lo(t))}function fm(e){const t=e.key==="Enter"&&!e.shiftKey&&!e.repeat&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229,s=e.key==="Tab"&&!e.shiftKey;return t||s}function Mo({agentType:e,workingDir:t,input:s,setInput:l,textareaRef:m,minHeight:v,maxHeight:C}){const[r,i]=k.useState(0),{data:c=[]}=tm({agentType:e,workingDir:t}),f=k.useMemo(()=>sm(hm(e),c),[e,c]),o=k.useMemo(()=>um(s),[s]),p=k.useMemo(()=>o===null?[]:dm(f,o),[f,o]),x=k.useCallback(()=>{const n=m.current;n&&(n.style.height="auto",n.style.height=`${Math.max(v,Math.min(n.scrollHeight,C))}px`)},[C,v,m]);k.useEffect(()=>{i(0)},[e,o]),k.useEffect(()=>{r<p.length||i(0)},[p.length,r]);const S=k.useCallback(n=>{const h=`${s.match(/^(\s*)\/[^\s]*$/)?.[1]??""}${n.command} `;l(h),requestAnimationFrame(()=>{const u=m.current;u&&(x(),u.focus(),u.setSelectionRange(h.length,h.length))})},[s,x,l,m]),g=k.useCallback(n=>o===null||p.length===0?!1:n.key==="ArrowDown"?(n.preventDefault(),i(d=>(d+1)%p.length),!0):n.key==="ArrowUp"?(n.preventDefault(),i(d=>(d-1+p.length)%p.length),!0):fm(n)?(n.preventDefault(),S(p[r]??p[0]),!0):!1,[S,p,o,r]);return{allCommands:f,query:o,filteredCommands:p,selectedIndex:r,setSelectedIndex:i,applyCommand:S,handleKeyDown:g}}function mm({agentType:e,workingDir:t}){return ht({queryKey:ae.system.skillCatalog(e,t),queryFn:async()=>(await fe.get("/system/skill-catalog",{params:{agentType:String(e),...t?{workingDir:t}:{}}})).commands,enabled:e===_t.CODEX,staleTime:3e4})}function pm(e){const t=e.key==="Enter"&&!e.shiftKey&&!e.repeat&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229,s=e.key==="Tab"&&!e.shiftKey;return t||s}function No({agentType:e,workingDir:t,input:s,setInput:l,textareaRef:m,minHeight:v,maxHeight:C}){const[r,i]=k.useState(0),{data:c=[]}=mm({agentType:e,workingDir:t}),o=k.useMemo(()=>e===_t.CODEX?Yi(s):null,[e,s])?.query??null,p=k.useMemo(()=>o===null?[]:To(c,o),[o,c]),x=k.useCallback(()=>{const n=m.current;n&&(n.style.height="auto",n.style.height=`${Math.max(v,Math.min(n.scrollHeight,C))}px`)},[C,v,m]);k.useEffect(()=>{i(0)},[e,o]),k.useEffect(()=>{r<p.length||i(0)},[p.length,r]);const S=k.useCallback(n=>{const d=Yi(s);if(!d)return;const h=`${s.slice(0,d.replaceStart)}${n.command} `;l(h),requestAnimationFrame(()=>{const u=m.current;u&&(x(),u.focus(),u.setSelectionRange(h.length,h.length))})},[s,x,l,m]),g=k.useCallback(n=>o===null||p.length===0?!1:n.key==="ArrowDown"?(n.preventDefault(),i(d=>(d+1)%p.length),!0):n.key==="ArrowUp"?(n.preventDefault(),i(d=>(d-1+p.length)%p.length),!0):pm(n)?(n.preventDefault(),S(p[r]??p[0]),!0):!1,[S,p,o,r]);return{allSkills:c,query:o,filteredSkills:p,selectedIndex:r,setSelectedIndex:i,applySkill:S,handleKeyDown:g}}const vm="/api",gm=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?`${vm}/attachments/by-path?path=${encodeURIComponent(e)}`:e,_m=({src:e,alt:t,...s})=>a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:a.jsx("img",{src:e,alt:t,...s,className:"max-w-[300px] max-h-[200px] object-contain rounded-lg border border-neutral-200 cursor-pointer hover:opacity-90 transition-opacity"})}),bm={img:_m},xm=675,Vi=320,Gi=1200;function Sm(){const{t:e}=ce();return a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-white text-neutral-400 select-none",children:[a.jsx("div",{className:"w-16 h-16 bg-neutral-50 rounded-2xl border border-neutral-100 flex items-center justify-center mb-6",children:a.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-300",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),a.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),a.jsx("h3",{className:"text-neutral-900 font-medium mb-2 text-lg",children:"Agent Tower"}),a.jsx("p",{className:"text-sm max-w-sm text-center text-neutral-500 leading-relaxed",children:e("Select a task from the sidebar to view logs, monitor execution, or interact with an agent.")})]})}const Qi=[{status:le.Review,className:"bg-amber-50 text-amber-700 border-amber-100",hoverClass:"hover:bg-amber-100",icon:a.jsx(Lr,{className:"w-3 h-3"})},{status:le.Running,className:"bg-blue-50 text-blue-700 border-blue-100",hoverClass:"hover:bg-blue-100",icon:a.jsx(Mr,{className:"w-3 h-3"})},{status:le.Pending,className:"bg-neutral-50 text-neutral-600 border-neutral-100",hoverClass:"hover:bg-neutral-100",icon:a.jsx(Nr,{className:"w-3 h-3"})},{status:le.Done,className:"bg-emerald-50 text-emerald-700 border-emerald-100",hoverClass:"hover:bg-emerald-100",icon:a.jsx(Pr,{className:"w-3 h-3"})},{status:le.Cancelled,className:"bg-neutral-50 text-neutral-500 border-neutral-200",hoverClass:"hover:bg-neutral-200",icon:a.jsx(Or,{className:"w-3 h-3"})}];function ym({status:e,onChangeStatus:t}){const{t:s}=ce(),[l,m]=k.useState(!1),v=k.useRef(null);k.useEffect(()=>{if(!l)return;const r=i=>{v.current&&!v.current.contains(i.target)&&m(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[l]);const C=Qi.find(r=>r.status===e);return a.jsxs("div",{className:"relative",ref:v,children:[a.jsxs("button",{onClick:()=>t&&m(r=>!r),className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border transition-colors ${C.className} ${t?"cursor-pointer hover:opacity-80":""}`,children:[C.icon,a.jsx("span",{children:s(e)}),t&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-0.5 transition-transform ${l?"rotate-180":""}`,children:a.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})]}),l&&a.jsx("div",{className:"absolute right-0 top-full mt-2 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1 animate-in fade-in zoom-in-95 duration-100",children:Qi.filter(r=>r.status!==e).map(r=>a.jsxs("button",{onClick:()=>{t?.(r.status),m(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-xs font-medium transition-colors ${r.hoverClass}`,children:[a.jsx("span",{className:r.className.split(" ").find(i=>i.startsWith("text-")),children:r.icon}),a.jsx("span",{className:"text-neutral-700",children:s(r.status)})]},r.status))})]})}function Cm({task:e,onDeleteTask:t,isDeleting:s,onTaskStatusChange:l}){const{t:m}=ce(),[v,C]=k.useState(""),[r,i]=k.useState(!1),[c,f]=k.useState(!1),[o,p]=k.useState(!1),[x,S]=k.useState(!1),[g,n]=k.useState(!1),[d,h]=k.useState(!1),[u,_]=k.useState(!1),[y,w]=k.useState(!1),E=k.useRef(null),b=k.useRef(null),R=k.useRef(null),j=k.useRef(null),{scrollRef:M,contentRef:L,isAtBottom:T,scrollToBottom:B}=qn({resize:"smooth",initial:"instant"}),[I,H]=k.useState(xm),[W,A]=k.useState(!0),[N,P]=k.useState(!1),O=k.useRef(0),$=k.useRef(0),X=k.useRef(null),{data:K,isLoading:Q}=wo(e?.id??""),se=Pf(e?.id);k.useEffect(()=>{w(!1)},[e?.id]),k.useEffect(()=>{if(!y||!K)return;K.some(ne=>ne.status==="ACTIVE"&&ne.sessions&&ne.sessions.length>0)&&w(!1)},[K,y]);const D=k.useMemo(()=>{if(y||!K)return null;const G=$e=>{const tr=$e.createdAt,Yt=$e.endedAt??$e.startedAt??tr;if(!Yt)return 0;const zt=Date.parse(Yt);return Number.isNaN(zt)?0:zt},ne=($e,tr)=>{const Yt=$e.filter(zt=>tr.includes(zt.status));return Yt.length===0?null:Yt.sort((zt,sa)=>G(sa)-G(zt))[0]??null},Ee=K.filter($e=>$e.status==="ACTIVE"&&Array.isArray($e.sessions)).flatMap($e=>$e.sessions??[]),rt=ne(Ee,[Le.RUNNING])??ne(Ee,[Le.PENDING])??ne(Ee,[Le.COMPLETED,Le.FAILED,Le.CANCELLED]);if(rt)return rt;const vt=K.filter($e=>($e.status==="MERGED"||$e.status==="ABANDONED")&&Array.isArray($e.sessions)).flatMap($e=>$e.sessions??[]);return ne(vt,[Le.COMPLETED,Le.FAILED,Le.CANCELLED])},[K,y]),F=D?.id??"",q=D?.status===Le.RUNNING||D?.status===Le.PENDING,z=!!e?.projectArchivedAt,te=!!e?.projectRepoDeletedAt,Y=m(te?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。"),{data:ie}=Hs(),[ge,me]=k.useState(null);k.useEffect(()=>{me(D?.providerId??null)},[D?.providerId]);const Me=k.useMemo(()=>!D||!K?!1:!K.some(ne=>ne.status==="ACTIVE"&&ne.sessions?.some(Ee=>Ee.id===D.id)),[D,K]),re=k.useMemo(()=>{if(!(!K||y)){for(const G of K)if(G.status==="ACTIVE"&&G.worktreePath)return G.worktreePath;return K[0]?.worktreePath}},[K,y]),Be=Mo({agentType:D?.agentType,workingDir:re,input:v,setInput:C,textareaRef:R,minHeight:60,maxHeight:300}),Ce=No({agentType:D?.agentType,workingDir:re,input:v,setInput:C,textareaRef:R,minHeight:60,maxHeight:300}),oe=k.useMemo(()=>K?K.find(ne=>ne.status==="ACTIVE")?.id:void 0,[K]),{data:Ne}=ko(oe??""),qe=k.useMemo(()=>K?K.find(ne=>ne.status==="ACTIVE")?.sessions??[]:[],[K]),Re=k.useMemo(()=>K?K.find(ne=>ne.status==="ACTIVE")?.branchName??"":"",[K]),Ve=k.useMemo(()=>K?K.find(ne=>ne.status==="ACTIVE")?.commitMessage:void 0,[K]),be=We(),st=k.useCallback(()=>e?.id?be.invalidateQueries({queryKey:ae.workspaces.list(e.id)}):Promise.resolve(),[e?.id,be]);k.useEffect(()=>{if(!u)return;const G=ne=>{b.current&&!b.current.contains(ne.target)&&_(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[u]);const Ke=Zr(),Pe=Gr(),Oe=Hf(),De=Eo(e?.id??""),V=Qr(),Z=k.useCallback(async()=>{if(!e?.id)return;const G=D?.providerId??ie?.find(Ee=>Ee.availability.type!=="NOT_FOUND")?.provider.id;if(!G)return;const ne=[e.title,e.description].filter(Boolean).join(`
|
|
76
76
|
|
|
77
|
-
`);p(!1),S(!0);try{await Oe.mutateAsync(e.id),w(!0);const Ee=await De.mutateAsync({}),rt=await fe.post(`/workspaces/${Ee.id}/sessions`,{providerId:G,prompt:ne});await V.mutateAsync(rt.id),await be.invalidateQueries({queryKey:ae.workspaces.list(e.id)})}catch(Ee){console.error("[retry] failed:",Ee),w(!1)}finally{S(!1)}},[e?.id,e?.title,e?.description,D?.providerId,ie,Oe,De,V,be]),xe=k.useCallback(()=>{oe&&Pe.mutate({workspaceId:oe})},[oe,Pe]),Se=k.useCallback(()=>{!e?.id||!t||(t(e.id),f(!1))},[e?.id,t]),{isConnected:He,isLoadingSnapshot:Xe,logs:pe,entries:et,attach:Ge}=hn({sessionId:F,onExit:k.useCallback(()=>{be.invalidateQueries({queryKey:["workspaces"]})},[be])});k.useEffect(()=>{if(!e?.id)return;const G=wt.connect();G.emit(Pt.SUBSCRIBE,{topic:"task",id:e.id});const ne=rt=>{rt.taskId===e.id&&be.invalidateQueries({queryKey:["tasks"]})},Ee=rt=>{rt.taskId===e.id&&be.invalidateQueries({queryKey:ae.workspaces.list(e.id)})};return G.on(Qe.TASK_UPDATED,ne),G.on(Qe.WORKSPACE_COMMIT_MESSAGE_UPDATED,Ee),()=>{G.off(Qe.TASK_UPDATED,ne),G.off(Qe.WORKSPACE_COMMIT_MESSAGE_UPDATED,Ee),G.emit(Pt.UNSUBSCRIBE,{topic:"task",id:e.id})}},[e?.id,be]),k.useEffect(()=>{if(!F)return;const G=wt.connect(),ne=Ee=>{Ee.sessionId===F&&be.invalidateQueries({queryKey:["workspaces"]})};return G.on(Qe.SESSION_COMPLETED,ne),()=>{G.off(Qe.SESSION_COMPLETED,ne)}},[F,be]);const{todos:nt}=un(et),{files:Ht,addFiles:je,removeFile:
|
|
77
|
+
`);p(!1),S(!0);try{await Oe.mutateAsync(e.id),w(!0);const Ee=await De.mutateAsync({}),rt=await fe.post(`/workspaces/${Ee.id}/sessions`,{providerId:G,prompt:ne});await V.mutateAsync(rt.id),await be.invalidateQueries({queryKey:ae.workspaces.list(e.id)})}catch(Ee){console.error("[retry] failed:",Ee),w(!1)}finally{S(!1)}},[e?.id,e?.title,e?.description,D?.providerId,ie,Oe,De,V,be]),xe=k.useCallback(()=>{oe&&Pe.mutate({workspaceId:oe})},[oe,Pe]),Se=k.useCallback(()=>{!e?.id||!t||(t(e.id),f(!1))},[e?.id,t]),{isConnected:He,isLoadingSnapshot:Xe,logs:pe,entries:et,attach:Ge}=hn({sessionId:F,onExit:k.useCallback(()=>{be.invalidateQueries({queryKey:["workspaces"]})},[be])});k.useEffect(()=>{if(!e?.id)return;const G=wt.connect();G.emit(Pt.SUBSCRIBE,{topic:"task",id:e.id});const ne=rt=>{rt.taskId===e.id&&be.invalidateQueries({queryKey:["tasks"]})},Ee=rt=>{rt.taskId===e.id&&be.invalidateQueries({queryKey:ae.workspaces.list(e.id)})};return G.on(Qe.TASK_UPDATED,ne),G.on(Qe.WORKSPACE_COMMIT_MESSAGE_UPDATED,Ee),()=>{G.off(Qe.TASK_UPDATED,ne),G.off(Qe.WORKSPACE_COMMIT_MESSAGE_UPDATED,Ee),G.emit(Pt.UNSUBSCRIBE,{topic:"task",id:e.id})}},[e?.id,be]),k.useEffect(()=>{if(!F)return;const G=wt.connect(),ne=Ee=>{Ee.sessionId===F&&be.invalidateQueries({queryKey:["workspaces"]})};return G.on(Qe.SESSION_COMPLETED,ne),()=>{G.off(Qe.SESSION_COMPLETED,ne)}},[F,be]);const{todos:nt}=un(et),{files:Ht,addFiles:je,removeFile:U,clear:J,buildMarkdownLinks:he,hasFiles:ue,isUploading:ve}=Jr(),Ae=k.useMemo(()=>{if(!D?.tokenUsage)return;const G=D.tokenUsage;if(typeof G.totalTokens=="number")return G},[D?.tokenUsage]),mt=Do(pe,Ae);k.useEffect(()=>{F&&He&&Ge()},[F,He,Ge]);const Fe=k.useRef(e?.id);k.useEffect(()=>{Fe.current!==e?.id&&B(),Fe.current=e?.id},[e?.id,B]);const ot=Ro(),tt=k.useRef(!1),at=k.useCallback(async()=>{if(!v.trim()&&!ue||!F||tt.current||ve)return;tt.current=!0;const G=he(),ne=[v.trim(),G].filter(Boolean).join(`
|
|
78
78
|
|
|
79
|
-
`);C(""),J(),R.current&&(R.current.style.height="60px"),Ke.mutate({id:F,message:ne,providerId:ge??void 0},{onSuccess:()=>{Ge()},onSettled:()=>{tt.current=!1}})},[v,F,Ke,Ge,ue,ve,he,J,ge]),jt=k.useCallback(async()=>{F&&(await ot.mutateAsync(F),be.invalidateQueries({queryKey:["workspaces"]}))},[F,ot,be]),Tt=k.useCallback(G=>{const ne=G.target.files;ne&&ne.length>0&&je(Array.from(ne)),G.target.value=""},[je]),pt=k.useCallback(G=>{const ne=G.clipboardData.items,Ee=[];for(const rt of ne)if(rt.kind==="file"){const vt=rt.getAsFile();vt&&Ee.push(vt)}Ee.length>0&&(G.preventDefault(),je(Ee))},[je]),[St,Lt]=k.useState(!1),Go=k.useCallback(G=>{G.preventDefault(),Lt(!0)},[]),Qo=k.useCallback(G=>{G.preventDefault(),Lt(!1)},[]),Zo=k.useCallback(G=>{G.preventDefault(),Lt(!1);const ne=G.dataTransfer.files;ne.length>0&&je(Array.from(ne))},[je]),Js=k.useCallback(G=>{const ne=G.clientX-O.current,Ee=Math.max(Vi,Math.min($.current+ne,Gi));X.current&&(X.current.style.width=`${Ee}px`)},[]),er=k.useCallback(()=>{if(P(!1),X.current){const G=X.current.getBoundingClientRect().width;H(Math.max(Vi,Math.min(Math.round(G),Gi)))}document.body.style.cursor="",document.body.style.userSelect=""},[]);k.useEffect(()=>{if(N)return document.addEventListener("mousemove",Js),document.addEventListener("mouseup",er),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Js),document.removeEventListener("mouseup",er),document.body.style.cursor="",document.body.style.userSelect=""}},[N,Js,er]);const Jo=k.useCallback(G=>{G.preventDefault(),O.current=G.clientX,$.current=I,P(!0)},[I]),ea=k.useCallback(()=>{A(G=>!G)},[]),ta=k.useCallback(G=>{C(G.target.value);const ne=G.target;ne.style.height="auto";const Ee=ne.scrollHeight;ne.style.height=`${Math.max(60,Math.min(Ee,300))}px`},[]),ei=k.useMemo(()=>{const G=[];if(K&&K.length>0){const ne=K.some(vt=>vt.status==="ACTIVE"),Ee=K.some(vt=>vt.sessions?.some($e=>$e.status===Le.RUNNING||$e.status===Le.PENDING)),rt=K.some(vt=>vt.status==="ACTIVE");Ee&&G.push(m("正在运行的 Agent 将被停止")),rt&&G.push(m("分支上未合并的变更将丢失")),ne&&G.push(m("关联的工作目录(worktree)将被清理"))}return G},[K,m]);return e?a.jsxs("div",{className:"flex-1 flex flex-col h-full bg-white relative overflow-hidden",children:[a.jsxs("div",{className:"px-6 py-4 flex items-center justify-between border-b border-neutral-100 bg-white/80 backdrop-blur-sm z-20 flex-shrink-0",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:`text-xs font-semibold uppercase tracking-wider ${e.projectColor}`,children:e.projectName}),e.projectArchivedAt&&a.jsx("span",{className:"rounded-full bg-neutral-100 px-2 py-0.5 text-[10px] font-medium text-neutral-500",children:e.projectRepoDeletedAt?m("源码已删除"):m("已删除")}),a.jsx("span",{className:"text-neutral-300 text-xs",children:"/"}),a.jsx("span",{className:"text-xs text-neutral-500 font-mono",children:e.branch})]}),a.jsx("h2",{className:"text-lg font-bold text-neutral-900",children:e.title})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ym,{status:e.status,onChangeStatus:!z&&l?G=>l(e.id,G):void 0}),oe&&!z&&a.jsx("button",{onClick:()=>h(!0),className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors",title:m("Git 操作"),children:a.jsx(Ya,{size:18})}),a.jsx("button",{onClick:xe,disabled:!oe||z,className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",title:m("Open in IDE"),children:a.jsx(zs,{size:18})}),a.jsx("button",{onClick:ea,className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors",title:m("Toggle Workspace"),children:W?a.jsx(cl,{size:18}):a.jsx(ul,{size:18})}),t&&!z&&a.jsxs("div",{className:"relative",ref:b,children:[a.jsx("button",{onClick:()=>_(G=>!G),className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors",title:m("More actions"),children:a.jsx(yn,{size:18})}),u&&a.jsxs("div",{className:"absolute right-0 top-full mt-2 w-44 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:[a.jsxs("button",{onClick:()=>{p(!0),_(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-neutral-700 hover:bg-neutral-50 transition-colors",children:[a.jsx(wa,{size:15}),a.jsx("span",{children:m("重新开始")})]}),a.jsxs("button",{onClick:()=>{f(!0),_(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 transition-colors",children:[a.jsx(vn,{size:15}),a.jsx("span",{children:m("删除任务")})]})]})]})]})]}),oe&&Ne&&a.jsx(Yf,{workspaceId:oe,gitStatus:Ne,onResolve:()=>n(!0)}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[a.jsxs("div",{ref:X,className:`flex flex-col bg-white relative ${W?"flex-shrink-0":"flex-1"}`,style:{width:W?I:"100%"},children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:M,className:"h-full overflow-y-auto px-6 pt-6 pb-4",children:a.jsxs("div",{ref:L,className:"w-full",children:[a.jsx("div",{className:"mb-4 pb-4 border-b border-neutral-100",children:e.description?a.jsx("div",{className:"text-sm text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:a.jsx(dn,{urlTransform:gm,components:bm,children:e.description})}):a.jsx("p",{className:"text-sm text-neutral-400 italic",children:m("No description")})}),se&&a.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-neutral-400 text-sm",children:[se.status==="running"&&a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"animate-spin h-3.5 w-3.5 shrink-0",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{children:m("Setup ({current}/{total}): {command}",{current:se.currentIndex,total:se.totalCommands,command:se.currentCommand})})]}),se.status==="completed"&&a.jsx("span",{className:"text-emerald-600",children:m("Setup 完成")}),se.status==="failed"&&a.jsx("span",{className:"text-red-500",children:m("Setup 失败: {error}",{error:se.error})})]}),Q?a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:m("Loading...")})]}):F?Xe?a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:m("Loading logs...")})]}):pe.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8",children:m(U?"Waiting for agent output...":"No logs recorded for this session.")}):a.jsx(fn,{logs:pe}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"w-14 h-14 bg-neutral-50 rounded-2xl border border-neutral-100 flex items-center justify-center mb-5",children:a.jsx(Ot,{size:24,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-base font-medium text-neutral-900 mb-1.5",children:m(z?"项目为只读历史":"尚未启动 Agent")}),a.jsx("p",{className:"text-sm text-neutral-500 mb-6 max-w-xs",children:z?Y:m("选择一个 Agent 来执行此任务,Agent 将自动创建工作空间并开始工作。")}),!z&&a.jsxs(dt,{onClick:()=>i(!0),children:[a.jsx(Ot,{size:16,className:"mr-1.5"}),m("启动 Agent")]})]})]})}),!T&&a.jsxs("button",{onClick:()=>B(),className:"absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 px-3 py-1.5 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-xs text-neutral-600 hover:bg-white hover:text-neutral-900 transition-all","aria-label":m("Scroll to bottom"),children:[a.jsx(bn,{size:14}),a.jsx("span",{children:m("回到底部")})]})]}),nt.length>0&&a.jsx("div",{className:"px-6 pt-2 pb-1 bg-white flex-shrink-0 border-t border-neutral-100",children:a.jsx(mn,{todos:nt})}),z?a.jsx("div",{className:"p-6 pt-3 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-neutral-100",children:a.jsx("div",{className:"bg-neutral-50 rounded-xl border border-neutral-200 px-4 py-3 text-sm text-neutral-500",children:Y})}):Me?a.jsx("div",{className:"p-6 pt-3 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-neutral-100",children:a.jsxs("div",{className:"flex items-center justify-between bg-neutral-50 rounded-xl border border-neutral-200 px-4 py-3",children:[a.jsx("span",{className:"text-sm text-neutral-500",children:m("代码已合并,以上为历史沟通记录")}),a.jsxs(dt,{size:"sm",onClick:()=>i(!0),children:[a.jsx(Ot,{size:14,className:"mr-1.5"}),m("启动新 Agent")]})]})}):a.jsxs("div",{className:"p-6 pt-2 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-transparent",onDragOver:Go,onDragLeave:Qo,onDrop:Zo,children:[a.jsxs("div",{ref:E,className:`relative bg-white rounded-xl border shadow-sm hover:shadow-md focus-within:shadow-md focus-within:border-neutral-300 transition-all duration-200 ${St?"border-blue-400 bg-blue-50/50 shadow-md":"border-neutral-200"}`,children:[a.jsx(Ns,{files:Ht,onRemove:q}),a.jsx("textarea",{ref:R,value:v,onChange:ta,onPaste:pt,onKeyDown:G=>{Ce.handleKeyDown(G)||Be.handleKeyDown(G)||G.key==="Enter"&&!G.shiftKey&&!G.repeat&&!G.nativeEvent.isComposing&&G.nativeEvent.keyCode!==229&&(G.preventDefault(),at())},rows:1,placeholder:m(St?"Drop files here...":F&&!U?"Continue conversation...":"Message Agent..."),className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-sm text-neutral-900 placeholder-neutral-400 leading-relaxed",style:{minHeight:"60px",maxHeight:"300px"}}),a.jsx("input",{ref:j,type:"file",multiple:!0,className:"hidden",onChange:Tt}),a.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("button",{onClick:()=>j.current?.click(),className:"p-2 text-neutral-400 hover:text-neutral-600 hover:bg-neutral-100 rounded-lg transition-colors",title:m("Upload file"),children:a.jsx(ws,{size:18})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[D&&ie&&a.jsx(jo,{providers:ie,currentProviderId:ge,agentType:D.agentType,onSelect:me}),a.jsx(Kn,{usage:mt}),U&&!v.trim()&&!ue?a.jsx("button",{onClick:jt,disabled:ot.isPending,className:"p-2 rounded-lg transition-all duration-200 bg-red-500 text-white hover:bg-red-600 shadow-md disabled:opacity-50",children:a.jsx(pn,{size:14})}):a.jsx("button",{onClick:at,disabled:!v.trim()&&!ue||ve,className:`p-2 rounded-lg transition-all duration-200 ${(v.trim()||ue)&&!ve?"bg-neutral-900 text-white shadow-md hover:bg-black":"bg-transparent text-neutral-300 cursor-not-allowed"}`,children:a.jsx(Sn,{size:18})})]})]})]}),a.jsx(Ps,{open:Be.query!==null,anchorRef:E,commands:Be.filteredCommands,selectedIndex:Be.selectedIndex,query:Be.query??"",hasCatalog:Be.allCommands.length>0,onSelect:Be.applyCommand}),a.jsx(Ps,{open:Ce.query!==null,anchorRef:E,commands:Ce.filteredSkills,selectedIndex:Ce.selectedIndex,query:Ce.query??"",hasCatalog:Ce.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",onSelect:Ce.applySkill})]})]}),W&&a.jsx("div",{className:"w-1 cursor-col-resize hover:bg-neutral-200 active:bg-blue-400 transition-colors z-30 flex-shrink-0 border-l border-neutral-200",onMouseDown:Jo}),W&&a.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-white",children:a.jsx(Co,{sessionId:F||void 0,workingDir:re,projectId:e.projectId,readOnly:z,repoDeleted:te})})]}),!z&&a.jsx(Ao,{isOpen:r,onClose:()=>i(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),oe&&!z&&a.jsx(Zf,{open:d,onOpenChange:h,workspaceId:oe,branchName:Re,targetBranch:e.mainBranch,commitMessage:Ve,onRefreshCommitMessage:st,onConflict:()=>n(!0)}),oe&&Ne&&Ne.conflictOp&&a.jsx(Gf,{open:g,onOpenChange:n,workspaceId:oe,conflictOp:Ne.conflictOp,conflictedFiles:Ne.conflictedFiles,sourceBranch:Re,targetBranch:e.mainBranch,sessions:qe}),a.jsx(xr,{isOpen:o,onClose:()=>p(!1),onConfirm:Z,title:m("重新开始任务"),description:a.jsx("p",{children:m("将归档当前工作区并自动在新 Worktree 中重新启动 Agent,旧工作区内容保留供参考。")}),confirmText:m("确认重试"),variant:"default",isLoading:x}),a.jsx(xr,{isOpen:c,onClose:()=>f(!1),onConfirm:Se,title:m("删除任务"),description:a.jsxs(a.Fragment,{children:[a.jsx("p",{children:m("确认删除任务「{title}」?此操作不可撤销。",{title:e.title})}),ei.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:ei.map((G,ne)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[a.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),a.jsx("span",{children:G})]},ne))})]}),confirmText:m("删除"),variant:"danger",isLoading:s})]}):a.jsx(Sm,{})}function Jr(e){switch(e){case gt.TODO:return le.Pending;case gt.IN_PROGRESS:return le.Running;case gt.IN_REVIEW:return le.Review;case gt.DONE:return le.Done;case gt.CANCELLED:return le.Cancelled}}function wm(e){switch(e){case le.Pending:return gt.TODO;case le.Running:return gt.IN_PROGRESS;case le.Review:return gt.IN_REVIEW;case le.Done:return gt.DONE;case le.Cancelled:return gt.CANCELLED}}function Em(e){switch(e){case _t.CLAUDE_CODE:return"Claude Code";case _t.GEMINI_CLI:return"Gemini CLI";case _t.CURSOR_AGENT:return"Cursor Agent";case _t.CODEX:return"Codex"}}const Os=["text-indigo-600","text-emerald-600","text-rose-600","text-amber-600","text-cyan-600","text-violet-600","text-teal-600","text-pink-600"];function Po(e,t){let s=0;for(let l=0;l<e.length;l++)s=(s<<5)-s+e.charCodeAt(l)|0;return Math.abs(s)%t}function Oo(e,t){return t??e?.find(s=>s.status==="ACTIVE")??e?.[0]}function km(e){return{id:e.id,name:e.name,color:e.color||Os[Po(e.name,Os.length)],archivedAt:e.archivedAt??null,repoDeletedAt:e.repoDeletedAt??null}}function Rm(e){const t=Oo(e);if(!t)return{agent:"—",branch:"—"};const s=t.branchName,l=t.sessions;if(l&&l.length>0){const m=l[l.length-1];return{agent:Em(m.agentType),branch:s}}return{agent:"—",branch:s}}function Dm(e){const{agent:t,branch:s}=Rm(e.workspaces),l=e.project;return{id:e.id,projectId:e.projectId,title:e.title,status:Jr(e.status),agent:t,branch:s,description:e.description??"",projectArchivedAt:l?.archivedAt??null,projectRepoDeletedAt:l?.repoDeletedAt??null}}function Am(e,t,s){const l=Oo(e.workspaces,s),m=l?.branchName??"—";return{id:e.id,projectId:t.id,projectName:t.name,projectColor:t.color||Os[Po(t.name,Os.length)],title:e.title,status:Jr(e.status),branch:m,mainBranch:l?.baseBranch??t.mainBranch??"main",description:e.description??"",projectArchivedAt:t.archivedAt??null,projectRepoDeletedAt:t.repoDeletedAt??null}}const Bo=768;function jm(e){const t=window.matchMedia(`(max-width: ${Bo-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function Tm(){return window.innerWidth<Bo}function Lm(){return!1}function Mm(){return k.useSyncExternalStore(jm,Tm,Lm)}const Zi={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function Nm(e){const t=e.split("/");return t[t.length-1]||e}function Pm(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function Om({workingDir:e,filePath:t,type:s}){const{t:l}=ce(),{data:m,isLoading:v,isError:C}=xo(e,t,s);if(v)return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[a.jsx(ze,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:l("Loading diff...")})]});if(C)return a.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:l("Failed to load diff.")});const r=m?.diff||"";if(!r.trim())return a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:l("No diff content available.")});const i=r.split(`
|
|
80
|
-
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:i.map((c,f)=>{let o="",p="text-neutral-400";return c.startsWith("+")&&!c.startsWith("+++")?(o="bg-emerald-950/40",p="text-emerald-400"):c.startsWith("-")&&!c.startsWith("---")?(o="bg-red-950/40",p="text-red-400"):c.startsWith("@@")&&(o="bg-blue-950/30",p="text-blue-400"),a.jsx("div",{className:ye("px-3 whitespace-pre",o,p),children:c},f)})})}function Bm({entry:e,type:t,workingDir:s}){const[l,m]=k.useState(!1),v=Zi[e.status]||Zi.M,C=Pm(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:ye("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("span",{className:ye("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",v),children:e.status}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Nm(e.path)}),C&&a.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),a.jsx("span",{className:"text-neutral-400 shrink-0",children:l?a.jsx(xt,{size:14}):a.jsx(Ft,{size:14})})]}),l&&a.jsx(Om,{workingDir:s,filePath:e.path,type:t})]})}function Ji({title:e,entries:t,type:s,workingDir:l,defaultOpen:m}){const{t:v}=ce(),[C,r]=k.useState(m);return t.length===0?null:a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>r(i=>!i),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-neutral-50",children:[a.jsx("span",{className:"text-neutral-400",children:C?a.jsx(xt,{size:14}):a.jsx(Ft,{size:14})}),a.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:v(e)}),a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:t.length})]}),C&&a.jsx("div",{className:"divide-y divide-neutral-100",children:t.map(i=>a.jsx(Bm,{entry:i,type:s,workingDir:l},`${s}:${i.path}`))})]})}function Im({workingDir:e}){const{t}=ce(),{data:s,isLoading:l,isError:m}=bo(e);if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:t("No workspace selected.")});if(l)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:t("Loading changes...")})]});if(m)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:t("Failed to load changes.")});const v=s?.uncommitted||[],C=s?.committed||[];return v.length+C.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[a.jsx(is,{size:28,className:"mb-3"}),a.jsx("span",{className:"text-sm",children:t("No pending changes")})]}):a.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[a.jsx(Ji,{title:"Uncommitted",entries:v,type:"uncommitted",workingDir:e,defaultOpen:!0}),a.jsx(Ji,{title:"Committed",entries:C,type:"committed",workingDir:e,defaultOpen:!1})]})}const
|
|
81
|
-
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:i.map((c,f)=>{let o="",p="text-neutral-400";return c.startsWith("+")&&!c.startsWith("+++")?(o="bg-emerald-950/40",p="text-emerald-400"):c.startsWith("-")&&!c.startsWith("---")?(o="bg-red-950/40",p="text-red-400"):c.startsWith("@@")&&(o="bg-blue-950/30",p="text-blue-400"),a.jsx("div",{className:ye("px-3 whitespace-pre",o,p),children:c},f)})})}function $m({entry:e,workingDir:t,hash:s}){const[l,m]=k.useState(!1),v=en[e.status]||en.M,C=zm(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:ye("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("span",{className:ye("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",v),children:e.status}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Hm(e.path)}),C&&a.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),a.jsx("span",{className:"text-neutral-400 shrink-0",children:l?a.jsx(xt,{size:14}):a.jsx(Ft,{size:14})})]}),l&&a.jsx(Wm,{workingDir:t,hash:s,filePath:e.path})]})}function Um({commit:e,workingDir:t}){const{t:s}=ce(),[l,m]=k.useState(!1),{data:v,isLoading:C}=So(t,l?e.hash:null),r=v?.files||[];return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(i=>!i),className:ye("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:a.jsx("div",{className:ye("w-2.5 h-2.5 rounded-full shrink-0",l?"bg-blue-500":"bg-neutral-300")})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs font-mono text-blue-600 shrink-0",children:e.shortHash}),a.jsx("span",{className:"text-sm text-neutral-900 truncate flex-1",children:e.message})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-[11px] text-neutral-500 truncate",children:e.author}),a.jsx("span",{className:"text-[11px] text-neutral-400",children:Fm(e.timestamp)})]})]}),a.jsx("span",{className:"text-neutral-400 shrink-0 pt-0.5",children:l?a.jsx(xt,{size:14}):a.jsx(Ft,{size:14})})]}),l&&a.jsxs("div",{className:"pl-4 border-l-2 border-blue-100 ml-[22px]",children:[e.body&&a.jsx("div",{className:"px-3 py-2 text-xs text-neutral-600 whitespace-pre-wrap leading-4",children:e.body}),C?a.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-neutral-400",children:[a.jsx(ze,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:s("Loading files...")})]}):r.length===0?a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:s("No files changed")}):a.jsx("div",{className:"divide-y divide-neutral-100",children:r.map(i=>a.jsx($m,{entry:i,workingDir:t,hash:e.hash},i.path))})]})]})}function qm({workingDir:e}){const{t}=ce(),{data:s,isLoading:l,isError:m,fetchNextPage:v,hasNextPage:C,isFetchingNextPage:r}=_n({queryKey:ae.git.log(e||""),queryFn:({pageParam:c=0})=>fe.get("/git/log",{params:{workingDir:e||"",limit:String(
|
|
79
|
+
`);C(""),J(),R.current&&(R.current.style.height="60px"),Ke.mutate({id:F,message:ne,providerId:ge??void 0},{onSuccess:()=>{Ge()},onSettled:()=>{tt.current=!1}})},[v,F,Ke,Ge,ue,ve,he,J,ge]),jt=k.useCallback(async()=>{F&&(await ot.mutateAsync(F),be.invalidateQueries({queryKey:["workspaces"]}))},[F,ot,be]),Tt=k.useCallback(G=>{const ne=G.target.files;ne&&ne.length>0&&je(Array.from(ne)),G.target.value=""},[je]),pt=k.useCallback(G=>{const ne=G.clipboardData.items,Ee=[];for(const rt of ne)if(rt.kind==="file"){const vt=rt.getAsFile();vt&&Ee.push(vt)}Ee.length>0&&(G.preventDefault(),je(Ee))},[je]),[St,Lt]=k.useState(!1),Go=k.useCallback(G=>{G.preventDefault(),Lt(!0)},[]),Qo=k.useCallback(G=>{G.preventDefault(),Lt(!1)},[]),Zo=k.useCallback(G=>{G.preventDefault(),Lt(!1);const ne=G.dataTransfer.files;ne.length>0&&je(Array.from(ne))},[je]),Js=k.useCallback(G=>{const ne=G.clientX-O.current,Ee=Math.max(Vi,Math.min($.current+ne,Gi));X.current&&(X.current.style.width=`${Ee}px`)},[]),er=k.useCallback(()=>{if(P(!1),X.current){const G=X.current.getBoundingClientRect().width;H(Math.max(Vi,Math.min(Math.round(G),Gi)))}document.body.style.cursor="",document.body.style.userSelect=""},[]);k.useEffect(()=>{if(N)return document.addEventListener("mousemove",Js),document.addEventListener("mouseup",er),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Js),document.removeEventListener("mouseup",er),document.body.style.cursor="",document.body.style.userSelect=""}},[N,Js,er]);const Jo=k.useCallback(G=>{G.preventDefault(),O.current=G.clientX,$.current=I,P(!0)},[I]),ea=k.useCallback(()=>{A(G=>!G)},[]),ta=k.useCallback(G=>{C(G.target.value);const ne=G.target;ne.style.height="auto";const Ee=ne.scrollHeight;ne.style.height=`${Math.max(60,Math.min(Ee,300))}px`},[]),ti=k.useMemo(()=>{const G=[];if(K&&K.length>0){const ne=K.some(vt=>vt.status==="ACTIVE"),Ee=K.some(vt=>vt.sessions?.some($e=>$e.status===Le.RUNNING||$e.status===Le.PENDING)),rt=K.some(vt=>vt.status==="ACTIVE");Ee&&G.push(m("正在运行的 Agent 将被停止")),rt&&G.push(m("分支上未合并的变更将丢失")),ne&&G.push(m("关联的工作目录(worktree)将被清理"))}return G},[K,m]);return e?a.jsxs("div",{className:"flex-1 flex flex-col h-full bg-white relative overflow-hidden",children:[a.jsxs("div",{className:"px-6 py-4 flex items-center justify-between border-b border-neutral-100 bg-white/80 backdrop-blur-sm z-20 flex-shrink-0",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:`text-xs font-semibold uppercase tracking-wider ${e.projectColor}`,children:e.projectName}),e.projectArchivedAt&&a.jsx("span",{className:"rounded-full bg-neutral-100 px-2 py-0.5 text-[10px] font-medium text-neutral-500",children:e.projectRepoDeletedAt?m("源码已删除"):m("已删除")}),a.jsx("span",{className:"text-neutral-300 text-xs",children:"/"}),a.jsx("span",{className:"text-xs text-neutral-500 font-mono",children:e.branch})]}),a.jsx("h2",{className:"text-lg font-bold text-neutral-900",children:e.title})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ym,{status:e.status,onChangeStatus:!z&&l?G=>l(e.id,G):void 0}),oe&&!z&&a.jsx("button",{onClick:()=>h(!0),className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors",title:m("Git 操作"),children:a.jsx(Ya,{size:18})}),a.jsx("button",{onClick:xe,disabled:!oe||z,className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",title:m("Open in IDE"),children:a.jsx(zs,{size:18})}),a.jsx("button",{onClick:ea,className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors",title:m("Toggle Workspace"),children:W?a.jsx(cl,{size:18}):a.jsx(ul,{size:18})}),t&&!z&&a.jsxs("div",{className:"relative",ref:b,children:[a.jsx("button",{onClick:()=>_(G=>!G),className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors",title:m("More actions"),children:a.jsx(yn,{size:18})}),u&&a.jsxs("div",{className:"absolute right-0 top-full mt-2 w-44 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:[a.jsxs("button",{onClick:()=>{p(!0),_(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-neutral-700 hover:bg-neutral-50 transition-colors",children:[a.jsx(wa,{size:15}),a.jsx("span",{children:m("重新开始")})]}),a.jsxs("button",{onClick:()=>{f(!0),_(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 transition-colors",children:[a.jsx(vn,{size:15}),a.jsx("span",{children:m("删除任务")})]})]})]})]})]}),oe&&Ne&&a.jsx(Yf,{workspaceId:oe,gitStatus:Ne,onResolve:()=>n(!0)}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[a.jsxs("div",{ref:X,className:`flex flex-col bg-white relative ${W?"flex-shrink-0":"flex-1"}`,style:{width:W?I:"100%"},children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:M,className:"h-full overflow-y-auto px-6 pt-6 pb-4",children:a.jsxs("div",{ref:L,className:"w-full",children:[a.jsx("div",{className:"mb-4 pb-4 border-b border-neutral-100",children:e.description?a.jsx("div",{className:"text-sm text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:a.jsx(dn,{urlTransform:gm,components:bm,children:e.description})}):a.jsx("p",{className:"text-sm text-neutral-400 italic",children:m("No description")})}),se&&a.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-neutral-400 text-sm",children:[se.status==="running"&&a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"animate-spin h-3.5 w-3.5 shrink-0",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{children:m("Setup ({current}/{total}): {command}",{current:se.currentIndex,total:se.totalCommands,command:se.currentCommand})})]}),se.status==="completed"&&a.jsx("span",{className:"text-emerald-600",children:m("Setup 完成")}),se.status==="failed"&&a.jsx("span",{className:"text-red-500",children:m("Setup 失败: {error}",{error:se.error})})]}),Q?a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:m("Loading...")})]}):F?Xe?a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:m("Loading logs...")})]}):pe.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8",children:m(q?"Waiting for agent output...":"No logs recorded for this session.")}):a.jsx(fn,{logs:pe}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"w-14 h-14 bg-neutral-50 rounded-2xl border border-neutral-100 flex items-center justify-center mb-5",children:a.jsx(Ot,{size:24,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-base font-medium text-neutral-900 mb-1.5",children:m(z?"项目为只读历史":"尚未启动 Agent")}),a.jsx("p",{className:"text-sm text-neutral-500 mb-6 max-w-xs",children:z?Y:m("选择一个 Agent 来执行此任务,Agent 将自动创建工作空间并开始工作。")}),!z&&a.jsxs(dt,{onClick:()=>i(!0),children:[a.jsx(Ot,{size:16,className:"mr-1.5"}),m("启动 Agent")]})]})]})}),!T&&a.jsxs("button",{onClick:()=>B(),className:"absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 px-3 py-1.5 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-xs text-neutral-600 hover:bg-white hover:text-neutral-900 transition-all","aria-label":m("Scroll to bottom"),children:[a.jsx(bn,{size:14}),a.jsx("span",{children:m("回到底部")})]})]}),nt.length>0&&a.jsx("div",{className:"px-6 pt-2 pb-1 bg-white flex-shrink-0 border-t border-neutral-100",children:a.jsx(mn,{todos:nt})}),z?a.jsx("div",{className:"p-6 pt-3 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-neutral-100",children:a.jsx("div",{className:"bg-neutral-50 rounded-xl border border-neutral-200 px-4 py-3 text-sm text-neutral-500",children:Y})}):Me?a.jsx("div",{className:"p-6 pt-3 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-neutral-100",children:a.jsxs("div",{className:"flex items-center justify-between bg-neutral-50 rounded-xl border border-neutral-200 px-4 py-3",children:[a.jsx("span",{className:"text-sm text-neutral-500",children:m("代码已合并,以上为历史沟通记录")}),a.jsxs(dt,{size:"sm",onClick:()=>i(!0),children:[a.jsx(Ot,{size:14,className:"mr-1.5"}),m("启动新 Agent")]})]})}):a.jsxs("div",{className:"p-6 pt-2 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-transparent",onDragOver:Go,onDragLeave:Qo,onDrop:Zo,children:[a.jsxs("div",{ref:E,className:`relative bg-white rounded-xl border shadow-sm hover:shadow-md focus-within:shadow-md focus-within:border-neutral-300 transition-all duration-200 ${St?"border-blue-400 bg-blue-50/50 shadow-md":"border-neutral-200"}`,children:[a.jsx(Ns,{files:Ht,onRemove:U}),a.jsx("textarea",{ref:R,value:v,onChange:ta,onPaste:pt,onKeyDown:G=>{Ce.handleKeyDown(G)||Be.handleKeyDown(G)||G.key==="Enter"&&!G.shiftKey&&!G.repeat&&!G.nativeEvent.isComposing&&G.nativeEvent.keyCode!==229&&(G.preventDefault(),at())},rows:1,placeholder:m(St?"Drop files here...":F&&!q?"Continue conversation...":"Message Agent..."),className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-sm text-neutral-900 placeholder-neutral-400 leading-relaxed",style:{minHeight:"60px",maxHeight:"300px"}}),a.jsx("input",{ref:j,type:"file",multiple:!0,className:"hidden",onChange:Tt}),a.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("button",{onClick:()=>j.current?.click(),className:"p-2 text-neutral-400 hover:text-neutral-600 hover:bg-neutral-100 rounded-lg transition-colors",title:m("Upload file"),children:a.jsx(ws,{size:18})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[D&&ie&&a.jsx(jo,{providers:ie,currentProviderId:ge,agentType:D.agentType,onSelect:me}),a.jsx(Kn,{usage:mt}),q&&!v.trim()&&!ue?a.jsx("button",{onClick:jt,disabled:ot.isPending,className:"p-2 rounded-lg transition-all duration-200 bg-red-500 text-white hover:bg-red-600 shadow-md disabled:opacity-50",children:a.jsx(pn,{size:14})}):a.jsx("button",{onClick:at,disabled:!v.trim()&&!ue||ve,className:`p-2 rounded-lg transition-all duration-200 ${(v.trim()||ue)&&!ve?"bg-neutral-900 text-white shadow-md hover:bg-black":"bg-transparent text-neutral-300 cursor-not-allowed"}`,children:a.jsx(Sn,{size:18})})]})]})]}),a.jsx(Ps,{open:Be.query!==null,anchorRef:E,commands:Be.filteredCommands,selectedIndex:Be.selectedIndex,query:Be.query??"",hasCatalog:Be.allCommands.length>0,onSelect:Be.applyCommand}),a.jsx(Ps,{open:Ce.query!==null,anchorRef:E,commands:Ce.filteredSkills,selectedIndex:Ce.selectedIndex,query:Ce.query??"",hasCatalog:Ce.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",onSelect:Ce.applySkill})]})]}),W&&a.jsx("div",{className:"w-1 cursor-col-resize hover:bg-neutral-200 active:bg-blue-400 transition-colors z-30 flex-shrink-0 border-l border-neutral-200",onMouseDown:Jo}),W&&a.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-white",children:a.jsx(Co,{sessionId:F||void 0,workingDir:re,projectId:e.projectId,readOnly:z,repoDeleted:te})})]}),!z&&a.jsx(Ao,{isOpen:r,onClose:()=>i(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),oe&&!z&&a.jsx(Zf,{open:d,onOpenChange:h,workspaceId:oe,branchName:Re,targetBranch:e.mainBranch,commitMessage:Ve,onRefreshCommitMessage:st,onConflict:()=>n(!0)}),oe&&Ne&&Ne.conflictOp&&a.jsx(Gf,{open:g,onOpenChange:n,workspaceId:oe,conflictOp:Ne.conflictOp,conflictedFiles:Ne.conflictedFiles,sourceBranch:Re,targetBranch:e.mainBranch,sessions:qe}),a.jsx(Sr,{isOpen:o,onClose:()=>p(!1),onConfirm:Z,title:m("重新开始任务"),description:a.jsx("p",{children:m("将归档当前工作区并自动在新 Worktree 中重新启动 Agent,旧工作区内容保留供参考。")}),confirmText:m("确认重试"),variant:"default",isLoading:x}),a.jsx(Sr,{isOpen:c,onClose:()=>f(!1),onConfirm:Se,title:m("删除任务"),description:a.jsxs(a.Fragment,{children:[a.jsx("p",{children:m("确认删除任务「{title}」?此操作不可撤销。",{title:e.title})}),ti.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:ti.map((G,ne)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[a.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),a.jsx("span",{children:G})]},ne))})]}),confirmText:m("删除"),variant:"danger",isLoading:s})]}):a.jsx(Sm,{})}function ei(e){switch(e){case gt.TODO:return le.Pending;case gt.IN_PROGRESS:return le.Running;case gt.IN_REVIEW:return le.Review;case gt.DONE:return le.Done;case gt.CANCELLED:return le.Cancelled}}function wm(e){switch(e){case le.Pending:return gt.TODO;case le.Running:return gt.IN_PROGRESS;case le.Review:return gt.IN_REVIEW;case le.Done:return gt.DONE;case le.Cancelled:return gt.CANCELLED}}function Em(e){switch(e){case _t.CLAUDE_CODE:return"Claude Code";case _t.GEMINI_CLI:return"Gemini CLI";case _t.CURSOR_AGENT:return"Cursor Agent";case _t.CODEX:return"Codex"}}const Os=["text-indigo-600","text-emerald-600","text-rose-600","text-amber-600","text-cyan-600","text-violet-600","text-teal-600","text-pink-600"];function Po(e,t){let s=0;for(let l=0;l<e.length;l++)s=(s<<5)-s+e.charCodeAt(l)|0;return Math.abs(s)%t}function Oo(e,t){return t??e?.find(s=>s.status==="ACTIVE")??e?.[0]}function km(e){return{id:e.id,name:e.name,color:e.color||Os[Po(e.name,Os.length)],archivedAt:e.archivedAt??null,repoDeletedAt:e.repoDeletedAt??null}}function Rm(e){const t=Oo(e);if(!t)return{agent:"—",branch:"—"};const s=t.branchName,l=t.sessions;if(l&&l.length>0){const m=l[l.length-1];return{agent:Em(m.agentType),branch:s}}return{agent:"—",branch:s}}function Dm(e){const{agent:t,branch:s}=Rm(e.workspaces),l=e.project;return{id:e.id,projectId:e.projectId,title:e.title,status:ei(e.status),agent:t,branch:s,description:e.description??"",projectArchivedAt:l?.archivedAt??null,projectRepoDeletedAt:l?.repoDeletedAt??null}}function Am(e,t,s){const l=Oo(e.workspaces,s),m=l?.branchName??"—";return{id:e.id,projectId:t.id,projectName:t.name,projectColor:t.color||Os[Po(t.name,Os.length)],title:e.title,status:ei(e.status),branch:m,mainBranch:l?.baseBranch??t.mainBranch??"main",description:e.description??"",projectArchivedAt:t.archivedAt??null,projectRepoDeletedAt:t.repoDeletedAt??null}}const Bo=768;function jm(e){const t=window.matchMedia(`(max-width: ${Bo-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function Tm(){return window.innerWidth<Bo}function Lm(){return!1}function Mm(){return k.useSyncExternalStore(jm,Tm,Lm)}const Zi={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function Nm(e){const t=e.split("/");return t[t.length-1]||e}function Pm(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function Om({workingDir:e,filePath:t,type:s}){const{t:l}=ce(),{data:m,isLoading:v,isError:C}=xo(e,t,s);if(v)return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[a.jsx(ze,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:l("Loading diff...")})]});if(C)return a.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:l("Failed to load diff.")});const r=m?.diff||"";if(!r.trim())return a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:l("No diff content available.")});const i=r.split(`
|
|
80
|
+
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:i.map((c,f)=>{let o="",p="text-neutral-400";return c.startsWith("+")&&!c.startsWith("+++")?(o="bg-emerald-950/40",p="text-emerald-400"):c.startsWith("-")&&!c.startsWith("---")?(o="bg-red-950/40",p="text-red-400"):c.startsWith("@@")&&(o="bg-blue-950/30",p="text-blue-400"),a.jsx("div",{className:ye("px-3 whitespace-pre",o,p),children:c},f)})})}function Bm({entry:e,type:t,workingDir:s}){const[l,m]=k.useState(!1),v=Zi[e.status]||Zi.M,C=Pm(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:ye("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("span",{className:ye("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",v),children:e.status}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Nm(e.path)}),C&&a.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),a.jsx("span",{className:"text-neutral-400 shrink-0",children:l?a.jsx(xt,{size:14}):a.jsx(Ft,{size:14})})]}),l&&a.jsx(Om,{workingDir:s,filePath:e.path,type:t})]})}function Ji({title:e,entries:t,type:s,workingDir:l,defaultOpen:m}){const{t:v}=ce(),[C,r]=k.useState(m);return t.length===0?null:a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>r(i=>!i),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-neutral-50",children:[a.jsx("span",{className:"text-neutral-400",children:C?a.jsx(xt,{size:14}):a.jsx(Ft,{size:14})}),a.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:v(e)}),a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:t.length})]}),C&&a.jsx("div",{className:"divide-y divide-neutral-100",children:t.map(i=>a.jsx(Bm,{entry:i,type:s,workingDir:l},`${s}:${i.path}`))})]})}function Im({workingDir:e}){const{t}=ce(),{data:s,isLoading:l,isError:m}=bo(e);if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:t("No workspace selected.")});if(l)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:t("Loading changes...")})]});if(m)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:t("Failed to load changes.")});const v=s?.uncommitted||[],C=s?.committed||[];return v.length+C.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[a.jsx(is,{size:28,className:"mb-3"}),a.jsx("span",{className:"text-sm",children:t("No pending changes")})]}):a.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[a.jsx(Ji,{title:"Uncommitted",entries:v,type:"uncommitted",workingDir:e,defaultOpen:!0}),a.jsx(Ji,{title:"Committed",entries:C,type:"committed",workingDir:e,defaultOpen:!1})]})}const gr=50,en={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function Fm(e){const s=Math.floor(Date.now()/1e3)-e;return s<60?Et("{count}s ago",{count:s}):s<3600?Et("{count}m ago",{count:Math.floor(s/60)}):s<86400?Et("{count}h ago",{count:Math.floor(s/3600)}):s<604800?Et("{count}d ago",{count:Math.floor(s/86400)}):new Date(e*1e3).toLocaleDateString()}function Hm(e){const t=e.split("/");return t[t.length-1]||e}function zm(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function Wm({workingDir:e,hash:t,filePath:s}){const{t:l}=ce(),{data:m,isLoading:v,isError:C}=yo(e,t,s);if(v)return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[a.jsx(ze,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:l("Loading diff...")})]});if(C)return a.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:l("Failed to load diff.")});const r=m?.diff||"";if(!r.trim())return a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:l("No diff content available.")});const i=r.split(`
|
|
81
|
+
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:i.map((c,f)=>{let o="",p="text-neutral-400";return c.startsWith("+")&&!c.startsWith("+++")?(o="bg-emerald-950/40",p="text-emerald-400"):c.startsWith("-")&&!c.startsWith("---")?(o="bg-red-950/40",p="text-red-400"):c.startsWith("@@")&&(o="bg-blue-950/30",p="text-blue-400"),a.jsx("div",{className:ye("px-3 whitespace-pre",o,p),children:c},f)})})}function $m({entry:e,workingDir:t,hash:s}){const[l,m]=k.useState(!1),v=en[e.status]||en.M,C=zm(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:ye("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("span",{className:ye("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",v),children:e.status}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Hm(e.path)}),C&&a.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),a.jsx("span",{className:"text-neutral-400 shrink-0",children:l?a.jsx(xt,{size:14}):a.jsx(Ft,{size:14})})]}),l&&a.jsx(Wm,{workingDir:t,hash:s,filePath:e.path})]})}function Um({commit:e,workingDir:t}){const{t:s}=ce(),[l,m]=k.useState(!1),{data:v,isLoading:C}=So(t,l?e.hash:null),r=v?.files||[];return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(i=>!i),className:ye("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:a.jsx("div",{className:ye("w-2.5 h-2.5 rounded-full shrink-0",l?"bg-blue-500":"bg-neutral-300")})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs font-mono text-blue-600 shrink-0",children:e.shortHash}),a.jsx("span",{className:"text-sm text-neutral-900 truncate flex-1",children:e.message})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-[11px] text-neutral-500 truncate",children:e.author}),a.jsx("span",{className:"text-[11px] text-neutral-400",children:Fm(e.timestamp)})]})]}),a.jsx("span",{className:"text-neutral-400 shrink-0 pt-0.5",children:l?a.jsx(xt,{size:14}):a.jsx(Ft,{size:14})})]}),l&&a.jsxs("div",{className:"pl-4 border-l-2 border-blue-100 ml-[22px]",children:[e.body&&a.jsx("div",{className:"px-3 py-2 text-xs text-neutral-600 whitespace-pre-wrap leading-4",children:e.body}),C?a.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-neutral-400",children:[a.jsx(ze,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:s("Loading files...")})]}):r.length===0?a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:s("No files changed")}):a.jsx("div",{className:"divide-y divide-neutral-100",children:r.map(i=>a.jsx($m,{entry:i,workingDir:t,hash:e.hash},i.path))})]})]})}function qm({workingDir:e}){const{t}=ce(),{data:s,isLoading:l,isError:m,fetchNextPage:v,hasNextPage:C,isFetchingNextPage:r}=_n({queryKey:ae.git.log(e||""),queryFn:({pageParam:c=0})=>fe.get("/git/log",{params:{workingDir:e||"",limit:String(gr),skip:String(c)}}),initialPageParam:0,getNextPageParam:(c,f)=>c.commits.length<gr?void 0:f.length*gr,enabled:!!e}),i=s?.pages.flatMap(c=>c.commits)||[];return e?l?a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[a.jsx(ze,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:t("Loading history...")})]}):m?a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:t("Failed to load history.")}):i.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[a.jsx(qt,{size:28,className:"mb-3"}),a.jsx("span",{className:"text-sm",children:t("No commit history")})]}):a.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[a.jsx("div",{className:"divide-y divide-neutral-100",children:i.map(c=>a.jsx(Um,{commit:c,workingDir:e},c.hash))}),C&&a.jsx("button",{type:"button",onClick:()=>v(),disabled:r,className:"w-full py-4 text-sm text-neutral-500 active:text-neutral-700 active:bg-neutral-50 flex items-center justify-center gap-2",children:r?a.jsxs(a.Fragment,{children:[a.jsx(ze,{size:14,className:"animate-spin"})," ",t("Loading...")]}):t("Load more")})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:t("No workspace selected.")})}const Km="/api",Xm=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?`${Km}/attachments/by-path?path=${encodeURIComponent(e)}`:e,Ym=({src:e,alt:t,...s})=>a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:a.jsx("img",{src:e,alt:t,...s,className:"max-w-[300px] max-h-[200px] object-contain rounded-lg border border-neutral-200 cursor-pointer active:opacity-90 transition-opacity"})}),Vm={img:Ym};function Gm({status:e}){const t={[le.Running]:"bg-blue-500",[le.Review]:"bg-amber-500",[le.Pending]:"bg-neutral-400",[le.Done]:"bg-emerald-500",[le.Cancelled]:"bg-neutral-400"};return a.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${t[e]}`})}const Qm=[{key:"chat",label:"Chat",icon:rl},{key:"changes",label:"Changes",icon:is},{key:"history",label:"History",icon:qt},{key:"workspace",label:"Workspace",icon:wn}];function Zm({task:e,onBack:t,onDeleteTask:s,isDeleting:l}){const{t:m}=ce(),[v,C]=k.useState("chat"),[r,i]=k.useState(""),[c,f]=k.useState(!1),[o,p]=k.useState(!1),[x,S]=k.useState(!1),g=k.useRef(null),n=k.useRef(null),d=k.useRef(null),h=k.useRef(null),{scrollRef:u,contentRef:_,isAtBottom:y,scrollToBottom:w}=qn({resize:"smooth",initial:"instant"}),E=We();k.useEffect(()=>{if(!x)return;const V=Z=>{n.current&&!n.current.contains(Z.target)&&S(!1)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[x]);const{data:b,isLoading:R}=wo(e.id),j=k.useMemo(()=>{if(!b)return null;const V=b.filter(pe=>pe.status==="ACTIVE"&&Array.isArray(pe.sessions)).flatMap(pe=>pe.sessions??[]),Z=pe=>{const et=pe.createdAt,Ge=pe.endedAt??pe.startedAt??et;if(!Ge)return 0;const nt=Date.parse(Ge);return Number.isNaN(nt)?0:nt},xe=pe=>{const et=V.filter(Ge=>pe.includes(Ge.status));return et.length===0?null:et.sort((Ge,nt)=>Z(nt)-Z(Ge))[0]??null},Se=xe([Le.RUNNING])??xe([Le.PENDING])??xe([Le.COMPLETED,Le.FAILED,Le.CANCELLED]);if(Se)return Se;const Xe=b.filter(pe=>(pe.status==="ABANDONED"||pe.status==="MERGED")&&Array.isArray(pe.sessions)).flatMap(pe=>pe.sessions??[]).filter(pe=>[Le.COMPLETED,Le.FAILED,Le.CANCELLED].includes(pe.status));return Xe.length===0?null:Xe.sort((pe,et)=>Z(et)-Z(pe))[0]??null},[b]),M=j?.id??"",L=j?.status===Le.RUNNING||j?.status===Le.PENDING,T=!!e.projectArchivedAt,B=!!e.projectRepoDeletedAt,I=m(B?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。"),H=k.useMemo(()=>!j||!b?!1:!b.some(Z=>Z.status==="ACTIVE"&&Z.sessions?.some(xe=>xe.id===j.id)),[j,b]),{data:W}=Hs(),[A,N]=k.useState(null);k.useEffect(()=>{N(j?.providerId??null)},[j?.providerId]);const P=k.useMemo(()=>{if(b){for(const V of b)if(V.status==="ACTIVE"&&V.worktreePath)return V.worktreePath;return b[0]?.worktreePath}},[b]),O=Mo({agentType:j?.agentType,workingDir:P,input:r,setInput:i,textareaRef:d,minHeight:40,maxHeight:140}),$=No({agentType:j?.agentType,workingDir:P,input:r,setInput:i,textareaRef:d,minHeight:40,maxHeight:140}),X=k.useMemo(()=>{if(b)return b.find(V=>V.status==="ACTIVE")?.id},[b]),K=k.useMemo(()=>{const V=[];if(b&&b.length>0){const Z=b.some(Se=>Se.status==="ACTIVE");b.some(Se=>Se.sessions?.some(He=>He.status===Le.RUNNING||He.status===Le.PENDING))&&V.push(m("正在运行的 Agent 将被停止")),Z&&(V.push(m("分支上未合并的变更将丢失")),V.push(m("关联的工作目录(worktree)将被清理")))}return V},[b,m]),Q=Zr(),se=Gr(),D=Ro(),{isConnected:F,isLoadingSnapshot:q,logs:z,entries:te,attach:Y}=hn({sessionId:M,onExit:k.useCallback(()=>{E.invalidateQueries({queryKey:["workspaces"]})},[E])}),{todos:ie}=un(te),{files:ge,addFiles:me,removeFile:Me,clear:re,buildMarkdownLinks:Be,hasFiles:Ce,isUploading:oe}=Jr(),Ne=k.useMemo(()=>{if(!j?.tokenUsage)return;const V=j.tokenUsage;if(typeof V.totalTokens=="number")return V},[j?.tokenUsage]),qe=Do(z,Ne);k.useEffect(()=>{M&&F&&Y()},[M,F,Y]),k.useEffect(()=>{w()},[e.id,w]);const Re=k.useRef(!1),Ve=k.useCallback(async()=>{if(!r.trim()&&!Ce||!M||Re.current||oe)return;Re.current=!0;const V=Be(),Z=[r.trim(),V].filter(Boolean).join(`
|
|
82
82
|
|
|
83
|
-
`);i(""),re(),d.current&&(d.current.style.height="40px"),Q.mutate({id:M,message:Z,providerId:A??void 0},{onSuccess:()=>Y(),onSettled:()=>{Re.current=!1}})},[r,M,Q,Y,Ce,oe,Be,re,A]),be=k.useCallback(async()=>{M&&(await D.mutateAsync(M),E.invalidateQueries({queryKey:["workspaces"]}))},[M,D,E]),st=k.useCallback(V=>{const Z=V.target.files;Z&&Z.length>0&&me(Array.from(Z)),V.target.value=""},[me]),Ke=k.useCallback(V=>{const Z=V.clipboardData.items,xe=[];for(const Se of Z)if(Se.kind==="file"){const He=Se.getAsFile();He&&xe.push(He)}xe.length>0&&(V.preventDefault(),me(xe))},[me]),Pe=k.useCallback(V=>{i(V.target.value);const Z=V.target;Z.style.height="auto",Z.style.height=`${Math.max(40,Math.min(Z.scrollHeight,140))}px`},[]),Oe=k.useCallback(()=>{X&&se.mutate({workspaceId:X})},[X,se]),De=k.useRef(null);return k.useEffect(()=>{const V=window.visualViewport;if(!V)return;let Z=!1;const xe=()=>{De.current&&(De.current.style.height=`${V.height}px`,De.current.style.top=`${V.offsetTop}px`)},Se=()=>xe(),He=()=>{Z||xe()},Xe=()=>{Z=!0},pe=()=>{Z=!1,requestAnimationFrame(xe)};return V.addEventListener("resize",Se),V.addEventListener("scroll",He),document.addEventListener("touchstart",Xe,{passive:!0}),document.addEventListener("touchend",pe,{passive:!0}),document.addEventListener("touchcancel",pe,{passive:!0}),()=>{V.removeEventListener("resize",Se),V.removeEventListener("scroll",He),document.removeEventListener("touchstart",Xe),document.removeEventListener("touchend",pe),document.removeEventListener("touchcancel",pe)}},[]),k.useEffect(()=>{const V=De.current;if(!V)return;const Z=xe=>{let Se=xe.target;for(;Se&&Se!==V;){if(Se.tagName==="TEXTAREA"){if(Se.scrollHeight>Se.clientHeight)return;Se=Se.parentElement;continue}const Xe=window.getComputedStyle(Se).overflowY;if((Xe==="auto"||Xe==="scroll")&&Se.scrollHeight>Se.clientHeight)return;Se=Se.parentElement}xe.preventDefault()};return V.addEventListener("touchmove",Z,{passive:!1}),()=>V.removeEventListener("touchmove",Z)},[]),a.jsxs("div",{ref:De,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[a.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[a.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[a.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:a.jsx(_a,{size:18})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),a.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[a.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),e.projectArchivedAt&&a.jsx("span",{className:"rounded-full bg-neutral-100 px-1.5 py-0.5 text-[10px] font-medium text-neutral-500",children:e.projectRepoDeletedAt?m("源码已删除"):m("已删除")}),a.jsx("span",{className:"text-neutral-300",children:"/"}),a.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),a.jsx(Gm,{status:e.status}),a.jsx("button",{onClick:Oe,disabled:!X||T,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:a.jsx(zs,{size:16})}),s&&!T&&a.jsxs("div",{className:"relative",ref:n,children:[a.jsx("button",{onClick:()=>S(V=>!V),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:a.jsx(yn,{size:16})}),x&&a.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:a.jsxs("button",{onClick:()=>{p(!0),S(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 active:bg-red-50",children:[a.jsx(vn,{size:15}),a.jsx("span",{children:m("删除任务")})]})})]})]}),a.jsx("div",{className:"flex border-t border-neutral-100",children:Qm.map(({key:V,label:Z,icon:xe})=>a.jsxs("button",{onClick:()=>C(V),className:`flex-1 flex items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors ${v===V?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[a.jsx(xe,{size:13}),a.jsx("span",{children:Z})]},V))})]}),v==="chat"&&a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:u,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:a.jsxs("div",{ref:_,children:[a.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:e.description?a.jsx("div",{className:"text-[13px] text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:a.jsx(dn,{urlTransform:Xm,components:Vm,children:e.description})}):a.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),R?a.jsx(tn,{label:"Loading..."}):M?U?a.jsx(tn,{label:"Loading logs..."}):z.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:L?"Waiting for agent output...":"No logs recorded."}):a.jsx(fn,{logs:z}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:a.jsx(Ot,{size:20,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:m("尚未启动 Agent")}),a.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:T?I:m("选择一个 Agent 来执行此任务")}),!T&&a.jsxs(dt,{onClick:()=>f(!0),children:[a.jsx(Ot,{size:16,className:"mr-1.5"}),m("启动 Agent")]})]})]})}),!y&&a.jsxs("button",{onClick:()=>w(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":"Scroll to bottom",children:[a.jsx(bn,{size:12}),a.jsx("span",{children:m("回到底部")})]})]}),ie.length>0&&a.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:a.jsx(mn,{todos:ie,compact:!0})}),T?a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsx("div",{className:"rounded-xl border border-neutral-200 bg-neutral-50 px-3 py-2 text-xs text-neutral-500",children:I})}):H?a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-neutral-200 bg-neutral-50 px-3 py-2",children:[a.jsx("span",{className:"text-xs text-neutral-500",children:m("代码已合并,以上为历史沟通记录")}),a.jsxs(dt,{size:"sm",onClick:()=>f(!0),children:[a.jsx(Ot,{size:14,className:"mr-1.5"}),m("启动新 Agent")]})]})}):M&&a.jsxs("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:[a.jsxs("div",{ref:g,className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[a.jsx(Ns,{files:ge,onRemove:Me}),a.jsx("textarea",{ref:d,value:r,onChange:Pe,onPaste:Ke,onKeyDown:V=>{$.handleKeyDown(V)||O.handleKeyDown(V)||V.key==="Enter"&&!V.shiftKey&&!V.repeat&&!V.nativeEvent.isComposing&&V.nativeEvent.keyCode!==229&&(V.preventDefault(),Ve())},rows:1,placeholder:L?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-neutral-900 placeholder-neutral-400",style:{minHeight:40,maxHeight:140}}),a.jsx("input",{ref:h,type:"file",multiple:!0,className:"hidden",onChange:st}),a.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[a.jsx("div",{className:"flex items-center gap-0.5",children:a.jsx("button",{onClick:()=>h.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:a.jsx(ws,{size:15})})}),a.jsxs("div",{className:"flex items-center gap-1",children:[j&&W&&a.jsx(jo,{providers:W,currentProviderId:A,agentType:j.agentType,onSelect:N}),a.jsx(Kn,{usage:qe}),L&&!r.trim()&&!Ce?a.jsx("button",{onClick:be,disabled:D.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:a.jsx(pn,{size:12})}):a.jsx("button",{onClick:Ve,disabled:!r.trim()&&!Ce||oe,className:`p-1.5 rounded-lg transition-colors ${(r.trim()||Ce)&&!oe?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:a.jsx(Sn,{size:15})})]})]})]}),a.jsx(Ps,{open:O.query!==null,anchorRef:g,commands:O.filteredCommands,selectedIndex:O.selectedIndex,query:O.query??"",hasCatalog:O.allCommands.length>0,compact:!0,onSelect:O.applyCommand}),a.jsx(Ps,{open:$.query!==null,anchorRef:g,commands:$.filteredSkills,selectedIndex:$.selectedIndex,query:$.query??"",hasCatalog:$.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",compact:!0,onSelect:$.applySkill})]})]}),v==="changes"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(Im,{workingDir:P})}),v==="history"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(qm,{workingDir:P})}),v==="workspace"&&a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(Co,{sessionId:M||void 0,workingDir:P,projectId:e.projectId,className:"h-full",hideChanges:!0,readOnly:T,repoDeleted:B})}),!T&&a.jsx(Ao,{isOpen:c,onClose:()=>f(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),a.jsx(xr,{isOpen:o,onClose:()=>p(!1),onConfirm:()=>{s?.(e.id),p(!1)},title:m("删除任务"),description:a.jsxs(a.Fragment,{children:[a.jsx("p",{children:m("确认删除任务「{title}」?此操作不可撤销。",{title:e.title})}),K.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:K.map((V,Z)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[a.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),a.jsx("span",{children:V})]},Z))})]}),confirmText:m("删除"),variant:"danger",isLoading:l})]})}function tn({label:e}){return a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:e})]})}var Jm=Object.defineProperty,Bs=Object.getOwnPropertySymbols,Io=Object.prototype.hasOwnProperty,Fo=Object.prototype.propertyIsEnumerable,sn=(e,t,s)=>t in e?Jm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Dr=(e,t)=>{for(var s in t||(t={}))Io.call(t,s)&&sn(e,s,t[s]);if(Bs)for(var s of Bs(t))Fo.call(t,s)&&sn(e,s,t[s]);return e},Ar=(e,t)=>{var s={};for(var l in e)Io.call(e,l)&&t.indexOf(l)<0&&(s[l]=e[l]);if(e!=null&&Bs)for(var l of Bs(e))t.indexOf(l)<0&&Fo.call(e,l)&&(s[l]=e[l]);return s};var It;(e=>{const t=class de{constructor(i,c,f,o){if(this.version=i,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],i<de.MIN_VERSION||i>de.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let p=[];for(let S=0;S<this.size;S++)p.push(!1);for(let S=0;S<this.size;S++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const x=this.addEccAndInterleave(f);if(this.drawCodewords(x),o==-1){let S=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const n=this.getPenaltyScore();n<S&&(o=g,S=n),this.applyMask(g)}}m(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,c){const f=e.QrSegment.makeSegments(i);return de.encodeSegments(f,c)}static encodeBinary(i,c){const f=e.QrSegment.makeBytes(i);return de.encodeSegments([f],c)}static encodeSegments(i,c,f=1,o=40,p=-1,x=!0){if(!(de.MIN_VERSION<=f&&f<=o&&o<=de.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let S,g;for(S=f;;S++){const u=de.getNumDataCodewords(S,c)*8,_=C.getTotalBits(i,S);if(_<=u){g=_;break}if(S>=o)throw new RangeError("Data too long")}for(const u of[de.Ecc.MEDIUM,de.Ecc.QUARTILE,de.Ecc.HIGH])x&&g<=de.getNumDataCodewords(S,u)*8&&(c=u);let n=[];for(const u of i){s(u.mode.modeBits,4,n),s(u.numChars,u.mode.numCharCountBits(S),n);for(const _ of u.getData())n.push(_)}m(n.length==g);const d=de.getNumDataCodewords(S,c)*8;m(n.length<=d),s(0,Math.min(4,d-n.length),n),s(0,(8-n.length%8)%8,n),m(n.length%8==0);for(let u=236;n.length<d;u^=253)s(u,8,n);let h=[];for(;h.length*8<n.length;)h.push(0);return n.forEach((u,_)=>h[_>>>3]|=u<<7-(_&7)),new de(S,c,h,p)}getModule(i,c){return 0<=i&&i<this.size&&0<=c&&c<this.size&&this.modules[c][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let f=0;f<this.size;f++)this.setFunctionModule(6,f,f%2==0),this.setFunctionModule(f,6,f%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),c=i.length;for(let f=0;f<c;f++)for(let o=0;o<c;o++)f==0&&o==0||f==0&&o==c-1||f==c-1&&o==0||this.drawAlignmentPattern(i[f],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const c=this.errorCorrectionLevel.formatBits<<3|i;let f=c;for(let p=0;p<10;p++)f=f<<1^(f>>>9)*1335;const o=(c<<10|f)^21522;m(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,l(o,p));this.setFunctionModule(8,7,l(o,6)),this.setFunctionModule(8,8,l(o,7)),this.setFunctionModule(7,8,l(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,l(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,l(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,l(o,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let f=0;f<12;f++)i=i<<1^(i>>>11)*7973;const c=this.version<<12|i;m(c>>>18==0);for(let f=0;f<18;f++){const o=l(c,f),p=this.size-11+f%3,x=Math.floor(f/3);this.setFunctionModule(p,x,o),this.setFunctionModule(x,p,o)}}drawFinderPattern(i,c){for(let f=-4;f<=4;f++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(f)),x=i+o,S=c+f;0<=x&&x<this.size&&0<=S&&S<this.size&&this.setFunctionModule(x,S,p!=2&&p!=4)}}drawAlignmentPattern(i,c){for(let f=-2;f<=2;f++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,c+f,Math.max(Math.abs(o),Math.abs(f))!=1)}setFunctionModule(i,c,f){this.modules[c][i]=f,this.isFunction[c][i]=!0}addEccAndInterleave(i){const c=this.version,f=this.errorCorrectionLevel;if(i.length!=de.getNumDataCodewords(c,f))throw new RangeError("Invalid argument");const o=de.NUM_ERROR_CORRECTION_BLOCKS[f.ordinal][c],p=de.ECC_CODEWORDS_PER_BLOCK[f.ordinal][c],x=Math.floor(de.getNumRawDataModules(c)/8),S=o-x%o,g=Math.floor(x/o);let n=[];const d=de.reedSolomonComputeDivisor(p);for(let u=0,_=0;u<o;u++){let y=i.slice(_,_+g-p+(u<S?0:1));_+=y.length;const w=de.reedSolomonComputeRemainder(y,d);u<S&&y.push(0),n.push(y.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((_,y)=>{(u!=g-p||y>=S)&&h.push(_[u])});return m(h.length==x),h}drawCodewords(i){if(i.length!=Math.floor(de.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let f=this.size-1;f>=1;f-=2){f==6&&(f=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const x=f-p,g=(f+1&2)==0?this.size-1-o:o;!this.isFunction[g][x]&&c<i.length*8&&(this.modules[g][x]=l(i[c>>>3],7-(c&7)),c++)}}m(c==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let f=0;f<this.size;f++){let o;switch(i){case 0:o=(f+c)%2==0;break;case 1:o=c%2==0;break;case 2:o=f%3==0;break;case 3:o=(f+c)%3==0;break;case 4:o=(Math.floor(f/3)+Math.floor(c/2))%2==0;break;case 5:o=f*c%2+f*c%3==0;break;case 6:o=(f*c%2+f*c%3)%2==0;break;case 7:o=((f+c)%2+f*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][f]&&o&&(this.modules[c][f]=!this.modules[c][f])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let x=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==x?(S++,S==5?i+=de.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),x||(i+=this.finderPenaltyCountPatterns(g)*de.PENALTY_N3),x=this.modules[p][n],S=1);i+=this.finderPenaltyTerminateAndCount(x,S,g)*de.PENALTY_N3}for(let p=0;p<this.size;p++){let x=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==x?(S++,S==5?i+=de.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),x||(i+=this.finderPenaltyCountPatterns(g)*de.PENALTY_N3),x=this.modules[n][p],S=1);i+=this.finderPenaltyTerminateAndCount(x,S,g)*de.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let x=0;x<this.size-1;x++){const S=this.modules[p][x];S==this.modules[p][x+1]&&S==this.modules[p+1][x]&&S==this.modules[p+1][x+1]&&(i+=de.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((x,S)=>x+(S?1:0),c);const f=this.size*this.size,o=Math.ceil(Math.abs(c*20-f*10)/f)-1;return m(0<=o&&o<=9),i+=o*de.PENALTY_N4,m(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let f=[6];for(let o=this.size-7;f.length<i;o-=c)f.splice(1,0,o);return f}}static getNumRawDataModules(i){if(i<de.MIN_VERSION||i>de.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*i+128)*i+64;if(i>=2){const f=Math.floor(i/7)+2;c-=(25*f-10)*f-55,i>=7&&(c-=36)}return m(208<=c&&c<=29648),c}static getNumDataCodewords(i,c){return Math.floor(de.getNumRawDataModules(i)/8)-de.ECC_CODEWORDS_PER_BLOCK[c.ordinal][i]*de.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let c=[];for(let o=0;o<i-1;o++)c.push(0);c.push(1);let f=1;for(let o=0;o<i;o++){for(let p=0;p<c.length;p++)c[p]=de.reedSolomonMultiply(c[p],f),p+1<c.length&&(c[p]^=c[p+1]);f=de.reedSolomonMultiply(f,2)}return c}static reedSolomonComputeRemainder(i,c){let f=c.map(o=>0);for(const o of i){const p=o^f.shift();f.push(0),c.forEach((x,S)=>f[S]^=de.reedSolomonMultiply(x,p))}return f}static reedSolomonMultiply(i,c){if(i>>>8||c>>>8)throw new RangeError("Byte out of range");let f=0;for(let o=7;o>=0;o--)f=f<<1^(f>>>7)*285,f^=(c>>>o&1)*i;return m(f>>>8==0),f}finderPenaltyCountPatterns(i){const c=i[1];m(c<=this.size*3);const f=c>0&&i[2]==c&&i[3]==c*3&&i[4]==c&&i[5]==c;return(f&&i[0]>=c*4&&i[6]>=c?1:0)+(f&&i[6]>=c*4&&i[0]>=c?1:0)}finderPenaltyTerminateAndCount(i,c,f){return i&&(this.finderPenaltyAddHistory(c,f),c=0),c+=this.size,this.finderPenaltyAddHistory(c,f),this.finderPenaltyCountPatterns(f)}finderPenaltyAddHistory(i,c){c[0]==0&&(i+=this.size),c.pop(),c.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function s(r,i,c){if(i<0||i>31||r>>>i)throw new RangeError("Value out of range");for(let f=i-1;f>=0;f--)c.push(r>>>f&1)}function l(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const v=class Ie{constructor(i,c,f){if(this.mode=i,this.numChars=c,this.bitData=f,c<0)throw new RangeError("Invalid argument");this.bitData=f.slice()}static makeBytes(i){let c=[];for(const f of i)s(f,8,c);return new Ie(Ie.Mode.BYTE,i.length,c)}static makeNumeric(i){if(!Ie.isNumeric(i))throw new RangeError("String contains non-numeric characters");let c=[];for(let f=0;f<i.length;){const o=Math.min(i.length-f,3);s(parseInt(i.substring(f,f+o),10),o*3+1,c),f+=o}return new Ie(Ie.Mode.NUMERIC,i.length,c)}static makeAlphanumeric(i){if(!Ie.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],f;for(f=0;f+2<=i.length;f+=2){let o=Ie.ALPHANUMERIC_CHARSET.indexOf(i.charAt(f))*45;o+=Ie.ALPHANUMERIC_CHARSET.indexOf(i.charAt(f+1)),s(o,11,c)}return f<i.length&&s(Ie.ALPHANUMERIC_CHARSET.indexOf(i.charAt(f)),6,c),new Ie(Ie.Mode.ALPHANUMERIC,i.length,c)}static makeSegments(i){return i==""?[]:Ie.isNumeric(i)?[Ie.makeNumeric(i)]:Ie.isAlphanumeric(i)?[Ie.makeAlphanumeric(i)]:[Ie.makeBytes(Ie.toUtf8ByteArray(i))]}static makeEci(i){let c=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)s(i,8,c);else if(i<16384)s(2,2,c),s(i,14,c);else if(i<1e6)s(6,3,c),s(i,21,c);else throw new RangeError("ECI assignment value out of range");return new Ie(Ie.Mode.ECI,0,c)}static isNumeric(i){return Ie.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Ie.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,c){let f=0;for(const o of i){const p=o.mode.numCharCountBits(c);if(o.numChars>=1<<p)return 1/0;f+=4+p+o.bitData.length}return f}static toUtf8ByteArray(i){i=encodeURI(i);let c=[];for(let f=0;f<i.length;f++)i.charAt(f)!="%"?c.push(i.charCodeAt(f)):(c.push(parseInt(i.substring(f+1,f+3),16)),f+=2);return c}};v.NUMERIC_REGEX=/^[0-9]*$/,v.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,v.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=v;e.QrSegment=v})(It||(It={}));(e=>{(t=>{const s=class{constructor(m,v){this.ordinal=m,this.formatBits=v}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),t.Ecc=s})(e.QrCode||(e.QrCode={}))})(It||(It={}));(e=>{(t=>{const s=class{constructor(m,v){this.modeBits=m,this.numBitsCharCount=v}numCharCountBits(m){return this.numBitsCharCount[Math.floor((m+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),t.Mode=s})(e.QrSegment||(e.QrSegment={}))})(It||(It={}));var $t=It;var ep={L:$t.QrCode.Ecc.LOW,M:$t.QrCode.Ecc.MEDIUM,Q:$t.QrCode.Ecc.QUARTILE,H:$t.QrCode.Ecc.HIGH},Ho=128,zo="L",Wo="#FFFFFF",$o="#000000",Uo=!1,qo=1,tp=4,sp=0,rp=.1;function Ko(e,t=0){const s=[];return e.forEach(function(l,m){let v=null;l.forEach(function(C,r){if(!C&&v!==null){s.push(`M${v+t} ${m+t}h${r-v}v1H${v+t}z`),v=null;return}if(r===l.length-1){if(!C)return;v===null?s.push(`M${r+t},${m+t} h1v1H${r+t}z`):s.push(`M${v+t},${m+t} h${r+1-v}v1H${v+t}z`);return}C&&v===null&&(v=r)})}),s.join("")}function Xo(e,t){return e.slice().map((s,l)=>l<t.y||l>=t.y+t.h?s:s.map((m,v)=>v<t.x||v>=t.x+t.w?m:!1))}function ip(e,t,s,l){if(l==null)return null;const m=e.length+s*2,v=Math.floor(t*rp),C=m/t,r=(l.width||v)*C,i=(l.height||v)*C,c=l.x==null?e.length/2-r/2:l.x*C,f=l.y==null?e.length/2-i/2:l.y*C,o=l.opacity==null?1:l.opacity;let p=null;if(l.excavate){let S=Math.floor(c),g=Math.floor(f),n=Math.ceil(r+c-S),d=Math.ceil(i+f-g);p={x:S,y:g,w:n,h:d}}const x=l.crossOrigin;return{x:c,y:f,h:i,w:r,excavation:p,opacity:o,crossOrigin:x}}function np(e,t){return t!=null?Math.max(Math.floor(t),0):e?tp:sp}function Yo({value:e,level:t,minVersion:s,includeMargin:l,marginSize:m,imageSettings:v,size:C,boostLevel:r}){let i=ee.useMemo(()=>{const S=(Array.isArray(e)?e:[e]).reduce((g,n)=>(g.push(...$t.QrSegment.makeSegments(n)),g),[]);return $t.QrCode.encodeSegments(S,ep[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:c,margin:f,numCells:o,calculatedImageSettings:p}=ee.useMemo(()=>{let x=i.getModules();const S=np(l,m),g=x.length+S*2,n=ip(x,C,S,v);return{cells:x,margin:S,numCells:g,calculatedImageSettings:n}},[i,C,v,l,m]);return{qrcode:i,margin:f,cells:c,numCells:o,calculatedImageSettings:p}}var op=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),ap=ee.forwardRef(function(t,s){const l=t,{value:m,size:v=Ho,level:C=zo,bgColor:r=Wo,fgColor:i=$o,includeMargin:c=Uo,minVersion:f=qo,boostLevel:o,marginSize:p,imageSettings:x}=l,g=Ar(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=g,d=Ar(g,["style"]),h=x?.src,u=ee.useRef(null),_=ee.useRef(null),y=ee.useCallback(B=>{u.current=B,typeof s=="function"?s(B):s&&(s.current=B)},[s]),[w,E]=ee.useState(!1),{margin:b,cells:R,numCells:j,calculatedImageSettings:M}=Yo({value:m,level:C,minVersion:f,boostLevel:o,includeMargin:c,marginSize:p,imageSettings:x,size:v});ee.useEffect(()=>{if(u.current!=null){const B=u.current,I=B.getContext("2d");if(!I)return;let H=R;const W=_.current,A=M!=null&&W!==null&&W.complete&&W.naturalHeight!==0&&W.naturalWidth!==0;A&&M.excavation!=null&&(H=Xo(R,M.excavation));const N=window.devicePixelRatio||1;B.height=B.width=v*N;const P=v/j*N;I.scale(P,P),I.fillStyle=r,I.fillRect(0,0,j,j),I.fillStyle=i,op?I.fill(new Path2D(Ko(H,b))):R.forEach(function(O,$){O.forEach(function(X,K){X&&I.fillRect(K+b,$+b,1,1)})}),M&&(I.globalAlpha=M.opacity),A&&I.drawImage(W,M.x+b,M.y+b,M.w,M.h)}}),ee.useEffect(()=>{E(!1)},[h]);const L=Dr({height:v,width:v},n);let T=null;return h!=null&&(T=ee.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{E(!0)},ref:_,crossOrigin:M?.crossOrigin})),ee.createElement(ee.Fragment,null,ee.createElement("canvas",Dr({style:L,height:v,width:v,ref:y,role:"img"},d)),T)});ap.displayName="QRCodeCanvas";var Vo=ee.forwardRef(function(t,s){const l=t,{value:m,size:v=Ho,level:C=zo,bgColor:r=Wo,fgColor:i=$o,includeMargin:c=Uo,minVersion:f=qo,boostLevel:o,title:p,marginSize:x,imageSettings:S}=l,g=Ar(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:d,numCells:h,calculatedImageSettings:u}=Yo({value:m,level:C,minVersion:f,boostLevel:o,includeMargin:c,marginSize:x,imageSettings:S,size:v});let _=d,y=null;S!=null&&u!=null&&(u.excavation!=null&&(_=Xo(d,u.excavation)),y=ee.createElement("image",{href:S.src,height:u.h,width:u.w,x:u.x+n,y:u.y+n,preserveAspectRatio:"none",opacity:u.opacity,crossOrigin:u.crossOrigin}));const w=Ko(_,n);return ee.createElement("svg",Dr({height:v,width:v,viewBox:`0 0 ${h} ${h}`,ref:s,role:"img"},g),!!p&&ee.createElement("title",null,p),ee.createElement("path",{fill:r,d:`M0,0 h${h}v${h}H0z`,shapeRendering:"crispEdges"}),ee.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),y)});Vo.displayName="QRCodeSVG";function lp(){return ht({queryKey:ae.tunnel.status,queryFn:()=>fe.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function cp(){const e=We();return Ze({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return fe.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:ae.tunnel.status})}})}function hp(){const e=We();return Ze({mutationFn:()=>fe.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:ae.tunnel.status})}})}function rn(){const{t:e}=ce(),{data:t}=lp(),s=cp(),l=hp(),[m,v]=k.useState(!1),[C,r]=k.useState(null),i=k.useRef(null),[c,f]=k.useState({top:0,right:0}),[o,p]=k.useState(!1),x=t?.running??!1,S=s.isPending,g=t?.shareableUrl,n=t?.token;k.useEffect(()=>{if(m&&i.current){const y=i.current.getBoundingClientRect();f({top:y.bottom+8,right:window.innerWidth-y.right})}},[m]);const d=k.useCallback(()=>{x?v(!0):s.mutate(void 0,{onSuccess:()=>v(!0)})},[x,s]),h=k.useCallback(()=>{g&&(navigator.clipboard.writeText(g),r("url"),setTimeout(()=>r(null),2e3))},[g]),u=k.useCallback(()=>{n&&(navigator.clipboard.writeText(n),r("token"),setTimeout(()=>r(null),2e3))},[n]),_=k.useCallback(()=>{l.mutate(),v(!1),p(!1)},[l]);return a.jsxs("div",{className:"relative",children:[a.jsx("button",{ref:i,onClick:d,disabled:S,className:`p-1.5 rounded-md transition-colors ${x?"text-emerald-600 hover:bg-emerald-50":"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100"}`,title:e(x?"Tunnel active":"Share via tunnel"),children:S?a.jsx(ze,{size:16,className:"animate-spin"}):a.jsx(Is,{size:16})}),x&&!S&&a.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),m&&x&&Nt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>v(!1)}),a.jsxs("div",{className:"fixed z-[101] w-80 bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:c.top,right:c.right},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),e("Tunnel Active")]}),a.jsx("button",{onClick:()=>v(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:a.jsx(Fs,{size:14})})]}),n&&a.jsxs("div",{className:"flex items-center gap-1.5 mb-2 px-2 py-1 bg-emerald-50 rounded text-xs text-emerald-700",children:[a.jsx(vl,{size:12}),a.jsx("span",{children:e("Token protected")})]}),g&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsx(Vo,{value:g,size:160})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{readOnly:!0,value:g??t?.url??"",className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-700 select-all",onFocus:y=>y.target.select()}),a.jsx("button",{onClick:h,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:e("Copy shareable link"),children:C==="url"?a.jsx(ss,{size:14,className:"text-emerald-500"}):a.jsx(ui,{size:14})})]}),n&&a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{onClick:()=>p(!o),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:e(o?"Hide token":"Show token")}),o&&a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("code",{className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-600 break-all",children:n}),a.jsx("button",{onClick:u,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:e("Copy token"),children:C==="token"?a.jsx(ss,{size:14,className:"text-emerald-500"}):a.jsx(ui,{size:14})})]})]}),a.jsx("button",{onClick:_,disabled:l.isPending,className:"mt-2 w-full px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 rounded-md transition-colors",children:l.isPending?e("Stopping..."):e("Stop Tunnel")})]})]}),document.body)]})}const nn={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Gt=k.lazy(()=>cn(()=>import("./modal-wSbeXj_V.js").then(e=>e.m),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.Modal}))),gr=k.lazy(()=>cn(()=>import("./folder-picker-Dl5GZRtL.js"),__vite__mapDeps([4,1,2,3,5,6,7,8])).then(e=>({default:e.FolderPicker}))),on=a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-900",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),a.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),an=a.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),up=260,dp=600,ln=400;function Dp(){const{t:e}=ce(),[t,s]=k.useState(null),[l,m]=k.useState(null),[v,C]=k.useState(ln),[r,i]=k.useState(!1),[c,f]=k.useState(!1),[o,p]=k.useState(""),[x,S]=k.useState(""),[g,n]=k.useState(""),[d,h]=k.useState(""),[u,_]=k.useState(""),[y,w]=k.useState(""),[E,b]=k.useState("idle"),{files:R,addFiles:j,removeFile:M,clear:L,buildMarkdownLinks:T,isUploading:B}=Zr(),I=k.useRef(null),H=k.useRef(!1),W=k.useRef(0),A=k.useRef(ln),N=k.useRef(null),P=We(),{data:O,isLoading:$}=Hs(),{data:X,isLoading:K}=ba(),Q=k.useMemo(()=>X?.data??[],[X?.data]),se=k.useMemo(()=>Q.map(km),[Q]),D=l&&Q.some(q=>q.id===l)?l:null,{data:F,isLoading:U}=Of(D??""),z=Da({queries:D?[]:Q.map(q=>({queryKey:ae.tasks.list(q.id),queryFn:()=>fe.get(`/projects/${q.id}/tasks`,{params:{limit:"500"}})}))}),te=!D&&z.some(q=>q.isLoading),Y=k.useMemo(()=>{if(D)return F?.data??[];const q=[];for(const J of z)J.data?.data&&q.push(...J.data.data);return q},[D,F,z]),ie=t&&Y.some(q=>q.id===t)?t:null,ge=k.useMemo(()=>{const q=new Map;for(const J of Y){const he=J.createdAt?new Date(J.createdAt).getTime():0,ue=q.get(J.projectId)??0;he>ue&&q.set(J.projectId,he)}return[...Q].sort((J,he)=>{const ue=q.get(J.id)??(J.createdAt?new Date(J.createdAt).getTime():0);return(q.get(he.id)??(he.createdAt?new Date(he.createdAt).getTime():0))-ue})},[Q,Y]),me=k.useMemo(()=>ge.filter(q=>!q.archivedAt),[ge]),Me=k.useMemo(()=>{if(!O)return[];const q=localStorage.getItem("providerUsageCount"),J=q?JSON.parse(q):{};return[...O].sort((he,ue)=>{const ve=he.availability.type!=="NOT_FOUND",Ae=ue.availability.type!=="NOT_FOUND";if(ve!==Ae)return ve?-1:1;const mt=J[he.provider.id]??0;return(J[ue.provider.id]??0)-mt})},[O]),re=k.useMemo(()=>Y.map(Dm),[Y]),Be=k.useMemo(()=>new Set,[]),Ce=k.useMemo(()=>{if(!ie)return null;const q=Y.find(he=>he.id===ie);if(!q)return null;const J=Q.find(he=>he.id===q.projectId);if(!J){const he=q.workspaces?.find(ue=>ue.status==="ACTIVE")?.branchName??q.workspaces?.[0]?.branchName??"—";return{id:q.id,projectId:q.projectId,projectName:"Unknown",projectColor:"text-neutral-500",title:q.title,status:Jr(q.status),branch:he,mainBranch:"main",description:q.description??"",projectArchivedAt:null,projectRepoDeletedAt:null}}return Am(q,J)},[ie,Y,Q]),oe=xa(),Ne=Bf(u),qe=Ff(),Re=If(),Ve=k.useCallback(q=>{qe.mutate(q,{onSuccess:()=>{ie===q&&s(null),P.invalidateQueries({queryKey:ae.tasks.all})}})},[qe,ie,P]),be=k.useCallback((q,J)=>{Re.mutate({id:q,status:wm(J)},{onError:()=>{ni.error(e("状态变更失败,该操作不被允许"))}})},[Re,e]),st=k.useCallback(q=>{q.preventDefault(),H.current=!0,W.current=q.clientX,A.current=v,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[v]);k.useEffect(()=>{const q=he=>{if(!H.current)return;const ue=he.clientX-W.current,ve=Math.max(up,Math.min(dp,A.current+ue));C(ve)},J=()=>{H.current&&(H.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",J),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",J)}},[]);const Ke=k.useCallback(()=>{i(!0)},[]),Pe=k.useCallback(()=>{if(me.length===0){ni.error(e("没有可用项目,请先创建或恢复项目"));return}const q=localStorage.getItem("lastSelectedProjectId"),J=localStorage.getItem("lastSelectedProviderId"),he=q&&me.find(Ae=>Ae.id===q)?q:(D&&me.find(Ae=>Ae.id===D)?.id)??me[0]?.id??"";_(he);const ue=Me?.find(Ae=>Ae.availability.type!=="NOT_FOUND"),ve=J&&Me?.find(Ae=>Ae.provider.id===J&&Ae.availability.type!=="NOT_FOUND")?J:ue?.provider.id??"";w(ve),b("idle"),f(!0)},[me,D,Me,e]),Oe=k.useCallback(()=>{i(!1),p(""),S("")},[]),De=k.useCallback(()=>{E==="idle"&&(f(!1),n(""),h(""),_(""),w(""),b("idle"),L())},[E,L]),V=k.useCallback(async()=>{if(!(!o.trim()||!x.trim()))try{await oe.mutateAsync({name:o.trim(),repoPath:x.trim()}),Oe()}catch{}},[o,x,oe,Oe]),Z=Gr(),xe=k.useCallback(async()=>{if(!(!g.trim()||!u))try{const q=T(),J=[d.trim(),q].filter(Boolean).join(`
|
|
83
|
+
`);i(""),re(),d.current&&(d.current.style.height="40px"),Q.mutate({id:M,message:Z,providerId:A??void 0},{onSuccess:()=>Y(),onSettled:()=>{Re.current=!1}})},[r,M,Q,Y,Ce,oe,Be,re,A]),be=k.useCallback(async()=>{M&&(await D.mutateAsync(M),E.invalidateQueries({queryKey:["workspaces"]}))},[M,D,E]),st=k.useCallback(V=>{const Z=V.target.files;Z&&Z.length>0&&me(Array.from(Z)),V.target.value=""},[me]),Ke=k.useCallback(V=>{const Z=V.clipboardData.items,xe=[];for(const Se of Z)if(Se.kind==="file"){const He=Se.getAsFile();He&&xe.push(He)}xe.length>0&&(V.preventDefault(),me(xe))},[me]),Pe=k.useCallback(V=>{i(V.target.value);const Z=V.target;Z.style.height="auto",Z.style.height=`${Math.max(40,Math.min(Z.scrollHeight,140))}px`},[]),Oe=k.useCallback(()=>{X&&se.mutate({workspaceId:X})},[X,se]),De=k.useRef(null);return k.useEffect(()=>{const V=window.visualViewport;if(!V)return;let Z=!1;const xe=()=>{De.current&&(De.current.style.height=`${V.height}px`,De.current.style.top=`${V.offsetTop}px`)},Se=()=>xe(),He=()=>{Z||xe()},Xe=()=>{Z=!0},pe=()=>{Z=!1,requestAnimationFrame(xe)};return V.addEventListener("resize",Se),V.addEventListener("scroll",He),document.addEventListener("touchstart",Xe,{passive:!0}),document.addEventListener("touchend",pe,{passive:!0}),document.addEventListener("touchcancel",pe,{passive:!0}),()=>{V.removeEventListener("resize",Se),V.removeEventListener("scroll",He),document.removeEventListener("touchstart",Xe),document.removeEventListener("touchend",pe),document.removeEventListener("touchcancel",pe)}},[]),k.useEffect(()=>{const V=De.current;if(!V)return;const Z=xe=>{let Se=xe.target;for(;Se&&Se!==V;){if(Se.tagName==="TEXTAREA"){if(Se.scrollHeight>Se.clientHeight)return;Se=Se.parentElement;continue}const Xe=window.getComputedStyle(Se).overflowY;if((Xe==="auto"||Xe==="scroll")&&Se.scrollHeight>Se.clientHeight)return;Se=Se.parentElement}xe.preventDefault()};return V.addEventListener("touchmove",Z,{passive:!1}),()=>V.removeEventListener("touchmove",Z)},[]),a.jsxs("div",{ref:De,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[a.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[a.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[a.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:a.jsx(_a,{size:18})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),a.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[a.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),e.projectArchivedAt&&a.jsx("span",{className:"rounded-full bg-neutral-100 px-1.5 py-0.5 text-[10px] font-medium text-neutral-500",children:e.projectRepoDeletedAt?m("源码已删除"):m("已删除")}),a.jsx("span",{className:"text-neutral-300",children:"/"}),a.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),a.jsx(Gm,{status:e.status}),a.jsx("button",{onClick:Oe,disabled:!X||T,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:a.jsx(zs,{size:16})}),s&&!T&&a.jsxs("div",{className:"relative",ref:n,children:[a.jsx("button",{onClick:()=>S(V=>!V),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:a.jsx(yn,{size:16})}),x&&a.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:a.jsxs("button",{onClick:()=>{p(!0),S(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 active:bg-red-50",children:[a.jsx(vn,{size:15}),a.jsx("span",{children:m("删除任务")})]})})]})]}),a.jsx("div",{className:"flex border-t border-neutral-100",children:Qm.map(({key:V,label:Z,icon:xe})=>a.jsxs("button",{onClick:()=>C(V),className:`flex-1 flex items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors ${v===V?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[a.jsx(xe,{size:13}),a.jsx("span",{children:Z})]},V))})]}),v==="chat"&&a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:u,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:a.jsxs("div",{ref:_,children:[a.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:e.description?a.jsx("div",{className:"text-[13px] text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:a.jsx(dn,{urlTransform:Xm,components:Vm,children:e.description})}):a.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),R?a.jsx(tn,{label:"Loading..."}):M?q?a.jsx(tn,{label:"Loading logs..."}):z.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:L?"Waiting for agent output...":"No logs recorded."}):a.jsx(fn,{logs:z}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:a.jsx(Ot,{size:20,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:m("尚未启动 Agent")}),a.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:T?I:m("选择一个 Agent 来执行此任务")}),!T&&a.jsxs(dt,{onClick:()=>f(!0),children:[a.jsx(Ot,{size:16,className:"mr-1.5"}),m("启动 Agent")]})]})]})}),!y&&a.jsxs("button",{onClick:()=>w(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":"Scroll to bottom",children:[a.jsx(bn,{size:12}),a.jsx("span",{children:m("回到底部")})]})]}),ie.length>0&&a.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:a.jsx(mn,{todos:ie,compact:!0})}),T?a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsx("div",{className:"rounded-xl border border-neutral-200 bg-neutral-50 px-3 py-2 text-xs text-neutral-500",children:I})}):H?a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-neutral-200 bg-neutral-50 px-3 py-2",children:[a.jsx("span",{className:"text-xs text-neutral-500",children:m("代码已合并,以上为历史沟通记录")}),a.jsxs(dt,{size:"sm",onClick:()=>f(!0),children:[a.jsx(Ot,{size:14,className:"mr-1.5"}),m("启动新 Agent")]})]})}):M&&a.jsxs("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:[a.jsxs("div",{ref:g,className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[a.jsx(Ns,{files:ge,onRemove:Me}),a.jsx("textarea",{ref:d,value:r,onChange:Pe,onPaste:Ke,onKeyDown:V=>{$.handleKeyDown(V)||O.handleKeyDown(V)||V.key==="Enter"&&!V.shiftKey&&!V.repeat&&!V.nativeEvent.isComposing&&V.nativeEvent.keyCode!==229&&(V.preventDefault(),Ve())},rows:1,placeholder:L?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-neutral-900 placeholder-neutral-400",style:{minHeight:40,maxHeight:140}}),a.jsx("input",{ref:h,type:"file",multiple:!0,className:"hidden",onChange:st}),a.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[a.jsx("div",{className:"flex items-center gap-0.5",children:a.jsx("button",{onClick:()=>h.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:a.jsx(ws,{size:15})})}),a.jsxs("div",{className:"flex items-center gap-1",children:[j&&W&&a.jsx(jo,{providers:W,currentProviderId:A,agentType:j.agentType,onSelect:N}),a.jsx(Kn,{usage:qe}),L&&!r.trim()&&!Ce?a.jsx("button",{onClick:be,disabled:D.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:a.jsx(pn,{size:12})}):a.jsx("button",{onClick:Ve,disabled:!r.trim()&&!Ce||oe,className:`p-1.5 rounded-lg transition-colors ${(r.trim()||Ce)&&!oe?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:a.jsx(Sn,{size:15})})]})]})]}),a.jsx(Ps,{open:O.query!==null,anchorRef:g,commands:O.filteredCommands,selectedIndex:O.selectedIndex,query:O.query??"",hasCatalog:O.allCommands.length>0,compact:!0,onSelect:O.applyCommand}),a.jsx(Ps,{open:$.query!==null,anchorRef:g,commands:$.filteredSkills,selectedIndex:$.selectedIndex,query:$.query??"",hasCatalog:$.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",compact:!0,onSelect:$.applySkill})]})]}),v==="changes"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(Im,{workingDir:P})}),v==="history"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(qm,{workingDir:P})}),v==="workspace"&&a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(Co,{sessionId:M||void 0,workingDir:P,projectId:e.projectId,className:"h-full",hideChanges:!0,readOnly:T,repoDeleted:B})}),!T&&a.jsx(Ao,{isOpen:c,onClose:()=>f(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),a.jsx(Sr,{isOpen:o,onClose:()=>p(!1),onConfirm:()=>{s?.(e.id),p(!1)},title:m("删除任务"),description:a.jsxs(a.Fragment,{children:[a.jsx("p",{children:m("确认删除任务「{title}」?此操作不可撤销。",{title:e.title})}),K.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:K.map((V,Z)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[a.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),a.jsx("span",{children:V})]},Z))})]}),confirmText:m("删除"),variant:"danger",isLoading:l})]})}function tn({label:e}){return a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:e})]})}var Jm=Object.defineProperty,Bs=Object.getOwnPropertySymbols,Io=Object.prototype.hasOwnProperty,Fo=Object.prototype.propertyIsEnumerable,sn=(e,t,s)=>t in e?Jm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ar=(e,t)=>{for(var s in t||(t={}))Io.call(t,s)&&sn(e,s,t[s]);if(Bs)for(var s of Bs(t))Fo.call(t,s)&&sn(e,s,t[s]);return e},jr=(e,t)=>{var s={};for(var l in e)Io.call(e,l)&&t.indexOf(l)<0&&(s[l]=e[l]);if(e!=null&&Bs)for(var l of Bs(e))t.indexOf(l)<0&&Fo.call(e,l)&&(s[l]=e[l]);return s};var It;(e=>{const t=class de{constructor(i,c,f,o){if(this.version=i,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],i<de.MIN_VERSION||i>de.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let p=[];for(let S=0;S<this.size;S++)p.push(!1);for(let S=0;S<this.size;S++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const x=this.addEccAndInterleave(f);if(this.drawCodewords(x),o==-1){let S=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const n=this.getPenaltyScore();n<S&&(o=g,S=n),this.applyMask(g)}}m(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,c){const f=e.QrSegment.makeSegments(i);return de.encodeSegments(f,c)}static encodeBinary(i,c){const f=e.QrSegment.makeBytes(i);return de.encodeSegments([f],c)}static encodeSegments(i,c,f=1,o=40,p=-1,x=!0){if(!(de.MIN_VERSION<=f&&f<=o&&o<=de.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let S,g;for(S=f;;S++){const u=de.getNumDataCodewords(S,c)*8,_=C.getTotalBits(i,S);if(_<=u){g=_;break}if(S>=o)throw new RangeError("Data too long")}for(const u of[de.Ecc.MEDIUM,de.Ecc.QUARTILE,de.Ecc.HIGH])x&&g<=de.getNumDataCodewords(S,u)*8&&(c=u);let n=[];for(const u of i){s(u.mode.modeBits,4,n),s(u.numChars,u.mode.numCharCountBits(S),n);for(const _ of u.getData())n.push(_)}m(n.length==g);const d=de.getNumDataCodewords(S,c)*8;m(n.length<=d),s(0,Math.min(4,d-n.length),n),s(0,(8-n.length%8)%8,n),m(n.length%8==0);for(let u=236;n.length<d;u^=253)s(u,8,n);let h=[];for(;h.length*8<n.length;)h.push(0);return n.forEach((u,_)=>h[_>>>3]|=u<<7-(_&7)),new de(S,c,h,p)}getModule(i,c){return 0<=i&&i<this.size&&0<=c&&c<this.size&&this.modules[c][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let f=0;f<this.size;f++)this.setFunctionModule(6,f,f%2==0),this.setFunctionModule(f,6,f%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),c=i.length;for(let f=0;f<c;f++)for(let o=0;o<c;o++)f==0&&o==0||f==0&&o==c-1||f==c-1&&o==0||this.drawAlignmentPattern(i[f],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const c=this.errorCorrectionLevel.formatBits<<3|i;let f=c;for(let p=0;p<10;p++)f=f<<1^(f>>>9)*1335;const o=(c<<10|f)^21522;m(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,l(o,p));this.setFunctionModule(8,7,l(o,6)),this.setFunctionModule(8,8,l(o,7)),this.setFunctionModule(7,8,l(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,l(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,l(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,l(o,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let f=0;f<12;f++)i=i<<1^(i>>>11)*7973;const c=this.version<<12|i;m(c>>>18==0);for(let f=0;f<18;f++){const o=l(c,f),p=this.size-11+f%3,x=Math.floor(f/3);this.setFunctionModule(p,x,o),this.setFunctionModule(x,p,o)}}drawFinderPattern(i,c){for(let f=-4;f<=4;f++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(f)),x=i+o,S=c+f;0<=x&&x<this.size&&0<=S&&S<this.size&&this.setFunctionModule(x,S,p!=2&&p!=4)}}drawAlignmentPattern(i,c){for(let f=-2;f<=2;f++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,c+f,Math.max(Math.abs(o),Math.abs(f))!=1)}setFunctionModule(i,c,f){this.modules[c][i]=f,this.isFunction[c][i]=!0}addEccAndInterleave(i){const c=this.version,f=this.errorCorrectionLevel;if(i.length!=de.getNumDataCodewords(c,f))throw new RangeError("Invalid argument");const o=de.NUM_ERROR_CORRECTION_BLOCKS[f.ordinal][c],p=de.ECC_CODEWORDS_PER_BLOCK[f.ordinal][c],x=Math.floor(de.getNumRawDataModules(c)/8),S=o-x%o,g=Math.floor(x/o);let n=[];const d=de.reedSolomonComputeDivisor(p);for(let u=0,_=0;u<o;u++){let y=i.slice(_,_+g-p+(u<S?0:1));_+=y.length;const w=de.reedSolomonComputeRemainder(y,d);u<S&&y.push(0),n.push(y.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((_,y)=>{(u!=g-p||y>=S)&&h.push(_[u])});return m(h.length==x),h}drawCodewords(i){if(i.length!=Math.floor(de.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let f=this.size-1;f>=1;f-=2){f==6&&(f=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const x=f-p,g=(f+1&2)==0?this.size-1-o:o;!this.isFunction[g][x]&&c<i.length*8&&(this.modules[g][x]=l(i[c>>>3],7-(c&7)),c++)}}m(c==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let f=0;f<this.size;f++){let o;switch(i){case 0:o=(f+c)%2==0;break;case 1:o=c%2==0;break;case 2:o=f%3==0;break;case 3:o=(f+c)%3==0;break;case 4:o=(Math.floor(f/3)+Math.floor(c/2))%2==0;break;case 5:o=f*c%2+f*c%3==0;break;case 6:o=(f*c%2+f*c%3)%2==0;break;case 7:o=((f+c)%2+f*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][f]&&o&&(this.modules[c][f]=!this.modules[c][f])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let x=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==x?(S++,S==5?i+=de.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),x||(i+=this.finderPenaltyCountPatterns(g)*de.PENALTY_N3),x=this.modules[p][n],S=1);i+=this.finderPenaltyTerminateAndCount(x,S,g)*de.PENALTY_N3}for(let p=0;p<this.size;p++){let x=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==x?(S++,S==5?i+=de.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),x||(i+=this.finderPenaltyCountPatterns(g)*de.PENALTY_N3),x=this.modules[n][p],S=1);i+=this.finderPenaltyTerminateAndCount(x,S,g)*de.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let x=0;x<this.size-1;x++){const S=this.modules[p][x];S==this.modules[p][x+1]&&S==this.modules[p+1][x]&&S==this.modules[p+1][x+1]&&(i+=de.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((x,S)=>x+(S?1:0),c);const f=this.size*this.size,o=Math.ceil(Math.abs(c*20-f*10)/f)-1;return m(0<=o&&o<=9),i+=o*de.PENALTY_N4,m(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let f=[6];for(let o=this.size-7;f.length<i;o-=c)f.splice(1,0,o);return f}}static getNumRawDataModules(i){if(i<de.MIN_VERSION||i>de.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*i+128)*i+64;if(i>=2){const f=Math.floor(i/7)+2;c-=(25*f-10)*f-55,i>=7&&(c-=36)}return m(208<=c&&c<=29648),c}static getNumDataCodewords(i,c){return Math.floor(de.getNumRawDataModules(i)/8)-de.ECC_CODEWORDS_PER_BLOCK[c.ordinal][i]*de.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let c=[];for(let o=0;o<i-1;o++)c.push(0);c.push(1);let f=1;for(let o=0;o<i;o++){for(let p=0;p<c.length;p++)c[p]=de.reedSolomonMultiply(c[p],f),p+1<c.length&&(c[p]^=c[p+1]);f=de.reedSolomonMultiply(f,2)}return c}static reedSolomonComputeRemainder(i,c){let f=c.map(o=>0);for(const o of i){const p=o^f.shift();f.push(0),c.forEach((x,S)=>f[S]^=de.reedSolomonMultiply(x,p))}return f}static reedSolomonMultiply(i,c){if(i>>>8||c>>>8)throw new RangeError("Byte out of range");let f=0;for(let o=7;o>=0;o--)f=f<<1^(f>>>7)*285,f^=(c>>>o&1)*i;return m(f>>>8==0),f}finderPenaltyCountPatterns(i){const c=i[1];m(c<=this.size*3);const f=c>0&&i[2]==c&&i[3]==c*3&&i[4]==c&&i[5]==c;return(f&&i[0]>=c*4&&i[6]>=c?1:0)+(f&&i[6]>=c*4&&i[0]>=c?1:0)}finderPenaltyTerminateAndCount(i,c,f){return i&&(this.finderPenaltyAddHistory(c,f),c=0),c+=this.size,this.finderPenaltyAddHistory(c,f),this.finderPenaltyCountPatterns(f)}finderPenaltyAddHistory(i,c){c[0]==0&&(i+=this.size),c.pop(),c.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function s(r,i,c){if(i<0||i>31||r>>>i)throw new RangeError("Value out of range");for(let f=i-1;f>=0;f--)c.push(r>>>f&1)}function l(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const v=class Ie{constructor(i,c,f){if(this.mode=i,this.numChars=c,this.bitData=f,c<0)throw new RangeError("Invalid argument");this.bitData=f.slice()}static makeBytes(i){let c=[];for(const f of i)s(f,8,c);return new Ie(Ie.Mode.BYTE,i.length,c)}static makeNumeric(i){if(!Ie.isNumeric(i))throw new RangeError("String contains non-numeric characters");let c=[];for(let f=0;f<i.length;){const o=Math.min(i.length-f,3);s(parseInt(i.substring(f,f+o),10),o*3+1,c),f+=o}return new Ie(Ie.Mode.NUMERIC,i.length,c)}static makeAlphanumeric(i){if(!Ie.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],f;for(f=0;f+2<=i.length;f+=2){let o=Ie.ALPHANUMERIC_CHARSET.indexOf(i.charAt(f))*45;o+=Ie.ALPHANUMERIC_CHARSET.indexOf(i.charAt(f+1)),s(o,11,c)}return f<i.length&&s(Ie.ALPHANUMERIC_CHARSET.indexOf(i.charAt(f)),6,c),new Ie(Ie.Mode.ALPHANUMERIC,i.length,c)}static makeSegments(i){return i==""?[]:Ie.isNumeric(i)?[Ie.makeNumeric(i)]:Ie.isAlphanumeric(i)?[Ie.makeAlphanumeric(i)]:[Ie.makeBytes(Ie.toUtf8ByteArray(i))]}static makeEci(i){let c=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)s(i,8,c);else if(i<16384)s(2,2,c),s(i,14,c);else if(i<1e6)s(6,3,c),s(i,21,c);else throw new RangeError("ECI assignment value out of range");return new Ie(Ie.Mode.ECI,0,c)}static isNumeric(i){return Ie.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Ie.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,c){let f=0;for(const o of i){const p=o.mode.numCharCountBits(c);if(o.numChars>=1<<p)return 1/0;f+=4+p+o.bitData.length}return f}static toUtf8ByteArray(i){i=encodeURI(i);let c=[];for(let f=0;f<i.length;f++)i.charAt(f)!="%"?c.push(i.charCodeAt(f)):(c.push(parseInt(i.substring(f+1,f+3),16)),f+=2);return c}};v.NUMERIC_REGEX=/^[0-9]*$/,v.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,v.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=v;e.QrSegment=v})(It||(It={}));(e=>{(t=>{const s=class{constructor(m,v){this.ordinal=m,this.formatBits=v}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),t.Ecc=s})(e.QrCode||(e.QrCode={}))})(It||(It={}));(e=>{(t=>{const s=class{constructor(m,v){this.modeBits=m,this.numBitsCharCount=v}numCharCountBits(m){return this.numBitsCharCount[Math.floor((m+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),t.Mode=s})(e.QrSegment||(e.QrSegment={}))})(It||(It={}));var $t=It;var ep={L:$t.QrCode.Ecc.LOW,M:$t.QrCode.Ecc.MEDIUM,Q:$t.QrCode.Ecc.QUARTILE,H:$t.QrCode.Ecc.HIGH},Ho=128,zo="L",Wo="#FFFFFF",$o="#000000",Uo=!1,qo=1,tp=4,sp=0,rp=.1;function Ko(e,t=0){const s=[];return e.forEach(function(l,m){let v=null;l.forEach(function(C,r){if(!C&&v!==null){s.push(`M${v+t} ${m+t}h${r-v}v1H${v+t}z`),v=null;return}if(r===l.length-1){if(!C)return;v===null?s.push(`M${r+t},${m+t} h1v1H${r+t}z`):s.push(`M${v+t},${m+t} h${r+1-v}v1H${v+t}z`);return}C&&v===null&&(v=r)})}),s.join("")}function Xo(e,t){return e.slice().map((s,l)=>l<t.y||l>=t.y+t.h?s:s.map((m,v)=>v<t.x||v>=t.x+t.w?m:!1))}function ip(e,t,s,l){if(l==null)return null;const m=e.length+s*2,v=Math.floor(t*rp),C=m/t,r=(l.width||v)*C,i=(l.height||v)*C,c=l.x==null?e.length/2-r/2:l.x*C,f=l.y==null?e.length/2-i/2:l.y*C,o=l.opacity==null?1:l.opacity;let p=null;if(l.excavate){let S=Math.floor(c),g=Math.floor(f),n=Math.ceil(r+c-S),d=Math.ceil(i+f-g);p={x:S,y:g,w:n,h:d}}const x=l.crossOrigin;return{x:c,y:f,h:i,w:r,excavation:p,opacity:o,crossOrigin:x}}function np(e,t){return t!=null?Math.max(Math.floor(t),0):e?tp:sp}function Yo({value:e,level:t,minVersion:s,includeMargin:l,marginSize:m,imageSettings:v,size:C,boostLevel:r}){let i=ee.useMemo(()=>{const S=(Array.isArray(e)?e:[e]).reduce((g,n)=>(g.push(...$t.QrSegment.makeSegments(n)),g),[]);return $t.QrCode.encodeSegments(S,ep[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:c,margin:f,numCells:o,calculatedImageSettings:p}=ee.useMemo(()=>{let x=i.getModules();const S=np(l,m),g=x.length+S*2,n=ip(x,C,S,v);return{cells:x,margin:S,numCells:g,calculatedImageSettings:n}},[i,C,v,l,m]);return{qrcode:i,margin:f,cells:c,numCells:o,calculatedImageSettings:p}}var op=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),ap=ee.forwardRef(function(t,s){const l=t,{value:m,size:v=Ho,level:C=zo,bgColor:r=Wo,fgColor:i=$o,includeMargin:c=Uo,minVersion:f=qo,boostLevel:o,marginSize:p,imageSettings:x}=l,g=jr(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=g,d=jr(g,["style"]),h=x?.src,u=ee.useRef(null),_=ee.useRef(null),y=ee.useCallback(B=>{u.current=B,typeof s=="function"?s(B):s&&(s.current=B)},[s]),[w,E]=ee.useState(!1),{margin:b,cells:R,numCells:j,calculatedImageSettings:M}=Yo({value:m,level:C,minVersion:f,boostLevel:o,includeMargin:c,marginSize:p,imageSettings:x,size:v});ee.useEffect(()=>{if(u.current!=null){const B=u.current,I=B.getContext("2d");if(!I)return;let H=R;const W=_.current,A=M!=null&&W!==null&&W.complete&&W.naturalHeight!==0&&W.naturalWidth!==0;A&&M.excavation!=null&&(H=Xo(R,M.excavation));const N=window.devicePixelRatio||1;B.height=B.width=v*N;const P=v/j*N;I.scale(P,P),I.fillStyle=r,I.fillRect(0,0,j,j),I.fillStyle=i,op?I.fill(new Path2D(Ko(H,b))):R.forEach(function(O,$){O.forEach(function(X,K){X&&I.fillRect(K+b,$+b,1,1)})}),M&&(I.globalAlpha=M.opacity),A&&I.drawImage(W,M.x+b,M.y+b,M.w,M.h)}}),ee.useEffect(()=>{E(!1)},[h]);const L=Ar({height:v,width:v},n);let T=null;return h!=null&&(T=ee.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{E(!0)},ref:_,crossOrigin:M?.crossOrigin})),ee.createElement(ee.Fragment,null,ee.createElement("canvas",Ar({style:L,height:v,width:v,ref:y,role:"img"},d)),T)});ap.displayName="QRCodeCanvas";var Vo=ee.forwardRef(function(t,s){const l=t,{value:m,size:v=Ho,level:C=zo,bgColor:r=Wo,fgColor:i=$o,includeMargin:c=Uo,minVersion:f=qo,boostLevel:o,title:p,marginSize:x,imageSettings:S}=l,g=jr(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:d,numCells:h,calculatedImageSettings:u}=Yo({value:m,level:C,minVersion:f,boostLevel:o,includeMargin:c,marginSize:x,imageSettings:S,size:v});let _=d,y=null;S!=null&&u!=null&&(u.excavation!=null&&(_=Xo(d,u.excavation)),y=ee.createElement("image",{href:S.src,height:u.h,width:u.w,x:u.x+n,y:u.y+n,preserveAspectRatio:"none",opacity:u.opacity,crossOrigin:u.crossOrigin}));const w=Ko(_,n);return ee.createElement("svg",Ar({height:v,width:v,viewBox:`0 0 ${h} ${h}`,ref:s,role:"img"},g),!!p&&ee.createElement("title",null,p),ee.createElement("path",{fill:r,d:`M0,0 h${h}v${h}H0z`,shapeRendering:"crispEdges"}),ee.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),y)});Vo.displayName="QRCodeSVG";function lp(){return ht({queryKey:ae.tunnel.status,queryFn:()=>fe.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function cp(){const e=We();return Ze({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return fe.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:ae.tunnel.status})}})}function hp(){const e=We();return Ze({mutationFn:()=>fe.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:ae.tunnel.status})}})}function rn(){const{t:e}=ce(),{data:t}=lp(),s=cp(),l=hp(),[m,v]=k.useState(!1),[C,r]=k.useState(null),i=k.useRef(null),[c,f]=k.useState({top:0,right:0}),[o,p]=k.useState(!1),x=t?.running??!1,S=s.isPending,g=t?.shareableUrl,n=t?.token;k.useEffect(()=>{if(m&&i.current){const y=i.current.getBoundingClientRect();f({top:y.bottom+8,right:window.innerWidth-y.right})}},[m]);const d=k.useCallback(()=>{x?v(!0):s.mutate(void 0,{onSuccess:()=>v(!0)})},[x,s]),h=k.useCallback(()=>{g&&(navigator.clipboard.writeText(g),r("url"),setTimeout(()=>r(null),2e3))},[g]),u=k.useCallback(()=>{n&&(navigator.clipboard.writeText(n),r("token"),setTimeout(()=>r(null),2e3))},[n]),_=k.useCallback(()=>{l.mutate(),v(!1),p(!1)},[l]);return a.jsxs("div",{className:"relative",children:[a.jsx("button",{ref:i,onClick:d,disabled:S,className:`p-1.5 rounded-md transition-colors ${x?"text-emerald-600 hover:bg-emerald-50":"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100"}`,title:e(x?"Tunnel active":"Share via tunnel"),children:S?a.jsx(ze,{size:16,className:"animate-spin"}):a.jsx(Is,{size:16})}),x&&!S&&a.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),m&&x&&Nt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>v(!1)}),a.jsxs("div",{className:"fixed z-[101] w-80 bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:c.top,right:c.right},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),e("Tunnel Active")]}),a.jsx("button",{onClick:()=>v(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:a.jsx(Fs,{size:14})})]}),n&&a.jsxs("div",{className:"flex items-center gap-1.5 mb-2 px-2 py-1 bg-emerald-50 rounded text-xs text-emerald-700",children:[a.jsx(vl,{size:12}),a.jsx("span",{children:e("Token protected")})]}),g&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsx(Vo,{value:g,size:160})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{readOnly:!0,value:g??t?.url??"",className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-700 select-all",onFocus:y=>y.target.select()}),a.jsx("button",{onClick:h,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:e("Copy shareable link"),children:C==="url"?a.jsx(ss,{size:14,className:"text-emerald-500"}):a.jsx(ui,{size:14})})]}),n&&a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{onClick:()=>p(!o),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:e(o?"Hide token":"Show token")}),o&&a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("code",{className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-600 break-all",children:n}),a.jsx("button",{onClick:u,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:e("Copy token"),children:C==="token"?a.jsx(ss,{size:14,className:"text-emerald-500"}):a.jsx(ui,{size:14})})]})]}),a.jsx("button",{onClick:_,disabled:l.isPending,className:"mt-2 w-full px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 rounded-md transition-colors",children:l.isPending?e("Stopping..."):e("Stop Tunnel")})]})]}),document.body)]})}const nn={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Gt=k.lazy(()=>cn(()=>import("./modal-BgEFLccc.js").then(e=>e.m),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.Modal}))),_r=k.lazy(()=>cn(()=>import("./folder-picker-C45cXliN.js"),__vite__mapDeps([4,1,2,3,5,6,7,8])).then(e=>({default:e.FolderPicker}))),on=a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-900",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),a.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),an=a.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),up=260,dp=600,ln=400;function Dp(){const{t:e}=ce(),[t,s]=k.useState(null),[l,m]=k.useState(null),[v,C]=k.useState(ln),[r,i]=k.useState(!1),[c,f]=k.useState(!1),[o,p]=k.useState(""),[x,S]=k.useState(""),[g,n]=k.useState(""),[d,h]=k.useState(""),[u,_]=k.useState(""),[y,w]=k.useState(""),[E,b]=k.useState("idle"),{files:R,addFiles:j,removeFile:M,clear:L,buildMarkdownLinks:T,isUploading:B}=Jr(),I=k.useRef(null),H=k.useRef(!1),W=k.useRef(0),A=k.useRef(ln),N=k.useRef(null),P=We(),{data:O,isLoading:$}=Hs(),{data:X,isLoading:K}=ba(),Q=k.useMemo(()=>X?.data??[],[X?.data]),se=k.useMemo(()=>Q.map(km),[Q]),D=l&&Q.some(U=>U.id===l)?l:null,{data:F,isLoading:q}=Of(D??""),z=Da({queries:D?[]:Q.map(U=>({queryKey:ae.tasks.list(U.id),queryFn:()=>fe.get(`/projects/${U.id}/tasks`,{params:{limit:"500"}})}))}),te=!D&&z.some(U=>U.isLoading),Y=k.useMemo(()=>{if(D)return F?.data??[];const U=[];for(const J of z)J.data?.data&&U.push(...J.data.data);return U},[D,F,z]),ie=t&&Y.some(U=>U.id===t)?t:null,ge=k.useMemo(()=>{const U=new Map;for(const J of Y){const he=J.createdAt?new Date(J.createdAt).getTime():0,ue=U.get(J.projectId)??0;he>ue&&U.set(J.projectId,he)}return[...Q].sort((J,he)=>{const ue=U.get(J.id)??(J.createdAt?new Date(J.createdAt).getTime():0);return(U.get(he.id)??(he.createdAt?new Date(he.createdAt).getTime():0))-ue})},[Q,Y]),me=k.useMemo(()=>ge.filter(U=>!U.archivedAt),[ge]),Me=k.useMemo(()=>{if(!O)return[];const U=localStorage.getItem("providerUsageCount"),J=U?JSON.parse(U):{};return[...O].sort((he,ue)=>{const ve=he.availability.type!=="NOT_FOUND",Ae=ue.availability.type!=="NOT_FOUND";if(ve!==Ae)return ve?-1:1;const mt=J[he.provider.id]??0;return(J[ue.provider.id]??0)-mt})},[O]),re=k.useMemo(()=>Y.map(Dm),[Y]),Be=k.useMemo(()=>new Set,[]),Ce=k.useMemo(()=>{if(!ie)return null;const U=Y.find(he=>he.id===ie);if(!U)return null;const J=Q.find(he=>he.id===U.projectId);if(!J){const he=U.workspaces?.find(ue=>ue.status==="ACTIVE")?.branchName??U.workspaces?.[0]?.branchName??"—";return{id:U.id,projectId:U.projectId,projectName:"Unknown",projectColor:"text-neutral-500",title:U.title,status:ei(U.status),branch:he,mainBranch:"main",description:U.description??"",projectArchivedAt:null,projectRepoDeletedAt:null}}return Am(U,J)},[ie,Y,Q]),oe=xa(),Ne=Bf(u),qe=Ff(),Re=If(),Ve=k.useCallback(U=>{qe.mutate(U,{onSuccess:()=>{ie===U&&s(null),P.invalidateQueries({queryKey:ae.tasks.all})}})},[qe,ie,P]),be=k.useCallback((U,J)=>{Re.mutate({id:U,status:wm(J)},{onError:()=>{sr.error(e("状态变更失败,该操作不被允许"))}})},[Re,e]),st=k.useCallback(U=>{U.preventDefault(),H.current=!0,W.current=U.clientX,A.current=v,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[v]);k.useEffect(()=>{const U=he=>{if(!H.current)return;const ue=he.clientX-W.current,ve=Math.max(up,Math.min(dp,A.current+ue));C(ve)},J=()=>{H.current&&(H.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",J),()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",J)}},[]);const Ke=k.useCallback(()=>{i(!0)},[]),Pe=k.useCallback(()=>{if(me.length===0){sr.error(e("没有可用项目,请先创建或恢复项目"));return}const U=localStorage.getItem("lastSelectedProjectId"),J=localStorage.getItem("lastSelectedProviderId"),he=U&&me.find(Ae=>Ae.id===U)?U:(D&&me.find(Ae=>Ae.id===D)?.id)??me[0]?.id??"";_(he);const ue=Me?.find(Ae=>Ae.availability.type!=="NOT_FOUND"),ve=J&&Me?.find(Ae=>Ae.provider.id===J&&Ae.availability.type!=="NOT_FOUND")?J:ue?.provider.id??"";w(ve),b("idle"),f(!0)},[me,D,Me,e]),Oe=k.useCallback(()=>{i(!1),p(""),S("")},[]),De=k.useCallback(()=>{E==="idle"&&(f(!1),n(""),h(""),_(""),w(""),b("idle"),L())},[E,L]),V=k.useCallback(async()=>{if(!(!o.trim()||!x.trim()))try{await oe.mutateAsync({name:o.trim(),repoPath:x.trim()}),Oe()}catch(U){sr.error(U instanceof Error?U.message:"Failed to create project")}},[o,x,oe,Oe]),Z=Qr(),xe=k.useCallback(async()=>{if(!(!g.trim()||!u))try{const U=T(),J=[d.trim(),U].filter(Boolean).join(`
|
|
84
84
|
|
|
85
85
|
`);b("creating-task");const he=await Ne.mutateAsync({title:g.trim(),description:J||void 0});if(localStorage.setItem("lastSelectedProjectId",u),y){localStorage.setItem("lastSelectedProviderId",y);const ue=localStorage.getItem("providerUsageCount"),ve=ue?JSON.parse(ue):{};ve[y]=(ve[y]??0)+1,localStorage.setItem("providerUsageCount",JSON.stringify(ve))}if(y){const ue=[g.trim(),J].filter(Boolean).join(`
|
|
86
86
|
|
|
87
|
-
`);b("creating-workspace");const ve=await fe.post(`/tasks/${he.id}/workspaces`,{});b("creating-session");const Ae=await fe.post(`/workspaces/${ve.id}/sessions`,{providerId:y,prompt:ue});b("starting-session"),await Z.mutateAsync(Ae.id),await P.invalidateQueries({queryKey:ae.workspaces.list(he.id)})}s(he.id),b("idle"),f(!1),n(""),h(""),_(""),w(""),L()}catch{b("idle")}},[g,d,u,y,Ne,Z,P,T,L]),Se=k.useCallback(q=>{const J=q.target.files;J&&J.length>0&&j(Array.from(J)),q.target.value=""},[j]),He=k.useCallback(q=>{const J=q.clipboardData.items,he=[];for(const ue of J)if(ue.kind==="file"){const ve=ue.getAsFile();ve&&he.push(ve)}he.length>0&&(q.preventDefault(),j(he))},[j]),[Xe,pe]=k.useState(!1),et=k.useCallback(q=>{q.preventDefault(),pe(!0)},[]),Ge=k.useCallback(q=>{q.preventDefault(),pe(!1)},[]),nt=k.useCallback(q=>{q.preventDefault(),pe(!1);const J=q.dataTransfer.files;J.length>0&&j(Array.from(J))},[j]),Ht=K||U||te;return Mm()?ie&&Ce?a.jsxs(a.Fragment,{children:[a.jsx(Zm,{task:Ce,onBack:()=>s(null),onDeleteTask:Ce.projectArchivedAt?void 0:Ve,isDeleting:qe.isPending}),a.jsx(k.Suspense,{fallback:null,children:a.jsx(Gt,{isOpen:r,onClose:Oe,title:e("Create New Project"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:Oe,className:"px-4 py-2 text-sm text-neutral-600",children:e("Cancel")}),a.jsx("button",{onClick:V,disabled:!o.trim()||!x.trim()||oe.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${o.trim()&&x.trim()&&!oe.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:oe.isPending?e("Creating..."):e("Create")})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project Name")}),a.jsx("input",{type:"text",value:o,onChange:q=>p(q.target.value),placeholder:e("e.g., Agent Tower"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",autoFocus:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Repository Path")}),a.jsx(gr,{value:x,onChange:S})]})]})})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col h-dvh bg-neutral-50 overflow-hidden text-sm",children:[a.jsxs("header",{className:"h-12 bg-white border-b border-neutral-200 flex items-center px-4 justify-between shrink-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[on,an]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(rn,{}),a.jsx(oi,{to:"/settings",className:"p-1.5 text-neutral-400 active:text-neutral-900 rounded-md",children:a.jsx(ai,{size:16})})]})]}),Ht&&re.length===0?a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-neutral-400",children:e("Loading...")}):a.jsx(Ei,{tasks:re,projects:se,selectedTaskId:null,onSelectTask:s,filterProjectId:D,setFilterProjectId:m,width:"100%",onCreateProject:Ke,onCreateTask:Pe,activeTaskIds:Be,onTaskStatusChange:be})]}),a.jsxs(k.Suspense,{fallback:null,children:[a.jsx(Gt,{isOpen:r,onClose:Oe,title:e("Create New Project"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:Oe,className:"px-4 py-2 text-sm text-neutral-600",children:e("Cancel")}),a.jsx("button",{onClick:V,disabled:!o.trim()||!x.trim()||oe.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${o.trim()&&x.trim()&&!oe.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:oe.isPending?e("Creating..."):e("Create")})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project Name")}),a.jsx("input",{type:"text",value:o,onChange:q=>p(q.target.value),placeholder:e("e.g., Agent Tower"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",autoFocus:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Repository Path")}),a.jsx(gr,{value:x,onChange:S})]})]})}),a.jsx(Gt,{isOpen:c,onClose:De,title:e("Create New Task"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:De,disabled:E!=="idle",className:"px-4 py-2 text-sm text-neutral-600 disabled:opacity-50",children:e("Cancel")}),a.jsx("button",{onClick:xe,disabled:!g.trim()||!u||E!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg ${g.trim()&&u&&E==="idle"?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:e(nn[E])})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project")}),a.jsx(vs,{value:u,onChange:_,options:me.map(q=>({value:q.id,label:q.name})),placeholder:e("Select project..."),disabled:E!=="idle"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Provider")}),a.jsx(vs,{value:y,onChange:w,options:Me.map(({provider:q,availability:J})=>({value:q.id,label:q.name+(J.type==="NOT_FOUND"?e(" (不可用)"):""),disabled:J.type==="NOT_FOUND"})),placeholder:e($?"Loading...":"Select provider..."),disabled:E!=="idle"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Task Title")}),a.jsx("input",{type:"text",value:g,onChange:q=>n(q.target.value),placeholder:e("e.g., Implement login flow"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",disabled:E!=="idle",onKeyDown:q=>{q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&xe()}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Description")}),a.jsxs("div",{className:`relative border rounded-lg transition-colors ${Xe?"border-neutral-400 bg-neutral-50":"border-neutral-200"}`,onDragOver:et,onDragLeave:Ge,onDrop:nt,children:[a.jsx("textarea",{rows:3,value:d,onChange:q=>h(q.target.value),onPaste:He,placeholder:e("Optional..."),className:"w-full px-3 py-2 text-sm focus:outline-none bg-transparent resize-none",disabled:E!=="idle",onKeyDown:q=>{(q.metaKey||q.ctrlKey)&&q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&xe()}}),Xe&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-neutral-50/90 pointer-events-none",children:a.jsx("p",{className:"text-sm text-neutral-600",children:e("Drop files here")})})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>I.current?.click(),disabled:E!=="idle"||B,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs text-neutral-600 active:text-neutral-900 active:bg-neutral-100 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(ws,{size:14}),e("Attach files")]}),a.jsx("span",{className:"text-xs text-neutral-400",children:e("or paste files")})]}),a.jsx("input",{ref:I,type:"file",multiple:!0,onChange:Se,className:"hidden"}),a.jsx(Ns,{files:R,onRemove:M})]})]})})]})]}):a.jsxs("div",{ref:N,className:"flex flex-col h-screen bg-neutral-50 overflow-hidden text-sm",children:[a.jsxs("header",{className:"h-12 bg-white border-b border-neutral-200 flex items-center px-4 justify-between flex-shrink-0 z-10 relative",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[on,an]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(rn,{}),a.jsx(oi,{to:"/settings",className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",children:a.jsx(ai,{size:16})})]})]}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[Ht&&re.length===0?a.jsx("div",{className:"h-full flex items-center justify-center text-sm text-neutral-400 border-r border-neutral-200 flex-shrink-0",style:{width:v},children:e("Loading...")}):a.jsx(Ei,{tasks:re,projects:se,selectedTaskId:ie,onSelectTask:s,filterProjectId:D,setFilterProjectId:m,width:v,onCreateProject:Ke,onCreateTask:Pe,activeTaskIds:Be,onTaskStatusChange:be,onDeleteTask:Ve}),a.jsx("div",{onMouseDown:st,className:"w-1 cursor-col-resize hover:bg-neutral-300 active:bg-neutral-400 transition-colors z-50 -ml-[2px] flex-shrink-0 h-full",title:e("Drag to resize")}),a.jsx(Cm,{task:Ce,onDeleteTask:Ce?.projectArchivedAt?void 0:Ve,isDeleting:qe.isPending,onTaskStatusChange:Ce?.projectArchivedAt?void 0:be})]}),a.jsxs(k.Suspense,{fallback:null,children:[a.jsx(Gt,{isOpen:r,onClose:Oe,title:e("Create New Project"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:Oe,className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors",children:e("Cancel")}),a.jsx("button",{onClick:V,disabled:!o.trim()||!x.trim()||oe.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${o.trim()&&x.trim()&&!oe.isPending?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:oe.isPending?e("Creating..."):e("Create Project")})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project Name")}),a.jsx("input",{type:"text",value:o,onChange:q=>p(q.target.value),placeholder:e("e.g., Agent Tower"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors",autoFocus:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Repository Path")}),a.jsx(gr,{value:x,onChange:S})]}),oe.isError&&a.jsx("p",{className:"text-xs text-red-500",children:oe.error instanceof Error?oe.error.message:e("Failed to create project")})]})}),a.jsx(Gt,{isOpen:c,onClose:De,title:e("Create New Task"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:De,disabled:E!=="idle",className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:e("Cancel")}),a.jsx("button",{onClick:xe,disabled:!g.trim()||!u||E!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${g.trim()&&u&&E==="idle"?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:e(nn[E])})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project")}),a.jsx(vs,{value:u,onChange:_,options:me.map(q=>({value:q.id,label:q.name})),placeholder:e("Select project..."),disabled:E!=="idle"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Agent")}),a.jsx(vs,{value:y,onChange:w,options:Me.map(({provider:q,availability:J})=>({value:q.id,label:q.name+(J.type==="NOT_FOUND"?e(" (不可用)"):""),disabled:J.type==="NOT_FOUND"})),placeholder:e($?"Loading...":"Select provider..."),disabled:E!=="idle"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Task Title")}),a.jsx("input",{type:"text",value:g,onChange:q=>n(q.target.value),placeholder:e("e.g., Implement login flow"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors",disabled:E!=="idle",onKeyDown:q=>{q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&xe()}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Description")}),a.jsxs("div",{className:`relative border rounded-lg transition-colors ${Xe?"border-neutral-400 bg-neutral-50":"border-neutral-200"}`,onDragOver:et,onDragLeave:Ge,onDrop:nt,children:[a.jsx("textarea",{rows:3,value:d,onChange:q=>h(q.target.value),onPaste:He,placeholder:e("Optional description..."),className:"w-full px-3 py-2 text-sm focus:outline-none bg-transparent resize-none",disabled:E!=="idle",onKeyDown:q=>{(q.metaKey||q.ctrlKey)&&q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&xe()}}),Xe&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-neutral-50/90 pointer-events-none",children:a.jsx("p",{className:"text-sm text-neutral-600",children:e("Drop files here")})})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>I.current?.click(),disabled:E!=="idle"||B,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs text-neutral-600 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(ws,{size:14}),e("Attach files")]}),a.jsx("span",{className:"text-xs text-neutral-400",children:e("or paste/drag files")})]}),a.jsx("input",{ref:I,type:"file",multiple:!0,onChange:Se,className:"hidden"}),a.jsx(Ns,{files:R,onRemove:M})]}),Ne.isError&&a.jsx("p",{className:"text-xs text-red-500",children:Ne.error instanceof Error?Ne.error.message:"Failed to create task"})]})})]})]})}export{Dp as ProjectKanbanPage};
|
|
87
|
+
`);b("creating-workspace");const ve=await fe.post(`/tasks/${he.id}/workspaces`,{});b("creating-session");const Ae=await fe.post(`/workspaces/${ve.id}/sessions`,{providerId:y,prompt:ue});b("starting-session"),await Z.mutateAsync(Ae.id),await P.invalidateQueries({queryKey:ae.workspaces.list(he.id)})}s(he.id),b("idle"),f(!1),n(""),h(""),_(""),w(""),L()}catch{b("idle")}},[g,d,u,y,Ne,Z,P,T,L]),Se=k.useCallback(U=>{const J=U.target.files;J&&J.length>0&&j(Array.from(J)),U.target.value=""},[j]),He=k.useCallback(U=>{const J=U.clipboardData.items,he=[];for(const ue of J)if(ue.kind==="file"){const ve=ue.getAsFile();ve&&he.push(ve)}he.length>0&&(U.preventDefault(),j(he))},[j]),[Xe,pe]=k.useState(!1),et=k.useCallback(U=>{U.preventDefault(),pe(!0)},[]),Ge=k.useCallback(U=>{U.preventDefault(),pe(!1)},[]),nt=k.useCallback(U=>{U.preventDefault(),pe(!1);const J=U.dataTransfer.files;J.length>0&&j(Array.from(J))},[j]),Ht=K||q||te;return Mm()?ie&&Ce?a.jsxs(a.Fragment,{children:[a.jsx(Zm,{task:Ce,onBack:()=>s(null),onDeleteTask:Ce.projectArchivedAt?void 0:Ve,isDeleting:qe.isPending}),a.jsx(k.Suspense,{fallback:null,children:a.jsx(Gt,{isOpen:r,onClose:Oe,title:e("Create New Project"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:Oe,className:"px-4 py-2 text-sm text-neutral-600",children:e("Cancel")}),a.jsx("button",{onClick:V,disabled:!o.trim()||!x.trim()||oe.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${o.trim()&&x.trim()&&!oe.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:oe.isPending?e("Creating..."):e("Create")})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project Name")}),a.jsx("input",{type:"text",value:o,onChange:U=>p(U.target.value),placeholder:e("e.g., Agent Tower"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",autoFocus:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Repository Path")}),a.jsx(_r,{value:x,onChange:S})]})]})})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col h-dvh bg-neutral-50 overflow-hidden text-sm",children:[a.jsxs("header",{className:"h-12 bg-white border-b border-neutral-200 flex items-center px-4 justify-between shrink-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[on,an]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(rn,{}),a.jsx(oi,{to:"/settings",className:"p-1.5 text-neutral-400 active:text-neutral-900 rounded-md",children:a.jsx(ai,{size:16})})]})]}),Ht&&re.length===0?a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-neutral-400",children:e("Loading...")}):a.jsx(Ei,{tasks:re,projects:se,selectedTaskId:null,onSelectTask:s,filterProjectId:D,setFilterProjectId:m,width:"100%",onCreateProject:Ke,onCreateTask:Pe,activeTaskIds:Be,onTaskStatusChange:be})]}),a.jsxs(k.Suspense,{fallback:null,children:[a.jsx(Gt,{isOpen:r,onClose:Oe,title:e("Create New Project"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:Oe,className:"px-4 py-2 text-sm text-neutral-600",children:e("Cancel")}),a.jsx("button",{onClick:V,disabled:!o.trim()||!x.trim()||oe.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${o.trim()&&x.trim()&&!oe.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:oe.isPending?e("Creating..."):e("Create")})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project Name")}),a.jsx("input",{type:"text",value:o,onChange:U=>p(U.target.value),placeholder:e("e.g., Agent Tower"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",autoFocus:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Repository Path")}),a.jsx(_r,{value:x,onChange:S})]})]})}),a.jsx(Gt,{isOpen:c,onClose:De,title:e("Create New Task"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:De,disabled:E!=="idle",className:"px-4 py-2 text-sm text-neutral-600 disabled:opacity-50",children:e("Cancel")}),a.jsx("button",{onClick:xe,disabled:!g.trim()||!u||E!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg ${g.trim()&&u&&E==="idle"?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:e(nn[E])})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project")}),a.jsx(vs,{value:u,onChange:_,options:me.map(U=>({value:U.id,label:U.name})),placeholder:e("Select project..."),disabled:E!=="idle"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Provider")}),a.jsx(vs,{value:y,onChange:w,options:Me.map(({provider:U,availability:J})=>({value:U.id,label:U.name+(J.type==="NOT_FOUND"?e(" (不可用)"):""),disabled:J.type==="NOT_FOUND"})),placeholder:e($?"Loading...":"Select provider..."),disabled:E!=="idle"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Task Title")}),a.jsx("input",{type:"text",value:g,onChange:U=>n(U.target.value),placeholder:e("e.g., Implement login flow"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",disabled:E!=="idle",onKeyDown:U=>{U.key==="Enter"&&!U.nativeEvent.isComposing&&U.nativeEvent.keyCode!==229&&xe()}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Description")}),a.jsxs("div",{className:`relative border rounded-lg transition-colors ${Xe?"border-neutral-400 bg-neutral-50":"border-neutral-200"}`,onDragOver:et,onDragLeave:Ge,onDrop:nt,children:[a.jsx("textarea",{rows:3,value:d,onChange:U=>h(U.target.value),onPaste:He,placeholder:e("Optional..."),className:"w-full px-3 py-2 text-sm focus:outline-none bg-transparent resize-none",disabled:E!=="idle",onKeyDown:U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&!U.nativeEvent.isComposing&&U.nativeEvent.keyCode!==229&&xe()}}),Xe&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-neutral-50/90 pointer-events-none",children:a.jsx("p",{className:"text-sm text-neutral-600",children:e("Drop files here")})})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>I.current?.click(),disabled:E!=="idle"||B,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs text-neutral-600 active:text-neutral-900 active:bg-neutral-100 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(ws,{size:14}),e("Attach files")]}),a.jsx("span",{className:"text-xs text-neutral-400",children:e("or paste files")})]}),a.jsx("input",{ref:I,type:"file",multiple:!0,onChange:Se,className:"hidden"}),a.jsx(Ns,{files:R,onRemove:M})]})]})})]})]}):a.jsxs("div",{ref:N,className:"flex flex-col h-screen bg-neutral-50 overflow-hidden text-sm",children:[a.jsxs("header",{className:"h-12 bg-white border-b border-neutral-200 flex items-center px-4 justify-between flex-shrink-0 z-10 relative",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[on,an]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(rn,{}),a.jsx(oi,{to:"/settings",className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",children:a.jsx(ai,{size:16})})]})]}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[Ht&&re.length===0?a.jsx("div",{className:"h-full flex items-center justify-center text-sm text-neutral-400 border-r border-neutral-200 flex-shrink-0",style:{width:v},children:e("Loading...")}):a.jsx(Ei,{tasks:re,projects:se,selectedTaskId:ie,onSelectTask:s,filterProjectId:D,setFilterProjectId:m,width:v,onCreateProject:Ke,onCreateTask:Pe,activeTaskIds:Be,onTaskStatusChange:be,onDeleteTask:Ve}),a.jsx("div",{onMouseDown:st,className:"w-1 cursor-col-resize hover:bg-neutral-300 active:bg-neutral-400 transition-colors z-50 -ml-[2px] flex-shrink-0 h-full",title:e("Drag to resize")}),a.jsx(Cm,{task:Ce,onDeleteTask:Ce?.projectArchivedAt?void 0:Ve,isDeleting:qe.isPending,onTaskStatusChange:Ce?.projectArchivedAt?void 0:be})]}),a.jsxs(k.Suspense,{fallback:null,children:[a.jsx(Gt,{isOpen:r,onClose:Oe,title:e("Create New Project"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:Oe,className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors",children:e("Cancel")}),a.jsx("button",{onClick:V,disabled:!o.trim()||!x.trim()||oe.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${o.trim()&&x.trim()&&!oe.isPending?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:oe.isPending?e("Creating..."):e("Create Project")})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project Name")}),a.jsx("input",{type:"text",value:o,onChange:U=>p(U.target.value),placeholder:e("e.g., Agent Tower"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors",autoFocus:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Repository Path")}),a.jsx(_r,{value:x,onChange:S})]}),oe.isError&&a.jsx("p",{className:"text-xs text-red-500",children:oe.error instanceof Error?oe.error.message:e("Failed to create project")})]})}),a.jsx(Gt,{isOpen:c,onClose:De,title:e("Create New Task"),action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:De,disabled:E!=="idle",className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:e("Cancel")}),a.jsx("button",{onClick:xe,disabled:!g.trim()||!u||E!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${g.trim()&&u&&E==="idle"?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:e(nn[E])})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Project")}),a.jsx(vs,{value:u,onChange:_,options:me.map(U=>({value:U.id,label:U.name})),placeholder:e("Select project..."),disabled:E!=="idle"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Agent")}),a.jsx(vs,{value:y,onChange:w,options:Me.map(({provider:U,availability:J})=>({value:U.id,label:U.name+(J.type==="NOT_FOUND"?e(" (不可用)"):""),disabled:J.type==="NOT_FOUND"})),placeholder:e($?"Loading...":"Select provider..."),disabled:E!=="idle"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Task Title")}),a.jsx("input",{type:"text",value:g,onChange:U=>n(U.target.value),placeholder:e("e.g., Implement login flow"),className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors",disabled:E!=="idle",onKeyDown:U=>{U.key==="Enter"&&!U.nativeEvent.isComposing&&U.nativeEvent.keyCode!==229&&xe()}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:e("Description")}),a.jsxs("div",{className:`relative border rounded-lg transition-colors ${Xe?"border-neutral-400 bg-neutral-50":"border-neutral-200"}`,onDragOver:et,onDragLeave:Ge,onDrop:nt,children:[a.jsx("textarea",{rows:3,value:d,onChange:U=>h(U.target.value),onPaste:He,placeholder:e("Optional description..."),className:"w-full px-3 py-2 text-sm focus:outline-none bg-transparent resize-none",disabled:E!=="idle",onKeyDown:U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&!U.nativeEvent.isComposing&&U.nativeEvent.keyCode!==229&&xe()}}),Xe&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-neutral-50/90 pointer-events-none",children:a.jsx("p",{className:"text-sm text-neutral-600",children:e("Drop files here")})})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>I.current?.click(),disabled:E!=="idle"||B,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs text-neutral-600 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(ws,{size:14}),e("Attach files")]}),a.jsx("span",{className:"text-xs text-neutral-400",children:e("or paste/drag files")})]}),a.jsx("input",{ref:I,type:"file",multiple:!0,onChange:Se,className:"hidden"}),a.jsx(Ns,{files:R,onRemove:M})]}),Ne.isError&&a.jsx("p",{className:"text-xs text-red-500",children:Ne.error instanceof Error?Ne.error.message:"Failed to create task"})]})})]})]})}export{Dp as ProjectKanbanPage};
|