agent-tower 0.1.7 → 0.1.9
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/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/middleware/tunnel-auth.d.ts.map +1 -1
- package/dist/middleware/tunnel-auth.js +4 -0
- package/dist/middleware/tunnel-auth.js.map +1 -1
- package/dist/services/terminal-manager.d.ts.map +1 -1
- package/dist/services/terminal-manager.js +10 -1
- package/dist/services/terminal-manager.js.map +1 -1
- package/dist/services/workspace.service.d.ts +5 -1
- package/dist/services/workspace.service.d.ts.map +1 -1
- package/dist/services/workspace.service.js +43 -5
- package/dist/services/workspace.service.js.map +1 -1
- package/dist/socket/events.d.ts +1 -1
- package/dist/socket/events.d.ts.map +1 -1
- package/dist/socket/events.js.map +1 -1
- package/dist/socket/socket-gateway.d.ts.map +1 -1
- package/dist/socket/socket-gateway.js +6 -1
- package/dist/socket/socket-gateway.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-CHlsAeGt.js → AgentDemoPage-DerZQ4Gx.js} +1 -1
- package/dist/web/assets/{DemoPage-BuI7acbi.js → DemoPage-C4GQUGY7.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-BGoKo6r7.js → NotificationSettingsPage-VfafH9Yq.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-DuWWMW-Z.js → ProfileSettingsPage-d9JwYeuz.js} +1 -1
- package/dist/web/assets/ProjectKanbanPage-Cv7GYyYS.js +75 -0
- package/dist/web/assets/{ProjectSettingsPage-CE8pGEMA.js → ProjectSettingsPage-CUWQQSkN.js} +1 -1
- package/dist/web/assets/{api-client-CvXTcmYq.js → api-client-DgR5kRP3.js} +1 -1
- package/dist/web/assets/{chevron-down-ml0TDwNN.js → chevron-down-C4k7kCKU.js} +1 -1
- package/dist/web/assets/{circle-alert-BxinJD1E.js → circle-alert-DKW_V_DS.js} +1 -1
- package/dist/web/assets/{code-block-OCS4YCEC-BcChVPQR.js → code-block-OCS4YCEC-Dn7S1wmS.js} +1 -1
- package/dist/web/assets/{folder-picker-DQQA9MJl.js → folder-picker-BOT99D65.js} +1 -1
- package/dist/web/assets/index-CqRsnxtD.css +1 -0
- package/dist/web/assets/{index-Bd8P8ri4.js → index-D4KE-GB_.js} +7 -7
- package/dist/web/assets/{loader-circle-DLsnUkgW.js → loader-circle-CWqRw5nB.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-hAoNEzYT.js → mermaid-NOHMQCX5-USaQ8Z5J.js} +4 -4
- package/dist/web/assets/{modal-DAr55LDv.js → modal--q8AO_f3.js} +1 -1
- package/dist/web/assets/{query-keys-BAUd6IYD.js → query-keys-BB9Mwoah.js} +1 -1
- package/dist/web/assets/{select-Bi3jfZzX.js → select-DDd-XcZ-.js} +1 -1
- package/dist/web/assets/{use-profiles-DSKFDf9E.js → use-profiles-BfGhdxH6.js} +1 -1
- package/dist/web/assets/{use-projects-BUtm-JeL.js → use-projects-CRQ5H1bO.js} +1 -1
- package/dist/web/assets/{x-I40qDFta.js → x-CKKtu1QQ.js} +1 -1
- package/dist/web/index.html +2 -2
- package/node_modules/@agent-tower/shared/dist/socket/events.d.ts +15 -0
- package/node_modules/@agent-tower/shared/dist/socket/events.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/socket/events.js +2 -0
- package/node_modules/@agent-tower/shared/dist/socket/events.js.map +1 -1
- package/package.json +1 -1
- package/prisma/CLAUDE.md +1 -5
- package/prisma/schema.prisma +1 -1
- package/dist/web/assets/ProjectKanbanPage-DsCdIAOu.js +0 -75
- package/dist/web/assets/index-RpcjVTWm.css +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal--q8AO_f3.js","assets/index-D4KE-GB_.js","assets/index-CqRsnxtD.css","assets/api-client-DgR5kRP3.js","assets/x-CKKtu1QQ.js","assets/folder-picker-BOT99D65.js","assets/mermaid-NOHMQCX5-USaQ8Z5J.js","assets/chevron-down-C4k7kCKU.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/loader-circle-CWqRw5nB.js","assets/circle-alert-DKW_V_DS.js","assets/use-projects-CRQ5H1bO.js","assets/query-keys-BB9Mwoah.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as uo,q as Xr,d as fo,y as po,u as De,r as R,n as mo,c as he,R as Z,z as vt,j as f,s as nt,S as Ne,C as st,i as os,g as as,A as vo,B as _o,L as Ds,_ as Li}from"./index-D4KE-GB_.js";import{Q as Mi,b as go,c as bo,e as So,d as xo,f as Co,s as As,g as Ts,w as yo,h as wo,a as Ue,q as ce,u as ut}from"./query-keys-BB9Mwoah.js";import{C as mr,h as ls,b as cs,d as hs,c as us,i as ds,G as vr,u as ji,a as Ni,e as Pi,T as Oi,P as Bi,f as Ii,S as Ls}from"./mermaid-NOHMQCX5-USaQ8Z5J.js";import{C as xt,a as ir}from"./chevron-down-C4k7kCKU.js";import{P as Yr,X as _r}from"./x-CKKtu1QQ.js";import{a as de,c as Oe,B as it}from"./api-client-DgR5kRP3.js";import{F as Eo,a as ko,c as Ro,u as Do,d as Ao}from"./use-projects-CRQ5H1bO.js";import{L as Qe}from"./loader-circle-CWqRw5nB.js";import{M as gr,T as Fi}from"./modal--q8AO_f3.js";import{S as Qt}from"./select-DDd-XcZ-.js";function Ms(e,t){const r=new Set(t);return e.filter(a=>!r.has(a))}function To(e,t,r){const a=e.slice(0);return a[t]=r,a}var Lo=class extends uo{#s;#e;#i;#n;#t;#r;#o;#a;#l;#c=[];constructor(e,t,r){super(),this.#s=e,this.#n=r,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,Xr.batch(()=>{const r=this.#t,a=this.#d(this.#i);a.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const m=a.map(u=>u.observer),x=m.map(u=>u.getCurrentResult()),y=r.length!==m.length,s=m.some((u,o)=>u!==r[o]),i=y||s,l=i?!0:x.some((u,o)=>{const p=this.#e[o];return!p||!fo(u,p)});!i&&!l||(i&&(this.#c=a,this.#t=m),this.#e=x,this.hasListeners()&&(i&&(Ms(r,m).forEach(u=>{u.destroy()}),Ms(m,r).forEach(u=>{u.subscribe(o=>{this.#f(u,o)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const r=this.#d(e),a=r.map(x=>x.observer.getOptimisticResult(x.defaultedQueryOptions)),m=r.map(x=>x.defaultedQueryOptions.queryHash);return[a,x=>this.#u(x??a,t,m),()=>this.#h(a,r)]}#h(e,t){return t.map((r,a)=>{const m=e[a];return r.defaultedQueryOptions.notifyOnChangeProps?m:r.observer.trackResult(m,x=>{t.forEach(y=>{y.observer.trackProp(x)})})})}#u(e,t,r){if(t){const a=this.#l,m=r!==void 0&&a!==void 0&&(a.length!==r.length||r.some((x,y)=>x!==a[y]));return(!this.#r||this.#e!==this.#a||m||t!==this.#o)&&(this.#o=t,this.#a=this.#e,r!==void 0&&(this.#l=r),this.#r=po(this.#r,t(e))),this.#r}return e}#d(e){const t=new Map;this.#t.forEach(a=>{const m=a.options.queryHash;if(!m)return;const x=t.get(m);x?x.push(a):t.set(m,[a])});const r=[];return e.forEach(a=>{const m=this.#s.defaultQueryOptions(a),y=t.get(m.queryHash)?.shift()??new Mi(this.#s,m);r.push({defaultedQueryOptions:m,observer:y})}),r}#f(e,t){const r=this.#t.indexOf(e);r!==-1&&(this.#e=To(this.#e,r,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#r,t=this.#h(this.#e,this.#c),r=this.#u(t,this.#n?.combine);e!==r&&Xr.batch(()=>{this.listeners.forEach(a=>{a(this.#e)})})}}};function Mo({queries:e,...t},r){const a=De(),m=go(),x=bo(),y=R.useMemo(()=>e.map(g=>{const n=a.defaultQueryOptions(g);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,a,m]);y.forEach(g=>{So(g);const n=a.getQueryCache().get(g.queryHash);xo(g,x,n)}),Co(x);const[s]=R.useState(()=>new Lo(a,y,t)),[i,l,u]=s.getOptimisticResult(y,t.combine),o=!m&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(g=>o?s.subscribe(Xr.batchCalls(g)):mo,[s,o]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),R.useEffect(()=>{s.setQueries(y,t)},[y,t,s]);const _=i.some((g,n)=>As(y[n],g))?i.flatMap((g,n)=>{const d=y[n];if(d){const c=new Mi(a,d);if(As(d,g))return Ts(d,c,x);yo(g,m)&&Ts(d,c,x)}return[]}):[];if(_.length>0)throw Promise.all(_);const C=i.find((g,n)=>{const d=y[n];return d&&wo({result:g,errorResetBoundary:x,throwOnError:d.throwOnError,query:a.getQueryCache().get(d.queryHash),suspense:d.suspense})});if(C?.error)throw C.error;return l(u())}const jo=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Hi=he("arrow-down",jo);const No=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],zi=he("arrow-right",No);const Po=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Wi=he("arrow-up",Po);const Oo=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],js=he("circle-check-big",Oo);const Bo=[["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"}]],br=he("code-xml",Bo);const Io=[["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"}]],Ns=he("copy",Io);const Fo=[["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"}]],Ui=he("ellipsis-vertical",Fo);const Ho=[["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"}]],zo=he("file-braces-corner",Ho);const Wo=[["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"}]],Vr=he("file-code-corner",Wo);const Uo=[["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"}]],$o=he("file-exclamation-point",Uo);const Ko=[["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"}]],$i=he("file-text",Ko);const qo=[["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"}]],Ki=he("folder-open",qo);const Xo=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Yo=he("gauge",Xo);const Vo=[["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"}]],Go=he("git-branch",Vo);const Qo=[["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"}]],Zo=he("git-fork",Qo);const Jo=[["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"}]],It=he("git-graph",Jo);const ea=[["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"}]],qi=he("git-merge",ea);const ta=[["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"}]],fs=he("image",ta);const ra=[["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"}]],Ps=he("layers",ra);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"}]],ia=he("maximize",sa);const na=[["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"}]],oa=he("message-square",na);const aa=[["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"}]],la=he("panel-left-close",aa);const ca=[["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"}]],ha=he("panel-left-open",ca);const ua=[["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"}]],da=he("panel-right-close",ua);const fa=[["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"}]],pa=he("panel-right-open",fa);const ma=[["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"}]],bt=he("play",ma);const va=[["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"}]],_a=he("refresh-cw",va);const ga=[["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=he("shield",ga);const Sa=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],nr=he("terminal",Sa);const xa=[["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"}]],ps=he("triangle-alert",xa);const Ca=[["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"}]],ya=he("zap",Ca);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"}]],Ea=he("zoom-in",wa);const ka=[["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"}]],Ra=he("zoom-out",ka),Sr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ct(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ms(e){return"nodeType"in e}function We(e){var t,r;return e?Ct(e)?e:ms(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function vs(e){const{Document:t}=We(e);return e instanceof t}function Ut(e){return Ct(e)?!1:e instanceof We(e).HTMLElement}function Xi(e){return e instanceof We(e).SVGElement}function yt(e){return e?Ct(e)?e.document:ms(e)?vs(e)?e:Ut(e)||Xi(e)?e.ownerDocument:document:document:document}const ot=Sr?R.useLayoutEffect:R.useEffect;function xr(e){const t=R.useRef(e);return ot(()=>{t.current=e}),R.useCallback(function(){for(var r=arguments.length,a=new Array(r),m=0;m<r;m++)a[m]=arguments[m];return t.current==null?void 0:t.current(...a)},[])}function Da(){const e=R.useRef(null),t=R.useCallback((a,m)=>{e.current=setInterval(a,m)},[]),r=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Ft(e,t){t===void 0&&(t=[e]);const r=R.useRef(e);return ot(()=>{r.current!==e&&(r.current=e)},t),r}function $t(e,t){const r=R.useRef();return R.useMemo(()=>{const a=e(r.current);return r.current=a,a},[...t])}function or(e){const t=xr(e),r=R.useRef(null),a=R.useCallback(m=>{m!==r.current&&t?.(m,r.current),r.current=m},[]);return[r,a]}function ar(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let Nr={};function Cr(e,t){return R.useMemo(()=>{if(t)return t;const r=Nr[e]==null?0:Nr[e]+1;return Nr[e]=r,e+"-"+r},[e,t])}function Yi(e){return function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),m=1;m<r;m++)a[m-1]=arguments[m];return a.reduce((x,y)=>{const s=Object.entries(y);for(const[i,l]of s){const u=x[i];u!=null&&(x[i]=u+e*l)}return x},{...t})}}const St=Yi(1),lr=Yi(-1);function Aa(e){return"clientX"in e&&"clientY"in e}function _s(e){if(!e)return!1;const{KeyboardEvent:t}=We(e.target);return t&&e instanceof t}function Ta(e){if(!e)return!1;const{TouchEvent:t}=We(e.target);return t&&e instanceof t}function cr(e){if(Ta(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Aa(e)?{x:e.clientX,y:e.clientY}:null}const Ht=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Ht.Translate.toString(e),Ht.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}}),Os="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function La(e){return e.matches(Os)?e:e.querySelector(Os)}const Ma={display:"none"};function ja(e){let{id:t,value:r}=e;return Z.createElement("div",{id:t,style:Ma},r)}function Na(e){let{id:t,announcement:r,ariaLiveType:a="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 Z.createElement("div",{id:t,style:m,role:"status","aria-live":a,"aria-atomic":!0},r)}function Pa(){const[e,t]=R.useState("");return{announce:R.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const Vi=R.createContext(null);function Oa(e){const t=R.useContext(Vi);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ba(){const[e]=R.useState(()=>new Set),t=R.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[R.useCallback(a=>{let{type:m,event:x}=a;e.forEach(y=>{var s;return(s=y[m])==null?void 0:s.call(y,x)})},[e]),t]}const Ia={draggable:`
|
|
3
|
+
To pick up a draggable item, press the space bar.
|
|
4
|
+
While dragging, use the arrow keys to move the item.
|
|
5
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
6
|
+
`},Fa={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Ha(e){let{announcements:t=Fa,container:r,hiddenTextDescribedById:a,screenReaderInstructions:m=Ia}=e;const{announce:x,announcement:y}=Pa(),s=Cr("DndLiveRegion"),[i,l]=R.useState(!1);if(R.useEffect(()=>{l(!0)},[]),Oa(R.useMemo(()=>({onDragStart(o){let{active:p}=o;x(t.onDragStart({active:p}))},onDragMove(o){let{active:p,over:_}=o;t.onDragMove&&x(t.onDragMove({active:p,over:_}))},onDragOver(o){let{active:p,over:_}=o;x(t.onDragOver({active:p,over:_}))},onDragEnd(o){let{active:p,over:_}=o;x(t.onDragEnd({active:p,over:_}))},onDragCancel(o){let{active:p,over:_}=o;x(t.onDragCancel({active:p,over:_}))}}),[x,t])),!i)return null;const u=Z.createElement(Z.Fragment,null,Z.createElement(ja,{id:a,value:m.draggable}),Z.createElement(Na,{id:s,announcement:y}));return r?vt.createPortal(u,r):u}var Me;(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"})(Me||(Me={}));function hr(){}function za(e,t){return R.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Wa(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return R.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const et=Object.freeze({x:0,y:0});function Ua(e,t){const r=cr(e);if(!r)return"0 0";const a={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return a.x+"% "+a.y+"%"}function $a(e,t){let{data:{value:r}}=e,{data:{value:a}}=t;return a-r}function Ka(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function qa(e,t){const r=Math.max(t.top,e.top),a=Math.max(t.left,e.left),m=Math.min(t.left+t.width,e.left+e.width),x=Math.min(t.top+t.height,e.top+e.height),y=m-a,s=x-r;if(a<m&&r<x){const i=t.width*t.height,l=e.width*e.height,u=y*s,o=u/(i+l-u);return Number(o.toFixed(4))}return 0}const Xa=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:a}=e;const m=[];for(const x of a){const{id:y}=x,s=r.get(y);if(s){const i=qa(s,t);i>0&&m.push({id:y,data:{droppableContainer:x,value:i}})}}return m.sort($a)};function Ya(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Gi(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:et}function Va(e){return function(r){for(var a=arguments.length,m=new Array(a>1?a-1:0),x=1;x<a;x++)m[x-1]=arguments[x];return m.reduce((y,s)=>({...y,top:y.top+e*s.y,bottom:y.bottom+e*s.y,left:y.left+e*s.x,right:y.right+e*s.x}),{...r})}}const Ga=Va(1);function Qi(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 Qa(e,t,r){const a=Qi(t);if(!a)return e;const{scaleX:m,scaleY:x,x:y,y:s}=a,i=e.left-y-(1-m)*parseFloat(r),l=e.top-s-(1-x)*parseFloat(r.slice(r.indexOf(" ")+1)),u=m?e.width/m:e.width,o=x?e.height/x:e.height;return{width:u,height:o,top:l,right:i+u,bottom:l+o,left:i}}const Za={ignoreTransform:!1};function Kt(e,t){t===void 0&&(t=Za);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:l,transformOrigin:u}=We(e).getComputedStyle(e);l&&(r=Qa(r,l,u))}const{top:a,left:m,width:x,height:y,bottom:s,right:i}=r;return{top:a,left:m,width:x,height:y,bottom:s,right:i}}function Bs(e){return Kt(e,{ignoreTransform:!0})}function Ja(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function el(e,t){return t===void 0&&(t=We(e).getComputedStyle(e)),t.position==="fixed"}function tl(e,t){t===void 0&&(t=We(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(m=>{const x=t[m];return typeof x=="string"?r.test(x):!1})}function gs(e,t){const r=[];function a(m){if(t!=null&&r.length>=t||!m)return r;if(vs(m)&&m.scrollingElement!=null&&!r.includes(m.scrollingElement))return r.push(m.scrollingElement),r;if(!Ut(m)||Xi(m)||r.includes(m))return r;const x=We(e).getComputedStyle(m);return m!==e&&tl(m,x)&&r.push(m),el(m,x)?r:a(m.parentNode)}return e?a(e):r}function Zi(e){const[t]=gs(e,1);return t??null}function Pr(e){return!Sr||!e?null:Ct(e)?e:ms(e)?vs(e)||e===yt(e).scrollingElement?window:Ut(e)?e:null:null}function Ji(e){return Ct(e)?e.scrollX:e.scrollLeft}function en(e){return Ct(e)?e.scrollY:e.scrollTop}function Gr(e){return{x:Ji(e),y:en(e)}}var Pe;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Pe||(Pe={}));function tn(e){return!Sr||!e?!1:e===document.scrollingElement}function rn(e){const t={x:0,y:0},r=tn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},m=e.scrollTop<=t.y,x=e.scrollLeft<=t.x,y=e.scrollTop>=a.y,s=e.scrollLeft>=a.x;return{isTop:m,isLeft:x,isBottom:y,isRight:s,maxScroll:a,minScroll:t}}const rl={x:.2,y:.2};function sl(e,t,r,a,m){let{top:x,left:y,right:s,bottom:i}=r;a===void 0&&(a=10),m===void 0&&(m=rl);const{isTop:l,isBottom:u,isLeft:o,isRight:p}=rn(e),_={x:0,y:0},C={x:0,y:0},g={height:t.height*m.y,width:t.width*m.x};return!l&&x<=t.top+g.height?(_.y=Pe.Backward,C.y=a*Math.abs((t.top+g.height-x)/g.height)):!u&&i>=t.bottom-g.height&&(_.y=Pe.Forward,C.y=a*Math.abs((t.bottom-g.height-i)/g.height)),!p&&s>=t.right-g.width?(_.x=Pe.Forward,C.x=a*Math.abs((t.right-g.width-s)/g.width)):!o&&y<=t.left+g.width&&(_.x=Pe.Backward,C.x=a*Math.abs((t.left+g.width-y)/g.width)),{direction:_,speed:C}}function il(e){if(e===document.scrollingElement){const{innerWidth:x,innerHeight:y}=window;return{top:0,left:0,right:x,bottom:y,width:x,height:y}}const{top:t,left:r,right:a,bottom:m}=e.getBoundingClientRect();return{top:t,left:r,right:a,bottom:m,width:e.clientWidth,height:e.clientHeight}}function sn(e){return e.reduce((t,r)=>St(t,Gr(r)),et)}function nl(e){return e.reduce((t,r)=>t+Ji(r),0)}function ol(e){return e.reduce((t,r)=>t+en(r),0)}function nn(e,t){if(t===void 0&&(t=Kt),!e)return;const{top:r,left:a,bottom:m,right:x}=t(e);Zi(e)&&(m<=0||x<=0||r>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const al=[["x",["left","right"],nl],["y",["top","bottom"],ol]];class bs{constructor(t,r){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 a=gs(r),m=sn(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[x,y,s]of al)for(const i of y)Object.defineProperty(this,i,{get:()=>{const l=s(a),u=m[x]-l;return this.rect[i]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class jt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...r)})},this.target=t}add(t,r,a){var m;(m=this.target)==null||m.addEventListener(t,r,a),this.listeners.push([t,r,a])}}function ll(e){const{EventTarget:t}=We(e);return e instanceof t?e:yt(e)}function Or(e,t){const r=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+a**2)>t:"x"in t&&"y"in t?r>t.x&&a>t.y:"x"in t?r>t.x:"y"in t?a>t.y:!1}var Ye;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ye||(Ye={}));function Is(e){e.preventDefault()}function cl(e){e.stopPropagation()}var ve;(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"})(ve||(ve={}));const on={start:[ve.Space,ve.Enter],cancel:[ve.Esc],end:[ve.Space,ve.Enter,ve.Tab]},hl=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case ve.Right:return{...r,x:r.x+25};case ve.Left:return{...r,x:r.x-25};case ve.Down:return{...r,y:r.y+25};case ve.Up:return{...r,y:r.y-25}}};class an{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:r}}=t;this.props=t,this.listeners=new jt(yt(r)),this.windowListeners=new jt(We(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ye.Resize,this.handleCancel),this.windowListeners.add(Ye.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ye.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,a=t.node.current;a&&nn(a),r(et)}handleKeyDown(t){if(_s(t)){const{active:r,context:a,options:m}=this.props,{keyboardCodes:x=on,coordinateGetter:y=hl,scrollBehavior:s="smooth"}=m,{code:i}=t;if(x.end.includes(i)){this.handleEnd(t);return}if(x.cancel.includes(i)){this.handleCancel(t);return}const{collisionRect:l}=a.current,u=l?{x:l.left,y:l.top}:et;this.referenceCoordinates||(this.referenceCoordinates=u);const o=y(t,{active:r,context:a.current,currentCoordinates:u});if(o){const p=lr(o,u),_={x:0,y:0},{scrollableAncestors:C}=a.current;for(const g of C){const n=t.code,{isTop:d,isRight:c,isLeft:h,isBottom:v,maxScroll:b,minScroll:w}=rn(g),k=il(g),S={x:Math.min(n===ve.Right?k.right-k.width/2:k.right,Math.max(n===ve.Right?k.left:k.left+k.width/2,o.x)),y:Math.min(n===ve.Down?k.bottom-k.height/2:k.bottom,Math.max(n===ve.Down?k.top:k.top+k.height/2,o.y))},E=n===ve.Right&&!c||n===ve.Left&&!h,T=n===ve.Down&&!v||n===ve.Up&&!d;if(E&&S.x!==o.x){const L=g.scrollLeft+p.x,M=n===ve.Right&&L<=b.x||n===ve.Left&&L>=w.x;if(M&&!p.y){g.scrollTo({left:L,behavior:s});return}M?_.x=g.scrollLeft-L:_.x=n===ve.Right?g.scrollLeft-b.x:g.scrollLeft-w.x,_.x&&g.scrollBy({left:-_.x,behavior:s});break}else if(T&&S.y!==o.y){const L=g.scrollTop+p.y,M=n===ve.Down&&L<=b.y||n===ve.Up&&L>=w.y;if(M&&!p.x){g.scrollTo({top:L,behavior:s});return}M?_.y=g.scrollTop-L:_.y=n===ve.Down?g.scrollTop-b.y:g.scrollTop-w.y,_.y&&g.scrollBy({top:-_.y,behavior:s});break}}this.handleMove(t,St(lr(o,this.referenceCoordinates),_))}}}handleMove(t,r){const{onMove:a}=this.props;t.preventDefault(),a(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}an.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:a=on,onActivation:m}=t,{active:x}=r;const{code:y}=e.nativeEvent;if(a.start.includes(y)){const s=x.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),m?.({event:e.nativeEvent}),!0)}return!1}}];function Fs(e){return!!(e&&"distance"in e)}function Hs(e){return!!(e&&"delay"in e)}class Ss{constructor(t,r,a){var m;a===void 0&&(a=ll(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=r;const{event:x}=t,{target:y}=x;this.props=t,this.events=r,this.document=yt(y),this.documentListeners=new jt(this.document),this.listeners=new jt(a),this.windowListeners=new jt(We(y)),this.initialCoordinates=(m=cr(x))!=null?m:et,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:r,bypassActivationConstraint:a}}}=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(Ye.Resize,this.handleCancel),this.windowListeners.add(Ye.DragStart,Is),this.windowListeners.add(Ye.VisibilityChange,this.handleCancel),this.windowListeners.add(Ye.ContextMenu,Is),this.documentListeners.add(Ye.Keydown,this.handleKeydown),r){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Hs(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Fs(r)){this.handlePending(r);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,r){const{active:a,onPending:m}=this.props;m(a,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ye.Click,cl,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ye.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:a,initialCoordinates:m,props:x}=this,{onMove:y,options:{activationConstraint:s}}=x;if(!m)return;const i=(r=cr(t))!=null?r:et,l=lr(m,i);if(!a&&s){if(Fs(s)){if(s.tolerance!=null&&Or(l,s.tolerance))return this.handleCancel();if(Or(l,s.distance))return this.handleStart()}if(Hs(s)&&Or(l,s.tolerance))return this.handleCancel();this.handlePending(s,l);return}t.cancelable&&t.preventDefault(),y(i)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ve.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ul={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class xs extends Ss{constructor(t){const{event:r}=t,a=yt(r.target);super(t,ul,a)}}xs.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;return!r.isPrimary||r.button!==0?!1:(a?.({event:r}),!0)}}];const dl={move:{name:"mousemove"},end:{name:"mouseup"}};var Qr;(function(e){e[e.RightClick=2]="RightClick"})(Qr||(Qr={}));class fl extends Ss{constructor(t){super(t,dl,yt(t.event.target))}}fl.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;return r.button===Qr.RightClick?!1:(a?.({event:r}),!0)}}];const Br={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class pl extends Ss{constructor(t){super(t,Br)}static setup(){return window.addEventListener(Br.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Br.move.name,t)};function t(){}}}pl.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;const{touches:m}=r;return m.length>1?!1:(a?.({event:r}),!0)}}];var Nt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Nt||(Nt={}));var ur;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ur||(ur={}));function ml(e){let{acceleration:t,activator:r=Nt.Pointer,canScroll:a,draggingRect:m,enabled:x,interval:y=5,order:s=ur.TreeOrder,pointerCoordinates:i,scrollableAncestors:l,scrollableAncestorRects:u,delta:o,threshold:p}=e;const _=_l({delta:o,disabled:!x}),[C,g]=Da(),n=R.useRef({x:0,y:0}),d=R.useRef({x:0,y:0}),c=R.useMemo(()=>{switch(r){case Nt.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case Nt.DraggableRect:return m}},[r,m,i]),h=R.useRef(null),v=R.useCallback(()=>{const w=h.current;if(!w)return;const k=n.current.x*d.current.x,S=n.current.y*d.current.y;w.scrollBy(k,S)},[]),b=R.useMemo(()=>s===ur.TreeOrder?[...l].reverse():l,[s,l]);R.useEffect(()=>{if(!x||!l.length||!c){g();return}for(const w of b){if(a?.(w)===!1)continue;const k=l.indexOf(w),S=u[k];if(!S)continue;const{direction:E,speed:T}=sl(w,S,c,t,p);for(const L of["x","y"])_[L][E[L]]||(T[L]=0,E[L]=0);if(T.x>0||T.y>0){g(),h.current=w,C(v,y),n.current=T,d.current=E;return}}n.current={x:0,y:0},d.current={x:0,y:0},g()},[t,v,a,g,x,y,JSON.stringify(c),JSON.stringify(_),C,l,b,u,JSON.stringify(p)])}const vl={x:{[Pe.Backward]:!1,[Pe.Forward]:!1},y:{[Pe.Backward]:!1,[Pe.Forward]:!1}};function _l(e){let{delta:t,disabled:r}=e;const a=ar(t);return $t(m=>{if(r||!a||!m)return vl;const x={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[Pe.Backward]:m.x[Pe.Backward]||x.x===-1,[Pe.Forward]:m.x[Pe.Forward]||x.x===1},y:{[Pe.Backward]:m.y[Pe.Backward]||x.y===-1,[Pe.Forward]:m.y[Pe.Forward]||x.y===1}}},[r,t,a])}function gl(e,t){const r=t!=null?e.get(t):void 0,a=r?r.node.current:null;return $t(m=>{var x;return t==null?null:(x=a??m)!=null?x:null},[a,t])}function bl(e,t){return R.useMemo(()=>e.reduce((r,a)=>{const{sensor:m}=a,x=m.activators.map(y=>({eventName:y.eventName,handler:t(y.handler,a)}));return[...r,...x]},[]),[e,t])}var zt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zt||(zt={}));var Zr;(function(e){e.Optimized="optimized"})(Zr||(Zr={}));const zs=new Map;function Sl(e,t){let{dragging:r,dependencies:a,config:m}=t;const[x,y]=R.useState(null),{frequency:s,measure:i,strategy:l}=m,u=R.useRef(e),o=n(),p=Ft(o),_=R.useCallback(function(d){d===void 0&&(d=[]),!p.current&&y(c=>c===null?d:c.concat(d.filter(h=>!c.includes(h))))},[p]),C=R.useRef(null),g=$t(d=>{if(o&&!r)return zs;if(!d||d===zs||u.current!==e||x!=null){const c=new Map;for(let h of e){if(!h)continue;if(x&&x.length>0&&!x.includes(h.id)&&h.rect.current){c.set(h.id,h.rect.current);continue}const v=h.node.current,b=v?new bs(i(v),v):null;h.rect.current=b,b&&c.set(h.id,b)}return c}return d},[e,x,r,o,i]);return R.useEffect(()=>{u.current=e},[e]),R.useEffect(()=>{o||_()},[r,o]),R.useEffect(()=>{x&&x.length>0&&y(null)},[JSON.stringify(x)]),R.useEffect(()=>{o||typeof s!="number"||C.current!==null||(C.current=setTimeout(()=>{_(),C.current=null},s))},[s,o,_,...a]),{droppableRects:g,measureDroppableContainers:_,measuringScheduled:x!=null};function n(){switch(l){case zt.Always:return!1;case zt.BeforeDragging:return r;default:return!r}}}function Cs(e,t){return $t(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function xl(e,t){return Cs(e,t)}function Cl(e){let{callback:t,disabled:r}=e;const a=xr(t),m=R.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:x}=window;return new x(a)},[a,r]);return R.useEffect(()=>()=>m?.disconnect(),[m]),m}function yr(e){let{callback:t,disabled:r}=e;const a=xr(t),m=R.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:x}=window;return new x(a)},[r]);return R.useEffect(()=>()=>m?.disconnect(),[m]),m}function yl(e){return new bs(Kt(e),e)}function Ws(e,t,r){t===void 0&&(t=yl);const[a,m]=R.useState(null);function x(){m(i=>{if(!e)return null;if(e.isConnected===!1){var l;return(l=i??r)!=null?l:null}const u=t(e);return JSON.stringify(i)===JSON.stringify(u)?i:u})}const y=Cl({callback(i){if(e)for(const l of i){const{type:u,target:o}=l;if(u==="childList"&&o instanceof HTMLElement&&o.contains(e)){x();break}}}}),s=yr({callback:x});return ot(()=>{x(),e?(s?.observe(e),y?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),y?.disconnect())},[e]),a}function wl(e){const t=Cs(e);return Gi(e,t)}const Us=[];function El(e){const t=R.useRef(e),r=$t(a=>e?a&&a!==Us&&e&&t.current&&e.parentNode===t.current.parentNode?a:gs(e):Us,[e]);return R.useEffect(()=>{t.current=e},[e]),r}function kl(e){const[t,r]=R.useState(null),a=R.useRef(e),m=R.useCallback(x=>{const y=Pr(x.target);y&&r(s=>s?(s.set(y,Gr(y)),new Map(s)):null)},[]);return R.useEffect(()=>{const x=a.current;if(e!==x){y(x);const s=e.map(i=>{const l=Pr(i);return l?(l.addEventListener("scroll",m,{passive:!0}),[l,Gr(l)]):null}).filter(i=>i!=null);r(s.length?new Map(s):null),a.current=e}return()=>{y(e),y(x)};function y(s){s.forEach(i=>{const l=Pr(i);l?.removeEventListener("scroll",m)})}},[m,e]),R.useMemo(()=>e.length?t?Array.from(t.values()).reduce((x,y)=>St(x,y),et):sn(e):et,[e,t])}function $s(e,t){t===void 0&&(t=[]);const r=R.useRef(null);return R.useEffect(()=>{r.current=null},t),R.useEffect(()=>{const a=e!==et;a&&!r.current&&(r.current=e),!a&&r.current&&(r.current=null)},[e]),r.current?lr(e,r.current):et}function Rl(e){R.useEffect(()=>{if(!Sr)return;const t=e.map(r=>{let{sensor:a}=r;return a.setup==null?void 0:a.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function Dl(e,t){return R.useMemo(()=>e.reduce((r,a)=>{let{eventName:m,handler:x}=a;return r[m]=y=>{x(y,t)},r},{}),[e,t])}function ln(e){return R.useMemo(()=>e?Ja(e):null,[e])}const Ks=[];function Al(e,t){t===void 0&&(t=Kt);const[r]=e,a=ln(r?We(r):null),[m,x]=R.useState(Ks);function y(){x(()=>e.length?e.map(i=>tn(i)?a:new bs(t(i),i)):Ks)}const s=yr({callback:y});return ot(()=>{s?.disconnect(),y(),e.forEach(i=>s?.observe(i))},[e]),m}function cn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ut(t)?t:e}function Tl(e){let{measure:t}=e;const[r,a]=R.useState(null),m=R.useCallback(l=>{for(const{target:u}of l)if(Ut(u)){a(o=>{const p=t(u);return o?{...o,width:p.width,height:p.height}:p});break}},[t]),x=yr({callback:m}),y=R.useCallback(l=>{const u=cn(l);x?.disconnect(),u&&x?.observe(u),a(u?t(u):null)},[t,x]),[s,i]=or(y);return R.useMemo(()=>({nodeRef:s,rect:r,setRef:i}),[r,s,i])}const Ll=[{sensor:xs,options:{}},{sensor:an,options:{}}],Ml={current:{}},sr={draggable:{measure:Bs},droppable:{measure:Bs,strategy:zt.WhileDragging,frequency:Zr.Optimized},dragOverlay:{measure:Kt}};class Pt extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,a;return(r=(a=this.get(t))==null?void 0:a.node.current)!=null?r:void 0}}const jl={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Pt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:hr},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:sr,measureDroppableContainers:hr,windowRect:null,measuringScheduled:!1},hn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:hr,draggableNodes:new Map,over:null,measureDroppableContainers:hr},qt=R.createContext(hn),un=R.createContext(jl);function Nl(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Pt}}}function Pl(e,t){switch(t.type){case Me.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Me.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 Me.DragEnd:case Me.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Me.RegisterDroppable:{const{element:r}=t,{id:a}=r,m=new Pt(e.droppable.containers);return m.set(a,r),{...e,droppable:{...e.droppable,containers:m}}}case Me.SetDroppableDisabled:{const{id:r,key:a,disabled:m}=t,x=e.droppable.containers.get(r);if(!x||a!==x.key)return e;const y=new Pt(e.droppable.containers);return y.set(r,{...x,disabled:m}),{...e,droppable:{...e.droppable,containers:y}}}case Me.UnregisterDroppable:{const{id:r,key:a}=t,m=e.droppable.containers.get(r);if(!m||a!==m.key)return e;const x=new Pt(e.droppable.containers);return x.delete(r),{...e,droppable:{...e.droppable,containers:x}}}default:return e}}function Ol(e){let{disabled:t}=e;const{active:r,activatorEvent:a,draggableNodes:m}=R.useContext(qt),x=ar(a),y=ar(r?.id);return R.useEffect(()=>{if(!t&&!a&&x&&y!=null){if(!_s(x)||document.activeElement===x.target)return;const s=m.get(y);if(!s)return;const{activatorNode:i,node:l}=s;if(!i.current&&!l.current)return;requestAnimationFrame(()=>{for(const u of[i.current,l.current]){if(!u)continue;const o=La(u);if(o){o.focus();break}}})}},[a,t,m,y,x]),null}function dn(e,t){let{transform:r,...a}=t;return e!=null&&e.length?e.reduce((m,x)=>x({transform:m,...a}),r):r}function Bl(e){return R.useMemo(()=>({draggable:{...sr.draggable,...e?.draggable},droppable:{...sr.droppable,...e?.droppable},dragOverlay:{...sr.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Il(e){let{activeNode:t,measure:r,initialRect:a,config:m=!0}=e;const x=R.useRef(!1),{x:y,y:s}=typeof m=="boolean"?{x:m,y:m}:m;ot(()=>{if(!y&&!s||!t){x.current=!1;return}if(x.current||!a)return;const l=t?.node.current;if(!l||l.isConnected===!1)return;const u=r(l),o=Gi(u,a);if(y||(o.x=0),s||(o.y=0),x.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const p=Zi(l);p&&p.scrollBy({top:o.y,left:o.x})}},[t,y,s,a,r])}const wr=R.createContext({...et,scaleX:1,scaleY:1});var at;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(at||(at={}));const Fl=R.memo(function(t){var r,a,m,x;let{id:y,accessibility:s,autoScroll:i=!0,children:l,sensors:u=Ll,collisionDetection:o=Xa,measuring:p,modifiers:_,...C}=t;const g=R.useReducer(Pl,void 0,Nl),[n,d]=g,[c,h]=Ba(),[v,b]=R.useState(at.Uninitialized),w=v===at.Initialized,{draggable:{active:k,nodes:S,translate:E},droppable:{containers:T}}=n,L=k!=null?S.get(k):null,M=R.useRef({initial:null,translated:null}),N=R.useMemo(()=>{var Re;return k!=null?{id:k,data:(Re=L?.data)!=null?Re:Ml,rect:M}:null},[k,L]),I=R.useRef(null),[F,H]=R.useState(null),[z,D]=R.useState(null),j=Ft(C,Object.values(C)),P=Cr("DndDescribedBy",y),O=R.useMemo(()=>T.getEnabled(),[T]),$=Bl(p),{droppableRects:q,measureDroppableContainers:X,measuringScheduled:G}=Sl(O,{dragging:w,dependencies:[E.x,E.y],config:$.droppable}),se=gl(S,k),A=R.useMemo(()=>z?cr(z):null,[z]),B=Dt(),U=xl(se,$.draggable.measure);Il({activeNode:k!=null?S.get(k):null,config:B.layoutShiftCompensation,initialRect:U,measure:$.draggable.measure});const W=Ws(se,$.draggable.measure,U),J=Ws(se?se.parentElement:null),Y=R.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=T.getNodeFor((r=Y.current.over)==null?void 0:r.id),ue=Tl({measure:$.dragOverlay.measure}),_e=(a=ue.nodeRef.current)!=null?a:se,we=w?(m=ue.rect)!=null?m:W:null,te=!!(ue.nodeRef.current&&ue.rect),ke=wl(te?null:W),Ae=ln(_e?We(_e):null),Q=El(w?ie??se:null),re=Al(Q),Se=dn(_,{transform:{x:E.x-ke.x,y:E.y-ke.y,scaleX:1,scaleY:1},activatorEvent:z,active:N,activeNodeRect:W,containerNodeRect:J,draggingNodeRect:we,over:Y.current.over,overlayNodeRect:ue.rect,scrollableAncestors:Q,scrollableAncestorRects:re,windowRect:Ae}),ae=A?St(A,E):null,K=kl(Q),ne=$s(K),me=$s(K,[W]),Be=St(Se,ne),Te=we?Ga(we,Se):null,qe=N&&Te?o({active:N,collisionRect:Te,droppableRects:q,droppableContainers:O,pointerCoordinates:ae}):null,Ie=Ka(qe,"id"),[je,fe]=R.useState(null),wt=te?Se:St(Se,me),Tr=Ya(wt,(x=je?.rect)!=null?x:null,W),Et=R.useRef(null),kt=R.useCallback((Re,Fe)=>{let{sensor:He,options:tt}=Fe;if(I.current==null)return;const ze=S.get(I.current);if(!ze)return;const V=Re.nativeEvent,ee=new He({active:I.current,activeNode:ze,event:V,options:tt,context:Y,onAbort(xe){if(!S.get(xe))return;const{onDragAbort:pe}=j.current,$e={id:xe};pe?.($e),c({type:"onDragAbort",event:$e})},onPending(xe,Le,pe,$e){if(!S.get(xe))return;const{onDragPending:Xe}=j.current,rt={id:xe,constraint:Le,initialCoordinates:pe,offset:$e};Xe?.(rt),c({type:"onDragPending",event:rt})},onStart(xe){const Le=I.current;if(Le==null)return;const pe=S.get(Le);if(!pe)return;const{onDragStart:$e}=j.current,Ze={activatorEvent:V,active:{id:Le,data:pe.data,rect:M}};vt.unstable_batchedUpdates(()=>{$e?.(Ze),b(at.Initializing),d({type:Me.DragStart,initialCoordinates:xe,active:Le}),c({type:"onDragStart",event:Ze}),H(Et.current),D(V)})},onMove(xe){d({type:Me.DragMove,coordinates:xe})},onEnd:ge(Me.DragEnd),onCancel:ge(Me.DragCancel)});Et.current=ee;function ge(xe){return async function(){const{active:pe,collisions:$e,over:Ze,scrollAdjustedTranslate:Xe}=Y.current;let rt=null;if(pe&&Xe){const{cancelDrop:At}=j.current;rt={activatorEvent:V,active:pe,collisions:$e,delta:Xe,over:Ze},xe===Me.DragEnd&&typeof At=="function"&&await Promise.resolve(At(rt))&&(xe=Me.DragCancel)}I.current=null,vt.unstable_batchedUpdates(()=>{d({type:xe}),b(at.Uninitialized),fe(null),H(null),D(null),Et.current=null;const At=xe===Me.DragEnd?"onDragEnd":"onDragCancel";if(rt){const jr=j.current[At];jr?.(rt),c({type:At,event:rt})}})}}},[S]),Rt=R.useCallback((Re,Fe)=>(He,tt)=>{const ze=He.nativeEvent,V=S.get(tt);if(I.current!==null||!V||ze.dndKit||ze.defaultPrevented)return;const ee={active:V};Re(He,Fe.options,ee)===!0&&(ze.dndKit={capturedBy:Fe.sensor},I.current=tt,kt(He,Fe))},[S,kt]),Gt=bl(u,Rt);Rl(u),ot(()=>{W&&v===at.Initializing&&b(at.Initialized)},[W,v]),R.useEffect(()=>{const{onDragMove:Re}=j.current,{active:Fe,activatorEvent:He,collisions:tt,over:ze}=Y.current;if(!Fe||!He)return;const V={active:Fe,activatorEvent:He,collisions:tt,delta:{x:Be.x,y:Be.y},over:ze};vt.unstable_batchedUpdates(()=>{Re?.(V),c({type:"onDragMove",event:V})})},[Be.x,Be.y]),R.useEffect(()=>{const{active:Re,activatorEvent:Fe,collisions:He,droppableContainers:tt,scrollAdjustedTranslate:ze}=Y.current;if(!Re||I.current==null||!Fe||!ze)return;const{onDragOver:V}=j.current,ee=tt.get(Ie),ge=ee&&ee.rect.current?{id:ee.id,rect:ee.rect.current,data:ee.data,disabled:ee.disabled}:null,xe={active:Re,activatorEvent:Fe,collisions:He,delta:{x:ze.x,y:ze.y},over:ge};vt.unstable_batchedUpdates(()=>{fe(ge),V?.(xe),c({type:"onDragOver",event:xe})})},[Ie]),ot(()=>{Y.current={activatorEvent:z,active:N,activeNode:se,collisionRect:Te,collisions:qe,droppableRects:q,draggableNodes:S,draggingNode:_e,draggingNodeRect:we,droppableContainers:T,over:je,scrollableAncestors:Q,scrollAdjustedTranslate:Be},M.current={initial:we,translated:Te}},[N,se,qe,Te,S,_e,we,q,T,je,Q,Be]),ml({...B,delta:E,draggingRect:Te,pointerCoordinates:ae,scrollableAncestors:Q,scrollableAncestorRects:re});const Lr=R.useMemo(()=>({active:N,activeNode:se,activeNodeRect:W,activatorEvent:z,collisions:qe,containerNodeRect:J,dragOverlay:ue,draggableNodes:S,droppableContainers:T,droppableRects:q,over:je,measureDroppableContainers:X,scrollableAncestors:Q,scrollableAncestorRects:re,measuringConfiguration:$,measuringScheduled:G,windowRect:Ae}),[N,se,W,z,qe,J,ue,S,T,q,je,X,Q,re,$,G,Ae]),Mr=R.useMemo(()=>({activatorEvent:z,activators:Gt,active:N,activeNodeRect:W,ariaDescribedById:{draggable:P},dispatch:d,draggableNodes:S,over:je,measureDroppableContainers:X}),[z,Gt,N,W,d,P,S,je,X]);return Z.createElement(Vi.Provider,{value:h},Z.createElement(qt.Provider,{value:Mr},Z.createElement(un.Provider,{value:Lr},Z.createElement(wr.Provider,{value:Tr},l)),Z.createElement(Ol,{disabled:s?.restoreFocus===!1})),Z.createElement(Ha,{...s,hiddenTextDescribedById:P}));function Dt(){const Re=F?.autoScrollEnabled===!1,Fe=typeof i=="object"?i.enabled===!1:i===!1,He=w&&!Re&&!Fe;return typeof i=="object"?{...i,enabled:He}:{enabled:He}}}),Hl=R.createContext(null),qs="button",zl="Draggable";function Wl(e){let{id:t,data:r,disabled:a=!1,attributes:m}=e;const x=Cr(zl),{activators:y,activatorEvent:s,active:i,activeNodeRect:l,ariaDescribedById:u,draggableNodes:o,over:p}=R.useContext(qt),{role:_=qs,roleDescription:C="draggable",tabIndex:g=0}=m??{},n=i?.id===t,d=R.useContext(n?wr:Hl),[c,h]=or(),[v,b]=or(),w=Dl(y,t),k=Ft(r);ot(()=>(o.set(t,{id:t,key:x,node:c,activatorNode:v,data:k}),()=>{const E=o.get(t);E&&E.key===x&&o.delete(t)}),[o,t]);const S=R.useMemo(()=>({role:_,tabIndex:g,"aria-disabled":a,"aria-pressed":n&&_===qs?!0:void 0,"aria-roledescription":C,"aria-describedby":u.draggable}),[a,_,g,n,C,u.draggable]);return{active:i,activatorEvent:s,activeNodeRect:l,attributes:S,isDragging:n,listeners:a?void 0:w,node:c,over:p,setNodeRef:h,setActivatorNodeRef:b,transform:d}}function Ul(){return R.useContext(un)}const $l="Droppable",Kl={timeout:25};function ql(e){let{data:t,disabled:r=!1,id:a,resizeObserverConfig:m}=e;const x=Cr($l),{active:y,dispatch:s,over:i,measureDroppableContainers:l}=R.useContext(qt),u=R.useRef({disabled:r}),o=R.useRef(!1),p=R.useRef(null),_=R.useRef(null),{disabled:C,updateMeasurementsFor:g,timeout:n}={...Kl,...m},d=Ft(g??a),c=R.useCallback(()=>{if(!o.current){o.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{l(Array.isArray(d.current)?d.current:[d.current]),_.current=null},n)},[n]),h=yr({callback:c,disabled:C||!y}),v=R.useCallback((S,E)=>{h&&(E&&(h.unobserve(E),o.current=!1),S&&h.observe(S))},[h]),[b,w]=or(v),k=Ft(t);return R.useEffect(()=>{!h||!b.current||(h.disconnect(),o.current=!1,h.observe(b.current))},[b,h]),R.useEffect(()=>(s({type:Me.RegisterDroppable,element:{id:a,key:x,disabled:r,node:b,rect:p,data:k}}),()=>s({type:Me.UnregisterDroppable,key:x,id:a})),[a]),R.useEffect(()=>{r!==u.current.disabled&&(s({type:Me.SetDroppableDisabled,id:a,key:x,disabled:r}),u.current.disabled=r)},[a,x,r,s]),{active:y,rect:p,isOver:i?.id===a,node:b,over:i,setNodeRef:w}}function Xl(e){let{animation:t,children:r}=e;const[a,m]=R.useState(null),[x,y]=R.useState(null),s=ar(r);return!r&&!a&&s&&m(s),ot(()=>{if(!x)return;const i=a?.key,l=a?.props.id;if(i==null||l==null){m(null);return}Promise.resolve(t(l,x)).then(()=>{m(null)})},[t,a,x]),Z.createElement(Z.Fragment,null,r,a?R.cloneElement(a,{ref:y}):null)}const Yl={x:0,y:0,scaleX:1,scaleY:1};function Vl(e){let{children:t}=e;return Z.createElement(qt.Provider,{value:hn},Z.createElement(wr.Provider,{value:Yl},t))}const Gl={position:"fixed",touchAction:"none"},Ql=e=>_s(e)?"transform 250ms ease":void 0,Zl=R.forwardRef((e,t)=>{let{as:r,activatorEvent:a,adjustScale:m,children:x,className:y,rect:s,style:i,transform:l,transition:u=Ql}=e;if(!s)return null;const o=m?l:{...l,scaleX:1,scaleY:1},p={...Gl,width:s.width,height:s.height,top:s.top,left:s.left,transform:Ht.Transform.toString(o),transformOrigin:m&&a?Ua(a,s):void 0,transition:typeof u=="function"?u(a):u,...i};return Z.createElement(r,{className:y,style:p,ref:t},x)}),Jl=e=>t=>{let{active:r,dragOverlay:a}=t;const m={},{styles:x,className:y}=e;if(x!=null&&x.active)for(const[s,i]of Object.entries(x.active))i!==void 0&&(m[s]=r.node.style.getPropertyValue(s),r.node.style.setProperty(s,i));if(x!=null&&x.dragOverlay)for(const[s,i]of Object.entries(x.dragOverlay))i!==void 0&&a.node.style.setProperty(s,i);return y!=null&&y.active&&r.node.classList.add(y.active),y!=null&&y.dragOverlay&&a.node.classList.add(y.dragOverlay),function(){for(const[i,l]of Object.entries(m))r.node.style.setProperty(i,l);y!=null&&y.active&&r.node.classList.remove(y.active)}},ec=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Ht.Transform.toString(t)},{transform:Ht.Transform.toString(r)}]},tc={duration:250,easing:"ease",keyframes:ec,sideEffects:Jl({styles:{active:{opacity:"0"}}})};function rc(e){let{config:t,draggableNodes:r,droppableContainers:a,measuringConfiguration:m}=e;return xr((x,y)=>{if(t===null)return;const s=r.get(x);if(!s)return;const i=s.node.current;if(!i)return;const l=cn(y);if(!l)return;const{transform:u}=We(y).getComputedStyle(y),o=Qi(u);if(!o)return;const p=typeof t=="function"?t:sc(t);return nn(i,m.draggable.measure),p({active:{id:x,data:s.data,node:i,rect:m.draggable.measure(i)},draggableNodes:r,dragOverlay:{node:y,rect:m.dragOverlay.measure(l)},droppableContainers:a,measuringConfiguration:m,transform:o})})}function sc(e){const{duration:t,easing:r,sideEffects:a,keyframes:m}={...tc,...e};return x=>{let{active:y,dragOverlay:s,transform:i,...l}=x;if(!t)return;const u={x:s.rect.left-y.rect.left,y:s.rect.top-y.rect.top},o={scaleX:i.scaleX!==1?y.rect.width*i.scaleX/s.rect.width:1,scaleY:i.scaleY!==1?y.rect.height*i.scaleY/s.rect.height:1},p={x:i.x-u.x,y:i.y-u.y,...o},_=m({...l,active:y,dragOverlay:s,transform:{initial:i,final:p}}),[C]=_,g=_[_.length-1];if(JSON.stringify(C)===JSON.stringify(g))return;const n=a?.({active:y,dragOverlay:s,...l}),d=s.node.animate(_,{duration:t,easing:r,fill:"forwards"});return new Promise(c=>{d.onfinish=()=>{n?.(),c()}})}}let Xs=0;function ic(e){return R.useMemo(()=>{if(e!=null)return Xs++,Xs},[e])}const nc=Z.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:a,style:m,transition:x,modifiers:y,wrapperElement:s="div",className:i,zIndex:l=999}=e;const{activatorEvent:u,active:o,activeNodeRect:p,containerNodeRect:_,draggableNodes:C,droppableContainers:g,dragOverlay:n,over:d,measuringConfiguration:c,scrollableAncestors:h,scrollableAncestorRects:v,windowRect:b}=Ul(),w=R.useContext(wr),k=ic(o?.id),S=dn(y,{activatorEvent:u,active:o,activeNodeRect:p,containerNodeRect:_,draggingNodeRect:n.rect,over:d,overlayNodeRect:n.rect,scrollableAncestors:h,scrollableAncestorRects:v,transform:w,windowRect:b}),E=Cs(p),T=rc({config:a,draggableNodes:C,droppableContainers:g,measuringConfiguration:c}),L=E?n.setRef:void 0;return Z.createElement(Vl,null,Z.createElement(Xl,{animation:T},o&&k?Z.createElement(Zl,{key:k,id:o.id,ref:L,as:s,activatorEvent:u,adjustScale:t,className:i,transition:x,rect:E,style:{zIndex:l,...m},transform:S},r):null))}),oe={Review:"Review",Running:"Running",Pending:"Pending",Done:"Done",Cancelled:"Cancelled"},oc=[{status:oe.Review,label:"Review",icon:ls,color:"text-amber-600"},{status:oe.Running,label:"Running",icon:cs,color:"text-blue-600"},{status:oe.Pending,label:"Pending",icon:hs,color:"text-neutral-600"},{status:oe.Done,label:"Done",icon:us,color:"text-emerald-600"},{status:oe.Cancelled,label:"Cancelled",icon:ds,color:"text-neutral-500"}];function ac({task:e,status:t,isSelected:r,isAgentActive:a,project:m,onSelectTask:x,onTaskStatusChange:y,onDeleteTask:s}){const{attributes:i,listeners:l,setNodeRef:u,isDragging:o}=Wl({id:e.id,data:{task:e,fromStatus:t}}),[p,_]=R.useState(null),C=R.useRef(null),g=R.useCallback(n=>{!y&&!s||(n.preventDefault(),_({x:n.clientX,y:n.clientY}))},[y,s]);return R.useEffect(()=>{if(!p)return;const n=d=>{C.current&&!C.current.contains(d.target)&&_(null)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[p]),f.jsxs(f.Fragment,{children:[f.jsxs("button",{ref:u,onClick:()=>x(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
|
+
${o?"opacity-30":""}
|
|
8
|
+
${r?"bg-neutral-100 border-neutral-800":"border-transparent hover:bg-neutral-50 hover:border-neutral-200"}`,...l,...i,children:[f.jsxs("div",{className:`mt-0.5 mr-3 flex-shrink-0 ${t===oe.Running?"text-blue-600":"text-neutral-500"}`,children:[t===oe.Review&&f.jsx(ls,{className:r?"text-amber-600":"text-neutral-500"}),t===oe.Running&&f.jsx(cs,{className:"animate-pulse"}),t===oe.Pending&&f.jsx(hs,{}),t===oe.Done&&f.jsx(us,{className:"text-neutral-400"}),t===oe.Cancelled&&f.jsx(ds,{className:"text-neutral-400"})]}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"mb-0.5",children:[f.jsx("span",{className:`font-medium mr-1 ${m?.color||"text-neutral-500"}`,children:m?.name}),f.jsx("span",{className:"text-neutral-400",children:"/"}),f.jsx("span",{className:`ml-1 ${r?"text-neutral-900":"text-neutral-700"}`,children:e.title}),a&&f.jsxs("span",{className:"relative inline-flex h-2 w-2 ml-1.5 align-middle",children:[f.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),f.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]})]}),f.jsx("p",{className:`text-xs line-clamp-2 leading-relaxed ${r?"text-neutral-500":"text-neutral-400 group-hover:text-neutral-500"}`,children:e.description})]})]}),p&&f.jsxs("div",{ref:C,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:[y&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-neutral-400 uppercase tracking-wider",children:"移动到"}),oc.filter(n=>n.status!==t).map(n=>{const d=n.icon;return f.jsxs("button",{onClick:()=>{y(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:[f.jsx(d,{className:`w-3.5 h-3.5 ${n.color}`}),f.jsx("span",{className:"text-neutral-700",children:n.label})]},n.status)})]}),s&&f.jsxs(f.Fragment,{children:[y&&f.jsx("div",{className:"my-1 border-t border-neutral-100"}),f.jsxs("button",{onClick:()=>{s(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:[f.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:[f.jsx("path",{d:"M3 6h18"}),f.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),f.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),f.jsx("span",{children:"删除任务"})]})]})]})]})}const lc=R.memo(function({title:t,tasks:r,status:a,defaultOpen:m,selectedTaskId:x,onSelectTask:y,projects:s,activeTaskIds:i,isDragging:l,dragFromStatus:u,onTaskStatusChange:o,onDeleteTask:p}){const[_,C]=R.useState(m),g=r.length===0,n=l&&u===a,d=l&&u!==a,{setNodeRef:c,isOver:h}=ql({id:`group-${a}`,data:{status:a}}),v=a===oe.Review,b=l?n&&(_||!0):_;return f.jsxs("div",{className:"mb-2",children:[f.jsxs("button",{onClick:()=>!l&&C(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:[f.jsx("span",{className:"mr-2 text-neutral-400",children:b?f.jsx(xt,{size:14}):f.jsx(mr,{size:14})}),f.jsx("span",{className:"flex-1 text-left",children:t}),v&&!g?f.jsx("span",{className:"px-2 py-0.5 bg-amber-100 text-amber-700 text-xs font-bold rounded-full animate-hop",children:r.length}):f.jsxs("span",{className:"text-xs text-neutral-400 font-normal",children:["(",r.length,")"]})]}),d&&f.jsx("div",{ref:c,className:`mx-3 my-1 flex items-center justify-center rounded-lg border-2 border-dashed transition-all duration-150 h-10
|
|
9
|
+
${h?"border-blue-400 bg-blue-50 text-blue-600":"border-neutral-300 bg-neutral-50/50 text-neutral-400"}`,children:f.jsx("span",{className:"text-xs font-medium",children:h?`放入 ${t}`:"拖到此处"})}),b&&!d&&f.jsx("div",{ref:n?void 0:c,className:`flex flex-col mt-1 min-h-[40px] rounded-md mx-2 transition-colors
|
|
10
|
+
${h&&!n?"bg-blue-50 ring-1 ring-blue-200":""}
|
|
11
|
+
${g&&l?"border border-dashed border-neutral-300":""}`,children:g?f.jsx("span",{className:"text-xs text-neutral-300 py-2 pl-8",children:"No tasks"}):r.map(w=>{const k=s.find(T=>T.id===w.projectId),S=x===w.id,E=i?.has(w.id)??!1;return f.jsx(ac,{task:w,status:a,isSelected:S,isAgentActive:E,project:k,onSelectTask:y,onTaskStatusChange:o,onDeleteTask:p},w.id)})})]})}),cc=f.jsx("div",{className:"p-4 border-t border-neutral-100 text-xs text-neutral-400 flex items-center justify-between",children:f.jsx("span",{children:"0 tasks"})});function hc(e){const t={[oe.Review]:[],[oe.Running]:[],[oe.Pending]:[],[oe.Done]:[],[oe.Cancelled]:[]};for(const r of e)t[r.status].push(r);return t}const uc=[{status:oe.Review,title:"Review",defaultOpen:!0},{status:oe.Running,title:"Running",defaultOpen:!0},{status:oe.Pending,title:"Pending",defaultOpen:!1},{status:oe.Done,title:"Done",defaultOpen:!1},{status:oe.Cancelled,title:"Cancelled",defaultOpen:!1}];function Ys({tasks:e=[],projects:t=[],selectedTaskId:r,onSelectTask:a,filterProjectId:m,setFilterProjectId:x,width:y=320,onCreateProject:s,onCreateTask:i,activeTaskIds:l,onTaskStatusChange:u,onDeleteTask:o}){const[p,_]=R.useState(!1),[C,g]=R.useState(null),[n,d]=R.useState(null),c=Wa(za(xs,{activationConstraint:{distance:8}})),h=R.useCallback(E=>{const T=E.active.data.current?.task,L=E.active.data.current?.fromStatus;T&&g(T),L&&d(L)},[]),v=R.useCallback(E=>{g(null),d(null);const{active:T,over:L}=E;if(!L)return;const M=T.data.current?.task,N=T.data.current?.fromStatus,I=L.data.current?.status;!M||!N||!I||N!==I&&u?.(M.id,I)},[u]),b=m?e.filter(E=>E.projectId===m):e,w=m?t.find(E=>E.id===m)??null:null,k=hc(b),S=y==="100%";return f.jsxs("div",{className:`h-full flex flex-col bg-white flex-shrink-0 ${S?"":"border-r border-neutral-200"}`,style:{width:y},children:[f.jsxs("div",{className:"h-14 flex items-center justify-between px-3 border-b border-neutral-100 flex-shrink-0 relative z-20",children:[f.jsxs("div",{className:"relative flex-1 mr-2",children:[f.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?f.jsxs(f.Fragment,{children:[f.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${w.color.replace("text-","bg-")}`}),f.jsx("span",{className:"truncate",children:w.name})]}):f.jsxs(f.Fragment,{children:[f.jsx(Ps,{size:16,className:"text-neutral-500 group-hover:text-neutral-800"}),f.jsx("span",{children:"All Projects"})]}),f.jsx(xt,{size:14,className:`text-neutral-400 ml-auto transition-transform duration-200 ${p?"rotate-180":""}`})]}),p?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>_(!1)}),f.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:[f.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-neutral-400 uppercase tracking-wider",children:"Select View"}),f.jsxs("button",{onClick:()=>{x(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:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.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:f.jsx(Ps,{size:12})}),f.jsx("span",{className:m===null?"text-neutral-900 font-medium":"text-neutral-600",children:"All Projects"})]}),m===null?f.jsx(ir,{size:14,className:"text-neutral-900"}):null]}),f.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),t.map(E=>{const T=m===E.id,L=E.color.replace("text-","bg-");return f.jsxs("button",{onClick:()=>{x(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:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:`w-2 h-2 rounded-full ml-1.5 mr-1.5 ${L}`}),f.jsx("span",{className:T?"text-neutral-900 font-medium":"text-neutral-600",children:E.name})]}),T?f.jsx(ir,{size:14,className:"text-neutral-900"}):null]},E.id)}),f.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),f.jsxs("button",{onClick:()=>{_(!1),s?.()},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:[f.jsx(Yr,{size:14}),f.jsx("span",{children:"Create New Project..."})]})]})]}):null]}),f.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:f.jsx(Yr,{size:18})})]}),f.jsxs(Fl,{sensors:c,onDragStart:h,onDragEnd:v,children:[f.jsx("div",{className:"flex-1 overflow-y-auto py-4 relative",children:uc.map(({status:E,title:T,defaultOpen:L})=>f.jsx(lc,{title:T,tasks:k[E],status:E,defaultOpen:L,selectedTaskId:r,onSelectTask:a,projects:t,activeTaskIds:l,isDragging:C!==null,dragFromStatus:n,onTaskStatusChange:u,onDeleteTask:o},E))}),f.jsx(nc,{dropAnimation:null,children:C?f.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:f.jsx("span",{className:"text-neutral-700 font-medium",children:C.title})}):null})]}),b.length>0?f.jsxs("div",{className:"p-4 border-t border-neutral-100 text-xs text-neutral-400 flex items-center justify-between",children:[f.jsxs("span",{children:[b.length," tasks"]}),m?f.jsx("button",{onClick:()=>x(null),className:"hover:text-neutral-800 underline decoration-neutral-300 underline-offset-2",children:"Clear filter"}):null]}):cc]})}const dc={damping:.7,stiffness:.05,mass:1.25},fc=70,pc=1e3/60,mc=350;let Er=!1;globalThis.document?.addEventListener("mousedown",()=>{Er=!0});globalThis.document?.addEventListener("mouseup",()=>{Er=!1});globalThis.document?.addEventListener("click",()=>{Er=!1});const fn=(e={})=>{const[t,r]=R.useState(!1),[a,m]=R.useState(e.initial!==!1),[x,y]=R.useState(!1),s=R.useRef(null);s.current=e;const i=R.useCallback(()=>{if(!Er)return!1;const c=window.getSelection();if(!c||!c.rangeCount)return!1;const h=c.getRangeAt(0);return h.commonAncestorContainer.contains(n.current)||n.current?.contains(h.commonAncestorContainer)},[]),l=R.useCallback(c=>{o.isAtBottom=c,m(c)},[]),u=R.useCallback(c=>{o.escapedFromLock=c,r(c)},[]),o=R.useMemo(()=>{let c;return{escapedFromLock:t,isAtBottom:a,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return n.current?.scrollTop??0},set scrollTop(h){n.current&&(n.current.scrollTop=h,o.ignoreScrollToTop=n.current.scrollTop)},get targetScrollTop(){return!n.current||!d.current?0:n.current.scrollHeight-1-n.current.clientHeight},get calculatedTargetScrollTop(){if(!n.current||!d.current)return 0;const{targetScrollTop:h}=this;if(!e.targetScrollTop)return h;if(c?.targetScrollTop===h)return c.calculatedScrollTop;const v=Math.max(Math.min(e.targetScrollTop(h,{scrollElement:n.current,contentElement:d.current}),h),0);return c={targetScrollTop:h,calculatedScrollTop:v},requestAnimationFrame(()=>{c=void 0}),v},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=fc}}},[]),p=R.useCallback((c={})=>{typeof c=="string"&&(c={animation:c}),c.preserveScrollPosition||l(!0);const h=Date.now()+(Number(c.wait)||0),v=Fr(s.current,c.animation),{ignoreEscapes:b=!1}=c;let w,k=o.calculatedTargetScrollTop;c.duration instanceof Promise?c.duration.finally(()=>{w=Date.now()}):w=h+(c.duration??0);const S=async()=>{const E=new Promise(requestAnimationFrame).then(()=>{if(!o.isAtBottom)return o.animation=void 0,!1;const{scrollTop:T}=o,L=performance.now(),M=(L-(o.lastTick??L))/pc;if(o.animation||(o.animation={behavior:v,promise:E,ignoreEscapes:b}),o.animation.behavior===v&&(o.lastTick=L),i()||h>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*M,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:Fr(s.current,s.current.resize),ignoreEscapes:b,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 c.wait!==!0&&(o.animation=void 0),o.animation?.behavior===v?o.animation.promise:S()},[l,i,o]),_=R.useCallback(()=>{u(!0),l(!1)},[u,l]),C=R.useCallback(({target:c})=>{if(c!==n.current)return;const{scrollTop:h,ignoreScrollToTop:v}=o;let{lastScrollTop:b=h}=o;o.lastScrollTop=h,o.ignoreScrollToTop=void 0,v&&v>h&&(b=v),y(o.isNearBottom),setTimeout(()=>{if(o.resizeDifference||h===v)return;if(i()){u(!0),l(!1);return}const w=h>b,k=h<b;if(o.animation?.ignoreEscapes){o.scrollTop=b;return}k&&(u(!0),l(!1)),w&&u(!1),!o.escapedFromLock&&o.isNearBottom&&l(!0)},1)},[u,l,i,o]),g=R.useCallback(({target:c,deltaY:h})=>{let v=c;for(;!["scroll","auto"].includes(getComputedStyle(v).overflow);){if(!v.parentElement)return;v=v.parentElement}v===n.current&&h<0&&n.current.scrollHeight>n.current.clientHeight&&!o.animation?.ignoreEscapes&&(u(!0),l(!1))},[u,l,o]),n=Vs(c=>{n.current?.removeEventListener("scroll",C),n.current?.removeEventListener("wheel",g),c?.addEventListener("scroll",C,{passive:!0}),c?.addEventListener("wheel",g,{passive:!0})},[]),d=Vs(c=>{if(o.resizeObserver?.disconnect(),!c)return;let h;o.resizeObserver=new ResizeObserver(([v])=>{const{height:b}=v.contentRect,w=b-(h??b);if(o.resizeDifference=w,o.scrollTop>o.targetScrollTop&&(o.scrollTop=o.targetScrollTop),y(o.isNearBottom),w>=0){const k=Fr(s.current,h?s.current.resize:s.current.initial);p({animation:k,wait:!0,preserveScrollPosition:!0,duration:k==="instant"?void 0:mc})}else o.isNearBottom&&(u(!1),l(!0));h=b,requestAnimationFrame(()=>{setTimeout(()=>{o.resizeDifference===w&&(o.resizeDifference=0)},1)})}),o.resizeObserver?.observe(c)},[]);return{contentRef:d,scrollRef:n,scrollToBottom:p,stopScroll:_,isAtBottom:a||x,isNearBottom:x,escapedFromLock:t,state:o}};function Vs(e,t){const r=R.useCallback(a=>(r.current=a,e(a)),t);return r}const Ir=new Map;function Fr(...e){const t={...dc};let r=!1;for(const m of e){if(m==="instant"){r=!0;continue}typeof m=="object"&&(r=!1,t.damping=m.damping??t.damping,t.stiffness=m.stiffness??t.stiffness,t.mass=m.mass??t.mass)}const a=JSON.stringify(t);return Ir.has(a)||Ir.set(a,Object.freeze(t)),r?"instant":Ir.get(a)}var Ve;(function(e){e.TODO="TODO",e.IN_PROGRESS="IN_PROGRESS",e.IN_REVIEW="IN_REVIEW",e.DONE="DONE",e.CANCELLED="CANCELLED"})(Ve||(Ve={}));var Gs;(function(e){e.ACTIVE="ACTIVE",e.MERGED="MERGED",e.ABANDONED="ABANDONED"})(Gs||(Gs={}));var Ot;(function(e){e.CLAUDE_CODE="CLAUDE_CODE",e.GEMINI_CLI="GEMINI_CLI",e.CURSOR_AGENT="CURSOR_AGENT"})(Ot||(Ot={}));var ye;(function(e){e.PENDING="PENDING",e.RUNNING="RUNNING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.CANCELLED="CANCELLED"})(ye||(ye={}));var Qs;(function(e){e.CHAT="CHAT",e.COMMIT_MSG="COMMIT_MSG"})(Qs||(Qs={}));var Jr;(function(e){e.REBASE="REBASE",e.MERGE="MERGE"})(Jr||(Jr={}));function Zt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function vc(e){return e>=.9?"text-red-500":e>=.7?"text-amber-500":"text-neutral-400"}function pn({usage:e}){if(!e)return null;const t=e.modelContextWindow,r=t?e.totalTokens/t:0,a=t?Math.min(Math.round(r*100),100):null,m=t?vc(r):"text-neutral-400";return f.jsxs("div",{className:"group relative 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:[f.jsx(Yo,{size:14,className:m}),f.jsxs("span",{className:`tabular-nums ${m}`,children:[Zt(e.totalTokens),a!==null&&f.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",a,"%"]})]}),f.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:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-50 shadow-lg",children:[t?f.jsxs("span",{children:["上下文: ",Zt(e.totalTokens)," / ",Zt(t)," tokens"]}):f.jsxs("span",{children:["已使用: ",Zt(e.totalTokens)," tokens"]}),f.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-neutral-900"})]})]})}var Hr={exports:{}},Zs;function _c(){return Zs||(Zs=1,(function(e,t){(function(r,a){e.exports=a()})(self,(()=>(()=>{var r={4567:function(y,s,i){var l=this&&this.__decorate||function(h,v,b,w){var k,S=arguments.length,E=S<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(h,v,b,w);else for(var T=h.length-1;T>=0;T--)(k=h[T])&&(E=(S<3?k(E):S>3?k(v,b,E):k(v,b))||E);return S>3&&E&&Object.defineProperty(v,b,E),E},u=this&&this.__param||function(h,v){return function(b,w){v(b,w,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const o=i(9042),p=i(6114),_=i(9924),C=i(844),g=i(5596),n=i(4725),d=i(3656);let c=s.AccessibilityManager=class extends C.Disposable{constructor(h,v){super(),this._terminal=h,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 b=0;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);if(this._topBoundaryFocusListener=b=>this._handleBoundaryFocus(b,0),this._bottomBoundaryFocusListener=b=>this._handleBoundaryFocus(b,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((b=>this._handleResize(b.rows)))),this.register(this._terminal.onRender((b=>this._refreshRows(b.start,b.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((b=>this._handleChar(b)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
12
|
+
`)))),this.register(this._terminal.onA11yTab((b=>this._handleTab(b)))),this.register(this._terminal.onKey((b=>this._handleKey(b.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new g.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,d.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,C.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(h){for(let v=0;v<h;v++)this._handleChar(" ")}_handleChar(h){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==h&&(this._charsToAnnounce+=h):this._charsToAnnounce+=h,h===`
|
|
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(h){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(h)||this._charsToConsume.push(h)}_refreshRows(h,v){this._liveRegionDebouncer.refresh(h,v,this._terminal.rows)}_renderRows(h,v){const b=this._terminal.buffer,w=b.lines.length.toString();for(let k=h;k<=v;k++){const S=b.translateBufferLineToString(b.ydisp+k,!0),E=(b.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(h,v){const b=h.target,w=this._rowElements[v===0?1:this._rowElements.length-2];if(b.getAttribute("aria-posinset")===(v===0?"1":`${this._terminal.buffer.lines.length}`)||h.relatedTarget!==w)return;let k,S;if(v===0?(k=b,S=this._rowElements.pop(),this._rowContainer.removeChild(S)):(k=this._rowElements.shift(),S=b,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(),h.preventDefault(),h.stopImmediatePropagation()}_handleResize(h){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>h;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const h=document.createElement("div");return h.setAttribute("role","listitem"),h.tabIndex=-1,this._refreshRowDimensions(h),h}_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 h=0;h<this._terminal.rows;h++)this._refreshRowDimensions(this._rowElements[h])}}_refreshRowDimensions(h){h.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=c=l([u(1,n.IRenderService)],c)},3614:(y,s)=>{function i(p){return p.replace(/\r?\n/g,"\r")}function l(p,_){return _?"\x1B[200~"+p+"\x1B[201~":p}function u(p,_,C,g){p=l(p=i(p),C.decPrivateModes.bracketedPasteMode&&g.rawOptions.ignoreBracketedPasteMode!==!0),C.triggerDataEvent(p,!0),_.value=""}function o(p,_,C){const g=C.getBoundingClientRect(),n=p.clientX-g.left-10,d=p.clientY-g.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${n}px`,_.style.top=`${d}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=i,s.bracketTextForPaste=l,s.copyHandler=function(p,_){p.clipboardData&&p.clipboardData.setData("text/plain",_.selectionText),p.preventDefault()},s.handlePasteEvent=function(p,_,C,g){p.stopPropagation(),p.clipboardData&&u(p.clipboardData.getData("text/plain"),_,C,g)},s.paste=u,s.moveTextAreaUnderMouseCursor=o,s.rightClickHandler=function(p,_,C,g,n){o(p,_,C),n&&g.rightClickSelect(p),_.value=g.selectionText,_.select()}},7239:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;const l=i(1505);s.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(u,o,p){this._css.set(u,o,p)}getCss(u,o){return this._css.get(u,o)}setColor(u,o,p){this._color.set(u,o,p)}getColor(u,o){return this._color.get(u,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(i,l,u,o){i.addEventListener(l,u,o);let p=!1;return{dispose:()=>{p||(p=!0,i.removeEventListener(l,u,o))}}}},6465:function(y,s,i){var l=this&&this.__decorate||function(n,d,c,h){var v,b=arguments.length,w=b<3?d:h===null?h=Object.getOwnPropertyDescriptor(d,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,c,h);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(b<3?v(w):b>3?v(d,c,w):v(d,c))||w);return b>3&&w&&Object.defineProperty(d,c,w),w},u=this&&this.__param||function(n,d){return function(c,h){d(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier2=void 0;const o=i(3656),p=i(8460),_=i(844),C=i(2585);let g=s.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 d=this._linkProviders.indexOf(n);d!==-1&&this._linkProviders.splice(d,1)}}}attachToDom(n,d,c){this._element=n,this._mouseService=d,this._renderService=c,this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){if(this._lastMouseEvent=n,!this._element||!this._mouseService)return;const d=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!d)return;this._isMouseOut=!1;const c=n.composedPath();for(let h=0;h<c.length;h++){const v=c[h];if(v.classList.contains("xterm"))break;if(v.classList.contains("xterm-hover"))return}this._lastBufferCell&&d.x===this._lastBufferCell.x&&d.y===this._lastBufferCell.y||(this._handleHover(d),this._lastBufferCell=d)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,d){var c,h;this._activeProviderReplies&&d||((c=this._activeProviderReplies)===null||c===void 0||c.forEach((b=>{b?.forEach((w=>{w.link.dispose&&w.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=n.y);let v=!1;for(const[b,w]of this._linkProviders.entries())d?!((h=this._activeProviderReplies)===null||h===void 0)&&h.get(b)&&(v=this._checkLinkProviderResult(b,n,v)):w.provideLinks(n.y,(k=>{var S,E;if(this._isMouseOut)return;const T=k?.map((L=>({link:L})));(S=this._activeProviderReplies)===null||S===void 0||S.set(b,T),v=this._checkLinkProviderResult(b,n,v),((E=this._activeProviderReplies)===null||E===void 0?void 0:E.size)===this._linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)}))}_removeIntersectingLinks(n,d){const c=new Set;for(let h=0;h<d.size;h++){const v=d.get(h);if(v)for(let b=0;b<v.length;b++){const w=v[b],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(c.has(E)){v.splice(b--,1);break}c.add(E)}}}}_checkLinkProviderResult(n,d,c){var h;if(!this._activeProviderReplies)return c;const v=this._activeProviderReplies.get(n);let b=!1;for(let w=0;w<n;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(b=!0);if(!b&&v){const w=v.find((k=>this._linkAtPosition(k.link,d)));w&&(c=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviders.length&&!c)for(let w=0;w<this._activeProviderReplies.size;w++){const k=(h=this._activeProviderReplies.get(w))===null||h===void 0?void 0:h.find((S=>this._linkAtPosition(S.link,d)));if(k){c=!0,this._handleNewLink(k);break}}return c}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._element||!this._mouseService||!this._currentLink)return;const d=this._positionFromMouseEvent(n,this._element,this._mouseService);d&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,d)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,d){this._element&&this._currentLink&&this._lastMouseEvent&&(!n||!d||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=d)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(n.link,d)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var c,h;return(h=(c=this._currentLink)===null||c===void 0?void 0:c.state)===null||h===void 0?void 0:h.decorations.pointerCursor},set:c=>{var h,v;!((h=this._currentLink)===null||h===void 0)&&h.state&&this._currentLink.state.decorations.pointerCursor!==c&&(this._currentLink.state.decorations.pointerCursor=c,this._currentLink.state.isHovered&&((v=this._element)===null||v===void 0||v.classList.toggle("xterm-cursor-pointer",c)))}},underline:{get:()=>{var c,h;return(h=(c=this._currentLink)===null||c===void 0?void 0:c.state)===null||h===void 0?void 0:h.decorations.underline},set:c=>{var h,v,b;!((h=this._currentLink)===null||h===void 0)&&h.state&&((b=(v=this._currentLink)===null||v===void 0?void 0:v.state)===null||b===void 0?void 0:b.decorations.underline)!==c&&(this._currentLink.state.decorations.underline=c,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,c))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((c=>{if(!this._currentLink)return;const h=c.start===0?0:c.start+1+this._bufferService.buffer.ydisp,v=this._bufferService.buffer.ydisp+1+c.end;if(this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=v&&(this._clearCurrentLink(h,v),this._lastMouseEvent&&this._element)){const b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}}))))}_linkHover(n,d,c){var h;!((h=this._currentLink)===null||h===void 0)&&h.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),d.hover&&d.hover(c,d.text)}_fireUnderlineEvent(n,d){const c=n.range,h=this._bufferService.buffer.ydisp,v=this._createLinkUnderlineEvent(c.start.x-1,c.start.y-h-1,c.end.x,c.end.y-h-1,void 0);(d?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(v)}_linkLeave(n,d,c){var h;!((h=this._currentLink)===null||h===void 0)&&h.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),d.leave&&d.leave(c,d.text)}_linkAtPosition(n,d){const c=n.range.start.y*this._bufferService.cols+n.range.start.x,h=n.range.end.y*this._bufferService.cols+n.range.end.x,v=d.y*this._bufferService.cols+d.x;return c<=v&&v<=h}_positionFromMouseEvent(n,d,c){const h=c.getCoords(n,d,this._bufferService.cols,this._bufferService.rows);if(h)return{x:h[0],y:h[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,d,c,h,v){return{x1:n,y1:d,x2:c,y2:h,cols:this._bufferService.cols,fg:v}}};s.Linkifier2=g=l([u(0,C.IBufferService)],g)},9042:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(y,s,i){var l=this&&this.__decorate||function(g,n,d,c){var h,v=arguments.length,b=v<3?n:c===null?c=Object.getOwnPropertyDescriptor(n,d):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(g,n,d,c);else for(var w=g.length-1;w>=0;w--)(h=g[w])&&(b=(v<3?h(b):v>3?h(n,d,b):h(n,d))||b);return v>3&&b&&Object.defineProperty(n,d,b),b},u=this&&this.__param||function(g,n){return function(d,c){n(d,c,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;const o=i(511),p=i(2585);let _=s.OscLinkProvider=class{constructor(g,n,d){this._bufferService=g,this._optionsService=n,this._oscLinkService=d}provideLinks(g,n){var d;const c=this._bufferService.buffer.lines.get(g-1);if(!c)return void n(void 0);const h=[],v=this._optionsService.rawOptions.linkHandler,b=new o.CellData,w=c.getTrimmedLength();let k=-1,S=-1,E=!1;for(let T=0;T<w;T++)if(S!==-1||c.hasContent(T)){if(c.loadCell(T,b),b.hasExtendedAttrs()&&b.extended.urlId){if(S===-1){S=T,k=b.extended.urlId;continue}E=b.extended.urlId!==k}else S!==-1&&(E=!0);if(E||S!==-1&&T===w-1){const L=(d=this._oscLinkService.getLinkData(k))===null||d===void 0?void 0:d.uri;if(L){const M={start:{x:S+1,y:g},end:{x:T+(E||T!==w-1?0:1),y:g}};let N=!1;if(!v?.allowNonHttpProtocols)try{const I=new URL(L);["http:","https:"].includes(I.protocol)||(N=!0)}catch{N=!0}N||h.push({text:L,range:M,activate:(I,F)=>v?v.activate(I,F,M):C(0,F),hover:(I,F)=>{var H;return(H=v?.hover)===null||H===void 0?void 0:H.call(v,I,F,M)},leave:(I,F)=>{var H;return(H=v?.leave)===null||H===void 0?void 0:H.call(v,I,F,M)}})}E=!1,b.hasExtendedAttrs()&&b.extended.urlId?(S=T,k=b.extended.urlId):(S=-1,k=-1)}}n(h)}};function C(g,n){if(confirm(`Do you want to navigate to ${n}?
|
|
14
|
+
|
|
15
|
+
WARNING: This link could potentially be dangerous`)){const d=window.open();if(d){try{d.opener=null}catch{}d.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=_=l([u(0,p.IBufferService),u(1,p.IOptionsService),u(2,p.IOscLinkService)],_)},6193:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(i,l){this._parentWindow=i,this._renderCallback=l,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,l,u){this._rowCount=u,i=i!==void 0?i:0,l=l!==void 0?l: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,l):l,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),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const i of this._refreshCallbacks)i(0);this._refreshCallbacks=[]}}},5596:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ScreenDprMonitor=void 0;const l=i(844);class u extends l.Disposable{constructor(p){super(),this._parentWindow=p,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,l.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)}}s.ScreenDprMonitor=u},3236:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const l=i(3614),u=i(3656),o=i(6465),p=i(9042),_=i(3730),C=i(1680),g=i(3107),n=i(5744),d=i(2950),c=i(1296),h=i(428),v=i(4269),b=i(5114),w=i(8934),k=i(3230),S=i(9312),E=i(4725),T=i(6731),L=i(8055),M=i(8969),N=i(8460),I=i(844),F=i(6114),H=i(8437),z=i(2584),D=i(7399),j=i(5941),P=i(9074),O=i(2585),$=i(5435),q=i(4567),X=typeof window<"u"?window.document:null;class G extends M.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(A={}){super(A),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new I.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(((B,U)=>this.refresh(B,U)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((B=>this._reportWindowsOptions(B)))),this.register(this._inputHandler.onColor((B=>this._handleColorEvent(B)))),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((B=>this._afterResize(B.cols,B.rows)))),this.register((0,I.toDisposable)((()=>{var B,U;this._customKeyEventHandler=void 0,(U=(B=this.element)===null||B===void 0?void 0:B.parentNode)===null||U===void 0||U.removeChild(this.element)})))}_handleColorEvent(A){if(this._themeService)for(const B of A){let U,W="";switch(B.index){case 256:U="foreground",W="10";break;case 257:U="background",W="11";break;case 258:U="cursor",W="12";break;default:U="ansi",W="4;"+B.index}switch(B.type){case 0:const J=L.color.toColorRGB(U==="ansi"?this._themeService.colors.ansi[B.index]:this._themeService.colors[U]);this.coreService.triggerDataEvent(`${z.C0.ESC}]${W};${(0,j.toRgbString)(J)}${z.C1_ESCAPED.ST}`);break;case 1:if(U==="ansi")this._themeService.modifyColors((Y=>Y.ansi[B.index]=L.rgba.toColor(...B.color)));else{const Y=U;this._themeService.modifyColors((ie=>ie[Y]=L.rgba.toColor(...B.color)))}break;case 2:this._themeService.restoreColor(B.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(A){A?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(q.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(A){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.C0.ESC+"[I"),this.updateCursorStyle(A),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var A;return(A=this.textarea)===null||A===void 0?void 0:A.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.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 A=this.buffer.ybase+this.buffer.y,B=this.buffer.lines.get(A);if(!B)return;const U=Math.min(this.buffer.x,this.cols-1),W=this._renderService.dimensions.css.cell.height,J=B.getWidth(U),Y=this._renderService.dimensions.css.cell.width*J,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,ue=U*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ue+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=Y+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,u.addDisposableDomListener)(this.element,"copy",(B=>{this.hasSelection()&&(0,l.copyHandler)(B,this._selectionService)})));const A=B=>(0,l.handlePasteEvent)(B,this.textarea,this.coreService,this.optionsService);this.register((0,u.addDisposableDomListener)(this.textarea,"paste",A)),this.register((0,u.addDisposableDomListener)(this.element,"paste",A)),F.isFirefox?this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(B=>{B.button===2&&(0,l.rightClickHandler)(B,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,u.addDisposableDomListener)(this.element,"contextmenu",(B=>{(0,l.rightClickHandler)(B,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),F.isLinux&&this.register((0,u.addDisposableDomListener)(this.element,"auxclick",(B=>{B.button===1&&(0,l.moveTextAreaUnderMouseCursor)(B,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,u.addDisposableDomListener)(this.textarea,"keyup",(A=>this._keyUp(A)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keydown",(A=>this._keyDown(A)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keypress",(A=>this._keyPress(A)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionupdate",(A=>this._compositionHelper.compositionupdate(A)))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,u.addDisposableDomListener)(this.textarea,"input",(A=>this._inputEvent(A)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(A){var B;if(!A)throw new Error("Terminal requires a parent element.");A.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=A.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),A.appendChild(this.element);const U=X.createDocumentFragment();this._viewportElement=X.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),U.appendChild(this._viewportElement),this._viewportScrollArea=X.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=X.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=X.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),U.appendChild(this.screenElement),this.textarea=X.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),F.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(b.CoreBrowserService,this.textarea,(B=this._document.defaultView)!==null&&B!==void 0?B:window),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,u.addDisposableDomListener)(this.textarea,"focus",(W=>this._handleTextAreaFocus(W)))),this.register((0,u.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(h.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((W=>this._onRender.fire(W)))),this.onResize((W=>this._renderService.resize(W.cols,W.rows))),this._compositionView=X.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(U);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(C.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((W=>this.scrollLines(W.amount,W.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((W=>this.scrollLines(W.amount,W.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,u.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,u.addDisposableDomListener)(this.element,"mousedown",(W=>this._selectionService.handleMouseDown(W)))),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(q.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(W=>this._handleScreenReaderModeOptionChange(W)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(n.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(W=>{!this._overviewRulerRenderer&&W&&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(c.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const A=this,B=this.element;function U(Y){const ie=A._mouseService.getMouseReportCoords(Y,A.screenElement);if(!ie)return!1;let ue,_e;switch(Y.overrideType||Y.type){case"mousemove":_e=32,Y.buttons===void 0?(ue=3,Y.button!==void 0&&(ue=Y.button<3?Y.button:3)):ue=1&Y.buttons?0:4&Y.buttons?1:2&Y.buttons?2:3;break;case"mouseup":_e=0,ue=Y.button<3?Y.button:3;break;case"mousedown":_e=1,ue=Y.button<3?Y.button:3;break;case"wheel":if(A.viewport.getLinesScrolled(Y)===0)return!1;_e=Y.deltaY<0?0:1,ue=4;break;default:return!1}return!(_e===void 0||ue===void 0||ue>4)&&A.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:ue,action:_e,ctrl:Y.ctrlKey,alt:Y.altKey,shift:Y.shiftKey})}const W={mouseup:null,wheel:null,mousedrag:null,mousemove:null},J={mouseup:Y=>(U(Y),Y.buttons||(this._document.removeEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.removeEventListener("mousemove",W.mousedrag)),this.cancel(Y)),wheel:Y=>(U(Y),this.cancel(Y,!0)),mousedrag:Y=>{Y.buttons&&U(Y)},mousemove:Y=>{Y.buttons||U(Y)}};this.register(this.coreMouseService.onProtocolChange((Y=>{Y?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Y)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&Y?W.mousemove||(B.addEventListener("mousemove",J.mousemove),W.mousemove=J.mousemove):(B.removeEventListener("mousemove",W.mousemove),W.mousemove=null),16&Y?W.wheel||(B.addEventListener("wheel",J.wheel,{passive:!1}),W.wheel=J.wheel):(B.removeEventListener("wheel",W.wheel),W.wheel=null),2&Y?W.mouseup||(B.addEventListener("mouseup",J.mouseup),W.mouseup=J.mouseup):(this._document.removeEventListener("mouseup",W.mouseup),B.removeEventListener("mouseup",W.mouseup),W.mouseup=null),4&Y?W.mousedrag||(W.mousedrag=J.mousedrag):(this._document.removeEventListener("mousemove",W.mousedrag),W.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,u.addDisposableDomListener)(B,"mousedown",(Y=>{if(Y.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Y))return U(Y),W.mouseup&&this._document.addEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.addEventListener("mousemove",W.mousedrag),this.cancel(Y)}))),this.register((0,u.addDisposableDomListener)(B,"wheel",(Y=>{if(!W.wheel){if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(Y);if(ie===0)return;const ue=z.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Y.deltaY<0?"A":"B");let _e="";for(let we=0;we<Math.abs(ie);we++)_e+=ue;return this.coreService.triggerDataEvent(_e,!0),this.cancel(Y,!0)}return this.viewport.handleWheel(Y)?this.cancel(Y):void 0}}),{passive:!1})),this.register((0,u.addDisposableDomListener)(B,"touchstart",(Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Y),this.cancel(Y)}),{passive:!0})),this.register((0,u.addDisposableDomListener)(B,"touchmove",(Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Y)?void 0:this.cancel(Y)}),{passive:!1}))}refresh(A,B){var U;(U=this._renderService)===null||U===void 0||U.refreshRows(A,B)}updateCursorStyle(A){var B;!((B=this._selectionService)===null||B===void 0)&&B.shouldColumnSelect(A)?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(A,B,U=0){var W;U===1?(super.scrollLines(A,B,U),this.refresh(0,this.rows-1)):(W=this.viewport)===null||W===void 0||W.scrollLines(A)}paste(A){(0,l.paste)(A,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(A){this._customKeyEventHandler=A}registerLinkProvider(A){return this.linkifier2.registerLinkProvider(A)}registerCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const B=this._characterJoinerService.register(A);return this.refresh(0,this.rows-1),B}deregisterCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(A)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(A){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+A)}registerDecoration(A){return this._decorationService.registerDecoration(A)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(A,B,U){this._selectionService.setSelection(A,B,U)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var A;(A=this._selectionService)===null||A===void 0||A.clearSelection()}selectAll(){var A;(A=this._selectionService)===null||A===void 0||A.selectAll()}selectLines(A,B){var U;(U=this._selectionService)===null||U===void 0||U.selectLines(A,B)}_keyDown(A){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;const B=this.browser.isMac&&this.options.macOptionIsMeta&&A.altKey;if(!B&&!this._compositionHelper.keydown(A))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;B||A.key!=="Dead"&&A.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const U=(0,D.evaluateKeyboardEvent)(A,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(A),U.type===3||U.type===2){const W=this.rows-1;return this.scrollLines(U.type===2?-W:W),this.cancel(A,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,A)||(U.cancel&&this.cancel(A,!0),!U.key||!!(A.key&&!A.ctrlKey&&!A.altKey&&!A.metaKey&&A.key.length===1&&A.key.charCodeAt(0)>=65&&A.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(U.key!==z.C0.ETX&&U.key!==z.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(U.key,!0),!this.optionsService.rawOptions.screenReaderMode||A.altKey||A.ctrlKey?this.cancel(A,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(A,B){const U=A.isMac&&!this.options.macOptionIsMeta&&B.altKey&&!B.ctrlKey&&!B.metaKey||A.isWindows&&B.altKey&&B.ctrlKey&&!B.metaKey||A.isWindows&&B.getModifierState("AltGraph");return B.type==="keypress"?U:U&&(!B.keyCode||B.keyCode>47)}_keyUp(A){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1||((function(B){return B.keyCode===16||B.keyCode===17||B.keyCode===18})(A)||this.focus(),this.updateCursorStyle(A),this._keyPressHandled=!1)}_keyPress(A){let B;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;if(this.cancel(A),A.charCode)B=A.charCode;else if(A.which===null||A.which===void 0)B=A.keyCode;else{if(A.which===0||A.charCode===0)return!1;B=A.which}return!(!B||(A.altKey||A.ctrlKey||A.metaKey)&&!this._isThirdLevelShift(this.browser,A)||(B=String.fromCharCode(B),this._onKey.fire({key:B,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(B,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(A){if(A.data&&A.inputType==="insertText"&&(!A.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const B=A.data;return this.coreService.triggerDataEvent(B,!0),this.cancel(A),!0}return!1}resize(A,B){A!==this.cols||B!==this.rows?super.resize(A,B):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(A,B){var U,W;(U=this._charSizeService)===null||U===void 0||U.measure(),(W=this.viewport)===null||W===void 0||W.syncScrollArea(!0)}clear(){var A;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 B=1;B<this.rows;B++)this.buffer.lines.push(this.buffer.getBlankLine(H.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(A=this.viewport)===null||A===void 0||A.reset(),this.refresh(0,this.rows-1)}}reset(){var A,B;this.options.rows=this.rows,this.options.cols=this.cols;const U=this._customKeyEventHandler;this._setup(),super.reset(),(A=this._selectionService)===null||A===void 0||A.reset(),this._decorationService.reset(),(B=this.viewport)===null||B===void 0||B.reset(),this._customKeyEventHandler=U,this.refresh(0,this.rows-1)}clearTextureAtlas(){var A;(A=this._renderService)===null||A===void 0||A.clearTextureAtlas()}_reportFocus(){var A;!((A=this.element)===null||A===void 0)&&A.classList.contains("focus")?this.coreService.triggerDataEvent(z.C0.ESC+"[I"):this.coreService.triggerDataEvent(z.C0.ESC+"[O")}_reportWindowsOptions(A){if(this._renderService)switch(A){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const B=this._renderService.dimensions.css.canvas.width.toFixed(0),U=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[4;${U};${B}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const W=this._renderService.dimensions.css.cell.width.toFixed(0),J=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[6;${J};${W}t`)}}cancel(A,B){if(this.options.cancelEvents||B)return A.preventDefault(),A.stopPropagation(),!1}}s.Terminal=G},9924:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(i,l=1e3){this._renderCallback=i,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(i,l,u){this._rowCount=u,i=i!==void 0?i:0,l=l!==void 0?l: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,l):l;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),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,l)}}},1680:function(y,s,i){var l=this&&this.__decorate||function(d,c,h,v){var b,w=arguments.length,k=w<3?c:v===null?v=Object.getOwnPropertyDescriptor(c,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,c,h,v);else for(var S=d.length-1;S>=0;S--)(b=d[S])&&(k=(w<3?b(k):w>3?b(c,h,k):b(c,h))||k);return w>3&&k&&Object.defineProperty(c,h,k),k},u=this&&this.__param||function(d,c){return function(h,v){c(h,v,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;const o=i(3656),p=i(4725),_=i(8460),C=i(844),g=i(2585);let n=s.Viewport=class extends C.Disposable{constructor(d,c,h,v,b,w,k,S){super(),this._viewportElement=d,this._scrollArea=c,this._bufferService=h,this._optionsService=v,this._charSizeService=b,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(d){this._viewportElement.style.backgroundColor=d.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(d){if(d)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const c=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==c&&(this._lastRecordedBufferHeight=c,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const d=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==d&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=d),this._refreshAnimationFrame=null}syncScrollArea(d=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(d);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(d)}_handleScroll(d){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const c=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:c,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const d=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(d*(this._smoothScrollState.target-this._smoothScrollState.origin)),d<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(d,c){const h=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(c<0&&this._viewportElement.scrollTop!==0||c>0&&h<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){const c=this._getPixelsScrolled(d);return c!==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+c:this._smoothScrollState.target+=c,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=c,this._bubbleScroll(d,c))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const c=d*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+c,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!1})}_getPixelsScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let c=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?c*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(c*=this._currentRowHeight*this._bufferService.rows),c}getBufferElements(d,c){var h;let v,b="";const w=[],k=c??this._bufferService.buffer.lines.length,S=this._bufferService.buffer.lines;for(let E=d;E<k;E++){const T=S.get(E);if(!T)continue;const L=(h=S.get(E+1))===null||h===void 0?void 0:h.isWrapped;if(b+=T.translateToString(!L),!L||E===S.length-1){const M=document.createElement("div");M.textContent=b,w.push(M),b.length>0&&(v=M),b=""}}return{bufferElements:w,cursorElement:v}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let c=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(c/=this._currentRowHeight+0,this._wheelPartialScroll+=c,c=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(c*=this._bufferService.rows),c}_applyScrollModifier(d,c){const h=this._optionsService.rawOptions.fastScrollModifier;return h==="alt"&&c.altKey||h==="ctrl"&&c.ctrlKey||h==="shift"&&c.shiftKey?d*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:d*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(d){this._lastTouchY=d.touches[0].pageY}handleTouchMove(d){const c=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,c!==0&&(this._viewportElement.scrollTop+=c,this._bubbleScroll(d,c))}};s.Viewport=n=l([u(2,g.IBufferService),u(3,g.IOptionsService),u(4,p.ICharSizeService),u(5,p.IRenderService),u(6,p.ICoreBrowserService),u(7,p.IThemeService)],n)},3107:function(y,s,i){var l=this&&this.__decorate||function(n,d,c,h){var v,b=arguments.length,w=b<3?d:h===null?h=Object.getOwnPropertyDescriptor(d,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,c,h);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(b<3?v(w):b>3?v(d,c,w):v(d,c))||w);return b>3&&w&&Object.defineProperty(d,c,w),w},u=this&&this.__param||function(n,d){return function(c,h){d(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;const o=i(3656),p=i(4725),_=i(844),C=i(2585);let g=s.BufferDecorationRenderer=class extends _.Disposable{constructor(n,d,c,h){super(),this._screenElement=n,this._bufferService=d,this._decorationService=c,this._renderService=h,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 d,c;const h=document.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",((d=n?.options)===null||d===void 0?void 0:d.layer)==="top"),h.style.width=`${Math.round((n.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(n.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(n.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const v=(c=n.options.x)!==null&&c!==void 0?c:0;return v&&v>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(n,h),h}_refreshStyle(n){const d=n.marker.line-this._bufferService.buffers.active.ydisp;if(d<0||d>=this._bufferService.rows)n.element&&(n.element.style.display="none",n.onRenderEmitter.fire(n.element));else{let c=this._decorationElements.get(n);c||(c=this._createElement(n),n.element=c,this._decorationElements.set(n,c),this._container.appendChild(c),n.onDispose((()=>{this._decorationElements.delete(n),c.remove()}))),c.style.top=d*this._renderService.dimensions.css.cell.height+"px",c.style.display=this._altBufferIsActive?"none":"block",n.onRenderEmitter.fire(c)}}_refreshXPosition(n,d=n.element){var c;if(!d)return;const h=(c=n.options.x)!==null&&c!==void 0?c:0;(n.options.anchor||"left")==="right"?d.style.right=h?h*this._renderService.dimensions.css.cell.width+"px":"":d.style.left=h?h*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(n){var d;(d=this._decorationElements.get(n))===null||d===void 0||d.remove(),this._decorationElements.delete(n),n.dispose()}};s.BufferDecorationRenderer=g=l([u(1,C.IBufferService),u(2,C.IDecorationService),u(3,p.IRenderService)],g)},5871:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.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 l of this._zones)if(l.color===i.options.overviewRulerOptions.color&&l.position===i.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,i.marker.line))return;if(this._lineAdjacentToZone(l,i.marker.line,i.options.overviewRulerOptions.position))return void this._addLineToZone(l,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,l){return l>=i.startBufferLine&&l<=i.endBufferLine}_lineAdjacentToZone(i,l,u){return l>=i.startBufferLine-this._linePadding[u||"full"]&&l<=i.endBufferLine+this._linePadding[u||"full"]}_addLineToZone(i,l){i.startBufferLine=Math.min(i.startBufferLine,l),i.endBufferLine=Math.max(i.endBufferLine,l)}}},5744:function(y,s,i){var l=this&&this.__decorate||function(v,b,w,k){var S,E=arguments.length,T=E<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,b,w,k);else for(var L=v.length-1;L>=0;L--)(S=v[L])&&(T=(E<3?S(T):E>3?S(b,w,T):S(b,w))||T);return E>3&&T&&Object.defineProperty(b,w,T),T},u=this&&this.__param||function(v,b){return function(w,k){b(w,k,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;const o=i(5871),p=i(3656),_=i(4725),C=i(844),g=i(2585),n={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0};let h=s.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(v,b,w,k,S,E,T){var L;super(),this._viewportElement=v,this._screenElement=b,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(),(L=this._viewportElement.parentElement)===null||L===void 0||L.insertBefore(this._canvas,this._viewportElement);const M=this._canvas.getContext("2d");if(!M)throw new Error("Ctx cannot be null");this._ctx=M,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.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),b=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=v,d.center=b,d.right=v,this._refreshDrawHeightConstants(),c.full=0,c.left=0,c.center=d.left,c.right=d.left+d.center}_refreshDrawHeightConstants(){n.full=Math.round(2*this._coreBrowseService.dpr);const v=this._canvas.height/this._bufferService.buffer.lines.length,b=Math.round(Math.max(Math.min(v,12),6)*this._coreBrowseService.dpr);n.left=b,n.center=b,n.right=b}_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 b of this._decorationService.decorations)this._colorZoneStore.addDecoration(b);this._ctx.lineWidth=1;const v=this._colorZoneStore.zones;for(const b of v)b.position!=="full"&&this._renderColorZone(b);for(const b of v)b.position==="full"&&this._renderColorZone(b);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(v){this._ctx.fillStyle=v.color,this._ctx.fillRect(c[v.position||"full"],Math.round((this._canvas.height-1)*(v.startBufferLine/this._bufferService.buffers.active.lines.length)-n[v.position||"full"]/2),d[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,b){this._shouldUpdateDimensions=v||this._shouldUpdateDimensions,this._shouldUpdateAnchor=b||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=h=l([u(2,g.IBufferService),u(3,g.IDecorationService),u(4,_.IRenderService),u(5,g.IOptionsService),u(6,_.ICoreBrowserService)],h)},2950:function(y,s,i){var l=this&&this.__decorate||function(g,n,d,c){var h,v=arguments.length,b=v<3?n:c===null?c=Object.getOwnPropertyDescriptor(n,d):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(g,n,d,c);else for(var w=g.length-1;w>=0;w--)(h=g[w])&&(b=(v<3?h(b):v>3?h(n,d,b):h(n,d))||b);return v>3&&b&&Object.defineProperty(n,d,b),b},u=this&&this.__param||function(g,n){return function(d,c){n(d,c,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;const o=i(4725),p=i(2585),_=i(2584);let C=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,n,d,c,h,v){this._textarea=g,this._compositionView=n,this._bufferService=d,this._optionsService=c,this._coreService=h,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 d;this._isSendingComposition=!1,n.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(n.start,n.end):this._textarea.value.substring(n.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;const n=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(n,!0)}}_handleAnyTextareaChanges(){const g=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const n=this._textarea.value,d=n.replace(g,"");this._dataAlreadySent=d,n.length>g.length?this._coreService.triggerDataEvent(d,!0):n.length<g.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):n.length===g.length&&n!==g&&this._coreService.triggerDataEvent(n,!0)}}),0)}updateCompositionElements(g){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const n=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,c=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,h=n*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=h+"px",this._compositionView.style.top=c+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const v=this._compositionView.getBoundingClientRect();this._textarea.style.left=h+"px",this._textarea.style.top=c+"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)}}};s.CompositionHelper=C=l([u(2,p.IBufferService),u(3,p.IOptionsService),u(4,p.ICoreService),u(5,o.IRenderService)],C)},9806:(y,s)=>{function i(l,u,o){const p=o.getBoundingClientRect(),_=l.getComputedStyle(o),C=parseInt(_.getPropertyValue("padding-left")),g=parseInt(_.getPropertyValue("padding-top"));return[u.clientX-p.left-C,u.clientY-p.top-g]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=i,s.getCoords=function(l,u,o,p,_,C,g,n,d){if(!C)return;const c=i(l,u,o);return c?(c[0]=Math.ceil((c[0]+(d?g/2:0))/g),c[1]=Math.ceil(c[1]/n),c[0]=Math.min(Math.max(c[0],1),p+(d?1:0)),c[1]=Math.min(Math.max(c[1],1),_),c):void 0}},9504:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;const l=i(2584);function u(n,d,c,h){const v=n-o(n,c),b=d-o(d,c),w=Math.abs(v-b)-(function(k,S,E){let T=0;const L=k-o(k,E),M=S-o(S,E);for(let N=0;N<Math.abs(L-M);N++){const I=p(k,S)==="A"?-1:1,F=E.buffer.lines.get(L+I*N);F?.isWrapped&&T++}return T})(n,d,c);return g(w,C(p(n,d),h))}function o(n,d){let c=0,h=d.buffer.lines.get(n),v=h?.isWrapped;for(;v&&n>=0&&n<d.rows;)c++,h=d.buffer.lines.get(--n),v=h?.isWrapped;return c}function p(n,d){return n>d?"A":"B"}function _(n,d,c,h,v,b){let w=n,k=d,S="";for(;w!==c||k!==h;)w+=v?1:-1,v&&w>b.cols-1?(S+=b.buffer.translateBufferLineToString(k,!1,n,w),w=0,n=0,k++):!v&&w<0&&(S+=b.buffer.translateBufferLineToString(k,!1,0,n+1),w=b.cols-1,n=w,k--);return S+b.buffer.translateBufferLineToString(k,!1,n,w)}function C(n,d){const c=d?"O":"[";return l.C0.ESC+c+n}function g(n,d){n=Math.floor(n);let c="";for(let h=0;h<n;h++)c+=d;return c}s.moveToCellSequence=function(n,d,c,h){const v=c.buffer.x,b=c.buffer.y;if(!c.buffer.hasScrollback)return(function(S,E,T,L,M,N){return u(E,L,M,N).length===0?"":g(_(S,E,S,E-o(E,M),!1,M).length,C("D",N))})(v,b,0,d,c,h)+u(b,d,c,h)+(function(S,E,T,L,M,N){let I;I=u(E,L,M,N).length>0?L-o(L,M):E;const F=L,H=(function(z,D,j,P,O,$){let q;return q=u(j,P,O,$).length>0?P-o(P,O):D,z<j&&q<=P||z>=j&&q<P?"C":"D"})(S,E,T,L,M,N);return g(_(S,I,T,F,H==="C",M).length,C(H,N))})(v,b,n,d,c,h);let w;if(b===d)return w=v>n?"D":"C",g(Math.abs(v-n),C(w,h));w=b>d?"D":"C";const k=Math.abs(b-d);return g((function(S,E){return E.cols-S})(b>d?n:v,c)+(k-1)*c.cols+1+((b>d?v:n)-1),C(w,h))}},1296:function(y,s,i){var l=this&&this.__decorate||function(M,N,I,F){var H,z=arguments.length,D=z<3?N:F===null?F=Object.getOwnPropertyDescriptor(N,I):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(M,N,I,F);else for(var j=M.length-1;j>=0;j--)(H=M[j])&&(D=(z<3?H(D):z>3?H(N,I,D):H(N,I))||D);return z>3&&D&&Object.defineProperty(N,I,D),D},u=this&&this.__param||function(M,N){return function(I,F){N(I,F,M)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;const o=i(3787),p=i(2550),_=i(2223),C=i(6171),g=i(4725),n=i(8055),d=i(8460),c=i(844),h=i(2585),v="xterm-dom-renderer-owner-",b="xterm-rows",w="xterm-fg-",k="xterm-bg-",S="xterm-focus",E="xterm-selection";let T=1,L=s.DomRenderer=class extends c.Disposable{constructor(M,N,I,F,H,z,D,j,P,O){super(),this._element=M,this._screenElement=N,this._viewportElement=I,this._linkifier2=F,this._charSizeService=z,this._optionsService=D,this._bufferService=j,this._coreBrowserService=P,this._themeService=O,this._terminalClass=T++,this._rowElements=[],this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(b),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,C.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors(($=>this._injectCss($)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(v+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(($=>this._handleLinkHover($)))),this.register(this._linkifier2.onHideLinkUnderline(($=>this._handleLinkLeave($)))),this.register((0,c.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 M=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*M,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*M),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/M),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/M),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 I of this._rowElements)I.style.width=`${this.dimensions.css.canvas.width}px`,I.style.height=`${this.dimensions.css.cell.height}px`,I.style.lineHeight=`${this.dimensions.css.cell.height}px`,I.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const N=`${this._terminalSelector} .${b} 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(M){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let N=`${this._terminalSelector} .${b} { color: ${M.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;N+=`${this._terminalSelector} .${b} .xterm-dim { color: ${n.color.multiplyOpacity(M.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: ${M.cursor.css}; color: ${M.cursorAccent.css}; } 50% { background-color: inherit; color: ${M.cursor.css}; }}`,N+=`${this._terminalSelector} .${b}.${S} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${b}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block { background-color: ${M.cursor.css}; color: ${M.cursorAccent.css};}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${M.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${M.cursor.css} inset;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${M.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: ${M.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${M.selectionInactiveBackgroundOpaque.css};}`;for(const[I,F]of M.ansi.entries())N+=`${this._terminalSelector} .${w}${I} { color: ${F.css}; }${this._terminalSelector} .${w}${I}.xterm-dim { color: ${n.color.multiplyOpacity(F,.5).css}; }${this._terminalSelector} .${k}${I} { background-color: ${F.css}; }`;N+=`${this._terminalSelector} .${w}${_.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(M.background).css}; }${this._terminalSelector} .${w}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(M.background),.5).css}; }${this._terminalSelector} .${k}${_.INVERTED_DEFAULT_COLOR} { background-color: ${M.foreground.css}; }`,this._themeStyleElement.textContent=N}_setDefaultSpacing(){const M=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${M}px`,this._rowFactory.defaultSpacing=M}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(M,N){for(let I=this._rowElements.length;I<=N;I++){const F=document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>N;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(M,N){this._refreshRowElements(M,N),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(M,N,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(M,N,I),this.renderRows(0,this._bufferService.rows-1),!M||!N)return;const F=M[1]-this._bufferService.buffer.ydisp,H=N[1]-this._bufferService.buffer.ydisp,z=Math.max(F,0),D=Math.min(H,this._bufferService.rows-1);if(z>=this._bufferService.rows||D<0)return;const j=document.createDocumentFragment();if(I){const P=M[0]>N[0];j.appendChild(this._createSelectionElement(z,P?N[0]:M[0],P?M[0]:N[0],D-z+1))}else{const P=F===z?M[0]:0,O=z===H?N[0]:this._bufferService.cols;j.appendChild(this._createSelectionElement(z,P,O));const $=D-z-1;if(j.appendChild(this._createSelectionElement(z+1,0,this._bufferService.cols,$)),z!==D){const q=H===D?N[0]:this._bufferService.cols;j.appendChild(this._createSelectionElement(D,0,q))}}this._selectionContainer.appendChild(j)}_createSelectionElement(M,N,I,F=1){const H=document.createElement("div");return H.style.height=F*this.dimensions.css.cell.height+"px",H.style.top=M*this.dimensions.css.cell.height+"px",H.style.left=N*this.dimensions.css.cell.width+"px",H.style.width=this.dimensions.css.cell.width*(I-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 M of this._rowElements)M.replaceChildren()}renderRows(M,N){const I=this._bufferService.buffer,F=I.ybase+I.y,H=Math.min(I.x,this._bufferService.cols-1),z=this._optionsService.rawOptions.cursorBlink,D=this._optionsService.rawOptions.cursorStyle,j=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=M;P<=N;P++){const O=P+I.ydisp,$=this._rowElements[P],q=I.lines.get(O);if(!$||!q)break;$.replaceChildren(...this._rowFactory.createRow(q,O,O===F,D,j,H,z,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${v}${this._terminalClass}`}_handleLinkHover(M){this._setCellUnderline(M.x1,M.x2,M.y1,M.y2,M.cols,!0)}_handleLinkLeave(M){this._setCellUnderline(M.x1,M.x2,M.y1,M.y2,M.cols,!1)}_setCellUnderline(M,N,I,F,H,z){I<0&&(M=0),F<0&&(N=0);const D=this._bufferService.rows-1;I=Math.max(Math.min(I,D),0),F=Math.max(Math.min(F,D),0),H=Math.min(H,this._bufferService.cols);const j=this._bufferService.buffer,P=j.ybase+j.y,O=Math.min(j.x,H-1),$=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let G=I;G<=F;++G){const se=G+j.ydisp,A=this._rowElements[G],B=j.lines.get(se);if(!A||!B)break;A.replaceChildren(...this._rowFactory.createRow(B,se,se===P,q,X,O,$,this.dimensions.css.cell.width,this._widthCache,z?G===I?M:0:-1,z?(G===F?N:H)-1:-1))}}};s.DomRenderer=L=l([u(4,h.IInstantiationService),u(5,g.ICharSizeService),u(6,h.IOptionsService),u(7,h.IBufferService),u(8,g.ICoreBrowserService),u(9,g.IThemeService)],L)},3787:function(y,s,i){var l=this&&this.__decorate||function(w,k,S,E){var T,L=arguments.length,M=L<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(w,k,S,E);else for(var N=w.length-1;N>=0;N--)(T=w[N])&&(M=(L<3?T(M):L>3?T(k,S,M):T(k,S))||M);return L>3&&M&&Object.defineProperty(k,S,M),M},u=this&&this.__param||function(w,k){return function(S,E){k(S,E,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;const o=i(2223),p=i(643),_=i(511),C=i(2585),g=i(8055),n=i(4725),d=i(4269),c=i(6171),h=i(3734);let v=s.DomRendererRowFactory=class{constructor(w,k,S,E,T,L,M){this._document=w,this._characterJoinerService=k,this._optionsService=S,this._coreBrowserService=E,this._coreService=T,this._decorationService=L,this._themeService=M,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,L,M,N,I,F,H){const z=[],D=this._characterJoinerService.getJoinedCharacters(k),j=this._themeService.colors;let P,O=w.getNoBgTrimmedLength();S&&O<L+1&&(O=L+1);let $=0,q="",X=0,G=0,se=0,A=!1,B=0,U=!1,W=0;const J=[],Y=F!==-1&&H!==-1;for(let ie=0;ie<O;ie++){w.loadCell(ie,this._workCell);let ue=this._workCell.getWidth();if(ue===0)continue;let _e=!1,we=ie,te=this._workCell;if(D.length>0&&ie===D[0][0]){_e=!0;const fe=D.shift();te=new d.JoinedCellData(this._workCell,w.translateToString(!0,fe[0],fe[1]),fe[1]-fe[0]),we=fe[1]-1,ue=te.getWidth()}const ke=this._isCellInSelection(ie,k),Ae=S&&ie===L,Q=Y&&ie>=F&&ie<=H;let re=!1;this._decorationService.forEachDecorationAtCell(ie,k,void 0,(fe=>{re=!0}));let Se=te.getChars()||p.WHITESPACE_CELL_CHAR;if(Se===" "&&(te.isUnderline()||te.isOverline())&&(Se=" "),W=ue*N-I.get(Se,te.isBold(),te.isItalic()),P){if($&&(ke&&U||!ke&&!U&&te.bg===X)&&(ke&&U&&j.selectionForeground||te.fg===G)&&te.extended.ext===se&&Q===A&&W===B&&!Ae&&!_e&&!re){q+=Se,$++;continue}$&&(P.textContent=q),P=this._document.createElement("span"),$=0,q=""}else P=this._document.createElement("span");if(X=te.bg,G=te.fg,se=te.extended.ext,A=Q,B=W,U=ke,_e&&L>=ie&&L<=we&&(L=ie),!this._coreService.isCursorHidden&&Ae){if(J.push("xterm-cursor"),this._coreBrowserService.isFocused)M&&J.push("xterm-cursor-blink"),J.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){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(te.isBold()&&J.push("xterm-bold"),te.isItalic()&&J.push("xterm-italic"),te.isDim()&&J.push("xterm-dim"),q=te.isInvisible()?p.WHITESPACE_CELL_CHAR:te.getChars()||p.WHITESPACE_CELL_CHAR,te.isUnderline()&&(J.push(`xterm-underline-${te.extended.underlineStyle}`),q===" "&&(q=" "),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${h.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let fe=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&fe<8&&(fe+=8),P.style.textDecorationColor=j.ansi[fe].css}te.isOverline()&&(J.push("xterm-overline"),q===" "&&(q=" ")),te.isStrikethrough()&&J.push("xterm-strikethrough"),Q&&(P.style.textDecoration="underline");let ae=te.getFgColor(),K=te.getFgColorMode(),ne=te.getBgColor(),me=te.getBgColorMode();const Be=!!te.isInverse();if(Be){const fe=ae;ae=ne,ne=fe;const wt=K;K=me,me=wt}let Te,qe,Ie,je=!1;switch(this._decorationService.forEachDecorationAtCell(ie,k,void 0,(fe=>{fe.options.layer!=="top"&&je||(fe.backgroundColorRGB&&(me=50331648,ne=fe.backgroundColorRGB.rgba>>8&16777215,Te=fe.backgroundColorRGB),fe.foregroundColorRGB&&(K=50331648,ae=fe.foregroundColorRGB.rgba>>8&16777215,qe=fe.foregroundColorRGB),je=fe.options.layer==="top")})),!je&&ke&&(Te=this._coreBrowserService.isFocused?j.selectionBackgroundOpaque:j.selectionInactiveBackgroundOpaque,ne=Te.rgba>>8&16777215,me=50331648,je=!0,j.selectionForeground&&(K=50331648,ae=j.selectionForeground.rgba>>8&16777215,qe=j.selectionForeground)),je&&J.push("xterm-decoration-top"),me){case 16777216:case 33554432:Ie=j.ansi[ne],J.push(`xterm-bg-${ne}`);break;case 50331648:Ie=g.rgba.toColor(ne>>16,ne>>8&255,255&ne),this._addStyle(P,`background-color:#${b((ne>>>0).toString(16),"0",6)}`);break;default:Be?(Ie=j.foreground,J.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):Ie=j.background}switch(Te||te.isDim()&&(Te=g.color.multiplyOpacity(Ie,.5)),K){case 16777216:case 33554432:te.isBold()&&ae<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ae+=8),this._applyMinimumContrast(P,Ie,j.ansi[ae],te,Te,void 0)||J.push(`xterm-fg-${ae}`);break;case 50331648:const fe=g.rgba.toColor(ae>>16&255,ae>>8&255,255&ae);this._applyMinimumContrast(P,Ie,fe,te,Te,qe)||this._addStyle(P,`color:#${b(ae.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,Ie,j.foreground,te,Te,void 0)||Be&&J.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}J.length&&(P.className=J.join(" "),J.length=0),Ae||_e||re?P.textContent=q:$++,W!==this.defaultSpacing&&(P.style.letterSpacing=`${W}px`),z.push(P),ie=we}return P&&$&&(P.textContent=q),z}_applyMinimumContrast(w,k,S,E,T,L){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,c.excludeFromContrastRatioDemands)(E.getCode()))return!1;const M=this._getContrastCache(E);let N;if(T||L||(N=M.getColor(k.rgba,S.rgba)),N===void 0){const I=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);N=g.color.ensureContrastRatio(T||k,L||S,I),M.setColor((T||k).rgba,(L||S).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 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 b(w,k,S){for(;w.length<S;)w=k+w;return w}s.DomRendererRowFactory=v=l([u(1,n.ICharacterJoinerService),u(2,C.IOptionsService),u(3,n.ICoreBrowserService),u(4,C.ICoreService),u(5,C.IDecorationService),u(6,n.IThemeService)],v)},2550:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.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 l=i.createElement("span"),u=i.createElement("span");u.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=[l,u,o,p],this._container.appendChild(l),this._container.appendChild(u),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,l,u,o){i===this._font&&l===this._fontSize&&u===this._weight&&o===this._weightBold||(this._font=i,this._fontSize=l,this._weight=u,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${u}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${u}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(i,l,u){let o=0;if(!l&&!u&&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;l&&(p+="B"),u&&(p+="I");let _=this._holey.get(p);if(_===void 0){let C=0;l&&(C|=1),u&&(C|=2),_=this._measure(i,C),this._holey.set(p,_)}return _}_measure(i,l){const u=this._measureElements[l];return u.textContent=i.repeat(32),u.offsetWidth/32}}},2223:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const l=i(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(y,s)=>{function i(l){return 57508<=l&&l<=57558}Object.defineProperty(s,"__esModule",{value:!0}),s.createRenderDimensions=s.excludeFromContrastRatioDemands=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},s.isPowerlineGlyph=i,s.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},s.excludeFromContrastRatioDemands=function(l){return i(l)||(function(u){return 9472<=u&&u<=9631})(l)},s.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:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.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,l=this.selectionEnd;return!(!i||!l)&&(i[1]>l[1]||i[1]===l[1]&&i[0]>l[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(y,s,i){var l=this&&this.__decorate||function(n,d,c,h){var v,b=arguments.length,w=b<3?d:h===null?h=Object.getOwnPropertyDescriptor(d,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,c,h);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(b<3?v(w):b>3?v(d,c,w):v(d,c))||w);return b>3&&w&&Object.defineProperty(d,c,w),w},u=this&&this.__param||function(n,d){return function(c,h){d(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;const o=i(2585),p=i(8460),_=i(844);let C=s.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(n,d,c){super(),this._optionsService=c,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new g(n,d,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const n=this._measureStrategy.measure();n.width===this.width&&n.height===this.height||(this.width=n.width,this.height=n.height,this._onCharSizeChange.fire())}};s.CharSizeService=C=l([u(2,o.IOptionsService)],C);class g{constructor(d,c,h){this._document=d,this._parentElement=c,this._optionsService=h,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const d={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return d.width!==0&&d.height!==0&&(this._result.width=d.width/32,this._result.height=Math.ceil(d.height)),this._result}}},4269:function(y,s,i){var l=this&&this.__decorate||function(d,c,h,v){var b,w=arguments.length,k=w<3?c:v===null?v=Object.getOwnPropertyDescriptor(c,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,c,h,v);else for(var S=d.length-1;S>=0;S--)(b=d[S])&&(k=(w<3?b(k):w>3?b(c,h,k):b(c,h))||k);return w>3&&k&&Object.defineProperty(c,h,k),k},u=this&&this.__param||function(d,c){return function(h,v){c(h,v,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;const o=i(3734),p=i(643),_=i(511),C=i(2585);class g extends o.AttributeData{constructor(c,h,v){super(),this.content=0,this.combinedData="",this.fg=c.fg,this.bg=c.bg,this.combinedData=h,this._width=v}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(c){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=g;let n=s.CharacterJoinerService=class mn{constructor(c){this._bufferService=c,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(c){const h={id:this._nextCharacterJoinerId++,handler:c};return this._characterJoiners.push(h),h.id}deregister(c){for(let h=0;h<this._characterJoiners.length;h++)if(this._characterJoiners[h].id===c)return this._characterJoiners.splice(h,1),!0;return!1}getJoinedCharacters(c){if(this._characterJoiners.length===0)return[];const h=this._bufferService.buffer.lines.get(c);if(!h||h.length===0)return[];const v=[],b=h.translateToString(!0);let w=0,k=0,S=0,E=h.getFg(0),T=h.getBg(0);for(let L=0;L<h.getTrimmedLength();L++)if(h.loadCell(L,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==T){if(L-w>1){const M=this._getJoinedRanges(b,S,k,h,w);for(let N=0;N<M.length;N++)v.push(M[N])}w=L,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 L=this._getJoinedRanges(b,S,k,h,w);for(let M=0;M<L.length;M++)v.push(L[M])}return v}_getJoinedRanges(c,h,v,b,w){const k=c.substring(h,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 L=0;L<T.length;L++)mn._mergeRanges(S,T[L])}catch(T){console.error(T)}return this._stringRangesToCellRanges(S,b,w),S}_stringRangesToCellRanges(c,h,v){let b=0,w=!1,k=0,S=c[b];if(S){for(let E=v;E<this._bufferService.cols;E++){const T=h.getWidth(E),L=h.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=c[++b],!S)break;S[0]<=k?(S[0]=E,w=!0):w=!1}k+=L}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(c,h){let v=!1;for(let b=0;b<c.length;b++){const w=c[b];if(v){if(h[1]<=w[0])return c[b-1][1]=h[1],c;if(h[1]<=w[1])return c[b-1][1]=Math.max(h[1],w[1]),c.splice(b,1),c;c.splice(b,1),b--}else{if(h[1]<=w[0])return c.splice(b,0,h),c;if(h[1]<=w[1])return w[0]=Math.min(h[0],w[0]),c;h[0]<w[1]&&(w[0]=Math.min(h[0],w[0]),v=!0)}}return v?c[c.length-1][1]=h[1]:c.push(h),c}};s.CharacterJoinerService=n=l([u(0,C.IBufferService)],n)},5114:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0,s.CoreBrowserService=class{constructor(i,l){this._textarea=i,this.window=l,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(y,s,i){var l=this&&this.__decorate||function(C,g,n,d){var c,h=arguments.length,v=h<3?g:d===null?d=Object.getOwnPropertyDescriptor(g,n):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(C,g,n,d);else for(var b=C.length-1;b>=0;b--)(c=C[b])&&(v=(h<3?c(v):h>3?c(g,n,v):c(g,n))||v);return h>3&&v&&Object.defineProperty(g,n,v),v},u=this&&this.__param||function(C,g){return function(n,d){g(n,d,C)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;const o=i(4725),p=i(9806);let _=s.MouseService=class{constructor(C,g){this._renderService=C,this._charSizeService=g}getCoords(C,g,n,d,c){return(0,p.getCoords)(window,C,g,n,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,c)}getMouseReportCoords(C,g){const n=(0,p.getCoordsRelativeToElement)(window,C,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])}}};s.MouseService=_=l([u(0,o.IRenderService),u(1,o.ICharSizeService)],_)},3230:function(y,s,i){var l=this&&this.__decorate||function(v,b,w,k){var S,E=arguments.length,T=E<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,b,w,k);else for(var L=v.length-1;L>=0;L--)(S=v[L])&&(T=(E<3?S(T):E>3?S(b,w,T):S(b,w))||T);return E>3&&T&&Object.defineProperty(b,w,T),T},u=this&&this.__param||function(v,b){return function(w,k){b(w,k,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;const o=i(3656),p=i(6193),_=i(5596),C=i(4725),g=i(8460),n=i(844),d=i(7226),c=i(2585);let h=s.RenderService=class extends n.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,b,w,k,S,E,T,L){if(super(),this._rowCount=v,this._charSizeService=k,this._renderer=this.register(new n.MutableDisposable),this._pausedResizeTask=new d.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new p.RenderDebouncer(T.window,((M,N)=>this._renderRows(M,N))),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 M;return(M=this._renderer.value)===null||M===void 0?void 0:M.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(L.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in T.window){const M=new T.window.IntersectionObserver((N=>this._handleIntersectionChange(N[N.length-1])),{threshold:0});M.observe(b),this.register({dispose:()=>M.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,b,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,b,this._rowCount))}_renderRows(v,b){this._renderer.value&&(v=Math.min(v,this._rowCount-1),b=Math.min(b,this._rowCount-1),this._renderer.value.renderRows(v,b),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:b}),this._onRender.fire({start:v,end:b}),this._isNextRenderRedrawOnly=!0)}resize(v,b){this._rowCount=b,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((b=>this.refreshRows(b.start,b.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,b;this._renderer.value&&((b=(v=this._renderer.value).clearTextureAtlas)===null||b===void 0||b.call(v),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,b){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(v,b))):this._renderer.value.handleResize(v,b),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,b,w){var k;this._selectionState.start=v,this._selectionState.end=b,this._selectionState.columnSelectMode=w,(k=this._renderer.value)===null||k===void 0||k.handleSelectionChanged(v,b,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()}};s.RenderService=h=l([u(2,c.IOptionsService),u(3,C.ICharSizeService),u(4,c.IDecorationService),u(5,c.IBufferService),u(6,C.ICoreBrowserService),u(7,C.IThemeService)],h)},9312:function(y,s,i){var l=this&&this.__decorate||function(S,E,T,L){var M,N=arguments.length,I=N<3?E:L===null?L=Object.getOwnPropertyDescriptor(E,T):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(S,E,T,L);else for(var F=S.length-1;F>=0;F--)(M=S[F])&&(I=(N<3?M(I):N>3?M(E,T,I):M(E,T))||I);return N>3&&I&&Object.defineProperty(E,T,I),I},u=this&&this.__param||function(S,E){return function(T,L){E(T,L,S)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;const o=i(9806),p=i(9504),_=i(456),C=i(4725),g=i(8460),n=i(844),d=i(6114),c=i(4841),h=i(511),v=i(2585),b=" ",w=new RegExp(b,"g");let k=s.SelectionService=class extends n.Disposable{constructor(S,E,T,L,M,N,I,F,H){super(),this._element=S,this._screenElement=E,this._linkifier=T,this._bufferService=L,this._coreService=M,this._mouseService=N,this._optionsService=I,this._renderService=F,this._coreBrowserService=H,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new h.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=z=>this._handleMouseMove(z),this._mouseUpListener=z=>this._handleMouseUp(z),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((z=>this._handleTrim(z))),this.register(this._bufferService.buffers.onBufferActivate((z=>this._handleBufferActivate(z)))),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,L=[];if(this._activeSelectionMode===3){if(S[0]===E[0])return"";const M=S[0]<E[0]?S[0]:E[0],N=S[0]<E[0]?E[0]:S[0];for(let I=S[1];I<=E[1];I++){const F=T.translateBufferLineToString(I,!0,M,N);L.push(F)}}else{const M=S[1]===E[1]?E[0]:void 0;L.push(T.translateBufferLineToString(S[1],!0,S[0],M));for(let N=S[1]+1;N<=E[1]-1;N++){const I=T.lines.get(N),F=T.translateBufferLineToString(N,!0);I?.isWrapped?L[L.length-1]+=F:L.push(F)}if(S[1]!==E[1]){const N=T.lines.get(E[1]),I=T.translateBufferLineToString(E[1],!0,0,E[0]);N&&N.isWrapped?L[L.length-1]+=I:L.push(I)}}return L.map((M=>M.replace(w," "))).join(d.isWindows?`\r
|
|
16
|
+
`:`
|
|
17
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(S){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.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,L=this._model.finalSelectionEnd;return!!(T&&L&&E)&&this._areCoordsInSelection(E,T,L)}isCellInSelection(S,E){const T=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!T||!L)&&this._areCoordsInSelection([S,E],T,L)}_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,L;const M=(L=(T=this._linkifier.currentLink)===null||T===void 0?void 0:T.link)===null||L===void 0?void 0:L.range;if(M)return this._model.selectionStart=[M.start.x-1,M.start.y-1],this._model.selectionStartLength=(0,c.getRangeLength)(M,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const N=this._getMouseBufferCoords(S);return!!N&&(this._selectWordAt(N,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 d.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&&!(d.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 L=T.lines.get(this._model.selectionEnd[1]);L&&L.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 L=(0,p.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(L,!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 L=0;E>=L;L++){const M=S.loadCell(L,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:M>1&&E!==L&&(T+=M-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,L=!0){if(S[0]>=this._bufferService.cols)return;const M=this._bufferService.buffer,N=M.lines.get(S[1]);if(!N)return;const I=M.translateBufferLineToString(S[1],!1);let F=this._convertViewportColToCharacterIndex(N,S[0]),H=F;const z=S[0]-F;let D=0,j=0,P=0,O=0;if(I.charAt(F)===" "){for(;F>0&&I.charAt(F-1)===" ";)F--;for(;H<I.length&&I.charAt(H+1)===" ";)H++}else{let X=S[0],G=S[0];N.getWidth(X)===0&&(D++,X--),N.getWidth(G)===2&&(j++,G++);const se=N.getString(G).length;for(se>1&&(O+=se-1,H+=se-1);X>0&&F>0&&!this._isCharWordSeparator(N.loadCell(X-1,this._workCell));){N.loadCell(X-1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===0?(D++,X--):A>1&&(P+=A-1,F-=A-1),F--,X--}for(;G<N.length&&H+1<I.length&&!this._isCharWordSeparator(N.loadCell(G+1,this._workCell));){N.loadCell(G+1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===2?(j++,G++):A>1&&(O+=A-1,H+=A-1),H++,G++}}H++;let $=F+z-D+P,q=Math.min(this._bufferService.cols,H-F+D+j-P-O);if(E||I.slice(F,H).trim()!==""){if(T&&$===0&&N.getCodePoint(0)!==32){const X=M.lines.get(S[1]-1);if(X&&N.isWrapped&&X.getCodePoint(this._bufferService.cols-1)!==32){const G=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(G){const se=this._bufferService.cols-G.start;$-=se,q+=se}}}if(L&&$+q===this._bufferService.cols&&N.getCodePoint(this._bufferService.cols-1)!==32){const X=M.lines.get(S[1]+1);if(X?.isWrapped&&X.getCodePoint(0)!==32){const G=this._getWordAt([0,S[1]+1],!1,!1,!0);G&&(q+=G.length)}}return{start:$,length:q}}}_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,c.getRangeLength)(T,this._bufferService.cols)}};s.SelectionService=k=l([u(3,v.IBufferService),u(4,v.ICoreService),u(5,C.IMouseService),u(6,v.IOptionsService),u(7,C.IRenderService),u(8,C.ICoreBrowserService)],k)},4725:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;const l=i(8343);s.ICharSizeService=(0,l.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),s.IMouseService=(0,l.createDecorator)("MouseService"),s.IRenderService=(0,l.createDecorator)("RenderService"),s.ISelectionService=(0,l.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,l.createDecorator)("ThemeService")},6731:function(y,s,i){var l=this&&this.__decorate||function(k,S,E,T){var L,M=arguments.length,N=M<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(k,S,E,T);else for(var I=k.length-1;I>=0;I--)(L=k[I])&&(N=(M<3?L(N):M>3?L(S,E,N):L(S,E))||N);return M>3&&N&&Object.defineProperty(S,E,N),N},u=this&&this.__param||function(k,S){return function(E,T){S(E,T,k)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;const o=i(7239),p=i(8055),_=i(8460),C=i(844),g=i(2585),n=p.css.toColor("#ffffff"),d=p.css.toColor("#000000"),c=p.css.toColor("#ffffff"),h=p.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.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],L=S[E/6%6|0],M=S[E%6];k.push({css:p.channels.toCss(T,L,M),rgba:p.channels.toRgba(T,L,M)})}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 b=s.ThemeService=class extends C.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:d,cursor:c,cursorAccent:h,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:p.color.blend(d,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:p.color.blend(d,v),ansi:s.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,d),S.cursor=w(k.cursor,c),S.cursorAccent=w(k.cursorAccent,h),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=s.DEFAULT_ANSI_COLORS.slice(),S.ansi[0]=w(k.black,s.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=w(k.red,s.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=w(k.green,s.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=w(k.yellow,s.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=w(k.blue,s.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=w(k.magenta,s.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=w(k.cyan,s.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=w(k.white,s.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=w(k.brightBlack,s.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=w(k.brightRed,s.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=w(k.brightGreen,s.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=w(k.brightYellow,s.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=w(k.brightBlue,s.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=w(k.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=w(k.brightCyan,s.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=w(k.brightWhite,s.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],s.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}s.ThemeService=b=l([u(0,g.IOptionsService)],b)},6349:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;const l=i(8460),u=i(844);class o extends u.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new l.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new l.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new l.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 C=new Array(_);for(let g=0;g<Math.min(_,this.length);g++)C[g]=this._array[this._getCyclicIndex(g)];this._array=C,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let C=this._length;C<_;C++)this._array[C]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,C){this._array[this._getCyclicIndex(_)]=C}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(_,C,...g){if(C){for(let n=_;n<this._length-C;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+C)];this._length-=C,this.onDeleteEmitter.fire({index:_,amount:C})}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(_,C,g){if(!(C<=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 d=C-1;d>=0;d--)this.set(_+d+g,this.get(_+d));const n=_+C+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<C;n++)this.set(_+n+g,this.get(_+n))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}s.CircularList=o},1439:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function i(l,u=5){if(typeof l!="object")return l;const o=Array.isArray(l)?[]:{};for(const p in l)o[p]=u<=1?l[p]:l[p]&&i(l[p],u-1);return o}},8055:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;const l=i(6114);let u=0,o=0,p=0,_=0;var C,g,n,d,c;function h(b){const w=b.toString(16);return w.length<2?"0"+w:w}function v(b,w){return b<w?(w+.05)/(b+.05):(b+.05)/(w+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(b){b.toCss=function(w,k,S,E){return E!==void 0?`#${h(w)}${h(k)}${h(S)}${h(E)}`:`#${h(w)}${h(k)}${h(S)}`},b.toRgba=function(w,k,S,E=255){return(w<<24|k<<16|S<<8|E)>>>0}})(C||(s.channels=C={})),(function(b){function w(k,S){return _=Math.round(255*S),[u,o,p]=c.toChannels(k.rgba),{css:C.toCss(u,o,p,_),rgba:C.toRgba(u,o,p,_)}}b.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,L=S.rgba>>8&255,M=k.rgba>>24&255,N=k.rgba>>16&255,I=k.rgba>>8&255;return u=M+Math.round((E-M)*_),o=N+Math.round((T-N)*_),p=I+Math.round((L-I)*_),{css:C.toCss(u,o,p),rgba:C.toRgba(u,o,p)}},b.isOpaque=function(k){return(255&k.rgba)==255},b.ensureContrastRatio=function(k,S,E){const T=c.ensureContrastRatio(k.rgba,S.rgba,E);if(T)return c.toColor(T>>24&255,T>>16&255,T>>8&255)},b.opaque=function(k){const S=(255|k.rgba)>>>0;return[u,o,p]=c.toChannels(S),{css:C.toCss(u,o,p),rgba:S}},b.opacity=w,b.multiplyOpacity=function(k,S){return _=255&k.rgba,w(k,_*S/255)},b.toColorRGB=function(k){return[k.rgba>>24&255,k.rgba>>16&255,k.rgba>>8&255]}})(g||(s.color=g={})),(function(b){let w,k;if(!l.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))}b.toColor=function(S){if(S.match(/#[\da-f]{3,8}/i))switch(S.length){case 4:return u=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),c.toColor(u,o,p);case 5:return u=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),c.toColor(u,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 u=parseInt(E[1]),o=parseInt(E[2]),p=parseInt(E[3]),_=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),c.toColor(u,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),[u,o,p,_]=w.getImageData(0,0,1,1).data,_!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:C.toRgba(u,o,p,_),css:S}}})(n||(s.css=n={})),(function(b){function w(k,S,E){const T=k/255,L=S/255,M=E/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))}b.relativeLuminance=function(k){return w(k>>16&255,k>>8&255,255&k)},b.relativeLuminance2=w})(d||(s.rgb=d={})),(function(b){function w(S,E,T){const L=S>>24&255,M=S>>16&255,N=S>>8&255;let I=E>>24&255,F=E>>16&255,H=E>>8&255,z=v(d.relativeLuminance2(I,F,H),d.relativeLuminance2(L,M,N));for(;z<T&&(I>0||F>0||H>0);)I-=Math.max(0,Math.ceil(.1*I)),F-=Math.max(0,Math.ceil(.1*F)),H-=Math.max(0,Math.ceil(.1*H)),z=v(d.relativeLuminance2(I,F,H),d.relativeLuminance2(L,M,N));return(I<<24|F<<16|H<<8|255)>>>0}function k(S,E,T){const L=S>>24&255,M=S>>16&255,N=S>>8&255;let I=E>>24&255,F=E>>16&255,H=E>>8&255,z=v(d.relativeLuminance2(I,F,H),d.relativeLuminance2(L,M,N));for(;z<T&&(I<255||F<255||H<255);)I=Math.min(255,I+Math.ceil(.1*(255-I))),F=Math.min(255,F+Math.ceil(.1*(255-F))),H=Math.min(255,H+Math.ceil(.1*(255-H))),z=v(d.relativeLuminance2(I,F,H),d.relativeLuminance2(L,M,N));return(I<<24|F<<16|H<<8|255)>>>0}b.ensureContrastRatio=function(S,E,T){const L=d.relativeLuminance(S>>8),M=d.relativeLuminance(E>>8);if(v(L,M)<T){if(M<L){const F=w(S,E,T),H=v(L,d.relativeLuminance(F>>8));if(H<T){const z=k(S,E,T);return H>v(L,d.relativeLuminance(z>>8))?F:z}return F}const N=k(S,E,T),I=v(L,d.relativeLuminance(N>>8));if(I<T){const F=w(S,E,T);return I>v(L,d.relativeLuminance(F>>8))?N:F}return N}},b.reduceLuminance=w,b.increaseLuminance=k,b.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]},b.toColor=function(S,E,T,L){return{css:C.toCss(S,E,T,L),rgba:C.toRgba(S,E,T,L)}}})(c||(s.rgba=c={})),s.toPaddedHex=h,s.contrastRatio=v},8969:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;const l=i(844),u=i(2585),o=i(4348),p=i(7866),_=i(744),C=i(7302),g=i(6975),n=i(8460),d=i(1753),c=i(1480),h=i(7994),v=i(9282),b=i(5435),w=i(5981),k=i(2660);let S=!1;class E extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new n.EventEmitter),this._onScroll.event((L=>{var M;(M=this._onScrollApi)===null||M===void 0||M.fire(L.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(L){for(const M in L)this.optionsService.options[M]=L[M]}constructor(L){super(),this._windowsWrappingHeuristics=this.register(new l.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 C.OptionsService(L)),this._instantiationService.setService(u.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(u.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(u.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(g.CoreService)),this._instantiationService.setService(u.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(u.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(c.UnicodeService)),this._instantiationService.setService(u.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h.CharsetService),this._instantiationService.setService(u.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(k.OscLinkService),this._instantiationService.setService(u.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new b.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((M=>{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((M=>{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(((M,N)=>this._inputHandler.parse(M,N)))),this.register((0,n.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(L,M){this._writeBuffer.write(L,M)}writeSync(L,M){this._logService.logLevel<=u.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(L,M)}resize(L,M){isNaN(L)||isNaN(M)||(L=Math.max(L,_.MINIMUM_COLS),M=Math.max(M,_.MINIMUM_ROWS),this._bufferService.resize(L,M))}scroll(L,M=!1){this._bufferService.scroll(L,M)}scrollLines(L,M,N){this._bufferService.scrollLines(L,M,N)}scrollPages(L){this.scrollLines(L*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(L){const M=L-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(L,M){return this._inputHandler.registerEscHandler(L,M)}registerDcsHandler(L,M){return this._inputHandler.registerDcsHandler(L,M)}registerCsiHandler(L,M){return this._inputHandler.registerCsiHandler(L,M)}registerOscHandler(L,M){return this._inputHandler.registerOscHandler(L,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let L=!1;const M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?L=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(L=!0),L?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const L=[];L.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),L.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)((()=>{for(const M of L)M.dispose()}))}}}s.CoreTerminal=E},8460:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.forwardEvent=s.EventEmitter=void 0,s.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 l=0;l<this._listeners.length;l++)if(this._listeners[l]===i)return void this._listeners.splice(l,1)}}})),this._event}fire(i,l){const u=[];for(let o=0;o<this._listeners.length;o++)u.push(this._listeners[o]);for(let o=0;o<u.length;o++)u[o].call(void 0,i,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(i,l){return i((u=>l.fire(u)))}},5435:function(y,s,i){var l=this&&this.__decorate||function(z,D,j,P){var O,$=arguments.length,q=$<3?D:P===null?P=Object.getOwnPropertyDescriptor(D,j):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(z,D,j,P);else for(var X=z.length-1;X>=0;X--)(O=z[X])&&(q=($<3?O(q):$>3?O(D,j,q):O(D,j))||q);return $>3&&q&&Object.defineProperty(D,j,q),q},u=this&&this.__param||function(z,D){return function(j,P){D(j,P,z)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;const o=i(2584),p=i(7116),_=i(2015),C=i(844),g=i(482),n=i(8437),d=i(8460),c=i(643),h=i(511),v=i(3734),b=i(2585),w=i(6242),k=i(6351),S=i(5941),E={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function L(z,D){if(z>24)return D.setWinLines||!1;switch(z){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 M;(function(z){z[z.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",z[z.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(M||(s.WindowsOptionsReportType=M={}));let N=0;class I extends C.Disposable{getAttrData(){return this._curAttrData}constructor(D,j,P,O,$,q,X,G,se=new _.EscapeSequenceParser){super(),this._bufferService=D,this._charsetService=j,this._coreService=P,this._logService=O,this._optionsService=$,this._oscLinkService=q,this._coreMouseService=X,this._unicodeService=G,this._parser=se,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new g.StringToUtf32,this._utf8Decoder=new g.Utf8ToUtf32,this._workCell=new h.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=n.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=n.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((A=>this._activeBuffer=A.activeBuffer))),this._parser.setCsiHandlerFallback(((A,B)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(A),params:B.toArray()})})),this._parser.setEscHandlerFallback((A=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(A)})})),this._parser.setExecuteHandlerFallback((A=>{this._logService.debug("Unknown EXECUTE code: ",{code:A})})),this._parser.setOscHandlerFallback(((A,B,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:A,action:B,data:U})})),this._parser.setDcsHandlerFallback(((A,B,U)=>{B==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(A),action:B,payload:U})})),this._parser.setPrintHandler(((A,B,U)=>this.print(A,B,U))),this._parser.registerCsiHandler({final:"@"},(A=>this.insertChars(A))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(A=>this.scrollLeft(A))),this._parser.registerCsiHandler({final:"A"},(A=>this.cursorUp(A))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(A=>this.scrollRight(A))),this._parser.registerCsiHandler({final:"B"},(A=>this.cursorDown(A))),this._parser.registerCsiHandler({final:"C"},(A=>this.cursorForward(A))),this._parser.registerCsiHandler({final:"D"},(A=>this.cursorBackward(A))),this._parser.registerCsiHandler({final:"E"},(A=>this.cursorNextLine(A))),this._parser.registerCsiHandler({final:"F"},(A=>this.cursorPrecedingLine(A))),this._parser.registerCsiHandler({final:"G"},(A=>this.cursorCharAbsolute(A))),this._parser.registerCsiHandler({final:"H"},(A=>this.cursorPosition(A))),this._parser.registerCsiHandler({final:"I"},(A=>this.cursorForwardTab(A))),this._parser.registerCsiHandler({final:"J"},(A=>this.eraseInDisplay(A,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(A=>this.eraseInDisplay(A,!0))),this._parser.registerCsiHandler({final:"K"},(A=>this.eraseInLine(A,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(A=>this.eraseInLine(A,!0))),this._parser.registerCsiHandler({final:"L"},(A=>this.insertLines(A))),this._parser.registerCsiHandler({final:"M"},(A=>this.deleteLines(A))),this._parser.registerCsiHandler({final:"P"},(A=>this.deleteChars(A))),this._parser.registerCsiHandler({final:"S"},(A=>this.scrollUp(A))),this._parser.registerCsiHandler({final:"T"},(A=>this.scrollDown(A))),this._parser.registerCsiHandler({final:"X"},(A=>this.eraseChars(A))),this._parser.registerCsiHandler({final:"Z"},(A=>this.cursorBackwardTab(A))),this._parser.registerCsiHandler({final:"`"},(A=>this.charPosAbsolute(A))),this._parser.registerCsiHandler({final:"a"},(A=>this.hPositionRelative(A))),this._parser.registerCsiHandler({final:"b"},(A=>this.repeatPrecedingCharacter(A))),this._parser.registerCsiHandler({final:"c"},(A=>this.sendDeviceAttributesPrimary(A))),this._parser.registerCsiHandler({prefix:">",final:"c"},(A=>this.sendDeviceAttributesSecondary(A))),this._parser.registerCsiHandler({final:"d"},(A=>this.linePosAbsolute(A))),this._parser.registerCsiHandler({final:"e"},(A=>this.vPositionRelative(A))),this._parser.registerCsiHandler({final:"f"},(A=>this.hVPosition(A))),this._parser.registerCsiHandler({final:"g"},(A=>this.tabClear(A))),this._parser.registerCsiHandler({final:"h"},(A=>this.setMode(A))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(A=>this.setModePrivate(A))),this._parser.registerCsiHandler({final:"l"},(A=>this.resetMode(A))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(A=>this.resetModePrivate(A))),this._parser.registerCsiHandler({final:"m"},(A=>this.charAttributes(A))),this._parser.registerCsiHandler({final:"n"},(A=>this.deviceStatus(A))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(A=>this.deviceStatusPrivate(A))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(A=>this.softReset(A))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(A=>this.setCursorStyle(A))),this._parser.registerCsiHandler({final:"r"},(A=>this.setScrollRegion(A))),this._parser.registerCsiHandler({final:"s"},(A=>this.saveCursor(A))),this._parser.registerCsiHandler({final:"t"},(A=>this.windowOptions(A))),this._parser.registerCsiHandler({final:"u"},(A=>this.restoreCursor(A))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(A=>this.insertColumns(A))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(A=>this.deleteColumns(A))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(A=>this.selectProtected(A))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(A=>this.requestMode(A,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(A=>this.requestMode(A,!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((A=>(this.setTitle(A),this.setIconName(A),!0)))),this._parser.registerOscHandler(1,new w.OscHandler((A=>this.setIconName(A)))),this._parser.registerOscHandler(2,new w.OscHandler((A=>this.setTitle(A)))),this._parser.registerOscHandler(4,new w.OscHandler((A=>this.setOrReportIndexedColor(A)))),this._parser.registerOscHandler(8,new w.OscHandler((A=>this.setHyperlink(A)))),this._parser.registerOscHandler(10,new w.OscHandler((A=>this.setOrReportFgColor(A)))),this._parser.registerOscHandler(11,new w.OscHandler((A=>this.setOrReportBgColor(A)))),this._parser.registerOscHandler(12,new w.OscHandler((A=>this.setOrReportCursorColor(A)))),this._parser.registerOscHandler(104,new w.OscHandler((A=>this.restoreIndexedColor(A)))),this._parser.registerOscHandler(110,new w.OscHandler((A=>this.restoreFgColor(A)))),this._parser.registerOscHandler(111,new w.OscHandler((A=>this.restoreBgColor(A)))),this._parser.registerOscHandler(112,new w.OscHandler((A=>this.restoreCursorColor(A)))),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 A in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:A},(()=>this.selectCharset("("+A))),this._parser.registerEscHandler({intermediates:")",final:A},(()=>this.selectCharset(")"+A))),this._parser.registerEscHandler({intermediates:"*",final:A},(()=>this.selectCharset("*"+A))),this._parser.registerEscHandler({intermediates:"+",final:A},(()=>this.selectCharset("+"+A))),this._parser.registerEscHandler({intermediates:"-",final:A},(()=>this.selectCharset("-"+A))),this._parser.registerEscHandler({intermediates:".",final:A},(()=>this.selectCharset("."+A))),this._parser.registerEscHandler({intermediates:"/",final:A},(()=>this.selectCharset("/"+A)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((A=>(this._logService.error("Parsing error: ",A),A))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((A,B)=>this.requestStatusString(A,B))))}_preserveStack(D,j,P,O){this._parseStack.paused=!0,this._parseStack.cursorStartX=D,this._parseStack.cursorStartY=j,this._parseStack.decodedLength=P,this._parseStack.position=O}_logSlowResolvingAsync(D){this._logService.logLevel<=b.LogLevelEnum.WARN&&Promise.race([D,new Promise(((j,P)=>setTimeout((()=>P("#SLOW_TIMEOUT")),5e3)))]).catch((j=>{if(j!=="#SLOW_TIMEOUT")throw j;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(D,j){let P,O=this._activeBuffer.x,$=this._activeBuffer.y,q=0;const X=this._parseStack.paused;if(X){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,j))return this._logSlowResolvingAsync(P),P;O=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,D.length>T&&(q=this._parseStack.position+T)}if(this._logService.logLevel<=b.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof D=="string"?` "${D}"`:` "${Array.prototype.map.call(D,(G=>String.fromCharCode(G))).join("")}"`),typeof D=="string"?D.split("").map((G=>G.charCodeAt(0))):D),this._parseBuffer.length<D.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(D.length,T))),X||this._dirtyRowTracker.clearRange(),D.length>T)for(let G=q;G<D.length;G+=T){const se=G+T<D.length?G+T:D.length,A=typeof D=="string"?this._stringDecoder.decode(D.substring(G,se),this._parseBuffer):this._utf8Decoder.decode(D.subarray(G,se),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,A))return this._preserveStack(O,$,A,G),this._logSlowResolvingAsync(P),P}else if(!X){const G=typeof D=="string"?this._stringDecoder.decode(D,this._parseBuffer):this._utf8Decoder.decode(D,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,G))return this._preserveStack(O,$,G,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===O&&this._activeBuffer.y===$||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(D,j,P){let O,$;const q=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,G=this._bufferService.cols,se=this._coreService.decPrivateModes.wraparound,A=this._coreService.modes.insertMode,B=this._curAttrData;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-j>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodePoint(this._activeBuffer.x-1,0,1,B.fg,B.bg,B.extended);for(let W=j;W<P;++W){if(O=D[W],$=this._unicodeService.wcwidth(O),O<127&&q){const J=q[String.fromCharCode(O)];J&&(O=J.charCodeAt(0))}if(X&&this._onA11yChar.fire((0,g.stringFromCodePoint)(O)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),$||!this._activeBuffer.x){if(this._activeBuffer.x+$-1>=G){if(se){for(;this._activeBuffer.x<G;)U.setCellFromCodePoint(this._activeBuffer.x++,0,1,B.fg,B.bg,B.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=G-1,$===2)continue}if(A&&(U.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(B),B),U.getWidth(G-1)===2&&U.setCellFromCodePoint(G-1,c.NULL_CELL_CODE,c.NULL_CELL_WIDTH,B.fg,B.bg,B.extended)),U.setCellFromCodePoint(this._activeBuffer.x++,O,$,B.fg,B.bg,B.extended),$>0)for(;--$;)U.setCellFromCodePoint(this._activeBuffer.x++,0,0,B.fg,B.bg,B.extended)}else U.getWidth(this._activeBuffer.x-1)?U.addCodepointToCell(this._activeBuffer.x-1,O):U.addCodepointToCell(this._activeBuffer.x-2,O)}P-j>0&&(U.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<G&&P-j>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodePoint(this._activeBuffer.x,0,1,B.fg,B.bg,B.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(D,j){return D.final!=="t"||D.prefix||D.intermediates?this._parser.registerCsiHandler(D,j):this._parser.registerCsiHandler(D,(P=>!L(P.params[0],this._optionsService.rawOptions.windowOptions)||j(P)))}registerDcsHandler(D,j){return this._parser.registerDcsHandler(D,new k.DcsHandler(j))}registerEscHandler(D,j){return this._parser.registerEscHandler(D,j)}registerOscHandler(D,j){return this._parser.registerOscHandler(D,new w.OscHandler(j))}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 j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);j.hasWidth(this._activeBuffer.x)&&!j.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,j){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=D,this._activeBuffer.y=this._activeBuffer.scrollTop+j):(this._activeBuffer.x=D,this._activeBuffer.y=j),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(D,j){this._restrictCursor(),this._setCursor(this._activeBuffer.x+D,this._activeBuffer.y+j)}cursorUp(D){const j=this._activeBuffer.y-this._activeBuffer.scrollTop;return j>=0?this._moveCursor(0,-Math.min(j,D.params[0]||1)):this._moveCursor(0,-(D.params[0]||1)),!0}cursorDown(D){const j=this._activeBuffer.scrollBottom-this._activeBuffer.y;return j>=0?this._moveCursor(0,Math.min(j,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 j=D.params[0];return j===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:j===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=D.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=D.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(D){const j=D.params[0];return j===1&&(this._curAttrData.bg|=536870912),j!==2&&j!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(D,j,P,O=!1,$=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);q.replaceCells(j,P,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),$),O&&(q.isWrapped=!1)}_resetBufferLine(D,j=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),j),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+D),P.isWrapped=!1)}eraseInDisplay(D,j=!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,j);P<this._bufferService.rows;P++)this._resetBufferLine(P,j);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,j),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,j);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,j);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,j=!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,j);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,j);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,j)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(D){this._restrictCursor();let j=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,$=this._bufferService.rows-1+this._activeBuffer.ybase-O+1;for(;j--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(D){this._restrictCursor();let j=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;j--;)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 j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.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 j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.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 j=D.params[0]||1;for(;j--;)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 j=D.params[0]||1;for(;j--;)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 j=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,j,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 j=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,j,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 j=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,j,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 j=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,j,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 j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.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 j=D.params[0]||1,P=new Uint32Array(j);for(let O=0;O<j;++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 j=0;j<D.length;j++)switch(D.params[j]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(D){for(let j=0;j<D.length;j++)switch(D.params[j]){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 j=0;j<D.length;j++)switch(D.params[j]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(D){for(let j=0;j<D.length;j++)switch(D.params[j]){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[j]===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,j){const P=this._coreService.decPrivateModes,{activeProtocol:O,activeEncoding:$}=this._coreMouseService,q=this._coreService,{buffers:X,cols:G}=this._bufferService,{active:se,alt:A}=X,B=this._optionsService.rawOptions,U=ie=>ie?1:2,W=D.params[0];return J=W,Y=j?W===2?4:W===4?U(q.modes.insertMode):W===12?3:W===20?U(B.convertEol):0:W===1?U(P.applicationCursorKeys):W===3?B.windowOptions.setWinLines?G===80?2:G===132?1:0:0:W===6?U(P.origin):W===7?U(P.wraparound):W===8?3:W===9?U(O==="X10"):W===12?U(B.cursorBlink):W===25?U(!q.isCursorHidden):W===45?U(P.reverseWraparound):W===66?U(P.applicationKeypad):W===67?4:W===1e3?U(O==="VT200"):W===1002?U(O==="DRAG"):W===1003?U(O==="ANY"):W===1004?U(P.sendFocus):W===1005?4:W===1006?U($==="SGR"):W===1015?4:W===1016?U($==="SGR_PIXELS"):W===1048?1:W===47||W===1047||W===1049?U(se===A):W===2004?U(P.bracketedPasteMode):0,q.triggerDataEvent(`${o.C0.ESC}[${j?"":"?"}${J};${Y}$y`),!0;var J,Y}_updateAttrColor(D,j,P,O,$){return j===2?(D|=50331648,D&=-16777216,D|=v.AttributeData.fromColorRGB([P,O,$])):j===5&&(D&=-50331904,D|=33554432|255&P),D}_extractColor(D,j,P){const O=[0,0,-1,0,0,0];let $=0,q=0;do{if(O[q+$]=D.params[j+q],D.hasSubParams(j+q)){const X=D.getSubParams(j+q);let G=0;do O[1]===5&&($=1),O[q+G+1+$]=X[G];while(++G<X.length&&G+q+1+$<O.length);break}if(O[1]===5&&q+$>=2||O[1]===2&&q+$>=5)break;O[1]&&($=1)}while(++q+j<D.length&&q+$<O.length);for(let X=2;X<O.length;++X)O[X]===-1&&(O[X]=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 q}_processUnderline(D,j){j.extended=j.extended.clone(),(!~D||D>5)&&(D=1),j.extended.underlineStyle=D,j.fg|=268435456,D===0&&(j.fg&=-268435457),j.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 j=D.length;let P;const O=this._curAttrData;for(let $=0;$<j;$++)P=D.params[$],P>=30&&P<=37?(O.fg&=-50331904,O.fg|=16777216|P-30):P>=40&&P<=47?(O.bg&=-50331904,O.bg|=16777216|P-40):P>=90&&P<=97?(O.fg&=-50331904,O.fg|=16777224|P-90):P>=100&&P<=107?(O.bg&=-50331904,O.bg|=16777224|P-100):P===0?this._processSGR0(O):P===1?O.fg|=134217728:P===3?O.bg|=67108864:P===4?(O.fg|=268435456,this._processUnderline(D.hasSubParams($)?D.getSubParams($)[0]:1,O)):P===5?O.fg|=536870912:P===7?O.fg|=67108864:P===8?O.fg|=1073741824:P===9?O.fg|=2147483648:P===2?O.bg|=134217728:P===21?this._processUnderline(2,O):P===22?(O.fg&=-134217729,O.bg&=-134217729):P===23?O.bg&=-67108865:P===24?(O.fg&=-268435457,this._processUnderline(0,O)):P===25?O.fg&=-536870913:P===27?O.fg&=-67108865:P===28?O.fg&=-1073741825:P===29?O.fg&=2147483647:P===39?(O.fg&=-67108864,O.fg|=16777215&n.DEFAULT_ATTR_DATA.fg):P===49?(O.bg&=-67108864,O.bg|=16777215&n.DEFAULT_ATTR_DATA.bg):P===38||P===48||P===58?$+=this._extractColor(D,$,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 j=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${j};${P}R`)}return!0}deviceStatusPrivate(D){if(D.params[0]===6){const j=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${j};${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 j=D.params[0]||1;switch(j){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=j%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(D){const j=D.params[0]||1;let P;return(D.length<2||(P=D.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>j&&(this._activeBuffer.scrollTop=j-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(D){if(!L(D.params[0],this._optionsService.rawOptions.windowOptions))return!0;const j=D.length>1?D.params[1]:0;switch(D.params[0]){case 14:j!==2&&this._onRequestWindowsOptionsReport.fire(M.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(M.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:j!==0&&j!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),j!==0&&j!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:j!==0&&j!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),j!==0&&j!==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 j=[],P=D.split(";");for(;P.length>1;){const O=P.shift(),$=P.shift();if(/^\d+$/.exec(O)){const q=parseInt(O);if(H(q))if($==="?")j.push({type:0,index:q});else{const X=(0,S.parseColor)($);X&&j.push({type:1,index:q,color:X})}}}return j.length&&this._onColor.fire(j),!0}setHyperlink(D){const j=D.split(";");return!(j.length<2)&&(j[1]?this._createHyperlink(j[0],j[1]):!j[0]&&this._finishHyperlink())}_createHyperlink(D,j){this._getCurrentLinkId()&&this._finishHyperlink();const P=D.split(":");let O;const $=P.findIndex((q=>q.startsWith("id=")));return $!==-1&&(O=P[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:O,uri:j}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(D,j){const P=D.split(";");for(let O=0;O<P.length&&!(j>=this._specialColors.length);++O,++j)if(P[O]==="?")this._onColor.fire([{type:0,index:this._specialColors[j]}]);else{const $=(0,S.parseColor)(P[O]);$&&this._onColor.fire([{type:1,index:this._specialColors[j],color:$}])}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 j=[],P=D.split(";");for(let O=0;O<P.length;++O)if(/^\d+$/.exec(P[O])){const $=parseInt(P[O]);H($)&&j.push({type:2,index:$})}return j.length&&this._onColor.fire(j),!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 h.CellData;D.content=4194373,D.fg=this._curAttrData.fg,D.bg=this._curAttrData.bg,this._setCursor(0,0);for(let j=0;j<this._bufferService.rows;++j){const P=this._activeBuffer.ybase+this._activeBuffer.y+j,O=this._activeBuffer.lines.get(P);O&&(O.fill(D),O.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(D,j){const P=this._bufferService.buffer,O=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${$}${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,j){this._dirtyRowTracker.markRangeDirty(D,j)}}s.InputHandler=I;let F=class{constructor(z){this._bufferService=z,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(z){z<this.start?this.start=z:z>this.end&&(this.end=z)}markRangeDirty(z,D){z>D&&(N=z,z=D,D=N),z<this.start&&(this.start=z),D>this.end&&(this.end=D)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(z){return 0<=z&&z<256}F=l([u(0,b.IBufferService)],F)},844:(y,s)=>{function i(l){for(const u of l)u.dispose();l.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const u=this._disposables.indexOf(l);u!==-1&&this._disposables.splice(u,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var u;this._isDisposed||l===this._value||((u=this._value)===null||u===void 0||u.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)===null||l===void 0||l.dispose(),this._value=void 0}},s.toDisposable=function(l){return{dispose:l}},s.disposeArray=i,s.getDisposeArrayDisposable=function(l){return{dispose:()=>i(l)}}},1505:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class i{constructor(){this._data={}}set(u,o,p){this._data[u]||(this._data[u]={}),this._data[u][o]=p}get(u,o){return this._data[u]?this._data[u][o]:void 0}clear(){this._data={}}}s.TwoKeyMap=i,s.FourKeyMap=class{constructor(){this._data=new i}set(l,u,o,p,_){this._data.get(l,u)||this._data.set(l,u,new i),this._data.get(l,u).set(o,p,_)}get(l,u,o,p){var _;return(_=this._data.get(l,u))===null||_===void 0?void 0:_.get(o,p)}clear(){this._data.clear()}}},6114:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof navigator>"u";const i=s.isNode?"node":navigator.userAgent,l=s.isNode?"node":navigator.platform;s.isFirefox=i.includes("Firefox"),s.isLegacyEdge=i.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(i),s.getSafariVersion=function(){if(!s.isSafari)return 0;const u=i.match(/Version\/(\d+)/);return u===null||u.length<2?0:parseInt(u[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),s.isIpad=l==="iPad",s.isIphone=l==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),s.isLinux=l.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(i)},6106:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let i=0;s.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(i=this._search(this._getKey(l)),this._array.splice(i,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const u=this._getKey(l);if(u===void 0||(i=this._search(u),i===-1)||this._getKey(this._array[i])!==u)return!1;do if(this._array[i]===l)return this._array.splice(i,1),!0;while(++i<this._array.length&&this._getKey(this._array[i])===u);return!1}*getKeyIterator(l){if(this._array.length!==0&&(i=this._search(l),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===l))do yield this._array[i];while(++i<this._array.length&&this._getKey(this._array[i])===l)}forEachByKey(l,u){if(this._array.length!==0&&(i=this._search(l),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===l))do u(this._array[i]);while(++i<this._array.length&&this._getKey(this._array[i])===l)}values(){return[...this._array].values()}_search(l){let u=0,o=this._array.length-1;for(;o>=u;){let p=u+o>>1;const _=this._getKey(this._array[p]);if(_>l)o=p-1;else{if(!(_<l)){for(;p>0&&this._getKey(this._array[p-1])===l;)p--;return p}u=p+1}}return u}}},7226:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const l=i(6114);class u{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 C=0,g=0,n=_.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),g=Math.max(C,g),d=_.timeRemaining(),1.5*g>d)return n-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-C))}ms`),void this._start();n=d}this.clear()}}class o extends u{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const C=Date.now()+_;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}s.PriorityTaskQueue=o,s.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends u{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:o,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;const l=i(643);s.updateWindowsModeWrappedState=function(u){const o=u.buffer.lines.get(u.buffer.ybase+u.buffer.y-1),p=o?.get(u.cols-1),_=u.buffer.lines.get(u.buffer.ybase+u.buffer.y);_&&p&&(_.isWrapped=p[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&p[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class i{constructor(){this.fg=0,this.bg=0,this.extended=new l}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}}s.AttributeData=i;class l{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 l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=l},9092:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;const l=i(6349),u=i(7226),o=i(3734),p=i(8437),_=i(4634),C=i(511),g=i(643),n=i(4863),d=i(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(c,h,v){this._hasScrollback=c,this._optionsService=h,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=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=C.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=C.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new u.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(c){return c?(this._nullCell.fg=c.fg,this._nullCell.bg=c.bg,this._nullCell.extended=c.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(c){return c?(this._whitespaceCell.fg=c.fg,this._whitespaceCell.bg=c.bg,this._whitespaceCell.extended=c.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(c,h){return new p.BufferLine(this._bufferService.cols,this.getNullCell(c),h)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const c=this.ybase+this.y-this.ydisp;return c>=0&&c<this._rows}_getCorrectBufferLength(c){if(!this._hasScrollback)return c;const h=c+this._optionsService.rawOptions.scrollback;return h>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:h}fillViewportRows(c){if(this.lines.length===0){c===void 0&&(c=p.DEFAULT_ATTR_DATA);let h=this._rows;for(;h--;)this.lines.push(this.getBlankLine(c))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(c,h){const v=this.getNullCell(p.DEFAULT_ATTR_DATA);let b=0;const w=this._getCorrectBufferLength(h);if(w>this.lines.maxLength&&(this.lines.maxLength=w),this.lines.length>0){if(this._cols<c)for(let S=0;S<this.lines.length;S++)b+=+this.lines.get(S).resize(c,v);let k=0;if(this._rows<h)for(let S=this._rows;S<h;S++)this.lines.length<h+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(c,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(c,v)));else for(let S=this._rows;S>h;S--)this.lines.length>h+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,c-1),this.y=Math.min(this.y,h-1),k&&(this.y+=k),this.savedX=Math.min(this.savedX,c-1),this.scrollTop=0}if(this.scrollBottom=h-1,this._isReflowEnabled&&(this._reflow(c,h),this._cols>c))for(let k=0;k<this.lines.length;k++)b+=+this.lines.get(k).resize(c,v);this._cols=c,this._rows=h,this._memoryCleanupQueue.clear(),b>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let c=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,c=!1);let h=0;for(;this._memoryCleanupPosition<this.lines.length;)if(h+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),h>100)return!0;return c}get _isReflowEnabled(){const c=this._optionsService.rawOptions.windowsPty;return c&&c.buildNumber?this._hasScrollback&&c.backend==="conpty"&&c.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(c,h){this._cols!==c&&(c>this._cols?this._reflowLarger(c,h):this._reflowSmaller(c,h))}_reflowLarger(c,h){const v=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,c,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(v.length>0){const b=(0,_.reflowLargerCreateNewLayout)(this.lines,v);(0,_.reflowLargerApplyNewLayout)(this.lines,b.layout),this._reflowLargerAdjustViewport(c,h,b.countRemoved)}}_reflowLargerAdjustViewport(c,h,v){const b=this.getNullCell(p.DEFAULT_ATTR_DATA);let w=v;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<h&&this.lines.push(new p.BufferLine(c,b))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(c,h){const v=this.getNullCell(p.DEFAULT_ATTR_DATA),b=[];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()<=c)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 L=E[E.length-1].getTrimmedLength(),M=(0,_.reflowSmallerGetNewLineLengths)(E,this._cols,c),N=M.length-E.length;let I;I=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 F=[];for(let O=0;O<N;O++){const $=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);F.push($)}F.length>0&&(b.push({start:k+E.length+w,newLines:F}),w+=F.length),E.push(...F);let H=M.length-1,z=M[H];z===0&&(H--,z=M[H]);let D=E.length-N-1,j=L;for(;D>=0;){const O=Math.min(j,z);if(E[H]===void 0)break;if(E[H].copyCellsFrom(E[D],j-O,z-O,O,!0),z-=O,z===0&&(H--,z=M[H]),j-=O,j===0){D--;const $=Math.max(D,0);j=(0,_.getWrappedLineTrimmedLength)(E,$,this._cols)}}for(let O=0;O<E.length;O++)M[O]<c&&E[O].setCell(M[O],v);let P=N-I;for(;P-- >0;)this.ybase===0?this.y<h-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+w)-h&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+N,this.ybase+h-1)}if(b.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,L=0,M=b[L];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(M&&M.start>T+N){for(let z=M.newLines.length-1;z>=0;z--)this.lines.set(H--,M.newLines[z]);H++,k.push({index:T+1,amount:M.newLines.length}),N+=M.newLines.length,M=b[++L]}else this.lines.set(H,S[T--]);let I=0;for(let H=k.length-1;H>=0;H--)k[H].index+=I,this.lines.onInsertEmitter.fire(k[H]),I+=k[H].amount;const F=Math.max(0,E+w-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(c,h,v=0,b){const w=this.lines.get(c);return w?w.translateToString(h,v,b):""}getWrappedRangeForLine(c){let h=c,v=c;for(;h>0&&this.lines.get(h).isWrapped;)h--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:h,last:v}}setupTabStops(c){for(c!=null?this.tabs[c]||(c=this.prevStop(c)):(this.tabs={},c=0);c<this._cols;c+=this._optionsService.rawOptions.tabStopWidth)this.tabs[c]=!0}prevStop(c){for(c==null&&(c=this.x);!this.tabs[--c]&&c>0;);return c>=this._cols?this._cols-1:c<0?0:c}nextStop(c){for(c==null&&(c=this.x);!this.tabs[++c]&&c<this._cols;);return c>=this._cols?this._cols-1:c<0?0:c}clearMarkers(c){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].line===c&&(this.markers[h].dispose(),this.markers.splice(h--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let c=0;c<this.markers.length;c++)this.markers[c].dispose(),this.markers.splice(c--,1);this._isClearing=!1}addMarker(c){const h=new n.Marker(c);return this.markers.push(h),h.register(this.lines.onTrim((v=>{h.line-=v,h.line<0&&h.dispose()}))),h.register(this.lines.onInsert((v=>{h.line>=v.index&&(h.line+=v.amount)}))),h.register(this.lines.onDelete((v=>{h.line>=v.index&&h.line<v.index+v.amount&&h.dispose(),h.line>v.index&&(h.line-=v.amount)}))),h.register(h.onDispose((()=>this._removeMarker(h)))),h}_removeMarker(c){this._isClearing||this.markers.splice(this.markers.indexOf(c),1)}}},8437:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;const l=i(3734),u=i(511),o=i(643),p=i(482);s.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let _=0;class C{constructor(n,d,c=!1){this.isWrapped=c,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*n);const h=d||u.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,h);this.length=n}get(n){const d=this._data[3*n+0],c=2097151&d;return[this._data[3*n+1],2097152&d?this._combined[n]:c?(0,p.stringFromCodePoint)(c):"",d>>22,2097152&d?this._combined[n].charCodeAt(this._combined[n].length-1):c]}set(n,d){this._data[3*n+1]=d[o.CHAR_DATA_ATTR_INDEX],d[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[n]=d[1],this._data[3*n+0]=2097152|n|d[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*n+0]=d[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(n){return this._data[3*n+0]>>22}hasWidth(n){return 12582912&this._data[3*n+0]}getFg(n){return this._data[3*n+1]}getBg(n){return this._data[3*n+2]}hasContent(n){return 4194303&this._data[3*n+0]}getCodePoint(n){const d=this._data[3*n+0];return 2097152&d?this._combined[n].charCodeAt(this._combined[n].length-1):2097151&d}isCombined(n){return 2097152&this._data[3*n+0]}getString(n){const d=this._data[3*n+0];return 2097152&d?this._combined[n]:2097151&d?(0,p.stringFromCodePoint)(2097151&d):""}isProtected(n){return 536870912&this._data[3*n+2]}loadCell(n,d){return _=3*n,d.content=this._data[_+0],d.fg=this._data[_+1],d.bg=this._data[_+2],2097152&d.content&&(d.combinedData=this._combined[n]),268435456&d.bg&&(d.extended=this._extendedAttrs[n]),d}setCell(n,d){2097152&d.content&&(this._combined[n]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[n]=d.extended),this._data[3*n+0]=d.content,this._data[3*n+1]=d.fg,this._data[3*n+2]=d.bg}setCellFromCodePoint(n,d,c,h,v,b){268435456&v&&(this._extendedAttrs[n]=b),this._data[3*n+0]=d|c<<22,this._data[3*n+1]=h,this._data[3*n+2]=v}addCodepointToCell(n,d){let c=this._data[3*n+0];2097152&c?this._combined[n]+=(0,p.stringFromCodePoint)(d):(2097151&c?(this._combined[n]=(0,p.stringFromCodePoint)(2097151&c)+(0,p.stringFromCodePoint)(d),c&=-2097152,c|=2097152):c=d|4194304,this._data[3*n+0]=c)}insertCells(n,d,c,h){if((n%=this.length)&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new l.ExtendedAttrs),d<this.length-n){const v=new u.CellData;for(let b=this.length-n-d-1;b>=0;--b)this.setCell(n+d+b,this.loadCell(n+b,v));for(let b=0;b<d;++b)this.setCell(n+b,c)}else for(let v=n;v<this.length;++v)this.setCell(v,c);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new l.ExtendedAttrs)}deleteCells(n,d,c,h){if(n%=this.length,d<this.length-n){const v=new u.CellData;for(let b=0;b<this.length-n-d;++b)this.setCell(n+b,this.loadCell(n+d+b,v));for(let b=this.length-d;b<this.length;++b)this.setCell(b,c)}else for(let v=n;v<this.length;++v)this.setCell(v,c);n&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new l.ExtendedAttrs),this.getWidth(n)!==0||this.hasContent(n)||this.setCellFromCodePoint(n,0,1,h?.fg||0,h?.bg||0,h?.extended||new l.ExtendedAttrs)}replaceCells(n,d,c,h,v=!1){if(v)for(n&&this.getWidth(n-1)===2&&!this.isProtected(n-1)&&this.setCellFromCodePoint(n-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new l.ExtendedAttrs),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodePoint(d,0,1,h?.fg||0,h?.bg||0,h?.extended||new l.ExtendedAttrs);n<d&&n<this.length;)this.isProtected(n)||this.setCell(n,c),n++;else for(n&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new l.ExtendedAttrs),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodePoint(d,0,1,h?.fg||0,h?.bg||0,h?.extended||new l.ExtendedAttrs);n<d&&n<this.length;)this.setCell(n++,c)}resize(n,d){if(n===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const c=3*n;if(n>this.length){if(this._data.buffer.byteLength>=4*c)this._data=new Uint32Array(this._data.buffer,0,c);else{const h=new Uint32Array(c);h.set(this._data),this._data=h}for(let h=this.length;h<n;++h)this.setCell(h,d)}else{this._data=this._data.subarray(0,c);const h=Object.keys(this._combined);for(let b=0;b<h.length;b++){const w=parseInt(h[b],10);w>=n&&delete this._combined[w]}const v=Object.keys(this._extendedAttrs);for(let b=0;b<v.length;b++){const w=parseInt(v[b],10);w>=n&&delete this._extendedAttrs[w]}}return this.length=n,4*c*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const n=new Uint32Array(this._data.length);return n.set(this._data),this._data=n,1}return 0}fill(n,d=!1){if(d)for(let c=0;c<this.length;++c)this.isProtected(c)||this.setCell(c,n);else{this._combined={},this._extendedAttrs={};for(let c=0;c<this.length;++c)this.setCell(c,n)}}copyFrom(n){this.length!==n.length?this._data=new Uint32Array(n._data):this._data.set(n._data),this.length=n.length,this._combined={};for(const d in n._combined)this._combined[d]=n._combined[d];this._extendedAttrs={};for(const d in n._extendedAttrs)this._extendedAttrs[d]=n._extendedAttrs[d];this.isWrapped=n.isWrapped}clone(){const n=new C(0);n._data=new Uint32Array(this._data),n.length=this.length;for(const d in this._combined)n._combined[d]=this._combined[d];for(const d in this._extendedAttrs)n._extendedAttrs[d]=this._extendedAttrs[d];return n.isWrapped=this.isWrapped,n}getTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0])return n+(this._data[3*n+0]>>22);return 0}getNoBgTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0]||50331648&this._data[3*n+2])return n+(this._data[3*n+0]>>22);return 0}copyCellsFrom(n,d,c,h,v){const b=n._data;if(v)for(let k=h-1;k>=0;k--){for(let S=0;S<3;S++)this._data[3*(c+k)+S]=b[3*(d+k)+S];268435456&b[3*(d+k)+2]&&(this._extendedAttrs[c+k]=n._extendedAttrs[d+k])}else for(let k=0;k<h;k++){for(let S=0;S<3;S++)this._data[3*(c+k)+S]=b[3*(d+k)+S];268435456&b[3*(d+k)+2]&&(this._extendedAttrs[c+k]=n._extendedAttrs[d+k])}const w=Object.keys(n._combined);for(let k=0;k<w.length;k++){const S=parseInt(w[k],10);S>=d&&(this._combined[S-d+c]=n._combined[S])}}translateToString(n=!1,d=0,c=this.length){n&&(c=Math.min(c,this.getTrimmedLength()));let h="";for(;d<c;){const v=this._data[3*d+0],b=2097151&v;h+=2097152&v?this._combined[d]:b?(0,p.stringFromCodePoint)(b):o.WHITESPACE_CELL_CHAR,d+=v>>22||1}return h}}s.BufferLine=C},4841:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(i,l){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 l*(i.end.y-i.start.y)+(i.end.x-i.start.x+1)}},4634:(y,s)=>{function i(l,u,o){if(u===l.length-1)return l[u].getTrimmedLength();const p=!l[u].hasContent(o-1)&&l[u].getWidth(o-1)===1,_=l[u+1].getWidth(0)===2;return p&&_?o-1:o}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(l,u,o,p,_){const C=[];for(let g=0;g<l.length-1;g++){let n=g,d=l.get(++n);if(!d.isWrapped)continue;const c=[l.get(g)];for(;n<l.length&&d.isWrapped;)c.push(d),d=l.get(++n);if(p>=g&&p<n){g+=c.length-1;continue}let h=0,v=i(c,h,u),b=1,w=0;for(;b<c.length;){const S=i(c,b,u),E=S-w,T=o-v,L=Math.min(E,T);c[h].copyCellsFrom(c[b],w,v,L,!1),v+=L,v===o&&(h++,v=0),w+=L,w===S&&(b++,w=0),v===0&&h!==0&&c[h-1].getWidth(o-1)===2&&(c[h].copyCellsFrom(c[h-1],o-1,v++,1,!1),c[h-1].setCell(o-1,_))}c[h].replaceCells(v,o,_);let k=0;for(let S=c.length-1;S>0&&(S>h||c[S].getTrimmedLength()===0);S--)k++;k>0&&(C.push(g+c.length-k),C.push(k)),g+=c.length-1}return C},s.reflowLargerCreateNewLayout=function(l,u){const o=[];let p=0,_=u[p],C=0;for(let g=0;g<l.length;g++)if(_===g){const n=u[++p];l.onDeleteEmitter.fire({index:g-C,amount:n}),g+=n-1,C+=n,_=u[++p]}else o.push(g);return{layout:o,countRemoved:C}},s.reflowLargerApplyNewLayout=function(l,u){const o=[];for(let p=0;p<u.length;p++)o.push(l.get(u[p]));for(let p=0;p<o.length;p++)l.set(p,o[p]);l.length=u.length},s.reflowSmallerGetNewLineLengths=function(l,u,o){const p=[],_=l.map(((d,c)=>i(l,c,u))).reduce(((d,c)=>d+c));let C=0,g=0,n=0;for(;n<_;){if(_-n<o){p.push(_-n);break}C+=o;const d=i(l,g,u);C>d&&(C-=d,g++);const c=l[g].getWidth(C-1)===2;c&&C--;const h=c?o-1:o;p.push(h),n+=h}return p},s.getWrappedLineTrimmedLength=i},5295:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;const l=i(8460),u=i(844),o=i(9092);class p extends u.Disposable{constructor(C,g){super(),this._optionsService=C,this._bufferService=g,this._onBufferActivate=this.register(new l.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(C){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(C),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(C,g){this._normal.resize(C,g),this._alt.resize(C,g),this.setupTabStops(C)}setupTabStops(C){this._normal.setupTabStops(C),this._alt.setupTabStops(C)}}s.BufferSet=p},511:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const l=i(482),u=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(C){const g=new p;return g.setFromCharData(C),g}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(C){this.fg=C[u.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(C[u.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(C[u.CHAR_DATA_CHAR_INDEX].length===2){const n=C[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){const d=C[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(n-55296)+d-56320+65536|C[u.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=C[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[u.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=C[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[u.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=p},643:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;const l=i(8460),u=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 l.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,u.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}s.Marker=o,o._nextId=1},7116:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.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:"≥","{":"π","|":"≠","}":"£","~":"·"},s.CHARSETS.A={"#":"£"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},s.CHARSETS.C=s.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},s.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},s.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},s.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},s.CHARSETS.E=s.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},s.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},s.CHARSETS.H=s.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(y,s)=>{var i,l,u;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.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||(s.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=""})(l||(s.C1=l={})),(function(o){o.ST=`${i.ESC}\\`})(u||(s.C1_ESCAPED=u={}))},7399:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;const l=i(2584),u={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:["'",'"']};s.evaluateKeyboardEvent=function(o,p,_,C){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?l.C0.ESC+"OA":l.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?g.key=p?l.C0.ESC+"OD":l.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?g.key=p?l.C0.ESC+"OC":l.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(g.key=p?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:if(o.altKey){g.key=l.C0.ESC+l.C0.DEL;break}g.key=l.C0.DEL;break;case 9:if(o.shiftKey){g.key=l.C0.ESC+"[Z";break}g.key=l.C0.HT,g.cancel=!0;break;case 13:g.key=o.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,g.cancel=!0;break;case 27:g.key=l.C0.ESC,o.altKey&&(g.key=l.C0.ESC+l.C0.ESC),g.cancel=!0;break;case 37:if(o.metaKey)break;n?(g.key=l.C0.ESC+"[1;"+(n+1)+"D",g.key===l.C0.ESC+"[1;3D"&&(g.key=l.C0.ESC+(_?"b":"[1;5D"))):g.key=p?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(o.metaKey)break;n?(g.key=l.C0.ESC+"[1;"+(n+1)+"C",g.key===l.C0.ESC+"[1;3C"&&(g.key=l.C0.ESC+(_?"f":"[1;5C"))):g.key=p?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(o.metaKey)break;n?(g.key=l.C0.ESC+"[1;"+(n+1)+"A",_||g.key!==l.C0.ESC+"[1;3A"||(g.key=l.C0.ESC+"[1;5A")):g.key=p?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(o.metaKey)break;n?(g.key=l.C0.ESC+"[1;"+(n+1)+"B",_||g.key!==l.C0.ESC+"[1;3B"||(g.key=l.C0.ESC+"[1;5B")):g.key=p?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(g.key=l.C0.ESC+"[2~");break;case 46:g.key=n?l.C0.ESC+"[3;"+(n+1)+"~":l.C0.ESC+"[3~";break;case 36:g.key=n?l.C0.ESC+"[1;"+(n+1)+"H":p?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:g.key=n?l.C0.ESC+"[1;"+(n+1)+"F":p?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:o.shiftKey?g.type=2:o.ctrlKey?g.key=l.C0.ESC+"[5;"+(n+1)+"~":g.key=l.C0.ESC+"[5~";break;case 34:o.shiftKey?g.type=3:o.ctrlKey?g.key=l.C0.ESC+"[6;"+(n+1)+"~":g.key=l.C0.ESC+"[6~";break;case 112:g.key=n?l.C0.ESC+"[1;"+(n+1)+"P":l.C0.ESC+"OP";break;case 113:g.key=n?l.C0.ESC+"[1;"+(n+1)+"Q":l.C0.ESC+"OQ";break;case 114:g.key=n?l.C0.ESC+"[1;"+(n+1)+"R":l.C0.ESC+"OR";break;case 115:g.key=n?l.C0.ESC+"[1;"+(n+1)+"S":l.C0.ESC+"OS";break;case 116:g.key=n?l.C0.ESC+"[15;"+(n+1)+"~":l.C0.ESC+"[15~";break;case 117:g.key=n?l.C0.ESC+"[17;"+(n+1)+"~":l.C0.ESC+"[17~";break;case 118:g.key=n?l.C0.ESC+"[18;"+(n+1)+"~":l.C0.ESC+"[18~";break;case 119:g.key=n?l.C0.ESC+"[19;"+(n+1)+"~":l.C0.ESC+"[19~";break;case 120:g.key=n?l.C0.ESC+"[20;"+(n+1)+"~":l.C0.ESC+"[20~";break;case 121:g.key=n?l.C0.ESC+"[21;"+(n+1)+"~":l.C0.ESC+"[21~";break;case 122:g.key=n?l.C0.ESC+"[23;"+(n+1)+"~":l.C0.ESC+"[23~";break;case 123:g.key=n?l.C0.ESC+"[24;"+(n+1)+"~":l.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(_&&!C||!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=l.C0.US),o.key==="@"&&(g.key=l.C0.NUL)):o.keyCode===65&&(g.type=1);else{const d=u[o.keyCode],c=d?.[o.shiftKey?1:0];if(c)g.key=l.C0.ESC+c;else if(o.keyCode>=65&&o.keyCode<=90){const h=o.ctrlKey?o.keyCode-64:o.keyCode+32;let v=String.fromCharCode(h);o.shiftKey&&(v=v.toUpperCase()),g.key=l.C0.ESC+v}else if(o.keyCode===32)g.key=l.C0.ESC+(o.ctrlKey?l.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let h=o.code.slice(3,4);o.shiftKey||(h=h.toLowerCase()),g.key=l.C0.ESC+h,g.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?g.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?g.key=l.C0.NUL:o.keyCode>=51&&o.keyCode<=55?g.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?g.key=l.C0.DEL:o.keyCode===219?g.key=l.C0.ESC:o.keyCode===220?g.key=l.C0.FS:o.keyCode===221&&(g.key=l.C0.GS)}return g}},482:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(i){return i>65535?(i-=65536,String.fromCharCode(55296+(i>>10))+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)},s.utf32ToString=function(i,l=0,u=i.length){let o="";for(let p=l;p<u;++p){let _=i[p];_>65535?(_-=65536,o+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):o+=String.fromCharCode(_)}return o},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(i,l){const u=i.length;if(!u)return 0;let o=0,p=0;if(this._interim){const _=i.charCodeAt(p++);56320<=_&&_<=57343?l[o++]=1024*(this._interim-55296)+_-56320+65536:(l[o++]=this._interim,l[o++]=_),this._interim=0}for(let _=p;_<u;++_){const C=i.charCodeAt(_);if(55296<=C&&C<=56319){if(++_>=u)return this._interim=C,o;const g=i.charCodeAt(_);56320<=g&&g<=57343?l[o++]=1024*(C-55296)+g-56320+65536:(l[o++]=C,l[o++]=g)}else C!==65279&&(l[o++]=C)}return o}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(i,l){const u=i.length;if(!u)return 0;let o,p,_,C,g=0,n=0,d=0;if(this.interim[0]){let v=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let w,k=0;for(;(w=63&this.interim[++k])&&k<4;)b<<=6,b|=w;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=S-k;for(;d<E;){if(d>=u)return 0;if(w=i[d++],(192&w)!=128){d--,v=!0;break}this.interim[k++]=w,b<<=6,b|=63&w}v||(S===2?b<128?d--:l[g++]=b:S===3?b<2048||b>=55296&&b<=57343||b===65279||(l[g++]=b):b<65536||b>1114111||(l[g++]=b)),this.interim.fill(0)}const c=u-4;let h=d;for(;h<u;){for(;!(!(h<c)||128&(o=i[h])||128&(p=i[h+1])||128&(_=i[h+2])||128&(C=i[h+3]));)l[g++]=o,l[g++]=p,l[g++]=_,l[g++]=C,h+=4;if(o=i[h++],o<128)l[g++]=o;else if((224&o)==192){if(h>=u)return this.interim[0]=o,g;if(p=i[h++],(192&p)!=128){h--;continue}if(n=(31&o)<<6|63&p,n<128){h--;continue}l[g++]=n}else if((240&o)==224){if(h>=u)return this.interim[0]=o,g;if(p=i[h++],(192&p)!=128){h--;continue}if(h>=u)return this.interim[0]=o,this.interim[1]=p,g;if(_=i[h++],(192&_)!=128){h--;continue}if(n=(15&o)<<12|(63&p)<<6|63&_,n<2048||n>=55296&&n<=57343||n===65279)continue;l[g++]=n}else if((248&o)==240){if(h>=u)return this.interim[0]=o,g;if(p=i[h++],(192&p)!=128){h--;continue}if(h>=u)return this.interim[0]=o,this.interim[1]=p,g;if(_=i[h++],(192&_)!=128){h--;continue}if(h>=u)return this.interim[0]=o,this.interim[1]=p,this.interim[2]=_,g;if(C=i[h++],(192&C)!=128){h--;continue}if(n=(7&o)<<18|(63&p)<<12|(63&_)<<6|63&C,n<65536||n>1114111)continue;l[g++]=n}}return g}}},225:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.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]],l=[[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 u;s.UnicodeV6=class{constructor(){if(this.version="6",!u){u=new Uint8Array(65536),u.fill(1),u[0]=0,u.fill(0,1,32),u.fill(0,127,160),u.fill(2,4352,4448),u[9001]=2,u[9002]=2,u.fill(2,11904,42192),u[12351]=1,u.fill(2,44032,55204),u.fill(2,63744,64256),u.fill(2,65040,65050),u.fill(2,65072,65136),u.fill(2,65280,65377),u.fill(2,65504,65511);for(let o=0;o<i.length;++o)u.fill(0,i[o][0],i[o][1]+1)}}wcwidth(o){return o<32?0:o<127?1:o<65536?u[o]:(function(p,_){let C,g=0,n=_.length-1;if(p<_[0][0]||p>_[n][1])return!1;for(;n>=g;)if(C=g+n>>1,p>_[C][1])g=C+1;else{if(!(p<_[C][0]))return!0;n=C-1}return!1})(o,l)?0:o>=131072&&o<=196605||o>=196608&&o<=262141?2:1}}},5981:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;const l=i(8460),u=i(844);class o extends u.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 l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,C){if(C!==void 0&&this._syncCalls>C)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(_,C){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(C),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(C)}_innerWrite(_=0,C=!0){const g=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const n=this._writeBuffer[this._bufferOffset],d=this._action(n,C);if(d){const h=v=>Date.now()-g>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(g,v);return void d.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(h)}const c=this._callbacks[this._bufferOffset];if(c&&c(),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()}}s.WriteBuffer=o},5941:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.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})$/,l=/^[\da-f]+$/;function u(o,p){const _=o.toString(16),C=_.length<2?"0"+_:_;switch(p){case 4:return _[0];case 8:return C;case 12:return(C+C).slice(0,3);default:return C+C}}s.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 C=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/C*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/C*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/C*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),l.exec(p)&&[3,6,9,12].includes(p.length))){const _=p.length/3,C=[0,0,0];for(let g=0;g<3;++g){const n=parseInt(p.slice(_*g,_*g+_),16);C[g]=_===1?n<<4:_===2?n:_===3?n>>4:n>>8}return C}},s.toRgbString=function(o,p=16){const[_,C,g]=o;return`rgb:${u(_,p)}/${u(C,p)}/${u(g,p)}`}},5770:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;const l=i(482),u=i(8742),o=i(5770),p=[];s.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(C,g){this._handlers[C]===void 0&&(this._handlers[C]=[]);const n=this._handlers[C];return n.push(g),{dispose:()=>{const d=n.indexOf(g);d!==-1&&n.splice(d,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}reset(){if(this._active.length)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(C,g){if(this.reset(),this._ident=C,this._active=this._handlers[C]||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(C,g,n){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(C,g,n);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(C,g,n))}unhook(C,g=!0){if(this._active.length){let n=!1,d=this._active.length-1,c=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,n=g,c=this._stack.fallThrough,this._stack.paused=!1),!c&&n===!1){for(;d>=0&&(n=this._active[d].unhook(C),n!==!0);d--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,n;d--}for(;d>=0;d--)if(n=this._active[d].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,"UNHOOK",C);this._active=p,this._ident=0}};const _=new u.Params;_.addParam(0),s.DcsHandler=class{constructor(C){this._handler=C,this._data="",this._params=_,this._hitLimit=!1}hook(C){this._params=C.length>1||C.params[0]?C.clone():_,this._data="",this._hitLimit=!1}put(C,g,n){this._hitLimit||(this._data+=(0,l.utf32ToString)(C,g,n),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(C){let g=!1;if(this._hitLimit)g=!1;else if(C&&(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:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;const l=i(844),u=i(8742),o=i(6242),p=i(6351);class _{constructor(d){this.table=new Uint8Array(d)}setDefault(d,c){this.table.fill(d<<4|c)}add(d,c,h,v){this.table[c<<8|d]=h<<4|v}addMany(d,c,h,v){for(let b=0;b<d.length;b++)this.table[c<<8|d[b]]=h<<4|v}}s.TransitionTable=_;const C=160;s.VT500_TRANSITION_TABLE=(function(){const n=new _(4095),d=Array.apply(null,Array(256)).map(((k,S)=>S)),c=(k,S)=>d.slice(k,S),h=c(32,127),v=c(0,24);v.push(25),v.push.apply(v,c(28,32));const b=c(0,14);let w;for(w in n.setDefault(1,0),n.addMany(h,0,2,0),b)n.addMany([24,26,153,154],w,3,0),n.addMany(c(128,144),w,3,0),n.addMany(c(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(h,8,5,8),n.add(127,8,5,8),n.addMany([156,27,24,26,7],8,6,0),n.addMany(c(28,32),8,0,8),n.addMany([88,94,95],1,0,7),n.addMany(h,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(c(64,127),3,7,0),n.addMany(c(48,60),3,8,4),n.addMany([60,61,62,63],3,9,4),n.addMany(c(48,60),4,8,4),n.addMany(c(64,127),4,7,0),n.addMany([60,61,62,63],4,0,6),n.addMany(c(32,64),6,0,6),n.add(127,6,0,6),n.addMany(c(64,127),6,0,0),n.addMany(c(32,48),3,9,5),n.addMany(c(32,48),5,9,5),n.addMany(c(48,64),5,0,6),n.addMany(c(64,127),5,7,0),n.addMany(c(32,48),4,9,5),n.addMany(c(32,48),1,9,2),n.addMany(c(32,48),2,9,2),n.addMany(c(48,127),2,10,0),n.addMany(c(48,80),1,10,0),n.addMany(c(81,88),1,10,0),n.addMany([89,90,92],1,10,0),n.addMany(c(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(c(28,32),9,0,9),n.addMany(c(32,48),9,9,12),n.addMany(c(48,60),9,8,10),n.addMany([60,61,62,63],9,9,10),n.addMany(v,11,0,11),n.addMany(c(32,128),11,0,11),n.addMany(c(28,32),11,0,11),n.addMany(v,10,0,10),n.add(127,10,0,10),n.addMany(c(28,32),10,0,10),n.addMany(c(48,60),10,8,10),n.addMany([60,61,62,63],10,0,11),n.addMany(c(32,48),10,9,12),n.addMany(v,12,0,12),n.add(127,12,0,12),n.addMany(c(28,32),12,0,12),n.addMany(c(32,48),12,9,12),n.addMany(c(48,64),12,0,11),n.addMany(c(64,127),12,12,13),n.addMany(c(64,127),10,12,13),n.addMany(c(64,127),9,12,13),n.addMany(v,13,13,13),n.addMany(h,13,13,13),n.add(127,13,0,13),n.addMany([27,156,24,26],13,14,0),n.add(C,0,2,0),n.add(C,8,5,8),n.add(C,6,0,6),n.add(C,11,0,11),n.add(C,13,13,13),n})();class g extends l.Disposable{constructor(d=s.VT500_TRANSITION_TABLE){super(),this._transitions=d,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new u.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(c,h,v)=>{},this._executeHandlerFb=c=>{},this._csiHandlerFb=(c,h)=>{},this._escHandlerFb=c=>{},this._errorHandlerFb=c=>c,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,l.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(d,c=[64,126]){let h=0;if(d.prefix){if(d.prefix.length>1)throw new Error("only one byte as prefix supported");if(h=d.prefix.charCodeAt(0),h&&60>h||h>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(d.intermediates){if(d.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let b=0;b<d.intermediates.length;++b){const w=d.intermediates.charCodeAt(b);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");h<<=8,h|=w}}if(d.final.length!==1)throw new Error("final must be a single byte");const v=d.final.charCodeAt(0);if(c[0]>v||v>c[1])throw new Error(`final must be in range ${c[0]} .. ${c[1]}`);return h<<=8,h|=v,h}identToString(d){const c=[];for(;d;)c.push(String.fromCharCode(255&d)),d>>=8;return c.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,c){const h=this._identifier(d,[48,126]);this._escHandlers[h]===void 0&&(this._escHandlers[h]=[]);const v=this._escHandlers[h];return v.push(c),{dispose:()=>{const b=v.indexOf(c);b!==-1&&v.splice(b,1)}}}clearEscHandler(d){this._escHandlers[this._identifier(d,[48,126])]&&delete this._escHandlers[this._identifier(d,[48,126])]}setEscHandlerFallback(d){this._escHandlerFb=d}setExecuteHandler(d,c){this._executeHandlers[d.charCodeAt(0)]=c}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,c){const h=this._identifier(d);this._csiHandlers[h]===void 0&&(this._csiHandlers[h]=[]);const v=this._csiHandlers[h];return v.push(c),{dispose:()=>{const b=v.indexOf(c);b!==-1&&v.splice(b,1)}}}clearCsiHandler(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,c){return this._dcsParser.registerHandler(this._identifier(d),c)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,c){return this._oscParser.registerHandler(d,c)}clearOscHandler(d){this._oscParser.clearHandler(d)}setOscHandlerFallback(d){this._oscParser.setHandlerFallback(d)}setErrorHandler(d){this._errorHandler=d}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(d,c,h,v,b){this._parseStack.state=d,this._parseStack.handlers=c,this._parseStack.handlerPos=h,this._parseStack.transition=v,this._parseStack.chunkPos=b}parse(d,c,h){let v,b=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(h===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(h===!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(h===!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(b=d[this._parseStack.chunkPos],v=this._dcsParser.unhook(b!==24&&b!==26,h),v)return v;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(b=d[this._parseStack.chunkPos],v=this._oscParser.end(b!==24&&b!==26,h),v)return v;b===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<c;++S){switch(b=d[S],w=this._transitions.table[this.currentState<<8|(b<160?b:C)],w>>4){case 2:for(let N=S+1;;++N){if(N>=c||(b=d[N])<32||b>126&&b<C){this._printHandler(d,S,N),S=N-1;break}if(++N>=c||(b=d[N])<32||b>126&&b<C){this._printHandler(d,S,N),S=N-1;break}if(++N>=c||(b=d[N])<32||b>126&&b<C){this._printHandler(d,S,N),S=N-1;break}if(++N>=c||(b=d[N])<32||b>126&&b<C){this._printHandler(d,S,N),S=N-1;break}}break;case 3:this._executeHandlers[b]?this._executeHandlers[b]():this._executeHandlerFb(b),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:S,code:b,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|b];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|b,this._params),this.precedingCodepoint=0;break;case 8:do switch(b){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(b-48)}while(++S<c&&(b=d[S])>47&&b<60);S--;break;case 9:this._collect<<=8,this._collect|=b;break;case 10:const L=this._escHandlers[this._collect<<8|b];let M=L?L.length-1:-1;for(;M>=0&&(v=L[M](),v!==!0);M--)if(v instanceof Promise)return this._preserveStack(4,L,M,w,S),v;M<0&&this._escHandlerFb(this._collect<<8|b),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|b,this._params);break;case 13:for(let N=S+1;;++N)if(N>=c||(b=d[N])===24||b===26||b===27||b>127&&b<C){this._dcsParser.put(d,S,N),S=N-1;break}break;case 14:if(v=this._dcsParser.unhook(b!==24&&b!==26),v)return this._preserveStack(6,[],0,w,S),v;b===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=S+1;;N++)if(N>=c||(b=d[N])<32||b>127&&b<C){this._oscParser.put(d,S,N),S=N-1;break}break;case 6:if(v=this._oscParser.end(b!==24&&b!==26),v)return this._preserveStack(5,[],0,w,S),v;b===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&w}}}s.EscapeSequenceParser=g},6242:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;const l=i(5770),u=i(482),o=[];s.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 C=this._handlers[p];return C.push(_),{dispose:()=>{const g=C.indexOf(_);g!==-1&&C.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,_,C){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(p,_,C);else this._handlerFb(this._id,"PUT",(0,u.utf32ToString)(p,_,C))}start(){this.reset(),this._state=1}put(p,_,C){if(this._state!==3){if(this._state===1)for(;_<C;){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&&C-_>0&&this._put(p,_,C)}}end(p,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let C=!1,g=this._active.length-1,n=!1;if(this._stack.paused&&(g=this._stack.loopPosition-1,C=_,n=this._stack.fallThrough,this._stack.paused=!1),!n&&C===!1){for(;g>=0&&(C=this._active[g].end(p),C!==!0);g--)if(C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!1,C;g--}for(;g>=0;g--)if(C=this._active[g].end(!1),C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!0,C}else this._handlerFb(this._id,"END",p);this._active=o,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,_,C){this._hitLimit||(this._data+=(0,u.utf32ToString)(p,_,C),this._data.length>l.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((C=>(this._data="",this._hitLimit=!1,C)));return this._data="",this._hitLimit=!1,_}}},8742:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;const i=2147483647;class l{static fromArray(o){const p=new l;if(!o.length)return p;for(let _=Array.isArray(o[0])?1:0;_<o.length;++_){const C=o[_];if(Array.isArray(C))for(let g=0;g<C.length;++g)p.addSubParam(C[g]);else p.addParam(C)}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 l(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,C=255&this._subParamsIdx[p];C-_>0&&o.push(Array.prototype.slice.call(this._subParams,_,C))}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,C=255&this._subParamsIdx[p];C-_>0&&(o[p]=this._subParams.slice(_,C))}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,C=_[p-1];_[p-1]=~C?Math.min(10*C+o,i):o}}s.Params=l},5741:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let i=this._addons.length-1;i>=0;i--)this._addons[i].instance.dispose()}loadAddon(i,l){const u={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(u),l.dispose=()=>this._wrappedAddonDispose(u),l.activate(i)}_wrappedAddonDispose(i){if(i.isDisposed)return;let l=-1;for(let u=0;u<this._addons.length;u++)if(this._addons[u]===i){l=u;break}if(l===-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(l,1)}}},8771:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;const l=i(3785),u=i(511);s.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 l.BufferLineApiView(p)}getNullCell(){return new u.CellData}}},3785:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;const l=i(511);s.BufferLineApiView=class{constructor(u){this._line=u}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(u,o){if(!(u<0||u>=this._line.length))return o?(this._line.loadCell(u,o),o):this._line.loadCell(u,new l.CellData)}translateToString(u,o,p){return this._line.translateToString(u,o,p)}}},8285:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;const l=i(8771),u=i(8460),o=i(844);class p extends o.Disposable{constructor(C){super(),this._core=C,this._onBufferChange=this.register(new u.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new l.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new l.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)}}s.BufferNamespaceApi=p},7975:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(i){this._core=i}registerCsiHandler(i,l){return this._core.registerCsiHandler(i,(u=>l(u.toArray())))}addCsiHandler(i,l){return this.registerCsiHandler(i,l)}registerDcsHandler(i,l){return this._core.registerDcsHandler(i,((u,o)=>l(u,o.toArray())))}addDcsHandler(i,l){return this.registerDcsHandler(i,l)}registerEscHandler(i,l){return this._core.registerEscHandler(i,l)}addEscHandler(i,l){return this.registerEscHandler(i,l)}registerOscHandler(i,l){return this._core.registerOscHandler(i,l)}addOscHandler(i,l){return this.registerOscHandler(i,l)}}},7090:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.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(y,s,i){var l=this&&this.__decorate||function(n,d,c,h){var v,b=arguments.length,w=b<3?d:h===null?h=Object.getOwnPropertyDescriptor(d,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,c,h);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(b<3?v(w):b>3?v(d,c,w):v(d,c))||w);return b>3&&w&&Object.defineProperty(d,c,w),w},u=this&&this.__param||function(n,d){return function(c,h){d(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;const o=i(8460),p=i(844),_=i(5295),C=i(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let g=s.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,s.MINIMUM_COLS),this.rows=Math.max(n.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(n,this))}resize(n,d){this.cols=n,this.rows=d,this.buffers.resize(n,d),this._onResize.fire({cols:n,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(n,d=!1){const c=this.buffer;let h;h=this._cachedBlankLine,h&&h.length===this.cols&&h.getFg(0)===n.fg&&h.getBg(0)===n.bg||(h=c.getBlankLine(n,d),this._cachedBlankLine=h),h.isWrapped=d;const v=c.ybase+c.scrollTop,b=c.ybase+c.scrollBottom;if(c.scrollTop===0){const w=c.lines.isFull;b===c.lines.length-1?w?c.lines.recycle().copyFrom(h):c.lines.push(h.clone()):c.lines.splice(b+1,0,h.clone()),w?this.isUserScrolling&&(c.ydisp=Math.max(c.ydisp-1,0)):(c.ybase++,this.isUserScrolling||c.ydisp++)}else{const w=b-v+1;c.lines.shiftElements(v+1,w-1,-1),c.lines.set(b,h.clone())}this.isUserScrolling||(c.ydisp=c.ybase),this._onScroll.fire(c.ydisp)}scrollLines(n,d,c){const h=this.buffer;if(n<0){if(h.ydisp===0)return;this.isUserScrolling=!0}else n+h.ydisp>=h.ybase&&(this.isUserScrolling=!1);const v=h.ydisp;h.ydisp=Math.max(Math.min(h.ydisp+n,h.ybase),0),v!==h.ydisp&&(d||this._onScroll.fire(h.ydisp))}};s.BufferService=g=l([u(0,C.IOptionsService)],g)},7994:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.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,l){this._charsets[i]=l,this.glevel===i&&(this.charset=l)}}},1753:function(y,s,i){var l=this&&this.__decorate||function(h,v,b,w){var k,S=arguments.length,E=S<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(h,v,b,w);else for(var T=h.length-1;T>=0;T--)(k=h[T])&&(E=(S<3?k(E):S>3?k(v,b,E):k(v,b))||E);return S>3&&E&&Object.defineProperty(v,b,E),E},u=this&&this.__param||function(h,v){return function(b,w){v(b,w,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;const o=i(2585),p=i(8460),_=i(844),C={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:h=>h.button!==4&&h.action===1&&(h.ctrl=!1,h.alt=!1,h.shift=!1,!0)},VT200:{events:19,restrict:h=>h.action!==32},DRAG:{events:23,restrict:h=>h.action!==32||h.button!==3},ANY:{events:31,restrict:h=>!0}};function g(h,v){let b=(h.ctrl?16:0)|(h.shift?4:0)|(h.alt?8:0);return h.button===4?(b|=64,b|=h.action):(b|=3&h.button,4&h.button&&(b|=64),8&h.button&&(b|=128),h.action===32?b|=32:h.action!==0||v||(b|=3)),b}const n=String.fromCharCode,d={DEFAULT:h=>{const v=[g(h,!1)+32,h.col+32,h.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${n(v[0])}${n(v[1])}${n(v[2])}`},SGR:h=>{const v=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${g(h,!0)};${h.col};${h.row}${v}`},SGR_PIXELS:h=>{const v=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${g(h,!0)};${h.x};${h.y}${v}`}};let c=s.CoreMouseService=class extends _.Disposable{constructor(h,v){super(),this._bufferService=h,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 b of Object.keys(C))this.addProtocol(b,C[b]);for(const b of Object.keys(d))this.addEncoding(b,d[b]);this.reset()}addProtocol(h,v){this._protocols[h]=v}addEncoding(h,v){this._encodings[h]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(h){if(!this._protocols[h])throw new Error(`unknown protocol "${h}"`);this._activeProtocol=h,this._onProtocolChange.fire(this._protocols[h].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(h){if(!this._encodings[h])throw new Error(`unknown encoding "${h}"`);this._activeEncoding=h}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(h){if(h.col<0||h.col>=this._bufferService.cols||h.row<0||h.row>=this._bufferService.rows||h.button===4&&h.action===32||h.button===3&&h.action!==32||h.button!==4&&(h.action===2||h.action===3)||(h.col++,h.row++,h.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,h,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(h))return!1;const v=this._encodings[this._activeEncoding](h);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=h,!0}explainEvents(h){return{down:!!(1&h),up:!!(2&h),drag:!!(4&h),move:!!(8&h),wheel:!!(16&h)}}_equalEvents(h,v,b){if(b){if(h.x!==v.x||h.y!==v.y)return!1}else if(h.col!==v.col||h.row!==v.row)return!1;return h.button===v.button&&h.action===v.action&&h.ctrl===v.ctrl&&h.alt===v.alt&&h.shift===v.shift}};s.CoreMouseService=c=l([u(0,o.IBufferService),u(1,o.ICoreService)],c)},6975:function(y,s,i){var l=this&&this.__decorate||function(c,h,v,b){var w,k=arguments.length,S=k<3?h:b===null?b=Object.getOwnPropertyDescriptor(h,v):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(c,h,v,b);else for(var E=c.length-1;E>=0;E--)(w=c[E])&&(S=(k<3?w(S):k>3?w(h,v,S):w(h,v))||S);return k>3&&S&&Object.defineProperty(h,v,S),S},u=this&&this.__param||function(c,h){return function(v,b){h(v,b,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;const o=i(1439),p=i(8460),_=i(844),C=i(2585),g=Object.freeze({insertMode:!1}),n=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=s.CoreService=class extends _.Disposable{constructor(c,h,v){super(),this._bufferService=c,this._logService=h,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(c,h=!1){if(this._optionsService.rawOptions.disableStdin)return;const v=this._bufferService.buffer;h&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),h&&this._onUserInput.fire(),this._logService.debug(`sending data "${c}"`,(()=>c.split("").map((b=>b.charCodeAt(0))))),this._onData.fire(c)}triggerBinaryEvent(c){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${c}"`,(()=>c.split("").map((h=>h.charCodeAt(0))))),this._onBinary.fire(c))}};s.CoreService=d=l([u(0,C.IBufferService),u(1,C.ILogService),u(2,C.IOptionsService)],d)},9074:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;const l=i(8055),u=i(8460),o=i(844),p=i(6106);let _=0,C=0;class g extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList((c=>c?.marker.line)),this._onDecorationRegistered=this.register(new u.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new u.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)((()=>this.reset())))}registerDecoration(c){if(c.marker.isDisposed)return;const h=new n(c);if(h){const v=h.marker.onDispose((()=>h.dispose()));h.onDispose((()=>{h&&(this._decorations.delete(h)&&this._onDecorationRemoved.fire(h),v.dispose())})),this._decorations.insert(h),this._onDecorationRegistered.fire(h)}return h}reset(){for(const c of this._decorations.values())c.dispose();this._decorations.clear()}*getDecorationsAtCell(c,h,v){var b,w,k;let S=0,E=0;for(const T of this._decorations.getKeyIterator(h))S=(b=T.options.x)!==null&&b!==void 0?b:0,E=S+((w=T.options.width)!==null&&w!==void 0?w:1),c>=S&&c<E&&(!v||((k=T.options.layer)!==null&&k!==void 0?k:"bottom")===v)&&(yield T)}forEachDecorationAtCell(c,h,v,b){this._decorations.forEachByKey(h,(w=>{var k,S,E;_=(k=w.options.x)!==null&&k!==void 0?k:0,C=_+((S=w.options.width)!==null&&S!==void 0?S:1),c>=_&&c<C&&(!v||((E=w.options.layer)!==null&&E!==void 0?E:"bottom")===v)&&b(w)}))}}s.DecorationService=g;class n extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=l.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=l.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(c){super(),this.options=c,this.onRenderEmitter=this.register(new u.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=c.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;const l=i(2585),u=i(8343);class o{constructor(..._){this._entries=new Map;for(const[C,g]of _)this.set(C,g)}set(_,C){const g=this._entries.get(_);return this._entries.set(_,C),g}forEach(_){for(const[C,g]of this._entries.entries())_(C,g)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}s.ServiceCollection=o,s.InstantiationService=class{constructor(){this._services=new o,this._services.set(l.IInstantiationService,this)}setService(p,_){this._services.set(p,_)}getService(p){return this._services.get(p)}createInstance(p,..._){const C=(0,u.getServiceDependencies)(p).sort(((d,c)=>d.index-c.index)),g=[];for(const d of C){const c=this._services.get(d.id);if(!c)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${d.id}.`);g.push(c)}const n=C.length>0?C[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(y,s,i){var l=this&&this.__decorate||function(n,d,c,h){var v,b=arguments.length,w=b<3?d:h===null?h=Object.getOwnPropertyDescriptor(d,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,d,c,h);else for(var k=n.length-1;k>=0;k--)(v=n[k])&&(w=(b<3?v(w):b>3?v(d,c,w):v(d,c))||w);return b>3&&w&&Object.defineProperty(d,c,w),w},u=this&&this.__param||function(n,d){return function(c,h){d(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.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 C,g=s.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()))),C=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(n){for(let d=0;d<n.length;d++)typeof n[d]=="function"&&(n[d]=n[d]())}_log(n,d,c){this._evalLazyOptionalParams(c),n.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...c)}trace(n,...d){var c,h;this._logLevel<=p.LogLevelEnum.TRACE&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.trace.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.log,n,d)}debug(n,...d){var c,h;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.debug.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.log,n,d)}info(n,...d){var c,h;this._logLevel<=p.LogLevelEnum.INFO&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.info.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.info,n,d)}warn(n,...d){var c,h;this._logLevel<=p.LogLevelEnum.WARN&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.warn.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.warn,n,d)}error(n,...d){var c,h;this._logLevel<=p.LogLevelEnum.ERROR&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.error.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.error,n,d)}};s.LogService=g=l([u(0,p.IOptionsService)],g),s.setTraceLogger=function(n){C=n},s.traceCall=function(n,d,c){if(typeof c.value!="function")throw new Error("not supported");const h=c.value;c.value=function(...v){if(C.logLevel!==p.LogLevelEnum.TRACE)return h.apply(this,v);C.trace(`GlyphRenderer#${h.name}(${v.map((w=>JSON.stringify(w))).join(", ")})`);const b=h.apply(this,v);return C.trace(`GlyphRenderer#${h.name} return`,b),b}}},7302:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;const l=i(8460),u=i(844),o=i(6114);s.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 u.Disposable{constructor(g){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;const n=Object.assign({},s.DEFAULT_OPTIONS);for(const d in g)if(d in n)try{const c=g[d];n[d]=this._sanitizeAndValidateOption(d,c)}catch(c){console.error(c)}this.rawOptions=n,this.options=Object.assign({},n),this._setupOptions()}onSpecificOptionChange(g,n){return this.onOptionChange((d=>{d===g&&n(this.rawOptions[g])}))}onMultipleOptionChange(g,n){return this.onOptionChange((d=>{g.indexOf(d)!==-1&&n()}))}_setupOptions(){const g=d=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},n=(d,c)=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);c=this._sanitizeAndValidateOption(d,c),this.rawOptions[d]!==c&&(this.rawOptions[d]=c,this._onOptionChange.fire(d))};for(const d in this.rawOptions){const c={get:g.bind(this,d),set:n.bind(this,d)};Object.defineProperty(this.options,d,c)}}_sanitizeAndValidateOption(g,n){switch(g){case"cursorStyle":if(n||(n=s.DEFAULT_OPTIONS[g]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(n))throw new Error(`"${n}" is not a valid value for ${g}`);break;case"wordSeparator":n||(n=s.DEFAULT_OPTIONS[g]);break;case"fontWeight":case"fontWeightBold":if(typeof n=="number"&&1<=n&&n<=1e3)break;n=p.includes(n)?n:s.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}}s.OptionsService=_},2660:function(y,s,i){var l=this&&this.__decorate||function(_,C,g,n){var d,c=arguments.length,h=c<3?C:n===null?n=Object.getOwnPropertyDescriptor(C,g):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(_,C,g,n);else for(var v=_.length-1;v>=0;v--)(d=_[v])&&(h=(c<3?d(h):c>3?d(C,g,h):d(C,g))||h);return c>3&&h&&Object.defineProperty(C,g,h),h},u=this&&this.__param||function(_,C){return function(g,n){C(g,n,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;const o=i(2585);let p=s.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const C=this._bufferService.buffer;if(_.id===void 0){const v=C.addMarker(C.ybase+C.y),b={data:_,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(b,v))),this._dataByLinkId.set(b.id,b),b.id}const g=_,n=this._getEntryIdKey(g),d=this._entriesWithId.get(n);if(d)return this.addLineToLink(d.id,C.ybase+C.y),d.id;const c=C.addMarker(C.ybase+C.y),h={id:this._nextId++,key:this._getEntryIdKey(g),data:g,lines:[c]};return c.onDispose((()=>this._removeMarkerFromLink(h,c))),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(_,C){const g=this._dataByLinkId.get(_);if(g&&g.lines.every((n=>n.line!==C))){const n=this._bufferService.buffer.addMarker(C);g.lines.push(n),n.onDispose((()=>this._removeMarkerFromLink(g,n)))}}getLinkData(_){var C;return(C=this._dataByLinkId.get(_))===null||C===void 0?void 0:C.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,C){const g=_.lines.indexOf(C);g!==-1&&(_.lines.splice(g,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};s.OscLinkService=p=l([u(0,o.IBufferService)],p)},8343:(y,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const i="di$target",l="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(u){return u[l]||[]},s.createDecorator=function(u){if(s.serviceRegistry.has(u))return s.serviceRegistry.get(u);const o=function(p,_,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,n,d){n[i]===n?n[l].push({id:g,index:d}):(n[l]=[{id:g,index:d}],n[i]=n)})(o,p,C)};return o.toString=()=>u,s.serviceRegistry.set(u,o),o}},2585:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const l=i(8343);var u;s.IBufferService=(0,l.createDecorator)("BufferService"),s.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),s.ICoreService=(0,l.createDecorator)("CoreService"),s.ICharsetService=(0,l.createDecorator)("CharsetService"),s.IInstantiationService=(0,l.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"})(u||(s.LogLevelEnum=u={})),s.ILogService=(0,l.createDecorator)("LogService"),s.IOptionsService=(0,l.createDecorator)("OptionsService"),s.IOscLinkService=(0,l.createDecorator)("OscLinkService"),s.IUnicodeService=(0,l.createDecorator)("UnicodeService"),s.IDecorationService=(0,l.createDecorator)("DecorationService")},1480:(y,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;const l=i(8460),u=i(225);s.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const o=new u.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 C=0;C<_;++C){let g=o.charCodeAt(C);if(55296<=g&&g<=56319){if(++C>=_)return p+this.wcwidth(g);const n=o.charCodeAt(C);56320<=n&&n<=57343?g=1024*(g-55296)+n-56320+65536:p+=this.wcwidth(n)}p+=this.wcwidth(g)}return p}}}},a={};function m(y){var s=a[y];if(s!==void 0)return s.exports;var i=a[y]={exports:{}};return r[y].call(i.exports,i,i.exports,m),i.exports}var x={};return(()=>{var y=x;Object.defineProperty(y,"__esModule",{value:!0}),y.Terminal=void 0;const s=m(9042),i=m(3236),l=m(844),u=m(5741),o=m(8285),p=m(7975),_=m(7090),C=["cols","rows"];class g extends l.Disposable{constructor(d){super(),this._core=this.register(new i.Terminal(d)),this._addonManager=this.register(new u.AddonManager),this._publicOptions=Object.assign({},this._core.options);const c=v=>this._core.options[v],h=(v,b)=>{this._checkReadonlyOptions(v),this._core.options[v]=b};for(const v in this._core.options){const b={get:c.bind(this,v),set:h.bind(this,v)};Object.defineProperty(this._publicOptions,v,b)}}_checkReadonlyOptions(d){if(C.includes(d))throw new Error(`Option "${d}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const d=this._core.coreService.decPrivateModes;let c="none";switch(this._core.coreMouseService.activeProtocol){case"X10":c="x10";break;case"VT200":c="vt200";break;case"DRAG":c="drag";break;case"ANY":c="any"}return{applicationCursorKeysMode:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:c,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(const c in d)this._publicOptions[c]=d[c]}blur(){this._core.blur()}focus(){this._core.focus()}resize(d,c){this._verifyIntegers(d,c),this._core.resize(d,c)}open(d){this._core.open(d)}attachCustomKeyEventHandler(d){this._core.attachCustomKeyEventHandler(d)}registerLinkProvider(d){return this._core.registerLinkProvider(d)}registerCharacterJoiner(d){return this._checkProposedApi(),this._core.registerCharacterJoiner(d)}deregisterCharacterJoiner(d){this._checkProposedApi(),this._core.deregisterCharacterJoiner(d)}registerMarker(d=0){return this._verifyIntegers(d),this._core.registerMarker(d)}registerDecoration(d){var c,h,v;return this._checkProposedApi(),this._verifyPositiveIntegers((c=d.x)!==null&&c!==void 0?c:0,(h=d.width)!==null&&h!==void 0?h:0,(v=d.height)!==null&&v!==void 0?v:0),this._core.registerDecoration(d)}hasSelection(){return this._core.hasSelection()}select(d,c,h){this._verifyIntegers(d,c,h),this._core.select(d,c,h)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,c){this._verifyIntegers(d,c),this._core.selectLines(d,c)}dispose(){super.dispose()}scrollLines(d){this._verifyIntegers(d),this._core.scrollLines(d)}scrollPages(d){this._verifyIntegers(d),this._core.scrollPages(d)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(d){this._verifyIntegers(d),this._core.scrollToLine(d)}clear(){this._core.clear()}write(d,c){this._core.write(d,c)}writeln(d,c){this._core.write(d),this._core.write(`\r
|
|
19
|
+
`,c)}paste(d){this._core.paste(d)}refresh(d,c){this._verifyIntegers(d,c),this._core.refresh(d,c)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return s}_verifyIntegers(...d){for(const c of d)if(c===1/0||isNaN(c)||c%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...d){for(const c of d)if(c&&(c===1/0||isNaN(c)||c%1!=0||c<0))throw new Error("This API only accepts positive integers")}}y.Terminal=g})(),x})()))})(Hr)),Hr.exports}var gc=_c();var bc=2,Sc=1,xc=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,r=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(r.getPropertyValue("height")),m=Math.max(0,parseInt(r.getPropertyValue("width"))),x=window.getComputedStyle(this._terminal.element),y={top:parseInt(x.getPropertyValue("padding-top")),bottom:parseInt(x.getPropertyValue("padding-bottom")),right:parseInt(x.getPropertyValue("padding-right")),left:parseInt(x.getPropertyValue("padding-left"))},s=y.top+y.bottom,i=y.right+y.left,l=a-s,u=m-i-t;return{cols:Math.max(bc,Math.floor(u/e.css.cell.width)),rows:Math.max(Sc,Math.floor(l/e.css.cell.height))}}};function Cc(e={}){const{cwd:t,cols:r,rows:a,onOutput:m,onExit:x}=e,[y,s]=R.useState(null),[i,l]=R.useState(()=>nt.isConnected()),[u,o]=R.useState(!1),[p,_]=R.useState(!1),C=R.useRef({onOutput:m,onExit:x});C.current={onOutput:m,onExit:x};const g=R.useRef(null);g.current=y,R.useEffect(()=>{if(!y)return;const v=nt.getSocket(),b=()=>{l(!0),o(!1),C.current.onExit?.(-1),s(null)},w=()=>{l(!1),o(!1)},k=L=>{L.terminalId===y&&C.current.onOutput?.(L.data)},S=L=>{L.terminalId===y&&(o(!1),C.current.onExit?.(L.exitCode),s(null))},E=L=>{L.terminalId===y&&o(!0)},T=L=>{L.terminalId===y&&o(!1)};return v.on("connect",b),v.on("disconnect",w),v.on(Ne.TERMINAL_STDOUT,k),v.on(Ne.TERMINAL_EXIT,S),v.on(Ne.TERMINAL_SUBSCRIBED,E),v.on(Ne.TERMINAL_UNSUBSCRIBED,T),l(v.connected),v.connected&&v.emit(st.SUBSCRIBE,{topic:"terminal",id:y},L=>{L.success&&o(!0)}),()=>{v.off("connect",b),v.off("disconnect",w),v.off(Ne.TERMINAL_STDOUT,k),v.off(Ne.TERMINAL_EXIT,S),v.off(Ne.TERMINAL_SUBSCRIBED,E),v.off(Ne.TERMINAL_UNSUBSCRIBED,T),v.emit(st.UNSUBSCRIBE,{topic:"terminal",id:y})}},[y]);const n=R.useCallback(async()=>{const v=nt.getSocket();if(!v.connected)return null;_(!0);try{const b=await de.post("/terminals",{socketId:v.id,cwd:t,cols:r,rows:a});return s(b.terminalId),b.terminalId}catch(b){return console.error("[useStandaloneTerminal] Failed to create terminal:",b),null}finally{_(!1)}},[t,r,a]),d=R.useCallback(async()=>{const v=g.current;if(v){try{await de.delete(`/terminals/${v}`)}catch(b){console.error("[useStandaloneTerminal] Failed to destroy terminal:",b)}s(null),o(!1)}},[]),c=R.useCallback(v=>{const b=g.current;if(!b)return;nt.getSocket().emit(st.TERMINAL_INPUT,{terminalId:b,data:v})},[]),h=R.useCallback((v,b)=>{const w=g.current;if(!w)return;nt.getSocket().emit(st.TERMINAL_RESIZE,{terminalId:w,cols:v,rows:b})},[]);return R.useEffect(()=>()=>{const v=g.current;v&&de.delete(`/terminals/${v}`).catch(()=>{})},[]),{terminalId:y,isConnected:i,isAttached:u,isCreating:p,create:n,destroy:d,sendInput:c,resize:h}}const yc={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"},wc=Z.memo(function({cwd:t,onExit:r,onReady:a}){const m=R.useRef(null),x=R.useRef(null),y=R.useRef(null),s=R.useRef(!1),{terminalId:i,isAttached:l,create:u,sendInput:o,resize:p}=Cc({cwd:t,onOutput:R.useCallback(_=>{x.current?.write(_)},[]),onExit:R.useCallback(_=>{x.current?.writeln(`\r
|
|
20
|
+
\x1B[90m[Process exited with code ${_}]\x1B[0m`),r?.(_)},[r])});return R.useLayoutEffect(()=>{if(!m.current)return;const _=new gc.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, 'Courier New', monospace",lineHeight:1.4,theme:yc,scrollback:5e3,convertEol:!0}),C=new xc;_.loadAddon(C),_.open(m.current);const g=(n=0)=>{if(!(n>=5))try{const c=m.current;if(!c||c.clientWidth===0||c.clientHeight===0){setTimeout(()=>g(n+1),50);return}C.fit(),p(_.cols,_.rows)}catch{setTimeout(()=>g(n+1),50)}};return g(0),setTimeout(()=>g(1),100),x.current=_,y.current=C,()=>{_.dispose(),x.current=null,y.current=null}},[p]),R.useEffect(()=>{s.current||(s.current=!0,u())},[u]),R.useEffect(()=>{const _=x.current;if(!_||!l)return;const C=_.onData(g=>{o(g)});return()=>C.dispose()},[o,l]),R.useEffect(()=>{l&&a?.({sendInput:o})},[l,o,a]),R.useEffect(()=>{if(!m.current)return;const _=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{const C=y.current,g=x.current,n=m.current;C&&g&&n&&n.clientWidth>0&&n.clientHeight>0&&(C.fit(),p(g.cols,g.rows))}catch{}})});return _.observe(m.current),()=>_.disconnect()},[p]),f.jsxs("div",{className:"relative flex h-full flex-col bg-[#1e1e1e]",children:[!i&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral-500 text-xs z-10 bg-[#1e1e1e]",children:"Starting terminal..."}),f.jsx("div",{ref:m,className:"flex-1 overflow-hidden px-1 pt-1"})]})}),Ec=Z.memo(function({commands:t,onSelect:r}){const[a,m]=R.useState(!1),x=R.useRef(null),y=R.useRef(null);return R.useEffect(()=>{if(!a)return;const s=i=>{x.current&&!x.current.contains(i.target)&&y.current&&!y.current.contains(i.target)&&m(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[a]),t.length===0?null:f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"w-px h-4 bg-[#444] mx-1 shrink-0"}),f.jsxs("div",{className:"relative",children:[f.jsxs("button",{ref:y,onClick:()=>m(!a),className:`flex items-center gap-1.5 px-2.5 py-1 mx-1 rounded text-[11px] font-medium transition-colors shrink-0 ${a?"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:[f.jsx(ya,{size:12}),f.jsx("span",{children:"快捷命令"}),f.jsx(xt,{size:10,className:`transition-transform ${a?"rotate-180":""}`})]}),a&&f.jsx("div",{ref:x,className:"absolute right-0 top-full mt-1 w-72 bg-[#2d2d2d] border border-[#444] rounded-lg shadow-xl z-[100] overflow-hidden",children:f.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:t.map((s,i)=>f.jsxs("button",{onClick:()=>{r(s.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:[f.jsx(bt,{size:12,className:"text-green-500 mt-0.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"text-[12px] font-medium text-neutral-200",children:s.name}),f.jsx("div",{className:"text-[11px] font-mono text-neutral-500 truncate",children:s.command})]})]},i))})})]})]})});let kc=0;function Js(){return`shell-${++kc}`}const Rc=Z.memo(function({cwd:t,quickCommands:r=[]}){const[a,m]=R.useState(()=>[{id:Js(),label:"Shell 1"}]),[x,y]=R.useState(()=>a[0].id),s=R.useRef(new Map),i=R.useCallback(()=>{const _=Js(),C={id:_,label:`Shell ${a.length+1}`};m(g=>[...g,C]),y(_)},[a.length]),l=R.useCallback((_,C)=>{C.stopPropagation(),s.current.delete(_),m(g=>{const n=g.filter(d=>d.id!==_);return _===x&&n.length>0&&y(n[n.length-1].id),n})},[x]),u=R.useCallback(_=>{s.current.delete(_),m(C=>{const g=C.filter(n=>n.id!==_);return _===x&&g.length>0&&y(g[g.length-1].id),g})},[x]),o=R.useCallback((_,C)=>{s.current.set(_,C.sendInput)},[]),p=R.useCallback(_=>{const C=s.current.get(x);C&&C(_+"\r")},[x]);return f.jsxs("div",{className:"flex h-full flex-col bg-[#1e1e1e]",children:[f.jsxs("div",{className:"flex items-center bg-[#252526] border-b border-[#333] shrink-0 select-none",children:[f.jsx("div",{className:"flex items-center overflow-x-auto flex-1 min-w-0",children:a.map(_=>f.jsxs("button",{onClick:()=>y(_.id),className:Oe("flex items-center gap-1.5 px-3 py-1.5 text-[11px] border-r border-[#333] whitespace-nowrap group transition-colors",_.id===x?"bg-[#1e1e1e] text-neutral-200":"bg-[#2d2d2d] text-neutral-500 hover:text-neutral-300"),children:[f.jsx(nr,{size:11,className:"shrink-0"}),f.jsx("span",{children:_.label}),a.length>1&&f.jsx("span",{onClick:C=>l(_.id,C),className:"ml-1 p-0.5 rounded hover:bg-[#444] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:f.jsx(_r,{size:10})})]},_.id))}),f.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:f.jsx(Yr,{size:14})}),r.length>0&&f.jsx(Ec,{commands:r,onSelect:p})]}),f.jsx("div",{className:"flex-1 overflow-hidden relative",children:a.length===0?f.jsx("div",{className:"flex-1 flex items-center justify-center h-full text-neutral-500",children:f.jsxs("div",{className:"flex flex-col items-center gap-2",children:[f.jsx(nr,{size:28}),f.jsx("span",{className:"text-xs",children:"No terminals open"}),f.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"})]})}):a.map(_=>f.jsx("div",{className:"absolute inset-0",style:{display:_.id===x?"block":"none"},children:f.jsx(wc,{cwd:t,onExit:()=>u(_.id),onReady:C=>o(_.id,C)})},_.id))})]})});function ei(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,a=Array(t);r<t;r++)a[r]=e[r];return a}function Dc(e){if(Array.isArray(e))return e}function Ac(e,t,r){return(t=Oc(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tc(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var a,m,x,y,s=[],i=!0,l=!1;try{if(x=(r=r.call(e)).next,t!==0)for(;!(i=(a=x.call(r)).done)&&(s.push(a.value),s.length!==t);i=!0);}catch(u){l=!0,m=u}finally{try{if(!i&&r.return!=null&&(y=r.return(),Object(y)!==y))return}finally{if(l)throw m}}return s}}function Lc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
21
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ti(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(m){return Object.getOwnPropertyDescriptor(e,m).enumerable})),r.push.apply(r,a)}return r}function ri(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ti(Object(r),!0).forEach(function(a){Ac(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ti(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Mc(e,t){if(e==null)return{};var r,a,m=jc(e,t);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(e);for(a=0;a<x.length;a++)r=x[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(m[r]=e[r])}return m}function jc(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}function Nc(e,t){return Dc(e)||Tc(e,t)||Bc(e,t)||Lc()}function Pc(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Oc(e){var t=Pc(e,"string");return typeof t=="symbol"?t:t+""}function Bc(e,t){if(e){if(typeof e=="string")return ei(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ei(e,t):void 0}}function Ic(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function si(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(m){return Object.getOwnPropertyDescriptor(e,m).enumerable})),r.push.apply(r,a)}return r}function ii(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?si(Object(r),!0).forEach(function(a){Ic(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):si(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Fc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(a){return t.reduceRight(function(m,x){return x(m)},a)}}function Mt(e){return function t(){for(var r=this,a=arguments.length,m=new Array(a),x=0;x<a;x++)m[x]=arguments[x];return m.length>=e.length?e.apply(this,m):function(){for(var y=arguments.length,s=new Array(y),i=0;i<y;i++)s[i]=arguments[i];return t.apply(r,[].concat(m,s))}}}function dr(e){return{}.toString.call(e).includes("Object")}function Hc(e){return!Object.keys(e).length}function Wt(e){return typeof e=="function"}function zc(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Wc(e,t){return dr(t)||lt("changeType"),Object.keys(t).some(function(r){return!zc(e,r)})&<("changeField"),t}function Uc(e){Wt(e)||lt("selectorType")}function $c(e){Wt(e)||dr(e)||lt("handlerType"),dr(e)&&Object.values(e).some(function(t){return!Wt(t)})&<("handlersType")}function Kc(e){e||lt("initialIsRequired"),dr(e)||lt("initialType"),Hc(e)&<("initialContent")}function qc(e,t){throw new Error(e[t]||e.default)}var Xc={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"},lt=Mt(qc)(Xc),Jt={changes:Wc,selector:Uc,handler:$c,initial:Kc};function Yc(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Jt.initial(e),Jt.handler(t);var r={current:e},a=Mt(Qc)(r,t),m=Mt(Gc)(r),x=Mt(Jt.changes)(e),y=Mt(Vc)(r);function s(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Jt.selector(l),l(r.current)}function i(l){Fc(a,m,x,y)(l)}return[s,i]}function Vc(e,t){return Wt(t)?t(e.current):t}function Gc(e,t){return e.current=ii(ii({},e.current),t),t}function Qc(e,t,r){return Wt(t)?t(e.current):Object.keys(r).forEach(function(a){var m;return(m=t[a])===null||m===void 0?void 0:m.call(t,e.current[a])}),r}var Zc={create:Yc},Jc={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function eh(e){return function t(){for(var r=this,a=arguments.length,m=new Array(a),x=0;x<a;x++)m[x]=arguments[x];return m.length>=e.length?e.apply(this,m):function(){for(var y=arguments.length,s=new Array(y),i=0;i<y;i++)s[i]=arguments[i];return t.apply(r,[].concat(m,s))}}}function th(e){return{}.toString.call(e).includes("Object")}function rh(e){return e||ni("configIsRequired"),th(e)||ni("configType"),e.urls?(sh(),{paths:{vs:e.urls.monacoBase}}):e}function sh(){console.warn(vn.deprecation)}function ih(e,t){throw new Error(e[t]||e.default)}var vn={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!
|
|
22
|
+
You are using deprecated way of configuration.
|
|
23
|
+
|
|
24
|
+
Instead of using
|
|
25
|
+
monaco.config({ urls: { monacoBase: '...' } })
|
|
26
|
+
use
|
|
27
|
+
monaco.config({ paths: { vs: '...' } })
|
|
28
|
+
|
|
29
|
+
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
30
|
+
`},ni=eh(ih)(vn),nh={config:rh},oh=function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return function(m){return r.reduceRight(function(x,y){return y(x)},m)}};function _n(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],_n(e[r],t[r]))}),ri(ri({},e),t)}var ah={type:"cancelation",msg:"operation is manually canceled"};function zr(e){var t=!1,r=new Promise(function(a,m){e.then(function(x){return t?m(ah):a(x)}),e.catch(m)});return r.cancel=function(){return t=!0},r}var lh=["monaco"],ch=Zc.create({config:Jc,isInitialized:!1,resolve:null,reject:null,monaco:null}),gn=Nc(ch,2),Xt=gn[0],kr=gn[1];function hh(e){var t=nh.config(e),r=t.monaco,a=Mc(t,lh);kr(function(m){return{config:_n(m.config,a),monaco:r}})}function uh(){var e=Xt(function(t){var r=t.monaco,a=t.isInitialized,m=t.resolve;return{monaco:r,isInitialized:a,resolve:m}});if(!e.isInitialized){if(kr({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),zr(Wr);if(window.monaco&&window.monaco.editor)return bn(window.monaco),e.resolve(window.monaco),zr(Wr);oh(dh,ph)(mh)}return zr(Wr)}function dh(e){return document.body.appendChild(e)}function fh(e){var t=document.createElement("script");return e&&(t.src=e),t}function ph(e){var t=Xt(function(a){var m=a.config,x=a.reject;return{config:m,reject:x}}),r=fh("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function mh(){var e=Xt(function(r){var a=r.config,m=r.resolve,x=r.reject;return{config:a,resolve:m,reject:x}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var a=r.m||r;bn(a),e.resolve(a)},function(r){e.reject(r)})}function bn(e){Xt().monaco||kr({monaco:e})}function vh(){return Xt(function(e){var t=e.monaco;return t})}var Wr=new Promise(function(e,t){return kr({resolve:e,reject:t})}),Sn={config:hh,init:uh,__getMonacoInstance:vh},_h={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Ur=_h,gh={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},bh=gh;function Sh({children:e}){return Z.createElement("div",{style:bh.container},e)}var xh=Sh,Ch=xh;function yh({width:e,height:t,isEditorReady:r,loading:a,_ref:m,className:x,wrapperProps:y}){return Z.createElement("section",{style:{...Ur.wrapper,width:e,height:t},...y},!r&&Z.createElement(Ch,null,a),Z.createElement("div",{ref:m,style:{...Ur.fullWidth,...!r&&Ur.hide},className:x}))}var wh=yh,xn=R.memo(wh);function Eh(e){R.useEffect(e,[])}var Cn=Eh;function kh(e,t,r=!0){let a=R.useRef(!0);R.useEffect(a.current||!r?()=>{a.current=!1}:e,t)}var Ke=kh;function Bt(){}function _t(e,t,r,a){return Rh(e,a)||Dh(e,t,r,a)}function Rh(e,t){return e.editor.getModel(yn(e,t))}function Dh(e,t,r,a){return e.editor.createModel(t,r,a?yn(e,a):void 0)}function yn(e,t){return e.Uri.parse(t)}function Ah({original:e,modified:t,language:r,originalLanguage:a,modifiedLanguage:m,originalModelPath:x,modifiedModelPath:y,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:i=!1,theme:l="light",loading:u="Loading...",options:o={},height:p="100%",width:_="100%",className:C,wrapperProps:g={},beforeMount:n=Bt,onMount:d=Bt}){let[c,h]=R.useState(!1),[v,b]=R.useState(!0),w=R.useRef(null),k=R.useRef(null),S=R.useRef(null),E=R.useRef(d),T=R.useRef(n),L=R.useRef(!1);Cn(()=>{let F=Sn.init();return F.then(H=>(k.current=H)&&b(!1)).catch(H=>H?.type!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>w.current?I():F.cancel()}),Ke(()=>{if(w.current&&k.current){let F=w.current.getOriginalEditor(),H=_t(k.current,e||"",a||r||"text",x||"");H!==F.getModel()&&F.setModel(H)}},[x],c),Ke(()=>{if(w.current&&k.current){let F=w.current.getModifiedEditor(),H=_t(k.current,t||"",m||r||"text",y||"");H!==F.getModel()&&F.setModel(H)}},[y],c),Ke(()=>{let F=w.current.getModifiedEditor();F.getOption(k.current.editor.EditorOption.readOnly)?F.setValue(t||""):t!==F.getValue()&&(F.executeEdits("",[{range:F.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),F.pushUndoStop())},[t],c),Ke(()=>{w.current?.getModel()?.original.setValue(e||"")},[e],c),Ke(()=>{let{original:F,modified:H}=w.current.getModel();k.current.editor.setModelLanguage(F,a||r||"text"),k.current.editor.setModelLanguage(H,m||r||"text")},[r,a,m],c),Ke(()=>{k.current?.editor.setTheme(l)},[l],c),Ke(()=>{w.current?.updateOptions(o)},[o],c);let M=R.useCallback(()=>{if(!k.current)return;T.current(k.current);let F=_t(k.current,e||"",a||r||"text",x||""),H=_t(k.current,t||"",m||r||"text",y||"");w.current?.setModel({original:F,modified:H})},[r,t,m,e,a,x,y]),N=R.useCallback(()=>{!L.current&&S.current&&(w.current=k.current.editor.createDiffEditor(S.current,{automaticLayout:!0,...o}),M(),k.current?.editor.setTheme(l),h(!0),L.current=!0)},[o,l,M]);R.useEffect(()=>{c&&E.current(w.current,k.current)},[c]),R.useEffect(()=>{!v&&!c&&N()},[v,c,N]);function I(){let F=w.current?.getModel();s||F?.original?.dispose(),i||F?.modified?.dispose(),w.current?.dispose()}return Z.createElement(xn,{width:_,height:p,isEditorReady:c,loading:u,_ref:S,className:C,wrapperProps:g})}var Th=Ah;R.memo(Th);function Lh(e){let t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}var Mh=Lh,er=new Map;function jh({defaultValue:e,defaultLanguage:t,defaultPath:r,value:a,language:m,path:x,theme:y="light",line:s,loading:i="Loading...",options:l={},overrideServices:u={},saveViewState:o=!0,keepCurrentModel:p=!1,width:_="100%",height:C="100%",className:g,wrapperProps:n={},beforeMount:d=Bt,onMount:c=Bt,onChange:h,onValidate:v=Bt}){let[b,w]=R.useState(!1),[k,S]=R.useState(!0),E=R.useRef(null),T=R.useRef(null),L=R.useRef(null),M=R.useRef(c),N=R.useRef(d),I=R.useRef(),F=R.useRef(a),H=Mh(x),z=R.useRef(!1),D=R.useRef(!1);Cn(()=>{let O=Sn.init();return O.then($=>(E.current=$)&&S(!1)).catch($=>$?.type!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>T.current?P():O.cancel()}),Ke(()=>{let O=_t(E.current,e||a||"",t||m||"",x||r||"");O!==T.current?.getModel()&&(o&&er.set(H,T.current?.saveViewState()),T.current?.setModel(O),o&&T.current?.restoreViewState(er.get(x)))},[x],b),Ke(()=>{T.current?.updateOptions(l)},[l],b),Ke(()=>{!T.current||a===void 0||(T.current.getOption(E.current.editor.EditorOption.readOnly)?T.current.setValue(a):a!==T.current.getValue()&&(D.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:a,forceMoveMarkers:!0}]),T.current.pushUndoStop(),D.current=!1))},[a],b),Ke(()=>{let O=T.current?.getModel();O&&m&&E.current?.editor.setModelLanguage(O,m)},[m],b),Ke(()=>{s!==void 0&&T.current?.revealLine(s)},[s],b),Ke(()=>{E.current?.editor.setTheme(y)},[y],b);let j=R.useCallback(()=>{if(!(!L.current||!E.current)&&!z.current){N.current(E.current);let O=x||r,$=_t(E.current,a||e||"",t||m||"",O||"");T.current=E.current?.editor.create(L.current,{model:$,automaticLayout:!0,...l},u),o&&T.current.restoreViewState(er.get(O)),E.current.editor.setTheme(y),s!==void 0&&T.current.revealLine(s),w(!0),z.current=!0}},[e,t,r,a,m,x,l,u,o,y,s]);R.useEffect(()=>{b&&M.current(T.current,E.current)},[b]),R.useEffect(()=>{!k&&!b&&j()},[k,b,j]),F.current=a,R.useEffect(()=>{b&&h&&(I.current?.dispose(),I.current=T.current?.onDidChangeModelContent(O=>{D.current||h(T.current.getValue(),O)}))},[b,h]),R.useEffect(()=>{if(b){let O=E.current.editor.onDidChangeMarkers($=>{let q=T.current.getModel()?.uri;if(q&&$.find(X=>X.path===q.path)){let X=E.current.editor.getModelMarkers({resource:q});v?.(X)}});return()=>{O?.dispose()}}return()=>{}},[b,v]);function P(){I.current?.dispose(),p?o&&er.set(x,T.current.saveViewState()):T.current.getModel()?.dispose(),T.current.dispose()}return Z.createElement(xn,{width:_,height:C,isEditorReady:b,loading:i,_ref:L,className:g,wrapperProps:n})}var Nh=jh,Ph=R.memo(Nh),Oh=Ph,Ge=function(e,t){return Number(e.toFixed(t))},Bh=function(e,t){return typeof e=="number"?e:t},Ce=function(e,t,r){r&&typeof r=="function"&&r(e,t)},Ih=function(e){return-Math.cos(e*Math.PI)/2+.5},Fh=function(e){return e},Hh=function(e){return e*e},zh=function(e){return e*(2-e)},Wh=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},Uh=function(e){return e*e*e},$h=function(e){return--e*e*e+1},Kh=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},qh=function(e){return e*e*e*e},Xh=function(e){return 1- --e*e*e*e},Yh=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},Vh=function(e){return e*e*e*e*e},Gh=function(e){return 1+--e*e*e*e*e},Qh=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},wn={easeOut:Ih,linear:Fh,easeInQuad:Hh,easeOutQuad:zh,easeInOutQuad:Wh,easeInCubic:Uh,easeOutCubic:$h,easeInOutCubic:Kh,easeInQuart:qh,easeOutQuart:Xh,easeInOutQuart:Yh,easeInQuint:Vh,easeOutQuint:Gh,easeInOutQuint:Qh},En=function(e){typeof e=="number"&&cancelAnimationFrame(e)},Je=function(e){e.mounted&&(En(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function kn(e,t,r,a){if(e.mounted){var m=new Date().getTime(),x=1;Je(e),e.animation=function(){if(!e.mounted)return En(e.animation);var y=new Date().getTime()-m,s=y/r,i=wn[t],l=i(s);y>=r?(a(x),e.animation=null):e.animation&&(a(l),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function Zh(e){var t=e.scale,r=e.positionX,a=e.positionY;return!(Number.isNaN(t)||Number.isNaN(r)||Number.isNaN(a))}function dt(e,t,r,a){var m=Zh(t);if(!(!e.mounted||!m)){var x=e.setTransformState,y=e.transformState,s=y.scale,i=y.positionX,l=y.positionY,u=t.scale-s,o=t.positionX-i,p=t.positionY-l;r===0?x(t.scale,t.positionX,t.positionY):kn(e,a,r,function(_){var C=s+u*_,g=i+o*_,n=l+p*_;x(C,g,n)})}}function Jh(e,t,r){var a=e.offsetWidth,m=e.offsetHeight,x=t.offsetWidth,y=t.offsetHeight,s=x*r,i=y*r,l=a-s,u=m-i;return{wrapperWidth:a,wrapperHeight:m,newContentWidth:s,newDiffWidth:l,newContentHeight:i,newDiffHeight:u}}var eu=function(e,t,r,a,m,x,y){var s=e>t?r*(y?1:.5):0,i=a>m?x*(y?1:.5):0,l=e-t-s,u=s,o=a-m-i,p=i;return{minPositionX:l,maxPositionX:u,minPositionY:o,maxPositionY:p}},ys=function(e,t){var r=e.wrapperComponent,a=e.contentComponent,m=e.setup.centerZoomedOut;if(!r||!a)throw new Error("Components are not mounted");var x=Jh(r,a,t),y=x.wrapperWidth,s=x.wrapperHeight,i=x.newContentWidth,l=x.newDiffWidth,u=x.newContentHeight,o=x.newDiffHeight,p=eu(y,i,l,s,u,o,!!m);return p},es=function(e,t,r,a){return a?e<t?Ge(t,2):e>r?Ge(r,2):Ge(e,2):Ge(e,2)},pt=function(e,t){var r=ys(e,t);return e.bounds=r,r};function Yt(e,t,r,a,m,x,y){var s=r.minPositionX,i=r.minPositionY,l=r.maxPositionX,u=r.maxPositionY,o=0,p=0;y&&(o=m,p=x);var _=es(e,s-o,l+o,a),C=es(t,i-p,u+p,a);return{x:_,y:C}}function Rr(e,t,r,a,m,x){var y=e.transformState,s=y.scale,i=y.positionX,l=y.positionY,u=a-s;if(typeof t!="number"||typeof r!="number")return console.error("Mouse X and Y position were not provided!"),{x:i,y:l};var o=i-t*u,p=l-r*u,_=Yt(o,p,m,x,0,0,null);return _}function Vt(e,t,r,a,m){var x=m?a:0,y=t-x;return!Number.isNaN(r)&&e>=r?r:!Number.isNaN(t)&&e<=y?y:e}var oi=function(e,t){var r=e.setup.panning.excluded,a=e.isInitialized,m=e.wrapperComponent,x=t.target,y="shadowRoot"in x&&"composedPath"in t,s=y?t.composedPath().some(function(u){return u instanceof Element?m?.contains(u):!1}):m?.contains(x),i=a&&x&&s;if(!i)return!1;var l=Dr(x,r);return!l},ai=function(e){var t=e.isInitialized,r=e.isPanning,a=e.setup,m=a.panning.disabled,x=t&&r&&!m;return!!x},tu=function(e,t){var r=e.transformState,a=r.positionX,m=r.positionY;e.isPanning=!0;var x=t.clientX,y=t.clientY;e.startCoords={x:x-a,y:y-m}},ru=function(e,t){var r=t.touches,a=e.transformState,m=a.positionX,x=a.positionY;e.isPanning=!0;var y=r.length===1;if(y){var s=r[0].clientX,i=r[0].clientY;e.startCoords={x:s-m,y:i-x}}};function su(e){var t=e.transformState,r=t.positionX,a=t.positionY,m=t.scale,x=e.setup,y=x.disabled,s=x.limitToBounds,i=x.centerZoomedOut,l=e.wrapperComponent;if(!(y||!l||!e.bounds)){var u=e.bounds,o=u.maxPositionX,p=u.minPositionX,_=u.maxPositionY,C=u.minPositionY,g=r>o||r<p,n=a>_||a<C,d=r>o?l.offsetWidth:e.setup.minPositionX||0,c=a>_?l.offsetHeight:e.setup.minPositionY||0,h=Rr(e,d,c,m,e.bounds,s||i),v=h.x,b=h.y;return{scale:m,positionX:g?v:r,positionY:n?b:a}}}function Rn(e,t,r,a,m){var x=e.setup.limitToBounds,y=e.wrapperComponent,s=e.bounds,i=e.transformState,l=i.scale,u=i.positionX,o=i.positionY;if(!(y===null||s===null||t===u&&r===o)){var p=Yt(t,r,s,x,a,m,y),_=p.x,C=p.y;e.setTransformState(l,_,C)}}var iu=function(e,t,r){var a=e.startCoords,m=e.transformState,x=e.setup.panning,y=x.lockAxisX,s=x.lockAxisY,i=m.positionX,l=m.positionY;if(!a)return{x:i,y:l};var u=t-a.x,o=r-a.y,p=y?i:u,_=s?l:o;return{x:p,y:_}},ht=function(e,t){var r=e.setup,a=e.transformState,m=a.scale,x=r.minScale,y=r.disablePadding;return t>0&&m>=x&&!y?t:0},nu=function(e){var t=e.mounted,r=e.setup,a=r.disabled,m=r.velocityAnimation,x=e.transformState.scale,y=m.disabled,s=!y||x>1||!a||t;return!!s},ou=function(e){var t=e.mounted,r=e.velocity,a=e.bounds,m=e.setup,x=m.disabled,y=m.velocityAnimation,s=e.transformState.scale,i=y.disabled,l=!i||s>1||!x||t;return!(!l||!r||!a)};function au(e,t){var r=e.setup.velocityAnimation,a=r.equalToMove,m=r.animationTime,x=r.sensitivity;return a?m*t*x:m}function li(e,t,r,a,m,x,y,s,i,l){if(m){if(t>y&&r>y){var u=y+(e-y)*l;return u>i?i:u<y?y:u}if(t<x&&r<x){var u=x+(e-x)*l;return u<s?s:u>x?x:u}}return a?t:es(e,x,y,m)}function lu(e,t){var r=1;return t?Math.min(r,e.offsetWidth/window.innerWidth):r}function cu(e,t){var r=nu(e);if(r){var a=e.lastMousePosition,m=e.velocityTime,x=e.setup,y=e.wrapperComponent,s=x.velocityAnimation.equalToMove,i=Date.now();if(a&&m&&y){var l=lu(y,s),u=t.x-a.x,o=t.y-a.y,p=u/l,_=o/l,C=i-m,g=u*u+o*o,n=Math.sqrt(g)/C;e.velocity={velocityX:p,velocityY:_,total:n}}e.lastMousePosition=t,e.velocityTime=i}}function hu(e){var t=e.velocity,r=e.bounds,a=e.setup,m=e.wrapperComponent,x=ou(e);if(!(!x||!t||!r||!m)){var y=t.velocityX,s=t.velocityY,i=t.total,l=r.maxPositionX,u=r.minPositionX,o=r.maxPositionY,p=r.minPositionY,_=a.limitToBounds,C=a.alignmentAnimation,g=a.zoomAnimation,n=a.panning,d=n.lockAxisY,c=n.lockAxisX,h=g.animationType,v=C.sizeX,b=C.sizeY,w=C.velocityAlignmentTime,k=w,S=au(e,i),E=Math.max(S,k),T=ht(e,v),L=ht(e,b),M=T*m.offsetWidth/100,N=L*m.offsetHeight/100,I=l+M,F=u-M,H=o+N,z=p-N,D=e.transformState,j=new Date().getTime();kn(e,h,E,function(P){var O=e.transformState,$=O.scale,q=O.positionX,X=O.positionY,G=new Date().getTime()-j,se=G/k,A=wn[C.animationType],B=1-A(Math.min(1,se)),U=1-P,W=q+y*U,J=X+s*U,Y=li(W,D.positionX,q,c,_,u,l,F,I,B),ie=li(J,D.positionY,X,d,_,p,o,z,H,B);(q!==W||X!==J)&&e.setTransformState($,Y,ie)})}}function ci(e,t){var r=e.transformState.scale;Je(e),pt(e,r),window.TouchEvent!==void 0&&t instanceof TouchEvent?ru(e,t):tu(e,t)}function ws(e,t){var r=e.transformState.scale,a=e.setup,m=a.minScale,x=a.alignmentAnimation,y=x.disabled,s=x.sizeX,i=x.sizeY,l=x.animationTime,u=x.animationType,o=y||r<m||!s&&!i;if(!o){var p=su(e);p&&dt(e,p,t??l,u)}}function hi(e,t,r){var a=e.startCoords,m=e.setup,x=m.alignmentAnimation,y=x.sizeX,s=x.sizeY;if(a){var i=iu(e,t,r),l=i.x,u=i.y,o=ht(e,y),p=ht(e,s);cu(e,{x:l,y:u}),Rn(e,l,u,o,p)}}function uu(e){if(e.isPanning){var t=e.setup.panning.velocityDisabled,r=e.velocity,a=e.wrapperComponent,m=e.contentComponent;e.isPanning=!1,e.animate=!1,e.animation=null;var x=a?.getBoundingClientRect(),y=m?.getBoundingClientRect(),s=x?.width||0,i=x?.height||0,l=y?.width||0,u=y?.height||0,o=s<l||i<u,p=!t&&r&&r?.total>.1&&o;p?hu(e):ws(e)}}function Es(e,t,r,a){var m=e.setup,x=m.minScale,y=m.maxScale,s=m.limitToBounds,i=Vt(Ge(t,2),x,y,0,!1),l=pt(e,i),u=Rr(e,r,a,i,l,s),o=u.x,p=u.y;return{scale:i,positionX:o,positionY:p}}function Dn(e,t,r){var a=e.transformState.scale,m=e.wrapperComponent,x=e.setup,y=x.minScale,s=x.limitToBounds,i=x.zoomAnimation,l=i.disabled,u=i.animationTime,o=i.animationType,p=l||a>=y;if((a>=1||s)&&ws(e),!(p||!m||!e.mounted)){var _=t||m.offsetWidth/2,C=r||m.offsetHeight/2,g=Es(e,y,_,C);g&&dt(e,g,u,o)}}var ct=function(){return ct=Object.assign||function(t){for(var r,a=1,m=arguments.length;a<m;a++){r=arguments[a];for(var x in r)Object.prototype.hasOwnProperty.call(r,x)&&(t[x]=r[x])}return t},ct.apply(this,arguments)};function ui(e,t,r){for(var a=0,m=t.length,x;a<m;a++)(x||!(a in t))&&(x||(x=Array.prototype.slice.call(t,0,a)),x[a]=t[a]);return e.concat(x||Array.prototype.slice.call(t))}var tr={scale:1,positionX:0,positionY:0},Tt={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}},ts={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},An=function(e){var t,r,a,m;return{previousScale:(t=e.initialScale)!==null&&t!==void 0?t:tr.scale,scale:(r=e.initialScale)!==null&&r!==void 0?r:tr.scale,positionX:(a=e.initialPositionX)!==null&&a!==void 0?a:tr.positionX,positionY:(m=e.initialPositionY)!==null&&m!==void 0?m:tr.positionY}},di=function(e){var t=ct({},Tt);return Object.keys(e).forEach(function(r){var a=typeof e[r]<"u",m=typeof Tt[r]<"u";if(m&&a){var x=Object.prototype.toString.call(Tt[r]),y=x==="[object Object]",s=x==="[object Array]";y?t[r]=ct(ct({},Tt[r]),e[r]):s?t[r]=ui(ui([],Tt[r],!0),e[r]):t[r]=e[r]}}),t},Tn=function(e,t,r){var a=e.transformState.scale,m=e.wrapperComponent,x=e.setup,y=x.maxScale,s=x.minScale,i=x.zoomAnimation,l=x.smooth,u=i.size;if(!m)throw new Error("Wrapper is not mounted");var o=l?a*Math.exp(t*r):a+t*r,p=Vt(Ge(o,3),s,y,u,!1);return p};function Ln(e,t,r,a,m){var x=e.wrapperComponent,y=e.transformState,s=y.scale,i=y.positionX,l=y.positionY;if(!x)return console.error("No WrapperComponent found");var u=x.offsetWidth,o=x.offsetHeight,p=(u/2-i)/s,_=(o/2-l)/s,C=Tn(e,t,r),g=Es(e,C,p,_);if(!g)return console.error("Error during zoom event. New transformation state was not calculated.");dt(e,g,a,m)}function Mn(e,t,r,a){var m=e.setup,x=e.wrapperComponent,y=m.limitToBounds,s=An(e.props),i=e.transformState,l=i.scale,u=i.positionX,o=i.positionY;if(x){var p=ys(e,s.scale),_=Yt(s.positionX,s.positionY,p,y,0,0,x),C={scale:s.scale,positionX:_.x,positionY:_.y};l===s.scale&&u===s.positionX&&o===s.positionY||(a?.(),dt(e,C,t,r))}}function du(e,t,r,a){var m=e.getBoundingClientRect(),x=t.getBoundingClientRect(),y=r.getBoundingClientRect(),s=x.x*a.scale,i=x.y*a.scale;return{x:(m.x-y.x+s)/a.scale,y:(m.y-y.y+i)/a.scale}}function fu(e,t,r){var a=e.wrapperComponent,m=e.contentComponent,x=e.transformState,y=e.setup,s=y.limitToBounds,i=y.minScale,l=y.maxScale;if(!a||!m)return x;var u=a.getBoundingClientRect(),o=t.getBoundingClientRect(),p=du(t,a,m,x),_=p.x,C=p.y,g=o.width/x.scale,n=o.height/x.scale,d=a.offsetWidth/g,c=a.offsetHeight/n,h=Vt(r||Math.min(d,c),i,l,0,!1),v=(u.width-g*h)/2,b=(u.height-n*h)/2,w=(u.left-_)*h+v,k=(u.top-C)*h+b,S=ys(e,h),E=Yt(w,k,S,s,0,0,a),T=E.x,L=E.y;return{positionX:T,positionY:L,scale:h}}var pu=function(e){return function(t,r,a){t===void 0&&(t=.5),r===void 0&&(r=300),a===void 0&&(a="easeOut"),Ln(e,1,t,r,a)}},mu=function(e){return function(t,r,a){t===void 0&&(t=.5),r===void 0&&(r=300),a===void 0&&(a="easeOut"),Ln(e,-1,t,r,a)}},vu=function(e){return function(t,r,a,m,x){m===void 0&&(m=300),x===void 0&&(x="easeOut");var y=e.transformState,s=y.positionX,i=y.positionY,l=y.scale,u=e.wrapperComponent,o=e.contentComponent,p=e.setup.disabled;if(!(p||!u||!o)){var _={positionX:Number.isNaN(t)?s:t,positionY:Number.isNaN(r)?i:r,scale:Number.isNaN(a)?l:a};dt(e,_,m,x)}}},_u=function(e){return function(t,r){t===void 0&&(t=200),r===void 0&&(r="easeOut"),Mn(e,t,r)}},gu=function(e){return function(t,r,a){r===void 0&&(r=200),a===void 0&&(a="easeOut");var m=e.transformState,x=e.wrapperComponent,y=e.contentComponent;if(x&&y){var s=jn(t||m.scale,x,y);dt(e,s,r,a)}}},bu=function(e){return function(t,r,a,m){a===void 0&&(a=600),m===void 0&&(m="easeOut"),Je(e);var x=e.wrapperComponent,y=typeof t=="string"?document.getElementById(t):t;if(x&&y&&x.contains(y)){var s=fu(e,y,r);dt(e,s,a,m)}}},fr=function(e){return{instance:e,zoomIn:pu(e),zoomOut:mu(e),setTransform:vu(e),resetTransform:_u(e),centerView:gu(e),zoomToElement:bu(e)}},rs=function(e){return{instance:e,state:e.transformState}},be=function(e){var t={};return Object.assign(t,rs(e)),Object.assign(t,fr(e)),t},$r=!1;function Kr(){try{var e={get passive(){return $r=!0,!1}};return e}catch{return $r=!1,$r}}var rr=".".concat(ts.wrapperClass),Dr=function(e,t){return t.some(function(r){return e.matches("".concat(rr," ").concat(r,", ").concat(rr," .").concat(r,", ").concat(rr," ").concat(r," *, ").concat(rr," .").concat(r," *"))})},ss=function(e){e&&clearTimeout(e)},Su=function(e,t,r){return"translate(".concat(e,"px, ").concat(t,"px) scale(").concat(r,")")},jn=function(e,t,r){var a=r.offsetWidth*e,m=r.offsetHeight*e,x=(t.offsetWidth-a)/2,y=(t.offsetHeight-m)/2;return{scale:e,positionX:x,positionY:y}};function xu(e){return function(t){e.forEach(function(r){typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Cu=function(e,t){var r=e.setup.wheel,a=r.disabled,m=r.wheelDisabled,x=r.touchPadDisabled,y=r.excluded,s=e.isInitialized,i=e.isPanning,l=t.target,u=s&&!i&&!a&&l;if(!u||m&&!t.ctrlKey||x&&t.ctrlKey)return!1;var o=Dr(l,y);return!o},yu=function(e){return e?e.deltaY<0?1:-1:0};function wu(e,t){var r=yu(e),a=Bh(t,r);return a}function Nn(e,t,r){var a=t.getBoundingClientRect(),m=0,x=0;if("clientX"in e)m=(e.clientX-a.left)/r,x=(e.clientY-a.top)/r;else{var y=e.touches[0];m=(y.clientX-a.left)/r,x=(y.clientY-a.top)/r}return(Number.isNaN(m)||Number.isNaN(x))&&console.error("No mouse or touch offset found"),{x:m,y:x}}var Eu=function(e,t,r,a,m){var x=e.transformState.scale,y=e.wrapperComponent,s=e.setup,i=s.maxScale,l=s.minScale,u=s.zoomAnimation,o=s.disablePadding,p=u.size,_=u.disabled;if(!y)throw new Error("Wrapper is not mounted");var C=x+t*r,g=a?!1:!_,n=Vt(Ge(C,3),l,i,p,g&&!o);return n},ku=function(e,t){var r=e.previousWheelEvent,a=e.transformState.scale,m=e.setup,x=m.maxScale,y=m.minScale;return r?a<x||a>y||Math.sign(r.deltaY)!==Math.sign(t.deltaY)||r.deltaY>0&&r.deltaY<t.deltaY||r.deltaY<0&&r.deltaY>t.deltaY||Math.sign(r.deltaY)!==Math.sign(t.deltaY):!1},Ru=function(e,t){var r=e.setup.pinch,a=r.disabled,m=r.excluded,x=e.isInitialized,y=t.target,s=x&&!a&&y;if(!s)return!1;var i=Dr(y,m);return!i},Du=function(e){var t=e.setup.pinch.disabled,r=e.isInitialized,a=e.pinchStartDistance,m=r&&!t&&a;return!!m},Au=function(e,t,r){var a=r.getBoundingClientRect(),m=e.touches,x=Ge(m[0].clientX-a.left,5),y=Ge(m[0].clientY-a.top,5),s=Ge(m[1].clientX-a.left,5),i=Ge(m[1].clientY-a.top,5);return{x:(x+s)/2/t,y:(y+i)/2/t}},Pn=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))},Tu=function(e,t){var r=e.pinchStartScale,a=e.pinchStartDistance,m=e.setup,x=m.maxScale,y=m.minScale,s=m.zoomAnimation,i=m.disablePadding,l=s.size,u=s.disabled;if(!r||a===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var o=t/a,p=o*r;return Vt(Ge(p,2),y,x,l,!u&&!i)},Lu=160,Mu=100,ju=function(e,t){var r=e.props,a=r.onWheelStart,m=r.onZoomStart;e.wheelStopEventTimer||(Je(e),Ce(be(e),t,a),Ce(be(e),t,m))},Nu=function(e,t){var r=e.props,a=r.onWheel,m=r.onZoom,x=e.contentComponent,y=e.setup,s=e.transformState,i=s.scale,l=y.limitToBounds,u=y.centerZoomedOut,o=y.zoomAnimation,p=y.wheel,_=y.disablePadding,C=y.smooth,g=o.size,n=o.disabled,d=p.step,c=p.smoothStep;if(!x)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var h=wu(t,null),v=C?c*Math.abs(t.deltaY):d,b=Eu(e,h,v,!t.ctrlKey);if(i!==b){var w=pt(e,b),k=Nn(t,x,i),S=n||g===0||u||_,E=l&&S,T=Rr(e,k.x,k.y,b,w,E),L=T.x,M=T.y;e.previousWheelEvent=t,e.setTransformState(b,L,M),Ce(be(e),t,a),Ce(be(e),t,m)}},Pu=function(e,t){var r=e.props,a=r.onWheelStop,m=r.onZoomStop;ss(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(Dn(e,t.x,t.y),e.wheelAnimationTimer=null)},Mu);var x=ku(e,t);x&&(ss(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Ce(be(e),t,a),Ce(be(e),t,m))},Lu))},On=function(e){for(var t=0,r=0,a=0;a<2;a+=1)t+=e.touches[a].clientX,r+=e.touches[a].clientY;var m=t/2,x=r/2;return{x:m,y:x}},Ou=function(e,t){var r=Pn(t);e.pinchStartDistance=r,e.lastDistance=r,e.pinchStartScale=e.transformState.scale,e.isPanning=!1;var a=On(t);e.pinchLastCenterX=a.x,e.pinchLastCenterY=a.y,Je(e)},Bu=function(e,t){var r=e.contentComponent,a=e.pinchStartDistance,m=e.wrapperComponent,x=e.transformState.scale,y=e.setup,s=y.limitToBounds,i=y.centerZoomedOut,l=y.zoomAnimation,u=y.alignmentAnimation,o=l.disabled,p=l.size;if(!(a===null||!r)){var _=Au(t,x,r);if(!(!Number.isFinite(_.x)||!Number.isFinite(_.y))){var C=Pn(t),g=Tu(e,C),n=On(t),d=n.x-(e.pinchLastCenterX||0),c=n.y-(e.pinchLastCenterY||0);if(!(g===x&&d===0&&c===0)){e.pinchLastCenterX=n.x,e.pinchLastCenterY=n.y;var h=pt(e,g),v=o||p===0||i,b=s&&v,w=Rr(e,_.x,_.y,g,h,b),k=w.x,S=w.y;e.pinchMidpoint=_,e.lastDistance=C;var E=u.sizeX,T=u.sizeY,L=ht(e,E),M=ht(e,T),N=k+d,I=S+c,F=Yt(N,I,h,s,L,M,m),H=F.x,z=F.y;e.setTransformState(g,H,z)}}}},Iu=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,Dn(e,t?.x,t?.y)},Bn=function(e,t){var r=e.props.onZoomStop,a=e.setup.doubleClick.animationTime;ss(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Ce(be(e),t,r)},a)},Fu=function(e,t){var r=e.props,a=r.onZoomStart,m=r.onZoom,x=e.setup.doubleClick,y=x.animationTime,s=x.animationType;Ce(be(e),t,a),Mn(e,y,s,function(){return Ce(be(e),t,m)}),Bn(e,t)};function Hu(e,t){return e==="toggle"?t===1?1:-1:e==="zoomOut"?-1:1}function zu(e,t){var r=e.setup,a=e.doubleClickStopEventTimer,m=e.transformState,x=e.contentComponent,y=m.scale,s=e.props,i=s.onZoomStart,l=s.onZoom,u=r.doubleClick,o=u.disabled,p=u.mode,_=u.step,C=u.animationTime,g=u.animationType;if(!o&&!a){if(p==="reset")return Fu(e,t);if(!x)return console.error("No ContentComponent found");var n=Hu(p,e.transformState.scale),d=Tn(e,n,_);if(y!==d){Ce(be(e),t,i);var c=Nn(t,x,y),h=Es(e,d,c.x,c.y);if(!h)return console.error("Error during zoom event. New transformation state was not calculated.");Ce(be(e),t,l),dt(e,h,C,g),Bn(e,t)}}}var Wu=function(e,t){var r=e.isInitialized,a=e.setup,m=e.wrapperComponent,x=a.doubleClick,y=x.disabled,s=x.excluded,i=t.target,l=m?.contains(i),u=r&&i&&l&&!y;if(!u)return!1;var o=Dr(i,s);return!o},Uu=(function(){function e(t){var r=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(){r.initializeWindowEvents()},this.unmount=function(){r.cleanupWindowEvents()},this.update=function(a){r.props=a,pt(r,r.transformState.scale),r.setup=di(a)},this.initializeWindowEvents=function(){var a,m,x=Kr(),y=(a=r.wrapperComponent)===null||a===void 0?void 0:a.ownerDocument,s=y?.defaultView;(m=r.wrapperComponent)===null||m===void 0||m.addEventListener("wheel",r.onWheelPanning,x),s?.addEventListener("mousedown",r.onPanningStart,x),s?.addEventListener("mousemove",r.onPanning,x),s?.addEventListener("mouseup",r.onPanningStop,x),y?.addEventListener("mouseleave",r.clearPanning,x),s?.addEventListener("keyup",r.setKeyUnPressed,x),s?.addEventListener("keydown",r.setKeyPressed,x)},this.cleanupWindowEvents=function(){var a,m,x=Kr(),y=(a=r.wrapperComponent)===null||a===void 0?void 0:a.ownerDocument,s=y?.defaultView;s?.removeEventListener("mousedown",r.onPanningStart,x),s?.removeEventListener("mousemove",r.onPanning,x),s?.removeEventListener("mouseup",r.onPanningStop,x),y?.removeEventListener("mouseleave",r.clearPanning,x),s?.removeEventListener("keyup",r.setKeyUnPressed,x),s?.removeEventListener("keydown",r.setKeyPressed,x),document.removeEventListener("mouseleave",r.clearPanning,x),Je(r),(m=r.observer)===null||m===void 0||m.disconnect()},this.handleInitializeWrapperEvents=function(a){var m=Kr();a.addEventListener("wheel",r.onWheelZoom,m),a.addEventListener("dblclick",r.onDoubleClick,m),a.addEventListener("touchstart",r.onTouchPanningStart,m),a.addEventListener("touchmove",r.onTouchPanning,m),a.addEventListener("touchend",r.onTouchPanningStop,m)},this.handleInitialize=function(a,m){var x=!1,y=r.setup.centerOnInit,s=function(i,l){for(var u=0,o=i;u<o.length;u++){var p=o[u];if(p.target===l)return!0}return!1};r.applyTransformation(),r.onInitCallbacks.forEach(function(i){i(be(r))}),r.observer=new ResizeObserver(function(i){if(s(i,a)||s(i,m))if(y&&!x){var l=m.offsetWidth,u=m.offsetHeight;(l>0||u>0)&&(x=!0,r.setCenter())}else Je(r),pt(r,r.transformState.scale),ws(r,0)}),r.observer.observe(a),r.observer.observe(m)},this.onWheelZoom=function(a){var m=r.setup.disabled;if(!m){var x=Cu(r,a);if(x){var y=r.isPressingKeys(r.setup.wheel.activationKeys);y&&(ju(r,a),Nu(r,a),Pu(r,a))}}},this.onWheelPanning=function(a){var m=r.setup,x=m.disabled,y=m.wheel,s=m.panning;if(!(!r.wrapperComponent||!r.contentComponent||x||!y.wheelDisabled||s.disabled||!s.wheelPanning||a.ctrlKey)){a.preventDefault(),a.stopPropagation();var i=r.transformState,l=i.positionX,u=i.positionY,o=l-a.deltaX,p=u-a.deltaY,_=s.lockAxisX?l:o,C=s.lockAxisY?u:p,g=r.setup.alignmentAnimation,n=g.sizeX,d=g.sizeY,c=ht(r,n),h=ht(r,d);_===l&&C===u||Rn(r,_,C,c,h)}},this.onPanningStart=function(a){var m=r.setup.disabled,x=r.props.onPanningStart;if(!m){var y=oi(r,a);if(y){var s=r.isPressingKeys(r.setup.panning.activationKeys);s&&(a.button===0&&!r.setup.panning.allowLeftClickPan||a.button===1&&!r.setup.panning.allowMiddleClickPan||a.button===2&&!r.setup.panning.allowRightClickPan||(a.preventDefault(),a.stopPropagation(),Je(r),ci(r,a),Ce(be(r),a,x)))}}},this.onPanning=function(a){var m=r.setup.disabled,x=r.props.onPanning;if(!m){var y=ai(r);if(y){var s=r.isPressingKeys(r.setup.panning.activationKeys);s&&(a.preventDefault(),a.stopPropagation(),hi(r,a.clientX,a.clientY),Ce(be(r),a,x))}}},this.onPanningStop=function(a){var m=r.props.onPanningStop;r.isPanning&&(uu(r),Ce(be(r),a,m))},this.onPinchStart=function(a){var m=r.setup.disabled,x=r.props,y=x.onPinchingStart,s=x.onZoomStart;if(!m){var i=Ru(r,a);i&&(Ou(r,a),Je(r),Ce(be(r),a,y),Ce(be(r),a,s))}},this.onPinch=function(a){var m=r.setup.disabled,x=r.props,y=x.onPinching,s=x.onZoom;if(!m){var i=Du(r);i&&(a.preventDefault(),a.stopPropagation(),Bu(r,a),Ce(be(r),a,y),Ce(be(r),a,s))}},this.onPinchStop=function(a){var m=r.props,x=m.onPinchingStop,y=m.onZoomStop;r.pinchStartScale&&(Iu(r),Ce(be(r),a,x),Ce(be(r),a,y))},this.onTouchPanningStart=function(a){var m=r.setup.disabled,x=r.props.onPanningStart;if(!m){var y=oi(r,a);if(y){var s=r.lastTouch&&+new Date-r.lastTouch<200&&a.touches.length===1;if(!s){r.lastTouch=+new Date,Je(r);var i=a.touches,l=i.length===1,u=i.length===2;l&&(Je(r),ci(r,a),Ce(be(r),a,x)),u&&r.onPinchStart(a)}}}},this.onTouchPanning=function(a){var m=r.setup.disabled,x=r.props.onPanning;if(r.isPanning&&a.touches.length===1){if(m)return;var y=ai(r);if(!y)return;a.preventDefault(),a.stopPropagation();var s=a.touches[0];hi(r,s.clientX,s.clientY),Ce(be(r),a,x)}else a.touches.length>1&&r.onPinch(a)},this.onTouchPanningStop=function(a){r.onPanningStop(a),r.onPinchStop(a)},this.onDoubleClick=function(a){var m=r.setup.disabled;if(!m){var x=Wu(r,a);x&&zu(r,a)}},this.clearPanning=function(a){r.isPanning&&r.onPanningStop(a)},this.setKeyPressed=function(a){r.pressedKeys[a.key]=!0},this.setKeyUnPressed=function(a){r.pressedKeys[a.key]=!1},this.isPressingKeys=function(a){return a.length?!!a.find(function(m){return r.pressedKeys[m]}):!0},this.setTransformState=function(a,m,x){var y=r.props.onTransformed;if(!Number.isNaN(a)&&!Number.isNaN(m)&&!Number.isNaN(x)){a!==r.transformState.scale&&(r.transformState.previousScale=r.transformState.scale,r.transformState.scale=a),r.transformState.positionX=m,r.transformState.positionY=x,r.applyTransformation();var s=be(r);r.onChangeCallbacks.forEach(function(i){return i(s)}),Ce(s,{scale:a,positionX:m,positionY:x},y)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(r.wrapperComponent&&r.contentComponent){var a=jn(r.transformState.scale,r.wrapperComponent,r.contentComponent);r.setTransformState(a.scale,a.positionX,a.positionY)}},this.handleTransformStyles=function(a,m,x){return r.props.customTransform?r.props.customTransform(a,m,x):Su(a,m,x)},this.applyTransformation=function(){if(!(!r.mounted||!r.contentComponent)){var a=r.transformState,m=a.scale,x=a.positionX,y=a.positionY,s=r.handleTransformStyles(x,y,m);r.contentComponent.style.transform=s}},this.getContext=function(){return be(r)},this.onChange=function(a){return r.onChangeCallbacks.has(a)||r.onChangeCallbacks.add(a),function(){r.onChangeCallbacks.delete(a)}},this.onInit=function(a){return r.onInitCallbacks.has(a)||r.onInitCallbacks.add(a),function(){r.onInitCallbacks.delete(a)}},this.init=function(a,m){r.cleanupWindowEvents(),r.wrapperComponent=a,r.contentComponent=m,pt(r,r.transformState.scale),r.handleInitializeWrapperEvents(a),r.handleInitialize(a,m),r.initializeWindowEvents(),r.isInitialized=!0;var x=be(r);Ce(x,void 0,r.props.onInit)},this.props=t,this.setup=di(this.props),this.transformState=An(this.props)}return e})(),Ar=Z.createContext(null),$u=function(e,t){return typeof e=="function"?e(t):e},Ku=Z.forwardRef(function(e,t){var r=R.useRef(new Uu(e)).current,a=$u(e.children,fr(r));return R.useImperativeHandle(t,function(){return fr(r)},[r]),R.useEffect(function(){r.update(e)},[r,e]),Z.createElement(Ar.Provider,{value:r},a)});Z.forwardRef(function(e,t){var r=R.useRef(null),a=R.useContext(Ar);return R.useEffect(function(){return a.onChange(function(m){if(r.current){var x=0,y=0;r.current.style.transform=a.handleTransformStyles(x,y,1/m.instance.transformState.scale)}})},[a]),Z.createElement("div",ct({},e,{ref:xu([r,t])}))});function qu(e,t){t===void 0&&(t={});var r=t.insertAt;if(!(typeof document>"u")){var a=document.head||document.getElementsByTagName("head")[0],m=document.createElement("style");m.type="text/css",r==="top"&&a.firstChild?a.insertBefore(m,a.firstChild):a.appendChild(m),m.styleSheet?m.styleSheet.cssText=e:m.appendChild(document.createTextNode(e))}}var Xu=`.transform-component-module_wrapper__SPB86 {
|
|
31
|
+
position: relative;
|
|
32
|
+
width: -moz-fit-content;
|
|
33
|
+
width: fit-content;
|
|
34
|
+
height: -moz-fit-content;
|
|
35
|
+
height: fit-content;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
38
|
+
-webkit-user-select: none; /* Safari */
|
|
39
|
+
-khtml-user-select: none; /* Konqueror HTML */
|
|
40
|
+
-moz-user-select: none; /* Firefox */
|
|
41
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
42
|
+
user-select: none;
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
transform: translate3d(0, 0, 0);
|
|
46
|
+
}
|
|
47
|
+
.transform-component-module_content__FBWxo {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-wrap: wrap;
|
|
50
|
+
width: -moz-fit-content;
|
|
51
|
+
width: fit-content;
|
|
52
|
+
height: -moz-fit-content;
|
|
53
|
+
height: fit-content;
|
|
54
|
+
margin: 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
transform-origin: 0% 0%;
|
|
57
|
+
}
|
|
58
|
+
.transform-component-module_content__FBWxo img {
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
}
|
|
61
|
+
`,fi={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};qu(Xu);var Yu=function(e){var t=e.children,r=e.wrapperClass,a=r===void 0?"":r,m=e.contentClass,x=m===void 0?"":m,y=e.wrapperStyle,s=e.contentStyle,i=e.wrapperProps,l=i===void 0?{}:i,u=e.contentProps,o=u===void 0?{}:u,p=R.useContext(Ar),_=p.init,C=p.cleanupWindowEvents,g=R.useRef(null),n=R.useRef(null);return R.useEffect(function(){var d=g.current,c=n.current;return d!==null&&c!==null&&_&&_?.(d,c),function(){C?.()}},[]),Z.createElement("div",ct({},l,{ref:g,className:"".concat(ts.wrapperClass," ").concat(fi.wrapper," ").concat(a),style:y}),Z.createElement("div",ct({},o,{ref:n,className:"".concat(ts.contentClass," ").concat(fi.content," ").concat(x),style:s}),t))},In=function(){var e=R.useContext(Ar);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},Vu=function(){var e=In();return fr(e)};function Gu(e){var t=In(),r=R.useState(e(rs(t))),a=r[0],m=r[1];return R.useEffect(function(){var x=!0,y=t.onChange(function(s){x&&m(e(rs(s.instance)))});return function(){y(),x=!1}},[e,t]),a}function Qu(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 Zu(e,t){return ut({queryKey:ce.files.tree(e||"",t),queryFn:()=>de.get("/files/tree",{params:{workingDir:e||"",path:t}}),enabled:!!e})}function Ju(e,t){return ut({queryKey:ce.files.content(e||"",t||""),queryFn:()=>de.get("/files/read",{params:{workingDir:e||"",path:t||""}}),enabled:!!e&&!!t})}function ed(e){const t=De();return R.useCallback(()=>{e&&t.invalidateQueries({queryKey:["files","tree",e]})},[t,e])}function td(){const e=De();return Ue({mutationFn:t=>de.post("/files/write",t),onSuccess:(t,r)=>{const a=ce.files.content(r.workingDir,r.path),m=e.getQueryData(a);e.setQueryData(a,{content:r.content,language:m?.language||Qu(r.path)})}})}function rd(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function sd(e,t){return e==="/"?t:`${e.slice(1)}/${t}`}const id=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function nd(e){if(e.type==="directory")return null;const t=e.name.split(".").pop()?.toLowerCase();return t&&id.has(t)?fs:t==="ts"||t==="tsx"||t==="js"||t==="jsx"?Vr:t==="json"?zo:t==="md"||t==="mdx"||t==="txt"?$i:ko}const pi=({depth:e,active:t,onClick:r,leftIcon:a,rightIcon:m,label:x})=>f.jsxs("button",{type:"button",onClick:r,className:Oe("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:[f.jsx("span",{className:"shrink-0",children:m}),f.jsx("span",{className:"shrink-0 text-neutral-500",children:a}),f.jsx("span",{className:"truncate text-neutral-700",children:x})]}),Fn=({workingDir:e,path:t,depth:r,expanded:a,toggleDir:m,onFileSelect:x,selectedFilePath:y})=>{const{data:s,isLoading:i,isError:l}=Zu(e,t),u=R.useMemo(()=>s?.items??[],[s?.items]);return i?f.jsx("div",{className:"text-xs text-neutral-400 px-2 py-1",style:{paddingLeft:8+r*14},children:"Loading..."}):l?f.jsx("div",{className:"text-xs text-red-600 px-2 py-1",style:{paddingLeft:8+r*14},children:"Failed to load"}):f.jsx("div",{className:"space-y-0.5",children:u.map(o=>{if(o.type==="directory"){const n=rd(t,o.name),d=a.has(n);return f.jsxs("div",{children:[f.jsx(pi,{depth:r,onClick:()=>m(n),rightIcon:d?f.jsx(xt,{size:14,className:"text-neutral-400"}):f.jsx(mr,{size:14,className:"text-neutral-400"}),leftIcon:d?f.jsx(Ki,{size:14,className:"text-amber-500"}):f.jsx(Eo,{size:14,className:"text-amber-500"}),label:o.name}),d&&f.jsx(Fn,{workingDir:e,path:n,depth:r+1,expanded:a,toggleDir:m,onFileSelect:x,selectedFilePath:y})]},n)}const p=sd(t,o.name),_=nd(o),C=y===p,g=_===fs;return f.jsx(pi,{depth:r,active:C,onClick:()=>x(p),rightIcon:f.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:_?f.jsx(_,{size:14,className:g?"text-emerald-600":"text-sky-600"}):null,label:o.name},p)})})},od=({workingDir:e,className:t,onFileSelect:r,selectedFilePath:a,onCollapse:m})=>{const[x,y]=R.useState(()=>new Set),s=ed(e),i=R.useCallback(l=>{y(u=>{const o=new Set(u);return o.has(l)?o.delete(l):o.add(l),o})},[]);return f.jsxs("div",{className:Oe("h-full flex flex-col",t),children:[f.jsxs("div",{className:"px-3 py-2 border-b border-neutral-200 bg-neutral-50/80 flex items-center justify-between",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"text-[11px] font-semibold text-neutral-600 uppercase tracking-wider",children:"Files"}),f.jsx("div",{className:"text-[11px] text-neutral-400 truncate",children:e||"No workingDir"})]}),f.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&f.jsx("button",{type:"button",onClick:s,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:"Refresh file tree",children:f.jsx(_a,{size:13})}),m&&f.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:f.jsx(la,{size:13})})]})]}),f.jsx("div",{className:"flex-1 overflow-auto p-2",children:e?f.jsx(Fn,{workingDir:e,path:"/",depth:0,expanded:x,toggleDir:i,onFileSelect:r,selectedFilePath:a}):f.jsx("div",{className:"text-xs text-neutral-500 px-2 py-2",children:"No workspace selected."})})]})},ad=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function ld(e){const t=e.split(".").pop()?.toLowerCase();return t?ad.has(t):!1}function cd(e,t){const r="/api",a=new URLSearchParams({workingDir:e,path:t});if(os()){const m=as();m&&a.set("token",m)}return`${r}/files/image?${a.toString()}`}const hd=({filePath:e})=>{const{zoomIn:t,zoomOut:r,centerView:a}=Vu(),m=Gu(y=>y.state.scale),x=Math.round(m*100);return f.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:[f.jsx("button",{type:"button",onClick:()=>r(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Zoom out",children:f.jsx(Ra,{size:14})}),f.jsxs("button",{type:"button",onClick:()=>a(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:[x,"%"]}),f.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:f.jsx(Ea,{size:14})}),f.jsx("button",{type:"button",onClick:()=>a(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:f.jsx(ia,{size:13})}),f.jsx("span",{className:"ml-2 text-[11px] text-neutral-400 truncate",children:e})]})},ud=({workingDir:e,filePath:t})=>{const[r,a]=R.useState(!1),m=cd(e,t);return r?f.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"Failed to load image."}):f.jsx(Ku,{initialScale:1,minScale:.1,maxScale:10,centerOnInit:!0,doubleClick:{mode:"toggle"},children:f.jsxs("div",{className:"h-full flex flex-col",children:[f.jsx(hd,{filePath:t}),f.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:f.jsx(Yu,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:f.jsx("img",{src:m,alt:t,className:"max-w-full max-h-full object-contain rounded shadow-sm",draggable:!1,onError:()=>a(!0)})})})]})})};function dd(e){const t=e.split("/");return t[t.length-1]||e}function fd(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 pd=({active:e,name:t,isDirty:r,onClick:a,onClose:m})=>f.jsxs("button",{type:"button",onClick:a,className:Oe("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:[f.jsx("span",{className:Oe("w-2 h-2 rounded-full",r?"bg-amber-500":"bg-transparent")}),f.jsx("span",{className:"truncate flex-1 text-left text-xs",children:t}),f.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:f.jsx(_r,{size:12})})]}),md=({workingDir:e,className:t})=>{const[r,a]=R.useState([]),[m,x]=R.useState(null),y=td(),[s,i]=R.useState(280),[l,u]=R.useState(!1),[o,p]=R.useState(!1),_=R.useRef(280),C=R.useCallback(()=>{u(L=>(L?i(_.current):_.current=s,!L))},[s]),g=R.useCallback(L=>{L.preventDefault(),p(!0);const M=L.clientX,N=s,I=H=>{const z=H.clientX-M,D=Math.min(480,Math.max(160,N+z));i(D)},F=()=>{p(!1),document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",F)};document.addEventListener("mousemove",I),document.addEventListener("mouseup",F)},[s]);R.useEffect(()=>{a([]),x(null)},[e]);const n=R.useMemo(()=>r.find(L=>L.path===m)||null,[r,m]),{data:d,isFetching:c,isError:h,error:v}=Ju(e,n?.isImage?null:m);R.useEffect(()=>{!m||!d||a(L=>L.map(M=>M.path!==m||M.isDirty||M.loaded?M:{...M,language:d.language||M.language,content:d.content,savedContent:d.content,isDirty:!1,loaded:!0}))},[m,d]);const b=R.useCallback(L=>{a(M=>{if(M.find(F=>F.path===L))return M;const I=ld(L);return[...M,{path:L,name:dd(L),language:fd(L),content:"",savedContent:"",isDirty:!1,loaded:I,isImage:I}]}),x(L)},[]),w=R.useCallback(L=>{a(M=>{const N=M.filter(I=>I.path!==L);return x(I=>I!==L?I:N.length?N[N.length-1].path:null),N})},[]),k=R.useCallback(L=>{a(M=>M.map(N=>{if(N.path!==m)return N;const I=L!==N.savedContent;return{...N,content:L,isDirty:I}}))},[m]),S=R.useCallback(async()=>{!e||!n||(await y.mutateAsync({workingDir:e,path:n.path,content:n.content}),a(L=>L.map(M=>M.path===n.path?{...M,savedContent:M.content,isDirty:!1,loaded:!0}:M)))},[e,n,y]),E=R.useRef(()=>{});R.useEffect(()=>{E.current=()=>{S().catch(()=>{})}},[S]),R.useEffect(()=>{const L=M=>{(M.metaKey||M.ctrlKey)&&M.key.toLowerCase()==="s"&&(M.preventDefault(),E.current())};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[]);const T=R.useCallback((L,M)=>{L.addCommand(M.KeyMod.CtrlCmd|M.KeyCode.KeyS,()=>{E.current()})},[]);return f.jsxs("div",{className:Oe("flex h-full overflow-hidden bg-white",t),style:o?{userSelect:"none",cursor:"col-resize"}:void 0,children:[f.jsx("div",{className:"border-r border-neutral-200 bg-white shrink-0 overflow-hidden relative",style:{width:l?36:s,transition:o?"none":"width 0.15s ease"},children:l?f.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:f.jsx("button",{type:"button",onClick:C,className:"p-1.5 rounded hover:bg-neutral-100 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Expand file tree",children:f.jsx(ha,{size:16})})}):f.jsx(f.Fragment,{children:f.jsx(od,{workingDir:e,onFileSelect:b,selectedFilePath:n?.path||null,onCollapse:C},e||"no-working-dir")})}),!l&&f.jsx("div",{onMouseDown:g,className:Oe("w-1 shrink-0 cursor-col-resize transition-colors",o?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),f.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[f.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:[r.length===0?f.jsx("div",{className:"px-2 pb-2 text-xs text-neutral-500",children:"No open files"}):r.map(L=>f.jsx(pd,{active:L.path===m,name:L.name,isDirty:L.isDirty,onClick:()=>x(L.path),onClose:M=>{M.stopPropagation(),w(L.path)}},L.path)),f.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[y.isPending&&f.jsxs("span",{className:"flex items-center gap-2 text-xs text-neutral-500",children:[f.jsx(Qe,{size:14,className:"animate-spin"}),"Saving"]}),n?.isDirty&&!y.isPending&&f.jsx("span",{className:"text-[11px] text-amber-600",children:"Unsaved"})]})]}),f.jsx("div",{className:"flex-1 min-h-0 relative",children:e?n?n.isImage?f.jsx(ud,{workingDir:e,filePath:n.path}):f.jsxs(f.Fragment,{children:[f.jsx(Oh,{path:n.path,value:n.content,language:n.language,theme:"vs-light",height:"100%",onChange:L=>k(L??""),onMount:T,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0}}),c&&!n.loaded&&f.jsx("div",{className:"absolute inset-0 bg-white/60 flex items-center justify-center",children:f.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-600",children:[f.jsx(Qe,{size:14,className:"animate-spin"}),"Loading file..."]})}),h&&f.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}`:"","."]})]}):f.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"Select a file from the tree to open."}):f.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"No workspace selected."})})]})]})};function Hn(e){return ut({queryKey:ce.git.changes(e||""),queryFn:()=>de.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e})}function zn(e,t,r){return ut({queryKey:ce.git.diff(e||"",t||"",r),queryFn:()=>de.get("/git/diff",{params:{workingDir:e||"",path:t||"",type:r}}),enabled:!!e&&!!t})}const mi={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"},vd={M:"Modified",A:"Added",D:"Deleted",R:"Renamed"};function _d(e){const t=e.split("/");return t[t.length-1]||e}function gd(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}const bd=({entry:e,selected:t,onClick:r})=>{const a=mi[e.status]||mi.M,m=vd[e.status]||e.status,x=gd(e.path);return f.jsxs("button",{type:"button",onClick:r,className:Oe("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:[f.jsx("span",{className:Oe("w-4 h-4 flex items-center justify-center text-[10px] font-bold border rounded-sm shrink-0",a),title:m,children:e.status}),f.jsx("span",{className:"text-xs text-neutral-900 truncate",children:_d(e.path)}),x&&f.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:x})]})},vi=({title:e,entries:t,type:r,selectedKey:a,onSelect:m})=>t.length===0?null:f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:e}),f.jsx("span",{className:"text-[10px] text-neutral-400",children:t.length})]}),f.jsx("div",{className:"space-y-0.5",children:t.map(x=>{const y=`${r}:${x.path}`;return f.jsx(bd,{entry:x,selected:a===y,onClick:()=>m(x.path,r)},y)})})]}),Sd=({line:e,lineNum:t})=>{let r="",a="text-neutral-700";return e.startsWith("+")&&!e.startsWith("+++")?(r="bg-emerald-50",a="text-emerald-800"):e.startsWith("-")&&!e.startsWith("---")?(r="bg-red-50",a="text-red-800"):e.startsWith("@@")?(r="bg-blue-50",a="text-blue-700"):(e.startsWith("diff ")||e.startsWith("index "))&&(a="text-neutral-400"),f.jsxs("div",{className:Oe("flex",r),children:[f.jsx("span",{className:"w-10 shrink-0 text-right pr-2 text-neutral-400 select-none border-r border-neutral-100",children:t}),f.jsx("span",{className:Oe("pl-2 whitespace-pre",a),children:e})]})},xd=({workingDir:e,filePath:t,type:r})=>{const{data:a,isLoading:m,isError:x}=zn(e,t,r);if(m)return f.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500",children:[f.jsx(Qe,{size:16,className:"animate-spin mr-2"}),f.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(x)return f.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-xs",children:"Failed to load diff."});const y=a?.diff||"";if(!y.trim())return f.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-xs",children:"No diff content available."});const s=y.split(`
|
|
62
|
+
`);return f.jsx("div",{className:"flex-1 overflow-auto font-mono text-xs leading-5",children:s.map((i,l)=>f.jsx(Sd,{line:i,lineNum:l+1},l))})},Cd=({workingDir:e})=>{const{data:t,isLoading:r,isError:a}=Hn(e),[m,x]=R.useState(null),y=m?`${m.type}:${m.path}`:null,s=(o,p)=>{x({path:o,type:p})};if(!e)return f.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-500 text-sm bg-white h-full",children:"No workspace selected."});if(r)return f.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500 bg-white h-full",children:[f.jsx(Qe,{size:16,className:"animate-spin mr-2"}),f.jsx("span",{className:"text-sm",children:"Loading changes..."})]});if(a)return f.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 i=t?.uncommitted||[],l=t?.committed||[],u=i.length+l.length;return f.jsxs("div",{className:"flex h-full bg-white",children:[f.jsxs("div",{className:"w-[260px] border-r border-neutral-200 flex flex-col shrink-0",children:[f.jsx("div",{className:"px-3 py-2.5 border-b border-neutral-100 shrink-0",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(It,{size:14,className:"text-neutral-500"}),f.jsx("span",{className:"text-xs font-semibold text-neutral-900",children:"Changes"}),u>0&&f.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:u})]})}),f.jsx("div",{className:"flex-1 overflow-auto p-1.5",children:u===0?f.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-neutral-400",children:[f.jsx(It,{size:28,className:"mb-2"}),f.jsx("span",{className:"text-xs",children:"No pending changes"})]}):f.jsxs("div",{className:"space-y-2",children:[f.jsx(vi,{title:"Uncommitted",entries:i,type:"uncommitted",selectedKey:y,onSelect:s}),f.jsx(vi,{title:"Committed",entries:l,type:"committed",selectedKey:y,onSelect:s})]})})]}),f.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:m?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"px-3 py-2 border-b border-neutral-100 flex items-center gap-2 shrink-0",children:[f.jsx(Vr,{size:14,className:"text-neutral-500"}),f.jsx("span",{className:"text-xs font-medium text-neutral-700 truncate",children:m.path}),f.jsxs("span",{className:"text-[10px] text-neutral-400",children:["(",m.type,")"]})]}),f.jsx(xd,{workingDir:e,filePath:m.path,type:m.type})]}):f.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:f.jsxs("div",{className:"flex flex-col items-center gap-2",children:[f.jsx(Vr,{size:28}),f.jsx("span",{className:"text-xs",children:"Select a file to view diff"})]})})})]})},yd=[{key:"changes",label:"Changes",icon:f.jsx(It,{size:14})},{key:"editor",label:"Editor",icon:f.jsx(br,{size:14})},{key:"terminal",label:"Terminal",icon:f.jsx(nr,{size:14})},{key:"preview",label:"Preview",icon:f.jsx(vr,{size:14})}],wd=[{key:"editor",label:"Editor",icon:f.jsx(br,{size:14})},{key:"terminal",label:"Terminal",icon:f.jsx(nr,{size:14})},{key:"preview",label:"Preview",icon:f.jsx(vr,{size:14})}],Ed=({active:e,onClick:t,icon:r,label:a})=>f.jsxs("button",{onClick:t,className:Oe("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:[r,f.jsx("span",{children:a})]}),kd=({icon:e,title:t})=>f.jsx("div",{className:"flex-1 flex items-center justify-center bg-white",children:f.jsxs("div",{className:"flex flex-col items-center gap-2 text-neutral-400",children:[e,f.jsx("span",{className:"text-sm font-medium text-neutral-500",children:t}),f.jsx("span",{className:"text-xs",children:"Coming soon..."})]})}),Wn=Z.memo(function({className:t,sessionId:r,workingDir:a,projectId:m,hideChanges:x}){const y=x?wd:yd,[s,i]=R.useState(x?"editor":"changes"),{data:l}=Ro(m??""),u=R.useMemo(()=>{if(!l?.quickCommands)return[];try{return JSON.parse(l.quickCommands)}catch{return[]}},[l?.quickCommands]),[o,p]=R.useState([]),_=R.useRef(void 0);return R.useEffect(()=>{a&&a!==_.current&&(_.current=a,p(C=>C.includes(a)?C:[...C,a]))},[a]),f.jsxs("div",{className:Oe("flex flex-col h-full bg-white",t),children:[f.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:y.map(C=>f.jsx(Ed,{active:s===C.key,onClick:()=>i(C.key),icon:C.icon,label:C.label},C.key))}),f.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[s==="editor"&&f.jsx(md,{workingDir:a}),o.map(C=>f.jsx("div",{className:"h-full absolute inset-0",style:{display:s==="terminal"&&a===C?"block":"none"},children:f.jsx(Rc,{cwd:C,quickCommands:u})},C)),s==="preview"&&f.jsx(kd,{icon:f.jsx(vr,{size:32}),title:"Preview"}),s==="changes"&&f.jsx(Cd,{workingDir:a})]})]})});function Un(e){return ut({queryKey:ce.workspaces.list(e),queryFn:()=>de.get(`/tasks/${e}/workspaces`),enabled:!!e})}function Rd(e){const t=De();return Ue({mutationFn:r=>de.post(`/tasks/${e}/workspaces`,r),onSuccess:()=>{t.invalidateQueries({queryKey:ce.workspaces.list(e)}),t.invalidateQueries({queryKey:ce.tasks.all})}})}function Dd(){const e=De();return Ue({mutationFn:({id:t,commitMessage:r})=>de.post(`/workspaces/${t}/merge`,{commitMessage:r}),onSuccess:()=>{e.invalidateQueries({queryKey:ce.workspaces.all}),e.invalidateQueries({queryKey:ce.tasks.all})}})}function ks(){return Ue({mutationFn:({workspaceId:e,editorType:t})=>de.post(`/workspaces/${e}/open-editor`,{editorType:t})})}function $n(e){return ut({queryKey:ce.workspaces.gitStatus(e),queryFn:()=>de.get(`/workspaces/${e}/git-status`),enabled:!!e})}function Ad(){const e=De();return Ue({mutationFn:t=>de.post(`/workspaces/${t}/rebase`),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:ce.workspaces.gitStatus(r)})},onError:(t,r)=>{e.invalidateQueries({queryKey:ce.workspaces.gitStatus(r)})}})}function Td(){const e=De();return Ue({mutationFn:t=>de.post(`/workspaces/${t}/abort-operation`),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:ce.workspaces.gitStatus(r)})}})}const _i=1500,Ld=3e3;function Md(e){const[t,r]=R.useState(null),a=R.useRef(0),m=R.useRef(null),x=R.useRef(null);return R.useEffect(()=>{if(!e)return;const y=()=>{x.current&&(clearTimeout(x.current),x.current=null)},s=nt.connect();s.emit(st.SUBSCRIBE,{topic:"task",id:e},u=>{});const i=u=>{r(u),x.current=setTimeout(()=>r(null),Ld)},l=u=>{if(u.taskId!==e)return;const o={status:u.status,currentCommand:u.currentCommand,currentIndex:u.currentIndex,totalCommands:u.totalCommands,error:u.error};if(u.status==="running"){y(),m.current=null,a.current===0&&(a.current=Date.now()),r(o);return}const p=a.current>0?Date.now()-a.current:0,_=_i-p;a.current===0?(a.current=Date.now(),r({status:"running",totalCommands:u.totalCommands,currentIndex:u.totalCommands}),m.current=o,x.current=setTimeout(()=>i(o),_i)):_>0?(m.current=o,y(),x.current=setTimeout(()=>i(o),_)):i(o)};return s.on(Ne.WORKSPACE_SETUP_PROGRESS,l),()=>{s.off(Ne.WORKSPACE_SETUP_PROGRESS,l),y(),a.current=0,m.current=null}},[e]),t}function Kn(){const e=De();return Ue({mutationFn:t=>de.post(`/sessions/${t}/start`),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:ce.sessions.detail(r)})}})}function qn(){const e=De();return Ue({mutationFn:t=>de.post(`/sessions/${t}/stop`),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:ce.sessions.detail(r)})}})}function Rs(){const e=De();return Ue({mutationFn:({id:t,message:r})=>de.post(`/sessions/${t}/message`,{message:r}),onSuccess:()=>{e.invalidateQueries({queryKey:ce.workspaces.all})}})}function Xn(e,t){return R.useMemo(()=>{for(let r=e.length-1;r>=0;r--){const a=e[r];if(a.tokenUsage&&typeof a.tokenUsage.totalTokens=="number"&&a.tokenUsage.totalTokens>0)return{totalTokens:a.tokenUsage.totalTokens,modelContextWindow:a.tokenUsage.modelContextWindow}}return t??null},[e,t])}const jd="/api";async function Nd(e){const t=new FormData;t.append("file",e);const r={};if(os()){const m=as();m&&(r.Authorization=`Bearer ${m}`)}const a=await fetch(`${jd}/attachments/upload`,{method:"POST",body:t,headers:r});if(!a.ok){const m=await a.json().catch(()=>({}));throw new Error(m.error||`Upload failed (${a.status})`)}return a.json()}let Pd=0;function Yn(){const[e,t]=R.useState([]),r=R.useRef(e);r.current=e;const a=R.useCallback(async l=>{const u=l.map(o=>({tempId:`tmp-${++Pd}`,file:o,progress:0,status:"uploading"}));t(o=>[...o,...u]),await Promise.allSettled(u.map(async o=>{try{const p=await Nd(o.file);t(_=>_.map(C=>C.tempId===o.tempId?{...C,status:"done",progress:100,attachment:p}:C))}catch(p){t(_=>_.map(C=>C.tempId===o.tempId?{...C,status:"error",error:p instanceof Error?p.message:"Upload failed"}:C))}}))},[]),m=R.useCallback(l=>{t(u=>u.filter(o=>o.tempId!==l))},[]),x=R.useCallback(()=>{t([])},[]),y=R.useCallback(()=>{const l=r.current.filter(u=>u.status==="done"&&u.attachment);return l.length===0?"":l.map(u=>{const o=u.attachment;return`${o.mimeType.startsWith("image/")?"!":""}[${o.originalName}](${o.storagePath})`}).join(`
|
|
63
|
+
`)},[]),s=e.length>0,i=e.some(l=>l.status==="uploading");return{files:e,addFiles:a,removeFile:m,clear:x,buildMarkdownLinks:y,hasFiles:s,isUploading:i}}const Od="/api";function Bd(e){if(!os())return e;const t=as();if(!t)return e;const r=e.includes("?")?"&":"?";return`${e}${r}token=${encodeURIComponent(t)}`}function Id(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Vn({files:e,onRemove:t}){return e.length===0?null:f.jsx("div",{className:"flex flex-wrap gap-2 px-4 pt-3 pb-1",children:e.map(r=>f.jsx(Fd,{item:r,onRemove:t},r.tempId))})}function Fd({item:e,onRemove:t}){const r=e.file.type.startsWith("image/"),a=e.status==="error",m=e.status==="uploading";return f.jsxs("div",{className:`relative group flex items-center gap-2 px-3 py-2 rounded-lg border text-xs max-w-[200px] ${a?"border-red-200 bg-red-50 text-red-600":"border-neutral-200 bg-neutral-50 text-neutral-700"}`,children:[r&&e.status==="done"&&e.attachment?f.jsx("img",{src:Bd(`${Od}${e.attachment.url}`),alt:e.file.name,className:"w-8 h-8 rounded object-cover flex-shrink-0"}):f.jsx("span",{className:"flex-shrink-0",children:m?f.jsx(Qe,{size:16,className:"animate-spin text-neutral-400"}):r?f.jsx(fs,{size:16,className:"text-neutral-400"}):f.jsx($i,{size:16,className:"text-neutral-400"})}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"truncate font-medium",children:e.file.name}),a?f.jsx("div",{className:"truncate text-red-500",children:e.error}):f.jsx("div",{className:"text-neutral-400",children:Id(e.file.size)})]}),f.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:f.jsx(_r,{size:10})})]})}function Gn({isOpen:e,onClose:t,taskId:r,taskTitle:a,taskDescription:m}){const[x,y]=R.useState([]),[s,i]=R.useState(""),[l,u]=R.useState(""),[o,p]=R.useState("idle"),[_,C]=R.useState(null),g=De(),n=Rd(r),d=Kn();R.useEffect(()=>{e&&de.get("/demo/agents").then(b=>{y(b.agents);const w=b.agents.find(k=>k.available);w&&i(w.type)})},[e]),R.useEffect(()=>{if(e){const b=[a];m&&b.push(m),u(b.join(`
|
|
64
|
+
|
|
65
|
+
`)),p("idle"),C(null)}},[e,a,m]);const c=o!=="idle",h=async()=>{if(!(!s||!l.trim())){C(null);try{p("creating-workspace");const b=await n.mutateAsync({});p("creating-session");const w=await de.post(`/workspaces/${b.id}/sessions`,{agentType:s,prompt:l.trim()});p("starting-session"),await d.mutateAsync(w.id),await g.invalidateQueries({queryKey:ce.workspaces.list(r)}),p("idle"),t()}catch(b){p("idle"),C(b instanceof Error?b.message:"启动失败,请重试")}}},v={idle:"启动","creating-workspace":"创建工作空间...","creating-session":"创建会话...","starting-session":"启动 Agent..."};return f.jsx(gr,{isOpen:e,onClose:c?()=>{}:t,title:"启动 Agent",action:f.jsxs(f.Fragment,{children:[f.jsx(it,{variant:"outline",onClick:t,disabled:c,children:"取消"}),f.jsx(it,{onClick:h,disabled:c||!s||!l.trim(),children:v[o]})]}),children:f.jsxs("div",{className:"space-y-5",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-2",children:"选择 Agent"}),f.jsxs("div",{className:"flex gap-2 flex-wrap",children:[x.length===0&&f.jsx("span",{className:"text-sm text-neutral-400",children:"加载中..."}),x.map(b=>f.jsxs(it,{variant:s===b.type?"default":"outline",size:"sm",disabled:!b.available||c,onClick:()=>i(b.type),children:[b.name,b.available&&b.version&&` (${b.version})`,!b.available&&" (不可用)"]},b.type))]})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-2",children:"任务描述"}),f.jsx("textarea",{value:l,onChange:b=>u(b.target.value),rows:5,disabled:c,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"})]}),_&&f.jsx("div",{className:"text-sm text-red-600 bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:_})]})})}const Qn=({isOpen:e,onClose:t,onConfirm:r,title:a,description:m,confirmText:x="确认",cancelText:y="取消",variant:s="default",isLoading:i=!1})=>{const l=s==="danger";return f.jsx(gr,{isOpen:e,onClose:t,title:a,className:"max-w-sm",action:f.jsxs(f.Fragment,{children:[f.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:y}),f.jsx("button",{onClick:r,disabled:i,className:Oe("px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50",l?"bg-red-500 text-white hover:bg-red-600":"bg-neutral-900 text-white hover:bg-black"),children:i?"处理中...":x})]}),children:f.jsxs("div",{className:"flex gap-4",children:[l&&f.jsx("div",{className:"shrink-0 w-10 h-10 rounded-full bg-red-50 flex items-center justify-center",children:f.jsx(ps,{size:20,className:"text-red-500"})}),f.jsx("div",{className:"text-sm text-neutral-600 leading-relaxed pt-1",children:m})]})})};function Hd({workspaceId:e,gitStatus:t,onResolve:r}){const a=Td();if(t.operation==="idle"||t.conflictedFiles.length===0)return null;const m=t.operation==="rebase"?"Rebase":"Merge";return f.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:[f.jsx(ps,{size:18,className:"text-amber-600 shrink-0"}),f.jsx("div",{className:"flex-1 min-w-0",children:f.jsxs("p",{className:"text-sm font-medium text-amber-900",children:[m," 冲突 — ",t.conflictedFiles.length," 个文件"]})}),f.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[f.jsx(it,{variant:"outline",size:"sm",onClick:()=>a.mutate(e),disabled:a.isPending,children:"中止操作"}),f.jsx(it,{size:"sm",onClick:r,children:"解决冲突"})]})]})}function zd(e,t,r,a){const m=r.map(x=>`- ${x}`).join(`
|
|
66
|
+
`);return a===Jr.REBASE?["## Rebase 冲突解决","",`在将分支 \`${e}\` rebase 到 \`${t}\` 时发生了冲突。`,"","### 冲突文件",m,"","### 解决步骤","1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git rebase --continue` 继续 rebase 流程"].join(`
|
|
67
|
+
`):["## Merge 冲突解决","",`在将分支 \`${e}\` 合并到 \`${t}\` 时发生了冲突。`,"","### 冲突文件",m,"","### 解决步骤","1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git commit` 完成合并"].join(`
|
|
68
|
+
`)}function Wd({open:e,onOpenChange:t,workspaceId:r,conflictOp:a,conflictedFiles:m,sourceBranch:x,targetBranch:y,sessions:s}){const[i,l]=R.useState(""),u=Rs(),o=ks(),p=()=>{if(!i)return;const g=zd(x,y,m,a);u.mutate({id:i,message:g},{onSuccess:()=>t(!1)})},_=()=>{o.mutate({workspaceId:r},{onSuccess:()=>t(!1)})},C=a==="REBASE"?"Rebase":"Merge";return f.jsx(gr,{isOpen:e,onClose:()=>t(!1),title:`解决 ${C} 冲突`,action:f.jsxs("div",{className:"flex gap-2",children:[f.jsx(it,{variant:"outline",onClick:_,children:"在 IDE 中打开"}),f.jsx(it,{onClick:p,disabled:!i||u.isPending,children:u.isPending?"发送中...":"AI 辅助解决"})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsxs("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:["冲突文件(",m.length,")"]}),f.jsx("div",{className:"max-h-40 overflow-y-auto rounded-md border border-neutral-200 bg-neutral-50",children:m.map(g=>f.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))})]}),s.length>0&&f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:"选择 Session(AI 辅助解决)"}),f.jsxs("select",{value:i,onChange:g=>l(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:[f.jsx("option",{value:"",children:"选择一个 Session..."}),s.map(g=>f.jsxs("option",{value:g.id,children:[g.agentType," — ",g.status]},g.id))]})]}),s.length===0&&f.jsx("p",{className:"text-sm text-neutral-500",children:"没有可用的 Session,请在 IDE 中手动解决冲突。"})]})})}function ft({children:e,variant:t}){const r={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 f.jsx("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${r[t]}`,children:e})}function Ud({gitStatus:e,branchName:t,targetBranch:r}){return f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:t}),f.jsx(zi,{size:14,className:"text-neutral-400"}),f.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:r})]}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.hasUncommittedChanges&&f.jsxs(ft,{variant:"danger",children:[f.jsx($o,{size:12}),e.uncommittedCount," 个未提交变更"]}),e.conflictedFiles.length>0&&f.jsxs(ft,{variant:"warning",children:[f.jsx(ps,{size:12}),e.conflictedFiles.length," 个冲突文件"]}),e.operation==="rebase"&&e.conflictedFiles.length===0&&f.jsxs(ft,{variant:"warning",children:[f.jsx(Qe,{size:12,className:"animate-spin"}),"变基进行中"]}),e.operation==="merge"&&e.conflictedFiles.length===0&&f.jsxs(ft,{variant:"warning",children:[f.jsx(Qe,{size:12,className:"animate-spin"}),"合并进行中"]}),e.ahead>0&&f.jsxs(ft,{variant:"success",children:[f.jsx(js,{size:12}),"领先 ",e.ahead," 个提交"]}),e.behind>0&&f.jsxs(ft,{variant:"warning",children:["落后 ",e.behind," 个提交"]}),e.operation==="idle"&&e.ahead===0&&e.behind===0&&!e.hasUncommittedChanges&&f.jsxs(ft,{variant:"neutral",children:[f.jsx(js,{size:12}),"已是最新"]})]}),e.hasUncommittedChanges&&f.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 $d({open:e,onOpenChange:t,workspaceId:r,branchName:a,targetBranch:m,commitMessage:x,onConflict:y}){const{data:s,isLoading:i}=$n(r),l=Ad(),u=Dd(),[o,p]=R.useState(null),[_,C]=R.useState("select"),[g,n]=R.useState(""),d=s?s.conflictedFiles.length>0:!1,c=s?s.operation!=="idle":!1,h=s?.hasUncommittedChanges??!1;R.useEffect(()=>{e&&(C("select"),p(null),n(x??""))},[e,x]);const v=()=>{p(null),l.mutate(r,{onSuccess:()=>t(!1),onError:S=>{const E=S;E.status===409?(t(!1),y()):p(E.message??"变基失败")}})},b=()=>{p(null),C("confirm")},w=()=>{p(null);const S=g.trim()||void 0;u.mutate({id:r,commitMessage:S},{onSuccess:()=>t(!1),onError:E=>{const T=E;T.status===409?(t(!1),y()):p(T.message??"合并失败")}})},k=_==="confirm"?"确认合并":"Git 操作";return f.jsx(gr,{isOpen:e,onClose:()=>t(!1),title:k,children:i||!s?f.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-neutral-400",children:[f.jsx(Qe,{size:18,className:"animate-spin"}),f.jsx("span",{className:"text-sm",children:"加载分支状态..."})]}):_==="confirm"?f.jsx(qd,{editableMessage:g,setEditableMessage:n,error:o,isPending:u.isPending,onConfirm:w,onBack:()=>C("select"),branchName:a,targetBranch:m}):f.jsx(Kd,{gitStatus:s,branchName:a,targetBranch:m,error:o,isDirty:h,hasConflicts:d,isOperationInProgress:c,rebasePending:l.isPending,mergePending:u.isPending,onRebase:v,onMerge:b})})}function Kd({gitStatus:e,branchName:t,targetBranch:r,error:a,isDirty:m,hasConflicts:x,isOperationInProgress:y,rebasePending:s,mergePending:i,onRebase:l,onMerge:u}){return f.jsxs("div",{className:"space-y-5",children:[f.jsx(Ud,{gitStatus:e,branchName:t,targetBranch:r}),a&&f.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:a}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("button",{onClick:l,disabled:s||x||y||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:[f.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-50 flex items-center justify-center shrink-0",children:f.jsx(Go,{size:16,className:"text-blue-600"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium text-neutral-900",children:s?"变基中...":"变基 (Rebase)"}),f.jsxs("div",{className:"text-xs text-neutral-500",children:["将当前分支变基到最新的 ",r]})]})]}),f.jsxs("button",{onClick:u,disabled:i||x||y||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:[f.jsx("div",{className:"w-8 h-8 rounded-md bg-emerald-50 flex items-center justify-center shrink-0",children:f.jsx(qi,{size:16,className:"text-emerald-600"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium text-neutral-900",children:i?"合并中...":"合并 (Merge)"}),f.jsxs("div",{className:"text-xs text-neutral-500",children:["Squash merge 到 ",r]})]})]})]})]})}function qd({editableMessage:e,setEditableMessage:t,error:r,isPending:a,onConfirm:m,onBack:x,branchName:y,targetBranch:s}){return f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:y}),f.jsx(zi,{size:14,className:"text-neutral-400"}),f.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:s})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-xs font-medium text-neutral-600 mb-1.5",children:"提交消息"}),f.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()&&f.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"留空将使用默认消息"})]}),r&&f.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:r}),f.jsxs("div",{className:"flex gap-2 justify-end",children:[f.jsx("button",{onClick:x,disabled:a,className:"px-4 py-2 rounded-md text-sm text-neutral-600 hover:bg-neutral-100 transition-colors disabled:opacity-50",children:"返回"}),f.jsx("button",{onClick:m,disabled:a,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:a?f.jsxs(f.Fragment,{children:[f.jsx(Qe,{size:14,className:"animate-spin"}),"合并中..."]}):f.jsxs(f.Fragment,{children:[f.jsx(qi,{size:14}),"确认合并"]})})]})]})}const Xd=675,gi=320,bi=1200,Yd=f.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-white text-neutral-400 select-none",children:[f.jsx("div",{className:"w-16 h-16 bg-neutral-50 rounded-2xl border border-neutral-100 flex items-center justify-center mb-6",children:f.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:[f.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),f.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),f.jsx("h3",{className:"text-neutral-900 font-medium mb-2 text-lg",children:"Agent Tower"}),f.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."})]}),Si=[{status:oe.Review,className:"bg-amber-50 text-amber-700 border-amber-100",hoverClass:"hover:bg-amber-100",icon:f.jsx(ls,{className:"w-3 h-3"})},{status:oe.Running,className:"bg-blue-50 text-blue-700 border-blue-100",hoverClass:"hover:bg-blue-100",icon:f.jsx(cs,{className:"w-3 h-3"})},{status:oe.Pending,className:"bg-neutral-50 text-neutral-600 border-neutral-100",hoverClass:"hover:bg-neutral-100",icon:f.jsx(hs,{className:"w-3 h-3"})},{status:oe.Done,className:"bg-emerald-50 text-emerald-700 border-emerald-100",hoverClass:"hover:bg-emerald-100",icon:f.jsx(us,{className:"w-3 h-3"})},{status:oe.Cancelled,className:"bg-neutral-50 text-neutral-500 border-neutral-200",hoverClass:"hover:bg-neutral-200",icon:f.jsx(ds,{className:"w-3 h-3"})}];function Vd({status:e,onChangeStatus:t}){const[r,a]=R.useState(!1),m=R.useRef(null);R.useEffect(()=>{if(!r)return;const y=s=>{m.current&&!m.current.contains(s.target)&&a(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]);const x=Si.find(y=>y.status===e);return f.jsxs("div",{className:"relative",ref:m,children:[f.jsxs("button",{onClick:()=>t&&a(y=>!y),className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border transition-colors ${x.className} ${t?"cursor-pointer hover:opacity-80":""}`,children:[x.icon,f.jsx("span",{children:e}),t&&f.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-0.5 transition-transform ${r?"rotate-180":""}`,children:f.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})]}),r&&f.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:Si.filter(y=>y.status!==e).map(y=>f.jsxs("button",{onClick:()=>{t?.(y.status),a(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-xs font-medium transition-colors ${y.hoverClass}`,children:[f.jsx("span",{className:y.className.split(" ").find(s=>s.startsWith("text-")),children:y.icon}),f.jsx("span",{className:"text-neutral-700",children:y.status})]},y.status))})]})}function Gd({task:e,onDeleteTask:t,isDeleting:r,onTaskStatusChange:a}){const[m,x]=R.useState(""),[y,s]=R.useState(!1),[i,l]=R.useState(!1),[u,o]=R.useState(!1),[p,_]=R.useState(!1),[C,g]=R.useState(!1),n=R.useRef(null),d=R.useRef(null),c=R.useRef(null),{scrollRef:h,contentRef:v,isAtBottom:b,scrollToBottom:w}=fn({resize:"smooth",initial:"instant"}),[k,S]=R.useState(Xd),[E,T]=R.useState(!0),[L,M]=R.useState(!1),N=R.useRef(0),I=R.useRef(0),F=R.useRef(null),{data:H,isLoading:z}=Un(e?.id??""),D=Md(e?.id),j=R.useMemo(()=>{if(!H)return null;const V=pe=>{const $e=pe.createdAt,Ze=pe.endedAt??pe.startedAt??$e;if(!Ze)return 0;const Xe=Date.parse(Ze);return Number.isNaN(Xe)?0:Xe},ee=(pe,$e)=>{const Ze=pe.filter(Xe=>$e.includes(Xe.status));return Ze.length===0?null:Ze.sort((Xe,rt)=>V(rt)-V(Xe))[0]??null},ge=H.filter(pe=>pe.status==="ACTIVE"&&Array.isArray(pe.sessions)).flatMap(pe=>pe.sessions??[]),xe=ee(ge,[ye.RUNNING])??ee(ge,[ye.PENDING])??ee(ge,[ye.COMPLETED,ye.FAILED,ye.CANCELLED]);if(xe)return xe;const Le=H.filter(pe=>pe.status==="MERGED"&&Array.isArray(pe.sessions)).flatMap(pe=>pe.sessions??[]);return ee(Le,[ye.COMPLETED,ye.FAILED,ye.CANCELLED])},[H]),P=j?.id??"",O=j?.status===ye.RUNNING||j?.status===ye.PENDING,$=R.useMemo(()=>!j||!H?!1:!H.some(ee=>ee.status==="ACTIVE"&&ee.sessions?.some(ge=>ge.id===j.id)),[j,H]),q=R.useMemo(()=>{if(H){for(const V of H)if(V.status==="ACTIVE"&&V.worktreePath)return V.worktreePath;return H[0]?.worktreePath}},[H]),X=R.useMemo(()=>H?H.find(ee=>ee.status==="ACTIVE")?.id:void 0,[H]),{data:G}=$n(X??""),se=R.useMemo(()=>H?H.find(ee=>ee.status==="ACTIVE")?.sessions??[]:[],[H]),A=R.useMemo(()=>H?H.find(ee=>ee.status==="ACTIVE")?.branchName??"":"",[H]),B=R.useMemo(()=>H?H.find(ee=>ee.status==="ACTIVE")?.commitMessage:void 0,[H]),U=De();R.useEffect(()=>{if(!C)return;const V=ee=>{n.current&&!n.current.contains(ee.target)&&g(!1)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[C]);const W=Rs(),J=ks(),Y=R.useCallback(()=>{X&&J.mutate({workspaceId:X})},[X,J]),ie=R.useCallback(()=>{!e?.id||!t||(t(e.id),l(!1))},[e?.id,t]),{isConnected:ue,isLoadingSnapshot:_e,logs:we,entries:te,attach:ke}=ji({sessionId:P,onExit:R.useCallback(()=>{U.invalidateQueries({queryKey:["workspaces"]})},[U])});R.useEffect(()=>{if(!e?.id)return;const V=nt.connect();V.emit(st.SUBSCRIBE,{topic:"task",id:e.id});const ee=ge=>{ge.taskId===e.id&&U.invalidateQueries({queryKey:["tasks"]})};return V.on(Ne.TASK_UPDATED,ee),()=>{V.off(Ne.TASK_UPDATED,ee),V.emit(st.UNSUBSCRIBE,{topic:"task",id:e.id})}},[e?.id,U]),R.useEffect(()=>{if(!P)return;const V=nt.connect(),ee=ge=>{ge.sessionId===P&&U.invalidateQueries({queryKey:["workspaces"]})};return V.on(Ne.SESSION_COMPLETED,ee),()=>{V.off(Ne.SESSION_COMPLETED,ee)}},[P,U]);const{todos:Ae}=Ni(te),{files:Q,addFiles:re,removeFile:Se,clear:ae,buildMarkdownLinks:K,hasFiles:ne,isUploading:me}=Yn(),Be=R.useMemo(()=>{if(!j?.tokenUsage)return;const V=j.tokenUsage;if(typeof V.totalTokens=="number")return V},[j?.tokenUsage]),Te=Xn(we,Be);R.useEffect(()=>{P&&ue&&ke()},[P,ue,ke]);const qe=R.useRef(e?.id);R.useEffect(()=>{qe.current!==e?.id&&w(),qe.current=e?.id},[e?.id,w]);const Ie=qn(),je=R.useRef(!1),fe=R.useCallback(async()=>{if(!m.trim()&&!ne||!P||je.current||me)return;je.current=!0;const V=K(),ee=[m.trim(),V].filter(Boolean).join(`
|
|
69
|
+
|
|
70
|
+
`);x(""),ae(),d.current&&(d.current.style.height="60px"),W.mutate({id:P,message:ee},{onSuccess:()=>{ke()},onSettled:()=>{je.current=!1}})},[m,P,W,ke,ne,me,K,ae]),wt=R.useCallback(async()=>{P&&(await Ie.mutateAsync(P),U.invalidateQueries({queryKey:["workspaces"]}))},[P,Ie,U]),Tr=R.useCallback(V=>{const ee=V.target.files;ee&&ee.length>0&&re(Array.from(ee)),V.target.value=""},[re]),Et=R.useCallback(V=>{const ee=V.clipboardData.items,ge=[];for(const xe of ee)if(xe.kind==="file"){const Le=xe.getAsFile();Le&&ge.push(Le)}ge.length>0&&(V.preventDefault(),re(ge))},[re]),[kt,Rt]=R.useState(!1),Gt=R.useCallback(V=>{V.preventDefault(),Rt(!0)},[]),Lr=R.useCallback(V=>{V.preventDefault(),Rt(!1)},[]),Mr=R.useCallback(V=>{V.preventDefault(),Rt(!1);const ee=V.dataTransfer.files;ee.length>0&&re(Array.from(ee))},[re]),Dt=R.useCallback(V=>{const ee=V.clientX-N.current,ge=Math.max(gi,Math.min(I.current+ee,bi));F.current&&(F.current.style.width=`${ge}px`),I.current=I.current},[]),Re=R.useCallback(()=>{if(M(!1),F.current){const V=F.current.getBoundingClientRect().width;S(Math.max(gi,Math.min(Math.round(V),bi)))}document.body.style.cursor="",document.body.style.userSelect=""},[]);R.useEffect(()=>{if(L)return document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",Re),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",Re),document.body.style.cursor="",document.body.style.userSelect=""}},[L,Dt,Re]);const Fe=R.useCallback(V=>{V.preventDefault(),N.current=V.clientX,I.current=k,M(!0)},[k]),He=R.useCallback(()=>{T(V=>!V)},[]),tt=R.useCallback(V=>{x(V.target.value);const ee=V.target;ee.style.height="auto";const ge=ee.scrollHeight;ee.style.height=`${Math.max(60,Math.min(ge,300))}px`},[]),ze=R.useMemo(()=>{const V=[];if(H&&H.length>0){const ee=H.some(Le=>Le.status==="ACTIVE"),ge=H.some(Le=>Le.sessions?.some(pe=>pe.status===ye.RUNNING||pe.status===ye.PENDING)),xe=H.some(Le=>Le.status==="ACTIVE");ge&&V.push("正在运行的 Agent 将被停止"),xe&&V.push("分支上未合并的变更将丢失"),ee&&V.push("关联的工作目录(worktree)将被清理")}return V},[H]);return e?f.jsxs("div",{className:"flex-1 flex flex-col h-full bg-white relative overflow-hidden",children:[f.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:[f.jsxs("div",{className:"flex flex-col",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("span",{className:`text-xs font-semibold uppercase tracking-wider ${e.projectColor}`,children:e.projectName}),f.jsx("span",{className:"text-neutral-300 text-xs",children:"/"}),f.jsx("span",{className:"text-xs text-neutral-500 font-mono",children:e.branch})]}),f.jsx("h2",{className:"text-lg font-bold text-neutral-900",children:e.title})]}),f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx(Vd,{status:e.status,onChangeStatus:a?V=>a(e.id,V):void 0}),X&&f.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:f.jsx(Zo,{size:18})}),f.jsx("button",{onClick:Y,disabled:!X,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:f.jsx(br,{size:18})}),f.jsx("button",{onClick:He,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?f.jsx(da,{size:18}):f.jsx(pa,{size:18})}),t&&f.jsxs("div",{className:"relative",ref:n,children:[f.jsx("button",{onClick:()=>g(V=>!V),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:f.jsx(Ui,{size:18})}),C&&f.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:f.jsxs("button",{onClick:()=>{l(!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:[f.jsx(Fi,{size:15}),f.jsx("span",{children:"删除任务"})]})})]})]})]}),X&&G&&f.jsx(Hd,{workspaceId:X,gitStatus:G,onResolve:()=>o(!0)}),f.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[f.jsxs("div",{ref:F,className:`flex flex-col bg-white relative ${E?"flex-shrink-0":"flex-1"}`,style:{width:E?k:"100%"},children:[f.jsxs("div",{className:"relative flex-1 min-h-0",children:[f.jsx("div",{ref:h,className:"h-full overflow-y-auto px-6 pt-6 pb-4",children:f.jsxs("div",{ref:v,className:"w-full",children:[f.jsx("div",{className:"mb-4 pb-4 border-b border-neutral-100",children:f.jsx("p",{className:"text-sm text-neutral-500 leading-relaxed",children:e.description})}),D&&f.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-neutral-400 text-sm",children:[D.status==="running"&&f.jsxs(f.Fragment,{children:[f.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:[f.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),f.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),f.jsxs("span",{children:["Setup (",D.currentIndex,"/",D.totalCommands,"): ",f.jsx("code",{children:D.currentCommand})]})]}),D.status==="completed"&&f.jsx("span",{className:"text-emerald-600",children:"Setup 完成"}),D.status==="failed"&&f.jsxs("span",{className:"text-red-500",children:["Setup 失败: ",D.error]})]}),z?f.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[f.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[f.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),f.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),f.jsx("span",{className:"text-sm",children:"Loading..."})]}):P?_e?f.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[f.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[f.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),f.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),f.jsx("span",{className:"text-sm",children:"Loading logs..."})]}):we.length===0?f.jsx("div",{className:"text-neutral-400 text-center py-8",children:O?"Waiting for agent output...":"No logs recorded for this session."}):f.jsx(Pi,{logs:we}):f.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[f.jsx("div",{className:"w-14 h-14 bg-neutral-50 rounded-2xl border border-neutral-100 flex items-center justify-center mb-5",children:f.jsx(bt,{size:24,className:"text-neutral-400 ml-0.5"})}),f.jsx("h3",{className:"text-base font-medium text-neutral-900 mb-1.5",children:"尚未启动 Agent"}),f.jsx("p",{className:"text-sm text-neutral-500 mb-6 max-w-xs",children:"选择一个 Agent 来执行此任务,Agent 将自动创建工作空间并开始工作。"}),f.jsxs(it,{onClick:()=>s(!0),children:[f.jsx(bt,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!b&&f.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:[f.jsx(Hi,{size:14}),f.jsx("span",{children:"回到底部"})]})]}),Ae.length>0&&f.jsx("div",{className:"px-6 pt-2 pb-1 bg-white flex-shrink-0 border-t border-neutral-100",children:f.jsx(Oi,{todos:Ae})}),$?f.jsx("div",{className:"p-6 pt-3 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-neutral-100",children:f.jsxs("div",{className:"flex items-center justify-between bg-neutral-50 rounded-xl border border-neutral-200 px-4 py-3",children:[f.jsx("span",{className:"text-sm text-neutral-500",children:"代码已合并,以上为历史沟通记录"}),f.jsxs(it,{size:"sm",onClick:()=>s(!0),children:[f.jsx(bt,{size:14,className:"mr-1.5"}),"启动新 Agent"]})]})}):f.jsx("div",{className:"p-6 pt-2 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-transparent",onDragOver:Gt,onDragLeave:Lr,onDrop:Mr,children:f.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 ${kt?"border-blue-400 bg-blue-50/50 shadow-md":"border-neutral-200"}`,children:[f.jsx(Vn,{files:Q,onRemove:Se}),f.jsx("textarea",{ref:d,value:m,onChange:tt,onPaste:Et,onKeyDown:V=>{V.key==="Enter"&&!V.shiftKey&&!V.repeat&&!V.nativeEvent.isComposing&&V.nativeEvent.keyCode!==229&&(V.preventDefault(),fe())},rows:1,placeholder:kt?"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"}}),f.jsx("input",{ref:c,type:"file",multiple:!0,className:"hidden",onChange:Tr}),f.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("button",{onClick:()=>c.current?.click(),className:"p-2 text-neutral-400 hover:text-neutral-600 hover:bg-neutral-100 rounded-lg transition-colors",title:"Upload file",children:f.jsx(Bi,{size:18})}),f.jsx(pn,{usage:Te})]}),f.jsx("div",{className:"flex items-center gap-2",children:O&&!m.trim()&&!ne?f.jsx("button",{onClick:wt,disabled:Ie.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:f.jsx(Ii,{size:14})}):f.jsx("button",{onClick:fe,disabled:!m.trim()&&!ne||me,className:`p-2 rounded-lg transition-all duration-200 ${(m.trim()||ne)&&!me?"bg-neutral-900 text-white shadow-md hover:bg-black":"bg-transparent text-neutral-300 cursor-not-allowed"}`,children:f.jsx(Wi,{size:18})})})]})]})})]}),E&&f.jsx("div",{className:"w-1 cursor-col-resize hover:bg-neutral-200 active:bg-blue-400 transition-colors z-30 flex-shrink-0",onMouseDown:Fe}),E&&f.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-white",children:f.jsx(Wn,{sessionId:P||void 0,workingDir:q,projectId:e.projectId})})]}),f.jsx(Gn,{isOpen:y,onClose:()=>s(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),X&&f.jsx($d,{open:p,onOpenChange:_,workspaceId:X,branchName:A,targetBranch:e.mainBranch,commitMessage:B,onConflict:()=>o(!0)}),X&&G&&G.conflictOp&&f.jsx(Wd,{open:u,onOpenChange:o,workspaceId:X,conflictOp:G.conflictOp,conflictedFiles:G.conflictedFiles,sourceBranch:A,targetBranch:e.mainBranch,sessions:se}),f.jsx(Qn,{isOpen:i,onClose:()=>l(!1),onConfirm:ie,title:"删除任务",description:f.jsxs(f.Fragment,{children:[f.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),ze.length>0&&f.jsx("ul",{className:"mt-2 space-y-1",children:ze.map((V,ee)=>f.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[f.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),f.jsx("span",{children:V})]},ee))})]}),confirmText:"删除",variant:"danger",isLoading:r})]}):Yd}function Qd(e){switch(e){case Ve.TODO:return oe.Pending;case Ve.IN_PROGRESS:return oe.Running;case Ve.IN_REVIEW:return oe.Review;case Ve.DONE:return oe.Done;case Ve.CANCELLED:return oe.Cancelled}}function Zd(e){switch(e){case oe.Pending:return Ve.TODO;case oe.Running:return Ve.IN_PROGRESS;case oe.Review:return Ve.IN_REVIEW;case oe.Done:return Ve.DONE;case oe.Cancelled:return Ve.CANCELLED}}function Jd(e){switch(e){case Ot.CLAUDE_CODE:return"Claude Code";case Ot.GEMINI_CLI:return"Gemini CLI";case Ot.CURSOR_AGENT:return"Cursor Agent"}}const xi=["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 ef(e,t){let r=0;for(let a=0;a<e.length;a++)r=(r<<5)-r+e.charCodeAt(a)|0;return Math.abs(r)%t}function tf(e){return{id:e.id,name:e.name,color:e.color||xi[ef(e.name,xi.length)]}}function rf(e){if(!e||e.length===0)return{agent:"—",branch:"—"};const t=e.find(m=>m.status==="ACTIVE")??e[0],r=t.branchName,a=t.sessions;if(a&&a.length>0){const m=a[a.length-1];return{agent:Jd(m.agentType),branch:r}}return{agent:"—",branch:r}}function sf(e){const{agent:t,branch:r}=rf(e.workspaces);return{id:e.id,projectId:e.projectId,title:e.title,status:Qd(e.status),agent:t,branch:r,description:e.description??""}}function nf(e,t){const r={};return ut({queryKey:ce.tasks.list(e,t),queryFn:()=>de.get(`/projects/${e}/tasks`,{params:r}),enabled:!!e})}function of(e){const t=De();return Ue({mutationFn:r=>de.post(`/projects/${e}/tasks`,r),onSuccess:()=>{t.invalidateQueries({queryKey:ce.tasks.list(e)}),t.invalidateQueries({queryKey:ce.tasks.stats(e)})}})}function af(){const e=De();return Ue({mutationFn:({id:t,status:r})=>de.patch(`/tasks/${t}/status`,{status:r}),onSuccess:t=>{e.invalidateQueries({queryKey:ce.tasks.all}),e.invalidateQueries({queryKey:ce.tasks.detail(t.id)})}})}function lf(){const e=De();return Ue({mutationFn:t=>de.delete(`/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:ce.tasks.all})}})}function cf(e){const t=De(),r=R.useRef(new Set);R.useEffect(()=>{if(e.length===0)return;const a=nt.connect(),m=r.current,x=new Set(e);for(const i of x)m.has(i)||a.emit(st.SUBSCRIBE,{topic:"project",id:i},l=>{l.success&&m.add(i)});for(const i of m)x.has(i)||a.emit(st.UNSUBSCRIBE,{topic:"project",id:i},()=>{m.delete(i)});const y=i=>{t.invalidateQueries({queryKey:ce.tasks.list(i.projectId)}),t.invalidateQueries({queryKey:ce.tasks.detail(i.taskId)})},s=i=>{t.invalidateQueries({queryKey:ce.tasks.list(i.projectId)}),t.removeQueries({queryKey:ce.tasks.detail(i.taskId)})};return a.on(Ne.TASK_UPDATED,y),a.on(Ne.TASK_DELETED,s),()=>{a.off(Ne.TASK_UPDATED,y),a.off(Ne.TASK_DELETED,s);for(const i of m)a.emit(st.UNSUBSCRIBE,{topic:"project",id:i});m.clear()}},[e,t])}const Zn=768;function hf(e){const t=window.matchMedia(`(max-width: ${Zn-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function uf(){return window.innerWidth<Zn}function df(){return!1}function ff(){return R.useSyncExternalStore(hf,uf,df)}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"};function pf(e){const t=e.split("/");return t[t.length-1]||e}function mf(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function vf({workingDir:e,filePath:t,type:r}){const{data:a,isLoading:m,isError:x}=zn(e,t,r);if(m)return f.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[f.jsx(Qe,{size:14,className:"animate-spin"}),f.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(x)return f.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:"Failed to load diff."});const y=a?.diff||"";if(!y.trim())return f.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No diff content."});const s=y.split(`
|
|
71
|
+
`);return f.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:s.map((i,l)=>{let u="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(u="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(u="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(u="bg-blue-950/30",o="text-blue-400"),f.jsx("div",{className:Oe("px-3 whitespace-pre",u,o),children:i},l)})})}function _f({entry:e,type:t,workingDir:r}){const[a,m]=R.useState(!1),x=Ci[e.status]||Ci.M,y=mf(e.path);return f.jsxs("div",{children:[f.jsxs("button",{onClick:()=>m(s=>!s),className:Oe("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-neutral-50",a&&"bg-neutral-50"),children:[f.jsx("span",{className:Oe("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",x),children:e.status}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:pf(e.path)}),y&&f.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:y})]}),f.jsx("span",{className:"text-neutral-400 shrink-0",children:a?f.jsx(xt,{size:14}):f.jsx(mr,{size:14})})]}),a&&f.jsx(vf,{workingDir:r,filePath:e.path,type:t})]})}function yi({title:e,entries:t,type:r,workingDir:a,defaultOpen:m}){const[x,y]=R.useState(m);return t.length===0?null:f.jsxs("div",{children:[f.jsxs("button",{onClick:()=>y(s=>!s),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-neutral-50",children:[f.jsx("span",{className:"text-neutral-400",children:x?f.jsx(xt,{size:14}):f.jsx(mr,{size:14})}),f.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:e}),f.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:t.length})]}),x&&f.jsx("div",{className:"divide-y divide-neutral-100",children:t.map(s=>f.jsx(_f,{entry:s,type:r,workingDir:a},`${r}:${s.path}`))})]})}function gf({workingDir:e}){const{data:t,isLoading:r,isError:a}=Hn(e);if(!e)return f.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."});if(r)return f.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[f.jsx(Qe,{size:16,className:"animate-spin mr-2"}),f.jsx("span",{className:"text-sm",children:"Loading changes..."})]});if(a)return f.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:"Failed to load changes."});const m=t?.uncommitted||[],x=t?.committed||[];return m.length+x.length===0?f.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[f.jsx(It,{size:28,className:"mb-3"}),f.jsx("span",{className:"text-sm",children:"No pending changes"})]}):f.jsxs("div",{className:"flex-1 overflow-y-auto",children:[f.jsx(yi,{title:"Uncommitted",entries:m,type:"uncommitted",workingDir:e,defaultOpen:!0}),f.jsx(yi,{title:"Committed",entries:x,type:"committed",workingDir:e,defaultOpen:!1})]})}function bf({status:e}){const t={[oe.Running]:"bg-blue-500",[oe.Review]:"bg-amber-500",[oe.Pending]:"bg-neutral-400",[oe.Done]:"bg-emerald-500",[oe.Cancelled]:"bg-neutral-400"};return f.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${t[e]}`})}const Sf=[{key:"chat",label:"Chat",icon:oa},{key:"changes",label:"Changes",icon:It},{key:"workspace",label:"Workspace",icon:Ki}];function xf({task:e,onBack:t,onDeleteTask:r,isDeleting:a}){const[m,x]=R.useState("chat"),[y,s]=R.useState(""),[i,l]=R.useState(!1),[u,o]=R.useState(!1),[p,_]=R.useState(!1),C=R.useRef(null),g=R.useRef(null),n=R.useRef(null),{scrollRef:d,contentRef:c,isAtBottom:h,scrollToBottom:v}=fn({resize:"smooth",initial:"instant"}),b=De();R.useEffect(()=>{if(!p)return;const Q=re=>{C.current&&!C.current.contains(re.target)&&_(!1)};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[p]);const{data:w,isLoading:k}=Un(e.id),S=R.useMemo(()=>{if(!w)return null;const Q=w.filter(ae=>ae.status==="ACTIVE"&&Array.isArray(ae.sessions)).flatMap(ae=>ae.sessions??[]),re=ae=>{const K=ae.createdAt,ne=ae.endedAt??ae.startedAt??K;if(!ne)return 0;const me=Date.parse(ne);return Number.isNaN(me)?0:me},Se=ae=>{const K=Q.filter(ne=>ae.includes(ne.status));return K.length===0?null:K.sort((ne,me)=>re(me)-re(ne))[0]??null};return Se([ye.RUNNING])??Se([ye.PENDING])??Se([ye.COMPLETED,ye.FAILED,ye.CANCELLED])},[w]),E=S?.id??"",T=S?.status===ye.RUNNING||S?.status===ye.PENDING,L=R.useMemo(()=>{if(w){for(const Q of w)if(Q.status==="ACTIVE"&&Q.worktreePath)return Q.worktreePath;return w[0]?.worktreePath}},[w]),M=R.useMemo(()=>{if(w)return w.find(Q=>Q.status==="ACTIVE")?.id},[w]),N=R.useMemo(()=>{const Q=[];if(w&&w.length>0){const re=w.some(ae=>ae.status==="ACTIVE");w.some(ae=>ae.sessions?.some(K=>K.status===ye.RUNNING||K.status===ye.PENDING))&&Q.push("正在运行的 Agent 将被停止"),re&&(Q.push("分支上未合并的变更将丢失"),Q.push("关联的工作目录(worktree)将被清理"))}return Q},[w]),I=Rs(),F=ks(),H=qn(),{isConnected:z,isLoadingSnapshot:D,logs:j,entries:P,attach:O}=ji({sessionId:E,onExit:R.useCallback(()=>{b.invalidateQueries({queryKey:["workspaces"]})},[b])}),{todos:$}=Ni(P),{files:q,addFiles:X,removeFile:G,clear:se,buildMarkdownLinks:A,hasFiles:B,isUploading:U}=Yn(),W=R.useMemo(()=>{if(!S?.tokenUsage)return;const Q=S.tokenUsage;if(typeof Q.totalTokens=="number")return Q},[S?.tokenUsage]),J=Xn(j,W);R.useEffect(()=>{E&&z&&O()},[E,z,O]),R.useEffect(()=>{v()},[e.id,v]);const Y=R.useRef(!1),ie=R.useCallback(async()=>{if(!y.trim()&&!B||!E||Y.current||U)return;Y.current=!0;const Q=A(),re=[y.trim(),Q].filter(Boolean).join(`
|
|
72
|
+
|
|
73
|
+
`);s(""),se(),g.current&&(g.current.style.height="40px"),I.mutate({id:E,message:re},{onSuccess:()=>O(),onSettled:()=>{Y.current=!1}})},[y,E,I,O,B,U,A,se]),ue=R.useCallback(async()=>{E&&(await H.mutateAsync(E),b.invalidateQueries({queryKey:["workspaces"]}))},[E,H,b]),_e=R.useCallback(Q=>{const re=Q.target.files;re&&re.length>0&&X(Array.from(re)),Q.target.value=""},[X]),we=R.useCallback(Q=>{const re=Q.clipboardData.items,Se=[];for(const ae of re)if(ae.kind==="file"){const K=ae.getAsFile();K&&Se.push(K)}Se.length>0&&(Q.preventDefault(),X(Se))},[X]),te=R.useCallback(Q=>{s(Q.target.value);const re=Q.target;re.style.height="auto",re.style.height=`${Math.max(40,Math.min(re.scrollHeight,140))}px`},[]),ke=R.useCallback(()=>{M&&F.mutate({workspaceId:M})},[M,F]),Ae=R.useRef(null);return R.useEffect(()=>{const Q=window.visualViewport;if(!Q)return;const re=()=>{Ae.current&&(Ae.current.style.height=`${Q.height}px`,Ae.current.style.top=`${Q.offsetTop}px`)};return Q.addEventListener("resize",re),Q.addEventListener("scroll",re),()=>{Q.removeEventListener("resize",re),Q.removeEventListener("scroll",re)}},[]),f.jsxs("div",{ref:Ae,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden",children:[f.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[f.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[f.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:f.jsx(vo,{size:18})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),f.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[f.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),f.jsx("span",{className:"text-neutral-300",children:"/"}),f.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),f.jsx(bf,{status:e.status}),f.jsx("button",{onClick:ke,disabled:!M,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:f.jsx(br,{size:16})}),r&&f.jsxs("div",{className:"relative",ref:C,children:[f.jsx("button",{onClick:()=>_(Q=>!Q),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:f.jsx(Ui,{size:16})}),p&&f.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:f.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:[f.jsx(Fi,{size:15}),f.jsx("span",{children:"删除任务"})]})})]})]}),f.jsx("div",{className:"flex border-t border-neutral-100",children:Sf.map(({key:Q,label:re,icon:Se})=>f.jsxs("button",{onClick:()=>x(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:[f.jsx(Se,{size:13}),f.jsx("span",{children:re})]},Q))})]}),m==="chat"&&f.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[f.jsxs("div",{className:"relative flex-1 min-h-0",children:[f.jsx("div",{ref:d,className:"h-full overflow-y-auto overflow-x-hidden px-3 pt-3 pb-2",children:f.jsxs("div",{ref:c,children:[f.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:f.jsx("p",{className:"text-[13px] text-neutral-500 leading-relaxed",children:e.description})}),k?f.jsx(wi,{label:"Loading..."}):E?D?f.jsx(wi,{label:"Loading logs..."}):j.length===0?f.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:T?"Waiting for agent output...":"No logs recorded."}):f.jsx(Pi,{logs:j}):f.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[f.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:f.jsx(bt,{size:20,className:"text-neutral-400 ml-0.5"})}),f.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),f.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),f.jsxs(it,{onClick:()=>l(!0),children:[f.jsx(bt,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!h&&f.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:[f.jsx(Hi,{size:12}),f.jsx("span",{children:"回到底部"})]})]}),$.length>0&&f.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:f.jsx(Oi,{todos:$,compact:!0})}),E&&f.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:f.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[f.jsx(Vn,{files:q,onRemove:G}),f.jsx("textarea",{ref:g,value:y,onChange:te,onPaste:we,onKeyDown:Q=>{Q.key==="Enter"&&!Q.shiftKey&&!Q.repeat&&!Q.nativeEvent.isComposing&&Q.nativeEvent.keyCode!==229&&(Q.preventDefault(),ie())},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}}),f.jsx("input",{ref:n,type:"file",multiple:!0,className:"hidden",onChange:_e}),f.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[f.jsxs("div",{className:"flex items-center gap-0.5",children:[f.jsx("button",{onClick:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:f.jsx(Bi,{size:15})}),f.jsx(pn,{usage:J})]}),T&&!y.trim()&&!B?f.jsx("button",{onClick:ue,disabled:H.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:f.jsx(Ii,{size:12})}):f.jsx("button",{onClick:ie,disabled:!y.trim()&&!B||U,className:`p-1.5 rounded-lg transition-colors ${(y.trim()||B)&&!U?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:f.jsx(Wi,{size:15})})]})]})})]}),m==="changes"&&f.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:f.jsx(gf,{workingDir:L})}),m==="workspace"&&f.jsx("div",{className:"flex-1 overflow-hidden",children:f.jsx(Wn,{sessionId:E||void 0,workingDir:L,projectId:e.projectId,className:"h-full",hideChanges:!0})}),f.jsx(Gn,{isOpen:i,onClose:()=>l(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),f.jsx(Qn,{isOpen:u,onClose:()=>o(!1),onConfirm:()=>{r?.(e.id),o(!1)},title:"删除任务",description:f.jsxs(f.Fragment,{children:[f.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),N.length>0&&f.jsx("ul",{className:"mt-2 space-y-1",children:N.map((Q,re)=>f.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[f.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),f.jsx("span",{children:Q})]},re))})]}),confirmText:"删除",variant:"danger",isLoading:a})]})}function wi({label:e}){return f.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[f.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[f.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),f.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),f.jsx("span",{className:"text-sm",children:e})]})}var Cf=Object.defineProperty,pr=Object.getOwnPropertySymbols,Jn=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable,Ei=(e,t,r)=>t in e?Cf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,is=(e,t)=>{for(var r in t||(t={}))Jn.call(t,r)&&Ei(e,r,t[r]);if(pr)for(var r of pr(t))eo.call(t,r)&&Ei(e,r,t[r]);return e},ns=(e,t)=>{var r={};for(var a in e)Jn.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&pr)for(var a of pr(e))t.indexOf(a)<0&&eo.call(e,a)&&(r[a]=e[a]);return r};var mt;(e=>{const t=class le{constructor(i,l,u,o){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<le.MIN_VERSION||i>le.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 C=0;C<this.size;C++)p.push(!1);for(let C=0;C<this.size;C++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const _=this.addEccAndInterleave(u);if(this.drawCodewords(_),o==-1){let C=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const n=this.getPenaltyScore();n<C&&(o=g,C=n),this.applyMask(g)}}m(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,l){const u=e.QrSegment.makeSegments(i);return le.encodeSegments(u,l)}static encodeBinary(i,l){const u=e.QrSegment.makeBytes(i);return le.encodeSegments([u],l)}static encodeSegments(i,l,u=1,o=40,p=-1,_=!0){if(!(le.MIN_VERSION<=u&&u<=o&&o<=le.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let C,g;for(C=u;;C++){const h=le.getNumDataCodewords(C,l)*8,v=y.getTotalBits(i,C);if(v<=h){g=v;break}if(C>=o)throw new RangeError("Data too long")}for(const h of[le.Ecc.MEDIUM,le.Ecc.QUARTILE,le.Ecc.HIGH])_&&g<=le.getNumDataCodewords(C,h)*8&&(l=h);let n=[];for(const h of i){r(h.mode.modeBits,4,n),r(h.numChars,h.mode.numCharCountBits(C),n);for(const v of h.getData())n.push(v)}m(n.length==g);const d=le.getNumDataCodewords(C,l)*8;m(n.length<=d),r(0,Math.min(4,d-n.length),n),r(0,(8-n.length%8)%8,n),m(n.length%8==0);for(let h=236;n.length<d;h^=253)r(h,8,n);let c=[];for(;c.length*8<n.length;)c.push(0);return n.forEach((h,v)=>c[v>>>3]|=h<<7-(v&7)),new le(C,l,c,p)}getModule(i,l){return 0<=i&&i<this.size&&0<=l&&l<this.size&&this.modules[l][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),l=i.length;for(let u=0;u<l;u++)for(let o=0;o<l;o++)u==0&&o==0||u==0&&o==l-1||u==l-1&&o==0||this.drawAlignmentPattern(i[u],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let u=l;for(let p=0;p<10;p++)u=u<<1^(u>>>9)*1335;const o=(l<<10|u)^21522;m(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,a(o,p));this.setFunctionModule(8,7,a(o,6)),this.setFunctionModule(8,8,a(o,7)),this.setFunctionModule(7,8,a(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,a(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,a(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,a(o,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let u=0;u<12;u++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;m(l>>>18==0);for(let u=0;u<18;u++){const o=a(l,u),p=this.size-11+u%3,_=Math.floor(u/3);this.setFunctionModule(p,_,o),this.setFunctionModule(_,p,o)}}drawFinderPattern(i,l){for(let u=-4;u<=4;u++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(u)),_=i+o,C=l+u;0<=_&&_<this.size&&0<=C&&C<this.size&&this.setFunctionModule(_,C,p!=2&&p!=4)}}drawAlignmentPattern(i,l){for(let u=-2;u<=2;u++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,l+u,Math.max(Math.abs(o),Math.abs(u))!=1)}setFunctionModule(i,l,u){this.modules[l][i]=u,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,u=this.errorCorrectionLevel;if(i.length!=le.getNumDataCodewords(l,u))throw new RangeError("Invalid argument");const o=le.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l],p=le.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l],_=Math.floor(le.getNumRawDataModules(l)/8),C=o-_%o,g=Math.floor(_/o);let n=[];const d=le.reedSolomonComputeDivisor(p);for(let h=0,v=0;h<o;h++){let b=i.slice(v,v+g-p+(h<C?0:1));v+=b.length;const w=le.reedSolomonComputeRemainder(b,d);h<C&&b.push(0),n.push(b.concat(w))}let c=[];for(let h=0;h<n[0].length;h++)n.forEach((v,b)=>{(h!=g-p||b>=C)&&c.push(v[h])});return m(c.length==_),c}drawCodewords(i){if(i.length!=Math.floor(le.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const _=u-p,g=(u+1&2)==0?this.size-1-o:o;!this.isFunction[g][_]&&l<i.length*8&&(this.modules[g][_]=a(i[l>>>3],7-(l&7)),l++)}}m(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let u=0;u<this.size;u++){let o;switch(i){case 0:o=(u+l)%2==0;break;case 1:o=l%2==0;break;case 2:o=u%3==0;break;case 3:o=(u+l)%3==0;break;case 4:o=(Math.floor(u/3)+Math.floor(l/2))%2==0;break;case 5:o=u*l%2+u*l%3==0;break;case 6:o=(u*l%2+u*l%3)%2==0;break;case 7:o=((u+l)%2+u*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][u]&&o&&(this.modules[l][u]=!this.modules[l][u])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let _=!1,C=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==_?(C++,C==5?i+=le.PENALTY_N1:C>5&&i++):(this.finderPenaltyAddHistory(C,g),_||(i+=this.finderPenaltyCountPatterns(g)*le.PENALTY_N3),_=this.modules[p][n],C=1);i+=this.finderPenaltyTerminateAndCount(_,C,g)*le.PENALTY_N3}for(let p=0;p<this.size;p++){let _=!1,C=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==_?(C++,C==5?i+=le.PENALTY_N1:C>5&&i++):(this.finderPenaltyAddHistory(C,g),_||(i+=this.finderPenaltyCountPatterns(g)*le.PENALTY_N3),_=this.modules[n][p],C=1);i+=this.finderPenaltyTerminateAndCount(_,C,g)*le.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let _=0;_<this.size-1;_++){const C=this.modules[p][_];C==this.modules[p][_+1]&&C==this.modules[p+1][_]&&C==this.modules[p+1][_+1]&&(i+=le.PENALTY_N2)}let l=0;for(const p of this.modules)l=p.reduce((_,C)=>_+(C?1:0),l);const u=this.size*this.size,o=Math.ceil(Math.abs(l*20-u*10)/u)-1;return m(0<=o&&o<=9),i+=o*le.PENALTY_N4,m(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let u=[6];for(let o=this.size-7;u.length<i;o-=l)u.splice(1,0,o);return u}}static getNumRawDataModules(i){if(i<le.MIN_VERSION||i>le.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const u=Math.floor(i/7)+2;l-=(25*u-10)*u-55,i>=7&&(l-=36)}return m(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(le.getNumRawDataModules(i)/8)-le.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*le.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let l=[];for(let o=0;o<i-1;o++)l.push(0);l.push(1);let u=1;for(let o=0;o<i;o++){for(let p=0;p<l.length;p++)l[p]=le.reedSolomonMultiply(l[p],u),p+1<l.length&&(l[p]^=l[p+1]);u=le.reedSolomonMultiply(u,2)}return l}static reedSolomonComputeRemainder(i,l){let u=l.map(o=>0);for(const o of i){const p=o^u.shift();u.push(0),l.forEach((_,C)=>u[C]^=le.reedSolomonMultiply(_,p))}return u}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let u=0;for(let o=7;o>=0;o--)u=u<<1^(u>>>7)*285,u^=(l>>>o&1)*i;return m(u>>>8==0),u}finderPenaltyCountPatterns(i){const l=i[1];m(l<=this.size*3);const u=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(u&&i[0]>=l*4&&i[6]>=l?1:0)+(u&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,u){return i&&(this.finderPenaltyAddHistory(l,u),l=0),l+=this.size,this.finderPenaltyAddHistory(l,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(i,l){l[0]==0&&(i+=this.size),l.pop(),l.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 r(s,i,l){if(i<0||i>31||s>>>i)throw new RangeError("Value out of range");for(let u=i-1;u>=0;u--)l.push(s>>>u&1)}function a(s,i){return(s>>>i&1)!=0}function m(s){if(!s)throw new Error("Assertion error")}const x=class Ee{constructor(i,l,u){if(this.mode=i,this.numChars=l,this.bitData=u,l<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(i){let l=[];for(const u of i)r(u,8,l);return new Ee(Ee.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!Ee.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];for(let u=0;u<i.length;){const o=Math.min(i.length-u,3);r(parseInt(i.substring(u,u+o),10),o*3+1,l),u+=o}return new Ee(Ee.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!Ee.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],u;for(u=0;u+2<=i.length;u+=2){let o=Ee.ALPHANUMERIC_CHARSET.indexOf(i.charAt(u))*45;o+=Ee.ALPHANUMERIC_CHARSET.indexOf(i.charAt(u+1)),r(o,11,l)}return u<i.length&&r(Ee.ALPHANUMERIC_CHARSET.indexOf(i.charAt(u)),6,l),new Ee(Ee.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:Ee.isNumeric(i)?[Ee.makeNumeric(i)]:Ee.isAlphanumeric(i)?[Ee.makeAlphanumeric(i)]:[Ee.makeBytes(Ee.toUtf8ByteArray(i))]}static makeEci(i){let l=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)r(i,8,l);else if(i<16384)r(2,2,l),r(i,14,l);else if(i<1e6)r(6,3,l),r(i,21,l);else throw new RangeError("ECI assignment value out of range");return new Ee(Ee.Mode.ECI,0,l)}static isNumeric(i){return Ee.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Ee.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let u=0;for(const o of i){const p=o.mode.numCharCountBits(l);if(o.numChars>=1<<p)return 1/0;u+=4+p+o.bitData.length}return u}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let u=0;u<i.length;u++)i.charAt(u)!="%"?l.push(i.charCodeAt(u)):(l.push(parseInt(i.substring(u+1,u+3),16)),u+=2);return l}};x.NUMERIC_REGEX=/^[0-9]*$/,x.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,x.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let y=x;e.QrSegment=x})(mt||(mt={}));(e=>{(t=>{const r=class{constructor(m,x){this.ordinal=m,this.formatBits=x}};r.LOW=new r(0,1),r.MEDIUM=new r(1,0),r.QUARTILE=new r(2,3),r.HIGH=new r(3,2),t.Ecc=r})(e.QrCode||(e.QrCode={}))})(mt||(mt={}));(e=>{(t=>{const r=class{constructor(m,x){this.modeBits=m,this.numBitsCharCount=x}numCharCountBits(m){return this.numBitsCharCount[Math.floor((m+7)/17)]}};r.NUMERIC=new r(1,[10,12,14]),r.ALPHANUMERIC=new r(2,[9,11,13]),r.BYTE=new r(4,[8,16,16]),r.KANJI=new r(8,[8,10,12]),r.ECI=new r(7,[0,0,0]),t.Mode=r})(e.QrSegment||(e.QrSegment={}))})(mt||(mt={}));var gt=mt;var yf={L:gt.QrCode.Ecc.LOW,M:gt.QrCode.Ecc.MEDIUM,Q:gt.QrCode.Ecc.QUARTILE,H:gt.QrCode.Ecc.HIGH},to=128,ro="L",so="#FFFFFF",io="#000000",no=!1,oo=1,wf=4,Ef=0,kf=.1;function ao(e,t=0){const r=[];return e.forEach(function(a,m){let x=null;a.forEach(function(y,s){if(!y&&x!==null){r.push(`M${x+t} ${m+t}h${s-x}v1H${x+t}z`),x=null;return}if(s===a.length-1){if(!y)return;x===null?r.push(`M${s+t},${m+t} h1v1H${s+t}z`):r.push(`M${x+t},${m+t} h${s+1-x}v1H${x+t}z`);return}y&&x===null&&(x=s)})}),r.join("")}function lo(e,t){return e.slice().map((r,a)=>a<t.y||a>=t.y+t.h?r:r.map((m,x)=>x<t.x||x>=t.x+t.w?m:!1))}function Rf(e,t,r,a){if(a==null)return null;const m=e.length+r*2,x=Math.floor(t*kf),y=m/t,s=(a.width||x)*y,i=(a.height||x)*y,l=a.x==null?e.length/2-s/2:a.x*y,u=a.y==null?e.length/2-i/2:a.y*y,o=a.opacity==null?1:a.opacity;let p=null;if(a.excavate){let C=Math.floor(l),g=Math.floor(u),n=Math.ceil(s+l-C),d=Math.ceil(i+u-g);p={x:C,y:g,w:n,h:d}}const _=a.crossOrigin;return{x:l,y:u,h:i,w:s,excavation:p,opacity:o,crossOrigin:_}}function Df(e,t){return t!=null?Math.max(Math.floor(t),0):e?wf:Ef}function co({value:e,level:t,minVersion:r,includeMargin:a,marginSize:m,imageSettings:x,size:y,boostLevel:s}){let i=Z.useMemo(()=>{const C=(Array.isArray(e)?e:[e]).reduce((g,n)=>(g.push(...gt.QrSegment.makeSegments(n)),g),[]);return gt.QrCode.encodeSegments(C,yf[t],r,void 0,void 0,s)},[e,t,r,s]);const{cells:l,margin:u,numCells:o,calculatedImageSettings:p}=Z.useMemo(()=>{let _=i.getModules();const C=Df(a,m),g=_.length+C*2,n=Rf(_,y,C,x);return{cells:_,margin:C,numCells:g,calculatedImageSettings:n}},[i,y,x,a,m]);return{qrcode:i,margin:u,cells:l,numCells:o,calculatedImageSettings:p}}var Af=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Tf=Z.forwardRef(function(t,r){const a=t,{value:m,size:x=to,level:y=ro,bgColor:s=so,fgColor:i=io,includeMargin:l=no,minVersion:u=oo,boostLevel:o,marginSize:p,imageSettings:_}=a,g=ns(a,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=g,d=ns(g,["style"]),c=_?.src,h=Z.useRef(null),v=Z.useRef(null),b=Z.useCallback(I=>{h.current=I,typeof r=="function"?r(I):r&&(r.current=I)},[r]),[w,k]=Z.useState(!1),{margin:S,cells:E,numCells:T,calculatedImageSettings:L}=co({value:m,level:y,minVersion:u,boostLevel:o,includeMargin:l,marginSize:p,imageSettings:_,size:x});Z.useEffect(()=>{if(h.current!=null){const I=h.current,F=I.getContext("2d");if(!F)return;let H=E;const z=v.current,D=L!=null&&z!==null&&z.complete&&z.naturalHeight!==0&&z.naturalWidth!==0;D&&L.excavation!=null&&(H=lo(E,L.excavation));const j=window.devicePixelRatio||1;I.height=I.width=x*j;const P=x/T*j;F.scale(P,P),F.fillStyle=s,F.fillRect(0,0,T,T),F.fillStyle=i,Af?F.fill(new Path2D(ao(H,S))):E.forEach(function(O,$){O.forEach(function(q,X){q&&F.fillRect(X+S,$+S,1,1)})}),L&&(F.globalAlpha=L.opacity),D&&F.drawImage(z,L.x+S,L.y+S,L.w,L.h)}}),Z.useEffect(()=>{k(!1)},[c]);const M=is({height:x,width:x},n);let N=null;return c!=null&&(N=Z.createElement("img",{src:c,key:c,style:{display:"none"},onLoad:()=>{k(!0)},ref:v,crossOrigin:L?.crossOrigin})),Z.createElement(Z.Fragment,null,Z.createElement("canvas",is({style:M,height:x,width:x,ref:b,role:"img"},d)),N)});Tf.displayName="QRCodeCanvas";var ho=Z.forwardRef(function(t,r){const a=t,{value:m,size:x=to,level:y=ro,bgColor:s=so,fgColor:i=io,includeMargin:l=no,minVersion:u=oo,boostLevel:o,title:p,marginSize:_,imageSettings:C}=a,g=ns(a,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:d,numCells:c,calculatedImageSettings:h}=co({value:m,level:y,minVersion:u,boostLevel:o,includeMargin:l,marginSize:_,imageSettings:C,size:x});let v=d,b=null;C!=null&&h!=null&&(h.excavation!=null&&(v=lo(d,h.excavation)),b=Z.createElement("image",{href:C.src,height:h.h,width:h.w,x:h.x+n,y:h.y+n,preserveAspectRatio:"none",opacity:h.opacity,crossOrigin:h.crossOrigin}));const w=ao(v,n);return Z.createElement("svg",is({height:x,width:x,viewBox:`0 0 ${c} ${c}`,ref:r,role:"img"},g),!!p&&Z.createElement("title",null,p),Z.createElement("path",{fill:s,d:`M0,0 h${c}v${c}H0z`,shapeRendering:"crispEdges"}),Z.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),b)});ho.displayName="QRCodeSVG";function Lf(){return ut({queryKey:ce.tunnel.status,queryFn:()=>de.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function Mf(){const e=De();return Ue({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return de.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function jf(){const e=De();return Ue({mutationFn:()=>de.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function ki(){const{data:e}=Lf(),t=Mf(),r=jf(),[a,m]=R.useState(!1),[x,y]=R.useState(null),s=R.useRef(null),[i,l]=R.useState({top:0,right:0}),[u,o]=R.useState(!1),p=e?.running??!1,_=t.isPending,C=e?.shareableUrl,g=e?.token;R.useEffect(()=>{if(a&&s.current){const v=s.current.getBoundingClientRect();l({top:v.bottom+8,right:window.innerWidth-v.right})}},[a]);const n=R.useCallback(()=>{p?m(!0):t.mutate(void 0,{onSuccess:()=>m(!0)})},[p,t]),d=R.useCallback(()=>{C&&(navigator.clipboard.writeText(C),y("url"),setTimeout(()=>y(null),2e3))},[C]),c=R.useCallback(()=>{g&&(navigator.clipboard.writeText(g),y("token"),setTimeout(()=>y(null),2e3))},[g]),h=R.useCallback(()=>{r.mutate(),m(!1),o(!1)},[r]);return f.jsxs("div",{className:"relative",children:[f.jsx("button",{ref:s,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:_?f.jsx(Qe,{size:16,className:"animate-spin"}):f.jsx(vr,{size:16})}),p&&!_&&f.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),a&&p&&vt.createPortal(f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>m(!1)}),f.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:[f.jsxs("div",{className:"flex items-center justify-between mb-2",children:[f.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),"Tunnel Active"]}),f.jsx("button",{onClick:()=>m(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:f.jsx(_r,{size:14})})]}),g&&f.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:[f.jsx(ba,{size:12}),f.jsx("span",{children:"Token protected"})]}),C&&f.jsx("div",{className:"flex justify-center py-3",children:f.jsx(ho,{value:C,size:160})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("input",{readOnly:!0,value:C??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()}),f.jsx("button",{onClick:d,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:"Copy shareable link",children:x==="url"?f.jsx(ir,{size:14,className:"text-emerald-500"}):f.jsx(Ns,{size:14})})]}),g&&f.jsxs("div",{className:"mt-2",children:[f.jsx("button",{onClick:()=>o(!u),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:u?"Hide token":"Show token"}),u&&f.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[f.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}),f.jsx("button",{onClick:c,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:x==="token"?f.jsx(ir,{size:14,className:"text-emerald-500"}):f.jsx(Ns,{size:14})})]})]}),f.jsx("button",{onClick:h,disabled:r.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:r.isPending?"Stopping...":"Stop Tunnel"})]})]}),document.body)]})}const Ri={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Lt=R.lazy(()=>Li(()=>import("./modal--q8AO_f3.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.Modal}))),qr=R.lazy(()=>Li(()=>import("./folder-picker-BOT99D65.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12])).then(e=>({default:e.FolderPicker}))),Di=f.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:[f.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),f.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ai=f.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),Nf=260,Pf=600,Ti=400;function Yf(){const[e,t]=R.useState(null),[r,a]=R.useState(null),[m,x]=R.useState(Ti),[y,s]=R.useState(!1),[i,l]=R.useState(!1),[u,o]=R.useState(""),[p,_]=R.useState(""),[C,g]=R.useState(""),[n,d]=R.useState(""),[c,h]=R.useState(""),[v,b]=R.useState(""),[w,k]=R.useState([]),[S,E]=R.useState("idle"),T=R.useRef(!1),L=R.useRef(0),M=R.useRef(Ti),N=R.useRef(null),I=De(),{data:F,isLoading:H}=Do(),z=F?.data??[],D=R.useMemo(()=>z.map(tf),[z]),j=R.useMemo(()=>z.map(K=>K.id),[z]);cf(j);const{data:P,isLoading:O}=nf(r??""),$=Mo({queries:r?[]:z.map(K=>({queryKey:ce.tasks.list(K.id),queryFn:()=>de.get(`/projects/${K.id}/tasks`,{params:{limit:"100"}})}))}),q=!r&&$.some(K=>K.isLoading),X=R.useMemo(()=>{if(r)return P?.data??[];const K=[];for(const ne of $)ne.data?.data&&K.push(...ne.data.data);return K},[r,P,$]),G=R.useMemo(()=>X.map(sf),[X]),se=R.useMemo(()=>new Set,[]),A=R.useMemo(()=>{if(!e)return null;const K=G.find(me=>me.id===e);if(!K)return null;const ne=z.find(me=>me.id===K.projectId);return{id:K.id,projectId:K.projectId,projectName:ne?.name??"Unknown",projectColor:ne?.color??"text-neutral-500",title:K.title,status:K.status,branch:K.branch,mainBranch:ne?.mainBranch??"main",description:K.description}},[e,G,z]),B=Ao(),U=of(c),W=lf(),J=af(),Y=R.useCallback(K=>{W.mutate(K,{onSuccess:()=>{e===K&&t(null),I.invalidateQueries({queryKey:ce.tasks.all})}})},[W,e,I]),ie=R.useCallback((K,ne)=>{J.mutate({id:K,status:Zd(ne)},{onError:()=>{_o.error("状态变更失败,该操作不被允许")}})},[J]),ue=R.useCallback(K=>{K.preventDefault(),T.current=!0,L.current=K.clientX,M.current=m,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[m]);R.useEffect(()=>{const K=me=>{if(!T.current)return;const Be=me.clientX-L.current,Te=Math.max(Nf,Math.min(Pf,M.current+Be));x(Te)},ne=()=>{T.current&&(T.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",ne),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",ne)}},[]);const _e=R.useCallback(()=>{s(!0)},[]),we=R.useCallback(()=>{h(r??z[0]?.id??""),b(""),E("idle"),l(!0),de.get("/demo/agents").then(K=>{k(K.agents);const ne=K.agents.find(me=>me.available);ne&&b(ne.type)})},[r,z]),te=R.useCallback(()=>{s(!1),o(""),_("")},[]),ke=R.useCallback(()=>{S==="idle"&&(l(!1),g(""),d(""),h(""),b(""),E("idle"))},[S]),Ae=R.useCallback(async()=>{if(!(!u.trim()||!p.trim()))try{await B.mutateAsync({name:u.trim(),repoPath:p.trim()}),te()}catch{}},[u,p,B,te]),Q=Kn(),re=R.useCallback(async()=>{if(!(!C.trim()||!c))try{E("creating-task");const K=await U.mutateAsync({title:C.trim(),description:n.trim()||void 0});if(v){const ne=[C.trim(),n.trim()].filter(Boolean).join(`
|
|
74
|
+
|
|
75
|
+
`);E("creating-workspace");const me=await de.post(`/tasks/${K.id}/workspaces`,{});E("creating-session");const Be=await de.post(`/workspaces/${me.id}/sessions`,{agentType:v,prompt:ne});E("starting-session"),await Q.mutateAsync(Be.id),await I.invalidateQueries({queryKey:ce.workspaces.list(K.id)})}t(K.id),E("idle"),l(!1),g(""),d(""),h(""),b("")}catch{E("idle")}},[C,n,c,v,U,Q,I]),Se=H||O||q;return ff()?e&&A?f.jsxs(f.Fragment,{children:[f.jsx(xf,{task:A,onBack:()=>t(null),onDeleteTask:Y,isDeleting:W.isPending}),f.jsx(R.Suspense,{fallback:null,children:f.jsx(Lt,{isOpen:y,onClose:te,title:"Create New Project",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:te,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),f.jsx("button",{onClick:Ae,disabled:!u.trim()||!p.trim()||B.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${u.trim()&&p.trim()&&!B.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:B.isPending?"Creating...":"Create"})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project Name"}),f.jsx("input",{type:"text",value:u,onChange:K=>o(K.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})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Repository Path"}),f.jsx(qr,{value:p,onChange:_})]})]})})})]}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex flex-col h-dvh bg-neutral-50 overflow-hidden text-sm",children:[f.jsxs("header",{className:"h-12 bg-white border-b border-neutral-200 flex items-center px-4 justify-between shrink-0 z-10",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[Di,Ai]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(ki,{}),f.jsx(Ds,{to:"/settings",className:"p-1.5 text-neutral-400 active:text-neutral-900 rounded-md",children:f.jsx(Ls,{size:16})})]})]}),Se&&G.length===0?f.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-neutral-400",children:"Loading..."}):f.jsx(Ys,{tasks:G,projects:D,selectedTaskId:null,onSelectTask:t,filterProjectId:r,setFilterProjectId:a,width:"100%",onCreateProject:_e,onCreateTask:we,activeTaskIds:se,onTaskStatusChange:ie})]}),f.jsxs(R.Suspense,{fallback:null,children:[f.jsx(Lt,{isOpen:y,onClose:te,title:"Create New Project",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:te,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),f.jsx("button",{onClick:Ae,disabled:!u.trim()||!p.trim()||B.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${u.trim()&&p.trim()&&!B.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:B.isPending?"Creating...":"Create"})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project Name"}),f.jsx("input",{type:"text",value:u,onChange:K=>o(K.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})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Repository Path"}),f.jsx(qr,{value:p,onChange:_})]})]})}),f.jsx(Lt,{isOpen:i,onClose:ke,title:"Create New Task",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:ke,disabled:S!=="idle",className:"px-4 py-2 text-sm text-neutral-600 disabled:opacity-50",children:"Cancel"}),f.jsx("button",{onClick:re,disabled:!C.trim()||!c||S!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg ${C.trim()&&c&&S==="idle"?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Ri[S]})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex gap-3",children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project"}),f.jsx(Qt,{value:c,onChange:h,options:z.map(K=>({value:K.id,label:K.name})),placeholder:"Select project...",disabled:S!=="idle"})]}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Agent"}),f.jsx(Qt,{value:v,onChange:b,options:w.map(K=>({value:K.type,label:K.name+(K.available&&K.version?` (${K.version})`:""),disabled:!K.available})),placeholder:w.length===0?"Loading...":"Select agent...",disabled:S!=="idle"})]})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),f.jsx("input",{type:"text",value:C,onChange:K=>g(K.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:S!=="idle",onKeyDown:K=>{K.key==="Enter"&&!K.nativeEvent.isComposing&&K.nativeEvent.keyCode!==229&&re()}})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),f.jsx("textarea",{rows:3,value:n,onChange:K=>d(K.target.value),placeholder:"Optional...",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 resize-none",disabled:S!=="idle",onKeyDown:K=>{(K.metaKey||K.ctrlKey)&&K.key==="Enter"&&!K.nativeEvent.isComposing&&K.nativeEvent.keyCode!==229&&re()}})]})]})})]})]}):f.jsxs("div",{ref:N,className:"flex flex-col h-screen bg-neutral-50 overflow-hidden text-sm",children:[f.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:[f.jsxs("div",{className:"flex items-center gap-2",children:[Di,Ai]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(ki,{}),f.jsx(Ds,{to:"/settings",className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",children:f.jsx(Ls,{size:16})})]})]}),f.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[Se&&G.length===0?f.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..."}):f.jsx(Ys,{tasks:G,projects:D,selectedTaskId:e,onSelectTask:t,filterProjectId:r,setFilterProjectId:a,width:m,onCreateProject:_e,onCreateTask:we,activeTaskIds:se,onTaskStatusChange:ie,onDeleteTask:Y}),f.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"}),f.jsx(Gd,{task:A,onDeleteTask:Y,isDeleting:W.isPending,onTaskStatusChange:ie})]}),f.jsxs(R.Suspense,{fallback:null,children:[f.jsx(Lt,{isOpen:y,onClose:te,title:"Create New Project",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:te,className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors",children:"Cancel"}),f.jsx("button",{onClick:Ae,disabled:!u.trim()||!p.trim()||B.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${u.trim()&&p.trim()&&!B.isPending?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:B.isPending?"Creating...":"Create Project"})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project Name"}),f.jsx("input",{type:"text",value:u,onChange:K=>o(K.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})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Repository Path"}),f.jsx(qr,{value:p,onChange:_})]}),B.isError&&f.jsx("p",{className:"text-xs text-red-500",children:B.error instanceof Error?B.error.message:"Failed to create project"})]})}),f.jsx(Lt,{isOpen:i,onClose:ke,title:"Create New Task",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:ke,disabled:S!=="idle",className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:"Cancel"}),f.jsx("button",{onClick:re,disabled:!C.trim()||!c||S!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${C.trim()&&c&&S==="idle"?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Ri[S]})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex gap-3",children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project"}),f.jsx(Qt,{value:c,onChange:h,options:z.map(K=>({value:K.id,label:K.name})),placeholder:"Select project...",disabled:S!=="idle"})]}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Agent"}),f.jsx(Qt,{value:v,onChange:b,options:w.map(K=>({value:K.type,label:K.name+(K.available&&K.version?` (${K.version})`:""),disabled:!K.available})),placeholder:w.length===0?"Loading...":"Select agent...",disabled:S!=="idle"})]})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),f.jsx("input",{type:"text",value:C,onChange:K=>g(K.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:S!=="idle",onKeyDown:K=>{K.key==="Enter"&&!K.nativeEvent.isComposing&&K.nativeEvent.keyCode!==229&&re()}})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),f.jsx("textarea",{rows:3,value:n,onChange:K=>d(K.target.value),placeholder:"Optional description...",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors resize-none",disabled:S!=="idle",onKeyDown:K=>{(K.metaKey||K.ctrlKey)&&K.key==="Enter"&&!K.nativeEvent.isComposing&&K.nativeEvent.keyCode!==229&&re()}})]}),U.isError&&f.jsx("p",{className:"text-xs text-red-500",children:U.error instanceof Error?U.error.message:"Failed to create task"})]})})]})]})}export{Yf as ProjectKanbanPage};
|