agent-tower 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/executors/codex.executor.d.ts +2 -6
- package/dist/executors/codex.executor.d.ts.map +1 -1
- package/dist/executors/codex.executor.js +3 -11
- package/dist/executors/codex.executor.js.map +1 -1
- package/dist/executors/default-providers.json +1 -2
- package/dist/routes/sessions.d.ts.map +1 -1
- package/dist/routes/sessions.js +2 -1
- package/dist/routes/sessions.js.map +1 -1
- package/dist/services/session-manager.d.ts +1 -1
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +28 -6
- package/dist/services/session-manager.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-DSyU6XMx.js → AgentDemoPage-BvaDaGTb.js} +1 -1
- package/dist/web/assets/{DemoPage-BxYQv1Wa.js → DemoPage-B7lfVxNj.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-mln4lAxn.js → NotificationSettingsPage-CUl8SV4s.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-CS-WK307.js → ProfileSettingsPage-hPvylvwn.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-Bz0Q0ZZy.js → ProjectKanbanPage-C2UFFwX_.js} +28 -28
- package/dist/web/assets/{ProjectSettingsPage-CBnahNua.js → ProjectSettingsPage-3_0cjA46.js} +1 -1
- package/dist/web/assets/ProviderSettingsPage-CzfHzUkE.js +54 -0
- package/dist/web/assets/{api-client-iFY2ykuZ.js → api-client-DQBFRKXh.js} +1 -1
- package/dist/web/assets/{chevron-down-CxTrrnvp.js → chevron-down-BxmO9AqF.js} +1 -1
- package/dist/web/assets/{circle-alert-CHDHEO67.js → circle-alert-CNojp6BL.js} +1 -1
- package/dist/web/assets/{circle-check-uswR_cEa.js → circle-check-PLh029g-.js} +1 -1
- package/dist/web/assets/{code-block-OCS4YCEC-VVSDpKw-.js → code-block-OCS4YCEC-DeKZRMJF.js} +1 -1
- package/dist/web/assets/{folder-picker-DshGpYNS.js → folder-picker-DG3yX995.js} +1 -1
- package/dist/web/assets/{index-hdGFeHu1.js → index-BjoprLxq.js} +2 -2
- package/dist/web/assets/{loader-circle-BYF33K7x.js → loader-circle-BtsxMnMy.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-CQLrOBEw.js → mermaid-NOHMQCX5-DGTR51GL.js} +3 -3
- package/dist/web/assets/{modal-BCL0660p.js → modal-Cw8yKTAW.js} +1 -1
- package/dist/web/assets/{pencil-SJi1qbh9.js → pencil-ChfcWQRp.js} +1 -1
- package/dist/web/assets/{query-keys-B2VhRmAm.js → query-keys-wUxyRw3p.js} +1 -1
- package/dist/web/assets/{select-WuDnj3zN.js → select-CUxnXhcD.js} +1 -1
- package/dist/web/assets/{use-profiles-DYTDOkn8.js → use-profiles-DMBAv505.js} +1 -1
- package/dist/web/assets/{use-projects-BLI6qXx-.js → use-projects-D14i8o7S.js} +1 -1
- package/dist/web/assets/{use-providers-C1i5uxRH.js → use-providers-DW_hHJcb.js} +1 -1
- package/dist/web/assets/{x-Bn5zgMLL.js → x-CHwmHeMU.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/ProviderSettingsPage-D-Lrg1Sj.js +0 -54
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-
|
|
2
|
-
import{z as Pr,A as wo,B as Eo,a as ko,q as tr,d as Ro,D as Do,u as Ie,r as R,n as To,c as ve,R as ee,E as Rt,j as a,s as ht,S as We,C as nt,i as Yt,g as Vt,G as Fi,H as jo,y as Lo,L as Or,_ as Hi}from"./index-hdGFeHu1.js";import{Q as dr,b as Ao,c as No,e as Mo,d as Po,f as Oo,s as Br,g as Ir,w as Bo,h as Io,i as Fo,a as Ge,q as ce,u as at}from"./query-keys-B2VhRmAm.js";import{C as kt,h as fr,b as pr,d as mr,c as vr,i as gr,G as Es,u as zi,a as Wi,Q as $i,e as Ui,T as qi,P as ds,f as Ki,S as Fr}from"./mermaid-NOHMQCX5-CQLrOBEw.js";import{C as gt,a as fs}from"./chevron-down-CxTrrnvp.js";import{P as sr,X as ks}from"./x-Bn5zgMLL.js";import{u as _r,C as Ho,S as Oe,T as it,A as is}from"./use-providers-C1i5uxRH.js";import"./log-adapter-50wgehrc.js";import{a as be,c as Se,B as ot,t as Xi}from"./api-client-iFY2ykuZ.js";import{F as zo,a as Wo,c as $o,u as Uo,d as qo}from"./use-projects-BLI6qXx-.js";import{L as Be}from"./loader-circle-BYF33K7x.js";import{M as Rs,T as Yi}from"./modal-BCL0660p.js";import{S as ns}from"./select-WuDnj3zN.js";var Ko=class extends dr{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:Pr()})}getOptimisticResult(e){return e.behavior=Pr(),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:b,isError:C,isRefetchError:r}=l,i=s.fetchMeta?.fetchMore?.direction,c=C&&i==="forward",d=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Eo(t,s.data),hasPreviousPage:wo(t,s.data),isFetchNextPageError:c,isFetchingNextPage:d,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!c&&!o,isRefetching:b&&!d&&!p}}};function Hr(e,t){const s=new Set(t);return e.filter(l=>!s.has(l))}function Xo(e,t,s){const l=e.slice(0);return l[t]=s,l}var Yo=class extends ko{#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,tr.batch(()=>{const s=this.#t,l=this.#d(this.#i);l.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const m=l.map(d=>d.observer),b=m.map(d=>d.getCurrentResult()),C=s.length!==m.length,r=m.some((d,o)=>d!==s[o]),i=C||r,c=i?!0:b.some((d,o)=>{const p=this.#e[o];return!p||!Ro(d,p)});!i&&!c||(i&&(this.#c=l,this.#t=m),this.#e=b,this.hasListeners()&&(i&&(Hr(s,m).forEach(d=>{d.destroy()}),Hr(m,s).forEach(d=>{d.subscribe(o=>{this.#f(d,o)})})),this.#p()))})}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(b=>b.observer.getOptimisticResult(b.defaultedQueryOptions)),m=s.map(b=>b.defaultedQueryOptions.queryHash);return[l,b=>this.#u(b??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,b=>{t.forEach(C=>{C.observer.trackProp(b)})})})}#u(e,t,s){if(t){const l=this.#l,m=s!==void 0&&l!==void 0&&(l.length!==s.length||s.some((b,C)=>b!==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=Do(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 b=t.get(m);b?b.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 dr(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=Xo(this.#e,s,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#s,t=this.#h(this.#e,this.#c),s=this.#u(t,this.#n?.combine);e!==s&&tr.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function Vo({queries:e,...t},s){const l=Ie(),m=Ao(),b=No(),C=R.useMemo(()=>e.map(g=>{const n=l.defaultQueryOptions(g);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,l,m]);C.forEach(g=>{Mo(g);const n=l.getQueryCache().get(g.queryHash);Po(g,b,n)}),Oo(b);const[r]=R.useState(()=>new Yo(l,C,t)),[i,c,d]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(g=>o?r.subscribe(tr.batchCalls(g)):To,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),R.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const _=i.some((g,n)=>Br(C[n],g))?i.flatMap((g,n)=>{const f=C[n];if(f){const h=new dr(l,f);if(Br(f,g))return Ir(f,h,b);Bo(g,m)&&Ir(f,h,b)}return[]}):[];if(_.length>0)throw Promise.all(_);const S=i.find((g,n)=>{const f=C[n];return f&&Io({result:g,errorResetBoundary:b,throwOnError:f.throwOnError,query:l.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(S?.error)throw S.error;return c(d())}function Vi(e,t){return Fo(e,Ko)}const Go=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Gi=ve("arrow-down",Go);const Qo=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Qi=ve("arrow-right",Qo);const Zo=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Zi=ve("arrow-up",Zo);const Jo=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],zr=ve("circle-check-big",Jo);const ea=[["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"}]],Ds=ve("code-xml",ea);const ta=[["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"}]],Wr=ve("copy",ta);const sa=[["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"}]],Ji=ve("ellipsis-vertical",sa);const ra=[["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"}]],ia=ve("file-braces-corner",ra);const na=[["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"}]],Wt=ve("file-code-corner",na);const oa=[["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"}]],aa=ve("file-exclamation-point",oa);const la=[["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"}]],en=ve("file-text",la);const ca=[["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"}]],tn=ve("folder-open",ca);const ha=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ua=ve("gauge",ha);const da=[["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"}]],fa=ve("git-branch",da);const pa=[["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"}]],ma=ve("git-fork",pa);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"}]],$t=ve("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"}]],sn=ve("git-merge",ga);const _a=[["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"}]],At=ve("history",_a);const ba=[["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=ve("image",ba);const xa=[["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"}]],$r=ve("layers",xa);const Sa=[["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"}]],ya=ve("maximize",Sa);const Ca=[["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"}]],wa=ve("message-square",Ca);const Ea=[["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"}]],ka=ve("panel-left-close",Ea);const Ra=[["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"}]],Da=ve("panel-left-open",Ra);const Ta=[["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"}]],ja=ve("panel-right-close",Ta);const La=[["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"}]],Aa=ve("panel-right-open",La);const Na=[["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"}]],jt=ve("play",Na);const Ma=[["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"}]],Pa=ve("refresh-cw",Ma);const Oa=[["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"}]],Ba=ve("shield",Oa);const Ia=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ps=ve("terminal",Ia);const Fa=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],xr=ve("triangle-alert",Fa);const Ha=[["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"}]],za=ve("zap",Ha);const Wa=[["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"}]],$a=ve("zoom-in",Wa);const Ua=[["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"}]],qa=ve("zoom-out",Ua),Ts=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Sr(e){return"nodeType"in e}function Ye(e){var t,s;return e?Nt(e)?e:Sr(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function yr(e){const{Document:t}=Ye(e);return e instanceof t}function Gt(e){return Nt(e)?!1:e instanceof Ye(e).HTMLElement}function rn(e){return e instanceof Ye(e).SVGElement}function Mt(e){return e?Nt(e)?e.document:Sr(e)?yr(e)?e:Gt(e)||rn(e)?e.ownerDocument:document:document:document}const ut=Ts?R.useLayoutEffect:R.useEffect;function js(e){const t=R.useRef(e);return ut(()=>{t.current=e}),R.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 Ka(){const e=R.useRef(null),t=R.useCallback((l,m)=>{e.current=setInterval(l,m)},[]),s=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Ut(e,t){t===void 0&&(t=[e]);const s=R.useRef(e);return ut(()=>{s.current!==e&&(s.current=e)},t),s}function Qt(e,t){const s=R.useRef();return R.useMemo(()=>{const l=e(s.current);return s.current=l,l},[...t])}function ms(e){const t=js(e),s=R.useRef(null),l=R.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,l]}function vs(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let Hs={};function Ls(e,t){return R.useMemo(()=>{if(t)return t;const s=Hs[e]==null?0:Hs[e]+1;return Hs[e]=s,e+"-"+s},[e,t])}function nn(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((b,C)=>{const r=Object.entries(C);for(const[i,c]of r){const d=b[i];d!=null&&(b[i]=d+e*c)}return b},{...t})}}const Lt=nn(1),gs=nn(-1);function Xa(e){return"clientX"in e&&"clientY"in e}function Cr(e){if(!e)return!1;const{KeyboardEvent:t}=Ye(e.target);return t&&e instanceof t}function Ya(e){if(!e)return!1;const{TouchEvent:t}=Ye(e.target);return t&&e instanceof t}function _s(e){if(Ya(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 Xa(e)?{x:e.clientX,y:e.clientY}:null}const qt=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[qt.Translate.toString(e),qt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:l}=e;return t+" "+s+"ms "+l}}}),Ur="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Va(e){return e.matches(Ur)?e:e.querySelector(Ur)}const Ga={display:"none"};function Qa(e){let{id:t,value:s}=e;return ee.createElement("div",{id:t,style:Ga},s)}function Za(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 Ja(){const[e,t]=R.useState("");return{announce:R.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const on=R.createContext(null);function el(e){const t=R.useContext(on);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function tl(){const[e]=R.useState(()=>new Set),t=R.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[R.useCallback(l=>{let{type:m,event:b}=l;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,b)})},[e]),t]}const sl={draggable:`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-Cw8yKTAW.js","assets/index-BjoprLxq.js","assets/index-Br9066ZX.css","assets/api-client-DQBFRKXh.js","assets/x-CHwmHeMU.js","assets/folder-picker-DG3yX995.js","assets/mermaid-NOHMQCX5-DGTR51GL.js","assets/log-adapter-50wgehrc.js","assets/chevron-down-BxmO9AqF.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/loader-circle-BtsxMnMy.js","assets/circle-alert-CNojp6BL.js","assets/use-projects-D14i8o7S.js","assets/query-keys-wUxyRw3p.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{z as Pr,A as wo,B as Eo,a as ko,q as sr,d as Ro,D as Do,u as Pe,r as R,n as jo,c as ve,R as ee,E as Dt,j as a,s as ft,S as We,C as at,i as Qt,g as Zt,G as Or,H as To,y as Lo,L as Br,_ as zi}from"./index-BjoprLxq.js";import{Q as fr,b as Ao,c as No,e as Mo,d as Po,f as Oo,s as Ir,g as Fr,w as Bo,h as Io,i as Fo,a as Ve,q as he,u as ct}from"./query-keys-wUxyRw3p.js";import{C as kt,h as pr,b as mr,d as vr,c as gr,i as _r,G as ks,u as Wi,a as $i,Q as Ui,e as qi,T as Ki,P as ps,f as Xi,S as Hr}from"./mermaid-NOHMQCX5-DGTR51GL.js";import{C as mt,a as Ut}from"./chevron-down-BxmO9AqF.js";import{P as rr,X as Rs}from"./x-CHwmHeMU.js";import{u as Ds,C as Ho,S as Ae,T as ot,A as os}from"./use-providers-DW_hHJcb.js";import"./log-adapter-50wgehrc.js";import{a as _e,c as xe,B as lt,t as zr}from"./api-client-DQBFRKXh.js";import{F as zo,a as Wo,c as $o,u as Uo,d as qo}from"./use-projects-D14i8o7S.js";import{L as Me}from"./loader-circle-BtsxMnMy.js";import{M as js,T as Yi}from"./modal-Cw8yKTAW.js";import{S as as}from"./select-CUxnXhcD.js";var Ko=class extends fr{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:Pr()})}getOptimisticResult(e){return e.behavior=Pr(),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:b,isError:C,isRefetchError:r}=l,i=s.fetchMeta?.fetchMore?.direction,c=C&&i==="forward",d=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Eo(t,s.data),hasPreviousPage:wo(t,s.data),isFetchNextPageError:c,isFetchingNextPage:d,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!c&&!o,isRefetching:b&&!d&&!p}}};function Wr(e,t){const s=new Set(t);return e.filter(l=>!s.has(l))}function Xo(e,t,s){const l=e.slice(0);return l[t]=s,l}var Yo=class extends ko{#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,sr.batch(()=>{const s=this.#t,l=this.#d(this.#i);l.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const m=l.map(d=>d.observer),b=m.map(d=>d.getCurrentResult()),C=s.length!==m.length,r=m.some((d,o)=>d!==s[o]),i=C||r,c=i?!0:b.some((d,o)=>{const p=this.#e[o];return!p||!Ro(d,p)});!i&&!c||(i&&(this.#c=l,this.#t=m),this.#e=b,this.hasListeners()&&(i&&(Wr(s,m).forEach(d=>{d.destroy()}),Wr(m,s).forEach(d=>{d.subscribe(o=>{this.#f(d,o)})})),this.#p()))})}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(b=>b.observer.getOptimisticResult(b.defaultedQueryOptions)),m=s.map(b=>b.defaultedQueryOptions.queryHash);return[l,b=>this.#u(b??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,b=>{t.forEach(C=>{C.observer.trackProp(b)})})})}#u(e,t,s){if(t){const l=this.#l,m=s!==void 0&&l!==void 0&&(l.length!==s.length||s.some((b,C)=>b!==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=Do(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 b=t.get(m);b?b.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 fr(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=Xo(this.#e,s,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#s,t=this.#h(this.#e,this.#c),s=this.#u(t,this.#n?.combine);e!==s&&sr.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function Vo({queries:e,...t},s){const l=Pe(),m=Ao(),b=No(),C=R.useMemo(()=>e.map(g=>{const n=l.defaultQueryOptions(g);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,l,m]);C.forEach(g=>{Mo(g);const n=l.getQueryCache().get(g.queryHash);Po(g,b,n)}),Oo(b);const[r]=R.useState(()=>new Yo(l,C,t)),[i,c,d]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(g=>o?r.subscribe(sr.batchCalls(g)):jo,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),R.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const _=i.some((g,n)=>Ir(C[n],g))?i.flatMap((g,n)=>{const f=C[n];if(f){const h=new fr(l,f);if(Ir(f,g))return Fr(f,h,b);Bo(g,m)&&Fr(f,h,b)}return[]}):[];if(_.length>0)throw Promise.all(_);const y=i.find((g,n)=>{const f=C[n];return f&&Io({result:g,errorResetBoundary:b,throwOnError:f.throwOnError,query:l.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(y?.error)throw y.error;return c(d())}function Vi(e,t){return Fo(e,Ko)}const Go=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Gi=ve("arrow-down",Go);const Qo=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Qi=ve("arrow-right",Qo);const Zo=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Zi=ve("arrow-up",Zo);const Jo=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],$r=ve("circle-check-big",Jo);const ea=[["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"}]],Ts=ve("code-xml",ea);const ta=[["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"}]],Ur=ve("copy",ta);const sa=[["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"}]],Ji=ve("ellipsis-vertical",sa);const ra=[["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"}]],ia=ve("file-braces-corner",ra);const na=[["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"}]],qt=ve("file-code-corner",na);const oa=[["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"}]],aa=ve("file-exclamation-point",oa);const la=[["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"}]],en=ve("file-text",la);const ca=[["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"}]],tn=ve("folder-open",ca);const ha=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ua=ve("gauge",ha);const da=[["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"}]],fa=ve("git-branch",da);const pa=[["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"}]],ma=ve("git-fork",pa);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"}]],Kt=ve("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"}]],sn=ve("git-merge",ga);const _a=[["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"}]],Nt=ve("history",_a);const ba=[["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=ve("image",ba);const xa=[["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"}]],qr=ve("layers",xa);const Sa=[["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"}]],ya=ve("maximize",Sa);const Ca=[["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"}]],wa=ve("message-square",Ca);const Ea=[["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"}]],ka=ve("panel-left-close",Ea);const Ra=[["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"}]],Da=ve("panel-left-open",Ra);const ja=[["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"}]],Ta=ve("panel-right-close",ja);const La=[["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"}]],Aa=ve("panel-right-open",La);const Na=[["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"}]],Lt=ve("play",Na);const Ma=[["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"}]],Pa=ve("refresh-cw",Ma);const Oa=[["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"}]],Ba=ve("shield",Oa);const Ia=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ms=ve("terminal",Ia);const Fa=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],xr=ve("triangle-alert",Fa);const Ha=[["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"}]],za=ve("zap",Ha);const Wa=[["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"}]],$a=ve("zoom-in",Wa);const Ua=[["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"}]],qa=ve("zoom-out",Ua),Ls=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Mt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Sr(e){return"nodeType"in e}function Ye(e){var t,s;return e?Mt(e)?e:Sr(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function yr(e){const{Document:t}=Ye(e);return e instanceof t}function Jt(e){return Mt(e)?!1:e instanceof Ye(e).HTMLElement}function rn(e){return e instanceof Ye(e).SVGElement}function Pt(e){return e?Mt(e)?e.document:Sr(e)?yr(e)?e:Jt(e)||rn(e)?e.ownerDocument:document:document:document}const pt=Ls?R.useLayoutEffect:R.useEffect;function As(e){const t=R.useRef(e);return pt(()=>{t.current=e}),R.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 Ka(){const e=R.useRef(null),t=R.useCallback((l,m)=>{e.current=setInterval(l,m)},[]),s=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Xt(e,t){t===void 0&&(t=[e]);const s=R.useRef(e);return pt(()=>{s.current!==e&&(s.current=e)},t),s}function es(e,t){const s=R.useRef();return R.useMemo(()=>{const l=e(s.current);return s.current=l,l},[...t])}function vs(e){const t=As(e),s=R.useRef(null),l=R.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,l]}function gs(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let zs={};function Ns(e,t){return R.useMemo(()=>{if(t)return t;const s=zs[e]==null?0:zs[e]+1;return zs[e]=s,e+"-"+s},[e,t])}function nn(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((b,C)=>{const r=Object.entries(C);for(const[i,c]of r){const d=b[i];d!=null&&(b[i]=d+e*c)}return b},{...t})}}const At=nn(1),_s=nn(-1);function Xa(e){return"clientX"in e&&"clientY"in e}function Cr(e){if(!e)return!1;const{KeyboardEvent:t}=Ye(e.target);return t&&e instanceof t}function Ya(e){if(!e)return!1;const{TouchEvent:t}=Ye(e.target);return t&&e instanceof t}function bs(e){if(Ya(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 Xa(e)?{x:e.clientX,y:e.clientY}:null}const Yt=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[Yt.Translate.toString(e),Yt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:l}=e;return t+" "+s+"ms "+l}}}),Kr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Va(e){return e.matches(Kr)?e:e.querySelector(Kr)}const Ga={display:"none"};function Qa(e){let{id:t,value:s}=e;return ee.createElement("div",{id:t,style:Ga},s)}function Za(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 Ja(){const[e,t]=R.useState("");return{announce:R.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const on=R.createContext(null);function el(e){const t=R.useContext(on);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function tl(){const[e]=R.useState(()=>new Set),t=R.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[R.useCallback(l=>{let{type:m,event:b}=l;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,b)})},[e]),t]}const sl={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
|
-
`},rl={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 il(e){let{announcements:t=rl,container:s,hiddenTextDescribedById:l,screenReaderInstructions:m=sl}=e;const{announce:b,announcement:C}=Ja(),r=Ls("DndLiveRegion"),[i,c]=R.useState(!1);if(R.useEffect(()=>{c(!0)},[]),el(R.useMemo(()=>({onDragStart(o){let{active:p}=o;b(t.onDragStart({active:p}))},onDragMove(o){let{active:p,over:_}=o;t.onDragMove&&b(t.onDragMove({active:p,over:_}))},onDragOver(o){let{active:p,over:_}=o;b(t.onDragOver({active:p,over:_}))},onDragEnd(o){let{active:p,over:_}=o;b(t.onDragEnd({active:p,over:_}))},onDragCancel(o){let{active:p,over:_}=o;b(t.onDragCancel({active:p,over:_}))}}),[b,t])),!i)return null;const d=ee.createElement(ee.Fragment,null,ee.createElement(Qa,{id:l,value:m.draggable}),ee.createElement(Za,{id:r,announcement:C}));return s?Rt.createPortal(d,s):d}var He;(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"})(He||(He={}));function bs(){}function nl(e,t){return R.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function ol(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return R.useMemo(()=>[...t].filter(l=>l!=null),[...t])}const rt=Object.freeze({x:0,y:0});function al(e,t){const s=_s(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 ll(e,t){let{data:{value:s}}=e,{data:{value:l}}=t;return l-s}function cl(e,t){if(!e||e.length===0)return null;const[s]=e;return s[t]}function hl(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),b=Math.min(t.top+t.height,e.top+e.height),C=m-l,r=b-s;if(l<m&&s<b){const i=t.width*t.height,c=e.width*e.height,d=C*r,o=d/(i+c-d);return Number(o.toFixed(4))}return 0}const ul=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:l}=e;const m=[];for(const b of l){const{id:C}=b,r=s.get(C);if(r){const i=hl(r,t);i>0&&m.push({id:C,data:{droppableContainer:b,value:i}})}}return m.sort(ll)};function dl(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}:rt}function fl(e){return function(s){for(var l=arguments.length,m=new Array(l>1?l-1:0),b=1;b<l;b++)m[b-1]=arguments[b];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 pl=fl(1);function ln(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 ml(e,t,s){const l=ln(t);if(!l)return e;const{scaleX:m,scaleY:b,x:C,y:r}=l,i=e.left-C-(1-m)*parseFloat(s),c=e.top-r-(1-b)*parseFloat(s.slice(s.indexOf(" ")+1)),d=m?e.width/m:e.width,o=b?e.height/b:e.height;return{width:d,height:o,top:c,right:i+d,bottom:c+o,left:i}}const vl={ignoreTransform:!1};function Zt(e,t){t===void 0&&(t=vl);let s=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:d}=Ye(e).getComputedStyle(e);c&&(s=ml(s,c,d))}const{top:l,left:m,width:b,height:C,bottom:r,right:i}=s;return{top:l,left:m,width:b,height:C,bottom:r,right:i}}function qr(e){return Zt(e,{ignoreTransform:!0})}function gl(e){const t=e.innerWidth,s=e.innerHeight;return{top:0,left:0,right:t,bottom:s,width:t,height:s}}function _l(e,t){return t===void 0&&(t=Ye(e).getComputedStyle(e)),t.position==="fixed"}function bl(e,t){t===void 0&&(t=Ye(e).getComputedStyle(e));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(m=>{const b=t[m];return typeof b=="string"?s.test(b):!1})}function wr(e,t){const s=[];function l(m){if(t!=null&&s.length>=t||!m)return s;if(yr(m)&&m.scrollingElement!=null&&!s.includes(m.scrollingElement))return s.push(m.scrollingElement),s;if(!Gt(m)||rn(m)||s.includes(m))return s;const b=Ye(e).getComputedStyle(m);return m!==e&&bl(m,b)&&s.push(m),_l(m,b)?s:l(m.parentNode)}return e?l(e):s}function cn(e){const[t]=wr(e,1);return t??null}function zs(e){return!Ts||!e?null:Nt(e)?e:Sr(e)?yr(e)||e===Mt(e).scrollingElement?window:Gt(e)?e:null:null}function hn(e){return Nt(e)?e.scrollX:e.scrollLeft}function un(e){return Nt(e)?e.scrollY:e.scrollTop}function rr(e){return{x:hn(e),y:un(e)}}var $e;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($e||($e={}));function dn(e){return!Ts||!e?!1:e===document.scrollingElement}function fn(e){const t={x:0,y:0},s=dn(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,b=e.scrollLeft<=t.x,C=e.scrollTop>=l.y,r=e.scrollLeft>=l.x;return{isTop:m,isLeft:b,isBottom:C,isRight:r,maxScroll:l,minScroll:t}}const xl={x:.2,y:.2};function Sl(e,t,s,l,m){let{top:b,left:C,right:r,bottom:i}=s;l===void 0&&(l=10),m===void 0&&(m=xl);const{isTop:c,isBottom:d,isLeft:o,isRight:p}=fn(e),_={x:0,y:0},S={x:0,y:0},g={height:t.height*m.y,width:t.width*m.x};return!c&&b<=t.top+g.height?(_.y=$e.Backward,S.y=l*Math.abs((t.top+g.height-b)/g.height)):!d&&i>=t.bottom-g.height&&(_.y=$e.Forward,S.y=l*Math.abs((t.bottom-g.height-i)/g.height)),!p&&r>=t.right-g.width?(_.x=$e.Forward,S.x=l*Math.abs((t.right-g.width-r)/g.width)):!o&&C<=t.left+g.width&&(_.x=$e.Backward,S.x=l*Math.abs((t.left+g.width-C)/g.width)),{direction:_,speed:S}}function yl(e){if(e===document.scrollingElement){const{innerWidth:b,innerHeight:C}=window;return{top:0,left:0,right:b,bottom:C,width:b,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 pn(e){return e.reduce((t,s)=>Lt(t,rr(s)),rt)}function Cl(e){return e.reduce((t,s)=>t+hn(s),0)}function wl(e){return e.reduce((t,s)=>t+un(s),0)}function mn(e,t){if(t===void 0&&(t=Zt),!e)return;const{top:s,left:l,bottom:m,right:b}=t(e);cn(e)&&(m<=0||b<=0||s>=window.innerHeight||l>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const El=[["x",["left","right"],Cl],["y",["top","bottom"],wl]];class Er{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=pn(l);this.rect={...t},this.width=t.width,this.height=t.height;for(const[b,C,r]of El)for(const i of C)Object.defineProperty(this,i,{get:()=>{const c=r(l),d=m[b]-c;return this.rect[i]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class It{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 kl(e){const{EventTarget:t}=Ye(e);return e instanceof t?e:Mt(e)}function Ws(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 Ze;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ze||(Ze={}));function Kr(e){e.preventDefault()}function Rl(e){e.stopPropagation()}var Ee;(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"})(Ee||(Ee={}));const vn={start:[Ee.Space,Ee.Enter],cancel:[Ee.Esc],end:[Ee.Space,Ee.Enter,Ee.Tab]},Dl=(e,t)=>{let{currentCoordinates:s}=t;switch(e.code){case Ee.Right:return{...s,x:s.x+25};case Ee.Left:return{...s,x:s.x-25};case Ee.Down:return{...s,y:s.y+25};case Ee.Up:return{...s,y:s.y-25}}};class gn{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 It(Mt(s)),this.windowListeners=new It(Ye(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ze.Resize,this.handleCancel),this.windowListeners.add(Ze.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ze.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:s}=this.props,l=t.node.current;l&&mn(l),s(rt)}handleKeyDown(t){if(Cr(t)){const{active:s,context:l,options:m}=this.props,{keyboardCodes:b=vn,coordinateGetter:C=Dl,scrollBehavior:r="smooth"}=m,{code:i}=t;if(b.end.includes(i)){this.handleEnd(t);return}if(b.cancel.includes(i)){this.handleCancel(t);return}const{collisionRect:c}=l.current,d=c?{x:c.left,y:c.top}:rt;this.referenceCoordinates||(this.referenceCoordinates=d);const o=C(t,{active:s,context:l.current,currentCoordinates:d});if(o){const p=gs(o,d),_={x:0,y:0},{scrollableAncestors:S}=l.current;for(const g of S){const n=t.code,{isTop:f,isRight:h,isLeft:u,isBottom:v,maxScroll:x,minScroll:w}=fn(g),k=yl(g),y={x:Math.min(n===Ee.Right?k.right-k.width/2:k.right,Math.max(n===Ee.Right?k.left:k.left+k.width/2,o.x)),y:Math.min(n===Ee.Down?k.bottom-k.height/2:k.bottom,Math.max(n===Ee.Down?k.top:k.top+k.height/2,o.y))},E=n===Ee.Right&&!h||n===Ee.Left&&!u,j=n===Ee.Down&&!v||n===Ee.Up&&!f;if(E&&y.x!==o.x){const A=g.scrollLeft+p.x,L=n===Ee.Right&&A<=x.x||n===Ee.Left&&A>=w.x;if(L&&!p.y){g.scrollTo({left:A,behavior:r});return}L?_.x=g.scrollLeft-A:_.x=n===Ee.Right?g.scrollLeft-x.x:g.scrollLeft-w.x,_.x&&g.scrollBy({left:-_.x,behavior:r});break}else if(j&&y.y!==o.y){const A=g.scrollTop+p.y,L=n===Ee.Down&&A<=x.y||n===Ee.Up&&A>=w.y;if(L&&!p.x){g.scrollTo({top:A,behavior:r});return}L?_.y=g.scrollTop-A:_.y=n===Ee.Down?g.scrollTop-x.y:g.scrollTop-w.y,_.y&&g.scrollBy({top:-_.y,behavior:r});break}}this.handleMove(t,Lt(gs(o,this.referenceCoordinates),_))}}}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()}}gn.activators=[{eventName:"onKeyDown",handler:(e,t,s)=>{let{keyboardCodes:l=vn,onActivation:m}=t,{active:b}=s;const{code:C}=e.nativeEvent;if(l.start.includes(C)){const r=b.activatorNode.current;return r&&e.target!==r?!1:(e.preventDefault(),m?.({event:e.nativeEvent}),!0)}return!1}}];function Xr(e){return!!(e&&"distance"in e)}function Yr(e){return!!(e&&"delay"in e)}class kr{constructor(t,s,l){var m;l===void 0&&(l=kl(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:b}=t,{target:C}=b;this.props=t,this.events=s,this.document=Mt(C),this.documentListeners=new It(this.document),this.listeners=new It(l),this.windowListeners=new It(Ye(C)),this.initialCoordinates=(m=_s(b))!=null?m:rt,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(Ze.Resize,this.handleCancel),this.windowListeners.add(Ze.DragStart,Kr),this.windowListeners.add(Ze.VisibilityChange,this.handleCancel),this.windowListeners.add(Ze.ContextMenu,Kr),this.documentListeners.add(Ze.Keydown,this.handleKeydown),s){if(l!=null&&l({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Yr(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(Xr(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(Ze.Click,Rl,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ze.SelectionChange,this.removeTextSelection),s(t))}handleMove(t){var s;const{activated:l,initialCoordinates:m,props:b}=this,{onMove:C,options:{activationConstraint:r}}=b;if(!m)return;const i=(s=_s(t))!=null?s:rt,c=gs(m,i);if(!l&&r){if(Xr(r)){if(r.tolerance!=null&&Ws(c,r.tolerance))return this.handleCancel();if(Ws(c,r.distance))return this.handleStart()}if(Yr(r)&&Ws(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===Ee.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Tl={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Rr extends kr{constructor(t){const{event:s}=t,l=Mt(s.target);super(t,Tl,l)}}Rr.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 jl={move:{name:"mousemove"},end:{name:"mouseup"}};var ir;(function(e){e[e.RightClick=2]="RightClick"})(ir||(ir={}));class Ll extends kr{constructor(t){super(t,jl,Mt(t.event.target))}}Ll.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:l}=t;return s.button===ir.RightClick?!1:(l?.({event:s}),!0)}}];const $s={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Al extends kr{constructor(t){super(t,$s)}static setup(){return window.addEventListener($s.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener($s.move.name,t)};function t(){}}}Al.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 Ft;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ft||(Ft={}));var xs;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xs||(xs={}));function Nl(e){let{acceleration:t,activator:s=Ft.Pointer,canScroll:l,draggingRect:m,enabled:b,interval:C=5,order:r=xs.TreeOrder,pointerCoordinates:i,scrollableAncestors:c,scrollableAncestorRects:d,delta:o,threshold:p}=e;const _=Pl({delta:o,disabled:!b}),[S,g]=Ka(),n=R.useRef({x:0,y:0}),f=R.useRef({x:0,y:0}),h=R.useMemo(()=>{switch(s){case Ft.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case Ft.DraggableRect:return m}},[s,m,i]),u=R.useRef(null),v=R.useCallback(()=>{const w=u.current;if(!w)return;const k=n.current.x*f.current.x,y=n.current.y*f.current.y;w.scrollBy(k,y)},[]),x=R.useMemo(()=>r===xs.TreeOrder?[...c].reverse():c,[r,c]);R.useEffect(()=>{if(!b||!c.length||!h){g();return}for(const w of x){if(l?.(w)===!1)continue;const k=c.indexOf(w),y=d[k];if(!y)continue;const{direction:E,speed:j}=Sl(w,y,h,t,p);for(const A of["x","y"])_[A][E[A]]||(j[A]=0,E[A]=0);if(j.x>0||j.y>0){g(),u.current=w,S(v,C),n.current=j,f.current=E;return}}n.current={x:0,y:0},f.current={x:0,y:0},g()},[t,v,l,g,b,C,JSON.stringify(h),JSON.stringify(_),S,c,x,d,JSON.stringify(p)])}const Ml={x:{[$e.Backward]:!1,[$e.Forward]:!1},y:{[$e.Backward]:!1,[$e.Forward]:!1}};function Pl(e){let{delta:t,disabled:s}=e;const l=vs(t);return Qt(m=>{if(s||!l||!m)return Ml;const b={x:Math.sign(t.x-l.x),y:Math.sign(t.y-l.y)};return{x:{[$e.Backward]:m.x[$e.Backward]||b.x===-1,[$e.Forward]:m.x[$e.Forward]||b.x===1},y:{[$e.Backward]:m.y[$e.Backward]||b.y===-1,[$e.Forward]:m.y[$e.Forward]||b.y===1}}},[s,t,l])}function Ol(e,t){const s=t!=null?e.get(t):void 0,l=s?s.node.current:null;return Qt(m=>{var b;return t==null?null:(b=l??m)!=null?b:null},[l,t])}function Bl(e,t){return R.useMemo(()=>e.reduce((s,l)=>{const{sensor:m}=l,b=m.activators.map(C=>({eventName:C.eventName,handler:t(C.handler,l)}));return[...s,...b]},[]),[e,t])}var Kt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Kt||(Kt={}));var nr;(function(e){e.Optimized="optimized"})(nr||(nr={}));const Vr=new Map;function Il(e,t){let{dragging:s,dependencies:l,config:m}=t;const[b,C]=R.useState(null),{frequency:r,measure:i,strategy:c}=m,d=R.useRef(e),o=n(),p=Ut(o),_=R.useCallback(function(f){f===void 0&&(f=[]),!p.current&&C(h=>h===null?f:h.concat(f.filter(u=>!h.includes(u))))},[p]),S=R.useRef(null),g=Qt(f=>{if(o&&!s)return Vr;if(!f||f===Vr||d.current!==e||b!=null){const h=new Map;for(let u of e){if(!u)continue;if(b&&b.length>0&&!b.includes(u.id)&&u.rect.current){h.set(u.id,u.rect.current);continue}const v=u.node.current,x=v?new Er(i(v),v):null;u.rect.current=x,x&&h.set(u.id,x)}return h}return f},[e,b,s,o,i]);return R.useEffect(()=>{d.current=e},[e]),R.useEffect(()=>{o||_()},[s,o]),R.useEffect(()=>{b&&b.length>0&&C(null)},[JSON.stringify(b)]),R.useEffect(()=>{o||typeof r!="number"||S.current!==null||(S.current=setTimeout(()=>{_(),S.current=null},r))},[r,o,_,...l]),{droppableRects:g,measureDroppableContainers:_,measuringScheduled:b!=null};function n(){switch(c){case Kt.Always:return!1;case Kt.BeforeDragging:return s;default:return!s}}}function Dr(e,t){return Qt(s=>e?s||(typeof t=="function"?t(e):e):null,[t,e])}function Fl(e,t){return Dr(e,t)}function Hl(e){let{callback:t,disabled:s}=e;const l=js(t),m=R.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:b}=window;return new b(l)},[l,s]);return R.useEffect(()=>()=>m?.disconnect(),[m]),m}function As(e){let{callback:t,disabled:s}=e;const l=js(t),m=R.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:b}=window;return new b(l)},[s]);return R.useEffect(()=>()=>m?.disconnect(),[m]),m}function zl(e){return new Er(Zt(e),e)}function Gr(e,t,s){t===void 0&&(t=zl);const[l,m]=R.useState(null);function b(){m(i=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=i??s)!=null?c:null}const d=t(e);return JSON.stringify(i)===JSON.stringify(d)?i:d})}const C=Hl({callback(i){if(e)for(const c of i){const{type:d,target:o}=c;if(d==="childList"&&o instanceof HTMLElement&&o.contains(e)){b();break}}}}),r=As({callback:b});return ut(()=>{b(),e?(r?.observe(e),C?.observe(document.body,{childList:!0,subtree:!0})):(r?.disconnect(),C?.disconnect())},[e]),l}function Wl(e){const t=Dr(e);return an(e,t)}const Qr=[];function $l(e){const t=R.useRef(e),s=Qt(l=>e?l&&l!==Qr&&e&&t.current&&e.parentNode===t.current.parentNode?l:wr(e):Qr,[e]);return R.useEffect(()=>{t.current=e},[e]),s}function Ul(e){const[t,s]=R.useState(null),l=R.useRef(e),m=R.useCallback(b=>{const C=zs(b.target);C&&s(r=>r?(r.set(C,rr(C)),new Map(r)):null)},[]);return R.useEffect(()=>{const b=l.current;if(e!==b){C(b);const r=e.map(i=>{const c=zs(i);return c?(c.addEventListener("scroll",m,{passive:!0}),[c,rr(c)]):null}).filter(i=>i!=null);s(r.length?new Map(r):null),l.current=e}return()=>{C(e),C(b)};function C(r){r.forEach(i=>{const c=zs(i);c?.removeEventListener("scroll",m)})}},[m,e]),R.useMemo(()=>e.length?t?Array.from(t.values()).reduce((b,C)=>Lt(b,C),rt):pn(e):rt,[e,t])}function Zr(e,t){t===void 0&&(t=[]);const s=R.useRef(null);return R.useEffect(()=>{s.current=null},t),R.useEffect(()=>{const l=e!==rt;l&&!s.current&&(s.current=e),!l&&s.current&&(s.current=null)},[e]),s.current?gs(e,s.current):rt}function ql(e){R.useEffect(()=>{if(!Ts)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 Kl(e,t){return R.useMemo(()=>e.reduce((s,l)=>{let{eventName:m,handler:b}=l;return s[m]=C=>{b(C,t)},s},{}),[e,t])}function _n(e){return R.useMemo(()=>e?gl(e):null,[e])}const Jr=[];function Xl(e,t){t===void 0&&(t=Zt);const[s]=e,l=_n(s?Ye(s):null),[m,b]=R.useState(Jr);function C(){b(()=>e.length?e.map(i=>dn(i)?l:new Er(t(i),i)):Jr)}const r=As({callback:C});return ut(()=>{r?.disconnect(),C(),e.forEach(i=>r?.observe(i))},[e]),m}function bn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Gt(t)?t:e}function Yl(e){let{measure:t}=e;const[s,l]=R.useState(null),m=R.useCallback(c=>{for(const{target:d}of c)if(Gt(d)){l(o=>{const p=t(d);return o?{...o,width:p.width,height:p.height}:p});break}},[t]),b=As({callback:m}),C=R.useCallback(c=>{const d=bn(c);b?.disconnect(),d&&b?.observe(d),l(d?t(d):null)},[t,b]),[r,i]=ms(C);return R.useMemo(()=>({nodeRef:r,rect:s,setRef:i}),[s,r,i])}const Vl=[{sensor:Rr,options:{}},{sensor:gn,options:{}}],Gl={current:{}},us={draggable:{measure:qr},droppable:{measure:qr,strategy:Kt.WhileDragging,frequency:nr.Optimized},dragOverlay:{measure:Zt}};class Ht 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 Ql={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ht,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:bs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:us,measureDroppableContainers:bs,windowRect:null,measuringScheduled:!1},xn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:bs,draggableNodes:new Map,over:null,measureDroppableContainers:bs},Jt=R.createContext(xn),Sn=R.createContext(Ql);function Zl(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ht}}}function Jl(e,t){switch(t.type){case He.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case He.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 He.DragEnd:case He.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case He.RegisterDroppable:{const{element:s}=t,{id:l}=s,m=new Ht(e.droppable.containers);return m.set(l,s),{...e,droppable:{...e.droppable,containers:m}}}case He.SetDroppableDisabled:{const{id:s,key:l,disabled:m}=t,b=e.droppable.containers.get(s);if(!b||l!==b.key)return e;const C=new Ht(e.droppable.containers);return C.set(s,{...b,disabled:m}),{...e,droppable:{...e.droppable,containers:C}}}case He.UnregisterDroppable:{const{id:s,key:l}=t,m=e.droppable.containers.get(s);if(!m||l!==m.key)return e;const b=new Ht(e.droppable.containers);return b.delete(s),{...e,droppable:{...e.droppable,containers:b}}}default:return e}}function ec(e){let{disabled:t}=e;const{active:s,activatorEvent:l,draggableNodes:m}=R.useContext(Jt),b=vs(l),C=vs(s?.id);return R.useEffect(()=>{if(!t&&!l&&b&&C!=null){if(!Cr(b)||document.activeElement===b.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 d of[i.current,c.current]){if(!d)continue;const o=Va(d);if(o){o.focus();break}}})}},[l,t,m,C,b]),null}function yn(e,t){let{transform:s,...l}=t;return e!=null&&e.length?e.reduce((m,b)=>b({transform:m,...l}),s):s}function tc(e){return R.useMemo(()=>({draggable:{...us.draggable,...e?.draggable},droppable:{...us.droppable,...e?.droppable},dragOverlay:{...us.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function sc(e){let{activeNode:t,measure:s,initialRect:l,config:m=!0}=e;const b=R.useRef(!1),{x:C,y:r}=typeof m=="boolean"?{x:m,y:m}:m;ut(()=>{if(!C&&!r||!t){b.current=!1;return}if(b.current||!l)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const d=s(c),o=an(d,l);if(C||(o.x=0),r||(o.y=0),b.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const p=cn(c);p&&p.scrollBy({top:o.y,left:o.x})}},[t,C,r,l,s])}const Ns=R.createContext({...rt,scaleX:1,scaleY:1});var ft;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ft||(ft={}));const rc=R.memo(function(t){var s,l,m,b;let{id:C,accessibility:r,autoScroll:i=!0,children:c,sensors:d=Vl,collisionDetection:o=ul,measuring:p,modifiers:_,...S}=t;const g=R.useReducer(Jl,void 0,Zl),[n,f]=g,[h,u]=tl(),[v,x]=R.useState(ft.Uninitialized),w=v===ft.Initialized,{draggable:{active:k,nodes:y,translate:E},droppable:{containers:j}}=n,A=k!=null?y.get(k):null,L=R.useRef({initial:null,translated:null}),N=R.useMemo(()=>{var ae;return k!=null?{id:k,data:(ae=A?.data)!=null?ae:Gl,rect:L}:null},[k,A]),B=R.useRef(null),[I,H]=R.useState(null),[W,D]=R.useState(null),M=Ut(S,Object.values(S)),P=Ls("DndDescribedBy",C),O=R.useMemo(()=>j.getEnabled(),[j]),U=tc(p),{droppableRects:K,measureDroppableContainers:V,measuringScheduled:Y}=Il(O,{dragging:w,dependencies:[E.x,E.y],config:U.droppable}),ie=Ol(y,k),T=R.useMemo(()=>W?_s(W):null,[W]),F=re(),$=Fl(ie,U.draggable.measure);sc({activeNode:k!=null?y.get(k):null,config:F.layoutShiftCompensation,initialRect:$,measure:U.draggable.measure});const z=Gr(ie,U.draggable.measure,$),J=Gr(ie?ie.parentElement:null),X=R.useRef({activatorEvent:null,active:null,activeNode:ie,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=j.getNodeFor((s=X.current.over)==null?void 0:s.id),he=Yl({measure:U.dragOverlay.measure}),we=(l=he.nodeRef.current)!=null?l:ie,je=w?(m=he.rect)!=null?m:z:null,Z=!!(he.nodeRef.current&&he.rect),ze=Wl(Z?null:z),Fe=_n(we?Ye(we):null),Re=$l(w?oe??ie:null),Q=Xl(Re),se=yn(_,{transform:{x:E.x-ze.x,y:E.y-ze.y,scaleX:1,scaleY:1},activatorEvent:W,active:N,activeNodeRect:z,containerNodeRect:J,draggingNodeRect:je,over:X.current.over,overlayNodeRect:he.rect,scrollableAncestors:Re,scrollableAncestorRects:Q,windowRect:Fe}),ue=T?Lt(T,E):null,ne=Ul(Re),ge=Zr(ne),me=Zr(ne,[z]),ye=Lt(se,ge),Le=je?pl(je,se):null,Ve=N&&Le?o({active:N,collisionRect:Le,droppableRects:K,droppableContainers:O,pointerCoordinates:ue}):null,Ae=cl(Ve,"id"),[Ne,_e]=R.useState(null),et=Z?se:Lt(se,me),bt=dl(et,(b=Ne?.rect)!=null?b:null,z),dt=R.useRef(null),xt=R.useCallback((ae,pe)=>{let{sensor:xe,options:Me}=pe;if(B.current==null)return;const qe=y.get(B.current);if(!qe)return;const Ue=ae.nativeEvent,G=new xe({active:B.current,activeNode:qe,event:Ue,options:Me,context:X,onAbort(de){if(!y.get(de))return;const{onDragAbort:Pe}=M.current,Ce={id:de};Pe?.(Ce),h({type:"onDragAbort",event:Ce})},onPending(de,Ke,Pe,Ce){if(!y.get(de))return;const{onDragPending:tt}=M.current,Xe={id:de,constraint:Ke,initialCoordinates:Pe,offset:Ce};tt?.(Xe),h({type:"onDragPending",event:Xe})},onStart(de){const Ke=B.current;if(Ke==null)return;const Pe=y.get(Ke);if(!Pe)return;const{onDragStart:Ce}=M.current,ct={activatorEvent:Ue,active:{id:Ke,data:Pe.data,rect:L}};Rt.unstable_batchedUpdates(()=>{Ce?.(ct),x(ft.Initializing),f({type:He.DragStart,initialCoordinates:de,active:Ke}),h({type:"onDragStart",event:ct}),H(dt.current),D(Ue)})},onMove(de){f({type:He.DragMove,coordinates:de})},onEnd:te(He.DragEnd),onCancel:te(He.DragCancel)});dt.current=G;function te(de){return async function(){const{active:Pe,collisions:Ce,over:ct,scrollAdjustedTranslate:tt}=X.current;let Xe=null;if(Pe&&tt){const{cancelDrop:yt}=M.current;Xe={activatorEvent:Ue,active:Pe,collisions:Ce,delta:tt,over:ct},de===He.DragEnd&&typeof yt=="function"&&await Promise.resolve(yt(Xe))&&(de=He.DragCancel)}B.current=null,Rt.unstable_batchedUpdates(()=>{f({type:de}),x(ft.Uninitialized),_e(null),H(null),D(null),dt.current=null;const yt=de===He.DragEnd?"onDragEnd":"onDragCancel";if(Xe){const Fs=M.current[yt];Fs?.(Xe),h({type:yt,event:Xe})}})}}},[y]),St=R.useCallback((ae,pe)=>(xe,Me)=>{const qe=xe.nativeEvent,Ue=y.get(Me);if(B.current!==null||!Ue||qe.dndKit||qe.defaultPrevented)return;const G={active:Ue};ae(xe,pe.options,G)===!0&&(qe.dndKit={capturedBy:pe.sensor},B.current=Me,xt(xe,pe))},[y,xt]),lt=Bl(d,St);ql(d),ut(()=>{z&&v===ft.Initializing&&x(ft.Initialized)},[z,v]),R.useEffect(()=>{const{onDragMove:ae}=M.current,{active:pe,activatorEvent:xe,collisions:Me,over:qe}=X.current;if(!pe||!xe)return;const Ue={active:pe,activatorEvent:xe,collisions:Me,delta:{x:ye.x,y:ye.y},over:qe};Rt.unstable_batchedUpdates(()=>{ae?.(Ue),h({type:"onDragMove",event:Ue})})},[ye.x,ye.y]),R.useEffect(()=>{const{active:ae,activatorEvent:pe,collisions:xe,droppableContainers:Me,scrollAdjustedTranslate:qe}=X.current;if(!ae||B.current==null||!pe||!qe)return;const{onDragOver:Ue}=M.current,G=Me.get(Ae),te=G&&G.rect.current?{id:G.id,rect:G.rect.current,data:G.data,disabled:G.disabled}:null,de={active:ae,activatorEvent:pe,collisions:xe,delta:{x:qe.x,y:qe.y},over:te};Rt.unstable_batchedUpdates(()=>{_e(te),Ue?.(de),h({type:"onDragOver",event:de})})},[Ae]),ut(()=>{X.current={activatorEvent:W,active:N,activeNode:ie,collisionRect:Le,collisions:Ve,droppableRects:K,draggableNodes:y,draggingNode:we,draggingNodeRect:je,droppableContainers:j,over:Ne,scrollableAncestors:Re,scrollAdjustedTranslate:ye},L.current={initial:je,translated:Le}},[N,ie,Ve,Le,y,we,je,K,j,Ne,Re,ye]),Nl({...F,delta:E,draggingRect:Le,pointerCoordinates:ue,scrollableAncestors:Re,scrollableAncestorRects:Q});const rs=R.useMemo(()=>({active:N,activeNode:ie,activeNodeRect:z,activatorEvent:W,collisions:Ve,containerNodeRect:J,dragOverlay:he,draggableNodes:y,droppableContainers:j,droppableRects:K,over:Ne,measureDroppableContainers:V,scrollableAncestors:Re,scrollableAncestorRects:Q,measuringConfiguration:U,measuringScheduled:Y,windowRect:Fe}),[N,ie,z,W,Ve,J,he,y,j,K,Ne,V,Re,Q,U,Y,Fe]),q=R.useMemo(()=>({activatorEvent:W,activators:lt,active:N,activeNodeRect:z,ariaDescribedById:{draggable:P},dispatch:f,draggableNodes:y,over:Ne,measureDroppableContainers:V}),[W,lt,N,z,f,P,y,Ne,V]);return ee.createElement(on.Provider,{value:u},ee.createElement(Jt.Provider,{value:q},ee.createElement(Sn.Provider,{value:rs},ee.createElement(Ns.Provider,{value:bt},c)),ee.createElement(ec,{disabled:r?.restoreFocus===!1})),ee.createElement(il,{...r,hiddenTextDescribedById:P}));function re(){const ae=I?.autoScrollEnabled===!1,pe=typeof i=="object"?i.enabled===!1:i===!1,xe=w&&!ae&&!pe;return typeof i=="object"?{...i,enabled:xe}:{enabled:xe}}}),ic=R.createContext(null),ei="button",nc="Draggable";function oc(e){let{id:t,data:s,disabled:l=!1,attributes:m}=e;const b=Ls(nc),{activators:C,activatorEvent:r,active:i,activeNodeRect:c,ariaDescribedById:d,draggableNodes:o,over:p}=R.useContext(Jt),{role:_=ei,roleDescription:S="draggable",tabIndex:g=0}=m??{},n=i?.id===t,f=R.useContext(n?Ns:ic),[h,u]=ms(),[v,x]=ms(),w=Kl(C,t),k=Ut(s);ut(()=>(o.set(t,{id:t,key:b,node:h,activatorNode:v,data:k}),()=>{const E=o.get(t);E&&E.key===b&&o.delete(t)}),[o,t]);const y=R.useMemo(()=>({role:_,tabIndex:g,"aria-disabled":l,"aria-pressed":n&&_===ei?!0:void 0,"aria-roledescription":S,"aria-describedby":d.draggable}),[l,_,g,n,S,d.draggable]);return{active:i,activatorEvent:r,activeNodeRect:c,attributes:y,isDragging:n,listeners:l?void 0:w,node:h,over:p,setNodeRef:u,setActivatorNodeRef:x,transform:f}}function ac(){return R.useContext(Sn)}const lc="Droppable",cc={timeout:25};function hc(e){let{data:t,disabled:s=!1,id:l,resizeObserverConfig:m}=e;const b=Ls(lc),{active:C,dispatch:r,over:i,measureDroppableContainers:c}=R.useContext(Jt),d=R.useRef({disabled:s}),o=R.useRef(!1),p=R.useRef(null),_=R.useRef(null),{disabled:S,updateMeasurementsFor:g,timeout:n}={...cc,...m},f=Ut(g??l),h=R.useCallback(()=>{if(!o.current){o.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{c(Array.isArray(f.current)?f.current:[f.current]),_.current=null},n)},[n]),u=As({callback:h,disabled:S||!C}),v=R.useCallback((y,E)=>{u&&(E&&(u.unobserve(E),o.current=!1),y&&u.observe(y))},[u]),[x,w]=ms(v),k=Ut(t);return R.useEffect(()=>{!u||!x.current||(u.disconnect(),o.current=!1,u.observe(x.current))},[x,u]),R.useEffect(()=>(r({type:He.RegisterDroppable,element:{id:l,key:b,disabled:s,node:x,rect:p,data:k}}),()=>r({type:He.UnregisterDroppable,key:b,id:l})),[l]),R.useEffect(()=>{s!==d.current.disabled&&(r({type:He.SetDroppableDisabled,id:l,key:b,disabled:s}),d.current.disabled=s)},[l,b,s,r]),{active:C,rect:p,isOver:i?.id===l,node:x,over:i,setNodeRef:w}}function uc(e){let{animation:t,children:s}=e;const[l,m]=R.useState(null),[b,C]=R.useState(null),r=vs(s);return!s&&!l&&r&&m(r),ut(()=>{if(!b)return;const i=l?.key,c=l?.props.id;if(i==null||c==null){m(null);return}Promise.resolve(t(c,b)).then(()=>{m(null)})},[t,l,b]),ee.createElement(ee.Fragment,null,s,l?R.cloneElement(l,{ref:C}):null)}const dc={x:0,y:0,scaleX:1,scaleY:1};function fc(e){let{children:t}=e;return ee.createElement(Jt.Provider,{value:xn},ee.createElement(Ns.Provider,{value:dc},t))}const pc={position:"fixed",touchAction:"none"},mc=e=>Cr(e)?"transform 250ms ease":void 0,vc=R.forwardRef((e,t)=>{let{as:s,activatorEvent:l,adjustScale:m,children:b,className:C,rect:r,style:i,transform:c,transition:d=mc}=e;if(!r)return null;const o=m?c:{...c,scaleX:1,scaleY:1},p={...pc,width:r.width,height:r.height,top:r.top,left:r.left,transform:qt.Transform.toString(o),transformOrigin:m&&l?al(l,r):void 0,transition:typeof d=="function"?d(l):d,...i};return ee.createElement(s,{className:C,style:p,ref:t},b)}),gc=e=>t=>{let{active:s,dragOverlay:l}=t;const m={},{styles:b,className:C}=e;if(b!=null&&b.active)for(const[r,i]of Object.entries(b.active))i!==void 0&&(m[r]=s.node.style.getPropertyValue(r),s.node.style.setProperty(r,i));if(b!=null&&b.dragOverlay)for(const[r,i]of Object.entries(b.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)}},_c=e=>{let{transform:{initial:t,final:s}}=e;return[{transform:qt.Transform.toString(t)},{transform:qt.Transform.toString(s)}]},bc={duration:250,easing:"ease",keyframes:_c,sideEffects:gc({styles:{active:{opacity:"0"}}})};function xc(e){let{config:t,draggableNodes:s,droppableContainers:l,measuringConfiguration:m}=e;return js((b,C)=>{if(t===null)return;const r=s.get(b);if(!r)return;const i=r.node.current;if(!i)return;const c=bn(C);if(!c)return;const{transform:d}=Ye(C).getComputedStyle(C),o=ln(d);if(!o)return;const p=typeof t=="function"?t:Sc(t);return mn(i,m.draggable.measure),p({active:{id:b,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 Sc(e){const{duration:t,easing:s,sideEffects:l,keyframes:m}={...bc,...e};return b=>{let{active:C,dragOverlay:r,transform:i,...c}=b;if(!t)return;const d={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-d.x,y:i.y-d.y,...o},_=m({...c,active:C,dragOverlay:r,transform:{initial:i,final:p}}),[S]=_,g=_[_.length-1];if(JSON.stringify(S)===JSON.stringify(g))return;const n=l?.({active:C,dragOverlay:r,...c}),f=r.node.animate(_,{duration:t,easing:s,fill:"forwards"});return new Promise(h=>{f.onfinish=()=>{n?.(),h()}})}}let ti=0;function yc(e){return R.useMemo(()=>{if(e!=null)return ti++,ti},[e])}const Cc=ee.memo(e=>{let{adjustScale:t=!1,children:s,dropAnimation:l,style:m,transition:b,modifiers:C,wrapperElement:r="div",className:i,zIndex:c=999}=e;const{activatorEvent:d,active:o,activeNodeRect:p,containerNodeRect:_,draggableNodes:S,droppableContainers:g,dragOverlay:n,over:f,measuringConfiguration:h,scrollableAncestors:u,scrollableAncestorRects:v,windowRect:x}=ac(),w=R.useContext(Ns),k=yc(o?.id),y=yn(C,{activatorEvent:d,active:o,activeNodeRect:p,containerNodeRect:_,draggingNodeRect:n.rect,over:f,overlayNodeRect:n.rect,scrollableAncestors:u,scrollableAncestorRects:v,transform:w,windowRect:x}),E=Dr(p),j=xc({config:l,draggableNodes:S,droppableContainers:g,measuringConfiguration:h}),A=E?n.setRef:void 0;return ee.createElement(fc,null,ee.createElement(uc,{animation:j},o&&k?ee.createElement(vc,{key:k,id:o.id,ref:A,as:r,activatorEvent:d,adjustScale:t,className:i,transition:b,rect:E,style:{zIndex:c,...m},transform:y},s):null))}),le={Review:"Review",Running:"Running",Pending:"Pending",Done:"Done",Cancelled:"Cancelled"},wc=[{status:le.Review,label:"Review",icon:fr,color:"text-amber-600"},{status:le.Running,label:"Running",icon:pr,color:"text-blue-600"},{status:le.Pending,label:"Pending",icon:mr,color:"text-neutral-600"},{status:le.Done,label:"Done",icon:vr,color:"text-emerald-600"},{status:le.Cancelled,label:"Cancelled",icon:gr,color:"text-neutral-500"}];function Ec({task:e,status:t,isSelected:s,isAgentActive:l,project:m,onSelectTask:b,onTaskStatusChange:C,onDeleteTask:r}){const{attributes:i,listeners:c,setNodeRef:d,isDragging:o}=oc({id:e.id,data:{task:e,fromStatus:t}}),[p,_]=R.useState(null),S=R.useRef(null),g=R.useCallback(n=>{!C&&!r||(n.preventDefault(),_({x:n.clientX,y:n.clientY}))},[C,r]);return R.useEffect(()=>{if(!p)return;const n=f=>{S.current&&!S.current.contains(f.target)&&_(null)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[p]),a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:d,onClick:()=>b(e.id),onContextMenu:g,className:`flex items-start pl-8 pr-4 py-2 text-sm w-full text-left transition-all border-l-2 group
|
|
6
|
+
`},rl={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 il(e){let{announcements:t=rl,container:s,hiddenTextDescribedById:l,screenReaderInstructions:m=sl}=e;const{announce:b,announcement:C}=Ja(),r=Ns("DndLiveRegion"),[i,c]=R.useState(!1);if(R.useEffect(()=>{c(!0)},[]),el(R.useMemo(()=>({onDragStart(o){let{active:p}=o;b(t.onDragStart({active:p}))},onDragMove(o){let{active:p,over:_}=o;t.onDragMove&&b(t.onDragMove({active:p,over:_}))},onDragOver(o){let{active:p,over:_}=o;b(t.onDragOver({active:p,over:_}))},onDragEnd(o){let{active:p,over:_}=o;b(t.onDragEnd({active:p,over:_}))},onDragCancel(o){let{active:p,over:_}=o;b(t.onDragCancel({active:p,over:_}))}}),[b,t])),!i)return null;const d=ee.createElement(ee.Fragment,null,ee.createElement(Qa,{id:l,value:m.draggable}),ee.createElement(Za,{id:r,announcement:C}));return s?Dt.createPortal(d,s):d}var Fe;(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"})(Fe||(Fe={}));function xs(){}function nl(e,t){return R.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function ol(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return R.useMemo(()=>[...t].filter(l=>l!=null),[...t])}const it=Object.freeze({x:0,y:0});function al(e,t){const s=bs(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 ll(e,t){let{data:{value:s}}=e,{data:{value:l}}=t;return l-s}function cl(e,t){if(!e||e.length===0)return null;const[s]=e;return s[t]}function hl(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),b=Math.min(t.top+t.height,e.top+e.height),C=m-l,r=b-s;if(l<m&&s<b){const i=t.width*t.height,c=e.width*e.height,d=C*r,o=d/(i+c-d);return Number(o.toFixed(4))}return 0}const ul=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:l}=e;const m=[];for(const b of l){const{id:C}=b,r=s.get(C);if(r){const i=hl(r,t);i>0&&m.push({id:C,data:{droppableContainer:b,value:i}})}}return m.sort(ll)};function dl(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}:it}function fl(e){return function(s){for(var l=arguments.length,m=new Array(l>1?l-1:0),b=1;b<l;b++)m[b-1]=arguments[b];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 pl=fl(1);function ln(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 ml(e,t,s){const l=ln(t);if(!l)return e;const{scaleX:m,scaleY:b,x:C,y:r}=l,i=e.left-C-(1-m)*parseFloat(s),c=e.top-r-(1-b)*parseFloat(s.slice(s.indexOf(" ")+1)),d=m?e.width/m:e.width,o=b?e.height/b:e.height;return{width:d,height:o,top:c,right:i+d,bottom:c+o,left:i}}const vl={ignoreTransform:!1};function ts(e,t){t===void 0&&(t=vl);let s=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:d}=Ye(e).getComputedStyle(e);c&&(s=ml(s,c,d))}const{top:l,left:m,width:b,height:C,bottom:r,right:i}=s;return{top:l,left:m,width:b,height:C,bottom:r,right:i}}function Xr(e){return ts(e,{ignoreTransform:!0})}function gl(e){const t=e.innerWidth,s=e.innerHeight;return{top:0,left:0,right:t,bottom:s,width:t,height:s}}function _l(e,t){return t===void 0&&(t=Ye(e).getComputedStyle(e)),t.position==="fixed"}function bl(e,t){t===void 0&&(t=Ye(e).getComputedStyle(e));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(m=>{const b=t[m];return typeof b=="string"?s.test(b):!1})}function wr(e,t){const s=[];function l(m){if(t!=null&&s.length>=t||!m)return s;if(yr(m)&&m.scrollingElement!=null&&!s.includes(m.scrollingElement))return s.push(m.scrollingElement),s;if(!Jt(m)||rn(m)||s.includes(m))return s;const b=Ye(e).getComputedStyle(m);return m!==e&&bl(m,b)&&s.push(m),_l(m,b)?s:l(m.parentNode)}return e?l(e):s}function cn(e){const[t]=wr(e,1);return t??null}function Ws(e){return!Ls||!e?null:Mt(e)?e:Sr(e)?yr(e)||e===Pt(e).scrollingElement?window:Jt(e)?e:null:null}function hn(e){return Mt(e)?e.scrollX:e.scrollLeft}function un(e){return Mt(e)?e.scrollY:e.scrollTop}function ir(e){return{x:hn(e),y:un(e)}}var $e;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($e||($e={}));function dn(e){return!Ls||!e?!1:e===document.scrollingElement}function fn(e){const t={x:0,y:0},s=dn(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,b=e.scrollLeft<=t.x,C=e.scrollTop>=l.y,r=e.scrollLeft>=l.x;return{isTop:m,isLeft:b,isBottom:C,isRight:r,maxScroll:l,minScroll:t}}const xl={x:.2,y:.2};function Sl(e,t,s,l,m){let{top:b,left:C,right:r,bottom:i}=s;l===void 0&&(l=10),m===void 0&&(m=xl);const{isTop:c,isBottom:d,isLeft:o,isRight:p}=fn(e),_={x:0,y:0},y={x:0,y:0},g={height:t.height*m.y,width:t.width*m.x};return!c&&b<=t.top+g.height?(_.y=$e.Backward,y.y=l*Math.abs((t.top+g.height-b)/g.height)):!d&&i>=t.bottom-g.height&&(_.y=$e.Forward,y.y=l*Math.abs((t.bottom-g.height-i)/g.height)),!p&&r>=t.right-g.width?(_.x=$e.Forward,y.x=l*Math.abs((t.right-g.width-r)/g.width)):!o&&C<=t.left+g.width&&(_.x=$e.Backward,y.x=l*Math.abs((t.left+g.width-C)/g.width)),{direction:_,speed:y}}function yl(e){if(e===document.scrollingElement){const{innerWidth:b,innerHeight:C}=window;return{top:0,left:0,right:b,bottom:C,width:b,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 pn(e){return e.reduce((t,s)=>At(t,ir(s)),it)}function Cl(e){return e.reduce((t,s)=>t+hn(s),0)}function wl(e){return e.reduce((t,s)=>t+un(s),0)}function mn(e,t){if(t===void 0&&(t=ts),!e)return;const{top:s,left:l,bottom:m,right:b}=t(e);cn(e)&&(m<=0||b<=0||s>=window.innerHeight||l>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const El=[["x",["left","right"],Cl],["y",["top","bottom"],wl]];class Er{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=pn(l);this.rect={...t},this.width=t.width,this.height=t.height;for(const[b,C,r]of El)for(const i of C)Object.defineProperty(this,i,{get:()=>{const c=r(l),d=m[b]-c;return this.rect[i]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ht{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 kl(e){const{EventTarget:t}=Ye(e);return e instanceof t?e:Pt(e)}function $s(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 et;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(et||(et={}));function Yr(e){e.preventDefault()}function Rl(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 vn={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},Dl=(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 gn{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 Ht(Pt(s)),this.windowListeners=new Ht(Ye(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(et.Resize,this.handleCancel),this.windowListeners.add(et.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(et.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:s}=this.props,l=t.node.current;l&&mn(l),s(it)}handleKeyDown(t){if(Cr(t)){const{active:s,context:l,options:m}=this.props,{keyboardCodes:b=vn,coordinateGetter:C=Dl,scrollBehavior:r="smooth"}=m,{code:i}=t;if(b.end.includes(i)){this.handleEnd(t);return}if(b.cancel.includes(i)){this.handleCancel(t);return}const{collisionRect:c}=l.current,d=c?{x:c.left,y:c.top}:it;this.referenceCoordinates||(this.referenceCoordinates=d);const o=C(t,{active:s,context:l.current,currentCoordinates:d});if(o){const p=_s(o,d),_={x:0,y:0},{scrollableAncestors:y}=l.current;for(const g of y){const n=t.code,{isTop:f,isRight:h,isLeft:u,isBottom:v,maxScroll:x,minScroll:w}=fn(g),k=yl(g),S={x:Math.min(n===we.Right?k.right-k.width/2:k.right,Math.max(n===we.Right?k.left:k.left+k.width/2,o.x)),y:Math.min(n===we.Down?k.bottom-k.height/2:k.bottom,Math.max(n===we.Down?k.top:k.top+k.height/2,o.y))},E=n===we.Right&&!h||n===we.Left&&!u,T=n===we.Down&&!v||n===we.Up&&!f;if(E&&S.x!==o.x){const A=g.scrollLeft+p.x,L=n===we.Right&&A<=x.x||n===we.Left&&A>=w.x;if(L&&!p.y){g.scrollTo({left:A,behavior:r});return}L?_.x=g.scrollLeft-A:_.x=n===we.Right?g.scrollLeft-x.x:g.scrollLeft-w.x,_.x&&g.scrollBy({left:-_.x,behavior:r});break}else if(T&&S.y!==o.y){const A=g.scrollTop+p.y,L=n===we.Down&&A<=x.y||n===we.Up&&A>=w.y;if(L&&!p.x){g.scrollTo({top:A,behavior:r});return}L?_.y=g.scrollTop-A:_.y=n===we.Down?g.scrollTop-x.y:g.scrollTop-w.y,_.y&&g.scrollBy({top:-_.y,behavior:r});break}}this.handleMove(t,At(_s(o,this.referenceCoordinates),_))}}}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()}}gn.activators=[{eventName:"onKeyDown",handler:(e,t,s)=>{let{keyboardCodes:l=vn,onActivation:m}=t,{active:b}=s;const{code:C}=e.nativeEvent;if(l.start.includes(C)){const r=b.activatorNode.current;return r&&e.target!==r?!1:(e.preventDefault(),m?.({event:e.nativeEvent}),!0)}return!1}}];function Vr(e){return!!(e&&"distance"in e)}function Gr(e){return!!(e&&"delay"in e)}class kr{constructor(t,s,l){var m;l===void 0&&(l=kl(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:b}=t,{target:C}=b;this.props=t,this.events=s,this.document=Pt(C),this.documentListeners=new Ht(this.document),this.listeners=new Ht(l),this.windowListeners=new Ht(Ye(C)),this.initialCoordinates=(m=bs(b))!=null?m:it,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(et.Resize,this.handleCancel),this.windowListeners.add(et.DragStart,Yr),this.windowListeners.add(et.VisibilityChange,this.handleCancel),this.windowListeners.add(et.ContextMenu,Yr),this.documentListeners.add(et.Keydown,this.handleKeydown),s){if(l!=null&&l({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Gr(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(Vr(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(et.Click,Rl,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(et.SelectionChange,this.removeTextSelection),s(t))}handleMove(t){var s;const{activated:l,initialCoordinates:m,props:b}=this,{onMove:C,options:{activationConstraint:r}}=b;if(!m)return;const i=(s=bs(t))!=null?s:it,c=_s(m,i);if(!l&&r){if(Vr(r)){if(r.tolerance!=null&&$s(c,r.tolerance))return this.handleCancel();if($s(c,r.distance))return this.handleStart()}if(Gr(r)&&$s(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 jl={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Rr extends kr{constructor(t){const{event:s}=t,l=Pt(s.target);super(t,jl,l)}}Rr.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 Tl={move:{name:"mousemove"},end:{name:"mouseup"}};var nr;(function(e){e[e.RightClick=2]="RightClick"})(nr||(nr={}));class Ll extends kr{constructor(t){super(t,Tl,Pt(t.event.target))}}Ll.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:l}=t;return s.button===nr.RightClick?!1:(l?.({event:s}),!0)}}];const Us={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Al extends kr{constructor(t){super(t,Us)}static setup(){return window.addEventListener(Us.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Us.move.name,t)};function t(){}}}Al.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 zt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(zt||(zt={}));var Ss;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ss||(Ss={}));function Nl(e){let{acceleration:t,activator:s=zt.Pointer,canScroll:l,draggingRect:m,enabled:b,interval:C=5,order:r=Ss.TreeOrder,pointerCoordinates:i,scrollableAncestors:c,scrollableAncestorRects:d,delta:o,threshold:p}=e;const _=Pl({delta:o,disabled:!b}),[y,g]=Ka(),n=R.useRef({x:0,y:0}),f=R.useRef({x:0,y:0}),h=R.useMemo(()=>{switch(s){case zt.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case zt.DraggableRect:return m}},[s,m,i]),u=R.useRef(null),v=R.useCallback(()=>{const w=u.current;if(!w)return;const k=n.current.x*f.current.x,S=n.current.y*f.current.y;w.scrollBy(k,S)},[]),x=R.useMemo(()=>r===Ss.TreeOrder?[...c].reverse():c,[r,c]);R.useEffect(()=>{if(!b||!c.length||!h){g();return}for(const w of x){if(l?.(w)===!1)continue;const k=c.indexOf(w),S=d[k];if(!S)continue;const{direction:E,speed:T}=Sl(w,S,h,t,p);for(const A of["x","y"])_[A][E[A]]||(T[A]=0,E[A]=0);if(T.x>0||T.y>0){g(),u.current=w,y(v,C),n.current=T,f.current=E;return}}n.current={x:0,y:0},f.current={x:0,y:0},g()},[t,v,l,g,b,C,JSON.stringify(h),JSON.stringify(_),y,c,x,d,JSON.stringify(p)])}const Ml={x:{[$e.Backward]:!1,[$e.Forward]:!1},y:{[$e.Backward]:!1,[$e.Forward]:!1}};function Pl(e){let{delta:t,disabled:s}=e;const l=gs(t);return es(m=>{if(s||!l||!m)return Ml;const b={x:Math.sign(t.x-l.x),y:Math.sign(t.y-l.y)};return{x:{[$e.Backward]:m.x[$e.Backward]||b.x===-1,[$e.Forward]:m.x[$e.Forward]||b.x===1},y:{[$e.Backward]:m.y[$e.Backward]||b.y===-1,[$e.Forward]:m.y[$e.Forward]||b.y===1}}},[s,t,l])}function Ol(e,t){const s=t!=null?e.get(t):void 0,l=s?s.node.current:null;return es(m=>{var b;return t==null?null:(b=l??m)!=null?b:null},[l,t])}function Bl(e,t){return R.useMemo(()=>e.reduce((s,l)=>{const{sensor:m}=l,b=m.activators.map(C=>({eventName:C.eventName,handler:t(C.handler,l)}));return[...s,...b]},[]),[e,t])}var Vt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Vt||(Vt={}));var or;(function(e){e.Optimized="optimized"})(or||(or={}));const Qr=new Map;function Il(e,t){let{dragging:s,dependencies:l,config:m}=t;const[b,C]=R.useState(null),{frequency:r,measure:i,strategy:c}=m,d=R.useRef(e),o=n(),p=Xt(o),_=R.useCallback(function(f){f===void 0&&(f=[]),!p.current&&C(h=>h===null?f:h.concat(f.filter(u=>!h.includes(u))))},[p]),y=R.useRef(null),g=es(f=>{if(o&&!s)return Qr;if(!f||f===Qr||d.current!==e||b!=null){const h=new Map;for(let u of e){if(!u)continue;if(b&&b.length>0&&!b.includes(u.id)&&u.rect.current){h.set(u.id,u.rect.current);continue}const v=u.node.current,x=v?new Er(i(v),v):null;u.rect.current=x,x&&h.set(u.id,x)}return h}return f},[e,b,s,o,i]);return R.useEffect(()=>{d.current=e},[e]),R.useEffect(()=>{o||_()},[s,o]),R.useEffect(()=>{b&&b.length>0&&C(null)},[JSON.stringify(b)]),R.useEffect(()=>{o||typeof r!="number"||y.current!==null||(y.current=setTimeout(()=>{_(),y.current=null},r))},[r,o,_,...l]),{droppableRects:g,measureDroppableContainers:_,measuringScheduled:b!=null};function n(){switch(c){case Vt.Always:return!1;case Vt.BeforeDragging:return s;default:return!s}}}function Dr(e,t){return es(s=>e?s||(typeof t=="function"?t(e):e):null,[t,e])}function Fl(e,t){return Dr(e,t)}function Hl(e){let{callback:t,disabled:s}=e;const l=As(t),m=R.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:b}=window;return new b(l)},[l,s]);return R.useEffect(()=>()=>m?.disconnect(),[m]),m}function Ms(e){let{callback:t,disabled:s}=e;const l=As(t),m=R.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:b}=window;return new b(l)},[s]);return R.useEffect(()=>()=>m?.disconnect(),[m]),m}function zl(e){return new Er(ts(e),e)}function Zr(e,t,s){t===void 0&&(t=zl);const[l,m]=R.useState(null);function b(){m(i=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=i??s)!=null?c:null}const d=t(e);return JSON.stringify(i)===JSON.stringify(d)?i:d})}const C=Hl({callback(i){if(e)for(const c of i){const{type:d,target:o}=c;if(d==="childList"&&o instanceof HTMLElement&&o.contains(e)){b();break}}}}),r=Ms({callback:b});return pt(()=>{b(),e?(r?.observe(e),C?.observe(document.body,{childList:!0,subtree:!0})):(r?.disconnect(),C?.disconnect())},[e]),l}function Wl(e){const t=Dr(e);return an(e,t)}const Jr=[];function $l(e){const t=R.useRef(e),s=es(l=>e?l&&l!==Jr&&e&&t.current&&e.parentNode===t.current.parentNode?l:wr(e):Jr,[e]);return R.useEffect(()=>{t.current=e},[e]),s}function Ul(e){const[t,s]=R.useState(null),l=R.useRef(e),m=R.useCallback(b=>{const C=Ws(b.target);C&&s(r=>r?(r.set(C,ir(C)),new Map(r)):null)},[]);return R.useEffect(()=>{const b=l.current;if(e!==b){C(b);const r=e.map(i=>{const c=Ws(i);return c?(c.addEventListener("scroll",m,{passive:!0}),[c,ir(c)]):null}).filter(i=>i!=null);s(r.length?new Map(r):null),l.current=e}return()=>{C(e),C(b)};function C(r){r.forEach(i=>{const c=Ws(i);c?.removeEventListener("scroll",m)})}},[m,e]),R.useMemo(()=>e.length?t?Array.from(t.values()).reduce((b,C)=>At(b,C),it):pn(e):it,[e,t])}function ei(e,t){t===void 0&&(t=[]);const s=R.useRef(null);return R.useEffect(()=>{s.current=null},t),R.useEffect(()=>{const l=e!==it;l&&!s.current&&(s.current=e),!l&&s.current&&(s.current=null)},[e]),s.current?_s(e,s.current):it}function ql(e){R.useEffect(()=>{if(!Ls)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 Kl(e,t){return R.useMemo(()=>e.reduce((s,l)=>{let{eventName:m,handler:b}=l;return s[m]=C=>{b(C,t)},s},{}),[e,t])}function _n(e){return R.useMemo(()=>e?gl(e):null,[e])}const ti=[];function Xl(e,t){t===void 0&&(t=ts);const[s]=e,l=_n(s?Ye(s):null),[m,b]=R.useState(ti);function C(){b(()=>e.length?e.map(i=>dn(i)?l:new Er(t(i),i)):ti)}const r=Ms({callback:C});return pt(()=>{r?.disconnect(),C(),e.forEach(i=>r?.observe(i))},[e]),m}function bn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Jt(t)?t:e}function Yl(e){let{measure:t}=e;const[s,l]=R.useState(null),m=R.useCallback(c=>{for(const{target:d}of c)if(Jt(d)){l(o=>{const p=t(d);return o?{...o,width:p.width,height:p.height}:p});break}},[t]),b=Ms({callback:m}),C=R.useCallback(c=>{const d=bn(c);b?.disconnect(),d&&b?.observe(d),l(d?t(d):null)},[t,b]),[r,i]=vs(C);return R.useMemo(()=>({nodeRef:r,rect:s,setRef:i}),[s,r,i])}const Vl=[{sensor:Rr,options:{}},{sensor:gn,options:{}}],Gl={current:{}},fs={draggable:{measure:Xr},droppable:{measure:Xr,strategy:Vt.WhileDragging,frequency:or.Optimized},dragOverlay:{measure:ts}};class Wt 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 Ql={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Wt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:xs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fs,measureDroppableContainers:xs,windowRect:null,measuringScheduled:!1},xn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:xs,draggableNodes:new Map,over:null,measureDroppableContainers:xs},ss=R.createContext(xn),Sn=R.createContext(Ql);function Zl(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Wt}}}function Jl(e,t){switch(t.type){case Fe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Fe.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 Fe.DragEnd:case Fe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Fe.RegisterDroppable:{const{element:s}=t,{id:l}=s,m=new Wt(e.droppable.containers);return m.set(l,s),{...e,droppable:{...e.droppable,containers:m}}}case Fe.SetDroppableDisabled:{const{id:s,key:l,disabled:m}=t,b=e.droppable.containers.get(s);if(!b||l!==b.key)return e;const C=new Wt(e.droppable.containers);return C.set(s,{...b,disabled:m}),{...e,droppable:{...e.droppable,containers:C}}}case Fe.UnregisterDroppable:{const{id:s,key:l}=t,m=e.droppable.containers.get(s);if(!m||l!==m.key)return e;const b=new Wt(e.droppable.containers);return b.delete(s),{...e,droppable:{...e.droppable,containers:b}}}default:return e}}function ec(e){let{disabled:t}=e;const{active:s,activatorEvent:l,draggableNodes:m}=R.useContext(ss),b=gs(l),C=gs(s?.id);return R.useEffect(()=>{if(!t&&!l&&b&&C!=null){if(!Cr(b)||document.activeElement===b.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 d of[i.current,c.current]){if(!d)continue;const o=Va(d);if(o){o.focus();break}}})}},[l,t,m,C,b]),null}function yn(e,t){let{transform:s,...l}=t;return e!=null&&e.length?e.reduce((m,b)=>b({transform:m,...l}),s):s}function tc(e){return R.useMemo(()=>({draggable:{...fs.draggable,...e?.draggable},droppable:{...fs.droppable,...e?.droppable},dragOverlay:{...fs.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function sc(e){let{activeNode:t,measure:s,initialRect:l,config:m=!0}=e;const b=R.useRef(!1),{x:C,y:r}=typeof m=="boolean"?{x:m,y:m}:m;pt(()=>{if(!C&&!r||!t){b.current=!1;return}if(b.current||!l)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const d=s(c),o=an(d,l);if(C||(o.x=0),r||(o.y=0),b.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const p=cn(c);p&&p.scrollBy({top:o.y,left:o.x})}},[t,C,r,l,s])}const Ps=R.createContext({...it,scaleX:1,scaleY:1});var vt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(vt||(vt={}));const rc=R.memo(function(t){var s,l,m,b;let{id:C,accessibility:r,autoScroll:i=!0,children:c,sensors:d=Vl,collisionDetection:o=ul,measuring:p,modifiers:_,...y}=t;const g=R.useReducer(Jl,void 0,Zl),[n,f]=g,[h,u]=tl(),[v,x]=R.useState(vt.Uninitialized),w=v===vt.Initialized,{draggable:{active:k,nodes:S,translate:E},droppable:{containers:T}}=n,A=k!=null?S.get(k):null,L=R.useRef({initial:null,translated:null}),M=R.useMemo(()=>{var oe;return k!=null?{id:k,data:(oe=A?.data)!=null?oe:Gl,rect:L}:null},[k,A]),B=R.useRef(null),[I,H]=R.useState(null),[W,D]=R.useState(null),N=Xt(y,Object.values(y)),P=Ns("DndDescribedBy",C),O=R.useMemo(()=>T.getEnabled(),[T]),U=tc(p),{droppableRects:X,measureDroppableContainers:V,measuringScheduled:Q}=Il(O,{dragging:w,dependencies:[E.x,E.y],config:U.droppable}),ae=Ol(S,k),j=R.useMemo(()=>W?bs(W):null,[W]),F=re(),$=Fl(ae,U.draggable.measure);sc({activeNode:k!=null?S.get(k):null,config:F.layoutShiftCompensation,initialRect:$,measure:U.draggable.measure});const z=Zr(ae,U.draggable.measure,$),Z=Zr(ae?ae.parentElement:null),K=R.useRef({activatorEvent:null,active:null,activeNode:ae,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=T.getNodeFor((s=K.current.over)==null?void 0:s.id),ue=Yl({measure:U.dragOverlay.measure}),ye=(l=ue.nodeRef.current)!=null?l:ae,je=w?(m=ue.rect)!=null?m:z:null,J=!!(ue.nodeRef.current&&ue.rect),He=Wl(J?null:z),ze=_n(ye?Ye(ye):null),Oe=$l(w?ne??ae:null),Be=Xl(Oe),Te=yn(_,{transform:{x:E.x-He.x,y:E.y-He.y,scaleX:1,scaleY:1},activatorEvent:W,active:M,activeNodeRect:z,containerNodeRect:Z,draggingNodeRect:je,over:K.current.over,overlayNodeRect:ue.rect,scrollableAncestors:Oe,scrollableAncestorRects:Be,windowRect:ze}),G=j?At(j,E):null,ie=Ul(Oe),fe=ei(ie),te=ei(ie,[z]),ge=At(Te,fe),ce=je?pl(je,Te):null,Ce=M&&ce?o({active:M,collisionRect:ce,droppableRects:X,droppableContainers:O,pointerCoordinates:G}):null,Ne=cl(Ce,"id"),[Ie,be]=R.useState(null),Qe=J?Te:At(Te,te),ht=dl(Qe,(b=Ie?.rect)!=null?b:null,z),ut=R.useRef(null),St=R.useCallback((oe,pe)=>{let{sensor:me,options:De}=pe;if(B.current==null)return;const qe=S.get(B.current);if(!qe)return;const Ke=oe.nativeEvent,Ze=new me({active:B.current,activeNode:qe,event:Ke,options:De,context:K,onAbort(Y){if(!S.get(Y))return;const{onDragAbort:Se}=N.current,Ue={id:Y};Se?.(Ue),h({type:"onDragAbort",event:Ue})},onPending(Y,se,Se,Ue){if(!S.get(Y))return;const{onDragPending:ke}=N.current,Je={id:Y,constraint:se,initialCoordinates:Se,offset:Ue};ke?.(Je),h({type:"onDragPending",event:Je})},onStart(Y){const se=B.current;if(se==null)return;const Se=S.get(se);if(!Se)return;const{onDragStart:Ue}=N.current,Xe={activatorEvent:Ke,active:{id:se,data:Se.data,rect:L}};Dt.unstable_batchedUpdates(()=>{Ue?.(Xe),x(vt.Initializing),f({type:Fe.DragStart,initialCoordinates:Y,active:se}),h({type:"onDragStart",event:Xe}),H(ut.current),D(Ke)})},onMove(Y){f({type:Fe.DragMove,coordinates:Y})},onEnd:dt(Fe.DragEnd),onCancel:dt(Fe.DragCancel)});ut.current=Ze;function dt(Y){return async function(){const{active:Se,collisions:Ue,over:Xe,scrollAdjustedTranslate:ke}=K.current;let Je=null;if(Se&&ke){const{cancelDrop:st}=N.current;Je={activatorEvent:Ke,active:Se,collisions:Ue,delta:ke,over:Xe},Y===Fe.DragEnd&&typeof st=="function"&&await Promise.resolve(st(Je))&&(Y=Fe.DragCancel)}B.current=null,Dt.unstable_batchedUpdates(()=>{f({type:Y}),x(vt.Uninitialized),be(null),H(null),D(null),ut.current=null;const st=Y===Fe.DragEnd?"onDragEnd":"onDragCancel";if(Je){const nt=N.current[st];nt?.(Je),h({type:st,event:Je})}})}}},[S]),Rt=R.useCallback((oe,pe)=>(me,De)=>{const qe=me.nativeEvent,Ke=S.get(De);if(B.current!==null||!Ke||qe.dndKit||qe.defaultPrevented)return;const Ze={active:Ke};oe(me,pe.options,Ze)===!0&&(qe.dndKit={capturedBy:pe.sensor},B.current=De,St(me,pe))},[S,St]),yt=Bl(d,Rt);ql(d),pt(()=>{z&&v===vt.Initializing&&x(vt.Initialized)},[z,v]),R.useEffect(()=>{const{onDragMove:oe}=N.current,{active:pe,activatorEvent:me,collisions:De,over:qe}=K.current;if(!pe||!me)return;const Ke={active:pe,activatorEvent:me,collisions:De,delta:{x:ge.x,y:ge.y},over:qe};Dt.unstable_batchedUpdates(()=>{oe?.(Ke),h({type:"onDragMove",event:Ke})})},[ge.x,ge.y]),R.useEffect(()=>{const{active:oe,activatorEvent:pe,collisions:me,droppableContainers:De,scrollAdjustedTranslate:qe}=K.current;if(!oe||B.current==null||!pe||!qe)return;const{onDragOver:Ke}=N.current,Ze=De.get(Ne),dt=Ze&&Ze.rect.current?{id:Ze.id,rect:Ze.rect.current,data:Ze.data,disabled:Ze.disabled}:null,Y={active:oe,activatorEvent:pe,collisions:me,delta:{x:qe.x,y:qe.y},over:dt};Dt.unstable_batchedUpdates(()=>{be(dt),Ke?.(Y),h({type:"onDragOver",event:Y})})},[Ne]),pt(()=>{K.current={activatorEvent:W,active:M,activeNode:ae,collisionRect:ce,collisions:Ce,droppableRects:X,draggableNodes:S,draggingNode:ye,draggingNodeRect:je,droppableContainers:T,over:Ie,scrollableAncestors:Oe,scrollAdjustedTranslate:ge},L.current={initial:je,translated:ce}},[M,ae,Ce,ce,S,ye,je,X,T,Ie,Oe,ge]),Nl({...F,delta:E,draggingRect:ce,pointerCoordinates:G,scrollableAncestors:Oe,scrollableAncestorRects:Be});const Ot=R.useMemo(()=>({active:M,activeNode:ae,activeNodeRect:z,activatorEvent:W,collisions:Ce,containerNodeRect:Z,dragOverlay:ue,draggableNodes:S,droppableContainers:T,droppableRects:X,over:Ie,measureDroppableContainers:V,scrollableAncestors:Oe,scrollableAncestorRects:Be,measuringConfiguration:U,measuringScheduled:Q,windowRect:ze}),[M,ae,z,W,Ce,Z,ue,S,T,X,Ie,V,Oe,Be,U,Q,ze]),q=R.useMemo(()=>({activatorEvent:W,activators:yt,active:M,activeNodeRect:z,ariaDescribedById:{draggable:P},dispatch:f,draggableNodes:S,over:Ie,measureDroppableContainers:V}),[W,yt,M,z,f,P,S,Ie,V]);return ee.createElement(on.Provider,{value:u},ee.createElement(ss.Provider,{value:q},ee.createElement(Sn.Provider,{value:Ot},ee.createElement(Ps.Provider,{value:ht},c)),ee.createElement(ec,{disabled:r?.restoreFocus===!1})),ee.createElement(il,{...r,hiddenTextDescribedById:P}));function re(){const oe=I?.autoScrollEnabled===!1,pe=typeof i=="object"?i.enabled===!1:i===!1,me=w&&!oe&&!pe;return typeof i=="object"?{...i,enabled:me}:{enabled:me}}}),ic=R.createContext(null),si="button",nc="Draggable";function oc(e){let{id:t,data:s,disabled:l=!1,attributes:m}=e;const b=Ns(nc),{activators:C,activatorEvent:r,active:i,activeNodeRect:c,ariaDescribedById:d,draggableNodes:o,over:p}=R.useContext(ss),{role:_=si,roleDescription:y="draggable",tabIndex:g=0}=m??{},n=i?.id===t,f=R.useContext(n?Ps:ic),[h,u]=vs(),[v,x]=vs(),w=Kl(C,t),k=Xt(s);pt(()=>(o.set(t,{id:t,key:b,node:h,activatorNode:v,data:k}),()=>{const E=o.get(t);E&&E.key===b&&o.delete(t)}),[o,t]);const S=R.useMemo(()=>({role:_,tabIndex:g,"aria-disabled":l,"aria-pressed":n&&_===si?!0:void 0,"aria-roledescription":y,"aria-describedby":d.draggable}),[l,_,g,n,y,d.draggable]);return{active:i,activatorEvent:r,activeNodeRect:c,attributes:S,isDragging:n,listeners:l?void 0:w,node:h,over:p,setNodeRef:u,setActivatorNodeRef:x,transform:f}}function ac(){return R.useContext(Sn)}const lc="Droppable",cc={timeout:25};function hc(e){let{data:t,disabled:s=!1,id:l,resizeObserverConfig:m}=e;const b=Ns(lc),{active:C,dispatch:r,over:i,measureDroppableContainers:c}=R.useContext(ss),d=R.useRef({disabled:s}),o=R.useRef(!1),p=R.useRef(null),_=R.useRef(null),{disabled:y,updateMeasurementsFor:g,timeout:n}={...cc,...m},f=Xt(g??l),h=R.useCallback(()=>{if(!o.current){o.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{c(Array.isArray(f.current)?f.current:[f.current]),_.current=null},n)},[n]),u=Ms({callback:h,disabled:y||!C}),v=R.useCallback((S,E)=>{u&&(E&&(u.unobserve(E),o.current=!1),S&&u.observe(S))},[u]),[x,w]=vs(v),k=Xt(t);return R.useEffect(()=>{!u||!x.current||(u.disconnect(),o.current=!1,u.observe(x.current))},[x,u]),R.useEffect(()=>(r({type:Fe.RegisterDroppable,element:{id:l,key:b,disabled:s,node:x,rect:p,data:k}}),()=>r({type:Fe.UnregisterDroppable,key:b,id:l})),[l]),R.useEffect(()=>{s!==d.current.disabled&&(r({type:Fe.SetDroppableDisabled,id:l,key:b,disabled:s}),d.current.disabled=s)},[l,b,s,r]),{active:C,rect:p,isOver:i?.id===l,node:x,over:i,setNodeRef:w}}function uc(e){let{animation:t,children:s}=e;const[l,m]=R.useState(null),[b,C]=R.useState(null),r=gs(s);return!s&&!l&&r&&m(r),pt(()=>{if(!b)return;const i=l?.key,c=l?.props.id;if(i==null||c==null){m(null);return}Promise.resolve(t(c,b)).then(()=>{m(null)})},[t,l,b]),ee.createElement(ee.Fragment,null,s,l?R.cloneElement(l,{ref:C}):null)}const dc={x:0,y:0,scaleX:1,scaleY:1};function fc(e){let{children:t}=e;return ee.createElement(ss.Provider,{value:xn},ee.createElement(Ps.Provider,{value:dc},t))}const pc={position:"fixed",touchAction:"none"},mc=e=>Cr(e)?"transform 250ms ease":void 0,vc=R.forwardRef((e,t)=>{let{as:s,activatorEvent:l,adjustScale:m,children:b,className:C,rect:r,style:i,transform:c,transition:d=mc}=e;if(!r)return null;const o=m?c:{...c,scaleX:1,scaleY:1},p={...pc,width:r.width,height:r.height,top:r.top,left:r.left,transform:Yt.Transform.toString(o),transformOrigin:m&&l?al(l,r):void 0,transition:typeof d=="function"?d(l):d,...i};return ee.createElement(s,{className:C,style:p,ref:t},b)}),gc=e=>t=>{let{active:s,dragOverlay:l}=t;const m={},{styles:b,className:C}=e;if(b!=null&&b.active)for(const[r,i]of Object.entries(b.active))i!==void 0&&(m[r]=s.node.style.getPropertyValue(r),s.node.style.setProperty(r,i));if(b!=null&&b.dragOverlay)for(const[r,i]of Object.entries(b.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)}},_c=e=>{let{transform:{initial:t,final:s}}=e;return[{transform:Yt.Transform.toString(t)},{transform:Yt.Transform.toString(s)}]},bc={duration:250,easing:"ease",keyframes:_c,sideEffects:gc({styles:{active:{opacity:"0"}}})};function xc(e){let{config:t,draggableNodes:s,droppableContainers:l,measuringConfiguration:m}=e;return As((b,C)=>{if(t===null)return;const r=s.get(b);if(!r)return;const i=r.node.current;if(!i)return;const c=bn(C);if(!c)return;const{transform:d}=Ye(C).getComputedStyle(C),o=ln(d);if(!o)return;const p=typeof t=="function"?t:Sc(t);return mn(i,m.draggable.measure),p({active:{id:b,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 Sc(e){const{duration:t,easing:s,sideEffects:l,keyframes:m}={...bc,...e};return b=>{let{active:C,dragOverlay:r,transform:i,...c}=b;if(!t)return;const d={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-d.x,y:i.y-d.y,...o},_=m({...c,active:C,dragOverlay:r,transform:{initial:i,final:p}}),[y]=_,g=_[_.length-1];if(JSON.stringify(y)===JSON.stringify(g))return;const n=l?.({active:C,dragOverlay:r,...c}),f=r.node.animate(_,{duration:t,easing:s,fill:"forwards"});return new Promise(h=>{f.onfinish=()=>{n?.(),h()}})}}let ri=0;function yc(e){return R.useMemo(()=>{if(e!=null)return ri++,ri},[e])}const Cc=ee.memo(e=>{let{adjustScale:t=!1,children:s,dropAnimation:l,style:m,transition:b,modifiers:C,wrapperElement:r="div",className:i,zIndex:c=999}=e;const{activatorEvent:d,active:o,activeNodeRect:p,containerNodeRect:_,draggableNodes:y,droppableContainers:g,dragOverlay:n,over:f,measuringConfiguration:h,scrollableAncestors:u,scrollableAncestorRects:v,windowRect:x}=ac(),w=R.useContext(Ps),k=yc(o?.id),S=yn(C,{activatorEvent:d,active:o,activeNodeRect:p,containerNodeRect:_,draggingNodeRect:n.rect,over:f,overlayNodeRect:n.rect,scrollableAncestors:u,scrollableAncestorRects:v,transform:w,windowRect:x}),E=Dr(p),T=xc({config:l,draggableNodes:y,droppableContainers:g,measuringConfiguration:h}),A=E?n.setRef:void 0;return ee.createElement(fc,null,ee.createElement(uc,{animation:T},o&&k?ee.createElement(vc,{key:k,id:o.id,ref:A,as:r,activatorEvent:d,adjustScale:t,className:i,transition:b,rect:E,style:{zIndex:c,...m},transform:S},s):null))}),le={Review:"Review",Running:"Running",Pending:"Pending",Done:"Done",Cancelled:"Cancelled"},wc=[{status:le.Review,label:"Review",icon:pr,color:"text-amber-600"},{status:le.Running,label:"Running",icon:mr,color:"text-blue-600"},{status:le.Pending,label:"Pending",icon:vr,color:"text-neutral-600"},{status:le.Done,label:"Done",icon:gr,color:"text-emerald-600"},{status:le.Cancelled,label:"Cancelled",icon:_r,color:"text-neutral-500"}];function Ec({task:e,status:t,isSelected:s,isAgentActive:l,project:m,onSelectTask:b,onTaskStatusChange:C,onDeleteTask:r}){const{attributes:i,listeners:c,setNodeRef:d,isDragging:o}=oc({id:e.id,data:{task:e,fromStatus:t}}),[p,_]=R.useState(null),y=R.useRef(null),g=R.useCallback(n=>{!C&&!r||(n.preventDefault(),_({x:n.clientX,y:n.clientY}))},[C,r]);return R.useEffect(()=>{if(!p)return;const n=f=>{y.current&&!y.current.contains(f.target)&&_(null)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[p]),a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:d,onClick:()=>b(e.id),onContextMenu:g,className:`flex items-start pl-8 pr-4 py-2 text-sm w-full text-left transition-all border-l-2 group
|
|
7
7
|
${o?"opacity-30":""}
|
|
8
|
-
${s?"bg-neutral-100 border-neutral-800":"border-transparent hover:bg-neutral-50 hover:border-neutral-200"}`,...c,...i,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,...i,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(pr,{className:s?"text-amber-600":"text-neutral-500"}),t===le.Running&&a.jsx(mr,{className:"animate-pulse"}),t===le.Pending&&a.jsx(vr,{}),t===le.Done&&a.jsx(gr,{className:"text-neutral-400"}),t===le.Cancelled&&a.jsx(_r,{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}),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})]})]}),p&&a.jsxs("div",{ref:y,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:p.x,top:p.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:"移动到"}),wc.filter(n=>n.status!==t).map(n=>{const f=n.icon;return a.jsxs("button",{onClick:()=>{C(e.id,n.status),_(null)},className:"w-full flex items-center gap-2 px-3 py-2 text-xs hover:bg-neutral-50 transition-colors",children:[a.jsx(f,{className:`w-3.5 h-3.5 ${n.color}`}),a.jsx("span",{className:"text-neutral-700",children:n.label})]},n.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),_(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:"删除任务"})]})]})]})]})}const kc=R.memo(function({title:t,tasks:s,status:l,defaultOpen:m,selectedTaskId:b,onSelectTask:C,projects:r,activeTaskIds:i,isDragging:c,dragFromStatus:d,onTaskStatusChange:o,onDeleteTask:p}){const[_,y]=R.useState(m),g=s.length===0,n=c&&d===l,f=c&&d!==l,{setNodeRef:h,isOver:u}=hc({id:`group-${l}`,data:{status:l}}),v=l===le.Review,x=c?n&&(_||!0):_;return a.jsxs("div",{className:"mb-2",children:[a.jsxs("button",{onClick:()=>!c&&y(w=>!w),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:x?a.jsx(mt,{size:14}):a.jsx(kt,{size:14})}),a.jsx("span",{className:"flex-1 text-left",children:t}),v&&!g?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,")"]})]}),f&&a.jsx("div",{ref:h,className:`mx-3 my-1 flex items-center justify-center rounded-lg border-2 border-dashed transition-all duration-150 h-10
|
|
9
9
|
${u?"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:u?`放入 ${t}`:"拖到此处"})}),x&&!f&&a.jsx("div",{ref:n?void 0:h,className:`flex flex-col mt-1 min-h-[40px] rounded-md mx-2 transition-colors
|
|
10
10
|
${u&&!n?"bg-blue-50 ring-1 ring-blue-200":""}
|
|
11
|
-
${g&&c?"border border-dashed border-neutral-300":""}`,children:g?a.jsx("span",{className:"text-xs text-neutral-300 py-2 pl-8",children:"No tasks"}):s.map(w=>{const k=r.find(j=>j.id===w.projectId),y=b===w.id,E=i?.has(w.id)??!1;return a.jsx(Ec,{task:w,status:l,isSelected:y,isAgentActive:E,project:k,onSelectTask:C,onTaskStatusChange:o,onDeleteTask:p},w.id)})})]})}),Rc=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:"0 tasks"})});function Dc(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 Tc=[{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 si({tasks:e=[],projects:t=[],selectedTaskId:s,onSelectTask:l,filterProjectId:m,setFilterProjectId:b,width:C=320,onCreateProject:r,onCreateTask:i,activeTaskIds:c,onTaskStatusChange:d,onDeleteTask:o}){const[p,_]=R.useState(!1),[S,g]=R.useState(null),[n,f]=R.useState(null),h=ol(nl(Rr,{activationConstraint:{distance:8}})),u=R.useCallback(E=>{const j=E.active.data.current?.task,A=E.active.data.current?.fromStatus;j&&g(j),A&&f(A)},[]),v=R.useCallback(E=>{g(null),f(null);const{active:j,over:A}=E;if(!A)return;const L=j.data.current?.task,N=j.data.current?.fromStatus,B=A.data.current?.status;!L||!N||!B||N!==B&&d?.(L.id,B)},[d]),x=m?e.filter(E=>E.projectId===m):e,w=m?t.find(E=>E.id===m)??null:null,k=Dc(x),y=C==="100%";return a.jsxs("div",{className:`h-full flex flex-col bg-white flex-shrink-0 ${y?"":"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:()=>_(E=>!E),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&&w?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${w.color.replace("text-","bg-")}`}),a.jsx("span",{className:"truncate",children:w.name})]}):a.jsxs(a.Fragment,{children:[a.jsx($r,{size:16,className:"text-neutral-500 group-hover:text-neutral-800"}),a.jsx("span",{children:"All Projects"})]}),a.jsx(gt,{size:14,className:`text-neutral-400 ml-auto transition-transform duration-200 ${p?"rotate-180":""}`})]}),p?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>_(!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:"Select View"}),a.jsxs("button",{onClick:()=>{b(null),_(!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($r,{size:12})}),a.jsx("span",{className:m===null?"text-neutral-900 font-medium":"text-neutral-600",children:"All Projects"})]}),m===null?a.jsx(fs,{size:14,className:"text-neutral-900"}):null]}),a.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),t.map(E=>{const j=m===E.id,A=E.color.replace("text-","bg-");return a.jsxs("button",{onClick:()=>{b(E.id),_(!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 ${A}`}),a.jsx("span",{className:j?"text-neutral-900 font-medium":"text-neutral-600",children:E.name})]}),j?a.jsx(fs,{size:14,className:"text-neutral-900"}):null]},E.id)}),a.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),a.jsxs("button",{onClick:()=>{_(!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(sr,{size:14}),a.jsx("span",{children:"Create New Project..."})]})]})]}):null]}),a.jsx("button",{onClick:i,className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors flex-shrink-0",title:"New Task",children:a.jsx(sr,{size:18})})]}),a.jsxs(rc,{sensors:h,onDragStart:u,onDragEnd:v,children:[a.jsx("div",{className:"flex-1 overflow-y-auto py-4 relative",children:Tc.map(({status:E,title:j,defaultOpen:A})=>a.jsx(kc,{title:j,tasks:k[E],status:E,defaultOpen:A,selectedTaskId:s,onSelectTask:l,projects:t,activeTaskIds:c,isDragging:S!==null,dragFromStatus:n,onTaskStatusChange:d,onDeleteTask:o},E))}),a.jsx(Cc,{dropAnimation:null,children:S?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:S.title})}):null})]}),x.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.jsxs("span",{children:[x.length," tasks"]}),m?a.jsx("button",{onClick:()=>b(null),className:"hover:text-neutral-800 underline decoration-neutral-300 underline-offset-2",children:"Clear filter"}):null]}):Rc]})}const jc={damping:.7,stiffness:.05,mass:1.25},Lc=70,Ac=1e3/60,Nc=350;let Ms=!1;globalThis.document?.addEventListener("mousedown",()=>{Ms=!0});globalThis.document?.addEventListener("mouseup",()=>{Ms=!1});globalThis.document?.addEventListener("click",()=>{Ms=!1});const Cn=(e={})=>{const[t,s]=R.useState(!1),[l,m]=R.useState(e.initial!==!1),[b,C]=R.useState(!1),r=R.useRef(null);r.current=e;const i=R.useCallback(()=>{if(!Ms)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=R.useCallback(h=>{o.isAtBottom=h,m(h)},[]),d=R.useCallback(h=>{o.escapedFromLock=h,s(h)},[]),o=R.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||!f.current?0:n.current.scrollHeight-1-n.current.clientHeight},get calculatedTargetScrollTop(){if(!n.current||!f.current)return 0;const{targetScrollTop:u}=this;if(!e.targetScrollTop)return u;if(h?.targetScrollTop===u)return h.calculatedScrollTop;const v=Math.max(Math.min(e.targetScrollTop(u,{scrollElement:n.current,contentElement:f.current}),u),0);return h={targetScrollTop:u,calculatedScrollTop:v},requestAnimationFrame(()=>{h=void 0}),v},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Lc}}},[]),p=R.useCallback((h={})=>{typeof h=="string"&&(h={animation:h}),h.preserveScrollPosition||c(!0);const u=Date.now()+(Number(h.wait)||0),v=qs(r.current,h.animation),{ignoreEscapes:x=!1}=h;let w,k=o.calculatedTargetScrollTop;h.duration instanceof Promise?h.duration.finally(()=>{w=Date.now()}):w=u+(h.duration??0);const y=async()=>{const E=new Promise(requestAnimationFrame).then(()=>{if(!o.isAtBottom)return o.animation=void 0,!1;const{scrollTop:j}=o,A=performance.now(),L=(A-(o.lastTick??A))/Ac;if(o.animation||(o.animation={behavior:v,promise:E,ignoreEscapes:x}),o.animation.behavior===v&&(o.lastTick=A),i()||u>Date.now())return y();if(j<Math.min(k,o.calculatedTargetScrollTop)){if(o.animation?.behavior===v){if(v==="instant")return o.scrollTop=o.calculatedTargetScrollTop,y();o.velocity=(v.damping*o.velocity+v.stiffness*o.scrollDifference)/v.mass,o.accumulated+=o.velocity*L,o.scrollTop+=o.accumulated,o.scrollTop!==j&&(o.accumulated=0)}return y()}return w>Date.now()?(k=o.calculatedTargetScrollTop,y()):(o.animation=void 0,o.scrollTop<o.calculatedTargetScrollTop?p({animation:qs(r.current,r.current.resize),ignoreEscapes:x,duration:Math.max(0,w-Date.now())||void 0}):o.isAtBottom)});return E.then(j=>(requestAnimationFrame(()=>{o.animation||(o.lastTick=void 0,o.velocity=0)}),j))};return h.wait!==!0&&(o.animation=void 0),o.animation?.behavior===v?o.animation.promise:y()},[c,i,o]),_=R.useCallback(()=>{d(!0),c(!1)},[d,c]),S=R.useCallback(({target:h})=>{if(h!==n.current)return;const{scrollTop:u,ignoreScrollToTop:v}=o;let{lastScrollTop:x=u}=o;o.lastScrollTop=u,o.ignoreScrollToTop=void 0,v&&v>u&&(x=v),C(o.isNearBottom),setTimeout(()=>{if(o.resizeDifference||u===v)return;if(i()){d(!0),c(!1);return}const w=u>x,k=u<x;if(o.animation?.ignoreEscapes){o.scrollTop=x;return}k&&(d(!0),c(!1)),w&&d(!1),!o.escapedFromLock&&o.isNearBottom&&c(!0)},1)},[d,c,i,o]),g=R.useCallback(({target:h,deltaY:u})=>{let v=h;for(;!["scroll","auto"].includes(getComputedStyle(v).overflow);){if(!v.parentElement)return;v=v.parentElement}v===n.current&&u<0&&n.current.scrollHeight>n.current.clientHeight&&!o.animation?.ignoreEscapes&&(d(!0),c(!1))},[d,c,o]),n=ri(h=>{n.current?.removeEventListener("scroll",S),n.current?.removeEventListener("wheel",g),h?.addEventListener("scroll",S,{passive:!0}),h?.addEventListener("wheel",g,{passive:!0})},[]),f=ri(h=>{if(o.resizeObserver?.disconnect(),!h)return;let u;o.resizeObserver=new ResizeObserver(([v])=>{const{height:x}=v.contentRect,w=x-(u??x);if(o.resizeDifference=w,o.scrollTop>o.targetScrollTop&&(o.scrollTop=o.targetScrollTop),C(o.isNearBottom),w>=0){const k=qs(r.current,u?r.current.resize:r.current.initial);p({animation:k,wait:!0,preserveScrollPosition:!0,duration:k==="instant"?void 0:Nc})}else o.isNearBottom&&(d(!1),c(!0));u=x,requestAnimationFrame(()=>{setTimeout(()=>{o.resizeDifference===w&&(o.resizeDifference=0)},1)})}),o.resizeObserver?.observe(h)},[]);return{contentRef:f,scrollRef:n,scrollToBottom:p,stopScroll:_,isAtBottom:l||b,isNearBottom:b,escapedFromLock:t,state:o}};function ri(e,t){const s=R.useCallback(l=>(s.current=l,e(l)),t);return s}const Us=new Map;function qs(...e){const t={...jc};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 Us.has(l)||Us.set(l,Object.freeze(t)),s?"instant":Us.get(l)}function wn({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 os(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Mc(e){return e>=.9?"text-red-500":e>=.7?"text-amber-500":"text-neutral-400"}function En({usage:e}){if(!e)return null;const t=e.modelContextWindow,s=t?e.totalTokens/t:0,l=t?Math.min(Math.round(s*100),100):null,m=t?Mc(s):"text-neutral-400",b=t?a.jsxs("span",{children:["上下文: ",os(e.totalTokens)," / ",os(t)," tokens"]}):a.jsxs("span",{children:["已使用: ",os(e.totalTokens)," tokens"]});return a.jsx(wn,{content:b,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:m}),a.jsxs("span",{className:`tabular-nums ${m}`,children:[os(e.totalTokens),l!==null&&a.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",l,"%"]})]})]})})}var Ks={exports:{}},ii;function Pc(){return ii||(ii=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,v,x,w){var k,y=arguments.length,E=y<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,x):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(u,v,x,w);else for(var j=u.length-1;j>=0;j--)(k=u[j])&&(E=(y<3?k(E):y>3?k(v,x,E):k(v,x))||E);return y>3&&E&&Object.defineProperty(v,x,E),E},d=this&&this.__param||function(u,v){return function(x,w){v(x,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const o=i(9042),p=i(6114),_=i(9924),S=i(844),g=i(5596),n=i(4725),f=i(3656);let h=r.AccessibilityManager=class extends S.Disposable{constructor(u,v){super(),this._terminal=u,this._renderService=v,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 x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,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 _.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((x=>this._handleResize(x.rows)))),this.register(this._terminal.onRender((x=>this._refreshRows(x.start,x.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((x=>this._handleChar(x)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
12
|
-
`)))),this.register(this._terminal.onA11yTab((x=>this._handleTab(x)))),this.register(this._terminal.onKey((x=>this._handleKey(x.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,f.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,
|
|
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,v){this._liveRegionDebouncer.refresh(u,v,this._terminal.rows)}_renderRows(u,v){const x=this._terminal.buffer,w=x.lines.length.toString();for(let k=u;k<=v;k++){const y=x.translateBufferLineToString(x.ydisp+k,!0),E=(x.ydisp+k+1).toString(),j=this._rowElements[k];j&&(y.length===0?j.innerText=" ":j.textContent=y,j.setAttribute("aria-posinset",E),j.setAttribute("aria-setsize",w))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(u,v){const x=u.target,w=this._rowElements[v===0?1:this._rowElements.length-2];if(x.getAttribute("aria-posinset")===(v===0?"1":`${this._terminal.buffer.lines.length}`)||u.relatedTarget!==w)return;let k,y;if(v===0?(k=x,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(k=this._rowElements.shift(),y=x,this._rowContainer.removeChild(k)),k.removeEventListener("focus",this._topBoundaryFocusListener),y.removeEventListener("focus",this._bottomBoundaryFocusListener),v===0){const E=this._createAccessibilityTreeNode();this._rowElements.unshift(E),this._rowContainer.insertAdjacentElement("afterbegin",E)}else{const E=this._createAccessibilityTreeNode();this._rowElements.push(E),this._rowContainer.appendChild(E)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(v===0?-1:1),this._rowElements[v===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 v=this._rowContainer.children.length;v<this._terminal.rows;v++)this._rowElements[v]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[v]);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([d(1,n.IRenderService)],h)},3614:(C,r)=>{function i(p){return p.replace(/\r?\n/g,"\r")}function c(p,_){return _?"\x1B[200~"+p+"\x1B[201~":p}function d(p,_,S,g){p=c(p=i(p),S.decPrivateModes.bracketedPasteMode&&g.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(p,!0),_.value=""}function o(p,_,S){const g=S.getBoundingClientRect(),n=p.clientX-g.left-10,f=p.clientY-g.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${n}px`,_.style.top=`${f}px`,_.style.zIndex="1000",_.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,_){p.clipboardData&&p.clipboardData.setData("text/plain",_.selectionText),p.preventDefault()},r.handlePasteEvent=function(p,_,S,g){p.stopPropagation(),p.clipboardData&&d(p.clipboardData.getData("text/plain"),_,S,g)},r.paste=d,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(p,_,S,g,n){o(p,_,S),n&&g.rightClickSelect(p),_.value=g.selectionText,_.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(d,o,p){this._css.set(d,o,p)}getCss(d,o){return this._css.get(d,o)}setColor(d,o,p){this._color.set(d,o,p)}getColor(d,o){return this._color.get(d,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,d,o){i.addEventListener(c,d,o);let p=!1;return{dispose:()=>{p||(p=!0,i.removeEventListener(c,d,o))}}}},6465:function(C,r,i){var c=this&&this.__decorate||function(n,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const o=i(3656),p=i(8460),_=i(844),S=i(2585);let g=r.Linkifier2=class extends _.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,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(n){return this._linkProviders.push(n),{dispose:()=>{const f=this._linkProviders.indexOf(n);f!==-1&&this._linkProviders.splice(f,1)}}}attachToDom(n,f,h){this._element=n,this._mouseService=f,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 f=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!f)return;this._isMouseOut=!1;const h=n.composedPath();for(let u=0;u<h.length;u++){const v=h[u];if(v.classList.contains("xterm"))break;if(v.classList.contains("xterm-hover"))return}this._lastBufferCell&&f.x===this._lastBufferCell.x&&f.y===this._lastBufferCell.y||(this._handleHover(f),this._lastBufferCell=f)}_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,f){var h,u;this._activeProviderReplies&&f||((h=this._activeProviderReplies)===null||h===void 0||h.forEach((x=>{x?.forEach((w=>{w.link.dispose&&w.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=n.y);let v=!1;for(const[x,w]of this._linkProviders.entries())f?!((u=this._activeProviderReplies)===null||u===void 0)&&u.get(x)&&(v=this._checkLinkProviderResult(x,n,v)):w.provideLinks(n.y,(k=>{var y,E;if(this._isMouseOut)return;const j=k?.map((A=>({link:A})));(y=this._activeProviderReplies)===null||y===void 0||y.set(x,j),v=this._checkLinkProviderResult(x,n,v),((E=this._activeProviderReplies)===null||E===void 0?void 0:E.size)===this._linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)}))}_removeIntersectingLinks(n,f){const h=new Set;for(let u=0;u<f.size;u++){const v=f.get(u);if(v)for(let x=0;x<v.length;x++){const w=v[x],k=w.link.range.start.y<n?0:w.link.range.start.x,y=w.link.range.end.y>n?this._bufferService.cols:w.link.range.end.x;for(let E=k;E<=y;E++){if(h.has(E)){v.splice(x--,1);break}h.add(E)}}}}_checkLinkProviderResult(n,f,h){var u;if(!this._activeProviderReplies)return h;const v=this._activeProviderReplies.get(n);let x=!1;for(let w=0;w<n;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(x=!0);if(!x&&v){const w=v.find((k=>this._linkAtPosition(k.link,f)));w&&(h=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviders.length&&!h)for(let w=0;w<this._activeProviderReplies.size;w++){const k=(u=this._activeProviderReplies.get(w))===null||u===void 0?void 0:u.find((y=>this._linkAtPosition(y.link,f)));if(k){h=!0,this._handleNewLink(k);break}}return h}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._element||!this._mouseService||!this._currentLink)return;const f=this._positionFromMouseEvent(n,this._element,this._mouseService);f&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,f)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,f){this._element&&this._currentLink&&this._lastMouseEvent&&(!n||!f||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=f)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const f=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);f&&this._linkAtPosition(n.link,f)&&(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,v;!((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&&((v=this._element)===null||v===void 0||v.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,v,x;!((u=this._currentLink)===null||u===void 0)&&u.state&&((x=(v=this._currentLink)===null||v===void 0?void 0:v.state)===null||x===void 0?void 0:x.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,v=this._bufferService.buffer.ydisp+1+h.end;if(this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=v&&(this._clearCurrentLink(u,v),this._lastMouseEvent&&this._element)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}}))))}_linkHover(n,f,h){var u;!((u=this._currentLink)===null||u===void 0)&&u.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(f,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),f.hover&&f.hover(h,f.text)}_fireUnderlineEvent(n,f){const h=n.range,u=this._bufferService.buffer.ydisp,v=this._createLinkUnderlineEvent(h.start.x-1,h.start.y-u-1,h.end.x,h.end.y-u-1,void 0);(f?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(v)}_linkLeave(n,f,h){var u;!((u=this._currentLink)===null||u===void 0)&&u.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(f,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),f.leave&&f.leave(h,f.text)}_linkAtPosition(n,f){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,v=f.y*this._bufferService.cols+f.x;return h<=v&&v<=u}_positionFromMouseEvent(n,f,h){const u=h.getCoords(n,f,this._bufferService.cols,this._bufferService.rows);if(u)return{x:u[0],y:u[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,f,h,u,v){return{x1:n,y1:f,x2:h,y2:u,cols:this._bufferService.cols,fg:v}}};r.Linkifier2=g=c([d(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,f,h){var u,v=arguments.length,x=v<3?n:h===null?h=Object.getOwnPropertyDescriptor(n,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,n,f,h);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(x=(v<3?u(x):v>3?u(n,f,x):u(n,f))||x);return v>3&&x&&Object.defineProperty(n,f,x),x},d=this&&this.__param||function(g,n){return function(f,h){n(f,h,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const o=i(511),p=i(2585);let _=r.OscLinkProvider=class{constructor(g,n,f){this._bufferService=g,this._optionsService=n,this._oscLinkService=f}provideLinks(g,n){var f;const h=this._bufferService.buffer.lines.get(g-1);if(!h)return void n(void 0);const u=[],v=this._optionsService.rawOptions.linkHandler,x=new o.CellData,w=h.getTrimmedLength();let k=-1,y=-1,E=!1;for(let j=0;j<w;j++)if(y!==-1||h.hasContent(j)){if(h.loadCell(j,x),x.hasExtendedAttrs()&&x.extended.urlId){if(y===-1){y=j,k=x.extended.urlId;continue}E=x.extended.urlId!==k}else y!==-1&&(E=!0);if(E||y!==-1&&j===w-1){const A=(f=this._oscLinkService.getLinkData(k))===null||f===void 0?void 0:f.uri;if(A){const L={start:{x:y+1,y:g},end:{x:j+(E||j!==w-1?0:1),y:g}};let N=!1;if(!v?.allowNonHttpProtocols)try{const B=new URL(A);["http:","https:"].includes(B.protocol)||(N=!0)}catch{N=!0}N||u.push({text:A,range:L,activate:(B,I)=>v?v.activate(B,I,L):S(0,I),hover:(B,I)=>{var H;return(H=v?.hover)===null||H===void 0?void 0:H.call(v,B,I,L)},leave:(B,I)=>{var H;return(H=v?.leave)===null||H===void 0?void 0:H.call(v,B,I,L)}})}E=!1,x.hasExtendedAttrs()&&x.extended.urlId?(y=j,k=x.extended.urlId):(y=-1,k=-1)}}n(u)}};function S(g,n){if(confirm(`Do you want to navigate to ${n}?
|
|
11
|
+
${g&&c?"border border-dashed border-neutral-300":""}`,children:g?a.jsx("span",{className:"text-xs text-neutral-300 py-2 pl-8",children:"No tasks"}):s.map(w=>{const k=r.find(T=>T.id===w.projectId),S=b===w.id,E=i?.has(w.id)??!1;return a.jsx(Ec,{task:w,status:l,isSelected:S,isAgentActive:E,project:k,onSelectTask:C,onTaskStatusChange:o,onDeleteTask:p},w.id)})})]})}),Rc=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:"0 tasks"})});function Dc(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 jc=[{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 ii({tasks:e=[],projects:t=[],selectedTaskId:s,onSelectTask:l,filterProjectId:m,setFilterProjectId:b,width:C=320,onCreateProject:r,onCreateTask:i,activeTaskIds:c,onTaskStatusChange:d,onDeleteTask:o}){const[p,_]=R.useState(!1),[y,g]=R.useState(null),[n,f]=R.useState(null),h=ol(nl(Rr,{activationConstraint:{distance:8}})),u=R.useCallback(E=>{const T=E.active.data.current?.task,A=E.active.data.current?.fromStatus;T&&g(T),A&&f(A)},[]),v=R.useCallback(E=>{g(null),f(null);const{active:T,over:A}=E;if(!A)return;const L=T.data.current?.task,M=T.data.current?.fromStatus,B=A.data.current?.status;!L||!M||!B||M!==B&&d?.(L.id,B)},[d]),x=m?e.filter(E=>E.projectId===m):e,w=m?t.find(E=>E.id===m)??null:null,k=Dc(x),S=C==="100%";return a.jsxs("div",{className:`h-full flex flex-col bg-white flex-shrink-0 ${S?"":"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:()=>_(E=>!E),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&&w?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${w.color.replace("text-","bg-")}`}),a.jsx("span",{className:"truncate",children:w.name})]}):a.jsxs(a.Fragment,{children:[a.jsx(qr,{size:16,className:"text-neutral-500 group-hover:text-neutral-800"}),a.jsx("span",{children:"All Projects"})]}),a.jsx(mt,{size:14,className:`text-neutral-400 ml-auto transition-transform duration-200 ${p?"rotate-180":""}`})]}),p?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>_(!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:"Select View"}),a.jsxs("button",{onClick:()=>{b(null),_(!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(qr,{size:12})}),a.jsx("span",{className:m===null?"text-neutral-900 font-medium":"text-neutral-600",children:"All Projects"})]}),m===null?a.jsx(Ut,{size:14,className:"text-neutral-900"}):null]}),a.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),t.map(E=>{const T=m===E.id,A=E.color.replace("text-","bg-");return a.jsxs("button",{onClick:()=>{b(E.id),_(!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 ${A}`}),a.jsx("span",{className:T?"text-neutral-900 font-medium":"text-neutral-600",children:E.name})]}),T?a.jsx(Ut,{size:14,className:"text-neutral-900"}):null]},E.id)}),a.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),a.jsxs("button",{onClick:()=>{_(!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(rr,{size:14}),a.jsx("span",{children:"Create New Project..."})]})]})]}):null]}),a.jsx("button",{onClick:i,className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors flex-shrink-0",title:"New Task",children:a.jsx(rr,{size:18})})]}),a.jsxs(rc,{sensors:h,onDragStart:u,onDragEnd:v,children:[a.jsx("div",{className:"flex-1 overflow-y-auto py-4 relative",children:jc.map(({status:E,title:T,defaultOpen:A})=>a.jsx(kc,{title:T,tasks:k[E],status:E,defaultOpen:A,selectedTaskId:s,onSelectTask:l,projects:t,activeTaskIds:c,isDragging:y!==null,dragFromStatus:n,onTaskStatusChange:d,onDeleteTask:o},E))}),a.jsx(Cc,{dropAnimation:null,children:y?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:y.title})}):null})]}),x.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.jsxs("span",{children:[x.length," tasks"]}),m?a.jsx("button",{onClick:()=>b(null),className:"hover:text-neutral-800 underline decoration-neutral-300 underline-offset-2",children:"Clear filter"}):null]}):Rc]})}const Tc={damping:.7,stiffness:.05,mass:1.25},Lc=70,Ac=1e3/60,Nc=350;let Os=!1;globalThis.document?.addEventListener("mousedown",()=>{Os=!0});globalThis.document?.addEventListener("mouseup",()=>{Os=!1});globalThis.document?.addEventListener("click",()=>{Os=!1});const Cn=(e={})=>{const[t,s]=R.useState(!1),[l,m]=R.useState(e.initial!==!1),[b,C]=R.useState(!1),r=R.useRef(null);r.current=e;const i=R.useCallback(()=>{if(!Os)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=R.useCallback(h=>{o.isAtBottom=h,m(h)},[]),d=R.useCallback(h=>{o.escapedFromLock=h,s(h)},[]),o=R.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||!f.current?0:n.current.scrollHeight-1-n.current.clientHeight},get calculatedTargetScrollTop(){if(!n.current||!f.current)return 0;const{targetScrollTop:u}=this;if(!e.targetScrollTop)return u;if(h?.targetScrollTop===u)return h.calculatedScrollTop;const v=Math.max(Math.min(e.targetScrollTop(u,{scrollElement:n.current,contentElement:f.current}),u),0);return h={targetScrollTop:u,calculatedScrollTop:v},requestAnimationFrame(()=>{h=void 0}),v},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Lc}}},[]),p=R.useCallback((h={})=>{typeof h=="string"&&(h={animation:h}),h.preserveScrollPosition||c(!0);const u=Date.now()+(Number(h.wait)||0),v=Ks(r.current,h.animation),{ignoreEscapes:x=!1}=h;let w,k=o.calculatedTargetScrollTop;h.duration instanceof Promise?h.duration.finally(()=>{w=Date.now()}):w=u+(h.duration??0);const S=async()=>{const E=new Promise(requestAnimationFrame).then(()=>{if(!o.isAtBottom)return o.animation=void 0,!1;const{scrollTop:T}=o,A=performance.now(),L=(A-(o.lastTick??A))/Ac;if(o.animation||(o.animation={behavior:v,promise:E,ignoreEscapes:x}),o.animation.behavior===v&&(o.lastTick=A),i()||u>Date.now())return S();if(T<Math.min(k,o.calculatedTargetScrollTop)){if(o.animation?.behavior===v){if(v==="instant")return o.scrollTop=o.calculatedTargetScrollTop,S();o.velocity=(v.damping*o.velocity+v.stiffness*o.scrollDifference)/v.mass,o.accumulated+=o.velocity*L,o.scrollTop+=o.accumulated,o.scrollTop!==T&&(o.accumulated=0)}return S()}return w>Date.now()?(k=o.calculatedTargetScrollTop,S()):(o.animation=void 0,o.scrollTop<o.calculatedTargetScrollTop?p({animation:Ks(r.current,r.current.resize),ignoreEscapes:x,duration:Math.max(0,w-Date.now())||void 0}):o.isAtBottom)});return E.then(T=>(requestAnimationFrame(()=>{o.animation||(o.lastTick=void 0,o.velocity=0)}),T))};return h.wait!==!0&&(o.animation=void 0),o.animation?.behavior===v?o.animation.promise:S()},[c,i,o]),_=R.useCallback(()=>{d(!0),c(!1)},[d,c]),y=R.useCallback(({target:h})=>{if(h!==n.current)return;const{scrollTop:u,ignoreScrollToTop:v}=o;let{lastScrollTop:x=u}=o;o.lastScrollTop=u,o.ignoreScrollToTop=void 0,v&&v>u&&(x=v),C(o.isNearBottom),setTimeout(()=>{if(o.resizeDifference||u===v)return;if(i()){d(!0),c(!1);return}const w=u>x,k=u<x;if(o.animation?.ignoreEscapes){o.scrollTop=x;return}k&&(d(!0),c(!1)),w&&d(!1),!o.escapedFromLock&&o.isNearBottom&&c(!0)},1)},[d,c,i,o]),g=R.useCallback(({target:h,deltaY:u})=>{let v=h;for(;!["scroll","auto"].includes(getComputedStyle(v).overflow);){if(!v.parentElement)return;v=v.parentElement}v===n.current&&u<0&&n.current.scrollHeight>n.current.clientHeight&&!o.animation?.ignoreEscapes&&(d(!0),c(!1))},[d,c,o]),n=ni(h=>{n.current?.removeEventListener("scroll",y),n.current?.removeEventListener("wheel",g),h?.addEventListener("scroll",y,{passive:!0}),h?.addEventListener("wheel",g,{passive:!0})},[]),f=ni(h=>{if(o.resizeObserver?.disconnect(),!h)return;let u;o.resizeObserver=new ResizeObserver(([v])=>{const{height:x}=v.contentRect,w=x-(u??x);if(o.resizeDifference=w,o.scrollTop>o.targetScrollTop&&(o.scrollTop=o.targetScrollTop),C(o.isNearBottom),w>=0){const k=Ks(r.current,u?r.current.resize:r.current.initial);p({animation:k,wait:!0,preserveScrollPosition:!0,duration:k==="instant"?void 0:Nc})}else o.isNearBottom&&(d(!1),c(!0));u=x,requestAnimationFrame(()=>{setTimeout(()=>{o.resizeDifference===w&&(o.resizeDifference=0)},1)})}),o.resizeObserver?.observe(h)},[]);return{contentRef:f,scrollRef:n,scrollToBottom:p,stopScroll:_,isAtBottom:l||b,isNearBottom:b,escapedFromLock:t,state:o}};function ni(e,t){const s=R.useCallback(l=>(s.current=l,e(l)),t);return s}const qs=new Map;function Ks(...e){const t={...Tc};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 qs.has(l)||qs.set(l,Object.freeze(t)),s?"instant":qs.get(l)}function Mc({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 ls(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Pc(e){return e>=.9?"text-red-500":e>=.7?"text-amber-500":"text-neutral-400"}function wn({usage:e}){if(!e)return null;const t=e.modelContextWindow,s=t?e.totalTokens/t:0,l=t?Math.min(Math.round(s*100),100):null,m=t?Pc(s):"text-neutral-400",b=t?a.jsxs("span",{children:["上下文: ",ls(e.totalTokens)," / ",ls(t)," tokens"]}):a.jsxs("span",{children:["已使用: ",ls(e.totalTokens)," tokens"]});return a.jsx(Mc,{content:b,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:m}),a.jsxs("span",{className:`tabular-nums ${m}`,children:[ls(e.totalTokens),l!==null&&a.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",l,"%"]})]})]})})}var Xs={exports:{}},oi;function Oc(){return oi||(oi=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,v,x,w){var k,S=arguments.length,E=S<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,x):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(u,v,x,w);else for(var T=u.length-1;T>=0;T--)(k=u[T])&&(E=(S<3?k(E):S>3?k(v,x,E):k(v,x))||E);return S>3&&E&&Object.defineProperty(v,x,E),E},d=this&&this.__param||function(u,v){return function(x,w){v(x,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const o=i(9042),p=i(6114),_=i(9924),y=i(844),g=i(5596),n=i(4725),f=i(3656);let h=r.AccessibilityManager=class extends y.Disposable{constructor(u,v){super(),this._terminal=u,this._renderService=v,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 x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,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 _.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((x=>this._handleResize(x.rows)))),this.register(this._terminal.onRender((x=>this._refreshRows(x.start,x.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((x=>this._handleChar(x)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
12
|
+
`)))),this.register(this._terminal.onA11yTab((x=>this._handleTab(x)))),this.register(this._terminal.onKey((x=>this._handleKey(x.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,f.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,y.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(u){for(let v=0;v<u;v++)this._handleChar(" ")}_handleChar(u){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==u&&(this._charsToAnnounce+=u):this._charsToAnnounce+=u,u===`
|
|
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,v){this._liveRegionDebouncer.refresh(u,v,this._terminal.rows)}_renderRows(u,v){const x=this._terminal.buffer,w=x.lines.length.toString();for(let k=u;k<=v;k++){const S=x.translateBufferLineToString(x.ydisp+k,!0),E=(x.ydisp+k+1).toString(),T=this._rowElements[k];T&&(S.length===0?T.innerText=" ":T.textContent=S,T.setAttribute("aria-posinset",E),T.setAttribute("aria-setsize",w))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(u,v){const x=u.target,w=this._rowElements[v===0?1:this._rowElements.length-2];if(x.getAttribute("aria-posinset")===(v===0?"1":`${this._terminal.buffer.lines.length}`)||u.relatedTarget!==w)return;let k,S;if(v===0?(k=x,S=this._rowElements.pop(),this._rowContainer.removeChild(S)):(k=this._rowElements.shift(),S=x,this._rowContainer.removeChild(k)),k.removeEventListener("focus",this._topBoundaryFocusListener),S.removeEventListener("focus",this._bottomBoundaryFocusListener),v===0){const E=this._createAccessibilityTreeNode();this._rowElements.unshift(E),this._rowContainer.insertAdjacentElement("afterbegin",E)}else{const E=this._createAccessibilityTreeNode();this._rowElements.push(E),this._rowContainer.appendChild(E)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(v===0?-1:1),this._rowElements[v===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 v=this._rowContainer.children.length;v<this._terminal.rows;v++)this._rowElements[v]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[v]);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([d(1,n.IRenderService)],h)},3614:(C,r)=>{function i(p){return p.replace(/\r?\n/g,"\r")}function c(p,_){return _?"\x1B[200~"+p+"\x1B[201~":p}function d(p,_,y,g){p=c(p=i(p),y.decPrivateModes.bracketedPasteMode&&g.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(p,!0),_.value=""}function o(p,_,y){const g=y.getBoundingClientRect(),n=p.clientX-g.left-10,f=p.clientY-g.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${n}px`,_.style.top=`${f}px`,_.style.zIndex="1000",_.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,_){p.clipboardData&&p.clipboardData.setData("text/plain",_.selectionText),p.preventDefault()},r.handlePasteEvent=function(p,_,y,g){p.stopPropagation(),p.clipboardData&&d(p.clipboardData.getData("text/plain"),_,y,g)},r.paste=d,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(p,_,y,g,n){o(p,_,y),n&&g.rightClickSelect(p),_.value=g.selectionText,_.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(d,o,p){this._css.set(d,o,p)}getCss(d,o){return this._css.get(d,o)}setColor(d,o,p){this._color.set(d,o,p)}getColor(d,o){return this._color.get(d,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,d,o){i.addEventListener(c,d,o);let p=!1;return{dispose:()=>{p||(p=!0,i.removeEventListener(c,d,o))}}}},6465:function(C,r,i){var c=this&&this.__decorate||function(n,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const o=i(3656),p=i(8460),_=i(844),y=i(2585);let g=r.Linkifier2=class extends _.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,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(n){return this._linkProviders.push(n),{dispose:()=>{const f=this._linkProviders.indexOf(n);f!==-1&&this._linkProviders.splice(f,1)}}}attachToDom(n,f,h){this._element=n,this._mouseService=f,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 f=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!f)return;this._isMouseOut=!1;const h=n.composedPath();for(let u=0;u<h.length;u++){const v=h[u];if(v.classList.contains("xterm"))break;if(v.classList.contains("xterm-hover"))return}this._lastBufferCell&&f.x===this._lastBufferCell.x&&f.y===this._lastBufferCell.y||(this._handleHover(f),this._lastBufferCell=f)}_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,f){var h,u;this._activeProviderReplies&&f||((h=this._activeProviderReplies)===null||h===void 0||h.forEach((x=>{x?.forEach((w=>{w.link.dispose&&w.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=n.y);let v=!1;for(const[x,w]of this._linkProviders.entries())f?!((u=this._activeProviderReplies)===null||u===void 0)&&u.get(x)&&(v=this._checkLinkProviderResult(x,n,v)):w.provideLinks(n.y,(k=>{var S,E;if(this._isMouseOut)return;const T=k?.map((A=>({link:A})));(S=this._activeProviderReplies)===null||S===void 0||S.set(x,T),v=this._checkLinkProviderResult(x,n,v),((E=this._activeProviderReplies)===null||E===void 0?void 0:E.size)===this._linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)}))}_removeIntersectingLinks(n,f){const h=new Set;for(let u=0;u<f.size;u++){const v=f.get(u);if(v)for(let x=0;x<v.length;x++){const w=v[x],k=w.link.range.start.y<n?0:w.link.range.start.x,S=w.link.range.end.y>n?this._bufferService.cols:w.link.range.end.x;for(let E=k;E<=S;E++){if(h.has(E)){v.splice(x--,1);break}h.add(E)}}}}_checkLinkProviderResult(n,f,h){var u;if(!this._activeProviderReplies)return h;const v=this._activeProviderReplies.get(n);let x=!1;for(let w=0;w<n;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(x=!0);if(!x&&v){const w=v.find((k=>this._linkAtPosition(k.link,f)));w&&(h=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviders.length&&!h)for(let w=0;w<this._activeProviderReplies.size;w++){const k=(u=this._activeProviderReplies.get(w))===null||u===void 0?void 0:u.find((S=>this._linkAtPosition(S.link,f)));if(k){h=!0,this._handleNewLink(k);break}}return h}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._element||!this._mouseService||!this._currentLink)return;const f=this._positionFromMouseEvent(n,this._element,this._mouseService);f&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,f)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,f){this._element&&this._currentLink&&this._lastMouseEvent&&(!n||!f||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=f)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const f=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);f&&this._linkAtPosition(n.link,f)&&(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,v;!((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&&((v=this._element)===null||v===void 0||v.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,v,x;!((u=this._currentLink)===null||u===void 0)&&u.state&&((x=(v=this._currentLink)===null||v===void 0?void 0:v.state)===null||x===void 0?void 0:x.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,v=this._bufferService.buffer.ydisp+1+h.end;if(this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=v&&(this._clearCurrentLink(u,v),this._lastMouseEvent&&this._element)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}}))))}_linkHover(n,f,h){var u;!((u=this._currentLink)===null||u===void 0)&&u.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(f,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),f.hover&&f.hover(h,f.text)}_fireUnderlineEvent(n,f){const h=n.range,u=this._bufferService.buffer.ydisp,v=this._createLinkUnderlineEvent(h.start.x-1,h.start.y-u-1,h.end.x,h.end.y-u-1,void 0);(f?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(v)}_linkLeave(n,f,h){var u;!((u=this._currentLink)===null||u===void 0)&&u.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(f,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),f.leave&&f.leave(h,f.text)}_linkAtPosition(n,f){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,v=f.y*this._bufferService.cols+f.x;return h<=v&&v<=u}_positionFromMouseEvent(n,f,h){const u=h.getCoords(n,f,this._bufferService.cols,this._bufferService.rows);if(u)return{x:u[0],y:u[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,f,h,u,v){return{x1:n,y1:f,x2:h,y2:u,cols:this._bufferService.cols,fg:v}}};r.Linkifier2=g=c([d(0,y.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,f,h){var u,v=arguments.length,x=v<3?n:h===null?h=Object.getOwnPropertyDescriptor(n,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,n,f,h);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(x=(v<3?u(x):v>3?u(n,f,x):u(n,f))||x);return v>3&&x&&Object.defineProperty(n,f,x),x},d=this&&this.__param||function(g,n){return function(f,h){n(f,h,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const o=i(511),p=i(2585);let _=r.OscLinkProvider=class{constructor(g,n,f){this._bufferService=g,this._optionsService=n,this._oscLinkService=f}provideLinks(g,n){var f;const h=this._bufferService.buffer.lines.get(g-1);if(!h)return void n(void 0);const u=[],v=this._optionsService.rawOptions.linkHandler,x=new o.CellData,w=h.getTrimmedLength();let k=-1,S=-1,E=!1;for(let T=0;T<w;T++)if(S!==-1||h.hasContent(T)){if(h.loadCell(T,x),x.hasExtendedAttrs()&&x.extended.urlId){if(S===-1){S=T,k=x.extended.urlId;continue}E=x.extended.urlId!==k}else S!==-1&&(E=!0);if(E||S!==-1&&T===w-1){const A=(f=this._oscLinkService.getLinkData(k))===null||f===void 0?void 0:f.uri;if(A){const L={start:{x:S+1,y:g},end:{x:T+(E||T!==w-1?0:1),y:g}};let M=!1;if(!v?.allowNonHttpProtocols)try{const B=new URL(A);["http:","https:"].includes(B.protocol)||(M=!0)}catch{M=!0}M||u.push({text:A,range:L,activate:(B,I)=>v?v.activate(B,I,L):y(0,I),hover:(B,I)=>{var H;return(H=v?.hover)===null||H===void 0?void 0:H.call(v,B,I,L)},leave:(B,I)=>{var H;return(H=v?.leave)===null||H===void 0?void 0:H.call(v,B,I,L)}})}E=!1,x.hasExtendedAttrs()&&x.extended.urlId?(S=T,k=x.extended.urlId):(S=-1,k=-1)}}n(u)}};function y(g,n){if(confirm(`Do you want to navigate to ${n}?
|
|
14
14
|
|
|
15
|
-
WARNING: This link could potentially be dangerous`)){const f=window.open();if(f){try{f.opener=null}catch{}f.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=_=c([d(0,p.IBufferService),d(1,p.IOptionsService),d(2,p.IOscLinkService)],_)},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,d){this._rowCount=d,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 d 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=d},3236:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const c=i(3614),d=i(3656),o=i(6465),p=i(9042),_=i(3730),S=i(1680),g=i(3107),n=i(5744),f=i(2950),h=i(1296),u=i(428),v=i(4269),x=i(5114),w=i(8934),k=i(3230),y=i(9312),E=i(4725),j=i(6731),A=i(8055),L=i(8969),N=i(8460),B=i(844),I=i(6114),H=i(8437),W=i(2584),D=i(7399),M=i(5941),P=i(9074),O=i(2585),U=i(5435),K=i(4567),V=typeof window<"u"?window.document:null;class Y 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(T={}){super(T),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 N.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new N.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new N.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new N.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new N.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new N.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new N.EventEmitter),this._onBlur=this.register(new N.EventEmitter),this._onA11yCharEmitter=this.register(new N.EventEmitter),this._onA11yTabEmitter=this.register(new N.EventEmitter),this._onWillOpen=this.register(new N.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(o.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(_.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,$)=>this.refresh(F,$)))),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,N.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,N.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,N.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,N.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,$;this._customKeyEventHandler=void 0,($=(F=this.element)===null||F===void 0?void 0:F.parentNode)===null||$===void 0||$.removeChild(this.element)})))}_handleColorEvent(T){if(this._themeService)for(const F of T){let $,z="";switch(F.index){case 256:$="foreground",z="10";break;case 257:$="background",z="11";break;case 258:$="cursor",z="12";break;default:$="ansi",z="4;"+F.index}switch(F.type){case 0:const J=A.color.toColorRGB($==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[$]);this.coreService.triggerDataEvent(`${W.C0.ESC}]${z};${(0,M.toRgbString)(J)}${W.C1_ESCAPED.ST}`);break;case 1:if($==="ansi")this._themeService.modifyColors((X=>X.ansi[F.index]=A.rgba.toColor(...F.color)));else{const X=$;this._themeService.modifyColors((oe=>oe[X]=A.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(T){T?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(T){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[I"),this.updateCursorStyle(T),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var T;return(T=this.textarea)===null||T===void 0?void 0:T.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 T=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(T);if(!F)return;const $=Math.min(this.buffer.x,this.cols-1),z=this._renderService.dimensions.css.cell.height,J=F.getWidth($),X=this._renderService.dimensions.css.cell.width*J,oe=this.buffer.y*this._renderService.dimensions.css.cell.height,he=$*this._renderService.dimensions.css.cell.width;this.textarea.style.left=he+"px",this.textarea.style.top=oe+"px",this.textarea.style.width=X+"px",this.textarea.style.height=z+"px",this.textarea.style.lineHeight=z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",(F=>{this.hasSelection()&&(0,c.copyHandler)(F,this._selectionService)})));const T=F=>(0,c.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",T)),this.register((0,d.addDisposableDomListener)(this.element,"paste",T)),I.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(F=>{F.button===2&&(0,c.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",(F=>{(0,c.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),I.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",(F=>{F.button===1&&(0,c.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",(T=>this._keyUp(T)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",(T=>this._keyDown(T)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",(T=>this._keyPress(T)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",(T=>this._compositionHelper.compositionupdate(T)))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,d.addDisposableDomListener)(this.textarea,"input",(T=>this._inputEvent(T)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(T){var F;if(!T)throw new Error("Terminal requires a parent element.");T.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=T.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),T.appendChild(this.element);const $=V.createDocumentFragment();this._viewportElement=V.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),$.appendChild(this._viewportElement),this._viewportScrollArea=V.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=V.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=V.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),$.appendChild(this.screenElement),this.textarea=V.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(x.CoreBrowserService,this.textarea,(F=this._document.defaultView)!==null&&F!==void 0?F:window),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",(z=>this._handleTextAreaFocus(z)))),this.register((0,d.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(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(j.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(k.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.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=V.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild($);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(E.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(y.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(E.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,d.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,d.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(K.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 T=this,F=this.element;function $(X){const oe=T._mouseService.getMouseReportCoords(X,T.screenElement);if(!oe)return!1;let he,we;switch(X.overrideType||X.type){case"mousemove":we=32,X.buttons===void 0?(he=3,X.button!==void 0&&(he=X.button<3?X.button:3)):he=1&X.buttons?0:4&X.buttons?1:2&X.buttons?2:3;break;case"mouseup":we=0,he=X.button<3?X.button:3;break;case"mousedown":we=1,he=X.button<3?X.button:3;break;case"wheel":if(T.viewport.getLinesScrolled(X)===0)return!1;we=X.deltaY<0?0:1,he=4;break;default:return!1}return!(we===void 0||he===void 0||he>4)&&T.coreMouseService.triggerMouseEvent({col:oe.col,row:oe.row,x:oe.x,y:oe.y,button:he,action:we,ctrl:X.ctrlKey,alt:X.altKey,shift:X.shiftKey})}const z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},J={mouseup:X=>($(X),X.buttons||(this._document.removeEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.removeEventListener("mousemove",z.mousedrag)),this.cancel(X)),wheel:X=>($(X),this.cancel(X,!0)),mousedrag:X=>{X.buttons&&$(X)},mousemove:X=>{X.buttons||$(X)}};this.register(this.coreMouseService.onProtocolChange((X=>{X?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(X)),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&X?z.mousemove||(F.addEventListener("mousemove",J.mousemove),z.mousemove=J.mousemove):(F.removeEventListener("mousemove",z.mousemove),z.mousemove=null),16&X?z.wheel||(F.addEventListener("wheel",J.wheel,{passive:!1}),z.wheel=J.wheel):(F.removeEventListener("wheel",z.wheel),z.wheel=null),2&X?z.mouseup||(F.addEventListener("mouseup",J.mouseup),z.mouseup=J.mouseup):(this._document.removeEventListener("mouseup",z.mouseup),F.removeEventListener("mouseup",z.mouseup),z.mouseup=null),4&X?z.mousedrag||(z.mousedrag=J.mousedrag):(this._document.removeEventListener("mousemove",z.mousedrag),z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(F,"mousedown",(X=>{if(X.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(X))return $(X),z.mouseup&&this._document.addEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.addEventListener("mousemove",z.mousedrag),this.cancel(X)}))),this.register((0,d.addDisposableDomListener)(F,"wheel",(X=>{if(!z.wheel){if(!this.buffer.hasScrollback){const oe=this.viewport.getLinesScrolled(X);if(oe===0)return;const he=W.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(X.deltaY<0?"A":"B");let we="";for(let je=0;je<Math.abs(oe);je++)we+=he;return this.coreService.triggerDataEvent(we,!0),this.cancel(X,!0)}return this.viewport.handleWheel(X)?this.cancel(X):void 0}}),{passive:!1})),this.register((0,d.addDisposableDomListener)(F,"touchstart",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(X),this.cancel(X)}),{passive:!0})),this.register((0,d.addDisposableDomListener)(F,"touchmove",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(X)?void 0:this.cancel(X)}),{passive:!1}))}refresh(T,F){var $;($=this._renderService)===null||$===void 0||$.refreshRows(T,F)}updateCursorStyle(T){var F;!((F=this._selectionService)===null||F===void 0)&&F.shouldColumnSelect(T)?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(T,F,$=0){var z;$===1?(super.scrollLines(T,F,$),this.refresh(0,this.rows-1)):(z=this.viewport)===null||z===void 0||z.scrollLines(T)}paste(T){(0,c.paste)(T,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(T){this._customKeyEventHandler=T}registerLinkProvider(T){return this.linkifier2.registerLinkProvider(T)}registerCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(T);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(T)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(T){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+T)}registerDecoration(T){return this._decorationService.registerDecoration(T)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(T,F,$){this._selectionService.setSelection(T,F,$)}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 T;(T=this._selectionService)===null||T===void 0||T.clearSelection()}selectAll(){var T;(T=this._selectionService)===null||T===void 0||T.selectAll()}selectLines(T,F){var $;($=this._selectionService)===null||$===void 0||$.selectLines(T,F)}_keyDown(T){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&T.altKey;if(!F&&!this._compositionHelper.keydown(T))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||T.key!=="Dead"&&T.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const $=(0,D.evaluateKeyboardEvent)(T,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(T),$.type===3||$.type===2){const z=this.rows-1;return this.scrollLines($.type===2?-z:z),this.cancel(T,!0)}return $.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,T)||($.cancel&&this.cancel(T,!0),!$.key||!!(T.key&&!T.ctrlKey&&!T.altKey&&!T.metaKey&&T.key.length===1&&T.key.charCodeAt(0)>=65&&T.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):($.key!==W.C0.ETX&&$.key!==W.C0.CR||(this.textarea.value=""),this._onKey.fire({key:$.key,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent($.key,!0),!this.optionsService.rawOptions.screenReaderMode||T.altKey||T.ctrlKey?this.cancel(T,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(T,F){const $=T.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||T.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||T.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?$:$&&(!F.keyCode||F.keyCode>47)}_keyUp(T){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1||((function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18})(T)||this.focus(),this.updateCursorStyle(T),this._keyPressHandled=!1)}_keyPress(T){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;if(this.cancel(T),T.charCode)F=T.charCode;else if(T.which===null||T.which===void 0)F=T.keyCode;else{if(T.which===0||T.charCode===0)return!1;F=T.which}return!(!F||(T.altKey||T.ctrlKey||T.metaKey)&&!this._isThirdLevelShift(this.browser,T)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(T){if(T.data&&T.inputType==="insertText"&&(!T.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=T.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(T),!0}return!1}resize(T,F){T!==this.cols||F!==this.rows?super.resize(T,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(T,F){var $,z;($=this._charSizeService)===null||$===void 0||$.measure(),(z=this.viewport)===null||z===void 0||z.syncScrollArea(!0)}clear(){var T;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}),(T=this.viewport)===null||T===void 0||T.reset(),this.refresh(0,this.rows-1)}}reset(){var T,F;this.options.rows=this.rows,this.options.cols=this.cols;const $=this._customKeyEventHandler;this._setup(),super.reset(),(T=this._selectionService)===null||T===void 0||T.reset(),this._decorationService.reset(),(F=this.viewport)===null||F===void 0||F.reset(),this._customKeyEventHandler=$,this.refresh(0,this.rows-1)}clearTextureAtlas(){var T;(T=this._renderService)===null||T===void 0||T.clearTextureAtlas()}_reportFocus(){var T;!((T=this.element)===null||T===void 0)&&T.classList.contains("focus")?this.coreService.triggerDataEvent(W.C0.ESC+"[I"):this.coreService.triggerDataEvent(W.C0.ESC+"[O")}_reportWindowsOptions(T){if(this._renderService)switch(T){case U.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),$=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[4;${$};${F}t`);break;case U.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const z=this._renderService.dimensions.css.cell.width.toFixed(0),J=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[6;${J};${z}t`)}}cancel(T,F){if(this.options.cancelEvents||F)return T.preventDefault(),T.stopPropagation(),!1}}r.Terminal=Y},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,d){this._rowCount=d,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,_=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_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(f,h,u,v){var x,w=arguments.length,k=w<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(f,h,u,v);else for(var y=f.length-1;y>=0;y--)(x=f[y])&&(k=(w<3?x(k):w>3?x(h,u,k):x(h,u))||k);return w>3&&k&&Object.defineProperty(h,u,k),k},d=this&&this.__param||function(f,h){return function(u,v){h(u,v,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const o=i(3656),p=i(4725),_=i(8460),S=i(844),g=i(2585);let n=r.Viewport=class extends S.Disposable{constructor(f,h,u,v,x,w,k,y){super(),this._viewportElement=f,this._scrollArea=h,this._bufferService=u,this._optionsService=v,this._charSizeService=x,this._renderService=w,this._coreBrowserService=k,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 _.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((E=>this._activeBuffer=E.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((E=>this._renderDimensions=E))),this._handleThemeChange(y.colors),this.register(y.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.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(f){if(f)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 f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){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 f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<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(f,h){const u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&u<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){const h=this._getPixelsScrolled(f);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(f,h))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const h=f*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:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(f,h){var u;let v,x="";const w=[],k=h??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let E=f;E<k;E++){const j=y.get(E);if(!j)continue;const A=(u=y.get(E+1))===null||u===void 0?void 0:u.isWrapped;if(x+=j.translateToString(!A),!A||E===y.length-1){const L=document.createElement("div");L.textContent=x,w.push(L),x.length>0&&(v=L),x=""}}return{bufferElements:w,cursorElement:v}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.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):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(f,h){const u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&h.altKey||u==="ctrl"&&h.ctrlKey||u==="shift"&&h.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){const h=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(f,h))}};r.Viewport=n=c([d(2,g.IBufferService),d(3,g.IOptionsService),d(4,p.ICharSizeService),d(5,p.IRenderService),d(6,p.ICoreBrowserService),d(7,p.IThemeService)],n)},3107:function(C,r,i){var c=this&&this.__decorate||function(n,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const o=i(3656),p=i(4725),_=i(844),S=i(2585);let g=r.BufferDecorationRenderer=class extends _.Disposable{constructor(n,f,h,u){super(),this._screenElement=n,this._bufferService=f,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((v=>this._removeDecoration(v)))),this.register((0,_.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 f,h;const u=document.createElement("div");u.classList.add("xterm-decoration"),u.classList.toggle("xterm-decoration-top-layer",((f=n?.options)===null||f===void 0?void 0:f.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 v=(h=n.options.x)!==null&&h!==void 0?h:0;return v&&v>this._bufferService.cols&&(u.style.display="none"),this._refreshXPosition(n,u),u}_refreshStyle(n){const f=n.marker.line-this._bufferService.buffers.active.ydisp;if(f<0||f>=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=f*this._renderService.dimensions.css.cell.height+"px",h.style.display=this._altBufferIsActive?"none":"block",n.onRenderEmitter.fire(h)}}_refreshXPosition(n,f=n.element){var h;if(!f)return;const u=(h=n.options.x)!==null&&h!==void 0?h:0;(n.options.anchor||"left")==="right"?f.style.right=u?u*this._renderService.dimensions.css.cell.width+"px":"":f.style.left=u?u*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(n){var f;(f=this._decorationElements.get(n))===null||f===void 0||f.remove(),this._decorationElements.delete(n),n.dispose()}};r.BufferDecorationRenderer=g=c([d(1,S.IBufferService),d(2,S.IDecorationService),d(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,d){return c>=i.startBufferLine-this._linePadding[d||"full"]&&c<=i.endBufferLine+this._linePadding[d||"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(v,x,w,k){var y,E=arguments.length,j=E<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(v,x,w,k);else for(var A=v.length-1;A>=0;A--)(y=v[A])&&(j=(E<3?y(j):E>3?y(x,w,j):y(x,w))||j);return E>3&&j&&Object.defineProperty(x,w,j),j},d=this&&this.__param||function(v,x){return function(w,k){x(w,k,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const o=i(5871),p=i(3656),_=i(4725),S=i(844),g=i(2585),n={full:0,left:0,center:0,right:0},f={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(v,x,w,k,y,E,j){var A;super(),this._viewportElement=v,this._screenElement=x,this._bufferService=w,this._decorationService=k,this._renderService=y,this._optionsService=E,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(),(A=this._viewportElement.parentElement)===null||A===void 0||A.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 N;(N=this._canvas)===null||N===void 0||N.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 v=Math.floor(this._canvas.width/3),x=Math.ceil(this._canvas.width/3);f.full=this._canvas.width,f.left=v,f.center=x,f.right=v,this._refreshDrawHeightConstants(),h.full=0,h.left=0,h.center=f.left,h.right=f.left+f.center}_refreshDrawHeightConstants(){n.full=Math.round(2*this._coreBrowseService.dpr);const v=this._canvas.height/this._bufferService.buffer.lines.length,x=Math.round(Math.max(Math.min(v,12),6)*this._coreBrowseService.dpr);n.left=x,n.center=x,n.right=x}_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 x of this._decorationService.decorations)this._colorZoneStore.addDecoration(x);this._ctx.lineWidth=1;const v=this._colorZoneStore.zones;for(const x of v)x.position!=="full"&&this._renderColorZone(x);for(const x of v)x.position==="full"&&this._renderColorZone(x);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(v){this._ctx.fillStyle=v.color,this._ctx.fillRect(h[v.position||"full"],Math.round((this._canvas.height-1)*(v.startBufferLine/this._bufferService.buffers.active.lines.length)-n[v.position||"full"]/2),f[v.position||"full"],Math.round((this._canvas.height-1)*((v.endBufferLine-v.startBufferLine)/this._bufferService.buffers.active.lines.length)+n[v.position||"full"]))}_queueRefresh(v,x){this._shouldUpdateDimensions=v||this._shouldUpdateDimensions,this._shouldUpdateAnchor=x||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=u=c([d(2,g.IBufferService),d(3,g.IDecorationService),d(4,_.IRenderService),d(5,g.IOptionsService),d(6,_.ICoreBrowserService)],u)},2950:function(C,r,i){var c=this&&this.__decorate||function(g,n,f,h){var u,v=arguments.length,x=v<3?n:h===null?h=Object.getOwnPropertyDescriptor(n,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,n,f,h);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(x=(v<3?u(x):v>3?u(n,f,x):u(n,f))||x);return v>3&&x&&Object.defineProperty(n,f,x),x},d=this&&this.__param||function(g,n){return function(f,h){n(f,h,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const o=i(4725),p=i(2585),_=i(2584);let S=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,n,f,h,u,v){this._textarea=g,this._compositionView=n,this._bufferService=f,this._optionsService=h,this._coreService=u,this._renderService=v,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 f;this._isSendingComposition=!1,n.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(n.start,n.end):this._textarea.value.substring(n.start),f.length>0&&this._coreService.triggerDataEvent(f,!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,f=n.replace(g,"");this._dataAlreadySent=f,n.length>g.length?this._coreService.triggerDataEvent(f,!0):n.length<g.length?this._coreService.triggerDataEvent(`${_.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),f=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=f+"px",this._compositionView.style.lineHeight=f+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const v=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=h+"px",this._textarea.style.width=Math.max(v.width,1)+"px",this._textarea.style.height=Math.max(v.height,1)+"px",this._textarea.style.lineHeight=v.height+"px"}g||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=S=c([d(2,p.IBufferService),d(3,p.IOptionsService),d(4,p.ICoreService),d(5,o.IRenderService)],S)},9806:(C,r)=>{function i(c,d,o){const p=o.getBoundingClientRect(),_=c.getComputedStyle(o),S=parseInt(_.getPropertyValue("padding-left")),g=parseInt(_.getPropertyValue("padding-top"));return[d.clientX-p.left-S,d.clientY-p.top-g]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=i,r.getCoords=function(c,d,o,p,_,S,g,n,f){if(!S)return;const h=i(c,d,o);return h?(h[0]=Math.ceil((h[0]+(f?g/2:0))/g),h[1]=Math.ceil(h[1]/n),h[0]=Math.min(Math.max(h[0],1),p+(f?1:0)),h[1]=Math.min(Math.max(h[1],1),_),h):void 0}},9504:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const c=i(2584);function d(n,f,h,u){const v=n-o(n,h),x=f-o(f,h),w=Math.abs(v-x)-(function(k,y,E){let j=0;const A=k-o(k,E),L=y-o(y,E);for(let N=0;N<Math.abs(A-L);N++){const B=p(k,y)==="A"?-1:1,I=E.buffer.lines.get(A+B*N);I?.isWrapped&&j++}return j})(n,f,h);return g(w,S(p(n,f),u))}function o(n,f){let h=0,u=f.buffer.lines.get(n),v=u?.isWrapped;for(;v&&n>=0&&n<f.rows;)h++,u=f.buffer.lines.get(--n),v=u?.isWrapped;return h}function p(n,f){return n>f?"A":"B"}function _(n,f,h,u,v,x){let w=n,k=f,y="";for(;w!==h||k!==u;)w+=v?1:-1,v&&w>x.cols-1?(y+=x.buffer.translateBufferLineToString(k,!1,n,w),w=0,n=0,k++):!v&&w<0&&(y+=x.buffer.translateBufferLineToString(k,!1,0,n+1),w=x.cols-1,n=w,k--);return y+x.buffer.translateBufferLineToString(k,!1,n,w)}function S(n,f){const h=f?"O":"[";return c.C0.ESC+h+n}function g(n,f){n=Math.floor(n);let h="";for(let u=0;u<n;u++)h+=f;return h}r.moveToCellSequence=function(n,f,h,u){const v=h.buffer.x,x=h.buffer.y;if(!h.buffer.hasScrollback)return(function(y,E,j,A,L,N){return d(E,A,L,N).length===0?"":g(_(y,E,y,E-o(E,L),!1,L).length,S("D",N))})(v,x,0,f,h,u)+d(x,f,h,u)+(function(y,E,j,A,L,N){let B;B=d(E,A,L,N).length>0?A-o(A,L):E;const I=A,H=(function(W,D,M,P,O,U){let K;return K=d(M,P,O,U).length>0?P-o(P,O):D,W<M&&K<=P||W>=M&&K<P?"C":"D"})(y,E,j,A,L,N);return g(_(y,B,j,I,H==="C",L).length,S(H,N))})(v,x,n,f,h,u);let w;if(x===f)return w=v>n?"D":"C",g(Math.abs(v-n),S(w,u));w=x>f?"D":"C";const k=Math.abs(x-f);return g((function(y,E){return E.cols-y})(x>f?n:v,h)+(k-1)*h.cols+1+((x>f?v:n)-1),S(w,u))}},1296:function(C,r,i){var c=this&&this.__decorate||function(L,N,B,I){var H,W=arguments.length,D=W<3?N:I===null?I=Object.getOwnPropertyDescriptor(N,B):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(L,N,B,I);else for(var M=L.length-1;M>=0;M--)(H=L[M])&&(D=(W<3?H(D):W>3?H(N,B,D):H(N,B))||D);return W>3&&D&&Object.defineProperty(N,B,D),D},d=this&&this.__param||function(L,N){return function(B,I){N(B,I,L)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const o=i(3787),p=i(2550),_=i(2223),S=i(6171),g=i(4725),n=i(8055),f=i(8460),h=i(844),u=i(2585),v="xterm-dom-renderer-owner-",x="xterm-rows",w="xterm-fg-",k="xterm-bg-",y="xterm-focus",E="xterm-selection";let j=1,A=r.DomRenderer=class extends h.Disposable{constructor(L,N,B,I,H,W,D,M,P,O){super(),this._element=L,this._screenElement=N,this._viewportElement=B,this._linkifier2=I,this._charSizeService=W,this._optionsService=D,this._bufferService=M,this._coreBrowserService=P,this._themeService=O,this._terminalClass=j++,this._rowElements=[],this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(x),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(E),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((U=>this._injectCss(U)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(v+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((U=>this._handleLinkHover(U)))),this.register(this._linkifier2.onHideLinkUnderline((U=>this._handleLinkLeave(U)))),this.register((0,h.toDisposable)((()=>{this._element.classList.remove(v+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 N=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=N,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 N=`${this._terminalSelector} .${x} { color: ${L.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;N+=`${this._terminalSelector} .${x} .xterm-dim { color: ${n.color.multiplyOpacity(L.foreground,.5).css};}`,N+=`${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;}`,N+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",N+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css}; } 50% { background-color: inherit; color: ${L.cursor.css}; }}`,N+=`${this._terminalSelector} .${x}.${y} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${x}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${L.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${L.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${L.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,N+=`${this._terminalSelector} .${E} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${E} div { position: absolute; background-color: ${L.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${L.selectionInactiveBackgroundOpaque.css};}`;for(const[B,I]of L.ansi.entries())N+=`${this._terminalSelector} .${w}${B} { color: ${I.css}; }${this._terminalSelector} .${w}${B}.xterm-dim { color: ${n.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${k}${B} { background-color: ${I.css}; }`;N+=`${this._terminalSelector} .${w}${_.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(L.background).css}; }${this._terminalSelector} .${w}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(L.background),.5).css}; }${this._terminalSelector} .${k}${_.INVERTED_DEFAULT_COLOR} { background-color: ${L.foreground.css}; }`,this._themeStyleElement.textContent=N}_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,N){for(let B=this._rowElements.length;B<=N;B++){const I=document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>N;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(L,N){this._refreshRowElements(L,N),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(L,N,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(L,N,B),this.renderRows(0,this._bufferService.rows-1),!L||!N)return;const I=L[1]-this._bufferService.buffer.ydisp,H=N[1]-this._bufferService.buffer.ydisp,W=Math.max(I,0),D=Math.min(H,this._bufferService.rows-1);if(W>=this._bufferService.rows||D<0)return;const M=document.createDocumentFragment();if(B){const P=L[0]>N[0];M.appendChild(this._createSelectionElement(W,P?N[0]:L[0],P?L[0]:N[0],D-W+1))}else{const P=I===W?L[0]:0,O=W===H?N[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(W,P,O));const U=D-W-1;if(M.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,U)),W!==D){const K=H===D?N[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(D,0,K))}}this._selectionContainer.appendChild(M)}_createSelectionElement(L,N,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=N*this.dimensions.css.cell.width+"px",H.style.width=this.dimensions.css.cell.width*(B-N)+"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,N){const B=this._bufferService.buffer,I=B.ybase+B.y,H=Math.min(B.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,D=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=L;P<=N;P++){const O=P+B.ydisp,U=this._rowElements[P],K=B.lines.get(O);if(!U||!K)break;U.replaceChildren(...this._rowFactory.createRow(K,O,O===I,D,M,H,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${v}${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,N,B,I,H,W){B<0&&(L=0),I<0&&(N=0);const D=this._bufferService.rows-1;B=Math.max(Math.min(B,D),0),I=Math.max(Math.min(I,D),0),H=Math.min(H,this._bufferService.cols);const M=this._bufferService.buffer,P=M.ybase+M.y,O=Math.min(M.x,H-1),U=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,V=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=B;Y<=I;++Y){const ie=Y+M.ydisp,T=this._rowElements[Y],F=M.lines.get(ie);if(!T||!F)break;T.replaceChildren(...this._rowFactory.createRow(F,ie,ie===P,K,V,O,U,this.dimensions.css.cell.width,this._widthCache,W?Y===B?L:0:-1,W?(Y===I?N:H)-1:-1))}}};r.DomRenderer=A=c([d(4,u.IInstantiationService),d(5,g.ICharSizeService),d(6,u.IOptionsService),d(7,u.IBufferService),d(8,g.ICoreBrowserService),d(9,g.IThemeService)],A)},3787:function(C,r,i){var c=this&&this.__decorate||function(w,k,y,E){var j,A=arguments.length,L=A<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,k,y,E);else for(var N=w.length-1;N>=0;N--)(j=w[N])&&(L=(A<3?j(L):A>3?j(k,y,L):j(k,y))||L);return A>3&&L&&Object.defineProperty(k,y,L),L},d=this&&this.__param||function(w,k){return function(y,E){k(y,E,w)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const o=i(2223),p=i(643),_=i(511),S=i(2585),g=i(8055),n=i(4725),f=i(4269),h=i(6171),u=i(3734);let v=r.DomRendererRowFactory=class{constructor(w,k,y,E,j,A,L){this._document=w,this._characterJoinerService=k,this._optionsService=y,this._coreBrowserService=E,this._coreService=j,this._decorationService=A,this._themeService=L,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,k,y){this._selectionStart=w,this._selectionEnd=k,this._columnSelectMode=y}createRow(w,k,y,E,j,A,L,N,B,I,H){const W=[],D=this._characterJoinerService.getJoinedCharacters(k),M=this._themeService.colors;let P,O=w.getNoBgTrimmedLength();y&&O<A+1&&(O=A+1);let U=0,K="",V=0,Y=0,ie=0,T=!1,F=0,$=!1,z=0;const J=[],X=I!==-1&&H!==-1;for(let oe=0;oe<O;oe++){w.loadCell(oe,this._workCell);let he=this._workCell.getWidth();if(he===0)continue;let we=!1,je=oe,Z=this._workCell;if(D.length>0&&oe===D[0][0]){we=!0;const _e=D.shift();Z=new f.JoinedCellData(this._workCell,w.translateToString(!0,_e[0],_e[1]),_e[1]-_e[0]),je=_e[1]-1,he=Z.getWidth()}const ze=this._isCellInSelection(oe,k),Fe=y&&oe===A,Re=X&&oe>=I&&oe<=H;let Q=!1;this._decorationService.forEachDecorationAtCell(oe,k,void 0,(_e=>{Q=!0}));let se=Z.getChars()||p.WHITESPACE_CELL_CHAR;if(se===" "&&(Z.isUnderline()||Z.isOverline())&&(se=" "),z=he*N-B.get(se,Z.isBold(),Z.isItalic()),P){if(U&&(ze&&$||!ze&&!$&&Z.bg===V)&&(ze&&$&&M.selectionForeground||Z.fg===Y)&&Z.extended.ext===ie&&Re===T&&z===F&&!Fe&&!we&&!Q){K+=se,U++;continue}U&&(P.textContent=K),P=this._document.createElement("span"),U=0,K=""}else P=this._document.createElement("span");if(V=Z.bg,Y=Z.fg,ie=Z.extended.ext,T=Re,F=z,$=ze,we&&A>=oe&&A<=je&&(A=oe),!this._coreService.isCursorHidden&&Fe){if(J.push("xterm-cursor"),this._coreBrowserService.isFocused)L&&J.push("xterm-cursor-blink"),J.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(j)switch(j){case"outline":J.push("xterm-cursor-outline");break;case"block":J.push("xterm-cursor-block");break;case"bar":J.push("xterm-cursor-bar");break;case"underline":J.push("xterm-cursor-underline")}}if(Z.isBold()&&J.push("xterm-bold"),Z.isItalic()&&J.push("xterm-italic"),Z.isDim()&&J.push("xterm-dim"),K=Z.isInvisible()?p.WHITESPACE_CELL_CHAR:Z.getChars()||p.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(J.push(`xterm-underline-${Z.extended.underlineStyle}`),K===" "&&(K=" "),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let _e=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&_e<8&&(_e+=8),P.style.textDecorationColor=M.ansi[_e].css}Z.isOverline()&&(J.push("xterm-overline"),K===" "&&(K=" ")),Z.isStrikethrough()&&J.push("xterm-strikethrough"),Re&&(P.style.textDecoration="underline");let ue=Z.getFgColor(),ne=Z.getFgColorMode(),ge=Z.getBgColor(),me=Z.getBgColorMode();const ye=!!Z.isInverse();if(ye){const _e=ue;ue=ge,ge=_e;const et=ne;ne=me,me=et}let Le,Ve,Ae,Ne=!1;switch(this._decorationService.forEachDecorationAtCell(oe,k,void 0,(_e=>{_e.options.layer!=="top"&&Ne||(_e.backgroundColorRGB&&(me=50331648,ge=_e.backgroundColorRGB.rgba>>8&16777215,Le=_e.backgroundColorRGB),_e.foregroundColorRGB&&(ne=50331648,ue=_e.foregroundColorRGB.rgba>>8&16777215,Ve=_e.foregroundColorRGB),Ne=_e.options.layer==="top")})),!Ne&&ze&&(Le=this._coreBrowserService.isFocused?M.selectionBackgroundOpaque:M.selectionInactiveBackgroundOpaque,ge=Le.rgba>>8&16777215,me=50331648,Ne=!0,M.selectionForeground&&(ne=50331648,ue=M.selectionForeground.rgba>>8&16777215,Ve=M.selectionForeground)),Ne&&J.push("xterm-decoration-top"),me){case 16777216:case 33554432:Ae=M.ansi[ge],J.push(`xterm-bg-${ge}`);break;case 50331648:Ae=g.rgba.toColor(ge>>16,ge>>8&255,255&ge),this._addStyle(P,`background-color:#${x((ge>>>0).toString(16),"0",6)}`);break;default:ye?(Ae=M.foreground,J.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):Ae=M.background}switch(Le||Z.isDim()&&(Le=g.color.multiplyOpacity(Ae,.5)),ne){case 16777216:case 33554432:Z.isBold()&&ue<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ue+=8),this._applyMinimumContrast(P,Ae,M.ansi[ue],Z,Le,void 0)||J.push(`xterm-fg-${ue}`);break;case 50331648:const _e=g.rgba.toColor(ue>>16&255,ue>>8&255,255&ue);this._applyMinimumContrast(P,Ae,_e,Z,Le,Ve)||this._addStyle(P,`color:#${x(ue.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,Ae,M.foreground,Z,Le,void 0)||ye&&J.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}J.length&&(P.className=J.join(" "),J.length=0),Fe||we||Q?P.textContent=K:U++,z!==this.defaultSpacing&&(P.style.letterSpacing=`${z}px`),W.push(P),oe=je}return P&&U&&(P.textContent=K),W}_applyMinimumContrast(w,k,y,E,j,A){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.excludeFromContrastRatioDemands)(E.getCode()))return!1;const L=this._getContrastCache(E);let N;if(j||A||(N=L.getColor(k.rgba,y.rgba)),N===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);N=g.color.ensureContrastRatio(j||k,A||y,B),L.setColor((j||k).rgba,(A||y).rgba,N??null)}return!!N&&(this._addStyle(w,`color:${N.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,k){w.setAttribute("style",`${w.getAttribute("style")||""}${k};`)}_isCellInSelection(w,k){const y=this._selectionStart,E=this._selectionEnd;return!(!y||!E)&&(this._columnSelectMode?y[0]<=E[0]?w>=y[0]&&k>=y[1]&&w<E[0]&&k<=E[1]:w<y[0]&&k>=y[1]&&w>=E[0]&&k<=E[1]:k>y[1]&&k<E[1]||y[1]===E[1]&&k===y[1]&&w>=y[0]&&w<E[0]||y[1]<E[1]&&k===E[1]&&w<E[0]||y[1]<E[1]&&k===y[1]&&w>=y[0])}};function x(w,k,y){for(;w.length<y;)w=k+w;return w}r.DomRendererRowFactory=v=c([d(1,n.ICharacterJoinerService),d(2,S.IOptionsService),d(3,n.ICoreBrowserService),d(4,S.ICoreService),d(5,S.IDecorationService),d(6,n.IThemeService)],v)},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"),d=i.createElement("span");d.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,d,o,p],this._container.appendChild(c),this._container.appendChild(d),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,d,o){i===this._font&&c===this._fontSize&&d===this._weight&&o===this._weightBold||(this._font=i,this._fontSize=c,this._weight=d,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(i,c,d){let o=0;if(!c&&!d&&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"),d&&(p+="I");let _=this._holey.get(p);if(_===void 0){let S=0;c&&(S|=1),d&&(S|=2),_=this._measure(i,S),this._holey.set(p,_)}return _}_measure(i,c){const d=this._measureElements[c];return d.textContent=i.repeat(32),d.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(d){return 9472<=d&&d<=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,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const o=i(2585),p=i(8460),_=i(844);let S=r.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(n,f,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,f,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([d(2,o.IOptionsService)],S);class g{constructor(f,h,u){this._document=f,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 f={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return f.width!==0&&f.height!==0&&(this._result.width=f.width/32,this._result.height=Math.ceil(f.height)),this._result}}},4269:function(C,r,i){var c=this&&this.__decorate||function(f,h,u,v){var x,w=arguments.length,k=w<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(f,h,u,v);else for(var y=f.length-1;y>=0;y--)(x=f[y])&&(k=(w<3?x(k):w>3?x(h,u,k):x(h,u))||k);return w>3&&k&&Object.defineProperty(h,u,k),k},d=this&&this.__param||function(f,h){return function(u,v){h(u,v,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const o=i(3734),p=i(643),_=i(511),S=i(2585);class g extends o.AttributeData{constructor(h,u,v){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=u,this._width=v}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 kn{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.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 v=[],x=u.translateToString(!0);let w=0,k=0,y=0,E=u.getFg(0),j=u.getBg(0);for(let A=0;A<u.getTrimmedLength();A++)if(u.loadCell(A,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==j){if(A-w>1){const L=this._getJoinedRanges(x,y,k,u,w);for(let N=0;N<L.length;N++)v.push(L[N])}w=A,y=k,E=this._workCell.fg,j=this._workCell.bg}k+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){const A=this._getJoinedRanges(x,y,k,u,w);for(let L=0;L<A.length;L++)v.push(A[L])}return v}_getJoinedRanges(h,u,v,x,w){const k=h.substring(u,v);let y=[];try{y=this._characterJoiners[0].handler(k)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const j=this._characterJoiners[E].handler(k);for(let A=0;A<j.length;A++)kn._mergeRanges(y,j[A])}catch(j){console.error(j)}return this._stringRangesToCellRanges(y,x,w),y}_stringRangesToCellRanges(h,u,v){let x=0,w=!1,k=0,y=h[x];if(y){for(let E=v;E<this._bufferService.cols;E++){const j=u.getWidth(E),A=u.getString(E).length||p.WHITESPACE_CELL_CHAR.length;if(j!==0){if(!w&&y[0]<=k&&(y[0]=E,w=!0),y[1]<=k){if(y[1]=E,y=h[++x],!y)break;y[0]<=k?(y[0]=E,w=!0):w=!1}k+=A}}y&&(y[1]=this._bufferService.cols)}}static _mergeRanges(h,u){let v=!1;for(let x=0;x<h.length;x++){const w=h[x];if(v){if(u[1]<=w[0])return h[x-1][1]=u[1],h;if(u[1]<=w[1])return h[x-1][1]=Math.max(u[1],w[1]),h.splice(x,1),h;h.splice(x,1),x--}else{if(u[1]<=w[0])return h.splice(x,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]),v=!0)}}return v?h[h.length-1][1]=u[1]:h.push(u),h}};r.CharacterJoinerService=n=c([d(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,f){var h,u=arguments.length,v=u<3?g:f===null?f=Object.getOwnPropertyDescriptor(g,n):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(S,g,n,f);else for(var x=S.length-1;x>=0;x--)(h=S[x])&&(v=(u<3?h(v):u>3?h(g,n,v):h(g,n))||v);return u>3&&v&&Object.defineProperty(g,n,v),v},d=this&&this.__param||function(S,g){return function(n,f){g(n,f,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const o=i(4725),p=i(9806);let _=r.MouseService=class{constructor(S,g){this._renderService=S,this._charSizeService=g}getCoords(S,g,n,f,h){return(0,p.getCoords)(window,S,g,n,f,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=_=c([d(0,o.IRenderService),d(1,o.ICharSizeService)],_)},3230:function(C,r,i){var c=this&&this.__decorate||function(v,x,w,k){var y,E=arguments.length,j=E<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(v,x,w,k);else for(var A=v.length-1;A>=0;A--)(y=v[A])&&(j=(E<3?y(j):E>3?y(x,w,j):y(x,w))||j);return E>3&&j&&Object.defineProperty(x,w,j),j},d=this&&this.__param||function(v,x){return function(w,k){x(w,k,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const o=i(3656),p=i(6193),_=i(5596),S=i(4725),g=i(8460),n=i(844),f=i(7226),h=i(2585);let u=r.RenderService=class extends n.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,x,w,k,y,E,j,A){if(super(),this._rowCount=v,this._charSizeService=k,this._renderer=this.register(new n.MutableDisposable),this._pausedResizeTask=new f.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,N)=>this._renderRows(L,N))),this.register(this._renderDebouncer),this._screenDprMonitor=new _.ScreenDprMonitor(j.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(E.onResize((()=>this._fullRefresh()))),this.register(E.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(y.onDecorationRegistered((()=>this._fullRefresh()))),this.register(y.onDecorationRemoved((()=>this._fullRefresh()))),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(E.cols,E.rows),this._fullRefresh()}))),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(E.buffer.y,E.buffer.y,!0)))),this.register((0,o.addDisposableDomListener)(j.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(A.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in j.window){const L=new j.window.IntersectionObserver((N=>this._handleIntersectionChange(N[N.length-1])),{threshold:0});L.observe(x),this.register({dispose:()=>L.disconnect()})}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.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(v,x,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,x,this._rowCount))}_renderRows(v,x){this._renderer.value&&(v=Math.min(v,this._rowCount-1),x=Math.min(x,this._rowCount-1),this._renderer.value.renderRows(v,x),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:x}),this._onRender.fire({start:v,end:x}),this._isNextRenderRedrawOnly=!0)}resize(v,x){this._rowCount=x,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(v){this._renderer.value=v,this._renderer.value.onRequestRedraw((x=>this.refreshRows(x.start,x.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var v,x;this._renderer.value&&((x=(v=this._renderer.value).clearTextureAtlas)===null||x===void 0||x.call(v),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,x){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(v,x))):this._renderer.value.handleResize(v,x),this._fullRefresh())}handleCharSizeChanged(){var v;(v=this._renderer.value)===null||v===void 0||v.handleCharSizeChanged()}handleBlur(){var v;(v=this._renderer.value)===null||v===void 0||v.handleBlur()}handleFocus(){var v;(v=this._renderer.value)===null||v===void 0||v.handleFocus()}handleSelectionChanged(v,x,w){var k;this._selectionState.start=v,this._selectionState.end=x,this._selectionState.columnSelectMode=w,(k=this._renderer.value)===null||k===void 0||k.handleSelectionChanged(v,x,w)}handleCursorMove(){var v;(v=this._renderer.value)===null||v===void 0||v.handleCursorMove()}clear(){var v;(v=this._renderer.value)===null||v===void 0||v.clear()}};r.RenderService=u=c([d(2,h.IOptionsService),d(3,S.ICharSizeService),d(4,h.IDecorationService),d(5,h.IBufferService),d(6,S.ICoreBrowserService),d(7,S.IThemeService)],u)},9312:function(C,r,i){var c=this&&this.__decorate||function(y,E,j,A){var L,N=arguments.length,B=N<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,E,j,A);else for(var I=y.length-1;I>=0;I--)(L=y[I])&&(B=(N<3?L(B):N>3?L(E,j,B):L(E,j))||B);return N>3&&B&&Object.defineProperty(E,j,B),B},d=this&&this.__param||function(y,E){return function(j,A){E(j,A,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const o=i(9806),p=i(9504),_=i(456),S=i(4725),g=i(8460),n=i(844),f=i(6114),h=i(4841),u=i(511),v=i(2585),x=" ",w=new RegExp(x,"g");let k=r.SelectionService=class extends n.Disposable{constructor(y,E,j,A,L,N,B,I,H){super(),this._element=y,this._screenElement=E,this._linkifier=j,this._bufferService=A,this._coreService=L,this._mouseService=N,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 _.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 y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!y||!E||y[0]===E[0]&&y[1]===E[1])}get selectionText(){const y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!y||!E)return"";const j=this._bufferService.buffer,A=[];if(this._activeSelectionMode===3){if(y[0]===E[0])return"";const L=y[0]<E[0]?y[0]:E[0],N=y[0]<E[0]?E[0]:y[0];for(let B=y[1];B<=E[1];B++){const I=j.translateBufferLineToString(B,!0,L,N);A.push(I)}}else{const L=y[1]===E[1]?E[0]:void 0;A.push(j.translateBufferLineToString(y[1],!0,y[0],L));for(let N=y[1]+1;N<=E[1]-1;N++){const B=j.lines.get(N),I=j.translateBufferLineToString(N,!0);B?.isWrapped?A[A.length-1]+=I:A.push(I)}if(y[1]!==E[1]){const N=j.lines.get(E[1]),B=j.translateBufferLineToString(E[1],!0,0,E[0]);N&&N.isWrapped?A[A.length-1]+=B:A.push(B)}}return A.map((L=>L.replace(w," "))).join(f.isWindows?`\r
|
|
15
|
+
WARNING: This link could potentially be dangerous`)){const f=window.open();if(f){try{f.opener=null}catch{}f.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=_=c([d(0,p.IBufferService),d(1,p.IOptionsService),d(2,p.IOscLinkService)],_)},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,d){this._rowCount=d,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 d 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=d},3236:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const c=i(3614),d=i(3656),o=i(6465),p=i(9042),_=i(3730),y=i(1680),g=i(3107),n=i(5744),f=i(2950),h=i(1296),u=i(428),v=i(4269),x=i(5114),w=i(8934),k=i(3230),S=i(9312),E=i(4725),T=i(6731),A=i(8055),L=i(8969),M=i(8460),B=i(844),I=i(6114),H=i(8437),W=i(2584),D=i(7399),N=i(5941),P=i(9074),O=i(2585),U=i(5435),X=i(4567),V=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(j={}){super(j),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 M.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new M.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new M.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new M.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new M.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new M.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new M.EventEmitter),this._onBlur=this.register(new M.EventEmitter),this._onA11yCharEmitter=this.register(new M.EventEmitter),this._onA11yTabEmitter=this.register(new M.EventEmitter),this._onWillOpen=this.register(new M.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(o.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(_.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,$)=>this.refresh(F,$)))),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,M.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,M.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,M.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,M.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,$;this._customKeyEventHandler=void 0,($=(F=this.element)===null||F===void 0?void 0:F.parentNode)===null||$===void 0||$.removeChild(this.element)})))}_handleColorEvent(j){if(this._themeService)for(const F of j){let $,z="";switch(F.index){case 256:$="foreground",z="10";break;case 257:$="background",z="11";break;case 258:$="cursor",z="12";break;default:$="ansi",z="4;"+F.index}switch(F.type){case 0:const Z=A.color.toColorRGB($==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[$]);this.coreService.triggerDataEvent(`${W.C0.ESC}]${z};${(0,N.toRgbString)(Z)}${W.C1_ESCAPED.ST}`);break;case 1:if($==="ansi")this._themeService.modifyColors((K=>K.ansi[F.index]=A.rgba.toColor(...F.color)));else{const K=$;this._themeService.modifyColors((ne=>ne[K]=A.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(j){j?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(X.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(j){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[I"),this.updateCursorStyle(j),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var j;return(j=this.textarea)===null||j===void 0?void 0:j.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 j=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(j);if(!F)return;const $=Math.min(this.buffer.x,this.cols-1),z=this._renderService.dimensions.css.cell.height,Z=F.getWidth($),K=this._renderService.dimensions.css.cell.width*Z,ne=this.buffer.y*this._renderService.dimensions.css.cell.height,ue=$*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ue+"px",this.textarea.style.top=ne+"px",this.textarea.style.width=K+"px",this.textarea.style.height=z+"px",this.textarea.style.lineHeight=z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",(F=>{this.hasSelection()&&(0,c.copyHandler)(F,this._selectionService)})));const j=F=>(0,c.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",j)),this.register((0,d.addDisposableDomListener)(this.element,"paste",j)),I.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(F=>{F.button===2&&(0,c.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",(F=>{(0,c.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),I.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",(F=>{F.button===1&&(0,c.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",(j=>this._keyUp(j)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",(j=>this._keyDown(j)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",(j=>this._keyPress(j)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",(j=>this._compositionHelper.compositionupdate(j)))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,d.addDisposableDomListener)(this.textarea,"input",(j=>this._inputEvent(j)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(j){var F;if(!j)throw new Error("Terminal requires a parent element.");j.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=j.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),j.appendChild(this.element);const $=V.createDocumentFragment();this._viewportElement=V.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),$.appendChild(this._viewportElement),this._viewportScrollArea=V.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=V.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=V.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),$.appendChild(this.screenElement),this.textarea=V.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(x.CoreBrowserService,this.textarea,(F=this._document.defaultView)!==null&&F!==void 0?F:window),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",(z=>this._handleTextAreaFocus(z)))),this.register((0,d.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(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(k.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.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=V.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild($);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(E.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(y.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(S.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(E.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,d.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,d.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 j=this,F=this.element;function $(K){const ne=j._mouseService.getMouseReportCoords(K,j.screenElement);if(!ne)return!1;let ue,ye;switch(K.overrideType||K.type){case"mousemove":ye=32,K.buttons===void 0?(ue=3,K.button!==void 0&&(ue=K.button<3?K.button:3)):ue=1&K.buttons?0:4&K.buttons?1:2&K.buttons?2:3;break;case"mouseup":ye=0,ue=K.button<3?K.button:3;break;case"mousedown":ye=1,ue=K.button<3?K.button:3;break;case"wheel":if(j.viewport.getLinesScrolled(K)===0)return!1;ye=K.deltaY<0?0:1,ue=4;break;default:return!1}return!(ye===void 0||ue===void 0||ue>4)&&j.coreMouseService.triggerMouseEvent({col:ne.col,row:ne.row,x:ne.x,y:ne.y,button:ue,action:ye,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:K=>($(K),K.buttons||(this._document.removeEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.removeEventListener("mousemove",z.mousedrag)),this.cancel(K)),wheel:K=>($(K),this.cancel(K,!0)),mousedrag:K=>{K.buttons&&$(K)},mousemove:K=>{K.buttons||$(K)}};this.register(this.coreMouseService.onProtocolChange((K=>{K?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(K)),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&K?z.mousemove||(F.addEventListener("mousemove",Z.mousemove),z.mousemove=Z.mousemove):(F.removeEventListener("mousemove",z.mousemove),z.mousemove=null),16&K?z.wheel||(F.addEventListener("wheel",Z.wheel,{passive:!1}),z.wheel=Z.wheel):(F.removeEventListener("wheel",z.wheel),z.wheel=null),2&K?z.mouseup||(F.addEventListener("mouseup",Z.mouseup),z.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",z.mouseup),F.removeEventListener("mouseup",z.mouseup),z.mouseup=null),4&K?z.mousedrag||(z.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",z.mousedrag),z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(F,"mousedown",(K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return $(K),z.mouseup&&this._document.addEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.addEventListener("mousemove",z.mousedrag),this.cancel(K)}))),this.register((0,d.addDisposableDomListener)(F,"wheel",(K=>{if(!z.wheel){if(!this.buffer.hasScrollback){const ne=this.viewport.getLinesScrolled(K);if(ne===0)return;const ue=W.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let ye="";for(let je=0;je<Math.abs(ne);je++)ye+=ue;return this.coreService.triggerDataEvent(ye,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}}),{passive:!1})),this.register((0,d.addDisposableDomListener)(F,"touchstart",(K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)}),{passive:!0})),this.register((0,d.addDisposableDomListener)(F,"touchmove",(K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)}),{passive:!1}))}refresh(j,F){var $;($=this._renderService)===null||$===void 0||$.refreshRows(j,F)}updateCursorStyle(j){var F;!((F=this._selectionService)===null||F===void 0)&&F.shouldColumnSelect(j)?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(j,F,$=0){var z;$===1?(super.scrollLines(j,F,$),this.refresh(0,this.rows-1)):(z=this.viewport)===null||z===void 0||z.scrollLines(j)}paste(j){(0,c.paste)(j,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(j){this._customKeyEventHandler=j}registerLinkProvider(j){return this.linkifier2.registerLinkProvider(j)}registerCharacterJoiner(j){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(j);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(j){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(j)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(j){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+j)}registerDecoration(j){return this._decorationService.registerDecoration(j)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(j,F,$){this._selectionService.setSelection(j,F,$)}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 j;(j=this._selectionService)===null||j===void 0||j.clearSelection()}selectAll(){var j;(j=this._selectionService)===null||j===void 0||j.selectAll()}selectLines(j,F){var $;($=this._selectionService)===null||$===void 0||$.selectLines(j,F)}_keyDown(j){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(j)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&j.altKey;if(!F&&!this._compositionHelper.keydown(j))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||j.key!=="Dead"&&j.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const $=(0,D.evaluateKeyboardEvent)(j,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(j),$.type===3||$.type===2){const z=this.rows-1;return this.scrollLines($.type===2?-z:z),this.cancel(j,!0)}return $.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,j)||($.cancel&&this.cancel(j,!0),!$.key||!!(j.key&&!j.ctrlKey&&!j.altKey&&!j.metaKey&&j.key.length===1&&j.key.charCodeAt(0)>=65&&j.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):($.key!==W.C0.ETX&&$.key!==W.C0.CR||(this.textarea.value=""),this._onKey.fire({key:$.key,domEvent:j}),this._showCursor(),this.coreService.triggerDataEvent($.key,!0),!this.optionsService.rawOptions.screenReaderMode||j.altKey||j.ctrlKey?this.cancel(j,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(j,F){const $=j.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||j.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||j.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?$:$&&(!F.keyCode||F.keyCode>47)}_keyUp(j){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(j)===!1||((function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18})(j)||this.focus(),this.updateCursorStyle(j),this._keyPressHandled=!1)}_keyPress(j){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(j)===!1)return!1;if(this.cancel(j),j.charCode)F=j.charCode;else if(j.which===null||j.which===void 0)F=j.keyCode;else{if(j.which===0||j.charCode===0)return!1;F=j.which}return!(!F||(j.altKey||j.ctrlKey||j.metaKey)&&!this._isThirdLevelShift(this.browser,j)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:j}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(j){if(j.data&&j.inputType==="insertText"&&(!j.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=j.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(j),!0}return!1}resize(j,F){j!==this.cols||F!==this.rows?super.resize(j,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(j,F){var $,z;($=this._charSizeService)===null||$===void 0||$.measure(),(z=this.viewport)===null||z===void 0||z.syncScrollArea(!0)}clear(){var j;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}),(j=this.viewport)===null||j===void 0||j.reset(),this.refresh(0,this.rows-1)}}reset(){var j,F;this.options.rows=this.rows,this.options.cols=this.cols;const $=this._customKeyEventHandler;this._setup(),super.reset(),(j=this._selectionService)===null||j===void 0||j.reset(),this._decorationService.reset(),(F=this.viewport)===null||F===void 0||F.reset(),this._customKeyEventHandler=$,this.refresh(0,this.rows-1)}clearTextureAtlas(){var j;(j=this._renderService)===null||j===void 0||j.clearTextureAtlas()}_reportFocus(){var j;!((j=this.element)===null||j===void 0)&&j.classList.contains("focus")?this.coreService.triggerDataEvent(W.C0.ESC+"[I"):this.coreService.triggerDataEvent(W.C0.ESC+"[O")}_reportWindowsOptions(j){if(this._renderService)switch(j){case U.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),$=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[4;${$};${F}t`);break;case U.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const z=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[6;${Z};${z}t`)}}cancel(j,F){if(this.options.cancelEvents||F)return j.preventDefault(),j.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,d){this._rowCount=d,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,_=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_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(f,h,u,v){var x,w=arguments.length,k=w<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(f,h,u,v);else for(var S=f.length-1;S>=0;S--)(x=f[S])&&(k=(w<3?x(k):w>3?x(h,u,k):x(h,u))||k);return w>3&&k&&Object.defineProperty(h,u,k),k},d=this&&this.__param||function(f,h){return function(u,v){h(u,v,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const o=i(3656),p=i(4725),_=i(8460),y=i(844),g=i(2585);let n=r.Viewport=class extends y.Disposable{constructor(f,h,u,v,x,w,k,S){super(),this._viewportElement=f,this._scrollArea=h,this._bufferService=u,this._optionsService=v,this._charSizeService=x,this._renderService=w,this._coreBrowserService=k,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 _.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((E=>this._activeBuffer=E.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((E=>this._renderDimensions=E))),this._handleThemeChange(S.colors),this.register(S.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.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(f){if(f)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 f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){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 f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<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(f,h){const u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&u<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){const h=this._getPixelsScrolled(f);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(f,h))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const h=f*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:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(f,h){var u;let v,x="";const w=[],k=h??this._bufferService.buffer.lines.length,S=this._bufferService.buffer.lines;for(let E=f;E<k;E++){const T=S.get(E);if(!T)continue;const A=(u=S.get(E+1))===null||u===void 0?void 0:u.isWrapped;if(x+=T.translateToString(!A),!A||E===S.length-1){const L=document.createElement("div");L.textContent=x,w.push(L),x.length>0&&(v=L),x=""}}return{bufferElements:w,cursorElement:v}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.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):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(f,h){const u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&h.altKey||u==="ctrl"&&h.ctrlKey||u==="shift"&&h.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){const h=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(f,h))}};r.Viewport=n=c([d(2,g.IBufferService),d(3,g.IOptionsService),d(4,p.ICharSizeService),d(5,p.IRenderService),d(6,p.ICoreBrowserService),d(7,p.IThemeService)],n)},3107:function(C,r,i){var c=this&&this.__decorate||function(n,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const o=i(3656),p=i(4725),_=i(844),y=i(2585);let g=r.BufferDecorationRenderer=class extends _.Disposable{constructor(n,f,h,u){super(),this._screenElement=n,this._bufferService=f,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((v=>this._removeDecoration(v)))),this.register((0,_.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 f,h;const u=document.createElement("div");u.classList.add("xterm-decoration"),u.classList.toggle("xterm-decoration-top-layer",((f=n?.options)===null||f===void 0?void 0:f.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 v=(h=n.options.x)!==null&&h!==void 0?h:0;return v&&v>this._bufferService.cols&&(u.style.display="none"),this._refreshXPosition(n,u),u}_refreshStyle(n){const f=n.marker.line-this._bufferService.buffers.active.ydisp;if(f<0||f>=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=f*this._renderService.dimensions.css.cell.height+"px",h.style.display=this._altBufferIsActive?"none":"block",n.onRenderEmitter.fire(h)}}_refreshXPosition(n,f=n.element){var h;if(!f)return;const u=(h=n.options.x)!==null&&h!==void 0?h:0;(n.options.anchor||"left")==="right"?f.style.right=u?u*this._renderService.dimensions.css.cell.width+"px":"":f.style.left=u?u*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(n){var f;(f=this._decorationElements.get(n))===null||f===void 0||f.remove(),this._decorationElements.delete(n),n.dispose()}};r.BufferDecorationRenderer=g=c([d(1,y.IBufferService),d(2,y.IDecorationService),d(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,d){return c>=i.startBufferLine-this._linePadding[d||"full"]&&c<=i.endBufferLine+this._linePadding[d||"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(v,x,w,k){var S,E=arguments.length,T=E<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,x,w,k);else for(var A=v.length-1;A>=0;A--)(S=v[A])&&(T=(E<3?S(T):E>3?S(x,w,T):S(x,w))||T);return E>3&&T&&Object.defineProperty(x,w,T),T},d=this&&this.__param||function(v,x){return function(w,k){x(w,k,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const o=i(5871),p=i(3656),_=i(4725),y=i(844),g=i(2585),n={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0};let u=r.OverviewRulerRenderer=class extends y.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(v,x,w,k,S,E,T){var A;super(),this._viewportElement=v,this._screenElement=x,this._bufferService=w,this._decorationService=k,this._renderService=S,this._optionsService=E,this._coreBrowseService=T,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(),(A=this._viewportElement.parentElement)===null||A===void 0||A.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,y.toDisposable)((()=>{var M;(M=this._canvas)===null||M===void 0||M.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 v=Math.floor(this._canvas.width/3),x=Math.ceil(this._canvas.width/3);f.full=this._canvas.width,f.left=v,f.center=x,f.right=v,this._refreshDrawHeightConstants(),h.full=0,h.left=0,h.center=f.left,h.right=f.left+f.center}_refreshDrawHeightConstants(){n.full=Math.round(2*this._coreBrowseService.dpr);const v=this._canvas.height/this._bufferService.buffer.lines.length,x=Math.round(Math.max(Math.min(v,12),6)*this._coreBrowseService.dpr);n.left=x,n.center=x,n.right=x}_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 x of this._decorationService.decorations)this._colorZoneStore.addDecoration(x);this._ctx.lineWidth=1;const v=this._colorZoneStore.zones;for(const x of v)x.position!=="full"&&this._renderColorZone(x);for(const x of v)x.position==="full"&&this._renderColorZone(x);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(v){this._ctx.fillStyle=v.color,this._ctx.fillRect(h[v.position||"full"],Math.round((this._canvas.height-1)*(v.startBufferLine/this._bufferService.buffers.active.lines.length)-n[v.position||"full"]/2),f[v.position||"full"],Math.round((this._canvas.height-1)*((v.endBufferLine-v.startBufferLine)/this._bufferService.buffers.active.lines.length)+n[v.position||"full"]))}_queueRefresh(v,x){this._shouldUpdateDimensions=v||this._shouldUpdateDimensions,this._shouldUpdateAnchor=x||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=u=c([d(2,g.IBufferService),d(3,g.IDecorationService),d(4,_.IRenderService),d(5,g.IOptionsService),d(6,_.ICoreBrowserService)],u)},2950:function(C,r,i){var c=this&&this.__decorate||function(g,n,f,h){var u,v=arguments.length,x=v<3?n:h===null?h=Object.getOwnPropertyDescriptor(n,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,n,f,h);else for(var w=g.length-1;w>=0;w--)(u=g[w])&&(x=(v<3?u(x):v>3?u(n,f,x):u(n,f))||x);return v>3&&x&&Object.defineProperty(n,f,x),x},d=this&&this.__param||function(g,n){return function(f,h){n(f,h,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const o=i(4725),p=i(2585),_=i(2584);let y=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,n,f,h,u,v){this._textarea=g,this._compositionView=n,this._bufferService=f,this._optionsService=h,this._coreService=u,this._renderService=v,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 f;this._isSendingComposition=!1,n.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(n.start,n.end):this._textarea.value.substring(n.start),f.length>0&&this._coreService.triggerDataEvent(f,!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,f=n.replace(g,"");this._dataAlreadySent=f,n.length>g.length?this._coreService.triggerDataEvent(f,!0):n.length<g.length?this._coreService.triggerDataEvent(`${_.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),f=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=f+"px",this._compositionView.style.lineHeight=f+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const v=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=h+"px",this._textarea.style.width=Math.max(v.width,1)+"px",this._textarea.style.height=Math.max(v.height,1)+"px",this._textarea.style.lineHeight=v.height+"px"}g||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=y=c([d(2,p.IBufferService),d(3,p.IOptionsService),d(4,p.ICoreService),d(5,o.IRenderService)],y)},9806:(C,r)=>{function i(c,d,o){const p=o.getBoundingClientRect(),_=c.getComputedStyle(o),y=parseInt(_.getPropertyValue("padding-left")),g=parseInt(_.getPropertyValue("padding-top"));return[d.clientX-p.left-y,d.clientY-p.top-g]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=i,r.getCoords=function(c,d,o,p,_,y,g,n,f){if(!y)return;const h=i(c,d,o);return h?(h[0]=Math.ceil((h[0]+(f?g/2:0))/g),h[1]=Math.ceil(h[1]/n),h[0]=Math.min(Math.max(h[0],1),p+(f?1:0)),h[1]=Math.min(Math.max(h[1],1),_),h):void 0}},9504:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const c=i(2584);function d(n,f,h,u){const v=n-o(n,h),x=f-o(f,h),w=Math.abs(v-x)-(function(k,S,E){let T=0;const A=k-o(k,E),L=S-o(S,E);for(let M=0;M<Math.abs(A-L);M++){const B=p(k,S)==="A"?-1:1,I=E.buffer.lines.get(A+B*M);I?.isWrapped&&T++}return T})(n,f,h);return g(w,y(p(n,f),u))}function o(n,f){let h=0,u=f.buffer.lines.get(n),v=u?.isWrapped;for(;v&&n>=0&&n<f.rows;)h++,u=f.buffer.lines.get(--n),v=u?.isWrapped;return h}function p(n,f){return n>f?"A":"B"}function _(n,f,h,u,v,x){let w=n,k=f,S="";for(;w!==h||k!==u;)w+=v?1:-1,v&&w>x.cols-1?(S+=x.buffer.translateBufferLineToString(k,!1,n,w),w=0,n=0,k++):!v&&w<0&&(S+=x.buffer.translateBufferLineToString(k,!1,0,n+1),w=x.cols-1,n=w,k--);return S+x.buffer.translateBufferLineToString(k,!1,n,w)}function y(n,f){const h=f?"O":"[";return c.C0.ESC+h+n}function g(n,f){n=Math.floor(n);let h="";for(let u=0;u<n;u++)h+=f;return h}r.moveToCellSequence=function(n,f,h,u){const v=h.buffer.x,x=h.buffer.y;if(!h.buffer.hasScrollback)return(function(S,E,T,A,L,M){return d(E,A,L,M).length===0?"":g(_(S,E,S,E-o(E,L),!1,L).length,y("D",M))})(v,x,0,f,h,u)+d(x,f,h,u)+(function(S,E,T,A,L,M){let B;B=d(E,A,L,M).length>0?A-o(A,L):E;const I=A,H=(function(W,D,N,P,O,U){let X;return X=d(N,P,O,U).length>0?P-o(P,O):D,W<N&&X<=P||W>=N&&X<P?"C":"D"})(S,E,T,A,L,M);return g(_(S,B,T,I,H==="C",L).length,y(H,M))})(v,x,n,f,h,u);let w;if(x===f)return w=v>n?"D":"C",g(Math.abs(v-n),y(w,u));w=x>f?"D":"C";const k=Math.abs(x-f);return g((function(S,E){return E.cols-S})(x>f?n:v,h)+(k-1)*h.cols+1+((x>f?v:n)-1),y(w,u))}},1296:function(C,r,i){var c=this&&this.__decorate||function(L,M,B,I){var H,W=arguments.length,D=W<3?M:I===null?I=Object.getOwnPropertyDescriptor(M,B):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(L,M,B,I);else for(var N=L.length-1;N>=0;N--)(H=L[N])&&(D=(W<3?H(D):W>3?H(M,B,D):H(M,B))||D);return W>3&&D&&Object.defineProperty(M,B,D),D},d=this&&this.__param||function(L,M){return function(B,I){M(B,I,L)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const o=i(3787),p=i(2550),_=i(2223),y=i(6171),g=i(4725),n=i(8055),f=i(8460),h=i(844),u=i(2585),v="xterm-dom-renderer-owner-",x="xterm-rows",w="xterm-fg-",k="xterm-bg-",S="xterm-focus",E="xterm-selection";let T=1,A=r.DomRenderer=class extends h.Disposable{constructor(L,M,B,I,H,W,D,N,P,O){super(),this._element=L,this._screenElement=M,this._viewportElement=B,this._linkifier2=I,this._charSizeService=W,this._optionsService=D,this._bufferService=N,this._coreBrowserService=P,this._themeService=O,this._terminalClass=T++,this._rowElements=[],this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(x),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(E),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((U=>this._injectCss(U)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(v+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((U=>this._handleLinkHover(U)))),this.register(this._linkifier2.onHideLinkUnderline((U=>this._handleLinkLeave(U)))),this.register((0,h.toDisposable)((()=>{this._element.classList.remove(v+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 M=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=M,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 M=`${this._terminalSelector} .${x} { color: ${L.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;M+=`${this._terminalSelector} .${x} .xterm-dim { color: ${n.color.multiplyOpacity(L.foreground,.5).css};}`,M+=`${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;}`,M+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",M+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css}; } 50% { background-color: inherit; color: ${L.cursor.css}; }}`,M+=`${this._terminalSelector} .${x}.${S} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${x}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${L.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${L.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${L.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,M+=`${this._terminalSelector} .${E} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${E} div { position: absolute; background-color: ${L.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${L.selectionInactiveBackgroundOpaque.css};}`;for(const[B,I]of L.ansi.entries())M+=`${this._terminalSelector} .${w}${B} { color: ${I.css}; }${this._terminalSelector} .${w}${B}.xterm-dim { color: ${n.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${k}${B} { background-color: ${I.css}; }`;M+=`${this._terminalSelector} .${w}${_.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(L.background).css}; }${this._terminalSelector} .${w}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(L.background),.5).css}; }${this._terminalSelector} .${k}${_.INVERTED_DEFAULT_COLOR} { background-color: ${L.foreground.css}; }`,this._themeStyleElement.textContent=M}_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,M){for(let B=this._rowElements.length;B<=M;B++){const I=document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>M;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(L,M){this._refreshRowElements(L,M),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(S)}handleFocus(){this._rowContainer.classList.add(S),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(L,M,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(L,M,B),this.renderRows(0,this._bufferService.rows-1),!L||!M)return;const I=L[1]-this._bufferService.buffer.ydisp,H=M[1]-this._bufferService.buffer.ydisp,W=Math.max(I,0),D=Math.min(H,this._bufferService.rows-1);if(W>=this._bufferService.rows||D<0)return;const N=document.createDocumentFragment();if(B){const P=L[0]>M[0];N.appendChild(this._createSelectionElement(W,P?M[0]:L[0],P?L[0]:M[0],D-W+1))}else{const P=I===W?L[0]:0,O=W===H?M[0]:this._bufferService.cols;N.appendChild(this._createSelectionElement(W,P,O));const U=D-W-1;if(N.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,U)),W!==D){const X=H===D?M[0]:this._bufferService.cols;N.appendChild(this._createSelectionElement(D,0,X))}}this._selectionContainer.appendChild(N)}_createSelectionElement(L,M,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=M*this.dimensions.css.cell.width+"px",H.style.width=this.dimensions.css.cell.width*(B-M)+"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,M){const B=this._bufferService.buffer,I=B.ybase+B.y,H=Math.min(B.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,D=this._optionsService.rawOptions.cursorStyle,N=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=L;P<=M;P++){const O=P+B.ydisp,U=this._rowElements[P],X=B.lines.get(O);if(!U||!X)break;U.replaceChildren(...this._rowFactory.createRow(X,O,O===I,D,N,H,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${v}${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,M,B,I,H,W){B<0&&(L=0),I<0&&(M=0);const D=this._bufferService.rows-1;B=Math.max(Math.min(B,D),0),I=Math.max(Math.min(I,D),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),U=this._optionsService.rawOptions.cursorBlink,X=this._optionsService.rawOptions.cursorStyle,V=this._optionsService.rawOptions.cursorInactiveStyle;for(let Q=B;Q<=I;++Q){const ae=Q+N.ydisp,j=this._rowElements[Q],F=N.lines.get(ae);if(!j||!F)break;j.replaceChildren(...this._rowFactory.createRow(F,ae,ae===P,X,V,O,U,this.dimensions.css.cell.width,this._widthCache,W?Q===B?L:0:-1,W?(Q===I?M:H)-1:-1))}}};r.DomRenderer=A=c([d(4,u.IInstantiationService),d(5,g.ICharSizeService),d(6,u.IOptionsService),d(7,u.IBufferService),d(8,g.ICoreBrowserService),d(9,g.IThemeService)],A)},3787:function(C,r,i){var c=this&&this.__decorate||function(w,k,S,E){var T,A=arguments.length,L=A<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,k,S,E);else for(var M=w.length-1;M>=0;M--)(T=w[M])&&(L=(A<3?T(L):A>3?T(k,S,L):T(k,S))||L);return A>3&&L&&Object.defineProperty(k,S,L),L},d=this&&this.__param||function(w,k){return function(S,E){k(S,E,w)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const o=i(2223),p=i(643),_=i(511),y=i(2585),g=i(8055),n=i(4725),f=i(4269),h=i(6171),u=i(3734);let v=r.DomRendererRowFactory=class{constructor(w,k,S,E,T,A,L){this._document=w,this._characterJoinerService=k,this._optionsService=S,this._coreBrowserService=E,this._coreService=T,this._decorationService=A,this._themeService=L,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,k,S){this._selectionStart=w,this._selectionEnd=k,this._columnSelectMode=S}createRow(w,k,S,E,T,A,L,M,B,I,H){const W=[],D=this._characterJoinerService.getJoinedCharacters(k),N=this._themeService.colors;let P,O=w.getNoBgTrimmedLength();S&&O<A+1&&(O=A+1);let U=0,X="",V=0,Q=0,ae=0,j=!1,F=0,$=!1,z=0;const Z=[],K=I!==-1&&H!==-1;for(let ne=0;ne<O;ne++){w.loadCell(ne,this._workCell);let ue=this._workCell.getWidth();if(ue===0)continue;let ye=!1,je=ne,J=this._workCell;if(D.length>0&&ne===D[0][0]){ye=!0;const be=D.shift();J=new f.JoinedCellData(this._workCell,w.translateToString(!0,be[0],be[1]),be[1]-be[0]),je=be[1]-1,ue=J.getWidth()}const He=this._isCellInSelection(ne,k),ze=S&&ne===A,Oe=K&&ne>=I&&ne<=H;let Be=!1;this._decorationService.forEachDecorationAtCell(ne,k,void 0,(be=>{Be=!0}));let Te=J.getChars()||p.WHITESPACE_CELL_CHAR;if(Te===" "&&(J.isUnderline()||J.isOverline())&&(Te=" "),z=ue*M-B.get(Te,J.isBold(),J.isItalic()),P){if(U&&(He&&$||!He&&!$&&J.bg===V)&&(He&&$&&N.selectionForeground||J.fg===Q)&&J.extended.ext===ae&&Oe===j&&z===F&&!ze&&!ye&&!Be){X+=Te,U++;continue}U&&(P.textContent=X),P=this._document.createElement("span"),U=0,X=""}else P=this._document.createElement("span");if(V=J.bg,Q=J.fg,ae=J.extended.ext,j=Oe,F=z,$=He,ye&&A>=ne&&A<=je&&(A=ne),!this._coreService.isCursorHidden&&ze){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)L&&Z.push("xterm-cursor-blink"),Z.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(J.isBold()&&Z.push("xterm-bold"),J.isItalic()&&Z.push("xterm-italic"),J.isDim()&&Z.push("xterm-dim"),X=J.isInvisible()?p.WHITESPACE_CELL_CHAR:J.getChars()||p.WHITESPACE_CELL_CHAR,J.isUnderline()&&(Z.push(`xterm-underline-${J.extended.underlineStyle}`),X===" "&&(X=" "),!J.isUnderlineColorDefault()))if(J.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(J.getUnderlineColor()).join(",")})`;else{let be=J.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&J.isBold()&&be<8&&(be+=8),P.style.textDecorationColor=N.ansi[be].css}J.isOverline()&&(Z.push("xterm-overline"),X===" "&&(X=" ")),J.isStrikethrough()&&Z.push("xterm-strikethrough"),Oe&&(P.style.textDecoration="underline");let G=J.getFgColor(),ie=J.getFgColorMode(),fe=J.getBgColor(),te=J.getBgColorMode();const ge=!!J.isInverse();if(ge){const be=G;G=fe,fe=be;const Qe=ie;ie=te,te=Qe}let ce,Ce,Ne,Ie=!1;switch(this._decorationService.forEachDecorationAtCell(ne,k,void 0,(be=>{be.options.layer!=="top"&&Ie||(be.backgroundColorRGB&&(te=50331648,fe=be.backgroundColorRGB.rgba>>8&16777215,ce=be.backgroundColorRGB),be.foregroundColorRGB&&(ie=50331648,G=be.foregroundColorRGB.rgba>>8&16777215,Ce=be.foregroundColorRGB),Ie=be.options.layer==="top")})),!Ie&&He&&(ce=this._coreBrowserService.isFocused?N.selectionBackgroundOpaque:N.selectionInactiveBackgroundOpaque,fe=ce.rgba>>8&16777215,te=50331648,Ie=!0,N.selectionForeground&&(ie=50331648,G=N.selectionForeground.rgba>>8&16777215,Ce=N.selectionForeground)),Ie&&Z.push("xterm-decoration-top"),te){case 16777216:case 33554432:Ne=N.ansi[fe],Z.push(`xterm-bg-${fe}`);break;case 50331648:Ne=g.rgba.toColor(fe>>16,fe>>8&255,255&fe),this._addStyle(P,`background-color:#${x((fe>>>0).toString(16),"0",6)}`);break;default:ge?(Ne=N.foreground,Z.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):Ne=N.background}switch(ce||J.isDim()&&(ce=g.color.multiplyOpacity(Ne,.5)),ie){case 16777216:case 33554432:J.isBold()&&G<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(G+=8),this._applyMinimumContrast(P,Ne,N.ansi[G],J,ce,void 0)||Z.push(`xterm-fg-${G}`);break;case 50331648:const be=g.rgba.toColor(G>>16&255,G>>8&255,255&G);this._applyMinimumContrast(P,Ne,be,J,ce,Ce)||this._addStyle(P,`color:#${x(G.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,Ne,N.foreground,J,ce,void 0)||ge&&Z.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}Z.length&&(P.className=Z.join(" "),Z.length=0),ze||ye||Be?P.textContent=X:U++,z!==this.defaultSpacing&&(P.style.letterSpacing=`${z}px`),W.push(P),ne=je}return P&&U&&(P.textContent=X),W}_applyMinimumContrast(w,k,S,E,T,A){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.excludeFromContrastRatioDemands)(E.getCode()))return!1;const L=this._getContrastCache(E);let M;if(T||A||(M=L.getColor(k.rgba,S.rgba)),M===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);M=g.color.ensureContrastRatio(T||k,A||S,B),L.setColor((T||k).rgba,(A||S).rgba,M??null)}return!!M&&(this._addStyle(w,`color:${M.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,k){w.setAttribute("style",`${w.getAttribute("style")||""}${k};`)}_isCellInSelection(w,k){const S=this._selectionStart,E=this._selectionEnd;return!(!S||!E)&&(this._columnSelectMode?S[0]<=E[0]?w>=S[0]&&k>=S[1]&&w<E[0]&&k<=E[1]:w<S[0]&&k>=S[1]&&w>=E[0]&&k<=E[1]:k>S[1]&&k<E[1]||S[1]===E[1]&&k===S[1]&&w>=S[0]&&w<E[0]||S[1]<E[1]&&k===E[1]&&w<E[0]||S[1]<E[1]&&k===S[1]&&w>=S[0])}};function x(w,k,S){for(;w.length<S;)w=k+w;return w}r.DomRendererRowFactory=v=c([d(1,n.ICharacterJoinerService),d(2,y.IOptionsService),d(3,n.ICoreBrowserService),d(4,y.ICoreService),d(5,y.IDecorationService),d(6,n.IThemeService)],v)},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"),d=i.createElement("span");d.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,d,o,p],this._container.appendChild(c),this._container.appendChild(d),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,d,o){i===this._font&&c===this._fontSize&&d===this._weight&&o===this._weightBold||(this._font=i,this._fontSize=c,this._weight=d,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(i,c,d){let o=0;if(!c&&!d&&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"),d&&(p+="I");let _=this._holey.get(p);if(_===void 0){let y=0;c&&(y|=1),d&&(y|=2),_=this._measure(i,y),this._holey.set(p,_)}return _}_measure(i,c){const d=this._measureElements[c];return d.textContent=i.repeat(32),d.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(d){return 9472<=d&&d<=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,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const o=i(2585),p=i(8460),_=i(844);let y=r.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(n,f,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,f,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=y=c([d(2,o.IOptionsService)],y);class g{constructor(f,h,u){this._document=f,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 f={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return f.width!==0&&f.height!==0&&(this._result.width=f.width/32,this._result.height=Math.ceil(f.height)),this._result}}},4269:function(C,r,i){var c=this&&this.__decorate||function(f,h,u,v){var x,w=arguments.length,k=w<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(f,h,u,v);else for(var S=f.length-1;S>=0;S--)(x=f[S])&&(k=(w<3?x(k):w>3?x(h,u,k):x(h,u))||k);return w>3&&k&&Object.defineProperty(h,u,k),k},d=this&&this.__param||function(f,h){return function(u,v){h(u,v,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const o=i(3734),p=i(643),_=i(511),y=i(2585);class g extends o.AttributeData{constructor(h,u,v){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=u,this._width=v}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 En{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.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 v=[],x=u.translateToString(!0);let w=0,k=0,S=0,E=u.getFg(0),T=u.getBg(0);for(let A=0;A<u.getTrimmedLength();A++)if(u.loadCell(A,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==T){if(A-w>1){const L=this._getJoinedRanges(x,S,k,u,w);for(let M=0;M<L.length;M++)v.push(L[M])}w=A,S=k,E=this._workCell.fg,T=this._workCell.bg}k+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){const A=this._getJoinedRanges(x,S,k,u,w);for(let L=0;L<A.length;L++)v.push(A[L])}return v}_getJoinedRanges(h,u,v,x,w){const k=h.substring(u,v);let S=[];try{S=this._characterJoiners[0].handler(k)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const T=this._characterJoiners[E].handler(k);for(let A=0;A<T.length;A++)En._mergeRanges(S,T[A])}catch(T){console.error(T)}return this._stringRangesToCellRanges(S,x,w),S}_stringRangesToCellRanges(h,u,v){let x=0,w=!1,k=0,S=h[x];if(S){for(let E=v;E<this._bufferService.cols;E++){const T=u.getWidth(E),A=u.getString(E).length||p.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!w&&S[0]<=k&&(S[0]=E,w=!0),S[1]<=k){if(S[1]=E,S=h[++x],!S)break;S[0]<=k?(S[0]=E,w=!0):w=!1}k+=A}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(h,u){let v=!1;for(let x=0;x<h.length;x++){const w=h[x];if(v){if(u[1]<=w[0])return h[x-1][1]=u[1],h;if(u[1]<=w[1])return h[x-1][1]=Math.max(u[1],w[1]),h.splice(x,1),h;h.splice(x,1),x--}else{if(u[1]<=w[0])return h.splice(x,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]),v=!0)}}return v?h[h.length-1][1]=u[1]:h.push(u),h}};r.CharacterJoinerService=n=c([d(0,y.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(y,g,n,f){var h,u=arguments.length,v=u<3?g:f===null?f=Object.getOwnPropertyDescriptor(g,n):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(y,g,n,f);else for(var x=y.length-1;x>=0;x--)(h=y[x])&&(v=(u<3?h(v):u>3?h(g,n,v):h(g,n))||v);return u>3&&v&&Object.defineProperty(g,n,v),v},d=this&&this.__param||function(y,g){return function(n,f){g(n,f,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const o=i(4725),p=i(9806);let _=r.MouseService=class{constructor(y,g){this._renderService=y,this._charSizeService=g}getCoords(y,g,n,f,h){return(0,p.getCoords)(window,y,g,n,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,h)}getMouseReportCoords(y,g){const n=(0,p.getCoordsRelativeToElement)(window,y,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=_=c([d(0,o.IRenderService),d(1,o.ICharSizeService)],_)},3230:function(C,r,i){var c=this&&this.__decorate||function(v,x,w,k){var S,E=arguments.length,T=E<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,x,w,k);else for(var A=v.length-1;A>=0;A--)(S=v[A])&&(T=(E<3?S(T):E>3?S(x,w,T):S(x,w))||T);return E>3&&T&&Object.defineProperty(x,w,T),T},d=this&&this.__param||function(v,x){return function(w,k){x(w,k,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const o=i(3656),p=i(6193),_=i(5596),y=i(4725),g=i(8460),n=i(844),f=i(7226),h=i(2585);let u=r.RenderService=class extends n.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,x,w,k,S,E,T,A){if(super(),this._rowCount=v,this._charSizeService=k,this._renderer=this.register(new n.MutableDisposable),this._pausedResizeTask=new f.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(T.window,((L,M)=>this._renderRows(L,M))),this.register(this._renderDebouncer),this._screenDprMonitor=new _.ScreenDprMonitor(T.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(E.onResize((()=>this._fullRefresh()))),this.register(E.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(S.onDecorationRegistered((()=>this._fullRefresh()))),this.register(S.onDecorationRemoved((()=>this._fullRefresh()))),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(E.cols,E.rows),this._fullRefresh()}))),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(E.buffer.y,E.buffer.y,!0)))),this.register((0,o.addDisposableDomListener)(T.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(A.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in T.window){const L=new T.window.IntersectionObserver((M=>this._handleIntersectionChange(M[M.length-1])),{threshold:0});L.observe(x),this.register({dispose:()=>L.disconnect()})}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.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(v,x,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,x,this._rowCount))}_renderRows(v,x){this._renderer.value&&(v=Math.min(v,this._rowCount-1),x=Math.min(x,this._rowCount-1),this._renderer.value.renderRows(v,x),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:x}),this._onRender.fire({start:v,end:x}),this._isNextRenderRedrawOnly=!0)}resize(v,x){this._rowCount=x,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(v){this._renderer.value=v,this._renderer.value.onRequestRedraw((x=>this.refreshRows(x.start,x.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var v,x;this._renderer.value&&((x=(v=this._renderer.value).clearTextureAtlas)===null||x===void 0||x.call(v),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,x){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(v,x))):this._renderer.value.handleResize(v,x),this._fullRefresh())}handleCharSizeChanged(){var v;(v=this._renderer.value)===null||v===void 0||v.handleCharSizeChanged()}handleBlur(){var v;(v=this._renderer.value)===null||v===void 0||v.handleBlur()}handleFocus(){var v;(v=this._renderer.value)===null||v===void 0||v.handleFocus()}handleSelectionChanged(v,x,w){var k;this._selectionState.start=v,this._selectionState.end=x,this._selectionState.columnSelectMode=w,(k=this._renderer.value)===null||k===void 0||k.handleSelectionChanged(v,x,w)}handleCursorMove(){var v;(v=this._renderer.value)===null||v===void 0||v.handleCursorMove()}clear(){var v;(v=this._renderer.value)===null||v===void 0||v.clear()}};r.RenderService=u=c([d(2,h.IOptionsService),d(3,y.ICharSizeService),d(4,h.IDecorationService),d(5,h.IBufferService),d(6,y.ICoreBrowserService),d(7,y.IThemeService)],u)},9312:function(C,r,i){var c=this&&this.__decorate||function(S,E,T,A){var L,M=arguments.length,B=M<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,E,T,A);else for(var I=S.length-1;I>=0;I--)(L=S[I])&&(B=(M<3?L(B):M>3?L(E,T,B):L(E,T))||B);return M>3&&B&&Object.defineProperty(E,T,B),B},d=this&&this.__param||function(S,E){return function(T,A){E(T,A,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const o=i(9806),p=i(9504),_=i(456),y=i(4725),g=i(8460),n=i(844),f=i(6114),h=i(4841),u=i(511),v=i(2585),x=" ",w=new RegExp(x,"g");let k=r.SelectionService=class extends n.Disposable{constructor(S,E,T,A,L,M,B,I,H){super(),this._element=S,this._screenElement=E,this._linkifier=T,this._bufferService=A,this._coreService=L,this._mouseService=M,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 _.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 S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!S||!E||S[0]===E[0]&&S[1]===E[1])}get selectionText(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!S||!E)return"";const T=this._bufferService.buffer,A=[];if(this._activeSelectionMode===3){if(S[0]===E[0])return"";const L=S[0]<E[0]?S[0]:E[0],M=S[0]<E[0]?E[0]:S[0];for(let B=S[1];B<=E[1];B++){const I=T.translateBufferLineToString(B,!0,L,M);A.push(I)}}else{const L=S[1]===E[1]?E[0]:void 0;A.push(T.translateBufferLineToString(S[1],!0,S[0],L));for(let M=S[1]+1;M<=E[1]-1;M++){const B=T.lines.get(M),I=T.translateBufferLineToString(M,!0);B?.isWrapped?A[A.length-1]+=I:A.push(I)}if(S[1]!==E[1]){const M=T.lines.get(E[1]),B=T.translateBufferLineToString(E[1],!0,0,E[0]);M&&M.isWrapped?A[A.length-1]+=B:A.push(B)}}return A.map((L=>L.replace(w," "))).join(f.isWindows?`\r
|
|
16
16
|
`:`
|
|
17
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(y){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),f.isLinux&&y&&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(y){const E=this._getMouseBufferCoords(y),j=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!!(j&&A&&E)&&this._areCoordsInSelection(E,j,A)}isCellInSelection(y,E){const j=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!(!j||!A)&&this._areCoordsInSelection([y,E],j,A)}_areCoordsInSelection(y,E,j){return y[1]>E[1]&&y[1]<j[1]||E[1]===j[1]&&y[1]===E[1]&&y[0]>=E[0]&&y[0]<j[0]||E[1]<j[1]&&y[1]===j[1]&&y[0]<j[0]||E[1]<j[1]&&y[1]===E[1]&&y[0]>=E[0]}_selectWordAtCursor(y,E){var j,A;const L=(A=(j=this._linkifier.currentLink)===null||j===void 0?void 0:j.link)===null||A===void 0?void 0:A.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 N=this._getMouseBufferCoords(y);return!!N&&(this._selectWordAt(N,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(y,E){this._model.clearSelection(),y=Math.max(y,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,y],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(y){this._model.handleTrim(y)&&this.refresh()}_getMouseBufferCoords(y){const E=this._mouseService.getCoords(y,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(y){let E=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,y,this._screenElement)[1];const j=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=j?0:(E>j&&(E-=j),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(y){return f.isMac?y.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:y.shiftKey}handleMouseDown(y){if(this._mouseDownTimeStamp=y.timeStamp,(y.button!==2||!this.hasSelection)&&y.button===0){if(!this._enabled){if(!this.shouldForceSelection(y))return;y.stopPropagation()}y.preventDefault(),this._dragScrollAmount=0,this._enabled&&y.shiftKey?this._handleIncrementalClick(y):y.detail===1?this._handleSingleClick(y):y.detail===2?this._handleDoubleClick(y):y.detail===3&&this._handleTripleClick(y),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(y){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(y))}_handleSingleClick(y){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(y)?3:0,this._model.selectionStart=this._getMouseBufferCoords(y),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(y){this._selectWordAtCursor(y,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(y){const E=this._getMouseBufferCoords(y);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(y){return y.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(y){if(y.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(y),!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(y),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 A=j.lines.get(this._model.selectionEnd[1]);A&&A.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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 y=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(y.ydisp+this._bufferService.rows,y.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=y.ydisp),this.refresh()}}_handleMouseUp(y){const E=y.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&y.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const j=this._mouseService.getCoords(y,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(j&&j[0]!==void 0&&j[1]!==void 0){const A=(0,p.moveToCellSequence)(j[0]-1,j[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(A,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,j=!(!y||!E||y[0]===E[0]&&y[1]===E[1]);j?y&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&y[0]===this._oldSelectionStart[0]&&y[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(y,E,j)):this._oldHasSelection&&this._fireOnSelectionChange(y,E,j)}_fireOnSelectionChange(y,E,j){this._oldSelectionStart=y,this._oldSelectionEnd=E,this._oldHasSelection=j,this._onSelectionChange.fire()}_handleBufferActivate(y){this.clearSelection(),this._trimListener.dispose(),this._trimListener=y.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(y,E){let j=E;for(let A=0;E>=A;A++){const L=y.loadCell(A,this._workCell).getChars().length;this._workCell.getWidth()===0?j--:L>1&&E!==A&&(j+=L-1)}return j}setSelection(y,E,j){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[y,E],this._model.selectionStartLength=j,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(y){this._isClickInSelection(y)||(this._selectWordAtCursor(y,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(y,E,j=!0,A=!0){if(y[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,N=L.lines.get(y[1]);if(!N)return;const B=L.translateBufferLineToString(y[1],!1);let I=this._convertViewportColToCharacterIndex(N,y[0]),H=I;const W=y[0]-I;let D=0,M=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 V=y[0],Y=y[0];N.getWidth(V)===0&&(D++,V--),N.getWidth(Y)===2&&(M++,Y++);const ie=N.getString(Y).length;for(ie>1&&(O+=ie-1,H+=ie-1);V>0&&I>0&&!this._isCharWordSeparator(N.loadCell(V-1,this._workCell));){N.loadCell(V-1,this._workCell);const T=this._workCell.getChars().length;this._workCell.getWidth()===0?(D++,V--):T>1&&(P+=T-1,I-=T-1),I--,V--}for(;Y<N.length&&H+1<B.length&&!this._isCharWordSeparator(N.loadCell(Y+1,this._workCell));){N.loadCell(Y+1,this._workCell);const T=this._workCell.getChars().length;this._workCell.getWidth()===2?(M++,Y++):T>1&&(O+=T-1,H+=T-1),H++,Y++}}H++;let U=I+W-D+P,K=Math.min(this._bufferService.cols,H-I+D+M-P-O);if(E||B.slice(I,H).trim()!==""){if(j&&U===0&&N.getCodePoint(0)!==32){const V=L.lines.get(y[1]-1);if(V&&N.isWrapped&&V.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,y[1]-1],!1,!0,!1);if(Y){const ie=this._bufferService.cols-Y.start;U-=ie,K+=ie}}}if(A&&U+K===this._bufferService.cols&&N.getCodePoint(this._bufferService.cols-1)!==32){const V=L.lines.get(y[1]+1);if(V?.isWrapped&&V.getCodePoint(0)!==32){const Y=this._getWordAt([0,y[1]+1],!1,!1,!0);Y&&(K+=Y.length)}}return{start:U,length:K}}}_selectWordAt(y,E){const j=this._getWordAt(y,E);if(j){for(;j.start<0;)j.start+=this._bufferService.cols,y[1]--;this._model.selectionStart=[j.start,y[1]],this._model.selectionStartLength=j.length}}_selectToWordAt(y){const E=this._getWordAt(y,!0);if(E){let j=y[1];for(;E.start<0;)E.start+=this._bufferService.cols,j--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,j++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,j]}}_isCharWordSeparator(y){return y.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(y.getChars())>=0}_selectLineAt(y){const E=this._bufferService.buffer.getWrappedRangeForLine(y),j={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(j,this._bufferService.cols)}};r.SelectionService=k=c([d(3,v.IBufferService),d(4,v.ICoreService),d(5,S.IMouseService),d(6,v.IOptionsService),d(7,S.IRenderService),d(8,S.ICoreBrowserService)],k)},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(k,y,E,j){var A,L=arguments.length,N=L<3?y:j===null?j=Object.getOwnPropertyDescriptor(y,E):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(k,y,E,j);else for(var B=k.length-1;B>=0;B--)(A=k[B])&&(N=(L<3?A(N):L>3?A(y,E,N):A(y,E))||N);return L>3&&N&&Object.defineProperty(y,E,N),N},d=this&&this.__param||function(k,y){return function(E,j){y(E,j,k)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const o=i(7239),p=i(8055),_=i(8460),S=i(844),g=i(2585),n=p.css.toColor("#ffffff"),f=p.css.toColor("#000000"),h=p.css.toColor("#ffffff"),u=p.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const k=[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")],y=[0,95,135,175,215,255];for(let E=0;E<216;E++){const j=y[E/36%6|0],A=y[E/6%6|0],L=y[E%6];k.push({css:p.channels.toCss(j,A,L),rgba:p.channels.toRgba(j,A,L)})}for(let E=0;E<24;E++){const j=8+10*E;k.push({css:p.channels.toCss(j,j,j),rgba:p.channels.toRgba(j,j,j)})}return k})());let x=r.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(k){super(),this._optionsService=k,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:n,background:f,cursor:h,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:p.color.blend(f,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:p.color.blend(f,v),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(k={}){const y=this._colors;if(y.foreground=w(k.foreground,n),y.background=w(k.background,f),y.cursor=w(k.cursor,h),y.cursorAccent=w(k.cursorAccent,u),y.selectionBackgroundTransparent=w(k.selectionBackground,v),y.selectionBackgroundOpaque=p.color.blend(y.background,y.selectionBackgroundTransparent),y.selectionInactiveBackgroundTransparent=w(k.selectionInactiveBackground,y.selectionBackgroundTransparent),y.selectionInactiveBackgroundOpaque=p.color.blend(y.background,y.selectionInactiveBackgroundTransparent),y.selectionForeground=k.selectionForeground?w(k.selectionForeground,p.NULL_COLOR):void 0,y.selectionForeground===p.NULL_COLOR&&(y.selectionForeground=void 0),p.color.isOpaque(y.selectionBackgroundTransparent)&&(y.selectionBackgroundTransparent=p.color.opacity(y.selectionBackgroundTransparent,.3)),p.color.isOpaque(y.selectionInactiveBackgroundTransparent)&&(y.selectionInactiveBackgroundTransparent=p.color.opacity(y.selectionInactiveBackgroundTransparent,.3)),y.ansi=r.DEFAULT_ANSI_COLORS.slice(),y.ansi[0]=w(k.black,r.DEFAULT_ANSI_COLORS[0]),y.ansi[1]=w(k.red,r.DEFAULT_ANSI_COLORS[1]),y.ansi[2]=w(k.green,r.DEFAULT_ANSI_COLORS[2]),y.ansi[3]=w(k.yellow,r.DEFAULT_ANSI_COLORS[3]),y.ansi[4]=w(k.blue,r.DEFAULT_ANSI_COLORS[4]),y.ansi[5]=w(k.magenta,r.DEFAULT_ANSI_COLORS[5]),y.ansi[6]=w(k.cyan,r.DEFAULT_ANSI_COLORS[6]),y.ansi[7]=w(k.white,r.DEFAULT_ANSI_COLORS[7]),y.ansi[8]=w(k.brightBlack,r.DEFAULT_ANSI_COLORS[8]),y.ansi[9]=w(k.brightRed,r.DEFAULT_ANSI_COLORS[9]),y.ansi[10]=w(k.brightGreen,r.DEFAULT_ANSI_COLORS[10]),y.ansi[11]=w(k.brightYellow,r.DEFAULT_ANSI_COLORS[11]),y.ansi[12]=w(k.brightBlue,r.DEFAULT_ANSI_COLORS[12]),y.ansi[13]=w(k.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),y.ansi[14]=w(k.brightCyan,r.DEFAULT_ANSI_COLORS[14]),y.ansi[15]=w(k.brightWhite,r.DEFAULT_ANSI_COLORS[15]),k.extendedAnsi){const E=Math.min(y.ansi.length-16,k.extendedAnsi.length);for(let j=0;j<E;j++)y.ansi[j+16]=w(k.extendedAnsi[j],r.DEFAULT_ANSI_COLORS[j+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(k){this._restoreColor(k),this._onChangeColors.fire(this.colors)}_restoreColor(k){if(k!==void 0)switch(k){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[k]=this._restoreColors.ansi[k]}else for(let y=0;y<this._restoreColors.ansi.length;++y)this._colors.ansi[y]=this._restoreColors.ansi[y]}modifyColors(k){k(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(k,y){if(k!==void 0)try{return p.css.toColor(k)}catch{}return y}r.ThemeService=x=c([d(0,g.IOptionsService)],x)},6349:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const c=i(8460),d=i(844);class o extends d.Disposable{constructor(_){super(),this._maxLength=_,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(_){if(this._maxLength===_)return;const S=new Array(_);for(let g=0;g<Math.min(_,this.length);g++)S[g]=this._array[this._getCyclicIndex(g)];this._array=S,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let S=this._length;S<_;S++)this._array[S]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,S){this._array[this._getCyclicIndex(_)]=S}push(_){this._array[this._getCyclicIndex(this._length)]=_,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(_,S,...g){if(S){for(let n=_;n<this._length-S;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+S)];this._length-=S,this.onDeleteEmitter.fire({index:_,amount:S})}for(let n=this._length-1;n>=_;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(_+n)]=g[n];if(g.length&&this.onInsertEmitter.fire({index:_,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(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,S,g){if(!(S<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let f=S-1;f>=0;f--)this.set(_+f+g,this.get(_+f));const n=_+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(_+n+g,this.get(_+n))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}r.CircularList=o},1439:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function i(c,d=5){if(typeof c!="object")return c;const o=Array.isArray(c)?[]:{};for(const p in c)o[p]=d<=1?c[p]:c[p]&&i(c[p],d-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 d=0,o=0,p=0,_=0;var S,g,n,f,h;function u(x){const w=x.toString(16);return w.length<2?"0"+w:w}function v(x,w){return x<w?(w+.05)/(x+.05):(x+.05)/(w+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(x){x.toCss=function(w,k,y,E){return E!==void 0?`#${u(w)}${u(k)}${u(y)}${u(E)}`:`#${u(w)}${u(k)}${u(y)}`},x.toRgba=function(w,k,y,E=255){return(w<<24|k<<16|y<<8|E)>>>0}})(S||(r.channels=S={})),(function(x){function w(k,y){return _=Math.round(255*y),[d,o,p]=h.toChannels(k.rgba),{css:S.toCss(d,o,p,_),rgba:S.toRgba(d,o,p,_)}}x.blend=function(k,y){if(_=(255&y.rgba)/255,_===1)return{css:y.css,rgba:y.rgba};const E=y.rgba>>24&255,j=y.rgba>>16&255,A=y.rgba>>8&255,L=k.rgba>>24&255,N=k.rgba>>16&255,B=k.rgba>>8&255;return d=L+Math.round((E-L)*_),o=N+Math.round((j-N)*_),p=B+Math.round((A-B)*_),{css:S.toCss(d,o,p),rgba:S.toRgba(d,o,p)}},x.isOpaque=function(k){return(255&k.rgba)==255},x.ensureContrastRatio=function(k,y,E){const j=h.ensureContrastRatio(k.rgba,y.rgba,E);if(j)return h.toColor(j>>24&255,j>>16&255,j>>8&255)},x.opaque=function(k){const y=(255|k.rgba)>>>0;return[d,o,p]=h.toChannels(y),{css:S.toCss(d,o,p),rgba:y}},x.opacity=w,x.multiplyOpacity=function(k,y){return _=255&k.rgba,w(k,_*y/255)},x.toColorRGB=function(k){return[k.rgba>>24&255,k.rgba>>16&255,k.rgba>>8&255]}})(g||(r.color=g={})),(function(x){let w,k;if(!c.isNode){const y=document.createElement("canvas");y.width=1,y.height=1;const E=y.getContext("2d",{willReadFrequently:!0});E&&(w=E,w.globalCompositeOperation="copy",k=w.createLinearGradient(0,0,1,1))}x.toColor=function(y){if(y.match(/#[\da-f]{3,8}/i))switch(y.length){case 4:return d=parseInt(y.slice(1,2).repeat(2),16),o=parseInt(y.slice(2,3).repeat(2),16),p=parseInt(y.slice(3,4).repeat(2),16),h.toColor(d,o,p);case 5:return d=parseInt(y.slice(1,2).repeat(2),16),o=parseInt(y.slice(2,3).repeat(2),16),p=parseInt(y.slice(3,4).repeat(2),16),_=parseInt(y.slice(4,5).repeat(2),16),h.toColor(d,o,p,_);case 7:return{css:y,rgba:(parseInt(y.slice(1),16)<<8|255)>>>0};case 9:return{css:y,rgba:parseInt(y.slice(1),16)>>>0}}const E=y.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(E)return d=parseInt(E[1]),o=parseInt(E[2]),p=parseInt(E[3]),_=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),h.toColor(d,o,p,_);if(!w||!k)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=k,w.fillStyle=y,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[d,o,p,_]=w.getImageData(0,0,1,1).data,_!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(d,o,p,_),css:y}}})(n||(r.css=n={})),(function(x){function w(k,y,E){const j=k/255,A=y/255,L=E/255;return .2126*(j<=.03928?j/12.92:Math.pow((j+.055)/1.055,2.4))+.7152*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}x.relativeLuminance=function(k){return w(k>>16&255,k>>8&255,255&k)},x.relativeLuminance2=w})(f||(r.rgb=f={})),(function(x){function w(y,E,j){const A=y>>24&255,L=y>>16&255,N=y>>8&255;let B=E>>24&255,I=E>>16&255,H=E>>8&255,W=v(f.relativeLuminance2(B,I,H),f.relativeLuminance2(A,L,N));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=v(f.relativeLuminance2(B,I,H),f.relativeLuminance2(A,L,N));return(B<<24|I<<16|H<<8|255)>>>0}function k(y,E,j){const A=y>>24&255,L=y>>16&255,N=y>>8&255;let B=E>>24&255,I=E>>16&255,H=E>>8&255,W=v(f.relativeLuminance2(B,I,H),f.relativeLuminance2(A,L,N));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=v(f.relativeLuminance2(B,I,H),f.relativeLuminance2(A,L,N));return(B<<24|I<<16|H<<8|255)>>>0}x.ensureContrastRatio=function(y,E,j){const A=f.relativeLuminance(y>>8),L=f.relativeLuminance(E>>8);if(v(A,L)<j){if(L<A){const I=w(y,E,j),H=v(A,f.relativeLuminance(I>>8));if(H<j){const W=k(y,E,j);return H>v(A,f.relativeLuminance(W>>8))?I:W}return I}const N=k(y,E,j),B=v(A,f.relativeLuminance(N>>8));if(B<j){const I=w(y,E,j);return B>v(A,f.relativeLuminance(I>>8))?N:I}return N}},x.reduceLuminance=w,x.increaseLuminance=k,x.toChannels=function(y){return[y>>24&255,y>>16&255,y>>8&255,255&y]},x.toColor=function(y,E,j,A){return{css:S.toCss(y,E,j,A),rgba:S.toRgba(y,E,j,A)}}})(h||(r.rgba=h={})),r.toPaddedHex=u,r.contrastRatio=v},8969:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const c=i(844),d=i(2585),o=i(4348),p=i(7866),_=i(744),S=i(7302),g=i(6975),n=i(8460),f=i(1753),h=i(1480),u=i(7994),v=i(9282),x=i(5435),w=i(5981),k=i(2660);let y=!1;class E extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new n.EventEmitter),this._onScroll.event((A=>{var L;(L=this._onScrollApi)===null||L===void 0||L.fire(A.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(A){for(const L in A)this.optionsService.options[L]=A[L]}constructor(A){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(A)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(g.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(k.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new x.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,N)=>this._inputHandler.parse(L,N)))),this.register((0,n.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(A,L){this._writeBuffer.write(A,L)}writeSync(A,L){this._logService.logLevel<=d.LogLevelEnum.WARN&&!y&&(this._logService.warn("writeSync is unreliable and will be removed soon."),y=!0),this._writeBuffer.writeSync(A,L)}resize(A,L){isNaN(A)||isNaN(L)||(A=Math.max(A,_.MINIMUM_COLS),L=Math.max(L,_.MINIMUM_ROWS),this._bufferService.resize(A,L))}scroll(A,L=!1){this._bufferService.scroll(A,L)}scrollLines(A,L,N){this._bufferService.scrollLines(A,L,N)}scrollPages(A){this.scrollLines(A*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(A){const L=A-this._bufferService.buffer.ydisp;L!==0&&this.scrollLines(L)}registerEscHandler(A,L){return this._inputHandler.registerEscHandler(A,L)}registerDcsHandler(A,L){return this._inputHandler.registerDcsHandler(A,L)}registerCsiHandler(A,L){return this._inputHandler.registerCsiHandler(A,L)}registerOscHandler(A,L){return this._inputHandler.registerOscHandler(A,L)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let A=!1;const L=this.optionsService.rawOptions.windowsPty;L&&L.buildNumber!==void 0&&L.buildNumber!==void 0?A=L.backend==="conpty"&&L.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(A=!0),A?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const A=[];A.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),A.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const L of A)L.dispose()}))}}}r.CoreTerminal=E},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 d=[];for(let o=0;o<this._listeners.length;o++)d.push(this._listeners[o]);for(let o=0;o<d.length;o++)d[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((d=>c.fire(d)))}},5435:function(C,r,i){var c=this&&this.__decorate||function(W,D,M,P){var O,U=arguments.length,K=U<3?D:P===null?P=Object.getOwnPropertyDescriptor(D,M):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(W,D,M,P);else for(var V=W.length-1;V>=0;V--)(O=W[V])&&(K=(U<3?O(K):U>3?O(D,M,K):O(D,M))||K);return U>3&&K&&Object.defineProperty(D,M,K),K},d=this&&this.__param||function(W,D){return function(M,P){D(M,P,W)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const o=i(2584),p=i(7116),_=i(2015),S=i(844),g=i(482),n=i(8437),f=i(8460),h=i(643),u=i(511),v=i(3734),x=i(2585),w=i(6242),k=i(6351),y=i(5941),E={"(":0,")":1,"*":2,"+":3,"-":1,".":2},j=131072;function A(W,D){if(W>24)return D.setWinLines||!1;switch(W){case 1:return!!D.restoreWin;case 2:return!!D.minimizeWin;case 3:return!!D.setWinPosition;case 4:return!!D.setWinSizePixels;case 5:return!!D.raiseWin;case 6:return!!D.lowerWin;case 7:return!!D.refreshWin;case 8:return!!D.setWinSizeChars;case 9:return!!D.maximizeWin;case 10:return!!D.fullscreenWin;case 11:return!!D.getWinState;case 13:return!!D.getWinPosition;case 14:return!!D.getWinSizePixels;case 15:return!!D.getScreenSizePixels;case 16:return!!D.getCellSizePixels;case 18:return!!D.getWinSizeChars;case 19:return!!D.getScreenSizeChars;case 20:return!!D.getIconTitle;case 21:return!!D.getWinTitle;case 22:return!!D.pushTitle;case 23:return!!D.popTitle;case 24:return!!D.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 N=0;class B extends S.Disposable{getAttrData(){return this._curAttrData}constructor(D,M,P,O,U,K,V,Y,ie=new _.EscapeSequenceParser){super(),this._bufferService=D,this._charsetService=M,this._coreService=P,this._logService=O,this._optionsService=U,this._oscLinkService=K,this._coreMouseService=V,this._unicodeService=Y,this._parser=ie,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 f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.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((T=>this._activeBuffer=T.activeBuffer))),this._parser.setCsiHandlerFallback(((T,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(T),params:F.toArray()})})),this._parser.setEscHandlerFallback((T=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(T)})})),this._parser.setExecuteHandlerFallback((T=>{this._logService.debug("Unknown EXECUTE code: ",{code:T})})),this._parser.setOscHandlerFallback(((T,F,$)=>{this._logService.debug("Unknown OSC code: ",{identifier:T,action:F,data:$})})),this._parser.setDcsHandlerFallback(((T,F,$)=>{F==="HOOK"&&($=$.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(T),action:F,payload:$})})),this._parser.setPrintHandler(((T,F,$)=>this.print(T,F,$))),this._parser.registerCsiHandler({final:"@"},(T=>this.insertChars(T))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(T=>this.scrollLeft(T))),this._parser.registerCsiHandler({final:"A"},(T=>this.cursorUp(T))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(T=>this.scrollRight(T))),this._parser.registerCsiHandler({final:"B"},(T=>this.cursorDown(T))),this._parser.registerCsiHandler({final:"C"},(T=>this.cursorForward(T))),this._parser.registerCsiHandler({final:"D"},(T=>this.cursorBackward(T))),this._parser.registerCsiHandler({final:"E"},(T=>this.cursorNextLine(T))),this._parser.registerCsiHandler({final:"F"},(T=>this.cursorPrecedingLine(T))),this._parser.registerCsiHandler({final:"G"},(T=>this.cursorCharAbsolute(T))),this._parser.registerCsiHandler({final:"H"},(T=>this.cursorPosition(T))),this._parser.registerCsiHandler({final:"I"},(T=>this.cursorForwardTab(T))),this._parser.registerCsiHandler({final:"J"},(T=>this.eraseInDisplay(T,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(T=>this.eraseInDisplay(T,!0))),this._parser.registerCsiHandler({final:"K"},(T=>this.eraseInLine(T,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(T=>this.eraseInLine(T,!0))),this._parser.registerCsiHandler({final:"L"},(T=>this.insertLines(T))),this._parser.registerCsiHandler({final:"M"},(T=>this.deleteLines(T))),this._parser.registerCsiHandler({final:"P"},(T=>this.deleteChars(T))),this._parser.registerCsiHandler({final:"S"},(T=>this.scrollUp(T))),this._parser.registerCsiHandler({final:"T"},(T=>this.scrollDown(T))),this._parser.registerCsiHandler({final:"X"},(T=>this.eraseChars(T))),this._parser.registerCsiHandler({final:"Z"},(T=>this.cursorBackwardTab(T))),this._parser.registerCsiHandler({final:"`"},(T=>this.charPosAbsolute(T))),this._parser.registerCsiHandler({final:"a"},(T=>this.hPositionRelative(T))),this._parser.registerCsiHandler({final:"b"},(T=>this.repeatPrecedingCharacter(T))),this._parser.registerCsiHandler({final:"c"},(T=>this.sendDeviceAttributesPrimary(T))),this._parser.registerCsiHandler({prefix:">",final:"c"},(T=>this.sendDeviceAttributesSecondary(T))),this._parser.registerCsiHandler({final:"d"},(T=>this.linePosAbsolute(T))),this._parser.registerCsiHandler({final:"e"},(T=>this.vPositionRelative(T))),this._parser.registerCsiHandler({final:"f"},(T=>this.hVPosition(T))),this._parser.registerCsiHandler({final:"g"},(T=>this.tabClear(T))),this._parser.registerCsiHandler({final:"h"},(T=>this.setMode(T))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(T=>this.setModePrivate(T))),this._parser.registerCsiHandler({final:"l"},(T=>this.resetMode(T))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(T=>this.resetModePrivate(T))),this._parser.registerCsiHandler({final:"m"},(T=>this.charAttributes(T))),this._parser.registerCsiHandler({final:"n"},(T=>this.deviceStatus(T))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(T=>this.deviceStatusPrivate(T))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(T=>this.softReset(T))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(T=>this.setCursorStyle(T))),this._parser.registerCsiHandler({final:"r"},(T=>this.setScrollRegion(T))),this._parser.registerCsiHandler({final:"s"},(T=>this.saveCursor(T))),this._parser.registerCsiHandler({final:"t"},(T=>this.windowOptions(T))),this._parser.registerCsiHandler({final:"u"},(T=>this.restoreCursor(T))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(T=>this.insertColumns(T))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(T=>this.deleteColumns(T))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(T=>this.selectProtected(T))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(T=>this.requestMode(T,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(T=>this.requestMode(T,!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((T=>(this.setTitle(T),this.setIconName(T),!0)))),this._parser.registerOscHandler(1,new w.OscHandler((T=>this.setIconName(T)))),this._parser.registerOscHandler(2,new w.OscHandler((T=>this.setTitle(T)))),this._parser.registerOscHandler(4,new w.OscHandler((T=>this.setOrReportIndexedColor(T)))),this._parser.registerOscHandler(8,new w.OscHandler((T=>this.setHyperlink(T)))),this._parser.registerOscHandler(10,new w.OscHandler((T=>this.setOrReportFgColor(T)))),this._parser.registerOscHandler(11,new w.OscHandler((T=>this.setOrReportBgColor(T)))),this._parser.registerOscHandler(12,new w.OscHandler((T=>this.setOrReportCursorColor(T)))),this._parser.registerOscHandler(104,new w.OscHandler((T=>this.restoreIndexedColor(T)))),this._parser.registerOscHandler(110,new w.OscHandler((T=>this.restoreFgColor(T)))),this._parser.registerOscHandler(111,new w.OscHandler((T=>this.restoreBgColor(T)))),this._parser.registerOscHandler(112,new w.OscHandler((T=>this.restoreCursorColor(T)))),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 T in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:T},(()=>this.selectCharset("("+T))),this._parser.registerEscHandler({intermediates:")",final:T},(()=>this.selectCharset(")"+T))),this._parser.registerEscHandler({intermediates:"*",final:T},(()=>this.selectCharset("*"+T))),this._parser.registerEscHandler({intermediates:"+",final:T},(()=>this.selectCharset("+"+T))),this._parser.registerEscHandler({intermediates:"-",final:T},(()=>this.selectCharset("-"+T))),this._parser.registerEscHandler({intermediates:".",final:T},(()=>this.selectCharset("."+T))),this._parser.registerEscHandler({intermediates:"/",final:T},(()=>this.selectCharset("/"+T)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((T=>(this._logService.error("Parsing error: ",T),T))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((T,F)=>this.requestStatusString(T,F))))}_preserveStack(D,M,P,O){this._parseStack.paused=!0,this._parseStack.cursorStartX=D,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=P,this._parseStack.position=O}_logSlowResolvingAsync(D){this._logService.logLevel<=x.LogLevelEnum.WARN&&Promise.race([D,new Promise(((M,P)=>setTimeout((()=>P("#SLOW_TIMEOUT")),5e3)))]).catch((M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(D,M){let P,O=this._activeBuffer.x,U=this._activeBuffer.y,K=0;const V=this._parseStack.paused;if(V){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(P),P;O=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,D.length>j&&(K=this._parseStack.position+j)}if(this._logService.logLevel<=x.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof D=="string"?` "${D}"`:` "${Array.prototype.map.call(D,(Y=>String.fromCharCode(Y))).join("")}"`),typeof D=="string"?D.split("").map((Y=>Y.charCodeAt(0))):D),this._parseBuffer.length<D.length&&this._parseBuffer.length<j&&(this._parseBuffer=new Uint32Array(Math.min(D.length,j))),V||this._dirtyRowTracker.clearRange(),D.length>j)for(let Y=K;Y<D.length;Y+=j){const ie=Y+j<D.length?Y+j:D.length,T=typeof D=="string"?this._stringDecoder.decode(D.substring(Y,ie),this._parseBuffer):this._utf8Decoder.decode(D.subarray(Y,ie),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,T))return this._preserveStack(O,U,T,Y),this._logSlowResolvingAsync(P),P}else if(!V){const Y=typeof D=="string"?this._stringDecoder.decode(D,this._parseBuffer):this._utf8Decoder.decode(D,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,Y))return this._preserveStack(O,U,Y,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===O&&this._activeBuffer.y===U||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(D,M,P){let O,U;const K=this._charsetService.charset,V=this._optionsService.rawOptions.screenReaderMode,Y=this._bufferService.cols,ie=this._coreService.decPrivateModes.wraparound,T=this._coreService.modes.insertMode,F=this._curAttrData;let $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-M>0&&$.getWidth(this._activeBuffer.x-1)===2&&$.setCellFromCodePoint(this._activeBuffer.x-1,0,1,F.fg,F.bg,F.extended);for(let z=M;z<P;++z){if(O=D[z],U=this._unicodeService.wcwidth(O),O<127&&K){const J=K[String.fromCharCode(O)];J&&(O=J.charCodeAt(0))}if(V&&this._onA11yChar.fire((0,g.stringFromCodePoint)(O)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),U||!this._activeBuffer.x){if(this._activeBuffer.x+U-1>=Y){if(ie){for(;this._activeBuffer.x<Y;)$.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),$=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=Y-1,U===2)continue}if(T&&($.insertCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(F),F),$.getWidth(Y-1)===2&&$.setCellFromCodePoint(Y-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,F.fg,F.bg,F.extended)),$.setCellFromCodePoint(this._activeBuffer.x++,O,U,F.fg,F.bg,F.extended),U>0)for(;--U;)$.setCellFromCodePoint(this._activeBuffer.x++,0,0,F.fg,F.bg,F.extended)}else $.getWidth(this._activeBuffer.x-1)?$.addCodepointToCell(this._activeBuffer.x-1,O):$.addCodepointToCell(this._activeBuffer.x-2,O)}P-M>0&&($.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<Y&&P-M>0&&$.getWidth(this._activeBuffer.x)===0&&!$.hasContent(this._activeBuffer.x)&&$.setCellFromCodePoint(this._activeBuffer.x,0,1,F.fg,F.bg,F.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(D,M){return D.final!=="t"||D.prefix||D.intermediates?this._parser.registerCsiHandler(D,M):this._parser.registerCsiHandler(D,(P=>!A(P.params[0],this._optionsService.rawOptions.windowOptions)||M(P)))}registerDcsHandler(D,M){return this._parser.registerDcsHandler(D,new k.DcsHandler(M))}registerEscHandler(D,M){return this._parser.registerEscHandler(D,M)}registerOscHandler(D,M){return this._parser.registerOscHandler(D,new w.OscHandler(M))}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 D;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&&(!((D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||D===void 0)&&D.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const D=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-D),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(D=this._bufferService.cols-1){this._activeBuffer.x=Math.min(D,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(D,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=D,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=D,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(D,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+D,this._activeBuffer.y+M)}cursorUp(D){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,D.params[0]||1)):this._moveCursor(0,-(D.params[0]||1)),!0}cursorDown(D){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,D.params[0]||1)):this._moveCursor(0,D.params[0]||1),!0}cursorForward(D){return this._moveCursor(D.params[0]||1,0),!0}cursorBackward(D){return this._moveCursor(-(D.params[0]||1),0),!0}cursorNextLine(D){return this.cursorDown(D),this._activeBuffer.x=0,!0}cursorPrecedingLine(D){return this.cursorUp(D),this._activeBuffer.x=0,!0}cursorCharAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(D){return this._setCursor(D.length>=2?(D.params[1]||1)-1:0,(D.params[0]||1)-1),!0}charPosAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(D){return this._moveCursor(D.params[0]||1,0),!0}linePosAbsolute(D){return this._setCursor(this._activeBuffer.x,(D.params[0]||1)-1),!0}vPositionRelative(D){return this._moveCursor(0,D.params[0]||1),!0}hVPosition(D){return this.cursorPosition(D),!0}tabClear(D){const M=D.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=D.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=D.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(D){const M=D.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(D,M,P,O=!1,U=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);K.replaceCells(M,P,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),U),O&&(K.isWrapped=!1)}_resetBufferLine(D,M=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+D),P.isWrapped=!1)}eraseInDisplay(D,M=!1){let P;switch(this._restrictCursor(this._bufferService.cols),D.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,M);P<this._bufferService.rows;P++)this._resetBufferLine(P,M);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,M),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,M);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(D,M=!1){switch(this._restrictCursor(this._bufferService.cols),D.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(D){this._restrictCursor();let M=D.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,U=this._bufferService.rows-1+this._activeBuffer.ybase-O+1;for(;M--;)this._activeBuffer.lines.splice(U-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(D){this._restrictCursor();let M=D.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;M--;)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(D){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.insertCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(D){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.deleteCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(D){let M=D.params[0]||1;for(;M--;)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(D){let M=D.params[0]||1;for(;M--;)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(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=D.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,M,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=D.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,M,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=D.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,M,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=D.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,M,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(D){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(D.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(D){if(!this._parser.precedingCodepoint)return!0;const M=D.params[0]||1,P=new Uint32Array(M);for(let O=0;O<M;++O)P[O]=this._parser.precedingCodepoint;return this.print(P,0,P.length),!0}sendDeviceAttributesPrimary(D){return D.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(D){return D.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(D.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(D){return(this._optionsService.rawOptions.termName+"").indexOf(D)===0}setMode(D){for(let M=0;M<D.length;M++)switch(D.params[M]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(D){for(let M=0;M<D.length;M++)switch(D.params[M]){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(D){for(let M=0;M<D.length;M++)switch(D.params[M]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(D){for(let M=0;M<D.length;M++)switch(D.params[M]){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(),D.params[M]===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(D,M){const P=this._coreService.decPrivateModes,{activeProtocol:O,activeEncoding:U}=this._coreMouseService,K=this._coreService,{buffers:V,cols:Y}=this._bufferService,{active:ie,alt:T}=V,F=this._optionsService.rawOptions,$=oe=>oe?1:2,z=D.params[0];return J=z,X=M?z===2?4:z===4?$(K.modes.insertMode):z===12?3:z===20?$(F.convertEol):0:z===1?$(P.applicationCursorKeys):z===3?F.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:z===6?$(P.origin):z===7?$(P.wraparound):z===8?3:z===9?$(O==="X10"):z===12?$(F.cursorBlink):z===25?$(!K.isCursorHidden):z===45?$(P.reverseWraparound):z===66?$(P.applicationKeypad):z===67?4:z===1e3?$(O==="VT200"):z===1002?$(O==="DRAG"):z===1003?$(O==="ANY"):z===1004?$(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?$(ie===T):z===2004?$(P.bracketedPasteMode):0,K.triggerDataEvent(`${o.C0.ESC}[${M?"":"?"}${J};${X}$y`),!0;var J,X}_updateAttrColor(D,M,P,O,U){return M===2?(D|=50331648,D&=-16777216,D|=v.AttributeData.fromColorRGB([P,O,U])):M===5&&(D&=-50331904,D|=33554432|255&P),D}_extractColor(D,M,P){const O=[0,0,-1,0,0,0];let U=0,K=0;do{if(O[K+U]=D.params[M+K],D.hasSubParams(M+K)){const V=D.getSubParams(M+K);let Y=0;do O[1]===5&&(U=1),O[K+Y+1+U]=V[Y];while(++Y<V.length&&Y+K+1+U<O.length);break}if(O[1]===5&&K+U>=2||O[1]===2&&K+U>=5)break;O[1]&&(U=1)}while(++K+M<D.length&&K+U<O.length);for(let V=2;V<O.length;++V)O[V]===-1&&(O[V]=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 K}_processUnderline(D,M){M.extended=M.extended.clone(),(!~D||D>5)&&(D=1),M.extended.underlineStyle=D,M.fg|=268435456,D===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(D){D.fg=n.DEFAULT_ATTR_DATA.fg,D.bg=n.DEFAULT_ATTR_DATA.bg,D.extended=D.extended.clone(),D.extended.underlineStyle=0,D.extended.underlineColor&=-67108864,D.updateExtended()}charAttributes(D){if(D.length===1&&D.params[0]===0)return this._processSGR0(this._curAttrData),!0;const M=D.length;let P;const O=this._curAttrData;for(let U=0;U<M;U++)P=D.params[U],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(D.hasSubParams(U)?D.getSubParams(U)[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?U+=this._extractColor(D,U,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(D){switch(D.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${M};${P}R`)}return!0}deviceStatusPrivate(D){if(D.params[0]===6){const M=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${M};${P}R`)}return!0}softReset(D){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(D){const M=D.params[0]||1;switch(M){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=M%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(D){const M=D.params[0]||1;let P;return(D.length<2||(P=D.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(D){if(!A(D.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=D.length>1?D.params[1]:0;switch(D.params[0]){case 14:M!==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:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(D){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(D){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(D){return this._windowTitle=D,this._onTitleChange.fire(D),!0}setIconName(D){return this._iconName=D,!0}setOrReportIndexedColor(D){const M=[],P=D.split(";");for(;P.length>1;){const O=P.shift(),U=P.shift();if(/^\d+$/.exec(O)){const K=parseInt(O);if(H(K))if(U==="?")M.push({type:0,index:K});else{const V=(0,y.parseColor)(U);V&&M.push({type:1,index:K,color:V})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(D){const M=D.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(D,M){this._getCurrentLinkId()&&this._finishHyperlink();const P=D.split(":");let O;const U=P.findIndex((K=>K.startsWith("id=")));return U!==-1&&(O=P[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:O,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(D,M){const P=D.split(";");for(let O=0;O<P.length&&!(M>=this._specialColors.length);++O,++M)if(P[O]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const U=(0,y.parseColor)(P[O]);U&&this._onColor.fire([{type:1,index:this._specialColors[M],color:U}])}return!0}setOrReportFgColor(D){return this._setOrReportSpecialColor(D,0)}setOrReportBgColor(D){return this._setOrReportSpecialColor(D,1)}setOrReportCursorColor(D){return this._setOrReportSpecialColor(D,2)}restoreIndexedColor(D){if(!D)return this._onColor.fire([{type:2}]),!0;const M=[],P=D.split(";");for(let O=0;O<P.length;++O)if(/^\d+$/.exec(P[O])){const U=parseInt(P[O]);H(U)&&M.push({type:2,index:U})}return M.length&&this._onColor.fire(M),!0}restoreFgColor(D){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(D){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(D){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(D){return D.length!==2?(this.selectDefaultCharset(),!0):(D[0]==="/"||this._charsetService.setgCharset(E[D[0]],p.CHARSETS[D[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 D=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,D,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(D){return this._charsetService.setgLevel(D),!0}screenAlignmentPattern(){const D=new u.CellData;D.content=4194373,D.fg=this._curAttrData.fg,D.bg=this._curAttrData.bg,this._setCursor(0,0);for(let M=0;M<this._bufferService.rows;++M){const P=this._activeBuffer.ybase+this._activeBuffer.y+M,O=this._activeBuffer.lines.get(P);O&&(O.fill(D),O.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(D,M){const P=this._bufferService.buffer,O=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${U}${o.C0.ESC}\\`),!0))(D==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:D==='"p'?'P1$r61;1"p':D==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:D==="m"?"P1$r0m":D===" q"?`P1$r${{block:2,underline:4,bar:6}[O.cursorStyle]-(O.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(D,M){this._dirtyRowTracker.markRangeDirty(D,M)}}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,D){W>D&&(N=W,W=D,D=N),W<this.start&&(this.start=W),D>this.end&&(this.end=D)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(W){return 0<=W&&W<256}I=c([d(0,x.IBufferService)],I)},844:(C,r)=>{function i(c){for(const d of c)d.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 d=this._disposables.indexOf(c);d!==-1&&this._disposables.splice(d,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var d;this._isDisposed||c===this._value||((d=this._value)===null||d===void 0||d.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(d,o,p){this._data[d]||(this._data[d]={}),this._data[d][o]=p}get(d,o){return this._data[d]?this._data[d][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=i,r.FourKeyMap=class{constructor(){this._data=new i}set(c,d,o,p,_){this._data.get(c,d)||this._data.set(c,d,new i),this._data.get(c,d).set(o,p,_)}get(c,d,o,p){var _;return(_=this._data.get(c,d))===null||_===void 0?void 0:_.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 d=i.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[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 d=this._getKey(c);if(d===void 0||(i=this._search(d),i===-1)||this._getKey(this._array[i])!==d)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])===d);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,d){if(this._array.length!==0&&(i=this._search(c),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===c))do d(this._array[i]);while(++i<this._array.length&&this._getKey(this._array[i])===c)}values(){return[...this._array].values()}_search(c){let d=0,o=this._array.length-1;for(;o>=d;){let p=d+o>>1;const _=this._getKey(this._array[p]);if(_>c)o=p-1;else{if(!(_<c)){for(;p>0&&this._getKey(this._array[p-1])===c;)p--;return p}d=p+1}}return d}}},7226:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const c=i(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let S=0,g=0,n=_.timeRemaining(),f=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),f=_.timeRemaining(),1.5*g>f)return n-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-S))}ms`),void this._start();n=f}this.clear()}}class o extends d{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const S=Date.now()+_;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends d{_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(d){const o=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),p=o?.get(d.cols-1),_=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);_&&p&&(_.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),d=i(7226),o=i(3734),p=i(8437),_=i(4634),S=i(511),g=i(643),n=i(4863),f=i(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(h,u,v){this._hasScrollback=h,this._optionsService=u,this._bufferService=v,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=f.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 d.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 v=this.getNullCell(p.DEFAULT_ATTR_DATA);let x=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 y=0;y<this.lines.length;y++)x+=+this.lines.get(y).resize(h,v);let k=0;if(this._rows<u)for(let y=this._rows;y<u;y++)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,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+k+1?(this.ybase--,k++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(h,v)));else for(let y=this._rows;y>u;y--)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 y=this.lines.length-w;y>0&&(this.lines.trimStart(y),this.ybase=Math.max(this.ybase-y,0),this.ydisp=Math.max(this.ydisp-y,0),this.savedY=Math.max(this.savedY-y,0)),this.lines.maxLength=w}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,u-1),k&&(this.y+=k),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 k=0;k<this.lines.length;k++)x+=+this.lines.get(k).resize(h,v);this._cols=h,this._rows=u,this._memoryCleanupQueue.clear(),x>.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 v=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(v.length>0){const x=(0,_.reflowLargerCreateNewLayout)(this.lines,v);(0,_.reflowLargerApplyNewLayout)(this.lines,x.layout),this._reflowLargerAdjustViewport(h,u,x.countRemoved)}}_reflowLargerAdjustViewport(h,u,v){const x=this.getNullCell(p.DEFAULT_ATTR_DATA);let w=v;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new p.BufferLine(h,x))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(h,u){const v=this.getNullCell(p.DEFAULT_ATTR_DATA),x=[];let w=0;for(let k=this.lines.length-1;k>=0;k--){let y=this.lines.get(k);if(!y||!y.isWrapped&&y.getTrimmedLength()<=h)continue;const E=[y];for(;y.isWrapped&&k>0;)y=this.lines.get(--k),E.unshift(y);const j=this.ybase+this.y;if(j>=k&&j<k+E.length)continue;const A=E[E.length-1].getTrimmedLength(),L=(0,_.reflowSmallerGetNewLineLengths)(E,this._cols,h),N=L.length-E.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+N):Math.max(0,this.lines.length-this.lines.maxLength+N);const I=[];for(let O=0;O<N;O++){const U=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);I.push(U)}I.length>0&&(x.push({start:k+E.length+w,newLines:I}),w+=I.length),E.push(...I);let H=L.length-1,W=L[H];W===0&&(H--,W=L[H]);let D=E.length-N-1,M=A;for(;D>=0;){const O=Math.min(M,W);if(E[H]===void 0)break;if(E[H].copyCellsFrom(E[D],M-O,W-O,O,!0),W-=O,W===0&&(H--,W=L[H]),M-=O,M===0){D--;const U=Math.max(D,0);M=(0,_.getWrappedLineTrimmedLength)(E,U,this._cols)}}for(let O=0;O<E.length;O++)L[O]<h&&E[O].setCell(L[O],v);let P=N-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+N,this.ybase+u-1)}if(x.length>0){const k=[],y=[];for(let H=0;H<this.lines.length;H++)y.push(this.lines.get(H));const E=this.lines.length;let j=E-1,A=0,L=x[A];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let N=0;for(let H=Math.min(this.lines.maxLength-1,E+w-1);H>=0;H--)if(L&&L.start>j+N){for(let W=L.newLines.length-1;W>=0;W--)this.lines.set(H--,L.newLines[W]);H++,k.push({index:j+1,amount:L.newLines.length}),N+=L.newLines.length,L=x[++A]}else this.lines.set(H,y[j--]);let B=0;for(let H=k.length-1;H>=0;H--)k[H].index+=B,this.lines.onInsertEmitter.fire(k[H]),B+=k[H].amount;const I=Math.max(0,E+w-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(h,u,v=0,x){const w=this.lines.get(h);return w?w.translateToString(u,v,x):""}getWrappedRangeForLine(h){let u=h,v=h;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:u,last:v}}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((v=>{u.line-=v,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((v=>{u.line>=v.index&&(u.line+=v.amount)}))),u.register(this.lines.onDelete((v=>{u.line>=v.index&&u.line<v.index+v.amount&&u.dispose(),u.line>v.index&&(u.line-=v.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),d=i(511),o=i(643),p=i(482);r.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let _=0;class S{constructor(n,f,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*n);const u=f||d.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let v=0;v<n;++v)this.setCell(v,u);this.length=n}get(n){const f=this._data[3*n+0],h=2097151&f;return[this._data[3*n+1],2097152&f?this._combined[n]:h?(0,p.stringFromCodePoint)(h):"",f>>22,2097152&f?this._combined[n].charCodeAt(this._combined[n].length-1):h]}set(n,f){this._data[3*n+1]=f[o.CHAR_DATA_ATTR_INDEX],f[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[n]=f[1],this._data[3*n+0]=2097152|n|f[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*n+0]=f[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[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 f=this._data[3*n+0];return 2097152&f?this._combined[n].charCodeAt(this._combined[n].length-1):2097151&f}isCombined(n){return 2097152&this._data[3*n+0]}getString(n){const f=this._data[3*n+0];return 2097152&f?this._combined[n]:2097151&f?(0,p.stringFromCodePoint)(2097151&f):""}isProtected(n){return 536870912&this._data[3*n+2]}loadCell(n,f){return _=3*n,f.content=this._data[_+0],f.fg=this._data[_+1],f.bg=this._data[_+2],2097152&f.content&&(f.combinedData=this._combined[n]),268435456&f.bg&&(f.extended=this._extendedAttrs[n]),f}setCell(n,f){2097152&f.content&&(this._combined[n]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[n]=f.extended),this._data[3*n+0]=f.content,this._data[3*n+1]=f.fg,this._data[3*n+2]=f.bg}setCellFromCodePoint(n,f,h,u,v,x){268435456&v&&(this._extendedAttrs[n]=x),this._data[3*n+0]=f|h<<22,this._data[3*n+1]=u,this._data[3*n+2]=v}addCodepointToCell(n,f){let h=this._data[3*n+0];2097152&h?this._combined[n]+=(0,p.stringFromCodePoint)(f):(2097151&h?(this._combined[n]=(0,p.stringFromCodePoint)(2097151&h)+(0,p.stringFromCodePoint)(f),h&=-2097152,h|=2097152):h=f|4194304,this._data[3*n+0]=h)}insertCells(n,f,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),f<this.length-n){const v=new d.CellData;for(let x=this.length-n-f-1;x>=0;--x)this.setCell(n+f+x,this.loadCell(n+x,v));for(let x=0;x<f;++x)this.setCell(n+x,h)}else for(let v=n;v<this.length;++v)this.setCell(v,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,f,h,u){if(n%=this.length,f<this.length-n){const v=new d.CellData;for(let x=0;x<this.length-n-f;++x)this.setCell(n+x,this.loadCell(n+f+x,v));for(let x=this.length-f;x<this.length;++x)this.setCell(x,h)}else for(let v=n;v<this.length;++v)this.setCell(v,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,f,h,u,v=!1){if(v)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),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodePoint(f,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs);n<f&&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),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodePoint(f,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs);n<f&&n<this.length;)this.setCell(n++,h)}resize(n,f){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,f)}else{this._data=this._data.subarray(0,h);const u=Object.keys(this._combined);for(let x=0;x<u.length;x++){const w=parseInt(u[x],10);w>=n&&delete this._combined[w]}const v=Object.keys(this._extendedAttrs);for(let x=0;x<v.length;x++){const w=parseInt(v[x],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,f=!1){if(f)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 f in n._combined)this._combined[f]=n._combined[f];this._extendedAttrs={};for(const f in n._extendedAttrs)this._extendedAttrs[f]=n._extendedAttrs[f];this.isWrapped=n.isWrapped}clone(){const n=new S(0);n._data=new Uint32Array(this._data),n.length=this.length;for(const f in this._combined)n._combined[f]=this._combined[f];for(const f in this._extendedAttrs)n._extendedAttrs[f]=this._extendedAttrs[f];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,f,h,u,v){const x=n._data;if(v)for(let k=u-1;k>=0;k--){for(let y=0;y<3;y++)this._data[3*(h+k)+y]=x[3*(f+k)+y];268435456&x[3*(f+k)+2]&&(this._extendedAttrs[h+k]=n._extendedAttrs[f+k])}else for(let k=0;k<u;k++){for(let y=0;y<3;y++)this._data[3*(h+k)+y]=x[3*(f+k)+y];268435456&x[3*(f+k)+2]&&(this._extendedAttrs[h+k]=n._extendedAttrs[f+k])}const w=Object.keys(n._combined);for(let k=0;k<w.length;k++){const y=parseInt(w[k],10);y>=f&&(this._combined[y-f+h]=n._combined[y])}}translateToString(n=!1,f=0,h=this.length){n&&(h=Math.min(h,this.getTrimmedLength()));let u="";for(;f<h;){const v=this._data[3*f+0],x=2097151&v;u+=2097152&v?this._combined[f]:x?(0,p.stringFromCodePoint)(x):o.WHITESPACE_CELL_CHAR,f+=v>>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,d,o){if(d===c.length-1)return c[d].getTrimmedLength();const p=!c[d].hasContent(o-1)&&c[d].getWidth(o-1)===1,_=c[d+1].getWidth(0)===2;return p&&_?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,d,o,p,_){const S=[];for(let g=0;g<c.length-1;g++){let n=g,f=c.get(++n);if(!f.isWrapped)continue;const h=[c.get(g)];for(;n<c.length&&f.isWrapped;)h.push(f),f=c.get(++n);if(p>=g&&p<n){g+=h.length-1;continue}let u=0,v=i(h,u,d),x=1,w=0;for(;x<h.length;){const y=i(h,x,d),E=y-w,j=o-v,A=Math.min(E,j);h[u].copyCellsFrom(h[x],w,v,A,!1),v+=A,v===o&&(u++,v=0),w+=A,w===y&&(x++,w=0),v===0&&u!==0&&h[u-1].getWidth(o-1)===2&&(h[u].copyCellsFrom(h[u-1],o-1,v++,1,!1),h[u-1].setCell(o-1,_))}h[u].replaceCells(v,o,_);let k=0;for(let y=h.length-1;y>0&&(y>u||h[y].getTrimmedLength()===0);y--)k++;k>0&&(S.push(g+h.length-k),S.push(k)),g+=h.length-1}return S},r.reflowLargerCreateNewLayout=function(c,d){const o=[];let p=0,_=d[p],S=0;for(let g=0;g<c.length;g++)if(_===g){const n=d[++p];c.onDeleteEmitter.fire({index:g-S,amount:n}),g+=n-1,S+=n,_=d[++p]}else o.push(g);return{layout:o,countRemoved:S}},r.reflowLargerApplyNewLayout=function(c,d){const o=[];for(let p=0;p<d.length;p++)o.push(c.get(d[p]));for(let p=0;p<o.length;p++)c.set(p,o[p]);c.length=d.length},r.reflowSmallerGetNewLineLengths=function(c,d,o){const p=[],_=c.map(((f,h)=>i(c,h,d))).reduce(((f,h)=>f+h));let S=0,g=0,n=0;for(;n<_;){if(_-n<o){p.push(_-n);break}S+=o;const f=i(c,g,d);S>f&&(S-=f,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),d=i(844),o=i(9092);class p extends d.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),d=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[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(S[d.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(S[d.CHAR_DATA_CHAR_INDEX].length===2){const n=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){const f=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(n-55296)+f-56320+65536|S[d.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[d.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=S[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[d.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),d=i(844);class o{get id(){return this._id}constructor(_){this.line=_,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,d.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}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,d;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
|
-
`,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}\\`})(d||(r.C1_ESCAPED=d={}))},7399:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const c=i(2584),d={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,_,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+(_?"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+(_?"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",_||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",_||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(_&&!S||!o.altKey||o.metaKey)!_||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 f=d[o.keyCode],h=f?.[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 v=String.fromCharCode(u);o.shiftKey&&(v=v.toUpperCase()),g.key=c.C0.ESC+v}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,d=i.length){let o="";for(let p=c;p<d;++p){let _=i[p];_>65535?(_-=65536,o+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):o+=String.fromCharCode(_)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(i,c){const d=i.length;if(!d)return 0;let o=0,p=0;if(this._interim){const _=i.charCodeAt(p++);56320<=_&&_<=57343?c[o++]=1024*(this._interim-55296)+_-56320+65536:(c[o++]=this._interim,c[o++]=_),this._interim=0}for(let _=p;_<d;++_){const S=i.charCodeAt(_);if(55296<=S&&S<=56319){if(++_>=d)return this._interim=S,o;const g=i.charCodeAt(_);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 d=i.length;if(!d)return 0;let o,p,_,S,g=0,n=0,f=0;if(this.interim[0]){let v=!1,x=this.interim[0];x&=(224&x)==192?31:(240&x)==224?15:7;let w,k=0;for(;(w=63&this.interim[++k])&&k<4;)x<<=6,x|=w;const y=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=y-k;for(;f<E;){if(f>=d)return 0;if(w=i[f++],(192&w)!=128){f--,v=!0;break}this.interim[k++]=w,x<<=6,x|=63&w}v||(y===2?x<128?f--:c[g++]=x:y===3?x<2048||x>=55296&&x<=57343||x===65279||(c[g++]=x):x<65536||x>1114111||(c[g++]=x)),this.interim.fill(0)}const h=d-4;let u=f;for(;u<d;){for(;!(!(u<h)||128&(o=i[u])||128&(p=i[u+1])||128&(_=i[u+2])||128&(S=i[u+3]));)c[g++]=o,c[g++]=p,c[g++]=_,c[g++]=S,u+=4;if(o=i[u++],o<128)c[g++]=o;else if((224&o)==192){if(u>=d)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>=d)return this.interim[0]=o,g;if(p=i[u++],(192&p)!=128){u--;continue}if(u>=d)return this.interim[0]=o,this.interim[1]=p,g;if(_=i[u++],(192&_)!=128){u--;continue}if(n=(15&o)<<12|(63&p)<<6|63&_,n<2048||n>=55296&&n<=57343||n===65279)continue;c[g++]=n}else if((248&o)==240){if(u>=d)return this.interim[0]=o,g;if(p=i[u++],(192&p)!=128){u--;continue}if(u>=d)return this.interim[0]=o,this.interim[1]=p,g;if(_=i[u++],(192&_)!=128){u--;continue}if(u>=d)return this.interim[0]=o,this.interim[1]=p,this.interim[2]=_,g;if(S=i[u++],(192&S)!=128){u--;continue}if(n=(7&o)<<18|(63&p)<<12|(63&_)<<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 d;r.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let o=0;o<i.length;++o)d.fill(0,i[o][0],i[o][1]+1)}}wcwidth(o){return o<32?0:o<127?1:o<65536?d[o]:(function(p,_){let S,g=0,n=_.length-1;if(p<_[0][0]||p>_[n][1])return!1;for(;n>=g;)if(S=g+n>>1,p>_[S][1])g=S+1;else{if(!(p<_[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),d=i(844);class o extends d.Disposable{constructor(_){super(),this._action=_,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(_,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),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(_,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+=_.length,this._writeBuffer.push(_),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(S)}_innerWrite(_=0,S=!0){const g=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const n=this._writeBuffer[this._bufferOffset],f=this._action(n,S);if(f){const u=v=>Date.now()-g>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(g,v);return void f.catch((v=>(queueMicrotask((()=>{throw v})),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 d(o,p){const _=o.toString(16),S=_.length<2?"0"+_:_;switch(p){case 4:return _[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 _=i.exec(p);if(_){const S=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/S*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/S*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/S*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),c.exec(p)&&[3,6,9,12].includes(p.length))){const _=p.length/3,S=[0,0,0];for(let g=0;g<3;++g){const n=parseInt(p.slice(_*g,_*g+_),16);S[g]=_===1?n<<4:_===2?n:_===3?n>>4:n>>8}return S}},r.toRgbString=function(o,p=16){const[_,S,g]=o;return`rgb:${d(_,p)}/${d(S,p)}/${d(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),d=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 f=n.indexOf(g);f!==-1&&n.splice(f,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 f=this._active.length-1;f>=0;f--)this._active[f].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,f=this._active.length-1,h=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,n=g,h=this._stack.fallThrough,this._stack.paused=!1),!h&&n===!1){for(;f>=0&&(n=this._active[f].unhook(S),n!==!0);f--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,n;f--}for(;f>=0;f--)if(n=this._active[f].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,"UNHOOK",S);this._active=p,this._ident=0}};const _=new d.Params;_.addParam(0),r.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=_,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():_,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=_,this._data="",this._hitLimit=!1,n)));return this._params=_,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),d=i(8742),o=i(6242),p=i(6351);class _{constructor(f){this.table=new Uint8Array(f)}setDefault(f,h){this.table.fill(f<<4|h)}add(f,h,u,v){this.table[h<<8|f]=u<<4|v}addMany(f,h,u,v){for(let x=0;x<f.length;x++)this.table[h<<8|f[x]]=u<<4|v}}r.TransitionTable=_;const S=160;r.VT500_TRANSITION_TABLE=(function(){const n=new _(4095),f=Array.apply(null,Array(256)).map(((k,y)=>y)),h=(k,y)=>f.slice(k,y),u=h(32,127),v=h(0,24);v.push(25),v.push.apply(v,h(28,32));const x=h(0,14);let w;for(w in n.setDefault(1,0),n.addMany(u,0,2,0),x)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(v,0,3,0),n.addMany(v,1,3,1),n.add(127,1,0,1),n.addMany(v,8,0,8),n.addMany(v,3,3,3),n.add(127,3,0,3),n.addMany(v,4,3,4),n.add(127,4,0,4),n.addMany(v,6,3,6),n.addMany(v,5,3,5),n.add(127,5,0,5),n.addMany(v,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(v,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(v,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(v,11,0,11),n.addMany(h(32,128),11,0,11),n.addMany(h(28,32),11,0,11),n.addMany(v,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(v,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(v,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(f=r.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(h,u,v)=>{},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(f,h=[64,126]){let u=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=f.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let x=0;x<f.intermediates.length;++x){const w=f.intermediates.charCodeAt(x);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=w}}if(f.final.length!==1)throw new Error("final must be a single byte");const v=f.final.charCodeAt(0);if(h[0]>v||v>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return u<<=8,u|=v,u}identToString(f){const h=[];for(;f;)h.push(String.fromCharCode(255&f)),f>>=8;return h.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,h){const u=this._identifier(f,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);const v=this._escHandlers[u];return v.push(h),{dispose:()=>{const x=v.indexOf(h);x!==-1&&v.splice(x,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,h){this._executeHandlers[f.charCodeAt(0)]=h}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,h){const u=this._identifier(f);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);const v=this._csiHandlers[u];return v.push(h),{dispose:()=>{const x=v.indexOf(h);x!==-1&&v.splice(x,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,h){return this._dcsParser.registerHandler(this._identifier(f),h)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,h){return this._oscParser.registerHandler(f,h)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}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(f,h,u,v,x){this._parseStack.state=f,this._parseStack.handlers=h,this._parseStack.handlerPos=u,this._parseStack.transition=v,this._parseStack.chunkPos=x}parse(f,h,u){let v,x=0,w=0,k=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,k=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 y=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&E>-1){for(;E>=0&&(v=y[E](this._params),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 4:if(u===!1&&E>-1){for(;E>=0&&(v=y[E](),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 6:if(x=f[this._parseStack.chunkPos],v=this._dcsParser.unhook(x!==24&&x!==26,u),v)return v;x===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(x=f[this._parseStack.chunkPos],v=this._oscParser.end(x!==24&&x!==26,u),v)return v;x===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,k=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let y=k;y<h;++y){switch(x=f[y],w=this._transitions.table[this.currentState<<8|(x<160?x:S)],w>>4){case 2:for(let N=y+1;;++N){if(N>=h||(x=f[N])<32||x>126&&x<S){this._printHandler(f,y,N),y=N-1;break}if(++N>=h||(x=f[N])<32||x>126&&x<S){this._printHandler(f,y,N),y=N-1;break}if(++N>=h||(x=f[N])<32||x>126&&x<S){this._printHandler(f,y,N),y=N-1;break}if(++N>=h||(x=f[N])<32||x>126&&x<S){this._printHandler(f,y,N),y=N-1;break}}break;case 3:this._executeHandlers[x]?this._executeHandlers[x]():this._executeHandlerFb(x),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:y,code:x,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|x];let j=E?E.length-1:-1;for(;j>=0&&(v=E[j](this._params),v!==!0);j--)if(v instanceof Promise)return this._preserveStack(3,E,j,w,y),v;j<0&&this._csiHandlerFb(this._collect<<8|x,this._params),this.precedingCodepoint=0;break;case 8:do switch(x){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(x-48)}while(++y<h&&(x=f[y])>47&&x<60);y--;break;case 9:this._collect<<=8,this._collect|=x;break;case 10:const A=this._escHandlers[this._collect<<8|x];let L=A?A.length-1:-1;for(;L>=0&&(v=A[L](),v!==!0);L--)if(v instanceof Promise)return this._preserveStack(4,A,L,w,y),v;L<0&&this._escHandlerFb(this._collect<<8|x),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|x,this._params);break;case 13:for(let N=y+1;;++N)if(N>=h||(x=f[N])===24||x===26||x===27||x>127&&x<S){this._dcsParser.put(f,y,N),y=N-1;break}break;case 14:if(v=this._dcsParser.unhook(x!==24&&x!==26),v)return this._preserveStack(6,[],0,w,y),v;x===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 N=y+1;;N++)if(N>=h||(x=f[N])<32||x>127&&x<S){this._oscParser.put(f,y,N),y=N-1;break}break;case 6:if(v=this._oscParser.end(x!==24&&x!==26),v)return this._preserveStack(5,[],0,w,y),v;x===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),d=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,_){this._handlers[p]===void 0&&(this._handlers[p]=[]);const S=this._handlers[p];return S.push(_),{dispose:()=>{const g=S.indexOf(_);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,_,S){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(p,_,S);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(p,_,S))}start(){this.reset(),this._state=1}put(p,_,S){if(this._state!==3){if(this._state===1)for(;_<S;){const g=p[_++];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-_>0&&this._put(p,_,S)}}end(p,_=!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=_,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,_,S){this._hitLimit||(this._data+=(0,d.utf32ToString)(p,_,S),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let _=!1;if(this._hitLimit)_=!1;else if(p&&(_=this._handler(this._data),_ instanceof Promise))return _.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,_}}},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 _=Array.isArray(o[0])?1:0;_<o.length;++_){const S=o[_];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 _=this._subParamsIdx[p]>>8,S=255&this._subParamsIdx[p];S-_>0&&o.push(Array.prototype.slice.call(this._subParams,_,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,_=255&this._subParamsIdx[o];return _-p>0?this._subParams.subarray(p,_):null}getSubParamsAll(){const o={};for(let p=0;p<this.length;++p){const _=this._subParamsIdx[p]>>8,S=255&this._subParamsIdx[p];S-_>0&&(o[p]=this._subParams.slice(_,S))}return o}addDigit(o){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,S=_[p-1];_[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 d={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(d),c.dispose=()=>this._wrappedAddonDispose(d),c.activate(i)}_wrappedAddonDispose(i){if(i.isDisposed)return;let c=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===i){c=d;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),d=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 d.CellData}}},3785:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const c=i(511);r.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,o){if(!(d<0||d>=this._line.length))return o?(this._line.loadCell(d,o),o):this._line.loadCell(d,new c.CellData)}translateToString(d,o,p){return this._line.translateToString(d,o,p)}}},8285:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const c=i(8771),d=i(8460),o=i(844);class p extends o.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new d.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,(d=>c(d.toArray())))}addCsiHandler(i,c){return this.registerCsiHandler(i,c)}registerDcsHandler(i,c){return this._core.registerDcsHandler(i,((d,o)=>c(d,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,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(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),_=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 _.BufferSet(n,this))}resize(n,f){this.cols=n,this.rows=f,this.buffers.resize(n,f),this._onResize.fire({cols:n,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(n,f=!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,f),this._cachedBlankLine=u),u.isWrapped=f;const v=h.ybase+h.scrollTop,x=h.ybase+h.scrollBottom;if(h.scrollTop===0){const w=h.lines.isFull;x===h.lines.length-1?w?h.lines.recycle().copyFrom(u):h.lines.push(u.clone()):h.lines.splice(x+1,0,u.clone()),w?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{const w=x-v+1;h.lines.shiftElements(v+1,w-1,-1),h.lines.set(x,u.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(n,f,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 v=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+n,u.ybase),0),v!==u.ydisp&&(f||this._onScroll.fire(u.ydisp))}};r.BufferService=g=c([d(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,v,x,w){var k,y=arguments.length,E=y<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,x):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(u,v,x,w);else for(var j=u.length-1;j>=0;j--)(k=u[j])&&(E=(y<3?k(E):y>3?k(v,x,E):k(v,x))||E);return y>3&&E&&Object.defineProperty(v,x,E),E},d=this&&this.__param||function(u,v){return function(x,w){v(x,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const o=i(2585),p=i(8460),_=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,v){let x=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(x|=64,x|=u.action):(x|=3&u.button,4&u.button&&(x|=64),8&u.button&&(x|=128),u.action===32?x|=32:u.action!==0||v||(x|=3)),x}const n=String.fromCharCode,f={DEFAULT:u=>{const v=[g(u,!1)+32,u.col+32,u.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${n(v[0])}${n(v[1])}${n(v[2])}`},SGR:u=>{const v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${g(u,!0)};${u.col};${u.row}${v}`},SGR_PIXELS:u=>{const v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${g(u,!0)};${u.x};${u.y}${v}`}};let h=r.CoreMouseService=class extends _.Disposable{constructor(u,v){super(),this._bufferService=u,this._coreService=v,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 x of Object.keys(S))this.addProtocol(x,S[x]);for(const x of Object.keys(f))this.addEncoding(x,f[x]);this.reset()}addProtocol(u,v){this._protocols[u]=v}addEncoding(u,v){this._encodings[u]=v}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 v=this._encodings[this._activeEncoding](u);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!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,v,x){if(x){if(u.x!==v.x||u.y!==v.y)return!1}else if(u.col!==v.col||u.row!==v.row)return!1;return u.button===v.button&&u.action===v.action&&u.ctrl===v.ctrl&&u.alt===v.alt&&u.shift===v.shift}};r.CoreMouseService=h=c([d(0,o.IBufferService),d(1,o.ICoreService)],h)},6975:function(C,r,i){var c=this&&this.__decorate||function(h,u,v,x){var w,k=arguments.length,y=k<3?u:x===null?x=Object.getOwnPropertyDescriptor(u,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(h,u,v,x);else for(var E=h.length-1;E>=0;E--)(w=h[E])&&(y=(k<3?w(y):k>3?w(u,v,y):w(u,v))||y);return k>3&&y&&Object.defineProperty(u,v,y),y},d=this&&this.__param||function(h,u){return function(v,x){u(v,x,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const o=i(1439),p=i(8460),_=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 f=r.CoreService=class extends _.Disposable{constructor(h,u,v){super(),this._bufferService=h,this._logService=u,this._optionsService=v,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 v=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${h}"`,(()=>h.split("").map((x=>x.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=f=c([d(0,S.IBufferService),d(1,S.ILogService),d(2,S.IOptionsService)],f)},9074:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const c=i(8055),d=i(8460),o=i(844),p=i(6106);let _=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 d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.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 v=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),v.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,v){var x,w,k;let y=0,E=0;for(const j of this._decorations.getKeyIterator(u))y=(x=j.options.x)!==null&&x!==void 0?x:0,E=y+((w=j.options.width)!==null&&w!==void 0?w:1),h>=y&&h<E&&(!v||((k=j.options.layer)!==null&&k!==void 0?k:"bottom")===v)&&(yield j)}forEachDecorationAtCell(h,u,v,x){this._decorations.forEachByKey(u,(w=>{var k,y,E;_=(k=w.options.x)!==null&&k!==void 0?k:0,S=_+((y=w.options.width)!==null&&y!==void 0?y:1),h>=_&&h<S&&(!v||((E=w.options.layer)!==null&&E!==void 0?E:"bottom")===v)&&x(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 d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.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),d=i(8343);class o{constructor(..._){this._entries=new Map;for(const[S,g]of _)this.set(S,g)}set(_,S){const g=this._entries.get(_);return this._entries.set(_,S),g}forEach(_){for(const[S,g]of this._entries.entries())_(S,g)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(c.IInstantiationService,this)}setService(p,_){this._services.set(p,_)}getService(p){return this._services.get(p)}createInstance(p,..._){const S=(0,d.getServiceDependencies)(p).sort(((f,h)=>f.index-h.index)),g=[];for(const f of S){const h=this._services.get(f.id);if(!h)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${f.id}.`);g.push(h)}const n=S.length>0?S[0].index:_.length;if(_.length!==n)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${n+1} conflicts with ${_.length} static arguments`);return new p(..._,...g)}}},7866:function(C,r,i){var c=this&&this.__decorate||function(n,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const o=i(844),p=i(2585),_={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=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(n){for(let f=0;f<n.length;f++)typeof n[f]=="function"&&(n[f]=n[f]())}_log(n,f,h){this._evalLazyOptionalParams(h),n.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...h)}trace(n,...f){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,f)}debug(n,...f){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,f)}info(n,...f){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,f)}warn(n,...f){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,f)}error(n,...f){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,f)}};r.LogService=g=c([d(0,p.IOptionsService)],g),r.setTraceLogger=function(n){S=n},r.traceCall=function(n,f,h){if(typeof h.value!="function")throw new Error("not supported");const u=h.value;h.value=function(...v){if(S.logLevel!==p.LogLevelEnum.TRACE)return u.apply(this,v);S.trace(`GlyphRenderer#${u.name}(${v.map((w=>JSON.stringify(w))).join(", ")})`);const x=u.apply(this,v);return S.trace(`GlyphRenderer#${u.name} return`,x),x}}},7302:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const c=i(8460),d=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 _ extends d.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 f in g)if(f in n)try{const h=g[f];n[f]=this._sanitizeAndValidateOption(f,h)}catch(h){console.error(h)}this.rawOptions=n,this.options=Object.assign({},n),this._setupOptions()}onSpecificOptionChange(g,n){return this.onOptionChange((f=>{f===g&&n(this.rawOptions[g])}))}onMultipleOptionChange(g,n){return this.onOptionChange((f=>{g.indexOf(f)!==-1&&n()}))}_setupOptions(){const g=f=>{if(!(f in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},n=(f,h)=>{if(!(f in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);h=this._sanitizeAndValidateOption(f,h),this.rawOptions[f]!==h&&(this.rawOptions[f]=h,this._onOptionChange.fire(f))};for(const f in this.rawOptions){const h={get:g.bind(this,f),set:n.bind(this,f)};Object.defineProperty(this.options,f,h)}}_sanitizeAndValidateOption(g,n){switch(g){case"cursorStyle":if(n||(n=r.DEFAULT_OPTIONS[g]),!(function(f){return f==="block"||f==="underline"||f==="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=_},2660:function(C,r,i){var c=this&&this.__decorate||function(_,S,g,n){var f,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(_,S,g,n);else for(var v=_.length-1;v>=0;v--)(f=_[v])&&(u=(h<3?f(u):h>3?f(S,g,u):f(S,g))||u);return h>3&&u&&Object.defineProperty(S,g,u),u},d=this&&this.__param||function(_,S){return function(g,n){S(g,n,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const o=i(2585);let p=r.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const S=this._bufferService.buffer;if(_.id===void 0){const v=S.addMarker(S.ybase+S.y),x={data:_,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(x,v))),this._dataByLinkId.set(x.id,x),x.id}const g=_,n=this._getEntryIdKey(g),f=this._entriesWithId.get(n);if(f)return this.addLineToLink(f.id,S.ybase+S.y),f.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(_,S){const g=this._dataByLinkId.get(_);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(_){var S;return(S=this._dataByLinkId.get(_))===null||S===void 0?void 0:S.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,S){const g=_.lines.indexOf(S);g!==-1&&(_.lines.splice(g,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};r.OscLinkService=p=c([d(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(d){return d[c]||[]},r.createDecorator=function(d){if(r.serviceRegistry.has(d))return r.serviceRegistry.get(d);const o=function(p,_,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,n,f){n[i]===n?n[c].push({id:g,index:f}):(n[c]=[{id:g,index:f}],n[i]=n)})(o,p,S)};return o.toString=()=>d,r.serviceRegistry.set(d,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 d;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"})(d||(r.LogLevelEnum=d={})),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),d=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 d.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 _=o.length;for(let S=0;S<_;++S){let g=o.charCodeAt(S);if(55296<=g&&g<=56319){if(++S>=_)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 b={};return(()=>{var C=b;Object.defineProperty(C,"__esModule",{value:!0}),C.Terminal=void 0;const r=m(9042),i=m(3236),c=m(844),d=m(5741),o=m(8285),p=m(7975),_=m(7090),S=["cols","rows"];class g extends c.Disposable{constructor(f){super(),this._core=this.register(new i.Terminal(f)),this._addonManager=this.register(new d.AddonManager),this._publicOptions=Object.assign({},this._core.options);const h=v=>this._core.options[v],u=(v,x)=>{this._checkReadonlyOptions(v),this._core.options[v]=x};for(const v in this._core.options){const x={get:h.bind(this,v),set:u.bind(this,v)};Object.defineProperty(this._publicOptions,v,x)}}_checkReadonlyOptions(f){if(S.includes(f))throw new Error(`Option "${f}" 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 _.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 f=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:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(const h in f)this._publicOptions[h]=f[h]}blur(){this._core.blur()}focus(){this._core.focus()}resize(f,h){this._verifyIntegers(f,h),this._core.resize(f,h)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){var h,u,v;return this._checkProposedApi(),this._verifyPositiveIntegers((h=f.x)!==null&&h!==void 0?h:0,(u=f.width)!==null&&u!==void 0?u:0,(v=f.height)!==null&&v!==void 0?v:0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,h,u){this._verifyIntegers(f,h,u),this._core.select(f,h,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,h){this._verifyIntegers(f,h),this._core.selectLines(f,h)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,h){this._core.write(f,h)}writeln(f,h){this._core.write(f),this._core.write(`\r
|
|
19
|
-
`,h)}paste(f){this._core.paste(f)}refresh(f,h){this._verifyIntegers(f,h),this._core.refresh(f,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return r}_verifyIntegers(...f){for(const h of f)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(const h of f)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}C.Terminal=g})(),b})()))})(
|
|
20
|
-
\x1B[90m[Process exited with code ${
|
|
21
|
-
\x1B[33m[Terminal disconnected — reconnecting...]\x1B[0m`),o()},[d,o]),R.useLayoutEffect(()=>{if(!m.current)return;const
|
|
22
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
17
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(S){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),f.isLinux&&S&&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(S){const E=this._getMouseBufferCoords(S),T=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!!(T&&A&&E)&&this._areCoordsInSelection(E,T,A)}isCellInSelection(S,E){const T=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!(!T||!A)&&this._areCoordsInSelection([S,E],T,A)}_areCoordsInSelection(S,E,T){return S[1]>E[1]&&S[1]<T[1]||E[1]===T[1]&&S[1]===E[1]&&S[0]>=E[0]&&S[0]<T[0]||E[1]<T[1]&&S[1]===T[1]&&S[0]<T[0]||E[1]<T[1]&&S[1]===E[1]&&S[0]>=E[0]}_selectWordAtCursor(S,E){var T,A;const L=(A=(T=this._linkifier.currentLink)===null||T===void 0?void 0:T.link)===null||A===void 0?void 0:A.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 M=this._getMouseBufferCoords(S);return!!M&&(this._selectWordAt(M,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(S,E){this._model.clearSelection(),S=Math.max(S,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,S],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(S){this._model.handleTrim(S)&&this.refresh()}_getMouseBufferCoords(S){const E=this._mouseService.getCoords(S,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(S){let E=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,S,this._screenElement)[1];const T=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=T?0:(E>T&&(E-=T),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(S){return f.isMac?S.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:S.shiftKey}handleMouseDown(S){if(this._mouseDownTimeStamp=S.timeStamp,(S.button!==2||!this.hasSelection)&&S.button===0){if(!this._enabled){if(!this.shouldForceSelection(S))return;S.stopPropagation()}S.preventDefault(),this._dragScrollAmount=0,this._enabled&&S.shiftKey?this._handleIncrementalClick(S):S.detail===1?this._handleSingleClick(S):S.detail===2?this._handleDoubleClick(S):S.detail===3&&this._handleTripleClick(S),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(S){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(S))}_handleSingleClick(S){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(S)?3:0,this._model.selectionStart=this._getMouseBufferCoords(S),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(S){this._selectWordAtCursor(S,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(S){const E=this._getMouseBufferCoords(S);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(S){return S.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(S){if(S.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(S),!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(S),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){const A=T.lines.get(this._model.selectionEnd[1]);A&&A.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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 S=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(S.ydisp+this._bufferService.rows,S.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=S.ydisp),this.refresh()}}_handleMouseUp(S){const E=S.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&S.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const T=this._mouseService.getCoords(S,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){const A=(0,p.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(A,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,T=!(!S||!E||S[0]===E[0]&&S[1]===E[1]);T?S&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&S[0]===this._oldSelectionStart[0]&&S[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(S,E,T)):this._oldHasSelection&&this._fireOnSelectionChange(S,E,T)}_fireOnSelectionChange(S,E,T){this._oldSelectionStart=S,this._oldSelectionEnd=E,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(S){this.clearSelection(),this._trimListener.dispose(),this._trimListener=S.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(S,E){let T=E;for(let A=0;E>=A;A++){const L=S.loadCell(A,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:L>1&&E!==A&&(T+=L-1)}return T}setSelection(S,E,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[S,E],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(S){this._isClickInSelection(S)||(this._selectWordAtCursor(S,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(S,E,T=!0,A=!0){if(S[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,M=L.lines.get(S[1]);if(!M)return;const B=L.translateBufferLineToString(S[1],!1);let I=this._convertViewportColToCharacterIndex(M,S[0]),H=I;const W=S[0]-I;let D=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 V=S[0],Q=S[0];M.getWidth(V)===0&&(D++,V--),M.getWidth(Q)===2&&(N++,Q++);const ae=M.getString(Q).length;for(ae>1&&(O+=ae-1,H+=ae-1);V>0&&I>0&&!this._isCharWordSeparator(M.loadCell(V-1,this._workCell));){M.loadCell(V-1,this._workCell);const j=this._workCell.getChars().length;this._workCell.getWidth()===0?(D++,V--):j>1&&(P+=j-1,I-=j-1),I--,V--}for(;Q<M.length&&H+1<B.length&&!this._isCharWordSeparator(M.loadCell(Q+1,this._workCell));){M.loadCell(Q+1,this._workCell);const j=this._workCell.getChars().length;this._workCell.getWidth()===2?(N++,Q++):j>1&&(O+=j-1,H+=j-1),H++,Q++}}H++;let U=I+W-D+P,X=Math.min(this._bufferService.cols,H-I+D+N-P-O);if(E||B.slice(I,H).trim()!==""){if(T&&U===0&&M.getCodePoint(0)!==32){const V=L.lines.get(S[1]-1);if(V&&M.isWrapped&&V.getCodePoint(this._bufferService.cols-1)!==32){const Q=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(Q){const ae=this._bufferService.cols-Q.start;U-=ae,X+=ae}}}if(A&&U+X===this._bufferService.cols&&M.getCodePoint(this._bufferService.cols-1)!==32){const V=L.lines.get(S[1]+1);if(V?.isWrapped&&V.getCodePoint(0)!==32){const Q=this._getWordAt([0,S[1]+1],!1,!1,!0);Q&&(X+=Q.length)}}return{start:U,length:X}}}_selectWordAt(S,E){const T=this._getWordAt(S,E);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,S[1]--;this._model.selectionStart=[T.start,S[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(S){const E=this._getWordAt(S,!0);if(E){let T=S[1];for(;E.start<0;)E.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,T]}}_isCharWordSeparator(S){return S.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(S.getChars())>=0}_selectLineAt(S){const E=this._bufferService.buffer.getWrappedRangeForLine(S),T={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(T,this._bufferService.cols)}};r.SelectionService=k=c([d(3,v.IBufferService),d(4,v.ICoreService),d(5,y.IMouseService),d(6,v.IOptionsService),d(7,y.IRenderService),d(8,y.ICoreBrowserService)],k)},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(k,S,E,T){var A,L=arguments.length,M=L<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(k,S,E,T);else for(var B=k.length-1;B>=0;B--)(A=k[B])&&(M=(L<3?A(M):L>3?A(S,E,M):A(S,E))||M);return L>3&&M&&Object.defineProperty(S,E,M),M},d=this&&this.__param||function(k,S){return function(E,T){S(E,T,k)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const o=i(7239),p=i(8055),_=i(8460),y=i(844),g=i(2585),n=p.css.toColor("#ffffff"),f=p.css.toColor("#000000"),h=p.css.toColor("#ffffff"),u=p.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const k=[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")],S=[0,95,135,175,215,255];for(let E=0;E<216;E++){const T=S[E/36%6|0],A=S[E/6%6|0],L=S[E%6];k.push({css:p.channels.toCss(T,A,L),rgba:p.channels.toRgba(T,A,L)})}for(let E=0;E<24;E++){const T=8+10*E;k.push({css:p.channels.toCss(T,T,T),rgba:p.channels.toRgba(T,T,T)})}return k})());let x=r.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(k){super(),this._optionsService=k,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:n,background:f,cursor:h,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:p.color.blend(f,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:p.color.blend(f,v),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(k={}){const S=this._colors;if(S.foreground=w(k.foreground,n),S.background=w(k.background,f),S.cursor=w(k.cursor,h),S.cursorAccent=w(k.cursorAccent,u),S.selectionBackgroundTransparent=w(k.selectionBackground,v),S.selectionBackgroundOpaque=p.color.blend(S.background,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundTransparent=w(k.selectionInactiveBackground,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundOpaque=p.color.blend(S.background,S.selectionInactiveBackgroundTransparent),S.selectionForeground=k.selectionForeground?w(k.selectionForeground,p.NULL_COLOR):void 0,S.selectionForeground===p.NULL_COLOR&&(S.selectionForeground=void 0),p.color.isOpaque(S.selectionBackgroundTransparent)&&(S.selectionBackgroundTransparent=p.color.opacity(S.selectionBackgroundTransparent,.3)),p.color.isOpaque(S.selectionInactiveBackgroundTransparent)&&(S.selectionInactiveBackgroundTransparent=p.color.opacity(S.selectionInactiveBackgroundTransparent,.3)),S.ansi=r.DEFAULT_ANSI_COLORS.slice(),S.ansi[0]=w(k.black,r.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=w(k.red,r.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=w(k.green,r.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=w(k.yellow,r.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=w(k.blue,r.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=w(k.magenta,r.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=w(k.cyan,r.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=w(k.white,r.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=w(k.brightBlack,r.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=w(k.brightRed,r.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=w(k.brightGreen,r.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=w(k.brightYellow,r.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=w(k.brightBlue,r.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=w(k.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=w(k.brightCyan,r.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=w(k.brightWhite,r.DEFAULT_ANSI_COLORS[15]),k.extendedAnsi){const E=Math.min(S.ansi.length-16,k.extendedAnsi.length);for(let T=0;T<E;T++)S.ansi[T+16]=w(k.extendedAnsi[T],r.DEFAULT_ANSI_COLORS[T+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(k){this._restoreColor(k),this._onChangeColors.fire(this.colors)}_restoreColor(k){if(k!==void 0)switch(k){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[k]=this._restoreColors.ansi[k]}else for(let S=0;S<this._restoreColors.ansi.length;++S)this._colors.ansi[S]=this._restoreColors.ansi[S]}modifyColors(k){k(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(k,S){if(k!==void 0)try{return p.css.toColor(k)}catch{}return S}r.ThemeService=x=c([d(0,g.IOptionsService)],x)},6349:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const c=i(8460),d=i(844);class o extends d.Disposable{constructor(_){super(),this._maxLength=_,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(_){if(this._maxLength===_)return;const y=new Array(_);for(let g=0;g<Math.min(_,this.length);g++)y[g]=this._array[this._getCyclicIndex(g)];this._array=y,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let y=this._length;y<_;y++)this._array[y]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,y){this._array[this._getCyclicIndex(_)]=y}push(_){this._array[this._getCyclicIndex(this._length)]=_,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(_,y,...g){if(y){for(let n=_;n<this._length-y;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+y)];this._length-=y,this.onDeleteEmitter.fire({index:_,amount:y})}for(let n=this._length-1;n>=_;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(_+n)]=g[n];if(g.length&&this.onInsertEmitter.fire({index:_,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(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,y,g){if(!(y<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let f=y-1;f>=0;f--)this.set(_+f+g,this.get(_+f));const n=_+y+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<y;n++)this.set(_+n+g,this.get(_+n))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}r.CircularList=o},1439:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function i(c,d=5){if(typeof c!="object")return c;const o=Array.isArray(c)?[]:{};for(const p in c)o[p]=d<=1?c[p]:c[p]&&i(c[p],d-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 d=0,o=0,p=0,_=0;var y,g,n,f,h;function u(x){const w=x.toString(16);return w.length<2?"0"+w:w}function v(x,w){return x<w?(w+.05)/(x+.05):(x+.05)/(w+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(x){x.toCss=function(w,k,S,E){return E!==void 0?`#${u(w)}${u(k)}${u(S)}${u(E)}`:`#${u(w)}${u(k)}${u(S)}`},x.toRgba=function(w,k,S,E=255){return(w<<24|k<<16|S<<8|E)>>>0}})(y||(r.channels=y={})),(function(x){function w(k,S){return _=Math.round(255*S),[d,o,p]=h.toChannels(k.rgba),{css:y.toCss(d,o,p,_),rgba:y.toRgba(d,o,p,_)}}x.blend=function(k,S){if(_=(255&S.rgba)/255,_===1)return{css:S.css,rgba:S.rgba};const E=S.rgba>>24&255,T=S.rgba>>16&255,A=S.rgba>>8&255,L=k.rgba>>24&255,M=k.rgba>>16&255,B=k.rgba>>8&255;return d=L+Math.round((E-L)*_),o=M+Math.round((T-M)*_),p=B+Math.round((A-B)*_),{css:y.toCss(d,o,p),rgba:y.toRgba(d,o,p)}},x.isOpaque=function(k){return(255&k.rgba)==255},x.ensureContrastRatio=function(k,S,E){const T=h.ensureContrastRatio(k.rgba,S.rgba,E);if(T)return h.toColor(T>>24&255,T>>16&255,T>>8&255)},x.opaque=function(k){const S=(255|k.rgba)>>>0;return[d,o,p]=h.toChannels(S),{css:y.toCss(d,o,p),rgba:S}},x.opacity=w,x.multiplyOpacity=function(k,S){return _=255&k.rgba,w(k,_*S/255)},x.toColorRGB=function(k){return[k.rgba>>24&255,k.rgba>>16&255,k.rgba>>8&255]}})(g||(r.color=g={})),(function(x){let w,k;if(!c.isNode){const S=document.createElement("canvas");S.width=1,S.height=1;const E=S.getContext("2d",{willReadFrequently:!0});E&&(w=E,w.globalCompositeOperation="copy",k=w.createLinearGradient(0,0,1,1))}x.toColor=function(S){if(S.match(/#[\da-f]{3,8}/i))switch(S.length){case 4:return d=parseInt(S.slice(1,2).repeat(2),16),o=parseInt(S.slice(2,3).repeat(2),16),p=parseInt(S.slice(3,4).repeat(2),16),h.toColor(d,o,p);case 5:return d=parseInt(S.slice(1,2).repeat(2),16),o=parseInt(S.slice(2,3).repeat(2),16),p=parseInt(S.slice(3,4).repeat(2),16),_=parseInt(S.slice(4,5).repeat(2),16),h.toColor(d,o,p,_);case 7:return{css:S,rgba:(parseInt(S.slice(1),16)<<8|255)>>>0};case 9:return{css:S,rgba:parseInt(S.slice(1),16)>>>0}}const E=S.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(E)return d=parseInt(E[1]),o=parseInt(E[2]),p=parseInt(E[3]),_=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),h.toColor(d,o,p,_);if(!w||!k)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=k,w.fillStyle=S,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[d,o,p,_]=w.getImageData(0,0,1,1).data,_!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(d,o,p,_),css:S}}})(n||(r.css=n={})),(function(x){function w(k,S,E){const T=k/255,A=S/255,L=E/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}x.relativeLuminance=function(k){return w(k>>16&255,k>>8&255,255&k)},x.relativeLuminance2=w})(f||(r.rgb=f={})),(function(x){function w(S,E,T){const A=S>>24&255,L=S>>16&255,M=S>>8&255;let B=E>>24&255,I=E>>16&255,H=E>>8&255,W=v(f.relativeLuminance2(B,I,H),f.relativeLuminance2(A,L,M));for(;W<T&&(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=v(f.relativeLuminance2(B,I,H),f.relativeLuminance2(A,L,M));return(B<<24|I<<16|H<<8|255)>>>0}function k(S,E,T){const A=S>>24&255,L=S>>16&255,M=S>>8&255;let B=E>>24&255,I=E>>16&255,H=E>>8&255,W=v(f.relativeLuminance2(B,I,H),f.relativeLuminance2(A,L,M));for(;W<T&&(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=v(f.relativeLuminance2(B,I,H),f.relativeLuminance2(A,L,M));return(B<<24|I<<16|H<<8|255)>>>0}x.ensureContrastRatio=function(S,E,T){const A=f.relativeLuminance(S>>8),L=f.relativeLuminance(E>>8);if(v(A,L)<T){if(L<A){const I=w(S,E,T),H=v(A,f.relativeLuminance(I>>8));if(H<T){const W=k(S,E,T);return H>v(A,f.relativeLuminance(W>>8))?I:W}return I}const M=k(S,E,T),B=v(A,f.relativeLuminance(M>>8));if(B<T){const I=w(S,E,T);return B>v(A,f.relativeLuminance(I>>8))?M:I}return M}},x.reduceLuminance=w,x.increaseLuminance=k,x.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]},x.toColor=function(S,E,T,A){return{css:y.toCss(S,E,T,A),rgba:y.toRgba(S,E,T,A)}}})(h||(r.rgba=h={})),r.toPaddedHex=u,r.contrastRatio=v},8969:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const c=i(844),d=i(2585),o=i(4348),p=i(7866),_=i(744),y=i(7302),g=i(6975),n=i(8460),f=i(1753),h=i(1480),u=i(7994),v=i(9282),x=i(5435),w=i(5981),k=i(2660);let S=!1;class E extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new n.EventEmitter),this._onScroll.event((A=>{var L;(L=this._onScrollApi)===null||L===void 0||L.fire(A.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(A){for(const L in A)this.optionsService.options[L]=A[L]}constructor(A){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 y.OptionsService(A)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(g.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(k.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new x.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,M)=>this._inputHandler.parse(L,M)))),this.register((0,n.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(A,L){this._writeBuffer.write(A,L)}writeSync(A,L){this._logService.logLevel<=d.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(A,L)}resize(A,L){isNaN(A)||isNaN(L)||(A=Math.max(A,_.MINIMUM_COLS),L=Math.max(L,_.MINIMUM_ROWS),this._bufferService.resize(A,L))}scroll(A,L=!1){this._bufferService.scroll(A,L)}scrollLines(A,L,M){this._bufferService.scrollLines(A,L,M)}scrollPages(A){this.scrollLines(A*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(A){const L=A-this._bufferService.buffer.ydisp;L!==0&&this.scrollLines(L)}registerEscHandler(A,L){return this._inputHandler.registerEscHandler(A,L)}registerDcsHandler(A,L){return this._inputHandler.registerDcsHandler(A,L)}registerCsiHandler(A,L){return this._inputHandler.registerCsiHandler(A,L)}registerOscHandler(A,L){return this._inputHandler.registerOscHandler(A,L)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let A=!1;const L=this.optionsService.rawOptions.windowsPty;L&&L.buildNumber!==void 0&&L.buildNumber!==void 0?A=L.backend==="conpty"&&L.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(A=!0),A?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const A=[];A.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),A.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const L of A)L.dispose()}))}}}r.CoreTerminal=E},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 d=[];for(let o=0;o<this._listeners.length;o++)d.push(this._listeners[o]);for(let o=0;o<d.length;o++)d[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((d=>c.fire(d)))}},5435:function(C,r,i){var c=this&&this.__decorate||function(W,D,N,P){var O,U=arguments.length,X=U<3?D:P===null?P=Object.getOwnPropertyDescriptor(D,N):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(W,D,N,P);else for(var V=W.length-1;V>=0;V--)(O=W[V])&&(X=(U<3?O(X):U>3?O(D,N,X):O(D,N))||X);return U>3&&X&&Object.defineProperty(D,N,X),X},d=this&&this.__param||function(W,D){return function(N,P){D(N,P,W)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const o=i(2584),p=i(7116),_=i(2015),y=i(844),g=i(482),n=i(8437),f=i(8460),h=i(643),u=i(511),v=i(3734),x=i(2585),w=i(6242),k=i(6351),S=i(5941),E={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function A(W,D){if(W>24)return D.setWinLines||!1;switch(W){case 1:return!!D.restoreWin;case 2:return!!D.minimizeWin;case 3:return!!D.setWinPosition;case 4:return!!D.setWinSizePixels;case 5:return!!D.raiseWin;case 6:return!!D.lowerWin;case 7:return!!D.refreshWin;case 8:return!!D.setWinSizeChars;case 9:return!!D.maximizeWin;case 10:return!!D.fullscreenWin;case 11:return!!D.getWinState;case 13:return!!D.getWinPosition;case 14:return!!D.getWinSizePixels;case 15:return!!D.getScreenSizePixels;case 16:return!!D.getCellSizePixels;case 18:return!!D.getWinSizeChars;case 19:return!!D.getScreenSizeChars;case 20:return!!D.getIconTitle;case 21:return!!D.getWinTitle;case 22:return!!D.pushTitle;case 23:return!!D.popTitle;case 24:return!!D.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 M=0;class B extends y.Disposable{getAttrData(){return this._curAttrData}constructor(D,N,P,O,U,X,V,Q,ae=new _.EscapeSequenceParser){super(),this._bufferService=D,this._charsetService=N,this._coreService=P,this._logService=O,this._optionsService=U,this._oscLinkService=X,this._coreMouseService=V,this._unicodeService=Q,this._parser=ae,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 f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.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((j=>this._activeBuffer=j.activeBuffer))),this._parser.setCsiHandlerFallback(((j,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(j),params:F.toArray()})})),this._parser.setEscHandlerFallback((j=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(j)})})),this._parser.setExecuteHandlerFallback((j=>{this._logService.debug("Unknown EXECUTE code: ",{code:j})})),this._parser.setOscHandlerFallback(((j,F,$)=>{this._logService.debug("Unknown OSC code: ",{identifier:j,action:F,data:$})})),this._parser.setDcsHandlerFallback(((j,F,$)=>{F==="HOOK"&&($=$.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(j),action:F,payload:$})})),this._parser.setPrintHandler(((j,F,$)=>this.print(j,F,$))),this._parser.registerCsiHandler({final:"@"},(j=>this.insertChars(j))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(j=>this.scrollLeft(j))),this._parser.registerCsiHandler({final:"A"},(j=>this.cursorUp(j))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(j=>this.scrollRight(j))),this._parser.registerCsiHandler({final:"B"},(j=>this.cursorDown(j))),this._parser.registerCsiHandler({final:"C"},(j=>this.cursorForward(j))),this._parser.registerCsiHandler({final:"D"},(j=>this.cursorBackward(j))),this._parser.registerCsiHandler({final:"E"},(j=>this.cursorNextLine(j))),this._parser.registerCsiHandler({final:"F"},(j=>this.cursorPrecedingLine(j))),this._parser.registerCsiHandler({final:"G"},(j=>this.cursorCharAbsolute(j))),this._parser.registerCsiHandler({final:"H"},(j=>this.cursorPosition(j))),this._parser.registerCsiHandler({final:"I"},(j=>this.cursorForwardTab(j))),this._parser.registerCsiHandler({final:"J"},(j=>this.eraseInDisplay(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(j=>this.eraseInDisplay(j,!0))),this._parser.registerCsiHandler({final:"K"},(j=>this.eraseInLine(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(j=>this.eraseInLine(j,!0))),this._parser.registerCsiHandler({final:"L"},(j=>this.insertLines(j))),this._parser.registerCsiHandler({final:"M"},(j=>this.deleteLines(j))),this._parser.registerCsiHandler({final:"P"},(j=>this.deleteChars(j))),this._parser.registerCsiHandler({final:"S"},(j=>this.scrollUp(j))),this._parser.registerCsiHandler({final:"T"},(j=>this.scrollDown(j))),this._parser.registerCsiHandler({final:"X"},(j=>this.eraseChars(j))),this._parser.registerCsiHandler({final:"Z"},(j=>this.cursorBackwardTab(j))),this._parser.registerCsiHandler({final:"`"},(j=>this.charPosAbsolute(j))),this._parser.registerCsiHandler({final:"a"},(j=>this.hPositionRelative(j))),this._parser.registerCsiHandler({final:"b"},(j=>this.repeatPrecedingCharacter(j))),this._parser.registerCsiHandler({final:"c"},(j=>this.sendDeviceAttributesPrimary(j))),this._parser.registerCsiHandler({prefix:">",final:"c"},(j=>this.sendDeviceAttributesSecondary(j))),this._parser.registerCsiHandler({final:"d"},(j=>this.linePosAbsolute(j))),this._parser.registerCsiHandler({final:"e"},(j=>this.vPositionRelative(j))),this._parser.registerCsiHandler({final:"f"},(j=>this.hVPosition(j))),this._parser.registerCsiHandler({final:"g"},(j=>this.tabClear(j))),this._parser.registerCsiHandler({final:"h"},(j=>this.setMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(j=>this.setModePrivate(j))),this._parser.registerCsiHandler({final:"l"},(j=>this.resetMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(j=>this.resetModePrivate(j))),this._parser.registerCsiHandler({final:"m"},(j=>this.charAttributes(j))),this._parser.registerCsiHandler({final:"n"},(j=>this.deviceStatus(j))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(j=>this.deviceStatusPrivate(j))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(j=>this.softReset(j))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(j=>this.setCursorStyle(j))),this._parser.registerCsiHandler({final:"r"},(j=>this.setScrollRegion(j))),this._parser.registerCsiHandler({final:"s"},(j=>this.saveCursor(j))),this._parser.registerCsiHandler({final:"t"},(j=>this.windowOptions(j))),this._parser.registerCsiHandler({final:"u"},(j=>this.restoreCursor(j))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(j=>this.insertColumns(j))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(j=>this.deleteColumns(j))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(j=>this.selectProtected(j))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(j=>this.requestMode(j,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(j=>this.requestMode(j,!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((j=>(this.setTitle(j),this.setIconName(j),!0)))),this._parser.registerOscHandler(1,new w.OscHandler((j=>this.setIconName(j)))),this._parser.registerOscHandler(2,new w.OscHandler((j=>this.setTitle(j)))),this._parser.registerOscHandler(4,new w.OscHandler((j=>this.setOrReportIndexedColor(j)))),this._parser.registerOscHandler(8,new w.OscHandler((j=>this.setHyperlink(j)))),this._parser.registerOscHandler(10,new w.OscHandler((j=>this.setOrReportFgColor(j)))),this._parser.registerOscHandler(11,new w.OscHandler((j=>this.setOrReportBgColor(j)))),this._parser.registerOscHandler(12,new w.OscHandler((j=>this.setOrReportCursorColor(j)))),this._parser.registerOscHandler(104,new w.OscHandler((j=>this.restoreIndexedColor(j)))),this._parser.registerOscHandler(110,new w.OscHandler((j=>this.restoreFgColor(j)))),this._parser.registerOscHandler(111,new w.OscHandler((j=>this.restoreBgColor(j)))),this._parser.registerOscHandler(112,new w.OscHandler((j=>this.restoreCursorColor(j)))),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 j in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:j},(()=>this.selectCharset("("+j))),this._parser.registerEscHandler({intermediates:")",final:j},(()=>this.selectCharset(")"+j))),this._parser.registerEscHandler({intermediates:"*",final:j},(()=>this.selectCharset("*"+j))),this._parser.registerEscHandler({intermediates:"+",final:j},(()=>this.selectCharset("+"+j))),this._parser.registerEscHandler({intermediates:"-",final:j},(()=>this.selectCharset("-"+j))),this._parser.registerEscHandler({intermediates:".",final:j},(()=>this.selectCharset("."+j))),this._parser.registerEscHandler({intermediates:"/",final:j},(()=>this.selectCharset("/"+j)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((j=>(this._logService.error("Parsing error: ",j),j))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((j,F)=>this.requestStatusString(j,F))))}_preserveStack(D,N,P,O){this._parseStack.paused=!0,this._parseStack.cursorStartX=D,this._parseStack.cursorStartY=N,this._parseStack.decodedLength=P,this._parseStack.position=O}_logSlowResolvingAsync(D){this._logService.logLevel<=x.LogLevelEnum.WARN&&Promise.race([D,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(D,N){let P,O=this._activeBuffer.x,U=this._activeBuffer.y,X=0;const V=this._parseStack.paused;if(V){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,N))return this._logSlowResolvingAsync(P),P;O=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,D.length>T&&(X=this._parseStack.position+T)}if(this._logService.logLevel<=x.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof D=="string"?` "${D}"`:` "${Array.prototype.map.call(D,(Q=>String.fromCharCode(Q))).join("")}"`),typeof D=="string"?D.split("").map((Q=>Q.charCodeAt(0))):D),this._parseBuffer.length<D.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(D.length,T))),V||this._dirtyRowTracker.clearRange(),D.length>T)for(let Q=X;Q<D.length;Q+=T){const ae=Q+T<D.length?Q+T:D.length,j=typeof D=="string"?this._stringDecoder.decode(D.substring(Q,ae),this._parseBuffer):this._utf8Decoder.decode(D.subarray(Q,ae),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,j))return this._preserveStack(O,U,j,Q),this._logSlowResolvingAsync(P),P}else if(!V){const Q=typeof D=="string"?this._stringDecoder.decode(D,this._parseBuffer):this._utf8Decoder.decode(D,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,Q))return this._preserveStack(O,U,Q,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===O&&this._activeBuffer.y===U||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(D,N,P){let O,U;const X=this._charsetService.charset,V=this._optionsService.rawOptions.screenReaderMode,Q=this._bufferService.cols,ae=this._coreService.decPrivateModes.wraparound,j=this._coreService.modes.insertMode,F=this._curAttrData;let $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-N>0&&$.getWidth(this._activeBuffer.x-1)===2&&$.setCellFromCodePoint(this._activeBuffer.x-1,0,1,F.fg,F.bg,F.extended);for(let z=N;z<P;++z){if(O=D[z],U=this._unicodeService.wcwidth(O),O<127&&X){const Z=X[String.fromCharCode(O)];Z&&(O=Z.charCodeAt(0))}if(V&&this._onA11yChar.fire((0,g.stringFromCodePoint)(O)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),U||!this._activeBuffer.x){if(this._activeBuffer.x+U-1>=Q){if(ae){for(;this._activeBuffer.x<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),$=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=Q-1,U===2)continue}if(j&&($.insertCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(F),F),$.getWidth(Q-1)===2&&$.setCellFromCodePoint(Q-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,F.fg,F.bg,F.extended)),$.setCellFromCodePoint(this._activeBuffer.x++,O,U,F.fg,F.bg,F.extended),U>0)for(;--U;)$.setCellFromCodePoint(this._activeBuffer.x++,0,0,F.fg,F.bg,F.extended)}else $.getWidth(this._activeBuffer.x-1)?$.addCodepointToCell(this._activeBuffer.x-1,O):$.addCodepointToCell(this._activeBuffer.x-2,O)}P-N>0&&($.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&&$.getWidth(this._activeBuffer.x)===0&&!$.hasContent(this._activeBuffer.x)&&$.setCellFromCodePoint(this._activeBuffer.x,0,1,F.fg,F.bg,F.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(D,N){return D.final!=="t"||D.prefix||D.intermediates?this._parser.registerCsiHandler(D,N):this._parser.registerCsiHandler(D,(P=>!A(P.params[0],this._optionsService.rawOptions.windowOptions)||N(P)))}registerDcsHandler(D,N){return this._parser.registerDcsHandler(D,new k.DcsHandler(N))}registerEscHandler(D,N){return this._parser.registerEscHandler(D,N)}registerOscHandler(D,N){return this._parser.registerOscHandler(D,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 D;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&&(!((D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||D===void 0)&&D.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 D=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-D),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(D=this._bufferService.cols-1){this._activeBuffer.x=Math.min(D,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(D,N){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=D,this._activeBuffer.y=this._activeBuffer.scrollTop+N):(this._activeBuffer.x=D,this._activeBuffer.y=N),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(D,N){this._restrictCursor(),this._setCursor(this._activeBuffer.x+D,this._activeBuffer.y+N)}cursorUp(D){const N=this._activeBuffer.y-this._activeBuffer.scrollTop;return N>=0?this._moveCursor(0,-Math.min(N,D.params[0]||1)):this._moveCursor(0,-(D.params[0]||1)),!0}cursorDown(D){const N=this._activeBuffer.scrollBottom-this._activeBuffer.y;return N>=0?this._moveCursor(0,Math.min(N,D.params[0]||1)):this._moveCursor(0,D.params[0]||1),!0}cursorForward(D){return this._moveCursor(D.params[0]||1,0),!0}cursorBackward(D){return this._moveCursor(-(D.params[0]||1),0),!0}cursorNextLine(D){return this.cursorDown(D),this._activeBuffer.x=0,!0}cursorPrecedingLine(D){return this.cursorUp(D),this._activeBuffer.x=0,!0}cursorCharAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(D){return this._setCursor(D.length>=2?(D.params[1]||1)-1:0,(D.params[0]||1)-1),!0}charPosAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(D){return this._moveCursor(D.params[0]||1,0),!0}linePosAbsolute(D){return this._setCursor(this._activeBuffer.x,(D.params[0]||1)-1),!0}vPositionRelative(D){return this._moveCursor(0,D.params[0]||1),!0}hVPosition(D){return this.cursorPosition(D),!0}tabClear(D){const N=D.params[0];return N===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:N===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let N=D.params[0]||1;for(;N--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let N=D.params[0]||1;for(;N--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(D){const N=D.params[0];return N===1&&(this._curAttrData.bg|=536870912),N!==2&&N!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(D,N,P,O=!1,U=!1){const X=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);X.replaceCells(N,P,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),U),O&&(X.isWrapped=!1)}_resetBufferLine(D,N=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),N),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+D),P.isWrapped=!1)}eraseInDisplay(D,N=!1){let P;switch(this._restrictCursor(this._bufferService.cols),D.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(D,N=!1){switch(this._restrictCursor(this._bufferService.cols),D.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(D){this._restrictCursor();let N=D.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,U=this._bufferService.rows-1+this._activeBuffer.ybase-O+1;for(;N--;)this._activeBuffer.lines.splice(U-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(D){this._restrictCursor();let N=D.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(D){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.insertCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(D){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.deleteCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(D){let N=D.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(D){let N=D.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(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=D.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(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=D.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(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=D.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(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=D.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(D){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(D.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(D){if(!this._parser.precedingCodepoint)return!0;const N=D.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(D){return D.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(D){return D.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(D.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(D){return(this._optionsService.rawOptions.termName+"").indexOf(D)===0}setMode(D){for(let N=0;N<D.length;N++)switch(D.params[N]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(D){for(let N=0;N<D.length;N++)switch(D.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(D){for(let N=0;N<D.length;N++)switch(D.params[N]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(D){for(let N=0;N<D.length;N++)switch(D.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(),D.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(D,N){const P=this._coreService.decPrivateModes,{activeProtocol:O,activeEncoding:U}=this._coreMouseService,X=this._coreService,{buffers:V,cols:Q}=this._bufferService,{active:ae,alt:j}=V,F=this._optionsService.rawOptions,$=ne=>ne?1:2,z=D.params[0];return Z=z,K=N?z===2?4:z===4?$(X.modes.insertMode):z===12?3:z===20?$(F.convertEol):0:z===1?$(P.applicationCursorKeys):z===3?F.windowOptions.setWinLines?Q===80?2:Q===132?1:0:0:z===6?$(P.origin):z===7?$(P.wraparound):z===8?3:z===9?$(O==="X10"):z===12?$(F.cursorBlink):z===25?$(!X.isCursorHidden):z===45?$(P.reverseWraparound):z===66?$(P.applicationKeypad):z===67?4:z===1e3?$(O==="VT200"):z===1002?$(O==="DRAG"):z===1003?$(O==="ANY"):z===1004?$(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?$(ae===j):z===2004?$(P.bracketedPasteMode):0,X.triggerDataEvent(`${o.C0.ESC}[${N?"":"?"}${Z};${K}$y`),!0;var Z,K}_updateAttrColor(D,N,P,O,U){return N===2?(D|=50331648,D&=-16777216,D|=v.AttributeData.fromColorRGB([P,O,U])):N===5&&(D&=-50331904,D|=33554432|255&P),D}_extractColor(D,N,P){const O=[0,0,-1,0,0,0];let U=0,X=0;do{if(O[X+U]=D.params[N+X],D.hasSubParams(N+X)){const V=D.getSubParams(N+X);let Q=0;do O[1]===5&&(U=1),O[X+Q+1+U]=V[Q];while(++Q<V.length&&Q+X+1+U<O.length);break}if(O[1]===5&&X+U>=2||O[1]===2&&X+U>=5)break;O[1]&&(U=1)}while(++X+N<D.length&&X+U<O.length);for(let V=2;V<O.length;++V)O[V]===-1&&(O[V]=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(D,N){N.extended=N.extended.clone(),(!~D||D>5)&&(D=1),N.extended.underlineStyle=D,N.fg|=268435456,D===0&&(N.fg&=-268435457),N.updateExtended()}_processSGR0(D){D.fg=n.DEFAULT_ATTR_DATA.fg,D.bg=n.DEFAULT_ATTR_DATA.bg,D.extended=D.extended.clone(),D.extended.underlineStyle=0,D.extended.underlineColor&=-67108864,D.updateExtended()}charAttributes(D){if(D.length===1&&D.params[0]===0)return this._processSGR0(this._curAttrData),!0;const N=D.length;let P;const O=this._curAttrData;for(let U=0;U<N;U++)P=D.params[U],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(D.hasSubParams(U)?D.getSubParams(U)[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?U+=this._extractColor(D,U,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(D){switch(D.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(D){if(D.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(D){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(D){const N=D.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(D){const N=D.params[0]||1;let P;return(D.length<2||(P=D.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(D){if(!A(D.params[0],this._optionsService.rawOptions.windowOptions))return!0;const N=D.length>1?D.params[1]:0;switch(D.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(D){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(D){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(D){return this._windowTitle=D,this._onTitleChange.fire(D),!0}setIconName(D){return this._iconName=D,!0}setOrReportIndexedColor(D){const N=[],P=D.split(";");for(;P.length>1;){const O=P.shift(),U=P.shift();if(/^\d+$/.exec(O)){const X=parseInt(O);if(H(X))if(U==="?")N.push({type:0,index:X});else{const V=(0,S.parseColor)(U);V&&N.push({type:1,index:X,color:V})}}}return N.length&&this._onColor.fire(N),!0}setHyperlink(D){const N=D.split(";");return!(N.length<2)&&(N[1]?this._createHyperlink(N[0],N[1]):!N[0]&&this._finishHyperlink())}_createHyperlink(D,N){this._getCurrentLinkId()&&this._finishHyperlink();const P=D.split(":");let O;const U=P.findIndex((X=>X.startsWith("id=")));return U!==-1&&(O=P[U].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(D,N){const P=D.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 U=(0,S.parseColor)(P[O]);U&&this._onColor.fire([{type:1,index:this._specialColors[N],color:U}])}return!0}setOrReportFgColor(D){return this._setOrReportSpecialColor(D,0)}setOrReportBgColor(D){return this._setOrReportSpecialColor(D,1)}setOrReportCursorColor(D){return this._setOrReportSpecialColor(D,2)}restoreIndexedColor(D){if(!D)return this._onColor.fire([{type:2}]),!0;const N=[],P=D.split(";");for(let O=0;O<P.length;++O)if(/^\d+$/.exec(P[O])){const U=parseInt(P[O]);H(U)&&N.push({type:2,index:U})}return N.length&&this._onColor.fire(N),!0}restoreFgColor(D){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(D){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(D){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(D){return D.length!==2?(this.selectDefaultCharset(),!0):(D[0]==="/"||this._charsetService.setgCharset(E[D[0]],p.CHARSETS[D[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 D=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,D,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(D){return this._charsetService.setgLevel(D),!0}screenAlignmentPattern(){const D=new u.CellData;D.content=4194373,D.fg=this._curAttrData.fg,D.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(D),O.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(D,N){const P=this._bufferService.buffer,O=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${U}${o.C0.ESC}\\`),!0))(D==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:D==='"p'?'P1$r61;1"p':D==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:D==="m"?"P1$r0m":D===" q"?`P1$r${{block:2,underline:4,bar:6}[O.cursorStyle]-(O.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(D,N){this._dirtyRowTracker.markRangeDirty(D,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,D){W>D&&(M=W,W=D,D=M),W<this.start&&(this.start=W),D>this.end&&(this.end=D)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(W){return 0<=W&&W<256}I=c([d(0,x.IBufferService)],I)},844:(C,r)=>{function i(c){for(const d of c)d.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 d=this._disposables.indexOf(c);d!==-1&&this._disposables.splice(d,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var d;this._isDisposed||c===this._value||((d=this._value)===null||d===void 0||d.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(d,o,p){this._data[d]||(this._data[d]={}),this._data[d][o]=p}get(d,o){return this._data[d]?this._data[d][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=i,r.FourKeyMap=class{constructor(){this._data=new i}set(c,d,o,p,_){this._data.get(c,d)||this._data.set(c,d,new i),this._data.get(c,d).set(o,p,_)}get(c,d,o,p){var _;return(_=this._data.get(c,d))===null||_===void 0?void 0:_.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 d=i.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[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 d=this._getKey(c);if(d===void 0||(i=this._search(d),i===-1)||this._getKey(this._array[i])!==d)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])===d);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,d){if(this._array.length!==0&&(i=this._search(c),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===c))do d(this._array[i]);while(++i<this._array.length&&this._getKey(this._array[i])===c)}values(){return[...this._array].values()}_search(c){let d=0,o=this._array.length-1;for(;o>=d;){let p=d+o>>1;const _=this._getKey(this._array[p]);if(_>c)o=p-1;else{if(!(_<c)){for(;p>0&&this._getKey(this._array[p-1])===c;)p--;return p}d=p+1}}return d}}},7226:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const c=i(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let y=0,g=0,n=_.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),g=Math.max(y,g),f=_.timeRemaining(),1.5*g>f)return n-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-y))}ms`),void this._start();n=f}this.clear()}}class o extends d{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const y=Date.now()+_;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends d{_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(d){const o=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),p=o?.get(d.cols-1),_=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);_&&p&&(_.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),d=i(7226),o=i(3734),p=i(8437),_=i(4634),y=i(511),g=i(643),n=i(4863),f=i(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(h,u,v){this._hasScrollback=h,this._optionsService=u,this._bufferService=v,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=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.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 v=this.getNullCell(p.DEFAULT_ATTR_DATA);let x=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 S=0;S<this.lines.length;S++)x+=+this.lines.get(S).resize(h,v);let k=0;if(this._rows<u)for(let S=this._rows;S<u;S++)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,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+k+1?(this.ybase--,k++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(h,v)));else for(let S=this._rows;S>u;S--)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 S=this.lines.length-w;S>0&&(this.lines.trimStart(S),this.ybase=Math.max(this.ybase-S,0),this.ydisp=Math.max(this.ydisp-S,0),this.savedY=Math.max(this.savedY-S,0)),this.lines.maxLength=w}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,u-1),k&&(this.y+=k),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 k=0;k<this.lines.length;k++)x+=+this.lines.get(k).resize(h,v);this._cols=h,this._rows=u,this._memoryCleanupQueue.clear(),x>.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 v=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(v.length>0){const x=(0,_.reflowLargerCreateNewLayout)(this.lines,v);(0,_.reflowLargerApplyNewLayout)(this.lines,x.layout),this._reflowLargerAdjustViewport(h,u,x.countRemoved)}}_reflowLargerAdjustViewport(h,u,v){const x=this.getNullCell(p.DEFAULT_ATTR_DATA);let w=v;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new p.BufferLine(h,x))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(h,u){const v=this.getNullCell(p.DEFAULT_ATTR_DATA),x=[];let w=0;for(let k=this.lines.length-1;k>=0;k--){let S=this.lines.get(k);if(!S||!S.isWrapped&&S.getTrimmedLength()<=h)continue;const E=[S];for(;S.isWrapped&&k>0;)S=this.lines.get(--k),E.unshift(S);const T=this.ybase+this.y;if(T>=k&&T<k+E.length)continue;const A=E[E.length-1].getTrimmedLength(),L=(0,_.reflowSmallerGetNewLineLengths)(E,this._cols,h),M=L.length-E.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+M):Math.max(0,this.lines.length-this.lines.maxLength+M);const I=[];for(let O=0;O<M;O++){const U=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);I.push(U)}I.length>0&&(x.push({start:k+E.length+w,newLines:I}),w+=I.length),E.push(...I);let H=L.length-1,W=L[H];W===0&&(H--,W=L[H]);let D=E.length-M-1,N=A;for(;D>=0;){const O=Math.min(N,W);if(E[H]===void 0)break;if(E[H].copyCellsFrom(E[D],N-O,W-O,O,!0),W-=O,W===0&&(H--,W=L[H]),N-=O,N===0){D--;const U=Math.max(D,0);N=(0,_.getWrappedLineTrimmedLength)(E,U,this._cols)}}for(let O=0;O<E.length;O++)L[O]<h&&E[O].setCell(L[O],v);let P=M-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+M,this.ybase+u-1)}if(x.length>0){const k=[],S=[];for(let H=0;H<this.lines.length;H++)S.push(this.lines.get(H));const E=this.lines.length;let T=E-1,A=0,L=x[A];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let M=0;for(let H=Math.min(this.lines.maxLength-1,E+w-1);H>=0;H--)if(L&&L.start>T+M){for(let W=L.newLines.length-1;W>=0;W--)this.lines.set(H--,L.newLines[W]);H++,k.push({index:T+1,amount:L.newLines.length}),M+=L.newLines.length,L=x[++A]}else this.lines.set(H,S[T--]);let B=0;for(let H=k.length-1;H>=0;H--)k[H].index+=B,this.lines.onInsertEmitter.fire(k[H]),B+=k[H].amount;const I=Math.max(0,E+w-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(h,u,v=0,x){const w=this.lines.get(h);return w?w.translateToString(u,v,x):""}getWrappedRangeForLine(h){let u=h,v=h;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:u,last:v}}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((v=>{u.line-=v,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((v=>{u.line>=v.index&&(u.line+=v.amount)}))),u.register(this.lines.onDelete((v=>{u.line>=v.index&&u.line<v.index+v.amount&&u.dispose(),u.line>v.index&&(u.line-=v.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),d=i(511),o=i(643),p=i(482);r.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let _=0;class y{constructor(n,f,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*n);const u=f||d.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let v=0;v<n;++v)this.setCell(v,u);this.length=n}get(n){const f=this._data[3*n+0],h=2097151&f;return[this._data[3*n+1],2097152&f?this._combined[n]:h?(0,p.stringFromCodePoint)(h):"",f>>22,2097152&f?this._combined[n].charCodeAt(this._combined[n].length-1):h]}set(n,f){this._data[3*n+1]=f[o.CHAR_DATA_ATTR_INDEX],f[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[n]=f[1],this._data[3*n+0]=2097152|n|f[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*n+0]=f[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[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 f=this._data[3*n+0];return 2097152&f?this._combined[n].charCodeAt(this._combined[n].length-1):2097151&f}isCombined(n){return 2097152&this._data[3*n+0]}getString(n){const f=this._data[3*n+0];return 2097152&f?this._combined[n]:2097151&f?(0,p.stringFromCodePoint)(2097151&f):""}isProtected(n){return 536870912&this._data[3*n+2]}loadCell(n,f){return _=3*n,f.content=this._data[_+0],f.fg=this._data[_+1],f.bg=this._data[_+2],2097152&f.content&&(f.combinedData=this._combined[n]),268435456&f.bg&&(f.extended=this._extendedAttrs[n]),f}setCell(n,f){2097152&f.content&&(this._combined[n]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[n]=f.extended),this._data[3*n+0]=f.content,this._data[3*n+1]=f.fg,this._data[3*n+2]=f.bg}setCellFromCodePoint(n,f,h,u,v,x){268435456&v&&(this._extendedAttrs[n]=x),this._data[3*n+0]=f|h<<22,this._data[3*n+1]=u,this._data[3*n+2]=v}addCodepointToCell(n,f){let h=this._data[3*n+0];2097152&h?this._combined[n]+=(0,p.stringFromCodePoint)(f):(2097151&h?(this._combined[n]=(0,p.stringFromCodePoint)(2097151&h)+(0,p.stringFromCodePoint)(f),h&=-2097152,h|=2097152):h=f|4194304,this._data[3*n+0]=h)}insertCells(n,f,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),f<this.length-n){const v=new d.CellData;for(let x=this.length-n-f-1;x>=0;--x)this.setCell(n+f+x,this.loadCell(n+x,v));for(let x=0;x<f;++x)this.setCell(n+x,h)}else for(let v=n;v<this.length;++v)this.setCell(v,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,f,h,u){if(n%=this.length,f<this.length-n){const v=new d.CellData;for(let x=0;x<this.length-n-f;++x)this.setCell(n+x,this.loadCell(n+f+x,v));for(let x=this.length-f;x<this.length;++x)this.setCell(x,h)}else for(let v=n;v<this.length;++v)this.setCell(v,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,f,h,u,v=!1){if(v)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),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodePoint(f,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs);n<f&&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),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodePoint(f,0,1,u?.fg||0,u?.bg||0,u?.extended||new c.ExtendedAttrs);n<f&&n<this.length;)this.setCell(n++,h)}resize(n,f){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,f)}else{this._data=this._data.subarray(0,h);const u=Object.keys(this._combined);for(let x=0;x<u.length;x++){const w=parseInt(u[x],10);w>=n&&delete this._combined[w]}const v=Object.keys(this._extendedAttrs);for(let x=0;x<v.length;x++){const w=parseInt(v[x],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,f=!1){if(f)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 f in n._combined)this._combined[f]=n._combined[f];this._extendedAttrs={};for(const f in n._extendedAttrs)this._extendedAttrs[f]=n._extendedAttrs[f];this.isWrapped=n.isWrapped}clone(){const n=new y(0);n._data=new Uint32Array(this._data),n.length=this.length;for(const f in this._combined)n._combined[f]=this._combined[f];for(const f in this._extendedAttrs)n._extendedAttrs[f]=this._extendedAttrs[f];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,f,h,u,v){const x=n._data;if(v)for(let k=u-1;k>=0;k--){for(let S=0;S<3;S++)this._data[3*(h+k)+S]=x[3*(f+k)+S];268435456&x[3*(f+k)+2]&&(this._extendedAttrs[h+k]=n._extendedAttrs[f+k])}else for(let k=0;k<u;k++){for(let S=0;S<3;S++)this._data[3*(h+k)+S]=x[3*(f+k)+S];268435456&x[3*(f+k)+2]&&(this._extendedAttrs[h+k]=n._extendedAttrs[f+k])}const w=Object.keys(n._combined);for(let k=0;k<w.length;k++){const S=parseInt(w[k],10);S>=f&&(this._combined[S-f+h]=n._combined[S])}}translateToString(n=!1,f=0,h=this.length){n&&(h=Math.min(h,this.getTrimmedLength()));let u="";for(;f<h;){const v=this._data[3*f+0],x=2097151&v;u+=2097152&v?this._combined[f]:x?(0,p.stringFromCodePoint)(x):o.WHITESPACE_CELL_CHAR,f+=v>>22||1}return u}}r.BufferLine=y},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,d,o){if(d===c.length-1)return c[d].getTrimmedLength();const p=!c[d].hasContent(o-1)&&c[d].getWidth(o-1)===1,_=c[d+1].getWidth(0)===2;return p&&_?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,d,o,p,_){const y=[];for(let g=0;g<c.length-1;g++){let n=g,f=c.get(++n);if(!f.isWrapped)continue;const h=[c.get(g)];for(;n<c.length&&f.isWrapped;)h.push(f),f=c.get(++n);if(p>=g&&p<n){g+=h.length-1;continue}let u=0,v=i(h,u,d),x=1,w=0;for(;x<h.length;){const S=i(h,x,d),E=S-w,T=o-v,A=Math.min(E,T);h[u].copyCellsFrom(h[x],w,v,A,!1),v+=A,v===o&&(u++,v=0),w+=A,w===S&&(x++,w=0),v===0&&u!==0&&h[u-1].getWidth(o-1)===2&&(h[u].copyCellsFrom(h[u-1],o-1,v++,1,!1),h[u-1].setCell(o-1,_))}h[u].replaceCells(v,o,_);let k=0;for(let S=h.length-1;S>0&&(S>u||h[S].getTrimmedLength()===0);S--)k++;k>0&&(y.push(g+h.length-k),y.push(k)),g+=h.length-1}return y},r.reflowLargerCreateNewLayout=function(c,d){const o=[];let p=0,_=d[p],y=0;for(let g=0;g<c.length;g++)if(_===g){const n=d[++p];c.onDeleteEmitter.fire({index:g-y,amount:n}),g+=n-1,y+=n,_=d[++p]}else o.push(g);return{layout:o,countRemoved:y}},r.reflowLargerApplyNewLayout=function(c,d){const o=[];for(let p=0;p<d.length;p++)o.push(c.get(d[p]));for(let p=0;p<o.length;p++)c.set(p,o[p]);c.length=d.length},r.reflowSmallerGetNewLineLengths=function(c,d,o){const p=[],_=c.map(((f,h)=>i(c,h,d))).reduce(((f,h)=>f+h));let y=0,g=0,n=0;for(;n<_;){if(_-n<o){p.push(_-n);break}y+=o;const f=i(c,g,d);y>f&&(y-=f,g++);const h=c[g].getWidth(y-1)===2;h&&y--;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),d=i(844),o=i(9092);class p extends d.Disposable{constructor(y,g){super(),this._optionsService=y,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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,g){this._normal.resize(y,g),this._alt.resize(y,g),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}r.BufferSet=p},511:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const c=i(482),d=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(y){const g=new p;return g.setFromCharData(y),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(y){this.fg=y[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(y[d.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(y[d.CHAR_DATA_CHAR_INDEX].length===2){const n=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){const f=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(n-55296)+f-56320+65536|y[d.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[d.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=y[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[d.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),d=i(844);class o{get id(){return this._id}constructor(_){this.line=_,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,d.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}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,d;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
|
+
`,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}\\`})(d||(r.C1_ESCAPED=d={}))},7399:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const c=i(2584),d={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,_,y){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+(_?"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+(_?"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",_||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",_||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(_&&!y||!o.altKey||o.metaKey)!_||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 f=d[o.keyCode],h=f?.[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 v=String.fromCharCode(u);o.shiftKey&&(v=v.toUpperCase()),g.key=c.C0.ESC+v}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,d=i.length){let o="";for(let p=c;p<d;++p){let _=i[p];_>65535?(_-=65536,o+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):o+=String.fromCharCode(_)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(i,c){const d=i.length;if(!d)return 0;let o=0,p=0;if(this._interim){const _=i.charCodeAt(p++);56320<=_&&_<=57343?c[o++]=1024*(this._interim-55296)+_-56320+65536:(c[o++]=this._interim,c[o++]=_),this._interim=0}for(let _=p;_<d;++_){const y=i.charCodeAt(_);if(55296<=y&&y<=56319){if(++_>=d)return this._interim=y,o;const g=i.charCodeAt(_);56320<=g&&g<=57343?c[o++]=1024*(y-55296)+g-56320+65536:(c[o++]=y,c[o++]=g)}else y!==65279&&(c[o++]=y)}return o}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(i,c){const d=i.length;if(!d)return 0;let o,p,_,y,g=0,n=0,f=0;if(this.interim[0]){let v=!1,x=this.interim[0];x&=(224&x)==192?31:(240&x)==224?15:7;let w,k=0;for(;(w=63&this.interim[++k])&&k<4;)x<<=6,x|=w;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=S-k;for(;f<E;){if(f>=d)return 0;if(w=i[f++],(192&w)!=128){f--,v=!0;break}this.interim[k++]=w,x<<=6,x|=63&w}v||(S===2?x<128?f--:c[g++]=x:S===3?x<2048||x>=55296&&x<=57343||x===65279||(c[g++]=x):x<65536||x>1114111||(c[g++]=x)),this.interim.fill(0)}const h=d-4;let u=f;for(;u<d;){for(;!(!(u<h)||128&(o=i[u])||128&(p=i[u+1])||128&(_=i[u+2])||128&(y=i[u+3]));)c[g++]=o,c[g++]=p,c[g++]=_,c[g++]=y,u+=4;if(o=i[u++],o<128)c[g++]=o;else if((224&o)==192){if(u>=d)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>=d)return this.interim[0]=o,g;if(p=i[u++],(192&p)!=128){u--;continue}if(u>=d)return this.interim[0]=o,this.interim[1]=p,g;if(_=i[u++],(192&_)!=128){u--;continue}if(n=(15&o)<<12|(63&p)<<6|63&_,n<2048||n>=55296&&n<=57343||n===65279)continue;c[g++]=n}else if((248&o)==240){if(u>=d)return this.interim[0]=o,g;if(p=i[u++],(192&p)!=128){u--;continue}if(u>=d)return this.interim[0]=o,this.interim[1]=p,g;if(_=i[u++],(192&_)!=128){u--;continue}if(u>=d)return this.interim[0]=o,this.interim[1]=p,this.interim[2]=_,g;if(y=i[u++],(192&y)!=128){u--;continue}if(n=(7&o)<<18|(63&p)<<12|(63&_)<<6|63&y,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 d;r.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let o=0;o<i.length;++o)d.fill(0,i[o][0],i[o][1]+1)}}wcwidth(o){return o<32?0:o<127?1:o<65536?d[o]:(function(p,_){let y,g=0,n=_.length-1;if(p<_[0][0]||p>_[n][1])return!1;for(;n>=g;)if(y=g+n>>1,p>_[y][1])g=y+1;else{if(!(p<_[y][0]))return!0;n=y-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),d=i(844);class o extends d.Disposable{constructor(_){super(),this._action=_,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(_,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),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(_,y){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+=_.length,this._writeBuffer.push(_),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(y)}_innerWrite(_=0,y=!0){const g=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const n=this._writeBuffer[this._bufferOffset],f=this._action(n,y);if(f){const u=v=>Date.now()-g>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(g,v);return void f.catch((v=>(queueMicrotask((()=>{throw v})),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 d(o,p){const _=o.toString(16),y=_.length<2?"0"+_:_;switch(p){case 4:return _[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}r.parseColor=function(o){if(!o)return;let p=o.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const _=i.exec(p);if(_){const y=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/y*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/y*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/y*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),c.exec(p)&&[3,6,9,12].includes(p.length))){const _=p.length/3,y=[0,0,0];for(let g=0;g<3;++g){const n=parseInt(p.slice(_*g,_*g+_),16);y[g]=_===1?n<<4:_===2?n:_===3?n>>4:n>>8}return y}},r.toRgbString=function(o,p=16){const[_,y,g]=o;return`rgb:${d(_,p)}/${d(y,p)}/${d(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),d=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(y,g){this._handlers[y]===void 0&&(this._handlers[y]=[]);const n=this._handlers[y];return n.push(g),{dispose:()=>{const f=n.indexOf(g);f!==-1&&n.splice(f,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(y,g){if(this.reset(),this._ident=y,this._active=this._handlers[y]||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(y,g,n){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(y,g,n);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(y,g,n))}unhook(y,g=!0){if(this._active.length){let n=!1,f=this._active.length-1,h=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,n=g,h=this._stack.fallThrough,this._stack.paused=!1),!h&&n===!1){for(;f>=0&&(n=this._active[f].unhook(y),n!==!0);f--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,n;f--}for(;f>=0;f--)if(n=this._active[f].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,"UNHOOK",y);this._active=p,this._ident=0}};const _=new d.Params;_.addParam(0),r.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=_,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():_,this._data="",this._hitLimit=!1}put(y,g,n){this._hitLimit||(this._data+=(0,c.utf32ToString)(y,g,n),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let g=!1;if(this._hitLimit)g=!1;else if(y&&(g=this._handler(this._data,this._params),g instanceof Promise))return g.then((n=>(this._params=_,this._data="",this._hitLimit=!1,n)));return this._params=_,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),d=i(8742),o=i(6242),p=i(6351);class _{constructor(f){this.table=new Uint8Array(f)}setDefault(f,h){this.table.fill(f<<4|h)}add(f,h,u,v){this.table[h<<8|f]=u<<4|v}addMany(f,h,u,v){for(let x=0;x<f.length;x++)this.table[h<<8|f[x]]=u<<4|v}}r.TransitionTable=_;const y=160;r.VT500_TRANSITION_TABLE=(function(){const n=new _(4095),f=Array.apply(null,Array(256)).map(((k,S)=>S)),h=(k,S)=>f.slice(k,S),u=h(32,127),v=h(0,24);v.push(25),v.push.apply(v,h(28,32));const x=h(0,14);let w;for(w in n.setDefault(1,0),n.addMany(u,0,2,0),x)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(v,0,3,0),n.addMany(v,1,3,1),n.add(127,1,0,1),n.addMany(v,8,0,8),n.addMany(v,3,3,3),n.add(127,3,0,3),n.addMany(v,4,3,4),n.add(127,4,0,4),n.addMany(v,6,3,6),n.addMany(v,5,3,5),n.add(127,5,0,5),n.addMany(v,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(v,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(v,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(v,11,0,11),n.addMany(h(32,128),11,0,11),n.addMany(h(28,32),11,0,11),n.addMany(v,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(v,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(v,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(y,0,2,0),n.add(y,8,5,8),n.add(y,6,0,6),n.add(y,11,0,11),n.add(y,13,13,13),n})();class g extends c.Disposable{constructor(f=r.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(h,u,v)=>{},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(f,h=[64,126]){let u=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=f.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let x=0;x<f.intermediates.length;++x){const w=f.intermediates.charCodeAt(x);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=w}}if(f.final.length!==1)throw new Error("final must be a single byte");const v=f.final.charCodeAt(0);if(h[0]>v||v>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return u<<=8,u|=v,u}identToString(f){const h=[];for(;f;)h.push(String.fromCharCode(255&f)),f>>=8;return h.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,h){const u=this._identifier(f,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);const v=this._escHandlers[u];return v.push(h),{dispose:()=>{const x=v.indexOf(h);x!==-1&&v.splice(x,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,h){this._executeHandlers[f.charCodeAt(0)]=h}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,h){const u=this._identifier(f);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);const v=this._csiHandlers[u];return v.push(h),{dispose:()=>{const x=v.indexOf(h);x!==-1&&v.splice(x,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,h){return this._dcsParser.registerHandler(this._identifier(f),h)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,h){return this._oscParser.registerHandler(f,h)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}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(f,h,u,v,x){this._parseStack.state=f,this._parseStack.handlers=h,this._parseStack.handlerPos=u,this._parseStack.transition=v,this._parseStack.chunkPos=x}parse(f,h,u){let v,x=0,w=0,k=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,k=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 S=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&E>-1){for(;E>=0&&(v=S[E](this._params),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 4:if(u===!1&&E>-1){for(;E>=0&&(v=S[E](),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 6:if(x=f[this._parseStack.chunkPos],v=this._dcsParser.unhook(x!==24&&x!==26,u),v)return v;x===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(x=f[this._parseStack.chunkPos],v=this._oscParser.end(x!==24&&x!==26,u),v)return v;x===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,k=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let S=k;S<h;++S){switch(x=f[S],w=this._transitions.table[this.currentState<<8|(x<160?x:y)],w>>4){case 2:for(let M=S+1;;++M){if(M>=h||(x=f[M])<32||x>126&&x<y){this._printHandler(f,S,M),S=M-1;break}if(++M>=h||(x=f[M])<32||x>126&&x<y){this._printHandler(f,S,M),S=M-1;break}if(++M>=h||(x=f[M])<32||x>126&&x<y){this._printHandler(f,S,M),S=M-1;break}if(++M>=h||(x=f[M])<32||x>126&&x<y){this._printHandler(f,S,M),S=M-1;break}}break;case 3:this._executeHandlers[x]?this._executeHandlers[x]():this._executeHandlerFb(x),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:S,code:x,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|x];let T=E?E.length-1:-1;for(;T>=0&&(v=E[T](this._params),v!==!0);T--)if(v instanceof Promise)return this._preserveStack(3,E,T,w,S),v;T<0&&this._csiHandlerFb(this._collect<<8|x,this._params),this.precedingCodepoint=0;break;case 8:do switch(x){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(x-48)}while(++S<h&&(x=f[S])>47&&x<60);S--;break;case 9:this._collect<<=8,this._collect|=x;break;case 10:const A=this._escHandlers[this._collect<<8|x];let L=A?A.length-1:-1;for(;L>=0&&(v=A[L](),v!==!0);L--)if(v instanceof Promise)return this._preserveStack(4,A,L,w,S),v;L<0&&this._escHandlerFb(this._collect<<8|x),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|x,this._params);break;case 13:for(let M=S+1;;++M)if(M>=h||(x=f[M])===24||x===26||x===27||x>127&&x<y){this._dcsParser.put(f,S,M),S=M-1;break}break;case 14:if(v=this._dcsParser.unhook(x!==24&&x!==26),v)return this._preserveStack(6,[],0,w,S),v;x===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 M=S+1;;M++)if(M>=h||(x=f[M])<32||x>127&&x<y){this._oscParser.put(f,S,M),S=M-1;break}break;case 6:if(v=this._oscParser.end(x!==24&&x!==26),v)return this._preserveStack(5,[],0,w,S),v;x===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),d=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,_){this._handlers[p]===void 0&&(this._handlers[p]=[]);const y=this._handlers[p];return y.push(_),{dispose:()=>{const g=y.indexOf(_);g!==-1&&y.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,_,y){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(p,_,y);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(p,_,y))}start(){this.reset(),this._state=1}put(p,_,y){if(this._state!==3){if(this._state===1)for(;_<y;){const g=p[_++];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&&y-_>0&&this._put(p,_,y)}}end(p,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,g=this._active.length-1,n=!1;if(this._stack.paused&&(g=this._stack.loopPosition-1,y=_,n=this._stack.fallThrough,this._stack.paused=!1),!n&&y===!1){for(;g>=0&&(y=this._active[g].end(p),y!==!0);g--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!1,y;g--}for(;g>=0;g--)if(y=this._active[g].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!0,y}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,_,y){this._hitLimit||(this._data+=(0,d.utf32ToString)(p,_,y),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let _=!1;if(this._hitLimit)_=!1;else if(p&&(_=this._handler(this._data),_ instanceof Promise))return _.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,_}}},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 _=Array.isArray(o[0])?1:0;_<o.length;++_){const y=o[_];if(Array.isArray(y))for(let g=0;g<y.length;++g)p.addSubParam(y[g]);else p.addParam(y)}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 _=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-_>0&&o.push(Array.prototype.slice.call(this._subParams,_,y))}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,_=255&this._subParamsIdx[o];return _-p>0?this._subParams.subarray(p,_):null}getSubParamsAll(){const o={};for(let p=0;p<this.length;++p){const _=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-_>0&&(o[p]=this._subParams.slice(_,y))}return o}addDigit(o){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,y=_[p-1];_[p-1]=~y?Math.min(10*y+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 d={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(d),c.dispose=()=>this._wrappedAddonDispose(d),c.activate(i)}_wrappedAddonDispose(i){if(i.isDisposed)return;let c=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===i){c=d;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),d=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 d.CellData}}},3785:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const c=i(511);r.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,o){if(!(d<0||d>=this._line.length))return o?(this._line.loadCell(d,o),o):this._line.loadCell(d,new c.CellData)}translateToString(d,o,p){return this._line.translateToString(d,o,p)}}},8285:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const c=i(8771),d=i(8460),o=i(844);class p extends o.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new d.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,(d=>c(d.toArray())))}addCsiHandler(i,c){return this.registerCsiHandler(i,c)}registerDcsHandler(i,c){return this._core.registerDcsHandler(i,((d,o)=>c(d,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,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(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),_=i(5295),y=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 _.BufferSet(n,this))}resize(n,f){this.cols=n,this.rows=f,this.buffers.resize(n,f),this._onResize.fire({cols:n,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(n,f=!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,f),this._cachedBlankLine=u),u.isWrapped=f;const v=h.ybase+h.scrollTop,x=h.ybase+h.scrollBottom;if(h.scrollTop===0){const w=h.lines.isFull;x===h.lines.length-1?w?h.lines.recycle().copyFrom(u):h.lines.push(u.clone()):h.lines.splice(x+1,0,u.clone()),w?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{const w=x-v+1;h.lines.shiftElements(v+1,w-1,-1),h.lines.set(x,u.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(n,f,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 v=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+n,u.ybase),0),v!==u.ydisp&&(f||this._onScroll.fire(u.ydisp))}};r.BufferService=g=c([d(0,y.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,v,x,w){var k,S=arguments.length,E=S<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,x):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(u,v,x,w);else for(var T=u.length-1;T>=0;T--)(k=u[T])&&(E=(S<3?k(E):S>3?k(v,x,E):k(v,x))||E);return S>3&&E&&Object.defineProperty(v,x,E),E},d=this&&this.__param||function(u,v){return function(x,w){v(x,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const o=i(2585),p=i(8460),_=i(844),y={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,v){let x=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(x|=64,x|=u.action):(x|=3&u.button,4&u.button&&(x|=64),8&u.button&&(x|=128),u.action===32?x|=32:u.action!==0||v||(x|=3)),x}const n=String.fromCharCode,f={DEFAULT:u=>{const v=[g(u,!1)+32,u.col+32,u.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${n(v[0])}${n(v[1])}${n(v[2])}`},SGR:u=>{const v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${g(u,!0)};${u.col};${u.row}${v}`},SGR_PIXELS:u=>{const v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${g(u,!0)};${u.x};${u.y}${v}`}};let h=r.CoreMouseService=class extends _.Disposable{constructor(u,v){super(),this._bufferService=u,this._coreService=v,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 x of Object.keys(y))this.addProtocol(x,y[x]);for(const x of Object.keys(f))this.addEncoding(x,f[x]);this.reset()}addProtocol(u,v){this._protocols[u]=v}addEncoding(u,v){this._encodings[u]=v}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 v=this._encodings[this._activeEncoding](u);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!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,v,x){if(x){if(u.x!==v.x||u.y!==v.y)return!1}else if(u.col!==v.col||u.row!==v.row)return!1;return u.button===v.button&&u.action===v.action&&u.ctrl===v.ctrl&&u.alt===v.alt&&u.shift===v.shift}};r.CoreMouseService=h=c([d(0,o.IBufferService),d(1,o.ICoreService)],h)},6975:function(C,r,i){var c=this&&this.__decorate||function(h,u,v,x){var w,k=arguments.length,S=k<3?u:x===null?x=Object.getOwnPropertyDescriptor(u,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(h,u,v,x);else for(var E=h.length-1;E>=0;E--)(w=h[E])&&(S=(k<3?w(S):k>3?w(u,v,S):w(u,v))||S);return k>3&&S&&Object.defineProperty(u,v,S),S},d=this&&this.__param||function(h,u){return function(v,x){u(v,x,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const o=i(1439),p=i(8460),_=i(844),y=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 f=r.CoreService=class extends _.Disposable{constructor(h,u,v){super(),this._bufferService=h,this._logService=u,this._optionsService=v,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 v=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${h}"`,(()=>h.split("").map((x=>x.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=f=c([d(0,y.IBufferService),d(1,y.ILogService),d(2,y.IOptionsService)],f)},9074:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const c=i(8055),d=i(8460),o=i(844),p=i(6106);let _=0,y=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 d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.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 v=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),v.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,v){var x,w,k;let S=0,E=0;for(const T of this._decorations.getKeyIterator(u))S=(x=T.options.x)!==null&&x!==void 0?x:0,E=S+((w=T.options.width)!==null&&w!==void 0?w:1),h>=S&&h<E&&(!v||((k=T.options.layer)!==null&&k!==void 0?k:"bottom")===v)&&(yield T)}forEachDecorationAtCell(h,u,v,x){this._decorations.forEachByKey(u,(w=>{var k,S,E;_=(k=w.options.x)!==null&&k!==void 0?k:0,y=_+((S=w.options.width)!==null&&S!==void 0?S:1),h>=_&&h<y&&(!v||((E=w.options.layer)!==null&&E!==void 0?E:"bottom")===v)&&x(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 d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.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),d=i(8343);class o{constructor(..._){this._entries=new Map;for(const[y,g]of _)this.set(y,g)}set(_,y){const g=this._entries.get(_);return this._entries.set(_,y),g}forEach(_){for(const[y,g]of this._entries.entries())_(y,g)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(c.IInstantiationService,this)}setService(p,_){this._services.set(p,_)}getService(p){return this._services.get(p)}createInstance(p,..._){const y=(0,d.getServiceDependencies)(p).sort(((f,h)=>f.index-h.index)),g=[];for(const f of y){const h=this._services.get(f.id);if(!h)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${f.id}.`);g.push(h)}const n=y.length>0?y[0].index:_.length;if(_.length!==n)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${n+1} conflicts with ${_.length} static arguments`);return new p(..._,...g)}}},7866:function(C,r,i){var c=this&&this.__decorate||function(n,f,h,u){var v,x=arguments.length,w=x<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,h):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,f,h,u);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(x<3?v(w):x>3?v(f,h,w):v(f,h))||w);return x>3&&w&&Object.defineProperty(f,h,w),w},d=this&&this.__param||function(n,f){return function(h,u){f(h,u,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const o=i(844),p=i(2585),_={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 y,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()))),y=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(n){for(let f=0;f<n.length;f++)typeof n[f]=="function"&&(n[f]=n[f]())}_log(n,f,h){this._evalLazyOptionalParams(h),n.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...h)}trace(n,...f){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,f)}debug(n,...f){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,f)}info(n,...f){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,f)}warn(n,...f){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,f)}error(n,...f){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,f)}};r.LogService=g=c([d(0,p.IOptionsService)],g),r.setTraceLogger=function(n){y=n},r.traceCall=function(n,f,h){if(typeof h.value!="function")throw new Error("not supported");const u=h.value;h.value=function(...v){if(y.logLevel!==p.LogLevelEnum.TRACE)return u.apply(this,v);y.trace(`GlyphRenderer#${u.name}(${v.map((w=>JSON.stringify(w))).join(", ")})`);const x=u.apply(this,v);return y.trace(`GlyphRenderer#${u.name} return`,x),x}}},7302:(C,r,i)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const c=i(8460),d=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 _ extends d.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 f in g)if(f in n)try{const h=g[f];n[f]=this._sanitizeAndValidateOption(f,h)}catch(h){console.error(h)}this.rawOptions=n,this.options=Object.assign({},n),this._setupOptions()}onSpecificOptionChange(g,n){return this.onOptionChange((f=>{f===g&&n(this.rawOptions[g])}))}onMultipleOptionChange(g,n){return this.onOptionChange((f=>{g.indexOf(f)!==-1&&n()}))}_setupOptions(){const g=f=>{if(!(f in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},n=(f,h)=>{if(!(f in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);h=this._sanitizeAndValidateOption(f,h),this.rawOptions[f]!==h&&(this.rawOptions[f]=h,this._onOptionChange.fire(f))};for(const f in this.rawOptions){const h={get:g.bind(this,f),set:n.bind(this,f)};Object.defineProperty(this.options,f,h)}}_sanitizeAndValidateOption(g,n){switch(g){case"cursorStyle":if(n||(n=r.DEFAULT_OPTIONS[g]),!(function(f){return f==="block"||f==="underline"||f==="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=_},2660:function(C,r,i){var c=this&&this.__decorate||function(_,y,g,n){var f,h=arguments.length,u=h<3?y:n===null?n=Object.getOwnPropertyDescriptor(y,g):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(_,y,g,n);else for(var v=_.length-1;v>=0;v--)(f=_[v])&&(u=(h<3?f(u):h>3?f(y,g,u):f(y,g))||u);return h>3&&u&&Object.defineProperty(y,g,u),u},d=this&&this.__param||function(_,y){return function(g,n){y(g,n,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const o=i(2585);let p=r.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const y=this._bufferService.buffer;if(_.id===void 0){const v=y.addMarker(y.ybase+y.y),x={data:_,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(x,v))),this._dataByLinkId.set(x.id,x),x.id}const g=_,n=this._getEntryIdKey(g),f=this._entriesWithId.get(n);if(f)return this.addLineToLink(f.id,y.ybase+y.y),f.id;const h=y.addMarker(y.ybase+y.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(_,y){const g=this._dataByLinkId.get(_);if(g&&g.lines.every((n=>n.line!==y))){const n=this._bufferService.buffer.addMarker(y);g.lines.push(n),n.onDispose((()=>this._removeMarkerFromLink(g,n)))}}getLinkData(_){var y;return(y=this._dataByLinkId.get(_))===null||y===void 0?void 0:y.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,y){const g=_.lines.indexOf(y);g!==-1&&(_.lines.splice(g,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};r.OscLinkService=p=c([d(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(d){return d[c]||[]},r.createDecorator=function(d){if(r.serviceRegistry.has(d))return r.serviceRegistry.get(d);const o=function(p,_,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,n,f){n[i]===n?n[c].push({id:g,index:f}):(n[c]=[{id:g,index:f}],n[i]=n)})(o,p,y)};return o.toString=()=>d,r.serviceRegistry.set(d,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 d;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"})(d||(r.LogLevelEnum=d={})),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),d=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 d.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 _=o.length;for(let y=0;y<_;++y){let g=o.charCodeAt(y);if(55296<=g&&g<=56319){if(++y>=_)return p+this.wcwidth(g);const n=o.charCodeAt(y);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 b={};return(()=>{var C=b;Object.defineProperty(C,"__esModule",{value:!0}),C.Terminal=void 0;const r=m(9042),i=m(3236),c=m(844),d=m(5741),o=m(8285),p=m(7975),_=m(7090),y=["cols","rows"];class g extends c.Disposable{constructor(f){super(),this._core=this.register(new i.Terminal(f)),this._addonManager=this.register(new d.AddonManager),this._publicOptions=Object.assign({},this._core.options);const h=v=>this._core.options[v],u=(v,x)=>{this._checkReadonlyOptions(v),this._core.options[v]=x};for(const v in this._core.options){const x={get:h.bind(this,v),set:u.bind(this,v)};Object.defineProperty(this._publicOptions,v,x)}}_checkReadonlyOptions(f){if(y.includes(f))throw new Error(`Option "${f}" 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 _.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 f=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:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(const h in f)this._publicOptions[h]=f[h]}blur(){this._core.blur()}focus(){this._core.focus()}resize(f,h){this._verifyIntegers(f,h),this._core.resize(f,h)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){var h,u,v;return this._checkProposedApi(),this._verifyPositiveIntegers((h=f.x)!==null&&h!==void 0?h:0,(u=f.width)!==null&&u!==void 0?u:0,(v=f.height)!==null&&v!==void 0?v:0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,h,u){this._verifyIntegers(f,h,u),this._core.select(f,h,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,h){this._verifyIntegers(f,h),this._core.selectLines(f,h)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,h){this._core.write(f,h)}writeln(f,h){this._core.write(f),this._core.write(`\r
|
|
19
|
+
`,h)}paste(f){this._core.paste(f)}refresh(f,h){this._verifyIntegers(f,h),this._core.refresh(f,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return r}_verifyIntegers(...f){for(const h of f)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(const h of f)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}C.Terminal=g})(),b})()))})(Xs)),Xs.exports}var Bc=Oc();var Ic=2,Fc=1,Hc=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"))),b=window.getComputedStyle(this._terminal.element),C={top:parseInt(b.getPropertyValue("padding-top")),bottom:parseInt(b.getPropertyValue("padding-bottom")),right:parseInt(b.getPropertyValue("padding-right")),left:parseInt(b.getPropertyValue("padding-left"))},r=C.top+C.bottom,i=C.right+C.left,c=l-r,d=m-i-t;return{cols:Math.max(Ic,Math.floor(d/e.css.cell.width)),rows:Math.max(Fc,Math.floor(c/e.css.cell.height))}}};function zc(e={}){const{cwd:t,cols:s,rows:l,onOutput:m,onExit:b}=e,[C,r]=R.useState(null),[i,c]=R.useState(()=>ft.isConnected()),[d,o]=R.useState(!1),[p,_]=R.useState(!1),[y,g]=R.useState(!1),n=R.useRef({onOutput:m,onExit:b});n.current={onOutput:m,onExit:b};const f=R.useRef(null);f.current=C,R.useEffect(()=>{if(!C)return;const w=ft.getSocket(),k=()=>{c(!0),o(!1),r(null),g(!0)},S=()=>{c(!1),o(!1)},E=M=>{M.terminalId===C&&n.current.onOutput?.(M.data)},T=M=>{M.terminalId===C&&(o(!1),n.current.onExit?.(M.exitCode),r(null))},A=M=>{M.terminalId===C&&o(!0)},L=M=>{M.terminalId===C&&o(!1)};return w.on("connect",k),w.on("disconnect",S),w.on(We.TERMINAL_STDOUT,E),w.on(We.TERMINAL_EXIT,T),w.on(We.TERMINAL_SUBSCRIBED,A),w.on(We.TERMINAL_UNSUBSCRIBED,L),c(w.connected),w.connected&&w.emit(at.SUBSCRIBE,{topic:"terminal",id:C},M=>{M.success&&o(!0)}),()=>{w.off("connect",k),w.off("disconnect",S),w.off(We.TERMINAL_STDOUT,E),w.off(We.TERMINAL_EXIT,T),w.off(We.TERMINAL_SUBSCRIBED,A),w.off(We.TERMINAL_UNSUBSCRIBED,L),w.emit(at.UNSUBSCRIBE,{topic:"terminal",id:C})}},[C]);const h=R.useCallback(async()=>{const w=ft.getSocket();if(!w.connected)return null;_(!0);try{const k=await _e.post("/terminals",{socketId:w.id,cwd:t,cols:s,rows:l});return r(k.terminalId),g(!1),k.terminalId}catch(k){return console.error("[useStandaloneTerminal] Failed to create terminal:",k),null}finally{_(!1)}},[t,s,l]),u=R.useCallback(async()=>{const w=f.current;if(w){try{await _e.delete(`/terminals/${w}`)}catch(k){console.error("[useStandaloneTerminal] Failed to destroy terminal:",k)}r(null),o(!1)}},[]),v=R.useCallback(w=>{const k=f.current;if(!k)return;ft.getSocket().emit(at.TERMINAL_INPUT,{terminalId:k,data:w})},[]),x=R.useCallback((w,k)=>{const S=f.current;if(!S)return;ft.getSocket().emit(at.TERMINAL_RESIZE,{terminalId:S,cols:w,rows:k})},[]);return R.useEffect(()=>()=>{const w=f.current;w&&_e.delete(`/terminals/${w}`).catch(()=>{})},[]),{terminalId:C,isConnected:i,isAttached:d,isCreating:p,needsRecreate:y,create:h,destroy:u,sendInput:v,resize:x}}const Wc={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"},$c=ee.memo(function({cwd:t,onExit:s,onReady:l}){const m=R.useRef(null),b=R.useRef(null),C=R.useRef(null),r=R.useRef(!1),{terminalId:i,isAttached:c,needsRecreate:d,create:o,sendInput:p,resize:_}=zc({cwd:t,onOutput:R.useCallback(y=>{b.current?.write(y)},[]),onExit:R.useCallback(y=>{b.current?.writeln(`\r
|
|
20
|
+
\x1B[90m[Process exited with code ${y}]\x1B[0m`),s?.(y)},[s])});return R.useEffect(()=>{if(!d)return;const y=b.current;y&&y.writeln(`\r
|
|
21
|
+
\x1B[33m[Terminal disconnected — reconnecting...]\x1B[0m`),o()},[d,o]),R.useLayoutEffect(()=>{if(!m.current)return;const y=new Bc.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, 'Courier New', monospace",lineHeight:1.4,theme:Wc,scrollback:5e3,convertEol:!0}),g=new Hc;y.loadAddon(g),y.open(m.current);const n=(f=0)=>{if(!(f>=5))try{const u=m.current;if(!u||u.clientWidth===0||u.clientHeight===0){setTimeout(()=>n(f+1),50);return}g.fit(),_(y.cols,y.rows)}catch{setTimeout(()=>n(f+1),50)}};return n(0),setTimeout(()=>n(1),100),b.current=y,C.current=g,()=>{y.dispose(),b.current=null,C.current=null}},[_]),R.useEffect(()=>{r.current||(r.current=!0,o())},[o]),R.useEffect(()=>{const y=b.current;if(!y||!c)return;const g=y.onData(n=>{p(n)});return()=>g.dispose()},[p,c]),R.useEffect(()=>{c&&l?.({sendInput:p})},[c,p,l]),R.useEffect(()=>{if(!m.current)return;const y=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{const g=C.current,n=b.current,f=m.current;g&&n&&f&&f.clientWidth>0&&f.clientHeight>0&&(g.fit(),_(n.cols,n.rows))}catch{}})});return y.observe(m.current),()=>y.disconnect()},[_]),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"})]})}),Uc=ee.memo(function({commands:t,onSelect:s}){const[l,m]=R.useState(!1),b=R.useRef(null),C=R.useRef(null);return R.useEffect(()=>{if(!l)return;const r=i=>{b.current&&!b.current.contains(i.target)&&C.current&&!C.current.contains(i.target)&&m(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[l]),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:C,onClick:()=>m(!l),className:`flex items-center gap-1.5 px-2.5 py-1 mx-1 rounded text-[11px] font-medium transition-colors shrink-0 ${l?"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(za,{size:12}),a.jsx("span",{children:"快捷命令"}),a.jsx(mt,{size:10,className:`transition-transform ${l?"rotate-180":""}`})]}),l&&a.jsx("div",{ref:b,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((r,i)=>a.jsxs("button",{onClick:()=>{s(r.command),m(!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(Lt,{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:r.name}),a.jsx("div",{className:"text-[11px] font-mono text-neutral-500 truncate",children:r.command})]})]},i))})})]})]})});let qc=0;function ai(){return`shell-${++qc}`}const Kc=ee.memo(function({cwd:t,quickCommands:s=[]}){const[l,m]=R.useState(()=>[{id:ai(),label:"Shell 1"}]),[b,C]=R.useState(()=>l[0].id),r=R.useRef(new Map),i=R.useCallback(()=>{const _=ai(),y={id:_,label:`Shell ${l.length+1}`};m(g=>[...g,y]),C(_)},[l.length]),c=R.useCallback((_,y)=>{y.stopPropagation(),r.current.delete(_),m(g=>{const n=g.filter(f=>f.id!==_);return _===b&&n.length>0&&C(n[n.length-1].id),n})},[b]),d=R.useCallback(_=>{r.current.delete(_),m(y=>{const g=y.filter(n=>n.id!==_);return _===b&&g.length>0&&C(g[g.length-1].id),g})},[b]),o=R.useCallback((_,y)=>{r.current.set(_,y.sendInput)},[]),p=R.useCallback(_=>{const y=r.current.get(b);y&&y(_+"\r")},[b]);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:l.map(_=>a.jsxs("button",{onClick:()=>C(_.id),className:xe("flex items-center gap-1.5 px-3 py-1.5 text-[11px] border-r border-[#333] whitespace-nowrap group transition-colors",_.id===b?"bg-[#1e1e1e] text-neutral-200":"bg-[#2d2d2d] text-neutral-500 hover:text-neutral-300"),children:[a.jsx(ms,{size:11,className:"shrink-0"}),a.jsx("span",{children:_.label}),l.length>1&&a.jsx("span",{onClick:y=>c(_.id,y),className:"ml-1 p-0.5 rounded hover:bg-[#444] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:a.jsx(Rs,{size:10})})]},_.id))}),a.jsx("button",{onClick:i,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:"New Terminal",children:a.jsx(rr,{size:14})}),s.length>0&&a.jsx(Uc,{commands:s,onSelect:p})]}),a.jsx("div",{className:"flex-1 overflow-hidden relative",children:l.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(ms,{size:28}),a.jsx("span",{className:"text-xs",children:"No terminals open"}),a.jsx("button",{onClick:i,className:"mt-1 px-3 py-1 text-xs bg-[#333] hover:bg-[#444] rounded transition-colors text-neutral-300",children:"New Terminal"})]})}):l.map(_=>a.jsx("div",{className:"absolute inset-0",style:{display:_.id===b?"block":"none"},children:a.jsx($c,{cwd:t,onExit:()=>d(_.id),onReady:y=>o(_.id,y)})},_.id))})]})});function li(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 Xc(e){if(Array.isArray(e))return e}function Yc(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 Vc(e,t){var s=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(s!=null){var l,m,b,C,r=[],i=!0,c=!1;try{if(b=(s=s.call(e)).next,t!==0)for(;!(i=(l=b.call(s)).done)&&(r.push(l.value),r.length!==t);i=!0);}catch(d){c=!0,m=d}finally{try{if(!i&&s.return!=null&&(C=s.return(),Object(C)!==C))return}finally{if(c)throw m}}return r}}function Gc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
22
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ci(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 hi(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?ci(Object(s),!0).forEach(function(l){Yc(e,l,s[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):ci(Object(s)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(s,l))})}return e}function Qc(e,t){if(e==null)return{};var s,l,m=Zc(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(l=0;l<b.length;l++)s=b[l],t.indexOf(s)===-1&&{}.propertyIsEnumerable.call(e,s)&&(m[s]=e[s])}return m}function Zc(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 Jc(e,t){return Xc(e)||Vc(e,t)||sh(e,t)||Gc()}function eh(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=eh(e,"string");return typeof t=="symbol"?t:t+""}function sh(e,t){if(e){if(typeof e=="string")return li(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)?li(e,t):void 0}}function rh(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function ui(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 di(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?ui(Object(s),!0).forEach(function(l){rh(e,l,s[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):ui(Object(s)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(s,l))})}return e}function ih(){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,b){return b(m)},l)}}function Ft(e){return function t(){for(var s=this,l=arguments.length,m=new Array(l),b=0;b<l;b++)m[b]=arguments[b];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 ys(e){return{}.toString.call(e).includes("Object")}function nh(e){return!Object.keys(e).length}function Gt(e){return typeof e=="function"}function oh(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ah(e,t){return ys(t)||gt("changeType"),Object.keys(t).some(function(s){return!oh(e,s)})&>("changeField"),t}function lh(e){Gt(e)||gt("selectorType")}function ch(e){Gt(e)||ys(e)||gt("handlerType"),ys(e)&&Object.values(e).some(function(t){return!Gt(t)})&>("handlersType")}function hh(e){e||gt("initialIsRequired"),ys(e)||gt("initialType"),nh(e)&>("initialContent")}function uh(e,t){throw new Error(e[t]||e.default)}var dh={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"},gt=Ft(uh)(dh),cs={changes:ah,selector:lh,handler:ch,initial:hh};function fh(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};cs.initial(e),cs.handler(t);var s={current:e},l=Ft(vh)(s,t),m=Ft(mh)(s),b=Ft(cs.changes)(e),C=Ft(ph)(s);function r(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return cs.selector(c),c(s.current)}function i(c){ih(l,m,b,C)(c)}return[r,i]}function ph(e,t){return Gt(t)?t(e.current):t}function mh(e,t){return e.current=di(di({},e.current),t),t}function vh(e,t,s){return Gt(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 gh={create:fh},_h={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function bh(e){return function t(){for(var s=this,l=arguments.length,m=new Array(l),b=0;b<l;b++)m[b]=arguments[b];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 xh(e){return{}.toString.call(e).includes("Object")}function Sh(e){return e||fi("configIsRequired"),xh(e)||fi("configType"),e.urls?(yh(),{paths:{vs:e.urls.monacoBase}}):e}function yh(){console.warn(kn.deprecation)}function Ch(e,t){throw new Error(e[t]||e.default)}var kn={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
|
|
|
25
25
|
Instead of using
|
|
@@ -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
|
-
`},ui=_h(yh)(Rn),Ch={config:xh},wh=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(b,C){return C(b)},m)}};function Dn(e,t){return Object.keys(t).forEach(function(s){t[s]instanceof Object&&e[s]&&Object.assign(t[s],Dn(e[s],t[s]))}),li(li({},e),t)}var Eh={type:"cancelation",msg:"operation is manually canceled"};function Xs(e){var t=!1,s=new Promise(function(l,m){e.then(function(b){return t?m(Eh):l(b)}),e.catch(m)});return s.cancel=function(){return t=!0},s}var kh=["monaco"],Rh=vh.create({config:gh,isInitialized:!1,resolve:null,reject:null,monaco:null}),Tn=Zc(Rh,2),es=Tn[0],Ps=Tn[1];function Dh(e){var t=Ch.config(e),s=t.monaco,l=Gc(t,kh);Ps(function(m){return{config:Dn(m.config,l),monaco:s}})}function Th(){var e=es(function(t){var s=t.monaco,l=t.isInitialized,m=t.resolve;return{monaco:s,isInitialized:l,resolve:m}});if(!e.isInitialized){if(Ps({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Xs(Ys);if(window.monaco&&window.monaco.editor)return jn(window.monaco),e.resolve(window.monaco),Xs(Ys);wh(jh,Ah)(Nh)}return Xs(Ys)}function jh(e){return document.body.appendChild(e)}function Lh(e){var t=document.createElement("script");return e&&(t.src=e),t}function Ah(e){var t=es(function(l){var m=l.config,b=l.reject;return{config:m,reject:b}}),s=Lh("".concat(t.config.paths.vs,"/loader.js"));return s.onload=function(){return e()},s.onerror=t.reject,s}function Nh(){var e=es(function(s){var l=s.config,m=s.resolve,b=s.reject;return{config:l,resolve:m,reject:b}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(s){var l=s.m||s;jn(l),e.resolve(l)},function(s){e.reject(s)})}function jn(e){es().monaco||Ps({monaco:e})}function Mh(){return es(function(e){var t=e.monaco;return t})}var Ys=new Promise(function(e,t){return Ps({resolve:e,reject:t})}),Ln={config:Dh,init:Th,__getMonacoInstance:Mh},Ph={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Vs=Ph,Oh={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Bh=Oh;function Ih({children:e}){return ee.createElement("div",{style:Bh.container},e)}var Fh=Ih,Hh=Fh;function zh({width:e,height:t,isEditorReady:s,loading:l,_ref:m,className:b,wrapperProps:C}){return ee.createElement("section",{style:{...Vs.wrapper,width:e,height:t},...C},!s&&ee.createElement(Hh,null,l),ee.createElement("div",{ref:m,style:{...Vs.fullWidth,...!s&&Vs.hide},className:b}))}var Wh=zh,An=R.memo(Wh);function $h(e){R.useEffect(e,[])}var Nn=$h;function Uh(e,t,s=!0){let l=R.useRef(!0);R.useEffect(l.current||!s?()=>{l.current=!1}:e,t)}var Qe=Uh;function zt(){}function Dt(e,t,s,l){return qh(e,l)||Kh(e,t,s,l)}function qh(e,t){return e.editor.getModel(Mn(e,t))}function Kh(e,t,s,l){return e.editor.createModel(t,s,l?Mn(e,l):void 0)}function Mn(e,t){return e.Uri.parse(t)}function Xh({original:e,modified:t,language:s,originalLanguage:l,modifiedLanguage:m,originalModelPath:b,modifiedModelPath:C,keepCurrentOriginalModel:r=!1,keepCurrentModifiedModel:i=!1,theme:c="light",loading:d="Loading...",options:o={},height:p="100%",width:_="100%",className:S,wrapperProps:g={},beforeMount:n=zt,onMount:f=zt}){let[h,u]=R.useState(!1),[v,x]=R.useState(!0),w=R.useRef(null),k=R.useRef(null),y=R.useRef(null),E=R.useRef(f),j=R.useRef(n),A=R.useRef(!1);Nn(()=>{let I=Ln.init();return I.then(H=>(k.current=H)&&x(!1)).catch(H=>H?.type!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>w.current?B():I.cancel()}),Qe(()=>{if(w.current&&k.current){let I=w.current.getOriginalEditor(),H=Dt(k.current,e||"",l||s||"text",b||"");H!==I.getModel()&&I.setModel(H)}},[b],h),Qe(()=>{if(w.current&&k.current){let I=w.current.getModifiedEditor(),H=Dt(k.current,t||"",m||s||"text",C||"");H!==I.getModel()&&I.setModel(H)}},[C],h),Qe(()=>{let I=w.current.getModifiedEditor();I.getOption(k.current.editor.EditorOption.readOnly)?I.setValue(t||""):t!==I.getValue()&&(I.executeEdits("",[{range:I.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),I.pushUndoStop())},[t],h),Qe(()=>{w.current?.getModel()?.original.setValue(e||"")},[e],h),Qe(()=>{let{original:I,modified:H}=w.current.getModel();k.current.editor.setModelLanguage(I,l||s||"text"),k.current.editor.setModelLanguage(H,m||s||"text")},[s,l,m],h),Qe(()=>{k.current?.editor.setTheme(c)},[c],h),Qe(()=>{w.current?.updateOptions(o)},[o],h);let L=R.useCallback(()=>{if(!k.current)return;j.current(k.current);let I=Dt(k.current,e||"",l||s||"text",b||""),H=Dt(k.current,t||"",m||s||"text",C||"");w.current?.setModel({original:I,modified:H})},[s,t,m,e,l,b,C]),N=R.useCallback(()=>{!A.current&&y.current&&(w.current=k.current.editor.createDiffEditor(y.current,{automaticLayout:!0,...o}),L(),k.current?.editor.setTheme(c),u(!0),A.current=!0)},[o,c,L]);R.useEffect(()=>{h&&E.current(w.current,k.current)},[h]),R.useEffect(()=>{!v&&!h&&N()},[v,h,N]);function B(){let I=w.current?.getModel();r||I?.original?.dispose(),i||I?.modified?.dispose(),w.current?.dispose()}return ee.createElement(An,{width:_,height:p,isEditorReady:h,loading:d,_ref:y,className:S,wrapperProps:g})}var Yh=Xh;R.memo(Yh);function Vh(e){let t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}var Gh=Vh,ls=new Map;function Qh({defaultValue:e,defaultLanguage:t,defaultPath:s,value:l,language:m,path:b,theme:C="light",line:r,loading:i="Loading...",options:c={},overrideServices:d={},saveViewState:o=!0,keepCurrentModel:p=!1,width:_="100%",height:S="100%",className:g,wrapperProps:n={},beforeMount:f=zt,onMount:h=zt,onChange:u,onValidate:v=zt}){let[x,w]=R.useState(!1),[k,y]=R.useState(!0),E=R.useRef(null),j=R.useRef(null),A=R.useRef(null),L=R.useRef(h),N=R.useRef(f),B=R.useRef(),I=R.useRef(l),H=Gh(b),W=R.useRef(!1),D=R.useRef(!1);Nn(()=>{let O=Ln.init();return O.then(U=>(E.current=U)&&y(!1)).catch(U=>U?.type!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>j.current?P():O.cancel()}),Qe(()=>{let O=Dt(E.current,e||l||"",t||m||"",b||s||"");O!==j.current?.getModel()&&(o&&ls.set(H,j.current?.saveViewState()),j.current?.setModel(O),o&&j.current?.restoreViewState(ls.get(b)))},[b],x),Qe(()=>{j.current?.updateOptions(c)},[c],x),Qe(()=>{!j.current||l===void 0||(j.current.getOption(E.current.editor.EditorOption.readOnly)?j.current.setValue(l):l!==j.current.getValue()&&(D.current=!0,j.current.executeEdits("",[{range:j.current.getModel().getFullModelRange(),text:l,forceMoveMarkers:!0}]),j.current.pushUndoStop(),D.current=!1))},[l],x),Qe(()=>{let O=j.current?.getModel();O&&m&&E.current?.editor.setModelLanguage(O,m)},[m],x),Qe(()=>{r!==void 0&&j.current?.revealLine(r)},[r],x),Qe(()=>{E.current?.editor.setTheme(C)},[C],x);let M=R.useCallback(()=>{if(!(!A.current||!E.current)&&!W.current){N.current(E.current);let O=b||s,U=Dt(E.current,l||e||"",t||m||"",O||"");j.current=E.current?.editor.create(A.current,{model:U,automaticLayout:!0,...c},d),o&&j.current.restoreViewState(ls.get(O)),E.current.editor.setTheme(C),r!==void 0&&j.current.revealLine(r),w(!0),W.current=!0}},[e,t,s,l,m,b,c,d,o,C,r]);R.useEffect(()=>{x&&L.current(j.current,E.current)},[x]),R.useEffect(()=>{!k&&!x&&M()},[k,x,M]),I.current=l,R.useEffect(()=>{x&&u&&(B.current?.dispose(),B.current=j.current?.onDidChangeModelContent(O=>{D.current||u(j.current.getValue(),O)}))},[x,u]),R.useEffect(()=>{if(x){let O=E.current.editor.onDidChangeMarkers(U=>{let K=j.current.getModel()?.uri;if(K&&U.find(V=>V.path===K.path)){let V=E.current.editor.getModelMarkers({resource:K});v?.(V)}});return()=>{O?.dispose()}}return()=>{}},[x,v]);function P(){B.current?.dispose(),p?o&&ls.set(b,j.current.saveViewState()):j.current.getModel()?.dispose(),j.current.dispose()}return ee.createElement(An,{width:_,height:S,isEditorReady:x,loading:i,_ref:A,className:g,wrapperProps:n})}var Zh=Qh,Jh=R.memo(Zh),eu=Jh,Je=function(e,t){return Number(e.toFixed(t))},tu=function(e,t){return typeof e=="number"?e:t},De=function(e,t,s){s&&typeof s=="function"&&s(e,t)},su=function(e){return-Math.cos(e*Math.PI)/2+.5},ru=function(e){return e},iu=function(e){return e*e},nu=function(e){return e*(2-e)},ou=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},au=function(e){return e*e*e},lu=function(e){return--e*e*e+1},cu=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},hu=function(e){return e*e*e*e},uu=function(e){return 1- --e*e*e*e},du=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},fu=function(e){return e*e*e*e*e},pu=function(e){return 1+--e*e*e*e*e},mu=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},Pn={easeOut:su,linear:ru,easeInQuad:iu,easeOutQuad:nu,easeInOutQuad:ou,easeInCubic:au,easeOutCubic:lu,easeInOutCubic:cu,easeInQuart:hu,easeOutQuart:uu,easeInOutQuart:du,easeInQuint:fu,easeOutQuint:pu,easeInOutQuint:mu},On=function(e){typeof e=="number"&&cancelAnimationFrame(e)},st=function(e){e.mounted&&(On(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function Bn(e,t,s,l){if(e.mounted){var m=new Date().getTime(),b=1;st(e),e.animation=function(){if(!e.mounted)return On(e.animation);var C=new Date().getTime()-m,r=C/s,i=Pn[t],c=i(r);C>=s?(l(b),e.animation=null):e.animation&&(l(c),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function vu(e){var t=e.scale,s=e.positionX,l=e.positionY;return!(Number.isNaN(t)||Number.isNaN(s)||Number.isNaN(l))}function _t(e,t,s,l){var m=vu(t);if(!(!e.mounted||!m)){var b=e.setTransformState,C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY,d=t.scale-r,o=t.positionX-i,p=t.positionY-c;s===0?b(t.scale,t.positionX,t.positionY):Bn(e,l,s,function(_){var S=r+d*_,g=i+o*_,n=c+p*_;b(S,g,n)})}}function gu(e,t,s){var l=e.offsetWidth,m=e.offsetHeight,b=t.offsetWidth,C=t.offsetHeight,r=b*s,i=C*s,c=l-r,d=m-i;return{wrapperWidth:l,wrapperHeight:m,newContentWidth:r,newDiffWidth:c,newContentHeight:i,newDiffHeight:d}}var _u=function(e,t,s,l,m,b,C){var r=e>t?s*(C?1:.5):0,i=l>m?b*(C?1:.5):0,c=e-t-r,d=r,o=l-m-i,p=i;return{minPositionX:c,maxPositionX:d,minPositionY:o,maxPositionY:p}},Tr=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 b=gu(s,l,t),C=b.wrapperWidth,r=b.wrapperHeight,i=b.newContentWidth,c=b.newDiffWidth,d=b.newContentHeight,o=b.newDiffHeight,p=_u(C,i,c,r,d,o,!!m);return p},or=function(e,t,s,l){return l?e<t?Je(t,2):e>s?Je(s,2):Je(e,2):Je(e,2)},wt=function(e,t){var s=Tr(e,t);return e.bounds=s,s};function ts(e,t,s,l,m,b,C){var r=s.minPositionX,i=s.minPositionY,c=s.maxPositionX,d=s.maxPositionY,o=0,p=0;C&&(o=m,p=b);var _=or(e,r-o,c+o,l),S=or(t,i-p,d+p,l);return{x:_,y:S}}function Os(e,t,s,l,m,b){var C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY,d=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*d,p=c-s*d,_=ts(o,p,m,b,0,0,null);return _}function ss(e,t,s,l,m){var b=m?l:0,C=t-b;return!Number.isNaN(s)&&e>=s?s:!Number.isNaN(t)&&e<=C?C:e}var di=function(e,t){var s=e.setup.panning.excluded,l=e.isInitialized,m=e.wrapperComponent,b=t.target,C="shadowRoot"in b&&"composedPath"in t,r=C?t.composedPath().some(function(d){return d instanceof Element?m?.contains(d):!1}):m?.contains(b),i=l&&b&&r;if(!i)return!1;var c=Bs(b,s);return!c},fi=function(e){var t=e.isInitialized,s=e.isPanning,l=e.setup,m=l.panning.disabled,b=t&&s&&!m;return!!b},bu=function(e,t){var s=e.transformState,l=s.positionX,m=s.positionY;e.isPanning=!0;var b=t.clientX,C=t.clientY;e.startCoords={x:b-l,y:C-m}},xu=function(e,t){var s=t.touches,l=e.transformState,m=l.positionX,b=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-b}}};function Su(e){var t=e.transformState,s=t.positionX,l=t.positionY,m=t.scale,b=e.setup,C=b.disabled,r=b.limitToBounds,i=b.centerZoomedOut,c=e.wrapperComponent;if(!(C||!c||!e.bounds)){var d=e.bounds,o=d.maxPositionX,p=d.minPositionX,_=d.maxPositionY,S=d.minPositionY,g=s>o||s<p,n=l>_||l<S,f=s>o?c.offsetWidth:e.setup.minPositionX||0,h=l>_?c.offsetHeight:e.setup.minPositionY||0,u=Os(e,f,h,m,e.bounds,r||i),v=u.x,x=u.y;return{scale:m,positionX:g?v:s,positionY:n?x:l}}}function In(e,t,s,l,m){var b=e.setup.limitToBounds,C=e.wrapperComponent,r=e.bounds,i=e.transformState,c=i.scale,d=i.positionX,o=i.positionY;if(!(C===null||r===null||t===d&&s===o)){var p=ts(t,s,r,b,l,m,C),_=p.x,S=p.y;e.setTransformState(c,_,S)}}var yu=function(e,t,s){var l=e.startCoords,m=e.transformState,b=e.setup.panning,C=b.lockAxisX,r=b.lockAxisY,i=m.positionX,c=m.positionY;if(!l)return{x:i,y:c};var d=t-l.x,o=s-l.y,p=C?i:d,_=r?c:o;return{x:p,y:_}},vt=function(e,t){var s=e.setup,l=e.transformState,m=l.scale,b=s.minScale,C=s.disablePadding;return t>0&&m>=b&&!C?t:0},Cu=function(e){var t=e.mounted,s=e.setup,l=s.disabled,m=s.velocityAnimation,b=e.transformState.scale,C=m.disabled,r=!C||b>1||!l||t;return!!r},wu=function(e){var t=e.mounted,s=e.velocity,l=e.bounds,m=e.setup,b=m.disabled,C=m.velocityAnimation,r=e.transformState.scale,i=C.disabled,c=!i||r>1||!b||t;return!(!c||!s||!l)};function Eu(e,t){var s=e.setup.velocityAnimation,l=s.equalToMove,m=s.animationTime,b=s.sensitivity;return l?m*t*b:m}function pi(e,t,s,l,m,b,C,r,i,c){if(m){if(t>C&&s>C){var d=C+(e-C)*c;return d>i?i:d<C?C:d}if(t<b&&s<b){var d=b+(e-b)*c;return d<r?r:d>b?b:d}}return l?t:or(e,b,C,m)}function ku(e,t){var s=1;return t?Math.min(s,e.offsetWidth/window.innerWidth):s}function Ru(e,t){var s=Cu(e);if(s){var l=e.lastMousePosition,m=e.velocityTime,b=e.setup,C=e.wrapperComponent,r=b.velocityAnimation.equalToMove,i=Date.now();if(l&&m&&C){var c=ku(C,r),d=t.x-l.x,o=t.y-l.y,p=d/c,_=o/c,S=i-m,g=d*d+o*o,n=Math.sqrt(g)/S;e.velocity={velocityX:p,velocityY:_,total:n}}e.lastMousePosition=t,e.velocityTime=i}}function Du(e){var t=e.velocity,s=e.bounds,l=e.setup,m=e.wrapperComponent,b=wu(e);if(!(!b||!t||!s||!m)){var C=t.velocityX,r=t.velocityY,i=t.total,c=s.maxPositionX,d=s.minPositionX,o=s.maxPositionY,p=s.minPositionY,_=l.limitToBounds,S=l.alignmentAnimation,g=l.zoomAnimation,n=l.panning,f=n.lockAxisY,h=n.lockAxisX,u=g.animationType,v=S.sizeX,x=S.sizeY,w=S.velocityAlignmentTime,k=w,y=Eu(e,i),E=Math.max(y,k),j=vt(e,v),A=vt(e,x),L=j*m.offsetWidth/100,N=A*m.offsetHeight/100,B=c+L,I=d-L,H=o+N,W=p-N,D=e.transformState,M=new Date().getTime();Bn(e,u,E,function(P){var O=e.transformState,U=O.scale,K=O.positionX,V=O.positionY,Y=new Date().getTime()-M,ie=Y/k,T=Pn[S.animationType],F=1-T(Math.min(1,ie)),$=1-P,z=K+C*$,J=V+r*$,X=pi(z,D.positionX,K,h,_,d,c,I,B,F),oe=pi(J,D.positionY,V,f,_,p,o,W,H,F);(K!==z||V!==J)&&e.setTransformState(U,X,oe)})}}function mi(e,t){var s=e.transformState.scale;st(e),wt(e,s),window.TouchEvent!==void 0&&t instanceof TouchEvent?xu(e,t):bu(e,t)}function jr(e,t){var s=e.transformState.scale,l=e.setup,m=l.minScale,b=l.alignmentAnimation,C=b.disabled,r=b.sizeX,i=b.sizeY,c=b.animationTime,d=b.animationType,o=C||s<m||!r&&!i;if(!o){var p=Su(e);p&&_t(e,p,t??c,d)}}function vi(e,t,s){var l=e.startCoords,m=e.setup,b=m.alignmentAnimation,C=b.sizeX,r=b.sizeY;if(l){var i=yu(e,t,s),c=i.x,d=i.y,o=vt(e,C),p=vt(e,r);Ru(e,{x:c,y:d}),In(e,c,d,o,p)}}function Tu(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 b=l?.getBoundingClientRect(),C=m?.getBoundingClientRect(),r=b?.width||0,i=b?.height||0,c=C?.width||0,d=C?.height||0,o=r<c||i<d,p=!t&&s&&s?.total>.1&&o;p?Du(e):jr(e)}}function Lr(e,t,s,l){var m=e.setup,b=m.minScale,C=m.maxScale,r=m.limitToBounds,i=ss(Je(t,2),b,C,0,!1),c=wt(e,i),d=Os(e,s,l,i,c,r),o=d.x,p=d.y;return{scale:i,positionX:o,positionY:p}}function Fn(e,t,s){var l=e.transformState.scale,m=e.wrapperComponent,b=e.setup,C=b.minScale,r=b.limitToBounds,i=b.zoomAnimation,c=i.disabled,d=i.animationTime,o=i.animationType,p=c||l>=C;if((l>=1||r)&&jr(e),!(p||!m||!e.mounted)){var _=t||m.offsetWidth/2,S=s||m.offsetHeight/2,g=Lr(e,C,_,S);g&&_t(e,g,d,o)}}var mt=function(){return mt=Object.assign||function(t){for(var s,l=1,m=arguments.length;l<m;l++){s=arguments[l];for(var b in s)Object.prototype.hasOwnProperty.call(s,b)&&(t[b]=s[b])}return t},mt.apply(this,arguments)};function gi(e,t,s){for(var l=0,m=t.length,b;l<m;l++)(b||!(l in t))&&(b||(b=Array.prototype.slice.call(t,0,l)),b[l]=t[l]);return e.concat(b||Array.prototype.slice.call(t))}var cs={scale:1,positionX:0,positionY:0},Pt={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}},ar={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},Hn=function(e){var t,s,l,m;return{previousScale:(t=e.initialScale)!==null&&t!==void 0?t:cs.scale,scale:(s=e.initialScale)!==null&&s!==void 0?s:cs.scale,positionX:(l=e.initialPositionX)!==null&&l!==void 0?l:cs.positionX,positionY:(m=e.initialPositionY)!==null&&m!==void 0?m:cs.positionY}},_i=function(e){var t=mt({},Pt);return Object.keys(e).forEach(function(s){var l=typeof e[s]<"u",m=typeof Pt[s]<"u";if(m&&l){var b=Object.prototype.toString.call(Pt[s]),C=b==="[object Object]",r=b==="[object Array]";C?t[s]=mt(mt({},Pt[s]),e[s]):r?t[s]=gi(gi([],Pt[s],!0),e[s]):t[s]=e[s]}}),t},zn=function(e,t,s){var l=e.transformState.scale,m=e.wrapperComponent,b=e.setup,C=b.maxScale,r=b.minScale,i=b.zoomAnimation,c=b.smooth,d=i.size;if(!m)throw new Error("Wrapper is not mounted");var o=c?l*Math.exp(t*s):l+t*s,p=ss(Je(o,3),r,C,d,!1);return p};function Wn(e,t,s,l,m){var b=e.wrapperComponent,C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY;if(!b)return console.error("No WrapperComponent found");var d=b.offsetWidth,o=b.offsetHeight,p=(d/2-i)/r,_=(o/2-c)/r,S=zn(e,t,s),g=Lr(e,S,p,_);if(!g)return console.error("Error during zoom event. New transformation state was not calculated.");_t(e,g,l,m)}function $n(e,t,s,l){var m=e.setup,b=e.wrapperComponent,C=m.limitToBounds,r=Hn(e.props),i=e.transformState,c=i.scale,d=i.positionX,o=i.positionY;if(b){var p=Tr(e,r.scale),_=ts(r.positionX,r.positionY,p,C,0,0,b),S={scale:r.scale,positionX:_.x,positionY:_.y};c===r.scale&&d===r.positionX&&o===r.positionY||(l?.(),_t(e,S,t,s))}}function ju(e,t,s,l){var m=e.getBoundingClientRect(),b=t.getBoundingClientRect(),C=s.getBoundingClientRect(),r=b.x*l.scale,i=b.y*l.scale;return{x:(m.x-C.x+r)/l.scale,y:(m.y-C.y+i)/l.scale}}function Lu(e,t,s){var l=e.wrapperComponent,m=e.contentComponent,b=e.transformState,C=e.setup,r=C.limitToBounds,i=C.minScale,c=C.maxScale;if(!l||!m)return b;var d=l.getBoundingClientRect(),o=t.getBoundingClientRect(),p=ju(t,l,m,b),_=p.x,S=p.y,g=o.width/b.scale,n=o.height/b.scale,f=l.offsetWidth/g,h=l.offsetHeight/n,u=ss(s||Math.min(f,h),i,c,0,!1),v=(d.width-g*u)/2,x=(d.height-n*u)/2,w=(d.left-_)*u+v,k=(d.top-S)*u+x,y=Tr(e,u),E=ts(w,k,y,r,0,0,l),j=E.x,A=E.y;return{positionX:j,positionY:A,scale:u}}var Au=function(e){return function(t,s,l){t===void 0&&(t=.5),s===void 0&&(s=300),l===void 0&&(l="easeOut"),Wn(e,1,t,s,l)}},Nu=function(e){return function(t,s,l){t===void 0&&(t=.5),s===void 0&&(s=300),l===void 0&&(l="easeOut"),Wn(e,-1,t,s,l)}},Mu=function(e){return function(t,s,l,m,b){m===void 0&&(m=300),b===void 0&&(b="easeOut");var C=e.transformState,r=C.positionX,i=C.positionY,c=C.scale,d=e.wrapperComponent,o=e.contentComponent,p=e.setup.disabled;if(!(p||!d||!o)){var _={positionX:Number.isNaN(t)?r:t,positionY:Number.isNaN(s)?i:s,scale:Number.isNaN(l)?c:l};_t(e,_,m,b)}}},Pu=function(e){return function(t,s){t===void 0&&(t=200),s===void 0&&(s="easeOut"),$n(e,t,s)}},Ou=function(e){return function(t,s,l){s===void 0&&(s=200),l===void 0&&(l="easeOut");var m=e.transformState,b=e.wrapperComponent,C=e.contentComponent;if(b&&C){var r=Un(t||m.scale,b,C);_t(e,r,s,l)}}},Bu=function(e){return function(t,s,l,m){l===void 0&&(l=600),m===void 0&&(m="easeOut"),st(e);var b=e.wrapperComponent,C=typeof t=="string"?document.getElementById(t):t;if(b&&C&&b.contains(C)){var r=Lu(e,C,s);_t(e,r,l,m)}}},ys=function(e){return{instance:e,zoomIn:Au(e),zoomOut:Nu(e),setTransform:Mu(e),resetTransform:Pu(e),centerView:Ou(e),zoomToElement:Bu(e)}},lr=function(e){return{instance:e,state:e.transformState}},ke=function(e){var t={};return Object.assign(t,lr(e)),Object.assign(t,ys(e)),t},Gs=!1;function Qs(){try{var e={get passive(){return Gs=!0,!1}};return e}catch{return Gs=!1,Gs}}var hs=".".concat(ar.wrapperClass),Bs=function(e,t){return t.some(function(s){return e.matches("".concat(hs," ").concat(s,", ").concat(hs," .").concat(s,", ").concat(hs," ").concat(s," *, ").concat(hs," .").concat(s," *"))})},cr=function(e){e&&clearTimeout(e)},Iu=function(e,t,s){return"translate(".concat(e,"px, ").concat(t,"px) scale(").concat(s,")")},Un=function(e,t,s){var l=s.offsetWidth*e,m=s.offsetHeight*e,b=(t.offsetWidth-l)/2,C=(t.offsetHeight-m)/2;return{scale:e,positionX:b,positionY:C}};function Fu(e){return function(t){e.forEach(function(s){typeof s=="function"?s(t):s!=null&&(s.current=t)})}}var Hu=function(e,t){var s=e.setup.wheel,l=s.disabled,m=s.wheelDisabled,b=s.touchPadDisabled,C=s.excluded,r=e.isInitialized,i=e.isPanning,c=t.target,d=r&&!i&&!l&&c;if(!d||m&&!t.ctrlKey||b&&t.ctrlKey)return!1;var o=Bs(c,C);return!o},zu=function(e){return e?e.deltaY<0?1:-1:0};function Wu(e,t){var s=zu(e),l=tu(t,s);return l}function qn(e,t,s){var l=t.getBoundingClientRect(),m=0,b=0;if("clientX"in e)m=(e.clientX-l.left)/s,b=(e.clientY-l.top)/s;else{var C=e.touches[0];m=(C.clientX-l.left)/s,b=(C.clientY-l.top)/s}return(Number.isNaN(m)||Number.isNaN(b))&&console.error("No mouse or touch offset found"),{x:m,y:b}}var $u=function(e,t,s,l,m){var b=e.transformState.scale,C=e.wrapperComponent,r=e.setup,i=r.maxScale,c=r.minScale,d=r.zoomAnimation,o=r.disablePadding,p=d.size,_=d.disabled;if(!C)throw new Error("Wrapper is not mounted");var S=b+t*s,g=l?!1:!_,n=ss(Je(S,3),c,i,p,g&&!o);return n},Uu=function(e,t){var s=e.previousWheelEvent,l=e.transformState.scale,m=e.setup,b=m.maxScale,C=m.minScale;return s?l<b||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},qu=function(e,t){var s=e.setup.pinch,l=s.disabled,m=s.excluded,b=e.isInitialized,C=t.target,r=b&&!l&&C;if(!r)return!1;var i=Bs(C,m);return!i},Ku=function(e){var t=e.setup.pinch.disabled,s=e.isInitialized,l=e.pinchStartDistance,m=s&&!t&&l;return!!m},Xu=function(e,t,s){var l=s.getBoundingClientRect(),m=e.touches,b=Je(m[0].clientX-l.left,5),C=Je(m[0].clientY-l.top,5),r=Je(m[1].clientX-l.left,5),i=Je(m[1].clientY-l.top,5);return{x:(b+r)/2/t,y:(C+i)/2/t}},Kn=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))},Yu=function(e,t){var s=e.pinchStartScale,l=e.pinchStartDistance,m=e.setup,b=m.maxScale,C=m.minScale,r=m.zoomAnimation,i=m.disablePadding,c=r.size,d=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 ss(Je(p,2),C,b,c,!d&&!i)},Vu=160,Gu=100,Qu=function(e,t){var s=e.props,l=s.onWheelStart,m=s.onZoomStart;e.wheelStopEventTimer||(st(e),De(ke(e),t,l),De(ke(e),t,m))},Zu=function(e,t){var s=e.props,l=s.onWheel,m=s.onZoom,b=e.contentComponent,C=e.setup,r=e.transformState,i=r.scale,c=C.limitToBounds,d=C.centerZoomedOut,o=C.zoomAnimation,p=C.wheel,_=C.disablePadding,S=C.smooth,g=o.size,n=o.disabled,f=p.step,h=p.smoothStep;if(!b)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var u=Wu(t,null),v=S?h*Math.abs(t.deltaY):f,x=$u(e,u,v,!t.ctrlKey);if(i!==x){var w=wt(e,x),k=qn(t,b,i),y=n||g===0||d||_,E=c&&y,j=Os(e,k.x,k.y,x,w,E),A=j.x,L=j.y;e.previousWheelEvent=t,e.setTransformState(x,A,L),De(ke(e),t,l),De(ke(e),t,m)}},Ju=function(e,t){var s=e.props,l=s.onWheelStop,m=s.onZoomStop;cr(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(Fn(e,t.x,t.y),e.wheelAnimationTimer=null)},Gu);var b=Uu(e,t);b&&(cr(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,De(ke(e),t,l),De(ke(e),t,m))},Vu))},Xn=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,b=s/2;return{x:m,y:b}},ed=function(e,t){var s=Kn(t);e.pinchStartDistance=s,e.lastDistance=s,e.pinchStartScale=e.transformState.scale,e.isPanning=!1;var l=Xn(t);e.pinchLastCenterX=l.x,e.pinchLastCenterY=l.y,st(e)},td=function(e,t){var s=e.contentComponent,l=e.pinchStartDistance,m=e.wrapperComponent,b=e.transformState.scale,C=e.setup,r=C.limitToBounds,i=C.centerZoomedOut,c=C.zoomAnimation,d=C.alignmentAnimation,o=c.disabled,p=c.size;if(!(l===null||!s)){var _=Xu(t,b,s);if(!(!Number.isFinite(_.x)||!Number.isFinite(_.y))){var S=Kn(t),g=Yu(e,S),n=Xn(t),f=n.x-(e.pinchLastCenterX||0),h=n.y-(e.pinchLastCenterY||0);if(!(g===b&&f===0&&h===0)){e.pinchLastCenterX=n.x,e.pinchLastCenterY=n.y;var u=wt(e,g),v=o||p===0||i,x=r&&v,w=Os(e,_.x,_.y,g,u,x),k=w.x,y=w.y;e.pinchMidpoint=_,e.lastDistance=S;var E=d.sizeX,j=d.sizeY,A=vt(e,E),L=vt(e,j),N=k+f,B=y+h,I=ts(N,B,u,r,A,L,m),H=I.x,W=I.y;e.setTransformState(g,H,W)}}}},sd=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,Fn(e,t?.x,t?.y)},Yn=function(e,t){var s=e.props.onZoomStop,l=e.setup.doubleClick.animationTime;cr(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,De(ke(e),t,s)},l)},rd=function(e,t){var s=e.props,l=s.onZoomStart,m=s.onZoom,b=e.setup.doubleClick,C=b.animationTime,r=b.animationType;De(ke(e),t,l),$n(e,C,r,function(){return De(ke(e),t,m)}),Yn(e,t)};function id(e,t){return e==="toggle"?t===1?1:-1:e==="zoomOut"?-1:1}function nd(e,t){var s=e.setup,l=e.doubleClickStopEventTimer,m=e.transformState,b=e.contentComponent,C=m.scale,r=e.props,i=r.onZoomStart,c=r.onZoom,d=s.doubleClick,o=d.disabled,p=d.mode,_=d.step,S=d.animationTime,g=d.animationType;if(!o&&!l){if(p==="reset")return rd(e,t);if(!b)return console.error("No ContentComponent found");var n=id(p,e.transformState.scale),f=zn(e,n,_);if(C!==f){De(ke(e),t,i);var h=qn(t,b,C),u=Lr(e,f,h.x,h.y);if(!u)return console.error("Error during zoom event. New transformation state was not calculated.");De(ke(e),t,c),_t(e,u,S,g),Yn(e,t)}}}var od=function(e,t){var s=e.isInitialized,l=e.setup,m=e.wrapperComponent,b=l.doubleClick,C=b.disabled,r=b.excluded,i=t.target,c=m?.contains(i),d=s&&i&&c&&!C;if(!d)return!1;var o=Bs(i,r);return!o},ad=(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,wt(s,s.transformState.scale),s.setup=_i(l)},this.initializeWindowEvents=function(){var l,m,b=Qs(),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,b),r?.addEventListener("mousedown",s.onPanningStart,b),r?.addEventListener("mousemove",s.onPanning,b),r?.addEventListener("mouseup",s.onPanningStop,b),C?.addEventListener("mouseleave",s.clearPanning,b),r?.addEventListener("keyup",s.setKeyUnPressed,b),r?.addEventListener("keydown",s.setKeyPressed,b)},this.cleanupWindowEvents=function(){var l,m,b=Qs(),C=(l=s.wrapperComponent)===null||l===void 0?void 0:l.ownerDocument,r=C?.defaultView;r?.removeEventListener("mousedown",s.onPanningStart,b),r?.removeEventListener("mousemove",s.onPanning,b),r?.removeEventListener("mouseup",s.onPanningStop,b),C?.removeEventListener("mouseleave",s.clearPanning,b),r?.removeEventListener("keyup",s.setKeyUnPressed,b),r?.removeEventListener("keydown",s.setKeyPressed,b),document.removeEventListener("mouseleave",s.clearPanning,b),st(s),(m=s.observer)===null||m===void 0||m.disconnect()},this.handleInitializeWrapperEvents=function(l){var m=Qs();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 b=!1,C=s.setup.centerOnInit,r=function(i,c){for(var d=0,o=i;d<o.length;d++){var p=o[d];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&&!b){var c=m.offsetWidth,d=m.offsetHeight;(c>0||d>0)&&(b=!0,s.setCenter())}else st(s),wt(s,s.transformState.scale),jr(s,0)}),s.observer.observe(l),s.observer.observe(m)},this.onWheelZoom=function(l){var m=s.setup.disabled;if(!m){var b=Hu(s,l);if(b){var C=s.isPressingKeys(s.setup.wheel.activationKeys);C&&(Qu(s,l),Zu(s,l),Ju(s,l))}}},this.onWheelPanning=function(l){var m=s.setup,b=m.disabled,C=m.wheel,r=m.panning;if(!(!s.wrapperComponent||!s.contentComponent||b||!C.wheelDisabled||r.disabled||!r.wheelPanning||l.ctrlKey)){l.preventDefault(),l.stopPropagation();var i=s.transformState,c=i.positionX,d=i.positionY,o=c-l.deltaX,p=d-l.deltaY,_=r.lockAxisX?c:o,S=r.lockAxisY?d:p,g=s.setup.alignmentAnimation,n=g.sizeX,f=g.sizeY,h=vt(s,n),u=vt(s,f);_===c&&S===d||In(s,_,S,h,u)}},this.onPanningStart=function(l){var m=s.setup.disabled,b=s.props.onPanningStart;if(!m){var C=di(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(),st(s),mi(s,l),De(ke(s),l,b)))}}},this.onPanning=function(l){var m=s.setup.disabled,b=s.props.onPanning;if(!m){var C=fi(s);if(C){var r=s.isPressingKeys(s.setup.panning.activationKeys);r&&(l.preventDefault(),l.stopPropagation(),vi(s,l.clientX,l.clientY),De(ke(s),l,b))}}},this.onPanningStop=function(l){var m=s.props.onPanningStop;s.isPanning&&(Tu(s),De(ke(s),l,m))},this.onPinchStart=function(l){var m=s.setup.disabled,b=s.props,C=b.onPinchingStart,r=b.onZoomStart;if(!m){var i=qu(s,l);i&&(ed(s,l),st(s),De(ke(s),l,C),De(ke(s),l,r))}},this.onPinch=function(l){var m=s.setup.disabled,b=s.props,C=b.onPinching,r=b.onZoom;if(!m){var i=Ku(s);i&&(l.preventDefault(),l.stopPropagation(),td(s,l),De(ke(s),l,C),De(ke(s),l,r))}},this.onPinchStop=function(l){var m=s.props,b=m.onPinchingStop,C=m.onZoomStop;s.pinchStartScale&&(sd(s),De(ke(s),l,b),De(ke(s),l,C))},this.onTouchPanningStart=function(l){var m=s.setup.disabled,b=s.props.onPanningStart;if(!m){var C=di(s,l);if(C){var r=s.lastTouch&&+new Date-s.lastTouch<200&&l.touches.length===1;if(!r){s.lastTouch=+new Date,st(s);var i=l.touches,c=i.length===1,d=i.length===2;c&&(st(s),mi(s,l),De(ke(s),l,b)),d&&s.onPinchStart(l)}}}},this.onTouchPanning=function(l){var m=s.setup.disabled,b=s.props.onPanning;if(s.isPanning&&l.touches.length===1){if(m)return;var C=fi(s);if(!C)return;l.preventDefault(),l.stopPropagation();var r=l.touches[0];vi(s,r.clientX,r.clientY),De(ke(s),l,b)}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 b=od(s,l);b&&nd(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,b){var C=s.props.onTransformed;if(!Number.isNaN(l)&&!Number.isNaN(m)&&!Number.isNaN(b)){l!==s.transformState.scale&&(s.transformState.previousScale=s.transformState.scale,s.transformState.scale=l),s.transformState.positionX=m,s.transformState.positionY=b,s.applyTransformation();var r=ke(s);s.onChangeCallbacks.forEach(function(i){return i(r)}),De(r,{scale:l,positionX:m,positionY:b},C)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(s.wrapperComponent&&s.contentComponent){var l=Un(s.transformState.scale,s.wrapperComponent,s.contentComponent);s.setTransformState(l.scale,l.positionX,l.positionY)}},this.handleTransformStyles=function(l,m,b){return s.props.customTransform?s.props.customTransform(l,m,b):Iu(l,m,b)},this.applyTransformation=function(){if(!(!s.mounted||!s.contentComponent)){var l=s.transformState,m=l.scale,b=l.positionX,C=l.positionY,r=s.handleTransformStyles(b,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,wt(s,s.transformState.scale),s.handleInitializeWrapperEvents(l),s.handleInitialize(l,m),s.initializeWindowEvents(),s.isInitialized=!0;var b=ke(s);De(b,void 0,s.props.onInit)},this.props=t,this.setup=_i(this.props),this.transformState=Hn(this.props)}return e})(),Is=ee.createContext(null),ld=function(e,t){return typeof e=="function"?e(t):e},cd=ee.forwardRef(function(e,t){var s=R.useRef(new ad(e)).current,l=ld(e.children,ys(s));return R.useImperativeHandle(t,function(){return ys(s)},[s]),R.useEffect(function(){s.update(e)},[s,e]),ee.createElement(Is.Provider,{value:s},l)});ee.forwardRef(function(e,t){var s=R.useRef(null),l=R.useContext(Is);return R.useEffect(function(){return l.onChange(function(m){if(s.current){var b=0,C=0;s.current.style.transform=l.handleTransformStyles(b,C,1/m.instance.transformState.scale)}})},[l]),ee.createElement("div",mt({},e,{ref:Fu([s,t])}))});function hd(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 ud=`.transform-component-module_wrapper__SPB86 {
|
|
31
|
+
`},fi=bh(Ch)(kn),wh={config:Sh},Eh=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(b,C){return C(b)},m)}};function Rn(e,t){return Object.keys(t).forEach(function(s){t[s]instanceof Object&&e[s]&&Object.assign(t[s],Rn(e[s],t[s]))}),hi(hi({},e),t)}var kh={type:"cancelation",msg:"operation is manually canceled"};function Ys(e){var t=!1,s=new Promise(function(l,m){e.then(function(b){return t?m(kh):l(b)}),e.catch(m)});return s.cancel=function(){return t=!0},s}var Rh=["monaco"],Dh=gh.create({config:_h,isInitialized:!1,resolve:null,reject:null,monaco:null}),Dn=Jc(Dh,2),rs=Dn[0],Bs=Dn[1];function jh(e){var t=wh.config(e),s=t.monaco,l=Qc(t,Rh);Bs(function(m){return{config:Rn(m.config,l),monaco:s}})}function Th(){var e=rs(function(t){var s=t.monaco,l=t.isInitialized,m=t.resolve;return{monaco:s,isInitialized:l,resolve:m}});if(!e.isInitialized){if(Bs({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Ys(Vs);if(window.monaco&&window.monaco.editor)return jn(window.monaco),e.resolve(window.monaco),Ys(Vs);Eh(Lh,Nh)(Mh)}return Ys(Vs)}function Lh(e){return document.body.appendChild(e)}function Ah(e){var t=document.createElement("script");return e&&(t.src=e),t}function Nh(e){var t=rs(function(l){var m=l.config,b=l.reject;return{config:m,reject:b}}),s=Ah("".concat(t.config.paths.vs,"/loader.js"));return s.onload=function(){return e()},s.onerror=t.reject,s}function Mh(){var e=rs(function(s){var l=s.config,m=s.resolve,b=s.reject;return{config:l,resolve:m,reject:b}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(s){var l=s.m||s;jn(l),e.resolve(l)},function(s){e.reject(s)})}function jn(e){rs().monaco||Bs({monaco:e})}function Ph(){return rs(function(e){var t=e.monaco;return t})}var Vs=new Promise(function(e,t){return Bs({resolve:e,reject:t})}),Tn={config:jh,init:Th,__getMonacoInstance:Ph},Oh={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Gs=Oh,Bh={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Ih=Bh;function Fh({children:e}){return ee.createElement("div",{style:Ih.container},e)}var Hh=Fh,zh=Hh;function Wh({width:e,height:t,isEditorReady:s,loading:l,_ref:m,className:b,wrapperProps:C}){return ee.createElement("section",{style:{...Gs.wrapper,width:e,height:t},...C},!s&&ee.createElement(zh,null,l),ee.createElement("div",{ref:m,style:{...Gs.fullWidth,...!s&&Gs.hide},className:b}))}var $h=Wh,Ln=R.memo($h);function Uh(e){R.useEffect(e,[])}var An=Uh;function qh(e,t,s=!0){let l=R.useRef(!0);R.useEffect(l.current||!s?()=>{l.current=!1}:e,t)}var Ge=qh;function $t(){}function jt(e,t,s,l){return Kh(e,l)||Xh(e,t,s,l)}function Kh(e,t){return e.editor.getModel(Nn(e,t))}function Xh(e,t,s,l){return e.editor.createModel(t,s,l?Nn(e,l):void 0)}function Nn(e,t){return e.Uri.parse(t)}function Yh({original:e,modified:t,language:s,originalLanguage:l,modifiedLanguage:m,originalModelPath:b,modifiedModelPath:C,keepCurrentOriginalModel:r=!1,keepCurrentModifiedModel:i=!1,theme:c="light",loading:d="Loading...",options:o={},height:p="100%",width:_="100%",className:y,wrapperProps:g={},beforeMount:n=$t,onMount:f=$t}){let[h,u]=R.useState(!1),[v,x]=R.useState(!0),w=R.useRef(null),k=R.useRef(null),S=R.useRef(null),E=R.useRef(f),T=R.useRef(n),A=R.useRef(!1);An(()=>{let I=Tn.init();return I.then(H=>(k.current=H)&&x(!1)).catch(H=>H?.type!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>w.current?B():I.cancel()}),Ge(()=>{if(w.current&&k.current){let I=w.current.getOriginalEditor(),H=jt(k.current,e||"",l||s||"text",b||"");H!==I.getModel()&&I.setModel(H)}},[b],h),Ge(()=>{if(w.current&&k.current){let I=w.current.getModifiedEditor(),H=jt(k.current,t||"",m||s||"text",C||"");H!==I.getModel()&&I.setModel(H)}},[C],h),Ge(()=>{let I=w.current.getModifiedEditor();I.getOption(k.current.editor.EditorOption.readOnly)?I.setValue(t||""):t!==I.getValue()&&(I.executeEdits("",[{range:I.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),I.pushUndoStop())},[t],h),Ge(()=>{w.current?.getModel()?.original.setValue(e||"")},[e],h),Ge(()=>{let{original:I,modified:H}=w.current.getModel();k.current.editor.setModelLanguage(I,l||s||"text"),k.current.editor.setModelLanguage(H,m||s||"text")},[s,l,m],h),Ge(()=>{k.current?.editor.setTheme(c)},[c],h),Ge(()=>{w.current?.updateOptions(o)},[o],h);let L=R.useCallback(()=>{if(!k.current)return;T.current(k.current);let I=jt(k.current,e||"",l||s||"text",b||""),H=jt(k.current,t||"",m||s||"text",C||"");w.current?.setModel({original:I,modified:H})},[s,t,m,e,l,b,C]),M=R.useCallback(()=>{!A.current&&S.current&&(w.current=k.current.editor.createDiffEditor(S.current,{automaticLayout:!0,...o}),L(),k.current?.editor.setTheme(c),u(!0),A.current=!0)},[o,c,L]);R.useEffect(()=>{h&&E.current(w.current,k.current)},[h]),R.useEffect(()=>{!v&&!h&&M()},[v,h,M]);function B(){let I=w.current?.getModel();r||I?.original?.dispose(),i||I?.modified?.dispose(),w.current?.dispose()}return ee.createElement(Ln,{width:_,height:p,isEditorReady:h,loading:d,_ref:S,className:y,wrapperProps:g})}var Vh=Yh;R.memo(Vh);function Gh(e){let t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}var Qh=Gh,hs=new Map;function Zh({defaultValue:e,defaultLanguage:t,defaultPath:s,value:l,language:m,path:b,theme:C="light",line:r,loading:i="Loading...",options:c={},overrideServices:d={},saveViewState:o=!0,keepCurrentModel:p=!1,width:_="100%",height:y="100%",className:g,wrapperProps:n={},beforeMount:f=$t,onMount:h=$t,onChange:u,onValidate:v=$t}){let[x,w]=R.useState(!1),[k,S]=R.useState(!0),E=R.useRef(null),T=R.useRef(null),A=R.useRef(null),L=R.useRef(h),M=R.useRef(f),B=R.useRef(),I=R.useRef(l),H=Qh(b),W=R.useRef(!1),D=R.useRef(!1);An(()=>{let O=Tn.init();return O.then(U=>(E.current=U)&&S(!1)).catch(U=>U?.type!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>T.current?P():O.cancel()}),Ge(()=>{let O=jt(E.current,e||l||"",t||m||"",b||s||"");O!==T.current?.getModel()&&(o&&hs.set(H,T.current?.saveViewState()),T.current?.setModel(O),o&&T.current?.restoreViewState(hs.get(b)))},[b],x),Ge(()=>{T.current?.updateOptions(c)},[c],x),Ge(()=>{!T.current||l===void 0||(T.current.getOption(E.current.editor.EditorOption.readOnly)?T.current.setValue(l):l!==T.current.getValue()&&(D.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:l,forceMoveMarkers:!0}]),T.current.pushUndoStop(),D.current=!1))},[l],x),Ge(()=>{let O=T.current?.getModel();O&&m&&E.current?.editor.setModelLanguage(O,m)},[m],x),Ge(()=>{r!==void 0&&T.current?.revealLine(r)},[r],x),Ge(()=>{E.current?.editor.setTheme(C)},[C],x);let N=R.useCallback(()=>{if(!(!A.current||!E.current)&&!W.current){M.current(E.current);let O=b||s,U=jt(E.current,l||e||"",t||m||"",O||"");T.current=E.current?.editor.create(A.current,{model:U,automaticLayout:!0,...c},d),o&&T.current.restoreViewState(hs.get(O)),E.current.editor.setTheme(C),r!==void 0&&T.current.revealLine(r),w(!0),W.current=!0}},[e,t,s,l,m,b,c,d,o,C,r]);R.useEffect(()=>{x&&L.current(T.current,E.current)},[x]),R.useEffect(()=>{!k&&!x&&N()},[k,x,N]),I.current=l,R.useEffect(()=>{x&&u&&(B.current?.dispose(),B.current=T.current?.onDidChangeModelContent(O=>{D.current||u(T.current.getValue(),O)}))},[x,u]),R.useEffect(()=>{if(x){let O=E.current.editor.onDidChangeMarkers(U=>{let X=T.current.getModel()?.uri;if(X&&U.find(V=>V.path===X.path)){let V=E.current.editor.getModelMarkers({resource:X});v?.(V)}});return()=>{O?.dispose()}}return()=>{}},[x,v]);function P(){B.current?.dispose(),p?o&&hs.set(b,T.current.saveViewState()):T.current.getModel()?.dispose(),T.current.dispose()}return ee.createElement(Ln,{width:_,height:y,isEditorReady:x,loading:i,_ref:A,className:g,wrapperProps:n})}var Jh=Zh,eu=R.memo(Jh),tu=eu,tt=function(e,t){return Number(e.toFixed(t))},su=function(e,t){return typeof e=="number"?e:t},Re=function(e,t,s){s&&typeof s=="function"&&s(e,t)},ru=function(e){return-Math.cos(e*Math.PI)/2+.5},iu=function(e){return e},nu=function(e){return e*e},ou=function(e){return e*(2-e)},au=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},lu=function(e){return e*e*e},cu=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},uu=function(e){return e*e*e*e},du=function(e){return 1- --e*e*e*e},fu=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},pu=function(e){return e*e*e*e*e},mu=function(e){return 1+--e*e*e*e*e},vu=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},Mn={easeOut:ru,linear:iu,easeInQuad:nu,easeOutQuad:ou,easeInOutQuad:au,easeInCubic:lu,easeOutCubic:cu,easeInOutCubic:hu,easeInQuart:uu,easeOutQuart:du,easeInOutQuart:fu,easeInQuint:pu,easeOutQuint:mu,easeInOutQuint:vu},Pn=function(e){typeof e=="number"&&cancelAnimationFrame(e)},rt=function(e){e.mounted&&(Pn(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function On(e,t,s,l){if(e.mounted){var m=new Date().getTime(),b=1;rt(e),e.animation=function(){if(!e.mounted)return Pn(e.animation);var C=new Date().getTime()-m,r=C/s,i=Mn[t],c=i(r);C>=s?(l(b),e.animation=null):e.animation&&(l(c),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function gu(e){var t=e.scale,s=e.positionX,l=e.positionY;return!(Number.isNaN(t)||Number.isNaN(s)||Number.isNaN(l))}function xt(e,t,s,l){var m=gu(t);if(!(!e.mounted||!m)){var b=e.setTransformState,C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY,d=t.scale-r,o=t.positionX-i,p=t.positionY-c;s===0?b(t.scale,t.positionX,t.positionY):On(e,l,s,function(_){var y=r+d*_,g=i+o*_,n=c+p*_;b(y,g,n)})}}function _u(e,t,s){var l=e.offsetWidth,m=e.offsetHeight,b=t.offsetWidth,C=t.offsetHeight,r=b*s,i=C*s,c=l-r,d=m-i;return{wrapperWidth:l,wrapperHeight:m,newContentWidth:r,newDiffWidth:c,newContentHeight:i,newDiffHeight:d}}var bu=function(e,t,s,l,m,b,C){var r=e>t?s*(C?1:.5):0,i=l>m?b*(C?1:.5):0,c=e-t-r,d=r,o=l-m-i,p=i;return{minPositionX:c,maxPositionX:d,minPositionY:o,maxPositionY:p}},jr=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 b=_u(s,l,t),C=b.wrapperWidth,r=b.wrapperHeight,i=b.newContentWidth,c=b.newDiffWidth,d=b.newContentHeight,o=b.newDiffHeight,p=bu(C,i,c,r,d,o,!!m);return p},ar=function(e,t,s,l){return l?e<t?tt(t,2):e>s?tt(s,2):tt(e,2):tt(e,2)},wt=function(e,t){var s=jr(e,t);return e.bounds=s,s};function is(e,t,s,l,m,b,C){var r=s.minPositionX,i=s.minPositionY,c=s.maxPositionX,d=s.maxPositionY,o=0,p=0;C&&(o=m,p=b);var _=ar(e,r-o,c+o,l),y=ar(t,i-p,d+p,l);return{x:_,y}}function Is(e,t,s,l,m,b){var C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY,d=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*d,p=c-s*d,_=is(o,p,m,b,0,0,null);return _}function ns(e,t,s,l,m){var b=m?l:0,C=t-b;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,b=t.target,C="shadowRoot"in b&&"composedPath"in t,r=C?t.composedPath().some(function(d){return d instanceof Element?m?.contains(d):!1}):m?.contains(b),i=l&&b&&r;if(!i)return!1;var c=Fs(b,s);return!c},mi=function(e){var t=e.isInitialized,s=e.isPanning,l=e.setup,m=l.panning.disabled,b=t&&s&&!m;return!!b},xu=function(e,t){var s=e.transformState,l=s.positionX,m=s.positionY;e.isPanning=!0;var b=t.clientX,C=t.clientY;e.startCoords={x:b-l,y:C-m}},Su=function(e,t){var s=t.touches,l=e.transformState,m=l.positionX,b=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-b}}};function yu(e){var t=e.transformState,s=t.positionX,l=t.positionY,m=t.scale,b=e.setup,C=b.disabled,r=b.limitToBounds,i=b.centerZoomedOut,c=e.wrapperComponent;if(!(C||!c||!e.bounds)){var d=e.bounds,o=d.maxPositionX,p=d.minPositionX,_=d.maxPositionY,y=d.minPositionY,g=s>o||s<p,n=l>_||l<y,f=s>o?c.offsetWidth:e.setup.minPositionX||0,h=l>_?c.offsetHeight:e.setup.minPositionY||0,u=Is(e,f,h,m,e.bounds,r||i),v=u.x,x=u.y;return{scale:m,positionX:g?v:s,positionY:n?x:l}}}function Bn(e,t,s,l,m){var b=e.setup.limitToBounds,C=e.wrapperComponent,r=e.bounds,i=e.transformState,c=i.scale,d=i.positionX,o=i.positionY;if(!(C===null||r===null||t===d&&s===o)){var p=is(t,s,r,b,l,m,C),_=p.x,y=p.y;e.setTransformState(c,_,y)}}var Cu=function(e,t,s){var l=e.startCoords,m=e.transformState,b=e.setup.panning,C=b.lockAxisX,r=b.lockAxisY,i=m.positionX,c=m.positionY;if(!l)return{x:i,y:c};var d=t-l.x,o=s-l.y,p=C?i:d,_=r?c:o;return{x:p,y:_}},bt=function(e,t){var s=e.setup,l=e.transformState,m=l.scale,b=s.minScale,C=s.disablePadding;return t>0&&m>=b&&!C?t:0},wu=function(e){var t=e.mounted,s=e.setup,l=s.disabled,m=s.velocityAnimation,b=e.transformState.scale,C=m.disabled,r=!C||b>1||!l||t;return!!r},Eu=function(e){var t=e.mounted,s=e.velocity,l=e.bounds,m=e.setup,b=m.disabled,C=m.velocityAnimation,r=e.transformState.scale,i=C.disabled,c=!i||r>1||!b||t;return!(!c||!s||!l)};function ku(e,t){var s=e.setup.velocityAnimation,l=s.equalToMove,m=s.animationTime,b=s.sensitivity;return l?m*t*b:m}function vi(e,t,s,l,m,b,C,r,i,c){if(m){if(t>C&&s>C){var d=C+(e-C)*c;return d>i?i:d<C?C:d}if(t<b&&s<b){var d=b+(e-b)*c;return d<r?r:d>b?b:d}}return l?t:ar(e,b,C,m)}function Ru(e,t){var s=1;return t?Math.min(s,e.offsetWidth/window.innerWidth):s}function Du(e,t){var s=wu(e);if(s){var l=e.lastMousePosition,m=e.velocityTime,b=e.setup,C=e.wrapperComponent,r=b.velocityAnimation.equalToMove,i=Date.now();if(l&&m&&C){var c=Ru(C,r),d=t.x-l.x,o=t.y-l.y,p=d/c,_=o/c,y=i-m,g=d*d+o*o,n=Math.sqrt(g)/y;e.velocity={velocityX:p,velocityY:_,total:n}}e.lastMousePosition=t,e.velocityTime=i}}function ju(e){var t=e.velocity,s=e.bounds,l=e.setup,m=e.wrapperComponent,b=Eu(e);if(!(!b||!t||!s||!m)){var C=t.velocityX,r=t.velocityY,i=t.total,c=s.maxPositionX,d=s.minPositionX,o=s.maxPositionY,p=s.minPositionY,_=l.limitToBounds,y=l.alignmentAnimation,g=l.zoomAnimation,n=l.panning,f=n.lockAxisY,h=n.lockAxisX,u=g.animationType,v=y.sizeX,x=y.sizeY,w=y.velocityAlignmentTime,k=w,S=ku(e,i),E=Math.max(S,k),T=bt(e,v),A=bt(e,x),L=T*m.offsetWidth/100,M=A*m.offsetHeight/100,B=c+L,I=d-L,H=o+M,W=p-M,D=e.transformState,N=new Date().getTime();On(e,u,E,function(P){var O=e.transformState,U=O.scale,X=O.positionX,V=O.positionY,Q=new Date().getTime()-N,ae=Q/k,j=Mn[y.animationType],F=1-j(Math.min(1,ae)),$=1-P,z=X+C*$,Z=V+r*$,K=vi(z,D.positionX,X,h,_,d,c,I,B,F),ne=vi(Z,D.positionY,V,f,_,p,o,W,H,F);(X!==z||V!==Z)&&e.setTransformState(U,K,ne)})}}function gi(e,t){var s=e.transformState.scale;rt(e),wt(e,s),window.TouchEvent!==void 0&&t instanceof TouchEvent?Su(e,t):xu(e,t)}function Tr(e,t){var s=e.transformState.scale,l=e.setup,m=l.minScale,b=l.alignmentAnimation,C=b.disabled,r=b.sizeX,i=b.sizeY,c=b.animationTime,d=b.animationType,o=C||s<m||!r&&!i;if(!o){var p=yu(e);p&&xt(e,p,t??c,d)}}function _i(e,t,s){var l=e.startCoords,m=e.setup,b=m.alignmentAnimation,C=b.sizeX,r=b.sizeY;if(l){var i=Cu(e,t,s),c=i.x,d=i.y,o=bt(e,C),p=bt(e,r);Du(e,{x:c,y:d}),Bn(e,c,d,o,p)}}function Tu(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 b=l?.getBoundingClientRect(),C=m?.getBoundingClientRect(),r=b?.width||0,i=b?.height||0,c=C?.width||0,d=C?.height||0,o=r<c||i<d,p=!t&&s&&s?.total>.1&&o;p?ju(e):Tr(e)}}function Lr(e,t,s,l){var m=e.setup,b=m.minScale,C=m.maxScale,r=m.limitToBounds,i=ns(tt(t,2),b,C,0,!1),c=wt(e,i),d=Is(e,s,l,i,c,r),o=d.x,p=d.y;return{scale:i,positionX:o,positionY:p}}function In(e,t,s){var l=e.transformState.scale,m=e.wrapperComponent,b=e.setup,C=b.minScale,r=b.limitToBounds,i=b.zoomAnimation,c=i.disabled,d=i.animationTime,o=i.animationType,p=c||l>=C;if((l>=1||r)&&Tr(e),!(p||!m||!e.mounted)){var _=t||m.offsetWidth/2,y=s||m.offsetHeight/2,g=Lr(e,C,_,y);g&&xt(e,g,d,o)}}var _t=function(){return _t=Object.assign||function(t){for(var s,l=1,m=arguments.length;l<m;l++){s=arguments[l];for(var b in s)Object.prototype.hasOwnProperty.call(s,b)&&(t[b]=s[b])}return t},_t.apply(this,arguments)};function bi(e,t,s){for(var l=0,m=t.length,b;l<m;l++)(b||!(l in t))&&(b||(b=Array.prototype.slice.call(t,0,l)),b[l]=t[l]);return e.concat(b||Array.prototype.slice.call(t))}var us={scale:1,positionX:0,positionY:0},Bt={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}},lr={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},Fn=function(e){var t,s,l,m;return{previousScale:(t=e.initialScale)!==null&&t!==void 0?t:us.scale,scale:(s=e.initialScale)!==null&&s!==void 0?s:us.scale,positionX:(l=e.initialPositionX)!==null&&l!==void 0?l:us.positionX,positionY:(m=e.initialPositionY)!==null&&m!==void 0?m:us.positionY}},xi=function(e){var t=_t({},Bt);return Object.keys(e).forEach(function(s){var l=typeof e[s]<"u",m=typeof Bt[s]<"u";if(m&&l){var b=Object.prototype.toString.call(Bt[s]),C=b==="[object Object]",r=b==="[object Array]";C?t[s]=_t(_t({},Bt[s]),e[s]):r?t[s]=bi(bi([],Bt[s],!0),e[s]):t[s]=e[s]}}),t},Hn=function(e,t,s){var l=e.transformState.scale,m=e.wrapperComponent,b=e.setup,C=b.maxScale,r=b.minScale,i=b.zoomAnimation,c=b.smooth,d=i.size;if(!m)throw new Error("Wrapper is not mounted");var o=c?l*Math.exp(t*s):l+t*s,p=ns(tt(o,3),r,C,d,!1);return p};function zn(e,t,s,l,m){var b=e.wrapperComponent,C=e.transformState,r=C.scale,i=C.positionX,c=C.positionY;if(!b)return console.error("No WrapperComponent found");var d=b.offsetWidth,o=b.offsetHeight,p=(d/2-i)/r,_=(o/2-c)/r,y=Hn(e,t,s),g=Lr(e,y,p,_);if(!g)return console.error("Error during zoom event. New transformation state was not calculated.");xt(e,g,l,m)}function Wn(e,t,s,l){var m=e.setup,b=e.wrapperComponent,C=m.limitToBounds,r=Fn(e.props),i=e.transformState,c=i.scale,d=i.positionX,o=i.positionY;if(b){var p=jr(e,r.scale),_=is(r.positionX,r.positionY,p,C,0,0,b),y={scale:r.scale,positionX:_.x,positionY:_.y};c===r.scale&&d===r.positionX&&o===r.positionY||(l?.(),xt(e,y,t,s))}}function Lu(e,t,s,l){var m=e.getBoundingClientRect(),b=t.getBoundingClientRect(),C=s.getBoundingClientRect(),r=b.x*l.scale,i=b.y*l.scale;return{x:(m.x-C.x+r)/l.scale,y:(m.y-C.y+i)/l.scale}}function Au(e,t,s){var l=e.wrapperComponent,m=e.contentComponent,b=e.transformState,C=e.setup,r=C.limitToBounds,i=C.minScale,c=C.maxScale;if(!l||!m)return b;var d=l.getBoundingClientRect(),o=t.getBoundingClientRect(),p=Lu(t,l,m,b),_=p.x,y=p.y,g=o.width/b.scale,n=o.height/b.scale,f=l.offsetWidth/g,h=l.offsetHeight/n,u=ns(s||Math.min(f,h),i,c,0,!1),v=(d.width-g*u)/2,x=(d.height-n*u)/2,w=(d.left-_)*u+v,k=(d.top-y)*u+x,S=jr(e,u),E=is(w,k,S,r,0,0,l),T=E.x,A=E.y;return{positionX:T,positionY:A,scale:u}}var Nu=function(e){return function(t,s,l){t===void 0&&(t=.5),s===void 0&&(s=300),l===void 0&&(l="easeOut"),zn(e,1,t,s,l)}},Mu=function(e){return function(t,s,l){t===void 0&&(t=.5),s===void 0&&(s=300),l===void 0&&(l="easeOut"),zn(e,-1,t,s,l)}},Pu=function(e){return function(t,s,l,m,b){m===void 0&&(m=300),b===void 0&&(b="easeOut");var C=e.transformState,r=C.positionX,i=C.positionY,c=C.scale,d=e.wrapperComponent,o=e.contentComponent,p=e.setup.disabled;if(!(p||!d||!o)){var _={positionX:Number.isNaN(t)?r:t,positionY:Number.isNaN(s)?i:s,scale:Number.isNaN(l)?c:l};xt(e,_,m,b)}}},Ou=function(e){return function(t,s){t===void 0&&(t=200),s===void 0&&(s="easeOut"),Wn(e,t,s)}},Bu=function(e){return function(t,s,l){s===void 0&&(s=200),l===void 0&&(l="easeOut");var m=e.transformState,b=e.wrapperComponent,C=e.contentComponent;if(b&&C){var r=$n(t||m.scale,b,C);xt(e,r,s,l)}}},Iu=function(e){return function(t,s,l,m){l===void 0&&(l=600),m===void 0&&(m="easeOut"),rt(e);var b=e.wrapperComponent,C=typeof t=="string"?document.getElementById(t):t;if(b&&C&&b.contains(C)){var r=Au(e,C,s);xt(e,r,l,m)}}},Cs=function(e){return{instance:e,zoomIn:Nu(e),zoomOut:Mu(e),setTransform:Pu(e),resetTransform:Ou(e),centerView:Bu(e),zoomToElement:Iu(e)}},cr=function(e){return{instance:e,state:e.transformState}},Ee=function(e){var t={};return Object.assign(t,cr(e)),Object.assign(t,Cs(e)),t},Qs=!1;function Zs(){try{var e={get passive(){return Qs=!0,!1}};return e}catch{return Qs=!1,Qs}}var ds=".".concat(lr.wrapperClass),Fs=function(e,t){return t.some(function(s){return e.matches("".concat(ds," ").concat(s,", ").concat(ds," .").concat(s,", ").concat(ds," ").concat(s," *, ").concat(ds," .").concat(s," *"))})},hr=function(e){e&&clearTimeout(e)},Fu=function(e,t,s){return"translate(".concat(e,"px, ").concat(t,"px) scale(").concat(s,")")},$n=function(e,t,s){var l=s.offsetWidth*e,m=s.offsetHeight*e,b=(t.offsetWidth-l)/2,C=(t.offsetHeight-m)/2;return{scale:e,positionX:b,positionY:C}};function Hu(e){return function(t){e.forEach(function(s){typeof s=="function"?s(t):s!=null&&(s.current=t)})}}var zu=function(e,t){var s=e.setup.wheel,l=s.disabled,m=s.wheelDisabled,b=s.touchPadDisabled,C=s.excluded,r=e.isInitialized,i=e.isPanning,c=t.target,d=r&&!i&&!l&&c;if(!d||m&&!t.ctrlKey||b&&t.ctrlKey)return!1;var o=Fs(c,C);return!o},Wu=function(e){return e?e.deltaY<0?1:-1:0};function $u(e,t){var s=Wu(e),l=su(t,s);return l}function Un(e,t,s){var l=t.getBoundingClientRect(),m=0,b=0;if("clientX"in e)m=(e.clientX-l.left)/s,b=(e.clientY-l.top)/s;else{var C=e.touches[0];m=(C.clientX-l.left)/s,b=(C.clientY-l.top)/s}return(Number.isNaN(m)||Number.isNaN(b))&&console.error("No mouse or touch offset found"),{x:m,y:b}}var Uu=function(e,t,s,l,m){var b=e.transformState.scale,C=e.wrapperComponent,r=e.setup,i=r.maxScale,c=r.minScale,d=r.zoomAnimation,o=r.disablePadding,p=d.size,_=d.disabled;if(!C)throw new Error("Wrapper is not mounted");var y=b+t*s,g=l?!1:!_,n=ns(tt(y,3),c,i,p,g&&!o);return n},qu=function(e,t){var s=e.previousWheelEvent,l=e.transformState.scale,m=e.setup,b=m.maxScale,C=m.minScale;return s?l<b||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},Ku=function(e,t){var s=e.setup.pinch,l=s.disabled,m=s.excluded,b=e.isInitialized,C=t.target,r=b&&!l&&C;if(!r)return!1;var i=Fs(C,m);return!i},Xu=function(e){var t=e.setup.pinch.disabled,s=e.isInitialized,l=e.pinchStartDistance,m=s&&!t&&l;return!!m},Yu=function(e,t,s){var l=s.getBoundingClientRect(),m=e.touches,b=tt(m[0].clientX-l.left,5),C=tt(m[0].clientY-l.top,5),r=tt(m[1].clientX-l.left,5),i=tt(m[1].clientY-l.top,5);return{x:(b+r)/2/t,y:(C+i)/2/t}},qn=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))},Vu=function(e,t){var s=e.pinchStartScale,l=e.pinchStartDistance,m=e.setup,b=m.maxScale,C=m.minScale,r=m.zoomAnimation,i=m.disablePadding,c=r.size,d=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 ns(tt(p,2),C,b,c,!d&&!i)},Gu=160,Qu=100,Zu=function(e,t){var s=e.props,l=s.onWheelStart,m=s.onZoomStart;e.wheelStopEventTimer||(rt(e),Re(Ee(e),t,l),Re(Ee(e),t,m))},Ju=function(e,t){var s=e.props,l=s.onWheel,m=s.onZoom,b=e.contentComponent,C=e.setup,r=e.transformState,i=r.scale,c=C.limitToBounds,d=C.centerZoomedOut,o=C.zoomAnimation,p=C.wheel,_=C.disablePadding,y=C.smooth,g=o.size,n=o.disabled,f=p.step,h=p.smoothStep;if(!b)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var u=$u(t,null),v=y?h*Math.abs(t.deltaY):f,x=Uu(e,u,v,!t.ctrlKey);if(i!==x){var w=wt(e,x),k=Un(t,b,i),S=n||g===0||d||_,E=c&&S,T=Is(e,k.x,k.y,x,w,E),A=T.x,L=T.y;e.previousWheelEvent=t,e.setTransformState(x,A,L),Re(Ee(e),t,l),Re(Ee(e),t,m)}},ed=function(e,t){var s=e.props,l=s.onWheelStop,m=s.onZoomStop;hr(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(In(e,t.x,t.y),e.wheelAnimationTimer=null)},Qu);var b=qu(e,t);b&&(hr(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Re(Ee(e),t,l),Re(Ee(e),t,m))},Gu))},Kn=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,b=s/2;return{x:m,y:b}},td=function(e,t){var s=qn(t);e.pinchStartDistance=s,e.lastDistance=s,e.pinchStartScale=e.transformState.scale,e.isPanning=!1;var l=Kn(t);e.pinchLastCenterX=l.x,e.pinchLastCenterY=l.y,rt(e)},sd=function(e,t){var s=e.contentComponent,l=e.pinchStartDistance,m=e.wrapperComponent,b=e.transformState.scale,C=e.setup,r=C.limitToBounds,i=C.centerZoomedOut,c=C.zoomAnimation,d=C.alignmentAnimation,o=c.disabled,p=c.size;if(!(l===null||!s)){var _=Yu(t,b,s);if(!(!Number.isFinite(_.x)||!Number.isFinite(_.y))){var y=qn(t),g=Vu(e,y),n=Kn(t),f=n.x-(e.pinchLastCenterX||0),h=n.y-(e.pinchLastCenterY||0);if(!(g===b&&f===0&&h===0)){e.pinchLastCenterX=n.x,e.pinchLastCenterY=n.y;var u=wt(e,g),v=o||p===0||i,x=r&&v,w=Is(e,_.x,_.y,g,u,x),k=w.x,S=w.y;e.pinchMidpoint=_,e.lastDistance=y;var E=d.sizeX,T=d.sizeY,A=bt(e,E),L=bt(e,T),M=k+f,B=S+h,I=is(M,B,u,r,A,L,m),H=I.x,W=I.y;e.setTransformState(g,H,W)}}}},rd=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,In(e,t?.x,t?.y)},Xn=function(e,t){var s=e.props.onZoomStop,l=e.setup.doubleClick.animationTime;hr(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Re(Ee(e),t,s)},l)},id=function(e,t){var s=e.props,l=s.onZoomStart,m=s.onZoom,b=e.setup.doubleClick,C=b.animationTime,r=b.animationType;Re(Ee(e),t,l),Wn(e,C,r,function(){return Re(Ee(e),t,m)}),Xn(e,t)};function nd(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,b=e.contentComponent,C=m.scale,r=e.props,i=r.onZoomStart,c=r.onZoom,d=s.doubleClick,o=d.disabled,p=d.mode,_=d.step,y=d.animationTime,g=d.animationType;if(!o&&!l){if(p==="reset")return id(e,t);if(!b)return console.error("No ContentComponent found");var n=nd(p,e.transformState.scale),f=Hn(e,n,_);if(C!==f){Re(Ee(e),t,i);var h=Un(t,b,C),u=Lr(e,f,h.x,h.y);if(!u)return console.error("Error during zoom event. New transformation state was not calculated.");Re(Ee(e),t,c),xt(e,u,y,g),Xn(e,t)}}}var ad=function(e,t){var s=e.isInitialized,l=e.setup,m=e.wrapperComponent,b=l.doubleClick,C=b.disabled,r=b.excluded,i=t.target,c=m?.contains(i),d=s&&i&&c&&!C;if(!d)return!1;var o=Fs(i,r);return!o},ld=(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,wt(s,s.transformState.scale),s.setup=xi(l)},this.initializeWindowEvents=function(){var l,m,b=Zs(),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,b),r?.addEventListener("mousedown",s.onPanningStart,b),r?.addEventListener("mousemove",s.onPanning,b),r?.addEventListener("mouseup",s.onPanningStop,b),C?.addEventListener("mouseleave",s.clearPanning,b),r?.addEventListener("keyup",s.setKeyUnPressed,b),r?.addEventListener("keydown",s.setKeyPressed,b)},this.cleanupWindowEvents=function(){var l,m,b=Zs(),C=(l=s.wrapperComponent)===null||l===void 0?void 0:l.ownerDocument,r=C?.defaultView;r?.removeEventListener("mousedown",s.onPanningStart,b),r?.removeEventListener("mousemove",s.onPanning,b),r?.removeEventListener("mouseup",s.onPanningStop,b),C?.removeEventListener("mouseleave",s.clearPanning,b),r?.removeEventListener("keyup",s.setKeyUnPressed,b),r?.removeEventListener("keydown",s.setKeyPressed,b),document.removeEventListener("mouseleave",s.clearPanning,b),rt(s),(m=s.observer)===null||m===void 0||m.disconnect()},this.handleInitializeWrapperEvents=function(l){var m=Zs();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 b=!1,C=s.setup.centerOnInit,r=function(i,c){for(var d=0,o=i;d<o.length;d++){var p=o[d];if(p.target===c)return!0}return!1};s.applyTransformation(),s.onInitCallbacks.forEach(function(i){i(Ee(s))}),s.observer=new ResizeObserver(function(i){if(r(i,l)||r(i,m))if(C&&!b){var c=m.offsetWidth,d=m.offsetHeight;(c>0||d>0)&&(b=!0,s.setCenter())}else rt(s),wt(s,s.transformState.scale),Tr(s,0)}),s.observer.observe(l),s.observer.observe(m)},this.onWheelZoom=function(l){var m=s.setup.disabled;if(!m){var b=zu(s,l);if(b){var C=s.isPressingKeys(s.setup.wheel.activationKeys);C&&(Zu(s,l),Ju(s,l),ed(s,l))}}},this.onWheelPanning=function(l){var m=s.setup,b=m.disabled,C=m.wheel,r=m.panning;if(!(!s.wrapperComponent||!s.contentComponent||b||!C.wheelDisabled||r.disabled||!r.wheelPanning||l.ctrlKey)){l.preventDefault(),l.stopPropagation();var i=s.transformState,c=i.positionX,d=i.positionY,o=c-l.deltaX,p=d-l.deltaY,_=r.lockAxisX?c:o,y=r.lockAxisY?d:p,g=s.setup.alignmentAnimation,n=g.sizeX,f=g.sizeY,h=bt(s,n),u=bt(s,f);_===c&&y===d||Bn(s,_,y,h,u)}},this.onPanningStart=function(l){var m=s.setup.disabled,b=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(),rt(s),gi(s,l),Re(Ee(s),l,b)))}}},this.onPanning=function(l){var m=s.setup.disabled,b=s.props.onPanning;if(!m){var C=mi(s);if(C){var r=s.isPressingKeys(s.setup.panning.activationKeys);r&&(l.preventDefault(),l.stopPropagation(),_i(s,l.clientX,l.clientY),Re(Ee(s),l,b))}}},this.onPanningStop=function(l){var m=s.props.onPanningStop;s.isPanning&&(Tu(s),Re(Ee(s),l,m))},this.onPinchStart=function(l){var m=s.setup.disabled,b=s.props,C=b.onPinchingStart,r=b.onZoomStart;if(!m){var i=Ku(s,l);i&&(td(s,l),rt(s),Re(Ee(s),l,C),Re(Ee(s),l,r))}},this.onPinch=function(l){var m=s.setup.disabled,b=s.props,C=b.onPinching,r=b.onZoom;if(!m){var i=Xu(s);i&&(l.preventDefault(),l.stopPropagation(),sd(s,l),Re(Ee(s),l,C),Re(Ee(s),l,r))}},this.onPinchStop=function(l){var m=s.props,b=m.onPinchingStop,C=m.onZoomStop;s.pinchStartScale&&(rd(s),Re(Ee(s),l,b),Re(Ee(s),l,C))},this.onTouchPanningStart=function(l){var m=s.setup.disabled,b=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,rt(s);var i=l.touches,c=i.length===1,d=i.length===2;c&&(rt(s),gi(s,l),Re(Ee(s),l,b)),d&&s.onPinchStart(l)}}}},this.onTouchPanning=function(l){var m=s.setup.disabled,b=s.props.onPanning;if(s.isPanning&&l.touches.length===1){if(m)return;var C=mi(s);if(!C)return;l.preventDefault(),l.stopPropagation();var r=l.touches[0];_i(s,r.clientX,r.clientY),Re(Ee(s),l,b)}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 b=ad(s,l);b&&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,b){var C=s.props.onTransformed;if(!Number.isNaN(l)&&!Number.isNaN(m)&&!Number.isNaN(b)){l!==s.transformState.scale&&(s.transformState.previousScale=s.transformState.scale,s.transformState.scale=l),s.transformState.positionX=m,s.transformState.positionY=b,s.applyTransformation();var r=Ee(s);s.onChangeCallbacks.forEach(function(i){return i(r)}),Re(r,{scale:l,positionX:m,positionY:b},C)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(s.wrapperComponent&&s.contentComponent){var l=$n(s.transformState.scale,s.wrapperComponent,s.contentComponent);s.setTransformState(l.scale,l.positionX,l.positionY)}},this.handleTransformStyles=function(l,m,b){return s.props.customTransform?s.props.customTransform(l,m,b):Fu(l,m,b)},this.applyTransformation=function(){if(!(!s.mounted||!s.contentComponent)){var l=s.transformState,m=l.scale,b=l.positionX,C=l.positionY,r=s.handleTransformStyles(b,C,m);s.contentComponent.style.transform=r}},this.getContext=function(){return Ee(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,wt(s,s.transformState.scale),s.handleInitializeWrapperEvents(l),s.handleInitialize(l,m),s.initializeWindowEvents(),s.isInitialized=!0;var b=Ee(s);Re(b,void 0,s.props.onInit)},this.props=t,this.setup=xi(this.props),this.transformState=Fn(this.props)}return e})(),Hs=ee.createContext(null),cd=function(e,t){return typeof e=="function"?e(t):e},hd=ee.forwardRef(function(e,t){var s=R.useRef(new ld(e)).current,l=cd(e.children,Cs(s));return R.useImperativeHandle(t,function(){return Cs(s)},[s]),R.useEffect(function(){s.update(e)},[s,e]),ee.createElement(Hs.Provider,{value:s},l)});ee.forwardRef(function(e,t){var s=R.useRef(null),l=R.useContext(Hs);return R.useEffect(function(){return l.onChange(function(m){if(s.current){var b=0,C=0;s.current.style.transform=l.handleTransformStyles(b,C,1/m.instance.transformState.scale)}})},[l]),ee.createElement("div",_t({},e,{ref:Hu([s,t])}))});function ud(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 dd=`.transform-component-module_wrapper__SPB86 {
|
|
32
32
|
position: relative;
|
|
33
33
|
width: -moz-fit-content;
|
|
34
34
|
width: fit-content;
|
|
@@ -59,27 +59,27 @@ 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
|
-
`,bi={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};hd(ud);var dd=function(e){var t=e.children,s=e.wrapperClass,l=s===void 0?"":s,m=e.contentClass,b=m===void 0?"":m,C=e.wrapperStyle,r=e.contentStyle,i=e.wrapperProps,c=i===void 0?{}:i,d=e.contentProps,o=d===void 0?{}:d,p=R.useContext(Is),_=p.init,S=p.cleanupWindowEvents,g=R.useRef(null),n=R.useRef(null);return R.useEffect(function(){var f=g.current,h=n.current;return f!==null&&h!==null&&_&&_?.(f,h),function(){S?.()}},[]),ee.createElement("div",mt({},c,{ref:g,className:"".concat(ar.wrapperClass," ").concat(bi.wrapper," ").concat(l),style:C}),ee.createElement("div",mt({},o,{ref:n,className:"".concat(ar.contentClass," ").concat(bi.content," ").concat(b),style:r}),t))},Vn=function(){var e=R.useContext(Is);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},fd=function(){var e=Vn();return ys(e)};function pd(e){var t=Vn(),s=R.useState(e(lr(t))),l=s[0],m=s[1];return R.useEffect(function(){var b=!0,C=t.onChange(function(r){b&&m(e(lr(r.instance)))});return function(){C(),b=!1}},[e,t]),l}function md(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 vd(e,t){return at({queryKey:ce.files.tree(e||"",t),queryFn:()=>be.get("/files/tree",{params:{workingDir:e||"",path:t}}),enabled:!!e})}function gd(e,t){return at({queryKey:ce.files.content(e||"",t||""),queryFn:()=>be.get("/files/read",{params:{workingDir:e||"",path:t||""}}),enabled:!!e&&!!t})}function _d(e){const t=Ie();return R.useCallback(()=>{e&&t.invalidateQueries({queryKey:["files","tree",e]})},[t,e])}function bd(){const e=Ie();return Ge({mutationFn:t=>be.post("/files/write",t),onSuccess:(t,s)=>{const l=ce.files.content(s.workingDir,s.path),m=e.getQueryData(l);e.setQueryData(l,{content:s.content,language:m?.language||md(s.path)})}})}function xd(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function Sd(e,t){return e==="/"?t:`${e.slice(1)}/${t}`}const yd=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function Cd(e){if(e.type==="directory")return null;const t=e.name.split(".").pop()?.toLowerCase();return t&&yd.has(t)?br:t==="ts"||t==="tsx"||t==="js"||t==="jsx"?Wt:t==="json"?ia:t==="md"||t==="mdx"||t==="txt"?en:Wo}const xi=({depth:e,active:t,onClick:s,leftIcon:l,rightIcon:m,label:b})=>a.jsxs("button",{type:"button",onClick:s,className:Se("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:b})]}),Gn=({workingDir:e,path:t,depth:s,expanded:l,toggleDir:m,onFileSelect:b,selectedFilePath:C})=>{const{data:r,isLoading:i,isError:c}=vd(e,t),d=R.useMemo(()=>r?.items??[],[r?.items]);return i?a.jsx("div",{className:"text-xs text-neutral-400 px-2 py-1",style:{paddingLeft:8+s*14},children:"Loading..."}):c?a.jsx("div",{className:"text-xs text-red-600 px-2 py-1",style:{paddingLeft:8+s*14},children:"Failed to load"}):a.jsx("div",{className:"space-y-0.5",children:d.map(o=>{if(o.type==="directory"){const n=xd(t,o.name),f=l.has(n);return a.jsxs("div",{children:[a.jsx(xi,{depth:s,onClick:()=>m(n),rightIcon:f?a.jsx(gt,{size:14,className:"text-neutral-400"}):a.jsx(kt,{size:14,className:"text-neutral-400"}),leftIcon:f?a.jsx(tn,{size:14,className:"text-amber-500"}):a.jsx(zo,{size:14,className:"text-amber-500"}),label:o.name}),f&&a.jsx(Gn,{workingDir:e,path:n,depth:s+1,expanded:l,toggleDir:m,onFileSelect:b,selectedFilePath:C})]},n)}const p=Sd(t,o.name),_=Cd(o),S=C===p,g=_===br;return a.jsx(xi,{depth:s,active:S,onClick:()=>b(p),rightIcon:a.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:_?a.jsx(_,{size:14,className:g?"text-emerald-600":"text-sky-600"}):null,label:o.name},p)})})},wd=({workingDir:e,className:t,onFileSelect:s,selectedFilePath:l,onCollapse:m})=>{const[b,C]=R.useState(()=>new Set),r=_d(e),i=R.useCallback(c=>{C(d=>{const o=new Set(d);return o.has(c)?o.delete(c):o.add(c),o})},[]);return a.jsxs("div",{className:Se("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:"Files"}),a.jsx("div",{className:"text-[11px] text-neutral-400 truncate",children:e||"No workingDir"})]}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&a.jsx("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:"Refresh file tree",children:a.jsx(Pa,{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:"Collapse file tree",children:a.jsx(ka,{size:13})})]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-2",children:e?a.jsx(Gn,{workingDir:e,path:"/",depth:0,expanded:b,toggleDir:i,onFileSelect:s,selectedFilePath:l}):a.jsx("div",{className:"text-xs text-neutral-500 px-2 py-2",children:"No workspace selected."})})]})},Ed=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function kd(e){const t=e.split(".").pop()?.toLowerCase();return t?Ed.has(t):!1}function Rd(e,t){const s="/api",l=new URLSearchParams({workingDir:e,path:t});if(Yt()){const m=Vt();m&&l.set("token",m)}return`${s}/files/image?${l.toString()}`}const Dd=({filePath:e})=>{const{zoomIn:t,zoomOut:s,centerView:l}=fd(),m=pd(C=>C.state.scale),b=Math.round(m*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:()=>s(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Zoom out",children:a.jsx(qa,{size:14})}),a.jsxs("button",{type:"button",onClick:()=>l(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:"Reset zoom",children:[b,"%"]}),a.jsx("button",{type:"button",onClick:()=>t(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Zoom in",children:a.jsx($a,{size:14})}),a.jsx("button",{type:"button",onClick:()=>l(1),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors ml-1",title:"Fit to view",children:a.jsx(ya,{size:13})}),a.jsx("span",{className:"ml-2 text-[11px] text-neutral-400 truncate",children:e})]})},Td=({workingDir:e,filePath:t})=>{const[s,l]=R.useState(!1),m=Rd(e,t);return s?a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"Failed to load image."}):a.jsx(cd,{initialScale:1,minScale:.1,maxScale:10,centerOnInit:!0,doubleClick:{mode:"toggle"},children:a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsx(Dd,{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(dd,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx("img",{src:m,alt:t,className:"max-w-full max-h-full object-contain rounded shadow-sm",draggable:!1,onError:()=>l(!0)})})})]})})};function jd(e){const t=e.split("/");return t[t.length-1]||e}function Ld(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 Ad=({active:e,name:t,isDirty:s,onClick:l,onClose:m})=>a.jsxs("button",{type:"button",onClick:l,className:Se("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:Se("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":"Close tab",title:"Close",children:a.jsx(ks,{size:12})})]}),Nd=({workingDir:e,className:t})=>{const[s,l]=R.useState([]),[m,b]=R.useState(null),C=bd(),[r,i]=R.useState(280),[c,d]=R.useState(!1),[o,p]=R.useState(!1),_=R.useRef(280),S=R.useCallback(()=>{d(A=>(A?i(_.current):_.current=r,!A))},[r]),g=R.useCallback(A=>{A.preventDefault(),p(!0);const L=A.clientX,N=r,B=H=>{const W=H.clientX-L,D=Math.min(480,Math.max(160,N+W));i(D)},I=()=>{p(!1),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",I)};document.addEventListener("mousemove",B),document.addEventListener("mouseup",I)},[r]);R.useEffect(()=>{l([]),b(null)},[e]);const n=R.useMemo(()=>s.find(A=>A.path===m)||null,[s,m]),{data:f,isFetching:h,isError:u,error:v}=gd(e,n?.isImage?null:m);R.useEffect(()=>{!m||!f||l(A=>A.map(L=>L.path!==m||L.isDirty||L.loaded?L:{...L,language:f.language||L.language,content:f.content,savedContent:f.content,isDirty:!1,loaded:!0}))},[m,f]);const x=R.useCallback(A=>{l(L=>{if(L.find(I=>I.path===A))return L;const B=kd(A);return[...L,{path:A,name:jd(A),language:Ld(A),content:"",savedContent:"",isDirty:!1,loaded:B,isImage:B}]}),b(A)},[]),w=R.useCallback(A=>{l(L=>{const N=L.filter(B=>B.path!==A);return b(B=>B!==A?B:N.length?N[N.length-1].path:null),N})},[]),k=R.useCallback(A=>{l(L=>L.map(N=>{if(N.path!==m)return N;const B=A!==N.savedContent;return{...N,content:A,isDirty:B}}))},[m]),y=R.useCallback(async()=>{!e||!n||(await C.mutateAsync({workingDir:e,path:n.path,content:n.content}),l(A=>A.map(L=>L.path===n.path?{...L,savedContent:L.content,isDirty:!1,loaded:!0}:L)))},[e,n,C]),E=R.useRef(()=>{});R.useEffect(()=>{E.current=()=>{y().catch(()=>{})}},[y]),R.useEffect(()=>{const A=L=>{(L.metaKey||L.ctrlKey)&&L.key.toLowerCase()==="s"&&(L.preventDefault(),E.current())};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[]);const j=R.useCallback((A,L)=>{A.addCommand(L.KeyMod.CtrlCmd|L.KeyCode.KeyS,()=>{E.current()})},[]);return a.jsxs("div",{className:Se("flex h-full overflow-hidden bg-white",t),style:o?{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:c?36:r,transition:o?"none":"width 0.15s ease"},children:c?a.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:a.jsx("button",{type:"button",onClick:S,className:"p-1.5 rounded hover:bg-neutral-100 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Expand file tree",children:a.jsx(Da,{size:16})})}):a.jsx(a.Fragment,{children:a.jsx(wd,{workingDir:e,onFileSelect:x,selectedFilePath:n?.path||null,onCollapse:S},e||"no-working-dir")})}),!c&&a.jsx("div",{onMouseDown:g,className:Se("w-1 shrink-0 cursor-col-resize transition-colors",o?"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:[s.length===0?a.jsx("div",{className:"px-2 pb-2 text-xs text-neutral-500",children:"No open files"}):s.map(A=>a.jsx(Ad,{active:A.path===m,name:A.name,isDirty:A.isDirty,onClick:()=>b(A.path),onClose:L=>{L.stopPropagation(),w(A.path)}},A.path)),a.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[C.isPending&&a.jsxs("span",{className:"flex items-center gap-2 text-xs text-neutral-500",children:[a.jsx(Be,{size:14,className:"animate-spin"}),"Saving"]}),n?.isDirty&&!C.isPending&&a.jsx("span",{className:"text-[11px] text-amber-600",children:"Unsaved"})]})]}),a.jsx("div",{className:"flex-1 min-h-0 relative",children:e?n?n.isImage?a.jsx(Td,{workingDir:e,filePath:n.path}):a.jsxs(a.Fragment,{children:[a.jsx(eu,{path:n.path,value:n.content,language:n.language,theme:"vs-light",height:"100%",onChange:A=>k(A??""),onMount:j,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0}}),h&&!n.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(Be,{size:14,className:"animate-spin"}),"Loading file..."]})}),u&&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:["Failed to load file",v instanceof Error?`: ${v.message}`:"","."]})]}):a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"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:"No workspace selected."})})]})]})};function Qn(e){return at({queryKey:ce.git.changes(e||""),queryFn:()=>be.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e})}function Zn(e,t,s){return at({queryKey:ce.git.diff(e||"",t||"",s),queryFn:()=>be.get("/git/diff",{params:{workingDir:e||"",path:t||"",type:s}}),enabled:!!e&&!!t})}function Jn(e,t){return at({queryKey:ce.git.commitFiles(e||"",t||""),queryFn:()=>be.get("/git/commit-files",{params:{workingDir:e||"",hash:t||""}}),enabled:!!e&&!!t})}function eo(e,t,s){return at({queryKey:ce.git.commitDiff(e||"",t||"",s||""),queryFn:()=>be.get("/git/commit-diff",{params:{workingDir:e||"",hash:t||"",path:s||""}}),enabled:!!e&&!!t&&!!s})}const Si={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"},Md={M:"Modified",A:"Added",D:"Deleted",R:"Renamed"};function Pd(e){const t=e.split("/");return t[t.length-1]||e}function Od(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}const Bd=({entry:e,selected:t,onClick:s})=>{const l=Si[e.status]||Si.M,m=Md[e.status]||e.status,b=Od(e.path);return a.jsxs("button",{type:"button",onClick:s,className:Se("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:Se("w-4 h-4 flex items-center justify-center text-[10px] font-bold border rounded-sm shrink-0",l),title:m,children:e.status}),a.jsx("span",{className:"text-xs text-neutral-900 truncate",children:Pd(e.path)}),b&&a.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:b})]})},yi=({title:e,entries:t,type:s,selectedKey:l,onSelect:m})=>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:e}),a.jsx("span",{className:"text-[10px] text-neutral-400",children:t.length})]}),a.jsx("div",{className:"space-y-0.5",children:t.map(b=>{const C=`${s}:${b.path}`;return a.jsx(Bd,{entry:b,selected:l===C,onClick:()=>m(b.path,s)},C)})})]}),Id=({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:Se("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:Se("pl-2 whitespace-pre",l),children:e})]})},Fd=({workingDir:e,filePath:t,type:s})=>{const{data:l,isLoading:m,isError:b}=Zn(e,t,s);if(m)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500",children:[a.jsx(Be,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(b)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-xs",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-xs",children:"No diff content available."});const r=C.split(`
|
|
63
|
-
`);return a.jsx("div",{className:"flex-1 overflow-auto font-mono text-xs leading-5",children:r.map((i,c)=>a.jsx(
|
|
62
|
+
`,Si={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};ud(dd);var fd=function(e){var t=e.children,s=e.wrapperClass,l=s===void 0?"":s,m=e.contentClass,b=m===void 0?"":m,C=e.wrapperStyle,r=e.contentStyle,i=e.wrapperProps,c=i===void 0?{}:i,d=e.contentProps,o=d===void 0?{}:d,p=R.useContext(Hs),_=p.init,y=p.cleanupWindowEvents,g=R.useRef(null),n=R.useRef(null);return R.useEffect(function(){var f=g.current,h=n.current;return f!==null&&h!==null&&_&&_?.(f,h),function(){y?.()}},[]),ee.createElement("div",_t({},c,{ref:g,className:"".concat(lr.wrapperClass," ").concat(Si.wrapper," ").concat(l),style:C}),ee.createElement("div",_t({},o,{ref:n,className:"".concat(lr.contentClass," ").concat(Si.content," ").concat(b),style:r}),t))},Yn=function(){var e=R.useContext(Hs);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},pd=function(){var e=Yn();return Cs(e)};function md(e){var t=Yn(),s=R.useState(e(cr(t))),l=s[0],m=s[1];return R.useEffect(function(){var b=!0,C=t.onChange(function(r){b&&m(e(cr(r.instance)))});return function(){C(),b=!1}},[e,t]),l}function vd(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 gd(e,t){return ct({queryKey:he.files.tree(e||"",t),queryFn:()=>_e.get("/files/tree",{params:{workingDir:e||"",path:t}}),enabled:!!e})}function _d(e,t){return ct({queryKey:he.files.content(e||"",t||""),queryFn:()=>_e.get("/files/read",{params:{workingDir:e||"",path:t||""}}),enabled:!!e&&!!t})}function bd(e){const t=Pe();return R.useCallback(()=>{e&&t.invalidateQueries({queryKey:["files","tree",e]})},[t,e])}function xd(){const e=Pe();return Ve({mutationFn:t=>_e.post("/files/write",t),onSuccess:(t,s)=>{const l=he.files.content(s.workingDir,s.path),m=e.getQueryData(l);e.setQueryData(l,{content:s.content,language:m?.language||vd(s.path)})}})}function Sd(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function yd(e,t){return e==="/"?t:`${e.slice(1)}/${t}`}const Cd=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function wd(e){if(e.type==="directory")return null;const t=e.name.split(".").pop()?.toLowerCase();return t&&Cd.has(t)?br:t==="ts"||t==="tsx"||t==="js"||t==="jsx"?qt:t==="json"?ia:t==="md"||t==="mdx"||t==="txt"?en:Wo}const yi=({depth:e,active:t,onClick:s,leftIcon:l,rightIcon:m,label:b})=>a.jsxs("button",{type:"button",onClick:s,className:xe("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:b})]}),Vn=({workingDir:e,path:t,depth:s,expanded:l,toggleDir:m,onFileSelect:b,selectedFilePath:C})=>{const{data:r,isLoading:i,isError:c}=gd(e,t),d=R.useMemo(()=>r?.items??[],[r?.items]);return i?a.jsx("div",{className:"text-xs text-neutral-400 px-2 py-1",style:{paddingLeft:8+s*14},children:"Loading..."}):c?a.jsx("div",{className:"text-xs text-red-600 px-2 py-1",style:{paddingLeft:8+s*14},children:"Failed to load"}):a.jsx("div",{className:"space-y-0.5",children:d.map(o=>{if(o.type==="directory"){const n=Sd(t,o.name),f=l.has(n);return a.jsxs("div",{children:[a.jsx(yi,{depth:s,onClick:()=>m(n),rightIcon:f?a.jsx(mt,{size:14,className:"text-neutral-400"}):a.jsx(kt,{size:14,className:"text-neutral-400"}),leftIcon:f?a.jsx(tn,{size:14,className:"text-amber-500"}):a.jsx(zo,{size:14,className:"text-amber-500"}),label:o.name}),f&&a.jsx(Vn,{workingDir:e,path:n,depth:s+1,expanded:l,toggleDir:m,onFileSelect:b,selectedFilePath:C})]},n)}const p=yd(t,o.name),_=wd(o),y=C===p,g=_===br;return a.jsx(yi,{depth:s,active:y,onClick:()=>b(p),rightIcon:a.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:_?a.jsx(_,{size:14,className:g?"text-emerald-600":"text-sky-600"}):null,label:o.name},p)})})},Ed=({workingDir:e,className:t,onFileSelect:s,selectedFilePath:l,onCollapse:m})=>{const[b,C]=R.useState(()=>new Set),r=bd(e),i=R.useCallback(c=>{C(d=>{const o=new Set(d);return o.has(c)?o.delete(c):o.add(c),o})},[]);return a.jsxs("div",{className:xe("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:"Files"}),a.jsx("div",{className:"text-[11px] text-neutral-400 truncate",children:e||"No workingDir"})]}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&a.jsx("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:"Refresh file tree",children:a.jsx(Pa,{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:"Collapse file tree",children:a.jsx(ka,{size:13})})]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-2",children:e?a.jsx(Vn,{workingDir:e,path:"/",depth:0,expanded:b,toggleDir:i,onFileSelect:s,selectedFilePath:l}):a.jsx("div",{className:"text-xs text-neutral-500 px-2 py-2",children:"No workspace selected."})})]})},kd=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function Rd(e){const t=e.split(".").pop()?.toLowerCase();return t?kd.has(t):!1}function Dd(e,t){const s="/api",l=new URLSearchParams({workingDir:e,path:t});if(Qt()){const m=Zt();m&&l.set("token",m)}return`${s}/files/image?${l.toString()}`}const jd=({filePath:e})=>{const{zoomIn:t,zoomOut:s,centerView:l}=pd(),m=md(C=>C.state.scale),b=Math.round(m*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:()=>s(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Zoom out",children:a.jsx(qa,{size:14})}),a.jsxs("button",{type:"button",onClick:()=>l(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:"Reset zoom",children:[b,"%"]}),a.jsx("button",{type:"button",onClick:()=>t(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Zoom in",children:a.jsx($a,{size:14})}),a.jsx("button",{type:"button",onClick:()=>l(1),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors ml-1",title:"Fit to view",children:a.jsx(ya,{size:13})}),a.jsx("span",{className:"ml-2 text-[11px] text-neutral-400 truncate",children:e})]})},Td=({workingDir:e,filePath:t})=>{const[s,l]=R.useState(!1),m=Dd(e,t);return s?a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"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(jd,{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(fd,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx("img",{src:m,alt:t,className:"max-w-full max-h-full object-contain rounded shadow-sm",draggable:!1,onError:()=>l(!0)})})})]})})};function Ld(e){const t=e.split("/");return t[t.length-1]||e}function Ad(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 Nd=({active:e,name:t,isDirty:s,onClick:l,onClose:m})=>a.jsxs("button",{type:"button",onClick:l,className:xe("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:xe("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":"Close tab",title:"Close",children:a.jsx(Rs,{size:12})})]}),Md=({workingDir:e,className:t})=>{const[s,l]=R.useState([]),[m,b]=R.useState(null),C=xd(),[r,i]=R.useState(280),[c,d]=R.useState(!1),[o,p]=R.useState(!1),_=R.useRef(280),y=R.useCallback(()=>{d(A=>(A?i(_.current):_.current=r,!A))},[r]),g=R.useCallback(A=>{A.preventDefault(),p(!0);const L=A.clientX,M=r,B=H=>{const W=H.clientX-L,D=Math.min(480,Math.max(160,M+W));i(D)},I=()=>{p(!1),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",I)};document.addEventListener("mousemove",B),document.addEventListener("mouseup",I)},[r]);R.useEffect(()=>{l([]),b(null)},[e]);const n=R.useMemo(()=>s.find(A=>A.path===m)||null,[s,m]),{data:f,isFetching:h,isError:u,error:v}=_d(e,n?.isImage?null:m);R.useEffect(()=>{!m||!f||l(A=>A.map(L=>L.path!==m||L.isDirty||L.loaded?L:{...L,language:f.language||L.language,content:f.content,savedContent:f.content,isDirty:!1,loaded:!0}))},[m,f]);const x=R.useCallback(A=>{l(L=>{if(L.find(I=>I.path===A))return L;const B=Rd(A);return[...L,{path:A,name:Ld(A),language:Ad(A),content:"",savedContent:"",isDirty:!1,loaded:B,isImage:B}]}),b(A)},[]),w=R.useCallback(A=>{l(L=>{const M=L.filter(B=>B.path!==A);return b(B=>B!==A?B:M.length?M[M.length-1].path:null),M})},[]),k=R.useCallback(A=>{l(L=>L.map(M=>{if(M.path!==m)return M;const B=A!==M.savedContent;return{...M,content:A,isDirty:B}}))},[m]),S=R.useCallback(async()=>{!e||!n||(await C.mutateAsync({workingDir:e,path:n.path,content:n.content}),l(A=>A.map(L=>L.path===n.path?{...L,savedContent:L.content,isDirty:!1,loaded:!0}:L)))},[e,n,C]),E=R.useRef(()=>{});R.useEffect(()=>{E.current=()=>{S().catch(()=>{})}},[S]),R.useEffect(()=>{const A=L=>{(L.metaKey||L.ctrlKey)&&L.key.toLowerCase()==="s"&&(L.preventDefault(),E.current())};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[]);const T=R.useCallback((A,L)=>{A.addCommand(L.KeyMod.CtrlCmd|L.KeyCode.KeyS,()=>{E.current()})},[]);return a.jsxs("div",{className:xe("flex h-full overflow-hidden bg-white",t),style:o?{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:c?36:r,transition:o?"none":"width 0.15s ease"},children:c?a.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:a.jsx("button",{type:"button",onClick:y,className:"p-1.5 rounded hover:bg-neutral-100 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Expand file tree",children:a.jsx(Da,{size:16})})}):a.jsx(a.Fragment,{children:a.jsx(Ed,{workingDir:e,onFileSelect:x,selectedFilePath:n?.path||null,onCollapse:y},e||"no-working-dir")})}),!c&&a.jsx("div",{onMouseDown:g,className:xe("w-1 shrink-0 cursor-col-resize transition-colors",o?"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:[s.length===0?a.jsx("div",{className:"px-2 pb-2 text-xs text-neutral-500",children:"No open files"}):s.map(A=>a.jsx(Nd,{active:A.path===m,name:A.name,isDirty:A.isDirty,onClick:()=>b(A.path),onClose:L=>{L.stopPropagation(),w(A.path)}},A.path)),a.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[C.isPending&&a.jsxs("span",{className:"flex items-center gap-2 text-xs text-neutral-500",children:[a.jsx(Me,{size:14,className:"animate-spin"}),"Saving"]}),n?.isDirty&&!C.isPending&&a.jsx("span",{className:"text-[11px] text-amber-600",children:"Unsaved"})]})]}),a.jsx("div",{className:"flex-1 min-h-0 relative",children:e?n?n.isImage?a.jsx(Td,{workingDir:e,filePath:n.path}):a.jsxs(a.Fragment,{children:[a.jsx(tu,{path:n.path,value:n.content,language:n.language,theme:"vs-light",height:"100%",onChange:A=>k(A??""),onMount:T,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0}}),h&&!n.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(Me,{size:14,className:"animate-spin"}),"Loading file..."]})}),u&&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:["Failed to load file",v instanceof Error?`: ${v.message}`:"","."]})]}):a.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"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:"No workspace selected."})})]})]})};function Gn(e){return ct({queryKey:he.git.changes(e||""),queryFn:()=>_e.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e})}function Qn(e,t,s){return ct({queryKey:he.git.diff(e||"",t||"",s),queryFn:()=>_e.get("/git/diff",{params:{workingDir:e||"",path:t||"",type:s}}),enabled:!!e&&!!t})}function Zn(e,t){return ct({queryKey:he.git.commitFiles(e||"",t||""),queryFn:()=>_e.get("/git/commit-files",{params:{workingDir:e||"",hash:t||""}}),enabled:!!e&&!!t})}function Jn(e,t,s){return ct({queryKey:he.git.commitDiff(e||"",t||"",s||""),queryFn:()=>_e.get("/git/commit-diff",{params:{workingDir:e||"",hash:t||"",path:s||""}}),enabled:!!e&&!!t&&!!s})}const Ci={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"},Pd={M:"Modified",A:"Added",D:"Deleted",R:"Renamed"};function Od(e){const t=e.split("/");return t[t.length-1]||e}function Bd(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}const Id=({entry:e,selected:t,onClick:s})=>{const l=Ci[e.status]||Ci.M,m=Pd[e.status]||e.status,b=Bd(e.path);return a.jsxs("button",{type:"button",onClick:s,className:xe("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:xe("w-4 h-4 flex items-center justify-center text-[10px] font-bold border rounded-sm shrink-0",l),title:m,children:e.status}),a.jsx("span",{className:"text-xs text-neutral-900 truncate",children:Od(e.path)}),b&&a.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:b})]})},wi=({title:e,entries:t,type:s,selectedKey:l,onSelect:m})=>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:e}),a.jsx("span",{className:"text-[10px] text-neutral-400",children:t.length})]}),a.jsx("div",{className:"space-y-0.5",children:t.map(b=>{const C=`${s}:${b.path}`;return a.jsx(Id,{entry:b,selected:l===C,onClick:()=>m(b.path,s)},C)})})]}),Fd=({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:xe("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:xe("pl-2 whitespace-pre",l),children:e})]})},Hd=({workingDir:e,filePath:t,type:s})=>{const{data:l,isLoading:m,isError:b}=Qn(e,t,s);if(m)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500",children:[a.jsx(Me,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(b)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-xs",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-xs",children:"No diff content available."});const r=C.split(`
|
|
63
|
+
`);return a.jsx("div",{className:"flex-1 overflow-auto font-mono text-xs leading-5",children:r.map((i,c)=>a.jsx(Fd,{line:i,lineNum:c+1},c))})},zd=({workingDir:e})=>{const{data:t,isLoading:s,isError:l}=Gn(e),[m,b]=R.useState(null),[C,r]=R.useState(260),[i,c]=R.useState(!1),d=R.useCallback(n=>{n.preventDefault(),c(!0);const f=n.clientX,h=C,u=x=>{const w=x.clientX-f,k=Math.min(480,Math.max(160,h+w));r(k)},v=()=>{c(!1),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",v)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",v)},[C]),o=m?`${m.type}:${m.path}`:null,p=(n,f)=>{b({path:n,type:f})};if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-500 text-sm bg-white h-full",children:"No workspace selected."});if(s)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500 bg-white h-full",children:[a.jsx(Me,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading changes..."})]});if(l)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm bg-white h-full",children:"Failed to load changes."});const _=t?.uncommitted||[],y=t?.committed||[],g=_.length+y.length;return a.jsxs("div",{className:"flex h-full bg-white",style:i?{userSelect:"none",cursor:"col-resize"}:void 0,children:[a.jsxs("div",{className:"border-r border-neutral-200 flex flex-col shrink-0",style:{width:C},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(Kt,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-semibold text-neutral-900",children:"Changes"}),g>0&&a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:g})]})}),a.jsx("div",{className:"flex-1 overflow-auto p-1.5",children:g===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-neutral-400",children:[a.jsx(Kt,{size:28,className:"mb-2"}),a.jsx("span",{className:"text-xs",children:"No pending changes"})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx(wi,{title:"Uncommitted",entries:_,type:"uncommitted",selectedKey:o,onSelect:p}),a.jsx(wi,{title:"Committed",entries:y,type:"committed",selectedKey:o,onSelect:p})]})})]}),a.jsx("div",{onMouseDown:d,className:xe("w-1 shrink-0 cursor-col-resize transition-colors",i?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:m?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(qt,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-medium text-neutral-700 truncate",children:m.path}),a.jsxs("span",{className:"text-[10px] text-neutral-400",children:["(",m.type,")"]})]}),a.jsx(Hd,{workingDir:e,filePath:m.path,type:m.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(qt,{size:28}),a.jsx("span",{className:"text-xs",children:"Select a file to view diff"})]})})})]})},Js=50,Ei={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 Wd(e){const s=Math.floor(Date.now()/1e3)-e;return s<60?`${s}s ago`:s<3600?`${Math.floor(s/60)}m ago`:s<86400?`${Math.floor(s/3600)}h ago`:s<604800?`${Math.floor(s/86400)}d ago`:new Date(e*1e3).toLocaleDateString()}function $d(e){const t=e.split("/");return t[t.length-1]||e}function Ud(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}const qd=`
|
|
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
|
-
`,
|
|
69
|
-
`);return a.jsx("div",{className:"flex-1 overflow-auto history-scroll font-mono text-xs leading-5",children:r.map((i,c)=>a.jsx(qd,{line:i,lineNum:c+1},c))})},Xd=({workingDir:e,hash:t,selectedPath:s,onSelectFile:l})=>{const{data:m,isLoading:b}=Jn(e,t);if(b)return a.jsxs("div",{className:"pl-7 py-1 text-xs text-neutral-400 flex items-center gap-1",children:[a.jsx(Be,{size:12,className:"animate-spin"}),a.jsx("span",{children:"Loading..."})]});const C=m?.files||[];return C.length===0?a.jsx("div",{className:"pl-7 py-1 text-xs text-neutral-400",children:"No files changed"}):a.jsx("div",{className:"pl-7 pb-1 space-y-0.5",children:C.map(r=>{const i=Ci[r.status]||Ci.M,c=$d(r.path);return a.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),l(r.path)},className:Se("flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer w-full text-left",s===r.path?"bg-blue-50":"hover:bg-neutral-50"),children:[a.jsx("span",{className:Se("w-3.5 h-3.5 flex items-center justify-center text-[9px] font-bold border rounded-sm shrink-0",i),children:r.status}),a.jsx("span",{className:"text-[11px] text-neutral-900 truncate",children:Wd(r.path)}),c&&a.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:c})]},r.path)})})},Yd=({workingDir:e})=>{const{data:t,isLoading:s,isError:l,fetchNextPage:m,hasNextPage:b,isFetchingNextPage:C}=Vi({queryKey:ce.git.log(e||""),queryFn:({pageParam:v=0})=>be.get("/git/log",{params:{workingDir:e||"",limit:String(Zs),skip:String(v)}}),initialPageParam:0,getNextPageParam:(v,x)=>v.commits.length<Zs?void 0:x.length*Zs,enabled:!!e}),r=t?.pages.flatMap(v=>v.commits)||[],[i,c]=R.useState(null),[d,o]=R.useState(null),[p,_]=R.useState(280),[S,g]=R.useState(!1),n=R.useCallback(v=>{v.preventDefault(),g(!0);const x=v.clientX,w=p,k=E=>{const j=Math.min(480,Math.max(180,w+(E.clientX-x)));_(j)},y=()=>{g(!1),document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",y)};document.addEventListener("mousemove",k),document.addEventListener("mouseup",y)},[p]),f=v=>{i===v?(c(null),o(null)):(c(v),o(null))},h=R.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:"No workspace selected."});if(s)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500 bg-white h-full",children:[a.jsx(Be,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading history..."})]});if(l)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm bg-white h-full",children:"Failed to load history."});if(r.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(At,{size:28,className:"mb-2"}),a.jsx("span",{className:"text-xs",children:"No commit history"})]});const u=r.find(v=>v.hash===i);return a.jsxs("div",{className:"flex h-full bg-white",style:S?{userSelect:"none",cursor:"col-resize"}:void 0,children:[a.jsx("style",{children:Ud}),a.jsxs("div",{className:"border-r border-neutral-200 flex flex-col shrink-0",style:{width:p},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(At,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-semibold text-neutral-900",children:"History"}),a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:r.length})]})}),a.jsxs("div",{ref:h,className:"flex-1 overflow-auto history-scroll p-1.5",children:[r.map(v=>{const x=i===v.hash;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>f(v.hash),className:Se("flex items-start gap-2 px-2 py-1.5 rounded cursor-pointer w-full text-left group",x?"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:Se("w-2 h-2 rounded-full shrink-0 transition-colors",x?"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:v.shortHash}),a.jsx("span",{className:"text-xs text-neutral-900 truncate flex-1",children:v.message}),a.jsx(kt,{size:12,className:Se("shrink-0 text-neutral-400 transition-transform",x&&"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:v.author}),a.jsx("span",{className:"text-[10px] text-neutral-400",children:zd(v.timestamp)})]})]})]}),x&&a.jsxs(a.Fragment,{children:[v.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:v.body}),a.jsx(Xd,{workingDir:e,hash:v.hash,selectedPath:d,onSelectFile:o})]})]},v.hash)}),b&&a.jsx("button",{type:"button",onClick:()=>m(),disabled:C,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:C?a.jsxs(a.Fragment,{children:[a.jsx(Be,{size:12,className:"animate-spin"})," Loading..."]}):"Load more"})]})]}),a.jsx("div",{onMouseDown:n,className:Se("w-1 shrink-0 cursor-col-resize transition-colors",S?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:d&&i?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(Wt,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-medium text-neutral-700 truncate",children:d}),a.jsxs("span",{className:"text-[10px] text-neutral-400",children:["(",u?.shortHash,")"]})]}),a.jsx(Kd,{workingDir:e,hash:i,filePath:d})]}):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(Wt,{size:28}),a.jsx("span",{className:"text-xs",children:i?"Select a file to view diff":"Select a commit to view changes"})]})})})]})},Vd=[{key:"changes",label:"Changes",icon:a.jsx($t,{size:14})},{key:"history",label:"History",icon:a.jsx(At,{size:14})},{key:"editor",label:"Editor",icon:a.jsx(Ds,{size:14})},{key:"terminal",label:"Terminal",icon:a.jsx(ps,{size:14})},{key:"preview",label:"Preview",icon:a.jsx(Es,{size:14})}],Gd=[{key:"history",label:"History",icon:a.jsx(At,{size:14})},{key:"editor",label:"Editor",icon:a.jsx(Ds,{size:14})},{key:"terminal",label:"Terminal",icon:a.jsx(ps,{size:14})},{key:"preview",label:"Preview",icon:a.jsx(Es,{size:14})}],Qd=({active:e,onClick:t,icon:s,label:l})=>a.jsxs("button",{onClick:t,className:Se("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})]}),Zd=({icon:e,title:t})=>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:t}),a.jsx("span",{className:"text-xs",children:"Coming soon..."})]})}),to=ee.memo(function({className:t,sessionId:s,workingDir:l,projectId:m,hideChanges:b}){const C=b?Gd:Vd,[r,i]=R.useState(b?"history":"changes"),{data:c}=$o(m??""),d=R.useMemo(()=>{if(!c?.quickCommands)return[];try{return JSON.parse(c.quickCommands)}catch{return[]}},[c?.quickCommands]),[o,p]=R.useState([]),_=R.useRef(void 0);return R.useEffect(()=>{l&&l!==_.current&&(_.current=l,p(S=>S.includes(l)?S:[...S,l]))},[l]),a.jsxs("div",{className:Se("flex flex-col h-full bg-white",t),children:[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(S=>a.jsx(Qd,{active:r===S.key,onClick:()=>i(S.key),icon:S.icon,label:S.label},S.key))}),a.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[r==="editor"&&a.jsx(Nd,{workingDir:l}),o.map(S=>a.jsx("div",{className:"h-full absolute inset-0",style:{display:r==="terminal"&&l===S?"block":"none"},children:a.jsx(qc,{cwd:S,quickCommands:d})},S)),r==="preview"&&a.jsx(Zd,{icon:a.jsx(Es,{size:32}),title:"Preview"}),r==="changes"&&a.jsx(Hd,{workingDir:l}),r==="history"&&a.jsx(Yd,{workingDir:l})]})]})});function so(e){return at({queryKey:ce.workspaces.list(e),queryFn:()=>be.get(`/tasks/${e}/workspaces`),enabled:!!e})}function Jd(e){const t=Ie();return Ge({mutationFn:s=>be.post(`/tasks/${e}/workspaces`,s),onSuccess:()=>{t.invalidateQueries({queryKey:ce.workspaces.list(e)}),t.invalidateQueries({queryKey:ce.tasks.all})}})}function ef(){const e=Ie();return Ge({mutationFn:({id:t,commitMessage:s})=>be.post(`/workspaces/${t}/merge`,{commitMessage:s}),onSuccess:()=>{e.invalidateQueries({queryKey:ce.workspaces.all}),e.invalidateQueries({queryKey:ce.tasks.all})}})}function Ar(){return Ge({mutationFn:({workspaceId:e,editorType:t})=>be.post(`/workspaces/${e}/open-editor`,{editorType:t})})}function ro(e){return at({queryKey:ce.workspaces.gitStatus(e),queryFn:()=>be.get(`/workspaces/${e}/git-status`),enabled:!!e})}function tf(){const e=Ie();return Ge({mutationFn:t=>be.post(`/workspaces/${t}/rebase`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ce.workspaces.gitStatus(s)})},onError:(t,s)=>{e.invalidateQueries({queryKey:ce.workspaces.gitStatus(s)})}})}function sf(){const e=Ie();return Ge({mutationFn:t=>be.post(`/workspaces/${t}/abort-operation`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ce.workspaces.gitStatus(s)})}})}const wi=1500,rf=3e3;function nf(e){const[t,s]=R.useState(null),l=R.useRef(0),m=R.useRef(null),b=R.useRef(null);return R.useEffect(()=>{if(!e)return;const C=()=>{b.current&&(clearTimeout(b.current),b.current=null)},r=ht.connect();r.emit(nt.SUBSCRIBE,{topic:"task",id:e},d=>{});const i=d=>{s(d),b.current=setTimeout(()=>s(null),rf)},c=d=>{if(d.taskId!==e)return;const o={status:d.status,currentCommand:d.currentCommand,currentIndex:d.currentIndex,totalCommands:d.totalCommands,error:d.error};if(d.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,_=wi-p;l.current===0?(l.current=Date.now(),s({status:"running",totalCommands:d.totalCommands,currentIndex:d.totalCommands}),m.current=o,b.current=setTimeout(()=>i(o),wi)):_>0?(m.current=o,C(),b.current=setTimeout(()=>i(o),_)):i(o)};return r.on(We.WORKSPACE_SETUP_PROGRESS,c),()=>{r.off(We.WORKSPACE_SETUP_PROGRESS,c),C(),l.current=0,m.current=null}},[e]),t}function io(){const e=Ie();return Ge({mutationFn:t=>be.post(`/sessions/${t}/start`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ce.sessions.detail(s)})}})}function no(){const e=Ie();return Ge({mutationFn:t=>be.post(`/sessions/${t}/stop`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:ce.sessions.detail(s)})}})}function Nr(){const e=Ie();return Ge({mutationFn:({id:t,message:s})=>be.post(`/sessions/${t}/message`,{message:s}),onSuccess:()=>{e.invalidateQueries({queryKey:ce.workspaces.all})}})}function oo(e){const{data:t}=_r();return R.useMemo(()=>{const s=e?.providerId;return!s||!t?null:t.find(m=>m.provider.id===s)?.provider.name??null},[e?.providerId,t])}function ao(e,t){return R.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 of="/api";async function af(e){const t=new FormData;t.append("file",e);const s={};if(Yt()){const m=Vt();m&&(s.Authorization=`Bearer ${m}`)}const l=await fetch(`${of}/attachments/upload`,{method:"POST",body:t,headers:s});if(!l.ok){const m=await l.json().catch(()=>({}));throw new Error(m.error||`Upload failed (${l.status})`)}return l.json()}let lf=0;function Mr(){const[e,t]=R.useState([]),s=R.useRef(e);s.current=e;const l=R.useCallback(async c=>{const d=c.map(o=>({tempId:`tmp-${++lf}`,file:o,progress:0,status:"uploading"}));t(o=>[...o,...d]),await Promise.allSettled(d.map(async o=>{try{const p=await af(o.file);t(_=>_.map(S=>S.tempId===o.tempId?{...S,status:"done",progress:100,attachment:p}:S))}catch(p){t(_=>_.map(S=>S.tempId===o.tempId?{...S,status:"error",error:p instanceof Error?p.message:"Upload failed"}:S))}}))},[]),m=R.useCallback(c=>{t(d=>d.filter(o=>o.tempId!==c))},[]),b=R.useCallback(()=>{t([])},[]),C=R.useCallback(()=>{const c=s.current.filter(d=>d.status==="done"&&d.attachment);return c.length===0?"":c.map(d=>{const o=d.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:b,buildMarkdownLinks:C,hasFiles:r,isUploading:i}}const
|
|
68
|
+
`,Kd=({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:xe("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:xe("pl-2 whitespace-pre",l),children:e})]})},Xd=({workingDir:e,hash:t,filePath:s})=>{const{data:l,isLoading:m,isError:b}=Jn(e,t,s);if(m)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500",children:[a.jsx(Me,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(b)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-xs",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-xs",children:"No diff content available."});const r=C.split(`
|
|
69
|
+
`);return a.jsx("div",{className:"flex-1 overflow-auto history-scroll font-mono text-xs leading-5",children:r.map((i,c)=>a.jsx(Kd,{line:i,lineNum:c+1},c))})},Yd=({workingDir:e,hash:t,selectedPath:s,onSelectFile:l})=>{const{data:m,isLoading:b}=Zn(e,t);if(b)return a.jsxs("div",{className:"pl-7 py-1 text-xs text-neutral-400 flex items-center gap-1",children:[a.jsx(Me,{size:12,className:"animate-spin"}),a.jsx("span",{children:"Loading..."})]});const C=m?.files||[];return C.length===0?a.jsx("div",{className:"pl-7 py-1 text-xs text-neutral-400",children:"No files changed"}):a.jsx("div",{className:"pl-7 pb-1 space-y-0.5",children:C.map(r=>{const i=Ei[r.status]||Ei.M,c=Ud(r.path);return a.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),l(r.path)},className:xe("flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer w-full text-left",s===r.path?"bg-blue-50":"hover:bg-neutral-50"),children:[a.jsx("span",{className:xe("w-3.5 h-3.5 flex items-center justify-center text-[9px] font-bold border rounded-sm shrink-0",i),children:r.status}),a.jsx("span",{className:"text-[11px] text-neutral-900 truncate",children:$d(r.path)}),c&&a.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:c})]},r.path)})})},Vd=({workingDir:e})=>{const{data:t,isLoading:s,isError:l,fetchNextPage:m,hasNextPage:b,isFetchingNextPage:C}=Vi({queryKey:he.git.log(e||""),queryFn:({pageParam:v=0})=>_e.get("/git/log",{params:{workingDir:e||"",limit:String(Js),skip:String(v)}}),initialPageParam:0,getNextPageParam:(v,x)=>v.commits.length<Js?void 0:x.length*Js,enabled:!!e}),r=t?.pages.flatMap(v=>v.commits)||[],[i,c]=R.useState(null),[d,o]=R.useState(null),[p,_]=R.useState(280),[y,g]=R.useState(!1),n=R.useCallback(v=>{v.preventDefault(),g(!0);const x=v.clientX,w=p,k=E=>{const T=Math.min(480,Math.max(180,w+(E.clientX-x)));_(T)},S=()=>{g(!1),document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",k),document.addEventListener("mouseup",S)},[p]),f=v=>{i===v?(c(null),o(null)):(c(v),o(null))},h=R.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:"No workspace selected."});if(s)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500 bg-white h-full",children:[a.jsx(Me,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading history..."})]});if(l)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm bg-white h-full",children:"Failed to load history."});if(r.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(Nt,{size:28,className:"mb-2"}),a.jsx("span",{className:"text-xs",children:"No commit history"})]});const u=r.find(v=>v.hash===i);return a.jsxs("div",{className:"flex h-full bg-white",style:y?{userSelect:"none",cursor:"col-resize"}:void 0,children:[a.jsx("style",{children:qd}),a.jsxs("div",{className:"border-r border-neutral-200 flex flex-col shrink-0",style:{width:p},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(Nt,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-semibold text-neutral-900",children:"History"}),a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:r.length})]})}),a.jsxs("div",{ref:h,className:"flex-1 overflow-auto history-scroll p-1.5",children:[r.map(v=>{const x=i===v.hash;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>f(v.hash),className:xe("flex items-start gap-2 px-2 py-1.5 rounded cursor-pointer w-full text-left group",x?"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:xe("w-2 h-2 rounded-full shrink-0 transition-colors",x?"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:v.shortHash}),a.jsx("span",{className:"text-xs text-neutral-900 truncate flex-1",children:v.message}),a.jsx(kt,{size:12,className:xe("shrink-0 text-neutral-400 transition-transform",x&&"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:v.author}),a.jsx("span",{className:"text-[10px] text-neutral-400",children:Wd(v.timestamp)})]})]})]}),x&&a.jsxs(a.Fragment,{children:[v.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:v.body}),a.jsx(Yd,{workingDir:e,hash:v.hash,selectedPath:d,onSelectFile:o})]})]},v.hash)}),b&&a.jsx("button",{type:"button",onClick:()=>m(),disabled:C,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:C?a.jsxs(a.Fragment,{children:[a.jsx(Me,{size:12,className:"animate-spin"})," Loading..."]}):"Load more"})]})]}),a.jsx("div",{onMouseDown:n,className:xe("w-1 shrink-0 cursor-col-resize transition-colors",y?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:d&&i?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(qt,{size:14,className:"text-neutral-500"}),a.jsx("span",{className:"text-xs font-medium text-neutral-700 truncate",children:d}),a.jsxs("span",{className:"text-[10px] text-neutral-400",children:["(",u?.shortHash,")"]})]}),a.jsx(Xd,{workingDir:e,hash:i,filePath:d})]}):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(qt,{size:28}),a.jsx("span",{className:"text-xs",children:i?"Select a file to view diff":"Select a commit to view changes"})]})})})]})},Gd=[{key:"changes",label:"Changes",icon:a.jsx(Kt,{size:14})},{key:"history",label:"History",icon:a.jsx(Nt,{size:14})},{key:"editor",label:"Editor",icon:a.jsx(Ts,{size:14})},{key:"terminal",label:"Terminal",icon:a.jsx(ms,{size:14})},{key:"preview",label:"Preview",icon:a.jsx(ks,{size:14})}],Qd=[{key:"history",label:"History",icon:a.jsx(Nt,{size:14})},{key:"editor",label:"Editor",icon:a.jsx(Ts,{size:14})},{key:"terminal",label:"Terminal",icon:a.jsx(ms,{size:14})},{key:"preview",label:"Preview",icon:a.jsx(ks,{size:14})}],Zd=({active:e,onClick:t,icon:s,label:l})=>a.jsxs("button",{onClick:t,className:xe("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})]}),Jd=({icon:e,title:t})=>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:t}),a.jsx("span",{className:"text-xs",children:"Coming soon..."})]})}),eo=ee.memo(function({className:t,sessionId:s,workingDir:l,projectId:m,hideChanges:b}){const C=b?Qd:Gd,[r,i]=R.useState(b?"history":"changes"),{data:c}=$o(m??""),d=R.useMemo(()=>{if(!c?.quickCommands)return[];try{return JSON.parse(c.quickCommands)}catch{return[]}},[c?.quickCommands]),[o,p]=R.useState([]),_=R.useRef(void 0);return R.useEffect(()=>{l&&l!==_.current&&(_.current=l,p(y=>y.includes(l)?y:[...y,l]))},[l]),a.jsxs("div",{className:xe("flex flex-col h-full bg-white",t),children:[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(y=>a.jsx(Zd,{active:r===y.key,onClick:()=>i(y.key),icon:y.icon,label:y.label},y.key))}),a.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[r==="editor"&&a.jsx(Md,{workingDir:l}),o.map(y=>a.jsx("div",{className:"h-full absolute inset-0",style:{display:r==="terminal"&&l===y?"block":"none"},children:a.jsx(Kc,{cwd:y,quickCommands:d})},y)),r==="preview"&&a.jsx(Jd,{icon:a.jsx(ks,{size:32}),title:"Preview"}),r==="changes"&&a.jsx(zd,{workingDir:l}),r==="history"&&a.jsx(Vd,{workingDir:l})]})]})});function to(e){return ct({queryKey:he.workspaces.list(e),queryFn:()=>_e.get(`/tasks/${e}/workspaces`),enabled:!!e})}function ef(e){const t=Pe();return Ve({mutationFn:s=>_e.post(`/tasks/${e}/workspaces`,s),onSuccess:()=>{t.invalidateQueries({queryKey:he.workspaces.list(e)}),t.invalidateQueries({queryKey:he.tasks.all})}})}function tf(){const e=Pe();return Ve({mutationFn:({id:t,commitMessage:s})=>_e.post(`/workspaces/${t}/merge`,{commitMessage:s}),onSuccess:()=>{e.invalidateQueries({queryKey:he.workspaces.all}),e.invalidateQueries({queryKey:he.tasks.all})}})}function Ar(){return Ve({mutationFn:({workspaceId:e,editorType:t})=>_e.post(`/workspaces/${e}/open-editor`,{editorType:t})})}function so(e){return ct({queryKey:he.workspaces.gitStatus(e),queryFn:()=>_e.get(`/workspaces/${e}/git-status`),enabled:!!e})}function sf(){const e=Pe();return Ve({mutationFn:t=>_e.post(`/workspaces/${t}/rebase`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:he.workspaces.gitStatus(s)})},onError:(t,s)=>{e.invalidateQueries({queryKey:he.workspaces.gitStatus(s)})}})}function rf(){const e=Pe();return Ve({mutationFn:t=>_e.post(`/workspaces/${t}/abort-operation`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:he.workspaces.gitStatus(s)})}})}const ki=1500,nf=3e3;function of(e){const[t,s]=R.useState(null),l=R.useRef(0),m=R.useRef(null),b=R.useRef(null);return R.useEffect(()=>{if(!e)return;const C=()=>{b.current&&(clearTimeout(b.current),b.current=null)},r=ft.connect();r.emit(at.SUBSCRIBE,{topic:"task",id:e},d=>{});const i=d=>{s(d),b.current=setTimeout(()=>s(null),nf)},c=d=>{if(d.taskId!==e)return;const o={status:d.status,currentCommand:d.currentCommand,currentIndex:d.currentIndex,totalCommands:d.totalCommands,error:d.error};if(d.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,_=ki-p;l.current===0?(l.current=Date.now(),s({status:"running",totalCommands:d.totalCommands,currentIndex:d.totalCommands}),m.current=o,b.current=setTimeout(()=>i(o),ki)):_>0?(m.current=o,C(),b.current=setTimeout(()=>i(o),_)):i(o)};return r.on(We.WORKSPACE_SETUP_PROGRESS,c),()=>{r.off(We.WORKSPACE_SETUP_PROGRESS,c),C(),l.current=0,m.current=null}},[e]),t}function ro(){const e=Pe();return Ve({mutationFn:t=>_e.post(`/sessions/${t}/start`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:he.sessions.detail(s)})}})}function io(){const e=Pe();return Ve({mutationFn:t=>_e.post(`/sessions/${t}/stop`),onSuccess:(t,s)=>{e.invalidateQueries({queryKey:he.sessions.detail(s)})}})}function Nr(){const e=Pe();return Ve({mutationFn:({id:t,message:s,providerId:l})=>_e.post(`/sessions/${t}/message`,{message:s,providerId:l}),onSuccess:()=>{e.invalidateQueries({queryKey:he.workspaces.all})}})}function no(e,t){return R.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 af="/api";async function lf(e){const t=new FormData;t.append("file",e);const s={};if(Qt()){const m=Zt();m&&(s.Authorization=`Bearer ${m}`)}const l=await fetch(`${af}/attachments/upload`,{method:"POST",body:t,headers:s});if(!l.ok){const m=await l.json().catch(()=>({}));throw new Error(m.error||`Upload failed (${l.status})`)}return l.json()}let cf=0;function Mr(){const[e,t]=R.useState([]),s=R.useRef(e);s.current=e;const l=R.useCallback(async c=>{const d=c.map(o=>({tempId:`tmp-${++cf}`,file:o,progress:0,status:"uploading"}));t(o=>[...o,...d]),await Promise.allSettled(d.map(async o=>{try{const p=await lf(o.file);t(_=>_.map(y=>y.tempId===o.tempId?{...y,status:"done",progress:100,attachment:p}:y))}catch(p){t(_=>_.map(y=>y.tempId===o.tempId?{...y,status:"error",error:p instanceof Error?p.message:"Upload failed"}:y))}}))},[]),m=R.useCallback(c=>{t(d=>d.filter(o=>o.tempId!==c))},[]),b=R.useCallback(()=>{t([])},[]),C=R.useCallback(()=>{const c=s.current.filter(d=>d.status==="done"&&d.attachment);return c.length===0?"":c.map(d=>{const o=d.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:b,buildMarkdownLinks:C,hasFiles:r,isUploading:i}}const hf="/api";function uf(e){if(!Qt())return e;const t=Zt();if(!t)return e;const s=e.includes("?")?"&":"?";return`${e}${s}token=${encodeURIComponent(t)}`}function df(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function ws({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(ff,{item:s,onRemove:t},s.tempId))})}function ff({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(`${hf}${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(Me,{size:16,className:"animate-spin text-neutral-400"}):s?a.jsx(br,{size:16,className:"text-neutral-400"}):a.jsx(en,{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:df(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(Rs,{size:10})})]})}function oo({isOpen:e,onClose:t,taskId:s,taskTitle:l,taskDescription:m}){const[b,C]=R.useState(""),[r,i]=R.useState(""),[c,d]=R.useState("idle"),[o,p]=R.useState(null),_=Pe(),y=ef(s),g=ro(),{data:n,isLoading:f}=Ds();R.useEffect(()=>{if(!e||!n)return;const x=n.find(w=>w.availability.type!=="NOT_FOUND");x&&C(x.provider.id)},[e,n]),R.useEffect(()=>{if(e){const x=[l];m&&x.push(m),i(x.join(`
|
|
71
71
|
|
|
72
|
-
`)),d("idle"),p(null)}},[e,l,m]);const h=c!=="idle",u=async()=>{if(!(!b||!r.trim())){p(null);try{d("creating-workspace");const x=await
|
|
72
|
+
`)),d("idle"),p(null)}},[e,l,m]);const h=c!=="idle",u=async()=>{if(!(!b||!r.trim())){p(null);try{d("creating-workspace");const x=await y.mutateAsync({});d("creating-session");const w=await _e.post(`/workspaces/${x.id}/sessions`,{providerId:b,prompt:r.trim()});d("starting-session"),await g.mutateAsync(w.id),await _.invalidateQueries({queryKey:he.workspaces.list(s)}),d("idle"),t()}catch(x){d("idle"),p(x instanceof Error?x.message:"启动失败,请重试")}}},v={idle:"启动","creating-workspace":"创建工作空间...","creating-session":"创建会话...","starting-session":"启动 Agent..."};return a.jsx(js,{isOpen:e,onClose:h?()=>{}:t,title:"启动 Agent",action:a.jsxs(a.Fragment,{children:[a.jsx(lt,{variant:"outline",onClick:t,disabled:h,children:"取消"}),a.jsx(lt,{onClick:u,disabled:h||!b||!r.trim(),children:v[c]})]}),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:"选择 Provider"}),a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[f&&a.jsx("span",{className:"text-sm text-neutral-400",children:"加载中..."}),n?.map(({provider:x,availability:w})=>{const k=w.type!=="NOT_FOUND";return a.jsxs(lt,{variant:b===x.id?"default":"outline",size:"sm",disabled:!k||h,onClick:()=>C(x.id),children:[x.name,!k&&" (不可用)"]},x.id)})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-2",children:"任务描述"}),a.jsx("textarea",{value:r,onChange:x=>i(x.target.value),rows:5,disabled:h,placeholder:"描述你想让 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"})]}),o&&a.jsx("div",{className:"text-sm text-red-600 bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:o})]})})}function ao({providers:e,currentProviderId:t,agentType:s,onSelect:l}){const[m,b]=R.useState(!1),C=R.useRef(null),r=e.filter(c=>String(c.provider.agentType)===s),i=e.find(c=>c.provider.id===t);return R.useEffect(()=>{function c(d){C.current&&!C.current.contains(d.target)&&b(!1)}if(m)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[m]),r.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(Or,{size:14,className:"shrink-0"}),a.jsx("span",{children:i?.provider.name?zr(i.provider.name,12):s})]}):a.jsxs("div",{className:"relative",ref:C,children:[a.jsxs("button",{onClick:()=>b(!m),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: ${i?.provider.name??s} (click to change)`,children:[a.jsx(Or,{size:14,className:"shrink-0"}),a.jsx("span",{children:i?.provider.name?zr(i.provider.name,12):s}),a.jsx(mt,{size:12,className:`shrink-0 transition-transform ${m?"rotate-180":""}`})]}),m&&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:"切换渠道"}),r.map(c=>a.jsxs("button",{onClick:()=>{l(c.provider.id),b(!1)},className:`w-full flex items-center justify-between px-3 py-2 text-sm text-left hover:bg-neutral-50 transition-colors ${c.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:c.provider.name}),c.provider.isDefault&&a.jsx("span",{className:"text-xs text-neutral-400",children:"(默认)"})]}),c.provider.id===t&&a.jsx(Ut,{size:14,className:"shrink-0"})]},c.provider.id))]})]})}const lo=({isOpen:e,onClose:t,onConfirm:s,title:l,description:m,confirmText:b="确认",cancelText:C="取消",variant:r="default",isLoading:i=!1})=>{const c=r==="danger";return a.jsx(js,{isOpen:e,onClose:t,title:l,className:"max-w-sm",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:t,disabled:i,className:"px-4 py-2 text-sm font-medium text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:C}),a.jsx("button",{onClick:s,disabled:i,className:xe("px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50",c?"bg-red-500 text-white hover:bg-red-600":"bg-neutral-900 text-white hover:bg-black"),children:i?"处理中...":b})]}),children:a.jsxs("div",{className:"flex gap-4",children:[c&&a.jsx("div",{className:"shrink-0 w-10 h-10 rounded-full bg-red-50 flex items-center justify-center",children:a.jsx(xr,{size:20,className:"text-red-500"})}),a.jsx("div",{className:"text-sm text-neutral-600 leading-relaxed pt-1",children:m})]})})};function pf({workspaceId:e,gitStatus:t,onResolve:s}){const l=rf();if(t.operation==="idle"||t.conflictedFiles.length===0)return null;const m=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(xr,{size:18,className:"text-amber-600 shrink-0"}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("p",{className:"text-sm font-medium text-amber-900",children:[m," 冲突 — ",t.conflictedFiles.length," 个文件"]})}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsx(lt,{variant:"outline",size:"sm",onClick:()=>l.mutate(e),disabled:l.isPending,children:"中止操作"}),a.jsx(lt,{size:"sm",onClick:s,children:"解决冲突"})]})]})}function mf(e,t,s,l){const m=s.map(b=>`- ${b}`).join(`
|
|
73
73
|
`);return l===Ho.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 mf({open:e,onOpenChange:t,workspaceId:s,conflictOp:l,conflictedFiles:m,sourceBranch:b,targetBranch:C,sessions:r}){const[i,c]=R.useState(""),d=Nr(),o=Ar(),p=()=>{if(!i)return;const g=pf(b,C,m,l);d.mutate({id:i,message:g},{onSuccess:()=>t(!1)})},_=()=>{o.mutate({workspaceId:s},{onSuccess:()=>t(!1)})},S=l==="REBASE"?"Rebase":"Merge";return a.jsx(Rs,{isOpen:e,onClose:()=>t(!1),title:`解决 ${S} 冲突`,action:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ot,{variant:"outline",onClick:_,children:"在 IDE 中打开"}),a.jsx(ot,{onClick:p,disabled:!i||d.isPending,children:d.isPending?"发送中...":"AI 辅助解决"})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:["冲突文件(",m.length,")"]}),a.jsx("div",{className:"max-h-40 overflow-y-auto rounded-md border border-neutral-200 bg-neutral-50",children:m.map(g=>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:g},g))})]}),r.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:"选择 Session(AI 辅助解决)"}),a.jsxs("select",{value:i,onChange:g=>c(g.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:"选择一个 Session..."}),r.map(g=>a.jsxs("option",{value:g.id,children:[g.agentType," — ",g.status]},g.id))]})]}),r.length===0&&a.jsx("p",{className:"text-sm text-neutral-500",children:"没有可用的 Session,请在 IDE 中手动解决冲突。"})]})})}function Ct({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 vf({gitStatus:e,branchName:t,targetBranch:s}){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(Qi,{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(Ct,{variant:"danger",children:[a.jsx(aa,{size:12}),e.uncommittedCount," 个未提交变更"]}),e.conflictedFiles.length>0&&a.jsxs(Ct,{variant:"warning",children:[a.jsx(xr,{size:12}),e.conflictedFiles.length," 个冲突文件"]}),e.operation==="rebase"&&e.conflictedFiles.length===0&&a.jsxs(Ct,{variant:"warning",children:[a.jsx(Be,{size:12,className:"animate-spin"}),"变基进行中"]}),e.operation==="merge"&&e.conflictedFiles.length===0&&a.jsxs(Ct,{variant:"warning",children:[a.jsx(Be,{size:12,className:"animate-spin"}),"合并进行中"]}),e.ahead>0&&a.jsxs(Ct,{variant:"success",children:[a.jsx(zr,{size:12}),"领先 ",e.ahead," 个提交"]}),e.behind>0&&a.jsxs(Ct,{variant:"warning",children:["落后 ",e.behind," 个提交"]}),e.operation==="idle"&&e.ahead===0&&e.behind===0&&!e.hasUncommittedChanges&&a.jsxs(Ct,{variant:"neutral",children:[a.jsx(zr,{size:12}),"已是最新"]})]}),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:"工作区有未提交的变更,请先让 Agent 提交或手动处理后再执行 Rebase / Merge 操作。"})]})}function gf({open:e,onOpenChange:t,workspaceId:s,branchName:l,targetBranch:m,commitMessage:b,onConflict:C}){const{data:r,isLoading:i}=ro(s),c=tf(),d=ef(),[o,p]=R.useState(null),[_,S]=R.useState("select"),[g,n]=R.useState(""),f=r?r.conflictedFiles.length>0:!1,h=r?r.operation!=="idle":!1,u=r?.hasUncommittedChanges??!1;R.useEffect(()=>{e&&(S("select"),p(null),n(b??""))},[e,b]);const v=()=>{p(null),c.mutate(s,{onSuccess:()=>t(!1),onError:y=>{const E=y;E.status===409?(t(!1),C()):p(E.message??"变基失败")}})},x=()=>{p(null),S("confirm")},w=()=>{p(null);const y=g.trim()||void 0;d.mutate({id:s,commitMessage:y},{onSuccess:()=>t(!1),onError:E=>{const j=E;j.status===409?(t(!1),C()):p(j.message??"合并失败")}})},k=_==="confirm"?"确认合并":"Git 操作";return a.jsx(Rs,{isOpen:e,onClose:()=>t(!1),title:k,children:i||!r?a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-neutral-400",children:[a.jsx(Be,{size:18,className:"animate-spin"}),a.jsx("span",{className:"text-sm",children:"加载分支状态..."})]}):_==="confirm"?a.jsx(bf,{editableMessage:g,setEditableMessage:n,error:o,isPending:d.isPending,onConfirm:w,onBack:()=>S("select"),branchName:l,targetBranch:m}):a.jsx(_f,{gitStatus:r,branchName:l,targetBranch:m,error:o,isDirty:u,hasConflicts:f,isOperationInProgress:h,rebasePending:c.isPending,mergePending:d.isPending,onRebase:v,onMerge:x})})}function _f({gitStatus:e,branchName:t,targetBranch:s,error:l,isDirty:m,hasConflicts:b,isOperationInProgress:C,rebasePending:r,mergePending:i,onRebase:c,onMerge:d}){return a.jsxs("div",{className:"space-y-5",children:[a.jsx(vf,{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||b||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(fa,{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:r?"变基中...":"变基 (Rebase)"}),a.jsxs("div",{className:"text-xs text-neutral-500",children:["将当前分支变基到最新的 ",s]})]})]}),a.jsxs("button",{onClick:d,disabled:i||b||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(sn,{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:i?"合并中...":"合并 (Merge)"}),a.jsxs("div",{className:"text-xs text-neutral-500",children:["Squash merge 到 ",s]})]})]})]})]})}function bf({editableMessage:e,setEditableMessage:t,error:s,isPending:l,onConfirm:m,onBack:b,branchName:C,targetBranch:r}){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(Qi,{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:"提交消息"}),a.jsx("textarea",{value:e,onChange:i=>t(i.target.value),placeholder:"输入提交消息...",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:"留空将使用默认消息"})]}),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:b,disabled:l,className:"px-4 py-2 rounded-md text-sm text-neutral-600 hover:bg-neutral-100 transition-colors disabled:opacity-50",children:"返回"}),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(Be,{size:14,className:"animate-spin"}),"合并中..."]}):a.jsxs(a.Fragment,{children:[a.jsx(sn,{size:14}),"确认合并"]})})]})]})}const xf="/api";function Sf(e){if(!Yt())return e;const t=Vt();if(!t)return e;const s=e.includes("?")?"&":"?";return`${e}${s}token=${encodeURIComponent(t)}`}const yf=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?Sf(`${xf}/attachments/by-path?path=${encodeURIComponent(e)}`):e,Cf=({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"})}),wf={img:Cf},Ef=675,Ei=320,ki=1200,kf=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:"Select a task from the sidebar to view logs, monitor execution, or interact with an agent."})]}),Ri=[{status:le.Review,className:"bg-amber-50 text-amber-700 border-amber-100",hoverClass:"hover:bg-amber-100",icon:a.jsx(fr,{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(pr,{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(vr,{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(gr,{className:"w-3 h-3"})}];function Rf({status:e,onChangeStatus:t}){const[s,l]=R.useState(!1),m=R.useRef(null);R.useEffect(()=>{if(!s)return;const C=r=>{m.current&&!m.current.contains(r.target)&&l(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const b=Ri.find(C=>C.status===e);return a.jsxs("div",{className:"relative",ref:m,children:[a.jsxs("button",{onClick:()=>t&&l(C=>!C),className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border transition-colors ${b.className} ${t?"cursor-pointer hover:opacity-80":""}`,children:[b.icon,a.jsx("span",{children:e}),t&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-0.5 transition-transform ${s?"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"})})]}),s&&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:Ri.filter(C=>C.status!==e).map(C=>a.jsxs("button",{onClick:()=>{t?.(C.status),l(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-xs font-medium transition-colors ${C.hoverClass}`,children:[a.jsx("span",{className:C.className.split(" ").find(r=>r.startsWith("text-")),children:C.icon}),a.jsx("span",{className:"text-neutral-700",children:C.status})]},C.status))})]})}function Df({task:e,onDeleteTask:t,isDeleting:s,onTaskStatusChange:l}){const[m,b]=R.useState(""),[C,r]=R.useState(!1),[i,c]=R.useState(!1),[d,o]=R.useState(!1),[p,_]=R.useState(!1),[S,g]=R.useState(!1),n=R.useRef(null),f=R.useRef(null),h=R.useRef(null),{scrollRef:u,contentRef:v,isAtBottom:x,scrollToBottom:w}=Cn({resize:"smooth",initial:"instant"}),[k,y]=R.useState(Ef),[E,j]=R.useState(!0),[A,L]=R.useState(!1),N=R.useRef(0),B=R.useRef(0),I=R.useRef(null),{data:H,isLoading:W}=so(e?.id??""),D=nf(e?.id),M=R.useMemo(()=>{if(!H)return null;const G=Ce=>{const ct=Ce.createdAt,tt=Ce.endedAt??Ce.startedAt??ct;if(!tt)return 0;const Xe=Date.parse(tt);return Number.isNaN(Xe)?0:Xe},te=(Ce,ct)=>{const tt=Ce.filter(Xe=>ct.includes(Xe.status));return tt.length===0?null:tt.sort((Xe,yt)=>G(yt)-G(Xe))[0]??null},de=H.filter(Ce=>Ce.status==="ACTIVE"&&Array.isArray(Ce.sessions)).flatMap(Ce=>Ce.sessions??[]),Ke=te(de,[Oe.RUNNING])??te(de,[Oe.PENDING])??te(de,[Oe.COMPLETED,Oe.FAILED,Oe.CANCELLED]);if(Ke)return Ke;const Pe=H.filter(Ce=>Ce.status==="MERGED"&&Array.isArray(Ce.sessions)).flatMap(Ce=>Ce.sessions??[]);return te(Pe,[Oe.COMPLETED,Oe.FAILED,Oe.CANCELLED])},[H]),P=M?.id??"",O=M?.status===Oe.RUNNING||M?.status===Oe.PENDING,U=oo(M),K=R.useMemo(()=>!M||!H?!1:!H.some(te=>te.status==="ACTIVE"&&te.sessions?.some(de=>de.id===M.id)),[M,H]),V=R.useMemo(()=>{if(H){for(const G of H)if(G.status==="ACTIVE"&&G.worktreePath)return G.worktreePath;return H[0]?.worktreePath}},[H]),Y=R.useMemo(()=>H?H.find(te=>te.status==="ACTIVE")?.id:void 0,[H]),{data:ie}=ro(Y??""),T=R.useMemo(()=>H?H.find(te=>te.status==="ACTIVE")?.sessions??[]:[],[H]),F=R.useMemo(()=>H?H.find(te=>te.status==="ACTIVE")?.branchName??"":"",[H]),$=R.useMemo(()=>H?H.find(te=>te.status==="ACTIVE")?.commitMessage:void 0,[H]),z=Ie();R.useEffect(()=>{if(!S)return;const G=te=>{n.current&&!n.current.contains(te.target)&&g(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[S]);const J=Nr(),X=Ar(),oe=R.useCallback(()=>{Y&&X.mutate({workspaceId:Y})},[Y,X]),he=R.useCallback(()=>{!e?.id||!t||(t(e.id),c(!1))},[e?.id,t]),{isConnected:we,isLoadingSnapshot:je,logs:Z,entries:ze,attach:Fe}=zi({sessionId:P,onExit:R.useCallback(()=>{z.invalidateQueries({queryKey:["workspaces"]})},[z])});R.useEffect(()=>{if(!e?.id)return;const G=ht.connect();G.emit(nt.SUBSCRIBE,{topic:"task",id:e.id});const te=de=>{de.taskId===e.id&&z.invalidateQueries({queryKey:["tasks"]})};return G.on(We.TASK_UPDATED,te),()=>{G.off(We.TASK_UPDATED,te),G.emit(nt.UNSUBSCRIBE,{topic:"task",id:e.id})}},[e?.id,z]),R.useEffect(()=>{if(!P)return;const G=ht.connect(),te=de=>{de.sessionId===P&&z.invalidateQueries({queryKey:["workspaces"]})};return G.on(We.SESSION_COMPLETED,te),()=>{G.off(We.SESSION_COMPLETED,te)}},[P,z]);const{todos:Re}=Wi(ze),{files:Q,addFiles:se,removeFile:ue,clear:ne,buildMarkdownLinks:ge,hasFiles:me,isUploading:ye}=Mr(),Le=R.useMemo(()=>{if(!M?.tokenUsage)return;const G=M.tokenUsage;if(typeof G.totalTokens=="number")return G},[M?.tokenUsage]),Ve=ao(Z,Le);R.useEffect(()=>{P&&we&&Fe()},[P,we,Fe]);const Ae=R.useRef(e?.id);R.useEffect(()=>{Ae.current!==e?.id&&w(),Ae.current=e?.id},[e?.id,w]);const Ne=no(),_e=R.useRef(!1),et=R.useCallback(async()=>{if(!m.trim()&&!me||!P||_e.current||ye)return;_e.current=!0;const G=ge(),te=[m.trim(),G].filter(Boolean).join(`
|
|
75
|
+
`)}function vf({open:e,onOpenChange:t,workspaceId:s,conflictOp:l,conflictedFiles:m,sourceBranch:b,targetBranch:C,sessions:r}){const[i,c]=R.useState(""),d=Nr(),o=Ar(),p=()=>{if(!i)return;const g=mf(b,C,m,l);d.mutate({id:i,message:g},{onSuccess:()=>t(!1)})},_=()=>{o.mutate({workspaceId:s},{onSuccess:()=>t(!1)})},y=l==="REBASE"?"Rebase":"Merge";return a.jsx(js,{isOpen:e,onClose:()=>t(!1),title:`解决 ${y} 冲突`,action:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(lt,{variant:"outline",onClick:_,children:"在 IDE 中打开"}),a.jsx(lt,{onClick:p,disabled:!i||d.isPending,children:d.isPending?"发送中...":"AI 辅助解决"})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:["冲突文件(",m.length,")"]}),a.jsx("div",{className:"max-h-40 overflow-y-auto rounded-md border border-neutral-200 bg-neutral-50",children:m.map(g=>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:g},g))})]}),r.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:"选择 Session(AI 辅助解决)"}),a.jsxs("select",{value:i,onChange:g=>c(g.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:"选择一个 Session..."}),r.map(g=>a.jsxs("option",{value:g.id,children:[g.agentType," — ",g.status]},g.id))]})]}),r.length===0&&a.jsx("p",{className:"text-sm text-neutral-500",children:"没有可用的 Session,请在 IDE 中手动解决冲突。"})]})})}function Ct({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 gf({gitStatus:e,branchName:t,targetBranch:s}){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(Qi,{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(Ct,{variant:"danger",children:[a.jsx(aa,{size:12}),e.uncommittedCount," 个未提交变更"]}),e.conflictedFiles.length>0&&a.jsxs(Ct,{variant:"warning",children:[a.jsx(xr,{size:12}),e.conflictedFiles.length," 个冲突文件"]}),e.operation==="rebase"&&e.conflictedFiles.length===0&&a.jsxs(Ct,{variant:"warning",children:[a.jsx(Me,{size:12,className:"animate-spin"}),"变基进行中"]}),e.operation==="merge"&&e.conflictedFiles.length===0&&a.jsxs(Ct,{variant:"warning",children:[a.jsx(Me,{size:12,className:"animate-spin"}),"合并进行中"]}),e.ahead>0&&a.jsxs(Ct,{variant:"success",children:[a.jsx($r,{size:12}),"领先 ",e.ahead," 个提交"]}),e.behind>0&&a.jsxs(Ct,{variant:"warning",children:["落后 ",e.behind," 个提交"]}),e.operation==="idle"&&e.ahead===0&&e.behind===0&&!e.hasUncommittedChanges&&a.jsxs(Ct,{variant:"neutral",children:[a.jsx($r,{size:12}),"已是最新"]})]}),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:"工作区有未提交的变更,请先让 Agent 提交或手动处理后再执行 Rebase / Merge 操作。"})]})}function _f({open:e,onOpenChange:t,workspaceId:s,branchName:l,targetBranch:m,commitMessage:b,onConflict:C}){const{data:r,isLoading:i}=so(s),c=sf(),d=tf(),[o,p]=R.useState(null),[_,y]=R.useState("select"),[g,n]=R.useState(""),f=r?r.conflictedFiles.length>0:!1,h=r?r.operation!=="idle":!1,u=r?.hasUncommittedChanges??!1;R.useEffect(()=>{e&&(y("select"),p(null),n(b??""))},[e,b]);const v=()=>{p(null),c.mutate(s,{onSuccess:()=>t(!1),onError:S=>{const E=S;E.status===409?(t(!1),C()):p(E.message??"变基失败")}})},x=()=>{p(null),y("confirm")},w=()=>{p(null);const S=g.trim()||void 0;d.mutate({id:s,commitMessage:S},{onSuccess:()=>t(!1),onError:E=>{const T=E;T.status===409?(t(!1),C()):p(T.message??"合并失败")}})},k=_==="confirm"?"确认合并":"Git 操作";return a.jsx(js,{isOpen:e,onClose:()=>t(!1),title:k,children:i||!r?a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-neutral-400",children:[a.jsx(Me,{size:18,className:"animate-spin"}),a.jsx("span",{className:"text-sm",children:"加载分支状态..."})]}):_==="confirm"?a.jsx(xf,{editableMessage:g,setEditableMessage:n,error:o,isPending:d.isPending,onConfirm:w,onBack:()=>y("select"),branchName:l,targetBranch:m}):a.jsx(bf,{gitStatus:r,branchName:l,targetBranch:m,error:o,isDirty:u,hasConflicts:f,isOperationInProgress:h,rebasePending:c.isPending,mergePending:d.isPending,onRebase:v,onMerge:x})})}function bf({gitStatus:e,branchName:t,targetBranch:s,error:l,isDirty:m,hasConflicts:b,isOperationInProgress:C,rebasePending:r,mergePending:i,onRebase:c,onMerge:d}){return a.jsxs("div",{className:"space-y-5",children:[a.jsx(gf,{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||b||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(fa,{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:r?"变基中...":"变基 (Rebase)"}),a.jsxs("div",{className:"text-xs text-neutral-500",children:["将当前分支变基到最新的 ",s]})]})]}),a.jsxs("button",{onClick:d,disabled:i||b||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(sn,{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:i?"合并中...":"合并 (Merge)"}),a.jsxs("div",{className:"text-xs text-neutral-500",children:["Squash merge 到 ",s]})]})]})]})]})}function xf({editableMessage:e,setEditableMessage:t,error:s,isPending:l,onConfirm:m,onBack:b,branchName:C,targetBranch:r}){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(Qi,{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:"提交消息"}),a.jsx("textarea",{value:e,onChange:i=>t(i.target.value),placeholder:"输入提交消息...",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:"留空将使用默认消息"})]}),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:b,disabled:l,className:"px-4 py-2 rounded-md text-sm text-neutral-600 hover:bg-neutral-100 transition-colors disabled:opacity-50",children:"返回"}),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(Me,{size:14,className:"animate-spin"}),"合并中..."]}):a.jsxs(a.Fragment,{children:[a.jsx(sn,{size:14}),"确认合并"]})})]})]})}const Sf="/api";function yf(e){if(!Qt())return e;const t=Zt();if(!t)return e;const s=e.includes("?")?"&":"?";return`${e}${s}token=${encodeURIComponent(t)}`}const Cf=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?yf(`${Sf}/attachments/by-path?path=${encodeURIComponent(e)}`):e,wf=({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"})}),Ef={img:wf},kf=675,Ri=320,Di=1200,Rf=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:"Select a task from the sidebar to view logs, monitor execution, or interact with an agent."})]}),ji=[{status:le.Review,className:"bg-amber-50 text-amber-700 border-amber-100",hoverClass:"hover:bg-amber-100",icon:a.jsx(pr,{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(vr,{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(gr,{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(_r,{className:"w-3 h-3"})}];function Df({status:e,onChangeStatus:t}){const[s,l]=R.useState(!1),m=R.useRef(null);R.useEffect(()=>{if(!s)return;const C=r=>{m.current&&!m.current.contains(r.target)&&l(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const b=ji.find(C=>C.status===e);return a.jsxs("div",{className:"relative",ref:m,children:[a.jsxs("button",{onClick:()=>t&&l(C=>!C),className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border transition-colors ${b.className} ${t?"cursor-pointer hover:opacity-80":""}`,children:[b.icon,a.jsx("span",{children:e}),t&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-0.5 transition-transform ${s?"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"})})]}),s&&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:ji.filter(C=>C.status!==e).map(C=>a.jsxs("button",{onClick:()=>{t?.(C.status),l(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-xs font-medium transition-colors ${C.hoverClass}`,children:[a.jsx("span",{className:C.className.split(" ").find(r=>r.startsWith("text-")),children:C.icon}),a.jsx("span",{className:"text-neutral-700",children:C.status})]},C.status))})]})}function jf({task:e,onDeleteTask:t,isDeleting:s,onTaskStatusChange:l}){const[m,b]=R.useState(""),[C,r]=R.useState(!1),[i,c]=R.useState(!1),[d,o]=R.useState(!1),[p,_]=R.useState(!1),[y,g]=R.useState(!1),n=R.useRef(null),f=R.useRef(null),h=R.useRef(null),{scrollRef:u,contentRef:v,isAtBottom:x,scrollToBottom:w}=Cn({resize:"smooth",initial:"instant"}),[k,S]=R.useState(kf),[E,T]=R.useState(!0),[A,L]=R.useState(!1),M=R.useRef(0),B=R.useRef(0),I=R.useRef(null),{data:H,isLoading:W}=to(e?.id??""),D=of(e?.id),N=R.useMemo(()=>{if(!H)return null;const Y=ke=>{const Je=ke.createdAt,st=ke.endedAt??ke.startedAt??Je;if(!st)return 0;const nt=Date.parse(st);return Number.isNaN(nt)?0:nt},se=(ke,Je)=>{const st=ke.filter(nt=>Je.includes(nt.status));return st.length===0?null:st.sort((nt,Co)=>Y(Co)-Y(nt))[0]??null},Se=H.filter(ke=>ke.status==="ACTIVE"&&Array.isArray(ke.sessions)).flatMap(ke=>ke.sessions??[]),Ue=se(Se,[Ae.RUNNING])??se(Se,[Ae.PENDING])??se(Se,[Ae.COMPLETED,Ae.FAILED,Ae.CANCELLED]);if(Ue)return Ue;const Xe=H.filter(ke=>ke.status==="MERGED"&&Array.isArray(ke.sessions)).flatMap(ke=>ke.sessions??[]);return se(Xe,[Ae.COMPLETED,Ae.FAILED,Ae.CANCELLED])},[H]),P=N?.id??"",O=N?.status===Ae.RUNNING||N?.status===Ae.PENDING,{data:U}=Ds(),[X,V]=R.useState(null);R.useEffect(()=>{V(N?.providerId??null)},[N?.providerId]);const Q=R.useMemo(()=>!N||!H?!1:!H.some(se=>se.status==="ACTIVE"&&se.sessions?.some(Se=>Se.id===N.id)),[N,H]),ae=R.useMemo(()=>{if(H){for(const Y of H)if(Y.status==="ACTIVE"&&Y.worktreePath)return Y.worktreePath;return H[0]?.worktreePath}},[H]),j=R.useMemo(()=>H?H.find(se=>se.status==="ACTIVE")?.id:void 0,[H]),{data:F}=so(j??""),$=R.useMemo(()=>H?H.find(se=>se.status==="ACTIVE")?.sessions??[]:[],[H]),z=R.useMemo(()=>H?H.find(se=>se.status==="ACTIVE")?.branchName??"":"",[H]),Z=R.useMemo(()=>H?H.find(se=>se.status==="ACTIVE")?.commitMessage:void 0,[H]),K=Pe();R.useEffect(()=>{if(!y)return;const Y=se=>{n.current&&!n.current.contains(se.target)&&g(!1)};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[y]);const ne=Nr(),ue=Ar(),ye=R.useCallback(()=>{j&&ue.mutate({workspaceId:j})},[j,ue]),je=R.useCallback(()=>{!e?.id||!t||(t(e.id),c(!1))},[e?.id,t]),{isConnected:J,isLoadingSnapshot:He,logs:ze,entries:Oe,attach:Be}=Wi({sessionId:P,onExit:R.useCallback(()=>{K.invalidateQueries({queryKey:["workspaces"]})},[K])});R.useEffect(()=>{if(!e?.id)return;const Y=ft.connect();Y.emit(at.SUBSCRIBE,{topic:"task",id:e.id});const se=Se=>{Se.taskId===e.id&&K.invalidateQueries({queryKey:["tasks"]})};return Y.on(We.TASK_UPDATED,se),()=>{Y.off(We.TASK_UPDATED,se),Y.emit(at.UNSUBSCRIBE,{topic:"task",id:e.id})}},[e?.id,K]),R.useEffect(()=>{if(!P)return;const Y=ft.connect(),se=Se=>{Se.sessionId===P&&K.invalidateQueries({queryKey:["workspaces"]})};return Y.on(We.SESSION_COMPLETED,se),()=>{Y.off(We.SESSION_COMPLETED,se)}},[P,K]);const{todos:Te}=$i(Oe),{files:G,addFiles:ie,removeFile:fe,clear:te,buildMarkdownLinks:ge,hasFiles:ce,isUploading:Ce}=Mr(),Ne=R.useMemo(()=>{if(!N?.tokenUsage)return;const Y=N.tokenUsage;if(typeof Y.totalTokens=="number")return Y},[N?.tokenUsage]),Ie=no(ze,Ne);R.useEffect(()=>{P&&J&&Be()},[P,J,Be]);const be=R.useRef(e?.id);R.useEffect(()=>{be.current!==e?.id&&w(),be.current=e?.id},[e?.id,w]);const Qe=io(),ht=R.useRef(!1),ut=R.useCallback(async()=>{if(!m.trim()&&!ce||!P||ht.current||Ce)return;ht.current=!0;const Y=ge(),se=[m.trim(),Y].filter(Boolean).join(`
|
|
76
76
|
|
|
77
|
-
`);b(""),ne(),f.current&&(f.current.style.height="60px"),J.mutate({id:P,message:te},{onSuccess:()=>{Fe()},onSettled:()=>{_e.current=!1}})},[m,P,J,Fe,me,ye,ge,ne]),bt=R.useCallback(async()=>{P&&(await Ne.mutateAsync(P),z.invalidateQueries({queryKey:["workspaces"]}))},[P,Ne,z]),dt=R.useCallback(G=>{const te=G.target.files;te&&te.length>0&&se(Array.from(te)),G.target.value=""},[se]),xt=R.useCallback(G=>{const te=G.clipboardData.items,de=[];for(const Ke of te)if(Ke.kind==="file"){const Pe=Ke.getAsFile();Pe&&de.push(Pe)}de.length>0&&(G.preventDefault(),se(de))},[se]),[St,lt]=R.useState(!1),rs=R.useCallback(G=>{G.preventDefault(),lt(!0)},[]),q=R.useCallback(G=>{G.preventDefault(),lt(!1)},[]),re=R.useCallback(G=>{G.preventDefault(),lt(!1);const te=G.dataTransfer.files;te.length>0&&se(Array.from(te))},[se]),ae=R.useCallback(G=>{const te=G.clientX-N.current,de=Math.max(Ei,Math.min(B.current+te,ki));I.current&&(I.current.style.width=`${de}px`),B.current=B.current},[]),pe=R.useCallback(()=>{if(L(!1),I.current){const G=I.current.getBoundingClientRect().width;y(Math.max(Ei,Math.min(Math.round(G),ki)))}document.body.style.cursor="",document.body.style.userSelect=""},[]);R.useEffect(()=>{if(A)return document.addEventListener("mousemove",ae),document.addEventListener("mouseup",pe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",pe),document.body.style.cursor="",document.body.style.userSelect=""}},[A,ae,pe]);const xe=R.useCallback(G=>{G.preventDefault(),N.current=G.clientX,B.current=k,L(!0)},[k]),Me=R.useCallback(()=>{j(G=>!G)},[]),qe=R.useCallback(G=>{b(G.target.value);const te=G.target;te.style.height="auto";const de=te.scrollHeight;te.style.height=`${Math.max(60,Math.min(de,300))}px`},[]),Ue=R.useMemo(()=>{const G=[];if(H&&H.length>0){const te=H.some(Pe=>Pe.status==="ACTIVE"),de=H.some(Pe=>Pe.sessions?.some(Ce=>Ce.status===Oe.RUNNING||Ce.status===Oe.PENDING)),Ke=H.some(Pe=>Pe.status==="ACTIVE");de&&G.push("正在运行的 Agent 将被停止"),Ke&&G.push("分支上未合并的变更将丢失"),te&&G.push("关联的工作目录(worktree)将被清理")}return G},[H]);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}),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(Rf,{status:e.status,onChangeStatus:l?G=>l(e.id,G):void 0}),Y&&a.jsx("button",{onClick:()=>_(!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:"Git 操作",children:a.jsx(ma,{size:18})}),a.jsx("button",{onClick:oe,disabled:!Y,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:"Open in IDE",children:a.jsx(Ds,{size:18})}),a.jsx("button",{onClick:Me,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:"Toggle Workspace",children:E?a.jsx(ja,{size:18}):a.jsx(Aa,{size:18})}),t&&a.jsxs("div",{className:"relative",ref:n,children:[a.jsx("button",{onClick:()=>g(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:"More actions",children:a.jsx(Ji,{size:18})}),S&&a.jsx("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:()=>{c(!0),g(!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(Yi,{size:15}),a.jsx("span",{children:"删除任务"})]})})]})]})]}),Y&&ie&&a.jsx(ff,{workspaceId:Y,gitStatus:ie,onResolve:()=>o(!0)}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[a.jsxs("div",{ref:I,className:`flex flex-col bg-white relative ${E?"flex-shrink-0":"flex-1"}`,style:{width:E?k:"100%"},children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:u,className:"h-full overflow-y-auto px-6 pt-6 pb-4",children:a.jsxs("div",{ref:v,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($i,{urlTransform:yf,components:wf,children:e.description})}):a.jsx("p",{className:"text-sm text-neutral-400 italic",children:"No description"})}),D&&a.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-neutral-400 text-sm",children:[D.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.jsxs("span",{children:["Setup (",D.currentIndex,"/",D.totalCommands,"): ",a.jsx("code",{children:D.currentCommand})]})]}),D.status==="completed"&&a.jsx("span",{className:"text-emerald-600",children:"Setup 完成"}),D.status==="failed"&&a.jsxs("span",{className:"text-red-500",children:["Setup 失败: ",D.error]})]}),W?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:"Loading..."})]}):P?je?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:"Loading logs..."})]}):Z.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8",children:O?"Waiting for agent output...":"No logs recorded for this session."}):a.jsx(Ui,{logs:Z}):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(jt,{size:24,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-base font-medium text-neutral-900 mb-1.5",children:"尚未启动 Agent"}),a.jsx("p",{className:"text-sm text-neutral-500 mb-6 max-w-xs",children:"选择一个 Agent 来执行此任务,Agent 将自动创建工作空间并开始工作。"}),a.jsxs(ot,{onClick:()=>r(!0),children:[a.jsx(jt,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!x&&a.jsxs("button",{onClick:()=>w(),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":"Scroll to bottom",children:[a.jsx(Gi,{size:14}),a.jsx("span",{children:"回到底部"})]})]}),Re.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(qi,{todos:Re})}),K?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:"代码已合并,以上为历史沟通记录"}),a.jsxs(ot,{size:"sm",onClick:()=>r(!0),children:[a.jsx(jt,{size:14,className:"mr-1.5"}),"启动新 Agent"]})]})}):a.jsx("div",{className:"p-6 pt-2 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-transparent",onDragOver:rs,onDragLeave:q,onDrop:re,children:a.jsxs("div",{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(Cs,{files:Q,onRemove:ue}),a.jsx("textarea",{ref:f,value:m,onChange:qe,onPaste:xt,onKeyDown:G=>{G.key==="Enter"&&!G.shiftKey&&!G.repeat&&!G.nativeEvent.isComposing&&G.nativeEvent.keyCode!==229&&(G.preventDefault(),et())},rows:1,placeholder:St?"Drop files here...":P&&!O?"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:h,type:"file",multiple:!0,className:"hidden",onChange:dt}),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:()=>h.current?.click(),className:"p-2 text-neutral-400 hover:text-neutral-600 hover:bg-neutral-100 rounded-lg transition-colors",title:"Upload file",children:a.jsx(ds,{size:18})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[U&&a.jsx(wn,{content:U,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs text-neutral-400 px-2 py-1.5 select-none cursor-default",children:[a.jsx(Fi,{size:14,className:"shrink-0"}),a.jsx("span",{children:Xi(U,12)})]})}),a.jsx(En,{usage:Ve}),O&&!m.trim()&&!me?a.jsx("button",{onClick:bt,disabled:Ne.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(Ki,{size:14})}):a.jsx("button",{onClick:et,disabled:!m.trim()&&!me||ye,className:`p-2 rounded-lg transition-all duration-200 ${(m.trim()||me)&&!ye?"bg-neutral-900 text-white shadow-md hover:bg-black":"bg-transparent text-neutral-300 cursor-not-allowed"}`,children:a.jsx(Zi,{size:18})})]})]})]})})]}),E&&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:xe}),E&&a.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-white",children:a.jsx(to,{sessionId:P||void 0,workingDir:V,projectId:e.projectId})})]}),a.jsx(lo,{isOpen:C,onClose:()=>r(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),Y&&a.jsx(gf,{open:p,onOpenChange:_,workspaceId:Y,branchName:F,targetBranch:e.mainBranch,commitMessage:$,onConflict:()=>o(!0)}),Y&&ie&&ie.conflictOp&&a.jsx(mf,{open:d,onOpenChange:o,workspaceId:Y,conflictOp:ie.conflictOp,conflictedFiles:ie.conflictedFiles,sourceBranch:F,targetBranch:e.mainBranch,sessions:T}),a.jsx(co,{isOpen:i,onClose:()=>c(!1),onConfirm:he,title:"删除任务",description:a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),Ue.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:Ue.map((G,te)=>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})]},te))})]}),confirmText:"删除",variant:"danger",isLoading:s})]}):kf}function Tf(e){switch(e){case it.TODO:return le.Pending;case it.IN_PROGRESS:return le.Running;case it.IN_REVIEW:return le.Review;case it.DONE:return le.Done;case it.CANCELLED:return le.Cancelled}}function jf(e){switch(e){case le.Pending:return it.TODO;case le.Running:return it.IN_PROGRESS;case le.Review:return it.IN_REVIEW;case le.Done:return it.DONE;case le.Cancelled:return it.CANCELLED}}function Lf(e){switch(e){case is.CLAUDE_CODE:return"Claude Code";case is.GEMINI_CLI:return"Gemini CLI";case is.CURSOR_AGENT:return"Cursor Agent";case is.CODEX:return"Codex"}}const Di=["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 Af(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 Nf(e){return{id:e.id,name:e.name,color:e.color||Di[Af(e.name,Di.length)]}}function Mf(e){if(!e||e.length===0)return{agent:"—",branch:"—"};const t=e.find(m=>m.status==="ACTIVE")??e[0],s=t.branchName,l=t.sessions;if(l&&l.length>0){const m=l[l.length-1];return{agent:Lf(m.agentType),branch:s}}return{agent:"—",branch:s}}function Pf(e){const{agent:t,branch:s}=Mf(e.workspaces);return{id:e.id,projectId:e.projectId,title:e.title,status:Tf(e.status),agent:t,branch:s,description:e.description??""}}function Of(e,t){const s={};return at({queryKey:ce.tasks.list(e,t),queryFn:()=>be.get(`/projects/${e}/tasks`,{params:s}),enabled:!!e})}function Bf(e){const t=Ie();return Ge({mutationFn:s=>be.post(`/projects/${e}/tasks`,s),onSuccess:()=>{t.invalidateQueries({queryKey:ce.tasks.list(e)}),t.invalidateQueries({queryKey:ce.tasks.stats(e)})}})}function If(){const e=Ie();return Ge({mutationFn:({id:t,status:s})=>be.patch(`/tasks/${t}/status`,{status:s}),onSuccess:t=>{e.invalidateQueries({queryKey:ce.tasks.all}),e.invalidateQueries({queryKey:ce.tasks.detail(t.id)})}})}function Ff(){const e=Ie();return Ge({mutationFn:t=>be.delete(`/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:ce.tasks.all})}})}function Hf(e){const t=Ie(),s=R.useRef(new Set);R.useEffect(()=>{if(e.length===0)return;const l=ht.connect(),m=s.current,b=new Set(e);for(const i of b)m.has(i)||l.emit(nt.SUBSCRIBE,{topic:"project",id:i},c=>{c.success&&m.add(i)});for(const i of m)b.has(i)||l.emit(nt.UNSUBSCRIBE,{topic:"project",id:i},()=>{m.delete(i)});const C=i=>{t.invalidateQueries({queryKey:ce.tasks.list(i.projectId)}),t.invalidateQueries({queryKey:ce.tasks.detail(i.taskId)})},r=i=>{t.invalidateQueries({queryKey:ce.tasks.list(i.projectId)}),t.removeQueries({queryKey:ce.tasks.detail(i.taskId)})};return l.on(We.TASK_UPDATED,C),l.on(We.TASK_DELETED,r),()=>{l.off(We.TASK_UPDATED,C),l.off(We.TASK_DELETED,r);for(const i of m)l.emit(nt.UNSUBSCRIBE,{topic:"project",id:i});m.clear()}},[e,t])}const ho=768;function zf(e){const t=window.matchMedia(`(max-width: ${ho-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function Wf(){return window.innerWidth<ho}function $f(){return!1}function Uf(){return R.useSyncExternalStore(zf,Wf,$f)}const Ti={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 qf(e){const t=e.split("/");return t[t.length-1]||e}function Kf(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function Xf({workingDir:e,filePath:t,type:s}){const{data:l,isLoading:m,isError:b}=Zn(e,t,s);if(m)return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[a.jsx(Be,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(b)return a.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No diff content."});const r=C.split(`
|
|
78
|
-
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:r.map((i,c)=>{let d="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(d="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(d="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(d="bg-blue-950/30",o="text-blue-400"),a.jsx("div",{className:
|
|
79
|
-
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:r.map((i,c)=>{let d="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(d="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(d="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(d="bg-blue-950/30",o="text-blue-400"),a.jsx("div",{className:
|
|
77
|
+
`);b(""),te(),f.current&&(f.current.style.height="60px"),ne.mutate({id:P,message:se,providerId:X??void 0},{onSuccess:()=>{Be()},onSettled:()=>{ht.current=!1}})},[m,P,ne,Be,ce,Ce,ge,te,X]),St=R.useCallback(async()=>{P&&(await Qe.mutateAsync(P),K.invalidateQueries({queryKey:["workspaces"]}))},[P,Qe,K]),Rt=R.useCallback(Y=>{const se=Y.target.files;se&&se.length>0&&ie(Array.from(se)),Y.target.value=""},[ie]),yt=R.useCallback(Y=>{const se=Y.clipboardData.items,Se=[];for(const Ue of se)if(Ue.kind==="file"){const Xe=Ue.getAsFile();Xe&&Se.push(Xe)}Se.length>0&&(Y.preventDefault(),ie(Se))},[ie]),[Ot,q]=R.useState(!1),re=R.useCallback(Y=>{Y.preventDefault(),q(!0)},[]),oe=R.useCallback(Y=>{Y.preventDefault(),q(!1)},[]),pe=R.useCallback(Y=>{Y.preventDefault(),q(!1);const se=Y.dataTransfer.files;se.length>0&&ie(Array.from(se))},[ie]),me=R.useCallback(Y=>{const se=Y.clientX-M.current,Se=Math.max(Ri,Math.min(B.current+se,Di));I.current&&(I.current.style.width=`${Se}px`),B.current=B.current},[]),De=R.useCallback(()=>{if(L(!1),I.current){const Y=I.current.getBoundingClientRect().width;S(Math.max(Ri,Math.min(Math.round(Y),Di)))}document.body.style.cursor="",document.body.style.userSelect=""},[]);R.useEffect(()=>{if(A)return document.addEventListener("mousemove",me),document.addEventListener("mouseup",De),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",De),document.body.style.cursor="",document.body.style.userSelect=""}},[A,me,De]);const qe=R.useCallback(Y=>{Y.preventDefault(),M.current=Y.clientX,B.current=k,L(!0)},[k]),Ke=R.useCallback(()=>{T(Y=>!Y)},[]),Ze=R.useCallback(Y=>{b(Y.target.value);const se=Y.target;se.style.height="auto";const Se=se.scrollHeight;se.style.height=`${Math.max(60,Math.min(Se,300))}px`},[]),dt=R.useMemo(()=>{const Y=[];if(H&&H.length>0){const se=H.some(Xe=>Xe.status==="ACTIVE"),Se=H.some(Xe=>Xe.sessions?.some(ke=>ke.status===Ae.RUNNING||ke.status===Ae.PENDING)),Ue=H.some(Xe=>Xe.status==="ACTIVE");Se&&Y.push("正在运行的 Agent 将被停止"),Ue&&Y.push("分支上未合并的变更将丢失"),se&&Y.push("关联的工作目录(worktree)将被清理")}return Y},[H]);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}),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(Df,{status:e.status,onChangeStatus:l?Y=>l(e.id,Y):void 0}),j&&a.jsx("button",{onClick:()=>_(!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:"Git 操作",children:a.jsx(ma,{size:18})}),a.jsx("button",{onClick:ye,disabled:!j,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:"Open in IDE",children:a.jsx(Ts,{size:18})}),a.jsx("button",{onClick:Ke,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:"Toggle Workspace",children:E?a.jsx(Ta,{size:18}):a.jsx(Aa,{size:18})}),t&&a.jsxs("div",{className:"relative",ref:n,children:[a.jsx("button",{onClick:()=>g(Y=>!Y),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:"More actions",children:a.jsx(Ji,{size:18})}),y&&a.jsx("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:()=>{c(!0),g(!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(Yi,{size:15}),a.jsx("span",{children:"删除任务"})]})})]})]})]}),j&&F&&a.jsx(pf,{workspaceId:j,gitStatus:F,onResolve:()=>o(!0)}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[a.jsxs("div",{ref:I,className:`flex flex-col bg-white relative ${E?"flex-shrink-0":"flex-1"}`,style:{width:E?k:"100%"},children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:u,className:"h-full overflow-y-auto px-6 pt-6 pb-4",children:a.jsxs("div",{ref:v,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(Ui,{urlTransform:Cf,components:Ef,children:e.description})}):a.jsx("p",{className:"text-sm text-neutral-400 italic",children:"No description"})}),D&&a.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-neutral-400 text-sm",children:[D.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.jsxs("span",{children:["Setup (",D.currentIndex,"/",D.totalCommands,"): ",a.jsx("code",{children:D.currentCommand})]})]}),D.status==="completed"&&a.jsx("span",{className:"text-emerald-600",children:"Setup 完成"}),D.status==="failed"&&a.jsxs("span",{className:"text-red-500",children:["Setup 失败: ",D.error]})]}),W?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:"Loading..."})]}):P?He?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:"Loading logs..."})]}):ze.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8",children:O?"Waiting for agent output...":"No logs recorded for this session."}):a.jsx(qi,{logs:ze}):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(Lt,{size:24,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-base font-medium text-neutral-900 mb-1.5",children:"尚未启动 Agent"}),a.jsx("p",{className:"text-sm text-neutral-500 mb-6 max-w-xs",children:"选择一个 Agent 来执行此任务,Agent 将自动创建工作空间并开始工作。"}),a.jsxs(lt,{onClick:()=>r(!0),children:[a.jsx(Lt,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!x&&a.jsxs("button",{onClick:()=>w(),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":"Scroll to bottom",children:[a.jsx(Gi,{size:14}),a.jsx("span",{children:"回到底部"})]})]}),Te.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(Ki,{todos:Te})}),Q?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:"代码已合并,以上为历史沟通记录"}),a.jsxs(lt,{size:"sm",onClick:()=>r(!0),children:[a.jsx(Lt,{size:14,className:"mr-1.5"}),"启动新 Agent"]})]})}):a.jsx("div",{className:"p-6 pt-2 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-transparent",onDragOver:re,onDragLeave:oe,onDrop:pe,children:a.jsxs("div",{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 ${Ot?"border-blue-400 bg-blue-50/50 shadow-md":"border-neutral-200"}`,children:[a.jsx(ws,{files:G,onRemove:fe}),a.jsx("textarea",{ref:f,value:m,onChange:Ze,onPaste:yt,onKeyDown:Y=>{Y.key==="Enter"&&!Y.shiftKey&&!Y.repeat&&!Y.nativeEvent.isComposing&&Y.nativeEvent.keyCode!==229&&(Y.preventDefault(),ut())},rows:1,placeholder:Ot?"Drop files here...":P&&!O?"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:h,type:"file",multiple:!0,className:"hidden",onChange:Rt}),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:()=>h.current?.click(),className:"p-2 text-neutral-400 hover:text-neutral-600 hover:bg-neutral-100 rounded-lg transition-colors",title:"Upload file",children:a.jsx(ps,{size:18})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[N&&U&&a.jsx(ao,{providers:U,currentProviderId:X,agentType:N.agentType,onSelect:V}),a.jsx(wn,{usage:Ie}),O&&!m.trim()&&!ce?a.jsx("button",{onClick:St,disabled:Qe.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(Xi,{size:14})}):a.jsx("button",{onClick:ut,disabled:!m.trim()&&!ce||Ce,className:`p-2 rounded-lg transition-all duration-200 ${(m.trim()||ce)&&!Ce?"bg-neutral-900 text-white shadow-md hover:bg-black":"bg-transparent text-neutral-300 cursor-not-allowed"}`,children:a.jsx(Zi,{size:18})})]})]})]})})]}),E&&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:qe}),E&&a.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-white",children:a.jsx(eo,{sessionId:P||void 0,workingDir:ae,projectId:e.projectId})})]}),a.jsx(oo,{isOpen:C,onClose:()=>r(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),j&&a.jsx(_f,{open:p,onOpenChange:_,workspaceId:j,branchName:z,targetBranch:e.mainBranch,commitMessage:Z,onConflict:()=>o(!0)}),j&&F&&F.conflictOp&&a.jsx(vf,{open:d,onOpenChange:o,workspaceId:j,conflictOp:F.conflictOp,conflictedFiles:F.conflictedFiles,sourceBranch:z,targetBranch:e.mainBranch,sessions:$}),a.jsx(lo,{isOpen:i,onClose:()=>c(!1),onConfirm:je,title:"删除任务",description:a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),dt.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:dt.map((Y,se)=>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:Y})]},se))})]}),confirmText:"删除",variant:"danger",isLoading:s})]}):Rf}function Tf(e){switch(e){case ot.TODO:return le.Pending;case ot.IN_PROGRESS:return le.Running;case ot.IN_REVIEW:return le.Review;case ot.DONE:return le.Done;case ot.CANCELLED:return le.Cancelled}}function Lf(e){switch(e){case le.Pending:return ot.TODO;case le.Running:return ot.IN_PROGRESS;case le.Review:return ot.IN_REVIEW;case le.Done:return ot.DONE;case le.Cancelled:return ot.CANCELLED}}function Af(e){switch(e){case os.CLAUDE_CODE:return"Claude Code";case os.GEMINI_CLI:return"Gemini CLI";case os.CURSOR_AGENT:return"Cursor Agent";case os.CODEX:return"Codex"}}const Ti=["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 Nf(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 Mf(e){return{id:e.id,name:e.name,color:e.color||Ti[Nf(e.name,Ti.length)]}}function Pf(e){if(!e||e.length===0)return{agent:"—",branch:"—"};const t=e.find(m=>m.status==="ACTIVE")??e[0],s=t.branchName,l=t.sessions;if(l&&l.length>0){const m=l[l.length-1];return{agent:Af(m.agentType),branch:s}}return{agent:"—",branch:s}}function Of(e){const{agent:t,branch:s}=Pf(e.workspaces);return{id:e.id,projectId:e.projectId,title:e.title,status:Tf(e.status),agent:t,branch:s,description:e.description??""}}function Bf(e,t){const s={};return ct({queryKey:he.tasks.list(e,t),queryFn:()=>_e.get(`/projects/${e}/tasks`,{params:s}),enabled:!!e})}function If(e){const t=Pe();return Ve({mutationFn:s=>_e.post(`/projects/${e}/tasks`,s),onSuccess:()=>{t.invalidateQueries({queryKey:he.tasks.list(e)}),t.invalidateQueries({queryKey:he.tasks.stats(e)})}})}function Ff(){const e=Pe();return Ve({mutationFn:({id:t,status:s})=>_e.patch(`/tasks/${t}/status`,{status:s}),onSuccess:t=>{e.invalidateQueries({queryKey:he.tasks.all}),e.invalidateQueries({queryKey:he.tasks.detail(t.id)})}})}function Hf(){const e=Pe();return Ve({mutationFn:t=>_e.delete(`/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:he.tasks.all})}})}function zf(e){const t=Pe(),s=R.useRef(new Set);R.useEffect(()=>{if(e.length===0)return;const l=ft.connect(),m=s.current,b=new Set(e);for(const i of b)m.has(i)||l.emit(at.SUBSCRIBE,{topic:"project",id:i},c=>{c.success&&m.add(i)});for(const i of m)b.has(i)||l.emit(at.UNSUBSCRIBE,{topic:"project",id:i},()=>{m.delete(i)});const C=i=>{t.invalidateQueries({queryKey:he.tasks.list(i.projectId)}),t.invalidateQueries({queryKey:he.tasks.detail(i.taskId)})},r=i=>{t.invalidateQueries({queryKey:he.tasks.list(i.projectId)}),t.removeQueries({queryKey:he.tasks.detail(i.taskId)})};return l.on(We.TASK_UPDATED,C),l.on(We.TASK_DELETED,r),()=>{l.off(We.TASK_UPDATED,C),l.off(We.TASK_DELETED,r);for(const i of m)l.emit(at.UNSUBSCRIBE,{topic:"project",id:i});m.clear()}},[e,t])}const co=768;function Wf(e){const t=window.matchMedia(`(max-width: ${co-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function $f(){return window.innerWidth<co}function Uf(){return!1}function qf(){return R.useSyncExternalStore(Wf,$f,Uf)}const Li={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 Kf(e){const t=e.split("/");return t[t.length-1]||e}function Xf(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function Yf({workingDir:e,filePath:t,type:s}){const{data:l,isLoading:m,isError:b}=Qn(e,t,s);if(m)return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[a.jsx(Me,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(b)return a.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No diff content."});const r=C.split(`
|
|
78
|
+
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:r.map((i,c)=>{let d="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(d="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(d="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(d="bg-blue-950/30",o="text-blue-400"),a.jsx("div",{className:xe("px-3 whitespace-pre",d,o),children:i},c)})})}function Vf({entry:e,type:t,workingDir:s}){const[l,m]=R.useState(!1),b=Li[e.status]||Li.M,C=Xf(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:xe("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:xe("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",b),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:Kf(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(mt,{size:14}):a.jsx(kt,{size:14})})]}),l&&a.jsx(Yf,{workingDir:s,filePath:e.path,type:t})]})}function Ai({title:e,entries:t,type:s,workingDir:l,defaultOpen:m}){const[b,C]=R.useState(m);return t.length===0?null:a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>C(r=>!r),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:b?a.jsx(mt,{size:14}):a.jsx(kt,{size:14})}),a.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:e}),a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:t.length})]}),b&&a.jsx("div",{className:"divide-y divide-neutral-100",children:t.map(r=>a.jsx(Vf,{entry:r,type:s,workingDir:l},`${s}:${r.path}`))})]})}function Gf({workingDir:e}){const{data:t,isLoading:s,isError:l}=Gn(e);if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."});if(s)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[a.jsx(Me,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading changes..."})]});if(l)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:"Failed to load changes."});const m=t?.uncommitted||[],b=t?.committed||[];return m.length+b.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[a.jsx(Kt,{size:28,className:"mb-3"}),a.jsx("span",{className:"text-sm",children:"No pending changes"})]}):a.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[a.jsx(Ai,{title:"Uncommitted",entries:m,type:"uncommitted",workingDir:e,defaultOpen:!0}),a.jsx(Ai,{title:"Committed",entries:b,type:"committed",workingDir:e,defaultOpen:!1})]})}const er=50,Ni={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 Qf(e){const s=Math.floor(Date.now()/1e3)-e;return s<60?`${s}s ago`:s<3600?`${Math.floor(s/60)}m ago`:s<86400?`${Math.floor(s/3600)}h ago`:s<604800?`${Math.floor(s/86400)}d ago`:new Date(e*1e3).toLocaleDateString()}function Zf(e){const t=e.split("/");return t[t.length-1]||e}function Jf(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function ep({workingDir:e,hash:t,filePath:s}){const{data:l,isLoading:m,isError:b}=Jn(e,t,s);if(m)return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[a.jsx(Me,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(b)return a.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No diff content."});const r=C.split(`
|
|
79
|
+
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:r.map((i,c)=>{let d="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(d="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(d="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(d="bg-blue-950/30",o="text-blue-400"),a.jsx("div",{className:xe("px-3 whitespace-pre",d,o),children:i},c)})})}function tp({entry:e,workingDir:t,hash:s}){const[l,m]=R.useState(!1),b=Ni[e.status]||Ni.M,C=Jf(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:xe("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:xe("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",b),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:Zf(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(mt,{size:14}):a.jsx(kt,{size:14})})]}),l&&a.jsx(ep,{workingDir:t,hash:s,filePath:e.path})]})}function sp({commit:e,workingDir:t}){const[s,l]=R.useState(!1),{data:m,isLoading:b}=Zn(t,s?e.hash:null),C=m?.files||[];return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>l(r=>!r),className:xe("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-neutral-50",s&&"bg-neutral-50"),children:[a.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:a.jsx("div",{className:xe("w-2.5 h-2.5 rounded-full shrink-0",s?"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:Qf(e.timestamp)})]})]}),a.jsx("span",{className:"text-neutral-400 shrink-0 pt-0.5",children:s?a.jsx(mt,{size:14}):a.jsx(kt,{size:14})})]}),s&&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}),b?a.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-neutral-400",children:[a.jsx(Me,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:"Loading files..."})]}):C.length===0?a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No files changed"}):a.jsx("div",{className:"divide-y divide-neutral-100",children:C.map(r=>a.jsx(tp,{entry:r,workingDir:t,hash:e.hash},r.path))})]})]})}function rp({workingDir:e}){const{data:t,isLoading:s,isError:l,fetchNextPage:m,hasNextPage:b,isFetchingNextPage:C}=Vi({queryKey:he.git.log(e||""),queryFn:({pageParam:i=0})=>_e.get("/git/log",{params:{workingDir:e||"",limit:String(er),skip:String(i)}}),initialPageParam:0,getNextPageParam:(i,c)=>i.commits.length<er?void 0:c.length*er,enabled:!!e}),r=t?.pages.flatMap(i=>i.commits)||[];return e?s?a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[a.jsx(Me,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading history..."})]}):l?a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:"Failed to load history."}):r.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[a.jsx(Nt,{size:28,className:"mb-3"}),a.jsx("span",{className:"text-sm",children:"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:r.map(i=>a.jsx(sp,{commit:i,workingDir:e},i.hash))}),b&&a.jsx("button",{type:"button",onClick:()=>m(),disabled:C,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:C?a.jsxs(a.Fragment,{children:[a.jsx(Me,{size:14,className:"animate-spin"})," Loading..."]}):"Load more"})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."})}const ip="/api";function np(e){if(!Qt())return e;const t=Zt();if(!t)return e;const s=e.includes("?")?"&":"?";return`${e}${s}token=${encodeURIComponent(t)}`}const op=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?np(`${ip}/attachments/by-path?path=${encodeURIComponent(e)}`):e,ap=({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"})}),lp={img:ap};function cp({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 hp=[{key:"chat",label:"Chat",icon:wa},{key:"changes",label:"Changes",icon:Kt},{key:"history",label:"History",icon:Nt},{key:"workspace",label:"Workspace",icon:tn}];function up({task:e,onBack:t,onDeleteTask:s,isDeleting:l}){const[m,b]=R.useState("chat"),[C,r]=R.useState(""),[i,c]=R.useState(!1),[d,o]=R.useState(!1),[p,_]=R.useState(!1),y=R.useRef(null),g=R.useRef(null),n=R.useRef(null),{scrollRef:f,contentRef:h,isAtBottom:u,scrollToBottom:v}=Cn({resize:"smooth",initial:"instant"}),x=Pe();R.useEffect(()=>{if(!p)return;const G=ie=>{y.current&&!y.current.contains(ie.target)&&_(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[p]);const{data:w,isLoading:k}=to(e.id),S=R.useMemo(()=>{if(!w)return null;const G=w.filter(te=>te.status==="ACTIVE"&&Array.isArray(te.sessions)).flatMap(te=>te.sessions??[]),ie=te=>{const ge=te.createdAt,ce=te.endedAt??te.startedAt??ge;if(!ce)return 0;const Ce=Date.parse(ce);return Number.isNaN(Ce)?0:Ce},fe=te=>{const ge=G.filter(ce=>te.includes(ce.status));return ge.length===0?null:ge.sort((ce,Ce)=>ie(Ce)-ie(ce))[0]??null};return fe([Ae.RUNNING])??fe([Ae.PENDING])??fe([Ae.COMPLETED,Ae.FAILED,Ae.CANCELLED])},[w]),E=S?.id??"",T=S?.status===Ae.RUNNING||S?.status===Ae.PENDING,{data:A}=Ds(),[L,M]=R.useState(null);R.useEffect(()=>{M(S?.providerId??null)},[S?.providerId]);const B=R.useMemo(()=>{if(w){for(const G of w)if(G.status==="ACTIVE"&&G.worktreePath)return G.worktreePath;return w[0]?.worktreePath}},[w]),I=R.useMemo(()=>{if(w)return w.find(G=>G.status==="ACTIVE")?.id},[w]),H=R.useMemo(()=>{const G=[];if(w&&w.length>0){const ie=w.some(te=>te.status==="ACTIVE");w.some(te=>te.sessions?.some(ge=>ge.status===Ae.RUNNING||ge.status===Ae.PENDING))&&G.push("正在运行的 Agent 将被停止"),ie&&(G.push("分支上未合并的变更将丢失"),G.push("关联的工作目录(worktree)将被清理"))}return G},[w]),W=Nr(),D=Ar(),N=io(),{isConnected:P,isLoadingSnapshot:O,logs:U,entries:X,attach:V}=Wi({sessionId:E,onExit:R.useCallback(()=>{x.invalidateQueries({queryKey:["workspaces"]})},[x])}),{todos:Q}=$i(X),{files:ae,addFiles:j,removeFile:F,clear:$,buildMarkdownLinks:z,hasFiles:Z,isUploading:K}=Mr(),ne=R.useMemo(()=>{if(!S?.tokenUsage)return;const G=S.tokenUsage;if(typeof G.totalTokens=="number")return G},[S?.tokenUsage]),ue=no(U,ne);R.useEffect(()=>{E&&P&&V()},[E,P,V]),R.useEffect(()=>{v()},[e.id,v]);const ye=R.useRef(!1),je=R.useCallback(async()=>{if(!C.trim()&&!Z||!E||ye.current||K)return;ye.current=!0;const G=z(),ie=[C.trim(),G].filter(Boolean).join(`
|
|
80
80
|
|
|
81
|
-
`);r(""),T(),g.current&&(g.current.style.height="40px"),I.mutate({id:E,message:se},{onSuccess:()=>U(),onSettled:()=>{oe.current=!1}})},[C,E,I,U,$,z,F,T]),we=R.useCallback(async()=>{E&&(await W.mutateAsync(E),x.invalidateQueries({queryKey:["workspaces"]}))},[E,W,x]),je=R.useCallback(Q=>{const se=Q.target.files;se&&se.length>0&&Y(Array.from(se)),Q.target.value=""},[Y]),Z=R.useCallback(Q=>{const se=Q.clipboardData.items,ue=[];for(const ne of se)if(ne.kind==="file"){const ge=ne.getAsFile();ge&&ue.push(ge)}ue.length>0&&(Q.preventDefault(),Y(ue))},[Y]),ze=R.useCallback(Q=>{r(Q.target.value);const se=Q.target;se.style.height="auto",se.style.height=`${Math.max(40,Math.min(se.scrollHeight,140))}px`},[]),Fe=R.useCallback(()=>{N&&H.mutate({workspaceId:N})},[N,H]),Re=R.useRef(null);return R.useEffect(()=>{const Q=window.visualViewport;if(!Q)return;let se=!1;const ue=()=>{Re.current&&(Re.current.style.height=`${Q.height}px`,Re.current.style.top=`${Q.offsetTop}px`)},ne=()=>ue(),ge=()=>{se||ue()},me=()=>{se=!0},ye=()=>{se=!1,requestAnimationFrame(ue)};return Q.addEventListener("resize",ne),Q.addEventListener("scroll",ge),document.addEventListener("touchstart",me,{passive:!0}),document.addEventListener("touchend",ye,{passive:!0}),document.addEventListener("touchcancel",ye,{passive:!0}),()=>{Q.removeEventListener("resize",ne),Q.removeEventListener("scroll",ge),document.removeEventListener("touchstart",me),document.removeEventListener("touchend",ye),document.removeEventListener("touchcancel",ye)}},[]),R.useEffect(()=>{const Q=Re.current;if(!Q)return;const se=ue=>{let ne=ue.target;for(;ne&&ne!==Q;){if(ne.tagName==="TEXTAREA"){if(ne.scrollHeight>ne.clientHeight)return;ne=ne.parentElement;continue}const me=window.getComputedStyle(ne).overflowY;if((me==="auto"||me==="scroll")&&ne.scrollHeight>ne.clientHeight)return;ne=ne.parentElement}ue.preventDefault()};return Q.addEventListener("touchmove",se,{passive:!1}),()=>Q.removeEventListener("touchmove",se)},[]),a.jsxs("div",{ref:Re,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(jo,{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}),a.jsx("span",{className:"text-neutral-300",children:"/"}),a.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),a.jsx(lp,{status:e.status}),a.jsx("button",{onClick:Fe,disabled:!N,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:a.jsx(Ds,{size:16})}),s&&a.jsxs("div",{className:"relative",ref:S,children:[a.jsx("button",{onClick:()=>_(Q=>!Q),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:a.jsx(Ji,{size:16})}),p&&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:()=>{o(!0),_(!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(Yi,{size:15}),a.jsx("span",{children:"删除任务"})]})})]})]}),a.jsx("div",{className:"flex border-t border-neutral-100",children:cp.map(({key:Q,label:se,icon:ue})=>a.jsxs("button",{onClick:()=>b(Q),className:`flex-1 flex items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors ${m===Q?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[a.jsx(ue,{size:13}),a.jsx("span",{children:se})]},Q))})]}),m==="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:f,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:a.jsxs("div",{ref:h,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($i,{urlTransform:np,components:ap,children:e.description})}):a.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),k?a.jsx(Ai,{label:"Loading..."}):E?M?a.jsx(Ai,{label:"Loading logs..."}):P.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:j?"Waiting for agent output...":"No logs recorded."}):a.jsx(Ui,{logs:P}):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(jt,{size:20,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),a.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),a.jsxs(ot,{onClick:()=>c(!0),children:[a.jsx(jt,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!u&&a.jsxs("button",{onClick:()=>v(),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(Gi,{size:12}),a.jsx("span",{children:"回到底部"})]})]}),K.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(qi,{todos:K,compact:!0})}),E&&a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[a.jsx(Cs,{files:V,onRemove:ie}),a.jsx("textarea",{ref:g,value:C,onChange:ze,onPaste:Z,onKeyDown:Q=>{Q.key==="Enter"&&!Q.shiftKey&&!Q.repeat&&!Q.nativeEvent.isComposing&&Q.nativeEvent.keyCode!==229&&(Q.preventDefault(),he())},rows:1,placeholder:j?"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:n,type:"file",multiple:!0,className:"hidden",onChange:je}),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:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:a.jsx(ds,{size:15})})}),a.jsxs("div",{className:"flex items-center gap-1",children:[A&&a.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] text-neutral-400 px-1.5 py-0.5 select-none",children:[a.jsx(Fi,{size:12,className:"shrink-0"}),a.jsx("span",{children:Xi(A,10)})]}),a.jsx(En,{usage:X}),j&&!C.trim()&&!$?a.jsx("button",{onClick:we,disabled:W.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:a.jsx(Ki,{size:12})}):a.jsx("button",{onClick:he,disabled:!C.trim()&&!$||z,className:`p-1.5 rounded-lg transition-colors ${(C.trim()||$)&&!z?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:a.jsx(Zi,{size:15})})]})]})]})})]}),m==="changes"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(Vf,{workingDir:L})}),m==="history"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(sp,{workingDir:L})}),m==="workspace"&&a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(to,{sessionId:E||void 0,workingDir:L,projectId:e.projectId,className:"h-full",hideChanges:!0})}),a.jsx(lo,{isOpen:i,onClose:()=>c(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),a.jsx(co,{isOpen:d,onClose:()=>o(!1),onConfirm:()=>{s?.(e.id),o(!1)},title:"删除任务",description:a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),B.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:B.map((Q,se)=>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:Q})]},se))})]}),confirmText:"删除",variant:"danger",isLoading:l})]})}function Ai({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 up=Object.defineProperty,ws=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,fo=Object.prototype.propertyIsEnumerable,Ni=(e,t,s)=>t in e?up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,hr=(e,t)=>{for(var s in t||(t={}))uo.call(t,s)&&Ni(e,s,t[s]);if(ws)for(var s of ws(t))fo.call(t,s)&&Ni(e,s,t[s]);return e},ur=(e,t)=>{var s={};for(var l in e)uo.call(e,l)&&t.indexOf(l)<0&&(s[l]=e[l]);if(e!=null&&ws)for(var l of ws(e))t.indexOf(l)<0&&fo.call(e,l)&&(s[l]=e[l]);return s};var Et;(e=>{const t=class fe{constructor(i,c,d,o){if(this.version=i,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],i<fe.MIN_VERSION||i>fe.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 _=this.addEccAndInterleave(d);if(this.drawCodewords(_),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 d=e.QrSegment.makeSegments(i);return fe.encodeSegments(d,c)}static encodeBinary(i,c){const d=e.QrSegment.makeBytes(i);return fe.encodeSegments([d],c)}static encodeSegments(i,c,d=1,o=40,p=-1,_=!0){if(!(fe.MIN_VERSION<=d&&d<=o&&o<=fe.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let S,g;for(S=d;;S++){const u=fe.getNumDataCodewords(S,c)*8,v=C.getTotalBits(i,S);if(v<=u){g=v;break}if(S>=o)throw new RangeError("Data too long")}for(const u of[fe.Ecc.MEDIUM,fe.Ecc.QUARTILE,fe.Ecc.HIGH])_&&g<=fe.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 v of u.getData())n.push(v)}m(n.length==g);const f=fe.getNumDataCodewords(S,c)*8;m(n.length<=f),s(0,Math.min(4,f-n.length),n),s(0,(8-n.length%8)%8,n),m(n.length%8==0);for(let u=236;n.length<f;u^=253)s(u,8,n);let h=[];for(;h.length*8<n.length;)h.push(0);return n.forEach((u,v)=>h[v>>>3]|=u<<7-(v&7)),new fe(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 d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%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 d=0;d<c;d++)for(let o=0;o<c;o++)d==0&&o==0||d==0&&o==c-1||d==c-1&&o==0||this.drawAlignmentPattern(i[d],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const c=this.errorCorrectionLevel.formatBits<<3|i;let d=c;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const o=(c<<10|d)^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 d=0;d<12;d++)i=i<<1^(i>>>11)*7973;const c=this.version<<12|i;m(c>>>18==0);for(let d=0;d<18;d++){const o=l(c,d),p=this.size-11+d%3,_=Math.floor(d/3);this.setFunctionModule(p,_,o),this.setFunctionModule(_,p,o)}}drawFinderPattern(i,c){for(let d=-4;d<=4;d++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(d)),_=i+o,S=c+d;0<=_&&_<this.size&&0<=S&&S<this.size&&this.setFunctionModule(_,S,p!=2&&p!=4)}}drawAlignmentPattern(i,c){for(let d=-2;d<=2;d++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,c+d,Math.max(Math.abs(o),Math.abs(d))!=1)}setFunctionModule(i,c,d){this.modules[c][i]=d,this.isFunction[c][i]=!0}addEccAndInterleave(i){const c=this.version,d=this.errorCorrectionLevel;if(i.length!=fe.getNumDataCodewords(c,d))throw new RangeError("Invalid argument");const o=fe.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][c],p=fe.ECC_CODEWORDS_PER_BLOCK[d.ordinal][c],_=Math.floor(fe.getNumRawDataModules(c)/8),S=o-_%o,g=Math.floor(_/o);let n=[];const f=fe.reedSolomonComputeDivisor(p);for(let u=0,v=0;u<o;u++){let x=i.slice(v,v+g-p+(u<S?0:1));v+=x.length;const w=fe.reedSolomonComputeRemainder(x,f);u<S&&x.push(0),n.push(x.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((v,x)=>{(u!=g-p||x>=S)&&h.push(v[u])});return m(h.length==_),h}drawCodewords(i){if(i.length!=Math.floor(fe.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const _=d-p,g=(d+1&2)==0?this.size-1-o:o;!this.isFunction[g][_]&&c<i.length*8&&(this.modules[g][_]=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 d=0;d<this.size;d++){let o;switch(i){case 0:o=(d+c)%2==0;break;case 1:o=c%2==0;break;case 2:o=d%3==0;break;case 3:o=(d+c)%3==0;break;case 4:o=(Math.floor(d/3)+Math.floor(c/2))%2==0;break;case 5:o=d*c%2+d*c%3==0;break;case 6:o=(d*c%2+d*c%3)%2==0;break;case 7:o=((d+c)%2+d*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][d]&&o&&(this.modules[c][d]=!this.modules[c][d])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let _=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==_?(S++,S==5?i+=fe.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),_||(i+=this.finderPenaltyCountPatterns(g)*fe.PENALTY_N3),_=this.modules[p][n],S=1);i+=this.finderPenaltyTerminateAndCount(_,S,g)*fe.PENALTY_N3}for(let p=0;p<this.size;p++){let _=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==_?(S++,S==5?i+=fe.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),_||(i+=this.finderPenaltyCountPatterns(g)*fe.PENALTY_N3),_=this.modules[n][p],S=1);i+=this.finderPenaltyTerminateAndCount(_,S,g)*fe.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let _=0;_<this.size-1;_++){const S=this.modules[p][_];S==this.modules[p][_+1]&&S==this.modules[p+1][_]&&S==this.modules[p+1][_+1]&&(i+=fe.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((_,S)=>_+(S?1:0),c);const d=this.size*this.size,o=Math.ceil(Math.abs(c*20-d*10)/d)-1;return m(0<=o&&o<=9),i+=o*fe.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 d=[6];for(let o=this.size-7;d.length<i;o-=c)d.splice(1,0,o);return d}}static getNumRawDataModules(i){if(i<fe.MIN_VERSION||i>fe.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*i+128)*i+64;if(i>=2){const d=Math.floor(i/7)+2;c-=(25*d-10)*d-55,i>=7&&(c-=36)}return m(208<=c&&c<=29648),c}static getNumDataCodewords(i,c){return Math.floor(fe.getNumRawDataModules(i)/8)-fe.ECC_CODEWORDS_PER_BLOCK[c.ordinal][i]*fe.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 d=1;for(let o=0;o<i;o++){for(let p=0;p<c.length;p++)c[p]=fe.reedSolomonMultiply(c[p],d),p+1<c.length&&(c[p]^=c[p+1]);d=fe.reedSolomonMultiply(d,2)}return c}static reedSolomonComputeRemainder(i,c){let d=c.map(o=>0);for(const o of i){const p=o^d.shift();d.push(0),c.forEach((_,S)=>d[S]^=fe.reedSolomonMultiply(_,p))}return d}static reedSolomonMultiply(i,c){if(i>>>8||c>>>8)throw new RangeError("Byte out of range");let d=0;for(let o=7;o>=0;o--)d=d<<1^(d>>>7)*285,d^=(c>>>o&1)*i;return m(d>>>8==0),d}finderPenaltyCountPatterns(i){const c=i[1];m(c<=this.size*3);const d=c>0&&i[2]==c&&i[3]==c*3&&i[4]==c&&i[5]==c;return(d&&i[0]>=c*4&&i[6]>=c?1:0)+(d&&i[6]>=c*4&&i[0]>=c?1:0)}finderPenaltyTerminateAndCount(i,c,d){return i&&(this.finderPenaltyAddHistory(c,d),c=0),c+=this.size,this.finderPenaltyAddHistory(c,d),this.finderPenaltyCountPatterns(d)}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 d=i-1;d>=0;d--)c.push(r>>>d&1)}function l(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const b=class Te{constructor(i,c,d){if(this.mode=i,this.numChars=c,this.bitData=d,c<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(i){let c=[];for(const d of i)s(d,8,c);return new Te(Te.Mode.BYTE,i.length,c)}static makeNumeric(i){if(!Te.isNumeric(i))throw new RangeError("String contains non-numeric characters");let c=[];for(let d=0;d<i.length;){const o=Math.min(i.length-d,3);s(parseInt(i.substring(d,d+o),10),o*3+1,c),d+=o}return new Te(Te.Mode.NUMERIC,i.length,c)}static makeAlphanumeric(i){if(!Te.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],d;for(d=0;d+2<=i.length;d+=2){let o=Te.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d))*45;o+=Te.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d+1)),s(o,11,c)}return d<i.length&&s(Te.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d)),6,c),new Te(Te.Mode.ALPHANUMERIC,i.length,c)}static makeSegments(i){return i==""?[]:Te.isNumeric(i)?[Te.makeNumeric(i)]:Te.isAlphanumeric(i)?[Te.makeAlphanumeric(i)]:[Te.makeBytes(Te.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 Te(Te.Mode.ECI,0,c)}static isNumeric(i){return Te.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Te.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,c){let d=0;for(const o of i){const p=o.mode.numCharCountBits(c);if(o.numChars>=1<<p)return 1/0;d+=4+p+o.bitData.length}return d}static toUtf8ByteArray(i){i=encodeURI(i);let c=[];for(let d=0;d<i.length;d++)i.charAt(d)!="%"?c.push(i.charCodeAt(d)):(c.push(parseInt(i.substring(d+1,d+3),16)),d+=2);return c}};b.NUMERIC_REGEX=/^[0-9]*$/,b.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,b.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=b;e.QrSegment=b})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.ordinal=m,this.formatBits=b}};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={}))})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.modeBits=m,this.numBitsCharCount=b}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={}))})(Et||(Et={}));var Tt=Et;var dp={L:Tt.QrCode.Ecc.LOW,M:Tt.QrCode.Ecc.MEDIUM,Q:Tt.QrCode.Ecc.QUARTILE,H:Tt.QrCode.Ecc.HIGH},po=128,mo="L",vo="#FFFFFF",go="#000000",_o=!1,bo=1,fp=4,pp=0,mp=.1;function xo(e,t=0){const s=[];return e.forEach(function(l,m){let b=null;l.forEach(function(C,r){if(!C&&b!==null){s.push(`M${b+t} ${m+t}h${r-b}v1H${b+t}z`),b=null;return}if(r===l.length-1){if(!C)return;b===null?s.push(`M${r+t},${m+t} h1v1H${r+t}z`):s.push(`M${b+t},${m+t} h${r+1-b}v1H${b+t}z`);return}C&&b===null&&(b=r)})}),s.join("")}function So(e,t){return e.slice().map((s,l)=>l<t.y||l>=t.y+t.h?s:s.map((m,b)=>b<t.x||b>=t.x+t.w?m:!1))}function vp(e,t,s,l){if(l==null)return null;const m=e.length+s*2,b=Math.floor(t*mp),C=m/t,r=(l.width||b)*C,i=(l.height||b)*C,c=l.x==null?e.length/2-r/2:l.x*C,d=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(d),n=Math.ceil(r+c-S),f=Math.ceil(i+d-g);p={x:S,y:g,w:n,h:f}}const _=l.crossOrigin;return{x:c,y:d,h:i,w:r,excavation:p,opacity:o,crossOrigin:_}}function gp(e,t){return t!=null?Math.max(Math.floor(t),0):e?fp:pp}function yo({value:e,level:t,minVersion:s,includeMargin:l,marginSize:m,imageSettings:b,size:C,boostLevel:r}){let i=ee.useMemo(()=>{const S=(Array.isArray(e)?e:[e]).reduce((g,n)=>(g.push(...Tt.QrSegment.makeSegments(n)),g),[]);return Tt.QrCode.encodeSegments(S,dp[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:c,margin:d,numCells:o,calculatedImageSettings:p}=ee.useMemo(()=>{let _=i.getModules();const S=gp(l,m),g=_.length+S*2,n=vp(_,C,S,b);return{cells:_,margin:S,numCells:g,calculatedImageSettings:n}},[i,C,b,l,m]);return{qrcode:i,margin:d,cells:c,numCells:o,calculatedImageSettings:p}}var _p=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),bp=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=po,level:C=mo,bgColor:r=vo,fgColor:i=go,includeMargin:c=_o,minVersion:d=bo,boostLevel:o,marginSize:p,imageSettings:_}=l,g=ur(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=g,f=ur(g,["style"]),h=_?.src,u=ee.useRef(null),v=ee.useRef(null),x=ee.useCallback(B=>{u.current=B,typeof s=="function"?s(B):s&&(s.current=B)},[s]),[w,k]=ee.useState(!1),{margin:y,cells:E,numCells:j,calculatedImageSettings:A}=yo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:p,imageSettings:_,size:b});ee.useEffect(()=>{if(u.current!=null){const B=u.current,I=B.getContext("2d");if(!I)return;let H=E;const W=v.current,D=A!=null&&W!==null&&W.complete&&W.naturalHeight!==0&&W.naturalWidth!==0;D&&A.excavation!=null&&(H=So(E,A.excavation));const M=window.devicePixelRatio||1;B.height=B.width=b*M;const P=b/j*M;I.scale(P,P),I.fillStyle=r,I.fillRect(0,0,j,j),I.fillStyle=i,_p?I.fill(new Path2D(xo(H,y))):E.forEach(function(O,U){O.forEach(function(K,V){K&&I.fillRect(V+y,U+y,1,1)})}),A&&(I.globalAlpha=A.opacity),D&&I.drawImage(W,A.x+y,A.y+y,A.w,A.h)}}),ee.useEffect(()=>{k(!1)},[h]);const L=hr({height:b,width:b},n);let N=null;return h!=null&&(N=ee.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{k(!0)},ref:v,crossOrigin:A?.crossOrigin})),ee.createElement(ee.Fragment,null,ee.createElement("canvas",hr({style:L,height:b,width:b,ref:x,role:"img"},f)),N)});bp.displayName="QRCodeCanvas";var Co=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=po,level:C=mo,bgColor:r=vo,fgColor:i=go,includeMargin:c=_o,minVersion:d=bo,boostLevel:o,title:p,marginSize:_,imageSettings:S}=l,g=ur(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:f,numCells:h,calculatedImageSettings:u}=yo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:_,imageSettings:S,size:b});let v=f,x=null;S!=null&&u!=null&&(u.excavation!=null&&(v=So(f,u.excavation)),x=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=xo(v,n);return ee.createElement("svg",hr({height:b,width:b,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"}),x)});Co.displayName="QRCodeSVG";function xp(){return at({queryKey:ce.tunnel.status,queryFn:()=>be.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function Sp(){const e=Ie();return Ge({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return be.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function yp(){const e=Ie();return Ge({mutationFn:()=>be.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function Mi(){const{data:e}=xp(),t=Sp(),s=yp(),[l,m]=R.useState(!1),[b,C]=R.useState(null),r=R.useRef(null),[i,c]=R.useState({top:0,right:0}),[d,o]=R.useState(!1),p=e?.running??!1,_=t.isPending,S=e?.shareableUrl,g=e?.token;R.useEffect(()=>{if(l&&r.current){const v=r.current.getBoundingClientRect();c({top:v.bottom+8,right:window.innerWidth-v.right})}},[l]);const n=R.useCallback(()=>{p?m(!0):t.mutate(void 0,{onSuccess:()=>m(!0)})},[p,t]),f=R.useCallback(()=>{S&&(navigator.clipboard.writeText(S),C("url"),setTimeout(()=>C(null),2e3))},[S]),h=R.useCallback(()=>{g&&(navigator.clipboard.writeText(g),C("token"),setTimeout(()=>C(null),2e3))},[g]),u=R.useCallback(()=>{s.mutate(),m(!1),o(!1)},[s]);return a.jsxs("div",{className:"relative",children:[a.jsx("button",{ref:r,onClick:n,disabled:_,className:`p-1.5 rounded-md transition-colors ${p?"text-emerald-600 hover:bg-emerald-50":"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100"}`,title:p?"Tunnel active":"Share via tunnel",children:_?a.jsx(Be,{size:16,className:"animate-spin"}):a.jsx(Es,{size:16})}),p&&!_&&a.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),l&&p&&Rt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>m(!1)}),a.jsxs("div",{className:"fixed z-[101] w-80 bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:i.top,right:i.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"}),"Tunnel Active"]}),a.jsx("button",{onClick:()=>m(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:a.jsx(ks,{size:14})})]}),g&&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(Ba,{size:12}),a.jsx("span",{children:"Token protected"})]}),S&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsx(Co,{value:S,size:160})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{readOnly:!0,value:S??e?.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:v=>v.target.select()}),a.jsx("button",{onClick:f,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:"Copy shareable link",children:b==="url"?a.jsx(fs,{size:14,className:"text-emerald-500"}):a.jsx(Wr,{size:14})})]}),g&&a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{onClick:()=>o(!d),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:d?"Hide token":"Show token"}),d&&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:g}),a.jsx("button",{onClick:h,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:"Copy token",children:b==="token"?a.jsx(fs,{size:14,className:"text-emerald-500"}):a.jsx(Wr,{size:14})})]})]}),a.jsx("button",{onClick:u,disabled:s.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:s.isPending?"Stopping...":"Stop Tunnel"})]})]}),document.body)]})}const Pi={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Ot=R.lazy(()=>Hi(()=>import("./modal-BCL0660p.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.Modal}))),er=R.lazy(()=>Hi(()=>import("./folder-picker-DshGpYNS.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12,13])).then(e=>({default:e.FolderPicker}))),Oi=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"})]}),Bi=a.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),Cp=260,wp=600,Ii=400;function Fp(){const[e,t]=R.useState(null),[s,l]=R.useState(null),[m,b]=R.useState(Ii),[C,r]=R.useState(!1),[i,c]=R.useState(!1),[d,o]=R.useState(""),[p,_]=R.useState(""),[S,g]=R.useState(""),[n,f]=R.useState(""),[h,u]=R.useState(""),[v,x]=R.useState(""),[w,k]=R.useState("idle"),{files:y,addFiles:E,removeFile:j,clear:A,buildMarkdownLinks:L,isUploading:N}=Mr(),B=R.useRef(null),I=R.useRef(!1),H=R.useRef(0),W=R.useRef(Ii),D=R.useRef(null),M=Ie(),{data:P,isLoading:O}=_r(),{data:U,isLoading:K}=Uo(),V=U?.data??[],Y=R.useMemo(()=>V.map(Nf),[V]),ie=R.useMemo(()=>V.map(q=>q.id),[V]);Hf(ie);const{data:T,isLoading:F}=Of(s??""),$=Vo({queries:s?[]:V.map(q=>({queryKey:ce.tasks.list(q.id),queryFn:()=>be.get(`/projects/${q.id}/tasks`,{params:{limit:"100"}})}))}),z=!s&&$.some(q=>q.isLoading),J=R.useMemo(()=>{if(s)return T?.data??[];const q=[];for(const re of $)re.data?.data&&q.push(...re.data.data);return q},[s,T,$]),X=R.useMemo(()=>{const q=new Map;for(const re of J){const ae=re.createdAt?new Date(re.createdAt).getTime():0,pe=q.get(re.projectId)??0;ae>pe&&q.set(re.projectId,ae)}return[...V].sort((re,ae)=>{const pe=q.get(re.id)??(re.createdAt?new Date(re.createdAt).getTime():0);return(q.get(ae.id)??(ae.createdAt?new Date(ae.createdAt).getTime():0))-pe})},[V,J]),oe=R.useMemo(()=>{if(!P)return[];const q=localStorage.getItem("providerUsageCount"),re=q?JSON.parse(q):{};return[...P].sort((ae,pe)=>{const xe=ae.availability.type!=="NOT_FOUND",Me=pe.availability.type!=="NOT_FOUND";if(xe!==Me)return xe?-1:1;const qe=re[ae.provider.id]??0;return(re[pe.provider.id]??0)-qe})},[P]),he=R.useMemo(()=>J.map(Pf),[J]),we=R.useMemo(()=>new Set,[]),je=R.useMemo(()=>{if(!e)return null;const q=he.find(ae=>ae.id===e);if(!q)return null;const re=V.find(ae=>ae.id===q.projectId);return{id:q.id,projectId:q.projectId,projectName:re?.name??"Unknown",projectColor:re?.color??"text-neutral-500",title:q.title,status:q.status,branch:q.branch,mainBranch:re?.mainBranch??"main",description:q.description}},[e,he,V]),Z=qo(),ze=Bf(h),Fe=Ff(),Re=If(),Q=R.useCallback(q=>{Fe.mutate(q,{onSuccess:()=>{e===q&&t(null),M.invalidateQueries({queryKey:ce.tasks.all})}})},[Fe,e,M]),se=R.useCallback((q,re)=>{Re.mutate({id:q,status:jf(re)},{onError:()=>{Lo.error("状态变更失败,该操作不被允许")}})},[Re]),ue=R.useCallback(q=>{q.preventDefault(),I.current=!0,H.current=q.clientX,W.current=m,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[m]);R.useEffect(()=>{const q=ae=>{if(!I.current)return;const pe=ae.clientX-H.current,xe=Math.max(Cp,Math.min(wp,W.current+pe));b(xe)},re=()=>{I.current&&(I.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",re)}},[]);const ne=R.useCallback(()=>{r(!0)},[]),ge=R.useCallback(()=>{const q=localStorage.getItem("lastSelectedProjectId"),re=localStorage.getItem("lastSelectedProviderId"),ae=q&&X.find(Me=>Me.id===q)?q:s??X[0]?.id??"";u(ae);const pe=oe?.find(Me=>Me.availability.type!=="NOT_FOUND"),xe=re&&oe?.find(Me=>Me.provider.id===re&&Me.availability.type!=="NOT_FOUND")?re:pe?.provider.id??"";x(xe),k("idle"),c(!0)},[s,X,oe]),me=R.useCallback(()=>{r(!1),o(""),_("")},[]),ye=R.useCallback(()=>{w==="idle"&&(c(!1),g(""),f(""),u(""),x(""),k("idle"),A())},[w,A]),Le=R.useCallback(async()=>{if(!(!d.trim()||!p.trim()))try{await Z.mutateAsync({name:d.trim(),repoPath:p.trim()}),me()}catch{}},[d,p,Z,me]),Ve=io(),Ae=R.useCallback(async()=>{if(!(!S.trim()||!h))try{const q=L(),re=[n.trim(),q].filter(Boolean).join(`
|
|
81
|
+
`);r(""),$(),g.current&&(g.current.style.height="40px"),W.mutate({id:E,message:ie,providerId:L??void 0},{onSuccess:()=>V(),onSettled:()=>{ye.current=!1}})},[C,E,W,V,Z,K,z,$,L]),J=R.useCallback(async()=>{E&&(await N.mutateAsync(E),x.invalidateQueries({queryKey:["workspaces"]}))},[E,N,x]),He=R.useCallback(G=>{const ie=G.target.files;ie&&ie.length>0&&j(Array.from(ie)),G.target.value=""},[j]),ze=R.useCallback(G=>{const ie=G.clipboardData.items,fe=[];for(const te of ie)if(te.kind==="file"){const ge=te.getAsFile();ge&&fe.push(ge)}fe.length>0&&(G.preventDefault(),j(fe))},[j]),Oe=R.useCallback(G=>{r(G.target.value);const ie=G.target;ie.style.height="auto",ie.style.height=`${Math.max(40,Math.min(ie.scrollHeight,140))}px`},[]),Be=R.useCallback(()=>{I&&D.mutate({workspaceId:I})},[I,D]),Te=R.useRef(null);return R.useEffect(()=>{const G=window.visualViewport;if(!G)return;let ie=!1;const fe=()=>{Te.current&&(Te.current.style.height=`${G.height}px`,Te.current.style.top=`${G.offsetTop}px`)},te=()=>fe(),ge=()=>{ie||fe()},ce=()=>{ie=!0},Ce=()=>{ie=!1,requestAnimationFrame(fe)};return G.addEventListener("resize",te),G.addEventListener("scroll",ge),document.addEventListener("touchstart",ce,{passive:!0}),document.addEventListener("touchend",Ce,{passive:!0}),document.addEventListener("touchcancel",Ce,{passive:!0}),()=>{G.removeEventListener("resize",te),G.removeEventListener("scroll",ge),document.removeEventListener("touchstart",ce),document.removeEventListener("touchend",Ce),document.removeEventListener("touchcancel",Ce)}},[]),R.useEffect(()=>{const G=Te.current;if(!G)return;const ie=fe=>{let te=fe.target;for(;te&&te!==G;){if(te.tagName==="TEXTAREA"){if(te.scrollHeight>te.clientHeight)return;te=te.parentElement;continue}const ce=window.getComputedStyle(te).overflowY;if((ce==="auto"||ce==="scroll")&&te.scrollHeight>te.clientHeight)return;te=te.parentElement}fe.preventDefault()};return G.addEventListener("touchmove",ie,{passive:!1}),()=>G.removeEventListener("touchmove",ie)},[]),a.jsxs("div",{ref:Te,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(To,{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}),a.jsx("span",{className:"text-neutral-300",children:"/"}),a.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),a.jsx(cp,{status:e.status}),a.jsx("button",{onClick:Be,disabled:!I,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:a.jsx(Ts,{size:16})}),s&&a.jsxs("div",{className:"relative",ref:y,children:[a.jsx("button",{onClick:()=>_(G=>!G),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:a.jsx(Ji,{size:16})}),p&&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:()=>{o(!0),_(!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(Yi,{size:15}),a.jsx("span",{children:"删除任务"})]})})]})]}),a.jsx("div",{className:"flex border-t border-neutral-100",children:hp.map(({key:G,label:ie,icon:fe})=>a.jsxs("button",{onClick:()=>b(G),className:`flex-1 flex items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors ${m===G?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[a.jsx(fe,{size:13}),a.jsx("span",{children:ie})]},G))})]}),m==="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:f,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:a.jsxs("div",{ref:h,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(Ui,{urlTransform:op,components:lp,children:e.description})}):a.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),k?a.jsx(Mi,{label:"Loading..."}):E?O?a.jsx(Mi,{label:"Loading logs..."}):U.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:T?"Waiting for agent output...":"No logs recorded."}):a.jsx(qi,{logs:U}):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(Lt,{size:20,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),a.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),a.jsxs(lt,{onClick:()=>c(!0),children:[a.jsx(Lt,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!u&&a.jsxs("button",{onClick:()=>v(),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(Gi,{size:12}),a.jsx("span",{children:"回到底部"})]})]}),Q.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(Ki,{todos:Q,compact:!0})}),E&&a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[a.jsx(ws,{files:ae,onRemove:F}),a.jsx("textarea",{ref:g,value:C,onChange:Oe,onPaste:ze,onKeyDown:G=>{G.key==="Enter"&&!G.shiftKey&&!G.repeat&&!G.nativeEvent.isComposing&&G.nativeEvent.keyCode!==229&&(G.preventDefault(),je())},rows:1,placeholder:T?"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:n,type:"file",multiple:!0,className:"hidden",onChange:He}),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:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:a.jsx(ps,{size:15})})}),a.jsxs("div",{className:"flex items-center gap-1",children:[S&&A&&a.jsx(ao,{providers:A,currentProviderId:L,agentType:S.agentType,onSelect:M}),a.jsx(wn,{usage:ue}),T&&!C.trim()&&!Z?a.jsx("button",{onClick:J,disabled:N.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:a.jsx(Xi,{size:12})}):a.jsx("button",{onClick:je,disabled:!C.trim()&&!Z||K,className:`p-1.5 rounded-lg transition-colors ${(C.trim()||Z)&&!K?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:a.jsx(Zi,{size:15})})]})]})]})})]}),m==="changes"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(Gf,{workingDir:B})}),m==="history"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(rp,{workingDir:B})}),m==="workspace"&&a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(eo,{sessionId:E||void 0,workingDir:B,projectId:e.projectId,className:"h-full",hideChanges:!0})}),a.jsx(oo,{isOpen:i,onClose:()=>c(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),a.jsx(lo,{isOpen:d,onClose:()=>o(!1),onConfirm:()=>{s?.(e.id),o(!1)},title:"删除任务",description:a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),H.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:H.map((G,ie)=>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})]},ie))})]}),confirmText:"删除",variant:"danger",isLoading:l})]})}function Mi({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 dp=Object.defineProperty,Es=Object.getOwnPropertySymbols,ho=Object.prototype.hasOwnProperty,uo=Object.prototype.propertyIsEnumerable,Pi=(e,t,s)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ur=(e,t)=>{for(var s in t||(t={}))ho.call(t,s)&&Pi(e,s,t[s]);if(Es)for(var s of Es(t))uo.call(t,s)&&Pi(e,s,t[s]);return e},dr=(e,t)=>{var s={};for(var l in e)ho.call(e,l)&&t.indexOf(l)<0&&(s[l]=e[l]);if(e!=null&&Es)for(var l of Es(e))t.indexOf(l)<0&&uo.call(e,l)&&(s[l]=e[l]);return s};var Et;(e=>{const t=class de{constructor(i,c,d,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 y=0;y<this.size;y++)p.push(!1);for(let y=0;y<this.size;y++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const _=this.addEccAndInterleave(d);if(this.drawCodewords(_),o==-1){let y=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const n=this.getPenaltyScore();n<y&&(o=g,y=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 d=e.QrSegment.makeSegments(i);return de.encodeSegments(d,c)}static encodeBinary(i,c){const d=e.QrSegment.makeBytes(i);return de.encodeSegments([d],c)}static encodeSegments(i,c,d=1,o=40,p=-1,_=!0){if(!(de.MIN_VERSION<=d&&d<=o&&o<=de.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let y,g;for(y=d;;y++){const u=de.getNumDataCodewords(y,c)*8,v=C.getTotalBits(i,y);if(v<=u){g=v;break}if(y>=o)throw new RangeError("Data too long")}for(const u of[de.Ecc.MEDIUM,de.Ecc.QUARTILE,de.Ecc.HIGH])_&&g<=de.getNumDataCodewords(y,u)*8&&(c=u);let n=[];for(const u of i){s(u.mode.modeBits,4,n),s(u.numChars,u.mode.numCharCountBits(y),n);for(const v of u.getData())n.push(v)}m(n.length==g);const f=de.getNumDataCodewords(y,c)*8;m(n.length<=f),s(0,Math.min(4,f-n.length),n),s(0,(8-n.length%8)%8,n),m(n.length%8==0);for(let u=236;n.length<f;u^=253)s(u,8,n);let h=[];for(;h.length*8<n.length;)h.push(0);return n.forEach((u,v)=>h[v>>>3]|=u<<7-(v&7)),new de(y,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 d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%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 d=0;d<c;d++)for(let o=0;o<c;o++)d==0&&o==0||d==0&&o==c-1||d==c-1&&o==0||this.drawAlignmentPattern(i[d],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const c=this.errorCorrectionLevel.formatBits<<3|i;let d=c;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const o=(c<<10|d)^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 d=0;d<12;d++)i=i<<1^(i>>>11)*7973;const c=this.version<<12|i;m(c>>>18==0);for(let d=0;d<18;d++){const o=l(c,d),p=this.size-11+d%3,_=Math.floor(d/3);this.setFunctionModule(p,_,o),this.setFunctionModule(_,p,o)}}drawFinderPattern(i,c){for(let d=-4;d<=4;d++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(d)),_=i+o,y=c+d;0<=_&&_<this.size&&0<=y&&y<this.size&&this.setFunctionModule(_,y,p!=2&&p!=4)}}drawAlignmentPattern(i,c){for(let d=-2;d<=2;d++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,c+d,Math.max(Math.abs(o),Math.abs(d))!=1)}setFunctionModule(i,c,d){this.modules[c][i]=d,this.isFunction[c][i]=!0}addEccAndInterleave(i){const c=this.version,d=this.errorCorrectionLevel;if(i.length!=de.getNumDataCodewords(c,d))throw new RangeError("Invalid argument");const o=de.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][c],p=de.ECC_CODEWORDS_PER_BLOCK[d.ordinal][c],_=Math.floor(de.getNumRawDataModules(c)/8),y=o-_%o,g=Math.floor(_/o);let n=[];const f=de.reedSolomonComputeDivisor(p);for(let u=0,v=0;u<o;u++){let x=i.slice(v,v+g-p+(u<y?0:1));v+=x.length;const w=de.reedSolomonComputeRemainder(x,f);u<y&&x.push(0),n.push(x.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((v,x)=>{(u!=g-p||x>=y)&&h.push(v[u])});return m(h.length==_),h}drawCodewords(i){if(i.length!=Math.floor(de.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const _=d-p,g=(d+1&2)==0?this.size-1-o:o;!this.isFunction[g][_]&&c<i.length*8&&(this.modules[g][_]=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 d=0;d<this.size;d++){let o;switch(i){case 0:o=(d+c)%2==0;break;case 1:o=c%2==0;break;case 2:o=d%3==0;break;case 3:o=(d+c)%3==0;break;case 4:o=(Math.floor(d/3)+Math.floor(c/2))%2==0;break;case 5:o=d*c%2+d*c%3==0;break;case 6:o=(d*c%2+d*c%3)%2==0;break;case 7:o=((d+c)%2+d*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][d]&&o&&(this.modules[c][d]=!this.modules[c][d])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let _=!1,y=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==_?(y++,y==5?i+=de.PENALTY_N1:y>5&&i++):(this.finderPenaltyAddHistory(y,g),_||(i+=this.finderPenaltyCountPatterns(g)*de.PENALTY_N3),_=this.modules[p][n],y=1);i+=this.finderPenaltyTerminateAndCount(_,y,g)*de.PENALTY_N3}for(let p=0;p<this.size;p++){let _=!1,y=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==_?(y++,y==5?i+=de.PENALTY_N1:y>5&&i++):(this.finderPenaltyAddHistory(y,g),_||(i+=this.finderPenaltyCountPatterns(g)*de.PENALTY_N3),_=this.modules[n][p],y=1);i+=this.finderPenaltyTerminateAndCount(_,y,g)*de.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let _=0;_<this.size-1;_++){const y=this.modules[p][_];y==this.modules[p][_+1]&&y==this.modules[p+1][_]&&y==this.modules[p+1][_+1]&&(i+=de.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((_,y)=>_+(y?1:0),c);const d=this.size*this.size,o=Math.ceil(Math.abs(c*20-d*10)/d)-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 d=[6];for(let o=this.size-7;d.length<i;o-=c)d.splice(1,0,o);return d}}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 d=Math.floor(i/7)+2;c-=(25*d-10)*d-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 d=1;for(let o=0;o<i;o++){for(let p=0;p<c.length;p++)c[p]=de.reedSolomonMultiply(c[p],d),p+1<c.length&&(c[p]^=c[p+1]);d=de.reedSolomonMultiply(d,2)}return c}static reedSolomonComputeRemainder(i,c){let d=c.map(o=>0);for(const o of i){const p=o^d.shift();d.push(0),c.forEach((_,y)=>d[y]^=de.reedSolomonMultiply(_,p))}return d}static reedSolomonMultiply(i,c){if(i>>>8||c>>>8)throw new RangeError("Byte out of range");let d=0;for(let o=7;o>=0;o--)d=d<<1^(d>>>7)*285,d^=(c>>>o&1)*i;return m(d>>>8==0),d}finderPenaltyCountPatterns(i){const c=i[1];m(c<=this.size*3);const d=c>0&&i[2]==c&&i[3]==c*3&&i[4]==c&&i[5]==c;return(d&&i[0]>=c*4&&i[6]>=c?1:0)+(d&&i[6]>=c*4&&i[0]>=c?1:0)}finderPenaltyTerminateAndCount(i,c,d){return i&&(this.finderPenaltyAddHistory(c,d),c=0),c+=this.size,this.finderPenaltyAddHistory(c,d),this.finderPenaltyCountPatterns(d)}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 d=i-1;d>=0;d--)c.push(r>>>d&1)}function l(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const b=class Le{constructor(i,c,d){if(this.mode=i,this.numChars=c,this.bitData=d,c<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(i){let c=[];for(const d of i)s(d,8,c);return new Le(Le.Mode.BYTE,i.length,c)}static makeNumeric(i){if(!Le.isNumeric(i))throw new RangeError("String contains non-numeric characters");let c=[];for(let d=0;d<i.length;){const o=Math.min(i.length-d,3);s(parseInt(i.substring(d,d+o),10),o*3+1,c),d+=o}return new Le(Le.Mode.NUMERIC,i.length,c)}static makeAlphanumeric(i){if(!Le.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],d;for(d=0;d+2<=i.length;d+=2){let o=Le.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d))*45;o+=Le.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d+1)),s(o,11,c)}return d<i.length&&s(Le.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d)),6,c),new Le(Le.Mode.ALPHANUMERIC,i.length,c)}static makeSegments(i){return i==""?[]:Le.isNumeric(i)?[Le.makeNumeric(i)]:Le.isAlphanumeric(i)?[Le.makeAlphanumeric(i)]:[Le.makeBytes(Le.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 Le(Le.Mode.ECI,0,c)}static isNumeric(i){return Le.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Le.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,c){let d=0;for(const o of i){const p=o.mode.numCharCountBits(c);if(o.numChars>=1<<p)return 1/0;d+=4+p+o.bitData.length}return d}static toUtf8ByteArray(i){i=encodeURI(i);let c=[];for(let d=0;d<i.length;d++)i.charAt(d)!="%"?c.push(i.charCodeAt(d)):(c.push(parseInt(i.substring(d+1,d+3),16)),d+=2);return c}};b.NUMERIC_REGEX=/^[0-9]*$/,b.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,b.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=b;e.QrSegment=b})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.ordinal=m,this.formatBits=b}};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={}))})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.modeBits=m,this.numBitsCharCount=b}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={}))})(Et||(Et={}));var Tt=Et;var fp={L:Tt.QrCode.Ecc.LOW,M:Tt.QrCode.Ecc.MEDIUM,Q:Tt.QrCode.Ecc.QUARTILE,H:Tt.QrCode.Ecc.HIGH},fo=128,po="L",mo="#FFFFFF",vo="#000000",go=!1,_o=1,pp=4,mp=0,vp=.1;function bo(e,t=0){const s=[];return e.forEach(function(l,m){let b=null;l.forEach(function(C,r){if(!C&&b!==null){s.push(`M${b+t} ${m+t}h${r-b}v1H${b+t}z`),b=null;return}if(r===l.length-1){if(!C)return;b===null?s.push(`M${r+t},${m+t} h1v1H${r+t}z`):s.push(`M${b+t},${m+t} h${r+1-b}v1H${b+t}z`);return}C&&b===null&&(b=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,b)=>b<t.x||b>=t.x+t.w?m:!1))}function gp(e,t,s,l){if(l==null)return null;const m=e.length+s*2,b=Math.floor(t*vp),C=m/t,r=(l.width||b)*C,i=(l.height||b)*C,c=l.x==null?e.length/2-r/2:l.x*C,d=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 y=Math.floor(c),g=Math.floor(d),n=Math.ceil(r+c-y),f=Math.ceil(i+d-g);p={x:y,y:g,w:n,h:f}}const _=l.crossOrigin;return{x:c,y:d,h:i,w:r,excavation:p,opacity:o,crossOrigin:_}}function _p(e,t){return t!=null?Math.max(Math.floor(t),0):e?pp:mp}function So({value:e,level:t,minVersion:s,includeMargin:l,marginSize:m,imageSettings:b,size:C,boostLevel:r}){let i=ee.useMemo(()=>{const y=(Array.isArray(e)?e:[e]).reduce((g,n)=>(g.push(...Tt.QrSegment.makeSegments(n)),g),[]);return Tt.QrCode.encodeSegments(y,fp[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:c,margin:d,numCells:o,calculatedImageSettings:p}=ee.useMemo(()=>{let _=i.getModules();const y=_p(l,m),g=_.length+y*2,n=gp(_,C,y,b);return{cells:_,margin:y,numCells:g,calculatedImageSettings:n}},[i,C,b,l,m]);return{qrcode:i,margin:d,cells:c,numCells:o,calculatedImageSettings:p}}var bp=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),xp=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=fo,level:C=po,bgColor:r=mo,fgColor:i=vo,includeMargin:c=go,minVersion:d=_o,boostLevel:o,marginSize:p,imageSettings:_}=l,g=dr(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=g,f=dr(g,["style"]),h=_?.src,u=ee.useRef(null),v=ee.useRef(null),x=ee.useCallback(B=>{u.current=B,typeof s=="function"?s(B):s&&(s.current=B)},[s]),[w,k]=ee.useState(!1),{margin:S,cells:E,numCells:T,calculatedImageSettings:A}=So({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:p,imageSettings:_,size:b});ee.useEffect(()=>{if(u.current!=null){const B=u.current,I=B.getContext("2d");if(!I)return;let H=E;const W=v.current,D=A!=null&&W!==null&&W.complete&&W.naturalHeight!==0&&W.naturalWidth!==0;D&&A.excavation!=null&&(H=xo(E,A.excavation));const N=window.devicePixelRatio||1;B.height=B.width=b*N;const P=b/T*N;I.scale(P,P),I.fillStyle=r,I.fillRect(0,0,T,T),I.fillStyle=i,bp?I.fill(new Path2D(bo(H,S))):E.forEach(function(O,U){O.forEach(function(X,V){X&&I.fillRect(V+S,U+S,1,1)})}),A&&(I.globalAlpha=A.opacity),D&&I.drawImage(W,A.x+S,A.y+S,A.w,A.h)}}),ee.useEffect(()=>{k(!1)},[h]);const L=ur({height:b,width:b},n);let M=null;return h!=null&&(M=ee.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{k(!0)},ref:v,crossOrigin:A?.crossOrigin})),ee.createElement(ee.Fragment,null,ee.createElement("canvas",ur({style:L,height:b,width:b,ref:x,role:"img"},f)),M)});xp.displayName="QRCodeCanvas";var yo=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=fo,level:C=po,bgColor:r=mo,fgColor:i=vo,includeMargin:c=go,minVersion:d=_o,boostLevel:o,title:p,marginSize:_,imageSettings:y}=l,g=dr(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:f,numCells:h,calculatedImageSettings:u}=So({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:_,imageSettings:y,size:b});let v=f,x=null;y!=null&&u!=null&&(u.excavation!=null&&(v=xo(f,u.excavation)),x=ee.createElement("image",{href:y.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=bo(v,n);return ee.createElement("svg",ur({height:b,width:b,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"}),x)});yo.displayName="QRCodeSVG";function Sp(){return ct({queryKey:he.tunnel.status,queryFn:()=>_e.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function yp(){const e=Pe();return Ve({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return _e.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:he.tunnel.status})}})}function Cp(){const e=Pe();return Ve({mutationFn:()=>_e.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:he.tunnel.status})}})}function Oi(){const{data:e}=Sp(),t=yp(),s=Cp(),[l,m]=R.useState(!1),[b,C]=R.useState(null),r=R.useRef(null),[i,c]=R.useState({top:0,right:0}),[d,o]=R.useState(!1),p=e?.running??!1,_=t.isPending,y=e?.shareableUrl,g=e?.token;R.useEffect(()=>{if(l&&r.current){const v=r.current.getBoundingClientRect();c({top:v.bottom+8,right:window.innerWidth-v.right})}},[l]);const n=R.useCallback(()=>{p?m(!0):t.mutate(void 0,{onSuccess:()=>m(!0)})},[p,t]),f=R.useCallback(()=>{y&&(navigator.clipboard.writeText(y),C("url"),setTimeout(()=>C(null),2e3))},[y]),h=R.useCallback(()=>{g&&(navigator.clipboard.writeText(g),C("token"),setTimeout(()=>C(null),2e3))},[g]),u=R.useCallback(()=>{s.mutate(),m(!1),o(!1)},[s]);return a.jsxs("div",{className:"relative",children:[a.jsx("button",{ref:r,onClick:n,disabled:_,className:`p-1.5 rounded-md transition-colors ${p?"text-emerald-600 hover:bg-emerald-50":"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100"}`,title:p?"Tunnel active":"Share via tunnel",children:_?a.jsx(Me,{size:16,className:"animate-spin"}):a.jsx(ks,{size:16})}),p&&!_&&a.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),l&&p&&Dt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>m(!1)}),a.jsxs("div",{className:"fixed z-[101] w-80 bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:i.top,right:i.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"}),"Tunnel Active"]}),a.jsx("button",{onClick:()=>m(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:a.jsx(Rs,{size:14})})]}),g&&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(Ba,{size:12}),a.jsx("span",{children:"Token protected"})]}),y&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsx(yo,{value:y,size:160})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{readOnly:!0,value:y??e?.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:v=>v.target.select()}),a.jsx("button",{onClick:f,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:"Copy shareable link",children:b==="url"?a.jsx(Ut,{size:14,className:"text-emerald-500"}):a.jsx(Ur,{size:14})})]}),g&&a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{onClick:()=>o(!d),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:d?"Hide token":"Show token"}),d&&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:g}),a.jsx("button",{onClick:h,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:"Copy token",children:b==="token"?a.jsx(Ut,{size:14,className:"text-emerald-500"}):a.jsx(Ur,{size:14})})]})]}),a.jsx("button",{onClick:u,disabled:s.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:s.isPending?"Stopping...":"Stop Tunnel"})]})]}),document.body)]})}const Bi={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},It=R.lazy(()=>zi(()=>import("./modal-Cw8yKTAW.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.Modal}))),tr=R.lazy(()=>zi(()=>import("./folder-picker-DG3yX995.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12,13])).then(e=>({default:e.FolderPicker}))),Ii=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"})]}),Fi=a.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),wp=260,Ep=600,Hi=400;function Hp(){const[e,t]=R.useState(null),[s,l]=R.useState(null),[m,b]=R.useState(Hi),[C,r]=R.useState(!1),[i,c]=R.useState(!1),[d,o]=R.useState(""),[p,_]=R.useState(""),[y,g]=R.useState(""),[n,f]=R.useState(""),[h,u]=R.useState(""),[v,x]=R.useState(""),[w,k]=R.useState("idle"),{files:S,addFiles:E,removeFile:T,clear:A,buildMarkdownLinks:L,isUploading:M}=Mr(),B=R.useRef(null),I=R.useRef(!1),H=R.useRef(0),W=R.useRef(Hi),D=R.useRef(null),N=Pe(),{data:P,isLoading:O}=Ds(),{data:U,isLoading:X}=Uo(),V=U?.data??[],Q=R.useMemo(()=>V.map(Mf),[V]),ae=R.useMemo(()=>V.map(q=>q.id),[V]);zf(ae);const{data:j,isLoading:F}=Bf(s??""),$=Vo({queries:s?[]:V.map(q=>({queryKey:he.tasks.list(q.id),queryFn:()=>_e.get(`/projects/${q.id}/tasks`,{params:{limit:"100"}})}))}),z=!s&&$.some(q=>q.isLoading),Z=R.useMemo(()=>{if(s)return j?.data??[];const q=[];for(const re of $)re.data?.data&&q.push(...re.data.data);return q},[s,j,$]),K=R.useMemo(()=>{const q=new Map;for(const re of Z){const oe=re.createdAt?new Date(re.createdAt).getTime():0,pe=q.get(re.projectId)??0;oe>pe&&q.set(re.projectId,oe)}return[...V].sort((re,oe)=>{const pe=q.get(re.id)??(re.createdAt?new Date(re.createdAt).getTime():0);return(q.get(oe.id)??(oe.createdAt?new Date(oe.createdAt).getTime():0))-pe})},[V,Z]),ne=R.useMemo(()=>{if(!P)return[];const q=localStorage.getItem("providerUsageCount"),re=q?JSON.parse(q):{};return[...P].sort((oe,pe)=>{const me=oe.availability.type!=="NOT_FOUND",De=pe.availability.type!=="NOT_FOUND";if(me!==De)return me?-1:1;const qe=re[oe.provider.id]??0;return(re[pe.provider.id]??0)-qe})},[P]),ue=R.useMemo(()=>Z.map(Of),[Z]),ye=R.useMemo(()=>new Set,[]),je=R.useMemo(()=>{if(!e)return null;const q=ue.find(oe=>oe.id===e);if(!q)return null;const re=V.find(oe=>oe.id===q.projectId);return{id:q.id,projectId:q.projectId,projectName:re?.name??"Unknown",projectColor:re?.color??"text-neutral-500",title:q.title,status:q.status,branch:q.branch,mainBranch:re?.mainBranch??"main",description:q.description}},[e,ue,V]),J=qo(),He=If(h),ze=Hf(),Oe=Ff(),Be=R.useCallback(q=>{ze.mutate(q,{onSuccess:()=>{e===q&&t(null),N.invalidateQueries({queryKey:he.tasks.all})}})},[ze,e,N]),Te=R.useCallback((q,re)=>{Oe.mutate({id:q,status:Lf(re)},{onError:()=>{Lo.error("状态变更失败,该操作不被允许")}})},[Oe]),G=R.useCallback(q=>{q.preventDefault(),I.current=!0,H.current=q.clientX,W.current=m,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[m]);R.useEffect(()=>{const q=oe=>{if(!I.current)return;const pe=oe.clientX-H.current,me=Math.max(wp,Math.min(Ep,W.current+pe));b(me)},re=()=>{I.current&&(I.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",re)}},[]);const ie=R.useCallback(()=>{r(!0)},[]),fe=R.useCallback(()=>{const q=localStorage.getItem("lastSelectedProjectId"),re=localStorage.getItem("lastSelectedProviderId"),oe=q&&K.find(De=>De.id===q)?q:s??K[0]?.id??"";u(oe);const pe=ne?.find(De=>De.availability.type!=="NOT_FOUND"),me=re&&ne?.find(De=>De.provider.id===re&&De.availability.type!=="NOT_FOUND")?re:pe?.provider.id??"";x(me),k("idle"),c(!0)},[s,K,ne]),te=R.useCallback(()=>{r(!1),o(""),_("")},[]),ge=R.useCallback(()=>{w==="idle"&&(c(!1),g(""),f(""),u(""),x(""),k("idle"),A())},[w,A]),ce=R.useCallback(async()=>{if(!(!d.trim()||!p.trim()))try{await J.mutateAsync({name:d.trim(),repoPath:p.trim()}),te()}catch{}},[d,p,J,te]),Ce=ro(),Ne=R.useCallback(async()=>{if(!(!y.trim()||!h))try{const q=L(),re=[n.trim(),q].filter(Boolean).join(`
|
|
82
82
|
|
|
83
|
-
`);k("creating-task");const
|
|
83
|
+
`);k("creating-task");const oe=await He.mutateAsync({title:y.trim(),description:re||void 0});if(localStorage.setItem("lastSelectedProjectId",h),v){localStorage.setItem("lastSelectedProviderId",v);const pe=localStorage.getItem("providerUsageCount"),me=pe?JSON.parse(pe):{};me[v]=(me[v]??0)+1,localStorage.setItem("providerUsageCount",JSON.stringify(me))}if(v){const pe=[y.trim(),re].filter(Boolean).join(`
|
|
84
84
|
|
|
85
|
-
`);k("creating-workspace");const xe=await be.post(`/tasks/${ae.id}/workspaces`,{});k("creating-session");const Me=await be.post(`/workspaces/${xe.id}/sessions`,{providerId:v,prompt:pe});k("starting-session"),await Ve.mutateAsync(Me.id),await M.invalidateQueries({queryKey:ce.workspaces.list(ae.id)})}t(ae.id),k("idle"),c(!1),g(""),f(""),u(""),x(""),A()}catch{k("idle")}},[S,n,h,v,ze,Ve,M,L,A]),Ne=R.useCallback(q=>{const re=q.target.files;re&&re.length>0&&E(Array.from(re)),q.target.value=""},[E]),_e=R.useCallback(q=>{const re=q.clipboardData.items,ae=[];for(const pe of re)if(pe.kind==="file"){const xe=pe.getAsFile();xe&&ae.push(xe)}ae.length>0&&(q.preventDefault(),E(ae))},[E]),[et,bt]=R.useState(!1),dt=R.useCallback(q=>{q.preventDefault(),bt(!0)},[]),xt=R.useCallback(q=>{q.preventDefault(),bt(!1)},[]),St=R.useCallback(q=>{q.preventDefault(),bt(!1);const re=q.dataTransfer.files;re.length>0&&E(Array.from(re))},[E]),lt=K||F||z;return Uf()?e&&je?a.jsxs(a.Fragment,{children:[a.jsx(hp,{task:je,onBack:()=>t(null),onDeleteTask:Q,isDeleting:Fe.isPending}),a.jsx(R.Suspense,{fallback:null,children:a.jsx(Ot,{isOpen:C,onClose:me,title:"Create New Project",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:me,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),a.jsx("button",{onClick:Le,disabled:!d.trim()||!p.trim()||Z.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${d.trim()&&p.trim()&&!Z.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Z.isPending?"Creating...":"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:"Project Name"}),a.jsx("input",{type:"text",value:d,onChange:q=>o(q.target.value),placeholder:"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:"Repository Path"}),a.jsx(er,{value:p,onChange:_})]})]})})})]}):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:[Oi,Bi]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Mi,{}),a.jsx(Or,{to:"/settings",className:"p-1.5 text-neutral-400 active:text-neutral-900 rounded-md",children:a.jsx(Fr,{size:16})})]})]}),lt&&he.length===0?a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-neutral-400",children:"Loading..."}):a.jsx(si,{tasks:he,projects:Y,selectedTaskId:null,onSelectTask:t,filterProjectId:s,setFilterProjectId:l,width:"100%",onCreateProject:ne,onCreateTask:ge,activeTaskIds:we,onTaskStatusChange:se})]}),a.jsxs(R.Suspense,{fallback:null,children:[a.jsx(Ot,{isOpen:C,onClose:me,title:"Create New Project",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:me,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),a.jsx("button",{onClick:Le,disabled:!d.trim()||!p.trim()||Z.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${d.trim()&&p.trim()&&!Z.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Z.isPending?"Creating...":"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:"Project Name"}),a.jsx("input",{type:"text",value:d,onChange:q=>o(q.target.value),placeholder:"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:"Repository Path"}),a.jsx(er,{value:p,onChange:_})]})]})}),a.jsx(Ot,{isOpen:i,onClose:ye,title:"Create New Task",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:ye,disabled:w!=="idle",className:"px-4 py-2 text-sm text-neutral-600 disabled:opacity-50",children:"Cancel"}),a.jsx("button",{onClick:Ae,disabled:!S.trim()||!h||w!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg ${S.trim()&&h&&w==="idle"?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Pi[w]})]}),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:"Project"}),a.jsx(ns,{value:h,onChange:u,options:X.map(q=>({value:q.id,label:q.name})),placeholder:"Select project...",disabled:w!=="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:"Provider"}),a.jsx(ns,{value:v,onChange:x,options:oe.map(({provider:q,availability:re})=>({value:q.id,label:q.name+(re.type==="NOT_FOUND"?" (不可用)":""),disabled:re.type==="NOT_FOUND"})),placeholder:O?"Loading...":"Select provider...",disabled:w!=="idle"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),a.jsx("input",{type:"text",value:S,onChange:q=>g(q.target.value),placeholder:"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:w!=="idle",onKeyDown:q=>{q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&Ae()}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),a.jsxs("div",{className:`relative border rounded-lg transition-colors ${et?"border-neutral-400 bg-neutral-50":"border-neutral-200"}`,onDragOver:dt,onDragLeave:xt,onDrop:St,children:[a.jsx("textarea",{rows:3,value:n,onChange:q=>f(q.target.value),onPaste:_e,placeholder:"Optional...",className:"w-full px-3 py-2 text-sm focus:outline-none bg-transparent resize-none",disabled:w!=="idle",onKeyDown:q=>{(q.metaKey||q.ctrlKey)&&q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&Ae()}}),et&&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:"Drop files here"})})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>B.current?.click(),disabled:w!=="idle"||N,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(ds,{size:14}),"Attach files"]}),a.jsx("span",{className:"text-xs text-neutral-400",children:"or paste files"})]}),a.jsx("input",{ref:B,type:"file",multiple:!0,onChange:Ne,className:"hidden"}),a.jsx(Cs,{files:y,onRemove:j})]})]})})]})]}):a.jsxs("div",{ref:D,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:[Oi,Bi]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Mi,{}),a.jsx(Or,{to:"/settings",className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",children:a.jsx(Fr,{size:16})})]})]}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[lt&&he.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:m},children:"Loading..."}):a.jsx(si,{tasks:he,projects:Y,selectedTaskId:e,onSelectTask:t,filterProjectId:s,setFilterProjectId:l,width:m,onCreateProject:ne,onCreateTask:ge,activeTaskIds:we,onTaskStatusChange:se,onDeleteTask:Q}),a.jsx("div",{onMouseDown:ue,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:"Drag to resize"}),a.jsx(Df,{task:je,onDeleteTask:Q,isDeleting:Fe.isPending,onTaskStatusChange:se})]}),a.jsxs(R.Suspense,{fallback:null,children:[a.jsx(Ot,{isOpen:C,onClose:me,title:"Create New Project",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:me,className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors",children:"Cancel"}),a.jsx("button",{onClick:Le,disabled:!d.trim()||!p.trim()||Z.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${d.trim()&&p.trim()&&!Z.isPending?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Z.isPending?"Creating...":"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:"Project Name"}),a.jsx("input",{type:"text",value:d,onChange:q=>o(q.target.value),placeholder:"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:"Repository Path"}),a.jsx(er,{value:p,onChange:_})]}),Z.isError&&a.jsx("p",{className:"text-xs text-red-500",children:Z.error instanceof Error?Z.error.message:"Failed to create project"})]})}),a.jsx(Ot,{isOpen:i,onClose:ye,title:"Create New Task",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:ye,disabled:w!=="idle",className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:"Cancel"}),a.jsx("button",{onClick:Ae,disabled:!S.trim()||!h||w!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${S.trim()&&h&&w==="idle"?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Pi[w]})]}),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:"Project"}),a.jsx(ns,{value:h,onChange:u,options:X.map(q=>({value:q.id,label:q.name})),placeholder:"Select project...",disabled:w!=="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:"Agent"}),a.jsx(ns,{value:v,onChange:x,options:oe.map(({provider:q,availability:re})=>({value:q.id,label:q.name+(re.type==="NOT_FOUND"?" (不可用)":""),disabled:re.type==="NOT_FOUND"})),placeholder:O?"Loading...":"Select provider...",disabled:w!=="idle"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),a.jsx("input",{type:"text",value:S,onChange:q=>g(q.target.value),placeholder:"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:w!=="idle",onKeyDown:q=>{q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&Ae()}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),a.jsxs("div",{className:`relative border rounded-lg transition-colors ${et?"border-neutral-400 bg-neutral-50":"border-neutral-200"}`,onDragOver:dt,onDragLeave:xt,onDrop:St,children:[a.jsx("textarea",{rows:3,value:n,onChange:q=>f(q.target.value),onPaste:_e,placeholder:"Optional description...",className:"w-full px-3 py-2 text-sm focus:outline-none bg-transparent resize-none",disabled:w!=="idle",onKeyDown:q=>{(q.metaKey||q.ctrlKey)&&q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&Ae()}}),et&&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:"Drop files here"})})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>B.current?.click(),disabled:w!=="idle"||N,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(ds,{size:14}),"Attach files"]}),a.jsx("span",{className:"text-xs text-neutral-400",children:"or paste/drag files"})]}),a.jsx("input",{ref:B,type:"file",multiple:!0,onChange:Ne,className:"hidden"}),a.jsx(Cs,{files:y,onRemove:j})]}),ze.isError&&a.jsx("p",{className:"text-xs text-red-500",children:ze.error instanceof Error?ze.error.message:"Failed to create task"})]})})]})]})}export{Fp as ProjectKanbanPage};
|
|
85
|
+
`);k("creating-workspace");const me=await _e.post(`/tasks/${oe.id}/workspaces`,{});k("creating-session");const De=await _e.post(`/workspaces/${me.id}/sessions`,{providerId:v,prompt:pe});k("starting-session"),await Ce.mutateAsync(De.id),await N.invalidateQueries({queryKey:he.workspaces.list(oe.id)})}t(oe.id),k("idle"),c(!1),g(""),f(""),u(""),x(""),A()}catch{k("idle")}},[y,n,h,v,He,Ce,N,L,A]),Ie=R.useCallback(q=>{const re=q.target.files;re&&re.length>0&&E(Array.from(re)),q.target.value=""},[E]),be=R.useCallback(q=>{const re=q.clipboardData.items,oe=[];for(const pe of re)if(pe.kind==="file"){const me=pe.getAsFile();me&&oe.push(me)}oe.length>0&&(q.preventDefault(),E(oe))},[E]),[Qe,ht]=R.useState(!1),ut=R.useCallback(q=>{q.preventDefault(),ht(!0)},[]),St=R.useCallback(q=>{q.preventDefault(),ht(!1)},[]),Rt=R.useCallback(q=>{q.preventDefault(),ht(!1);const re=q.dataTransfer.files;re.length>0&&E(Array.from(re))},[E]),yt=X||F||z;return qf()?e&&je?a.jsxs(a.Fragment,{children:[a.jsx(up,{task:je,onBack:()=>t(null),onDeleteTask:Be,isDeleting:ze.isPending}),a.jsx(R.Suspense,{fallback:null,children:a.jsx(It,{isOpen:C,onClose:te,title:"Create New Project",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:te,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),a.jsx("button",{onClick:ce,disabled:!d.trim()||!p.trim()||J.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${d.trim()&&p.trim()&&!J.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:J.isPending?"Creating...":"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:"Project Name"}),a.jsx("input",{type:"text",value:d,onChange:q=>o(q.target.value),placeholder:"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:"Repository Path"}),a.jsx(tr,{value:p,onChange:_})]})]})})})]}):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:[Ii,Fi]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Oi,{}),a.jsx(Br,{to:"/settings",className:"p-1.5 text-neutral-400 active:text-neutral-900 rounded-md",children:a.jsx(Hr,{size:16})})]})]}),yt&&ue.length===0?a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-neutral-400",children:"Loading..."}):a.jsx(ii,{tasks:ue,projects:Q,selectedTaskId:null,onSelectTask:t,filterProjectId:s,setFilterProjectId:l,width:"100%",onCreateProject:ie,onCreateTask:fe,activeTaskIds:ye,onTaskStatusChange:Te})]}),a.jsxs(R.Suspense,{fallback:null,children:[a.jsx(It,{isOpen:C,onClose:te,title:"Create New Project",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:te,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),a.jsx("button",{onClick:ce,disabled:!d.trim()||!p.trim()||J.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${d.trim()&&p.trim()&&!J.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:J.isPending?"Creating...":"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:"Project Name"}),a.jsx("input",{type:"text",value:d,onChange:q=>o(q.target.value),placeholder:"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:"Repository Path"}),a.jsx(tr,{value:p,onChange:_})]})]})}),a.jsx(It,{isOpen:i,onClose:ge,title:"Create New Task",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:ge,disabled:w!=="idle",className:"px-4 py-2 text-sm text-neutral-600 disabled:opacity-50",children:"Cancel"}),a.jsx("button",{onClick:Ne,disabled:!y.trim()||!h||w!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg ${y.trim()&&h&&w==="idle"?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Bi[w]})]}),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:"Project"}),a.jsx(as,{value:h,onChange:u,options:K.map(q=>({value:q.id,label:q.name})),placeholder:"Select project...",disabled:w!=="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:"Provider"}),a.jsx(as,{value:v,onChange:x,options:ne.map(({provider:q,availability:re})=>({value:q.id,label:q.name+(re.type==="NOT_FOUND"?" (不可用)":""),disabled:re.type==="NOT_FOUND"})),placeholder:O?"Loading...":"Select provider...",disabled:w!=="idle"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),a.jsx("input",{type:"text",value:y,onChange:q=>g(q.target.value),placeholder:"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:w!=="idle",onKeyDown:q=>{q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&Ne()}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),a.jsxs("div",{className:`relative border rounded-lg transition-colors ${Qe?"border-neutral-400 bg-neutral-50":"border-neutral-200"}`,onDragOver:ut,onDragLeave:St,onDrop:Rt,children:[a.jsx("textarea",{rows:3,value:n,onChange:q=>f(q.target.value),onPaste:be,placeholder:"Optional...",className:"w-full px-3 py-2 text-sm focus:outline-none bg-transparent resize-none",disabled:w!=="idle",onKeyDown:q=>{(q.metaKey||q.ctrlKey)&&q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&Ne()}}),Qe&&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:"Drop files here"})})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>B.current?.click(),disabled:w!=="idle"||M,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(ps,{size:14}),"Attach files"]}),a.jsx("span",{className:"text-xs text-neutral-400",children:"or paste files"})]}),a.jsx("input",{ref:B,type:"file",multiple:!0,onChange:Ie,className:"hidden"}),a.jsx(ws,{files:S,onRemove:T})]})]})})]})]}):a.jsxs("div",{ref:D,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:[Ii,Fi]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Oi,{}),a.jsx(Br,{to:"/settings",className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",children:a.jsx(Hr,{size:16})})]})]}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[yt&&ue.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:m},children:"Loading..."}):a.jsx(ii,{tasks:ue,projects:Q,selectedTaskId:e,onSelectTask:t,filterProjectId:s,setFilterProjectId:l,width:m,onCreateProject:ie,onCreateTask:fe,activeTaskIds:ye,onTaskStatusChange:Te,onDeleteTask:Be}),a.jsx("div",{onMouseDown:G,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:"Drag to resize"}),a.jsx(jf,{task:je,onDeleteTask:Be,isDeleting:ze.isPending,onTaskStatusChange:Te})]}),a.jsxs(R.Suspense,{fallback:null,children:[a.jsx(It,{isOpen:C,onClose:te,title:"Create New Project",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:te,className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors",children:"Cancel"}),a.jsx("button",{onClick:ce,disabled:!d.trim()||!p.trim()||J.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${d.trim()&&p.trim()&&!J.isPending?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:J.isPending?"Creating...":"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:"Project Name"}),a.jsx("input",{type:"text",value:d,onChange:q=>o(q.target.value),placeholder:"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:"Repository Path"}),a.jsx(tr,{value:p,onChange:_})]}),J.isError&&a.jsx("p",{className:"text-xs text-red-500",children:J.error instanceof Error?J.error.message:"Failed to create project"})]})}),a.jsx(It,{isOpen:i,onClose:ge,title:"Create New Task",action:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:ge,disabled:w!=="idle",className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:"Cancel"}),a.jsx("button",{onClick:Ne,disabled:!y.trim()||!h||w!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${y.trim()&&h&&w==="idle"?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Bi[w]})]}),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:"Project"}),a.jsx(as,{value:h,onChange:u,options:K.map(q=>({value:q.id,label:q.name})),placeholder:"Select project...",disabled:w!=="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:"Agent"}),a.jsx(as,{value:v,onChange:x,options:ne.map(({provider:q,availability:re})=>({value:q.id,label:q.name+(re.type==="NOT_FOUND"?" (不可用)":""),disabled:re.type==="NOT_FOUND"})),placeholder:O?"Loading...":"Select provider...",disabled:w!=="idle"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),a.jsx("input",{type:"text",value:y,onChange:q=>g(q.target.value),placeholder:"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:w!=="idle",onKeyDown:q=>{q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&Ne()}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),a.jsxs("div",{className:`relative border rounded-lg transition-colors ${Qe?"border-neutral-400 bg-neutral-50":"border-neutral-200"}`,onDragOver:ut,onDragLeave:St,onDrop:Rt,children:[a.jsx("textarea",{rows:3,value:n,onChange:q=>f(q.target.value),onPaste:be,placeholder:"Optional description...",className:"w-full px-3 py-2 text-sm focus:outline-none bg-transparent resize-none",disabled:w!=="idle",onKeyDown:q=>{(q.metaKey||q.ctrlKey)&&q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&Ne()}}),Qe&&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:"Drop files here"})})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>B.current?.click(),disabled:w!=="idle"||M,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(ps,{size:14}),"Attach files"]}),a.jsx("span",{className:"text-xs text-neutral-400",children:"or paste/drag files"})]}),a.jsx("input",{ref:B,type:"file",multiple:!0,onChange:Ie,className:"hidden"}),a.jsx(ws,{files:S,onRemove:T})]}),He.isError&&a.jsx("p",{className:"text-xs text-red-500",children:He.error instanceof Error?He.error.message:"Failed to create task"})]})})]})]})}export{Hp as ProjectKanbanPage};
|